using Aitex.Core.RT.Routine; using MECF.Framework.Common.RecipeCenter; using MECF.Framework.Common.Routine; using MECF.Framework.Common.Utilities; using PunkHPX8_Core; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace PunkHPX8_RT.Modules.VpwCell { public class VpwManualRecipeRoutine : RoutineBase, IRoutine { private enum RecipeStep { Prepare, WaitPrepare, VacuumPrewet, WaitVacuumPrewet, End } #region 内部变量 /// /// 手动Prepare routine /// private VpwManualPrepareRoutine _manualPrepareRoutine; /// /// Vacuum prewet routine /// private VpwVacuumPrewetRoutine _vacuumPrewetRoutine; /// /// recipe /// private VpwRecipe _recipe; #endregion /// /// 构造函数 /// /// public VpwManualRecipeRoutine(string module) : base(module) { _manualPrepareRoutine = new VpwManualPrepareRoutine(module); } /// /// 中止 /// public void Abort() { Runner.Stop("Manual stop"); } /// /// 监控 /// /// public RState Monitor() { Runner.Run(RecipeStep.Prepare, Prepare, _delay_1ms) .WaitWithStopCondition(RecipeStep.WaitPrepare, ()=>CommonFunction.CheckRoutineEndState(_manualPrepareRoutine), ()=>CommonFunction.CheckRoutineStopState(_manualPrepareRoutine)) .Run(RecipeStep.VacuumPrewet,VacuumPrewet) .WaitWithStopCondition(RecipeStep.WaitVacuumPrewet, () => CommonFunction.CheckRoutineEndState(_vacuumPrewetRoutine), () => CommonFunction.CheckRoutineStopState(_vacuumPrewetRoutine)) .End(RecipeStep.End, NullFun, _delay_1ms); return Runner.Status; } /// /// Prepare /// /// private bool Prepare() { return _manualPrepareRoutine.Start(_recipe) == RState.Running; } /// /// Vacuum Prewet /// /// private bool VacuumPrewet() { return _vacuumPrewetRoutine.Start(_recipe) == RState.Running; } /// /// 启动 /// /// /// public RState Start(params object[] objs) { _recipe = objs[0] as VpwRecipe; return Runner.Start(Module, "start run recipe"); } } }