|  |  | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * @Author liurunyu | 
 |  |  |  * @Date 2024/4/10 18:51 | 
 |  |  |  * @LastEditTime 2024/4/10 18:51 | 
 |  |  |  * @Description | 
 |  |  |  * @Date 2024/4/10 18:26 | 
 |  |  |  * @LastEditTime 2024/4/10 18:26 | 
 |  |  |  * @Description 设置水价 | 
 |  |  |  */ | 
 |  |  | @AnnotationCodeDown(ifAny={ | 
 |  |  |         CodeV1_0_1.cd_3D | 
 |  |  | 
 |  |  |         MidResultToRtu midRs = new MidResultToRtu() ; | 
 |  |  |         midRs.rtuResultSendWebUrl = para.rtuResultSendWebUrl ;//rtu返回命令结果 发向目的地web URL | 
 |  |  |         midRs.protocolName = para.protocolName ;//协议名称 | 
 |  |  |         midRs.rtuAddr = para.rtuAddr ;//Rtu地址(电信平台设备IMEI) | 
 |  |  |         midRs.rtuAddr = para.rtuAddr ;//Rtu地址 | 
 |  |  |         midRs.commandId = para.commandId ;//命令ID,发起命令的客户端(web端)生成,以匹配命令结果 | 
 |  |  |         midRs.downCode = para.commandCode ;//下行命令功能码; | 
 |  |  |         midRs.downCodeName = CodeV1_0_1.getCodeName(para.commandCode) ;//下行命令功能码名称; | 
 |  |  |         midRs.downBuffer = bs ;//下行命令数据 | 
 |  |  |         midRs.downBufHex = ByteUtil.bytes2Hex(bs, true) ;//下行命令数据十六进制形式 | 
 |  |  |         midRs.hasResponse = true ;//是否有应答 | 
 |  |  | 
 |  |  |             throw new Exception("未提供命令参数数据,不能构造功能码为" + para.commandCode + "的下行命令") ; | 
 |  |  |         }else{ | 
 |  |  |             index = 0 ; | 
 |  |  |             byte[] bs = new byte[12] ; | 
 |  |  |             String icCardNo = ((String)para.param) ; | 
 |  |  |             Integer icCardNoInt = Integer.valueOf(icCardNo); | 
 |  |  |             ByteUtilUnsigned.int2Bytes_LE(bs, icCardNoInt, index); | 
 |  |  |             index += 4 ; | 
 |  |  |             byte[] bs = new byte[10] ; | 
 |  |  |             Double priceDb = ((Double)para.param) * 100 ; | 
 |  |  |             Integer priceInt = priceDb.intValue() ; | 
 |  |  |             ByteUtilUnsigned.short2Bytes_LE(bs, priceInt.shortValue(), index); | 
 |  |  |             index += 2 ; | 
 |  |  |             GlCreate.createPw(bs, index); | 
 |  |  |             index += 2 ; | 
 |  |  |             GlCreate.createTp(bs, index); | 
 |  |  | 
 |  |  |         return bytes ; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | } | 
 |  |  | } |