QueryDataService.cs 11 KB

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