using System; using System.Collections.Generic; using Aitex.Core.RT.Event; using Aitex.Core.RT.Key; using Aitex.Core.RT.RecipeCenter; using Aitex.Core.Util; using MECF.Framework.Common.Equipment; namespace MECF.Framework.Common.RecipeCenter { internal class RecipeService : IRecipeService { public string LoadRecipe(ModuleName chamId, string recipeName) { EV.PostInfoLog(chamId.ToString(), $"Read {chamId} recipe {recipeName}."); return Singleton.Instance.LoadRecipe(chamId.ToString(), recipeName, needValidation: false); } public bool DeleteRecipe(ModuleName chamId, string recipeName) { if (Singleton.Instance.IsExpired) { EV.PostMessage("System", EventEnum.DefaultWarning, "Software is expired. Can not do the operation"); return false; } EV.PostInfoLog(chamId.ToString(), $"Delete {chamId} recipe {recipeName}."); return Singleton.Instance.DeleteRecipe(chamId.ToString(), recipeName); } public string GetXmlRecipeList(ModuleName chamId, bool includingUsedRecipe) { return Singleton.Instance.GetXmlRecipeList(chamId.ToString(), includingUsedRecipe); } public IEnumerable GetRecipes(ModuleName chamId, bool includingUsedRecipe) { return Singleton.Instance.GetRecipes(chamId.ToString(), includingUsedRecipe); } public bool RenameRecipe(ModuleName chamId, string oldName, string newName) { if (Singleton.Instance.IsExpired) { EV.PostMessage("System", EventEnum.DefaultWarning, "Software is expired. Can not do the operation"); return false; } EV.PostInfoLog(chamId.ToString(), $"Rename {chamId} recipe {oldName} to {newName}."); return Singleton.Instance.RenameRecipe(chamId.ToString(), oldName, newName); } public bool DeleteFolder(ModuleName chamId, string folderName) { if (Singleton.Instance.IsExpired) { EV.PostMessage("System", EventEnum.DefaultWarning, "Software is expired. Can not do the operation"); return false; } EV.PostInfoLog(chamId.ToString(), $"Delete {chamId} recipe folder {folderName}."); return Singleton.Instance.DeleteFolder(chamId.ToString(), folderName); } public bool SaveRecipe(ModuleName chamId, string recipeName, string recipeContent) { if (Singleton.Instance.IsExpired) { EV.PostMessage("System", EventEnum.DefaultWarning, "Software is expired. Can not do the operation"); return false; } EV.PostInfoLog(chamId.ToString(), $"Modify and save {chamId} recipe {recipeName}."); return Singleton.Instance.SaveRecipe(chamId.ToString(), recipeName, recipeContent, clearBarcode: false, notifyUI: false); } public bool SaveAsRecipe(ModuleName chamId, string recipeName, string recipeContent) { if (Singleton.Instance.IsExpired) { EV.PostMessage("System", EventEnum.DefaultWarning, "Software is expired. Can not do the operation"); return false; } EV.PostInfoLog(chamId.ToString(), $"Modify and save as {chamId} recipe {recipeName}."); return Singleton.Instance.SaveAsRecipe(chamId.ToString(), recipeName, recipeContent); } public bool CreateFolder(ModuleName chamId, string folderName) { if (Singleton.Instance.IsExpired) { EV.PostMessage("System", EventEnum.DefaultWarning, "Software is expired. Can not do the operation"); return false; } EV.PostInfoLog(chamId.ToString(), $"Create {chamId} recipe foler {folderName}."); return Singleton.Instance.CreateFolder(chamId.ToString(), folderName); } public bool RenameFolder(ModuleName chamId, string oldName, string newName) { if (Singleton.Instance.IsExpired) { EV.PostMessage("System", EventEnum.DefaultWarning, "Software is expired. Can not do the operation"); return false; } EV.PostInfoLog(chamId.ToString(), $"Rename {chamId} recipe folder {oldName} to {newName}."); return Singleton.Instance.RenameFolder(chamId.ToString(), oldName, newName); } public string GetRecipeFormatXml(ModuleName chamId) { return Singleton.Instance.GetRecipeFormatXml(chamId.ToString()); } public string GetRecipeTemplate(ModuleName chamId) { return Singleton.Instance.GetRecipeTemplate(chamId.ToString()); } public Tuple LoadRunTimeRecipeInfo(ModuleName chamId) { return null; } public string GetRecipeByBarcode(ModuleName chamId, string barcode) { return ""; } public string GetXmlSequenceList(ModuleName chamId) { return Singleton.Instance.GetXmlSequenceList(chamId.ToString()); } public string GetSequence(string sequenceName) { return Singleton.Instance.GetSequence(sequenceName, needValidation: true); } public List GetSequenceNameList() { return Singleton.Instance.GetSequenceNameList(); } public bool DeleteSequence(string sequenceName) { return Singleton.Instance.DeleteSequence(sequenceName); } public bool SaveSequence(string sequenceName, string sequenceContent) { return Singleton.Instance.SaveSequence(sequenceName, sequenceContent, notifyUI: false); } public bool SaveAsSequence(string sequenceName, string sequenceContent) { return Singleton.Instance.SaveAsSequence(sequenceName, sequenceContent); } public bool RenameSequence(string oldName, string newName) { return Singleton.Instance.RenameSequence(oldName, newName); } public string GetSequenceFormatXml() { return Singleton.Instance.GetSequenceFormatXml(); } public bool RenameSequenceFolder(string oldName, string newName) { return Singleton.Instance.RenameSequenceFolder(oldName, newName); } public bool CreateSequenceFolder(string folderName) { return Singleton.Instance.CreateSequenceFolder(folderName); } public bool DeleteSequenceFolder(string folderName) { return Singleton.Instance.DeleteSequenceFolder(folderName); } public string LoadRecipeByPath(string pathName, string recipeName) { return Singleton.Instance.LoadRecipe(pathName, recipeName, needValidation: false); } public bool DeleteRecipeByPath(string pathName, string recipeName) { return Singleton.Instance.DeleteRecipe(pathName, recipeName); } public string GetXmlRecipeListByPath(string pathName, bool includingUsedRecipe) { return Singleton.Instance.GetXmlRecipeList(pathName, includingUsedRecipe); } public IEnumerable GetRecipesByPath(string pathName, bool includingUsedRecipe) { return Singleton.Instance.GetRecipes(pathName, includingUsedRecipe); } public bool RenameRecipeByPath(string pathName, string oldName, string newName) { return Singleton.Instance.RenameRecipe(pathName, oldName, newName); } public bool DeleteFolderByPath(string pathName, string folderName) { return Singleton.Instance.DeleteFolder(pathName, folderName); } public bool SaveRecipeByPath(string pathName, string recipeName, string recipeContent) { return Singleton.Instance.SaveRecipe(pathName, recipeName, recipeContent, clearBarcode: false, notifyUI: false); } public bool SaveAsRecipeByPath(string pathName, string recipeName, string recipeContent) { return Singleton.Instance.SaveAsRecipe(pathName, recipeName, recipeContent); } public bool CreateFolderByPath(string pathName, string folderName) { return Singleton.Instance.CreateFolder(pathName, folderName); } public bool RenameFolderByPath(string pathName, string oldName, string newName) { return Singleton.Instance.RenameFolder(pathName, oldName, newName); } public string GetRecipeFormatXmlByPath(string pathName) { return Singleton.Instance.GetRecipeFormatXml(pathName); } public string GetRecipeTemplateByPath(string pathName) { return Singleton.Instance.GetRecipeTemplate(pathName); } public Tuple LoadRunTimeRecipeInfoByPath(string pathName) { return null; } public string GetRecipeByBarcodeByPath(string pathName, string barcode) { return ""; } } }