From e22952465f1ab08a58f84c2f01e7d4e89b6bd61e Mon Sep 17 00:00:00 2001
From: Junjie <xjj@123>
Date: 星期一, 18 八月 2025 17:10:34 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java |   93 ++++++++++++++++++++++++++++++++++------------
 1 files changed, 69 insertions(+), 24 deletions(-)

diff --git a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
index 5b7f399..ef9d076 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -233,6 +233,12 @@
                                     .eq("loc_no", dto.getLocNo()));
 
                             short staNo = dto.getStaNo().shortValue();
+
+                            int sourceStaNo = dto.getSourceStaNo();
+                            if (sourceStaNo == 1007) {
+                                staNo = 2002;
+                            }
+
                             if (inSta.getStaNo() == 1002) {
                                 staNo = 2002;
                             }
@@ -743,7 +749,7 @@
 //            }
 
             //鍫嗗灈鏈哄洖鍘熺偣浠诲姟涓�
-            Object object = redisUtil.get(RedisConstantType.CRN_MOVE_LOCK);
+            Object object = redisUtil.get(RedisConstantType.CRN_MOVE_LOCK + crn.getId());
             if (object != null) {
                 continue;
             }
@@ -815,7 +821,7 @@
                     continue;
                 }
 
-                Object object = redisUtil.get(RedisConstantType.CRN_MOVE_LOCK);
+                Object object = redisUtil.get(RedisConstantType.CRN_MOVE_LOCK + crn.getId());
                 if (object != null) {
                     continue;
                 }
@@ -887,7 +893,7 @@
                     continue;
                 }
 
-                Object object = redisUtil.get(RedisConstantType.CRN_MOVE_LOCK);
+                Object object = redisUtil.get(RedisConstantType.CRN_MOVE_LOCK + crn.getId());
                 if (object != null) {
                     continue;
                 }
@@ -1207,7 +1213,7 @@
 //                    continue;
                 }
                 // 鍒ゆ柇鍫嗗灈鏈哄嚭搴撶珯鐘舵��
-                if (staProtocol.isAutoing()  && staDetl.getCanouting() != null && staDetl.getCanouting().equals("Y")) {
+                if (staProtocol.isAutoing() && !staProtocol.isLoading() && staDetl.getCanouting() != null && staDetl.getCanouting().equals("Y")) {
 
                     //鏍规嵁鍙傛暟鍒ゆ柇鏄惁鏍¢獙鍙嚭淇″彿
                     String crnOutVerifyOut = "Y";
@@ -1219,10 +1225,6 @@
 
                     if (crnOutVerifyOut.equals("Y")) {
                         if (!staProtocol.isOutEnable()) {
-                            continue;
-                        }
-
-                        if (staProtocol.isLoading()) {
                             continue;
                         }
 
@@ -1648,6 +1650,7 @@
                 if (crnProtocol.getTaskNo() == 9999) {
                     // 鍫嗗灈鏈哄浣�
                     crnThread.setResetFlag(true);
+                    redisUtil.set(RedisConstantType.CRN_MOVE_LOCK + crn.getId(), "lock", 8);//闃叉鍥炲師鐐瑰悗涓嬪彂鎸囦护杩囧揩
                     continue;
                 }
 
@@ -2137,22 +2140,64 @@
 //                    }catch (Exception e){
 //                        log.error("宸ヤ綔妗f鏄庣粏杈撳叆鐢佃鏈哄け璐�1锛氬紓甯镐俊鎭�==銆�"+e);
 //                    }
-                    wrkDetls.forEach(wrkDetl -> ledCommand.getMatDtos().add(new MatDto(
-                            wrkDetl.getMatnr()
-                            , wrkDetl.getMaktx()
-                            , wrkDetl.getAnfme()
-                            , wrkDetl.getWeight()
-                            , wrkDetl.getStockNum()
-                            , wrkDetl.getStockNum2()
-                            , wrkDetl.getSpecs()
-                            , wrkDetl.getSku()
-                            , wrkDetl.getZpallet()
-                            , wrkDetl.getModel()
-                            , wrkDetl.getSupp()
-                            , wrkDetl.getKpCstmrName()
-                            , wrkDetl.getOrderNo()
-                            , wrkDetl.getCstateid$()
-                    )));
+
+                    if (!wrkDetls.isEmpty()) {
+                        WrkDetl wrkDetl = wrkDetls.get(0);
+                        double anfme = 0D;
+                        double weight = 0D;
+                        for (WrkDetl detl : wrkDetls) {
+                            anfme += detl.getAnfme();
+                            weight += detl.getWeight();
+                            wrkDetl.setAnfme(anfme);
+                            wrkDetl.setWeight(weight);
+                        }
+
+                        List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>()
+                                .eq("loc_no", wrkMast.getSourceLocNo()));
+                        double totalAnfme = 0D;
+                        double totalWeight = 0D;
+                        for (LocDetl locDetl : locDetls) {
+                            totalAnfme += locDetl.getAnfme();
+                            totalWeight += locDetl.getWeight();
+                        }
+                        wrkDetl.setStockNum(totalAnfme);
+                        wrkDetl.setStockNum2(totalWeight);
+
+                        ledCommand.getMatDtos().add(new MatDto(
+                                wrkDetl.getMatnr()
+                                , wrkDetl.getMaktx()
+                                , wrkDetl.getAnfme()
+                                , wrkDetl.getWeight()
+                                , wrkDetl.getStockNum()
+                                , wrkDetl.getStockNum2()
+                                , wrkDetl.getSpecs()
+                                , wrkDetl.getSku()
+                                , wrkDetl.getZpallet()
+                                , wrkDetl.getModel()
+                                , wrkDetl.getSupp()
+                                , wrkDetl.getKpCstmrName()
+                                , wrkDetl.getOrderNo()
+                                , wrkDetl.getCstateid$()
+                        ));
+
+//                        wrkDetls.forEach(wrkDetl -> ledCommand.getMatDtos().add(new MatDto(
+//                                wrkDetl.getMatnr()
+//                                , wrkDetl.getMaktx()
+//                                , wrkDetl.getAnfme()
+//                                , wrkDetl.getWeight()
+//                                , wrkDetl.getStockNum()
+//                                , wrkDetl.getStockNum2()
+//                                , wrkDetl.getSpecs()
+//                                , wrkDetl.getSku()
+//                                , wrkDetl.getZpallet()
+//                                , wrkDetl.getModel()
+//                                , wrkDetl.getSupp()
+//                                , wrkDetl.getKpCstmrName()
+//                                , wrkDetl.getOrderNo()
+//                                , wrkDetl.getCstateid$()
+//                        )));
+                    }
+
                 }
                 commands.add(ledCommand);
             }

--
Gitblit v1.9.1