From 73ce8bebcc5d14f3fb62a19ee677abfcdfc776b4 Mon Sep 17 00:00:00 2001
From: Junjie <540245094@qq.com>
Date: 星期六, 19 七月 2025 16:17:51 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/core/dispatcher/ShuttleDispatchUtils.java |   40 ++++++++++++++++++++++++++++++++++++----
 1 files changed, 36 insertions(+), 4 deletions(-)

diff --git a/src/main/java/com/zy/core/dispatcher/ShuttleDispatchUtils.java b/src/main/java/com/zy/core/dispatcher/ShuttleDispatchUtils.java
index 9062069..38e09c4 100644
--- a/src/main/java/com/zy/core/dispatcher/ShuttleDispatchUtils.java
+++ b/src/main/java/com/zy/core/dispatcher/ShuttleDispatchUtils.java
@@ -129,7 +129,7 @@
                 //褰撳墠绌挎杞﹀簱浣嶅彿
                 String currentLocNo = shuttleProtocol.getCurrentLocNo();
                 //褰撳墠绌挎杞︾嚎绋嬪埌鐩爣鍦扮偣璺濈
-                List<NavigateNode> currentShuttlePath = navigateUtils.calc(currentLocNo, locNo, NavigationMapType.NORMAL.id, Utils.getShuttlePoints(shuttleNo, Utils.getLev(currentLocNo)), null);//鎼滅储绌洪棽绌挎杞︼紝浣跨敤姝e父閫氶亾鍦板浘
+                List<NavigateNode> currentShuttlePath = navigateUtils.calc(currentLocNo, locNo, new ArrayList<NavigationMapType>(){{add(NavigationMapType.NORMAL);}}, Utils.getShuttlePoints(shuttleNo, Utils.getLev(currentLocNo)), null);//鎼滅储绌洪棽绌挎杞︼紝浣跨敤姝e父閫氶亾鍦板浘
                 if (currentShuttlePath == null) {
                     continue;
                 }
@@ -174,7 +174,7 @@
                     int currentLev = Utils.getLev(currentLocNo);
                     //鍒ゆ柇褰撳墠妤煎眰鏄惁鏈変换鍔★紝濡傛灉鏈夊垯涓嶅垎閰嶈繖杈嗚溅
                     List<WrkMast> wrkMasts1 = wrkMastService.selectWrkByLev(currentLev);
-                    int shuttleCount = this.getShuttleCountByLev(currentLev);//鑾峰彇绌挎杞︽ゼ灞傝溅杈嗘暟閲�
+                    int shuttleCount = this.getShuttleEnableUseCountByLev(currentLev);//鑾峰彇绌挎杞︽ゼ灞傝溅杈嗘暟閲�
                     if (!wrkMasts1.isEmpty() && shuttleCount <= 1) {
                         //瀛樺湪鍏朵粬浠诲姟涓斿彲鐢ㄥ皬杞︽暟閲忓皬浜庣瓑浜�1锛岃烦杩囪繖杈嗚溅
                         continue;
@@ -498,7 +498,7 @@
             String locNo = forkLiftStaProtocol.getLocNo();//绔欑偣搴撲綅鍙�
 
             //褰撳墠绌挎杞︾嚎绋嬪埌鐩爣鍦扮偣璺濈
-            List<NavigateNode> currentShuttlePath = navigateUtils.calc(currentLocNo, locNo, NavigationMapType.NORMAL.id, Utils.getShuttlePoints(shuttleNo, Utils.getLev(currentLocNo)), null);//浣跨敤姝e父閫氶亾鍦板浘
+            List<NavigateNode> currentShuttlePath = navigateUtils.calc(currentLocNo, locNo, NavigationMapType.getMapTypes(NavigationMapType.NORMAL), Utils.getShuttlePoints(shuttleNo, Utils.getLev(currentLocNo)), null);//浣跨敤姝e父閫氶亾鍦板浘
             if (currentShuttlePath == null) {
                 continue;
             }
@@ -528,7 +528,7 @@
     /**
      * 鑾峰彇妤煎眰鍙敤灏忚溅鏁伴噺
      */
-    public int getShuttleCountByLev(int lev) {
+    public int getShuttleEnableUseCountByLev(int lev) {
         List<DeviceConfig> shuttleList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>()
                 .eq("device_type", String.valueOf(SlaveType.Shuttle)));
         int count = 0;
@@ -561,4 +561,36 @@
         return count;
     }
 
+    /**
+     * 鑾峰彇妤煎眰灏忚溅鏁伴噺
+     */
+    public int getShuttleCountByLev(int lev) {
+        List<DeviceConfig> shuttleList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>()
+                .eq("device_type", String.valueOf(SlaveType.Shuttle)));
+        int count = 0;
+        for (DeviceConfig device : shuttleList) {
+            //鑾峰彇鍥涘悜绌挎杞︾嚎绋�
+            ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, device.getDeviceNo());
+            if (shuttleThread == null) {
+                continue;
+            }
+
+            ShuttleProtocol shuttleProtocol = shuttleThread.getStatus();
+            if (shuttleProtocol == null || shuttleProtocol.getShuttleNo() == null) {
+                continue;
+            }
+
+            if (shuttleProtocol.getCurrentLocNo() == null) {
+                continue;
+            }
+
+            if (Utils.getLev(shuttleProtocol.getCurrentLocNo()) == lev) {
+                //鍚屼竴妤煎眰鍙敤灏忚溅
+                count++;
+                continue;
+            }
+        }
+        return count;
+    }
+
 }

--
Gitblit v1.9.1