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(device, out result)) { return false; } if (!Check(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(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(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(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(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(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.Instance.IsError) { result = "INTERNAL/UNDEFINITION"; } return true; } } }