BufferBaseDevice.cs 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. using Aitex.Core.Common;
  2. using Aitex.Core.RT.DataCenter;
  3. using Aitex.Core.RT.Device;
  4. using Aitex.Core.RT.OperationCenter;
  5. using MECF.Framework.Common.Equipment;
  6. using MECF.Framework.Common.SubstrateTrackings;
  7. using System;
  8. using System.Collections.Generic;
  9. using System.Linq;
  10. using System.Text;
  11. using System.Threading.Tasks;
  12. namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Buffer
  13. {
  14. public class BufferStationBaseDevice : BaseDevice, IDevice
  15. {
  16. public virtual BufferStateEnum CurrentState
  17. {
  18. get; set;
  19. } = BufferStateEnum.Idle;
  20. public virtual bool IsMapped { get; }
  21. public virtual int BufferSlotsNumber { get; set; }
  22. public virtual ModuleName BufferModuleName { get; set; }
  23. public string BufferSlotMap { get; set; }
  24. public BufferStationBaseDevice(string module, ModuleName name, int slotNumber)
  25. {
  26. Module = module;
  27. Name = name.ToString();
  28. BufferModuleName = name;
  29. BufferSlotsNumber = slotNumber;
  30. WaferManager.Instance.SubscribeLocation(BufferModuleName, slotNumber);
  31. }
  32. public virtual void SubscribeOperationAndData()
  33. {
  34. OP.Subscribe(String.Format("{0}.{1}", Name, "SetWaferSize"), (out string reason, int time, object[] param) =>
  35. {
  36. if (param.Length < 2)
  37. {
  38. reason = "Invalide parameter";
  39. return false;
  40. }
  41. WaferSize size = (WaferSize)Enum.Parse(typeof(WaferSize), param[1].ToString());
  42. bool ret = ExecuteSetWaferSize(size, out reason);
  43. if (ret)
  44. {
  45. reason = string.Format("{0} {1}", Name, "SetWaferSize");
  46. return true;
  47. }
  48. reason = "";
  49. return false;
  50. });
  51. DATA.Subscribe($"{Name}.WaferSize", () => CurrentWaferSize.ToString());
  52. DATA.Subscribe($"{Name}.State", () => CurrentState.ToString());
  53. }
  54. public virtual bool ExecuteSetWaferSize(WaferSize size, out string reason)
  55. {
  56. if(WaferManager.Instance.CheckHasWafer(BufferModuleName,0))
  57. {
  58. WaferManager.Instance.UpdateWaferSize(BufferModuleName, 0, size);
  59. }
  60. reason = "";
  61. return true;
  62. }
  63. public BufferStationBaseDevice(string module, string name, int slotNumber)
  64. {
  65. Module = module;
  66. Name = name;
  67. BufferModuleName = (ModuleName)Enum.Parse(typeof(ModuleName), name);
  68. BufferSlotsNumber = slotNumber;
  69. WaferManager.Instance.SubscribeLocation(BufferModuleName, slotNumber);
  70. }
  71. public bool Initialize()
  72. {
  73. SubscribeOperationAndData();
  74. return true;
  75. }
  76. public void Monitor()
  77. {
  78. }
  79. public void Terminate()
  80. {
  81. }
  82. public virtual void Reset()
  83. {
  84. }
  85. public virtual bool IsEnableTransferWafer(out string reason)
  86. {
  87. reason = "";
  88. return true;
  89. }
  90. public virtual bool IsEnableMapWafer(out string reason)
  91. {
  92. reason = "";
  93. return true;
  94. }
  95. public virtual void ConfirmWaferPresent()
  96. {
  97. }
  98. public virtual void OnSlotMapRead(string slotMap, int index)
  99. {
  100. }
  101. public virtual void OnSlotMapRead(string slotMap)
  102. {
  103. }
  104. public virtual bool IsWaferPresent { get; set; }
  105. public virtual void InformAccessStart()
  106. {
  107. }
  108. public virtual void InformAccessComplete()
  109. {
  110. }
  111. public virtual WaferSize CurrentWaferSize
  112. {
  113. get
  114. {
  115. if (WaferManager.Instance.CheckHasWafer(BufferModuleName, 0))
  116. {
  117. return WaferManager.Instance.GetWaferSize(BufferModuleName, 0);
  118. }
  119. return WaferSize.WS0;
  120. }
  121. }
  122. }
  123. public enum BufferStateEnum
  124. {
  125. Idle,
  126. }
  127. }