RecipeData.cs 52 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Collections.ObjectModel;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Text.RegularExpressions;
  7. using System.Windows;
  8. using System.Xml;
  9. using Aitex.Core.RT.Log;
  10. using Caliburn.Micro.Core;
  11. using MECF.Framework.Common.DataCenter;
  12. using RecipeEditorLib.DGExtension.CustomColumn;
  13. using RecipeEditorLib.RecipeModel.Params;
  14. namespace MECF.Framework.UI.Client.CenterViews.Editors.Recipe
  15. {
  16. public class RecipeData : PropertyChangedBase
  17. {
  18. public bool IsChanged
  19. {
  20. get
  21. {
  22. bool changed = !IsSavedDesc;
  23. if (!changed)
  24. {
  25. changed = ChkChanged(Steps) || ChkChanged(PopSettingSteps) || ChkChanged(StepTolerances);
  26. }
  27. if (!changed)
  28. {
  29. foreach (Param config in this.ConfigItems)
  30. {
  31. if (!config.IsSaved)
  32. {
  33. changed = true;
  34. break;
  35. }
  36. }
  37. }
  38. return changed;
  39. }
  40. }
  41. private bool _isSavedDesc;
  42. public bool IsSavedDesc
  43. {
  44. get { return _isSavedDesc; }
  45. set
  46. {
  47. this._isSavedDesc = value;
  48. this.NotifyOfPropertyChange("IsSavedDesc");
  49. }
  50. }
  51. private string name;
  52. public string Name
  53. {
  54. get { return this.name; }
  55. set
  56. {
  57. this.name = value;
  58. this.NotifyOfPropertyChange("Name");
  59. }
  60. }
  61. private string _chamberType;
  62. public string RecipeChamberType
  63. {
  64. get { return this._chamberType; }
  65. set
  66. {
  67. this._chamberType = value;
  68. this.NotifyOfPropertyChange("RecipeChamberType");
  69. }
  70. }
  71. private string _recipeVersion;
  72. public string RecipeVersion
  73. {
  74. get { return this._recipeVersion; }
  75. set
  76. {
  77. this._recipeVersion = value;
  78. this.NotifyOfPropertyChange("RecipeVersion");
  79. }
  80. }
  81. private string _prefixPath;
  82. public string PrefixPath
  83. {
  84. get { return _prefixPath; }
  85. set
  86. {
  87. _prefixPath = value;
  88. this.NotifyOfPropertyChange("PrefixPath");
  89. }
  90. }
  91. private string creator;
  92. public string Creator
  93. {
  94. get { return this.creator; }
  95. set
  96. {
  97. this.creator = value;
  98. this.NotifyOfPropertyChange("Creator");
  99. }
  100. }
  101. private DateTime createTime;
  102. public DateTime CreateTime
  103. {
  104. get { return this.createTime; }
  105. set
  106. {
  107. this.createTime = value;
  108. this.NotifyOfPropertyChange("CreateTime");
  109. }
  110. }
  111. private string description;
  112. public string Description
  113. {
  114. get { return this.description; }
  115. set
  116. {
  117. this.description = value;
  118. this.NotifyOfPropertyChange("Description");
  119. }
  120. }
  121. private string devisor;
  122. public string Revisor
  123. {
  124. get { return this.devisor; }
  125. set
  126. {
  127. this.devisor = value;
  128. this.NotifyOfPropertyChange("Revisor");
  129. }
  130. }
  131. private DateTime deviseTime;
  132. public DateTime ReviseTime
  133. {
  134. get { return this.deviseTime; }
  135. set
  136. {
  137. this.deviseTime = value;
  138. this.NotifyOfPropertyChange("ReviseTime");
  139. }
  140. }
  141. public ObservableCollection<ObservableCollection<Param>> Steps { get; private set; }
  142. public Dictionary<string, ObservableCollection<ObservableCollection<Param>>> PopSettingSteps { get; private set; }
  143. public ObservableCollection<ObservableCollection<Param>> StepTolerances { get; private set; }
  144. public ObservableCollection<Param> ConfigItems { get; private set; }
  145. private XmlDocument _doc;
  146. private string _module;
  147. public bool ToleranceEnable { get; set; }
  148. public Dictionary<string, bool> PopEnable { get; set; }
  149. public bool IsCompatibleWithCurrentFormat { get; set; }
  150. public bool ChkChanged(ObservableCollection<ObservableCollection<Param>> Steps)
  151. {
  152. foreach (ObservableCollection<Param> parameters in Steps)
  153. {
  154. if (parameters.Where(param => param.IsSaved == false).Count() > 0)
  155. {
  156. return true;
  157. }
  158. }
  159. return false;
  160. }
  161. public bool ChkChanged(Dictionary<string, ObservableCollection<ObservableCollection<Param>>> PopSteps)
  162. {
  163. foreach (ObservableCollection<ObservableCollection<Param>> parameters in PopSteps.Values)
  164. {
  165. if (ChkChanged(parameters))
  166. {
  167. return true;
  168. }
  169. }
  170. return false;
  171. }
  172. public RecipeData()
  173. {
  174. this.Steps = new ObservableCollection<ObservableCollection<Param>>();
  175. StepTolerances = new ObservableCollection<ObservableCollection<Param>>();
  176. this.PopSettingSteps = new Dictionary<string, ObservableCollection<ObservableCollection<Param>>>();
  177. this.PopEnable = new Dictionary<string, bool>();
  178. ConfigItems = new ObservableCollection<Param>();
  179. IsSavedDesc = true;
  180. _doc = new XmlDocument();
  181. XmlElement node = _doc.CreateElement("Aitex");
  182. _doc.AppendChild(node);
  183. node.AppendChild(_doc.CreateElement("TableRecipeData"));
  184. }
  185. public void Clear()
  186. {
  187. Steps.Clear();
  188. PopSettingSteps.Clear();
  189. StepTolerances.Clear();
  190. ConfigItems.Clear();
  191. RecipeChamberType = "";
  192. RecipeVersion = "";
  193. IsSavedDesc = true;
  194. _module = "";
  195. }
  196. public void DataSaved()
  197. {
  198. foreach (ObservableCollection<Param> parameters in Steps)
  199. {
  200. parameters.Apply(param => param.IsSaved = true);
  201. }
  202. foreach (ObservableCollection<ObservableCollection<Param>> popParameters in PopSettingSteps.Values)
  203. {
  204. foreach (ObservableCollection<Param> parameters in popParameters)
  205. {
  206. parameters.Apply(param => param.IsSaved = true);
  207. }
  208. }
  209. foreach (ObservableCollection<Param> parameters in StepTolerances)
  210. {
  211. parameters.Apply(param => param.IsSaved = true);
  212. }
  213. ConfigItems.Apply(config => config.IsSaved = true);
  214. IsSavedDesc = true;
  215. }
  216. public void InitData(string prefixPath, string recipeName, string recipeContent,
  217. ObservableCollection<EditorDataGridTemplateColumnBase> columnDefine, Dictionary<string, ObservableCollection<Param>> popSettingColumnsDefine, ObservableCollection<Param> configDefine, string module)
  218. {
  219. IsCompatibleWithCurrentFormat = false;
  220. Name = recipeName;
  221. PrefixPath = prefixPath;
  222. _module = module;
  223. try
  224. {
  225. _doc = new XmlDocument();
  226. _doc.LoadXml(recipeContent);
  227. if (!LoadHeader(_doc.SelectSingleNode("Aitex/TableRecipeData")))
  228. return;
  229. XmlNodeList nodeSteps = _doc.SelectNodes($"Aitex/TableRecipeData/Module[@Name='{module}']/Step");
  230. if (nodeSteps == null)
  231. nodeSteps = _doc.SelectNodes($"Aitex/TableRecipeData/Step");
  232. LoadSteps(columnDefine, popSettingColumnsDefine, nodeSteps);
  233. var index = 1;
  234. foreach (ObservableCollection<Param> parameters in Steps)
  235. {
  236. (parameters[1] as StepParam).Value = index.ToString();
  237. index++;
  238. }
  239. ValidLoopData();
  240. XmlNode nodeConfig =
  241. _doc.SelectSingleNode($"Aitex/TableRecipeData/Module[@Name='{module}']/Config");
  242. if (nodeSteps == null)
  243. nodeConfig = _doc.SelectSingleNode($"Aitex/TableRecipeData/Config");
  244. LoadConfigs(configDefine, nodeConfig);
  245. IsCompatibleWithCurrentFormat = true;
  246. }
  247. catch (Exception ex)
  248. {
  249. LOG.Write(ex);
  250. }
  251. }
  252. public void ChangeChamber(ObservableCollection<EditorDataGridTemplateColumnBase> columnDefine, Dictionary<string, ObservableCollection<Param>> PopSettingColumns
  253. , ObservableCollection<Param> configDefine, string module)
  254. {
  255. _module = module;
  256. try
  257. {
  258. XmlNodeList nodeSteps = _doc.SelectNodes($"Aitex/TableRecipeData/Module[@Name='{module}']/Step");
  259. if (nodeSteps == null)
  260. nodeSteps = _doc.SelectNodes($"Aitex/TableRecipeData/Step");
  261. LoadSteps(columnDefine, PopSettingColumns, nodeSteps);
  262. var index = 1;
  263. foreach (ObservableCollection<Param> parameters in Steps)
  264. {
  265. (parameters[1] as StepParam).Value = index.ToString();
  266. index++;
  267. }
  268. ValidLoopData();
  269. XmlNode nodeConfig =
  270. _doc.SelectSingleNode($"Aitex/TableRecipeData/Module[@Name='{module}']/Config");
  271. if (nodeSteps == null)
  272. nodeConfig = _doc.SelectSingleNode($"Aitex/TableRecipeData/Config");
  273. LoadConfigs(configDefine, nodeConfig);
  274. }
  275. catch (Exception ex)
  276. {
  277. LOG.Write(ex);
  278. }
  279. }
  280. public void SaveTo(string[] moduleList)
  281. {
  282. GetXmlString();
  283. XmlNode nodeModule = _doc.SelectSingleNode($"Aitex/TableRecipeData/Module[@Name='{_module}']");
  284. if (nodeModule == null)
  285. {
  286. LOG.Write("recipe not find modules," + Name);
  287. return;
  288. }
  289. XmlNode nodeData = nodeModule.ParentNode;
  290. foreach (var module in moduleList)
  291. {
  292. if (module == _module)
  293. {
  294. continue;
  295. }
  296. var child = _doc.SelectSingleNode($"Aitex/TableRecipeData/Module[@Name='{module}']");
  297. if (child != null)
  298. nodeData.RemoveChild(child);
  299. XmlElement node = nodeModule.Clone() as XmlElement;
  300. node.SetAttribute("Name", module);
  301. nodeData.AppendChild(node);
  302. }
  303. }
  304. public ObservableCollection<Param> CreateStep(ObservableCollection<EditorDataGridTemplateColumnBase> columns, XmlNode stepNode = null)
  305. {
  306. ObservableCollection<Param> rows = new ObservableCollection<Param>();
  307. foreach (EditorDataGridTemplateColumnBase col in columns)
  308. {
  309. string value = string.Empty;
  310. if (!(col is ExpanderColumn) && stepNode != null && !(col is StepColumn) && !(col is PopSettingColumn))
  311. {
  312. if (string.IsNullOrEmpty(col.ModuleName) && stepNode.Attributes[col.ControlName] != null)
  313. {
  314. value = stepNode.Attributes[col.ControlName].Value;
  315. }
  316. else
  317. {
  318. if (stepNode.Attributes[col.ControlName] != null && stepNode.SelectSingleNode(col.ModuleName) != null && stepNode.SelectSingleNode(col.ModuleName).Attributes[col.ControlName] != null)
  319. value = stepNode.SelectSingleNode(col.ModuleName).Attributes[col.ControlName].Value;
  320. }
  321. }
  322. Param cell = null;
  323. if (col is StepColumn)
  324. {
  325. cell = new StepParam()
  326. {
  327. Name = col.ControlName,
  328. EnableTolerance = col.EnableTolerance,
  329. };
  330. }
  331. else if (col is TextBoxColumn)
  332. {
  333. cell = new StringParam()
  334. {
  335. Name = col.ControlName,
  336. Value = value,
  337. IsEnabled = col.IsEnable,
  338. EnableTolerance = col.EnableTolerance,
  339. };
  340. }
  341. else if (col is NumColumn)
  342. {
  343. cell = new IntParam()
  344. {
  345. Name = col.ControlName,
  346. Value = string.IsNullOrEmpty(value) ? (string.IsNullOrEmpty(col.Default) ? 0 : int.Parse(col.Default)) : int.Parse(value),
  347. IsEnabled = col.IsEnable,
  348. Minimun = (int)((NumColumn)col).Minimun,
  349. Maximun = (int)((NumColumn)col).Maximun,
  350. EnableTolerance = col.EnableTolerance,
  351. };
  352. }
  353. else if (col is DoubleColumn)
  354. {
  355. cell = new DoubleParam()
  356. {
  357. Name = col.ControlName,
  358. Value = string.IsNullOrEmpty(value) ? (string.IsNullOrEmpty(col.Default) ? "0" : col.Default) : value,
  359. Minimun = (int)((DoubleColumn)col).Minimun,
  360. Maximun = (int)((DoubleColumn)col).Maximun,
  361. IsEnabled = col.IsEnable,
  362. Resolution = ((DoubleColumn)col).Resolution,
  363. EnableTolerance = col.EnableTolerance,
  364. };
  365. }
  366. else if (col is ComboxColumn)
  367. {
  368. string displayValue;
  369. if (!string.IsNullOrEmpty(value) &&
  370. ((ComboxColumn)col).Options.FirstOrDefault(x => x.ControlName == value) != null)
  371. {
  372. displayValue = ((ComboxColumn)col).Options.First(x => x.ControlName == value).DisplayName;
  373. }
  374. else
  375. {
  376. if (!string.IsNullOrEmpty(col.Default) && ((ComboxColumn)col).Options.Any(x => x.DisplayName == col.Default))
  377. {
  378. displayValue = col.Default;
  379. }
  380. else
  381. {
  382. int selIndex = 0;
  383. displayValue = displayValue = ((ComboxColumn)col).Options[selIndex].DisplayName;
  384. }
  385. }
  386. cell = new ComboxParam()
  387. {
  388. Name = col.ControlName,
  389. Value = displayValue,
  390. Options = ((ComboxColumn)col).Options,
  391. IsEditable = !col.IsReadOnly,
  392. EnableTolerance = col.EnableTolerance,
  393. };
  394. }
  395. else if (col is LoopComboxColumn)
  396. {
  397. int selIndex = 0;
  398. cell = new LoopComboxParam()
  399. {
  400. Name = col.ControlName,
  401. Value = string.IsNullOrEmpty(value) ? ((LoopComboxColumn)col).Options[selIndex].DisplayName : value,
  402. Options = ((LoopComboxColumn)col).Options,
  403. IsEditable = !col.IsReadOnly,
  404. IsLoopStep = false,
  405. EnableTolerance = col.EnableTolerance,
  406. };
  407. }
  408. else if (col is ExpanderColumn)
  409. {
  410. cell = new ExpanderParam();
  411. }
  412. else if (col is PopSettingColumn)
  413. {
  414. cell = new PopSettingParam()
  415. {
  416. Name = col.ControlName,
  417. DisplayName = col.DisplayName,
  418. EnableTolerance = col.EnableTolerance,
  419. };
  420. }
  421. cell.Feedback = col.Feedback;
  422. cell.Parent = rows;
  423. if (col is LoopComboxColumn)
  424. {
  425. cell.Feedback = LoopCellFeedback;
  426. }
  427. rows.Add(cell);
  428. }
  429. foreach (Param cell in rows)
  430. {
  431. if (cell.Feedback != null)
  432. cell.Feedback(cell);
  433. }
  434. return rows;
  435. }
  436. public bool CreateStepTolerance(ObservableCollection<EditorDataGridTemplateColumnBase> columns,
  437. Dictionary<string, ObservableCollection<Param>> popSettingColumns, XmlNode stepNode, out ObservableCollection<Param> step, out ObservableCollection<Param> warning, out ObservableCollection<Param> alarm,
  438. out Dictionary<string, ObservableCollection<Param>> popSettingStep)
  439. {
  440. step = new ObservableCollection<Param>();
  441. warning = new ObservableCollection<Param>();
  442. alarm = new ObservableCollection<Param>();
  443. popSettingStep = new Dictionary<string, ObservableCollection<Param>>();
  444. foreach (EditorDataGridTemplateColumnBase col in columns)
  445. {
  446. string warningValue = string.Empty;
  447. string alarmValue = string.Empty;
  448. string stepValue = string.Empty;
  449. Dictionary<string, Dictionary<string, string>> popValues = new Dictionary<string, Dictionary<string, string>>();
  450. if (!(col is ExpanderColumn) && stepNode != null && !(col is StepColumn) && !(col is PopSettingColumn))
  451. {
  452. XmlNode warningNode = stepNode.SelectSingleNode("Warning");
  453. if (warningNode != null && warningNode.Attributes[col.ControlName] != null)
  454. {
  455. warningValue = warningNode.Attributes[col.ControlName].Value;
  456. }
  457. XmlNode alarmNode = stepNode.SelectSingleNode("Alarm");
  458. if (alarmNode != null && alarmNode.Attributes[col.ControlName] != null)
  459. {
  460. alarmValue = alarmNode.Attributes[col.ControlName].Value;
  461. }
  462. if (string.IsNullOrEmpty(col.ModuleName) && stepNode.Attributes[col.ControlName] != null)
  463. {
  464. stepValue = stepNode.Attributes[col.ControlName].Value;
  465. }
  466. else
  467. {
  468. if (stepNode.Attributes[col.ControlName] != null && stepNode.SelectSingleNode(col.ModuleName) != null && stepNode.SelectSingleNode(col.ModuleName).Attributes[col.ControlName] != null)
  469. stepValue = stepNode.SelectSingleNode(col.ModuleName).Attributes[col.ControlName].Value;
  470. }
  471. }
  472. if (col is PopSettingColumn)
  473. {
  474. foreach (string key in popSettingColumns.Keys)
  475. {
  476. XmlNode popNode = stepNode.SelectSingleNode(key);
  477. if (popNode != null)
  478. {
  479. Dictionary<string, string> Values = new Dictionary<string, string>();
  480. foreach (Param item in popSettingColumns[key])
  481. {
  482. if (popNode.Attributes[item.Name] != null)
  483. Values.Add(item.Name, popNode.Attributes[item.Name].Value);
  484. };
  485. popValues.Add(key, Values);
  486. }
  487. }
  488. }
  489. Param stepCell = new DoubleParam()
  490. {
  491. Name = col.ControlName,
  492. DisplayName = col.DisplayName,
  493. Value = stepValue,
  494. IsEnabled = false,
  495. StepCheckVisibility = Visibility.Hidden,
  496. };
  497. stepCell.Parent = step;
  498. step.Add(stepCell);
  499. if (col is PopSettingColumn)
  500. {
  501. for (int i = 0; i < popSettingColumns[col.ControlName].Count; i++)
  502. {
  503. string name = popSettingColumns[col.ControlName][i].Name;
  504. string value = popValues[col.ControlName].Where(x => x.Key == name).Count() > 0 ?
  505. popValues[col.ControlName].First(x => x.Key == name).Value : "";
  506. if (popSettingColumns[col.ControlName][i] is DoubleParam)
  507. {
  508. stepCell = new DoubleParam()
  509. {
  510. Name = name,
  511. DisplayName = popSettingColumns[col.ControlName][i].DisplayName,
  512. Value = value,
  513. IsEnabled = false,
  514. StepCheckVisibility = Visibility.Hidden,
  515. };
  516. }
  517. if (popSettingColumns[col.ControlName][i] is StringParam)
  518. {
  519. stepCell = new StringParam()
  520. {
  521. Name = name,
  522. DisplayName = popSettingColumns[col.ControlName][i].DisplayName,
  523. Value = value,
  524. IsEnabled = false,
  525. StepCheckVisibility = Visibility.Hidden,
  526. };
  527. }
  528. if (popSettingColumns[col.ControlName][i] is ComboxParam)
  529. {
  530. stepCell = new ComboxParam()
  531. {
  532. Name = name,
  533. DisplayName = popSettingColumns[col.ControlName][i].DisplayName,
  534. Value = value,
  535. Options = ((ComboxParam)popSettingColumns[col.ControlName][i]).Options,
  536. IsEditable = !col.IsReadOnly,
  537. EnableTolerance = col.EnableTolerance,
  538. };
  539. }
  540. if (!popSettingStep.ContainsKey(col.ControlName))
  541. {
  542. popSettingStep.Add(col.ControlName, new ObservableCollection<Param>());
  543. }
  544. stepCell.Parent = popSettingStep[col.ControlName];
  545. popSettingStep[col.ControlName].Add(stepCell);
  546. }
  547. }
  548. Param warningCell = new DoubleParam()
  549. {
  550. Name = col.ControlName,
  551. DisplayName = col.DisplayName,
  552. Value = col.EnableTolerance ? (string.IsNullOrEmpty(warningValue) ? "0" : warningValue) : "*",
  553. IsEnabled = col.EnableTolerance && stepValue != "0",
  554. StepCheckVisibility = Visibility.Collapsed,
  555. };
  556. warningCell.Feedback = col.Feedback;
  557. warningCell.Parent = warning;
  558. warning.Add(warningCell);
  559. Param alarmCell = new DoubleParam()
  560. {
  561. Name = col.ControlName,
  562. DisplayName = col.DisplayName,
  563. Value = col.EnableTolerance ? (string.IsNullOrEmpty(alarmValue) ? "0" : alarmValue) : "*",
  564. IsEnabled = col.EnableTolerance && stepValue != "0",
  565. StepCheckVisibility = Visibility.Collapsed,
  566. };
  567. alarmCell.Feedback = col.Feedback;
  568. alarmCell.Parent = alarm;
  569. alarm.Add(alarmCell);
  570. }
  571. return true;
  572. }
  573. public void ValidLoopData()
  574. {
  575. if (Steps.Count == 0)
  576. return;
  577. for (int j = 0; j < Steps[0].Count; j++)
  578. {
  579. if (Steps[0][j] is LoopComboxParam)
  580. {
  581. LoopCellFeedback(Steps[0][j]);
  582. }
  583. }
  584. }
  585. private void LoopCellFeedback(Param cell)
  586. {
  587. var loopCell = cell as LoopComboxParam;
  588. int rowIndex = -1;
  589. int colIndex = -1;
  590. for (int i = 0; i < Steps.Count; i++)
  591. {
  592. for (int j = 0; j < Steps[i].Count; j++)
  593. {
  594. if (Steps[i][j] == loopCell)
  595. {
  596. rowIndex = i;
  597. colIndex = j;
  598. }
  599. }
  600. }
  601. if (rowIndex < 0 || colIndex < 0)
  602. return;
  603. for (int i = 0; i < Steps.Count; i++)
  604. {
  605. loopCell = Steps[i][colIndex] as LoopComboxParam;
  606. string loopStr = loopCell.Value;
  607. bool isLoopStart = Regex.IsMatch(loopStr, @"^Loop\x20x\d+$");
  608. bool isLoopEnd = Regex.IsMatch(loopStr, @"^Loop End$");
  609. bool isNullOrEmpty = string.IsNullOrWhiteSpace(loopStr);
  610. if (!isLoopEnd && !isLoopStart && !isNullOrEmpty)
  611. {
  612. loopCell.IsLoopStep = true;
  613. loopCell.IsValidLoop = false;
  614. continue;
  615. }
  616. if (isLoopEnd)
  617. {
  618. loopCell.IsLoopStep = true;
  619. loopCell.IsValidLoop = false;
  620. continue;
  621. }
  622. if (isLoopStart)
  623. {
  624. if (i + 1 == Steps.Count)
  625. {
  626. loopCell.IsLoopStep = true;
  627. loopCell.IsValidLoop = true;
  628. }
  629. for (int j = i + 1; j < Steps.Count; j++)
  630. {
  631. var loopCell2 = Steps[j][colIndex] as LoopComboxParam;
  632. string loopStr2 = loopCell2.Value;
  633. bool isLoopStart2 = Regex.IsMatch(loopStr2, @"^Loop\x20x\d+$");
  634. bool isLoopEnd2 = Regex.IsMatch(loopStr2, @"^Loop End$");
  635. bool isNullOrEmpty2 = string.IsNullOrWhiteSpace(loopStr2);
  636. if (!isLoopEnd2 && !isLoopStart2 && !isNullOrEmpty2)
  637. {
  638. for (int k = i; k < j + 1; k++)
  639. {
  640. (Steps[k][colIndex] as LoopComboxParam).IsLoopStep = true;
  641. (Steps[k][colIndex] as LoopComboxParam).IsValidLoop = false;
  642. }
  643. i = j;
  644. break;
  645. }
  646. if (isLoopStart2)
  647. {
  648. loopCell.IsLoopStep = true;
  649. loopCell.IsValidLoop = true;
  650. i = j - 1;
  651. break;
  652. }
  653. if (isLoopEnd2)
  654. {
  655. for (int k = i; k < j + 1; k++)
  656. {
  657. (Steps[k][colIndex] as LoopComboxParam).IsLoopStep = true;
  658. (Steps[k][colIndex] as LoopComboxParam).IsValidLoop = true;
  659. }
  660. i = j;
  661. break;
  662. }
  663. if (j == Steps.Count - 1)
  664. {
  665. loopCell.IsLoopStep = true;
  666. loopCell.IsValidLoop = true;
  667. i = j;
  668. break;
  669. }
  670. }
  671. continue;
  672. }
  673. loopCell.IsLoopStep = false;
  674. loopCell.IsValidLoop = false;
  675. }
  676. }
  677. private bool LoadHeader(XmlNode nodeHeader)
  678. {
  679. if (nodeHeader == null)
  680. return false;
  681. if (nodeHeader.Attributes["CreatedBy"] != null)
  682. this.Creator = nodeHeader.Attributes["CreatedBy"].Value;
  683. if (nodeHeader.Attributes["CreationTime"] != null)
  684. this.CreateTime = DateTime.Parse(nodeHeader.Attributes["CreationTime"].Value);
  685. if (nodeHeader.Attributes["LastRevisedBy"] != null)
  686. this.Revisor = nodeHeader.Attributes["LastRevisedBy"].Value;
  687. if (nodeHeader.Attributes["LastRevisionTime"] != null)
  688. this.ReviseTime = DateTime.Parse(nodeHeader.Attributes["LastRevisionTime"].Value);
  689. if (nodeHeader.Attributes["Description"] != null)
  690. this.Description = nodeHeader.Attributes["Description"].Value;
  691. string chamberType = string.Empty;
  692. if (nodeHeader.Attributes["RecipeChamberType"] != null)
  693. chamberType = nodeHeader.Attributes["RecipeChamberType"].Value;
  694. if (!string.IsNullOrEmpty(chamberType) && chamberType != RecipeChamberType)
  695. {
  696. LOG.Write($"{chamberType} is not accordance with {RecipeChamberType}");
  697. return false;
  698. }
  699. string version = string.Empty;
  700. if (nodeHeader.Attributes["RecipeVersion"] != null)
  701. version = nodeHeader.Attributes["RecipeVersion"].Value;
  702. if (!string.IsNullOrEmpty(version) && version != RecipeVersion)
  703. {
  704. LOG.Write($"{version} is not accordance with {RecipeVersion}");
  705. return false;
  706. }
  707. return true;
  708. }
  709. private void LoadSteps(ObservableCollection<EditorDataGridTemplateColumnBase> columns, Dictionary<string, ObservableCollection<Param>> popSettingColumns, XmlNodeList steps)
  710. {
  711. Steps.Clear();
  712. PopSettingSteps.Clear();
  713. StepTolerances.Clear();
  714. int index = 1;
  715. foreach (XmlNode nodeStep in steps)
  716. {
  717. ObservableCollection<Param> rows = this.CreateStep(columns, nodeStep);
  718. (rows[1] as StepParam).Value = index.ToString();
  719. CreateStepTolerance(columns, popSettingColumns, nodeStep, out ObservableCollection<Param> step, out ObservableCollection<Param> warning,
  720. out ObservableCollection<Param> alarm, out Dictionary<string, ObservableCollection<Param>> popSettingStep
  721. );
  722. StepTolerances.Add(step);
  723. (step[1] as DoubleParam).Value = index.ToString();
  724. StepTolerances.Add(warning);
  725. (warning[1] as DoubleParam).Value = "Warn(%)";
  726. StepTolerances.Add(alarm);
  727. (alarm[1] as DoubleParam).Value = "Alarm(%)";
  728. Steps.Add(rows);
  729. foreach (string key in popSettingStep.Keys)
  730. {
  731. if (!PopSettingSteps.ContainsKey(key))
  732. {
  733. PopSettingSteps.Add(key, new ObservableCollection<ObservableCollection<Param>>());
  734. }
  735. PopSettingSteps[key].Add(popSettingStep[key]);
  736. }
  737. index++;
  738. }
  739. }
  740. private void LoadConfigs(ObservableCollection<Param> configDefine, XmlNode configNode)
  741. {
  742. ConfigItems.Clear();
  743. foreach (var param in configDefine)
  744. {
  745. if (param is DoubleParam param1)
  746. {
  747. var config = new DoubleParam()
  748. {
  749. Name = param.Name,
  750. Value = param1.Value,
  751. DisplayName = param.DisplayName,
  752. Minimun = param1.Minimun,
  753. Maximun = param1.Maximun,
  754. Resolution = param1.Resolution
  755. };
  756. if (configNode != null && configNode.Attributes[param1.Name] != null)
  757. config.Value = configNode.Attributes[param1.Name].Value;
  758. ConfigItems.Add(config);
  759. }
  760. if (param is StringParam paramString)
  761. {
  762. var config = new StringParam()
  763. {
  764. Name = param.Name,
  765. Value = paramString.Value,
  766. DisplayName = param.DisplayName,
  767. };
  768. if (configNode != null && configNode.Attributes[paramString.Name] != null)
  769. config.Value = configNode.Attributes[paramString.Name].Value;
  770. ConfigItems.Add(config);
  771. }
  772. }
  773. }
  774. public ObservableCollection<Param> CloneStep(ObservableCollection<EditorDataGridTemplateColumnBase> _columns, ObservableCollection<Param> _sourceParams)
  775. {
  776. ObservableCollection<Param> targetParams = this.CreateStep(_columns);
  777. for (var index = 0; index < _sourceParams.Count; index++)
  778. {
  779. if (_sourceParams[index] is StringParam)
  780. {
  781. ((StringParam)targetParams[index]).Value = ((StringParam)_sourceParams[index]).Value;
  782. }
  783. else if (_sourceParams[index] is IntParam)
  784. {
  785. ((IntParam)targetParams[index]).Value = ((IntParam)_sourceParams[index]).Value;
  786. }
  787. else if (_sourceParams[index] is ComboxParam)
  788. {
  789. ((ComboxParam)targetParams[index]).Value = ((ComboxParam)_sourceParams[index]).Value;
  790. }
  791. else if (_sourceParams[index] is LoopComboxParam)
  792. {
  793. ((LoopComboxParam)targetParams[index]).Value = ((LoopComboxParam)_sourceParams[index]).Value;
  794. }
  795. else if (_sourceParams[index] is BoolParam)
  796. {
  797. ((BoolParam)targetParams[index]).Value = ((BoolParam)_sourceParams[index]).Value;
  798. }
  799. else if (_sourceParams[index] is IntParam)
  800. {
  801. ((IntParam)targetParams[index]).Value = ((IntParam)_sourceParams[index]).Value;
  802. }
  803. else if (_sourceParams[index] is DoubleParam)
  804. {
  805. ((DoubleParam)targetParams[index]).Value = ((DoubleParam)_sourceParams[index]).Value;
  806. }
  807. targetParams[index].Parent = targetParams;
  808. }
  809. return targetParams;
  810. }
  811. public string GetXmlString()
  812. {
  813. XmlElement nodeData = _doc.SelectSingleNode($"Aitex/TableRecipeData") as XmlElement;
  814. nodeData.SetAttribute("CreatedBy", Creator);
  815. nodeData.SetAttribute("CreationTime", CreateTime.ToString("yyyy-MM-dd HH:mm:ss"));
  816. nodeData.SetAttribute("LastRevisedBy", Revisor);
  817. nodeData.SetAttribute("LastRevisionTime", ReviseTime.ToString("yyyy-MM-dd HH:mm:ss"));
  818. nodeData.SetAttribute("Description", Description);
  819. nodeData.SetAttribute("RecipeChamberType", RecipeChamberType);
  820. nodeData.SetAttribute("RecipeVersion", RecipeVersion);
  821. XmlNode nodeModule = _doc.SelectSingleNode($"Aitex/TableRecipeData/Module[@Name='{_module}']");
  822. if (nodeModule == null)
  823. {
  824. nodeModule = _doc.CreateElement("Module");
  825. nodeData.AppendChild(nodeModule);
  826. }
  827. nodeModule.RemoveAll();
  828. (nodeModule as XmlElement).SetAttribute("Name", _module);
  829. int i = 0;
  830. foreach (ObservableCollection<Param> parameters in Steps)
  831. {
  832. XmlElement nodeWarning = _doc.CreateElement("Warning");
  833. XmlElement nodeAlarm = _doc.CreateElement("Alarm");
  834. Dictionary<string, XmlElement> nodePop = new Dictionary<string, XmlElement>();
  835. foreach (string key in PopEnable.Keys)
  836. {
  837. nodePop.Add(key, _doc.CreateElement(key));
  838. }
  839. XmlElement nodeStep = _doc.CreateElement("Step");
  840. int stepNo = -1;
  841. foreach (Param parameter in parameters)
  842. {
  843. if (parameter is StepParam)
  844. {
  845. int.TryParse(((StepParam)parameter).Value.ToString(), out stepNo);
  846. break;
  847. }
  848. }
  849. foreach (Param parameter in parameters)
  850. {
  851. if (parameter.Visible != System.Windows.Visibility.Visible)
  852. continue;
  853. if (ToleranceEnable)
  854. {
  855. if (parameter.EnableTolerance && StepTolerances.Count > (stepNo - 1) * 3 + 2)
  856. {
  857. var warning = StepTolerances[(stepNo - 1) * 3 + 1].SingleOrDefault(x => x.Name == parameter.Name);
  858. var alarm = StepTolerances[(stepNo - 1) * 3 + 2].SingleOrDefault(x => x.Name == parameter.Name);
  859. if (warning != null && warning is DoubleParam)
  860. nodeWarning.SetAttribute(parameter.Name, (warning as DoubleParam).Value);
  861. if (alarm != null && alarm is DoubleParam)
  862. nodeAlarm.SetAttribute(parameter.Name, (alarm as DoubleParam).Value);
  863. }
  864. }
  865. if (parameter is IntParam)
  866. nodeStep.SetAttribute(parameter.Name, ((IntParam)parameter).Value.ToString());
  867. else if (parameter is DoubleParam)
  868. nodeStep.SetAttribute(parameter.Name, ((DoubleParam)parameter).Value.ToString());
  869. else if (parameter is StringParam)
  870. nodeStep.SetAttribute(parameter.Name, ((StringParam)parameter).Value.ToString());
  871. else if (parameter is ComboxParam)
  872. nodeStep.SetAttribute(parameter.Name, ((ComboxParam)parameter).Options.First(x => x.DisplayName == ((ComboxParam)parameter).Value.ToString()).ControlName);
  873. else if (parameter is LoopComboxParam)
  874. nodeStep.SetAttribute(parameter.Name, ((LoopComboxParam)parameter).Value.ToString());
  875. else if (parameter is PositionParam)
  876. nodeStep.SetAttribute(parameter.Name, ((PositionParam)parameter).Value.ToString());
  877. else if (parameter is BoolParam)
  878. nodeStep.SetAttribute(parameter.Name, ((BoolParam)parameter).Value.ToString());
  879. else if (parameter is StepParam)
  880. nodeStep.SetAttribute(parameter.Name, ((StepParam)parameter).Value.ToString());
  881. else if (parameter is MultipleSelectParam)
  882. {
  883. List<string> selected = new List<string>();
  884. ((MultipleSelectParam)parameter).Options.Apply(
  885. opt =>
  886. {
  887. if (opt.IsChecked)
  888. selected.Add(opt.ControlName);
  889. }
  890. );
  891. nodeStep.SetAttribute(parameter.Name, string.Join(",", selected));
  892. }
  893. else if (parameter is PopSettingParam)
  894. {
  895. SetAttribute(PopSettingSteps[parameter.Name][i], nodePop[parameter.Name]);
  896. }
  897. }
  898. if (ToleranceEnable)
  899. {
  900. nodeStep.AppendChild(nodeWarning);
  901. nodeStep.AppendChild(nodeAlarm);
  902. }
  903. foreach (string key in PopEnable.Keys)
  904. {
  905. if (PopEnable[key])
  906. {
  907. nodeStep.AppendChild(nodePop[key]);
  908. }
  909. }
  910. nodeModule.AppendChild(nodeStep);
  911. i++;
  912. }
  913. XmlElement nodeConfig = _doc.CreateElement("Config");
  914. foreach (Param parameter in ConfigItems)
  915. {
  916. if (parameter.Visible == System.Windows.Visibility.Visible)
  917. {
  918. if (parameter is IntParam)
  919. nodeConfig.SetAttribute(parameter.Name, ((IntParam)parameter).Value.ToString());
  920. else if (parameter is DoubleParam)
  921. {
  922. string strValue = ((DoubleParam)parameter).Value;
  923. bool succed = double.TryParse(strValue, out double dValue);
  924. if (!succed)
  925. {
  926. MessageBox.Show($"The set value of {parameter.DisplayName} is {strValue}, not a valid value");
  927. return null;
  928. }
  929. var config = ConfigItems.Where(m => m.Name == parameter.Name).FirstOrDefault();
  930. if (config is DoubleParam param1)
  931. {
  932. if (param1.Minimun == 0 && param1.Maximun == 0)
  933. {
  934. //没有设定范围
  935. }
  936. else if (dValue > param1.Maximun || dValue < param1.Minimun)
  937. {
  938. MessageBox.Show($"The set value of {parameter.DisplayName} is {dValue}, out of the range {param1.Minimun}~{param1.Maximun}");
  939. return null;
  940. }
  941. }
  942. nodeConfig.SetAttribute(parameter.Name, ((DoubleParam)parameter).Value.ToString());
  943. }
  944. else if (parameter is StringParam)
  945. nodeConfig.SetAttribute(parameter.Name, ((StringParam)parameter).Value.ToString());
  946. else if (parameter is ComboxParam)
  947. nodeConfig.SetAttribute(parameter.Name, ((ComboxParam)parameter).Value.ToString());
  948. else if (parameter is LoopComboxParam)
  949. nodeConfig.SetAttribute(parameter.Name, ((LoopComboxParam)parameter).Value.ToString());
  950. else if (parameter is PositionParam)
  951. nodeConfig.SetAttribute(parameter.Name, ((PositionParam)parameter).Value.ToString());
  952. else if (parameter is BoolParam)
  953. nodeConfig.SetAttribute(parameter.Name, ((BoolParam)parameter).Value.ToString());
  954. else if (parameter is StepParam)
  955. nodeConfig.SetAttribute(parameter.Name, ((StepParam)parameter).Value.ToString());
  956. else if (parameter is MultipleSelectParam)
  957. {
  958. List<string> selected = new List<string>();
  959. ((MultipleSelectParam)parameter).Options.Apply(
  960. opt =>
  961. {
  962. if (opt.IsChecked)
  963. selected.Add(opt.ControlName);
  964. }
  965. );
  966. nodeConfig.SetAttribute(parameter.Name, string.Join(",", selected));
  967. }
  968. }
  969. }
  970. nodeModule.AppendChild(nodeConfig);
  971. return _doc.OuterXml;
  972. }
  973. private void SetAttribute(ObservableCollection<Param> Parameters, XmlElement PopSettingStep)
  974. {
  975. if (Parameters != null)
  976. foreach (Param parameter1 in Parameters)
  977. {
  978. if (parameter1.Visible != System.Windows.Visibility.Visible)
  979. continue;
  980. if (parameter1 is IntParam)
  981. PopSettingStep.SetAttribute(parameter1.Name, ((IntParam)parameter1).Value.ToString());
  982. else if (parameter1 is DoubleParam)
  983. PopSettingStep.SetAttribute(parameter1.Name, ((DoubleParam)parameter1).Value.ToString());
  984. else if (parameter1 is StringParam)
  985. PopSettingStep.SetAttribute(parameter1.Name, ((StringParam)parameter1).Value.ToString());
  986. else if (parameter1 is ComboxParam)
  987. PopSettingStep.SetAttribute(parameter1.Name, ((ComboxParam)parameter1).Value.ToString());
  988. else if (parameter1 is LoopComboxParam)
  989. PopSettingStep.SetAttribute(parameter1.Name, ((LoopComboxParam)parameter1).Value.ToString());
  990. else if (parameter1 is PositionParam)
  991. PopSettingStep.SetAttribute(parameter1.Name, ((PositionParam)parameter1).Value.ToString());
  992. else if (parameter1 is BoolParam)
  993. PopSettingStep.SetAttribute(parameter1.Name, ((BoolParam)parameter1).Value.ToString());
  994. else if (parameter1 is StepParam)
  995. PopSettingStep.SetAttribute(parameter1.Name, ((StepParam)parameter1).Value.ToString());
  996. else if (parameter1 is MultipleSelectParam)
  997. {
  998. List<string> selected1 = new List<string>();
  999. ((MultipleSelectParam)parameter1).Options.Apply(
  1000. opt =>
  1001. {
  1002. if (opt.IsChecked)
  1003. selected1.Add(opt.ControlName);
  1004. }
  1005. );
  1006. PopSettingStep.SetAttribute(parameter1.Name, string.Join(",", selected1));
  1007. }
  1008. }
  1009. }
  1010. public string ToXmlString()
  1011. {
  1012. StringBuilder builder = new StringBuilder();
  1013. builder.Append("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
  1014. builder.Append(string.Format("<Aitex><TableRecipeData CreatedBy=\"{0}\" CreationTime=\"{1}\" LastRevisedBy=\"{2}\" LastRevisionTime=\"{3}\" Description=\"{4}\" RecipeChamberType=\"{5}\" RecipeVersion=\"{6}\">", this.Creator, this.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"), this.Revisor, this.ReviseTime.ToString("yyyy-MM-dd HH:mm:ss"), this.Description, RecipeChamberType, RecipeVersion));
  1015. foreach (ObservableCollection<Param> parameters in Steps)
  1016. {
  1017. builder.Append("<Step ");
  1018. foreach (Param parameter in parameters)
  1019. {
  1020. if (parameter.Visible == System.Windows.Visibility.Visible)
  1021. {
  1022. if (parameter is IntParam)
  1023. builder.Append(parameter.Name + "=\"" + ((IntParam)parameter).Value + "\" ");
  1024. else if (parameter is DoubleParam)
  1025. builder.Append(parameter.Name + "=\"" + ((DoubleParam)parameter).Value + "\" ");
  1026. else if (parameter is StringParam)
  1027. builder.Append(parameter.Name + "=\"" + ((StringParam)parameter).Value + "\" ");
  1028. else if (parameter is ComboxParam)
  1029. builder.Append(parameter.Name + "=\"" + ((ComboxParam)parameter).Value + "\" ");
  1030. else if (parameter is LoopComboxParam)
  1031. builder.Append(parameter.Name + "=\"" + ((LoopComboxParam)parameter).Value + "\" ");
  1032. else if (parameter is PositionParam)
  1033. builder.Append(parameter.Name + "=\"" + ((PositionParam)parameter).Value + "\" ");
  1034. else if (parameter is BoolParam)
  1035. builder.Append(parameter.Name + "=\"" + ((BoolParam)parameter).Value + "\" ");
  1036. else if (parameter is StepParam)
  1037. builder.Append(parameter.Name + "=\"" + ((StepParam)parameter).Value + "\" ");
  1038. else if (parameter is MultipleSelectParam)
  1039. {
  1040. List<string> selected = new List<string>();
  1041. ((MultipleSelectParam)parameter).Options.Apply(
  1042. opt =>
  1043. {
  1044. if (opt.IsChecked)
  1045. selected.Add(opt.ControlName);
  1046. }
  1047. );
  1048. builder.Append(parameter.Name + "=\"" + string.Join(",", selected) + "\" ");
  1049. }
  1050. }
  1051. }
  1052. builder.Append("/>");
  1053. }
  1054. builder.Append("<Config ");
  1055. foreach (Param parameter in ConfigItems)
  1056. {
  1057. if (parameter.Visible == System.Windows.Visibility.Visible)
  1058. {
  1059. if (parameter is IntParam)
  1060. builder.Append(parameter.Name + "=\"" + ((IntParam)parameter).Value + "\" ");
  1061. else if (parameter is DoubleParam)
  1062. builder.Append(parameter.Name + "=\"" + ((DoubleParam)parameter).Value + "\" ");
  1063. else if (parameter is StringParam)
  1064. builder.Append(parameter.Name + "=\"" + ((StringParam)parameter).Value + "\" ");
  1065. else if (parameter is ComboxParam)
  1066. builder.Append(parameter.Name + "=\"" + ((ComboxParam)parameter).Value + "\" ");
  1067. else if (parameter is LoopComboxParam)
  1068. builder.Append(parameter.Name + "=\"" + ((LoopComboxParam)parameter).Value + "\" ");
  1069. else if (parameter is PositionParam)
  1070. builder.Append(parameter.Name + "=\"" + ((PositionParam)parameter).Value + "\" ");
  1071. else if (parameter is BoolParam)
  1072. builder.Append(parameter.Name + "=\"" + ((BoolParam)parameter).Value + "\" ");
  1073. else if (parameter is StepParam)
  1074. builder.Append(parameter.Name + "=\"" + ((StepParam)parameter).Value + "\" ");
  1075. else if (parameter is MultipleSelectParam)
  1076. {
  1077. List<string> selected = new List<string>();
  1078. ((MultipleSelectParam)parameter).Options.Apply(
  1079. opt =>
  1080. {
  1081. if (opt.IsChecked)
  1082. selected.Add(opt.ControlName);
  1083. }
  1084. );
  1085. builder.Append(parameter.Name + "=\"" + string.Join(",", selected) + "\" ");
  1086. }
  1087. }
  1088. }
  1089. builder.Append("/>");
  1090. builder.Append("</TableRecipeData></Aitex>");
  1091. return builder.ToString();
  1092. }
  1093. }
  1094. }