AbortTask.cs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. using Aitex.Core.RT.Device;
  2. using Aitex.Core.Util;
  3. using Aitex.Sorter.Common;
  4. using Efem;
  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 AbortTask : CheckImp, ITask
  10. {
  11. public AbortTask()
  12. {
  13. }
  14. public bool Execute(out string result, params string[] args)
  15. {
  16. string device = DeviceName.Robot;
  17. if (args.Length > 0)
  18. {
  19. result = PARAM_NG;
  20. return false;
  21. }
  22. if (!Check<NoReadyPolicy>(device, out result))
  23. {
  24. return false;
  25. }
  26. if (!Check<VacPolicy>(device, out result))
  27. {
  28. return false;
  29. }
  30. if (!Check<EMSPolicy>(device, out result))
  31. {
  32. return false;
  33. }
  34. if (!Check<CMPLPolicy>(device, out result))
  35. {
  36. return false;
  37. }
  38. if (!Check<ErrorPolicy>(device, out result))
  39. {
  40. return false;
  41. }
  42. if (!Check<NoHoldPolicy>(device, out result))
  43. {
  44. return false;
  45. }
  46. if (!Check<MaintenancePolicy>(device, out result))
  47. {
  48. return false;
  49. }
  50. if (!Check<PowerDownPolicy>(device, out result))
  51. {
  52. return false;
  53. }
  54. Singleton<EfemEntity>.Instance.SetSystemUnHold();
  55. RobotBaseDevice robot = DEVICE.GetDevice<RobotBaseDevice>(device);
  56. if (!robot.Home(null))
  57. {
  58. return false;
  59. }
  60. return true;
  61. }
  62. public bool? Monitor(out string result, params string[] args)
  63. {
  64. result = string.Empty;
  65. string device = DeviceName.Robot;
  66. RobotBaseDevice robot = DEVICE.GetDevice<RobotBaseDevice>(device);
  67. if (robot.IsError)
  68. {
  69. return false;
  70. }
  71. if (!robot.IsIdle)
  72. {
  73. return true;
  74. }
  75. return null;
  76. }
  77. }
  78. }