From 49379100e381557f383f601616b2f6835295786d Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期三, 20 九月 2023 13:39:44 +0800
Subject: [PATCH] #
---
 src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java |  197 +++++++++++++++++++++++++++++++++----------------
 src/main/java/com/zy/asrs/mapper/WrkMastMapper.java         |    2 
 src/main/java/com/zy/common/utils/NyShuttleOperaUtils.java  |   28 +++++++
 src/main/resources/mapper/WrkMastMapper.xml                 |    9 ++
 4 files changed, 171 insertions(+), 65 deletions(-)
diff --git a/src/main/java/com/zy/asrs/mapper/WrkMastMapper.java b/src/main/java/com/zy/asrs/mapper/WrkMastMapper.java
index e748e0d..0873d5b 100644
--- a/src/main/java/com/zy/asrs/mapper/WrkMastMapper.java
+++ b/src/main/java/com/zy/asrs/mapper/WrkMastMapper.java
@@ -46,6 +46,8 @@
 
     WrkMast selectRackInStep4(Short workNo,Integer staNo);
 
+    List<WrkMast> selectInStep4();
+
     WrkMast selectByWorkNo(Integer workNo);
 
     List<WrkMast> selectLiftStep223103();
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 4b61f61..1f2c87c 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -665,6 +665,34 @@
      * 鍏ュ簱  ===>>  鍥涘悜绌挎杞﹀叆搴撲綔涓氫笅鍙�
      */
     public synchronized void shuttleInExecute() {
+        List<WrkMast> wrkMasts = wrkMastMapper.selectInStep4();
+        for (WrkMast wrkMast : wrkMasts) {
+            //鑾峰彇婧愮珯
+            BasDevp sourceBasDevp = basDevpService.selectById(wrkMast.getSourceStaNo());
+            if (sourceBasDevp == null) {
+                continue;//绔欑偣涓嶅瓨鍦�
+            }
+
+            //鑾峰彇鐩爣绔�
+            LiftStaProtocol liftStaProtocol = NyLiftUtils.getLiftStaByLev(sourceBasDevp.getLiftNo(), Utils.getLev(wrkMast.getLocNo()));
+            if (liftStaProtocol == null) {
+                continue;//绔欑偣涓嶅瓨鍦�
+            }
+
+            // 鍒ゆ柇鏄惁婊¤冻鍏ュ簱鏉′欢锛岃嚜鍔ㄣ�佺┖闂层�佹湁鐗�
+            if (!(liftStaProtocol.getModel() && !liftStaProtocol.getBusy() && liftStaProtocol.getHasTray())) {
+                continue;
+            }
+
+            boolean step1 = this.shuttleInExecuteStep1(wrkMast, liftStaProtocol);//灏忚溅鎼叆搴撲腑
+            if (!step1) {
+                continue;
+            }
+        }
+
+
+
+
         // 鏍规嵁杈撻�佺嚎plc閬嶅巻
         for (DevpSlave devp : slaveProperties.getDevp()) {
             // 閬嶅巻鍏ュ簱绔�
@@ -688,30 +716,64 @@
                     continue;
                 }
 
-                WrkMast wrkMast = wrkMastMapper.selectRackInStep4(workNo, staProtocol.getSiteId());
-                if (wrkMast == null) {
-                    continue;
-                }
 
-                boolean step1 = this.shuttleInExecuteStep1(wrkMast, basDevp);//灏忚溅鎼叆搴撲腑
-                if (!step1) {
-                    continue;
-                }
 
             }
         }
 
     }
 
