LightTask.cs 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. using System;
  2. using Aitex.Core.RT.Device;
  3. using Aitex.Sorter.Common;
  4. using Efem;
  5. using Efem.Protocol;
  6. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadPorts;
  7. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadPorts.LoadPortBase;
  8. namespace EFEM.RT.Tasks
  9. {
  10. public class SetLightTask : CheckImp, ITask
  11. {
  12. public SetLightTask()
  13. {
  14. }
  15. public bool Execute(out string result, params string[] args)
  16. {
  17. string device = Args2Unit(args.Length > 0 ?args[0]:string.Empty);
  18. IServerModule entity = GetEntity(device);
  19. if (entity == null || !(entity is LoadPortServerModule))
  20. {
  21. result = PARAM_NG;
  22. return false;
  23. }
  24. if (!Check<NoReadyPolicy>(device, out result))
  25. {
  26. return false;
  27. }
  28. if (!Check<NoInitCompletedPolicy>(device, out result))
  29. {
  30. return false;
  31. }
  32. if (!Check<NoOriginCompletedPolicy>(device, out result))
  33. {
  34. return false;
  35. }
  36. if (!Check<AirPolicy>(device, out result))
  37. {
  38. return false;
  39. }
  40. if (!Check<EMSPolicy>(device, out result))
  41. {
  42. return false;
  43. }
  44. if (!Check<ErrorPolicy>(device, out result))
  45. {
  46. return false;
  47. }
  48. if (!Check<BusyPolicy>(device, out result))
  49. {
  50. return false;
  51. }
  52. if (!Check<HoldPolicy>(device, out result))
  53. {
  54. return false;
  55. }
  56. if (!Check<RemovePolicy>(device, out result))
  57. {
  58. return false;
  59. }
  60. if (!Check<LinkPolicy>(device, out result))
  61. {
  62. return false;
  63. }
  64. if (!Check<ArmExtendPolicy>(device, out result))
  65. {
  66. return false;
  67. }
  68. if (!Check<PowerDownPolicy>(device, out result))
  69. {
  70. return false;
  71. }
  72. if (!Check<NoPodPolicy>(device, out result))
  73. {
  74. return false;
  75. }
  76. //LoadPort _device = DEVICE.GetDevice<LoadPort>(device);
  77. //_device.Clamp(out result);
  78. return true;
  79. }
  80. public bool? Monitor(out string result, params string[] args)
  81. {
  82. result = string.Empty;
  83. string device = Args2Unit(args.Length > 0 ?args[0]:string.Empty);
  84. LoadPortBaseDevice _device = DEVICE.GetDevice<LoadPortBaseDevice>(device);
  85. if (_device.IsError)
  86. {
  87. flag1 = ErrorCheckList1.VAC | ErrorCheckList1.AIR | ErrorCheckList1.STALL
  88. | ErrorCheckList1.LIMIT | ErrorCheckList1.SENSOR | ErrorCheckList1.POSITION | ErrorCheckList1.EMS
  89. | ErrorCheckList1.COMM | ErrorCheckList1.COMM2 | ErrorCheckList1.VACON | ErrorCheckList1.VACOFF
  90. | ErrorCheckList1.CLAMPON | ErrorCheckList1.CLAMPOF;
  91. flag2 = ErrorCheckList2.RRTWAF | ErrorCheckList2.CRSWAF | ErrorCheckList2.THICKWAF | ErrorCheckList2.THINWAF
  92. | ErrorCheckList2.DBLWAF | ErrorCheckList2.BAOWAF | ErrorCheckList2.COMMAND | ErrorCheckList2.PODNG
  93. | ErrorCheckList2.PODMISMATCH | ErrorCheckList2.VAC_S | ErrorCheckList2.CLAMP_S | ErrorCheckList2.SAFTY
  94. | ErrorCheckList2.LOCKNG | ErrorCheckList2.UNLOCKNG | ErrorCheckList2.L_KEY_LK | ErrorCheckList2.L_KEY_UL;
  95. flag3 = ErrorCheckList3.MAP_S | ErrorCheckList3.MAP_S1 | ErrorCheckList3.MAP_S2 | ErrorCheckList3.WAFLOST
  96. | ErrorCheckList3.ALIGNNG
  97. | ErrorCheckList3.DRIVER | ErrorCheckList3.DRPOWERDOWN | ErrorCheckList3.HARDWARE
  98. | ErrorCheckList3.INTERNAL | ErrorCheckList3.E84_TIMEOUTx | ErrorCheckList3.E84_CS_VALID | ErrorCheckList3.READFAIL;
  99. return CheckError(device, out result);
  100. }
  101. if (!_device.IsBusy && _device.ClampState == FoupClampState.Close)
  102. return true;
  103. return null;
  104. }
  105. }
  106. public class QueryLightTask : CheckImp, ITask
  107. {
  108. public QueryLightTask()
  109. {
  110. }
  111. public bool Execute(out string result, params string[] args)
  112. {
  113. string device = DeviceName.System;
  114. EfemEventType type;
  115. if (!Enum.TryParse(args[0], out type))
  116. {
  117. result = PARAM_NG;
  118. return false;
  119. }
  120. EfemEventValue value;
  121. if (!Enum.TryParse(args[1], out value))
  122. {
  123. result = PARAM_NG;
  124. return false;
  125. }
  126. if (!Check<NoReadyPolicy>(device, out result))
  127. {
  128. return false;
  129. }
  130. return true;
  131. }
  132. public bool? Monitor(out string result, params string[] args)
  133. {
  134. result = string.Empty;
  135. EfemEventType type;
  136. Enum.TryParse(args[0], out type);
  137. SystemServerModule entity = (SystemServerModule)GetEntity(DeviceName.System);
  138. if (entity.IsEventEnabled(type))
  139. result = string.Format("ON");
  140. else
  141. result = string.Format("OFF");
  142. return true;
  143. }
  144. }
  145. }