From be99dea0c47c9a86eae906b46d67e14081191ad8 Mon Sep 17 00:00:00 2001
From: zhangc <zc@123>
Date: 星期六, 12 四月 2025 12:53:45 +0800
Subject: [PATCH] 1

---
 src/main/java/com/zy/asrs/service/impl/NoLiftOutServiceImpl.java |   86 ++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 84 insertions(+), 2 deletions(-)

diff --git a/src/main/java/com/zy/asrs/service/impl/NoLiftOutServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/NoLiftOutServiceImpl.java
index ee7b7de..b3a9855 100644
--- a/src/main/java/com/zy/asrs/service/impl/NoLiftOutServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/NoLiftOutServiceImpl.java
@@ -23,6 +23,8 @@
 import com.zy.core.model.command.ShuttleCommand;
 import com.zy.core.model.protocol.LiftProtocol;
 import com.zy.core.model.protocol.ShuttleProtocol;
+import com.zy.core.model.protocol.StaProtocol;
+import com.zy.core.thread.DevpThread;
 import com.zy.core.thread.LiftThread;
 import com.zy.core.thread.ShuttleThread;
 import lombok.extern.slf4j.Slf4j;
@@ -65,7 +67,7 @@
      */
     public void shuttleMoveExecute(WrkMast wrkMast) {
         //鍒ゆ柇鐩爣搴撲綅鏄惁鍦�1灞傛垨5灞�
-        if (Utils.getLev(wrkMast.getLocNo()) == 1 || Utils.getLev(wrkMast.getLocNo()) == 5) {
+        if (Utils.getLev(wrkMast.getSourceLocNo()) == 1 || Utils.getLev(wrkMast.getSourceLocNo()) == 5) {
             boolean stepMoveSta = this.shuttleMoveExecuteTransportLiftStepCallShuttle2(wrkMast);//鍛煎彨灏忚溅鑷冲彇璐х偣
             if (!stepMoveSta) {
                 return;
@@ -136,9 +138,28 @@
                 return false;
             }
 
+            DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, 1);
+            if (devpThread == null) {
+                return false;
+            }
+            int lev = Utils.getLev(wrkMast.getLocNo());
+            StaProtocol staProtocol2 = devpThread.getStation().get(lev == 1 ? 1014 : 1025);
+            //TODO
+//            if (!staProtocol2.isOutEnable()) {
+//                log.error("{}浠诲姟锛寋}鍙疯緭閫佺嚎涓嶅彲鍑�", wrkMast.getWrkNo(), lev == 1 ? 1014 : 1025);
+//                News.taskInfo(wrkMast.getWrkNo(), "{}浠诲姟锛寋}鍙疯緭閫佺嚎涓嶅彲鍑�", wrkMast.getWrkNo(), lev == 1 ? 1014 : 1025);
+//                return false;
+//            }
+            StaProtocol staProtocol = devpThread.getStation().get(lev == 1 ? 1015 : 1026);
+            if (staProtocol.isLoading()) {
+                log.error("{}浠诲姟锛寋}鍙疯緭閫佺嚎鏈夌墿", wrkMast.getWrkNo(), wrkMast.getSourceStaNo());
+                News.taskInfo(wrkMast.getWrkNo(), "{}浠诲姟锛寋}鍙疯緭閫佺嚎鏈夌墿", wrkMast.getWrkNo(), wrkMast.getSourceStaNo());
+                return false;
+            }
+
             if (shuttleProtocol.getCurrentLocNo().equals(wrkMast.getSourceLocNo())) {
                 //灏忚溅鍦ㄥ彇璐х偣
-                wrkMast.setWrkSts(WrkStsType.MOVE_OUT_NO_LIFT_2.sts);//灏忚溅绉诲姩鍒版彁鍗囨満涓�  301.鐢熸垚灏忚溅绉诲簱浠诲姟 ==> 鍛煎彨灏忚溅鑷冲彇璐х偣
+                wrkMast.setWrkSts(WrkStsType.MOVE_OUT_NO_LIFT_1.sts);//灏忚溅绉诲姩鍒版彁鍗囨満涓�  301.鐢熸垚灏忚溅绉诲簱浠诲姟 ==> 鍛煎彨灏忚溅鑷冲彇璐х偣
                 wrkMast.setModiTime(now);
                 wrkMast.setSystemMsg("");//娓呯┖娑堟伅
                 wrkMastService.updateById(wrkMast);
@@ -650,6 +671,25 @@
                 return false;//鎻愬崌鏈哄唴鏃犲皬杞�
             }
 
+            if (Utils.getLev(shuttleProtocol.getCurrentLocNo()) != Utils.getLev(wrkMast.getLocNo())) {
+                ShuttleAssignCommand assignCommand = new ShuttleAssignCommand();
+                assignCommand.setShuttleNo(shuttleProtocol.getShuttleNo()); // 鍥涘悜绌挎杞︾紪鍙�
+                assignCommand.setTaskMode(ShuttleTaskModeType.UPDATE_LOCATION.id);//鏇存柊鍧愭爣
+                assignCommand.setTaskNo(wrkMast.getWrkNo());//浠诲姟鍙�
+                assignCommand.setAuto(true);//鑷姩妯″紡
+                assignCommand.setSourceLocNo(shuttleProtocol.getCurrentLocNo());//婧愬簱浣�
+                assignCommand.setLocNo(wrkMast.getLocNo());//鐩爣搴撲綅
+
+                //鏇存柊灏忚溅鍧愭爣
+                ShuttleCommand command = shuttleThread.getUpdateLocationCommand(wrkMast.getWrkNo(), wrkMast.getLocNo());
+                ArrayList<ShuttleCommand> commands = new ArrayList<>();
+                commands.add(command);
+
+                assignCommand.setCommands(commands);
+                shuttleAction.assignWork(shuttleProtocol.getShuttleNo(), assignCommand);
+                return false;
+            }
+
             ShuttleAssignCommand assignCommand = new ShuttleAssignCommand();
             assignCommand.setShuttleNo(shuttleProtocol.getShuttleNo()); // 鍥涘悜绌挎杞︾紪鍙�
             assignCommand.setTaskMode(ShuttleTaskModeType.MOVE_LOC_NO.id);//灏忚溅绉诲簱浠诲姟
@@ -702,6 +742,26 @@
             if (shuttleProtocol == null) {
                 return false;
             }
+
+//            if (Utils.getLev(shuttleProtocol.getCurrentLocNo()) != Utils.getLev(wrkMast.getLocNo())) {
+//                ShuttleAssignCommand assignCommand = new ShuttleAssignCommand();
+//                assignCommand.setShuttleNo(shuttleProtocol.getShuttleNo()); // 鍥涘悜绌挎杞︾紪鍙�
+//                assignCommand.setTaskMode(ShuttleTaskModeType.UPDATE_LOCATION.id);//鏇存柊鍧愭爣
+//                assignCommand.setTaskNo(wrkMast.getWrkNo());//浠诲姟鍙�
+//                assignCommand.setAuto(true);//鑷姩妯″紡
+//                assignCommand.setSourceLocNo(shuttleProtocol.getCurrentLocNo());//婧愬簱浣�
+//                assignCommand.setLocNo(wrkMast.getLocNo());//鐩爣搴撲綅
+//
+//                //鏇存柊灏忚溅鍧愭爣
+//                ShuttleCommand command = shuttleThread.getUpdateLocationCommand(wrkMast.getWrkNo(), wrkMast.getLocNo());
+//                ArrayList<ShuttleCommand> commands = new ArrayList<>();
+//                commands.add(command);
+//
+//                assignCommand.setCommands(commands);
+//                shuttleAction.assignWork(shuttleProtocol.getShuttleNo(), assignCommand);
+//                return false;
+//            }
+
 
             //灏忚溅澶勪簬绌洪棽鐘舵��
             if (!shuttleThread.isIdle()) {
@@ -773,6 +833,24 @@
                 News.taskInfo(wrkMast.getWrkNo(), "{}浠诲姟锛寋}灏忚溅锛屽皬杞﹀繖纰屼腑", wrkMast.getWrkNo(), shuttleProtocol.getShuttleNo());
                 return false;
             }
+            DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, 1);
+            if (devpThread == null) {
+                return false;
+            }
+            int lev = Utils.getLev(wrkMast.getLocNo());
+            StaProtocol staProtocol2 = devpThread.getStation().get(lev == 1 ? 1014 : 1025);
+            //TODO
+//            if (!staProtocol2.isOutEnable()) {
+//                log.error("{}浠诲姟锛寋}鍙疯緭閫佺嚎涓嶅彲鍑�", wrkMast.getWrkNo(), lev == 1 ? 1014 : 1025);
+//                News.taskInfo(wrkMast.getWrkNo(), "{}浠诲姟锛寋}鍙疯緭閫佺嚎涓嶅彲鍑�", wrkMast.getWrkNo(), lev == 1 ? 1014 : 1025);
+//                return false;
+//            }
+            StaProtocol staProtocol = devpThread.getStation().get(lev == 1 ? 1015 : 1026);
+            if (staProtocol.isLoading()) {
+                log.error("{}浠诲姟锛寋}鍙疯緭閫佺嚎鏈夌墿", wrkMast.getWrkNo(), wrkMast.getSourceStaNo());
+                News.taskInfo(wrkMast.getWrkNo(), "{}浠诲姟锛寋}鍙疯緭閫佺嚎鏈夌墿", wrkMast.getWrkNo(), wrkMast.getSourceStaNo());
+                return false;
+            }
 
             if (shuttleProtocol.getCurrentLocNo().equals(wrkMast.getSourceLocNo())) {
                 //灏忚溅鍦ㄥ彇璐х偣
@@ -826,6 +904,10 @@
                 return false;
             }
 
+            if (!shuttleProtocol.getCurrentLocNo().equals(wrkMast.getSourceLocNo())) {
+                return false;
+            }
+
             ShuttleAssignCommand assignCommand = new ShuttleAssignCommand();
             assignCommand.setShuttleNo(shuttleProtocol.getShuttleNo()); // 鍥涘悜绌挎杞︾紪鍙�
             assignCommand.setTaskMode(ShuttleTaskModeType.MOVE_LOC_NO.id);//灏忚溅绉诲簱浠诲姟

--
Gitblit v1.9.1