| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328 | 
							- using Aitex.Core.RT.Log;
 
- using Caliburn.Micro.Core;
 
- using MECF.Framework.Common.RecipeCenter;
 
- using MECF.Framework.UI.Client.CenterViews.Editors.Recipe;
 
- using RecipeEditorLib.RecipeModel.Params;
 
- using System;
 
- using System.Collections.Generic;
 
- using System.Collections.ObjectModel;
 
- using System.Reflection;
 
- using System.Text;
 
- using System.Xml;
 
- namespace FurnaceUI.Views.Recipes
 
- {
 
-     public class RecipeDataJob : PropertyChangedBase
 
-     {
 
-         private string _prefixPath;
 
-         public string PrefixPath
 
-         {
 
-             get => _prefixPath;
 
-             set
 
-             {
 
-                 _prefixPath = value;
 
-                 NotifyOfPropertyChange(nameof(PrefixPath));
 
-             }
 
-         }
 
-         private string _name;
 
-         public string Name
 
-         {
 
-             get => _name;
 
-             set
 
-             {
 
-                 _name = value;
 
-                 NotifyOfPropertyChange(nameof(Name));
 
-             }
 
-         }
 
-         private string _createBy;
 
-         public string CreateBy
 
-         {
 
-             get => _createBy;
 
-             set
 
-             {
 
-                 _createBy = value;
 
-                 NotifyOfPropertyChange(nameof(CreateBy));
 
-             }
 
-         }
 
-         private string _createTime;
 
-         public string CreateTime
 
-         {
 
-             get => _createTime;
 
-             set
 
-             {
 
-                 _createTime = value;
 
-                 NotifyOfPropertyChange(nameof(CreateTime));
 
-             }
 
-         }
 
-         private string _lastReviseBy;
 
-         public string LastReviseBy
 
-         {
 
-             get => _lastReviseBy;
 
-             set
 
-             {
 
-                 _lastReviseBy = value;
 
-                 NotifyOfPropertyChange(nameof(LastReviseBy));
 
-             }
 
-         }
 
-         private string _lastRevisionTime;
 
-         public string LastRevisionTime
 
-         {
 
-             get => _lastRevisionTime;
 
-             set
 
-             {
 
-                 _lastRevisionTime = value;
 
-                 NotifyOfPropertyChange(nameof(LastRevisionTime));
 
-             }
 
-         }
 
-         private string _description;
 
-         public string Description
 
-         {
 
-             get => _description;
 
-             set
 
-             {
 
-                 _description = value;
 
-                 NotifyOfPropertyChange(nameof(Description));
 
-             }
 
-         }
 
-         private string _recipePermission;
 
-         public string RecipePermission
 
-         {
 
-             get { return this._recipePermission; }
 
-             set
 
-             {
 
-                 this._recipePermission = value;
 
-                 this.NotifyOfPropertyChange("RecipePermisson");
 
-             }
 
-         }
 
-         private string _recipeLevel;
 
-         public string RecipeLevel
 
-         {
 
-             get { return this._recipeLevel; }
 
-             set
 
-             {
 
-                 this._recipeLevel = value;
 
-                 this.NotifyOfPropertyChange("RecipeLevel");
 
-             }
 
-         }
 
-         private string _processRecipe;
 
-         public string ProcessRecipe
 
-         {
 
-             get => _processRecipe;
 
-             set
 
-             {
 
-                 _processRecipe = value;
 
-                 NotifyOfPropertyChange(nameof(ProcessRecipe));
 
-             }
 
-         }
 
-         private string _layoutRecipe;
 
-         public string LayoutRecipe
 
-         {
 
-             get => _layoutRecipe;
 
-             set
 
-             {
 
-                 _layoutRecipe = value;
 
-                 NotifyOfPropertyChange(nameof(LayoutRecipe));
 
-             }
 
-         }
 
-         private string _coolTime;
 
-         public string CoolTime
 
-         {
 
-             get => _coolTime;
 
-             set
 
-             {
 
-                 _coolTime = value;
 
-                 NotifyOfPropertyChange(nameof(CoolTime));
 
-             }
 
-         }
 
-         private string _recipeChamberType;
 
-         public string RecipeChamberType
 
-         {
 
-             get => _recipeChamberType;
 
-             set
 
-             {
 
-                 _recipeChamberType = value;
 
-                 NotifyOfPropertyChange(nameof(RecipeChamberType));
 
-             }
 
-         }
 
-         private string _recipeVersion;
 
-         public string RecipeVersion
 
-         {
 
-             get => _recipeVersion;
 
-             set
 
-             {
 
-                 _recipeVersion = value;
 
-                 NotifyOfPropertyChange(nameof(RecipeVersion));
 
-             }
 
-         }
 
-         private XmlDocument _doc;
 
-         private string _module;
 
-         private RecipeProvider _recipeProvider = new RecipeProvider();
 
-         public RecipeDataJob()
 
-         {
 
-             _doc = new XmlDocument();
 
-         }
 
-         public void Clear()
 
-         {
 
-             CreateBy = "";
 
-             CreateTime = "";
 
-             LastReviseBy = "";
 
-             LastRevisionTime = "";
 
-             Description = "";
 
-             RecipeChamberType = "";
 
-             RecipeVersion = "";
 
-             _module = "";
 
-         }
 
-         public void InitData(string prefixPath, string recipeName, string recipeContent, string module)
 
-         {
 
-             PrefixPath = prefixPath;
 
-             Name = recipeName;
 
-             _module = module;
 
-             try
 
-             {
 
-                 _doc = new XmlDocument();
 
-                 _doc.LoadXml(recipeContent);
 
-                 if (!LoadHeader(_doc.SelectSingleNode("Aitex/TableRecipeData")))
 
-                     return;
 
-                 XmlNode nodeModule;
 
-                 nodeModule = _doc.SelectSingleNode("Aitex/TableRecipeData");
 
-                 XmlElement stepNode = nodeModule as XmlElement;
 
-                 foreach (XmlAttribute att in stepNode.Attributes)
 
-                 {
 
-                     switch (att.Name)
 
-                     {
 
-                         case "CreatedBy":
 
-                             CreateBy = att.Value;
 
-                             break;
 
-                         case "CreationTime":
 
-                             CreateTime = att.Value;
 
-                             break;
 
-                         case "LastRevisedBy":
 
-                             LastReviseBy = att.Value;
 
-                             break;
 
-                         case "LastRevisionTime":
 
-                             LastRevisionTime = att.Value;
 
-                             break;
 
-                         case "Description":
 
-                             Description = att.Value;
 
-                             break;
 
-                     }
 
-                 }
 
-                 nodeModule = _doc.SelectSingleNode($"Aitex/TableRecipeData/Module[@Name='{module}']/Step");
 
-                 if (nodeModule == null) 
 
-                     return;
 
-                 stepNode = nodeModule as XmlElement;
 
-                 foreach (XmlAttribute att in stepNode.Attributes)
 
-                 {
 
-                     switch (att.Name)
 
-                     {
 
-                         case "ProcessRecipe":
 
-                             ProcessRecipe = att.Value;
 
-                             break;
 
-                         case "LayoutRecipe":
 
-                             LayoutRecipe = att.Value;
 
-                             break;
 
-                         case "CoolTime":
 
-                             CoolTime = att.Value;
 
-                             break;
 
-                     }
 
-                 }
 
-             }
 
-             catch (Exception ex)
 
-             {
 
-                 LOG.Write(ex);
 
-             }
 
-         }
 
-         public string GetXmlString()
 
-         {
 
-             try
 
-             {
 
-                 XmlElement nodeData = _doc.SelectSingleNode($"Aitex/TableRecipeData") as XmlElement;
 
-                 nodeData.SetAttribute("LastRevisedBy", LastReviseBy);
 
-                 nodeData.SetAttribute("LastRevisionTime", LastRevisionTime);
 
-                 nodeData.SetAttribute("Description", Description);
 
-                 nodeData.SetAttribute("RecipeChamberType", RecipeChamberType);
 
-                 nodeData.SetAttribute("RecipePermission", RecipePermission);
 
-                 nodeData.SetAttribute("RecipeLevel", RecipeLevel);
 
-                 XmlNode nodeModule = _doc.SelectSingleNode($"Aitex/TableRecipeData/Module[@Name='{_module}']");
 
-                 if (nodeModule == null)
 
-                 {
 
-                     nodeModule = _doc.CreateElement("Module");
 
-                     nodeData.AppendChild(nodeModule);
 
-                 }
 
-                 nodeModule.RemoveAll();
 
-                 (nodeModule as XmlElement).SetAttribute("Name", _module);
 
-                 XmlElement nodeStep = _doc.CreateElement("Step");
 
-                 nodeStep.SetAttribute("ProcessRecipe", ProcessRecipe);
 
-                 nodeStep.SetAttribute("LayoutRecipe", LayoutRecipe);
 
-                 nodeStep.SetAttribute("CoolTime", CoolTime);
 
-                 nodeModule.AppendChild(nodeStep);
 
-             }
 
-             catch (Exception ex)
 
-             {
 
-                 LOG.Write(ex);
 
-                 return _doc.OuterXml;
 
-             }
 
-             return _doc.OuterXml;
 
-         }
 
-         private bool LoadHeader(XmlNode nodeHeader)
 
-         {
 
-             if (nodeHeader == null)
 
-                 return false;
 
-             if (nodeHeader.Attributes["CreatedBy"] != null)
 
-                 CreateBy = nodeHeader.Attributes["CreatedBy"].Value;
 
-             if (nodeHeader.Attributes["CreationTime"] != null)
 
-                 CreateTime = nodeHeader.Attributes["CreationTime"].Value;
 
-             if (nodeHeader.Attributes["LastRevisedBy"] != null)
 
-                 LastReviseBy = nodeHeader.Attributes["LastRevisedBy"].Value;
 
-             if (nodeHeader.Attributes["LastRevisionTime"] != null)
 
-                 LastRevisionTime = nodeHeader.Attributes["LastRevisionTime"].Value;
 
-             if (nodeHeader.Attributes["Description"] != null)
 
-                 Description = nodeHeader.Attributes["Description"].Value;
 
-             if (nodeHeader.Attributes["RecipeLevel"] != null)
 
-                 RecipeLevel = nodeHeader.Attributes["RecipeLevel"].Value;
 
-             string chamberType = string.Empty;
 
-             if (nodeHeader.Attributes["RecipeChamberType"] != null)
 
-                 chamberType = nodeHeader.Attributes["RecipeChamberType"].Value;
 
-             if (!string.IsNullOrEmpty(chamberType) && chamberType != RecipeChamberType)
 
-             {
 
-                 LOG.Write($"{chamberType} is not accordance with {RecipeChamberType}");
 
-                 return false;
 
-             }
 
-             return true;
 
-         }
 
-     }
 
- }
 
 
  |