From 33050f2e886fb8e4f84313388cc0450550b0b848 Mon Sep 17 00:00:00 2001 From: ytfl <ytfl@qq.com> Date: 星期一, 11 八月 2025 09:56:44 +0800 Subject: [PATCH] # --- src/main/java/com/zy/core/thread/SiemensCrnThread.java | 28 ++++++++++++++++++++++------ 1 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/zy/core/thread/SiemensCrnThread.java b/src/main/java/com/zy/core/thread/SiemensCrnThread.java index 654042f..64dd38d 100644 --- a/src/main/java/com/zy/core/thread/SiemensCrnThread.java +++ b/src/main/java/com/zy/core/thread/SiemensCrnThread.java @@ -282,13 +282,29 @@ OperateResult result = null; int idx = 0; do { - OperateResultExOne<byte[]> resultRead = siemensNet.Read("DB100.0", (short) 4); + OperateResultExOne<byte[]> resultRead = siemensNet.Read("DB100.0", (short) 20); if (resultRead.IsSuccess) { - short taskNo = siemensNet.getByteTransform().TransInt16(resultRead.Content, 2); - if(taskNo == 0) { - result = siemensNet.Write("DB100.0", array); + if (command.getAckFinish() == 0) { + short taskNo = siemensNet.getByteTransform().TransInt16(resultRead.Content, 2); + short taskMode = siemensNet.getByteTransform().TransInt16(resultRead.Content, 4); + short sourcePosX = siemensNet.getByteTransform().TransInt16(resultRead.Content, 6); + short sourcePosY = siemensNet.getByteTransform().TransInt16(resultRead.Content, 8); + short sourcePosZ = siemensNet.getByteTransform().TransInt16(resultRead.Content, 10); + short destinationPosX = siemensNet.getByteTransform().TransInt16(resultRead.Content, 12); + short destinationPosY = siemensNet.getByteTransform().TransInt16(resultRead.Content, 14); + short destinationPosZ = siemensNet.getByteTransform().TransInt16(resultRead.Content, 16); + if(taskNo == 0 || taskMode == 0 || sourcePosX == 0 || sourcePosY == 0 || sourcePosZ == 0 || destinationPosX == 0 || destinationPosY == 0 || destinationPosZ == 0) { + result = siemensNet.Write("DB100.0", array); + }else { + break; + } }else { - break; + short ackFinish = siemensNet.getByteTransform().TransInt16(resultRead.Content, 0); + if(ackFinish != command.getAckFinish()) { + result = siemensNet.Write("DB100.0", array); + }else { + break; + } } } idx++; @@ -313,6 +329,7 @@ } while (i < 5); } + this.crnProtocol.setLastCommandTime(System.currentTimeMillis()); try { // 鏃ュ織璁板綍 BasCrnOptService bean = SpringUtils.getBean(BasCrnOptService.class); @@ -348,7 +365,6 @@ return false; } } - @Override public void close() { -- Gitblit v1.9.1