StoreStep.cs
17.3 KB
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
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
using log4net;
using OnlineStore.Common;
using OnlineStore.DeviceLibrary;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.IO.Ports;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace OnlineStore.DeviceLibrary
{
/// <summary>
///0= 等待启动/已经停止,1=初始化完成, 2=正常运行中,3=可以进行新的处理,4=忙碌,重置
/// </summary>
public enum LineRunStatus
{
/// <summary>
/// 等待启动/已经停止
/// </summary>
Wait = 0,
/// <summary>
/// 初始化 ,原点返回状态中,只有流水线使用
/// </summary>
HomeMoving = 1,
/// <summary>
/// 设备正在重置中,请稍后
/// </summary>
Reset = 2,
/// <summary>
/// 正常运行中,可以进行新的处理
/// </summary>
Runing = 3,
/// <summary>
/// 正在忙碌中,请稍后
/// </summary>
Busy = 4,
}
/// <summary>
///1=设备联机(正常就绪)(入库后,BOX恢复原始状态)(出库后,移载装置恢复原始状态),
///2=急停,3=故障,4=警告,5=调试
/// 6=入库执行中,7=入仓完成,8=入仓失败
/// 9=出库执行,10=出仓完成,11=出库失败
/// </summary>
public enum LineStatus
{
None=0,
/// <summary>
/// 1=设备联机(正常就绪)(入库后,BOX恢复原始状态)(出库后,移载装置恢复原始状态),
/// </summary>
StoreOnline = 1,
/// <summary>
///2=急停中
/// </summary>
SuddenStop = 2,
/// <summary>
/// 3=故障中
/// </summary>
InTrouble = 3,
/// <summary>
/// 4=警告
/// </summary>
Warning = 4,
/// <summary>
/// 5=设备调试中
/// </summary>
Debugging = 5,
/// <summary>
/// 6=入库执行中
/// </summary>
InStoreExecute = 6,
/// <summary>
/// 7= 入仓位完成(料仓Box把料盘放入对应的库位中,装置还未恢复原始状态)
/// </summary>
InStoreEnd = 7,
/// <summary>
/// 8=入库失败
/// </summary>
InStoreFaild = 8,
/// <summary>
/// 9=出库执行中",
/// </summary>
OutStoreExecute = 9,
/// <summary>
///10= 出仓位完成( 料盘已经放到Box门口)
/// </summary>
OutStoreBoxEnd = 10,
/// <summary>
/// 12=移栽出库移栽过程中(移栽完成后变成OnLine)
/// </summary>
OutMoveExecute = 12,
/// <summary>
///11=出库失败
/// </summary>
OutStoreFaild = 11,
/// <summary>
/// 重置中(原点返回和重置都发此状态)
/// </summary>
ResetMove =13,
}
/// <summary>
/// 料仓运动状态(当料仓状态=busy时,才会有此运动状态)
/// </summary>
public enum LineMoveStep
{
/// <summary>
/// 无操作,等待状态
/// </summary>
Wait = 0,
#region 流水线入仓操作 100开始
/// <summary>
/// 流水线入仓,开始扫码 扫描枪触发,数据处理
/// </summary>
LI_Scannering = 101,
/// <summary>
/// 流水线入仓,料仓号及库位号发送, 夹具号编码记忆(X5,X6.X7)数据接收
/// </summary>
LI_WaitServerResult = 102,
/// <summary>
/// 等待100毫秒后再放行
/// </summary>
LI_00_Wait100 = 103,
/// <summary>
/// 阻挡气缸0-2下降
/// </summary>
LI_01_StopCylinder2Down = 104,
/// <summary>
/// 检测夹具检测1=0 ) 开始
/// </summary>
LI_02_FixtureCheck = 105,
/// <summary>
/// 阻挡气缸0-2上升
/// </summary>
LI_03_StopCylinder2Up = 106,
/// <summary>
/// 阻挡气缸0-1下降
/// </summary>
LI_04_StopCylinder1Down = 107,
#endregion
#region 流水线出库操作200开始
/// <summary>
/// 流水线出库,等待100毫秒之后在放行
/// </summary>
LO_00_Wait100 = 200,
/// <summary>
/// 流水线出库,阻挡气缸0-2下降
/// </summary>
LO_01_StopCylinder2Down = 201,
/// <summary>
/// 流水线出库, 检测夹具检测1=0
/// </summary>
LO_02_FixtureCheck = 202,
/// <summary>
/// 流水线出库,阻挡气缸0-2上升
/// </summary>
LO_03_StopCylinder2Up = 203,
/// <summary>
/// 阻挡气缸0-1下降
/// </summary>
LO_04_StopCylinder1Up = 204,
#endregion
#region 移栽装置原点返回和重置步骤 2000开始
/// <summary>
/// 上下气缸回原点
/// </summary>
MH_UpDownHomeMove = 2000,
/// <summary>
/// 料仓移栽装置,上下气缸上升端
/// </summary>
MH_UpDownCylinder_Up = 2001,
/// <summary>
/// 料仓移载装置,其他气缸运行到初始状态( 顶升气缸下降端,前后气缸后退端,夹料气缸放松端,阻挡气缸输入=0 )
/// </summary>
MH_OtherCylinder_Back = 2002,
#endregion
#region 移载装置入库处理 3000-3050
/// <summary>
///移载装置入库处理,检测 夹具编码
/// </summary>
MI_05_CodeCheck = 3005,
/// <summary>
///移载装置入库处理,编码与仓位一致,上下气缸1下降
/// </summary>
MI_07_UpDownCylinderDown = 3007,
/// <summary>
///移载装置入库处理,编码与仓位一致,上下气缸1下降后,等待0.3秒,防止没有 下降到位就夹紧
/// </summary>
MI_07_UpDownCylinderDownWait = 3024,
/// <summary>
///移载装置入库处理,夹料气缸1夹紧
/// </summary>
MI_08_ClampCylinderSlack = 3008,
/// <summary>
///移载装置入库处理,上下气缸1上升
/// </summary>
MI_09_UpDownCylinderUp = 3009,
/// <summary>
///移载装置入库处理,,前后气缸1前进
/// </summary>
MI_10_BeforeAfterCylinderBefore = 3010,
/// <summary>
/// 移载装置入库处理,等待box等待状态才能继续操作
/// </summary>
MI_10_WaitBox = 3006,
/// <summary>
///移载装置入库处理,上下气缸1下降
/// </summary>
MI_11_UpDownCylinderDown = 3011,
/// <summary>
///移载装置入库处理,,夹料气缸1放松
/// </summary>
MI_12_ClampCylinderTighten = 3012,
/// <summary>
///移载装置入库处理,上下气缸1上升
/// </summary>
MI_13_UpdownCylinderUp = 3013,
/// <summary>
///移载装置入库处理,,前后气缸1后退
/// </summary>
MI_14_BeforeAfterCylinderAfter = 3014,
/// <summary>
///移载装置入库处理,检测到X102-1=1送料流程完成
/// </summary>
MI_15_SendEnd = 3015,
/// <summary>
///移载装置入库处理,编码不一致,顶升气缸1下降
/// </summary>
MI_20_TopCylinderDown = 3020,
/// <summary>
///移载装置入库处理,阻挡气缸1-2下降
/// </summary>
MI_21_StopCylinderDown = 3021,
/// <summary>
///移载装置入库处理,检测Check4=0,
/// </summary>
MI_22_FixtureCheck_Low = 3022,
/// <summary>
///移载装置入库处理,,,阻挡气缸1-2 上升,等待200毫秒
/// </summary>
MI_23_StopCylinderReset = 3023,
#endregion
#region 移栽装置出入库共同模块 3080-3100
/// <summary>
///移载(流水线)装置出入库处理,阻挡气缸1-1下降
/// </summary>
MIO_01_StopCylinder1Down = 3081,
/// <summary>
///移载(流水线)装置出入库处理,夹具检测1-4=1
/// </summary>
MIO_02_FixtureCheck = 3082,
/// <summary>
///移载(流水线)装置出入库处理,阻挡气缸1-1上升
/// </summary>
MIO_03_StopCylinder2Down = 3083,
/// <summary>
/// 检测夹具检测IO1=1
/// </summary>
MIO_04_Wait = 3084,
/// <summary>
/// 等待一秒钟
/// </summary>
MIO_05_WaitTime = 3085,
/// <summary>
///移载(流水线)装置出入库处理,顶 升气缸上升
/// </summary>
MIO_06_TopCylinderUp = 3086,
/// <summary>
/// 此处 顶升气缸上升时等待一秒钟,再下降,现在看起来没有升到位就下降
/// </summary>
MIO_07_TopCylinderUpWait = 3087,
/// <summary>
/// 等待StoreMove完成当前操作开始入库
/// </summary>
MIO_08_WaitInStore=3088,
/// <summary>
/// 等待StoreMove移走料盘开始放托盘通过
/// </summary>
MIO_09_WaitLetFixtureGo=3089,
#endregion
#region 移栽装置出库处理 3100-3200
/// <summary>
/// 移载(流水线)装置出库处理, 检测夹具编码并记忆,托盘 是空盘,并且BOX在出库等待中,开始移栽料盘
/// </summary>
MO_11_CodeRember = 3101,
/// <summary>
/// 移载(流水线)装置出库处理 ,顶升气缸1下降
/// </summary>
MO_12_TopCylinder_Down = 3102,
/// <summary>
/// 如果是移栽2需要等待托盘是否可以走
/// </summary>
MO_13_WaitCanGo=3103,
/// <summary>
/// 移载(流水线)装置出库处理, 阻挡气缸1-2下降
/// </summary>
MO_14_StopCylinder2_Down = 3104,
/// <summary>
/// 移载(流水线)装置出库处理, 阻挡2托盘检测=0,
/// </summary>
MO_15_Tray_Check = 3105,
/// <summary>
/// 移载(流水线)装置出库处理, 阻挡气缸1-1下降 阻挡气缸1-2上升
/// </summary>
MO_16_StopCylinder_Back = 3106,
/// <summary>
/// 移栽装置出库处理,开始出库
/// </summary>
MO_50_StartOutProcess=3150,
/// <summary>
/// 移栽装置出库处理。。前后气缸1前进
/// </summary>
MO_51_BeforeAfterCylinderBefore = 3151,
/// <summary>
/// 移栽装置出库处理。上下气缸1下降
/// </summary>
MO_52_UpDownCylinderDown = 3152,
/// <summary>
/// 移栽装置出库处理。上下气缸1下降后,等待0.3秒再夹紧,防止没有下降到位就夹紧操作
/// </summary>
MO_53_UpDownCylinderDownWait = 3153,
/// <summary>
/// 移栽装置出库处理。 夹料气缸1夹紧
/// </summary>
MO_54_ClampCylinderSlack = 3154,
/// <summary>
/// 移栽装置出库处理。 上下气缸1上升
/// </summary>
MO_55_UpDownCylinderUp = 3155,
/// <summary>
/// 移栽装置出库处理。 前后气缸1后退
/// </summary>
MO_56_BeforeAfterCylinderAfter = 3156,
/// <summary>
/// 移载(流水线)装置出库处理,上下气缸1下降
/// </summary>
MO_58_UpDownCylinderDown = 3158,
/// <summary>
/// 移载(流水线)装置出库处理,夹料气缸1放松
/// </summary>
MO_59_ClampCylinderTighten = 3159,
/// <summary>
/// 移载(流水线)装置出库处理,上下气缸1上升
/// </summary>
MO_60_UpDownCylinderUp = 3160,
#endregion
#region 横移轨道处理 5000 开始
SW00_Wait=5000,
/// <summary>
/// 定位气缸下降
/// </summary>
SW01_LocationCylinderDown=5001,
/// <summary>
/// 等待轨道1夹具检测信号
/// </summary>
SW02_WaitFixtureCheck=5002,
/// <summary>
/// 横移轨道顶升气缸上升
/// </summary>
SW03_TopCylinderUp=5003,
/// <summary>
/// 横移轨道点击转动
/// </summary>
SW04_DriveMotorMove=5004,
/// <summary>
/// 收到横移轨道2夹具检测信号
/// </summary>
SW05_WaitOutFixtureCheck=5005,
/// <summary>
/// 等待出口信号持续一段时间
/// </summary>
SW06_WatOutFixture2=5006,
/// <summary>
/// 停止横移轨道转动,横移轨道顶升气缸下降
/// </summary>
SW07_TopCylinderDown=5007,
/// <summary>
/// 阻挡2下降,等待托盘流出
/// </summary>
SW08_StopDrive=5008,
/// <summary>
/// 等待托盘流出,上升阻挡气缸
/// </summary>
SW09_WaitTrayGo=5009,
#endregion
#region 入料装置原点返回,10000开始
/// <summary>
/// 阻挡气缸复位
/// </summary>
FR_01_StopCylinderMove=10001,
/// <summary>
/// 定位气缸下降
/// </summary>
FR_02_LocationCylinderDown=10002,
/// <summary>
/// 伺服原点返回
/// </summary>
FR_03_AxisHomeMove=10003,
/// <summary>
/// 伺服回待机点
/// </summary>
FR_04_AxisToP1=10004,
#endregion
#region 入料装置入料处理,11000开始
/// <summary>
/// 入口流水线转动,等待入料检测信号消失
/// </summary>
FI_01_InLineStart=11001,
/// <summary>
/// 入口流水线转动,等待阻挡气缸信号到位
/// </summary>
FI_02_InLineRun=11002,
/// <summary>
/// 入口流水线转动,等待入料阻挡信号消失
/// </summary>
FI_03_InLineStart = 11003,
/// <summary>
/// 入口流水线转动,等待定位工位检测到位
/// </summary>
FI_04_InLineRun = 11004,
/// <summary>
/// 已有工位检测信号,定位气缸上升
/// </summary>
FI_05_LocationUp=11005,
/// <summary>
/// 托盘定位气缸上升
/// </summary>
FI_06_TrayLocationUp=11006,
#endregion
#region 入料装置出料处理,12000开始
/// <summary>
///
/// </summary>
FO_01_OutLineStart = 11001,
#endregion
#region 出料装置移栽出料,20000开始
/// <summary>
/// 上下气缸下降
/// </summary>
PO_01_UpDownCylinderDown = 20001,
/// <summary>
/// 等待0.3秒后再夹紧
/// </summary>
PO_02_UpDownCylinderDownWait = 20002,
/// <summary>
/// 夹料气缸夹紧
/// </summary>
PO_03_ClampCylinderSlack=20003,
/// <summary>
/// 上下气缸上升
/// </summary>
PO_04_UpDownCylinderUp = 20004,
/// <summary>
/// 等待可以移栽料盘到流水线
/// </summary>
PO_05_WaitBox = 20005,
/// <summary>
/// 前后气缸前进
/// </summary>
PO_06_BeforeAfterCylinderBefore = 20006,
/// <summary>
/// 上下气缸下降
/// </summary>
PO_07_UpDownCylinderDown = 20007,
/// <summary>
/// 夹料气缸放松
/// </summary>
PO_08_ClampCylinderTighten = 20008,
/// <summary>
/// 上下气缸上升
/// </summary>
PO_09_UpdownCylinderUp = 20009,
/// <summary>
/// 前后气缸后退,等待4000
/// </summary>
PO_10_BeforeAfterCylinderAfter = 20010,
#endregion
#region 出料流水线处理,30000开始
/// <summary>
/// 出料流水线复位,定位气缸下降
/// </summary>
DL_R_CylinderDown=30001,
/// <summary>
/// 转动皮带开始运行
/// </summary>
DL_R_StartRun=30002,
/// <summary>
/// 皮带线检测处理
/// </summary>
DL_R_LineCheck=30100,
#endregion
}
public enum LineAlarmType
{
/// <summary>
/// 没有报警
/// </summary>
None = 0,
/// <summary>
/// 轴报警
/// </summary>
AxisAlarm = 1,
/// <summary>
/// 收到急停
/// </summary>
SuddenStop = 10,
/// <summary>
/// 没有气压信号
/// </summary>
NoAirCheck = 11,
/// <summary>
/// 轴运动错误,没有达到指定脉冲,但是io判断已停止运动
/// </summary>
AxisMoveError = 20,
/// <summary>
/// io信号超时未收到
/// </summary>
IoSingleTimeOut = 30,
/// <summary>
/// 电钢报警
/// </summary>
StellAlarm=50,
}
}