自动化立体仓库 - WCS系统
#
luxiaotao1123
2021-01-11 16787b096c6aec16195a85f0a1c4666679e8f32f
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
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
package com.zy.core.model.protocol;
 
import com.zy.asrs.entity.BasCrnp;
import com.zy.core.enums.*;
import lombok.Data;
 
/**
 * Created by vincent on 2020/8/7
 */
@Data
public class CrnProtocol {
 
    /**
     * 1 = 手动模式
     * 2 = 自动模式
     * 3 = 电脑模式
     */
    public Short mode;
 
    public CrnModeType modeType;
 
    /**
     * 堆垛机任务完成
     */
    public Short taskFinish;
 
    /**
     * 校验结果 1表示检验成功
     */
    public Short valid;
 
    /**
     * 1 = 急停
     */
    public Short eStop;
 
    /**
     * 任务号
     */
    public Short taskNo = 0;
 
    /**
     * 堆垛机当前状态
     * 0:空闲,无任务
     * 1:取货定位中
     * 2:取货中
     * 3:取货完成,放货定位中
     * 4:放货中
     * 5:回原点中
     * 6:反原点
     * 7:库位移位
     * 90:任务完成等待WCS确认
     * 99:报警
     */
    public Short status;
 
    /**
     * 状态枚举
     */
    public CrnStatusType statusType;
 
    /**
     * 堆垛机当前列号
     */
    public Short bay;
 
    /**
     * 堆垛机当前层号
     */
    public Short level;
 
    /**
     * 堆垛机当前排
     */
    public Short row;
 
    /**
     * 堆垛机当前巷道号
     */
    public Short lane;
 
    /**
     * 堆垛机通讯状态
     */
    public Boolean connStatus;
 
    /**
     * 申请入库修正
     */
    public Boolean correction;
 
    /**
     * 托盘号错
     */
    public Boolean tuError;
 
    /**
     * 取货无箱
     */
    public Boolean noneError;
 
    /**
     * 双重入库
     */
    public Boolean stockError;
 
    /**
     * 作业数据无效
     */
    public Boolean jobInvalid;
 
    /**
     * 空闲状态
     */
    public Boolean idle;
 
    /**
     * 控制柜使能
     */
    public Boolean control;
 
    /**
     * 停准
     */
    public Boolean stopQuasi;
 
    /**
     * 运行
     */
    public Boolean running;
 
    /**
     * 故障
     */
    public Boolean fault;
 
    /**
     * 货叉中位
     */
    public Boolean forkHome;
    /**
     * 单伸位货叉左位
     */
    public Boolean forkSingleLeft;
    /**
     * 单伸位货叉右位
     */
    public Boolean forkSingleRight;
    /**
     * 双伸位货叉左位
     */
    public Boolean forkDoubleLeft;
    /**
     * 双伸位货叉右位
     */
    public Boolean forkDoubleRight;
    /**
     * 单伸位高位
     */
    public Boolean singleHigh;
    /**
     * 单伸位低位
     */
    public Boolean singleLow;
    /**
     * 双伸位高位
     */
    public Boolean doubleHigh;
    /**
     * 双伸位低位
     */
    public Boolean doubleLow;
    /**
     * 站台高位
     */
    public Boolean platformHigh;
    /**
     * 站台低位
     */
    public Boolean platformLow;
 
    /**
     * 当前货叉位置
     * 0 = 货叉原位
     * 1 = 货叉在左侧
     * 2 = 货叉在右侧
     */
    public Short forkPos = -1;
 
    public CrnForkPosType forkPosType = CrnForkPosType.NONE;
 
    /**
     * 当前载货台位置
     * 0 = 下定位
     * 1 = 上定位
     */
    public Short liftPos = -1;
 
    public CrnLiftPosType liftPosType = CrnLiftPosType.ERROR;
 
    /**
     * 走行在定位
     * 0 = 在定位
     * 1 = 不在定位
     */
    public Short walkPos = 0;
 
    /**
     * 拨指位置
     * 0 = 不在定位
     * 1 = 上定位
     * 2 = 下定位
     */
    public Short fingerPos;
 
    public CrnFingerPosType fingerPosType;
 
    /**
     * 载货台有物
     */
    public Short loaded;
 
    /**
     * 堆垛机垂直故障代码(数值显示)
     */
    private Integer alarm1;
 
    /**
     * 堆垛机水平故障代码(数值显示)
     */
    private Integer alarm2;
 
    /**
     * 堆垛机货叉故障代码(数值显示)
     */
    private Integer alarm3;
 
    /**
     * 堆垛机状态故障代码(数值显示)
     */
    private Integer alarm4;
 
    /**
     * 异常1
     */
    private boolean[] error1;
 
    private CrnError1 crnError1;
 
    /**
     * 异常2
     */
    private boolean[] error2;
 
    private CrnError2 crnError2;
 
    /**
     * 异常3
     */
    private boolean[] error3;
 
    private CrnError3 crnError3;
 
    /**
     * 异常4
     */
    private boolean[] error4;
 
    private CrnError4 crnError4;
 
    /**
     * X行走线速度m/min
     */
    private Float xSpeed;
 
    /**
     * Y行走线速度m/min
     */
    private Float ySpeed;
 
    /**
     * Z行走线速度m/min
     */
    private Float zSpeed;
 
    /**
     * 堆垛机累计走行距离km
     */
    public Float xDistance;
 
    /**
     * 堆垛机累计升降距离km
     */
    public Float yDistance;
 
