HoldTask.cs 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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 HoldTask : CheckImp, ITask
  10. {
  11. public HoldTask()
  12. {
  13. }
  14. public bool Execute(out string result, params string[] args)
  15. {
  16. string device = DeviceName.Robot;
  17. if (!Check<NoReadyPolicy>(device, out result))
  18. {
  19. return false;
  20. }
  21. if (!Check<NoInitCompletedPolicy>(device, out result))
  22. {
  23. return false;
  24. }
  25. if (!Check<NoOriginCompletedPolicy>(device, out result))
  26. {
  27. return false;
  28. }
  29. if (!Check<EMSPolicy>(device, out result))
  30. {
  31. return false;
  32. }
  33. if (!Check<ErrorPolicy>(device, out result))
  34. {
  35. return false;
  36. }
  37. if (!Check<NoMovingPolicy>(device, out result))
  38. {
  39. return false;
  40. }
  41. if (!Check<HoldPolicy>(device, out result))
  42. {
  43. return false;
  44. }
  45. if (!Check<MaintenancePolicy>(device, out result))
  46. {
  47. return false;
  48. }
  49. if (!Check<PowerDownPolicy>(device, out result))
  50. {
  51. return false;
  52. }
  53. RobotBaseDevice robot = DEVICE.GetDevice<RobotBaseDevice>(device);
  54. if (!robot.IsBusy)
  55. {
  56. result = "NOTINMOTION";
  57. return false;
  58. }
  59. if (!robot.Stop( ))
  60. {
  61. return false;
  62. }
  63. Singleton<EfemEntity>.Instance.SetSystemHold();
  64. return true;
  65. }
  66. public bool? Monitor( out string result, params string[] args)
  67. {
  68. result = string.Empty;
  69. string device = DeviceName.Robot;
  70. RobotBaseDevice robot = DEVICE.GetDevice<RobotBaseDevice>(device);
  71. if (robot.IsError)
  72. {
  73. return false;
  74. }
  75. if (robot.IsReady())
  76. {
  77. return true;
  78. }
  79. return null;
  80. }
  81. }
  82. }