ReadIDTask.cs 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. using Aitex.Core.Util;
  2. using Aitex.Sorter.RT.EFEMs.Servers;
  3. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.CarrierIdReaders;
  4. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.CarrierIdReaders.OmronRFID;
  5. namespace Aitex.Sorter.RT.EFEMs.Tasks
  6. {
  7. public class ReadIDTask : CheckImp, ITask
  8. {
  9. public ReadIDTask()
  10. {
  11. }
  12. public bool Execute(out string result, params string[] args)
  13. {
  14. string device = Args2Unit(args[0]);
  15. IServerModule entity = GetEntity(device);
  16. if (entity == null || entity is LoadPortServerModule)
  17. {
  18. result = string.Format("PRAM_NG");
  19. return false;
  20. }
  21. if (!Check<NoReadyPolicy>(device, out result))
  22. {
  23. return false;
  24. }
  25. if (!Check<NoInitCompletedPolicy>(device, out result))
  26. {
  27. return false;
  28. }
  29. if (!Check<NoOriginCompletedPolicy>(device, out result))
  30. {
  31. return false;
  32. }
  33. if (!Check<AirPolicy>(device, out result))
  34. {
  35. return false;
  36. }
  37. if (!Check<EMSPolicy>(device, out result))
  38. {
  39. return false;
  40. }
  41. if (!Check<ErrorPolicy>(device, out result))
  42. {
  43. return false;
  44. }
  45. if (!Check<BusyPolicy>(device, out result))
  46. {
  47. return false;
  48. }
  49. if (!Check<HoldPolicy>(device, out result))
  50. {
  51. return false;
  52. }
  53. if (!Check<RemovePolicy>(device, out result))
  54. {
  55. return false;
  56. }
  57. if (!Check<MaintenancePolicy>(device, out result))
  58. {
  59. return false;
  60. }
  61. if (!Check<LinkPolicy>(device, out result))
  62. {
  63. return false;
  64. }
  65. if (!Check<ArmExtendPolicy>(device, out result))
  66. {
  67. return false;
  68. }
  69. if (!Check<PowerDownPolicy>(device, out result))
  70. {
  71. return false;
  72. }
  73. if (!Check<NoPodPolicy>(device, out result))
  74. {
  75. return false;
  76. }
  77. CarrierIdReader _device = Singleton<EfemEntity>.Instance.EfemDevice.GetRfidReader(device);
  78. if (_device == null)
  79. {
  80. result = PARAM_NG;
  81. return false;
  82. }
  83. _device.Read(out result);
  84. return true;
  85. }
  86. public bool? Monitor(out string result, params string[] args)
  87. {
  88. result = string.Empty;
  89. string device = Args2Unit(args.Length > 0 ?args[0]:string.Empty);
  90. OmronRfidReader _device = Singleton<EfemEntity>.Instance.EfemDevice.GetRfidReader(device);
  91. if (_device.Error)
  92. {
  93. flag1 = ErrorCheckList1.VAC | ErrorCheckList1.AIR | ErrorCheckList1.STALL
  94. | ErrorCheckList1.LIMIT | ErrorCheckList1.SENSOR | ErrorCheckList1.POSITION | ErrorCheckList1.EMS
  95. | ErrorCheckList1.COMM | ErrorCheckList1.COMM2 | ErrorCheckList1.VACON | ErrorCheckList1.VACOFF
  96. | ErrorCheckList1.CLAMPON | ErrorCheckList1.CLAMPOF;
  97. flag2 = ErrorCheckList2.RRTWAF | ErrorCheckList2.CRSWAF | ErrorCheckList2.THICKWAF | ErrorCheckList2.THINWAF
  98. | ErrorCheckList2.DBLWAF | ErrorCheckList2.BAOWAF | ErrorCheckList2.COMMAND | ErrorCheckList2.PODNG
  99. | ErrorCheckList2.PODMISMATCH | ErrorCheckList2.VAC_S | ErrorCheckList2.CLAMP_S | ErrorCheckList2.SAFTY
  100. | ErrorCheckList2.LOCKNG | ErrorCheckList2.UNLOCKNG | ErrorCheckList2.L_KEY_LK | ErrorCheckList2.L_KEY_UL;
  101. flag3 = ErrorCheckList3.MAP_S | ErrorCheckList3.MAP_S1 | ErrorCheckList3.MAP_S2 | ErrorCheckList3.WAFLOST
  102. | ErrorCheckList3.ALIGNNG
  103. | ErrorCheckList3.DRIVER | ErrorCheckList3.DRPOWERDOWN | ErrorCheckList3.HARDWARE
  104. | ErrorCheckList3.INTERNAL | ErrorCheckList3.E84_TIMEOUTx | ErrorCheckList3.E84_CS_VALID | ErrorCheckList3.READFAIL;
  105. return CheckError(device, out result);
  106. }
  107. if (!_device.Busy)
  108. {
  109. result = $"{_device.FoupID}";
  110. return true;
  111. }
  112. return null;
  113. }
  114. }
  115. }