123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185 |
- using Aitex.Core.RT.Device;
- using Aitex.Sorter.Common;
- using Efem;
- using Efem.Protocol;
- using System;
- using Aitex.Core.Util;
- using EFEM.RT.Modules;
- using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadPorts;
- using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadPorts.LoadPortBase;
- using System.Threading;
- using Aitex.Core.RT.Event;
- using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Aligners.AlignersBase;
- using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots.RobotBase;
- namespace EFEM.RT.Tasks
- {
- public class ClearErrorTask : CheckImp, ITask
- {
- public ClearErrorTask()
- {
- HasInfoMessage = false;
- }
- public bool Execute(out string result, params string[] args)
- {
- string device = DeviceName.System;
- EfemEventType type;
- if (!String.Equals(args[0], "CLEAR"))
- {
- result = PARAM_NG;
- return false;
- }
- if (!Check<NoReadyPolicy>(device, out result))
- {
- return false;
- }
- if (!Check<MaintenancePolicy>(device, out result))
- {
- return false;
- }
- if (args.Length == 1)
- {
- SystemServerModule entity = (SystemServerModule)GetEntity(device);
- entity.ClearError();
- }
- else if (args.Length > 1)
- {
- device = Args2Unit(args.Length > 0 ? args[1] : string.Empty);
- IServerModule entity = GetEntity(device);
- if (entity == null || !(entity is SystemServerModule || entity is RobotServerModule || entity is LoadPortServerModule || entity is AlignerServerModule))
- {
- result = PARAM_NG;
- return false;
- }
- if (!entity.Reset(out result))
- {
- return false;
- }
- switch (device)
- {
- case "Robot":
- {
- var rbt = DEVICE.GetDevice<RobotBaseDevice>(DeviceName.Robot);
- DateTime dt = DateTime.Now;
- while (true)
- {
- Thread.Sleep(1000);
- if (DateTime.Now - dt > TimeSpan.FromSeconds(60))
- {
- EV.PostAlarmLog("System", "Clear error time out than 60s.");
- return false;
- }
- if (rbt.IsBusy)
- continue;
- break;
- }
- }
- break;
- //case "Aligner":
- // {
- // var alg = DEVICE.GetDevice<AlignerBaseDevice>(DeviceName.Aligner);
- // DateTime dt = DateTime.Now;
- // while (true)
- // {
- // Thread.Sleep(1000);
- // if (DateTime.Now - dt > TimeSpan.FromSeconds(60))
- // {
- // EV.PostAlarmLog("System", "Clear error time out than 60s.");
- // return false;
- // }
- // if (alg.IsBusy)
- // continue;
- // break;
- // }
- // }
- // break;
- case "LP1":
- case "LP2":
- case "LP3":
- {
- var lp1 = DEVICE.GetDevice<LoadPortBaseDevice>(device);
- DateTime dt = DateTime.Now;
- while (true)
- {
- Thread.Sleep(1000);
- if (DateTime.Now - dt > TimeSpan.FromSeconds(60))
- {
- EV.PostAlarmLog("System", "Clear error time out than 60s.");
- return false;
- }
- if (lp1.IsBusy)
- continue;
- break;
- }
- }
- break;
- }
- }
- return true;
- }
- public bool? Monitor(out string result, params string[] args)
- {
- result = string.Empty;
- SystemServerModule entity = (SystemServerModule)GetEntity(DeviceName.System);
- string device = DeviceName.System;
- LoadPortBaseDevice _device = DEVICE.GetDevice<LoadPortBaseDevice>(device);
- if (_device!= null && _device.IsError)
- {
- flag3 = ErrorCheckList3.HARDWARE
- | ErrorCheckList3.INTERNAL;
- return CheckError(device, out result);
- }
- if (_device==null || !_device.IsBusy)
- return true;
- return null;
- }
- }
- public class QueryErrorTask : CheckImp, ITask
- {
- public QueryErrorTask()
- {
- }
- public bool Execute(out string result, params string[] args)
- {
- string device = DeviceName.System;
-
- if (!Check<NoReadyPolicy>(device, out result))
- {
- return false;
- }
- return true;
- }
- public bool? Monitor(out string result, params string[] args)
- {
- result = string.Empty;
- SystemServerModule entity = (SystemServerModule)GetEntity(DeviceName.System);
- string device = DeviceName.System;
- if (Singleton<RouteManager>.Instance.IsError)
- {
- result = "INTERNAL/UNDEFINITION";
- }
- return true;
- }
- }
- }
|