| | |
| | | package com.dy.pipIrrMwTestWeb.test; |
| | | |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.downVos.ComCd10Vo; |
| | | import com.dy.common.mw.protocol.p206V202404.downVos.ComCd15Vo; |
| | | import com.dy.common.mw.protocol.p206V202404.downVos.ComCd65Vo; |
| | | import com.dy.common.mw.protocol.p206V202404.downVos.*; |
| | | import com.dy.common.webUtil.BaseResponse; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | |
| | | * @return |
| | | */ |
| | | public BaseResponse test(){ |
| | | //return this.connect() ; |
| | | return this.cd50() ; |
| | | //return this.connect() ;//连接通信中间件测试 |
| | | //return this.cdXY(CodeV202404.cd_50) ;//发送固定参数的命令 |
| | | return this.cd65(2) ; |
| | | } |
| | | |
| | | /** |
| | |
| | | return this.sendTest() ; |
| | | } |
| | | |
| | | //发送固定参数的命令 |
| | | private BaseResponse cdXY(String code){ |
| | | return this.sendCom2Mw(this.command(code, this.comCdXyVo(), null)) ; |
| | | } |
| | | |
| | | //设置终端地址(AFN=0x10H) |
| | | private BaseResponse cd10(){ |
| | | ComCd10Vo comVo = new ComCd10Vo() ; |
| | |
| | | comVo.rtuNewAddr = Test.rtuAddr ; |
| | | return this.sendCom2Mw(this.command(CodeV202404.cd_10, comVo, null)) ; |
| | | } |
| | | //查询设备终端地址(AFN=0x50H) |
| | | private BaseResponse cd50(){ |
| | | return this.sendCom2Mw(this.command(CodeV202404.cd_50, this.comCdXyVo(), null)) ; |
| | | } |
| | | //查询设备终端实时值(AFN=0x5BH) |
| | | private BaseResponse cd5B(){ |
| | | return this.sendCom2Mw(this.command(CodeV202404.cd_5B, this.comCdXyVo(), null)) ; |
| | | } |
| | | //查询设备终端用户用水记录(AFN=0x65H) |
| | | private BaseResponse cd65(){ |
| | | ComCd65Vo comVo = new ComCd65Vo() ; |
| | | comVo.controllerType = Test.controllerType ; |
| | | comVo.projectNo = Test.projectNo ; |
| | | comVo.page = 1 ; |
| | | return this.sendCom2Mw(this.command(CodeV202404.cd_65, comVo, null)) ; |
| | | } |
| | | //清除设备终端用户用水记录 (AFN=0x97H) |
| | | private BaseResponse cd97(){ |
| | | return this.sendCom2Mw(this.command(CodeV202404.cd_97, this.comCdXyVo(), null)) ; |
| | | } |
| | | //远程用户充值 (AFN=0x15H) |
| | | //远程用户充值 (AFN=0x15H) |
| | | private BaseResponse cd15(){ |
| | | ComCd15Vo comVo = new ComCd15Vo() ; |
| | | comVo.controllerType = Test.controllerType ; |
| | | comVo.projectNo = Test.projectNo ; |
| | | comVo.icCardAddr = "" ;//IC卡地址(8位数字或字母) |
| | | comVo.icCardNo = "" ;//用户卡序列号(17位数字)(6字节BCD,2字节HEX) |
| | | comVo.icCardAddr = Test.icCardAddr ;//IC卡地址(8位数字或字母) |
| | | comVo.icCardNo = Test.icCardNo ;//用户卡序列号(17位数字)(6字节BCD,2字节HEX) |
| | | comVo.chargeMoney = 123.45 ;//单位:元 2位小数点(最大值 99999999.99) |
| | | comVo.chargeWater = 123.45 ;//单位:m3 2位小数点(最大值 99999999.99) |
| | | comVo.flowNo = "" ;//流水号(12位数字) |
| | | comVo.chargeWater = 234.56 ;//单位:m3 2位小数点(最大值 99999999.99) |
| | | comVo.flowNo = "123456789012" ;//流水号(12位数字) |
| | | |
| | | return this.sendCom2Mw(this.command(CodeV202404.cd_15, comVo, null)) ; |
| | | } |
| | | //设置设备终端剩余水量和剩余金额报警值 (AFN=0x16H) |
| | | private BaseResponse cd16(){ |
| | | ComCd16Vo comVo = new ComCd16Vo() ; |
| | | comVo.controllerType = Test.controllerType ; |
| | | comVo.projectNo = Test.projectNo ; |
| | | comVo.waterAlarm = 10 ;//剩余水量报警值,单位:m3。整数,取值范围0~9999 |
| | | comVo.moneyAlarm = 11 ;//剩余金额报警值,单位:元。整数,取值范围0~9999 |
| | | |
| | | return this.sendCom2Mw(this.command(CodeV202404.cd_16, comVo, null)) ; |
| | | } |
| | | //设置设备终端IP地址 (AFN=0x21H) |
| | | private BaseResponse cd21(){ |
| | | ComCd21Vo comVo = new ComCd21Vo() ; |
| | | comVo.controllerType = Test.controllerType ; |
| | | comVo.projectNo = Test.projectNo ; |
| | | comVo.channel = 1 ;//IP通道号(取值范围 1、2). |
| | | comVo.ip = "111.222.123.321" ;//IP(例如 125.235.35.89) |
| | | comVo.port = 60000 ;///端口号(0~65536) |
| | | |
| | | return this.sendCom2Mw(this.command(CodeV202404.cd_21, comVo, null)) ; |
| | | } |
| | | //设置机井年最大开采量和水位下限 (AFN=0x22H) |
| | | private BaseResponse cd22(){ |
| | | ComCd22Vo comVo = new ComCd22Vo() ; |
| | | comVo.controllerType = Test.controllerType ; |
| | | comVo.projectNo = Test.projectNo ; |
| | | comVo.maxAmountYear = 12345 ;//机井年最大用水量单位:m3 整数,取值范围0~99999999 |
| | | comVo.limitLevel = 123.4; //水位下限 单位:m 取值范围:0~9999.99 |
| | | |
| | | return this.sendCom2Mw(this.command(CodeV202404.cd_22, comVo, null)) ; |
| | | } |
| | | //设置设备终端域名(AFN=0x23H) |
| | | private BaseResponse cd23(){ |
| | | ComCd23Vo comVo = new ComCd23Vo() ; |
| | | comVo.controllerType = Test.controllerType ; |
| | | comVo.projectNo = Test.projectNo ; |
| | | comVo.channel = 1 ;//IP通道号(取值范围 1、2). |
| | | comVo.domain = "www.baidu.com" ;//域名(例如 dayuyanjiuyuan.to),最大长度42字符 |
| | | comVo.port = 60000 ;///端口号(0~65536) |
| | | |
| | | return this.sendCom2Mw(this.command(CodeV202404.cd_23, comVo, null)) ; |
| | | } |
| | | //设置设备终端注册号(AFN=0x24H) |
| | | private BaseResponse cd24(){ |
| | | ComCd24Vo comVo = new ComCd24Vo() ; |
| | | comVo.controllerType = Test.controllerType ; |
| | | comVo.projectNo = Test.projectNo ; |
| | | comVo.registerNo = "102030405060708090" ;//域名(例如 dayuyanjiuyuan.to),最大长度42字符 |
| | | |
| | | return this.sendCom2Mw(this.command(CodeV202404.cd_24, comVo, null)) ; |
| | | } |
| | | //设置设备终端年用水量(AFN=0x24H) |
| | | private BaseResponse cd26(){ |
| | | ComCd26Vo comVo = new ComCd26Vo() ; |
| | | comVo.controllerType = Test.controllerType ; |
| | | comVo.projectNo = Test.projectNo ; |
| | | comVo.ipChannel = 1 ;//IP通道号 0x01:1通道 0x02:2通道. |
| | | comVo.maxAmountYear = 123456 ;//设备终端年用水量 单位:m3 整数,取值范围0~99999999 |
| | | |
| | | return this.sendCom2Mw(this.command(CodeV202404.cd_26, comVo, null)) ; |
| | | } |
| | | //设置设备终端用水有效(AFN=0x31H) |
| | | private BaseResponse cd31(){ |
| | | ComCd31Vo comVo = new ComCd31Vo() ; |
| | | comVo.controllerType = Test.controllerType ; |
| | | comVo.projectNo = Test.projectNo ; |
| | | comVo.valid = false ;//有效性 |
| | | |
| | | return this.sendCom2Mw(this.command(CodeV202404.cd_31, comVo, null)) ; |
| | | } |
| | | //查询遥测终端充值记录 (AFN=0x55H) |
| | | private BaseResponse cd55(int page){ |
| | | ComCd55Vo comVo = new ComCd55Vo() ; |
| | | comVo.controllerType = Test.controllerType ; |
| | | comVo.projectNo = Test.projectNo ; |
| | | comVo.page = page ;//分页(取值范围1、2、3、4、5、6、7、8、9) |
| | | |
| | | return this.sendCom2Mw(this.command(CodeV202404.cd_55, comVo, null)) ; |
| | | } |
| | | //查询设备终端用户用水记录(AFN=0x65H) |
| | | private BaseResponse cd65(int page){ |
| | | ComCd65Vo comVo = new ComCd65Vo() ; |
| | | comVo.controllerType = Test.controllerType ; |
| | | comVo.projectNo = Test.projectNo ; |
| | | comVo.page = page ; |
| | | return this.sendCom2Mw(this.command(CodeV202404.cd_65, comVo, null)) ; |
| | | } |
| | | //查询控制器IP地址(AFN=0x86H) |
| | | private BaseResponse cd86(){ |
| | | ComCd86Vo comVo = new ComCd86Vo() ; |
| | | comVo.controllerType = Test.controllerType ; |
| | | comVo.projectNo = Test.projectNo ; |
| | | comVo.channel = 1 ;//IP通道号(取值范围 1、2). |
| | | return this.sendCom2Mw(this.command(CodeV202404.cd_86, comVo, null)) ; |
| | | } |
| | | //查询控制器域名(AFN=0x87H) |
| | | private BaseResponse cd87(){ |
| | | ComCd87Vo comVo = new ComCd87Vo() ; |
| | | comVo.controllerType = Test.controllerType ; |
| | | comVo.projectNo = Test.projectNo ; |
| | | comVo.channel = 1 ;//IP通道号(取值范围 1、2). |
| | | return this.sendCom2Mw(this.command(CodeV202404.cd_87, comVo, null)) ; |
| | | } |
| | | //平台/APP远程开启水泵/阀门(AFN=0x92H/AFN=0xA2H) |
| | | private BaseResponse cd92(){ |
| | | ComCd92_A2Vo comVo = new ComCd92_A2Vo() ; |
| | | comVo.controllerType = Test.controllerType ; |
| | | comVo.projectNo = Test.projectNo ; |
| | | //comVo.icCardAddr = Test.icCardAddr ;//IC卡地址(8位数字或字母) |
| | | comVo.icCardNo = Test.icCardNo ;//用户卡序列号(17位数字)(6字节BCD,2字节HEX) |
| | | comVo.waterRemain = 123.45 ;//单位:元 2位小数点(最大值 99999999.99) |
| | | comVo.moneyRemain = 234.56 ;//单位:m3 2位小数点(最大值 99999999.99) |
| | | comVo.waterPrice = 0.8 ;//水量单价 单位:元, 2个小数点 |
| | | comVo.elePrice = 1.2 ;//电量单价 单位:元, 2个小数点 |
| | | comVo.orderNo = "1234567890123456" ;//订单号(16位数字) |
| | | |
| | | return this.sendCom2Mw(this.command(CodeV202404.cd_92, comVo, null)) ; |
| | | } |
| | | //平台/APP远程开启水泵/阀门(AFN=0x92H/AFN=0xA2H) |
| | | private BaseResponse cdA2(){ |
| | | ComCd92_A2Vo comVo = new ComCd92_A2Vo() ; |
| | | comVo.controllerType = Test.controllerType ; |
| | | comVo.projectNo = Test.projectNo ; |
| | | //comVo.icCardAddr = Test.icCardAddr ;//IC卡地址(8位数字或字母) |
| | | comVo.icCardNo = Test.icCardNo ;//用户卡序列号(17位数字)(6字节BCD,2字节HEX) |
| | | comVo.waterRemain = 123.45 ;//单位:元 2位小数点(最大值 99999999.99) |
| | | comVo.moneyRemain = 234.56 ;//单位:m3 2位小数点(最大值 99999999.99) |
| | | comVo.waterPrice = 0.8 ;//水量单价 单位:元, 2个小数点 |
| | | comVo.elePrice = 1.2 ;//电量单价 单位:元, 2个小数点 |
| | | comVo.orderNo = "1234567890123456" ;//订单号(16位数字) |
| | | |
| | | return this.sendCom2Mw(this.command(CodeV202404.cd_A2, comVo, null)) ; |
| | | } |
| | | |
| | | //平台/APP远程关闭水泵/阀门(AFN=0x93H/AFN=0xA3H) |
| | | private BaseResponse cd93(){ |
| | | ComCd93_A3Vo comVo = new ComCd93_A3Vo() ; |
| | | comVo.controllerType = Test.controllerType ; |
| | | comVo.projectNo = Test.projectNo ; |
| | | comVo.icCardNo = Test.icCardNo ;//用户卡序列号(17位数字)(6字节BCD,2字节HEX) |
| | | comVo.orderNo = "1234567890123456" ;//订单号(16位数字) |
| | | |
| | | return this.sendCom2Mw(this.command(CodeV202404.cd_93, comVo, null)) ; |
| | | } |
| | | //平台/APP远程关闭水泵/阀门(AFN=0x93H/AFN=0xA3H) |
| | | private BaseResponse cdA3(){ |
| | | ComCd93_A3Vo comVo = new ComCd93_A3Vo() ; |
| | | comVo.controllerType = Test.controllerType ; |
| | | comVo.projectNo = Test.projectNo ; |
| | | comVo.icCardNo = Test.icCardNo ;//用户卡序列号(17位数字)(6字节BCD,2字节HEX) |
| | | comVo.orderNo = "1234567890123456" ;//订单号(16位数字) |
| | | |
| | | return this.sendCom2Mw(this.command(CodeV202404.cd_A3, comVo, null)) ; |
| | | } |
| | | |
| | | |
| | | } |