+//    /**
+//     * 鍏ュ簱  ===>>  鍥涘悜绌挎杞﹀叆搴撲綔涓氫笅鍙�
+//     */
+//    public synchronized void shuttleInExecute() {
+//        // 鏍规嵁杈撻�佺嚎plc閬嶅巻
+//        for (DevpSlave devp : slaveProperties.getDevp()) {
+//            // 閬嶅巻鍏ュ簱绔�
+//            for (DevpSlave.StaRack staRack : devp.getRackInStn()) {
+//                // 鑾峰彇鍏ュ簱绔欎俊鎭�
+//                DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
+//                StaProtocol staProtocol = devpThread.getStation().get(staRack.getStaNo());
+//                if (staProtocol == null) {
+//                    continue;
+//                } else {
+//                    staProtocol = staProtocol.clone();
+//                }
+//                Short workNo = staProtocol.getWorkNo();
+//                BasDevp basDevp = basDevpService.selectById(staProtocol.getSiteId());
+//                if (basDevp == null) {
+//                    continue;//绔欑偣淇℃伅涓嶅瓨鍦�
+//                }
+//
+//                // 鍒ゆ柇鏄惁婊¤冻鍏ュ簱鏉′欢锛岃嚜鍔ㄣ�佹湁鐗┿�佸洓鍚戠┛姊溅鍙彇淇″彿
+//                if (!(staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isShuttleTakeEnable())) {
+//                    continue;
+//                }
+//
+//                WrkMast wrkMast = wrkMastMapper.selectRackInStep4(workNo, staProtocol.getSiteId());
+//                if (wrkMast == null) {
+//                    continue;
+//                }
+//
+//                boolean step1 = this.shuttleInExecuteStep1(wrkMast, basDevp);//灏忚溅鎼叆搴撲腑
+//                if (!step1) {
+//                    continue;
+//                }
+//
+//            }
+//        }
+//
+//    }
+
     /**
      * 鍏ュ簱-灏忚溅鎼叆搴撲腑
      * 濡傞渶涓绘柟娉曟墽琛宑ontinue锛岃杩斿洖false
      * ps:杩斿洖鍊紅rue骞朵笉浠h〃璇ユ柟娉曟墽琛屾垚鍔燂紝杩斿洖鍊间粎鍋氭爣璁扮敤浜庝富鏂规硶鏄惁鎵цcontinue
      */
