RecipeParser.cs 119 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Xml;
  4. using System.Reflection;
  5. using Aitex.Common.Util;
  6. using Aitex.Core.Common.DeviceData;
  7. using Aitex.Core.RT.Log;
  8. using Aitex.Core.RT.RecipeCenter;
  9. using Aitex.Core.RT.SCCore;
  10. using MECF.Framework.Common.Equipment;
  11. using System.IO;
  12. using MECF.Framework.UI.Client.CenterViews.Editors.Recipe;
  13. namespace FurnaceRT.Equipments.PMs.RecipeExecutions
  14. {
  15. public class RecipeParser
  16. {
  17. 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)
  18. {
  19. reason = string.Empty;
  20. if (mainHead != null)
  21. recipeHead = mainHead;
  22. else
  23. recipeHead = new RecipeHead();
  24. recipeData = new List<RecipeStep>();
  25. string content = string.Empty;
  26. if (recipeType != "Process" && recipeType != "Idle" && recipeType != "Reset")
  27. {
  28. if (!File.Exists($"{PathManager.GetRecipeDir()}\\{SC.GetStringValue("System.Recipe.SupportedChamberType")}\\{SC.GetStringValue($"System.Recipe.Supported{recipeType}Type")}\\{recipeFile}.rcp"))
  29. return true;
  30. }
  31. content = RecipeFileManager.Instance.LoadRecipe($"{SC.GetStringValue("System.Recipe.SupportedChamberType")}\\{SC.GetStringValue($"System.Recipe.Supported{recipeType}Type")}", recipeFile, false);
  32. if (string.IsNullOrEmpty(content))
  33. {
  34. reason = $"{recipeFile} is not a valid recipe file";
  35. return false;
  36. }
  37. try
  38. {
  39. //获取工艺程序文件中允许的命令字符串列表
  40. //目的:如果工艺程序文件中含有规定之外的命令,则被禁止执行
  41. HashSet<string> recipeAllowedCommands = new HashSet<string>();
  42. XmlDocument rcpFormatDoc = new XmlDocument();
  43. string recipeSchema = PathManager.GetCfgDir() + $@"\Recipe\Furnace\Process\{SC.GetStringValue("System.SetUp.ToolType")}\RecipeFormat.xml";
  44. rcpFormatDoc.Load(recipeSchema);
  45. XmlNodeList rcpItemNodeList = rcpFormatDoc.SelectNodes("/Aitex/TableRecipeFormat/Catalog/Group/Step");
  46. foreach (XmlElement item in rcpItemNodeList)
  47. recipeAllowedCommands.Add(item.Attributes["ControlName"].Value);
  48. recipeAllowedCommands.Add("Temperature.ControlMode");
  49. recipeAllowedCommands.Add("Temperature.Correct");
  50. recipeAllowedCommands.Add("Temperature.PID");
  51. recipeAllowedCommands.Add("ConditionCheck");
  52. recipeAllowedCommands.Add("EventSetting");
  53. recipeAllowedCommands.Add("FilmThickFormula");
  54. recipeAllowedCommands.Add("FilmThickCoefficientA");
  55. recipeAllowedCommands.Add("FilmThickCoefficientB");
  56. recipeAllowedCommands.Add("AlarmTableIndex");
  57. recipeAllowedCommands.Add("RFSwitch");
  58. recipeAllowedCommands.Add("RFSetpoint");
  59. recipeAllowedCommands.Add("ForwardPowerAlarmWatchTable");
  60. recipeAllowedCommands.Add("PrAlarmWatchTable");
  61. recipeAllowedCommands.Add("PIAlarmWatchTable");
  62. recipeAllowedCommands.Add("C1Setpoint");
  63. recipeAllowedCommands.Add("C2Setpoint");
  64. recipeAllowedCommands.Add("C1AlarmWatchTable");
  65. recipeAllowedCommands.Add("C2AlarmWatchTable");
  66. recipeAllowedCommands.Add("VppAlarmWatchTable");
  67. recipeAllowedCommands.Add("VdcAlarmWatchTable");
  68. recipeAllowedCommands.Add("PressureSonserValue");
  69. recipeAllowedCommands.Add("PressureValveAngle");
  70. recipeAllowedCommands.Add("PressureSettingVG");
  71. recipeAllowedCommands.Add("PressCommand");
  72. recipeAllowedCommands.Add("PressValue");
  73. recipeAllowedCommands.Add("PressureAlarmTableNo");
  74. recipeAllowedCommands.Add("AbortRecipeTableIndex");
  75. recipeAllowedCommands.Add("AlarmConditionTable");
  76. recipeAllowedCommands.Add("LoaderCommand");
  77. recipeAllowedCommands.Add("LoaderValue");
  78. for (int i = 1; i < 11; i++)
  79. {
  80. recipeAllowedCommands.Add($"AlarmAction.{i}");
  81. recipeAllowedCommands.Add($"AlarmDetails.{i}");
  82. }
  83. for (int i = 1; i < 60; i++)
  84. {
  85. recipeAllowedCommands.Add($"MFC{i}.Flow.Set");
  86. recipeAllowedCommands.Add($"MFC{i}.Flow.SetUnit");
  87. recipeAllowedCommands.Add($"MFC{i}.Flow.Ramprate");
  88. recipeAllowedCommands.Add($"MFC{i}.Flow.RamprateUnit");
  89. recipeAllowedCommands.Add($"MFC{i}.Flow.Check");
  90. recipeAllowedCommands.Add($"MFC{i}.Flow.High");
  91. recipeAllowedCommands.Add($"MFC{i}.Flow.Low");
  92. recipeAllowedCommands.Add($"MFC{i}.Flow.Unit");
  93. }
  94. for (int i = 1; i < 200; i++)
  95. {
  96. recipeAllowedCommands.Add($"AUX.{i}.Set");
  97. recipeAllowedCommands.Add($"AUX.{i}.Check");
  98. recipeAllowedCommands.Add($"AUX.{i}.High");
  99. recipeAllowedCommands.Add($"AUX.{i}.Low");
  100. recipeAllowedCommands.Add($"AUX.{i}.CheckUnit");
  101. }
  102. recipeAllowedCommands.Add("HeaterU.ZoneName");
  103. recipeAllowedCommands.Add("HeaterU.Set");
  104. recipeAllowedCommands.Add("HeaterU.SetUnit");
  105. recipeAllowedCommands.Add("HeaterU.Ramprate");
  106. recipeAllowedCommands.Add("HeaterU.RamprateUnit");
  107. recipeAllowedCommands.Add("HeaterU.Check");
  108. recipeAllowedCommands.Add("HeaterU.High");
  109. recipeAllowedCommands.Add("HeaterU.Low");
  110. recipeAllowedCommands.Add("HeaterU.Unit");
  111. recipeAllowedCommands.Add("HeaterCU.ZoneName");
  112. recipeAllowedCommands.Add("HeaterCU.Set");
  113. recipeAllowedCommands.Add("HeaterCU.SetUnit");
  114. recipeAllowedCommands.Add("HeaterCU.Ramprate");
  115. recipeAllowedCommands.Add("HeaterCU.RamprateUnit");
  116. recipeAllowedCommands.Add("HeaterCU.Check");
  117. recipeAllowedCommands.Add("HeaterCU.High");
  118. recipeAllowedCommands.Add("HeaterCU.Low");
  119. recipeAllowedCommands.Add("HeaterCU.Unit");
  120. recipeAllowedCommands.Add("HeaterC.ZoneName");
  121. recipeAllowedCommands.Add("HeaterC.Set");
  122. recipeAllowedCommands.Add("HeaterC.SetUnit");
  123. recipeAllowedCommands.Add("HeaterC.Ramprate");
  124. recipeAllowedCommands.Add("HeaterC.RamprateUnit");
  125. recipeAllowedCommands.Add("HeaterC.Check");
  126. recipeAllowedCommands.Add("HeaterC.High");
  127. recipeAllowedCommands.Add("HeaterC.Low");
  128. recipeAllowedCommands.Add("HeaterC.Unit");
  129. recipeAllowedCommands.Add("HeaterCL.ZoneName");
  130. recipeAllowedCommands.Add("HeaterCL.Set");
  131. recipeAllowedCommands.Add("HeaterCL.SetUnit");
  132. recipeAllowedCommands.Add("HeaterCL.Ramprate");
  133. recipeAllowedCommands.Add("HeaterCL.RamprateUnit");
  134. recipeAllowedCommands.Add("HeaterCL.Check");
  135. recipeAllowedCommands.Add("HeaterCL.High");
  136. recipeAllowedCommands.Add("HeaterCL.Low");
  137. recipeAllowedCommands.Add("HeaterCL.Unit");
  138. recipeAllowedCommands.Add("HeaterL.ZoneName");
  139. recipeAllowedCommands.Add("HeaterL.Set");
  140. recipeAllowedCommands.Add("HeaterL.SetUnit");
  141. recipeAllowedCommands.Add("HeaterL.Ramprate");
  142. recipeAllowedCommands.Add("HeaterL.RamprateUnit");
  143. recipeAllowedCommands.Add("HeaterL.Check");
  144. recipeAllowedCommands.Add("HeaterL.High");
  145. recipeAllowedCommands.Add("HeaterL.Low");
  146. recipeAllowedCommands.Add("HeaterL.Unit");
  147. recipeAllowedCommands.Add("Loader.Command");
  148. recipeAllowedCommands.Add("Loader.Speed1");
  149. recipeAllowedCommands.Add("Loader.Speed2");
  150. recipeAllowedCommands.Add("Loader.Speed3");
  151. recipeAllowedCommands.Add("Loader.RPM");
  152. recipeAllowedCommands.Add("Press.Command");
  153. recipeAllowedCommands.Add("Press.PID");
  154. recipeAllowedCommands.Add("Press.Set");
  155. recipeAllowedCommands.Add("Press.SlowVacSet");
  156. recipeAllowedCommands.Add("Press.ValveAngleSet");
  157. recipeAllowedCommands.Add("Press.IsWait");
  158. recipeAllowedCommands.Add("Press.LowWait");
  159. recipeAllowedCommands.Add("Press.HighWait");
  160. recipeAllowedCommands.Add("Press.WaitUnit");
  161. recipeAllowedCommands.Add("Press.WaitPress");
  162. //获取工艺程序文件中所有步的内容
  163. XmlDocument rcpDataDoc = new XmlDocument();
  164. rcpDataDoc.LoadXml(content);
  165. XmlNode nodeModule = null;
  166. if (recipeType == "Process" || recipeType == "Idle" || recipeType == "Reset")
  167. nodeModule = rcpDataDoc.SelectSingleNode($"/Aitex/TableRecipeData/Module[@Name='{module}']");
  168. else
  169. nodeModule = rcpDataDoc.SelectSingleNode($"/Aitex/TableRecipeData/Tables/Table[@Index='{tableID}']");
  170. if (nodeModule == null)
  171. {
  172. reason = $"Recipe file does not contains step content for {module}";
  173. return false;
  174. }
  175. XmlElement nodeConfig = nodeModule.SelectSingleNode($"Config") as XmlElement;
  176. if (nodeConfig != null)
  177. {
  178. if (mainHead == null)
  179. {
  180. recipeHead.SubRecipe = nodeConfig.HasAttribute("Combination.SubRecipe") ? nodeConfig.Attributes["Combination.SubRecipe"].Value : "";
  181. recipeHead.AlarmRecipe = nodeConfig.HasAttribute("Combination.AlarmRecipe") ? nodeConfig.Attributes["Combination.AlarmRecipe"].Value : "";
  182. recipeHead.AlarmCondition = nodeConfig.HasAttribute("Combination.AlarmCondition") ? nodeConfig.Attributes["Combination.AlarmCondition"].Value : "";
  183. recipeHead.LeakCheck = nodeConfig.HasAttribute("Combination.LeakCheck") ? nodeConfig.Attributes["Combination.LeakCheck"].Value : "";
  184. recipeHead.AbortRecipe = nodeConfig.HasAttribute("Combination.AbortRecipe") ? nodeConfig.Attributes["Combination.AbortRecipe"].Value : "";
  185. recipeHead.PressApcPID = nodeConfig.HasAttribute("Combination.PressAPCPID") ? nodeConfig.Attributes["Combination.PressAPCPID"].Value : "";
  186. recipeHead.TempCorrect = nodeConfig.HasAttribute("Combination.TempCorrection") ? nodeConfig.Attributes["Combination.TempCorrection"].Value : "";
  187. recipeHead.TempPID = nodeConfig.HasAttribute("Combination.TempPID") ? nodeConfig.Attributes["Combination.TempPID"].Value : "";
  188. recipeHead.ProfileCondition = nodeConfig.HasAttribute("Combination.ProfileCondition") ? nodeConfig.Attributes["Combination.ProfileCondition"].Value : "";
  189. if (nodeConfig.HasAttribute("N2PurgeMode"))
  190. {
  191. recipeHead.N2PurgeModeStr = nodeConfig.Attributes["N2PurgeMode"].Value;
  192. }
  193. if (string.IsNullOrEmpty(recipeHead.AbortRecipe))
  194. recipeHead.AbortRecipe = SC.GetStringValue("System.Recipe.Abort Recipe");
  195. }
  196. }
  197. else
  198. {
  199. if (mainHead == null)
  200. {
  201. recipeHead.SubRecipe = "";
  202. recipeHead.AlarmRecipe = "";
  203. recipeHead.AlarmCondition = "";
  204. recipeHead.LeakCheck = "";
  205. recipeHead.AbortRecipe = "";
  206. recipeHead.PressApcPID = "";
  207. recipeHead.TempCorrect = "";
  208. recipeHead.TempPID = "";
  209. recipeHead.ProfileCondition = "";
  210. if (recipeType == "Sub")
  211. recipeHead.AbortRecipe = SC.GetStringValue("System.Recipe.Abort Recipe");
  212. }
  213. }
  214. XmlNodeList stepNodeList = nodeModule.SelectNodes($"Step");
  215. string strLoopEndStep, strJumpStep;
  216. strLoopEndStep = strJumpStep = string.Empty;
  217. for (int i = 0; i < stepNodeList.Count; i++)
  218. {
  219. var recipeStep = new RecipeStep();
  220. recipeStep.RecipeType = recipeType;
  221. recipeData.Add(recipeStep);
  222. XmlElement stepNode = stepNodeList[i] as XmlElement;
  223. Dictionary<string, string> dic = new Dictionary<string, string>();
  224. //遍历Step节点
  225. foreach (XmlAttribute att in stepNode.Attributes)
  226. {
  227. if (recipeAllowedCommands.Contains(att.Name))
  228. {
  229. dic.Add(att.Name, att.Value);
  230. }
  231. }
  232. //遍历Step子节点中所有的attribute属性节点
  233. foreach (XmlElement subStepNode in stepNode.ChildNodes)
  234. {
  235. foreach (XmlAttribute att in subStepNode.Attributes)
  236. {
  237. if (recipeAllowedCommands.Contains(att.Name))
  238. {
  239. dic.Add(att.Name, att.Value);
  240. }
  241. }
  242. //遍历Step子节点的子节点中所有的attribute属性节点
  243. foreach (XmlElement subsubStepNode in subStepNode.ChildNodes)
  244. {
  245. foreach (XmlAttribute att in subsubStepNode.Attributes)
  246. {
  247. if (recipeAllowedCommands.Contains(att.Name))
  248. {
  249. dic.Add(att.Name, att.Value);
  250. }
  251. }
  252. }
  253. }
  254. recipeStep.StepName = dic["Name"];
  255. if (dic["Name"] == strLoopEndStep)
  256. {
  257. recipeStep.IsLoopEndStep = true;
  258. strLoopEndStep = string.Empty;
  259. }
  260. recipeStep.IsJumpStep = false;
  261. if (dic.ContainsKey("Command"))
  262. {
  263. string commandStr = dic["Command"];
  264. if (commandStr.Contains("CallSystemRecipe"))
  265. {
  266. }
  267. else if (commandStr.ToUpper().StartsWith("CALL"))
  268. {
  269. int subTableID = 0;
  270. var subPara = commandStr.Replace("CALL", "").Replace("[", "").Replace("]", "").Split('*');
  271. if (subPara != null && subPara.Length > 1)
  272. {
  273. int.TryParse(subPara[0], out int loopCount);
  274. var tablePara = subPara[1].Split(':');
  275. if (tablePara != null && tablePara.Length > 1)
  276. {
  277. int.TryParse(tablePara[0], out subTableID);
  278. if (subTableID > 0)
  279. {
  280. recipeStep.IsCallSubStep = true;
  281. recipeStep.SubRecipeLoopCount = loopCount;
  282. }
  283. }
  284. recipeStep.SubRecipeTableInfo = subPara[1];
  285. }
  286. //sub需要修改table id
  287. List<RecipeStep> subRecipeData = null;
  288. if (recipeStep.IsCallSubStep && !Parse(recipeHead.SubRecipe, module, out var head, out subRecipeData, out reason, "Sub", subTableID, recipeHead))
  289. {
  290. return false;
  291. }
  292. if (subRecipeData == null || subRecipeData.Count == 0)
  293. {
  294. reason = $"Sub Recipe {commandStr.Replace("CallSubRecipe:", string.Empty)} is empty";
  295. return false;
  296. }
  297. recipeStep.SubRecipeSteps = subRecipeData;
  298. }
  299. else if (commandStr.ToUpper().StartsWith("LOOP"))
  300. {
  301. recipeStep.IsLoopEndStep = true;
  302. var loopPara = commandStr.Replace("LOOP", "").Replace("[", "").Replace("]", "").Split('*');
  303. if (loopPara != null && loopPara.Length > 1)
  304. {
  305. int.TryParse(loopPara[0], out int loopCount);
  306. recipeStep.LoopCount = loopCount + 1;//加1是因为第一次从正常的start-》end的执行算是一次循环,所以要额外加1
  307. int loopStartStep = -1;
  308. for (int index = 0; index < recipeData.Count; index++)
  309. {
  310. if (recipeData[index].StepName == loopPara[1])
  311. {
  312. loopStartStep = index;
  313. break;
  314. }
  315. }
  316. if (loopStartStep < 0)
  317. {
  318. reason = $"Recipe file does not contains LOOP step {loopPara[1]}";
  319. return false;
  320. }
  321. if (loopPara[1] != null)
  322. {
  323. if (loopStartStep < 0 ||
  324. (recipeType == "Process" && loopStartStep == 0))//Process recipe的standby不参与循环
  325. recipeStep.IsLoopEndStep = false;
  326. else
  327. {
  328. recipeStep.LoopStartStep = loopStartStep;
  329. if (recipeData.Count > loopStartStep)
  330. {
  331. recipeData[loopStartStep].IsLoopStartStep = true;
  332. recipeData[loopStartStep].LoopCount = loopCount + 1;
  333. recipeStep.LoopEndStep = recipeType == "Process" ? i + 1 : i;//Process recipe包含standby,从0开始;其他recipe不包含standby
  334. }
  335. }
  336. }
  337. }
  338. }
  339. else if (commandStr.ToUpper().StartsWith("JUMP"))
  340. {
  341. var jumpPara = commandStr.Replace("Jump:", string.Empty).Replace("[", "").Replace("]", "");//JumpStepNo
  342. if (jumpPara != null)
  343. {
  344. //int.TryParse(jumpPara[0], out int jumpStepNo);
  345. //recipeStep.JumpStepNo = recipeType == "Process" ? jumpStepNo : jumpStepNo - 1;//Process recipe包含standby,从0开始;其他recipe不包含standby
  346. recipeStep.IsJumpStep = true;
  347. recipeStep.JumpStepName = jumpPara;
  348. }
  349. }
  350. }
  351. if (dic.ContainsKey("AbortRecipeTableIndex"))
  352. {
  353. if (dic["AbortRecipeTableIndex"].ToLower() != "none")
  354. {
  355. //格式 1:name
  356. var abortPara = dic["AbortRecipeTableIndex"].Split(':');
  357. int abortTableID = 0;
  358. if (abortPara.Length > 1)
  359. {
  360. int.TryParse(abortPara[0], out abortTableID);
  361. List<RecipeStep> abortRecipeData = null;
  362. if (!Parse(recipeHead.AbortRecipe, module, out var head, out abortRecipeData, out reason, "Abort", abortTableID))
  363. {
  364. return false;
  365. }
  366. if (abortRecipeData == null || abortRecipeData.Count == 0)
  367. {
  368. reason = $"Abort Recipe {recipeHead.AbortRecipe}--{dic["AbortRecipeTableIndex"]} is empty";
  369. return false;
  370. }
  371. recipeStep.AbortRecipeSteps = abortRecipeData;
  372. recipeStep.AbortRecipeTableInfo = dic["AbortRecipeTableIndex"];
  373. }
  374. }
  375. else
  376. {
  377. recipeStep.AbortRecipeSteps = null;
  378. }
  379. }
  380. if (dic.ContainsKey("EventSetting"))
  381. {
  382. string eventSettingStr = dic["EventSetting"];
  383. if (eventSettingStr.ToLower() == "start")
  384. {
  385. recipeStep.IsTimeMeasurementStartStep = true;
  386. }
  387. else if (eventSettingStr.ToLower() == "stop")
  388. {
  389. recipeStep.IsTimeMeasurementStopStep = true;
  390. }
  391. }
  392. if (dic.ContainsKey("FilmThickFormula"))
  393. {
  394. recipeStep.FilmThickFormula = dic["FilmThickFormula"];
  395. }
  396. if (dic.ContainsKey("FilmThickCoefficientA"))
  397. {
  398. recipeStep.FilmThickCoefficientA = float.Parse(dic["FilmThickCoefficientA"]);
  399. }
  400. if (dic.ContainsKey("FilmThickCoefficientB"))
  401. {
  402. recipeStep.FilmThickCoefficientB = float.Parse(dic["FilmThickCoefficientB"]);
  403. }
  404. if (dic.ContainsKey("AlarmConditionTable"))
  405. {
  406. recipeStep.AlarmConditionTable = dic["AlarmConditionTable"];
  407. }
  408. for (int j = 1; j < 11; j++)
  409. {
  410. string tempType = "Ignore Alarm";
  411. string tempDetails = "";
  412. if (dic.ContainsKey($"AlarmAction.{j}"))
  413. {
  414. tempType = dic[$"AlarmAction.{j}"];
  415. }
  416. if (dic.ContainsKey($"AlarmDetails.{j}"))
  417. {
  418. tempDetails = dic[$"AlarmDetails.{j}"];
  419. }
  420. recipeStep.AlarmActionSets.Add(j, new AlarmActions()
  421. {
  422. ProcessingType = tempType,
  423. ProcessingDetails = tempDetails
  424. });
  425. }
  426. //if(dic.ContainsKey("Loop"))
  427. //{
  428. // string loopStr = dic["Loop"];
  429. // recipeStep.IsLoopStartStep = System.Text.RegularExpressions.Regex.Match(loopStr, @"Loop\x20\d+\s*$").Success;
  430. // recipeStep.IsLoopEndStep = System.Text.RegularExpressions.Regex.Match(loopStr, @"Loop End$").Success;
  431. // if (recipeStep.IsLoopStartStep)
  432. // recipeStep.LoopCount = Convert.ToInt32(loopStr.Replace("Loop", string.Empty));
  433. // else
  434. // recipeStep.LoopCount = 0;
  435. //}
  436. //recipe time
  437. if (dic["Name"].ToLower() == "standby")
  438. {
  439. if (DateTime.TryParse(dic["Time"], out DateTime time))
  440. {
  441. recipeStep.StepTime = time.Second + time.Minute * 60 + time.Hour * 3600 + time.Millisecond / 1000.0;
  442. }
  443. else if (float.TryParse(dic["Time"], out float timeInSec))
  444. {
  445. recipeStep.StepTime = timeInSec;
  446. recipeStep.EndBy = EnumEndByCondition.ByTime;
  447. }
  448. else
  449. {
  450. recipeStep.StepTime = 0;
  451. recipeStep.EndBy = EnumEndByCondition.ByStandbyFactor;
  452. }
  453. }
  454. else
  455. {
  456. if (System.Text.RegularExpressions.Regex.Match(dic["Time"], @"[a-zA-Z]").Success)
  457. {
  458. if (SC.ContainsItem($"{module}.RecipeEditParameter.StepTime.{dic["Time"]}"))
  459. {
  460. var time = DateTime.Parse(SC.GetStringValue($"{module}.RecipeEditParameter.StepTime.{dic["Time"]}"));
  461. recipeStep.StepTime = time.Second + time.Minute * 60 + time.Hour * 3600;
  462. }
  463. else
  464. {
  465. reason = $"Configuration does not contains step time config {dic["Time"]}";
  466. return false;
  467. }
  468. }
  469. else
  470. {
  471. if (DateTime.TryParse(dic["Time"], out DateTime time))
  472. {
  473. recipeStep.StepTime = time.Second + time.Minute * 60 + time.Hour * 3600 + time.Millisecond / 1000.0;
  474. }
  475. else if (float.TryParse(dic["Time"], out float timeInSec))
  476. {
  477. recipeStep.StepTime = timeInSec;
  478. }
  479. else
  480. {
  481. reason = $"Step time {dic["Time"]} is invalid";
  482. return false;
  483. }
  484. }
  485. if (dic["ConditionCheck"].ToLower() == "none")
  486. {
  487. recipeStep.EndBy = EnumEndByCondition.ByTime;
  488. }
  489. else
  490. {
  491. recipeStep.EndBy = EnumEndByCondition.ByStandbyFactor;
  492. }
  493. }
  494. //ReplaceControlName(ref dic, "GasLineMFC1.Flow", "MFC1.SetParameters");
  495. //ReplaceControlName(ref dic, "GasLineMFC2.Flow", "MFC2.SetParameters");
  496. //ReplaceControlName(ref dic, "GasLineMFC3.Flow", "MFC3.SetParameters");
  497. //ReplaceControlName(ref dic, "GasLineMFC4.Flow", "MFC4.SetParameters");
  498. //ReplaceControlName(ref dic, "GasLineMFC5.Flow", "MFC5.SetParameters");
  499. //ReplaceControlName(ref dic, "GasLineMFC6.Flow", "MFC6.SetParameters");
  500. //ReplaceControlName(ref dic, "GasLineMFC7.Flow", "MFC7.SetParameters");
  501. //ReplaceControlName(ref dic, "GasLineMFC8.Flow", "MFC8.SetParameters");
  502. //ReplaceControlName(ref dic, "GasLineMFC9.Flow", "MFC9.SetParameters");
  503. //ReplaceControlName(ref dic, "GasLineMFC10.Flow", "MFC10.SetParameters");
  504. //ReplaceControlName(ref dic, "GasLineMFC11.Flow", "MFC11.SetParameters");
  505. //ReplaceControlName(ref dic, "GasLineMFC12.Flow", "MFC12.SetParameters");
  506. //ReplaceControlName(ref dic, "GasLineMFC51.Flow", "MFC51.SetParameters");
  507. 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" });
  508. 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" });
  509. 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" });
  510. 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" });
  511. 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" });
  512. 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" });
  513. 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" });
  514. 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" });
  515. 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" });
  516. 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" });
  517. 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" });
  518. 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" });
  519. 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" });
  520. 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" });
  521. 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" });
  522. 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" });
  523. 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" });
  524. 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" });
  525. 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" });
  526. //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" });
  527. ReplaceControlName(ref dic, "MFM57Flow", "MFM57.SetParameters");
  528. ReplaceControlName(ref dic, "MFM1Flow", "MFM1.SetParameters");
  529. ReplaceControlName(ref dic, "MFM6Flow", "MFM6.SetParameters");
  530. ReplaceControlName(ref dic, "MFM7Flow", "MFM7.SetParameters");
  531. ReplaceControlName(ref dic, "MFM8Flow", "MFM8.SetParameters");
  532. ReplaceControlName(ref dic, "MFM9Flow", "MFM9.SetParameters");
  533. ReplaceControlName(ref dic, "MFM11Flow", "MFM11.SetParameters");
  534. ReplaceControlName(ref dic, "MFM12Flow", "MFM12.SetParameters");
  535. ReplaceControlName(ref dic, "MFM13Flow", "MFM13.SetParameters");
  536. ReplaceControlName(ref dic, "MFM16Flow", "MFM16.SetParameters");
  537. ReplaceControlName(ref dic, "ConditionCheck", "SetConditionCheck");
  538. ReplaceControlName(ref dic, "Command", "SetCommand");
  539. if (dic.ContainsKey("AlarmConditionTable"))
  540. ReplaceControlName(ref dic, "AlarmConditionTable", "SetAlarmConditionTable");
  541. //ReplaceControlName(ref dic, "Heater2", "ZoneU.SetParameters");
  542. //ReplaceControlName(ref dic, "Heater4", "ZoneCU.SetParameters");
  543. //ReplaceControlName(ref dic, "Heater6", "ZoneC.SetParameters");
  544. //ReplaceControlName(ref dic, "Heater8", "ZoneCL.SetParameters");
  545. //ReplaceControlName(ref dic, "Heater10", "ZoneL.SetParameters");
  546. var controlMode = dic["Temperature.ControlMode"];
  547. var correct = dic["Temperature.Correct"];
  548. var PID = dic["Temperature.PID"];
  549. //AddParameter(ref dic, "ZoneU.SetParameters", controlMode, correct, PID);
  550. //AddParameter(ref dic, "ZoneCU.SetParameters", controlMode, correct, PID);
  551. //AddParameter(ref dic, "ZoneC.SetParameters", controlMode, correct, PID);
  552. //AddParameter(ref dic, "ZoneCL.SetParameters", controlMode, correct, PID);
  553. //AddParameter(ref dic, "ZoneL.SetParameters", controlMode, correct, PID);
  554. 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" });
  555. AddParameterValue(ref dic, "HeaterU.SetParameters", new string[8] { controlMode, correct, PID, recipeHead.TempCorrect, recipeHead.TempPID, recipeHead.ProfileCondition, dic["ValveAV91"], dic["BWR"] });
  556. 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" });
  557. AddParameterValue(ref dic, "HeaterCU.SetParameters", new string[8] { controlMode, correct, PID, recipeHead.TempCorrect, recipeHead.TempPID, recipeHead.ProfileCondition, dic["ValveAV91"], dic["BWR"] });
  558. 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" });
  559. AddParameterValue(ref dic, "HeaterC.SetParameters", new string[8] { controlMode, correct, PID, recipeHead.TempCorrect, recipeHead.TempPID, recipeHead.ProfileCondition, dic["ValveAV91"], dic["BWR"] });
  560. 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" });
  561. AddParameterValue(ref dic, "HeaterCL.SetParameters", new string[8] { controlMode, correct, PID, recipeHead.TempCorrect, recipeHead.TempPID, recipeHead.ProfileCondition, dic["ValveAV91"], dic["BWR"] });
  562. 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" });
  563. AddParameterValue(ref dic, "HeaterL.SetParameters", new string[8] { controlMode, correct, PID, recipeHead.TempCorrect, recipeHead.TempPID, recipeHead.ProfileCondition, dic["ValveAV91"], dic["BWR"] });
  564. 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
  565. AddParameterValue(ref dic, "APC.SetParameters", new string[2] { recipeHead.PressApcPID, dic["ValveAV71"] });//APC
  566. AddParameter(ref dic, "SetBoatMotion", new string[5] { "Loader.Command", "Loader.Speed1", "Loader.Speed2", "Loader.Speed3", "Loader.RPM" });//Boat
  567. List<string> auxCommands = new List<string>();
  568. for (int k = 1; k < 200; k++)
  569. {
  570. if (!dic.ContainsKey($"AUX.{k}.Set"))
  571. continue;
  572. auxCommands.Add($"{k},{dic[$"AUX.{k}.Set"]},{dic[$"AUX.{k}.Check"]},{dic[$"AUX.{k}.High"]},{dic[$"AUX.{k}.Low"]},{dic[$"AUX.{k}.CheckUnit"]}");
  573. dic.Remove($"AUX.{k}.Set");
  574. dic.Remove($"AUX.{k}.Check");
  575. dic.Remove($"AUX.{k}.High");
  576. dic.Remove($"AUX.{k}.Low");
  577. dic.Remove($"AUX.{k}.CheckUnit");
  578. }
  579. dic.Add("AUX.SetParameters", string.Join(";", auxCommands));
  580. //ReplaceControlName(ref dic, "RFSwitch", "RfPower.SetParameters");
  581. //AddParameter(ref dic, "RfPower.SetParameters", dic["RFSetpoint"], dic["ForwardPowerAlarmWatchTable"], dic["PrAlarmWatchTable"], dic["PIAlarmWatchTable"]);
  582. //ReplaceControlName(ref dic, "C1Setpoint", "RfMatch.SetParameters");
  583. //AddParameter(ref dic, "RfMatch.SetParameters", dic["C2Setpoint"], dic["C1AlarmWatchTable"], dic["C2AlarmWatchTable"], dic["VppAlarmWatchTable"]);
  584. AddValveParameter(ref dic, "SetValves", new string[153] {
  585. "ValveAV1",
  586. "ValveAV2",
  587. "ValveAV3",
  588. "ValveAV4",
  589. "ValveAV5",
  590. "ValveAV6",
  591. "ValveAV7",
  592. "ValveAV8",
  593. "ValveAV9",
  594. "ValveAV10",
  595. "ValveAV11",
  596. "ValveAV12",
  597. "ValveAV13",
  598. "ValveAV14",
  599. "ValveAV15",
  600. "ValveAV16",
  601. "ValveAV17",
  602. "ValveAV18",
  603. "ValveAV19",
  604. "ValveAV20",
  605. "ValveAV21",
  606. "ValveAV22",
  607. "ValveAV23",
  608. "ValveAV24",
  609. "ValveAV25",
  610. "ValveAV26",
  611. "ValveAV27",
  612. "ValveAV28",
  613. "ValveAV29",
  614. "ValveAV30",
  615. "ValveAV31",
  616. "ValveAV32",
  617. "ValveAV33",
  618. "ValveAV34",
  619. "ValveAV35",
  620. "ValveAV36",
  621. "ValveAV37",
  622. "ValveAV38",
  623. "ValveAV39",
  624. "ValveAV40",
  625. "ValveAV41",
  626. "ValveAV42",
  627. "ValveAV43",
  628. "ValveAV44",
  629. "ValveAV45",
  630. "ValveAV46",
  631. "ValveAV47",
  632. "ValveAV48",
  633. "ValveAV49",
  634. "ValveAV50",
  635. "ValveAV51",
  636. "ValveAV52",
  637. "ValveAV53",
  638. "ValveAV60",
  639. "ValveAV61",
  640. "ValveAV62",
  641. "ValveAV63",
  642. "ValveAV64",
  643. "ValveAV65",
  644. "ValveAV66",
  645. "ValveAV67",
  646. "ValveAV68",
  647. "ValveAV69",
  648. "ValveAV70",
  649. "ValveAV71",
  650. "ValveAV72",
  651. "ValveAV73",
  652. "ValveAV74",
  653. "ValveAV75",
  654. "ValveAV76",
  655. "ValveAV77",
  656. "ValveAV78",
  657. "ValveAV79",
  658. "ValveAV80",
  659. "ValveAV81",
  660. "ValveAV82",
  661. "ValveAV83",
  662. "ValveAV84",
  663. "ValveAV85",
  664. "ValveAV86",
  665. "ValveAV87",
  666. "ValveAV88",
  667. "ValveAV89",
  668. "ValveAV90",
  669. "ValveAV91",
  670. "ValveAV92",
  671. "ValveAV93",
  672. "ValveAV94",
  673. "ValveAV95",
  674. "ValveAV96",
  675. "ValveAV97",
  676. "ValveAV98",
  677. "ValveAV99",
  678. "ValveAV100",
  679. "ValveAV101",
  680. "ValveAV102",
  681. "ValveAV103",
  682. "ValveAV104",
  683. "ValveAV105",
  684. "ValveAV106",
  685. "ValveAV107",
  686. "ValveAV108",
  687. "ValveAV109",
  688. "ValveAV110",
  689. "ValveAV111",
  690. "ValveAV112",
  691. "ValveAV113",
  692. "ValveAV114",
  693. "ValveAV115",
  694. "ValveAV116",
  695. "ValveAV117",
  696. "ValveAV118",
  697. "ValveAV119",
  698. "ValveAV120",
  699. "ValveAV121",
  700. "ValveAV122",
  701. "ValveAV123",
  702. "ValveAV124",
  703. "ValveAV125",
  704. "ValveAV126",
  705. "ValveAV127",
  706. "ValveAV128",
  707. "ValveAV129",
  708. "ValveAV130",
  709. "ValveAV131",
  710. "ValveAV132",
  711. "ValveAV133",
  712. "ValveAV134",
  713. "ValveAV135",
  714. "ValveAV136",
  715. "DPR",
  716. "AGV",
  717. "AGV2",
  718. "MBP",
  719. "MBP1",
  720. "MBP2",
  721. "DP",
  722. "BWR",
  723. "F2Cln",
  724. "HFCln",
  725. "CEXH",
  726. "DEPO",
  727. "HTR1",
  728. "HTR2",
  729. "HTR3",
  730. "DP1",
  731. "DP2",
  732. "HMNT",
  733. "CMNT",
  734. "HREF",
  735. "CREF",
  736. "HZERO",
  737. "CZERO"
  738. });
  739. //dic.Remove("SetValves");
  740. //dic.Remove("HeaterU.SetParameters");
  741. //dic.Remove("HeaterCU.SetParameters");
  742. //dic.Remove("HeaterC.SetParameters");
  743. //dic.Remove("HeaterCL.SetParameters");
  744. //dic.Remove("HeaterL.SetParameters");
  745. //dic.Remove("MFC1.SetParameters");
  746. //dic.Remove("MFC2.SetParameters");
  747. //dic.Remove("MFC3.SetParameters");
  748. //dic.Remove("MFC4.SetParameters");
  749. //dic.Remove("MFC5.SetParameters");
  750. //dic.Remove("MFC6.SetParameters");
  751. //dic.Remove("MFC7.SetParameters");
  752. //dic.Remove("MFC8.SetParameters");
  753. //dic.Remove("MFC9.SetParameters");
  754. //dic.Remove("MFC10.SetParameters");
  755. //dic.Remove("MFC11.SetParameters");
  756. //dic.Remove("MFC12.SetParameters");
  757. //ReplaceControlNameForValve(ref dic, "ValveAV1");
  758. //ReplaceControlNameForValve(ref dic, "ValveAV2");
  759. //ReplaceControlNameForValve(ref dic, "ValveAV3");
  760. //ReplaceControlNameForValve(ref dic, "ValveAV4");
  761. //ReplaceControlNameForValve(ref dic, "ValveAV5");
  762. //ReplaceControlNameForValve(ref dic, "ValveAV6");
  763. //ReplaceControlNameForValve(ref dic, "ValveAV7");
  764. //ReplaceControlNameForValve(ref dic, "ValveAV8");
  765. //ReplaceControlNameForValve(ref dic, "ValveAV9");
  766. //ReplaceControlNameForValve(ref dic, "ValveAV10");
  767. //ReplaceControlNameForValve(ref dic, "ValveAV11");
  768. //ReplaceControlNameForValve(ref dic, "ValveAV12");
  769. //ReplaceControlNameForValve(ref dic, "ValveAV13");
  770. //ReplaceControlNameForValve(ref dic, "ValveAV14");
  771. //ReplaceControlNameForValve(ref dic, "ValveAV15");
  772. //ReplaceControlNameForValve(ref dic, "ValveAV16");
  773. //ReplaceControlNameForValve(ref dic, "ValveAV17");
  774. //ReplaceControlNameForValve(ref dic, "ValveAV18");
  775. //ReplaceControlNameForValve(ref dic, "ValveAV19");
  776. //ReplaceControlNameForValve(ref dic, "ValveAV20");
  777. //ReplaceControlNameForValve(ref dic, "ValveAV21");
  778. //ReplaceControlNameForValve(ref dic, "ValveAV22");
  779. //ReplaceControlNameForValve(ref dic, "ValveAV23");
  780. //ReplaceControlNameForValve(ref dic, "ValveAV24");
  781. //ReplaceControlNameForValve(ref dic, "ValveAV25");
  782. //ReplaceControlNameForValve(ref dic, "ValveAV26");
  783. //ReplaceControlNameForValve(ref dic, "ValveAV27");
  784. //ReplaceControlNameForValve(ref dic, "ValveAV28");
  785. //ReplaceControlNameForValve(ref dic, "ValveAV29");
  786. //ReplaceControlNameForValve(ref dic, "ValveAV30");
  787. //ReplaceControlNameForValve(ref dic, "ValveAV31");
  788. //ReplaceControlNameForValve(ref dic, "ValveAV32");
  789. //ReplaceControlNameForValve(ref dic, "ValveAV33");
  790. //ReplaceControlNameForValve(ref dic, "ValveAV34");
  791. //ReplaceControlNameForValve(ref dic, "ValveAV35");
  792. //ReplaceControlNameForValve(ref dic, "ValveAV36");
  793. //ReplaceControlNameForValve(ref dic, "ValveAV37");
  794. //ReplaceControlNameForValve(ref dic, "ValveAV38");
  795. //ReplaceControlNameForValve(ref dic, "ValveAV39");
  796. //ReplaceControlNameForValve(ref dic, "ValveAV52");
  797. ////ReplaceControlNameForValve(ref dic, "ValveAV54");
  798. ////ReplaceControlNameForValve(ref dic, "ValveAV56");
  799. ////ReplaceControlNameForValve(ref dic, "ValveAV57");
  800. ////ReplaceControlNameForValve(ref dic, "ValveAV58");
  801. ////ReplaceControlNameForValve(ref dic, "ValveAV59");
  802. //ReplaceControlNameForValve(ref dic, "ValveAV60");
  803. ////ReplaceControlNameForValve(ref dic, "ValveAV65");
  804. ////ReplaceControlNameForValve(ref dic, "ValveAV66");
  805. ////ReplaceControlNameForValve(ref dic, "ValveAV68");
  806. //ReplaceControlNameForValve(ref dic, "ValveAV71");
  807. //ReplaceControlNameForValve(ref dic, "ValveAV72");
  808. //ReplaceControlNameForValve(ref dic, "ValveAV73");
  809. //ReplaceControlNameForValve(ref dic, "ValveAV74");
  810. //ReplaceControlNameForValve(ref dic, "ValveAV75");
  811. //ReplaceControlNameForValve(ref dic, "ValveAV77");
  812. //ReplaceControlNameForValve(ref dic, "ValveAV81");
  813. //ReplaceControlNameForValve(ref dic, "ValveAV82");
  814. //ReplaceControlNameForValve(ref dic, "ValveAV83");
  815. //ReplaceControlNameForValve(ref dic, "ValveAV91");
  816. dic.Remove("StepNo");
  817. dic.Remove("Name");
  818. dic.Remove("EndBy");
  819. dic.Remove("Time");
  820. dic.Remove("ZAxisPosition");
  821. dic.Remove("ZAxisSpeed");
  822. dic.Remove("RotatePosition");
  823. dic.Remove("RotateSpeed");
  824. dic.Remove("RotateDirection");
  825. dic.Remove("Heater1");
  826. dic.Remove("Heater2");
  827. dic.Remove("Heater3");
  828. dic.Remove("Heater4");
  829. dic.Remove("Heater5");
  830. dic.Remove("ValveAV54");
  831. dic.Remove("ValveAV55");
  832. dic.Remove("ValveAV56");
  833. dic.Remove("ValveAV57");
  834. dic.Remove("ValveAV58");
  835. dic.Remove("ValveAV59");
  836. dic.Remove("ValveAV65");
  837. dic.Remove("ValveAV66");
  838. dic.Remove("ValveAV68");
  839. dic.Remove("ExternalOn");
  840. dic.Remove("ExternalOff");
  841. dic.Remove("ExternalSensor");
  842. dic.Remove("TempStabilize");
  843. dic.Remove("FinishAutoProfile");
  844. dic.Remove("ReachTempWait");
  845. dic.Remove("ReachTemp");
  846. dic.Remove("TempUpper");
  847. dic.Remove("TempLower");
  848. dic.Remove("ReachPressureWait");
  849. dic.Remove("ReachPressure");
  850. dic.Remove("PressureUpper");
  851. dic.Remove("PressureLower");
  852. dic.Remove("PressureStabilize");
  853. dic.Remove("External.Out1");
  854. dic.Remove("External.Out2");
  855. dic.Remove("External.Out3");
  856. dic.Remove("External.Out4");
  857. dic.Remove("External.Out5");
  858. dic.Remove("External.Out6");
  859. dic.Remove("RFSwitch");
  860. dic.Remove("RFSetpoint");
  861. dic.Remove("ForwardPowerAlarmWatchTable");
  862. dic.Remove("PrAlarmWatchTable");
  863. dic.Remove("PIAlarmWatchTable");
  864. dic.Remove("C1Setpoint");
  865. dic.Remove("C2Setpoint");
  866. dic.Remove("C1AlarmWatchTable");
  867. dic.Remove("C2AlarmWatchTable");
  868. dic.Remove("VppAlarmWatchTable");
  869. dic.Remove("VdcAlarmWatchTable");
  870. dic.Remove("AbortRecipeTableIndex");
  871. dic.Remove("Temperature.ControlMode");
  872. dic.Remove("Temperature.Correct");
  873. dic.Remove("Temperature.PID");
  874. dic.Remove("Temperature.Profile");
  875. dic.Remove("Temperature.Stabilize");
  876. dic.Remove("Temperature.TempReadyCond");
  877. dic.Remove("FilmThickFormula");
  878. dic.Remove("FilmThickCoefficientA");
  879. dic.Remove("FilmThickCoefficientB");
  880. dic.Remove("APC.SetPressure");
  881. dic.Remove("PressureSettingVG");
  882. dic.Remove("PressureSonserValue");
  883. dic.Remove("PressureValveAngle");
  884. dic.Remove("PressureAlarmTableNo");
  885. dic.Remove("EventSetting");
  886. dic.Remove("AlarmTableIndex");
  887. dic.Remove("AlarmDetails.1");
  888. dic.Remove("AlarmAction.1");
  889. dic.Remove("AlarmDetails.2");
  890. dic.Remove("AlarmAction.2");
  891. dic.Remove("AlarmDetails.3");
  892. dic.Remove("AlarmAction.3");
  893. dic.Remove("AlarmDetails.4");
  894. dic.Remove("AlarmAction.4");
  895. dic.Remove("AlarmDetails.5");
  896. dic.Remove("AlarmAction.5");
  897. dic.Remove("AlarmDetails.6");
  898. dic.Remove("AlarmAction.6");
  899. dic.Remove("AlarmDetails.7");
  900. dic.Remove("AlarmAction.7");
  901. dic.Remove("AlarmDetails.8");
  902. dic.Remove("AlarmAction.8");
  903. dic.Remove("AlarmDetails.9");
  904. dic.Remove("AlarmAction.9");
  905. dic.Remove("AlarmDetails.10");
  906. dic.Remove("AlarmAction.10");
  907. //List<string> mfcCheckInstall = new List<string>()
  908. //{
  909. // "MfcN1",
  910. // "MfcN2",
  911. // "MfcN3",
  912. // "MfcH1",
  913. // "MfcJ1",
  914. // "MfcXN1",
  915. //};
  916. //foreach(var mfc in mfcCheckInstall)
  917. //{
  918. // if (!SC.GetValue<bool>($"PM1.MFC.{mfc}.IsMFCInstalled"))
  919. // dic.Remove($"{mfc}.SetParameters");
  920. //}
  921. foreach (string key in dic.Keys)
  922. recipeStep.RecipeCommands.Add(key, dic[key]);
  923. }
  924. for (int i = 0; i < recipeData.Count; i++)
  925. {
  926. if (recipeData[i].IsJumpStep)
  927. {
  928. bool findJumpStep = false;
  929. for (int j = 0; j < recipeData.Count; j++)
  930. {
  931. if (recipeData[j].StepName == recipeData[i].JumpStepName)
  932. {
  933. recipeData[i].JumpStepNo = j;
  934. findJumpStep = true;
  935. break;
  936. }
  937. }
  938. if (!findJumpStep)
  939. {
  940. reason = $"Recipe file does not contains jump step {recipeData[i].JumpStepName}";
  941. return false;
  942. }
  943. }
  944. }
  945. }
  946. catch (Exception ex)
  947. {
  948. LOG.Write(ex);
  949. reason = $"Recipe file content not valid, {recipeFile}, {ex.Message}";
  950. return false;
  951. }
  952. return true;
  953. }
  954. public static bool LayoutRecipeParse(string recipeFile, string module, out RecipeLayoutEntityNormal layoutRecipeDataNormal, out RecipeLayoutEntityExpert layoutRecipeDataExpert, out string reason)
  955. {
  956. reason = string.Empty;
  957. layoutRecipeDataNormal = new RecipeLayoutEntityNormal();
  958. layoutRecipeDataExpert = new RecipeLayoutEntityExpert();
  959. string content = RecipeFileManager.Instance.LoadRecipe($"{SC.GetStringValue("System.Recipe.SupportedChamberType")}\\{SC.GetStringValue("System.Recipe.SupportedLayoutType")}", recipeFile, false);
  960. if (string.IsNullOrEmpty(content))
  961. {
  962. reason = $"{recipeFile} is not a valid recipe file";
  963. return false;
  964. }
  965. try
  966. {
  967. XmlDocument rcpDataDoc = new XmlDocument();
  968. rcpDataDoc.LoadXml(content);
  969. XmlNode nodeModule;
  970. nodeModule = rcpDataDoc.SelectSingleNode("/Aitex/TableRecipeData/Module/Step[@Name='Normal']");
  971. if (nodeModule == null)
  972. {
  973. //reason = "Recipe file does not contains step content for Normal";
  974. return false;
  975. }
  976. else
  977. {
  978. Type t = layoutRecipeDataNormal.GetType();
  979. foreach (FieldInfo pi in t.GetFields())
  980. {
  981. XmlElement stepNode = nodeModule as XmlElement;
  982. //遍历Step节点
  983. foreach (XmlAttribute att in stepNode.Attributes)
  984. {
  985. if (pi.Name == att.Name)
  986. {
  987. pi.SetValue(layoutRecipeDataNormal, att.Value);
  988. }
  989. }
  990. }
  991. }
  992. nodeModule = rcpDataDoc.SelectSingleNode("/Aitex/TableRecipeData/Module/Step[@Name='Expert']");
  993. if (nodeModule == null)
  994. {
  995. //reason = "Recipe file does not contains step content for Expert";
  996. return false;
  997. }
  998. else
  999. {
  1000. XmlElement stepNode = nodeModule as XmlElement;
  1001. string strName = "";
  1002. //遍历Step节点
  1003. foreach (XmlAttribute att in stepNode.Attributes)
  1004. {
  1005. if (att.Name != "Name")
  1006. {
  1007. layoutRecipeDataExpert.Items.Add(att.Value);
  1008. }
  1009. else
  1010. {
  1011. strName = att.Value;
  1012. }
  1013. }
  1014. layoutRecipeDataExpert.Name = strName;
  1015. }
  1016. }
  1017. catch (Exception ex)
  1018. {
  1019. LOG.Write(ex);
  1020. reason = $"Recipe file content not valid, {recipeFile}, {ex.Message}";
  1021. return false;
  1022. }
  1023. return true;
  1024. }
  1025. private static void ReplaceControlName(ref Dictionary<string, string> dic, string from, string to)
  1026. {
  1027. if (dic.ContainsKey(from))
  1028. {
  1029. dic.Add(to, dic[from]);
  1030. dic.Remove(from);
  1031. }
  1032. }
  1033. private static void ReplaceControlName(ref Dictionary<string, string> dic, string from, string to1, string to2)
  1034. {
  1035. dic.Add(to1, dic[from]);
  1036. dic.Add(to2, dic[from]);
  1037. dic.Remove(from);
  1038. }
  1039. private static void ReplaceControlNameForValve(ref Dictionary<string, string> dic, string key)
  1040. {
  1041. switch (dic[key].ToLower())
  1042. {
  1043. case "open":
  1044. dic[key] = "true";
  1045. break;
  1046. case "close":
  1047. dic[key] = "false";
  1048. break;
  1049. case "continue":
  1050. dic[key] = "Continue";
  1051. break;
  1052. }
  1053. //dic[key] = dic[key].ToLower() == "open" ? "true" : "false";
  1054. }
  1055. private static void AddValveParameter(ref Dictionary<string, string> dic, string to, string[] param)
  1056. {
  1057. if (param != null && param.Length > 0)
  1058. {
  1059. foreach (var item in param)
  1060. {
  1061. if (!string.IsNullOrEmpty(item) && dic.ContainsKey(item))
  1062. {
  1063. if (!dic.ContainsKey(to))
  1064. dic.Add(to, "");
  1065. var set = "";
  1066. switch (dic[item].ToLower())
  1067. {
  1068. case "open":
  1069. set = "true";
  1070. break;
  1071. case "close":
  1072. set = "false";
  1073. break;
  1074. case "continue":
  1075. set = "Continue";
  1076. break;
  1077. }
  1078. var value = $"{dic[to]};{item},{set}";
  1079. dic[to] = string.IsNullOrEmpty(dic[to]) ? $"{item},{set}" : value;
  1080. dic.Remove(item);
  1081. }
  1082. }
  1083. }
  1084. }
  1085. private static void AddParameter(ref Dictionary<string, string> dic, string to, string from1, string from2, string from3, string from4 = null)
  1086. {
  1087. var value = $"{dic[to]};{from1};{from2};{from3}";
  1088. if (!string.IsNullOrEmpty(from4))
  1089. value = $"{value};{from4}";
  1090. dic[to] = value;
  1091. }
  1092. private static void AddParameter(ref Dictionary<string, string> dic, string to, string[] param)
  1093. {
  1094. if (param != null && param.Length > 0)
  1095. {
  1096. foreach (var item in param)
  1097. {
  1098. if (!string.IsNullOrEmpty(item) && dic.ContainsKey(item))
  1099. {
  1100. if (!dic.ContainsKey(to))
  1101. dic.Add(to, "");
  1102. var value = $"{dic[to]};{dic[item]}";
  1103. dic[to] = string.IsNullOrEmpty(dic[to]) ? dic[item] : value;
  1104. dic.Remove(item);
  1105. }
  1106. }
  1107. }
  1108. }
  1109. private static void AddParameterValue(ref Dictionary<string, string> dic, string to, string[] param)
  1110. {
  1111. if (!dic.ContainsKey(to))
  1112. dic.Add(to, "");
  1113. if (param != null && param.Length > 0)
  1114. {
  1115. foreach (var item in param)
  1116. {
  1117. var value = $"{dic[to]};{item}";
  1118. dic[to] = string.IsNullOrEmpty(dic[to]) ? item : value;
  1119. }
  1120. }
  1121. }
  1122. public static bool ParseTables(string recipeFile, string module, out Dictionary<int, List<RecipeStep>> recipeDatas, out string reason, string recipeType)
  1123. {
  1124. reason = string.Empty;
  1125. recipeDatas = new Dictionary<int, List<RecipeStep>>();
  1126. string content = string.Empty;
  1127. if (recipeType != "Process" && recipeType != "Idle" && recipeType != "Reset")
  1128. {
  1129. if (!File.Exists($"{PathManager.GetRecipeDir()}\\{SC.GetStringValue("System.Recipe.SupportedChamberType")}\\{SC.GetStringValue($"System.Recipe.Supported{recipeType}Type")}\\{recipeFile}.rcp"))
  1130. return true;
  1131. }
  1132. content = RecipeFileManager.Instance.LoadRecipe($"{SC.GetStringValue("System.Recipe.SupportedChamberType")}\\{SC.GetStringValue($"System.Recipe.Supported{recipeType}Type")}", recipeFile, false);
  1133. if (string.IsNullOrEmpty(content))
  1134. {
  1135. reason = $"{recipeFile} is not a valid recipe file";
  1136. return false;
  1137. }
  1138. try
  1139. {
  1140. //获取工艺程序文件中允许的命令字符串列表
  1141. //目的:如果工艺程序文件中含有规定之外的命令,则被禁止执行
  1142. HashSet<string> recipeAllowedCommands = new HashSet<string>();
  1143. XmlDocument rcpFormatDoc = new XmlDocument();
  1144. string recipeSchema = PathManager.GetCfgDir() + $@"\Recipe\Furnace\Process\{SC.GetStringValue("System.SetUp.ToolType")}\RecipeFormat.xml";
  1145. rcpFormatDoc.Load(recipeSchema);
  1146. XmlNodeList rcpItemNodeList = rcpFormatDoc.SelectNodes("/Aitex/TableRecipeFormat/Catalog/Group/Step");
  1147. foreach (XmlElement item in rcpItemNodeList)
  1148. recipeAllowedCommands.Add(item.Attributes["ControlName"].Value);
  1149. recipeAllowedCommands.Add("Temperature.ControlMode");
  1150. recipeAllowedCommands.Add("Temperature.Correct");
  1151. recipeAllowedCommands.Add("Temperature.PID");
  1152. recipeAllowedCommands.Add("ConditionCheck");
  1153. recipeAllowedCommands.Add("EventSetting");
  1154. recipeAllowedCommands.Add("FilmThickFormula");
  1155. recipeAllowedCommands.Add("FilmThickCoefficientA");
  1156. recipeAllowedCommands.Add("FilmThickCoefficientB");
  1157. recipeAllowedCommands.Add("AlarmTableIndex");
  1158. recipeAllowedCommands.Add("RFSwitch");
  1159. recipeAllowedCommands.Add("RFSetpoint");
  1160. recipeAllowedCommands.Add("ForwardPowerAlarmWatchTable");
  1161. recipeAllowedCommands.Add("PrAlarmWatchTable");
  1162. recipeAllowedCommands.Add("PIAlarmWatchTable");
  1163. recipeAllowedCommands.Add("C1Setpoint");
  1164. recipeAllowedCommands.Add("C2Setpoint");
  1165. recipeAllowedCommands.Add("C1AlarmWatchTable");
  1166. recipeAllowedCommands.Add("C2AlarmWatchTable");
  1167. recipeAllowedCommands.Add("VppAlarmWatchTable");
  1168. recipeAllowedCommands.Add("VdcAlarmWatchTable");
  1169. recipeAllowedCommands.Add("PressureSonserValue");
  1170. recipeAllowedCommands.Add("PressureValveAngle");
  1171. recipeAllowedCommands.Add("PressureSettingVG");
  1172. recipeAllowedCommands.Add("PressCommand");
  1173. recipeAllowedCommands.Add("PressValue");
  1174. recipeAllowedCommands.Add("PressureAlarmTableNo");
  1175. recipeAllowedCommands.Add("AbortRecipeTableIndex");
  1176. recipeAllowedCommands.Add("AlarmConditionTable");
  1177. recipeAllowedCommands.Add("LoaderCommand");
  1178. recipeAllowedCommands.Add("LoaderValue");
  1179. for (int i = 1; i < 11; i++)
  1180. {
  1181. recipeAllowedCommands.Add($"AlarmAction.{i}");
  1182. recipeAllowedCommands.Add($"AlarmDetails.{i}");
  1183. }
  1184. for (int i = 1; i < 60; i++)
  1185. {
  1186. recipeAllowedCommands.Add($"MFC{i}.Flow.Set");
  1187. recipeAllowedCommands.Add($"MFC{i}.Flow.SetUnit");
  1188. recipeAllowedCommands.Add($"MFC{i}.Flow.Ramprate");
  1189. recipeAllowedCommands.Add($"MFC{i}.Flow.RamprateUnit");
  1190. recipeAllowedCommands.Add($"MFC{i}.Flow.Check");
  1191. recipeAllowedCommands.Add($"MFC{i}.Flow.High");
  1192. recipeAllowedCommands.Add($"MFC{i}.Flow.Low");
  1193. recipeAllowedCommands.Add($"MFC{i}.Flow.Unit");
  1194. }
  1195. for (int i = 1; i < 200; i++)
  1196. {
  1197. recipeAllowedCommands.Add($"AUX.{i}.Set");
  1198. recipeAllowedCommands.Add($"AUX.{i}.Check");
  1199. recipeAllowedCommands.Add($"AUX.{i}.High");
  1200. recipeAllowedCommands.Add($"AUX.{i}.Low");
  1201. recipeAllowedCommands.Add($"AUX.{i}.CheckUnit");
  1202. }
  1203. recipeAllowedCommands.Add("HeaterU.ZoneName");
  1204. recipeAllowedCommands.Add("HeaterU.Set");
  1205. recipeAllowedCommands.Add("HeaterU.SetUnit");
  1206. recipeAllowedCommands.Add("HeaterU.Ramprate");
  1207. recipeAllowedCommands.Add("HeaterU.RamprateUnit");
  1208. recipeAllowedCommands.Add("HeaterU.Check");
  1209. recipeAllowedCommands.Add("HeaterU.High");
  1210. recipeAllowedCommands.Add("HeaterU.Low");
  1211. recipeAllowedCommands.Add("HeaterU.Unit");
  1212. recipeAllowedCommands.Add("HeaterCU.ZoneName");
  1213. recipeAllowedCommands.Add("HeaterCU.Set");
  1214. recipeAllowedCommands.Add("HeaterCU.SetUnit");
  1215. recipeAllowedCommands.Add("HeaterCU.Ramprate");
  1216. recipeAllowedCommands.Add("HeaterCU.RamprateUnit");
  1217. recipeAllowedCommands.Add("HeaterCU.Check");
  1218. recipeAllowedCommands.Add("HeaterCU.High");
  1219. recipeAllowedCommands.Add("HeaterCU.Low");
  1220. recipeAllowedCommands.Add("HeaterCU.Unit");
  1221. recipeAllowedCommands.Add("HeaterC.ZoneName");
  1222. recipeAllowedCommands.Add("HeaterC.Set");
  1223. recipeAllowedCommands.Add("HeaterC.SetUnit");
  1224. recipeAllowedCommands.Add("HeaterC.Ramprate");
  1225. recipeAllowedCommands.Add("HeaterC.RamprateUnit");
  1226. recipeAllowedCommands.Add("HeaterC.Check");
  1227. recipeAllowedCommands.Add("HeaterC.High");
  1228. recipeAllowedCommands.Add("HeaterC.Low");
  1229. recipeAllowedCommands.Add("HeaterC.Unit");
  1230. recipeAllowedCommands.Add("HeaterCL.ZoneName");
  1231. recipeAllowedCommands.Add("HeaterCL.Set");
  1232. recipeAllowedCommands.Add("HeaterCL.SetUnit");
  1233. recipeAllowedCommands.Add("HeaterCL.Ramprate");
  1234. recipeAllowedCommands.Add("HeaterCL.RamprateUnit");
  1235. recipeAllowedCommands.Add("HeaterCL.Check");
  1236. recipeAllowedCommands.Add("HeaterCL.High");
  1237. recipeAllowedCommands.Add("HeaterCL.Low");
  1238. recipeAllowedCommands.Add("HeaterCL.Unit");
  1239. recipeAllowedCommands.Add("HeaterL.ZoneName");
  1240. recipeAllowedCommands.Add("HeaterL.Set");
  1241. recipeAllowedCommands.Add("HeaterL.SetUnit");
  1242. recipeAllowedCommands.Add("HeaterL.Ramprate");
  1243. recipeAllowedCommands.Add("HeaterL.RamprateUnit");
  1244. recipeAllowedCommands.Add("HeaterL.Check");
  1245. recipeAllowedCommands.Add("HeaterL.High");
  1246. recipeAllowedCommands.Add("HeaterL.Low");
  1247. recipeAllowedCommands.Add("HeaterL.Unit");
  1248. recipeAllowedCommands.Add("Loader.Command");
  1249. recipeAllowedCommands.Add("Loader.Speed1");
  1250. recipeAllowedCommands.Add("Loader.Speed2");
  1251. recipeAllowedCommands.Add("Loader.Speed3");
  1252. recipeAllowedCommands.Add("Loader.RPM");
  1253. recipeAllowedCommands.Add("Press.Command");
  1254. recipeAllowedCommands.Add("Press.PID");
  1255. recipeAllowedCommands.Add("Press.Set");
  1256. recipeAllowedCommands.Add("Press.SlowVacSet");
  1257. recipeAllowedCommands.Add("Press.ValveAngleSet");
  1258. recipeAllowedCommands.Add("Press.IsWait");
  1259. recipeAllowedCommands.Add("Press.LowWait");
  1260. recipeAllowedCommands.Add("Press.HighWait");
  1261. recipeAllowedCommands.Add("Press.WaitUnit");
  1262. recipeAllowedCommands.Add("Press.WaitPress");
  1263. //获取工艺程序文件中所有步的内容
  1264. XmlDocument rcpDataDoc = new XmlDocument();
  1265. rcpDataDoc.LoadXml(content);
  1266. XmlNodeList tablesNodeList = rcpDataDoc.SelectNodes("//Tables/Table");
  1267. if (tablesNodeList == null || tablesNodeList.Count == 0)
  1268. {
  1269. reason = "No Table nodes found.";
  1270. return false;
  1271. }
  1272. for (int x = 0; x < tablesNodeList.Count; x++)
  1273. {
  1274. XmlNode tableNode = tablesNodeList[x];
  1275. // 获取当前 Table 下的所有 Step 节点
  1276. XmlNodeList stepNodes = tableNode.SelectNodes("Step");
  1277. #region
  1278. string strLoopEndStep, strJumpStep;
  1279. strLoopEndStep = strJumpStep = string.Empty;
  1280. var recipeData = new List<RecipeStep>();
  1281. for (int i = 0; i < stepNodes.Count; i++)
  1282. {
  1283. var recipeStep = new RecipeStep();
  1284. recipeStep.RecipeType = recipeType;
  1285. recipeData.Add(recipeStep);
  1286. XmlElement stepNode = stepNodes[i] as XmlElement;
  1287. Dictionary<string, string> dic = new Dictionary<string, string>();
  1288. //遍历Step节点
  1289. foreach (XmlAttribute att in stepNode.Attributes)
  1290. {
  1291. if (recipeAllowedCommands.Contains(att.Name))
  1292. {
  1293. dic.Add(att.Name, att.Value);
  1294. }
  1295. }
  1296. //遍历Step子节点中所有的attribute属性节点
  1297. foreach (XmlElement subStepNode in stepNode.ChildNodes)
  1298. {
  1299. foreach (XmlAttribute att in subStepNode.Attributes)
  1300. {
  1301. if (recipeAllowedCommands.Contains(att.Name))
  1302. {
  1303. dic.Add(att.Name, att.Value);
  1304. }
  1305. }
  1306. //遍历Step子节点的子节点中所有的attribute属性节点
  1307. foreach (XmlElement subsubStepNode in subStepNode.ChildNodes)
  1308. {
  1309. foreach (XmlAttribute att in subsubStepNode.Attributes)
  1310. {
  1311. if (recipeAllowedCommands.Contains(att.Name))
  1312. {
  1313. dic.Add(att.Name, att.Value);
  1314. }
  1315. }
  1316. }
  1317. }
  1318. recipeStep.StepName = dic["Name"];
  1319. if (dic["Name"] == strLoopEndStep)
  1320. {
  1321. recipeStep.IsLoopEndStep = true;
  1322. strLoopEndStep = string.Empty;
  1323. }
  1324. recipeStep.IsJumpStep = false;
  1325. if (dic.ContainsKey("Command"))
  1326. {
  1327. string commandStr = dic["Command"];
  1328. if (commandStr.Contains("CallSystemRecipe"))
  1329. {
  1330. }
  1331. else if (commandStr.ToUpper().StartsWith("CALL"))
  1332. {
  1333. int subTableID = 0;
  1334. var subPara = commandStr.Replace("CALL", "").Replace("[", "").Replace("]", "").Split('*');
  1335. if (subPara != null && subPara.Length > 1)
  1336. {
  1337. int.TryParse(subPara[0], out int loopCount);
  1338. var tablePara = subPara[1].Split(':');
  1339. if (tablePara != null && tablePara.Length > 1)
  1340. {
  1341. int.TryParse(tablePara[0], out subTableID);
  1342. if (subTableID > 0)
  1343. {
  1344. recipeStep.IsCallSubStep = true;
  1345. recipeStep.SubRecipeLoopCount = loopCount;
  1346. }
  1347. }
  1348. recipeStep.SubRecipeTableInfo = subPara[1];
  1349. }
  1350. }
  1351. else if (commandStr.ToUpper().StartsWith("LOOP"))
  1352. {
  1353. recipeStep.IsLoopEndStep = true;
  1354. var loopPara = commandStr.Replace("LOOP", "").Replace("[", "").Replace("]", "").Split('*');
  1355. if (loopPara != null && loopPara.Length > 1)
  1356. {
  1357. int.TryParse(loopPara[0], out int loopCount);
  1358. recipeStep.LoopCount = loopCount + 1;//加1是因为第一次从正常的start-》end的执行算是一次循环,所以要额外加1
  1359. int loopStartStep = -1;
  1360. for (int index = 0; index < recipeData.Count; index++)
  1361. {
  1362. if (recipeData[index].StepName == loopPara[1])
  1363. {
  1364. loopStartStep = index;
  1365. break;
  1366. }
  1367. }
  1368. if (loopStartStep < 0)
  1369. {
  1370. reason = $"Recipe file does not contains LOOP step {loopPara[1]}";
  1371. return false;
  1372. }
  1373. if (loopPara[1] != null)
  1374. {
  1375. if (loopStartStep < 0 ||
  1376. (recipeType == "Process" && loopStartStep == 0))//Process recipe的standby不参与循环
  1377. recipeStep.IsLoopEndStep = false;
  1378. else
  1379. {
  1380. recipeStep.LoopStartStep = loopStartStep;
  1381. if (recipeData.Count > loopStartStep)
  1382. {
  1383. recipeData[loopStartStep].IsLoopStartStep = true;
  1384. recipeData[loopStartStep].LoopCount = loopCount + 1;
  1385. recipeStep.LoopEndStep = recipeType == "Process" ? i + 1 : i;//Process recipe包含standby,从0开始;其他recipe不包含standby
  1386. }
  1387. }
  1388. }
  1389. }
  1390. }
  1391. else if (commandStr.ToUpper().StartsWith("JUMP"))
  1392. {
  1393. var jumpPara = commandStr.Replace("Jump:", string.Empty).Replace("[", "").Replace("]", "");//JumpStepNo
  1394. if (jumpPara != null)
  1395. {
  1396. //int.TryParse(jumpPara[0], out int jumpStepNo);
  1397. //recipeStep.JumpStepNo = recipeType == "Process" ? jumpStepNo : jumpStepNo - 1;//Process recipe包含standby,从0开始;其他recipe不包含standby
  1398. recipeStep.IsJumpStep = true;
  1399. recipeStep.JumpStepName = jumpPara;
  1400. }
  1401. }
  1402. }
  1403. if (dic.ContainsKey("AbortRecipeTableIndex"))
  1404. {
  1405. if (dic["AbortRecipeTableIndex"].ToLower() != "none")
  1406. {
  1407. recipeStep.AbortRecipeTableInfo = dic["AbortRecipeTableIndex"];
  1408. }
  1409. recipeStep.AbortRecipeSteps = null;
  1410. }
  1411. if (dic.ContainsKey("EventSetting"))
  1412. {
  1413. string eventSettingStr = dic["EventSetting"];
  1414. if (eventSettingStr.ToLower() == "start")
  1415. {
  1416. recipeStep.IsTimeMeasurementStartStep = true;
  1417. }
  1418. else if (eventSettingStr.ToLower() == "stop")
  1419. {
  1420. recipeStep.IsTimeMeasurementStopStep = true;
  1421. }
  1422. }
  1423. if (dic.ContainsKey("FilmThickFormula"))
  1424. {
  1425. recipeStep.FilmThickFormula = dic["FilmThickFormula"];
  1426. }
  1427. if (dic.ContainsKey("FilmThickCoefficientA"))
  1428. {
  1429. recipeStep.FilmThickCoefficientA = float.Parse(dic["FilmThickCoefficientA"]);
  1430. }
  1431. if (dic.ContainsKey("FilmThickCoefficientB"))
  1432. {
  1433. recipeStep.FilmThickCoefficientB = float.Parse(dic["FilmThickCoefficientB"]);
  1434. }
  1435. if (dic.ContainsKey("AlarmConditionTable"))
  1436. {
  1437. recipeStep.AlarmConditionTable = dic["AlarmConditionTable"];
  1438. }
  1439. for (int j = 1; j < 11; j++)
  1440. {
  1441. string tempType = "Ignore Alarm";
  1442. string tempDetails = "";
  1443. if (dic.ContainsKey($"AlarmAction.{j}"))
  1444. {
  1445. tempType = dic[$"AlarmAction.{j}"];
  1446. }
  1447. if (dic.ContainsKey($"AlarmDetails.{j}"))
  1448. {
  1449. tempDetails = dic[$"AlarmDetails.{j}"];
  1450. }
  1451. recipeStep.AlarmActionSets.Add(j, new AlarmActions()
  1452. {
  1453. ProcessingType = tempType,
  1454. ProcessingDetails = tempDetails
  1455. });
  1456. }
  1457. //if(dic.ContainsKey("Loop"))
  1458. //{
  1459. // string loopStr = dic["Loop"];
  1460. // recipeStep.IsLoopStartStep = System.Text.RegularExpressions.Regex.Match(loopStr, @"Loop\x20\d+\s*$").Success;
  1461. // recipeStep.IsLoopEndStep = System.Text.RegularExpressions.Regex.Match(loopStr, @"Loop End$").Success;
  1462. // if (recipeStep.IsLoopStartStep)
  1463. // recipeStep.LoopCount = Convert.ToInt32(loopStr.Replace("Loop", string.Empty));
  1464. // else
  1465. // recipeStep.LoopCount = 0;
  1466. //}
  1467. //recipe time
  1468. if (dic["Name"].ToLower() == "standby")
  1469. {
  1470. if (DateTime.TryParse(dic["Time"], out DateTime time))
  1471. {
  1472. recipeStep.StepTime = time.Second + time.Minute * 60 + time.Hour * 3600 + time.Millisecond / 1000.0;
  1473. }
  1474. else if (float.TryParse(dic["Time"], out float timeInSec))
  1475. {
  1476. recipeStep.StepTime = timeInSec;
  1477. recipeStep.EndBy = EnumEndByCondition.ByTime;
  1478. }
  1479. else
  1480. {
  1481. recipeStep.StepTime = 0;
  1482. recipeStep.EndBy = EnumEndByCondition.ByStandbyFactor;
  1483. }
  1484. }
  1485. else
  1486. {
  1487. if (System.Text.RegularExpressions.Regex.Match(dic["Time"], @"[a-zA-Z]").Success)
  1488. {
  1489. if (SC.ContainsItem($"{module}.RecipeEditParameter.StepTime.{dic["Time"]}"))
  1490. {
  1491. var time = DateTime.Parse(SC.GetStringValue($"{module}.RecipeEditParameter.StepTime.{dic["Time"]}"));
  1492. recipeStep.StepTime = time.Second + time.Minute * 60 + time.Hour * 3600;
  1493. }
  1494. else
  1495. {
  1496. reason = $"Configuration does not contains step time config {dic["Time"]}";
  1497. return false;
  1498. }
  1499. }
  1500. else
  1501. {
  1502. if (DateTime.TryParse(dic["Time"], out DateTime time))
  1503. {
  1504. recipeStep.StepTime = time.Second + time.Minute * 60 + time.Hour * 3600 + time.Millisecond / 1000.0;
  1505. }
  1506. else if (float.TryParse(dic["Time"], out float timeInSec))
  1507. {
  1508. recipeStep.StepTime = timeInSec;
  1509. }
  1510. else
  1511. {
  1512. reason = $"Step time {dic["Time"]} is invalid";
  1513. return false;
  1514. }
  1515. }
  1516. if (dic["ConditionCheck"].ToLower() == "none")
  1517. {
  1518. recipeStep.EndBy = EnumEndByCondition.ByTime;
  1519. }
  1520. else
  1521. {
  1522. recipeStep.EndBy = EnumEndByCondition.ByStandbyFactor;
  1523. }
  1524. }
  1525. //ReplaceControlName(ref dic, "GasLineMFC1.Flow", "MFC1.SetParameters");
  1526. //ReplaceControlName(ref dic, "GasLineMFC2.Flow", "MFC2.SetParameters");
  1527. //ReplaceControlName(ref dic, "GasLineMFC3.Flow", "MFC3.SetParameters");
  1528. //ReplaceControlName(ref dic, "GasLineMFC4.Flow", "MFC4.SetParameters");
  1529. //ReplaceControlName(ref dic, "GasLineMFC5.Flow", "MFC5.SetParameters");
  1530. //ReplaceControlName(ref dic, "GasLineMFC6.Flow", "MFC6.SetParameters");
  1531. //ReplaceControlName(ref dic, "GasLineMFC7.Flow", "MFC7.SetParameters");
  1532. //ReplaceControlName(ref dic, "GasLineMFC8.Flow", "MFC8.SetParameters");
  1533. //ReplaceControlName(ref dic, "GasLineMFC9.Flow", "MFC9.SetParameters");
  1534. //ReplaceControlName(ref dic, "GasLineMFC10.Flow", "MFC10.SetParameters");
  1535. //ReplaceControlName(ref dic, "GasLineMFC11.Flow", "MFC11.SetParameters");
  1536. //ReplaceControlName(ref dic, "GasLineMFC12.Flow", "MFC12.SetParameters");
  1537. //ReplaceControlName(ref dic, "GasLineMFC51.Flow", "MFC51.SetParameters");
  1538. 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" });
  1539. 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" });
  1540. 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" });
  1541. 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" });
  1542. 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" });
  1543. 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" });
  1544. 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" });
  1545. 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" });
  1546. 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" });
  1547. 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" });
  1548. 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" });
  1549. 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" });
  1550. 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" });
  1551. 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" });
  1552. 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" });
  1553. 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" });
  1554. 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" });
  1555. 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" });
  1556. 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" });
  1557. //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" });
  1558. ReplaceControlName(ref dic, "MFM57Flow", "MFM57.SetParameters");
  1559. ReplaceControlName(ref dic, "MFM1Flow", "MFM1.SetParameters");
  1560. ReplaceControlName(ref dic, "MFM6Flow", "MFM6.SetParameters");
  1561. ReplaceControlName(ref dic, "MFM7Flow", "MFM7.SetParameters");
  1562. ReplaceControlName(ref dic, "MFM8Flow", "MFM8.SetParameters");
  1563. ReplaceControlName(ref dic, "MFM9Flow", "MFM9.SetParameters");
  1564. ReplaceControlName(ref dic, "MFM11Flow", "MFM11.SetParameters");
  1565. ReplaceControlName(ref dic, "MFM12Flow", "MFM12.SetParameters");
  1566. ReplaceControlName(ref dic, "MFM13Flow", "MFM13.SetParameters");
  1567. ReplaceControlName(ref dic, "MFM16Flow", "MFM16.SetParameters");
  1568. ReplaceControlName(ref dic, "ConditionCheck", "SetConditionCheck");
  1569. ReplaceControlName(ref dic, "Command", "SetCommand");
  1570. if (dic.ContainsKey("AlarmConditionTable"))
  1571. ReplaceControlName(ref dic, "AlarmConditionTable", "SetAlarmConditionTable");
  1572. //ReplaceControlName(ref dic, "Heater2", "ZoneU.SetParameters");
  1573. //ReplaceControlName(ref dic, "Heater4", "ZoneCU.SetParameters");
  1574. //ReplaceControlName(ref dic, "Heater6", "ZoneC.SetParameters");
  1575. //ReplaceControlName(ref dic, "Heater8", "ZoneCL.SetParameters");
  1576. //ReplaceControlName(ref dic, "Heater10", "ZoneL.SetParameters");
  1577. var controlMode = dic["Temperature.ControlMode"];
  1578. var correct = dic["Temperature.Correct"];
  1579. var PID = dic["Temperature.PID"];
  1580. //AddParameter(ref dic, "ZoneU.SetParameters", controlMode, correct, PID);
  1581. //AddParameter(ref dic, "ZoneCU.SetParameters", controlMode, correct, PID);
  1582. //AddParameter(ref dic, "ZoneC.SetParameters", controlMode, correct, PID);
  1583. //AddParameter(ref dic, "ZoneCL.SetParameters", controlMode, correct, PID);
  1584. //AddParameter(ref dic, "ZoneL.SetParameters", controlMode, correct, PID);
  1585. 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" });
  1586. AddParameterValue(ref dic, "HeaterU.SetParameters", new string[8] { controlMode, correct, PID, "", "", "", dic["ValveAV91"], dic["BWR"] });
  1587. 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" });
  1588. AddParameterValue(ref dic, "HeaterCU.SetParameters", new string[8] { controlMode, correct, PID, "", "", "", dic["ValveAV91"], dic["BWR"] });
  1589. 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" });
  1590. AddParameterValue(ref dic, "HeaterC.SetParameters", new string[8] { controlMode, correct, PID, "", "", "", dic["ValveAV91"], dic["BWR"] });
  1591. 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" });
  1592. AddParameterValue(ref dic, "HeaterCL.SetParameters", new string[8] { controlMode, correct, PID, "", "", "", dic["ValveAV91"], dic["BWR"] });
  1593. 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" });
  1594. AddParameterValue(ref dic, "HeaterL.SetParameters", new string[8] { controlMode, correct, PID, "", "", "", dic["ValveAV91"], dic["BWR"] });
  1595. 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
  1596. AddParameterValue(ref dic, "APC.SetParameters", new string[2] { "", dic["ValveAV71"] });//APC
  1597. AddParameter(ref dic, "SetBoatMotion", new string[5] { "Loader.Command", "Loader.Speed1", "Loader.Speed2", "Loader.Speed3", "Loader.RPM" });//Boat
  1598. List<string> auxCommands = new List<string>();
  1599. for (int k = 1; k < 200; k++)
  1600. {
  1601. if (!dic.ContainsKey($"AUX.{k}.Set"))
  1602. continue;
  1603. auxCommands.Add($"{k},{dic[$"AUX.{k}.Set"]},{dic[$"AUX.{k}.Check"]},{dic[$"AUX.{k}.High"]},{dic[$"AUX.{k}.Low"]},{dic[$"AUX.{k}.CheckUnit"]}");
  1604. dic.Remove($"AUX.{k}.Set");
  1605. dic.Remove($"AUX.{k}.Check");
  1606. dic.Remove($"AUX.{k}.High");
  1607. dic.Remove($"AUX.{k}.Low");
  1608. dic.Remove($"AUX.{k}.CheckUnit");
  1609. }
  1610. dic.Add("AUX.SetParameters", string.Join(";", auxCommands));
  1611. //ReplaceControlName(ref dic, "RFSwitch", "RfPower.SetParameters");
  1612. //AddParameter(ref dic, "RfPower.SetParameters", dic["RFSetpoint"], dic["ForwardPowerAlarmWatchTable"], dic["PrAlarmWatchTable"], dic["PIAlarmWatchTable"]);
  1613. //ReplaceControlName(ref dic, "C1Setpoint", "RfMatch.SetParameters");
  1614. //AddParameter(ref dic, "RfMatch.SetParameters", dic["C2Setpoint"], dic["C1AlarmWatchTable"], dic["C2AlarmWatchTable"], dic["VppAlarmWatchTable"]);
  1615. AddValveParameter(ref dic, "SetValves", new string[153] {
  1616. "ValveAV1",
  1617. "ValveAV2",
  1618. "ValveAV3",
  1619. "ValveAV4",
  1620. "ValveAV5",
  1621. "ValveAV6",
  1622. "ValveAV7",
  1623. "ValveAV8",
  1624. "ValveAV9",
  1625. "ValveAV10",
  1626. "ValveAV11",
  1627. "ValveAV12",
  1628. "ValveAV13",
  1629. "ValveAV14",
  1630. "ValveAV15",
  1631. "ValveAV16",
  1632. "ValveAV17",
  1633. "ValveAV18",
  1634. "ValveAV19",
  1635. "ValveAV20",
  1636. "ValveAV21",
  1637. "ValveAV22",
  1638. "ValveAV23",
  1639. "ValveAV24",
  1640. "ValveAV25",
  1641. "ValveAV26",
  1642. "ValveAV27",
  1643. "ValveAV28",
  1644. "ValveAV29",
  1645. "ValveAV30",
  1646. "ValveAV31",
  1647. "ValveAV32",
  1648. "ValveAV33",
  1649. "ValveAV34",
  1650. "ValveAV35",
  1651. "ValveAV36",
  1652. "ValveAV37",
  1653. "ValveAV38",
  1654. "ValveAV39",
  1655. "ValveAV40",
  1656. "ValveAV41",
  1657. "ValveAV42",
  1658. "ValveAV43",
  1659. "ValveAV44",
  1660. "ValveAV45",
  1661. "ValveAV46",
  1662. "ValveAV47",
  1663. "ValveAV48",
  1664. "ValveAV49",
  1665. "ValveAV50",
  1666. "ValveAV51",
  1667. "ValveAV52",
  1668. "ValveAV53",
  1669. "ValveAV60",
  1670. "ValveAV61",
  1671. "ValveAV62",
  1672. "ValveAV63",
  1673. "ValveAV64",
  1674. "ValveAV65",
  1675. "ValveAV66",
  1676. "ValveAV67",
  1677. "ValveAV68",
  1678. "ValveAV69",
  1679. "ValveAV70",
  1680. "ValveAV71",
  1681. "ValveAV72",
  1682. "ValveAV73",
  1683. "ValveAV74",
  1684. "ValveAV75",
  1685. "ValveAV76",
  1686. "ValveAV77",
  1687. "ValveAV78",
  1688. "ValveAV79",
  1689. "ValveAV80",
  1690. "ValveAV81",
  1691. "ValveAV82",
  1692. "ValveAV83",
  1693. "ValveAV84",
  1694. "ValveAV85",
  1695. "ValveAV86",
  1696. "ValveAV87",
  1697. "ValveAV88",
  1698. "ValveAV89",
  1699. "ValveAV90",
  1700. "ValveAV91",
  1701. "ValveAV92",
  1702. "ValveAV93",
  1703. "ValveAV94",
  1704. "ValveAV95",
  1705. "ValveAV96",
  1706. "ValveAV97",
  1707. "ValveAV98",
  1708. "ValveAV99",
  1709. "ValveAV100",
  1710. "ValveAV101",
  1711. "ValveAV102",
  1712. "ValveAV103",
  1713. "ValveAV104",
  1714. "ValveAV105",
  1715. "ValveAV106",
  1716. "ValveAV107",
  1717. "ValveAV108",
  1718. "ValveAV109",
  1719. "ValveAV110",
  1720. "ValveAV111",
  1721. "ValveAV112",
  1722. "ValveAV113",
  1723. "ValveAV114",
  1724. "ValveAV115",
  1725. "ValveAV116",
  1726. "ValveAV117",
  1727. "ValveAV118",
  1728. "ValveAV119",
  1729. "ValveAV120",
  1730. "ValveAV121",
  1731. "ValveAV122",
  1732. "ValveAV123",
  1733. "ValveAV124",
  1734. "ValveAV125",
  1735. "ValveAV126",
  1736. "ValveAV127",
  1737. "ValveAV128",
  1738. "ValveAV129",
  1739. "ValveAV130",
  1740. "ValveAV131",
  1741. "ValveAV132",
  1742. "ValveAV133",
  1743. "ValveAV134",
  1744. "ValveAV135",
  1745. "ValveAV136",
  1746. "DPR",
  1747. "AGV",
  1748. "AGV2",
  1749. "MBP",
  1750. "MBP1",
  1751. "MBP2",
  1752. "DP",
  1753. "BWR",
  1754. "F2Cln",
  1755. "HFCln",
  1756. "CEXH",
  1757. "DEPO",
  1758. "HTR1",
  1759. "HTR2",
  1760. "HTR3",
  1761. "DP1",
  1762. "DP2",
  1763. "HMNT",
  1764. "CMNT",
  1765. "HREF",
  1766. "CREF",
  1767. "HZERO",
  1768. "CZERO"
  1769. });
  1770. //dic.Remove("SetValves");
  1771. //dic.Remove("HeaterU.SetParameters");
  1772. //dic.Remove("HeaterCU.SetParameters");
  1773. //dic.Remove("HeaterC.SetParameters");
  1774. //dic.Remove("HeaterCL.SetParameters");
  1775. //dic.Remove("HeaterL.SetParameters");
  1776. //dic.Remove("MFC1.SetParameters");
  1777. //dic.Remove("MFC2.SetParameters");
  1778. //dic.Remove("MFC3.SetParameters");
  1779. //dic.Remove("MFC4.SetParameters");
  1780. //dic.Remove("MFC5.SetParameters");
  1781. //dic.Remove("MFC6.SetParameters");
  1782. //dic.Remove("MFC7.SetParameters");
  1783. //dic.Remove("MFC8.SetParameters");
  1784. //dic.Remove("MFC9.SetParameters");
  1785. //dic.Remove("MFC10.SetParameters");
  1786. //dic.Remove("MFC11.SetParameters");
  1787. //dic.Remove("MFC12.SetParameters");
  1788. //ReplaceControlNameForValve(ref dic, "ValveAV1");
  1789. //ReplaceControlNameForValve(ref dic, "ValveAV2");
  1790. //ReplaceControlNameForValve(ref dic, "ValveAV3");
  1791. //ReplaceControlNameForValve(ref dic, "ValveAV4");
  1792. //ReplaceControlNameForValve(ref dic, "ValveAV5");
  1793. //ReplaceControlNameForValve(ref dic, "ValveAV6");
  1794. //ReplaceControlNameForValve(ref dic, "ValveAV7");
  1795. //ReplaceControlNameForValve(ref dic, "ValveAV8");
  1796. //ReplaceControlNameForValve(ref dic, "ValveAV9");
  1797. //ReplaceControlNameForValve(ref dic, "ValveAV10");
  1798. //ReplaceControlNameForValve(ref dic, "ValveAV11");
  1799. //ReplaceControlNameForValve(ref dic, "ValveAV12");
  1800. //ReplaceControlNameForValve(ref dic, "ValveAV13");
  1801. //ReplaceControlNameForValve(ref dic, "ValveAV14");
  1802. //ReplaceControlNameForValve(ref dic, "ValveAV15");
  1803. //ReplaceControlNameForValve(ref dic, "ValveAV16");
  1804. //ReplaceControlNameForValve(ref dic, "ValveAV17");
  1805. //ReplaceControlNameForValve(ref dic, "ValveAV18");
  1806. //ReplaceControlNameForValve(ref dic, "ValveAV19");
  1807. //ReplaceControlNameForValve(ref dic, "ValveAV20");
  1808. //ReplaceControlNameForValve(ref dic, "ValveAV21");
  1809. //ReplaceControlNameForValve(ref dic, "ValveAV22");
  1810. //ReplaceControlNameForValve(ref dic, "ValveAV23");
  1811. //ReplaceControlNameForValve(ref dic, "ValveAV24");
  1812. //ReplaceControlNameForValve(ref dic, "ValveAV25");
  1813. //ReplaceControlNameForValve(ref dic, "ValveAV26");
  1814. //ReplaceControlNameForValve(ref dic, "ValveAV27");
  1815. //ReplaceControlNameForValve(ref dic, "ValveAV28");
  1816. //ReplaceControlNameForValve(ref dic, "ValveAV29");
  1817. //ReplaceControlNameForValve(ref dic, "ValveAV30");
  1818. //ReplaceControlNameForValve(ref dic, "ValveAV31");
  1819. //ReplaceControlNameForValve(ref dic, "ValveAV32");
  1820. //ReplaceControlNameForValve(ref dic, "ValveAV33");
  1821. //ReplaceControlNameForValve(ref dic, "ValveAV34");
  1822. //ReplaceControlNameForValve(ref dic, "ValveAV35");
  1823. //ReplaceControlNameForValve(ref dic, "ValveAV36");
  1824. //ReplaceControlNameForValve(ref dic, "ValveAV37");
  1825. //ReplaceControlNameForValve(ref dic, "ValveAV38");
  1826. //ReplaceControlNameForValve(ref dic, "ValveAV39");
  1827. //ReplaceControlNameForValve(ref dic, "ValveAV52");
  1828. ////ReplaceControlNameForValve(ref dic, "ValveAV54");
  1829. ////ReplaceControlNameForValve(ref dic, "ValveAV56");
  1830. ////ReplaceControlNameForValve(ref dic, "ValveAV57");
  1831. ////ReplaceControlNameForValve(ref dic, "ValveAV58");
  1832. ////ReplaceControlNameForValve(ref dic, "ValveAV59");
  1833. //ReplaceControlNameForValve(ref dic, "ValveAV60");
  1834. ////ReplaceControlNameForValve(ref dic, "ValveAV65");
  1835. ////ReplaceControlNameForValve(ref dic, "ValveAV66");
  1836. ////ReplaceControlNameForValve(ref dic, "ValveAV68");
  1837. //ReplaceControlNameForValve(ref dic, "ValveAV71");
  1838. //ReplaceControlNameForValve(ref dic, "ValveAV72");
  1839. //ReplaceControlNameForValve(ref dic, "ValveAV73");
  1840. //ReplaceControlNameForValve(ref dic, "ValveAV74");
  1841. //ReplaceControlNameForValve(ref dic, "ValveAV75");
  1842. //ReplaceControlNameForValve(ref dic, "ValveAV77");
  1843. //ReplaceControlNameForValve(ref dic, "ValveAV81");
  1844. //ReplaceControlNameForValve(ref dic, "ValveAV82");
  1845. //ReplaceControlNameForValve(ref dic, "ValveAV83");
  1846. //ReplaceControlNameForValve(ref dic, "ValveAV91");
  1847. dic.Remove("StepNo");
  1848. dic.Remove("Name");
  1849. dic.Remove("EndBy");
  1850. dic.Remove("Time");
  1851. dic.Remove("ZAxisPosition");
  1852. dic.Remove("ZAxisSpeed");
  1853. dic.Remove("RotatePosition");
  1854. dic.Remove("RotateSpeed");
  1855. dic.Remove("RotateDirection");
  1856. dic.Remove("Heater1");
  1857. dic.Remove("Heater2");
  1858. dic.Remove("Heater3");
  1859. dic.Remove("Heater4");
  1860. dic.Remove("Heater5");
  1861. dic.Remove("ValveAV54");
  1862. dic.Remove("ValveAV55");
  1863. dic.Remove("ValveAV56");
  1864. dic.Remove("ValveAV57");
  1865. dic.Remove("ValveAV58");
  1866. dic.Remove("ValveAV59");
  1867. dic.Remove("ValveAV65");
  1868. dic.Remove("ValveAV66");
  1869. dic.Remove("ValveAV68");
  1870. dic.Remove("ExternalOn");
  1871. dic.Remove("ExternalOff");
  1872. dic.Remove("ExternalSensor");
  1873. dic.Remove("TempStabilize");
  1874. dic.Remove("FinishAutoProfile");
  1875. dic.Remove("ReachTempWait");
  1876. dic.Remove("ReachTemp");
  1877. dic.Remove("TempUpper");
  1878. dic.Remove("TempLower");
  1879. dic.Remove("ReachPressureWait");
  1880. dic.Remove("ReachPressure");
  1881. dic.Remove("PressureUpper");
  1882. dic.Remove("PressureLower");
  1883. dic.Remove("PressureStabilize");
  1884. dic.Remove("External.Out1");
  1885. dic.Remove("External.Out2");
  1886. dic.Remove("External.Out3");
  1887. dic.Remove("External.Out4");
  1888. dic.Remove("External.Out5");
  1889. dic.Remove("External.Out6");
  1890. dic.Remove("RFSwitch");
  1891. dic.Remove("RFSetpoint");
  1892. dic.Remove("ForwardPowerAlarmWatchTable");
  1893. dic.Remove("PrAlarmWatchTable");
  1894. dic.Remove("PIAlarmWatchTable");
  1895. dic.Remove("C1Setpoint");
  1896. dic.Remove("C2Setpoint");
  1897. dic.Remove("C1AlarmWatchTable");
  1898. dic.Remove("C2AlarmWatchTable");
  1899. dic.Remove("VppAlarmWatchTable");
  1900. dic.Remove("VdcAlarmWatchTable");
  1901. dic.Remove("AbortRecipeTableIndex");
  1902. dic.Remove("Temperature.ControlMode");
  1903. dic.Remove("Temperature.Correct");
  1904. dic.Remove("Temperature.PID");
  1905. dic.Remove("Temperature.Profile");
  1906. dic.Remove("Temperature.Stabilize");
  1907. dic.Remove("Temperature.TempReadyCond");
  1908. dic.Remove("FilmThickFormula");
  1909. dic.Remove("FilmThickCoefficientA");
  1910. dic.Remove("FilmThickCoefficientB");
  1911. dic.Remove("APC.SetPressure");
  1912. dic.Remove("PressureSettingVG");
  1913. dic.Remove("PressureSonserValue");
  1914. dic.Remove("PressureValveAngle");
  1915. dic.Remove("PressureAlarmTableNo");
  1916. dic.Remove("EventSetting");
  1917. dic.Remove("AlarmTableIndex");
  1918. dic.Remove("AlarmDetails.1");
  1919. dic.Remove("AlarmAction.1");
  1920. dic.Remove("AlarmDetails.2");
  1921. dic.Remove("AlarmAction.2");
  1922. dic.Remove("AlarmDetails.3");
  1923. dic.Remove("AlarmAction.3");
  1924. dic.Remove("AlarmDetails.4");
  1925. dic.Remove("AlarmAction.4");
  1926. dic.Remove("AlarmDetails.5");
  1927. dic.Remove("AlarmAction.5");
  1928. dic.Remove("AlarmDetails.6");
  1929. dic.Remove("AlarmAction.6");
  1930. dic.Remove("AlarmDetails.7");
  1931. dic.Remove("AlarmAction.7");
  1932. dic.Remove("AlarmDetails.8");
  1933. dic.Remove("AlarmAction.8");
  1934. dic.Remove("AlarmDetails.9");
  1935. dic.Remove("AlarmAction.9");
  1936. dic.Remove("AlarmDetails.10");
  1937. dic.Remove("AlarmAction.10");
  1938. //List<string> mfcCheckInstall = new List<string>()
  1939. //{
  1940. // "MfcN1",
  1941. // "MfcN2",
  1942. // "MfcN3",
  1943. // "MfcH1",
  1944. // "MfcJ1",
  1945. // "MfcXN1",
  1946. //};
  1947. //foreach(var mfc in mfcCheckInstall)
  1948. //{
  1949. // if (!SC.GetValue<bool>($"PM1.MFC.{mfc}.IsMFCInstalled"))
  1950. // dic.Remove($"{mfc}.SetParameters");
  1951. //}
  1952. foreach (string key in dic.Keys)
  1953. recipeStep.RecipeCommands.Add(key, dic[key]);
  1954. }
  1955. for (int i = 0; i < recipeData.Count; i++)
  1956. {
  1957. if (recipeData[i].IsJumpStep)
  1958. {
  1959. bool findJumpStep = false;
  1960. for (int j = 0; j < recipeData.Count; j++)
  1961. {
  1962. if (recipeData[j].StepName == recipeData[i].JumpStepName)
  1963. {
  1964. recipeData[i].JumpStepNo = j;
  1965. findJumpStep = true;
  1966. break;
  1967. }
  1968. }
  1969. if (!findJumpStep)
  1970. {
  1971. reason = $"Recipe file does not contains jump step {recipeData[i].JumpStepName}";
  1972. return false;
  1973. }
  1974. }
  1975. }
  1976. #endregion
  1977. recipeDatas.Add(x + 1, recipeData);
  1978. }
  1979. }
  1980. catch (Exception ex)
  1981. {
  1982. LOG.Write(ex);
  1983. reason = $"Recipe file content not valid, {recipeFile}, {ex.Message}";
  1984. return false;
  1985. }
  1986. return true;
  1987. }
  1988. }
  1989. }