InitTask.cs 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. using Aitex.Core.RT.Device;
  2. using Aitex.Core.Util;
  3. using athosRT.Devices.EFEM.ABS;
  4. using athosRT.Modules.EFEMs;
  5. using MECF.Framework.Common.Equipment;
  6. using System;
  7. using System.Collections.Generic;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11. namespace athosRT.Devices.EFEM.Task
  12. {
  13. public class InitTask : CheckImp, ITask
  14. {
  15. public bool Execute(out string result, params string[] args)
  16. {
  17. string str = args.Length != 0 ? Args2Unit(args[0]) : "System";
  18. IServerModule entity = GetEntity(str);
  19. if (entity == null)
  20. {
  21. result = "PARAM_NG";
  22. return false;
  23. }
  24. if (!Check<InitNoReadyPolicy>(str, out result)
  25. || !Check<InitBusyPolicy>(str, out result)
  26. || !Check<HoldPolicy>(str, out result)
  27. || !Check<RemovePolicy>(str, out result)
  28. || !Check<MaintenancePolicy>(str, out result)
  29. || !Check<LinkPolicy>(str, out result))
  30. //以上条件有一条不符合都不执行
  31. return false;
  32. if (str == "System")
  33. {
  34. GetEntity("Robot").Initialized = false;
  35. for (int index = 0;index < LoadPortQuantity;++index)
  36. {
  37. GetEntity(string.Format($"LP{index + 1}")).Initialized = false;
  38. }
  39. if (AlignerInstalled)
  40. {
  41. GetEntity("Aligner").Initialized = false;
  42. }
  43. }
  44. entity.Initialized = false;
  45. return entity.Init(out result);
  46. }
  47. public bool? Monitor(out string result, params string[] args)
  48. {
  49. result = string.Empty;
  50. string str = Args2Unit(args.Length != 0 ? args[0] : string.Empty);
  51. if (string.IsNullOrEmpty(str))
  52. str = "System";
  53. IServerModule entity = GetEntity(str);
  54. if (entity.Error)
  55. {
  56. flag1 = ErrorCheckList1.VAC | ErrorCheckList1.AIR | ErrorCheckList1.STALL | ErrorCheckList1.LIMIT | ErrorCheckList1.SENSOR | ErrorCheckList1.POSITION | ErrorCheckList1.EMS | ErrorCheckList1.COMM | ErrorCheckList1.COMM2 | ErrorCheckList1.VACON | ErrorCheckList1.VACOFF | ErrorCheckList1.CLAMPON | ErrorCheckList1.CLAMPOF;
  57. flag2 = ErrorCheckList2.RRTWAF | ErrorCheckList2.CRSWAF | ErrorCheckList2.THICKWAF | ErrorCheckList2.THINWAF | ErrorCheckList2.DBLWAF | ErrorCheckList2.BAOWAF | ErrorCheckList2.COMMAND | ErrorCheckList2.PODNG | ErrorCheckList2.PODMISMATCH | ErrorCheckList2.VAC_S | ErrorCheckList2.CLAMP_S | ErrorCheckList2.SAFTY | ErrorCheckList2.LOCKNG | ErrorCheckList2.UNLOCKNG | ErrorCheckList2.L_KEY_LK | ErrorCheckList2.L_KEY_UL;
  58. flag3 = ErrorCheckList3.MAP_S | ErrorCheckList3.MAP_S1 | ErrorCheckList3.MAP_S2 | ErrorCheckList3.WAFLOST | ErrorCheckList3.ALIGNNG | ErrorCheckList3.DRIVER | ErrorCheckList3.DRPOWERDOWN | ErrorCheckList3.HARDWARE | ErrorCheckList3.INTERNAL | ErrorCheckList3.E84_TIMEOUTx | ErrorCheckList3.E84_CS_VALID | ErrorCheckList3.READFAIL;
  59. return new bool?(CheckError(str, out result));
  60. }
  61. if (entity.Busy)
  62. return new bool?();
  63. if (str == "System")
  64. {
  65. GetEntity("Robot").Initialized = true;
  66. GetEntity("System").Initialized = true;
  67. GetEntity("Robot").OriginSearched = true;
  68. GetEntity("System").OriginSearched = true;
  69. for (int i = 0; i < LoadPortQuantity; i++)
  70. {
  71. GetEntity(string.Format($"LP{i+1}")).Initialized = true;
  72. GetEntity(string.Format($"LP{i+1}")).OriginSearched = true;
  73. Singleton<EfemEntity>.Instance.SendSigStatEvent(ModuleHelper.Converter(string.Format($"LP{i+1}")));
  74. }
  75. if (AlignerInstalled)
  76. {
  77. GetEntity("Aligner1").Initialized = true;
  78. GetEntity("Aligner1").OriginSearched = true;
  79. GetEntity("Aligner2").Initialized = true;
  80. GetEntity("Aligner2").OriginSearched = true;
  81. GetEntity("CoolingBuffer1").Initialized = true;
  82. GetEntity("CoolingBuffer1").OriginSearched = true;
  83. GetEntity("CoolingBuffer2").Initialized = true;
  84. GetEntity("CoolingBuffer2").OriginSearched = true;
  85. }
  86. if (CoolingBufferInstalled)
  87. {
  88. GetEntity("Aligner1").Initialized = true;
  89. GetEntity("Aligner1").OriginSearched = true;
  90. GetEntity("Aligner2").Initialized = true;
  91. GetEntity("Aligner2").OriginSearched = true;
  92. GetEntity("CoolingBuffer1").Initialized = true;
  93. GetEntity("CoolingBuffer1").OriginSearched = true;
  94. GetEntity("CoolingBuffer2").Initialized = true;
  95. GetEntity("CoolingBuffer2").OriginSearched = true;
  96. }
  97. Singleton<EfemEntity>.Instance.SetInitialize(ModuleName.System,true);
  98. Singleton<EfemEntity>.Instance.SetInitialize(ModuleName.LP1,true);
  99. Singleton<EfemEntity>.Instance.SetInitialize(ModuleName.LP2,true);
  100. Singleton<EfemEntity>.Instance.SetInitialize(ModuleName.Robot,true);
  101. Singleton<EfemEntity>.Instance.SetInitialize(ModuleName.Aligner1,true);
  102. Singleton<EfemEntity>.Instance.SetInitialize(ModuleName.Aligner2, true);
  103. Singleton<EfemEntity>.Instance.SetInitialize(ModuleName.CoolingBuffer1,true);
  104. Singleton<EfemEntity>.Instance.SetInitialize(ModuleName.CoolingBuffer2,true);
  105. Singleton<EfemEntity>.Instance.SendSigStatEvent(ModuleHelper.Converter(str));
  106. if (Singleton<DeviceDefineManager>.Instance.GetValue<bool>("LLDoorControlByStation").GetValueOrDefault())
  107. Singleton<EfemEntity>.Instance.SendSigStatEvent(ModuleName.LL1);
  108. return new bool?(true);
  109. }
  110. //debug
  111. entity.Initialized = true;
  112. if (ModuleHelper.IsLoadPort(ModuleHelper.Converter(str)))
  113. Singleton<EfemEntity>.Instance.SendSigStatEvent(ModuleHelper.Converter(str));
  114. return new bool?(true);
  115. }
  116. }
  117. }