ExchangeTask.cs 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. using Aitex.Core.RT.Device;
  2. using Aitex.Sorter.Common;
  3. using Efem;
  4. using MECF.Framework.Common.Equipment;
  5. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robot;
  6. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots.RobotBase;
  7. namespace EFEM.RT.Tasks
  8. {
  9. public class ExchangeTask : RobotImp, ITask
  10. {
  11. public ExchangeTask()
  12. {
  13. }
  14. public bool Execute(out string result, params string[] args)
  15. {
  16. string device = DeviceName.Robot;
  17. IServerModule entity = GetEntity(device);
  18. ModuleName target = ModuleName.System;
  19. int slot = 1;
  20. if (!ParseMoveTarget(args[0], out target, out slot))
  21. {
  22. result = PARAM_NG;
  23. return false;
  24. }
  25. Hand placearm = Hand.Blade2;
  26. if (!ParseMoveArm(args[1], out placearm))
  27. {
  28. result = PARAM_NG;
  29. return false;
  30. }
  31. Hand pickarm = Hand.Blade2;
  32. if (!ParseMoveArm(args[2], out pickarm))
  33. {
  34. result = PARAM_NG;
  35. return false;
  36. }
  37. if (!Check<NoReadyPolicy>(device, out result))
  38. {
  39. return false;
  40. }
  41. if (!Check<NoInitCompletedPolicy>(device, out result))
  42. {
  43. return false;
  44. }
  45. if (!Check<NoOriginCompletedPolicy>(device, out result))
  46. {
  47. return false;
  48. }
  49. if (!Check<VacPolicy>(device, out result))
  50. {
  51. return false;
  52. }
  53. if (!Check<EMSPolicy>(device, out result))
  54. {
  55. return false;
  56. }
  57. if (!Check<ErrorPolicy>(device, out result))
  58. {
  59. return false;
  60. }
  61. if (!Check<BusyPolicy>(device, out result))
  62. {
  63. return false;
  64. }
  65. if (!Check<HoldPolicy>(device, out result))
  66. {
  67. return false;
  68. }
  69. if (!Check<RemovePolicy>(device, out result))
  70. {
  71. return false;
  72. }
  73. if (!Check<MaintenancePolicy>(device, out result))
  74. {
  75. return false;
  76. }
  77. if (!Check<LinkPolicy>(device, out result))
  78. {
  79. return false;
  80. }
  81. if (!Check<PowerDownPolicy>(device, out result))
  82. {
  83. return false;
  84. }
  85. RobotBaseDevice _device = DEVICE.GetDevice<RobotBaseDevice>(device);
  86. //if (!_device.Swap(target, slot-1, placearm ))
  87. // {
  88. // return false;
  89. // }
  90. return true;
  91. }
  92. public bool? Monitor(out string result, params string[] args)
  93. {
  94. result = string.Empty;
  95. RobotBaseDevice _device = DEVICE.GetDevice<RobotBaseDevice>(DeviceName.Robot);
  96. if (_device.IsError)
  97. {
  98. flag1 = ErrorCheckList1.VAC | ErrorCheckList1.AIR | ErrorCheckList1.STALL
  99. | ErrorCheckList1.LIMIT | ErrorCheckList1.SENSOR | ErrorCheckList1.POSITION | ErrorCheckList1.EMS
  100. | ErrorCheckList1.COMM | ErrorCheckList1.COMM2 | ErrorCheckList1.VACON | ErrorCheckList1.VACOFF
  101. | ErrorCheckList1.CLAMPON | ErrorCheckList1.CLAMPOF;
  102. flag2 = ErrorCheckList2.RRTWAF | ErrorCheckList2.CRSWAF | ErrorCheckList2.THICKWAF | ErrorCheckList2.THINWAF
  103. | ErrorCheckList2.DBLWAF | ErrorCheckList2.BAOWAF | ErrorCheckList2.COMMAND | ErrorCheckList2.PODNG
  104. | ErrorCheckList2.PODMISMATCH | ErrorCheckList2.VAC_S | ErrorCheckList2.CLAMP_S | ErrorCheckList2.SAFTY
  105. | ErrorCheckList2.LOCKNG | ErrorCheckList2.UNLOCKNG | ErrorCheckList2.L_KEY_LK | ErrorCheckList2.L_KEY_UL;
  106. flag3 = ErrorCheckList3.MAP_S | ErrorCheckList3.MAP_S1 | ErrorCheckList3.MAP_S2 | ErrorCheckList3.WAFLOST
  107. | ErrorCheckList3.ALIGNNG
  108. | ErrorCheckList3.DRIVER | ErrorCheckList3.DRPOWERDOWN | ErrorCheckList3.HARDWARE
  109. | ErrorCheckList3.INTERNAL | ErrorCheckList3.E84_TIMEOUTx | ErrorCheckList3.E84_CS_VALID | ErrorCheckList3.READFAIL;
  110. return CheckError(DeviceName.Robot, out result);
  111. }
  112. if (_device.IsReady())
  113. return true;
  114. return null;
  115. }
  116. }
  117. }