| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553 | 
							- using Caliburn.Micro;
 
- using Caliburn.Micro.Core;
 
- using MECF.Framework.Common.DataCenter;
 
- using MECF.Framework.Common.RecipeCenter;
 
- using MECF.Framework.UI.Client.CenterViews.Configs.SystemConfig;
 
- using MECF.Framework.UI.Client.CenterViews.Editors.Recipe;
 
- using System;
 
- using System.Collections.Generic;
 
- using System.Collections.ObjectModel;
 
- using System.Linq;
 
- using System.Text;
 
- using System.Threading.Tasks;
 
- using System.Windows;
 
- using FurnaceUI.Models;
 
- using FurnaceUI.Views.Recipes;
 
- using RecipeEditorLib.RecipeModel.Params;
 
- namespace FurnaceUI.Views.Editors
 
- {
 
-     public class RecipeStandbySettingViewModel : FurnaceUIViewModelBase
 
-     {
 
-         private Step _standbyStep = new Step();
 
-         public Step StandbyStep
 
-         {
 
-             get => _standbyStep;
 
-             set
 
-             {
 
-                 _standbyStep = value;
 
-                 NotifyOfPropertyChange(nameof(StandbyStep));
 
-             }
 
-         }
 
-         private string _selectedStepName = "Standby";
 
-         public string SelectedStepName
 
-         {
 
-             get
 
-             {
 
-                 return _selectedStepName;
 
-             }
 
-             set
 
-             {
 
-                 _selectedStepName = value;
 
-                 NotifyOfPropertyChange("SelectedStepName");
 
-             }
 
-         }
 
-         private string _selectedTempSetting1;
 
-         public string SelectedTempSetting1
 
-         {
 
-             get
 
-             {
 
-                 return _selectedTempSetting1;
 
-             }
 
-             set
 
-             {
 
-                 _selectedTempSetting1 = value;
 
-                 NotifyOfPropertyChange("SelectedTempSetting1");
 
-             }
 
-         }
 
-         private string _selectedTempSetting2;
 
-         public string SelectedTempSetting2
 
-         {
 
-             get
 
-             {
 
-                 return _selectedTempSetting2;
 
-             }
 
-             set
 
-             {
 
-                 _selectedTempSetting2 = value;
 
-                 NotifyOfPropertyChange("SelectedTempSetting2");
 
-             }
 
-         }
 
-         private string _selectedTempSetting3;
 
-         public string SelectedTempSetting3
 
-         {
 
-             get
 
-             {
 
-                 return _selectedTempSetting3;
 
-             }
 
-             set
 
-             {
 
-                 _selectedTempSetting3 = value;
 
-                 NotifyOfPropertyChange("SelectedTempSetting3");
 
-             }
 
-         }
 
-         private string _selectedTempSetting4;
 
-         public string SelectedTempSetting4
 
-         {
 
-             get
 
-             {
 
-                 return _selectedTempSetting4;
 
-             }
 
-             set
 
-             {
 
-                 _selectedTempSetting4 = value;
 
-                 NotifyOfPropertyChange("SelectedTempSetting4");
 
-             }
 
-         }
 
-         private string _selectedTempSetting5;
 
-         public string SelectedTempSetting5
 
-         {
 
-             get
 
-             {
 
-                 return _selectedTempSetting5;
 
-             }
 
-             set
 
-             {
 
-                 _selectedTempSetting5 = value;
 
-                 NotifyOfPropertyChange("SelectedTempSetting5");
 
-             }
 
-         }
 
-         private string _selectedTempSettingValue1;
 
-         public string SelectedTempSettingValue1
 
-         {
 
-             get
 
-             {
 
-                 return _selectedTempSettingValue1;
 
-             }
 
-             set
 
-             {
 
-                 _selectedTempSettingValue1 = value;
 
-                 NotifyOfPropertyChange("SelectedTempSettingValue1");
 
-             }
 
-         }
 
-         private string _selectedTempSettingValue2;
 
-         public string SelectedTempSettingValue2
 
-         {
 
-             get
 
-             {
 
-                 return _selectedTempSettingValue2;
 
-             }
 
-             set
 
-             {
 
-                 _selectedTempSettingValue2 = value;
 
-                 NotifyOfPropertyChange("SelectedTempSettingValue2");
 
-             }
 
-         }
 
-         private string _selectedTempSettingValue3;
 
-         public string SelectedTempSettingValue3
 
-         {
 
-             get
 
-             {
 
-                 return _selectedTempSettingValue3;
 
-             }
 
-             set
 
-             {
 
-                 _selectedTempSettingValue3 = value;
 
-                 NotifyOfPropertyChange("SelectedTempSettingValue3");
 
-             }
 
-         }
 
-         private string _selectedTempSettingValue4;
 
-         public string SelectedTempSettingValue4
 
-         {
 
-             get
 
-             {
 
-                 return _selectedTempSettingValue4;
 
-             }
 
-             set
 
-             {
 
-                 _selectedTempSettingValue4 = value;
 
-                 NotifyOfPropertyChange("SelectedTempSettingValue4");
 
-             }
 
-         }
 
-         private string _selectedTempSettingValue5;
 
-         public string SelectedTempSettingValue5
 
-         {
 
-             get
 
-             {
 
-                 return _selectedTempSettingValue5;
 
-             }
 
-             set
 
-             {
 
-                 _selectedTempSettingValue5 = value;
 
-                 NotifyOfPropertyChange("SelectedTempSettingValue5");
 
-             }
 
-         }
 
-         private string _selectedGasSetting1;
 
-         public string SelectedGasSetting1
 
-         {
 
-             get
 
-             {
 
-                 return _selectedGasSetting1;
 
-             }
 
-             set
 
-             {
 
-                 _selectedGasSetting1 = value;
 
-                 NotifyOfPropertyChange("SelectedGasSetting1");
 
-             }
 
-         }
 
-         private string _selectedGasSetting2;
 
-         public string SelectedGasSetting2
 
-         {
 
-             get
 
-             {
 
-                 return _selectedGasSetting2;
 
-             }
 
-             set
 
-             {
 
-                 _selectedGasSetting2 = value;
 
-                 NotifyOfPropertyChange("SelectedGasSetting2");
 
-             }
 
-         }
 
-         private string _selectedGasSetting3;
 
-         public string SelectedGasSetting3
 
-         {
 
-             get
 
-             {
 
-                 return _selectedGasSetting3;
 
-             }
 
-             set
 
-             {
 
-                 _selectedGasSetting3 = value;
 
-                 NotifyOfPropertyChange("SelectedGasSetting3");
 
-             }
 
-         }
 
-         private string _selectedGasSetting4;
 
-         public string SelectedGasSetting4
 
-         {
 
-             get
 
-             {
 
-                 return _selectedGasSetting4;
 
-             }
 
-             set
 
-             {
 
-                 _selectedGasSetting4 = value;
 
-                 NotifyOfPropertyChange("SelectedGasSetting4");
 
-             }
 
-         }
 
-         private string _selectedGasSetting5;
 
-         public string SelectedGasSetting5
 
-         {
 
-             get
 
-             {
 
-                 return _selectedGasSetting5;
 
-             }
 
-             set
 
-             {
 
-                 _selectedGasSetting5 = value;
 
-                 NotifyOfPropertyChange("SelectedGasSetting5");
 
-             }
 
-         }
 
-         private string _selectedGasSetting6;
 
-         public string SelectedGasSetting6
 
-         {
 
-             get
 
-             {
 
-                 return _selectedGasSetting6;
 
-             }
 
-             set
 
-             {
 
-                 _selectedGasSetting6 = value;
 
-                 NotifyOfPropertyChange("SelectedGasSetting6");
 
-             }
 
-         }
 
-         public Dictionary<string, string> TemperatureValues { get; set; }
 
-         public ObservableCollection<TempSetData> HeadLst { get; set; }
 
-         public Dictionary<string, ObservableCollection<RecipeTemplateColumnBase>> RecipeTemplate { get; set; }
 
-         public RecipeDataBase CurrentRecipe { get; set; }
 
-         private Step _selectedRecipeStep;
 
-         public Step SelectedRecipeStep
 
-         {
 
-             get => _selectedRecipeStep;
 
-             set
 
-             {
 
-                 if (value != null)
 
-                 {
 
-                     _selectedRecipeStep = value;
 
-                     NotifyOfPropertyChange("SelectedRecipeStep");
 
-                 }
 
-                 else
 
-                 {
 
-                     _selectedRecipeStep = null;
 
-                     NotifyOfPropertyChange("SelectedRecipeStep");
 
-                 }
 
-             }
 
-         }
 
-         //private ObservableCollection<MFCData> _mFCDatas = new ObservableCollection<MFCData>();
 
-         //public ObservableCollection<MFCData> MFCDataList
 
-         //{
 
-         //    get => _mFCDatas;
 
-         //    set
 
-         //    {
 
-         //        _mFCDatas = value;
 
-         //        NotifyOfPropertyChange("MFCDataList");
 
-         //    }
 
-         //}
 
-         public List<ConfigNode> ConfigNodes { get; private set; }
 
-         RecipeTempSetViewModel recipeTempSetViewModel = null;
 
-         public string RecipeType { get; set; }
 
-         public RecipeStandbySettingViewModel()
 
-         {
 
-         }
 
-         protected override void OnInitialize()
 
-         {
 
-             base.OnInitialize();
 
-             LoadData();
 
-         }
 
-         private void LoadData()
 
-         {
 
-             Step step = StandbyStep;
 
-             if (step.MFCSets != null && step.MFCSets.Count > 0)
 
-             {
 
-                 //int index2 = 0;
 
-                 StringBuilder stringBuilder = new StringBuilder();
 
-                 var MfcItems = this.GetMfcItem();
 
-                 int mfcIndex = 0;
 
-                 foreach (var item in MfcItems)
 
-                 {
 
-                     var isInstalled = QueryDataClient.Instance.Service.GetConfig($"PM1.MFC.{item.Name}.IsMFCInstalled");
 
-                     //var key = step.MFCSets.Keys.ToList()[mfcIndex];
 
-                     mfcIndex++;
 
-                     if (!(bool)isInstalled) continue;
 
-                     //MFCDataList.Add(new MFCData()
 
-                     //{
 
-                     //    SetValueParam = step.MFCSets[key.ToString()].SetValueParam,
 
-                     //    Name = SystemConfigProvider.Instance.GetValueByName($"PM1.MFC.{item.Name}.GasName"),
 
-                     //   // Unit = SystemConfigProvider.Instance.GetValueByName($"PM1.MFC.{item.Name}.FlowUnit"),
 
-                     //});
 
-                 }
 
-             }
 
-         }
 
-         public void RecipeEdit(object cmdName, object value)
 
-         {
 
-             var windowManager = IoC.Get<IWindowManager>();
 
-             switch ((string)cmdName)
 
-             {
 
-                 case "StepTime":
 
-                     RecipeStepTimeViewModel recipeStepTimeViewModel = new RecipeStepTimeViewModel("StepTime");
 
-                     recipeStepTimeViewModel.SelectTime = StandbyStep.Time;
 
-                     (windowManager as WindowManager)?.ShowDialogWithTitle(recipeStepTimeViewModel, null, "Standby Time Setting");
 
-                     if (recipeStepTimeViewModel.IsSave)
 
-                     {
 
-                         StandbyStep.Time = recipeStepTimeViewModel.SelectTime;
 
-                         if (recipeStepTimeViewModel.SelectTime == "Value")
 
-                         {
 
-                             SelectedRecipeStep.Time = recipeStepTimeViewModel.SelectTime + ":" + recipeStepTimeViewModel.SelectValueTime;
 
-                             StandbyStep.Time = recipeStepTimeViewModel.SelectValueTime;
 
-                         }
 
-                         else
 
-                         {
 
-                             SelectedRecipeStep.Time = recipeStepTimeViewModel.SelectTime + ":" + recipeStepTimeViewModel.RecipeStepTime[recipeStepTimeViewModel.SelectTime];
 
-                         }
 
-                     }
 
-                     break;
 
-                 case "AlarmAction":
 
-                     RecipeAlarmActionViewModel recipeAlarmActionViewModel = new RecipeAlarmActionViewModel
 
-                     {
 
-                         CurrentRecipe = CurrentRecipe,
 
-                         CurrentStepName = SelectedRecipeStep.Name,
 
-                         TableIndex = StandbyStep.AlarmConditionTable.Value,
 
-                         AlarmActions = StandbyStep.AlarmActionSets
 
-                     };
 
-                     if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeAlarmActionViewModel, null, "Standby Alarm Action"))
 
-                     {
 
-                         StandbyStep.AlarmConditionTable.Value = recipeAlarmActionViewModel.TableIndex;
 
-                         StandbyStep.AlarmActionSets = recipeAlarmActionViewModel.AlarmActions;
 
-                     }
 
-                     break;
 
-                 case "TempSetting":
 
-                     if (recipeTempSetViewModel is null)
 
-                     {
 
-                         recipeTempSetViewModel = new RecipeTempSetViewModel
 
-                         {
 
-                             RecipeTemplate = RecipeTemplate
 
-                         };
 
-                     }
 
-                     var tempSets = StandbyStep;
 
-                     recipeTempSetViewModel.TemperatureValues = tempSets.TemperatureSets;
 
-                     recipeTempSetViewModel.StepType = SelectedStepName;
 
-                     recipeTempSetViewModel.RecipeType = RecipeType;
 
-                     if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeTempSetViewModel, null, "Standby Temperature Setting"))
 
