From f55ba9203e378212ca3be9710b85cb91f04e7ca7 Mon Sep 17 00:00:00 2001 From: whycq <913841844@qq.com> Date: 星期三, 15 三月 2023 16:21:44 +0800 Subject: [PATCH] # --- src/main/java/com/zy/core/thread/SiemensCrnThread.java | 43 +++++++++++++++++++++++-------------------- 1 files changed, 23 insertions(+), 20 deletions(-) diff --git a/src/main/java/com/zy/core/thread/SiemensCrnThread.java b/src/main/java/com/zy/core/thread/SiemensCrnThread.java index 65343df..befab27 100644 --- a/src/main/java/com/zy/core/thread/SiemensCrnThread.java +++ b/src/main/java/com/zy/core/thread/SiemensCrnThread.java @@ -147,10 +147,11 @@ */ private void readStatus(){ try { - OperateResultExOne<byte[]> result = siemensNet.Read("DB101.0", (short) 70); + OperateResultExOne<byte[]> result = siemensNet.Read("DB101.0", (short) 56); if (result.IsSuccess) { if (null == crnProtocol) { crnProtocol = new CrnProtocol(); + crnProtocol.setCrnNo(slave.getId()); } crnProtocol.setMode(siemensNet.getByteTransform().TransInt16(result.Content, 0)); crnProtocol.setTaskNo(siemensNet.getByteTransform().TransInt16(result.Content, 2)); @@ -167,12 +168,12 @@ crnProtocol.setTemp3(siemensNet.getByteTransform().TransInt16(result.Content, 24)); crnProtocol.setTemp4(siemensNet.getByteTransform().TransInt16(result.Content, 26)); crnProtocol.setxSpeed(siemensNet.getByteTransform().TransInt16(result.Content, 28)); - crnProtocol.setySpeed(siemensNet.getByteTransform().TransInt16(result.Content, 30)); - crnProtocol.setzSpeed(siemensNet.getByteTransform().TransInt16(result.Content, 32)); - crnProtocol.setxDistance(siemensNet.getByteTransform().TransInt16(result.Content, 34)); - crnProtocol.setyDistance(siemensNet.getByteTransform().TransInt16(result.Content, 36)); - crnProtocol.setxDuration(siemensNet.getByteTransform().TransInt16(result.Content, 38)); - crnProtocol.setyDuration(siemensNet.getByteTransform().TransInt16(result.Content, 40)); + crnProtocol.setySpeed(siemensNet.getByteTransform().TransInt16(result.Content, 32)); + crnProtocol.setzSpeed(siemensNet.getByteTransform().TransInt16(result.Content, 36)); + crnProtocol.setxDistance(siemensNet.getByteTransform().TransInt16(result.Content, 40)); + crnProtocol.setyDistance(siemensNet.getByteTransform().TransInt16(result.Content, 44)); + crnProtocol.setxDuration(siemensNet.getByteTransform().TransInt16(result.Content, 48)); + crnProtocol.setyDuration(siemensNet.getByteTransform().TransInt16(result.Content, 52)); OutputQueue.CRN.offer(MessageFormat.format("銆恵0}銆慬id:{1}] <<<<< 瀹炴椂鏁版嵁鏇存柊鎴愬姛",DateUtils.convert(new Date()), slave.getId())); @@ -231,25 +232,27 @@ log.error("鍫嗗灈鏈哄啓鍏ュ懡浠や负绌�"); return false; } - convertRow(command); +// convertRow(command); command.setCrnNo(slave.getId()); +// short[] array = new short[10]; short[] array = new short[12]; - array[0] = command.getAckFinish(); - array[1] = command.getTaskNo(); - array[2] = command.getTaskMode(); - array[3] = command.getSourcePosX(); - array[4] = command.getSourcePosY(); - array[5] = command.getSourcePosZ(); - array[6] = command.getDestinationPosX(); - array[7] = command.getDestinationPosY(); - array[8] = command.getDestinationPosZ(); - array[9] = command.getSourceStaNo(); - array[10] = command.getDestinationStaNo(); - array[11] = command.getCommand(); + array[0] = command.getAckFinish(); // 浠诲姟瀹屾垚纭浣� + array[1] = command.getTaskNo(); // 浠诲姟鍙� + array[2] = command.getTaskMode(); // 妯″紡 + array[3] = command.getSourcePosX(); // 婧愪綅缃帓鍙� + array[4] = command.getSourcePosY(); // 婧愪綅缃垪鍙� + array[5] = command.getSourcePosZ(); // 婧愪綅缃眰鍙� + array[6] = command.getDestinationPosX(); // 鐩爣浣嶇疆鎺掑彿 + array[7] = command.getDestinationPosY(); // 鐩爣浣嶇疆鍒楀彿 + array[8] = command.getDestinationPosZ(); // 鐩爣浣嶇疆灞傚彿 + array[9] = command.getCommand(); + array[10] = command.getLocType1(); //鏂板璐х墿绫诲瀷涓嬪彂 OperateResult result = siemensNet.Write("DB100.0", array); if (command.getAckFinish() == 0) { short commandFinish = 1; + Thread.sleep(100L); +// result = siemensNet.Write("DB100.18", commandFinish); result = siemensNet.Write("DB100.22", commandFinish); } -- Gitblit v1.9.1