From 135a1341621d7de38132aba7b6174c651492ba0e Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期二, 22 四月 2025 12:56:01 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/core/thread/impl/LfdZyForkLiftSlaveThread.java |   30 +++++++++++++++++++-----------
 1 files changed, 19 insertions(+), 11 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 a46d4c7..b5d31d7 100644
--- a/src/main/java/com/zy/core/thread/impl/LfdZyForkLiftSlaveThread.java
+++ b/src/main/java/com/zy/core/thread/impl/LfdZyForkLiftSlaveThread.java
@@ -30,10 +30,7 @@
 import lombok.extern.slf4j.Slf4j;
 
 import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.Base64;
-import java.util.Date;
-import java.util.List;
+import java.util.*;
 
 @Slf4j
 @SuppressWarnings("all")
@@ -90,7 +87,7 @@
                 }
 
                 read();
-                Thread.sleep(200);
+                Thread.sleep(1000);
                 execute();
             } catch (Exception e) {
                 e.printStackTrace();
@@ -135,10 +132,6 @@
         try {
             //鑾峰彇鎻愬崌鏈烘暟鎹�
             OperateResultExOne<byte[]> result1 = this.masterThread.read(this.slave.getId(), "status");
-            if (result1 == null) {
-                OutputQueue.FORKLIFT.offer(MessageFormat.format("銆恵0}銆憑1}璇诲彇璐у弶鎻愬崌鏈虹姸鎬佷俊鎭け璐�", DateUtils.convert(new Date()), slave.getId()));
-            }
-
             SiemensS7Net siemensS7Net = this.masterThread.getSiemensS7Net();
             if (result1.IsSuccess) {
                 if (null == forkLiftProtocol) {
@@ -201,6 +194,15 @@
                 deviceDataLog.setDeviceNo(forkLiftProtocol.getLiftNo());
                 deviceDataLog.setCreateTime(new Date());
                 deviceDataLogService.insert(deviceDataLog);
+
+                //淇濆瓨鏁版嵁璁板綍
+                DeviceDataLog deviceDataLog2 = new DeviceDataLog();
+                deviceDataLog2.setOriginData(Base64.getEncoder().encodeToString(result2.Content));
+                deviceDataLog2.setWcsData(JSON.toJSONString(forkLiftStaProtocols));
+                deviceDataLog2.setType("forkLiftStaProtocols");
+                deviceDataLog2.setDeviceNo(forkLiftProtocol.getLiftNo());
+                deviceDataLog2.setCreateTime(new Date());
+                deviceDataLogService.insert(deviceDataLog2);
 
                 //鏇存柊閲囬泦鏃堕棿
                 forkLiftProtocol.setDeviceDataLog(System.currentTimeMillis());
@@ -304,6 +306,7 @@
         if (this.forkLiftProtocol.getTaskNo() == null
                 || this.forkLiftProtocol.getProtocolStatus() == null
                 || this.forkLiftProtocol.getModel() == null
+                || this.forkLiftProtocol.getErrorCode() == null
         ) {
             return false;
         }
@@ -311,7 +314,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;
     }
 
@@ -332,13 +337,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;
     }
 

--
Gitblit v1.9.1