-                     {
 
-                         if (recipeTempSetViewModel.TemperatureValues != null && recipeTempSetViewModel.TemperatureValues.Count > 0 && recipeTempSetViewModel.IsSave)
 
-                         {
 
-                             StringBuilder tempStr = new StringBuilder();
 
-                             List<string> temperatureValue = new List<string>();
 
-                             List<string> tempLis = new List<string>();
 
-                             string strTemperatureValue = "", strTemperatureName = "";
 
-                             int index = 0;
 
-                         }
 
-                     }
 
-                     break;
 
-                 case "GASSetting":
 
-                     RecipeGASSettingViewModel recipeGASSettingViewModel = new RecipeGASSettingViewModel();
 
-                     var tempValveSets = StandbyStep.ValveSets;
 
-                     if (tempValveSets != null && tempValveSets.Count > 0)
 
-                     {
 
-                         recipeGASSettingViewModel.ValveSets= StandbyStep.ValveSets;
 
-                     }
 
-                     recipeGASSettingViewModel.MFCSets = StandbyStep.MFCSets;
 
-                     var tempMFMSets = StandbyStep.MFMSets;
 
-                     if (tempMFMSets != null && tempMFMSets.Count > 0)
 
-                     {
 
-                         foreach (var item in tempMFMSets.Keys)
 
-                         {
 
-                             if (recipeGASSettingViewModel.MFMSets.ContainsKey(item))
 
-                             {
 
-                                 recipeGASSettingViewModel.MFMSets[item] = tempMFMSets[item];
 
-                             }
 
-                             else
 
-                             {
 
-                                 recipeGASSettingViewModel.MFMSets.Add(item, tempMFMSets[item]);
 
-                             }
 
-                         }
 
-                     }
 
