| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281 | 
							- using Aitex.Core.RT.Log;
 
- using Aitex.Core.RT.ParameterCenter;
 
- using Caliburn.Micro.Core;
 
- using MECF.Framework.Common.ParameterCenter;
 
- using MECF.Framework.UI.Client.CenterViews.Editors.Recipe;
 
- using RecipeEditorLib.RecipeModel.Params;
 
- using System;
 
- using System.Collections.Generic;
 
- using System.Collections.ObjectModel;
 
- using System.Linq;
 
- using System.Text;
 
- using System.Threading.Tasks;
 
- using System.Windows;
 
- using System.Xml;
 
- namespace MECF.Framework.UI.Client.CenterViews.Parameter
 
- {
 
-     public class LeakCheckConditionParameterData : ParameterDataBase
 
-     {
 
-         private ParameterProvider _parameterProvider = new ParameterProvider();
 
-         private ParameterFormatBuilder _columnBuilder = new ParameterFormatBuilder();
 
-         private Dictionary<string, ObservableCollection<ParameterTemplateColumnBase>> ParameterTemplate;
 
-         public LeakCheckConditionParameterData() : base()
 
-         {
 
-             string vars = _parameterProvider.GetParameterFormatXml($"Parameter\\LeakCheckCondition");
 
-             _columnBuilder.Build($"Parameter\\LeakCheckCondition");
 
-             ParameterTemplate = _parameterProvider.GetGroupParameterTemplate();
 
-             TableNumber = _columnBuilder.TableNumber;
 
-             Version = _columnBuilder.Version;
 
-             for (int i = 1; i < TableNumber+1; i++)
 
-             {
 
-                 Steps.Add(CreateStep());
 
-             }
 
-         }
 
-        public override ParameterTable CreateStep(XmlNode stepNode = null)
 
-         {
 
-             ParameterTable table = new LeakCheckConditionTable();
 
-             var step = table as LeakCheckConditionTable;
 
-             if (stepNode != null)
 
-             {
 
-                 if (stepNode.Attributes["StepNo"] != null)
 
-                     step.StepNo = int.Parse(stepNode.Attributes["StepNo"].Value);
 
-                 if (stepNode.Attributes["Name"] != null)
 
-                     step.Name = stepNode.Attributes["Name"].Value;
 
-             }
 
-             else
 
-             {
 
-                 step.StepNo = StepNo;
 
-                 step.Name = "Name" + StepNo.ToString();
 
-                 //step.UseTemp = "0";
 
-                 StepNo++;
 
-                 
 
-             }
 
-             foreach (var item in ParameterTemplate)
 
-             {
 
-                 if (item.Key != "Parameter Information")
 
-                 {
 
-                     var pHHighLimitcom = item.Value.Where(x => x.ControlName == "PHHighLimit").FirstOrDefault();
 
-                     if (pHHighLimitcom != null)
 
-                     {
 
-                         DoubleParam pHHighLimitParam = new DoubleParam()
 
-                         {
 
-                             Name = pHHighLimitcom.ControlName,
 
-                             Value = pHHighLimitcom.Value.ToString(),
 
-                             DisplayName = pHHighLimitcom.DisplayName,
 
-                             Minimun = pHHighLimitcom.Minimun,
 
-                             Maximun = pHHighLimitcom.Maximun,
 
-                             Resolution = 0
 
-                         };
 
-                         step.PHHighLimit= pHHighLimitParam;
 
-                     }
 
-                     var pLLowLimitcom = item.Value.Where(x => x.ControlName == "PLLowLimit").FirstOrDefault();
 
-                     if (pLLowLimitcom != null)
 
-                     {
 
-                         DoubleParam pLLowLimitParam = new DoubleParam()
 
-                         {
 
-                             Name = pLLowLimitcom.ControlName,
 
-                             Value = pLLowLimitcom.Value.ToString(),
 
-                             DisplayName = pLLowLimitcom.DisplayName,
 
-                             Minimun = pLLowLimitcom.Minimun,
 
-                             Maximun = pLLowLimitcom.Maximun,
 
-                             Resolution = 0
 
-                         };
 
-                         step.PLLowLimit = pLLowLimitParam;
 
-                     }
 
-                     var bPLimitcom = item.Value.Where(x => x.ControlName == "BPLimit").FirstOrDefault();
 
-                     if (bPLimitcom != null)
 
-                     {
 
-                         DoubleParam bPLimitParam = new DoubleParam()
 
-                         {
 
-                             Name = bPLimitcom.ControlName,
 
-                             Value = bPLimitcom.Value.ToString(),
 
-                             DisplayName = bPLimitcom.DisplayName,
 
-                             Minimun = bPLimitcom.Minimun,
 
-                             Maximun = bPLimitcom.Maximun,
 
-                             Resolution = 0
 
-                         };
 
-                         step.BPLimit = bPLimitParam;
 
-                     }
 
-                     var leakLimitcom = item.Value.Where(x => x.ControlName == "LeakLimit").FirstOrDefault();
 
-                     if (leakLimitcom != null)
 
-                     {
 
-                         DoubleParam leakLimitParam = new DoubleParam()
 
-                         {
 
-                             Name = leakLimitcom.ControlName,
 
-                             Value = leakLimitcom.Value.ToString(),
 
-                             DisplayName = leakLimitcom.DisplayName,
 
-                             Minimun = leakLimitcom.Minimun,
 
-                             Maximun = leakLimitcom.Maximun,
 
-                             Resolution = 0
 
-                         };
 
-                         step.LeakLimit = leakLimitParam;
 
-                     }
 
-                     var retryLimitcom = item.Value.Where(x => x.ControlName == "RetryLimit").FirstOrDefault();
 
-                     if (leakLimitcom != null)
 
-                     {
 
-                         NumParam retryLimitParam = new NumParam()
 
-                         {
 
-                             Name = leakLimitcom.ControlName,
 
-                             Value = (int)leakLimitcom.Value,
 
-                             DisplayName = leakLimitcom.DisplayName,
 
-                             Minimun = leakLimitcom.Minimun,
 
-                             Maximun = leakLimitcom.Maximun
 
-                         };
 
-                         step.RetryLimit = retryLimitParam;
 
-                     }
 
-                 }
 
-             }
 
-             if (stepNode != null)
 
-             {
 
-                 if (stepNode.Attributes["PressSensor"] != null)
 
-                     step.PressSensor = stepNode.Attributes["PressSensor"].Value;
 
-                 if (stepNode.Attributes["PHHighLimit"] != null)
 
-                     step.PHHighLimit.Value = stepNode.Attributes["PHHighLimit"].Value;
 
-                 if (stepNode.Attributes["PLLowLimit"] != null)
 
-                     step.PLLowLimit.Value = stepNode.Attributes["PLLowLimit"].Value;
 
-                 if (stepNode.Attributes["BPLimit"] != null)
 
-                     step.BPLimit.Value = stepNode.Attributes["BPLimit"].Value;
 
-                 if (stepNode.Attributes["DelayTime"] != null)
 
-                     step.DelayTime = stepNode.Attributes["DelayTime"].Value;
 
-                 if (stepNode.Attributes["CheckTime"] != null)
 
-                     step.CheckTime = stepNode.Attributes["CheckTime"].Value;
 
-                 if (stepNode.Attributes["LeakLimit"] != null)
 
-                     step.LeakLimit.Value = stepNode.Attributes["LeakLimit"].Value;
 
-                 if (stepNode.Attributes["RetryLimit"] != null)
 
-                     step.RetryLimit.Value =Convert.ToInt32(stepNode.Attributes["RetryLimit"].Value);
 
-                 if (stepNode.Attributes["HightLimitCommand"] != null)
 
-                     step.HightLimitCommand = stepNode.Attributes["HightLimitCommand"].Value;
 
-                 if (stepNode.Attributes["LowLimitCommand"] != null)
 
-                     step.LowLimitCommand = stepNode.Attributes["LowLimitCommand"].Value;
 
-                 if (stepNode.Attributes["BasePressureLimitCommand"] != null)
 
-                     step.BasePressureLimitCommand = stepNode.Attributes["BasePressureLimitCommand"].Value;
 
-                 if (stepNode.Attributes["ErrorCommand"] != null)
 
-                     step.ErrorCommand = stepNode.Attributes["ErrorCommand"].Value;
 
-                 if (stepNode.Attributes["RetryOverCommand"] != null)
 
-                     step.RetryOverCommand = stepNode.Attributes["RetryOverCommand"].Value;
 
-             }
 
-             return step;
 
-         }
 
-         public override string GetXmlString()
 
-         {
 
-             XmlElement nodeData = _doc.SelectSingleNode($"Aitex/TableParameterData") as XmlElement;
 
-             nodeData.SetAttribute("CreatedBy", Creator);
 
-             nodeData.SetAttribute("CreationTime", CreateTime.ToString("yyyy-MM-dd HH:mm:ss"));
 
-             nodeData.SetAttribute("LastRevisedBy", Revisor);
 
-             nodeData.SetAttribute("LastRevisionTime", ReviseTime.ToString("yyyy-MM-dd HH:mm:ss"));
 
-             nodeData.SetAttribute("Description", Description);
 
-             nodeData.SetAttribute("ParameterChamberType", ChamberType);
 
-             nodeData.SetAttribute("Version", Version);
 
-             nodeData.SetAttribute("TableNumber", TableNumber.ToString());
 
-             nodeData.SetAttribute("Permission", Permission);
 
-             nodeData.SetAttribute("ParameterLevel", Level);
 
-             XmlNode nodeModule = _doc.SelectSingleNode($"Aitex/TableParameterData/Module[@Name='{_module}']");
 
-             if (nodeModule == null)
 
-             {
 
-                 nodeModule = _doc.CreateElement("Module");
 
-                 nodeData.AppendChild(nodeModule);
 
-             }
 
-             nodeModule.RemoveAll();
 
-             (nodeModule as XmlElement).SetAttribute("Name", _module);
 
-             int i = 0;
 
-             foreach (LeakCheckConditionTable parameter in Steps)
 
-             {
 
-                 XmlElement nodeStep = _doc.CreateElement("Step");
 
-               
 
-                 nodeStep.SetAttribute("StepNo", parameter.StepNo.ToString());
 
-                 nodeStep.SetAttribute("Name", parameter.Name);
 
-              //   nodeStep.SetAttribute("UseTemp", parameter.UseTemp);
 
-                 nodeStep.SetAttribute("PressSensor", parameter.PressSensor);
 
-                 nodeStep.SetAttribute("PHHighLimit", parameter.PHHighLimit.Value.ToString());
 
-                 nodeStep.SetAttribute("PLLowLimit", parameter.PLLowLimit.Value.ToString());
 
-                 nodeStep.SetAttribute("BPLimit", parameter.BPLimit.Value.ToString());
 
-                 nodeStep.SetAttribute("DelayTime", parameter.DelayTime);
 
-                 nodeStep.SetAttribute("CheckTime", parameter.CheckTime);
 
-                 nodeStep.SetAttribute("LeakLimit", parameter.LeakLimit.Value.ToString());
 
-                 nodeStep.SetAttribute("RetryLimit", parameter.RetryLimit.Value.ToString());
 
-                 nodeStep.SetAttribute("HightLimitCommand", parameter.HightLimitCommand);
 
-                 nodeStep.SetAttribute("LowLimitCommand", parameter.LowLimitCommand);
 
-                 nodeStep.SetAttribute("BasePressureLimitCommand", parameter.BasePressureLimitCommand);
 
-                 nodeStep.SetAttribute("ErrorCommand", parameter.ErrorCommand);
 
-                 nodeStep.SetAttribute("RetryOverCommand", parameter.RetryOverCommand);
 
-                 nodeModule.AppendChild(nodeStep);
 
-                 i++;
 
-             }
 
-           
 
-             return _doc.OuterXml;
 
-         }
 
-         public override void InitData(string prefixPath, string recipeName, string recipeContent, string module)
 
-         {
 
-             IsCompatibleWithCurrentFormat = false;
 
-             _module = module;
 
-             Name = recipeName;
 
-             PrefixPath = prefixPath;
 
-             try
 
-             {
 
-                 _doc = new XmlDocument();
 
-                 _doc.LoadXml(recipeContent);
 
-                 if (!LoadHeader(_doc.SelectSingleNode("Aitex/TableParameterData")))
 
-                     return;
 
-                 XmlNodeList nodeSteps = _doc.SelectNodes($"Aitex/TableParameterData/Module[@Name='{module}']/Step");
 
-                 if (nodeSteps == null)
 
-                     nodeSteps = _doc.SelectNodes($"Aitex/TableParameterData/Step");
 
-                 LoadSteps(nodeSteps);
 
-                 var index = 1;
 
-                 foreach (ParameterTable parameters in Steps)
 
-                 {
 
-                     parameters.Value = index.ToString();
 
-                     index++;
 
-                 }
 
-                 //   ValidLoopData();
 
-                 XmlNode nodeConfig =
 
-                     _doc.SelectSingleNode($"Aitex/TableParameterData/Module[@Name='{module}']/Config");
 
-                 if (nodeSteps == null)
 
-                     nodeConfig = _doc.SelectSingleNode($"Aitex/TableParameterData/Config");
 
-                 IsCompatibleWithCurrentFormat = true;
 
-             }
 
-             catch (Exception ex)
 
-             {
 
-                 LOG.Write(ex);
 
-             }
 
-         }
 
-         public override void LoadSteps(XmlNodeList steps)
 
-         {
 
-             Steps.Clear();
 
-             PopSettingSteps.Clear();
 
-             StepTolerances.Clear();
 
-             StepNos.Clear();
 
-             int index = 1;
 
-            
 
-             foreach (XmlNode nodeStep in steps)
 
-             {
 
-                 ParameterTable stepTable = this.CreateStep(nodeStep);
 
-                 StepNos.Add(stepTable.StepNo);
 
-                 Steps.Add(stepTable);
 
-                 index++;
 
-             }
 
-         }
 
-        
 
-     }
 
- }
 
 
  |