From 9004d51f5b6096827b5c66b444729cb554997ec4 Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期五, 26 九月 2025 14:32:30 +0800
Subject: [PATCH] 原材料订单拆分功能调整v2

---
 ruoyi-admin-ztns/src/main/resources/application-ztns.yml                                       |    6 ++
 ruoyi-common/src/main/java/com/ruoyi/common/utils/api/MesApiUtils.java                         |    6 +-
 inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsReportServiceImpl.java          |   41 +++++++------
 inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderServiceImpl.java           |   11 ++-
 inspect-server/src/main/java/com/ruoyi/inspect/aspect/MoveLocationAfterPushMesStockAspect.java |    4 +
 inspect-server/src/main/java/com/ruoyi/inspect/service/impl/RawMaterialOrderServiceImpl.java   |   50 ++++++++--------
 ruoyi-admin-ztns/src/main/resources/application-druid.yml                                      |   12 +++-
 inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java       |   38 +++++-------
 8 files changed, 91 insertions(+), 77 deletions(-)

diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/aspect/MoveLocationAfterPushMesStockAspect.java b/inspect-server/src/main/java/com/ruoyi/inspect/aspect/MoveLocationAfterPushMesStockAspect.java
index 126294d..d6ee1d0 100644
--- a/inspect-server/src/main/java/com/ruoyi/inspect/aspect/MoveLocationAfterPushMesStockAspect.java
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/aspect/MoveLocationAfterPushMesStockAspect.java
@@ -35,6 +35,8 @@
     @Autowired
     private MesApiUtils mesApiUtils;
 
+    private final static String LOCATION_NO = "WG-02-001";//mes澶栬喘鍚堟牸搴撲綅
+
     @AfterReturning(value = "execution(* com.ruoyi.inspect.service.impl.InsOrderServiceImpl.moveRawMaterial(..))")
     @Transactional(rollbackFor = Exception.class,isolation = Isolation.READ_COMMITTED)
     public void doAfterReturning(JoinPoint joinPoint) {
@@ -65,7 +67,7 @@
                     requestMap.put("outerColor", one.getOuterColor()); // 澶栨姢棰滆壊
                     requestMap.put("letteringInfo", one.getLetteringInfo()); // 鍗板瓧淇℃伅
                     requestMap.put("reelNumber", one.getDrumNo()); // 鐩樺彿
-                    requestMap.put("locationNo", "1302"); // 搴撲綅缂栧彿
+                    requestMap.put("locationNo", LOCATION_NO); // 搴撲綅缂栧彿
                     requestMap.put("customerOrderNo", one.getOrderNo()); // 閿�鍞鍗曞彿
                     requestMap.put("stockSource", one.getStockSource()); // 搴撳瓨鏉ユ簮
                     requestMap.put("remark", one.getRemark()); // 澶囨敞
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java
index 7f9701e..a3f4888 100644
--- a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java
@@ -919,24 +919,23 @@
         InsSample insSample = insSampleMapper.selectOne(Wrappers.<InsSample>lambdaQuery()
                 .eq(InsSample::getInsOrderId, orderId)
                 .last("limit 1"));
-//        threadPoolTaskExecutor.execute(() -> {
-//            String message = "";
-//            message += "鑰愪笣绯荤粺妫�楠屼换鍔″鏍搁�氱煡";
-//            message += "\n鎻愪氦浜�: " + userName;
-//            message += "\n濮旀墭缂栧彿: " + order.getEntrustCode();
-//            message += "\n鏍峰搧鍚嶇О: " + insSample.getModel();
-//            message += "\n瑙勬牸鍨嬪彿: " + order.getPartDetail();
-//            if (ifsInventoryQuantity != null) {
-//                message += "\n鎵规鍙�: " + ifsInventoryQuantity.getUpdateBatchNo();
-//            }
-//            //鍙戦�佷紒涓氬井淇℃秷鎭�氱煡  鎻愪氦澶嶆牳
-//            try {
-//                WxCpUtils.inform(sendUserAccount, message, null);
-//            } catch (Exception e) {
-//                throw new RuntimeException(e);
-//            }
-//        });
-
+        threadPoolTaskExecutor.execute(() -> {
+            String message = "";
+            message += "鑰愪笣绯荤粺妫�楠屼换鍔″鏍搁�氱煡";
+            message += "\n鎻愪氦浜�: " + userName;
+            message += "\n濮旀墭缂栧彿: " + order.getEntrustCode();
+            message += "\n鏍峰搧鍚嶇О: " + insSample.getModel();
+            message += "\n瑙勬牸鍨嬪彿: " + order.getPartDetail();
+            if (ifsInventoryQuantity != null) {
+                message += "\n鎵规鍙�: " + ifsInventoryQuantity.getUpdateBatchNo();
+            }
+            //鍙戦�佷紒涓氬井淇℃秷鎭�氱煡  鎻愪氦澶嶆牳
+            try {
+                WxCpUtils.inform(sendUserAccount, message, null);
+            } catch (Exception e) {
+                throw new RuntimeException(e);
+            }
+        });
         // 14.ifs绉诲簱(鍘熸潗鏂欓渶瑕佽繘琛岀Щ搴撴搷浣�) --> 鏈�鍚庢墽琛�,鍥犱负澶辫触鏃犳硶鍥炴粴
         if (ifsInventoryQuantity != null) {
             // 鐧昏妫�楠岀粨鏋�
@@ -950,8 +949,6 @@
                 // 娣诲姞鍒嗘瀽鏁版嵁
                 addAnalysis(productList, ifsInventoryQuantity, order, sendUserAccount);
             });