-                     var tempEXOU = StandbyStep.EXOUSets;
 
-                     if (tempEXOU != null && tempEXOU.Count > 0)
 
-                     {
 
-                         foreach (var item in tempEXOU.Keys)
 
-                         {
 
-                             var keyName = $"EXOU{item.Substring(12)}";
 
-                             if (recipeGASSettingViewModel.ExternalOutSets.ContainsKey(keyName))
 
-                             {
 
-                                 recipeGASSettingViewModel.ExternalOutSets[keyName] = tempEXOU[item];
 
-                             }
 
-                             else
 
-                             {
 
-                                 recipeGASSettingViewModel.ExternalOutSets.Add(keyName, tempEXOU[item]);
 
-                             }
 
-                         }
 
-                     }
 
-                     recipeGASSettingViewModel.RecipeTemplate = RecipeTemplate;
 
-                     recipeGASSettingViewModel.RecipeType = RecipeType;
 
-                     if (!(bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeGASSettingViewModel, null, "Standby Gas Setting")) return;
 
-                     if (StandbyStep.MFMSets != null)
 
-                     {
 
-                         if (recipeGASSettingViewModel.MFMSets != null)
 
-                         {
 
-                             StandbyStep.MFMSets = recipeGASSettingViewModel.MFMSets;
 
-                         }
 
-                     }
 
