123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297 |
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.Windows;
- using System.Windows.Input;
- using System.Xml;
- using Aitex.Core.RT.Log;
- using Aitex.Core.RT.RecipeCenter;
- using Aitex.Core.RT.SCCore;
- using Aitex.Core.UI.MVVM;
- using Aitex.UI.RecipeEditor;
- using MECF.Framework.UI.Client.ClientBase;
- using OpenSEMI.ClientBase;
- namespace EfemDualUI.Views.PMs
- {
- class RecipeEditorViewModel : ModuleUiViewModelBase, ISupportMultipleSystem
- {
- #region 控件used
- public ICommand OpenLocalRecipeCommand { get; set; }
- public ICommand RightClickCommand { get; set; }
- public ICommand RecipeHelpDocCommand { get; set; }
- public ICommand SaveRecipeCommand { get; set; }
- public ICommand UndoCommand { get; set; }
- public ICommand RedoCommand { get; set; }
- public ICommand ExpandGroupCommand { get; set; }
- public ICommand CollapseGroupCommand { get; set; }
- public ICommand ToggleHideSameCommand { get; set; }
- public ICommand RecipeExport2ExcelCommand { get; set; }
- public ICommand ShowDetailedErrInfoCommand { get; set; }
- public ICommand EditRecipeInfoCommand { get; set; }
- public Visibility SingleAppElementVisibility { get; set; }
- public Visibility RecipeInfoTextVisibility { get; set; }
- public bool IsUndoEnabled { get; set; }
- public bool IsRedoEnabled { get; set; }
- public object RecipeHead { get; set; }
- public string Errors { get; set; }
- public string RecipeInfo { get; set; }
- public ObservableCollection<RecipeRow> RecipeRows { get; set; }
- public Visibility IsBarcodeVisibility
- {
- get; set;
- }
- #endregion 控件used
- private IUiRecipeManager _recipeManager;
- private string _chamberId;
- private SCValue _config = new SCValue();
- private string _currentRecipeName = string.Empty;
- public RecipeEditorViewModel( )
- {
-
- // _config.SetKeys(new List<string>() { SCName.BarcodeConfig_EnableBarcode });
- }
- public RecipeEditorViewModel(IUiRecipeManager recipeManager, string chamberId)
- {
- _recipeManager = recipeManager;
- _chamberId = chamberId;
- // _config.SetKeys(new List<string>() { SCName.BarcodeConfig_EnableBarcode });
- }
- public string ChamberId
- {
- set { _chamberId = value; }
- get { return _chamberId; }
- }
- /// <summary>
- /// Recipe template
- /// </summary>
- public string RecipeTemplate
- {
- get
- {
- return _recipeManager.GetRecipeTemplate(_chamberId);
- }
- }
- public bool IsBarcodeEnabled
- {
- get
- {
- return false;
- }
- }
- public Dictionary<string, AitexTableRecipeFormatCatalogGroup> RecipePermission
- {
- get
- {
- try
- {
- string recipetemplate = RecipeTemplate;
- System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
- doc.LoadXml(RecipeTemplate);
- Dictionary<string, AitexTableRecipeFormatCatalogGroup> ret = new Dictionary<string, AitexTableRecipeFormatCatalogGroup>();
- XmlNodeList nodeList = doc.SelectNodes("TableRecipeData/Step");
- foreach (XmlNode node in nodeList)
- {
- AitexTableRecipeFormatCatalogGroup group = new AitexTableRecipeFormatCatalogGroup();
- if (node.BaseURI.ToLower() != "mos")
- {
- group.DisplayName = node.BaseURI;
- bool hasper = false;
- bool.TryParse(node.Attributes["Permission"].Value, out hasper);
- group.HasPermission = hasper;
- ret.Add(group.DisplayName, group);
- }
- }
- return ret;
- }
- catch (Exception ex)
- {
- LOG.Write(ex);
- }
- return new Dictionary<string, AitexTableRecipeFormatCatalogGroup>();
- }
- }
- public string RecipeVersion()
- {
- try
- {
- System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
- doc.LoadXml(RecipeTemplate);
- return doc.DocumentElement.Attributes["RecipeVersion"].Value;
- }
- catch (Exception ex)
- {
- LOG.Write(ex);
- }
- return "1.0";
- }
- /// <summary>
- /// Recipe format
- /// </summary>
- public string RecipeFormat
- {
- get
- {
- return _recipeManager.GetRecipeFormatXml(_chamberId);
- }
- }
- /// <summary>
- /// Name list of all recipes.
- /// </summary>
- public IEnumerable<string> RecipeNames
- {
- get
- {
- return _recipeManager.GetRecipes(_chamberId, true);
- }
- }
- /// <summary>
- /// Name list of all recipes.
- /// </summary>
- public string CurrentRecipeName { get { return _currentRecipeName; } set { if (value != _currentRecipeName) _currentRecipeName = value; InvokePropertyChanged("CurrentRecipeName"); } }
- /// <summary>
- /// Load recipe data by recipe name
- /// </summary>
- /// <param name="receipeName"></param>
- /// <returns></returns>
- public string LoadRecipe(string receipeName)
- {
- return _recipeManager.LoadRecipe(_chamberId, receipeName);
- }
- /// <summary>
- /// Get a list of all recipe names.
- /// </summary>
- /// <returns></returns>
- public IEnumerable<string> GetRecipes()
- {
- return _recipeManager.GetRecipes(_chamberId, true);
- }
-
- /// <summary>
- /// delete a recipe by recipe name
- /// </summary>
- /// <param name="recipeName"></param>
- /// <returns></returns>
- public bool DeleteRecipe(string recipeName)
- {
- return _recipeManager.DeleteRecipe(_chamberId, recipeName);
- }
- /// <summary>
- /// Save recipe by recipe name and recipe data
- /// </summary>
- /// <param name="recipeName"></param>
- /// <param name="recipe"></param>
- /// <returns></returns>
- public bool SaveRecipe(string recipeName, string recipeContent)
- {
- return _recipeManager.SaveRecipe(_chamberId, recipeName, recipeContent);
- }
- /// <summary>
- /// Save recipe by recipe name and recipe data
- /// </summary>
- /// <param name="recipeName"></param>
- /// <param name="recipe"></param>
- /// <returns></returns>
- public bool SaveRecipeDouble(string recipeName, string recipeContent)
- {
- return _recipeManager.SaveRecipe(_chamberId, recipeName, recipeContent) && _recipeManager.SaveRecipe(_chamberId == "PMA" ? "PMB" : "PMA", recipeName, recipeContent);
- }
- /// <summary>
- /// SaveAs recipe by recipe name and recipe data
- /// </summary>
- /// <param name="recipeName"></param>
- /// <param name="recipe"></param>
- /// <returns></returns>
- public bool SaveAsRecipe(string recipeName, string recipeContent)
- {
- return _recipeManager.SaveAsRecipe(_chamberId, recipeName, recipeContent);
- }
- /// <summary>
- /// Rename recipe
- /// </summary>
- /// <param name="oldName"></param>
- /// <param name="newName"></param>
- /// <returns></returns>
- public bool RenameRecipe(string oldName, string newName)
- {
- return _recipeManager.RenameRecipe(_chamberId, oldName, newName);
- }
- /// <summary>
- /// Create recipe folder
- /// </summary>
- /// <param name="oldName"></param>
- /// <param name="newName"></param>
- /// <returns></returns>
- public bool CreateFolder(string folderName)
- {
- return _recipeManager.CreateFolder(_chamberId, folderName);
- }
- /// <summary>
- /// move recipe file
- /// </summary>
- /// <param name="folderName"></param>
- /// <param name="tragetFolderName"></param>
- /// <returns></returns>
- public bool MoveRecipeFile(string folderName, string tragetFolderName)
- {
- return _recipeManager.MoveRecipeFile(_chamberId, folderName, tragetFolderName);
- }
- /// <summary>
- /// Get recipe list in xml format
- /// </summary>
- /// <returns></returns>
- public string GetXmlRecipeList()
- {
- return _recipeManager.GetXmlRecipeList(_chamberId, true) ?? "";
- }
- /// <summary>
- /// Delete recipe folder
- /// </summary>
- /// <param name="foldName"></param>
- /// <returns></returns>
- public bool DeleteFolder(string foldName)
- {
- return _recipeManager.DeleteFolder(_chamberId, foldName);
- }
- /// <summary>
- /// Rename recipe folder
- /// </summary>
- /// <param name="oldName"></param>
- /// <param name="newName"></param>
- /// <returns></returns>
- public bool RenameFolder(string oldName, string newName)
- {
- return _recipeManager.RenameFolder(_chamberId, oldName, newName);
- }
- public void UpdateAllConfig()
- {
- //_config.Update(VirgoUiSystem.Instance.WCF.Query.PollConfig(_config.GetKeys()));
- }
- }
- }
|