MainParameterEditViewModel.cs 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665
  1. using Aitex.Core.RT.SCCore;
  2. using Caliburn.Micro;
  3. using Caliburn.Micro.Core;
  4. using MECF.Framework.Common.DataCenter;
  5. using MECF.Framework.Common.OperationCenter;
  6. using MECF.Framework.UI.Client.CenterViews.Configs.SystemConfig;
  7. using MECF.Framework.UI.Client.CenterViews.Dialogs;
  8. using MECF.Framework.UI.Client.CenterViews.Editors;
  9. using MECF.Framework.UI.Client.CenterViews.Editors.Recipe;
  10. using MECF.Framework.UI.Client.ClientBase;
  11. using OpenSEMI.ClientBase;
  12. using SciChart.Core.Extensions;
  13. using System;
  14. using System.Collections.Generic;
  15. using System.Collections.ObjectModel;
  16. using System.Globalization;
  17. using System.Linq;
  18. using System.Text;
  19. using System.Threading.Tasks;
  20. using System.Windows;
  21. using System.Windows.Controls;
  22. using System.Windows.Data;
  23. using System.Windows.Input;
  24. using System.Windows.Threading;
  25. namespace MECF.Framework.UI.Client.CenterViews.Parameter
  26. {
  27. public class MainParameterEditViewModel : ModuleUiViewModelBase, ISupportMultipleSystem
  28. {
  29. public bool IsPermission { get => this.Permission == 3; }
  30. public List<ParamBase> ParameterTree { get; set; } = new List<ParamBase>();
  31. public ObservableCollection<TempSetData> HeadLst { get; set; } = new ObservableCollection<TempSetData>();
  32. public ObservableCollection<TempSetData> PIDHeadLst { get; set; } = new ObservableCollection<TempSetData>();
  33. public ObservableCollection<ConfigItem> StepNames { get; set; } = new ObservableCollection<ConfigItem>();
  34. private ConfigNode _currentNode;
  35. public ConfigNode CurrentNode
  36. {
  37. get { return _currentNode; }
  38. set { _currentNode = value; this.NotifyOfPropertyChange(nameof(CurrentNode)); }
  39. }
  40. private string _allZoneValue = "0";
  41. public string AllZoneValue
  42. {
  43. get { return _allZoneValue; }
  44. set { _allZoneValue = value; this.NotifyOfPropertyChange(nameof(AllZoneValue)); }
  45. }
  46. private ConfigNode _currentSubNode;
  47. public ConfigNode CurrentSubNode
  48. {
  49. get { return _currentSubNode; }
  50. set { _currentSubNode = value; this.NotifyOfPropertyChange(nameof(CurrentSubNode)); }
  51. }
  52. private ConfigNode _currentTwoSubNode;
  53. public ConfigNode CurrentTwoSubNode
  54. {
  55. get { return _currentTwoSubNode; }
  56. set { _currentTwoSubNode = value; this.NotifyOfPropertyChange(nameof(CurrentTwoSubNode)); }
  57. }
  58. private List<ConfigNode> _ConfigNodes = new List<ConfigNode>();
  59. public List<ConfigNode> ConfigNodes
  60. {
  61. get { return _ConfigNodes; }
  62. set { _ConfigNodes = value; NotifyOfPropertyChange("ConfigNodes"); }
  63. }
  64. private string _defaultUnit = "Pa";
  65. public string DefaultUnit
  66. {
  67. get
  68. {
  69. return _defaultUnit;
  70. }
  71. set
  72. {
  73. _defaultUnit = value;
  74. NotifyOfPropertyChange("DefaultUnit");
  75. }
  76. }
  77. private ConfigNode _rootNode;
  78. private string _CurrentNodeName = string.Empty;
  79. private string path;
  80. private string currentValue;
  81. private ObservableCollection<PageValue> valueList { get; set; } = new ObservableCollection<PageValue>();
  82. private ObservableCollection<PageValue> newValueList { get; set; } = new ObservableCollection<PageValue>();
  83. protected override void OnInitialize()
  84. {
  85. base.OnInitialize();
  86. this.SystemName = "System";
  87. ConfigNodes = SystemConfigProvider.Instance.GetConfigTree(SystemName).SubNodes;
  88. _rootNode = SystemConfigProvider.Instance.GetConfig(true);
  89. InitTree();
  90. }
  91. protected override void OnActivate()
  92. {
  93. base.OnActivate();
  94. }
  95. private void InitTree()
  96. {
  97. var node = SystemConfigProvider.Instance.GetConfigTree(SystemName).SubNodes;
  98. ParameterTree.Add(new ParamBase() { ID = 1, ParentID = 0, Name = "StepName", ConfigName = "StepName" });
  99. ParameterTree.Add(new ParamBase() { ID = 2, ParentID = 0, Name = "StepGroup", ConfigName = "StepGroup" });
  100. //ParameterTree.Add(new ParamBase() { ID = 2, ParentID = 0, Name = "TempSetting", ConfigName = "TempSetting" });
  101. //ParameterTree.Add(new ParamBase() { ID = 3, ParentID = 0, Name = "TempSetting", ConfigName = "TempSetting" });
  102. ParameterTree = this.LoadTreeView(0);
  103. foreach (var item in ParameterTree)
  104. {
  105. InitAllParameterTree(item);
  106. }
  107. var stepNameNode = FindNodeByName(_rootNode, $"{strHeader}.StepName");
  108. if (stepNameNode != null && stepNameNode.Items.Count > 0)
  109. {
  110. stepNameNode.Items.ForEach(x => StepNames.Add(x));
  111. CurrentNode = stepNameNode;
  112. }
  113. this.GetHeaderConfig();
  114. }
  115. string strHeader = "PM1.RecipeEditParameter";
  116. private void InitAllParameterTree(ParamBase para)
  117. {
  118. CurrentNode = new ConfigNode();
  119. CurrentNode = FindNodeByName(_rootNode, $"{strHeader}.{para.ConfigName}");
  120. InitItemsCurrentValue(CurrentNode, true);
  121. if (CurrentNode.SubNodes != null)
  122. {
  123. foreach (var item in CurrentNode.SubNodes)
  124. {
  125. InitItemsCurrentValue(item, true);
  126. }
  127. }
  128. }
  129. private Visibility _stepNameVisibility = Visibility.Visible;
  130. public Visibility StepNameVisibility
  131. {
  132. get => _stepNameVisibility;
  133. set
  134. {
  135. _stepNameVisibility = value;
  136. NotifyOfPropertyChange(nameof(StepNameVisibility));
  137. }
  138. }
  139. private Visibility _stepGroupSettingVisibility = Visibility.Hidden;
  140. public Visibility StepGroupSettingVisibility
  141. {
  142. get => _stepGroupSettingVisibility;
  143. set
  144. {
  145. _stepGroupSettingVisibility = value;
  146. NotifyOfPropertyChange(nameof(StepGroupSettingVisibility));
  147. }
  148. }
  149. private Visibility _tempSettingeVisibility = Visibility.Hidden;
  150. public Visibility TempSettingVisibility
  151. {
  152. get => _tempSettingeVisibility;
  153. set
  154. {
  155. _tempSettingeVisibility = value;
  156. NotifyOfPropertyChange(nameof(TempSettingVisibility));
  157. }
  158. }
  159. private List<ParamBase> LoadTreeView(int id)
  160. {
  161. List<ParamBase> node = ParameterTree.FindAll(s => s.ParentID.Equals(id));
  162. foreach (var item in node)
  163. {
  164. item.Children = LoadTreeView(item.ID);
  165. }
  166. return node;
  167. }
  168. public void HideAllCanvas()
  169. {
  170. StepNameVisibility = Visibility.Hidden;
  171. TempSettingVisibility = Visibility.Hidden;
  172. StepGroupSettingVisibility = Visibility.Hidden;
  173. }
  174. public void TreeViewSelectedItemChanged(object obj)
  175. {
  176. valueList.Clear();
  177. var view = GetView() as MainParameterEditView;
  178. HideAllCanvas();
  179. ParamBase para = obj as ParamBase;
  180. string strHeader = "PM1.RecipeEditParameter";
  181. switch (para.ConfigName)
  182. {
  183. case "StepName":
  184. StepNameVisibility = Visibility.Visible;
  185. break;
  186. case "StepGroup":
  187. CurrentNode = FindNodeByName(_rootNode, $"{strHeader}.{para.ConfigName}");
  188. StepGroupSettingVisibility = Visibility.Visible;
  189. break;
  190. case "TempSetting":
  191. CurrentNode = FindNodeByName(_rootNode, $"{strHeader}.{para.ConfigName}");
  192. TempSettingVisibility = Visibility.Visible;
  193. if (CurrentNode.SubNodes.Where(x => x.StabilizeBoolValue == true).Count() <= 0)
  194. {
  195. CurrentNode.SubNodes[0].StabilizeBoolValue = true;
  196. }
  197. CurrentSubNode = CurrentNode.SubNodes.FirstOrDefault(x => x.StabilizeBoolValue);
  198. break;
  199. }
  200. }
  201. public void StepGroupEdit(string groupName)
  202. {
  203. var windowManager = IoC.Get<IWindowManager>();
  204. StepGroupEditViewModel recipeStepNameViewModel = new StepGroupEditViewModel();
  205. recipeStepNameViewModel.StepGroupName = groupName;
  206. if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeStepNameViewModel, null, "Step Group Edit"))
  207. {
  208. var selectStepId = recipeStepNameViewModel.StepIdList.Where(a => a.IsExpanded).Select(a => a.Name).ToList();
  209. InvokeClient.Instance.Service.DoOperation($"{SystemName}.SetConfig", $"PM1.RecipeEditParameter.StepGroup.{groupName}", string.Join(",", selectStepId.ToArray()));
  210. }
  211. }
  212. private void InitItemsCurrentValue(ConfigNode node, bool initSubItems = true)
  213. {
  214. if (node == null) return;
  215. _CurrentNodeName = string.IsNullOrEmpty(node.Path) ? node.Name : $"{node.Path}.{node.Name}";
  216. if (node.Items == null || node.Items.Count <= 0)
  217. {
  218. if (!initSubItems) return;
  219. foreach (var item in node.SubNodes)
  220. {
  221. InitItemsCurrentValue(item);
  222. }
  223. }
  224. else
  225. {
  226. GetDataOfConfigItems(node);
  227. }
  228. }
  229. private void GetDataOfConfigItems(ConfigNode node)
  230. {
  231. if (node.Items == null)
  232. return;
  233. List<string> allItems = new List<string>();
  234. for (int i = 0; i < node.Items.Count; i++)
  235. {
  236. string key = String.Format("{0}{1}{2}", _CurrentNodeName, ".", node.Items[i].Name);
  237. allItems.Add(key);
  238. }
  239. List<string> newallItems = allItems.Distinct().ToList();
  240. var DictItems = QueryDataClient.Instance.Service.PollConfig(newallItems);
  241. for (int i = 0; i < node.Items.Count; i++)
  242. {
  243. string key = String.Format("{0}{1}{2}", _CurrentNodeName, ".", node.Items[i].Name);
  244. node.Items[i].CurrentValue = DictItems.ContainsKey(key) ? DictItems[key].ToString() : "";
  245. node.Items[i].Path = key;
  246. //if (CurrenItems[i].Path.Contains("PM1.RecipeEditParameter.PressureStabilizeTable"))
  247. // DefaultUnit = CurrenItems[i].Unit;
  248. if (node.Items[i].Type == DataType.Bool)
  249. {
  250. bool value;
  251. if (bool.TryParse(node.Items[i].CurrentValue, out value))
  252. {
  253. node.Items[i].BoolValue = value;
  254. node.Items[i].CurrentValue = value ? "Yes" : "No";
  255. }
  256. }
  257. else
  258. node.Items[i].StringValue = node.Items[i].CurrentValue;
  259. }
  260. }
  261. public void MenuCommand(object obj, object menuLevel)
  262. {
  263. RadioButton radioButton = obj as RadioButton;
  264. switch ((string)menuLevel)
  265. {
  266. case "LevelOne":
  267. CurrentSubNode = CurrentNode.SubNodes.Find((x) => x.Name == radioButton.ToolTip.ToString());
  268. break;
  269. case "LevelTwo":
  270. CurrentTwoSubNode = CurrentSubNode.SubNodes.Find((x) => x.Name == radioButton.ToolTip.ToString());
  271. break;
  272. default:
  273. break;
  274. }
  275. }
  276. public void SetValue(object obj)
  277. {
  278. if (CurrentNode.Items == null || CurrentNode.Items.Count == 0) return;
  279. ConfigItem item = null;
  280. if (obj is Control)
  281. item = CurrentNode.Items.ToList().Find((x) => x.Name == (obj as Control).ToolTip.ToString());
  282. else
  283. item = obj as ConfigItem;
  284. if (item == null) return;
  285. if (item.Type == DataType.String)
  286. {
  287. currentValue = item.CurrentValue;
  288. path = item.Path;
  289. FullKeyboard fullKeyboard = new FullKeyboard("", currentValue);
  290. if ((bool)fullKeyboard.ShowDialog())
  291. {
  292. InvokeClient.Instance.Service.DoOperation($"{SystemName}.SetConfig", path, fullKeyboard.ValueString);
  293. currentValue = fullKeyboard.ValueString;
  294. item.CurrentValue = fullKeyboard.ValueString;
  295. }
  296. valueList.Add(new PageValue() { Path = path, CurrentValue = currentValue });
  297. }
  298. else
  299. {
  300. InputDialogViewModel dialog = new InputDialogViewModel();
  301. dialog.Item = item;
  302. dialog.DisplayName = "Set Value";
  303. WindowManager wm = new WindowManager();
  304. bool? bret = wm.ShowDialog(dialog);
  305. if ((bool)bret)
  306. {
  307. item.StringValue = dialog.DialogResult;
  308. //key :System.IsSimulatorMode
  309. //value: true or false 都是字符串
  310. //input check
  311. string value;
  312. if (item.Type == DataType.Bool)
  313. {
  314. if (item.StringValue.Equals("Yes", StringComparison.CurrentCultureIgnoreCase))
  315. item.BoolValue = true;
  316. else if (item.StringValue.Equals("No", StringComparison.CurrentCultureIgnoreCase))
  317. item.BoolValue = false;
  318. else
  319. {
  320. DialogBox.ShowWarning("The Value Should be Yes Or No.");
  321. return;
  322. }
  323. value = item.BoolValue.ToString().ToLower();
  324. }
  325. else
  326. {
  327. if (item.Type == DataType.Int)
  328. {
  329. int iValue;
  330. if (int.TryParse(item.StringValue, out iValue))
  331. {
  332. if (!double.IsNaN(item.Max) && !double.IsNaN(item.Min))
  333. {
  334. if (iValue > item.Max || iValue < item.Min)
  335. {
  336. DialogBox.ShowWarning(string.Format("The value should be between {0} and {1}.", ((int)item.Min).ToString(), ((int)item.Max).ToString()));
  337. return;
  338. }
  339. }
  340. }
  341. else
  342. {
  343. DialogBox.ShowWarning("Please input valid data.");
  344. return;
  345. }
  346. value = item.StringValue;
  347. }
  348. else if (item.Type == DataType.Double)
  349. {
  350. double fValue;
  351. if (double.TryParse(item.StringValue, out fValue))
  352. {
  353. if (!double.IsNaN(item.Max) && !double.IsNaN(item.Min))
  354. {
  355. if (fValue > item.Max || fValue < item.Min)
  356. {
  357. DialogBox.ShowWarning(string.Format("The value should be between {0} and {1}.", item.Min.ToString(), item.Max.ToString()));
  358. return;
  359. }
  360. string[] box = fValue.ToString().Split('.');
  361. if (box.Length > 1 && box[1].Length > 3)
  362. {
  363. DialogBox.ShowWarning(string.Format("The value should be more than three decimal places"));
  364. return;
  365. }
  366. }
  367. }
  368. else
  369. {
  370. DialogBox.ShowWarning("Please input valid data.");
  371. return;
  372. }
  373. value = item.StringValue;
  374. }
  375. else
  376. value = item.StringValue;
  377. }
  378. string key = String.Format("{0}{1}{2}", _CurrentNodeName, ".", item.Name);
  379. path = item.Path;
  380. currentValue = value;
  381. valueList.Add(new PageValue() { Path = path, CurrentValue = currentValue });
  382. }
  383. }
  384. }
  385. public void AllZoneTextChanged()
  386. {
  387. if (CurrentSubNode.Items == null || CurrentSubNode.Items.Count == 0) return;
  388. newValueList = new ObservableCollection<PageValue>();
  389. valueList = new ObservableCollection<PageValue>();
  390. foreach (var item in CurrentSubNode.Items)
  391. {
  392. item.CurrentValue = AllZoneValue;
  393. newValueList.Add(new PageValue() { Path = item.Path, CurrentValue = AllZoneValue });
  394. }
  395. }
  396. public void SetCurrentSubNodeValue(object obj)
  397. {
  398. if (CurrentSubNode.Items == null || CurrentSubNode.Items.Count == 0) return;
  399. ConfigItem item = null;
  400. if (obj is Control)
  401. item = CurrentSubNode.Items.ToList().Find((x) => x.Name == (obj as Control).ToolTip.ToString());
  402. else
  403. item = obj as ConfigItem;
  404. if (item == null) return;
  405. if (item.Type == DataType.String)
  406. {
  407. currentValue = item.CurrentValue;
  408. path = item.Path;
  409. FullKeyboard fullKeyboard = new FullKeyboard("", currentValue);
  410. if ((bool)fullKeyboard.ShowDialog())
  411. {
  412. InvokeClient.Instance.Service.DoOperation($"{SystemName}.SetConfig", path, fullKeyboard.ValueString);
  413. currentValue = fullKeyboard.ValueString;
  414. item.CurrentValue = fullKeyboard.ValueString;
  415. }
  416. valueList.Add(new PageValue() { Path = path, CurrentValue = currentValue });
  417. }
  418. else
  419. {
  420. InputDialogViewModel dialog = new InputDialogViewModel();
  421. dialog.Item = item;
  422. dialog.DisplayName = "Set Value";
  423. WindowManager wm = new WindowManager();
  424. bool? bret = wm.ShowDialog(dialog);
  425. if ((bool)bret)
  426. {
  427. item.StringValue = dialog.DialogResult;
  428. //key :System.IsSimulatorMode
  429. //value: true or false 都是字符串
  430. //input check
  431. string value;
  432. if (item.Type == DataType.Bool)
  433. {
  434. if (item.StringValue.Equals("Yes", StringComparison.CurrentCultureIgnoreCase))
  435. item.BoolValue = true;
  436. else if (item.StringValue.Equals("No", StringComparison.CurrentCultureIgnoreCase))
  437. item.BoolValue = false;
  438. else
  439. {
  440. DialogBox.ShowWarning("The Value Should be Yes Or No.");
  441. return;
  442. }
  443. value = item.BoolValue.ToString().ToLower();
  444. }
  445. else
  446. {
  447. if (item.Type == DataType.Int)
  448. {
  449. int iValue;
  450. if (int.TryParse(item.StringValue, out iValue))
  451. {
  452. if (!double.IsNaN(item.Max) && !double.IsNaN(item.Min))
  453. {
  454. if (iValue > item.Max || iValue < item.Min)
  455. {
  456. DialogBox.ShowWarning(string.Format("The value should be between {0} and {1}.", ((int)item.Min).ToString(), ((int)item.Max).ToString()));
  457. return;
  458. }
  459. }
  460. }
  461. else
  462. {
  463. DialogBox.ShowWarning("Please input valid data.");
  464. return;
  465. }
  466. value = item.StringValue;
  467. }
  468. else if (item.Type == DataType.Double)
  469. {
  470. double fValue;
  471. if (double.TryParse(item.StringValue, out fValue))
  472. {
  473. if (!double.IsNaN(item.Max) && !double.IsNaN(item.Min))
  474. {
  475. if (fValue > item.Max || fValue < item.Min)
  476. {
  477. DialogBox.ShowWarning(string.Format("The value should be between {0} and {1}.", item.Min.ToString(), item.Max.ToString()));
  478. return;
  479. }
  480. string[] box = fValue.ToString().Split('.');
  481. if (box.Length > 1 && box[1].Length > 3)
  482. {
  483. DialogBox.ShowWarning(string.Format("The value should be more than three decimal places"));
  484. return;
  485. }
  486. }
  487. }
  488. else
  489. {
  490. DialogBox.ShowWarning("Please input valid data.");
  491. return;
  492. }
  493. value = item.StringValue;
  494. }
  495. else
  496. value = item.StringValue;
  497. }
  498. path = item.Path;
  499. currentValue = value;
  500. valueList.Add(new PageValue() { Path = path, CurrentValue = currentValue });
  501. }
  502. }
  503. }
  504. public void SetStepNameValue(object obj, MouseButtonEventArgs e)
  505. {
  506. e.Handled = true;
  507. if (StepNames == null || StepNames.Count == 0) return;
  508. ConfigItem item = null;
  509. if (obj is Control)
  510. item = StepNames.ToList().Find((x) => x.Name == (obj as Control).ToolTip.ToString());
  511. else
  512. item = obj as ConfigItem;
  513. if (item == null) return;
  514. if (item.Type == DataType.String)
  515. {
  516. currentValue = item.CurrentValue;
  517. path = item.Path;
  518. FullKeyboard fullKeyboard = new FullKeyboard("", currentValue);
  519. if ((bool)fullKeyboard.ShowDialog())
  520. {
  521. InvokeClient.Instance.Service.DoOperation($"{SystemName}.SetConfig", path, fullKeyboard.ValueString);
  522. currentValue = fullKeyboard.ValueString;
  523. item.CurrentValue = fullKeyboard.ValueString;
  524. }
  525. valueList.Add(new PageValue() { Path = path, CurrentValue = currentValue });
  526. }
  527. else
  528. {
  529. InputDialogViewModel dialog = new InputDialogViewModel();
  530. dialog.Item = item;
  531. dialog.DisplayName = "Set Value";
  532. WindowManager wm = new WindowManager();
  533. bool? bret = wm.ShowDialog(dialog);
  534. if ((bool)bret)
  535. {
  536. item.StringValue = dialog.DialogResult;
  537. //key :System.IsSimulatorMode
  538. //value: true or false 都是字符串
  539. //input check
  540. string value;
  541. value = item.StringValue;
  542. path = item.Path;
  543. currentValue = value;
  544. valueList.Add(new PageValue() { Path = path, CurrentValue = currentValue });
  545. }
  546. }
  547. }
  548. public void SaveParameter()
  549. {
  550. if (newValueList != null && newValueList.Count > 0)
  551. {
  552. var one = newValueList[0];
  553. if (one.Path.Contains("TempSetting"))
  554. {
  555. foreach (var item in valueList)
  556. {
  557. newValueList.Add(item);
  558. }
  559. valueList.Clear();
  560. valueList = newValueList;
  561. }
  562. }
  563. foreach (var item in valueList)
  564. {
  565. InvokeClient.Instance.Service.DoOperation($"{SystemName}.SetConfig", item.Path, item.CurrentValue);
  566. }
  567. valueList = new ObservableCollection<PageValue>();
  568. newValueList = new ObservableCollection<PageValue>();
  569. }
  570. private string[] HeaterNameList = new string[5] { "HeaterU", "HeaterCU", "HeaterC", "HeaterCL", "HeaterL" };
  571. public void GetHeaderConfig()
  572. {
  573. HeadLst.Clear();
  574. for (int i = 0; i < 5; i++)
  575. {
  576. var configHeater = (string)QueryDataClient.Instance.Service.GetConfig($"PM1.Heater.{HeaterNameList[i]}.DisplayName");
  577. TempSetData item = new TempSetData(configHeater);
  578. item.SetValue.Value = configHeater;
  579. HeadLst.Add(item);
  580. }
  581. }
  582. private ConfigNode FindNodeByName(ConfigNode parentNode, string strName)
  583. {
  584. string strCates = strName.Split('.')[0];
  585. ConfigNode node = parentNode.SubNodes.Find((x) => x.Name == strCates);
  586. if (node == null)
  587. return parentNode;
  588. else
  589. return FindNodeByName(node, strName.Replace(strCates + ".", ""));
  590. }
  591. }
  592. public class ParamBase
  593. {
  594. public int ID { get; set; }
  595. public string Name { get; set; }
  596. public int ParentID { get; set; }
  597. public string ConfigName { get; set; }
  598. public List<ParamBase> Children { get; set; }
  599. public ParamBase()
  600. {
  601. Children = new List<ParamBase>();
  602. }
  603. }
  604. public class ParameterConvert : IValueConverter
  605. {
  606. public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
  607. {
  608. return value.ToString().Replace("Table", "").Replace("LineNo", "");
  609. }
  610. public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
  611. {
  612. throw new NotImplementedException();
  613. }
  614. }
  615. }