From c036b0582e39b53516d88f26df587b5a61c4b2f2 Mon Sep 17 00:00:00 2001
From: Junjie <xjj@123>
Date: 星期三, 17 四月 2024 10:32:47 +0800
Subject: [PATCH] #

---
 zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/command/ShuttleCommandService.java |   47 ++++++++++++++++++++++++-----------------------
 1 files changed, 24 insertions(+), 23 deletions(-)

diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/command/ShuttleCommandService.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/command/ShuttleCommandService.java
index 33e9853..e799b7b 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/command/ShuttleCommandService.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/command/ShuttleCommandService.java
@@ -81,7 +81,8 @@
 
         ShuttleAssignCommand assignCommand = new ShuttleAssignCommand();
         assignCommand.setShuttleNo(deviceNo);
-        assignCommand.setTaskNo(motion.getWrkNo());
+        assignCommand.setTaskNo(motion.getTaskNo());
+        assignCommand.setDeviceTaskNo(shuttleThread.generateDeviceTaskNo(motion.getTaskNo(), MotionCtgType.get(motion.getMotionCtgEl())));
         assignCommand.setSourceLocNo(motion.getOrigin());
         assignCommand.setLocNo(motion.getTarget());
         assignCommand.setDeviceId(Integer.parseInt(motion.getDevice()));
@@ -106,12 +107,12 @@
             case SHUTTLE_MOVE_LIFT_PALLET://绌挎杞﹂《鍗囧苟绉诲姩
                 shuttleCommands = this.shuttleAssignCommand(motion.getOrigin(), motion.getTarget(), NavigationMapType.DFX.id, assignCommand, shuttleThread);
                 shuttleTaskModeType = ShuttleTaskModeType.PAK_IN;
-                shuttleCommands.add(0, shuttleThread.getLiftCommand(motion.getWrkNo(), true));
+                shuttleCommands.add(0, shuttleThread.getLiftCommand(motion.getTaskNo(), true));
                 break;
             case SHUTTLE_MOVE_DOWN_PALLET://绌挎杞︾Щ鍔ㄥ苟鎵樼洏涓嬮檷
                 shuttleCommands = this.shuttleAssignCommand(motion.getOrigin(), motion.getTarget(), NavigationMapType.DFX.id, assignCommand, shuttleThread);
                 shuttleTaskModeType = ShuttleTaskModeType.PAK_IN;
-                shuttleCommands.add(shuttleCommands.size(), shuttleThread.getLiftCommand(motion.getWrkNo(), false));
+                shuttleCommands.add(shuttleCommands.size(), shuttleThread.getLiftCommand(motion.getTaskNo(), false));
                 break;
             case SHUTTLE_MOVE_FROM_LIFT://鍑烘彁鍗囨満
                 // 鍒ゆ柇鎻愬崌鏈虹姸鎬�
@@ -151,7 +152,7 @@
 //                }
 
                 //鍒ゆ柇鎻愬崌鏈哄伐浣滃彿鏄惁鍜屽綋鍓嶄换鍔$浉鍚�
