123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039 |
- using Aitex.Core.Common.DeviceData;
- using Aitex.Core.Util;
- using Caliburn.Micro;
- using Caliburn.Micro.Core;
- using DocumentFormat.OpenXml.Bibliography;
- using DocumentFormat.OpenXml.Office2010.Excel;
- using FurnaceUI.Client.Dialog;
- using FurnaceUI.Common;
- using FurnaceUI.Models;
- using FurnaceUI.Views.Editors;
- using FurnaceUI.Views.Parameter;
- using MECF.Framework.Common.Communications;
- using MECF.Framework.Common.DataCenter;
- using MECF.Framework.Common.OperationCenter;
- using MECF.Framework.Common.RecipeCenter;
- using MECF.Framework.Common.Utilities;
- using MECF.Framework.UI.Client.CenterViews.Configs.SystemConfig;
- using MECF.Framework.UI.Client.CenterViews.Dialogs;
- using MECF.Framework.UI.Client.CenterViews.Editors.Recipe;
- using MECF.Framework.UI.Client.CenterViews.Parameter;
- using MECF.Framework.UI.Client.ClientBase;
- using OpenSEMI.ClientBase;
- using RecipeEditorLib.RecipeModel.Params;
- using SciChart.Core.Extensions;
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.Linq;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Input;
- namespace FurnaceUI.Views.Recipes
- {
- public class RecipeProcessEditViewModel : FurnaceUIViewModelBase
- {
- public string DefaultUnit { get; set; }
- public string ToolType { get; set; }
- public string _defaultUnit
- {
- get { return DefaultUnit + "/S"; }
- }
- #region MFCs
- [Subscription("PM1.MFC1.DeviceData")]
- public AITMfcData MFC1Data { get; set; }
- [Subscription("PM1.MFC2.DeviceData")]
- public AITMfcData MFC2Data { get; set; }
- [Subscription("PM1.MFC3.DeviceData")]
- public AITMfcData MFC3Data { get; set; }
- [Subscription("PM1.MFC4.DeviceData")]
- public AITMfcData MFC4Data { get; set; }
- [Subscription("PM1.MFC5.DeviceData")]
- public AITMfcData MFC5Data { get; set; }
- [Subscription("PM1.MFC6.DeviceData")]
- public AITMfcData MFC6Data { get; set; }
- [Subscription("PM1.MFC7.DeviceData")]
- public AITMfcData MFC7Data { get; set; }
- [Subscription("PM1.MFC8.DeviceData")]
- public AITMfcData MFC8Data { get; set; }
- [Subscription("PM1.MFC9.DeviceData")]
- public AITMfcData MFC9Data { get; set; }
- [Subscription("PM1.MFC10.DeviceData")]
- public AITMfcData MFC10Data { get; set; }
- [Subscription("PM1.MFC11.DeviceData")]
- public AITMfcData MFC11Data { get; set; }
- [Subscription("PM1.MFC12.DeviceData")]
- public AITMfcData MFC12Data { get; set; }
- [Subscription("PM1.MFC13.DeviceData")]
- public AITMfcData MFC13Data { get; set; }
- [Subscription("PM1.MFC14.DeviceData")]
- public AITMfcData MFC14Data { get; set; }
- [Subscription("PM1.MFC15.DeviceData")]
- public AITMfcData MFC15Data { get; set; }
- [Subscription("PM1.MFC16.DeviceData")]
- public AITMfcData MFC16Data { get; set; }
- [Subscription("PM1.MFC17.DeviceData")]
- public AITMfcData MFC17Data { get; set; }
- [Subscription("PM1.MFC31.DeviceData")]
- public AITMfcData MFC31Data { get; set; }
- [Subscription("PM1.MFC32.DeviceData")]
- public AITMfcData MFC32Data { get; set; }
- [Subscription("PM1.MFC51.DeviceData")]
- public AITMfcData MFC51Data { get; set; }
- [Subscription("PM1.MFM57.DeviceData")]
- public AITWaterFlowMeterData MFM57Flow { get; set; }
- [Subscription("PM1.MFM1.DeviceData")]
- public AITWaterFlowMeterData MFM1Flow { get; set; }
- #endregion
- [Subscription("PM1.EditRecipeStepNo")]
- public int EditRecipeStepNo { get; set; }
- [Subscription("PM1.EditRecipeName")]
- public string EditRecipeName { get; set; }
- [Subscription("PM1.EditRecipeStepName")]
- public string EditRecipeStepName { get; set; }
- private UIElement _parent;
- public void SetParent(UIElement parent)
- {
- _parent = parent;
- }
- private readonly RecipeProvider _recipeProvider = new RecipeProvider();
- private Dictionary<string, ObservableCollection<RecipeTemplateColumnBase>> RecipeTemplate;
- private Dictionary<string, string> TemperatureValues { get; set; } = new Dictionary<string, string>();
- public ObservableCollection<TempSetData> HeadLst { get; set; } = new ObservableCollection<TempSetData>();
- private RecipeDataBase _CurrentRecipe = new RecipeDataBase();
- public RecipeDataBase CurrentRecipe
- {
- get { return _CurrentRecipe; }
- set { _CurrentRecipe = value; this.NotifyOfPropertyChange(nameof(CurrentRecipe)); }
- }
- private bool _isStandbyChecked;
- public bool IsStandbyChecked
- {
- get => _isStandbyChecked;
- set
- {
- _isStandbyChecked = value;
- NotifyOfPropertyChange(nameof(IsStandbyChecked));
- }
- }
- private bool _isStandbyCheckedHide;
- public bool IsStandbyCheckedHide
- {
- get => _isStandbyCheckedHide;
- set
- {
- _isStandbyCheckedHide = value;
- NotifyOfPropertyChange(nameof(IsStandbyCheckedHide));
- }
- }
- private bool _isStandbyCheckedSelect = false;
- private bool _isStandbyEnabled;
- public bool IsStandbyEnabled
- {
- get => _isStandbyEnabled;
- set
- {
- _isStandbyEnabled = value;
- NotifyOfPropertyChange(nameof(IsStandbyEnabled));
- }
- }
- private bool _isCommandConditionEventEnabled;
- public bool IsCommandConditionEventEnabled
- {
- get => _isCommandConditionEventEnabled;
- set
- {
- _isCommandConditionEventEnabled = value;
- NotifyOfPropertyChange(nameof(IsCommandConditionEventEnabled));
- }
- }
- private Visibility _isProcessVisibility = Visibility.Visible;
- public Visibility IsProcessVisibility
- {
- get => _isProcessVisibility;
- set
- {
- _isProcessVisibility = value;
- NotifyOfPropertyChange(nameof(IsProcessVisibility));
- }
- }
- private string _selectBtnName;
- public string SelectBtnName
- {
- get { return _selectBtnName; }
- set { _selectBtnName = value; this.NotifyOfPropertyChange(nameof(SelectBtnName)); }
- }
- private Step _selectedRecipeStep = null;
- public Step SelectedRecipeStep
- {
- get => _selectedRecipeStep;
- set
- {
- _selectedRecipeStep = value;
- NotifyOfPropertyChange(nameof(SelectedRecipeStep));
- }
- }
- private int _IndexNoDefault = 0;
- public int IndexNoDefault
- {
- get { return _IndexNoDefault; }
- set
- {
- _IndexNoDefault = value;
- NotifyOfPropertyChange(nameof(IndexNoDefault));
- }
- }
- public string SelectedStepName { get; set; }
- private int _selectIndex = 0;
- public int SelectIndex
- {
- get { return _selectIndex; }
- set
- {
- _selectIndex = value;
- NotifyOfPropertyChange(nameof(SelectIndex));
- }
- }
- private bool _appendStepItemIsEnabled;
- public bool AppendStepItemIsEnabled
- {
- get => _appendStepItemIsEnabled;
- set
- {
- _appendStepItemIsEnabled = value;
- NotifyOfPropertyChange(nameof(AppendStepItemIsEnabled));
- }
- }
- private bool _overWriteCopyIsEnabled;
- public bool OverWriteCopyIsEnabled
- {
- get => _overWriteCopyIsEnabled;
- set
- {
- _overWriteCopyIsEnabled = value;
- NotifyOfPropertyChange(nameof(OverWriteCopyIsEnabled));
- }
- }
- private bool _insertCopyIsEnabled;
- public bool InsertCopyIsEnabled
- {
- get => _insertCopyIsEnabled;
- set
- {
- _insertCopyIsEnabled = value;
- NotifyOfPropertyChange(nameof(InsertCopyIsEnabled));
- }
- }
- private bool _prevStepOverwriteIsEnabled;
- public bool PrevStepOverwriteIsEnabled
- {
- get => _prevStepOverwriteIsEnabled;
- set
- {
- _prevStepOverwriteIsEnabled = value;
- NotifyOfPropertyChange(nameof(PrevStepOverwriteIsEnabled));
- }
- }
- private bool _prevStepInsertIsEnabled;
- public bool PrevStepInsertIsEnabled
- {
- get => _prevStepInsertIsEnabled;
- set
- {
- _prevStepInsertIsEnabled = value;
- NotifyOfPropertyChange(nameof(PrevStepInsertIsEnabled));
- }
- }
- private bool _prevStepItemIsEnabled;
- public bool PrevStepItemIsEnabled
- {
- get => _prevStepItemIsEnabled;
- set
- {
- _prevStepItemIsEnabled = value;
- NotifyOfPropertyChange(nameof(PrevStepItemIsEnabled));
- }
- }
- private bool _currStepDeleteIsEnabled;
- public bool CurrStepDeleteIsEnabled
- {
- get => _currStepDeleteIsEnabled;
- set
- {
- _currStepDeleteIsEnabled = value;
- NotifyOfPropertyChange(nameof(CurrStepDeleteIsEnabled));
- }
- }
- private bool _multStepsDeleteIsEnabled;
- public bool MultStepsDeleteIsEnabled
- {
- get => _multStepsDeleteIsEnabled;
- set
- {
- _multStepsDeleteIsEnabled = value;
- NotifyOfPropertyChange(nameof(MultStepsDeleteIsEnabled));
- }
- }
- private bool _settingButtonEnable = true;
- public bool SettingButtonEnable
- {
- get => _settingButtonEnable;
- set
- {
- _settingButtonEnable = value;
- NotifyOfPropertyChange(nameof(SettingButtonEnable));
- }
- }
- private string _eventSetting;
- public string EventSetting
- {
- get => _eventSetting;
- set
- {
- _eventSetting = value;
- NotifyOfPropertyChange(nameof(EventSetting));
- }
- }
- public bool IsEnable => CGlobal.RecipeProcessEditViewEnable;//是否是View模式
- RecipeTempSetViewModel recipeTempSetViewModel = null;
- #region"Loader Set Value"
- private Visibility _loaderSet3SpeedVisibility = Visibility.Hidden;
- public Visibility LoaderSet3SpeedVisibility
- {
- get => _loaderSet3SpeedVisibility;
- set
- {
- _loaderSet3SpeedVisibility = value;
- NotifyOfPropertyChange(nameof(LoaderSet3SpeedVisibility));
- }
- }
- private Visibility _loaderSetSpeedVisibility = Visibility.Hidden;
- public Visibility LoaderSetSpeedVisibility
- {
- get => _loaderSetSpeedVisibility;
- set
- {
- _loaderSetSpeedVisibility = value;
- NotifyOfPropertyChange(nameof(LoaderSetSpeedVisibility));
- }
- }
- private Visibility _loaderSetSpeedFloatVisibility = Visibility.Hidden;
- public Visibility LoaderSetSpeedFloatVisibility
- {
- get => _loaderSetSpeedFloatVisibility;
- set
- {
- _loaderSetSpeedFloatVisibility = value;
- NotifyOfPropertyChange(nameof(LoaderSetSpeedFloatVisibility));
- }
- }
- public bool CommandBtnVisibility
- {
- get
- {
- return GetCommandBtnVisibility();
- }
- set { }
- }
- public bool CommandBtnHeight
- {
- get
- {
- return !CommandBtnVisibility;
- }
- set { }
- }
- private bool GetCommandBtnVisibility()
- {
- List<string> noNeedEndRecipeType = new List<string>() {
- "reset"
- };
- var isContainsType = noNeedEndRecipeType.Contains(CurrentRecipe.PrefixPath.Split('\\').LastOrDefault());
- if (null == CurrentRecipe || string.IsNullOrEmpty(CurrentRecipe.PrefixPath) || isContainsType)
- {
- return false;
- }
- return true;
- }
- public void SetShowLoaderValuePanel(string selectedCmd)
- {
- switch (selectedCmd)
- {
- case "Boat Load":
- case "Boat Unload":
- LoaderSet3SpeedVisibility = Visibility.Visible;
- LoaderSetSpeedVisibility = Visibility.Hidden;
- LoaderSetSpeedFloatVisibility = Visibility.Hidden;
- break;
- case "Boat Rotate":
- LoaderSet3SpeedVisibility = Visibility.Hidden;
- LoaderSetSpeedVisibility = Visibility.Hidden;
- LoaderSetSpeedFloatVisibility = Visibility.Visible;
- break;
- case "Boat CAP2":
- LoaderSet3SpeedVisibility = Visibility.Hidden;
- LoaderSetSpeedVisibility = Visibility.Visible;
- LoaderSetSpeedFloatVisibility = Visibility.Hidden;
- break;
- case "Stop(Include R-axis)":
- case "Boat Rotate Stop":
- case "Boat Loader Home":
- case "None":
- case "NONE":
- LoaderSet3SpeedVisibility = Visibility.Hidden;
- LoaderSetSpeedVisibility = Visibility.Hidden;
- LoaderSetSpeedFloatVisibility = Visibility.Hidden;
- break;
- default:
- break;
- }
- }
- //public void SetLoaderValue(string selectedCmd, string Values)
- //{
- // switch (selectedCmd)
- // {
- // case "Boat Load":
- // case "Boat Unload":
- // if (string.IsNullOrEmpty(Values)) return;
- // string[] list = Values.Split(';');
- // if (list.Length < 3) return;
- // Loader3Speed1 = int.Parse(list[0]);
- // Loader3Speed2 = int.Parse(list[1]);
- // Loader3Speed3 = int.Parse(list[2]);
- // break;
- // case "Boat Rotate":
- // if (string.IsNullOrEmpty(Values)) return;
- // LoaderFloatRPM = double.Parse(Values);
- // break;
- // case "Boat CAP2":
- // if (string.IsNullOrEmpty(Values)) return;
- // LoaderSpeed = int.Parse(Values);
- // break;
- // case "Stop(Include R-axis)":
- // case "Boat Rotate Stop":
- // case "Boat Loader Home":
- // case "None":
- // break;
- // default:
- // break;
- // }
- //}
- //public string GetSaveLoaderValue(string selectedCmd)
- //{
- // switch (selectedCmd)
- // {
- // case "Boat Load":
- // case "Boat Unload":
- // return $"{Loader3Speed1};{Loader3Speed2};{Loader3Speed3}";
- // case "Boat Rotate":
- // return LoaderFloatRPM.ToString();
- // case "Boat CAP2":
- // return LoaderSpeed.ToString();
- // case "Stop(Include R-axis)":
- // case "Boat Rotate Stop":
- // case "Boat Loader Home":
- // case "None":
- // return "";
- // default:
- // return "";
- // }
- //}
- private void ClearLoaderSetValue()
- {
- if (SelectedRecipeStep != null)
- {
- SelectedRecipeStep.LoaderSpeed1.Value = "0";
- SelectedRecipeStep.LoaderSpeed1.IsSaved = true;
- SelectedRecipeStep.LoaderSpeed2.Value = "0";
- SelectedRecipeStep.LoaderSpeed2.IsSaved = true;
- SelectedRecipeStep.LoaderSpeed3.Value = "0";
- SelectedRecipeStep.LoaderSpeed3.IsSaved = true;
- SelectedRecipeStep.LoaderRPM.Value = "0";
- SelectedRecipeStep.LoaderRPM.IsSaved = true;
- }
- }
- #endregion
- #region"PressVisibility"
- private Visibility _pressVisibility = Visibility.Hidden;
- public Visibility PressVisibility
- {
- get => _pressVisibility;
- set
- {
- _pressVisibility = value;
- NotifyOfPropertyChange(nameof(PressVisibility));
- }
- }
- private Visibility _pressSlowVacVisibility = Visibility.Hidden;
- public Visibility PressSlowVacVisibility
- {
- get => _pressSlowVacVisibility;
- set
- {
- _pressSlowVacVisibility = value;
- NotifyOfPropertyChange(nameof(PressSlowVacVisibility));
- }
- }
- private Visibility _pressValveAngleVisibility = Visibility.Hidden;
- public Visibility PressValveAngleVisibility
- {
- get => _pressValveAngleVisibility;
- set
- {
- _pressValveAngleVisibility = value;
- NotifyOfPropertyChange(nameof(PressValveAngleVisibility));
- }
- }
- private Visibility _pressWaitVisibility = Visibility.Hidden;
- public Visibility PressWaitVisibility
- {
- get => _pressWaitVisibility;
- set
- {
- _pressWaitVisibility = value;
- NotifyOfPropertyChange(nameof(PressWaitVisibility));
- }
- }
- public void SetShowPressPanel(string selectedCmd)
- {
- if (!"Valve Angle".Equals(selectedCmd))
- {
- SelectedRecipeStep.PressValveAngleSet.Value = "0";
- }
- switch (selectedCmd)
- {
- case "Press":
- case "Press2":
- case "Valve Angle":
- PressWaitBtnIsEnabled = true;
- break;
- default:
- PressWaitBtnIsEnabled = false;
- break;
- }
- PressWaitIsEnabled = false;
- switch (selectedCmd)
- {
- case "None":
- PressVisibility = Visibility.Hidden;
- PressSlowVacVisibility = Visibility.Hidden;
- PressValveAngleVisibility = Visibility.Hidden;
- PressWaitVisibility = Visibility.Hidden;
- break;
- case "Press":
- case "Press2":
- PressVisibility = Visibility.Visible;
- PressSlowVacVisibility = Visibility.Hidden;
- PressValveAngleVisibility = Visibility.Hidden;
- PressWaitVisibility = Visibility.Hidden;
- break;
- case "Slow Vac":
- PressVisibility = Visibility.Hidden;
- PressSlowVacVisibility = Visibility.Visible;
- PressValveAngleVisibility = Visibility.Hidden;
- PressWaitVisibility = Visibility.Hidden;
- break;
- case "Valve Angle":
- PressVisibility = Visibility.Hidden;
- PressSlowVacVisibility = Visibility.Hidden;
- PressValveAngleVisibility = Visibility.Visible;
- PressWaitVisibility = Visibility.Hidden;
- break;
- case "Full Open":
- case "Full Close":
- case "Hold":
- case "Zero Set":
- case "Cancel Zero":
- PressVisibility = Visibility.Hidden;
- PressSlowVacVisibility = Visibility.Hidden;
- PressValveAngleVisibility = Visibility.Hidden;
- PressWaitVisibility = Visibility.Hidden;
- break;
- case "WaitPressUp1":
- case "WaitPressDown1":
- case "WaitPressUp2":
- case "WaitPressDown2":
- PressVisibility = Visibility.Hidden;
- PressSlowVacVisibility = Visibility.Hidden;
- PressValveAngleVisibility = Visibility.Hidden;
- if (selectedCmd == "WaitPressUp1" || selectedCmd == "WaitPressDown1")
- {
- if (view1 != null)
- {
- view1.TxtPressWait.KeepDecimals = 3;
- }
- }
- else
- {
- if (view1 != null)
- {
- view1.TxtPressWait.KeepDecimals = 1;
- }
- }
- PressWaitVisibility = Visibility.Visible;
- PressWaitIsEnabled = true;
- break;
- default:
- break;
- }
- }
- //public void SetPressValue(string selectedCmd, string Values)
- //{
- // if (string.IsNullOrEmpty(Values))
- // {
- // if (selectedCmd == "None")
- // {
- // PressPID = "";
- // PressSet = 0f;
- // PressSlowVacSet = 0f;
- // PressValveAngleSet = 0f;
- // LowPressWait = "";
- // PressWait = 0f;
- // }
- // return;
- // }
- // string[] list = Values.Split(';');
- // if (list.Length < 4) return;
- // switch (selectedCmd)
- // {
- // case "None":
- // PressPID = "";
- // PressSet = 0f;
- // break;
- // case "Press":
- // case "Press2":
- // PressPID = list[0];
- // double.TryParse(list[1], out double pressSet);
- // PressSet = pressSet;
- // break;
- // case "Slow Vac":
- // double.TryParse(list[1], out double pressSlowVacSet);
- // PressSlowVacSet = pressSlowVacSet;
- // break;
- // case "Valve Angle":
- // double.TryParse(list[1], out double pressValveAngleSet);
- // PressValveAngleSet = pressValveAngleSet;
- // LowPressWait = list[2];
- // break;
- // case "Full Open":
- // case "Full Close":
- // case "Hold":
- // case "Zero Set":
- // case "Cancel Zero":
- // break;
- // case "WaitPressUp1":
- // case "WaitPressDown1":
- // case "WaitPressUp2":
- // case "WaitPressDown2":
- // double.TryParse(list[1], out double presswait);
- // PressWait = presswait;
- // break;
- // default:
- // break;
- // }
- //}
- //public string GetSavePressValue(string selectedCmd)
- //{
- // string[] pressStringList = new string[4] { "", "", "", "" };
- // pressStringList[0] = PressPID;
- // switch (selectedCmd)
- // {
- // case "Press":
- // case "Press2":
- // pressStringList[1] = PressSet.ToString();
- // break;
- // case "Slow Vac":
- // pressStringList[1] = PressSlowVacSet.ToString();
- // break;
- // case "Valve Angle":
- // pressStringList[1] = PressValveAngleSet.ToString();
- // pressStringList[2] = LowPressWait;
- // break;
- // case "Full Open":
- // case "Full Close":
- // case "Hold":
- // case "Zero Set":
- // case "Cancel Zero":
- // pressStringList[0] = "";
- // pressStringList[1] = "";
- // pressStringList[2] = "";
- // pressStringList[3] = "";
- // break;
- // case "WaitPressUp1":
- // case "WaitPressDown1":
- // case "WaitPressUp2":
- // case "WaitPressDown2":
- // pressStringList[1] = PressWait.ToString();
- // break;
- // default:
- // pressStringList[0] = "";
- // pressStringList[1] = "";
- // pressStringList[2] = "";
- // pressStringList[3] = "";
- // break;
- // }
- // return string.Join(";", pressStringList);
- //}
- //private string _pressPID;
- //public string PressPID
- //{
- // get => _pressPID;
- // set
- // {
- // _pressPID = value;
- // NotifyOfPropertyChange(nameof(PressPID));
- // }
- //}
- //private double _pressSet;
- //public double PressSet
- //{
- // get => _pressSet;
- // set
- // {
- // _pressSet = value;
- // NotifyOfPropertyChange(nameof(PressSet));
- // }
- //}
- //private double _pressSlowVacSet;
- //public double PressSlowVacSet
- //{
- // get => _pressSlowVacSet;
- // set
- // {
- // _pressSlowVacSet = value;
- // NotifyOfPropertyChange(nameof(PressSlowVacSet));
- // }
- //}
- //private double _pressValveAngleSet;
- //public double PressValveAngleSet
- //{
- // get => _pressValveAngleSet;
- // set
- // {
- // _pressValveAngleSet = value;
- // NotifyOfPropertyChange(nameof(PressValveAngleSet));
- // }
- //}
- //private string _lowPressWait;
- //public string LowPressWait
- //{
- // get => _lowPressWait;
- // set
- // {
- // _lowPressWait = value;
- // NotifyOfPropertyChange(nameof(LowPressWait));
- // }
- //}
- //private double _pressWait;
- //public double PressWait
- //{
- // get => _pressWait;
- // set
- // {
- // _pressWait = value;
- // NotifyOfPropertyChange(nameof(PressWait));
- // }
- //}
- //private void ClearPressSetValue()
- //{
- // if (SelectedRecipeStep != null)
- // {
- // SelectedRecipeStep.PressPID = "None";
- // SelectedRecipeStep.PressSet = 0;
- // SelectedRecipeStep.PressSlowVacSet = 0;
- // SelectedRecipeStep.PressValveAngleSet = "0";
- // SelectedRecipeStep.PressLowWait = "None";
- // SelectedRecipeStep.PressWait = 0;
- // }
- //}
- #endregion
- #region AlarmRecipe Visibility
- public bool IsAlarmReicpe => RecipeType.ToLower() == "alarm";
- public bool IsAbortReicpe => RecipeType.ToLower() == "abort";
- public bool IsSubReicpe => RecipeType.ToLower() == "sub";
- public bool IsTableVisibility => IsAlarmReicpe || IsAbortReicpe || IsSubReicpe;
- public bool IsRecipeHeaderVisibility => !IsTableVisibility;
- public bool IsVPDataListVisibility => !IsTableVisibility;
- public bool IsCombinationVisibility => !IsTableVisibility;
- #endregion
- private bool _pressWaitIsEnabled = false;
- public bool PressWaitIsEnabled
- {
- get => _pressWaitIsEnabled;
- set
- {
- _pressWaitIsEnabled = value;
- NotifyOfPropertyChange(nameof(PressWaitIsEnabled));
- }
- }
- private bool _pressWaitBtnIsEnabled = false;
- public bool PressWaitBtnIsEnabled
- {
- get => _pressWaitBtnIsEnabled;
- set
- {
- _pressWaitBtnIsEnabled = value;
- NotifyOfPropertyChange(nameof(PressWaitBtnIsEnabled));
- }
- }
- private void RefreshUpdate()
- {
- SetChangedStepRefreshUpdate();
- SetCmdIsEnabled();
- }
- private bool _noStandbyOrEndIsEnabled = false;
- public bool NoStandbyOrEndIsEnabled
- {
- get => _noStandbyOrEndIsEnabled;
- set
- {
- _noStandbyOrEndIsEnabled = value;
- NotifyOfPropertyChange(nameof(NoStandbyOrEndIsEnabled));
- }
- }
- private Visibility _standbyIsVisibility = Visibility.Visible;
- public Visibility StandbyIsVisibility
- {
- get => _standbyIsVisibility;
- set
- {
- _standbyIsVisibility = value;
- NotifyOfPropertyChange(nameof(StandbyIsVisibility));
- }
- }
- private void SetChangedStepRefreshUpdate()
- {
- if (CurrentRecipe.Steps == null || CurrentRecipe.Steps.Count < 1)
- {
- return;
- }
- var endName = "";
- if (SelectedRecipeStep.Name.Contains(":") && SelectedRecipeStep.Name.Split(':').Length > 1)
- {
- endName = SelectedRecipeStep.Name.Split(':')[1].Trim().ToLower();
- }
- else
- {
- endName = SelectedRecipeStep.Name.Trim().ToLower();
- }
- if (SelectedRecipeStep.Name == "Standby" || endName == "end")
- {
- NoStandbyOrEndIsEnabled = false;
- StandbyIsVisibility = Visibility.Visible;
- // LoaderSetSpeedFloatVisibility= Visibility.Hidden;
- // LoaderSet3SpeedVisibility= Visibility.Visible;
- // LoaderSetSpeedVisibility = Visibility.Hidden;
- }
- else
- {
- NoStandbyOrEndIsEnabled = true && SettingButtonEnable;
- StandbyIsVisibility = Visibility.Visible;
- }
- }
- private void SetCmdIsEnabled()
- {
- AppendStepItemIsEnabled = true;
- if (CurrentRecipe.Steps == null || CurrentRecipe.Steps.Count == 0 || SelectedRecipeStep.Name == "Standby" || (CurrentRecipe.RecipeChamberType == RecipeDataBase.ProcessType && SelectedRecipeStep == CurrentRecipe.Steps.LastOrDefault()))
- {
- AppendStepItemIsEnabled = false;
- OverWriteCopyIsEnabled = false;
- InsertCopyIsEnabled = false;
- PrevStepOverwriteIsEnabled = false;
- PrevStepInsertIsEnabled = false;
- PrevStepItemIsEnabled = false;
- CurrStepDeleteIsEnabled = false;
- MultStepsDeleteIsEnabled = false;
- }
- else
- {
- if (CurrentRecipe.RecipeChamberType == RecipeDataBase.ProcessType)
- {
- AppendStepItemIsEnabled = true;
- InsertCopyIsEnabled = true;
- PrevStepItemIsEnabled = false;
- SetCurrAndMultStepDeleteIsEnabled();
- if (CurrentRecipe.Steps[1].StepNo == SelectedRecipeStep.StepNo)
- {
- OverWriteCopyIsEnabled = true;
- PrevStepOverwriteIsEnabled = false;
- PrevStepInsertIsEnabled = false;
- }
- else
- {
- OverWriteCopyIsEnabled = true;
- PrevStepOverwriteIsEnabled = true;
- PrevStepInsertIsEnabled = true;
- }
- }
- else
- {
- AppendStepItemIsEnabled = true;
- OverWriteCopyIsEnabled = true;
- InsertCopyIsEnabled = true;
- PrevStepItemIsEnabled = false;
- SetCurrAndMultStepDeleteIsEnabled();
- if (CurrentRecipe.Steps[0].StepNo == SelectedRecipeStep.StepNo)
- {
- PrevStepOverwriteIsEnabled = false;
- PrevStepInsertIsEnabled = false;
- }
- else
- {
- PrevStepOverwriteIsEnabled = true;
- PrevStepInsertIsEnabled = true;
- }
- }
- //OverWriteCopyIsEnabled = true;
- //InsertCopyIsEnabled = true;
- //PrevStepOverwriteIsEnabled = true;
- //PrevStepInsertIsEnabled = true;
- //PrevStepItemIsEnabled = true;
- //CurrStepDeleteIsEnabled = true;
- //MultStepsDeleteIsEnabled = true;
- //if (CurrentRecipe.RecipeChamberType == RecipeDataBase.ProcessType)
- // if (CurrentRecipe.Steps[1].StepNo == SelectedRecipeStep.StepNo)
- // {
- // AppendStepItemIsEnabled = true;
- // OverWriteCopyIsEnabled = false;
- // InsertCopyIsEnabled = true;
- // PrevStepOverwriteIsEnabled = false;
- // PrevStepInsertIsEnabled = false;
- // PrevStepItemIsEnabled = false;
- // CurrStepDeleteIsEnabled = true;
- // MultStepsDeleteIsEnabled = true;
- // }
- // else
- // {
- // OverWriteCopyIsEnabled = true;
- // InsertCopyIsEnabled = true;
- // PrevStepOverwriteIsEnabled = true;
- // PrevStepInsertIsEnabled = true;
- // PrevStepItemIsEnabled = false;
- // CurrStepDeleteIsEnabled = true;
- // MultStepsDeleteIsEnabled = true;
- // }
- //else
- //{
- // if (CurrentRecipe.Steps[0].StepNo == SelectedRecipeStep.StepNo)
- // {
- // AppendStepItemIsEnabled = true;
- // OverWriteCopyIsEnabled = true;
- // InsertCopyIsEnabled = true;
- // PrevStepOverwriteIsEnabled = false;
- // PrevStepInsertIsEnabled = false;
- // PrevStepItemIsEnabled = false;
- // CurrStepDeleteIsEnabled = true;
- // MultStepsDeleteIsEnabled = true;
- // }
- // else
- // {
- // OverWriteCopyIsEnabled = true;
- // InsertCopyIsEnabled = true;
- // PrevStepOverwriteIsEnabled = true;
- // PrevStepInsertIsEnabled = true;
- // PrevStepItemIsEnabled = false;
- // CurrStepDeleteIsEnabled = true;
- // MultStepsDeleteIsEnabled = true;
- // }
- //}
- }
- IsCommandConditionEventEnabled = SettingButtonEnable;
- IsStandbyEnabled = SettingButtonEnable && (RecipeType.ToLower() == "process");
- }
- private void SetCurrAndMultStepDeleteIsEnabled()
- {
- if (CurrentRecipe.RecipeChamberType == "Process")
- {
- if ((CurrentRecipe.Steps.Count < 4))
- {
- CurrStepDeleteIsEnabled = false;
- MultStepsDeleteIsEnabled = false;
- }
- else
- {
- MultStepsDeleteIsEnabled = true;
- if (SelectedRecipeStep.Name == "Standby" || SelectedRecipeStep.Name == "End")
- {
- CurrStepDeleteIsEnabled = false;
- }
- else
- {
- CurrStepDeleteIsEnabled = true;
- }
- }
- }
- else
- {
- if ((CurrentRecipe.Steps.Count < 2))
- {
- CurrStepDeleteIsEnabled = false;
- MultStepsDeleteIsEnabled = false;
- }
- else
- {
- CurrStepDeleteIsEnabled = true;
- MultStepsDeleteIsEnabled = true;
- }
- }
- }
- private string _selectedGasSetting2;
- public string SelectedGasSetting2
- {
- get
- {
- return _selectedGasSetting2;
- }
- set
- {
- _selectedGasSetting2 = value;
- NotifyOfPropertyChange(nameof(SelectedGasSetting2));
- }
- }
- private string _selectedGasSetting3;
- public string SelectedGasSetting3
- {
- get
- {
- return _selectedGasSetting3;
- }
- set
- {
- _selectedGasSetting3 = value;
- NotifyOfPropertyChange(nameof(SelectedGasSetting3));
- }
- }
- private string _selectedGasSetting4;
- public string SelectedGasSetting4
- {
- get
- {
- return _selectedGasSetting4;
- }
- set
- {
- _selectedGasSetting4 = value;
- NotifyOfPropertyChange(nameof(SelectedGasSetting4));
- }
- }
- private string _selectedGasSetting5;
- public string SelectedGasSetting5
- {
- get
- {
- return _selectedGasSetting5;
- }
- set
- {
- _selectedGasSetting5 = value;
- NotifyOfPropertyChange(nameof(SelectedGasSetting5));
- }
- }
- private string _selectedGasSetting6;
- public string SelectedGasSetting6
- {
- get
- {
- return _selectedGasSetting6;
- }
- set
- {
- _selectedGasSetting6 = value;
- NotifyOfPropertyChange(nameof(SelectedGasSetting6));
- }
- }
- private List<ConfigNode> _ConfigNodes = new List<ConfigNode>();
- public List<ConfigNode> ConfigNodes
- {
- get { return _ConfigNodes; }
- set
- {
- _ConfigNodes = value;
- NotifyOfPropertyChange(nameof(ConfigNodes));
- }
- }
- //private ObservableCollection<MFCData> _mFCDatas = new ObservableCollection<MFCData>();
- //public ObservableCollection<TempSetData> TempList { get; set; } = new ObservableCollection<TempSetData>();
- //public ObservableCollection<MFCData> MFCDataList
- //{
- // get => _mFCDatas;
- // set
- // {
- // _mFCDatas = value;
- // NotifyOfPropertyChange(nameof(MFCDataList));
- // }
- //}
- private string _pressureUnit;
- public string PressureUnit
- {
- get => _pressureUnit;
- set
- {
- _pressureUnit = value;
- NotifyOfPropertyChange(nameof(PressureUnit));
- }
- }
- public string RecipeType { get; set; }
- private RecipeProcessEditView view1;
- public RecipeProcessEditViewModel(string strPrefixPath, string strRecipeName, string permission = "")
- {
- PumpDict.Clear();
- PumpDict.Add("DPR", "ValveAV91");
- PumpDict.Add("AGV", "AGVPump");
- PumpDict.Add("MBP", "BothPump");
- PumpDict.Add("DP", "AUCPump");
- PumpDict.Add("BWR", "ValveBWR");
- OtherPumpDict.Clear();
- OtherPumpDict.Add("F2Cln", "F2Cln");
- OtherPumpDict.Add("HFCln", "HFCln");
- OtherPumpDict.Add("HTR1", "HTR1");
- OtherPumpDict.Add("HTR2", "HTR2");
- OtherPumpDict.Add("HTR3", "HTR3");
- DefaultUnit = (string)QueryDataClient.Instance.Service.GetConfig($"PM1.APC.PressureUnit");
- RecipeTemplate = _recipeProvider.GetGroupRecipeTemplate();
- CurrentRecipe.PrefixPath = strPrefixPath;
- CurrentRecipe.Name = strRecipeName;
- CurrentRecipe.RecipePermission = permission;
- }
- protected override void OnViewLoaded(object view)
- {
- base.OnViewLoaded(view);
- view1 = (RecipeProcessEditView)view;
- }
- protected override void OnActivate()
- {
- base.OnActivate();
- InvokeClient.Instance.Service.DoOperation($"PM1.SetSensorRecipeOK", "");
- }
- protected override void OnDeactivate(bool close)
- {
- base.OnDeactivate(close);
- InvokeClient.Instance.Service.DoOperation($"PM1.SetSensorPROCManualOK", "");
- }
- protected override void OnInitialize()
- {
- base.OnInitialize();
- ToolType = (string)QueryDataClient.Instance.Service.GetConfig("System.SetUp.ToolType");
- // GetHeaderConfig();
- LoadData();
- RefreshUpdate();
- currentPage = GetcurrentPage();
- NewSteps = new ObservableCollection<Step>(CurrentRecipe.Steps.Take(pageSize * currentPage).Skip(pageSize * (currentPage - 1)));
- }
- private void LoadData()
- {
- if (RecipeType.ToLower() == "process" || RecipeType.ToLower() == "sub")
- {
- IsProcessVisibility = Visibility.Visible;
- }
- else
- {
- IsProcessVisibility = Visibility.Hidden;
- }
- CurrentRecipe.Clear();
- var recipeContent = _recipeProvider.LoadRecipe(CurrentRecipe.PrefixPath, CurrentRecipe.Name);
- if (string.IsNullOrEmpty(recipeContent))
- {
- System.Windows.MessageBox.Show($"{CurrentRecipe.PrefixPath}\\{CurrentRecipe.Name} is empty, please confirm the file is valid.");
- return;
- }
- // CurrentRecipe.RecipeChamberType = "OriginChamber";
- CurrentRecipe.InitData(CurrentRecipe.PrefixPath, CurrentRecipe.Name, recipeContent, "PM1");
- if (CurrentRecipe.Steps.Count > 0)
- {
- if (!string.IsNullOrEmpty(SelectedStepName))
- {
- //根据名称找到对应的Index
- var steps = CurrentRecipe.Steps.Where(p => SelectedStepName.EndsWith(p.Name)).FirstOrDefault();
- if (steps != null)
- {
- IndexNoDefault = CurrentRecipe.Steps.IndexOf(steps);
- }
- }
- if (CurrentRecipe.Steps.Count > IndexNoDefault)
- {
- SelectStep(CurrentRecipe.Steps[IndexNoDefault]);
- }
- }
- IsCommandConditionEventEnabled = true;
- PressureUnit = "(" + (string)QueryDataClient.Instance.Service.GetConfig("PM1.APC.PressureUnit") + ")";
- }
- public void SwitchPage(string page)
- {
- var windowManager = IoC.Get<IWindowManager>();
- switch (page)
- {
- case "GFCSetting":
- RecipeGasPanelSettingViewModel recipeGasPanelSettingViewModel = new RecipeGasPanelSettingViewModel
- {
- SelectedStepNo = SelectedRecipeStep.StepNo,
- SelectedStepName = $"{SelectedRecipeStep.StepNo}:{SelectedRecipeStep.Name}",
- CurrentRecipe = CurrentRecipe,
- SelectedStep = this.CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault()
- };
- recipeGasPanelSettingViewModel.ChangedStepEvent += RecipeGasPanelSettingViewModel_ChangedStepEvent;
- (windowManager as WindowManager)?.ShowDialogWithTitle(recipeGasPanelSettingViewModel, null, "Recipe Gas Panel Setting");
- break;
- }
- }
- private void RecipeGasPanelSettingViewModel_ChangedStepEvent(Step step)
- {
- SelectStep(step);
- }
- private Step OldStep;
- private Dictionary<string, string> PumpDict = new Dictionary<string, string>();
- private Dictionary<string, string> OtherPumpDict = new Dictionary<string, string>();
- public void SelectStep(object sender, object step)
- {
- var textBox = sender as UIElement;
- if (textBox != null)
- {
- Keyboard.Focus(textBox);
- }
- SelectStep(step);
- }
- public void SelectStep(object step)
- {
- if (step == null || !(step is Step))
- {
- return;
- }
- var step1 = (Step)step;
- var SelectedStep = this.CurrentRecipe.Steps.Where(x => x.StepNo == step1.StepNo).FirstOrDefault();
- if (OldStep != null && step1.StepNo != OldStep.StepNo)
- {
- var selectedOldStep = this.CurrentRecipe.Steps.Where(x => x.StepNo == OldStep.StepNo).FirstOrDefault();
- if (step1 != null && step1.TemperatureControlMode != null && !string.IsNullOrEmpty(step1.TemperatureControlMode.Value))
- {
- if (step1.TemperatureControlMode.Value.Contains("Profile"))
- {
- SelectBtnName = "Profile";
- }
- else
- {
- SelectBtnName = step1.TemperatureControlMode.Value;
- }
- }
- else
- {
- SelectBtnName = "";
- }
- //if (selectedOldStep != null)
- //{
- // selectedOldStep.LoaderValue = GetSaveLoaderValue(selectedOldStep.LoaderCommand);
- // selectedOldStep.PressValue = GetSavePressValue(selectedOldStep.PressCommand);
- //}
- }
- OldStep = step1;
- string strName = step1.Name == null ? step1.Name : step1.Name?.Trim();
- SelectedRecipeStep = SelectedStep;
- //if (SelectedRecipeStep.Name != EditRecipeStepName || SelectedRecipeStep.StepNo != step1.StepNo)
- //{
- SetShowLoaderValuePanel(SelectedRecipeStep.LoaderCommand.Value);
- SetShowPressPanel(SelectedRecipeStep.PressCommand.Value);
- InvokeClient.Instance.Service.DoOperation($"PM1.SetEditRecipeStepName", SelectedRecipeStep.Name);
- new Task(() =>
- {
- var selectedStep = step1;
- if (selectedStep.MFCSets != null && selectedStep.MFCSets.Count > 0)
- {
- Dictionary<string, string> dictMFC = new Dictionary<string, string>();
- foreach (var mfc in selectedStep.MFCSets)
- {
- dictMFC[mfc.ControlName] = $"{mfc.SetValue.Value};{mfc.Rampng.Value};{mfc.AlarmValue}";
- }
- InvokeClient.Instance.Service.DoOperation($"PM1.SetAllMfcVirtualValue", dictMFC);
- }
- if (selectedStep.ValveSets != null && selectedStep.ValveSets.Count > 0)
- {
- Dictionary<string, bool> dictValve = new Dictionary<string, bool>();
- foreach (var item in selectedStep.ValveSets)
- {
- if (PumpDict.ContainsKey(item.Name))
- {
- // dictValve[PumpDict[key]] = selectedStep.ValveSets[key] == "Open" ? true : false;
- }
- else if (OtherPumpDict.ContainsKey(item.Name))
- { }
- else
- {
- dictValve[item.Name] = item.Value;
- }
- }
- InvokeClient.Instance.Service.DoOperation($"PM1.SetAll{AITValveOperation.GVVirtualTurnValve}", dictValve);
- }
- }).Start();
- //if (selectedStep.TemperatureSets != null)
- //{
- // TempList.Clear();
- // selectedStep.TemperatureSets.ToList().ForEach(x => TempList.Add(x));
- //}
- //SetLoaderValue(selectedStep.LoaderCommand, selectedStep.LoaderValue);
- //SetPressValue(selectedStep.PressCommand, selectedStep.PressValue);
- //}
- RefreshUpdate();
- }
- #region"StepEdit"
- public Step selectStep { get; set; } = new Step();
- public void StepEdit(string stepEditCmd)
- {
- var windowManager = IoC.Get<IWindowManager>();
- switch (stepEditCmd)
- {
- case "Append":
- AppendStep2();
- break;
- case "InsertCopy":
- InsertCopyStep();
- break;
- case "OverWrite"://任何步骤的内容都可以覆盖到选定的步骤中
- OverWriteStep();
- break;
- case "PrevStepOverwrite"://用上一步的内容覆盖所选步骤
- PrevStepOverwriteStep();
- break;
- case "PrevStepInsert"://在选定步骤之前,插入带有前一步内容的新步骤。
- InsertPrevStep();
- break;
- case "PrevStepItem":
- break;
- case "CurrStepDelete":
- if (SelectedRecipeStep == null || CurrentRecipe == null)
- { return; }
- CurrDeleteStep();
- break;
- case "MultStepsDelete":
- RecipeStepDeleteDialogViewModel recipedeleteDialog = new RecipeStepDeleteDialogViewModel(CurrentRecipe);
- (windowManager as WindowManager)?.ShowDialogWithTitle(recipedeleteDialog, null, "Delete Recipe Step");
- IndexNoDefault = 0;
- if (CurrentRecipe.Steps.Count > 0)
- {
- selectStep = CurrentRecipe.Steps[0];
- }
- break;
- default:
- break;
- }
- // var totalPage = GetTotalPage();
- currentPage = GetcurrentPage();
- NewSteps = new ObservableCollection<Step>(CurrentRecipe.Steps.Take(pageSize * currentPage).Skip(pageSize * (currentPage - 1)));
- //currentPage = totalPage;
- if (selectStep != null && selectStep.StepNo >= 0)
- {
- SelectStep(selectStep);
- }
- }
- private void OverWriteStep()
- {
- var windowManager = IoC.Get<IWindowManager>();
- if (CurrentRecipe == null) return;
- RecipeStepSelectDialogViewModel recipeStepSelectDialogViewModel = new RecipeStepSelectDialogViewModel(CurrentRecipe);
- if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeStepSelectDialogViewModel, null, "Select Recipe Step"))
- {
- var tempStep = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
- CurrentRecipe.ShallowCopyStep(ref tempStep, recipeStepSelectDialogViewModel.SelectedStep);
- selectStep = SelectedRecipeStep;
- }
- }
- private void PrevStepOverwriteStep()
- {
- int index = -1;
- index = SelectedRecipeStep.StepNo;
- if (index > 1)
- {
- var setStep = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
- CurrentRecipe.ShallowCopyStep(ref setStep, CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo - 1).FirstOrDefault());
- selectStep = SelectedRecipeStep;
- }
- }
- public void CurrDeleteStep()
- {
- int index = -1;
- index = SelectedRecipeStep.StepNo;
- CurrentRecipe.Steps.Remove(CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault());
- if (CurrentRecipe.RecipeChamberType != RecipeDataBase.ProcessType)
- {
- for (int i = index; i < this.CurrentRecipe.Steps.Count + 1; i++)
- {
- this.CurrentRecipe.Steps[i - 1].StepNo = i;
- }
- }
- else
- {
- for (int i = index; i < this.CurrentRecipe.Steps.Count + 1; i++)
- {
- this.CurrentRecipe.Steps[i - 1].StepNo = i - 1;
- }
- }
- if (index > CurrentRecipe.Steps.Count - 1)
- {
- IndexNoDefault = CurrentRecipe.Steps.Count - 1;
- }
- else
- {
- IndexNoDefault = CurrentRecipe.Steps.IndexOf(CurrentRecipe.Steps.FirstOrDefault(x => x.StepNo == index));
- }
- if (CurrentRecipe != null && CurrentRecipe.Steps.Count > 0)
- {
- RefreshUpdate();
- selectStep = CurrentRecipe.Steps[IndexNoDefault];
- }
- }
- public void InsertPrevStep()
- {
- var foundPrevStep = this.CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo - 1).FirstOrDefault();
- var foundStep = this.CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
- if (foundPrevStep != null && foundStep != null)
- {
- var tempStep = CurrentRecipe.CreateStep();
- CurrentRecipe.CloneStep(ref tempStep, foundPrevStep);
- tempStep.StepNo = foundPrevStep.StepNo + 1;
- foreach (var item in this.CurrentRecipe.Steps)
- {
- if (item.StepNo >= tempStep.StepNo)
- {
- item.StepNo += 1;
- }
- }
- Step step = CurrentRecipe.Steps.FirstOrDefault(x => x.Name == "Standby");
- CurrentRecipe.SetDelegateEvent(tempStep);
- if (step == null)
- {
- this.CurrentRecipe.Steps.Insert(foundPrevStep.StepNo, tempStep);
- }
- else
- {
- this.CurrentRecipe.Steps.Insert(foundPrevStep.StepNo + 1, tempStep);
- }
- if (step == null)
- {
- IndexNoDefault = SelectedRecipeStep.StepNo - 1;
- }
- else
- {
- IndexNoDefault = SelectedRecipeStep.StepNo;
- }
- selectStep = CurrentRecipe.Steps[IndexNoDefault];
- }
- }
- private void AppendStep()
- {
- if (CurrentRecipe.RecipeChamberType == "Process")
- {
- var last = CurrentRecipe.Steps.LastOrDefault();
- CurrentRecipe.Steps.RemoveWhere(a => a.StepNo == last.StepNo);
- var newStep = CurrentRecipe.CreateStep();
- CurrentRecipe.Steps.Add(newStep);
- int TempSelectIndex = 0;
- Step step = CurrentRecipe.Steps.FirstOrDefault(x => x.Name == "Standby");
- for (int i = 0; i < this.CurrentRecipe.Steps.Count; i++)
- {
- if (step == null)
- {
- this.CurrentRecipe.Steps[i].StepNo = i + 1;
- }
- else
- {
- this.CurrentRecipe.Steps[i].StepNo = i;
- }
- TempSelectIndex = i;
- }
- IndexNoDefault = TempSelectIndex;
- last.StepNo = CurrentRecipe.Steps.LastOrDefault().StepNo + 1;
- CurrentRecipe.Steps.Add(last);
- selectStep = CurrentRecipe.Steps[newStep.StepNo - 1];
- }
- else
- {
- var newStep = CurrentRecipe.CreateStep();
- CurrentRecipe.Steps.Add(newStep);
- int TempSelectIndex = 0;
- Step step = CurrentRecipe.Steps.FirstOrDefault(x => x.Name == "Standby");
- for (int i = 0; i < this.CurrentRecipe.Steps.Count; i++)
- {
- if (step == null)
- {
- this.CurrentRecipe.Steps[i].StepNo = i + 1;
- }
- else
- {
- this.CurrentRecipe.Steps[i].StepNo = i;
- }
- TempSelectIndex = i;
- }
- IndexNoDefault = TempSelectIndex;
- selectStep = CurrentRecipe.Steps[TempSelectIndex];
- }
- }
- public void AppendStep2()
- {
- var foundStep = this.CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
- int foundIndex = this.CurrentRecipe.Steps.IndexOf(foundStep);
- if (foundStep != null)
- {
- var tempStep = CurrentRecipe.CreateStep();
- CurrentRecipe.CloneStep(ref tempStep, foundStep);
- tempStep.StepNo = foundStep.StepNo + 1;
- tempStep.Name = $"Name{tempStep.StepNo}";
- foreach (var item in this.CurrentRecipe.Steps)
- {
- if (item.StepNo >= tempStep.StepNo)
- {
- item.StepNo += 1;
- }
- }
- this.CurrentRecipe.Steps.Insert(foundIndex + 1, tempStep);
- selectStep = CurrentRecipe.Steps[foundIndex + 1];
- }
- }
- public void InsertCopyStep()
- {
- var windowManager = IoC.Get<IWindowManager>();
- if (CurrentRecipe == null) return;
- RecipeStepSelectDialogViewModel recipeStepSelectDialogViewModel = new RecipeStepSelectDialogViewModel(CurrentRecipe);
- if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeStepSelectDialogViewModel, null, "Select Recipe Step"))
- {
- var foundStep = this.CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
- if (foundStep != null)
- {
- var tempStep = CurrentRecipe.CreateStep();
- CurrentRecipe.CloneStep(ref tempStep, recipeStepSelectDialogViewModel.SelectedStep);
- tempStep.StepNo = foundStep.StepNo;
- int insertIndex = this.CurrentRecipe.Steps.IndexOf(foundStep);
- CurrentRecipe.SetDelegateEvent(tempStep);
- this.CurrentRecipe.Steps.Insert(insertIndex, tempStep);
- if (CurrentRecipe.RecipeChamberType != RecipeDataBase.ProcessType)
- {
- for (int i = tempStep.StepNo; i < this.CurrentRecipe.Steps.Count + 1; i++)
- {
- this.CurrentRecipe.Steps[i - 1].StepNo = i;
- }
- }
- else
- {
- for (int i = tempStep.StepNo; i < this.CurrentRecipe.Steps.Count; i++)
- {
- this.CurrentRecipe.Steps[i].StepNo = i;
- }
- }
- selectStep = CurrentRecipe.Steps[insertIndex];
- }
- }
- }
- #endregion
- public void RecipeSingMFCIsChangeClick(object value)
- {
- if (value is MFCData)
- {
- var mfc = value as MFCData;
- if (mfc.IsSaved)
- {
- if (DialogButton.Yes == DialogBox.ShowDialog(DialogButton.Yes | DialogButton.No,
- DialogType.CONFIRM,
- $"Recipe single MFC is changed Flag, do you want to save it?"))
- {
- mfc.FlagIsSaved = false;
- }
- }
- else
- {
- mfc.FlagIsSaved = true;
- mfc.UndoChanges();
- }
- }
- }
- //撤销修改
- public void RecipeIsChangeClick(object cmdName, object value)
- {
- if (value == null)
- return;
- var windowManager = IoC.Get<IWindowManager>();
- switch ((string)cmdName)
- {
- case "Alarm":
- ((Step)value).UndoAlarmChanges();
- break;
- case "MFC":
- ((Step)value).UndoMFCChanges();
- break;
- case "Gas":
- ((Step)value).UndoGasChanges();
- break;
- case "AUX":
- ((Step)value).UndoAUXChanges();
- break;
- case "Press":
- ((Step)value).UndoPressChanges();
- SetShowPressPanel(((Step)value).PressCommand.Value);
- break;
- case "Temp":
- ((Step)value).UndoTemperatureChanges();
- break;
- case "Loader":
- ((Step)value).UndoLoaderChanges();
- SetShowLoaderValuePanel(((Step)value).LoaderCommand.Value);
- break;
- default:
- break;
- }
- }
- public void TempSetClick(object sender)
- {
- string stSetValue = ShowNumberKeyboard(sender as Button, "", 1);
- if (stSetValue != "Cancel")
- {
- foreach (var item in SelectedRecipeStep.TemperatureSets)
- {
- item.SetValue.SetValue(stSetValue);
- }
- }
- }
- public void RampSetClick(object sender)
- {
- string strSetRamp = ShowNumberKeyboard(sender as Button, "", 1);
- if (strSetRamp != "Cancel")
- {
- foreach (var item in SelectedRecipeStep.TemperatureSets)
- {
- item.RampngValue.SetValue(strSetRamp);
- }
- }
- }
- private string ShowNumberKeyboard(Control control, string defaultValue, int keepDecimals = -1)
- {
- NumberKeyboard numberKeyboard = new NumberKeyboard("", defaultValue);
- numberKeyboard.KeepDecimals = keepDecimals;
- var point = control.PointFromScreen(new Point(0, 0));
- double wx = SystemParameters.WorkArea.Width;
- double hy = SystemParameters.WorkArea.Height;
- if (-point.Y + control.ActualHeight + 5 + numberKeyboard.Height < hy)
- {
- numberKeyboard.Top = -point.Y + control.ActualHeight + 5;
- }
- else
- {
- numberKeyboard.Top = -point.Y - numberKeyboard.Height - 5;
- }
- if (-point.X + numberKeyboard.Width < wx)
- {
- numberKeyboard.Left = -point.X;
- }
- else
- {
- numberKeyboard.Left = -point.X - (numberKeyboard.Width - control.ActualWidth);
- }
- if ((bool)numberKeyboard.ShowDialog())
- return numberKeyboard.ValueString;
- else
- return "Cancel";
- }
- private string GetTemperatureControlMode(string val)
- {
- if (string.IsNullOrEmpty(val) || !val.Contains("—"))
- {
- return val;
- }
- var temperatureControlModes = val.Split('—').ToList();
- SelectBtnName = temperatureControlModes.LastOrDefault();
- if (temperatureControlModes.Count == 1)
- {
- SelectBtnName = "";
- }
- return temperatureControlModes.FirstOrDefault();
- }
- public void TempTextClick(string type, object sender)
- {
- var windowManager = IoC.Get<IWindowManager>();
- switch (type)
- {
- case "Mode":
- RecipeTempModeViewModel recipeTempModeViewModel = new RecipeTempModeViewModel();
- recipeTempModeViewModel.CurrentRecipe = CurrentRecipe;
- recipeTempModeViewModel.SelectProfileTable = SelectedRecipeStep.TemperatureControlMode.Value;
- recipeTempModeViewModel.SelectBtnName = SelectBtnName;
- var rtn = (windowManager as WindowManager)?.ShowDialogWithTitle(recipeTempModeViewModel, null, "Temp Mode");
- if ((bool)rtn)
- {
- SelectBtnName = recipeTempModeViewModel.SelectBtnName;
- //SelectedRecipeStep.TemperatureControlMode.Value =recipeTempModeViewModel.ResultString;
- var foundStep = this.CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
- if (foundStep != null)
- {
- if (null != recipeTempModeViewModel && !string.IsNullOrEmpty(recipeTempModeViewModel.ResultString) && recipeTempModeViewModel.ResultString.Contains("Profile"))
- {
- SelectBtnName = "Profile";
- }
- foundStep.TemperatureControlMode.SetValue(recipeTempModeViewModel.ResultString);
- }
- }
- break;
- case "Correct":
- TempCorrectionEditViewModel tempCorrectionEditViewModel = new TempCorrectionEditViewModel();
- tempCorrectionEditViewModel.CurrentRecipe = CurrentRecipe;
- tempCorrectionEditViewModel.ResultString = SelectedRecipeStep.TemperatureCorrect.Value;
- tempCorrectionEditViewModel.IsEnabledControl = false;
- tempCorrectionEditViewModel.AutoSelectVisibility = Visibility.Visible;
- // tempOffsetTableViewModel.SelectedRecipeStep = SelectedRecipeStep;
- rtn = (windowManager as WindowManager)?.ShowDialogWithTitle(tempCorrectionEditViewModel, null, "Temp Correct Table");
- if ((bool)rtn)
- {
- // SelectedRecipeStep.TemperatureCorrect.Value = tempCorrectionEditViewModel.ResultString;
- var foundStep = this.CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
- if (foundStep != null)
- {
- foundStep.TemperatureCorrect.SetValue(tempCorrectionEditViewModel.ResultString);
- }
- }
- break;
- case "PID":
- TempOffsetTableViewModel tempOffsetTableViewModel1 = new TempOffsetTableViewModel();
- tempOffsetTableViewModel1.TempOffsetTableSelected = SelectedRecipeStep.TemperaturePID.Value;
- tempOffsetTableViewModel1.CurrentRecipe = CurrentRecipe;
- tempOffsetTableViewModel1.IsEnabledControl = false;
- tempOffsetTableViewModel1.SelectedRecipeStep = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
- rtn = (windowManager as WindowManager)?.ShowDialogWithTitle(tempOffsetTableViewModel1, null, "Temp PID Table");
- if ((bool)rtn)
- {
- // SelectedRecipeStep.TemperaturePID.Value = tempOffsetTableViewModel1.TempOffsetTableSelected;
- var foundStep = this.CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
- if (foundStep != null)
- {
- foundStep.TemperaturePID.SetValue(tempOffsetTableViewModel1.TempOffsetTableSelected);
- }
- }
- break;
- default:
- break;
- }
- }
- //public void TempTextChanged(string type, object sender, object item)
- //{
- // if (!string.IsNullOrEmpty(type) && item != null && sender != null)
- // {
- // TempSetData tempData = (TempSetData)item;
- // string value = ((TextBox)sender).Text;
- // int stepNo = SelectedRecipeStep.StepNo;
- // var step = CurrentRecipe.Steps.Where(x => x.StepNo == stepNo).FirstOrDefault();
- // if (step != null)
- // {
- // var tempValue = CurrentRecipe.Steps.Where(x => x.StepNo == stepNo).FirstOrDefault().TemperatureSets.Where(x => x.Name == tempData.Name).FirstOrDefault();
- // if (tempValue == null) return;
- // switch (type)
- // {
- // case "Value":
- // tempValue.SetValue.Value = value;
- // break;
- // case "Ramp":
- // tempValue.RampngValue.Value = value;
- // break;
- // default:
- // break;
- // }
- // }
- // }
- //}
- private bool isEditMFC = false;
- public void StepEdit(object cmdName, object value)
- {
- var windowManager = IoC.Get<IWindowManager>();
- switch ((string)cmdName)
- {
- case "StepName":
- RecipeStepNameViewModel recipeStepNameViewModel = new RecipeStepNameViewModel() { SelectedStepName = SelectedRecipeStep.Name };
- if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeStepNameViewModel, null, "Recipe Step Name"))
- {
- SelectedRecipeStep.Name = recipeStepNameViewModel.SelectedStepName;
- }
- break;
- case "StepTime":
- RecipeStepTimeViewModel recipeStepTimeViewModel = new RecipeStepTimeViewModel("StepTime");
- if (CurrentRecipe.Steps.Count > 0)
- {
- var timeValue = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().Time;
- recipeStepTimeViewModel.SelectTime = (timeValue == null || timeValue.Contains(':')) ? "Value" : timeValue;
- if (recipeStepTimeViewModel.SelectTime == "Value")
- {
- recipeStepTimeViewModel.SelectValueTime = timeValue;
- }
- (windowManager as WindowManager)?.ShowDialogWithTitle(recipeStepTimeViewModel, null, "Step Time Set");
- if (recipeStepTimeViewModel.IsSave)
- {
- CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().Time = recipeStepTimeViewModel.SelectTime;
- if (recipeStepTimeViewModel.SelectTime == "Value")
- {
- SelectedRecipeStep.Time = recipeStepTimeViewModel.SelectTime + ":" + recipeStepTimeViewModel.SelectValueTime;
- if (CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault() != null)
- {
- CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().Time = recipeStepTimeViewModel.SelectValueTime;
- }
- }
- else
- {
- SelectedRecipeStep.Time = recipeStepTimeViewModel.SelectTime + ":" + recipeStepTimeViewModel.RecipeStepTime[recipeStepTimeViewModel.SelectTime];
- }
- }
- }
- break;
- case "RecipeCommand":
- RecipeCommandViewModel recipeCommandViewModel = new RecipeCommandViewModel();
- ObservableCollection<ShowStep> loopStepNames = new ObservableCollection<ShowStep>(CurrentRecipe.Steps.OrderBy(x => x.StepNo).Where(x => x.StepNo < SelectedRecipeStep.StepNo && x.Name != "Standby").Select(x => new ShowStep() { StepNo = x.StepNo, StepName = x.Name }).ToList());
- ObservableCollection<ShowStep> jumpStepNames = new ObservableCollection<ShowStep>(CurrentRecipe.Steps.OrderBy(x => x.StepNo).Where(x => x.StepNo != SelectedRecipeStep.StepNo).Select(x => new ShowStep() { StepNo = x.StepNo, StepName = x.Name }).ToList());
- recipeCommandViewModel.LoopStepNames = loopStepNames;
- recipeCommandViewModel.JumpStepNames = jumpStepNames;
- recipeCommandViewModel.SelectedRecipeStep = SelectedRecipeStep;
- recipeCommandViewModel.SelectRecipeCommand = SelectedRecipeStep.Command;
- recipeCommandViewModel.RecipeData = CurrentRecipe;
- if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeCommandViewModel, null, "Recipe Command"))
- {
- SelectedRecipeStep.Command = recipeCommandViewModel.SelectRecipeCommand;
- CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().Command = SelectedRecipeStep.Command;
- }
- break;
- case "ConditionCheck":
- RecipeConditionCheckSetViewModel recipeConditionCheckSetViewModel = new RecipeConditionCheckSetViewModel();
- if (CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().ExternalSensor != null)
- {
- recipeConditionCheckSetViewModel.RecipeConditions.ExternalSensor = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().ExternalSensor;
- }
- var step = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
- if (step != null)
- {
- recipeConditionCheckSetViewModel.RecipeConditions.TempStabizeSelected = step.TempStabilizeSelected;
- recipeConditionCheckSetViewModel.RecipeConditions.FinishAutoProfile = step.FinishAutoProfile;
- recipeConditionCheckSetViewModel.RecipeConditions.ReachTemp = step.ReachTemp;
- recipeConditionCheckSetViewModel.RecipeConditions.ReachTempValue = step.ReachTempValue;
- recipeConditionCheckSetViewModel.RecipeConditions.O2Density = step.O2Density;
- recipeConditionCheckSetViewModel.RecipeConditions.O2DensityValue = step.O2DensityValue;
- recipeConditionCheckSetViewModel.RecipeConditions.ReachPressure = step.ReachPressure;
- recipeConditionCheckSetViewModel.RecipeConditions.ReachPressureVG = step.ReachPressureVG;
- recipeConditionCheckSetViewModel.RecipeConditions.ReachPressureValue = step.ReachPressureValue;
- recipeConditionCheckSetViewModel.RecipeConditions.PressureStabilizeVG = step.PressureStabilizeVG;
- recipeConditionCheckSetViewModel.RecipeConditions.PressureStabilizeSelected = step.PressureStabilizeSelected;
- recipeConditionCheckSetViewModel.RecipeConditions.ProcessTimeToEnd = step.ProcessTimeToEnd;
- }
- var result = (windowManager as WindowManager)?.ShowDialogWithTitle(recipeConditionCheckSetViewModel, null, "Condition Check");
- if (recipeConditionCheckSetViewModel.IsSave)
- {
- if (recipeConditionCheckSetViewModel.IsNone)
- {
- CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().IsnoneConditionCheck = true;
- }
- else
- {
- CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().IsnoneConditionCheck = false;
- }
- CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().ExternalSensor = recipeConditionCheckSetViewModel.RecipeConditions.ExternalSensor;
- CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().ExternalSensorName = recipeConditionCheckSetViewModel.RecipeConditions.ExternalSensorName;
- CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().TempStabilizeSelected = recipeConditionCheckSetViewModel.RecipeConditions.TempStabizeSelected;
- CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().FinishAutoProfile = recipeConditionCheckSetViewModel.RecipeConditions.FinishAutoProfile;
- CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().ReachTemp = recipeConditionCheckSetViewModel.RecipeConditions.ReachTemp;
- CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().ReachTempValue = recipeConditionCheckSetViewModel.RecipeConditions.ReachTempValue;
- CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().O2Density = recipeConditionCheckSetViewModel.RecipeConditions.O2Density;
- CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().O2DensityValue = recipeConditionCheckSetViewModel.RecipeConditions.O2DensityValue;
- CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().ReachPressure = recipeConditionCheckSetViewModel.RecipeConditions.ReachPressure;
- CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().ReachPressureVG = recipeConditionCheckSetViewModel.RecipeConditions.ReachPressureVG;
- CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().PressureStabilizeVG = recipeConditionCheckSetViewModel.RecipeConditions.PressureStabilizeVG;
- CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().ReachPressureValue = recipeConditionCheckSetViewModel.RecipeConditions.ReachPressureValue;
- CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().PressureStabilizeSelected = recipeConditionCheckSetViewModel.RecipeConditions.PressureStabilizeSelected;
- CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().ProcessTimeToEnd = recipeConditionCheckSetViewModel.RecipeConditions.ProcessTimeToEnd;
- }
- if (recipeConditionCheckSetViewModel.IsNone)//不存数据处理
- { }
- break;
- case "AlarmAction":
- Combination combination = new Combination(CurrentRecipe.ConfigItems);
- AlarmConditionEditViewModel alarmConditionViewModel = new AlarmConditionEditViewModel($"Parameter\\AlarmCondition", combination.AlarmCondition, SelectedRecipeStep.AlarmConditionTable.Value);
- alarmConditionViewModel.IsEnableEdit = false;
- alarmConditionViewModel.RecipeType = CurrentRecipe.RecipeChamberType;
- if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(alarmConditionViewModel, null, "Alarm Action"))
- {
- CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().AlarmConditionTable.SetValue(alarmConditionViewModel.ReturnString);
- }
- //RecipeAlarmActionViewModel recipeAlarmActionViewModel = new RecipeAlarmActionViewModel
- //{
- // CurrentRecipe = CurrentRecipe,
- // CurrentStepName = SelectedRecipeStep.Name,
- // TableIndex = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().AlarmTableIndex,
- // AlarmActions = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().AlarmActionSets
- //};
- //if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeAlarmActionViewModel, null, "Alarm Action"))
- //{
- // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().AlarmTableIndex = recipeAlarmActionViewModel.TableIndex;
- // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().AlarmActionSets = recipeAlarmActionViewModel.AlarmActions;
- //}
- break;
- case "TempSetting":
- if (recipeTempSetViewModel is null)
- {
- recipeTempSetViewModel = new RecipeTempSetViewModel
- {
- RecipeTemplate = RecipeTemplate
- };
- }
- if (CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().TemperatureSets != null)
- {
- var tempSets = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
- recipeTempSetViewModel.TemperatureValues = tempSets.TemperatureSets;
- //tempSets.TemperatureSets.ToList().ForEach(x => recipeTempSetViewModel.TemperatureValues.Add(x));
- }
- recipeTempSetViewModel.StepType = SelectedRecipeStep.Name;
- recipeTempSetViewModel.RecipeType = RecipeType;
- if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeTempSetViewModel, null, "Temp Detail"))
- {
- if (recipeTempSetViewModel.TemperatureValues != null && recipeTempSetViewModel.TemperatureValues.Count > 0 && recipeTempSetViewModel.IsSave)
- {
- if (CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().TemperatureSets != null)
- {
- // var tempSets = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
- // tempSets.TemperatureSets = recipeTempSetViewModel.TempSetDataList;
- }
- }
- }
- break;
- case "GASSetting":
- RecipeMFCSettingViewModel recipeMFCSettingViewModel = new RecipeMFCSettingViewModel();
- //InvokeClient.Instance.Service.DoOperation($"PM1.SetSensorRecipeOK", "");
- recipeMFCSettingViewModel.MFCSets = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().MFCSets;
- //recipeGASSettingViewModel.MFMSets = new MFMValue() { AlarmValue = tempMFMSets.AlarmValue, IsNotifying = tempMFMSets.IsNotifying, Name = tempMFMSets.Name, Value = tempMFMSets.Value };
- recipeMFCSettingViewModel.RecipeType = RecipeType;
- recipeMFCSettingViewModel.RecipeTemplate = RecipeTemplate;
- if (!(bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeMFCSettingViewModel, null, "MFC Detail"))
- {
- //InvokeClient.Instance.Service.DoOperation($"PM1.SetSensorPROCManualOK", "");
- return;
- }
- //InvokeClient.Instance.Service.DoOperation($"PM1.SetSensorPROCManualOK", "");
- if (CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().MFCSets != null)
- {
- if (recipeMFCSettingViewModel.MFCSets != null && recipeMFCSettingViewModel.MFCSets.Count > 0)
- {
- CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().MFCSets = recipeMFCSettingViewModel.MFCSets;
- UpdateMFCShow();
- }
- }
- break;
- case "PressureSetting":
- RecipePressureSettingViewModel recipePressureSettingViewModel = new RecipePressureSettingViewModel();
- var tempStep = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
- // recipePressureSettingViewModel.PressureSonsorValue = tempStep.PressureSonserValue;
- // recipePressureSettingViewModel.PressureValveAngleValue = tempStep.PressureValveAngle;
- // recipePressureSettingViewModel.PressureSettingVG = tempStep.PressureSettingVG;
- //if (!string.IsNullOrEmpty(tempStep.PressureAlarmTableNo))
- //{
- // if (tempStep.PressureAlarmTableNo.ToLower() == "none")
- // recipePressureSettingViewModel.PressureAlarmWatchTable = "None";
- // else
- // recipePressureSettingViewModel.PressureAlarmWatchTable = tempStep.PressureAlarmTableNo;
- //}
- //if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipePressureSettingViewModel, null, "Recipe Pressure Setting"))
- //{
- // if (CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault() != null)
- // {
- // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().PressureSonserValue = recipePressureSettingViewModel.PressureSonsorValue;
- // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().PressureValveAngle = recipePressureSettingViewModel.PressureValveAngleValue;
- // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().PressureAlarmTableNo = recipePressureSettingViewModel.PressureAlarmWatchTable;
- // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().PressureSettingVG = recipePressureSettingViewModel.PressureSettingVG;
- // // SelectedRecipeStep.PressureSonserValue = $"{recipePressureSettingViewModel.PressureSonsorValue}";
- // }
- //}
- break;
- case "RFSetting":
- //RecipeRFPressureSettingViewModel recipeRFPressureSettingViewModel = new RecipeRFPressureSettingViewModel();
- //var tempRecipeStep = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
- //recipeRFPressureSettingViewModel.RFSwitch = tempRecipeStep.RFSwitch;
- //recipeRFPressureSettingViewModel.RFSetPointValue = tempRecipeStep.RFSetpoint;
- //recipeRFPressureSettingViewModel.C1SetPointValue = tempRecipeStep.C1Setpoint;
- //recipeRFPressureSettingViewModel.C2SetPointValue = tempRecipeStep.C2Setpoint;
- //recipeRFPressureSettingViewModel.ForwardPowerAlarmWatchSetPointValue = tempRecipeStep.ForwardPowerAlarmWatchTable;
- //recipeRFPressureSettingViewModel.PrAlarmWatchSetPointValue = tempRecipeStep.PrAlarmWatchTable;
- //recipeRFPressureSettingViewModel.PIAlarmWatchSetPointValue = tempRecipeStep.PIAlarmWatchTable;
- //recipeRFPressureSettingViewModel.C1AlarmWatchSetPointValue = tempRecipeStep.C1AlarmWatchTable;
- //recipeRFPressureSettingViewModel.C2AlarmWatchSetPointValue = tempRecipeStep.C2AlarmWatchTable;
- //recipeRFPressureSettingViewModel.VppAlarmWatchSetPointValue = tempRecipeStep.VppAlarmWatchTable;
- //recipeRFPressureSettingViewModel.VdcAlarmWatchSetPointValue = tempRecipeStep.VdcAlarmWatchTable;
- //if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeRFPressureSettingViewModel, null, "Recipe RF Setting"))
- //{
- // if (CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault() != null)
- // {
- // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().RFSwitch = recipeRFPressureSettingViewModel.RFSwitch;
- // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().RFSetpoint = recipeRFPressureSettingViewModel.RFSetPointValue;
- // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().C1Setpoint = recipeRFPressureSettingViewModel.C1SetPointValue;
- // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().C2Setpoint = recipeRFPressureSettingViewModel.C2SetPointValue;
- // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().ForwardPowerAlarmWatchTable = recipeRFPressureSettingViewModel.ForwardPowerAlarmWatchSetPointValue;
- // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().PrAlarmWatchTable = recipeRFPressureSettingViewModel.PrAlarmWatchSetPointValue;
- // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().PIAlarmWatchTable = recipeRFPressureSettingViewModel.PIAlarmWatchSetPointValue;
- // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().C1AlarmWatchTable = recipeRFPressureSettingViewModel.C1AlarmWatchSetPointValue;
- // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().C2AlarmWatchTable = recipeRFPressureSettingViewModel.C2AlarmWatchSetPointValue;
- // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().VppAlarmWatchTable = recipeRFPressureSettingViewModel.VppAlarmWatchSetPointValue;
- // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().VdcAlarmWatchTable = recipeRFPressureSettingViewModel.VdcAlarmWatchSetPointValue;
- // // SelectedRecipeStep.RFSetting = $"{recipeRFPressureSettingViewModel.RFSetPointValue}";
- // }
- //}
- break;
- case "Loader":
- RecipeLoaderCommandViewModel recipeLoaderCommandViewModel = new RecipeLoaderCommandViewModel();
- tempStep = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
- recipeLoaderCommandViewModel.SelectedCmd = tempStep.LoaderCommand.Value;
- if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeLoaderCommandViewModel, null, "Loader Command"))
- {
- if (tempStep.LoaderCommand.Value != recipeLoaderCommandViewModel.ReturnString)
- {
- ClearLoaderSetValue();
- }
- tempStep.LoaderCommand.SetValue(recipeLoaderCommandViewModel.ReturnString);
- SelectedRecipeStep.LoaderCommand.SetValue(recipeLoaderCommandViewModel.ReturnString);
- SetShowLoaderValuePanel(recipeLoaderCommandViewModel.ReturnString);
- }
- break;
- case "Pressure":
- RecipePressCommandViewModel recipePressCommandViewModel = new RecipePressCommandViewModel();
- tempStep = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
- recipePressCommandViewModel.SelectedCmd = tempStep.PressCommand.Value;
- if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipePressCommandViewModel, null, "Press Command"))
- {
- tempStep.PressCommand.SetValue(recipePressCommandViewModel.ReturnString);
- SelectedRecipeStep.PressCommand.SetValue(recipePressCommandViewModel.ReturnString);
- SetShowPressPanel(recipePressCommandViewModel.ReturnString);
- }
- break;
- case "PressureWait":
- RecipePressureWaitViewModel recipePressureWaitViewModel = new RecipePressureWaitViewModel();
- tempStep = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
- var destinationStep = (Step)CloneUtil.CloneObject(tempStep);
- destinationStep.StepNo = tempStep.StepNo;
- destinationStep.PressWaitUnit.SetValue((string)QueryDataClient.Instance.Service.GetConfig($"PM1.APC.PressureUnit"));
- recipePressureWaitViewModel.SelectedStep = destinationStep;
- if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipePressureWaitViewModel, null, "Press WaitSet"))
- {
- tempStep.PressIsWait = recipePressureWaitViewModel.SelectedStep.PressIsWait;
- tempStep.PressLowWait = recipePressureWaitViewModel.SelectedStep.PressLowWait;
- tempStep.PressHighWait = recipePressureWaitViewModel.SelectedStep.PressHighWait;
- tempStep.PressWaitUnit = recipePressureWaitViewModel.SelectedStep.PressWaitUnit;
- }
- break;
- case "Pattern":
- if (SelectedRecipeStep != null)
- {
- string toolType = (string)QueryDataClient.Instance.Service.GetConfig("System.SetUp.ToolType");
- isEditMFC = true;
- if (ConstantsCommon.ELK.Equals(toolType))
- {
- using (FurnaceUI.Views.Editors.ELK.RecipeGasPanelSettingViewModel recipeGasPanelSettingViewModel = new FurnaceUI.Views.Editors.ELK.RecipeGasPanelSettingViewModel())
- {
- recipeGasPanelSettingViewModel.CurrentRecipe = CurrentRecipe;
- recipeGasPanelSettingViewModel.SelectedStepName = $"{SelectedRecipeStep.StepNo}:{SelectedRecipeStep.Name}";
- recipeGasPanelSettingViewModel.ChangedStepEvent += RecipeGasPanelSettingViewModel_ChangedStepEvent;
- recipeGasPanelSettingViewModel.SelectedStep = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
- bool rtn = (bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeGasPanelSettingViewModel, null, "Valve");
- if (rtn)
- {
- isEditMFC = false;
- }
- }
- }
- else if (ConstantsCommon.SIBCN.Equals(toolType))
- {
- using (FurnaceUI.Views.Editors.SiBCN.RecipeGasPanelSettingViewModel recipeGasPanelSettingViewModel = new FurnaceUI.Views.Editors.SiBCN.RecipeGasPanelSettingViewModel())
- {
- recipeGasPanelSettingViewModel.CurrentRecipe = CurrentRecipe;
- recipeGasPanelSettingViewModel.SelectedStepName = $"{SelectedRecipeStep.StepNo}:{SelectedRecipeStep.Name}";
- recipeGasPanelSettingViewModel.ChangedStepEvent += RecipeGasPanelSettingViewModel_ChangedStepEvent;
- recipeGasPanelSettingViewModel.SelectedStep = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
- bool rtn = (bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeGasPanelSettingViewModel, null, "Valve");
- if (rtn)
- {
- isEditMFC = false;
- }
- }
- }
- else if (ConstantsCommon.TiN.Equals(toolType))
- {
- using (FurnaceUI.Views.Editors.TiN.RecipeGasPanelSettingViewModel recipeGasPanelSettingViewModel = new FurnaceUI.Views.Editors.TiN.RecipeGasPanelSettingViewModel())
- {
- recipeGasPanelSettingViewModel.CurrentRecipe = CurrentRecipe;
- recipeGasPanelSettingViewModel.SelectedStepName = $"{SelectedRecipeStep.StepNo}:{SelectedRecipeStep.Name}";
- recipeGasPanelSettingViewModel.ChangedStepEvent += RecipeGasPanelSettingViewModel_ChangedStepEvent;
- recipeGasPanelSettingViewModel.SelectedStep = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
- bool rtn = (bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeGasPanelSettingViewModel, null, "Valve");
- if (rtn)
- {
- isEditMFC = false;
- }
- }
- }
- else
- {
- RecipeGasPanelSettingViewModel recipeGasPanelSettingViewModel = new RecipeGasPanelSettingViewModel();
- recipeGasPanelSettingViewModel.CurrentRecipe = CurrentRecipe;
- recipeGasPanelSettingViewModel.SelectedStepName = $"{SelectedRecipeStep.StepNo}:{SelectedRecipeStep.Name}";
- recipeGasPanelSettingViewModel.ChangedStepEvent += RecipeGasPanelSettingViewModel_ChangedStepEvent;
- recipeGasPanelSettingViewModel.SelectedStep = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
- if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeGasPanelSettingViewModel, null, "Valve"))
- {
- }
- }
- }
- break;
- case "BoatElevatorSetting":
- //BoatElevatorSettingViewModel boatElevatorSettingViewModel = new BoatElevatorSettingViewModel();
- //boatElevatorSettingViewModel.SelectedRecipeStep = SelectedRecipeStep;
- //if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(boatElevatorSettingViewModel, null, "BoatElevator Setting"))
- //{
- // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().ZAxisPosition = boatElevatorSettingViewModel.SelectedRecipeStep.ZAxisPosition;
- // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().ZAxisSpeed = boatElevatorSettingViewModel.SelectedRecipeStep.ZAxisSpeed;
- // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().RotatePosition = boatElevatorSettingViewModel.SelectedRecipeStep.RotatePosition;
- // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().RotateSpeed = boatElevatorSettingViewModel.SelectedRecipeStep.RotateSpeed;
- // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().RotateInterval = boatElevatorSettingViewModel.SelectedRecipeStep.RotateInterval;
- // CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().RotateDirection = boatElevatorSettingViewModel.SelectedRecipeStep.RotateDirection;
- //}
- break;
- case "AUX":
- if (SelectedRecipeStep == null || SelectedRecipeStep.AUXSets.Count == 0)
- { return; }
- RecipeAUXSetViewModel recipeAUXSetViewModel = new RecipeAUXSetViewModel();
- recipeAUXSetViewModel.AUXDataList = SelectedRecipeStep.AUXSets;
- if (!(bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeAUXSetViewModel, null, "AUX Set"))
- {
- // SelectedRecipeStep.UndoAUXChanges();
- }
- break;
- case "RecipeHeader":
- RecipeHeaderViewModel recipeHeaderViewModel = new RecipeHeaderViewModel();
- if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeHeaderViewModel, null, "Recipe Header"))
- {
- }
- break;
- case "Combination":
- RecipeCombinationViewModel recipeCombinationViewModel = new RecipeCombinationViewModel();
- recipeCombinationViewModel.CombinationData = new Combination(CurrentRecipe.ConfigItems);
- recipeCombinationViewModel.CombinationData.ChangedValueEvent += CombinationData_ChangedValueEvent;
- if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeCombinationViewModel, null, "Combination"))
- {
- recipeCombinationViewModel.CombinationData.SetValueToParam();
- }
- break;
- case "VPDataList":
- RecipeVPItemSelectViewModel recipeVPItemSelectViewModel = new RecipeVPItemSelectViewModel();
- if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeVPItemSelectViewModel, null, "VP Item Select"))
- {
- }
- break;
- case "AbortRecipe":
- Step currentStep = CurrentRecipe.Steps.FirstOrDefault(x => x.StepNo == SelectedRecipeStep.StepNo);
- StringParam abortCombination = CurrentRecipe.ConfigItems.FirstOrDefault(x => x.Name == "Combination.AbortRecipe") as StringParam;
- if (string.IsNullOrEmpty(abortCombination.Value))
- {
- DialogBox.ShowError("Please select abort recipe first!");
- }
- var retRecipe = RecipeTableSelect.ShowDialog($"Furnace\\abort", abortCombination.Value, false);
- if (!string.IsNullOrEmpty(retRecipe))
- {
- currentStep.AbortRecipeTableIndex = retRecipe;
- SelectedRecipeStep.AbortRecipeTableIndex = retRecipe;
- }
- break;
- case "SkipOrWait":
- RecipeSkipWaitCommandViewModel recipeSkipWaitCommandViewModel = new RecipeSkipWaitCommandViewModel();
- recipeSkipWaitCommandViewModel.SkipWait = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().SkipWait;
- if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeSkipWaitCommandViewModel, null, "Skip or wait command"))
- {
- CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().SkipWait = recipeSkipWaitCommandViewModel.RtnString;
- SelectedRecipeStep.SkipWait = recipeSkipWaitCommandViewModel.RtnString;
- }
- break;
- default:
- break;
- }
- }
- private void CombinationData_ChangedValueEvent(string type, string value)
- {
- string prefix = "";
- switch (type)
- {
- case "SubRecipe":
- break;
- case "AlarmRecipe":
- break;
- case "AbortRecipePath":
- break;
- case "AlarmCondition":
- break;
- case "LeakCheck":
- break;
- case "PressAPCPID":
- prefix = $"Parameter\\APCPID";
- var pressAPCDictData = LoadData(prefix, value);
- foreach (var item in CurrentRecipe.Steps)
- {
- if (item.TemperaturePID.Value.Contains(","))
- {
- var pidList = item.TemperaturePID.Value.Split(',');
- if (pidList.Count() > 2)
- {
- pidList[0] = $"{prefix}\\{value}";
- int pressAPCTempNo = 0;
- int.TryParse(pidList[1], out pressAPCTempNo);
- if (pressAPCDictData != null && pressAPCDictData.ContainsKey(pressAPCTempNo))
- {
- pidList[2] = pressAPCDictData[pressAPCTempNo];
- }
- item.TemperaturePID.Value = string.Join(",", pidList);
- }
- }
- }
- break;
- case "TempCorrection":
- prefix = $"Parameter\\TempCorrection";
- var tempCorDictData = LoadData(prefix, value);
- foreach (var item in CurrentRecipe.Steps)
- {
- if (item.TemperaturePID.Value.Contains(","))
- {
- var pidList = item.TemperaturePID.Value.Split(',');
- if (pidList.Count() > 2)
- {
- pidList[0] = $"{prefix}\\{value}";
- int tempCorTempNo = 0;
- int.TryParse(pidList[1], out tempCorTempNo);
- if (tempCorDictData != null && tempCorDictData.ContainsKey(tempCorTempNo))
- {
- pidList[2] = tempCorDictData[tempCorTempNo];
- }
- item.TemperaturePID.Value = string.Join(",", pidList);
- }
- }
- }
- break;
- case "TempPID":
- prefix = $"Parameter\\TempPID";
- var tempPIDDictData = LoadData(prefix, value);
- foreach (var item in CurrentRecipe.Steps)
- {
- if (item.TemperaturePID.Value.Contains(","))
- {
- var pidList = item.TemperaturePID.Value.Split(',');
- if (pidList.Count() > 2)
- {
- pidList[0] = $"{prefix}\\{value}";
- int tempTempNo = 0;
- int.TryParse(pidList[1], out tempTempNo);
- if (tempPIDDictData != null && tempPIDDictData.ContainsKey(tempTempNo))
- {
- pidList[2] = tempPIDDictData[tempTempNo];
- }
- }
- item.TemperaturePID.Value = string.Join(",", pidList);
- }
- }
- break;
- case "ProfileCondition":
- break;
- default:
- break;
- }
- }
- public TempPIDParameterData CurrentParameter { get; set; } = new TempPIDParameterData();
- private readonly ParameterProvider _parameterProvider = new ParameterProvider();
- private Dictionary<int, string> LoadData(string PrefixPath, string name)
- {
- var recipeContent = _parameterProvider.LoadParameter(PrefixPath, name);
- if (string.IsNullOrEmpty(recipeContent))
- {
- System.Windows.MessageBox.Show($"{PrefixPath}\\{name} is empty, please confirm the file is valid.");
- return null;
- }
- var parameter = new TempPIDParameterData();
- parameter.PrefixPath = PrefixPath;
- parameter.Name = name;
- parameter.InitData(PrefixPath, name, recipeContent, "");
- var dictData = new Dictionary<int, string>();
- if (parameter != null && parameter.Steps.Count > 0)
- {
- foreach (var item in parameter.Steps)
- {
- dictData.Add(item.StepNo, item.Name);
- }
- }
- return dictData;
- }
- public void LowPressWaitTextChanged(object sender, object item)
- {
- if (SelectedRecipeStep == null)
- {
- DialogBox.ShowWarning("The current step is empty!");
- return;
- }
- SelectExistViewModel selectExistViewModel = new SelectExistViewModel();
- selectExistViewModel.ProductZeroStr = SelectedRecipeStep.PressLowPressWait.Value;
- var windowManager = IoC.Get<IWindowManager>();
- var dialogReturn = (bool)(windowManager as WindowManager)?.ShowDialogWithTitle(selectExistViewModel, null, "Select");
- if ((bool)dialogReturn)
- {
- SelectedRecipeStep.PressLowPressWait.SetValue(selectExistViewModel.DialogResultString);
- }
- }
- public void UpdateTotalTime()
- {
- if (CurrentRecipe != null && CurrentRecipe.ConfigItems != null)
- {
- var param = CurrentRecipe.ConfigItems.FirstOrDefault(x => x.Name == "RecipeTime");
- string outAlarmSet = "0";
- if (param != null && param is StringParam)
- {
- List<double> timeList = new List<double>();
- foreach (var item in CurrentRecipe.Steps)
- {
- var timeStr = item.Time;
- if (timeStr != null)
- {
- double hhTime = 0;
- double mmTime = 0;
- double ssTime = 0;
- var strs = timeStr.Split(':');
- if (strs.Length < 3) continue;
- double.TryParse(strs[0], out hhTime);
- double.TryParse(strs[1], out mmTime);
- double.TryParse(strs[2], out ssTime);
- timeList.Add(hhTime * 3600 + mmTime * 60 + ssTime);
- }
- else
- {
- continue;
- }
- }
- string sumValue = timeList.ToArray().Sum().ToString();
- if (((StringParam)param).Value != sumValue)
- {
- ((StringParam)param).Value = sumValue;
- //outAlarmSet = (timeList.ToArray().Sum() * 10).ToString();
- }
- }
- var paramTimeOut = CurrentRecipe.ConfigItems.FirstOrDefault(x => x.Name == "TimeOutAlarmSet");
- if (paramTimeOut != null && param is DoubleParam)
- {
- if (outAlarmSet != "0")
- {
- ((DoubleParam)paramTimeOut).Value = outAlarmSet;
- }
- }
- }
- }
- public void RecipeSave()
- {
- List<string> noNeedEndRecipeType = new List<string>() {
- "reset",
- "idle",
- "abort",
- "sub",
- "alarm",
- };
- var SelectedStep = this.CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
- //if (SelectedStep != null)
- //{
- // SelectedStep.LoaderValue = GetSaveLoaderValue(SelectedStep.LoaderCommand);
- // SelectedStep.PressValue = GetSavePressValue(SelectedStep.PressCommand);
- //}
- RecipePermissionSelectViewModel dialog = new RecipePermissionSelectViewModel("Save recipe and permission", CurrentRecipe.RecipePermission, CurrentRecipe.Description);
- WindowManager wm = new WindowManager();
- bool? dialogReturn = wm.ShowDialog(dialog);
- if (!dialogReturn.HasValue || !dialogReturn.Value)
- return;
- this.CurrentRecipe.ReviseTime = DateTime.Now;
- CurrentRecipe.Description = dialog.RecipeComment;
- InvokeClient.Instance.Service.DoOperation("SetRecipeEditHistory", this.CurrentRecipe.GetRecipeHistory());
- List<string> names = new List<string>();
- string filmFormula = string.Empty;
- Step step = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault();
- if (string.IsNullOrEmpty(CurrentRecipe.Name))
- {
- DialogBox.ShowWarning("Recipe name is empty,can not save!");
- return;
- }
- bool bStandby = false, bEnd;
- foreach (Step recipestep in CurrentRecipe.Steps)
- {
- if (recipestep.StepNo == 0)
- bStandby = true;
- //DialogBox.ShowWarning($"{recipestep.TemperatureControlMode}");
- //DialogBox.ShowWarning($"{recipestep.TemperatureCorrect}");
- //DialogBox.ShowWarning($"{recipestep.TemperaturePID}");
- //if (string.IsNullOrEmpty(filmFormula))
- // filmFormula = recipestep.FilmThickFormula;
- //if (filmFormula != recipestep.FilmThickFormula)
- //{
- // DialogBox.ShowWarning($"The step film thicknesss formula of step number {recipestep.StepNo} is different,can not save!");
- // return;
- //}
- if (string.IsNullOrEmpty(recipestep.Name) || string.IsNullOrEmpty(recipestep.Time))
- {
- if (recipestep.Name != "Standby")
- {
- DialogBox.ShowWarning($"The step name or time of step number {recipestep.StepNo} is empty,can not save!");
- return;
- }
- }
- if (names.Where(x => x == recipestep.Name).FirstOrDefault() != null)
- {
- DialogBox.ShowWarning("Step name cannot be duplicated!");
- return;
- }
- names.Add(recipestep.Name);
- bEnd = bStandby ? recipestep.StepNo == CurrentRecipe.Steps.Count - 1 : recipestep.StepNo == CurrentRecipe.Steps.Count;
- //// "reset/Idle/abort/sub"类型的Recipe不需要End结尾
- if (bEnd == true && noNeedEndRecipeType.Contains(CurrentRecipe.RecipeChamberType.ToLower()))
- {
- bEnd = false;
- }
- //是否是最后一步
- if (bEnd)
- {
- if (!recipestep.Name.ToUpper().Contains("END"))
- {
- DialogBox.ShowWarning("The step command of last step must be 'END',please check!");
- return;
- }
- }
- }
- // step.SetStepValues(SelectedRecipeStep);
- this.CurrentRecipe.Revisor = BaseApp.Instance.UserContext.LoginName;
- this.CurrentRecipe.ReviseTime = DateTime.Now;
- this.CurrentRecipe.RecipeLevel = this.LevelDisplay;
- this.CurrentRecipe.RecipePermission = dialog.RecipeComment;
- UpdateTotalTime();
- var result = this._recipeProvider.SaveRecipe(CurrentRecipe.PrefixPath, CurrentRecipe.Name, CurrentRecipe.GetXmlString());
- if (result)
- {
- ((Window)GetView()).DialogResult = true;
- }
- }
- public List<ConfigNode> GetMfcItem()
- {
- this.SystemName = "System";
- ConfigNodes = SystemConfigProvider.Instance.GetConfigTree(SystemName).SubNodes;
- var MfcItems = ConfigNodes.Where(x => x.Display == "Parameter").FirstOrDefault().SubNodes.Where(y => y.Name == "MFC").FirstOrDefault().SubNodes;
- return MfcItems;
- }
- public void RecipeCancel()
- {
- if (DialogBox.ShowDialog(DialogButton.Yes | DialogButton.No, DialogType.CONFIRM, " You confirm that you want to unsave the recipe and exit the interface?") == DialogButton.No)
- return;
- ((Window)GetView()).DialogResult = false;
- }
- public void PressPIDChick()
- {
- var windowManager = IoC.Get<IWindowManager>();
- StringParam pressAPC = CurrentRecipe.ConfigItems.FirstOrDefault(x => x.Name == "Combination.PressAPCPID") as StringParam;
- if (pressAPC == null)
- {
- DialogBox.ShowDialog(DialogButton.Cancel, DialogType.INFO, "Please set the combination file first");
- return;
- }
- APCPIDEditViewModel aPCPIDEditViewModel = new APCPIDEditViewModel();
- aPCPIDEditViewModel.IsEditEnabled = false;
- aPCPIDEditViewModel.CurrentRecipe = CurrentRecipe;
- var rtn = (windowManager as WindowManager)?.ShowDialogWithTitle(aPCPIDEditViewModel, null, "APC PID Table");
- if ((bool)rtn && SelectedRecipeStep != null)
- SelectedRecipeStep.PressPID.SetValue(aPCPIDEditViewModel.RetrunString);
- }
- protected override void InvokeAfterUpdateProperty(Dictionary<string, object> data)
- {
- base.InvokeAfterUpdateProperty(data);
- if (SelectedRecipeStep != null)
- {
- if (CurrentRecipe.RecipeChamberType == RecipeDataBase.ProcessType)
- {
- SelectIndex = SelectedRecipeStep.StepNo + 1;
- }
- else
- {
- SelectIndex = SelectedRecipeStep.StepNo;
- }
- }
- if (CurrentRecipe.Steps != null && CurrentRecipe.Steps.Count > 0 && CheckValueChange(data))
- {
- // UpdateRecipeGASSetting(data);
- //SelectStep(CurrentRecipe.Steps[EditRecipeStepNo]);
- }
- // UpdateGASSetting();
- oldresult = data;
- SetCmdIsEnabled();
- }
- Dictionary<string, object> oldresult;
- private bool CheckValueChange(Dictionary<string, object> result)
- {
- Dictionary<string, object> temp = result;
- if (oldresult == null)
- {
- oldresult = result;
- return true;
- }
- else
- {
- List<string> strkeys = new List<string>();
- foreach (var key in result.Keys)
- {
- if (_subscribedKeys.Contains(key) && oldresult.ContainsKey(key) && result.ContainsKey(key))
- {
- if (result[key].GetType() == typeof(AITValveData) && ((AITValveData)oldresult[key]).VirtualFeedback != ((AITValveData)result[key]).VirtualFeedback)
- {
- return true;
- }
- else if (result[key].GetType() == typeof(AITMfcData) && ((AITMfcData)oldresult[key]).VirtualSetPoint != ((AITMfcData)result[key]).VirtualSetPoint)
- {
- return true;
- }
- else if (result[key].GetType() == typeof(bool) && (bool)oldresult[key] != (bool)result[key])
- {
- return true;
- }
- }
- }
- }
- return false;
- }
- public void SetValue(object sender)
- {
- string value = ((TextBox)sender).Text;
- NumberKeyboard fullKeyboard = new NumberKeyboard("", value);
- if ((bool)fullKeyboard.ShowDialog())
- {
- ((TextBox)sender).Text = fullKeyboard.ValueString;
- }
- }
- public void SetValue(object sender, string isFullKeyboard = "")
- {
- string value = ((TextBox)sender).Text;
- if (!string.IsNullOrEmpty(isFullKeyboard))
- {
- FullKeyboard fullKeyboard1 = new FullKeyboard("", value);
- if ((bool)fullKeyboard1.ShowDialog())
- {
- ((TextBox)sender).Text = fullKeyboard1.ValueString;
- }
- }
- else
- {
- NumberKeyboard fullKeyboard = new NumberKeyboard("", value);
- if ((bool)fullKeyboard.ShowDialog())
- {
- ((TextBox)sender).Text = fullKeyboard.ValueString;
- }
- }
- }
- public void MFCTextChanged(string type, object sender, object item)
- {
- if (!string.IsNullOrEmpty(type) && item != null && sender != null)
- {
- if (isEditMFC) return;
- MFCData mFCData = (MFCData)item;
- string value = ((TextBox)sender).Text;
- switch (type)
- {
- case "Value":
- InvokeClient.Instance.Service.DoOperation($"PM1.{mFCData.ControlName}.SetMfcVirtualValue", $"{value};{mFCData.Rampng.Value};{mFCData.AlarmValue}");
- break;
- case "Rampng":
- InvokeClient.Instance.Service.DoOperation($"PM1.{mFCData.ControlName}.SetMfcVirtualValue", $"{mFCData.SetValue.Value};{value};{mFCData.AlarmValue}");
- SetRampngValue(mFCData.DisplayName, value);
- break;
- default:
- break;
- }
- }
- }
- public void PressTextChanged(string type, object sender, object item)
- {
- if (!string.IsNullOrEmpty(type) && item != null && sender != null)
- {
- Step step = (Step)item;
- if (step.StepNo != OldStep.StepNo)
- {
- return;
- }
- //string value = ((TextBox)sender).Text;
- //switch (type)
- //{
- // case "PressSet":
- // step.PressSet.IsSaved = false;
- // break;
- // case "PressSlowVacSet":
- // step.PressSlowVacSet.IsSaved = false;
- // break;
- // case "PressValveAngleSet":
- // step.PressValveAngleSet.IsSaved = false;
- // break;
- // case "PressLowPressWait":
- // step.PressLowPressWait.IsSaved = false;
- // break;
- // case "WaitPress":
- // step.WaitPress.IsSaved = false;
- // break;
- // default:
- // break;
- //}
- }
- }
- //public void PressValidated(string type, object sender, object item)
- //{
- // if (!string.IsNullOrEmpty(type) && item != null && sender != null)
- // {
- // Step step = (Step)item;
- // if (step.StepNo != OldStep.StepNo)
- // {
- // return;
- // }
- // string value = ((TextBox)sender).Text;
- // switch (type)
- // {
- // case "PressSet":
- // step.PressSet.IsSaved = false;
- // break;
- // case "PressSlowVacSet":
- // step.PressSlowVacSet.IsSaved = false;
- // break;
- // case "PressValveAngleSet":
- // step.PressValveAngleSet.IsSaved = false;
- // break;
- // case "PressLowPressWait":
- // step.PressLowPressWait.IsSaved = false;
- // break;
- // case "WaitPress":
- // step.WaitPress.IsSaved = false;
- // break;
- // default:
- // break;
- // }
- // }
- //}
- private void SetRampngValue(string name, string value)
- {
- if (double.TryParse(value, out double getValue))
- {
- var stepNo = 0;
- if (!_isStandbyCheckedSelect)
- stepNo = SelectedRecipeStep.StepNo;
- var step = CurrentRecipe.Steps.Where(x => x.StepNo == stepNo).FirstOrDefault();
- if (step != null)
- {
- var mfc = CurrentRecipe.Steps.Where(x => x.StepNo == stepNo).FirstOrDefault().MFCSets.FirstOrDefault(x => x.ControlName == name);
- if (mfc != null)
- {
- mfc.Rampng.SetValue(value);
- }
- }
- }
- }
- private void UpdateMFCShow()
- {
- var mfcDict = CurrentRecipe.Steps.Where(x => x.StepNo == SelectedRecipeStep.StepNo).FirstOrDefault().MFCSets;
- foreach (var item in mfcDict)
- {
- //var mfc = MFCDataList.FirstOrDefault(x => x.Name == item.Key.Replace(".Flow", ""));
- //if (mfc != null)
- //{
- // mfc.IsCheck = item.Value.IsCheck;
- //}
- }
- }
- private void UpdateRecipeGASSetting(Dictionary<string, object> result)
- {
- var stepNo = 0;
- if (!_isStandbyCheckedSelect)
- stepNo = SelectedRecipeStep.StepNo;
- var step = CurrentRecipe.Steps.Where(x => x.StepNo == stepNo).FirstOrDefault();
- if (step != null)
- {
- var mfcSets = CurrentRecipe.Steps.Where(x => x.StepNo == stepNo).FirstOrDefault().MFCSets;
- var valveSets = CurrentRecipe.Steps.Where(x => x.StepNo == stepNo).FirstOrDefault().ValveSets;
- foreach (var key in result.Keys)
- {
- //if (result[key].GetType() == typeof(AITValveData))
- //{
- // var valveData = (AITValveData)result[key];
- // if (valveSets.ContainsKey(valveData.DeviceName))
- // {
- // valveSets[valveData.DeviceName] = valveData.VirtualFeedback ? "Open" : "Close";
- // }
- //}else
- if (result[key].GetType() == typeof(AITMfcData))
- {
- var mfcData = (AITMfcData)result[key];
- var name = $"{mfcData.DeviceName}.Flow";
- var findMFC = mfcSets.FirstOrDefault(x => x.ControlName == name);
- if (findMFC != null)
- {
- findMFC.SetValue.Value = mfcData.VirtualSetPoint.ToString();
- findMFC.Rampng.Value = mfcData.VirtualRamping.ToString();
- findMFC.AlarmValue = mfcData.VirtualAlarmWatchTable;
- }
- }
- }
- CurrentRecipe.Steps.Where(x => x.StepNo == stepNo).FirstOrDefault().MFCSets = mfcSets;
- CurrentRecipe.Steps.Where(x => x.StepNo == stepNo).FirstOrDefault().ValveSets = valveSets;
- }
- }
- private void UpdateGASSetting()
- {
- if (_isStandbyCheckedSelect)
- return;
- List<AITMfcData> mfcDatas = new List<AITMfcData>()
- {
- MFC1Data,
- MFC2Data,
- MFC3Data,
- MFC4Data,
- MFC5Data,
- MFC6Data,
- MFC7Data,
- MFC8Data,
- MFC9Data,
- MFC10Data,
- MFC11Data,
- MFC12Data,
- MFC13Data,
- MFC14Data,
- MFC15Data,
- MFC16Data,
- MFC17Data,
- MFC31Data,
- MFC32Data,
- //MFC51Data,
- };
- for (int i = 0; i < mfcDatas.Count; i++)
- {
- if (SelectedRecipeStep != null)
- {
- if (mfcDatas[i] == null) continue;
- var mfc = SelectedRecipeStep.MFCSets.FirstOrDefault(x => x.ControlName == mfcDatas[i].DeviceName);
- mfc.SetValue.Value = mfcDatas[i].VirtualSetPoint.ToString();
- mfc.Rampng.Value = mfcDatas[i].VirtualRamping.ToString();
- }
- }
- }
- public void SelecteTable()
- {
- CurrentRecipe.Tables.FirstOrDefault(x => x.Index == CurrentRecipe.TableIndex).TableData.Steps.Clear();
- CurrentRecipe.Steps.ToList().ForEach(x =>
- {
- var tempStep = (Step)CloneUtil.CloneAllObject(x);
- CurrentRecipe.Tables.FirstOrDefault(y => y.Index == CurrentRecipe.TableIndex).TableData.Steps.Add(tempStep);
- });
- CurrentRecipe.StepCloneChangedIndex();
- int getIndex = RecipeTableSelect.ShowDialogGetTableIndex(CurrentRecipe, RecipeType);
- //SelectStep(CurrentRecipe.Steps.FirstOrDefault());
- if (getIndex != -1)
- {
- while (CurrentRecipe.Steps.Count > 0)
- {
- CurrentRecipe.Steps.RemoveAt(0);
- }
- CurrentRecipe.Tables.FirstOrDefault(x => x.Index == (getIndex + 1)).TableData.Steps.ToList().ForEach(x =>
- {
- Step tempStep = (Step)CloneUtil.CloneAllObject(x);
- CurrentRecipe.SetDelegateEvent(tempStep);
- CurrentRecipe.Steps.Add(tempStep);
- });
- NewSteps = new ObservableCollection<Step>(CurrentRecipe.Steps.Take(pageSize * currentPage).Skip(pageSize * (currentPage - 1)));
- SelectStep(CurrentRecipe.Steps.FirstOrDefault());
- }
- }
- private int currentPage = 1;
- private int pageSize = 10;
- private int totalPage = 0;
- private ObservableCollection<Step> _newSteps = new ObservableCollection<Step>();
- public ObservableCollection<Step> NewSteps
- {
- get
- {
- return _newSteps;
- }
- set
- {
- _newSteps = value;
- NotifyOfPropertyChange(nameof(NewSteps));
- }
- }
- public void PageLineTop()
- {
- if (currentPage <= 1)
- {
- return;
- }
- currentPage = currentPage - 1;
- NewSteps = new ObservableCollection<Step>(CurrentRecipe.Steps.Take(pageSize * currentPage).Skip(pageSize * (currentPage - 1)));
- IndexNoDefault = 9;
- SelectStep(NewSteps[IndexNoDefault]);
- RefreshUpdate();
- }
- public void PageTop()
- {
- if (IndexNoDefault == 0)
- {
- PageLineTop();
- if (currentPage != 1)
- {
- IndexNoDefault = NewSteps.Count - 1;
- }
- return;
- }
- IndexNoDefault = IndexNoDefault - 1;
- SelectStep(NewSteps[IndexNoDefault]);
- RefreshUpdate();
- }
- public void PageDown()
- {
- if (IndexNoDefault == CurrentRecipe.Steps.Count || SelectedRecipeStep == CurrentRecipe.Steps.LastOrDefault())
- {
- return;
- }
- IndexNoDefault = IndexNoDefault + 1;
- if ((IndexNoDefault % pageSize) == 0)
- {
- PageLineDown();
- }
- SelectStep(NewSteps[IndexNoDefault]);
- RefreshUpdate();
- }
- public void PageLineDown()
- {
- if (currentPage >= GetTotalPage())
- {
- return;
- }
- currentPage = currentPage + 1;
- NewSteps = new ObservableCollection<Step>(CurrentRecipe.Steps.Take(pageSize * currentPage).Skip(pageSize * (currentPage - 1)));
- IndexNoDefault = 0;
- SelectStep(NewSteps[IndexNoDefault]);
- RefreshUpdate();
- }
- public int GetTotalPage()
- {
- var totalPage = CurrentRecipe.Steps.Count / pageSize;
- if ((CurrentRecipe.Steps.Count % pageSize) > 0)
- {
- totalPage = totalPage + 1;
- }
- return totalPage;
- }
- public int GetcurrentPage()
- {
- var currentPage = IndexNoDefault / pageSize;
- if ((IndexNoDefault % pageSize) > 0)
- {
- currentPage = currentPage + 1;
- }
- if (currentPage == 0) currentPage++;
- return currentPage;
- }
- }
- }
|