RecipeServiceClient.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408
  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.RecipeCenter
  9. {
  10. public class RecipeClient : Singleton<RecipeClient>
  11. {
  12. public bool InProcess { get; set; }
  13. private IRecipeService _service;
  14. public IRecipeService Service
  15. {
  16. get
  17. {
  18. if (_service == null)
  19. {
  20. if (InProcess)
  21. _service = new RecipeService();
  22. else
  23. _service = new RecipeServiceClient();
  24. }
  25. return _service;
  26. }
  27. }
  28. }
  29. public class RecipeServiceClient : ServiceClientWrapper<IRecipeService>, IRecipeService
  30. {
  31. public RecipeServiceClient()
  32. : base("Client_IRecipeService", "RecipeService")
  33. {
  34. }
  35. public string LoadRecipe(ModuleName chamId, string recipeName)
  36. {
  37. string result = null;
  38. Invoke(svc => { result = svc.LoadRecipe(chamId, recipeName); });
  39. return result;
  40. }
  41. public Tuple<string, string> LoadRunTimeRecipeInfo(ModuleName chamId)
  42. {
  43. Tuple<string, string> result = null;
  44. Invoke(svc => { result = svc.LoadRunTimeRecipeInfo(chamId); });
  45. return result;
  46. }
  47. public IEnumerable<string> GetRecipes(ModuleName chamId, bool includeUsedRecipe)
  48. {
  49. IEnumerable<string> result = null;
  50. Invoke(svc => { result = svc.GetRecipes(chamId, includeUsedRecipe); });
  51. return result;
  52. }
  53. public string GetXmlRecipeList(ModuleName chamId, bool includeUsedRecipe)
  54. {
  55. string result = null;
  56. Invoke(svc => { result = svc.GetXmlRecipeList(chamId, includeUsedRecipe); });
  57. return result;
  58. }
  59. public bool DeleteRecipe(ModuleName chamId, string recipeName)
  60. {
  61. bool result = false;
  62. Invoke(svc => { result = svc.DeleteRecipe(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 SaveAsRecipe(ModuleName chamId, string recipeName, string recipeContent)
  72. {
  73. bool result = false;
  74. Invoke(svc => { result = svc.SaveAsRecipe(chamId, recipeName, recipeContent); });
  75. return result;
  76. }
  77. public bool SaveRecipe(ModuleName chamId, string recipeName, string recipeContent)
  78. {
  79. bool result = false;
  80. Invoke(svc => { result = svc.SaveRecipe(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 RenameRecipe(ModuleName chamId, string oldName, string newName)
  90. {
  91. bool result = false;
  92. Invoke(svc => { result = svc.RenameRecipe(chamId, oldName, newName); });
  93. return result;
  94. }
  95. public bool BackupRecipe(string fileOriginalPath, string fileDestinationPath, bool isSaveLinkRecipe, List<string> recipeNames)
  96. {
  97. bool result = false;
  98. Invoke(svc => { result = svc.BackupRecipe(fileOriginalPath, fileDestinationPath, isSaveLinkRecipe,recipeNames); });
  99. return result;
  100. }
  101. public bool CheckBackRecipeIsLinkRecipe(string fileOriginalPath, List<string> recipeNames)
  102. {
  103. bool result = false;
  104. Invoke(svc => { result = svc.CheckBackRecipeIsLinkRecipe(fileOriginalPath, recipeNames); });
  105. return result;
  106. }
  107. public List<string> RestoreRecipeFolderList()
  108. {
  109. List<string> result = new List<string>();
  110. Invoke(svc => { result = svc.RestoreRecipeFolderList(); });
  111. return result;
  112. }
  113. public string GetXmlRestoreRecipeList(string fileType, bool includeUsedRecipe)
  114. {
  115. string result = null;
  116. Invoke(svc => { result = svc.GetXmlRestoreRecipeList(fileType, includeUsedRecipe); });
  117. return result;
  118. }
  119. public string LoadRestoreRecipe(string pathName, string recipeName)
  120. {
  121. string result = null;
  122. Invoke(svc => { result = svc.LoadRestoreRecipe(pathName, recipeName); });
  123. return result;
  124. }
  125. public bool RestoreRecipe(string chamId,bool isSaveLink, List<string> recipeNames)
  126. {
  127. bool result = false;
  128. Invoke(svc => { result = svc.RestoreRecipe(chamId, isSaveLink,recipeNames); });
  129. return result;
  130. }
  131. public bool CheckRestoreRecipeIsLinkRecipe(string fileOriginalPath, List<string> recipeNames)
  132. {
  133. bool result = false;
  134. Invoke(svc => { result = svc.CheckRestoreRecipeIsLinkRecipe(fileOriginalPath, recipeNames); });
  135. return result;
  136. }
  137. public bool SigRestoreRecipe(string chamId, List<string> recipeNames)
  138. {
  139. bool result = false;
  140. Invoke(svc => { result = svc.SigRestoreRecipe(chamId, recipeNames); });
  141. return result;
  142. }
  143. public bool RenameFolder(ModuleName chamId, string oldName, string newName)
  144. {
  145. bool result = false;
  146. Invoke(svc => { result = svc.RenameFolder(chamId, oldName, newName); });
  147. return result;
  148. }
  149. public string GetRecipeFormatXml(ModuleName chamId)
  150. {
  151. string result = null;
  152. Invoke(svc => { result = svc.GetRecipeFormatXml(chamId); });
  153. return result;
  154. }
  155. public Dictionary<string, ObservableCollection<RecipeTemplateColumnBase>> GetGroupRecipeTemplate()
  156. {
  157. Dictionary<string, ObservableCollection<RecipeTemplateColumnBase>> result = null;
  158. Invoke(svc => { result = svc.GetGroupRecipeTemplate(); });
  159. return result;
  160. }
  161. public string GetRecipeTemplate(ModuleName chamId)
  162. {
  163. string result = string.Empty;
  164. Invoke(svc => { result = svc.GetRecipeTemplate(chamId); });
  165. return result;
  166. }
  167. public string GetRecipeByBarcode(ModuleName chamId, string barcode)
  168. {
  169. string result = string.Empty;
  170. Invoke(svc => { result = svc.GetRecipeByBarcode(chamId, barcode); });
  171. return result;
  172. }
  173. public string GetXmlSequenceList(ModuleName chamId)
  174. {
  175. string result = null;
  176. Invoke(svc => { result = svc.GetXmlSequenceList(chamId); });
  177. return result;
  178. }
  179. public string GetSequence(string sequenceName)
  180. {
  181. string result = string.Empty;
  182. Invoke(svc => { result = svc.GetSequence(sequenceName); });
  183. return result;
  184. }
  185. public List<string> GetSequenceNameList()
  186. {
  187. List<string> result = null;
  188. Invoke(svc => { result = svc.GetSequenceNameList(); });
  189. return result;
  190. }
  191. public bool DeleteSequence(string sequenceName)
  192. {
  193. bool result = false;
  194. Invoke(svc => { result = svc.DeleteSequence(sequenceName); });
  195. return result;
  196. }
  197. public bool SaveSequence(string sequenceName, string sequenceContent)
  198. {
  199. bool result = false;
  200. Invoke(svc => { result = svc.SaveSequence(sequenceName, sequenceContent); });
  201. return result;
  202. }
  203. public bool SaveAsSequence(string sequenceName, string sequenceContent)
  204. {
  205. bool result = false;
  206. Invoke(svc => { result = svc.SaveAsSequence(sequenceName, sequenceContent); });
  207. return result;
  208. }
  209. public bool RenameSequence(string oldName, string newName)
  210. {
  211. bool result = false;
  212. Invoke(svc => { result = svc.RenameSequence(oldName, newName); });
  213. return result;
  214. }
  215. public string GetSequenceFormatXml()
  216. {
  217. string result = string.Empty;
  218. Invoke(svc => { result = svc.GetSequenceFormatXml(); });
  219. return result;
  220. }
  221. public bool RenameSequenceFolder(string oldName, string newName)
  222. {
  223. bool result = false;
  224. Invoke(svc => { result = svc.RenameSequenceFolder(oldName, newName); });
  225. return result;
  226. }
  227. public bool CreateSequenceFolder(string folderName)
  228. {
  229. bool result = false;
  230. Invoke(svc => { result = svc.CreateSequenceFolder(folderName); });
  231. return result;
  232. }
  233. public bool DeleteSequenceFolder(string folderName)
  234. {
  235. bool result = false;
  236. Invoke(svc => { result = svc.DeleteSequenceFolder(folderName); });
  237. return result;
  238. }
  239. #region extended recipe interface
  240. public string LoadRecipeByPath(string pathName, string recipeName)
  241. {
  242. string result = null;
  243. Invoke(svc => { result = svc.LoadRecipeByPath(pathName, recipeName); });
  244. return result;
  245. }
  246. public Tuple<string, string> LoadRunTimeRecipeInfoByPath(string pathName)
  247. {
  248. Tuple<string, string> result = null;
  249. Invoke(svc => { result = svc.LoadRunTimeRecipeInfoByPath(pathName); });
  250. return result;
  251. }
  252. public IEnumerable<string> GetRecipesByPath(string pathName, bool includeUsedRecipe)
  253. {
  254. IEnumerable<string> result = null;
  255. Invoke(svc => { result = svc.GetRecipesByPath(pathName, includeUsedRecipe); });
  256. return result;
  257. }
  258. public string GetXmlRecipeListByPath(string pathName, bool includeUsedRecipe)
  259. {
  260. string result = null;
  261. Invoke(svc => { result = svc.GetXmlRecipeListByPath(pathName, includeUsedRecipe); });
  262. return result;
  263. }
  264. public bool DeleteRecipeByPath(string pathName, string recipeName)
  265. {
  266. bool result = false;
  267. Invoke(svc => { result = svc.DeleteRecipeByPath(pathName, recipeName); });
  268. return result;
  269. }
  270. public bool DeleteFolderByPath(string pathName, string folderName)
  271. {
  272. bool result = false;
  273. Invoke(svc => { result = svc.DeleteFolderByPath(pathName, folderName); });
  274. return result;
  275. }
  276. public bool SaveAsRecipeByPath(string pathName, string recipeName, string recipeContent)
  277. {
  278. bool result = false;
  279. Invoke(svc => { result = svc.SaveAsRecipeByPath(pathName, recipeName, recipeContent); });
  280. return result;
  281. }
  282. public bool SaveRecipeByPath(string pathName, string recipeName, string recipeContent)
  283. {
  284. bool result = false;
  285. Invoke(svc => { result = svc.SaveRecipeByPath(pathName, recipeName, recipeContent); });
  286. return result;
  287. }
  288. public bool CreateFolderByPath(string pathName, string folderName)
  289. {
  290. bool result = false;
  291. Invoke(svc => { result = svc.CreateFolderByPath(pathName, folderName); });
  292. return result;
  293. }
  294. public bool RenameRecipeByPath(string pathName, string oldName, string newName)
  295. {
  296. bool result = false;
  297. Invoke(svc => { result = svc.RenameRecipeByPath(pathName, oldName, newName); });
  298. return result;
  299. }
  300. public bool RenameFolderByPath(string pathName, string oldName, string newName)
  301. {
  302. bool result = false;
  303. Invoke(svc => { result = svc.RenameFolderByPath(pathName, oldName, newName); });
  304. return result;
  305. }
  306. public string GetRecipeFormatXmlByPath(string pathName)
  307. {
  308. string result = null;
  309. Invoke(svc => { result = svc.GetRecipeFormatXmlByPath(pathName); });
  310. return result;
  311. }
  312. public string GetRecipeTemplateByPath(string pathName)
  313. {
  314. string result = string.Empty;
  315. Invoke(svc => { result = svc.GetRecipeTemplateByPath(pathName); });
  316. return result;
  317. }
  318. public string GetRecipeByBarcodeByPath(string pathName, string barcode)
  319. {
  320. string result = string.Empty;
  321. Invoke(svc => { result = svc.GetRecipeByBarcodeByPath(pathName, barcode); });
  322. return result;
  323. }
  324. public List<string> CheckRecipe(string prefix, string recipeName)
  325. {
  326. List<string> result = null;
  327. Invoke(svc => { result = svc.CheckRecipe(prefix, recipeName); });
  328. return result;
  329. }
  330. public bool GetRecipeChecked(string prefix, string recipeName)
  331. {
  332. bool result = false;
  333. Invoke(svc => { result = svc.GetRecipeChecked(prefix, recipeName); });
  334. return result;
  335. }
  336. public string LoadRecipeByFullPath(string fullPath)
  337. {
  338. string result = null;
  339. Invoke(svc => { result = svc.LoadRecipeByFullPath(fullPath); });
  340. return result;
  341. }
  342. public List<RecipeFileNode> GetRecipeByPathFileNodes(string prefix, string recipeName)
  343. {
  344. List<RecipeFileNode> result = null;
  345. Invoke(svc => { result = svc.GetRecipeByPathFileNodes(prefix, recipeName); });
  346. return result;
  347. }
  348. public List<FileNodeItem> GetFileNodeParameterListByPath(string pathName)
  349. {
  350. List<FileNodeItem> result = null;
  351. Invoke(svc => { result = svc.GetFileNodeParameterListByPath(pathName); });
  352. return result;
  353. }
  354. #endregion
  355. }
  356. }