QueryDataService.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331
  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.SCCore;
  11. using Aitex.Core.RT.RecipeCenter;
  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. using MECF.Framework.Common.CommonData;
  20. namespace MECF.Framework.Common.DataCenter
  21. {
  22. [ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Multiple)]
  23. public class QueryDataService : IQueryDataService
  24. {
  25. public Dictionary<string, object> PollData(IEnumerable<string> keys)
  26. {
  27. try
  28. {
  29. var result = DATA.PollData(keys);
  30. return result;
  31. }
  32. catch (Exception ex)
  33. {
  34. LOG.Write(ex);
  35. }
  36. return null;
  37. }
  38. public string GetConfigFileContent()
  39. {
  40. return SC.GetConfigFileContent();
  41. }
  42. public string GetFileContent(string fileName)
  43. {
  44. return ConfigManager.Instance.GetRootFileContent(fileName);
  45. }
  46. public string GetConfigFileDispenseByModule(string module)
  47. {
  48. return ConfigManager.Instance.GetFileContent(module);
  49. }
  50. public List<string> GetFileListByFolderBrowser(string folderBrowser)
  51. {
  52. return ConfigManager.Instance.GetFileListByFolderBrowser(folderBrowser);
  53. }
  54. public string GetConfigFileContentByModule(string module)
  55. {
  56. return SC.GetConfigFileContent(module);
  57. }
  58. public List<SCConfigItem> GetConfigItemList()
  59. {
  60. return SC.GetItemList();
  61. }
  62. public object GetConfigByModule(string module, string key)
  63. {
  64. return CONFIG.Poll(module, key);
  65. }
  66. public Dictionary<string, object> PollConfigByModule(string module, IEnumerable<string> keys)
  67. {
  68. return CONFIG.PollConfig(module, keys);
  69. }
  70. public Dictionary<string, object> PollConfig(IEnumerable<string> keys)
  71. {
  72. return CONFIG.PollConfig(keys);
  73. }
  74. public object GetData(string key)
  75. {
  76. return DATA.Poll(key);
  77. }
  78. public object GetConfig(string key)
  79. {
  80. return CONFIG.Poll(key);
  81. }
  82. public List<NotifiableIoItem> GetDiList(string key)
  83. {
  84. var ret = IO.GetDiList(key);
  85. List<NotifiableIoItem> result = new List<NotifiableIoItem>();
  86. ret.ForEach(x => result.Add(new NotifiableIoItem()
  87. {
  88. Address = x.Addr,
  89. Name = x.Name,
  90. Description = x.Description,
  91. Index = x.Index,
  92. BoolValue = x.Value,
  93. Provider = x.Provider,
  94. BlockOffset = x.BlockOffset,
  95. BlockIndex = x.Index,
  96. }));
  97. return result;
  98. }
  99. public List<NotifiableIoItem> GetDoList(string key)
  100. {
  101. var ret = IO.GetDoList(key);
  102. List<NotifiableIoItem> result = new List<NotifiableIoItem>();
  103. ret.ForEach(x => result.Add(new NotifiableIoItem()
  104. {
  105. Address = x.Addr,
  106. Name = x.Name,
  107. Description = x.Description,
  108. Index = x.Index,
  109. BoolValue = x.Value,
  110. Provider = x.Provider,
  111. BlockOffset = x.BlockOffset,
  112. BlockIndex = x.Index,
  113. }));
  114. return result;
  115. }
  116. public List<NotifiableIoItem> GetAiList(string key)
  117. {
  118. var ret = IO.GetAiList(key);
  119. List<NotifiableIoItem> result = new List<NotifiableIoItem>();
  120. ret.ForEach(x => result.Add(new NotifiableIoItem()
  121. {
  122. Address = x.Addr,
  123. Name = x.Name,
  124. Description = x.Description,
  125. Index = x.Index,
  126. ShortValue = (short)x.Value,
  127. Provider = x.Provider,
  128. BlockOffset = x.BlockOffset,
  129. BlockIndex = x.Index,
  130. }));
  131. return result;
  132. }
  133. public List<NotifiableIoItem> GetAoList(string key)
  134. {
  135. var ret = IO.GetAoList(key);
  136. List<NotifiableIoItem> result = new List<NotifiableIoItem>();
  137. ret.ForEach(x => result.Add(new NotifiableIoItem()
  138. {
  139. Address = x.Addr,
  140. Name = x.Name,
  141. Description = x.Description,
  142. Index = x.Index,
  143. ShortValue = (short)x.Value,
  144. Provider = x.Provider,
  145. BlockOffset = x.BlockOffset,
  146. BlockIndex = x.Index,
  147. }));
  148. return result;
  149. }
  150. public List<EventItem> QueryDBEvent(string sql)
  151. {
  152. return EV.QueryDBEvent(sql);
  153. }
  154. public List<HistoryCarrierData> QueryDBCarrier(string sql)
  155. {
  156. return CarrierDataRecorder.QueryDBCarrier(sql);
  157. }
  158. public List<HistoryStatisticsOCRData> QueryDBOCRStatistics(string sql)
  159. {
  160. return OCRDataRecorder.QueryDBOCRStatistics(sql);
  161. }
  162. public List<HistoryFfuDiffPressureData> QueryDBFfuDiffPressureStatistics(string sql)
  163. {
  164. return FfuDiffPressureDataRecorder.FfuDiffPressureHistory(sql);
  165. }
  166. public List<HistoryOCRData> QueryDBOCRHistory(string sql)
  167. {
  168. return OCRDataRecorder.QueryDBOCRHistory(sql);
  169. }
  170. public List<StatsStatisticsData> QueryStatsDBStatistics(string sql)
  171. {
  172. List<StatsStatisticsData> statsStatisticsDatas = new List<StatsStatisticsData>();
  173. return StatsDataRecorder.QueryStatsStatistics(sql);
  174. }
  175. public List<HistoryProcessData> QueryDBProcess(string sql)
  176. {
  177. return ProcessDataRecorder.QueryDBProcess(sql);
  178. }
  179. public List<HistoryWaferData> QueryDBWafer(string sql)
  180. {
  181. return WaferDataRecorder.QueryDBWafer(sql);
  182. }
  183. public List<HistoryMoveData> QueryDBMovement(string sql)
  184. {
  185. return WaferMoveHistoryRecorder.QueryDBMovement(sql);
  186. }
  187. public List<HistoryJobMoveData> QueryDBJobMovementByJobGuid(string jobGuid)
  188. {
  189. return JobMoveHistoryRecorder.QueryJobMovement(jobGuid);
  190. }
  191. public List<HistoryJobMoveData> QueryDBJobMovementByJobGuidAndStationName(string jobGuid, string stationName)
  192. {
  193. return JobMoveHistoryRecorder.QueryJobMovement(jobGuid, stationName);
  194. }
  195. public List<HistoryDataItem> GetHistoryData(IEnumerable<string> keys, string recipeRunGuid, string module)
  196. {
  197. return ProcessDataRecorder.GetHistoryData(keys, recipeRunGuid, module);
  198. }
  199. public List<HistoryDataItem> GetOneDayHistoryData(IEnumerable<string> keys, DateTime begin, string module)
  200. {
  201. return ProcessDataRecorder.GetOneDayHistoryData(keys, begin, module);
  202. }
  203. public List<HistoryDataItem> GetHistoryDataFromStartToEnd(IEnumerable<string> keys, DateTime begin, DateTime end, string module)
  204. {
  205. return ProcessDataRecorder.GetHistoryDataFromStartToEnd(keys, begin, end, module);
  206. }
  207. public DataTable QueryData(string sql)
  208. {
  209. return DataQuery.Query(sql);
  210. }
  211. public List<WaferHistoryWafer> GetWaferHistoryWafers(string id)
  212. {
  213. return WaferDataRecorder.GetWaferHistoryWafers(id);
  214. }
  215. public WaferHistoryRecipe GetWaferHistoryRecipe(string id)
  216. {
  217. return RecipeDataRecorder.GetWaferHistoryRecipe(id);
  218. }
  219. public List<WaferHistoryRecipe> GetWaferHistoryRecipes(string id)
  220. {
  221. return RecipeDataRecorder.GetWaferHistoryRecipes(id);
  222. }
  223. public List<WaferHistorySecquence> GetWaferHistorySecquences(string id)
  224. {
  225. return RecipeDataRecorder.GetWaferHistorySecquences(id);
  226. }
  227. public List<WaferHistoryMovement> GetWaferHistoryMovements(string id)
  228. {
  229. return WaferMoveHistoryRecorder.GetWaferHistoryMovements(id);
  230. }
  231. public List<WaferHistoryLot> QueryWaferHistoryLotsBySql(string sql)
  232. {
  233. return CarrierDataRecorder.QueryWaferHistoryLotsBySql(sql);
  234. }
  235. public List<WaferHistoryLot> GetWaferHistoryLots(DateTime startTime, DateTime endTime, string keyWord)
  236. {
  237. return CarrierDataRecorder.GetWaferHistoryLots(startTime, endTime, keyWord);
  238. }
  239. public string GetTypedConfigContent(string type, string contentPath)
  240. {
  241. return TypedConfigManager.Instance.GetTypedConfigContent(type, contentPath);
  242. }
  243. public void SetTypedConfigContent(string type, string contentPath, string content)
  244. {
  245. TypedConfigManager.Instance.SetTypedConfigContent(type, contentPath, content);
  246. }
  247. public List<string> GetExpertLayoutRecipeContent(string chamberId, string recipeFile)
  248. {
  249. return RecipeFileManager.Instance.ExpertLayoutRecipeParse(chamberId, recipeFile);
  250. }
  251. public List<string> GetLayoutRecipeContent(/*string chamberId, */string recipeContent, string slotCount, string cassetteSlotCount)
  252. {
  253. return RecipeFileManager.Instance.LayoutRecipeParse(/*chamberId, */recipeContent, slotCount, cassetteSlotCount);
  254. }
  255. public List<string> GetLayoutExpertRecipeContent(/*string chamberId, */string recipeContent, string slotCount, string cassetteSlotCount)
  256. {
  257. return RecipeFileManager.Instance.LayoutExpertRecipeParse(/*chamberId, */recipeContent, slotCount, cassetteSlotCount);
  258. }
  259. public string GetInterlockConfigContent()
  260. {
  261. return Singleton<InterlockManager>.Instance.GetInterlockConfigContent();
  262. }
  263. public string GetInterlockUserDefineConfigContent()
  264. {
  265. return Singleton<InterlockManager>.Instance.GetInterlockUserDefineConfigContent();
  266. }
  267. public void SetInterlockConfigContent(string content)
  268. {
  269. Singleton<InterlockManager>.Instance.SetInterlockConfigContent(content);
  270. }
  271. public List<RecipeHistory> QueryByRecipePathHistory(string RecipePath, int row = 20)
  272. {
  273. return RecipeEditHistoryRecorder.QueryByRecipePathHistory(RecipePath, 20);
  274. }
  275. public bool ClearByRecipePathHistory(string RecipePath)
  276. {
  277. return RecipeEditHistoryRecorder.ClearByRecipePathHistory(RecipePath);
  278. }
  279. }
  280. }