From 959dcca95276888cd9c092d93d276ef9aa580aef Mon Sep 17 00:00:00 2001 From: liurunyu <lry9898@163.com> Date: 星期三, 30 四月 2025 16:26:19 +0800 Subject: [PATCH] 1、增加远程透传命令; 2、表阀一体机协议优化; --- pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V2/DriverV2.java | 43 +++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 41 insertions(+), 2 deletions(-) diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V2/DriverV2.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V2/DriverV2.java index 614e5b6..5913d26 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V2/DriverV2.java +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V2/DriverV2.java @@ -1,7 +1,7 @@ package com.dy.common.mw.protocol.p206V2; import com.dy.common.mw.protocol.*; -import com.dy.common.mw.protocol.p206V1.ProtocolConstantV206V1; +import com.dy.common.mw.protocol.p206V2.parse.TransparentDown; import com.dy.common.util.DateTime; @AnnotationDriver(enable = true, @@ -110,7 +110,7 @@ } @Override public void notify(NotifyInfo ...infos) { - notify.notify(rtuAddr, ProtocolConstantV206V1.protocolName, ProtocolConstantV206V1.protocolVer, infos); + notify.notify(rtuAddr, ProtocolConstantV206V2.protocolName, ProtocolConstantV206V2.protocolVer, infos); } }); } @@ -168,5 +168,44 @@ } } + /** + * 鏋勯�犱笅琛岄�忎紶鏁版嵁锛堝懡浠わ級 + * @param isLowPower 鏄惁鍦ㄤ綆鍔熻�楃幆澧冧笅杩愯 + * @param command 鍛戒护 + * @return MidResult[] + */ + @Override + public MidResult[] transparentCommand(Boolean isLowPower, Command command, Object... params){ + this.clear(); + String RtuResultSendWebUrl = command.getRtuResultSendWebUrl() ; + if(RtuResultSendWebUrl == null || RtuResultSendWebUrl.trim().equals("")){ + return new MidResult[]{(new MidResultError(ProtocolConstantV206V2.protocolName, null, "涓ラ噸閿欒锛屽懡浠や腑rtu杩斿洖鍛戒护缁撴灉鍙戝悜鐩殑鍦皐eb URL涓虹┖锛屼笉鑳芥瀯寤轰换浣曞懡浠わ紒", null))} ; + } + String rtuAddr = command.getRtuAddr() ; + if(rtuAddr == null || rtuAddr.trim().equals("")){ + return new MidResult[]{(new MidResultError(ProtocolConstantV206V2.protocolName, null, "涓ラ噸閿欒锛屽懡浠や腑Rtu鍦板潃涓虹┖锛屼笉鑳芥瀯寤轰换浣曞懡浠わ紒", null))} ; + } + try { + String commandCode = command.getCode() ; + + this.downCpParams.setValue( + RtuResultSendWebUrl, + ProtocolConstantV206V2.protocolName, + command.protocolVersion==null?ProtocolConstantV206V2.protocolVer:command.protocolVersion, + rtuAddr, + command.getId(), + commandCode, + command.getParam(), + command.getAttachment()); + + if(commandCode == null){ + return new MidResult[]{(new MidResultError(ProtocolConstantV206V2.protocolName, rtuAddr, "涓ラ噸閿欒锛屽懡浠や腑鍔熻兘鐮佷负绌猴紝涓嶈兘鏋勫缓浠讳綍鍛戒护锛�", null))} ; + }else{ + return new TransparentDown().parse(isLowPower, this.downCpParams, null); + } + } catch (Exception e) { + return new MidResult[]{(new MidResultError(ProtocolConstantV206V2.protocolName, rtuAddr, "涓ラ噸閿欒锛屾瀯閫犱笅琛屾暟鎹嚭閿欙紒鍛戒护涓猴細" + command.toString(), e))} ; + } + } } \ No newline at end of file -- Gitblit v1.8.0