From 2bb12b1ca40b29b7edcf06ef3f3d6de24dde1c4c Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期三, 24 九月 2025 14:59:17 +0800
Subject: [PATCH] 原材料订单拆分功能v1

---
 inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java |   56 +++++++++++++++++++++++++++++++++++---------------------
 1 files changed, 35 insertions(+), 21 deletions(-)

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 62a2daa..7f9701e 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
@@ -30,6 +30,7 @@
 import com.ruoyi.basic.pojo.IfsInventoryQuantity;
 import com.ruoyi.basic.pojo.StandardTemplate;
 import com.ruoyi.basic.service.StandardTemplateService;
+import com.ruoyi.basic.vo.IfsInventoryQuantityVO;
 import com.ruoyi.common.constant.DictDataConstants;
 import com.ruoyi.common.constant.InsOrderTypeConstants;
 import com.ruoyi.common.constant.MenuJumpPathConstants;
@@ -277,7 +278,8 @@
     }
 
     @Override
-    public List<String> checkSubmitPlan(Integer orderId, String laboratory) {
+    public Map<String,Object> checkSubmitPlan(Integer orderId, String laboratory) {
+        Map<String, Object> map = new HashMap<>();
         List<String> collect = new ArrayList<>();
         List<InsSample> insSamples = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery().eq(InsSample::getInsOrderId, orderId).select(InsSample::getId));
         List<Integer> ids = insSamples.stream().map(a -> a.getId()).collect(Collectors.toList());
@@ -303,7 +305,19 @@
                 return insProduct.getInspectionItem() + "-" + insProduct.getInspectionItemSubclass();
             }).collect(Collectors.toList());
         }
-        return collect;
+        //鏌ヨifs鎷嗗垎璁㈠崟鏄惁鏈夊凡涓嬪崟浣嗘槸鏈瀹岀殑鍗曞瓙
+        long count = 0L;
+        InsOrder insOrder = insOrderMapper.selectById(orderId);
+        if(Objects.nonNull(insOrder.getIfsInventoryId())){
+            IfsInventoryQuantity one = ifsInventoryQuantityMapper.selectById(insOrder.getIfsInventoryId());
+            //杩囨护鍑轰笉鍚堟牸鎴栨湭鎻愪氦鐨勫崟瀛�
+            count = ifsInventoryQuantityMapper.selectSplitOrderList(one.getPartNo(),one.getLineNo(),one.getReleaseNo(),one.getReceiptNo(),one.getOrderNo())
+                    .stream()
+                    .filter(f->(Objects.nonNull(f.getInsOrderId()) && !Objects.equals(f.getInsOrderId(),orderId)) && (Objects.isNull(f.getInsResult()) || 0==f.getInsResult())).count();
+        }
+        map.put("errorMsg",collect);
+        map.put("unInsOrderCount",count);
+        return map;
     }
 
     @Override
@@ -758,7 +772,7 @@
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public int submitPlan(Integer orderId, String laboratory, Integer verifyUser, String entrustCode) {
+    public int submitPlan(Integer orderId, String laboratory, Integer verifyUser, String entrustCode,Boolean registerInsResults) {
         InsOrder order = insOrderMapper.selectById(orderId);
         // 1. 鍒ゆ柇鏄惁鏈夐噸澶嶇紪鍙�, 鏈夐噸澶嶇紪鍙峰仛鎻愰啋
         Long codeCount = insOrderMapper.selectCount(Wrappers.<InsOrder>lambdaQuery()
@@ -905,30 +919,30 @@
         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) {
             // 鐧昏妫�楠岀粨鏋�
             // 鍒ゆ柇鏄惁鏈変笉鍚堟牸, 鏈変笉鍚堟牸涓嶈兘绉诲簱
             // todo: ifs绉诲簱
-            insReportService.isRawMaterial(order);
+            insReportService.isRawMaterial(order,registerInsResults,false);
 
             // 15 鍒ゆ柇褰撳墠鏍峰搧鏄惁涓哄師鏉愭枡, 鍘熸潗鏂欓渶瑕佽繘琛屾暟鎹垎鏋�, 鍒ゆ柇涔嬪墠10鏉℃暟鎹悓涓�涓緵搴斿晢, 鍚屼竴涓楠岄」鐨勫亸宸槸鍚﹁秴杩�10%
             // 鏌ヨifs淇℃伅鑾峰彇鑾峰彇鍓�10涓緵搴斿晢涓�鏍风殑, 妫�楠岄」涓�鏍蜂俊鎭�

--
Gitblit v1.9.3