LoadPrepareRoutine.cs 2.3 KB

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