From 8f2a9efad19927c0d016ecda2227f5e096abf487 Mon Sep 17 00:00:00 2001 From: liyongde <1419499670@qq.com> Date: Mon, 6 Nov 2023 13:15:34 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=94=9B=E5=A4=B4=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nl/config/lucene/LogMessageConstant.java | 2 +- .../acs/service/impl/AcsToWmsServiceImpl.java | 16 ++++++++++++---- .../ext/mes/autotask/AutoSynMaterialInfo.java | 18 +++++++++++++++++- .../wms/ext/mes/service/WmsToMesService.java | 4 +++- .../service/dao/mapper/MesRequestMapper.java | 4 +++- .../service/dao/mapper/MesRequestMapper.xml | 12 ++++++++++-- .../nl/wms/ext/mes/service/dto/CusterDo.java | 14 ++++++++++++++ .../mes/service/impl/WmsToMesServiceImpl.java | 7 ++++++- .../src/main/resources/config/application.yml | 2 +- .../src/test/java/org/nl/ext/TestDemo.java | 6 ++++++ .../src/views/wms/pdm/workerorder/index.vue | 2 +- 11 files changed, 74 insertions(+), 13 deletions(-) create mode 100644 lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/dto/CusterDo.java diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/LogMessageConstant.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/LogMessageConstant.java index 14ddcca..c2fc8e5 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/LogMessageConstant.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/LogMessageConstant.java @@ -41,6 +41,6 @@ public class LogMessageConstant { /** 背景颜色:黄色 */ public final static String BACKGROUND_YELLOW = "\u001B[43m"; /** 索引路径 */ - public final static String INDEX_DIR = "E:\\lucene\\index"; + public final static String INDEX_DIR = "D:\\lucene\\index"; } diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java index 46156c9..610dff8 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java @@ -23,6 +23,7 @@ import org.nl.wms.ext.acs.service.dto.to.acs.ApplyTaskResponse; import org.nl.wms.ext.acs.service.dto.to.acs.GetPalletizeResponse; import org.nl.wms.ext.acs.service.dto.to.wms.*; import org.nl.wms.ext.mes.service.WmsToMesService; +import org.nl.wms.ext.mes.service.dto.CusterDo; import org.nl.wms.ext.mes.service.dto.CusterVo; import org.nl.wms.ext.mes.service.dto.MesMudConsumptionDto; import org.nl.wms.ext.mms.service.WmsToMmsService; @@ -468,7 +469,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { */ @Override public ApplyTaskResponse applyLabelling(JSONObject param) { - // 木托盘号(4)##物料编码(12)##数量(2-3)##吨量(单重X数量)##生产日期(11)##客户名称##订单号(12)##产品名称##型号 + // 木托盘号(4)##物料编码(12)##数量(2-3)##吨量(单重X数量)##生产日期(2023/11/04)##客户编码##订单号(12)#型号##产品名称##客户名称** String requestNo = param.getString("requestNo"); ApplyTaskRequest baseRequest = param.toJavaObject(ApplyTaskRequest.class); if (baseRequest.getVehicle_code() == null) { @@ -491,16 +492,23 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { log.info("包装数据:{}", object); String custerNo = object.getString("custer_no"); String orderNo = object.getString("order_no"); + CusterDo custer; + if (custerNo.matches("\\d+")) { + custer = wmsToMesService.getCusterByNo(custerNo); + } else { + custer = wmsToMesService.getCusterByName(custerNo); + } // 组合 sb.append(baseRequest.getVehicle_code()).append("##") .append(baseMaterial.getMaterial_code()).append("##") .append(groupInfo.getMaterial_qty()).append("##") .append(multiply).append("##") - .append(DateUtil.format(DateUtil.parse(DateUtil.today()), "yyyy年MM月dd日")).append("##") - .append(custerNo).append("##") + .append(DateUtil.format(DateUtil.parse(DateUtil.today()), "yyyy/MM/dd")).append("##") + .append(custer.getCuster_no()).append("##") .append(orderNo).append("##") + .append(baseMaterial.getMaterial_spec() + "~" + baseMaterial.getMaterial_model()).append("##") .append(baseMaterial.getMaterial_name()).append("##") - .append(baseMaterial.getMaterial_model()).append("**"); + .append(custer.getCuster_name()).append("**"); return ApplyTaskResponse.responseOk(requestNo, sb.toString()); } diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/autotask/AutoSynMaterialInfo.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/autotask/AutoSynMaterialInfo.java index c39b48b..23db376 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/autotask/AutoSynMaterialInfo.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/autotask/AutoSynMaterialInfo.java @@ -3,10 +3,14 @@ package org.nl.wms.ext.mes.autotask; import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; import org.nl.wms.ext.mes.service.WmsToMesService; +import org.redisson.api.RLock; +import org.redisson.api.RedissonClient; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.annotation.Order; import org.springframework.stereotype.Component; +import java.util.concurrent.TimeUnit; + /** * @Author: lyd * @Description: 自动同步物料 @@ -18,8 +22,20 @@ import org.springframework.stereotype.Component; public class AutoSynMaterialInfo { @Autowired private WmsToMesService wmsToMesService; + @Autowired + private RedissonClient redissonClient; @SneakyThrows public void run() { - wmsToMesService.synchronizeMaterialInfo(); + RLock lock = redissonClient.getLock(this.getClass().getName()); + boolean tryLock = lock.tryLock(0, TimeUnit.SECONDS); + try { + if (tryLock) { + wmsToMesService.synchronizeMaterialInfo(); + } + } finally { + if (tryLock) { + lock.unlock(); + } + } } } diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/WmsToMesService.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/WmsToMesService.java index 18b5b88..35aabbe 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/WmsToMesService.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/WmsToMesService.java @@ -116,7 +116,7 @@ public interface WmsToMesService { * @param custerNo * @return */ - CusterVo getCusterByNo(String custerNo); + CusterDo getCusterByNo(String custerNo); /** * 分页获取数据 @@ -132,4 +132,6 @@ public interface WmsToMesService { * @return */ int getTotal(String materialId); + + CusterDo getCusterByName(String custerName); } diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/dao/mapper/MesRequestMapper.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/dao/mapper/MesRequestMapper.java index 6bdcfad..b1b1de3 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/dao/mapper/MesRequestMapper.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/dao/mapper/MesRequestMapper.java @@ -63,7 +63,7 @@ public interface MesRequestMapper { @DS("oracle") List getCusterInfo(); @DS("oracle") - CusterVo getCusterByNo(String custerNo); + CusterDo getCusterByNo(String custerNo); @DS("oracle") List selectPageMesOrder(String materialId, int currentPage, int currentSize); @@ -74,4 +74,6 @@ public interface MesRequestMapper { */ @DS("oracle") int getOrderTotalByMaterial(String materialId); + @DS("oracle") + CusterDo getCusterByName(String custerName); } diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/dao/mapper/MesRequestMapper.xml b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/dao/mapper/MesRequestMapper.xml index c2a5872..9c8a58d 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/dao/mapper/MesRequestMapper.xml +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/dao/mapper/MesRequestMapper.xml @@ -284,8 +284,10 @@ - + SELECT CUSTER_NO AS custer_no, + CUSTER_NAME AS custer_name + FROM "RTMG"."VIEW_CUSTER_LMS" WHERE CUSTER_NO = #{custerNo} + diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/dto/CusterDo.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/dto/CusterDo.java new file mode 100644 index 0000000..fce5159 --- /dev/null +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/dto/CusterDo.java @@ -0,0 +1,14 @@ +package org.nl.wms.ext.mes.service.dto; + +import lombok.Data; + +/** + * @Author: lyd + * @Description: + * @Date: 2023/11/6 + */ +@Data +public class CusterDo { + private String custer_no; + private String custer_name; +} diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/impl/WmsToMesServiceImpl.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/impl/WmsToMesServiceImpl.java index 1d28e66..b093b27 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/impl/WmsToMesServiceImpl.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/impl/WmsToMesServiceImpl.java @@ -416,7 +416,7 @@ public class WmsToMesServiceImpl implements WmsToMesService { } @Override - public CusterVo getCusterByNo(String custerNo) { + public CusterDo getCusterByNo(String custerNo) { return mesRequestMapper.getCusterByNo(custerNo); } @@ -430,6 +430,11 @@ public class WmsToMesServiceImpl implements WmsToMesService { return mesRequestMapper.getOrderTotalByMaterial(materialId); } + @Override + public CusterDo getCusterByName(String custerName) { + return mesRequestMapper.getCusterByName(custerName); + } + /** * 转换 * diff --git a/lms/nladmin-system/nlsso-server/src/main/resources/config/application.yml b/lms/nladmin-system/nlsso-server/src/main/resources/config/application.yml index b559a01..3ca8677 100644 --- a/lms/nladmin-system/nlsso-server/src/main/resources/config/application.yml +++ b/lms/nladmin-system/nlsso-server/src/main/resources/config/application.yml @@ -42,7 +42,7 @@ spring: freemarker: check-template-location: false profiles: - active: prod + active: test jackson: time-zone: GMT+8 data: diff --git a/lms/nladmin-system/nlsso-server/src/test/java/org/nl/ext/TestDemo.java b/lms/nladmin-system/nlsso-server/src/test/java/org/nl/ext/TestDemo.java index fbd5893..6a7136b 100644 --- a/lms/nladmin-system/nlsso-server/src/test/java/org/nl/ext/TestDemo.java +++ b/lms/nladmin-system/nlsso-server/src/test/java/org/nl/ext/TestDemo.java @@ -141,6 +141,7 @@ public class TestDemo { @Test void testData() { System.out.println(DateUtil.format(DateUtil.parse(DateUtil.today()), "yyyy年MM月dd日")); + System.out.println(DateUtil.format(DateUtil.parse(DateUtil.today()), "yyyy/MM/dd")); } @Test void testAdd() { @@ -148,4 +149,9 @@ public class TestDemo { Integer materialQty = 12; System.out.println(NumberUtil.add(realQty, materialQty)); } + @Test + void testNumberStr() { + System.out.println("1234564".matches("\\d+")); + System.out.println("1234你好564".matches("\\d+")); + } } diff --git a/lms/nladmin-ui/src/views/wms/pdm/workerorder/index.vue b/lms/nladmin-ui/src/views/wms/pdm/workerorder/index.vue index 107c697..160a403 100644 --- a/lms/nladmin-ui/src/views/wms/pdm/workerorder/index.vue +++ b/lms/nladmin-ui/src/views/wms/pdm/workerorder/index.vue @@ -242,7 +242,7 @@ v-for="item in custerList" :key="item.custer_NO" :label="item.custer_NAME" - :value="item.custer_NAME" + :value="item.custer_NO" > {{ item.custer_NO }} {{ item.custer_NAME }}