From 204d4f97eb72d58b2145873c12eefd1c4fa8b448 Mon Sep 17 00:00:00 2001 From: zhangchao <zc857179121@qq.com> Date: 星期四, 29 八月 2024 13:50:18 +0800 Subject: [PATCH] 配置 --- src/main/java/com/zy/core/thread/SiemensCrnThread.java | 70 +++++++++++++++++++++------------- 1 files changed, 43 insertions(+), 27 deletions(-) diff --git a/src/main/java/com/zy/core/thread/SiemensCrnThread.java b/src/main/java/com/zy/core/thread/SiemensCrnThread.java index 2c9e8f3..2da9ed0 100644 --- a/src/main/java/com/zy/core/thread/SiemensCrnThread.java +++ b/src/main/java/com/zy/core/thread/SiemensCrnThread.java @@ -149,33 +149,41 @@ */ private void readStatus(){ try { - OperateResultExOne<byte[]> result = siemensNet.Read("DB101.0", (short) 56); + OperateResultExOne<byte[]> result = siemensNet.Read("DB101.0", (short) 66); if (result.IsSuccess) { if (null == crnProtocol) { crnProtocol = new CrnProtocol(); crnProtocol.setCrnNo(slave.getId()); } crnProtocol.setMode(siemensNet.getByteTransform().TransInt16(result.Content, 0)); + //宸ヤ綅1 crnProtocol.setTaskNo(siemensNet.getByteTransform().TransInt16(result.Content, 2)); crnProtocol.setStatus(siemensNet.getByteTransform().TransInt16(result.Content, 4)); crnProtocol.setBay(siemensNet.getByteTransform().TransInt16(result.Content, 6)); crnProtocol.setLevel(siemensNet.getByteTransform().TransInt16(result.Content, 8)); crnProtocol.setForkPos(siemensNet.getByteTransform().TransInt16(result.Content, 10)); - crnProtocol.setLiftPos(siemensNet.getByteTransform().TransInt16(result.Content, 12)); - crnProtocol.setWalkPos(siemensNet.getByteTransform().TransInt16(result.Content, 14)); - crnProtocol.setLoaded(siemensNet.getByteTransform().TransInt16(result.Content, 16)); - crnProtocol.setAlarm(siemensNet.getByteTransform().TransInt16(result.Content, 18)); - crnProtocol.setTemp1(siemensNet.getByteTransform().TransInt16(result.Content, 20)); - 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().TransInt16(result.Content, 28)); - 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)); + crnProtocol.setLoaded(siemensNet.getByteTransform().TransInt16(result.Content, 12)); + //宸ヤ綅2 + crnProtocol.setTaskNoTwo(siemensNet.getByteTransform().TransInt16(result.Content, 14)); + crnProtocol.setStatusTwo(siemensNet.getByteTransform().TransInt16(result.Content, 16)); + crnProtocol.setBayTwo(siemensNet.getByteTransform().TransInt16(result.Content, 18)); + crnProtocol.setLevelTwo(siemensNet.getByteTransform().TransInt16(result.Content, 20)); + crnProtocol.setForkPosTwo(siemensNet.getByteTransform().TransInt16(result.Content, 22)); + crnProtocol.setLoadedTwo(siemensNet.getByteTransform().TransInt16(result.Content, 24)); + + crnProtocol.setWalkPos(siemensNet.getByteTransform().TransInt16(result.Content, 26)); + crnProtocol.setWalkPosTwo(siemensNet.getByteTransform().TransInt16(result.Content, 28)); + crnProtocol.setLiftPos(siemensNet.getByteTransform().TransInt16(result.Content, 30)); + crnProtocol.setAlarm(siemensNet.getByteTransform().TransInt16(result.Content, 32)); + crnProtocol.setxSpeed(siemensNet.getByteTransform().TransInt16(result.Content, 34)); + crnProtocol.setySpeed(siemensNet.getByteTransform().TransInt16(result.Content, 38)); + crnProtocol.setzSpeed(siemensNet.getByteTransform().TransInt16(result.Content, 42)); + crnProtocol.setzSpeedTwo(siemensNet.getByteTransform().TransInt16(result.Content, 46)); + crnProtocol.setxDistance(siemensNet.getByteTransform().TransInt16(result.Content, 50)); + crnProtocol.setyDistance(siemensNet.getByteTransform().TransInt16(result.Content, 54)); + crnProtocol.setxDuration(siemensNet.getByteTransform().TransInt16(result.Content, 58)); + crnProtocol.setyDuration(siemensNet.getByteTransform().TransInt16(result.Content, 62)); + OutputQueue.CRN.offer(MessageFormat.format("銆恵0}銆慬id:{1}] <<<<< 瀹炴椂鏁版嵁鏇存柊鎴愬姛",DateUtils.convert(new Date()), slave.getId())); @@ -236,19 +244,27 @@ } // convertRow(command); command.setCrnNo(slave.getId()); - short[] array = new short[10]; - 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(); + short[] array = new short[17]; + array[0] = command.getTaskNo(); + array[1] = command.getTaskMode(); + array[2] = command.getSourcePosX(); + array[3] = command.getSourcePosY(); + array[4] = command.getSourcePosZ(); + array[5] = command.getDestinationPosX(); + array[6] = command.getDestinationPosY(); + array[7] = command.getDestinationPosZ(); + array[8] = command.getSourcePosXTwo(); + array[9] = command.getSourcePosYTwo(); + array[10] = command.getSourcePosZTwo(); + array[11] = command.getDestinationPosXTwo(); + array[12] = command.getDestinationPosYTwo(); + array[13] = command.getDestinationPosZTwo(); + array[14] = command.getCommand(); + array[15] = command.getAckFinish(); + // array[9] = command.getSourceStaNo(); // array[10] = command.getDestinationStaNo(); - array[9] = command.getCommand(); + //array[9] = command.getCommand(); OperateResult result = siemensNet.Write("DB100.0", array); if (command.getAckFinish() == 0) { -- Gitblit v1.9.1