123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367 |
- using System;
- using System.Collections.Generic;
- using Aitex.Core.RT.RecipeCenter;
- using Aitex.Common.Util;
- using System.Xml;
- using Aitex.Core.RT.SCCore;
- using System.IO;
- using Aitex.Core.RT.Log;
- using Aitex.Core.RT.Event;
- using Aitex.RT.Properties;
- namespace Aitex.RT.Module
- {
- class RtRecipeFileContext : IRecipeFileContext
- {
- private Dictionary<string, string> _dicDisplayName = new Dictionary<string, string>()
- {
- {"StepInfo", "步骤信息"},
- {"Set", "设置"},
- {"No.", "步数"},
- {"Name", "名称"},
- {"Loop", "循环"},
- {"Loop 10", "循环 10"},
- {"Loop End", "循环结束"},
- {"Step Mode", "步骤结束模式"},
- {"Step Time Mode", "按步骤设定时间"},
- {"RF Time Mode", "按射频时间"},
- {"Step Time", "步骤时间"},
- {"Chamber Pressure Setting", "压力设定"},
- {"Chamber Pressure", "腔体压力"},
- {"ValveMode", "球阀模式"},
- {"Pressure", "压力模式"},
- {"Position", "位置模式"},
- {"Valve Position", "球阀位置"},
- {"TVPressure", "球阀压力"},
- {"RF Setting", "射频设置"},
- {"RF", "射频"},
- {"RF Time", "射频时间"},
- {"RFMode", "射频模式"},
- {"Continuous", "持续模式"},
- {"Pulsing", "脉冲模式"},
- {"Pulsing Frequency", "脉冲频率"},
- {"Pulsing Duty", "脉冲频次Duty"},
- {"RFPower", "射频功率"},
- {"GasFlow", "气体流量设置"},
- {"MFC", "气流"},
- };
- public string GetRecipeDefiniton(string chamberId)
- {
- try
- {
- string recipeSchema = PathManager.GetCfgDir() + @"\RecipeFormat.xml";
- XmlDocument xmlDom = new XmlDocument();
- xmlDom.Load(recipeSchema);
- if (Resources.Culture.Name.ToLower() == "zh-cn")
- {
- foreach (var nodeCatalog in xmlDom.SelectNodes("/Aitex/TableRecipeFormat/Catalog"))
- {
- XmlElement catalog = nodeCatalog as XmlElement;
- if (catalog != null)
- {
- if (catalog.HasAttribute("DisplayName"))
- {
- if (_dicDisplayName.ContainsKey(catalog.GetAttribute("DisplayName")))
- {
- catalog.SetAttribute("DisplayName", _dicDisplayName[catalog.GetAttribute("DisplayName")]);
- }
- }
- }
- }
- foreach (var node in xmlDom.SelectNodes("/Aitex/TableRecipeFormat/Catalog/Group/Step"))
- {
- XmlElement step = node as XmlElement;
- if (step != null)
- {
- if (step.HasAttribute("DisplayName"))
- {
- if (_dicDisplayName.ContainsKey(step.GetAttribute("DisplayName")))
- {
- step.SetAttribute("DisplayName", _dicDisplayName[step.GetAttribute("DisplayName")]);
- }
- }
- }
- }
- foreach (var node in xmlDom.SelectNodes("/Aitex/TableRecipeFormat/Catalog/Group/Step/Item"))
- {
- XmlElement item = node as XmlElement;
- if (item != null)
- {
- if (item.HasAttribute("DisplayName"))
- {
- if (_dicDisplayName.ContainsKey(item.GetAttribute("DisplayName")))
- {
- item.SetAttribute("DisplayName", _dicDisplayName[item.GetAttribute("DisplayName")]);
- }
- }
- }
- }
- }
- double rfPowerRange = SC.GetValue<double>(SCName.RfConfig_PowerRange);
- bool rfEnablePulsing = SC.GetValue<bool>(SCName.RfConfig_EnablePulsingFunction);
- var nodeRfPower = xmlDom.SelectSingleNode(string.Format("/Aitex/TableRecipeFormat/Catalog/Group/Step[@ControlName='Rf.SetPower']")) as XmlElement;
- if (nodeRfPower != null)
- {
- nodeRfPower.SetAttribute("Max", (int)rfPowerRange + "");
- }
- if (!rfEnablePulsing)
- {
- var node1 = xmlDom.SelectSingleNode(string.Format("/Aitex/TableRecipeFormat/Catalog/Group/Step[@ControlName='Rf.SetPulsingFrequency']")) as XmlElement;
- if (node1 != null)
- node1.ParentNode.RemoveChild(node1);
- var node2 = xmlDom.SelectSingleNode(string.Format("/Aitex/TableRecipeFormat/Catalog/Group/Step[@ControlName='Rf.SetPulsingDuty']")) as XmlElement;
- if (node2 != null)
- node2.ParentNode.RemoveChild(node2);
- var node3 = xmlDom.SelectSingleNode(string.Format("/Aitex/TableRecipeFormat/Catalog/Group/Step/Item[@ControlName='PulsingMode']")) as XmlElement;
- if (node3 != null)
- node3.ParentNode.RemoveChild(node3);
- }
- string gas1Name = (string)SC.GetItemValue(SCName.GasLineConfig_Gas1Name);
- bool gas1Enable = SC.GetValue<bool>(SCName.GasLineConfig_Gas1Enable);
- double gas1N2Scale = SC.GetValue<double>(SCName.GasLineConfig_Gas1MfcN2Scale);
- double gas1ScaleFactor = SC.GetValue<double>(SCName.GasLineConfig_Gas1MfcScaleFactor);
- var nodeGas1 = xmlDom.SelectSingleNode(string.Format("/Aitex/TableRecipeFormat/Catalog/Group/Step[@ControlName='MfcGas1']")) as XmlElement;
- if (nodeGas1 != null)
- {
- nodeGas1.SetAttribute("DisplayName", string.Format("MFC1({0})", gas1Name));
- nodeGas1.SetAttribute("Max", (int)(gas1N2Scale * gas1ScaleFactor) + "");
- if (!gas1Enable)
- nodeGas1.ParentNode.RemoveChild(nodeGas1);
- }
- string gas2Name = (string)SC.GetItemValue(SCName.GasLineConfig_Gas2Name);
- bool gas2Enable = SC.GetValue<bool>(SCName.GasLineConfig_Gas2Enable);
- double gas2N2Scale = SC.GetValue<double>(SCName.GasLineConfig_Gas2MfcN2Scale);
- double gas2ScaleFactor = SC.GetValue<double>(SCName.GasLineConfig_Gas2MfcScaleFactor);
- var nodeGas2 = xmlDom.SelectSingleNode(string.Format("/Aitex/TableRecipeFormat/Catalog/Group/Step[@ControlName='MfcGas2']")) as XmlElement;
- if (nodeGas2 != null)
- {
- nodeGas2.SetAttribute("DisplayName", string.Format("MFC2({0})", gas2Name));
- nodeGas2.SetAttribute("Max", (int)(gas2N2Scale * gas2ScaleFactor) + "");
- if (!gas2Enable)
- nodeGas2.ParentNode.RemoveChild(nodeGas2);
- }
- string gas3Name = (string)SC.GetItemValue(SCName.GasLineConfig_Gas3Name);
- bool gas3Enable = SC.GetValue<bool>(SCName.GasLineConfig_Gas3Enable);
- double gas3N2Scale = SC.GetValue<double>(SCName.GasLineConfig_Gas3MfcN2Scale);
- double gas3ScaleFactor = SC.GetValue<double>(SCName.GasLineConfig_Gas3MfcScaleFactor);
- var nodeGas3 = xmlDom.SelectSingleNode(string.Format("/Aitex/TableRecipeFormat/Catalog/Group/Step[@ControlName='MfcGas3']")) as XmlElement;
- if (nodeGas3 != null)
- {
- nodeGas3.SetAttribute("DisplayName", string.Format("MFC3({0})", gas3Name));
- nodeGas3.SetAttribute("Max", (int)(gas3N2Scale * gas3ScaleFactor) + "");
- if (!gas3Enable)
- nodeGas3.ParentNode.RemoveChild(nodeGas3);
- }
- string gas4Name = (string)SC.GetItemValue(SCName.GasLineConfig_Gas4Name);
- bool gas4Enable = SC.GetValue<bool>(SCName.GasLineConfig_Gas4Enable);
- double gas4N2Scale = SC.GetValue<double>(SCName.GasLineConfig_Gas4MfcN2Scale);
- double gas4ScaleFactor = SC.GetValue<double>(SCName.GasLineConfig_Gas4MfcScaleFactor);
- var nodeGas4 = xmlDom.SelectSingleNode(string.Format("/Aitex/TableRecipeFormat/Catalog/Group/Step[@ControlName='MfcGas4']")) as XmlElement;
- if (nodeGas4 != null)
- {
- nodeGas4.SetAttribute("DisplayName", string.Format("MFC4({0})", gas4Name));
- nodeGas4.SetAttribute("Max", (int)(gas4N2Scale * gas4ScaleFactor) + "");
- if (!gas4Enable)
- nodeGas4.ParentNode.RemoveChild(nodeGas4);
- }
- string gas5Name = (string)SC.GetItemValue(SCName.GasLineConfig_Gas5Name);
- bool gas5Enable = SC.GetValue<bool>(SCName.GasLineConfig_Gas5Enable);
- double gas5N2Scale = SC.GetValue<double>(SCName.GasLineConfig_Gas5MfcN2Scale);
- double gas5ScaleFactor = SC.GetValue<double>(SCName.GasLineConfig_Gas5MfcScaleFactor);
- var nodeGas5 = xmlDom.SelectSingleNode(string.Format("/Aitex/TableRecipeFormat/Catalog/Group/Step[@ControlName='MfcGas5']")) as XmlElement;
- if (nodeGas5 != null)
- {
- nodeGas5.SetAttribute("DisplayName", string.Format("MFC5({0})", gas5Name));
- nodeGas5.SetAttribute("Max", (int)(gas5N2Scale * gas5ScaleFactor) + "");
- if (!gas5Enable)
- nodeGas5.ParentNode.RemoveChild(nodeGas5);
- }
- bool isTvInstalled = SC.GetValue<bool>(SCName.PressureControlConfig_EnableThrottleValve);
- if (!isTvInstalled)
- {
- var nodeSetMode = xmlDom.SelectSingleNode(string.Format("/Aitex/TableRecipeFormat/Catalog/Group/Step[@ControlName='PressureControl.SetTVMode']"))
- as XmlElement;
- if (nodeSetMode != null)
- {
- nodeSetMode.ParentNode.RemoveChild(nodeSetMode);
- }
- var nodeSetPosition = xmlDom.SelectSingleNode(string.Format("/Aitex/TableRecipeFormat/Catalog/Group/Step[@ControlName='PressureControl.SetTVPosition']")) as XmlElement;
- if (nodeSetPosition != null)
- {
- nodeSetPosition.ParentNode.RemoveChild(nodeSetPosition);
- }
- var nodeSetPressure = xmlDom.SelectSingleNode(string.Format("/Aitex/TableRecipeFormat/Catalog/Group/Step[@ControlName='PressureControl.SetTVPressure']")) as XmlElement;
- if (nodeSetPressure != null)
- {
- nodeSetPressure.ParentNode.RemoveChild(nodeSetPressure);
- }
- }
- bool isBoostInstalled = SC.GetValue<bool>(SCName.PressureControlConfig_EnableBoosterPump);
- if (!isBoostInstalled)
- {
- var nodeSetPressure =
- xmlDom.SelectSingleNode(
- string.Format(
- "/Aitex/TableRecipeFormat/Catalog/Group/Step[@ControlName='PressureControl.SetBoostPressure']"))
- as XmlElement;
- if (nodeSetPressure != null)
- {
- nodeSetPressure.ParentNode.RemoveChild(nodeSetPressure);
- }
- }
- double maxChamberPressure = SC.GetValue<double>(SCName.ProcessConfig_ChamberPressureMaxValue);
- var nodeSetPressure1 = xmlDom.SelectSingleNode(string.Format("/Aitex/TableRecipeFormat/Catalog/Group/Step[@ControlName='PressureControl.SetChamberPressure']")) as XmlElement;
- if (nodeSetPressure1 != null)
- {
- if (isTvInstalled || isBoostInstalled)
- nodeSetPressure1.ParentNode.RemoveChild(nodeSetPressure1);
- else
- {
- nodeSetPressure1.SetAttribute("Max", maxChamberPressure.ToString());
- }
- }
- return xmlDom.OuterXml;
- }
- catch (Exception ex)
- {
- LOG.Write(ex);
- return "";
- }
- }
- public IEnumerable<string> GetRecipes(string chamberId, bool includingUsedRecipe)
- {
- try
- {
- string recipePath = PathManager.GetRecipeDir() + chamberId + "\\";
- var di = new DirectoryInfo(recipePath);
- var fis = di.GetFiles("*.rcp", SearchOption.AllDirectories);
- var recipes = new List<string>();
- foreach (var fi in fis)
- {
- string str = fi.FullName.Substring(recipePath.Length);
- str = str.Substring(0, str.LastIndexOf('.'));
- if (includingUsedRecipe || (!str.Contains("HistoryRecipe\\")))
- {
- recipes.Add(str);
- }
- }
- return recipes;
- }
- catch (Exception ex)
- {
- LOG.Write(ex);
- return new List<string>();
- }
- }
- public void PostInfoEvent(string message)
- {
- EV.PostMessage("System", EventEnum.GeneralInfo, message);
- }
- public void PostWarningEvent(string message)
- {
- EV.PostMessage("System", EventEnum.DefaultWarning, message);
- }
- public void PostAlarmEvent(string message)
- {
- EV.PostMessage("System", EventEnum.DefaultAlarm, message);
- }
- public void PostDialogEvent(string message)
- {
- EV.PostNotificationMessage(message);
- }
- public void PostInfoDialogMessage(string message)
- {
- EV.PostMessage("System", EventEnum.GeneralInfo, message);
- EV.PostPopDialogMessage(EventLevel.Information, "System Information", message);
- }
- public void PostWarningDialogMessage(string message)
- {
- EV.PostMessage("System", EventEnum.GeneralInfo, message);
- EV.PostPopDialogMessage(EventLevel.Warning, "System Warning", message);
- }
- public void PostAlarmDialogMessage(string message)
- {
- EV.PostMessage("System", EventEnum.GeneralInfo, message);
- EV.PostPopDialogMessage(EventLevel.Alarm, "System Alarm", message);
- }
- public string GetRecipeTemplate(string chamberId)
- {
- string schema = GetRecipeDefiniton(chamberId);
- XmlDocument dom = new XmlDocument();
- dom.LoadXml(schema);
- XmlNode nodeTemplate = dom.SelectSingleNode("/Aitex/TableRecipeData");
- if (nodeTemplate.Attributes["BasePressure"] != null)
- nodeTemplate.Attributes["BasePressure"].Value = SC.GetValue<double>(SCName.System_PumpBasePressure).ToString("F0");
- if (nodeTemplate.Attributes["PumpDownLimit"] != null)
- nodeTemplate.Attributes["PumpDownLimit"].Value = SC.GetValue<double>(SCName.System_PumpTimeLimit).ToString("F0");
- if (nodeTemplate.Attributes["PurgeActive"] != null)
- nodeTemplate.Attributes["PurgeActive"].Value = "true";
- if (nodeTemplate.Attributes["ElectrodeTemp"] != null)
- nodeTemplate.Attributes["ElectrodeTemp"].Value = "20";
- if (nodeTemplate.Attributes["MatchPositionC1"] != null)
- nodeTemplate.Attributes["MatchPositionC1"].Value = SC.GetValue<double>(SCName.System_MatchPositionC1).ToString("F0");
- if (nodeTemplate.Attributes["MatchPositionC2"] != null)
- nodeTemplate.Attributes["MatchPositionC2"].Value = SC.GetValue<double>(SCName.System_MatchPositionC2).ToString("F0");
- return nodeTemplate.OuterXml;
- }
- }
- }
|