liurunyu
2023-11-18 c1ddfd71223c1a7d704b6f21b669fbfcb37adc82
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
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;
    }
 
}