EquipBase.cs
30.6 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
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace OnlineStore.DeviceLibrary
{
public abstract class EquipBase : KTK_Store
{
public bool StopInstore = false;
public bool MoveStop = false;
public string CurrShelfId = "";//当前的料架ID
public string LastOutShelfId = "";//最后一个出口
public string RFIDIP = "";
public LineMoveInfo SecondMoveInfo = null;
public bool IsDebug = false;
public bool UseAxis = false;
public ConcurrentQueue<InOutParam> waitOutStoreList = new ConcurrentQueue<InOutParam>();
public List<InOutParam> waitInStoreList = new List<InOutParam>();
internal object waitInListLock = "";
protected int trayCount = 0;
internal int preTrayNum = 0;
public int currTrayNum = 0;
public AxisBean UpdownAxis = null;
public delegate void TrayProcessEnd(int swNum, int trayNum);
protected abstract void BaseTimerProcess();
protected abstract void FixtureProcess();
protected override void mainThread_Process()
{
TimerProcess();
}
public DateTime LastAlarmTime = DateTime.Now;
public override void Alarm(LineAlarmType alarmType)
{
if (alarmType.Equals(LineAlarmType.None).Equals(false))
{
LastAlarmTime = DateTime.Now;
}
if (this.alarmType.Equals(alarmType))
{
return;
}
if (alarmType.Equals(LineAlarmType.SuddenStop))
{
isInSuddenDown = true;
}
else if (alarmType.Equals(LineAlarmType.NoAirCheck))
{
isNoAirCheck = true;
}
this.alarmType = alarmType;
if (alarmType.Equals(LineAlarmType.SuddenStop) || alarmType.Equals(LineAlarmType.NoAirCheck)
|| alarmType.Equals(LineAlarmType.AxisAlarm) || alarmType.Equals(LineAlarm.AxisErrorStop))
{
StopMove(alarmType + "报警");
}
}
public virtual void CheckAlarmProcess(LineMoveInfo moveInfo, LineAlarmType alarmType)
{
}
protected virtual void CloseAllDO()
{
List<string> doList = new List<string>(baseConfig.DOList.Keys);
foreach (string doType in doList)
{
if (doType.Equals(IO_Type.SL_AlarmLed) || doType.Equals(IO_Type.SL_HddLed))
{
continue;
}
if (IOValue(doType).Equals(IO_VALUE.HIGH))
{
IOMove(doType, IO_VALUE.LOW);
}
}
}
private DateTime lastProTimer = DateTime.Now;
protected int TimerMaxSeconds = 3;
public void TimerProcess()
{
TimeSpan span = DateTime.Now - lastProTimer;
if (isInPro && span.TotalSeconds < TimerMaxSeconds)
{
return;
}
isInPro = true;
lastProTimer = DateTime.Now;
try
{
if (runStatus <= LineRunStatus.Wait && (!baseConfig.DType.Equals(DeviceType.FeedingEquip)))
{
isInPro = false;
return;
}
BaseTimerProcess();
if (TimerMaxSeconds > 3 && runStatus >= LineRunStatus.Runing)
{
TimerMaxSeconds = 3;
}
}
catch (Exception ex)
{
LogUtil.error(Name + "TimerProcess出错:", ex);
}
isInPro = false;
}
protected DateTime preIoTimerOutTime = DateTime.Now;
protected virtual void IOTimeOutProcess()
{
try
{
TimeSpan span = DateTime.Now - preIoTimerOutTime;
if (span.TotalSeconds > 1 && alarmType.Equals(LineAlarmType.IoSingleTimeOut))
{
preIoTimerOutTime = DateTime.Now;
if (runStatus < LineRunStatus.Runing || isInSuddenDown || isNoAirCheck)
{
return;
}
//若BOX和出料都没有在等待Io的过程中则此Io超时异常可能已经处理过
if (MoveInfo.MoveType.Equals(LineMoveType.None) && SecondMoveInfo.MoveType.Equals(LineMoveType.None) && MoveInfo.IsInWait.Equals(false) && SecondMoveInfo.IsInWait.Equals(false))
{
LogUtil.info(Name + "清理信号超时报警【" + WarnMsg + "】 ");
alarmType = LineAlarmType.None;
SetWarnMsg("");
}
}
}
catch (Exception ex)
{
LogUtil.error("IOTimeOutProcess出错:", ex);
}
}
protected override void BusyMoveProcess()
{
try
{
if (MoveStop)
{
return;
}
if (SecondMoveInfo.MoveType.Equals(LineMoveType.Fixture))
{
FixtureProcess();
}
if (MoveInfo.MoveType.Equals(LineMoveType.InStore) || this.SecondMoveInfo.MoveType.Equals(LineMoveType.InStore))
{
InStoreProcess();
}
else if (MoveInfo.MoveType.Equals(LineMoveType.OutStore) || SecondMoveInfo.MoveType.Equals(LineMoveType.OutStore))
{
OutStoreProcess();
}
else if (MoveInfo.MoveType.Equals(LineMoveType.RHome))
{
ResetProcess();
}
else if (MoveInfo.MoveType.Equals(LineMoveType.Reset))
{
ResetProcess();
}
}
catch (Exception ex)
{
LogUtil.error(Name + " BusyMoveProcess 出错:" + ex.ToString());
}
}
//protected void MoveTimeOut(LineMoveInfo move, string msg)
//{
// WarnMsg = move.Name + "[" + move.MoveStep + "] "+ msg + " [" +FormUtil.GetSpanStr( move.StepSpan()) + "]";
// int logId = DeviceID * 10000 + (int)move.MoveStep;
// LogUtil.error(WarnMsg, logId);
// Alarm(LineAlarmType.IoSingleTimeOut);
//}
//protected void ClearTimeoutAlarm(string msg)
//{
// if (isInSuddenDown || isNoAirCheck)
// {
// return;
// }
// if (WarnMsg.Contains(msg) && alarmType.Equals(LineAlarmType.IoSingleTimeOut))
// {
// LogUtil.info(Name + "清理信号超时报警【" + WarnMsg + "】 ");
// alarmType = LineAlarmType.None;
// SetWarnMsg("");
// }
//}
protected bool CanStartRun()
{
string canResult = LineManager.Line.CanStart();
if (String.IsNullOrEmpty(canResult).Equals(false))
{
SetWarnMsg(Name + canResult);
return false;
}
return true;
}
protected void ResetClearData()
{
TimerMaxSeconds = 10;
trayCount = 0;
SetWarnMsg("");
alarmType = LineAlarmType.None;
isInSuddenDown = false;
isNoAirCheck = false;
preTrayNum = 0;
currTrayNum = 0;
}
public void ChangeDebug(bool isDebug)
{
if (baseConfig.DType.Equals(DeviceType.MoveEquip))
{
if (isDebug)
{
IsDebug = true;
IOMove(IO_Type.StopDown1, IO_VALUE.HIGH);
IOMove(IO_Type.StopDown2, IO_VALUE.HIGH);
LogInfo("从正常状态切换到调试状态!");
}
else
{
IsDebug = false;
IOMove(IO_Type.StopDown1, IO_VALUE.HIGH);
IOMove(IO_Type.StopDown2, IO_VALUE.LOW);
LogInfo("从调试状态切换到正常状态!");
}
}
else if (baseConfig.DType.Equals(DeviceType.HYEquip))
{
if (isDebug)
{
IsDebug = true;
IOMove(IO_Type.HY_FrontStopDown, IO_VALUE.HIGH);
IOMove(IO_Type.HY_StopDown, IO_VALUE.HIGH);
LogInfo("从正常状态切换到调试状态!");
}
else
{
IsDebug = false;
IOMove(IO_Type.HY_FrontStopDown, IO_VALUE.HIGH);
IOMove(IO_Type.HY_StopDown, IO_VALUE.LOW);
LogInfo("从调试状态切换到正常状态!");
}
}
else
{
if (isDebug)
{
IsDebug = true;
LogInfo("从正常状态切换到调试状态!");
}
else
{
IsDebug = false;
LogInfo("从调试状态切换到正常状态!");
}
}
}
internal virtual void OpenStopBlock()
{
preRWTime = DateTime.Now;
if (baseConfig.DType.Equals(DeviceType.MoveEquip))
{
LogInfo("OpenStopCylinder: 下降阻挡气缸,上下气缸上升,顶升气缸下降");
IOMove(IO_Type.StopDown1, IO_VALUE.HIGH);
IOMove(IO_Type.StopDown2, IO_VALUE.HIGH);
//上下气缸上升
if (!UseAxis)
{
CylinderMove(null, IO_Type.UpDownCylinder_Down, IO_Type.UpDownCylinder_Up);
}
//顶升气缸下降
CylinderMove(null, IO_Type.TopCylinder_Up, IO_Type.TopCylinder_Down);
Thread.Sleep(30);
}
else if (baseConfig.DType.Equals(DeviceType.FeedingEquip))
{
}
}
internal virtual bool OpenStopBlockOk(TimeSpan span)
{
TimeSpan rwSpan = DateTime.Now - preRWTime;
if (baseConfig.DType.Equals(DeviceType.MoveEquip))
{
if (IOValue(IO_Type.StopDown1).Equals(IO_VALUE.HIGH) &&
IOValue(IO_Type.StopDown2).Equals(IO_VALUE.HIGH))
{
return true;
}
else if (rwSpan.TotalSeconds > 5 && span.TotalSeconds > 6 && span.TotalSeconds < LineManager.Config.IOSingle_TimerOut * 2)
{
preRWTime = DateTime.Now;
IOMove(IO_Type.StopDown1, IO_VALUE.HIGH);
IOMove(IO_Type.StopDown2, IO_VALUE.HIGH);
}
}
else if (baseConfig.DType.Equals(DeviceType.FeedingEquip))
{
return true;
}
return true;
}
internal virtual void CloseStopBlock()
{
if (baseConfig.DType.Equals(DeviceType.MoveEquip))
{
LogInfo("CloseCylinderStop: 上升阻挡气缸,关闭上下气缸,顶升气缸IO");
IOMove(IO_Type.StopDown1, IO_VALUE.LOW);
IOMove(IO_Type.StopDown2, IO_VALUE.LOW);
//上下气缸上升
if (!UseAxis)
{
IOMove(IO_Type.UpDownCylinder_Down, IO_VALUE.LOW);
IOMove(IO_Type.UpDownCylinder_Up, IO_VALUE.LOW);
}
//顶升气缸下降
IOMove(IO_Type.TopCylinder_Up, IO_VALUE.LOW);
IOMove(IO_Type.TopCylinder_Down, IO_VALUE.LOW);
Thread.Sleep(30);
}
else if (baseConfig.DType.Equals(DeviceType.FeedingEquip))
{
}
}
internal bool UpdateTrayNum()
{
trayCount++;
//此处先对托盘号进行验证
preTrayNum = currTrayNum;
currTrayNum = RFIDManager.GetTrayNum(Name, DeviceID, true);
SServerManager.updateTray(currTrayNum);
if (String.IsNullOrEmpty(RFIDIP)) { }
else
{
LogUtil.LOGGER.Info(Name + " [" + trayCount + "] IP [" + RFIDManager.GetRFIP(DeviceID) + "] 当前托盘 [" + currTrayNum + "] 上个托盘 [" + preTrayNum + "] ");
if (preTrayNum.Equals(currTrayNum) && currTrayNum > 0)
{ //如果是接驳台HY,不需要验证托盘号是否重复
List<int> jHy = new List<int>() { 210, 212, 217 };
if (jHy.Contains(DeviceID))
{
LogUtil.error(Name + ":当前托盘 [" + currTrayNum + "] 上个托盘[" + preTrayNum + "] ,连续两个托盘号一样,当前为出料口横移,不需要处理托盘号重复");
}
else
{
TrayManager.TrayErrorMsg = DateTime.Now.ToLongTimeString() + " " + Name + "托盘号错乱:当前托盘 [" + currTrayNum + "] 上个托盘[" + preTrayNum + "] ,连续两个托盘号一样";
LogUtil.error(Name + "托盘号错乱:当前托盘 [" + currTrayNum + "] 上个托盘[" + preTrayNum + "] ,连续两个托盘号一样");
//托盘号一样,返回false
return false;
}
}
}
return true;
}
internal void ClearTrayRFID()
{
RFIDManager.ClearTrayNum(DeviceID);
}
#region 伺服运动
public bool RunAxis(bool isCheck, AxisBean axis)
{
if (!UseAxis)
{
return true;
}
string msg = "";
bool result = axis.Open(isCheck, out msg);
if (result && String.IsNullOrEmpty(msg))
{
return true;
}
SetWarnMsg(Name + msg, axis.Config.DisplayStr + "_轴报警");
Alarm(LineAlarmType.AxisAlarm);
return false;
}
public void CloseAxis(AxisBean axis)
{
LogUtil.info(Name + "关闭伺服 " + axis.AxisName);
axis.ServoOff();
Thread.Sleep(100);
}
private DateTime checkAlarmTime = DateTime.Now;
public bool CheckAxisAlarm(params AxisBean[] axisList)
{
if (!NoErrorAlarm())
{
return true;
}
TimeSpan span = DateTime.Now - checkAlarmTime;
//1秒钟检测一次轴报警
if (span.TotalSeconds < 3)
{
return false;
}
checkAlarmTime = DateTime.Now;
bool isInAlarm = false;
foreach (AxisBean axisInfo in axisList)
{
short axis = axisInfo.Config.GetAxisValue();
string deviceName = axisInfo.Config.GetNameStr();
int alarmIo = AxisManager.instance.GetAlarmStatus(deviceName, axis);
if (alarmIo == 1)
{
string msg = Name + " 运动轴" + axisInfo.Config.Explain + "报警";
//LogUtil.error(WarnMsg);
SetWarnMsg(msg, axisInfo.Config.Explain + "轴报警");
Alarm(LineAlarmType.AxisAlarm);
isInAlarm = true;
}
}
//判断报警状态
return isInAlarm;
}
#endregion
#region CheckWait处理
private DateTime preCheckAxisTime = DateTime.Now;
protected DateTime preRWTime = DateTime.Now;
internal void CheckWait(LineMoveInfo moveInfo)
{
try
{
List<WaitResultInfo> list = moveInfo.WaitList;
if (list.Count <= 0)
{
moveInfo.EndStepWait();
return;
}
//当等待超过一分钟时,需要打印提示
TimeSpan span = DateTime.Now - moveInfo.LastSetpTime;
string NotOkMsg = "";
bool isOk = true;
if (moveInfo.OneWaitCanEndStep)
{
isOk = false;
}
foreach (WaitResultInfo wait in list)
{
if (wait.IsEnd)
{
continue;
}
NotOkMsg = " [" + wait.ToStr() + "] ";
if (wait.WaitType.Equals(WaitEnum.W001_AxisMove))
{
TimeSpan axisSpan = DateTime.Now - preCheckAxisTime;
if (axisSpan.TotalSeconds > 1)
{
preCheckAxisTime = DateTime.Now;
string msg = "";
if (wait.IsHomeMove)
{
wait.IsEnd = AxisBean.HomeMoveIsEnd(moveInfo, wait.AxisInfo, out msg);
if (wait.IsEnd)
{
RunLogUtil.AxisLog(new AxisMoveLog(Name, wait.AxisInfo.Explain, "回原点", 0, wait.AxisInfo.HomeHighSpeed, moveInfo.LastSetpTime, DateTime.Now, moveInfo.MoveParam.PosId, moveInfo.MoveParam.WareCode));
}
}
else
{
wait.IsEnd = AxisBean.ACAxisMoveIsEnd(moveInfo, wait.AxisInfo, wait.TargetPosition, wait.TargetSpeed, out msg);
if (wait.IsEnd)
{
RunLogUtil.AxisLog(new AxisMoveLog(Name, wait.AxisInfo.Explain, "绝对运动", wait.TargetPosition, wait.TargetSpeed, moveInfo.LastSetpTime, DateTime.Now, moveInfo.MoveParam.PosId, moveInfo.MoveParam.WareCode));
}
}
if (!msg.Equals(""))
{
isOk = false;
string type = moveInfo.GetStepDes() + "_轴运动报警";
// WarnMsg = Name + msg;
SetWarnMsg(msg, type, moveInfo);
Alarm(LineAlarmType.AxisMoveError);
CheckAlarmProcess(moveInfo, LineAlarmType.AxisMoveError);
LogUtil.error(WarnMsg, DeviceID * 1000 + 14);
break;
}
}
}
else if (wait.WaitType.Equals(WaitEnum.W002_IOValue))
{
NotOkMsg = " [" + baseConfig.GetDisplayName(wait.IoType) + "=" + wait.IoValue + "]";
wait.IsEnd = IOValue(wait.IoType).Equals(wait.IoValue);
if (!wait.IsEnd)
{
if (wait.IoType.Equals(IO_Type.SL_Line_Run))
{
IOMove(wait.IoType, wait.IoValue);
LogInfo(" [" + moveInfo.MoveType + "][" + moveInfo.MoveStep + "]重写DO: " + wait.ToStr());
}
TimeSpan rwSpan = DateTime.Now - preRWTime;
//一分钟还未检测到
if (span.TotalSeconds > LineManager.Config.IOSingle_TimerOut && alarmType <= LineAlarmType.IoSingleTimeOut)
{
ConfigIO io = baseConfig.getWaitIO(wait.IoType);
string warnmsg = moveInfo.Name + "[" + moveInfo.MoveType + "][" + moveInfo.MoveStep + "] 等待" + NotOkMsg + " 超时 " + Math.Round(span.TotalSeconds, 1) + "秒";
SetWarnMsg(warnmsg, moveInfo.GetStepDes() + "_超时报警", moveInfo);
LogUtil.error(WarnMsg, DeviceID * 1000 + 13);
if (NoAlarm())
{
Alarm(LineAlarmType.IoSingleTimeOut);
CheckAlarmProcess(moveInfo, LineAlarmType.IoSingleTimeOut);
}
}
if (rwSpan.TotalSeconds > 5 && span.TotalSeconds > 6 && span.TotalSeconds < LineManager.Config.IOSingle_TimerOut * 2)
{
preRWTime = DateTime.Now;
string msg = moveInfo.Name + " [" + moveInfo.MoveType + "][" + moveInfo.MoveStep + "] " + NotOkMsg + "已等待 " + Math.Round(span.TotalSeconds, 1) + "秒,重写DO:";
bool isLog = false;
foreach (WaitResultInfo ww in list)
{
if (ww != null && ww.WaitType.Equals(2) && baseConfig.DOList.ContainsKey(ww.IoType))
{
if (IOManager.DOValue(ww.IoType, baseConfig.Id).Equals(ww.IoValue).Equals(false))
{
isLog = true;
IOMove(ww.IoType, ww.IoValue);
msg += ww.ToStr() + ",";
}
}
}
if (isLog)
{
LogUtil.error(msg);
}
}
if (!moveInfo.OneWaitCanEndStep)
{
isOk = false;
break;
}
}
}
else if (wait.WaitType.Equals(WaitEnum.W003_Time))
{
wait.IsEnd = (span.TotalMilliseconds >= wait.TimeMSeconds);
}
else if (wait.WaitType.Equals(WaitEnum.W008_InStoreCheckOK))
{
string posId = moveInfo.MoveParam.PosId;
int id = moveInfo.MoveParam.GetStoreId();
wait.IsEnd = LineServer.RightInPosId(id, posId);
}
else if (wait.WaitType.Equals(WaitEnum.W009_BoxCanInstore))
{
int storeId = moveInfo.MoveParam.GetStoreId();
wait.IsEnd = LineServer.BoxCanReviceTray(storeId, out NotOkMsg);
}
else
{
wait.IsEnd = CheckWaitResult(moveInfo, wait);
}
//else if (wait.WaitType.Equals(10))
//{
// wait.IsEnd = LineManager.Line.SideWay34HasTray().Equals(false);
//}
if (wait.IsEnd)
{
if (moveInfo.OneWaitCanEndStep)
{
isOk = true;
break;
}
}
else
{
if (!moveInfo.OneWaitCanEndStep)
{
isOk = false;
break;
}
}
}
if (isOk)
{
moveInfo.EndStepWait();
ClearStepAlarm(moveInfo.GetStepDes());
}
else if (span.TotalSeconds > moveInfo.TimeOutSeconds)
{
int second = 10;
if (IsLowAlarm(moveInfo))
{
second = 30;
}
second = (int)(span.TotalSeconds / moveInfo.TimeOutSeconds) * 10;
if (second > 120)
{
second = 120;
}
else if (second < 10)
{
second = 10;
}
string msg = moveInfo.Name + "[" + moveInfo.MoveType + "][" + moveInfo.MoveStep + "]等待" + NotOkMsg
+ "超时[" + FormUtil.GetSpanStr(span) + "]";
string type = moveInfo.GetStepDes() + "_" + "超时报警";
//判断是等待抓料直接返回
List<WaitResultInfo> noTrayAlarm = (from m in list where m.WaitType.Equals(WaitEnum.W1000_NoTrayAlarm) select m).ToList();
if (noTrayAlarm.Count > 0)
{
msg = moveInfo.Name + "[" + moveInfo.MoveType + "][" + moveInfo.MoveStep + "]未抓起料盘,请取走料盘后复位[" + FormUtil.GetSpanStr(span) + "]";
type = MoveInfo.GetStepDes() + "_" + "未抓起料";
}
//LogUtil.error(WarnMsg, DeviceID * 1000 + 15, second);
SetWarnMsg(msg, type, moveInfo, second);
Alarm(LineAlarmType.IoSingleTimeOut);
CheckAlarmProcess(moveInfo, LineAlarmType.IoSingleTimeOut);
}
}
catch (Exception ex)
{
LogUtil.error(moveInfo.Name + " [" + moveInfo.MoveStep + "] CheckWait 出错:", ex);
}
}
private bool IsLowAlarm(LineMoveInfo moveInfo)
{
//托盘卡的信号不报警,只提示
// [_进仓_14-SMove] [CheckFixture] [MO_17_Stop2Check] 等待[X462 - 进仓14阻挡2托盘检测 - StopCylinder_Check2 = LOW] 超时[181.7]秒
if (moveInfo.MoveType.Equals(LineMoveType.Fixture) &&
(moveInfo.IsStep(LineMoveStep.MIO_00_Stop1Down) ||
moveInfo.IsStep(LineMoveStep.MIO_02_TrayCheck) ||
moveInfo.IsStep(LineMoveStep.MO_17_Stop2Check)))
{
return true;
}
return false;
}
protected virtual bool CheckWaitResult(LineMoveInfo moveInfo, WaitResultInfo wait)
{
return false;
}
#endregion
protected void CheckLog(string msg)
{
LogUtil.debug(Name + "" + msg);
}
protected void InLog(string msg)
{
string posId = MoveInfo.MoveParam != null ? "[" + currTrayNum + "][" + MoveInfo.MoveParam.PosId + "][" + MoveInfo.MoveParam.WareCode + "]" : "";
//baseConfig.DType.Equals(DeviceType.HYEquip)
if (baseConfig.DType.Equals(DeviceType.MoveEquip))
{
LogUtil.debug(Name + " " + posId + msg);
}
else
{
LogUtil.info(Name + " " + posId + msg);
}
}
/// <summary>
///
/// </summary>
/// <param name="msg"></param>
/// <param name="levle">-1是默认值,0时打印debug,1打印info</param>
protected void OutLog(string msg, int levle = -1)
{
string posId = MoveInfo.MoveParam != null ? "[" + currTrayNum + "][" + MoveInfo.MoveParam.PosId + "][" + MoveInfo.MoveParam.WareCode + "]" : "";
if (levle.Equals(-1) && baseConfig.DType.Equals(DeviceType.MoveEquip))
{
levle = 0;
}
if (baseConfig.DType.Equals(DeviceType.FeedingEquip))
{
levle = 1;
}
List<int> jHy = new List<int>() { 210, 212 };
if (jHy.Contains(DeviceID))
{
//三个接驳台打印日志
levle = 1;
}
if (levle.Equals(1))
{
LogUtil.info(Name + " " + posId + msg);
}
else if (levle.Equals(0))
{
LogUtil.debug(Name + " " + posId + msg);
}
}
public virtual string GetMoveStr()
{
string msg = "";
int tLength = 15;
if (!String.IsNullOrEmpty(RFIDIP))
{
msg += "当前托盘:" + currTrayNum + " 上个托盘:" + preTrayNum + "\n";
}
msg += "runS: " + runStatus + "\n";
msg += "alarm: " + alarmType + " " + LastAlarmTime.ToLongTimeString() + "\n";
msg += "Move:" + MoveInfo.MoveType + " " + MoveInfo.SLog + "\n";
msg += "SMove:" + SecondMoveInfo.MoveType + " " + SecondMoveInfo.MoveStep + "\n";
return msg;
}
internal void MoveEndS()
{
runStatus = LineRunStatus.Runing;
MoveInfo.EndMove();
}
public string GetColorDes()
{
return
"橘色:复位中\r\n" +
"蓝色:正常待机中\r\n" +
"绿色:忙碌中\r\n" +
"珊瑚色:信号超时报警\r\n" +
"红色:严重报警\r\n";
}
public Color GetShowColor()
{
if (runStatus.Equals(LineRunStatus.Wait))
{
if (IsDebug)
{
return Color.LightGray;
}
else
{
return Color.White;
}
}
else if (alarmType.Equals(LineAlarmType.IoSingleTimeOut))
{
return Color.LightCoral;
}
else if (alarmType.Equals(LineAlarmType.None).Equals(false))
{
return Color.Red;
}
else if (runStatus.Equals(LineRunStatus.HomeMoving) || runStatus.Equals(LineRunStatus.Reset))
{
return Color.Orange;
}
else if (runStatus.Equals(LineRunStatus.Busy))
{
return Color.LimeGreen;
}
else if (runStatus.Equals(LineRunStatus.Runing))
{
return Color.LightBlue;
}
return Color.White;
}
}
}