RecipeDataBase.cs 237 KB

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