自动化立体仓库 - WCS系统
Junjie
2023-06-26 7cd8c743cb1f377a3102d9a154669fb2bc10535c
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
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
package com.zy.core.model.protocol;
 
import com.zy.core.enums.LiftProtocolStatusType;
import com.zy.core.model.command.LiftAssignCommand;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
 
import java.util.Date;
 
/**
 * 提升机
 */
@Slf4j
@Data
public class LiftProtocol {
 
    /**
     * 提升机号
     */
    private Short liftNo;
 
    /**
     * 提升机内部二维码
     */
    private Short barcode = 1699;
 
    /**
     * 任务号
     */
    private Short taskNo = 0;
 
    /**
     * 四向穿梭车号
     */
    private Short shuttleNo = 0;
 
    /**
     * 当前提升机状态(内部自我维护)
     */
    private Integer protocolStatus = 1;
 
    /**
     * 当前提升机状态枚举
     */
    private LiftProtocolStatusType protocolStatusType = LiftProtocolStatusType.IDLE;
 
    /**
     * 层
     */
    private Short lev;
 
    /**
     * 提升机锁定
     */
    private Boolean liftLock;
 
    /**
     * 位置到达反馈
     */
    private Short positionArrivalFeedback;
 
    /**
     * 准备就绪
     * 就绪为1,未就绪为0
     */
    private Boolean ready;
 
    /**
     * 运行中
     * 运行中为1,未运行为0
     */
    private Boolean running;
 
    /**
     * 联机/单机
     * 联机为1,单机为0
     */
    private Boolean mode;
 
    /**
     * 输送线前端光电有货
     * 有货为1,无货为0(前端指靠近货架侧)
     */
    private Boolean lineFrontHasStock;
 
    /**
     * 输送线正转反馈
     * 正转运行为1,否则为0
     */
    private Boolean forwardRotationFeedback;
 
    /**
     * 输送线反转反馈
     * 反转运行为1,否则为0
     */
    private Boolean reverseFeedback;
 
    /**
     * 输送线电机过载
     * 过载为0,正常为1
     */
    private Boolean motorOverload;
 
    /**
     * 输送线末端光电有货
     * 有货为1,无货为0
     */
    private Boolean lineEndHasStock;
 
    /**
     * 进输送线卡托盘报警
     * 报警为1,未报警为0
     */
    private Boolean inConveyLineCardTrayAlarm;
 
    /**
     * 出输送线卡托盘报警
     * 报警为1,未报警为0
     */
    private Boolean outConveyLineCardTrayAlarm;
 
    /**
     * 平台位置偏差报警
     * 报警为1,未报警为0
     */
    private Boolean platPositionDeviationAlarm;
 
    /**
     * 平台扭矩偏差报警
     * 报警为1,未报警为0
     */
    private Boolean platTorqueDeviationAlarm;
 
    /**
     * 平台四向车检测
     * 有车为1,无车为0
     */
    private Boolean platShuttleCheck;
 
    /**
     * 未就绪状态
     * 1.    不在指定层
     * 2.    四轴不同步
     * 3.    平台前限光电被挡到(靠近货架)
     * 4.    平台后限光电被挡到(远离货架)
     * 5.    平台上限位报警
     * 6.    平台下限位报警
     * 7.    电柜急停报警
     * 8.    输送线前限位被挡到(靠近货架)
     * 9.    输送线后限位被挡到(远离货架)
     * 10.    触摸屏紧急停止被按下
     * 11.    四轴动力线断线
     * 12.    单机模式
     * 13.    四轴报警
     * 14.    位置偏差过大
     * 15.    扭矩偏差过大
     * 16.    输送线过载
     * 17.    进提升机卡托盘
     * 18.    出提升机卡托盘
     */
    private Short notReady;
 
    /**
     * 伺服1错误
     */
    private Short servoError1;
 
    /**
     * 伺服2错误
     */
    private Short servoError2;
 
    /**
     * 伺服3错误
     */
    private Short servoError3;
 
    /**
     * 伺服4错误
     */
    private Short servoError4;
 
    /**
     * 提升机实际速度反馈
     */
    private Short liftActualSpeed;
 
    /**
     * 作业标记
     */
    private Boolean pakMk = true;
 
    /**
     * 四向穿梭车调度提升机时,需要锁定此标记
     */
    private Boolean securityMk = false;
 
    /**
     * 任务命令
     */
    private LiftAssignCommand assignCommand;
 
    /**
     * 出入库模式,1:入库,2:出库
     */
    private Integer outInModel;
 
    /**
     * 出入库模式起始站点
     */
    private Integer startSta;
 
    /**
     * 出入库模式目标站点
     */
    private Integer distSta;
 
    /**
     * 出入库模式步数
     */
    private Integer outInModelStep;
 
    /**
     * 工作时间
     */
    private Date wrkTime;
 
    public Short getLiftLockShortValue() {
        return liftLock ? (short) 1 : (short) 0;
    }
 
    /**
     * 设置提升机状态
     */
    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 Boolean isIdle() {
        if(this.taskNo == null
                || this.liftLock == null
                || this.ready == null
                || this.running == null
                || this.mode == null
                || this.pakMk == null
        ){
            return false;
        }
 
        boolean res = this.taskNo == 0
                && !this.liftLock
//                && this.ready
                && !this.running
                && this.mode
                && this.pakMk.equals(true)
                && !this.securityMk
                ;
        return res;
    }
 
    // 是否处于空闲待命状态,不判断任务号
    public Boolean isIdleNoTask() {
        if(this.taskNo == null
                || this.liftLock == null
                || this.ready == null
                || this.running == null
                || this.mode == null
                || this.pakMk == null
        ){
            return false;
        }
 
        boolean res = !this.liftLock
//                && this.ready
                && !this.running
                && this.mode
                && this.pakMk
                && !this.securityMk
                ;
        return res;
    }
 
    public void setPositionArrivalFeedback(Short position) {
        Short lev = null;
        switch (position) {
            case 1:
                lev = 1;
                break;
            case 4:
                lev = 2;
                break;
            case 8:
                lev = 3;
                break;
            case 16:
                lev = 4;
                break;
        }
        this.lev = lev;//层高
        this.positionArrivalFeedback = position;//位置到达反馈
    }
 
    public Integer getPositionArrivalFeedback$() {
        if (this.positionArrivalFeedback == null) {
            return null;
        }
 
        switch (this.positionArrivalFeedback) {
            case 1:
                return 1;
            case 2:
                return 2;
            case 4:
                return 3;
            case 8:
                return 4;
            case 16:
                return 5;
        }
 
        return null;
    }
 
 
}