diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/controller/BaseKnifeController.java b/ktg-mes/src/main/java/com/ktg/mes/md/controller/BaseKnifeController.java index ccf6231..87d20d7 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/md/controller/BaseKnifeController.java +++ b/ktg-mes/src/main/java/com/ktg/mes/md/controller/BaseKnifeController.java @@ -588,12 +588,12 @@ public class BaseKnifeController extends BaseController // 查询工艺bom BaseTechnologyBom technologyBom = new BaseTechnologyBom(); + Boolean lockedFlag = false; if (zdTask.getAttr4() != null){ + lockedFlag = true; technologyBom = baseTechnologyBomService.selectBaseTechnologyBomByTechnologyBomId(zdTask.getAttr4()); } else { technologyBom.setFigureCode(zdTask.getCode()); - technologyBom.setLockedStartTime(DateUtils.getNowDate()); - technologyBom.setLockedEndTime(DateUtils.getNowDate()); } // 出库基础物料 @@ -622,9 +622,13 @@ public class BaseKnifeController extends BaseController baseKnife.setStandardQuantity("1"); baseKnife.setKnifeLife(100); baseKnife.setKnifeFineState(0); - baseKnife.setIsLocked(1); - baseKnife.setLockedStartTime(technologyBom.getLockedStartTime()); - baseKnife.setLockedEndTime(technologyBom.getLockedEndTime()); + if (lockedFlag) { + baseKnife.setIsLocked(1); + baseKnife.setLockedStartTime(technologyBom.getLockedStartTime()); + baseKnife.setLockedEndTime(technologyBom.getLockedEndTime()); + } else { + baseKnife.setIsLocked(0); + } baseKnife.setPlanSheet(zdTask.getAttr4()); baseKnife.setItemOrProduct("PRODUCT"); baseKnife.setCreateBy(getUsername()); @@ -716,10 +720,14 @@ public class BaseKnifeController extends BaseController wmsOutTask.setCreateBy(getUsername()); wmsOutTask.setCreateTime(DateUtils.getNowDate()); wmsOutTaskMapper.insertWmsOutTask(wmsOutTask); + + // 更新基础物料数量 + MdItem mdItem = mdItemService.selectMdItemById(outPlanDetail.getMdItemId()); + mdItem.setStandardNumber(mdItem.getStandardNumber() - outPlanDetail.getRealQuantity()); + mdItemService.updateMdItem(mdItem); } // 整刀入库计划 - Random random = new Random(); WmsInPlan wmsInPlan = new WmsInPlan(); wmsInPlan.setState("1"); wmsInPlan.setSourceType("SGLR"); diff --git a/ktg-mes/src/main/resources/mapper/md/BaseKnifeMapper.xml b/ktg-mes/src/main/resources/mapper/md/BaseKnifeMapper.xml index d27d504..e9e4f82 100644 --- a/ktg-mes/src/main/resources/mapper/md/BaseKnifeMapper.xml +++ b/ktg-mes/src/main/resources/mapper/md/BaseKnifeMapper.xml @@ -560,6 +560,6 @@ \ No newline at end of file