UnloadRoutine.cs 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. using Aitex.Core.RT.Routine;
  2. using Aitex.Core.RT.SCCore;
  3. using Aitex.Core.Util;
  4. using MECF.Framework.Common.Equipment;
  5. using MECF.Framework.RT.Core.Equipments;
  6. using MECF.Framework.RT.ModuleLibrary.VceModules;
  7. using System;
  8. using System.Collections.Generic;
  9. using System.Linq;
  10. using System.Text;
  11. using System.Threading.Tasks;
  12. using Venus_Core;
  13. using Venus_RT.Devices.VCE;
  14. namespace Venus_RT.Modules.VCE
  15. {
  16. public class UnloadRoutine : ModuleRoutineBase, IRoutine
  17. {
  18. public enum UnloadStep
  19. {
  20. Vent,
  21. GotoUnload,
  22. OpenOutDoor,
  23. NotifyOver
  24. }
  25. VceModuleBase _vce;
  26. int _timeout;
  27. public UnloadRoutine(ModuleName module,VceModuleBase vce) : base(module)
  28. {
  29. _vce = vce;
  30. }
  31. public RState Start(params object[] objs)
  32. {
  33. _timeout = SC.GetValue<int>($"{Module}.MotionTimeout");
  34. Reset();
  35. return Runner.Start(Module,"VCE Unload Routine");
  36. }
  37. public RState Monitor()
  38. {
  39. Runner.Run(UnloadStep.Vent, Vent, CheckVentOver)
  40. .Run(UnloadStep.GotoUnload, GotoUnload, CheckVceIdle, _timeout)
  41. .Run(UnloadStep.OpenOutDoor, OpenOutDoor, CheckVceIdle, _timeout)
  42. .End(UnloadStep.NotifyOver, NullFun, 100);
  43. return Runner.Status;
  44. }
  45. private bool CheckVentOver()
  46. {
  47. return true;
  48. }
  49. private bool Vent()
  50. {
  51. return true;
  52. }
  53. private bool OpenOutDoor()
  54. {
  55. return _vce.OpenDoor();
  56. }
  57. private bool GotoUnload()
  58. {
  59. return _vce.GotoLP();
  60. }
  61. private bool CheckVceIdle()
  62. {
  63. if (_vce.Status == RState.Failed || _vce.Status == RState.Timeout)
  64. {
  65. Singleton<RouteManager>.Instance.GetVCE(Module).PostMsg(VceMSG.Error);
  66. return false;
  67. }
  68. return _vce.Status == RState.End;
  69. }
  70. public void Abort()
  71. {
  72. }
  73. }
  74. }