From 371272c50c94b364aed0efec4871aefa85ff0a27 Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@163.com> Date: 星期一, 11 一月 2021 14:43:54 +0800 Subject: [PATCH] # --- src/main/java/com/zy/core/thread/SiemensCrnThread.java | 40 +++++++++++++++++++++++++++++----------- 1 files changed, 29 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/zy/core/thread/SiemensCrnThread.java b/src/main/java/com/zy/core/thread/SiemensCrnThread.java index 7c603e2..5bfc407 100644 --- a/src/main/java/com/zy/core/thread/SiemensCrnThread.java +++ b/src/main/java/com/zy/core/thread/SiemensCrnThread.java @@ -114,7 +114,7 @@ * 璇诲彇鐘舵�� */ private void readStatus(){ - OperateResultExOne<byte[]> result = siemensNet.Read("DB11.2", (short) 90); + OperateResultExOne<byte[]> result = siemensNet.Read("DB11.2", (short) 104); if (result.IsSuccess) { if (null == crnProtocol) { crnProtocol = new CrnProtocol(); @@ -160,6 +160,19 @@ crnProtocol.setDoubleLow(bool3[5]); crnProtocol.setPlatformHigh(bool3[6]); crnProtocol.setPlatformLow(bool3[7]); + boolean[] bool4 = siemensNet.getByteTransform().TransBool(result.Content, 64, 1); // 66 + crnProtocol.setLoaded((short) (bool4[4]?1:0)); // 鏈夌墿 + + // 閫熷害 + crnProtocol.setXSpeed((float) siemensNet.getByteTransform().TransInt16(result.Content, 22)); // 24 + crnProtocol.setYSpeed((float) siemensNet.getByteTransform().TransInt16(result.Content, 24)); // 26 + crnProtocol.setZSpeed((float) siemensNet.getByteTransform().TransInt16(result.Content, 26)); // 28 + // 绱閲岀▼銆佹椂闀� + crnProtocol.setXDuration((float) siemensNet.getByteTransform().TransInt32(result.Content, 88)); // 90 + crnProtocol.setYDistance((float) siemensNet.getByteTransform().TransInt32(result.Content, 92)); // 94 + crnProtocol.setXDuration((float) siemensNet.getByteTransform().TransInt32(result.Content, 96)); // 98 + crnProtocol.setYDuration((float) siemensNet.getByteTransform().TransInt32(result.Content, 100)); // 102 + // 澧炲己 if (crnProtocol.getForkHome()) { crnProtocol.setForkPos(CrnForkPosType.HOME); @@ -230,6 +243,9 @@ log.error("鍫嗗灈鏈哄啓鍏ュ懡浠や负绌�"); return false; } + if (command.getTaskNo() == 0) { + command.setTaskNo((short) 9999); + } command.setCrnNo(slave.getId()); short[] array = new short[9]; if (!command.getTaskModeType().equals(CrnTaskModeType.CLEAR)) { @@ -246,15 +262,14 @@ array[7] = command.getSourceStaNo(); array[8] = command.getDestinationStaNo(); // 浣滀笟淇℃伅 - OperateResult result = siemensNet.Write("DB10.0", array); + OperateResult result = siemensNet.Write("DB1000.0", array); // 浠诲姟鍙� - OperateResult result1 = siemensNet.Write("DB10.24", command.getTaskNo()); + OperateResult result1 = siemensNet.Write("DB1000.24", command.getTaskNo()); // 缁撴潫浣� - OperateResult result2 = siemensNet.Write("DB10.28.1", true); - if (result.IsSuccess && result1.IsSuccess && result2.IsSuccess) { - - try { - // 鏃ュ織璁板綍 + OperateResult result2 = siemensNet.Write("DB1000.28.1", true); + // 鏃ュ織璁板綍 + try { + if (command.getAckFinish() != 1) { BasCrnOptService bean = SpringUtils.getBean(BasCrnOptService.class); BasCrnOpt basCrnOpt = new BasCrnOpt( command.getTaskNo().intValue(), // 浠诲姟鍙� @@ -264,17 +279,20 @@ command.getSourcePosX().intValue(), // 婧愭帓 command.getSourcePosY().intValue(), // 婧愬垪 command.getSourcePosZ().intValue(), // 婧愬眰 - command.getSourceStaNo().intValue(), // 婧愮珯 + null, // 婧愮珯 command.getDestinationPosX().intValue(), // 鐩爣鎺� command.getDestinationPosY().intValue(), // 鐩爣鍒� command.getDestinationPosZ().intValue(), // 鐩爣灞� - command.getDestinationStaNo().intValue(), // 鐩爣绔� + null, // 鐩爣绔� null, // 鍝嶅簲缁撴灉 null, // 淇敼鏃堕棿 null // 淇敼浜哄憳 ); bean.insert(basCrnOpt); - } catch (Exception ignore) {} + } + } catch (Exception ignore) {} + + if (result.IsSuccess && result1.IsSuccess && result2.IsSuccess) { log.info("鍫嗗灈鏈哄懡浠や笅鍙慬id:{}] >>>>> {}", slave.getId(), JSON.toJSON(command)); OutputQueue.CRN.offer(MessageFormat.format("銆恵0}銆慬id:{1}] >>>>> 鍛戒护涓嬪彂锛� {2}", DateUtils.convert(new Date()), slave.getId(), JSON.toJSON(command))); -- Gitblit v1.9.1