-                if (liftProtocol.getTaskNo().intValue() != motion.getWrkNo()) {
+                if (liftProtocol.getTaskNo().intValue() != motion.getTaskNo()) {
                     return false;
                 }
 
@@ -188,7 +189,7 @@
 //                }
 
                 //鍒ゆ柇鎻愬崌鏈哄伐浣滃彿鏄惁鍜屽綋鍓嶄换鍔$浉鍚�
-                if (liftProtocol.getTaskNo().intValue() != motion.getWrkNo()) {
+                if (liftProtocol.getTaskNo().intValue() != motion.getTaskNo()) {
                     return false;
                 }
 
@@ -197,21 +198,21 @@
                 break;
             case SHUTTLE_CHARGE_ON://鍏呯數寮�
                 shuttleTaskModeType = ShuttleTaskModeType.CHARGE;
-                shuttleCommands.add(shuttleThread.getChargeCommand(motion.getWrkNo(), true));
+                shuttleCommands.add(shuttleThread.getChargeCommand(motion.getTaskNo(), true));
                 assignCommand.setCharge(Boolean.TRUE);
                 break;
             case SHUTTLE_CHARGE_OFF://鍏呯數鍏�
                 shuttleTaskModeType = ShuttleTaskModeType.CHARGE;
-                shuttleCommands.add(shuttleThread.getChargeCommand(motion.getWrkNo(), false));
+                shuttleCommands.add(shuttleThread.getChargeCommand(motion.getTaskNo(), false));
                 assignCommand.setCharge(Boolean.TRUE);
                 break;
             case SHUTTLE_PALLET_LIFT://鎵樼洏椤跺崌
                 shuttleTaskModeType = ShuttleTaskModeType.PALLET_LIFT;
-                shuttleCommands.add(shuttleThread.getLiftCommand(motion.getWrkNo(), true));
+                shuttleCommands.add(shuttleThread.getLiftCommand(motion.getTaskNo(), true));
                 break;
             case SHUTTLE_PALLET_DOWN://鎵樼洏涓嬮檷
                 shuttleTaskModeType = ShuttleTaskModeType.PALLET_DOWN;
-                shuttleCommands.add(shuttleThread.getLiftCommand(motion.getWrkNo(), false));
+                shuttleCommands.add(shuttleThread.getLiftCommand(motion.getTaskNo(), false));
                 break;
             default:
                 throw new CoolException(motion.getMotionCtgEl() + "娌℃湁鎸囧畾浠诲姟浣滀笟娴佺▼锛侊紒锛�");
@@ -245,24 +246,24 @@
             return false;
         }
 
-        if (shuttleProtocol.getTaskNo() != 0 && shuttleProtocol.getTaskNo().intValue() != motion.getWrkNo()) {
+        if (shuttleProtocol.getTaskNo() != 0 && shuttleProtocol.getTaskNo().intValue() != motion.getTaskNo()) {
             return false;
         }
 
         //鍏呯數浠诲姟
         if (Objects.requireNonNull(MotionCtgType.get(motion.getMotionCtgEl())).equals(MotionCtgType.SHUTTLE_CHARGE_ON)) {
             // 澶嶄綅绌挎杞�
-            shuttleProtocol.setTaskNo(0);
-            shuttleProtocol.setProtocolStatus(ShuttleProtocolStatusType.IDLE);
-            shuttleProtocol.setPakMk(true);
+            shuttleThread.setSyncTaskNo(0);
+            shuttleThread.setProtocolStatus(ShuttleProtocolStatusType.IDLE);
+            shuttleThread.setPakMk(true);
             return true;
         }
 
-//        if (!shuttleProtocol.getProtocolStatusType().equals(ShuttleProtocolStatusType.WAITING)
-//            && !shuttleProtocol.getProtocolStatusType().equals(ShuttleProtocolStatusType.CHARGING_WAITING)
-//        ) {
-//            return false;
-//        }
+        if (!shuttleProtocol.getProtocolStatusType().equals(ShuttleProtocolStatusType.WAITING)
+            && !shuttleProtocol.getProtocolStatusType().equals(ShuttleProtocolStatusType.CHARGING_WAITING)
+        ) {
+            return false;
+        }
 
         //鍒ゆ柇璁惧鏄惁绌洪棽
         if (!shuttleThread.isIdle()) {
@@ -308,7 +309,7 @@
 //                }
 
                 //鍒ゆ柇鎻愬崌鏈哄伐浣滃彿鏄惁鍜屽綋鍓嶄换鍔$浉鍚�
-                if (liftProtocol.getTaskNo().intValue() != motion.getWrkNo()) {
+                if (liftProtocol.getTaskNo().intValue() != motion.getTaskNo()) {
                     return false;
                 }
 
@@ -323,9 +324,9 @@
         }
 
         // 澶嶄綅绌挎杞�
-        shuttleProtocol.setTaskNo(0);
-        shuttleProtocol.setProtocolStatus(ShuttleProtocolStatusType.IDLE);
-        shuttleProtocol.setPakMk(true);
+        shuttleThread.setSyncTaskNo(0);
+        shuttleThread.setProtocolStatus(ShuttleProtocolStatusType.IDLE);
+        shuttleThread.setPakMk(true);
 
         return true;
     }
@@ -361,7 +362,7 @@
             //閫氳繃xy鍧愭爣灏忚溅浜岀淮鐮�
             String distCodeNum = NavigatePositionConvert.xyToPosition(endPath.getX(), endPath.getY(), endPath.getZ(), hostId);
             //鑾峰彇绉诲姩鍛戒护
-            ShuttleCommand command = shuttleThread.getMoveCommand(assignCommand.getTaskNo(), startCodeNum, distCodeNum, allDistance, ShuttleRunDirection.get(startPath.getDirection()).id.intValue(), runSpeed);
+            ShuttleCommand command = shuttleThread.getMoveCommand(assignCommand.getDeviceTaskNo(), startCodeNum, distCodeNum, allDistance, ShuttleRunDirection.get(startPath.getDirection()).id.intValue(), runSpeed);
             command.setNodes(nodes);//灏嗚璧拌妭鐐规坊鍔犲埌姣忎竴姝ュ懡浠や腑
             commands.add(command);
         }

--
Gitblit v1.9.1