From 0089be186795036fe12ad2b5ef8dd81f602071a0 Mon Sep 17 00:00:00 2001
From: zhangc <zc@123>
Date: 星期日, 13 四月 2025 15:41:00 +0800
Subject: [PATCH] 1

---
 src/main/java/com/zy/core/dispatcher/ShuttleDispatchUtils.java |   30 +++++++++++++++++-------------
 1 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/src/main/java/com/zy/core/dispatcher/ShuttleDispatchUtils.java b/src/main/java/com/zy/core/dispatcher/ShuttleDispatchUtils.java
index 3c7c31d..34dcb90 100644
--- a/src/main/java/com/zy/core/dispatcher/ShuttleDispatchUtils.java
+++ b/src/main/java/com/zy/core/dispatcher/ShuttleDispatchUtils.java
@@ -14,21 +14,15 @@
 import com.zy.common.model.NavigateNode;
 import com.zy.common.model.enums.NavigationMapType;
 import com.zy.common.service.CommonService;
-import com.zy.common.utils.ForkLiftUtils;
-import com.zy.common.utils.LiftUtils;
 import com.zy.common.utils.NavigateUtils;
 import com.zy.core.News;
 import com.zy.core.cache.SlaveConnection;
 import com.zy.core.enums.SlaveType;
 import com.zy.core.enums.WrkIoType;
 import com.zy.core.enums.WrkStsType;
-import com.zy.core.model.ForkLiftSlave;
-import com.zy.core.model.LiftSlave;
 import com.zy.core.model.ShuttleSlave;
-import com.zy.core.model.protocol.*;
+import com.zy.core.model.protocol.ShuttleProtocol;
 import com.zy.core.properties.SlaveProperties;
-import com.zy.core.thread.ForkLiftThread;
-import com.zy.core.thread.LiftThread;
 import com.zy.core.thread.ShuttleThread;
 import com.zy.system.entity.Config;
 import com.zy.system.service.ConfigService;
@@ -74,7 +68,7 @@
     /**
      * 璋冨害杞﹁締
      */
-    public boolean dispatchShuttle(Integer wrkNo, String locNo) {
+    public boolean searchDispatchShuttle(Integer wrkNo, String sourceLocNo, String locNo, String flag) {
         ArrayList<ShuttleThread> sameLev = new ArrayList<>();//鐩稿悓妤煎眰鐨勭┛姊溅
         ArrayList<ShuttleThread> diffLev = new ArrayList<>();//涓嶅悓妤煎眰鐨勭┛姊溅
 
@@ -119,7 +113,7 @@
             if (currentLev == Utils.getLev(locNo)) {
                 //宸ヤ綔妗fゼ灞傜浉鍚岀殑绌挎杞�
                 sameLev.add(shuttleThread);
-            }else {
+            } else {
                 //宸ヤ綔妗d笉鍚屾ゼ灞傜殑绌挎杞�
                 diffLev.add(shuttleThread);
             }
@@ -134,6 +128,11 @@
                 Integer shuttleNo = shuttleProtocol.getShuttleNo();
                 //褰撳墠绌挎杞﹀簱浣嶅彿
                 String currentLocNo = shuttleProtocol.getCurrentLocNo();
+                if (currentLocNo.equals(locNo)) {
+                    sameShuttles.put(-1, shuttleThread);
+                    continue;
+                }
+
                 //褰撳墠绌挎杞︾嚎绋嬪埌鐩爣鍦扮偣璺濈
                 List<NavigateNode> currentShuttlePath = navigateUtils.calc(currentLocNo, locNo, NavigationMapType.NORMAL.id, Utils.getShuttlePoints(shuttleNo, Utils.getLev(currentLocNo)), null);//鎼滅储绌洪棽绌挎杞︼紝浣跨敤姝e父閫氶亾鍦板浘
                 if (currentShuttlePath == null) {
@@ -149,7 +148,7 @@
                 ShuttleProtocol shuttleProtocol = shuttleThread.getStatus();
                 Integer shuttleNo = shuttleProtocol.getShuttleNo();
                 //灏濊瘯璋冨害灏忚溅
-                boolean result = shuttleMoveGenerate(wrkNo, locNo, shuttleNo);
+                boolean result = shuttleMoveGenerate(wrkNo, sourceLocNo, locNo, shuttleNo, flag, false);
                 if (result) {
                     return true;//璋冨害鎴愬姛
                 }
@@ -196,7 +195,7 @@
                     ShuttleProtocol shuttleProtocol = shuttleThread.getStatus();
                     Integer shuttleNo = shuttleProtocol.getShuttleNo();
                     //灏濊瘯璋冨害灏忚溅
-                    boolean result = shuttleMoveGenerate(wrkNo, locNo, shuttleNo);
+                    boolean result = shuttleMoveGenerate(wrkNo, sourceLocNo, locNo, shuttleNo, flag, false);
                     if (result) {
                         return true;//璋冨害鎴愬姛
                     }
@@ -284,6 +283,12 @@
         wrkMast.setLocNo(locNo); // 鐩爣搴撲綅
         wrkMast.setAppeTime(now);
         wrkMast.setModiTime(now);
+        wrkMast.setMainWrkNo(mainWrkMast.getWrkNo());
+
+        if ("TRANSPORT_LIFT".equals(flag)) {
+            wrkMast.setMainWrkNo(wrkNo);
+        }
+
         boolean res = wrkMastService.insert(wrkMast);
         if (!res) {
             News.error("灏忚溅杩佺Щ --- 淇濆瓨宸ヤ綔妗eけ璐ワ紒 绌挎杞﹀彿锛�" + shuttleNo);
@@ -314,7 +319,7 @@
         List<ShuttleGatherResult> list = new ArrayList<>();
         for (BasShuttle basShuttle : basShuttles) {
             String idleLoc = basShuttle.getIdleLoc();
-            if(Cools.isEmpty(idleLoc)) {
+            if (Cools.isEmpty(idleLoc)) {
                 continue;
             }
 
@@ -395,7 +400,6 @@
 
         return levCount < Integer.parseInt(config.getValue());
     }
-
 
 
     /**

--
Gitblit v1.9.1