-
-
         } else {
             // 淇敼鎴愬搧鐘舵��
             // 鍒ゆ柇鏄惁鏈変笉鍚堟牸
@@ -966,7 +963,6 @@
                         .set(InsOrder::getInsResult, 0));
             }
         }
-
         return 1;
     }
 
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderServiceImpl.java
index 976209c..c3b08cb 100644
--- a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderServiceImpl.java
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderServiceImpl.java
@@ -43,6 +43,7 @@
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Isolation;
 import org.springframework.transaction.annotation.Transactional;
 
 import javax.servlet.http.HttpServletResponse;
@@ -1149,12 +1150,14 @@
 
     /**
      * ifs绉诲簱鎿嶄綔
-     * @param one
+     * @param inventoryQuantity
      * @return
      */
     @Override
-    @Transactional(rollbackFor = Exception.class)
-    public String moveRawMaterial(IfsInventoryQuantity one) {
+    @Transactional(rollbackFor = Exception.class,isolation = Isolation.READ_COMMITTED)
+    public String moveRawMaterial(IfsInventoryQuantity inventoryQuantity) {
+        //鏌ヨifs璁㈠崟璇︽儏
+        IfsInventoryQuantity one = ifsInventoryQuantityMapper.selectById(inventoryQuantity.getId());
         String toLocation;
         // 鐧昏閲囪喘妫�楠岀粨鏋淪TD
         if (one.getIsRegister().equals(0)) {
@@ -1175,7 +1178,7 @@
             if (result.getCode() != 200) {
                 throw new ErrorException("IFS鐧昏閲囪喘妫�楠岀粨鏋滃け璐�: " + result.getMessage());
             }
-            //濡傛灉鏄媶鍒嗚鍗曪紝鍒欏皢鍚屼竴鎺ュ彈鍙风殑璁㈠崟鏍囪宸茬櫥璁版帴鏀�
+            //濡傛灉鏄媶鍒嗚鍗曪紝鍒欏皢鍚屼竴鎺ユ敹鍙风殑璁㈠崟鏍囪宸茬櫥璁版牎楠�
             if(one.getIsSplitOrder()==1){
                 //鏌ヨ鍏朵綑鎷嗗垎鐨勮鍗�
                 List<IfsInventoryQuantity> quantityList = ifsInventoryQuantityMapper.selectList(Wrappers.<IfsInventoryQuantity>lambdaQuery()
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsReportServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsReportServiceImpl.java
index 3778b0c..1a7ce8c 100644
--- a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsReportServiceImpl.java
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsReportServiceImpl.java
@@ -49,6 +49,7 @@
 import org.springframework.core.io.ClassPathResource;
 import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Isolation;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.multipart.MultipartFile;
 
@@ -796,7 +797,7 @@
 
 
     @Override
-    @Transactional(rollbackFor = Exception.class)
+    @Transactional(rollbackFor = Exception.class,isolation = Isolation.READ_COMMITTED)
     public void isRawMaterial(InsOrder insOrder,Boolean registerInsResults,Boolean hasExemption) {
         IfsInventoryQuantity one = ifsInventoryQuantityMapper.selectOne(new LambdaQueryWrapper<IfsInventoryQuantity>()
                 .eq(IfsInventoryQuantity::getId, insOrder.getIfsInventoryId()));
@@ -822,9 +823,9 @@
                     if(Objects.isNull(vo.getInsOrderId())){
                         rawMaterialOrderService.rawOrderRelease(vo.getId(), vo.getPartDesc());
                     }else if(Objects.equals(vo.getInsOrderId(),insOrder.getId())){
-                        toLocation = insOrderService.moveRawMaterial(one);
+                        toLocation = insOrderService.moveRawMaterial(vo);
                     }else if(Objects.nonNull(vo.getInsResult()) && 1 == vo.getInsResult()){
-                        toLocation = insOrderService.moveRawMaterial(one);
+                        toLocation = insOrderService.moveRawMaterial(vo);
                     }
                 }
             }else{
@@ -855,23 +856,23 @@
                         .eq(IfsInventoryQuantity::getId, insOrder.getIfsInventoryId()));
             }
 
-//            threadPoolTaskExecutor.execute(() -> {
-//                // 浼佷笟寰俊閫氱煡
-//                String message = "";
-//                message += "妫�娴嬬粨鏋滄彁浜ら�氱煡";
-//                message += "\n鎵规鍙�: " + one.getUpdateBatchNo();
-//                message += "\n闆朵欢鍙�: " + one.getPartNo();
-//                message += "\n闆朵欢鎻忚堪: " + one.getPartDesc();
-//                message += "\n渚涘簲鍟嗗悕绉�: " + one.getSupplierName();
-//                message += "\n鎶佃揪鏁伴噺: " + one.getQtyArrived().stripTrailingZeros().toPlainString() + one.getBuyUnitMeas();
-//                // 鍙戦�佷紒涓歩nspectStatus淇¢�氱煡
-//                if (inspectStatus == 1) {
-//                    message += "\n妫�娴嬬粨鏋�: 鍚堟牸";
-//                } else {
-//                    message += "\n妫�娴嬬粨鏋�: 涓嶅悎鏍�";
-//                }
-//                WxCpUtils.informWebHook(wechatProperty.getExaminingUrl(), message);
-//            });
+            threadPoolTaskExecutor.execute(() -> {
+                // 浼佷笟寰俊閫氱煡
+                String message = "";
+                message += "妫�娴嬬粨鏋滄彁浜ら�氱煡";
+                message += "\n鎵规鍙�: " + one.getUpdateBatchNo();
+                message += "\n闆朵欢鍙�: " + one.getPartNo();
+                message += "\n闆朵欢鎻忚堪: " + one.getPartDesc();
+                message += "\n渚涘簲鍟嗗悕绉�: " + one.getSupplierName();
+                message += "\n鎶佃揪鏁伴噺: " + one.getQtyArrived().stripTrailingZeros().toPlainString() + one.getBuyUnitMeas();
+                // 鍙戦�佷紒涓歩nspectStatus淇¢�氱煡
+                if (inspectStatus == 1) {
+                    message += "\n妫�娴嬬粨鏋�: 鍚堟牸";
+                } else {
+                    message += "\n妫�娴嬬粨鏋�: 涓嶅悎鏍�";
+                }
+                WxCpUtils.informWebHook(wechatProperty.getExaminingUrl(), message);
+            });
 
         }
 
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/RawMaterialOrderServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/RawMaterialOrderServiceImpl.java
index 829cd4c..dc0649a 100644
--- a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/RawMaterialOrderServiceImpl.java
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/RawMaterialOrderServiceImpl.java
@@ -172,31 +172,31 @@
                 .set(IfsInventoryQuantity::getIsInspect, 1)
                 .set(IfsInventoryQuantity::getDeclareDate, LocalDateTime.now())
         );
-//        threadPoolTaskExecutor.execute(() -> {
-//            List<IfsInventoryQuantity> quantityList = ifsInventoryQuantityMapper.selectList(Wrappers.<IfsInventoryQuantity>lambdaQuery()
-//                    .in(IfsInventoryQuantity::getId, ids));
-//            // 浼佷笟寰俊閫氱煡
-//            String message = "";
-//            message += "鏂板鎶ユ閫氱煡";
-//            for (IfsInventoryQuantity inventoryQuantity : quantityList) {
-//                message += "\n鎵规鍙�: " + inventoryQuantity.getUpdateBatchNo();
-//                message += "\n闆朵欢鎻忚堪: " + inventoryQuantity.getPartDesc();
-//                message += "\n鎶佃揪鏁伴噺: " + inventoryQuantity.getQtyArrived().stripTrailingZeros().toPlainString() + inventoryQuantity.getBuyUnitMeas();
-//
-//                // 鍒ゆ柇鏈夋病鏈夊埌20鍚�. 鎴栬�呰兘鍚﹀厤妫�
-//                int result = notificationRawOrder(inventoryQuantity.getId());
-//                switch (result) {
-//                    case 1:
-//                        message += "\n褰撳墠鏍峰搧宸叉楠岃繃, 鍙互鍏嶆";
-//                        break;
-//                    case 2:
-//                        message += "\n褰撳墠鏍峰搧宸茶秴杩�20鍚�";
-//                        break;
-//                }
-//                message += "\n";
-//            }
-//            WxCpUtils.informWebHook(wechatProperty.getExaminingUrl(), message);
-//        });
+        threadPoolTaskExecutor.execute(() -> {
+            List<IfsInventoryQuantity> quantityList = ifsInventoryQuantityMapper.selectList(Wrappers.<IfsInventoryQuantity>lambdaQuery()
+                    .in(IfsInventoryQuantity::getId, ids));
+            // 浼佷笟寰俊閫氱煡
+            String message = "";
+            message += "鏂板鎶ユ閫氱煡";
+            for (IfsInventoryQuantity inventoryQuantity : quantityList) {
+                message += "\n鎵规鍙�: " + inventoryQuantity.getUpdateBatchNo();
+                message += "\n闆朵欢鎻忚堪: " + inventoryQuantity.getPartDesc();
+                message += "\n鎶佃揪鏁伴噺: " + inventoryQuantity.getQtyArrived().stripTrailingZeros().toPlainString() + inventoryQuantity.getBuyUnitMeas();
+
+                // 鍒ゆ柇鏈夋病鏈夊埌20鍚�. 鎴栬�呰兘鍚﹀厤妫�
+                int result = notificationRawOrder(inventoryQuantity.getId());
+                switch (result) {
+                    case 1:
+                        message += "\n褰撳墠鏍峰搧宸叉楠岃繃, 鍙互鍏嶆";
+                        break;
+                    case 2:
+                        message += "\n褰撳墠鏍峰搧宸茶秴杩�20鍚�";
+                        break;
+                }
+                message += "\n";
+            }
+            WxCpUtils.informWebHook(wechatProperty.getExaminingUrl(), message);
+        });
         return 1;
     }
 
