RecipeDataBase.cs 239 KB

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