From 6e02d92c3b9c240fa78a343b67ddf0db12d840e6 Mon Sep 17 00:00:00 2001
From: Junjie <540245094@qq.com>
Date: 星期五, 22 八月 2025 17:00:56 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/common/utils/ShuttleOperaUtils.java |   43 +++++++++++++++++++++++++++++++++----------
 1 files changed, 33 insertions(+), 10 deletions(-)

diff --git a/src/main/java/com/zy/common/utils/ShuttleOperaUtils.java b/src/main/java/com/zy/common/utils/ShuttleOperaUtils.java
index 0b3fd1f..c7dbe39 100644
--- a/src/main/java/com/zy/common/utils/ShuttleOperaUtils.java
+++ b/src/main/java/com/zy/common/utils/ShuttleOperaUtils.java
@@ -51,10 +51,16 @@
     private DeviceConfigService deviceConfigService;
 
     public synchronized List<ShuttleCommand> getStartToTargetCommands(String startLocNo, String endLocNo, List<NavigationMapType> mapTypes, ShuttleAssignCommand assignCommand, ShuttleThread shuttleThread) {
-        return getStartToTargetCommands(startLocNo, endLocNo, mapTypes, null, assignCommand, shuttleThread);
+        return getStartToTargetCommands(startLocNo, endLocNo, mapTypes, null, assignCommand, shuttleThread, "move");
     }
 
-    public synchronized List<ShuttleCommand> getStartToTargetCommands(String startLocNo, String endLocNo, List<NavigationMapType> mapTypes, List<int[]> whites, ShuttleAssignCommand assignCommand, ShuttleThread shuttleThread) {
+    public synchronized List<ShuttleCommand> getStartToTargetCommands(String startLocNo, String endLocNo, List<NavigationMapType> mapTypes, ShuttleAssignCommand assignCommand, ShuttleThread shuttleThread, String moveType) {
+        return getStartToTargetCommands(startLocNo, endLocNo, mapTypes, null, assignCommand, shuttleThread, moveType);
+    }
+
+    public synchronized List<ShuttleCommand> getStartToTargetCommands(String startLocNo, String endLocNo, List<NavigationMapType> mapTypes, List<int[]> whites, ShuttleAssignCommand assignCommand, ShuttleThread shuttleThread, String moveType) {
+        long getStartTime = System.currentTimeMillis();
+
         ShuttleProtocol shuttleProtocol = shuttleThread.getStatus();
         if (shuttleProtocol == null) {
             return null;
@@ -77,7 +83,7 @@
             if (whites != null) {
                 boolean flag = false;
                 for (int[] white : whites) {
-                    if(white[0] == node.getX() && white[1] == node.getY()) {
+                    if (white[0] == node.getX() && white[1] == node.getY()) {
                         flag = true;
                         break;
                     }
@@ -95,9 +101,11 @@
         //鑾峰彇鍒嗘璺緞
         List<List<NavigateNode>> data = navigateUtils.getSectionPath(nodeList);
         long endTime = System.currentTimeMillis();
-        News.info("getSection path time:{}", (endTime - startTime));
+        News.info("[RCS Debug] getSection path time:{}", (endTime - startTime));
         //灏嗘瘡涓�娈佃矾寰勫垎鎴恈ommand鎸囦护
-        for (List<NavigateNode> nodes : data) {
+        for (int i = 0; i < data.size(); i++) {
+            List<NavigateNode> nodes = data.get(i);
+
             //寮�濮嬭矾寰�
             NavigateNode startPath = nodes.get(0);
 
@@ -110,6 +118,15 @@
             String distCodeNum = NavigatePositionConvert.xyToPosition(endPath.getX(), endPath.getY(), endPath.getZ());
             //鑾峰彇绉诲姩鍛戒护
             ShuttleCommand command = shuttleThread.getMoveCommand(assignCommand.getDeviceTaskNo(), startCodeNum, distCodeNum, allDistance, ShuttleRunDirection.get(startPath.getDirection()).id.intValue(), runSpeed, nodes);
+
+            if (i + 1 == data.size()) {
+                if (moveType.equals("inLift")) {
+                    command = shuttleThread.getMoveLiftCommand(assignCommand.getDeviceTaskNo(), startCodeNum, distCodeNum, allDistance, ShuttleRunDirection.get(startPath.getDirection()).id.intValue(), runSpeed, nodes, true);
+                }else if (moveType.equals("outLift")) {
+                    command = shuttleThread.getMoveLiftCommand(assignCommand.getDeviceTaskNo(), startCodeNum, distCodeNum, allDistance, ShuttleRunDirection.get(startPath.getDirection()).id.intValue(), runSpeed, nodes, false);
+                }
+            }
+
             command.setNodes(nodes);//灏嗚璧拌妭鐐规坊鍔犲埌姣忎竴姝ュ懡浠や腑
             commands.add(command);
         }
@@ -126,6 +143,8 @@
             }
         }
         assignCommand.setShuttleMoveCommandsContinuously(shuttleMoveCommandsContinuously);
+
+        News.info("{}浠诲姟锛寋}灏忚溅锛寋} - {} 璺緞鍛戒护鍖呰绠楁垚鍔燂紝鑰楁椂:{}ms", assignCommand.getTaskNo(), shuttleProtocol.getShuttleNo(), startLocNo, endLocNo, System.currentTimeMillis() - startTime);
         return commands;
     }
 
@@ -153,8 +172,11 @@
         return commands;
     }
 
-    //妫�娴嬮殰纰嶇墿杞�
-    public synchronized boolean checkObstacle(String locNo, List<Integer> whiteShuttles, List<NavigateNode> whiteNodes) {
+    /**
+     * 妫�娴嬮殰纰嶇墿杞�
+     * @return 0:鏃犻殰纰� 1:鏈夐殰纰嶈皟搴︽垚鍔� 2:鏈夐殰纰嶈皟搴﹀け璐�
+     */
+    public synchronized int checkObstacle(String locNo, List<Integer> whiteShuttles, List<NavigateNode> whiteNodes) {
         int innerCircle = 0;
         int outerCircle = 3;
         Config avoidInnerCircleConfig = configService.selectOne(new EntityWrapper<Config>().eq("code", "avoidInnerCircle"));
@@ -187,7 +209,7 @@
         List<NavigateNode> innerNodes = getInnerNodes(locNo, innerCircle, whiteShuttlePointList);
         List<Integer> nodesCar = findNodesCar(innerNodes);
         if (nodesCar.isEmpty()) {
-            return false;//鍐呭湀涓棤杞�
+            return 0;//鍐呭湀涓棤杞�
         }
 
         //鑾峰彇澶栧湀鑺傜偣
@@ -224,10 +246,11 @@
             if (targetLocNo == null) {
                 continue;
             }
-            shuttleDispatchUtils.dispatchShuttle(null, targetLocNo, shuttleNo);
+            boolean dispatched = shuttleDispatchUtils.dispatchShuttle(null, targetLocNo, shuttleNo);
+            return dispatched ? 1 : 2;
         }
 
-        return true;//鍐呭湀涓湁杞�
+        return 2;//鍐呭湀涓湁杞�
     }
 
     private HashMap<String, Integer> findCarMap() {

--
Gitblit v1.9.1