package com.dy.common.mw.protocol.pMeterV1_0_1; public class DataCd0405Vo { public Byte open1_close2 ;//开阀是1,关阀是2 public Byte state ;//开关阀操作结果:开关到位:01H; 开关超时:02H 电流超限:03H //以下数据都是上报时刻的数据 public String dt ;//上报时间(格式 yyyy-mm-dd hh:mm:ss) public String toString(){ StringBuffer sb = new StringBuffer() ; if(open1_close2 != null && open1_close2.byteValue() == 1){ if(state != null && state.byteValue() == 1){ sb.append(" 开阀结果 : 开到位\n") ; }else if(state != null && state.byteValue() == 2){ sb.append(" 开阀结果 : 超时\n") ; }else if(state != null && state.byteValue() == 2){ sb.append(" 开阀结果 : 电流超限\n") ; } }else if(open1_close2 != null && open1_close2.byteValue() == 2){ if(state != null && state.byteValue() == 1){ sb.append(" 关阀结果 : 关到位\n") ; }else if(state != null && state.byteValue() == 2){ sb.append(" 关阀结果 : 超时\n") ; }else if(state != null && state.byteValue() == 2){ sb.append(" 关阀结果 : 电流超限\n") ; } } sb.append(" 终端时间 : " + dt + "\n") ; return sb.toString() ; } /** * 由其产生命令日志,并存储到数据库中 * @return */ public String resultInfo(){ StringBuffer sb = new StringBuffer() ; if(open1_close2 != null && open1_close2.byteValue() == 1){ if(state != null && state.byteValue() == 1){ sb.append(" 开阀结果 : 开到位\n") ; }else if(state != null && state.byteValue() == 2){ sb.append(" 开阀结果 : 超时\n") ; }else if(state != null && state.byteValue() == 2){ sb.append(" 开阀结果 : 电流超限\n") ; } }else if(open1_close2 != null && open1_close2.byteValue() == 2){ if(state != null && state.byteValue() == 1){ sb.append(" 关阀结果 : 关到位\n") ; }else if(state != null && state.byteValue() == 2){ sb.append(" 关阀结果 : 超时\n") ; }else if(state != null && state.byteValue() == 2){ sb.append(" 关阀结果 : 电流超限\n") ; } } sb.append(" 终端时间 : " + dt + "\n") ; return sb.toString() ; } public Byte getOpen1_close2() { return open1_close2; } public void setOpen1_close2(Byte open1_close2) { this.open1_close2 = open1_close2; } public Byte getState() { return state; } public void setState(Byte sate) { this.state = sate; } public String getDt() { return dt; } public void setDt(String dt) { this.dt = dt; } }