12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- using Aitex.Core.RT.Device;
- 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.Text;
- using System.Threading.Tasks;
- using Venus_Core;
- using Venus_RT.Devices;
- using Venus_RT.Devices.VCE;
- using Venus_RT.Modules.TM;
- using Venus_RT.Modules.TM.VenusEntity;
- namespace Venus_RT.Modules.VCE
- {
- public class UnloadRoutine : ModuleRoutineBase, IRoutine
- {
- public enum UnloadStep
- {
- Vent,
- GotoUnload,
- OpenOutDoor,
- NotifyOver
- }
- VceModuleBase _vce;
- int _timeout;
- SEMFVentRoutine ventRoutine;
- public UnloadRoutine(ModuleName module,VceModuleBase vce) : base(module)
- {
- _vce = vce;
- ventRoutine = new SEMFVentRoutine(DEVICE.GetDevice<HongHuTM>("SETM"), module);
- }
- public RState Start(params object[] objs)
- {
- _timeout = SC.GetValue<int>($"{Module}.MotionTimeout") * 1000;
- Reset();
- return Runner.Start(Module,"VCE Unload Routine");
- }
- public RState Monitor()
- {
- Runner.Run(UnloadStep.Vent, Vent, CheckVentOver)
- .Run(UnloadStep.GotoUnload, GotoUnload, CheckVceIdle, _timeout)
- .Run(UnloadStep.OpenOutDoor, OpenOutDoor, CheckVceIdle, _timeout)
- .End(UnloadStep.NotifyOver, NullFun, 100);
- return Runner.Status;
- }
- private bool CheckVentOver()
- {
- RState ret = ventRoutine.Monitor();
- if (ret == RState.Failed || ret == RState.Timeout)
- {
- _vce.PostMsg(VceMSG.Error);
- }
- return ret == RState.End;
- }
- private bool Vent()
- {
- return ventRoutine.Start() == RState.Running;
- }
- private bool OpenOutDoor()
- {
- return _vce.OpenDoor();
- }
- private bool GotoUnload()
- {
- return _vce.GotoLP();
- }
- private bool CheckVceIdle()
- {
- if (_vce.Status == RState.Failed || _vce.Status == RState.Timeout)
- {
- Singleton<RouteManager>.Instance.GetVCE(Module).PostMsg(VceMSG.Error);
- return false;
- }
- return _vce.Status == RState.End;
- }
- public void Abort()
- {
- }
- }
- }
|