VerticalStoreBean_InOut.cs
31.5 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
using DeviceLib;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading;
namespace OnlineStore.DeviceLibrary
{
partial class VerticalStoreBean
{
private Stopwatch moveWatch = new Stopwatch();
#region 自动出入库参数
private int CurrInOutCount = 0;
private int CurrInOutACount = 0;
public List<string> PositionNumList = new List<string>();
public bool autoNext = false;
public int autoJiange = 3;
public int autoPositionIndex = 0;
public string autoMsg = "";
public int AutoStartIndex = -1;
#endregion
#region CheckWait
private void CheckWait()
{
List<WaitResultInfo> list = MoveInfo.WaitList;
//当等待超过一分钟时,需要打印提示
TimeSpan span = DateTime.Now - MoveInfo.LastSetpTime;
string NotOkMsg = "";
if (list.Count <= 0)
{
MoveInfo.EndStepWait();
return;
}
bool isOk = true;
if (MoveInfo.OneWaitCanEndStep)
{
isOk = false;
}
foreach (WaitResultInfo wait in list)
{
if (wait.IsEnd)
{
continue;
}
NotOkMsg = wait.ToStr();
if (wait.WaitType == 1)
{
string msg = "";
if (wait.IsHomeMove)
{
wait.IsEnd =AxisBean. HomeMoveIsEnd(MoveInfo, wait.AxisInfo, out msg);
}
else
{
wait.IsEnd = AxisBean.ACAxisMoveIsEnd(MoveInfo, wait.AxisInfo, wait.TargetPosition, wait.TargetSpeed, out msg);
}
if (!msg.Equals(""))
{
isOk = false;
WarnMsg = msg;
Alarm(StoreAlarmType.AxisMoveError, wait.AxisInfo.ProName, WarnMsg, MoveInfo.MoveType);
break;
}
}
else if (wait.WaitType == 2)
{
wait.IsEnd = IOManager.IOValue(wait.IoType).Equals(wait.IoValue);
int timeOutMs = Config.IOSingle_TimerOut;
if (MoveInfo.MoveStep == StoreMoveStep.SO_18_WaitTake)
{
timeOutMs = 650000;
}
if ((!wait.IsEnd) && span.TotalMilliseconds > timeOutMs)
{
ConfigIO io = Config.getWaitIO(wait.IoType);
WarnMsg = Name + " 等待信号" + io.DisplayStr + "=" + wait.IoValue + "超时!";
Alarm(StoreAlarmType.IoSingleTimeOut, io.ElectricalDefinition, WarnMsg, MoveInfo.MoveType);
LogUtil.error(Name + wait.IoType + "等待信号(" + io.DisplayStr + "=" + wait.IoValue + ") 超时", 14);
isOk = false;
break;
}
}
else if (wait.WaitType == 3)
{
wait.IsEnd = (span.TotalMilliseconds >= wait.TimeMSeconds);
}
if (wait.IsEnd)
{
if (MoveInfo.OneWaitCanEndStep)
{
isOk = true;
break;
}
}
else
{
if (!MoveInfo.OneWaitCanEndStep)
{
isOk = false;
break;
}
}
}
if (isOk)
{
MoveInfo.EndStepWait();
}
else if (span.TotalSeconds > MoveInfo.TimeOutSeconds)
{
WarnMsg = Name + "【" + MoveInfo.MoveType + "】【" + MoveInfo.MoveStep + "】等待超时 [" + NotOkMsg
+ "]已等待[" + Math.Round(span.TotalSeconds, 1) + "]秒";
LogUtil.error(WarnMsg, 100);
Alarm(StoreAlarmType.IoSingleTimeOut, "", WarnMsg, MoveInfo.MoveType);
}
}
#endregion
#region 入库
public override bool StartInStore(InOutParam param, bool isNeedCheckIO = false)
{
param.paramType = MoveType.InStore;
string posId = param != null ? param.PosId : "";
if (runStatus .Equals( StoreRunStatus.Runing)&&MoveInfo.MoveType.Equals(MoveType.None))
{
if (param.Position==null)
{
LogUtil.error(Name + " 启动 " + param.LogName + "失败,找不到库位信息");
return false;
}
LogUtil.info(Name + " 启动 " + param.LogName );
moveWatch.Restart();
runStatus = StoreRunStatus.Busy;
storeStatus = StoreStatus.InStoreExecute;
MoveInfo.NewMove(MoveType.InStore, param);
if (isNeedCheckIO)
{
MoveInfo.NextMoveStep(StoreMoveStep.SI_01_TrayCheck);
InStoreLog(" 检测料盘信号");
}
else
{
//SI_02_InOutToP1(MoveInfo.MoveParam.MoveP);
}
return true;
}
else
{
LogUtil.error(Name + " 启动 " + param.LogName + "出错,当前状态:[" + runStatus+"],["+MoveInfo.MoveType+"]");
return false;
}
}
protected override void InStoreProcess()
{
//StoreMoveP moveP = MoveInfo.MoveParam.MoveP;
//if (MoveInfo.IsInWait)
//{
// CheckWait();
//}
//if (MoveInfo.IsInWait)
//{
// return;
//}
//if (MoveInfo.IsStep(StoreMoveStep.SI_01_TrayCheck))
//{
// SI_02_InOutToP1(moveP);
//}
//else if (MoveInfo.IsStep(StoreMoveStep.SI_02_InOutToP1))
//{
// MoveInfo.NextMoveStep(StoreMoveStep.SI_03_Clamping_Relax);
// InStoreLog(" 夹爪放松");
// CylinderMove(MoveInfo, IO_Type.Clamping_Tighten, IO_Type.Clamping_Relax);
//}
//else if (MoveInfo.IsStep(StoreMoveStep.SI_03_Clamping_Relax))
//{
// MoveInfo.NextMoveStep(StoreMoveStep.SI_04_AxisToP1);
// InStoreLog(" 轴2、轴1 动作到P1 ");
// ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P1, Config.UpDownAxis_P1_Speed);
// ACAxisMove(Config.Middle_Axis, moveP.Middle_P1, Config.MiddleAxis_P1_Speed);
//}
//else if (MoveInfo.IsStep(StoreMoveStep.SI_04_AxisToP1))
//{
// SI_05_InoutToP2();
//}
//else if (MoveInfo.IsStep(StoreMoveStep.SI_05_InoutToP2))
//{
// NeedCheckSafetyLight = 0;
// MoveInfo.NextMoveStep(StoreMoveStep.SI_06_Clamping_Work);
// InStoreLog("夹爪夹紧 ");
// CylinderMove(MoveInfo, IO_Type.Clamping_Relax, IO_Type.Clamping_Tighten);
//}
//else if (MoveInfo.IsStep(StoreMoveStep.SI_06_Clamping_Work))
//{
// MoveInfo.NextMoveStep(StoreMoveStep.SI_07_UpdownToP7);
// InStoreLog("升降轴到P7 ");
// ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P7, Config.UpDownAxis_P7_Speed);
//}
//else if (MoveInfo.IsStep(StoreMoveStep.SI_07_UpdownToP7))
//{
// MoveInfo.NextMoveStep(StoreMoveStep.SI_08_InOutToP1);
// InOutBackToP1(moveP.InOut_P1);
// ConfigMoveAxis axis = GetPosTAxis();
// InStoreLog("进出轴返回待机点P1, " + axis.ProName + "停止匀速运动 ");
// AxisSuddenStop(axis);
//}
//else if (MoveInfo.IsStep(StoreMoveStep.SI_08_InOutToP1))
//{
// ConfigMoveAxis axis = GetPosTAxis();
// MoveInfo.NextMoveStep(StoreMoveStep.SI_09_MoveToBag);
// MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
// InStoreLog("移动到库位点,旋转轴 至P2( 库位点)升降轴至P3(库位入库前点)关闭仓门 " + axis.ProName + "开始原点返回");
// ACAxisMove(Config.Middle_Axis, moveP.Middle_P2, Config.MiddleAxis_P2_Speed);
// ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P3, Config.UpDownAxis_P3_Speed);
// CylinderMove(null, IO_Type.Door_Up, IO_Type.Door_Down);
// ACAxisHomeMove(axis);
//}
//else if (MoveInfo.IsStep(StoreMoveStep.SI_09_MoveToBag))
//{
// MoveInfo.NextMoveStep(StoreMoveStep.SI_10_TargetAxisToP2);
// if (MoveInfo.MoveParam.Position.PosType.Equals(1))
// {
// InStoreLog("冷藏旋转轴到P2 ");
// ACAxisMove(Config.Colding_Axis, moveP.Cold_P2, Config.ColdingAxis_P2_Speed);
// }
// else
// {
// InStoreLog("回温旋转轴到P2 ");
// ACAxisMove(Config.Warming_Axis, moveP.Warm_P2, Config.WarmingAxis_P2_Speed);
// }
//}
//else if (MoveInfo.IsStep(StoreMoveStep.SI_10_TargetAxisToP2))
//{
// if (MoveInfo.MoveParam.Position.PosType.Equals(1))
// {
// MoveInfo.NextMoveStep(StoreMoveStep.SI_11_OpenColddoor);
// InStoreLog("打开冷藏门,关闭仓门 ");
// CylinderMove(MoveInfo, IO_Type.Door_Up, IO_Type.Door_Down);
// CylinderMove(MoveInfo, IO_Type.ColdDoor_Close, IO_Type.ColdDoor_Open);
// }
// else
// {
// MoveInfo.NextMoveStep(StoreMoveStep.SI_12_InoutToP3);
// InStoreLog("进出轴到P3 ");
// ACAxisMove(Config.InOut_Axis, moveP.InOut_P3, Config.InOutAxis_P3_Speed);
// }
//}
//else if (MoveInfo.IsStep(StoreMoveStep.SI_11_OpenColddoor))
//{
// MoveInfo.NextMoveStep(StoreMoveStep.SI_12_InoutToP3);
// InStoreLog("进出轴到P3 ");
// ACAxisMove(Config.InOut_Axis, moveP.InOut_P3, Config.InOutAxis_P3_Speed);
//}
//else if (MoveInfo.IsStep(StoreMoveStep.SI_12_InoutToP3))
//{
// MoveInfo.NextMoveStep(StoreMoveStep.SI_13_UpdownToP4);
// InStoreLog("升降轴到入料缓冲点P4 ");
// ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P4, Config.UpDownAxis_P4_Speed);
//}
//else if (MoveInfo.IsStep(StoreMoveStep.SI_13_UpdownToP4))
//{
// MoveInfo.NextMoveStep(StoreMoveStep.SI_14_Clamping_Relax);
// InStoreLog(" 夹爪放松");
// CylinderMove(MoveInfo, IO_Type.Clamping_Tighten, IO_Type.Clamping_Relax);
//}
//else if (MoveInfo.IsStep(StoreMoveStep.SI_14_Clamping_Relax))
//{
// // 5= 入仓位完成(料仓Box把料盘放入对应的库位中,装置还未恢复原始状态)
// UpdateLastStatus(StoreStatus.InStoreEnd);
// MoveInfo.NextMoveStep(StoreMoveStep.SI_15_InOutToP1);
// InStoreLog(" 进出轴返回待机点P1");
// InOutBackToP1(moveP.InOut_P1);
//}
//else if (MoveInfo.IsStep(StoreMoveStep.SI_15_InOutToP1))
//{
// if (MoveInfo.MoveParam.Position.PosType.Equals(1))
// {
// MoveInfo.NextMoveStep(StoreMoveStep.SI_16_CloseColddoor);
// InStoreLog(" 关闭冷藏区门");
// CylinderMove(MoveInfo, IO_Type.ColdDoor_Open, IO_Type.ColdDoor_Close);
// }
// else
// {
// SI_17_GoBack();
// }
//}
//else if (MoveInfo.IsStep(StoreMoveStep.SI_16_CloseColddoor))
//{
// SI_17_GoBack();
//}
//else if (MoveInfo.IsStep(StoreMoveStep.SI_17_GoBack))
//{
// TimeSpan span = moveWatch.Elapsed;
// moveWatch.Stop();
// LogUtil.info(Name + " 【" + MoveInfo.MoveParam.LogName + "】 结束,开始旋转,耗时【" + FormUtil.GetSpanStr(span) + "】!");
// MoveInfo.EndMove();
// runStatus = StoreRunStatus.Runing;
// //设备连接,入库后,BOX恢复原始状态
// storeStatus = StoreStatus.StoreOnline;
// InOutEndProcess(MoveType.InStore);
//}
//else
//{
// LogUtil.info(Name + " 入库,moveStatus=" + MoveInfo.MoveStep + ",没有对应的处理!");
//}
}
private void SI_02_InOutToP1( )
{
//MoveInfo.NextMoveStep(StoreMoveStep.SI_02_InOutToP1);
//InStoreLog(" 进出轴到P1,打开舱门");
//CylinderMove(MoveInfo, IO_Type.Door_Down, IO_Type.Door_Up);
//InOutBackToP1(moveP.InOut_P1);
}
private void SI_05_InoutToP2()
{
//MoveInfo.NextMoveStep(StoreMoveStep.SI_05_InoutToP2);
//InStoreLog("进出轴到P2");
//ACAxisMove(Config.InOut_Axis, MoveInfo.MoveParam.MoveP.InOut_P2, Config.InOutAxis_P2_Speed);
//NeedCheckSafetyLight = 1;
}
private void SI_17_GoBack()
{
//MoveInfo.NextMoveStep(StoreMoveStep.SI_17_GoBack);
//ConfigMoveAxis axis = GetPosTAxis();
//InStoreLog(" 升降轴,旋转轴返回P1," + axis.ProName + "开始匀速运转");
//ACAxisMove(Config.Middle_Axis, MoveInfo.MoveParam.MoveP.Middle_P1, Config.MiddleAxis_P1_Speed);
//ACAxisMove(Config.UpDown_Axis, MoveInfo.MoveParam.MoveP.UpDown_P1, Config.UpDownAxis_P1_Speed);
//StartWork(MoveInfo.MoveParam.Position.PosType);
}
private void InOutBackToP1(int InOut_P1)
{
////判断是否在P1,如果是,不需要运行
//int outCount = ACServerManager.GetActualtPosition(Config.InOut_Axis.DeviceName, Config.InOut_Axis.GetAxisValue());
//int errorCount = Math.Abs(outCount - InOut_P1);
//if (errorCount <= Config.InOut_Axis.CanErrorCountMin)
//{
// LogUtil.info("进出轴当前位置:" + outCount + ",已经在P1,不需要再回P1");
//}
//else
//{
// ACAxisMove(Config.InOut_Axis, InOut_P1, Config.InOutAxis_P1_Speed);
//}
//StoreMove.WaitList.Add(WaitResultInfo.WaitAxisOrg(Config.InOut_Axis,IO_VALUE.HIGH));
}
#endregion
#region 出库
public override bool StartOutStore(InOutParam param)
{
//param.paramType = MoveType.OutStore;
//if (runStatus.Equals(StoreRunStatus.Runing) && MoveInfo.MoveType.Equals(MoveType.None))
//{
// if (!param.LoadParam(Config))
// {
// LogUtil.error(Name + " 启动 " + param.LogName + "失败,找不到库位");
// return false;
// }
// if (IOManager.IOValue(IO_Type.TinCheck_Fixture).Equals(IO_VALUE.HIGH))
// {
// LogUtil.error(Name + " 启动 " + param.LogName + "失败,叉子料盘检测有料");
// return false;
// }
// moveWatch.Restart();
// LogUtil.info(Name + "启动 " + param.LogName + " ");
// runStatus = StoreRunStatus.Busy;
// storeStatus = StoreStatus.OutStoreExecute;
// MoveInfo.NewMove(MoveType.OutStore, param);
// MoveInfo.NextMoveStep(StoreMoveStep.SO_01_InoutToP1);
// ConfigMoveAxis axis = GetPosTAxis();
// OutStoreLog(" 叉子先运动到P1 ," + axis.ProName + "停止匀速运动");
// InOutBackToP1(MoveInfo.MoveParam.MoveP.InOut_P1);
// AxisSuddenStop(axis);
// return true;
//}
//else
//{
// LogUtil.error(Name + " 启动 " + param.LogName + "出错,当前状态:[" + runStatus + "],[" + MoveInfo.MoveType + "]");
return false;
//}
}
protected override void OutStoreProcess()
{
//StoreMoveP moveP = MoveInfo.MoveParam.MoveP;
if (MoveInfo.IsInWait)
{
CheckWait();
}
if (MoveInfo.IsInWait)
{
return;
}
//if (MoveInfo.MoveStep .Equals( StoreMoveStep.SO_01_InoutToP1))
//{
// MoveInfo.NextMoveStep(StoreMoveStep.SO_02_AxisHome);
// ConfigMoveAxis axis = GetPosTAxis();
// OutStoreLog(" " + axis.ProName + "开始原点返回");
// MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
// ACAxisHomeMove(axis);
//}
//else if (MoveInfo.IsStep(StoreMoveStep.SO_02_AxisHome))
//{
// MoveInfo.NextMoveStep(StoreMoveStep.SO_03_ToBag);
// MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
// ConfigMoveAxis axis = GetPosTAxis();
// OutStoreLog(" 旋转轴至P2(库位点),升降轴至P5(库位出库前点)," + axis.ProName + "到P2");
// ACAxisMove(Config.Middle_Axis, MoveInfo.MoveParam.MoveP.Middle_P2, Config.MiddleAxis_P2_Speed);
// ACAxisMove(Config.UpDown_Axis, MoveInfo.MoveParam.MoveP.UpDown_P5, Config.UpDownAxis_P5_Speed);
// if (MoveInfo.MoveParam.Position.PosType.Equals(1))
// {
// ACAxisMove(Config.Colding_Axis, moveP.Cold_P2, Config.ColdingAxis_P2_Speed);
// }
// else
// {
// ACAxisMove(Config.Warming_Axis, moveP.Warm_P2, Config.WarmingAxis_P2_Speed);
// }
//}
//else if (MoveInfo.IsStep(StoreMoveStep.SO_03_ToBag))
//{
// if (MoveInfo.MoveParam.Position.PosType.Equals(1))
// {
// MoveInfo.NextMoveStep(StoreMoveStep.SO_04_OpenCold);
// OutStoreLog("打开冷藏区门 ");
// CylinderMove(MoveInfo, IO_Type.ColdDoor_Close, IO_Type.ColdDoor_Open);
// }
// else
// {
// MoveInfo.NextMoveStep(StoreMoveStep.SO_05_InoutToP3);
// OutStoreLog(" 进出轴至P3(库位取放料点) ");
// ACAxisMove(Config.InOut_Axis, moveP.InOut_P3, Config.InOutAxis_P3_Speed);
// }
//}
//else if (MoveInfo.IsStep(StoreMoveStep.SO_04_OpenCold))
//{
// MoveInfo.NextMoveStep(StoreMoveStep.SO_05_InoutToP3);
// OutStoreLog(" 进出轴至P3(库位取放料点) ");
// ACAxisMove(Config.InOut_Axis, moveP.InOut_P3, Config.InOutAxis_P3_Speed);
//}
//else if (MoveInfo.IsStep(StoreMoveStep.SO_05_InoutToP3))
//{
// MoveInfo.NextMoveStep(StoreMoveStep.SO_06_Clamping_Work);
// OutStoreLog("夹爪夹紧 ");
// CylinderMove(MoveInfo, IO_Type.Clamping_Relax, IO_Type.Clamping_Tighten);
//}
//else if (MoveInfo.IsStep(StoreMoveStep.SO_06_Clamping_Work))
//{
// MoveInfo.NextMoveStep(StoreMoveStep.SO_07_UpdownToP6);
// OutStoreLog(" 升降轴至P6(库位出料缓冲点) ");
// ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P6, Config.UpDownAxis_P6_Speed);
//}
//else if (MoveInfo.IsStep(StoreMoveStep.SO_07_UpdownToP6))
//{
// MoveInfo.NextMoveStep(StoreMoveStep.SO_08_InoutToP1);
// OutStoreLog(" 进出轴至P1(待机点) ");
// InOutBackToP1(moveP.InOut_P1);
// //把库位的物品放到取到叉子上之后是出仓完成
// UpdateLastStatus(StoreStatus.OutStoreBoxEnd);
//}
//else if (MoveInfo.IsStep(StoreMoveStep.SO_08_InoutToP1))
//{
// if (IOManager.IOValue(IO_Type.TinCheck_Fixture).Equals(IO_VALUE.LOW))
// {
// CodeMsg = MoveInfo.MoveParam.LogName + " 叉子从库位退出后,未检测到料盘有料";
// LogUtil.error(CodeMsg);
// }
// if (MoveInfo.MoveParam.Position.PosType.Equals(1))
// {
// MoveInfo.NextMoveStep(StoreMoveStep.SO_09_CloseCold);
// OutStoreLog("关闭冷藏区门 ");
// CylinderMove(MoveInfo, IO_Type.ColdDoor_Open, IO_Type.ColdDoor_Close);
// }
// else
// {
// MoveInfo.NextMoveStep(StoreMoveStep.SO_10_ToDoorPosition);
// MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
// OutStoreLog("旋转轴至P1(待机点)升降轴至P2(进料口出料前点),");
// ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P2, Config.UpDownAxis_P2_Speed);
// ACAxisMove(Config.Middle_Axis, moveP.Middle_P1, Config.MiddleAxis_P1_Speed);
// }
//}
//else if (MoveInfo.IsStep(StoreMoveStep.SO_09_CloseCold))
//{
// MoveInfo.NextMoveStep(StoreMoveStep.SO_10_ToDoorPosition);
// MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
// OutStoreLog("旋转轴至P1(待机点)升降轴至P2(进料口出料前点),");
// ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P2, Config.UpDownAxis_P2_Speed);
// ACAxisMove(Config.Middle_Axis, moveP.Middle_P1, Config.MiddleAxis_P1_Speed);
//}
//else if (MoveInfo.IsStep(StoreMoveStep.SO_10_ToDoorPosition))
//{
// MoveInfo.NextMoveStep(StoreMoveStep.SO_11_OpenDoor);
// ConfigMoveAxis axis = GetPosTAxis();
// OutStoreLog("打开仓门 ," + axis.ProName + "开始匀速运转");
// CylinderMove(MoveInfo, IO_Type.Door_Down, IO_Type.Door_Up);
// StartWork(MoveInfo.MoveParam.Position.PosType);
//}
//else if (MoveInfo.IsStep(StoreMoveStep.SO_11_OpenDoor))
//{
// MoveInfo.NextMoveStep(StoreMoveStep.SO_12_WaitNoTray);
// OutStoreLog("等待仓门口无料盘 ");
// MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(MoveInfo.MoveParam.GetDoorTinCheck(), IO_VALUE.LOW));
//}
//else if (MoveInfo.IsStep(StoreMoveStep.SO_12_WaitNoTray))
//{
// SO_13_InoutToP2();
//}
//else if (MoveInfo.IsStep(StoreMoveStep.SO_13_InoutToP2))
//{
// MoveInfo.NextMoveStep(StoreMoveStep.SO_14_UpdownToP8);
// OutStoreLog("进出轴到出料缓冲点P8 ");
// ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P8, Config.UpDownAxis_P8_Speed);
//}
////此处需要等待移栽没有工作,才能把盘放入出料口
//else if (MoveInfo.IsStep(StoreMoveStep.SO_14_UpdownToP8))
//{
// NeedCheckSafetyLight = 0;
// MoveInfo.NextMoveStep(StoreMoveStep.SO_15_Clamping_Relax);
// OutStoreLog("夹爪放松 ");
// CylinderMove(MoveInfo, IO_Type.Clamping_Tighten, IO_Type.Clamping_Relax);
//}
//else if (MoveInfo.IsStep(StoreMoveStep.SO_15_Clamping_Relax))
//{
// MoveInfo.NextMoveStep(StoreMoveStep.SO_16_InoutToP1);
// OutStoreLog("进出轴动作至P1(待机点) ");
// InOutBackToP1(moveP.InOut_P1);
//}
//else if (MoveInfo.IsStep(StoreMoveStep.SO_16_InoutToP1))
//{
// MoveInfo.NextMoveStep(StoreMoveStep.SO_17_CloseDoor);
// OutStoreLog("关闭仓门 ");
// CylinderMove(MoveInfo, IO_Type.Door_Up, IO_Type.Door_Down);
//}
//else if (MoveInfo.IsStep(StoreMoveStep.SO_17_CloseDoor))
//{
// MoveInfo.NextMoveStep(StoreMoveStep.SO_18_WaitTake);
// int OutStoreWaitSeconds = ConfigAppSettings.GetIntValue(Setting_Init.OutStoreWaitSeconds);
// if (OutStoreWaitSeconds <= 0)
// {
// OutStoreWaitSeconds = 600;
// }
// int ms = OutStoreWaitSeconds * 1000;
// OutStoreLog(" 等待拿走物品,最多等待" + OutStoreWaitSeconds + "秒");
// MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(ms));
// MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(MoveInfo.MoveParam.GetDoorTinCheck(), IO_VALUE.LOW));
// MoveInfo.OneWaitCanEndStep = true;
//}
//else if (MoveInfo.IsStep(StoreMoveStep.SO_18_WaitTake))
//{
// TimeSpan span = moveWatch.Elapsed;
// moveWatch.Stop();
// storeStatus = StoreStatus.StoreOnline;
// LogUtil.info(Name + " 【" + MoveInfo.MoveParam.LogName + "】 结束,耗时【" + FormUtil.GetSpanStr(span) + "】!");
// MoveInfo.EndMove();
// runStatus = StoreRunStatus.Runing;
// InOutEndProcess(MoveType.OutStore);
//}
//else
//{
// LogUtil.error(Name + " 出库处理,moveStatus=" + MoveInfo.MoveStep + ",没有对应的处理!");
//}
}
private void SO_13_InoutToP2()
{
//StoreMoveP moveP = MoveInfo.MoveParam.MoveP;
//MoveInfo.NextMoveStep(StoreMoveStep.SO_13_InoutToP2);
//OutStoreLog(" 进出轴至P2(进料口取料点) ");
//ACAxisMove(Config.InOut_Axis, moveP.InOut_P2, Config.InOutAxis_P2_Speed);
//NeedCheckSafetyLight = 1;
}
public bool InOutAxisCanMove()
{
return true;
}
#endregion
private void UpdateLastStatus(StoreStatus status)
{
string posId = MoveInfo.MoveParam != null ? MoveInfo.MoveParam.PosId : "";
lastPosId = posId;
lastPosIdStatus = status;
storeStatus = status;
LogUtil.info(Name + "更新 LastStatus [" + lastPosIdStatus + "] [" + lastPosId + "] ");
}
private void InOutEndProcess(MoveType storeMoveType)
{
try
{
CurrInOutCount++;
CurrInOutACount++;
//是否自动进入出库状态
if (!autoNext)
{
return;
}
if (storeMoveType.Equals(MoveType.InStore))
{
int newIndex = autoPositionIndex - 1;
if (newIndex < 0)
{
if (AutoStartIndex >= 0 && AutoStartIndex < PositionNumList.Count)
{
newIndex = AutoStartIndex;
LogUtil.info(Name + "下一个索引不存在,重新开始自动出入库,索引【" + AutoStartIndex + "】");
}
else
{
autoNext = false;
autoMsg = "自动出入库结束!";
LogUtil.info(Name + "下一个索引不存在,自动 出入库结束!");
}
}
else
{
autoPositionIndex = newIndex;
string posid = PositionNumList[autoPositionIndex];
InOutParam newParam = new InOutParam(MoveType.OutStore, posid);
LogUtil.info(Name + "自动进入下一个出库:posid=" + posid);
autoMsg = "自动出库:" + posid;
StartOutStore(newParam);
}
}
else if (storeMoveType.Equals(MoveType.OutStore))
{
int newIndex = autoPositionIndex - autoJiange;
if (newIndex < 0)
{
if (AutoStartIndex >= 0 && AutoStartIndex < PositionNumList.Count)
{
newIndex = AutoStartIndex;
LogUtil.info(Name + "下一个索引不存在,重新开始自动出入库,索引【" + AutoStartIndex + "】");
}
else
{
autoNext = false;
autoMsg = "自动出入库结束!";
LogUtil.info(Name + "下一个索引不存在,自动 出入库结束!");
}
}
else
{
string posid = PositionNumList[newIndex];
InOutParam newParam = new InOutParam(MoveType.InStore, posid, "AAAAA");
LogUtil.info(Name + "自动进入下一个入库:posid=" + posid);
autoMsg = "自动入库:" + posid;
StartInStore(newParam);
}
}
}
catch (Exception ex)
{
LogUtil.error(ex.ToString());
}
}
private void AddWaitMoveParam(InOutParam newParam)
{
throw new NotImplementedException();
}
private void InStoreLog(string msg)
{
string LogName = MoveInfo.MoveParam != null ? MoveInfo.MoveParam.LogName : "";
LogUtil.info("" + LogName + " ["+MoveInfo.MoveStep+"]" + msg);
}
private void OutStoreLog(string msg)
{
string LogName = MoveInfo.MoveParam != null ? MoveInfo.MoveParam.LogName : "";
LogUtil.info("" + LogName + " [" + MoveInfo.MoveStep + "]" + msg);
}
private void MovePosLog(string msg)
{
string LogName = MoveInfo.MoveParam != null ? MoveInfo.MoveParam.LogName : "";
LogUtil.info("" + LogName + " [" + MoveInfo.MoveStep + "]" + msg);
}
private void StiringLog(string msg)
{
string LogName = MoveInfo.MoveParam != null ? MoveInfo.MoveParam.LogName : "";
LogUtil.info("" + LogName + " [" + MoveInfo.MoveStep + "]" + msg);
}
private void ResetLog(string msg)
{
LogUtil.info(Name+" "+MoveInfo.MoveType+ " ["+MoveInfo.MoveStep+"] " + msg);
}
}
}