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