RecipeParser.cs 65 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216
  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. namespace FurnaceRT.Equipments.PMs.RecipeExecutions
  13. {
  14. public class RecipeParser
  15. {
  16. 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)
  17. {
  18. reason = string.Empty;
  19. if (mainHead != null)
  20. recipeHead = mainHead;
  21. else
  22. recipeHead = new RecipeHead();
  23. recipeData = new List<RecipeStep>();
  24. string content = string.Empty;
  25. if (recipeType != "Process" && recipeType != "Idle" && recipeType != "Reset")
  26. {
  27. if (!File.Exists($"{PathManager.GetRecipeDir()}\\{SC.GetStringValue("System.Recipe.SupportedChamberType")}\\{SC.GetStringValue($"System.Recipe.Supported{recipeType}Type")}\\{recipeFile}.rcp"))
  28. return true;
  29. }
  30. content = RecipeFileManager.Instance.LoadRecipe($"{SC.GetStringValue("System.Recipe.SupportedChamberType")}\\{SC.GetStringValue($"System.Recipe.Supported{recipeType}Type")}", recipeFile, false);
  31. if (string.IsNullOrEmpty(content))
  32. {
  33. reason = $"{recipeFile} is not a valid recipe file";
  34. return false;
  35. }
  36. try
  37. {
  38. //获取工艺程序文件中允许的命令字符串列表
  39. //目的:如果工艺程序文件中含有规定之外的命令,则被禁止执行
  40. HashSet<string> recipeAllowedCommands = new HashSet<string>();
  41. XmlDocument rcpFormatDoc = new XmlDocument();
  42. string recipeSchema = PathManager.GetCfgDir() + $@"\Recipe\Furnace\Process\{SC.GetStringValue("System.SetUp.ToolType")}\RecipeFormat.xml";
  43. rcpFormatDoc.Load(recipeSchema);
  44. XmlNodeList rcpItemNodeList = rcpFormatDoc.SelectNodes("/Aitex/TableRecipeFormat/Catalog/Group/Step");
  45. foreach (XmlElement item in rcpItemNodeList)
  46. recipeAllowedCommands.Add(item.Attributes["ControlName"].Value);
  47. recipeAllowedCommands.Add("Temperature.ControlMode");
  48. recipeAllowedCommands.Add("Temperature.Correct");
  49. recipeAllowedCommands.Add("Temperature.PID");
  50. recipeAllowedCommands.Add("ConditionCheck");
  51. recipeAllowedCommands.Add("EventSetting");
  52. recipeAllowedCommands.Add("FilmThickFormula");
  53. recipeAllowedCommands.Add("FilmThickCoefficientA");
  54. recipeAllowedCommands.Add("FilmThickCoefficientB");
  55. recipeAllowedCommands.Add("AlarmTableIndex");
  56. recipeAllowedCommands.Add("RFSwitch");
  57. recipeAllowedCommands.Add("RFSetpoint");
  58. recipeAllowedCommands.Add("ForwardPowerAlarmWatchTable");
  59. recipeAllowedCommands.Add("PrAlarmWatchTable");
  60. recipeAllowedCommands.Add("PIAlarmWatchTable");
  61. recipeAllowedCommands.Add("C1Setpoint");
  62. recipeAllowedCommands.Add("C2Setpoint");
  63. recipeAllowedCommands.Add("C1AlarmWatchTable");
  64. recipeAllowedCommands.Add("C2AlarmWatchTable");
  65. recipeAllowedCommands.Add("VppAlarmWatchTable");
  66. recipeAllowedCommands.Add("VdcAlarmWatchTable");
  67. recipeAllowedCommands.Add("PressureSonserValue");
  68. recipeAllowedCommands.Add("PressureValveAngle");
  69. recipeAllowedCommands.Add("PressureSettingVG");
  70. recipeAllowedCommands.Add("PressCommand");
  71. recipeAllowedCommands.Add("PressValue");
  72. recipeAllowedCommands.Add("PressureAlarmTableNo");
  73. recipeAllowedCommands.Add("AbortRecipeTableIndex");
  74. recipeAllowedCommands.Add("AlarmConditionTable");
  75. recipeAllowedCommands.Add("LoaderCommand");
  76. recipeAllowedCommands.Add("LoaderValue");
  77. for (int i = 1; i < 11; i++)
  78. {
  79. recipeAllowedCommands.Add($"AlarmAction.{i}");
  80. recipeAllowedCommands.Add($"AlarmDetails.{i}");
  81. }
  82. for (int i = 1; i < 60; i++)
  83. {
  84. recipeAllowedCommands.Add($"MFC{i}.Flow.Set");
  85. recipeAllowedCommands.Add($"MFC{i}.Flow.SetUnit");
  86. recipeAllowedCommands.Add($"MFC{i}.Flow.Ramprate");
  87. recipeAllowedCommands.Add($"MFC{i}.Flow.RamprateUnit");
  88. recipeAllowedCommands.Add($"MFC{i}.Flow.Check");
  89. recipeAllowedCommands.Add($"MFC{i}.Flow.High");
  90. recipeAllowedCommands.Add($"MFC{i}.Flow.Low");
  91. recipeAllowedCommands.Add($"MFC{i}.Flow.Unit");
  92. }
  93. for (int i = 1; i < 200; i++)
  94. {
  95. recipeAllowedCommands.Add($"AUX.{i}.Set");
  96. recipeAllowedCommands.Add($"AUX.{i}.Check");
  97. recipeAllowedCommands.Add($"AUX.{i}.High");
  98. recipeAllowedCommands.Add($"AUX.{i}.Low");
  99. recipeAllowedCommands.Add($"AUX.{i}.CheckUnit");
  100. }
  101. recipeAllowedCommands.Add("HeaterU.ZoneName");
  102. recipeAllowedCommands.Add("HeaterU.Set");
  103. recipeAllowedCommands.Add("HeaterU.SetUnit");
  104. recipeAllowedCommands.Add("HeaterU.Ramprate");
  105. recipeAllowedCommands.Add("HeaterU.RamprateUnit");
  106. recipeAllowedCommands.Add("HeaterU.Check");
  107. recipeAllowedCommands.Add("HeaterU.High");
  108. recipeAllowedCommands.Add("HeaterU.Low");
  109. recipeAllowedCommands.Add("HeaterU.Unit");
  110. recipeAllowedCommands.Add("HeaterCU.ZoneName");
  111. recipeAllowedCommands.Add("HeaterCU.Set");
  112. recipeAllowedCommands.Add("HeaterCU.SetUnit");
  113. recipeAllowedCommands.Add("HeaterCU.Ramprate");
  114. recipeAllowedCommands.Add("HeaterCU.RamprateUnit");
  115. recipeAllowedCommands.Add("HeaterCU.Check");
  116. recipeAllowedCommands.Add("HeaterCU.High");
  117. recipeAllowedCommands.Add("HeaterCU.Low");
  118. recipeAllowedCommands.Add("HeaterCU.Unit");
  119. recipeAllowedCommands.Add("HeaterC.ZoneName");
  120. recipeAllowedCommands.Add("HeaterC.Set");
  121. recipeAllowedCommands.Add("HeaterC.SetUnit");
  122. recipeAllowedCommands.Add("HeaterC.Ramprate");
  123. recipeAllowedCommands.Add("HeaterC.RamprateUnit");
  124. recipeAllowedCommands.Add("HeaterC.Check");
  125. recipeAllowedCommands.Add("HeaterC.High");
  126. recipeAllowedCommands.Add("HeaterC.Low");
  127. recipeAllowedCommands.Add("HeaterC.Unit");
  128. recipeAllowedCommands.Add("HeaterCL.ZoneName");
  129. recipeAllowedCommands.Add("HeaterCL.Set");
  130. recipeAllowedCommands.Add("HeaterCL.SetUnit");
  131. recipeAllowedCommands.Add("HeaterCL.Ramprate");
  132. recipeAllowedCommands.Add("HeaterCL.RamprateUnit");
  133. recipeAllowedCommands.Add("HeaterCL.Check");
  134. recipeAllowedCommands.Add("HeaterCL.High");
  135. recipeAllowedCommands.Add("HeaterCL.Low");
  136. recipeAllowedCommands.Add("HeaterCL.Unit");
  137. recipeAllowedCommands.Add("HeaterL.ZoneName");
  138. recipeAllowedCommands.Add("HeaterL.Set");
  139. recipeAllowedCommands.Add("HeaterL.SetUnit");
  140. recipeAllowedCommands.Add("HeaterL.Ramprate");
  141. recipeAllowedCommands.Add("HeaterL.RamprateUnit");
  142. recipeAllowedCommands.Add("HeaterL.Check");
  143. recipeAllowedCommands.Add("HeaterL.High");
  144. recipeAllowedCommands.Add("HeaterL.Low");
  145. recipeAllowedCommands.Add("HeaterL.Unit");
  146. recipeAllowedCommands.Add("Loader.Command");
  147. recipeAllowedCommands.Add("Loader.Speed1");
  148. recipeAllowedCommands.Add("Loader.Speed2");
  149. recipeAllowedCommands.Add("Loader.Speed3");
  150. recipeAllowedCommands.Add("Loader.RPM");
  151. recipeAllowedCommands.Add("Press.Command");
  152. recipeAllowedCommands.Add("Press.PID");
  153. recipeAllowedCommands.Add("Press.Set");
  154. recipeAllowedCommands.Add("Press.SlowVacSet");
  155. recipeAllowedCommands.Add("Press.ValveAngleSet");
  156. recipeAllowedCommands.Add("Press.IsWait");
  157. recipeAllowedCommands.Add("Press.LowWait");
  158. recipeAllowedCommands.Add("Press.HighWait");
  159. recipeAllowedCommands.Add("Press.WaitUnit");
  160. recipeAllowedCommands.Add("Press.WaitPress");
  161. //获取工艺程序文件中所有步的内容
  162. XmlDocument rcpDataDoc = new XmlDocument();
  163. rcpDataDoc.LoadXml(content);
  164. XmlNode nodeModule = null;
  165. if (recipeType == "Process" || recipeType == "Idle" || recipeType == "Reset")
  166. nodeModule = rcpDataDoc.SelectSingleNode($"/Aitex/TableRecipeData/Module[@Name='{module}']");
  167. else
  168. nodeModule = rcpDataDoc.SelectSingleNode($"/Aitex/TableRecipeData/Tables/Table[@Index='{tableID}']");
  169. if (nodeModule == null)
  170. {
  171. reason = $"Recipe file does not contains step content for {module}";
  172. return false;
  173. }
  174. XmlElement nodeConfig = nodeModule.SelectSingleNode($"Config") as XmlElement;
  175. if (nodeConfig != null)
  176. {
  177. if (mainHead == null)
  178. {
  179. recipeHead.SubRecipe = nodeConfig.HasAttribute("Combination.SubRecipe") ? nodeConfig.Attributes["Combination.SubRecipe"].Value : "";
  180. recipeHead.AlarmRecipe = nodeConfig.HasAttribute("Combination.AlarmRecipe") ? nodeConfig.Attributes["Combination.AlarmRecipe"].Value : "";
  181. recipeHead.AlarmCondition = nodeConfig.HasAttribute("Combination.AlarmCondition") ? nodeConfig.Attributes["Combination.AlarmCondition"].Value : "";
  182. recipeHead.LeakCheck = nodeConfig.HasAttribute("Combination.LeakCheck") ? nodeConfig.Attributes["Combination.LeakCheck"].Value : "";
  183. recipeHead.AbortRecipe = nodeConfig.HasAttribute("Combination.AbortRecipe") ? nodeConfig.Attributes["Combination.AbortRecipe"].Value : "";
  184. recipeHead.PressApcPID = nodeConfig.HasAttribute("Combination.PressAPCPID") ? nodeConfig.Attributes["Combination.PressAPCPID"].Value : "";
  185. recipeHead.TempCorrect = nodeConfig.HasAttribute("Combination.TempCorrection") ? nodeConfig.Attributes["Combination.TempCorrection"].Value : "";
  186. recipeHead.TempPID = nodeConfig.HasAttribute("Combination.TempPID") ? nodeConfig.Attributes["Combination.TempPID"].Value : "";
  187. recipeHead.ProfileCondition = nodeConfig.HasAttribute("Combination.ProfileCondition") ? nodeConfig.Attributes["Combination.ProfileCondition"].Value : "";
  188. if(nodeConfig.HasAttribute("N2PurgeMode"))
  189. {
  190. recipeHead.IsN2PurgeMode = nodeConfig.Attributes["N2PurgeMode"].Value.Replace(" ", "").ToLower() == "n2purge";
  191. }
  192. else
  193. {
  194. recipeHead.IsN2PurgeMode = false;
  195. }
  196. if (string.IsNullOrEmpty(recipeHead.AbortRecipe))
  197. recipeHead.AbortRecipe = SC.GetStringValue("System.Recipe.Abort Recipe");
  198. }
  199. }
  200. else
  201. {
  202. if (mainHead == null)
  203. {
  204. recipeHead.SubRecipe = "";
  205. recipeHead.AlarmRecipe = "";
  206. recipeHead.AlarmCondition = "";
  207. recipeHead.LeakCheck = "";
  208. recipeHead.AbortRecipe = "";
  209. recipeHead.PressApcPID = "";
  210. recipeHead.TempCorrect = "";
  211. recipeHead.TempPID = "";
  212. recipeHead.ProfileCondition = "";
  213. if (recipeType == "Sub")
  214. recipeHead.AbortRecipe = SC.GetStringValue("System.Recipe.Abort Recipe");
  215. }
  216. }
  217. XmlNodeList stepNodeList = nodeModule.SelectNodes($"Step");
  218. string strLoopEndStep, strJumpStep;
  219. strLoopEndStep = strJumpStep = string.Empty;
  220. for (int i = 0; i < stepNodeList.Count; i++)
  221. {
  222. var recipeStep = new RecipeStep();
  223. recipeStep.RecipeType = recipeType;
  224. recipeData.Add(recipeStep);
  225. XmlElement stepNode = stepNodeList[i] as XmlElement;
  226. Dictionary<string, string> dic = new Dictionary<string, string>();
  227. //遍历Step节点
  228. foreach (XmlAttribute att in stepNode.Attributes)
  229. {
  230. if (recipeAllowedCommands.Contains(att.Name))
  231. {
  232. dic.Add(att.Name, att.Value);
  233. }
  234. }
  235. //遍历Step子节点中所有的attribute属性节点
  236. foreach (XmlElement subStepNode in stepNode.ChildNodes)
  237. {
  238. foreach (XmlAttribute att in subStepNode.Attributes)
  239. {
  240. if (recipeAllowedCommands.Contains(att.Name))
  241. {
  242. dic.Add(att.Name, att.Value);
  243. }
  244. }
  245. //遍历Step子节点的子节点中所有的attribute属性节点
  246. foreach (XmlElement subsubStepNode in subStepNode.ChildNodes)
  247. {
  248. foreach (XmlAttribute att in subsubStepNode.Attributes)
  249. {
  250. if (recipeAllowedCommands.Contains(att.Name))
  251. {
  252. dic.Add(att.Name, att.Value);
  253. }
  254. }
  255. }
  256. }
  257. recipeStep.StepName = dic["Name"];
  258. if (dic["Name"] == strLoopEndStep)
  259. {
  260. recipeStep.IsLoopEndStep = true;
  261. strLoopEndStep = string.Empty;
  262. }
  263. recipeStep.IsJumpStep = false;
  264. if (dic.ContainsKey("Command"))
  265. {
  266. string commandStr = dic["Command"];
  267. if (commandStr.Contains("CallSystemRecipe"))
  268. {
  269. }
  270. else if (commandStr.ToUpper().StartsWith("CALL"))
  271. {
  272. int subTableID = 0;
  273. var subPara = commandStr.Replace("CALL", "").Replace("[", "").Replace("]", "").Split('*');
  274. if (subPara != null && subPara.Length > 1)
  275. {
  276. int.TryParse(subPara[0], out int loopCount);
  277. var tablePara = subPara[1].Split(':');
  278. if (tablePara != null && tablePara.Length > 1)
  279. {
  280. int.TryParse(tablePara[0], out subTableID);
  281. if (subTableID > 0)
  282. {
  283. recipeStep.IsCallSubStep = true;
  284. recipeStep.SubRecipeLoopCount = loopCount;
  285. }
  286. }
  287. recipeStep.SubRecipeTableInfo = subPara[1];
  288. }
  289. //sub需要修改table id
  290. List<RecipeStep> subRecipeData = null;
  291. if (recipeStep.IsCallSubStep && !Parse(recipeHead.SubRecipe, module, out var head, out subRecipeData, out reason, "Sub", subTableID, recipeHead))
  292. {
  293. return false;
  294. }
  295. if (subRecipeData == null || subRecipeData.Count == 0)
  296. {
  297. reason = $"Sub Recipe {commandStr.Replace("CallSubRecipe:", string.Empty)} is empty";
  298. return false;
  299. }
  300. recipeStep.SubRecipeSteps = subRecipeData;
  301. }
  302. else if (commandStr.ToUpper().StartsWith("LOOP"))
  303. {
  304. recipeStep.IsLoopEndStep = true;
  305. var loopPara = commandStr.Replace("LOOP", "").Replace("[", "").Replace("]", "").Split('*');
  306. if (loopPara != null && loopPara.Length > 1)
  307. {
  308. int.TryParse(loopPara[0], out int loopCount);
  309. recipeStep.LoopCount = loopCount + 1;//加1是因为第一次从正常的start-》end的执行算是一次循环,所以要额外加1
  310. int loopStartStep = -1;
  311. for (int index = 0; index < recipeData.Count; index++)
  312. {
  313. if (recipeData[index].StepName == loopPara[1])
  314. {
  315. loopStartStep = index;
  316. break;
  317. }
  318. }
  319. if (loopStartStep < 0)
  320. {
  321. reason = $"Recipe file does not contains LOOP step {loopPara[1]}";
  322. return false;
  323. }
  324. if (loopPara[1] != null)
  325. {
  326. if (loopStartStep < 0 ||
  327. (recipeType == "Process" && loopStartStep == 0))//Process recipe的standby不参与循环
  328. recipeStep.IsLoopEndStep = false;
  329. else
  330. {
  331. recipeStep.LoopStartStep = loopStartStep;
  332. if (recipeData.Count > loopStartStep)
  333. {
  334. recipeData[loopStartStep].IsLoopStartStep = true;
  335. recipeData[loopStartStep].LoopCount = loopCount + 1;
  336. recipeStep.LoopEndStep = recipeType == "Process" ? i + 1 : i;//Process recipe包含standby,从0开始;其他recipe不包含standby
  337. }
  338. }
  339. }
  340. }
  341. }
  342. else if (commandStr.ToUpper().StartsWith("JUMP"))
  343. {
  344. var jumpPara = commandStr.Replace("Jump:", string.Empty).Replace("[", "").Replace("]", "");//JumpStepNo
  345. if (jumpPara != null)
  346. {
  347. //int.TryParse(jumpPara[0], out int jumpStepNo);
  348. //recipeStep.JumpStepNo = recipeType == "Process" ? jumpStepNo : jumpStepNo - 1;//Process recipe包含standby,从0开始;其他recipe不包含standby
  349. recipeStep.IsJumpStep = true;
  350. recipeStep.JumpStepName = jumpPara;
  351. }
  352. }
  353. }
  354. if (dic.ContainsKey("AbortRecipeTableIndex"))
  355. {
  356. if (dic["AbortRecipeTableIndex"].ToLower() != "none")
  357. {
  358. //格式 1:name
  359. var abortPara = dic["AbortRecipeTableIndex"].Split(':');
  360. int abortTableID = 0;
  361. if (abortPara.Length > 1)
  362. {
  363. int.TryParse(abortPara[0], out abortTableID);
  364. List<RecipeStep> abortRecipeData = null;
  365. if (!Parse(recipeHead.AbortRecipe, module, out var head, out abortRecipeData, out reason, "Abort", abortTableID))
  366. {
  367. return false;
  368. }
  369. if (abortRecipeData == null || abortRecipeData.Count == 0)
  370. {
  371. reason = $"Abort Recipe {recipeHead.AbortRecipe}--{dic["AbortRecipeTableIndex"]} is empty";
  372. return false;
  373. }
  374. recipeStep.AbortRecipeSteps = abortRecipeData;
  375. recipeStep.AbortRecipeTableInfo = dic["AbortRecipeTableIndex"];
  376. }
  377. }
  378. else
  379. {
  380. recipeStep.AbortRecipeSteps = null;
  381. }
  382. }
  383. if (dic.ContainsKey("EventSetting"))
  384. {
  385. string eventSettingStr = dic["EventSetting"];
  386. if (eventSettingStr.ToLower() == "start")
  387. {
  388. recipeStep.IsTimeMeasurementStartStep = true;
  389. }
  390. else if (eventSettingStr.ToLower() == "stop")
  391. {
  392. recipeStep.IsTimeMeasurementStopStep = true;
  393. }
  394. }
  395. if (dic.ContainsKey("FilmThickFormula"))
  396. {
  397. recipeStep.FilmThickFormula = dic["FilmThickFormula"];
  398. }
  399. if (dic.ContainsKey("FilmThickCoefficientA"))
  400. {
  401. recipeStep.FilmThickCoefficientA = float.Parse(dic["FilmThickCoefficientA"]);
  402. }
  403. if (dic.ContainsKey("FilmThickCoefficientB"))
  404. {
  405. recipeStep.FilmThickCoefficientB = float.Parse(dic["FilmThickCoefficientB"]);
  406. }
  407. if (dic.ContainsKey("AlarmConditionTable"))
  408. {
  409. recipeStep.AlarmConditionTable = dic["AlarmConditionTable"];
  410. }
  411. for (int j = 1; j < 11; j++)
  412. {
  413. string tempType = "Ignore Alarm";
  414. string tempDetails = "";
  415. if (dic.ContainsKey($"AlarmAction.{j}"))
  416. {
  417. tempType = dic[$"AlarmAction.{j}"];
  418. }
  419. if (dic.ContainsKey($"AlarmDetails.{j}"))
  420. {
  421. tempDetails = dic[$"AlarmDetails.{j}"];
  422. }
  423. recipeStep.AlarmActionSets.Add(j, new AlarmActions()
  424. {
  425. ProcessingType = tempType,
  426. ProcessingDetails = tempDetails
  427. });
  428. }
  429. //if(dic.ContainsKey("Loop"))
  430. //{
  431. // string loopStr = dic["Loop"];
  432. // recipeStep.IsLoopStartStep = System.Text.RegularExpressions.Regex.Match(loopStr, @"Loop\x20\d+\s*$").Success;
  433. // recipeStep.IsLoopEndStep = System.Text.RegularExpressions.Regex.Match(loopStr, @"Loop End$").Success;
  434. // if (recipeStep.IsLoopStartStep)
  435. // recipeStep.LoopCount = Convert.ToInt32(loopStr.Replace("Loop", string.Empty));
  436. // else
  437. // recipeStep.LoopCount = 0;
  438. //}
  439. //recipe time
  440. if (dic["Name"].ToLower() == "standby")
  441. {
  442. if (DateTime.TryParse(dic["Time"], out DateTime time))
  443. {
  444. recipeStep.StepTime = time.Second + time.Minute * 60 + time.Hour * 3600 + time.Millisecond / 1000.0;
  445. }
  446. else if (float.TryParse(dic["Time"], out float timeInSec))
  447. {
  448. recipeStep.StepTime = timeInSec;
  449. recipeStep.EndBy = EnumEndByCondition.ByTime;
  450. }
  451. else
  452. {
  453. recipeStep.StepTime = 0;
  454. recipeStep.EndBy = EnumEndByCondition.ByStandbyFactor;
  455. }
  456. }
  457. else
  458. {
  459. if (System.Text.RegularExpressions.Regex.Match(dic["Time"], @"[a-zA-Z]").Success)
  460. {
  461. if (SC.ContainsItem($"{module}.RecipeEditParameter.StepTime.{dic["Time"]}"))
  462. {
  463. var time = DateTime.Parse(SC.GetStringValue($"{module}.RecipeEditParameter.StepTime.{dic["Time"]}"));
  464. recipeStep.StepTime = time.Second + time.Minute * 60 + time.Hour * 3600;
  465. }
  466. else
  467. {
  468. reason = $"Configuration does not contains step time config {dic["Time"]}";
  469. return false;
  470. }
  471. }
  472. else
  473. {
  474. if (DateTime.TryParse(dic["Time"], out DateTime time))
  475. {
  476. recipeStep.StepTime = time.Second + time.Minute * 60 + time.Hour * 3600 + time.Millisecond / 1000.0;
  477. }
  478. else if (float.TryParse(dic["Time"], out float timeInSec))
  479. {
  480. recipeStep.StepTime = timeInSec;
  481. }
  482. else
  483. {
  484. reason = $"Step time {dic["Time"]} is invalid";
  485. return false;
  486. }
  487. }
  488. if (dic["ConditionCheck"].ToLower() == "none")
  489. {
  490. recipeStep.EndBy = EnumEndByCondition.ByTime;
  491. }
  492. else
  493. {
  494. recipeStep.EndBy = EnumEndByCondition.ByStandbyFactor;
  495. }
  496. }
  497. //ReplaceControlName(ref dic, "GasLineMFC1.Flow", "MFC1.SetParameters");
  498. //ReplaceControlName(ref dic, "GasLineMFC2.Flow", "MFC2.SetParameters");
  499. //ReplaceControlName(ref dic, "GasLineMFC3.Flow", "MFC3.SetParameters");
  500. //ReplaceControlName(ref dic, "GasLineMFC4.Flow", "MFC4.SetParameters");
  501. //ReplaceControlName(ref dic, "GasLineMFC5.Flow", "MFC5.SetParameters");
  502. //ReplaceControlName(ref dic, "GasLineMFC6.Flow", "MFC6.SetParameters");
  503. //ReplaceControlName(ref dic, "GasLineMFC7.Flow", "MFC7.SetParameters");
  504. //ReplaceControlName(ref dic, "GasLineMFC8.Flow", "MFC8.SetParameters");
  505. //ReplaceControlName(ref dic, "GasLineMFC9.Flow", "MFC9.SetParameters");
  506. //ReplaceControlName(ref dic, "GasLineMFC10.Flow", "MFC10.SetParameters");
  507. //ReplaceControlName(ref dic, "GasLineMFC11.Flow", "MFC11.SetParameters");
  508. //ReplaceControlName(ref dic, "GasLineMFC12.Flow", "MFC12.SetParameters");
  509. //ReplaceControlName(ref dic, "GasLineMFC51.Flow", "MFC51.SetParameters");
  510. 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" });
  511. 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" });
  512. 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" });
  513. 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" });
  514. 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" });
  515. 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" });
  516. 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" });
  517. 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" });
  518. 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" });
  519. 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" });
  520. 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" });
  521. 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" });
  522. 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" });
  523. 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" });
  524. 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" });
  525. 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" });
  526. 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" });
  527. 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" });
  528. 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" });
  529. //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" });
  530. ReplaceControlName(ref dic, "MFM57Flow", "MFM57.SetParameters");
  531. ReplaceControlName(ref dic, "MFM1Flow", "MFM1.SetParameters");
  532. ReplaceControlName(ref dic, "MFM6Flow", "MFM6.SetParameters");
  533. ReplaceControlName(ref dic, "MFM7Flow", "MFM7.SetParameters");
  534. ReplaceControlName(ref dic, "MFM8Flow", "MFM8.SetParameters");
  535. ReplaceControlName(ref dic, "MFM9Flow", "MFM9.SetParameters");
  536. ReplaceControlName(ref dic, "MFM11Flow", "MFM11.SetParameters");
  537. ReplaceControlName(ref dic, "MFM12Flow", "MFM12.SetParameters");
  538. ReplaceControlName(ref dic, "MFM13Flow", "MFM13.SetParameters");
  539. ReplaceControlName(ref dic, "MFM16Flow", "MFM16.SetParameters");
  540. ReplaceControlName(ref dic, "ConditionCheck", "SetConditionCheck");
  541. ReplaceControlName(ref dic, "Command", "SetCommand");
  542. if (dic.ContainsKey("AlarmConditionTable"))
  543. ReplaceControlName(ref dic, "AlarmConditionTable", "SetAlarmConditionTable");
  544. //ReplaceControlName(ref dic, "Heater2", "ZoneU.SetParameters");
  545. //ReplaceControlName(ref dic, "Heater4", "ZoneCU.SetParameters");
  546. //ReplaceControlName(ref dic, "Heater6", "ZoneC.SetParameters");
  547. //ReplaceControlName(ref dic, "Heater8", "ZoneCL.SetParameters");
  548. //ReplaceControlName(ref dic, "Heater10", "ZoneL.SetParameters");
  549. var controlMode = dic["Temperature.ControlMode"];
  550. var correct = dic["Temperature.Correct"];
  551. var PID = dic["Temperature.PID"];
  552. //AddParameter(ref dic, "ZoneU.SetParameters", controlMode, correct, PID);
  553. //AddParameter(ref dic, "ZoneCU.SetParameters", controlMode, correct, PID);
  554. //AddParameter(ref dic, "ZoneC.SetParameters", controlMode, correct, PID);
  555. //AddParameter(ref dic, "ZoneCL.SetParameters", controlMode, correct, PID);
  556. //AddParameter(ref dic, "ZoneL.SetParameters", controlMode, correct, PID);
  557. 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" });
  558. AddParameterValue(ref dic, "HeaterU.SetParameters", new string[8] { controlMode, correct, PID, recipeHead.TempCorrect, recipeHead.TempPID, recipeHead.ProfileCondition, dic["ValveAV91"], dic["BWR"] });
  559. 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" });
  560. AddParameterValue(ref dic, "HeaterCU.SetParameters", new string[8] { controlMode, correct, PID, recipeHead.TempCorrect, recipeHead.TempPID, recipeHead.ProfileCondition, dic["ValveAV91"], dic["BWR"] });
  561. 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" });
  562. AddParameterValue(ref dic, "HeaterC.SetParameters", new string[8] { controlMode, correct, PID, recipeHead.TempCorrect, recipeHead.TempPID, recipeHead.ProfileCondition, dic["ValveAV91"], dic["BWR"] });
  563. 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" });
  564. AddParameterValue(ref dic, "HeaterCL.SetParameters", new string[8] { controlMode, correct, PID, recipeHead.TempCorrect, recipeHead.TempPID, recipeHead.ProfileCondition, dic["ValveAV91"], dic["BWR"] });
  565. 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" });
  566. AddParameterValue(ref dic, "HeaterL.SetParameters", new string[8] { controlMode, correct, PID, recipeHead.TempCorrect, recipeHead.TempPID, recipeHead.ProfileCondition, dic["ValveAV91"], dic["BWR"] });
  567. 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
  568. AddParameterValue(ref dic, "APC.SetParameters", new string[2] { recipeHead.PressApcPID, dic["ValveAV71"] });//APC
  569. AddParameter(ref dic, "SetBoatMotion", new string[5] { "Loader.Command", "Loader.Speed1", "Loader.Speed2", "Loader.Speed3", "Loader.RPM" });//Boat
  570. List<string> auxCommands = new List<string>();
  571. for (int k = 1; k < 200; k++)
  572. {
  573. if (!dic.ContainsKey($"AUX.{k}.Set"))
  574. continue;
  575. auxCommands.Add($"{k},{dic[$"AUX.{k}.Set"]},{dic[$"AUX.{k}.Check"]},{dic[$"AUX.{k}.High"]},{dic[$"AUX.{k}.Low"]},{dic[$"AUX.{k}.CheckUnit"]}");
  576. dic.Remove($"AUX.{k}.Set");
  577. dic.Remove($"AUX.{k}.Check");
  578. dic.Remove($"AUX.{k}.High");
  579. dic.Remove($"AUX.{k}.Low");
  580. dic.Remove($"AUX.{k}.CheckUnit");
  581. }
  582. dic.Add("AUX.SetParameters", string.Join(";", auxCommands));
  583. //ReplaceControlName(ref dic, "RFSwitch", "RfPower.SetParameters");
  584. //AddParameter(ref dic, "RfPower.SetParameters", dic["RFSetpoint"], dic["ForwardPowerAlarmWatchTable"], dic["PrAlarmWatchTable"], dic["PIAlarmWatchTable"]);
  585. //ReplaceControlName(ref dic, "C1Setpoint", "RfMatch.SetParameters");
  586. //AddParameter(ref dic, "RfMatch.SetParameters", dic["C2Setpoint"], dic["C1AlarmWatchTable"], dic["C2AlarmWatchTable"], dic["VppAlarmWatchTable"]);
  587. AddValveParameter(ref dic, "SetValves", new string[159] {
  588. "ValveAV1",
  589. "ValveAV2",
  590. "ValveAV3",
  591. "ValveAV4",
  592. "ValveAV5",
  593. "ValveAV6",
  594. "ValveAV7",
  595. "ValveAV8",
  596. "ValveAV9",
  597. "ValveAV10",
  598. "ValveAV11",
  599. "ValveAV12",
  600. "ValveAV13",
  601. "ValveAV14",
  602. "ValveAV15",
  603. "ValveAV16",
  604. "ValveAV17",
  605. "ValveAV18",
  606. "ValveAV19",
  607. "ValveAV20",
  608. "ValveAV21",
  609. "ValveAV22",
  610. "ValveAV23",
  611. "ValveAV24",
  612. "ValveAV25",
  613. "ValveAV26",
  614. "ValveAV27",
  615. "ValveAV28",
  616. "ValveAV29",
  617. "ValveAV30",
  618. "ValveAV31",
  619. "ValveAV32",
  620. "ValveAV33",
  621. "ValveAV34",
  622. "ValveAV35",
  623. "ValveAV36",
  624. "ValveAV37",
  625. "ValveAV38",
  626. "ValveAV39",
  627. "ValveAV40",
  628. "ValveAV41",
  629. "ValveAV42",
  630. "ValveAV43",
  631. "ValveAV44",
  632. "ValveAV45",
  633. "ValveAV46",
  634. "ValveAV47",
  635. "ValveAV48",
  636. "ValveAV49",
  637. "ValveAV50",
  638. "ValveAV51",
  639. "ValveAV52",
  640. "ValveAV53",
  641. "ValveAV54",
  642. "ValveAV55",
  643. "ValveAV56",
  644. "ValveAV57",
  645. "ValveAV58",
  646. "ValveAV59",
  647. "ValveAV60",
  648. "ValveAV61",
  649. "ValveAV62",
  650. "ValveAV63",
  651. "ValveAV64",
  652. "ValveAV65",
  653. "ValveAV66",
  654. "ValveAV67",
  655. "ValveAV68",
  656. "ValveAV69",
  657. "ValveAV70",
  658. "ValveAV71",
  659. "ValveAV72",
  660. "ValveAV73",
  661. "ValveAV74",
  662. "ValveAV75",
  663. "ValveAV76",
  664. "ValveAV77",
  665. "ValveAV78",
  666. "ValveAV79",
  667. "ValveAV80",
  668. "ValveAV81",
  669. "ValveAV82",
  670. "ValveAV83",
  671. "ValveAV84",
  672. "ValveAV85",
  673. "ValveAV86",
  674. "ValveAV87",
  675. "ValveAV88",
  676. "ValveAV89",
  677. "ValveAV90",
  678. "ValveAV91",
  679. "ValveAV92",
  680. "ValveAV93",
  681. "ValveAV94",
  682. "ValveAV95",
  683. "ValveAV96",
  684. "ValveAV97",
  685. "ValveAV98",
  686. "ValveAV99",
  687. "ValveAV100",
  688. "ValveAV101",
  689. "ValveAV102",
  690. "ValveAV103",
  691. "ValveAV104",
  692. "ValveAV105",
  693. "ValveAV106",
  694. "ValveAV107",
  695. "ValveAV108",
  696. "ValveAV109",
  697. "ValveAV110",
  698. "ValveAV111",
  699. "ValveAV112",
  700. "ValveAV113",
  701. "ValveAV114",
  702. "ValveAV115",
  703. "ValveAV116",
  704. "ValveAV117",
  705. "ValveAV118",
  706. "ValveAV119",
  707. "ValveAV120",
  708. "ValveAV121",
  709. "ValveAV122",
  710. "ValveAV123",
  711. "ValveAV124",
  712. "ValveAV125",
  713. "ValveAV126",
  714. "ValveAV127",
  715. "ValveAV128",
  716. "ValveAV129",
  717. "ValveAV130",
  718. "ValveAV131",
  719. "ValveAV132",
  720. "ValveAV133",
  721. "ValveAV134",
  722. "ValveAV135",
  723. "ValveAV136",
  724. "DPR",
  725. "AGV",
  726. "AGV2",
  727. "MBP",
  728. "MBP1",
  729. "MBP2",
  730. "DP",
  731. "BWR",
  732. "F2Cln",
  733. "HFCln",
  734. "CEXH",
  735. "DEPO",
  736. "HTR1",
  737. "HTR2",
  738. "HTR3",
  739. "DP1",
  740. "DP2",
  741. "HMNT",
  742. "CMNT",
  743. "HREF",
  744. "CREF",
  745. "HZERO",
  746. "CZERO"
  747. });
  748. //dic.Remove("SetValves");
  749. //dic.Remove("HeaterU.SetParameters");
  750. //dic.Remove("HeaterCU.SetParameters");
  751. //dic.Remove("HeaterC.SetParameters");
  752. //dic.Remove("HeaterCL.SetParameters");
  753. //dic.Remove("HeaterL.SetParameters");
  754. //dic.Remove("MFC1.SetParameters");
  755. //dic.Remove("MFC2.SetParameters");
  756. //dic.Remove("MFC3.SetParameters");
  757. //dic.Remove("MFC4.SetParameters");
  758. //dic.Remove("MFC5.SetParameters");
  759. //dic.Remove("MFC6.SetParameters");
  760. //dic.Remove("MFC7.SetParameters");
  761. //dic.Remove("MFC8.SetParameters");
  762. //dic.Remove("MFC9.SetParameters");
  763. //dic.Remove("MFC10.SetParameters");
  764. //dic.Remove("MFC11.SetParameters");
  765. //dic.Remove("MFC12.SetParameters");
  766. //ReplaceControlNameForValve(ref dic, "ValveAV1");
  767. //ReplaceControlNameForValve(ref dic, "ValveAV2");
  768. //ReplaceControlNameForValve(ref dic, "ValveAV3");
  769. //ReplaceControlNameForValve(ref dic, "ValveAV4");
  770. //ReplaceControlNameForValve(ref dic, "ValveAV5");
  771. //ReplaceControlNameForValve(ref dic, "ValveAV6");
  772. //ReplaceControlNameForValve(ref dic, "ValveAV7");
  773. //ReplaceControlNameForValve(ref dic, "ValveAV8");
  774. //ReplaceControlNameForValve(ref dic, "ValveAV9");
  775. //ReplaceControlNameForValve(ref dic, "ValveAV10");
  776. //ReplaceControlNameForValve(ref dic, "ValveAV11");
  777. //ReplaceControlNameForValve(ref dic, "ValveAV12");
  778. //ReplaceControlNameForValve(ref dic, "ValveAV13");
  779. //ReplaceControlNameForValve(ref dic, "ValveAV14");
  780. //ReplaceControlNameForValve(ref dic, "ValveAV15");
  781. //ReplaceControlNameForValve(ref dic, "ValveAV16");
  782. //ReplaceControlNameForValve(ref dic, "ValveAV17");
  783. //ReplaceControlNameForValve(ref dic, "ValveAV18");
  784. //ReplaceControlNameForValve(ref dic, "ValveAV19");
  785. //ReplaceControlNameForValve(ref dic, "ValveAV20");
  786. //ReplaceControlNameForValve(ref dic, "ValveAV21");
  787. //ReplaceControlNameForValve(ref dic, "ValveAV22");
  788. //ReplaceControlNameForValve(ref dic, "ValveAV23");
  789. //ReplaceControlNameForValve(ref dic, "ValveAV24");
  790. //ReplaceControlNameForValve(ref dic, "ValveAV25");
  791. //ReplaceControlNameForValve(ref dic, "ValveAV26");
  792. //ReplaceControlNameForValve(ref dic, "ValveAV27");
  793. //ReplaceControlNameForValve(ref dic, "ValveAV28");
  794. //ReplaceControlNameForValve(ref dic, "ValveAV29");
  795. //ReplaceControlNameForValve(ref dic, "ValveAV30");
  796. //ReplaceControlNameForValve(ref dic, "ValveAV31");
  797. //ReplaceControlNameForValve(ref dic, "ValveAV32");
  798. //ReplaceControlNameForValve(ref dic, "ValveAV33");
  799. //ReplaceControlNameForValve(ref dic, "ValveAV34");
  800. //ReplaceControlNameForValve(ref dic, "ValveAV35");
  801. //ReplaceControlNameForValve(ref dic, "ValveAV36");
  802. //ReplaceControlNameForValve(ref dic, "ValveAV37");
  803. //ReplaceControlNameForValve(ref dic, "ValveAV38");
  804. //ReplaceControlNameForValve(ref dic, "ValveAV39");
  805. //ReplaceControlNameForValve(ref dic, "ValveAV52");
  806. ////ReplaceControlNameForValve(ref dic, "ValveAV54");
  807. ////ReplaceControlNameForValve(ref dic, "ValveAV56");
  808. ////ReplaceControlNameForValve(ref dic, "ValveAV57");
  809. ////ReplaceControlNameForValve(ref dic, "ValveAV58");
  810. ////ReplaceControlNameForValve(ref dic, "ValveAV59");
  811. //ReplaceControlNameForValve(ref dic, "ValveAV60");
  812. ////ReplaceControlNameForValve(ref dic, "ValveAV65");
  813. ////ReplaceControlNameForValve(ref dic, "ValveAV66");
  814. ////ReplaceControlNameForValve(ref dic, "ValveAV68");
  815. //ReplaceControlNameForValve(ref dic, "ValveAV71");
  816. //ReplaceControlNameForValve(ref dic, "ValveAV72");
  817. //ReplaceControlNameForValve(ref dic, "ValveAV73");
  818. //ReplaceControlNameForValve(ref dic, "ValveAV74");
  819. //ReplaceControlNameForValve(ref dic, "ValveAV75");
  820. //ReplaceControlNameForValve(ref dic, "ValveAV77");
  821. //ReplaceControlNameForValve(ref dic, "ValveAV81");
  822. //ReplaceControlNameForValve(ref dic, "ValveAV82");
  823. //ReplaceControlNameForValve(ref dic, "ValveAV83");
  824. //ReplaceControlNameForValve(ref dic, "ValveAV91");
  825. dic.Remove("StepNo");
  826. dic.Remove("Name");
  827. dic.Remove("EndBy");
  828. dic.Remove("Time");
  829. dic.Remove("ZAxisPosition");
  830. dic.Remove("ZAxisSpeed");
  831. dic.Remove("RotatePosition");
  832. dic.Remove("RotateSpeed");
  833. dic.Remove("RotateDirection");
  834. dic.Remove("Heater1");
  835. dic.Remove("Heater2");
  836. dic.Remove("Heater3");
  837. dic.Remove("Heater4");
  838. dic.Remove("Heater5");
  839. dic.Remove("ValveAV54");
  840. dic.Remove("ValveAV56");
  841. dic.Remove("ValveAV57");
  842. dic.Remove("ValveAV58");
  843. dic.Remove("ValveAV59");
  844. dic.Remove("ValveAV65");
  845. dic.Remove("ValveAV66");
  846. dic.Remove("ValveAV68");
  847. dic.Remove("ExternalOn");
  848. dic.Remove("ExternalOff");
  849. dic.Remove("ExternalSensor");
  850. dic.Remove("TempStabilize");
  851. dic.Remove("FinishAutoProfile");
  852. dic.Remove("ReachTempWait");
  853. dic.Remove("ReachTemp");
  854. dic.Remove("TempUpper");
  855. dic.Remove("TempLower");
  856. dic.Remove("ReachPressureWait");
  857. dic.Remove("ReachPressure");
  858. dic.Remove("PressureUpper");
  859. dic.Remove("PressureLower");
  860. dic.Remove("PressureStabilize");
  861. dic.Remove("External.Out1");
  862. dic.Remove("External.Out2");
  863. dic.Remove("External.Out3");
  864. dic.Remove("External.Out4");
  865. dic.Remove("External.Out5");
  866. dic.Remove("External.Out6");
  867. dic.Remove("RFSwitch");
  868. dic.Remove("RFSetpoint");
  869. dic.Remove("ForwardPowerAlarmWatchTable");
  870. dic.Remove("PrAlarmWatchTable");
  871. dic.Remove("PIAlarmWatchTable");
  872. dic.Remove("C1Setpoint");
  873. dic.Remove("C2Setpoint");
  874. dic.Remove("C1AlarmWatchTable");
  875. dic.Remove("C2AlarmWatchTable");
  876. dic.Remove("VppAlarmWatchTable");
  877. dic.Remove("VdcAlarmWatchTable");
  878. dic.Remove("AbortRecipeTableIndex");
  879. dic.Remove("Temperature.ControlMode");
  880. dic.Remove("Temperature.Correct");
  881. dic.Remove("Temperature.PID");
  882. dic.Remove("Temperature.Profile");
  883. dic.Remove("Temperature.Stabilize");
  884. dic.Remove("Temperature.TempReadyCond");
  885. dic.Remove("FilmThickFormula");
  886. dic.Remove("FilmThickCoefficientA");
  887. dic.Remove("FilmThickCoefficientB");
  888. dic.Remove("APC.SetPressure");
  889. dic.Remove("PressureSettingVG");
  890. dic.Remove("PressureSonserValue");
  891. dic.Remove("PressureValveAngle");
  892. dic.Remove("PressureAlarmTableNo");
  893. dic.Remove("EventSetting");
  894. dic.Remove("AlarmTableIndex");
  895. dic.Remove("AlarmDetails.1");
  896. dic.Remove("AlarmAction.1");
  897. dic.Remove("AlarmDetails.2");
  898. dic.Remove("AlarmAction.2");
  899. dic.Remove("AlarmDetails.3");
  900. dic.Remove("AlarmAction.3");
  901. dic.Remove("AlarmDetails.4");
  902. dic.Remove("AlarmAction.4");
  903. dic.Remove("AlarmDetails.5");
  904. dic.Remove("AlarmAction.5");
  905. dic.Remove("AlarmDetails.6");
  906. dic.Remove("AlarmAction.6");
  907. dic.Remove("AlarmDetails.7");
  908. dic.Remove("AlarmAction.7");
  909. dic.Remove("AlarmDetails.8");
  910. dic.Remove("AlarmAction.8");
  911. dic.Remove("AlarmDetails.9");
  912. dic.Remove("AlarmAction.9");
  913. dic.Remove("AlarmDetails.10");
  914. dic.Remove("AlarmAction.10");
  915. //List<string> mfcCheckInstall = new List<string>()
  916. //{
  917. // "MfcN1",
  918. // "MfcN2",
  919. // "MfcN3",
  920. // "MfcH1",
  921. // "MfcJ1",
  922. // "MfcXN1",
  923. //};
  924. //foreach(var mfc in mfcCheckInstall)
  925. //{
  926. // if (!SC.GetValue<bool>($"PM1.MFC.{mfc}.IsMFCInstalled"))
  927. // dic.Remove($"{mfc}.SetParameters");
  928. //}
  929. foreach (string key in dic.Keys)
  930. recipeStep.RecipeCommands.Add(key, dic[key]);
  931. }
  932. for (int i = 0; i < recipeData.Count; i++)
  933. {
  934. if (recipeData[i].IsJumpStep)
  935. {
  936. bool findJumpStep = false;
  937. for (int j = 0; j < recipeData.Count; j++)
  938. {
  939. if (recipeData[j].StepName == recipeData[i].JumpStepName)
  940. {
  941. recipeData[i].JumpStepNo = j;
  942. findJumpStep = true;
  943. break;
  944. }
  945. }
  946. if (!findJumpStep)
  947. {
  948. reason = $"Recipe file does not contains jump step {recipeData[i].JumpStepName}";
  949. return false;
  950. }
  951. }
  952. }
  953. }
  954. catch (Exception ex)
  955. {
  956. LOG.Write(ex);
  957. reason = $"Recipe file content not valid, {recipeFile}, {ex.Message}";
  958. return false;
  959. }
  960. return true;
  961. }
  962. public static bool LayoutRecipeParse(string recipeFile, string module, out RecipeLayoutEntityNormal layoutRecipeDataNormal, out RecipeLayoutEntityExpert layoutRecipeDataExpert, out string reason)
  963. {
  964. reason = string.Empty;
  965. layoutRecipeDataNormal = new RecipeLayoutEntityNormal();
  966. layoutRecipeDataExpert = new RecipeLayoutEntityExpert();
  967. string content = RecipeFileManager.Instance.LoadRecipe($"{SC.GetStringValue("System.Recipe.SupportedChamberType")}\\{SC.GetStringValue("System.Recipe.SupportedLayoutType")}", recipeFile, false);
  968. if (string.IsNullOrEmpty(content))
  969. {
  970. reason = $"{recipeFile} is not a valid recipe file";
  971. return false;
  972. }
  973. try
  974. {
  975. XmlDocument rcpDataDoc = new XmlDocument();
  976. rcpDataDoc.LoadXml(content);
  977. XmlNode nodeModule;
  978. nodeModule = rcpDataDoc.SelectSingleNode("/Aitex/TableRecipeData/Module/Step[@Name='Normal']");
  979. if (nodeModule == null)
  980. {
  981. //reason = "Recipe file does not contains step content for Normal";
  982. return false;
  983. }
  984. else
  985. {
  986. Type t = layoutRecipeDataNormal.GetType();
  987. foreach (FieldInfo pi in t.GetFields())
  988. {
  989. XmlElement stepNode = nodeModule as XmlElement;
  990. //遍历Step节点
  991. foreach (XmlAttribute att in stepNode.Attributes)
  992. {
  993. if (pi.Name == att.Name)
  994. {
  995. pi.SetValue(layoutRecipeDataNormal, att.Value);
  996. }
  997. }
  998. }
  999. }
  1000. nodeModule = rcpDataDoc.SelectSingleNode("/Aitex/TableRecipeData/Module/Step[@Name='Expert']");
  1001. if (nodeModule == null)
  1002. {
  1003. //reason = "Recipe file does not contains step content for Expert";
  1004. return false;
  1005. }
  1006. else
  1007. {
  1008. XmlElement stepNode = nodeModule as XmlElement;
  1009. string strName = "";
  1010. //遍历Step节点
  1011. foreach (XmlAttribute att in stepNode.Attributes)
  1012. {
  1013. if (att.Name != "Name")
  1014. {
  1015. layoutRecipeDataExpert.Items.Add(att.Value);
  1016. }
  1017. else
  1018. {
  1019. strName = att.Value;
  1020. }
  1021. }
  1022. layoutRecipeDataExpert.Name = strName;
  1023. }
  1024. }
  1025. catch (Exception ex)
  1026. {
  1027. LOG.Write(ex);
  1028. reason = $"Recipe file content not valid, {recipeFile}, {ex.Message}";
  1029. return false;
  1030. }
  1031. return true;
  1032. }
  1033. private static void ReplaceControlName(ref Dictionary<string, string> dic, string from, string to)
  1034. {
  1035. if (dic.ContainsKey(from))
  1036. {
  1037. dic.Add(to, dic[from]);
  1038. dic.Remove(from);
  1039. }
  1040. }
  1041. private static void ReplaceControlName(ref Dictionary<string, string> dic, string from, string to1, string to2)
  1042. {
  1043. dic.Add(to1, dic[from]);
  1044. dic.Add(to2, dic[from]);
  1045. dic.Remove(from);
  1046. }
  1047. private static void ReplaceControlNameForValve(ref Dictionary<string, string> dic, string key)
  1048. {
  1049. switch (dic[key].ToLower())
  1050. {
  1051. case "open":
  1052. dic[key] = "true";
  1053. break;
  1054. case "close":
  1055. dic[key] = "false";
  1056. break;
  1057. case "continue":
  1058. dic[key] = "Continue";
  1059. break;
  1060. }
  1061. //dic[key] = dic[key].ToLower() == "open" ? "true" : "false";
  1062. }
  1063. private static void AddValveParameter(ref Dictionary<string, string> dic, string to, string[] param)
  1064. {
  1065. if (param != null && param.Length > 0)
  1066. {
  1067. foreach (var item in param)
  1068. {
  1069. if (!string.IsNullOrEmpty(item) && dic.ContainsKey(item))
  1070. {
  1071. if (!dic.ContainsKey(to))
  1072. dic.Add(to, "");
  1073. var set = "";
  1074. switch (dic[item].ToLower())
  1075. {
  1076. case "open":
  1077. set = "true";
  1078. break;
  1079. case "close":
  1080. set = "false";
  1081. break;
  1082. case "continue":
  1083. set = "Continue";
  1084. break;
  1085. }
  1086. var value = $"{dic[to]};{item},{set}";
  1087. dic[to] = string.IsNullOrEmpty(dic[to]) ? $"{item},{set}" : value;
  1088. dic.Remove(item);
  1089. }
  1090. }
  1091. }
  1092. }
  1093. private static void AddParameter(ref Dictionary<string, string> dic, string to, string from1, string from2, string from3, string from4 = null)
  1094. {
  1095. var value = $"{dic[to]};{from1};{from2};{from3}";
  1096. if (!string.IsNullOrEmpty(from4))
  1097. value = $"{value};{from4}";
  1098. dic[to] = value;
  1099. }
  1100. private static void AddParameter(ref Dictionary<string, string> dic, string to, string[] param)
  1101. {
  1102. if (param != null && param.Length > 0)
  1103. {
  1104. foreach (var item in param)
  1105. {
  1106. if (!string.IsNullOrEmpty(item) && dic.ContainsKey(item))
  1107. {
  1108. if (!dic.ContainsKey(to))
  1109. dic.Add(to, "");
  1110. var value = $"{dic[to]};{dic[item]}";
  1111. dic[to] = string.IsNullOrEmpty(dic[to]) ? dic[item] : value;
  1112. dic.Remove(item);
  1113. }
  1114. }
  1115. }
  1116. }
  1117. private static void AddParameterValue(ref Dictionary<string, string> dic, string to, string[] param)
  1118. {
  1119. if (!dic.ContainsKey(to))
  1120. dic.Add(to, "");
  1121. if (param != null && param.Length > 0)
  1122. {
  1123. foreach (var item in param)
  1124. {
  1125. var value = $"{dic[to]};{item}";
  1126. dic[to] = string.IsNullOrEmpty(dic[to]) ? item : value;
  1127. }
  1128. }
  1129. }
  1130. }
  1131. }