| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155 | 
							- using Aitex.Core.RT.Device;
 
- using Aitex.Core.RT.Log;
 
- using Aitex.Core.RT.OperationCenter;
 
- using Aitex.Core.RT.Routine;
 
- using Aitex.Core.RT.SCCore;
 
- using Aitex.Core.Util;
 
- using MECF.Framework.Common.Equipment;
 
- 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.SMIF;
 
- using Venus_RT.Devices.TM;
 
- using Venus_RT.Devices.VCE;
 
- using Venus_RT.Modules.TM.VenusEntity;
 
- namespace Venus_RT.Modules.VCE
 
- {
 
-     public class UnloadWithSMIFRoutine : ModuleRoutineBase, IRoutine
 
-     {
 
-         public enum UnloadWithSMIFStep
 
-         {
 
-             CloseDoor,
 
-             Vent,
 
-             GotoUnload,
 
-             OpenOutDoor,
 
-             SMIFUnload,
 
-             CloseOutDoor,
 
-             NotifyOver
 
-         }
 
-         VCEModuleBase _vce;
 
-         ISMIF _smif;
 
-         int _vcetimeout;
 
-         int _smiftimeout;
 
-         TMBase _tm;
 
-         SEMFVentRoutine ventRoutine;
 
-         public UnloadWithSMIFRoutine(ModuleName module,VCEModuleBase vce,ISMIF smif) : base(module)
 
-         {
 
-             _vce = vce;
 
-             _smif = smif;
 
-             switch (RtInstance.ConfigType)
 
-             {
 
-                 case ConfigType.VenusSE:
 
-                     _tm = DEVICE.GetDevice<HongHuTM>("TM");
 
-                     break;
 
-                 case ConfigType.VenusDE:
 
-                     _tm = DEVICE.GetDevice<HongHuDETM>("TM");
 
-                     break;
 
-             }
 
-             ventRoutine = new SEMFVentRoutine(_tm, module);
 
-         }
 
-         public RState Start(params object[] objs)
 
-         {
 
-             _vcetimeout = SC.GetValue<int>($"{Module}.MotionTimeout") * 1000;
 
-             _smiftimeout = SC.GetValue<int>($"{Module}.SMIF.MotionTimeout") * 1000;
 
-             Reset();
 
-             return Runner.Start(Module, $"{Module} Unload with SMIF");
 
-         }
 
-         public RState Monitor()
 
-         {
 
-             Runner.Run(UnloadWithSMIFStep.CloseDoor,        CloseDoor,          CheckDoorIsClose)
 
-                   .Run(UnloadWithSMIFStep.Vent,             Vent,               CheckVentOver)
 
-                   .Run(UnloadWithSMIFStep.GotoUnload,       GotoUnload,         CheckVceIdle,       _vcetimeout)
 
-                   .Run(UnloadWithSMIFStep.OpenOutDoor,      OpenOutDoor,        CheckVceIdle,       _vcetimeout)
 
-                   .Run(UnloadWithSMIFStep.SMIFUnload,       SMIFUnload,         CheckSMIFIdle,      _smiftimeout)
 
-                   .Run(UnloadWithSMIFStep.CloseOutDoor,     CloseOutDoor,       CheckVceIdle,       _vcetimeout)
 
-                   .End(UnloadWithSMIFStep.NotifyOver,       NullFun, 100);
 
-             return Runner.Status;
 
-         }
 
-         private bool CloseDoor()
 
-         {
 
-             OP.DoOperation("TM.SetSlitDoor", Module, false);
 
-             return true;
 
-         }
 
-         private bool CheckDoorIsClose()
 
-         {
 
-             return Singleton<RouteManager>.Instance.seTM.IsVCESlitDoorClosed(Module);
 
-         }
 
-         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 SMIFUnload()
 
-         {
 
-             _smif.Unload();
 
-             return true;
 
-         }
 
-         private bool CheckSMIFIdle()
 
-         {
 
-             return true;
 
-         }
 
-         private bool CloseOutDoor()
 
-         {
 
-             return _vce.CloseDoor();
 
-         }
 
-         private bool OpenOutDoor()
 
-         {
 
-             if (Singleton<RouteManager>.Instance.seTM.VCEIsATM(Module) && Singleton<RouteManager>.Instance.seTM.VCEPressure(Module) >= SC.GetValue<int>($"{Module}.OutDoorOpenPressure"))
 
-             {
 
-                 return _vce.OpenDoor();
 
-             }
 
-             else
 
-             {
 
-                 LOG.Write(eEvent.ERR_VCE_COMMON_Failed, Module, $"{Module} is not ATM or Pressure not arrive {SC.GetValue<int>($"{Module}.OutDoorOpenPressure")}");
 
-                 return false;
 
-             }
 
-         }
 
-         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()
 
-         {
 
-         }
 
-     }
 
- }
 
 
  |