RecipeConditionCheckSetViewModel.cs 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using FurnaceUI.Models;
  7. using System.Windows;
  8. using Caliburn.Micro.Core;
  9. using System.Windows.Controls;
  10. using Aitex.Core.RT.SCCore;
  11. using Aitex.Core.Util;
  12. using Aitex.Core.Common.DeviceData;
  13. using MECF.Framework.UI.Client.CenterViews.Configs.SystemConfig;
  14. using MECF.Framework.Common.DataCenter;
  15. namespace FurnaceUI.Views.Editors
  16. {
  17. public class RecipeConditionCheckSetViewModel : FurnaceUIViewModelBase
  18. {
  19. public RecipeCondition RecipeConditions { get; set; } = new RecipeCondition();
  20. public string O2Unit
  21. {
  22. get
  23. {
  24. return $"O2 Density({QueryDataClient.Instance.Service.GetConfig("PM1.APC.PressureUnit")})";
  25. }
  26. }
  27. public bool IsSave { get; set; } = false;
  28. public bool IsNone { get; set; } = false;
  29. public RecipeConditionCheckSetViewModel()
  30. {
  31. RecipeConditions.CreateDefaultValues();
  32. }
  33. private int _tempJudgTentTime;
  34. public int TempJudgTentTime
  35. {
  36. get => _tempJudgTentTime;
  37. set
  38. {
  39. _tempJudgTentTime = value;
  40. NotifyOfPropertyChange("TempJudgTentTime");
  41. }
  42. }
  43. private float _tempMax;
  44. public float TempMax
  45. {
  46. get => _tempMax;
  47. set
  48. {
  49. _tempMax = value;
  50. NotifyOfPropertyChange("TempMax");
  51. }
  52. }
  53. private float _tempMin;
  54. public float TempMin
  55. {
  56. get => _tempMin;
  57. set
  58. {
  59. _tempMin = value;
  60. NotifyOfPropertyChange("TempMin");
  61. }
  62. }
  63. private int _pressureJudgTentTime;
  64. public int PressureJudgTentTime
  65. {
  66. get => _pressureJudgTentTime;
  67. set
  68. {
  69. _pressureJudgTentTime = value;
  70. NotifyOfPropertyChange("PressureJudgTentTime");
  71. }
  72. }
  73. private float _pressureMax;
  74. public float PressureMax
  75. {
  76. get => _pressureMax;
  77. set
  78. {
  79. _pressureMax = value;
  80. NotifyOfPropertyChange("PressureMax");
  81. }
  82. }
  83. private float _pressureMin;
  84. public float PressureMin
  85. {
  86. get => _pressureMin;
  87. set
  88. {
  89. _pressureMin = value;
  90. NotifyOfPropertyChange("PressureMin");
  91. }
  92. }
  93. private float _pressureDelayTime;
  94. public float PressureDelayTime
  95. {
  96. get => _pressureDelayTime;
  97. set
  98. {
  99. _pressureDelayTime = value;
  100. NotifyOfPropertyChange("PressureDelayTime");
  101. }
  102. }
  103. private float _pressureScaleMax;
  104. public float PressureScaleMax
  105. {
  106. get => _pressureScaleMax;
  107. set
  108. {
  109. _pressureScaleMax = value;
  110. NotifyOfPropertyChange("PressureScaleMax");
  111. }
  112. }
  113. private float _reachTempValue;
  114. public float ReachTempValue
  115. {
  116. get => _reachTempValue;
  117. set
  118. {
  119. _reachTempValue = value;
  120. RecipeConditions.ReachTempValue = value;
  121. NotifyOfPropertyChange("ReachTempValue");
  122. }
  123. }
  124. private int _O2DensityValue;
  125. public int O2DensityValue
  126. {
  127. get => _O2DensityValue;
  128. set
  129. {
  130. _O2DensityValue = value;
  131. RecipeConditions.O2DensityValue = value;
  132. NotifyOfPropertyChange("O2DensityValue");
  133. }
  134. }
  135. private float _reachPressureValue;
  136. public float ReachPressureValue
  137. {
  138. get => _reachPressureValue;
  139. set
  140. {
  141. _reachPressureValue = value;
  142. RecipeConditions.ReachPressureValue = value;
  143. NotifyOfPropertyChange("ReachPressureValue");
  144. }
  145. }
  146. public string PressureUnit { get; set; }
  147. public string PressureName { get; set; }
  148. public bool IsEnable => CGlobal.RecipeProcessEditViewEnable;//是否是View模式
  149. private List<string> _tempAssociateParameterTable;
  150. private List<string> _tempDisplayName;
  151. public List<string> TempDisplayName
  152. {
  153. get => _tempDisplayName;
  154. set
  155. {
  156. _tempDisplayName = value;
  157. NotifyOfPropertyChange(nameof(TempDisplayName));
  158. }
  159. }
  160. private bool _isReachTempEnabled;
  161. public bool IsReachTempEnabled
  162. {
  163. get => _isReachTempEnabled;
  164. set
  165. {
  166. _isReachTempEnabled = value;
  167. NotifyOfPropertyChange("IsReachTempEnabled");
  168. }
  169. }
  170. private bool _isO2DensityEnabled;
  171. public bool IsO2DensityEnabled
  172. {
  173. get => _isO2DensityEnabled;
  174. set
  175. {
  176. _isO2DensityEnabled = value;
  177. NotifyOfPropertyChange("IsO2DensityEnabled");
  178. }
  179. }
  180. private bool _isReachPressureEnabled;
  181. public bool IsReachPressureEnabled
  182. {
  183. get => _isReachPressureEnabled;
  184. set
  185. {
  186. _isReachPressureEnabled = value;
  187. NotifyOfPropertyChange("IsReachPressureEnabled");
  188. }
  189. }
  190. private bool _isReachVGEnabled;
  191. public bool IsReachVGEnabled
  192. {
  193. get => _isReachVGEnabled;
  194. set
  195. {
  196. _isReachVGEnabled = value;
  197. NotifyOfPropertyChange("IsReachVGEnabled");
  198. }
  199. }
  200. private bool _isPressureStabilizeVGEnabled;
  201. public bool IsPressureStabilizeVGEnabled
  202. {
  203. get => _isPressureStabilizeVGEnabled;
  204. set
  205. {
  206. _isPressureStabilizeVGEnabled = value;
  207. NotifyOfPropertyChange("IsPressureStabilizeVGEnabled");
  208. }
  209. }
  210. #region External In
  211. [Subscription("PM1.SensorTubeATMPressure.DeviceData")]
  212. public AITSensorData SensorTubeATMPressure { get; set; }
  213. [Subscription("System.SensorASOpenPosition.DeviceData")]
  214. public AITSensorData SensorASOpenPosition { get; set; }
  215. [Subscription("System.SensorASClosePosition.DeviceData")]
  216. public AITSensorData SensorASClosePosition { get; set; }
  217. [Subscription("PM1.SensorEXTIN4.DeviceData")]
  218. public AITSensorData SensorEXTIN4 { get; set; }
  219. [Subscription("PM1.SensorEXTIN5.DeviceData")]
  220. public AITSensorData SensorEXTIN5 { get; set; }
  221. [Subscription("PM1.SensorEXTIN6.DeviceData")]
  222. public AITSensorData SensorEXTIN6 { get; set; }
  223. [Subscription("PM1.SensorEXTIN7.DeviceData")]
  224. public AITSensorData SensorEXTIN7 { get; set; }
  225. [Subscription("PM1.SensorEXTIN8.DeviceData")]
  226. public AITSensorData SensorEXTIN8 { get; set; }
  227. public string SensorExternalIn1
  228. {
  229. get
  230. {
  231. if (SensorTubeATMPressure != null)
  232. return SensorTubeATMPressure.DisplayName;
  233. return "External1";
  234. }
  235. }
  236. public string SensorExternalIn2
  237. {
  238. get
  239. {
  240. if (SensorASOpenPosition != null)
  241. return SensorASOpenPosition.DisplayName;
  242. return "External2";
  243. }
  244. }
  245. public string SensorExternalIn3
  246. {
  247. get
  248. {
  249. if (SensorASClosePosition != null)
  250. return SensorASClosePosition.DisplayName;
  251. return "External3";
  252. }
  253. }
  254. public string SensorExternalIn4
  255. {
  256. get
  257. {
  258. if (SensorEXTIN4 != null)
  259. return SensorEXTIN4.DisplayName;
  260. return "External4";
  261. }
  262. }
  263. public string SensorExternalIn5
  264. {
  265. get
  266. {
  267. if (SensorEXTIN5 != null)
  268. return SensorEXTIN5.DisplayName;
  269. return "External5";
  270. }
  271. }
  272. public string SensorExternalIn6
  273. {
  274. get
  275. {
  276. if (SensorEXTIN6 != null)
  277. return SensorEXTIN6.DisplayName;
  278. return "External6";
  279. }
  280. }
  281. public string SensorExternalIn7
  282. {
  283. get
  284. {
  285. if (SensorEXTIN7 != null)
  286. return SensorEXTIN7.DisplayName;
  287. return "External7";
  288. }
  289. }
  290. public string SensorExternalIn8
  291. {
  292. get
  293. {
  294. if (SensorEXTIN8 != null)
  295. return SensorEXTIN8.DisplayName;
  296. return "External8";
  297. }
  298. }
  299. #endregion
  300. protected override void OnViewLoaded(object view)
  301. {
  302. base.OnViewLoaded(view);
  303. UpDataRefresh();
  304. }
  305. protected void UpDataRefresh()
  306. {
  307. var view = (RecipeConditionCheckSetView)(GetView() as Window).Content;
  308. var controls = view.gdExternalSensor.Children;
  309. RecipeConditions.ExternalSensorName[0] = SensorExternalIn1;
  310. RecipeConditions.ExternalSensorName[1] = SensorExternalIn2;
  311. RecipeConditions.ExternalSensorName[2] = SensorExternalIn3;
  312. RecipeConditions.ExternalSensorName[3] = SensorExternalIn4;
  313. RecipeConditions.ExternalSensorName[4] = SensorExternalIn5;
  314. RecipeConditions.ExternalSensorName[5] = SensorExternalIn6;
  315. RecipeConditions.ExternalSensorName[6] = SensorExternalIn7;
  316. for (int i = 0; i < RecipeConditions.ExternalSensor.Count(); i++)
  317. {
  318. foreach (var item in controls)
  319. {
  320. if ((item is RadioButton) && ((RadioButton)item).GroupName == $"externalsensor{i + 1}" && (string)((RadioButton)item).Content == RecipeConditions.ExternalSensor[i])
  321. {
  322. ((RadioButton)item).IsChecked = true;
  323. }
  324. }
  325. }
  326. controls = view.gdFinishAutoProfile.Children;
  327. foreach (var item in controls)
  328. {
  329. if ((item is RadioButton) && ((RadioButton)item).GroupName == "FinishAutoProfile" && (string)((RadioButton)item).Content == RecipeConditions.FinishAutoProfile)
  330. {
  331. ((RadioButton)item).IsChecked = true;
  332. }
  333. }
  334. controls = view.gdProcessTimeToEnd.Children;
  335. foreach (var item in controls)
  336. {
  337. if ((item is RadioButton) && ((RadioButton)item).GroupName == "ProcessTimeToEnd" && (string)((RadioButton)item).Content == RecipeConditions.ProcessTimeToEnd)
  338. {
  339. ((RadioButton)item).IsChecked = true;
  340. }
  341. }
  342. switch (RecipeConditions.ReachTemp)
  343. {
  344. case "None":
  345. view.tempNone.IsChecked = true;
  346. IsReachTempEnabled = false;
  347. break;
  348. case "WaitMoreThan":
  349. view.tempMore.IsChecked = true;
  350. IsReachTempEnabled = true;
  351. break;
  352. case "WaitLessThan":
  353. view.tempLess.IsChecked = true;
  354. IsReachTempEnabled = true;
  355. break;
  356. }
  357. switch (RecipeConditions.O2Density)
  358. {
  359. case "None":
  360. view.o2None.IsChecked = true;
  361. IsO2DensityEnabled = false;
  362. break;
  363. case "WaitLessThan":
  364. view.o2Less.IsChecked = true;
  365. IsO2DensityEnabled = true;
  366. break;
  367. }
  368. switch (RecipeConditions.ReachPressure)
  369. {
  370. case "None":
  371. view.pressureNone.IsChecked = true;
  372. IsReachPressureEnabled = false;
  373. IsReachVGEnabled = false;
  374. break;
  375. case "WaitMoreThan":
  376. view.pressureMore.IsChecked = true;
  377. if (RecipeConditions.ReachPressureVG == "VG1")
  378. view.VG1.IsChecked = true;
  379. else if (RecipeConditions.ReachPressureVG == "VG3")
  380. view.VG3.IsChecked = true;
  381. else
  382. view.VG2.IsChecked = true;
  383. IsReachPressureEnabled = true;
  384. IsReachVGEnabled = true;
  385. break;
  386. case "WaitLessThan":
  387. view.pressureLess.IsChecked = true;
  388. if (RecipeConditions.ReachPressureVG == "VG1")
  389. view.VG1.IsChecked = true;
  390. else if (RecipeConditions.ReachPressureVG == "VG3")
  391. view.VG3.IsChecked = true;
  392. else
  393. view.VG2.IsChecked = true;
  394. IsReachPressureEnabled = true;
  395. IsReachVGEnabled = true;
  396. break;
  397. }
  398. if (RecipeConditions.TempStabizeSelected == "None" || RecipeConditions.TempStabizeSelected == null)
  399. TempStabilizeSelectIndex = 0;
  400. else
  401. TempStabilizeSelectIndex = int.Parse(RecipeConditions.TempStabizeSelected);
  402. var tempSetValue = RecipeConditions.TempStabilizeSets[TempStabilizeSelectIndex][SelectType];
  403. TempJudgTentTime = tempSetValue.JudgmentTime;
  404. TempMax = tempSetValue.StabilizeTemperatureMax;
  405. TempMin = tempSetValue.StabilizeTemperatureMin;
  406. ReachTempValue = (float)RecipeConditions.ReachTempValue;
  407. O2DensityValue = RecipeConditions.O2DensityValue;
  408. ReachPressureValue = (float)RecipeConditions.ReachPressureValue;
  409. var tempStabizeSelected = RecipeConditions.TempStabizeSelected;
  410. controls = view.WPlTempStabilize.Children;
  411. foreach (var item in controls)
  412. {
  413. if ((item is RadioButton) && ((RadioButton)item).GroupName == "TempStabilize" && (string)((RadioButton)item).Content == tempStabizeSelected)
  414. {
  415. ((RadioButton)item).IsChecked = true;
  416. }
  417. }
  418. if (RecipeConditions.PressureStabilizeSelected == "None" || RecipeConditions.PressureStabilizeSelected == null)
  419. {
  420. PressureStabilizeSelectIndex = 0;
  421. IsPressureStabilizeVGEnabled = false;
  422. }
  423. else
  424. {
  425. if (RecipeConditions.PressureStabilizeVG == "VG1")
  426. {
  427. view.VG4.IsChecked = true;
  428. RecipeConditions.PressureStabilizeVG = "VG1";
  429. }
  430. else if (RecipeConditions.PressureStabilizeVG == "VG3")
  431. {
  432. view.VG6.IsChecked = true;
  433. RecipeConditions.PressureStabilizeVG = "VG3";
  434. }
  435. else
  436. {
  437. view.VG5.IsChecked = true;
  438. RecipeConditions.PressureStabilizeVG = "VG2";
  439. }
  440. PressureStabilizeSelectIndex = int.Parse(RecipeConditions.PressureStabilizeSelected);
  441. IsPressureStabilizeVGEnabled = true;
  442. }
  443. var pressureSetValue = RecipeConditions.PressureStabilizeSets[PressureStabilizeSelectIndex];
  444. PressureDelayTime = pressureSetValue.DelayTime;
  445. PressureScaleMax = pressureSetValue.PressureScaleMax;
  446. PressureJudgTentTime = pressureSetValue.JudgmentTime;
  447. PressureMax = pressureSetValue.StabilizePressureMax;
  448. PressureMin = pressureSetValue.StabilizePressureMin;
  449. var pressureStabizeSelected = RecipeConditions.PressureStabilizeSelected;
  450. var pressurecontrols = view.WPlPressureStabilize.Children;
  451. foreach (var item in pressurecontrols)
  452. {
  453. if ((item is RadioButton) && ((RadioButton)item).GroupName == "PressureStabilize" && (string)((RadioButton)item).Content == pressureStabizeSelected)
  454. {
  455. ((RadioButton)item).IsChecked = true;
  456. }
  457. }
  458. _tempAssociateParameterTable = new List<string>();
  459. _tempDisplayName = new List<string>();
  460. for (int i = 10; i > 0; i--)
  461. {
  462. if (i % 2 != 0)
  463. {
  464. var displayName = (string)QueryDataClient.Instance.Service.GetConfig($"PM1.Heater.Heater{i}.DisplayName");
  465. _tempDisplayName.Add(displayName);
  466. var sssociateParameterTable = (string)QueryDataClient.Instance.Service.GetConfig($"PM1.Heater.Heater{i}.AssociateParameterTable");
  467. _tempAssociateParameterTable.Add(sssociateParameterTable);
  468. }
  469. }
  470. PressureUnit = (string)QueryDataClient.Instance.Service.GetConfig($"PM1.APC.PressureUnit");
  471. PressureName = $"Pressure({PressureUnit})";
  472. for (int i = 0; i < RecipeConditions.ExternalSensor.Count(); i++)
  473. {
  474. if (RecipeConditions.ExternalSensor[i] != "None")
  475. {
  476. view.rdExternalSensor.IsChecked = true;
  477. view.ExternalInSensor.Visibility = Visibility.Visible;
  478. return;
  479. }
  480. }
  481. if (RecipeConditions.TempStabizeSelected != "None")
  482. {
  483. view.rdTempStabilize.IsChecked = true;
  484. view.TempStabilize.Visibility = Visibility.Visible;
  485. return;
  486. }
  487. if (RecipeConditions.FinishAutoProfile != "None")
  488. {
  489. view.rdFinishAutoProfile.IsChecked = true;
  490. view.FinishAutoProfile.Visibility = Visibility.Visible;
  491. return;
  492. }
  493. if (RecipeConditions.ReachTemp != "None")
  494. {
  495. view.rdReachTemp.IsChecked = true;
  496. view.ReachTemp.Visibility = Visibility.Visible;
  497. return;
  498. }
  499. if (RecipeConditions.ReachPressure != "None")
  500. {
  501. view.rdReachPressure.IsChecked = true;
  502. view.ReachPressure.Visibility = Visibility.Visible;
  503. return;
  504. }
  505. if (RecipeConditions.PressureStabilizeSelected != "None")
  506. {
  507. view.rdPressureStabilize.IsChecked = true;
  508. view.PressureStabilize.Visibility = Visibility.Visible;
  509. return;
  510. }
  511. if (RecipeConditions.O2Density != "None")
  512. {
  513. view.rdO2Density.IsChecked = true;
  514. view.O2Density.Visibility = Visibility.Visible;
  515. return;
  516. }
  517. if (RecipeConditions.ProcessTimeToEnd != "None")
  518. {
  519. view.rdProcessTimeToEnd.IsChecked = true;
  520. view.ProcessTimeToEnd.Visibility = Visibility.Visible;
  521. return;
  522. }
  523. view.rdNone.IsChecked = true;
  524. }
  525. public int TempStabilizeSelectIndex { get; set; } = 1;
  526. public int PressureStabilizeSelectIndex { get; set; } = 1;
  527. private string SelectType { get; set; } = "TOP";
  528. public void TempStabilizeSelected(object sender)
  529. {
  530. if (sender is RadioButton)
  531. {
  532. string content = ((RadioButton)sender).Content.ToString();
  533. var tempIndex = 0;
  534. if (content != "None")
  535. {
  536. tempIndex = int.Parse((string)((RadioButton)sender).Content);
  537. }
  538. //if (TempStabilizeSelectIndex != tempIndex)
  539. {
  540. TempStabilizeSelectIndex = tempIndex;
  541. RecipeConditions.TempStabizeSelected = content;
  542. var tempSetValue = RecipeConditions.TempStabilizeSets[TempStabilizeSelectIndex][SelectType];
  543. TempJudgTentTime = tempSetValue.JudgmentTime;
  544. TempMax = tempSetValue.StabilizeTemperatureMax;
  545. TempMin = tempSetValue.StabilizeTemperatureMin;
  546. }
  547. }
  548. }
  549. public void PressureStabilizeSelected(object sender)
  550. {
  551. if (sender is RadioButton)
  552. {
  553. string content = ((RadioButton)sender).Content.ToString();
  554. var pressureIndex = 0;
  555. if (content != "None")
  556. {
  557. pressureIndex = int.Parse((string)((RadioButton)sender).Content);
  558. IsPressureStabilizeVGEnabled = true;
  559. }
  560. else
  561. {
  562. IsPressureStabilizeVGEnabled = false;
  563. }
  564. //if (PressureStabilizeSelectIndex != pressureIndex)
  565. {
  566. PressureStabilizeSelectIndex = pressureIndex;
  567. RecipeConditions.PressureStabilizeSelected = content;
  568. var pressureSetValue = RecipeConditions.PressureStabilizeSets[pressureIndex];
  569. PressureDelayTime = pressureSetValue.DelayTime;
  570. PressureScaleMax = pressureSetValue.PressureScaleMax;
  571. PressureJudgTentTime = pressureSetValue.JudgmentTime;
  572. PressureMax = pressureSetValue.StabilizePressureMax;
  573. PressureMin = pressureSetValue.StabilizePressureMin;
  574. }
  575. }
  576. }
  577. public void TempStabilizeTypeSelected(object sender, object value)
  578. {
  579. if (sender is RadioButton)
  580. {
  581. var tempType = _tempAssociateParameterTable[int.Parse(value.ToString())];
  582. if (tempType != SelectType)
  583. {
  584. RecipeConditions.TempStabilizeSets[TempStabilizeSelectIndex][SelectType].JudgmentTime = TempJudgTentTime;
  585. RecipeConditions.TempStabilizeSets[TempStabilizeSelectIndex][SelectType].StabilizeTemperatureMax = TempMax;
  586. RecipeConditions.TempStabilizeSets[TempStabilizeSelectIndex][SelectType].StabilizeTemperatureMin = TempMin;
  587. SelectType = tempType;
  588. var tempSetValue = RecipeConditions.TempStabilizeSets[TempStabilizeSelectIndex][SelectType];
  589. TempJudgTentTime = tempSetValue.JudgmentTime;
  590. TempMax = tempSetValue.StabilizeTemperatureMax;
  591. TempMin = tempSetValue.StabilizeTemperatureMin;
  592. }
  593. }
  594. }
  595. public void RecipeConditionCheckSubCommand(object sender, object value, object index, object vgIndex)
  596. {
  597. if (sender is RadioButton)
  598. {
  599. string content = ((RadioButton)sender).Content.ToString();
  600. switch (value.ToString())
  601. {
  602. case "ExternalSensor":
  603. RecipeConditions.ExternalSensor[int.Parse(index.ToString())] = content;
  604. break;
  605. case "FinishAutoProfile":
  606. RecipeConditions.FinishAutoProfile = content;
  607. break;
  608. case "Temp":
  609. RecipeConditions.ReachTemp = index.ToString();
  610. if (content == "None")
  611. IsReachTempEnabled = false;
  612. else
  613. IsReachTempEnabled = true;
  614. break;
  615. case "Pressure":
  616. RecipeConditions.ReachPressure = index.ToString();
  617. RecipeConditions.ReachPressureVG = vgIndex.ToString();
  618. if (content == "None")
  619. {
  620. IsReachPressureEnabled = false;
  621. IsReachVGEnabled = false;
  622. }
  623. else
  624. {
  625. IsReachPressureEnabled = true;
  626. IsReachVGEnabled = true;
  627. }
  628. break;
  629. case "Pressure Stabilize":
  630. RecipeConditions.PressureStabilizeVG = vgIndex.ToString();
  631. break;
  632. case "O2":
  633. RecipeConditions.O2Density = index.ToString();
  634. if (content == "None")
  635. IsO2DensityEnabled = false;
  636. else
  637. IsO2DensityEnabled = true;
  638. break;
  639. case "ProcessTimeToEnd":
  640. RecipeConditions.ProcessTimeToEnd = content;
  641. break;
  642. }
  643. }
  644. }
  645. public void RecipeConditionCheckCommand(string commandName)
  646. {
  647. HideAllControl();
  648. var temp = (RecipeConditionCheckSetView)(GetView() as Window).Content;
  649. IsNone = false;
  650. switch (commandName)
  651. {
  652. case "externalsensor":
  653. temp.ExternalInSensor.Visibility = Visibility.Visible;
  654. break;
  655. case "tempstabilize":
  656. temp.TempStabilize.Visibility = Visibility.Visible;
  657. break;
  658. case "finishautoprofile":
  659. temp.FinishAutoProfile.Visibility = Visibility.Visible;
  660. break;
  661. case "reachtemp":
  662. temp.ReachTemp.Visibility = Visibility.Visible;
  663. break;
  664. case "reachpressure":
  665. temp.ReachPressure.Visibility = Visibility.Visible;
  666. break;
  667. case "pressurestabilize":
  668. temp.PressureStabilize.Visibility = Visibility.Visible;
  669. break;
  670. case "O2Density":
  671. temp.O2Density.Visibility = Visibility.Visible;
  672. break;
  673. case "processTimeToEnd":
  674. temp.ProcessTimeToEnd.Visibility = Visibility.Visible;
  675. break;
  676. case "none":
  677. IsNone = true;
  678. break;
  679. default:
  680. break;
  681. }
  682. }
  683. public bool ConditionCheck()
  684. {
  685. bool isNone = true;
  686. if (RecipeConditions.ProcessTimeToEnd != "None")
  687. return false;
  688. if (RecipeConditions.O2Density != "None")
  689. return false;
  690. if (RecipeConditions.PressureStabilizeSelected != "None")
  691. return false;
  692. if (RecipeConditions.ReachPressure != "None")
  693. return false;
  694. if (RecipeConditions.ReachTemp != "None")
  695. return false;
  696. if (RecipeConditions.FinishAutoProfile != "None")
  697. return false;
  698. if (RecipeConditions.TempStabizeSelected != "None")
  699. return false;
  700. for (int i = 0; i < RecipeConditions.ExternalSensor.Count(); i++)
  701. {
  702. if (RecipeConditions.ExternalSensor[i] != "None")
  703. return false;
  704. }
  705. return isNone;
  706. }
  707. public void HideAllControl()
  708. {
  709. var temp = (RecipeConditionCheckSetView)(GetView() as Window).Content;
  710. temp.ExternalInSensor.Visibility = Visibility.Hidden;
  711. temp.TempStabilize.Visibility = Visibility.Hidden;
  712. temp.FinishAutoProfile.Visibility = Visibility.Hidden;
  713. temp.ReachTemp.Visibility = Visibility.Hidden;
  714. temp.ReachPressure.Visibility = Visibility.Hidden;
  715. temp.PressureStabilize.Visibility = Visibility.Hidden;
  716. temp.O2Density.Visibility = Visibility.Hidden;
  717. temp.ProcessTimeToEnd.Visibility = Visibility.Hidden;
  718. }
  719. public void ConditionCheckSave()
  720. {
  721. IsSave = true;
  722. if (!IsNone)
  723. IsNone = ConditionCheck();
  724. if (IsNone)
  725. {
  726. for (int i = 0; i < RecipeConditions.ExternalSensor.Count(); i++)
  727. {
  728. RecipeConditions.ExternalSensor[i] = "None";
  729. }
  730. RecipeConditions.TempStabizeSelected = "None";
  731. RecipeConditions.FinishAutoProfile = "None";
  732. RecipeConditions.ReachTemp = "None";
  733. RecipeConditions.ReachTempValue = 0;
  734. RecipeConditions.O2Density = "None";
  735. RecipeConditions.O2DensityValue = 0;
  736. RecipeConditions.ReachPressure = "None";
  737. RecipeConditions.ReachPressureVG = "";
  738. RecipeConditions.ReachPressureValue = 0;
  739. RecipeConditions.PressureStabilizeSelected = "None";
  740. }
  741. if (string.IsNullOrEmpty(RecipeConditions.PressureStabilizeVG))
  742. RecipeConditions.PressureStabilizeVG = "VG1";
  743. if (string.IsNullOrEmpty(RecipeConditions.ReachPressureVG))
  744. RecipeConditions.ReachPressureVG = "VG1";
  745. (GetView() as Window).Close();
  746. }
  747. public void ConditionCheckCancel()
  748. {
  749. IsSave = false;
  750. (GetView() as Window).Close();
  751. }
  752. }
  753. public class RecipeCondition : PropertyChangedBase
  754. {
  755. public RecipeCondition()
  756. {
  757. }
  758. string[] externalsensorname = new string[7];
  759. public string[] ExternalSensorName
  760. {
  761. get => externalsensorname;
  762. set
  763. {
  764. externalsensorname = value;
  765. NotifyOfPropertyChange("ExternalSensorName");
  766. }
  767. }
  768. string[] externalsensor = new string[7];
  769. public string[] ExternalSensor
  770. {
  771. get => externalsensor;
  772. set
  773. {
  774. externalsensor = value;
  775. NotifyOfPropertyChange("ExternalSensor");
  776. }
  777. }
  778. public string FinishAutoProfile { get; set; }
  779. public string TempStabizeSelected { get; set; }
  780. public string ReachTemp { get; set; }
  781. public string O2Density { get; set; }
  782. public double ReachTempValue { get; set; }
  783. public int O2DensityValue { get; set; }
  784. public string ReachPressure { get; set; }
  785. public string ReachPressureVG { get; set; }
  786. public string PressureStabilizeVG { get; set; }
  787. public double ReachPressureValue { get; set; }
  788. public string PressureStabilizeSelected { get; set; }
  789. public string ProcessTimeToEnd { get; set; }
  790. public void CreateDefaultValues()
  791. {
  792. ExternalSensor = new string[] { "None", "None", "None", "None", "None", "None", "None" };
  793. TempStabilizeSets.Clear();
  794. ReachTempSets.Clear();
  795. ReachPressureSets.Clear();
  796. PressureStabilizeSets.Clear();
  797. for (int i = 0; i < 6; i++)
  798. {
  799. Dictionary<string, TempSetValues> tempSets = new Dictionary<string, TempSetValues>();
  800. tempSets.Add("TOP", new TempSetValues() { JudgmentTime = 0, StabilizeTemperatureMin = 0, StabilizeTemperatureMax = 0 });
  801. tempSets.Add("C3", new TempSetValues() { JudgmentTime = 0, StabilizeTemperatureMin = 0, StabilizeTemperatureMax = 0 });
  802. tempSets.Add("C2", new TempSetValues() { JudgmentTime = 0, StabilizeTemperatureMin = 0, StabilizeTemperatureMax = 0 });
  803. tempSets.Add("C1", new TempSetValues() { JudgmentTime = 0, StabilizeTemperatureMin = 0, StabilizeTemperatureMax = 0 });
  804. tempSets.Add("BTM", new TempSetValues() { JudgmentTime = 0, StabilizeTemperatureMin = 0, StabilizeTemperatureMax = 0 });
  805. TempStabilizeSets.Add(i, tempSets);
  806. PressureStabilizeSets.Add(i, new PressureSetValues() { DelayTime = 0, JudgmentTime = 0, StabilizePressureMin = 0, StabilizePressureMax = 0, PressureScaleMax = 0.0f });
  807. }
  808. for (int i = 0; i < TempStabilizeSets.Count; i++)
  809. {
  810. if (i == 0) continue;
  811. foreach (var subItem in TempStabilizeSets[i])
  812. {
  813. string strHeader = "PM1.RecipeEditParameter.TempStabilizeTable";
  814. subItem.Value.JudgmentTime = Convert.ToInt32(SystemConfigProvider.Instance.GetValueByName($"{strHeader}.Table{i}.{subItem.Key}.JudgmentTime"));
  815. subItem.Value.StabilizeTemperatureMin = Convert.ToInt32(SystemConfigProvider.Instance.GetValueByName($"{strHeader}.Table{i}.{subItem.Key}.MinValue"));
  816. subItem.Value.StabilizeTemperatureMax = Convert.ToInt32(SystemConfigProvider.Instance.GetValueByName($"{strHeader}.Table{i}.{subItem.Key}.MaxValue"));
  817. }
  818. {
  819. string strHeader = "PM1.RecipeEditParameter.PressureStabilizeTable";
  820. PressureStabilizeSets[i].PressureScaleMax = float.Parse(SystemConfigProvider.Instance.GetValueByName($"{strHeader}.Table{i}.MaxScale"));
  821. var unit = QueryDataClient.Instance.Service.GetConfig($"{strHeader}.Table{i}.MaxScale");
  822. PressureStabilizeSets[i].DelayTime = Convert.ToInt32(SystemConfigProvider.Instance.GetValueByName($"{strHeader}.Table{i}.DelayTime"));
  823. PressureStabilizeSets[i].StabilizePressureMax = Convert.ToInt32(SystemConfigProvider.Instance.GetValueByName($"{strHeader}.Table{i}.MaxValue"));
  824. PressureStabilizeSets[i].StabilizePressureMin = Convert.ToInt32(SystemConfigProvider.Instance.GetValueByName($"{strHeader}.Table{i}.MinValue"));
  825. PressureStabilizeSets[i].JudgmentTime = Convert.ToInt32(SystemConfigProvider.Instance.GetValueByName($"{strHeader}.Table{i}.JudgmentTime"));
  826. }
  827. }
  828. ReachTempSets.Add("Upper", new ReachAndUsedIntValues() { IsUsed = true, TempValue = 600 });
  829. ReachTempSets.Add("Lower", new ReachAndUsedIntValues() { IsUsed = true, TempValue = 300 });
  830. ReachPressureSets.Add("Upper", new ReachAndUsedFloatValues() { IsUsed = true, TempValue = 1.0f });
  831. ReachPressureSets.Add("Lower", new ReachAndUsedFloatValues() { IsUsed = true, TempValue = 0.1f });
  832. }
  833. public Dictionary<int, Dictionary<string, TempSetValues>> TempStabilizeSets = new Dictionary<int, Dictionary<string, TempSetValues>>();
  834. public Dictionary<string, ReachAndUsedIntValues> ReachTempSets = new Dictionary<string, ReachAndUsedIntValues>();
  835. public Dictionary<string, ReachAndUsedFloatValues> ReachPressureSets = new Dictionary<string, ReachAndUsedFloatValues>();
  836. public Dictionary<int, PressureSetValues> PressureStabilizeSets = new Dictionary<int, PressureSetValues>();
  837. }
  838. public class PressureSetValues : PropertyChangedBase
  839. {
  840. float _pressureScaleMax;
  841. public float PressureScaleMax
  842. {
  843. get => _pressureScaleMax;
  844. set
  845. {
  846. _pressureScaleMax = value;
  847. NotifyOfPropertyChange("PressureScaleMax");
  848. }
  849. }
  850. int _judgmentTime;
  851. public int JudgmentTime
  852. {
  853. get => _judgmentTime;
  854. set
  855. {
  856. _judgmentTime = value;
  857. NotifyOfPropertyChange("JudgmentTime");
  858. }
  859. }
  860. int _delayTime;
  861. public int DelayTime
  862. {
  863. get => _delayTime;
  864. set
  865. {
  866. _delayTime = value;
  867. NotifyOfPropertyChange("DelayTime");
  868. }
  869. }
  870. float _stabilizePressureMax;
  871. public float StabilizePressureMax
  872. {
  873. get => _stabilizePressureMax;
  874. set
  875. {
  876. _stabilizePressureMax = value;
  877. NotifyOfPropertyChange("StabilizePressureMax");
  878. }
  879. }
  880. float _stabilizePressureMin;
  881. public float StabilizePressureMin
  882. {
  883. get => _stabilizePressureMin;
  884. set
  885. {
  886. _stabilizePressureMin = value;
  887. NotifyOfPropertyChange("StabilizePressureMin");
  888. }
  889. }
  890. }
  891. public class TempSetValues : PropertyChangedBase
  892. {
  893. int _judgmentTime;
  894. public int JudgmentTime
  895. {
  896. get => _judgmentTime;
  897. set
  898. {
  899. _judgmentTime = value;
  900. NotifyOfPropertyChange("JudgmentTime");
  901. }
  902. }
  903. float _stabilizeTemperatureMax;
  904. public float StabilizeTemperatureMax
  905. {
  906. get => _stabilizeTemperatureMax;
  907. set
  908. {
  909. _stabilizeTemperatureMax = value;
  910. NotifyOfPropertyChange("StabilizeTemperatureMax");
  911. }
  912. }
  913. float _stabilizeTemperatureMin;
  914. public float StabilizeTemperatureMin
  915. {
  916. get => _stabilizeTemperatureMin;
  917. set
  918. {
  919. _stabilizeTemperatureMin = value;
  920. NotifyOfPropertyChange("StabilizeTemperatureMin");
  921. }
  922. }
  923. }
  924. public class ReachAndUsedIntValues : PropertyChangedBase
  925. {
  926. bool _isUsed;
  927. public bool IsUsed
  928. {
  929. get => _isUsed;
  930. set
  931. {
  932. _isUsed = value;
  933. NotifyOfPropertyChange("IsUsed");
  934. }
  935. }
  936. int _tempValue;
  937. public int TempValue
  938. {
  939. get => _tempValue;
  940. set
  941. {
  942. _tempValue = value;
  943. NotifyOfPropertyChange("TempValue");
  944. }
  945. }
  946. }
  947. public class ReachAndUsedFloatValues : PropertyChangedBase
  948. {
  949. bool _isUsed;
  950. public bool IsUsed
  951. {
  952. get => _isUsed;
  953. set
  954. {
  955. _isUsed = value;
  956. NotifyOfPropertyChange("IsUsed");
  957. }
  958. }
  959. float _tempValue;
  960. public float TempValue
  961. {
  962. get => _tempValue;
  963. set
  964. {
  965. _tempValue = value;
  966. NotifyOfPropertyChange("TempValue");
  967. }
  968. }
  969. }
  970. }