From 3c992dd950b539f03cdf64898f8bfba65c2313b8 Mon Sep 17 00:00:00 2001
From: lsh <lsh@163.com>
Date: 星期六, 08 十一月 2025 15:10:25 +0800
Subject: [PATCH] *

---
 src/main/java/com/zy/asrs/utils/OrderOutBatchUtil.java |  143 +++++++++++++++++++++++++++++------------------
 1 files changed, 87 insertions(+), 56 deletions(-)

diff --git a/src/main/java/com/zy/asrs/utils/OrderOutBatchUtil.java b/src/main/java/com/zy/asrs/utils/OrderOutBatchUtil.java
index fb1cdd0..f30eab3 100644
--- a/src/main/java/com/zy/asrs/utils/OrderOutBatchUtil.java
+++ b/src/main/java/com/zy/asrs/utils/OrderOutBatchUtil.java
@@ -11,6 +11,7 @@
 import com.zy.asrs.entity.param.StockOutParam;
 import com.zy.asrs.service.LocDetlService;
 import com.zy.asrs.service.LocMastService;
+import com.zy.asrs.service.MatService;
 import com.zy.asrs.service.WorkService;
 import com.zy.common.model.LocDto;
 import com.zy.common.properties.SlaveProperties;
@@ -78,7 +79,6 @@
     public R setOrderOutBatch() {
         return R.ok();
     }
-
 
     public R setOrderOutBatch(List<OrderOutLocBoxCsUtilParam>  OutLocBoxCs) {
         int total = OutLocBoxCs.size();
@@ -239,7 +239,8 @@
         }
         return R.error(requert);
     }
