From 171206ad10f56e8ee795cc3d5ee7c5ad3980a105 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期五, 13 十月 2023 17:34:20 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/utils/Utils.java |   43 +++++++++++++++++--------------------------
 1 files changed, 17 insertions(+), 26 deletions(-)

diff --git a/src/main/java/com/zy/asrs/utils/Utils.java b/src/main/java/com/zy/asrs/utils/Utils.java
index b5e47fb..393f21e 100644
--- a/src/main/java/com/zy/asrs/utils/Utils.java
+++ b/src/main/java/com/zy/asrs/utils/Utils.java
@@ -4,7 +4,9 @@
 import com.core.common.Arith;
 import com.core.common.Cools;
 import com.core.common.SpringUtils;
+import com.zy.asrs.entity.BasShuttle;
 import com.zy.asrs.entity.LocMast;
+import com.zy.asrs.service.BasShuttleService;
 import com.zy.asrs.service.LocMastService;
 import com.zy.asrs.service.impl.MainServiceImpl;
 import com.zy.common.model.NavigateNode;
@@ -354,29 +356,6 @@
         return locNo;
     }
 
-    //妤煎眰杞崲瀵瑰簲鍑哄叆搴撶珯鐐瑰簱浣嶅彿
-    public static String levToOutInStaLocNo(Integer lev) {
-        String locNo = null;
-        if (lev >= 2) {
-            lev++;
-        }
-        switch (lev) {
-            case 1:
-                locNo = "1800201";
-                break;
-            case 3:
-                locNo = "1800202";
-                break;
-            case 4:
-                locNo = "1800203";
-                break;
-            case 5:
-                locNo = "1800204";
-                break;
-        }
-        return locNo;
-    }
-
     public static void main(String[] args) {
         System.out.println(JSON.toJSONString(getGroupOutsideLoc("0200101")));
     }
@@ -415,6 +394,7 @@
 
     //鑾峰彇闄ょ櫧鍚嶅崟澶栫殑鎸囧畾妤煎眰鍏ㄩ儴绌挎杞y鍧愭爣鐐�
     public static List<int[]> getShuttlePoints(Integer whiteShuttle, Integer lev) {
+        BasShuttleService basShuttleService = SpringUtils.getBean(BasShuttleService.class);
         SlaveProperties slaveProperties = SpringUtils.getBean(SlaveProperties.class);
         ArrayList<int[]> list = new ArrayList<>();
         for (ShuttleSlave slave : slaveProperties.getShuttle()) {
@@ -432,14 +412,25 @@
                 continue;
             }
 
-            if (shuttleProtocol.getCurrentLocNo() == null) {
-                continue;
+            String currentLocNo = shuttleProtocol.getCurrentLocNo();
+
+            if (currentLocNo == null) {
+                //灏忚溅娌℃湁搴撲綅鍙锋暟鎹紝浠庢暟鎹簱涓彇
+                BasShuttle basShuttle = basShuttleService.selectById(slave.getId());
+                if (basShuttle == null || basShuttle.getPoint() == null) {
+                    continue;
+                }
+                NyShuttleProtocol.NyShuttlePointClass shuttlePoint = JSON.parseObject(basShuttle.getPoint(), NyShuttleProtocol.NyShuttlePointClass.class);
+                currentLocNo = NavigatePositionConvert.nyXyzToLocNo(shuttlePoint.getX(), shuttlePoint.getY(), shuttlePoint.getZ());
             }
 
-            if (lev != Utils.getLev(shuttleProtocol.getCurrentLocNo())) {
+            if (lev != Utils.getLev(currentLocNo)) {
                 continue;//妤煎眰涓嶅悓
             }
 
+            if (shuttleProtocol.getCurrentLocNo() == null) {
+                continue;
+            }
             int[] xyPosition = NavigatePositionConvert.positionToXY(shuttleProtocol.getCurrentLocNo());//閫氳繃搴撲綅鍙疯幏鍙杧y鍧愭爣
             list.add(xyPosition);
         }

--
Gitblit v1.9.1