|
|
|
@ -16,6 +16,10 @@ import jnpf.model.warehousingoutbound.WarehousingOutboundForm;
|
|
|
|
|
import jnpf.model.warehousingoutbound.WarehousingOutboundProductModel;
|
|
|
|
|
import jnpf.model.warehousingreceive.WarehousingReceiveForm;
|
|
|
|
|
import jnpf.model.warehousingreceive.WarehousingReceiveProductModel;
|
|
|
|
|
import jnpf.model.warehousingreportloss.WarehousingReportlossForm;
|
|
|
|
|
import jnpf.model.warehousingreportloss.WarehousingReportlossProductModel;
|
|
|
|
|
import jnpf.model.warehousingreturn.WarehousingReturnForm;
|
|
|
|
|
import jnpf.model.warehousingreturn.WarehousingReturnProductModel;
|
|
|
|
|
import jnpf.model.warehousingstorage.WarehousingStorageForm;
|
|
|
|
|
import jnpf.model.warehousingstorage.WarehousingStoragePoundlistModel;
|
|
|
|
|
import jnpf.model.warehousingstorage.WarehousingStorageProductModel;
|
|
|
|
@ -30,6 +34,7 @@ import org.springframework.beans.BeanUtils;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
import javax.validation.Valid;
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import jnpf.annotation.JnpfField;
|
|
|
|
|
import jnpf.base.vo.PageListVO;
|
|
|
|
@ -94,6 +99,10 @@ public class WorkOrderController {
|
|
|
|
|
@Autowired WarehousingReceiveController warehousingReceiveController;
|
|
|
|
|
@Autowired
|
|
|
|
|
private WarehousingOutboundController warehousingOutboundController;
|
|
|
|
|
@Autowired
|
|
|
|
|
private WarehousingReturnController warehousingReturnController;
|
|
|
|
|
@Autowired
|
|
|
|
|
private WarehousingReportlossController warehousingReportlossController;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
@ -419,7 +428,7 @@ public class WorkOrderController {
|
|
|
|
|
if(flowTaskNodeEntityList != null && "end".equals(flowTaskNodeEntityList.get(0).getNodeNext())){
|
|
|
|
|
//审核通过
|
|
|
|
|
if (workOrderForm.getType().equals("1")){
|
|
|
|
|
workOrderForm.setStatus("4");
|
|
|
|
|
workOrderForm.setStatus("5");
|
|
|
|
|
} else if (workOrderForm.getType().equals("2")){
|
|
|
|
|
workOrderForm.setStatus("2");
|
|
|
|
|
}
|
|
|
|
@ -443,8 +452,8 @@ public class WorkOrderController {
|
|
|
|
|
warehousingStorageForm.setWarehousingStorageProductList(list);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
warehousingStorageController.create(id,warehousingStorageForm);
|
|
|
|
|
//原材料生成领用单和出库单
|
|
|
|
|
warehousingStorageController.createWork(id,warehousingStorageForm);
|
|
|
|
|
//原材料生成领用单和出库单和返库单和报损单
|
|
|
|
|
//领用单
|
|
|
|
|
WarehousingReceiveForm warehousingReceiveForm=new WarehousingReceiveForm();
|
|
|
|
|
warehousingReceiveForm.setWarehouseId(workOrderForm.getWarehouseId()); //仓库
|
|
|
|
@ -472,11 +481,9 @@ public class WorkOrderController {
|
|
|
|
|
receiveWrapper.lambda().eq(WarehousingReceiveEntity::getBusinessId, id);
|
|
|
|
|
// flowTaskNodeEntityQueryWrapper.lambda().eq(WarehousingReceiveEntity::getTaskId, flowTaskEntity.getId());
|
|
|
|
|
List<WarehousingReceiveEntity> warehousingReceiveEntityList = warehousingReceiveService.list(receiveWrapper);
|
|
|
|
|
|
|
|
|
|
warehousingOutboundForm.setWarehousingOutboundType("14");
|
|
|
|
|
warehousingOutboundForm.setWarehousingId(warehousingReceiveEntityList.get(0).getId());
|
|
|
|
|
warehousingOutboundForm.setWarehouseId(warehousingReceiveForm.getWarehouseId());
|
|
|
|
|
|
|
|
|
|
List<WarehousingOutboundProductModel> warehousingOutboundProductModelList =new ArrayList<>();
|
|
|
|
|
for (WarehousingReceiveProductModel warehousingReceiveProductModel1:warehousingReceiveList){
|
|
|
|
|
WarehousingOutboundProductModel warehousingOutboundProductModel=new WarehousingOutboundProductModel();
|
|
|
|
@ -485,11 +492,61 @@ public class WorkOrderController {
|
|
|
|
|
warehousingOutboundProductModel.setOutboundUnit(unit); //加工单位
|
|
|
|
|
warehousingOutboundProductModel.setOutboundNumber(warehousingReceiveProductModel1.getUsedreturnNumber()); //实际发货量
|
|
|
|
|
warehousingOutboundProductModelList.add(warehousingOutboundProductModel);
|
|
|
|
|
|
|
|
|
|
warehousingOutboundForm.setWarehousingOutboundProductList(warehousingOutboundProductModelList);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
warehousingOutboundController.create(id,warehousingOutboundForm);
|
|
|
|
|
warehousingOutboundController.createWork(id,warehousingOutboundForm);
|
|
|
|
|
//返库单
|
|
|
|
|
WarehousingReturnForm warehousingReturnForm=new WarehousingReturnForm();
|
|
|
|
|
warehousingReturnForm.setBusinessId(workOrderForm.getId());
|
|
|
|
|
warehousingReturnForm.setWarehouseId(workOrderForm.getWarehouseId());
|
|
|
|
|
warehousingReturnForm.setReturnReason("8");
|
|
|
|
|
warehousingReturnForm.setRemark(workOrderForm.getRemark());
|
|
|
|
|
BigDecimal retNum = new BigDecimal("0");
|
|
|
|
|
BigDecimal zero = BigDecimal.ZERO;
|
|
|
|
|
List<WarehousingReturnProductModel> warehousingReturnProductModelList =new ArrayList<>();
|
|
|
|
|
for (WorkOrderPrimaryModel WorkOrderPrimaryModel:workOrderForm.getWorkOrderPrimaryList()){
|
|
|
|
|
if (WorkOrderPrimaryModel.getReturnNum()==null||WorkOrderPrimaryModel.getReturnNum().equals("0")){
|
|
|
|
|
}else{
|
|
|
|
|
WarehousingReturnProductModel warehousingReturnProductModel=new WarehousingReturnProductModel();
|
|
|
|
|
warehousingReturnProductModel.setProductId(WorkOrderPrimaryModel.getProductId());
|
|
|
|
|
warehousingReturnProductModel.setReturnUnit(unit);
|
|
|
|
|
warehousingReturnProductModel.setCargoId(WorkOrderPrimaryModel.getCargoId());
|
|
|
|
|
warehousingReturnProductModel.setReturnNumber(WorkOrderPrimaryModel.getReturnNum());
|
|
|
|
|
warehousingReturnProductModelList.add(warehousingReturnProductModel);
|
|
|
|
|
warehousingReturnForm.setWarehousingReturnProductList(warehousingReturnProductModelList);
|
|
|
|
|
retNum =new BigDecimal(WorkOrderPrimaryModel.getReturnNum());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (retNum.compareTo(zero)>0){
|
|
|
|
|
warehousingReturnController.createWork(id,warehousingReturnForm);
|
|
|
|
|
}
|
|
|
|
|
//报损单
|
|
|
|
|
WarehousingReportlossForm warehousingReportlossForm=new WarehousingReportlossForm();
|
|
|
|
|
warehousingReportlossForm.setReportlossType("4");
|
|
|
|
|
warehousingReportlossForm.setReportlossReason("5");
|
|
|
|
|
warehousingReportlossForm.setWarehouseId(workOrderForm.getWarehouseId());
|
|
|
|
|
warehousingReportlossForm.setBusinessId(workOrderForm.getId());
|
|
|
|
|
warehousingReportlossForm.setRemark(workOrderForm.getRemark());
|
|
|
|
|
BigDecimal retNum1 = new BigDecimal("0");
|
|
|
|
|
BigDecimal zero1 = BigDecimal.ZERO;
|
|
|
|
|
List<WarehousingReportlossProductModel> warehousingReportlossProductModelList =new ArrayList<>();
|
|
|
|
|
for (WorkOrderPrimaryModel WorkOrderPrimaryModel:workOrderForm.getWorkOrderPrimaryList()){
|
|
|
|
|
if (WorkOrderPrimaryModel.getReportlossNum()==null||WorkOrderPrimaryModel.getReportlossNum().equals("0")){
|
|
|
|
|
}else{
|
|
|
|
|
WarehousingReportlossProductModel warehousingReportlossProductModel=new WarehousingReportlossProductModel();
|
|
|
|
|
warehousingReportlossProductModel.setProductId(WorkOrderPrimaryModel.getProductId());
|
|
|
|
|
warehousingReportlossProductModel.setReportlossUnit(unit);
|
|
|
|
|
warehousingReportlossProductModel.setCargoId(WorkOrderPrimaryModel.getCargoId());
|
|
|
|
|
warehousingReportlossProductModel.setReportlossNumber(WorkOrderPrimaryModel.getReportlossNum());
|
|
|
|
|
warehousingReportlossProductModelList.add(warehousingReportlossProductModel);
|
|
|
|
|
warehousingReportlossForm.setWarehousingReportlossProductList(warehousingReportlossProductModelList);
|
|
|
|
|
retNum1 =new BigDecimal(WorkOrderPrimaryModel.getReportlossNum());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (retNum1.compareTo(zero1)>0){
|
|
|
|
|
warehousingReportlossController.createWork(id,warehousingReportlossForm);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -576,6 +633,44 @@ public class WorkOrderController {
|
|
|
|
|
return ActionResult.success(workOrderMap);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取详情(编辑页)完成加工
|
|
|
|
|
* 编辑页面使用-不转换数据
|
|
|
|
|
* @param id
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@Operation(summary = "信息")
|
|
|
|
|
@GetMapping("/work/{id}")
|
|
|
|
|
public ActionResult infoWork(@PathVariable("id") String id){
|
|
|
|
|
WorkOrderEntity entity= workOrderService.getInfo(id);
|
|
|
|
|
if(entity==null){
|
|
|
|
|
return ActionResult.fail("表单数据不存在!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Map<String, Object> workOrderMap=JsonUtil.entityToMap(entity);
|
|
|
|
|
workOrderMap.put("id", workOrderMap.get("id"));
|
|
|
|
|
//副表数据
|
|
|
|
|
//子表数据
|
|
|
|
|
List<WorkOrderProductEntity> workOrderProductList = workOrderService.getWorkOrderProductList(entity.getId());
|
|
|
|
|
// List<WorkOrderProductEntity> workOrderProductEntityList =new ArrayList<>();
|
|
|
|
|
for (WorkOrderProductEntity workOrderProductEntity:workOrderProductList){
|
|
|
|
|
workOrderProductEntity.setNums(workOrderProductEntity.getProportionNum());
|
|
|
|
|
workOrderProductEntity.setProportionNum(null);
|
|
|
|
|
// workOrderProductEntityList.add(workOrderProductEntity);
|
|
|
|
|
}
|
|
|
|
|
workOrderMap.put("workOrderProductList",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(workOrderProductList)));
|
|
|
|
|
List<WorkOrderPrimaryEntity> workOrderPrimaryList = workOrderService.getWorkOrderPrimaryList(entity.getId());
|
|
|
|
|
for (WorkOrderPrimaryEntity workOrderPrimaryEntity:workOrderPrimaryList){
|
|
|
|
|
workOrderPrimaryEntity.setReturnNum(null);
|
|
|
|
|
workOrderPrimaryEntity.setReportlossNum(null);
|
|
|
|
|
workOrderPrimaryEntity.setRealityNum(null);
|
|
|
|
|
}
|
|
|
|
|
workOrderMap.put("workOrderPrimaryList",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(workOrderPrimaryList)));
|
|
|
|
|
workOrderMap = generaterSwapUtil.swapDataForm(workOrderMap,WorkOrderConstant.getFormData(),WorkOrderConstant.TABLEFIELDKEY,WorkOrderConstant.TABLERENAMES);
|
|
|
|
|
return ActionResult.success(workOrderMap);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 更新状态
|
|
|
|
|
* @param id
|
|
|
|
@ -611,21 +706,197 @@ public class WorkOrderController {
|
|
|
|
|
|
|
|
|
|
List<BomEntity> workBomlist= workOrderService.getWorkBom(id);
|
|
|
|
|
for (BomEntity bomEntity:workBomlist){
|
|
|
|
|
QueryWrapper<BomItemValueEntity> bomEntityQueryWrapper = new QueryWrapper<>();
|
|
|
|
|
bomEntityQueryWrapper.lambda().eq(BomItemValueEntity::getBomId,bomEntity.getId());
|
|
|
|
|
List<BomItemValueEntity> bomItemValueEntityList = bomItemValueService.list(bomEntityQueryWrapper);
|
|
|
|
|
bomEntity.setBomItemValueEntityList(bomItemValueEntityList);
|
|
|
|
|
|
|
|
|
|
List<ProductWarehouseEntity> productList =new ArrayList<>();
|
|
|
|
|
for (BomItemValueEntity bomItemValueEntity : bomItemValueEntityList){
|
|
|
|
|
List<ProductWarehouseEntity> productWarehouseEntityList=workOrderService.getWorkBomProduct(bomItemValueEntity.getProductId());
|
|
|
|
|
productList.addAll(productWarehouseEntityList);
|
|
|
|
|
}
|
|
|
|
|
bomEntity.setProductWarehouseEntityList(productList);
|
|
|
|
|
// QueryWrapper<BomItemValueEntity> bomEntityQueryWrapper = new QueryWrapper<>();
|
|
|
|
|
// bomEntityQueryWrapper.lambda().eq(BomItemValueEntity::getBomId,bomEntity.getId());
|
|
|
|
|
// List<BomItemValueEntity> bomItemValueEntityList = bomItemValueService.list(bomEntityQueryWrapper);
|
|
|
|
|
// bomEntity.setBomItemValueEntityList(bomItemValueEntityList);
|
|
|
|
|
// List<ProductWarehouseEntity> productList =new ArrayList<>();
|
|
|
|
|
// for (BomItemValueEntity bomItemValueEntity : bomItemValueEntityList){
|
|
|
|
|
// List<ProductWarehouseEntity> productWarehouseEntityList=workOrderService.getWorkBomProduct(bomItemValueEntity.getProductId());
|
|
|
|
|
List<ProductWarehouseEntity> productWarehouseEntityList=workOrderService.getWorkBomProduct(bomEntity.getId());
|
|
|
|
|
// productList.addAll(productWarehouseEntityList);
|
|
|
|
|
// }
|
|
|
|
|
// bomEntity.setProductWarehouseEntityList(productList);
|
|
|
|
|
bomEntity.setProductWarehouseEntityList(productWarehouseEntityList);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ActionResult.success(workBomlist);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 编辑状态
|
|
|
|
|
* @param id
|
|
|
|
|
* @param workOrderForm
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@PutMapping("/workStatus/{id}")
|
|
|
|
|
@Operation(summary = "编辑状态")
|
|
|
|
|
public ActionResult updateWorkStatus(@PathVariable("id") String id,@RequestBody @Valid WorkOrderForm workOrderForm,
|
|
|
|
|
@RequestParam(value = "isImport", required = false) boolean isImport){
|
|
|
|
|
workOrderForm.setId(id);
|
|
|
|
|
WorkOrderEntity entity= workOrderService.getInfo(id);
|
|
|
|
|
if(entity!=null){
|
|
|
|
|
try{
|
|
|
|
|
BigDecimal bigworknums;
|
|
|
|
|
BigDecimal retNums;
|
|
|
|
|
BigDecimal zeros = BigDecimal.ZERO;
|
|
|
|
|
QueryWrapper<WorkOrderProductEntity> workOrderProductEntityQueryWrapper =new QueryWrapper<>();
|
|
|
|
|
workOrderProductEntityQueryWrapper.lambda().eq(WorkOrderProductEntity::getWorkId, id);
|
|
|
|
|
List<WorkOrderProductEntity> workOrderProductEntityList = workOrderProductService.list(workOrderProductEntityQueryWrapper);
|
|
|
|
|
bigworknums = workOrderProductEntityList.get(0).getProportionNum(); //成品之前加工数
|
|
|
|
|
retNums = new BigDecimal(workOrderForm.getWorkOrderProductList().get(0).getProportionNum()); //成品现在加工数量
|
|
|
|
|
bigworknums = bigworknums.add(retNums);
|
|
|
|
|
|
|
|
|
|
List<WorkOrderProductModel> workOrderProductModels =new ArrayList<>();
|
|
|
|
|
for (WorkOrderProductModel workOrderProductModel:workOrderForm.getWorkOrderProductList()){
|
|
|
|
|
//加工数量和计划加工数量对比
|
|
|
|
|
workOrderProductModel.setProportionNum(String.valueOf(bigworknums));
|
|
|
|
|
BigDecimal planNum = new BigDecimal(workOrderProductModel.getPlanNum());
|
|
|
|
|
BigDecimal planNum1 =planNum.subtract(retNums);
|
|
|
|
|
|
|
|
|
|
planNum = planNum.subtract(bigworknums);
|
|
|
|
|
int result = planNum.compareTo(zeros);
|
|
|
|
|
if (result>0){
|
|
|
|
|
// System.out.println("刚好大于0");
|
|
|
|
|
// workOrderForm.setStatus("4");
|
|
|
|
|
}else if (result==0){
|
|
|
|
|
// System.out.println("刚好等于0");
|
|
|
|
|
workOrderForm.setStatus("5");
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
|
|
return ActionResult.fail("加工数量不能大于计划加工数量,"+"现在已经加工数量是"+planNum1);
|
|
|
|
|
}
|
|
|
|
|
workOrderProductModels.add(workOrderProductModel);
|
|
|
|
|
}
|
|
|
|
|
workOrderForm.setWorkOrderProductList(workOrderProductModels);
|
|
|
|
|
workOrderService.saveOrUpdateWork(workOrderForm,id,false);
|
|
|
|
|
|
|
|
|
|
if (workOrderForm.getType().equals("2")){
|
|
|
|
|
//成品生成入库单
|
|
|
|
|
WarehousingStorageForm warehousingStorageForm=new WarehousingStorageForm();
|
|
|
|
|
warehousingStorageForm.setWarehousingStorageType("14");
|
|
|
|
|
warehousingStorageForm.setWarehousingId(workOrderForm.getId());
|
|
|
|
|
warehousingStorageForm.setWarehouseId(workOrderForm.getWarehouseId());
|
|
|
|
|
List<WarehousingStorageProductModel> list =new ArrayList<>();
|
|
|
|
|
for (WorkOrderProductModel workOrderProductModel:workOrderForm.getWorkOrderProductList()){
|
|
|
|
|
WarehousingStorageProductModel warehousingStorageProductModel=new WarehousingStorageProductModel();
|
|
|
|
|
warehousingStorageProductModel.setProductId(workOrderProductModel.getProductId());
|
|
|
|
|
warehousingStorageProductModel.setStorageAreaId(workOrderProductModel.getCargoId());
|
|
|
|
|
warehousingStorageProductModel.setStorageUnit(workOrderProductModel.getUnitId()); //加工单位
|
|
|
|
|
warehousingStorageProductModel.setStorageNumber(workOrderProductModel.getProportionNum());
|
|
|
|
|
list.add(warehousingStorageProductModel);
|
|
|
|
|
|
|
|
|
|
warehousingStorageForm.setWarehousingStorageProductList(list);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
warehousingStorageController.createWork(id,warehousingStorageForm);
|
|
|
|
|
//原材料生成领用单和出库单和返库单和报损单
|
|
|
|
|
//领用单
|
|
|
|
|
WarehousingReceiveForm warehousingReceiveForm=new WarehousingReceiveForm();
|
|
|
|
|
warehousingReceiveForm.setWarehouseId(workOrderForm.getWarehouseId()); //仓库
|
|
|
|
|
warehousingReceiveForm.setUsedreturnStatus("4");
|
|
|
|
|
warehousingReceiveForm.setUsedreturnReason("8");
|
|
|
|
|
warehousingReceiveForm.setBusinessId(workOrderForm.getId()); //关联单据 加工单
|
|
|
|
|
warehousingReceiveForm.setRemark(workOrderForm.getRemark());
|
|
|
|
|
List<WarehousingReceiveProductModel> warehousingReceiveList =new ArrayList<>();
|
|
|
|
|
String unit=workOrderForm.getWorkOrderProductList().get(0).getUnitId();
|
|
|
|
|
for (WorkOrderPrimaryModel WorkOrderPrimaryModel:workOrderForm.getWorkOrderPrimaryList()){
|
|
|
|
|
WarehousingReceiveProductModel warehousingReceiveProductModel=new WarehousingReceiveProductModel();
|
|
|
|
|
warehousingReceiveProductModel.setProductId(WorkOrderPrimaryModel.getProductId());
|
|
|
|
|
warehousingReceiveProductModel.setCargoId(WorkOrderPrimaryModel.getCargoId());
|
|
|
|
|
warehousingReceiveProductModel.setUsedreturnUnit(unit); //加工单位
|
|
|
|
|
warehousingReceiveProductModel.setUsedreturnNumber(WorkOrderPrimaryModel.getRealityNum()); //实际发货量
|
|
|
|
|
warehousingReceiveList.add(warehousingReceiveProductModel);
|
|
|
|
|
|
|
|
|
|
warehousingReceiveForm.setWarehousingReceiveProductList(warehousingReceiveList);
|
|
|
|
|
}
|
|
|
|
|
warehousingReceiveController.createWorkOrder(id,warehousingReceiveForm);
|
|
|
|
|
//出库单
|
|
|
|
|
WarehousingOutboundForm warehousingOutboundForm=new WarehousingOutboundForm();
|
|
|
|
|
// WarehousingReceiveEntity receiveentity= warehousingReceiveService.getInfo(warehousingOutboundForm.getId());
|
|
|
|
|
QueryWrapper<WarehousingReceiveEntity> receiveWrapper = new QueryWrapper<>();
|
|
|
|
|
receiveWrapper.lambda().eq(WarehousingReceiveEntity::getBusinessId, id);
|
|
|
|
|
// flowTaskNodeEntityQueryWrapper.lambda().eq(WarehousingReceiveEntity::getTaskId, flowTaskEntity.getId());
|
|
|
|
|
List<WarehousingReceiveEntity> warehousingReceiveEntityList = warehousingReceiveService.list(receiveWrapper);
|
|
|
|
|
warehousingOutboundForm.setWarehousingOutboundType("14");
|
|
|
|
|
warehousingOutboundForm.setWarehousingId(warehousingReceiveEntityList.get(0).getId());
|
|
|
|
|
warehousingOutboundForm.setWarehouseId(warehousingReceiveForm.getWarehouseId());
|
|
|
|
|
List<WarehousingOutboundProductModel> warehousingOutboundProductModelList =new ArrayList<>();
|
|
|
|
|
for (WarehousingReceiveProductModel warehousingReceiveProductModel1:warehousingReceiveList){
|
|
|
|
|
WarehousingOutboundProductModel warehousingOutboundProductModel=new WarehousingOutboundProductModel();
|
|
|
|
|
warehousingOutboundProductModel.setProductId(warehousingReceiveProductModel1.getProductId());
|
|
|
|
|
warehousingOutboundProductModel.setOutboundAreaId(warehousingReceiveProductModel1.getCargoId());
|
|
|
|
|
warehousingOutboundProductModel.setOutboundUnit(unit); //加工单位
|
|
|
|
|
warehousingOutboundProductModel.setOutboundNumber(warehousingReceiveProductModel1.getUsedreturnNumber()); //实际发货量
|
|
|
|
|
warehousingOutboundProductModelList.add(warehousingOutboundProductModel);
|
|
|
|
|
warehousingOutboundForm.setWarehousingOutboundProductList(warehousingOutboundProductModelList);
|
|
|
|
|
}
|
|
|
|
|
warehousingOutboundController.createWork(id,warehousingOutboundForm);
|
|
|
|
|
//返库单
|
|
|
|
|
WarehousingReturnForm warehousingReturnForm=new WarehousingReturnForm();
|
|
|
|
|
warehousingReturnForm.setBusinessId(workOrderForm.getId());
|
|
|
|
|
warehousingReturnForm.setWarehouseId(workOrderForm.getWarehouseId());
|
|
|
|
|
warehousingReturnForm.setReturnReason("8");
|
|
|
|
|
warehousingReturnForm.setRemark(workOrderForm.getRemark());
|
|
|
|
|
BigDecimal retNum = new BigDecimal("0");
|
|
|
|
|
BigDecimal zero = BigDecimal.ZERO;
|
|
|
|
|
List<WarehousingReturnProductModel> warehousingReturnProductModelList =new ArrayList<>();
|
|
|
|
|
for (WorkOrderPrimaryModel WorkOrderPrimaryModel:workOrderForm.getWorkOrderPrimaryList()){
|
|
|
|
|
if (WorkOrderPrimaryModel.getReturnNum()==null||WorkOrderPrimaryModel.getReturnNum().equals("0")){
|
|
|
|
|
}else{
|
|
|
|
|
WarehousingReturnProductModel warehousingReturnProductModel=new WarehousingReturnProductModel();
|
|
|
|
|
warehousingReturnProductModel.setProductId(WorkOrderPrimaryModel.getProductId());
|
|
|
|
|
warehousingReturnProductModel.setReturnUnit(unit);
|
|
|
|
|
warehousingReturnProductModel.setCargoId(WorkOrderPrimaryModel.getCargoId());
|
|
|
|
|
warehousingReturnProductModel.setReturnNumber(WorkOrderPrimaryModel.getReturnNum());
|
|
|
|
|
warehousingReturnProductModelList.add(warehousingReturnProductModel);
|
|
|
|
|
warehousingReturnForm.setWarehousingReturnProductList(warehousingReturnProductModelList);
|
|
|
|
|
retNum =new BigDecimal(WorkOrderPrimaryModel.getReturnNum());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (retNum.compareTo(zero)>0){
|
|
|
|
|
warehousingReturnController.createWork(id,warehousingReturnForm);
|
|
|
|
|
}
|
|
|
|
|
//报损单
|
|
|
|
|
WarehousingReportlossForm warehousingReportlossForm=new WarehousingReportlossForm();
|
|
|
|
|
warehousingReportlossForm.setReportlossType("4");
|
|
|
|
|
warehousingReportlossForm.setReportlossReason("5");
|
|
|
|
|
warehousingReportlossForm.setWarehouseId(workOrderForm.getWarehouseId());
|
|
|
|
|
warehousingReportlossForm.setBusinessId(workOrderForm.getId());
|
|
|
|
|
warehousingReportlossForm.setRemark(workOrderForm.getRemark());
|
|
|
|
|
BigDecimal retNum1 = new BigDecimal("0");
|
|
|
|
|
BigDecimal zero1 = BigDecimal.ZERO;
|
|
|
|
|
List<WarehousingReportlossProductModel> warehousingReportlossProductModelList =new ArrayList<>();
|
|
|
|
|
for (WorkOrderPrimaryModel WorkOrderPrimaryModel:workOrderForm.getWorkOrderPrimaryList()){
|
|
|
|
|
if (WorkOrderPrimaryModel.getReportlossNum()==null||WorkOrderPrimaryModel.getReportlossNum().equals("0")){
|
|
|
|
|
}else{
|
|
|
|
|
WarehousingReportlossProductModel warehousingReportlossProductModel=new WarehousingReportlossProductModel();
|
|
|
|
|
warehousingReportlossProductModel.setProductId(WorkOrderPrimaryModel.getProductId());
|
|
|
|
|
warehousingReportlossProductModel.setReportlossUnit(unit);
|
|
|
|
|
warehousingReportlossProductModel.setCargoId(WorkOrderPrimaryModel.getCargoId());
|
|
|
|
|
warehousingReportlossProductModel.setReportlossNumber(WorkOrderPrimaryModel.getReportlossNum());
|
|
|
|
|
warehousingReportlossProductModelList.add(warehousingReportlossProductModel);
|
|
|
|
|
warehousingReportlossForm.setWarehousingReportlossProductList(warehousingReportlossProductModelList);
|
|
|
|
|
retNum1 =new BigDecimal(WorkOrderPrimaryModel.getReportlossNum());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (retNum1.compareTo(zero1)>0){
|
|
|
|
|
warehousingReportlossController.createWork(id,warehousingReportlossForm);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}catch(Exception e){
|
|
|
|
|
return ActionResult.fail("修改数据失败");
|
|
|
|
|
}
|
|
|
|
|
return ActionResult.success("更新成功");
|
|
|
|
|
}else{
|
|
|
|
|
return ActionResult.fail("更新失败,数据不存在");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|