-    public boolean shuttleInExecuteStep1(WrkMast wrkMast, BasDevp basDevp) {
+    public boolean shuttleInExecuteStep1(WrkMast wrkMast, LiftStaProtocol liftStaProtocol) {
         if (wrkMast.getWrkSts() == 4) {
             if (wrkMast.getShuttleNo() == null) {//娌℃湁缁戝畾灏忚溅锛岃繘琛岃皟搴�
-                shuttleDispatchUtils.dispatchShuttle(wrkMast.getWrkNo(), basDevp.getLocNo());//璋冨害灏忚溅鍒拌揣鐗╂墍鍦ㄨ緭閫佺珯鐐硅繘琛屽彇璐�
+                shuttleDispatchUtils.dispatchShuttle(wrkMast.getWrkNo(), liftStaProtocol.getLocNo());//璋冨害灏忚溅鍒拌揣鐗╂墍鍦ㄨ緭閫佺珯鐐硅繘琛屽彇璐�
                 return false;
             }
 
@@ -733,14 +795,14 @@
             }
 
             //鍒ゆ柇灏忚溅鏄惁鍒拌揪杈撻�佺珯鐐瑰簱浣�
-            if (!shuttleProtocol.getCurrentLocNo().equals(basDevp.getLocNo())) {
+            if (!shuttleProtocol.getCurrentLocNo().equals(liftStaProtocol.getLocNo())) {
                 //灏忚溅涓嶅湪杈撻�佺珯鐐逛綅缃�
-                shuttleDispatchUtils.dispatchShuttle(wrkMast.getWrkNo(), basDevp.getLocNo(), wrkMast.getShuttleNo());//璋冨害灏忚溅鍒拌揣鐗╂墍鍦ㄨ緭閫佺珯鐐硅繘琛屽彇璐�
+                shuttleDispatchUtils.dispatchShuttle(wrkMast.getWrkNo(), liftStaProtocol.getLocNo(), wrkMast.getShuttleNo());//璋冨害灏忚溅鍒拌揣鐗╂墍鍦ㄨ緭閫佺珯鐐硅繘琛屽彇璐�
                 return false;
             }
 
             //灏忚溅宸叉姷杈捐緭閫佺珯鐐逛綅缃紝杩涜鎼繍璐х墿
-            NyShuttleOperaResult result = NyShuttleOperaUtils.getShuttleTransportCommands(wrkMast.getShuttleNo(), wrkMast.getWrkNo(), shuttleProtocol.getCurrentLocNo(), basDevp.getLocNo(), wrkMast.getLocNo());
+            NyShuttleOperaResult result = NyShuttleOperaUtils.getShuttleTransportCommands(wrkMast.getShuttleNo(), wrkMast.getWrkNo(), shuttleProtocol.getCurrentLocNo(), wrkMast.getLocNo());
             if (result == null) {//璺緞璁$畻澶辫触
                 return false;
             }
@@ -805,26 +867,15 @@
                 return false;//鍑哄簱绔欑偣涓嶅彲鍑�
             }
 
-            //鍒ゆ柇鍚勬ゼ灞傚唴閮ㄨ緭閫佺珯鐐规槸鍚︾┖闂叉棤鐗�
-            LiftThread liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, basDevp.getLiftNo());
-            if (liftThread == null) {
-                return false;
-            }
-            //鑾峰彇鎻愬崌鏈虹珯鐐筶ist
-            List<LiftStaProtocol> liftStaProtocols = liftThread.getLiftStaProtocols();
-            if (liftStaProtocols.isEmpty()) {
-                return false;
+            //鑾峰彇婧愮珯
+            LiftStaProtocol liftStaProtocol = NyLiftUtils.getLiftStaByLev(basDevp.getLiftNo(), Utils.getLev(wrkMast.getSourceLocNo()));
+            if (liftStaProtocol == null) {
+                return false;//鎵句笉鍒扮珯鐐�
             }
 
-            for (LiftStaProtocol liftStaProtocol : liftStaProtocols) {
-                //鍒ゆ柇褰撳墠鍑哄簱浠诲姟瀵瑰簲妤煎眰鐨勬彁鍗囨満绔欑偣鐘舵��
-                if (liftStaProtocol.getLev() == Utils.getLev(wrkMast.getSourceLocNo())) {
-                    if (liftStaProtocol.getModel() && !liftStaProtocol.getBusy() && !liftStaProtocol.getHasTray()) {
-                        return false;//绔欑偣蹇呴』鑷姩銆佺┖闂层�佹病鏈夋墭鐩�
-                    }
-                }
+            if (liftStaProtocol.getModel() && !liftStaProtocol.getBusy() && !liftStaProtocol.getHasTray()) {
+                return false;//绔欑偣蹇呴』鑷姩銆佺┖闂层�佹病鏈夋墭鐩�
             }
-
 
             if (wrkMast.getShuttleNo() == null) {//娌℃湁缁戝畾灏忚溅锛岃繘琛岃皟搴�
                 shuttleDispatchUtils.dispatchShuttle(wrkMast.getWrkNo(), wrkMast.getSourceLocNo());//璋冨害灏忚溅鍒拌揣鐗╂墍鍦ㄥ簱浣嶈繘琛屽彇璐�
@@ -851,12 +902,12 @@
             //鍒ゆ柇灏忚溅鏄惁鍒拌揪璐х墿搴撲綅
             if (!shuttleProtocol.getCurrentLocNo().equals(wrkMast.getSourceLocNo())) {
                 //灏忚溅涓嶅湪杈撻�佺珯鐐逛綅缃�
-                shuttleDispatchUtils.dispatchShuttle(wrkMast.getWrkNo(), wrkMast.getSourceLocNo(), wrkMast.getShuttleNo());//璋冨害灏忚溅鍒拌揣鐗╂墍鍦ㄨ緭閫佺珯鐐硅繘琛屽彇璐�
+                shuttleDispatchUtils.dispatchShuttle(wrkMast.getWrkNo(), wrkMast.getSourceLocNo(), wrkMast.getShuttleNo());//璋冨害灏忚溅鍒拌揣鐗╂墍鍦ㄥ簱浣嶈繘琛屽彇璐�
                 return false;
             }
 
             //灏忚溅宸叉姷杈捐揣鐗╀綅缃紝杩涜鎼繍璐х墿
-            NyShuttleOperaResult result = NyShuttleOperaUtils.getShuttleTransportCommands(wrkMast.getShuttleNo(), wrkMast.getWrkNo(), shuttleProtocol.getCurrentLocNo(), wrkMast.getSourceLocNo(), null);
+            NyShuttleOperaResult result = NyShuttleOperaUtils.getShuttleTransportCommands(wrkMast.getShuttleNo(), wrkMast.getWrkNo(), wrkMast.getSourceLocNo(), liftStaProtocol.getLocNo());//灏嗚揣鐗╂惉杩愯嚦鎻愬崌鏈鸿緭閫佺珯鐐�
             if (result == null) {//鍑哄簱璺緞璁$畻澶辫触
                 return false;
             }
@@ -1047,7 +1098,17 @@
 
         //2.璁惧涓婅蛋 ==> 3.鎻愬崌鏈烘惉杩愪腑
         if (wrkMast.getWrkSts() == 2) {
-            LiftThread liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, wrkMast.getLiftNo());
+            //鑾峰彇婧愮珯
+            BasDevp sourceBasDevp = basDevpService.selectById(wrkMast.getSourceStaNo());
+            if (sourceBasDevp == null) {
+                return false;//鎵句笉鍒扮珯鐐�
+            }
+
+            if (!sourceBasDevp.getInEnable().equals("Y")) {
+                return false;//绔欑偣涓嶅彲鍏�
+            }
+
+            LiftThread liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, sourceBasDevp.getLiftNo());
             if (liftThread == null) {
                 return false;
             }
@@ -1055,37 +1116,38 @@
             if (liftProtocol == null) {
                 return false;
             }
-            if (!liftProtocol.isIdle(wrkMast.getWrkNo().shortValue())) {
+            if (!liftProtocol.isIdle()) {
                 return false;
             }
             //鍒ゆ柇鎻愬崌鏈轰护鐗屾槸鍚︽湭琚崰棰�
             if (liftProtocol.getToken() != 0) {
                 return false;//鎻愬崌鏈哄凡琚嫭鍗狅紝绂佹鍐嶆淳鍙戜换鍔�
             }
+
+            //鍒ゆ柇鎻愬崌鏈哄唴鏄惁鏈夊皬杞�
+            if (liftProtocol.getHasCar()) {
+                return false;//鏈夊皬杞︼紝绂佹娲惧彂
+            }
+
+            //鍒ゆ柇鎻愬崌鏈哄唴鏄惁鏈夋墭鐩�
+            if (liftProtocol.getHasTray()) {
+                return false;//鏈夋墭鐩橈紝绂佹娲惧彂
+            }
+
             //鍒ゆ柇鎻愬崌鏈烘槸鍚︽湁鍏朵粬浠诲姟
             WrkMast liftWrkMast = wrkMastMapper.selectLiftWrkMast(liftThread.getSlave().getId());
             if (liftWrkMast != null) {
                 return false;//褰撳墠鎻愬崌鏈哄瓨鍦ㄦ湭瀹屾垚浠诲姟锛岀瓑寰呬笅涓�娆¤疆璇�
             }
 
-            //鑾峰彇婧愮珯瀵瑰簲鐨勮緭閫佺珯鐐�
-            BasDevp sourceBasDevp = basDevpService.selectById(wrkMast.getSourceStaNo());
-            if (sourceBasDevp == null) {
-                return false;//绔欑偣涓嶅瓨鍦�
-            }
             //鑾峰彇婧愮珯瀵瑰簲鐨勭墰鐪兼彁鍗囨満绔欑偣缂栧彿(璧风偣缂栧彿)
             Integer startSta = Integer.parseInt(sourceBasDevp.getQrCodeValue());
-            Integer targetSta = null;
-            //鑾峰彇鐗涚溂鎻愬崌鏈虹珯鐐圭紪鍙�(鐩爣缂栧彿)
-            for (LiftStaProtocol liftStaProtocol : liftThread.getLiftStaProtocols()) {
-                if (liftStaProtocol.getLev() == Utils.getLev(wrkMast.getLocNo())) {
-                    targetSta = liftStaProtocol.getStaNo();
-                }
+            //鑾峰彇鎻愬崌鏈虹珯鐐�
+            LiftStaProtocol targetStaProtocol = NyLiftUtils.getLiftStaByLev(liftThread.getSlave().getId(), Utils.getLev(wrkMast.getLocNo()));
+            if (targetStaProtocol == null) {
+                return false;//绔欑偣涓嶅瓨鍦�
             }
-
-            if (targetSta == null) {
-                return false;//绔欑偣缂栧彿涓嶅瓨鍦�
-            }
+            Integer targetSta = targetStaProtocol.getStaNo();
 
             //鑾峰彇鎻愬崌鏈哄懡浠�
             NyLiftCommand liftCommand = NyLiftUtils.getLiftCommand(liftProtocol.getLiftNo().intValue(), NyLiftTaskModelType.MOVE_TRAY.id, startSta, targetSta, wrkMast.getWrkNo());
@@ -1124,7 +1186,17 @@
 
         //23.灏忚溅鎼繍瀹屾垚 ==> 24.鎻愬崌鏈烘惉杩愪腑
         if (wrkMast.getWrkSts() == 23) {
-            LiftThread liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, wrkMast.getLiftNo());
+            //鑾峰彇鍑哄簱绔欑偣(鐩爣绔�)
+            BasDevp basDevp = basDevpService.selectById(wrkMast.getStaNo());
+            if (basDevp == null) {
+                return false;//鍑哄簱绔欑偣涓嶅瓨鍦�
+            }
+
+            if (!basDevp.getOutEnable().equals("Y")) {
+                return false;//鍑哄簱绔欑偣涓嶅彲鍑�
+            }
+
+            LiftThread liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, basDevp.getLiftNo());
             if (liftThread == null) {
                 return false;
             }
@@ -1132,7 +1204,7 @@
             if (liftProtocol == null) {
                 return false;
             }
-            if (!liftProtocol.isIdle(wrkMast.getWrkNo().shortValue())) {
+            if (!liftProtocol.isIdle()) {
                 return false;
             }
             //鍒ゆ柇鎻愬崌鏈轰护鐗屾槸鍚︽湭琚崰棰�
@@ -1146,16 +1218,11 @@
             }
 
             //鑾峰彇婧愮珯瀵瑰簲鐨勭墰鐪兼彁鍗囨満绔欑偣缂栧彿(璧风偣缂栧彿)
-            Integer startSta = null;
-            for (LiftStaProtocol liftStaProtocol : liftThread.getLiftStaProtocols()) {
-                if (liftStaProtocol.getLev() == Utils.getLev(wrkMast.getLocNo())) {
-                    startSta = liftStaProtocol.getStaNo();
-                }
+            LiftStaProtocol liftStaProtocol = NyLiftUtils.getLiftStaByLev(liftThread.getSlave().getId(), Utils.getLev(wrkMast.getSourceLocNo()));
+            if (liftStaProtocol == null) {
+                return false;//鎵句笉鍒扮珯鐐�
             }
-
-            if (startSta == null) {
-                return false;//绔欑偣缂栧彿涓嶅瓨鍦�
-            }
+            Integer startSta = liftStaProtocol.getStaNo();
 
             //鑾风洰鏍囩珯婧愮珯瀵瑰簲鐨勮緭閫佺珯鐐�
             BasDevp targetBasDevp = basDevpService.selectById(wrkMast.getStaNo());
@@ -1166,7 +1233,7 @@
             Integer targetSta = Integer.parseInt(targetBasDevp.getQrCodeValue());
 
             //鑾峰彇鎻愬崌鏈哄懡浠�
-            NyLiftCommand liftCommand = NyLiftUtils.getLiftCommand(liftProtocol.getLiftNo().intValue(), NyLiftTaskModelType.MOVE_TRAY.id, startSta, targetSta, wrkMast.getWrkNo());
+            NyLiftCommand liftCommand = NyLiftUtils.getLiftCommand(liftThread.getSlave().getId(), NyLiftTaskModelType.MOVE_TRAY.id, startSta, targetSta, wrkMast.getWrkNo());
 
             ArrayList<NyLiftCommand> commands = new ArrayList<>();
             commands.add(liftCommand);
@@ -1327,7 +1394,7 @@
             }
 
             //灏忚溅宸叉姷杈炬簮搴撲綅锛岃繘琛屾惉杩愯揣鐗�
-            NyShuttleOperaResult result = NyShuttleOperaUtils.getShuttleTransportCommands(wrkMast.getShuttleNo(), wrkMast.getWrkNo(), shuttleProtocol.getCurrentLocNo(), wrkMast.getSourceLocNo(), wrkMast.getLocNo());
+            NyShuttleOperaResult result = NyShuttleOperaUtils.getShuttleTransportCommands(wrkMast.getShuttleNo(), wrkMast.getWrkNo(), wrkMast.getSourceLocNo(), wrkMast.getLocNo());
             if (result == null) {//璺緞璁$畻澶辫触
                 return false;
             }
@@ -1396,7 +1463,7 @@
             Integer staNo = liftSta.getLiftNo() * 100 + Utils.getLev(wrkMast.getLocNo());//鐩爣绔�
 
             //灏忚溅宸叉姷杈炬簮搴撲綅锛屽皢璐х墿鎼繍鍒拌緭閫佺珯鐐�
-            NyShuttleOperaResult result = NyShuttleOperaUtils.getShuttleTransportCommands(wrkMast.getShuttleNo(), wrkMast.getWrkNo(), shuttleProtocol.getCurrentLocNo(), wrkMast.getSourceLocNo(), liftSta.getLocNo());
+            NyShuttleOperaResult result = NyShuttleOperaUtils.getShuttleTransportCommands(wrkMast.getShuttleNo(), wrkMast.getWrkNo(), wrkMast.getSourceLocNo(), liftSta.getLocNo());
             if (result == null) {//璺緞璁$畻澶辫触
                 return false;
             }
@@ -1487,7 +1554,7 @@
     }
 
     /**
-     * 璺ㄦゼ灞傚簱浣嶇Щ杞�-璋冨害杞﹁締鍙栬揣骞惰繍閫佸埌鐩爣鏋悗
+     * 璺ㄦゼ灞傚簱浣嶇Щ杞�-璋冨害杞﹁締鍙栬揣骞惰繍閫佸埌鐩爣搴撲綅
      * 濡傞渶涓绘柟娉曟墽琛宑ontinue锛岃杩斿洖false
      * ps:杩斿洖鍊紅rue骞朵笉浠h〃璇ユ柟娉曟墽琛屾垚鍔燂紝杩斿洖鍊间粎鍋氭爣璁扮敤浜庝富鏂规硶鏄惁鎵цcontinue
      */
@@ -1525,7 +1592,7 @@
             }
 
             //灏忚溅宸叉姷杈剧洰鏍囪緭閫佺珯鐐癸紝灏嗚揣鐗╂惉杩愬埌鐩爣搴撲綅
-            NyShuttleOperaResult result = NyShuttleOperaUtils.getShuttleTransportCommands(wrkMast.getShuttleNo(), wrkMast.getWrkNo(), shuttleProtocol.getCurrentLocNo(), targetBasDevp.getLocNo(), wrkMast.getLocNo());
+            NyShuttleOperaResult result = NyShuttleOperaUtils.getShuttleTransportCommands(wrkMast.getShuttleNo(), wrkMast.getWrkNo(), targetBasDevp.getLocNo(), wrkMast.getLocNo());
             if (result == null) {//璺緞璁$畻澶辫触
                 return false;
             }
diff --git a/src/main/java/com/zy/common/utils/NyShuttleOperaUtils.java b/src/main/java/com/zy/common/utils/NyShuttleOperaUtils.java
index bd0d0e6..cc59243 100644
--- a/src/main/java/com/zy/common/utils/NyShuttleOperaUtils.java
+++ b/src/main/java/com/zy/common/utils/NyShuttleOperaUtils.java
@@ -19,6 +19,34 @@
      * @param shuttleNo 灏忚溅鍙�
      * @param wrkNo 宸ヤ綔鍙�
      * @param startPoint 璧风偣锛堝皬杞﹀綋鍓嶄綅缃級
+     * @param targetPoint 鐩爣鐐癸紙璐х墿鐩爣浣嶇疆锛�
+     */
+    public static NyShuttleOperaResult getShuttleTransportCommands(Integer shuttleNo, Integer wrkNo, String startPoint, String targetPoint) {
+        //琛岃蛋璺緞
+        ArrayList<NavigateNode> nodes = new ArrayList<>();
+        //鍛戒护闆嗗悎
+        ArrayList<NyShuttleHttpCommand> commands = new ArrayList<>();
+
+        //璁$畻璧风偣鍒扮洰鏍囩偣鍛戒护
+        NyShuttleOperaResult result = getStartToTargetCommands(shuttleNo, wrkNo, startPoint, targetPoint);
+        if (result == null) {
+            //璁$畻缁撴灉蹇呴』涓嶄负绌猴紝鍚﹀垯璁$畻澶辫触
+            return null;
+        }
+        nodes.addAll(result.getNodes());
+        //璧风偣浣嶇疆涓嬪彂涓�鏉¢《鍗囧懡浠ゅ皢璐х墿杩涜鎼繍
+        commands.add(NyHttpUtils.getPalletLiftCommand(shuttleNo, wrkNo, true));
+        commands.addAll(result.getCommands());//璧风偣鍒扮洰鏍囩偣绉诲姩鍛戒护
+        //褰撳皬杞﹁璧板埌鐩爣鐐瑰悗锛岄渶瑕佷笅鍙戜竴鏉′笅闄嶅懡浠ゅ皢璐х墿鏀剧疆
+        commands.add(NyHttpUtils.getPalletLiftCommand(shuttleNo, wrkNo, false));
+        return result(commands, nodes);
+    }
+
+    /**
+     * 璁$畻骞惰幏鍙栧皬杞︿粠璧风偣鈥斺�斾腑闂寸偣鈥斺�旂洰鏍囩偣涔嬮棿鎼繍璐х墿鍔ㄤ綔鍛戒护
+     * @param shuttleNo 灏忚溅鍙�
+     * @param wrkNo 宸ヤ綔鍙�
+     * @param startPoint 璧风偣锛堝皬杞﹀綋鍓嶄綅缃級
      * @param middlePoint 涓棿鐐癸紙璐х墿浣嶇疆锛�
      * @param targetPoint 鐩爣鐐癸紙璐х墿鐩爣浣嶇疆锛�
      */
diff --git a/src/main/resources/mapper/WrkMastMapper.xml b/src/main/resources/mapper/WrkMastMapper.xml
index 0fa8d8a..36b1cc3 100644
--- a/src/main/resources/mapper/WrkMastMapper.xml
+++ b/src/main/resources/mapper/WrkMastMapper.xml
@@ -117,6 +117,15 @@
         order by io_pri desc,wrk_sts desc
     </select>
 
+    <select id="selectInStep4" resultMap="BaseResultMap">
+        select *
+        from dbo.asr_wrk_mast
+        where 1=1
+        and wrk_sts = 4
+        and io_type in (1,10,53)
+        order by io_pri desc,wrk_sts desc
+    </select>
+
     <select id="selectByWorkNo" resultMap="BaseResultMap">
         select top 1 * from dbo.asr_wrk_mast
         where wrk_no=#{workNo}
--
Gitblit v1.9.1