From 1d624dfdb040825ffecba6c792c480be662b2dbc Mon Sep 17 00:00:00 2001
From: Junjie <xjj@123>
Date: 星期四, 10 四月 2025 17:39:56 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/core/thread/impl/ZyForkLiftThread.java |   36 +++++++++++++++++++++++++++++-------
 1 files changed, 29 insertions(+), 7 deletions(-)

diff --git a/src/main/java/com/zy/core/thread/impl/ZyForkLiftThread.java b/src/main/java/com/zy/core/thread/impl/ZyForkLiftThread.java
index 25269ab..fc0c40c 100644
--- a/src/main/java/com/zy/core/thread/impl/ZyForkLiftThread.java
+++ b/src/main/java/com/zy/core/thread/impl/ZyForkLiftThread.java
@@ -19,6 +19,7 @@
 import com.zy.core.action.ForkLiftAction;
 import com.zy.core.action.ShuttleAction;
 import com.zy.core.cache.OutputQueue;
+import com.zy.core.enums.ForkLiftIoModeType;
 import com.zy.core.enums.ForkLiftProtocolStatusType;
 import com.zy.core.enums.ForkLiftTaskModeType;
 import com.zy.core.enums.RedisKeyType;
@@ -299,6 +300,7 @@
         if (this.forkLiftProtocol.getTaskNo() == null
                 || this.forkLiftProtocol.getProtocolStatus() == null
                 || this.forkLiftProtocol.getModel() == null
+                || this.forkLiftProtocol.getErrorCode() == null
         ) {
             return false;
         }
@@ -306,7 +308,9 @@
         boolean res = this.forkLiftProtocol.getProtocolStatus() == ForkLiftProtocolStatusType.IDLE.id
                 && this.forkLiftProtocol.getWrkNo() == 0
                 && this.forkLiftProtocol.getTaskNo() == 0
-                && this.forkLiftProtocol.getModel() == 2;
+                && this.forkLiftProtocol.getModel() == 2
+                && this.forkLiftProtocol.getErrorCode() == 0
+                ;
         return res;
     }
 
@@ -327,13 +331,16 @@
         if (this.forkLiftProtocol.getTaskNo() == null
                 || this.forkLiftProtocol.getProtocolStatus() == null
                 || this.forkLiftProtocol.getModel() == null
+                || this.forkLiftProtocol.getErrorCode() == null
         ) {
             return false;
         }
 
         boolean res = this.forkLiftProtocol.getProtocolStatus() == ForkLiftProtocolStatusType.IDLE.id
                 && this.forkLiftProtocol.getWrkNo() == 0
-                && this.forkLiftProtocol.getModel() == 2;
+                && this.forkLiftProtocol.getModel() == 2
+                && this.forkLiftProtocol.getErrorCode() == 0
+                ;
         return res;
     }
 
@@ -349,19 +356,31 @@
     }
 
     @Override
+    public boolean switchIOMode(ForkLiftIoModeType type) {
+        OperateResult result = siemensS7Net.Write("DB103.12", type.id.shortValue());
+        if (result.IsSuccess) {
+            return true;
+        }
+        return false;
+    }
+
+    @Override
     public int generateDeviceTaskNo(int taskNo, ForkLiftTaskModeType type) {
         return taskNo;
     }
 
     @Override
     public List<ForkLiftCommand> getPickAndPutCommand(Integer taskNo, Integer pick, Integer put) {
+        Integer realPick = pick % 1000;
+        Integer realPut = put % 1000;
+
         List<ForkLiftCommand> commands = new ArrayList<>();
         ForkLiftCommand command = new ForkLiftCommand();
         command.setLiftNo(slave.getId());
         command.setTaskNo(taskNo.shortValue());
         command.setMode(ForkLiftTaskModeType.PICK_PUT.id.shortValue());
-        command.setPick(pick.shortValue());
-        command.setPut(put.shortValue());
+        command.setPick(realPick.shortValue());
+        command.setPut(realPut.shortValue());
         command.setConfirm((short) 1);
 
         commands.add(command);
@@ -369,14 +388,17 @@
     }
 
     @Override
-    public List<ForkLiftCommand> getShuttleSwitchCommand(Integer taskNo, Integer originLev, Integer targetLev) {
+    public List<ForkLiftCommand> getShuttleSwitchCommand(Integer taskNo, Integer pick, Integer put) {
+        Integer realPick = pick % 1000;
+        Integer realPut = put % 1000;
+
         List<ForkLiftCommand> commands = new ArrayList<>();
         ForkLiftCommand command = new ForkLiftCommand();
         command.setLiftNo(slave.getId());
         command.setTaskNo(taskNo.shortValue());
         command.setMode(ForkLiftTaskModeType.SHUTTLE_SWITCH.id.shortValue());
-        command.setPick(originLev.shortValue());
-        command.setPut(targetLev.shortValue());
+        command.setPick(realPick.shortValue());
+        command.setPut(realPut.shortValue());
         command.setConfirm((short) 1);
 
         commands.add(command);

--
Gitblit v1.9.1