using System; using Aitex.Core.RT.DataCenter; using Aitex.Core.RT.Routine; using Aitex.Core.RT.SCCore; using JetVirgoPM.Devices; using MECF.Framework.Common.Routine; using MECF.Framework.Common.Schedulers; using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.PMs; using MECF.Framework.RT.ModuleLibrary.SystemModules; namespace JetVirgoPM.PMs.Routines { class PMPostTransferRoutine : PMRoutineBase, IStepRoutine { enum RoutineStep { PumpDown, SetLiftPin, WaitNotExtendToPMON, SetSlitDoor, SlitDoorDelay, kEnd } private int _timeout; private EnumDualPM _pos; public PMPostTransferRoutine(JetDualPM chamber) : base(chamber) { Name = "PostTransfer"; } public RState Init(EnumTransferType type, int[] slot) { _pos = (slot.Length > 1) ? EnumDualPM.Both : (slot[0] == 0) ? EnumDualPM.Left : EnumDualPM.Right; if (SC.IsDoubleFork) _pos = EnumDualPM.Both; return RState.End; } public RState Start(params object[] objs) { Reset(); _timeout = SC.GetValue($"{Module}.PrepareTransferTimeout"); return Runner.Start(_chamber.Module.ToString(), Name); } public RState Monitor() { //只在TMCycle中降pin,其余在Recipe中控制 if (DATA.Poll("Rt", "Status").ToString() == RtState.TMCycling.ToString()) { Runner.Run(RoutineStep.SetLiftPin, HOFs.Apply(SetLiftPinUpDown, _pos, false), HOFs.Apply(ChecktLiftPinUpDown, _pos, false)) .Run(RoutineStep.WaitNotExtendToPMON, WaitNotExtendToPMON, CheckWaitNotExtendToPMON, _timeout * 1000) .Run(RoutineStep.SetSlitDoor, HOFs.Apply(SetSlitDoor, _pos, false), HOFs.Apply(CheckSlitDoor, _pos, false), _timeout * 1000) .End(RoutineStep.kEnd, EndFunc, _delay_0s); } else { Runner.Run(RoutineStep.WaitNotExtendToPMON, WaitNotExtendToPMON, CheckWaitNotExtendToPMON, _timeout * 1000) .Run(RoutineStep.SetSlitDoor, HOFs.Apply(SetSlitDoor, _pos, false), HOFs.Apply(CheckSlitDoor, _pos, false), _timeout * 1000) .End(RoutineStep.kEnd, EndFunc, _delay_0s); } return Runner.Status; } public override void Abort() { } bool WaitNotExtendToPMON() { Func notifyFunc = () => { Notify($"等待 Not Extend To PM 信号ON"); return true; }; return ((_pos != EnumDualPM.Left || _chamber.IsTMRobotNotExtendToPM1) || notifyFunc()) && ((_pos != EnumDualPM.Right || _chamber.IsTMRobotNotExtendToPM2) || notifyFunc()); } private bool CheckWaitNotExtendToPMON() { return ((_pos != EnumDualPM.Left) || _chamber.IsTMRobotNotExtendToPM1) && ((_pos != EnumDualPM.Right) || _chamber.IsTMRobotNotExtendToPM2); } } }