diff --git a/aucma-production/src/main/java/com/aucma/production/service/impl/ProductPlanInfoServiceImpl.java b/aucma-production/src/main/java/com/aucma/production/service/impl/ProductPlanInfoServiceImpl.java index 18fd671..e2a789d 100644 --- a/aucma-production/src/main/java/com/aucma/production/service/impl/ProductPlanInfoServiceImpl.java +++ b/aucma-production/src/main/java/com/aucma/production/service/impl/ProductPlanInfoServiceImpl.java @@ -5,6 +5,7 @@ import java.util.List; import com.aucma.base.domain.BaseOrderInfo; import com.aucma.base.service.IBaseOrderInfoService; +import com.aucma.base.utils.MaterialConstants; import com.aucma.common.exception.ServiceException; import com.aucma.common.exception.base.BaseException; import com.aucma.common.utils.DateUtils; @@ -139,23 +140,46 @@ public class ProductPlanInfoServiceImpl implements IProductPlanInfoService if (baseBomInfoList.size() == 0){ throw new BaseException("请先维护生产BOM信息!"); } + for (BaseBomInfo baseBomInfo : baseBomInfoList) { + if (baseBomInfo.getMaterialType().equals(MaterialConstants.BOX_MATERIAL_TYPE)){ + ProductPlanInfo planInfo = new ProductPlanInfo(); + planInfo.setPlanCode(PlanCodeUtils.getPlanCode()); + planInfo.setOrderCode(orderCode); + planInfo.setSaleOrderCode(saleOrderCode); + planInfo.setSaleorderLinenumber(saleOrderLineNumber); + planInfo.setMaterialCode(baseBomInfo.getMaterialCode()); + planInfo.setMaterialName(baseBomInfo.getMaterialName()); + planInfo.setProductLineCode("1002"); + planInfo.setPlanAmount(baseBomInfo.getStandardAmount().longValue() * orderAmount.longValue()); + this.insertProductPlanInfo(planInfo); + planInfo.setPlanCode(PlanCodeUtils.getPlanCode()); + planInfo.setProductLineCode("1005"); + this.insertProductPlanInfo(planInfo); + + BaseBomInfo bomInfo1 = new BaseBomInfo(); + bomInfo1.setParentId(baseBomInfo.getMaterialCode()); + List baseBomInfos = baseBomInfoService.selectBaseBomInfoList(bomInfo1); + for (BaseBomInfo info : baseBomInfos) { + if (info.getMaterialType().equals(MaterialConstants.COAMING_MATERIAL_TYPE)){ + planInfo.setPlanCode(PlanCodeUtils.getPlanCode()); + planInfo.setOrderCode(orderCode); + planInfo.setSaleOrderCode(saleOrderCode); + planInfo.setSaleorderLinenumber(saleOrderLineNumber); + planInfo.setMaterialCode(info.getMaterialCode()); + planInfo.setMaterialName(info.getMaterialName()); + planInfo.setProductLineCode("1001"); + planInfo.setPlanAmount(baseBomInfo.getStandardAmount().longValue() * orderAmount.longValue()); + this.insertProductPlanInfo(planInfo); + } + } + } + } //-- 若一个工单可下达多计划:则需要根据工单编号和物料编号去重 + //检查生产BOM是否满足下计划条件 - baseBomInfoService.checkBomInfo(baseBomInfoList); - //维护生产计划 - for (BaseBomInfo baseBomInfo : baseBomInfoList) { - ProductPlanInfo planInfo = new ProductPlanInfo(); - planInfo.setPlanCode(PlanCodeUtils.getPlanCode()); - planInfo.setOrderCode(orderCode); - planInfo.setSaleOrderCode(saleOrderCode); - planInfo.setSaleorderLinenumber(saleOrderLineNumber); - planInfo.setMaterialCode(baseBomInfo.getMaterialCode()); - planInfo.setMaterialName(baseBomInfo.getMaterialName()); - planInfo.setProductLineCode(baseBomInfo.getProductLineCode()); - planInfo.setPlanAmount(baseBomInfo.getStandardAmount() * orderAmount.longValue()); - this.insertProductPlanInfo(planInfo); - } +// baseBomInfoService.checkBomInfo(baseBomInfoList); + baseOrderInfo.setIsRelease(0L); baseOrderInfoService.updateBaseOrderInfo(baseOrderInfo); } catch (Exception e) {