123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610 |
- using Aitex.Core.RT.Log;
- using Caliburn.Micro.Core;
- using MECF.Framework.Common.CommonData;
- using MECF.Framework.Common.DataCenter;
- using MECF.Framework.Common.RecipeCenter;
- using MECF.Framework.Common.Utilities;
- using MECF.Framework.UI.Client.CenterViews.Configs.SystemConfig;
- using RecipeEditorLib.DGExtension.CustomColumn;
- using RecipeEditorLib.RecipeModel.Params;
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.Linq;
- using System.Reflection;
- using System.Text;
- using System.Windows;
- using System.Xml;
- using System.ComponentModel;
- using OpenSEMI.ClientBase;
- using MECF.Framework.UI.Client.ClientBase;
- using System.Threading.Tasks;
- using System.Collections.Concurrent;
- using Mapster;
- using System.Diagnostics;
- using SciChart.Charting.Common.Extensions;
- using DocumentFormat.OpenXml.EMMA;
- namespace MECF.Framework.UI.Client.CenterViews.Editors.Recipe
- {
- public class RecipeTable : PropertyChangedBase
- {
- private int _Index;
- public int Index
- {
- get { return _Index; }
- set { _Index = value; this.NotifyOfPropertyChange(nameof(Index)); }
- }
- private string _Name;
- public string Name
- {
- get { return _Name; }
- set { _Name = value; this.NotifyOfPropertyChange(nameof(Name)); }
- }
- private string _EndStatus;
- public string EndStatus
- {
- get { return _EndStatus; }
- set { _EndStatus = value; this.NotifyOfPropertyChange(nameof(EndStatus)); }
- }
- private RecipeDataBase _TableData;
- public RecipeDataBase TableData
- {
- get { return _TableData; }
- set { _TableData = value; this.NotifyOfPropertyChange(nameof(TableData)); }
- }
- }
- public class RecipeDataBase : PropertyChangedBase
- {
- public static string[] SaveTableRecipeTypes = new string[] { "sub", "alarm", "abort" };
- public static string ProcessType = "Process";
- public bool GetIsTableType
- {
- get
- {
- if (string.IsNullOrEmpty(RecipeChamberType))
- return false;
- else if (SaveTableRecipeTypes.Contains(RecipeChamberType))
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- }
- public bool IsChanged
- {
- get
- {
- bool changed = !IsSavedDesc;
- if (!changed)
- {
- //changed = ChkChanged(Steps) || ChkChanged(PopSettingSteps) || ChkChanged(StepTolerances);
- }
- if (!changed)
- {
- foreach (Param config in this.ConfigItems)
- {
- if (!config.IsSaved)
- {
- changed = true;
- break;
- }
- }
- }
- return changed;
- }
- }
- private bool _isSavedDesc;
- public bool IsSavedDesc
- {
- get { return _isSavedDesc; }
- set
- {
- this._isSavedDesc = value;
- this.NotifyOfPropertyChange("IsSavedDesc");
- }
- }
- private string name;
- public string Name
- {
- get { return this.name; }
- set
- {
- this.name = value;
- this.NotifyOfPropertyChange("Name");
- }
- }
- private string _chamberType;
- public string RecipeChamberType
- {
- get { return this._chamberType; }
- set
- {
- this._chamberType = value;
- CreateTable(value);
- this.NotifyOfPropertyChange("RecipeChamberType");
- }
- }
- public void CreateTable(string type)
- {
- if (SaveTableRecipeTypes.Contains(type))
- {
- int maxCount = 20;
- if (type.ToLower() == "abort")
- {
- maxCount = 10;
- }
- for (int i = 0; i < maxCount; i++)
- {
- Tables.Add(new RecipeTable()
- { Index = i + 1, Name = "", EndStatus = "", TableData = new RecipeDataBase() });
- }
- }
- }
- private string _recipeVersion;
- public string RecipeVersion
- {
- get { return this._recipeVersion; }
- set
- {
- this._recipeVersion = value;
- this.NotifyOfPropertyChange("RecipeVersion");
- }
- }
- private string _recipePermission;
- public string RecipePermission
- {
- get { return this._recipePermission; }
- set
- {
- this._recipePermission = value;
- this.NotifyOfPropertyChange("RecipePermisson");
- }
- }
- private string _recipeLevel;
- public string RecipeLevel
- {
- get { return this._recipeLevel; }
- set
- {
- this._recipeLevel = value;
- this.NotifyOfPropertyChange("RecipeLevel");
- }
- }
- private string _prefixPath;
- public string PrefixPath
- {
- get { return _prefixPath; }
- set
- {
- _prefixPath = value;
- this.NotifyOfPropertyChange("PrefixPath");
- }
- }
- private string creator;
- public string Creator
- {
- get { return this.creator; }
- set
- {
- this.creator = value;
- this.NotifyOfPropertyChange("Creator");
- }
- }
- private DateTime createTime;
- public DateTime CreateTime
- {
- get { return this.createTime; }
- set
- {
- this.createTime = value;
- this.NotifyOfPropertyChange("CreateTime");
- }
- }
- private string description;
- public string Description
- {
- get { return this.description; }
- set
- {
- this.description = value;
- this.NotifyOfPropertyChange("Description");
- }
- }
- private string devisor;
- public string Revisor
- {
- get { return this.devisor; }
- set
- {
- this.devisor = value;
- this.NotifyOfPropertyChange("Revisor");
- }
- }
- private int _TableIndex = 1;
- public int TableIndex
- {
- get { return this._TableIndex; }
- set
- {
- this._TableIndex = value;
- this.NotifyOfPropertyChange("TableIndex");
- }
- }
- public string Time
- {
- get => GetTime();
- }
- private string GetTime()
- {
- var parm = this.ConfigItems.FirstOrDefault(x => x.Name == "RecipeTime") as StringParam;
- if (parm != null)
- {
- return ConvertSecondsToHMSFormat(parm.Value);
- }
- return "00:00:00.0";
- }
- public static string ConvertSecondsToHMSFormat(string strTotalSeconds)
- {
- double totalSeconds = 0;
- double.TryParse(strTotalSeconds, out totalSeconds);
- int intTotalSeconds = (int)totalSeconds;
- int hours = intTotalSeconds / 3600;
- int minutes = (intTotalSeconds % 3600) / 60;
- double seconds = intTotalSeconds % 60 + (totalSeconds - intTotalSeconds);
- return string.Format("{0:00}:{1:00}:{2:00.0}", hours, minutes, seconds);
- }
- public string TableName => Tables.Count > 0&&TableIndex>-1 ? Tables.FirstOrDefault(x => x.Index == TableIndex)?.Name : "";
- private DateTime deviseTime;
- public DateTime ReviseTime
- {
- get { return this.deviseTime; }
- set
- {
- this.deviseTime = value;
- this.NotifyOfPropertyChange("ReviseTime");
- }
- }
- public ObservableCollection<Step> Steps { get; set; }
- public Dictionary<string, ObservableCollection<ObservableCollection<Param>>> PopSettingSteps { get; private set; }
- public ObservableCollection<ObservableCollection<Param>> StepTolerances { get; private set; }
- public ObservableCollection<Param> ConfigItems { get; private set; }
- public List<int> StepNos { get; set; } = new List<int>();
- private XmlDocument _doc;
- private string _module = "PM1";
- public bool ToleranceEnable { get; set; }
- public Dictionary<string, bool> PopEnable { get; set; }
- public bool IsCompatibleWithCurrentFormat { get; set; }
- private RecipeProvider _recipeProvider = new RecipeProvider();
- private Dictionary<string, ObservableCollection<RecipeTemplateColumnBase>> RecipeTemplate;
- public ObservableCollection<RecipeTable> Tables { get; set; } = new ObservableCollection<RecipeTable>();
- public void ShallowCopyStep(ref Step destinationStep, Step originalStep)
- {
- int stepNo = destinationStep.StepNo;
- //Type type = originalStep.GetType();
- //PropertyInfo[] properties = type.GetProperties();
- //// 遍历属性并赋值
- //foreach (PropertyInfo property in properties)
- //{
- // // 判断属性是否可写
- // if (property.CanWrite)
- // {
- // // 设置属性的值
- // property.SetValue(destinationStep, property.GetValue(originalStep));
- // }
- //}
- originalStep.Adapt(destinationStep);
- destinationStep.StepNo = stepNo;
- SetDelegateEvent(destinationStep);
- }
- public void CloneStep(ref Step destinationStep, Step originalStep)
- {
- int stepNo = destinationStep.StepNo;
- //destinationStep = (Step)CloneUtil.CloneObjectSetFlag(originalStep, "IsSaved", true);
- //TypeAdapterConfig<Param, Param>.NewConfig().MapToConstructor(true).Ignore(t=>t.IsSaved);
- originalStep.Adapt(destinationStep);
- destinationStep.StepNo = stepNo;
- SetDelegateEvent(destinationStep);
- }
- public RecipeDataBase()
- {
- this.Steps = new ObservableCollection<Step>();
- StepTolerances = new ObservableCollection<ObservableCollection<Param>>();
- this.PopSettingSteps = new Dictionary<string, ObservableCollection<ObservableCollection<Param>>>();
- this.PopEnable = new Dictionary<string, bool>();
- ConfigItems = new ObservableCollection<Param>()
- {
- new StringParam { Name="Combination.SubRecipe"},
- new StringParam { Name="Combination.AlarmRecipe"},
- new StringParam { Name="Combination.AlarmCondition"},
- new StringParam { Name="Combination.LeakCheck"},
- new StringParam { Name="Combination.AbortRecipe"},
- new StringParam { Name="Combination.PressAPCPID"},
- new StringParam { Name="Combination.TempCorrection"},
- new StringParam { Name="Combination.TempPID"},
- new StringParam { Name="Combination.ProfileCondition"},
- new StringParam { Name="RecipeTime"},
- new StringParam { Name="N2PurgeMode",Value = "None"},
- };
- IsSavedDesc = true;
- _doc = new XmlDocument();
- XmlElement node = _doc.CreateElement("Aitex");
- _doc.AppendChild(node);
- node.AppendChild(_doc.CreateElement("TableRecipeData"));
- string vars = _recipeProvider.GetRecipeFormatXml(MECF.Framework.Common.Equipment.ModuleName.PM1);
- RecipeTemplate = _recipeProvider.GetGroupRecipeTemplate();
- StepCollectionChanged();
- }
- private void StepCollectionChanged()
- {
- foreach (var item in Steps)
- {
- item.TempValueChangedEvent += Item_TempValueChangedEvent;
- item.MFCValueChangedEvent += Item_MFCValueChangedEvent;
- item.ValveValueChangedEvent += Item_ValveValueChangedEvent;
- item.AUXValueChangedEvent += Item_AUXValueChangedEvent;
- item.OhterTempValueChangedEvent += Item_OhterTempValueChangedEvent;
- item.PressureValueChangedEvent += Item_PressureValueChangedEvent;
- item.LoaderValueChangedEvent += Item_LoaderValueChangedEvent;
- item.AlarmValueChangedEvent += Item_AlarmValueChangedEvent;
- }
- Steps.CollectionChanged += (s, e) =>
- {
- if (e.OldItems != null)
- {
- foreach (Step item in e.OldItems)
- {
- item.TempValueChangedEvent -= Item_TempValueChangedEvent;
- item.MFCValueChangedEvent -= Item_MFCValueChangedEvent;
- item.ValveValueChangedEvent -= Item_ValveValueChangedEvent;
- item.AUXValueChangedEvent -= Item_AUXValueChangedEvent;
- item.OhterTempValueChangedEvent -= Item_OhterTempValueChangedEvent;
- item.PressureValueChangedEvent -= Item_PressureValueChangedEvent;
- item.LoaderValueChangedEvent -= Item_LoaderValueChangedEvent;
- item.AlarmValueChangedEvent -= Item_AlarmValueChangedEvent;
- }
- }
- if (e.NewItems != null)
- {
- foreach (Step item in e.NewItems)
- {
- item.TempValueChangedEvent += Item_TempValueChangedEvent;
- item.MFCValueChangedEvent += Item_MFCValueChangedEvent;
- item.ValveValueChangedEvent += Item_ValveValueChangedEvent;
- item.AUXValueChangedEvent += Item_AUXValueChangedEvent;
- item.OhterTempValueChangedEvent += Item_OhterTempValueChangedEvent;
- item.PressureValueChangedEvent += Item_PressureValueChangedEvent;
- item.LoaderValueChangedEvent += Item_LoaderValueChangedEvent;
- item.AlarmValueChangedEvent += Item_AlarmValueChangedEvent;
- }
- }
- };
- }
- private void Item_LoaderValueChangedEvent(object sender, SetValueEventArgs e)
- {
- //throw new NotImplementedException();
- }
- private void Item_AlarmValueChangedEvent(object sender, SetValueEventArgs e)
- {
- if (sender != null && sender is Step)
- {
- var step = sender as Step;
- int stepIndex = Steps.IndexOf(step);
- if (stepIndex < Steps.Count - 1)
- {
- for (int i = stepIndex + 1; i < Steps.Count; i++)
- {
- if (Steps[i].AlarmIsSaved)
- {
- string tempName = e.ValueName;
- string proName = e.PropertyName;
- string proValue = e.PropertyValue;
- Type type = Steps[i].GetType();
- PropertyInfo[] properties = type.GetProperties();
- var property = properties.FirstOrDefault(x => x.Name == proName);
- if (property != null)
- {
- var proParam = property.GetValue(Steps[i]);
- if (proParam is StringParam)
- {
- ((StringParam)proParam).Value = proValue;
- //property.SetValue(Steps[i], proParam);
- }
- }
- }
- else
- { break; }
- }
- }
- }
- }
- private void Item_PressureValueChangedEvent(object sender, SetValueEventArgs e)
- {
- if (sender != null && sender is Step)
- {
- var step = sender as Step;
- int stepIndex = Steps.IndexOf(step);
- if (stepIndex < Steps.Count - 1)
- {
- for (int i = stepIndex + 1; i < Steps.Count; i++)
- {
- if (Steps[i].PressIsSaved)
- {
- string tempName = e.ValueName;
- string proName = e.PropertyName;
- string proValue = e.PropertyValue;
- Type type = Steps[i].GetType();
- PropertyInfo[] properties = type.GetProperties();
- var property = properties.FirstOrDefault(x => x.Name == proName);
- if (property != null)
- {
- var proParam = property.GetValue(Steps[i]);
- if (proParam is DoubleParam)
- {
- ((DoubleParam)proParam).Value = proValue;
- property.SetValue(Steps[i], proParam);
- }
- else if (proParam is StringParam)
- {
- ((StringParam)proParam).Value = proValue;
- property.SetValue(Steps[i], proParam);
- }
- }
- }
- else
- { break; }
- }
- }
- }
- }
- private void Item_OhterTempValueChangedEvent(object sender, SetValueEventArgs e)
- {
- if (sender != null && sender is Step)
- {
- var step = sender as Step;
- int stepIndex = Steps.IndexOf(step);
- if (stepIndex < Steps.Count - 1)
- {
- for (int i = stepIndex + 1; i < Steps.Count; i++)
- {
- if (Steps[i].TemperatureIsSaved)
- {
- string tempName = e.ValueName;
- string proName = e.PropertyName;
- string proValue = e.PropertyValue;
- Type type = Steps[i].GetType();
- PropertyInfo[] properties = type.GetProperties();
- var property = properties.FirstOrDefault(x => x.Name == proName);
- if (property != null)
- {
- var proParam = property.GetValue(Steps[i]);
- if (proParam is DoubleParam)
- {
- ((DoubleParam)proParam).Value = proValue;
- property.SetValue(Steps[i], proParam);
- }
- else if (proParam is StringParam)
- {
- ((StringParam)proParam).Value = proValue;
- ((StringParam)proParam).IsSaved = true;
- property.SetValue(Steps[i], proParam);
- }
- else if (proParam is BoolParam)
- {
- bool tryValue = true;
- bool.TryParse(proValue, out tryValue);
- ((BoolParam)proParam).Value = tryValue;
- property.SetValue(Steps[i], proParam);
- }
- }
- }
- else
- { break; }
- }
- }
- }
- }
- private void Item_MFCValueChangedEvent(object sender, SetValueEventArgs e)
- {
- if (sender != null && sender is Step)
- {
- var step = sender as Step;
- int stepIndex = Steps.IndexOf(step);
- if (stepIndex < Steps.Count - 1)
- {
- for (int i = stepIndex + 1; i < Steps.Count; i++)
- {
- if (Steps[i].MFCIsSaved)
- {
- var tempData = (MFCData)e.Sender;
- string tempName = e.ValueName;
- string proName = e.PropertyName;
- string proValue = e.PropertyValue;
- var temp = Steps[i].MFCSets.FirstOrDefault(x => x.ControlName == tempName);
- Type type = temp.GetType();
- PropertyInfo[] properties = type.GetProperties();
- var property = properties.FirstOrDefault(x => x.Name == proName);
- if (property != null)
- {
- var proParam = property.GetValue(temp);
- if (proParam is DoubleParam)
- {
- ((DoubleParam)proParam).Value = proValue;
- property.SetValue(temp, proParam);
- }
- else if (proParam is IntParam)
- {
- int.TryParse(proValue, out int outValue);
- ((IntParam)proParam).Value = outValue;
- property.SetValue(temp, proParam);
- }
- else if (proParam is StringParam)
- {
- ((StringParam)proParam).Value = proValue;
- property.SetValue(temp, proParam);
- }
- else if (proParam is BoolParam)
- {
- bool tryValue = true;
- bool.TryParse(proValue, out tryValue);
- ((BoolParam)proParam).Value = tryValue;
- property.SetValue(temp, proParam);
- }
- }
- }
- else
- { break; }
- }
- }
- }
- }
- private void Item_TempValueChangedEvent(object sender, SetValueEventArgs e)
- {
- if (sender != null && sender is Step)
- {
- var step = sender as Step;
- int stepIndex = Steps.IndexOf(step);
- if (stepIndex < Steps.Count - 1)
- {
- for (int i = stepIndex + 1; i < Steps.Count; i++)
- {
- if (Steps[i].TemperatureIsSaved)
- {
- var tempData = (TempSetData)e.Sender;
- string tempName = e.ValueName;
- string proName = e.PropertyName;
- string proValue = e.PropertyValue;
- var temp = Steps[i].TemperatureSets.FirstOrDefault(x => x.Name == tempName);
- Type type = temp.GetType();
- PropertyInfo[] properties = type.GetProperties();
- var property = properties.FirstOrDefault(x => x.Name == proName);
- if (property != null)
- {
- var proParam = property.GetValue(temp);
- if (proParam is DoubleParam)
- {
- ((DoubleParam)proParam).Value = proValue;
- property.SetValue(temp, proParam);
- }
- else if (proParam is StringParam)
- {
- ((StringParam)proParam).Value = proValue;
- property.SetValue(temp, proParam);
- }
- }
- }
- else
- { break; }
- }
- }
- }
- }
- private void Item_TempOtherValueChangedEvent(object sender, SetValueEventArgs e)
- {
- if (sender != null && sender is Step)
- {
- var step = sender as Step;
- int stepIndex = Steps.IndexOf(step);
- if (stepIndex < Steps.Count - 1)
- {
- for (int i = stepIndex + 1; i < Steps.Count; i++)
- {
- if (Steps[i].TemperatureIsSaved)
- {
- string proName = e.PropertyName;
- string proValue = e.PropertyValue;
- Type type = step.GetType();
- PropertyInfo[] properties = type.GetProperties();
- var property = properties.FirstOrDefault(x => x.Name == proName);
- if (property != null)
- {
- var proParam = property.GetValue(Steps[i]);
- if (proParam is StringParam)
- {
- ((StringParam)proParam).Value = proValue;
- property.SetValue(Steps[i], proParam);
- }
- }
- }
- else
- { break; }
- }
- }
- }
- }
- private void Item_AUXValueChangedEvent(object sender, SetValueEventArgs e)
- {
- if (sender != null && sender is Step)
- {
- var step = sender as Step;
- int stepIndex = Steps.IndexOf(step);
- if (stepIndex < Steps.Count - 1)
- {
- for (int i = stepIndex + 1; i < Steps.Count; i++)
- {
- if (Steps[i].AUXIsSaved)
- {
- var tempData = (AUXData)e.Sender;
- string tempName = e.ValueName;
- string proName = e.PropertyName;
- string proValue = e.PropertyValue;
- var temp = Steps[i].AUXSets.FirstOrDefault(x => x.ControlName == tempName);
- Type type = temp.GetType();
- PropertyInfo[] properties = type.GetProperties();
- var property = properties.FirstOrDefault(x => x.Name == proName);
- if (property != null)
- {
- var proParam = property.GetValue(temp);
- if (proParam is DoubleParam)
- {
- ((DoubleParam)proParam).Value = proValue;
- property.SetValue(temp, proParam);
- }
- else if (proParam is StringParam)
- {
- ((StringParam)proParam).Value = proValue;
- property.SetValue(temp, proParam);
- }
- else if (proParam is BoolParam)
- {
- bool tryValue = true;
- bool.TryParse(proValue, out tryValue);
- ((BoolParam)proParam).Value = tryValue;
- property.SetValue(temp, proParam);
- }
- }
- }
- else
- { break; }
- }
- }
- }
- }
- private void Item_ValveValueChangedEvent(object sender, SetValueEventArgs e)
- {
- if (sender != null && sender is Step)
- {
- var step = sender as Step;
- int stepIndex = Steps.IndexOf(step);
- if (stepIndex < Steps.Count - 1)
- {
- for (int i = stepIndex + 1; i < Steps.Count; i++)
- {
- if (Steps[i].ValveIsSaved)
- {
- var tempData = (BoolParam)e.Sender;
- string tempName = e.ValueName;
- string proName = e.PropertyName;
- string proValue = e.PropertyValue;
- var temp = Steps[i].ValveSets.FirstOrDefault(x => x.Name == tempData.Name);
- bool tempValue = false;
- bool.TryParse(proValue, out tempValue);
- temp.Value = tempValue;
- }
- else
- { break; }
- }
- }
- }
- }
- public void Clear()
- {
- Steps.Clear();
- PopSettingSteps.Clear();
- StepTolerances.Clear();
- RecipeChamberType = "";
- RecipeVersion = "";
- IsSavedDesc = true;
- _module = "PM1";
- }
- public void StepCloneChangedIndex()
- {
- int index = 1;
- foreach (var item in Steps)
- {
- item.StepNo = index;
- index += 1;
- }
- }
- public void InitData(string prefixPath, string recipeName, string recipeContent, string module, int tableNo = 1)
- {
- IsCompatibleWithCurrentFormat = false;
- _module = module;
- Name = recipeName;
- PrefixPath = prefixPath;
- try
- {
- _doc = new XmlDocument();
- _doc.LoadXml(recipeContent);
- if (!LoadHeader(_doc.SelectSingleNode("Aitex/TableRecipeData")))
- return;
- //Load Tables
- XmlNode nodeTable = _doc.SelectSingleNode($"Aitex/TableRecipeData/Tables");
- if (nodeTable != null)
- LoadTables(nodeTable);
- if (!SaveTableRecipeTypes.Contains(RecipeChamberType))
- {
- XmlNodeList nodeSteps = _doc.SelectNodes($"Aitex/TableRecipeData/Module[@Name='{module}']/Step");
- if (nodeSteps == null)
- nodeSteps = _doc.SelectNodes($"Aitex/TableRecipeData/Step");
- FastLoadSteps(nodeSteps);
- // LoadSteps(nodeSteps);
- XmlNode nodeConfig = _doc.SelectSingleNode($"Aitex/TableRecipeData/Module[@Name='{module}']/Config");
- if (nodeConfig == null)
- nodeConfig = _doc.SelectSingleNode($"Aitex/TableRecipeData/Config");
- LoadConfigs(nodeConfig);
- }
- else
- {
- Steps.Clear();
- StepNos.Clear();
- TableIndex = 1;
- Tables[0].TableData.Steps.ToList().ForEach(
- x =>
- {
- var tempStep = x;// (Step)CloneUtil.CloneObject(x);
- tempStep.StepNo = x.StepNo;
- Steps.Add(tempStep);
- StepNos.Add(x.StepNo);
- });
- }
- //var index = 1;
- //foreach (Step parameters in Steps)
- //{
- // parameters.Value = index.ToString();
- // index++;
- //}
- IsCompatibleWithCurrentFormat = true;
- }
- catch (Exception ex)
- {
- LOG.Write(ex);
- }
- }
- public void SaveTo(string[] moduleList)
- {
- GetXmlString();
- XmlNode nodeModule = _doc.SelectSingleNode($"Aitex/TableRecipeData/Module[@Name='{_module}']");
- if (nodeModule == null)
- {
- LOG.Write("recipe not find modules," + Name);
- return;
- }
- XmlNode nodeData = nodeModule.ParentNode;
- foreach (var module in moduleList)
- {
- if (module == _module)
- {
- continue;
- }
- var child = _doc.SelectSingleNode($"Aitex/TableRecipeData/Module[@Name='{module}']");
- if (child != null)
- nodeData.RemoveChild(child);
- XmlElement node = nodeModule.Clone() as XmlElement;
- node.SetAttribute("Name", module);
- nodeData.AppendChild(node);
- }
- }
- int StepNo = 1;
- public string DictionaryStepTime(Dictionary<string, string> steptimes)
- {
- if (steptimes == null && steptimes.Count == 0) return null;
- StringBuilder rtn = new StringBuilder();
- foreach (var item in steptimes.Keys)
- {
- if (steptimes[item] == "00:00:00") continue;
- rtn.Append($"{item},{steptimes[item]};");
- }
- if (rtn.Length > 0) rtn.Remove(rtn.Length - 1, 1);
- return rtn.ToString();
- }
- public Dictionary<string, string> StepTimeToDictionary(string stepTime)
- {
- Dictionary<string, string> steptimes = new Dictionary<string, string>();
- string[] tempTimes = stepTime.Split(';');
- foreach (var item in tempTimes)
- {
- string[] subTimes = item.Split(',');
- steptimes.Add(subTimes[0], subTimes[1]);
- }
- return steptimes;
- }
- private List<string> valveDefaultOpen = new List<string>() { "AGV", "MBP", "DP", "HTR1", "HTR2", "HTR3" };
- private MFCData GetNewMFCData(string controlName)
- {
- return new MFCData()
- {
- Name = controlName,
- ControlName = controlName.Replace(".Flow", ""),
- SetValue = new StringParam() { Name = "SetValue", Value = "0" },
- SetUnit = new StringParam() { Name = "SetUnit", Value = "SLM" },
- Rampng = new DoubleParam() { Name = "Rampng", Value = "0" },
- RampngUnit = new StringParam() { Name = "RampngUnit", Value = "SLM" },
- AlarmValue = "None",
- IsCheck = new BoolParam() { Name = "IsCheck", Value = false },
- MaxValue = new DoubleParam() { Name = "MaxValue", Value = "0" },
- MinValue = new DoubleParam { Name = "MaxValue", Value = "0" }
- };
- }
- public Step CreateStep(Step oldStep, XmlNode stepNode = null)
- {
- if (oldStep == null)
- {
- return CreateStep(stepNode);
- }
- else
- {
- Step step = (Step)CloneUtil.CloneObject(oldStep);
- if (stepNode != null)
- {
- if (stepNode.Attributes["StepNo"] != null)
- step.StepNo = int.Parse(stepNode.Attributes["StepNo"].Value);
- if (stepNode.Attributes["Name"] != null)
- step.Name = stepNode.Attributes["Name"].Value;
- if (stepNode.Attributes["EndBy"] != null)
- step.EndBy = stepNode.Attributes["EndBy"].Value;
- if (stepNode.Attributes["Time"] != null)
- {
- var timeValue = stepNode.Attributes["Time"].Value;
- if (!string.IsNullOrEmpty(timeValue) && !timeValue.Contains('.'))
- {
- timeValue = $"{timeValue}.0";
- }
- step.Time = timeValue;
- }
- if (stepNode.Attributes["SkipWait"] != null)
- step.SkipWait = stepNode.Attributes["SkipWait"].Value;
- else
- step.SkipWait = "";
- if (stepNode.Attributes["Command"] != null)
- step.Command = stepNode.Attributes["Command"].Value;
- AnalysisIsSaved(stepNode, step);
- ReadConditionCheck(stepNode, step);
- if (stepNode.Attributes["AlarmConditionTable"] != null)
- step.AlarmConditionTable = new StringParam() { Name = "AlarmConditionTable", Value = stepNode.Attributes["AlarmConditionTable"].Value };
- if (stepNode.Attributes["AbortRecipeTableIndex"] != null)
- step.AbortRecipeTableIndex = stepNode.Attributes["AbortRecipeTableIndex"].Value;
- if (stepNode.Attributes["FilmThickFormula"] != null)
- step.FilmThickFormula = stepNode.Attributes["FilmThickFormula"].Value;
- if (RecipeTemplate != null && RecipeTemplate.ContainsKey("Valve"))
- {
- foreach (var item in RecipeTemplate["Valve"])
- {
- var _tempValve = step.ValveSets.FirstOrDefault(x => x.Name == item.ControlName);
- if (stepNode.Attributes[item.ControlName] != null && _tempValve != null)
- {
- var tempstr = stepNode.Attributes[item.ControlName].Value;
- //if (valveDefaultOpen.Contains(item.ControlName))
- //{
- // _tempValve.Value = true;
- //}
- //else
- //{
- var boolVal = stepNode.Attributes[item.ControlName].Value == "Open" ? true : false;
- _tempValve.Value = boolVal;
- //}
- }
- else
- {
- if (valveDefaultOpen.Contains(item.ControlName))
- {
- var findVal = step.ValveSets.FirstOrDefault(x => x.Name == item.ControlName);
- if (findVal != null)
- {
- findVal.Value = true;
- }
- else
- {
- step.ValveSets.Add(new BoolParam() { Name = item.ControlName, Value = true });
- }
- }
- else
- {
- var findVal = step.ValveSets.FirstOrDefault(x => x.Name == item.ControlName);
- if (findVal != null)
- {
- findVal.Value = false;
- }
- else
- {
- step.ValveSets.Add(new BoolParam() { Name = item.ControlName, Value = false });
- }
- }
- }
- }
- }
- if (RecipeTemplate != null && RecipeTemplate.ContainsKey("Temperature"))
- {
- foreach (var item in RecipeTemplate["Temperature"])
- {
- FromXmlNodeGetTemperatureSets(stepNode, step, item);
- }
- }
- if (RecipeTemplate != null && RecipeTemplate.ContainsKey("MFC"))
- {
- foreach (var item in RecipeTemplate["MFC"])
- {
- var mFCData = step.MFCSets.FirstOrDefault(x => x.ControlName == item.ControlName.Replace(".Flow", ""));
- if (mFCData == null)
- {
- step.MFCSets.Add(GetNewMFCData(item.ControlName));
- }
- if (step.MFCSets != null && step.MFCSets.Count > 0)
- {
- for (int i = 0; i < step.MFCSets.Count; i++)
- {
- step.MFCSets[i].No = i + 1;
- }
- }
- if (stepNode.Attributes[$"{item.ControlName}.IsSaved"] != null)
- {
- bool.TryParse(stepNode.Attributes[$"{item.ControlName}.IsSaved"].Value, out bool isSaved);
- mFCData.FlagIsSaved = isSaved;
- }
- else
- {
- mFCData.FlagIsSaved = true;
- }
- var setValue = stepNode.Attributes[$"{item.ControlName}.Set"] != null ? stepNode.Attributes[$"{item.ControlName}.Set"].Value : "0";
- mFCData.SetValue = new StringParam() { Name = "SetValue", Value = setValue };
- var strSetUnit = stepNode.Attributes[$"{item.ControlName}.SetUnit"] != null ? stepNode.Attributes[$"{item.ControlName}.SetUnit"].Value : "SLM";
- mFCData.SetUnit = new StringParam() { Name = "SetUnit", Value = strSetUnit };
- var rampngValue = stepNode.Attributes[$"{item.ControlName}.Ramprate"] != null ? stepNode.Attributes[$"{item.ControlName}.Ramprate"].Value : "0";
- mFCData.Rampng = new DoubleParam() { Name = "Rampng", Value = rampngValue };
- var strRampngUnit = stepNode.Attributes[$"{item.ControlName}.RamprateUnit"] != null ? stepNode.Attributes[$"{item.ControlName}.RamprateUnit"].Value : "SLM";
- mFCData.RampngUnit = new StringParam() { Name = "RampngUnit", Value = strRampngUnit };
- var boolIsCheck = stepNode.Attributes[$"{item.ControlName}.Check"] != null ? bool.Parse(stepNode.Attributes[$"{item.ControlName}.Check"].Value) : false;
- mFCData.IsCheck = new BoolParam() { Name = "IsCheck", Value = boolIsCheck };
- double max = 0;
- if (stepNode.Attributes[$"{item.ControlName}.High"] != null && !string.IsNullOrEmpty(stepNode.Attributes[$"{item.ControlName}.High"].Value))
- {
- double.TryParse(stepNode.Attributes[$"{item.ControlName}.High"].Value, out max);
- }
- mFCData.MaxValue = new DoubleParam() { Name = "MaxValue", Value = max.ToString() };
- double min = 0;
- if (stepNode.Attributes[$"{item.ControlName}.Low"] != null && !string.IsNullOrEmpty(stepNode.Attributes[$"{item.ControlName}.Low"].Value))
- {
- double.TryParse(stepNode.Attributes[$"{item.ControlName}.Low"].Value, out min);
- }
- mFCData.MinValue = new DoubleParam() { Name = "MinValue", Value = min.ToString() };
- mFCData.Unit = stepNode.Attributes[$"{item.ControlName}.Unit"] != null ? stepNode.Attributes[$"{item.ControlName}.Unit"].Value : "SLM";
- }
- }
- if (RecipeTemplate != null && RecipeTemplate.ContainsKey("MFM"))
- {
- step.MFMSets.Clear();
- foreach (var item in RecipeTemplate["MFM"])
- {
- if (stepNode.Attributes[item.ControlName] != null)
- {
- var MFMListValues = stepNode.Attributes[item.ControlName].Value.Split(';');
- step.MFMSets.Add(item.ControlName, new MFMValue() { Value = MFMListValues[0] });
- if (MFMListValues.Length > 1 && RecipeTemplate != null && RecipeTemplate.ContainsKey("MFMAlarm"))
- {
- step.MFMSets[item.ControlName].AlarmValue = MFMListValues[1];
- }
- else
- {
- step.MFMSets.Add(item.ControlName, new MFMValue() { Value = "0", AlarmValue = "None" });
- }
- }
- else
- {
- if (!step.MFMSets.ContainsKey(item.ControlName))
- {
- step.MFMSets.Add(item.ControlName, new MFMValue() { Value = "0", AlarmValue = "None" });
- }
- }
- }
- }
- for (int i = 1; i < 7; i++)
- {
- if (stepNode.Attributes[$"External.Out{i}"] != null && stepNode.Attributes[$"External.Out{i}"].Value != "")
- {
- if (step.EXOUSets.ContainsKey($"External.Out{i}"))
- {
- step.EXOUSets[$"External.Out{i}"] = bool.Parse(stepNode.Attributes[$"External.Out{i}"].Value);
- }
- else
- {
- step.EXOUSets.Add($"External.Out{i}", bool.Parse(stepNode.Attributes[$"External.Out{i}"].Value));
- }
- }
- else
- {
- if (!step.EXOUSets.ContainsKey($"External.Out{i}"))
- {
- step.EXOUSets.Add($"External.Out{i}", false);
- }
- }
- }
- if (stepNode.Attributes["Temperature.ControlMode"] != null)
- step.TemperatureControlMode = new StringParam() { Name = "TemperatureControlMode", Value = stepNode.Attributes["Temperature.ControlMode"].Value };
- else
- step.TemperatureControlMode = new StringParam() { Name = "TemperatureControlMode", Value = "Heater" };
- if (stepNode.Attributes["Temperature.Correct"] != null)
- step.TemperatureCorrect = new StringParam() { Name = "TemperatureCorrect", Value = stepNode.Attributes["Temperature.Correct"].Value };
- else
- step.TemperatureCorrect = new StringParam() { Name = "TemperatureCorrect", Value = "1" };
- if (stepNode.Attributes["Temperature.PID"] != null)
- step.TemperaturePID = new StringParam() { Name = "TemperaturePID", Value = stepNode.Attributes["Temperature.PID"].Value };
- else
- step.TemperaturePID = new StringParam() { Name = "TemperaturePID", Value = "1" };
- if (stepNode.Attributes["Loader.Command"] != null)
- step.LoaderCommand = new StringParam() { Name = "LoaderCommand", Value = stepNode.Attributes["Loader.Command"].Value };
- else
- step.LoaderCommand = new StringParam() { Name = "LoaderCommand", Value = "None" };
- if (stepNode.Attributes["Loader.Speed1"] != null)
- {
- step.LoaderSpeed1 = new DoubleParam() { Name = "LoaderSpeed1", Value = stepNode.Attributes["Loader.Speed1"].Value };
- }
- if (stepNode.Attributes["Loader.Speed2"] != null)
- {
- step.LoaderSpeed2 = new DoubleParam() { Name = "LoaderSpeed2", Value = stepNode.Attributes["Loader.Speed2"].Value };
- }
- if (stepNode.Attributes["Loader.Speed3"] != null)
- {
- step.LoaderSpeed3 = new DoubleParam() { Name = "LoaderSpeed3", Value = stepNode.Attributes["Loader.Speed3"].Value };
- }
- if (stepNode.Attributes["Loader.RPM"] != null)
- {
- step.LoaderRPM = new DoubleParam() { Name = "LoaderRPM", Value = stepNode.Attributes["Loader.RPM"].Value };
- }
- if (stepNode.Attributes["Press.Command"] != null)
- step.PressCommand = new StringParam() { Name = "PressCommand", Value = stepNode.Attributes["Press.Command"].Value };
- else
- step.PressCommand = new StringParam() { Name = "PressCommand", Value = "None" };
- if (stepNode.Attributes["Press.PID"] != null)
- step.PressPID = new StringParam() { Name = "PressPID", Value = stepNode.Attributes["Press.PID"].Value };
- if (stepNode.Attributes["Press.Set"] != null)
- {
- step.PressSet = new DoubleParam() { Name = "PressSet", Value = stepNode.Attributes["Press.Set"].Value };
- }
- if (stepNode.Attributes["Press.SlowVacSet"] != null)
- {
- step.PressSlowVacSet = new DoubleParam() { Name = "PressSlowVacSet", Value = stepNode.Attributes["Press.SlowVacSet"].Value };
- }
- if (stepNode.Attributes["Press.ValveAngleSet"] != null)
- step.PressValveAngleSet = new StringParam() { Name = "PressValveAngleSet", Value = stepNode.Attributes["Press.ValveAngleSet"].Value };
- if (stepNode.Attributes["Press.IsWait"] != null)
- {
- bool.TryParse(stepNode.Attributes["Press.IsWait"].Value, out bool isWait);
- step.PressIsWait = new BoolParam() { Name = "PressIsWait", Value = isWait };
- }
- if (stepNode.Attributes["Press.LowWait"] != null)
- step.PressLowWait = new StringParam() { Name = "PressLowWait", Value = !string.IsNullOrEmpty(stepNode.Attributes["Press.LowWait"].Value) ? stepNode.Attributes["Press.LowWait"].Value : "0" };
- if (stepNode.Attributes["Press.HighWait"] != null)
- step.PressHighWait = new StringParam() { Name = "PressHighWait", Value = !string.IsNullOrEmpty(stepNode.Attributes["Press.HighWait"].Value) ? stepNode.Attributes["Press.HighWait"].Value : "0" };
- if (stepNode.Attributes["Press.WaitUnit"] != null)
- {
- step.PressWaitUnit = new StringParam() { Name = "PressWaitUnit", Value = stepNode.Attributes["Press.WaitUnit"].Value };
- }
- if (stepNode.Attributes["Press.LowPressWait"] != null)
- step.PressLowPressWait = new StringParam() { Name = "PressLowPressWait", Value = !string.IsNullOrEmpty(stepNode.Attributes["Press.LowPressWait"].Value) ? stepNode.Attributes["Press.LowPressWait"].Value : "None" };
- if (stepNode.Attributes["Press.WaitPress"] != null)
- step.WaitPress = new StringParam() { Name = "PressLowPressWait", Value = !string.IsNullOrEmpty(stepNode.Attributes["Press.WaitPress"].Value) ? stepNode.Attributes["Press.WaitPress"].Value : "0" };
- if (RecipeTemplate != null && RecipeTemplate.ContainsKey("AUX"))
- {
- List<string> queryList = new List<string>();
- foreach (var item in RecipeTemplate["AUX"])
- {
- queryList.Add($"PM1.RecipeEditParameter.AUX.{item.ControlName}.Display");
- queryList.Add($"PM1.RecipeEditParameter.AUX.{item.ControlName}.Unit");
- }
- var dictValues = QueryDataClient.Instance.Service.PollConfig(queryList);
- foreach (var item in RecipeTemplate["AUX"])
- {
- if (stepNode.Attributes[$"AUX.{item.ControlName}.Set"] != null)
- {
- AUXData aUXData = step.AUXSets.FirstOrDefault(x => x.ControlName == item.ControlName);
- if (aUXData == null)
- {
- aUXData = new AUXData();
- var displayName = (string)dictValues[$"PM1.RecipeEditParameter.AUX.{item.ControlName}.Display"];
- var auxUnit = (string)dictValues[$"PM1.RecipeEditParameter.AUX.{item.ControlName}.Unit"];
- aUXData.ControlName = item.ControlName;
- aUXData.DisplayName = displayName;
- aUXData.Unit = auxUnit;
- }
- float setValue = 0;
- if (stepNode.Attributes[$"AUX.{item.ControlName}.Set"] != null)
- {
- float.TryParse(stepNode.Attributes[$"AUX.{item.ControlName}.Set"].Value, out setValue);
- }
- aUXData.SetValue = new DoubleParam() { Name = "SetValue", Value = setValue.ToString() };
- var _ischeck = stepNode.Attributes[$"AUX.{item.ControlName}.Check"] != null ? bool.Parse(stepNode.Attributes[$"AUX.{item.ControlName}.Check"].Value) : false;
- aUXData.IsCheck = new BoolParam() { Name = "IsCheck", Value = _ischeck };
- float maxValue = 0;
- if (stepNode.Attributes[$"AUX.{item.ControlName}.High"] != null)
- {
- float.TryParse(stepNode.Attributes[$"AUX.{item.ControlName}.High"].Value, out maxValue);
- }
- aUXData.MaxValue = new DoubleParam() { Name = "MaxValue", Value = maxValue.ToString() };
- float minValue = 0;
- if (stepNode.Attributes[$"AUX.{item.ControlName}.Low"] != null)
- {
- float.TryParse(stepNode.Attributes[$"AUX.{item.ControlName}.Low"].Value, out minValue);
- }
- aUXData.MinValue = new DoubleParam() { Name = "MinValue", Value = minValue.ToString() };
- var _setunit = stepNode.Attributes[$"AUX.{item.ControlName}.CheckUnit"] != null ? stepNode.Attributes[$"AUX.{item.ControlName}.CheckUnit"].Value : "℃";
- aUXData.SetUnit = new StringParam() { Name = "SetUnit", Value = _setunit };
- if (step.AUXSets.Where(x => x.Name == item.ControlName).Any())
- {
- step.AUXSets.Add(aUXData);
- }
- }
- else
- {
- var displayName = (string)dictValues[$"PM1.RecipeEditParameter.AUX.{item.ControlName}.Display"];
- var auxUnit = (string)dictValues[$"PM1.RecipeEditParameter.AUX.{item.ControlName}.Unit"];
- if (step.AUXSets.Where(x => x.Name == item.ControlName).Any())
- {
- AddNewAUX(step, item, displayName, auxUnit);
- }
- }
- }
- }
- }
- SetDelegateEvent(step);
- return step;
- }
- }
- public void SetDelegateEvent(Step step)
- {
- //MFCSetsCollectionChanged(step);
- //TemperatureSetsCollectionChanged(step);
- //ValveSetsCollectionChanged(step);
- //AUXSetsCollectionChanged(step);
- Task[] tasks = new Task[4];
- tasks[0] = Task.Factory.StartNew(() =>
- {
- MFCSetsCollectionChanged(step);
- });
- tasks[1] = Task.Factory.StartNew(() =>
- {
- TemperatureSetsCollectionChanged(step);
- });
- tasks[2] = Task.Factory.StartNew(() =>
- {
- ValveSetsCollectionChanged(step);
- });
- tasks[3] = Task.Factory.StartNew(() =>
- {
- AUXSetsCollectionChanged(step);
- });
- Task.WaitAll(tasks);
- }
- private void MFCSetsCollectionChanged(Step step)
- {
- foreach (var item in step.MFCSets)
- {
- item.PropertyChanged += step.MFCIsSaved_PropertyChanged;
- item.ValueChangedEvent += step.Item_MFCValueChangedEvent;
- }
- }
- private void TemperatureSetsCollectionChanged(Step step)
- {
- foreach (var item in step.TemperatureSets)
- {
- item.PropertyChanged += step.TemperatureIsSaved_PropertyChanged;
- item.ValueChangedEvent += step.Item_TempValueChangedEvent;
- }
- }
- private void ValveSetsCollectionChanged(Step step)
- {
- foreach (var item in step.ValveSets)
- {
- item.PropertyChanged += step.ValveIsSaved_PropertyChanged;
- item.ValueChangedEvent += step.Item_ValveValueChangedEvent;
- }
- //step.ValveSets.CollectionChanged += (s, e) =>
- //{
- // if (e.OldItems != null)
- // {
- // foreach (BoolParam item in e.OldItems)
- // {
- // item.PropertyChanged -= step.ValveIsSaved_PropertyChanged;
- // item.ValueChangedEvent -= step.Item_ValveValueChangedEvent;
- // }
- // }
- // if (e.NewItems != null)
- // {
- // foreach (BoolParam item in e.NewItems)
- // {
- // item.PropertyChanged += step.ValveIsSaved_PropertyChanged;
- // item.ValueChangedEvent += step.Item_ValveValueChangedEvent;
- // }
- // }
- //};
- }
- private void AUXSetsCollectionChanged(Step step)
- {
- foreach (var item in step.AUXSets)
- {
- item.PropertyChanged += step.AUXIsSaved_PropertyChanged;
- item.ValueChangedEvent += step.Item_AUXValueChangedEvent;
- }
- //step.AUXSets.CollectionChanged += (s, e) =>
- //{
- // if (e.OldItems != null)
- // {
- // foreach (AUXData item in e.OldItems)
- // {
- // item.PropertyChanged -= step.AUXIsSaved_PropertyChanged;
- // item.ValueChangedEvent -= step.Item_AUXValueChangedEvent;
- // }
- // }
- // if (e.NewItems != null)
- // {
- // foreach (AUXData item in e.NewItems)
- // {
- // item.PropertyChanged += step.AUXIsSaved_PropertyChanged;
- // item.ValueChangedEvent += step.Item_AUXValueChangedEvent;
- // }
- // }
- //};
- }
- private static void AddNewAUX(Step step, RecipeTemplateColumnBase item, string displayName, string auxUnit)
- {
- var tempAUX = new AUXData()
- {
- ControlName = item.ControlName,
- DisplayName = displayName,
- SetValue = new DoubleParam() { Name = "SetValue", Value = "0" },
- SetUnit = new StringParam() { Name = "SetUnit", Value = auxUnit },
- Rampng = new DoubleParam() { Name = "Rampng", Value = "0" },
- RampngUnit = new StringParam() { Name = "RampngUnit", Value = "SLM" },
- AlarmValue = "None",
- IsCheck = new BoolParam() { Name = "IsCheck", Value = false },
- MaxValue = new DoubleParam() { Name = "MaxValue", Value = "0" },
- MinValue = new DoubleParam() { Name = "MinValue", Value = "0" },
- Unit = auxUnit
- };
- step.AUXSets.Add(tempAUX);
- }
- public Step CreateStep(XmlNode stepNode = null)
- {
- Step step = new Step();
- if (stepNode != null)
- {
- if (stepNode.Attributes["StepNo"] != null)
- step.StepNo = int.Parse(stepNode.Attributes["StepNo"].Value);
- if (stepNode.Attributes["Name"] != null)
- step.Name = stepNode.Attributes["Name"].Value;
- if (stepNode.Attributes["EndBy"] != null)
- step.EndBy = stepNode.Attributes["EndBy"].Value;
- if (stepNode.Attributes["Time"] != null)
- {
- if (stepNode.Attributes["Time"] != null)
- {
- var timeValue = stepNode.Attributes["Time"].Value;
- if (!string.IsNullOrEmpty(timeValue) && !timeValue.Contains('.'))
- {
- timeValue = $"{timeValue}.0";
- }
- step.Time = timeValue;
- }
- }
- if (stepNode.Attributes["SkipWait"] != null)
- step.SkipWait = stepNode.Attributes["SkipWait"].Value;
- else
- step.SkipWait = "";
- if (stepNode.Attributes["Command"] != null)
- step.Command = stepNode.Attributes["Command"].Value;
- AnalysisIsSaved(stepNode, step);
- ReadConditionCheck(stepNode, step);
- if (stepNode.Attributes["AbortRecipeTableIndex"] != null)
- step.AbortRecipeTableIndex = stepNode.Attributes["AbortRecipeTableIndex"].Value;
- if (RecipeTemplate != null && RecipeTemplate.ContainsKey("Valve"))
- {
- step.ValveSets.Clear();
- foreach (var item in RecipeTemplate["Valve"])
- {
- if (stepNode.Attributes[item.ControlName] != null)
- {
- var valValue = stepNode.Attributes[item.ControlName].Value == "Open" ? true : false;
- step.ValveSets.Add(new BoolParam() { Name = item.ControlName, Value = valValue });
- }
- else
- {
- if (valveDefaultOpen.Contains(item.ControlName))
- {
- step.ValveSets.Add(new BoolParam() { Name = item.ControlName, Value = true });
- }
- else
- {
- step.ValveSets.Add(new BoolParam() { Name = item.ControlName, Value = false });
- }
- }
- }
- }
- if (RecipeTemplate != null && RecipeTemplate.ContainsKey("Temperature"))
- {
- step.TemperatureSets.Clear();
- foreach (var item in RecipeTemplate["Temperature"])
- {
- FromXmlNodeGetTemperatureSets(stepNode, step, item);
- }
- }
- if (RecipeTemplate != null && RecipeTemplate.ContainsKey("MFC"))
- {
- step.MFCSets.Clear();
- foreach (var item in RecipeTemplate["MFC"])
- {
- if (stepNode.Attributes[$"{item.ControlName}.Set"] != null)
- {
- step.MFCSets.Add(StepNodeToMFCData(stepNode, item));
- }
- else
- {
- step.MFCSets.Add(GetNewMFCData(item.ControlName));
- }
- }
- if (step.MFCSets != null && step.MFCSets.Count > 0)
- {
- for (int i = 0; i < step.MFCSets.Count; i++)
- {
- step.MFCSets[i].No = i + 1;
- }
- }
- }
- if (RecipeTemplate != null && RecipeTemplate.ContainsKey("MFM"))
- {
- step.MFMSets.Clear();
- foreach (var item in RecipeTemplate["MFM"])
- {
- if (stepNode.Attributes[item.ControlName] != null)
- {
- var MFMListValues = stepNode.Attributes[item.ControlName].Value.Split(';');
- step.MFMSets.Add(item.ControlName, new MFMValue() { Value = MFMListValues[0] });
- if (MFMListValues.Length > 1 && RecipeTemplate != null && RecipeTemplate.ContainsKey("MFMAlarm"))
- {
- step.MFMSets[item.ControlName].AlarmValue = MFMListValues[1];
- }
- }
- else
- {
- step.MFMSets.Add(item.ControlName, new MFMValue() { Value = "0", AlarmValue = "None" });
- }
- }
- }
- for (int i = 1; i < 7; i++)
- {
- if (stepNode.Attributes[$"External.Out{i}"] != null && stepNode.Attributes[$"External.Out{i}"].Value != "")
- {
- step.EXOUSets.Add($"External.Out{i}", bool.Parse(stepNode.Attributes[$"External.Out{i}"].Value));
- }
- else
- {
- step.EXOUSets.Add($"External.Out{i}", false);
- }
- }
- if (stepNode.Attributes["AlarmConditionTable"] != null)
- step.AlarmConditionTable = new StringParam() { Name = "AlarmConditionTable", Value = stepNode.Attributes["AlarmConditionTable"].Value };
- if (stepNode.Attributes["Temperature.ControlMode"] != null)
- step.TemperatureControlMode = new StringParam() { Name = "TemperatureControlMode", Value = stepNode.Attributes["Temperature.ControlMode"].Value };
- else
- step.TemperatureControlMode = new StringParam() { Name = "TemperatureControlMode", Value = "Heater" };
- if (stepNode.Attributes["Temperature.Correct"] != null)
- step.TemperatureCorrect = new StringParam() { Name = "TemperatureCorrect", Value = stepNode.Attributes["Temperature.Correct"].Value };
- else
- step.TemperatureCorrect = new StringParam() { Name = "TemperatureCorrect", Value = "1" };
- if (stepNode.Attributes["Temperature.PID"] != null)
- step.TemperaturePID = new StringParam() { Name = "TemperaturePID", Value = stepNode.Attributes["Temperature.PID"].Value };
- else
- step.TemperaturePID = new StringParam() { Name = "TemperaturePID", Value = "1" };
- if (stepNode.Attributes["Loader.Command"] != null)
- step.LoaderCommand = new StringParam() { Name = "LoaderCommand", Value = stepNode.Attributes["Loader.Command"].Value };
- else
- step.LoaderCommand = new StringParam() { Name = "LoaderCommand", Value = "None" };
- if (stepNode.Attributes["Loader.Speed1"] != null)
- {
- step.LoaderSpeed1 = new DoubleParam() { Name = "LoaderSpeed1", Value = stepNode.Attributes["Loader.Speed1"].Value };
- }
- if (stepNode.Attributes["Loader.Speed2"] != null)
- {
- step.LoaderSpeed2 = new DoubleParam() { Name = "LoaderSpeed2", Value = stepNode.Attributes["Loader.Speed2"].Value };
- }
- if (stepNode.Attributes["Loader.Speed3"] != null)
- {
- step.LoaderSpeed3 = new DoubleParam() { Name = "LoaderSpeed3", Value = stepNode.Attributes["Loader.Speed3"].Value };
- }
- if (stepNode.Attributes["Loader.RPM"] != null)
- {
- step.LoaderRPM = new DoubleParam() { Name = "LoaderRPM", Value = stepNode.Attributes["Loader.RPM"].Value };
- }
- if (stepNode.Attributes["Press.Command"] != null)
- step.PressCommand = new StringParam() { Name = "PressCommand", Value = stepNode.Attributes["Press.Command"].Value };
- else
- step.PressCommand = new StringParam() { Name = "PressCommand", Value = "None" };
- if (stepNode.Attributes["Press.PID"] != null)
- step.PressPID = new StringParam() { Name = "PressPID", Value = stepNode.Attributes["Press.PID"].Value };
- if (stepNode.Attributes["Press.Set"] != null)
- {
- step.PressSet = new DoubleParam() { Name = "PressSet", Value = stepNode.Attributes["Press.Set"].Value };
- }
- if (stepNode.Attributes["Press.SlowVacSet"] != null)
- {
- step.PressSlowVacSet = new DoubleParam() { Name = "PressSet", Value = stepNode.Attributes["Press.SlowVacSet"].Value };
- }
- if (stepNode.Attributes["Press.ValveAngleSet"] != null)
- step.PressValveAngleSet = new StringParam() { Name = "PressValveAngleSet", Value = stepNode.Attributes["Press.ValveAngleSet"].Value };
- if (stepNode.Attributes["Press.IsWait"] != null)
- {
- bool.TryParse(stepNode.Attributes["Press.IsWait"].Value, out bool isWait);
- step.PressIsWait = new BoolParam() { Name = "PressIsWait", Value = isWait };
- }
- if (stepNode.Attributes["Press.LowWait"] != null)
- step.PressLowWait = new StringParam() { Name = "PressLowWait", Value = !string.IsNullOrEmpty(stepNode.Attributes["Press.LowWait"].Value) ? stepNode.Attributes["Press.LowWait"].Value : "0" };
- if (stepNode.Attributes["Press.HighWait"] != null)
- step.PressHighWait = new StringParam() { Name = "PressHighWait", Value = !string.IsNullOrEmpty(stepNode.Attributes["Press.HighWait"].Value) ? stepNode.Attributes["Press.HighWait"].Value : "0" };
- if (stepNode.Attributes["Press.WaitUnit"] != null)
- {
- step.PressWaitUnit = new StringParam() { Name = "PressWaitUnit", Value = stepNode.Attributes["Press.WaitUnit"].Value };
- }
- if (stepNode.Attributes["Press.LowPressWait"] != null)
- step.PressLowPressWait = new StringParam() { Name = "PressLowPressWait", Value = !string.IsNullOrEmpty(stepNode.Attributes["Press.LowPressWait"].Value) ? stepNode.Attributes["Press.LowPressWait"].Value : "None" };
- if (stepNode.Attributes["Press.WaitPress"] != null)
- step.WaitPress = new StringParam() { Name = "WaitPress", Value = !string.IsNullOrEmpty(stepNode.Attributes["Press.WaitPress"].Value) ? stepNode.Attributes["Press.WaitPress"].Value : "0" };
- if (RecipeTemplate != null && RecipeTemplate.ContainsKey("AUX"))
- {
- step.AUXSets.Clear();
- foreach (var item in RecipeTemplate["AUX"])
- {
- var displayName = (string)QueryDataClient.Instance.Service.GetConfig($"PM1.RecipeEditParameter.AUX.{item.ControlName}.Display");
- var auxUnit = (string)QueryDataClient.Instance.Service.GetConfig($"PM1.RecipeEditParameter.AUX.{item.ControlName}.Unit");
- if (stepNode.Attributes[$"AUX.{item.ControlName}.Set"] != null)
- {
- AUXData aUXData = new AUXData();
- aUXData.ControlName = item.ControlName;
- aUXData.DisplayName = displayName;
- aUXData.Unit = auxUnit;
- float setValue = 0;
- if (stepNode.Attributes[$"AUX.{item.ControlName}.Set"] != null)
- {
- float.TryParse(stepNode.Attributes[$"AUX.{item.ControlName}.Set"].Value, out setValue);
- }
- aUXData.SetValue = new DoubleParam() { Name = "SetValue", Value = setValue.ToString() };
- aUXData.IsCheck = new BoolParam() { Name = "IsCheck", Value = stepNode.Attributes[$"AUX.{item.ControlName}.Check"] != null ? bool.Parse(stepNode.Attributes[$"AUX.{item.ControlName}.Check"].Value) : false };
- float maxValue = 0;
- if (stepNode.Attributes[$"AUX.{item.ControlName}.High"] != null)
- {
- float.TryParse(stepNode.Attributes[$"AUX.{item.ControlName}.High"].Value, out maxValue);
- }
- aUXData.MaxValue = new DoubleParam() { Name = "MaxValue", Value = maxValue.ToString() };
- float minValue = 0;
- if (stepNode.Attributes[$"AUX.{item.ControlName}.Low"] != null)
- {
- float.TryParse(stepNode.Attributes[$"AUX.{item.ControlName}.Low"].Value, out minValue);
- }
- aUXData.MinValue = new DoubleParam() { Name = "MinValue", Value = minValue.ToString() };
- aUXData.SetUnit = new StringParam() { Name = "SetUnit", Value = stepNode.Attributes[$"AUX.{item.ControlName}.CheckUnit"] != null ? stepNode.Attributes[$"AUX.{item.ControlName}.CheckUnit"].Value : "℃" };
- step.AUXSets.Add(aUXData);
- }
- else
- {
- AddNewAUX(step, item, displayName, auxUnit);
- }
- }
- }
- if (stepNode.Attributes["AbortRecipeTableIndex"] != null)
- step.AbortRecipeTableIndex = stepNode.Attributes["AbortRecipeTableIndex"].Value;
- else
- step.AbortRecipeTableIndex = "None";
- for (int i = 1; i < 11; i++)
- {
- string tempType = "";
- string tempDetails = "";
- if (stepNode.Attributes[$"AlarmAction.{i}"] != null && stepNode.Attributes[$"AlarmAction.{i}"].Value != "")
- {
- tempType = stepNode.Attributes[$"AlarmAction.{i}"].Value;
- }
- else
- {
- tempType = "Ignore Alarm";
- }
- if (stepNode.Attributes[$"AlarmDetails.{i}"] != null)
- tempDetails = stepNode.Attributes[$"AlarmDetails.{i}"].Value;
- step.AlarmActionSets.Add(i, new AlarmAction()
- {
- PtocessingType = tempType,
- PtocessingDetails = tempDetails
- });
- }
- if (stepNode.Attributes["FilmThickFormula"] != null)
- step.FilmThickFormula = stepNode.Attributes["FilmThickFormula"].Value;
- }
- else
- {
- step.StepNo = StepNo;
- step.Name = "Name" + StepNo.ToString();
- step.EndBy = "EndByStepTime";
- step.Time = null;
- step.SkipWait = "";
- step.Command = "NoControl";
- step.IsnoneConditionCheck = true;
- step.AlarmConditionTable = new StringParam() { Name = "AlarmConditionTable", Value = "1:" };
- if (RecipeTemplate != null && RecipeTemplate.ContainsKey("Valve"))
- {
- step.ValveSets.Clear();
- foreach (var item in RecipeTemplate["Valve"])
- {
- if (valveDefaultOpen.Contains(item.ControlName))
- {
- step.ValveSets.Add(new BoolParam() { Name = item.ControlName, Value = true });
- }
- else
- {
- step.ValveSets.Add(new BoolParam() { Name = item.ControlName, Value = false });
- }
- }
- }
- if (RecipeTemplate != null && RecipeTemplate.ContainsKey("Temperature"))
- {
- step.TemperatureSets.Clear();
- foreach (var item in RecipeTemplate["Temperature"])
- {
- var configHeater = (string)QueryDataClient.Instance.Service.GetConfig($"PM1.Heater.{item.ControlName}.DisplayName");
- var tempSetData = new TempSetData(configHeater);
- tempSetData.Name = item.ControlName;
- tempSetData.DisplayName = configHeater;
- step.TemperatureSets.Add(tempSetData);
- }
- }
- if (RecipeTemplate != null && RecipeTemplate.ContainsKey("MFC"))
- {
- step.MFCSets.Clear();
- foreach (var item in RecipeTemplate["MFC"])
- {
- step.MFCSets.Add(GetNewMFCData(item.ControlName)); ;
- }
- if (step.MFCSets != null && step.MFCSets.Count > 0)
- {
- for (int i = 0; i < step.MFCSets.Count; i++)
- {
- step.MFCSets[i].No = i + 1;
- }
- }
- }
- if (RecipeTemplate != null && RecipeTemplate.ContainsKey("MFM"))
- {
- step.MFMSets.Clear();
- foreach (var item in RecipeTemplate["MFM"])
- {
- step.MFMSets.Add(item.ControlName, new MFMValue() { Value = "0", AlarmValue = "None" }); ;
- }
- }
- step.TemperatureControlMode = new StringParam() { Name = "TemperatureControlMode", Value = "Heater" };
- step.TemperatureCorrect = new StringParam() { Name = "TemperatureCorrect", Value = "" };
- step.TemperaturePID = new StringParam() { Name = "TemperaturePID", Value = "" };
- step.LoaderCommand = new StringParam() { Name = "Loader", Value = "None" };
- step.PressCommand = new StringParam() { Name = "PressCommand", Value = "None" };
- step.FilmThickFormula = "";
- step.AbortRecipeTableIndex = "None";
- step.FinishAutoProfile = "None";
- step.ReachPressure = "None";
- step.ReachTemp = "None";
- step.O2Density = "None";
- step.TempStabilizeSelected = "None";
- step.PressureStabilizeSelected = "None";
- step.ProcessTimeToEnd = "None";
- if (RecipeTemplate != null && RecipeTemplate.ContainsKey("AUX"))
- {
- step.AUXSets.Clear();
- foreach (var item in RecipeTemplate["AUX"])
- {
- var displayName = (string)QueryDataClient.Instance.Service.GetConfig($"PM1.RecipeEditParameter.AUX.{item.ControlName}.Display");
- var auxUnit = (string)QueryDataClient.Instance.Service.GetConfig($"PM1.RecipeEditParameter.AUX.{item.ControlName}.Unit");
- AddNewAUX(step, item, displayName, auxUnit);
- // 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 });
- }
- }
- StepNo++;
- }
- return step;
- }
- private static void AnalysisIsSaved(XmlNode stepNode, Step step)
- {
- if (stepNode.Attributes["AlarmIsSaved"] != null)
- {
- bool isSaved = true;
- bool.TryParse(stepNode.Attributes["AlarmIsSaved"].Value, out isSaved);
- step.AlarmIsSaved = isSaved;
- }
- else
- {
- step.AlarmIsSaved = true;
- }
- if (stepNode.Attributes["MFCIsSaved"] != null)
- {
- bool isSaved = true;
- bool.TryParse(stepNode.Attributes["MFCIsSaved"].Value, out isSaved);
- step.MFCIsSaved = isSaved;
- }
- else
- {
- step.MFCIsSaved = true;
- }
- if (stepNode.Attributes["ValveIsSaved"] != null)
- {
- bool isSaved = true;
- bool.TryParse(stepNode.Attributes["ValveIsSaved"].Value, out isSaved);
- step.ValveIsSaved = isSaved;
- }
- else
- {
- step.ValveIsSaved = true;
- }
- if (stepNode.Attributes["PressIsSaved"] != null)
- {
- bool isSaved = true;
- bool.TryParse(stepNode.Attributes["PressIsSaved"].Value, out isSaved);
- step.PressIsSaved = isSaved;
- }
- else
- {
- step.PressIsSaved = true;
- }
- if (stepNode.Attributes["AUXIsSaved"] != null)
- {
- bool isSaved = true;
- bool.TryParse(stepNode.Attributes["AUXIsSaved"].Value, out isSaved);
- step.AUXIsSaved = isSaved;
- }
- else
- {
- step.AUXIsSaved = true;
- }
- if (stepNode.Attributes["TemperatureIsSaved"] != null)
- {
- bool isSaved = true;
- bool.TryParse(stepNode.Attributes["TemperatureIsSaved"].Value, out isSaved);
- step.TemperatureIsSaved = isSaved;
- }
- else
- {
- step.TemperatureIsSaved = true;
- }
- }
- private static void FromXmlNodeGetTemperatureSets(XmlNode stepNode, Step step, RecipeTemplateColumnBase item)
- {
- var configHeater = (string)QueryDataClient.Instance.Service.GetConfig($"PM1.Heater.{item.ControlName}.DisplayName");
- TempSetData tempSetData = new TempSetData();
- tempSetData.Name = item.ControlName;
- tempSetData.DisplayName = configHeater != null ? configHeater : item.ControlName;
- tempSetData.SetValue = new StringParam() { Name = "SetValue", Value = stepNode.Attributes[$"{item.ControlName}.Set"] != null ? stepNode.Attributes[$"{item.ControlName}.Set"].Value : "0" };
- tempSetData.SetUnit = new StringParam() { Name = "SetUnit", Value = stepNode.Attributes[$"{item.ControlName}.SetUnit"] != null ? stepNode.Attributes[$"{item.ControlName}.SetUnit"].Value : "℃" };
- tempSetData.RampngValue = new DoubleParam() { Name = "RampngValue", Value = stepNode.Attributes[$"{item.ControlName}.Ramprate"] != null ? stepNode.Attributes[$"{item.ControlName}.Ramprate"].Value : "0" };
- tempSetData.RampngUnit = new StringParam() { Name = "RampngUnit", Value = stepNode.Attributes[$"{item.ControlName}.RamprateUnit"] != null ? stepNode.Attributes[$"{item.ControlName}.RamprateUnit"].Value : "℃/min" };
- bool tempCheck = false;
- if (stepNode.Attributes[$"{item.ControlName}.Check"] != null) bool.TryParse(stepNode.Attributes[$"{item.ControlName}.Check"].Value, out tempCheck);
- tempSetData.IsCheck = new BoolParam() { Name = "IsCheck", Value = tempCheck };
- double tempHigh = 0;
- if (stepNode.Attributes[$"{item.ControlName}.High"] != null) double.TryParse(stepNode.Attributes[$"{item.ControlName}.High"].Value, out tempHigh);
- tempSetData.HighValue = new DoubleParam() { Name = "HighValue", Value = tempHigh.ToString() };
- double tempLow = 0;
- if (stepNode.Attributes[$"{item.ControlName}.Low"] != null) double.TryParse(stepNode.Attributes[$"{item.ControlName}.Low"].Value, out tempLow);
- tempSetData.LowValue = new DoubleParam() { Name = "LowValue", Value = tempLow.ToString() };
- tempSetData.Unit = stepNode.Attributes[$"{item.ControlName}.Unit"] != null ? stepNode.Attributes[$"{item.ControlName}.Unit"].Value : "0";
- if (!step.TemperatureSets.Where(x => x.Name == item.ControlName).Any())
- {
- step.TemperatureSets.Add(tempSetData);
- }
- else
- {
- var tempTemperatureSets = step.TemperatureSets.FirstOrDefault(x => x.Name == item.ControlName);
- int getIndex = step.TemperatureSets.IndexOf(tempTemperatureSets);
- step.TemperatureSets.Remove(tempTemperatureSets);
- step.TemperatureSets.Insert(getIndex, tempSetData);
- }
- }
- private static MFCData StepNodeToMFCData(XmlNode stepNode, RecipeTemplateColumnBase item)
- {
- MFCData mFCValue = new MFCData();
- mFCValue.ControlName = item.ControlName.Replace(".Flow", "");
- if (stepNode.Attributes[$"{item.ControlName}.IsSaved"] != null)
- {
- bool isSaved = true;
- bool.TryParse(stepNode.Attributes[$"{item.ControlName}.IsSaved"].Value, out isSaved);
- mFCValue.FlagIsSaved = isSaved;
- }
- else
- {
- mFCValue.FlagIsSaved = true;
- }
- var setValue = stepNode.Attributes[$"{item.ControlName}.Set"] != null ? stepNode.Attributes[$"{item.ControlName}.Set"].Value : "0";
- mFCValue.SetValue = new StringParam() { Name = "SetValue", Value = setValue };
- var strSetUnit = stepNode.Attributes[$"{item.ControlName}.SetUnit"] != null ? stepNode.Attributes[$"{item.ControlName}.SetUnit"].Value : "SLM";
- mFCValue.SetUnit = new StringParam() { Name = "SetUnit", Value = strSetUnit };
- var rampngValue = stepNode.Attributes[$"{item.ControlName}.Ramprate"] != null ? stepNode.Attributes[$"{item.ControlName}.Ramprate"].Value : "0";
- mFCValue.Rampng = new DoubleParam() { Name = "Rampng", Value = rampngValue };
- var strRampngUnit = stepNode.Attributes[$"{item.ControlName}.RamprateUnit"] != null ? stepNode.Attributes[$"{item.ControlName}.RamprateUnit"].Value : "SLM";
- mFCValue.RampngUnit = new StringParam() { Name = "RampngUnit", Value = strRampngUnit };
- var boolIsCheck = stepNode.Attributes[$"{item.ControlName}.Check"] != null ? bool.Parse(stepNode.Attributes[$"{item.ControlName}.Check"].Value) : false;
- mFCValue.IsCheck = new BoolParam() { Name = "IsCheck", Value = boolIsCheck };
- double maxValue = 0;
- if (stepNode.Attributes[$"{item.ControlName}.High"] != null && !string.IsNullOrEmpty(stepNode.Attributes[$"{item.ControlName}.High"].Value))
- double.TryParse(stepNode.Attributes[$"{item.ControlName}.High"].Value, out maxValue);
- mFCValue.MaxValue = new DoubleParam() { Name = "MaxValue", Value = maxValue.ToString("F3") };
- double minValue = 0;
- if (stepNode.Attributes[$"{item.ControlName}.Low"] != null && !string.IsNullOrEmpty(stepNode.Attributes[$"{item.ControlName}.Low"].Value))
- double.TryParse(stepNode.Attributes[$"{item.ControlName}.High"].Value, out minValue);
- mFCValue.MinValue = new DoubleParam() { Name = "MinValue", Value = minValue.ToString("F3") };
- mFCValue.Unit = stepNode.Attributes[$"{item.ControlName}.Unit"] != null ? stepNode.Attributes[$"{item.ControlName}.Unit"].Value : "SLM";
- mFCValue.ScaleValue = SystemConfigProvider.Instance.GetValueByName($"PM1.MFC.{item.ModuleName}.N2Scale");
- return mFCValue;
- }
- public Step CreateStandbyStep()
- {
- Step step = new Step();
- step.StepNo = 0;
- step.Name = "Standby";
- step.EndBy = "EndByStepTime";
- step.Time = null;
- step.SkipWait = "";
- step.Command = "NoControl";
- //step.ZAxisPosition = "None";
- step.AbortRecipeTableIndex = "None";
- //step.ZAxisSpeed = "0";
- //step.RotatePosition = "None";
- //step.RotateDirection = "CW";
- //step.RotateSpeed = "0";
- //step.RotateInterval = "0";
- //step.APC_SetPressure = "0";
- step.IsnoneConditionCheck = true;
- step.AlarmConditionTable = new StringParam() { Name = "AlarmConditionTable", Value = "1:" };
- //step.MfmD1Flow = new MFMValue() { Value = "0", AlarmValue = "None" };
- if (RecipeTemplate != null && RecipeTemplate.ContainsKey("Valve"))
- {
- step.ValveSets.Clear();
- foreach (var item in RecipeTemplate["Valve"])
- {
- if (valveDefaultOpen.Contains(item.ControlName))
- {
- step.ValveSets.Add(new BoolParam() { Name = item.ControlName, Value = true });
- }
- else
- {
- step.ValveSets.Add(new BoolParam() { Name = item.ControlName, Value = false });
- }
- }
- }
- if (RecipeTemplate != null && RecipeTemplate.ContainsKey("Temperature"))
- {
- step.TemperatureSets.Clear();
- foreach (var item in RecipeTemplate["Temperature"])
- {
- var configHeater = (string)QueryDataClient.Instance.Service.GetConfig($"PM1.Heater.{item.ControlName}.DisplayName");
- var tempSet = new TempSetData(configHeater);
- tempSet.Name = item.ControlName;
- step.TemperatureSets.Add(tempSet);
- }
- }
- if (RecipeTemplate != null && RecipeTemplate.ContainsKey("MFC"))
- {
- step.MFCSets.Clear();
- foreach (var item in RecipeTemplate["MFC"])
- {
- step.MFCSets.Add(GetNewMFCData(item.ControlName)); ;
- }
- if (step.MFCSets != null && step.MFCSets.Count > 0)
- {
- for (int i = 0; i < step.MFCSets.Count; i++)
- {
- step.MFCSets[i].No = i + 1;
- }
- }
- }
- if (RecipeTemplate != null && RecipeTemplate.ContainsKey("MFM"))
- {
- step.MFMSets.Clear();
- foreach (var item in RecipeTemplate["MFM"])
- {
- step.MFMSets.Add(item.ControlName, new MFMValue() { Value = "0", AlarmValue = "0" }); ;
- }
- }
- step.TemperatureControlMode = new StringParam() { Name = "TemperatureControlMode", Value = "Heater" };
- step.TemperatureCorrect = new StringParam() { Name = "TemperatureCorrect", Value = "" };
- step.TemperaturePID = new StringParam() { Name = "TemperaturePID", Value = "" };
- step.LoaderCommand = new StringParam() { Name = "LoaderCommand", Value = "None" };
- step.PressCommand = new StringParam() { Name = "PressCommand", Value = "None" };
- //step.TemperatureProfile = "None";
- //step.TemperatureAlarm = "None";
- //step.CAPTemperatureAlarm = "None";
- //step.TemperatureStabilize = "None";
- step.FilmThickFormula = "None";
- //隐藏StandBy行
- //step.IsVisibility = Visibility.Collapsed;
- return step;
- }
- public Step CreateFirstStep()
- {
- Step step = new Step();
- step.StepNo = 1;
- step.Name = "Name";
- step.EndBy = "EndByStepTime";
- step.Time = null;
- step.SkipWait = "";
- step.Command = "NoControl";
- //step.ZAxisPosition = "None";
- step.AbortRecipeTableIndex = "None";
- //step.ZAxisSpeed = "0";
- //step.RotatePosition = "None";
- //step.RotateDirection = "CW";
- //step.RotateSpeed = "0";
- //step.RotateInterval = "0";
- //step.APC_SetPressure = "0";
- step.IsnoneConditionCheck = true;
- step.AlarmConditionTable = new StringParam() { Name = "AlarmConditionTable", Value = "1:" };
- //step.MfmD1Flow = new MFMValue() { Value = "0", AlarmValue = "None" };
- if (RecipeTemplate != null && RecipeTemplate.ContainsKey("Valve"))
- {
- step.ValveSets.Clear();
- foreach (var item in RecipeTemplate["Valve"])
- {
- if (valveDefaultOpen.Contains(item.ControlName))
- {
- step.ValveSets.Add(new BoolParam() { Name = item.ControlName, Value = true });
- }
- else
- {
- step.ValveSets.Add(new BoolParam() { Name = item.ControlName, Value = false });
- }
- }
- }
- if (RecipeTemplate != null && RecipeTemplate.ContainsKey("Temperature"))
- {
- step.TemperatureSets.Clear();
- foreach (var item in RecipeTemplate["Temperature"])
- {
- var configHeater = (string)QueryDataClient.Instance.Service.GetConfig($"PM1.Heater.{item.ControlName}.DisplayName");
- var tempSet = new TempSetData(configHeater);
- tempSet.Name = item.ControlName;
- step.TemperatureSets.Add(tempSet);
- }
- }
- if (RecipeTemplate != null && RecipeTemplate.ContainsKey("MFC"))
- {
- step.MFCSets.Clear();
- foreach (var item in RecipeTemplate["MFC"])
- {
- step.MFCSets.Add(GetNewMFCData(item.ControlName));
- }
- if (step.MFCSets != null && step.MFCSets.Count > 0)
- {
- for (int i = 0; i < step.MFCSets.Count; i++)
- {
- step.MFCSets[i].No = i + 1;
- }
- }
- }
- if (RecipeTemplate != null && RecipeTemplate.ContainsKey("MFM"))
- {
- step.MFMSets.Clear();
- foreach (var item in RecipeTemplate["MFM"])
- {
- step.MFMSets.Add(item.ControlName, new MFMValue() { Value = "0", AlarmValue = "0" }); ;
- }
- }
- step.TemperatureControlMode = new StringParam() { Name = "TemperatureControlMode", Value = "Heater" };
- step.TemperatureCorrect = new StringParam() { Name = "TemperatureCorrect", Value = "" };
- step.TemperaturePID = new StringParam() { Name = "TemperaturePID", Value = "" };
- step.LoaderCommand = new StringParam() { Name = "LoaderCommand", Value = "None" };
- step.PressCommand = new StringParam() { Name = "PressCommand", Value = "None" };
- //step.TemperatureProfile = "None";
- //step.TemperatureAlarm = "None";
- //step.CAPTemperatureAlarm = "None";
- //step.TemperatureStabilize = "None";
- step.FilmThickFormula = "None";
- //隐藏StandBy行
- //step.IsVisibility = Visibility.Collapsed;
- return step;
- }
- public Step CreateEndStep()
- {
- Step step = new Step();
- step.StepNo = 2;
- step.Name = "End";
- step.EndBy = "EndByStepTime";
- step.Time = null;
- step.SkipWait = "";
- step.Command = "NoControl";
- //step.ZAxisPosition = "None";
- step.AbortRecipeTableIndex = "None";
- //step.ZAxisSpeed = "0";
- //step.RotatePosition = "None";
- //step.RotateDirection = "CW";
- //step.RotateSpeed = "0";
- //step.RotateInterval = "0";
- //step.APC_SetPressure = "0";
- step.IsnoneConditionCheck = true;
- step.AlarmConditionTable = new StringParam() { Name = "AlarmConditionTable", Value = "1:" };
- //step.MfmD1Flow = new MFMValue() { Value = "0", AlarmValue = "None" };
- if (RecipeTemplate != null && RecipeTemplate.ContainsKey("Valve"))
- {
- step.ValveSets.Clear();
- foreach (var item in RecipeTemplate["Valve"])
- {
- if (valveDefaultOpen.Contains(item.ControlName))
- {
- step.ValveSets.Add(new BoolParam() { Name = item.ControlName, Value = true });
- }
- else
- {
- step.ValveSets.Add(new BoolParam() { Name = item.ControlName, Value = false });
- }
- }
- }
- if (RecipeTemplate != null && RecipeTemplate.ContainsKey("Temperature"))
- {
- step.TemperatureSets.Clear();
- foreach (var item in RecipeTemplate["Temperature"])
- {
- var configHeater = (string)QueryDataClient.Instance.Service.GetConfig($"PM1.Heater.{item.ControlName}.DisplayName");
- var tempSet = new TempSetData(configHeater);
- tempSet.Name = item.ControlName;
- step.TemperatureSets.Add(tempSet);
- }
- }
- if (RecipeTemplate != null && RecipeTemplate.ContainsKey("MFC"))
- {
- step.MFCSets.Clear();
- foreach (var item in RecipeTemplate["MFC"])
- {
- step.MFCSets.Add(GetNewMFCData(item.ControlName)); ;
- }
- if (step.MFCSets != null && step.MFCSets.Count > 0)
- {
- for (int i = 0; i < step.MFCSets.Count; i++)
- {
- step.MFCSets[i].No = i + 1;
- }
- }
- }
- if (RecipeTemplate != null && RecipeTemplate.ContainsKey("MFM"))
- {
- step.MFMSets.Clear();
- foreach (var item in RecipeTemplate["MFM"])
- {
- step.MFMSets.Add(item.ControlName, new MFMValue() { Value = "0", AlarmValue = "0" }); ;
- }
- }
- step.TemperatureControlMode = new StringParam() { Name = "TemperatureControlMode", Value = "Heater" };
- step.TemperatureCorrect = new StringParam() { Name = "TemperatureCorrect", Value = "" };
- step.TemperaturePID = new StringParam() { Name = "TemperaturePID", Value = "" };
- step.LoaderCommand = new StringParam() { Name = "LoaderCommand", Value = "None" };
- step.PressCommand = new StringParam() { Name = "PressCommand", Value = "None" };
- //step.TemperatureProfile = "None";
- //step.TemperatureAlarm = "None";
- //step.CAPTemperatureAlarm = "None";
- //step.TemperatureStabilize = "None";
- step.FilmThickFormula = "None";
- //隐藏StandBy行
- //step.IsVisibility = Visibility.Collapsed;
- return step;
- }
- private static void ReadConditionCheck(XmlNode stepNode, Step step)
- {
- if (stepNode.Attributes["ConditionCheck"] != null)
- {
- var conditionCheckValue = stepNode.Attributes["ConditionCheck"].Value;
- if (conditionCheckValue != "none")
- {
- var subValues = conditionCheckValue.Split(';');
- if (subValues.Count() == 0) return;
- foreach (var item in subValues)
- {
- var itemValues = item.Split(':');
- switch (itemValues[0])
- {
- case "ExternalSensor":
- //step.ExternalSensor = itemValues[1].Split(',').ToArray();
- var externalSensor = itemValues[1].Split(',').ToArray();
- for (int i = 0; i < externalSensor.Count(); i++)
- {
- step.ExternalSensorName[i] = externalSensor[i].Split('.')[0];
- step.ExternalSensor[i] = externalSensor[i].Split('.')[1];
- }
- break;
- case "TempStabilize":
- step.TempStabilizeSelected = itemValues[1];
- break;
- case "FinishAutoProfile":
- step.FinishAutoProfile = itemValues[1];
- break;
- //case "TempUpper":
- // step.TempUpper = int.Parse(itemValues[1]);
- // break;
- //case "TempLower":
- // step.TempLower = int.Parse(itemValues[1]);
- // break;
- case "ReachTemp":
- var reachTemp = itemValues[1];
- if (reachTemp == "None")
- {
- step.ReachTemp = reachTemp;
- step.ReachTempValue = 0;
- }
- else
- {
- step.ReachTemp = itemValues[1].Split(',')[0];
- step.ReachTempValue = double.Parse(itemValues[1].Split(',')[1]);
- }
- break;
- case "O2Density":
- var o2Density = itemValues[1];
- if (o2Density == "None")
- {
- step.O2Density = o2Density;
- step.O2DensityValue = 0;
- }
- else
- {
- step.O2Density = itemValues[1].Split(',')[0];
- step.O2DensityValue = int.Parse(itemValues[1].Split(',')[1]);
- }
- break;
- //case "PressureUpper":
- // step.PressureUpper = double.Parse(itemValues[1]);
- // break;
- //case "PressureLower":
- // step.PressureLower = double.Parse(itemValues[1]);
- // break;
- case "ReachPressure":
- var reachPressure = itemValues[1];
- if (reachPressure == "None")
- {
- step.ReachPressure = reachPressure;
- step.ReachPressureVG = reachPressure;
- step.ReachPressureValue = 0;
- }
- else
- {
- step.ReachPressure = itemValues[1].Split(',')[0];
- if (itemValues[1].Split(',').Length > 2)
- {
- step.ReachPressureVG = itemValues[1].Split(',')[1];
- step.ReachPressureValue = double.Parse(itemValues[1].Split(',')[2]);
- }
- else
- step.ReachPressureValue = double.Parse(itemValues[1].Split(',')[1]);
- }
- break;
- case "PressureStabilize":
- if (itemValues[1].Split(',').Length > 1)
- {
- step.PressureStabilizeSelected = itemValues[1].Split(',')[0];
- step.PressureStabilizeVG = itemValues[1].Split(',')[1];
- }
- else
- step.PressureStabilizeSelected = itemValues[1].Split(',')[0];
- break;
- case "ProcessTimeToEnd":
- step.ProcessTimeToEnd = itemValues[1];
- break;
- default:
- break;
- }
- }
- }
- else
- {
- step.IsnoneConditionCheck = true;
- }
- if (step.ExternalSensor == null || step.ExternalSensor.Count() == 0)
- {
- step.ExternalSensor = new string[] { "None", "None", "None", "None", "None", "None", "None" };
- }
- if (step.TempStabilizeSelected == null)
- step.TempStabilizeSelected = "None";
- if (step.FinishAutoProfile == null)
- step.FinishAutoProfile = "None";
- if (step.ReachTemp == null)
- step.ReachTemp = "None";
- if (step.O2Density == null)
- step.O2Density = "None";
- if (step.ReachPressure == null)
- step.ReachPressure = "None";
- if (step.PressureStabilizeSelected == null)
- step.PressureStabilizeSelected = "None";
- if (step.ProcessTimeToEnd == null)
- step.ProcessTimeToEnd = "None";
- }
- }
- public bool CreateStepTolerance(XmlNode stepNode, out ObservableCollection<Param> step, out ObservableCollection<Param> warning, out ObservableCollection<Param> alarm,
- out Dictionary<string, ObservableCollection<Param>> popSettingStep)
- {
- step = new ObservableCollection<Param>();
- warning = new ObservableCollection<Param>();
- alarm = new ObservableCollection<Param>();
- popSettingStep = new Dictionary<string, ObservableCollection<Param>>();
- return true;
- }
- private bool LoadHeader(XmlNode nodeHeader)
- {
- if (nodeHeader == null)
- return false;
- if (nodeHeader.Attributes["CreatedBy"] != null)
- this.Creator = nodeHeader.Attributes["CreatedBy"].Value;
- if (nodeHeader.Attributes["CreationTime"] != null)
- this.CreateTime = DateTime.Parse(nodeHeader.Attributes["CreationTime"].Value);
- if (nodeHeader.Attributes["LastRevisedBy"] != null)
- this.Revisor = nodeHeader.Attributes["LastRevisedBy"].Value;
- if (nodeHeader.Attributes["LastRevisionTime"] != null)
- this.ReviseTime = DateTime.Parse(nodeHeader.Attributes["LastRevisionTime"].Value);
- if (nodeHeader.Attributes["Description"] != null)
- this.Description = nodeHeader.Attributes["Description"].Value;
- if (nodeHeader.Attributes["TableIndex"] != null)
- this.TableIndex = int.Parse(nodeHeader.Attributes["TableIndex"].Value);
- string chamberType = string.Empty;
- if (nodeHeader.Attributes["RecipeChamberType"] != null)
- this.RecipeChamberType = nodeHeader.Attributes["RecipeChamberType"].Value;
- //if (!string.IsNullOrEmpty(chamberType) && chamberType != RecipeChamberType)
- //{
- // LOG.Write($"{chamberType} is not accordance with {RecipeChamberType}");
- // return false;
- //}
- string version = string.Empty;
- if (nodeHeader.Attributes["RecipeVersion"] != null)
- version = nodeHeader.Attributes["RecipeVersion"].Value;
- //if (!string.IsNullOrEmpty(version) && version != RecipeVersion)
- //{
- // LOG.Write($"{version} is not accordance with {RecipeVersion}");
- // return false;
- //}
- return true;
- }
- private void LoadTables(XmlNode nodeRoot)
- {
- Tables.Clear();
- foreach (XmlNode nodeTable in nodeRoot.ChildNodes)
- {
- XmlNodeList nodeSteps = nodeTable.SelectNodes($"Step");
- RecipeTable recipeDataBase = new RecipeTable();
- recipeDataBase.Index = int.Parse(nodeTable.Attributes["Index"].Value);
- recipeDataBase.Name = nodeTable.Attributes["Name"].Value;
- recipeDataBase.EndStatus = nodeTable.Attributes["EndStatus"].Value;
- RecipeDataBase tableData = new RecipeDataBase();
- tableData.FastLoadSteps(nodeSteps);
- recipeDataBase.TableData = tableData;
- Tables.Add(recipeDataBase);
- }
- }
- private void LoadSteps(XmlNodeList steps)
- {
- Steps.Clear();
- PopSettingSteps.Clear();
- StepTolerances.Clear();
- StepNos.Clear();
- int index = 1;
- foreach (XmlNode nodeStep in steps)
- {
- Step step = this.CreateStep(nodeStep);
- StepNos.Add(step.StepNo);
- Steps.Add(step);
- index++;
- }
- if (StepNos == null || StepNos.Count == 0)
- {
- StepNo = 1;
- }
- else
- {
- StepNo = StepNos.Max() + 1;
- }
- }
- //private class StepInfo
- //{
- // public StepInfo(int stepNo, Step step)
- // {
- // StepNo = StepNo;
- // Step = step;
- // }
- // public int StepNo { get; }
- // public Step Step { get; }
- //}
- private readonly ConcurrentDictionary<int, Step> _StepCache = new ConcurrentDictionary<int, Step>();
- private void FastLoadSteps(XmlNodeList steps)
- {
- Steps.Clear();
- PopSettingSteps.Clear();
- StepTolerances.Clear();
- StepNos.Clear();
- this._StepCache.Clear();
- if (steps.Count == 0)
- return;
- Step step = this.CreateStep(steps[0]);
- StepNos.Add(step.StepNo);
- Steps.Add(step);
- Parallel.For(1, steps.Count, index =>
- {
- _StepCache[index] = CreateStep(step, steps.Item(index));
- });
- for (int i = 1; i <= _StepCache.Count; i++)
- {
- if (!_StepCache.TryGetValue(i, out Step step_c) || step_c is null)
- continue;
- StepNos.Add(step_c.StepNo);
- Steps.Add(step_c);
- }
- //if (steps.Count != 0)
- //{
- // Step step = this.CreateStep(steps[0]);
- // var query1 = (from XmlNode n in steps select n).ToList();
- // query1.RemoveAt(0);
- // var allSteps = query1.AsParallel().AsOrdered()
- // .Select(x => this.CreateStep(Steps[0], x));
- // StepNos.Add(step.StepNo);
- // Steps.Add(step);
- // foreach (var item in allSteps)
- // {
- // StepNos.Add(item.StepNo);
- // Steps.Add(item);
- // }
- //}
- }
- private void LoadConfigs(XmlNode configNode)
- {
- if (configNode == null)
- return;
- foreach (Param configItem in ConfigItems)
- {
- if (configNode.Attributes[configItem.Name] != null)
- {
- if (configItem is StringParam)
- (configItem as StringParam).Value = configNode.Attributes[configItem.Name]?.Value;
- else if (configItem is DoubleParam)
- (configItem as DoubleParam).Value = configNode.Attributes[configItem.Name]?.Value;
- }
- }
- }
- private string GetConditionCheckXmlString(Step parameters)
- {
- StringBuilder conditionCheckStr = new StringBuilder();
- string externalSensor = "";
- string[] tempStr = new string[] { "", "", "", "", "", "", "" };
- for (int i = 0; i < tempStr.Count(); i++)
- {
- tempStr[i] = $"{parameters.ExternalSensorName[i]}.{parameters.ExternalSensor[i]}";
- }
- externalSensor = $"ExternalSensor:{string.Join(",", tempStr.Select(x => x.ToString()))}";
- conditionCheckStr.Append($"{externalSensor};");
- conditionCheckStr.Append($"TempStabilize:{parameters.TempStabilizeSelected};");
- conditionCheckStr.Append($"FinishAutoProfile:{parameters.FinishAutoProfile};");
- //conditionCheckStr.Append($"TempUpper:{parameters.TempUpper.ToString()};");
- //conditionCheckStr.Append($"TempLower:{parameters.TempLower.ToString()};");
- if (parameters.ReachTemp == "None")
- {
- conditionCheckStr.Append($"ReachTemp:{parameters.ReachTemp};");
- }
- else
- {
- conditionCheckStr.Append($"ReachTemp:{parameters.ReachTemp},{parameters.ReachTempValue.ToString()};");
- }
- if (parameters.O2Density == "None")
- {
- conditionCheckStr.Append($"O2Density:{parameters.O2Density};");
- }
- else
- {
- conditionCheckStr.Append($"O2Density:{parameters.O2Density},{parameters.O2DensityValue.ToString()};");
- }
- //conditionCheckStr.Append($"PressureUpper:{parameters.PressureUpper.ToString()};");
- //conditionCheckStr.Append($"PressureLower:{parameters.PressureLower.ToString()};");
- if (parameters.ReachPressure == "None")
- {
- conditionCheckStr.Append($"ReachPressureWait:{parameters.ReachPressure};");
- }
- else
- {
- conditionCheckStr.Append($"ReachPressure:{parameters.ReachPressure},{parameters.ReachPressureVG},{parameters.ReachPressureValue.ToString()};");
- }
- conditionCheckStr.Append($"PressureStabilize:{parameters.PressureStabilizeSelected},{parameters.PressureStabilizeVG}");
- conditionCheckStr.Append($"ProcessTimeToEnd:{parameters.ProcessTimeToEnd}");
- return conditionCheckStr.ToString();
- }
- private void CreateTablesXml(XmlElement nodeData)
- {
- XmlNode nodeTables = _doc.SelectSingleNode($"Aitex/TableRecipeData/Tables");
- if (nodeTables == null) //创建Recipe文件
- {
- nodeTables = _doc.CreateElement("Tables");
- nodeData.AppendChild(nodeTables);
- nodeTables.RemoveAll();
- int tableCount = 20;
- if (_chamberType.ToLower() == "abort")
- {
- tableCount = 10;
- }
- for (int i = 1; i <= tableCount; i++)
- {
- XmlElement nodeTable = _doc.CreateElement("Table");
- nodeTable.SetAttribute("Index", i.ToString());
- nodeTable.SetAttribute("EndStatus", "");
- nodeTable.SetAttribute("Name", "");
- nodeTables.AppendChild(nodeTable);
- }
- }
- }
- private void SaveTables(XmlElement nodeData, List<XmlElement> steps, int tableIndex = 1)
- {
- //XmlNode nodeTables = nodeData.SelectSingleNode($"Aitex/TableRecipeData/Tables");
- XmlElement selectednodeTable = (XmlElement)nodeData.ChildNodes[0].SelectSingleNode($"Table[@Index='{tableIndex}']");
- var table = this.Tables.FirstOrDefault(x => x.Index == tableIndex);
- if (selectednodeTable == null || table == null)
- return;
- selectednodeTable.SetAttribute("EndStatus", table.EndStatus);
- selectednodeTable.SetAttribute("Name", table.Name);
- while (selectednodeTable.FirstChild != null)
- {
- selectednodeTable.RemoveChild(selectednodeTable.FirstChild);
- }
- steps.ForEach(x => selectednodeTable.AppendChild(x));
- }
- public string GetXmlString()
- {
- XmlElement nodeData = _doc.SelectSingleNode($"Aitex/TableRecipeData") as XmlElement;
- nodeData.SetAttribute("CreatedBy", Creator);
- nodeData.SetAttribute("CreationTime", CreateTime.ToString("yyyy-MM-dd HH:mm:ss"));
- nodeData.SetAttribute("LastRevisedBy", Revisor);
- nodeData.SetAttribute("LastRevisionTime", ReviseTime.ToString("yyyy-MM-dd HH:mm:ss"));
- nodeData.SetAttribute("Description", Description);
- nodeData.SetAttribute("RecipeChamberType", RecipeChamberType);
- nodeData.SetAttribute("RecipeVersion", RecipeVersion);
- nodeData.SetAttribute("RecipePermission", RecipePermission);
- nodeData.SetAttribute("RecipeLevel", RecipeLevel);
- nodeData.SetAttribute("TableIndex", TableIndex.ToString());
- if (!SaveTableRecipeTypes.Contains(RecipeChamberType))
- {
- XmlNode nodeModule = _doc.SelectSingleNode($"Aitex/TableRecipeData/Module[@Name='{_module}']");
- if (nodeModule == null)
- {
- nodeModule = _doc.CreateElement("Module");
- nodeData.AppendChild(nodeModule);
- }
- nodeModule.RemoveAll();
- (nodeModule as XmlElement).SetAttribute("Name", _module);
- int i = 0;
- foreach (Step parameters in Steps)
- {
- XmlElement nodeWarning = _doc.CreateElement("Warning");
- XmlElement nodeAlarm = _doc.CreateElement("Alarm");
- Dictionary<string, XmlElement> nodePop = new Dictionary<string, XmlElement>();
- foreach (string key in PopEnable.Keys)
- {
- nodePop.Add(key, _doc.CreateElement(key));
- }
- XmlElement nodeStep = _doc.CreateElement("Step");
- if (ToleranceEnable)
- {
- nodeStep.AppendChild(nodeWarning);
- nodeStep.AppendChild(nodeAlarm);
- }
- nodeStep.SetAttribute("StepNo", parameters.StepNo.ToString());
- nodeStep.SetAttribute("Name", parameters.Name);
- nodeStep.SetAttribute("EndBy", parameters.EndBy);
- nodeStep.SetAttribute("Time", parameters.Time);
- nodeStep.SetAttribute("SkipWait", parameters.SkipWait);
- nodeStep.SetAttribute("Command", parameters.Command);
- nodeStep.SetAttribute("AlarmIsSaved", parameters.AlarmIsSaved.ToString());
- nodeStep.SetAttribute("MFCIsSaved", parameters.MFCIsSaved.ToString());
- nodeStep.SetAttribute("ValveIsSaved", parameters.ValveIsSaved.ToString());
- nodeStep.SetAttribute("PressIsSaved", parameters.PressIsSaved.ToString());
- nodeStep.SetAttribute("AUXIsSaved", parameters.AUXIsSaved.ToString());
- nodeStep.SetAttribute("TemperatureIsSaved", parameters.TemperatureIsSaved.ToString());
- if (parameters.IsnoneConditionCheck)
- {
- nodeStep.SetAttribute("ConditionCheck", "none");
- }
- else
- {
- nodeStep.SetAttribute("ConditionCheck", GetConditionCheckXmlString(parameters));
- }
- //nodeStep.SetAttribute("PressureSonserValue", parameters.PressureSonserValue);
- //nodeStep.SetAttribute("PressureSonserValue", parameters.PressureSonserValue);
- //nodeStep.SetAttribute("PressureValveAngle", parameters.PressureValveAngle);
- //nodeStep.SetAttribute("PressureSettingVG", parameters.PressureSettingVG);
- //nodeStep.SetAttribute("SlowVacuumValue", parameters.SlowVacuumValue);
- //nodeStep.SetAttribute("PressureAlarmTableNo", parameters.PressureAlarmTableNo);
- //nodeStep.SetAttribute("ZAxisPosition", parameters.ZAxisPosition);
- //nodeStep.SetAttribute("ZAxisSpeed", parameters.ZAxisSpeed);
- //nodeStep.SetAttribute("RotateDirection", parameters.RotateDirection);
- //nodeStep.SetAttribute("RotatePosition", parameters.RotatePosition);
- //nodeStep.SetAttribute("RotateSpeed", parameters.RotateSpeed);
- //nodeStep.SetAttribute("RotateInterval", parameters.RotateInterval);
- //nodeStep.SetAttribute("APC.SetPressure", parameters.APC_SetPressure);
- //nodeStep.SetAttribute("MfmD1Flow", parameters.MfmD1Flow.ToString());
- //nodeStep.SetAttribute("RFSwitch", parameters.RFSwitch);
- //nodeStep.SetAttribute("RFSetpoint", parameters.RFSetpoint);
- //nodeStep.SetAttribute("RFPowerSetpoint", parameters.RFPowerSetpoint);
- //nodeStep.SetAttribute("CAPSetValue", parameters.CAPSetValue);
- //nodeStep.SetAttribute("CAPRampingValue", parameters.CAPRampingValue);
- //nodeStep.SetAttribute("C1Setpoint", parameters.C1Setpoint);
- //nodeStep.SetAttribute("C2Setpoint", parameters.C2Setpoint);
- //nodeStep.SetAttribute("ForwardPowerAlarmWatchTable", parameters.ForwardPowerAlarmWatchTable);
- //nodeStep.SetAttribute("C1AlarmWatchTable", parameters.C1AlarmWatchTable);
- //nodeStep.SetAttribute("C2AlarmWatchTable", parameters.C2AlarmWatchTable);
- //nodeStep.SetAttribute("PrAlarmWatchTable", parameters.PrAlarmWatchTable);
- //nodeStep.SetAttribute("PIAlarmWatchTable", parameters.PIAlarmWatchTable);
- //nodeStep.SetAttribute("VppAlarmWatchTable", parameters.VppAlarmWatchTable);
- //nodeStep.SetAttribute("VdcAlarmWatchTable", parameters.VdcAlarmWatchTable);
- nodeStep.SetAttribute("AlarmConditionTable", parameters.AlarmConditionTable.Value);
- nodeStep.SetAttribute("AbortRecipeTableIndex", parameters.AbortRecipeTableIndex);
- //nodeStep.SetAttribute("EventSetting", parameters.EventSetting);
- var dpParam = parameters.ValveSets.FirstOrDefault(x => x.Name == "DP");
- foreach (var item in parameters.ValveSets)
- {
- if (item.Name == "MBP")
- {
- if (dpParam != null)
- {
- nodeStep.SetAttribute(item.Name, dpParam.Value ? "Open" : "Close");
- }
- else
- {
- nodeStep.SetAttribute(item.Name, item.Value ? "Open" : "Close");
- }
- }
- else
- {
- nodeStep.SetAttribute(item.Name, item.Value ? "Open" : "Close");
- }
- }
- foreach (var item in parameters.MFCSets)
- {
- nodeStep.SetAttribute($"{item.ControlName}.Flow.IsSaved", item.IsSaved.ToString());
- nodeStep.SetAttribute($"{item.ControlName}.Flow.Set", item.SetValue.Value);
- nodeStep.SetAttribute($"{item.ControlName}.Flow.SetUnit", item.SetUnit.Value);
- nodeStep.SetAttribute($"{item.ControlName}.Flow.Ramprate", item.Rampng.Value);
- nodeStep.SetAttribute($"{item.ControlName}.Flow.RamprateUnit", item.RampngUnit.Value);
- nodeStep.SetAttribute($"{item.ControlName}.Flow.Check", item.IsCheck.Value.ToString());
- nodeStep.SetAttribute($"{item.ControlName}.Flow.High", item.MaxValue.Value.ToString());
- nodeStep.SetAttribute($"{item.ControlName}.Flow.Low", item.MinValue.Value.ToString());
- nodeStep.SetAttribute($"{item.ControlName}.Flow.Unit", item.Unit);
- }
- foreach (var item in parameters.MFMSets)
- {
- nodeStep.SetAttribute(item.Key, parameters.MFMSets[item.Key].ToString());
- }
- foreach (var item in parameters.EXOUSets.Keys)
- {
- nodeStep.SetAttribute(item, parameters.EXOUSets[item].ToString());
- }
- foreach (var item in parameters.TemperatureSets)
- {
- nodeStep.SetAttribute($"{item.Name}.ZoneName", item.Name);
- nodeStep.SetAttribute($"{item.Name}.Set", item.SetValue.Value);
- nodeStep.SetAttribute($"{item.Name}.SetUnit", item.SetUnit.Value);
- nodeStep.SetAttribute($"{item.Name}.Ramprate", item.RampngValue.Value);
- nodeStep.SetAttribute($"{item.Name}.RamprateUnit", item.RampngUnit.Value);
- nodeStep.SetAttribute($"{item.Name}.Check", item.IsCheck.Value.ToString());
- nodeStep.SetAttribute($"{item.Name}.High", item.HighValue.Value.ToString());
- nodeStep.SetAttribute($"{item.Name}.Low", item.LowValue.Value.ToString());
- nodeStep.SetAttribute($"{item.Name}.Unit", item.Unit.ToString());
- }
- nodeStep.SetAttribute("Temperature.ControlMode", parameters.TemperatureControlMode.Value);
- nodeStep.SetAttribute("Temperature.Correct", parameters.TemperatureCorrect.Value);
- nodeStep.SetAttribute("Temperature.PID", parameters.TemperaturePID.Value);
- nodeStep.SetAttribute("Loader.Command", parameters.LoaderCommand.Value);
- nodeStep.SetAttribute("Loader.Speed1", parameters.LoaderSpeed1.Value);
- nodeStep.SetAttribute("Loader.Speed2", parameters.LoaderSpeed2.Value);
- nodeStep.SetAttribute("Loader.Speed3", parameters.LoaderSpeed3.Value);
- nodeStep.SetAttribute("Loader.RPM", parameters.LoaderRPM.Value.ToString());
- nodeStep.SetAttribute("Press.Command", parameters.PressCommand.Value);
- nodeStep.SetAttribute("Press.PID", parameters.PressPID.Value);
- // nodeStep.SetAttribute("Press.Set", parameters.PressSet.Value);
- nodeStep.SetAttribute("Press.Set", GetPressSetValue(parameters));
- // nodeStep.SetAttribute("Press.SlowVacSet", parameters.PressSlowVacSet.Value);
- nodeStep.SetAttribute("Press.SlowVacSet", GetPressSlowVacSet(parameters));
- // nodeStep.SetAttribute("Press.ValveAngleSet", parameters.PressValveAngleSet.Value);
- nodeStep.SetAttribute("Press.ValveAngleSet", RecipeDataBase.GetValveAngleSet(parameters));
- nodeStep.SetAttribute("Press.IsWait", parameters.PressIsWait.Value.ToString());
- nodeStep.SetAttribute("Press.LowWait", parameters.PressLowWait.Value);
- nodeStep.SetAttribute("Press.HighWait", parameters.PressHighWait.Value);
- nodeStep.SetAttribute("Press.WaitUnit", parameters.PressWaitUnit.Value);
- nodeStep.SetAttribute("Press.LowPressWait", parameters.PressLowPressWait.Value);
- // nodeStep.SetAttribute("Press.WaitPress", parameters.WaitPress.Value);
- nodeStep.SetAttribute("Press.WaitPress", RecipeDataBase.GetWaitPress(parameters));
- nodeStep.SetAttribute("FilmThickFormula", parameters.FilmThickFormula);
- foreach (var item in parameters.AUXSets)
- {
- nodeStep.SetAttribute($"AUX.{item.ControlName}.Set", item.SetValue.Value);
- nodeStep.SetAttribute($"AUX.{item.ControlName}.Check", item.IsCheck.Value.ToString());
- nodeStep.SetAttribute($"AUX.{item.ControlName}.High", item.MaxValue.Value);
- nodeStep.SetAttribute($"AUX.{item.ControlName}.Low", item.MinValue.Value);
- nodeStep.SetAttribute($"AUX.{item.ControlName}.CheckUnit", item.SetUnit.Value);
- }
- nodeModule.AppendChild(nodeStep);
- i++;
- }
- XmlElement nodeConfig = _doc.CreateElement("Config");
- foreach (Param parameter in ConfigItems)
- {
- if (parameter.Visible == System.Windows.Visibility.Visible)
- {
- if (parameter is IntParam)
- nodeConfig.SetAttribute(parameter.Name, ((IntParam)parameter).Value.ToString());
- else if (parameter is DoubleParam)
- {
- string strValue = ((DoubleParam)parameter).Value;
- bool succed = double.TryParse(strValue, out double dValue);
- if (!succed)
- {
- MessageBox.Show($"The set value of {parameter.DisplayName} is {strValue}, not a valid value");
- return null;
- }
- var config = ConfigItems.Where(m => m.Name == parameter.Name).FirstOrDefault();
- if (config is DoubleParam param1)
- {
- if (param1.Minimun == 0 && param1.Maximun == 0)
- {
- //没有设定范围
- }
- else if (dValue > param1.Maximun || dValue < param1.Minimun)
- {
- MessageBox.Show($"The set value of {parameter.DisplayName} is {dValue}, out of the range {param1.Minimun}~{param1.Maximun}");
- return null;
- }
- }
- nodeConfig.SetAttribute(parameter.Name, ((DoubleParam)parameter).Value.ToString());
- }
- else if (parameter is StringParam)
- nodeConfig.SetAttribute(parameter.Name, ((StringParam)parameter).Value?.ToString());
- else if (parameter is ComboxParam)
- nodeConfig.SetAttribute(parameter.Name, ((ComboxParam)parameter).Value.ToString());
- else if (parameter is LoopComboxParam)
- nodeConfig.SetAttribute(parameter.Name, ((LoopComboxParam)parameter).Value.ToString());
- else if (parameter is PositionParam)
- nodeConfig.SetAttribute(parameter.Name, ((PositionParam)parameter).Value.ToString());
- else if (parameter is BoolParam)
- nodeConfig.SetAttribute(parameter.Name, ((BoolParam)parameter).Value.ToString());
- else if (parameter is StepParam)
- nodeConfig.SetAttribute(parameter.Name, ((StepParam)parameter).Value.ToString());
- else if (parameter is MultipleSelectParam)
- {
- List<string> selected = new List<string>();
- ((MultipleSelectParam)parameter).Options.Apply(
- opt =>
- {
- if (opt.IsChecked)
- selected.Add(opt.ControlName);
- }
- );
- nodeConfig.SetAttribute(parameter.Name, string.Join(",", selected));
- }
- }
- }
- nodeModule.AppendChild(nodeConfig);
- }
- else
- {
- var CurrentTableSteps = Tables.FirstOrDefault(x => x.Index == TableIndex).TableData.Steps;
- CurrentTableSteps.Clear();
- Steps.ToList().ForEach(x => CurrentTableSteps.Add(x));
- CreateTablesXml(nodeData);
- foreach (var item in Tables)
- {
- List<XmlElement> StepsXmlElement = new List<XmlElement>();
- foreach (Step parameters in item.TableData.Steps)
- {
- StepsXmlElement.Add(StepToXmlElement(parameters));
- }
- SaveTables(nodeData, StepsXmlElement, item.Index);
- }
- }
- return _doc.OuterXml;
- }
- public static string GetPressPidValue(Step parameters)
- {
- string cmd = parameters.PressCommand.Value;
- if (cmd == "Slow Vac" || cmd == "Valve Angle" || cmd == "Full Open" || cmd == "Full Close" || cmd == "Hold" ||
- cmd == "WaitPressUp1" || cmd == "WaitPressDown1" || cmd == "WaitPressUp2" || cmd == "WaitPressDown2" || cmd == "Zero Set" || cmd == "Cancel Zero")
- {
- return "";
- }
- return parameters.PressPID.Value.Replace(",", ":");
- }
- public static string GetPressSetValue(Step parameters)
- {
- string rtn = "0";
- string cmd = parameters.PressCommand.Value;
- if (cmd == "Press" || cmd == "Press2")
- {
- rtn = parameters.PressSet.Value;
- }
- return rtn;
- }
- public static string GetPressSlowVacSet(Step parameters)
- {
- string rtn = "0";
- string cmd = parameters.PressCommand.Value;
- if (cmd == "Slow Vac")
- {
- rtn = parameters.PressSlowVacSet.Value;
- }
- return rtn;
- }
- public static string GetValveAngleSet(Step parameters)
- {
- string rtn = "0";
- string cmd = parameters.PressCommand.Value;
- if (cmd == "Valve Angle")
- {
- rtn = parameters.PressValveAngleSet.Value;
- }
- return rtn;
- }
- public static string GetWaitPress(Step parameters)
- {
- string rtn = "0";
- string cmd = parameters.PressCommand.Value;
- if (cmd == "WaitPressUp1" || cmd == "WaitPressDown1" || cmd == "WaitPressUp2" || cmd == "WaitPressDown2")
- {
- rtn = parameters.WaitPress.Value;
- }
- return rtn;
- }
- private XmlElement StepToXmlElement(Step parameters)
- {
- XmlElement nodeStep = _doc.CreateElement("Step");
- if (ToleranceEnable)
- {
- //nodeStep.AppendChild(nodeWarning);
- //nodeStep.AppendChild(nodeAlarm);
- }
- nodeStep.SetAttribute("StepNo", parameters.StepNo.ToString());
- nodeStep.SetAttribute("Name", parameters.Name);
- nodeStep.SetAttribute("EndBy", parameters.EndBy);
- nodeStep.SetAttribute("Time", parameters.Time);
- nodeStep.SetAttribute("SkipWait", parameters.SkipWait);
- nodeStep.SetAttribute("Command", parameters.Command);
- nodeStep.SetAttribute("AlarmIsSaved", parameters.AlarmIsSaved.ToString());
- nodeStep.SetAttribute("MFCIsSaved", parameters.MFCIsSaved.ToString());
- nodeStep.SetAttribute("ValveIsSaved", parameters.ValveIsSaved.ToString());
- nodeStep.SetAttribute("PressIsSaved", parameters.PressIsSaved.ToString());
- nodeStep.SetAttribute("AUXIsSaved", parameters.AUXIsSaved.ToString());
- nodeStep.SetAttribute("TemperatureIsSaved", parameters.TemperatureIsSaved.ToString());
- if (parameters.IsnoneConditionCheck)
- {
- nodeStep.SetAttribute("ConditionCheck", "none");
- }
- else
- {
- nodeStep.SetAttribute("ConditionCheck", GetConditionCheckXmlString(parameters));
- }
- nodeStep.SetAttribute("AlarmConditionTable", parameters.AlarmConditionTable.Value);
- nodeStep.SetAttribute("AbortRecipeTableIndex", parameters.AbortRecipeTableIndex);
- foreach (var item in parameters.ValveSets)
- {
- nodeStep.SetAttribute(item.Name, item.Value ? "Open" : "Close");
- }
- foreach (var item in parameters.MFCSets)
- {
- nodeStep.SetAttribute($"{item.ControlName}.Flow.IsSaved", item.IsSaved.ToString());
- nodeStep.SetAttribute($"{item.ControlName}.Flow.Set", item.SetValue.Value);
- nodeStep.SetAttribute($"{item.ControlName}.Flow.SetUnit", item.SetUnit.Value);
- nodeStep.SetAttribute($"{item.ControlName}.Flow.Ramprate", item.Rampng.Value);
- nodeStep.SetAttribute($"{item.ControlName}.Flow.RamprateUnit", item.RampngUnit.Value);
- nodeStep.SetAttribute($"{item.ControlName}.Flow.Check", item.IsCheck.Value.ToString());
- nodeStep.SetAttribute($"{item.ControlName}.Flow.High", item.MaxValue.Value.ToString());
- nodeStep.SetAttribute($"{item.ControlName}.Flow.Low", item.MinValue.Value.ToString());
- nodeStep.SetAttribute($"{item.ControlName}.Flow.Unit", item.Unit);
- }
- foreach (var item in parameters.MFMSets)
- {
- nodeStep.SetAttribute(item.Key, parameters.MFMSets[item.Key].ToString());
- }
- foreach (var item in parameters.EXOUSets.Keys)
- {
- nodeStep.SetAttribute(item, parameters.EXOUSets[item].ToString());
- }
- foreach (var item in parameters.TemperatureSets)
- {
- nodeStep.SetAttribute($"{item.Name}.ZoneName", item.Name);
- nodeStep.SetAttribute($"{item.Name}.Set", item.SetValue.Value);
- nodeStep.SetAttribute($"{item.Name}.SetUnit", item.SetUnit.Value);
- nodeStep.SetAttribute($"{item.Name}.Ramprate", item.RampngValue.Value);
- nodeStep.SetAttribute($"{item.Name}.RamprateUnit", item.RampngUnit.Value);
- nodeStep.SetAttribute($"{item.Name}.Check", item.IsCheck.Value.ToString());
- nodeStep.SetAttribute($"{item.Name}.High", item.HighValue.Value.ToString());
- nodeStep.SetAttribute($"{item.Name}.Low", item.LowValue.Value.ToString());
- nodeStep.SetAttribute($"{item.Name}.Unit", item.Unit.ToString());
- }
- nodeStep.SetAttribute("Temperature.ControlMode", parameters.TemperatureControlMode.Value);
- nodeStep.SetAttribute("Temperature.Correct", parameters.TemperatureCorrect.Value);
- nodeStep.SetAttribute("Temperature.PID", parameters.TemperaturePID.Value);
- nodeStep.SetAttribute("Loader.Command", parameters.LoaderCommand.Value);
- nodeStep.SetAttribute("Loader.Speed1", parameters.LoaderSpeed1.Value);
- nodeStep.SetAttribute("Loader.Speed2", parameters.LoaderSpeed2.Value);
- nodeStep.SetAttribute("Loader.Speed3", parameters.LoaderSpeed3.Value);
- nodeStep.SetAttribute("Loader.RPM", parameters.LoaderRPM.Value.ToString());
- nodeStep.SetAttribute("Press.Command", parameters.PressCommand.Value);
- nodeStep.SetAttribute("Press.PID", parameters.PressPID.Value);
- nodeStep.SetAttribute("Press.Set", parameters.PressSet.Value);
- nodeStep.SetAttribute("Press.SlowVacSet", parameters.PressSlowVacSet.Value);
- nodeStep.SetAttribute("Press.ValveAngleSet", parameters.PressValveAngleSet.Value);
- nodeStep.SetAttribute("Press.IsWait", parameters.PressIsWait.Value.ToString());
- nodeStep.SetAttribute("Press.LowWait", parameters.PressLowWait.Value);
- nodeStep.SetAttribute("Press.HighWait", parameters.PressHighWait.Value);
- nodeStep.SetAttribute("Press.WaitUnit", parameters.PressWaitUnit.Value);
- nodeStep.SetAttribute("Press.LowPressWait", parameters.PressLowPressWait.Value);
- nodeStep.SetAttribute("Press.WaitPress", parameters.WaitPress.Value);
- nodeStep.SetAttribute("FilmThickFormula", parameters.FilmThickFormula);
- // nodeStep.SetAttribute("FilmThickFormula", parameters.FilmThickFormula);
- foreach (var item in parameters.AUXSets)
- {
- nodeStep.SetAttribute($"AUX.{item.ControlName}.Set", item.SetValue.Value);
- nodeStep.SetAttribute($"AUX.{item.ControlName}.Check", item.IsCheck.Value.ToString());
- nodeStep.SetAttribute($"AUX.{item.ControlName}.High", item.MaxValue.Value);
- nodeStep.SetAttribute($"AUX.{item.ControlName}.Low", item.MinValue.Value);
- nodeStep.SetAttribute($"AUX.{item.ControlName}.CheckUnit", item.SetUnit.Value);
- }
- return nodeStep;
- }
- public RecipeHistory GetRecipeHistory()
- {
- RecipeHistory recipeHistory = new RecipeHistory();
- recipeHistory.CreatedBy = this.Creator;
- recipeHistory.CreationTime = this.CreateTime;
- recipeHistory.LastRevisedBy = this.Revisor;
- recipeHistory.LastRevisionTime = this.ReviseTime;
- recipeHistory.Recipe_Description = this.Description;
- recipeHistory.Recipe_Type = this.PrefixPath;
- recipeHistory.Recipe_Name = this.Name;
- recipeHistory.Recipe_Path = $"{this.PrefixPath}\\{this.Name}";
- recipeHistory.Recipe_Version = this.RecipeVersion;
- recipeHistory.Recipe_Level = this.RecipeLevel;
- recipeHistory.Recipe_Premission = this.RecipePermission;
- recipeHistory.Recipe_Compare = "";
- recipeHistory.Recipe_Content = GetXmlString();
- return recipeHistory;
- }
- private void LoadConfigs(ObservableCollection<Param> configDefine, XmlNode configNode)
- {
- ConfigItems.Clear();
- foreach (var param in configDefine)
- {
- if (param is DoubleParam param1)
- {
- var config = new DoubleParam()
- {
- Name = param.Name,
- Value = param1.Value,
- DisplayName = param.DisplayName,
- Minimun = param1.Minimun,
- Maximun = param1.Maximun,
- Resolution = param1.Resolution
- };
- if (configNode != null && configNode.Attributes[param1.Name] != null)
- config.Value = configNode.Attributes[param1.Name].Value;
- ConfigItems.Add(config);
- }
- if (param is NumParam paramInt)
- {
- var config = new NumParam()
- {
- Name = paramInt.Name,
- Value = paramInt.Value,
- DisplayName = paramInt.DisplayName,
- };
- if (configNode != null && configNode.Attributes[paramInt.Name] != null)
- {
- int.TryParse(configNode.Attributes[paramInt.Name].Value, out int intValue);
- config.Value = intValue;
- }
- ConfigItems.Add(config);
- }
- if (param is StringParam paramString)
- {
- var config = new StringParam()
- {
- Name = param.Name,
- Value = paramString.Value,
- DisplayName = param.DisplayName,
- };
- if (configNode != null && configNode.Attributes[paramString.Name] != null)
- config.Value = configNode.Attributes[paramString.Name].Value;
- ConfigItems.Add(config);
- }
- }
- }
- public void InitData(string prefixPath, string recipeName, string recipeContent, ObservableCollection<Param> configDefine, string module)
- {
- IsCompatibleWithCurrentFormat = false;
- _module = module;
- Name = recipeName;
- PrefixPath = prefixPath;
- try
- {
- _doc = new XmlDocument();
- _doc.LoadXml(recipeContent);
- if (!LoadHeader(_doc.SelectSingleNode("Aitex/TableRecipeData")))
- return;
- XmlNodeList nodeSteps = _doc.SelectNodes($"Aitex/TableRecipeData/Module[@Name='{module}']/Step");
- if (nodeSteps == null)
- nodeSteps = _doc.SelectNodes($"Aitex/TableRecipeData/Step");
- LoadSteps(nodeSteps);
- XmlNode nodeConfig =
- _doc.SelectSingleNode($"Aitex/TableRecipeData/Module[@Name='{module}']/Config");
- if (nodeSteps == null)
- nodeConfig = _doc.SelectSingleNode($"Aitex/TableRecipeData/Config");
- LoadConfigs(configDefine, nodeConfig);
- IsCompatibleWithCurrentFormat = true;
- }
- catch (Exception ex)
- {
- LOG.Write(ex);
- }
- }
- }
- public class Step : PropertyChangedBase
- {
- public delegate void TempValueChangedEventHandler(object sender, SetValueEventArgs e);
- public event TempValueChangedEventHandler TempValueChangedEvent;
- public void OnTempValueChanged(SetValueEventArgs e)
- {
- if (TempValueChangedEvent != null)
- {
- TempValueChangedEvent(this, e);
- }
- }
- public delegate void OhterTempValueChangedEventHandler(object sender, SetValueEventArgs e);
- public event OhterTempValueChangedEventHandler OhterTempValueChangedEvent;
- public void OnOhterTempValueChanged(SetValueEventArgs e)
- {
- if (OhterTempValueChangedEvent != null)
- {
- OhterTempValueChangedEvent(this, e);
- }
- }
- public delegate void MFCValueChangedEventHandler(object sender, SetValueEventArgs e);
- public event MFCValueChangedEventHandler MFCValueChangedEvent;
- public void OnMFCValueChanged(SetValueEventArgs e)
- {
- if (MFCValueChangedEvent != null)
- {
- MFCValueChangedEvent(this, e);
- }
- }
- public delegate void ValveValueChangedEventHandler(object sender, SetValueEventArgs e);
- public event ValveValueChangedEventHandler ValveValueChangedEvent;
- public void OnValveValueChanged(SetValueEventArgs e)
- {
- if (ValveValueChangedEvent != null)
- {
- ValveValueChangedEvent(this, e);
- }
- }
- public delegate void AUXValueChangedEventHandler(object sender, SetValueEventArgs e);
- public event AUXValueChangedEventHandler AUXValueChangedEvent;
- public void OnAUXValueChanged(SetValueEventArgs e)
- {
- if (AUXValueChangedEvent != null)
- {
- AUXValueChangedEvent(this, e);
- }
- }
- public Step()
- {
- SetDelegateEvent();
- }
- public void SetDelegateEvent()
- {
- MFCSetsCollectionChanged();
- TemperatureSetsCollectionChanged();
- ValveSetsCollectionChanged();
- AUXSetsCollectionChanged();
- }
- private void MFCSetsCollectionChanged()
- {
- foreach (var item in MFCSets)
- {
- item.PropertyChanged += MFCIsSaved_PropertyChanged;
- item.ValueChangedEvent += Item_MFCValueChangedEvent;
- }
- MFCSets.CollectionChanged += (s, e) =>
- {
- if (e.OldItems != null)
- {
- foreach (MFCData item in e.OldItems)
- {
- item.PropertyChanged -= MFCIsSaved_PropertyChanged;
- item.ValueChangedEvent -= Item_MFCValueChangedEvent;
- }
- }
- if (e.NewItems != null)
- {
- foreach (MFCData item in e.NewItems)
- {
- item.PropertyChanged += MFCIsSaved_PropertyChanged;
- item.ValueChangedEvent += Item_MFCValueChangedEvent;
- }
- }
- };
- }
- private void TemperatureSetsCollectionChanged()
- {
- foreach (var item in TemperatureSets)
- {
- item.PropertyChanged += TemperatureIsSaved_PropertyChanged;
- item.ValueChangedEvent += Item_TempValueChangedEvent;
- }
- TemperatureSets.CollectionChanged += (s, e) =>
- {
- if (e.OldItems != null)
- {
- foreach (TempSetData item in e.OldItems)
- {
- item.PropertyChanged -= TemperatureIsSaved_PropertyChanged;
- item.ValueChangedEvent -= Item_TempValueChangedEvent;
- }
- }
- if (e.NewItems != null)
- {
- foreach (TempSetData item in e.NewItems)
- {
- item.PropertyChanged += TemperatureIsSaved_PropertyChanged;
- item.ValueChangedEvent += Item_TempValueChangedEvent;
- }
- }
- };
- }
- private void ValveSetsCollectionChanged()
- {
- foreach (var item in ValveSets)
- {
- item.PropertyChanged += ValveIsSaved_PropertyChanged;
- item.ValueChangedEvent += Item_ValveValueChangedEvent;
- }
- ValveSets.CollectionChanged += (s, e) =>
- {
- if (e.OldItems != null)
- {
- foreach (BoolParam item in e.OldItems)
- {
- item.PropertyChanged -= ValveIsSaved_PropertyChanged;
- item.ValueChangedEvent -= Item_ValveValueChangedEvent;
- }
- }
- if (e.NewItems != null)
- {
- foreach (BoolParam item in e.NewItems)
- {
- item.PropertyChanged += ValveIsSaved_PropertyChanged;
- item.ValueChangedEvent += Item_ValveValueChangedEvent;
- }
- }
- };
- }
- private void AUXSetsCollectionChanged()
- {
- foreach (var item in AUXSets)
- {
- item.PropertyChanged += AUXIsSaved_PropertyChanged;
- item.ValueChangedEvent += Item_AUXValueChangedEvent;
- }
- AUXSets.CollectionChanged += (s, e) =>
- {
- if (e.OldItems != null)
- {
- foreach (AUXData item in e.OldItems)
- {
- item.PropertyChanged -= AUXIsSaved_PropertyChanged;
- item.ValueChangedEvent -= Item_AUXValueChangedEvent;
- }
- }
- if (e.NewItems != null)
- {
- foreach (AUXData item in e.NewItems)
- {
- item.PropertyChanged += AUXIsSaved_PropertyChanged;
- item.ValueChangedEvent += Item_AUXValueChangedEvent;
- }
- }
- };
- }
- public void Item_TempValueChangedEvent(object sender, SetValueEventArgs e)
- {
- OnTempValueChanged(e);
- }
- public void Item_MFCValueChangedEvent(object sender, SetValueEventArgs e)
- {
- OnMFCValueChanged(e);
- }
- public void Item_ValveValueChangedEvent(object sender, SetValueEventArgs e)
- {
- OnValveValueChanged(e);
- }
- public void Item_AUXValueChangedEvent(object sender, SetValueEventArgs e)
- {
- OnAUXValueChanged(e);
- }
- public void MFCIsSaved_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
- {
- if (e.PropertyName == "IsSaved")
- {
- if (MFCSets.Where(x => x.IsSaved == false).Any())
- {
- MFCIsSaved = false;
- }
- else
- {
- if (MFCSetFlagIsSaved)
- {
- MFCIsSaved = true;
- }
- else
- {
- MFCIsSaved = false;
- }
- }
- }
- }
- public void TemperatureIsSaved_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
- {
- if (e.PropertyName == "IsSaved")
- {
- SetTemperatureIsSaved();
- }
- }
- public void ValveIsSaved_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
- {
- if (e.PropertyName == "IsSaved")
- {
- if (ValveSets.Where(x => x.IsSaved == false).Any())
- {
- ValveIsSaved = false;
- }
- else
- {
- ValveIsSaved = true;
- }
- }
- }
- public void AUXIsSaved_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
- {
- if (e.PropertyName == "IsSaved")
- {
- if (AUXSets.Where(x => x.IsSaved == false).Any())
- {
- AUXIsSaved = false;
- }
- else
- {
- AUXIsSaved = true;
- }
- }
- }
- private void LoaderIsSaved_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
- {
- if (e.PropertyName == "IsSaved")
- {
- if (!LoaderCommand.IsSaved || !LoaderSpeed1.IsSaved
- || !LoaderSpeed2.IsSaved || !LoaderSpeed3.IsSaved
- || !LoaderRPM.IsSaved)
- {
- LoaderIsSaved = false;
- }
- else
- {
- LoaderIsSaved = true;
- }
- }
- }
- private void AlarmIsSaved_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
- {
- if (e.PropertyName == "IsSaved")
- {
- if (!AlarmConditionTable.IsSaved)
- {
- AlarmIsSaved = false;
- }
- else
- {
- AlarmIsSaved = true;
- }
- }
- else if (e.PropertyName == "Value")
- {
- if (((Param)sender).IsSaved) return;
- SetValueEventArgs setEventArgs = new SetValueEventArgs();
- setEventArgs.Sender = this;
- setEventArgs.ValueName = "Alarm";
- setEventArgs.PropertyName = ((Param)sender).Name;
- if (sender is StringParam)
- {
- setEventArgs.PropertyValue = ((StringParam)sender).Value;
- OnAlarmValueChanged(setEventArgs);
- }
- }
- }
- public delegate void AlarmValueChangedEventHandler(object sender, SetValueEventArgs e);
- public event AlarmValueChangedEventHandler AlarmValueChangedEvent;
- public void OnAlarmValueChanged(SetValueEventArgs e)
- {
- if (AlarmValueChangedEvent != null)
- {
- AlarmValueChangedEvent(this, e);
- }
- }
- private void PressureIsSaved_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
- {
- if (e.PropertyName == "IsSaved")
- {
- if (!PressCommand.IsSaved || !PressPID.IsSaved
- || !PressSet.IsSaved || !PressValveAngleSet.IsSaved
- || !PressSlowVacSet.IsSaved || !PressIsWait.IsSaved
- || !PressLowWait.IsSaved || !PressHighWait.IsSaved
- || !PressWaitUnit.IsSaved || !PressLowPressWait.IsSaved
- || !WaitPress.IsSaved)
- {
- PressIsSaved = false;
- }
- else
- {
- PressIsSaved = true;
- }
- }
- else if (e.PropertyName == "Value")
- {
- if (sender is Param)
- {
- if (((Param)sender).IsSaved) return;
- SetValueEventArgs setEventArgs = new SetValueEventArgs();
- setEventArgs.Sender = this;
- setEventArgs.ValueName = "Press";
- setEventArgs.PropertyName = ((Param)sender).Name;
- if (sender is DoubleParam)
- {
- setEventArgs.PropertyValue = ((DoubleParam)sender).Value;
- OnPressureValueChanged(setEventArgs);
- }
- else if (sender is StringParam)
- {
- setEventArgs.PropertyValue = ((StringParam)sender).Value;
- OnPressureValueChanged(setEventArgs);
- }
- }
- }
- }
- public delegate void PressureValueChangedEventHandler(object sender, SetValueEventArgs e);
- public event PressureValueChangedEventHandler PressureValueChangedEvent;
- public void OnPressureValueChanged(SetValueEventArgs e)
- {
- if (PressureValueChangedEvent != null)
- {
- PressureValueChangedEvent(this, e);
- }
- }
- public delegate void LoaderValueChangedEventHandler(object sender, SetValueEventArgs e);
- public event LoaderValueChangedEventHandler LoaderValueChangedEvent;
- public void OnLoaderValueChanged(SetValueEventArgs e)
- {
- if (LoaderValueChangedEvent != null)
- {
- LoaderValueChangedEvent(this, e);
- }
- }
- private void SetTemperatureIsSaved()
- {
- if (TemperatureSets.Where(x => x.IsSaved == false).Any() || !TemperatureControlMode.IsSaved || !TemperatureCorrect.IsSaved || !TemperaturePID.IsSaved)
- {
- TemperatureIsSaved = false;
- }
- else
- {
- if (TemperatureSetsFlagIsSaved)
- {
- TemperatureIsSaved = true;
- }
- else
- {
- TemperatureIsSaved = false;
- }
- }
- }
- public bool UndoMFCChanges()
- {
- if (MFCIsSaved)
- {
- if (DialogButton.Yes == DialogBox.ShowDialog(DialogButton.Yes | DialogButton.No,
- DialogType.CONFIRM,
- $"Recipe MFC is changed Flag, do you want to save it?"))
- {
- MFCIsSaved = false;
- MFCSetFlagIsSaved = false;
- }
- }
- else
- {
- MFCSetFlagIsSaved = true;
- foreach (var item in MFCSets)
- {
- item.UndoChanges();
- }
- }
- return true;
- }
- public bool UndoGasChanges()
- {
- if (ValveIsSaved)
- {
- if (DialogButton.Yes == DialogBox.ShowDialog(DialogButton.Yes | DialogButton.No,
- DialogType.CONFIRM,
- $"Recipe Valve is changed Flag, do you want to save it?"))
- {
- ValveIsSaved = false;
- ValveFlagIsSaved = false;
- }
- }
- else
- {
- ValveFlagIsSaved = true;
- foreach (var item in ValveSets)
- {
- item.UndoChanges();
- }
- }
- return true;
- }
- public bool UndoAUXChanges()
- {
- if (AUXIsSaved)
- {
- if (DialogButton.Yes == DialogBox.ShowDialog(DialogButton.Yes | DialogButton.No,
- DialogType.CONFIRM,
- $"Recipe AUX is changed Flag, do you want to save it?"))
- {
- AUXIsSaved = false;
- AUXFlagIsSaved = false;
- }
- }
- else
- {
- AUXFlagIsSaved = true;
- foreach (var item in AUXSets)
- {
- item.UndoChanges();
- }
- }
- return true;
- }
- public bool UndoTemperatureChanges()
- {
- if (TemperatureIsSaved)
- {
- if (DialogButton.Yes == DialogBox.ShowDialog(DialogButton.Yes | DialogButton.No,
- DialogType.CONFIRM,
- $"Recipe Temperature is changed Flag, do you want to save it?"))
- {
- TemperatureIsSaved = false;
- TemperatureSetsFlagIsSaved = false;
- }
- }
- else
- {
- TemperatureSetsFlagIsSaved = true;
- foreach (var item in TemperatureSets)
- {
- item.UndoChanges();
- }
- TemperatureControlMode.UndoChanges();
- TemperatureCorrect.UndoChanges();
- TemperaturePID.UndoChanges();
- }
- return true;
- }
- public bool UndoAlarmChanges()
- {
- if (AlarmIsSaved)
- {
- if (DialogButton.Yes == DialogBox.ShowDialog(DialogButton.Yes | DialogButton.No,
- DialogType.CONFIRM,
- $"Recipe Alarm is changed Flag, do you want to save it?"))
- {
- AlarmIsSaved = false;
- AlarmFlagIsSaved = false;
- }
- }
- else
- {
- AlarmFlagIsSaved = true;
- AlarmIsSaved = true;
- AlarmConditionTable.UndoChanges();
- }
- return true;
- }
- public bool UndoPressChanges()
- {
- if (PressIsSaved)
- {
- if (DialogButton.Yes == DialogBox.ShowDialog(DialogButton.Yes | DialogButton.No,
- DialogType.CONFIRM,
- $"Recipe Press is changed Flag, do you want to save it?"))
- {
- PressIsSaved = false;
- PressFlagIsSaved = false;
- }
- }
- else
- {
- PressFlagIsSaved = true;
- PressCommand.UndoChanges();
- PressPID.UndoChanges();
- PressSet.UndoChanges();
- PressSlowVacSet.UndoChanges();
- PressValveAngleSet.UndoChanges();
- PressLowPressWait.UndoChanges();
- WaitPress.UndoChanges();
- }
- return true;
- }
- public bool UndoLoaderChanges()
- {
- if (LoaderIsSaved)
- {
- if (DialogButton.Yes == DialogBox.ShowDialog(DialogButton.Yes | DialogButton.No,
- DialogType.CONFIRM,
- $"Recipe Loader is changed Flag, do you want to save it?"))
- {
- LoaderIsSaved = false;
- }
- }
- else
- {
- LoaderIsSaved = true;
- LoaderCommand.UndoChanges();
- LoaderSpeed1.UndoChanges();
- LoaderSpeed2.UndoChanges();
- LoaderSpeed3.UndoChanges();
- LoaderRPM.UndoChanges();
- }
- return true;
- }
- public string Value { get; set; }
- private int _stepNo;
- public int StepNo
- {
- get => _stepNo; set
- {
- _stepNo = value;
- NotifyOfPropertyChange("StepNo");
- }
- }
- private string _name;
- public string Name
- {
- get => _name; set
- {
- _name = value;
- NotifyOfPropertyChange("Name");
- }
- }
- public string EndBy { get; set; }
- public string Time { get; set; }
- public string SkipWait { get; set; }
- public string Command { get; set; }
- public bool IsChecked { get; set; }
- public Visibility IsVisibility { get; set; } = Visibility.Visible;
- public bool IsnoneConditionCheck { get; set; }
- public string[] ExternalSensorName { get; set; } = new string[] { "SensorTubeATMPressure", "SensorASOpenPosition", "SensorASClosePosition", "SensorEXTIN4", "SensorEXTIN5", "SensorEXTIN6", "SensorEXTIN7" };
- public string[] ExternalSensor { get; set; } = new string[] { "None", "None", "None", "None", "None", "None", "None" };
- public string TempStabilizeSelected { get; set; }
- public string FinishAutoProfile { get; set; }
- public string ReachTemp { get; set; }
- public double ReachTempValue { get; set; }
- public string O2Density { get; set; }
- public int O2DensityValue { get; set; }
- public string ReachPressure { get; set; }
- public string ReachPressureVG { get; set; }
- public string PressureStabilizeVG { get; set; }
- public double ReachPressureValue { get; set; }
- public string PressureStabilizeSelected { get; set; }
- public string ProcessTimeToEnd { get; set; }
- //public string PressureSonserValue { get; set; }
- //public string PressureValveAngle { get; set; }
- //public string PressureSettingVG { get; set; }
- //public string SlowVacuumValue { get; set; }
- //public string PressureAlarmTableNo { get; set; }
- //public string ZAxisPosition { get; set; }
- //public string ZAxisSpeed { get; set; }
- //public string RotatePosition { get; set; }
- public string AbortRecipeTableIndex { get; set; }
- //public string RFSwitch { get; set; }
- //public string RFSetpoint { get; set; }
- //public string RFPowerSetpoint { get; set; }
- //public string C1Setpoint { get; set; }
- //public string C2Setpoint { get; set; }
- //public string ForwardPowerAlarmWatchTable { get; set; }
- //public string PrAlarmWatchTable { get; set; }
- //public string PIAlarmWatchTable { get; set; }
- //public string C1AlarmWatchTable { get; set; }
- //public string C2AlarmWatchTable { get; set; }
- //public string VppAlarmWatchTable { get; set; }
- //public string VdcAlarmWatchTable { get; set; }
- /// <summary>
- /// R 轴方向,CCW(逆时针),CW(顺时针)
- /// </summary>
- // public string RotateDirection { get; set; }
- //public string RotateSpeed { get; set; }
- //public string RotateInterval { get; set; }
- //public string APC_SetPressure { get; set; }
- private bool _mFCSetFlagIsSaved = true;
- public bool MFCSetFlagIsSaved
- {
- get => _mFCSetFlagIsSaved;
- set
- {
- _mFCSetFlagIsSaved = value;
- NotifyOfPropertyChange(nameof(MFCSetFlagIsSaved));
- }
- }
- private bool _mFCIsSaved = true;
- public bool MFCIsSaved
- {
- get => _mFCIsSaved;
- set
- {
- _mFCIsSaved = value;
- NotifyOfPropertyChange(nameof(MFCIsSaved));
- }
- }
- private bool _temperatureSetsFlagIsSaved = true;
- public bool TemperatureSetsFlagIsSaved
- {
- get => _temperatureSetsFlagIsSaved;
- set
- {
- _temperatureSetsFlagIsSaved = value;
- NotifyOfPropertyChange(nameof(TemperatureSetsFlagIsSaved));
- }
- }
- private bool _temperatureIsSaved = true;
- public bool TemperatureIsSaved
- {
- get => _temperatureIsSaved;
- set
- {
- _temperatureIsSaved = value;
- NotifyOfPropertyChange(nameof(TemperatureIsSaved));
- }
- }
- private bool _valveFlagIsSaved = true;
- public bool ValveFlagIsSaved
- {
- get => _valveFlagIsSaved;
- set
- {
- _valveFlagIsSaved = value;
- NotifyOfPropertyChange(nameof(ValveFlagIsSaved));
- }
- }
- private bool _valveIsSaved = true;
- public bool ValveIsSaved
- {
- get => _valveIsSaved;
- set
- {
- _valveIsSaved = value;
- NotifyOfPropertyChange(nameof(ValveIsSaved));
- }
- }
- private bool _auxFlagIsSaved = true;
- public bool AUXFlagIsSaved
- {
- get => _auxFlagIsSaved;
- set
- {
- _auxFlagIsSaved = value;
- NotifyOfPropertyChange(nameof(AUXFlagIsSaved));
- }
- }
- private bool _auxIsSaved = true;
- public bool AUXIsSaved
- {
- get => _auxIsSaved;
- set
- {
- _auxIsSaved = value;
- NotifyOfPropertyChange(nameof(AUXIsSaved));
- }
- }
- private bool _loaderIsSaved = true;
- public bool LoaderIsSaved
- {
- get => _loaderIsSaved;
- set
- {
- _loaderIsSaved = value;
- NotifyOfPropertyChange(nameof(LoaderIsSaved));
- }
- }
- private bool _pressFlagIsSaved = true;
- public bool PressFlagIsSaved
- {
- get => _pressFlagIsSaved;
- set
- {
- _pressFlagIsSaved = value;
- NotifyOfPropertyChange(nameof(PressFlagIsSaved));
- }
- }
- private bool _pressIsSaved = true;
- public bool PressIsSaved
- {
- get => _pressIsSaved;
- set
- {
- _pressIsSaved = value;
- NotifyOfPropertyChange(nameof(PressIsSaved));
- }
- }
- private bool _alarmFlagIsSaved = true;
- public bool AlarmFlagIsSaved
- {
- get => _alarmFlagIsSaved;
- set
- {
- _alarmFlagIsSaved = value;
- NotifyOfPropertyChange(nameof(AlarmFlagIsSaved));
- }
- }
- private bool _alarmIsSaved = true;
- public bool AlarmIsSaved
- {
- get => _alarmIsSaved;
- set
- {
- _alarmIsSaved = value;
- NotifyOfPropertyChange(nameof(AlarmIsSaved));
- }
- }
- public string GasLineN2_Flow { get; set; }
- public string GasLineN3_Flow { get; set; }
- public MFMValue MfmD1Flow { get; set; }
- public ObservableCollection<BoolParam> ValveSets { get; set; } = new ObservableCollection<BoolParam>();
- //public Dictionary<string, MFCData> MFCSets { get; set; } = new Dictionary<string, MFCData>();
- public ObservableCollection<MFCData> MFCSets { get; set; } = new ObservableCollection<MFCData>();
- public Dictionary<string, MFMValue> MFMSets { get; set; } = new Dictionary<string, MFMValue>();
- public Dictionary<string, bool> EXOUSets { get; set; } = new Dictionary<string, bool>();
- public ObservableCollection<TempSetData> TemperatureSets { get; set; } = new ObservableCollection<TempSetData>();
- public Dictionary<string, Dictionary<int, VPData>> VPSets { get; set; } = new Dictionary<string, Dictionary<int, VPData>>();
- public ObservableCollection<AUXData> AUXSets { get; set; } = new ObservableCollection<AUXData>();
- private void Temperature_PropertyChanged(object sender, PropertyChangedEventArgs e)
- {
- if (e.PropertyName == nameof(StringParam.IsSaved))
- {
- SetTemperatureIsSaved();
- }
- else if (e.PropertyName == "Value")
- {
- if (sender is Param)
- {
- if (((Param)sender).IsSaved) return;
- SetValueEventArgs setValueEventArgs = new SetValueEventArgs();
- setValueEventArgs.Sender = this;
- setValueEventArgs.ValueName = ((Param)sender).Name;
- setValueEventArgs.PropertyName = ((Param)sender).Name;
- if (sender is DoubleParam)
- {
- setValueEventArgs.PropertyValue = ((DoubleParam)sender).Value;
- OnTempValueChanged(setValueEventArgs);
- }
- else if (sender is StringParam)
- {
- var tempObj = sender as StringParam;
- if (tempObj.Name == "TemperatureControlMode" || tempObj.Name == "TemperatureCorrect" || tempObj.Name == "TemperaturePID")
- setValueEventArgs.PropertyValue = ((StringParam)sender).Value;
- if (((StringParam)sender).OldValue != ((StringParam)sender).Value)
- {
- OnTempValueChanged(setValueEventArgs);
- }
- }
- }
- }
- }
- private void OtherTemperature_PropertyChanged(object sender, PropertyChangedEventArgs e)
- {
- if (e.PropertyName == nameof(StringParam.IsSaved))
- {
- SetTemperatureIsSaved();
- }
- else if (e.PropertyName == "Value")
- {
- if (sender is Param)
- {
- if (((Param)sender).IsSaved) return;
- SetValueEventArgs setValueEventArgs = new SetValueEventArgs();
- setValueEventArgs.Sender = this;
- setValueEventArgs.ValueName = ((Param)sender).Name;
- setValueEventArgs.PropertyName = ((Param)sender).Name;
- if (sender is DoubleParam)
- {
- setValueEventArgs.PropertyValue = ((DoubleParam)sender).Value;
- OnOhterTempValueChanged(setValueEventArgs);
- }
- else if (sender is StringParam)
- {
- var tempObj = sender as StringParam;
- if (tempObj.Name == "TemperatureControlMode" || tempObj.Name == "TemperatureCorrect" || tempObj.Name == "TemperaturePID")
- {
- setValueEventArgs.PropertyValue = ((StringParam)sender).Value;
- //if (((StringParam)sender).OldValue != ((StringParam)sender).Value)
- //{
- OnOhterTempValueChanged(setValueEventArgs);
- //}
- }
- }
- }
- }
- }
- private StringParam _temperatureControlMode;
- public StringParam TemperatureControlMode
- {
- get => _temperatureControlMode;
- set
- {
- _temperatureControlMode = value;
- _temperatureControlMode.PropertyChanged += OtherTemperature_PropertyChanged;
- NotifyOfPropertyChange(nameof(TemperatureControlMode));
- }
- }
- private StringParam _temperatureCorrect;
- public StringParam TemperatureCorrect
- {
- get => _temperatureCorrect;
- set
- {
- _temperatureCorrect = value;
- _temperatureCorrect.PropertyChanged += OtherTemperature_PropertyChanged;
- NotifyOfPropertyChange(nameof(TemperatureCorrect));
- }
- }
- private StringParam _temperaturePID;
- public StringParam TemperaturePID
- {
- get => _temperaturePID;
- set
- {
- _temperaturePID = value;
- _temperaturePID.PropertyChanged += OtherTemperature_PropertyChanged;
- NotifyOfPropertyChange(nameof(TemperaturePID));
- }
- }
- private StringParam _loaderCommand = new StringParam() { Name = "LoaderCommand", Value = "None" };
- public StringParam LoaderCommand
- {
- get => _loaderCommand;
- set
- {
- _loaderCommand = value;
- _loaderCommand.PropertyChanged += LoaderIsSaved_PropertyChanged;
- NotifyOfPropertyChange(nameof(LoaderCommand));
- }
- }
- private DoubleParam _loaderSpeed1 = new DoubleParam() { Name = "LoaderSpeed1", Value = "0" };
- public DoubleParam LoaderSpeed1
- {
- get => _loaderSpeed1;
- set
- {
- _loaderSpeed1 = value;
- _loaderSpeed1.PropertyChanged += LoaderIsSaved_PropertyChanged;
- NotifyOfPropertyChange(nameof(LoaderSpeed1));
- }
- }
- private DoubleParam _loaderSpeed2 = new DoubleParam() { Name = "LoaderSpeed2", Value = "0" };
- public DoubleParam LoaderSpeed2
- {
- get => _loaderSpeed2;
- set
- {
- _loaderSpeed2 = value;
- _loaderSpeed2.PropertyChanged += LoaderIsSaved_PropertyChanged;
- NotifyOfPropertyChange(nameof(LoaderSpeed2));
- }
- }
- private DoubleParam _loaderSpeed3 = new DoubleParam() { Name = "LoaderSpeed3", Value = "0" };
- public DoubleParam LoaderSpeed3
- {
- get => _loaderSpeed3;
- set
- {
- _loaderSpeed3 = value;
- _loaderSpeed3.PropertyChanged += LoaderIsSaved_PropertyChanged;
- NotifyOfPropertyChange(nameof(LoaderSpeed3));
- }
- }
- private DoubleParam _loaderRPM = new DoubleParam() { Name = "LoaderRPM", Value = "0" };
- public DoubleParam LoaderRPM
- {
- get => _loaderRPM;
- set
- {
- _loaderRPM = value;
- _loaderRPM.PropertyChanged += LoaderIsSaved_PropertyChanged;
- NotifyOfPropertyChange(nameof(LoaderRPM));
- }
- }
- public StringParam _pressCommand = new StringParam() { Name = "PressCommand", Value = "None" };
- public StringParam PressCommand
- {
- get => _pressCommand;
- set
- {
- _pressCommand = value;
- _pressCommand.PropertyChanged += PressureIsSaved_PropertyChanged;
- NotifyOfPropertyChange(nameof(PressCommand));
- }
- }
- private StringParam _pressPID = new StringParam() { Name = "PressPID", Value = "" };
- public StringParam PressPID
- {
- get => _pressPID;
- set
- {
- _pressPID = value;
- _pressPID.PropertyChanged += PressureIsSaved_PropertyChanged;
- NotifyOfPropertyChange(nameof(_pressPID));
- }
- }
- private DoubleParam _pressSet = new DoubleParam() { Name = "PressSet", Value = "0" };
- public DoubleParam PressSet
- {
- get => _pressSet;
- set
- {
- _pressSet = value;
- _pressSet.PropertyChanged += PressureIsSaved_PropertyChanged;
- NotifyOfPropertyChange(nameof(PressSet));
- }
- }
- private StringParam _pressValveAngleSet = new StringParam() { Name = "PressValveAngleSet", Value = "0" };
- public StringParam PressValveAngleSet
- {
- get => _pressValveAngleSet;
- set
- {
- _pressValveAngleSet = value;
- _pressValveAngleSet.PropertyChanged += PressureIsSaved_PropertyChanged;
- NotifyOfPropertyChange(nameof(PressValveAngleSet));
- }
- }
- private DoubleParam _pressSlowVacSet = new DoubleParam() { Name = "PressSlowVacSet", Value = "0" };
- public DoubleParam PressSlowVacSet
- {
- get => _pressSlowVacSet;
- set
- {
- _pressSlowVacSet = value;
- _pressSlowVacSet.PropertyChanged += PressureIsSaved_PropertyChanged;
- NotifyOfPropertyChange(nameof(PressSlowVacSet));
- }
- }
- private BoolParam _pressIsWait = new BoolParam() { Name = "PressIsWait", Value = false };
- public BoolParam PressIsWait
- {
- get => _pressIsWait;
- set
- {
- _pressIsWait = value;
- _pressIsWait.PropertyChanged += PressureIsSaved_PropertyChanged;
- NotifyOfPropertyChange(nameof(PressIsWait));
- }
- }
- private StringParam _pressLowWait = new StringParam() { Name = "PressLowWait", Value = "0" };
- public StringParam PressLowWait
- {
- get => _pressLowWait;
- set
- {
- _pressLowWait = value;
- _pressLowWait.PropertyChanged += PressureIsSaved_PropertyChanged;
- NotifyOfPropertyChange(nameof(PressLowWait));
- }
- }
- public StringParam _pressHighWait = new StringParam() { Name = "PressHighWait", Value = "0" };
- public StringParam PressHighWait
- {
- get => _pressHighWait;
- set
- {
- _pressHighWait = value;
- _pressHighWait.PropertyChanged += PressureIsSaved_PropertyChanged;
- NotifyOfPropertyChange(nameof(PressHighWait));
- }
- }
- private StringParam _pressWaitUnit = new StringParam() { Name = "PressWaitUnit", Value = "Torr" };
- public StringParam PressWaitUnit
- {
- get => _pressWaitUnit;
- set
- {
- _pressWaitUnit = value;
- _pressWaitUnit.PropertyChanged += PressureIsSaved_PropertyChanged;
- NotifyOfPropertyChange(nameof(PressWaitUnit));
- }
- }
- private StringParam _pressLowPressWait = new StringParam() { Name = "PressLowPressWait", Value = "None" };
- public StringParam PressLowPressWait
- {
- get => _pressLowPressWait;
- set
- {
- _pressLowPressWait = value;
- _pressLowPressWait.PropertyChanged += PressureIsSaved_PropertyChanged;
- NotifyOfPropertyChange(nameof(PressLowPressWait));
- }
- }
- private StringParam _waitPress = new StringParam() { Name = "WaitPress", Value = "0" };
- public StringParam WaitPress
- {
- get => _waitPress;
- set
- {
- _waitPress = value;
- _waitPress.PropertyChanged += PressureIsSaved_PropertyChanged;
- NotifyOfPropertyChange(nameof(WaitPress));
- }
- }
- //public string TemperatureProfile { get; set; }
- //public string TemperatureAlarm { get; set; }
- //public string CAPTemperatureAlarm { get; set; }
- //public string CAPSetValue { get; set; }
- //public string CAPRampingValue { get; set; }
- //public string TemperatureStabilize { get; set; }
- //public bool TemperatureReadyCond { get; set; }
- private StringParam _alarmConditionTable = new StringParam() { Name = "AlarmConditionTable", Value = "" };
- public StringParam AlarmConditionTable
- {
- get => _alarmConditionTable;
- set
- {
- _alarmConditionTable = value;
- _alarmConditionTable.PropertyChanged += AlarmIsSaved_PropertyChanged;
- NotifyOfPropertyChange(nameof(AlarmConditionTable));
- }
- }
- //public string EventSetting { get; set; }
- public string FilmThickFormula { get; set; }
- public Dictionary<int, AlarmAction> AlarmActionSets { get; set; } = new Dictionary<int, AlarmAction>();
- public string DictionaryStepTime(Dictionary<string, string> steptimes)
- {
- if (steptimes == null) return null;
- StringBuilder rtn = new StringBuilder();
- foreach (var item in steptimes.Keys)
- {
- if (steptimes[item] == "00:00:00") continue;
- rtn.Append($"{item},{steptimes[item]};");
- }
- if (rtn.Length > 0) rtn.Remove(rtn.Length - 1, 1);
- return rtn.ToString();
- }
- public Dictionary<string, string> StepTimeToDictionary(string stepTime)
- {
- Dictionary<string, string> steptimes = new Dictionary<string, string>();
- string[] tempTimes = stepTime.Split(';');
- foreach (var item in tempTimes)
- {
- string[] subTimes = item.Split(',');
- steptimes.Add(subTimes[0], subTimes[1]);
- }
- return steptimes;
- }
- }
- public class AlarmAction
- {
- public string PtocessingType { get; set; }
- public string PtocessingDetails { get; set; }
- }
- public class MFMValue : PropertyChangedBase
- {
- private string _name;
- public string Name
- {
- get => _name;
- set
- {
- _name = value;
- NotifyOfPropertyChange("Name");
- }
- }
- private string _value;
- public string Value
- {
- get => _value;
- set
- {
- _value = value;
- NotifyOfPropertyChange("Value");
- }
- }
- private string _alarmValue;
- public string AlarmValue
- {
- get => _alarmValue; set
- {
- _alarmValue = value;
- NotifyOfPropertyChange("AlarmValue");
- }
- }
- public override string ToString()
- {
- return $"{Value};{AlarmValue}";
- }
- }
- public class MFMData : MFCData
- { }
- public class MFCData : PropertyChangedBase
- {
- public delegate void ValueChangedEventHandler(object sender, SetValueEventArgs e);
- public event ValueChangedEventHandler ValueChangedEvent;
- public MFCData()
- {
- }
- public void OnValueChanged(SetValueEventArgs e)
- {
- if (ValueChangedEvent != null)
- {
- ValueChangedEvent(this, e);
- }
- }
- private bool _flagIsSaved = true;
- public bool FlagIsSaved
- {
- get => _flagIsSaved;
- set
- {
- _flagIsSaved = value;
- NotifyOfPropertyChange(nameof(FlagIsSaved));
- NotifyOfPropertyChange(nameof(IsSaved));
- }
- }
- public bool IsSaved
- {
- get
- {
- if (SetValue.IsSaved && SetUnit.IsSaved && Rampng.IsSaved && RampngUnit.IsSaved && IsCheck.IsSaved && MaxValue.IsSaved && MinValue.IsSaved)
- {
- if (FlagIsSaved)
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- else
- {
- return false;
- }
- }
- }
- public bool UndoChanges()
- {
- Type type = this.GetType();
- PropertyInfo[] properties = type.GetProperties();
- foreach (var item in properties)
- {
- var obj = item.GetValue(this);
- if (obj is Param)
- {
- ((Param)obj).UndoChanges();
- }
- }
- FlagIsSaved = true;
- return true;
- }
- private void ParamIsSaved_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
- {
- if (e.PropertyName == "IsSaved")
- {
- NotifyOfPropertyChange("IsSaved");
- }
- else if (e.PropertyName == "Value")
- {
- if (sender is Param)
- {
- if (((Param)sender).IsSaved) return;
- SetValueEventArgs tempSetEventArgs = new SetValueEventArgs();
- tempSetEventArgs.Sender = this;
- tempSetEventArgs.ValueName = this.ControlName;
- tempSetEventArgs.PropertyName = ((Param)sender).Name;
- if (sender is DoubleParam)
- {
- tempSetEventArgs.PropertyValue = ((DoubleParam)sender).Value;
- OnValueChanged(tempSetEventArgs);
- }
- else if (sender is IntParam)
- {
- tempSetEventArgs.PropertyValue = ((IntParam)sender).Value.ToString();
- OnValueChanged(tempSetEventArgs);
- }
- else if (sender is StringParam)
- {
- tempSetEventArgs.PropertyValue = ((StringParam)sender).Value;
- OnValueChanged(tempSetEventArgs);
- }
- else if (sender is BoolParam)
- {
- tempSetEventArgs.PropertyValue = ((BoolParam)sender).Value.ToString();
- OnValueChanged(tempSetEventArgs);
- }
- }
- }
- }
- private int _no;
- public int No
- {
- get => _no;
- set
- {
- _no = value;
- NotifyOfPropertyChange("No");
- }
- }
- private string _name;
- public string Name
- {
- get => _name;
- set
- {
- _name = value;
- NotifyOfPropertyChange("Name");
- }
- }
- public string _unit;
- public string Unit
- {
- get => _unit;
- set
- {
- _unit = value;
- NotifyOfPropertyChange("Unit");
- }
- }
- private string _scaleValue;
- public string ScaleValue
- {
- get => _scaleValue;
- set
- {
- _scaleValue = value;
- NotifyOfPropertyChange("ScaleValue");
- }
- }
- private string _displayName;
- public string DisplayName
- {
- get => _displayName;
- set
- {
- _displayName = value;
- NotifyOfPropertyChange("DisplayName");
- }
- }
- private string _controlName;
- public string ControlName
- {
- get => _controlName;
- set
- {
- _controlName = value;
- NotifyOfPropertyChange("ControlName");
- }
- }
- private StringParam _setValue;
- public StringParam SetValue
- {
- get => _setValue;
- set
- {
- if (_setValue != null)
- {
- _setValue.PropertyChanged -= ParamIsSaved_PropertyChanged;
- }
- _setValue = value;
- _setValue.PropertyChanged += ParamIsSaved_PropertyChanged;
- NotifyOfPropertyChange(nameof(SetValue));
- }
- }
- private StringParam _setUnit = new StringParam() { Name = "SetUnit", Value = "SLM" };
- public StringParam SetUnit
- {
- get => _setUnit;
- set
- {
- if (_setUnit != null)
- {
- _setUnit.PropertyChanged -= ParamIsSaved_PropertyChanged;
- }
- _setUnit = value;
- _setUnit.PropertyChanged += ParamIsSaved_PropertyChanged;
- NotifyOfPropertyChange(nameof(SetUnit));
- }
- }
- private StringParam _rampngUnit = new StringParam() { Name = "RampngUnit", Value = "SLM" };
- public StringParam RampngUnit
- {
- get => _rampngUnit;
- set
- {
- if (_rampngUnit != null)
- {
- _rampngUnit.PropertyChanged -= ParamIsSaved_PropertyChanged;
- }
- _rampngUnit = value;
- _rampngUnit.PropertyChanged += ParamIsSaved_PropertyChanged;
- NotifyOfPropertyChange("RampngUnit");
- }
- }
- private DoubleParam _rampng;
- public DoubleParam Rampng
- {
- get => _rampng;
- set
- {
- if (_rampng != null)
- {
- _rampng.PropertyChanged -= ParamIsSaved_PropertyChanged;
- }
- _rampng = value;
- NotifyOfPropertyChange("Rampng");
- _rampng.PropertyChanged += ParamIsSaved_PropertyChanged;
- }
- }
- private string _alarmValue;
- public string AlarmValue
- {
- get => _alarmValue; set
- {
- _alarmValue = value;
- NotifyOfPropertyChange("AlarmValue");
- }
- }
- private DoubleParam _maxValue = new DoubleParam() { Name = "MaxValue", Value = "0" };
- public DoubleParam MaxValue
- {
- get => _maxValue; set
- {
- if (_maxValue != null)
- {
- _maxValue.PropertyChanged -= ParamIsSaved_PropertyChanged;
- }
- _maxValue = value;
- _maxValue.PropertyChanged += ParamIsSaved_PropertyChanged;
- NotifyOfPropertyChange("MaxValue");
- }
- }
- private DoubleParam _minValue = new DoubleParam() { Name = "MinValue", Value = "0" };
- public DoubleParam MinValue
- {
- get => _minValue; set
- {
- if (_minValue != null)
- {
- _minValue.PropertyChanged -= ParamIsSaved_PropertyChanged;
- }
- _minValue = value;
- _minValue.PropertyChanged += ParamIsSaved_PropertyChanged;
- NotifyOfPropertyChange("MinValue");
- }
- }
- private BoolParam _isCheck = new BoolParam() { Name = "IsCheck", Value = true };
- public BoolParam IsCheck
- {
- get => _isCheck;
- set
- {
- if (_isCheck != null)
- {
- _isCheck.PropertyChanged -= ParamIsSaved_PropertyChanged;
- }
- _isCheck = value;
- _isCheck.PropertyChanged += ParamIsSaved_PropertyChanged;
- NotifyOfPropertyChange("IsCheck");
- }
- }
- private bool _isEnable = true;
- public bool IsEnable
- {
- get => _isEnable;
- set
- {
- _isEnable = value;
- NotifyOfPropertyChange("IsEnable");
- }
- }
- }
- public class TempSetData : PropertyChangedBase
- {
- public delegate void ValueChangedEventHandler(object sender, SetValueEventArgs e);
- public event ValueChangedEventHandler ValueChangedEvent;
- public void OnValueChanged(SetValueEventArgs e)
- {
- if (ValueChangedEvent != null)
- {
- ValueChangedEvent(this, e);
- }
- }
- public TempSetData() { }
- public bool UndoChanges()
- {
- Type type = this.GetType();
- PropertyInfo[] properties = type.GetProperties();
- foreach (var item in properties)
- {
- var obj = item.GetValue(this);
- if (obj is Param)
- {
- ((Param)obj).UndoChanges();
- }
- }
- return true;
- }
- public bool IsSaved
- {
- get => SetValue.IsSaved && SetUnit.IsSaved && RampngValue.IsSaved && RampngUnit.IsSaved && IsCheck.IsSaved && HighValue.IsSaved && LowValue.IsSaved;
- }
- public TempSetData(string name)
- {
- No = 1;
- Name = name;
- SetValue = new StringParam() { Name = "SetValue", Value = "0" };
- SetUnit = new StringParam() { Name = "SetUnit", Value = "℃" };
- RampngValue = new DoubleParam() { Name = "RampngValue", Value = "0" };
- RampngUnit = new StringParam() { Name = "RampngUnit", Value = "℃/min" };
- IsCheck = new BoolParam() { Name = "IsCheck", Value = false };
- HighValue = new DoubleParam() { Name = "HighValue", Value = "0" };
- LowValue = new DoubleParam() { Name = "LowValue", Value = "0" };
- Unit = "℃";
- }
- private void ParamIsSaved_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
- {
- if (e.PropertyName == nameof(Param.IsSaved))
- {
- NotifyOfPropertyChange(nameof(IsSaved));
- }
- else if (e.PropertyName == "Value")
- {
- if (sender is Param)
- {
- if (((Param)sender).IsSaved) return;
- SetValueEventArgs tempSetEventArgs = new SetValueEventArgs();
- tempSetEventArgs.Sender = this;
- tempSetEventArgs.ValueName = Name;
- tempSetEventArgs.PropertyName = ((Param)sender).Name;
- if (sender is DoubleParam)
- {
- tempSetEventArgs.PropertyValue = ((DoubleParam)sender).Value;
- OnValueChanged(tempSetEventArgs);
- }
- else if (sender is StringParam)
- {
- tempSetEventArgs.PropertyValue = ((StringParam)sender).Value;
- OnValueChanged(tempSetEventArgs);
- }
- }
- }
- }
- public TempSetData(string name, string value) : this(name)
- {
- var listStr = value.Split(';');
- No = 1;
- if (listStr.Length > 8)
- {
- Name = listStr[0];
- SetValue.Value = listStr[1];
- SetUnit.Value = listStr[2];
- RampngValue.Value = listStr[3];
- RampngUnit.Value = listStr[4];
- bool.TryParse(listStr[5], out bool isCheck);
- IsCheck.Value = isCheck;
- double.TryParse(listStr[6], out double highValue);
- HighValue.Value = highValue.ToString();
- double.TryParse(listStr[7], out double lowValue);
- LowValue.Value = lowValue.ToString();
- Unit = listStr[8];
- }
- }
- private int _no;
- public int No
- {
- get => _no;
- set
- {
- _no = value;
- NotifyOfPropertyChange("No");
- }
- }
- private string _name;
- public string Name
- {
- get => _name;
- set
- {
- _name = value;
- NotifyOfPropertyChange("Name");
- }
- }
- private string _displayName;
- public string DisplayName
- {
- get => _displayName;
- set
- {
- _displayName = value;
- NotifyOfPropertyChange("DisplayName");
- }
- }
- private StringParam _setValue;
- public StringParam SetValue
- {
- get => _setValue;
- set
- {
- if (_setValue != null)
- {
- _setValue.PropertyChanged -= ParamIsSaved_PropertyChanged;
- }
- _setValue = value;
- _setValue.PropertyChanged += ParamIsSaved_PropertyChanged;
- NotifyOfPropertyChange("SetValue");
- }
- }
- private StringParam _setUnit;
- public StringParam SetUnit
- {
- get => _setUnit;
- set
- {
- if (_setUnit != null)
- {
- _setUnit.PropertyChanged -= ParamIsSaved_PropertyChanged;
- }
- _setUnit = value;
- _setUnit.PropertyChanged += ParamIsSaved_PropertyChanged;
- NotifyOfPropertyChange("SetUnit");
- }
- }
- private DoubleParam _rampngValue;
- public DoubleParam RampngValue
- {
- get => _rampngValue;
- set
- {
- if (_rampngValue != null)
- {
- _rampngValue.PropertyChanged -= ParamIsSaved_PropertyChanged;
- }
- _rampngValue = value;
- _rampngValue.PropertyChanged += ParamIsSaved_PropertyChanged;
- NotifyOfPropertyChange("RampngValue");
- }
- }
- private StringParam _rampngUnit;
- public StringParam RampngUnit
- {
- get => _rampngUnit;
- set
- {
- if (_rampngUnit != null)
- {
- _rampngUnit.PropertyChanged -= ParamIsSaved_PropertyChanged;
- }
- _rampngUnit = value;
- _rampngUnit.PropertyChanged += ParamIsSaved_PropertyChanged;
- NotifyOfPropertyChange("RampngUnit");
- }
- }
- private StringParam _alarmValue;
- public StringParam AlarmValue
- {
- get => _alarmValue;
- set
- {
- _alarmValue = value;
- NotifyOfPropertyChange("AlarmValue");
- }
- }
- private BoolParam _isCheck;
- public BoolParam IsCheck
- {
- get => _isCheck;
- set
- {
- if (_isCheck != null)
- {
- _isCheck.PropertyChanged -= ParamIsSaved_PropertyChanged;
- }
- _isCheck = value;
- _isCheck.PropertyChanged += ParamIsSaved_PropertyChanged;
- NotifyOfPropertyChange("IsCheck");
- }
- }
- private DoubleParam _highValue;
- public DoubleParam HighValue
- {
- get => _highValue;
- set
- {
- if (_highValue != null)
- {
- _highValue.PropertyChanged -= ParamIsSaved_PropertyChanged;
- }
- _highValue = value;
- _highValue.PropertyChanged += ParamIsSaved_PropertyChanged;
- NotifyOfPropertyChange("HighValue");
- }
- }
- private DoubleParam _lowValue;
- public DoubleParam LowValue
- {
- get => _lowValue;
- set
- {
- if (_lowValue != null)
- {
- _lowValue.PropertyChanged -= ParamIsSaved_PropertyChanged;
- }
- _lowValue = value;
- _lowValue.PropertyChanged += ParamIsSaved_PropertyChanged;
- NotifyOfPropertyChange("LowValue");
- }
- }
- private string _unit;
- public string Unit
- {
- get => _unit;
- set
- {
- _unit = value;
- NotifyOfPropertyChange("Unit");
- }
- }
- public override string ToString()
- {
- return $"{Name};{SetValue.Value};{SetUnit.Value};{RampngValue.Value};{RampngUnit.Value};{IsCheck.Value};{HighValue.Value};{LowValue.Value};{Unit}";
- }
- }
- public class VPData : PropertyChangedBase
- {
- private int _no;
- public int No
- {
- get => _no;
- set
- {
- _no = value;
- NotifyOfPropertyChange("No");
- }
- }
- private string _name;
- public string Name
- {
- get => _name;
- set
- {
- _name = value;
- NotifyOfPropertyChange("Name");
- }
- }
- private bool _isCheck;
- public bool IsCheck
- {
- get => _isCheck;
- set
- {
- _isCheck = value;
- NotifyOfPropertyChange("IsCheck");
- }
- }
- }
- public class Combination : PropertyChangedBase
- {
- public ObservableCollection<Param> Params = new ObservableCollection<Param>();
- public Combination() { }
- public Combination(ObservableCollection<Param> value) : base()
- {
- if (value != null && value.Count > 0)
- {
- Params = value;
- StringParam subRecipe = value.FirstOrDefault(x => x.Name == "Combination.SubRecipe") as StringParam;
- this.SubRecipePath = subRecipe != null ? subRecipe.Value : "";
- StringParam alarmRecipe = value.FirstOrDefault(x => x.Name == "Combination.AlarmRecipe") as StringParam;
- this.AlarmRecipePath = alarmRecipe != null ? alarmRecipe.Value : "";
- StringParam alarmCondition = value.FirstOrDefault(x => x.Name == "Combination.AlarmCondition") as StringParam;
- this.AlarmCondition = alarmCondition != null ? alarmCondition.Value : "";
- StringParam leakCheck = value.FirstOrDefault(x => x.Name == "Combination.LeakCheck") as StringParam;
- this.LeakCheck = leakCheck != null ? leakCheck.Value : "";
- StringParam abortRecipe = value.FirstOrDefault(x => x.Name == "Combination.AbortRecipe") as StringParam;
- this.AbortRecipePath = abortRecipe != null ? abortRecipe.Value : "";
- StringParam pressAPCPID = value.FirstOrDefault(x => x.Name == "Combination.PressAPCPID") as StringParam;
- this.PressAPC = pressAPCPID != null ? pressAPCPID.Value : "";
- StringParam tempCorrection = value.FirstOrDefault(x => x.Name == "Combination.TempCorrection") as StringParam;
- this.TempCorrection = tempCorrection != null ? tempCorrection.Value : "";
- StringParam tempPID = value.FirstOrDefault(x => x.Name == "Combination.TempPID") as StringParam;
- this.TempPID = tempPID != null ? tempPID.Value : "";
- StringParam profileCondition = value.FirstOrDefault(x => x.Name == "Combination.ProfileCondition") as StringParam;
- this.ProfileCondition = profileCondition != null ? profileCondition.Value : "";
- StringParam n2PurgeMode = value.FirstOrDefault(x => x.Name == "N2PurgeMode") as StringParam;
- this.N2PurgeMode = n2PurgeMode != null ? n2PurgeMode.Value : "None";
- }
- }
- public Combination(string value) : base()
- {
- SetCombinationValue(value);
- }
- public void SetCombinationValue(string value)
- {
- if (string.IsNullOrEmpty(value) || !value.Contains(";")) return;
- var strList = value.Split(';');
- foreach (var item in strList)
- {
- var subStrList = item.Split(':');
- if (string.IsNullOrEmpty(subStrList[0]) || subStrList.Length != 2) continue;
- switch (subStrList[0])
- {
- case "SubRecipePath":
- SubRecipePath = subStrList[1];
- break;
- case "AlarmRecipePath":
- AlarmRecipePath = subStrList[1];
- break;
- case "AbortRecipePath":
- AbortRecipePath = subStrList[1];
- break;
- case "AlarmCondition":
- AlarmCondition = subStrList[1];
- break;
- case "LeakCheck":
- LeakCheck = subStrList[1];
- break;
- case "PressAPC":
- PressAPC = subStrList[1];
- break;
- case "TempCorrect":
- TempCorrection = subStrList[1];
- break;
- case "TempPID":
- TempPID = subStrList[1];
- break;
- case "ProfileCondition":
- ProfileCondition = subStrList[1];
- break;
- default:
- break;
- }
- }
- }
- private string _subRecipePath = "";
- public string SubRecipePath
- {
- get => _subRecipePath;
- set
- {
- _subRecipePath = value;
- NotifyOfPropertyChange("SubRecipePath");
- }
- }
- private string _alarmRecipePath = "";
- public string AlarmRecipePath
- {
- get => _alarmRecipePath;
- set
- {
- _alarmRecipePath = value;
- NotifyOfPropertyChange("AlarmRecipePath");
- }
- }
- private string _alarmCondition = "";
- public string AlarmCondition
- {
- get => _alarmCondition;
- set
- {
- _alarmCondition = value;
- NotifyOfPropertyChange("AlarmCondition");
- }
- }
- private string _leakCheck = "";
- public string LeakCheck
- {
- get => _leakCheck;
- set
- {
- _leakCheck = value;
- NotifyOfPropertyChange("LeakCheck");
- }
- }
- private string _AbortRecipePath = "";
- public string AbortRecipePath
- {
- get => _AbortRecipePath;
- set
- {
- _AbortRecipePath = value;
- NotifyOfPropertyChange("AbortRecipePath");
- }
- }
- private string _pressAPC = "";
- public string PressAPC
- {
- get => _pressAPC;
- set
- {
- _pressAPC = value;
- NotifyOfPropertyChange("PressAPC");
- }
- }
- private string _tempCorrection = "";
- public string TempCorrection
- {
- get => _tempCorrection;
- set
- {
- _tempCorrection = value;
- NotifyOfPropertyChange("TempCorrection");
- }
- }
- private string _tempPID = "";
- public string TempPID
- {
- get => _tempPID;
- set
- {
- _tempPID = value;
- NotifyOfPropertyChange("TempPID");
- }
- }
- private string _profileCondition = "";
- public string ProfileCondition
- {
- get => _profileCondition;
- set
- {
- _profileCondition = value;
- NotifyOfPropertyChange("ProfileCondition");
- }
- }
- private string _n2PurgeMode = "None";
- public string N2PurgeMode
- {
- get => _n2PurgeMode;
- set
- {
- _n2PurgeMode = value;
- NotifyOfPropertyChange("N2PurgeMode");
- }
- }
- public delegate void ChangedValueHandler(string type, string value);
- public event ChangedValueHandler ChangedValueEvent;
- private void ChangedSelectedFileName(string type, string value)
- {
- if (ChangedValueEvent != null)
- {
- ChangedValueEvent(type, value);
- }
- }
- public void SetN2PurgeModeToParam()
- {
- if (Params.Count > 0)
- {
- StringParam n2PurgeMode = Params.FirstOrDefault(x => x.Name == "N2PurgeMode") as StringParam;
- if (n2PurgeMode != null && n2PurgeMode.Value != this.N2PurgeMode)
- {
- n2PurgeMode.Value = this.N2PurgeMode;
- ChangedSelectedFileName("N2PurgeMode", this.N2PurgeMode);
- }
- }
- }
- public void SetValueToParam()
- {
- if (Params.Count > 0)
- {
- StringParam subRecipe = Params.FirstOrDefault(x => x.Name == "Combination.SubRecipe") as StringParam;
- if (subRecipe != null && subRecipe.Value != this.SubRecipePath)
- {
- subRecipe.Value = this.SubRecipePath;
- ChangedSelectedFileName("SubRecipe", this.SubRecipePath);
- }
- StringParam alarmRecipe = Params.FirstOrDefault(x => x.Name == "Combination.AlarmRecipe") as StringParam;
- if (alarmRecipe != null && alarmRecipe.Value != this.AlarmRecipePath)
- {
- alarmRecipe.Value = this.AlarmRecipePath;
- ChangedSelectedFileName("AlarmRecipe", this.AlarmRecipePath);
- }
- StringParam alarmCondition = Params.FirstOrDefault(x => x.Name == "Combination.AlarmCondition") as StringParam;
- if (alarmCondition != null && alarmCondition.Value != this.AlarmCondition)
- {
- alarmCondition.Value = this.AlarmCondition;
- ChangedSelectedFileName("AlarmCondition", this.AlarmCondition);
- }
- StringParam leakCheck = Params.FirstOrDefault(x => x.Name == "Combination.LeakCheck") as StringParam;
- if (leakCheck != null && leakCheck.Value != this.LeakCheck)
- {
- leakCheck.Value = this.LeakCheck;
- ChangedSelectedFileName("LeakCheck", this.LeakCheck);
- }
- StringParam abortRecipe = Params.FirstOrDefault(x => x.Name == "Combination.AbortRecipe") as StringParam;
- if (abortRecipe != null && abortRecipe.Value != this.AbortRecipePath)
- {
- abortRecipe.Value = this.AbortRecipePath;
- ChangedSelectedFileName("AbortRecipe", this.AbortRecipePath);
- }
- StringParam pressAPCPID = Params.FirstOrDefault(x => x.Name == "Combination.PressAPCPID") as StringParam;
- if (pressAPCPID != null && pressAPCPID.Value != this.PressAPC)
- {
- pressAPCPID.Value = this.PressAPC;
- ChangedSelectedFileName("PressAPCPID", this.PressAPC);
- }
- StringParam tempCorrection = Params.FirstOrDefault(x => x.Name == "Combination.TempCorrection") as StringParam;
- if (tempCorrection != null && tempCorrection.Value != this.TempCorrection)
- {
- tempCorrection.Value = this.TempCorrection;
- ChangedSelectedFileName("TempCorrection", this.TempCorrection);
- }
- StringParam tempPID = Params.FirstOrDefault(x => x.Name == "Combination.TempPID") as StringParam;
- if (tempPID != null && tempPID.Value != this.TempPID)
- {
- tempPID.Value = this.TempPID;
- ChangedSelectedFileName("TempPID", this.TempPID);
- }
- StringParam profileCondition = Params.FirstOrDefault(x => x.Name == "Combination.ProfileCondition") as StringParam;
- if (profileCondition != null && profileCondition.Value != this.ProfileCondition)
- {
- profileCondition.Value = this.ProfileCondition;
- ChangedSelectedFileName("ProfileCondition", this.ProfileCondition);
- }
- StringParam n2PurgeMode = Params.FirstOrDefault(x => x.Name == "N2PurgeMode") as StringParam;
- if (n2PurgeMode != null && n2PurgeMode.Value != this.N2PurgeMode)
- {
- n2PurgeMode.Value = this.N2PurgeMode;
- ChangedSelectedFileName("N2PurgeMode", this.N2PurgeMode);
- }
- }
- }
- public override string ToString()
- {
- List<string> strList = new List<string>
- {
- $"SubRecipePath:{SubRecipePath}",
- $"AlarmRecipePath:{AlarmRecipePath}",
- $"AlarmCondition:{AlarmCondition}",
- $"LeakCheck:{LeakCheck}",
- $"AbortRecipePath:{AbortRecipePath}",
- $"PressAPC:{PressAPC}",
- $"TempCorrect:{TempCorrection}",
- $"TempPID:{TempPID}",
- $"ProfileCondition:{ProfileCondition}"
- };
- string toolType = (string)QueryDataClient.Instance.Service.GetConfig("System.SetUp.ToolType");
- if (toolType != null && "SIBCN" == toolType)
- {
- strList.Add($"N2PurgeMode:{N2PurgeMode}");
- }
- return string.Join(";", strList);
- }
- }
- public class AUXData : PropertyChangedBase
- {
- public delegate void ValueChangedEventHandler(object sender, SetValueEventArgs e);
- public event ValueChangedEventHandler ValueChangedEvent;
- public void OnValueChanged(SetValueEventArgs e)
- {
- if (ValueChangedEvent != null)
- {
- ValueChangedEvent(this, e);
- }
- }
- public bool IsSaved
- {
- get => SetValue.IsSaved && SetUnit.IsSaved && Rampng.IsSaved && RampngUnit.IsSaved && IsCheck.IsSaved && MaxValue.IsSaved && MinValue.IsSaved;
- }
- public bool UndoChanges()
- {
- Type type = this.GetType();
- PropertyInfo[] properties = type.GetProperties();
- foreach (var item in properties)
- {
- var obj = item.GetValue(this);
- if (obj is Param)
- {
- ((Param)obj).UndoChanges();
- }
- }
- return true;
- }
- public bool UndoChanges(AUXData oldAUXData)
- {
- Type type = this.GetType();
- PropertyInfo[] properties = type.GetProperties();
- Type oldType = oldAUXData.GetType();
- PropertyInfo[] oldProperties = oldType.GetProperties();
- foreach (var item in properties)
- {
- var oldprop = oldProperties.FirstOrDefault(x => x.Name == item.Name);
- if (oldprop != null)
- {
- var oldObj = oldprop.GetValue(oldAUXData);
- if (oldObj != null)
- {
- var obj = item.GetValue(this);
- if (obj is Param)
- {
- if (oldObj != null && ((Param)oldObj).IsSaved != ((Param)obj).IsSaved)
- ((Param)obj).UndoChanges();
- }
- }
- }
- }
- return true;
- }
- private void ParamIsSaved_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
- {
- if (e.PropertyName == nameof(Param.IsSaved))
- {
- NotifyOfPropertyChange("IsSaved");
- }
- else if (e.PropertyName == nameof(DoubleParam.Value))
- {
- if (sender is Param)
- {
- if (((Param)sender).IsSaved) return;
- SetValueEventArgs tempSetEventArgs = new SetValueEventArgs();
- tempSetEventArgs.Sender = this;
- tempSetEventArgs.ValueName = this.ControlName;
- tempSetEventArgs.PropertyName = ((Param)sender).Name;
- if (sender is DoubleParam)
- {
- tempSetEventArgs.PropertyValue = ((DoubleParam)sender).Value;
- OnValueChanged(tempSetEventArgs);
- }
- else if (sender is StringParam)
- {
- tempSetEventArgs.PropertyValue = ((StringParam)sender).Value;
- OnValueChanged(tempSetEventArgs);
- }
- else if (sender is BoolParam)
- {
- tempSetEventArgs.PropertyValue = ((BoolParam)sender).Value.ToString();
- OnValueChanged(tempSetEventArgs);
- }
- }
- }
- }
- private int _no;
- public int No
- {
- get => _no;
- set
- {
- _no = value;
- NotifyOfPropertyChange("No");
- }
- }
- private string _name;
- public string Name
- {
- get => _name;
- set
- {
- _name = value;
- NotifyOfPropertyChange("Name");
- }
- }
- public string _unit;
- public string Unit
- {
- get => _unit;
- set
- {
- _unit = value;
- NotifyOfPropertyChange("Unit");
- }
- }
- private string _displayName;
- public string DisplayName
- {
- get => _displayName;
- set
- {
- _displayName = value;
- NotifyOfPropertyChange("DisplayName");
- }
- }
- private string _controlName;
- public string ControlName
- {
- get => _controlName;
- set
- {
- _controlName = value;
- NotifyOfPropertyChange("ControlName");
- }
- }
- private DoubleParam _setValue;
- public DoubleParam SetValue
- {
- get => _setValue;
- set
- {
- if (_setValue != null)
- {
- _setValue.PropertyChanged -= ParamIsSaved_PropertyChanged;
- }
- _setValue = value;
- _setValue.PropertyChanged += ParamIsSaved_PropertyChanged;
- NotifyOfPropertyChange(nameof(SetValue));
- }
- }
- private StringParam _setUnit;// = "SLM";
- public StringParam SetUnit
- {
- get => _setUnit;
- set
- {
- if (_setUnit != null)
- {
- _setUnit.PropertyChanged -= ParamIsSaved_PropertyChanged;
- }
- _setUnit = value;
- _setUnit.PropertyChanged += ParamIsSaved_PropertyChanged;
- NotifyOfPropertyChange(nameof(SetUnit));
- }
- }
- private StringParam _rampngUnit = new StringParam() { Name = "RampngUnit", Value = "SLM" };// = "SLM";
- public StringParam RampngUnit
- {
- get => _rampngUnit;
- set
- {
- if (_rampngUnit != null)
- {
- _rampngUnit.PropertyChanged -= ParamIsSaved_PropertyChanged;
- }
- _rampngUnit = value;
- _rampngUnit.PropertyChanged += ParamIsSaved_PropertyChanged;
- NotifyOfPropertyChange("RampngUnit");
- }
- }
- private DoubleParam _rampng = new DoubleParam() { Name = "Rampng", Value = "0" };
- public DoubleParam Rampng
- {
- get => _rampng; set
- {
- if (_rampng != null)
- {
- _rampng.PropertyChanged -= ParamIsSaved_PropertyChanged;
- }
- _rampng = value;
- _rampng.PropertyChanged += ParamIsSaved_PropertyChanged;
- NotifyOfPropertyChange("Rampng");
- }
- }
- private string _alarmValue;
- public string AlarmValue
- {
- get => _alarmValue; set
- {
- _alarmValue = value;
- NotifyOfPropertyChange("AlarmValue");
- }
- }
- private DoubleParam _maxValue;
- public DoubleParam MaxValue
- {
- get => _maxValue; set
- {
- if (_maxValue != null)
- {
- _maxValue.PropertyChanged -= ParamIsSaved_PropertyChanged;
- }
- _maxValue = value;
- _maxValue.PropertyChanged += ParamIsSaved_PropertyChanged;
- NotifyOfPropertyChange("MaxValue");
- }
- }
- private DoubleParam _minValue;
- public DoubleParam MinValue
- {
- get => _minValue; set
- {
- if (_minValue != null)
- {
- _minValue.PropertyChanged -= ParamIsSaved_PropertyChanged;
- }
- _minValue = value;
- _minValue.PropertyChanged += ParamIsSaved_PropertyChanged;
- NotifyOfPropertyChange("MinValue");
- }
- }
- private BoolParam _isCheck;
- public BoolParam IsCheck
- {
- get => _isCheck;
- set
- {
- if (_isCheck != null)
- {
- _isCheck.PropertyChanged -= ParamIsSaved_PropertyChanged;
- }
- _isCheck = value;
- _isCheck.PropertyChanged += ParamIsSaved_PropertyChanged;
- NotifyOfPropertyChange("IsCheck");
- }
- }
- private bool _isEnable = true;
- public bool IsEnable
- {
- get => _isEnable;
- set
- {
- _isEnable = value;
- NotifyOfPropertyChange("IsEnable");
- }
- }
- }
- public class SetValueEventArgs : EventArgs
- {
- private Object _sender;
- public Object Sender
- {
- get => _sender;
- set
- {
- _sender = value;
- }
- }
- private string _valueName;
- public string ValueName
- {
- get => _valueName;
- set
- {
- _valueName = value;
- }
- }
- private string _propertyName;
- public string PropertyName
- {
- get => _propertyName;
- set
- {
- _propertyName = value;
- }
- }
- private string _propertyValue;
- public string PropertyValue
- {
- get => _propertyValue;
- set
- {
- _propertyValue = value;
- }
- }
- public SetValueEventArgs()
- {
- }
- }
- }
|