diff --git a/ruoyi-admin-ztns/src/main/resources/application-druid.yml b/ruoyi-admin-ztns/src/main/resources/application-druid.yml
index fef6444..e4dd6da 100644
--- a/ruoyi-admin-ztns/src/main/resources/application-druid.yml
+++ b/ruoyi-admin-ztns/src/main/resources/application-druid.yml
@@ -150,7 +150,7 @@
 # 浼佷笟寰俊閫氱煡
 wechat:
   # 璐ㄩ噺鎶ユ閫氱煡
-  examiningUrl: https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=21993616-9966-4fe4-81b0-68e99a40c964
+  examiningUrl: # https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=21993616-9966-4fe4-81b0-68e99a40c964
 
 ifs:
   contract: ZTNS
@@ -159,6 +159,12 @@
   custorder: http://192.168.20.47/PurchService.ashx?
   custorder-port: http://192.168.20.47:8008/PurchService.ashx?
   erp-services: http://192.168.20.47:8081
+
+mes:
+  ztns:
+    ip: http://10.16.173.36
+    user: lims
+    password: qCzOMJlqE8TYOHDWGva/Tw==
 
 # 澶囨敞 18083瀵嗙爜锛歾ttZTT123!@
 mqtt:
@@ -169,7 +175,7 @@
     keepalive: 60 # 蹇冭烦 锛堝崟浣嶏細绉掞級
     qos: 1 # 蹇冭烦鍖呯骇鍒�
     completion-timeout: 3000 # 杩炴帴瓒呮椂鏃堕棿锛堝崟浣嶏細绉掞級
