EmsTask.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. using Aitex.Core.RT.Device;
  2. using Aitex.Core.Util;
  3. using Aitex.Sorter.Common;
  4. using Aitex.Sorter.RT.EFEMs.Servers;
  5. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robot;
  6. namespace Aitex.Sorter.RT.EFEMs.Tasks
  7. {
  8. public class EmsTask : CheckImp, ITask
  9. {
  10. public EmsTask()
  11. {
  12. }
  13. public bool Execute(out string result, params string[] args)
  14. {
  15. string device = DeviceName.Robot;
  16. if (!Check<NoReadyPolicy>(device, out result))
  17. {
  18. return false;
  19. }
  20. if (!Check<EMSPolicy>(device, out result))
  21. {
  22. return false;
  23. }
  24. if (!Check<ErrorPolicy>(device, out result))
  25. {
  26. return false;
  27. }
  28. if (!Check<HoldPolicy>(device, out result))
  29. {
  30. return false;
  31. }
  32. if (!Check<MaintenancePolicy>(device, out result))
  33. {
  34. return false;
  35. }
  36. if (!Check<NoReadyPolicy>(device, out result))
  37. {
  38. return false;
  39. }
  40. Singleton<EfemEntity>.Instance.EfemDevice.IsEMSStop = false;
  41. return true;
  42. }
  43. public bool? Monitor(out string result, params string[] args)
  44. {
  45. result = string.Empty;
  46. if (Singleton<EfemEntity>.Instance.EfemDevice.IsError)
  47. {
  48. result = "ERROR";
  49. return false;
  50. }
  51. if (Singleton<EfemEntity>.Instance.EfemDevice.IsIdle &&
  52. Singleton<EfemEntity>.Instance.EfemDevice.CheckAcked(_token))
  53. {
  54. return true;
  55. }
  56. return null;
  57. }
  58. }
  59. }