-                     if (StandbyStep.ValveSets != null)
 
-                     {
 
-                         if (recipeGASSettingViewModel.ValveSets != null && recipeGASSettingViewModel.ValveSets.Count > 0)
 
-                         {
 
-                             var step = StandbyStep;
 
-                             step.ValveSets = recipeGASSettingViewModel.ValveSets;
 
-                         }
 
-                     }
 
-                     if (StandbyStep.MFCSets != null)
 
-                     {
 
-                         if (recipeGASSettingViewModel.MFCSets != null && recipeGASSettingViewModel.MFCSets.Count > 0)
 
-                         {
 
-                             var step = StandbyStep;
 
-                             var MfcItems = this.GetMfcItem();
 
-                             int mfcIndex = 0;
 
-                             foreach (var item in MfcItems)
 
-                             {
 
-                                 var isInstalled = QueryDataClient.Instance.Service.GetConfig($"PM1.MFC.{item.Name}.IsMFCInstalled");
 
-                                 //var key = StandbyStep.MFCSets.Keys.ToList()[mfcIndex];
 
-                                 mfcIndex++;
 
-                                 if (!(bool)isInstalled) continue;
 
-                                 //MFCDataList.Add(new MFCData()
 
-                                 //{
 
-                                 //    SetValueParam =StandbyStep.MFCSets[key.ToString()].SetValueParam,
 
-                                 //    Name = SystemConfigProvider.Instance.GetValueByName($"PM1.MFC.{item.Name}.GasName"),
 
-                                 //    Unit = SystemConfigProvider.Instance.GetValueByName($"PM1.MFC.{item.Name}.FlowUnit"),
 
-                                 //});
 
-                             }
 
-                         }
 
-                     }
 
