FeedingEquip_Partial.cs
54.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
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OnlineStore.DeviceLibrary
{
partial class FeedingEquip
{
protected override bool CheckWaitResult(LineMoveInfo moveInfo,WaitResultInfo wait)
{
if (wait.WaitType.Equals(WaitEnum.W101_BatchAxisMove))
{
string msg = "";
if (IOValue(TargetIoType).Equals(TargetIoValue))
{
return true;
}
else
{
bool result = AxisBean.ACAxisMoveIsEnd(moveInfo, wait.AxisInfo, wait.TargetPosition, wait.TargetSpeed, out msg);
if (!result)
{
LogUtil.error(msg);
}
return result;
}
}
else if (wait.WaitType.Equals(WaitEnum.W102_FeedScanCode))
{
if (LastCodeList.Count > 0)
{
return true;
}
}
return false;
}
#region 托盘检测
private void StartCheckFixture()
{
if (Config.SidesWayNum > 0)
{
int num = TrayManager.GetTrayNum(DeviceID);
if (IOValue(IO_Type.SW_TrayCheck).Equals(IO_VALUE.HIGH) && num > 0 && preTrayNum.Equals(num).Equals(false) && LineManager.Line.SwNoProcess(Config.SidesWayNum))
{
//判断是否是需要的托盘
if (NeedCurrTray())
{
TrayManager.UpdateSWState(Config.SidesWayNum, 2);
CheckLog("托盘检测(流水线阻挡)SecondStoreMove:(MIO_06_TopCylinderUp 横移顶升气缸上 升 )");
SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_06_TopCylinderUp);
CylinderMove(SecondMoveInfo, IO_Type.SW_TopCylinder_Down, IO_Type.SW_TopCylinder_Up);
}
else
{
preTrayNum = num;
TrayManager.UpdateSWState(Config.SidesWayNum, 1);
}
}
}
else
{
if (IOValue(IO_Type.FL_TrayCheck).Equals(IO_VALUE.HIGH) || IOValue(IO_Type.FL_StopCheck).Equals(IO_VALUE.HIGH))
{
int num = TrayManager.GetTrayNum(DeviceID);
//托盘在两个阻挡内
if (num > 0 && IOValue(IO_Type.FL_TrayCheck).Equals(IO_VALUE.HIGH))
{
SecondMoveInfo.NewMove(LineMoveType.CheckFixture);
CheckLog("托盘检测(流水线阻挡)SecondStoreMove:(MIO_03_StopCylinder2Down FL阻挡1上升)");
SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_03_StopCylinder2Down);
IOMove(IO_Type.FL_StopCylinder_Down1, IO_VALUE.LOW);
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.FL_StopCylinder_Down1, IO_VALUE.LOW));
}
else if (IOValue(IO_Type.FL_StopCheck).Equals(IO_VALUE.HIGH))
{
//托盘在第一个阻挡处
SecondMoveInfo.NewMove(LineMoveType.CheckFixture);
SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_01_StopCylinder1Down);
CheckLog(" 托盘检测:料盘检测 SecondStoreMove(MIO_01_StopCylinder1Down FL阻挡1下降 ,最多等待1秒)");
IOMove(IO_Type.FL_StopCylinder_Down1, IO_VALUE.HIGH);
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.FL_StopCylinder_Down1, IO_VALUE.HIGH));
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1500));
}
}
}
}
protected override void CheckFixtureProcess()
{
if (!LineManager.Line.LineCanRun())
{
return;
}
if (SecondMoveInfo.IsInWait)
{
CheckWait(SecondMoveInfo);
}
if (SecondMoveInfo.IsInWait)
{
return;
}
#region 托盘检测
if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MIO_01_StopCylinder1Down))
{
CheckLog("托盘检测(流水线阻挡)SecondStoreMove:(MIO_02_FixtureCheck FL阻挡1上升,等待FL_TrayCheck=1)");
SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_03_StopCylinder2Down);
IOMove(IO_Type.FL_StopCylinder_Down1, IO_VALUE.LOW);
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.FL_StopCylinder_Down1, IO_VALUE.LOW));
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.FL_TrayCheck, IO_VALUE.HIGH));
}
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MIO_02_FixtureCheck))
{
CheckLog("托盘检测(流水线阻挡)SecondStoreMove:(MIO_03_StopCylinder2Down FL阻挡1上升)");
SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_03_StopCylinder2Down);
IOMove(IO_Type.FL_StopCylinder_Down1, IO_VALUE.LOW);
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.FL_StopCylinder_Down1, IO_VALUE.LOW));
}
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MIO_03_StopCylinder2Down))
{
CheckLog("托盘检测(流水线阻挡)SecondStoreMove:(MIO_04_Wait ,等待编码信号稳定)");
SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_04_Wait);
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
}
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MIO_04_Wait))
{
//此处先对托盘号进行验证
preTrayNum = currTrayNum;
currTrayNum = TrayManager.GetTrayNum(DeviceID);
if (TrayManager.RightTrayCode(currTrayNum, preTrayNum, false))
{
if (TrayManager.ErrorStoreId.Equals(DeviceID))
{
TrayManager.UpdateTrayNumError(-1, "");
}
//出料中,需要拦盘
if (NeedCurrTray(true))
{
//preTrayNum = currMoveTrayNum;
// SecondMoveInfo.MoveParam = new InOutParam(currMoveTrayNum);
SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_05_WaitTime);
SecondMoveInfo.EndStepWait();
return;
}
else
{
bool isFull = TrayManager.TrayIsFull(currTrayNum);
LogInfo(SecondMoveInfo.MoveNum + "***************上个托盘号【" + preTrayNum + "】,当前" + (isFull ? "有料托盘" : "空托盘") + "【" + currTrayNum + "】没有出入料任务,放盘通过~");
CheckLog("托盘放行 SecondStoreMove:(MO_14_WaitCanGo ,移栽2,需要判断是否可以放盘通过,最多等待10000)");
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_15_WaitCanGo);
}
}
else
{
string msg = Name + " 托盘顺序错乱,上个托盘号【" + preTrayNum + "】当前托盘号 【" + currTrayNum + "】最大盘号【" + TrayManager.MaxTrayNum + "】";
TrayManager.UpdateTrayNumError(DeviceID, msg);
LogUtil.error(msg);
return;
}
}
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MIO_05_WaitTime))
{
CheckLog("托盘检测(流水线阻挡)SecondStoreMove:(MIO_06_TopCylinderUp 顶升气缸上 升 )");
SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_06_TopCylinderUp);
CylinderMove(SecondMoveInfo, IO_Type.FL_TopCylinder_Down, IO_Type.FL_TopCylinder_Up);
}
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MIO_06_TopCylinderUp))
{
CheckLog("托盘检测(流水线阻挡)SecondStoreMove:(MIO_07_LocationCylinderUp , 定位气缸上升 )");
SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_07_LocationCylinderUp);
if (Config.SidesWayNum > 0)
{
CylinderMove(SecondMoveInfo, IO_Type.SW_LocationCylinder_Down, IO_Type.SW_LocationCylinder_Up);
}
}
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MIO_07_LocationCylinderUp))
{
CheckLog("托盘检测(流水线阻挡)*************** 托盘号【" + currTrayNum + "】");
//判断盘是空盘,空盘并且编号正确才需要放料盘过去
if (MoveInfo.MoveType.Equals(LineMoveType.InStore))
{
LogInfo(SecondMoveInfo.MoveNum + "*************** 托盘号【" + currTrayNum + "】 ,需要入料,移栽料盘");
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_11_CodeRember);
SecondMoveInfo.EndStepWait();
}
else if (MoveInfo.MoveType.Equals(LineMoveType.OutStore))
{
LogInfo(SecondMoveInfo.MoveNum + "*************** 托盘号【" + currTrayNum + "】 ,需要出库,开始出库处理,升降伺服到P1点");
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_201_UpDownToP1);
InStoreLog(" MO_201_UpDownToP1 紧急出料移栽:升降伺服到P1点");
UpdownAxis.AbsMove(MoveInfo, Config.UpDownAxisP1, Config.UpdownAxis_P1Speed);
}
else
{
CheckLog("托盘检测 SecondStoreMove:(MO_13_LoactionCylinder_Down ,托盘号【" + currTrayNum + "】,直接放盘通过,定位气缸下降)");
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_13_LoactionCylinder_Down);
CylinderMove(SecondMoveInfo, IO_Type.SW_LocationCylinder_Up, IO_Type.SW_LocationCylinder_Down);
}
}
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MIO_08_WaitInStore) && MoveInfo.MoveType.Equals(LineMoveType.None))
{
CheckLog("托盘放行 SecondStoreMove:(MIO_09_WaitLetFixtureGo ,等待移栽完成后放开阻挡)");
StartOutStoreMove(SecondMoveInfo.MoveParam);
SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_09_WaitLetFixtureGo);
}
#endregion
#region 不需要出出料,直接放行
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_12_MoveOk))
{
//更新托盘条码信息
string code = CodeManager.ProcessCode(LastCodeList);
TrayManager.UpdateTrayCode(currTrayNum, code);
if (code.Equals(""))
{
TrayManager.UpdateInStoreNG(currTrayNum, true);
}
//从服务器获取库位号
string result = StoreServerManager.CodeReceived(Name, currTrayNum, LastCodeList, LastHeight, LastWidth);
if (!result.Equals(""))
{
TrayManager.UpdateInStoreNG(currTrayNum, true);
LogUtil.error(result);
}
InStoreLog(" SecondStoreMove=MO_13_LoactionCylinder_Down 上料横移机构上升,托盘开始放行,定位气缸下降");
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_13_LoactionCylinder_Down);
CylinderMove(SecondMoveInfo, IO_Type.SW_LocationCylinder_Up, IO_Type.SW_LocationCylinder_Down);
}
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_13_LoactionCylinder_Down))
{
CheckLog("托盘检测 SecondStoreMove:(MO_14_TopCylinder_Down ,托盘号【" + currTrayNum + "】,直接放盘通过,顶升气缸下降)");
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_14_TopCylinder_Down);
//只有2号横移不需要下降
if (Config.SidesWayNum.Equals(2))
{
CylinderMove(SecondMoveInfo, IO_Type.SW_TopCylinder_Up, IO_Type.SW_TopCylinder_Down);
}
else
{
CylinderMove(SecondMoveInfo, IO_Type.FL_TopCylinder_Up, IO_Type.FL_TopCylinder_Down);
}
}
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_14_TopCylinder_Down))
{
if (Config.SidesWayNum > 0)
{
//更新横移托盘已处理完成
TrayManager.UpdateSWState(Config.SidesWayNum, 1);
preTrayNum = currTrayNum;
CheckLog("托盘放行 SecondStoreMove:(托盘放行结束) ");
SecondMoveInfo.EndMove();
}
else
{
CheckLog("托盘放行 SecondStoreMove:(MO_14_WaitCanGo ,移栽2,需要判断是否可以放盘通过,最多等待10000)");
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_15_WaitCanGo);
}
}
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_15_WaitCanGo))
{
CheckLog("托盘放行 SecondStoreMove:(MO_15_StopCylinder2_Down ,阻挡气缸1-2下降)");
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_16_StopCylinder2_Down);
IOMove(IO_Type.FL_StopCylinder_Down2, IO_VALUE.HIGH);
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.FL_StopCylinder_Down2, IO_VALUE.HIGH));
// SecondMoveInfo.EndStepWait();
}
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_16_StopCylinder2_Down))
{
CheckLog("托盘放行 SecondStoreMove:(MO_16_Tray_Check , 阻挡2托盘检测=0), 延时2秒)");
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_17_Tray_Check);
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Check2, IO_VALUE.LOW));
}
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_17_Tray_Check))
{
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_18_StopCylinder_Back);
CheckLog("托盘放行 SecondStoreMove:(MO_17_StopCylinder_Back ,FL阻挡2上升 )");
IOMove(IO_Type.FL_StopCylinder_Down2, IO_VALUE.LOW);
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.FL_StopCylinder_Down2, IO_VALUE.LOW));
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(200));
}
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_18_StopCylinder_Back))
{
preTrayNum = currTrayNum;
CheckLog("托盘放行 SecondStoreMove:(托盘放行结束) ");
// IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.HIGH);
SecondMoveInfo.EndMove();
}
#endregion
#region 紧急出料,先移载料盘
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_201_UpDownToP1) && MoveInfo.MoveStep >= (LineMoveStep.FO_07_LocationCylinder_Up))
{
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_202_MoveCylinder_Give);
InStoreLog(" MO_202_MoveCylinder_Give 紧急出料移栽:上料横移机构到放料端");
CylinderMove(SecondMoveInfo, IO_Type.SL_MoveCylinder_Take, IO_Type.SL_MoveCylinder_Give);
}
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_202_MoveCylinder_Give))
{
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_203_MoveCylinder_Down);
InStoreLog(" MO_203_MoveCylinder_Down 紧急出料移栽:上料横移机构下降");
CylinderMove(SecondMoveInfo, IO_Type.SL_MoveCylinder_Up, IO_Type.SL_MoveCylinder_Down);
}
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_203_MoveCylinder_Down))
{
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_204_UpdownAxisToP2);
int targetP = Config.GetUpdownPositionP2(SecondMoveInfo.MoveParam.PlateH);
InStoreLog(" MO_204_UpdownAxisToP2 紧急出料移栽:升降伺服下降到指定位置" + targetP);
UpdownAxis.AbsMove(MoveInfo, targetP, Config.UpdownAxis_P2Speed);
}
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_204_UpdownAxisToP2))
{
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_205_MoveCylinder_Tighten);
InStoreLog(" MO_205_MoveCylinder_Tighten 紧急出料移栽:上料气缸夹紧");
CylinderMove(SecondMoveInfo, IO_Type.SL_MoveCylinder_Slack, IO_Type.SL_MoveCylinder_Tighten);
}
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_205_MoveCylinder_Tighten))
{
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_206_UpdownAxisToP1);
InStoreLog(" MO_206_UpdownAxisToP1 紧急出料移栽:升降伺服到P1");
UpdownAxis.AbsMove(MoveInfo, Config.UpDownAxisP1, Config.UpdownAxis_P1Speed);
}
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_206_UpdownAxisToP1))
{
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_207_MoveCylinder_Up);
InStoreLog(" MO_207_MoveCylinder_Up 紧急出料移栽:上料横移机构上升,更新【" + currTrayNum + "】为空托盘");
CylinderMove(SecondMoveInfo, IO_Type.SL_MoveCylinder_Down, IO_Type.SL_MoveCylinder_Up);
//更新此托盘为空托盘
TrayManager.UpdateTrayInfo(currTrayNum, false);
}
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_207_MoveCylinder_Up))
{
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_208_MoveCylinder_Take);
InStoreLog(" MO_208_MoveCylinder_Take 紧急出料移栽:上料横移机构到取料端");
CylinderMove(SecondMoveInfo, IO_Type.SL_MoveCylinder_Give, IO_Type.SL_MoveCylinder_Take);
}
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_208_MoveCylinder_Take))
{
InStoreLog(" SecondStoreMove=MO_13_LoactionCylinder_Down 托盘开始放行,定位气缸下降");
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_13_LoactionCylinder_Down);
CylinderMove(SecondMoveInfo, IO_Type.SW_LocationCylinder_Up, IO_Type.SW_LocationCylinder_Down);
}
#endregion
}
#endregion
#region 入料流程
private bool StartInStoreP()
{
//若定位工位,阻挡工位,入料口有一个有料架,需要进行处理
if (IOValue(IO_Type.SL_Location_Check).Equals(IO_VALUE.HIGH) || IOValue(IO_Type.SL_Stop_Check).Equals(IO_VALUE.HIGH) || IOValue(IO_Type.SL_Entry_Check).Equals(IO_VALUE.HIGH))
{
StartInStoreMove(null);
}
else if (IOValue(IO_Type.SL_Out_Check).Equals(IO_VALUE.HIGH))
{
//线体出口检测到料架,需要通知AGV小车
}
return false ;
}
public override bool StartInStoreMove(InOutParam param)
{
runStatus = LineRunStatus.Busy;
lineStatus = LineStatus.InStoreExecute;
MoveInfo.NewMove(LineMoveType.InStore);
MoveInfo.MoveParam = new InOutParam();
//判断是哪个工位有料架
if (IOValue(IO_Type.SL_Location_Check).Equals(IO_VALUE.HIGH))
{
//定位工位有料架,直接开始入料
MoveInfo.NextMoveStep(LineMoveStep.FI_07_LocationCylinder_Up);
InStoreLog(" 定位工位检测到料架:FI_07_LocationCylinder_Up缓冲阻挡上升, 定位气缸上升");
IOMove(IO_Type.SL_Buffer_StopDown, IO_VALUE.LOW);//缓冲阻挡下降
CylinderMove(MoveInfo, IO_Type.SL_LocationCylinder_Down, IO_Type.SW4_LocationCylinder_Up);
}
else
{
MoveInfo.NextMoveStep(LineMoveStep.FI_01_TrayLocation_After);
TrayLCylinderAfter(MoveInfo);
InStoreLog("检测到料架, FI_01_TrayLocation_After :升降盘定位气缸下降");
}
return true ;
}
private void LineInStoreProcess()
{
IOMove(IO_Type.Line_Run, IO_VALUE.LOW);
//判断是哪个工位有料架
if (IOValue(IO_Type.SL_Location_Check).Equals(IO_VALUE.HIGH))
{
//定位工位有料架,直接开始入料
MoveInfo.NextMoveStep(LineMoveStep.FI_07_LocationCylinder_Up);
InStoreLog(" FI_07_LocationCylinder_Up 定位工位检测到料架:缓冲阻挡上升, 定位气缸上升");
IOMove(IO_Type.SL_Buffer_StopDown, IO_VALUE.LOW);//缓冲阻挡下降
CylinderMove(MoveInfo, IO_Type.SL_LocationCylinder_Down, IO_Type.SW4_LocationCylinder_Up);
}
//阻挡工位有料架,流水线转动一个工位
else if (IOValue(IO_Type.SL_Stop_Check).Equals(IO_VALUE.HIGH))
{
MoveInfo.NextMoveStep(LineMoveStep.FI_03_LineStart);
IOMove(IO_Type.SL_Entry_StopDown, IO_VALUE.LOW);//进料阻挡上升
IOMove(IO_Type.SL_Buffer_StopDown, IO_VALUE.HIGH);//缓冲阻挡下降
IOMove(IO_Type.Line_Run, IO_VALUE.HIGH);
//等待指定时间
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(2000));
InStoreLog(" FI_03_InLineStart 入料检测:阻挡检测有料架,进料阻挡上升,缓冲阻挡下降,流水线转动2000");
}
else if (IOValue(IO_Type.SL_Entry_Check).Equals(IO_VALUE.HIGH))
{
//判断料架的编码是否正确
int num = TrayManager.GetShelfNum(DeviceID);
if (num <= 0)
{
MoveInfo.EndMove();
runStatus = LineRunStatus.Runing;
LogUtil.info(" 入料检测有料架,获取不到正确的料架编号,入料结束");
return;
}
MoveInfo.NextMoveStep(LineMoveStep.FI_03_LineStart);
IOMove(IO_Type.SL_Entry_StopDown, IO_VALUE.HIGH);//进料阻挡下降
IOMove(IO_Type.SL_Buffer_StopDown, IO_VALUE.LOW);//缓冲阻挡上升
IOMove(IO_Type.Line_Run, IO_VALUE.HIGH);
//等待指定时间
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(2000));
InStoreLog(" FI_03_InLineStart 入料检测:入料检测有料架,进料阻挡下降,缓冲阻挡上升,流水线转动2000");
}
else
{
MoveInfo.EndMove();
runStatus = LineRunStatus.Runing;
LogUtil.info(" 未检测到料架,入料结束");
}
}
protected override void InStoreProcess()
{
if (MoveInfo.IsInWait)
{
CheckWait(MoveInfo);
}
if (MoveInfo.IsInWait)
{
return;
}
if (MoveInfo.MoveStep.Equals(LineMoveStep.Wait))
{
MoveInfo.NextMoveStep(LineMoveStep.FI_01_TrayLocation_After);
InStoreLog(" FI_01_TrayLocation_After 开始:升降盘定位气缸下降");
TrayLCylinderAfter(MoveInfo);
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FI_01_TrayLocation_After))
{
MoveInfo.NextMoveStep(LineMoveStep.FI_02_LocationCylinder_Down);
InStoreLog(" FI_02_LocationCylinder_Down 开始:定位气缸下降,提升伺服移动到P1");
CylinderMove(MoveInfo, IO_Type.SL_LocationCylinder_Up, IO_Type.SL_LocationCylinder_Down);
BatchAxis.AbsMove(Config.BatchAxisP1, Config.BatchAxis_P1Speed);
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FI_02_LocationCylinder_Down))
{
LineInStoreProcess();
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FI_03_LineStart))
{
LineInStoreProcess();
}
//else if (MoveInfo.MoveStep.Equals(LineMoveStep.FI_04_LineRunCheck))
//{
// MoveInfo.NextMoveStep(LineMoveStep.FI_05_LineStart);
// IOMove(IO_Type.Line_Run, IO_VALUE.LOW);
// IOMove(IO_Type.SL_Entry_Check, IO_VALUE.LOW);
// MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SL_Stop_Check, IO_VALUE.LOW));
// InStoreLog(" FI_05_InLineStart 开始:进料线体运转,进料阻挡上升,等待SL_Stop_Check=0");
// IOMove(IO_Type.Line_Run, IO_VALUE.HIGH);
//}
//else if (MoveInfo.MoveStep.Equals(LineMoveStep.FI_05_LineStart))
//{
// MoveInfo.NextMoveStep(LineMoveStep.FI_06_LineRunCheck);
// IOMove(IO_Type.Line_Run, IO_VALUE.HIGH);
// MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SL_Location_Check, IO_VALUE.HIGH));
// InStoreLog(" FI_06_InLineRun 开始:SL_Location_Check=1");
//}
//else if (MoveInfo.MoveStep.Equals(LineMoveStep.FI_06_LineRunCheck))
//{
// MoveInfo.NextMoveStep(LineMoveStep.FI_07_LocationCylinder_Up);
// InStoreLog(" FI_07_LocationCylinder_Up 开始:进料线体停止,定位气缸上升");
// IOMove(IO_Type.Line_Run, IO_VALUE.LOW);
// CylinderMove(MoveInfo, IO_Type.SL_LocationCylinder_Down, IO_Type.SW4_LocationCylinder_Up);
//}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FI_07_LocationCylinder_Up))
{
MoveInfo.NextMoveStep(LineMoveStep.FI_08_BatchAxisToP2);
InStoreLog(" FI_08_BatchAxisToP2 开始:提升轴下降到位P2");
IOMove(IO_Type.Line_Run, IO_VALUE.LOW);
BatchAxis.AbsMove(MoveInfo, Config.BatchAxisP2, Config.BatchAxis_P2Speed);
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FI_08_BatchAxisToP2))
{
MoveInfo.NextMoveStep(LineMoveStep.FI_09_TrayLocation_Before);
InStoreLog(" FI_09_TrayLocation_Before 开始:升降盘定位气缸前进");
TrayLCylinderBefore(MoveInfo);
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FI_09_TrayLocation_Before))
{
MoveInfo.NextMoveStep(LineMoveStep.FI_10_AxisUpMove);
InStoreLog(" FI_10_AxisUpMove 开始:上料轴开始慢速上升到P3点,等待加测到料盘");
BatchAxisToP3();
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FI_10_AxisUpMove))
{
if (IOValue(IO_Type.SL_Location_Check).Equals(IO_VALUE.HIGH))
{
//有料盘
MoveInfo.NextMoveStep(LineMoveStep.FI_11_MoveCylinder_Take);
InStoreLog(" FI_11_MoveCylinder_Take 料盘移栽:检测到料盘,上料横移气缸到取料端");
CylinderMove(MoveInfo, IO_Type.SL_MoveCylinder_Give, IO_Type.SL_MoveCylinder_Take);
}
else
{
//无料盘
MoveInfo.NextMoveStep(LineMoveStep.FI_31_BatchAxisToP2);
InStoreLog(" FI_31_BatchAxisToP2 料盘移栽:未检测到料盘,提升伺服到P2点");
BatchAxis.AbsMove(MoveInfo, Config.BatchAxisP2, Config.BatchAxis_P2Speed);
}
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FI_11_MoveCylinder_Take))
{
MoveInfo.NextMoveStep(LineMoveStep.FI_12_MoveCylinder_Down);
InStoreLog(" FI_12_MoveCylinder_Down 料盘移栽:上料横移机构下降");
CylinderMove(MoveInfo, IO_Type.SL_MoveCylinder_Up, IO_Type.SL_MoveCylinder_Down);
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FI_12_MoveCylinder_Down))
{
MoveInfo.NextMoveStep(LineMoveStep.FI_13_MoveCylinder_Tighten);
InStoreLog(" FI_13_MoveCylinder_Tighten 料盘移栽:上料横移机构夹紧");
CylinderMove(MoveInfo, IO_Type.SL_MoveCylinder_Slack, IO_Type.SL_MoveCylinder_Tighten);
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FI_13_MoveCylinder_Tighten))
{
MoveInfo.NextMoveStep(LineMoveStep.FI_14_MoveCylinder_Up);
InStoreLog(" FI_14_MoveCylinder_Up 料盘移栽:上料横移机构上升,同时伺服运动到P3");
CylinderMove(MoveInfo, IO_Type.SL_MoveCylinder_Down, IO_Type.SL_MoveCylinder_Up);
BatchAxisToP3();
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FI_14_MoveCylinder_Up))
{
MoveInfo.NextMoveStep(LineMoveStep.FI_15_SaveSize);
LastHeight = GetHeight();
LastWidth = GetWidth();
InStoreLog(" FI_15_SaveSize 料盘移栽:记录高度尺寸 高度【" + LastHeight + "】宽度【" + LastWidth + "】");
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FI_15_SaveSize))
{
MoveInfo.NextMoveStep(LineMoveStep.FI_16_MoveCylinder_Emptying);
InStoreLog(" FI_16_MoveCylinder_Emptying 料盘移栽:上料横移气缸放料SOL");
CylinderMove(MoveInfo, IO_Type.SL_MoveCylinder_Take, IO_Type.SL_MoveCylinder_Take);
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FI_16_MoveCylinder_Emptying))
{
MoveInfo.NextMoveStep(LineMoveStep.FI_17_WaitTray);
InStoreLog(" FI_17_WaitTray 料盘移栽:等待空托盘到达,并顶升上升,定位上升");
//TODO 此处需要等待空托盘
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FI_17_WaitTray) && SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_11_CodeRember))//TODO
{
MoveInfo.NextMoveStep(LineMoveStep.FI_18_MoveCylinder_Down);
InStoreLog(" FI_18_MoveCylinder_Down 料盘移栽:上料机构下降");
CylinderMove(MoveInfo, IO_Type.SL_MoveCylinder_Up, IO_Type.SL_MoveCylinder_Down);
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FI_18_MoveCylinder_Down))
{
MoveInfo.NextMoveStep(LineMoveStep.FI_19_UpdownAxisToP2);
int targetPositon = Config.GetUpdownPositionP2(LastHeight);
InStoreLog(" FI_19_UpdownAxisToP2 料盘移栽:移栽伺服下降到指定位置:" + targetPositon);
UpdownAxis.AbsMove(MoveInfo, targetPositon, Config.UpdownAxis_P2Speed);
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FI_19_UpdownAxisToP2))
{
MoveInfo.NextMoveStep(LineMoveStep.FI_20_MoveCylinder_Slack);
InStoreLog(" FI_20_MoveCylinder_Slack 料盘移栽:上料气缸放松");
CylinderMove(MoveInfo, IO_Type.SL_MoveCylinder_Tighten, IO_Type.SL_MoveCylinder_Slack);
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FI_20_MoveCylinder_Slack))
{
MoveInfo.NextMoveStep(LineMoveStep.FI_21_UpDownAxisToP1);
InStoreLog(" FI_21_UpDownAxisToP1 料盘移栽:升降伺服到P1点");
UpdownAxis.AbsMove(MoveInfo, Config.UpDownAxisP1, Config.UpdownAxis_P1Speed);
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FI_21_UpDownAxisToP1))
{
MoveInfo.NextMoveStep(LineMoveStep.FI_22_MoveCylinder_Up);
InStoreLog(" FI_22_MoveCylinder_Up 料盘移栽:上料横移机构上升,记录托盘尺寸, 开始放行,");
CylinderMove(MoveInfo, IO_Type.SL_MoveCylinder_Down, IO_Type.SL_MoveCylinder_Up);
TrayManager.UpdateTrayInfo(currTrayNum, true, 1, "", "", LastHeight, LastWidth);
LastCodeList = new List<string>();
InStoreLog(" SecondStoreMove=MO_12_MoveOk 开始扫码");
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_12_MoveOk);
MoveInfo.WaitList.Add(WaitResultInfo.WaitFeedScanCode());
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(5000));
Task<List<string>> scanTask = Task.Factory.StartNew(delegate
{
LastCodeList = CodeManager.CameraScan(Config.GetCameraList());
if (LastCodeList.Count <= 0)
{
LastCodeList = CodeManager.CameraScan(Config.GetCameraList());
}
return LastCodeList;
});
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FI_22_MoveCylinder_Up))
{
MoveInfo.NextMoveStep(LineMoveStep.FI_23_MoveCylinder_Take);
InStoreLog(" FI_23_MoveCylinder_Take 料盘移栽:上料横移机构到取料端");
CylinderMove(MoveInfo, IO_Type.SL_MoveCylinder_Give, IO_Type.SL_MoveCylinder_Take);
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FI_23_MoveCylinder_Take))
{
MoveInfo.NextMoveStep(LineMoveStep.FI_31_BatchAxisToP2);
InStoreLog(" FI_31_BatchAxisToP2 上料完成:未检测到料盘,提升伺服到P2点");
BatchAxis.AbsMove(MoveInfo, Config.BatchAxisP2, Config.BatchAxis_P2Speed);
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FI_31_BatchAxisToP2))
{
MoveInfo.NextMoveStep(LineMoveStep.FI_32_TrayLocationCylinder_After);
InStoreLog(" FI_32_TrayLocationCylinder_After 上料完成: 升降盘定位气缸后退");
TrayLCylinderAfter(MoveInfo);
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FI_32_TrayLocationCylinder_After))
{
MoveInfo.NextMoveStep(LineMoveStep.FI_33_BatchAxisToP1);
InStoreLog(" FI_33_BatchAxisToP1 上料完成:提升伺服到P1点");
BatchAxis.AbsMove(MoveInfo, Config.BatchAxisP1, Config.BatchAxis_P1Speed);
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FI_33_BatchAxisToP1))
{
MoveInfo.NextMoveStep(LineMoveStep.FI_35_OutTopCylinder_Up);
InStoreLog(" FI_34_LocationCylinder_Down 上料完成,出口顶升气缸上升,出料缓冲阻挡上升");
CylinderMove(MoveInfo, IO_Type.SL_OutTopCylinder_Down, IO_Type.SL_OutTopCylinder_Up);
IOMove(IO_Type.SL_Out_StopDown, IO_VALUE.LOW);
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FI_35_OutTopCylinder_Up))
{
//TODO
MoveInfo.NextMoveStep(LineMoveStep.FI_36_SideWayLineRun);
InStoreLog(" FI_36_SideWayLineRun 上料完成, 线体横移电机运转,等待SL1线体出口横移检测");
IOMove(IO_Type.SL_LocationSideWay_Run, IO_VALUE.HIGH);
IOMove(IO_Type.SL_OutSideWay_Run, IO_VALUE.HIGH);
MoveInfo.OneWaitCanEndStep = true;
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(2000));
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SL_SideWay_OutCheck, IO_VALUE.HIGH));
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FI_36_SideWayLineRun))
{
MoveInfo.NextMoveStep(LineMoveStep.FI_37_LineStop);
InStoreLog(" FI_37_LineStop 上料完成, 料架到达出口,线体横移电机停止 ");
IOMove(IO_Type.SL_LocationSideWay_Run, IO_VALUE.LOW);
IOMove(IO_Type.SL_OutSideWay_Run, IO_VALUE.LOW);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(300));
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FI_37_LineStop))
{
MoveInfo.NextMoveStep(LineMoveStep.FI_38_TopCylinderDown);
InStoreLog(" FI_38_TopCylinderDown 上料完成, 料架到达出口,出口顶升下降,定位气缸下降, ");
CylinderMove(MoveInfo, IO_Type.SL_OutTopCylinder_Up, IO_Type.SL_OutTopCylinder_Down);
CylinderMove(MoveInfo, IO_Type.SL_LocationCylinder_Up, IO_Type.SL_LocationCylinder_Down);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(300));
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FI_38_TopCylinderDown))
{
MoveInfo.NextMoveStep(LineMoveStep.FI_39_OutLineRun);
InStoreLog(" FI_39_OutLineRun 上料完成, 出口线体运转,料架到达出口处, 通知AGV取空料架, ");
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FI_40_OutLineRun))
{
MoveInfo.NextMoveStep(LineMoveStep.FI_40_OutLineRun);
InStoreLog(" FI_40_OutLineRun 上料完成, AGV到达,继续转动出口线体,送走出料料架, ");
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FI_40_OutLineRun))
{
MoveInfo.NextMoveStep(LineMoveStep.FI_41_OutLineRun);
InStoreLog(" FI_41_OutLineRun 上料完成, 上料完成, 料架送出, ");
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FI_41_OutLineRun))
{
MoveInfo.EndMove();
runStatus = LineRunStatus.Runing;
LogUtil.info("空料架已送出,入料结束");
}
}
private void BatchAxisToP3()
{
MoveInfo.CanWhileCount = 0;
// 需要增加定时器,获取验证信号并停止伺服
StartMovePosition = BatchAxis.GetAclPosition();
MoveInfo.WaitList.Add(WaitResultInfo.WaitBatchAxis(Config.Batch_Axis, Config.BatchAxisP3, Config.BatchAxis_P3Speed));
Config.Batch_Axis.TargetPosition = Config.BatchAxisP3;
BatchAxis.AbsMove(Config.BatchAxisP3, Config.BatchAxis_P3Speed);
//开始检测信号
BatchAxisStartCheck();
}
private int StartMovePosition = 0;
private int EndMovePosition = 0;
private int LastHeight = 0;
private int LastWidth = 0;
private List<string> LastCodeList = new List<string>();
private int GetHeight()
{
int AxisChangeValue = Config.Height_ChangeValue;
//计算高度
EndMovePosition = BatchAxis.GetAclPosition();
LastHeight = (int)Math.Ceiling(1F * (EndMovePosition - StartMovePosition) / AxisChangeValue);
int addHeight = 0;
//如果检测信号未亮,极限亮了,需要补充高
//if (IOManager.IOValue(IO_Type.TrayCheck_LoadMaterial).Equals(IO_VALUE.LOW))
//{
// addHeight = Config.LastTrayAddHeight;
//}
LastHeight += addHeight;
string msg = Name + " 计算盘高:上升前【" + StartMovePosition + "】实时【" + EndMovePosition + "】补充【" + addHeight + "】计算后【" + LastHeight + "】";
if (LastHeight <= 8) { LastHeight = 8; }
else
{
LastHeight = (int)Math.Ceiling(1F * LastHeight / 4) * 4;
}
LogUtil.info(msg + ",归类为" + LastHeight);
return LastHeight;
}
private int GetWidth()
{
int width = 15;
if (IOValue(IO_Type.SL_TrayCheck4).Equals(IO_VALUE.HIGH))
{
width = 15;
}
else if (IOValue(IO_Type.SL_TrayCheck3).Equals(IO_VALUE.HIGH))
{
width = 13;
}
else if (IOValue(IO_Type.SL_TrayCheck2).Equals(IO_VALUE.HIGH))
{
width = 11;
}
else if (IOValue(IO_Type.SL_TrayCheck1).Equals(IO_VALUE.HIGH))
{
width = 7;
}
return width;
}
#endregion
/// <summary>
/// 是否需要拦截当前托盘进行处理
/// </summary>
/// <returns></returns>
internal bool NeedCurrTray(bool checkAndMove = false )
{
int trayNum = TrayManager.GetTrayNum(Config.Id);
bool isFull = TrayManager.TrayIsFull(trayNum);
TrayInfo info = TrayManager.GetTrayInfo(trayNum);
InOutParam param = new InOutParam(trayNum, info.WareCode, info.PosId, info.PlateH, info.PlateW);
//是出料的模块
if (Config.IsCanOut.Equals(1))
{
//此托盘是紧急出料盘,需要通过料架出库
if ((IOValue(IO_Type.SW_ReelCheck).Equals(IO_VALUE.HIGH) || IOValue(IO_Type.FL_ReelCheck).Equals(IO_VALUE.HIGH))&&info.EmergencyOut)
{
if (isFull && runStatus.Equals(LineRunStatus.Runing) && MoveInfo.MoveType.Equals(LineMoveType.OutStore))
{
lastOutParam = param;
if (checkAndMove)
{
SecondMoveInfo.MoveParam = param;
}
// return true;
//TODO 开始出库
StartOutStoreMove(param);
}
}
}
else
{
if (!isFull && runStatus.Equals(LineRunStatus.Runing) && MoveInfo.MoveType.Equals(LineMoveType.InStore))
{
//入料执行中, 且需要空托盘
if (MoveInfo.MoveStep >= LineMoveStep.FI_11_MoveCylinder_Take && MoveInfo.MoveStep <= LineMoveStep.FI_17_WaitTray)
{
if (checkAndMove)
{
SecondMoveInfo.MoveParam = param;
}
LogUtil.info(Name + "拦截到空托盘【" + trayNum + "】,入料执行中,需要空托盘");
return true;
}
}
}
return false;
}
#region 出料流程
private InOutParam lastOutParam = null;
public override bool StartOutStoreMove(InOutParam param)
{
runStatus = LineRunStatus.Busy;
lineStatus = LineStatus.OutStoreExecute;
MoveInfo.NewMove(LineMoveType.OutStore);
MoveInfo.MoveParam = new InOutParam();
MoveInfo.NextMoveStep(LineMoveStep.FO_01_TrayLocation_After);
TrayLCylinderAfter(MoveInfo);
InStoreLog("检测到料架, FO_01_TrayLocation_After :升降盘定位气缸后退");
return true;
}
private void LineOutStoreProcess()
{
IOMove(IO_Type.Line_Run, IO_VALUE.LOW);
//判断是哪个工位有料架
if (IOValue(IO_Type.SL_Location_Check).Equals(IO_VALUE.HIGH))
{
//定位工位有料架,直接开始入料
MoveInfo.NextMoveStep(LineMoveStep.FO_07_LocationCylinder_Up);
InStoreLog(" FO_07_LocationCylinder_Up 定位工位检测到料架:缓冲阻挡上升, 定位气缸上升");
IOMove(IO_Type.SL_Buffer_StopDown, IO_VALUE.LOW);//缓冲阻挡下降
CylinderMove(MoveInfo, IO_Type.SL_LocationCylinder_Down, IO_Type.SW4_LocationCylinder_Up);
}
//阻挡工位有料架,流水线转动一个工位
else if (IOValue(IO_Type.SL_Stop_Check).Equals(IO_VALUE.HIGH))
{
MoveInfo.NextMoveStep(LineMoveStep.FO_03_LineStart);
IOMove(IO_Type.SL_Entry_StopDown, IO_VALUE.LOW);//进料阻挡上升
IOMove(IO_Type.SL_Buffer_StopDown, IO_VALUE.HIGH);//缓冲阻挡下降
IOMove(IO_Type.Line_Run, IO_VALUE.HIGH);
//等待指定时间
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(2000));
InStoreLog(" FO_03_InLineStart 出料检测:阻挡工位有料架,进料阻挡上升,缓冲阻挡下降,流水线转动2000");
}
else if (IOValue(IO_Type.SL_Entry_Check).Equals(IO_VALUE.HIGH))
{
MoveInfo.NextMoveStep(LineMoveStep.FO_03_LineStart);
IOMove(IO_Type.SL_Entry_StopDown, IO_VALUE.HIGH);//进料阻挡下降
IOMove(IO_Type.SL_Buffer_StopDown, IO_VALUE.LOW);//缓冲阻挡上升
IOMove(IO_Type.Line_Run, IO_VALUE.HIGH);
//等待指定时间
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(2000));
InStoreLog(" FO_03_InLineStart 出料检测:入料工位有料架,进料阻挡下降,缓冲阻挡上升,流水线转动2000");
}
else
{
MoveInfo.EndMove();
runStatus = LineRunStatus.Runing;
LogUtil.info(" 未检测到料架,出料结束");
}
}
protected override void OutStoreProcess()
{
if (MoveInfo.IsInWait)
{
CheckWait(MoveInfo);
}
if (MoveInfo.IsInWait)
{
return;
}
if (MoveInfo.MoveStep.Equals(LineMoveStep.Wait))
{
MoveInfo.NextMoveStep(LineMoveStep.FO_01_TrayLocation_After);
TrayLCylinderAfter(MoveInfo);
InStoreLog("检测到料架, FO_01_TrayLocation_After :升降盘定位气缸后退");
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FO_01_TrayLocation_After))
{
MoveInfo.NextMoveStep(LineMoveStep.FO_02_LocationCylinder_Down);
InStoreLog(" FO_02_LocationCylinder_Down 开始:定位气缸下降,提升轴移动到P1");
CylinderMove(MoveInfo, IO_Type.SL_LocationCylinder_Up, IO_Type.SL_LocationCylinder_Down);
BatchAxis.AbsMove(Config.BatchAxisP1, Config.BatchAxis_P1Speed);
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FO_02_LocationCylinder_Down))
{
LineOutStoreProcess();
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FO_03_LineStart))
{
LineOutStoreProcess();
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FO_07_LocationCylinder_Up))
{
MoveInfo.NextMoveStep(LineMoveStep.FO_08_BatchAxisToP2);
InStoreLog(" FO_08_BatchAxisToP2 开始:提升轴下降到位P2");
IOMove(IO_Type.Line_Run, IO_VALUE.LOW);
BatchAxis.AbsMove(MoveInfo, Config.BatchAxisP2, Config.BatchAxis_P2Speed);
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FO_08_BatchAxisToP2))
{
MoveInfo.NextMoveStep(LineMoveStep.FO_09_TrayLocation_Before);
InStoreLog(" FO_09_TrayLocation_Before 开始:升降盘定位气缸前进");
TrayLCylinderBefore(MoveInfo);
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FO_09_TrayLocation_Before))
{
MoveInfo.NextMoveStep(LineMoveStep.FO_10_AxisUpMove);
InStoreLog(" FO_10_AxisUpMove 开始:上料轴开始慢速上升到P3点");
BatchAxis.AbsMove(MoveInfo, Config.BatchAxisP3, Config.BatchAxis_TargetSpeed);
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FO_10_AxisUpMove))
{
MoveInfo.NextMoveStep(LineMoveStep.FO_11_AxisDownMove);
InStoreLog(" FO_31_BatchAxisToP2 料盘移栽:提升伺服下降指定的高度");
int targetPosition = Config.BatchAxisP3 + lastOutParam.PlateH * Config.Height_ChangeValue;
BatchAxis.AbsMove(MoveInfo, targetPosition, Config.BatchAxis_TargetSpeed);
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FO_11_AxisDownMove))
{
MoveInfo.NextMoveStep(LineMoveStep.FO_12_MoveCylinder_Down);
InStoreLog(" FO_12_MoveCylinder_Down 料盘移栽:出料横移机构下降");
CylinderMove(MoveInfo, IO_Type.SL_MoveCylinder_Up, IO_Type.SL_MoveCylinder_Down);
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FO_12_MoveCylinder_Down))
{
MoveInfo.NextMoveStep(LineMoveStep.FO_13_MoveCylinder_Slack);
InStoreLog(" FO_13_MoveCylinder_Slack 料盘移栽:出料横移机构放松");
CylinderMove(MoveInfo, IO_Type.SL_MoveCylinder_Tighten, IO_Type.SL_MoveCylinder_Slack);
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FO_13_MoveCylinder_Slack))
{
MoveInfo.NextMoveStep(LineMoveStep.FO_14_MoveCylinder_Up);
InStoreLog(" FO_14_MoveCylinder_Up 料盘移栽:上料横移机构上升");
CylinderMove(MoveInfo, IO_Type.SL_MoveCylinder_Down, IO_Type.SL_MoveCylinder_Up);
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FO_14_MoveCylinder_Up))
{
MoveInfo.NextMoveStep(LineMoveStep.FO_31_BatchAxisToP2);
InStoreLog(" FO_31_BatchAxisToP2 出料完成:未检测到料盘,提升伺服到P2点");
BatchAxis.AbsMove(MoveInfo, Config.BatchAxisP2, Config.BatchAxis_P2Speed);
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FO_31_BatchAxisToP2))
{
MoveInfo.NextMoveStep(LineMoveStep.FO_32_TrayLocationCylinder_After);
InStoreLog(" FO_32_TrayLocationCylinder_After 出料完成: 升降盘定位气缸后退");
TrayLCylinderAfter(MoveInfo);
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FO_32_TrayLocationCylinder_After))
{
MoveInfo.NextMoveStep(LineMoveStep.FO_33_BatchAxisToP1);
InStoreLog(" FO_33_BatchAxisToP1 出料完成:提升伺服到P1点");
BatchAxis.AbsMove(MoveInfo, Config.BatchAxisP1, Config.BatchAxis_P1Speed);
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FO_33_BatchAxisToP1))
{
MoveInfo.NextMoveStep(LineMoveStep.FO_35_OutTopCylinder_Up);
InStoreLog(" FO_34_LocationCylinder_Down 出料完成,出口顶升气缸上升,出料缓冲阻挡上升");
CylinderMove(MoveInfo, IO_Type.SL_OutTopCylinder_Down, IO_Type.SL_OutTopCylinder_Up);
IOMove(IO_Type.SL_Out_StopDown, IO_VALUE.LOW);
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FO_34_OutCheck))
{
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FO_35_OutTopCylinder_Up))
{
//TODO
MoveInfo.NextMoveStep(LineMoveStep.FO_36_SideWayLineRun);
InStoreLog(" FO_36_SideWayLineRun 出料完成, 线体横移电机运转,等待料架到达出口");
IOMove(IO_Type.SL_LocationSideWay_Run, IO_VALUE.HIGH);
IOMove(IO_Type.SL_OutSideWay_Run, IO_VALUE.HIGH);
MoveInfo.OneWaitCanEndStep = true;
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SL_Out_Check, IO_VALUE.HIGH));
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FO_36_SideWayLineRun))
{
MoveInfo.NextMoveStep(LineMoveStep.FO_37_LineStop);
InStoreLog(" FO_37_LineStop 出料完成, 料架到达出口,线体横移电机停止 ");
IOMove(IO_Type.SL_LocationSideWay_Run, IO_VALUE.LOW);
IOMove(IO_Type.SL_OutSideWay_Run, IO_VALUE.LOW);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(300));
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FO_37_LineStop))
{
MoveInfo.NextMoveStep(LineMoveStep.FO_38_TopCylinderDown);
InStoreLog(" FO_38_TopCylinderDown 出料完成, 料架到达出口,出口顶升下降,定位气缸下降, ");
CylinderMove(MoveInfo, IO_Type.SL_OutTopCylinder_Up, IO_Type.SL_OutTopCylinder_Down);
CylinderMove(MoveInfo, IO_Type.SL_LocationCylinder_Up, IO_Type.SL_LocationCylinder_Down);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(300));
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FO_38_TopCylinderDown))
{
MoveInfo.NextMoveStep(LineMoveStep.FO_39_OutLineRun);
InStoreLog(" FO_39_OutLineRun 出料完成, 出口线体运转,料架到达出口处, 通知AGV取空料架, ");
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FO_40_OutLineRun))
{
MoveInfo.NextMoveStep(LineMoveStep.FO_40_OutLineRun);
InStoreLog(" FO_40_OutLineRun 出料完成, AGV到达,继续转动出口线体,送走出料料架, ");
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FO_40_OutLineRun))
{
MoveInfo.NextMoveStep(LineMoveStep.FO_41_OutLineRun);
InStoreLog(" FO_41_OutLineRun 出料完成, 上料完成, 料架送出, ");
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FO_41_OutLineRun))
{
MoveInfo.EndMove();
runStatus = LineRunStatus.Runing;
lastOutParam = null;
LogUtil.info("空料架已送出,出料结束");
}
}
#endregion
}
}