From de37f12a8df8f692cfb4433257a99d1ad9bcafcf Mon Sep 17 00:00:00 2001 From: Kelvin Date: Thu, 28 Nov 2024 15:49:02 +0800 Subject: [PATCH 1/9] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=20=E6=89=A7?= =?UTF-8?q?=E8=A1=8C=E5=85=A5=E5=BA=93=E8=AE=A1=E5=88=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ktg/mes/wm/service/IWmsInPlanService.java | 9 ++- .../wm/service/impl/WmsInPlanServiceImpl.java | 57 ++++++++++++++++++- 2 files changed, 63 insertions(+), 3 deletions(-) diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmsInPlanService.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmsInPlanService.java index cef7914..517db38 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmsInPlanService.java +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmsInPlanService.java @@ -17,7 +17,7 @@ public interface IWmsInPlanService * @param planId 入库计划主键 * @return 入库计划 */ - public WmsInPlan selectWmsInPlanByPlanId(String planId); + public WmsInPlan selectWmsInPlanByPlanId(Long planId); WmsInPlan selectWmsInPlanByPlanCode(String planCode); @@ -67,4 +67,11 @@ public interface IWmsInPlanService * @return 是否重复 */ public Boolean isDuplicatePlanCode(String planCode); + + /** + * 执行入库计划 + * @param planId 入库计划ID + * @return 结果 + */ + public int issueWmsInPlan(Long planId); } diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmsInPlanServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmsInPlanServiceImpl.java index 11a9180..fa86703 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmsInPlanServiceImpl.java +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmsInPlanServiceImpl.java @@ -1,14 +1,20 @@ package com.ktg.mes.wm.service.impl; +import java.util.Date; import java.util.List; import com.ktg.common.utils.DateUtils; +import com.ktg.mes.md.domain.MdItem; +import com.ktg.mes.md.service.IMdItemService; import com.ktg.mes.wm.domain.WmsInPlanDetailEntity; +import com.ktg.mes.wm.domain.WmsInTask; import com.ktg.mes.wm.mapper.WmsInPlanDetailEntityMapper; +import com.ktg.mes.wm.service.IWmsInTaskService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.ArrayList; +import java.util.concurrent.atomic.AtomicInteger; import com.ktg.common.utils.StringUtils; import org.springframework.transaction.annotation.Transactional; @@ -31,6 +37,12 @@ public class WmsInPlanServiceImpl implements IWmsInPlanService { @Autowired private WmsInPlanDetailEntityMapper wmsInPlanDetailEntityMapper; + @Autowired + private IWmsInTaskService wmsInTaskService; + + @Autowired + private IMdItemService mdItemService; + /** * 查询入库计划 * @@ -38,7 +50,7 @@ public class WmsInPlanServiceImpl implements IWmsInPlanService { * @return 入库计划 */ @Override - public WmsInPlan selectWmsInPlanByPlanId(String planId) { + public WmsInPlan selectWmsInPlanByPlanId(Long planId) { WmsInPlan wmsInPlan = wmsInPlanMapper.selectWmsInPlanByPlanId(planId); List wmsInPlanDetailsList = new ArrayList<>(); wmsInPlan.getWmsInPlanDetailsList().forEach(detail -> { @@ -140,7 +152,7 @@ public class WmsInPlanServiceImpl implements IWmsInPlanService { } if (!list.isEmpty()) { wmsInPlanMapper.batchWmsInPlanDetails(list); - WmsInPlan wmsInPlan1 = selectWmsInPlanByPlanId(planId.toString()); + WmsInPlan wmsInPlan1 = selectWmsInPlanByPlanId(planId); List wmsInPlanDetailsList1 = wmsInPlan1.getWmsInPlanDetailsList(); for (int i = 0; i < list.size(); i++) { List wmsInPlanDetailEntityList = list.get(i).getWmsInPlanDetailEntityList(); @@ -178,10 +190,51 @@ public class WmsInPlanServiceImpl implements IWmsInPlanService { /** * 入库计划ID是否重复 + * * @param planCode 入库计划ID * @return 是否重复 */ + @Override public Boolean isDuplicatePlanCode(String planCode) { return wmsInPlanMapper.isDuplicatePlanCode(planCode); } + + /** + * 执行入库计划 + * + * @param planId 入库计划ID + * @return 结果 + */ + @Override + public int issueWmsInPlan(Long planId) { + WmsInPlan wmsInPlan = selectWmsInPlanByPlanId(planId); + WmsInTask wmsInTask = new WmsInTask(); + + AtomicInteger atomicInteger = new AtomicInteger(); + wmsInPlan.getWmsInPlanDetailsList().forEach(detail -> { + int index = atomicInteger.getAndIncrement(); + + wmsInTask.setPlanInId(wmsInPlan.getPlanId()); + wmsInTask.setPlanInCode(wmsInPlan.getPlanCode()); + wmsInTask.setTaskInQuantity(Integer.parseInt(detail.getQuantity())); + wmsInTask.setActualInQuantity(Integer.parseInt(detail.getQuantityIn())); + wmsInTask.setCellTgt(detail.getCellId()); + wmsInTask.setCellOrig(new Date().toString() + index); + wmsInTask.setRemark(detail.getRemark()); + wmsInTask.setBatch(detail.getBatch()); + wmsInTask.setMaterialId(detail.getMaterialId()); + + MdItem mdItem = mdItemService.selectMdItemById(Long.parseLong(wmsInTask.getMaterialId())); + wmsInTask.setMaterialCode(mdItem.getItemCode()); + wmsInTask.setPlanTypeId(wmsInPlan.getPlanTypeId().toString()); + wmsInTask.setPlanTypeCode(wmsInPlan.getPlanTypeCode()); + wmsInTask.setPlanInStatus("0"); + wmsInTask.setDetailInId(detail.getDetailsId()); + + wmsInTaskService.insertWmsInTask(wmsInTask); + }); + + wmsInPlan.setState("1"); + return wmsInPlanMapper.updateWmsInPlan(wmsInPlan); + } } From 262ffdd50c6f75bef38fc0b0b855e25a97ff1096 Mon Sep 17 00:00:00 2001 From: Kelvin Date: Thu, 28 Nov 2024 15:49:25 +0800 Subject: [PATCH 2/9] =?UTF-8?q?refactor:=20=E5=AD=97=E6=AE=B5=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E7=B1=BB=E5=9E=8B=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmsInPlan.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmsInPlan.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmsInPlan.java index ae5253b..c25e501 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmsInPlan.java +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmsInPlan.java @@ -1,5 +1,6 @@ package com.ktg.mes.wm.domain; +import java.util.Date; import java.util.List; import org.apache.commons.lang3.builder.ToStringBuilder; @@ -55,7 +56,7 @@ public class WmsInPlan extends BaseEntity { * 计划日期 */ @Excel(name = "计划日期") - private String expectDate; + private Date expectDate; /** * 发布人 @@ -211,11 +212,11 @@ public class WmsInPlan extends BaseEntity { return workOrderCode; } - public void setExpectDate(String expectDate) { + public void setExpectDate(Date expectDate) { this.expectDate = expectDate; } - public String getExpectDate() { + public Date getExpectDate() { return expectDate; } From 78a51123b65450ac719eeb8329bd43dac171b5fb Mon Sep 17 00:00:00 2001 From: Kelvin Date: Thu, 28 Nov 2024 15:50:35 +0800 Subject: [PATCH 3/9] =?UTF-8?q?refactor:=20=E5=AD=97=E6=AE=B5=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E7=B1=BB=E5=9E=8B=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ktg/mes/md/controller/BaseKnifeController.java | 2 +- .../ktg/mes/md/service/impl/InventoryBatchServiceImpl.java | 2 +- .../java/com/ktg/mes/wm/controller/WmsInPlanController.java | 2 +- ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmsInTask.java | 6 +++--- .../main/java/com/ktg/mes/wm/mapper/WmsInPlanMapper.java | 2 +- .../wm/service/impl/WmsInPlanDetailEntityServiceImpl.java | 2 +- .../com/ktg/mes/wm/service/impl/WmsZdTaskServiceImpl.java | 2 +- 7 files changed, 9 insertions(+), 9 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 0eb8eb8..0bab2fc 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 @@ -945,7 +945,7 @@ public class BaseKnifeController extends BaseController { // 生成任务号 String taskInCode = MultiModuleCodeGenerator.generateTaskCode("RKT"); wmsInTask.setTaskInCode(taskInCode); - wmsInTask.setPlanInId(wmsInPlan.getPlanId().toString()); + wmsInTask.setPlanInId(wmsInPlan.getPlanId()); wmsInTask.setPlanInCode(wmsInPlan.getPlanCode()); wmsInTask.setMaterialCode(mdItem.getItemCode()); wmsInTask.setTaskInQuantity(zdTask.getProductIdQty()); 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 e5362ef..e49519d 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,7 +189,7 @@ public class InventoryBatchServiceImpl implements IInventoryBatchService { // 获取当期入库明细数据 List> hashMapList = new ArrayList<>(); WmsInPlanDetailEntity entityQuery = new WmsInPlanDetailEntity(); - entityQuery.setPlanId(Long.parseLong(inTask.getPlanInId())); + entityQuery.setPlanId(inTask.getPlanInId()); // entityQuery.setKnifeId(Long.parseLong(inTask.getPlanInId())); List wmsInPlanDetailEntityList = wmsInPlanDetailEntityMapper.selectWmsInPlanDetailEntityList(entityQuery); wmsInPlanDetailEntityList.forEach(inPlanDetailEntity -> { diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmsInPlanController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmsInPlanController.java index 8d4a6c9..4c5daa3 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmsInPlanController.java +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmsInPlanController.java @@ -62,7 +62,7 @@ public class WmsInPlanController extends BaseController { */ @PreAuthorize("@ss.hasPermi('wm:PLAN:query')") @GetMapping(value = "/{planId}") - public AjaxResult getInfo(@PathVariable("planId") String planId) { + public AjaxResult getInfo(@PathVariable("planId") Long planId) { return AjaxResult.success(wmsInPlanService.selectWmsInPlanByPlanId(planId)); } diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmsInTask.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmsInTask.java index 249a693..83a0ffb 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmsInTask.java +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmsInTask.java @@ -31,7 +31,7 @@ public class WmsInTask extends BaseEntity { * 入库计划id */ @Excel(name = "入库计划id") - private String planInId; + private Long planInId; /** * 任务数量 @@ -157,11 +157,11 @@ public class WmsInTask extends BaseEntity { return taskInCode; } - public void setPlanInId(String planInId) { + public void setPlanInId(Long planInId) { this.planInId = planInId; } - public String getPlanInId() { + public Long getPlanInId() { return planInId; } diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmsInPlanMapper.java b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmsInPlanMapper.java index 33b3ead..be2d8ff 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmsInPlanMapper.java +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmsInPlanMapper.java @@ -18,7 +18,7 @@ public interface WmsInPlanMapper * @param planId 入库计划主键 * @return 入库计划 */ - public WmsInPlan selectWmsInPlanByPlanId(String planId); + public WmsInPlan selectWmsInPlanByPlanId(Long planId); /** * 查询入库计划列表 diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmsInPlanDetailEntityServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmsInPlanDetailEntityServiceImpl.java index bdf379c..1374126 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmsInPlanDetailEntityServiceImpl.java +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmsInPlanDetailEntityServiceImpl.java @@ -66,7 +66,7 @@ public class WmsInPlanDetailEntityServiceImpl implements IWmsInPlanDetailEntityS List handleWmsInPlanDetailEntityList = new ArrayList<>(); wmsInPlanDetailEntityList.forEach(entity -> { // 获取入库计划信息 - WmsInPlan wmsInPlan = wmsInPlanMapper.selectWmsInPlanByPlanId(entity.getPlanId().toString()); + WmsInPlan wmsInPlan = wmsInPlanMapper.selectWmsInPlanByPlanId(entity.getPlanId()); // 获取入库计划 WmsBusinessType wmsBusinessType = wmsBusinessTypeMapper.selectWmsBusinessTypeByTypeId(wmsInPlan.getPlanTypeId().toString()); 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 4d25949..876b4af 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 @@ -434,7 +434,7 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService // 生成任务号 String taskInCode = MultiModuleCodeGenerator.generateTaskCode("RKT"); wmsInTask.setTaskInCode(taskInCode); - wmsInTask.setPlanInId(wmsInPlan.getPlanId().toString()); + wmsInTask.setPlanInId(wmsInPlan.getPlanId()); wmsInTask.setPlanInCode(wmsInPlan.getPlanCode()); wmsInTask.setMaterialCode(mdItem.getItemCode()); wmsInTask.setTaskInQuantity(zdTask.getProductIdQty()); From 42b1f93f4b5a730eb0d9eef5a4d1c8d658f07328 Mon Sep 17 00:00:00 2001 From: Kelvin Date: Fri, 29 Nov 2024 09:28:15 +0800 Subject: [PATCH 4/9] =?UTF-8?q?feat(=E5=85=A5=E5=BA=93):=20=E5=90=8C?= =?UTF-8?q?=E6=AD=A5=E5=B0=8F=E5=9E=8B=E5=88=80=E5=85=B7=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ktg/mes/md/mapper/AP0AEMapper.java | 9 ++ .../com/ktg/mes/md/service/IAP0AEService.java | 6 ++ .../mes/md/service/impl/AP0AEServiceImpl.java | 85 +++++++++++++++++++ .../main/resources/mapper/md/AP0AEMapper.xml | 18 ++++ 4 files changed, 118 insertions(+) diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/mapper/AP0AEMapper.java b/ktg-mes/src/main/java/com/ktg/mes/md/mapper/AP0AEMapper.java index c0ae759..3529b4c 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/md/mapper/AP0AEMapper.java +++ b/ktg-mes/src/main/java/com/ktg/mes/md/mapper/AP0AEMapper.java @@ -6,10 +6,19 @@ import com.ktg.mes.md.domain.AP0AE; import java.util.List; +/** + * @author Kelvin + */ public interface AP0AEMapper { @DataSource(DataSourceType.SQLSERVER) List selectOutNewData(); @DataSource(DataSourceType.SQLSERVER) int updateOutDataToOld(AP0AE ap0ae); + + @DataSource(DataSourceType.SQLSERVER) + List selectInNewData(); + + @DataSource(DataSourceType.SQLSERVER) + int updateInDataToOld(AP0AE ap0ae); } diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/service/IAP0AEService.java b/ktg-mes/src/main/java/com/ktg/mes/md/service/IAP0AEService.java index b0c1446..39b039f 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/md/service/IAP0AEService.java +++ b/ktg-mes/src/main/java/com/ktg/mes/md/service/IAP0AEService.java @@ -4,6 +4,12 @@ import com.ktg.mes.md.domain.AP0AE; import java.util.List; +/** + * @author luo26 + */ public interface IAP0AEService { public List selectOutNewData(); + + + public List selectInNewData(); } diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/AP0AEServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/AP0AEServiceImpl.java index f875b27..371709e 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/AP0AEServiceImpl.java +++ b/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/AP0AEServiceImpl.java @@ -2,21 +2,106 @@ package com.ktg.mes.md.service.impl; import com.ktg.common.annotation.DataSource; import com.ktg.common.enums.DataSourceType; +import com.ktg.generator.util.MultiModuleCodeGenerator; import com.ktg.mes.md.domain.AP0AE; +import com.ktg.mes.md.domain.MdItem; import com.ktg.mes.md.mapper.AP0AEMapper; import com.ktg.mes.md.service.IAP0AEService; +import com.ktg.mes.md.service.IMdItemService; +import com.ktg.mes.wm.domain.WmStorageArea; +import com.ktg.mes.wm.domain.WmsInPlan; +import com.ktg.mes.wm.domain.WmsInPlanDetails; +import com.ktg.mes.wm.domain.WmsInTask; +import com.ktg.mes.wm.service.IWmStorageAreaService; +import com.ktg.mes.wm.service.IWmsInPlanService; +import com.ktg.mes.wm.service.IWmsInTaskService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.lang.reflect.Array; +import java.util.ArrayList; +import java.util.Collections; import java.util.List; +/** + * 小型刀具库-借领退还表 + * + * @author Kelvin + */ @Service public class AP0AEServiceImpl implements IAP0AEService { @Autowired private AP0AEMapper aP0AEMapper; + @Autowired + private IWmsInPlanService wmsInPlanService; + + @Autowired + private IWmsInTaskService wmsInTaskService; + + @Autowired + private IWmStorageAreaService wmStorageAreaService; + + @Autowired + private IMdItemService mdItemService; + @Override public List selectOutNewData() { return this.aP0AEMapper.selectOutNewData(); } + + @Override + public List selectInNewData() { + List ap0aeList = aP0AEMapper.selectInNewData(); + ap0aeList.stream().filter(ap0ae -> ap0ae.getAE003() != null).forEach(ap0ae -> { + WmsInPlan wmsInPlan = new WmsInPlan(); + wmsInPlan.setPlanCode(MultiModuleCodeGenerator.generateTaskCode("RKP")); + // 发布人 + wmsInPlan.setPublishName(ap0ae.getAE004()); + // 计划日期 + wmsInPlan.setExpectDate(ap0ae.getAE003()); + // 入库类型编码 刀片入库 + wmsInPlan.setPlanTypeCode("DPRK"); + // 库位编码 + wmsInPlan.setCellCode(ap0ae.getAE020()); + // 业务类型 自动生成 + wmsInPlan.setSourceType("XTTB"); + // 已执行 + wmsInPlan.setState("1"); + + // 查询库位信息 + WmStorageArea wmStorageArea = wmStorageAreaService.selectWmStorageAreaByAreaCode(ap0ae.getAE020()); + MdItem mdItem = mdItemService.selectMdItemByCode(ap0ae.getAE014()); + + //-- 入库计划详情 + WmsInPlanDetails wmsInPlanDetails = new WmsInPlanDetails(); + // 状态-待执行 + wmsInPlanDetails.setPlanInStatus("0"); + // 库位ID + wmsInPlanDetails.setCellId(wmStorageArea.getAreaId()); + wmsInPlanDetails.setQuantity(ap0ae.getAE022().toString()); + wmsInPlanDetails.setQuantityIn(ap0ae.getAE022().toString()); + wmsInPlanDetails.setMaterialId(mdItem.getItemId().toString()); + + wmsInPlan.setWmsInPlanDetailsList(Collections.singletonList(wmsInPlanDetails)); + wmsInPlanService.insertWmsInPlan(wmsInPlan); + + // 执行入库计划 + wmsInPlanService.issueWmsInPlan(wmsInPlan.getPlanId()); + + WmsInTask wmsInTask = new WmsInTask(); + wmsInTask.setPlanInId(wmsInPlan.getPlanId()); + wmsInTask.setPlanInStatus("0"); + List wmsInTaskList = wmsInTaskService.selectWmsInTaskList(wmsInTask); + List taskId = new ArrayList<>(); + wmsInTaskList.forEach(wmsInTask1 -> { + taskId.add(wmsInTask1.getId().toString()); + }); + wmsInTaskService.issueBatch(taskId.toArray(new String[0])); + ap0ae.setUDF06("ED"); + int i = aP0AEMapper.updateInDataToOld(ap0ae); + System.out.println("小型刀具库----" + i); + }); + return Collections.emptyList(); + } } diff --git a/ktg-mes/src/main/resources/mapper/md/AP0AEMapper.xml b/ktg-mes/src/main/resources/mapper/md/AP0AEMapper.xml index 9e77fd9..f2af232 100644 --- a/ktg-mes/src/main/resources/mapper/md/AP0AEMapper.xml +++ b/ktg-mes/src/main/resources/mapper/md/AP0AEMapper.xml @@ -113,6 +113,15 @@ AND AE020 IS NOT NULL + + update AP0AE set UDF07 = 'ED' @@ -121,4 +130,13 @@ AND AE003 = #{AE003} AND AE012 = #{AE012} + + + update AP0AE + set UDF06 = 'ED' + where AE001 = #{AE001} + AND AE002 = #{AE002} + AND AE003 = #{AE003} + AND AE012 = #{AE012} + \ No newline at end of file From 0de94143cd42c13909060a25fabe9540fecbe23b Mon Sep 17 00:00:00 2001 From: Kelvin Date: Fri, 29 Nov 2024 09:30:39 +0800 Subject: [PATCH 5/9] =?UTF-8?q?feat(=E5=85=A5=E5=BA=93=E8=AE=A1=E5=88=92):?= =?UTF-8?q?=20=E6=89=A7=E8=A1=8C=E4=BB=BB=E5=8A=A1=E6=96=B9=E6=B3=95?= =?UTF-8?q?=EF=BC=8C=E4=B8=B4=E6=97=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ktg/mes/wm/service/IWmsInTaskService.java | 2 + .../wm/service/impl/WmsInTaskServiceImpl.java | 58 +++++++++++++++---- 2 files changed, 49 insertions(+), 11 deletions(-) diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmsInTaskService.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmsInTaskService.java index 990a27c..d7a4fe3 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmsInTaskService.java +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmsInTaskService.java @@ -58,4 +58,6 @@ public interface IWmsInTaskService * @return 结果 */ public int deleteWmsInTaskById(String id); + + public int issueBatch(String[] ids); } diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmsInTaskServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmsInTaskServiceImpl.java index 183de07..8a3fd33 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmsInTaskServiceImpl.java +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmsInTaskServiceImpl.java @@ -1,23 +1,22 @@ package com.ktg.mes.wm.service.impl; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; +import java.util.*; +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.BaseKnife; import com.ktg.mes.md.domain.MdItem; -import com.ktg.mes.md.mapper.MdItemMapper; +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.*; import com.ktg.mes.wm.mapper.WmStorageAreaMapper; -import com.ktg.mes.wm.service.IWmsInPlanDetailEntityService; +import com.ktg.mes.wm.service.*; +import org.checkerframework.checker.units.qual.A; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ktg.mes.wm.mapper.WmsInTaskMapper; -import com.ktg.mes.wm.domain.WmsInTask; -import com.ktg.mes.wm.service.IWmsInTaskService; /** * 入库任务Service业务层处理 @@ -30,11 +29,19 @@ public class WmsInTaskServiceImpl implements IWmsInTaskService { @Autowired private WmsInTaskMapper wmsInTaskMapper; @Autowired - private MdItemMapper mdItemMapper; + private IMdItemService mdItemService; @Autowired private IWmsInPlanDetailEntityService wmsInPlanDetailEntityService; @Autowired private WmStorageAreaMapper wmStorageAreaMapper; + @Autowired + private IWmsInPlanService wmsInPlanService; + @Autowired + private IWmStorageAreaService wmStorageAreaService; + @Autowired + private IWmsZdTaskService wmsZdTaskService; + @Autowired + private IBaseKnifeService baseKnifeService; /** * 查询入库任务 @@ -57,7 +64,7 @@ public class WmsInTaskServiceImpl implements IWmsInTaskService { public List selectWmsInTaskList(WmsInTask wmsInTask) { List wmsInTaskList = new ArrayList<>(); wmsInTaskMapper.selectWmsInTaskList(wmsInTask).forEach(task -> { - MdItem mdItem = mdItemMapper.selectMdItemByCode(task.getMaterialCode()); + MdItem mdItem = mdItemService.selectMdItemByCode(task.getMaterialCode()); task.setMaterialName(mdItem.getItemName()); WmsInPlanDetailEntity wmsInPlanDetailEntityQuery = new WmsInPlanDetailEntity(); @@ -123,4 +130,33 @@ public class WmsInTaskServiceImpl implements IWmsInTaskService { public int deleteWmsInTaskById(String id) { return wmsInTaskMapper.deleteWmsInTaskById(id); } + + @Override + public int issueBatch(String[] ids) { + for (String taskId : ids) { + // 获取任务信息 + WmsInTask wmsInTask = selectWmsInTaskById(taskId); + // 更新任务状态 + wmsInTask.setPlanInStatus("1"); + updateWmsInTask(wmsInTask); + + MdItem mbbBdMrlMitm = mdItemService.selectMdItemByCode(wmsInTask.getMaterialCode()); + BaseKnife baseKnifeQuery = new BaseKnife(); + baseKnifeQuery.setKnifeCode(mbbBdMrlMitm.getItemCode()); + baseKnifeQuery.setKnifeFineState(2); + List baseKnifeList = baseKnifeService.selectBaseKnifeList(baseKnifeQuery); + + + for (int i = 0; i < wmsInTask.getActualInQuantity(); i++) { + BaseKnife baseKnife = baseKnifeList.get(i); + // 设置状态为 解锁 + baseKnife.setIsLocked(0); + // 设置工具状态 已入库 + baseKnife.setKnifeFineState(1); + // 更新台账状态 + baseKnifeService.updateBaseKnife(baseKnife); + } + } + return 0; + } } From 50f434954fdba3b5f8bd33847a8567be26adceeb Mon Sep 17 00:00:00 2001 From: Kelvin Date: Fri, 29 Nov 2024 11:29:59 +0800 Subject: [PATCH 6/9] =?UTF-8?q?fix(=E5=85=A5=E5=BA=93=E8=AE=A1=E5=88=92):?= =?UTF-8?q?=20=E8=AF=AD=E6=B3=95=E9=94=99=E8=AF=AF=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ktg-mes/src/main/resources/mapper/wm/WmsInPlanMapper.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ktg-mes/src/main/resources/mapper/wm/WmsInPlanMapper.xml b/ktg-mes/src/main/resources/mapper/wm/WmsInPlanMapper.xml index 70789ed..72d2672 100644 --- a/ktg-mes/src/main/resources/mapper/wm/WmsInPlanMapper.xml +++ b/ktg-mes/src/main/resources/mapper/wm/WmsInPlanMapper.xml @@ -55,7 +55,7 @@ - + @@ -73,7 +73,7 @@ - + @@ -105,7 +105,7 @@ IS_ACTIVE, IS_DELETE, PLAN_CODE, - PLAN_TYPE_ID + PLAN_TYPE_ID, PLAN_TYPE_CODE from WMS_IN_PLAN @@ -147,7 +147,7 @@ order by CREATE_TIME desc - select a.PLAN_ID, a.STATE, a.SOURCE_TYPE, From a7021a27f4992d86e47b8627653fb4102e0176cd Mon Sep 17 00:00:00 2001 From: Kelvin Date: Fri, 29 Nov 2024 11:41:12 +0800 Subject: [PATCH 7/9] =?UTF-8?q?feat(=E5=85=A5=E5=BA=93=E8=AE=A1=E5=88=92):?= =?UTF-8?q?=20=E5=AF=B9=E6=8E=A5=E5=B0=8F=E5=9E=8B=E5=88=80=E5=85=B7?= =?UTF-8?q?=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ktg/mes/wm/controller/WmsInPlanController.java | 5 +++++ .../com/ktg/mes/wm/service/impl/WmsInPlanServiceImpl.java | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmsInPlanController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmsInPlanController.java index 4c5daa3..46f8161 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmsInPlanController.java +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmsInPlanController.java @@ -3,6 +3,7 @@ package com.ktg.mes.wm.controller; import java.util.List; import javax.servlet.http.HttpServletResponse; +import com.ktg.mes.md.service.IAP0AEService; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; @@ -34,6 +35,9 @@ public class WmsInPlanController extends BaseController { @Autowired private IWmsInPlanService wmsInPlanService; + @Autowired + private IAP0AEService iAP0AEService; + /** * 查询入库计划列表 */ @@ -42,6 +46,7 @@ public class WmsInPlanController extends BaseController { public TableDataInfo list(WmsInPlan wmsInPlan) { startPage(); List list = wmsInPlanService.selectWmsInPlanList(wmsInPlan); + iAP0AEService.selectInNewData(); return getDataTable(list); } diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmsInPlanServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmsInPlanServiceImpl.java index fa86703..4a3c1a9 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmsInPlanServiceImpl.java +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmsInPlanServiceImpl.java @@ -226,7 +226,6 @@ public class WmsInPlanServiceImpl implements IWmsInPlanService { MdItem mdItem = mdItemService.selectMdItemById(Long.parseLong(wmsInTask.getMaterialId())); wmsInTask.setMaterialCode(mdItem.getItemCode()); - wmsInTask.setPlanTypeId(wmsInPlan.getPlanTypeId().toString()); wmsInTask.setPlanTypeCode(wmsInPlan.getPlanTypeCode()); wmsInTask.setPlanInStatus("0"); wmsInTask.setDetailInId(detail.getDetailsId()); From a80458d48896ce5d9a20c2041578e800cfcb50d9 Mon Sep 17 00:00:00 2001 From: Kelvin Date: Fri, 29 Nov 2024 14:31:30 +0800 Subject: [PATCH 8/9] =?UTF-8?q?refactor(=E5=85=A5=E5=BA=93=E8=AE=A1?= =?UTF-8?q?=E5=88=92):=20=E8=87=AA=E5=8A=A8=E7=94=9F=E6=88=90=E8=AE=A1?= =?UTF-8?q?=E5=88=92=E7=BC=96=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ktg/mes/wm/service/impl/WmsInPlanServiceImpl.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmsInPlanServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmsInPlanServiceImpl.java index 4a3c1a9..0dd010d 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmsInPlanServiceImpl.java +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmsInPlanServiceImpl.java @@ -4,6 +4,7 @@ import java.util.Date; import java.util.List; import com.ktg.common.utils.DateUtils; +import com.ktg.generator.util.MultiModuleCodeGenerator; import com.ktg.mes.md.domain.MdItem; import com.ktg.mes.md.service.IMdItemService; import com.ktg.mes.wm.domain.WmsInPlanDetailEntity; @@ -90,6 +91,8 @@ public class WmsInPlanServiceImpl implements IWmsInPlanService { @Override public int insertWmsInPlan(WmsInPlan wmsInPlan) { wmsInPlan.setCreateTime(DateUtils.getNowDate()); + // 设置计划编码 + wmsInPlan.setPlanCode(MultiModuleCodeGenerator.generateTaskCode("RKP")); int rows = wmsInPlanMapper.insertWmsInPlan(wmsInPlan); insertWmsInPlanDetails(wmsInPlan); return rows; From d5bf5f29996e17d367cb9c798ac7242334955809 Mon Sep 17 00:00:00 2001 From: Kelvin Date: Mon, 2 Dec 2024 17:01:54 +0800 Subject: [PATCH 9/9] =?UTF-8?q?feat(=E5=85=A5=E5=BA=93=E4=BB=BB=E5=8A=A1):?= =?UTF-8?q?=20=E6=A0=B9=E6=8D=AErfid=E6=9F=A5=E8=AF=A2=E5=85=A5=E5=BA=93?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wm/controller/WmsInTaskController.java | 25 +++++++++++++------ .../ktg/mes/wm/service/IWmsInTaskService.java | 8 ++++++ .../wm/service/impl/WmsInTaskServiceImpl.java | 19 ++++++++++++++ 3 files changed, 45 insertions(+), 7 deletions(-) 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 ce3fa03..2377ebc 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 @@ -17,11 +17,13 @@ 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.*; import java.util.stream.Stream; + import com.ktg.mes.wm.mapper.*; import com.ktg.mes.md.mapper.*; @@ -90,6 +92,14 @@ public class WmsInTaskController extends BaseController { return getDataTable(list); } + /** + * 查询入库任务 + */ + @GetMapping("/open/rfid/{rfid}") + public AjaxResult byRfid(@PathVariable String rfid) { + return AjaxResult.success(wmsInTaskService.selectWmsInTaskByRfid(rfid)); + } + /** * 查询入库任务列表 */ @@ -177,7 +187,7 @@ public class WmsInTaskController extends BaseController { // 如果是自动生成的组刀任务入库 WmsInPlan wmsInPlan = wmsInPlanService.selectWmsInPlanByPlanId(wmsInTask.getPlanInId()); - if (Objects.equals("SCZB", wmsInPlan.getSourceType())){ + if (Objects.equals("SCZB", wmsInPlan.getSourceType())) { // 查询组装任务 WmsZdTask wmsZdTaskWrapper = new WmsZdTask(); wmsZdTaskWrapper.setPlanSheet(wmsInPlan.getPlanCode()); @@ -200,8 +210,8 @@ public class WmsInTaskController extends BaseController { // 检测订单是否完成,完成则出库整刀 if (this.checkFinal(wmsInPlan.getPlanCode())) this.createOutTask(wmsInPlan.getPlanCode()); - } else if (Objects.equals("ZZRW", wmsInPlan.getSourceType())){ - // 查询组装任务 + } else if (Objects.equals("ZZRW", wmsInPlan.getSourceType())) { + // 查询组装任务 WmsZdTask wmsZdTaskWrapper = new WmsZdTask(); wmsZdTaskWrapper.setCode(wmsInPlan.getPlanCode()); wmsZdTaskWrapper.setmProductId(Long.parseLong(wmsInTask.getMaterialId())); @@ -312,8 +322,8 @@ public class WmsInTaskController extends BaseController { } - // 检查订单完成状态 - public Boolean checkFinal(String planSheet){ + // 检查订单完成状态 + public Boolean checkFinal(String planSheet) { // 获取订单记录 ProductionArrangements productionArrangements = productionArrangementsMapper.selectProductionArrangementsByPlanSheet(planSheet); BaseTechnologyBom baseTechnologyBomWrapper = new BaseTechnologyBom(); @@ -334,7 +344,7 @@ public class WmsInTaskController extends BaseController { // 检查订单完成状态 @Transactional - public void createOutTask(String planSheet){ + public void createOutTask(String planSheet) { // 构建出库计划 WmsOutPlan outPlan = new WmsOutPlan(); outPlan.setPlanCode(planSheet); @@ -360,7 +370,8 @@ public class WmsInTaskController extends BaseController { baseKnifeWrapper.setPlanSheet(planSheet); baseKnifeWrapper.setKnifeCode(technologyBom.getKnifeCode()); List baseKnifeLockedList = baseKnifeMapper.selectBaseKnifeList(baseKnifeWrapper); - if (baseKnifeLockedList.size() == technologyBom.getKnifeCount()) baseKnifeResultList.addAll(baseKnifeLockedList); + if (baseKnifeLockedList.size() == technologyBom.getKnifeCount()) + baseKnifeResultList.addAll(baseKnifeLockedList); } String batchNum = "SCZBPC01"; diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmsInTaskService.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmsInTaskService.java index d7a4fe3..069c22e 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmsInTaskService.java +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmsInTaskService.java @@ -19,6 +19,14 @@ public interface IWmsInTaskService */ public WmsInTask selectWmsInTaskById(String id); + /** + * 查询入库任务 + * + * @param rfid rfid + * @return 入库任务 + */ + public WmsInTask selectWmsInTaskByRfid(String rfid); + /** * 查询入库任务列表 * diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmsInTaskServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmsInTaskServiceImpl.java index 8a3fd33..93c3177 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmsInTaskServiceImpl.java +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmsInTaskServiceImpl.java @@ -54,6 +54,25 @@ public class WmsInTaskServiceImpl implements IWmsInTaskService { return wmsInTaskMapper.selectWmsInTaskById(id); } + @Override + public WmsInTask selectWmsInTaskByRfid(String rfid) { + WmsInPlanDetailEntity wmsInPlanDetailEntity = new WmsInPlanDetailEntity(); + WmsInTask wmsInTask = null; + List wmsInPlanDetailEntityList = wmsInPlanDetailEntityService.selectWmsInPlanDetailEntityList(wmsInPlanDetailEntity); + for (WmsInPlanDetailEntity entity : wmsInPlanDetailEntityList) { + WmsInTask wmsInTaskQuery = new WmsInTask(); + wmsInTaskQuery.setDetailInId(entity.getPlanDetailsId()); + wmsInTaskQuery.setPlanInStatus("0"); + List wmsInTaskList = selectWmsInTaskList(wmsInTaskQuery); + if (!wmsInTaskList.isEmpty()) { + wmsInTask = wmsInTaskList.get(0); + break; + } + } + return wmsInTask; + } + + /** * 查询入库任务列表 *