-                     if (StandbyStep.EXOUSets != null)
 
-                     {
 
-                         if (recipeGASSettingViewModel.ExternalOutSets != null && recipeGASSettingViewModel.ExternalOutSets.Count > 0)
 
-                         {
 
-                             var step = StandbyStep;
 
-                             foreach (var item in recipeGASSettingViewModel.ExternalOutSets.Keys)
 
-                             {
 
-                                 var key = $"External.Out{ item.Substring(4)}";
 
-                                 if (step.EXOUSets.ContainsKey(key))
 
-                                 {
 
-                                     step.EXOUSets[key] = recipeGASSettingViewModel.ExternalOutSets[item];
 
-                                 }
 
-                                 else
 
-                                 {
 
-                                     step.EXOUSets.Add(key, recipeGASSettingViewModel.ExternalOutSets[item]);
 
-                                 }
 
-                             }
 
-                         }
 
-                     }
 
-                     break;
 
-                 case "PressureSetting":
 
-                     RecipePressureSettingViewModel recipePressureSettingViewModel = new RecipePressureSettingViewModel();
 
-                     var tempStep = StandbyStep;
 
-                     //recipePressureSettingViewModel.PressureSonsorValue = tempStep.PressureSonserValue;
 
-                     //recipePressureSettingViewModel.PressureValveAngleValue = tempStep.PressureValveAngle;
 
-                     //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, "Standby Pressure Setting"))
 
-                     //{
 
-                     //    if (StandbyStep != null)
 
-                     //    {
 
-                     //        StandbyStep.PressureSonserValue = recipePressureSettingViewModel.PressureSonsorValue;
 
-                     //        StandbyStep.PressureValveAngle = recipePressureSettingViewModel.PressureValveAngleValue;
 
-                     //        StandbyStep.PressureAlarmTableNo = recipePressureSettingViewModel.PressureAlarmWatchTable;
 
-                     //        SelectedRecipeStep.PressureSonserValue = $"{recipePressureSettingViewModel.PressureSonsorValue}";
 
-                     //    }
 
-                     //}
 
-                     break;
 
-             }
 
-         }
 
-         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 RecipeSave()
 
-         {
 
-             ((Window)GetView()).DialogResult = true;
 
-         }
 
-         public void RecipeCancel()
 
-         {
 
-             ((Window)GetView()).DialogResult = false;
 
-         }
 
-     }
 
- }
 
 
  |