diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysMakeOrderController.java b/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysMakeOrderController.java index 54c90bdf..719b9d37 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysMakeOrderController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysMakeOrderController.java @@ -491,7 +491,7 @@ public class SysMakeOrderController extends BaseController makeOrder.setCustomerOderCode(sysSalesOrder.getSalesOrderNumber()); makeOrder.setMaterial(String.valueOf(sysSalesOrder.getMaterialSum())); //这个类型需要注意 - // makeOrder.setMaterialSum(sysSalesOrder.getEnterpriseSum()); + makeOrder.setMaterialSum(sysSalesOrder.getEnterpriseSum()); } } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysMakeorderBomController.java b/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysMakeorderBomController.java index 3a802eea..24463965 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysMakeorderBomController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysMakeorderBomController.java @@ -59,6 +59,20 @@ public class SysMakeorderBomController extends BaseController return getDataTable(list); } + /** + * 查询生产订单入库BOM信息列表(生产加工类型才需要生产入库) + */ + @PostMapping("/storageList") + @ResponseBody + public TableDataInfo storageList(SysMakeorderBom sysMakeorderBom) + { + startPage(); + List list = sysMakeorderBomService.selectSysMakeorderBomList(sysMakeorderBom); + List filterList = list.stream() + .filter(item -> item.getProcessMethod().equals("1")).collect(Collectors.toList()); + return getDataTable(filterList); + } + /* * 获取工程审核页面生产bom(去除辅料原料及加工方式为采购)*/ @PostMapping("/selectedList") diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysMakeOrder.java b/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysMakeOrder.java index 24cc69ef..4d8980f4 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysMakeOrder.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysMakeOrder.java @@ -74,15 +74,15 @@ public class SysMakeOrder extends BaseEntity /** 数量合计 */ @Excel(name = "数量合计") - private Long materialSum; + private int materialSum; /** 已完成数量 */ @Excel(name = "已完成数量") - private Long finishNum; + private int finishNum; /** 已入库数量 */ @Excel(name = "已入库数量") - private Long eceiptNum; + private int eceiptNum; /** 不含税生产成本(RMB) */ @Excel(name = "不含税生产成本(RMB)") @@ -219,30 +219,30 @@ public class SysMakeOrder extends BaseEntity { return material; } - public void setMaterialSum(Long materialSum) + public void setMaterialSum(int materialSum) { this.materialSum = materialSum; } - public Long getMaterialSum() + public int getMaterialSum() { return materialSum; } - public void setFinishNum(Long finishNum) + public void setFinishNum(int finishNum) { this.finishNum = finishNum; } - public Long getFinishNum() + public int getFinishNum() { return finishNum; } - public void setEceiptNum(Long eceiptNum) + public void setEceiptNum(int eceiptNum) { this.eceiptNum = eceiptNum; } - public Long getEceiptNum() + public int getEceiptNum() { return eceiptNum; } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysMakeOrderServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysMakeOrderServiceImpl.java index 4014ce44..78796e79 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysMakeOrderServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysMakeOrderServiceImpl.java @@ -19,9 +19,11 @@ import com.ruoyi.purchase.service.IPurchasePlanService; import com.ruoyi.quality.domain.QualityOrder; import com.ruoyi.quality.domain.QualityOrderDetail; import com.ruoyi.quality.domain.QualityOrderReport; +import com.ruoyi.quality.domain.QualityShippingDevice; import com.ruoyi.quality.mapper.QualityOrderDetailMapper; import com.ruoyi.quality.mapper.QualityOrderMapper; import com.ruoyi.quality.mapper.QualityOrderReportMapper; +import com.ruoyi.quality.mapper.QualityShippingDeviceMapper; import com.ruoyi.system.domain.*; import com.ruoyi.system.dto.SysEquipDetailDto; import com.ruoyi.system.dto.SysEquipMaterialDto; @@ -107,6 +109,9 @@ public class SysMakeOrderServiceImpl implements ISysMakeOrderService @Autowired private ErpMaterialMapper erpMaterialMapper; + + @Autowired + private QualityShippingDeviceMapper qualityDeviceMapper; /** * 查询生产订单 * @@ -259,7 +264,7 @@ public class SysMakeOrderServiceImpl implements ISysMakeOrderService makeOrder.setCustomerName(sysSalesOrderVo.getEnterpriseName()); makeOrder.setCustomerOderCode(sysSalesOrderVo.getSalesOrderNumber()); //这里需要注意一下类型 - //makeOrder.setMaterialSum(sysSalesOrderVo.getEnterpriseSum()); + makeOrder.setMaterialSum(sysSalesOrderVo.getEnterpriseSum()); makeOrder.setMaterial(String.valueOf(sysSalesOrderVo.getMaterialSum())); String makeNo = redisCache.generateBillNo("PO"); makeOrder.setMakeNo(makeNo); @@ -589,6 +594,7 @@ public class SysMakeOrderServiceImpl implements ISysMakeOrderService @Override public int addProduceInboundSave(ErpInboundOrder erpInboundOrder) { String loginName = ShiroUtils.getLoginName(); + String makeNo = erpInboundOrder.getMakeNo(); erpInboundOrder.setCreateBy(loginName); erpInboundOrder.setCreateTime(DateUtils.getNowDate()); List inboundDetails = erpInboundOrder.getInboundDetails(); @@ -601,36 +607,91 @@ public class SysMakeOrderServiceImpl implements ISysMakeOrderService throw new BusinessException("本次完成数不能全为0"); } for (ErpInboundOrderDetail inboundDetail:inboundDetails) { + //获取物料信息 + String materialNo = inboundDetail.getMaterialNo(); + SysMakeorderBom tempOrderBom = new SysMakeorderBom(); + tempOrderBom.setMaterialNo(materialNo); + tempOrderBom.setMakeNo(makeNo); + SysMakeorderBom makeorderBom = makeorderBomMapper.selectSysMakeorderBomByNo(tempOrderBom); + //生成并新增品质单 String qualityOrderCode = redisCache.generateBillNo("PZ"); - QualityOrder qualityOrder = createQualityOrder(qualityOrderCode, erpInboundOrder, loginName); + int orderDetailResult = generateQualityOrderDetail(qualityOrderCode,makeorderBom,inboundDetail.getCurrentNum()); + if(orderDetailResult<=0){ + throw new BusinessException("新增品质单详情失败!"); + } + QualityOrder qualityOrder = createQualityOrder(qualityOrderCode, erpInboundOrder.getMakeNo(), loginName); + qualityOrder.setMaterialNo(makeorderBom.getMaterialNo()); + qualityOrder.setMaterialName(makeorderBom.getMaterialName()); + qualityOrder.setThisArrivedNum(inboundDetail.getCurrentNum()); result += qualityOrderMapper.insertQualityOrder(qualityOrder); + + //根据出货设备生成品质单关联出货设备,并更新出货设备品质状态 List deviceList = inboundDetail.getSalesShippingDeviceList(); if(StringUtils.isNotEmpty(deviceList)){ for (AfterSalesShippingDevice device:deviceList) { + QualityShippingDevice qualityDevice = generateQualityShippingDevice(qualityOrderCode,device); + int insertDeviceResult = qualityDeviceMapper.insertQualityShippingDevice(qualityDevice); + if(insertDeviceResult<=0){ + throw new BusinessException("添加品质单关联设备"+qualityDevice.getShippingDeviceId()+"失败"); + } device.setQualityStatus("1");//待品质 afterSalesShippingDeviceMapper.updateAfterSalesShippingDevice(device); } } } - //品质报告单审核通过后再更新已完成数 -// SysMakeOrder sysMakeOrder = sysMakeOrderMapper.selectMakeOrderByMakeNo(erpInboundOrder.getMakeNo()); -// long hasFinished = sysMakeOrder.getFinishNum(); -// finishNum += hasFinished; -// sysMakeOrder.setFinishNum(finishNum); -// int updateSysMakeOrderResult = sysMakeOrderMapper.updateSysMakeOrder(sysMakeOrder); -// if (updateSysMakeOrderResult <= 0){ -// throw new BusinessException("更新生产订单失败"); -// } - return result; } - private QualityOrder createQualityOrder(String code, ErpInboundOrder erpInboundOrder, String loginName) { + //根据售后出货设备生成品质单关联设备 + private QualityShippingDevice generateQualityShippingDevice(String qualityOrderCode,AfterSalesShippingDevice shippingDevice){ + QualityShippingDevice qualityDevice = new QualityShippingDevice(); + qualityDevice.setShippingDeviceId(shippingDevice.getShippingDeviceId()); + qualityDevice.setMakeNo(shippingDevice.getMakeNo()); + qualityDevice.setQualityAuditStatus("0"); + qualityDevice.setQualityStatus("0"); + qualityDevice.setDeviceModelCode(shippingDevice.getDeviceModelCode()); + qualityDevice.setDeviceRunningNumber(shippingDevice.getDeviceRunningNumber()); + qualityDevice.setSalesOrderCode(shippingDevice.getSalesOrderCode()); + qualityDevice.setMaterialNo(shippingDevice.getMaterialNo()); + qualityDevice.setMaterialName(shippingDevice.getMaterialName()); + qualityDevice.setMaterialType(shippingDevice.getMaterialType()); + qualityDevice.setMaterialBrand(shippingDevice.getMaterialBrand()); + qualityDevice.setMaterialUnit(shippingDevice.getMaterialUnit()); + qualityDevice.setMaterialDescribe(shippingDevice.getMaterialDescribe()); + qualityDevice.setQualityOrderCode(qualityOrderCode); + return qualityDevice; + } + + //根据生产订单bom生成品质单详情 + private int generateQualityOrderDetail(String qualityOrderCode,SysMakeorderBom makeorderBom,int checkNum){ + QualityOrderDetail qualityOrderDetail = new QualityOrderDetail(); + qualityOrderDetail.setQualityOrderCode(qualityOrderCode); + qualityOrderDetail.setMaterialNo(makeorderBom.getMaterialNo()); + qualityOrderDetail.setMaterialName(makeorderBom.getMaterialName()); + qualityOrderDetail.setMaterialType(makeorderBom.getMaterialType()); + qualityOrderDetail.setMaterialBrand(makeorderBom.getBrand()); + qualityOrderDetail.setMaterialUnit(makeorderBom.getUnit()); + qualityOrderDetail.setMaterialPhotourl(makeorderBom.getPhotoUrl()); + qualityOrderDetail.setMaterialDescribe(makeorderBom.getDescribe()); + qualityOrderDetail.setMaterialModel(makeorderBom.getMaterialModel()); + qualityOrderDetail.setMaterialProcessMethod(makeorderBom.getProcessMethod()); + qualityOrderDetail.setCheckNum(checkNum); + qualityOrderDetail.setMakeTotal(makeorderBom.getOrderNum()); + qualityOrderDetail.setQualityStatus("0"); + qualityOrderDetail.setQualityStorageStatus("4"); + qualityOrderDetail.setQualityOrderType("1"); + qualityOrderDetail.setRelatedOrderCode(makeorderBom.getMakeNo()); + qualityOrderDetail.setCreateBy(ShiroUtils.getLoginName()); + qualityOrderDetail.setCreateTime(DateUtils.getNowDate()); + return orderDetailMapper.insertQualityOrderDetail(qualityOrderDetail); + } + + private QualityOrder createQualityOrder(String code, String makeNo, String loginName) { QualityOrder qualityOrder = new QualityOrder(); qualityOrder.setQualityOrderCode(code); - qualityOrder.setRelatedOrderCode(erpInboundOrder.getMakeNo()); + qualityOrder.setRelatedOrderCode(makeNo); qualityOrder.setQualityStatus("0"); qualityOrder.setQualityStorageStatus("4"); qualityOrder.setQualityOrderType("1"); @@ -682,20 +743,6 @@ public class SysMakeOrderServiceImpl implements ISysMakeOrderService return qualityOrderDetail; } - //添加品质单报告数据 - private void addQualityOrderReports(QualityOrder qualityOrder, ErpInboundOrder erpInboundOrder, Map materialInfoMap) { - - for (ErpInboundOrderDetail detail : erpInboundOrder.getInboundDetails()) { - SysSalesOrderChild salesOrderChild = materialInfoMap.get(detail.getMaterialNo()); - QualityOrderReport qualityOrderReport = createQualityOrderReport(qualityOrder, detail, salesOrderChild); - int result = orderReportMapper.insertQualityOrderReport(qualityOrderReport); - if (result <= 0) { - throw new BusinessException("新增品质单报告失败"); - } - } - } - - private QualityOrderReport createQualityOrderReport(QualityOrder qualityOrder, ErpInboundOrderDetail detail, SysSalesOrderChild salesOrderChild) { QualityOrderReport qualityOrderReport = new QualityOrderReport();