From 5bd42df0ef1bcdbc3911381274b4f3f267d0203b Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期三, 13 八月 2025 09:45:59 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/shuttle_rcs_dev' into shuttle_rcs_dev

---
 src/main/java/com/zy/core/thread/impl/NyShuttleThread.java  |   60 +++++++++++++++++++++++++++++-
 src/main/java/com/zy/common/utils/ShuttleOperaUtils.java    |   23 +++++++++--
 src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java |    2 
 src/main/java/com/zy/core/thread/ShuttleThread.java         |    2 +
 4 files changed, 80 insertions(+), 7 deletions(-)

diff --git a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
index 09cefc6..2d0c45f 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -1653,7 +1653,7 @@
             assignCommand.setAuto(true);//鑷姩妯″紡
 
             //鑾峰彇灏忚溅鍒版彁鍗囨満琛岃蛋鍛戒护
-            List<ShuttleCommand> commands = shuttleOperaUtils.getStartToTargetCommands(shuttleProtocol.getCurrentLocNo(), liftThread.getCurrentLocNo(), NavigationMapType.getNormalWithDevice(), assignCommand, shuttleThread);
+            List<ShuttleCommand> commands = shuttleOperaUtils.getStartToTargetCommands(shuttleProtocol.getCurrentLocNo(), liftThread.getCurrentLocNo(), NavigationMapType.getNormalWithDevice(), assignCommand, shuttleThread, "inLift");
             if (commands == null) {
                 News.taskInfo(wrkMast.getWrkNo(), "{}浠诲姟锛寋}灏忚溅锛岃矾寰勮绠楀け璐�", wrkMast.getWrkNo(), shuttleProtocol.getShuttleNo());
                 return false;//璺緞瑙i攣澶辫触
diff --git a/src/main/java/com/zy/common/utils/ShuttleOperaUtils.java b/src/main/java/com/zy/common/utils/ShuttleOperaUtils.java
index 0b3fd1f..db9ab33 100644
--- a/src/main/java/com/zy/common/utils/ShuttleOperaUtils.java
+++ b/src/main/java/com/zy/common/utils/ShuttleOperaUtils.java
@@ -51,10 +51,14 @@
     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) {
         ShuttleProtocol shuttleProtocol = shuttleThread.getStatus();
         if (shuttleProtocol == null) {
             return null;
@@ -77,7 +81,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;
                     }
@@ -97,7 +101,9 @@
         long endTime = System.currentTimeMillis();
         News.info("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 +116,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);
         }
diff --git a/src/main/java/com/zy/core/thread/ShuttleThread.java b/src/main/java/com/zy/core/thread/ShuttleThread.java
index 060e27d..228afb4 100644
--- a/src/main/java/com/zy/core/thread/ShuttleThread.java
+++ b/src/main/java/com/zy/core/thread/ShuttleThread.java
@@ -82,6 +82,8 @@
 
     ShuttleCommand getMoveCommand(Integer taskNo, String startCodeNum, String distCodeNum, Integer allDistance, Integer runDirection, Integer runSpeed, List<NavigateNode> nodes);//鑾峰彇绉诲姩鍛戒护
 
+    ShuttleCommand getMoveLiftCommand(Integer taskNo, String startCodeNum, String distCodeNum, Integer allDistance, Integer runDirection, Integer runSpeed, List<NavigateNode> nodes, Boolean moveIn);//鑾峰彇绉诲姩鍛戒护
+
     ShuttleCommand getLiftCommand(Integer taskNo, Boolean lift);//椤跺崌鍛戒护 true=>椤跺崌 false=>涓嬮檷
 
     ShuttleCommand getChargeCommand(Integer taskNo, Boolean charge);//鍏呯數寮�鍏冲懡浠� true=>寮� false=>鍏�
diff --git a/src/main/java/com/zy/core/thread/impl/NyShuttleThread.java b/src/main/java/com/zy/core/thread/impl/NyShuttleThread.java
index e311708..aba6db6 100644
--- a/src/main/java/com/zy/core/thread/impl/NyShuttleThread.java
+++ b/src/main/java/com/zy/core/thread/impl/NyShuttleThread.java
@@ -977,8 +977,64 @@
         HashMap<String, Object> body = new HashMap<>();
         body.put("requestType", "move");//绉诲姩鍛戒护
         body.put("taskId", taskId);//TaskID闇�瑕侀殢鏈�
-//        body.put("start", navigateNodeToNyPointNode(NavigatePositionConvert.codeToNode(startCodeNum, device.getHostId())));//璧风偣
-//        body.put("target", navigateNodeToNyPointNode(NavigatePositionConvert.codeToNode(distCodeNum, device.getHostId())));//缁堢偣
+        body.put("path", path);
+        request.setBody(body);
+
+        NavigateNode startNode = nodes.get(0);
+        for (NavigateNode node : nodes) {
+            HashMap<String, Object> data = new HashMap<>();
+            String codeNum = NavigatePositionConvert.xyToPosition(node.getX(), node.getY(), node.getZ());
+            Map<String, Object> nyNode = navigateNodeToNyPointNode(NavigatePositionConvert.codeToNode(codeNum));
+            int xp = Integer.parseInt(String.valueOf(nyNode.get("y")));
+            int yp = Integer.parseInt(String.valueOf(nyNode.get("x")));
+            int z = Integer.parseInt(String.valueOf(nyNode.get("z")));
+
+            List<List<MapNode>> mapData = navigateMapData.getJsonData(startNode.getZ(), NavigationMapType.getMapTypes(NavigationMapType.NONE), null, null);
+            List<MapNode> mapNodes = mapData.get(node.getX());
+            MapNode mapNode = mapNodes.get(node.getY());
+
+            data.put("xp", xp);
+            data.put("yp", yp);
+            data.put("z", z);
+            data.put("x", mapNode.getXBase());
+            data.put("y", mapNode.getYBase());
+            path.add(data);
+        }
+
+        httpStandard.setRequest(request);
+
+        LocMastService locMastService = SpringUtils.getBean(LocMastService.class);
+        LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>()
+                .eq("qr_code_value", distCodeNum));
+        if (locMast == null) {
+            throw new CoolException("搴撲綅淇℃伅涓嶅瓨鍦�");
+        }
+
+        ShuttleCommand command = new ShuttleCommand();
+        command.setShuttleNo(deviceConfig.getDeviceNo());
+        command.setBody(JSON.toJSONString(httpStandard));
+        command.setMode(ShuttleCommandModeType.MOVE.id);
+        command.setTargetLocNo(locMast.getLocNo());
+        command.setTaskNo(taskId);
+        return command;
+    }
+
+    @Override
+    public ShuttleCommand getMoveLiftCommand(Integer taskNo, String startCodeNum, String distCodeNum, Integer allDistance, Integer runDirection, Integer runSpeed, List<NavigateNode> nodes, Boolean moveIn) {
+        NavigateMapData navigateMapData = SpringUtils.getBean(NavigateMapData.class);
+        NyShuttleHttpCommand httpStandard = getHttpStandard(deviceConfig.getDeviceNo(), taskNo);
+        NyShuttleHttpCommand.NyRequest request = httpStandard.getRequest();
+
+        ArrayList<HashMap<String, Object>> path = new ArrayList<>();
+
+        Integer taskId = getTaskId();
+        HashMap<String, Object> body = new HashMap<>();
+        if (moveIn) {
+            body.put("requestType", "intoLift");//杩涙彁鍗囨満
+        }else {
+            body.put("requestType", "outLift");//鍑烘彁鍗囨満
+        }
+        body.put("taskId", taskId);//TaskID闇�瑕侀殢鏈�
         body.put("path", path);
         request.setBody(body);
 

--
Gitblit v1.9.1