HomeAll.cs 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. using System.Collections.Generic;
  2. using System.Linq;
  3. using Aitex.Core.RT.Device;
  4. using Aitex.Core.RT.Routine;
  5. using Aitex.Core.RT.SCCore;
  6. using Aitex.Core.Util;
  7. using MECF.Framework.Common.Equipment;
  8. using MECF.Framework.RT.ModuleLibrary.SystemModules;
  9. namespace EfemDualSchedulerLib
  10. {
  11. public class HomeAll:IRoutine
  12. {
  13. List<List<IModuleDevice>> _lstModules = new List<List<IModuleDevice>>();
  14. List<IModuleDevice> _homingModules = new List<IModuleDevice>();
  15. public HomeAll()
  16. {
  17. }
  18. public Result Start(params object[] objs)
  19. {
  20. _lstModules.Clear();
  21. _lstModules.Add(new List<IModuleDevice>()
  22. {
  23. EquipmentManager.Modules[ModuleName.EFEM] as IModuleDevice,
  24. EquipmentManager.Modules[ModuleName.TM] as IModuleDevice,
  25. });
  26. var lstModules = new List<IModuleDevice>()
  27. {
  28. EquipmentManager.Modules[ModuleName.PMA] as IModuleDevice,
  29. EquipmentManager.Modules[ModuleName.PMB] as IModuleDevice,
  30. EquipmentManager.Modules[ModuleName.LLA] as IModuleDevice,
  31. EquipmentManager.Modules[ModuleName.LLB] as IModuleDevice,
  32. EquipmentManager.Modules[ModuleName.Aligner1] as IModuleDevice,
  33. EquipmentManager.Modules[ModuleName.Aligner2] as IModuleDevice,
  34. EquipmentManager.Modules[ModuleName.Cooling1] as IModuleDevice,
  35. EquipmentManager.Modules[ModuleName.Cooling2] as IModuleDevice,
  36. EquipmentManager.Modules[ModuleName.LP1] as IModuleDevice,
  37. EquipmentManager.Modules[ModuleName.LP2] as IModuleDevice,
  38. EquipmentManager.Modules[ModuleName.LP3] as IModuleDevice,
  39. };
  40. _lstModules.Add(lstModules);
  41. _homingModules.Clear();
  42. return Result.RUN;
  43. }
  44. public bool GetIsInstalled(string ModuleName)
  45. {
  46. return SC.GetValue<bool>($"System.SetUp.{ModuleName}.IsInstalled");
  47. }
  48. public Result Monitor( )
  49. {
  50. if (_homingModules.Count == 0 && _lstModules.Count == 0)
  51. return Result.DONE;
  52. if (_homingModules.Count > 0)
  53. {
  54. if(_homingModules.Any(p=>p.IsError)) return Result.FAIL;
  55. foreach (var module in _homingModules)
  56. {
  57. if (module.IsError)
  58. return Result.FAIL;
  59. if (!module.IsReady)
  60. return Result.RUN;
  61. }
  62. _homingModules.Clear();
  63. if (_lstModules.Count == 0)
  64. return Result.DONE;
  65. }
  66. if (_homingModules.Count == 0)
  67. {
  68. foreach (var moduleEntity in _lstModules[0])
  69. {
  70. if(moduleEntity.Name!="TM" && moduleEntity.Name != "EFEM")
  71. {
  72. if (!GetIsInstalled(moduleEntity.Name))
  73. {
  74. continue;
  75. }
  76. }
  77. if (!moduleEntity.Home(out string reason))
  78. return Result.FAIL;
  79. _homingModules.Add(moduleEntity);
  80. }
  81. _lstModules.RemoveAt(0);
  82. }
  83. return Result.RUN;
  84. }
  85. public void Abort()
  86. {
  87. Clear();
  88. }
  89. public void Clear()
  90. {
  91. _lstModules.Clear();
  92. _homingModules.Clear();
  93. }
  94. }
  95. }