ExchangeTask.cs 4.6 KB

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