123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235 |
- 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
- {
- /// <summary>
- /// Load a recipe from server to client for editing.
- /// </summary>
- /// <param name="chamId"></param>
- /// <param name="recipeName"></param>
- /// <returns></returns>
- 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);
- }
- /// <summary>
- /// Delete a recipe by recipe name
- /// </summary>
- /// <param name="chamId"></param>
- /// <param name="recipeName"></param>
- /// <returns></returns>
- 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);
- }
- /// <summary>
- /// move recipe content
- /// </summary>
- /// <param name="chamId"></param>
- /// <param name="recipeName"></param>
- /// <returns></returns>
- 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);
- }
- /// <summary>
- /// Get recipe list in xml format
- /// </summary>
- /// <param name="chamId"></param>
- /// <param name="includingUsedRecipe"></param>
- /// <returns></returns>
- public string GetXmlRecipeList(ModuleName chamId, bool includingUsedRecipe)
- {
- return RecipeFileManager.Instance.GetXmlRecipeList(chamId.ToString(), includingUsedRecipe);
- }
- /// <summary>
- /// Get recipe data by recipe name
- /// </summary>
- /// <param name="chamId"></param>
- /// <param name="includingUsedRecipe"></param>
- /// <returns></returns>
- public IEnumerable<string> GetRecipes(ModuleName chamId, bool includingUsedRecipe)
- {
- return RecipeFileManager.Instance.GetRecipes(chamId.ToString(), includingUsedRecipe);
- }
- /// <summary>
- /// Rename recipe
- /// </summary>
- /// <param name="chamId"></param>
- /// <param name="oldName"></param>
- /// <param name="newName"></param>
- /// <returns></returns>
- 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);
- }
- /// <summary>
- /// delete a recipe folder
- /// </summary>
- /// <param name="chamId"></param>
- /// <param name="folderName"></param>
- /// <returns></returns>
- 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);
- }
- /// <summary>
- /// save recipe content
- /// </summary>
- /// <param name="chamId"></param>
- /// <param name="recipeName"></param>
- /// <param name="recipeContent"></param>
- /// <returns></returns>
- 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);
- }
- /// <summary>
- /// save recipe content
- /// </summary>
- /// <param name="chamId"></param>
- /// <param name="recipeName"></param>
- /// <param name="recipeContent"></param>
- /// <returns></returns>
- 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);
- }
- /// <summary>
- /// create a new recipe folder
- /// </summary>
- /// <param name="chamId"></param>
- /// <param name="folderName"></param>
- /// <returns></returns>
- 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);
- }
- /// <summary>
- /// Rename recipe folder name
- /// </summary>
- /// <param name="chamId"></param>
- /// <param name="oldName"></param>
- /// <param name="newName"></param>
- /// <returns></returns>
- 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);
- }
- /// <summary>
- /// get reactor's recipe format define file
- /// </summary>
- /// <param name="chamId"></param>
- /// <returns></returns>
- public string GetRecipeFormatXml(ModuleName chamId)
- {
- return RecipeFileManager.Instance.GetRecipeFormatXml(chamId.ToString());
- }
- /// <summary>
- /// get reactor's template recipe file
- /// </summary>
- /// <param name="chamId"></param>
- /// <returns></returns>
- public string GetRecipeTemplate(ModuleName chamId)
- {
- return RecipeFileManager.Instance.GetRecipeTemplate(chamId.ToString());
- }
- /// <summary>
- /// 获取当前反应腔正在运行的Recipe信息
- /// </summary>
- /// <param name="chamId"></param>
- /// <returns>recipeName + recipeContent</returns>
- public Tuple<string, string> LoadRunTimeRecipeInfo(ModuleName chamId)
- {
- //return null;
- //var pm = PmManager.GetReactor(chamId);
- //if (pm != null) return pm.LoadRunTimeRecipeInfo();
- return Singleton<PMEntity>.Instance.GetRecipeInfo();
- }
- public string GetRecipeByBarcode(ModuleName chamId, string barcode)
- {
- return RecipeFileManager.Instance.GetRecipeByBarcode(chamId.ToString(), barcode);
- }
- }
- }
|