自动化立体仓库 - WCS系统
#
Junjie
2025-04-10 1d624dfdb040825ffecba6c792c480be662b2dbc
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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
package com.zy.core.model.protocol;
 
import com.core.common.Cools;
import com.core.common.SpringUtils;
import com.zy.asrs.entity.BasLiftErr;
import com.zy.asrs.service.BasLiftErrService;
import com.zy.common.utils.RedisUtil;
import com.zy.core.enums.LiftProtocolStatusType;
import com.zy.core.enums.RedisKeyType;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
 
@Slf4j
@Data
public class LiftProtocol implements Cloneable {
 
    //**********************必须存在属性**********************
    /**
     * 提升机号
     */
    private Integer liftNo;
 
    /**
     * 任务号
     */
    private Integer taskNo;
 
    /**
     * 四向穿梭车号
     */
    private Integer shuttleNo = 0;
 
    /**
     * 当前提升机状态(内部自我维护)
     */
    private Integer protocolStatus = -1;
 
    /**
     * 当前提升机状态枚举
     */
    private LiftProtocolStatusType protocolStatusType = LiftProtocolStatusType.NONE;
 
    /**
     * 模式 => 自动/手动
     */
    private Boolean model;
 
    /**
     * 运行状态
     */
    private Boolean run;
 
    /**
     * 就绪状态
     */
    private Boolean ready;
 
    /**
     * 前超限
     */
    private Boolean frontOverrun;
 
    /**
     * 后超限
     */
    private Boolean backOverrun;
 
    /**
     * 左超限
     */
    private Boolean leftOverrun;
 
    /**
     * 右超限
     */
    private Boolean rightOverrun;
 
    /**
     * 超高
     */
    private Boolean overHeight;
 
    /**
     * 超重
     */
    private Boolean overWeight;
 
    /**
     * 有托盘
     */
    private Boolean hasTray;
 
    /**
     * 有小车
     */
    private Boolean hasCar;
 
    /**
     * 故障
     */
    private Boolean error;
 
    /**
     * 故障码
     */
    private String errorCode;
 
    /**
     * 任务地址
     */
    private Short taskAddress;
 
    /**
     * 目的地址
     */
    private Short distAddress;
 
    /**
     * 已完成的任务号
     */
    private String completeTaskNo;
 
    /**
     * 层
     */
    private Integer lev;
 
    /**
     * 作业标记
     */
    private Boolean pakMk = true;
 
    /**
     * 指令下发时间
     */
    private Long sendTime = 0L;
 
    /**
     * 日志采集时间
     */
    private Long deviceDataLog = System.currentTimeMillis();
 
    /**
     * 扩展字段
     */
    private Object extend;
 
    public String getRun$() {
        if (this.run == null) {
            return "未知";
        }
 
        return this.run ? "运行中" : "空闲";
    }
 
    public String getReady$() {
        if (this.ready == null) {
            return "未知";
        }
 
        return this.ready ? "就绪" : "未就绪";
    }
 
    public String getModel$() {
        if (this.model == null) {
            return "未知";
        }
 
        return this.model ? "自动" : "手动";
    }
 
    public String getHasTray$() {
        if (this.hasTray == null) {
            return "未知";
        }
 
        return this.hasTray ? "Y" : "N";
    }
 
    public String getHasCar$() {
        if (this.hasCar == null) {
            return "未知";
        }
 
        return this.hasCar ? "Y" : "N";
    }
 
    public String getFrontOverrun$() {
        if (this.frontOverrun == null) {
            return "未知";
        }
 
        return this.frontOverrun ? "Y" : "N";
    }
 
    public String getBackOverrun$() {
        if (this.backOverrun == null) {
            return "未知";
        }
 
        return this.backOverrun ? "Y" : "N";
    }
 
    public String getLeftOverrun$() {
        if (this.leftOverrun == null) {
            return "未知";
        }
 
        return this.leftOverrun ? "Y" : "N";
    }
 
    public String getRightOverrun$() {
        if (this.rightOverrun == null) {
            return "未知";
        }
 
        return this.rightOverrun ? "Y" : "N";
    }
 
    public String getOverHeight$() {
        if (this.overHeight == null) {
            return "未知";
        }
 
        return this.overHeight ? "Y" : "N";
    }
 
    public String getOverWeight$() {
        if (this.overWeight == null) {
            return "未知";
        }
 
        return this.overWeight ? "Y" : "N";
    }
 
    public String getProtocolStatus$() {
        if (this.protocolStatusType == null) {
            return "未知";
        }
 
        return this.protocolStatusType.desc;
    }
 
    /**
     * 设置提升机状态
     */
    public void setProtocolStatus(Integer status) {
        this.protocolStatus = status;
        this.protocolStatusType = LiftProtocolStatusType.get(status);
    }
 
    /**
     * 设置提升机状态
     */
    public void setProtocolStatus(LiftProtocolStatusType status) {
        this.protocolStatus = status.id;
        this.protocolStatusType = status;
    }
 
    public synchronized void setTaskNo(Integer taskNo) {
        RedisUtil redisUtil = SpringUtils.getBean(RedisUtil.class);
        if (null != redisUtil) {
            redisUtil.set(RedisKeyType.LIFT_FLAG.key + this.liftNo, taskNo);
            this.taskNo = taskNo;
        }
    }
 
    public Integer getTaskNo() {
        RedisUtil redisUtil = SpringUtils.getBean(RedisUtil.class);
        if (null != redisUtil) {
            Object o = redisUtil.get(RedisKeyType.LIFT_FLAG.key + this.liftNo);
            if (!Cools.isEmpty(o)) {
                this.taskNo = Integer.valueOf(String.valueOf(o));
            }
        }
        return this.taskNo == null ? 0 : this.taskNo;
    }
 
    /**
     * 错误码
     */
    public String getErrCode$() {
        if (this.errorCode == null) {
            return "";
        }
        BasLiftErrService basLiftErrService = SpringUtils.getBean(BasLiftErrService.class);
        BasLiftErr basLiftErr = basLiftErrService.selectById(this.errorCode);
        if (basLiftErr == null) {
            return String.valueOf(this.errorCode);
        }
        return basLiftErr.getErrName();
    }
 
    @Override
    public LiftProtocol clone() {
        try {
            return (LiftProtocol) super.clone();
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        return null;
    }
 
}