LoadPrepareRoutine.cs 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. using Aitex.Core.RT.Device;
  2. using Aitex.Core.RT.Log;
  3. using Aitex.Core.RT.Routine;
  4. using Aitex.Core.Util;
  5. using MECF.Framework.Common.Equipment;
  6. using MECF.Framework.RT.ModuleLibrary.VceModules;
  7. using System;
  8. using System.Collections.Generic;
  9. using System.Linq;
  10. using System.Reflection;
  11. using System.Text;
  12. using System.Threading.Tasks;
  13. using Venus_Core;
  14. using Venus_RT.Devices;
  15. using Venus_RT.Modules.TM.VenusEntity;
  16. namespace Venus_RT.Modules.VCE
  17. {
  18. public class LoadPrepareRoutine : ModuleRoutineBase, IRoutine
  19. {
  20. private enum LoadPrepareStep
  21. {
  22. VceGotoLP,
  23. VceOuterDoorOpen,
  24. NotifyDone
  25. }
  26. private VceModuleBase _vce;//动作驱动
  27. public LoadPrepareRoutine(ModuleName module, VceModuleBase vce) : base(module)
  28. {
  29. Module = module;
  30. _vce = vce;
  31. }
  32. public RState Start(params object[] objs)
  33. {
  34. //如果不是ATM 不允许执行
  35. //if (!Singleton<RouteManager>.Instance.seTM.VCEIsATM)
  36. //{
  37. // LOG.Write(eEvent.ERR_VCE_COMMON_Failed, Module, $"VCE is not atm cannot load prepare! Please Vent it First!");
  38. // return RState.Failed;
  39. //}
  40. Reset();
  41. return Runner.Start(Module, $"Load Prepare");
  42. }
  43. public RState Monitor()
  44. {
  45. Runner.Run(LoadPrepareStep.VceGotoLP, VceGotoLP, CheckVceStageDownDone)
  46. .Run(LoadPrepareStep.VceOuterDoorOpen, VceOuterDoorOpen, CheckVceOuterDoorOpenDone)
  47. .End(LoadPrepareStep.NotifyDone, NullFun, 100);
  48. return Runner.Status;
  49. }
  50. private bool CheckVceStageDownDone()
  51. {
  52. if (_vce.Status == RState.Timeout || _vce.Status == RState.Failed)
  53. {
  54. LOG.Write(eEvent.ERR_VCE_COMMON_Failed, Module, $"VCE Stage Down failed");
  55. }
  56. return _vce.Status == RState.End;
  57. }
  58. private bool CheckVceOuterDoorOpenDone()
  59. {
  60. if (_vce.Status == RState.Timeout || _vce.Status == RState.Failed)
  61. {
  62. LOG.Write(eEvent.ERR_VCE_COMMON_Failed, Module, $"VCE OuterDoor Open failed");
  63. }
  64. return _vce.Status == RState.End;
  65. }
  66. private bool VceGotoLP()
  67. {
  68. return _vce.GotoLP();
  69. }
  70. private bool VceOuterDoorOpen()
  71. {
  72. return _vce.OpenDoor();
  73. }
  74. public void Abort()
  75. {
  76. }
  77. }
  78. }