From 6dba613b20244677543795eb91d18ce54d612c27 Mon Sep 17 00:00:00 2001 From: liurunyu <lry9898@163.com> Date: 星期四, 27 六月 2024 13:44:01 +0800 Subject: [PATCH] 靳总协议上行数据处理修改完善 --- pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_84_Up.java | 80 +++++++++++++++++----------------------- 1 files changed, 34 insertions(+), 46 deletions(-) diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_84_Up.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_84_Up.java index ad0b1b9..fe33156 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_84_Up.java +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_84_Up.java @@ -3,12 +3,13 @@ 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.DataCd84Vo; import com.dy.common.util.ByteUtil; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @AnnotationCodeUp(ifAny={ - CodeV1_0_1.cd_83 + CodeV1_0_1.cd_84 }) @SuppressWarnings("unused") public class Cd_84_Up implements CodeParse { @@ -40,9 +41,10 @@ midRs.reportOrResponse_trueOrFalse = true ;//涓诲姩涓婃姤 - String confirmComCode = CodeV1_0_1.cd_C0 ; + String confirmComCode = para.upCode ; ParseParamsForDownV1_0_1 downCpParams = new ParseParamsForDownV1_0_1() ; downCpParams.setValue( + null, ProtocolConstantV206V1_0_0.protocolName, para.rtuAddr, Command.defaultId, @@ -61,8 +63,13 @@ confirmCommand.downBufHex = ByteUtil.bytes2Hex(data, true) ;//涓嬭鍛戒护鏁版嵁鍗佸叚杩涘埗褰㈠紡 confirmCommand.hasResponse = false ;//鏄惁鏈夊簲绛� confirmCommand.maxSendTimes = 1 ;//鍛戒护鏈�澶у彂閫佹鏁�(褰撴敹涓嶅埌搴旂瓟鏃讹紝灏嗛噸鍙�2娆�)锛屽鏋滀笉璁剧疆锛屽懡浠ょ紦瀛樺櫒杩涜琛ュ厖璁剧疆 - confirmCommand.isSendFirst = true ;//纭鍛戒护锛屼紭鍏堝彂閫� confirmCommand.isCachForOffLine = false ;//RTU涓嶅湪绾匡紝鍛戒护鏄惁缂撳瓨 + + confirmCommand.isSendFirst = true ;//纭鍛戒护锛屼紭鍏堝彂閫� + if(isLowPower != null && isLowPower.booleanValue()){ + //浣庡姛鑰楁椂锛屽敖蹇彂閫� + confirmCommand.isQuickSend = true ; + } callback.callback(midRs.reportOrResponse_trueOrFalse); return new MidResult[]{midRs, confirmCommand} ; @@ -78,63 +85,44 @@ protected void doParse(byte[] bs, int bsLen, String dataCode, Data data) throws Exception { DataV1_0_1 dV1 = (DataV1_0_1)data.getSubData() ; DataCd84Vo cdData = new DataCd84Vo() ; - dV1.dataCd84Vo = cdData ; + dV1.subData = cdData ; short index = ProtocolConstantV206V1_0_0.dataIndex ; - //鐢ㄦ按鎴峰彿鏁版嵁鏍煎紡锛�5瀛楄妭BCD鐮佷綆浣嶅湪鍓嶉珮浣嶅湪鍚庛�� - cdData.clientNum = ByteUtil.BCD2String_LE(bs, index, index + 4) ; - index += 5 ; + //cdData.opType = bs[index] ; + //index++ ; + //cdData.cardType = bs[index] ; + + //index++ ; + //cdData.cardAddr = ByteUtil.bytes2Hex(bs, false, index, 4) ; + + //index += 4 ; + //鐢ㄦ按鎴峰彿鏁版嵁鏍煎紡锛�5瀛楄妭BCD鐮佷綆浣嶅湪鍓嶉珮浣嶅湪鍚庛�� + cdData.cardNo = ByteUtil.BCD2String_LE(bs, index, index + 4) ; + + index += 5 ; //鐢ㄦ按鎴蜂綑棰濓細鐢ㄦ埛浣欓4瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0.00~999999.99锛屽崟浣嶄负鍏冦�� cdData.remainMoney = 0.0D ; - int tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; - index++ ; + int tpInt = ByteUtil.BCD2Int_LE(bs, index, index + 3) ; cdData.remainMoney += tpInt/100.0 ; - tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; - index++ ; - cdData.remainMoney += tpInt; - tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; - index++ ; - cdData.remainMoney += tpInt * 100.0 ; - tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; - index++ ; - cdData.remainMoney += tpInt * 10000.0 ; + index += 4 ; //绱娴侀噺锛�5瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0~9999999999锛屽崟浣嶄负m3銆� cdData.totalAmount = 0.0D ; - tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; - index++ ; + tpInt = ByteUtil.BCD2Int_LE(bs, index, index + 4) ; 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~9999999.999锛屽崟浣嶄负m3/h銆� cdData.instantAmount = 0.0D ; - tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; - index++ ; + tpInt = ByteUtil.BCD2Int_LE(bs, index, index + 4) ; 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 ; + + index += 5 ; + cdData.alarmVo = GlParse.parseAlarm(bs, index) ; + index += 2 ; + cdData.stateVo = GlParse.parseState(bs, index) ; + index += 2 ; //鎺у埗鍣ㄦ椂閽� cdData.rtuDt = GlParse.parseTp(bs, index) ; -- Gitblit v1.8.0