using System; using System.Collections.Generic; using System.Linq; using System.Text; using Aitex.Core.RT.Event; using Aitex.Core.RT.Key; using Aitex.Core.RT.OperationCenter; using Aitex.Core.RT.RecipeCenter; using Aitex.Core.Util; using Aitex.Triton160.Common; using Aitex.Triton160.Common.Interface; using Aitex.Triton160.RT.Module; namespace Aitex.Triton160.RT.WCF { class RecipeService : IRecipeService { /// /// Load a recipe from server to client for editing. /// /// /// /// public string LoadRecipe(ModuleName chamId, string recipeName) { OP.Record(chamId.ToString(), string.Format("读取{0}工艺程序{1}。", ModuleNameString.ToCstring(chamId), recipeName)); return RecipeFileManager.Instance.LoadRecipe(chamId.ToString(), recipeName, false); } /// /// Delete a recipe by recipe name /// /// /// /// public bool DeleteRecipe(ModuleName chamId, string recipeName) { if (KeyManager.Instance.IsExpired) { EV.PostMessage("System", EventEnum.DefaultWarning, "Software is expired. Can not do the operation"); return false; } //if (!ChamberOperationService.IsSuperEnter()) return false; OP.Record(chamId.ToString(), string.Format("删除{0}工艺程序{1}。", ModuleNameString.ToCstring(chamId), recipeName)); return RecipeFileManager.Instance.DeleteRecipe(chamId.ToString(), recipeName); } /// /// move recipe content /// /// /// /// public bool MoveRecipeFile(ModuleName chamId, string recipeName, string tragetFolderName) { if (KeyManager.Instance.IsExpired) { EV.PostMessage("System", EventEnum.DefaultWarning, "Software is expired. Can not do the operation"); return false; } EV.PostInfoLog(chamId.ToString(), string.Format("Move {0} recipe {1}。", chamId, recipeName)); return RecipeFileManager.Instance.MoveRecipeFile(chamId.ToString(), recipeName, tragetFolderName, false, false); } /// /// Get recipe list in xml format /// /// /// /// public string GetXmlRecipeList(ModuleName chamId, bool includingUsedRecipe) { return RecipeFileManager.Instance.GetXmlRecipeList(chamId.ToString(), includingUsedRecipe); } /// /// Get recipe data by recipe name /// /// /// /// public IEnumerable GetRecipes(ModuleName chamId, bool includingUsedRecipe) { return RecipeFileManager.Instance.GetRecipes(chamId.ToString(), includingUsedRecipe); } /// /// Rename recipe /// /// /// /// /// public bool RenameRecipe(ModuleName chamId, string oldName, string newName) { if (KeyManager.Instance.IsExpired) { EV.PostMessage("System", EventEnum.DefaultWarning, "Software is expired. Can not do the operation"); return false; } OP.Record(chamId.ToString(), string.Format("重命名{0}工艺程序{1}为{2}。", ModuleNameString.ToCstring(chamId), oldName, newName)); //if (!ChamberOperationService.IsSuperEnter()) return false; return RecipeFileManager.Instance.RenameRecipe(chamId.ToString(), oldName, newName); } /// /// delete a recipe folder /// /// /// /// public bool DeleteFolder(ModuleName chamId, string folderName) { if (KeyManager.Instance.IsExpired) { EV.PostMessage("System", EventEnum.DefaultWarning, "Software is expired. Can not do the operation"); return false; } //if (!ChamberOperationService.IsSuperEnter()) return false; OP.Record(chamId.ToString(), string.Format("删除{0}工艺程序文件夹{1}。", ModuleNameString.ToCstring(chamId), folderName)); return RecipeFileManager.Instance.DeleteFolder(chamId.ToString(), folderName); } /// /// save recipe content /// /// /// /// /// public bool SaveRecipe(ModuleName chamId, string recipeName, string recipeContent) { if (KeyManager.Instance.IsExpired) { EV.PostMessage("System", EventEnum.DefaultWarning, "Software is expired. Can not do the operation"); return false; } OP.Record(chamId.ToString(), string.Format("修改并保存{0}工艺程序{1}。", ModuleNameString.ToCstring(chamId), recipeName)); return RecipeFileManager.Instance.SaveRecipe(chamId.ToString(), recipeName, recipeContent, false, true); } /// /// save recipe content /// /// /// /// /// public bool SaveAsRecipe(ModuleName chamId, string recipeName, string recipeContent) { if (KeyManager.Instance.IsExpired) { EV.PostMessage("System", EventEnum.DefaultWarning, "Software is expired. Can not do the operation"); return false; } OP.Record(chamId.ToString(), string.Format("修改并另存为{0}工艺程序{1}。", ModuleNameString.ToCstring(chamId), recipeName)); return RecipeFileManager.Instance.SaveAsRecipe(chamId.ToString(), recipeName, recipeContent); } /// /// create a new recipe folder /// /// /// /// public bool CreateFolder(ModuleName chamId, string folderName) { if (KeyManager.Instance.IsExpired) { EV.PostMessage("System", EventEnum.DefaultWarning, "Software is expired. Can not do the operation"); return false; } OP.Record(chamId.ToString(), string.Format("创建{0}工艺程序文件夹{1}。", ModuleNameString.ToCstring(chamId), folderName)); return RecipeFileManager.Instance.CreateFolder(chamId.ToString(), folderName); } /// /// Rename recipe folder name /// /// /// /// /// public bool RenameFolder(ModuleName chamId, string oldName, string newName) { if (KeyManager.Instance.IsExpired) { EV.PostMessage("System", EventEnum.DefaultWarning, "Software is expired. Can not do the operation"); return false; } OP.Record(chamId.ToString(), string.Format("重命名{0}工艺程序文件夹{1}为{2}。", ModuleNameString.ToCstring(chamId), oldName, newName)); return RecipeFileManager.Instance.RenameFolder(chamId.ToString(), oldName, newName); } /// /// get reactor's recipe format define file /// /// /// public string GetRecipeFormatXml(ModuleName chamId) { return RecipeFileManager.Instance.GetRecipeFormatXml(chamId.ToString()); } /// /// get reactor's template recipe file /// /// /// public string GetRecipeTemplate(ModuleName chamId) { return RecipeFileManager.Instance.GetRecipeTemplate(chamId.ToString()); } /// /// 获取当前反应腔正在运行的Recipe信息 /// /// /// recipeName + recipeContent public Tuple LoadRunTimeRecipeInfo(ModuleName chamId) { //return null; //var pm = PmManager.GetReactor(chamId); //if (pm != null) return pm.LoadRunTimeRecipeInfo(); return Singleton.Instance.GetRecipeInfo(); } public string GetRecipeByBarcode(ModuleName chamId, string barcode) { return RecipeFileManager.Instance.GetRecipeByBarcode(chamId.ToString(), barcode); } } }