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