From 58eaf5e73359f7164525d9c50f6e5bf82b247e32 Mon Sep 17 00:00:00 2001
From: zc <zc@123>
Date: 星期四, 24 四月 2025 09:10:58 +0800
Subject: [PATCH] 初步调试

---
 src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java |   81 +++++++++++++++++++++++++++-------------
 1 files changed, 55 insertions(+), 26 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 a31bf77..42bebb2 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -813,7 +813,7 @@
 //    }
     public synchronized void liftInExecute() {
         try {
-            List<WrkMast> wrkMasts = wrkMastService.selectList(new EntityWrapper<WrkMast>().in("wrk_sts", WrkStsType.NEW_INBOUND.sts, WrkStsType.INBOUND_DEVICE_RUN.sts, WrkStsType.INBOUND_LIFT_RUN_COMPLETE.sts).in("source_sta_no", 1012, 1022));
+            List<WrkMast> wrkMasts = wrkMastService.selectList(new EntityWrapper<WrkMast>().in("wrk_sts", WrkStsType.NEW_INBOUND.sts, WrkStsType.INBOUND_DEVICE_RUN.sts, WrkStsType.INBOUND_LIFT_RUN_COMPLETE.sts).in("source_sta_no", 1012, 1022, 1031));
             for (WrkMast wrkMast : wrkMasts) {
                 boolean step0 = this.liftInExecuteStep0(wrkMast);//璁惧涓婅蛋
                 if (!step0) {
@@ -858,11 +858,13 @@
                 News.info("{}浠诲姟锛寋}绔欑偣锛屾棤鎵樼洏", wrkMast.getWrkNo(), staProtocol.getSiteId());
                 return false;
             }
-
-            if (!staProtocol.getBarcode().equals(wrkMast.getBarcode())) {
-                News.info("{}浠诲姟锛寋}绔欑偣锛屾墭鐩樼爜涓嶅尮閰嶏紝绔欑偣鎵樼洏鐮侊細{}锛屼换鍔℃墭鐩樼爜锛歿}", wrkMast.getWrkNo(), staProtocol.getSiteId(), staProtocol.getBarcode(), wrkMast.getBarcode());
-                return false;
+            if (wrkMast.getSourceStaNo() != 1031) {
+                if (!staProtocol.getBarcode().equals(wrkMast.getBarcode())) {
+                    News.info("{}浠诲姟锛寋}绔欑偣锛屾墭鐩樼爜涓嶅尮閰嶏紝绔欑偣鎵樼洏鐮侊細{}锛屼换鍔℃墭鐩樼爜锛歿}", wrkMast.getWrkNo(), staProtocol.getSiteId(), staProtocol.getBarcode(), wrkMast.getBarcode());
+                    return false;
+                }
             }
+
             //鍒ゆ柇鎻愬崌鏈烘槸鍚︽湁鍏朵粬浠诲姟
             WrkMast liftWrkMast = wrkMastService.selectLiftWrkMastAndWrkNo(1, wrkMast.getWrkNo(), wrkMast.getMainWrkNo());
             if (liftWrkMast != null) {
@@ -875,7 +877,7 @@
             short staNo = 1012;
             if (wrkMast.getSourceStaNo() == 1022) {
                 staNo = 1023;
-            } else if (wrkMast.getSourceStaNo() == 1032) {
+            } else if (wrkMast.getSourceStaNo() == 1031) {
                 staNo = 1032;
             }
 
@@ -943,6 +945,8 @@
             Integer sourceStaNo = wrkMast.getSourceStaNo();
             if (wrkMast.getSourceStaNo() == 1022) {
                 sourceStaNo = 1023;
+            } else if (wrkMast.getSourceStaNo() == 1031) {
+                sourceStaNo = 1032;
             }
 
             StaProtocol staProtocol = station.get(sourceStaNo);
@@ -970,7 +974,7 @@
                     return false;
                 }
             } else if (sourceStaNo == 1032) {
-                if (staProtocol.getWorkNo().intValue() != wrkMast.getWrkNo()) {
+                if (staProtocol.getFinishWorkNo().intValue() != wrkMast.getWrkNo()) {
                     News.info("{}浠诲姟锛寋}绔欑偣锛屼换鍔″彿涓嶄竴鑷�", wrkMast.getWrkNo(), staProtocol.getSiteId());
                     return false;
                 }
@@ -990,11 +994,9 @@
 
             int lev = 101;
             if (wrkMast.getSourceStaNo() == 1021) {
-                //TODO
-                // lev = 105;
-                lev = 1021;
+                lev = 100 + Utils.getLev(wrkMast.getLocNo());
             } else if (wrkMast.getSourceStaNo() == 1031) {
-                lev = 1031;
+                lev = 100 + Utils.getLev(wrkMast.getLocNo());
             }
             //鑾峰彇鎻愬崌鏈哄懡浠�
             List<LiftCommand> liftCommands = liftThread.getPalletInCommand(wrkMast.getWrkNo(), sourceStaNo, lev);
@@ -1119,11 +1121,10 @@
                 return false;
             }
             if (wrkMast.getStaNo() == 1031) {
-                //TODO
-                if (staProtocol.getOutInModel() != 1) {
-                    News.info("{}浠诲姟锛寋}绔欑偣锛屾病鏈夊彲鍑轰俊鍙�", wrkMast.getWrkNo(), staProtocol.getSiteId());
-                    return false;
-                }
+//                if (staProtocol.getOutInModel() != 1) {
+//                    News.info("{}浠诲姟锛寋}绔欑偣锛屾病鏈夊彲鍑轰俊鍙�", wrkMast.getWrkNo(), staProtocol.getSiteId());
+//                    return false;
+//                }
             } else {
                 if (!isOutEnable(devpThread, wrkMast.getStaNo())) {
                     News.info("{}浠诲姟锛寋}绔欑偣锛屾病鏈夊彲鍑轰俊鍙�", wrkMast.getWrkNo(), staProtocol.getSiteId());
@@ -1214,9 +1215,12 @@
             //鑾峰彇鎻愬崌鏈哄懡浠�
             List<LiftCommand> liftCommands = liftThread.getPalletOutCommand(wrkMast.getWrkNo(), sourceLev, wrkMast.getStaNo());
             LiftCommand liftCommand = liftCommands.get(0);
-
-            int deviceWrk = commonService.getWorkNo(8);//鐢熸垚鎻愬崌鏈鸿澶囧伐浣滃彿
-            liftCommand.setTaskNo(deviceWrk);//鏇存崲闅忔満浠诲姟鍙�
+            if ( wrkMast.getStaNo()==1031){
+                liftCommand.setTaskNo(wrkMast.getWrkNo());
+            }else {
+                int deviceWrk = commonService.getWorkNo(8);//鐢熸垚鎻愬崌鏈鸿澶囧伐浣滃彿
+                liftCommand.setTaskNo(deviceWrk);//鏇存崲闅忔満浠诲姟鍙�
+            }
 
             ArrayList<LiftCommand> commands = new ArrayList<>();
             commands.add(liftCommand);
@@ -1232,6 +1236,7 @@
             wrkMast.setLiftNo(liftProtocol.getLiftNo());//鎻愬墠閿佸畾鎻愬崌鏈�
             wrkMast.setSystemMsg("");//娓呯┖娑堟伅
             wrkMast.setModiTime(now);
+
             if (wrkMastService.updateById(wrkMast)) {
                 //涓嬪彂浠诲姟
                 liftAction.assignWork(wrkMast.getLiftNo(), assignCommand);
@@ -1573,7 +1578,11 @@
                             wrkMast.setWrkSts(WrkStsType.INBOUND_LIFT_RUN_COMPLETE.sts);
                         } else if (wrkMast.getWrkSts() == WrkStsType.OUTBOUND_LIFT_RUN.sts) {
                             //104.鎻愬崌鏈烘惉杩愪腑 ==> 109.鍑哄簱瀹屾垚
-                            wrkMast.setWrkSts(WrkStsType.COMPLETE_OUTBOUND.sts);
+                            if (wrkMast.getStaNo() == 1031) {
+                                wrkMast.setWrkSts(WrkStsType.OUTBOUND_DEVP_RUN_2.sts);
+                            } else {
+                                wrkMast.setWrkSts(WrkStsType.COMPLETE_OUTBOUND.sts);
+                            }
                             wrkMast.setLiftNo(null);//閲婃斁鎻愬崌鏈�
                         } else if (wrkMast.getWrkSts() == WrkStsType.MOVE_LIFT_RUN.sts) {
                             //306.鎻愬崌鏈烘惉杩愪腑 ==> 307.鎻愬崌鏈烘惉杩愬畬鎴�
@@ -1600,7 +1609,6 @@
                             //鎻愬崌鏈鸿嚦灏忚溅灞� ==> 鎻愬崌鏈鸿嚦灏忚溅灞傚畬鎴�
                             wrkMast.setWrkSts(WrkStsType.MOVE_OUT_NO_LIFT_5.sts);
                         }
-
                         wrkMast.setModiTime(new Date());
                         if (wrkMastService.updateById(wrkMast)) {
                             liftThread.setSyncTaskNo(0);
@@ -1626,9 +1634,24 @@
             Map<Integer, StaProtocol> station = devpThread.getStation();
             WrkMast wrkMast = null;
             for (StaProtocol staProtocol : station.values()) {
-                if (staProtocol.getSiteId() == 1013 || staProtocol.getSiteId() == 1024) {
+                if ((staProtocol.getSiteId() == 1013 || staProtocol.getSiteId() == 1024) && staProtocol.isLoading()) {
                     wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("wrk_no", staProtocol.getFinishWorkNo()).eq("wrk_sts", WrkStsType.OUTBOUND_DEVP_RUN.sts));
                     if (wrkMast != null) {
+                        wrkMast.setWrkSts(WrkStsType.COMPLETE_OUTBOUND.sts);
+                        wrkMast.setModiTime(new Date());
+                        if (wrkMastService.updateById(wrkMast)) {
+                            News.info("杈撻�佺嚎宸茬‘璁や笖浠诲姟瀹屾垚鐘舵�併�傝緭閫佺嚎鍙�={},瀹岀粨宸ヤ綔鍙�={}", staProtocol.getSiteId(), staProtocol.getFinishWorkNo());
+                        } else {
+                            News.error("杈撻�佺嚎宸茬‘璁や笖浠诲姟瀹屾垚鐘舵��,澶嶄綅澶辫触锛屼絾鏈壘鍒板伐浣滄。銆傝緭閫佺嚎鍙�={}锛屽畬缁撳伐浣滃彿={}", staProtocol.getSiteId(), staProtocol.getFinishWorkNo());
+                        }
+                    }
+                } else if (staProtocol.getSiteId() == 1031 && staProtocol.isLoading()) {
+                    wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("wrk_no", staProtocol.getFinishWorkNo()).eq("wrk_sts", WrkStsType.OUTBOUND_DEVP_RUN_2.sts));
+                    if (wrkMast != null) {
+                        staProtocol.setWorkNo(Short.parseShort(String.valueOf(wrkMast.getWrkNo())));
+                        staProtocol.setStaNo(Short.parseShort(String.valueOf(1135)));
+                        MessageQueue.offer(SlaveType.Devp, 1, new Task(2, staProtocol));
+                        News.info("杈撻�佺嚎鍏ュ簱鍛戒护涓嬪彂锛屼换鍔℃暟鎹�={}", JSON.toJSON(wrkMast));
                         wrkMast.setWrkSts(WrkStsType.COMPLETE_OUTBOUND.sts);
                         wrkMast.setModiTime(new Date());
                         if (wrkMastService.updateById(wrkMast)) {
@@ -2137,11 +2160,17 @@
     }
 
     private void shuttleMoveExecuteTransportLift(WrkMast wrkMast) {
-        LiftThread liftThread = LiftUtils.getRecentLift(wrkMast.getLocNo());
-        if (liftThread == null) {
-            return;
+        WrkMast wrkMast1 = wrkMastService.selectByWorkNo(wrkMast.getMainWrkNo());
+        LiftThread liftThread;
+        if (wrkMast1 != null && wrkMast1.getLiftNo() != null) {
+            liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, 1);
+        } else {
+            liftThread = LiftUtils.getRecentLift(wrkMast.getLocNo());
+            if (liftThread == null) {
+                return;
+            }
         }
-
+        //liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, wrkMast1.getLiftNo());
         String liftLocNo = liftThread.getLiftLocNo(Utils.getLev(wrkMast.getLocNo()));
         if (Utils.getRow(liftLocNo) == Utils.getRow(wrkMast.getSourceLocNo()) && Utils.getBay(liftLocNo) == Utils.getBay(wrkMast.getSourceLocNo())) {
             //鍙栬揣浣嶇疆鏄彁鍗囨満

--
Gitblit v1.9.1