BatchMoveBean_Partial.cs
27.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
using Asa;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace OnlineStore.DeviceLibrary
{
partial class BatchMoveBean
{
#region 料串入料处理
internal string CurrShelfId = "";
private List<string> LastCodeList = new List<string>();
private List<string> NextCodeList = new List<string>();
public bool StartWorking(WorkParam param)
{
if (ProcessShelfOut || ProcessShelfEnter)
{
return false;
}
if (!Robot.CanStartWork())
{
return false;
}
if (AgvClient.GetAction(AgvName) == ClientAction.NeedLeave || AgvClient.GetAction(AgvName) == ClientAction.MayLeave)
{
//WorkLog("料串入料 :等待AGV来取空料串1");
return false; ;
}
if (Robot.IOValue(IO_LineEnd_Check).Equals(IO_VALUE.HIGH) && Robot.IOValue(IO_LineIn_Check).Equals(IO_VALUE.HIGH))
{
//runStatus = RobotRunStatus.Busy;
MoveInfo.NewMove(RobotMoveType.Working);
MoveInfo.MoveParam = new WorkParam();
//判断是哪个工位有料串
IB05_WaitTime();
}
else if (Robot.IOValue(IO_LineIn_Check).Equals(IO_VALUE.HIGH))
{
MoveInfo.NewMove(RobotMoveType.Working, StepEnum.IB04_LineStart);
IB04_LineStart();
}
else
{
LineStop();
MoveInfo.EndMove();
}
return true;
}
private bool UpdateShelfId()
{
try
{
//判断料串的编码是否正确
RFIDData rfidD = RFIDManager.ReadRFID(RfidIP);
CurrShelfId = rfidD.NumStr;
//发送料串信息给调度系统
// AgvClient.SendRFID(Config.AgvInName, CurrShelfId);
LogUtil.info(Name + "读取到料串编号:" + CurrShelfId);
}
catch (Exception ex)
{
LogUtil.error(Name + "UpdateShelfId出错:", ex);
}
return true;
}
private void IB04_LineStart()
{
MoveInfo.NextMoveStep(StepEnum.IB04_LineStart);
WorkLog(" 入口检测到料串,流水线转动 3000,等待料串完全进入轨道");
LineRun(MoveInfo);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(3000));
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_LineIn_Check, IO_VALUE.HIGH));
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_LineEnd_Check, IO_VALUE.HIGH));
}
private void IB05_WaitTime()
{
// 定位工位有料串,等待1秒后再次检测
MoveInfo.NextMoveStep(StepEnum.IB05_WaitTime);
WorkLog("定位工位检测到料串: 链条转动, 3秒再次检测");
LineRun();
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(3000));
}
protected void WorkingProcess()
{
if (MoveInfo.IsInWait)
{
CheckWait(MoveInfo);
}
if (MoveInfo.IsInWait)
{
return;
}
#region 入料:料串进入并开始检测托盘
if (MoveInfo.IsStep(StepEnum.IB01_Wait))
{
WorkLog("料串入料 :提升伺服移动到P1,顶升气缸下降");
MoveInfo.NextMoveStep(StepEnum.IB02_BatchAxisToP1);
BatchAxis.AbsMove(MoveInfo, BatchAxisP1, Robot.Config.BatchAxis_P1Speed);
LocationDown(MoveInfo);
}
if (MoveInfo.IsStep(StepEnum.IB02_BatchAxisToP1))
{
MoveInfo.NextMoveStep(StepEnum.IB04_LineStart);
WorkLog("料串入料 :开始转动链条");
LineRun(MoveInfo);
//等待指定时间
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(3000));
}
else if (MoveInfo.IsStep(StepEnum.IB04_LineStart))
{
if (AgvClient.GetAction(AgvName) == ClientAction.NeedLeave || AgvClient.GetAction(AgvName) == ClientAction.MayLeave) {
WorkLog("料串入料 :等待AGV来取空料串0");
//return;
}
if (Robot.IOValue(IO_LineIn_Check).Equals(IO_VALUE.HIGH) && Robot.IOValue(IO_LineEnd_Check).Equals(IO_VALUE.HIGH))
{
IB05_WaitTime();
}
else if (Robot.IOValue(IO_LineIn_Check).Equals(IO_VALUE.HIGH))
{
IB04_LineStart();
}
else
{
LineStop();
MoveInfo.EndMove();
LogUtil.info(" 未检测到料串,入料结束");
}
}
else if (MoveInfo.IsStep(StepEnum.IB05_WaitTime))
{
LineStop();
if (Robot.IOValue(IO_LineIn_Check).Equals(IO_VALUE.HIGH) && Robot.IOValue(IO_LineEnd_Check).Equals(IO_VALUE.HIGH))
{
// UpdateShelfId();
//if (CurrShelfId.EndsWith("00"))
//{
// SendShelfOut(" 料串号【" + CurrShelfId + "】无效 ");
//}
//else
// {
MoveInfo.ShelfNoTray = false;
//定位工位有料串,直接开始入料
MoveInfo.NextMoveStep(StepEnum.IB06_LocationUp);
WorkLog("检测到料串:链条停止转动,定位气缸上升");
AgvClient.SetToNone(AgvName);
LocationUp(MoveInfo);
// }
}
else
{
MoveInfo.EndMove();
WorkLog(" 未检测到料串,链条停止转动,入料结束");
}
}
else if (MoveInfo.IsStep(StepEnum.IB06_LocationUp))
{
MoveInfo.NextMoveStep(StepEnum.IB07_AxisUpMove);
WorkLog("料串入料 :上料轴开始慢速上升到P3点,等待检测到料盘");
LastCodeList = new List<string>();
NextCodeList = new List<string>();
MoveInfo.ShelfNoTray = false;
BatchAxisToP3(true);
}
#endregion
#region 检测到托盘,扫码,取料并放入托盘
else if (MoveInfo.IsStep(StepEnum.IB07_AxisUpMove))
{
CheckHasTray();//==>StepEnum.IB09_ScanCode
}
else if (MoveInfo.IsStep(StepEnum.IB09_ScanCode))
{
WorkLog("IB09_ScanCode");
MoveInfo.MoveParam = new WorkParam();
MoveInfo.MoveParam.WareCode = CodeManager.GetValidCode(LastCodeList);
if (String.IsNullOrEmpty(MoveInfo.MoveParam.WareCode))
{
MoveInfo.MoveParam.IsNgReel = true;
MoveInfo.MoveParam.NgMsg = "无有效条码";
MoveInfo.MoveParam.TargetPosType = 1;
WorkLog(" 无有效条码,从XRay放到NG箱:" + MoveInfo.MoveParam.ToStr());
string outF = "无有效条码NG.";
RobotManager.robot.sQLite.Insert(MoveInfo.MoveParam.WareCode, MoveInfo.MoveParam.PlateW, MoveInfo.MoveParam.PlateH, 0, outF);
}
else if (SServerManager.CanConnect())
{
int needPosition = 0;
string msg = SServerManager.Get_VMICheckRLC(Name, MoveInfo.MoveParam.WareCode, out needPosition);
if (needPosition >= 1 && needPosition <= 3)
{
MoveInfo.MoveParam.TargetPosType = needPosition;
WorkLog(" 【" + MoveInfo.MoveParam.WareCode + "】通过接口获取目标位置:" + needPosition);
}
else
{
WorkLog(" 【" + MoveInfo.MoveParam.WareCode + "】获取是否测值失败:" + msg);
MoveInfo.MoveParam.TargetPosType = 1;
MoveInfo.MoveParam.IsNgReel = true;
MoveInfo.MoveParam.NgMsg = msg;
RobotManager.robot.sQLite.Insert(MoveInfo.MoveParam.WareCode, MoveInfo.MoveParam.PlateW, MoveInfo.MoveParam.PlateH, 0, msg);
}
}
else {
MoveInfo.MoveParam.TargetPosType = 1;
}
MoveInfo.NextMoveStep(StepEnum.IB10_ScanOK);
var span = DateTime.Now - MoveInfo.LastSetpTime;
//LogUtil.ticklog("", MoveInfo.MoveParam.WareCode, span.TotalSeconds, "拍照扫码结束");
WorkLog("料串入料 :扫码结束【" + MoveInfo.MoveParam.WareCode + "】,等待取料机构来取料," + MoveInfo.MoveParam.ToStr());
}
else if (MoveInfo.IsStep(StepEnum.IB11_TrayLeave))
{
MoveInfo.NextMoveStep(StepEnum.IB12_BatchAxisToP3);
WorkLog("料串入料 :料盘已拿走,批量轴到P3,测盘高 ");
//可删除WaitTime
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
BatchAxisToP3();
}
else if (MoveInfo.IsStep(StepEnum.IB12_BatchAxisToP3))
{
MoveInfo.NextMoveStep(StepEnum.IB13_SaveHight);
//可删除WaitTime
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
LastHeight = GetHeight();
CheckHasTray();
}
#endregion
#region 未检测到托盘或放料完成
else if (MoveInfo.IsStep(StepEnum.IB21_BatchToP1))
{
MoveInfo.NextMoveStep(StepEnum.IB22_LocationDown);
WorkLog("上料完成 :定位气缸下降");
LocationDown(MoveInfo);
}
else if (MoveInfo.IsStep(StepEnum.IB22_LocationDown))
{
MoveInfo.NextMoveStep(StepEnum.IB23_ShelfOut);
MoveInfo.TimeOutSeconds = 40;
MoveInfo.OneWaitCanEndStep = true;
bool agvcallresult = AgvClient.NeedLeave(AgvName, CurrShelfId, ClientLevel.High);
WorkLog("上料完成 :通知agv来取料串,等待料串离开AgvName:" + AgvName + ",CurrShelfId:" + CurrShelfId+ ",agvcallresult:"+ agvcallresult.ToString());
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(60000));
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_LineIn_Check, IO_VALUE.LOW));
}
else if (MoveInfo.IsStep(StepEnum.IB23_ShelfOut))
{
WorkLog("上料结束");
MoveInfo.EndMove();
}
#endregion
}
public void GetTrayOK()
{
if (MoveInfo.MoveType.Equals(RobotMoveType.Working))
{
MoveInfo.NextMoveStep(StepEnum.IB11_TrayLeave);
WorkLog("当前料盘已离开,清理高度,准备开始测高");
LastHeight = 0;
}
else
{
LogUtil.error(Name + "当前状态:" + MoveInfo.MoveType + ",GetTrayOK暂不处理");
}
}
//internal string LCodeStr = "";
//internal string GetCurrCode()
//{
// return LCodeStr = CodeManager.GetValidCode(LastCodeList);
//}
private void FI_21_BatchAxisDown()
{
// MoveInfo.NextMoveStep(LineMoveStep.FI_21_BatchAxisDown);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(200));
int maxtPosition = BatchAxisP3 - Robot.Config.Height_ChangeValue * 30; //在上料位置基础上下降30mm
int currPositon = BatchAxis.GetAclPosition();
int targetPosition = currPositon - Robot.Config.Height_ChangeValue * 30;
if (targetPosition <= BatchAxisP1)
{
targetPosition = BatchAxisP1;
}
else if (targetPosition > maxtPosition)
{
targetPosition = maxtPosition;
}
WorkLog("料盘移栽 :提升轴下降到料盘不溢出(" + (currPositon - Robot.Config.Height_ChangeValue * 30) + "):" + targetPosition);
BatchAxis.AbsMove(MoveInfo, targetPosition, Robot.Config.BatchAxis_P1Speed);
}
public void YuScanCode()
{
bool isScan = ConfigAppSettings.GetIntValue(Setting_Init.NeedScanCode).Equals(1);
//TODO 此处需要等待空托盘
if (MoveInfo.ShelfNoTray.Equals(false) && isScan)
{
WorkLog("料盘移栽 : ,预扫码");
//还有料盘,直接扫码
NextCodeList = new List<string>();
try
{
Task<List<string>> scanTask = Task.Factory.StartNew(delegate
{
Robot.IOMove(IO_Type.Camera_Led, IO_VALUE.HIGH);
NextCodeList = CodeManager.CameraScan(Name+"预扫码", CameraName);
//if (NextCodeList.Count <= 0)
//{
// NextCodeList = CodeManager.CameraScan(Name, CameraName);
//}
Robot.IOMove(IO_Type.Camera_Led, IO_VALUE.LOW);
return NextCodeList;
});
}
catch (Exception ex)
{
LogUtil.error(" 为下一盘料扫码出错:", ex);
}
}
}
private void IB09_ScanCode()
{
MoveInfo.NextMoveStep(StepEnum.IB09_ScanCode);
bool isScan = ConfigAppSettings.GetIntValue(Setting_Init.NeedScanCode).Equals(1);
LastCodeList = new List<string>();
if (NextCodeList.Count > 0)
{
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(300));
LastCodeList = new List<string>(NextCodeList);
NextCodeList = new List<string>();
MoveInfo.MoveParam.WareCode = CodeManager.GetValidCode(LastCodeList);
MoveInfo.NextMoveStep(StepEnum.IB10_ScanOK);
WorkLog("料盘移栽 :使用预扫码【" + MoveInfo.MoveParam.WareCode + "】,等待取料机构来取料");
//WorkLog("料盘移栽 :上料横移取料端");
// CylinderMove(MoveInfo, IO_Type.SL_MoveCylinder_Give, IO_Type.SL_MoveCylinder_Take);
}
else if (isScan)
{
WorkLog("料盘移栽 :开始扫码");
MoveInfo.OneWaitCanEndStep = true;
MoveInfo.WaitList.Add(WaitResultInfo.WaitFeedScanCode());
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(6000));
try
{
Task<List<string>> scanTask = Task.Factory.StartNew(delegate
{
Robot.IOMove(IO_Type.Camera_Led, IO_VALUE.HIGH);
LastCodeList = CodeManager.CameraScan(Name, CameraName);
if (LastCodeList.Count <= 0)
{
LastCodeList = CodeManager.CameraScan(Name, CameraName);
}
Robot.IOMove(IO_Type.Camera_Led, IO_VALUE.LOW);
return LastCodeList;
});
}
catch (Exception ex)
{
LogUtil.error("FI_13_ScanCode扫码出错:", ex);
}
}
else
{
WorkLog("料盘移栽 :不需要扫码");
}
}
private void CheckHasTray()
{
WarnMsg = "";
if (Robot.IOValue(IO_AxisTrayCheck).Equals(IO_VALUE.HIGH) && MoveInfo.ShelfNoTray.Equals(false))
{
IB09_ScanCode();
}
else
{
if (MoveInfo.ShelfNoTray.Equals(false))
{
//判断当前位置是否在指定的位置
int currP = BatchAxis.GetAclPosition();
int chaz = Math.Abs(currP - BatchAxisP3);
if (chaz > BatchAxis.Config.CanErrorCountMax)
{
MoveInfo.NextMoveStep(StepEnum.IB07_AxisUpMove);
WorkLog("料串入料 :CheckHasTray:上料轴开始慢速上升到P3点,等待检测到料盘。currP"+ currP.ToString());
MoveInfo.ShelfNoTray = false;
BatchAxisToP3();
return;
}
}
//无料盘
MoveInfo.ShelfNoTray = true;
SendShelfOut(" 未检测到料盘 ");
}
}
private void SendShelfOut(string msg = "")
{
MoveInfo.NextMoveStep(StepEnum.IB21_BatchToP1);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
WorkLog("送出料串 :" + msg + ",提升伺服到P1点");
BatchAxis.SuddenStop(true);
BatchAxis.AbsMove(MoveInfo, BatchAxisP1, Robot.Config.BatchAxis_P1Speed);
}
/// <summary>
/// 料串往P3提升,直到检测到料盘
/// </summary>
/// <param name="first">是否是第一次测试料窜是否有盘</param>
private void BatchAxisToP3(bool first=false)
{
int targetP3 = BatchAxisP3;
int targetSpeed = Robot.Config.BatchAxis_P3Speed;
MoveInfo.TimeOutSeconds = 200;
MoveInfo.CanWhileCount = 0;
// 需要增加定时器,获取验证信号并停止伺服
StartMovePosition = BatchAxis.GetAclPosition();
if (!first)
{
//如果不是第一次取盘,则每次最多上升16mm
targetP3 = StartMovePosition+Robot.Config.Height_ChangeValue*60;
if (targetP3 > BatchAxisP3)
targetP3 = BatchAxisP3;
}
MoveInfo.WaitList.Add(WaitResultInfo.WaitBatchAxis(BatchAxis.Config, targetP3, targetSpeed));
BatchAxis.Config.TargetPosition = targetP3;
BatchAxis.AbsMove(null, targetP3, targetSpeed);
//开始检测信号
BatchAxis.BatchAxisStartCheck(IO_AxisTrayCheck, IO_VALUE.HIGH);
}
#endregion
#region 获取料盘高度
private int StartMovePosition = 0;
private int EndMovePosition = 0;
internal int LastHeight = 0;
private int GetHeight()
{
LastHeight = 0;
int AxisChangeValue = Robot.Config.Height_ChangeValue;
//计算高度
EndMovePosition = BatchAxis.GetAclPosition();
bool isLast = false;
int chaz = Math.Abs(EndMovePosition - BatchAxisP3);
if (chaz < BatchAxis.Config.CanErrorCountMax)
{
isLast = true;
}
float height = (float)Math.Ceiling(1F * Math.Abs(EndMovePosition - StartMovePosition) / AxisChangeValue);
string buchongStr = "";
if (isLast)
{
buchongStr = "(最后一盘料已补充5)";
height += 5;
}
//如果检测出<=15,都按照8计算
if (height <= 15)
{
LastHeight = 8;
}
else
{
List<int> heightList = RobotManager.GetTrayList();
heightList = (from m in heightList orderby m descending select m).ToList<int>();
float minCha = height;
foreach (int h in heightList)
{
//取差值最小的接近值
float cha = Math.Abs(h - (height - 4));
if (cha < minCha)
{
LastHeight = h;
minCha = cha;
}
}
}
if (LastHeight <= 8) { LastHeight = 8; }
string code = CodeManager.GetValidCode(LastCodeList);
string msg = Name + " 计算盘高:上升前 [" + StartMovePosition + "]实时[ " + EndMovePosition + "]差值[" + (EndMovePosition - StartMovePosition) + "]系数[" + AxisChangeValue + "] 计算后" + buchongStr + "[" + height + "]" + ",归类为【" + LastHeight + "mm】条码【" + code + "】";
LogUtil.info(msg);
return LastHeight;
}
#endregion
#region AGV 处理
internal bool ProcessShelfOut = false;
internal bool ProcessShelfEnter = false;
internal void AgvReady(string nodeId, string rfid, ClientAction clientaction)
{
if (clientaction== ClientAction.MayLeave)
{
ShelfOutProcess(nodeId, rfid);
}
else
{
ShelfEnterProcess(nodeId, rfid);
}
}
internal void ShelfEnterProcess(string nodeId, string rfid)
{
Task.Factory.StartNew(delegate
{
string logName = Name + "料串 " + rfid + " [AGV->" + AgvName + "] ";
try
{
if (Robot.IOValue(IO_LineIn_Check).Equals(IO_VALUE.LOW) && Robot.IOValue(IO_LineEnd_Check).Equals(IO_VALUE.LOW))
{
LogUtil.info(logName + " 开始转动线体");
ProcessShelfEnter = true;
LineRun();
//等待进料检测信号
bool result = Robot.WaitIo(IO_LineIn_Check, IO_VALUE.HIGH, 60000);
if (!result)
{
LogUtil.error(logName + " 等待 IO_LineIn_Check=High 超时, 等待 IO_LineEnd_Check 信号");
}
else
{
LogUtil.info(logName + "已收到 IO_LineIn_Check=High , 等待 IO_LineEnd_Check 信号");
}
result = Robot.WaitIo(IO_LineEnd_Check, IO_VALUE.HIGH, 60000);
if (!result)
{
LogUtil.error(logName + " 等待 IO_LineEnd_Check=High 超时,等待3000后停止转动,发送 FinishEnter");
}
else
{
LogUtil.info(logName + "已收到 IO_LineEnd_Check=High ,等待3000后停止转动,发送 FinishEnter");
}
//等待200毫秒后停止转动
Thread.Sleep(3000);
LogUtil.info(logName + "等待3000后,停止链条转动");
LineStop();
//料串可离开
AgvClient.SetStatus(AgvName, "", ClientAction.FinishEnter, ClientLevel.High, true);
Task.Factory.StartNew(delegate
{
Thread.Sleep(10000);
AgvClient.SetStatus(AgvName, "", ClientAction.None, ClientLevel.High, true);
});
ProcessShelfEnter = false;
LogUtil.info(logName + " 结束");
}
else
{
//入口有料串,暂不处理
LogUtil.error(logName + ",入口已有料架,暂不处理");
Task.Factory.StartNew(delegate
{
Thread.Sleep(3000);
AgvClient.SetStatus(AgvName, "", ClientAction.None, ClientLevel.High, true);
});
}
}
catch (TimeoutException te)
{
LogUtil.error(logName + " 超时:" + te);
}
catch (Exception ex)
{
LogUtil.error(logName + " 出错:", ex);
}
finally
{
ProcessShelfEnter = false;
}
});
}
internal void ShelfOutProcess(string nodeId, string rfid)
{
//AGV已到达,将料串送入AGV中
Task.Factory.StartNew(delegate
{
string logName = Name + "料串" + rfid + "[" + AgvName + "->AGV ] ";
try
{
//AgvClient.SetStatus(AgvName, CurrShelfId, ClientAction.None, ClientLevel.High, true);
if (Robot.IOValue(IO_LineIn_Check).Equals(IO_VALUE.HIGH) || Robot.IOValue(IO_LineEnd_Check).Equals(IO_VALUE.HIGH))
{
LocationDown();
ProcessShelfOut = true;
LineBack();
bool result = Robot.WaitIo(IO_LineIn_Check, IO_VALUE.LOW, 60000);
if (!result)
{
LogUtil.error(logName + " 等待 IO_LineIn_Check=LOW超时,等待8000后停止转动,发送FinishLeave");
}
else
{
LogUtil.info(logName + " 已收到 IO_LineIn_Check=LOW ,等待8000后停止转动,发送FinishLeave");
}
//再转动2000
Thread.Sleep(8000);
LineStop();
AgvClient.SetStatus(AgvName, CurrShelfId, ClientAction.FinishLeave, ClientLevel.High, true);
Task.Factory.StartNew(delegate
{
Thread.Sleep(10000);
AgvClient.SetStatus(AgvName, "", ClientAction.None, ClientLevel.High, true);
});
ProcessShelfOut = false;
LogUtil.info(logName + "结束,停止转动,清空料串[" + CurrShelfId + "] ");
}
else
{
LogUtil.info(logName + " 未检测到料架,暂不处理");
Task.Factory.StartNew(delegate
{
Thread.Sleep(3000);
AgvClient.SetStatus(AgvName, "", ClientAction.None, ClientLevel.High, true);
});
}
}
catch (TimeoutException te)
{
LogUtil.error(logName + " 超时:" + te);
}
catch (Exception ex)
{
LogUtil.error(logName + " 出错:", ex);
}
finally
{
LineStop();
ProcessShelfOut = false;
}
});
}
#endregion
protected void WorkLog(string msg)
{
LogUtil.info(Name + " [" + MoveInfo.MoveStep + "]" + msg);
}
}
}