From c5ba40cbd977a23c1b659b6923bf3f67326ff092 Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@63.com> Date: 星期六, 03 十二月 2022 15:59:58 +0800 Subject: [PATCH] # --- src/main/java/com/zy/core/thread/SteThread.java | 15 ++++++++++++++- 1 files changed, 14 insertions(+), 1 deletions(-) diff --git a/src/main/java/com/zy/core/thread/SteThread.java b/src/main/java/com/zy/core/thread/SteThread.java index 3aad9d7..f2ca292 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; @@ -137,6 +138,14 @@ 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)); steProtocol.setCharge(siemensS7Net.getByteTransform().TransSingle(result.Content, 10)); @@ -165,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())); @@ -259,6 +269,7 @@ // 浠诲姟瀹屾垚 } else { + siemensS7Net.Write("V2000.0", false); siemensS7Net.Write("V998", (short) 0); siemensS7Net.Write("V1000", (short) 0); result = siemensS7Net.Write("V2000.1", true); @@ -296,7 +307,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)); -- Gitblit v1.9.1