RecipeDataBase.cs 239 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685
  1. using Aitex.Core.RT.Log;
  2. using Caliburn.Micro.Core;
  3. using MECF.Framework.Common.CommonData;
  4. using MECF.Framework.Common.DataCenter;
  5. using MECF.Framework.Common.RecipeCenter;
  6. using MECF.Framework.Common.Utilities;
  7. using MECF.Framework.UI.Client.CenterViews.Configs.SystemConfig;
  8. using RecipeEditorLib.DGExtension.CustomColumn;
  9. using RecipeEditorLib.RecipeModel.Params;
  10. using System;
  11. using System.Collections.Generic;
  12. using System.Collections.ObjectModel;
  13. using System.Linq;
  14. using System.Reflection;
  15. using System.Text;
  16. using System.Windows;
  17. using System.Xml;
  18. using System.ComponentModel;
  19. using OpenSEMI.ClientBase;
  20. using MECF.Framework.UI.Client.ClientBase;
  21. namespace MECF.Framework.UI.Client.CenterViews.Editors.Recipe
  22. {
  23. public class RecipeTable : PropertyChangedBase
  24. {
  25. private int _Index;
  26. public int Index
  27. {
  28. get { return _Index; }
  29. set { _Index = value; this.NotifyOfPropertyChange(nameof(Index)); }
  30. }
  31. private string _Name;
  32. public string Name
  33. {
  34. get { return _Name; }
  35. set { _Name = value; this.NotifyOfPropertyChange(nameof(Name)); }
  36. }
  37. private string _EndStatus;
  38. public string EndStatus
  39. {
  40. get { return _EndStatus; }
  41. set { _EndStatus = value; this.NotifyOfPropertyChange(nameof(EndStatus)); }
  42. }
  43. private RecipeDataBase _TableData;
  44. public RecipeDataBase TableData
  45. {
  46. get { return _TableData; }
  47. set { _TableData = value; this.NotifyOfPropertyChange(nameof(TableData)); }
  48. }
  49. }
  50. public class RecipeDataBase : PropertyChangedBase
  51. {
  52. public static string[] SaveTableRecipeTypes = new string[] { "sub", "alarm", "abort" };
  53. public static string ProcessType = "Process";
  54. public bool GetIsTableType
  55. {
  56. get
  57. {
  58. if (string.IsNullOrEmpty(RecipeChamberType))
  59. return false;
  60. else if (SaveTableRecipeTypes.Contains(RecipeChamberType))
  61. {
  62. return true;
  63. }
  64. else
  65. {
  66. return false;
  67. }
  68. }
  69. }
  70. public bool IsChanged
  71. {
  72. get
  73. {
  74. bool changed = !IsSavedDesc;
  75. if (!changed)
  76. {
  77. //changed = ChkChanged(Steps) || ChkChanged(PopSettingSteps) || ChkChanged(StepTolerances);
  78. }
  79. if (!changed)
  80. {
  81. foreach (Param config in this.ConfigItems)
  82. {
  83. if (!config.IsSaved)
  84. {
  85. changed = true;
  86. break;
  87. }
  88. }
  89. }
  90. return changed;
  91. }
  92. }
  93. private bool _isSavedDesc;
  94. public bool IsSavedDesc
  95. {
  96. get { return _isSavedDesc; }
  97. set
  98. {
  99. this._isSavedDesc = value;
  100. this.NotifyOfPropertyChange("IsSavedDesc");
  101. }
  102. }
  103. private string name;
  104. public string Name
  105. {
  106. get { return this.name; }
  107. set
  108. {
  109. this.name = value;
  110. this.NotifyOfPropertyChange("Name");
  111. }
  112. }
  113. private string _chamberType;
  114. public string RecipeChamberType
  115. {
  116. get { return this._chamberType; }
  117. set
  118. {
  119. this._chamberType = value;
  120. CreateTable(value);
  121. this.NotifyOfPropertyChange("RecipeChamberType");
  122. }
  123. }
  124. public void CreateTable(string type)
  125. {
  126. if (SaveTableRecipeTypes.Contains(type))
  127. {
  128. int maxCount = 20;
  129. if (type.ToLower() == "abort")
  130. {
  131. maxCount = 10;
  132. }
  133. for (int i = 0; i < maxCount; i++)
  134. {
  135. Tables.Add(new RecipeTable()
  136. { Index = i + 1, Name = "", EndStatus = "", TableData = new RecipeDataBase() });
  137. }
  138. }
  139. }
  140. private string _recipeVersion;
  141. public string RecipeVersion
  142. {
  143. get { return this._recipeVersion; }
  144. set
  145. {
  146. this._recipeVersion = value;
  147. this.NotifyOfPropertyChange("RecipeVersion");
  148. }
  149. }
  150. private string _recipePermission;
  151. public string RecipePermission
  152. {
  153. get { return this._recipePermission; }
  154. set
  155. {
  156. this._recipePermission = value;
  157. this.NotifyOfPropertyChange("RecipePermisson");
  158. }
  159. }
  160. private string _recipeLevel;
  161. public string RecipeLevel
  162. {
  163. get { return this._recipeLevel; }
  164. set
  165. {
  166. this._recipeLevel = value;
  167. this.NotifyOfPropertyChange("RecipeLevel");
  168. }
  169. }
  170. private string _prefixPath;
  171. public string PrefixPath
  172. {
  173. get { return _prefixPath; }
  174. set
  175. {
  176. _prefixPath = value;
  177. this.NotifyOfPropertyChange("PrefixPath");
  178. }
  179. }
  180. private string creator;
  181. public string Creator
  182. {
  183. get { return this.creator; }
  184. set
  185. {
  186. this.creator = value;
  187. this.NotifyOfPropertyChange("Creator");
  188. }
  189. }
  190. private DateTime createTime;
  191. public DateTime CreateTime
  192. {
  193. get { return this.createTime; }
  194. set
  195. {
  196. this.createTime = value;
  197. this.NotifyOfPropertyChange("CreateTime");
  198. }
  199. }
  200. private string description;
  201. public string Description
  202. {
  203. get { return this.description; }
  204. set
  205. {
  206. this.description = value;
  207. this.NotifyOfPropertyChange("Description");
  208. }
  209. }
  210. private string devisor;
  211. public string Revisor
  212. {
  213. get { return this.devisor; }
  214. set
  215. {
  216. this.devisor = value;
  217. this.NotifyOfPropertyChange("Revisor");
  218. }
  219. }
  220. private int _TableIndex = 1;
  221. public int TableIndex
  222. {
  223. get { return this._TableIndex; }
  224. set
  225. {
  226. this._TableIndex = value;
  227. this.NotifyOfPropertyChange("TableIndex");
  228. }
  229. }
  230. public string Time
  231. {
  232. get => GetTime();
  233. }
  234. private string GetTime()
  235. {
  236. var parm = this.ConfigItems.FirstOrDefault(x => x.Name == "RecipeTime") as StringParam;
  237. if (parm != null)
  238. {
  239. return ConvertSecondsToHMSFormat(parm.Value);
  240. }
  241. return "00:00:00.0";
  242. }
  243. public static string ConvertSecondsToHMSFormat(string strTotalSeconds)
  244. {
  245. double totalSeconds = 0;
  246. double.TryParse(strTotalSeconds, out totalSeconds);
  247. int intTotalSeconds = (int)totalSeconds;
  248. int hours = intTotalSeconds / 3600;
  249. int minutes = (intTotalSeconds % 3600) / 60;
  250. double seconds = intTotalSeconds % 60 + (totalSeconds - intTotalSeconds);
  251. return string.Format("{0:00}:{1:00}:{2:00.0}", hours, minutes, seconds);
  252. }
  253. public string TableName => Tables.Count > 0 ? Tables.FirstOrDefault(x => x.Index == TableIndex).Name : "";
  254. private DateTime deviseTime;
  255. public DateTime ReviseTime
  256. {
  257. get { return this.deviseTime; }
  258. set
  259. {
  260. this.deviseTime = value;
  261. this.NotifyOfPropertyChange("ReviseTime");
  262. }
  263. }
  264. public ObservableCollection<Step> Steps { get; set; }
  265. public Dictionary<string, ObservableCollection<ObservableCollection<Param>>> PopSettingSteps { get; private set; }
  266. public ObservableCollection<ObservableCollection<Param>> StepTolerances { get; private set; }
  267. public ObservableCollection<Param> ConfigItems { get; private set; }
  268. public List<int> StepNos { get; set; } = new List<int>();
  269. private XmlDocument _doc;
  270. private string _module = "PM1";
  271. public bool ToleranceEnable { get; set; }
  272. public Dictionary<string, bool> PopEnable { get; set; }
  273. public bool IsCompatibleWithCurrentFormat { get; set; }
  274. private RecipeProvider _recipeProvider = new RecipeProvider();
  275. private Dictionary<string, ObservableCollection<RecipeTemplateColumnBase>> RecipeTemplate;
  276. public ObservableCollection<RecipeTable> Tables { get; set; } = new ObservableCollection<RecipeTable>();
  277. public void ShallowCopyStep(ref Step destinationStep, Step originalStep)
  278. {
  279. int stepNo = destinationStep.StepNo;
  280. Type type = originalStep.GetType();
  281. PropertyInfo[] properties = type.GetProperties();
  282. // 遍历属性并赋值
  283. foreach (PropertyInfo property in properties)
  284. {
  285. // 判断属性是否可写
  286. if (property.CanWrite)
  287. {
  288. // 设置属性的值
  289. property.SetValue(destinationStep, property.GetValue(originalStep));
  290. }
  291. }
  292. destinationStep.StepNo = stepNo;
  293. }
  294. public void CloneStep(ref Step destinationStep, Step originalStep)
  295. {
  296. int stepNo = destinationStep.StepNo;
  297. destinationStep = (Step)CloneUtil.CloneObjectSetFlag(originalStep, "IsSaved", true);
  298. destinationStep.StepNo = stepNo;
  299. SetDelegateEvent(destinationStep);
  300. ////destinationStep.StepNo = originalStep.StepNo;
  301. //destinationStep.Name = originalStep.Name;
  302. //destinationStep.Time = originalStep.Time;
  303. //destinationStep.SkipWait = originalStep.SkipWait;
  304. //destinationStep.EndBy = originalStep.EndBy;
  305. //destinationStep.MFCSets = originalStep.MFCSets;
  306. //destinationStep.MFMSets = originalStep.MFMSets;
  307. //destinationStep.ValveSets = originalStep.ValveSets;
  308. ////destinationStep.AlarmActionSets = originalStep.AlarmActionSets;
  309. //foreach (var temkey in originalStep.AlarmActionSets.Keys)
  310. //{
  311. // if (!destinationStep.AlarmActionSets.ContainsKey(temkey))
  312. // {
  313. // destinationStep.AlarmActionSets.Add(temkey, originalStep.AlarmActionSets[temkey]);
  314. // }
  315. // else
  316. // {
  317. // destinationStep.AlarmActionSets[temkey] = originalStep.AlarmActionSets[temkey];
  318. // }
  319. //}
  320. //destinationStep.AlarmConditionTable = originalStep.AlarmConditionTable;
  321. ////destinationStep.TemperatureSets = originalStep.TemperatureSets;
  322. //foreach (var temkey in originalStep.TemperatureSets.Keys)
  323. //{
  324. // if (!destinationStep.TemperatureSets.ContainsKey(temkey))
  325. // {
  326. // destinationStep.TemperatureSets.Add(temkey, originalStep.TemperatureSets[temkey]);
  327. // }
  328. // else
  329. // {
  330. // destinationStep.TemperatureSets[temkey] = originalStep.TemperatureSets[temkey];
  331. // }
  332. //}
  333. //destinationStep.TemperatureControlMode = originalStep.TemperatureControlMode;
  334. //destinationStep.TemperatureCorrect = originalStep.TemperatureCorrect;
  335. //destinationStep.TemperaturePID = originalStep.TemperaturePID;
  336. //destinationStep.LoaderCommand = originalStep.LoaderCommand;
  337. //destinationStep.LoaderValue = originalStep.LoaderValue;
  338. //destinationStep.PressCommand = originalStep.PressCommand;
  339. //destinationStep.PressValue = originalStep.PressValue;
  340. //destinationStep.TemperatureProfile = originalStep.TemperatureProfile;
  341. //destinationStep.TemperatureAlarm = originalStep.TemperatureAlarm;
  342. //destinationStep.CAPTemperatureAlarm = originalStep.CAPTemperatureAlarm;
  343. //destinationStep.CAPSetValue = originalStep.CAPSetValue;
  344. //destinationStep.CAPRampingValue = originalStep.CAPRampingValue;
  345. //destinationStep.TemperatureStabilize = originalStep.TemperatureStabilize;
  346. //destinationStep.TemperatureReadyCond = originalStep.TemperatureReadyCond;
  347. //destinationStep.RFSwitch = originalStep.RFSwitch;
  348. //destinationStep.RFSetpoint = originalStep.RFSetpoint;
  349. //destinationStep.RFPowerSetpoint = originalStep.RFPowerSetpoint;
  350. //destinationStep.C1Setpoint = originalStep.C1Setpoint;
  351. //destinationStep.C2Setpoint = originalStep.C2Setpoint;
  352. //destinationStep.ForwardPowerAlarmWatchTable = originalStep.ForwardPowerAlarmWatchTable;
  353. //destinationStep.PrAlarmWatchTable = originalStep.PrAlarmWatchTable;
  354. //destinationStep.PIAlarmWatchTable = originalStep.PIAlarmWatchTable;
  355. //destinationStep.C1AlarmWatchTable = originalStep.C1AlarmWatchTable;
  356. //destinationStep.C2AlarmWatchTable = originalStep.C2AlarmWatchTable;
  357. //destinationStep.VppAlarmWatchTable = originalStep.VppAlarmWatchTable;
  358. //destinationStep.VdcAlarmWatchTable = originalStep.VdcAlarmWatchTable;
  359. ////destinationStep.Command = originalStep.Command;
  360. ////destinationStep.APC_SetPressure = originalStep.APC_SetPressure;
  361. ////destinationStep.EXOUSets = originalStep.EXOUSets;
  362. ////destinationStep.ExternalSensor = originalStep.ExternalSensor;
  363. ////destinationStep.GasLineN2_Flow = originalStep.GasLineN2_Flow;
  364. ////destinationStep.GasLineN3_Flow = originalStep.GasLineN3_Flow;
  365. ////destinationStep.IsnoneConditionCheck = originalStep.IsnoneConditionCheck;
  366. ////destinationStep.ZAxisPosition = originalStep.ZAxisPosition;
  367. ////destinationStep.ZAxisSpeed = originalStep.ZAxisSpeed;
  368. ////destinationStep.RotatePosition = originalStep.RotatePosition;
  369. ////destinationStep.RotateSpeed = originalStep.RotateSpeed;
  370. ////destinationStep.RotateInterval = originalStep.RotateInterval;
  371. ////destinationStep.ReachPressureValue = originalStep.ReachPressureValue;
  372. ////destinationStep.PressureStabilizeSelected = originalStep.PressureStabilizeSelected;
  373. ////destinationStep.PressureSonserValue = originalStep.PressureSonserValue;
  374. ////destinationStep.PressureValveAngle = originalStep.PressureValveAngle;
  375. ////destinationStep.PressureSettingVG = originalStep.PressureSettingVG;
  376. ////destinationStep.PressureAlarmTableNo = originalStep.PressureAlarmTableNo;
  377. ////destinationStep.EventSetting = originalStep.EventSetting;
  378. ////destinationStep.FinishAutoProfile = originalStep.FinishAutoProfile;
  379. ////destinationStep.ReachTemp = originalStep.ReachTemp;
  380. ////destinationStep.ReachPressure = originalStep.ReachPressure;
  381. ////destinationStep.ReachPressureVG = originalStep.ReachPressureVG;
  382. ////destinationStep.PressureStabilizeVG = originalStep.PressureStabilizeVG;
  383. ////destinationStep.ReachTempValue = originalStep.ReachTempValue;
  384. ////destinationStep.TempStabilizeSelected = originalStep.TempStabilizeSelected;
  385. }
  386. public void CloneStep(Step destinationStep, Step originalStep)
  387. {
  388. //destinationStep.StepNo = originalStep.StepNo;
  389. //destinationStep.Name = originalStep.Name;
  390. //destinationStep.EndBy = originalStep.EndBy;
  391. //destinationStep.Time = originalStep.Time;
  392. //destinationStep.SkipWait = originalStep.SkipWait;
  393. //destinationStep.Command = originalStep.Command;
  394. //destinationStep.APC_SetPressure = originalStep.APC_SetPressure;
  395. //destinationStep.EXOUSets = originalStep.EXOUSets;
  396. //destinationStep.ExternalSensor = originalStep.ExternalSensor;
  397. //destinationStep.GasLineN2_Flow = originalStep.GasLineN2_Flow;
  398. //destinationStep.GasLineN3_Flow = originalStep.GasLineN3_Flow;
  399. //destinationStep.IsnoneConditionCheck = originalStep.IsnoneConditionCheck;
  400. //destinationStep.ZAxisPosition = originalStep.ZAxisPosition;
  401. //destinationStep.ZAxisSpeed = originalStep.ZAxisSpeed;
  402. //destinationStep.RotatePosition = originalStep.RotatePosition;
  403. //destinationStep.RotateSpeed = originalStep.RotateSpeed;
  404. //destinationStep.RotateInterval = originalStep.RotateInterval;
  405. //destinationStep.MFCSets = originalStep.MFCSets;
  406. //destinationStep.MFMSets = originalStep.MFMSets;
  407. //destinationStep.ValveSets = originalStep.ValveSets;
  408. //destinationStep.ReachPressureValue = originalStep.ReachPressureValue;
  409. //destinationStep.PressureStabilizeSelected = originalStep.PressureStabilizeSelected;
  410. //destinationStep.PressureSonserValue = originalStep.PressureSonserValue;
  411. //destinationStep.PressureValveAngle = originalStep.PressureValveAngle;
  412. //destinationStep.PressureSettingVG = originalStep.PressureSettingVG;
  413. //destinationStep.SlowVacuumValue = originalStep.SlowVacuumValue;
  414. //destinationStep.PressureAlarmTableNo = originalStep.PressureAlarmTableNo;
  415. //destinationStep.TemperatureCorrect = originalStep.TemperatureCorrect;
  416. //destinationStep.TemperaturePID = originalStep.TemperaturePID;
  417. //destinationStep.LoaderCommand = originalStep.LoaderCommand;
  418. //destinationStep.LoaderValue = originalStep.LoaderValue;
  419. //destinationStep.PressCommand = originalStep.PressCommand;
  420. //destinationStep.PressValue = originalStep.PressValue;
  421. //destinationStep.TemperatureSets = originalStep.TemperatureSets;
  422. //destinationStep.EventSetting = originalStep.EventSetting;
  423. //destinationStep.FinishAutoProfile = originalStep.FinishAutoProfile;
  424. //destinationStep.ReachTemp = originalStep.ReachTemp;
  425. //destinationStep.O2Density = originalStep.O2Density;
  426. //destinationStep.ReachPressure = originalStep.ReachPressure;
  427. //destinationStep.ReachPressureVG = originalStep.ReachPressureVG;
  428. //destinationStep.PressureStabilizeVG = originalStep.PressureStabilizeVG;
  429. //destinationStep.ReachTempValue = originalStep.ReachTempValue;
  430. //destinationStep.O2DensityValue = originalStep.O2DensityValue;
  431. //destinationStep.RotateDirection = originalStep.RotateDirection;
  432. //destinationStep.TempStabilizeSelected = originalStep.TempStabilizeSelected;
  433. destinationStep = (Step)CloneUtil.CloneObject(originalStep);
  434. SetDelegateEvent(destinationStep);
  435. }
  436. public RecipeDataBase()
  437. {
  438. this.Steps = new ObservableCollection<Step>();
  439. StepTolerances = new ObservableCollection<ObservableCollection<Param>>();
  440. this.PopSettingSteps = new Dictionary<string, ObservableCollection<ObservableCollection<Param>>>();
  441. this.PopEnable = new Dictionary<string, bool>();
  442. ConfigItems = new ObservableCollection<Param>()
  443. {
  444. new StringParam { Name="Combination.SubRecipe"},
  445. new StringParam { Name="Combination.AlarmRecipe"},
  446. new StringParam { Name="Combination.AlarmCondition"},
  447. new StringParam { Name="Combination.LeakCheck"},
  448. new StringParam { Name="Combination.AbortRecipe"},
  449. new StringParam { Name="Combination.PressAPCPID"},
  450. new StringParam { Name="Combination.TempCorrection"},
  451. new StringParam { Name="Combination.TempPID"},
  452. new StringParam { Name="Combination.ProfileCondition"},
  453. new StringParam { Name="RecipeTime"},
  454. new StringParam { Name="N2PurgeMode",Value = "None"},
  455. };
  456. IsSavedDesc = true;
  457. _doc = new XmlDocument();
  458. XmlElement node = _doc.CreateElement("Aitex");
  459. _doc.AppendChild(node);
  460. node.AppendChild(_doc.CreateElement("TableRecipeData"));
  461. string vars = _recipeProvider.GetRecipeFormatXml(MECF.Framework.Common.Equipment.ModuleName.PM1);
  462. RecipeTemplate = _recipeProvider.GetGroupRecipeTemplate();
  463. StepCollectionChanged();
  464. }
  465. private void StepCollectionChanged()
  466. {
  467. foreach (var item in Steps)
  468. {
  469. item.TempValueChangedEvent += Item_TempValueChangedEvent;
  470. item.MFCValueChangedEvent += Item_MFCValueChangedEvent;
  471. item.ValveValueChangedEvent += Item_ValveValueChangedEvent;
  472. item.AUXValueChangedEvent += Item_AUXValueChangedEvent;
  473. item.OhterTempValueChangedEvent += Item_OhterTempValueChangedEvent;
  474. item.PressureValueChangedEvent += Item_PressureValueChangedEvent;
  475. item.LoaderValueChangedEvent += Item_LoaderValueChangedEvent;
  476. item.AlarmValueChangedEvent += Item_AlarmValueChangedEvent;
  477. }
  478. Steps.CollectionChanged += (s, e) =>
  479. {
  480. if (e.OldItems != null)
  481. {
  482. foreach (Step item in e.OldItems)
  483. {
  484. item.TempValueChangedEvent -= Item_TempValueChangedEvent;
  485. item.MFCValueChangedEvent -= Item_MFCValueChangedEvent;
  486. item.ValveValueChangedEvent -= Item_ValveValueChangedEvent;
  487. item.AUXValueChangedEvent -= Item_AUXValueChangedEvent;
  488. item.OhterTempValueChangedEvent -= Item_OhterTempValueChangedEvent;
  489. item.PressureValueChangedEvent -= Item_PressureValueChangedEvent;
  490. item.LoaderValueChangedEvent -= Item_LoaderValueChangedEvent;
  491. item.AlarmValueChangedEvent -= Item_AlarmValueChangedEvent;
  492. }
  493. }
  494. if (e.NewItems != null)
  495. {
  496. foreach (Step item in e.NewItems)
  497. {
  498. item.TempValueChangedEvent += Item_TempValueChangedEvent;
  499. item.MFCValueChangedEvent += Item_MFCValueChangedEvent;
  500. item.ValveValueChangedEvent += Item_ValveValueChangedEvent;
  501. item.AUXValueChangedEvent += Item_AUXValueChangedEvent;
  502. item.OhterTempValueChangedEvent += Item_OhterTempValueChangedEvent;
  503. item.PressureValueChangedEvent += Item_PressureValueChangedEvent;
  504. item.LoaderValueChangedEvent += Item_LoaderValueChangedEvent;
  505. item.AlarmValueChangedEvent += Item_AlarmValueChangedEvent;
  506. }
  507. }
  508. };
  509. }
  510. private void Item_LoaderValueChangedEvent(object sender, SetValueEventArgs e)
  511. {
  512. //throw new NotImplementedException();
  513. }
  514. private void Item_AlarmValueChangedEvent(object sender, SetValueEventArgs e)
  515. {
  516. if (sender != null && sender is Step)
  517. {
  518. var step = sender as Step;
  519. int stepIndex = Steps.IndexOf(step);
  520. if (stepIndex < Steps.Count - 1)
  521. {
  522. for (int i = stepIndex + 1; i < Steps.Count; i++)
  523. {
  524. if (Steps[i].AlarmIsSaved)
  525. {
  526. string tempName = e.ValueName;
  527. string proName = e.PropertyName;
  528. string proValue = e.PropertyValue;
  529. Type type = Steps[i].GetType();
  530. PropertyInfo[] properties = type.GetProperties();
  531. var property = properties.FirstOrDefault(x => x.Name == proName);
  532. if (property != null)
  533. {
  534. var proParam = property.GetValue(Steps[i]);
  535. if (proParam is StringParam)
  536. {
  537. ((StringParam)proParam).Value = proValue;
  538. //property.SetValue(Steps[i], proParam);
  539. }
  540. }
  541. }
  542. else
  543. { break; }
  544. }
  545. }
  546. }
  547. }
  548. private void Item_PressureValueChangedEvent(object sender, SetValueEventArgs e)
  549. {
  550. if (sender != null && sender is Step)
  551. {
  552. var step = sender as Step;
  553. int stepIndex = Steps.IndexOf(step);
  554. if (stepIndex < Steps.Count - 1)
  555. {
  556. for (int i = stepIndex + 1; i < Steps.Count; i++)
  557. {
  558. if (Steps[i].PressIsSaved)
  559. {
  560. string tempName = e.ValueName;
  561. string proName = e.PropertyName;
  562. string proValue = e.PropertyValue;
  563. Type type = Steps[i].GetType();
  564. PropertyInfo[] properties = type.GetProperties();
  565. var property = properties.FirstOrDefault(x => x.Name == proName);
  566. if (property != null)
  567. {
  568. var proParam = property.GetValue(Steps[i]);
  569. if (proParam is DoubleParam)
  570. {
  571. ((DoubleParam)proParam).Value = proValue;
  572. property.SetValue(Steps[i], proParam);
  573. }
  574. else if (proParam is StringParam)
  575. {
  576. ((StringParam)proParam).Value = proValue;
  577. property.SetValue(Steps[i], proParam);
  578. }
  579. }
  580. }
  581. else
  582. { break; }
  583. }
  584. }
  585. }
  586. }
  587. private void Item_OhterTempValueChangedEvent(object sender, SetValueEventArgs e)
  588. {
  589. if (sender != null && sender is Step)
  590. {
  591. var step = sender as Step;
  592. int stepIndex = Steps.IndexOf(step);
  593. if (stepIndex < Steps.Count - 1)
  594. {
  595. for (int i = stepIndex + 1; i < Steps.Count; i++)
  596. {
  597. if (Steps[i].TemperatureIsSaved)
  598. {
  599. string tempName = e.ValueName;
  600. string proName = e.PropertyName;
  601. string proValue = e.PropertyValue;
  602. Type type = Steps[i].GetType();
  603. PropertyInfo[] properties = type.GetProperties();
  604. var property = properties.FirstOrDefault(x => x.Name == proName);
  605. if (property != null)
  606. {
  607. var proParam = property.GetValue(Steps[i]);
  608. if (proParam is DoubleParam)
  609. {
  610. ((DoubleParam)proParam).Value = proValue;
  611. property.SetValue(Steps[i], proParam);
  612. }
  613. else if (proParam is StringParam)
  614. {
  615. ((StringParam)proParam).Value = proValue;
  616. ((StringParam)proParam).IsSaved = true;
  617. property.SetValue(Steps[i], proParam);
  618. }
  619. else if (proParam is BoolParam)
  620. {
  621. bool tryValue = true;
  622. bool.TryParse(proValue, out tryValue);
  623. ((BoolParam)proParam).Value = tryValue;
  624. property.SetValue(Steps[i], proParam);
  625. }
  626. }
  627. }
  628. else
  629. { break; }
  630. }
  631. }
  632. }
  633. }
  634. private void Item_MFCValueChangedEvent(object sender, SetValueEventArgs e)
  635. {
  636. if (sender != null && sender is Step)
  637. {
  638. var step = sender as Step;
  639. int stepIndex = Steps.IndexOf(step);
  640. if (stepIndex < Steps.Count - 1)
  641. {
  642. for (int i = stepIndex + 1; i < Steps.Count; i++)
  643. {
  644. if (Steps[i].MFCIsSaved)
  645. {
  646. var tempData = (MFCData)e.Sender;
  647. string tempName = e.ValueName;
  648. string proName = e.PropertyName;
  649. string proValue = e.PropertyValue;
  650. var temp = Steps[i].MFCSets.FirstOrDefault(x => x.ControlName == tempName);
  651. Type type = temp.GetType();
  652. PropertyInfo[] properties = type.GetProperties();
  653. var property = properties.FirstOrDefault(x => x.Name == proName);
  654. if (property != null)
  655. {
  656. var proParam = property.GetValue(temp);
  657. if (proParam is DoubleParam)
  658. {
  659. ((DoubleParam)proParam).Value = proValue;
  660. property.SetValue(temp, proParam);
  661. }
  662. else if (proParam is IntParam)
  663. {
  664. int.TryParse(proValue, out int outValue);
  665. ((IntParam)proParam).Value = outValue;
  666. property.SetValue(temp, proParam);
  667. }
  668. else if (proParam is StringParam)
  669. {
  670. ((StringParam)proParam).Value = proValue;
  671. property.SetValue(temp, proParam);
  672. }
  673. else if (proParam is BoolParam)
  674. {
  675. bool tryValue = true;
  676. bool.TryParse(proValue, out tryValue);
  677. ((BoolParam)proParam).Value = tryValue;
  678. property.SetValue(temp, proParam);
  679. }
  680. }
  681. }
  682. else
  683. { break; }
  684. }
  685. }
  686. }
  687. }
  688. private void Item_TempValueChangedEvent(object sender, SetValueEventArgs e)
  689. {
  690. if (sender != null && sender is Step)
  691. {
  692. var step = sender as Step;
  693. int stepIndex = Steps.IndexOf(step);
  694. if (stepIndex < Steps.Count - 1)
  695. {
  696. for (int i = stepIndex + 1; i < Steps.Count; i++)
  697. {
  698. if (Steps[i].TemperatureIsSaved)
  699. {
  700. var tempData = (TempSetData)e.Sender;
  701. string tempName = e.ValueName;
  702. string proName = e.PropertyName;
  703. string proValue = e.PropertyValue;
  704. var temp = Steps[i].TemperatureSets.FirstOrDefault(x => x.Name == tempName);
  705. Type type = temp.GetType();
  706. PropertyInfo[] properties = type.GetProperties();
  707. var property = properties.FirstOrDefault(x => x.Name == proName);
  708. if (property != null)
  709. {
  710. var proParam = property.GetValue(temp);
  711. if (proParam is DoubleParam)
  712. {
  713. ((DoubleParam)proParam).Value = proValue;
  714. property.SetValue(temp, proParam);
  715. }
  716. else if (proParam is StringParam)
  717. {
  718. ((StringParam)proParam).Value = proValue;
  719. property.SetValue(temp, proParam);
  720. }
  721. }
  722. }
  723. else
  724. { break; }
  725. }
  726. }
  727. }
  728. }
  729. private void Item_TempOtherValueChangedEvent(object sender, SetValueEventArgs e)
  730. {
  731. if (sender != null && sender is Step)
  732. {
  733. var step = sender as Step;
  734. int stepIndex = Steps.IndexOf(step);
  735. if (stepIndex < Steps.Count - 1)
  736. {
  737. for (int i = stepIndex + 1; i < Steps.Count; i++)
  738. {
  739. if (Steps[i].TemperatureIsSaved)
  740. {
  741. string proName = e.PropertyName;
  742. string proValue = e.PropertyValue;
  743. Type type = step.GetType();
  744. PropertyInfo[] properties = type.GetProperties();
  745. var property = properties.FirstOrDefault(x => x.Name == proName);
  746. if (property != null)
  747. {
  748. var proParam = property.GetValue(Steps[i]);
  749. if (proParam is StringParam)
  750. {
  751. ((StringParam)proParam).Value = proValue;
  752. property.SetValue(Steps[i], proParam);
  753. }
  754. }
  755. }
  756. else
  757. { break; }
  758. }
  759. }
  760. }
  761. }
  762. private void Item_AUXValueChangedEvent(object sender, SetValueEventArgs e)
  763. {
  764. if (sender != null && sender is Step)
  765. {
  766. var step = sender as Step;
  767. int stepIndex = Steps.IndexOf(step);
  768. if (stepIndex < Steps.Count - 1)
  769. {
  770. for (int i = stepIndex + 1; i < Steps.Count; i++)
  771. {
  772. if (Steps[i].AUXIsSaved)
  773. {
  774. var tempData = (AUXData)e.Sender;
  775. string tempName = e.ValueName;
  776. string proName = e.PropertyName;
  777. string proValue = e.PropertyValue;
  778. var temp = Steps[i].AUXSets.FirstOrDefault(x => x.ControlName == tempName);
  779. Type type = temp.GetType();
  780. PropertyInfo[] properties = type.GetProperties();
  781. var property = properties.FirstOrDefault(x => x.Name == proName);
  782. if (property != null)
  783. {
  784. var proParam = property.GetValue(temp);
  785. if (proParam is DoubleParam)
  786. {
  787. ((DoubleParam)proParam).Value = proValue;
  788. property.SetValue(temp, proParam);
  789. }
  790. else if (proParam is StringParam)
  791. {
  792. ((StringParam)proParam).Value = proValue;
  793. property.SetValue(temp, proParam);
  794. }
  795. else if (proParam is BoolParam)
  796. {
  797. bool tryValue = true;
  798. bool.TryParse(proValue, out tryValue);
  799. ((BoolParam)proParam).Value = tryValue;
  800. property.SetValue(temp, proParam);
  801. }
  802. }
  803. }
  804. else
  805. { break; }
  806. }
  807. }
  808. }
  809. }
  810. private void Item_ValveValueChangedEvent(object sender, SetValueEventArgs e)
  811. {
  812. if (sender != null && sender is Step)
  813. {
  814. var step = sender as Step;
  815. int stepIndex = Steps.IndexOf(step);
  816. if (stepIndex < Steps.Count - 1)
  817. {
  818. for (int i = stepIndex + 1; i < Steps.Count; i++)
  819. {
  820. if (Steps[i].ValveIsSaved)
  821. {
  822. var tempData = (BoolParam)e.Sender;
  823. string tempName = e.ValueName;
  824. string proName = e.PropertyName;
  825. string proValue = e.PropertyValue;
  826. var temp = Steps[i].ValveSets.FirstOrDefault(x => x.Name == tempData.Name);
  827. bool tempValue = false;
  828. bool.TryParse(proValue, out tempValue);
  829. temp.Value = tempValue;
  830. }
  831. else
  832. { break; }
  833. }
  834. }
  835. }
  836. }
  837. public void Clear()
  838. {
  839. Steps.Clear();
  840. PopSettingSteps.Clear();
  841. StepTolerances.Clear();
  842. RecipeChamberType = "";
  843. RecipeVersion = "";
  844. IsSavedDesc = true;
  845. _module = "PM1";
  846. }
  847. public void StepCloneChangedIndex()
  848. {
  849. int index = 1;
  850. foreach (var item in Steps)
  851. {
  852. item.StepNo = index;
  853. index += 1;
  854. }
  855. }
  856. public void InitData(string prefixPath, string recipeName, string recipeContent, string module, int tableNo = 1)
  857. {
  858. IsCompatibleWithCurrentFormat = false;
  859. _module = module;
  860. Name = recipeName;
  861. PrefixPath = prefixPath;
  862. try
  863. {
  864. _doc = new XmlDocument();
  865. _doc.LoadXml(recipeContent);
  866. if (!LoadHeader(_doc.SelectSingleNode("Aitex/TableRecipeData")))
  867. return;
  868. //Load Tables
  869. XmlNode nodeTable = _doc.SelectSingleNode($"Aitex/TableRecipeData/Tables");
  870. if (nodeTable != null)
  871. LoadTables(nodeTable);
  872. if (!SaveTableRecipeTypes.Contains(RecipeChamberType))
  873. {
  874. XmlNodeList nodeSteps = _doc.SelectNodes($"Aitex/TableRecipeData/Module[@Name='{module}']/Step");
  875. if (nodeSteps == null)
  876. nodeSteps = _doc.SelectNodes($"Aitex/TableRecipeData/Step");
  877. FastLoadSteps(nodeSteps);
  878. // LoadSteps(nodeSteps);
  879. XmlNode nodeConfig = _doc.SelectSingleNode($"Aitex/TableRecipeData/Module[@Name='{module}']/Config");
  880. if (nodeConfig == null)
  881. nodeConfig = _doc.SelectSingleNode($"Aitex/TableRecipeData/Config");
  882. LoadConfigs(nodeConfig);
  883. }
  884. else
  885. {
  886. Steps.Clear();
  887. StepNos.Clear();
  888. TableIndex = 1;
  889. Tables[0].TableData.Steps.ToList().ForEach(
  890. x =>
  891. {
  892. var tempStep = x;// (Step)CloneUtil.CloneObject(x);
  893. tempStep.StepNo = x.StepNo;
  894. Steps.Add(tempStep);
  895. StepNos.Add(x.StepNo);
  896. });
  897. }
  898. //var index = 1;
  899. //foreach (Step parameters in Steps)
  900. //{
  901. // parameters.Value = index.ToString();
  902. // index++;
  903. //}
  904. IsCompatibleWithCurrentFormat = true;
  905. }
  906. catch (Exception ex)
  907. {
  908. LOG.Write(ex);
  909. }
  910. }
  911. public void SaveTo(string[] moduleList)
  912. {
  913. GetXmlString();
  914. XmlNode nodeModule = _doc.SelectSingleNode($"Aitex/TableRecipeData/Module[@Name='{_module}']");
  915. if (nodeModule == null)
  916. {
  917. LOG.Write("recipe not find modules," + Name);
  918. return;
  919. }
  920. XmlNode nodeData = nodeModule.ParentNode;
  921. foreach (var module in moduleList)
  922. {
  923. if (module == _module)
  924. {
  925. continue;
  926. }
  927. var child = _doc.SelectSingleNode($"Aitex/TableRecipeData/Module[@Name='{module}']");
  928. if (child != null)
  929. nodeData.RemoveChild(child);
  930. XmlElement node = nodeModule.Clone() as XmlElement;
  931. node.SetAttribute("Name", module);
  932. nodeData.AppendChild(node);
  933. }
  934. }
  935. int StepNo = 1;
  936. public string DictionaryStepTime(Dictionary<string, string> steptimes)
  937. {
  938. if (steptimes == null && steptimes.Count == 0) return null;
  939. StringBuilder rtn = new StringBuilder();
  940. foreach (var item in steptimes.Keys)
  941. {
  942. if (steptimes[item] == "00:00:00") continue;
  943. rtn.Append($"{item},{steptimes[item]};");
  944. }
  945. if (rtn.Length > 0) rtn.Remove(rtn.Length - 1, 1);
  946. return rtn.ToString();
  947. }
  948. public Dictionary<string, string> StepTimeToDictionary(string stepTime)
  949. {
  950. Dictionary<string, string> steptimes = new Dictionary<string, string>();
  951. string[] tempTimes = stepTime.Split(';');
  952. foreach (var item in tempTimes)
  953. {
  954. string[] subTimes = item.Split(',');
  955. steptimes.Add(subTimes[0], subTimes[1]);
  956. }
  957. return steptimes;
  958. }
  959. private List<string> valveDefaultOpen = new List<string>() { "AGV", "MBP", "DP", "HTR1", "HTR2", "HTR3" };
  960. private MFCData GetNewMFCData(string controlName)
  961. {
  962. return new MFCData()
  963. {
  964. Name = controlName,
  965. ControlName = controlName.Replace(".Flow", ""),
  966. SetValue = new StringParam() { Name = "SetValue", Value = "0" },
  967. SetUnit = new StringParam() { Name = "SetUnit", Value = "SLM" },
  968. Rampng = new DoubleParam() { Name = "Rampng", Value = "0" },
  969. RampngUnit = new StringParam() { Name = "RampngUnit", Value = "SLM" },
  970. AlarmValue = "None",
  971. IsCheck = new BoolParam() { Name = "IsCheck", Value = false },
  972. MaxValue = new DoubleParam() { Name = "MaxValue", Value = "0" },
  973. MinValue = new DoubleParam { Name = "MaxValue", Value = "0" }
  974. };
  975. }
  976. public Step CreateStep(Step oldStep, XmlNode stepNode = null)
  977. {
  978. if (oldStep == null)
  979. {
  980. return CreateStep(stepNode);
  981. }
  982. else
  983. {
  984. Step step = (Step)CloneUtil.CloneObject(oldStep);
  985. if (stepNode != null)
  986. {
  987. if (stepNode.Attributes["StepNo"] != null)
  988. step.StepNo = int.Parse(stepNode.Attributes["StepNo"].Value);
  989. if (stepNode.Attributes["Name"] != null)
  990. step.Name = stepNode.Attributes["Name"].Value;
  991. if (stepNode.Attributes["EndBy"] != null)
  992. step.EndBy = stepNode.Attributes["EndBy"].Value;
  993. if (stepNode.Attributes["Time"] != null)
  994. {
  995. var timeValue = stepNode.Attributes["Time"].Value;
  996. if (!string.IsNullOrEmpty(timeValue) && !timeValue.Contains('.'))
  997. {
  998. timeValue = $"{timeValue}.0";
  999. }
  1000. step.Time = timeValue;
  1001. }
  1002. if (stepNode.Attributes["SkipWait"] != null)
  1003. step.SkipWait = stepNode.Attributes["SkipWait"].Value;
  1004. else
  1005. step.SkipWait = "";
  1006. if (stepNode.Attributes["Command"] != null)
  1007. step.Command = stepNode.Attributes["Command"].Value;
  1008. AnalysisIsSaved(stepNode, step);
  1009. ReadConditionCheck(stepNode, step);
  1010. if (stepNode.Attributes["AlarmConditionTable"] != null)
  1011. step.AlarmConditionTable = new StringParam() { Name = "AlarmConditionTable", Value = stepNode.Attributes["AlarmConditionTable"].Value };
  1012. if (stepNode.Attributes["AbortRecipeTableIndex"] != null)
  1013. step.AbortRecipeTableIndex = stepNode.Attributes["AbortRecipeTableIndex"].Value;
  1014. if (stepNode.Attributes["FilmThickFormula"] != null)
  1015. step.FilmThickFormula = stepNode.Attributes["FilmThickFormula"].Value;
  1016. if (RecipeTemplate != null && RecipeTemplate.ContainsKey("Valve"))
  1017. {
  1018. foreach (var item in RecipeTemplate["Valve"])
  1019. {
  1020. var _tempValve = step.ValveSets.FirstOrDefault(x => x.Name == item.ControlName);
  1021. if (stepNode.Attributes[item.ControlName] != null && _tempValve != null)
  1022. {
  1023. var tempstr = stepNode.Attributes[item.ControlName].Value;
  1024. //if (valveDefaultOpen.Contains(item.ControlName))
  1025. //{
  1026. // _tempValve.Value = true;
  1027. //}
  1028. //else
  1029. //{
  1030. var boolVal = stepNode.Attributes[item.ControlName].Value == "Open" ? true : false;
  1031. _tempValve.Value = boolVal;
  1032. //}
  1033. }
  1034. else
  1035. {
  1036. if (valveDefaultOpen.Contains(item.ControlName))
  1037. {
  1038. var findVal = step.ValveSets.FirstOrDefault(x => x.Name == item.ControlName);
  1039. if (findVal != null)
  1040. {
  1041. findVal.Value = true;
  1042. }
  1043. else
  1044. {
  1045. step.ValveSets.Add(new BoolParam() { Name = item.ControlName, Value = true });
  1046. }
  1047. }
  1048. else
  1049. {
  1050. var findVal = step.ValveSets.FirstOrDefault(x => x.Name == item.ControlName);
  1051. if (findVal != null)
  1052. {
  1053. findVal.Value = false;
  1054. }
  1055. else
  1056. {
  1057. step.ValveSets.Add(new BoolParam() { Name = item.ControlName, Value = false });
  1058. }
  1059. }
  1060. }
  1061. }
  1062. }
  1063. if (RecipeTemplate != null && RecipeTemplate.ContainsKey("Temperature"))
  1064. {
  1065. foreach (var item in RecipeTemplate["Temperature"])
  1066. {
  1067. FromXmlNodeGetTemperatureSets(stepNode, step, item);
  1068. }
  1069. }
  1070. if (RecipeTemplate != null && RecipeTemplate.ContainsKey("MFC"))
  1071. {
  1072. foreach (var item in RecipeTemplate["MFC"])
  1073. {
  1074. var mFCData = step.MFCSets.FirstOrDefault(x => x.ControlName == item.ControlName.Replace(".Flow", ""));
  1075. if (mFCData == null)
  1076. {
  1077. step.MFCSets.Add(GetNewMFCData(item.ControlName));
  1078. }
  1079. if (step.MFCSets != null && step.MFCSets.Count > 0)
  1080. {
  1081. for (int i = 0; i < step.MFCSets.Count; i++)
  1082. {
  1083. step.MFCSets[i].No = i + 1;
  1084. }
  1085. }
  1086. if (stepNode.Attributes[$"{item.ControlName}.IsSaved"] != null)
  1087. {
  1088. bool.TryParse(stepNode.Attributes[$"{item.ControlName}.IsSaved"].Value, out bool isSaved);
  1089. mFCData.FlagIsSaved = isSaved;
  1090. }
  1091. else
  1092. {
  1093. mFCData.FlagIsSaved = true;
  1094. }
  1095. var setValue = stepNode.Attributes[$"{item.ControlName}.Set"] != null ? stepNode.Attributes[$"{item.ControlName}.Set"].Value : "0";
  1096. mFCData.SetValue = new StringParam() { Name = "SetValue", Value = setValue };
  1097. var strSetUnit = stepNode.Attributes[$"{item.ControlName}.SetUnit"] != null ? stepNode.Attributes[$"{item.ControlName}.SetUnit"].Value : "SLM";
  1098. mFCData.SetUnit = new StringParam() { Name = "SetUnit", Value = strSetUnit };
  1099. var rampngValue = stepNode.Attributes[$"{item.ControlName}.Ramprate"] != null ? stepNode.Attributes[$"{item.ControlName}.Ramprate"].Value : "0";
  1100. mFCData.Rampng = new DoubleParam() { Name = "Rampng", Value = rampngValue };
  1101. var strRampngUnit = stepNode.Attributes[$"{item.ControlName}.RamprateUnit"] != null ? stepNode.Attributes[$"{item.ControlName}.RamprateUnit"].Value : "SLM";
  1102. mFCData.RampngUnit = new StringParam() { Name = "RampngUnit", Value = strRampngUnit };
  1103. var boolIsCheck = stepNode.Attributes[$"{item.ControlName}.Check"] != null ? bool.Parse(stepNode.Attributes[$"{item.ControlName}.Check"].Value) : false;
  1104. mFCData.IsCheck = new BoolParam() { Name = "IsCheck", Value = boolIsCheck };
  1105. double max = 0;
  1106. if (stepNode.Attributes[$"{item.ControlName}.High"] != null && !string.IsNullOrEmpty(stepNode.Attributes[$"{item.ControlName}.High"].Value))
  1107. {
  1108. double.TryParse(stepNode.Attributes[$"{item.ControlName}.High"].Value, out max);
  1109. }
  1110. mFCData.MaxValue = new DoubleParam() { Name = "MaxValue", Value = max.ToString() };
  1111. double min = 0;
  1112. if (stepNode.Attributes[$"{item.ControlName}.Low"] != null && !string.IsNullOrEmpty(stepNode.Attributes[$"{item.ControlName}.Low"].Value))
  1113. {
  1114. double.TryParse(stepNode.Attributes[$"{item.ControlName}.Low"].Value, out min);
  1115. }
  1116. mFCData.MinValue = new DoubleParam() { Name = "MinValue", Value = min.ToString() };
  1117. mFCData.Unit = stepNode.Attributes[$"{item.ControlName}.Unit"] != null ? stepNode.Attributes[$"{item.ControlName}.Unit"].Value : "SLM";
  1118. }
  1119. }
  1120. if (RecipeTemplate != null && RecipeTemplate.ContainsKey("MFM"))
  1121. {
  1122. step.MFMSets.Clear();
  1123. foreach (var item in RecipeTemplate["MFM"])
  1124. {
  1125. if (stepNode.Attributes[item.ControlName] != null)
  1126. {
  1127. var MFMListValues = stepNode.Attributes[item.ControlName].Value.Split(';');
  1128. step.MFMSets.Add(item.ControlName, new MFMValue() { Value = MFMListValues[0] });
  1129. if (MFMListValues.Length > 1 && RecipeTemplate != null && RecipeTemplate.ContainsKey("MFMAlarm"))
  1130. {
  1131. step.MFMSets[item.ControlName].AlarmValue = MFMListValues[1];
  1132. }
  1133. else
  1134. {
  1135. step.MFMSets.Add(item.ControlName, new MFMValue() { Value = "0", AlarmValue = "None" });
  1136. }
  1137. }
  1138. else
  1139. {
  1140. if (!step.MFMSets.ContainsKey(item.ControlName))
  1141. {
  1142. step.MFMSets.Add(item.ControlName, new MFMValue() { Value = "0", AlarmValue = "None" });
  1143. }
  1144. }
  1145. }
  1146. }
  1147. for (int i = 1; i < 7; i++)
  1148. {
  1149. if (stepNode.Attributes[$"External.Out{i}"] != null && stepNode.Attributes[$"External.Out{i}"].Value != "")
  1150. {
  1151. if (step.EXOUSets.ContainsKey($"External.Out{i}"))
  1152. {
  1153. step.EXOUSets[$"External.Out{i}"] = bool.Parse(stepNode.Attributes[$"External.Out{i}"].Value);
  1154. }
  1155. else
  1156. {
  1157. step.EXOUSets.Add($"External.Out{i}", bool.Parse(stepNode.Attributes[$"External.Out{i}"].Value));
  1158. }
  1159. }
  1160. else
  1161. {
  1162. if (!step.EXOUSets.ContainsKey($"External.Out{i}"))
  1163. {
  1164. step.EXOUSets.Add($"External.Out{i}", false);
  1165. }
  1166. }
  1167. }
  1168. if (stepNode.Attributes["Temperature.ControlMode"] != null)
  1169. step.TemperatureControlMode = new StringParam() { Name = "TemperatureControlMode", Value = stepNode.Attributes["Temperature.ControlMode"].Value };
  1170. else
  1171. step.TemperatureControlMode = new StringParam() { Name = "TemperatureControlMode", Value = "Heater" };
  1172. if (stepNode.Attributes["Temperature.Correct"] != null)
  1173. step.TemperatureCorrect = new StringParam() { Name = "TemperatureCorrect", Value = stepNode.Attributes["Temperature.Correct"].Value };
  1174. else
  1175. step.TemperatureCorrect = new StringParam() { Name = "TemperatureCorrect", Value = "1" };
  1176. if (stepNode.Attributes["Temperature.PID"] != null)
  1177. step.TemperaturePID = new StringParam() { Name = "TemperaturePID", Value = stepNode.Attributes["Temperature.PID"].Value };
  1178. else
  1179. step.TemperaturePID = new StringParam() { Name = "TemperaturePID", Value = "1" };
  1180. if (stepNode.Attributes["Loader.Command"] != null)
  1181. step.LoaderCommand = new StringParam() { Name = "LoaderCommand", Value = stepNode.Attributes["Loader.Command"].Value };
  1182. else
  1183. step.LoaderCommand = new StringParam() { Name = "LoaderCommand", Value = "None" };
  1184. if (stepNode.Attributes["Loader.Speed1"] != null)
  1185. {
  1186. step.LoaderSpeed1 = new DoubleParam() { Name = "LoaderSpeed1", Value = stepNode.Attributes["Loader.Speed1"].Value };
  1187. }
  1188. if (stepNode.Attributes["Loader.Speed2"] != null)
  1189. {
  1190. step.LoaderSpeed2 = new DoubleParam() { Name = "LoaderSpeed2", Value = stepNode.Attributes["Loader.Speed2"].Value };
  1191. }
  1192. if (stepNode.Attributes["Loader.Speed3"] != null)
  1193. {
  1194. step.LoaderSpeed3 = new DoubleParam() { Name = "LoaderSpeed3", Value = stepNode.Attributes["Loader.Speed3"].Value };
  1195. }
  1196. if (stepNode.Attributes["Loader.RPM"] != null)
  1197. {
  1198. step.LoaderRPM = new DoubleParam() { Name = "LoaderRPM", Value = stepNode.Attributes["Loader.RPM"].Value };
  1199. }
  1200. if (stepNode.Attributes["Press.Command"] != null)
  1201. step.PressCommand = new StringParam() { Name = "PressCommand", Value = stepNode.Attributes["Press.Command"].Value };
  1202. else
  1203. step.PressCommand = new StringParam() { Name = "PressCommand", Value = "None" };
  1204. if (stepNode.Attributes["Press.PID"] != null)
  1205. step.PressPID = new StringParam() { Name = "PressPID", Value = stepNode.Attributes["Press.PID"].Value };
  1206. if (stepNode.Attributes["Press.Set"] != null)
  1207. {
  1208. step.PressSet = new DoubleParam() { Name = "PressSet", Value = stepNode.Attributes["Press.Set"].Value };
  1209. }
  1210. if (stepNode.Attributes["Press.SlowVacSet"] != null)
  1211. {
  1212. step.PressSlowVacSet = new DoubleParam() { Name = "PressSlowVacSet", Value = stepNode.Attributes["Press.SlowVacSet"].Value };
  1213. }
  1214. if (stepNode.Attributes["Press.ValveAngleSet"] != null)
  1215. step.PressValveAngleSet = new StringParam() { Name = "PressValveAngleSet", Value = stepNode.Attributes["Press.ValveAngleSet"].Value };
  1216. if (stepNode.Attributes["Press.IsWait"] != null)
  1217. {
  1218. bool.TryParse(stepNode.Attributes["Press.IsWait"].Value, out bool isWait);
  1219. step.PressIsWait = new BoolParam() { Name = "PressIsWait", Value = isWait };
  1220. }
  1221. if (stepNode.Attributes["Press.LowWait"] != null)
  1222. step.PressLowWait = new StringParam() { Name = "PressLowWait", Value = !string.IsNullOrEmpty(stepNode.Attributes["Press.LowWait"].Value) ? stepNode.Attributes["Press.LowWait"].Value : "0" };
  1223. if (stepNode.Attributes["Press.HighWait"] != null)
  1224. step.PressHighWait = new StringParam() { Name = "PressHighWait", Value = !string.IsNullOrEmpty(stepNode.Attributes["Press.HighWait"].Value) ? stepNode.Attributes["Press.HighWait"].Value : "0" };
  1225. if (stepNode.Attributes["Press.WaitUnit"] != null)
  1226. {
  1227. step.PressWaitUnit = new StringParam() { Name = "PressWaitUnit", Value = stepNode.Attributes["Press.WaitUnit"].Value };
  1228. }
  1229. if (stepNode.Attributes["Press.LowPressWait"] != null)
  1230. step.PressLowPressWait = new StringParam() { Name = "PressLowPressWait", Value = !string.IsNullOrEmpty(stepNode.Attributes["Press.LowPressWait"].Value) ? stepNode.Attributes["Press.LowPressWait"].Value : "None" };
  1231. if (stepNode.Attributes["Press.WaitPress"] != null)
  1232. step.WaitPress = new StringParam() { Name = "PressLowPressWait", Value = !string.IsNullOrEmpty(stepNode.Attributes["Press.WaitPress"].Value) ? stepNode.Attributes["Press.WaitPress"].Value : "0" };
  1233. if (RecipeTemplate != null && RecipeTemplate.ContainsKey("AUX"))
  1234. {
  1235. List<string> queryList = new List<string>();
  1236. foreach (var item in RecipeTemplate["AUX"])
  1237. {
  1238. queryList.Add($"PM1.RecipeEditParameter.AUX.{item.ControlName}.Display");
  1239. queryList.Add($"PM1.RecipeEditParameter.AUX.{item.ControlName}.Unit");
  1240. }
  1241. var dictValues = QueryDataClient.Instance.Service.PollConfig(queryList);
  1242. foreach (var item in RecipeTemplate["AUX"])
  1243. {
  1244. if (stepNode.Attributes[$"AUX.{item.ControlName}.Set"] != null)
  1245. {
  1246. AUXData aUXData = step.AUXSets.FirstOrDefault(x => x.ControlName == item.ControlName);
  1247. if (aUXData == null)
  1248. {
  1249. aUXData = new AUXData();
  1250. var displayName = (string)dictValues[$"PM1.RecipeEditParameter.AUX.{item.ControlName}.Display"];
  1251. var auxUnit = (string)dictValues[$"PM1.RecipeEditParameter.AUX.{item.ControlName}.Unit"];
  1252. aUXData.ControlName = item.ControlName;
  1253. aUXData.DisplayName = displayName;
  1254. aUXData.Unit = auxUnit;
  1255. }
  1256. float setValue = 0;
  1257. if (stepNode.Attributes[$"AUX.{item.ControlName}.Set"] != null)
  1258. {
  1259. float.TryParse(stepNode.Attributes[$"AUX.{item.ControlName}.Set"].Value, out setValue);
  1260. }
  1261. aUXData.SetValue = new DoubleParam() { Name = "SetValue", Value = setValue.ToString() };
  1262. var _ischeck = stepNode.Attributes[$"AUX.{item.ControlName}.Check"] != null ? bool.Parse(stepNode.Attributes[$"AUX.{item.ControlName}.Check"].Value) : false;
  1263. aUXData.IsCheck = new BoolParam() { Name = "IsCheck", Value = _ischeck };
  1264. float maxValue = 0;
  1265. if (stepNode.Attributes[$"AUX.{item.ControlName}.High"] != null)
  1266. {
  1267. float.TryParse(stepNode.Attributes[$"AUX.{item.ControlName}.High"].Value, out maxValue);
  1268. }
  1269. aUXData.MaxValue = new DoubleParam() { Name = "MaxValue", Value = maxValue.ToString() };
  1270. float minValue = 0;
  1271. if (stepNode.Attributes[$"AUX.{item.ControlName}.Low"] != null)
  1272. {
  1273. float.TryParse(stepNode.Attributes[$"AUX.{item.ControlName}.Low"].Value, out minValue);
  1274. }
  1275. aUXData.MinValue = new DoubleParam() { Name = "MinValue", Value = minValue.ToString() };
  1276. var _setunit = stepNode.Attributes[$"AUX.{item.ControlName}.CheckUnit"] != null ? stepNode.Attributes[$"AUX.{item.ControlName}.CheckUnit"].Value : "℃";
  1277. aUXData.SetUnit = new StringParam() { Name = "SetUnit", Value = _setunit };
  1278. if (step.AUXSets.Where(x => x.Name == item.ControlName).Any())
  1279. {
  1280. step.AUXSets.Add(aUXData);
  1281. }
  1282. }
  1283. else
  1284. {
  1285. var displayName = (string)dictValues[$"PM1.RecipeEditParameter.AUX.{item.ControlName}.Display"];
  1286. var auxUnit = (string)dictValues[$"PM1.RecipeEditParameter.AUX.{item.ControlName}.Unit"];
  1287. if (step.AUXSets.Where(x => x.Name == item.ControlName).Any())
  1288. {
  1289. AddNewAUX(step, item, displayName, auxUnit);
  1290. }
  1291. }
  1292. }
  1293. }
  1294. }
  1295. SetDelegateEvent(step);
  1296. return step;
  1297. }
  1298. }
  1299. public void SetDelegateEvent(Step step)
  1300. {
  1301. MFCSetsCollectionChanged(step);
  1302. TemperatureSetsCollectionChanged(step);
  1303. ValveSetsCollectionChanged(step);
  1304. AUXSetsCollectionChanged(step);
  1305. }
  1306. private void MFCSetsCollectionChanged(Step step)
  1307. {
  1308. foreach (var item in step.MFCSets)
  1309. {
  1310. item.PropertyChanged += step.MFCIsSaved_PropertyChanged;
  1311. item.ValueChangedEvent += step.Item_MFCValueChangedEvent;
  1312. }
  1313. }
  1314. private void TemperatureSetsCollectionChanged(Step step)
  1315. {
  1316. foreach (var item in step.TemperatureSets)
  1317. {
  1318. item.PropertyChanged += step.TemperatureIsSaved_PropertyChanged;
  1319. item.ValueChangedEvent += step.Item_TempValueChangedEvent;
  1320. }
  1321. }
  1322. private void ValveSetsCollectionChanged(Step step)
  1323. {
  1324. foreach (var item in step.ValveSets)
  1325. {
  1326. item.PropertyChanged += step.ValveIsSaved_PropertyChanged;
  1327. item.ValueChangedEvent += step.Item_ValveValueChangedEvent;
  1328. }
  1329. //step.ValveSets.CollectionChanged += (s, e) =>
  1330. //{
  1331. // if (e.OldItems != null)
  1332. // {
  1333. // foreach (BoolParam item in e.OldItems)
  1334. // {
  1335. // item.PropertyChanged -= step.ValveIsSaved_PropertyChanged;
  1336. // item.ValueChangedEvent -= step.Item_ValveValueChangedEvent;
  1337. // }
  1338. // }
  1339. // if (e.NewItems != null)
  1340. // {
  1341. // foreach (BoolParam item in e.NewItems)
  1342. // {
  1343. // item.PropertyChanged += step.ValveIsSaved_PropertyChanged;
  1344. // item.ValueChangedEvent += step.Item_ValveValueChangedEvent;
  1345. // }
  1346. // }
  1347. //};
  1348. }
  1349. private void AUXSetsCollectionChanged(Step step)
  1350. {
  1351. foreach (var item in step.AUXSets)
  1352. {
  1353. item.PropertyChanged += step.AUXIsSaved_PropertyChanged;
  1354. item.ValueChangedEvent += step.Item_AUXValueChangedEvent;
  1355. }
  1356. //step.AUXSets.CollectionChanged += (s, e) =>
  1357. //{
  1358. // if (e.OldItems != null)
  1359. // {
  1360. // foreach (AUXData item in e.OldItems)
  1361. // {
  1362. // item.PropertyChanged -= step.AUXIsSaved_PropertyChanged;
  1363. // item.ValueChangedEvent -= step.Item_AUXValueChangedEvent;
  1364. // }
  1365. // }
  1366. // if (e.NewItems != null)
  1367. // {
  1368. // foreach (AUXData item in e.NewItems)
  1369. // {
  1370. // item.PropertyChanged += step.AUXIsSaved_PropertyChanged;
  1371. // item.ValueChangedEvent += step.Item_AUXValueChangedEvent;
  1372. // }
  1373. // }
  1374. //};
  1375. }
  1376. private static void AddNewAUX(Step step, RecipeTemplateColumnBase item, string displayName, string auxUnit)
  1377. {
  1378. var tempAUX = new AUXData()
  1379. {
  1380. ControlName = item.ControlName,
  1381. DisplayName = displayName,
  1382. SetValue = new DoubleParam() { Name = "SetValue", Value = "0" },
  1383. SetUnit = new StringParam() { Name = "SetUnit", Value = auxUnit },
  1384. Rampng = new DoubleParam() { Name = "Rampng", Value = "0" },
  1385. RampngUnit = new StringParam() { Name = "RampngUnit", Value = "SLM" },
  1386. AlarmValue = "None",
  1387. IsCheck = new BoolParam() { Name = "IsCheck", Value = false },
  1388. MaxValue = new DoubleParam() { Name = "MaxValue", Value = "0" },
  1389. MinValue = new DoubleParam() { Name = "MinValue", Value = "0" },
  1390. Unit = auxUnit
  1391. };
  1392. step.AUXSets.Add(tempAUX);
  1393. }
  1394. public Step CreateStep(XmlNode stepNode = null)
  1395. {
  1396. Step step = new Step();
  1397. if (stepNode != null)
  1398. {
  1399. if (stepNode.Attributes["StepNo"] != null)
  1400. step.StepNo = int.Parse(stepNode.Attributes["StepNo"].Value);
  1401. if (stepNode.Attributes["Name"] != null)
  1402. step.Name = stepNode.Attributes["Name"].Value;
  1403. if (stepNode.Attributes["EndBy"] != null)
  1404. step.EndBy = stepNode.Attributes["EndBy"].Value;
  1405. if (stepNode.Attributes["Time"] != null)
  1406. {
  1407. if (stepNode.Attributes["Time"] != null)
  1408. {
  1409. var timeValue = stepNode.Attributes["Time"].Value;
  1410. if (!string.IsNullOrEmpty(timeValue) && !timeValue.Contains('.'))
  1411. {
  1412. timeValue = $"{timeValue}.0";
  1413. }
  1414. step.Time = timeValue;
  1415. }
  1416. }
  1417. if (stepNode.Attributes["SkipWait"] != null)
  1418. step.SkipWait = stepNode.Attributes["SkipWait"].Value;
  1419. else
  1420. step.SkipWait = "";
  1421. if (stepNode.Attributes["Command"] != null)
  1422. step.Command = stepNode.Attributes["Command"].Value;
  1423. AnalysisIsSaved(stepNode, step);
  1424. ReadConditionCheck(stepNode, step);
  1425. if (stepNode.Attributes["AbortRecipeTableIndex"] != null)
  1426. step.AbortRecipeTableIndex = stepNode.Attributes["AbortRecipeTableIndex"].Value;
  1427. if (RecipeTemplate != null && RecipeTemplate.ContainsKey("Valve"))
  1428. {
  1429. step.ValveSets.Clear();
  1430. foreach (var item in RecipeTemplate["Valve"])
  1431. {
  1432. if (stepNode.Attributes[item.ControlName] != null)
  1433. {
  1434. var valValue = stepNode.Attributes[item.ControlName].Value == "Open" ? true : false;
  1435. step.ValveSets.Add(new BoolParam() { Name = item.ControlName, Value = valValue });
  1436. }
  1437. else
  1438. {
  1439. if (valveDefaultOpen.Contains(item.ControlName))
  1440. {
  1441. step.ValveSets.Add(new BoolParam() { Name = item.ControlName, Value = true });
  1442. }
  1443. else
  1444. {
  1445. step.ValveSets.Add(new BoolParam() { Name = item.ControlName, Value = false });
  1446. }
  1447. }
  1448. }
  1449. }
  1450. if (RecipeTemplate != null && RecipeTemplate.ContainsKey("Temperature"))
  1451. {
  1452. step.TemperatureSets.Clear();
  1453. foreach (var item in RecipeTemplate["Temperature"])
  1454. {
  1455. FromXmlNodeGetTemperatureSets(stepNode, step, item);
  1456. }
  1457. }
  1458. if (RecipeTemplate != null && RecipeTemplate.ContainsKey("MFC"))
  1459. {
  1460. step.MFCSets.Clear();
  1461. foreach (var item in RecipeTemplate["MFC"])
  1462. {
  1463. if (stepNode.Attributes[$"{item.ControlName}.Set"] != null)
  1464. {
  1465. step.MFCSets.Add(StepNodeToMFCData(stepNode, item));
  1466. }
  1467. else
  1468. {
  1469. step.MFCSets.Add(GetNewMFCData(item.ControlName));
  1470. }
  1471. }
  1472. if (step.MFCSets != null && step.MFCSets.Count > 0)
  1473. {
  1474. for (int i = 0; i < step.MFCSets.Count; i++)
  1475. {
  1476. step.MFCSets[i].No = i + 1;
  1477. }
  1478. }
  1479. }
  1480. if (RecipeTemplate != null && RecipeTemplate.ContainsKey("MFM"))
  1481. {
  1482. step.MFMSets.Clear();
  1483. foreach (var item in RecipeTemplate["MFM"])
  1484. {
  1485. if (stepNode.Attributes[item.ControlName] != null)
  1486. {
  1487. var MFMListValues = stepNode.Attributes[item.ControlName].Value.Split(';');
  1488. step.MFMSets.Add(item.ControlName, new MFMValue() { Value = MFMListValues[0] });
  1489. if (MFMListValues.Length > 1 && RecipeTemplate != null && RecipeTemplate.ContainsKey("MFMAlarm"))
  1490. {
  1491. step.MFMSets[item.ControlName].AlarmValue = MFMListValues[1];
  1492. }
  1493. }
  1494. else
  1495. {
  1496. step.MFMSets.Add(item.ControlName, new MFMValue() { Value = "0", AlarmValue = "None" });
  1497. }
  1498. }
  1499. }
  1500. for (int i = 1; i < 7; i++)
  1501. {
  1502. if (stepNode.Attributes[$"External.Out{i}"] != null && stepNode.Attributes[$"External.Out{i}"].Value != "")
  1503. {
  1504. step.EXOUSets.Add($"External.Out{i}", bool.Parse(stepNode.Attributes[$"External.Out{i}"].Value));
  1505. }
  1506. else
  1507. {
  1508. step.EXOUSets.Add($"External.Out{i}", false);
  1509. }
  1510. }
  1511. if (stepNode.Attributes["AlarmConditionTable"] != null)
  1512. step.AlarmConditionTable = new StringParam() { Name = "AlarmConditionTable", Value = stepNode.Attributes["AlarmConditionTable"].Value };
  1513. if (stepNode.Attributes["Temperature.ControlMode"] != null)
  1514. step.TemperatureControlMode = new StringParam() { Name = "TemperatureControlMode", Value = stepNode.Attributes["Temperature.ControlMode"].Value };
  1515. else
  1516. step.TemperatureControlMode = new StringParam() { Name = "TemperatureControlMode", Value = "Heater" };
  1517. if (stepNode.Attributes["Temperature.Correct"] != null)
  1518. step.TemperatureCorrect = new StringParam() { Name = "TemperatureCorrect", Value = stepNode.Attributes["Temperature.Correct"].Value };
  1519. else
  1520. step.TemperatureCorrect = new StringParam() { Name = "TemperatureCorrect", Value = "1" };
  1521. if (stepNode.Attributes["Temperature.PID"] != null)
  1522. step.TemperaturePID = new StringParam() { Name = "TemperaturePID", Value = stepNode.Attributes["Temperature.PID"].Value };
  1523. else
  1524. step.TemperaturePID = new StringParam() { Name = "TemperaturePID", Value = "1" };
  1525. if (stepNode.Attributes["Loader.Command"] != null)
  1526. step.LoaderCommand = new StringParam() { Name = "LoaderCommand", Value = stepNode.Attributes["Loader.Command"].Value };
  1527. else
  1528. step.LoaderCommand = new StringParam() { Name = "LoaderCommand", Value = "None" };
  1529. if (stepNode.Attributes["Loader.Speed1"] != null)
  1530. {
  1531. step.LoaderSpeed1 = new DoubleParam() { Name = "LoaderSpeed1", Value = stepNode.Attributes["Loader.Speed1"].Value };
  1532. }
  1533. if (stepNode.Attributes["Loader.Speed2"] != null)
  1534. {
  1535. step.LoaderSpeed2 = new DoubleParam() { Name = "LoaderSpeed2", Value = stepNode.Attributes["Loader.Speed2"].Value };
  1536. }
  1537. if (stepNode.Attributes["Loader.Speed3"] != null)
  1538. {
  1539. step.LoaderSpeed3 = new DoubleParam() { Name = "LoaderSpeed3", Value = stepNode.Attributes["Loader.Speed3"].Value };
  1540. }
  1541. if (stepNode.Attributes["Loader.RPM"] != null)
  1542. {
  1543. step.LoaderRPM = new DoubleParam() { Name = "LoaderRPM", Value = stepNode.Attributes["Loader.RPM"].Value };
  1544. }
  1545. if (stepNode.Attributes["Press.Command"] != null)
  1546. step.PressCommand = new StringParam() { Name = "PressCommand", Value = stepNode.Attributes["Press.Command"].Value };
  1547. else
  1548. step.PressCommand = new StringParam() { Name = "PressCommand", Value = "None" };
  1549. if (stepNode.Attributes["Press.PID"] != null)
  1550. step.PressPID = new StringParam() { Name = "PressPID", Value = stepNode.Attributes["Press.PID"].Value };
  1551. if (stepNode.Attributes["Press.Set"] != null)
  1552. {
  1553. step.PressSet = new DoubleParam() { Name = "PressSet", Value = stepNode.Attributes["Press.Set"].Value };
  1554. }
  1555. if (stepNode.Attributes["Press.SlowVacSet"] != null)
  1556. {
  1557. step.PressSlowVacSet = new DoubleParam() { Name = "PressSet", Value = stepNode.Attributes["Press.SlowVacSet"].Value };
  1558. }
  1559. if (stepNode.Attributes["Press.ValveAngleSet"] != null)
  1560. step.PressValveAngleSet = new StringParam() { Name = "PressValveAngleSet", Value = stepNode.Attributes["Press.ValveAngleSet"].Value };
  1561. if (stepNode.Attributes["Press.IsWait"] != null)
  1562. {
  1563. bool.TryParse(stepNode.Attributes["Press.IsWait"].Value, out bool isWait);
  1564. step.PressIsWait = new BoolParam() { Name = "PressIsWait", Value = isWait };
  1565. }
  1566. if (stepNode.Attributes["Press.LowWait"] != null)
  1567. step.PressLowWait = new StringParam() { Name = "PressLowWait", Value = !string.IsNullOrEmpty(stepNode.Attributes["Press.LowWait"].Value) ? stepNode.Attributes["Press.LowWait"].Value : "0" };
  1568. if (stepNode.Attributes["Press.HighWait"] != null)
  1569. step.PressHighWait = new StringParam() { Name = "PressHighWait", Value = !string.IsNullOrEmpty(stepNode.Attributes["Press.HighWait"].Value) ? stepNode.Attributes["Press.HighWait"].Value : "0" };
  1570. if (stepNode.Attributes["Press.WaitUnit"] != null)
  1571. {
  1572. step.PressWaitUnit = new StringParam() { Name = "PressWaitUnit", Value = stepNode.Attributes["Press.WaitUnit"].Value };
  1573. }
  1574. if (stepNode.Attributes["Press.LowPressWait"] != null)
  1575. step.PressLowPressWait = new StringParam() { Name = "PressLowPressWait", Value = !string.IsNullOrEmpty(stepNode.Attributes["Press.LowPressWait"].Value) ? stepNode.Attributes["Press.LowPressWait"].Value : "None" };
  1576. if (stepNode.Attributes["Press.WaitPress"] != null)
  1577. step.WaitPress = new StringParam() { Name = "WaitPress", Value = !string.IsNullOrEmpty(stepNode.Attributes["Press.WaitPress"].Value) ? stepNode.Attributes["Press.WaitPress"].Value : "0" };
  1578. if (RecipeTemplate != null && RecipeTemplate.ContainsKey("AUX"))
  1579. {
  1580. step.AUXSets.Clear();
  1581. foreach (var item in RecipeTemplate["AUX"])
  1582. {
  1583. var displayName = (string)QueryDataClient.Instance.Service.GetConfig($"PM1.RecipeEditParameter.AUX.{item.ControlName}.Display");
  1584. var auxUnit = (string)QueryDataClient.Instance.Service.GetConfig($"PM1.RecipeEditParameter.AUX.{item.ControlName}.Unit");
  1585. if (stepNode.Attributes[$"AUX.{item.ControlName}.Set"] != null)
  1586. {
  1587. AUXData aUXData = new AUXData();
  1588. aUXData.ControlName = item.ControlName;
  1589. aUXData.DisplayName = displayName;
  1590. aUXData.Unit = auxUnit;
  1591. float setValue = 0;
  1592. if (stepNode.Attributes[$"AUX.{item.ControlName}.Set"] != null)
  1593. {
  1594. float.TryParse(stepNode.Attributes[$"AUX.{item.ControlName}.Set"].Value, out setValue);
  1595. }
  1596. aUXData.SetValue = new DoubleParam() { Name = "SetValue", Value = setValue.ToString() };
  1597. aUXData.IsCheck = new BoolParam() { Name = "IsCheck", Value = stepNode.Attributes[$"AUX.{item.ControlName}.Check"] != null ? bool.Parse(stepNode.Attributes[$"AUX.{item.ControlName}.Check"].Value) : false };
  1598. float maxValue = 0;
  1599. if (stepNode.Attributes[$"AUX.{item.ControlName}.High"] != null)
  1600. {
  1601. float.TryParse(stepNode.Attributes[$"AUX.{item.ControlName}.High"].Value, out maxValue);
  1602. }
  1603. aUXData.MaxValue = new DoubleParam() { Name = "MaxValue", Value = maxValue.ToString() };
  1604. float minValue = 0;
  1605. if (stepNode.Attributes[$"AUX.{item.ControlName}.Low"] != null)
  1606. {
  1607. float.TryParse(stepNode.Attributes[$"AUX.{item.ControlName}.Low"].Value, out minValue);
  1608. }
  1609. aUXData.MinValue = new DoubleParam() { Name = "MinValue", Value = minValue.ToString() };
  1610. aUXData.SetUnit = new StringParam() { Name = "SetUnit", Value = stepNode.Attributes[$"AUX.{item.ControlName}.CheckUnit"] != null ? stepNode.Attributes[$"AUX.{item.ControlName}.CheckUnit"].Value : "℃" };
  1611. step.AUXSets.Add(aUXData);
  1612. }
  1613. else
  1614. {
  1615. AddNewAUX(step, item, displayName, auxUnit);
  1616. }
  1617. }
  1618. }
  1619. if (stepNode.Attributes["AbortRecipeTableIndex"] != null)
  1620. step.AbortRecipeTableIndex = stepNode.Attributes["AbortRecipeTableIndex"].Value;
  1621. else
  1622. step.AbortRecipeTableIndex = "None";
  1623. for (int i = 1; i < 11; i++)
  1624. {
  1625. string tempType = "";
  1626. string tempDetails = "";
  1627. if (stepNode.Attributes[$"AlarmAction.{i}"] != null && stepNode.Attributes[$"AlarmAction.{i}"].Value != "")
  1628. {
  1629. tempType = stepNode.Attributes[$"AlarmAction.{i}"].Value;
  1630. }
  1631. else
  1632. {
  1633. tempType = "Ignore Alarm";
  1634. }
  1635. if (stepNode.Attributes[$"AlarmDetails.{i}"] != null)
  1636. tempDetails = stepNode.Attributes[$"AlarmDetails.{i}"].Value;
  1637. step.AlarmActionSets.Add(i, new AlarmAction()
  1638. {
  1639. PtocessingType = tempType,
  1640. PtocessingDetails = tempDetails
  1641. });
  1642. }
  1643. if (stepNode.Attributes["FilmThickFormula"] != null)
  1644. step.FilmThickFormula = stepNode.Attributes["FilmThickFormula"].Value;
  1645. }
  1646. else
  1647. {
  1648. step.StepNo = StepNo;
  1649. step.Name = "Name" + StepNo.ToString();
  1650. step.EndBy = "EndByStepTime";
  1651. step.Time = null;
  1652. step.SkipWait = "";
  1653. step.Command = "NoControl";
  1654. step.IsnoneConditionCheck = true;
  1655. step.AlarmConditionTable = new StringParam() { Name = "AlarmConditionTable", Value = "1:" };
  1656. if (RecipeTemplate != null && RecipeTemplate.ContainsKey("Valve"))
  1657. {
  1658. step.ValveSets.Clear();
  1659. foreach (var item in RecipeTemplate["Valve"])
  1660. {
  1661. if (valveDefaultOpen.Contains(item.ControlName))
  1662. {
  1663. step.ValveSets.Add(new BoolParam() { Name = item.ControlName, Value = true });
  1664. }
  1665. else
  1666. {
  1667. step.ValveSets.Add(new BoolParam() { Name = item.ControlName, Value = false });
  1668. }
  1669. }
  1670. }
  1671. if (RecipeTemplate != null && RecipeTemplate.ContainsKey("Temperature"))
  1672. {
  1673. step.TemperatureSets.Clear();
  1674. foreach (var item in RecipeTemplate["Temperature"])
  1675. {
  1676. var configHeater = (string)QueryDataClient.Instance.Service.GetConfig($"PM1.Heater.{item.ControlName}.DisplayName");
  1677. var tempSetData = new TempSetData(configHeater);
  1678. tempSetData.Name = item.ControlName;
  1679. tempSetData.DisplayName = configHeater;
  1680. step.TemperatureSets.Add(tempSetData);
  1681. }
  1682. }
  1683. if (RecipeTemplate != null && RecipeTemplate.ContainsKey("MFC"))
  1684. {
  1685. step.MFCSets.Clear();
  1686. foreach (var item in RecipeTemplate["MFC"])
  1687. {
  1688. step.MFCSets.Add(GetNewMFCData(item.ControlName)); ;
  1689. }
  1690. if (step.MFCSets != null && step.MFCSets.Count > 0)
  1691. {
  1692. for (int i = 0; i < step.MFCSets.Count; i++)
  1693. {
  1694. step.MFCSets[i].No = i + 1;
  1695. }
  1696. }
  1697. }
  1698. if (RecipeTemplate != null && RecipeTemplate.ContainsKey("MFM"))
  1699. {
  1700. step.MFMSets.Clear();
  1701. foreach (var item in RecipeTemplate["MFM"])
  1702. {
  1703. step.MFMSets.Add(item.ControlName, new MFMValue() { Value = "0", AlarmValue = "None" }); ;
  1704. }
  1705. }
  1706. step.TemperatureControlMode = new StringParam() { Name = "TemperatureControlMode", Value = "Heater" };
  1707. step.TemperatureCorrect = new StringParam() { Name = "TemperatureCorrect", Value = "" };
  1708. step.TemperaturePID = new StringParam() { Name = "TemperaturePID", Value = "" };
  1709. step.LoaderCommand = new StringParam() { Name = "Loader", Value = "None" };
  1710. step.PressCommand = new StringParam() { Name = "PressCommand", Value = "None" };
  1711. step.FilmThickFormula = "";
  1712. step.AbortRecipeTableIndex = "None";
  1713. step.FinishAutoProfile = "None";
  1714. step.ReachPressure = "None";
  1715. step.ReachTemp = "None";
  1716. step.O2Density = "None";
  1717. step.TempStabilizeSelected = "None";
  1718. step.PressureStabilizeSelected = "None";
  1719. step.ProcessTimeToEnd = "None";
  1720. if (RecipeTemplate != null && RecipeTemplate.ContainsKey("AUX"))
  1721. {
  1722. step.AUXSets.Clear();
  1723. foreach (var item in RecipeTemplate["AUX"])
  1724. {
  1725. var displayName = (string)QueryDataClient.Instance.Service.GetConfig($"PM1.RecipeEditParameter.AUX.{item.ControlName}.Display");
  1726. var auxUnit = (string)QueryDataClient.Instance.Service.GetConfig($"PM1.RecipeEditParameter.AUX.{item.ControlName}.Unit");
  1727. AddNewAUX(step, item, displayName, auxUnit);
  1728. // step.AUXSets.Add(item.ControlName, new AUXData() { ControlName = item.ControlName, DisplayName = displayName, SetValue = 0, SetUnit = auxUnit, Rampng = 0, RampngUnit = "SLM", AlarmValue = "None", IsCheck = false, MaxValue = 0, MinValue = 0, Unit = auxUnit });
  1729. }
  1730. }
  1731. StepNo++;
  1732. }
  1733. return step;
  1734. }
  1735. private static void AnalysisIsSaved(XmlNode stepNode, Step step)
  1736. {
  1737. if (stepNode.Attributes["AlarmIsSaved"] != null)
  1738. {
  1739. bool isSaved = true;
  1740. bool.TryParse(stepNode.Attributes["AlarmIsSaved"].Value, out isSaved);
  1741. step.AlarmIsSaved = isSaved;
  1742. }
  1743. else
  1744. {
  1745. step.AlarmIsSaved = true;
  1746. }
  1747. if (stepNode.Attributes["MFCIsSaved"] != null)
  1748. {
  1749. bool isSaved = true;
  1750. bool.TryParse(stepNode.Attributes["MFCIsSaved"].Value, out isSaved);
  1751. step.MFCIsSaved = isSaved;
  1752. }
  1753. else
  1754. {
  1755. step.MFCIsSaved = true;
  1756. }
  1757. if (stepNode.Attributes["ValveIsSaved"] != null)
  1758. {
  1759. bool isSaved = true;
  1760. bool.TryParse(stepNode.Attributes["ValveIsSaved"].Value, out isSaved);
  1761. step.ValveIsSaved = isSaved;
  1762. }
  1763. else
  1764. {
  1765. step.ValveIsSaved = true;
  1766. }
  1767. if (stepNode.Attributes["PressIsSaved"] != null)
  1768. {
  1769. bool isSaved = true;
  1770. bool.TryParse(stepNode.Attributes["PressIsSaved"].Value, out isSaved);
  1771. step.PressIsSaved = isSaved;
  1772. }
  1773. else
  1774. {
  1775. step.PressIsSaved = true;
  1776. }
  1777. if (stepNode.Attributes["AUXIsSaved"] != null)
  1778. {
  1779. bool isSaved = true;
  1780. bool.TryParse(stepNode.Attributes["AUXIsSaved"].Value, out isSaved);
  1781. step.AUXIsSaved = isSaved;
  1782. }
  1783. else
  1784. {
  1785. step.AUXIsSaved = true;
  1786. }
  1787. if (stepNode.Attributes["TemperatureIsSaved"] != null)
  1788. {
  1789. bool isSaved = true;
  1790. bool.TryParse(stepNode.Attributes["TemperatureIsSaved"].Value, out isSaved);
  1791. step.TemperatureIsSaved = isSaved;
  1792. }
  1793. else
  1794. {
  1795. step.TemperatureIsSaved = true;
  1796. }
  1797. }
  1798. private static void FromXmlNodeGetTemperatureSets(XmlNode stepNode, Step step, RecipeTemplateColumnBase item)
  1799. {
  1800. var configHeater = (string)QueryDataClient.Instance.Service.GetConfig($"PM1.Heater.{item.ControlName}.DisplayName");
  1801. TempSetData tempSetData = new TempSetData();
  1802. tempSetData.Name = item.ControlName;
  1803. tempSetData.DisplayName = configHeater != null ? configHeater : item.ControlName;
  1804. tempSetData.SetValue = new StringParam() { Name = "SetValue", Value = stepNode.Attributes[$"{item.ControlName}.Set"] != null ? stepNode.Attributes[$"{item.ControlName}.Set"].Value : "0" };
  1805. tempSetData.SetUnit = new StringParam() { Name = "SetUnit", Value = stepNode.Attributes[$"{item.ControlName}.SetUnit"] != null ? stepNode.Attributes[$"{item.ControlName}.SetUnit"].Value : "℃" };
  1806. tempSetData.RampngValue = new DoubleParam() { Name = "RampngValue", Value = stepNode.Attributes[$"{item.ControlName}.Ramprate"] != null ? stepNode.Attributes[$"{item.ControlName}.Ramprate"].Value : "0" };
  1807. tempSetData.RampngUnit = new StringParam() { Name = "RampngUnit", Value = stepNode.Attributes[$"{item.ControlName}.RamprateUnit"] != null ? stepNode.Attributes[$"{item.ControlName}.RamprateUnit"].Value : "℃/min" };
  1808. bool tempCheck = false;
  1809. if (stepNode.Attributes[$"{item.ControlName}.Check"] != null) bool.TryParse(stepNode.Attributes[$"{item.ControlName}.Check"].Value, out tempCheck);
  1810. tempSetData.IsCheck = new BoolParam() { Name = "IsCheck", Value = tempCheck };
  1811. double tempHigh = 0;
  1812. if (stepNode.Attributes[$"{item.ControlName}.High"] != null) double.TryParse(stepNode.Attributes[$"{item.ControlName}.High"].Value, out tempHigh);
  1813. tempSetData.HighValue = new DoubleParam() { Name = "HighValue", Value = tempHigh.ToString() };
  1814. double tempLow = 0;
  1815. if (stepNode.Attributes[$"{item.ControlName}.Low"] != null) double.TryParse(stepNode.Attributes[$"{item.ControlName}.Low"].Value, out tempLow);
  1816. tempSetData.LowValue = new DoubleParam() { Name = "LowValue", Value = tempLow.ToString() };
  1817. tempSetData.Unit = stepNode.Attributes[$"{item.ControlName}.Unit"] != null ? stepNode.Attributes[$"{item.ControlName}.Unit"].Value : "0";
  1818. if (!step.TemperatureSets.Where(x => x.Name == item.ControlName).Any())
  1819. {
  1820. step.TemperatureSets.Add(tempSetData);
  1821. }
  1822. else
  1823. {
  1824. var tempTemperatureSets = step.TemperatureSets.FirstOrDefault(x => x.Name == item.ControlName);
  1825. int getIndex = step.TemperatureSets.IndexOf(tempTemperatureSets);
  1826. step.TemperatureSets.Remove(tempTemperatureSets);
  1827. step.TemperatureSets.Insert(getIndex, tempSetData);
  1828. }
  1829. }
  1830. private static MFCData StepNodeToMFCData(XmlNode stepNode, RecipeTemplateColumnBase item)
  1831. {
  1832. MFCData mFCValue = new MFCData();
  1833. mFCValue.ControlName = item.ControlName.Replace(".Flow", "");
  1834. if (stepNode.Attributes[$"{item.ControlName}.IsSaved"] != null)
  1835. {
  1836. bool isSaved = true;
  1837. bool.TryParse(stepNode.Attributes[$"{item.ControlName}.IsSaved"].Value, out isSaved);
  1838. mFCValue.FlagIsSaved = isSaved;
  1839. }
  1840. else
  1841. {
  1842. mFCValue.FlagIsSaved = true;
  1843. }
  1844. var setValue = stepNode.Attributes[$"{item.ControlName}.Set"] != null ? stepNode.Attributes[$"{item.ControlName}.Set"].Value : "0";
  1845. mFCValue.SetValue = new StringParam() { Name = "SetValue", Value = setValue };
  1846. var strSetUnit = stepNode.Attributes[$"{item.ControlName}.SetUnit"] != null ? stepNode.Attributes[$"{item.ControlName}.SetUnit"].Value : "SLM";
  1847. mFCValue.SetUnit = new StringParam() { Name = "SetUnit", Value = strSetUnit };
  1848. var rampngValue = stepNode.Attributes[$"{item.ControlName}.Ramprate"] != null ? stepNode.Attributes[$"{item.ControlName}.Ramprate"].Value : "0";
  1849. mFCValue.Rampng = new DoubleParam() { Name = "Rampng", Value = rampngValue };
  1850. var strRampngUnit = stepNode.Attributes[$"{item.ControlName}.RamprateUnit"] != null ? stepNode.Attributes[$"{item.ControlName}.RamprateUnit"].Value : "SLM";
  1851. mFCValue.RampngUnit = new StringParam() { Name = "RampngUnit", Value = strRampngUnit };
  1852. var boolIsCheck = stepNode.Attributes[$"{item.ControlName}.Check"] != null ? bool.Parse(stepNode.Attributes[$"{item.ControlName}.Check"].Value) : false;
  1853. mFCValue.IsCheck = new BoolParam() { Name = "IsCheck", Value = boolIsCheck };
  1854. double maxValue = 0;
  1855. if (stepNode.Attributes[$"{item.ControlName}.High"] != null && !string.IsNullOrEmpty(stepNode.Attributes[$"{item.ControlName}.High"].Value))
  1856. double.TryParse(stepNode.Attributes[$"{item.ControlName}.High"].Value, out maxValue);
  1857. mFCValue.MaxValue = new DoubleParam() { Name = "MaxValue", Value = maxValue.ToString("F3") };
  1858. double minValue = 0;
  1859. if (stepNode.Attributes[$"{item.ControlName}.Low"] != null && !string.IsNullOrEmpty(stepNode.Attributes[$"{item.ControlName}.Low"].Value))
  1860. double.TryParse(stepNode.Attributes[$"{item.ControlName}.High"].Value, out minValue);
  1861. mFCValue.MinValue = new DoubleParam() { Name = "MinValue", Value = minValue.ToString("F3") };
  1862. mFCValue.Unit = stepNode.Attributes[$"{item.ControlName}.Unit"] != null ? stepNode.Attributes[$"{item.ControlName}.Unit"].Value : "SLM";
  1863. mFCValue.ScaleValue = SystemConfigProvider.Instance.GetValueByName($"PM1.MFC.{item.ModuleName}.N2Scale");
  1864. return mFCValue;
  1865. }
  1866. public Step CreateStandbyStep()
  1867. {
  1868. Step step = new Step();
  1869. step.StepNo = 0;
  1870. step.Name = "Standby";
  1871. step.EndBy = "EndByStepTime";
  1872. step.Time = null;
  1873. step.SkipWait = "";
  1874. step.Command = "NoControl";
  1875. //step.ZAxisPosition = "None";
  1876. step.AbortRecipeTableIndex = "None";
  1877. //step.ZAxisSpeed = "0";
  1878. //step.RotatePosition = "None";
  1879. //step.RotateDirection = "CW";
  1880. //step.RotateSpeed = "0";
  1881. //step.RotateInterval = "0";
  1882. //step.APC_SetPressure = "0";
  1883. step.IsnoneConditionCheck = true;
  1884. step.AlarmConditionTable = new StringParam() { Name = "AlarmConditionTable", Value = "1:" };
  1885. //step.MfmD1Flow = new MFMValue() { Value = "0", AlarmValue = "None" };
  1886. if (RecipeTemplate != null && RecipeTemplate.ContainsKey("Valve"))
  1887. {
  1888. step.ValveSets.Clear();
  1889. foreach (var item in RecipeTemplate["Valve"])
  1890. {
  1891. if (valveDefaultOpen.Contains(item.ControlName))
  1892. {
  1893. step.ValveSets.Add(new BoolParam() { Name = item.ControlName, Value = true });
  1894. }
  1895. else
  1896. {
  1897. step.ValveSets.Add(new BoolParam() { Name = item.ControlName, Value = false });
  1898. }
  1899. }
  1900. }
  1901. if (RecipeTemplate != null && RecipeTemplate.ContainsKey("Temperature"))
  1902. {
  1903. step.TemperatureSets.Clear();
  1904. foreach (var item in RecipeTemplate["Temperature"])
  1905. {
  1906. var configHeater = (string)QueryDataClient.Instance.Service.GetConfig($"PM1.Heater.{item.ControlName}.DisplayName");
  1907. var tempSet = new TempSetData(configHeater);
  1908. tempSet.Name = item.ControlName;
  1909. step.TemperatureSets.Add(tempSet);
  1910. }
  1911. }
  1912. if (RecipeTemplate != null && RecipeTemplate.ContainsKey("MFC"))
  1913. {
  1914. step.MFCSets.Clear();
  1915. foreach (var item in RecipeTemplate["MFC"])
  1916. {
  1917. step.MFCSets.Add(GetNewMFCData(item.ControlName)); ;
  1918. }
  1919. if (step.MFCSets != null && step.MFCSets.Count > 0)
  1920. {
  1921. for (int i = 0; i < step.MFCSets.Count; i++)
  1922. {
  1923. step.MFCSets[i].No = i + 1;
  1924. }
  1925. }
  1926. }
  1927. if (RecipeTemplate != null && RecipeTemplate.ContainsKey("MFM"))
  1928. {
  1929. step.MFMSets.Clear();
  1930. foreach (var item in RecipeTemplate["MFM"])
  1931. {
  1932. step.MFMSets.Add(item.ControlName, new MFMValue() { Value = "0", AlarmValue = "0" }); ;
  1933. }
  1934. }
  1935. step.TemperatureControlMode = new StringParam() { Name = "TemperatureControlMode", Value = "Heater" };
  1936. step.TemperatureCorrect = new StringParam() { Name = "TemperatureCorrect", Value = "" };
  1937. step.TemperaturePID = new StringParam() { Name = "TemperaturePID", Value = "" };
  1938. step.LoaderCommand = new StringParam() { Name = "LoaderCommand", Value = "None" };
  1939. step.PressCommand = new StringParam() { Name = "PressCommand", Value = "None" };
  1940. //step.TemperatureProfile = "None";
  1941. //step.TemperatureAlarm = "None";
  1942. //step.CAPTemperatureAlarm = "None";
  1943. //step.TemperatureStabilize = "None";
  1944. step.FilmThickFormula = "None";
  1945. //隐藏StandBy行
  1946. //step.IsVisibility = Visibility.Collapsed;
  1947. return step;
  1948. }
  1949. public Step CreateFirstStep()
  1950. {
  1951. Step step = new Step();
  1952. step.StepNo = 1;
  1953. step.Name = "Name";
  1954. step.EndBy = "EndByStepTime";
  1955. step.Time = null;
  1956. step.SkipWait = "";
  1957. step.Command = "NoControl";
  1958. //step.ZAxisPosition = "None";
  1959. step.AbortRecipeTableIndex = "None";
  1960. //step.ZAxisSpeed = "0";
  1961. //step.RotatePosition = "None";
  1962. //step.RotateDirection = "CW";
  1963. //step.RotateSpeed = "0";
  1964. //step.RotateInterval = "0";
  1965. //step.APC_SetPressure = "0";
  1966. step.IsnoneConditionCheck = true;
  1967. step.AlarmConditionTable = new StringParam() { Name = "AlarmConditionTable", Value = "1:" };
  1968. //step.MfmD1Flow = new MFMValue() { Value = "0", AlarmValue = "None" };
  1969. if (RecipeTemplate != null && RecipeTemplate.ContainsKey("Valve"))
  1970. {
  1971. step.ValveSets.Clear();
  1972. foreach (var item in RecipeTemplate["Valve"])
  1973. {
  1974. if (valveDefaultOpen.Contains(item.ControlName))
  1975. {
  1976. step.ValveSets.Add(new BoolParam() { Name = item.ControlName, Value = true });
  1977. }
  1978. else
  1979. {
  1980. step.ValveSets.Add(new BoolParam() { Name = item.ControlName, Value = false });
  1981. }
  1982. }
  1983. }
  1984. if (RecipeTemplate != null && RecipeTemplate.ContainsKey("Temperature"))
  1985. {
  1986. step.TemperatureSets.Clear();
  1987. foreach (var item in RecipeTemplate["Temperature"])
  1988. {
  1989. var configHeater = (string)QueryDataClient.Instance.Service.GetConfig($"PM1.Heater.{item.ControlName}.DisplayName");
  1990. var tempSet = new TempSetData(configHeater);
  1991. tempSet.Name = item.ControlName;
  1992. step.TemperatureSets.Add(tempSet);
  1993. }
  1994. }
  1995. if (RecipeTemplate != null && RecipeTemplate.ContainsKey("MFC"))
  1996. {
  1997. step.MFCSets.Clear();
  1998. foreach (var item in RecipeTemplate["MFC"])
  1999. {
  2000. step.MFCSets.Add(GetNewMFCData(item.ControlName));
  2001. }
  2002. if (step.MFCSets != null && step.MFCSets.Count > 0)
  2003. {
  2004. for (int i = 0; i < step.MFCSets.Count; i++)
  2005. {
  2006. step.MFCSets[i].No = i + 1;
  2007. }
  2008. }
  2009. }
  2010. if (RecipeTemplate != null && RecipeTemplate.ContainsKey("MFM"))
  2011. {
  2012. step.MFMSets.Clear();
  2013. foreach (var item in RecipeTemplate["MFM"])
  2014. {
  2015. step.MFMSets.Add(item.ControlName, new MFMValue() { Value = "0", AlarmValue = "0" }); ;
  2016. }
  2017. }
  2018. step.TemperatureControlMode = new StringParam() { Name = "TemperatureControlMode", Value = "Heater" };
  2019. step.TemperatureCorrect = new StringParam() { Name = "TemperatureCorrect", Value = "" };
  2020. step.TemperaturePID = new StringParam() { Name = "TemperaturePID", Value = "" };
  2021. step.LoaderCommand = new StringParam() { Name = "LoaderCommand", Value = "None" };
  2022. step.PressCommand = new StringParam() { Name = "PressCommand", Value = "None" };
  2023. //step.TemperatureProfile = "None";
  2024. //step.TemperatureAlarm = "None";
  2025. //step.CAPTemperatureAlarm = "None";
  2026. //step.TemperatureStabilize = "None";
  2027. step.FilmThickFormula = "None";
  2028. //隐藏StandBy行
  2029. //step.IsVisibility = Visibility.Collapsed;
  2030. return step;
  2031. }
  2032. public Step CreateEndStep()
  2033. {
  2034. Step step = new Step();
  2035. step.StepNo = 2;
  2036. step.Name = "End";
  2037. step.EndBy = "EndByStepTime";
  2038. step.Time = null;
  2039. step.SkipWait = "";
  2040. step.Command = "NoControl";
  2041. //step.ZAxisPosition = "None";
  2042. step.AbortRecipeTableIndex = "None";
  2043. //step.ZAxisSpeed = "0";
  2044. //step.RotatePosition = "None";
  2045. //step.RotateDirection = "CW";
  2046. //step.RotateSpeed = "0";
  2047. //step.RotateInterval = "0";
  2048. //step.APC_SetPressure = "0";
  2049. step.IsnoneConditionCheck = true;
  2050. step.AlarmConditionTable = new StringParam() { Name = "AlarmConditionTable", Value = "1:" };
  2051. //step.MfmD1Flow = new MFMValue() { Value = "0", AlarmValue = "None" };
  2052. if (RecipeTemplate != null && RecipeTemplate.ContainsKey("Valve"))
  2053. {
  2054. step.ValveSets.Clear();
  2055. foreach (var item in RecipeTemplate["Valve"])
  2056. {
  2057. if (valveDefaultOpen.Contains(item.ControlName))
  2058. {
  2059. step.ValveSets.Add(new BoolParam() { Name = item.ControlName, Value = true });
  2060. }
  2061. else
  2062. {
  2063. step.ValveSets.Add(new BoolParam() { Name = item.ControlName, Value = false });
  2064. }
  2065. }
  2066. }
  2067. if (RecipeTemplate != null && RecipeTemplate.ContainsKey("Temperature"))
  2068. {
  2069. step.TemperatureSets.Clear();
  2070. foreach (var item in RecipeTemplate["Temperature"])
  2071. {
  2072. var configHeater = (string)QueryDataClient.Instance.Service.GetConfig($"PM1.Heater.{item.ControlName}.DisplayName");
  2073. var tempSet = new TempSetData(configHeater);
  2074. tempSet.Name = item.ControlName;
  2075. step.TemperatureSets.Add(tempSet);
  2076. }
  2077. }
  2078. if (RecipeTemplate != null && RecipeTemplate.ContainsKey("MFC"))
  2079. {
  2080. step.MFCSets.Clear();
  2081. foreach (var item in RecipeTemplate["MFC"])
  2082. {
  2083. step.MFCSets.Add(GetNewMFCData(item.ControlName)); ;
  2084. }
  2085. if (step.MFCSets != null && step.MFCSets.Count > 0)
  2086. {
  2087. for (int i = 0; i < step.MFCSets.Count; i++)
  2088. {
  2089. step.MFCSets[i].No = i + 1;
  2090. }
  2091. }
  2092. }
  2093. if (RecipeTemplate != null && RecipeTemplate.ContainsKey("MFM"))
  2094. {
  2095. step.MFMSets.Clear();
  2096. foreach (var item in RecipeTemplate["MFM"])
  2097. {
  2098. step.MFMSets.Add(item.ControlName, new MFMValue() { Value = "0", AlarmValue = "0" }); ;
  2099. }
  2100. }
  2101. step.TemperatureControlMode = new StringParam() { Name = "TemperatureControlMode", Value = "Heater" };
  2102. step.TemperatureCorrect = new StringParam() { Name = "TemperatureCorrect", Value = "" };
  2103. step.TemperaturePID = new StringParam() { Name = "TemperaturePID", Value = "" };
  2104. step.LoaderCommand = new StringParam() { Name = "LoaderCommand", Value = "None" };
  2105. step.PressCommand = new StringParam() { Name = "PressCommand", Value = "None" };
  2106. //step.TemperatureProfile = "None";
  2107. //step.TemperatureAlarm = "None";
  2108. //step.CAPTemperatureAlarm = "None";
  2109. //step.TemperatureStabilize = "None";
  2110. step.FilmThickFormula = "None";
  2111. //隐藏StandBy行
  2112. //step.IsVisibility = Visibility.Collapsed;
  2113. return step;
  2114. }
  2115. private static void ReadConditionCheck(XmlNode stepNode, Step step)
  2116. {
  2117. if (stepNode.Attributes["ConditionCheck"] != null)
  2118. {
  2119. var conditionCheckValue = stepNode.Attributes["ConditionCheck"].Value;
  2120. if (conditionCheckValue != "none")
  2121. {
  2122. var subValues = conditionCheckValue.Split(';');
  2123. if (subValues.Count() == 0) return;
  2124. foreach (var item in subValues)
  2125. {
  2126. var itemValues = item.Split(':');
  2127. switch (itemValues[0])
  2128. {
  2129. case "ExternalSensor":
  2130. //step.ExternalSensor = itemValues[1].Split(',').ToArray();
  2131. var externalSensor = itemValues[1].Split(',').ToArray();
  2132. for (int i = 0; i < externalSensor.Count(); i++)
  2133. {
  2134. step.ExternalSensorName[i] = externalSensor[i].Split('.')[0];
  2135. step.ExternalSensor[i] = externalSensor[i].Split('.')[1];
  2136. }
  2137. break;
  2138. case "TempStabilize":
  2139. step.TempStabilizeSelected = itemValues[1];
  2140. break;
  2141. case "FinishAutoProfile":
  2142. step.FinishAutoProfile = itemValues[1];
  2143. break;
  2144. //case "TempUpper":
  2145. // step.TempUpper = int.Parse(itemValues[1]);
  2146. // break;
  2147. //case "TempLower":
  2148. // step.TempLower = int.Parse(itemValues[1]);
  2149. // break;
  2150. case "ReachTemp":
  2151. var reachTemp = itemValues[1];
  2152. if (reachTemp == "None")
  2153. {
  2154. step.ReachTemp = reachTemp;
  2155. step.ReachTempValue = 0;
  2156. }
  2157. else
  2158. {
  2159. step.ReachTemp = itemValues[1].Split(',')[0];
  2160. step.ReachTempValue = double.Parse(itemValues[1].Split(',')[1]);
  2161. }
  2162. break;
  2163. case "O2Density":
  2164. var o2Density = itemValues[1];
  2165. if (o2Density == "None")
  2166. {
  2167. step.O2Density = o2Density;
  2168. step.O2DensityValue = 0;
  2169. }
  2170. else
  2171. {
  2172. step.O2Density = itemValues[1].Split(',')[0];
  2173. step.O2DensityValue = int.Parse(itemValues[1].Split(',')[1]);
  2174. }
  2175. break;
  2176. //case "PressureUpper":
  2177. // step.PressureUpper = double.Parse(itemValues[1]);
  2178. // break;
  2179. //case "PressureLower":
  2180. // step.PressureLower = double.Parse(itemValues[1]);
  2181. // break;
  2182. case "ReachPressure":
  2183. var reachPressure = itemValues[1];
  2184. if (reachPressure == "None")
  2185. {
  2186. step.ReachPressure = reachPressure;
  2187. step.ReachPressureVG = reachPressure;
  2188. step.ReachPressureValue = 0;
  2189. }
  2190. else
  2191. {
  2192. step.ReachPressure = itemValues[1].Split(',')[0];
  2193. if (itemValues[1].Split(',').Length > 2)
  2194. {
  2195. step.ReachPressureVG = itemValues[1].Split(',')[1];
  2196. step.ReachPressureValue = double.Parse(itemValues[1].Split(',')[2]);
  2197. }
  2198. else
  2199. step.ReachPressureValue = double.Parse(itemValues[1].Split(',')[1]);
  2200. }
  2201. break;
  2202. case "PressureStabilize":
  2203. if (itemValues[1].Split(',').Length > 1)
  2204. {
  2205. step.PressureStabilizeSelected = itemValues[1].Split(',')[0];
  2206. step.PressureStabilizeVG = itemValues[1].Split(',')[1];
  2207. }
  2208. else
  2209. step.PressureStabilizeSelected = itemValues[1].Split(',')[0];
  2210. break;
  2211. case "ProcessTimeToEnd":
  2212. step.ProcessTimeToEnd = itemValues[1];
  2213. break;
  2214. default:
  2215. break;
  2216. }
  2217. }
  2218. }
  2219. else
  2220. {
  2221. step.IsnoneConditionCheck = true;
  2222. }
  2223. if (step.ExternalSensor == null || step.ExternalSensor.Count() == 0)
  2224. {
  2225. step.ExternalSensor = new string[] { "None", "None", "None", "None", "None", "None", "None" };
  2226. }
  2227. if (step.TempStabilizeSelected == null)
  2228. step.TempStabilizeSelected = "None";
  2229. if (step.FinishAutoProfile == null)
  2230. step.FinishAutoProfile = "None";
  2231. if (step.ReachTemp == null)
  2232. step.ReachTemp = "None";
  2233. if (step.O2Density == null)
  2234. step.O2Density = "None";
  2235. if (step.ReachPressure == null)
  2236. step.ReachPressure = "None";
  2237. if (step.PressureStabilizeSelected == null)
  2238. step.PressureStabilizeSelected = "None";
  2239. if (step.ProcessTimeToEnd == null)
  2240. step.ProcessTimeToEnd = "None";
  2241. }
  2242. }
  2243. public bool CreateStepTolerance(XmlNode stepNode, out ObservableCollection<Param> step, out ObservableCollection<Param> warning, out ObservableCollection<Param> alarm,
  2244. out Dictionary<string, ObservableCollection<Param>> popSettingStep)
  2245. {
  2246. step = new ObservableCollection<Param>();
  2247. warning = new ObservableCollection<Param>();
  2248. alarm = new ObservableCollection<Param>();
  2249. popSettingStep = new Dictionary<string, ObservableCollection<Param>>();
  2250. return true;
  2251. }
  2252. private bool LoadHeader(XmlNode nodeHeader)
  2253. {
  2254. if (nodeHeader == null)
  2255. return false;
  2256. if (nodeHeader.Attributes["CreatedBy"] != null)
  2257. this.Creator = nodeHeader.Attributes["CreatedBy"].Value;
  2258. if (nodeHeader.Attributes["CreationTime"] != null)
  2259. this.CreateTime = DateTime.Parse(nodeHeader.Attributes["CreationTime"].Value);
  2260. if (nodeHeader.Attributes["LastRevisedBy"] != null)
  2261. this.Revisor = nodeHeader.Attributes["LastRevisedBy"].Value;
  2262. if (nodeHeader.Attributes["LastRevisionTime"] != null)
  2263. this.ReviseTime = DateTime.Parse(nodeHeader.Attributes["LastRevisionTime"].Value);
  2264. if (nodeHeader.Attributes["Description"] != null)
  2265. this.Description = nodeHeader.Attributes["Description"].Value;
  2266. if (nodeHeader.Attributes["TableIndex"] != null)
  2267. this.TableIndex = int.Parse(nodeHeader.Attributes["TableIndex"].Value);
  2268. string chamberType = string.Empty;
  2269. if (nodeHeader.Attributes["RecipeChamberType"] != null)
  2270. this.RecipeChamberType = nodeHeader.Attributes["RecipeChamberType"].Value;
  2271. //if (!string.IsNullOrEmpty(chamberType) && chamberType != RecipeChamberType)
  2272. //{
  2273. // LOG.Write($"{chamberType} is not accordance with {RecipeChamberType}");
  2274. // return false;
  2275. //}
  2276. string version = string.Empty;
  2277. if (nodeHeader.Attributes["RecipeVersion"] != null)
  2278. version = nodeHeader.Attributes["RecipeVersion"].Value;
  2279. //if (!string.IsNullOrEmpty(version) && version != RecipeVersion)
  2280. //{
  2281. // LOG.Write($"{version} is not accordance with {RecipeVersion}");
  2282. // return false;
  2283. //}
  2284. return true;
  2285. }
  2286. private void LoadTables(XmlNode nodeRoot)
  2287. {
  2288. Tables.Clear();
  2289. foreach (XmlNode nodeTable in nodeRoot.ChildNodes)
  2290. {
  2291. XmlNodeList nodeSteps = nodeTable.SelectNodes($"Step");
  2292. RecipeTable recipeDataBase = new RecipeTable();
  2293. recipeDataBase.Index = int.Parse(nodeTable.Attributes["Index"].Value);
  2294. recipeDataBase.Name = nodeTable.Attributes["Name"].Value;
  2295. recipeDataBase.EndStatus = nodeTable.Attributes["EndStatus"].Value;
  2296. RecipeDataBase tableData = new RecipeDataBase();
  2297. tableData.FastLoadSteps(nodeSteps);
  2298. recipeDataBase.TableData = tableData;
  2299. Tables.Add(recipeDataBase);
  2300. }
  2301. }
  2302. private void LoadSteps(XmlNodeList steps)
  2303. {
  2304. Steps.Clear();
  2305. PopSettingSteps.Clear();
  2306. StepTolerances.Clear();
  2307. StepNos.Clear();
  2308. int index = 1;
  2309. foreach (XmlNode nodeStep in steps)
  2310. {
  2311. Step step = this.CreateStep(nodeStep);
  2312. StepNos.Add(step.StepNo);
  2313. Steps.Add(step);
  2314. index++;
  2315. }
  2316. if (StepNos == null || StepNos.Count == 0)
  2317. {
  2318. StepNo = 1;
  2319. }
  2320. else
  2321. {
  2322. StepNo = StepNos.Max() + 1;
  2323. }
  2324. }
  2325. private void FastLoadSteps(XmlNodeList steps)
  2326. {
  2327. Steps.Clear();
  2328. PopSettingSteps.Clear();
  2329. StepTolerances.Clear();
  2330. StepNos.Clear();
  2331. if (steps.Count != 0)
  2332. {
  2333. Step step = this.CreateStep(steps[0]);
  2334. var query1 = (from XmlNode n in steps select n).ToList();
  2335. query1.RemoveAt(0);
  2336. var allSteps = query1.AsParallel().AsOrdered()
  2337. .Select(x => this.CreateStep(Steps[0], x));
  2338. StepNos.Add(step.StepNo);
  2339. Steps.Add(step);
  2340. foreach (var item in allSteps)
  2341. {
  2342. StepNos.Add(item.StepNo);
  2343. Steps.Add(item);
  2344. }
  2345. }
  2346. }
  2347. private void LoadConfigs(XmlNode configNode)
  2348. {
  2349. if (configNode == null)
  2350. return;
  2351. foreach (Param configItem in ConfigItems)
  2352. {
  2353. if (configNode.Attributes[configItem.Name] != null)
  2354. {
  2355. if (configItem is StringParam)
  2356. (configItem as StringParam).Value = configNode.Attributes[configItem.Name]?.Value;
  2357. else if (configItem is DoubleParam)
  2358. (configItem as DoubleParam).Value = configNode.Attributes[configItem.Name]?.Value;
  2359. }
  2360. }
  2361. }
  2362. private string GetConditionCheckXmlString(Step parameters)
  2363. {
  2364. StringBuilder conditionCheckStr = new StringBuilder();
  2365. string externalSensor = "";
  2366. string[] tempStr = new string[] { "", "", "", "", "", "", "" };
  2367. for (int i = 0; i < tempStr.Count(); i++)
  2368. {
  2369. tempStr[i] = $"{parameters.ExternalSensorName[i]}.{parameters.ExternalSensor[i]}";
  2370. }
  2371. externalSensor = $"ExternalSensor:{string.Join(",", tempStr.Select(x => x.ToString()))}";
  2372. conditionCheckStr.Append($"{externalSensor};");
  2373. conditionCheckStr.Append($"TempStabilize:{parameters.TempStabilizeSelected};");
  2374. conditionCheckStr.Append($"FinishAutoProfile:{parameters.FinishAutoProfile};");
  2375. //conditionCheckStr.Append($"TempUpper:{parameters.TempUpper.ToString()};");
  2376. //conditionCheckStr.Append($"TempLower:{parameters.TempLower.ToString()};");
  2377. if (parameters.ReachTemp == "None")
  2378. {
  2379. conditionCheckStr.Append($"ReachTemp:{parameters.ReachTemp};");
  2380. }
  2381. else
  2382. {
  2383. conditionCheckStr.Append($"ReachTemp:{parameters.ReachTemp},{parameters.ReachTempValue.ToString()};");
  2384. }
  2385. if (parameters.O2Density == "None")
  2386. {
  2387. conditionCheckStr.Append($"O2Density:{parameters.O2Density};");
  2388. }
  2389. else
  2390. {
  2391. conditionCheckStr.Append($"O2Density:{parameters.O2Density},{parameters.O2DensityValue.ToString()};");
  2392. }
  2393. //conditionCheckStr.Append($"PressureUpper:{parameters.PressureUpper.ToString()};");
  2394. //conditionCheckStr.Append($"PressureLower:{parameters.PressureLower.ToString()};");
  2395. if (parameters.ReachPressure == "None")
  2396. {
  2397. conditionCheckStr.Append($"ReachPressureWait:{parameters.ReachPressure};");
  2398. }
  2399. else
  2400. {
  2401. conditionCheckStr.Append($"ReachPressure:{parameters.ReachPressure},{parameters.ReachPressureVG},{parameters.ReachPressureValue.ToString()};");
  2402. }
  2403. conditionCheckStr.Append($"PressureStabilize:{parameters.PressureStabilizeSelected},{parameters.PressureStabilizeVG}");
  2404. conditionCheckStr.Append($"ProcessTimeToEnd:{parameters.ProcessTimeToEnd}");
  2405. return conditionCheckStr.ToString();
  2406. }
  2407. private void CreateTablesXml(XmlElement nodeData)
  2408. {
  2409. XmlNode nodeTables = _doc.SelectSingleNode($"Aitex/TableRecipeData/Tables");
  2410. if (nodeTables == null) //创建Recipe文件
  2411. {
  2412. nodeTables = _doc.CreateElement("Tables");
  2413. nodeData.AppendChild(nodeTables);
  2414. nodeTables.RemoveAll();
  2415. int tableCount = 20;
  2416. if (_chamberType.ToLower() == "abort")
  2417. {
  2418. tableCount = 10;
  2419. }
  2420. for (int i = 1; i <= tableCount; i++)
  2421. {
  2422. XmlElement nodeTable = _doc.CreateElement("Table");
  2423. nodeTable.SetAttribute("Index", i.ToString());
  2424. nodeTable.SetAttribute("EndStatus", "");
  2425. nodeTable.SetAttribute("Name", "");
  2426. nodeTables.AppendChild(nodeTable);
  2427. }
  2428. }
  2429. }
  2430. private void SaveTables(XmlElement nodeData, List<XmlElement> steps, int tableIndex = 1)
  2431. {
  2432. //XmlNode nodeTables = nodeData.SelectSingleNode($"Aitex/TableRecipeData/Tables");
  2433. XmlElement selectednodeTable = (XmlElement)nodeData.ChildNodes[0].SelectSingleNode($"Table[@Index='{tableIndex}']");
  2434. var table = this.Tables.FirstOrDefault(x => x.Index == tableIndex);
  2435. if (selectednodeTable == null || table == null)
  2436. return;
  2437. selectednodeTable.SetAttribute("EndStatus", table.EndStatus);
  2438. selectednodeTable.SetAttribute("Name", table.Name);
  2439. while (selectednodeTable.FirstChild != null)
  2440. {
  2441. selectednodeTable.RemoveChild(selectednodeTable.FirstChild);
  2442. }
  2443. steps.ForEach(x => selectednodeTable.AppendChild(x));
  2444. }
  2445. public string GetXmlString()
  2446. {
  2447. XmlElement nodeData = _doc.SelectSingleNode($"Aitex/TableRecipeData") as XmlElement;
  2448. nodeData.SetAttribute("CreatedBy", Creator);
  2449. nodeData.SetAttribute("CreationTime", CreateTime.ToString("yyyy-MM-dd HH:mm:ss"));
  2450. nodeData.SetAttribute("LastRevisedBy", Revisor);
  2451. nodeData.SetAttribute("LastRevisionTime", ReviseTime.ToString("yyyy-MM-dd HH:mm:ss"));
  2452. nodeData.SetAttribute("Description", Description);
  2453. nodeData.SetAttribute("RecipeChamberType", RecipeChamberType);
  2454. nodeData.SetAttribute("RecipeVersion", RecipeVersion);
  2455. nodeData.SetAttribute("RecipePermission", RecipePermission);
  2456. nodeData.SetAttribute("RecipeLevel", RecipeLevel);
  2457. nodeData.SetAttribute("TableIndex", TableIndex.ToString());
  2458. if (!SaveTableRecipeTypes.Contains(RecipeChamberType))
  2459. {
  2460. XmlNode nodeModule = _doc.SelectSingleNode($"Aitex/TableRecipeData/Module[@Name='{_module}']");
  2461. if (nodeModule == null)
  2462. {
  2463. nodeModule = _doc.CreateElement("Module");
  2464. nodeData.AppendChild(nodeModule);
  2465. }
  2466. nodeModule.RemoveAll();
  2467. (nodeModule as XmlElement).SetAttribute("Name", _module);
  2468. int i = 0;
  2469. foreach (Step parameters in Steps)
  2470. {
  2471. XmlElement nodeWarning = _doc.CreateElement("Warning");
  2472. XmlElement nodeAlarm = _doc.CreateElement("Alarm");
  2473. Dictionary<string, XmlElement> nodePop = new Dictionary<string, XmlElement>();
  2474. foreach (string key in PopEnable.Keys)
  2475. {
  2476. nodePop.Add(key, _doc.CreateElement(key));
  2477. }
  2478. XmlElement nodeStep = _doc.CreateElement("Step");
  2479. if (ToleranceEnable)
  2480. {
  2481. nodeStep.AppendChild(nodeWarning);
  2482. nodeStep.AppendChild(nodeAlarm);
  2483. }
  2484. nodeStep.SetAttribute("StepNo", parameters.StepNo.ToString());
  2485. nodeStep.SetAttribute("Name", parameters.Name);
  2486. nodeStep.SetAttribute("EndBy", parameters.EndBy);
  2487. nodeStep.SetAttribute("Time", parameters.Time);
  2488. nodeStep.SetAttribute("SkipWait", parameters.SkipWait);
  2489. nodeStep.SetAttribute("Command", parameters.Command);
  2490. nodeStep.SetAttribute("AlarmIsSaved", parameters.AlarmIsSaved.ToString());
  2491. nodeStep.SetAttribute("MFCIsSaved", parameters.MFCIsSaved.ToString());
  2492. nodeStep.SetAttribute("ValveIsSaved", parameters.ValveIsSaved.ToString());
  2493. nodeStep.SetAttribute("PressIsSaved", parameters.PressIsSaved.ToString());
  2494. nodeStep.SetAttribute("AUXIsSaved", parameters.AUXIsSaved.ToString());
  2495. nodeStep.SetAttribute("TemperatureIsSaved", parameters.TemperatureIsSaved.ToString());
  2496. if (parameters.IsnoneConditionCheck)
  2497. {
  2498. nodeStep.SetAttribute("ConditionCheck", "none");
  2499. }
  2500. else
  2501. {
  2502. nodeStep.SetAttribute("ConditionCheck", GetConditionCheckXmlString(parameters));
  2503. }
  2504. //nodeStep.SetAttribute("PressureSonserValue", parameters.PressureSonserValue);
  2505. //nodeStep.SetAttribute("PressureSonserValue", parameters.PressureSonserValue);
  2506. //nodeStep.SetAttribute("PressureValveAngle", parameters.PressureValveAngle);
  2507. //nodeStep.SetAttribute("PressureSettingVG", parameters.PressureSettingVG);
  2508. //nodeStep.SetAttribute("SlowVacuumValue", parameters.SlowVacuumValue);
  2509. //nodeStep.SetAttribute("PressureAlarmTableNo", parameters.PressureAlarmTableNo);
  2510. //nodeStep.SetAttribute("ZAxisPosition", parameters.ZAxisPosition);
  2511. //nodeStep.SetAttribute("ZAxisSpeed", parameters.ZAxisSpeed);
  2512. //nodeStep.SetAttribute("RotateDirection", parameters.RotateDirection);
  2513. //nodeStep.SetAttribute("RotatePosition", parameters.RotatePosition);
  2514. //nodeStep.SetAttribute("RotateSpeed", parameters.RotateSpeed);
  2515. //nodeStep.SetAttribute("RotateInterval", parameters.RotateInterval);
  2516. //nodeStep.SetAttribute("APC.SetPressure", parameters.APC_SetPressure);
  2517. //nodeStep.SetAttribute("MfmD1Flow", parameters.MfmD1Flow.ToString());
  2518. //nodeStep.SetAttribute("RFSwitch", parameters.RFSwitch);
  2519. //nodeStep.SetAttribute("RFSetpoint", parameters.RFSetpoint);
  2520. //nodeStep.SetAttribute("RFPowerSetpoint", parameters.RFPowerSetpoint);
  2521. //nodeStep.SetAttribute("CAPSetValue", parameters.CAPSetValue);
  2522. //nodeStep.SetAttribute("CAPRampingValue", parameters.CAPRampingValue);
  2523. //nodeStep.SetAttribute("C1Setpoint", parameters.C1Setpoint);
  2524. //nodeStep.SetAttribute("C2Setpoint", parameters.C2Setpoint);
  2525. //nodeStep.SetAttribute("ForwardPowerAlarmWatchTable", parameters.ForwardPowerAlarmWatchTable);
  2526. //nodeStep.SetAttribute("C1AlarmWatchTable", parameters.C1AlarmWatchTable);
  2527. //nodeStep.SetAttribute("C2AlarmWatchTable", parameters.C2AlarmWatchTable);
  2528. //nodeStep.SetAttribute("PrAlarmWatchTable", parameters.PrAlarmWatchTable);
  2529. //nodeStep.SetAttribute("PIAlarmWatchTable", parameters.PIAlarmWatchTable);
  2530. //nodeStep.SetAttribute("VppAlarmWatchTable", parameters.VppAlarmWatchTable);
  2531. //nodeStep.SetAttribute("VdcAlarmWatchTable", parameters.VdcAlarmWatchTable);
  2532. nodeStep.SetAttribute("AlarmConditionTable", parameters.AlarmConditionTable.Value);
  2533. nodeStep.SetAttribute("AbortRecipeTableIndex", parameters.AbortRecipeTableIndex);
  2534. //nodeStep.SetAttribute("EventSetting", parameters.EventSetting);
  2535. var dpParam = parameters.ValveSets.FirstOrDefault(x => x.Name == "DP");
  2536. foreach (var item in parameters.ValveSets)
  2537. {
  2538. if (item.Name == "MBP")
  2539. {
  2540. if (dpParam != null)
  2541. {
  2542. nodeStep.SetAttribute(item.Name, dpParam.Value ? "Open" : "Close");
  2543. }
  2544. else
  2545. {
  2546. nodeStep.SetAttribute(item.Name, item.Value ? "Open" : "Close");
  2547. }
  2548. }
  2549. else
  2550. {
  2551. nodeStep.SetAttribute(item.Name, item.Value ? "Open" : "Close");
  2552. }
  2553. }
  2554. foreach (var item in parameters.MFCSets)
  2555. {
  2556. nodeStep.SetAttribute($"{item.ControlName}.Flow.IsSaved", item.IsSaved.ToString());
  2557. nodeStep.SetAttribute($"{item.ControlName}.Flow.Set", item.SetValue.Value);
  2558. nodeStep.SetAttribute($"{item.ControlName}.Flow.SetUnit", item.SetUnit.Value);
  2559. nodeStep.SetAttribute($"{item.ControlName}.Flow.Ramprate", item.Rampng.Value);
  2560. nodeStep.SetAttribute($"{item.ControlName}.Flow.RamprateUnit", item.RampngUnit.Value);
  2561. nodeStep.SetAttribute($"{item.ControlName}.Flow.Check", item.IsCheck.Value.ToString());
  2562. nodeStep.SetAttribute($"{item.ControlName}.Flow.High", item.MaxValue.Value.ToString());
  2563. nodeStep.SetAttribute($"{item.ControlName}.Flow.Low", item.MinValue.Value.ToString());
  2564. nodeStep.SetAttribute($"{item.ControlName}.Flow.Unit", item.Unit);
  2565. }
  2566. foreach (var item in parameters.MFMSets)
  2567. {
  2568. nodeStep.SetAttribute(item.Key, parameters.MFMSets[item.Key].ToString());
  2569. }
  2570. foreach (var item in parameters.EXOUSets.Keys)
  2571. {
  2572. nodeStep.SetAttribute(item, parameters.EXOUSets[item].ToString());
  2573. }
  2574. foreach (var item in parameters.TemperatureSets)
  2575. {
  2576. nodeStep.SetAttribute($"{item.Name}.ZoneName", item.Name);
  2577. nodeStep.SetAttribute($"{item.Name}.Set", item.SetValue.Value);
  2578. nodeStep.SetAttribute($"{item.Name}.SetUnit", item.SetUnit.Value);
  2579. nodeStep.SetAttribute($"{item.Name}.Ramprate", item.RampngValue.Value);
  2580. nodeStep.SetAttribute($"{item.Name}.RamprateUnit", item.RampngUnit.Value);
  2581. nodeStep.SetAttribute($"{item.Name}.Check", item.IsCheck.Value.ToString());
  2582. nodeStep.SetAttribute($"{item.Name}.High", item.HighValue.Value.ToString());
  2583. nodeStep.SetAttribute($"{item.Name}.Low", item.LowValue.Value.ToString());
  2584. nodeStep.SetAttribute($"{item.Name}.Unit", item.Unit.ToString());
  2585. }
  2586. nodeStep.SetAttribute("Temperature.ControlMode", parameters.TemperatureControlMode.Value);
  2587. nodeStep.SetAttribute("Temperature.Correct", parameters.TemperatureCorrect.Value);
  2588. nodeStep.SetAttribute("Temperature.PID", parameters.TemperaturePID.Value);
  2589. nodeStep.SetAttribute("Loader.Command", parameters.LoaderCommand.Value);
  2590. nodeStep.SetAttribute("Loader.Speed1", parameters.LoaderSpeed1.Value);
  2591. nodeStep.SetAttribute("Loader.Speed2", parameters.LoaderSpeed2.Value);
  2592. nodeStep.SetAttribute("Loader.Speed3", parameters.LoaderSpeed3.Value);
  2593. nodeStep.SetAttribute("Loader.RPM", parameters.LoaderRPM.Value.ToString());
  2594. nodeStep.SetAttribute("Press.Command", parameters.PressCommand.Value);
  2595. nodeStep.SetAttribute("Press.PID", parameters.PressPID.Value);
  2596. // nodeStep.SetAttribute("Press.Set", parameters.PressSet.Value);
  2597. nodeStep.SetAttribute("Press.Set", GetPressSetValue(parameters));
  2598. // nodeStep.SetAttribute("Press.SlowVacSet", parameters.PressSlowVacSet.Value);
  2599. nodeStep.SetAttribute("Press.SlowVacSet", GetPressSlowVacSet(parameters));
  2600. // nodeStep.SetAttribute("Press.ValveAngleSet", parameters.PressValveAngleSet.Value);
  2601. nodeStep.SetAttribute("Press.ValveAngleSet", RecipeDataBase.GetValveAngleSet(parameters));
  2602. nodeStep.SetAttribute("Press.IsWait", parameters.PressIsWait.Value.ToString());
  2603. nodeStep.SetAttribute("Press.LowWait", parameters.PressLowWait.Value);
  2604. nodeStep.SetAttribute("Press.HighWait", parameters.PressHighWait.Value);
  2605. nodeStep.SetAttribute("Press.WaitUnit", parameters.PressWaitUnit.Value);
  2606. nodeStep.SetAttribute("Press.LowPressWait", parameters.PressLowPressWait.Value);
  2607. // nodeStep.SetAttribute("Press.WaitPress", parameters.WaitPress.Value);
  2608. nodeStep.SetAttribute("Press.WaitPress", RecipeDataBase.GetWaitPress(parameters));
  2609. nodeStep.SetAttribute("FilmThickFormula", parameters.FilmThickFormula);
  2610. foreach (var item in parameters.AUXSets)
  2611. {
  2612. nodeStep.SetAttribute($"AUX.{item.ControlName}.Set", item.SetValue.Value);
  2613. nodeStep.SetAttribute($"AUX.{item.ControlName}.Check", item.IsCheck.Value.ToString());
  2614. nodeStep.SetAttribute($"AUX.{item.ControlName}.High", item.MaxValue.Value);
  2615. nodeStep.SetAttribute($"AUX.{item.ControlName}.Low", item.MinValue.Value);
  2616. nodeStep.SetAttribute($"AUX.{item.ControlName}.CheckUnit", item.SetUnit.Value);
  2617. }
  2618. nodeModule.AppendChild(nodeStep);
  2619. i++;
  2620. }
  2621. XmlElement nodeConfig = _doc.CreateElement("Config");
  2622. foreach (Param parameter in ConfigItems)
  2623. {
  2624. if (parameter.Visible == System.Windows.Visibility.Visible)
  2625. {
  2626. if (parameter is IntParam)
  2627. nodeConfig.SetAttribute(parameter.Name, ((IntParam)parameter).Value.ToString());
  2628. else if (parameter is DoubleParam)
  2629. {
  2630. string strValue = ((DoubleParam)parameter).Value;
  2631. bool succed = double.TryParse(strValue, out double dValue);
  2632. if (!succed)
  2633. {
  2634. MessageBox.Show($"The set value of {parameter.DisplayName} is {strValue}, not a valid value");
  2635. return null;
  2636. }
  2637. var config = ConfigItems.Where(m => m.Name == parameter.Name).FirstOrDefault();
  2638. if (config is DoubleParam param1)
  2639. {
  2640. if (param1.Minimun == 0 && param1.Maximun == 0)
  2641. {
  2642. //没有设定范围
  2643. }
  2644. else if (dValue > param1.Maximun || dValue < param1.Minimun)
  2645. {
  2646. MessageBox.Show($"The set value of {parameter.DisplayName} is {dValue}, out of the range {param1.Minimun}~{param1.Maximun}");
  2647. return null;
  2648. }
  2649. }
  2650. nodeConfig.SetAttribute(parameter.Name, ((DoubleParam)parameter).Value.ToString());
  2651. }
  2652. else if (parameter is StringParam)
  2653. nodeConfig.SetAttribute(parameter.Name, ((StringParam)parameter).Value?.ToString());
  2654. else if (parameter is ComboxParam)
  2655. nodeConfig.SetAttribute(parameter.Name, ((ComboxParam)parameter).Value.ToString());
  2656. else if (parameter is LoopComboxParam)
  2657. nodeConfig.SetAttribute(parameter.Name, ((LoopComboxParam)parameter).Value.ToString());
  2658. else if (parameter is PositionParam)
  2659. nodeConfig.SetAttribute(parameter.Name, ((PositionParam)parameter).Value.ToString());
  2660. else if (parameter is BoolParam)
  2661. nodeConfig.SetAttribute(parameter.Name, ((BoolParam)parameter).Value.ToString());
  2662. else if (parameter is StepParam)
  2663. nodeConfig.SetAttribute(parameter.Name, ((StepParam)parameter).Value.ToString());
  2664. else if (parameter is MultipleSelectParam)
  2665. {
  2666. List<string> selected = new List<string>();
  2667. ((MultipleSelectParam)parameter).Options.Apply(
  2668. opt =>
  2669. {
  2670. if (opt.IsChecked)
  2671. selected.Add(opt.ControlName);
  2672. }
  2673. );
  2674. nodeConfig.SetAttribute(parameter.Name, string.Join(",", selected));
  2675. }
  2676. }
  2677. }
  2678. nodeModule.AppendChild(nodeConfig);
  2679. }
  2680. else
  2681. {
  2682. var CurrentTableSteps = Tables.FirstOrDefault(x => x.Index == TableIndex).TableData.Steps;
  2683. CurrentTableSteps.Clear();
  2684. Steps.ToList().ForEach(x => CurrentTableSteps.Add(x));
  2685. CreateTablesXml(nodeData);
  2686. foreach (var item in Tables)
  2687. {
  2688. List<XmlElement> StepsXmlElement = new List<XmlElement>();
  2689. foreach (Step parameters in item.TableData.Steps)
  2690. {
  2691. StepsXmlElement.Add(StepToXmlElement(parameters));
  2692. }
  2693. SaveTables(nodeData, StepsXmlElement, item.Index);
  2694. }
  2695. }
  2696. return _doc.OuterXml;
  2697. }
  2698. public static string GetPressPidValue(Step parameters)
  2699. {
  2700. string cmd = parameters.PressCommand.Value;
  2701. if (cmd == "Slow Vac" || cmd == "Valve Angle" || cmd == "Full Open" || cmd == "Full Close" || cmd == "Hold" ||
  2702. cmd == "WaitPressUp1" || cmd == "WaitPressDown1" || cmd == "WaitPressUp2" || cmd == "WaitPressDown2" || cmd == "Zero Set" || cmd == "Cancel Zero")
  2703. {
  2704. return "";
  2705. }
  2706. return parameters.PressPID.Value.Replace(",", ":");
  2707. }
  2708. public static string GetPressSetValue(Step parameters)
  2709. {
  2710. string rtn = "0";
  2711. string cmd = parameters.PressCommand.Value;
  2712. if (cmd == "Press" || cmd == "Press2")
  2713. {
  2714. rtn = parameters.PressSet.Value;
  2715. }
  2716. return rtn;
  2717. }
  2718. public static string GetPressSlowVacSet(Step parameters)
  2719. {
  2720. string rtn = "0";
  2721. string cmd = parameters.PressCommand.Value;
  2722. if (cmd == "Slow Vac")
  2723. {
  2724. rtn = parameters.PressSlowVacSet.Value;
  2725. }
  2726. return rtn;
  2727. }
  2728. public static string GetValveAngleSet(Step parameters)
  2729. {
  2730. string rtn = "0";
  2731. string cmd = parameters.PressCommand.Value;
  2732. if (cmd == "Valve Angle")
  2733. {
  2734. rtn = parameters.PressValveAngleSet.Value;
  2735. }
  2736. return rtn;
  2737. }
  2738. public static string GetWaitPress(Step parameters)
  2739. {
  2740. string rtn = "0";
  2741. string cmd = parameters.PressCommand.Value;
  2742. if (cmd == "WaitPressUp1" || cmd == "WaitPressDown1" || cmd == "WaitPressUp2" || cmd == "WaitPressDown2")
  2743. {
  2744. rtn = parameters.WaitPress.Value;
  2745. }
  2746. return rtn;
  2747. }
  2748. private XmlElement StepToXmlElement(Step parameters)
  2749. {
  2750. XmlElement nodeStep = _doc.CreateElement("Step");
  2751. if (ToleranceEnable)
  2752. {
  2753. //nodeStep.AppendChild(nodeWarning);
  2754. //nodeStep.AppendChild(nodeAlarm);
  2755. }
  2756. nodeStep.SetAttribute("StepNo", parameters.StepNo.ToString());
  2757. nodeStep.SetAttribute("Name", parameters.Name);
  2758. nodeStep.SetAttribute("EndBy", parameters.EndBy);
  2759. nodeStep.SetAttribute("Time", parameters.Time);
  2760. nodeStep.SetAttribute("SkipWait", parameters.SkipWait);
  2761. nodeStep.SetAttribute("Command", parameters.Command);
  2762. nodeStep.SetAttribute("AlarmIsSaved", parameters.AlarmIsSaved.ToString());
  2763. nodeStep.SetAttribute("MFCIsSaved", parameters.MFCIsSaved.ToString());
  2764. nodeStep.SetAttribute("ValveIsSaved", parameters.ValveIsSaved.ToString());
  2765. nodeStep.SetAttribute("PressIsSaved", parameters.PressIsSaved.ToString());
  2766. nodeStep.SetAttribute("AUXIsSaved", parameters.AUXIsSaved.ToString());
  2767. nodeStep.SetAttribute("TemperatureIsSaved", parameters.TemperatureIsSaved.ToString());
  2768. if (parameters.IsnoneConditionCheck)
  2769. {
  2770. nodeStep.SetAttribute("ConditionCheck", "none");
  2771. }
  2772. else
  2773. {
  2774. nodeStep.SetAttribute("ConditionCheck", GetConditionCheckXmlString(parameters));
  2775. }
  2776. nodeStep.SetAttribute("AlarmConditionTable", parameters.AlarmConditionTable.Value);
  2777. nodeStep.SetAttribute("AbortRecipeTableIndex", parameters.AbortRecipeTableIndex);
  2778. foreach (var item in parameters.ValveSets)
  2779. {
  2780. nodeStep.SetAttribute(item.Name, item.Value ? "Open" : "Close");
  2781. }
  2782. foreach (var item in parameters.MFCSets)
  2783. {
  2784. nodeStep.SetAttribute($"{item.ControlName}.Flow.IsSaved", item.IsSaved.ToString());
  2785. nodeStep.SetAttribute($"{item.ControlName}.Flow.Set", item.SetValue.Value);
  2786. nodeStep.SetAttribute($"{item.ControlName}.Flow.SetUnit", item.SetUnit.Value);
  2787. nodeStep.SetAttribute($"{item.ControlName}.Flow.Ramprate", item.Rampng.Value);
  2788. nodeStep.SetAttribute($"{item.ControlName}.Flow.RamprateUnit", item.RampngUnit.Value);
  2789. nodeStep.SetAttribute($"{item.ControlName}.Flow.Check", item.IsCheck.Value.ToString());
  2790. nodeStep.SetAttribute($"{item.ControlName}.Flow.High", item.MaxValue.Value.ToString());
  2791. nodeStep.SetAttribute($"{item.ControlName}.Flow.Low", item.MinValue.Value.ToString());
  2792. nodeStep.SetAttribute($"{item.ControlName}.Flow.Unit", item.Unit);
  2793. }
  2794. foreach (var item in parameters.MFMSets)
  2795. {
  2796. nodeStep.SetAttribute(item.Key, parameters.MFMSets[item.Key].ToString());
  2797. }
  2798. foreach (var item in parameters.EXOUSets.Keys)
  2799. {
  2800. nodeStep.SetAttribute(item, parameters.EXOUSets[item].ToString());
  2801. }
  2802. foreach (var item in parameters.TemperatureSets)
  2803. {
  2804. nodeStep.SetAttribute($"{item.Name}.ZoneName", item.Name);
  2805. nodeStep.SetAttribute($"{item.Name}.Set", item.SetValue.Value);
  2806. nodeStep.SetAttribute($"{item.Name}.SetUnit", item.SetUnit.Value);
  2807. nodeStep.SetAttribute($"{item.Name}.Ramprate", item.RampngValue.Value);
  2808. nodeStep.SetAttribute($"{item.Name}.RamprateUnit", item.RampngUnit.Value);
  2809. nodeStep.SetAttribute($"{item.Name}.Check", item.IsCheck.Value.ToString());
  2810. nodeStep.SetAttribute($"{item.Name}.High", item.HighValue.Value.ToString());
  2811. nodeStep.SetAttribute($"{item.Name}.Low", item.LowValue.Value.ToString());
  2812. nodeStep.SetAttribute($"{item.Name}.Unit", item.Unit.ToString());
  2813. }
  2814. nodeStep.SetAttribute("Temperature.ControlMode", parameters.TemperatureControlMode.Value);
  2815. nodeStep.SetAttribute("Temperature.Correct", parameters.TemperatureCorrect.Value);
  2816. nodeStep.SetAttribute("Temperature.PID", parameters.TemperaturePID.Value);
  2817. nodeStep.SetAttribute("Loader.Command", parameters.LoaderCommand.Value);
  2818. nodeStep.SetAttribute("Loader.Speed1", parameters.LoaderSpeed1.Value);
  2819. nodeStep.SetAttribute("Loader.Speed2", parameters.LoaderSpeed2.Value);
  2820. nodeStep.SetAttribute("Loader.Speed3", parameters.LoaderSpeed3.Value);
  2821. nodeStep.SetAttribute("Loader.RPM", parameters.LoaderRPM.Value.ToString());
  2822. nodeStep.SetAttribute("Press.Command", parameters.PressCommand.Value);
  2823. nodeStep.SetAttribute("Press.PID", parameters.PressPID.Value);
  2824. nodeStep.SetAttribute("Press.Set", parameters.PressSet.Value);
  2825. nodeStep.SetAttribute("Press.SlowVacSet", parameters.PressSlowVacSet.Value);
  2826. nodeStep.SetAttribute("Press.ValveAngleSet", parameters.PressValveAngleSet.Value);
  2827. nodeStep.SetAttribute("Press.IsWait", parameters.PressIsWait.Value.ToString());
  2828. nodeStep.SetAttribute("Press.LowWait", parameters.PressLowWait.Value);
  2829. nodeStep.SetAttribute("Press.HighWait", parameters.PressHighWait.Value);
  2830. nodeStep.SetAttribute("Press.WaitUnit", parameters.PressWaitUnit.Value);
  2831. nodeStep.SetAttribute("Press.LowPressWait", parameters.PressLowPressWait.Value);
  2832. nodeStep.SetAttribute("Press.WaitPress", parameters.WaitPress.Value);
  2833. nodeStep.SetAttribute("FilmThickFormula", parameters.FilmThickFormula);
  2834. // nodeStep.SetAttribute("FilmThickFormula", parameters.FilmThickFormula);
  2835. foreach (var item in parameters.AUXSets)
  2836. {
  2837. nodeStep.SetAttribute($"AUX.{item.ControlName}.Set", item.SetValue.Value);
  2838. nodeStep.SetAttribute($"AUX.{item.ControlName}.Check", item.IsCheck.Value.ToString());
  2839. nodeStep.SetAttribute($"AUX.{item.ControlName}.High", item.MaxValue.Value);
  2840. nodeStep.SetAttribute($"AUX.{item.ControlName}.Low", item.MinValue.Value);
  2841. nodeStep.SetAttribute($"AUX.{item.ControlName}.CheckUnit", item.SetUnit.Value);
  2842. }
  2843. return nodeStep;
  2844. }
  2845. public RecipeHistory GetRecipeHistory()
  2846. {
  2847. RecipeHistory recipeHistory = new RecipeHistory();
  2848. recipeHistory.CreatedBy = this.Creator;
  2849. recipeHistory.CreationTime = this.CreateTime;
  2850. recipeHistory.LastRevisedBy = this.Revisor;
  2851. recipeHistory.LastRevisionTime = this.ReviseTime;
  2852. recipeHistory.Recipe_Description = this.Description;
  2853. recipeHistory.Recipe_Type = this.PrefixPath;
  2854. recipeHistory.Recipe_Name = this.Name;
  2855. recipeHistory.Recipe_Path = $"{this.PrefixPath}\\{this.Name}";
  2856. recipeHistory.Recipe_Version = this.RecipeVersion;
  2857. recipeHistory.Recipe_Level = this.RecipeLevel;
  2858. recipeHistory.Recipe_Premission = this.RecipePermission;
  2859. recipeHistory.Recipe_Compare = "";
  2860. recipeHistory.Recipe_Content = GetXmlString();
  2861. return recipeHistory;
  2862. }
  2863. private void LoadConfigs(ObservableCollection<Param> configDefine, XmlNode configNode)
  2864. {
  2865. ConfigItems.Clear();
  2866. foreach (var param in configDefine)
  2867. {
  2868. if (param is DoubleParam param1)
  2869. {
  2870. var config = new DoubleParam()
  2871. {
  2872. Name = param.Name,
  2873. Value = param1.Value,
  2874. DisplayName = param.DisplayName,
  2875. Minimun = param1.Minimun,
  2876. Maximun = param1.Maximun,
  2877. Resolution = param1.Resolution
  2878. };
  2879. if (configNode != null && configNode.Attributes[param1.Name] != null)
  2880. config.Value = configNode.Attributes[param1.Name].Value;
  2881. ConfigItems.Add(config);
  2882. }
  2883. if (param is NumParam paramInt)
  2884. {
  2885. var config = new NumParam()
  2886. {
  2887. Name = paramInt.Name,
  2888. Value = paramInt.Value,
  2889. DisplayName = paramInt.DisplayName,
  2890. };
  2891. if (configNode != null && configNode.Attributes[paramInt.Name] != null)
  2892. {
  2893. int.TryParse(configNode.Attributes[paramInt.Name].Value, out int intValue);
  2894. config.Value = intValue;
  2895. }
  2896. ConfigItems.Add(config);
  2897. }
  2898. if (param is StringParam paramString)
  2899. {
  2900. var config = new StringParam()
  2901. {
  2902. Name = param.Name,
  2903. Value = paramString.Value,
  2904. DisplayName = param.DisplayName,
  2905. };
  2906. if (configNode != null && configNode.Attributes[paramString.Name] != null)
  2907. config.Value = configNode.Attributes[paramString.Name].Value;
  2908. ConfigItems.Add(config);
  2909. }
  2910. }
  2911. }
  2912. public void InitData(string prefixPath, string recipeName, string recipeContent, ObservableCollection<Param> configDefine, string module)
  2913. {
  2914. IsCompatibleWithCurrentFormat = false;
  2915. _module = module;
  2916. Name = recipeName;
  2917. PrefixPath = prefixPath;
  2918. try
  2919. {
  2920. _doc = new XmlDocument();
  2921. _doc.LoadXml(recipeContent);
  2922. if (!LoadHeader(_doc.SelectSingleNode("Aitex/TableRecipeData")))
  2923. return;
  2924. XmlNodeList nodeSteps = _doc.SelectNodes($"Aitex/TableRecipeData/Module[@Name='{module}']/Step");
  2925. if (nodeSteps == null)
  2926. nodeSteps = _doc.SelectNodes($"Aitex/TableRecipeData/Step");
  2927. LoadSteps(nodeSteps);
  2928. XmlNode nodeConfig =
  2929. _doc.SelectSingleNode($"Aitex/TableRecipeData/Module[@Name='{module}']/Config");
  2930. if (nodeSteps == null)
  2931. nodeConfig = _doc.SelectSingleNode($"Aitex/TableRecipeData/Config");
  2932. LoadConfigs(configDefine, nodeConfig);
  2933. IsCompatibleWithCurrentFormat = true;
  2934. }
  2935. catch (Exception ex)
  2936. {
  2937. LOG.Write(ex);
  2938. }
  2939. }
  2940. }
  2941. public class Step : PropertyChangedBase
  2942. {
  2943. public delegate void TempValueChangedEventHandler(object sender, SetValueEventArgs e);
  2944. public event TempValueChangedEventHandler TempValueChangedEvent;
  2945. public void OnTempValueChanged(SetValueEventArgs e)
  2946. {
  2947. if (TempValueChangedEvent != null)
  2948. {
  2949. TempValueChangedEvent(this, e);
  2950. }
  2951. }
  2952. public delegate void OhterTempValueChangedEventHandler(object sender, SetValueEventArgs e);
  2953. public event OhterTempValueChangedEventHandler OhterTempValueChangedEvent;
  2954. public void OnOhterTempValueChanged(SetValueEventArgs e)
  2955. {
  2956. if (OhterTempValueChangedEvent != null)
  2957. {
  2958. OhterTempValueChangedEvent(this, e);
  2959. }
  2960. }
  2961. public delegate void MFCValueChangedEventHandler(object sender, SetValueEventArgs e);
  2962. public event MFCValueChangedEventHandler MFCValueChangedEvent;
  2963. public void OnMFCValueChanged(SetValueEventArgs e)
  2964. {
  2965. if (MFCValueChangedEvent != null)
  2966. {
  2967. MFCValueChangedEvent(this, e);
  2968. }
  2969. }
  2970. public delegate void ValveValueChangedEventHandler(object sender, SetValueEventArgs e);
  2971. public event ValveValueChangedEventHandler ValveValueChangedEvent;
  2972. public void OnValveValueChanged(SetValueEventArgs e)
  2973. {
  2974. if (ValveValueChangedEvent != null)
  2975. {
  2976. ValveValueChangedEvent(this, e);
  2977. }
  2978. }
  2979. public delegate void AUXValueChangedEventHandler(object sender, SetValueEventArgs e);
  2980. public event AUXValueChangedEventHandler AUXValueChangedEvent;
  2981. public void OnAUXValueChanged(SetValueEventArgs e)
  2982. {
  2983. if (AUXValueChangedEvent != null)
  2984. {
  2985. AUXValueChangedEvent(this, e);
  2986. }
  2987. }
  2988. public Step()
  2989. {
  2990. SetDelegateEvent();
  2991. }
  2992. public void SetDelegateEvent()
  2993. {
  2994. MFCSetsCollectionChanged();
  2995. TemperatureSetsCollectionChanged();
  2996. ValveSetsCollectionChanged();
  2997. AUXSetsCollectionChanged();
  2998. }
  2999. private void MFCSetsCollectionChanged()
  3000. {
  3001. foreach (var item in MFCSets)
  3002. {
  3003. item.PropertyChanged += MFCIsSaved_PropertyChanged;
  3004. item.ValueChangedEvent += Item_MFCValueChangedEvent;
  3005. }
  3006. MFCSets.CollectionChanged += (s, e) =>
  3007. {
  3008. if (e.OldItems != null)
  3009. {
  3010. foreach (MFCData item in e.OldItems)
  3011. {
  3012. item.PropertyChanged -= MFCIsSaved_PropertyChanged;
  3013. item.ValueChangedEvent -= Item_MFCValueChangedEvent;
  3014. }
  3015. }
  3016. if (e.NewItems != null)
  3017. {
  3018. foreach (MFCData item in e.NewItems)
  3019. {
  3020. item.PropertyChanged += MFCIsSaved_PropertyChanged;
  3021. item.ValueChangedEvent += Item_MFCValueChangedEvent;
  3022. }
  3023. }
  3024. };
  3025. }
  3026. private void TemperatureSetsCollectionChanged()
  3027. {
  3028. foreach (var item in TemperatureSets)
  3029. {
  3030. item.PropertyChanged += TemperatureIsSaved_PropertyChanged;
  3031. item.ValueChangedEvent += Item_TempValueChangedEvent;
  3032. }
  3033. TemperatureSets.CollectionChanged += (s, e) =>
  3034. {
  3035. if (e.OldItems != null)
  3036. {
  3037. foreach (TempSetData item in e.OldItems)
  3038. {
  3039. item.PropertyChanged -= TemperatureIsSaved_PropertyChanged;
  3040. item.ValueChangedEvent -= Item_TempValueChangedEvent;
  3041. }
  3042. }
  3043. if (e.NewItems != null)
  3044. {
  3045. foreach (TempSetData item in e.NewItems)
  3046. {
  3047. item.PropertyChanged += TemperatureIsSaved_PropertyChanged;
  3048. item.ValueChangedEvent += Item_TempValueChangedEvent;
  3049. }
  3050. }
  3051. };
  3052. }
  3053. private void ValveSetsCollectionChanged()
  3054. {
  3055. foreach (var item in ValveSets)
  3056. {
  3057. item.PropertyChanged += ValveIsSaved_PropertyChanged;
  3058. item.ValueChangedEvent += Item_ValveValueChangedEvent;
  3059. }
  3060. ValveSets.CollectionChanged += (s, e) =>
  3061. {
  3062. if (e.OldItems != null)
  3063. {
  3064. foreach (BoolParam item in e.OldItems)
  3065. {
  3066. item.PropertyChanged -= ValveIsSaved_PropertyChanged;
  3067. item.ValueChangedEvent -= Item_ValveValueChangedEvent;
  3068. }
  3069. }
  3070. if (e.NewItems != null)
  3071. {
  3072. foreach (BoolParam item in e.NewItems)
  3073. {
  3074. item.PropertyChanged += ValveIsSaved_PropertyChanged;
  3075. item.ValueChangedEvent += Item_ValveValueChangedEvent;
  3076. }
  3077. }
  3078. };
  3079. }
  3080. private void AUXSetsCollectionChanged()
  3081. {
  3082. foreach (var item in AUXSets)
  3083. {
  3084. item.PropertyChanged += AUXIsSaved_PropertyChanged;
  3085. item.ValueChangedEvent += Item_AUXValueChangedEvent;
  3086. }
  3087. AUXSets.CollectionChanged += (s, e) =>
  3088. {
  3089. if (e.OldItems != null)
  3090. {
  3091. foreach (AUXData item in e.OldItems)
  3092. {
  3093. item.PropertyChanged -= AUXIsSaved_PropertyChanged;
  3094. item.ValueChangedEvent -= Item_AUXValueChangedEvent;
  3095. }
  3096. }
  3097. if (e.NewItems != null)
  3098. {
  3099. foreach (AUXData item in e.NewItems)
  3100. {
  3101. item.PropertyChanged += AUXIsSaved_PropertyChanged;
  3102. item.ValueChangedEvent += Item_AUXValueChangedEvent;
  3103. }
  3104. }
  3105. };
  3106. }
  3107. public void Item_TempValueChangedEvent(object sender, SetValueEventArgs e)
  3108. {
  3109. OnTempValueChanged(e);
  3110. }
  3111. public void Item_MFCValueChangedEvent(object sender, SetValueEventArgs e)
  3112. {
  3113. OnMFCValueChanged(e);
  3114. }
  3115. public void Item_ValveValueChangedEvent(object sender, SetValueEventArgs e)
  3116. {
  3117. OnValveValueChanged(e);
  3118. }
  3119. public void Item_AUXValueChangedEvent(object sender, SetValueEventArgs e)
  3120. {
  3121. OnAUXValueChanged(e);
  3122. }
  3123. public void MFCIsSaved_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
  3124. {
  3125. if (e.PropertyName == "IsSaved")
  3126. {
  3127. if (MFCSets.Where(x => x.IsSaved == false).Any())
  3128. {
  3129. MFCIsSaved = false;
  3130. }
  3131. else
  3132. {
  3133. if (MFCSetFlagIsSaved)
  3134. {
  3135. MFCIsSaved = true;
  3136. }
  3137. else
  3138. {
  3139. MFCIsSaved = false;
  3140. }
  3141. }
  3142. }
  3143. }
  3144. public void TemperatureIsSaved_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
  3145. {
  3146. if (e.PropertyName == "IsSaved")
  3147. {
  3148. SetTemperatureIsSaved();
  3149. }
  3150. }
  3151. public void ValveIsSaved_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
  3152. {
  3153. if (e.PropertyName == "IsSaved")
  3154. {
  3155. if (ValveSets.Where(x => x.IsSaved == false).Any())
  3156. {
  3157. ValveIsSaved = false;
  3158. }
  3159. else
  3160. {
  3161. ValveIsSaved = true;
  3162. }
  3163. }
  3164. }
  3165. public void AUXIsSaved_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
  3166. {
  3167. if (e.PropertyName == "IsSaved")
  3168. {
  3169. if (AUXSets.Where(x => x.IsSaved == false).Any())
  3170. {
  3171. AUXIsSaved = false;
  3172. }
  3173. else
  3174. {
  3175. AUXIsSaved = true;
  3176. }
  3177. }
  3178. }
  3179. private void LoaderIsSaved_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
  3180. {
  3181. if (e.PropertyName == "IsSaved")
  3182. {
  3183. if (!LoaderCommand.IsSaved || !LoaderSpeed1.IsSaved
  3184. || !LoaderSpeed2.IsSaved || !LoaderSpeed3.IsSaved
  3185. || !LoaderRPM.IsSaved)
  3186. {
  3187. LoaderIsSaved = false;
  3188. }
  3189. else
  3190. {
  3191. LoaderIsSaved = true;
  3192. }
  3193. }
  3194. }
  3195. private void AlarmIsSaved_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
  3196. {
  3197. if (e.PropertyName == "IsSaved")
  3198. {
  3199. if (!AlarmConditionTable.IsSaved)
  3200. {
  3201. AlarmIsSaved = false;
  3202. }
  3203. else
  3204. {
  3205. AlarmIsSaved = true;
  3206. }
  3207. }
  3208. else if (e.PropertyName == "Value")
  3209. {
  3210. if (((Param)sender).IsSaved) return;
  3211. SetValueEventArgs setEventArgs = new SetValueEventArgs();
  3212. setEventArgs.Sender = this;
  3213. setEventArgs.ValueName = "Alarm";
  3214. setEventArgs.PropertyName = ((Param)sender).Name;
  3215. if (sender is StringParam)
  3216. {
  3217. setEventArgs.PropertyValue = ((StringParam)sender).Value;
  3218. OnAlarmValueChanged(setEventArgs);
  3219. }
  3220. }
  3221. }
  3222. public delegate void AlarmValueChangedEventHandler(object sender, SetValueEventArgs e);
  3223. public event AlarmValueChangedEventHandler AlarmValueChangedEvent;
  3224. public void OnAlarmValueChanged(SetValueEventArgs e)
  3225. {
  3226. if (AlarmValueChangedEvent != null)
  3227. {
  3228. AlarmValueChangedEvent(this, e);
  3229. }
  3230. }
  3231. private void PressureIsSaved_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
  3232. {
  3233. if (e.PropertyName == "IsSaved")
  3234. {
  3235. if (!PressCommand.IsSaved || !PressPID.IsSaved
  3236. || !PressSet.IsSaved || !PressValveAngleSet.IsSaved
  3237. || !PressSlowVacSet.IsSaved || !PressIsWait.IsSaved
  3238. || !PressLowWait.IsSaved || !PressHighWait.IsSaved
  3239. || !PressWaitUnit.IsSaved || !PressLowPressWait.IsSaved
  3240. || !WaitPress.IsSaved)
  3241. {
  3242. PressIsSaved = false;
  3243. }
  3244. else
  3245. {
  3246. PressIsSaved = true;
  3247. }
  3248. }
  3249. else if (e.PropertyName == "Value")
  3250. {
  3251. if (sender is Param)
  3252. {
  3253. if (((Param)sender).IsSaved) return;
  3254. SetValueEventArgs setEventArgs = new SetValueEventArgs();
  3255. setEventArgs.Sender = this;
  3256. setEventArgs.ValueName = "Press";
  3257. setEventArgs.PropertyName = ((Param)sender).Name;
  3258. if (sender is DoubleParam)
  3259. {
  3260. setEventArgs.PropertyValue = ((DoubleParam)sender).Value;
  3261. OnPressureValueChanged(setEventArgs);
  3262. }
  3263. else if (sender is StringParam)
  3264. {
  3265. setEventArgs.PropertyValue = ((StringParam)sender).Value;
  3266. OnPressureValueChanged(setEventArgs);
  3267. }
  3268. }
  3269. }
  3270. }
  3271. public delegate void PressureValueChangedEventHandler(object sender, SetValueEventArgs e);
  3272. public event PressureValueChangedEventHandler PressureValueChangedEvent;
  3273. public void OnPressureValueChanged(SetValueEventArgs e)
  3274. {
  3275. if (PressureValueChangedEvent != null)
  3276. {
  3277. PressureValueChangedEvent(this, e);
  3278. }
  3279. }
  3280. public delegate void LoaderValueChangedEventHandler(object sender, SetValueEventArgs e);
  3281. public event LoaderValueChangedEventHandler LoaderValueChangedEvent;
  3282. public void OnLoaderValueChanged(SetValueEventArgs e)
  3283. {
  3284. if (LoaderValueChangedEvent != null)
  3285. {
  3286. LoaderValueChangedEvent(this, e);
  3287. }
  3288. }
  3289. private void SetTemperatureIsSaved()
  3290. {
  3291. if (TemperatureSets.Where(x => x.IsSaved == false).Any() || !TemperatureControlMode.IsSaved || !TemperatureCorrect.IsSaved || !TemperaturePID.IsSaved)
  3292. {
  3293. TemperatureIsSaved = false;
  3294. }
  3295. else
  3296. {
  3297. if (TemperatureSetsFlagIsSaved)
  3298. {
  3299. TemperatureIsSaved = true;
  3300. }
  3301. else
  3302. {
  3303. TemperatureIsSaved = false;
  3304. }
  3305. }
  3306. }
  3307. public bool UndoMFCChanges()
  3308. {
  3309. if (MFCIsSaved)
  3310. {
  3311. if (DialogButton.Yes == DialogBox.ShowDialog(DialogButton.Yes | DialogButton.No,
  3312. DialogType.CONFIRM,
  3313. $"Recipe MFC is changed Flag, do you want to save it?"))
  3314. {
  3315. MFCIsSaved = false;
  3316. MFCSetFlagIsSaved = false;
  3317. }
  3318. }
  3319. else
  3320. {
  3321. MFCSetFlagIsSaved = true;
  3322. foreach (var item in MFCSets)
  3323. {
  3324. item.UndoChanges();
  3325. }
  3326. }
  3327. return true;
  3328. }
  3329. public bool UndoGasChanges()
  3330. {
  3331. if (ValveIsSaved)
  3332. {
  3333. if (DialogButton.Yes == DialogBox.ShowDialog(DialogButton.Yes | DialogButton.No,
  3334. DialogType.CONFIRM,
  3335. $"Recipe Valve is changed Flag, do you want to save it?"))
  3336. {
  3337. ValveIsSaved = false;
  3338. ValveFlagIsSaved = false;
  3339. }
  3340. }
  3341. else
  3342. {
  3343. ValveFlagIsSaved = true;
  3344. foreach (var item in ValveSets)
  3345. {
  3346. item.UndoChanges();
  3347. }
  3348. }
  3349. return true;
  3350. }
  3351. public bool UndoAUXChanges()
  3352. {
  3353. if (AUXIsSaved)
  3354. {
  3355. if (DialogButton.Yes == DialogBox.ShowDialog(DialogButton.Yes | DialogButton.No,
  3356. DialogType.CONFIRM,
  3357. $"Recipe AUX is changed Flag, do you want to save it?"))
  3358. {
  3359. AUXIsSaved = false;
  3360. AUXFlagIsSaved = false;
  3361. }
  3362. }
  3363. else
  3364. {
  3365. AUXFlagIsSaved = true;
  3366. foreach (var item in AUXSets)
  3367. {
  3368. item.UndoChanges();
  3369. }
  3370. }
  3371. return true;
  3372. }
  3373. public bool UndoTemperatureChanges()
  3374. {
  3375. if (TemperatureIsSaved)
  3376. {
  3377. if (DialogButton.Yes == DialogBox.ShowDialog(DialogButton.Yes | DialogButton.No,
  3378. DialogType.CONFIRM,
  3379. $"Recipe Temperature is changed Flag, do you want to save it?"))
  3380. {
  3381. TemperatureIsSaved = false;
  3382. TemperatureSetsFlagIsSaved = false;
  3383. }
  3384. }
  3385. else
  3386. {
  3387. TemperatureSetsFlagIsSaved = true;
  3388. foreach (var item in TemperatureSets)
  3389. {
  3390. item.UndoChanges();
  3391. }
  3392. TemperatureControlMode.UndoChanges();
  3393. TemperatureCorrect.UndoChanges();
  3394. TemperaturePID.UndoChanges();
  3395. }
  3396. return true;
  3397. }
  3398. public bool UndoAlarmChanges()
  3399. {
  3400. if (AlarmIsSaved)
  3401. {
  3402. if (DialogButton.Yes == DialogBox.ShowDialog(DialogButton.Yes | DialogButton.No,
  3403. DialogType.CONFIRM,
  3404. $"Recipe Alarm is changed Flag, do you want to save it?"))
  3405. {
  3406. AlarmIsSaved = false;
  3407. AlarmFlagIsSaved = false;
  3408. }
  3409. }
  3410. else
  3411. {
  3412. AlarmFlagIsSaved = true;
  3413. AlarmIsSaved = true;
  3414. AlarmConditionTable.UndoChanges();
  3415. }
  3416. return true;
  3417. }
  3418. public bool UndoPressChanges()
  3419. {
  3420. if (PressIsSaved)
  3421. {
  3422. if (DialogButton.Yes == DialogBox.ShowDialog(DialogButton.Yes | DialogButton.No,
  3423. DialogType.CONFIRM,
  3424. $"Recipe Press is changed Flag, do you want to save it?"))
  3425. {
  3426. PressIsSaved = false;
  3427. PressFlagIsSaved = false;
  3428. }
  3429. }
  3430. else
  3431. {
  3432. PressFlagIsSaved = true;
  3433. PressCommand.UndoChanges();
  3434. PressPID.UndoChanges();
  3435. PressSet.UndoChanges();
  3436. PressSlowVacSet.UndoChanges();
  3437. PressValveAngleSet.UndoChanges();
  3438. PressLowPressWait.UndoChanges();
  3439. WaitPress.UndoChanges();
  3440. }
  3441. return true;
  3442. }
  3443. public bool UndoLoaderChanges()
  3444. {
  3445. if (LoaderIsSaved)
  3446. {
  3447. if (DialogButton.Yes == DialogBox.ShowDialog(DialogButton.Yes | DialogButton.No,
  3448. DialogType.CONFIRM,
  3449. $"Recipe Loader is changed Flag, do you want to save it?"))
  3450. {
  3451. LoaderIsSaved = false;
  3452. }
  3453. }
  3454. else
  3455. {
  3456. LoaderIsSaved = true;
  3457. LoaderCommand.UndoChanges();
  3458. LoaderSpeed1.UndoChanges();
  3459. LoaderSpeed2.UndoChanges();
  3460. LoaderSpeed3.UndoChanges();
  3461. LoaderRPM.UndoChanges();
  3462. }
  3463. return true;
  3464. }
  3465. public string Value { get; set; }
  3466. private int _stepNo;
  3467. public int StepNo
  3468. {
  3469. get => _stepNo; set
  3470. {
  3471. _stepNo = value;
  3472. NotifyOfPropertyChange("StepNo");
  3473. }
  3474. }
  3475. private string _name;
  3476. public string Name
  3477. {
  3478. get => _name; set
  3479. {
  3480. _name = value;
  3481. NotifyOfPropertyChange("Name");
  3482. }
  3483. }
  3484. public string EndBy { get; set; }
  3485. public string Time { get; set; }
  3486. public string SkipWait { get; set; }
  3487. public string Command { get; set; }
  3488. public bool IsChecked { get; set; }
  3489. public Visibility IsVisibility { get; set; } = Visibility.Visible;
  3490. public bool IsnoneConditionCheck { get; set; }
  3491. public string[] ExternalSensorName { get; set; } = new string[] { "SensorTubeATMPressure", "SensorASOpenPosition", "SensorASClosePosition", "SensorEXTIN4", "SensorEXTIN5", "SensorEXTIN6", "SensorEXTIN7" };
  3492. public string[] ExternalSensor { get; set; } = new string[] { "None", "None", "None", "None", "None", "None", "None" };
  3493. public string TempStabilizeSelected { get; set; }
  3494. public string FinishAutoProfile { get; set; }
  3495. public string ReachTemp { get; set; }
  3496. public double ReachTempValue { get; set; }
  3497. public string O2Density { get; set; }
  3498. public int O2DensityValue { get; set; }
  3499. public string ReachPressure { get; set; }
  3500. public string ReachPressureVG { get; set; }
  3501. public string PressureStabilizeVG { get; set; }
  3502. public double ReachPressureValue { get; set; }
  3503. public string PressureStabilizeSelected { get; set; }
  3504. public string ProcessTimeToEnd { get; set; }
  3505. //public string PressureSonserValue { get; set; }
  3506. //public string PressureValveAngle { get; set; }
  3507. //public string PressureSettingVG { get; set; }
  3508. //public string SlowVacuumValue { get; set; }
  3509. //public string PressureAlarmTableNo { get; set; }
  3510. //public string ZAxisPosition { get; set; }
  3511. //public string ZAxisSpeed { get; set; }
  3512. //public string RotatePosition { get; set; }
  3513. public string AbortRecipeTableIndex { get; set; }
  3514. //public string RFSwitch { get; set; }
  3515. //public string RFSetpoint { get; set; }
  3516. //public string RFPowerSetpoint { get; set; }
  3517. //public string C1Setpoint { get; set; }
  3518. //public string C2Setpoint { get; set; }
  3519. //public string ForwardPowerAlarmWatchTable { get; set; }
  3520. //public string PrAlarmWatchTable { get; set; }
  3521. //public string PIAlarmWatchTable { get; set; }
  3522. //public string C1AlarmWatchTable { get; set; }
  3523. //public string C2AlarmWatchTable { get; set; }
  3524. //public string VppAlarmWatchTable { get; set; }
  3525. //public string VdcAlarmWatchTable { get; set; }
  3526. /// <summary>
  3527. /// R 轴方向,CCW(逆时针),CW(顺时针)
  3528. /// </summary>
  3529. // public string RotateDirection { get; set; }
  3530. //public string RotateSpeed { get; set; }
  3531. //public string RotateInterval { get; set; }
  3532. //public string APC_SetPressure { get; set; }
  3533. private bool _mFCSetFlagIsSaved = true;
  3534. public bool MFCSetFlagIsSaved
  3535. {
  3536. get => _mFCSetFlagIsSaved;
  3537. set
  3538. {
  3539. _mFCSetFlagIsSaved = value;
  3540. NotifyOfPropertyChange(nameof(MFCSetFlagIsSaved));
  3541. }
  3542. }
  3543. private bool _mFCIsSaved = true;
  3544. public bool MFCIsSaved
  3545. {
  3546. get => _mFCIsSaved;
  3547. set
  3548. {
  3549. _mFCIsSaved = value;
  3550. NotifyOfPropertyChange(nameof(MFCIsSaved));
  3551. }
  3552. }
  3553. private bool _temperatureSetsFlagIsSaved = true;
  3554. public bool TemperatureSetsFlagIsSaved
  3555. {
  3556. get => _temperatureSetsFlagIsSaved;
  3557. set
  3558. {
  3559. _temperatureSetsFlagIsSaved = value;
  3560. NotifyOfPropertyChange(nameof(TemperatureSetsFlagIsSaved));
  3561. }
  3562. }
  3563. private bool _temperatureIsSaved = true;
  3564. public bool TemperatureIsSaved
  3565. {
  3566. get => _temperatureIsSaved;
  3567. set
  3568. {
  3569. _temperatureIsSaved = value;
  3570. NotifyOfPropertyChange(nameof(TemperatureIsSaved));
  3571. }
  3572. }
  3573. private bool _valveFlagIsSaved = true;
  3574. public bool ValveFlagIsSaved
  3575. {
  3576. get => _valveFlagIsSaved;
  3577. set
  3578. {
  3579. _valveFlagIsSaved = value;
  3580. NotifyOfPropertyChange(nameof(ValveFlagIsSaved));
  3581. }
  3582. }
  3583. private bool _valveIsSaved = true;
  3584. public bool ValveIsSaved
  3585. {
  3586. get => _valveIsSaved;
  3587. set
  3588. {
  3589. _valveIsSaved = value;
  3590. NotifyOfPropertyChange(nameof(ValveIsSaved));
  3591. }
  3592. }
  3593. private bool _auxFlagIsSaved = true;
  3594. public bool AUXFlagIsSaved
  3595. {
  3596. get => _auxFlagIsSaved;
  3597. set
  3598. {
  3599. _auxFlagIsSaved = value;
  3600. NotifyOfPropertyChange(nameof(AUXFlagIsSaved));
  3601. }
  3602. }
  3603. private bool _auxIsSaved = true;
  3604. public bool AUXIsSaved
  3605. {
  3606. get => _auxIsSaved;
  3607. set
  3608. {
  3609. _auxIsSaved = value;
  3610. NotifyOfPropertyChange(nameof(AUXIsSaved));
  3611. }
  3612. }
  3613. private bool _loaderIsSaved = true;
  3614. public bool LoaderIsSaved
  3615. {
  3616. get => _loaderIsSaved;
  3617. set
  3618. {
  3619. _loaderIsSaved = value;
  3620. NotifyOfPropertyChange(nameof(LoaderIsSaved));
  3621. }
  3622. }
  3623. private bool _pressFlagIsSaved = true;
  3624. public bool PressFlagIsSaved
  3625. {
  3626. get => _pressFlagIsSaved;
  3627. set
  3628. {
  3629. _pressFlagIsSaved = value;
  3630. NotifyOfPropertyChange(nameof(PressFlagIsSaved));
  3631. }
  3632. }
  3633. private bool _pressIsSaved = true;
  3634. public bool PressIsSaved
  3635. {
  3636. get => _pressIsSaved;
  3637. set
  3638. {
  3639. _pressIsSaved = value;
  3640. NotifyOfPropertyChange(nameof(PressIsSaved));
  3641. }
  3642. }
  3643. private bool _alarmFlagIsSaved = true;
  3644. public bool AlarmFlagIsSaved
  3645. {
  3646. get => _alarmFlagIsSaved;
  3647. set
  3648. {
  3649. _alarmFlagIsSaved = value;
  3650. NotifyOfPropertyChange(nameof(AlarmFlagIsSaved));
  3651. }
  3652. }
  3653. private bool _alarmIsSaved = true;
  3654. public bool AlarmIsSaved
  3655. {
  3656. get => _alarmIsSaved;
  3657. set
  3658. {
  3659. _alarmIsSaved = value;
  3660. NotifyOfPropertyChange(nameof(AlarmIsSaved));
  3661. }
  3662. }
  3663. public string GasLineN2_Flow { get; set; }
  3664. public string GasLineN3_Flow { get; set; }
  3665. public MFMValue MfmD1Flow { get; set; }
  3666. public ObservableCollection<BoolParam> ValveSets { get; set; } = new ObservableCollection<BoolParam>();
  3667. //public Dictionary<string, MFCData> MFCSets { get; set; } = new Dictionary<string, MFCData>();
  3668. public ObservableCollection<MFCData> MFCSets { get; set; } = new ObservableCollection<MFCData>();
  3669. public Dictionary<string, MFMValue> MFMSets { get; set; } = new Dictionary<string, MFMValue>();
  3670. public Dictionary<string, bool> EXOUSets { get; set; } = new Dictionary<string, bool>();
  3671. public ObservableCollection<TempSetData> TemperatureSets { get; set; } = new ObservableCollection<TempSetData>();
  3672. public Dictionary<string, Dictionary<int, VPData>> VPSets { get; set; } = new Dictionary<string, Dictionary<int, VPData>>();
  3673. public ObservableCollection<AUXData> AUXSets { get; set; } = new ObservableCollection<AUXData>();
  3674. private void Temperature_PropertyChanged(object sender, PropertyChangedEventArgs e)
  3675. {
  3676. if (e.PropertyName == nameof(StringParam.IsSaved))
  3677. {
  3678. SetTemperatureIsSaved();
  3679. }
  3680. else if (e.PropertyName == "Value")
  3681. {
  3682. if (sender is Param)
  3683. {
  3684. if (((Param)sender).IsSaved) return;
  3685. SetValueEventArgs setValueEventArgs = new SetValueEventArgs();
  3686. setValueEventArgs.Sender = this;
  3687. setValueEventArgs.ValueName = ((Param)sender).Name;
  3688. setValueEventArgs.PropertyName = ((Param)sender).Name;
  3689. if (sender is DoubleParam)
  3690. {
  3691. setValueEventArgs.PropertyValue = ((DoubleParam)sender).Value;
  3692. OnTempValueChanged(setValueEventArgs);
  3693. }
  3694. else if (sender is StringParam)
  3695. {
  3696. var tempObj = sender as StringParam;
  3697. if (tempObj.Name == "TemperatureControlMode" || tempObj.Name == "TemperatureCorrect" || tempObj.Name == "TemperaturePID")
  3698. setValueEventArgs.PropertyValue = ((StringParam)sender).Value;
  3699. if (((StringParam)sender).OldValue != ((StringParam)sender).Value)
  3700. {
  3701. OnTempValueChanged(setValueEventArgs);
  3702. }
  3703. }
  3704. }
  3705. }
  3706. }
  3707. private void OtherTemperature_PropertyChanged(object sender, PropertyChangedEventArgs e)
  3708. {
  3709. if (e.PropertyName == nameof(StringParam.IsSaved))
  3710. {
  3711. SetTemperatureIsSaved();
  3712. }
  3713. else if (e.PropertyName == "Value")
  3714. {
  3715. if (sender is Param)
  3716. {
  3717. if (((Param)sender).IsSaved) return;
  3718. SetValueEventArgs setValueEventArgs = new SetValueEventArgs();
  3719. setValueEventArgs.Sender = this;
  3720. setValueEventArgs.ValueName = ((Param)sender).Name;
  3721. setValueEventArgs.PropertyName = ((Param)sender).Name;
  3722. if (sender is DoubleParam)
  3723. {
  3724. setValueEventArgs.PropertyValue = ((DoubleParam)sender).Value;
  3725. OnOhterTempValueChanged(setValueEventArgs);
  3726. }
  3727. else if (sender is StringParam)
  3728. {
  3729. var tempObj = sender as StringParam;
  3730. if (tempObj.Name == "TemperatureControlMode" || tempObj.Name == "TemperatureCorrect" || tempObj.Name == "TemperaturePID")
  3731. {
  3732. setValueEventArgs.PropertyValue = ((StringParam)sender).Value;
  3733. //if (((StringParam)sender).OldValue != ((StringParam)sender).Value)
  3734. //{
  3735. OnOhterTempValueChanged(setValueEventArgs);
  3736. //}
  3737. }
  3738. }
  3739. }
  3740. }
  3741. }
  3742. private StringParam _temperatureControlMode;
  3743. public StringParam TemperatureControlMode
  3744. {
  3745. get => _temperatureControlMode;
  3746. set
  3747. {
  3748. _temperatureControlMode = value;
  3749. _temperatureControlMode.PropertyChanged += OtherTemperature_PropertyChanged;
  3750. NotifyOfPropertyChange(nameof(TemperatureControlMode));
  3751. }
  3752. }
  3753. private StringParam _temperatureCorrect;
  3754. public StringParam TemperatureCorrect
  3755. {
  3756. get => _temperatureCorrect;
  3757. set
  3758. {
  3759. _temperatureCorrect = value;
  3760. _temperatureCorrect.PropertyChanged += OtherTemperature_PropertyChanged;
  3761. NotifyOfPropertyChange(nameof(TemperatureCorrect));
  3762. }
  3763. }
  3764. private StringParam _temperaturePID;
  3765. public StringParam TemperaturePID
  3766. {
  3767. get => _temperaturePID;
  3768. set
  3769. {
  3770. _temperaturePID = value;
  3771. _temperaturePID.PropertyChanged += OtherTemperature_PropertyChanged;
  3772. NotifyOfPropertyChange(nameof(TemperaturePID));
  3773. }
  3774. }
  3775. private StringParam _loaderCommand = new StringParam() { Name = "LoaderCommand", Value = "None" };
  3776. public StringParam LoaderCommand
  3777. {
  3778. get => _loaderCommand;
  3779. set
  3780. {
  3781. _loaderCommand = value;
  3782. _loaderCommand.PropertyChanged += LoaderIsSaved_PropertyChanged;
  3783. NotifyOfPropertyChange(nameof(LoaderCommand));
  3784. }
  3785. }
  3786. private DoubleParam _loaderSpeed1 = new DoubleParam() { Name = "LoaderSpeed1", Value = "0" };
  3787. public DoubleParam LoaderSpeed1
  3788. {
  3789. get => _loaderSpeed1;
  3790. set
  3791. {
  3792. _loaderSpeed1 = value;
  3793. _loaderSpeed1.PropertyChanged += LoaderIsSaved_PropertyChanged;
  3794. NotifyOfPropertyChange(nameof(LoaderSpeed1));
  3795. }
  3796. }
  3797. private DoubleParam _loaderSpeed2 = new DoubleParam() { Name = "LoaderSpeed2", Value = "0" };
  3798. public DoubleParam LoaderSpeed2
  3799. {
  3800. get => _loaderSpeed2;
  3801. set
  3802. {
  3803. _loaderSpeed2 = value;
  3804. _loaderSpeed2.PropertyChanged += LoaderIsSaved_PropertyChanged;
  3805. NotifyOfPropertyChange(nameof(LoaderSpeed2));
  3806. }
  3807. }
  3808. private DoubleParam _loaderSpeed3 = new DoubleParam() { Name = "LoaderSpeed3", Value = "0" };
  3809. public DoubleParam LoaderSpeed3
  3810. {
  3811. get => _loaderSpeed3;
  3812. set
  3813. {
  3814. _loaderSpeed3 = value;
  3815. _loaderSpeed3.PropertyChanged += LoaderIsSaved_PropertyChanged;
  3816. NotifyOfPropertyChange(nameof(LoaderSpeed3));
  3817. }
  3818. }
  3819. private DoubleParam _loaderRPM = new DoubleParam() { Name = "LoaderRPM", Value = "0" };
  3820. public DoubleParam LoaderRPM
  3821. {
  3822. get => _loaderRPM;
  3823. set
  3824. {
  3825. _loaderRPM = value;
  3826. _loaderRPM.PropertyChanged += LoaderIsSaved_PropertyChanged;
  3827. NotifyOfPropertyChange(nameof(LoaderRPM));
  3828. }
  3829. }
  3830. public StringParam _pressCommand = new StringParam() { Name = "PressCommand", Value = "None" };
  3831. public StringParam PressCommand
  3832. {
  3833. get => _pressCommand;
  3834. set
  3835. {
  3836. _pressCommand = value;
  3837. _pressCommand.PropertyChanged += PressureIsSaved_PropertyChanged;
  3838. NotifyOfPropertyChange(nameof(PressCommand));
  3839. }
  3840. }
  3841. private StringParam _pressPID = new StringParam() { Name = "PressPID", Value = "" };
  3842. public StringParam PressPID
  3843. {
  3844. get => _pressPID;
  3845. set
  3846. {
  3847. _pressPID = value;
  3848. _pressPID.PropertyChanged += PressureIsSaved_PropertyChanged;
  3849. NotifyOfPropertyChange(nameof(_pressPID));
  3850. }
  3851. }
  3852. private DoubleParam _pressSet = new DoubleParam() { Name = "PressSet", Value = "0" };
  3853. public DoubleParam PressSet
  3854. {
  3855. get => _pressSet;
  3856. set
  3857. {
  3858. _pressSet = value;
  3859. _pressSet.PropertyChanged += PressureIsSaved_PropertyChanged;
  3860. NotifyOfPropertyChange(nameof(PressSet));
  3861. }
  3862. }
  3863. private StringParam _pressValveAngleSet = new StringParam() { Name = "PressValveAngleSet", Value = "0" };
  3864. public StringParam PressValveAngleSet
  3865. {
  3866. get => _pressValveAngleSet;
  3867. set
  3868. {
  3869. _pressValveAngleSet = value;
  3870. _pressValveAngleSet.PropertyChanged += PressureIsSaved_PropertyChanged;
  3871. NotifyOfPropertyChange(nameof(PressValveAngleSet));
  3872. }
  3873. }
  3874. private DoubleParam _pressSlowVacSet = new DoubleParam() { Name = "PressSlowVacSet", Value = "0" };
  3875. public DoubleParam PressSlowVacSet
  3876. {
  3877. get => _pressSlowVacSet;
  3878. set
  3879. {
  3880. _pressSlowVacSet = value;
  3881. _pressSlowVacSet.PropertyChanged += PressureIsSaved_PropertyChanged;
  3882. NotifyOfPropertyChange(nameof(PressSlowVacSet));
  3883. }
  3884. }
  3885. private BoolParam _pressIsWait = new BoolParam() { Name = "PressIsWait", Value = false };
  3886. public BoolParam PressIsWait
  3887. {
  3888. get => _pressIsWait;
  3889. set
  3890. {
  3891. _pressIsWait = value;
  3892. _pressIsWait.PropertyChanged += PressureIsSaved_PropertyChanged;
  3893. NotifyOfPropertyChange(nameof(PressIsWait));
  3894. }
  3895. }
  3896. private StringParam _pressLowWait = new StringParam() { Name = "PressLowWait", Value = "0" };
  3897. public StringParam PressLowWait
  3898. {
  3899. get => _pressLowWait;
  3900. set
  3901. {
  3902. _pressLowWait = value;
  3903. _pressLowWait.PropertyChanged += PressureIsSaved_PropertyChanged;
  3904. NotifyOfPropertyChange(nameof(PressLowWait));
  3905. }
  3906. }
  3907. public StringParam _pressHighWait = new StringParam() { Name = "PressHighWait", Value = "0" };
  3908. public StringParam PressHighWait
  3909. {
  3910. get => _pressHighWait;
  3911. set
  3912. {
  3913. _pressHighWait = value;
  3914. _pressHighWait.PropertyChanged += PressureIsSaved_PropertyChanged;
  3915. NotifyOfPropertyChange(nameof(PressHighWait));
  3916. }
  3917. }
  3918. private StringParam _pressWaitUnit = new StringParam() { Name = "PressWaitUnit", Value = "Torr" };
  3919. public StringParam PressWaitUnit
  3920. {
  3921. get => _pressWaitUnit;
  3922. set
  3923. {
  3924. _pressWaitUnit = value;
  3925. _pressWaitUnit.PropertyChanged += PressureIsSaved_PropertyChanged;
  3926. NotifyOfPropertyChange(nameof(PressWaitUnit));
  3927. }
  3928. }
  3929. private StringParam _pressLowPressWait = new StringParam() { Name = "PressLowPressWait", Value = "None" };
  3930. public StringParam PressLowPressWait
  3931. {
  3932. get => _pressLowPressWait;
  3933. set
  3934. {
  3935. _pressLowPressWait = value;
  3936. _pressLowPressWait.PropertyChanged += PressureIsSaved_PropertyChanged;
  3937. NotifyOfPropertyChange(nameof(PressLowPressWait));
  3938. }
  3939. }
  3940. private StringParam _waitPress = new StringParam() { Name = "WaitPress", Value = "0" };
  3941. public StringParam WaitPress
  3942. {
  3943. get => _waitPress;
  3944. set
  3945. {
  3946. _waitPress = value;
  3947. _waitPress.PropertyChanged += PressureIsSaved_PropertyChanged;
  3948. NotifyOfPropertyChange(nameof(WaitPress));
  3949. }
  3950. }
  3951. //public string TemperatureProfile { get; set; }
  3952. //public string TemperatureAlarm { get; set; }
  3953. //public string CAPTemperatureAlarm { get; set; }
  3954. //public string CAPSetValue { get; set; }
  3955. //public string CAPRampingValue { get; set; }
  3956. //public string TemperatureStabilize { get; set; }
  3957. //public bool TemperatureReadyCond { get; set; }
  3958. private StringParam _alarmConditionTable = new StringParam() { Name = "AlarmConditionTable", Value = "" };
  3959. public StringParam AlarmConditionTable
  3960. {
  3961. get => _alarmConditionTable;
  3962. set
  3963. {
  3964. _alarmConditionTable = value;
  3965. _alarmConditionTable.PropertyChanged += AlarmIsSaved_PropertyChanged;
  3966. NotifyOfPropertyChange(nameof(AlarmConditionTable));
  3967. }
  3968. }
  3969. //public string EventSetting { get; set; }
  3970. public string FilmThickFormula { get; set; }
  3971. public Dictionary<int, AlarmAction> AlarmActionSets { get; set; } = new Dictionary<int, AlarmAction>();
  3972. public string DictionaryStepTime(Dictionary<string, string> steptimes)
  3973. {
  3974. if (steptimes == null) return null;
  3975. StringBuilder rtn = new StringBuilder();
  3976. foreach (var item in steptimes.Keys)
  3977. {
  3978. if (steptimes[item] == "00:00:00") continue;
  3979. rtn.Append($"{item},{steptimes[item]};");
  3980. }
  3981. if (rtn.Length > 0) rtn.Remove(rtn.Length - 1, 1);
  3982. return rtn.ToString();
  3983. }
  3984. public Dictionary<string, string> StepTimeToDictionary(string stepTime)
  3985. {
  3986. Dictionary<string, string> steptimes = new Dictionary<string, string>();
  3987. string[] tempTimes = stepTime.Split(';');
  3988. foreach (var item in tempTimes)
  3989. {
  3990. string[] subTimes = item.Split(',');
  3991. steptimes.Add(subTimes[0], subTimes[1]);
  3992. }
  3993. return steptimes;
  3994. }
  3995. }
  3996. public class AlarmAction
  3997. {
  3998. public string PtocessingType { get; set; }
  3999. public string PtocessingDetails { get; set; }
  4000. }
  4001. public class MFMValue : PropertyChangedBase
  4002. {
  4003. private string _name;
  4004. public string Name
  4005. {
  4006. get => _name;
  4007. set
  4008. {
  4009. _name = value;
  4010. NotifyOfPropertyChange("Name");
  4011. }
  4012. }
  4013. private string _value;
  4014. public string Value
  4015. {
  4016. get => _value;
  4017. set
  4018. {
  4019. _value = value;
  4020. NotifyOfPropertyChange("Value");
  4021. }
  4022. }
  4023. private string _alarmValue;
  4024. public string AlarmValue
  4025. {
  4026. get => _alarmValue; set
  4027. {
  4028. _alarmValue = value;
  4029. NotifyOfPropertyChange("AlarmValue");
  4030. }
  4031. }
  4032. public override string ToString()
  4033. {
  4034. return $"{Value};{AlarmValue}";
  4035. }
  4036. }
  4037. public class MFMData : MFCData
  4038. { }
  4039. public class MFCData : PropertyChangedBase
  4040. {
  4041. public delegate void ValueChangedEventHandler(object sender, SetValueEventArgs e);
  4042. public event ValueChangedEventHandler ValueChangedEvent;
  4043. public MFCData()
  4044. {
  4045. }
  4046. public void OnValueChanged(SetValueEventArgs e)
  4047. {
  4048. if (ValueChangedEvent != null)
  4049. {
  4050. ValueChangedEvent(this, e);
  4051. }
  4052. }
  4053. private bool _flagIsSaved = true;
  4054. public bool FlagIsSaved
  4055. {
  4056. get => _flagIsSaved;
  4057. set
  4058. {
  4059. _flagIsSaved = value;
  4060. NotifyOfPropertyChange(nameof(FlagIsSaved));
  4061. NotifyOfPropertyChange(nameof(IsSaved));
  4062. }
  4063. }
  4064. public bool IsSaved
  4065. {
  4066. get
  4067. {
  4068. if (SetValue.IsSaved && SetUnit.IsSaved && Rampng.IsSaved && RampngUnit.IsSaved && IsCheck.IsSaved && MaxValue.IsSaved && MinValue.IsSaved)
  4069. {
  4070. if (FlagIsSaved)
  4071. {
  4072. return true;
  4073. }
  4074. else
  4075. {
  4076. return false;
  4077. }
  4078. }
  4079. else
  4080. {
  4081. return false;
  4082. }
  4083. }
  4084. }
  4085. public bool UndoChanges()
  4086. {
  4087. Type type = this.GetType();
  4088. PropertyInfo[] properties = type.GetProperties();
  4089. foreach (var item in properties)
  4090. {
  4091. var obj = item.GetValue(this);
  4092. if (obj is Param)
  4093. {
  4094. ((Param)obj).UndoChanges();
  4095. }
  4096. }
  4097. FlagIsSaved = true;
  4098. return true;
  4099. }
  4100. private void ParamIsSaved_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
  4101. {
  4102. if (e.PropertyName == "IsSaved")
  4103. {
  4104. NotifyOfPropertyChange("IsSaved");
  4105. }
  4106. else if (e.PropertyName == "Value")
  4107. {
  4108. if (sender is Param)
  4109. {
  4110. if (((Param)sender).IsSaved) return;
  4111. SetValueEventArgs tempSetEventArgs = new SetValueEventArgs();
  4112. tempSetEventArgs.Sender = this;
  4113. tempSetEventArgs.ValueName = this.ControlName;
  4114. tempSetEventArgs.PropertyName = ((Param)sender).Name;
  4115. if (sender is DoubleParam)
  4116. {
  4117. tempSetEventArgs.PropertyValue = ((DoubleParam)sender).Value;
  4118. OnValueChanged(tempSetEventArgs);
  4119. }
  4120. else if (sender is IntParam)
  4121. {
  4122. tempSetEventArgs.PropertyValue = ((IntParam)sender).Value.ToString();
  4123. OnValueChanged(tempSetEventArgs);
  4124. }
  4125. else if (sender is StringParam)
  4126. {
  4127. tempSetEventArgs.PropertyValue = ((StringParam)sender).Value;
  4128. OnValueChanged(tempSetEventArgs);
  4129. }
  4130. else if (sender is BoolParam)
  4131. {
  4132. tempSetEventArgs.PropertyValue = ((BoolParam)sender).Value.ToString();
  4133. OnValueChanged(tempSetEventArgs);
  4134. }
  4135. }
  4136. }
  4137. }
  4138. private int _no;
  4139. public int No
  4140. {
  4141. get => _no;
  4142. set
  4143. {
  4144. _no = value;
  4145. NotifyOfPropertyChange("No");
  4146. }
  4147. }
  4148. private string _name;
  4149. public string Name
  4150. {
  4151. get => _name;
  4152. set
  4153. {
  4154. _name = value;
  4155. NotifyOfPropertyChange("Name");
  4156. }
  4157. }
  4158. public string _unit;
  4159. public string Unit
  4160. {
  4161. get => _unit;
  4162. set
  4163. {
  4164. _unit = value;
  4165. NotifyOfPropertyChange("Unit");
  4166. }
  4167. }
  4168. private string _scaleValue;
  4169. public string ScaleValue
  4170. {
  4171. get => _scaleValue;
  4172. set
  4173. {
  4174. _scaleValue = value;
  4175. NotifyOfPropertyChange("ScaleValue");
  4176. }
  4177. }
  4178. private string _displayName;
  4179. public string DisplayName
  4180. {
  4181. get => _displayName;
  4182. set
  4183. {
  4184. _displayName = value;
  4185. NotifyOfPropertyChange("DisplayName");
  4186. }
  4187. }
  4188. private string _controlName;
  4189. public string ControlName
  4190. {
  4191. get => _controlName;
  4192. set
  4193. {
  4194. _controlName = value;
  4195. NotifyOfPropertyChange("ControlName");
  4196. }
  4197. }
  4198. private StringParam _setValue;
  4199. public StringParam SetValue
  4200. {
  4201. get => _setValue;
  4202. set
  4203. {
  4204. if (_setValue != null)
  4205. {
  4206. _setValue.PropertyChanged -= ParamIsSaved_PropertyChanged;
  4207. }
  4208. _setValue = value;
  4209. _setValue.PropertyChanged += ParamIsSaved_PropertyChanged;
  4210. NotifyOfPropertyChange(nameof(SetValue));
  4211. }
  4212. }
  4213. private StringParam _setUnit = new StringParam() { Name = "SetUnit", Value = "SLM" };
  4214. public StringParam SetUnit
  4215. {
  4216. get => _setUnit;
  4217. set
  4218. {
  4219. if (_setUnit != null)
  4220. {
  4221. _setUnit.PropertyChanged -= ParamIsSaved_PropertyChanged;
  4222. }
  4223. _setUnit = value;
  4224. _setUnit.PropertyChanged += ParamIsSaved_PropertyChanged;
  4225. NotifyOfPropertyChange(nameof(SetUnit));
  4226. }
  4227. }
  4228. private StringParam _rampngUnit = new StringParam() { Name = "RampngUnit", Value = "SLM" };
  4229. public StringParam RampngUnit
  4230. {
  4231. get => _rampngUnit;
  4232. set
  4233. {
  4234. if (_rampngUnit != null)
  4235. {
  4236. _rampngUnit.PropertyChanged -= ParamIsSaved_PropertyChanged;
  4237. }
  4238. _rampngUnit = value;
  4239. _rampngUnit.PropertyChanged += ParamIsSaved_PropertyChanged;
  4240. NotifyOfPropertyChange("RampngUnit");
  4241. }
  4242. }
  4243. private DoubleParam _rampng;
  4244. public DoubleParam Rampng
  4245. {
  4246. get => _rampng;
  4247. set
  4248. {
  4249. if (_rampng != null)
  4250. {
  4251. _rampng.PropertyChanged -= ParamIsSaved_PropertyChanged;
  4252. }
  4253. _rampng = value;
  4254. NotifyOfPropertyChange("Rampng");
  4255. _rampng.PropertyChanged += ParamIsSaved_PropertyChanged;
  4256. }
  4257. }
  4258. private string _alarmValue;
  4259. public string AlarmValue
  4260. {
  4261. get => _alarmValue; set
  4262. {
  4263. _alarmValue = value;
  4264. NotifyOfPropertyChange("AlarmValue");
  4265. }
  4266. }
  4267. private DoubleParam _maxValue = new DoubleParam() { Name = "MaxValue", Value = "0" };
  4268. public DoubleParam MaxValue
  4269. {
  4270. get => _maxValue; set
  4271. {
  4272. if (_maxValue != null)
  4273. {
  4274. _maxValue.PropertyChanged -= ParamIsSaved_PropertyChanged;
  4275. }
  4276. _maxValue = value;
  4277. _maxValue.PropertyChanged += ParamIsSaved_PropertyChanged;
  4278. NotifyOfPropertyChange("MaxValue");
  4279. }
  4280. }
  4281. private DoubleParam _minValue = new DoubleParam() { Name = "MinValue", Value = "0" };
  4282. public DoubleParam MinValue
  4283. {
  4284. get => _minValue; set
  4285. {
  4286. if (_minValue != null)
  4287. {
  4288. _minValue.PropertyChanged -= ParamIsSaved_PropertyChanged;
  4289. }
  4290. _minValue = value;
  4291. _minValue.PropertyChanged += ParamIsSaved_PropertyChanged;
  4292. NotifyOfPropertyChange("MinValue");
  4293. }
  4294. }
  4295. private BoolParam _isCheck = new BoolParam() { Name = "IsCheck", Value = true };
  4296. public BoolParam IsCheck
  4297. {
  4298. get => _isCheck;
  4299. set
  4300. {
  4301. if (_isCheck != null)
  4302. {
  4303. _isCheck.PropertyChanged -= ParamIsSaved_PropertyChanged;
  4304. }
  4305. _isCheck = value;
  4306. _isCheck.PropertyChanged += ParamIsSaved_PropertyChanged;
  4307. NotifyOfPropertyChange("IsCheck");
  4308. }
  4309. }
  4310. private bool _isEnable = true;
  4311. public bool IsEnable
  4312. {
  4313. get => _isEnable;
  4314. set
  4315. {
  4316. _isEnable = value;
  4317. NotifyOfPropertyChange("IsEnable");
  4318. }
  4319. }
  4320. }
  4321. public class TempSetData : PropertyChangedBase
  4322. {
  4323. public delegate void ValueChangedEventHandler(object sender, SetValueEventArgs e);
  4324. public event ValueChangedEventHandler ValueChangedEvent;
  4325. public void OnValueChanged(SetValueEventArgs e)
  4326. {
  4327. if (ValueChangedEvent != null)
  4328. {
  4329. ValueChangedEvent(this, e);
  4330. }
  4331. }
  4332. public TempSetData() { }
  4333. public bool UndoChanges()
  4334. {
  4335. Type type = this.GetType();
  4336. PropertyInfo[] properties = type.GetProperties();
  4337. foreach (var item in properties)
  4338. {
  4339. var obj = item.GetValue(this);
  4340. if (obj is Param)
  4341. {
  4342. ((Param)obj).UndoChanges();
  4343. }
  4344. }
  4345. return true;
  4346. }
  4347. public bool IsSaved
  4348. {
  4349. get => SetValue.IsSaved && SetUnit.IsSaved && RampngValue.IsSaved && RampngUnit.IsSaved && IsCheck.IsSaved && HighValue.IsSaved && LowValue.IsSaved;
  4350. }
  4351. public TempSetData(string name)
  4352. {
  4353. No = 1;
  4354. Name = name;
  4355. SetValue = new StringParam() { Name = "SetValue", Value = "0" };
  4356. SetUnit = new StringParam() { Name = "SetUnit", Value = "℃" };
  4357. RampngValue = new DoubleParam() { Name = "RampngValue", Value = "0" };
  4358. RampngUnit = new StringParam() { Name = "RampngUnit", Value = "℃/min" };
  4359. IsCheck = new BoolParam() { Name = "IsCheck", Value = false };
  4360. HighValue = new DoubleParam() { Name = "HighValue", Value = "0" };
  4361. LowValue = new DoubleParam() { Name = "LowValue", Value = "0" };
  4362. Unit = "℃";
  4363. }
  4364. private void ParamIsSaved_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
  4365. {
  4366. if (e.PropertyName == nameof(Param.IsSaved))
  4367. {
  4368. NotifyOfPropertyChange(nameof(IsSaved));
  4369. }
  4370. else if (e.PropertyName == "Value")
  4371. {
  4372. if (sender is Param)
  4373. {
  4374. if (((Param)sender).IsSaved) return;
  4375. SetValueEventArgs tempSetEventArgs = new SetValueEventArgs();
  4376. tempSetEventArgs.Sender = this;
  4377. tempSetEventArgs.ValueName = Name;
  4378. tempSetEventArgs.PropertyName = ((Param)sender).Name;
  4379. if (sender is DoubleParam)
  4380. {
  4381. tempSetEventArgs.PropertyValue = ((DoubleParam)sender).Value;
  4382. OnValueChanged(tempSetEventArgs);
  4383. }
  4384. else if (sender is StringParam)
  4385. {
  4386. tempSetEventArgs.PropertyValue = ((StringParam)sender).Value;
  4387. OnValueChanged(tempSetEventArgs);
  4388. }
  4389. }
  4390. }
  4391. }
  4392. public TempSetData(string name, string value) : this(name)
  4393. {
  4394. var listStr = value.Split(';');
  4395. No = 1;
  4396. if (listStr.Length > 8)
  4397. {
  4398. Name = listStr[0];
  4399. SetValue.Value = listStr[1];
  4400. SetUnit.Value = listStr[2];
  4401. RampngValue.Value = listStr[3];
  4402. RampngUnit.Value = listStr[4];
  4403. bool.TryParse(listStr[5], out bool isCheck);
  4404. IsCheck.Value = isCheck;
  4405. double.TryParse(listStr[6], out double highValue);
  4406. HighValue.Value = highValue.ToString();
  4407. double.TryParse(listStr[7], out double lowValue);
  4408. LowValue.Value = lowValue.ToString();
  4409. Unit = listStr[8];
  4410. }
  4411. }
  4412. private int _no;
  4413. public int No
  4414. {
  4415. get => _no;
  4416. set
  4417. {
  4418. _no = value;
  4419. NotifyOfPropertyChange("No");
  4420. }
  4421. }
  4422. private string _name;
  4423. public string Name
  4424. {
  4425. get => _name;
  4426. set
  4427. {
  4428. _name = value;
  4429. NotifyOfPropertyChange("Name");
  4430. }
  4431. }
  4432. private string _displayName;
  4433. public string DisplayName
  4434. {
  4435. get => _displayName;
  4436. set
  4437. {
  4438. _displayName = value;
  4439. NotifyOfPropertyChange("DisplayName");
  4440. }
  4441. }
  4442. private StringParam _setValue;
  4443. public StringParam SetValue
  4444. {
  4445. get => _setValue;
  4446. set
  4447. {
  4448. if (_setValue != null)
  4449. {
  4450. _setValue.PropertyChanged -= ParamIsSaved_PropertyChanged;
  4451. }
  4452. _setValue = value;
  4453. _setValue.PropertyChanged += ParamIsSaved_PropertyChanged;
  4454. NotifyOfPropertyChange("SetValue");
  4455. }
  4456. }
  4457. private StringParam _setUnit;
  4458. public StringParam SetUnit
  4459. {
  4460. get => _setUnit;
  4461. set
  4462. {
  4463. if (_setUnit != null)
  4464. {
  4465. _setUnit.PropertyChanged -= ParamIsSaved_PropertyChanged;
  4466. }
  4467. _setUnit = value;
  4468. _setUnit.PropertyChanged += ParamIsSaved_PropertyChanged;
  4469. NotifyOfPropertyChange("SetUnit");
  4470. }
  4471. }
  4472. private DoubleParam _rampngValue;
  4473. public DoubleParam RampngValue
  4474. {
  4475. get => _rampngValue;
  4476. set
  4477. {
  4478. if (_rampngValue != null)
  4479. {
  4480. _rampngValue.PropertyChanged -= ParamIsSaved_PropertyChanged;
  4481. }
  4482. _rampngValue = value;
  4483. _rampngValue.PropertyChanged += ParamIsSaved_PropertyChanged;
  4484. NotifyOfPropertyChange("RampngValue");
  4485. }
  4486. }
  4487. private StringParam _rampngUnit;
  4488. public StringParam RampngUnit
  4489. {
  4490. get => _rampngUnit;
  4491. set
  4492. {
  4493. if (_rampngUnit != null)
  4494. {
  4495. _rampngUnit.PropertyChanged -= ParamIsSaved_PropertyChanged;
  4496. }
  4497. _rampngUnit = value;
  4498. _rampngUnit.PropertyChanged += ParamIsSaved_PropertyChanged;
  4499. NotifyOfPropertyChange("RampngUnit");
  4500. }
  4501. }
  4502. private StringParam _alarmValue;
  4503. public StringParam AlarmValue
  4504. {
  4505. get => _alarmValue;
  4506. set
  4507. {
  4508. _alarmValue = value;
  4509. NotifyOfPropertyChange("AlarmValue");
  4510. }
  4511. }
  4512. private BoolParam _isCheck;
  4513. public BoolParam IsCheck
  4514. {
  4515. get => _isCheck;
  4516. set
  4517. {
  4518. if (_isCheck != null)
  4519. {
  4520. _isCheck.PropertyChanged -= ParamIsSaved_PropertyChanged;
  4521. }
  4522. _isCheck = value;
  4523. _isCheck.PropertyChanged += ParamIsSaved_PropertyChanged;
  4524. NotifyOfPropertyChange("IsCheck");
  4525. }
  4526. }
  4527. private DoubleParam _highValue;
  4528. public DoubleParam HighValue
  4529. {
  4530. get => _highValue;
  4531. set
  4532. {
  4533. if (_highValue != null)
  4534. {
  4535. _highValue.PropertyChanged -= ParamIsSaved_PropertyChanged;
  4536. }
  4537. _highValue = value;
  4538. _highValue.PropertyChanged += ParamIsSaved_PropertyChanged;
  4539. NotifyOfPropertyChange("HighValue");
  4540. }
  4541. }
  4542. private DoubleParam _lowValue;
  4543. public DoubleParam LowValue
  4544. {
  4545. get => _lowValue;
  4546. set
  4547. {
  4548. if (_lowValue != null)
  4549. {
  4550. _lowValue.PropertyChanged -= ParamIsSaved_PropertyChanged;
  4551. }
  4552. _lowValue = value;
  4553. _lowValue.PropertyChanged += ParamIsSaved_PropertyChanged;
  4554. NotifyOfPropertyChange("LowValue");
  4555. }
  4556. }
  4557. private string _unit;
  4558. public string Unit
  4559. {
  4560. get => _unit;
  4561. set
  4562. {
  4563. _unit = value;
  4564. NotifyOfPropertyChange("Unit");
  4565. }
  4566. }
  4567. public override string ToString()
  4568. {
  4569. return $"{Name};{SetValue.Value};{SetUnit.Value};{RampngValue.Value};{RampngUnit.Value};{IsCheck.Value};{HighValue.Value};{LowValue.Value};{Unit}";
  4570. }
  4571. }
  4572. public class VPData : PropertyChangedBase
  4573. {
  4574. private int _no;
  4575. public int No
  4576. {
  4577. get => _no;
  4578. set
  4579. {
  4580. _no = value;
  4581. NotifyOfPropertyChange("No");
  4582. }
  4583. }
  4584. private string _name;
  4585. public string Name
  4586. {
  4587. get => _name;
  4588. set
  4589. {
  4590. _name = value;
  4591. NotifyOfPropertyChange("Name");
  4592. }
  4593. }
  4594. private bool _isCheck;
  4595. public bool IsCheck
  4596. {
  4597. get => _isCheck;
  4598. set
  4599. {
  4600. _isCheck = value;
  4601. NotifyOfPropertyChange("IsCheck");
  4602. }
  4603. }
  4604. }
  4605. public class Combination : PropertyChangedBase
  4606. {
  4607. public ObservableCollection<Param> Params = new ObservableCollection<Param>();
  4608. public Combination() { }
  4609. public Combination(ObservableCollection<Param> value) : base()
  4610. {
  4611. if (value != null && value.Count > 0)
  4612. {
  4613. Params = value;
  4614. StringParam subRecipe = value.FirstOrDefault(x => x.Name == "Combination.SubRecipe") as StringParam;
  4615. this.SubRecipePath = subRecipe != null ? subRecipe.Value : "";
  4616. StringParam alarmRecipe = value.FirstOrDefault(x => x.Name == "Combination.AlarmRecipe") as StringParam;
  4617. this.AlarmRecipePath = alarmRecipe != null ? alarmRecipe.Value : "";
  4618. StringParam alarmCondition = value.FirstOrDefault(x => x.Name == "Combination.AlarmCondition") as StringParam;
  4619. this.AlarmCondition = alarmCondition != null ? alarmCondition.Value : "";
  4620. StringParam leakCheck = value.FirstOrDefault(x => x.Name == "Combination.LeakCheck") as StringParam;
  4621. this.LeakCheck = leakCheck != null ? leakCheck.Value : "";
  4622. StringParam abortRecipe = value.FirstOrDefault(x => x.Name == "Combination.AbortRecipe") as StringParam;
  4623. this.AbortRecipePath = abortRecipe != null ? abortRecipe.Value : "";
  4624. StringParam pressAPCPID = value.FirstOrDefault(x => x.Name == "Combination.PressAPCPID") as StringParam;
  4625. this.PressAPC = pressAPCPID != null ? pressAPCPID.Value : "";
  4626. StringParam tempCorrection = value.FirstOrDefault(x => x.Name == "Combination.TempCorrection") as StringParam;
  4627. this.TempCorrection = tempCorrection != null ? tempCorrection.Value : "";
  4628. StringParam tempPID = value.FirstOrDefault(x => x.Name == "Combination.TempPID") as StringParam;
  4629. this.TempPID = tempPID != null ? tempPID.Value : "";
  4630. StringParam profileCondition = value.FirstOrDefault(x => x.Name == "Combination.ProfileCondition") as StringParam;
  4631. this.ProfileCondition = profileCondition != null ? profileCondition.Value : "";
  4632. StringParam n2PurgeMode = value.FirstOrDefault(x => x.Name == "N2PurgeMode") as StringParam;
  4633. this.N2PurgeMode = n2PurgeMode != null ? n2PurgeMode.Value : "None";
  4634. }
  4635. }
  4636. public Combination(string value) : base()
  4637. {
  4638. SetCombinationValue(value);
  4639. }
  4640. public void SetCombinationValue(string value)
  4641. {
  4642. if (string.IsNullOrEmpty(value) || !value.Contains(";")) return;
  4643. var strList = value.Split(';');
  4644. foreach (var item in strList)
  4645. {
  4646. var subStrList = item.Split(':');
  4647. if (string.IsNullOrEmpty(subStrList[0]) || subStrList.Length != 2) continue;
  4648. switch (subStrList[0])
  4649. {
  4650. case "SubRecipePath":
  4651. SubRecipePath = subStrList[1];
  4652. break;
  4653. case "AlarmRecipePath":
  4654. AlarmRecipePath = subStrList[1];
  4655. break;
  4656. case "AbortRecipePath":
  4657. AbortRecipePath = subStrList[1];
  4658. break;
  4659. case "AlarmCondition":
  4660. AlarmCondition = subStrList[1];
  4661. break;
  4662. case "LeakCheck":
  4663. LeakCheck = subStrList[1];
  4664. break;
  4665. case "PressAPC":
  4666. PressAPC = subStrList[1];
  4667. break;
  4668. case "TempCorrect":
  4669. TempCorrection = subStrList[1];
  4670. break;
  4671. case "TempPID":
  4672. TempPID = subStrList[1];
  4673. break;
  4674. case "ProfileCondition":
  4675. ProfileCondition = subStrList[1];
  4676. break;
  4677. default:
  4678. break;
  4679. }
  4680. }
  4681. }
  4682. private string _subRecipePath = "";
  4683. public string SubRecipePath
  4684. {
  4685. get => _subRecipePath;
  4686. set
  4687. {
  4688. _subRecipePath = value;
  4689. NotifyOfPropertyChange("SubRecipePath");
  4690. }
  4691. }
  4692. private string _alarmRecipePath = "";
  4693. public string AlarmRecipePath
  4694. {
  4695. get => _alarmRecipePath;
  4696. set
  4697. {
  4698. _alarmRecipePath = value;
  4699. NotifyOfPropertyChange("AlarmRecipePath");
  4700. }
  4701. }
  4702. private string _alarmCondition = "";
  4703. public string AlarmCondition
  4704. {
  4705. get => _alarmCondition;
  4706. set
  4707. {
  4708. _alarmCondition = value;
  4709. NotifyOfPropertyChange("AlarmCondition");
  4710. }
  4711. }
  4712. private string _leakCheck = "";
  4713. public string LeakCheck
  4714. {
  4715. get => _leakCheck;
  4716. set
  4717. {
  4718. _leakCheck = value;
  4719. NotifyOfPropertyChange("LeakCheck");
  4720. }
  4721. }
  4722. private string _AbortRecipePath = "";
  4723. public string AbortRecipePath
  4724. {
  4725. get => _AbortRecipePath;
  4726. set
  4727. {
  4728. _AbortRecipePath = value;
  4729. NotifyOfPropertyChange("AbortRecipePath");
  4730. }
  4731. }
  4732. private string _pressAPC = "";
  4733. public string PressAPC
  4734. {
  4735. get => _pressAPC;
  4736. set
  4737. {
  4738. _pressAPC = value;
  4739. NotifyOfPropertyChange("PressAPC");
  4740. }
  4741. }
  4742. private string _tempCorrection = "";
  4743. public string TempCorrection
  4744. {
  4745. get => _tempCorrection;
  4746. set
  4747. {
  4748. _tempCorrection = value;
  4749. NotifyOfPropertyChange("TempCorrection");
  4750. }
  4751. }
  4752. private string _tempPID = "";
  4753. public string TempPID
  4754. {
  4755. get => _tempPID;
  4756. set
  4757. {
  4758. _tempPID = value;
  4759. NotifyOfPropertyChange("TempPID");
  4760. }
  4761. }
  4762. private string _profileCondition = "";
  4763. public string ProfileCondition
  4764. {
  4765. get => _profileCondition;
  4766. set
  4767. {
  4768. _profileCondition = value;
  4769. NotifyOfPropertyChange("ProfileCondition");
  4770. }
  4771. }
  4772. private string _n2PurgeMode = "None";
  4773. public string N2PurgeMode
  4774. {
  4775. get => _n2PurgeMode;
  4776. set
  4777. {
  4778. _n2PurgeMode = value;
  4779. NotifyOfPropertyChange("N2PurgeMode");
  4780. }
  4781. }
  4782. public delegate void ChangedValueHandler(string type, string value);
  4783. public event ChangedValueHandler ChangedValueEvent;
  4784. private void ChangedSelectedFileName(string type, string value)
  4785. {
  4786. if (ChangedValueEvent != null)
  4787. {
  4788. ChangedValueEvent(type, value);
  4789. }
  4790. }
  4791. public void SetN2PurgeModeToParam()
  4792. {
  4793. if (Params.Count > 0)
  4794. {
  4795. StringParam n2PurgeMode = Params.FirstOrDefault(x => x.Name == "N2PurgeMode") as StringParam;
  4796. if (n2PurgeMode != null && n2PurgeMode.Value != this.N2PurgeMode)
  4797. {
  4798. n2PurgeMode.Value = this.N2PurgeMode;
  4799. ChangedSelectedFileName("N2PurgeMode", this.N2PurgeMode);
  4800. }
  4801. }
  4802. }
  4803. public void SetValueToParam()
  4804. {
  4805. if (Params.Count > 0)
  4806. {
  4807. StringParam subRecipe = Params.FirstOrDefault(x => x.Name == "Combination.SubRecipe") as StringParam;
  4808. if (subRecipe != null && subRecipe.Value != this.SubRecipePath)
  4809. {
  4810. subRecipe.Value = this.SubRecipePath;
  4811. ChangedSelectedFileName("SubRecipe", this.SubRecipePath);
  4812. }
  4813. StringParam alarmRecipe = Params.FirstOrDefault(x => x.Name == "Combination.AlarmRecipe") as StringParam;
  4814. if (alarmRecipe != null && alarmRecipe.Value != this.AlarmRecipePath)
  4815. {
  4816. alarmRecipe.Value = this.AlarmRecipePath;
  4817. ChangedSelectedFileName("AlarmRecipe", this.AlarmRecipePath);
  4818. }
  4819. StringParam alarmCondition = Params.FirstOrDefault(x => x.Name == "Combination.AlarmCondition") as StringParam;
  4820. if (alarmCondition != null && alarmCondition.Value != this.AlarmCondition)
  4821. {
  4822. alarmCondition.Value = this.AlarmCondition;
  4823. ChangedSelectedFileName("AlarmCondition", this.AlarmCondition);
  4824. }
  4825. StringParam leakCheck = Params.FirstOrDefault(x => x.Name == "Combination.LeakCheck") as StringParam;
  4826. if (leakCheck != null && leakCheck.Value != this.LeakCheck)
  4827. {
  4828. leakCheck.Value = this.LeakCheck;
  4829. ChangedSelectedFileName("LeakCheck", this.LeakCheck);
  4830. }
  4831. StringParam abortRecipe = Params.FirstOrDefault(x => x.Name == "Combination.AbortRecipe") as StringParam;
  4832. if (abortRecipe != null && abortRecipe.Value != this.AbortRecipePath)
  4833. {
  4834. abortRecipe.Value = this.AbortRecipePath;
  4835. ChangedSelectedFileName("AbortRecipe", this.AbortRecipePath);
  4836. }
  4837. StringParam pressAPCPID = Params.FirstOrDefault(x => x.Name == "Combination.PressAPCPID") as StringParam;
  4838. if (pressAPCPID != null && pressAPCPID.Value != this.PressAPC)
  4839. {
  4840. pressAPCPID.Value = this.PressAPC;
  4841. ChangedSelectedFileName("PressAPCPID", this.PressAPC);
  4842. }
  4843. StringParam tempCorrection = Params.FirstOrDefault(x => x.Name == "Combination.TempCorrection") as StringParam;
  4844. if (tempCorrection != null && tempCorrection.Value != this.TempCorrection)
  4845. {
  4846. tempCorrection.Value = this.TempCorrection;
  4847. ChangedSelectedFileName("TempCorrection", this.TempCorrection);
  4848. }
  4849. StringParam tempPID = Params.FirstOrDefault(x => x.Name == "Combination.TempPID") as StringParam;
  4850. if (tempPID != null && tempPID.Value != this.TempPID)
  4851. {
  4852. tempPID.Value = this.TempPID;
  4853. ChangedSelectedFileName("TempPID", this.TempPID);
  4854. }
  4855. StringParam profileCondition = Params.FirstOrDefault(x => x.Name == "Combination.ProfileCondition") as StringParam;
  4856. if (profileCondition != null && profileCondition.Value != this.ProfileCondition)
  4857. {
  4858. profileCondition.Value = this.ProfileCondition;
  4859. ChangedSelectedFileName("ProfileCondition", this.ProfileCondition);
  4860. }
  4861. StringParam n2PurgeMode = Params.FirstOrDefault(x => x.Name == "N2PurgeMode") as StringParam;
  4862. if (n2PurgeMode != null && n2PurgeMode.Value != this.N2PurgeMode)
  4863. {
  4864. n2PurgeMode.Value = this.N2PurgeMode;
  4865. ChangedSelectedFileName("N2PurgeMode", this.N2PurgeMode);
  4866. }
  4867. }
  4868. }
  4869. public override string ToString()
  4870. {
  4871. List<string> strList = new List<string>
  4872. {
  4873. $"SubRecipePath:{SubRecipePath}",
  4874. $"AlarmRecipePath:{AlarmRecipePath}",
  4875. $"AlarmCondition:{AlarmCondition}",
  4876. $"LeakCheck:{LeakCheck}",
  4877. $"AbortRecipePath:{AbortRecipePath}",
  4878. $"PressAPC:{PressAPC}",
  4879. $"TempCorrect:{TempCorrection}",
  4880. $"TempPID:{TempPID}",
  4881. $"ProfileCondition:{ProfileCondition}"
  4882. };
  4883. string toolType = (string)QueryDataClient.Instance.Service.GetConfig("System.SetUp.ToolType");
  4884. if (toolType != null && "SIBCN" == toolType)
  4885. {
  4886. strList.Add($"N2PurgeMode:{N2PurgeMode}");
  4887. }
  4888. return string.Join(";", strList);
  4889. }
  4890. }
  4891. public class AUXData : PropertyChangedBase
  4892. {
  4893. public delegate void ValueChangedEventHandler(object sender, SetValueEventArgs e);
  4894. public event ValueChangedEventHandler ValueChangedEvent;
  4895. public void OnValueChanged(SetValueEventArgs e)
  4896. {
  4897. if (ValueChangedEvent != null)
  4898. {
  4899. ValueChangedEvent(this, e);
  4900. }
  4901. }
  4902. public bool IsSaved
  4903. {
  4904. get => SetValue.IsSaved && SetUnit.IsSaved && Rampng.IsSaved && RampngUnit.IsSaved && IsCheck.IsSaved && MaxValue.IsSaved && MinValue.IsSaved;
  4905. }
  4906. public bool UndoChanges()
  4907. {
  4908. Type type = this.GetType();
  4909. PropertyInfo[] properties = type.GetProperties();
  4910. foreach (var item in properties)
  4911. {
  4912. var obj = item.GetValue(this);
  4913. if (obj is Param)
  4914. {
  4915. ((Param)obj).UndoChanges();
  4916. }
  4917. }
  4918. return true;
  4919. }
  4920. public bool UndoChanges(AUXData oldAUXData)
  4921. {
  4922. Type type = this.GetType();
  4923. PropertyInfo[] properties = type.GetProperties();
  4924. Type oldType = oldAUXData.GetType();
  4925. PropertyInfo[] oldProperties = oldType.GetProperties();
  4926. foreach (var item in properties)
  4927. {
  4928. var oldprop = oldProperties.FirstOrDefault(x => x.Name == item.Name);
  4929. if (oldprop != null)
  4930. {
  4931. var oldObj = oldprop.GetValue(oldAUXData);
  4932. if (oldObj != null)
  4933. {
  4934. var obj = item.GetValue(this);
  4935. if (obj is Param)
  4936. {
  4937. if (oldObj != null && ((Param)oldObj).IsSaved != ((Param)obj).IsSaved)
  4938. ((Param)obj).UndoChanges();
  4939. }
  4940. }
  4941. }
  4942. }
  4943. return true;
  4944. }
  4945. private void ParamIsSaved_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
  4946. {
  4947. if (e.PropertyName == nameof(Param.IsSaved))
  4948. {
  4949. NotifyOfPropertyChange("IsSaved");
  4950. }
  4951. else if (e.PropertyName == nameof(DoubleParam.Value))
  4952. {
  4953. if (sender is Param)
  4954. {
  4955. if (((Param)sender).IsSaved) return;
  4956. SetValueEventArgs tempSetEventArgs = new SetValueEventArgs();
  4957. tempSetEventArgs.Sender = this;
  4958. tempSetEventArgs.ValueName = this.ControlName;
  4959. tempSetEventArgs.PropertyName = ((Param)sender).Name;
  4960. if (sender is DoubleParam)
  4961. {
  4962. tempSetEventArgs.PropertyValue = ((DoubleParam)sender).Value;
  4963. OnValueChanged(tempSetEventArgs);
  4964. }
  4965. else if (sender is StringParam)
  4966. {
  4967. tempSetEventArgs.PropertyValue = ((StringParam)sender).Value;
  4968. OnValueChanged(tempSetEventArgs);
  4969. }
  4970. else if (sender is BoolParam)
  4971. {
  4972. tempSetEventArgs.PropertyValue = ((BoolParam)sender).Value.ToString();
  4973. OnValueChanged(tempSetEventArgs);
  4974. }
  4975. }
  4976. }
  4977. }
  4978. private int _no;
  4979. public int No
  4980. {
  4981. get => _no;
  4982. set
  4983. {
  4984. _no = value;
  4985. NotifyOfPropertyChange("No");
  4986. }
  4987. }
  4988. private string _name;
  4989. public string Name
  4990. {
  4991. get => _name;
  4992. set
  4993. {
  4994. _name = value;
  4995. NotifyOfPropertyChange("Name");
  4996. }
  4997. }
  4998. public string _unit;
  4999. public string Unit
  5000. {
  5001. get => _unit;
  5002. set
  5003. {
  5004. _unit = value;
  5005. NotifyOfPropertyChange("Unit");
  5006. }
  5007. }
  5008. private string _displayName;
  5009. public string DisplayName
  5010. {
  5011. get => _displayName;
  5012. set
  5013. {
  5014. _displayName = value;
  5015. NotifyOfPropertyChange("DisplayName");
  5016. }
  5017. }
  5018. private string _controlName;
  5019. public string ControlName
  5020. {
  5021. get => _controlName;
  5022. set
  5023. {
  5024. _controlName = value;
  5025. NotifyOfPropertyChange("ControlName");
  5026. }
  5027. }
  5028. private DoubleParam _setValue;
  5029. public DoubleParam SetValue
  5030. {
  5031. get => _setValue;
  5032. set
  5033. {
  5034. if (_setValue != null)
  5035. {
  5036. _setValue.PropertyChanged -= ParamIsSaved_PropertyChanged;
  5037. }
  5038. _setValue = value;
  5039. _setValue.PropertyChanged += ParamIsSaved_PropertyChanged;
  5040. NotifyOfPropertyChange(nameof(SetValue));
  5041. }
  5042. }
  5043. private StringParam _setUnit;// = "SLM";
  5044. public StringParam SetUnit
  5045. {
  5046. get => _setUnit;
  5047. set
  5048. {
  5049. if (_setUnit != null)
  5050. {
  5051. _setUnit.PropertyChanged -= ParamIsSaved_PropertyChanged;
  5052. }
  5053. _setUnit = value;
  5054. _setUnit.PropertyChanged += ParamIsSaved_PropertyChanged;
  5055. NotifyOfPropertyChange(nameof(SetUnit));
  5056. }
  5057. }
  5058. private StringParam _rampngUnit = new StringParam() { Name = "RampngUnit", Value = "SLM" };// = "SLM";
  5059. public StringParam RampngUnit
  5060. {
  5061. get => _rampngUnit;
  5062. set
  5063. {
  5064. if (_rampngUnit != null)
  5065. {
  5066. _rampngUnit.PropertyChanged -= ParamIsSaved_PropertyChanged;
  5067. }
  5068. _rampngUnit = value;
  5069. _rampngUnit.PropertyChanged += ParamIsSaved_PropertyChanged;
  5070. NotifyOfPropertyChange("RampngUnit");
  5071. }
  5072. }
  5073. private DoubleParam _rampng = new DoubleParam() { Name = "Rampng", Value = "0" };
  5074. public DoubleParam Rampng
  5075. {
  5076. get => _rampng; set
  5077. {
  5078. if (_rampng != null)
  5079. {
  5080. _rampng.PropertyChanged -= ParamIsSaved_PropertyChanged;
  5081. }
  5082. _rampng = value;
  5083. _rampng.PropertyChanged += ParamIsSaved_PropertyChanged;
  5084. NotifyOfPropertyChange("Rampng");
  5085. }
  5086. }
  5087. private string _alarmValue;
  5088. public string AlarmValue
  5089. {
  5090. get => _alarmValue; set
  5091. {
  5092. _alarmValue = value;
  5093. NotifyOfPropertyChange("AlarmValue");
  5094. }
  5095. }
  5096. private DoubleParam _maxValue;
  5097. public DoubleParam MaxValue
  5098. {
  5099. get => _maxValue; set
  5100. {
  5101. if (_maxValue != null)
  5102. {
  5103. _maxValue.PropertyChanged -= ParamIsSaved_PropertyChanged;
  5104. }
  5105. _maxValue = value;
  5106. _maxValue.PropertyChanged += ParamIsSaved_PropertyChanged;
  5107. NotifyOfPropertyChange("MaxValue");
  5108. }
  5109. }
  5110. private DoubleParam _minValue;
  5111. public DoubleParam MinValue
  5112. {
  5113. get => _minValue; set
  5114. {
  5115. if (_minValue != null)
  5116. {
  5117. _minValue.PropertyChanged -= ParamIsSaved_PropertyChanged;
  5118. }
  5119. _minValue = value;
  5120. _minValue.PropertyChanged += ParamIsSaved_PropertyChanged;
  5121. NotifyOfPropertyChange("MinValue");
  5122. }
  5123. }
  5124. private BoolParam _isCheck;
  5125. public BoolParam IsCheck
  5126. {
  5127. get => _isCheck;
  5128. set
  5129. {
  5130. if (_isCheck != null)
  5131. {
  5132. _isCheck.PropertyChanged -= ParamIsSaved_PropertyChanged;
  5133. }
  5134. _isCheck = value;
  5135. _isCheck.PropertyChanged += ParamIsSaved_PropertyChanged;
  5136. NotifyOfPropertyChange("IsCheck");
  5137. }
  5138. }
  5139. private bool _isEnable = true;
  5140. public bool IsEnable
  5141. {
  5142. get => _isEnable;
  5143. set
  5144. {
  5145. _isEnable = value;
  5146. NotifyOfPropertyChange("IsEnable");
  5147. }
  5148. }
  5149. }
  5150. public class SetValueEventArgs : EventArgs
  5151. {
  5152. private Object _sender;
  5153. public Object Sender
  5154. {
  5155. get => _sender;
  5156. set
  5157. {
  5158. _sender = value;
  5159. }
  5160. }
  5161. private string _valueName;
  5162. public string ValueName
  5163. {
  5164. get => _valueName;
  5165. set
  5166. {
  5167. _valueName = value;
  5168. }
  5169. }
  5170. private string _propertyName;
  5171. public string PropertyName
  5172. {
  5173. get => _propertyName;
  5174. set
  5175. {
  5176. _propertyName = value;
  5177. }
  5178. }
  5179. private string _propertyValue;
  5180. public string PropertyValue
  5181. {
  5182. get => _propertyValue;
  5183. set
  5184. {
  5185. _propertyValue = value;
  5186. }
  5187. }
  5188. public SetValueEventArgs()
  5189. {
  5190. }
  5191. }
  5192. }