using System.Collections.Generic; using System.Linq; using Aitex.Core.RT.Device; using Aitex.Core.RT.Routine; using Aitex.Core.RT.SCCore; using Aitex.Core.Util; using MECF.Framework.Common.Equipment; using MECF.Framework.RT.ModuleLibrary.SystemModules; namespace EfemDualSchedulerLib { public class HomeAll:IRoutine { List> _lstModules = new List>(); List _homingModules = new List(); public HomeAll() { } public Result Start(params object[] objs) { _lstModules.Clear(); _lstModules.Add(new List() { EquipmentManager.Modules[ModuleName.EFEM] as IModuleDevice, EquipmentManager.Modules[ModuleName.TM] as IModuleDevice, }); var lstModules = new List() { EquipmentManager.Modules[ModuleName.PMA] as IModuleDevice, EquipmentManager.Modules[ModuleName.PMB] as IModuleDevice, EquipmentManager.Modules[ModuleName.LLA] as IModuleDevice, EquipmentManager.Modules[ModuleName.LLB] as IModuleDevice, EquipmentManager.Modules[ModuleName.Aligner1] as IModuleDevice, EquipmentManager.Modules[ModuleName.Aligner2] as IModuleDevice, EquipmentManager.Modules[ModuleName.Cooling1] as IModuleDevice, EquipmentManager.Modules[ModuleName.Cooling2] as IModuleDevice, EquipmentManager.Modules[ModuleName.LP1] as IModuleDevice, EquipmentManager.Modules[ModuleName.LP2] as IModuleDevice, EquipmentManager.Modules[ModuleName.LP3] as IModuleDevice, }; _lstModules.Add(lstModules); _homingModules.Clear(); return Result.RUN; } public bool GetIsInstalled(string ModuleName) { return SC.GetValue($"System.SetUp.{ModuleName}.IsInstalled"); } public Result Monitor( ) { if (_homingModules.Count == 0 && _lstModules.Count == 0) return Result.DONE; if (_homingModules.Count > 0) { if(_homingModules.Any(p=>p.IsError)) return Result.FAIL; foreach (var module in _homingModules) { if (module.IsError) return Result.FAIL; if (!module.IsReady) return Result.RUN; } _homingModules.Clear(); if (_lstModules.Count == 0) return Result.DONE; } if (_homingModules.Count == 0) { foreach (var moduleEntity in _lstModules[0]) { if(moduleEntity.Name!="TM" && moduleEntity.Name != "EFEM") { if (!GetIsInstalled(moduleEntity.Name)) { continue; } } if (!moduleEntity.Home(out string reason)) return Result.FAIL; _homingModules.Add(moduleEntity); } _lstModules.RemoveAt(0); } return Result.RUN; } public void Abort() { Clear(); } public void Clear() { _lstModules.Clear(); _homingModules.Clear(); } } }