From 614299992d69ba10053fd14867ae11936cd65e1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B1=A4=E9=94=A6=E7=A7=91?= <32996823@qq.com> Date: Mon, 25 Nov 2024 21:08:13 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=84=E8=A3=85=E4=BB=BB=E5=8A=A1=E7=94=9F?= =?UTF-8?q?=E6=88=90=E5=BE=85=E6=89=A7=E8=A1=8C=E5=85=A5=E5=BA=93=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ktg-admin/pom.xml | 70 +---- .../src/main/resources/application-druid.yml | 4 +- ktg-admin/src/main/resources/application.yml | 6 +- ktg-admin/src/test/WmsInPlanTest.java | 4 +- ktg-admin/src/test/WmsOutPlanTest.java | 4 +- .../md/controller/BaseKnifeController.java | 2 +- .../md/controller/WmsOutTaskController.java | 11 + .../service/impl/WmsOutPlanServiceImpl.java | 2 +- .../wm/controller/WmsInTaskController.java | 244 +++++++++++++++++- .../wm/service/impl/WmsZdTaskServiceImpl.java | 29 ++- 10 files changed, 275 insertions(+), 101 deletions(-) diff --git a/ktg-admin/pom.xml b/ktg-admin/pom.xml index dbebbe6..d1db2ec 100644 --- a/ktg-admin/pom.xml +++ b/ktg-admin/pom.xml @@ -30,41 +30,6 @@ springfox-boot-starter - - - - org.springframework.boot - spring-boot-starter-test - test - - - junit - junit - test - - - - - org.springframework.boot - spring-boot-starter-tomcat - provided - - - - - org.apache.tomcat.embed - tomcat-embed-websocket - 8.5.23 - - - - javax.websocket - javax.websocket-api - 1.1 - provided - - - io.swagger @@ -72,7 +37,7 @@ 1.6.2 - + mysql mysql-connector-java @@ -103,43 +68,20 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - com.dm DmJdbcDriver 1.8 + system + ${basedir}/lib/DmJdbcDriver18.jar com.dm.dialect hibernate5 5.4 + system + ${basedir}/lib/DmDialect-for-hibernate5.4.jar - @@ -167,7 +109,7 @@ false ${project.artifactId} - + ${project.artifactId} diff --git a/ktg-admin/src/main/resources/application-druid.yml b/ktg-admin/src/main/resources/application-druid.yml index 77a79a4..29031e6 100644 --- a/ktg-admin/src/main/resources/application-druid.yml +++ b/ktg-admin/src/main/resources/application-druid.yml @@ -7,8 +7,8 @@ spring: # 主库数据源 master: # url: jdbc:dm://30.30.2.24:5237/WMS_DJ?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 - # url: jdbc:dm://localhost:5236/WMS_DJ?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 - url: jdbc:dm://192.168.8.60:5236/WMS_DJ?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 + url: jdbc:dm://localhost:5236/WMS_DJ?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 +# url: jdbc:dm://192.168.8.60:5236/WMS_DJ?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 username: SYSDBA password: SYSDBA # 从库数据源 diff --git a/ktg-admin/src/main/resources/application.yml b/ktg-admin/src/main/resources/application.yml index 736ed7c..cc555d4 100644 --- a/ktg-admin/src/main/resources/application.yml +++ b/ktg-admin/src/main/resources/application.yml @@ -63,13 +63,15 @@ spring: # redis 配置 redis: # 地址 - host: 192.168.8.60 +# host: 192.168.8.60 + host: 127.0.0.1 # 端口,默认为6379 port: 6379 # 数据库索引 database: 4 # 密码 - password: 123456 +# password: 123456 + password: # 连接超时时间 timeout: 10s lettuce: diff --git a/ktg-admin/src/test/WmsInPlanTest.java b/ktg-admin/src/test/WmsInPlanTest.java index 30dddbf..e175b6a 100644 --- a/ktg-admin/src/test/WmsInPlanTest.java +++ b/ktg-admin/src/test/WmsInPlanTest.java @@ -42,7 +42,7 @@ public class WmsInPlanTest { public void insertWmsInPlan() { WmsInPlan wmsInPlan = new WmsInPlan(); wmsInPlan.setState("0"); - wmsInPlan.setSourceType("ZDSC"); + wmsInPlan.setSourceType("SCZB"); wmsInPlan.setWareId("10"); wmsInPlan.setCellCode("A0089"); wmsInPlan.setRelBillCode("123456"); @@ -60,7 +60,7 @@ public class WmsInPlanTest { WmsInPlan wmsInPlan = new WmsInPlan(); wmsInPlan.setPlanId("41"); wmsInPlan.setState("0"); - wmsInPlan.setSourceType("ZDSC"); + wmsInPlan.setSourceType("SCZB"); wmsInPlan.setWareId("10"); wmsInPlan.setCellCode("A0089"); wmsInPlan.setRelBillCode("123456"); diff --git a/ktg-admin/src/test/WmsOutPlanTest.java b/ktg-admin/src/test/WmsOutPlanTest.java index 53de195..3063188 100644 --- a/ktg-admin/src/test/WmsOutPlanTest.java +++ b/ktg-admin/src/test/WmsOutPlanTest.java @@ -24,7 +24,7 @@ public class WmsOutPlanTest { WmsOutPlan wmsOutPlan = new WmsOutPlan(); wmsOutPlan.setPlanCode("CKJH202411020949"); wmsOutPlan.setWmsBusinessTypeId(12L); - wmsOutPlan.setPlanType("ZDSC"); + wmsOutPlan.setPlanType("SCZB"); wmsOutPlan.setPlanState("1"); int i = wmsOutPlanService.insertWmsOutPlan(wmsOutPlan); System.out.println(i); @@ -39,7 +39,7 @@ public class WmsOutPlanTest { wmsOutPlan.setWmsOutPlanId(27L); wmsOutPlan.setPlanCode("CKJH202411020949"); wmsOutPlan.setWmsBusinessTypeId(12L); - wmsOutPlan.setPlanType("ZDSC"); + wmsOutPlan.setPlanType("SCZB"); wmsOutPlan.setPlanState("0"); int i = wmsOutPlanService.updateWmsOutPlan(wmsOutPlan); System.out.println(i); 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 cb8433b..2d9716a 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 @@ -901,7 +901,7 @@ public class BaseKnifeController extends BaseController { if (wmsInPlan == null) { WmsInPlan wmsInPlanTemp = new WmsInPlan(); wmsInPlanTemp.setState("1"); - wmsInPlanTemp.setSourceType("ZDSC"); + wmsInPlanTemp.setSourceType("SCZB"); wmsInPlanTemp.setCellCode(zdTask.getAttr3()); wmsInPlanTemp.setPlanCode(zdTask.getAttr4() == null ? zdTask.getCode() : zdTask.getAttr4()); wmsInPlanTemp.setRelBillCode("组装单据"); diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/controller/WmsOutTaskController.java b/ktg-mes/src/main/java/com/ktg/mes/md/controller/WmsOutTaskController.java index 33cee91..47f7c74 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/md/controller/WmsOutTaskController.java +++ b/ktg-mes/src/main/java/com/ktg/mes/md/controller/WmsOutTaskController.java @@ -40,6 +40,17 @@ public class WmsOutTaskController extends BaseController { return getDataTable(list); } + + /** + * 开放 查询出库任务列表 + */ + @GetMapping("/open/incomplete/{planSheet}") + public TableDataInfo openList(@PathVariable String planSheet) { + startPage(); + List list = wmsOutTaskService.selectWmsOutTaskIncompleteList(planSheet); + return getDataTable(list); + } + /** * 查询出库任务列表 */ diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/WmsOutPlanServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/WmsOutPlanServiceImpl.java index 5ace0cc..a09d50d 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/WmsOutPlanServiceImpl.java +++ b/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/WmsOutPlanServiceImpl.java @@ -293,7 +293,7 @@ public class WmsOutPlanServiceImpl implements IWmsOutPlanService { wmsOutPlan.setPlanCode(Long.toString(System.currentTimeMillis(), 32).toUpperCase(Locale.ROOT)); wmsOutPlan.setWmsBusinessTypeId(this.wmsBusinessTypeMapper.selectWmsBusinessTypeByCode("CK04").getTypeId() != null ? Long.parseLong(this.wmsBusinessTypeMapper.selectWmsBusinessTypeByCode("CK04").getTypeId()) : 14L); wmsOutPlan.setPlanState("1"); - wmsOutPlan.setPlanType("ZDSC"); + wmsOutPlan.setPlanType("SCZB"); wmsOutPlan.setRemark("一键清退无寿命物品"); wmsOutPlan.setCreateBy(username); wmsOutPlan.setCreateTime(new Date()); diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmsInTaskController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmsInTaskController.java index 9aae9a9..a32177d 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmsInTaskController.java +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmsInTaskController.java @@ -5,27 +5,25 @@ import com.ktg.common.core.controller.BaseController; import com.ktg.common.core.domain.AjaxResult; import com.ktg.common.core.page.TableDataInfo; import com.ktg.common.enums.BusinessType; +import com.ktg.common.utils.DateUtils; import com.ktg.common.utils.StringUtils; import com.ktg.common.utils.poi.ExcelUtil; -import com.ktg.mes.md.domain.BaseKnife; -import com.ktg.mes.md.domain.MdItem; +import com.ktg.mes.md.domain.*; import com.ktg.mes.md.service.IBaseKnifeService; import com.ktg.mes.md.service.IMdItemService; -import com.ktg.mes.wm.domain.WmStorageArea; -import com.ktg.mes.wm.domain.WmsInPlanDetailEntity; -import com.ktg.mes.wm.domain.WmsInTask; -import com.ktg.mes.wm.service.IWmStorageAreaService; -import com.ktg.mes.wm.service.IWmsInPlanDetailEntityService; -import com.ktg.mes.wm.service.IWmsInTaskService; +import com.ktg.mes.wm.domain.*; +import com.ktg.mes.wm.service.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.*; +import static com.ktg.generator.util.MultiModuleCodeGenerator.generateTaskCode; import javax.servlet.http.HttpServletResponse; -import java.util.List; -import java.util.Objects; -import java.util.Optional; +import java.util.*; import java.util.stream.Stream; +import com.ktg.mes.wm.mapper.*; +import com.ktg.mes.md.mapper.*; /** * 入库任务Controller @@ -39,6 +37,10 @@ public class WmsInTaskController extends BaseController { @Autowired private IWmsInTaskService wmsInTaskService; @Autowired + private IWmsInPlanService wmsInPlanService; + @Autowired + private IWmsZdTaskService wmsZdTaskService; + @Autowired private IMdItemService mdItemService; @Autowired private IBaseKnifeService baseKnifeService; @@ -47,6 +49,36 @@ public class WmsInTaskController extends BaseController { @Autowired private IWmsInPlanDetailEntityService wmsInPlanDetailEntityService; + @Autowired + private WmsOutPlanMapper wmsOutPlanMapper; + + @Autowired + private WmsOutPlanDetailEntityMapper wmsOutPlanDetailEntityMapper; + + @Autowired + private WmsOutTaskMapper wmsOutTaskMapper; + + @Autowired + private ProductionArrangementsMapper productionArrangementsMapper; + + @Autowired + private BaseKnifeMapper baseKnifeMapper; + + @Autowired + private BomRouteMapper bomRouteMapper; + + @Autowired + private MdItemMapper mdItemMapper; + + @Autowired + private BaseTechnologyBomMapper baseTechnologyBomMapper; + + @Autowired + private WmsZdTaskMapper wmsZdTaskMapper; + + @Autowired + private WmStorageAreaMapper wmStorageAreaMapper; + /** * 查询入库任务列表 */ @@ -126,6 +158,7 @@ public class WmsInTaskController extends BaseController { // @Log(title = "入库任务", businessType = BusinessType.UPDATE) @PostMapping("/open/issueBatch/{ids}") @ResponseBody + @Transactional public AjaxResult issueBatch(@PathVariable String[] ids) { for (String taskId : ids) { // 获取任务信息 @@ -142,8 +175,53 @@ public class WmsInTaskController extends BaseController { wmsInPlanDetailEntity.setPlanDetailsId(wmsInTask.getDetailInId()); List wmsInPlanDetailEntityList = wmsInPlanDetailEntityService.selectWmsInPlanDetailEntityList(wmsInPlanDetailEntity); - // 入库类型为整刀回库 - if (Objects.equals(wmsInTask.getPlanTypeId(), "9")) { + // 如果是自动生成的组刀任务入库 + WmsInPlan wmsInPlan = wmsInPlanService.selectWmsInPlanByPlanId(wmsInTask.getPlanInId()); + if (Objects.equals("SCZB", wmsInPlan.getSourceType())){ + // 查询组装任务 + WmsZdTask wmsZdTaskWrapper = new WmsZdTask(); + wmsZdTaskWrapper.setPlanSheet(wmsInPlan.getPlanCode()); + wmsZdTaskWrapper.setmProductId(Long.parseLong(wmsInTask.getMaterialId())); + List zdTaskList = wmsZdTaskService.selectWmsZdTaskList(wmsZdTaskWrapper); + if (zdTaskList.size() != 1) return AjaxResult.error("组刀任务不存在"); + + // 获取台账信息 + BaseKnife baseKnifeWrapper = new BaseKnife(); + baseKnifeWrapper.setZdTaskId(zdTaskList.get(0).getWmsZdTaskId()); + baseKnifeWrapper.setMbbBdMrlId(zdTaskList.get(0).getmProductId()); + List baseKnifeList = baseKnifeMapper.selectBaseKnifeNotValidList(baseKnifeWrapper); + + // 整 刀台账设为有效 + baseKnifeList.forEach(baseKnife -> { + baseKnife.setIsValid(0); + baseKnife.setCreateTime(DateUtils.getNowDate()); + baseKnifeService.updateBaseKnife(baseKnife); + }); + + // 检测订单是否完成,完成则出库整刀 + if (this.checkFinal(wmsInPlan.getPlanCode())) this.createOutTask(wmsInPlan.getPlanCode()); + } else if (Objects.equals("ZZRW", wmsInPlan.getSourceType())){ + // 查询组装任务 + WmsZdTask wmsZdTaskWrapper = new WmsZdTask(); + wmsZdTaskWrapper.setCode(wmsInPlan.getPlanCode()); + wmsZdTaskWrapper.setmProductId(Long.parseLong(wmsInTask.getMaterialId())); + List zdTaskList = wmsZdTaskService.selectWmsZdTaskList(wmsZdTaskWrapper); + if (zdTaskList.size() != 1) return AjaxResult.error("组刀任务不存在"); + + // 获取台账信息 + BaseKnife baseKnifeWrapper = new BaseKnife(); + baseKnifeWrapper.setZdTaskId(zdTaskList.get(0).getWmsZdTaskId()); + baseKnifeWrapper.setMbbBdMrlId(zdTaskList.get(0).getmProductId()); + List baseKnifeList = baseKnifeMapper.selectBaseKnifeNotValidList(baseKnifeWrapper); + + // 整 刀台账设为有效 + baseKnifeList.forEach(baseKnife -> { + baseKnife.setIsValid(0); + baseKnife.setCreateTime(DateUtils.getNowDate()); + baseKnifeService.updateBaseKnife(baseKnife); + }); + } else if (Objects.equals(wmsInTask.getPlanTypeId(), "9")) { + // 入库类型为整刀回库 wmsInPlanDetailEntityList.forEach(planDetailEntity -> { BaseKnife baseKnife = baseKnifeService.selectBaseKnifeByBaseKnifeId(planDetailEntity.getKnifeId()); // 计算消耗寿命 @@ -232,4 +310,144 @@ public class WmsInTaskController extends BaseController { } return toAjax(1); } + + + // 检查订单完成状态 + public Boolean checkFinal(String planSheet){ + // 获取订单记录 + ProductionArrangements productionArrangements = productionArrangementsMapper.selectProductionArrangementsByPlanSheet(planSheet); + 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; + } + + // 检查订单完成状态 + @Transactional + public void createOutTask(String planSheet){ + // 构建出库计划 + WmsOutPlan outPlan = new WmsOutPlan(); + outPlan.setPlanCode(planSheet); + outPlan.setWmsBusinessTypeId(16L); + outPlan.setPlanState("1"); + outPlan.setPlanType("ZDCK"); + outPlan.setCreateBy(getUsername()); + outPlan.setCreateTime(DateUtils.getNowDate()); + wmsOutPlanMapper.insertWmsOutPlan(outPlan); + + // 所有的物料 + List baseKnifeResultList = new ArrayList<>(); + + // 获取订单记录 + ProductionArrangements productionArrangements = productionArrangementsMapper.selectProductionArrangementsByPlanSheet(planSheet); + 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"; + // 出库任务,进行整刀的出库 + HashMap>> baseKnifeHashMapMap = new HashMap<>(); + + // 遍历构建map + baseKnifeResultList.forEach(item -> { + // 判断当前物料主键是否已经被收录 + baseKnifeHashMapMap.computeIfAbsent(item.getMbbBdMrlId(), k -> new HashMap<>()); + + // 判断当前库位编码是否已经被收录 + baseKnifeHashMapMap.get(item.getMbbBdMrlId()).computeIfAbsent(item.getAreaCode(), k -> new ArrayList<>()); + + // 对当前台账对象进行收录 + baseKnifeHashMapMap.get(item.getMbbBdMrlId()).get(item.getAreaCode()).add(item); + }); + + // 生成出库计划明细 + WmsOutPlan outPlanTemp = outPlan; + baseKnifeHashMapMap.keySet().forEach(mdItemId -> { + MdItem mdItemOutPlan = mdItemMapper.selectMdItemById(mdItemId); + // 根据库位编码遍历 + baseKnifeHashMapMap.get(mdItemId).keySet().forEach(areaCode -> { + // 获得库位对象 + WmStorageArea wmStorageAreaOutPlan = wmStorageAreaMapper.selectWmStorageAreaByAreaCode(areaCode); + + WmsOutPlanDetail outPlanDetail = new WmsOutPlanDetail(); + outPlanDetail.setWmsOutPlanId(outPlanTemp.getWmsOutPlanId()); + outPlanDetail.setMdItemId(mdItemId); + outPlanDetail.setMdItemCode(mdItemOutPlan.getItemCode()); + outPlanDetail.setMdItemName(mdItemOutPlan.getItemName()); + outPlanDetail.setMdItemUnit(mdItemOutPlan.getUnitName()); + outPlanDetail.setPlannedQuantity(baseKnifeHashMapMap.get(mdItemId).get(areaCode).size()); + outPlanDetail.setRealQuantity(baseKnifeHashMapMap.get(mdItemId).get(areaCode).size()); + outPlanDetail.setDetailBatchNum(batchNum); + outPlanDetail.setWmStorageAreaId(wmStorageAreaOutPlan.getAreaId()); + outPlanDetail.setWmStorageAreaCode(wmStorageAreaOutPlan.getAreaCode()); + outPlanDetail.setWmStorageAreaName(wmStorageAreaOutPlan.getAreaName()); + outPlanDetail.setDetailState("1"); + outPlanDetail.setCreateTime(DateUtils.getNowDate()); + wmsOutPlanMapper.insertWmsOutPlanDetail(outPlanDetail); + + // 遍历台账对象 + baseKnifeHashMapMap.get(mdItemId).get(areaCode).forEach(item -> { + // 构建出库计划明细实体 + WmsOutPlanDetailEntity wmsOutPlanDetailEntity = new WmsOutPlanDetailEntity(); + wmsOutPlanDetailEntity.setWmsOutPlanDetailId(outPlanDetail.getWmsOutPlanDetailId()); + wmsOutPlanDetailEntity.setBaseKnifeId(item.getBaseKnifeId()); + wmsOutPlanDetailEntity.setAreaCode(item.getAreaCode()); + wmsOutPlanDetailEntity.setItemOrProduct(item.getItemOrProduct()); + wmsOutPlanDetailEntity.setKnifeCode(item.getKnifeCode()); + wmsOutPlanDetailEntity.setKnifeName(item.getKnifeName()); + wmsOutPlanDetailEntity.setPlanSheet(item.getPlanSheet()); + wmsOutPlanDetailEntity.setKnifeLife(item.getKnifeLife()); + wmsOutPlanDetailEntity.setResetCount(item.getResetCount()); + wmsOutPlanDetailEntity.setKnifeUnit(item.getKnifeUnit()); + wmsOutPlanDetailEntity.setSafeStock(item.getKnifeType()); + wmsOutPlanDetailEntity.setStandardQuantity(item.getStandardQuantity()); + wmsOutPlanDetailEntity.setCreateTime(DateUtils.getNowDate()); + wmsOutPlanDetailEntityMapper.insertWmsOutPlanDetailEntity(wmsOutPlanDetailEntity); + }); + + // 生成出库任务 + WmsOutTask wmsOutTask = new WmsOutTask(); + wmsOutTask.setWmsOutPlanId(outPlanTemp.getWmsOutPlanId()); + wmsOutTask.setWmsOutPlanCode(outPlanTemp.getPlanCode()); + wmsOutTask.setWmsOutPlanDetailId(outPlanDetail.getWmsOutPlanDetailId()); + // 出库类型 12组刀出库 + wmsOutTask.setWmsBusinessTypeId(12L); + wmsOutTask.setTaskCode(generateTaskCode("CKT")); + 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("0"); + wmsOutTask.setRecipientUsername(""); + wmsOutTask.setCreateTime(DateUtils.getNowDate()); + wmsOutTaskMapper.insertWmsOutTask(wmsOutTask); + }); + }); + + productionArrangements.setStatus(1); + productionArrangementsMapper.updateProductionArrangements(productionArrangements); + } } 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 c63df8a..07f8142 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 @@ -223,12 +223,13 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService // 判断是否需要锁定整刀 if (lockedFlag) { baseKnife.setIsLocked(1); - baseKnife.setKnifeFineState(2); + baseKnife.setKnifeFineState(1); baseKnife.setLockedStartTime(technologyBom.getLockedStartTime()); baseKnife.setLockedEndTime(technologyBom.getLockedEndTime()); } else { baseKnife.setIsLocked(0); } + // attr4 计划编码, 整刀 baseKnife.setPlanSheet(zdTask.getPlanSheet()); baseKnife.setZdTaskId(zdTask.getWmsZdTaskId()); @@ -377,13 +378,13 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService // 整刀入库计划, 根据图号查询入库计划,如果不存在生成计划,存在则往计划中添加任务 WmStorageArea wmStorageArea = wmStorageAreaMapper.selectWmStorageAreaByAreaId(zdTask.getAreaId()); - WmsInPlan wmsInPlan = wmsInPlanService.selectWmsInPlanByPlanCode(zdTask.getCode()); + WmsInPlan wmsInPlan = wmsInPlanService.selectWmsInPlanByPlanCode(zdTask.getPlanSheet()); if (wmsInPlan == null) { WmsInPlan wmsInPlanTemp = new WmsInPlan(); wmsInPlanTemp.setState("1"); - wmsInPlanTemp.setSourceType("ZDSC"); + wmsInPlanTemp.setSourceType(zdTask.getPlanSheet() != null ? "SCZB" : "ZZRW"); wmsInPlanTemp.setCellCode(wmStorageArea.getAreaCode()); - wmsInPlanTemp.setPlanCode(zdTask.getCode()); + wmsInPlanTemp.setPlanCode(zdTask.getPlanSheet() != null ? zdTask.getPlanSheet() : zdTask.getCode()); wmsInPlanTemp.setRelBillCode("组装单据"); wmsInPlanTemp.setPlanTypeId("13"); wmsInPlanTemp.setCreateBy(getUsername()); @@ -440,21 +441,21 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService wmsInTask.setBatch(batchNum); wmsInTask.setMaterialId(zdTask.getmProductId().toString()); wmsInTask.setPlanTypeId("9"); - wmsInTask.setPlanInStatus("1"); + wmsInTask.setPlanInStatus("0"); wmsInTask.setDetailInId(wmsInPlan.getWmsInPlanDetailsList().get(0).getDetailsId()); wmsInTask.setCreateBy(getUsername()); wmsInTask.setCreateTime(DateUtils.getNowDate()); wmsInTaskMapper.insertWmsInTask(wmsInTask); - // 整 刀台账设为有效 - baseKnifeList.forEach(baseKnife -> { - baseKnife.setIsValid(0); - baseKnife.setCreateTime(DateUtils.getNowDate()); - baseKnifeMapper.updateBaseKnife(baseKnife); - }); - - // 检测订单是否完成,完成则出库整刀 - if (zdTask.getPlanSheet() != null && this.checkFinal(zdTask.getPlanSheet())) this.createOutTask(zdTask.getPlanSheet()); +// // 整 刀台账设为有效 +// baseKnifeList.forEach(baseKnife -> { +// baseKnife.setIsValid(0); +// baseKnife.setCreateTime(DateUtils.getNowDate()); +// baseKnifeMapper.updateBaseKnife(baseKnife); +// }); +// +// // 检测订单是否完成,完成则出库整刀 +// if (zdTask.getPlanSheet() != null && this.checkFinal(zdTask.getPlanSheet())) this.createOutTask(zdTask.getPlanSheet()); // 更新组装任务 zdTask.setStatus("2");