| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176 | using System;using System.Collections.Generic;using System.Xml;using System.Reflection;using Aitex.Common.Util;using Aitex.Core.Common.DeviceData;using Aitex.Core.RT.Log;using Aitex.Core.RT.RecipeCenter;using Aitex.Core.RT.SCCore;using MECF.Framework.Common.Equipment;using System.IO;using MECF.Framework.UI.Client.CenterViews.Editors.Recipe;namespace FurnaceRT.Equipments.PMs.RecipeExecutions{    public class RecipeParser    {        public static bool Parse(string recipeFile, string module, out RecipeHead recipeHead, out List<RecipeStep> recipeData, out string reason, string recipeType, int tableID = 1, RecipeHead mainHead = null)        {            reason = string.Empty;            if (mainHead != null)                recipeHead = mainHead;            else                recipeHead = new RecipeHead();            recipeData = new List<RecipeStep>();            string content = string.Empty;            if (recipeType != "Process" && recipeType != "Idle" && recipeType != "Reset")            {                if (!File.Exists($"{PathManager.GetRecipeDir()}\\{SC.GetStringValue("System.Recipe.SupportedChamberType")}\\{SC.GetStringValue($"System.Recipe.Supported{recipeType}Type")}\\{recipeFile}.rcp"))                    return true;            }            content = RecipeFileManager.Instance.LoadRecipe($"{SC.GetStringValue("System.Recipe.SupportedChamberType")}\\{SC.GetStringValue($"System.Recipe.Supported{recipeType}Type")}", recipeFile, false);            if (string.IsNullOrEmpty(content))            {                reason = $"{recipeFile} is not a valid recipe file";                return false;            }            try            {                //获取工艺程序文件中允许的命令字符串列表                //目的:如果工艺程序文件中含有规定之外的命令,则被禁止执行                HashSet<string> recipeAllowedCommands = new HashSet<string>();                XmlDocument rcpFormatDoc = new XmlDocument();                string recipeSchema = PathManager.GetCfgDir() + $@"\Recipe\Furnace\Process\{SC.GetStringValue("System.SetUp.ToolType")}\RecipeFormat.xml";                rcpFormatDoc.Load(recipeSchema);                XmlNodeList rcpItemNodeList = rcpFormatDoc.SelectNodes("/Aitex/TableRecipeFormat/Catalog/Group/Step");                foreach (XmlElement item in rcpItemNodeList)                    recipeAllowedCommands.Add(item.Attributes["ControlName"].Value);                recipeAllowedCommands.Add("Temperature.ControlMode");                recipeAllowedCommands.Add("Temperature.Correct");                recipeAllowedCommands.Add("Temperature.PID");                recipeAllowedCommands.Add("ConditionCheck");                recipeAllowedCommands.Add("EventSetting");                recipeAllowedCommands.Add("FilmThickFormula");                recipeAllowedCommands.Add("FilmThickCoefficientA");                recipeAllowedCommands.Add("FilmThickCoefficientB");                recipeAllowedCommands.Add("AlarmTableIndex");                recipeAllowedCommands.Add("RFSwitch");                recipeAllowedCommands.Add("RFSetpoint");                recipeAllowedCommands.Add("ForwardPowerAlarmWatchTable");                recipeAllowedCommands.Add("PrAlarmWatchTable");                recipeAllowedCommands.Add("PIAlarmWatchTable");                recipeAllowedCommands.Add("C1Setpoint");                recipeAllowedCommands.Add("C2Setpoint");                recipeAllowedCommands.Add("C1AlarmWatchTable");                recipeAllowedCommands.Add("C2AlarmWatchTable");                recipeAllowedCommands.Add("VppAlarmWatchTable");                recipeAllowedCommands.Add("VdcAlarmWatchTable");                recipeAllowedCommands.Add("PressureSonserValue");                recipeAllowedCommands.Add("PressureValveAngle");                recipeAllowedCommands.Add("PressureSettingVG");                recipeAllowedCommands.Add("PressCommand");                recipeAllowedCommands.Add("PressValue");                recipeAllowedCommands.Add("PressureAlarmTableNo");                recipeAllowedCommands.Add("AbortRecipeTableIndex");                recipeAllowedCommands.Add("AlarmConditionTable");                recipeAllowedCommands.Add("LoaderCommand");                recipeAllowedCommands.Add("LoaderValue");                for (int i = 1; i < 11; i++)                {                    recipeAllowedCommands.Add($"AlarmAction.{i}");                    recipeAllowedCommands.Add($"AlarmDetails.{i}");                }                for (int i = 1; i < 60; i++)                {                    recipeAllowedCommands.Add($"MFC{i}.Flow.Set");                    recipeAllowedCommands.Add($"MFC{i}.Flow.SetUnit");                    recipeAllowedCommands.Add($"MFC{i}.Flow.Ramprate");                    recipeAllowedCommands.Add($"MFC{i}.Flow.RamprateUnit");                    recipeAllowedCommands.Add($"MFC{i}.Flow.Check");                    recipeAllowedCommands.Add($"MFC{i}.Flow.High");                    recipeAllowedCommands.Add($"MFC{i}.Flow.Low");                    recipeAllowedCommands.Add($"MFC{i}.Flow.Unit");                }                for (int i = 1; i < 200; i++)                {                    recipeAllowedCommands.Add($"AUX.{i}.Set");                    recipeAllowedCommands.Add($"AUX.{i}.Check");                    recipeAllowedCommands.Add($"AUX.{i}.High");                    recipeAllowedCommands.Add($"AUX.{i}.Low");                    recipeAllowedCommands.Add($"AUX.{i}.CheckUnit");                }                recipeAllowedCommands.Add("HeaterU.ZoneName");                recipeAllowedCommands.Add("HeaterU.Set");                recipeAllowedCommands.Add("HeaterU.SetUnit");                recipeAllowedCommands.Add("HeaterU.Ramprate");                recipeAllowedCommands.Add("HeaterU.RamprateUnit");                recipeAllowedCommands.Add("HeaterU.Check");                recipeAllowedCommands.Add("HeaterU.High");                recipeAllowedCommands.Add("HeaterU.Low");                recipeAllowedCommands.Add("HeaterU.Unit");                recipeAllowedCommands.Add("HeaterCU.ZoneName");                recipeAllowedCommands.Add("HeaterCU.Set");                recipeAllowedCommands.Add("HeaterCU.SetUnit");                recipeAllowedCommands.Add("HeaterCU.Ramprate");                recipeAllowedCommands.Add("HeaterCU.RamprateUnit");                recipeAllowedCommands.Add("HeaterCU.Check");                recipeAllowedCommands.Add("HeaterCU.High");                recipeAllowedCommands.Add("HeaterCU.Low");                recipeAllowedCommands.Add("HeaterCU.Unit");                recipeAllowedCommands.Add("HeaterC.ZoneName");                recipeAllowedCommands.Add("HeaterC.Set");                recipeAllowedCommands.Add("HeaterC.SetUnit");                recipeAllowedCommands.Add("HeaterC.Ramprate");                recipeAllowedCommands.Add("HeaterC.RamprateUnit");                recipeAllowedCommands.Add("HeaterC.Check");                recipeAllowedCommands.Add("HeaterC.High");                recipeAllowedCommands.Add("HeaterC.Low");                recipeAllowedCommands.Add("HeaterC.Unit");                recipeAllowedCommands.Add("HeaterCL.ZoneName");                recipeAllowedCommands.Add("HeaterCL.Set");                recipeAllowedCommands.Add("HeaterCL.SetUnit");                recipeAllowedCommands.Add("HeaterCL.Ramprate");                recipeAllowedCommands.Add("HeaterCL.RamprateUnit");                recipeAllowedCommands.Add("HeaterCL.Check");                recipeAllowedCommands.Add("HeaterCL.High");                recipeAllowedCommands.Add("HeaterCL.Low");                recipeAllowedCommands.Add("HeaterCL.Unit");                recipeAllowedCommands.Add("HeaterL.ZoneName");                recipeAllowedCommands.Add("HeaterL.Set");                recipeAllowedCommands.Add("HeaterL.SetUnit");                recipeAllowedCommands.Add("HeaterL.Ramprate");                recipeAllowedCommands.Add("HeaterL.RamprateUnit");                recipeAllowedCommands.Add("HeaterL.Check");                recipeAllowedCommands.Add("HeaterL.High");                recipeAllowedCommands.Add("HeaterL.Low");                recipeAllowedCommands.Add("HeaterL.Unit");                recipeAllowedCommands.Add("Loader.Command");                recipeAllowedCommands.Add("Loader.Speed1");                recipeAllowedCommands.Add("Loader.Speed2");                recipeAllowedCommands.Add("Loader.Speed3");                recipeAllowedCommands.Add("Loader.RPM");                recipeAllowedCommands.Add("Press.Command");                recipeAllowedCommands.Add("Press.PID");                recipeAllowedCommands.Add("Press.Set");                recipeAllowedCommands.Add("Press.SlowVacSet");                recipeAllowedCommands.Add("Press.ValveAngleSet");                recipeAllowedCommands.Add("Press.IsWait");                recipeAllowedCommands.Add("Press.LowWait");                recipeAllowedCommands.Add("Press.HighWait");                recipeAllowedCommands.Add("Press.WaitUnit");                recipeAllowedCommands.Add("Press.WaitPress");                //获取工艺程序文件中所有步的内容                XmlDocument rcpDataDoc = new XmlDocument();                rcpDataDoc.LoadXml(content);                XmlNode nodeModule = null;                if (recipeType == "Process" || recipeType == "Idle" || recipeType == "Reset")                    nodeModule = rcpDataDoc.SelectSingleNode($"/Aitex/TableRecipeData/Module[@Name='{module}']");                else                    nodeModule = rcpDataDoc.SelectSingleNode($"/Aitex/TableRecipeData/Tables/Table[@Index='{tableID}']");                if (nodeModule == null)                {                    reason = $"Recipe file does not contains step content for {module}";                    return false;                }                XmlElement nodeConfig = nodeModule.SelectSingleNode($"Config") as XmlElement;                if (nodeConfig != null)                {                    if (mainHead == null)                    {                        recipeHead.SubRecipe = nodeConfig.HasAttribute("Combination.SubRecipe") ? nodeConfig.Attributes["Combination.SubRecipe"].Value : "";                        recipeHead.AlarmRecipe = nodeConfig.HasAttribute("Combination.AlarmRecipe") ? nodeConfig.Attributes["Combination.AlarmRecipe"].Value : "";                        recipeHead.AlarmCondition = nodeConfig.HasAttribute("Combination.AlarmCondition") ? nodeConfig.Attributes["Combination.AlarmCondition"].Value : "";                        recipeHead.LeakCheck = nodeConfig.HasAttribute("Combination.LeakCheck") ? nodeConfig.Attributes["Combination.LeakCheck"].Value : "";                        recipeHead.AbortRecipe = nodeConfig.HasAttribute("Combination.AbortRecipe") ? nodeConfig.Attributes["Combination.AbortRecipe"].Value : "";                        recipeHead.PressApcPID = nodeConfig.HasAttribute("Combination.PressAPCPID") ? nodeConfig.Attributes["Combination.PressAPCPID"].Value : "";                        recipeHead.TempCorrect = nodeConfig.HasAttribute("Combination.TempCorrection") ? nodeConfig.Attributes["Combination.TempCorrection"].Value : "";                        recipeHead.TempPID = nodeConfig.HasAttribute("Combination.TempPID") ? nodeConfig.Attributes["Combination.TempPID"].Value : "";                        recipeHead.ProfileCondition = nodeConfig.HasAttribute("Combination.ProfileCondition") ? nodeConfig.Attributes["Combination.ProfileCondition"].Value : "";                        if (nodeConfig.HasAttribute("N2PurgeMode"))                        {                            recipeHead.N2PurgeModeStr = nodeConfig.Attributes["N2PurgeMode"].Value;                        }                        if (string.IsNullOrEmpty(recipeHead.AbortRecipe))                            recipeHead.AbortRecipe = SC.GetStringValue("System.Recipe.Abort Recipe");                    }                }                else                {                    if (mainHead == null)                    {                        recipeHead.SubRecipe = "";                        recipeHead.AlarmRecipe = "";                        recipeHead.AlarmCondition = "";                        recipeHead.LeakCheck = "";                        recipeHead.AbortRecipe = "";                        recipeHead.PressApcPID = "";                        recipeHead.TempCorrect = "";                        recipeHead.TempPID = "";                        recipeHead.ProfileCondition = "";                        if (recipeType == "Sub")                            recipeHead.AbortRecipe = SC.GetStringValue("System.Recipe.Abort Recipe");                    }                }                XmlNodeList stepNodeList = nodeModule.SelectNodes($"Step");                string strLoopEndStep, strJumpStep;                strLoopEndStep = strJumpStep = string.Empty;                for (int i = 0; i < stepNodeList.Count; i++)                {                    var recipeStep = new RecipeStep();                    recipeStep.RecipeType = recipeType;                    recipeData.Add(recipeStep);                    XmlElement stepNode = stepNodeList[i] as XmlElement;                    Dictionary<string, string> dic = new Dictionary<string, string>();                    //遍历Step节点                    foreach (XmlAttribute att in stepNode.Attributes)                    {                        if (recipeAllowedCommands.Contains(att.Name))                        {                            dic.Add(att.Name, att.Value);                        }                    }                    //遍历Step子节点中所有的attribute属性节点                    foreach (XmlElement subStepNode in stepNode.ChildNodes)                    {                        foreach (XmlAttribute att in subStepNode.Attributes)                        {                            if (recipeAllowedCommands.Contains(att.Name))                            {                                dic.Add(att.Name, att.Value);                            }                        }                        //遍历Step子节点的子节点中所有的attribute属性节点                        foreach (XmlElement subsubStepNode in subStepNode.ChildNodes)                        {                            foreach (XmlAttribute att in subsubStepNode.Attributes)                            {                                if (recipeAllowedCommands.Contains(att.Name))                                {                                    dic.Add(att.Name, att.Value);                                }                            }                        }                    }                    recipeStep.StepName = dic["Name"];                    if (dic["Name"] == strLoopEndStep)                    {                        recipeStep.IsLoopEndStep = true;                        strLoopEndStep = string.Empty;                    }                    recipeStep.IsJumpStep = false;                    if (dic.ContainsKey("Command"))                    {                        string commandStr = dic["Command"];                        if (commandStr.Contains("CallSystemRecipe"))                        {                        }                        else if (commandStr.ToUpper().StartsWith("CALL"))                        {                            int subTableID = 0;                            var subPara = commandStr.Replace("CALL", "").Replace("[", "").Replace("]", "").Split('*');                            if (subPara != null && subPara.Length > 1)                            {                                int.TryParse(subPara[0], out int loopCount);                                var tablePara = subPara[1].Split(':');                                if (tablePara != null && tablePara.Length > 1)                                {                                    int.TryParse(tablePara[0], out subTableID);                                    if (subTableID > 0)                                    {                                        recipeStep.IsCallSubStep = true;                                        recipeStep.SubRecipeLoopCount = loopCount;                                    }                                }                                recipeStep.SubRecipeTableInfo = subPara[1];                            }                            //sub需要修改table id                            List<RecipeStep> subRecipeData = null;                            if (recipeStep.IsCallSubStep && !Parse(recipeHead.SubRecipe, module, out var head, out subRecipeData, out reason, "Sub", subTableID, recipeHead))                            {                                return false;                            }                            if (subRecipeData == null || subRecipeData.Count == 0)                            {                                reason = $"Sub Recipe {commandStr.Replace("CallSubRecipe:", string.Empty)} is empty";                                return false;                            }                            recipeStep.SubRecipeSteps = subRecipeData;                        }                        else if (commandStr.ToUpper().StartsWith("LOOP"))                        {                            recipeStep.IsLoopEndStep = true;                            var loopPara = commandStr.Replace("LOOP", "").Replace("[", "").Replace("]", "").Split('*');                            if (loopPara != null && loopPara.Length > 1)                            {                                int.TryParse(loopPara[0], out int loopCount);                                recipeStep.LoopCount = loopCount + 1;//加1是因为第一次从正常的start-》end的执行算是一次循环,所以要额外加1                                int loopStartStep = -1;                                for (int index = 0; index < recipeData.Count; index++)                                {                                    if (recipeData[index].StepName == loopPara[1])                                    {                                        loopStartStep = index;                                        break;                                    }                                }                                if (loopStartStep < 0)                                {                                    reason = $"Recipe file does not contains LOOP step {loopPara[1]}";                                    return false;                                }                                if (loopPara[1] != null)                                {                                    if (loopStartStep < 0 ||                                        (recipeType == "Process" && loopStartStep == 0))//Process recipe的standby不参与循环                                        recipeStep.IsLoopEndStep = false;                                    else                                    {                                        recipeStep.LoopStartStep = loopStartStep;                                        if (recipeData.Count > loopStartStep)                                        {                                            recipeData[loopStartStep].IsLoopStartStep = true;                                            recipeData[loopStartStep].LoopCount = loopCount + 1;                                            recipeStep.LoopEndStep = recipeType == "Process" ? i + 1 : i;//Process recipe包含standby,从0开始;其他recipe不包含standby                                        }                                    }                                }                            }                        }                        else if (commandStr.ToUpper().StartsWith("JUMP"))                        {                            var jumpPara = commandStr.Replace("Jump:", string.Empty).Replace("[", "").Replace("]", "");//JumpStepNo                            if (jumpPara != null)                            {                                //int.TryParse(jumpPara[0], out int jumpStepNo);                                //recipeStep.JumpStepNo = recipeType == "Process" ? jumpStepNo : jumpStepNo - 1;//Process recipe包含standby,从0开始;其他recipe不包含standby                                recipeStep.IsJumpStep = true;                                recipeStep.JumpStepName = jumpPara;                            }                        }                    }                    if (dic.ContainsKey("AbortRecipeTableIndex"))                    {                        if (dic["AbortRecipeTableIndex"].ToLower() != "none")                        {                            //格式 1:name                            var abortPara = dic["AbortRecipeTableIndex"].Split(':');                            int abortTableID = 0;                            if (abortPara.Length > 1)                            {                                int.TryParse(abortPara[0], out abortTableID);                                List<RecipeStep> abortRecipeData = null;                                if (!Parse(recipeHead.AbortRecipe, module, out var head, out abortRecipeData, out reason, "Abort", abortTableID))                                {                                    return false;                                }                                if (abortRecipeData == null || abortRecipeData.Count == 0)                                {                                    reason = $"Abort Recipe {recipeHead.AbortRecipe}--{dic["AbortRecipeTableIndex"]} is empty";                                    return false;                                }                                recipeStep.AbortRecipeSteps = abortRecipeData;                                recipeStep.AbortRecipeTableInfo = dic["AbortRecipeTableIndex"];                            }                        }                        else                        {                            recipeStep.AbortRecipeSteps = null;                        }                    }                    if (dic.ContainsKey("EventSetting"))                    {                        string eventSettingStr = dic["EventSetting"];                        if (eventSettingStr.ToLower() == "start")                        {                            recipeStep.IsTimeMeasurementStartStep = true;                        }                        else if (eventSettingStr.ToLower() == "stop")                        {                            recipeStep.IsTimeMeasurementStopStep = true;                        }                    }                    if (dic.ContainsKey("FilmThickFormula"))                    {                        recipeStep.FilmThickFormula = dic["FilmThickFormula"];                    }                    if (dic.ContainsKey("FilmThickCoefficientA"))                    {                        recipeStep.FilmThickCoefficientA = float.Parse(dic["FilmThickCoefficientA"]);                    }                    if (dic.ContainsKey("FilmThickCoefficientB"))                    {                        recipeStep.FilmThickCoefficientB = float.Parse(dic["FilmThickCoefficientB"]);                    }                    if (dic.ContainsKey("AlarmConditionTable"))                    {                        recipeStep.AlarmConditionTable = dic["AlarmConditionTable"];                    }                    for (int j = 1; j < 11; j++)                    {                        string tempType = "Ignore Alarm";                        string tempDetails = "";                        if (dic.ContainsKey($"AlarmAction.{j}"))                        {                            tempType = dic[$"AlarmAction.{j}"];                        }                        if (dic.ContainsKey($"AlarmDetails.{j}"))                        {                            tempDetails = dic[$"AlarmDetails.{j}"];                        }                        recipeStep.AlarmActionSets.Add(j, new AlarmActions()                        {                            ProcessingType = tempType,                            ProcessingDetails = tempDetails                        });                    }                    //if(dic.ContainsKey("Loop"))                    //{                    //    string loopStr = dic["Loop"];                    //    recipeStep.IsLoopStartStep = System.Text.RegularExpressions.Regex.Match(loopStr, @"Loop\x20\d+\s*$").Success;                    //    recipeStep.IsLoopEndStep = System.Text.RegularExpressions.Regex.Match(loopStr, @"Loop End$").Success;                    //    if (recipeStep.IsLoopStartStep)                    //        recipeStep.LoopCount = Convert.ToInt32(loopStr.Replace("Loop", string.Empty));                    //    else                    //        recipeStep.LoopCount = 0;                    //}                    //recipe time                    if (dic["Name"].ToLower() == "standby")                    {                        if (DateTime.TryParse(dic["Time"], out DateTime time))                        {                            recipeStep.StepTime = time.Second + time.Minute * 60 + time.Hour * 3600 + time.Millisecond / 1000.0;                        }                        else if (float.TryParse(dic["Time"], out float timeInSec))                        {                            recipeStep.StepTime = timeInSec;                            recipeStep.EndBy = EnumEndByCondition.ByTime;                        }                        else                        {                            recipeStep.StepTime = 0;                            recipeStep.EndBy = EnumEndByCondition.ByStandbyFactor;                        }                    }                    else                    {                        if (System.Text.RegularExpressions.Regex.Match(dic["Time"], @"[a-zA-Z]").Success)                        {                            if (SC.ContainsItem($"{module}.RecipeEditParameter.StepTime.{dic["Time"]}"))                            {                                var time = DateTime.Parse(SC.GetStringValue($"{module}.RecipeEditParameter.StepTime.{dic["Time"]}"));                                recipeStep.StepTime = time.Second + time.Minute * 60 + time.Hour * 3600;                            }                            else                            {                                reason = $"Configuration does not contains step time config {dic["Time"]}";                                return false;                            }                        }                        else                        {                            if (DateTime.TryParse(dic["Time"], out DateTime time))                            {                                recipeStep.StepTime = time.Second + time.Minute * 60 + time.Hour * 3600 + time.Millisecond / 1000.0;                            }                            else if (float.TryParse(dic["Time"], out float timeInSec))                            {                                recipeStep.StepTime = timeInSec;                            }                            else                            {                                reason = $"Step time {dic["Time"]} is invalid";                                return false;                            }                        }                        if (dic["ConditionCheck"].ToLower() == "none")                        {                            recipeStep.EndBy = EnumEndByCondition.ByTime;                        }                        else                        {                            recipeStep.EndBy = EnumEndByCondition.ByStandbyFactor;                        }                    }                    //ReplaceControlName(ref dic, "GasLineMFC1.Flow", "MFC1.SetParameters");                    //ReplaceControlName(ref dic, "GasLineMFC2.Flow", "MFC2.SetParameters");                    //ReplaceControlName(ref dic, "GasLineMFC3.Flow", "MFC3.SetParameters");                    //ReplaceControlName(ref dic, "GasLineMFC4.Flow", "MFC4.SetParameters");                    //ReplaceControlName(ref dic, "GasLineMFC5.Flow", "MFC5.SetParameters");                    //ReplaceControlName(ref dic, "GasLineMFC6.Flow", "MFC6.SetParameters");                    //ReplaceControlName(ref dic, "GasLineMFC7.Flow", "MFC7.SetParameters");                    //ReplaceControlName(ref dic, "GasLineMFC8.Flow", "MFC8.SetParameters");                    //ReplaceControlName(ref dic, "GasLineMFC9.Flow", "MFC9.SetParameters");                    //ReplaceControlName(ref dic, "GasLineMFC10.Flow", "MFC10.SetParameters");                    //ReplaceControlName(ref dic, "GasLineMFC11.Flow", "MFC11.SetParameters");                    //ReplaceControlName(ref dic, "GasLineMFC12.Flow", "MFC12.SetParameters");                    //ReplaceControlName(ref dic, "GasLineMFC51.Flow", "MFC51.SetParameters");                    AddParameter(ref dic, "MFC1.SetParameters", new string[8] { "MFC1.Flow.Set", "MFC1.Flow.Ramprate", "MFC1.Flow.SetUnit", "MFC1.Flow.RamprateUnit", "MFC1.Flow.Check", "MFC1.Flow.High", "MFC1.Flow.Low", "MFC1.Flow.Unit" });                    AddParameter(ref dic, "MFC2.SetParameters", new string[8] { "MFC2.Flow.Set", "MFC2.Flow.Ramprate", "MFC2.Flow.SetUnit", "MFC2.Flow.RamprateUnit", "MFC2.Flow.Check", "MFC2.Flow.High", "MFC2.Flow.Low", "MFC2.Flow.Unit" });                    AddParameter(ref dic, "MFC3.SetParameters", new string[8] { "MFC3.Flow.Set", "MFC3.Flow.Ramprate", "MFC3.Flow.SetUnit", "MFC3.Flow.RamprateUnit", "MFC3.Flow.Check", "MFC3.Flow.High", "MFC3.Flow.Low", "MFC3.Flow.Unit" });                    AddParameter(ref dic, "MFC4.SetParameters", new string[8] { "MFC4.Flow.Set", "MFC4.Flow.Ramprate", "MFC4.Flow.SetUnit", "MFC4.Flow.RamprateUnit", "MFC4.Flow.Check", "MFC4.Flow.High", "MFC4.Flow.Low", "MFC4.Flow.Unit" });                    AddParameter(ref dic, "MFC5.SetParameters", new string[8] { "MFC5.Flow.Set", "MFC5.Flow.Ramprate", "MFC5.Flow.SetUnit", "MFC5.Flow.RamprateUnit", "MFC5.Flow.Check", "MFC5.Flow.High", "MFC5.Flow.Low", "MFC5.Flow.Unit" });                    AddParameter(ref dic, "MFC6.SetParameters", new string[8] { "MFC6.Flow.Set", "MFC6.Flow.Ramprate", "MFC6.Flow.SetUnit", "MFC6.Flow.RamprateUnit", "MFC6.Flow.Check", "MFC6.Flow.High", "MFC6.Flow.Low", "MFC6.Flow.Unit" });                    AddParameter(ref dic, "MFC7.SetParameters", new string[8] { "MFC7.Flow.Set", "MFC7.Flow.Ramprate", "MFC7.Flow.SetUnit", "MFC7.Flow.RamprateUnit", "MFC7.Flow.Check", "MFC7.Flow.High", "MFC7.Flow.Low", "MFC7.Flow.Unit" });                    AddParameter(ref dic, "MFC8.SetParameters", new string[8] { "MFC8.Flow.Set", "MFC8.Flow.Ramprate", "MFC8.Flow.SetUnit", "MFC8.Flow.RamprateUnit", "MFC8.Flow.Check", "MFC8.Flow.High", "MFC8.Flow.Low", "MFC8.Flow.Unit" });                    AddParameter(ref dic, "MFC9.SetParameters", new string[8] { "MFC9.Flow.Set", "MFC9.Flow.Ramprate", "MFC9.Flow.SetUnit", "MFC9.Flow.RamprateUnit", "MFC9.Flow.Check", "MFC9.Flow.High", "MFC9.Flow.Low", "MFC9.Flow.Unit" });                    AddParameter(ref dic, "MFC10.SetParameters", new string[8] { "MFC10.Flow.Set", "MFC10.Flow.Ramprate", "MFC10.Flow.SetUnit", "MFC10.Flow.RamprateUnit", "MFC10.Flow.Check", "MFC10.Flow.High", "MFC10.Flow.Low", "MFC10.Flow.Unit" });                    AddParameter(ref dic, "MFC11.SetParameters", new string[8] { "MFC11.Flow.Set", "MFC11.Flow.Ramprate", "MFC11.Flow.SetUnit", "MFC11.Flow.RamprateUnit", "MFC11.Flow.Check", "MFC11.Flow.High", "MFC11.Flow.Low", "MFC11.Flow.Unit" });                    AddParameter(ref dic, "MFC12.SetParameters", new string[8] { "MFC12.Flow.Set", "MFC12.Flow.Ramprate", "MFC12.Flow.SetUnit", "MFC12.Flow.RamprateUnit", "MFC12.Flow.Check", "MFC12.Flow.High", "MFC12.Flow.Low", "MFC12.Flow.Unit" });                    AddParameter(ref dic, "MFC13.SetParameters", new string[8] { "MFC13.Flow.Set", "MFC13.Flow.Ramprate", "MFC13.Flow.SetUnit", "MFC13.Flow.RamprateUnit", "MFC13.Flow.Check", "MFC13.Flow.High", "MFC13.Flow.Low", "MFC13.Flow.Unit" });                    AddParameter(ref dic, "MFC14.SetParameters", new string[8] { "MFC14.Flow.Set", "MFC14.Flow.Ramprate", "MFC14.Flow.SetUnit", "MFC14.Flow.RamprateUnit", "MFC14.Flow.Check", "MFC14.Flow.High", "MFC14.Flow.Low", "MFC14.Flow.Unit" });                    AddParameter(ref dic, "MFC15.SetParameters", new string[8] { "MFC15.Flow.Set", "MFC15.Flow.Ramprate", "MFC15.Flow.SetUnit", "MFC15.Flow.RamprateUnit", "MFC15.Flow.Check", "MFC15.Flow.High", "MFC15.Flow.Low", "MFC15.Flow.Unit" });                    AddParameter(ref dic, "MFC16.SetParameters", new string[8] { "MFC16.Flow.Set", "MFC16.Flow.Ramprate", "MFC16.Flow.SetUnit", "MFC16.Flow.RamprateUnit", "MFC16.Flow.Check", "MFC16.Flow.High", "MFC16.Flow.Low", "MFC16.Flow.Unit" });                    AddParameter(ref dic, "MFC17.SetParameters", new string[8] { "MFC17.Flow.Set", "MFC17.Flow.Ramprate", "MFC17.Flow.SetUnit", "MFC17.Flow.RamprateUnit", "MFC17.Flow.Check", "MFC17.Flow.High", "MFC17.Flow.Low", "MFC17.Flow.Unit" });                    AddParameter(ref dic, "MFC31.SetParameters", new string[8] { "MFC31.Flow.Set", "MFC31.Flow.Ramprate", "MFC31.Flow.SetUnit", "MFC31.Flow.RamprateUnit", "MFC31.Flow.Check", "MFC31.Flow.High", "MFC31.Flow.Low", "MFC31.Flow.Unit" });                    AddParameter(ref dic, "MFC32.SetParameters", new string[8] { "MFC32.Flow.Set", "MFC32.Flow.Ramprate", "MFC32.Flow.SetUnit", "MFC32.Flow.RamprateUnit", "MFC32.Flow.Check", "MFC32.Flow.High", "MFC32.Flow.Low", "MFC32.Flow.Unit" });                    //AddParameter(ref dic, "MFC51.SetParameters", new string[8] { "MFC51.Flow.Set",  "MFC51.Flow.Ramprate", "MFC51.Flow.SetUnit", "MFC51.Flow.RamprateUnit", "MFC51.Flow.Check", "MFC51.Flow.High", "MFC51.Flow.Low", "MFC51.Flow.Unit" });                    ReplaceControlName(ref dic, "MFM57Flow", "MFM57.SetParameters");                    ReplaceControlName(ref dic, "MFM1Flow", "MFM1.SetParameters");                    ReplaceControlName(ref dic, "MFM6Flow", "MFM6.SetParameters");                    ReplaceControlName(ref dic, "MFM7Flow", "MFM7.SetParameters");                    ReplaceControlName(ref dic, "MFM8Flow", "MFM8.SetParameters");                    ReplaceControlName(ref dic, "MFM9Flow", "MFM9.SetParameters");                    ReplaceControlName(ref dic, "MFM11Flow", "MFM11.SetParameters");                    ReplaceControlName(ref dic, "MFM12Flow", "MFM12.SetParameters");                    ReplaceControlName(ref dic, "MFM13Flow", "MFM13.SetParameters");                    ReplaceControlName(ref dic, "MFM16Flow", "MFM16.SetParameters");                    ReplaceControlName(ref dic, "ConditionCheck", "SetConditionCheck");                    ReplaceControlName(ref dic, "Command", "SetCommand");                    if (dic.ContainsKey("AlarmConditionTable"))                        ReplaceControlName(ref dic, "AlarmConditionTable", "SetAlarmConditionTable");                    //ReplaceControlName(ref dic, "Heater2", "ZoneU.SetParameters");                    //ReplaceControlName(ref dic, "Heater4", "ZoneCU.SetParameters");                    //ReplaceControlName(ref dic, "Heater6", "ZoneC.SetParameters");                    //ReplaceControlName(ref dic, "Heater8", "ZoneCL.SetParameters");                    //ReplaceControlName(ref dic, "Heater10", "ZoneL.SetParameters");                    var controlMode = dic["Temperature.ControlMode"];                    var correct = dic["Temperature.Correct"];                    var PID = dic["Temperature.PID"];                    //AddParameter(ref dic, "ZoneU.SetParameters", controlMode, correct, PID);                    //AddParameter(ref dic, "ZoneCU.SetParameters", controlMode, correct, PID);                    //AddParameter(ref dic, "ZoneC.SetParameters", controlMode, correct, PID);                    //AddParameter(ref dic, "ZoneCL.SetParameters", controlMode, correct, PID);                    //AddParameter(ref dic, "ZoneL.SetParameters", controlMode, correct, PID);                    AddParameter(ref dic, "HeaterU.SetParameters", new string[9] { "HeaterU.ZoneName", "HeaterU.Set", "HeaterU.SetUnit", "HeaterU.Ramprate", "HeaterU.RamprateUnit", "HeaterU.Check", "HeaterU.High", "HeaterU.Low", "HeaterU.Unit" });                    AddParameterValue(ref dic, "HeaterU.SetParameters", new string[8] { controlMode, correct, PID, recipeHead.TempCorrect, recipeHead.TempPID, recipeHead.ProfileCondition, dic["ValveAV91"], dic["BWR"] });                    AddParameter(ref dic, "HeaterCU.SetParameters", new string[9] { "HeaterCU.ZoneName", "HeaterCU.Set", "HeaterCU.SetUnit", "HeaterCU.Ramprate", "HeaterCU.RamprateUnit", "HeaterCU.Check", "HeaterCU.High", "HeaterCU.Low", "HeaterCU.Unit" });                    AddParameterValue(ref dic, "HeaterCU.SetParameters", new string[8] { controlMode, correct, PID, recipeHead.TempCorrect, recipeHead.TempPID, recipeHead.ProfileCondition, dic["ValveAV91"], dic["BWR"] });                    AddParameter(ref dic, "HeaterC.SetParameters", new string[9] { "HeaterC.ZoneName", "HeaterC.Set", "HeaterC.SetUnit", "HeaterC.Ramprate", "HeaterC.RamprateUnit", "HeaterC.Check", "HeaterC.High", "HeaterC.Low", "HeaterC.Unit" });                    AddParameterValue(ref dic, "HeaterC.SetParameters", new string[8] { controlMode, correct, PID, recipeHead.TempCorrect, recipeHead.TempPID, recipeHead.ProfileCondition, dic["ValveAV91"], dic["BWR"] });                    AddParameter(ref dic, "HeaterCL.SetParameters", new string[9] { "HeaterCL.ZoneName", "HeaterCL.Set", "HeaterCL.SetUnit", "HeaterCL.Ramprate", "HeaterCL.RamprateUnit", "HeaterCL.Check", "HeaterCL.High", "HeaterCL.Low", "HeaterCL.Unit" });                    AddParameterValue(ref dic, "HeaterCL.SetParameters", new string[8] { controlMode, correct, PID, recipeHead.TempCorrect, recipeHead.TempPID, recipeHead.ProfileCondition, dic["ValveAV91"], dic["BWR"] });                    AddParameter(ref dic, "HeaterL.SetParameters", new string[9] { "HeaterL.ZoneName", "HeaterL.Set", "HeaterL.SetUnit", "HeaterL.Ramprate", "HeaterL.RamprateUnit", "HeaterL.Check", "HeaterL.High", "HeaterL.Low", "HeaterL.Unit" });                    AddParameterValue(ref dic, "HeaterL.SetParameters", new string[8] { controlMode, correct, PID, recipeHead.TempCorrect, recipeHead.TempPID, recipeHead.ProfileCondition, dic["ValveAV91"], dic["BWR"] });                    AddParameter(ref dic, "APC.SetParameters", new string[10] { "Press.Command", "Press.PID", "Press.Set", "Press.SlowVacSet", "Press.ValveAngleSet", "Press.IsWait", "Press.LowWait", "Press.HighWait", "Press.WaitUnit", "Press.WaitPress" });//APC                    AddParameterValue(ref dic, "APC.SetParameters", new string[2] { recipeHead.PressApcPID, dic["ValveAV71"] });//APC                    AddParameter(ref dic, "SetBoatMotion", new string[5] { "Loader.Command", "Loader.Speed1", "Loader.Speed2", "Loader.Speed3", "Loader.RPM" });//Boat                    List<string> auxCommands = new List<string>();                    for (int k = 1; k < 200; k++)                    {                        if (!dic.ContainsKey($"AUX.{k}.Set"))                            continue;                        auxCommands.Add($"{k},{dic[$"AUX.{k}.Set"]},{dic[$"AUX.{k}.Check"]},{dic[$"AUX.{k}.High"]},{dic[$"AUX.{k}.Low"]},{dic[$"AUX.{k}.CheckUnit"]}");                        dic.Remove($"AUX.{k}.Set");                        dic.Remove($"AUX.{k}.Check");                        dic.Remove($"AUX.{k}.High");                        dic.Remove($"AUX.{k}.Low");                        dic.Remove($"AUX.{k}.CheckUnit");                    }                    dic.Add("AUX.SetParameters", string.Join(";", auxCommands));                    //ReplaceControlName(ref dic, "RFSwitch", "RfPower.SetParameters");                    //AddParameter(ref dic, "RfPower.SetParameters", dic["RFSetpoint"], dic["ForwardPowerAlarmWatchTable"], dic["PrAlarmWatchTable"], dic["PIAlarmWatchTable"]);                    //ReplaceControlName(ref dic, "C1Setpoint", "RfMatch.SetParameters");                    //AddParameter(ref dic, "RfMatch.SetParameters", dic["C2Setpoint"], dic["C1AlarmWatchTable"], dic["C2AlarmWatchTable"], dic["VppAlarmWatchTable"]);                    AddValveParameter(ref dic, "SetValves", new string[153] {                      "ValveAV1",                      "ValveAV2",                      "ValveAV3",                      "ValveAV4",                      "ValveAV5",                      "ValveAV6",                      "ValveAV7",                      "ValveAV8",                      "ValveAV9",                      "ValveAV10",                      "ValveAV11",                      "ValveAV12",                      "ValveAV13",                      "ValveAV14",                      "ValveAV15",                      "ValveAV16",                      "ValveAV17",                      "ValveAV18",                      "ValveAV19",                      "ValveAV20",                      "ValveAV21",                      "ValveAV22",                      "ValveAV23",                      "ValveAV24",                      "ValveAV25",                      "ValveAV26",                      "ValveAV27",                      "ValveAV28",                      "ValveAV29",                      "ValveAV30",                      "ValveAV31",                      "ValveAV32",                      "ValveAV33",                      "ValveAV34",                      "ValveAV35",                      "ValveAV36",                      "ValveAV37",                      "ValveAV38",                      "ValveAV39",                      "ValveAV40",                      "ValveAV41",                      "ValveAV42",                      "ValveAV43",                      "ValveAV44",                      "ValveAV45",                      "ValveAV46",                      "ValveAV47",                      "ValveAV48",                      "ValveAV49",                      "ValveAV50",                      "ValveAV51",                      "ValveAV52",                      "ValveAV53",                      "ValveAV60",                      "ValveAV61",                      "ValveAV62",                      "ValveAV63",                      "ValveAV64",                      "ValveAV65",                      "ValveAV66",                      "ValveAV67",                      "ValveAV68",                      "ValveAV69",                      "ValveAV70",                      "ValveAV71",                      "ValveAV72",                      "ValveAV73",                      "ValveAV74",                      "ValveAV75",                      "ValveAV76",                      "ValveAV77",                      "ValveAV78",                      "ValveAV79",                      "ValveAV80",                      "ValveAV81",                      "ValveAV82",                      "ValveAV83",                      "ValveAV84",                      "ValveAV85",                      "ValveAV86",                      "ValveAV87",                      "ValveAV88",                      "ValveAV89",                      "ValveAV90",                      "ValveAV91",                      "ValveAV92",                      "ValveAV93",                      "ValveAV94",                      "ValveAV95",                      "ValveAV96",                      "ValveAV97",                      "ValveAV98",                      "ValveAV99",                      "ValveAV100",                      "ValveAV101",                      "ValveAV102",                      "ValveAV103",                      "ValveAV104",                      "ValveAV105",                      "ValveAV106",                      "ValveAV107",                      "ValveAV108",                      "ValveAV109",                      "ValveAV110",                      "ValveAV111",                      "ValveAV112",                      "ValveAV113",                      "ValveAV114",                      "ValveAV115",                      "ValveAV116",                      "ValveAV117",                      "ValveAV118",                      "ValveAV119",                      "ValveAV120",                      "ValveAV121",                      "ValveAV122",                      "ValveAV123",                      "ValveAV124",                      "ValveAV125",                      "ValveAV126",                      "ValveAV127",                      "ValveAV128",                      "ValveAV129",                      "ValveAV130",                      "ValveAV131",                      "ValveAV132",                      "ValveAV133",                      "ValveAV134",                      "ValveAV135",                      "ValveAV136",                        "DPR",                        "AGV",                        "AGV2",                        "MBP",                        "MBP1",                        "MBP2",                        "DP",                        "BWR",                        "F2Cln",                        "HFCln",                        "CEXH",                        "DEPO",                        "HTR1",                        "HTR2",                        "HTR3",                        "DP1",                        "DP2",                        "HMNT",                        "CMNT",                        "HREF",                        "CREF",                        "HZERO",                        "CZERO"                    });                    //dic.Remove("SetValves");                    //dic.Remove("HeaterU.SetParameters");                    //dic.Remove("HeaterCU.SetParameters");                    //dic.Remove("HeaterC.SetParameters");                    //dic.Remove("HeaterCL.SetParameters");                    //dic.Remove("HeaterL.SetParameters");                    //dic.Remove("MFC1.SetParameters");                    //dic.Remove("MFC2.SetParameters");                    //dic.Remove("MFC3.SetParameters");                    //dic.Remove("MFC4.SetParameters");                    //dic.Remove("MFC5.SetParameters");                    //dic.Remove("MFC6.SetParameters");                    //dic.Remove("MFC7.SetParameters");                    //dic.Remove("MFC8.SetParameters");                    //dic.Remove("MFC9.SetParameters");                    //dic.Remove("MFC10.SetParameters");                    //dic.Remove("MFC11.SetParameters");                    //dic.Remove("MFC12.SetParameters");                    //ReplaceControlNameForValve(ref dic, "ValveAV1");                    //ReplaceControlNameForValve(ref dic, "ValveAV2");                    //ReplaceControlNameForValve(ref dic, "ValveAV3");                    //ReplaceControlNameForValve(ref dic, "ValveAV4");                    //ReplaceControlNameForValve(ref dic, "ValveAV5");                    //ReplaceControlNameForValve(ref dic, "ValveAV6");                    //ReplaceControlNameForValve(ref dic, "ValveAV7");                    //ReplaceControlNameForValve(ref dic, "ValveAV8");                    //ReplaceControlNameForValve(ref dic, "ValveAV9");                    //ReplaceControlNameForValve(ref dic, "ValveAV10");                    //ReplaceControlNameForValve(ref dic, "ValveAV11");                    //ReplaceControlNameForValve(ref dic, "ValveAV12");                    //ReplaceControlNameForValve(ref dic, "ValveAV13");                    //ReplaceControlNameForValve(ref dic, "ValveAV14");                    //ReplaceControlNameForValve(ref dic, "ValveAV15");                    //ReplaceControlNameForValve(ref dic, "ValveAV16");                    //ReplaceControlNameForValve(ref dic, "ValveAV17");                    //ReplaceControlNameForValve(ref dic, "ValveAV18");                    //ReplaceControlNameForValve(ref dic, "ValveAV19");                    //ReplaceControlNameForValve(ref dic, "ValveAV20");                    //ReplaceControlNameForValve(ref dic, "ValveAV21");                    //ReplaceControlNameForValve(ref dic, "ValveAV22");                    //ReplaceControlNameForValve(ref dic, "ValveAV23");                    //ReplaceControlNameForValve(ref dic, "ValveAV24");                    //ReplaceControlNameForValve(ref dic, "ValveAV25");                    //ReplaceControlNameForValve(ref dic, "ValveAV26");                    //ReplaceControlNameForValve(ref dic, "ValveAV27");                    //ReplaceControlNameForValve(ref dic, "ValveAV28");                    //ReplaceControlNameForValve(ref dic, "ValveAV29");                    //ReplaceControlNameForValve(ref dic, "ValveAV30");                    //ReplaceControlNameForValve(ref dic, "ValveAV31");                    //ReplaceControlNameForValve(ref dic, "ValveAV32");                    //ReplaceControlNameForValve(ref dic, "ValveAV33");                    //ReplaceControlNameForValve(ref dic, "ValveAV34");                    //ReplaceControlNameForValve(ref dic, "ValveAV35");                    //ReplaceControlNameForValve(ref dic, "ValveAV36");                    //ReplaceControlNameForValve(ref dic, "ValveAV37");                    //ReplaceControlNameForValve(ref dic, "ValveAV38");                    //ReplaceControlNameForValve(ref dic, "ValveAV39");                    //ReplaceControlNameForValve(ref dic, "ValveAV52");                    ////ReplaceControlNameForValve(ref dic, "ValveAV54");                    ////ReplaceControlNameForValve(ref dic, "ValveAV56");                    ////ReplaceControlNameForValve(ref dic, "ValveAV57");                    ////ReplaceControlNameForValve(ref dic, "ValveAV58");                    ////ReplaceControlNameForValve(ref dic, "ValveAV59");                    //ReplaceControlNameForValve(ref dic, "ValveAV60");                    ////ReplaceControlNameForValve(ref dic, "ValveAV65");                    ////ReplaceControlNameForValve(ref dic, "ValveAV66");                    ////ReplaceControlNameForValve(ref dic, "ValveAV68");                    //ReplaceControlNameForValve(ref dic, "ValveAV71");                    //ReplaceControlNameForValve(ref dic, "ValveAV72");                    //ReplaceControlNameForValve(ref dic, "ValveAV73");                    //ReplaceControlNameForValve(ref dic, "ValveAV74");                    //ReplaceControlNameForValve(ref dic, "ValveAV75");                    //ReplaceControlNameForValve(ref dic, "ValveAV77");                    //ReplaceControlNameForValve(ref dic, "ValveAV81");                    //ReplaceControlNameForValve(ref dic, "ValveAV82");                    //ReplaceControlNameForValve(ref dic, "ValveAV83");                    //ReplaceControlNameForValve(ref dic, "ValveAV91");                    dic.Remove("StepNo");                    dic.Remove("Name");                    dic.Remove("EndBy");                    dic.Remove("Time");                    dic.Remove("ZAxisPosition");                    dic.Remove("ZAxisSpeed");                    dic.Remove("RotatePosition");                    dic.Remove("RotateSpeed");                    dic.Remove("RotateDirection");                    dic.Remove("Heater1");                    dic.Remove("Heater2");                    dic.Remove("Heater3");                    dic.Remove("Heater4");                    dic.Remove("Heater5");                    dic.Remove("ValveAV54");                    dic.Remove("ValveAV55");                    dic.Remove("ValveAV56");                    dic.Remove("ValveAV57");                    dic.Remove("ValveAV58");                    dic.Remove("ValveAV59");                    dic.Remove("ValveAV65");                    dic.Remove("ValveAV66");                    dic.Remove("ValveAV68");                    dic.Remove("ExternalOn");                    dic.Remove("ExternalOff");                    dic.Remove("ExternalSensor");                    dic.Remove("TempStabilize");                    dic.Remove("FinishAutoProfile");                    dic.Remove("ReachTempWait");                    dic.Remove("ReachTemp");                    dic.Remove("TempUpper");                    dic.Remove("TempLower");                    dic.Remove("ReachPressureWait");                    dic.Remove("ReachPressure");                    dic.Remove("PressureUpper");                    dic.Remove("PressureLower");                    dic.Remove("PressureStabilize");                    dic.Remove("External.Out1");                    dic.Remove("External.Out2");                    dic.Remove("External.Out3");                    dic.Remove("External.Out4");                    dic.Remove("External.Out5");                    dic.Remove("External.Out6");                    dic.Remove("RFSwitch");                    dic.Remove("RFSetpoint");                    dic.Remove("ForwardPowerAlarmWatchTable");                    dic.Remove("PrAlarmWatchTable");                    dic.Remove("PIAlarmWatchTable");                    dic.Remove("C1Setpoint");                    dic.Remove("C2Setpoint");                    dic.Remove("C1AlarmWatchTable");                    dic.Remove("C2AlarmWatchTable");                    dic.Remove("VppAlarmWatchTable");                    dic.Remove("VdcAlarmWatchTable");                    dic.Remove("AbortRecipeTableIndex");                    dic.Remove("Temperature.ControlMode");                    dic.Remove("Temperature.Correct");                    dic.Remove("Temperature.PID");                    dic.Remove("Temperature.Profile");                    dic.Remove("Temperature.Stabilize");                    dic.Remove("Temperature.TempReadyCond");                    dic.Remove("FilmThickFormula");                    dic.Remove("FilmThickCoefficientA");                    dic.Remove("FilmThickCoefficientB");                    dic.Remove("APC.SetPressure");                    dic.Remove("PressureSettingVG");                    dic.Remove("PressureSonserValue");                    dic.Remove("PressureValveAngle");                    dic.Remove("PressureAlarmTableNo");                    dic.Remove("EventSetting");                    dic.Remove("AlarmTableIndex");                    dic.Remove("AlarmDetails.1");                    dic.Remove("AlarmAction.1");                    dic.Remove("AlarmDetails.2");                    dic.Remove("AlarmAction.2");                    dic.Remove("AlarmDetails.3");                    dic.Remove("AlarmAction.3");                    dic.Remove("AlarmDetails.4");                    dic.Remove("AlarmAction.4");                    dic.Remove("AlarmDetails.5");                    dic.Remove("AlarmAction.5");                    dic.Remove("AlarmDetails.6");                    dic.Remove("AlarmAction.6");                    dic.Remove("AlarmDetails.7");                    dic.Remove("AlarmAction.7");                    dic.Remove("AlarmDetails.8");                    dic.Remove("AlarmAction.8");                    dic.Remove("AlarmDetails.9");                    dic.Remove("AlarmAction.9");                    dic.Remove("AlarmDetails.10");                    dic.Remove("AlarmAction.10");                    //List<string> mfcCheckInstall = new List<string>()                    //{                    //    "MfcN1",                    //    "MfcN2",                    //    "MfcN3",                    //    "MfcH1",                    //    "MfcJ1",                    //    "MfcXN1",                    //};                    //foreach(var mfc in mfcCheckInstall)                    //{                    //    if (!SC.GetValue<bool>($"PM1.MFC.{mfc}.IsMFCInstalled"))                    //        dic.Remove($"{mfc}.SetParameters");                    //}                    foreach (string key in dic.Keys)                        recipeStep.RecipeCommands.Add(key, dic[key]);                }                for (int i = 0; i < recipeData.Count; i++)                {                    if (recipeData[i].IsJumpStep)                    {                        bool findJumpStep = false;                        for (int j = 0; j < recipeData.Count; j++)                        {                            if (recipeData[j].StepName == recipeData[i].JumpStepName)                            {                                recipeData[i].JumpStepNo = j;                                findJumpStep = true;                                break;                            }                        }                        if (!findJumpStep)                        {                            reason = $"Recipe file does not contains jump step {recipeData[i].JumpStepName}";                            return false;                        }                    }                }            }            catch (Exception ex)            {                LOG.Write(ex);                reason = $"Recipe file content not valid, {recipeFile}, {ex.Message}";                return false;            }            return true;        }        public static bool LayoutRecipeParse(string recipeFile, string module, out RecipeLayoutEntityNormal layoutRecipeDataNormal, out RecipeLayoutEntityExpert layoutRecipeDataExpert, out RecipeLayoutEntityConfig layoutRecipeDataConfig, out string reason)        {            reason = string.Empty;            layoutRecipeDataNormal = new RecipeLayoutEntityNormal();            layoutRecipeDataExpert = new RecipeLayoutEntityExpert();            layoutRecipeDataConfig = new RecipeLayoutEntityConfig();            string content = RecipeFileManager.Instance.LoadRecipe($"{SC.GetStringValue("System.Recipe.SupportedChamberType")}\\{SC.GetStringValue("System.Recipe.SupportedLayoutType")}", recipeFile, false);            if (string.IsNullOrEmpty(content))            {                reason = $"{recipeFile} is not a valid recipe file";                return false;            }            try            {                XmlDocument rcpDataDoc = new XmlDocument();                rcpDataDoc.LoadXml(content);                XmlNode nodeModule;                nodeModule = rcpDataDoc.SelectSingleNode("/Aitex/TableRecipeData/Module/Step[@Name='Normal']");                if (nodeModule == null)                {                    //reason = "Recipe file does not contains step content for Normal";                    return false;                }                else                {                    Type t = layoutRecipeDataNormal.GetType();                    foreach (FieldInfo pi in t.GetFields())                    {                        XmlElement stepNode = nodeModule as XmlElement;                        //遍历Step节点                        foreach (XmlAttribute att in stepNode.Attributes)                        {                            if (pi.Name == att.Name)                            {                                pi.SetValue(layoutRecipeDataNormal, att.Value);                            }                        }                    }                }                nodeModule = rcpDataDoc.SelectSingleNode("/Aitex/TableRecipeData/Module/Step[@Name='Expert']");                if (nodeModule == null)                {                    //reason = "Recipe file does not contains step content for Expert";                    return false;                }                else                {                    XmlElement stepNode = nodeModule as XmlElement;                    string strName = "";                    //遍历Step节点                    foreach (XmlAttribute att in stepNode.Attributes)                    {                        if (att.Name != "Name")                        {                            layoutRecipeDataExpert.Items.Add(att.Value);                        }                        else                        {                            strName = att.Value;                        }                    }                    layoutRecipeDataExpert.Name = strName;                }                nodeModule = rcpDataDoc.SelectSingleNode("/Aitex/TableRecipeData/Module[@Name='PM1']/Config");                if (nodeModule == null)                {                    return false;                }                else                {                    Type t = layoutRecipeDataConfig.GetType();                    foreach (FieldInfo pi in t.GetFields())                    {                        XmlElement stepNode = nodeModule as XmlElement;                        //遍历Step节点                        foreach (XmlAttribute att in stepNode.Attributes)                        {                            if (pi.Name == att.Name)                            {                                pi.SetValue(layoutRecipeDataConfig, att.Value);                            }                        }                    }                }            }            catch (Exception ex)            {                LOG.Write(ex);                reason = $"Recipe file content not valid, {recipeFile}, {ex.Message}";                return false;            }            return true;        }        private static void ReplaceControlName(ref Dictionary<string, string> dic, string from, string to)        {            if (dic.ContainsKey(from))            {                dic.Add(to, dic[from]);                dic.Remove(from);            }        }        private static void ReplaceControlName(ref Dictionary<string, string> dic, string from, string to1, string to2)        {            dic.Add(to1, dic[from]);            dic.Add(to2, dic[from]);            dic.Remove(from);        }        private static void ReplaceControlNameForValve(ref Dictionary<string, string> dic, string key)        {            switch (dic[key].ToLower())            {                case "open":                    dic[key] = "true";                    break;                case "close":                    dic[key] = "false";                    break;                case "continue":                    dic[key] = "Continue";                    break;            }            //dic[key] = dic[key].ToLower() == "open" ? "true" : "false";        }        private static void AddValveParameter(ref Dictionary<string, string> dic, string to, string[] param)        {            if (param != null && param.Length > 0)            {                foreach (var item in param)                {                    if (!string.IsNullOrEmpty(item) && dic.ContainsKey(item))                    {                        if (!dic.ContainsKey(to))                            dic.Add(to, "");                        var set = "";                        switch (dic[item].ToLower())                        {                            case "open":                                set = "true";                                break;                            case "close":                                set = "false";                                break;                            case "continue":                                set = "Continue";                                break;                        }                        var value = $"{dic[to]};{item},{set}";                        dic[to] = string.IsNullOrEmpty(dic[to]) ? $"{item},{set}" : value;                        dic.Remove(item);                    }                }            }        }        private static void AddParameter(ref Dictionary<string, string> dic, string to, string from1, string from2, string from3, string from4 = null)        {            var value = $"{dic[to]};{from1};{from2};{from3}";            if (!string.IsNullOrEmpty(from4))                value = $"{value};{from4}";            dic[to] = value;        }        private static void AddParameter(ref Dictionary<string, string> dic, string to, string[] param)        {            if (param != null && param.Length > 0)            {                foreach (var item in param)                {                    if (!string.IsNullOrEmpty(item) && dic.ContainsKey(item))                    {                        if (!dic.ContainsKey(to))                            dic.Add(to, "");                        var value = $"{dic[to]};{dic[item]}";                        dic[to] = string.IsNullOrEmpty(dic[to]) ? dic[item] : value;                        dic.Remove(item);                    }                }            }        }        private static void AddParameterValue(ref Dictionary<string, string> dic, string to, string[] param)        {            if (!dic.ContainsKey(to))                dic.Add(to, "");            if (param != null && param.Length > 0)            {                foreach (var item in param)                {                    var value = $"{dic[to]};{item}";                    dic[to] = string.IsNullOrEmpty(dic[to]) ? item : value;                }            }        }        public static bool ParseTables(string recipeFile, string module, out Dictionary<int, List<RecipeStep>> recipeDatas, out string reason, string recipeType)        {            reason = string.Empty;            recipeDatas = new Dictionary<int, List<RecipeStep>>();            string content = string.Empty;            if (recipeType != "Process" && recipeType != "Idle" && recipeType != "Reset")            {                if (!File.Exists($"{PathManager.GetRecipeDir()}\\{SC.GetStringValue("System.Recipe.SupportedChamberType")}\\{SC.GetStringValue($"System.Recipe.Supported{recipeType}Type")}\\{recipeFile}.rcp"))                    return true;            }            content = RecipeFileManager.Instance.LoadRecipe($"{SC.GetStringValue("System.Recipe.SupportedChamberType")}\\{SC.GetStringValue($"System.Recipe.Supported{recipeType}Type")}", recipeFile, false);            if (string.IsNullOrEmpty(content))            {                reason = $"{recipeFile} is not a valid recipe file";                return false;            }            try            {                //获取工艺程序文件中允许的命令字符串列表                //目的:如果工艺程序文件中含有规定之外的命令,则被禁止执行                HashSet<string> recipeAllowedCommands = new HashSet<string>();                XmlDocument rcpFormatDoc = new XmlDocument();                string recipeSchema = PathManager.GetCfgDir() + $@"\Recipe\Furnace\Process\{SC.GetStringValue("System.SetUp.ToolType")}\RecipeFormat.xml";                rcpFormatDoc.Load(recipeSchema);                XmlNodeList rcpItemNodeList = rcpFormatDoc.SelectNodes("/Aitex/TableRecipeFormat/Catalog/Group/Step");                foreach (XmlElement item in rcpItemNodeList)                    recipeAllowedCommands.Add(item.Attributes["ControlName"].Value);                recipeAllowedCommands.Add("Temperature.ControlMode");                recipeAllowedCommands.Add("Temperature.Correct");                recipeAllowedCommands.Add("Temperature.PID");                recipeAllowedCommands.Add("ConditionCheck");                recipeAllowedCommands.Add("EventSetting");                recipeAllowedCommands.Add("FilmThickFormula");                recipeAllowedCommands.Add("FilmThickCoefficientA");                recipeAllowedCommands.Add("FilmThickCoefficientB");                recipeAllowedCommands.Add("AlarmTableIndex");                recipeAllowedCommands.Add("RFSwitch");                recipeAllowedCommands.Add("RFSetpoint");                recipeAllowedCommands.Add("ForwardPowerAlarmWatchTable");                recipeAllowedCommands.Add("PrAlarmWatchTable");                recipeAllowedCommands.Add("PIAlarmWatchTable");                recipeAllowedCommands.Add("C1Setpoint");                recipeAllowedCommands.Add("C2Setpoint");                recipeAllowedCommands.Add("C1AlarmWatchTable");                recipeAllowedCommands.Add("C2AlarmWatchTable");                recipeAllowedCommands.Add("VppAlarmWatchTable");                recipeAllowedCommands.Add("VdcAlarmWatchTable");                recipeAllowedCommands.Add("PressureSonserValue");                recipeAllowedCommands.Add("PressureValveAngle");                recipeAllowedCommands.Add("PressureSettingVG");                recipeAllowedCommands.Add("PressCommand");                recipeAllowedCommands.Add("PressValue");                recipeAllowedCommands.Add("PressureAlarmTableNo");                recipeAllowedCommands.Add("AbortRecipeTableIndex");                recipeAllowedCommands.Add("AlarmConditionTable");                recipeAllowedCommands.Add("LoaderCommand");                recipeAllowedCommands.Add("LoaderValue");                for (int i = 1; i < 11; i++)                {                    recipeAllowedCommands.Add($"AlarmAction.{i}");                    recipeAllowedCommands.Add($"AlarmDetails.{i}");                }                for (int i = 1; i < 60; i++)                {                    recipeAllowedCommands.Add($"MFC{i}.Flow.Set");                    recipeAllowedCommands.Add($"MFC{i}.Flow.SetUnit");                    recipeAllowedCommands.Add($"MFC{i}.Flow.Ramprate");                    recipeAllowedCommands.Add($"MFC{i}.Flow.RamprateUnit");                    recipeAllowedCommands.Add($"MFC{i}.Flow.Check");                    recipeAllowedCommands.Add($"MFC{i}.Flow.High");                    recipeAllowedCommands.Add($"MFC{i}.Flow.Low");                    recipeAllowedCommands.Add($"MFC{i}.Flow.Unit");                }                for (int i = 1; i < 200; i++)                {                    recipeAllowedCommands.Add($"AUX.{i}.Set");                    recipeAllowedCommands.Add($"AUX.{i}.Check");                    recipeAllowedCommands.Add($"AUX.{i}.High");                    recipeAllowedCommands.Add($"AUX.{i}.Low");                    recipeAllowedCommands.Add($"AUX.{i}.CheckUnit");                }                recipeAllowedCommands.Add("HeaterU.ZoneName");                recipeAllowedCommands.Add("HeaterU.Set");                recipeAllowedCommands.Add("HeaterU.SetUnit");                recipeAllowedCommands.Add("HeaterU.Ramprate");                recipeAllowedCommands.Add("HeaterU.RamprateUnit");                recipeAllowedCommands.Add("HeaterU.Check");                recipeAllowedCommands.Add("HeaterU.High");                recipeAllowedCommands.Add("HeaterU.Low");                recipeAllowedCommands.Add("HeaterU.Unit");                recipeAllowedCommands.Add("HeaterCU.ZoneName");                recipeAllowedCommands.Add("HeaterCU.Set");                recipeAllowedCommands.Add("HeaterCU.SetUnit");                recipeAllowedCommands.Add("HeaterCU.Ramprate");                recipeAllowedCommands.Add("HeaterCU.RamprateUnit");                recipeAllowedCommands.Add("HeaterCU.Check");                recipeAllowedCommands.Add("HeaterCU.High");                recipeAllowedCommands.Add("HeaterCU.Low");                recipeAllowedCommands.Add("HeaterCU.Unit");                recipeAllowedCommands.Add("HeaterC.ZoneName");                recipeAllowedCommands.Add("HeaterC.Set");                recipeAllowedCommands.Add("HeaterC.SetUnit");                recipeAllowedCommands.Add("HeaterC.Ramprate");                recipeAllowedCommands.Add("HeaterC.RamprateUnit");                recipeAllowedCommands.Add("HeaterC.Check");                recipeAllowedCommands.Add("HeaterC.High");                recipeAllowedCommands.Add("HeaterC.Low");                recipeAllowedCommands.Add("HeaterC.Unit");                recipeAllowedCommands.Add("HeaterCL.ZoneName");                recipeAllowedCommands.Add("HeaterCL.Set");                recipeAllowedCommands.Add("HeaterCL.SetUnit");                recipeAllowedCommands.Add("HeaterCL.Ramprate");                recipeAllowedCommands.Add("HeaterCL.RamprateUnit");                recipeAllowedCommands.Add("HeaterCL.Check");                recipeAllowedCommands.Add("HeaterCL.High");                recipeAllowedCommands.Add("HeaterCL.Low");                recipeAllowedCommands.Add("HeaterCL.Unit");                recipeAllowedCommands.Add("HeaterL.ZoneName");                recipeAllowedCommands.Add("HeaterL.Set");                recipeAllowedCommands.Add("HeaterL.SetUnit");                recipeAllowedCommands.Add("HeaterL.Ramprate");                recipeAllowedCommands.Add("HeaterL.RamprateUnit");                recipeAllowedCommands.Add("HeaterL.Check");                recipeAllowedCommands.Add("HeaterL.High");                recipeAllowedCommands.Add("HeaterL.Low");                recipeAllowedCommands.Add("HeaterL.Unit");                recipeAllowedCommands.Add("Loader.Command");                recipeAllowedCommands.Add("Loader.Speed1");                recipeAllowedCommands.Add("Loader.Speed2");                recipeAllowedCommands.Add("Loader.Speed3");                recipeAllowedCommands.Add("Loader.RPM");                recipeAllowedCommands.Add("Press.Command");                recipeAllowedCommands.Add("Press.PID");                recipeAllowedCommands.Add("Press.Set");                recipeAllowedCommands.Add("Press.SlowVacSet");                recipeAllowedCommands.Add("Press.ValveAngleSet");                recipeAllowedCommands.Add("Press.IsWait");                recipeAllowedCommands.Add("Press.LowWait");                recipeAllowedCommands.Add("Press.HighWait");                recipeAllowedCommands.Add("Press.WaitUnit");                recipeAllowedCommands.Add("Press.WaitPress");                //获取工艺程序文件中所有步的内容                XmlDocument rcpDataDoc = new XmlDocument();                rcpDataDoc.LoadXml(content);                XmlNodeList tablesNodeList = rcpDataDoc.SelectNodes("//Tables/Table");                if (tablesNodeList == null || tablesNodeList.Count == 0)                {                    reason = "No Table nodes found.";                    return false;                }                for (int x = 0; x < tablesNodeList.Count; x++)                {                    XmlNode tableNode = tablesNodeList[x];                    // 获取当前 Table 下的所有 Step 节点                    XmlNodeList stepNodes = tableNode.SelectNodes("Step");                    #region                     string strLoopEndStep, strJumpStep;                    strLoopEndStep = strJumpStep = string.Empty;                    var recipeData = new List<RecipeStep>();                    for (int i = 0; i < stepNodes.Count; i++)                    {                        var recipeStep = new RecipeStep();                        recipeStep.RecipeType = recipeType;                        recipeData.Add(recipeStep);                        XmlElement stepNode = stepNodes[i] as XmlElement;                        Dictionary<string, string> dic = new Dictionary<string, string>();                        //遍历Step节点                        foreach (XmlAttribute att in stepNode.Attributes)                        {                            if (recipeAllowedCommands.Contains(att.Name))                            {                                dic.Add(att.Name, att.Value);                            }                        }                        //遍历Step子节点中所有的attribute属性节点                        foreach (XmlElement subStepNode in stepNode.ChildNodes)                        {                            foreach (XmlAttribute att in subStepNode.Attributes)                            {                                if (recipeAllowedCommands.Contains(att.Name))                                {                                    dic.Add(att.Name, att.Value);                                }                            }                            //遍历Step子节点的子节点中所有的attribute属性节点                            foreach (XmlElement subsubStepNode in subStepNode.ChildNodes)                            {                                foreach (XmlAttribute att in subsubStepNode.Attributes)                                {                                    if (recipeAllowedCommands.Contains(att.Name))                                    {                                        dic.Add(att.Name, att.Value);                                    }                                }                            }                        }                        recipeStep.StepName = dic["Name"];                        if (dic["Name"] == strLoopEndStep)                        {                            recipeStep.IsLoopEndStep = true;                            strLoopEndStep = string.Empty;                        }                        recipeStep.IsJumpStep = false;                        if (dic.ContainsKey("Command"))                        {                            string commandStr = dic["Command"];                            if (commandStr.Contains("CallSystemRecipe"))                            {                            }                            else if (commandStr.ToUpper().StartsWith("CALL"))                            {                                int subTableID = 0;                                var subPara = commandStr.Replace("CALL", "").Replace("[", "").Replace("]", "").Split('*');                                if (subPara != null && subPara.Length > 1)                                {                                    int.TryParse(subPara[0], out int loopCount);                                    var tablePara = subPara[1].Split(':');                                    if (tablePara != null && tablePara.Length > 1)                                    {                                        int.TryParse(tablePara[0], out subTableID);                                        if (subTableID > 0)                                        {                                            recipeStep.IsCallSubStep = true;                                            recipeStep.SubRecipeLoopCount = loopCount;                                        }                                    }                                    recipeStep.SubRecipeTableInfo = subPara[1];                                }                            }                            else if (commandStr.ToUpper().StartsWith("LOOP"))                            {                                recipeStep.IsLoopEndStep = true;                                var loopPara = commandStr.Replace("LOOP", "").Replace("[", "").Replace("]", "").Split('*');                                if (loopPara != null && loopPara.Length > 1)                                {                                    int.TryParse(loopPara[0], out int loopCount);                                    recipeStep.LoopCount = loopCount + 1;//加1是因为第一次从正常的start-》end的执行算是一次循环,所以要额外加1                                    int loopStartStep = -1;                                    for (int index = 0; index < recipeData.Count; index++)                                    {                                        if (recipeData[index].StepName == loopPara[1])                                        {                                            loopStartStep = index;                                            break;                                        }                                    }                                    if (loopStartStep < 0)                                    {                                        reason = $"Recipe file does not contains LOOP step {loopPara[1]}";                                        return false;                                    }                                    if (loopPara[1] != null)                                    {                                        if (loopStartStep < 0 ||                                            (recipeType == "Process" && loopStartStep == 0))//Process recipe的standby不参与循环                                            recipeStep.IsLoopEndStep = false;                                        else                                        {                                            recipeStep.LoopStartStep = loopStartStep;                                            if (recipeData.Count > loopStartStep)                                            {                                                recipeData[loopStartStep].IsLoopStartStep = true;                                                recipeData[loopStartStep].LoopCount = loopCount + 1;                                                recipeStep.LoopEndStep = recipeType == "Process" ? i + 1 : i;//Process recipe包含standby,从0开始;其他recipe不包含standby                                            }                                        }                                    }                                }                            }                            else if (commandStr.ToUpper().StartsWith("JUMP"))                            {                                var jumpPara = commandStr.Replace("Jump:", string.Empty).Replace("[", "").Replace("]", "");//JumpStepNo                                if (jumpPara != null)                                {                                    //int.TryParse(jumpPara[0], out int jumpStepNo);                                    //recipeStep.JumpStepNo = recipeType == "Process" ? jumpStepNo : jumpStepNo - 1;//Process recipe包含standby,从0开始;其他recipe不包含standby                                    recipeStep.IsJumpStep = true;                                    recipeStep.JumpStepName = jumpPara;                                }                            }                        }                        if (dic.ContainsKey("AbortRecipeTableIndex"))                        {                            if (dic["AbortRecipeTableIndex"].ToLower() != "none")                            {                                recipeStep.AbortRecipeTableInfo = dic["AbortRecipeTableIndex"];                            }                            recipeStep.AbortRecipeSteps = null;                        }                        if (dic.ContainsKey("EventSetting"))                        {                            string eventSettingStr = dic["EventSetting"];                            if (eventSettingStr.ToLower() == "start")                            {                                recipeStep.IsTimeMeasurementStartStep = true;                            }                            else if (eventSettingStr.ToLower() == "stop")                            {                                recipeStep.IsTimeMeasurementStopStep = true;                            }                        }                        if (dic.ContainsKey("FilmThickFormula"))                        {                            recipeStep.FilmThickFormula = dic["FilmThickFormula"];                        }                        if (dic.ContainsKey("FilmThickCoefficientA"))                        {                            recipeStep.FilmThickCoefficientA = float.Parse(dic["FilmThickCoefficientA"]);                        }                        if (dic.ContainsKey("FilmThickCoefficientB"))                        {                            recipeStep.FilmThickCoefficientB = float.Parse(dic["FilmThickCoefficientB"]);                        }                        if (dic.ContainsKey("AlarmConditionTable"))                        {                            recipeStep.AlarmConditionTable = dic["AlarmConditionTable"];                        }                        for (int j = 1; j < 11; j++)                        {                            string tempType = "Ignore Alarm";                            string tempDetails = "";                            if (dic.ContainsKey($"AlarmAction.{j}"))                            {                                tempType = dic[$"AlarmAction.{j}"];                            }                            if (dic.ContainsKey($"AlarmDetails.{j}"))                            {                                tempDetails = dic[$"AlarmDetails.{j}"];                            }                            recipeStep.AlarmActionSets.Add(j, new AlarmActions()                            {                                ProcessingType = tempType,                                ProcessingDetails = tempDetails                            });                        }                        //if(dic.ContainsKey("Loop"))                        //{                        //    string loopStr = dic["Loop"];                        //    recipeStep.IsLoopStartStep = System.Text.RegularExpressions.Regex.Match(loopStr, @"Loop\x20\d+\s*$").Success;                        //    recipeStep.IsLoopEndStep = System.Text.RegularExpressions.Regex.Match(loopStr, @"Loop End$").Success;                        //    if (recipeStep.IsLoopStartStep)                        //        recipeStep.LoopCount = Convert.ToInt32(loopStr.Replace("Loop", string.Empty));                        //    else                        //        recipeStep.LoopCount = 0;                        //}                        //recipe time                        if (dic["Name"].ToLower() == "standby")                        {                            if (DateTime.TryParse(dic["Time"], out DateTime time))                            {                                recipeStep.StepTime = time.Second + time.Minute * 60 + time.Hour * 3600 + time.Millisecond / 1000.0;                            }                            else if (float.TryParse(dic["Time"], out float timeInSec))                            {                                recipeStep.StepTime = timeInSec;                                recipeStep.EndBy = EnumEndByCondition.ByTime;                            }                            else                            {                                recipeStep.StepTime = 0;                                recipeStep.EndBy = EnumEndByCondition.ByStandbyFactor;                            }                        }                        else                        {                            if (System.Text.RegularExpressions.Regex.Match(dic["Time"], @"[a-zA-Z]").Success)                            {                                if (SC.ContainsItem($"{module}.RecipeEditParameter.StepTime.{dic["Time"]}"))                                {                                    var time = DateTime.Parse(SC.GetStringValue($"{module}.RecipeEditParameter.StepTime.{dic["Time"]}"));                                    recipeStep.StepTime = time.Second + time.Minute * 60 + time.Hour * 3600;                                }                                else                                {                                    reason = $"Configuration does not contains step time config {dic["Time"]}";                                    return false;                                }                            }                            else                            {                                if (DateTime.TryParse(dic["Time"], out DateTime time))                                {                                    recipeStep.StepTime = time.Second + time.Minute * 60 + time.Hour * 3600 + time.Millisecond / 1000.0;                                }                                else if (float.TryParse(dic["Time"], out float timeInSec))                                {                                    recipeStep.StepTime = timeInSec;                                }                                else                                {                                    reason = $"Step time {dic["Time"]} is invalid";                                    return false;                                }                            }                            if (dic["ConditionCheck"].ToLower() == "none")                            {                                recipeStep.EndBy = EnumEndByCondition.ByTime;                            }                            else                            {                                recipeStep.EndBy = EnumEndByCondition.ByStandbyFactor;                            }                        }                        //ReplaceControlName(ref dic, "GasLineMFC1.Flow", "MFC1.SetParameters");                        //ReplaceControlName(ref dic, "GasLineMFC2.Flow", "MFC2.SetParameters");                        //ReplaceControlName(ref dic, "GasLineMFC3.Flow", "MFC3.SetParameters");                        //ReplaceControlName(ref dic, "GasLineMFC4.Flow", "MFC4.SetParameters");                        //ReplaceControlName(ref dic, "GasLineMFC5.Flow", "MFC5.SetParameters");                        //ReplaceControlName(ref dic, "GasLineMFC6.Flow", "MFC6.SetParameters");                        //ReplaceControlName(ref dic, "GasLineMFC7.Flow", "MFC7.SetParameters");                        //ReplaceControlName(ref dic, "GasLineMFC8.Flow", "MFC8.SetParameters");                        //ReplaceControlName(ref dic, "GasLineMFC9.Flow", "MFC9.SetParameters");                        //ReplaceControlName(ref dic, "GasLineMFC10.Flow", "MFC10.SetParameters");                        //ReplaceControlName(ref dic, "GasLineMFC11.Flow", "MFC11.SetParameters");                        //ReplaceControlName(ref dic, "GasLineMFC12.Flow", "MFC12.SetParameters");                        //ReplaceControlName(ref dic, "GasLineMFC51.Flow", "MFC51.SetParameters");                        AddParameter(ref dic, "MFC1.SetParameters", new string[8] { "MFC1.Flow.Set", "MFC1.Flow.Ramprate", "MFC1.Flow.SetUnit", "MFC1.Flow.RamprateUnit", "MFC1.Flow.Check", "MFC1.Flow.High", "MFC1.Flow.Low", "MFC1.Flow.Unit" });                        AddParameter(ref dic, "MFC2.SetParameters", new string[8] { "MFC2.Flow.Set", "MFC2.Flow.Ramprate", "MFC2.Flow.SetUnit", "MFC2.Flow.RamprateUnit", "MFC2.Flow.Check", "MFC2.Flow.High", "MFC2.Flow.Low", "MFC2.Flow.Unit" });                        AddParameter(ref dic, "MFC3.SetParameters", new string[8] { "MFC3.Flow.Set", "MFC3.Flow.Ramprate", "MFC3.Flow.SetUnit", "MFC3.Flow.RamprateUnit", "MFC3.Flow.Check", "MFC3.Flow.High", "MFC3.Flow.Low", "MFC3.Flow.Unit" });                        AddParameter(ref dic, "MFC4.SetParameters", new string[8] { "MFC4.Flow.Set", "MFC4.Flow.Ramprate", "MFC4.Flow.SetUnit", "MFC4.Flow.RamprateUnit", "MFC4.Flow.Check", "MFC4.Flow.High", "MFC4.Flow.Low", "MFC4.Flow.Unit" });                        AddParameter(ref dic, "MFC5.SetParameters", new string[8] { "MFC5.Flow.Set", "MFC5.Flow.Ramprate", "MFC5.Flow.SetUnit", "MFC5.Flow.RamprateUnit", "MFC5.Flow.Check", "MFC5.Flow.High", "MFC5.Flow.Low", "MFC5.Flow.Unit" });                        AddParameter(ref dic, "MFC6.SetParameters", new string[8] { "MFC6.Flow.Set", "MFC6.Flow.Ramprate", "MFC6.Flow.SetUnit", "MFC6.Flow.RamprateUnit", "MFC6.Flow.Check", "MFC6.Flow.High", "MFC6.Flow.Low", "MFC6.Flow.Unit" });                        AddParameter(ref dic, "MFC7.SetParameters", new string[8] { "MFC7.Flow.Set", "MFC7.Flow.Ramprate", "MFC7.Flow.SetUnit", "MFC7.Flow.RamprateUnit", "MFC7.Flow.Check", "MFC7.Flow.High", "MFC7.Flow.Low", "MFC7.Flow.Unit" });                        AddParameter(ref dic, "MFC8.SetParameters", new string[8] { "MFC8.Flow.Set", "MFC8.Flow.Ramprate", "MFC8.Flow.SetUnit", "MFC8.Flow.RamprateUnit", "MFC8.Flow.Check", "MFC8.Flow.High", "MFC8.Flow.Low", "MFC8.Flow.Unit" });                        AddParameter(ref dic, "MFC9.SetParameters", new string[8] { "MFC9.Flow.Set", "MFC9.Flow.Ramprate", "MFC9.Flow.SetUnit", "MFC9.Flow.RamprateUnit", "MFC9.Flow.Check", "MFC9.Flow.High", "MFC9.Flow.Low", "MFC9.Flow.Unit" });                        AddParameter(ref dic, "MFC10.SetParameters", new string[8] { "MFC10.Flow.Set", "MFC10.Flow.Ramprate", "MFC10.Flow.SetUnit", "MFC10.Flow.RamprateUnit", "MFC10.Flow.Check", "MFC10.Flow.High", "MFC10.Flow.Low", "MFC10.Flow.Unit" });                        AddParameter(ref dic, "MFC11.SetParameters", new string[8] { "MFC11.Flow.Set", "MFC11.Flow.Ramprate", "MFC11.Flow.SetUnit", "MFC11.Flow.RamprateUnit", "MFC11.Flow.Check", "MFC11.Flow.High", "MFC11.Flow.Low", "MFC11.Flow.Unit" });                        AddParameter(ref dic, "MFC12.SetParameters", new string[8] { "MFC12.Flow.Set", "MFC12.Flow.Ramprate", "MFC12.Flow.SetUnit", "MFC12.Flow.RamprateUnit", "MFC12.Flow.Check", "MFC12.Flow.High", "MFC12.Flow.Low", "MFC12.Flow.Unit" });                        AddParameter(ref dic, "MFC13.SetParameters", new string[8] { "MFC13.Flow.Set", "MFC13.Flow.Ramprate", "MFC13.Flow.SetUnit", "MFC13.Flow.RamprateUnit", "MFC13.Flow.Check", "MFC13.Flow.High", "MFC13.Flow.Low", "MFC13.Flow.Unit" });                        AddParameter(ref dic, "MFC14.SetParameters", new string[8] { "MFC14.Flow.Set", "MFC14.Flow.Ramprate", "MFC14.Flow.SetUnit", "MFC14.Flow.RamprateUnit", "MFC14.Flow.Check", "MFC14.Flow.High", "MFC14.Flow.Low", "MFC14.Flow.Unit" });                        AddParameter(ref dic, "MFC15.SetParameters", new string[8] { "MFC15.Flow.Set", "MFC15.Flow.Ramprate", "MFC15.Flow.SetUnit", "MFC15.Flow.RamprateUnit", "MFC15.Flow.Check", "MFC15.Flow.High", "MFC15.Flow.Low", "MFC15.Flow.Unit" });                        AddParameter(ref dic, "MFC16.SetParameters", new string[8] { "MFC16.Flow.Set", "MFC16.Flow.Ramprate", "MFC16.Flow.SetUnit", "MFC16.Flow.RamprateUnit", "MFC16.Flow.Check", "MFC16.Flow.High", "MFC16.Flow.Low", "MFC16.Flow.Unit" });                        AddParameter(ref dic, "MFC17.SetParameters", new string[8] { "MFC17.Flow.Set", "MFC17.Flow.Ramprate", "MFC17.Flow.SetUnit", "MFC17.Flow.RamprateUnit", "MFC17.Flow.Check", "MFC17.Flow.High", "MFC17.Flow.Low", "MFC17.Flow.Unit" });                        AddParameter(ref dic, "MFC31.SetParameters", new string[8] { "MFC31.Flow.Set", "MFC31.Flow.Ramprate", "MFC31.Flow.SetUnit", "MFC31.Flow.RamprateUnit", "MFC31.Flow.Check", "MFC31.Flow.High", "MFC31.Flow.Low", "MFC31.Flow.Unit" });                        AddParameter(ref dic, "MFC32.SetParameters", new string[8] { "MFC32.Flow.Set", "MFC32.Flow.Ramprate", "MFC32.Flow.SetUnit", "MFC32.Flow.RamprateUnit", "MFC32.Flow.Check", "MFC32.Flow.High", "MFC32.Flow.Low", "MFC32.Flow.Unit" });                        //AddParameter(ref dic, "MFC51.SetParameters", new string[8] { "MFC51.Flow.Set",  "MFC51.Flow.Ramprate", "MFC51.Flow.SetUnit", "MFC51.Flow.RamprateUnit", "MFC51.Flow.Check", "MFC51.Flow.High", "MFC51.Flow.Low", "MFC51.Flow.Unit" });                        ReplaceControlName(ref dic, "MFM57Flow", "MFM57.SetParameters");                        ReplaceControlName(ref dic, "MFM1Flow", "MFM1.SetParameters");                        ReplaceControlName(ref dic, "MFM6Flow", "MFM6.SetParameters");                        ReplaceControlName(ref dic, "MFM7Flow", "MFM7.SetParameters");                        ReplaceControlName(ref dic, "MFM8Flow", "MFM8.SetParameters");                        ReplaceControlName(ref dic, "MFM9Flow", "MFM9.SetParameters");                        ReplaceControlName(ref dic, "MFM11Flow", "MFM11.SetParameters");                        ReplaceControlName(ref dic, "MFM12Flow", "MFM12.SetParameters");                        ReplaceControlName(ref dic, "MFM13Flow", "MFM13.SetParameters");                        ReplaceControlName(ref dic, "MFM16Flow", "MFM16.SetParameters");                        ReplaceControlName(ref dic, "ConditionCheck", "SetConditionCheck");                        ReplaceControlName(ref dic, "Command", "SetCommand");                        if (dic.ContainsKey("AlarmConditionTable"))                            ReplaceControlName(ref dic, "AlarmConditionTable", "SetAlarmConditionTable");                        //ReplaceControlName(ref dic, "Heater2", "ZoneU.SetParameters");                        //ReplaceControlName(ref dic, "Heater4", "ZoneCU.SetParameters");                        //ReplaceControlName(ref dic, "Heater6", "ZoneC.SetParameters");                        //ReplaceControlName(ref dic, "Heater8", "ZoneCL.SetParameters");                        //ReplaceControlName(ref dic, "Heater10", "ZoneL.SetParameters");                        var controlMode = dic["Temperature.ControlMode"];                        var correct = dic["Temperature.Correct"];                        var PID = dic["Temperature.PID"];                        //AddParameter(ref dic, "ZoneU.SetParameters", controlMode, correct, PID);                        //AddParameter(ref dic, "ZoneCU.SetParameters", controlMode, correct, PID);                        //AddParameter(ref dic, "ZoneC.SetParameters", controlMode, correct, PID);                        //AddParameter(ref dic, "ZoneCL.SetParameters", controlMode, correct, PID);                        //AddParameter(ref dic, "ZoneL.SetParameters", controlMode, correct, PID);                        AddParameter(ref dic, "HeaterU.SetParameters", new string[9] { "HeaterU.ZoneName", "HeaterU.Set", "HeaterU.SetUnit", "HeaterU.Ramprate", "HeaterU.RamprateUnit", "HeaterU.Check", "HeaterU.High", "HeaterU.Low", "HeaterU.Unit" });                        AddParameterValue(ref dic, "HeaterU.SetParameters", new string[8] { controlMode, correct, PID, "", "", "", dic["ValveAV91"], dic["BWR"] });                        AddParameter(ref dic, "HeaterCU.SetParameters", new string[9] { "HeaterCU.ZoneName", "HeaterCU.Set", "HeaterCU.SetUnit", "HeaterCU.Ramprate", "HeaterCU.RamprateUnit", "HeaterCU.Check", "HeaterCU.High", "HeaterCU.Low", "HeaterCU.Unit" });                        AddParameterValue(ref dic, "HeaterCU.SetParameters", new string[8] { controlMode, correct, PID, "", "", "", dic["ValveAV91"], dic["BWR"] });                        AddParameter(ref dic, "HeaterC.SetParameters", new string[9] { "HeaterC.ZoneName", "HeaterC.Set", "HeaterC.SetUnit", "HeaterC.Ramprate", "HeaterC.RamprateUnit", "HeaterC.Check", "HeaterC.High", "HeaterC.Low", "HeaterC.Unit" });                        AddParameterValue(ref dic, "HeaterC.SetParameters", new string[8] { controlMode, correct, PID, "", "", "", dic["ValveAV91"], dic["BWR"] });                        AddParameter(ref dic, "HeaterCL.SetParameters", new string[9] { "HeaterCL.ZoneName", "HeaterCL.Set", "HeaterCL.SetUnit", "HeaterCL.Ramprate", "HeaterCL.RamprateUnit", "HeaterCL.Check", "HeaterCL.High", "HeaterCL.Low", "HeaterCL.Unit" });                        AddParameterValue(ref dic, "HeaterCL.SetParameters", new string[8] { controlMode, correct, PID, "", "", "", dic["ValveAV91"], dic["BWR"] });                        AddParameter(ref dic, "HeaterL.SetParameters", new string[9] { "HeaterL.ZoneName", "HeaterL.Set", "HeaterL.SetUnit", "HeaterL.Ramprate", "HeaterL.RamprateUnit", "HeaterL.Check", "HeaterL.High", "HeaterL.Low", "HeaterL.Unit" });                        AddParameterValue(ref dic, "HeaterL.SetParameters", new string[8] { controlMode, correct, PID, "", "", "", dic["ValveAV91"], dic["BWR"] });                        AddParameter(ref dic, "APC.SetParameters", new string[10] { "Press.Command", "Press.PID", "Press.Set", "Press.SlowVacSet", "Press.ValveAngleSet", "Press.IsWait", "Press.LowWait", "Press.HighWait", "Press.WaitUnit", "Press.WaitPress" });//APC                        AddParameterValue(ref dic, "APC.SetParameters", new string[2] { "", dic["ValveAV71"] });//APC                        AddParameter(ref dic, "SetBoatMotion", new string[5] { "Loader.Command", "Loader.Speed1", "Loader.Speed2", "Loader.Speed3", "Loader.RPM" });//Boat                        List<string> auxCommands = new List<string>();                        for (int k = 1; k < 200; k++)                        {                            if (!dic.ContainsKey($"AUX.{k}.Set"))                                continue;                            auxCommands.Add($"{k},{dic[$"AUX.{k}.Set"]},{dic[$"AUX.{k}.Check"]},{dic[$"AUX.{k}.High"]},{dic[$"AUX.{k}.Low"]},{dic[$"AUX.{k}.CheckUnit"]}");                            dic.Remove($"AUX.{k}.Set");                            dic.Remove($"AUX.{k}.Check");                            dic.Remove($"AUX.{k}.High");                            dic.Remove($"AUX.{k}.Low");                            dic.Remove($"AUX.{k}.CheckUnit");                        }                        dic.Add("AUX.SetParameters", string.Join(";", auxCommands));                        //ReplaceControlName(ref dic, "RFSwitch", "RfPower.SetParameters");                        //AddParameter(ref dic, "RfPower.SetParameters", dic["RFSetpoint"], dic["ForwardPowerAlarmWatchTable"], dic["PrAlarmWatchTable"], dic["PIAlarmWatchTable"]);                        //ReplaceControlName(ref dic, "C1Setpoint", "RfMatch.SetParameters");                        //AddParameter(ref dic, "RfMatch.SetParameters", dic["C2Setpoint"], dic["C1AlarmWatchTable"], dic["C2AlarmWatchTable"], dic["VppAlarmWatchTable"]);                        AddValveParameter(ref dic, "SetValves", new string[153] {                      "ValveAV1",                      "ValveAV2",                      "ValveAV3",                      "ValveAV4",                      "ValveAV5",                      "ValveAV6",                      "ValveAV7",                      "ValveAV8",                      "ValveAV9",                      "ValveAV10",                      "ValveAV11",                      "ValveAV12",                      "ValveAV13",                      "ValveAV14",                      "ValveAV15",                      "ValveAV16",                      "ValveAV17",                      "ValveAV18",                      "ValveAV19",                      "ValveAV20",                      "ValveAV21",                      "ValveAV22",                      "ValveAV23",                      "ValveAV24",                      "ValveAV25",                      "ValveAV26",                      "ValveAV27",                      "ValveAV28",                      "ValveAV29",                      "ValveAV30",                      "ValveAV31",                      "ValveAV32",                      "ValveAV33",                      "ValveAV34",                      "ValveAV35",                      "ValveAV36",                      "ValveAV37",                      "ValveAV38",                      "ValveAV39",                      "ValveAV40",                      "ValveAV41",                      "ValveAV42",                      "ValveAV43",                      "ValveAV44",                      "ValveAV45",                      "ValveAV46",                      "ValveAV47",                      "ValveAV48",                      "ValveAV49",                      "ValveAV50",                      "ValveAV51",                      "ValveAV52",                      "ValveAV53",                      "ValveAV60",                      "ValveAV61",                      "ValveAV62",                      "ValveAV63",                      "ValveAV64",                      "ValveAV65",                      "ValveAV66",                      "ValveAV67",                      "ValveAV68",                      "ValveAV69",                      "ValveAV70",                      "ValveAV71",                      "ValveAV72",                      "ValveAV73",                      "ValveAV74",                      "ValveAV75",                      "ValveAV76",                      "ValveAV77",                      "ValveAV78",                      "ValveAV79",                      "ValveAV80",                      "ValveAV81",                      "ValveAV82",                      "ValveAV83",                      "ValveAV84",                      "ValveAV85",                      "ValveAV86",                      "ValveAV87",                      "ValveAV88",                      "ValveAV89",                      "ValveAV90",                      "ValveAV91",                      "ValveAV92",                      "ValveAV93",                      "ValveAV94",                      "ValveAV95",                      "ValveAV96",                      "ValveAV97",                      "ValveAV98",                      "ValveAV99",                      "ValveAV100",                      "ValveAV101",                      "ValveAV102",                      "ValveAV103",                      "ValveAV104",                      "ValveAV105",                      "ValveAV106",                      "ValveAV107",                      "ValveAV108",                      "ValveAV109",                      "ValveAV110",                      "ValveAV111",                      "ValveAV112",                      "ValveAV113",                      "ValveAV114",                      "ValveAV115",                      "ValveAV116",                      "ValveAV117",                      "ValveAV118",                      "ValveAV119",                      "ValveAV120",                      "ValveAV121",                      "ValveAV122",                      "ValveAV123",                      "ValveAV124",                      "ValveAV125",                      "ValveAV126",                      "ValveAV127",                      "ValveAV128",                      "ValveAV129",                      "ValveAV130",                      "ValveAV131",                      "ValveAV132",                      "ValveAV133",                      "ValveAV134",                      "ValveAV135",                      "ValveAV136",                        "DPR",                        "AGV",                        "AGV2",                        "MBP",                        "MBP1",                        "MBP2",                        "DP",                        "BWR",                        "F2Cln",                        "HFCln",                        "CEXH",                        "DEPO",                        "HTR1",                        "HTR2",                        "HTR3",                        "DP1",                        "DP2",                        "HMNT",                        "CMNT",                        "HREF",                        "CREF",                        "HZERO",                        "CZERO"                    });                        //dic.Remove("SetValves");                        //dic.Remove("HeaterU.SetParameters");                        //dic.Remove("HeaterCU.SetParameters");                        //dic.Remove("HeaterC.SetParameters");                        //dic.Remove("HeaterCL.SetParameters");                        //dic.Remove("HeaterL.SetParameters");                        //dic.Remove("MFC1.SetParameters");                        //dic.Remove("MFC2.SetParameters");                        //dic.Remove("MFC3.SetParameters");                        //dic.Remove("MFC4.SetParameters");                        //dic.Remove("MFC5.SetParameters");                        //dic.Remove("MFC6.SetParameters");                        //dic.Remove("MFC7.SetParameters");                        //dic.Remove("MFC8.SetParameters");                        //dic.Remove("MFC9.SetParameters");                        //dic.Remove("MFC10.SetParameters");                        //dic.Remove("MFC11.SetParameters");                        //dic.Remove("MFC12.SetParameters");                        //ReplaceControlNameForValve(ref dic, "ValveAV1");                        //ReplaceControlNameForValve(ref dic, "ValveAV2");                        //ReplaceControlNameForValve(ref dic, "ValveAV3");                        //ReplaceControlNameForValve(ref dic, "ValveAV4");                        //ReplaceControlNameForValve(ref dic, "ValveAV5");                        //ReplaceControlNameForValve(ref dic, "ValveAV6");                        //ReplaceControlNameForValve(ref dic, "ValveAV7");                        //ReplaceControlNameForValve(ref dic, "ValveAV8");                        //ReplaceControlNameForValve(ref dic, "ValveAV9");                        //ReplaceControlNameForValve(ref dic, "ValveAV10");                        //ReplaceControlNameForValve(ref dic, "ValveAV11");                        //ReplaceControlNameForValve(ref dic, "ValveAV12");                        //ReplaceControlNameForValve(ref dic, "ValveAV13");                        //ReplaceControlNameForValve(ref dic, "ValveAV14");                        //ReplaceControlNameForValve(ref dic, "ValveAV15");                        //ReplaceControlNameForValve(ref dic, "ValveAV16");                        //ReplaceControlNameForValve(ref dic, "ValveAV17");                        //ReplaceControlNameForValve(ref dic, "ValveAV18");                        //ReplaceControlNameForValve(ref dic, "ValveAV19");                        //ReplaceControlNameForValve(ref dic, "ValveAV20");                        //ReplaceControlNameForValve(ref dic, "ValveAV21");                        //ReplaceControlNameForValve(ref dic, "ValveAV22");                        //ReplaceControlNameForValve(ref dic, "ValveAV23");                        //ReplaceControlNameForValve(ref dic, "ValveAV24");                        //ReplaceControlNameForValve(ref dic, "ValveAV25");                        //ReplaceControlNameForValve(ref dic, "ValveAV26");                        //ReplaceControlNameForValve(ref dic, "ValveAV27");                        //ReplaceControlNameForValve(ref dic, "ValveAV28");                        //ReplaceControlNameForValve(ref dic, "ValveAV29");                        //ReplaceControlNameForValve(ref dic, "ValveAV30");                        //ReplaceControlNameForValve(ref dic, "ValveAV31");                        //ReplaceControlNameForValve(ref dic, "ValveAV32");                        //ReplaceControlNameForValve(ref dic, "ValveAV33");                        //ReplaceControlNameForValve(ref dic, "ValveAV34");                        //ReplaceControlNameForValve(ref dic, "ValveAV35");                        //ReplaceControlNameForValve(ref dic, "ValveAV36");                        //ReplaceControlNameForValve(ref dic, "ValveAV37");                        //ReplaceControlNameForValve(ref dic, "ValveAV38");                        //ReplaceControlNameForValve(ref dic, "ValveAV39");                        //ReplaceControlNameForValve(ref dic, "ValveAV52");                        ////ReplaceControlNameForValve(ref dic, "ValveAV54");                        ////ReplaceControlNameForValve(ref dic, "ValveAV56");                        ////ReplaceControlNameForValve(ref dic, "ValveAV57");                        ////ReplaceControlNameForValve(ref dic, "ValveAV58");                        ////ReplaceControlNameForValve(ref dic, "ValveAV59");                        //ReplaceControlNameForValve(ref dic, "ValveAV60");                        ////ReplaceControlNameForValve(ref dic, "ValveAV65");                        ////ReplaceControlNameForValve(ref dic, "ValveAV66");                        ////ReplaceControlNameForValve(ref dic, "ValveAV68");                        //ReplaceControlNameForValve(ref dic, "ValveAV71");                        //ReplaceControlNameForValve(ref dic, "ValveAV72");                        //ReplaceControlNameForValve(ref dic, "ValveAV73");                        //ReplaceControlNameForValve(ref dic, "ValveAV74");                        //ReplaceControlNameForValve(ref dic, "ValveAV75");                        //ReplaceControlNameForValve(ref dic, "ValveAV77");                        //ReplaceControlNameForValve(ref dic, "ValveAV81");                        //ReplaceControlNameForValve(ref dic, "ValveAV82");                        //ReplaceControlNameForValve(ref dic, "ValveAV83");                        //ReplaceControlNameForValve(ref dic, "ValveAV91");                        dic.Remove("StepNo");                        dic.Remove("Name");                        dic.Remove("EndBy");                        dic.Remove("Time");                        dic.Remove("ZAxisPosition");                        dic.Remove("ZAxisSpeed");                        dic.Remove("RotatePosition");                        dic.Remove("RotateSpeed");                        dic.Remove("RotateDirection");                        dic.Remove("Heater1");                        dic.Remove("Heater2");                        dic.Remove("Heater3");                        dic.Remove("Heater4");                        dic.Remove("Heater5");                        dic.Remove("ValveAV54");                        dic.Remove("ValveAV55");                        dic.Remove("ValveAV56");                        dic.Remove("ValveAV57");                        dic.Remove("ValveAV58");                        dic.Remove("ValveAV59");                        dic.Remove("ValveAV65");                        dic.Remove("ValveAV66");                        dic.Remove("ValveAV68");                        dic.Remove("ExternalOn");                        dic.Remove("ExternalOff");                        dic.Remove("ExternalSensor");                        dic.Remove("TempStabilize");                        dic.Remove("FinishAutoProfile");                        dic.Remove("ReachTempWait");                        dic.Remove("ReachTemp");                        dic.Remove("TempUpper");                        dic.Remove("TempLower");                        dic.Remove("ReachPressureWait");                        dic.Remove("ReachPressure");                        dic.Remove("PressureUpper");                        dic.Remove("PressureLower");                        dic.Remove("PressureStabilize");                        dic.Remove("External.Out1");                        dic.Remove("External.Out2");                        dic.Remove("External.Out3");                        dic.Remove("External.Out4");                        dic.Remove("External.Out5");                        dic.Remove("External.Out6");                        dic.Remove("RFSwitch");                        dic.Remove("RFSetpoint");                        dic.Remove("ForwardPowerAlarmWatchTable");                        dic.Remove("PrAlarmWatchTable");                        dic.Remove("PIAlarmWatchTable");                        dic.Remove("C1Setpoint");                        dic.Remove("C2Setpoint");                        dic.Remove("C1AlarmWatchTable");                        dic.Remove("C2AlarmWatchTable");                        dic.Remove("VppAlarmWatchTable");                        dic.Remove("VdcAlarmWatchTable");                        dic.Remove("AbortRecipeTableIndex");                        dic.Remove("Temperature.ControlMode");                        dic.Remove("Temperature.Correct");                        dic.Remove("Temperature.PID");                        dic.Remove("Temperature.Profile");                        dic.Remove("Temperature.Stabilize");                        dic.Remove("Temperature.TempReadyCond");                        dic.Remove("FilmThickFormula");                        dic.Remove("FilmThickCoefficientA");                        dic.Remove("FilmThickCoefficientB");                        dic.Remove("APC.SetPressure");                        dic.Remove("PressureSettingVG");                        dic.Remove("PressureSonserValue");                        dic.Remove("PressureValveAngle");                        dic.Remove("PressureAlarmTableNo");                        dic.Remove("EventSetting");                        dic.Remove("AlarmTableIndex");                        dic.Remove("AlarmDetails.1");                        dic.Remove("AlarmAction.1");                        dic.Remove("AlarmDetails.2");                        dic.Remove("AlarmAction.2");                        dic.Remove("AlarmDetails.3");                        dic.Remove("AlarmAction.3");                        dic.Remove("AlarmDetails.4");                        dic.Remove("AlarmAction.4");                        dic.Remove("AlarmDetails.5");                        dic.Remove("AlarmAction.5");                        dic.Remove("AlarmDetails.6");                        dic.Remove("AlarmAction.6");                        dic.Remove("AlarmDetails.7");                        dic.Remove("AlarmAction.7");                        dic.Remove("AlarmDetails.8");                        dic.Remove("AlarmAction.8");                        dic.Remove("AlarmDetails.9");                        dic.Remove("AlarmAction.9");                        dic.Remove("AlarmDetails.10");                        dic.Remove("AlarmAction.10");                        //List<string> mfcCheckInstall = new List<string>()                        //{                        //    "MfcN1",                        //    "MfcN2",                        //    "MfcN3",                        //    "MfcH1",                        //    "MfcJ1",                        //    "MfcXN1",                        //};                        //foreach(var mfc in mfcCheckInstall)                        //{                        //    if (!SC.GetValue<bool>($"PM1.MFC.{mfc}.IsMFCInstalled"))                        //        dic.Remove($"{mfc}.SetParameters");                        //}                        foreach (string key in dic.Keys)                            recipeStep.RecipeCommands.Add(key, dic[key]);                    }                    for (int i = 0; i < recipeData.Count; i++)                    {                        if (recipeData[i].IsJumpStep)                        {                            bool findJumpStep = false;                            for (int j = 0; j < recipeData.Count; j++)                            {                                if (recipeData[j].StepName == recipeData[i].JumpStepName)                                {                                    recipeData[i].JumpStepNo = j;                                    findJumpStep = true;                                    break;                                }                            }                            if (!findJumpStep)                            {                                reason = $"Recipe file does not contains jump step {recipeData[i].JumpStepName}";                                return false;                            }                        }                    }                    #endregion                    recipeDatas.Add(x + 1, recipeData);                }            }            catch (Exception ex)            {                LOG.Write(ex);                reason = $"Recipe file content not valid, {recipeFile}, {ex.Message}";                return false;            }            return true;        }    }}
 |