LoadPortGetMapInfoRoutine.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. using System;
  2. using Aitex.Core.RT.Device;
  3. using Aitex.Core.RT.Routine;
  4. using Aitex.Core.RT.SCCore;
  5. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadPorts;
  6. namespace JetEfemLib.LPs
  7. {
  8. class LoadPortGetMapInfoRoutine : ModuleRoutineBase, IStepRoutine
  9. {
  10. enum RoutineStep
  11. {
  12. OpenDoor,
  13. GetWaferInfo,
  14. QueryStatus,
  15. End,
  16. }
  17. private int _timeout = 0;
  18. private LoadPortModule _lpModule;
  19. public LoadPortGetMapInfoRoutine(LoadPortModule lpModule) : base(lpModule.Module)
  20. {
  21. _lpModule = lpModule;
  22. Name = "MapDT";
  23. }
  24. public bool Initalize()
  25. {
  26. return true;
  27. }
  28. public RState Start(params object[] objs)
  29. {
  30. Reset();
  31. _timeout = SC.GetValue<int>("EFEM.LoadPort.MotionTimeout");
  32. return Runner.Start(_lpModule.Module, Name);
  33. }
  34. public RState Monitor()
  35. {
  36. Runner.Run(RoutineStep.GetWaferInfo, QueryMapInfo, CheckDevice, _timeout * 1000)
  37. .End(RoutineStep.QueryStatus, QueryStatus, CheckDevice, _timeout * 1000);
  38. return Runner.Status;
  39. }
  40. bool QueryMapInfo()
  41. {
  42. if (!_lpModule.LPDevice.GetMapInfo(out string reason))
  43. {
  44. Stop(reason);
  45. return false;
  46. }
  47. return true;
  48. }
  49. bool CheckDevice()
  50. {
  51. return !(_lpModule.LPDevice.Error || _lpModule.LPDevice.IsBusy);
  52. }
  53. bool QueryStatus()
  54. {
  55. if (!_lpModule.LPDevice.QueryState(out string reason))
  56. {
  57. Stop(reason);
  58. return false;
  59. }
  60. return true;
  61. }
  62. public void Abort()
  63. {
  64. }
  65. }
  66. }