EntityFactory.cs 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. using Aitex.Core.RT.Device;
  2. using Aitex.Core.Util;
  3. using MECF.Framework.Common.Equipment;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Text.RegularExpressions;
  9. using System.Threading.Tasks;
  10. namespace athosRT.Devices.EFEM
  11. {
  12. public class EntityFactory
  13. {
  14. private SystemServerModule _system = (SystemServerModule)null;
  15. private AlignerServerModule _aligner = (AlignerServerModule)null;
  16. private RobotServerModule _robot = (RobotServerModule)null;
  17. private LoadPortServerModule _loadportA = (LoadPortServerModule)null;
  18. private LoadPortServerModule _loadportB = (LoadPortServerModule)null;
  19. private LoadPortServerModule _loadportC = (LoadPortServerModule)null;
  20. private LoadPortServerModule _loadportD = (LoadPortServerModule)null;
  21. private LoadPortServerModule _loadportE = (LoadPortServerModule)null;
  22. private LoadPortServerModule _loadportF = (LoadPortServerModule)null;
  23. private LoadPortServerModule _loadportG = (LoadPortServerModule)null;
  24. private LoadPortServerModule _loadportH = (LoadPortServerModule)null;
  25. private LoadPortServerModule _loadportI = (LoadPortServerModule)null;
  26. private LoadPortServerModule _loadportJ = (LoadPortServerModule)null;
  27. private BufferServerModule _buffer1 = (BufferServerModule)null;
  28. private BufferServerModule _buffer2 = (BufferServerModule)null;
  29. private BufferServerModule _aligner1 = (BufferServerModule)null;
  30. private BufferServerModule _aligner2 = (BufferServerModule)null;
  31. public EntityFactory()
  32. {
  33. this._system = new SystemServerModule("System");
  34. this._aligner = new AlignerServerModule("Aligner");
  35. this._robot = new RobotServerModule("Robot");
  36. this._loadportA = new LoadPortServerModule("LP1");
  37. this._loadportB = new LoadPortServerModule("LP2");
  38. this._loadportC = new LoadPortServerModule("LP3");
  39. this._loadportD = new LoadPortServerModule("LP4");
  40. this._loadportE = new LoadPortServerModule("LP5");
  41. this._loadportF = new LoadPortServerModule("LP6");
  42. this._loadportG = new LoadPortServerModule("LP7");
  43. this._loadportH = new LoadPortServerModule("LP8");
  44. this._loadportI = new LoadPortServerModule("LP9");
  45. this._loadportJ = new LoadPortServerModule("LP10");
  46. this._aligner1 = new BufferServerModule("Aligner1");
  47. this._aligner2 = new BufferServerModule("Aligner2");
  48. this._buffer1 = new BufferServerModule("CoolingBuffer1");
  49. this._buffer2 = new BufferServerModule("CoolingBuffer2");
  50. }
  51. public IServerModule GetEntity(string name)
  52. {
  53. if (string.IsNullOrEmpty(name))
  54. return (IServerModule)null;
  55. if (ModuleHelper.IsLoadPort((ModuleName)Enum.Parse(typeof(ModuleName), name)))
  56. {
  57. int num = int.Parse(new Regex("[1-9]\\d*").Match(name).ToString());
  58. int? nullable = Singleton<DeviceDefineManager>.Instance.GetValue<int>("LoadPortQuantity");
  59. int valueOrDefault = nullable.GetValueOrDefault();
  60. if (num > valueOrDefault & nullable.HasValue)
  61. return (IServerModule)null;
  62. }
  63. switch (name)
  64. {
  65. case "Aligner":
  66. return _aligner;
  67. case "Aligner1":
  68. return _aligner1;
  69. case "Aligner2":
  70. return _aligner2;
  71. case "Aligner3":
  72. return _aligner1;
  73. case "Aligner4":
  74. return _aligner2;
  75. case "CoolingBuffer1":
  76. return _buffer1;
  77. case "CoolingBuffer2":
  78. return _buffer2;
  79. case "LP1":
  80. return _loadportA;
  81. case "LP10":
  82. return _loadportJ;
  83. case "LP2":
  84. return _loadportB;
  85. case "LP3":
  86. return _loadportC;
  87. case "LP4":
  88. return _loadportD;
  89. case "LP5":
  90. return _loadportE;
  91. case "LP6":
  92. return _loadportF;
  93. case "LP7":
  94. return _loadportG;
  95. case "LP8":
  96. return _loadportH;
  97. case "LP9":
  98. return _loadportI;
  99. case "Robot":
  100. return _robot;
  101. case "System":
  102. return _system;
  103. default:
  104. return (IServerModule)null;
  105. }
  106. }
  107. }
  108. }