123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396 |
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.IO;
- using System.ServiceModel;
- using Aitex.Core.RT.RecipeCenter;
- using Aitex.Core.Util;
- using Aitex.Core.WCF;
- using MECF.Framework.Common.Equipment;
- using CyberX8_Core;
- namespace MECF.Framework.Common.RecipeCenter
- {
- public class RecipeClient : Singleton<RecipeClient>
- {
- public bool InProcess { get; set; }
- private IRecipeService _service;
- public IRecipeService Service
- {
- get
- {
- if (_service == null)
- {
- if (InProcess)
- _service = new RecipeService();
- else
- _service = new RecipeServiceClient();
- }
- return _service;
- }
- }
- }
- public class RecipeServiceClient : ServiceClientWrapper<IRecipeService>, IRecipeService
- {
- public RecipeServiceClient()
- : base("Client_IRecipeService", "RecipeService")
- {
- }
- public string LoadRecipe(ModuleName chamId, string recipeName)
- {
- string result = null;
- Invoke(svc => { result = svc.LoadRecipe(chamId, recipeName); });
- return result;
- }
- public bool DeleteRecipeByFullPath(string fullPath)
- {
- bool result = true;
- Invoke(svc => { result = svc.DeleteRecipeByFullPath(fullPath); });
- return result;
- }
- public bool PromoteRecipe(List<string> FilePaths)
- {
- bool result = true;
- Invoke(svc => { result = svc.PromoteRecipe(FilePaths); });
- return result;
- }
- public Tuple<string, string> LoadRunTimeRecipeInfo(ModuleName chamId)
- {
- Tuple<string, string> result = null;
- Invoke(svc => { result = svc.LoadRunTimeRecipeInfo(chamId); });
- return result;
- }
- public IEnumerable<string> GetRecipes(ModuleName chamId, bool includeUsedRecipe)
- {
- IEnumerable<string> result = null;
- Invoke(svc => { result = svc.GetRecipes(chamId, includeUsedRecipe); });
- return result;
- }
- public IEnumerable<string> GetAllRecipes(string chamId)
- {
- IEnumerable<string> result = null;
- Invoke(svc => { result = svc.GetAllRecipes(chamId); });
- return result;
- }
- public ObservableCollection<RecipeNode> GetRecipesByType(string recipeType)
- {
- ObservableCollection<RecipeNode> result = null;
- Invoke(svc => { result = svc.GetRecipesByType(recipeType); });
- return result;
- }
- public ObservableCollection<RecipeNode> GetEngineeringRecipesByType(string recipeType)
- {
- ObservableCollection<RecipeNode> result = null;
- Invoke(svc => { result=svc.GetEngineeringRecipesByType(recipeType);} );
- return result;
- }
- /// <summary>
- /// 获取目录集合节点
- /// </summary>
- /// <param name="directories"></param>
- /// <returns></returns>
- public ObservableCollection<RecipeNode> GetRecipeByDirectoryList(List<string> directories)
- {
- ObservableCollection<RecipeNode> result = null;
- Invoke(svc => { result = svc.GetRecipeByDirectoryList(directories); });
- return result;
- }
- /// <summary>
- /// 加载 Recipe
- /// </summary>
- /// <param name="recipeFullName"></param>
- /// <returns></returns>
- [OperationContract]
- public string LoadGenericityRecipe(string type, string recipeFullName)
- {
- string result = null;
- Invoke(svc => { result = svc.LoadGenericityRecipe(type,recipeFullName); });
- return result;
- }
- /// <summary>
- /// 保存 Recipe
- /// </summary>
- /// <param name="recipeFullName"></param>
- /// <returns></returns>
- [OperationContract]
- public void SaveRecipeTypeRecipe(string root, string recipeName,string recipeType, string recipe, string dataType)
- {
- Invoke(svc => svc.SaveRecipeTypeRecipe(root, recipeName,recipeType, recipe,dataType));
- }
- public string GetXmlRecipeList(ModuleName chamId, bool includeUsedRecipe)
- {
- string result = null;
- Invoke(svc => { result = svc.GetXmlRecipeList(chamId, includeUsedRecipe); });
- return result;
- }
- public bool DeleteRecipe(ModuleName chamId, string recipeName)
- {
- bool result = false;
- Invoke(svc => { result = svc.DeleteRecipe(chamId, recipeName); });
- return result;
- }
- public bool DeleteFolder(ModuleName chamId, string folderName)
- {
- bool result = false;
- Invoke(svc => { result = svc.DeleteFolder(chamId, folderName); });
- return result;
- }
- public bool SaveAsRecipe(ModuleName chamId, string recipeName, string recipeContent)
- {
- bool result = false;
- Invoke(svc => { result = svc.SaveAsRecipe(chamId, recipeName, recipeContent); });
- return result;
- }
- public bool SaveAsRecipe2(ModuleName chamId,string type, string recipeName, string recipeContent)
- {
- bool result = false;
- Invoke(svc => { result = svc.SaveAsRecipe2(chamId,type, recipeName, recipeContent); });
- return result;
- }
- public bool SaveRecipe(ModuleName chamId, string recipeName, string recipeContent)
- {
- bool result = false;
- Invoke(svc => { result = svc.SaveRecipe(chamId, recipeName, recipeContent); });
- return result;
- }
- public bool CreateFolder(ModuleName chamId, string folderName)
- {
- bool result = false;
- Invoke(svc => { result = svc.CreateFolder(chamId, folderName); });
- return result;
- }
- public bool MoveRecipeFile(ModuleName chamId, string folderName, string tragetFolderName)
- {
- bool result = false;
- Invoke(svc => { result = svc.MoveRecipeFile(chamId, folderName, tragetFolderName); });
- return result;
- }
- public bool RenameRecipe(ModuleName chamId, string oldName, string newName)
- {
- bool result = false;
- Invoke(svc => { result = svc.RenameRecipe(chamId, oldName, newName); });
- return result;
- }
- public bool RenameFolder(ModuleName chamId, string oldName, string newName)
- {
- bool result = false;
- Invoke(svc => { result = svc.RenameFolder(chamId, oldName, newName); });
- return result;
- }
- public string GetRecipeFormatXml(ModuleName chamId)
- {
- string result = null;
- Invoke(svc => { result = svc.GetRecipeFormatXml(chamId); });
- return result;
- }
- public string GetRecipeTemplate(ModuleName chamId)
- {
- string result = string.Empty;
- Invoke(svc => { result = svc.GetRecipeTemplate(chamId); });
- return result;
- }
- public string GetRecipeByBarcode(ModuleName chamId, string barcode)
- {
- string result = string.Empty;
- Invoke(svc => { result = svc.GetRecipeByBarcode(chamId, barcode); });
- return result;
- }
- public string GetXmlSequenceList(ModuleName chamId)
- {
- string result = null;
- Invoke(svc => { result = svc.GetXmlSequenceList(chamId); });
- return result;
- }
- public string GetSequence(string sequenceName)
- {
- string result = string.Empty;
- Invoke(svc => { result = svc.GetSequence(sequenceName); });
- return result;
- }
- public List<string> GetSequenceNameList()
- {
- List<string> result = null;
- Invoke(svc => { result = svc.GetSequenceNameList(); });
- return result;
- }
- public bool DeleteSequence(string sequenceName)
- {
- bool result = false;
- Invoke(svc => { result = svc.DeleteSequence(sequenceName); });
- return result;
- }
- public bool SaveSequence(string sequenceName, string sequenceContent)
- {
- bool result = false;
- Invoke(svc => { result = svc.SaveSequence(sequenceName, sequenceContent); });
- return result;
- }
- public bool SaveAsSequence(string sequenceName, string sequenceContent)
- {
- bool result = false;
- Invoke(svc => { result = svc.SaveAsSequence(sequenceName, sequenceContent); });
- return result;
- }
- public bool RenameSequence(string oldName, string newName)
- {
- bool result = false;
- Invoke(svc => { result = svc.RenameSequence(oldName, newName); });
- return result;
- }
- public string GetSequenceFormatXml()
- {
- string result = string.Empty;
- Invoke(svc => { result = svc.GetSequenceFormatXml(); });
- return result;
- }
- public bool RenameSequenceFolder(string oldName, string newName)
- {
- bool result = false;
- Invoke(svc => { result = svc.RenameSequenceFolder(oldName, newName); });
- return result;
- }
- public bool CreateSequenceFolder(string folderName)
- {
- bool result = false;
- Invoke(svc => { result = svc.CreateSequenceFolder(folderName); });
- return result;
- }
- public bool DeleteSequenceFolder(string folderName)
- {
- bool result = false;
- Invoke(svc => { result = svc.DeleteSequenceFolder(folderName); });
- return result;
- }
- #region extended recipe interface
- public string LoadRecipeByPath(string path)
- {
- string result = null;
- Invoke(svc => { result = svc.LoadRecipeByPath(path); });
- return result;
- }
- public Tuple<string, string> LoadRunTimeRecipeInfoByPath(string pathName)
- {
- Tuple<string, string> result = null;
- Invoke(svc => { result = svc.LoadRunTimeRecipeInfoByPath(pathName); });
- return result;
- }
- public IEnumerable<string> GetRecipesByPath(string pathName, bool includeUsedRecipe)
- {
- IEnumerable<string> result = null;
- Invoke(svc => { result = svc.GetRecipesByPath(pathName, includeUsedRecipe); });
- return result;
- }
- public string GetXmlRecipeListByPath(string pathName, bool includeUsedRecipe)
- {
- string result = null;
- Invoke(svc => { result = svc.GetXmlRecipeListByPath(pathName, includeUsedRecipe); });
- return result;
- }
- public bool DeleteRecipeByPath(string pathName, string recipeName)
- {
- bool result = false;
- Invoke(svc => { result = svc.DeleteRecipeByPath(pathName, recipeName); });
- return result;
- }
- public bool DeleteFolderByPath(string pathName, string folderName)
- {
- bool result = false;
- Invoke(svc => { result = svc.DeleteFolderByPath(pathName, folderName); });
- return result;
- }
- public bool SaveAsRecipeByPath(string pathName, string recipeName, string recipeContent)
- {
- bool result = false;
- Invoke(svc => { result = svc.SaveAsRecipeByPath(pathName, recipeName, recipeContent); });
- return result;
- }
- public bool SaveRecipeByPath(string pathName, string recipeName, string recipeContent)
- {
- bool result = false;
- Invoke(svc => { result = svc.SaveRecipeByPath(pathName, recipeName, recipeContent); });
- return result;
- }
- public bool CreateFolderByPath(string pathName, string folderName)
- {
- bool result = false;
- Invoke(svc => { result = svc.CreateFolderByPath(pathName, folderName); });
- return result;
- }
- public bool RenameRecipeByPath(string pathName, string oldName, string newName)
- {
- bool result = false;
- Invoke(svc => { result = svc.RenameRecipeByPath(pathName, oldName, newName); });
- return result;
- }
- public bool RenameFolderByPath(string pathName, string oldName, string newName)
- {
- bool result = false;
- Invoke(svc => { result = svc.RenameFolderByPath(pathName, oldName, newName); });
- return result;
- }
- public string GetRecipeFormatXmlByPath(string pathName)
- {
- string result = null;
- Invoke(svc => { result = svc.GetRecipeFormatXmlByPath(pathName); });
- return result;
- }
- public string GetRecipeTemplateByPath(string pathName)
- {
- string result = string.Empty;
- Invoke(svc => { result = svc.GetRecipeTemplateByPath(pathName); });
- return result;
- }
- public string GetRecipeByBarcodeByPath(string pathName, string barcode)
- {
- string result = string.Empty;
- Invoke(svc => { result = svc.GetRecipeByBarcodeByPath(pathName, barcode); });
- return result;
- }
- public List<String> GetSequenceList(string recipeType, string sequenceType)
- {
- List<String> result = null;
- Invoke(svc => { result = svc.GetSequenceList(recipeType, sequenceType); });
- return result;
- }
- #endregion
- }
- }
|