HomeAll.cs 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. using System.Collections.Generic;
  2. using Aitex.Core.RT.Device;
  3. using Aitex.Core.RT.Routine;
  4. using Aitex.Core.Util;
  5. using MECF.Framework.Common.Equipment;
  6. using MECF.Framework.RT.ModuleLibrary.SystemModules;
  7. namespace EfemDualSchedulerLib
  8. {
  9. public class HomeAll:IRoutine
  10. {
  11. List<List<IModuleDevice>> _lstModules = new List<List<IModuleDevice>>();
  12. List<IModuleDevice> _homingModules = new List<IModuleDevice>();
  13. public HomeAll()
  14. {
  15. }
  16. public Result Start(params object[] objs)
  17. {
  18. _lstModules.Clear();
  19. _lstModules.Add(new List<IModuleDevice>()
  20. {
  21. EquipmentManager.Modules[ModuleName.EFEM] as IModuleDevice,
  22. EquipmentManager.Modules[ModuleName.TM] as IModuleDevice,
  23. });
  24. var lstModules = new List<IModuleDevice>()
  25. {
  26. EquipmentManager.Modules[ModuleName.PMA] as IModuleDevice,
  27. EquipmentManager.Modules[ModuleName.PMB] as IModuleDevice,
  28. EquipmentManager.Modules[ModuleName.Aligner] as IModuleDevice,
  29. EquipmentManager.Modules[ModuleName.LP1] as IModuleDevice,
  30. EquipmentManager.Modules[ModuleName.LP2] as IModuleDevice,
  31. EquipmentManager.Modules[ModuleName.LP3] as IModuleDevice,
  32. };
  33. _lstModules.Add(lstModules);
  34. _homingModules.Clear();
  35. return Result.RUN;
  36. }
  37. public Result Monitor( )
  38. {
  39. if (_homingModules.Count == 0 && _lstModules.Count == 0)
  40. return Result.DONE;
  41. if (_homingModules.Count > 0)
  42. {
  43. foreach (var module in _homingModules)
  44. {
  45. if (module.IsError)
  46. return Result.FAIL;
  47. if (!module.IsReady)
  48. return Result.RUN;
  49. }
  50. _homingModules.Clear();
  51. if (_lstModules.Count == 0)
  52. return Result.DONE;
  53. }
  54. if (_homingModules.Count == 0)
  55. {
  56. foreach (var moduleEntity in _lstModules[0])
  57. {
  58. if (!moduleEntity.Home(out string reason))
  59. return Result.FAIL;
  60. _homingModules.Add(moduleEntity);
  61. }
  62. _lstModules.RemoveAt(0);
  63. }
  64. return Result.RUN;
  65. }
  66. public void Abort()
  67. {
  68. Clear();
  69. }
  70. public void Clear()
  71. {
  72. _lstModules.Clear();
  73. _homingModules.Clear();
  74. }
  75. }
  76. }