|  |  |  | 
|---|
|  |  |  | package com.dy.common.mw.protocol.p206V202404.parse.global; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.dy.common.mw.protocol.p206V202404.CommonV202404; | 
|---|
|  |  |  | import com.dy.common.mw.protocol.p206V202404.ProtocolConstantV206V202404; | 
|---|
|  |  |  | import com.dy.common.mw.protocol.p206V202404.upVos.*; | 
|---|
|  |  |  | import com.dy.common.util.ByteUtil; | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 分析状态与报警 | 
|---|
|  |  |  | * @param bs | 
|---|
|  |  |  | * @param index | 
|---|
|  |  |  | * @param bs 上报数据的字节数组 | 
|---|
|  |  |  | * @param index 当前解析数组下标位置 | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public static void parseAlarmAndState(byte[] bs, int index, AlarmVo vo){ | 
|---|
|  |  |  | byte b = bs[index + 1] ; | 
|---|
|  |  |  | byte b = bs[index] ; | 
|---|
|  |  |  | vo.statePump = (byte)(b & 0x1) ; | 
|---|
|  |  |  | vo.alarmWaterRemain = (byte)(b >> 1 & 1) ; | 
|---|
|  |  |  | vo.alarm0WaterRemain = (byte)(b >> 2 & 1) ; | 
|---|
|  |  |  | vo.alarmExceedYear = (byte)(b >> 3 & 1) ; | 
|---|
|  |  |  | vo.alarmWaterMeterFault = (byte)(b >> 4 & 1) ; | 
|---|
|  |  |  | vo.alarmSteal = (byte)(b >> 5 & 1) ; | 
|---|
|  |  |  | vo.alarmWaterMeterBreak = (byte)(b >> 6 & 1) ; | 
|---|
|  |  |  | vo.alarmEleMeterFault = (byte)(b >> 7 & 1) ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | b = bs[index] ; | 
|---|
|  |  |  | //与测控一体阀兼容 | 
|---|
|  |  |  | if(vo.statePump == 0){ | 
|---|
|  |  |  | vo.statePump = (byte)1; | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | vo.statePump = (byte)0; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | vo.alarmWaterRemain = (byte)((b >> 1) & 1) ; | 
|---|
|  |  |  | vo.alarm0WaterRemain = (byte)((b >> 2) & 1) ; | 
|---|
|  |  |  | vo.alarmExceedYear = (byte)((b >> 3) & 1) ; | 
|---|
|  |  |  | vo.alarmWaterMeterFault = (byte)((b >> 4) & 1) ; | 
|---|
|  |  |  | vo.alarmSteal = (byte)((b >> 5) & 1) ; | 
|---|
|  |  |  | vo.alarmWaterMeterBreak = (byte)((b >> 6) & 1) ; | 
|---|
|  |  |  | vo.alarmEleMeterFault = (byte)((b >> 7) & 1) ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | b = bs[index + 1] ; | 
|---|
|  |  |  | vo.alarm0MoneyRemain = (byte)(b & 0x1) ; | 
|---|
|  |  |  | vo.alarmInnerDoor = (byte)(b >> 1 & 1) ; | 
|---|
|  |  |  | vo.alarmOuterDoor = (byte)(b >> 2 & 1) ; | 
|---|
|  |  |  | vo.alarmEleMiss = (byte)(b >> 3 & 1) ; | 
|---|
|  |  |  | vo.alarmEleExceed = (byte)(b >> 4 & 1) ; | 
|---|
|  |  |  | vo.alarmEleLowVolt = (byte)(b >> 5 & 1) ; | 
|---|
|  |  |  | vo.stateIcEnable = (byte)(b >> 6 & 1) ; | 
|---|
|  |  |  | vo.alarmDoor = (byte)((b >> 1) & 1) ; | 
|---|
|  |  |  | vo.alarmBatteryVolt = (byte)((b >> 2) & 1) ; | 
|---|
|  |  |  | vo.alarmEleMiss = (byte)((b >> 3) & 1) ; | 
|---|
|  |  |  | vo.alarmEleExceed = (byte)((b >> 4) & 1) ; | 
|---|
|  |  |  | vo.alarmEleLowVolt = (byte)((b >> 5) & 1) ; | 
|---|
|  |  |  | vo.stateIcEnable = (byte)((b >> 6) & 1) ; | 
|---|
|  |  |  | vo.stateOpClValve = (byte)((b >> 7) & 1) ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | b = bs[index + 2] ; | 
|---|
|  |  |  | vo.alarmBlockValve = (byte)(b & 0x1) ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public static String parseTp(byte[] bs, short index){ | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | index += 5 ; | 
|---|
|  |  |  | Long moneyRemain = ByteUtil.BCD2Long_LE(bs, index, index + 4) ; | 
|---|
|  |  |  | cdData.moneyRemain = moneyRemain/100.0D; | 
|---|
|  |  |  | cdData.moneyRemain = moneyRemain/10000.0D; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | index += 5 ; | 
|---|
|  |  |  | Long waterRemain = ByteUtil.BCD2Long_LE(bs, index, index + 4) ; | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | index += 4 ; | 
|---|
|  |  |  | int thisMoney = ByteUtil.BCD2Int_LE(bs, index, index + 3) ; | 
|---|
|  |  |  | cdData.thisMoney = thisMoney/100.0D; | 
|---|
|  |  |  | cdData.thisMoney = thisMoney/10000.0D; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | index += 4 ; | 
|---|
|  |  |  | cdData.thisDuration = ByteUtil.BCD2Int_LE(bs, index, index + 1) ; | 
|---|
|  |  |  | 
|---|
|  |  |  | cdData.projectNo = (int)bs[index]; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | index ++ ; | 
|---|
|  |  |  | cdData.opType = bs[index]; | 
|---|
|  |  |  | cdData.clType = bs[index]; | 
|---|
|  |  |  | //进行兼容转换 | 
|---|
|  |  |  | cdData.clType = CommonV202404.closeType2P206V1(cdData.clType) ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | index++ ; | 
|---|
|  |  |  | cdData.icCardAddr = ByteUtil.bytes2Hex(bs, false, index, 4) ; | 
|---|
|  |  |  | 
|---|
|  |  |  | cdData.eleTotalAmount = ByteUtil.BCD2Long_LE(bs, index, index + 4)/100.0D ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | index += 5 ; | 
|---|
|  |  |  | cdData.moneyRemain = ByteUtil.BCD2Long_LE(bs, index, index + 4)/100.0D ; | 
|---|
|  |  |  | cdData.moneyRemain = ByteUtil.BCD2Long_LE(bs, index, index + 4)/10000.0D ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | index += 5 ; | 
|---|
|  |  |  | cdData.waterRemain = ByteUtil.BCD2Long_LE(bs, index, index + 4)/100.0D ; | 
|---|
|  |  |  | 
|---|
|  |  |  | cdData.thisWater = ByteUtil.BCD2Long_LE(bs, index, index + 3)/100.0D ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | index += 4 ; | 
|---|
|  |  |  | cdData.thisMoney = ByteUtil.BCD2Long_LE(bs, index, index + 3)/100.0D ; | 
|---|
|  |  |  | cdData.thisMoney = ByteUtil.BCD2Long_LE(bs, index, index + 3)/10000.0D ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | index += 4 ; | 
|---|
|  |  |  | cdData.thisDuration = ByteUtil.BCD2Int_LE(bs, index, index + 1) ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | index += 2 ; | 
|---|
|  |  |  | GlParse.parseAlarmAndState(bs, index, cdData) ;//四个字节 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | index += 4 ; | 
|---|
|  |  |  | cdData.price = ByteUtil.BCD2Int_LE(bs, index, index + 1)/100.0 ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 分析功能93、A3数据 | 
|---|
|  |  |  | 
|---|
|  |  |  | * @param cdData | 
|---|
|  |  |  | * @throws Exception | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public static void parseCd93A3(byte[] bs, DataCd93_A3Vo cdData) throws Exception { | 
|---|
|  |  |  | public static void parseCd93A3(byte[] bs, DataCd93_9D_A3Vo cdData) throws Exception { | 
|---|
|  |  |  | int index = ProtocolConstantV206V202404.dataIndex ; | 
|---|
|  |  |  | cdData.controllerType = ByteUtil.bytes2Hex(bs, false, index, 1) ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | cdData.projectNo = (int)bs[index]; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | index ++ ; | 
|---|
|  |  |  | cdData.opResult = bs[index]; | 
|---|
|  |  |  | cdData.clResult = bs[index]; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | index ++ ; | 
|---|
|  |  |  | cdData.opType = bs[index]; | 
|---|
|  |  |  | cdData.clType = bs[index]; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | index++ ; | 
|---|
|  |  |  | cdData.icCardAddr = ByteUtil.bytes2Hex(bs, false, index, 4) ; | 
|---|
|  |  |  | 
|---|
|  |  |  | index += 8 ; | 
|---|
|  |  |  | cdData.orderNo = ByteUtil.BCD2String_BE(bs, index, index + 7) ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(cdData.clResult == (byte)0x81){ | 
|---|
|  |  |  | //2025-06-11 王江海安排 | 
|---|
|  |  |  | //失败了,下面就没有数据了 | 
|---|
|  |  |  | return ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | index += 8 ; | 
|---|
|  |  |  | cdData.startDt  = GlParse.parseRtuDt(bs, index) ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | index += 6 ; | 
|---|
|  |  |  | cdData.endDt  = GlParse.parseRtuDt(bs, index) ; | 
|---|
|  |  |  | 
|---|
|  |  |  | cdData.eleTotalAmount = ByteUtil.BCD2Long_LE(bs, index, index + 4)/100.0D ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | index += 5 ; | 
|---|
|  |  |  | cdData.moneyRemain = ByteUtil.BCD2Long_LE(bs, index, index + 4)/100.0D ; | 
|---|
|  |  |  | cdData.moneyRemain = ByteUtil.BCD2Long_LE(bs, index, index + 4)/10000.0D ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | index += 5 ; | 
|---|
|  |  |  | cdData.waterRemain = ByteUtil.BCD2Long_LE(bs, index, index + 4)/100.0D ; | 
|---|
|  |  |  | 
|---|
|  |  |  | cdData.thisWater = ByteUtil.BCD2Long_LE(bs, index, index + 3)/100.0D ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | index += 4 ; | 
|---|
|  |  |  | cdData.thisMoney = ByteUtil.BCD2Long_LE(bs, index, index + 3)/100.0D ; | 
|---|
|  |  |  | cdData.thisMoney = ByteUtil.BCD2Long_LE(bs, index, index + 3)/10000.0D ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | index += 4 ; | 
|---|
|  |  |  | cdData.thisDuration = ByteUtil.BCD2Int_LE(bs, index, index + 1) ; | 
|---|