using Aitex.Core.RT.Device; using Aitex.Core.RT.Log; using Aitex.Core.RT.Routine; using Aitex.Core.RT.SCCore; using Aitex.Core.Util; using MECF.Framework.Common.Equipment; using MECF.Framework.Common.RecipeCenter; using MECF.Framework.Common.Routine; using MECF.Framework.Common.SubstrateTrackings; using PunkHPX8_Core; using PunkHPX8_RT.Devices.AXIS; using PunkHPX8_RT.Devices.VpwCell; using PunkHPX8_RT.Devices.VpwMain; using PunkHPX8_RT.Modules.VpwMain; using PunkHPX8_RT.Schedulers; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace PunkHPX8_RT.Modules.VpwCell { public class VpwChamberDownRoutine : RoutineBase, IRoutine { private enum PrepareStep { CheckPreCondition, ChamerDown, Delay, End } #region 内部变量 /// /// Main设备 /// private VpwMainDevice _mainDevice; #endregion /// /// 构造函数 /// /// public VpwChamberDownRoutine(string module) : base(module) { } /// /// 中止 /// public void Abort() { Runner.Stop("Manual abort"); } /// /// 监控 /// /// public RState Monitor() { Runner.Run(PrepareStep.CheckPreCondition, CheckPreCondition, _delay_1ms) .Run(PrepareStep.ChamerDown, ChamberDown, CheckChamberOpend,_delay_10s) .End(PrepareStep.End,NullFun,_delay_1ms); return Runner.Status; } /// /// 打开 Chamber /// /// private bool ChamberDown() { return _mainDevice.ChamberDown(); } /// /// 检验Chamber是否打开 /// /// private bool CheckChamberOpend() { return _mainDevice.CommonData.ChamberOpened && !_mainDevice.CommonData.ChamberClosed; } /// /// 检验前置条件 /// /// private bool CheckPreCondition() { string matcher = ModuleMatcherManager.Instance.GetMatcherByModule(Module); VpwCellEntity vpwCellEntity = Singleton.Instance.GetModule(matcher); if (vpwCellEntity == null) { return true; } if (vpwCellEntity.IsDisable) { return true; } if (!vpwCellEntity.IsAuto) { return true; } bool result = vpwCellEntity.IsIdle; if (!result) { NotifyError(eEvent.ERR_PLATINGCELL, $"{vpwCellEntity.Module} is not idle,cannot chamber up", 0); } return result; } /// /// 启动 /// /// /// public RState Start(params object[] objs) { _mainDevice = DEVICE.GetDevice(ModuleName.VPWMain1.ToString()); return Runner.Start(Module, $"{Module} chamber down"); } } }