From a68bf17ab81df98882e19b79628e6876bb260468 Mon Sep 17 00:00:00 2001
From: zc <zc@123>
Date: 星期三, 18 六月 2025 10:04:26 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/fyxc_shuttle_wcs' into fyxc_shuttle_wcs

---
 src/main/java/com/zy/common/utils/ShuttleOperaUtils.java |   41 +++++++++++++++++++++++++++++++++++++++--
 1 files changed, 39 insertions(+), 2 deletions(-)

diff --git a/src/main/java/com/zy/common/utils/ShuttleOperaUtils.java b/src/main/java/com/zy/common/utils/ShuttleOperaUtils.java
index cba1a01..9451d91 100644
--- a/src/main/java/com/zy/common/utils/ShuttleOperaUtils.java
+++ b/src/main/java/com/zy/common/utils/ShuttleOperaUtils.java
@@ -44,15 +44,32 @@
         Integer shuttleNo = shuttleProtocol.getShuttleNo();
         //鑾峰彇灏忚溅绉诲姩閫熷害
         Integer runSpeed = Optional.ofNullable(basShuttleService.selectOne(new EntityWrapper<BasShuttle>().eq("shuttle_no", shuttleNo)).getRunSpeed()).orElse(1000);
-        List<NavigateNode> nodeList = navigateUtils.calc(startLocNo, endLocNo, mapType, Utils.getShuttlePoints(shuttleNo, Utils.getLev(startLocNo)), null);
+        List<NavigateNode> nodeList = navigateUtils.calc(startLocNo, endLocNo, mapType, Utils.getShuttlePoints(shuttleNo, Utils.getLev(startLocNo)), whites);
         if (nodeList == null) {
             News.error("{} dash {} can't find navigate path!", startLocNo, endLocNo);
+            shuttleThread.offerSystemMsg("{} dash {} can't find navigate path!", startLocNo, endLocNo);
             return null;
         }
 
         List<NavigateNode> allNode = new ArrayList<>();
+        List<NavigateNode> lockNode = new ArrayList<>();
         for (NavigateNode node : nodeList) {
             allNode.add(node.clone());
+
+            if (whites != null) {
+                boolean flag = false;
+                for (int[] white : whites) {
+                    if(white[0] == node.getX() && white[1] == node.getY()) {
+                        flag = true;
+                        break;
+                    }
+                }
+
+                if (flag) {//鐧藉悕鍗曡烦杩囬攣瀹�
+                    continue;
+                }
+            }
+            lockNode.add(node.clone());
         }
 
         List<ShuttleCommand> commands = new ArrayList<>();
@@ -78,6 +95,12 @@
 
         assignCommand.setNodes(allNode);//褰撳墠浠诲姟鎵�鍗犵敤鐨勮妭鐐筶ist
 
+        boolean result = navigateMapUtils.writeNavigateNodeToRedisMap(Utils.getLev(startLocNo), shuttleNo, lockNode, true);//閿佸畾璺緞
+        if (!result) {
+            News.error("{} dash {} can't lock path!", startLocNo, endLocNo);
+            shuttleThread.offerSystemMsg("{} dash {} can't lock path!", startLocNo, endLocNo);
+            return null;//璺緞閿佸畾澶辫触
+        }
         return commands;
     }
 
@@ -98,6 +121,7 @@
         boolean lockResult = navigateMapUtils.writeNavigateNodeToRedisMap(Utils.getLev(endLocNo), shuttleProtocol.getShuttleNo(), unlockPath, false);//鎵�浣跨敤鐨勮矾寰勮繘琛岃В閿�
         if (!lockResult) {
             News.error("{} dash {} can't find unlock path!", startLocNo, endLocNo);
+            shuttleThread.offerSystemMsg("{} dash {} can't find unlock path!", startLocNo, endLocNo);
             return null;//瑙i攣澶辫触
         }
 
@@ -106,6 +130,7 @@
         List<NavigateNode> nodeList = navigateUtils.calc(startLocNo, endLocNo, mapType, Utils.getShuttlePoints(shuttleNo, Utils.getLev(startLocNo)), null);
         if (nodeList == null) {
             News.error("{} dash {} can't find navigate path!", startLocNo, endLocNo);
+            shuttleThread.offerSystemMsg("{} dash {} can't find navigate path!", startLocNo, endLocNo);
             return null;
         }
 
@@ -143,7 +168,7 @@
     /**
      * 鑾峰彇鍏呯數鍛戒护
      */
-    public synchronized List<ShuttleCommand> shuttleChargeCommand(ShuttleAssignCommand assignCommand, ShuttleThread shuttleThread, Boolean openCharge) {
+    public synchronized List<ShuttleCommand> getShuttleChargeCommand(ShuttleAssignCommand assignCommand, ShuttleThread shuttleThread, Boolean openCharge) {
         List<ShuttleCommand> commands = new ArrayList<>();
 
         //鑾峰彇鍏呯數鍛戒护
@@ -152,6 +177,18 @@
         return commands;
     }
 
+    /**
+     * 鑾峰彇椤跺崌鍛戒护
+     */
+    public synchronized List<ShuttleCommand> getShuttleLiftCommand(ShuttleAssignCommand assignCommand, ShuttleThread shuttleThread, Boolean lift) {
+        List<ShuttleCommand> commands = new ArrayList<>();
+
+        //鑾峰彇椤跺崌鍛戒护
+        ShuttleCommand command = shuttleThread.getLiftCommand(assignCommand.getDeviceTaskNo(), lift);
+        commands.add(command);
+        return commands;
+    }
+
 //    private boolean checkSimilarityPath(Motion motion, ShuttleAssignCommand assignCommand) {
 //        String movePath = motion.getMovePath();
 //        if (Cools.isEmpty(movePath)) {

--
Gitblit v1.9.1