From 8a1f312d9f7842bb02c97b200e017926f0af63a5 Mon Sep 17 00:00:00 2001
From: Junjie <540245094@qq.com>
Date: 星期三, 17 九月 2025 14:48:08 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/utils/Utils.java |   46 ++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 44 insertions(+), 2 deletions(-)

diff --git a/src/main/java/com/zy/asrs/utils/Utils.java b/src/main/java/com/zy/asrs/utils/Utils.java
index 454a799..26132f4 100644
--- a/src/main/java/com/zy/asrs/utils/Utils.java
+++ b/src/main/java/com/zy/asrs/utils/Utils.java
@@ -1,5 +1,7 @@
 package com.zy.asrs.utils;
 
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.mapper.EntityWrapper;
 import com.core.common.Arith;
 import com.core.common.Cools;
@@ -84,7 +86,7 @@
         return null;
     }
 
-    //鑾峰彇闄ょ櫧鍚嶅崟澶栫殑鎸囧畾妤煎眰鍏ㄩ儴绌挎杞y鍧愭爣鐐�
+    //鑾峰彇绌挎杞y鍧愭爣鐐�
     public static int[] getShuttlePoint(Integer shuttleNo) {
         //鑾峰彇绌挎杞︽墍鍦ㄨ妭鐐逛綅缃�
         ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttleNo);
@@ -145,6 +147,34 @@
             list.add(xyPosition);
         }
         return list;
+    }
+
+    public static ShuttleThread searchShuttle(String locNo) {
+        DeviceConfigService deviceConfigService = SpringUtils.getBean(DeviceConfigService.class);
+        List<DeviceConfig> shuttleList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>()
+                .eq("device_type", String.valueOf(SlaveType.Shuttle)));
+        for (DeviceConfig device : shuttleList) {
+            //鑾峰彇绌挎杞︽墍鍦ㄨ妭鐐逛綅缃�
+            ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, device.getDeviceNo());
+            if (shuttleThread == null) {
+                continue;
+            }
+            ShuttleProtocol shuttleProtocol = shuttleThread.getStatus();
+            if (shuttleProtocol == null) {
+                continue;
+            }
+
+            String currentLocNo = shuttleProtocol.getCurrentLocNo();
+            if (currentLocNo == null) {
+                continue;
+            }
+
+            if (currentLocNo.equals(locNo)) {
+                return shuttleThread;
+            }
+        }
+
+        return null;
     }
 
     //妫�娴嬫ゼ灞傛槸鍚︽湁鍙敤绌挎杞�
@@ -252,7 +282,7 @@
         String recentLocNo = null;
         for (LocMast locMast : locMasts) {
             //寰呮満浣嶅埌鐩爣鐐硅窛绂�
-            List<NavigateNode> currentShuttlePath = navigateUtils.calc(locNo, locMast.getLocNo(), NavigationMapType.NORMAL.id, Utils.getShuttlePoints(0, Utils.getLev(locNo)), null);//鎼滅储绌洪棽绌挎杞︼紝浣跨敤姝e父閫氶亾鍦板浘
+            List<NavigateNode> currentShuttlePath = navigateUtils.calc(locNo, locMast.getLocNo(), NavigationMapType.getMapTypes(NavigationMapType.NORMAL), Utils.getShuttlePoints(0, Utils.getLev(locNo)), null);//鎼滅储绌洪棽绌挎杞︼紝浣跨敤姝e父閫氶亾鍦板浘
             if (currentShuttlePath == null) {
                 continue;
             }
@@ -265,4 +295,16 @@
 
         return recentLocNo;
     }
+
+    public static boolean isJSON(String value) {
+        try {
+            JSONObject jsonData = JSON.parseObject(value);
+            if (jsonData == null) {
+                return false;
+            }
+            return true;
+        } catch (Exception e) {
+            return false;
+        }
+    }
 }

--
Gitblit v1.9.1