SystemSeverModule.cs 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. using Aitex.Core.Util;
  2. using athosRT.Modules;
  3. using athosRT.Modules.EFEMs;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading;
  9. using System.Threading.Tasks;
  10. using RouteManager = athosRT.Modules.RouteManager1;
  11. namespace athosRT.Devices.EFEM
  12. {
  13. public class SystemServerModule : IServerModule, IData, IFunction
  14. {
  15. private Dictionary<EfemEventType, EfemEventValue> _dicEventStatus = new Dictionary<EfemEventType, EfemEventValue>();
  16. public string Name { get; set; }
  17. public bool Busy => Singleton<RouteManager>.Instance.IsRunning;
  18. public bool Moving { get; set; }
  19. public bool Error => Singleton<RouteManager>.Instance.IsError;
  20. public bool IsLinkOk => Singleton<EfemEntity>.Instance.IsCommunicationOk;
  21. public bool Disabled { get; set; }
  22. public bool Initialized { get; set; }
  23. public bool OriginSearched { get; set; }
  24. public bool InUsed { get; set; }
  25. public SystemServerModule(string name)
  26. {
  27. this.Name = name;
  28. foreach (EfemEventType key in Enum.GetValues(typeof(EfemEventType)))
  29. this._dicEventStatus[key] = EfemEventValue.ON;
  30. }
  31. public bool Init(out string reason)
  32. {
  33. reason = string.Empty;
  34. if (!Singleton<RouteManager>.Instance.CheckToPostMsg(RouteManager.MSG.HOME))
  35. {
  36. reason = "BUSY";
  37. return false;
  38. }
  39. Thread.Sleep(100);//原来就有
  40. this.Initialized = true;
  41. return true;
  42. }
  43. public bool Home(out string reason)
  44. {
  45. reason = string.Empty;
  46. if (!Singleton<RouteManager>.Instance.CheckToPostMsg(RouteManager.MSG.HOME))
  47. {
  48. reason = "BUSY";
  49. return false;
  50. }
  51. this.Initialized = true;
  52. return true;
  53. }
  54. public bool MapWafer(string device, out string reason)
  55. {
  56. reason = string.Empty;
  57. if (Singleton<RouteManager>.Instance.CheckToPostMsg(RouteManager.MSG.MapWafer, (object)device))
  58. return true;
  59. reason = "BUSY";
  60. return false;
  61. }
  62. public bool SetEvent(EfemEventType type, EfemEventValue value)
  63. {
  64. this._dicEventStatus[type] = value;
  65. return true;
  66. }
  67. public bool IsEventEnabled(EfemEventType type) => this._dicEventStatus[type] == EfemEventValue.ON;
  68. public bool Hold() => true;
  69. public bool Resume() => true;
  70. public bool Abort() => true;
  71. public bool Stop() => true;
  72. public bool ClearError()
  73. {
  74. if (Singleton<RouteManager>.Instance.IsError)
  75. Singleton<RouteManager>.Instance.Invoke("Reset");
  76. return true;
  77. }
  78. public string GetLastError() => string.Empty;
  79. }
  80. }