RecipeDataBase.cs 236 KB

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