-    public R setOrderOutBatchCargoBookingNote(List<String[]> OutLocBoxCs) {
+
+    public R setOrderOutBatchCargoBookingNote(List<OrderOutLocBoxCsUtilParam>  OutLocBoxCs) {
         int total = OutLocBoxCs.size();
         if (!Cools.isEmpty(OutLocBoxCs) && !OutLocBoxCs.isEmpty()) {
             LocDetlService locDetlService = SpringUtils.getBean(LocDetlService.class);
@@ -247,77 +248,107 @@
             SlaveProperties slaveProperties = SpringUtils.getBean(SlaveProperties.class);
             WorkService workService = SpringUtils.getBean(WorkService.class);
             List<LocDto> locDtos = new ArrayList<>();
-            List<String[]> outLocBoxCList = new ArrayList<>();
+            List<OrderOutLocBoxCsUtilParam> outLocBoxCList = new ArrayList<>();
             List<String> outLocBoxCNew = new ArrayList<>();
-            for (String[] outLocBoxC : OutLocBoxCs) {
+            List<String> outLocRollListOld = new ArrayList<>();
+            List<String> outLocRollListNew = new ArrayList<>();
+            for (OrderOutLocBoxCsUtilParam outLocBoxC : OutLocBoxCs) {
+                if (!outLocRollListOld.contains(outLocBoxC.getRoll())) {
+                    outLocRollListOld.add(outLocBoxC.getRoll());
+                }
+            }
+            for (OrderOutLocBoxCsUtilParam outLocBoxC : OutLocBoxCs) {
                 total--;
-                if (!outLocBoxCNew.contains(outLocBoxC[0])) {
-                    LocDetl locDetlSou = locDetlService.selectOne(new EntityWrapper<LocDetl>().eq("batch", outLocBoxC[0]));
-                    if (Cools.isEmpty(locDetlSou)) {
+                LocDetl locDetlSou = locDetlService.selectOne(new EntityWrapper<LocDetl>().eq("batch", outLocBoxC.getBoxNo()).eq("model",outLocBoxC.getRoll()));
+                if (Cools.isEmpty(locDetlSou)) {
+                    locDetlSou = new LocDetl();
+                    locDetlSou.setBatch(outLocBoxC.getBoxNo());
+                    locDetlSou.setModel(outLocBoxC.getRoll());
+                    locDetlSou.setLocNo("鏃犲簱瀛�");
+//                    sign = false;
+                    errorMsgOrderLoc = errorMsgOrderLoc + "[===銆�" + "绠卞彿锛�" + outLocBoxC.getBoxNo() + "鍗峰彿锛�" + outLocBoxC.getRoll() + " 鏈煡璇㈠埌鏁版嵁锛侊紒锛併��===]";
+//                    continue;
+                }
+                if (signDanger){
+                    if (!locDetlSou.getDanger$().equals(outLocBoxC.getDanger())) {
                         sign = false;
-                        errorMsgOrderLoc = errorMsgOrderLoc + "[===銆�" + "绠卞彿锛�" + outLocBoxC[0] + " 鏈煡璇㈠埌鏁版嵁锛侊紒锛併��===]";
+                        errorMsgOrderLoc = errorMsgOrderLoc + "[===銆�" + "绠卞彿锛�" + outLocBoxC.getBoxNo() + "鍗峰彿锛�" + outLocBoxC.getRoll() +  " ==銆嬪嚭搴撹緭鍏ュ緟鍒ょ姸鎬侊細" + outLocBoxC.getDanger() + "銆佸簱瀛樼姸鎬侊細" + locDetlSou.getDanger$() + "銆傜姸鎬佷笉鍖归厤銆�===]";
                         continue;
-//                        throw new CoolException("绠卞彿锛�"+outLocBoxC[0]+" 鏈煡璇㈠埌鏁版嵁锛侊紒锛�");
                     }
-                    if (signDanger){
-                        if (!locDetlSou.getDanger$().equals(outLocBoxC[4])) {
-                            sign = false;
-                            errorMsgOrderLoc = errorMsgOrderLoc + "[===銆�" + "绠卞彿锛�" + outLocBoxC[0] + " ==銆嬪嚭搴撹緭鍏ュ緟鍒ょ姸鎬侊細" + outLocBoxC[4] + "銆佸簱瀛樼姸鎬侊細" + locDetlSou.getDanger$() + "銆傜姸鎬佷笉鍖归厤銆�===]";
-                            continue;
-                        }
-                    }
+                }
+                if (!outLocBoxCNew.contains(outLocBoxC.getBoxNo()) && !locDetlSou.getLocNo().equals("鏃犲簱瀛�")) {
                     LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", locDetlSou.getLocNo()));
                     if (Cools.isEmpty(locMast)) {
-                        sign = false;
-                        errorMsgOrderLoc = errorMsgOrderLoc + "[===銆�" + "绠卞彿锛�" + outLocBoxC[0] + " 鎵�鍦ㄥ簱浣嶄笉婊¤冻鍑哄簱鏉′欢锛侊紒锛佹湭鏌ヨ鍒版绠卞彿鎵�鍦ㄥ簱浣�" + "銆�===]";
-                        continue;
-                    }
-                    if (!locMast.getLocSts().equals("F")) {
-                        sign = false;
-                        errorMsgOrderLoc = errorMsgOrderLoc + "[===銆�" + "绠卞彿锛�" + outLocBoxC[0] + " 鎵�鍦ㄥ簱浣嶄笉婊¤冻鍑哄簱鏉′欢锛侊紒锛佸簱浣嶇姸鎬佷笉涓篎锛侊紒锛佸簱浣嶇姸鎬侊細" + locMast.getLocSts$() + "銆�===]";
-                        continue;
-                    }
-
-                    // 鐩爣搴撲綅 ===>> 娴呭簱浣�
-                    if (Utils.isShallowLoc(slaveProperties, locMast.getLocNo())) {
-                        String shallowLoc = Utils.getDeepLoc(slaveProperties, locMast.getLocNo());
-                        LocMast locMast2 = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", shallowLoc));
-                        if (!Cools.isEmpty(locMast2)) {
-                            if (locMast2.getLocSts().equals("P") || locMast2.getLocSts().equals("R")) {
-                                errorMsgOrderLoc = errorMsgOrderLoc + "[===銆�" + "绠卞彿锛�" + outLocBoxC[0] + " 鎵�鍦ㄥ簱浣嶆弧瓒冲嚭搴撴潯浠讹紒锛侊紒浣嗘槸娣卞簱浣嶅湪鍑哄簱涓紒锛侊紒鍥犳浼氬す鏉傚湪鍓嶈竟璁㈠崟鎵ц锛侊紒锛�" + "銆�===]";
+//                        sign = false;
+                        errorMsgOrderLoc = errorMsgOrderLoc + "[===銆�" + "绠卞彿锛�" + outLocBoxC.getBoxNo() + "鍗峰彿锛�" + outLocBoxC.getRoll() +  " 鎵�鍦ㄥ簱浣嶄笉婊¤冻鍑哄簱鏉′欢锛侊紒锛佹湭鏌ヨ鍒版绠卞彿鎵�鍦ㄥ簱浣�" + "銆�===]";
+//                        continue;
+                    } else if (!locMast.getLocSts().equals("F")) {
+//                        sign = false;
+                        errorMsgOrderLoc = errorMsgOrderLoc + "[===銆�" + "绠卞彿锛�" + outLocBoxC.getBoxNo() + "鍗峰彿锛�" + outLocBoxC.getRoll() +  " 鎵�鍦ㄥ簱浣嶄笉婊¤冻鍑哄簱鏉′欢锛侊紒锛佸簱浣嶇姸鎬佷笉涓篎锛侊紒锛佸簱浣嶇姸鎬侊細" + locMast.getLocSts$() + "銆�===]";
+//                        continue;
+                    } else {
+                        // 鐩爣搴撲綅 ===>> 娴呭簱浣�
+                        if (Utils.isShallowLoc(slaveProperties, locMast.getLocNo())) {
+                            String shallowLoc = Utils.getDeepLoc(slaveProperties, locMast.getLocNo());
+                            LocMast locMast2 = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", shallowLoc));
+                            if (!Cools.isEmpty(locMast2)) {
+                                if (locMast2.getLocSts().equals("P") || locMast2.getLocSts().equals("R")) {
+                                    errorMsgOrderLoc = errorMsgOrderLoc + "[===銆�" + "绠卞彿锛�" + outLocBoxC.getBoxNo() +  "鍗峰彿锛�" + outLocBoxC.getRoll() + " 鎵�鍦ㄥ簱浣嶆弧瓒冲嚭搴撴潯浠讹紒锛侊紒浣嗘槸鐩搁偦搴撲綅鍦ㄥ嚭搴撲腑锛侊紒锛佸洜姝や細澶规潅鍦ㄥ墠杈硅鍗曟墽琛岋紒锛侊紒" + "銆�===]";
+                                }
                             }
                         }
                     }
-
-                    if (sign) {
-                        List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>()
-                                .eq("loc_no", locDetlSou.getLocNo()).eq("origin", locDetlSou.getOrigin()));
-                        for (LocDetl locDetl : locDetls) {
-                            total++;
-                            String[] locDetlNow = new String[5];
-                            locDetlNow[0] = locDetl.getBatch();
-                            locDetlNow[1] = outLocBoxC[1];
-                            locDetlNow[2] = outLocBoxC[2];
-                            locDetlNow[3] = outLocBoxC[3];
-                            locDetlNow[4] = outLocBoxC[4];
-                            outLocBoxCList.add(locDetlNow);
-                            outLocBoxCNew.add(outLocBoxC[0]);
+                }
+                if (sign && !outLocRollListNew.contains(outLocBoxC.getRoll()) && !locDetlSou.getLocNo().equals("鏃犲簱瀛�")) {
+                    List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>()
+                            .eq("loc_no", locDetlSou.getLocNo()).eq("origin", locDetlSou.getOrigin()));
+                    for (LocDetl locDetl : locDetls) {
+                        if (!outLocRollListNew.contains(locDetl.getModel())){
+                            if (!outLocRollListOld.contains(locDetl.getModel())){
+                                total++;
+                                OrderOutLocBoxCsUtilParam orderOutLocBoxCsUtilParam = new OrderOutLocBoxCsUtilParam(locDetl.getBatch(),locDetl.getModel(), outLocBoxC);
+                                orderOutLocBoxCsUtilParam.setMemo("闄勫甫鍑哄簱");
+                                orderOutLocBoxCsUtilParam.setDanger(locDetl.getDanger$());
+                                outLocBoxCList.add(orderOutLocBoxCsUtilParam);
+                                outLocBoxCNew.add(outLocBoxC.getBoxNo());
+                                outLocRollListNew.add(outLocBoxC.getRoll());
+                            } else {
+                                if (locDetlSou.getBatch().equals(locDetl.getBatch()) && locDetlSou.getModel().equals(locDetl.getModel())) {
+                                    total++;
+                                    outLocBoxCList.add(outLocBoxC);
+                                    outLocBoxCNew.add(outLocBoxC.getBoxNo());
+                                    outLocRollListNew.add(outLocBoxC.getRoll());
+                                }
+                            }
                         }
+                    }
+                } else if (sign && !outLocRollListNew.contains(outLocBoxC.getRoll()) && locDetlSou.getLocNo().equals("鏃犲簱瀛�")) {
+                    if (!outLocRollListNew.contains(locDetlSou.getModel())){
+                        total++;
+                        outLocBoxCList.add(outLocBoxC);
+                        outLocBoxCNew.add(outLocBoxC.getBoxNo());
+                        outLocRollListNew.add(outLocBoxC.getRoll());
                     }
                 }
             }
-            for (String[] outLocBoxC : outLocBoxCList) {
-                LocDetl locDetl = locDetlService.selectOne(new EntityWrapper<LocDetl>().eq("batch", outLocBoxC[0]));
+            for (OrderOutLocBoxCsUtilParam outLocBoxC : outLocBoxCList) {
+                LocDetl locDetl = locDetlService.selectOne(new EntityWrapper<LocDetl>().eq("batch", outLocBoxC.getBoxNo()).eq("model", outLocBoxC.getRoll()));
                 if (Cools.isEmpty(locDetl)) {
-                    total--;
-                    continue;
+//                    total--;
+//                    continue;
+                    locDetl = new LocDetl();
+                    locDetl.setBatch(outLocBoxC.getBoxNo());
+                    locDetl.setModel(outLocBoxC.getRoll());
+                    locDetl.setLocNo("鏃犲簱瀛�");
                 }
 
-                if (!Cools.isEmpty(outLocBoxC[3])) {
-                    String memo = Cools.isEmpty(locDetl.getMemo()) ? "" : locDetl.getMemo() + "锛�";
-                    locDetl.setMemo(memo + DateUtils.convert(new Date(), DateUtils.yyyyMMdd_C) + "澶囨敞锛�" + outLocBoxC[3]);
-                } else if (Cools.isEmpty(locDetl.getMemo())) {
-                    locDetl.setMemo(outLocBoxC[3]);
+                if (!Cools.isEmpty(outLocBoxC.getMemo())) {
+                    if (Cools.isEmpty(locDetl.getMemo())) {
+                        locDetl.setMemo(DateUtils.convert(new Date(), DateUtils.yyyyMMdd_C) + "澶囨敞锛�" + outLocBoxC.getMemo());
+                    } else {
+                        String memo = Cools.isEmpty(locDetl.getMemo()) ? "" : locDetl.getMemo() + "锛�";
+                        locDetl.setMemo(memo + DateUtils.convert(new Date(), DateUtils.yyyyMMdd_C) + "澶囨敞锛�" + outLocBoxC.getMemo());
+                    }
                 }
                 LocDto locDto = new LocDto(locDetl);
                 locDtos.add(locDto);

--
Gitblit v1.9.1