From 1f46976c9ee72d7889fceee968db9c8aef885eca Mon Sep 17 00:00:00 2001 From: liurunyu <lry9898@163.com> Date: 星期一, 28 十月 2024 17:28:15 +0800 Subject: [PATCH] 远程监控中开关阀记录查询重构,增加了水价信息,调整了显示内容,优化SQL语句,开闭阀类型改为通信协议中的Common*.*.java中的统一匹配。 --- pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_C0_Up.java | 112 ++++++++++++------------------------------------------- 1 files changed, 25 insertions(+), 87 deletions(-) diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_C0_Up.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_C0_Up.java index 5ef3642..44d376c 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_C0_Up.java +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_C0_Up.java @@ -3,6 +3,7 @@ import com.dy.common.mw.protocol.*; import com.dy.common.mw.protocol.p206V1_0_0.*; import com.dy.common.mw.protocol.p206V1_0_0.parse.global.GlParse; +import com.dy.common.mw.protocol.p206V1_0_0.upVos.DataCdC0Vo; import com.dy.common.util.ByteUtil; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -28,7 +29,7 @@ para.upCode, para.data) ; } - log.info("鍒嗘瀽涓婅鏁版嵁<" + CodeV1_0_1.getCodeName(para.upCode) + " RTU鍦板潃=" + para.rtuAddr + ">:\n" + para.data.toString()); + log.info("\n鍒嗘瀽鍛戒护搴旂瓟鏁版嵁<" + CodeV1_0_1.getCodeName(para.upCode) + " RTU鍦板潃=" + para.rtuAddr + ">:\n" + para.data.toString()); MidResultFromRtu midRs = new MidResultFromRtu() ; midRs.protocolName = para.protocolName ;//鍗忚鍚嶇О @@ -58,6 +59,7 @@ confirmCommand.rtuAddr = para.rtuAddr ;//Rtu鍦板潃 confirmCommand.commandId = Command.defaultId ;//鍛戒护ID锛屽彂璧峰懡浠ょ殑瀹㈡埛绔�(web绔�)鐢熸垚锛屼互鍖归厤鍛戒护缁撴灉 confirmCommand.downCode = confirmComCode ;//涓嬭鍛戒护鍔熻兘鐮�; + confirmCommand.downCodeName = CodeV1_0_1.getCodeName(confirmComCode) ;//涓嬭鍛戒护鍔熻兘鐮佸悕绉�; confirmCommand.downBuffer = data ;//涓嬭鍛戒护鏁版嵁 confirmCommand.downBufHex = ByteUtil.bytes2Hex(data, true) ;//涓嬭鍛戒护鏁版嵁鍗佸叚杩涘埗褰㈠紡 confirmCommand.hasResponse = false ;//鏄惁鏈夊簲绛� @@ -119,99 +121,39 @@ */ if(hasWaterAmount){ //鐬椂娴侀噺锛�5瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0~9999999.999锛屽崟浣嶄负m3/h銆� - cdData.instantAmount = 0.0D ; - int tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; - index++ ; - cdData.instantAmount += tpInt/1000.0 ; - tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; - index++ ; - cdData.instantAmount += tpInt/10.0 ; - tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; - index++ ; - cdData.instantAmount += tpInt * 10.0 ; - tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; - index++ ; - cdData.instantAmount += tpInt * 1000.0 ; - tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; - index++ ; - cdData.instantAmount += tpInt * 100000.0 ; + int tpInt = ByteUtil.BCD2Int_LE(bs, index, index + 4) ; + cdData.instantAmount = tpInt/1000.0 ; - //绱娴侀噺锛�5瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0~9999999999锛屽崟浣嶄负m3銆� - cdData.totalAmount = 0.0D ; - tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; - index++ ; - cdData.totalAmount += tpInt; - tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; - index++ ; - cdData.totalAmount += tpInt * 100.0 ; - tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; - index++ ; - cdData.totalAmount += tpInt * 10000.0 ; - tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; - index++ ; - cdData.totalAmount += tpInt * 1000000.0 ; - tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; - index++ ; - cdData.totalAmount += tpInt * 100000000.0 ; + index += 5 ; + //绱娴侀噺锛�5瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0~99999999.99锛屽崟浣嶄负m3銆� + tpInt = ByteUtil.BCD2Int_LE(bs, index, index + 4) ; + cdData.totalAmount = tpInt/100.0; + index += 5 ; //鎹熷け娴侀噺锛�5瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0~9999999999锛屽崟浣嶄负m3銆� - cdData.lossAmount = 0.0D ; - tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; - index++ ; - cdData.lossAmount += tpInt; - tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; - index++ ; - cdData.lossAmount += tpInt * 100.0 ; - tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; - index++ ; - cdData.lossAmount += tpInt * 10000.0 ; - tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; - index++ ; - cdData.lossAmount += tpInt * 1000000.0 ; - tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; - index++ ; - cdData.lossAmount += tpInt * 100000000.0 ; + tpInt = ByteUtil.BCD2Int_LE(bs, index, index + 4) ; + cdData.lossAmount = tpInt/100.0; + + index += 5 ; } if(hasWaterPress){ //姘村帇锛�4瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0~999999.99锛屽崟浣嶄负KPa銆� - cdData.waterPress = 0.0D ; - int tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; - index++ ; - cdData.waterPress += tpInt/100.0 ; - tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; - index++ ; - cdData.waterPress += tpInt; - tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; - index++ ; - cdData.waterPress += tpInt * 100.0 ; - tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; - index++ ; - cdData.waterPress += tpInt * 10000.0 ; + int tpInt = ByteUtil.BCD2Int_LE(bs, index, index + 3) ; + cdData.waterPress = tpInt/100.0 ; + index += 4 ; } if(hasEleVolt){ //鐢垫睜鐢靛帇锛�2瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0~99.99锛屽崟浣嶄负V銆� - cdData.batteryVolt = 0.0D ;//钃勭數姹犵數鍘� - cdData.sunVolt = 0.0D ;//澶槼鑳界數鍘� - int tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; - index++ ; - cdData.batteryVolt += tpInt/100.0 ; - tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; - index++ ; - cdData.batteryVolt += tpInt; -// //澶槼鑳界數鍘嬶細4瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0~99.99锛屽崟浣嶄负V銆� -// tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; -// index++ ; -// cdData.sunVolt += tpInt/100.0 ; -// tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; -// index++ ; -// cdData.sunVolt += tpInt; + //钃勭數姹犵數鍘� + int tpInt = ByteUtil.BCD2Int_LE(bs, index, index + 1) ; + cdData.batteryVolt = tpInt/100.0 ; + index += 2 ; } if(hasSignal){ //淇″彿寮哄害锛�1瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0~99銆� - cdData.signalValue = 0 ; int tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + cdData.signalValue = tpInt ; index++ ; - cdData.signalValue += tpInt ; } if(hasAlarmStatus){ //鎶ヨ鏁版嵁 @@ -223,14 +165,10 @@ } //姘翠环锛�2瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0~99.99锛屽崟浣嶄负鍏冦�� - cdData.waterPrice = 0.0D ;//姘翠环 - int tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; - index++ ; - cdData.waterPrice += tpInt/100.0 ; - tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; - index++ ; - cdData.waterPrice += tpInt; + int tpInt = ByteUtil.BCD2Int_LE(bs, index, index + 1) ; + cdData.waterPrice = tpInt/100.0 ; + index += 2 ; cdData.rtuDt = GlParse.parseTp(bs, index) ; } -- Gitblit v1.8.0