From c6ac4fcda65f2033dbf4d0cfb57fc32cdd3eee2f Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期三, 30 十一月 2022 14:42:09 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/core/thread/SteThread.java |   18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/src/main/java/com/zy/core/thread/SteThread.java b/src/main/java/com/zy/core/thread/SteThread.java
index 49bc3a9..4adf992 100644
--- a/src/main/java/com/zy/core/thread/SteThread.java
+++ b/src/main/java/com/zy/core/thread/SteThread.java
@@ -5,6 +5,7 @@
 import HslCommunication.Profinet.Siemens.SiemensPLCS;
 import HslCommunication.Profinet.Siemens.SiemensS7Net;
 import com.alibaba.fastjson.JSON;
+import com.core.common.Cools;
 import com.core.common.DateUtils;
 import com.core.common.SpringUtils;
 import com.core.exception.CoolException;
@@ -124,8 +125,9 @@
             if (result.IsSuccess) {
                 if (null == steProtocol) {
                     steProtocol = new SteProtocol();
+                    steProtocol.setSteNo(slave.getId().shortValue());
                 }
-                steProtocol.setSteNo(siemensS7Net.getByteTransform().TransInt16(result.Content, 0));
+//                steProtocol.setSteNo(siemensS7Net.getByteTransform().TransInt16(result.Content, 0));
                 steProtocol.setMode(siemensS7Net.getByteTransform().TransInt16(result.Content, 2));
                 steProtocol.setStatus(siemensS7Net.getByteTransform().TransInt16(result.Content, 4));
                 OperateResultExOne<Boolean> executeRes = siemensS7Net.ReadBool("V2001.0");
@@ -135,6 +137,14 @@
                 OperateResultExOne<Boolean> waitingRes = siemensS7Net.ReadBool("V2001.1");
                 if (waitingRes.IsSuccess) {
                     steProtocol.setWaiting(waitingRes.Content);
+                }
+                OperateResultExOne<Boolean> inEmptyRes = siemensS7Net.ReadBool("V2001.2");
+                if (inEmptyRes.IsSuccess) {
+                    steProtocol.setInEmpty(inEmptyRes.Content);
+                }
+                OperateResultExOne<Boolean> outEmptyRes = siemensS7Net.ReadBool("V2001.3");
+                if (outEmptyRes.IsSuccess) {
+                    steProtocol.setOutEmpty(outEmptyRes.Content);
                 }
                 steProtocol.setAlarm(siemensS7Net.getByteTransform().TransInt16(result.Content, 6));
                 steProtocol.setAlarm0(siemensS7Net.getByteTransform().TransInt16(result.Content, 8));
@@ -164,6 +174,7 @@
                 steProtocol.setCrnStopRun(siemensS7Net.getByteTransform().TransInt16(result.Content, 38));
                 steProtocol.setCrnStopFork(siemensS7Net.getByteTransform().TransInt16(result.Content, 40));
                 steProtocol.setCrnAllowRun(siemensS7Net.getByteTransform().TransInt16(result.Content, 42));
+                steProtocol.setChargeStatus(siemensS7Net.getByteTransform().TransInt16(result.Content, 44));
 
                 OutputQueue.STE.offer(MessageFormat.format("銆恵0}銆慬id:{1}] <<<<< 瀹炴椂鏁版嵁鏇存柊鎴愬姛",DateUtils.convert(new Date()), slave.getId()));
 
@@ -295,7 +306,9 @@
         if (result != null && result.IsSuccess) {
             // 缁存姢鏁版嵁搴撴帓鍒楀眰
             if (!steProtocol.getWaiting()) {
-                this.modifyPos(command.getRow().intValue(), command.getBay().intValue(), command.getLev().intValue());
+                if (!Cools.isEmpty(command.getRow(), command.getBay(), command.getLev())) {
+                    this.modifyPos(command.getRow().intValue(), command.getBay().intValue(), command.getLev().intValue());
+                }
             }
 
             log.info("绌挎杞﹀懡浠や笅鍙慬id:{}] >>>>> {}", slave.getId(), JSON.toJSON(command));
@@ -338,6 +351,7 @@
         short[] arr = new short[] {row.shortValue(), bay.shortValue(), lev.shortValue()};
         OperateResult result = siemensS7Net.Write("V1002", arr);
         if (!result.IsSuccess) {
+            log.error("鏇存柊{}鍙风┛姊溅瀹氫綅澶辫触 ===>> 鎺掞細銆恵}銆�, 鍒楋細銆恵}銆戯紝灞傦細銆恵}銆�", this.slave.getId(), row, bay, lev);
             return false;
         }
         BasSteService service = SpringUtils.getBean(BasSteService.class);

--
Gitblit v1.9.1