12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- 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.RT.Core.Equipments;
- using MECF.Framework.RT.ModuleLibrary.VceModules;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Reflection;
- using System.Text;
- using System.Threading.Tasks;
- using Venus_Core;
- using Venus_RT.Devices;
- using Venus_RT.Modules.TM.VenusEntity;
- namespace Venus_RT.Modules.VCE
- {
- public class LoadPrepareRoutine : ModuleRoutineBase, IRoutine
- {
- private enum LoadPrepareStep
- {
- VceGotoLP,
- VceOuterDoorOpen,
- NotifyDone
- }
-
- private VceModuleBase _vce;//动作驱动
- private int _vcetimeout;
- public LoadPrepareRoutine(ModuleName module, VceModuleBase vce) : base(module)
- {
- Module = module;
- _vce = vce;
- }
- public RState Start(params object[] objs)
- {
- //如果不是ATM 不允许执行
- if (!Singleton<RouteManager>.Instance.seTM.VCEIsATM)
- {
- LOG.Write(eEvent.ERR_VCE_COMMON_Failed, Module, $"VCE is not atm cannot load prepare! Please Vent it First!");
- return RState.Failed;
- }
-
- _vcetimeout = SC.GetValue<int>($"{Module}.MotionTimeout") * 1000;
- Reset();
- return Runner.Start(Module, $"Load Prepare");
- }
- public RState Monitor()
- {
- Runner.Run(LoadPrepareStep.VceGotoLP, VceGotoLP, CheckVceStageDownDone , _vcetimeout)
- .Run(LoadPrepareStep.VceOuterDoorOpen, VceOuterDoorOpen, CheckVceOuterDoorOpenDone, _vcetimeout)
- .End(LoadPrepareStep.NotifyDone, NullFun, 100);
- return Runner.Status;
- }
- private bool CheckVceStageDownDone()
- {
- if (_vce.Status == RState.Timeout || _vce.Status == RState.Failed)
- {
- LOG.Write(eEvent.ERR_VCE_COMMON_Failed, Module, $"VCE Stage Down failed");
- }
- return _vce.Status == RState.End;
- }
- private bool CheckVceOuterDoorOpenDone()
- {
- if (_vce.Status == RState.Timeout || _vce.Status == RState.Failed)
- {
- LOG.Write(eEvent.ERR_VCE_COMMON_Failed, Module, $"VCE OuterDoor Open failed");
- }
- return _vce.Status == RState.End;
- }
- private bool VceGotoLP()
- {
- return _vce.GotoLP();
- }
- private bool VceOuterDoorOpen()
- {
- return _vce.OpenDoor();
- }
- public void Abort()
- {
- }
- }
- }
|