From aec4636e4fb430055feb66751da0e6c05bb864df Mon Sep 17 00:00:00 2001 From: zuoxiao <470321431@qq.com> Date: 星期三, 30 四月 2025 16:25:30 +0800 Subject: [PATCH] fix(irrigatePlan): 修复终止灌溉计划时长设置错误- 将终止计划的默认时长从 9999 修改为 0 - 此修改确保在终止灌溉计划时,不会出现时长设置过长的问题 --- pipIrr-platform/pipIrr-web/pipIrr-mwTest-rtu/src/main/java/com/dy/pipIrrMwTestRtu/tcpClient/upData/UpCd81.java | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 59 insertions(+), 0 deletions(-) diff --git a/pipIrr-platform/pipIrr-web/pipIrr-mwTest-rtu/src/main/java/com/dy/pipIrrMwTestRtu/tcpClient/upData/UpCd81.java b/pipIrr-platform/pipIrr-web/pipIrr-mwTest-rtu/src/main/java/com/dy/pipIrrMwTestRtu/tcpClient/upData/UpCd81.java new file mode 100644 index 0000000..935cab7 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-mwTest-rtu/src/main/java/com/dy/pipIrrMwTestRtu/tcpClient/upData/UpCd81.java @@ -0,0 +1,59 @@ +package com.dy.pipIrrMwTestRtu.tcpClient.upData; + +import com.dy.common.mw.protocol.p206V1.parse.global.GlCreate; +import com.dy.common.util.ByteUtil; +import com.dy.pipIrrMwTestRtu.ServerProperties; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +/** + * @Author: liurunyu + * @Date: 2024/7/31 16:29 + * @Description + */ +public class UpCd81 extends UpData { + + private static final Logger log = LogManager.getLogger(UpCd81.class); + + public static void upData() { + try { + if (UpData.session != null && UpData.session.isConnected()) { + byte[] bs = createData(ServerProperties.rtuAddr); + UpData.upSend(bs); + } else { + log.error("鏈繛鎺ラ�氫俊涓棿浠讹紝涓嶈兘鍙戦�佹暟鎹�"); + } + } catch (Exception e) { + log.error("鍚戦�氫俊涓棿浠跺彂閫佹暟鎹骇鐢熷紓甯�", e); + } + } + + + /** + * 鏋勯�犳暟鎹� + * + * @return 瀛楄妭鏁扮粍 + * @throws Exception 寮傚父 + */ + private static byte[] createData(String rtuAddr) throws Exception { + byte[] bytes = creatHead(rtuAddr, "81", (byte)0xB0); + + byte[] bs = new byte[2] ; + bs[0] = (byte)0xDF ;//鎶ヨ + bs[1] = (byte)0xF9 ;//鎶ヨ + bytes = ByteUtil.bytesMerge(bytes, bs) ; + + bs = new byte[2] ; + bs[0] = (byte)0x00 ;//鐘舵�� + bs[1] = (byte)0x00 ;//鐘舵�� + bytes = ByteUtil.bytesMerge(bytes, bs) ; + + GlCreate.createLen(bytes);//闀垮害鏀惧瓧鑺傛暟缁勪腑 + + byte[] bsTail = GlCreate.createCrcTail4P206(bytes) ;//CRC鍜屽熬鍙犲姞瀛楄妭鏁扮粍涓� + + bytes = ByteUtil.bytesMerge(bytes, bsTail) ; + + return bytes ; + } +} -- Gitblit v1.8.0