From 09fcc4ec56a1ce6c0fcb308348d8dd5e2c08d336 Mon Sep 17 00:00:00 2001
From: fyxc <fyxc@qq.com>
Date: 星期四, 22 五月 2025 14:33:06 +0800
Subject: [PATCH] server commit files

---
 src/main/java/com/zy/core/thread/impl/LfdZyForkLiftSlaveThread.java |   33 +++++++++++++++++++++------------
 1 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/src/main/java/com/zy/core/thread/impl/LfdZyForkLiftSlaveThread.java b/src/main/java/com/zy/core/thread/impl/LfdZyForkLiftSlaveThread.java
index 8ba8fb4..eb32bc1 100644
--- a/src/main/java/com/zy/core/thread/impl/LfdZyForkLiftSlaveThread.java
+++ b/src/main/java/com/zy/core/thread/impl/LfdZyForkLiftSlaveThread.java
@@ -2,7 +2,6 @@
 
 import HslCommunication.Core.Types.OperateResult;
 import HslCommunication.Core.Types.OperateResultExOne;
-import HslCommunication.Profinet.Siemens.SiemensPLCS;
 import HslCommunication.Profinet.Siemens.SiemensS7Net;
 import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.mapper.EntityWrapper;
@@ -43,7 +42,6 @@
     private ForkLiftSlave slave;
     private ForkLiftProtocol forkLiftProtocol;
     private RedisUtil redisUtil;
-    private SiemensS7Net siemensS7Net;
     private List<ForkLiftStaProtocol> forkLiftStaProtocols = new ArrayList<>();
     private LfdZyForkLiftMasterThread masterThread;
 
@@ -67,7 +65,7 @@
     public boolean connect() {
         boolean result = false;
         LfdZyForkLiftMasterThread masterThread = (LfdZyForkLiftMasterThread) SlaveConnection.get(SlaveType.ForkLiftMaster, masterId);
-        if(masterThread != null) {
+        if (masterThread != null) {
             result = true;
             this.masterThread = masterThread;
         }
@@ -140,6 +138,7 @@
                 OutputQueue.FORKLIFT.offer(MessageFormat.format("銆恵0}銆憑1}璇诲彇璐у弶鎻愬崌鏈虹姸鎬佷俊鎭け璐�", DateUtils.convert(new Date()), slave.getId()));
             }
 
+            SiemensS7Net siemensS7Net = this.masterThread.getSiemensS7Net();
             if (result1.IsSuccess) {
                 if (null == forkLiftProtocol) {
                     forkLiftProtocol = new ForkLiftProtocol();
@@ -171,7 +170,7 @@
                 InnerForkLiftExtend forkLiftExtend = (InnerForkLiftExtend) forkLiftProtocol.getExtend();
                 forkLiftProtocol.setExtend(forkLiftExtend);
 
-            }else {
+            } else {
                 OutputQueue.FORKLIFT.offer(MessageFormat.format("銆恵0}銆憑1}璇诲彇璐у弶鎻愬崌鏈虹姸鎬佷俊鎭け璐�", DateUtils.convert(new Date()), slave.getId()));
             }
 
@@ -224,7 +223,7 @@
             //璁惧鐘舵��
             basLift.setDeviceStatus(JSON.toJSONString(forkLiftProtocol));
             if (basLiftService.updateById(basLift)) {
-                OutputQueue.FORKLIFT.offer(MessageFormat.format("銆恵0}銆慬id:{1}] <<<<< 瀹炴椂鏁版嵁鏇存柊鎴愬姛",DateUtils.convert(new Date()), forkLiftProtocol.getLiftNo()));
+                OutputQueue.FORKLIFT.offer(MessageFormat.format("銆恵0}銆慬id:{1}] <<<<< 瀹炴椂鏁版嵁鏇存柊鎴愬姛", DateUtils.convert(new Date()), forkLiftProtocol.getLiftNo()));
             }
 
         } catch (Exception e) {
@@ -304,6 +303,7 @@
         if (this.forkLiftProtocol.getTaskNo() == null
                 || this.forkLiftProtocol.getProtocolStatus() == null
                 || this.forkLiftProtocol.getModel() == null
+                || this.forkLiftProtocol.getErrorCode() == null
         ) {
             return false;
         }
@@ -311,7 +311,8 @@
         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;
     }
 
@@ -332,13 +333,15 @@
         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;
     }
 
@@ -369,13 +372,16 @@
 
     @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);
@@ -383,14 +389,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