using Aitex.Core.RT.Device; using Aitex.Core.RT.Routine; using Aitex.Sorter.Common; using athosRT.FSM; using athosRT.tool; using MECF.Framework.Common.Equipment; using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadPorts.LoadPortBase; using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadPorts.TDK; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace athosRT.Modules.LPs { class LoadFoupRoutine : ModuleRoutineBase, FSM.IRoutine { int _timeout = -1;//超时计数器 private LoadPortBaseDevice _device = null; public ModuleName _chamber { get; set; } public LoadFoupRoutine(ModuleName chamber) : base(chamber) { _chamber = chamber; _timeout = 30000; } public void Abort() { } public RState Monitor() { Runner.Run(LoadFoupStep.MapLoadFoup, MapLoadFoup, WaitLoadportMotion, _timeout) .End(LoadFoupStep.End, NullFun,500); return Runner.Status; } public RState Start(params object[] objs) { Reset(); _device = DEVICE.GetDevice(_chamber.ToString()); if (_device.DockState == FoupDockState.Docked) { return RState.Failed; } return Runner.Start(Module,"Start LoadFoup"); } protected bool MapLoadFoup() { string reason = string.Empty; //LogObject.Info(GetName.GetCurrentName(),"正在执行Map Load Foup"); return this._device.Load(out reason); } protected bool CheckMapLoadFoup() { string reason = string.Empty; //LogObject.Info(GetName.GetCurrentName(), "正在检查Map Load Foup"); return this._device.Load(out reason); } protected bool WaitLoadportMotion() { //LogObject.Info(GetName.GetCurrentName(), "正在等待LoadportMotion"); if (_device.CurrentState == LoadPortStateEnum.Error) return false; if (!_device.IsReady()) return false; //LogObject.Info(GetName.GetCurrentName(), "等待Load port Motion完毕"); return true; } enum LoadFoupStep { MapLoadFoup, WaitLoadportMotion, End } } }