UnloadWithSMIFRoutine.cs 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. using Aitex.Core.RT.Device;
  2. using Aitex.Core.RT.OperationCenter;
  3. using Aitex.Core.RT.Routine;
  4. using Aitex.Core.RT.SCCore;
  5. using Aitex.Core.Util;
  6. using MECF.Framework.Common.Equipment;
  7. using MECF.Framework.RT.ModuleLibrary.VceModules;
  8. using System;
  9. using System.Collections.Generic;
  10. using System.Linq;
  11. using System.Text;
  12. using System.Threading.Tasks;
  13. using Venus_Core;
  14. using Venus_RT.Devices;
  15. using Venus_RT.Devices.SMIF;
  16. using Venus_RT.Modules.TM.VenusEntity;
  17. namespace Venus_RT.Modules.VCE
  18. {
  19. public class UnloadWithSMIFRoutine : ModuleRoutineBase, IRoutine
  20. {
  21. public enum UnloadWithSMIFStep
  22. {
  23. CloseDoor,
  24. Vent,
  25. GotoUnload,
  26. OpenOutDoor,
  27. SMIFUnload,
  28. CloseOutDoor,
  29. NotifyOver
  30. }
  31. VceModuleBase _vce;
  32. ISMIF _smif;
  33. int _vcetimeout;
  34. int _smiftimeout;
  35. SEMFVentRoutine ventRoutine;
  36. public UnloadWithSMIFRoutine(ModuleName module,VceModuleBase vce,ISMIF smif) : base(module)
  37. {
  38. _vce = vce;
  39. _smif = smif;
  40. ventRoutine = new SEMFVentRoutine(DEVICE.GetDevice<HongHuTM>("SETM"), module);
  41. }
  42. public RState Start(params object[] objs)
  43. {
  44. _vcetimeout = SC.GetValue<int>($"{Module}.MotionTimeout") * 1000;
  45. _smiftimeout = SC.GetValue<int>($"{Module}.SMIF.MotionTimeout") * 1000;
  46. Reset();
  47. return Runner.Start(Module, "VCE Unload with SMIF");
  48. }
  49. public RState Monitor()
  50. {
  51. Runner.Run(UnloadWithSMIFStep.CloseDoor, CloseDoor, CheckDoorIsClose)
  52. .Run(UnloadWithSMIFStep.Vent, Vent, CheckVentOver)
  53. .Run(UnloadWithSMIFStep.GotoUnload, GotoUnload, CheckVceIdle, _vcetimeout)
  54. .Run(UnloadWithSMIFStep.OpenOutDoor, OpenOutDoor, CheckVceIdle, _vcetimeout)
  55. .Run(UnloadWithSMIFStep.SMIFUnload, SMIFUnload, CheckSMIFIdle, _smiftimeout)
  56. .Run(UnloadWithSMIFStep.CloseOutDoor, CloseOutDoor, CheckVceIdle, _vcetimeout)
  57. .End(UnloadWithSMIFStep.NotifyOver, NullFun, 100);
  58. return Runner.Status;
  59. }
  60. private bool CloseDoor()
  61. {
  62. OP.DoOperation("SETM.SetSlitDoor", ModuleName.VCE1, false);
  63. return true;
  64. }
  65. private bool CheckDoorIsClose()
  66. {
  67. return Singleton<RouteManager>.Instance.seTM.IsVCESlitDoorClosed;
  68. }
  69. private bool CheckVentOver()
  70. {
  71. RState ret = ventRoutine.Monitor();
  72. if (ret == RState.Failed || ret == RState.Timeout)
  73. {
  74. _vce.PostMsg(VceMSG.Error);
  75. }
  76. return ret == RState.End;
  77. }
  78. private bool Vent()
  79. {
  80. return ventRoutine.Start() == RState.Running;
  81. }
  82. private bool SMIFUnload()
  83. {
  84. _smif.Unload();
  85. return true;
  86. }
  87. private bool CheckSMIFIdle()
  88. {
  89. return true;
  90. }
  91. private bool CloseOutDoor()
  92. {
  93. return _vce.CloseDoor();
  94. }
  95. private bool OpenOutDoor()
  96. {
  97. return _vce.OpenDoor();
  98. }
  99. private bool GotoUnload()
  100. {
  101. return _vce.GotoLP();
  102. }
  103. private bool CheckVceIdle()
  104. {
  105. if (_vce.Status == RState.Failed || _vce.Status == RState.Timeout)
  106. {
  107. Singleton<RouteManager>.Instance.GetVCE(Module).PostMsg(VceMSG.Error);
  108. return false;
  109. }
  110. return _vce.Status == RState.End;
  111. }
  112. public void Abort()
  113. {
  114. }
  115. }
  116. }