From 9bb292da94b9ae4450588ca570ce9b00f0316e1b Mon Sep 17 00:00:00 2001 From: zwl <1051256694@qq.com> Date: 星期四, 10 七月 2025 15:24:56 +0800 Subject: [PATCH] 完善三号堆垛机采集不到数据BUG --- src/main/java/com/zy/core/thread/SiemensCrnThread.java | 28 ++++++++++++++++++++-------- 1 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/zy/core/thread/SiemensCrnThread.java b/src/main/java/com/zy/core/thread/SiemensCrnThread.java index 37ca98b..04573b7 100644 --- a/src/main/java/com/zy/core/thread/SiemensCrnThread.java +++ b/src/main/java/com/zy/core/thread/SiemensCrnThread.java @@ -182,17 +182,29 @@ // crnProtocol.setTemp2(siemensNet.getByteTransform().TransInt16(result.Content, 22)); // crnProtocol.setTemp3(siemensNet.getByteTransform().TransInt16(result.Content, 24)); // crnProtocol.setTemp4(siemensNet.getByteTransform().TransInt16(result.Content, 26)); - crnProtocol.setXSpeed(siemensNet.getByteTransform().TransSingle(result.Content, 28)); - crnProtocol.setYSpeed(siemensNet.getByteTransform().TransSingle(result.Content, 32)); - crnProtocol.setZSpeed(siemensNet.getByteTransform().TransSingle(result.Content, 36)); - crnProtocol.setXDistance(siemensNet.getByteTransform().TransSingle(result.Content, 40)); - crnProtocol.setYDistance(siemensNet.getByteTransform().TransSingle(result.Content, 44)); - crnProtocol.setXDuration(siemensNet.getByteTransform().TransSingle(result.Content, 48)); - crnProtocol.setYDuration(siemensNet.getByteTransform().TransSingle(result.Content, 52)); + if(slave.getId()==3){ + crnProtocol.setXSpeed((float) siemensNet.getByteTransform().TransInt16(result.Content, 28)); + crnProtocol.setYSpeed((float) siemensNet.getByteTransform().TransInt16(result.Content, 30)); + crnProtocol.setZSpeed((float) siemensNet.getByteTransform().TransInt16(result.Content, 32)); + crnProtocol.setXDistance((float) siemensNet.getByteTransform().TransInt16(result.Content, 34)); + crnProtocol.setYDistance((float) siemensNet.getByteTransform().TransInt16(result.Content, 36)); + crnProtocol.setXDuration((float) siemensNet.getByteTransform().TransInt16(result.Content, 38)); + crnProtocol.setYDuration((float) siemensNet.getByteTransform().TransInt16(result.Content, 40)); + + }else{ + crnProtocol.setXSpeed(siemensNet.getByteTransform().TransSingle(result.Content, 28)); + crnProtocol.setYSpeed(siemensNet.getByteTransform().TransSingle(result.Content, 32)); + crnProtocol.setZSpeed(siemensNet.getByteTransform().TransSingle(result.Content, 36)); + crnProtocol.setXDistance(siemensNet.getByteTransform().TransSingle(result.Content, 40)); + crnProtocol.setYDistance(siemensNet.getByteTransform().TransSingle(result.Content, 44)); + crnProtocol.setXDuration(siemensNet.getByteTransform().TransSingle(result.Content, 48)); + crnProtocol.setYDuration(siemensNet.getByteTransform().TransSingle(result.Content, 52)); + + } - OutputQueue.CRN.offer(MessageFormat.format("銆恵0}銆慬id:{1}] <<<<< 瀹炴椂鏁版嵁鏇存柊鎴愬姛",DateUtils.convert(new Date()), slave.getId())); + OutputQueue.CRN.offer(MessageFormat.format("銆恵0}銆慬id:{1}] <<<<< 瀹炴椂鏁版嵁鏇存柊鎴愬姛", DateUtils.convert(new Date()), slave.getId())); // 澶嶄綅淇″彿 if (crnProtocol.getTaskFinish() == 0) { -- Gitblit v1.9.1