ManualSetViewModel.cs 112 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548
  1. using Aitex.Core.Common.DeviceData;
  2. using Aitex.Core.RT.IOCore;
  3. using Aitex.Core.RT.Log;
  4. using Aitex.Core.Util;
  5. using Caliburn.Micro;
  6. using Caliburn.Micro.Core;
  7. using FurnaceGasPanelUI.Views.Maintenances;
  8. using FurnaceUI.Client;
  9. using FurnaceUI.Common;
  10. using FurnaceUI.Models;
  11. using FurnaceUI.Views.Editors;
  12. using FurnaceUI.Views.Operations;
  13. using FurnaceUI.Views.Parameter;
  14. using FurnaceUI.Views.Status;
  15. using MECF.Framework.Common.DataCenter;
  16. using MECF.Framework.Common.OperationCenter;
  17. using MECF.Framework.Common.RecipeCenter;
  18. using MECF.Framework.UI.Client.CenterViews.Configs.SystemConfig;
  19. using MECF.Framework.UI.Client.CenterViews.Dialogs;
  20. using MECF.Framework.UI.Client.CenterViews.Editors.Recipe;
  21. using MECF.Framework.UI.Client.ClientBase;
  22. using OpenSEMI.ClientBase;
  23. using RecipeEditorLib.RecipeModel.Params;
  24. using System;
  25. using System.Collections.Generic;
  26. using System.Collections.ObjectModel;
  27. using System.Linq;
  28. using System.Reflection;
  29. using System.Windows;
  30. using System.Windows.Controls;
  31. namespace FurnaceUI.Views.Recipes
  32. {
  33. public class ManualSetViewModel : FurnaceUIViewModelBase
  34. {
  35. [Subscription("PM1.CurrentAuxData")]
  36. public List<AITAuxData> AUXDetailDatas { get; set; }
  37. public string DefaultUnit { get; set; }
  38. #region MFCs
  39. [Subscription("PM1.MFC1.DeviceData")]
  40. public AITMfcData MFC1Data { get; set; }
  41. [Subscription("PM1.MFC2.DeviceData")]
  42. public AITMfcData MFC2Data { get; set; }
  43. [Subscription("PM1.MFC3.DeviceData")]
  44. public AITMfcData MFC3Data { get; set; }
  45. [Subscription("PM1.MFC4.DeviceData")]
  46. public AITMfcData MFC4Data { get; set; }
  47. [Subscription("PM1.MFC5.DeviceData")]
  48. public AITMfcData MFC5Data { get; set; }
  49. [Subscription("PM1.MFC6.DeviceData")]
  50. public AITMfcData MFC6Data { get; set; }
  51. [Subscription("PM1.MFC7.DeviceData")]
  52. public AITMfcData MFC7Data { get; set; }
  53. [Subscription("PM1.MFC8.DeviceData")]
  54. public AITMfcData MFC8Data { get; set; }
  55. [Subscription("PM1.MFC9.DeviceData")]
  56. public AITMfcData MFC9Data { get; set; }
  57. [Subscription("PM1.MFC10.DeviceData")]
  58. public AITMfcData MFC10Data { get; set; }
  59. [Subscription("PM1.MFC11.DeviceData")]
  60. public AITMfcData MFC11Data { get; set; }
  61. [Subscription("PM1.MFC12.DeviceData")]
  62. public AITMfcData MFC12Data { get; set; }
  63. [Subscription("PM1.MFC13.DeviceData")]
  64. public AITMfcData MFC13Data { get; set; }
  65. [Subscription("PM1.MFC14.DeviceData")]
  66. public AITMfcData MFC14Data { get; set; }
  67. [Subscription("PM1.MFC15.DeviceData")]
  68. public AITMfcData MFC15Data { get; set; }
  69. [Subscription("PM1.MFC16.DeviceData")]
  70. public AITMfcData MFC16Data { get; set; }
  71. [Subscription("PM1.MFC17.DeviceData")]
  72. public AITMfcData MFC17Data { get; set; }
  73. [Subscription("PM1.MFC31.DeviceData")]
  74. public AITMfcData MFC31Data { get; set; }
  75. [Subscription("PM1.MFC32.DeviceData")]
  76. public AITMfcData MFC32Data { get; set; }
  77. [Subscription("PM1.MFC51.DeviceData")]
  78. public AITMfcData MFC51Data { get; set; }
  79. #endregion
  80. [Subscription("PM1.EditRecipeStepNo")]
  81. public int EditRecipeStepNo { get; set; }
  82. [Subscription("PM1.EditRecipeName")]
  83. public string EditRecipeName { get; set; }
  84. [Subscription("PM1.EditRecipeStepName")]
  85. public string EditRecipeStepName { get; set; }
  86. private int ControlMode = 1;
  87. private UIElement _parent;
  88. [Subscription("System.HeaterU.DeviceData")]
  89. public AITHeaterData HeaterUData { get; set; }
  90. [Subscription("System.HeaterCU.DeviceData")]
  91. public AITHeaterData HeaterCUData { get; set; }
  92. [Subscription("System.HeaterC.DeviceData")]
  93. public AITHeaterData HeaterCData { get; set; }
  94. [Subscription("System.HeaterCL.DeviceData")]
  95. public AITHeaterData HeaterCLData { get; set; }
  96. [Subscription("System.HeaterL.DeviceData")]
  97. public AITHeaterData HeaterLData { get; set; }
  98. public AITHeaterData BottomHeaterData => HeaterLData;
  99. public AITHeaterData CenterBottomHeaterData => HeaterCLData;
  100. public AITHeaterData CenterHeaterData => HeaterCData;
  101. public AITHeaterData TopCenterHeaterData => HeaterCUData;
  102. public AITHeaterData TopHeaterData => HeaterUData;
  103. [Subscription("PM1.APC.DeviceData")]
  104. public AITAPCData APCData { get; set; }
  105. IWindowManager wm = IoC.Get<IWindowManager>();
  106. private string _selectBtnName;
  107. public string SelectBtnName
  108. {
  109. get { return _selectBtnName; }
  110. set { _selectBtnName = value; this.NotifyOfPropertyChange(nameof(SelectBtnName)); }
  111. }
  112. private string _temperatureControlMode;
  113. public string TemperatureControlMode
  114. {
  115. get => _temperatureControlMode;
  116. set
  117. {
  118. _temperatureControlMode = value;
  119. NotifyOfPropertyChange(nameof(TemperatureControlMode));
  120. }
  121. }
  122. private string _temperatureCorrect;
  123. public string TemperatureCorrect
  124. {
  125. get => _temperatureCorrect;
  126. set
  127. {
  128. _temperatureCorrect = value;
  129. NotifyOfPropertyChange(nameof(TemperatureCorrect));
  130. }
  131. }
  132. private string _temperaturePID;
  133. public string TemperaturePID
  134. {
  135. get => _temperaturePID;
  136. set
  137. {
  138. _temperaturePID = value;
  139. NotifyOfPropertyChange(nameof(TemperaturePID));
  140. }
  141. }
  142. private string _loaderCommand = "";
  143. public string LoaderCommand
  144. {
  145. get => _loaderCommand;
  146. set
  147. {
  148. _loaderCommand = value;
  149. NotifyOfPropertyChange(nameof(LoaderCommand));
  150. NotifyOfPropertyChange(nameof(LoaderCommandIsSaved));
  151. }
  152. }
  153. public string OldLoaderCommand { get; set; } = "";
  154. public void SetParent(UIElement parent)
  155. {
  156. _parent = parent;
  157. }
  158. public bool LoaderCommandIsSaved
  159. {
  160. get => LoaderCommand == OldLoaderCommand;
  161. }
  162. #region"Loader Set Value"
  163. private Visibility _loaderSet3SpeedVisibility = Visibility.Hidden;
  164. public Visibility LoaderSet3SpeedVisibility
  165. {
  166. get => _loaderSet3SpeedVisibility;
  167. set
  168. {
  169. _loaderSet3SpeedVisibility = value;
  170. NotifyOfPropertyChange(nameof(LoaderSet3SpeedVisibility));
  171. }
  172. }
  173. private Visibility _loaderSetSpeedVisibility = Visibility.Hidden;
  174. public Visibility LoaderSetSpeedVisibility
  175. {
  176. get => _loaderSetSpeedVisibility;
  177. set
  178. {
  179. _loaderSetSpeedVisibility = value;
  180. NotifyOfPropertyChange(nameof(LoaderSetSpeedVisibility));
  181. }
  182. }
  183. private Visibility _loaderSetSpeedFloatVisibility = Visibility.Hidden;
  184. public Visibility LoaderSetSpeedFloatVisibility
  185. {
  186. get => _loaderSetSpeedFloatVisibility;
  187. set
  188. {
  189. _loaderSetSpeedFloatVisibility = value;
  190. NotifyOfPropertyChange(nameof(LoaderSetSpeedFloatVisibility));
  191. }
  192. }
  193. private string _pressCommand = "";
  194. public string PressCommand
  195. {
  196. get => _pressCommand;
  197. set
  198. {
  199. _pressCommand = value;
  200. NotifyOfPropertyChange(nameof(PressCommand));
  201. NotifyOfPropertyChange(nameof(PressCommandIsSaved));
  202. }
  203. }
  204. public string OldPressCommand { get; set; } = "";
  205. public bool PressCommandIsSaved
  206. {
  207. get => _pressCommand == OldPressCommand;
  208. }
  209. public void SetShowLoaderValuePanel(string selectedCmd)
  210. {
  211. switch (selectedCmd)
  212. {
  213. case "Boat Load":
  214. case "Boat Unload":
  215. LoaderSet3SpeedVisibility = Visibility.Visible;
  216. LoaderSetSpeedVisibility = Visibility.Hidden;
  217. LoaderSetSpeedFloatVisibility = Visibility.Hidden;
  218. break;
  219. case "Boat Rotate":
  220. LoaderSet3SpeedVisibility = Visibility.Hidden;
  221. LoaderSetSpeedVisibility = Visibility.Hidden;
  222. LoaderSetSpeedFloatVisibility = Visibility.Visible;
  223. break;
  224. case "Boat CAP2":
  225. LoaderSet3SpeedVisibility = Visibility.Hidden;
  226. LoaderSetSpeedVisibility = Visibility.Visible;
  227. LoaderSetSpeedFloatVisibility = Visibility.Hidden;
  228. break;
  229. case "Stop(Include R-axis)":
  230. case "Boat Rotate Stop":
  231. case "Boat Loader Home":
  232. case "None":
  233. case "NONE":
  234. LoaderSet3SpeedVisibility = Visibility.Hidden;
  235. LoaderSetSpeedVisibility = Visibility.Hidden;
  236. LoaderSetSpeedFloatVisibility = Visibility.Hidden;
  237. break;
  238. default:
  239. break;
  240. }
  241. }
  242. public void SetLoaderValue(string selectedCmd, string Values)
  243. {
  244. switch (selectedCmd)
  245. {
  246. case "Boat Load":
  247. case "Boat Unload":
  248. if (string.IsNullOrEmpty(Values)) return;
  249. string[] list = Values.Split(';');
  250. if (list.Length < 3) return;
  251. Loader3Speed1 = int.Parse(list[0]);
  252. Loader3Speed2 = int.Parse(list[1]);
  253. Loader3Speed3 = int.Parse(list[2]);
  254. break;
  255. case "Boat Rotate":
  256. if (string.IsNullOrEmpty(Values)) return;
  257. LoaderRPM = double.Parse(Values);
  258. break;
  259. case "Boat CAP2":
  260. if (string.IsNullOrEmpty(Values)) return;
  261. LoaderSpeed = int.Parse(Values);
  262. break;
  263. case "Stop(Include R-axis)":
  264. case "Boat Rotate Stop":
  265. case "Boat Loader Home":
  266. case "None":
  267. break;
  268. default:
  269. break;
  270. }
  271. }
  272. public string GetSaveLoaderValue(string selectedCmd)
  273. {
  274. switch (selectedCmd)
  275. {
  276. case "Boat Load":
  277. case "Boat Unload":
  278. return $"{selectedCmd};{Loader3Speed1};{Loader3Speed2};{Loader3Speed3}";
  279. case "Boat Rotate":
  280. return $"{selectedCmd};{LoaderRPM.ToString()}";
  281. case "Boat CAP2":
  282. return $"{selectedCmd};{LoaderSpeed.ToString()}";
  283. case "Stop(Include R-axis)":
  284. case "Boat Rotate Stop":
  285. case "Boat Loader Home":
  286. case "None":
  287. return $"{selectedCmd};";
  288. default:
  289. return "";
  290. }
  291. }
  292. private int loader3Speed1 = 5;
  293. public int Loader3Speed1
  294. {
  295. get => loader3Speed1;
  296. set
  297. {
  298. loader3Speed1 = value;
  299. NotifyOfPropertyChange(nameof(Loader3Speed1));
  300. }
  301. }
  302. private int loader3Speed2 = 0;
  303. public int Loader3Speed2
  304. {
  305. get => loader3Speed2;
  306. set
  307. {
  308. loader3Speed2 = value;
  309. NotifyOfPropertyChange(nameof(Loader3Speed2));
  310. }
  311. }
  312. private int loader3Speed3 = 0;
  313. public int Loader3Speed3
  314. {
  315. get => loader3Speed3;
  316. set
  317. {
  318. loader3Speed3 = value;
  319. NotifyOfPropertyChange(nameof(Loader3Speed3));
  320. }
  321. }
  322. private double _loaderRPM = 0;
  323. public double LoaderRPM
  324. {
  325. get => _loaderRPM;
  326. set
  327. {
  328. _loaderRPM = value;
  329. NotifyOfPropertyChange(nameof(LoaderRPM));
  330. }
  331. }
  332. private int loaderSpeed = 0;
  333. public int LoaderSpeed
  334. {
  335. get => loaderSpeed;
  336. set
  337. {
  338. loaderSpeed = value;
  339. NotifyOfPropertyChange(nameof(LoaderSpeed));
  340. }
  341. }
  342. private void ClearLoaderSetValue()
  343. {
  344. Loader3Speed1 = 0;
  345. Loader3Speed2 = 0;
  346. Loader3Speed3 = 0;
  347. LoaderRPM = 0;
  348. LoaderSpeed = 0;
  349. }
  350. #endregion
  351. #region"PressVisibility"
  352. private Visibility _pressVisibility = Visibility.Hidden;
  353. public Visibility PressVisibility
  354. {
  355. get => _pressVisibility;
  356. set
  357. {
  358. _pressVisibility = value;
  359. NotifyOfPropertyChange(nameof(PressVisibility));
  360. }
  361. }
  362. private Visibility _pressSlowVacVisibility = Visibility.Hidden;
  363. public Visibility PressSlowVacVisibility
  364. {
  365. get => _pressSlowVacVisibility;
  366. set
  367. {
  368. _pressSlowVacVisibility = value;
  369. NotifyOfPropertyChange(nameof(PressSlowVacVisibility));
  370. }
  371. }
  372. private Visibility _pressValveAngleVisibility = Visibility.Hidden;
  373. public Visibility PressValveAngleVisibility
  374. {
  375. get => _pressValveAngleVisibility;
  376. set
  377. {
  378. _pressValveAngleVisibility = value;
  379. NotifyOfPropertyChange(nameof(PressValveAngleVisibility));
  380. }
  381. }
  382. private Visibility _pressWaitVisibility = Visibility.Hidden;
  383. public Visibility PressWaitVisibility
  384. {
  385. get => _pressWaitVisibility;
  386. set
  387. {
  388. _pressWaitVisibility = value;
  389. NotifyOfPropertyChange(nameof(PressWaitVisibility));
  390. }
  391. }
  392. private string _pressureCommand;
  393. public string PressureCommand
  394. {
  395. get => _pressureCommand;
  396. set
  397. {
  398. _pressureCommand = value;
  399. }
  400. }
  401. public void SetShowPressPanel(string selectedCmd)
  402. {
  403. switch (selectedCmd)
  404. {
  405. case "Press":
  406. case "Press2":
  407. PressVisibility = Visibility.Visible;
  408. PressSlowVacVisibility = Visibility.Hidden;
  409. PressValveAngleVisibility = Visibility.Hidden;
  410. PressWaitVisibility = Visibility.Hidden;
  411. break;
  412. case "Slow Vac":
  413. PressVisibility = Visibility.Hidden;
  414. PressSlowVacVisibility = Visibility.Visible;
  415. PressValveAngleVisibility = Visibility.Hidden;
  416. PressWaitVisibility = Visibility.Hidden;
  417. break;
  418. case "Valve Angle":
  419. PressVisibility = Visibility.Hidden;
  420. PressSlowVacVisibility = Visibility.Hidden;
  421. PressValveAngleVisibility = Visibility.Visible;
  422. PressWaitVisibility = Visibility.Hidden;
  423. break;
  424. case "Full Open":
  425. case "Full Close":
  426. case "Hold":
  427. case "Zero Set":
  428. case "Cancel Zero":
  429. case "Home":
  430. case "None":
  431. PressVisibility = Visibility.Hidden;
  432. PressSlowVacVisibility = Visibility.Hidden;
  433. PressValveAngleVisibility = Visibility.Hidden;
  434. PressWaitVisibility = Visibility.Hidden;
  435. break;
  436. case "WaitPressUp1":
  437. case "WaitPressDown1":
  438. case "WaitPressUp2":
  439. case "WaitPressDown2":
  440. PressVisibility = Visibility.Hidden;
  441. PressSlowVacVisibility = Visibility.Hidden;
  442. PressValveAngleVisibility = Visibility.Hidden;
  443. PressWaitVisibility = Visibility.Visible;
  444. break;
  445. default:
  446. break;
  447. }
  448. }
  449. public void SetPressValue(string selectedCmd, string Values)
  450. {
  451. switch (selectedCmd)
  452. {
  453. case "Press":
  454. case "Press2":
  455. if (string.IsNullOrEmpty(Values)) return;
  456. string[] list = Values.Split(';');
  457. if (list.Length < 2) return;
  458. PressPID = list[0];
  459. PressSet = double.Parse(list[1]);
  460. break;
  461. case "Slow Vac":
  462. if (string.IsNullOrEmpty(Values)) return;
  463. PressSlowVacSet = double.Parse(Values);
  464. break;
  465. case "Valve Angle":
  466. if (string.IsNullOrEmpty(Values)) return;
  467. PressValveAngleSet = double.Parse(Values);
  468. break;
  469. case "Full Open":
  470. case "Full Close":
  471. case "Hold":
  472. case "Zero Set":
  473. case "Cancel Zero":
  474. break;
  475. case "WaitPressUp1":
  476. case "WaitPressDown1":
  477. case "WaitPressUp2":
  478. case "WaitPressDown2":
  479. if (string.IsNullOrEmpty(Values)) return;
  480. PressWait = double.Parse(Values);
  481. break;
  482. default:
  483. break;
  484. }
  485. }
  486. public string GetSavePressValue(string selectedCmd)
  487. {
  488. switch (selectedCmd)
  489. {
  490. case "Press":
  491. case "Press2":
  492. return $"{PressPID};{PressSet}";
  493. case "Slow Vac":
  494. return PressSlowVacSet.ToString();
  495. case "Valve Angle":
  496. return PressValveAngleSet.ToString();
  497. case "Full Open":
  498. case "Full Close":
  499. case "Hold":
  500. case "Zero Set":
  501. case "Cancel Zero":
  502. return "";
  503. case "WaitPressUp1":
  504. case "WaitPressDown1":
  505. case "WaitPressUp2":
  506. case "WaitPressDown2":
  507. return PressWait.ToString();
  508. default:
  509. return "";
  510. }
  511. }
  512. private string _pressPID;
  513. public string PressPID
  514. {
  515. get => _pressPID;
  516. set
  517. {
  518. _pressPID = value;
  519. NotifyOfPropertyChange(nameof(PressPID));
  520. }
  521. }
  522. private double _pressSet;
  523. public double PressSet
  524. {
  525. get => _pressSet;
  526. set
  527. {
  528. _pressSet = value;
  529. NotifyOfPropertyChange(nameof(PressSet));
  530. }
  531. }
  532. private double _pressSlowVacSet;
  533. public double PressSlowVacSet
  534. {
  535. get => _pressSlowVacSet;
  536. set
  537. {
  538. _pressSlowVacSet = value;
  539. NotifyOfPropertyChange(nameof(PressSlowVacSet));
  540. }
  541. }
  542. private double _pressValveAngleSet;
  543. public double PressValveAngleSet
  544. {
  545. get => _pressValveAngleSet;
  546. set
  547. {
  548. _pressValveAngleSet = value;
  549. NotifyOfPropertyChange(nameof(PressValveAngleSet));
  550. }
  551. }
  552. private string _lowPressWait = "None";
  553. public string LowPressWait
  554. {
  555. get => _lowPressWait;
  556. set
  557. {
  558. _lowPressWait = value;
  559. NotifyOfPropertyChange(nameof(LowPressWait));
  560. }
  561. }
  562. private double _pressWait;
  563. public double PressWait
  564. {
  565. get => _pressWait;
  566. set
  567. {
  568. _pressWait = value;
  569. NotifyOfPropertyChange(nameof(PressWait));
  570. }
  571. }
  572. private void ClearPressSetValue()
  573. {
  574. PressPID = "None";
  575. PressSet = 0;
  576. PressSlowVacSet = 0;
  577. PressValveAngleSet = 0;
  578. LowPressWait = "None";
  579. PressWait = 0;
  580. }
  581. #endregion
  582. #region AlarmRecipe Visibility
  583. public bool IsAlarmReicpe => RecipeType.ToLower() == "alarm";
  584. public bool IsAbortReicpe => RecipeType.ToLower() == "abort";
  585. public bool IsSubReicpe => RecipeType.ToLower() == "sub";
  586. public bool IsTableVisibility => IsAlarmReicpe || IsAbortReicpe || IsSubReicpe;
  587. public bool IsRecipeHeaderVisibility => !IsTableVisibility;
  588. public bool IsVPDataListVisibility => !IsTableVisibility;
  589. public bool IsCombinationVisibility => !IsTableVisibility;
  590. #endregion
  591. private bool _noStandbyIsEnabled = false;
  592. public bool NoStandbyIsEnabled
  593. {
  594. get => _noStandbyIsEnabled;
  595. set
  596. {
  597. _noStandbyIsEnabled = value;
  598. NotifyOfPropertyChange(nameof(NoStandbyIsEnabled));
  599. }
  600. }
  601. private Visibility _standbyIsVisibility = Visibility.Visible;
  602. public Visibility StandbyIsVisibility
  603. {
  604. get => _standbyIsVisibility;
  605. set
  606. {
  607. _standbyIsVisibility = value;
  608. NotifyOfPropertyChange(nameof(StandbyIsVisibility));
  609. }
  610. }
  611. private string _selectedGasSetting2;
  612. public string SelectedGasSetting2
  613. {
  614. get
  615. {
  616. return _selectedGasSetting2;
  617. }
  618. set
  619. {
  620. _selectedGasSetting2 = value;
  621. NotifyOfPropertyChange(nameof(SelectedGasSetting2));
  622. }
  623. }
  624. private string _selectedGasSetting3;
  625. public string SelectedGasSetting3
  626. {
  627. get
  628. {
  629. return _selectedGasSetting3;
  630. }
  631. set
  632. {
  633. _selectedGasSetting3 = value;
  634. NotifyOfPropertyChange(nameof(SelectedGasSetting3));
  635. }
  636. }
  637. private string _selectedGasSetting4;
  638. public string SelectedGasSetting4
  639. {
  640. get
  641. {
  642. return _selectedGasSetting4;
  643. }
  644. set
  645. {
  646. _selectedGasSetting4 = value;
  647. NotifyOfPropertyChange(nameof(SelectedGasSetting4));
  648. }
  649. }
  650. private string _selectedGasSetting5;
  651. public string SelectedGasSetting5
  652. {
  653. get
  654. {
  655. return _selectedGasSetting5;
  656. }
  657. set
  658. {
  659. _selectedGasSetting5 = value;
  660. NotifyOfPropertyChange(nameof(SelectedGasSetting5));
  661. }
  662. }
  663. private string _selectedGasSetting6;
  664. public string SelectedGasSetting6
  665. {
  666. get
  667. {
  668. return _selectedGasSetting6;
  669. }
  670. set
  671. {
  672. _selectedGasSetting6 = value;
  673. NotifyOfPropertyChange(nameof(SelectedGasSetting6));
  674. }
  675. }
  676. private List<ConfigNode> _ConfigNodes = new List<ConfigNode>();
  677. public List<ConfigNode> ConfigNodes
  678. {
  679. get { return _ConfigNodes; }
  680. set
  681. {
  682. _ConfigNodes = value;
  683. NotifyOfPropertyChange(nameof(ConfigNodes));
  684. }
  685. }
  686. public ObservableCollection<TempManualSetData> TempList { get; set; } = new ObservableCollection<TempManualSetData>();
  687. private ObservableCollection<MFCGasData> _mFCDatas = new ObservableCollection<MFCGasData>();
  688. public ObservableCollection<MFCGasData> MFCDataList
  689. {
  690. get => _mFCDatas;
  691. set
  692. {
  693. _mFCDatas = value;
  694. NotifyOfPropertyChange(nameof(MFCDataList));
  695. }
  696. }
  697. private string _pressureUnit;
  698. public string PressureUnit
  699. {
  700. get => _pressureUnit;
  701. set
  702. {
  703. _pressureUnit = value;
  704. NotifyOfPropertyChange(nameof(PressureUnit));
  705. }
  706. }
  707. public string RecipeType { get; set; }
  708. public ManualSetViewModel()
  709. {
  710. }
  711. protected override void OnViewLoaded(object view)
  712. {
  713. base.OnViewLoaded(view);
  714. }
  715. protected override void OnActivate()
  716. {
  717. base.OnActivate();
  718. //InvokeClient.Instance.Service.DoOperation($"PM1.SetSensorRecipeOK", "");
  719. LoadData();
  720. }
  721. protected override void OnDeactivate(bool close)
  722. {
  723. base.OnDeactivate(close);
  724. //InvokeClient.Instance.Service.DoOperation($"PM1.SetSensorPROCManualOK", "");
  725. }
  726. protected override void OnInitialize()
  727. {
  728. base.OnInitialize();
  729. // GetHeaderConfig();
  730. }
  731. private void LoadData()
  732. {
  733. firstUpdate = true;
  734. }
  735. //撤销修改
  736. public void RecipeIsChangeClick(object cmdName, object value)
  737. {
  738. var windowManager = IoC.Get<IWindowManager>();
  739. switch ((string)cmdName)
  740. {
  741. case "Alarm":
  742. break;
  743. case "MFC":
  744. break;
  745. case "Gas":
  746. break;
  747. case "AUX":
  748. break;
  749. case "Press":
  750. break;
  751. case "Temp":
  752. break;
  753. default:
  754. break;
  755. }
  756. }
  757. public void TempSetClick(object sender)
  758. {
  759. string stSetValue = ShowNumberKeyboard(sender as Button, "", 1);
  760. foreach (var item in TempList)
  761. {
  762. item.Value = stSetValue;
  763. item.IsSetChanged = false;
  764. }
  765. }
  766. public Dictionary<string, bool> DictValve { get; set; } = new Dictionary<string, bool>();
  767. public Dictionary<string, string> DictMFC { get; set; } = new Dictionary<string, string>();
  768. public Dictionary<string, string> DictMFCRamp { get; set; } = new Dictionary<string, string>();
  769. public Dictionary<string, bool> PumpSetValues { get; set; } = new Dictionary<string, bool>();
  770. public Dictionary<string, bool> F2HFClnOrHFCl2Values { get; set; } = new Dictionary<string, bool>();
  771. private Dictionary<string, string> ChangedDictMFC(Dictionary<string, double> oldDict)
  772. {
  773. Dictionary<string, string> rtnKeyValue = new Dictionary<string, string>();
  774. foreach (var item in oldDict.Keys)
  775. {
  776. rtnKeyValue.Add(item, oldDict[item].ToString());
  777. }
  778. return rtnKeyValue;
  779. }
  780. public void PatternCmd()
  781. {
  782. string toolType = (string)QueryDataClient.Instance.Service.GetConfig("System.SetUp.ToolType");
  783. if (!string.IsNullOrEmpty(toolType) && toolType.Equals(ConstantsCommon.ELK))
  784. {
  785. FurnaceUI.Views.Maintenances.Maintenances.ELK.GasPanelViewModel gasPanelTwoView = new Maintenances.Maintenances.ELK.GasPanelViewModel();
  786. gasPanelTwoView.MFCDataList = MFCDataList;
  787. var rtn = (wm as WindowManager)?.ShowDialogWithTitle(gasPanelTwoView, null, " Gas Panel");
  788. if ((bool)rtn)
  789. {
  790. DictValve = gasPanelTwoView.DictChangedValve;
  791. DictMFC = ChangedDictMFC(gasPanelTwoView.DictChangedMFC);
  792. DictMFCRamp = ChangedDictMFC(gasPanelTwoView.DictChangedMFCRamp);
  793. foreach (var item in DictMFC)
  794. {
  795. var tempMFC = MFCDataList.FirstOrDefault(x => x.Name == item.Key);
  796. if (tempMFC != null)
  797. {
  798. tempMFC.IsSetChanged = false;
  799. tempMFC.Value = item.Value;
  800. }
  801. }
  802. foreach (var item in DictMFCRamp)
  803. {
  804. var tempMFC = MFCDataList.FirstOrDefault(x => x.Name == item.Key);
  805. if (tempMFC != null)
  806. {
  807. tempMFC.IsRampngChanged = false;
  808. tempMFC.Rampng = item.Value;
  809. }
  810. }
  811. if (DictMFC.Count == 0 && DictMFCRamp.Count == 0)
  812. {
  813. for (int i = 0; i < MFCDataList.Count; i++)
  814. {
  815. double setLastPoint = (double)QueryDataClient.Instance.Service.GetConfig($"PM1.MFC.{MFCDataList[i].DisplayName}.SetLastPoint");
  816. double setLastRamping = (double)QueryDataClient.Instance.Service.GetConfig($"PM1.MFC.{MFCDataList[i].DisplayName}.SetLastRamping");
  817. MFCDataList[i].Value = setLastPoint.ToString("f3");
  818. MFCDataList[i].Rampng = setLastRamping.ToString("f3");
  819. MFCDataList[i].IsSetChanged = true;
  820. MFCDataList[i].IsRampngChanged = true;
  821. };
  822. }
  823. if (gasPanelTwoView.DictChangedPumpValve.Count > 0)
  824. {
  825. PumpSetValues.Clear();
  826. if (gasPanelTwoView.AGVPumpData != null && gasPanelTwoView.AGVPumpData.DefaultValue != gasPanelTwoView.AGVPumpData.Feedback)
  827. {
  828. PumpSetValues.Add(gasPanelTwoView.AGVPumpData.UniqueName, gasPanelTwoView.AGVPumpData.Feedback);
  829. // InvokeClient.Instance.Service.DoOperation($"{gasPanelTwoView.AGVPumpData.UniqueName}.{AITValveOperation.GVTurnValve}", gasPanelTwoView.AGVPumpData.Feedback);
  830. }
  831. if (gasPanelTwoView.AGV2PumpData != null && gasPanelTwoView.AGV2PumpData.DefaultValue != gasPanelTwoView.AGV2PumpData.Feedback)
  832. {
  833. PumpSetValues.Add(gasPanelTwoView.AGV2PumpData.UniqueName, gasPanelTwoView.AGV2PumpData.Feedback);
  834. }
  835. if (gasPanelTwoView.AUCPumpData != null && gasPanelTwoView.AUCPumpData.DefaultValue != gasPanelTwoView.AUCPumpData.Feedback)
  836. {
  837. PumpSetValues.Add(gasPanelTwoView.AUCPumpData.UniqueName, gasPanelTwoView.AUCPumpData.Feedback);
  838. // InvokeClient.Instance.Service.DoOperation($"{gasPanelTwoView.AUCPumpData.UniqueName}.{AITValveOperation.GVTurnValve}", gasPanelTwoView.AUCPumpData.Feedback);
  839. }
  840. if (gasPanelTwoView.BothPump1Data != null && gasPanelTwoView.BothPump1Data.DefaultValue != gasPanelTwoView.BothPump1Data.Feedback)
  841. {
  842. PumpSetValues.Add(gasPanelTwoView.BothPump1Data.UniqueName, gasPanelTwoView.BothPump1Data.Feedback);
  843. // InvokeClient.Instance.Service.DoOperation($"{gasPanelTwoView.BothPumpData.UniqueName}.{AITValveOperation.GVTurnValve}", gasPanelTwoView.BothPumpData.Feedback);
  844. }
  845. if (gasPanelTwoView.BothPump2Data != null && gasPanelTwoView.BothPump2Data.DefaultValue != gasPanelTwoView.BothPump2Data.Feedback)
  846. {
  847. PumpSetValues.Add(gasPanelTwoView.BothPump2Data.UniqueName, gasPanelTwoView.BothPump2Data.Feedback);
  848. // InvokeClient.Instance.Service.DoOperation($"{gasPanelTwoView.BothPumpData.UniqueName}.{AITValveOperation.GVTurnValve}", gasPanelTwoView.BothPumpData.Feedback);
  849. }
  850. if (gasPanelTwoView.ValveBWRData != null && gasPanelTwoView.ValveBWRData.DefaultValue != gasPanelTwoView.ValveBWRData.Feedback)
  851. {
  852. PumpSetValues.Add(gasPanelTwoView.ValveBWRData.UniqueName, gasPanelTwoView.ValveBWRData.Feedback);
  853. // InvokeClient.Instance.Service.DoOperation($"{gasPanelTwoView.ValveBWRData.UniqueName}.{AITValveOperation.GVTurnValve}", gasPanelTwoView.ValveBWRData.Feedback);
  854. }
  855. if (gasPanelTwoView.ValveDPRData != null && gasPanelTwoView.ValveDPRData.DefaultValue != gasPanelTwoView.ValveDPRData.Feedback)
  856. {
  857. PumpSetValues.Add(gasPanelTwoView.ValveDPRData.UniqueName, gasPanelTwoView.ValveDPRData.Feedback);
  858. // InvokeClient.Instance.Service.DoOperation($"{gasPanelTwoView.ValveDPRData.UniqueName}.{AITValveOperation.GVTurnValve}", gasPanelTwoView.ValveDPRData.Feedback);
  859. }
  860. if (gasPanelTwoView.HREFData != null && gasPanelTwoView.HREFData.DefaultValue != gasPanelTwoView.HREFData.Feedback)
  861. {
  862. PumpSetValues.Add(gasPanelTwoView.HREFData.UniqueName, gasPanelTwoView.HREFData.Feedback);
  863. }
  864. if (gasPanelTwoView.CREF2Data != null && gasPanelTwoView.CREF2Data.DefaultValue != gasPanelTwoView.CREF2Data.Feedback)
  865. {
  866. PumpSetValues.Add(gasPanelTwoView.CREF2Data.UniqueName, gasPanelTwoView.CREF2Data.Feedback);
  867. }
  868. if (gasPanelTwoView.HZEROData != null && gasPanelTwoView.HZEROData.DefaultValue != gasPanelTwoView.HZEROData.Feedback)
  869. {
  870. PumpSetValues.Add(gasPanelTwoView.HZEROData.UniqueName, gasPanelTwoView.HZEROData.Feedback);
  871. }
  872. if (gasPanelTwoView.HMNTData != null && gasPanelTwoView.HMNTData.DefaultValue != gasPanelTwoView.HMNTData.Feedback)
  873. {
  874. PumpSetValues.Add(gasPanelTwoView.HMNTData.UniqueName, gasPanelTwoView.HMNTData.Feedback);
  875. }
  876. if (gasPanelTwoView.CMNTData != null && gasPanelTwoView.CMNTData.DefaultValue != gasPanelTwoView.CMNTData.Feedback)
  877. {
  878. PumpSetValues.Add(gasPanelTwoView.CMNTData.UniqueName, gasPanelTwoView.CMNTData.Feedback);
  879. }
  880. if (gasPanelTwoView.CZEROData != null && gasPanelTwoView.CZEROData.DefaultValue != gasPanelTwoView.CZEROData.Feedback)
  881. {
  882. PumpSetValues.Add(gasPanelTwoView.CZEROData.UniqueName, gasPanelTwoView.CZEROData.Feedback);
  883. }
  884. F2HFClnOrHFCl2Values.Clear();
  885. if (gasPanelTwoView.IsDEPOOn != gasPanelTwoView.IsOldDEPOOn)
  886. {
  887. F2HFClnOrHFCl2Values.Add("PM1.SetDEPOEnable", gasPanelTwoView.IsDEPOOn);
  888. // InvokeClient.Instance.Service.DoOperation($"PM1.SetF2ClnEnable", gasPanelTwoView.IsF2ClnOn);
  889. }
  890. if (gasPanelTwoView.IsF2ClnOn != gasPanelTwoView.IsOldF2ClnOn)
  891. {
  892. F2HFClnOrHFCl2Values.Add("PM1.SetF2ClnEnable", gasPanelTwoView.IsF2ClnOn);
  893. // InvokeClient.Instance.Service.DoOperation($"PM1.SetF2ClnEnable", gasPanelTwoView.IsF2ClnOn);
  894. }
  895. if (gasPanelTwoView.IsHFClnOn != gasPanelTwoView.IsOldHFClnOn)
  896. {
  897. F2HFClnOrHFCl2Values.Add("PM1.SetHFClnEnable", gasPanelTwoView.IsHFClnOn);
  898. //InvokeClient.Instance.Service.DoOperation($"PM1.SetHFClnEnable", gasPanelTwoView.IsHFClnOn);
  899. }
  900. if (gasPanelTwoView.IsHTR1Enable != gasPanelTwoView.IsOldHTR1Enable)
  901. {
  902. F2HFClnOrHFCl2Values.Add("PM1.SetHTR1Enable", gasPanelTwoView.IsHTR1Enable);
  903. // InvokeClient.Instance.Service.DoOperation($"PM1.SetHTR1Enable", gasPanelTwoView.IsHTR1Enable);
  904. }
  905. if (gasPanelTwoView.IsHTR2Enable != gasPanelTwoView.IsOldHTR2Enable)
  906. {
  907. F2HFClnOrHFCl2Values.Add("PM1.SetHTR2Enable", gasPanelTwoView.IsHTR2Enable);
  908. //InvokeClient.Instance.Service.DoOperation($"PM1.SetHTR2Enable", gasPanelTwoView.IsHTR2Enable);
  909. }
  910. if (gasPanelTwoView.IsHTR3Enable != gasPanelTwoView.IsOldHTR3Enable)
  911. {
  912. F2HFClnOrHFCl2Values.Add("PM1.SetHTR3Enable", gasPanelTwoView.IsHTR3Enable);
  913. //InvokeClient.Instance.Service.DoOperation($"PM1.SetHTR2Enable", gasPanelTwoView.IsHTR2Enable);
  914. }
  915. if (gasPanelTwoView.IsCEXHOn != gasPanelTwoView.IsOldCEXHOn)
  916. {
  917. F2HFClnOrHFCl2Values.Add("PM1.SetCEXHEnable", gasPanelTwoView.IsCEXHOn);
  918. //InvokeClient.Instance.Service.DoOperation($"PM1.SetHTR2Enable", gasPanelTwoView.IsHTR2Enable);
  919. }
  920. if (gasPanelTwoView.IsCREFOn != gasPanelTwoView.IsOldCREFOn)
  921. {
  922. F2HFClnOrHFCl2Values.Add("PM1.SetCREFEnable", gasPanelTwoView.IsCREFOn);
  923. //InvokeClient.Instance.Service.DoOperation($"PM1.SetHTR2Enable", gasPanelTwoView.IsHTR2Enable);
  924. }
  925. if (gasPanelTwoView.IsSIREFOn != gasPanelTwoView.IsOldSIREFOn)
  926. {
  927. F2HFClnOrHFCl2Values.Add("PM1.SetSIREFEnable", gasPanelTwoView.IsSIREFOn);
  928. //InvokeClient.Instance.Service.DoOperation($"PM1.SetHTR2Enable", gasPanelTwoView.IsHTR2Enable);
  929. }
  930. }
  931. }
  932. }
  933. else if (!string.IsNullOrEmpty(toolType) && toolType.Equals(ConstantsCommon.SIBCN))
  934. {
  935. FurnaceUI.Views.Maintenances.Maintenances.SiBCN.GasPanelViewModel gasPanelTwoView = new Maintenances.Maintenances.SiBCN.GasPanelViewModel();
  936. gasPanelTwoView.MFCDataList = MFCDataList;
  937. var rtn = (wm as WindowManager)?.ShowDialogWithTitle(gasPanelTwoView, null, " Gas Panel");
  938. if ((bool)rtn)
  939. {
  940. DictValve = gasPanelTwoView.DictChangedValve;
  941. DictMFC = ChangedDictMFC(gasPanelTwoView.DictChangedMFC);
  942. foreach (var item in DictMFC)
  943. {
  944. var tempMFC = MFCDataList.FirstOrDefault(x => x.Name == item.Key);
  945. if (tempMFC != null)
  946. {
  947. tempMFC.IsSetChanged = false;
  948. tempMFC.Value = item.Value;
  949. }
  950. }
  951. if (DictMFC.Count == 0)
  952. {
  953. for (int i = 0; i < MFCDataList.Count; i++)
  954. {
  955. double setLastPoint = (double)QueryDataClient.Instance.Service.GetConfig($"PM1.MFC.{MFCDataList[i].DisplayName}.SetLastPoint");
  956. double setLastRamping = (double)QueryDataClient.Instance.Service.GetConfig($"PM1.MFC.{MFCDataList[i].DisplayName}.SetLastRamping");
  957. MFCDataList[i].Value = setLastPoint.ToString("f3");
  958. MFCDataList[i].Rampng = setLastRamping.ToString("f3");
  959. MFCDataList[i].IsSetChanged = true;
  960. };
  961. }
  962. if (gasPanelTwoView.DictChangedPumpValve.Count > 0)
  963. {
  964. PumpSetValues.Clear();
  965. if (gasPanelTwoView.AGVPumpData != null && gasPanelTwoView.AGVPumpData.DefaultValue != gasPanelTwoView.AGVPumpData.Feedback)
  966. {
  967. PumpSetValues.Add(gasPanelTwoView.AGVPumpData.UniqueName, gasPanelTwoView.AGVPumpData.Feedback);
  968. // InvokeClient.Instance.Service.DoOperation($"{gasPanelTwoView.AGVPumpData.UniqueName}.{AITValveOperation.GVTurnValve}", gasPanelTwoView.AGVPumpData.Feedback);
  969. }
  970. if (gasPanelTwoView.AUCPumpData != null && gasPanelTwoView.AUCPumpData.DefaultValue != gasPanelTwoView.AUCPumpData.Feedback)
  971. {
  972. PumpSetValues.Add(gasPanelTwoView.AUCPumpData.UniqueName, gasPanelTwoView.AUCPumpData.Feedback);
  973. // InvokeClient.Instance.Service.DoOperation($"{gasPanelTwoView.AUCPumpData.UniqueName}.{AITValveOperation.GVTurnValve}", gasPanelTwoView.AUCPumpData.Feedback);
  974. }
  975. if (gasPanelTwoView.BothPumpData != null && gasPanelTwoView.BothPumpData.DefaultValue != gasPanelTwoView.BothPumpData.Feedback)
  976. {
  977. PumpSetValues.Add(gasPanelTwoView.BothPumpData.UniqueName, gasPanelTwoView.BothPumpData.Feedback);
  978. // InvokeClient.Instance.Service.DoOperation($"{gasPanelTwoView.BothPumpData.UniqueName}.{AITValveOperation.GVTurnValve}", gasPanelTwoView.BothPumpData.Feedback);
  979. }
  980. if (gasPanelTwoView.ValveBWRData != null && gasPanelTwoView.ValveBWRData.DefaultValue != gasPanelTwoView.ValveBWRData.Feedback)
  981. {
  982. PumpSetValues.Add(gasPanelTwoView.ValveBWRData.UniqueName, gasPanelTwoView.ValveBWRData.Feedback);
  983. // InvokeClient.Instance.Service.DoOperation($"{gasPanelTwoView.ValveBWRData.UniqueName}.{AITValveOperation.GVTurnValve}", gasPanelTwoView.ValveBWRData.Feedback);
  984. }
  985. if (gasPanelTwoView.ValveDPRData != null && gasPanelTwoView.ValveDPRData.DefaultValue != gasPanelTwoView.ValveDPRData.Feedback)
  986. {
  987. PumpSetValues.Add(gasPanelTwoView.ValveDPRData.UniqueName, gasPanelTwoView.ValveDPRData.Feedback);
  988. // InvokeClient.Instance.Service.DoOperation($"{gasPanelTwoView.ValveDPRData.UniqueName}.{AITValveOperation.GVTurnValve}", gasPanelTwoView.ValveDPRData.Feedback);
  989. }
  990. F2HFClnOrHFCl2Values.Clear();
  991. if (gasPanelTwoView.IsDEPOOn != gasPanelTwoView.IsOldDEPOOn)
  992. {
  993. F2HFClnOrHFCl2Values.Add("PM1.SetDEPOEnable", gasPanelTwoView.IsDEPOOn);
  994. // InvokeClient.Instance.Service.DoOperation($"PM1.SetF2ClnEnable", gasPanelTwoView.IsF2ClnOn);
  995. }
  996. if (gasPanelTwoView.IsF2ClnOn != gasPanelTwoView.IsOldF2ClnOn)
  997. {
  998. F2HFClnOrHFCl2Values.Add("PM1.SetF2ClnEnable", gasPanelTwoView.IsF2ClnOn);
  999. // InvokeClient.Instance.Service.DoOperation($"PM1.SetF2ClnEnable", gasPanelTwoView.IsF2ClnOn);
  1000. }
  1001. if (gasPanelTwoView.IsHFClnOn != gasPanelTwoView.IsOldHFClnOn)
  1002. {
  1003. F2HFClnOrHFCl2Values.Add("PM1.SetHFClnEnable", gasPanelTwoView.IsHFClnOn);
  1004. //InvokeClient.Instance.Service.DoOperation($"PM1.SetHFClnEnable", gasPanelTwoView.IsHFClnOn);
  1005. }
  1006. if (gasPanelTwoView.IsHTR1Enable != gasPanelTwoView.IsOldHTR1Enable)
  1007. {
  1008. F2HFClnOrHFCl2Values.Add("PM1.SetHTR1Enable", gasPanelTwoView.IsHTR1Enable);
  1009. // InvokeClient.Instance.Service.DoOperation($"PM1.SetHTR1Enable", gasPanelTwoView.IsHTR1Enable);
  1010. }
  1011. if (gasPanelTwoView.IsHTR2Enable != gasPanelTwoView.IsOldHTR2Enable)
  1012. {
  1013. F2HFClnOrHFCl2Values.Add("PM1.SetHTR2Enable", gasPanelTwoView.IsHTR2Enable);
  1014. //InvokeClient.Instance.Service.DoOperation($"PM1.SetHTR2Enable", gasPanelTwoView.IsHTR2Enable);
  1015. }
  1016. if (gasPanelTwoView.IsHTR3Enable != gasPanelTwoView.IsOldHTR3Enable)
  1017. {
  1018. F2HFClnOrHFCl2Values.Add("PM1.SetHTR3Enable", gasPanelTwoView.IsHTR3Enable);
  1019. //InvokeClient.Instance.Service.DoOperation($"PM1.SetHTR2Enable", gasPanelTwoView.IsHTR2Enable);
  1020. }
  1021. if (gasPanelTwoView.IsCEXHOn != gasPanelTwoView.IsOldCEXHOn)
  1022. {
  1023. F2HFClnOrHFCl2Values.Add("PM1.SetCEXHEnable", gasPanelTwoView.IsCEXHOn);
  1024. //InvokeClient.Instance.Service.DoOperation($"PM1.SetHTR2Enable", gasPanelTwoView.IsHTR2Enable);
  1025. }
  1026. }
  1027. }
  1028. }
  1029. else if (!string.IsNullOrEmpty(toolType) && toolType.Equals(ConstantsCommon.TiN))
  1030. {
  1031. FurnaceUI.Views.Maintenances.Maintenances.TiN.GasPanelViewModel gasPanelTwoView = new Maintenances.Maintenances.TiN.GasPanelViewModel();
  1032. gasPanelTwoView.MFCDataList = MFCDataList;
  1033. var rtn = (wm as WindowManager)?.ShowDialogWithTitle(gasPanelTwoView, null, " Gas Panel");
  1034. if ((bool)rtn)
  1035. {
  1036. DictValve = gasPanelTwoView.DictChangedValve;
  1037. DictMFC = ChangedDictMFC(gasPanelTwoView.DictChangedMFC);
  1038. foreach (var item in DictMFC)
  1039. {
  1040. var tempMFC = MFCDataList.FirstOrDefault(x => x.Name == item.Key);
  1041. if (tempMFC != null)
  1042. {
  1043. tempMFC.IsSetChanged = false;
  1044. tempMFC.Value = item.Value;
  1045. }
  1046. }
  1047. if (DictMFC.Count == 0)
  1048. {
  1049. for (int i = 0; i < MFCDataList.Count; i++)
  1050. {
  1051. double setLastPoint = (double)QueryDataClient.Instance.Service.GetConfig($"PM1.MFC.{MFCDataList[i].DisplayName}.SetLastPoint");
  1052. double setLastRamping = (double)QueryDataClient.Instance.Service.GetConfig($"PM1.MFC.{MFCDataList[i].DisplayName}.SetLastRamping");
  1053. MFCDataList[i].Value = setLastPoint.ToString("f3");
  1054. MFCDataList[i].Rampng = setLastRamping.ToString("f3");
  1055. MFCDataList[i].IsSetChanged = true;
  1056. };
  1057. }
  1058. if (gasPanelTwoView.DictChangedPumpValve.Count > 0)
  1059. {
  1060. PumpSetValues.Clear();
  1061. if (gasPanelTwoView.AGVPumpData != null && gasPanelTwoView.AGVPumpData.DefaultValue != gasPanelTwoView.AGVPumpData.Feedback)
  1062. {
  1063. PumpSetValues.Add(gasPanelTwoView.AGVPumpData.UniqueName, gasPanelTwoView.AGVPumpData.Feedback);
  1064. // InvokeClient.Instance.Service.DoOperation($"{gasPanelTwoView.AGVPumpData.UniqueName}.{AITValveOperation.GVTurnValve}", gasPanelTwoView.AGVPumpData.Feedback);
  1065. }
  1066. if (gasPanelTwoView.AUCPumpData != null && gasPanelTwoView.AUCPumpData.DefaultValue != gasPanelTwoView.AUCPumpData.Feedback)
  1067. {
  1068. PumpSetValues.Add(gasPanelTwoView.AUCPumpData.UniqueName, gasPanelTwoView.AUCPumpData.Feedback);
  1069. // InvokeClient.Instance.Service.DoOperation($"{gasPanelTwoView.AUCPumpData.UniqueName}.{AITValveOperation.GVTurnValve}", gasPanelTwoView.AUCPumpData.Feedback);
  1070. }
  1071. if (gasPanelTwoView.BothPumpData != null && gasPanelTwoView.BothPumpData.DefaultValue != gasPanelTwoView.BothPumpData.Feedback)
  1072. {
  1073. PumpSetValues.Add(gasPanelTwoView.BothPumpData.UniqueName, gasPanelTwoView.BothPumpData.Feedback);
  1074. // InvokeClient.Instance.Service.DoOperation($"{gasPanelTwoView.BothPumpData.UniqueName}.{AITValveOperation.GVTurnValve}", gasPanelTwoView.BothPumpData.Feedback);
  1075. }
  1076. if (gasPanelTwoView.ValveBWRData != null && gasPanelTwoView.ValveBWRData.DefaultValue != gasPanelTwoView.ValveBWRData.Feedback)
  1077. {
  1078. PumpSetValues.Add(gasPanelTwoView.ValveBWRData.UniqueName, gasPanelTwoView.ValveBWRData.Feedback);
  1079. // InvokeClient.Instance.Service.DoOperation($"{gasPanelTwoView.ValveBWRData.UniqueName}.{AITValveOperation.GVTurnValve}", gasPanelTwoView.ValveBWRData.Feedback);
  1080. }
  1081. if (gasPanelTwoView.ValveDPRData != null && gasPanelTwoView.ValveDPRData.DefaultValue != gasPanelTwoView.ValveDPRData.Feedback)
  1082. {
  1083. PumpSetValues.Add(gasPanelTwoView.ValveDPRData.UniqueName, gasPanelTwoView.ValveDPRData.Feedback);
  1084. // InvokeClient.Instance.Service.DoOperation($"{gasPanelTwoView.ValveDPRData.UniqueName}.{AITValveOperation.GVTurnValve}", gasPanelTwoView.ValveDPRData.Feedback);
  1085. }
  1086. F2HFClnOrHFCl2Values.Clear();
  1087. if (gasPanelTwoView.IsDEPOOn != gasPanelTwoView.IsOldDEPOOn)
  1088. {
  1089. F2HFClnOrHFCl2Values.Add("PM1.SetDEPOEnable", gasPanelTwoView.IsDEPOOn);
  1090. // InvokeClient.Instance.Service.DoOperation($"PM1.SetF2ClnEnable", gasPanelTwoView.IsF2ClnOn);
  1091. }
  1092. if (gasPanelTwoView.IsF2ClnOn != gasPanelTwoView.IsOldF2ClnOn)
  1093. {
  1094. F2HFClnOrHFCl2Values.Add("PM1.SetF2ClnEnable", gasPanelTwoView.IsF2ClnOn);
  1095. // InvokeClient.Instance.Service.DoOperation($"PM1.SetF2ClnEnable", gasPanelTwoView.IsF2ClnOn);
  1096. }
  1097. if (gasPanelTwoView.IsHFClnOn != gasPanelTwoView.IsOldHFClnOn)
  1098. {
  1099. F2HFClnOrHFCl2Values.Add("PM1.SetHFClnEnable", gasPanelTwoView.IsHFClnOn);
  1100. //InvokeClient.Instance.Service.DoOperation($"PM1.SetHFClnEnable", gasPanelTwoView.IsHFClnOn);
  1101. }
  1102. if (gasPanelTwoView.IsHTR1Enable != gasPanelTwoView.IsOldHTR1Enable)
  1103. {
  1104. F2HFClnOrHFCl2Values.Add("PM1.SetHTR1Enable", gasPanelTwoView.IsHTR1Enable);
  1105. // InvokeClient.Instance.Service.DoOperation($"PM1.SetHTR1Enable", gasPanelTwoView.IsHTR1Enable);
  1106. }
  1107. if (gasPanelTwoView.IsHTR2Enable != gasPanelTwoView.IsOldHTR2Enable)
  1108. {
  1109. F2HFClnOrHFCl2Values.Add("PM1.SetHTR2Enable", gasPanelTwoView.IsHTR2Enable);
  1110. //InvokeClient.Instance.Service.DoOperation($"PM1.SetHTR2Enable", gasPanelTwoView.IsHTR2Enable);
  1111. }
  1112. if (gasPanelTwoView.IsHTR3Enable != gasPanelTwoView.IsOldHTR3Enable)
  1113. {
  1114. F2HFClnOrHFCl2Values.Add("PM1.SetHTR3Enable", gasPanelTwoView.IsHTR3Enable);
  1115. //InvokeClient.Instance.Service.DoOperation($"PM1.SetHTR2Enable", gasPanelTwoView.IsHTR2Enable);
  1116. }
  1117. if (gasPanelTwoView.IsCEXHOn != gasPanelTwoView.IsOldCEXHOn)
  1118. {
  1119. F2HFClnOrHFCl2Values.Add("PM1.SetCEXHEnable", gasPanelTwoView.IsCEXHOn);
  1120. //InvokeClient.Instance.Service.DoOperation($"PM1.SetHTR2Enable", gasPanelTwoView.IsHTR2Enable);
  1121. }
  1122. }
  1123. }
  1124. }
  1125. else
  1126. {
  1127. FurnaceUI.Views.Maintenances.GasPanelTwoViewModel gasPanelTwoView = new FurnaceUI.Views.Maintenances.GasPanelTwoViewModel();
  1128. gasPanelTwoView.MFCDataList = MFCDataList;
  1129. var rtn = (wm as WindowManager)?.ShowDialogWithTitle(gasPanelTwoView, null, " Gas Panel");
  1130. if ((bool)rtn)
  1131. {
  1132. DictValve = gasPanelTwoView.DictChangedValve;
  1133. DictMFC = ChangedDictMFC(gasPanelTwoView.DictChangedMFC);
  1134. foreach (var item in DictMFC)
  1135. {
  1136. var tempMFC = MFCDataList.FirstOrDefault(x => x.Name == item.Key);
  1137. if (tempMFC != null)
  1138. {
  1139. tempMFC.IsSetChanged = false;
  1140. tempMFC.Value = item.Value;
  1141. }
  1142. }
  1143. if (DictMFC.Count == 0)
  1144. {
  1145. for (int i = 0; i < MFCDataList.Count; i++)
  1146. {
  1147. double setLastPoint = (double)QueryDataClient.Instance.Service.GetConfig($"PM1.MFC.{MFCDataList[i].DisplayName}.SetLastPoint");
  1148. double setLastRamping = (double)QueryDataClient.Instance.Service.GetConfig($"PM1.MFC.{MFCDataList[i].DisplayName}.SetLastRamping");
  1149. MFCDataList[i].Value = setLastPoint.ToString("f3");
  1150. MFCDataList[i].Rampng = setLastRamping.ToString("f3");
  1151. MFCDataList[i].IsSetChanged = true;
  1152. };
  1153. }
  1154. if (gasPanelTwoView.DictChangedPumpValve.Count > 0)
  1155. {
  1156. PumpSetValues.Clear();
  1157. if (gasPanelTwoView.AGVPumpData != null && gasPanelTwoView.AGVPumpData.DefaultValue != gasPanelTwoView.AGVPumpData.Feedback)
  1158. {
  1159. PumpSetValues.Add(gasPanelTwoView.AGVPumpData.UniqueName, gasPanelTwoView.AGVPumpData.Feedback);
  1160. // InvokeClient.Instance.Service.DoOperation($"{gasPanelTwoView.AGVPumpData.UniqueName}.{AITValveOperation.GVTurnValve}", gasPanelTwoView.AGVPumpData.Feedback);
  1161. }
  1162. if (gasPanelTwoView.AUCPumpData != null && gasPanelTwoView.AUCPumpData.DefaultValue != gasPanelTwoView.AUCPumpData.Feedback)
  1163. {
  1164. PumpSetValues.Add(gasPanelTwoView.AUCPumpData.UniqueName, gasPanelTwoView.AUCPumpData.Feedback);
  1165. // InvokeClient.Instance.Service.DoOperation($"{gasPanelTwoView.AUCPumpData.UniqueName}.{AITValveOperation.GVTurnValve}", gasPanelTwoView.AUCPumpData.Feedback);
  1166. }
  1167. if (gasPanelTwoView.BothPumpData != null && gasPanelTwoView.BothPumpData.DefaultValue != gasPanelTwoView.BothPumpData.Feedback)
  1168. {
  1169. PumpSetValues.Add(gasPanelTwoView.BothPumpData.UniqueName, gasPanelTwoView.BothPumpData.Feedback);
  1170. // InvokeClient.Instance.Service.DoOperation($"{gasPanelTwoView.BothPumpData.UniqueName}.{AITValveOperation.GVTurnValve}", gasPanelTwoView.BothPumpData.Feedback);
  1171. }
  1172. if (gasPanelTwoView.ValveBWRData != null && gasPanelTwoView.ValveBWRData.DefaultValue != gasPanelTwoView.ValveBWRData.Feedback)
  1173. {
  1174. PumpSetValues.Add(gasPanelTwoView.ValveBWRData.UniqueName, gasPanelTwoView.ValveBWRData.Feedback);
  1175. // InvokeClient.Instance.Service.DoOperation($"{gasPanelTwoView.ValveBWRData.UniqueName}.{AITValveOperation.GVTurnValve}", gasPanelTwoView.ValveBWRData.Feedback);
  1176. }
  1177. if (gasPanelTwoView.ValveDPRData != null && gasPanelTwoView.ValveDPRData.DefaultValue != gasPanelTwoView.ValveDPRData.Feedback)
  1178. {
  1179. PumpSetValues.Add(gasPanelTwoView.ValveDPRData.UniqueName, gasPanelTwoView.ValveDPRData.Feedback);
  1180. // InvokeClient.Instance.Service.DoOperation($"{gasPanelTwoView.ValveDPRData.UniqueName}.{AITValveOperation.GVTurnValve}", gasPanelTwoView.ValveDPRData.Feedback);
  1181. }
  1182. F2HFClnOrHFCl2Values.Clear();
  1183. if (gasPanelTwoView.IsF2ClnOn != gasPanelTwoView.IsOldF2ClnOn)
  1184. {
  1185. F2HFClnOrHFCl2Values.Add("PM1.SetF2ClnEnable", gasPanelTwoView.IsF2ClnOn);
  1186. // InvokeClient.Instance.Service.DoOperation($"PM1.SetF2ClnEnable", gasPanelTwoView.IsF2ClnOn);
  1187. }
  1188. if (gasPanelTwoView.IsHFClnOn != gasPanelTwoView.IsOldHFClnOn)
  1189. {
  1190. F2HFClnOrHFCl2Values.Add("PM1.SetHFClnEnable", gasPanelTwoView.IsHFClnOn);
  1191. //InvokeClient.Instance.Service.DoOperation($"PM1.SetHFClnEnable", gasPanelTwoView.IsHFClnOn);
  1192. }
  1193. if (gasPanelTwoView.IsHTR1Enable != gasPanelTwoView.IsOldHTR1Enable)
  1194. {
  1195. F2HFClnOrHFCl2Values.Add("PM1.SetHTR1Enable", gasPanelTwoView.IsHTR1Enable);
  1196. // InvokeClient.Instance.Service.DoOperation($"PM1.SetHTR1Enable", gasPanelTwoView.IsHTR1Enable);
  1197. }
  1198. if (gasPanelTwoView.IsHTR2Enable != gasPanelTwoView.IsOldHTR2Enable)
  1199. {
  1200. F2HFClnOrHFCl2Values.Add("PM1.SetHTR2Enable", gasPanelTwoView.IsHTR2Enable);
  1201. //InvokeClient.Instance.Service.DoOperation($"PM1.SetHTR2Enable", gasPanelTwoView.IsHTR2Enable);
  1202. }
  1203. }
  1204. }
  1205. }
  1206. }
  1207. public void SwitchPage(string page)
  1208. {
  1209. switch (page)
  1210. {
  1211. case "Pressure":
  1212. {
  1213. ClientApp.Instance.SwitchPage("maintenance", "GasPanel", null);
  1214. }
  1215. break;
  1216. }
  1217. }
  1218. public void RampSetClick(object sender)
  1219. {
  1220. string strSetRamp = ShowNumberKeyboard(sender as Button, "", 1);
  1221. foreach (var item in TempList)
  1222. {
  1223. item.Rampng = strSetRamp;
  1224. item.IsRampngChanged = false;
  1225. }
  1226. }
  1227. private string ShowNumberKeyboard(Control control, string defaultValue, int keepDecimals = -1)
  1228. {
  1229. NumberKeyboard numberKeyboard = new NumberKeyboard("", defaultValue);
  1230. numberKeyboard.KeepDecimals = keepDecimals;
  1231. var point = control.PointFromScreen(new Point(0, 0));
  1232. double wx = SystemParameters.WorkArea.Width;
  1233. double hy = SystemParameters.WorkArea.Height;
  1234. if (-point.Y + control.ActualHeight + 5 + numberKeyboard.Height < hy)
  1235. {
  1236. numberKeyboard.Top = -point.Y + control.ActualHeight + 5;
  1237. }
  1238. else
  1239. {
  1240. numberKeyboard.Top = -point.Y - numberKeyboard.Height - 5;
  1241. }
  1242. if (-point.X + numberKeyboard.Width < wx)
  1243. {
  1244. numberKeyboard.Left = -point.X;
  1245. }
  1246. else
  1247. {
  1248. numberKeyboard.Left = -point.X - (numberKeyboard.Width - control.ActualWidth);
  1249. }
  1250. if ((bool)numberKeyboard.ShowDialog())
  1251. return numberKeyboard.ValueString;
  1252. else
  1253. return "Cancel";
  1254. }
  1255. private string SplitTemperatureControlMode(string str)
  1256. {
  1257. if (string.IsNullOrEmpty(str))
  1258. {
  1259. return str;
  1260. }
  1261. if (str.Contains("Profile("))
  1262. {
  1263. return str.Replace("Profile(", "").Replace(")", "").Replace(",", ":");
  1264. }
  1265. return str;
  1266. }
  1267. public void TempTextClick(string type, object sender)
  1268. {
  1269. switch (type)
  1270. {
  1271. case "Mode":
  1272. RecipeTempModeViewModel recipeTempModeViewModel = new RecipeTempModeViewModel();
  1273. recipeTempModeViewModel.SelectBtnName = SelectBtnName;
  1274. recipeTempModeViewModel.IsManualSet = true;
  1275. recipeTempModeViewModel.SelectProfileTable = SplitTemperatureControlMode(TemperatureControlMode);
  1276. var rtn = (wm as WindowManager)?.ShowDialogWithTitle(recipeTempModeViewModel, null, "Temp Mode");
  1277. if ((bool)rtn)
  1278. {
  1279. SelectBtnName = recipeTempModeViewModel.SelectBtnName;
  1280. if (null != recipeTempModeViewModel && !string.IsNullOrEmpty(recipeTempModeViewModel.ResultString) && recipeTempModeViewModel.ResultString.Contains("Profile"))
  1281. {
  1282. SelectBtnName = "Profile";
  1283. }
  1284. if (!string.IsNullOrEmpty(recipeTempModeViewModel.ResultString) && recipeTempModeViewModel.ResultString.Contains("Profile(,"))
  1285. {
  1286. recipeTempModeViewModel.ResultString = recipeTempModeViewModel.ResultString.Replace("Profile(,", "Profile(");
  1287. }
  1288. TemperatureControlMode = recipeTempModeViewModel.ResultString;
  1289. }
  1290. break;
  1291. case "Correct":
  1292. TempCorrectionEditViewModel tempCorrectionEditViewModel = new TempCorrectionEditViewModel();
  1293. tempCorrectionEditViewModel.ResultString = TemperatureCorrect;
  1294. tempCorrectionEditViewModel.IsManualSet = true;
  1295. //tempCorrectionEditViewModel.SelectedRecipeStep = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
  1296. tempCorrectionEditViewModel.IsEnabledControl = false;
  1297. tempCorrectionEditViewModel.AutoSelectVisibility = Visibility.Visible;
  1298. // tempOffsetTableViewModel.SelectedRecipeStep = SelectedRecipeStep;
  1299. rtn = (wm as WindowManager)?.ShowDialogWithTitle(tempCorrectionEditViewModel, null, "Temp Correct Table");
  1300. if ((bool)rtn)
  1301. {
  1302. TemperatureCorrect = tempCorrectionEditViewModel.ResultString;
  1303. }
  1304. break;
  1305. case "PID":
  1306. TempOffsetTableViewModel tempOffsetTableViewModel1 = new TempOffsetTableViewModel();
  1307. tempOffsetTableViewModel1.CboAutoSelectChecked = false;
  1308. tempOffsetTableViewModel1.IsEnabledControl = false;
  1309. tempOffsetTableViewModel1.IsManualSet = true;
  1310. tempOffsetTableViewModel1.TempOffsetTableSelected = TemperaturePID;
  1311. rtn = (wm as WindowManager)?.ShowDialogWithTitle(tempOffsetTableViewModel1, null, "Temp PID Table");
  1312. if ((bool)rtn)
  1313. {
  1314. TemperaturePID = tempOffsetTableViewModel1.TempOffsetTableSelected;
  1315. }
  1316. break;
  1317. default:
  1318. break;
  1319. }
  1320. }
  1321. private ObservableCollection<AUXData> _aUXDatas;
  1322. public void StepEdit(object cmdName, object value)
  1323. {
  1324. switch ((string)cmdName)
  1325. {
  1326. case "GASSetting":
  1327. RecipeMFCSettingViewModel recipeMFCSettingViewModel = new RecipeMFCSettingViewModel();
  1328. //InvokeClient.Instance.Service.DoOperation($"PM1.SetSensorRecipeOK", "");
  1329. //var tempMFCSets = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().MFCSets;
  1330. //if (tempMFCSets != null && tempMFCSets.Count > 0)
  1331. //{
  1332. // foreach (var item in tempMFCSets.Keys)
  1333. // {
  1334. // if (recipeMFCSettingViewModel.MFCSets.ContainsKey(item))
  1335. // {
  1336. // recipeMFCSettingViewModel.MFCSets[item] = tempMFCSets[item];
  1337. // }
  1338. // else
  1339. // {
  1340. // //recipeGASSettingViewModel.MFCSets.Add(item, tempMFCSets[item]);
  1341. // recipeMFCSettingViewModel.MFCSets.Add(item, new MFCValue() { AlarmValue = tempMFCSets[item].MinValue, IsNotifying = tempMFCSets[item].IsNotifying, MaxValue = tempMFCSets[item].MaxValue, MinValue = tempMFCSets[item].MinValue, IsCheck = tempMFCSets[item].IsCheck, Name = tempMFCSets[item].Name, Rampng = tempMFCSets[item].Rampng, Value = tempMFCSets[item].Value });
  1342. // }
  1343. // }
  1344. //}
  1345. ////recipeGASSettingViewModel.MFMSets = new MFMValue() { AlarmValue = tempMFMSets.AlarmValue, IsNotifying = tempMFMSets.IsNotifying, Name = tempMFMSets.Name, Value = tempMFMSets.Value };
  1346. //recipeMFCSettingViewModel.RecipeType = RecipeType;
  1347. //recipeMFCSettingViewModel.RecipeTemplate = RecipeTemplate;
  1348. //if (!(bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeMFCSettingViewModel, null, "MFC Detail"))
  1349. //{
  1350. // //InvokeClient.Instance.Service.DoOperation($"PM1.SetSensorPROCManualOK", "");
  1351. // return;
  1352. //}
  1353. ////InvokeClient.Instance.Service.DoOperation($"PM1.SetSensorPROCManualOK", "");
  1354. //if (CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().MFCSets != null)
  1355. //{
  1356. // if (recipeMFCSettingViewModel.MFCSets != null && recipeMFCSettingViewModel.MFCSets.Count > 0)
  1357. // {
  1358. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().MFCSets = recipeMFCSettingViewModel.MFCSets;
  1359. // }
  1360. //}
  1361. break;
  1362. case "PressureSetting":
  1363. RecipePressureSettingViewModel recipePressureSettingViewModel = new RecipePressureSettingViewModel();
  1364. //var tempStep = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
  1365. //recipePressureSettingViewModel.PressureSonsorValue = tempStep.PressureSonserValue;
  1366. //recipePressureSettingViewModel.PressureValveAngleValue = tempStep.PressureValveAngle;
  1367. //recipePressureSettingViewModel.PressureSettingVG = tempStep.PressureSettingVG;
  1368. //if (!string.IsNullOrEmpty(tempStep.PressureAlarmTableNo))
  1369. //{
  1370. // if (tempStep.PressureAlarmTableNo.ToLower() == "none")
  1371. // recipePressureSettingViewModel.PressureAlarmWatchTable = "None";
  1372. // else
  1373. // recipePressureSettingViewModel.PressureAlarmWatchTable = tempStep.PressureAlarmTableNo;
  1374. //}
  1375. //if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipePressureSettingViewModel, null, "Recipe Pressure Setting"))
  1376. //{
  1377. // if (CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault() != null)
  1378. // {
  1379. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().PressureSonserValue = recipePressureSettingViewModel.PressureSonsorValue;
  1380. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().PressureValveAngle = recipePressureSettingViewModel.PressureValveAngleValue;
  1381. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().PressureAlarmTableNo = recipePressureSettingViewModel.PressureAlarmWatchTable;
  1382. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().PressureSettingVG = recipePressureSettingViewModel.PressureSettingVG;
  1383. // SelectedRecipeStep.PressureSonserValue = $"{recipePressureSettingViewModel.PressureSonsorValue}";
  1384. // }
  1385. //}
  1386. break;
  1387. case "RFSetting":
  1388. //RecipeRFPressureSettingViewModel recipeRFPressureSettingViewModel = new RecipeRFPressureSettingViewModel();
  1389. //var tempRecipeStep = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
  1390. //recipeRFPressureSettingViewModel.RFSwitch = tempRecipeStep.RFSwitch;
  1391. //recipeRFPressureSettingViewModel.RFSetPointValue = tempRecipeStep.RFSetpoint;
  1392. //recipeRFPressureSettingViewModel.C1SetPointValue = tempRecipeStep.C1Setpoint;
  1393. //recipeRFPressureSettingViewModel.C2SetPointValue = tempRecipeStep.C2Setpoint;
  1394. //recipeRFPressureSettingViewModel.ForwardPowerAlarmWatchSetPointValue = tempRecipeStep.ForwardPowerAlarmWatchTable;
  1395. //recipeRFPressureSettingViewModel.PrAlarmWatchSetPointValue = tempRecipeStep.PrAlarmWatchTable;
  1396. //recipeRFPressureSettingViewModel.PIAlarmWatchSetPointValue = tempRecipeStep.PIAlarmWatchTable;
  1397. //recipeRFPressureSettingViewModel.C1AlarmWatchSetPointValue = tempRecipeStep.C1AlarmWatchTable;
  1398. //recipeRFPressureSettingViewModel.C2AlarmWatchSetPointValue = tempRecipeStep.C2AlarmWatchTable;
  1399. //recipeRFPressureSettingViewModel.VppAlarmWatchSetPointValue = tempRecipeStep.VppAlarmWatchTable;
  1400. //recipeRFPressureSettingViewModel.VdcAlarmWatchSetPointValue = tempRecipeStep.VdcAlarmWatchTable;
  1401. //if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeRFPressureSettingViewModel, null, "Recipe RF Setting"))
  1402. //{
  1403. // if (CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault() != null)
  1404. // {
  1405. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().RFSwitch = recipeRFPressureSettingViewModel.RFSwitch;
  1406. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().RFSetpoint = recipeRFPressureSettingViewModel.RFSetPointValue;
  1407. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().C1Setpoint = recipeRFPressureSettingViewModel.C1SetPointValue;
  1408. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().C2Setpoint = recipeRFPressureSettingViewModel.C2SetPointValue;
  1409. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().ForwardPowerAlarmWatchTable = recipeRFPressureSettingViewModel.ForwardPowerAlarmWatchSetPointValue;
  1410. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().PrAlarmWatchTable = recipeRFPressureSettingViewModel.PrAlarmWatchSetPointValue;
  1411. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().PIAlarmWatchTable = recipeRFPressureSettingViewModel.PIAlarmWatchSetPointValue;
  1412. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().C1AlarmWatchTable = recipeRFPressureSettingViewModel.C1AlarmWatchSetPointValue;
  1413. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().C2AlarmWatchTable = recipeRFPressureSettingViewModel.C2AlarmWatchSetPointValue;
  1414. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().VppAlarmWatchTable = recipeRFPressureSettingViewModel.VppAlarmWatchSetPointValue;
  1415. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().VdcAlarmWatchTable = recipeRFPressureSettingViewModel.VdcAlarmWatchSetPointValue;
  1416. // // SelectedRecipeStep.RFSetting = $"{recipeRFPressureSettingViewModel.RFSetPointValue}";
  1417. // }
  1418. //}
  1419. break;
  1420. case "Loader":
  1421. RecipeLoaderCommandViewModel recipeLoaderCommandViewModel = new RecipeLoaderCommandViewModel();
  1422. recipeLoaderCommandViewModel.SetRecipeProcessEditViewEnable = false;
  1423. if ((bool)(wm as WindowManager)?.ShowDialogWithTitle(recipeLoaderCommandViewModel, null, "Loader Command"))
  1424. {
  1425. ClearLoaderSetValue();
  1426. LoaderCommand = recipeLoaderCommandViewModel.ReturnString;
  1427. SetShowLoaderValuePanel(recipeLoaderCommandViewModel.ReturnString);
  1428. }
  1429. break;
  1430. case "Pressure":
  1431. ManualPressCommandViewModel recipePressCommandViewModel = new ManualPressCommandViewModel();
  1432. recipePressCommandViewModel.SetRecipeProcessEditViewEnable = false;
  1433. recipePressCommandViewModel.SelectedCmd = PressCommand;
  1434. if ((bool)(wm as WindowManager)?.ShowDialogWithTitle(recipePressCommandViewModel, null, "Press Command"))
  1435. {
  1436. DefaultUnit = recipePressCommandViewModel.DefaultUnit;
  1437. string returnString = recipePressCommandViewModel.ReturnString;
  1438. PressCommand = returnString;
  1439. SetShowPressPanel(returnString);
  1440. }
  1441. break;
  1442. case "Pattern":
  1443. RecipeGasPanelSettingViewModel recipeGasPanelSettingViewModel = new RecipeGasPanelSettingViewModel();
  1444. //recipeGasPanelSettingViewModel.CurrentRecipe = CurrentRecipe;
  1445. //recipeGasPanelSettingViewModel.SelectedStepName = $"{SelectedRecipeStep.StepNo}:{SelectedRecipeStep.Name}";
  1446. //recipeGasPanelSettingViewModel.ChangedStepEvent += RecipeGasPanelSettingViewModel_ChangedStepEvent;
  1447. //recipeGasPanelSettingViewModel.SelectedStep = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
  1448. if ((bool)(wm as WindowManager)?.ShowDialogWithTitle(recipeGasPanelSettingViewModel, null, "Valve"))
  1449. {
  1450. }
  1451. break;
  1452. case "BoatElevatorSetting":
  1453. BoatElevatorSettingViewModel boatElevatorSettingViewModel = new BoatElevatorSettingViewModel();
  1454. //boatElevatorSettingViewModel.SelectedRecipeStep = SelectedRecipeStep;
  1455. //if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(boatElevatorSettingViewModel, null, "BoatElevator Setting"))
  1456. //{
  1457. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().ZAxisPosition = boatElevatorSettingViewModel.SelectedRecipeStep.ZAxisPosition;
  1458. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().ZAxisSpeed = boatElevatorSettingViewModel.SelectedRecipeStep.ZAxisSpeed;
  1459. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().RotatePosition = boatElevatorSettingViewModel.SelectedRecipeStep.RotatePosition;
  1460. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().RotateSpeed = boatElevatorSettingViewModel.SelectedRecipeStep.RotateSpeed;
  1461. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().RotateInterval = boatElevatorSettingViewModel.SelectedRecipeStep.RotateInterval;
  1462. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().RotateDirection = boatElevatorSettingViewModel.SelectedRecipeStep.RotateDirection;
  1463. //}
  1464. break;
  1465. case "AUX":
  1466. RecipeAUXSetViewModel recipeAUXSetViewModel = new RecipeAUXSetViewModel();
  1467. if (_aUXDatas != null && _aUXDatas.Count > 0)
  1468. {
  1469. recipeAUXSetViewModel.AUXDataList.Clear();
  1470. _aUXDatas.ToList().ForEach(x => recipeAUXSetViewModel.AUXDataList.Add(x));
  1471. }
  1472. else
  1473. {
  1474. int i = 1;
  1475. recipeAUXSetViewModel.AUXDataList.Clear();
  1476. foreach (var item in AUXDetailDatas)
  1477. {
  1478. var tempAux = new AUXData();
  1479. tempAux.No = i;
  1480. tempAux.ControlName = i.ToString();
  1481. tempAux.DisplayName = item.DisplayName;
  1482. tempAux.SetValue = new DoubleParam() { Name = "SetValue", Value = item.SetPoint.ToString() };
  1483. tempAux.IsCheck = new BoolParam() { Name = "IsCheck", Value = false };
  1484. tempAux.MaxValue = new DoubleParam() { Name = "MaxValue", Value = item.WarningHighLimit.ToString() };
  1485. tempAux.MinValue = new DoubleParam() { Name = "MinValue", Value = item.WarningLowLimit.ToString() };
  1486. tempAux.SetUnit = new StringParam() { Name = "SetUnit", Value = item.Unit };
  1487. recipeAUXSetViewModel.AUXDataList.Add(tempAux);
  1488. i++;
  1489. }
  1490. }
  1491. if ((bool)(wm as WindowManager)?.ShowDialogWithTitle(recipeAUXSetViewModel, null, "AUX Set"))
  1492. {
  1493. _aUXDatas = recipeAUXSetViewModel.AUXDataList;
  1494. }
  1495. break;
  1496. case "RecipeHeader":
  1497. RecipeHeaderViewModel recipeHeaderViewModel = new RecipeHeaderViewModel();
  1498. if ((bool)(wm as WindowManager)?.ShowDialogWithTitle(recipeHeaderViewModel, null, "Recipe Header"))
  1499. {
  1500. }
  1501. break;
  1502. case "Combination":
  1503. //StringParam strCombination = CurrentRecipe.ConfigItems.FirstOrDefault(x => x.Name == "Combination") as StringParam;
  1504. //RecipeCombinationViewModel recipeCombinationViewModel = new RecipeCombinationViewModel();
  1505. //recipeCombinationViewModel.CombinationStr = strCombination.Value;
  1506. //if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeCombinationViewModel, null, "Combination"))
  1507. //{
  1508. // strCombination.Value = recipeCombinationViewModel.Combination.ToString();
  1509. //}
  1510. break;
  1511. case "VPDataList":
  1512. RecipeVPItemSelectViewModel recipeVPItemSelectViewModel = new RecipeVPItemSelectViewModel();
  1513. if ((bool)(wm as WindowManager)?.ShowDialogWithTitle(recipeVPItemSelectViewModel, null, "VP Item Select"))
  1514. {
  1515. }
  1516. break;
  1517. case "SkipOrWait":
  1518. RecipeSkipWaitCommandViewModel recipeSkipWaitCommandViewModel = new RecipeSkipWaitCommandViewModel();
  1519. //recipeSkipWaitCommandViewModel.SkipWait = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().SkipWait;
  1520. //if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeSkipWaitCommandViewModel, null, "Skip or wait command"))
  1521. //{
  1522. // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().SkipWait = recipeSkipWaitCommandViewModel.RtnString;
  1523. // SelectedRecipeStep.SkipWait = recipeSkipWaitCommandViewModel.RtnString;
  1524. //}
  1525. break;
  1526. default:
  1527. break;
  1528. }
  1529. }
  1530. public void MFCTextChanged(string type, object sender, object item)
  1531. {
  1532. try
  1533. {
  1534. if (!string.IsNullOrEmpty(type) && item != null && sender != null)
  1535. {
  1536. MFCGasData mFCData = (MFCGasData)item;
  1537. string value = ((TextBox)sender).Text;
  1538. string proStr = $"{mFCData.Name}Data";
  1539. Type type1 = typeof(ManualSetViewModel);
  1540. PropertyInfo property = type1.GetProperty(proStr);
  1541. if (property == null) return;
  1542. AITMfcData aITMfcData = (AITMfcData)property.GetValue(this);
  1543. double setValue = 0;
  1544. double.TryParse(value, out setValue);
  1545. switch (type)
  1546. {
  1547. case "Value":
  1548. mFCData.Value = value;
  1549. if (setValue != aITMfcData.SetPoint)
  1550. {
  1551. mFCData.IsSetChanged = false;
  1552. }
  1553. else
  1554. {
  1555. // mFCData.IsSetChanged = true;
  1556. }
  1557. break;
  1558. case "Rampng":
  1559. mFCData.Rampng = value;
  1560. if (setValue != aITMfcData.Ramping)
  1561. {
  1562. mFCData.IsRampngChanged = false;
  1563. }
  1564. else
  1565. {
  1566. // mFCData.IsRampngChanged = true;
  1567. }
  1568. break;
  1569. default:
  1570. break;
  1571. }
  1572. }
  1573. }
  1574. catch (Exception ex)
  1575. {
  1576. LOG.Write(ex);
  1577. }
  1578. }
  1579. public void TempTextChanged(string type, object sender, object item)
  1580. {
  1581. try
  1582. {
  1583. if (!string.IsNullOrEmpty(type) && item != null && sender != null)
  1584. {
  1585. TempManualSetData tempData = (TempManualSetData)item;
  1586. string value = ((TextBox)sender).Text;
  1587. string proStr = tempData.ControlName;
  1588. Type type1 = typeof(ManualSetViewModel);
  1589. PropertyInfo property = type1.GetProperty(proStr);
  1590. if (property == null) return;
  1591. AITHeaterData aITHeaterData = (AITHeaterData)property.GetValue(this);
  1592. double setValue = 0;
  1593. double.TryParse(value, out setValue);
  1594. switch (type)
  1595. {
  1596. case "Value":
  1597. tempData.Value = value;
  1598. if (setValue != aITHeaterData.SetPoint)
  1599. {
  1600. tempData.IsSetChanged = false;
  1601. }
  1602. else
  1603. {
  1604. // tempData.IsSetChanged = false;
  1605. }
  1606. break;
  1607. case "Ramp":
  1608. tempData.Rampng = value;
  1609. if (setValue != aITHeaterData.RampSetPoint)
  1610. {
  1611. tempData.IsRampngChanged = false;
  1612. }
  1613. else
  1614. {
  1615. // tempData.IsRampngChanged = false;
  1616. }
  1617. break;
  1618. default:
  1619. break;
  1620. }
  1621. }
  1622. }
  1623. catch (Exception ex)
  1624. {
  1625. LOG.Write(ex);
  1626. }
  1627. }
  1628. private string oldPressStr = "";
  1629. public void Exec()
  1630. {
  1631. if (!DialogBox.Confirm("Are you sure to execute?"))
  1632. return;
  1633. if (DictValve != null && DictValve.Count > 0)
  1634. {
  1635. InvokeClient.Instance.Service.DoOperation($"PM1.SetAll{AITValveOperation.GVTurnValve}", DictValve);
  1636. }
  1637. if (MFCDataList != null && MFCDataList.Count() > 0)
  1638. {
  1639. Dictionary<string, string> setChangedMFC = new Dictionary<string, string>();
  1640. var changedList = MFCDataList.ToList().Where(x => !x.IsSetChanged);
  1641. foreach (var item in changedList)
  1642. {
  1643. setChangedMFC.Add(item.Name, item.Value);
  1644. }
  1645. InvokeClient.Instance.Service.DoOperation($"PM1.SetAllMfcValue", setChangedMFC);
  1646. MFCDataList.ToList().ForEach(x =>
  1647. {
  1648. if (!x.IsSetChanged)
  1649. {
  1650. // InvokeClient.Instance.Service.DoOperation($"PM1.{x.DisplayName}.SetMfcValue", $"{x.Value};{x.Rampng};{x.AlarmValue}");
  1651. InvokeClient.Instance.Service.DoOperation($"System.SetConfig", $"PM1.MFC.{x.DisplayName}.SetLastPoint", x.Value);
  1652. x.IsSetChanged = true;
  1653. }
  1654. if (!x.IsRampngChanged)
  1655. {
  1656. InvokeClient.Instance.Service.DoOperation($"PM1.{x.DisplayName}.SetMfcValue", $"{x.Value};{x.Rampng};{x.AlarmValue}");
  1657. InvokeClient.Instance.Service.DoOperation($"System.SetConfig", $"PM1.MFC.{x.DisplayName}.SetLastRamping", x.Rampng);
  1658. x.IsRampngChanged = true;
  1659. }
  1660. });
  1661. }
  1662. var pressStr = GetPressString();
  1663. if (oldPressStr != pressStr || (DictValve != null && DictValve.ContainsKey("ValveAV71")))
  1664. {
  1665. if ((CheckIsChanged(pressStr) && pressStr != ";;;") || (DictValve != null && DictValve.ContainsKey("ValveAV71")))
  1666. {
  1667. if (DictValve != null && DictValve.ContainsKey("ValveAV71"))
  1668. InvokeClient.Instance.Service.DoOperation($"PM1.APC.SetManualParameters", $"{pressStr};{DictValve["ValveAV71"]}");
  1669. else
  1670. InvokeClient.Instance.Service.DoOperation($"PM1.APC.SetManualParameters", $"{pressStr}");
  1671. }
  1672. }
  1673. OldPressCommand = PressCommand;
  1674. oldPressStr = pressStr;
  1675. if (HeaterUData.CorrectTable != TemperatureCorrect || HeaterUData.PIDTable != TemperaturePID || HeaterUData.ControlModeSetpoint != TemperatureControlMode)
  1676. {
  1677. string[] tempPra = new string[] { TemperatureControlMode, TemperatureCorrect, TemperaturePID };
  1678. InvokeClient.Instance.Service.DoOperation("PM1.Heater.SetParameters", string.Join(";", tempPra));
  1679. }
  1680. if (TempList != null && TempList.Count() > 0)
  1681. {
  1682. TempList.ToList().ForEach(x =>
  1683. {
  1684. if (!x.IsRampngChanged || !x.IsSetChanged)
  1685. {
  1686. InvokeClient.Instance.Service.DoOperation($"System.{x.Name}.SetManualParameters", $"{x.Value};{x.Rampng}");
  1687. if (!x.IsSetChanged)
  1688. {
  1689. InvokeClient.Instance.Service.DoOperation($"System.SetConfig", $"PM1.Heater.{x.Name}.SetLastPoint", x.Value);
  1690. }
  1691. if (!x.IsRampngChanged)
  1692. {
  1693. InvokeClient.Instance.Service.DoOperation($"System.SetConfig", $"PM1.Heater.{x.Name}.SetLastRamping", x.Rampng);
  1694. }
  1695. x.IsSetChanged = true;
  1696. x.IsRampngChanged = true;
  1697. }
  1698. });
  1699. }
  1700. if (!string.IsNullOrEmpty(LoaderCommand))
  1701. {
  1702. if (OldLoaderCommand != LoaderCommand)
  1703. {
  1704. InvokeClient.Instance.Service.DoOperation("PM1.SetBoatManualMotion", GetSaveLoaderValue(LoaderCommand));
  1705. }
  1706. OldLoaderCommand = LoaderCommand;
  1707. }
  1708. if (PumpSetValues.Count > 0)
  1709. {
  1710. PumpSetValues.ToList().ForEach(x => InvokeClient.Instance.Service.DoOperation($"{x.Key}.{AITValveOperation.GVTurnValve}", x.Value));
  1711. }
  1712. if (F2HFClnOrHFCl2Values.Count > 0)
  1713. {
  1714. F2HFClnOrHFCl2Values.ToList().ForEach(x => InvokeClient.Instance.Service.DoOperation(x.Key, x.Value));
  1715. }
  1716. }
  1717. private bool CheckIsChanged(string value)
  1718. {
  1719. string[] strList = value.Split(';');
  1720. if (APCData.CommandSetPoint != strList[0])
  1721. {
  1722. return true;
  1723. }
  1724. if (APCData.PIDTable != strList[1])
  1725. {
  1726. return true;
  1727. }
  1728. float.TryParse(strList[2], out float set);
  1729. if (APCData.SetPoint != set)
  1730. {
  1731. return true;
  1732. }
  1733. if (APCData.LowPressWaitSetPoint != strList[3])
  1734. {
  1735. return true;
  1736. }
  1737. return false;
  1738. }
  1739. public List<ConfigNode> GetMfcItem()
  1740. {
  1741. this.SystemName = "System";
  1742. ConfigNodes = SystemConfigProvider.Instance.GetConfigTree(SystemName).SubNodes;
  1743. var MfcItems = ConfigNodes.Where(x => x.Display == "Parameter").FirstOrDefault().SubNodes.Where(y => y.Name == "MFC").FirstOrDefault().SubNodes;
  1744. return MfcItems;
  1745. }
  1746. public void RecipeCancel()
  1747. {
  1748. if (DialogBox.ShowDialog(DialogButton.Yes | DialogButton.No, DialogType.CONFIRM, " You confirm that you want to unsave the recipe and exit the interface?") == DialogButton.No)
  1749. {
  1750. return;
  1751. }
  1752. else
  1753. {
  1754. UpdateGASSetting(true);
  1755. UpdateHeaterSetting();
  1756. ClearSetValue();
  1757. }
  1758. // ((Window)GetView()).Close();
  1759. }
  1760. public void PressPIDChick()
  1761. {
  1762. var windowManager = IoC.Get<IWindowManager>();
  1763. var defaultAPCPID = SystemConfigProvider.Instance.GetValueByName("PM1.APCPID");
  1764. if (string.IsNullOrEmpty(defaultAPCPID))
  1765. {
  1766. DialogBox.ShowDialog(DialogButton.Cancel, DialogType.INFO, "Please set the default file first");
  1767. return;
  1768. }
  1769. int last = defaultAPCPID.LastIndexOf('\\');
  1770. var pix = defaultAPCPID.Substring(0, last);
  1771. var file = defaultAPCPID.Substring(last + 1, defaultAPCPID.Length - last - 1);
  1772. APCPIDEditViewModel aPCPIDEditViewModel = new APCPIDEditViewModel(pix, file);
  1773. aPCPIDEditViewModel.IsEditEnabled = false;
  1774. var rtn = (windowManager as WindowManager)?.ShowDialogWithTitle(aPCPIDEditViewModel, null, "APC PID Table");
  1775. if ((bool)rtn)
  1776. {
  1777. PressPID = aPCPIDEditViewModel.RetrunString;
  1778. }
  1779. }
  1780. private bool firstUpdate = true;
  1781. private void ClearSetValue()
  1782. {
  1783. TemperatureControlMode = "";
  1784. TemperatureCorrect = "";
  1785. TemperaturePID = "";
  1786. ClearLoaderSetValue();
  1787. LoaderCommand = "";
  1788. SetShowLoaderValuePanel("None");
  1789. PressCommand = "";
  1790. SetShowPressPanel("None");
  1791. }
  1792. protected override void InvokeAfterUpdateProperty(Dictionary<string, object> data)
  1793. {
  1794. base.InvokeAfterUpdateProperty(data);
  1795. if (firstUpdate)
  1796. {
  1797. UpdateGASSetting(false);
  1798. UpdateHeaterSetting();
  1799. firstUpdate = false;
  1800. }
  1801. }
  1802. private void UpdateGASSetting(bool upDataMfcSetPoint)
  1803. {
  1804. List<AITMfcData> allmfcDatas = new List<AITMfcData>()
  1805. {
  1806. MFC1Data,
  1807. MFC2Data,
  1808. MFC3Data,
  1809. MFC4Data,
  1810. MFC5Data,
  1811. MFC6Data,
  1812. MFC7Data,
  1813. MFC8Data,
  1814. MFC9Data,
  1815. MFC10Data,
  1816. MFC11Data,
  1817. MFC12Data,
  1818. MFC13Data,
  1819. MFC14Data,
  1820. MFC15Data,
  1821. MFC16Data,
  1822. MFC17Data,
  1823. MFC31Data,
  1824. MFC32Data,
  1825. MFC51Data,
  1826. };
  1827. List<AITMfcData> mfcDatas = new List<AITMfcData>()
  1828. {
  1829. };
  1830. foreach (var item in allmfcDatas)
  1831. {
  1832. if (item != null)
  1833. {
  1834. mfcDatas.Add(item);
  1835. }
  1836. }
  1837. if (MFCDataList.Count == 0)
  1838. {
  1839. for (int i = 0; i < mfcDatas.Count; i++)
  1840. {
  1841. if (mfcDatas[i] == null)
  1842. continue;
  1843. double setLastPoint = (double)QueryDataClient.Instance.Service.GetConfig($"PM1.MFC.{mfcDatas[i].DeviceName}.SetLastPoint");
  1844. double setLastRamping = (double)QueryDataClient.Instance.Service.GetConfig($"PM1.MFC.{mfcDatas[i].DeviceName}.SetLastRamping");
  1845. //MFCDataList.Add(new MFCGasData()
  1846. //{
  1847. // Name = mfcDatas[i].DeviceName,
  1848. // DisplayName = mfcDatas[i].DisplayName,
  1849. // ActualValue = mfcDatas[i].FeedBack,
  1850. // Value = mfcDatas[i].SetPoint,
  1851. // ActualRampng = mfcDatas[i].Ramping,
  1852. // Rampng = mfcDatas[i].VirtualRamping,
  1853. // Unit = mfcDatas[i].Unit,
  1854. // AlarmValue = mfcDatas[i].AlarmWatchTable
  1855. //});
  1856. MFCDataList.Add(new MFCGasData()
  1857. {
  1858. Name = mfcDatas[i].DeviceName,
  1859. DisplayName = mfcDatas[i].DisplayName,
  1860. //ActualValue = mfcDatas[i].FeedBack,
  1861. Value = setLastPoint.ToString("f3"),
  1862. //ActualRampng = mfcDatas[i].Ramping,
  1863. Rampng = setLastRamping.ToString("f3"),
  1864. IsSetChanged = true,
  1865. Unit = mfcDatas[i].Unit,
  1866. AlarmValue = mfcDatas[i].AlarmWatchTable
  1867. });
  1868. }
  1869. }
  1870. else
  1871. {
  1872. for (int i = 0; i < MFCDataList.Count; i++)
  1873. {
  1874. var findMFC = mfcDatas.FirstOrDefault(x => x.DeviceName == MFCDataList[i].Name);
  1875. if (findMFC != null)
  1876. {
  1877. double setLastPoint = (double)QueryDataClient.Instance.Service.GetConfig($"PM1.MFC.{findMFC.DeviceName}.SetLastPoint");
  1878. double setLastRamping = (double)QueryDataClient.Instance.Service.GetConfig($"PM1.MFC.{findMFC.DeviceName}.SetLastRamping");
  1879. MFCDataList[i].Value = setLastPoint.ToString("f3");
  1880. MFCDataList[i].IsSetChanged = true;
  1881. MFCDataList[i].Rampng = setLastRamping.ToString("f3");
  1882. }
  1883. };
  1884. }
  1885. if (MFCDataList != null && MFCDataList.Count > 0)
  1886. {
  1887. if (upDataMfcSetPoint)
  1888. {
  1889. Dictionary<string, string> setChangedMFC = new Dictionary<string, string>();
  1890. foreach (var item in MFCDataList)
  1891. {
  1892. setChangedMFC.Add(item.Name, item.Value);
  1893. }
  1894. InvokeClient.Instance.Service.DoOperation($"PM1.SetAllMfcSetPoint", setChangedMFC);
  1895. }
  1896. }
  1897. }
  1898. private void UpdateHeaterSetting()
  1899. {
  1900. if ((HeaterUData != null && HeaterCUData != null && HeaterCData != null && HeaterCLData != null && HeaterLData != null))
  1901. {
  1902. List<AITHeaterData> heaterDatas = new List<AITHeaterData>()
  1903. {
  1904. HeaterUData,
  1905. HeaterCUData,
  1906. HeaterCData,
  1907. HeaterCLData,
  1908. HeaterLData,
  1909. };
  1910. if (TempList.Count == 0)
  1911. {
  1912. string[] strList = new string[5] { "BottomHeaterData", "CenterBottomHeaterData", "CenterHeaterData", "TopCenterHeaterData", "HeaterUData" };
  1913. for (int i = 0; i < heaterDatas.Count; i++)
  1914. {
  1915. double setLastPoint = (double)QueryDataClient.Instance.Service.GetConfig($"PM1.Heater.{heaterDatas[i].DeviceName}.SetLastPoint");
  1916. double setLastRamping = (double)QueryDataClient.Instance.Service.GetConfig($"PM1.Heater.{heaterDatas[i].DeviceName}.SetLastRamping");
  1917. //TempList.Add(new TempManualSetData()
  1918. //{
  1919. // DisplayName = heaterDatas[i].DisplayName,
  1920. // Name = heaterDatas[i].DeviceName,
  1921. // ControlName = strList[i],
  1922. // ActualValue = heaterDatas[i].FeedBack,
  1923. // Value = heaterDatas[i].SetPoint,
  1924. // ActualRampng = heaterDatas[i].Ramping,
  1925. // Rampng = heaterDatas[i].UpRateSetPoint,
  1926. // Unit = heaterDatas[i].Unit,
  1927. //});
  1928. TempList.Add(new TempManualSetData()
  1929. {
  1930. DisplayName = heaterDatas[i].DisplayName,
  1931. Name = heaterDatas[i].DeviceName,
  1932. ControlName = strList[i],
  1933. Value = setLastPoint.ToString("f1"),
  1934. Rampng = setLastRamping.ToString("f1"),
  1935. Unit = heaterDatas[i].Unit,
  1936. });
  1937. }
  1938. }
  1939. else
  1940. {
  1941. for (int i = 0; i < TempList.Count; i++)
  1942. {
  1943. var findHeater = heaterDatas.FirstOrDefault(x => x.DeviceName == TempList[i].Name);
  1944. double setLastPoint = (double)QueryDataClient.Instance.Service.GetConfig($"PM1.Heater.{findHeater.DeviceName}.SetLastPoint");
  1945. double setLastRamping = (double)QueryDataClient.Instance.Service.GetConfig($"PM1.Heater.{findHeater.DeviceName}.SetLastRamping");
  1946. if (findHeater != null)
  1947. {
  1948. TempList[i].Value = setLastPoint.ToString("f1");
  1949. TempList[i].Rampng = setLastRamping.ToString("f1");
  1950. TempList[i].IsSetChanged = true;
  1951. TempList[i].IsRampngChanged = true;
  1952. }
  1953. };
  1954. }
  1955. }
  1956. }
  1957. public void SetValue(object sender, string isFullKeyboard = "")
  1958. {
  1959. string value = ((TextBox)sender).Text;
  1960. if (!string.IsNullOrEmpty(isFullKeyboard))
  1961. {
  1962. FullKeyboard fullKeyboard1 = new FullKeyboard("", value);
  1963. if ((bool)fullKeyboard1.ShowDialog())
  1964. {
  1965. ((TextBox)sender).Text = fullKeyboard1.ValueString;
  1966. }
  1967. }
  1968. else
  1969. {
  1970. NumberKeyboard fullKeyboard = new NumberKeyboard("", value);
  1971. if ((bool)fullKeyboard.ShowDialog())
  1972. {
  1973. ((TextBox)sender).Text = fullKeyboard.ValueString;
  1974. }
  1975. }
  1976. }
  1977. private string GetPressString()
  1978. {
  1979. string[] pressStringList = new string[4] { "", "", "", "" };
  1980. pressStringList[0] = PressCommand;
  1981. if (!string.IsNullOrEmpty(PressCommand))
  1982. {
  1983. switch (PressCommand)
  1984. {
  1985. case "Press":
  1986. case "Press2":
  1987. PressVisibility = Visibility.Visible;
  1988. pressStringList[1] = PressPID;
  1989. pressStringList[2] = PressSet.ToString();
  1990. break;
  1991. case "Slow Vac":
  1992. var defaultAPCPID = SystemConfigProvider.Instance.GetValueByName("PM1.APCPID");
  1993. pressStringList[1] = defaultAPCPID;
  1994. pressStringList[2] = PressSlowVacSet.ToString();
  1995. break;
  1996. case "Valve Angle":
  1997. pressStringList[2] = PressValveAngleSet.ToString();
  1998. pressStringList[3] = LowPressWait;
  1999. break;
  2000. case "Full Open":
  2001. case "Full Close":
  2002. case "Hold":
  2003. case "Zero Set":
  2004. case "Cancel Zero":
  2005. pressStringList[1] = "";
  2006. pressStringList[2] = "";
  2007. pressStringList[3] = "";
  2008. break;
  2009. case "WaitPressUp1":
  2010. case "WaitPressDown1":
  2011. case "WaitPressUp2":
  2012. case "WaitPressDown2":
  2013. pressStringList[2] = PressWait.ToString();
  2014. break;
  2015. default:
  2016. break;
  2017. }
  2018. }
  2019. return string.Join(";", pressStringList);
  2020. }
  2021. }
  2022. public class MFCGasData : PropertyChangedBase
  2023. {
  2024. private int _no;
  2025. public int No
  2026. {
  2027. get => _no;
  2028. set
  2029. {
  2030. _no = value;
  2031. NotifyOfPropertyChange(nameof(No));
  2032. }
  2033. }
  2034. private string _name;
  2035. public string Name
  2036. {
  2037. get => _name;
  2038. set
  2039. {
  2040. _name = value;
  2041. NotifyOfPropertyChange(nameof(Name));
  2042. }
  2043. }
  2044. public string _unit;
  2045. public string Unit
  2046. {
  2047. get => _unit;
  2048. set
  2049. {
  2050. _unit = value;
  2051. NotifyOfPropertyChange(nameof(Unit));
  2052. }
  2053. }
  2054. private string _displayName;
  2055. public string DisplayName
  2056. {
  2057. get => _displayName;
  2058. set
  2059. {
  2060. _displayName = value;
  2061. NotifyOfPropertyChange(nameof(DisplayName));
  2062. }
  2063. }
  2064. private string _controlName;
  2065. public string ControlName
  2066. {
  2067. get => _controlName;
  2068. set
  2069. {
  2070. _controlName = value;
  2071. NotifyOfPropertyChange(nameof(ControlName));
  2072. }
  2073. }
  2074. private double _actualValue;
  2075. public double ActualValue
  2076. {
  2077. get => _actualValue;
  2078. set
  2079. {
  2080. _actualValue = value;
  2081. NotifyOfPropertyChange(nameof(ActualValue));
  2082. }
  2083. }
  2084. private string _value;
  2085. public string Value
  2086. {
  2087. get => _value;
  2088. set
  2089. {
  2090. _value = value;
  2091. NotifyOfPropertyChange(nameof(Value));
  2092. }
  2093. }
  2094. private double _actualRampng;
  2095. public double ActualRampng
  2096. {
  2097. get => _actualRampng; set
  2098. {
  2099. _actualRampng = value;
  2100. NotifyOfPropertyChange(nameof(ActualRampng));
  2101. }
  2102. }
  2103. private string _rampng;
  2104. public string Rampng
  2105. {
  2106. get => _rampng; set
  2107. {
  2108. _rampng = value;
  2109. NotifyOfPropertyChange(nameof(Rampng));
  2110. }
  2111. }
  2112. private string _maxValue;
  2113. public string MaxValue
  2114. {
  2115. get => _maxValue; set
  2116. {
  2117. _maxValue = value;
  2118. NotifyOfPropertyChange(nameof(MaxValue));
  2119. }
  2120. }
  2121. private string _minValue;
  2122. public string MinValue
  2123. {
  2124. get => _minValue; set
  2125. {
  2126. _minValue = value;
  2127. NotifyOfPropertyChange(nameof(MinValue));
  2128. }
  2129. }
  2130. private bool _isSetChanged = true;
  2131. public bool IsSetChanged
  2132. {
  2133. get => _isSetChanged;
  2134. set
  2135. {
  2136. _isSetChanged = value;
  2137. NotifyOfPropertyChange(nameof(IsSetChanged));
  2138. }
  2139. }
  2140. private bool _isRampngChanged = true;
  2141. public bool IsRampngChanged
  2142. {
  2143. get => _isRampngChanged;
  2144. set
  2145. {
  2146. _isRampngChanged = value;
  2147. NotifyOfPropertyChange(nameof(IsRampngChanged));
  2148. }
  2149. }
  2150. private string _alarmValue;
  2151. public string AlarmValue
  2152. {
  2153. get => _alarmValue;
  2154. set
  2155. {
  2156. _alarmValue = value;
  2157. NotifyOfPropertyChange(nameof(AlarmValue));
  2158. }
  2159. }
  2160. }
  2161. public class TempManualSetData : PropertyChangedBase
  2162. {
  2163. private int _no;
  2164. public int No
  2165. {
  2166. get => _no;
  2167. set
  2168. {
  2169. _no = value;
  2170. NotifyOfPropertyChange("No");
  2171. }
  2172. }
  2173. private string _name;
  2174. public string Name
  2175. {
  2176. get => _name;
  2177. set
  2178. {
  2179. _name = value;
  2180. NotifyOfPropertyChange("Name");
  2181. }
  2182. }
  2183. private string _displayName;
  2184. public string DisplayName
  2185. {
  2186. get => _displayName;
  2187. set
  2188. {
  2189. _displayName = value;
  2190. NotifyOfPropertyChange(nameof(DisplayName));
  2191. }
  2192. }
  2193. private string _controlName;
  2194. public string ControlName
  2195. {
  2196. get => _controlName;
  2197. set
  2198. {
  2199. _controlName = value;
  2200. NotifyOfPropertyChange(nameof(ControlName));
  2201. }
  2202. }
  2203. private double _actualValue;
  2204. public double ActualValue
  2205. {
  2206. get => _actualValue;
  2207. set
  2208. {
  2209. _actualValue = value;
  2210. NotifyOfPropertyChange(nameof(ActualValue));
  2211. }
  2212. }
  2213. private string _value;
  2214. public string Value
  2215. {
  2216. get => _value;
  2217. set
  2218. {
  2219. _value = value;
  2220. NotifyOfPropertyChange(nameof(Value));
  2221. }
  2222. }
  2223. private string _actualRampng;
  2224. public string ActualRampng
  2225. {
  2226. get => _actualRampng;
  2227. set
  2228. {
  2229. _actualRampng = value;
  2230. NotifyOfPropertyChange(nameof(ActualRampng));
  2231. }
  2232. }
  2233. private string _rampng;
  2234. public string Rampng
  2235. {
  2236. get => _rampng; set
  2237. {
  2238. _rampng = value;
  2239. NotifyOfPropertyChange(nameof(Rampng));
  2240. }
  2241. }
  2242. private string _maxValue;
  2243. public string MaxValue
  2244. {
  2245. get => _maxValue; set
  2246. {
  2247. _maxValue = value;
  2248. NotifyOfPropertyChange(nameof(MaxValue));
  2249. }
  2250. }
  2251. private string _minValue;
  2252. public string MinValue
  2253. {
  2254. get => _minValue; set
  2255. {
  2256. _minValue = value;
  2257. NotifyOfPropertyChange(nameof(MinValue));
  2258. }
  2259. }
  2260. private bool _isChanged = true;
  2261. public bool IsChanged
  2262. {
  2263. get => _isChanged;
  2264. set
  2265. {
  2266. _isChanged = value;
  2267. NotifyOfPropertyChange(nameof(IsChanged));
  2268. }
  2269. }
  2270. private string _unit;
  2271. public string Unit
  2272. {
  2273. get => _unit;
  2274. set
  2275. {
  2276. _unit = value;
  2277. NotifyOfPropertyChange("Unit");
  2278. }
  2279. }
  2280. private bool _isSetChanged = true;
  2281. public bool IsSetChanged
  2282. {
  2283. get => _isSetChanged;
  2284. set
  2285. {
  2286. _isSetChanged = value;
  2287. NotifyOfPropertyChange(nameof(IsSetChanged));
  2288. }
  2289. }
  2290. private bool _isRampngChanged = true;
  2291. public bool IsRampngChanged
  2292. {
  2293. get => _isRampngChanged;
  2294. set
  2295. {
  2296. _isRampngChanged = value;
  2297. NotifyOfPropertyChange(nameof(IsRampngChanged));
  2298. }
  2299. }
  2300. private string _alarmValue;
  2301. public string AlarmValue
  2302. {
  2303. get => _alarmValue;
  2304. set
  2305. {
  2306. _alarmValue = value;
  2307. NotifyOfPropertyChange(nameof(AlarmValue));
  2308. }
  2309. }
  2310. }
  2311. }