ManualSetViewModel.cs 112 KB

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