EmsTask.cs 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. using Aitex.Core.RT.Device;
  2. using Aitex.Core.Util;
  3. using EFEM.RT.Modules;
  4. using Aitex.Sorter.Common;
  5. using Efem;
  6. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robot;
  7. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots.RobotBase;
  8. namespace EFEM.RT.Tasks
  9. {
  10. public class EmsTask : CheckImp, ITask
  11. {
  12. public EmsTask()
  13. {
  14. }
  15. public bool Execute(out string result, params string[] args)
  16. {
  17. string device = DeviceName.Robot;
  18. if (!Check<NoReadyPolicy>(device, out result))
  19. {
  20. return false;
  21. }
  22. if (!Check<EMSPolicy>(device, out result))
  23. {
  24. return false;
  25. }
  26. if (!Check<ErrorPolicy>(device, out result))
  27. {
  28. return false;
  29. }
  30. if (!Check<HoldPolicy>(device, out result))
  31. {
  32. return false;
  33. }
  34. if (!Check<MaintenancePolicy>(device, out result))
  35. {
  36. return false;
  37. }
  38. if (!Check<NoReadyPolicy>(device, out result))
  39. {
  40. return false;
  41. }
  42. RobotBaseDevice robot = DEVICE.GetDevice<RobotBaseDevice>(device);
  43. Singleton<RouteManager>.Instance.IsEMSStop = false;
  44. if (!robot.Stop( ))
  45. {
  46. return false;
  47. }
  48. return true;
  49. }
  50. public bool? Monitor(out string result, params string[] args)
  51. {
  52. result = string.Empty;
  53. string device = DeviceName.Robot;
  54. RobotBaseDevice robot = DEVICE.GetDevice<RobotBaseDevice>(device);
  55. if (robot.IsError)
  56. {
  57. return false;
  58. }
  59. if (robot.IsReady())
  60. {
  61. Singleton<RouteManager>.Instance.IsEMSStop = true;
  62. return true;
  63. }
  64. return null;
  65. }
  66. }
  67. }