QueryDataService.cs 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Data;
  4. using System.ServiceModel;
  5. using Aitex.Core.RT.ConfigCenter;
  6. using Aitex.Core.RT.DataCenter;
  7. using Aitex.Core.RT.Event;
  8. using Aitex.Core.RT.IOCore;
  9. using Aitex.Core.RT.Log;
  10. using Aitex.Core.RT.RecipeCenter;
  11. using Aitex.Core.RT.SCCore;
  12. using Aitex.Core.UI.ControlDataContext;
  13. using Aitex.Core.Util;
  14. using Aitex.Sorter.Common;
  15. using Aitex.Sorter.RT.Module.DBRecorder;
  16. using MECF.Framework.Common.DBCore;
  17. using MECF.Framework.Common.IOCore;
  18. using MECF.Framework.Common.SCCore;
  19. namespace MECF.Framework.Common.DataCenter
  20. {
  21. [ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Multiple, UseSynchronizationContext = false)]
  22. public class QueryDataService : IQueryDataService
  23. {
  24. public Dictionary<string, object> PollData(IEnumerable<string> keys)
  25. {
  26. try
  27. {
  28. var result = DATA.PollData(keys);
  29. return result;
  30. }
  31. catch (Exception ex)
  32. {
  33. LOG.Write(ex);
  34. }
  35. return null;
  36. }
  37. public string GetConfigFileContent()
  38. {
  39. return SC.GetConfigFileContent();
  40. }
  41. public void SetItemValue(string module, int value)
  42. {
  43. SC.SetItemValue(module, value);
  44. }
  45. public string GetConfigFileContentByModule(string module)
  46. {
  47. return SC.GetConfigFileContent(module);
  48. }
  49. public List<SCConfigItem> GetConfigItemList()
  50. {
  51. return SC.GetItemList();
  52. }
  53. public object GetConfigByModule(string module, string key)
  54. {
  55. return CONFIG.Poll(module, key);
  56. }
  57. public Dictionary<string, object> PollConfigByModule(string module, IEnumerable<string> keys)
  58. {
  59. return CONFIG.PollConfig(module, keys);
  60. }
  61. public Dictionary<string, object> PollConfig(IEnumerable<string> keys)
  62. {
  63. return CONFIG.PollConfig(keys);
  64. }
  65. public object GetData(string key)
  66. {
  67. return DATA.Poll(key);
  68. }
  69. public object GetConfig(string key)
  70. {
  71. return CONFIG.Poll(key);
  72. }
  73. public List<NotifiableIoItem> GetDiList(string key)
  74. {
  75. var ret = IO.GetDiList(key);
  76. List<NotifiableIoItem> result = new List<NotifiableIoItem>();
  77. ret.ForEach(x => result.Add(new NotifiableIoItem()
  78. {
  79. Address = x.Addr,
  80. Name = x.Name,
  81. Description = x.Description,
  82. Index = x.Index,
  83. BoolValue = x.Value,
  84. Provider = x.Provider,
  85. BlockOffset = x.BlockOffset,
  86. BlockIndex = x.Index,
  87. }));
  88. return result;
  89. }
  90. public List<NotifiableIoItem> GetDoList(string key)
  91. {
  92. var ret = IO.GetDoList(key);
  93. List<NotifiableIoItem> result = new List<NotifiableIoItem>();
  94. ret.ForEach(x => result.Add(new NotifiableIoItem()
  95. {
  96. Address = x.Addr,
  97. Name = x.Name,
  98. Description = x.Description,
  99. Index = x.Index,
  100. BoolValue = x.Value,
  101. Provider = x.Provider,
  102. BlockOffset = x.BlockOffset,
  103. BlockIndex = x.Index,
  104. }));
  105. return result;
  106. }
  107. public List<NotifiableIoItem> GetAiList(string key)
  108. {
  109. var ret = IO.GetAiList(key);
  110. List<NotifiableIoItem> result = new List<NotifiableIoItem>();
  111. ret.ForEach(x => result.Add(new NotifiableIoItem()
  112. {
  113. Address = x.Addr,
  114. Name = x.Name,
  115. Description = x.Description,
  116. Index = x.Index,
  117. ShortValue = (short)x.Value,
  118. Provider = x.Provider,
  119. BlockOffset = x.BlockOffset,
  120. BlockIndex = x.Index,
  121. }));
  122. return result;
  123. }
  124. public List<NotifiableIoItem> GetAoList(string key)
  125. {
  126. var ret = IO.GetAoList(key);
  127. List<NotifiableIoItem> result = new List<NotifiableIoItem>();
  128. ret.ForEach(x => result.Add(new NotifiableIoItem()
  129. {
  130. Address = x.Addr,
  131. Name = x.Name,
  132. Description = x.Description,
  133. Index = x.Index,
  134. ShortValue = (short)x.Value,
  135. Provider = x.Provider,
  136. BlockOffset = x.BlockOffset,
  137. BlockIndex = x.Index,
  138. }));
  139. return result;
  140. }
  141. public List<EventItem> QueryDBEvent(string sql)
  142. {
  143. return EV.QueryDBEvent(sql);
  144. }
  145. public List<HistoryCarrierData> QueryDBCarrier(string sql)
  146. {
  147. return CarrierDataRecorder.QueryDBCarrier(sql);
  148. }
  149. public List<HistoryProcessData> QueryDBProcessCarrier(string sql)
  150. {
  151. return CarrierDataRecorder.QueryDBProcessCarrier(sql);
  152. }
  153. public List<HistoryProcessData> QueryDBProcessLot(string sql)
  154. {
  155. return CarrierDataRecorder.QueryDBProcessLot(sql);
  156. }
  157. public List<HistoryStatisticsOCRData> QueryDBOCRStatistics(string sql)
  158. {
  159. return OCRDataRecorder.QueryDBOCRStatistics(sql);
  160. }
  161. public List<HistoryFfuDiffPressureData> QueryDBFfuDiffPressureStatistics(string sql)
  162. {
  163. return FfuDiffPressureDataRecorder.FfuDiffPressureHistory(sql);
  164. }
  165. public List<HistoryOCRData> QueryDBOCRHistory(string sql)
  166. {
  167. return OCRDataRecorder.QueryDBOCRHistory(sql);
  168. }
  169. public List<StatsStatisticsData> QueryStatsDBStatistics(string sql)
  170. {
  171. List<StatsStatisticsData> statsStatisticsDatas = new List<StatsStatisticsData>();
  172. return StatsDataRecorder.QueryStatsStatistics(sql);
  173. }
  174. public List<HistoryProcessData> QueryDBProcess(string sql)
  175. {
  176. return ProcessDataRecorder.QueryDBProcess(sql);
  177. }
  178. public List<HistoryWaferData> QueryDBWafer(string sql)
  179. {
  180. return WaferDataRecorder.QueryDBWafer(sql);
  181. }
  182. public List<HistoryMoveData> QueryDBMovement(string sql)
  183. {
  184. return WaferMoveHistoryRecorder.QueryDBMovement(sql);
  185. }
  186. public List<HistoryJobMoveData> QueryDBJobMovementByJobGuid(string jobGuid)
  187. {
  188. return JobMoveHistoryRecorder.QueryJobMovement(jobGuid);
  189. }
  190. public List<HistoryJobMoveData> QueryDBJobMovementByJobGuidAndStationName(string jobGuid, string stationName)
  191. {
  192. return JobMoveHistoryRecorder.QueryJobMovement(jobGuid, stationName);
  193. }
  194. public List<HistoryDataItem> GetHistoryData(IEnumerable<string> keys, string recipeRunGuid, string module)
  195. {
  196. return ProcessDataRecorder.GetHistoryData(keys, recipeRunGuid, module);
  197. }
  198. public List<HistoryDataItem> GetOneDayHistoryData(IEnumerable<string> keys, DateTime begin, string module)
  199. {
  200. return ProcessDataRecorder.GetOneDayHistoryData(keys, begin, module);
  201. }
  202. public List<HistoryDataItem> GetHistoryDataFromStartToEnd(IEnumerable<string> keys, DateTime begin, DateTime end, string module)
  203. {
  204. return ProcessDataRecorder.GetHistoryDataFromStartToEnd(keys, begin, end, module);
  205. }
  206. public DataTable QueryData(string sql)
  207. {
  208. return DataQuery.Query(sql);
  209. }
  210. public List<WaferHistoryWafer> GetWaferHistoryWafers(string id)
  211. {
  212. return WaferDataRecorder.GetWaferHistoryWafers(id);
  213. }
  214. public WaferHistoryRecipe GetWaferHistoryRecipe(string id)
  215. {
  216. return RecipeDataRecorder.GetWaferHistoryRecipe(id);
  217. }
  218. public List<WaferHistoryRecipe> GetWaferHistoryRecipes(string id)
  219. {
  220. return RecipeDataRecorder.GetWaferHistoryRecipes(id);
  221. }
  222. public List<WaferHistorySecquence> GetWaferHistorySecquences(string id)
  223. {
  224. return RecipeDataRecorder.GetWaferHistorySecquences(id);
  225. }
  226. public List<WaferHistoryMovement> GetWaferHistoryMovements(string id)
  227. {
  228. return WaferMoveHistoryRecorder.GetWaferHistoryMovements(id);
  229. }
  230. public List<WaferHistoryLot> QueryWaferHistoryLotsBySql(string sql)
  231. {
  232. return CarrierDataRecorder.QueryWaferHistoryLotsBySql(sql);
  233. }
  234. public List<WaferHistoryLot> GetWaferHistoryLots(DateTime startTime, DateTime endTime, string keyWord)
  235. {
  236. return CarrierDataRecorder.GetWaferHistoryLots(startTime, endTime, keyWord);
  237. }
  238. public string GetTypedConfigContent(string type, string contentPath)
  239. {
  240. return TypedConfigManager.Instance.GetTypedConfigContent(type, contentPath);
  241. }
  242. public void SetTypedConfigContent(string type, string contentPath, string content)
  243. {
  244. TypedConfigManager.Instance.SetTypedConfigContent(type, contentPath, content);
  245. }
  246. public List<string> GetLayoutRecipeContent(string recipeContent, string slotCount, string cassetteSlotCount)
  247. {
  248. return RecipeFileManager.Instance.LayoutRecipeParse(recipeContent, slotCount, cassetteSlotCount);
  249. }
  250. }
  251. }