-    clientId: ztns01 # clientId
+    clientId: ztns01a # clientId
     subscribe: /ztt/v3/2455220/publish # 璁㈤槄涓婚
     client: true # 濡傛灉寮�鍙戦渶瑕佸惎鍔ㄦ祴璇曪紝闇�瑕佹敼涓篺alse涓嶇劧浼氫竴鐩存姤閿�
   - url: tcp://mqtt-ztt.zttiot.com:1883 # 鏈嶅姟鍣╥p
@@ -179,7 +185,7 @@
     keepalive: 60 # 蹇冭烦 锛堝崟浣嶏細绉掞級
     qos: 1 # 蹇冭烦鍖呯骇鍒�
     completion-timeout: 3000 # 杩炴帴瓒呮椂鏃堕棿锛堝崟浣嶏細绉掞級
-    clientId: ztns02 # clientId
+    clientId: ztns02b # clientId
     subscribe: /ztt/v3/2455221/publish # 璁㈤槄涓婚
     client: true # 濡傛灉寮�鍙戦渶瑕佸惎鍔ㄦ祴璇曪紝闇�瑕佹敼涓篺alse涓嶇劧浼氫竴鐩存姤閿�
 
diff --git a/ruoyi-admin-ztns/src/main/resources/application-ztns.yml b/ruoyi-admin-ztns/src/main/resources/application-ztns.yml
index fb5a17a..1e856e3 100644
--- a/ruoyi-admin-ztns/src/main/resources/application-ztns.yml
+++ b/ruoyi-admin-ztns/src/main/resources/application-ztns.yml
@@ -161,6 +161,12 @@
   custorder-port: http://192.168.20.50:8008/PurchService.ashx?
   erp-services: http://192.168.20.50:8081
 
+mes:
+  ztns:
+    ip: http://10.1.51.128
+    user: lims
+    password: q1CItm6Zl7P4SQkfczu/oQ==
+
 # 澶囨敞 18083瀵嗙爜锛歾ttZTT123!@
 mqtt:
   - url: tcp://mqtt-ztt.zttiot.com:1883 # 鏈嶅姟鍣╥p
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/api/MesApiUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/api/MesApiUtils.java
index 98f2f2f..f8d5e8b 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/api/MesApiUtils.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/api/MesApiUtils.java
@@ -15,13 +15,13 @@
 @Component
 public class MesApiUtils {
 
-    @Value("${mes.ztzb.ip}")
+    @Value("${mes.ztns.ip}")
     String ip;
 
-    @Value("${mes.ztzb.user}")
+    @Value("${mes.ztns.user}")
     String user;
 
-    @Value("${mes.ztzb.password}")
+    @Value("${mes.ztns.password}")
     String password;
 
     /**

--
Gitblit v1.9.3