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 21adc14..cb8433b 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 @@ -133,11 +133,14 @@ public class BaseKnifeController extends BaseController { return getDataTable(list); } - @PostMapping("/open/checkForAlignment") + @PostMapping("/open/checkForAlignment/{technologyCode}") @ResponseBody - public AjaxResult checkForAlignment(@RequestBody List processCodeList) { - // 获取工艺bom - List technologyBomList = baseTechnologyBomService.selectBaseTechnologyBomListByProcessCodeList(processCodeList); + public AjaxResult checkForAlignment(@PathVariable String technologyCode) { + // 验证bom工艺 + BaseTechnologyBom baseTechnologyBomWrapper = new BaseTechnologyBom(); + baseTechnologyBomWrapper.setTechnologyCode(technologyCode); +// List technologyBomList = baseTechnologyBomService.selectBaseTechnologyBomListByProcessCodeList(productionArrangements.getProcessCodes()); + List technologyBomList = baseTechnologyBomService.selectBaseTechnologyBomList(baseTechnologyBomWrapper); if (technologyBomList.isEmpty() || technologyBomList.size() == 1 && technologyBomList.get(0).getKnifeCode() == null) return AjaxResult.error("未检测到工艺bom项"); @@ -151,7 +154,7 @@ public class BaseKnifeController extends BaseController { operLog.setOperLocation("上游系统"); operLog.setOperUrl("/mes/md/baseKnife/open/checkForAlignment"); operLog.setMethod("com.ktg.mes.md.controller.BaseKnifeController.checkForAlignment()"); - operLog.setOperParam(JSON.toJSONString(processCodeList)); + operLog.setOperParam(JSON.toJSONString(technologyCode)); operLog.setStatus(1); operLog.setOperTime(new Date()); @@ -319,15 +322,22 @@ public class BaseKnifeController extends BaseController { baseKnifePlan.setPlanSheet(productionArrangements.getPlanSheet()); if (!baseKnifeService.selectBaseKnifeList(baseKnifePlan).isEmpty()) return AjaxResult.error("该计划单已存在,请更换重试"); + WmsZdTask wmsZdTaskValid = new WmsZdTask(); + wmsZdTaskValid.setPlanSheet(productionArrangements.getPlanSheet()); + if (!zdTaskService.selectWmsZdTaskList(wmsZdTaskValid).isEmpty()) + return AjaxResult.error("该计划单已存在,请更换重试"); // 齐套性检查 - AjaxResult ajaxResult = this.checkForAlignment(productionArrangements.getProcessCodes()); + AjaxResult ajaxResult = this.checkForAlignment(productionArrangements.getTechnologyCode()); if (Integer.parseInt(String.valueOf(ajaxResult.get("code"))) != 200) { return AjaxResult.error(ajaxResult.get("msg").toString(), ajaxResult.get("data")); } // 验证bom工艺 - List technologyBomList = baseTechnologyBomService.selectBaseTechnologyBomListByProcessCodeList(productionArrangements.getProcessCodes()); + BaseTechnologyBom baseTechnologyBomWrapper = new BaseTechnologyBom(); + baseTechnologyBomWrapper.setTechnologyCode(productionArrangements.getTechnologyCode()); +// List technologyBomList = baseTechnologyBomService.selectBaseTechnologyBomListByProcessCodeList(productionArrangements.getProcessCodes()); + List technologyBomList = baseTechnologyBomService.selectBaseTechnologyBomList(baseTechnologyBomWrapper); if (technologyBomList.isEmpty() || technologyBomList.size() == 1 && technologyBomList.get(0).getKnifeCode() == null) return AjaxResult.error("未检测到工艺bom项"); @@ -337,7 +347,7 @@ public class BaseKnifeController extends BaseController { // 参数列表 Map params = new HashMap<>(); params.put("planCode", productionArrangements.getPlanSheet()); - params.put("processCodeList", productionArrangements.getProcessCodes()); + params.put("processCode", productionArrangements.getTechnologyCode()); params.put("processUnit", productionArrangements.getProcessUnit()); // 构建日志 @@ -579,7 +589,8 @@ public class BaseKnifeController extends BaseController { } // 添加生产准备记录 - productionArrangements.setProcessCode(productionArrangements.getProcessCodes().toString()); +// productionArrangements.setProcessCode(productionArrangements.getProcessCodes().toString()); + productionArrangements.setTechnologyCode(productionArrangements.getTechnologyCode()); productionArrangements.setProcessUnit(productionArrangements.getProcessUnit()); productionArrangements.setStatus(0); productionArrangements.setCreateTime(DateUtils.getNowDate()); diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/domain/BaseTechnologyBom.java b/ktg-mes/src/main/java/com/ktg/mes/md/domain/BaseTechnologyBom.java index a2ba55c..d557c5c 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/md/domain/BaseTechnologyBom.java +++ b/ktg-mes/src/main/java/com/ktg/mes/md/domain/BaseTechnologyBom.java @@ -72,6 +72,14 @@ public class BaseTechnologyBom extends BaseEntity @Excel(name = "预留字段4") private String attr4; + /** 预留字段4 */ + @Excel(name = "工艺编码") + private String technologyCode; + + /** 预留字段4 */ + @Excel(name = "工艺名称") + private String technologyName; + public void setTechnologyBomId(String technologyBomId) { this.technologyBomId = technologyBomId; @@ -199,6 +207,14 @@ public class BaseTechnologyBom extends BaseEntity return attr4; } + public String getTechnologyCode() { + return technologyCode; + } + + public void setTechnologyCode(String technologyCode) { + this.technologyCode = technologyCode; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/InventoryBatchServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/InventoryBatchServiceImpl.java index fc5d6c7..2c9bfe5 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/InventoryBatchServiceImpl.java +++ b/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/InventoryBatchServiceImpl.java @@ -189,10 +189,10 @@ public class InventoryBatchServiceImpl implements IInventoryBatchService { // 获取当期入库明细数据 List> hashMapList = new ArrayList<>(); WmsInPlanDetailEntity entityQuery = new WmsInPlanDetailEntity(); - entityQuery.setPlanDetailsId(inTask.getDetailInId()); + entityQuery.setPlanId(Long.parseLong(inTask.getPlanInId())); + entityQuery.setKnifeId(Long.parseLong(inTask.getPlanInId())); List wmsInPlanDetailEntityList = wmsInPlanDetailEntityMapper.selectWmsInPlanDetailEntityList(entityQuery); wmsInPlanDetailEntityList.forEach(inPlanDetailEntity -> { - // 根据出库计划获得出库类型 WmsBusinessType wmsBusinessType = this.wmsBusinessTypeMapper.selectWmsBusinessTypeByTypeId(inTask.getPlanTypeId()); diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/ProductionArrangements.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/ProductionArrangements.java index be042f7..913eb4b 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/ProductionArrangements.java +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/ProductionArrangements.java @@ -25,13 +25,13 @@ public class ProductionArrangements extends BaseEntity private String planSheet; /** 工序号 */ - @Excel(name = "工序号") - private String processCode; + @Excel(name = "工艺编码") + private String technologyCode; - @Excel(name = "工序号") - private List processCodes; +// @Excel(name = "工序号") +// private List processCodes; - @Excel(name = "工序号") + @Excel(name = "加工单元") private String processUnit; /** 状态 */ @@ -72,15 +72,15 @@ public class ProductionArrangements extends BaseEntity { return planSheet; } - public void setProcessCode(String processCode) - { - this.processCode = processCode; + + public String getTechnologyCode() { + return technologyCode; } - public String getProcessCode() - { - return processCode; + public void setTechnologyCode(String technologyCode) { + this.technologyCode = technologyCode; } + public void setStatus(Integer status) { this.status = status; @@ -94,13 +94,13 @@ public class ProductionArrangements extends BaseEntity this.processUnit = processUnit; } - public List getProcessCodes() { - return processCodes; - } - - public void setProcessCodes(List processCodes) { - this.processCodes = processCodes; - } +// public List getProcessCodes() { +// return processCodes; +// } +// +// public void setProcessCodes(List processCodes) { +// this.processCodes = processCodes; +// } public Integer getStatus() { @@ -148,8 +148,6 @@ public class ProductionArrangements extends BaseEntity return "ProductionArrangements{" + "productionArrangementsId='" + productionArrangementsId + '\'' + ", planSheet='" + planSheet + '\'' + - ", processCode='" + processCode + '\'' + - ", processCodes=" + processCodes + ", processUnit='" + processUnit + '\'' + ", status=" + status + ", attr1='" + attr1 + '\'' + diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmsZdTaskServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmsZdTaskServiceImpl.java index 6a44748..c63df8a 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmsZdTaskServiceImpl.java +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmsZdTaskServiceImpl.java @@ -478,20 +478,17 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService public Boolean checkFinal(String planSheet){ // 获取订单记录 ProductionArrangements productionArrangements = productionArrangementsMapper.selectProductionArrangementsByPlanSheet(planSheet); - String[] processCodes = productionArrangements.getProcessCode().substring(1, productionArrangements.getProcessCode().length() - 1).split(","); - for (String processCode : processCodes) { - // 遍历工序 - List baseTechnologyBomList = baseTechnologyBomMapper.selectBaseTechnologyBomListByProcessCode(processCode.trim()); - if (baseTechnologyBomList != null && baseTechnologyBomList.size() > 0) { - // 判断订单锁定的物料是否足够 - for (BaseTechnologyBom technologyBom : baseTechnologyBomList) { - BaseKnife baseKnifeWrapper = new BaseKnife(); - baseKnifeWrapper.setPlanSheet(planSheet); - baseKnifeWrapper.setKnifeCode(technologyBom.getKnifeCode()); - List baseKnifePlanSheetList = baseKnifeMapper.selectBaseKnifeList(baseKnifeWrapper); - if (baseKnifePlanSheetList.size() < technologyBom.getKnifeCount()) return false; - } - } + BaseTechnologyBom baseTechnologyBomWrapper = new BaseTechnologyBom(); + baseTechnologyBomWrapper.setTechnologyCode(productionArrangements.getTechnologyCode()); + List baseTechnologyBomList = baseTechnologyBomMapper.selectBaseTechnologyBomList(baseTechnologyBomWrapper); + + // 判断订单锁定的物料是否足够 + for (BaseTechnologyBom technologyBom : baseTechnologyBomList) { + BaseKnife baseKnifeWrapper = new BaseKnife(); + baseKnifeWrapper.setPlanSheet(planSheet); + baseKnifeWrapper.setKnifeCode(technologyBom.getKnifeCode()); + List baseKnifePlanSheetList = baseKnifeMapper.selectBaseKnifeList(baseKnifeWrapper); + if (baseKnifePlanSheetList.size() < technologyBom.getKnifeCount()) return false; } return true; @@ -515,20 +512,17 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService // 获取订单记录 ProductionArrangements productionArrangements = productionArrangementsMapper.selectProductionArrangementsByPlanSheet(planSheet); - String[] processCodes = productionArrangements.getProcessCode().substring(1, productionArrangements.getProcessCode().length() - 1).split(","); - for (String processCode : processCodes) { - // 遍历工序 - List baseTechnologyBomList = baseTechnologyBomMapper.selectBaseTechnologyBomListByProcessCode(processCode.trim()); - if (baseTechnologyBomList != null && baseTechnologyBomList.size() > 0) { - // 判断订单锁定的物料是否足够 - for (BaseTechnologyBom technologyBom : baseTechnologyBomList) { - BaseKnife baseKnifeWrapper = new BaseKnife(); - baseKnifeWrapper.setPlanSheet(planSheet); - baseKnifeWrapper.setKnifeCode(technologyBom.getKnifeCode()); - List baseKnifeLockedList = baseKnifeMapper.selectBaseKnifeList(baseKnifeWrapper); - if (baseKnifeLockedList.size() == technologyBom.getKnifeCount()) baseKnifeResultList.addAll(baseKnifeLockedList); - } - } + BaseTechnologyBom baseTechnologyBomWrapper = new BaseTechnologyBom(); + baseTechnologyBomWrapper.setTechnologyCode(productionArrangements.getTechnologyCode()); + List baseTechnologyBomList = baseTechnologyBomMapper.selectBaseTechnologyBomList(baseTechnologyBomWrapper); + + // 判断订单锁定的物料是否足够 + for (BaseTechnologyBom technologyBom : baseTechnologyBomList) { + BaseKnife baseKnifeWrapper = new BaseKnife(); + baseKnifeWrapper.setPlanSheet(planSheet); + baseKnifeWrapper.setKnifeCode(technologyBom.getKnifeCode()); + List baseKnifeLockedList = baseKnifeMapper.selectBaseKnifeList(baseKnifeWrapper); + if (baseKnifeLockedList.size() == technologyBom.getKnifeCount()) baseKnifeResultList.addAll(baseKnifeLockedList); } String batchNum = "SCZBPC01"; diff --git a/ktg-mes/src/main/resources/mapper/md/BaseTechnologyBomMapper.xml b/ktg-mes/src/main/resources/mapper/md/BaseTechnologyBomMapper.xml index b3f436e..884afeb 100644 --- a/ktg-mes/src/main/resources/mapper/md/BaseTechnologyBomMapper.xml +++ b/ktg-mes/src/main/resources/mapper/md/BaseTechnologyBomMapper.xml @@ -15,6 +15,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + @@ -27,7 +29,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select TECHNOLOGY_BOM_ID, FIGURE_CODE, PROCESS_CODE, PROCESS_NAME, KNIFE_CODE, KNIFE_SORT, KNIFE_COUNT, EXPEND_LIFE, LOCKED_START_TIME, LOCKED_END_TIME, REMARK, ATTR1, ATTR2, ATTR3, ATTR4, CREATE_BY, CREATE_TIME, UPDATE_BY, UPDATE_TIME from BASE_TECHNOLOGY_BOM + select TECHNOLOGY_BOM_ID, FIGURE_CODE, PROCESS_CODE, PROCESS_NAME, KNIFE_CODE, + KNIFE_SORT, KNIFE_COUNT, EXPEND_LIFE, LOCKED_START_TIME, LOCKED_END_TIME, + TECHNOLOGY_CODE, TECHNOLOGY_NAME, + REMARK, ATTR1, ATTR2, ATTR3, ATTR4, CREATE_BY, CREATE_TIME, UPDATE_BY, UPDATE_TIME + from BASE_TECHNOLOGY_BOM and PLAN_SHEET = #{planSheet} - and PROCESS_CODE = #{processCode} + and TECHNOLOGY_CODE = #{technologyCode} and STATUS = #{status} and ATTR1 = #{attr1} and ATTR2 = #{attr2} @@ -54,7 +54,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" insert into PRODUCTION_ARRANGEMENTS PLAN_SHEET, - PROCESS_CODE, + TECHNOLOGY_CODE, STATUS, PROCESS_UNIT, ATTR1, @@ -68,7 +68,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{planSheet}, - #{processCode}, + #{technologyCode}, #{status}, #{processUnit}, #{attr1}, @@ -86,7 +86,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update PRODUCTION_ARRANGEMENTS PLAN_SHEET = #{planSheet}, - PROCESS_CODE = #{processCode}, + TECHNOLOGY_CODE = #{technologyCode}, STATUS = #{status}, ATTR1 = #{attr1}, ATTR2 = #{attr2}, diff --git a/ktg-mes/src/main/resources/mapper/wm/WmsZdTaskMapper.xml b/ktg-mes/src/main/resources/mapper/wm/WmsZdTaskMapper.xml index 6de191b..133be9b 100644 --- a/ktg-mes/src/main/resources/mapper/wm/WmsZdTaskMapper.xml +++ b/ktg-mes/src/main/resources/mapper/wm/WmsZdTaskMapper.xml @@ -54,6 +54,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and PLAN_OUT_ID = #{planOutId} and PLAN_OUT_TYPE = #{planOutType} and technology_bom_id = #{technologyBomId} + and plan_sheet = #{planSheet} and QTY_OK = #{qtyOk} and REMARK = #{remark} and ATTR1 = #{attr1}