123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153 |
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using Aitex.Core.RT.RecipeCenter;
- using MECF.Framework.Common.Equipment;
- using MECF.Framework.Common.RecipeCenter;
- using Newtonsoft.Json;
- namespace CyberX8_MainPages.PMs
- {
- class UiRecipeManager : IUiRecipeManager
- {
- public string LoadRecipe(string chamId, string receipeName)
- {
- return RecipeClient.Instance.Service.LoadRecipe(ModuleNameString.ToEnum(chamId), receipeName);
- }
- public string LoadRecipeByPath(string path)
- {
- return RecipeClient.Instance.Service.LoadRecipeByPath(path);
- }
- public Tuple<string, string> LoadRunTimeRecipeInfo(string chamId)
- {
- return RecipeClient.Instance.Service.LoadRunTimeRecipeInfo(ModuleNameString.ToEnum(chamId));
- }
- public IEnumerable<string> GetRecipes(string chamId, bool includeUsedRecipe)
- {
- return RecipeClient.Instance.Service.GetRecipes(ModuleNameString.ToEnum(chamId), includeUsedRecipe);
- }
- public ObservableCollection<RecipeNode> GetRecipesByType(string recipeType)
- {
- return RecipeClient.Instance.Service.GetRecipesByType(recipeType);
- }
- public ObservableCollection<RecipeNode> GetEngineeringRecipesByType(string recipeType)
- {
- return RecipeClient.Instance.Service.GetEngineeringRecipesByType(recipeType);
- }
- public ObservableCollection<RecipeNode> GetRecipeByDirectoryList(List<string> recipeType)
- {
- return RecipeClient.Instance.Service.GetRecipeByDirectoryList(recipeType);
- }
- /// <summary>
- /// 通过绝对路径删除recipe
- /// </summary>
- /// <param name="fullPath"></param>
- /// <returns></returns>
- public bool DeleteRecipeByFullPath(string fullPath)
- {
- return RecipeClient.Instance.Service.DeleteRecipeByFullPath(fullPath);
- }
- /// <summary>
- /// Promot recipe
- /// </summary>
- /// <param name="fullPath"></param>
- /// <returns></returns>
- public bool PromoteRecipe(List<string> FilePaths)
- {
- return RecipeClient.Instance.Service.PromoteRecipe(FilePaths);
- }
- /// <summary>
- /// 加载 recipe
- /// </summary>
- /// <param name="recipeFullName"></param>
- /// <returns></returns>
- public T LoadRecipe<T>(string recipeFullName)
- {
- Type type = typeof(T);
- string recipeContent =RecipeClient.Instance.Service.LoadGenericityRecipe(type.ToString(),recipeFullName);
- if(!string.IsNullOrEmpty(recipeContent))
- {
- return JsonConvert.DeserializeObject<T>(recipeContent);
- }
- else
- {
- return default(T);
- }
- }
- /// <summary>
- /// 保存 recipe
- /// </summary>
- /// <param name="recipeFullName"></param>
- /// <returns></returns>
- public void SaveRecipe<T>(string root, string recipeName,string recipeType, object recipe)
- {
- Type type = typeof(T);
- string str=JsonConvert.SerializeObject(recipe);
- RecipeClient.Instance.Service.SaveRecipeTypeRecipe(root, recipeName,recipeType, str,type.ToString());
- }
- public bool DeleteRecipe(string chamId, string recipeName)
- {
- return RecipeClient.Instance.Service.DeleteRecipe(ModuleNameString.ToEnum(chamId), recipeName);
- }
- public bool SaveAsRecipe(string chamId, string recipeName, string recipeContent)
- {
- return RecipeClient.Instance.Service.SaveAsRecipe(ModuleNameString.ToEnum(chamId), recipeName, recipeContent);
- }
- public bool SaveAsRecipe2(string chamId,string type, string recipeName, string recipeContent)
- {
- return RecipeClient.Instance.Service.SaveAsRecipe2(ModuleNameString.ToEnum(chamId),type, recipeName, recipeContent);
- }
- public bool SaveRecipe(string chamId, string recipeName, string recipeContent)
- {
- return RecipeClient.Instance.Service.SaveRecipe(ModuleNameString.ToEnum(chamId), recipeName, recipeContent);
- }
- public bool RenameRecipe(string chamId, string oldName, string newName)
- {
- return RecipeClient.Instance.Service.RenameRecipe(ModuleNameString.ToEnum(chamId), oldName, newName);
- }
- public bool CreateFolder(string chamId, string folderName)
- {
- return RecipeClient.Instance.Service.CreateFolder(ModuleNameString.ToEnum(chamId), folderName);
- }
- public bool MoveRecipeFile(string chamId, string folderName, string tragetFolderName)
- {
- return RecipeClient.Instance.Service.MoveRecipeFile(ModuleNameString.ToEnum(chamId), folderName, tragetFolderName);
- }
- public bool DeleteFolder(string chamId, string foldName)
- {
- return RecipeClient.Instance.Service.DeleteFolder(ModuleNameString.ToEnum(chamId), foldName);
- }
- public string GetXmlRecipeList(string chamId, bool includingUsedRecipe)
- {
- return RecipeClient.Instance.Service.GetXmlRecipeList(ModuleNameString.ToEnum(chamId), includingUsedRecipe);
- }
- public bool RenameFolder(string chamId, string oldName, string newName)
- {
- return RecipeClient.Instance.Service.RenameFolder(ModuleNameString.ToEnum(chamId), oldName, newName);
- }
- public string GetRecipeFormatXml(string chamId)
- {
- return RecipeClient.Instance.Service.GetRecipeFormatXml(ModuleNameString.ToEnum(chamId));
- }
- public string GetRecipeTemplate(string chamId)
- {
- return RecipeClient.Instance.Service.GetRecipeTemplate(ModuleNameString.ToEnum(chamId));
- }
- }
- }
|