From 6553439b4b6013f23b7fe60549837b2fd03719b9 Mon Sep 17 00:00:00 2001 From: LJW Date: Fri, 15 Nov 2024 17:05:12 +0800 Subject: [PATCH 1/2] =?UTF-8?q?refactor(=E7=BC=96=E7=A0=81=E7=94=9F?= =?UTF-8?q?=E6=88=90):=20=E8=A7=84=E5=88=99=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../util/MultiModuleCodeGenerator.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/ktg-generator/src/main/java/com/ktg/generator/util/MultiModuleCodeGenerator.java b/ktg-generator/src/main/java/com/ktg/generator/util/MultiModuleCodeGenerator.java index 45ca70e..f73c164 100644 --- a/ktg-generator/src/main/java/com/ktg/generator/util/MultiModuleCodeGenerator.java +++ b/ktg-generator/src/main/java/com/ktg/generator/util/MultiModuleCodeGenerator.java @@ -3,6 +3,7 @@ package com.ktg.generator.util; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Map; +import java.util.Random; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicInteger; @@ -35,17 +36,23 @@ public class MultiModuleCodeGenerator { int currentSequence = moduleSequence.getSequence().incrementAndGet(); // 格式化序列号,确保是四位,不足的地方用 0 填充 - String sequenceStr = String.format("%04d", currentSequence); +// String sequenceStr = String.format("%04d", currentSequence); + + int random = new Random().nextInt(9999); + String sequenceStr = String.format("%04d", random); // 拼接前缀、日期和序列号 return modulePrefix + currentDate + sequenceStr; } public static void main(String[] args) { - for (int i = 0; i < 10; i++) { - System.out.println(generateTaskCode("RKT")); - System.out.println(generateTaskCode("MOD")); - } + int random = new Random().nextInt(9999); + String sequenceStr = String.format("%04d", random); + System.out.println(sequenceStr); +// for (int i = 0; i < 10; i++) { +// System.out.println(generateTaskCode("RKT")); +// System.out.println(generateTaskCode("MOD")); +// } } } From 21ea93c5d9bae5996519d3d8d3fe739c8367848e Mon Sep 17 00:00:00 2001 From: LJW Date: Fri, 15 Nov 2024 17:15:48 +0800 Subject: [PATCH 2/2] =?UTF-8?q?refactor(=E5=85=A5=E5=BA=93=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1):=20=E8=81=94=E6=9F=A5=20=E7=89=A9=E6=96=99=E5=90=8D?= =?UTF-8?q?=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ktg/mes/wm/domain/WmsInTask.java | 14 +++++ .../wm/service/impl/WmsInTaskServiceImpl.java | 51 +++++++++++-------- 2 files changed, 43 insertions(+), 22 deletions(-) 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 26eebb4..00a9ea6 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 @@ -113,6 +113,11 @@ public class WmsInTask extends BaseEntity { @Excel(name = "物料编码") private String materialCode; + /** + * 物料名称 + */ + private String materialName; + /** * 入库明细ID */ @@ -263,6 +268,14 @@ public class WmsInTask extends BaseEntity { this.detailInId = detailInId; } + public String getMaterialName() { + return materialName; + } + + public void setMaterialName(String materialName) { + this.materialName = materialName; + } + @Override public String toString() { return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) @@ -288,6 +301,7 @@ public class WmsInTask extends BaseEntity { .append("planInStatus", getPlanInStatus()) .append("planInCode", getPlanInCode()) .append("materialCode", getMaterialCode()) + .append("materialName", getMaterialName()) .append("detailInId", getDetailInId()) .toString(); } 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 cdb91af..e2c2005 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,8 +1,13 @@ package com.ktg.mes.wm.service.impl; +import java.util.ArrayList; 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.mapper.MdItemMapper; +import com.ktg.mes.md.service.IMdItemService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ktg.mes.wm.mapper.WmsInTaskMapper; @@ -11,49 +16,54 @@ import com.ktg.mes.wm.service.IWmsInTaskService; /** * 入库任务Service业务层处理 - * + * * @author yinjinlu * @date 2024-11-01 */ @Service -public class WmsInTaskServiceImpl implements IWmsInTaskService -{ +public class WmsInTaskServiceImpl implements IWmsInTaskService { @Autowired private WmsInTaskMapper wmsInTaskMapper; + @Autowired + private MdItemMapper mdItemMapper; + /** * 查询入库任务 - * + * * @param id 入库任务主键 * @return 入库任务 */ @Override - public WmsInTask selectWmsInTaskById(String id) - { + public WmsInTask selectWmsInTaskById(String id) { return wmsInTaskMapper.selectWmsInTaskById(id); } /** * 查询入库任务列表 - * + * * @param wmsInTask 入库任务 * @return 入库任务 */ @Override - public List selectWmsInTaskList(WmsInTask wmsInTask) - { - return wmsInTaskMapper.selectWmsInTaskList(wmsInTask); + public List selectWmsInTaskList(WmsInTask wmsInTask) { + List wmsInTaskList = new ArrayList<>(); + wmsInTaskMapper.selectWmsInTaskList(wmsInTask).forEach(task -> { + MdItem mdItem = mdItemMapper.selectMdItemByCode(task.getMaterialCode()); + task.setMaterialName(mdItem.getItemName()); + wmsInTaskList.add(task); + }); + return wmsInTaskList; } /** * 新增入库任务 - * + * * @param wmsInTask 入库任务 * @return 结果 */ @Override - public int insertWmsInTask(WmsInTask wmsInTask) - { + public int insertWmsInTask(WmsInTask wmsInTask) { wmsInTask.setCreateTime(DateUtils.getNowDate()); // 生成任务号 String taskInCode = MultiModuleCodeGenerator.generateTaskCode("RKT"); @@ -63,38 +73,35 @@ public class WmsInTaskServiceImpl implements IWmsInTaskService /** * 修改入库任务 - * + * * @param wmsInTask 入库任务 * @return 结果 */ @Override - public int updateWmsInTask(WmsInTask wmsInTask) - { + public int updateWmsInTask(WmsInTask wmsInTask) { wmsInTask.setUpdateTime(DateUtils.getNowDate()); return wmsInTaskMapper.updateWmsInTask(wmsInTask); } /** * 批量删除入库任务 - * + * * @param ids 需要删除的入库任务主键 * @return 结果 */ @Override - public int deleteWmsInTaskByIds(String[] ids) - { + public int deleteWmsInTaskByIds(String[] ids) { return wmsInTaskMapper.deleteWmsInTaskByIds(ids); } /** * 删除入库任务信息 - * + * * @param id 入库任务主键 * @return 结果 */ @Override - public int deleteWmsInTaskById(String id) - { + public int deleteWmsInTaskById(String id) { return wmsInTaskMapper.deleteWmsInTaskById(id); } }