From c6bca77cf2603ceebc07fec7ece783c2f9bca74e Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期六, 10 六月 2023 19:24:53 +0800
Subject: [PATCH] Base地图更新

---
 src/main/java/com/zy/core/thread/ShuttleThread.java |   36 +++++++++++++++++++++++++++---------
 1 files changed, 27 insertions(+), 9 deletions(-)

diff --git a/src/main/java/com/zy/core/thread/ShuttleThread.java b/src/main/java/com/zy/core/thread/ShuttleThread.java
index 2df784a..025d0e9 100644
--- a/src/main/java/com/zy/core/thread/ShuttleThread.java
+++ b/src/main/java/com/zy/core/thread/ShuttleThread.java
@@ -210,7 +210,7 @@
 
                 //灏嗗洓鍚戠┛姊溅鐘舵�佷繚瀛樿嚦鏁版嵁搴�
                 BasShuttleService shuttleService = SpringUtils.getBean(BasShuttleService.class);
-                BasShuttle basShuttle = shuttleService.selectById(shuttleProtocol.getShuttleNo());
+                BasShuttle basShuttle = shuttleService.selectById(slave.getId());
                 if (basShuttle == null) {
                     basShuttle = new BasShuttle();
                     //鍥涘悜绌挎杞﹀彿
@@ -467,10 +467,16 @@
                     commands.add(getPalletCommand(assignCommand.getTaskMode() == 3 ? (short) 1 : (short) 2));
                     break;
                 case 5://寮哄埗宸︾Щ
+                    commands.add(getForceMoveCommand((short) 2));
+                    break;
                 case 6://寮哄埗鍙崇Щ
+                    commands.add(getForceMoveCommand((short) 1));
+                    break;
                 case 7://寮哄埗涓婄Щ
+                    commands.add(getForceMoveCommand((short) 3));
+                    break;
                 case 8://寮哄埗涓嬬Щ
-                    commands.add(getForceMoveCommand((short) (assignCommand.getTaskMode() - 4)));
+                    commands.add(getForceMoveCommand((short) 4));
                     break;
                 case 9://鐘舵�佸浣�
                     ShuttleCommand reset = getResetCommand();
@@ -918,7 +924,7 @@
      * 鑾峰彇鎵樼洏椤跺崌鍛戒护
      * @param lift 1椤跺崌锛�2涓嬮檷
      */
-    private ShuttleCommand getPalletCommand(Short lift) {
+    public ShuttleCommand getPalletCommand(Short lift) {
         ShuttleCommand command = new ShuttleCommand();
         command.setCommandWord((short) 2);
         command.setStartCodeNum((short) 0);
@@ -938,7 +944,7 @@
      * 姝e父绉诲姩鍛戒护
      * @return
      */
-    private ShuttleCommand getMoveCommand(Short startCodeNum, Short distCodeNum, Integer startToDistDistance, Short runDirection) {
+    public ShuttleCommand getMoveCommand(Short startCodeNum, Short distCodeNum, Integer startToDistDistance, Short runDirection) {
         ShuttleCommand command = new ShuttleCommand();
         command.setCommandWord((short) 1);
         command.setStartCodeNum(startCodeNum);
@@ -957,7 +963,7 @@
      * 寮哄埗绉诲姩鍛戒护
      * @param direction 绉诲姩鏂瑰悜 1宸︾Щ锛�2鍙崇Щ锛�3鍓嶇Щ锛�4鍚庣Щ
      */
-    private ShuttleCommand getForceMoveCommand(Short direction) {
+    public ShuttleCommand getForceMoveCommand(Short direction) {
         ShuttleCommand command = new ShuttleCommand();
         command.setCommandWord((short) 3);
         command.setStartCodeNum((short) 0);
@@ -975,7 +981,7 @@
     /**
      * 鐘舵�佸浣嶅懡浠�
      */
-    private ShuttleCommand getResetCommand() {
+    public ShuttleCommand getResetCommand() {
         ShuttleCommand command = new ShuttleCommand();
         command.setCommandWord((short) 6);
         command.setStartCodeNum((short) 0);
@@ -998,7 +1004,7 @@
      * 鑾峰彇瀵诲簱浣嶅懡浠�
      * @param direction 1:鍚戞鏂瑰悜(宸�)瀵诲簱浣�,2:鍚戣礋鏂瑰悜(鍙�)瀵诲簱浣�,3:鍚戣礋鏂瑰悜(鍚�)瀵诲簱浣�,4:鍚戞鏂瑰悜(鍓�)瀵诲簱浣�
      */
-    private ShuttleCommand getFindLocCommand(Short direction, Integer startToDistance, Short runSpeed) {
+    public ShuttleCommand getFindLocCommand(Short direction, Integer startToDistance, Short runSpeed) {
         ShuttleCommand command = new ShuttleCommand();
         command.setCommandWord((short) 4);
         command.setRunDirection(direction);
@@ -1012,14 +1018,14 @@
      * 鑾峰彇瀵诲簱浣嶅懡浠わ紝榛樿绉诲姩璺濈3000锛岃繍琛岄�熷害1000
      * @param direction 1:鍚戞鏂瑰悜(宸�)瀵诲簱浣�,2:鍚戣礋鏂瑰悜(鍙�)瀵诲簱浣�,3:鍚戣礋鏂瑰悜(鍚�)瀵诲簱浣�,4:鍚戞鏂瑰悜(鍓�)瀵诲簱浣�
      */
-    private ShuttleCommand getFindLocCommand(Short direction) {
+    public ShuttleCommand getFindLocCommand(Short direction) {
         return getFindLocCommand(direction, 3000, (short) 1000);
     }
 
     /**
      * 鑾峰彇鍏呯數寮�鍏冲懡浠�
      */
-    private ShuttleCommand getChargeSwitchCommand() {
+    public ShuttleCommand getChargeSwitchCommand() {
         ShuttleCommand command = new ShuttleCommand();
         command.setCommandWord((short) 8);
         command.setIOControl((short) 4);
@@ -1027,6 +1033,18 @@
         return command;
     }
 
+    /**
+     * charge锛�1=>寮�濮嬪厖鐢碉紝2=>鏂紑鍏呯數
+     */
+    public ShuttleCommand getChargeSwitchCommand(Short charge) {
+        ShuttleCommand command = new ShuttleCommand();
+        command.setCommandWord((short) 5);//鍏呯數
+        command.setShuttleNo(shuttleProtocol.getShuttleNo());
+        command.setChargeSwitch(charge);//寮�濮嬪厖鐢�
+        command.setCommandEnd((short) 1);
+        return command;
+    }
+
     /******************************************************************************************/
     /**************************************** 娴嬭瘯涓撶敤 *****************************************/
     /*****************************************************************************************/

--
Gitblit v1.9.1