From f82a1fb830770a31e7c72ecd08455e5a2a603b80 Mon Sep 17 00:00:00 2001 From: Stang <32996823@qq.com> Date: Fri, 15 Nov 2024 10:43:04 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=AE=8C=E6=88=90=E6=89=8B=E5=8A=A8?= =?UTF-8?q?=E7=BB=84=E5=88=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../md/controller/BaseKnifeController.java | 127 ++++--- .../java/com/ktg/mes/md/domain/BaseKnife.java | 32 ++ .../ktg/mes/md/mapper/BaseKnifeMapper.java | 2 + .../java/com/ktg/mes/wm/domain/WmsZdTask.java | 67 +++- .../wm/service/impl/WmsZdTaskServiceImpl.java | 346 +++++++++++++----- .../resources/mapper/md/BaseKnifeMapper.xml | 55 ++- .../resources/mapper/wm/WmsZdTaskMapper.xml | 22 +- 7 files changed, 499 insertions(+), 152 deletions(-) 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 ab52ab3..339ff9c 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 @@ -6,7 +6,6 @@ import javax.servlet.http.HttpServletResponse; import com.alibaba.fastjson.JSON; import com.ktg.common.utils.DateUtils; -import com.ktg.generator.util.MultiModuleCodeGenerator; import com.ktg.mes.md.domain.*; import com.ktg.mes.md.mapper.WmsOutPlanDetailEntityMapper; import com.ktg.mes.md.mapper.WmsOutPlanMapper; @@ -19,9 +18,9 @@ import com.ktg.mes.wm.service.IWmsInTaskService; import com.ktg.mes.wm.service.IWmsZdTaskService; import com.ktg.system.domain.SysOperLog; import com.ktg.system.service.ISysOperLogService; -import org.codehaus.jackson.map.Serializers; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.*; import com.ktg.common.annotation.Log; import com.ktg.common.core.controller.BaseController; @@ -305,6 +304,7 @@ public class BaseKnifeController extends BaseController { @PostMapping("/open/productionArrangements/{planSheet}") @ResponseBody + @Transactional public AjaxResult productionArrangements(@PathVariable String planSheet, @RequestBody List processCodeList) { // 检查计划单是否已存在 @@ -647,6 +647,7 @@ public class BaseKnifeController extends BaseController { baseKnife.setStandardQuantity("1"); baseKnife.setKnifeLife(100); baseKnife.setKnifeFineState(1); + baseKnife.setIsValid(1); // 判断是否需要锁定整刀 if (lockedFlag) { baseKnife.setIsLocked(1); @@ -699,7 +700,7 @@ public class BaseKnifeController extends BaseController { wmsBaseKnife.setKnifeFineState(2); wmsBaseKnife.setLockedStartTime(technologyBom.getLockedStartTime()); wmsBaseKnife.setLockedEndTime(technologyBom.getLockedEndTime()); - wmsBaseKnife.setAttr1(baseKnife.getBaseKnifeId()); + wmsBaseKnife.setParentId(baseKnife.getBaseKnifeId()); wmsBaseKnife.setPlanSheet(zdTask.getAttr4()); baseKnifeListOutPlan.add(wmsBaseKnife); baseKnifeService.updateBaseKnife(wmsBaseKnife); @@ -768,68 +769,66 @@ public class BaseKnifeController extends BaseController { mdItemService.updateMdItem(mdItem); } - // 整刀入库计划, 根据图号查询入库计划,如果不存在生成计划,存在则往计划中添加任务 - WmsInPlan wmsInPlan = wmsInPlanService.selectWmsInPlanByPlanCode(zdTask.getAttr4()); - if (wmsInPlan == null) { - WmsInPlan wmsInPlanTemp = new WmsInPlan(); - wmsInPlanTemp.setState("1"); - wmsInPlanTemp.setSourceType("SGLR"); - wmsInPlanTemp.setCellCode(zdTask.getAttr3()); - wmsInPlanTemp.setPlanCode(zdTask.getAttr4() == null ? zdTask.getCode() : zdTask.getAttr4()); - wmsInPlanTemp.setRelBillCode("组装单据"); - wmsInPlanTemp.setPlanTypeId("13"); - wmsInPlanTemp.setCreateBy(getUsername()); - wmsInPlanTemp.setCreateTime(DateUtils.getNowDate()); +// // 整刀入库计划, 根据图号查询入库计划,如果不存在生成计划,存在则往计划中添加任务 +// WmsInPlan wmsInPlan = wmsInPlanService.selectWmsInPlanByPlanCode(zdTask.getAttr4()); +// if (wmsInPlan == null) { +// WmsInPlan wmsInPlanTemp = new WmsInPlan(); +// wmsInPlanTemp.setState("1"); +// wmsInPlanTemp.setSourceType("SGLR"); +// wmsInPlanTemp.setCellCode(zdTask.getAttr3()); +// wmsInPlanTemp.setPlanCode(zdTask.getAttr4() == null ? zdTask.getCode() : zdTask.getAttr4()); +// wmsInPlanTemp.setRelBillCode("组装单据"); +// wmsInPlanTemp.setPlanTypeId("13"); +// wmsInPlanTemp.setCreateBy(getUsername()); +// wmsInPlanTemp.setCreateTime(DateUtils.getNowDate()); +// +// // 入库任务明细 +// List wmsInPlanDetailsList = new ArrayList<>(); +// WmsInPlanDetails wmsInPlanDetails = new WmsInPlanDetails(); +// wmsInPlanDetails.setMaterialId(zdTask.getmProductId().toString()); +// wmsInPlanDetails.setBatch(batchNum); +// wmsInPlanDetails.setCellId(1L); +// wmsInPlanDetails.setQuantity(zdTask.getProductIdQty().toString()); +// wmsInPlanDetails.setQuantityIn(zdTask.getProductIdQty().toString()); +// wmsInPlanDetails.setPlanInStatus("0"); +// wmsInPlanDetailsList.add(wmsInPlanDetails); +// wmsInPlanTemp.setWmsInPlanDetailsList(wmsInPlanDetailsList); +// wmsInPlanService.insertWmsInPlan(wmsInPlanTemp); +// wmsInPlan = wmsInPlanTemp; +// } else { +// // 入库任务明细 +// List wmsInPlanDetailsList = wmsInPlan.getWmsInPlanDetailsList(); +// WmsInPlanDetails wmsInPlanDetails = new WmsInPlanDetails(); +// wmsInPlanDetails.setMaterialId(zdTask.getmProductId().toString()); +// wmsInPlanDetails.setBatch(batchNum); +// wmsInPlanDetails.setCellId(1L); +// wmsInPlanDetails.setQuantity(zdTask.getProductIdQty().toString()); +// wmsInPlanDetails.setQuantityIn(zdTask.getProductIdQty().toString()); +// wmsInPlanDetails.setPlanInStatus("0"); +// wmsInPlanDetailsList.add(wmsInPlanDetails); +// wmsInPlan.setWmsInPlanDetailsList(wmsInPlanDetailsList); +// wmsInPlanService.updateWmsInPlan(wmsInPlan); +// } +// +// // 入库任务 +// MdItem mdItem = mdItemService.selectMdItemById(zdTask.getmProductId()); +// WmsInTask wmsInTask = new WmsInTask(); +// // 生成任务号 +// String taskInCode = MultiModuleCodeGenerator.generateTaskCode("RKT"); +// wmsInTask.setTaskInCode(taskInCode); +// wmsInTask.setPlanInId(wmsInPlan.getPlanId().toString()); +// wmsInTask.setPlanInCode(wmsInPlan.getPlanCode()); +// wmsInTask.setMaterialCode(mdItem.getItemCode()); +// wmsInTask.setTaskInQuantity(zdTask.getProductIdQty()); +// wmsInTask.setActualInQuantity(zdTask.getProductIdQty()); +// WmStorageArea wmStorageArea = wmStorageAreaService.selectWmStorageAreaByAreaCode(zdTask.getAttr3()); +// wmsInTask.setCellTgt(wmStorageArea.getAreaId()); +// wmsInTask.setBatch(batchNum); +// wmsInTask.setMaterialId(zdTask.getmProductId().toString()); +// wmsInTask.setPlanTypeId("9"); +// wmsInTask.setPlanInStatus("1"); +// wmsInTaskService.insertWmsInTask(wmsInTask); - // 入库任务明细 - List wmsInPlanDetailsList = new ArrayList<>(); - WmsInPlanDetails wmsInPlanDetails = new WmsInPlanDetails(); - wmsInPlanDetails.setMaterialId(zdTask.getmProductId().toString()); - wmsInPlanDetails.setBatch(batchNum); - wmsInPlanDetails.setCellId(1L); - wmsInPlanDetails.setQuantity(zdTask.getProductIdQty().toString()); - wmsInPlanDetails.setQuantityIn(zdTask.getProductIdQty().toString()); - wmsInPlanDetails.setPlanInStatus("0"); - wmsInPlanDetailsList.add(wmsInPlanDetails); - wmsInPlanTemp.setWmsInPlanDetailsList(wmsInPlanDetailsList); - wmsInPlanService.insertWmsInPlan(wmsInPlanTemp); - wmsInPlan = wmsInPlanTemp; - } else { - // 入库任务明细 - List wmsInPlanDetailsList = wmsInPlan.getWmsInPlanDetailsList(); - WmsInPlanDetails wmsInPlanDetails = new WmsInPlanDetails(); - wmsInPlanDetails.setMaterialId(zdTask.getmProductId().toString()); - wmsInPlanDetails.setBatch(batchNum); - wmsInPlanDetails.setCellId(1L); - wmsInPlanDetails.setQuantity(zdTask.getProductIdQty().toString()); - wmsInPlanDetails.setQuantityIn(zdTask.getProductIdQty().toString()); - wmsInPlanDetails.setPlanInStatus("0"); - wmsInPlanDetailsList.add(wmsInPlanDetails); - wmsInPlan.setWmsInPlanDetailsList(wmsInPlanDetailsList); - wmsInPlanService.updateWmsInPlan(wmsInPlan); - } - - // 入库任务 - MdItem mdItem = mdItemService.selectMdItemById(zdTask.getmProductId()); - WmsInTask wmsInTask = new WmsInTask(); - // 生成任务号 - String taskInCode = MultiModuleCodeGenerator.generateTaskCode("RKT"); - wmsInTask.setTaskInCode(taskInCode); - wmsInTask.setPlanInId(wmsInPlan.getPlanId().toString()); - wmsInTask.setPlanInCode(wmsInPlan.getPlanCode()); - wmsInTask.setMaterialCode(mdItem.getItemCode()); - wmsInTask.setTaskInQuantity(zdTask.getProductIdQty()); - wmsInTask.setActualInQuantity(zdTask.getProductIdQty()); - WmStorageArea wmStorageArea = wmStorageAreaService.selectWmStorageAreaByAreaCode(zdTask.getAttr3()); - wmsInTask.setCellTgt(wmStorageArea.getAreaId()); - wmsInTask.setBatch(batchNum); - wmsInTask.setMaterialId(zdTask.getmProductId().toString()); - wmsInTask.setPlanTypeId("9"); - wmsInTask.setPlanInStatus("1"); - wmsInTaskService.insertWmsInTask(wmsInTask); - - // 更新数量 - mdItemService.updateMdItem(mdItem); // 更新组装任务 zdTask.setStatus("1"); diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/domain/BaseKnife.java b/ktg-mes/src/main/java/com/ktg/mes/md/domain/BaseKnife.java index 0f4a2f8..326cbbd 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/md/domain/BaseKnife.java +++ b/ktg-mes/src/main/java/com/ktg/mes/md/domain/BaseKnife.java @@ -102,6 +102,8 @@ public class BaseKnife extends BaseEntity { @Excel(name = "是否锁定") private Integer isLocked; + private Long zdTaskId; + /** * 库区编码 */ @@ -157,6 +159,12 @@ public class BaseKnife extends BaseEntity { @Excel(name = "预留字段4") private String attr4; + @Excel(name = "父物料id") + private Long parentId; + + @Excel(name = "是否有效") + private Integer isValid; + /** * 物料产品信息 */ @@ -383,6 +391,30 @@ public class BaseKnife extends BaseEntity { this.inInfoList = inInfoList; } + public Long getParentId() { + return parentId; + } + + public void setParentId(Long parentId) { + this.parentId = parentId; + } + + public Integer getIsValid() { + return isValid; + } + + public void setIsValid(Integer isValid) { + this.isValid = isValid; + } + + public Long getZdTaskId() { + return zdTaskId; + } + + public void setZdTaskId(Long zdTaskId) { + this.zdTaskId = zdTaskId; + } + @Override public String toString() { return "BaseKnife{" + diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/mapper/BaseKnifeMapper.java b/ktg-mes/src/main/java/com/ktg/mes/md/mapper/BaseKnifeMapper.java index 3459328..d959460 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/md/mapper/BaseKnifeMapper.java +++ b/ktg-mes/src/main/java/com/ktg/mes/md/mapper/BaseKnifeMapper.java @@ -102,4 +102,6 @@ public interface BaseKnifeMapper { ); long countBaseKnife(@Param("mbbBdMrlId") Long mbbBdMrlId); + + List selectBaseKnifeNotValidList(BaseKnife baseKnifeWrapper); } diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmsZdTask.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmsZdTask.java index ecb10ff..32ace36 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmsZdTask.java +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmsZdTask.java @@ -17,7 +17,7 @@ public class WmsZdTask extends BaseEntity private static final long serialVersionUID = 1L; /** 主键 */ - private String wmsZdTaskId; + private Long wmsZdTaskId; /** 编码 */ @Excel(name = "编码") @@ -50,6 +50,17 @@ public class WmsZdTask extends BaseEntity @Excel(name = "已完成数量") private Integer qtyOk; + + private Long bomId; + + private String itemName; + + private String areaName; + + private Long areaId; + + private String processCode; + /** 预留字段1 */ @Excel(name = "预留字段1") private Long attr1; @@ -72,12 +83,14 @@ public class WmsZdTask extends BaseEntity @Excel(name = "完成状态") private String status; - public void setWmsZdTaskId(String wmsZdTaskId) + private Long technologyBomId; + + public void setWmsZdTaskId(Long wmsZdTaskId) { this.wmsZdTaskId = wmsZdTaskId; } - public String getWmsZdTaskId() + public Long getWmsZdTaskId() { return wmsZdTaskId; } @@ -207,6 +220,54 @@ public class WmsZdTask extends BaseEntity this.planSheet = planSheet; } + public Long getTechnologyBomId() { + return technologyBomId; + } + + public void setTechnologyBomId(Long technologyBomId) { + this.technologyBomId = technologyBomId; + } + + public Long getBomId() { + return bomId; + } + + public void setBomId(Long bomId) { + this.bomId = bomId; + } + + public String getItemName() { + return itemName; + } + + public void setItemName(String itemName) { + this.itemName = itemName; + } + + public String getAreaName() { + return areaName; + } + + public void setAreaName(String areaName) { + this.areaName = areaName; + } + + public Long getAreaId() { + return areaId; + } + + public void setAreaId(Long areaId) { + this.areaId = areaId; + } + + public String getProcessCode() { + return processCode; + } + + public void setProcessCode(String processCode) { + this.processCode = processCode; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) 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 c5cd172..453fe5a 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 @@ -25,6 +25,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ktg.mes.wm.mapper.WmsZdTaskMapper; import com.ktg.mes.wm.service.IWmsZdTaskService; +import org.springframework.transaction.annotation.Transactional; import static com.ktg.common.utils.SecurityUtils.getUsername; import static com.ktg.generator.util.MultiModuleCodeGenerator.generateTaskCode; @@ -58,7 +59,7 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService private WmStorageAreaMapper wmStorageAreaMapper; @Autowired - private WmsInPlanMapper wmsInPlanMapper; + private IWmsInPlanService wmsInPlanService; @Autowired private WmsInTaskMapper wmsInTaskMapper; @@ -149,11 +150,12 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService } @Override + @Transactional public AjaxResult createOutTaskByWmsZdTask(WmsZdTask zdTask) { String batchNum = "ZZPC001"; // 判断物料是否充足 - BomRoute bomRoute = bomRouteMapper.selectBomRouteByBomRouteId(zdTask.getAttr1()); + BomRoute bomRoute = bomRouteMapper.selectBomRouteByBomRouteId(zdTask.getBomId()); BaseKnife baseKnifeWrapper = new BaseKnife(); List baseKnifeList = new ArrayList<>(); @@ -172,15 +174,22 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService List wmsOutPlanDetailList = new ArrayList<>(); List baseKnifeListOutPlan = new ArrayList<>(); + // 查询工艺bom BaseTechnologyBom technologyBom = new BaseTechnologyBom(); + Boolean lockedFlag = false; + // attr4 组装任务所属计划单, 如果为空则是手动组装任务不需要锁定 + if (zdTask.getPlanSheet() != null) { + lockedFlag = true; + } // 出库基础物料, 根据图号查询出库计划,如果不存在生成计划,存在则往计划中添加任务 - WmsOutPlan outPlan = wmsOutPlanMapper.selectWmsOutPlanByPlanCode(zdTask.getAttr4()); - if (outPlan == null){ + WmsOutPlan outPlan = wmsOutPlanMapper.selectWmsOutPlanByPlanCode(zdTask.getPlanSheet()); + if (outPlan == null) { // 构建新的出库计划 WmsOutPlan outPlanTemp = new WmsOutPlan(); - outPlanTemp.setPlanCode(zdTask.getAttr4() == null ? zdTask.getCode() : zdTask.getAttr4()); - outPlanTemp.setWmsBusinessTypeId(12L); + outPlanTemp.setPlanCode(zdTask.getPlanSheet() == null ? zdTask.getCode() : zdTask.getPlanSheet()); + // 组刀出库 + outPlanTemp.setWmsBusinessTypeId(16L); outPlanTemp.setPlanState("1"); outPlanTemp.setPlanType("ZDCK"); outPlanTemp.setCreateBy(getUsername()); @@ -189,52 +198,98 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService outPlan = outPlanTemp; } - // 出库任务 - for (MbbProduBom mbbProduBom : bomRoute.getMbbProduBomList()) { - // 出库任务,进行基础物料的出库 - MdItem mdItemOutPlan = mdItemMapper.selectMdItemById(mbbProduBom.getMdItemId()); - WmsOutPlanDetail outPlanDetail = new WmsOutPlanDetail(); - outPlanDetail.setWmsOutPlanId(outPlan.getWmsOutPlanId()); - outPlanDetail.setMdItemId(mbbProduBom.getMdItemId()); - outPlanDetail.setMdItemCode(mdItemOutPlan.getItemCode()); - outPlanDetail.setMdItemName(mdItemOutPlan.getItemName()); - outPlanDetail.setMdItemUnit(mdItemOutPlan.getUnitName()); - outPlanDetail.setPlannedQuantity(mbbProduBom.getStandardDosage() * zdTask.getProductIdQty()); - outPlanDetail.setRealQuantity(mbbProduBom.getStandardDosage() * zdTask.getProductIdQty()); - outPlanDetail.setDetailBatchNum(batchNum); - // 查询库位信息 - WmStorageArea wmStorageArea = wmStorageAreaMapper.selectWmStorageAreaByAreaCode(zdTask.getAttr3()); - outPlanDetail.setWmStorageAreaId(wmStorageArea.getAreaId()); - outPlanDetail.setWmStorageAreaCode(wmStorageArea.getAreaCode()); - outPlanDetail.setWmStorageAreaName(wmStorageArea.getAreaName()); - outPlanDetail.setDetailState("1"); - wmsOutPlanDetailList.add(outPlanDetail); + // 锁定物料 + Boolean outPlanFlag = true; + for (int i = 0; i < zdTask.getProductIdQty(); i++) { + // 构建整刀 + BaseKnife baseKnife = new BaseKnife(); + MdItem mdItem = mdItemMapper.selectMdItemById(zdTask.getmProductId()); + baseKnife.setMbbBdMrlId(zdTask.getmProductId()); + baseKnife.setKnifeCode(mdItem.getItemCode()); + baseKnife.setKnifeName(mdItem.getItemName()); + baseKnife.setKnifeUnit(mdItem.getUnitName()); + baseKnife.setKnifeType(mdItem.getItemTypeName()); + WmStorageArea wmStorageArea = wmStorageAreaMapper.selectWmStorageAreaByAreaId(zdTask.getAreaId()); + baseKnife.setAreaCode(wmStorageArea.getAreaCode()); + baseKnife.setSafeStock(mdItem.getMinStock()); + baseKnife.setStandardQuantity("1"); + baseKnife.setKnifeLife(100); + baseKnife.setKnifeFineState(1); + baseKnife.setIsValid(1); + baseKnife.setZdTaskId(zdTask.getWmsZdTaskId()); + // 判断是否需要锁定整刀 + if (lockedFlag) { + baseKnife.setIsLocked(1); + baseKnife.setLockedStartTime(technologyBom.getLockedStartTime()); + baseKnife.setLockedEndTime(technologyBom.getLockedEndTime()); + } else { + baseKnife.setIsLocked(0); + } + // attr4 计划编码, 整刀 + baseKnife.setPlanSheet(zdTask.getPlanSheet()); + baseKnife.setItemOrProduct("PRODUCT"); + baseKnife.setCreateBy(getUsername()); + baseKnife.setCreateTime(DateUtils.getNowDate()); + baseKnifeMapper.insertBaseKnife(baseKnife); - // 查询未锁定的物料 - baseKnifeWrapper.setMbbBdMrlId(mbbProduBom.getMdItemId()); - baseKnifeWrapper.setIsLocked(0); - baseKnifeList = baseKnifeMapper.selectBaseKnifeList(baseKnifeWrapper); + // 锁定物料 + int resetCount = 0; + for (MbbProduBom mbbProduBom : bomRoute.getMbbProduBomList()) { + // 查询未锁定的物料 + baseKnifeWrapper.setMbbBdMrlId(mbbProduBom.getMdItemId()); + baseKnifeWrapper.setIsLocked(0); + baseKnifeList = baseKnifeMapper.selectBaseKnifeList(baseKnifeWrapper); - // 锁定基础 物料 - int bomCount = mbbProduBom.getStandardDosage(); - for (BaseKnife wmsBaseKnife : baseKnifeList){ - if (bomCount > 0){ - wmsBaseKnife.setIsLocked(1); - wmsBaseKnife.setKnifeFineState(2); - wmsBaseKnife.setLockedStartTime(technologyBom.getLockedStartTime()); - wmsBaseKnife.setLockedEndTime(technologyBom.getLockedEndTime()); -// wmsBaseKnife.setAttr1(baseKnife.getBaseKnifeId()); - wmsBaseKnife.setPlanSheet(zdTask.getAttr4()); - baseKnifeListOutPlan.add(wmsBaseKnife); - baseKnifeMapper.updateBaseKnife(wmsBaseKnife); - bomCount--; + if (outPlanFlag) { + // 出库任务,进行基础物料的出库 + MdItem mdItemOutPlan = mdItemMapper.selectMdItemById(mbbProduBom.getMdItemId()); + WmsOutPlanDetail outPlanDetail = new WmsOutPlanDetail(); + outPlanDetail.setWmsOutPlanId(outPlan.getWmsOutPlanId()); + outPlanDetail.setMdItemId(mbbProduBom.getMdItemId()); + outPlanDetail.setMdItemCode(mdItemOutPlan.getItemCode()); + outPlanDetail.setMdItemName(mdItemOutPlan.getItemName()); + outPlanDetail.setMdItemUnit(mdItemOutPlan.getUnitName()); + outPlanDetail.setPlannedQuantity(mbbProduBom.getStandardDosage() * zdTask.getProductIdQty()); + outPlanDetail.setRealQuantity(mbbProduBom.getStandardDosage() * zdTask.getProductIdQty()); + outPlanDetail.setDetailBatchNum(batchNum); + // 查询库位信息 + wmStorageArea = wmStorageAreaMapper.selectWmStorageAreaByAreaId(zdTask.getAreaId()); + outPlanDetail.setWmStorageAreaId(wmStorageArea.getAreaId()); + outPlanDetail.setWmStorageAreaCode(wmStorageArea.getAreaCode()); + outPlanDetail.setWmStorageAreaName(wmStorageArea.getAreaName()); + outPlanDetail.setDetailState("1"); + wmsOutPlanDetailList.add(outPlanDetail); + } + + // 锁定基础 物料 + int bomCount = mbbProduBom.getStandardDosage(); + for (BaseKnife wmsBaseKnife : baseKnifeList) { + if (bomCount > 0) { + wmsBaseKnife.setZdTaskId(zdTask.getWmsZdTaskId()); + wmsBaseKnife.setIsLocked(1); + wmsBaseKnife.setKnifeFineState(2); + wmsBaseKnife.setLockedStartTime(technologyBom.getLockedStartTime()); + wmsBaseKnife.setLockedEndTime(technologyBom.getLockedEndTime()); + wmsBaseKnife.setParentId(baseKnife.getBaseKnifeId()); + wmsBaseKnife.setPlanSheet(zdTask.getPlanSheet()); + baseKnifeListOutPlan.add(wmsBaseKnife); + baseKnifeMapper.updateBaseKnife(wmsBaseKnife); + bomCount--; + // 记录刀片重置次数 + resetCount += wmsBaseKnife.getResetCount(); + } } } + + // 更新重置次数 + outPlanFlag = false; + baseKnife.setResetCount(resetCount - 1); + baseKnifeMapper.updateBaseKnife(baseKnife); } // 出库 int i = 0; - for (WmsOutPlanDetail outPlanDetail : wmsOutPlanDetailList){ + for (WmsOutPlanDetail outPlanDetail : wmsOutPlanDetailList) { wmsOutPlanMapper.insertWmsOutPlanDetail(outPlanDetail); // 出库计划明细,绑定实体 @@ -280,56 +335,166 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService wmsOutTaskMapper.insertWmsOutTask(wmsOutTask); } + // 更新组装任务 zdTask.setStatus("1"); - zdTask.setQtyOk(zdTask.getProductIdQty()); +// zdTask.setQtyOk(zdTask.getProductIdQty()); wmsZdTaskMapper.updateWmsZdTask(zdTask); return AjaxResult.success(); + + +// String batchNum = "ZZPC001"; +// +// // 判断物料是否充足 +// BomRoute bomRoute = bomRouteMapper.selectBomRouteByBomRouteId(zdTask.getAttr1()); +// BaseKnife baseKnifeWrapper = new BaseKnife(); +// List baseKnifeList = new ArrayList<>(); +// +// // 遍历组装整刀需要的bom物料 +// for (MbbProduBom mbbProduBom : bomRoute.getMbbProduBomList()) { +// // 查找未锁定的物料 +// baseKnifeWrapper.setMbbBdMrlId(mbbProduBom.getMdItemId()); +// baseKnifeWrapper.setIsLocked(0); +// baseKnifeList = baseKnifeMapper.selectBaseKnifeList(baseKnifeWrapper); +// +// // 如果未锁定的物料不足所需数量 +// if (baseKnifeList.size() < mbbProduBom.getStandardDosage() * zdTask.getProductIdQty()) +// return AjaxResult.error("bom物料不足进行组装:" + mbbProduBom.getMdItemCode()); +// } +// +// List wmsOutPlanDetailList = new ArrayList<>(); +// List baseKnifeListOutPlan = new ArrayList<>(); +// +// BaseTechnologyBom technologyBom = new BaseTechnologyBom(); +// +// // 出库基础物料, 根据图号查询出库计划,如果不存在生成计划,存在则往计划中添加任务 +// WmsOutPlan outPlan = wmsOutPlanMapper.selectWmsOutPlanByPlanCode(zdTask.getAttr4()); +// if (outPlan == null){ +// // 构建新的出库计划 +// WmsOutPlan outPlanTemp = new WmsOutPlan(); +// outPlanTemp.setPlanCode(zdTask.getAttr4() == null ? zdTask.getCode() : zdTask.getAttr4()); +// outPlanTemp.setWmsBusinessTypeId(12L); +// outPlanTemp.setPlanState("1"); +// outPlanTemp.setPlanType("ZDCK"); +// outPlanTemp.setCreateBy(getUsername()); +// outPlanTemp.setCreateTime(DateUtils.getNowDate()); +// wmsOutPlanMapper.insertWmsOutPlan(outPlanTemp); +// outPlan = outPlanTemp; +// } +// +// // 出库任务 +// for (MbbProduBom mbbProduBom : bomRoute.getMbbProduBomList()) { +// // 出库任务,进行基础物料的出库 +// MdItem mdItemOutPlan = mdItemMapper.selectMdItemById(mbbProduBom.getMdItemId()); +// WmsOutPlanDetail outPlanDetail = new WmsOutPlanDetail(); +// outPlanDetail.setWmsOutPlanId(outPlan.getWmsOutPlanId()); +// outPlanDetail.setMdItemId(mbbProduBom.getMdItemId()); +// outPlanDetail.setMdItemCode(mdItemOutPlan.getItemCode()); +// outPlanDetail.setMdItemName(mdItemOutPlan.getItemName()); +// outPlanDetail.setMdItemUnit(mdItemOutPlan.getUnitName()); +// outPlanDetail.setPlannedQuantity(mbbProduBom.getStandardDosage() * zdTask.getProductIdQty()); +// outPlanDetail.setRealQuantity(mbbProduBom.getStandardDosage() * zdTask.getProductIdQty()); +// outPlanDetail.setDetailBatchNum(batchNum); +// // 查询库位信息 +// WmStorageArea wmStorageArea = wmStorageAreaMapper.selectWmStorageAreaByAreaCode(zdTask.getAttr3()); +// outPlanDetail.setWmStorageAreaId(wmStorageArea.getAreaId()); +// outPlanDetail.setWmStorageAreaCode(wmStorageArea.getAreaCode()); +// outPlanDetail.setWmStorageAreaName(wmStorageArea.getAreaName()); +// outPlanDetail.setDetailState("1"); +// wmsOutPlanDetailList.add(outPlanDetail); +// +// // 查询未锁定的物料 +// baseKnifeWrapper.setMbbBdMrlId(mbbProduBom.getMdItemId()); +// baseKnifeWrapper.setIsLocked(0); +// baseKnifeList = baseKnifeMapper.selectBaseKnifeList(baseKnifeWrapper); +// +// // 锁定基础 物料 +// int bomCount = mbbProduBom.getStandardDosage(); +// for (BaseKnife wmsBaseKnife : baseKnifeList){ +// if (bomCount > 0){ +// wmsBaseKnife.setIsLocked(1); +// wmsBaseKnife.setKnifeFineState(2); +// wmsBaseKnife.setLockedStartTime(technologyBom.getLockedStartTime()); +// wmsBaseKnife.setLockedEndTime(technologyBom.getLockedEndTime()); +//// wmsBaseKnife.setAttr1(baseKnife.getBaseKnifeId()); +// wmsBaseKnife.setPlanSheet(zdTask.getAttr4()); +// baseKnifeListOutPlan.add(wmsBaseKnife); +// baseKnifeMapper.updateBaseKnife(wmsBaseKnife); +// bomCount--; +// } +// } +// } +// +// // 出库 +// int i = 0; +// for (WmsOutPlanDetail outPlanDetail : wmsOutPlanDetailList){ +// wmsOutPlanMapper.insertWmsOutPlanDetail(outPlanDetail); +// +// // 出库计划明细,绑定实体 +// for (int j = 0; j < outPlanDetail.getPlannedQuantity(); j++) { +// WmsOutPlanDetailEntity wmsOutPlanDetailEntity = new WmsOutPlanDetailEntity(); +// wmsOutPlanDetailEntity.setBaseKnifeId(baseKnifeListOutPlan.get(i).getBaseKnifeId()); +// wmsOutPlanDetailEntity.setAreaCode(baseKnifeListOutPlan.get(i).getAreaCode()); +// wmsOutPlanDetailEntity.setItemOrProduct(baseKnifeListOutPlan.get(i).getItemOrProduct()); +// wmsOutPlanDetailEntity.setKnifeCode(baseKnifeListOutPlan.get(i).getKnifeCode()); +// wmsOutPlanDetailEntity.setKnifeName(baseKnifeListOutPlan.get(i).getKnifeName()); +// wmsOutPlanDetailEntity.setPlanSheet(baseKnifeListOutPlan.get(i).getPlanSheet()); +// wmsOutPlanDetailEntity.setKnifeLife(baseKnifeListOutPlan.get(i).getKnifeLife()); +// wmsOutPlanDetailEntity.setResetCount(baseKnifeListOutPlan.get(i).getResetCount()); +// wmsOutPlanDetailEntity.setKnifeUnit(baseKnifeListOutPlan.get(i).getKnifeUnit()); +// wmsOutPlanDetailEntity.setSafeStock(baseKnifeListOutPlan.get(i).getKnifeType()); +// wmsOutPlanDetailEntity.setStandardQuantity(baseKnifeListOutPlan.get(i++).getStandardQuantity()); +// wmsOutPlanDetailEntity.setWmsOutPlanDetailId(outPlanDetail.getWmsOutPlanDetailId()); +// wmsOutPlanDetailEntity.setCreateBy(getUsername()); +// wmsOutPlanDetailEntity.setCreateTime(DateUtils.getNowDate()); +// wmsOutPlanDetailEntityMapper.insertWmsOutPlanDetailEntity(wmsOutPlanDetailEntity); +// } +// +// // 生成出库任务 +// WmsOutTask wmsOutTask = new WmsOutTask(); +// wmsOutTask.setWmsOutPlanId(outPlan.getWmsOutPlanId()); +// wmsOutTask.setWmsOutPlanCode(outPlan.getPlanCode()); +// wmsOutTask.setWmsOutPlanDetailId(outPlanDetail.getWmsOutPlanDetailId()); +// // 出库类型 12组刀出库 +// wmsOutTask.setWmsBusinessTypeId(12L); +// wmsOutTask.setTaskCode(generateTaskCode(outPlan.getPlanCode())); +// wmsOutTask.setTaskNumber(outPlanDetail.getPlannedQuantity()); +// wmsOutTask.setOutNumber(outPlanDetail.getRealQuantity()); +// wmsOutTask.setWmStorageAreaId(outPlanDetail.getWmStorageAreaId()); +// wmsOutTask.setBatchNum(batchNum); +// wmsOutTask.setMdItemId(outPlanDetail.getMdItemId()); +// wmsOutTask.setMdItemCode(outPlanDetail.getMdItemCode()); +// wmsOutTask.setMdItemName(outPlanDetail.getMdItemName()); +// wmsOutTask.setMdItemUnit(outPlanDetail.getMdItemUnit()); +// wmsOutTask.setTaskState("1"); +// wmsOutTask.setRecipientUsername(""); +// wmsOutTask.setCreateBy(getUsername()); +// wmsOutTask.setCreateTime(DateUtils.getNowDate()); +// wmsOutTaskMapper.insertWmsOutTask(wmsOutTask); +// } +// +// // 更新组装任务 +// zdTask.setStatus("1"); +// zdTask.setQtyOk(zdTask.getProductIdQty()); +// wmsZdTaskMapper.updateWmsZdTask(zdTask); +// return AjaxResult.success(); } @Override + @Transactional public AjaxResult createInTaskByWmsZdTask(WmsZdTask zdTask) { String batchNum = "ZZPC001"; - BaseTechnologyBom technologyBom = new BaseTechnologyBom(); - - for (int i = 0; i < zdTask.getProductIdQty(); i++) { - // 构建整刀 - BaseKnife baseKnife = new BaseKnife(); - MdItem mdItem = mdItemMapper.selectMdItemById(zdTask.getmProductId()); - baseKnife.setMbbBdMrlId(zdTask.getmProductId()); - baseKnife.setKnifeCode(mdItem.getItemCode()); - baseKnife.setKnifeName(mdItem.getItemName()); - baseKnife.setKnifeUnit(mdItem.getUnitName()); - baseKnife.setKnifeType(mdItem.getItemTypeName()); - // attr3 库位编码 - baseKnife.setAreaCode(zdTask.getAttr3()); - baseKnife.setSafeStock(mdItem.getMinStock()); - baseKnife.setStandardQuantity("1"); - baseKnife.setKnifeLife(100); - baseKnife.setKnifeFineState(1); - // 判断是否需要锁定整刀 - baseKnife.setIsLocked(1); - baseKnife.setLockedStartTime(technologyBom.getLockedStartTime()); - baseKnife.setLockedEndTime(technologyBom.getLockedEndTime()); - - // attr4 计划编码, 整刀 - baseKnife.setPlanSheet(zdTask.getAttr4()); - baseKnife.setItemOrProduct("PRODUCT"); - baseKnife.setCreateBy(getUsername()); - baseKnife.setCreateTime(DateUtils.getNowDate()); - baseKnifeMapper.insertBaseKnife(baseKnife); - } - // 整刀入库计划, 根据图号查询入库计划,如果不存在生成计划,存在则往计划中添加任务 - WmsInPlan wmsInPlan = wmsInPlanMapper.selectWmsInPlanByPlanCode(zdTask.getAttr4()); - if (wmsInPlan == null){ + WmsInPlan wmsInPlan = wmsInPlanService.selectWmsInPlanByPlanCode(zdTask.getPlanSheet()); + if (wmsInPlan == null) { WmsInPlan wmsInPlanTemp = new WmsInPlan(); wmsInPlanTemp.setState("1"); wmsInPlanTemp.setSourceType("SGLR"); - wmsInPlanTemp.setCellCode(zdTask.getAttr3()); - wmsInPlanTemp.setPlanCode(zdTask.getAttr4() == null ? zdTask.getCode() : zdTask.getAttr4()); + WmStorageArea wmStorageArea = wmStorageAreaMapper.selectWmStorageAreaByAreaId(zdTask.getAreaId()); + wmsInPlanTemp.setCellCode(wmStorageArea.getAreaCode()); + wmsInPlanTemp.setPlanCode(zdTask.getPlanSheet() == null ? zdTask.getCode() : zdTask.getPlanSheet()); wmsInPlanTemp.setRelBillCode("组装单据"); wmsInPlanTemp.setPlanTypeId("13"); wmsInPlanTemp.setCreateBy(getUsername()); @@ -346,7 +511,7 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService wmsInPlanDetails.setPlanInStatus("0"); wmsInPlanDetailsList.add(wmsInPlanDetails); wmsInPlanTemp.setWmsInPlanDetailsList(wmsInPlanDetailsList); - wmsInPlanMapper.insertWmsInPlan(wmsInPlanTemp); + wmsInPlanService.insertWmsInPlan(wmsInPlanTemp); wmsInPlan = wmsInPlanTemp; } else { // 入库任务明细 @@ -360,26 +525,41 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService wmsInPlanDetails.setPlanInStatus("0"); wmsInPlanDetailsList.add(wmsInPlanDetails); wmsInPlan.setWmsInPlanDetailsList(wmsInPlanDetailsList); - wmsInPlanMapper.updateWmsInPlan(wmsInPlan); + wmsInPlanService.updateWmsInPlan(wmsInPlan); } // 入库任务 MdItem mdItem = mdItemMapper.selectMdItemById(zdTask.getmProductId()); WmsInTask wmsInTask = new WmsInTask(); - wmsInTask.setTaskInCode(MultiModuleCodeGenerator.generateTaskCode("RKT")); + // 生成任务号 + String taskInCode = MultiModuleCodeGenerator.generateTaskCode("RKT"); + wmsInTask.setTaskInCode(taskInCode); wmsInTask.setPlanInId(wmsInPlan.getPlanId().toString()); wmsInTask.setPlanInCode(wmsInPlan.getPlanCode()); wmsInTask.setMaterialCode(mdItem.getItemCode()); wmsInTask.setTaskInQuantity(zdTask.getProductIdQty()); wmsInTask.setActualInQuantity(zdTask.getProductIdQty()); - WmStorageArea wmStorageArea = wmStorageAreaMapper.selectWmStorageAreaByAreaCode(zdTask.getAttr3()); + WmStorageArea wmStorageArea = wmStorageAreaMapper.selectWmStorageAreaByAreaId(zdTask.getAreaId()); wmsInTask.setCellTgt(wmStorageArea.getAreaId()); wmsInTask.setBatch(batchNum); wmsInTask.setMaterialId(zdTask.getmProductId().toString()); wmsInTask.setPlanTypeId("9"); wmsInTask.setPlanInStatus("1"); + wmsInTask.setCreateBy(getUsername()); + wmsInTask.setCreateTime(DateUtils.getNowDate()); wmsInTaskMapper.insertWmsInTask(wmsInTask); + // 整 刀台账设为有效 + BaseKnife baseKnifeWrapper = new BaseKnife(); + baseKnifeWrapper.setZdTaskId(zdTask.getWmsZdTaskId()); + baseKnifeWrapper.setMbbBdMrlId(zdTask.getmProductId()); + List baseKnifeList = baseKnifeMapper.selectBaseKnifeNotValidList(baseKnifeWrapper); + baseKnifeList.forEach(baseKnife -> { + baseKnife.setIsValid(0); + baseKnife.setCreateTime(DateUtils.getNowDate()); + baseKnifeMapper.updateBaseKnife(baseKnife); + }); + // 更新组装任务 zdTask.setStatus("2"); zdTask.setQtyOk(zdTask.getProductIdQty()); diff --git a/ktg-mes/src/main/resources/mapper/md/BaseKnifeMapper.xml b/ktg-mes/src/main/resources/mapper/md/BaseKnifeMapper.xml index 2d2170f..0be378a 100644 --- a/ktg-mes/src/main/resources/mapper/md/BaseKnifeMapper.xml +++ b/ktg-mes/src/main/resources/mapper/md/BaseKnifeMapper.xml @@ -22,6 +22,9 @@ + + + @@ -70,7 +73,7 @@ SELECT BK.BASE_KNIFE_ID, BK.MBB_BD_MRL_ID, - RFID, + BK.RFID, MI.ITEM_CODE AS KNIFE_CODE, MI.ITEM_NAME AS KNIFE_NAME, MI.UNIT_NAME AS KNIFE_UNIT, @@ -86,6 +89,9 @@ BK.RESET_COUNT, BK.ITEM_OR_PRODUCT, BK.PLAN_SHEET, + BK.PARENT_ID, + BK.IS_VALID, + BK.ZD_TASK_ID, BK.REMARK, BK.ATTR1, BK.ATTR2, @@ -103,6 +109,7 @@ + + @@ -45,6 +53,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and "product_id_qty" = #{productIdQty} and PLAN_OUT_ID = #{planOutId} and PLAN_OUT_TYPE = #{planOutType} + and technology_bom_id = #{technologyBomId} and QTY_OK = #{qtyOk} and REMARK = #{remark} and ATTR1 = #{attr1} @@ -81,6 +90,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ATTR2, ATTR3, ATTR4, + technology_bom_id, + bom_id, + area_id, + process_code, + plan_sheet, CREATE_BY, CREATE_TIME, UPDATE_BY, @@ -101,6 +115,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{attr2}, #{attr3}, #{attr4}, + #{technologyBomId}, + #{bomId}, + #{areaId}, + #{processCode}, + #{planSheet}, #{createBy}, #{createTime}, #{updateBy}, @@ -119,6 +138,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" QTY = #{qty}, PLAN_OUT_ID = #{planOutId}, PLAN_OUT_TYPE = #{planOutType}, + area_id = #{areaId}, QTY_OK = #{qtyOk}, REMARK = #{remark}, ATTR1 = #{attr1}, From bb93abcee8e7f1fe5bc1b788c9d08645d1cf01db Mon Sep 17 00:00:00 2001 From: LJW Date: Fri, 15 Nov 2024 14:04:18 +0800 Subject: [PATCH 2/3] =?UTF-8?q?feat(=E5=8F=B0=E8=B4=A6):=20=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2rfid=E6=98=AF=E5=90=A6=E5=94=AF=E4=B8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ktg/mes/md/controller/BaseKnifeController.java | 9 +++++++++ .../main/java/com/ktg/mes/md/mapper/BaseKnifeMapper.java | 9 +++++++++ .../java/com/ktg/mes/md/service/IBaseKnifeService.java | 8 ++++++++ .../ktg/mes/md/service/impl/BaseKnifeServiceImpl.java | 9 +++++++++ ktg-mes/src/main/resources/mapper/md/BaseKnifeMapper.xml | 6 ++++++ 5 files changed, 41 insertions(+) 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 339ff9c..aacefbc 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 @@ -877,6 +877,15 @@ public class BaseKnifeController extends BaseController { return AjaxResult.success(baseKnifeService.selectBaseKnifeByBaseKnifeId(baseKnifeId)); } + /** + * 查询台账RFID是否重复 + */ + @PreAuthorize("@ss.hasPermi('md:baseKnife:query')") + @GetMapping(value = "/isDuplicateRfid/{rfid}") + public AjaxResult isDuplicateRfid(@PathVariable("rfid") String rfid) { + return AjaxResult.success(baseKnifeService.isDuplicateRfid(rfid)); + } + /** * 新增工具台账 */ diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/mapper/BaseKnifeMapper.java b/ktg-mes/src/main/java/com/ktg/mes/md/mapper/BaseKnifeMapper.java index d959460..77a19ea 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/md/mapper/BaseKnifeMapper.java +++ b/ktg-mes/src/main/java/com/ktg/mes/md/mapper/BaseKnifeMapper.java @@ -2,6 +2,7 @@ package com.ktg.mes.md.mapper; import com.ktg.mes.md.domain.BaseKnife; import com.ktg.mes.md.domain.MdItem; +import com.sun.org.apache.xpath.internal.operations.Bool; import org.apache.ibatis.annotations.Param; import java.util.List; @@ -103,5 +104,13 @@ public interface BaseKnifeMapper { long countBaseKnife(@Param("mbbBdMrlId") Long mbbBdMrlId); + /** + * 查询台账RFID是否重复 + * + * @param rfid 物料产品列表 + * @return 结果 + */ + public Boolean isDuplicateRfid(String rfid); + List selectBaseKnifeNotValidList(BaseKnife baseKnifeWrapper); } diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/service/IBaseKnifeService.java b/ktg-mes/src/main/java/com/ktg/mes/md/service/IBaseKnifeService.java index c90574a..b556d74 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/md/service/IBaseKnifeService.java +++ b/ktg-mes/src/main/java/com/ktg/mes/md/service/IBaseKnifeService.java @@ -60,4 +60,12 @@ public interface IBaseKnifeService public int deleteBaseKnifeByBaseKnifeId(Long baseKnifeId); public int resetBaseKnifeByBaseKnifeId(Long baseKnifeId); + + /** + * 查询台账RFID是否重复 + * + * @param rfid rfid + * @return 结果 + */ + public Boolean isDuplicateRfid(String rfid); } diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/BaseKnifeServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/BaseKnifeServiceImpl.java index d436ca0..bb56fdb 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/BaseKnifeServiceImpl.java +++ b/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/BaseKnifeServiceImpl.java @@ -182,4 +182,13 @@ public class BaseKnifeServiceImpl implements IBaseKnifeService { return baseKnifeMapper.resetBaseKnife(baseKnifeId); } + /** + * 查询台账RFID是否重复 + * + * @param rfid rfid + * @return 结果 + */ + public Boolean isDuplicateRfid(String rfid){ + return baseKnifeMapper.isDuplicateRfid(rfid); + } } diff --git a/ktg-mes/src/main/resources/mapper/md/BaseKnifeMapper.xml b/ktg-mes/src/main/resources/mapper/md/BaseKnifeMapper.xml index 0be378a..a14b6df 100644 --- a/ktg-mes/src/main/resources/mapper/md/BaseKnifeMapper.xml +++ b/ktg-mes/src/main/resources/mapper/md/BaseKnifeMapper.xml @@ -636,4 +636,10 @@ and (KNIFE_FINE_STATE = 0 OR KNIFE_FINE_STATE = 1) + + \ No newline at end of file From e599a0cb5db6ebc5330ae8d8c61092e13073a977 Mon Sep 17 00:00:00 2001 From: Stang <32996823@qq.com> Date: Fri, 15 Nov 2024 15:04:06 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=BB=84=E8=A3=85?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../md/controller/BaseKnifeController.java | 133 +++++++++--------- .../md/service/impl/BaseKnifeServiceImpl.java | 7 + .../wm/controller/WmsZdTaskController.java | 5 + .../ktg/mes/wm/mapper/WmsInTaskMapper.java | 1 + .../ktg/mes/wm/mapper/WmsZdTaskMapper.java | 2 + .../ktg/mes/wm/service/IWmsZdTaskService.java | 2 + .../wm/service/impl/WmsZdTaskServiceImpl.java | 27 +++- .../resources/mapper/md/BaseKnifeMapper.xml | 3 + .../resources/mapper/wm/WmsZdTaskMapper.xml | 5 + 9 files changed, 110 insertions(+), 75 deletions(-) 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 aacefbc..c8a3ec5 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 @@ -6,6 +6,7 @@ import javax.servlet.http.HttpServletResponse; import com.alibaba.fastjson.JSON; import com.ktg.common.utils.DateUtils; +import com.ktg.generator.util.MultiModuleCodeGenerator; import com.ktg.mes.md.domain.*; import com.ktg.mes.md.mapper.WmsOutPlanDetailEntityMapper; import com.ktg.mes.md.mapper.WmsOutPlanMapper; @@ -554,11 +555,11 @@ public class BaseKnifeController extends BaseController { // 生成组装任务 WmsZdTask wmsZdTask = new WmsZdTask(); wmsZdTask.setmProductId(mdItem.getItemId()); - wmsZdTask.setAttr4(planSheet); - wmsZdTask.setCode(techBom.getProcessCode()); + wmsZdTask.setPlanSheet(planSheet); + wmsZdTask.setCode(generateTaskCode(techBom.getProcessCode())); wmsZdTask.setName(techBom.getProcessName()); wmsZdTask.setProductIdQty(count); - wmsZdTask.setAttr1(bomRouteList.get(0).getBomRouteId()); + wmsZdTask.setBomId(bomRouteList.get(0).getBomRouteId()); wmsZdTask.setCreateTime(DateUtils.getNowDate()); zdTaskService.insertWmsZdTask(wmsZdTask); msg = "生产准备验证成功!缺少物料已生成组装任务!"; @@ -769,65 +770,65 @@ public class BaseKnifeController extends BaseController { mdItemService.updateMdItem(mdItem); } -// // 整刀入库计划, 根据图号查询入库计划,如果不存在生成计划,存在则往计划中添加任务 -// WmsInPlan wmsInPlan = wmsInPlanService.selectWmsInPlanByPlanCode(zdTask.getAttr4()); -// if (wmsInPlan == null) { -// WmsInPlan wmsInPlanTemp = new WmsInPlan(); -// wmsInPlanTemp.setState("1"); -// wmsInPlanTemp.setSourceType("SGLR"); -// wmsInPlanTemp.setCellCode(zdTask.getAttr3()); -// wmsInPlanTemp.setPlanCode(zdTask.getAttr4() == null ? zdTask.getCode() : zdTask.getAttr4()); -// wmsInPlanTemp.setRelBillCode("组装单据"); -// wmsInPlanTemp.setPlanTypeId("13"); -// wmsInPlanTemp.setCreateBy(getUsername()); -// wmsInPlanTemp.setCreateTime(DateUtils.getNowDate()); -// -// // 入库任务明细 -// List wmsInPlanDetailsList = new ArrayList<>(); -// WmsInPlanDetails wmsInPlanDetails = new WmsInPlanDetails(); -// wmsInPlanDetails.setMaterialId(zdTask.getmProductId().toString()); -// wmsInPlanDetails.setBatch(batchNum); -// wmsInPlanDetails.setCellId(1L); -// wmsInPlanDetails.setQuantity(zdTask.getProductIdQty().toString()); -// wmsInPlanDetails.setQuantityIn(zdTask.getProductIdQty().toString()); -// wmsInPlanDetails.setPlanInStatus("0"); -// wmsInPlanDetailsList.add(wmsInPlanDetails); -// wmsInPlanTemp.setWmsInPlanDetailsList(wmsInPlanDetailsList); -// wmsInPlanService.insertWmsInPlan(wmsInPlanTemp); -// wmsInPlan = wmsInPlanTemp; -// } else { -// // 入库任务明细 -// List wmsInPlanDetailsList = wmsInPlan.getWmsInPlanDetailsList(); -// WmsInPlanDetails wmsInPlanDetails = new WmsInPlanDetails(); -// wmsInPlanDetails.setMaterialId(zdTask.getmProductId().toString()); -// wmsInPlanDetails.setBatch(batchNum); -// wmsInPlanDetails.setCellId(1L); -// wmsInPlanDetails.setQuantity(zdTask.getProductIdQty().toString()); -// wmsInPlanDetails.setQuantityIn(zdTask.getProductIdQty().toString()); -// wmsInPlanDetails.setPlanInStatus("0"); -// wmsInPlanDetailsList.add(wmsInPlanDetails); -// wmsInPlan.setWmsInPlanDetailsList(wmsInPlanDetailsList); -// wmsInPlanService.updateWmsInPlan(wmsInPlan); -// } -// -// // 入库任务 -// MdItem mdItem = mdItemService.selectMdItemById(zdTask.getmProductId()); -// WmsInTask wmsInTask = new WmsInTask(); -// // 生成任务号 -// String taskInCode = MultiModuleCodeGenerator.generateTaskCode("RKT"); -// wmsInTask.setTaskInCode(taskInCode); -// wmsInTask.setPlanInId(wmsInPlan.getPlanId().toString()); -// wmsInTask.setPlanInCode(wmsInPlan.getPlanCode()); -// wmsInTask.setMaterialCode(mdItem.getItemCode()); -// wmsInTask.setTaskInQuantity(zdTask.getProductIdQty()); -// wmsInTask.setActualInQuantity(zdTask.getProductIdQty()); -// WmStorageArea wmStorageArea = wmStorageAreaService.selectWmStorageAreaByAreaCode(zdTask.getAttr3()); -// wmsInTask.setCellTgt(wmStorageArea.getAreaId()); -// wmsInTask.setBatch(batchNum); -// wmsInTask.setMaterialId(zdTask.getmProductId().toString()); -// wmsInTask.setPlanTypeId("9"); -// wmsInTask.setPlanInStatus("1"); -// wmsInTaskService.insertWmsInTask(wmsInTask); + // 整刀入库计划, 根据图号查询入库计划,如果不存在生成计划,存在则往计划中添加任务 + WmsInPlan wmsInPlan = wmsInPlanService.selectWmsInPlanByPlanCode(zdTask.getAttr4()); + if (wmsInPlan == null) { + WmsInPlan wmsInPlanTemp = new WmsInPlan(); + wmsInPlanTemp.setState("1"); + wmsInPlanTemp.setSourceType("SGLR"); + wmsInPlanTemp.setCellCode(zdTask.getAttr3()); + wmsInPlanTemp.setPlanCode(zdTask.getAttr4() == null ? zdTask.getCode() : zdTask.getAttr4()); + wmsInPlanTemp.setRelBillCode("组装单据"); + wmsInPlanTemp.setPlanTypeId("13"); + wmsInPlanTemp.setCreateBy(getUsername()); + wmsInPlanTemp.setCreateTime(DateUtils.getNowDate()); + + // 入库任务明细 + List wmsInPlanDetailsList = new ArrayList<>(); + WmsInPlanDetails wmsInPlanDetails = new WmsInPlanDetails(); + wmsInPlanDetails.setMaterialId(zdTask.getmProductId().toString()); + wmsInPlanDetails.setBatch(batchNum); + wmsInPlanDetails.setCellId(1L); + wmsInPlanDetails.setQuantity(zdTask.getProductIdQty().toString()); + wmsInPlanDetails.setQuantityIn(zdTask.getProductIdQty().toString()); + wmsInPlanDetails.setPlanInStatus("0"); + wmsInPlanDetailsList.add(wmsInPlanDetails); + wmsInPlanTemp.setWmsInPlanDetailsList(wmsInPlanDetailsList); + wmsInPlanService.insertWmsInPlan(wmsInPlanTemp); + wmsInPlan = wmsInPlanTemp; + } else { + // 入库任务明细 + List wmsInPlanDetailsList = wmsInPlan.getWmsInPlanDetailsList(); + WmsInPlanDetails wmsInPlanDetails = new WmsInPlanDetails(); + wmsInPlanDetails.setMaterialId(zdTask.getmProductId().toString()); + wmsInPlanDetails.setBatch(batchNum); + wmsInPlanDetails.setCellId(1L); + wmsInPlanDetails.setQuantity(zdTask.getProductIdQty().toString()); + wmsInPlanDetails.setQuantityIn(zdTask.getProductIdQty().toString()); + wmsInPlanDetails.setPlanInStatus("0"); + wmsInPlanDetailsList.add(wmsInPlanDetails); + wmsInPlan.setWmsInPlanDetailsList(wmsInPlanDetailsList); + wmsInPlanService.updateWmsInPlan(wmsInPlan); + } + + // 入库任务 + MdItem mdItem = mdItemService.selectMdItemById(zdTask.getmProductId()); + WmsInTask wmsInTask = new WmsInTask(); + // 生成任务号 + String taskInCode = MultiModuleCodeGenerator.generateTaskCode("RKT"); + wmsInTask.setTaskInCode(taskInCode); + wmsInTask.setPlanInId(wmsInPlan.getPlanId().toString()); + wmsInTask.setPlanInCode(wmsInPlan.getPlanCode()); + wmsInTask.setMaterialCode(mdItem.getItemCode()); + wmsInTask.setTaskInQuantity(zdTask.getProductIdQty()); + wmsInTask.setActualInQuantity(zdTask.getProductIdQty()); + WmStorageArea wmStorageArea = wmStorageAreaService.selectWmStorageAreaByAreaCode(zdTask.getAttr3()); + wmsInTask.setCellTgt(wmStorageArea.getAreaId()); + wmsInTask.setBatch(batchNum); + wmsInTask.setMaterialId(zdTask.getmProductId().toString()); + wmsInTask.setPlanTypeId("9"); + wmsInTask.setPlanInStatus("1"); + wmsInTaskService.insertWmsInTask(wmsInTask); // 更新组装任务 @@ -845,14 +846,6 @@ public class BaseKnifeController extends BaseController { public TableDataInfo list(BaseKnife baseKnife) { startPage(); List list = baseKnifeService.selectBaseKnifeList(baseKnife); - list.forEach(item -> { - // 查询基础物料 - if ("PRODUCT".equals(item.getItemOrProduct())) { - BaseKnife baseKnifeWrapper = new BaseKnife(); - baseKnifeWrapper.setAttr1(item.getBaseKnifeId()); - item.setBaseKnifeList(baseKnifeService.selectBaseKnifeList(baseKnifeWrapper)); - } - }); return getDataTable(list); } diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/BaseKnifeServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/BaseKnifeServiceImpl.java index bb56fdb..21a08e6 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/BaseKnifeServiceImpl.java +++ b/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/BaseKnifeServiceImpl.java @@ -119,6 +119,13 @@ public class BaseKnifeServiceImpl implements IBaseKnifeService { wmsInPlanDetailEntityQuery.setKnifeId(nowBaseKnife.getBaseKnifeId()); List wmsInPlanDetailEntityList = wmsInPlanDetailEntityService.selectWmsInPlanDetailEntityList(wmsInPlanDetailEntityQuery); nowBaseKnife.setInInfoList(wmsInPlanDetailEntityList); + + // 查询基础物料 + if ("PRODUCT".equals(nowBaseKnife.getItemOrProduct())) { + BaseKnife baseKnifeWrapper = new BaseKnife(); + baseKnifeWrapper.setParentId(nowBaseKnife.getBaseKnifeId()); + nowBaseKnife.setBaseKnifeList(baseKnifeMapper.selectBaseKnifeList(baseKnifeWrapper)); + } }); return baseKnifeList; diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmsZdTaskController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmsZdTaskController.java index 7cf82a1..030d079 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmsZdTaskController.java +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmsZdTaskController.java @@ -2,6 +2,8 @@ package com.ktg.mes.wm.controller; import java.util.List; import javax.servlet.http.HttpServletResponse; + +import com.ktg.common.constant.UserConstants; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; @@ -100,6 +102,9 @@ public class WmsZdTaskController extends BaseController @PostMapping public AjaxResult add(@RequestBody WmsZdTask wmsZdTask) { + if (UserConstants.NOT_UNIQUE.equals(wmsZdTaskService.checkTaskCodeUnique(wmsZdTask))) { + return AjaxResult.error("新增物料" + wmsZdTask.getCode() + "失败,任务编码已存在"); + } return toAjax(wmsZdTaskService.insertWmsZdTask(wmsZdTask)); } diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmsInTaskMapper.java b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmsInTaskMapper.java index 74bb03a..45d6f1c 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmsInTaskMapper.java +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmsInTaskMapper.java @@ -2,6 +2,7 @@ package com.ktg.mes.wm.mapper; import java.util.List; import com.ktg.mes.wm.domain.WmsInTask; +import com.ktg.mes.wm.domain.WmsZdTask; /** * 入库任务Mapper接口 diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmsZdTaskMapper.java b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmsZdTaskMapper.java index 76ebd16..9eb69cf 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmsZdTaskMapper.java +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmsZdTaskMapper.java @@ -58,4 +58,6 @@ public interface WmsZdTaskMapper * @return 结果 */ public int deleteWmsZdTaskByWmsZdTaskIds(String[] wmsZdTaskIds); + + WmsZdTask checkTaskCodeUnique(WmsZdTask wmsZdTask); } diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmsZdTaskService.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmsZdTaskService.java index d66cc6c..9b561e5 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmsZdTaskService.java +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmsZdTaskService.java @@ -64,4 +64,6 @@ public interface IWmsZdTaskService AjaxResult createOutTaskByWmsZdTask(WmsZdTask wmsZdTask); AjaxResult createInTaskByWmsZdTask(WmsZdTask wmsZdTask); + + String checkTaskCodeUnique(WmsZdTask wmsZdTask); } 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 453fe5a..0a759e5 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 @@ -3,8 +3,10 @@ package com.ktg.mes.wm.service.impl; import java.util.ArrayList; import java.util.List; +import com.ktg.common.constant.UserConstants; import com.ktg.common.core.domain.AjaxResult; import com.ktg.common.utils.DateUtils; +import com.ktg.common.utils.StringUtils; import com.ktg.generator.util.MultiModuleCodeGenerator; import com.ktg.mes.md.domain.*; import com.ktg.mes.md.mapper.*; @@ -180,6 +182,11 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService // attr4 组装任务所属计划单, 如果为空则是手动组装任务不需要锁定 if (zdTask.getPlanSheet() != null) { lockedFlag = true; + BaseTechnologyBom technologyBomWrapper = new BaseTechnologyBom(); + technologyBomWrapper.setProcessCode(zdTask.getProcessCode()); + MdItem mdItemTemp = mdItemMapper.selectMdItemById(zdTask.getmProductId()); + technologyBomWrapper.setKnifeCode(mdItemTemp.getItemCode()); + technologyBom = baseTechnologyBomMapper.selectBaseTechnologyBomList(technologyBomWrapper).get(0); } // 出库基础物料, 根据图号查询出库计划,如果不存在生成计划,存在则往计划中添加任务 @@ -216,7 +223,6 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService baseKnife.setKnifeLife(100); baseKnife.setKnifeFineState(1); baseKnife.setIsValid(1); - baseKnife.setZdTaskId(zdTask.getWmsZdTaskId()); // 判断是否需要锁定整刀 if (lockedFlag) { baseKnife.setIsLocked(1); @@ -227,6 +233,7 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService } // attr4 计划编码, 整刀 baseKnife.setPlanSheet(zdTask.getPlanSheet()); + baseKnife.setZdTaskId(zdTask.getWmsZdTaskId()); baseKnife.setItemOrProduct("PRODUCT"); baseKnife.setCreateBy(getUsername()); baseKnife.setCreateTime(DateUtils.getNowDate()); @@ -487,12 +494,12 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService String batchNum = "ZZPC001"; // 整刀入库计划, 根据图号查询入库计划,如果不存在生成计划,存在则往计划中添加任务 + WmStorageArea wmStorageArea = wmStorageAreaMapper.selectWmStorageAreaByAreaId(zdTask.getAreaId()); WmsInPlan wmsInPlan = wmsInPlanService.selectWmsInPlanByPlanCode(zdTask.getPlanSheet()); if (wmsInPlan == null) { WmsInPlan wmsInPlanTemp = new WmsInPlan(); wmsInPlanTemp.setState("1"); wmsInPlanTemp.setSourceType("SGLR"); - WmStorageArea wmStorageArea = wmStorageAreaMapper.selectWmStorageAreaByAreaId(zdTask.getAreaId()); wmsInPlanTemp.setCellCode(wmStorageArea.getAreaCode()); wmsInPlanTemp.setPlanCode(zdTask.getPlanSheet() == null ? zdTask.getCode() : zdTask.getPlanSheet()); wmsInPlanTemp.setRelBillCode("组装单据"); @@ -505,7 +512,7 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService WmsInPlanDetails wmsInPlanDetails = new WmsInPlanDetails(); wmsInPlanDetails.setMaterialId(zdTask.getmProductId().toString()); wmsInPlanDetails.setBatch(batchNum); - wmsInPlanDetails.setCellId(1L); + wmsInPlanDetails.setCellId(wmStorageArea.getAreaId()); wmsInPlanDetails.setQuantity(zdTask.getProductIdQty().toString()); wmsInPlanDetails.setQuantityIn(zdTask.getProductIdQty().toString()); wmsInPlanDetails.setPlanInStatus("0"); @@ -519,7 +526,7 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService WmsInPlanDetails wmsInPlanDetails = new WmsInPlanDetails(); wmsInPlanDetails.setMaterialId(zdTask.getmProductId().toString()); wmsInPlanDetails.setBatch(batchNum); - wmsInPlanDetails.setCellId(1L); + wmsInPlanDetails.setCellId(wmStorageArea.getAreaId()); wmsInPlanDetails.setQuantity(zdTask.getProductIdQty().toString()); wmsInPlanDetails.setQuantityIn(zdTask.getProductIdQty().toString()); wmsInPlanDetails.setPlanInStatus("0"); @@ -539,7 +546,6 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService wmsInTask.setMaterialCode(mdItem.getItemCode()); wmsInTask.setTaskInQuantity(zdTask.getProductIdQty()); wmsInTask.setActualInQuantity(zdTask.getProductIdQty()); - WmStorageArea wmStorageArea = wmStorageAreaMapper.selectWmStorageAreaByAreaId(zdTask.getAreaId()); wmsInTask.setCellTgt(wmStorageArea.getAreaId()); wmsInTask.setBatch(batchNum); wmsInTask.setMaterialId(zdTask.getmProductId().toString()); @@ -566,4 +572,15 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService wmsZdTaskMapper.updateWmsZdTask(zdTask); return AjaxResult.success(); } + + @Override + public String checkTaskCodeUnique(WmsZdTask wmsZdTask) { + WmsZdTask zdTask = wmsZdTaskMapper.checkTaskCodeUnique(wmsZdTask); + Long zdTaskId = wmsZdTask.getWmsZdTaskId() == null ? -1L : wmsZdTask.getWmsZdTaskId(); + if (StringUtils.isNotNull(zdTask) && zdTask.getWmsZdTaskId().longValue() != zdTaskId.longValue()) { + return UserConstants.NOT_UNIQUE; + } else { + return UserConstants.UNIQUE; + } + } } diff --git a/ktg-mes/src/main/resources/mapper/md/BaseKnifeMapper.xml b/ktg-mes/src/main/resources/mapper/md/BaseKnifeMapper.xml index a14b6df..8e04ac6 100644 --- a/ktg-mes/src/main/resources/mapper/md/BaseKnifeMapper.xml +++ b/ktg-mes/src/main/resources/mapper/md/BaseKnifeMapper.xml @@ -152,6 +152,9 @@ and BK.plan_sheet = #{planSheet} + + and BK.parent_id = #{parentId} + and BK.zd_task_id = #{zdTaskId} diff --git a/ktg-mes/src/main/resources/mapper/wm/WmsZdTaskMapper.xml b/ktg-mes/src/main/resources/mapper/wm/WmsZdTaskMapper.xml index 3a1e6d3..6de191b 100644 --- a/ktg-mes/src/main/resources/mapper/wm/WmsZdTaskMapper.xml +++ b/ktg-mes/src/main/resources/mapper/wm/WmsZdTaskMapper.xml @@ -163,4 +163,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{wmsZdTaskId} + + \ No newline at end of file