ParameterServiceClient.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Collections.ObjectModel;
  4. using Aitex.Core.Util;
  5. using Aitex.Core.WCF;
  6. using MECF.Framework.Common.CommonData;
  7. using MECF.Framework.Common.Equipment;
  8. namespace MECF.Framework.Common.ParameterCenter
  9. {
  10. public class ParameterClient : Singleton<ParameterClient>
  11. {
  12. public bool InProcess { get; set; }
  13. private IParameterService _service;
  14. public IParameterService Service
  15. {
  16. get
  17. {
  18. if (_service == null)
  19. {
  20. if (InProcess)
  21. _service = new ParameterService();
  22. else
  23. _service = new ParameterServiceClient();
  24. }
  25. return _service;
  26. }
  27. }
  28. }
  29. public class ParameterServiceClient : ServiceClientWrapper<IParameterService>, IParameterService
  30. {
  31. public ParameterServiceClient()
  32. : base("Client_IParameterService", "ParameterService")
  33. {
  34. }
  35. public string LoadParameter(ModuleName chamId, string recipeName)
  36. {
  37. string result = null;
  38. Invoke(svc => { result = svc.LoadParameter(chamId, recipeName); });
  39. return result;
  40. }
  41. public Tuple<string, string> LoadRunTimeParameterInfo(ModuleName chamId)
  42. {
  43. Tuple<string, string> result = null;
  44. Invoke(svc => { result = svc.LoadRunTimeParameterInfo(chamId); });
  45. return result;
  46. }
  47. public IEnumerable<string> GetParameters(ModuleName chamId, bool includeUsedRecipe)
  48. {
  49. IEnumerable<string> result = null;
  50. Invoke(svc => { result = svc.GetParameters(chamId, includeUsedRecipe); });
  51. return result;
  52. }
  53. public string GetXmlParameterList(ModuleName chamId, bool includeUsedParameter)
  54. {
  55. string result = null;
  56. Invoke(svc => { result = svc.GetXmlParameterList(chamId, includeUsedParameter); });
  57. return result;
  58. }
  59. public bool DeleteParameter(ModuleName chamId, string recipeName)
  60. {
  61. bool result = false;
  62. Invoke(svc => { result = svc.DeleteParameter(chamId, recipeName); });
  63. return result;
  64. }
  65. public bool DeleteFolder(ModuleName chamId, string folderName)
  66. {
  67. bool result = false;
  68. Invoke(svc => { result = svc.DeleteFolder(chamId, folderName); });
  69. return result;
  70. }
  71. public bool SaveAsParameter(ModuleName chamId, string recipeName, string recipeContent)
  72. {
  73. bool result = false;
  74. Invoke(svc => { result = svc.SaveAsParameter(chamId, recipeName, recipeContent); });
  75. return result;
  76. }
  77. public bool SaveParameter(ModuleName chamId, string recipeName, string recipeContent)
  78. {
  79. bool result = false;
  80. Invoke(svc => { result = svc.SaveParameter(chamId, recipeName, recipeContent); });
  81. return result;
  82. }
  83. public bool CreateFolder(ModuleName chamId, string folderName)
  84. {
  85. bool result = false;
  86. Invoke(svc => { result = svc.CreateFolder(chamId, folderName); });
  87. return result;
  88. }
  89. public bool RenameParameter(ModuleName chamId, string oldName, string newName)
  90. {
  91. bool result = false;
  92. Invoke(svc => { result = svc.RenameParameter(chamId, oldName, newName); });
  93. return result;
  94. }
  95. public bool BackupParameter(string fileOriginalPath, string fileDestinationPath, bool isSaveLinkRecipe, List<string> recipeNames)
  96. {
  97. bool result = false;
  98. Invoke(svc => { result = svc.BackupParameter(fileOriginalPath, fileDestinationPath, isSaveLinkRecipe,recipeNames); });
  99. return result;
  100. }
  101. public bool CheckBackParameterIsLinkParameter(string fileOriginalPath, List<string> recipeNames)
  102. {
  103. bool result = false;
  104. Invoke(svc => { result = svc.CheckBackParameterIsLinkParameter(fileOriginalPath, recipeNames); });
  105. return result;
  106. }
  107. public List<string> RestoreParameterFolderList()
  108. {
  109. List<string> result = new List<string>();
  110. Invoke(svc => { result = svc.RestoreParameterFolderList(); });
  111. return result;
  112. }
  113. public string GetXmlRestoreParameterList(string fileType, bool includeUsedRecipe)
  114. {
  115. string result = null;
  116. Invoke(svc => { result = svc.GetXmlRestoreParameterList(fileType, includeUsedRecipe); });
  117. return result;
  118. }
  119. public string LoadRestoreParameter(string pathName, string recipeName)
  120. {
  121. string result = null;
  122. Invoke(svc => { result = svc.LoadRestoreParameter(pathName, recipeName); });
  123. return result;
  124. }
  125. public bool RestoreParameter(string chamId,bool isSaveLink, List<string> recipeNames)
  126. {
  127. bool result = false;
  128. Invoke(svc => { result = svc.RestoreParameter(chamId, isSaveLink,recipeNames); });
  129. return result;
  130. }
  131. public bool SigRestoreParameter(string chamId, List<string> recipeNames)
  132. {
  133. bool result = false;
  134. Invoke(svc => { result = svc.SigRestoreParameter(chamId, recipeNames); });
  135. return result;
  136. }
  137. public bool RenameFolder(ModuleName chamId, string oldName, string newName)
  138. {
  139. bool result = false;
  140. Invoke(svc => { result = svc.RenameFolder(chamId, oldName, newName); });
  141. return result;
  142. }
  143. public string GetParameterFormatXml(string chamId)
  144. {
  145. string result = null;
  146. Invoke(svc => { result = svc.GetParameterFormatXml(chamId); });
  147. return result;
  148. }
  149. public Dictionary<string, ObservableCollection<ParameterTemplateColumnBase>> GetGroupParameterTemplate()
  150. {
  151. Dictionary<string, ObservableCollection<ParameterTemplateColumnBase>> result = null;
  152. Invoke(svc => { result = svc.GetGroupParameterTemplate(); });
  153. return result;
  154. }
  155. public string GetParameterTemplate(ModuleName chamId)
  156. {
  157. string result = string.Empty;
  158. Invoke(svc => { result = svc.GetParameterTemplate(chamId); });
  159. return result;
  160. }
  161. public string GetParameterByBarcode(ModuleName chamId, string barcode)
  162. {
  163. string result = string.Empty;
  164. Invoke(svc => { result = svc.GetParameterByBarcode(chamId, barcode); });
  165. return result;
  166. }
  167. #region extended recipe interface
  168. public string LoadParameterByPath(string pathName, string recipeName)
  169. {
  170. string result = null;
  171. Invoke(svc => { result = svc.LoadParameterByPath(pathName, recipeName); });
  172. return result;
  173. }
  174. public Tuple<string, string> LoadRunTimeParameterInfoByPath(string pathName)
  175. {
  176. Tuple<string, string> result = null;
  177. Invoke(svc => { result = svc.LoadRunTimeParameterInfoByPath(pathName); });
  178. return result;
  179. }
  180. public IEnumerable<string> GetParametersByPath(string pathName, bool includeUsedRecipe)
  181. {
  182. IEnumerable<string> result = null;
  183. Invoke(svc => { result = svc.GetParametersByPath(pathName, includeUsedRecipe); });
  184. return result;
  185. }
  186. public string GetXmlParameterListByPath(string pathName, bool includeUsedRecipe)
  187. {
  188. string result = null;
  189. Invoke(svc => { result = svc.GetXmlParameterListByPath(pathName, includeUsedRecipe); });
  190. return result;
  191. }
  192. public List<FileNodeItem> GetFileNodeParameterListByPath(string pathName)
  193. {
  194. List<FileNodeItem> result = null;
  195. Invoke(svc => { result = svc.GetFileNodeParameterListByPath(pathName); });
  196. return result;
  197. }
  198. public bool DeleteParameterByPath(string pathName, string recipeName)
  199. {
  200. bool result = false;
  201. Invoke(svc => { result = svc.DeleteParameterByPath(pathName, recipeName); });
  202. return result;
  203. }
  204. public bool DeleteFolderByPath(string pathName, string folderName)
  205. {
  206. bool result = false;
  207. Invoke(svc => { result = svc.DeleteFolderByPath(pathName, folderName); });
  208. return result;
  209. }
  210. public bool SaveAsParameterByPath(string pathName, string recipeName, string recipeContent)
  211. {
  212. bool result = false;
  213. Invoke(svc => { result = svc.SaveAsParameterByPath(pathName, recipeName, recipeContent); });
  214. return result;
  215. }
  216. public bool SaveParameterByPath(string pathName, string recipeName, string recipeContent)
  217. {
  218. bool result = false;
  219. Invoke(svc => { result = svc.SaveParameterByPath(pathName, recipeName, recipeContent); });
  220. return result;
  221. }
  222. public bool CreateFolderByPath(string pathName, string folderName)
  223. {
  224. bool result = false;
  225. Invoke(svc => { result = svc.CreateFolderByPath(pathName, folderName); });
  226. return result;
  227. }
  228. public bool RenameParameterByPath(string pathName, string oldName, string newName)
  229. {
  230. bool result = false;
  231. Invoke(svc => { result = svc.RenameParameterByPath(pathName, oldName, newName); });
  232. return result;
  233. }
  234. public bool RenameFolderByPath(string pathName, string oldName, string newName)
  235. {
  236. bool result = false;
  237. Invoke(svc => { result = svc.RenameFolderByPath(pathName, oldName, newName); });
  238. return result;
  239. }
  240. public string GetParameterFormatXmlByPath(string pathName)
  241. {
  242. string result = null;
  243. Invoke(svc => { result = svc.GetParameterFormatXmlByPath(pathName); });
  244. return result;
  245. }
  246. public string GetParameterTemplateByPath(string pathName)
  247. {
  248. string result = string.Empty;
  249. Invoke(svc => { result = svc.GetParameterTemplateByPath(pathName); });
  250. return result;
  251. }
  252. public string GetParameterByBarcodeByPath(string pathName, string barcode)
  253. {
  254. string result = string.Empty;
  255. Invoke(svc => { result = svc.GetParameterByBarcodeByPath(pathName, barcode); });
  256. return result;
  257. }
  258. public List<string> CheckParameter(string prefix, string recipeName)
  259. {
  260. List<string> result = null;
  261. Invoke(svc => { result = svc.CheckParameter(prefix, recipeName); });
  262. return result;
  263. }
  264. public bool GetParameterChecked(string prefix, string recipeName)
  265. {
  266. bool result = false;
  267. Invoke(svc => { result = svc.GetParameterChecked(prefix, recipeName); });
  268. return result;
  269. }
  270. #endregion
  271. }
  272. }