StateTask.cs 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. using System;
  2. using System.IO;
  3. using System.Reflection;
  4. using Aitex.Core.RT.DataCenter;
  5. using Aitex.Core.Util;
  6. using Aitex.Sorter.Common;
  7. using Aitex.Sorter.RT.EFEMs.Servers;
  8. using MECF.Framework.Common.Equipment;
  9. using MECF.Framework.Common.SubstrateTrackings;
  10. namespace Aitex.Sorter.RT.EFEMs.Tasks
  11. {
  12. public class QueryStateTask : CheckImp, ITask
  13. {
  14. public QueryStateTask()
  15. {
  16. }
  17. public bool Execute(out string result, params string[] args)
  18. {
  19. string device = DeviceName.System;
  20. if (args[0]!="VER" && args[0]!="TRACK" && !args[0].StartsWith("PRS") && !args[0].StartsWith("FFU") && !args[0].StartsWith("INF"))
  21. {
  22. result = PARAM_NG;
  23. return false;
  24. }
  25. if (!Check<NoReadyPolicy>(device, out result))
  26. {
  27. return false;
  28. }
  29. if (!Check<MaintenancePolicy>(device, out result))
  30. {
  31. return false;
  32. }
  33. return true;
  34. }
  35. public bool? Monitor(out string result, params string[] args)
  36. {
  37. result = string.Empty;
  38. if(args.Length < 1)
  39. {
  40. return false;
  41. }
  42. switch (args[0])
  43. {
  44. case "VER":
  45. Assembly assembly = Assembly.GetExecutingAssembly();
  46. string version = Assembly.GetExecutingAssembly().GetName().Version.ToString();
  47. DateTime lastModified = DateTime.Now;
  48. if (!string.IsNullOrEmpty(assembly.Location))
  49. {
  50. FileInfo fileInfo = new FileInfo(assembly.Location);
  51. lastModified = fileInfo.LastWriteTime;
  52. }
  53. result = string.Format("{0}({1}-{2}-{3})", version, lastModified.Year, lastModified.Month, lastModified.Day);
  54. break;
  55. case "TRACK":
  56. //var aligner = WaferManager.Instance.CheckHasWafer(ModuleName.Aligner, 0) ? "1" : "0";
  57. //var up = WaferManager.Instance.CheckHasWafer(ModuleName.Robot, 1) ? "1" : "0";
  58. //var low = WaferManager.Instance.CheckHasWafer(ModuleName.Robot, 0) ? "1" : "0";
  59. //result = $"{up}{low}{aligner}";
  60. result = Singleton<EfemEntity>.Instance.EfemDevice.GetStateTrack();
  61. break;
  62. case "INF1":
  63. object value = DATA.Poll("System.MeterDifferencePressure.Feedback");
  64. if (value != null)
  65. {
  66. result = $"{value}";
  67. }
  68. else
  69. result = $"0.0";
  70. break;
  71. case "INF2":
  72. value = DATA.Poll("FfuAAF1.Speed");
  73. if (value != null)
  74. {
  75. result = $"{value}";
  76. }
  77. else
  78. result = $"0.0";
  79. break;
  80. case "INF3":
  81. value = DATA.Poll("FfuAAF2.Speed");
  82. if (value != null)
  83. {
  84. result += $"{value}";
  85. }
  86. else
  87. result += $"0.0";
  88. break;
  89. case "INF4":
  90. result = $"0.0";
  91. break;
  92. case "PRS1":
  93. value = DATA.Poll("System.MeterDifferencePressure.Feedback");
  94. if (value != null)
  95. {
  96. result = $"1|{value}";
  97. }
  98. else
  99. result = $"1|0.0";
  100. break;
  101. case "PRS2":
  102. value = DATA.Poll("System.MeterDifferencePressure.Feedback");
  103. if (value != null)
  104. {
  105. result = $"2|{value}";
  106. }
  107. else
  108. result = $"2|0.0";
  109. break;
  110. case "PRS3":
  111. value = DATA.Poll("System.MeterDifferencePressure.Feedback");
  112. if (value != null)
  113. {
  114. result = $"3|{value}";
  115. }
  116. else
  117. result = $"3|0.0";
  118. break;
  119. case "PRS4":
  120. value = DATA.Poll("System.MeterDifferencePressure.Feedback");
  121. if (value != null)
  122. {
  123. result = $"4|{value}";
  124. }
  125. else
  126. result = $"4|0.0";
  127. break;
  128. case "FFU1":
  129. value = DATA.Poll("FfuAAF1.Speed");
  130. if (value != null)
  131. {
  132. result = $"1|{value}";
  133. }
  134. else
  135. result = $"1|0.0";
  136. break;
  137. case "FFU2":
  138. value = DATA.Poll("FfuAAF2.Speed");
  139. if (value != null)
  140. {
  141. result += $"2|{value}";
  142. }
  143. else
  144. result += $"2|0.0";
  145. break;
  146. default:
  147. break;
  148. }
  149. return true;
  150. }
  151. }
  152. }