RecipeServiceClient.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  1. using System;
  2. using System.Collections.Generic;
  3. using Aitex.Core.Util;
  4. using Aitex.Core.WCF;
  5. using MECF.Framework.Common.Equipment;
  6. namespace MECF.Framework.Common.RecipeCenter
  7. {
  8. public class RecipeClient : Singleton<RecipeClient>
  9. {
  10. public bool InProcess { get; set; }
  11. private IRecipeService _service;
  12. public IRecipeService Service
  13. {
  14. get
  15. {
  16. if (_service == null)
  17. {
  18. if (InProcess)
  19. _service = new RecipeService();
  20. else
  21. _service = new RecipeServiceClient();
  22. }
  23. return _service;
  24. }
  25. }
  26. }
  27. public class RecipeServiceClient : ServiceClientWrapper<IRecipeService>, IRecipeService
  28. {
  29. public RecipeServiceClient()
  30. : base("Client_IRecipeService", "RecipeService")
  31. {
  32. }
  33. public string LoadRecipe(ModuleName chamId, string recipeName)
  34. {
  35. string result = null;
  36. Invoke(svc => { result = svc.LoadRecipe(chamId, recipeName); });
  37. return result;
  38. }
  39. public Tuple<string, string> LoadRunTimeRecipeInfo(ModuleName chamId)
  40. {
  41. Tuple<string, string> result = null;
  42. Invoke(svc => { result = svc.LoadRunTimeRecipeInfo(chamId); });
  43. return result;
  44. }
  45. public IEnumerable<string> GetRecipes(ModuleName chamId, bool includeUsedRecipe)
  46. {
  47. IEnumerable<string> result = null;
  48. Invoke(svc => { result = svc.GetRecipes(chamId, includeUsedRecipe); });
  49. return result;
  50. }
  51. public string GetXmlRecipeList(ModuleName chamId, bool includeUsedRecipe)
  52. {
  53. string result = null;
  54. Invoke(svc => { result = svc.GetXmlRecipeList(chamId, includeUsedRecipe); });
  55. return result;
  56. }
  57. public bool DeleteRecipe(ModuleName chamId, string recipeName)
  58. {
  59. bool result = false;
  60. Invoke(svc => { result = svc.DeleteRecipe(chamId, recipeName); });
  61. return result;
  62. }
  63. public bool DeleteFolder(ModuleName chamId, string folderName)
  64. {
  65. bool result = false;
  66. Invoke(svc => { result = svc.DeleteFolder(chamId, folderName); });
  67. return result;
  68. }
  69. public bool SaveAsRecipe(ModuleName chamId, string recipeName, string recipeContent)
  70. {
  71. bool result = false;
  72. Invoke(svc => { result = svc.SaveAsRecipe(chamId, recipeName, recipeContent); });
  73. return result;
  74. }
  75. public bool SaveRecipe(ModuleName chamId, string recipeName, string recipeContent)
  76. {
  77. bool result = false;
  78. Invoke(svc => { result = svc.SaveRecipe(chamId, recipeName, recipeContent); });
  79. return result;
  80. }
  81. public bool CreateFolder(ModuleName chamId, string folderName)
  82. {
  83. bool result = false;
  84. Invoke(svc => { result = svc.CreateFolder(chamId, folderName); });
  85. return result;
  86. }
  87. public bool RenameRecipe(ModuleName chamId, string oldName, string newName)
  88. {
  89. bool result = false;
  90. Invoke(svc => { result = svc.RenameRecipe(chamId, oldName, newName); });
  91. return result;
  92. }
  93. public bool RenameFolder(ModuleName chamId, string oldName, string newName)
  94. {
  95. bool result = false;
  96. Invoke(svc => { result = svc.RenameFolder(chamId, oldName, newName); });
  97. return result;
  98. }
  99. public string GetRecipeFormatXml(ModuleName chamId)
  100. {
  101. string result = null;
  102. Invoke(svc => { result = svc.GetRecipeFormatXml(chamId); });
  103. return result;
  104. }
  105. public string GetRecipeTemplate(ModuleName chamId)
  106. {
  107. string result = string.Empty;
  108. Invoke(svc => { result = svc.GetRecipeTemplate(chamId); });
  109. return result;
  110. }
  111. public string GetRecipeByBarcode(ModuleName chamId, string barcode)
  112. {
  113. string result = string.Empty;
  114. Invoke(svc => { result = svc.GetRecipeByBarcode(chamId, barcode); });
  115. return result;
  116. }
  117. public string GetXmlSequenceList(ModuleName chamId)
  118. {
  119. string result = null;
  120. Invoke(svc => { result = svc.GetXmlSequenceList(chamId); });
  121. return result;
  122. }
  123. public string GetSequence(string sequenceName)
  124. {
  125. string result = string.Empty;
  126. Invoke(svc => { result = svc.GetSequence(sequenceName); });
  127. return result;
  128. }
  129. public List<string> GetSequenceNameList()
  130. {
  131. List<string> result = null;
  132. Invoke(svc => { result = svc.GetSequenceNameList(); });
  133. return result;
  134. }
  135. public bool DeleteSequence(string sequenceName)
  136. {
  137. bool result = false;
  138. Invoke(svc => { result = svc.DeleteSequence(sequenceName); });
  139. return result;
  140. }
  141. public bool SaveSequence(string sequenceName, string sequenceContent)
  142. {
  143. bool result = false;
  144. Invoke(svc => { result = svc.SaveSequence(sequenceName, sequenceContent); });
  145. return result;
  146. }
  147. public bool SaveAsSequence(string sequenceName, string sequenceContent)
  148. {
  149. bool result = false;
  150. Invoke(svc => { result = svc.SaveAsSequence(sequenceName, sequenceContent); });
  151. return result;
  152. }
  153. public bool RenameSequence(string oldName, string newName)
  154. {
  155. bool result = false;
  156. Invoke(svc => { result = svc.RenameSequence(oldName, newName); });
  157. return result;
  158. }
  159. public string GetSequenceFormatXml()
  160. {
  161. string result = string.Empty;
  162. Invoke(svc => { result = svc.GetSequenceFormatXml(); });
  163. return result;
  164. }
  165. public bool RenameSequenceFolder(string oldName, string newName)
  166. {
  167. bool result = false;
  168. Invoke(svc => { result = svc.RenameSequenceFolder(oldName, newName); });
  169. return result;
  170. }
  171. public bool CreateSequenceFolder(string folderName)
  172. {
  173. bool result = false;
  174. Invoke(svc => { result = svc.CreateSequenceFolder(folderName); });
  175. return result;
  176. }
  177. public bool DeleteSequenceFolder(string folderName)
  178. {
  179. bool result = false;
  180. Invoke(svc => { result = svc.DeleteSequenceFolder(folderName); });
  181. return result;
  182. }
  183. #region extended recipe interface
  184. public string LoadRecipeByPath(string pathName, string recipeName)
  185. {
  186. string result = null;
  187. Invoke(svc => { result = svc.LoadRecipeByPath(pathName, recipeName); });
  188. return result;
  189. }
  190. public Tuple<string, string> LoadRunTimeRecipeInfoByPath(string pathName)
  191. {
  192. Tuple<string, string> result = null;
  193. Invoke(svc => { result = svc.LoadRunTimeRecipeInfoByPath(pathName); });
  194. return result;
  195. }
  196. public IEnumerable<string> GetRecipesByPath(string pathName, bool includeUsedRecipe)
  197. {
  198. IEnumerable<string> result = null;
  199. Invoke(svc => { result = svc.GetRecipesByPath(pathName, includeUsedRecipe); });
  200. return result;
  201. }
  202. public string GetXmlRecipeListByPath(string pathName, bool includeUsedRecipe)
  203. {
  204. string result = null;
  205. Invoke(svc => { result = svc.GetXmlRecipeListByPath(pathName, includeUsedRecipe); });
  206. return result;
  207. }
  208. public bool DeleteRecipeByPath(string pathName, string recipeName)
  209. {
  210. bool result = false;
  211. Invoke(svc => { result = svc.DeleteRecipeByPath(pathName, recipeName); });
  212. return result;
  213. }
  214. public bool DeleteFolderByPath(string pathName, string folderName)
  215. {
  216. bool result = false;
  217. Invoke(svc => { result = svc.DeleteFolderByPath(pathName, folderName); });
  218. return result;
  219. }
  220. public bool SaveAsRecipeByPath(string pathName, string recipeName, string recipeContent)
  221. {
  222. bool result = false;
  223. Invoke(svc => { result = svc.SaveAsRecipeByPath(pathName, recipeName, recipeContent); });
  224. return result;
  225. }
  226. public bool SaveRecipeByPath(string pathName, string recipeName, string recipeContent)
  227. {
  228. bool result = false;
  229. Invoke(svc => { result = svc.SaveRecipeByPath(pathName, recipeName, recipeContent); });
  230. return result;
  231. }
  232. public bool CreateFolderByPath(string pathName, string folderName)
  233. {
  234. bool result = false;
  235. Invoke(svc => { result = svc.CreateFolderByPath(pathName, folderName); });
  236. return result;
  237. }
  238. public bool RenameRecipeByPath(string pathName, string oldName, string newName)
  239. {
  240. bool result = false;
  241. Invoke(svc => { result = svc.RenameRecipeByPath(pathName, oldName, newName); });
  242. return result;
  243. }
  244. public bool RenameFolderByPath(string pathName, string oldName, string newName)
  245. {
  246. bool result = false;
  247. Invoke(svc => { result = svc.RenameFolderByPath(pathName, oldName, newName); });
  248. return result;
  249. }
  250. public string GetRecipeFormatXmlByPath(string pathName)
  251. {
  252. string result = null;
  253. Invoke(svc => { result = svc.GetRecipeFormatXmlByPath(pathName); });
  254. return result;
  255. }
  256. public string GetRecipeTemplateByPath(string pathName)
  257. {
  258. string result = string.Empty;
  259. Invoke(svc => { result = svc.GetRecipeTemplateByPath(pathName); });
  260. return result;
  261. }
  262. public string GetRecipeByBarcodeByPath(string pathName, string barcode)
  263. {
  264. string result = string.Empty;
  265. Invoke(svc => { result = svc.GetRecipeByBarcodeByPath(pathName, barcode); });
  266. return result;
  267. }
  268. public bool MoveRecipeFile(ModuleName chamId, string folderName, string tragetFolderName)
  269. {
  270. bool result = false;
  271. Invoke(svc => { result = svc.MoveRecipeFile(chamId, folderName, tragetFolderName); });
  272. return result;
  273. }
  274. #endregion
  275. }
  276. }