    /**
     * 堆垛机累计走行时长h
     */
    public Float xDuration;
 
    /**
     * 堆垛机累计升降时长h
     */
    public Float yDuration;
 
    public void setMode(Short mode) {
        this.mode = mode;
        this.modeType = CrnModeType.get(mode);
    }
 
    public void setMode(CrnModeType type) {
        this.modeType = type;
        this.mode = CrnModeType.get(type).id.shortValue();
    }
 
    public void setForkPos(Short forkPos) {
        this.forkPos = forkPos;
        this.forkPosType = CrnForkPosType.get(forkPos);
    }
 
    public void setForkPos(CrnForkPosType type) {
        this.forkPosType = type;
        this.forkPos = CrnForkPosType.get(type).id.shortValue();
    }
 
    public void setLiftPos(Short liftPos) {
        this.liftPos = liftPos;
        this.liftPosType = CrnLiftPosType.get(liftPos);
    }
 
    public void setLiftPos(CrnLiftPosType type) {
        this.liftPosType = type;
        this.liftPos = CrnLiftPosType.get(type).id.shortValue();
    }
 
    public void setStatus(Short status){
        this.status = status;
        this.statusType = CrnStatusType.get(status);
    }
 
    public void setStatus(CrnStatusType type){
        this.statusType = type;
        this.status = CrnStatusType.get(type).id.shortValue();
    }
 
    public void setFingerPos(Short type) {
        this.fingerPos = type;
        this.fingerPosType = CrnFingerPosType.get(type);
    }
 
    public void setError1(boolean[] error1){
        this.error1 = error1;
        this.crnError1 = new CrnError1();
        this.crnError1.remoteStop = error1[0];
        this.crnError1.mainStop = error1[1];
        this.crnError1.controlStop = error1[2];
        this.crnError1.xCoverErr = error1[3];
        this.crnError1.yCoverErr = error1[4];
        this.crnError1.zCoverErr = error1[5];
        this.crnError1.laserErr = error1[6];
        this.crnError1.barcodeErr = error1[7];
        this.crnError1.xFrontLimitErr = error1[8];
        this.crnError1.xBackLimitErr = error1[9];
        this.crnError1.yUpLimitErr = error1[10];
        this.crnError1.yDownLimitErr = error1[11];
        this.crnError1.zLeftLimitErr = error1[12];
        this.crnError1.zRightLimitErr = error1[13];
        this.crnError1.leftOverWidthErr1 = error1[14];
        this.crnError1.leftOverWidthErr2 = error1[15];
    }
 
    public void setError2(boolean[] error2){
        this.error2 = error2;
        this.crnError2 = new CrnError2();
        this.crnError2.leftOverLenErr1 = error2[0];
        this.crnError2.leftOverLenErr2 = error2[1];
        this.crnError2.leftOverHighErr = error2[2];
        this.crnError2.rightOverWidthErr1 = error2[3];
        this.crnError2.rightOverWidthErr2 = error2[4];
        this.crnError2.rightOverLenErr1 = error2[5];
        this.crnError2.rightOverLenErr2 = error2[6];
        this.crnError2.rightOverHighErr = error2[7];
        this.crnError2.leftLooseRopeErr = error2[8];
        this.crnError2.rightLooseRopeErr = error2[9];
        this.crnError2.frontDoorErr = error2[10];
        this.crnError2.backDoorErr = error2[11];
        this.crnError2.startupErr = error2[12];
        this.crnError2.xFrontLocaUpErr = error2[13];
        this.crnError2.xFrontLocaDownErr = error2[14];
        this.crnError2.xBackLocaUpErr = error2[15];
    }
 
    public void setError3(boolean[] error3) {
        this.error3 = error3;
        this.crnError3 = new CrnError3();
        this.crnError3.xBackLocaDownErr = error3[0];
        this.crnError3.yUpLocaUpErr = error3[1];
        this.crnError3.yUpLocaDownErr = error3[2];
        this.crnError3.yDownLocaUpErr = error3[3];
        this.crnError3.yDownLocaDownErr = error3[4];
        this.crnError3.zLeftLocaUpErr = error3[5];
        this.crnError3.zLeftLocaDownErr = error3[6];
        this.crnError3.zRightLocaUpErr = error3[7];
        this.crnError3.zRightLocaDownErr = error3[8];
        this.crnError3.leftTakeNoneErr = error3[9];
        this.crnError3.rightTakeNoneErr = error3[10];
        this.crnError3.leftTakeThenLoadErr = error3[11];
        this.crnError3.rightTakeThenLoadErr = error3[12];
        this.crnError3.leftPutAndLoadErr = error3[13];
        this.crnError3.rightPutAndLoadErr = error3[14];
        this.crnError3.leftPutThenNoneErr = error3[15];
    }
 
    public void setError4(boolean[] error4) {
        this.error4 = error4;
        this.crnError4 = new CrnError4();
        this.crnError4.rightPutThenNoneErr = error4[0];
        this.crnError4.xLooseBrakeTimeout = error4[1];
        this.crnError4.yLooseBrakeTimeout = error4[2];
        this.crnError4.zLooseBrakeTimeout = error4[3];
    }
 
    /**
     * 最近一次入出库类型
     *       I:入库
     *       O:出库
     */
    private String lastIo = "I";
 
 
    public BasCrnp toSqlModel(BasCrnp basCrnp){
        basCrnp.setCrnErr(alarm1.longValue());
        basCrnp.setWrkNo(taskNo.intValue());
        return basCrnp;
    }
}