From 9f6bae6e952b0b6836b539703f3418b0acc725d3 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期二, 19 九月 2023 08:25:00 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java |   53 ++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 40 insertions(+), 13 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 9df5453..01078e7 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -971,6 +971,11 @@
                 continue;
             }
 
+            //鍒ゆ柇鎻愬崌鏈轰护鐗屾槸鍚﹁鍗犵敤
+            if (liftProtocol.getToken() != 0) {
+                continue;
+            }
+
             //鎼滅储鏄惁鏈夊緟澶勭悊鐨勪换鍔�
             List<WrkMast> wrkMasts = wrkMastMapper.selectLiftStep223103();
             if (wrkMasts.isEmpty()) {
@@ -1032,15 +1037,25 @@
 
             //鑾峰彇婧愮珯瀵瑰簲鐨勮緭閫佺珯鐐�
             BasDevp sourceBasDevp = basDevpService.selectById(wrkMast.getSourceStaNo());
-            //鑾峰彇鐩爣绔欏搴旂殑杈撻�佺珯鐐�
-            BasDevp targetBasDevp = basDevpService.selectById(wrkMast.getStaNo());
-            if (sourceBasDevp == null || targetBasDevp == null) {
-                return false;//缂哄皯绔欑偣淇℃伅
+            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();
+                }
+            }
+
+            if (targetSta == null) {
+                return false;//绔欑偣缂栧彿涓嶅瓨鍦�
             }
 
             //鑾峰彇鎻愬崌鏈哄懡浠�
-            NyLiftCommand liftCommand = NyLiftUtils.getLiftCommand(liftProtocol.getLiftNo().intValue(), NyLiftTaskModelType.MOVE_TRAY.id, sourceBasDevp.getDevNo(), targetBasDevp.getDevNo(), wrkMast.getWrkNo());
-
+            NyLiftCommand liftCommand = NyLiftUtils.getLiftCommand(liftProtocol.getLiftNo().intValue(), NyLiftTaskModelType.MOVE_TRAY.id, startSta, targetSta, wrkMast.getWrkNo());
             ArrayList<NyLiftCommand> commands = new ArrayList<>();
             commands.add(liftCommand);
 
@@ -1097,16 +1112,28 @@
                 return false;//褰撳墠鎻愬崌鏈哄瓨鍦ㄦ湭瀹屾垚浠诲姟锛岀瓑寰呬笅涓�娆¤疆璇�
             }
 
-            //鑾峰彇婧愮珯瀵瑰簲鐨勮緭閫佺珯鐐�
-            BasDevp sourceBasDevp = basDevpService.selectByLevAndLiftNo(Utils.getLev(wrkMast.getSourceLocNo()), liftProtocol.getLiftNo().intValue());
-            //鑾峰彇鐩爣绔欏搴旂殑杈撻�佺珯鐐�
-            BasDevp targetBasDevp = basDevpService.selectById(wrkMast.getSourceStaNo());
-            if (sourceBasDevp == null || targetBasDevp == null) {
-                return false;//缂哄皯绔欑偣淇℃伅
+            //鑾峰彇婧愮珯瀵瑰簲鐨勭墰鐪兼彁鍗囨満绔欑偣缂栧彿(璧风偣缂栧彿)
+            Integer startSta = null;
+            for (LiftStaProtocol liftStaProtocol : liftThread.getLiftStaProtocols()) {
+                if (liftStaProtocol.getLev() == Utils.getLev(wrkMast.getLocNo())) {
+                    startSta = liftStaProtocol.getStaNo();
+                }
             }
 
+            if (startSta == null) {
+                return false;//绔欑偣缂栧彿涓嶅瓨鍦�
+            }
+
+            //鑾风洰鏍囩珯婧愮珯瀵瑰簲鐨勮緭閫佺珯鐐�
+            BasDevp targetBasDevp = basDevpService.selectById(wrkMast.getStaNo());
+            if (targetBasDevp == null) {
+                return false;//绔欑偣涓嶅瓨鍦�
+            }
+            //鑾峰彇鐗涚溂鎻愬崌鏈虹珯鐐圭紪鍙�(鐩爣缂栧彿)
+            Integer targetSta = Integer.parseInt(targetBasDevp.getQrCodeValue());
+
             //鑾峰彇鎻愬崌鏈哄懡浠�
-            NyLiftCommand liftCommand = NyLiftUtils.getLiftCommand(liftProtocol.getLiftNo().intValue(), NyLiftTaskModelType.MOVE_TRAY.id, sourceBasDevp.getDevNo(), targetBasDevp.getDevNo(), wrkMast.getWrkNo());
+            NyLiftCommand liftCommand = NyLiftUtils.getLiftCommand(liftProtocol.getLiftNo().intValue(), NyLiftTaskModelType.MOVE_TRAY.id, startSta, targetSta, wrkMast.getWrkNo());
 
             ArrayList<NyLiftCommand> commands = new ArrayList<>();
             commands.add(liftCommand);

--
Gitblit v1.9.1