野心家
2025-05-23 d75bdc98e2bc456eecfa4003bf700cb701d52a9b
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
package com.zy.core.model.protocol;
 
import com.zy.asrs.entity.BasRgv;
import com.zy.core.enums.RgvModeType;
import com.zy.core.enums.RgvStatusType;
import lombok.Data;
 
/**
 * Created by vincent on 2020/8/7
 */
@Data
public class RgvProtocol {
 
    private Integer RgvNo;
 
    /**
     * 1 = 手动模式
     * 2 = 自动模式
     * 3 = 电脑模式
     */
    public Short mode = -1;
 
    public RgvModeType modeType = RgvModeType.NONE;
 
    /**
     * RGV当前状态
     * 0:空闲,无任务
     * 1:作业中
     * 2:报警
     */
    public Short status = -1;
 
    /**
     * 状态枚举
     */
    public RgvStatusType statusType = RgvStatusType.NONE;
 
    /**
     * 任务号
     */
    public Long taskNo = 0L;
 
    /**
     * 有物
     */
    public Short loaded = -1;//0 无物;1 有物
 
    /**
     * RGV当前位置
     */
    public Long RgvPos = 0L;
 
    /**
     * RGV目的位置
     */
    public Long RgvPosDestination = 0L;
 
    /**
     * 走行在定位
     * 0 = 在定位
     * 1 = 不在定位
     */
    public Short walkPos;
 
    /**
     * 异常码
     */
    public Short alarm;
 
    /**
     * X行走行速度m/min
     */
    private Float xSpeed;
 
    /**
     * 累计走行距离km
     */
    public Float xDistance;
 
    /**
     * 累计走行时长h
     */
    public Float xDuration;
 
    /**
     * 车身
     */
    public Long carBodyJiaoMing = 2000L;
 
    /**
     * 车身
     */
    public Long carBodyKunPeng = 15000L;
 
    /**
     * 是否启用
     */
    public boolean statusEnable;//0\1\2
 
 
 
    // 急停
    private boolean err1;
 
    // 有物无资料
    private boolean err2;
 
    // 命令错误走行链条冲突
    private boolean err3;
 
    // 目标为超过走行极限
    private boolean err4;
 
    // 变频器异常
    private boolean err5;
 
    // 光电异常
    private boolean err6;
 
    public void setMode(Short mode) {
        this.mode = mode;
        this.modeType = RgvModeType.get(mode);
    }
 
    public void setMode(RgvModeType type) {
        this.modeType = type;
        this.mode = RgvModeType.get(type).id.shortValue();
    }
 
    public void setStatus(Short status){
        this.status = status;
        this.statusType = RgvStatusType.get(status);
    }
 
    public void setStatus(RgvStatusType type){
        this.statusType = type;
        this.status = RgvStatusType.get(type).id.shortValue();
    }
 
    public BasRgv toSqlModel(BasRgv basRgv){
        if (alarm!=null) {
            basRgv.setRgvErr(alarm.longValue());
        }
        basRgv.setWrkNo1(taskNo.intValue());
        return basRgv;
    }
 
    public long getRgvPosDestinationOrPos(boolean sign){
        if (!sign){
            return RgvPosDestination>RgvPos? RgvPosDestination:RgvPos;
        } else {
            return RgvPosDestination<RgvPos? RgvPosDestination:RgvPos;
        }
    }
 
    public void setxSpeed(Short xSpeed) {
        this.xSpeed = Float.valueOf(xSpeed);
    }
 
    public void setxDistance(Short xDistance) {
        this.xDistance = Float.valueOf(xDistance);
    }
 
    public void setxDuration(Short xDuration) {
        this.xDuration = Float.valueOf(xDuration);
    }
 
    public int getAlarm$(){
        if (err1){
            return 1;
        }
        if (err2){
            return 2;
        }
        if (err3){
            return 3;
        }
        if (err4){
            return 4;
        }
        if (err5){
            return 5;
        }
        if (err6){
            return 6;
        }
        return 0;
    }
    public String getAlarmM(){
        switch (getAlarm$()){
            case 1:
                return "急停";
            case 2:
                return "有物无资料";
            case 3:
                return "命令错误走行链条冲突";
            case 4:
                return "目标为超过走行极限";
            case 5:
                return "变频器异常";
            case 6:
                return "光电异常";
        }
        return "正常";
    }
 
}