123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using FurnaceUI.Models;
- using System.Windows;
- using Caliburn.Micro.Core;
- using System.Windows.Controls;
- using Aitex.Core.RT.SCCore;
- using Aitex.Core.Util;
- using Aitex.Core.Common.DeviceData;
- using MECF.Framework.UI.Client.CenterViews.Configs.SystemConfig;
- using MECF.Framework.Common.DataCenter;
- namespace FurnaceUI.Views.Editors
- {
- public class RecipeConditionCheckSetViewModel : FurnaceUIViewModelBase
- {
- public RecipeCondition RecipeConditions { get; set; } = new RecipeCondition();
- public string O2Unit
- {
- get
- {
- return $"O2 Density({QueryDataClient.Instance.Service.GetConfig("PM1.APC.PressureUnit")})";
- }
- }
- public bool IsSave { get; set; } = false;
- public bool IsNone { get; set; } = false;
- public RecipeConditionCheckSetViewModel()
- {
- RecipeConditions.CreateDefaultValues();
- }
- private int _tempJudgTentTime;
- public int TempJudgTentTime
- {
- get => _tempJudgTentTime;
- set
- {
- _tempJudgTentTime = value;
- NotifyOfPropertyChange("TempJudgTentTime");
- }
- }
- private float _tempMax;
- public float TempMax
- {
- get => _tempMax;
- set
- {
- _tempMax = value;
- NotifyOfPropertyChange("TempMax");
- }
- }
- private float _tempMin;
- public float TempMin
- {
- get => _tempMin;
- set
- {
- _tempMin = value;
- NotifyOfPropertyChange("TempMin");
- }
- }
- private int _pressureJudgTentTime;
- public int PressureJudgTentTime
- {
- get => _pressureJudgTentTime;
- set
- {
- _pressureJudgTentTime = value;
- NotifyOfPropertyChange("PressureJudgTentTime");
- }
- }
- private float _pressureMax;
- public float PressureMax
- {
- get => _pressureMax;
- set
- {
- _pressureMax = value;
- NotifyOfPropertyChange("PressureMax");
- }
- }
- private float _pressureMin;
- public float PressureMin
- {
- get => _pressureMin;
- set
- {
- _pressureMin = value;
- NotifyOfPropertyChange("PressureMin");
- }
- }
- private float _pressureDelayTime;
- public float PressureDelayTime
- {
- get => _pressureDelayTime;
- set
- {
- _pressureDelayTime = value;
- NotifyOfPropertyChange("PressureDelayTime");
- }
- }
- private float _pressureScaleMax;
- public float PressureScaleMax
- {
- get => _pressureScaleMax;
- set
- {
- _pressureScaleMax = value;
- NotifyOfPropertyChange("PressureScaleMax");
- }
- }
- private float _reachTempValue;
- public float ReachTempValue
- {
- get => _reachTempValue;
- set
- {
- _reachTempValue = value;
- RecipeConditions.ReachTempValue = value;
- NotifyOfPropertyChange("ReachTempValue");
- }
- }
- private int _O2DensityValue;
- public int O2DensityValue
- {
- get => _O2DensityValue;
- set
- {
- _O2DensityValue = value;
- RecipeConditions.O2DensityValue = value;
- NotifyOfPropertyChange("O2DensityValue");
- }
- }
- private float _reachPressureValue;
- public float ReachPressureValue
- {
- get => _reachPressureValue;
- set
- {
- _reachPressureValue = value;
- RecipeConditions.ReachPressureValue = value;
- NotifyOfPropertyChange("ReachPressureValue");
- }
- }
- public string PressureUnit { get; set; }
- public string PressureName { get; set; }
- public bool IsEnable => CGlobal.RecipeProcessEditViewEnable;//是否是View模式
- private List<string> _tempAssociateParameterTable;
- private List<string> _tempDisplayName;
- public List<string> TempDisplayName
- {
- get => _tempDisplayName;
- set
- {
- _tempDisplayName = value;
- NotifyOfPropertyChange(nameof(TempDisplayName));
- }
- }
- private bool _isReachTempEnabled;
- public bool IsReachTempEnabled
- {
- get => _isReachTempEnabled;
- set
- {
- _isReachTempEnabled = value;
- NotifyOfPropertyChange("IsReachTempEnabled");
- }
- }
- private bool _isO2DensityEnabled;
- public bool IsO2DensityEnabled
- {
- get => _isO2DensityEnabled;
- set
- {
- _isO2DensityEnabled = value;
- NotifyOfPropertyChange("IsO2DensityEnabled");
- }
- }
- private bool _isReachPressureEnabled;
- public bool IsReachPressureEnabled
- {
- get => _isReachPressureEnabled;
- set
- {
- _isReachPressureEnabled = value;
- NotifyOfPropertyChange("IsReachPressureEnabled");
- }
- }
- private bool _isReachVGEnabled;
- public bool IsReachVGEnabled
- {
- get => _isReachVGEnabled;
- set
- {
- _isReachVGEnabled = value;
- NotifyOfPropertyChange("IsReachVGEnabled");
- }
- }
- private bool _isPressureStabilizeVGEnabled;
- public bool IsPressureStabilizeVGEnabled
- {
- get => _isPressureStabilizeVGEnabled;
- set
- {
- _isPressureStabilizeVGEnabled = value;
- NotifyOfPropertyChange("IsPressureStabilizeVGEnabled");
- }
- }
- #region External In
- [Subscription("PM1.SensorTubeATMPressure.DeviceData")]
- public AITSensorData SensorTubeATMPressure { get; set; }
- [Subscription("System.SensorASOpenPosition.DeviceData")]
- public AITSensorData SensorASOpenPosition { get; set; }
- [Subscription("System.SensorASClosePosition.DeviceData")]
- public AITSensorData SensorASClosePosition { get; set; }
- [Subscription("PM1.SensorEXTIN4.DeviceData")]
- public AITSensorData SensorEXTIN4 { get; set; }
- [Subscription("PM1.SensorEXTIN5.DeviceData")]
- public AITSensorData SensorEXTIN5 { get; set; }
- [Subscription("PM1.SensorEXTIN6.DeviceData")]
- public AITSensorData SensorEXTIN6 { get; set; }
- [Subscription("PM1.SensorEXTIN7.DeviceData")]
- public AITSensorData SensorEXTIN7 { get; set; }
- [Subscription("PM1.SensorEXTIN8.DeviceData")]
- public AITSensorData SensorEXTIN8 { get; set; }
- public string SensorExternalIn1
- {
- get
- {
- if (SensorTubeATMPressure != null)
- return SensorTubeATMPressure.DisplayName;
- return "External1";
- }
- }
- public string SensorExternalIn2
- {
- get
- {
- if (SensorASOpenPosition != null)
- return SensorASOpenPosition.DisplayName;
- return "External2";
- }
- }
- public string SensorExternalIn3
- {
- get
- {
- if (SensorASClosePosition != null)
- return SensorASClosePosition.DisplayName;
- return "External3";
- }
- }
- public string SensorExternalIn4
- {
- get
- {
- if (SensorEXTIN4 != null)
- return SensorEXTIN4.DisplayName;
- return "External4";
- }
- }
- public string SensorExternalIn5
- {
- get
- {
- if (SensorEXTIN5 != null)
- return SensorEXTIN5.DisplayName;
- return "External5";
- }
- }
- public string SensorExternalIn6
- {
- get
- {
- if (SensorEXTIN6 != null)
- return SensorEXTIN6.DisplayName;
- return "External6";
- }
- }
- public string SensorExternalIn7
- {
- get
- {
- if (SensorEXTIN7 != null)
- return SensorEXTIN7.DisplayName;
- return "External7";
- }
- }
- public string SensorExternalIn8
- {
- get
- {
- if (SensorEXTIN8 != null)
- return SensorEXTIN8.DisplayName;
- return "External8";
- }
- }
- #endregion
- protected override void OnViewLoaded(object view)
- {
- base.OnViewLoaded(view);
- UpDataRefresh();
- }
- protected void UpDataRefresh()
- {
- var view = (RecipeConditionCheckSetView)(GetView() as Window).Content;
- var controls = view.gdExternalSensor.Children;
- RecipeConditions.ExternalSensorName[0] = SensorExternalIn1;
- RecipeConditions.ExternalSensorName[1] = SensorExternalIn2;
- RecipeConditions.ExternalSensorName[2] = SensorExternalIn3;
- RecipeConditions.ExternalSensorName[3] = SensorExternalIn4;
- RecipeConditions.ExternalSensorName[4] = SensorExternalIn5;
- RecipeConditions.ExternalSensorName[5] = SensorExternalIn6;
- RecipeConditions.ExternalSensorName[6] = SensorExternalIn7;
- for (int i = 0; i < RecipeConditions.ExternalSensor.Count(); i++)
- {
- foreach (var item in controls)
- {
- if ((item is RadioButton) && ((RadioButton)item).GroupName == $"externalsensor{i + 1}" && (string)((RadioButton)item).Content == RecipeConditions.ExternalSensor[i])
- {
- ((RadioButton)item).IsChecked = true;
- }
- }
- }
- controls = view.gdFinishAutoProfile.Children;
- foreach (var item in controls)
- {
- if ((item is RadioButton) && ((RadioButton)item).GroupName == "FinishAutoProfile" && (string)((RadioButton)item).Content == RecipeConditions.FinishAutoProfile)
- {
- ((RadioButton)item).IsChecked = true;
- }
- }
- controls = view.gdProcessTimeToEnd.Children;
- foreach (var item in controls)
- {
- if ((item is RadioButton) && ((RadioButton)item).GroupName == "ProcessTimeToEnd" && (string)((RadioButton)item).Content == RecipeConditions.ProcessTimeToEnd)
- {
- ((RadioButton)item).IsChecked = true;
- }
- }
- switch (RecipeConditions.ReachTemp)
- {
- case "None":
- view.tempNone.IsChecked = true;
- IsReachTempEnabled = false;
- break;
- case "WaitMoreThan":
- view.tempMore.IsChecked = true;
- IsReachTempEnabled = true;
- break;
- case "WaitLessThan":
- view.tempLess.IsChecked = true;
- IsReachTempEnabled = true;
- break;
- }
- switch (RecipeConditions.O2Density)
- {
- case "None":
- view.o2None.IsChecked = true;
- IsO2DensityEnabled = false;
- break;
- case "WaitLessThan":
- view.o2Less.IsChecked = true;
- IsO2DensityEnabled = true;
- break;
- }
- switch (RecipeConditions.ReachPressure)
- {
- case "None":
- view.pressureNone.IsChecked = true;
- IsReachPressureEnabled = false;
- IsReachVGEnabled = false;
- break;
- case "WaitMoreThan":
- view.pressureMore.IsChecked = true;
- if (RecipeConditions.ReachPressureVG == "VG1")
- view.VG1.IsChecked = true;
- else if (RecipeConditions.ReachPressureVG == "VG3")
- view.VG3.IsChecked = true;
- else
- view.VG2.IsChecked = true;
- IsReachPressureEnabled = true;
- IsReachVGEnabled = true;
- break;
- case "WaitLessThan":
- view.pressureLess.IsChecked = true;
- if (RecipeConditions.ReachPressureVG == "VG1")
- view.VG1.IsChecked = true;
- else if (RecipeConditions.ReachPressureVG == "VG3")
- view.VG3.IsChecked = true;
- else
- view.VG2.IsChecked = true;
- IsReachPressureEnabled = true;
- IsReachVGEnabled = true;
- break;
- }
- if (RecipeConditions.TempStabizeSelected == "None" || RecipeConditions.TempStabizeSelected == null)
- TempStabilizeSelectIndex = 0;
- else
- TempStabilizeSelectIndex = int.Parse(RecipeConditions.TempStabizeSelected);
- var tempSetValue = RecipeConditions.TempStabilizeSets[TempStabilizeSelectIndex][SelectType];
- TempJudgTentTime = tempSetValue.JudgmentTime;
- TempMax = tempSetValue.StabilizeTemperatureMax;
- TempMin = tempSetValue.StabilizeTemperatureMin;
- ReachTempValue = (float)RecipeConditions.ReachTempValue;
- O2DensityValue = RecipeConditions.O2DensityValue;
- ReachPressureValue = (float)RecipeConditions.ReachPressureValue;
- var tempStabizeSelected = RecipeConditions.TempStabizeSelected;
- controls = view.WPlTempStabilize.Children;
- foreach (var item in controls)
- {
- if ((item is RadioButton) && ((RadioButton)item).GroupName == "TempStabilize" && (string)((RadioButton)item).Content == tempStabizeSelected)
- {
- ((RadioButton)item).IsChecked = true;
- }
- }
- if (RecipeConditions.PressureStabilizeSelected == "None" || RecipeConditions.PressureStabilizeSelected == null)
- {
- PressureStabilizeSelectIndex = 0;
- IsPressureStabilizeVGEnabled = false;
- }
- else
- {
- if (RecipeConditions.PressureStabilizeVG == "VG1")
- {
- view.VG4.IsChecked = true;
- RecipeConditions.PressureStabilizeVG = "VG1";
- }
- else if (RecipeConditions.PressureStabilizeVG == "VG3")
- {
- view.VG6.IsChecked = true;
- RecipeConditions.PressureStabilizeVG = "VG3";
- }
- else
- {
- view.VG5.IsChecked = true;
- RecipeConditions.PressureStabilizeVG = "VG2";
- }
- PressureStabilizeSelectIndex = int.Parse(RecipeConditions.PressureStabilizeSelected);
- IsPressureStabilizeVGEnabled = true;
- }
- var pressureSetValue = RecipeConditions.PressureStabilizeSets[PressureStabilizeSelectIndex];
- PressureDelayTime = pressureSetValue.DelayTime;
- PressureScaleMax = pressureSetValue.PressureScaleMax;
- PressureJudgTentTime = pressureSetValue.JudgmentTime;
- PressureMax = pressureSetValue.StabilizePressureMax;
- PressureMin = pressureSetValue.StabilizePressureMin;
- var pressureStabizeSelected = RecipeConditions.PressureStabilizeSelected;
- var pressurecontrols = view.WPlPressureStabilize.Children;
- foreach (var item in pressurecontrols)
- {
- if ((item is RadioButton) && ((RadioButton)item).GroupName == "PressureStabilize" && (string)((RadioButton)item).Content == pressureStabizeSelected)
- {
- ((RadioButton)item).IsChecked = true;
- }
- }
- _tempAssociateParameterTable = new List<string>();
- _tempDisplayName = new List<string>();
- for (int i = 10; i > 0; i--)
- {
- if (i % 2 != 0)
- {
- var displayName = (string)QueryDataClient.Instance.Service.GetConfig($"PM1.Heater.Heater{i}.DisplayName");
- _tempDisplayName.Add(displayName);
- var sssociateParameterTable = (string)QueryDataClient.Instance.Service.GetConfig($"PM1.Heater.Heater{i}.AssociateParameterTable");
- _tempAssociateParameterTable.Add(sssociateParameterTable);
- }
- }
- PressureUnit = (string)QueryDataClient.Instance.Service.GetConfig($"PM1.APC.PressureUnit");
- PressureName = $"Pressure({PressureUnit})";
- for (int i = 0; i < RecipeConditions.ExternalSensor.Count(); i++)
- {
- if (RecipeConditions.ExternalSensor[i] != "None")
- {
- view.rdExternalSensor.IsChecked = true;
- view.ExternalInSensor.Visibility = Visibility.Visible;
- return;
- }
- }
- if (RecipeConditions.TempStabizeSelected != "None")
- {
- view.rdTempStabilize.IsChecked = true;
- view.TempStabilize.Visibility = Visibility.Visible;
- return;
- }
- if (RecipeConditions.FinishAutoProfile != "None")
- {
- view.rdFinishAutoProfile.IsChecked = true;
- view.FinishAutoProfile.Visibility = Visibility.Visible;
- return;
- }
- if (RecipeConditions.ReachTemp != "None")
- {
- view.rdReachTemp.IsChecked = true;
- view.ReachTemp.Visibility = Visibility.Visible;
- return;
- }
- if (RecipeConditions.ReachPressure != "None")
- {
- view.rdReachPressure.IsChecked = true;
- view.ReachPressure.Visibility = Visibility.Visible;
- return;
- }
- if (RecipeConditions.PressureStabilizeSelected != "None")
- {
- view.rdPressureStabilize.IsChecked = true;
- view.PressureStabilize.Visibility = Visibility.Visible;
- return;
- }
- if (RecipeConditions.O2Density != "None")
- {
- view.rdO2Density.IsChecked = true;
- view.O2Density.Visibility = Visibility.Visible;
- return;
- }
- if (RecipeConditions.ProcessTimeToEnd != "None")
- {
- view.rdProcessTimeToEnd.IsChecked = true;
- view.ProcessTimeToEnd.Visibility = Visibility.Visible;
- return;
- }
- view.rdNone.IsChecked = true;
- }
- public int TempStabilizeSelectIndex { get; set; } = 1;
- public int PressureStabilizeSelectIndex { get; set; } = 1;
- private string SelectType { get; set; } = "TOP";
- public void TempStabilizeSelected(object sender)
- {
- if (sender is RadioButton)
- {
- string content = ((RadioButton)sender).Content.ToString();
- var tempIndex = 0;
- if (content != "None")
- {
- tempIndex = int.Parse((string)((RadioButton)sender).Content);
- }
- //if (TempStabilizeSelectIndex != tempIndex)
- {
- TempStabilizeSelectIndex = tempIndex;
- RecipeConditions.TempStabizeSelected = content;
- var tempSetValue = RecipeConditions.TempStabilizeSets[TempStabilizeSelectIndex][SelectType];
- TempJudgTentTime = tempSetValue.JudgmentTime;
- TempMax = tempSetValue.StabilizeTemperatureMax;
- TempMin = tempSetValue.StabilizeTemperatureMin;
- }
- }
- }
- public void PressureStabilizeSelected(object sender)
- {
- if (sender is RadioButton)
- {
- string content = ((RadioButton)sender).Content.ToString();
- var pressureIndex = 0;
- if (content != "None")
- {
- pressureIndex = int.Parse((string)((RadioButton)sender).Content);
- IsPressureStabilizeVGEnabled = true;
- }
- else
- {
- IsPressureStabilizeVGEnabled = false;
- }
- //if (PressureStabilizeSelectIndex != pressureIndex)
- {
- PressureStabilizeSelectIndex = pressureIndex;
- RecipeConditions.PressureStabilizeSelected = content;
- var pressureSetValue = RecipeConditions.PressureStabilizeSets[pressureIndex];
- PressureDelayTime = pressureSetValue.DelayTime;
- PressureScaleMax = pressureSetValue.PressureScaleMax;
- PressureJudgTentTime = pressureSetValue.JudgmentTime;
- PressureMax = pressureSetValue.StabilizePressureMax;
- PressureMin = pressureSetValue.StabilizePressureMin;
- }
- }
- }
- public void TempStabilizeTypeSelected(object sender, object value)
- {
- if (sender is RadioButton)
- {
- var tempType = _tempAssociateParameterTable[int.Parse(value.ToString())];
- if (tempType != SelectType)
- {
- RecipeConditions.TempStabilizeSets[TempStabilizeSelectIndex][SelectType].JudgmentTime = TempJudgTentTime;
- RecipeConditions.TempStabilizeSets[TempStabilizeSelectIndex][SelectType].StabilizeTemperatureMax = TempMax;
- RecipeConditions.TempStabilizeSets[TempStabilizeSelectIndex][SelectType].StabilizeTemperatureMin = TempMin;
- SelectType = tempType;
- var tempSetValue = RecipeConditions.TempStabilizeSets[TempStabilizeSelectIndex][SelectType];
- TempJudgTentTime = tempSetValue.JudgmentTime;
- TempMax = tempSetValue.StabilizeTemperatureMax;
- TempMin = tempSetValue.StabilizeTemperatureMin;
- }
- }
- }
- public void RecipeConditionCheckSubCommand(object sender, object value, object index, object vgIndex)
- {
- if (sender is RadioButton)
- {
- string content = ((RadioButton)sender).Content.ToString();
- switch (value.ToString())
- {
- case "ExternalSensor":
- RecipeConditions.ExternalSensor[int.Parse(index.ToString())] = content;
- break;
- case "FinishAutoProfile":
- RecipeConditions.FinishAutoProfile = content;
- break;
- case "Temp":
- RecipeConditions.ReachTemp = index.ToString();
- if (content == "None")
- IsReachTempEnabled = false;
- else
- IsReachTempEnabled = true;
- break;
- case "Pressure":
- RecipeConditions.ReachPressure = index.ToString();
- RecipeConditions.ReachPressureVG = vgIndex.ToString();
- if (content == "None")
- {
- IsReachPressureEnabled = false;
- IsReachVGEnabled = false;
- }
- else
- {
- IsReachPressureEnabled = true;
- IsReachVGEnabled = true;
- }
- break;
- case "Pressure Stabilize":
- RecipeConditions.PressureStabilizeVG = vgIndex.ToString();
- break;
- case "O2":
- RecipeConditions.O2Density = index.ToString();
- if (content == "None")
- IsO2DensityEnabled = false;
- else
- IsO2DensityEnabled = true;
- break;
- case "ProcessTimeToEnd":
- RecipeConditions.ProcessTimeToEnd = content;
- break;
- }
- }
- }
- public void RecipeConditionCheckCommand(string commandName)
- {
- HideAllControl();
- var temp = (RecipeConditionCheckSetView)(GetView() as Window).Content;
- IsNone = false;
- switch (commandName)
- {
- case "externalsensor":
- temp.ExternalInSensor.Visibility = Visibility.Visible;
- break;
- case "tempstabilize":
- temp.TempStabilize.Visibility = Visibility.Visible;
- break;
- case "finishautoprofile":
- temp.FinishAutoProfile.Visibility = Visibility.Visible;
- break;
- case "reachtemp":
- temp.ReachTemp.Visibility = Visibility.Visible;
- break;
- case "reachpressure":
- temp.ReachPressure.Visibility = Visibility.Visible;
- break;
- case "pressurestabilize":
- temp.PressureStabilize.Visibility = Visibility.Visible;
- break;
- case "O2Density":
- temp.O2Density.Visibility = Visibility.Visible;
- break;
- case "processTimeToEnd":
- temp.ProcessTimeToEnd.Visibility = Visibility.Visible;
- break;
- case "none":
- IsNone = true;
- break;
- default:
- break;
- }
- }
- public bool ConditionCheck()
- {
- bool isNone = true;
- if (RecipeConditions.ProcessTimeToEnd != "None")
- return false;
- if (RecipeConditions.O2Density != "None")
- return false;
- if (RecipeConditions.PressureStabilizeSelected != "None")
- return false;
- if (RecipeConditions.ReachPressure != "None")
- return false;
- if (RecipeConditions.ReachTemp != "None")
- return false;
- if (RecipeConditions.FinishAutoProfile != "None")
- return false;
- if (RecipeConditions.TempStabizeSelected != "None")
- return false;
- for (int i = 0; i < RecipeConditions.ExternalSensor.Count(); i++)
- {
- if (RecipeConditions.ExternalSensor[i] != "None")
- return false;
- }
- return isNone;
- }
- public void HideAllControl()
- {
- var temp = (RecipeConditionCheckSetView)(GetView() as Window).Content;
- temp.ExternalInSensor.Visibility = Visibility.Hidden;
- temp.TempStabilize.Visibility = Visibility.Hidden;
- temp.FinishAutoProfile.Visibility = Visibility.Hidden;
- temp.ReachTemp.Visibility = Visibility.Hidden;
- temp.ReachPressure.Visibility = Visibility.Hidden;
- temp.PressureStabilize.Visibility = Visibility.Hidden;
- temp.O2Density.Visibility = Visibility.Hidden;
- temp.ProcessTimeToEnd.Visibility = Visibility.Hidden;
- }
- public void ConditionCheckSave()
- {
- IsSave = true;
- if (!IsNone)
- IsNone = ConditionCheck();
- if (IsNone)
- {
- for (int i = 0; i < RecipeConditions.ExternalSensor.Count(); i++)
- {
- RecipeConditions.ExternalSensor[i] = "None";
- }
- RecipeConditions.TempStabizeSelected = "None";
- RecipeConditions.FinishAutoProfile = "None";
- RecipeConditions.ReachTemp = "None";
- RecipeConditions.ReachTempValue = 0;
- RecipeConditions.O2Density = "None";
- RecipeConditions.O2DensityValue = 0;
- RecipeConditions.ReachPressure = "None";
- RecipeConditions.ReachPressureVG = "";
- RecipeConditions.ReachPressureValue = 0;
- RecipeConditions.PressureStabilizeSelected = "None";
- }
- if (string.IsNullOrEmpty(RecipeConditions.PressureStabilizeVG))
- RecipeConditions.PressureStabilizeVG = "VG1";
- if (string.IsNullOrEmpty(RecipeConditions.ReachPressureVG))
- RecipeConditions.ReachPressureVG = "VG1";
- (GetView() as Window).Close();
- }
- public void ConditionCheckCancel()
- {
- IsSave = false;
- (GetView() as Window).Close();
- }
- }
- public class RecipeCondition : PropertyChangedBase
- {
- public RecipeCondition()
- {
- }
- string[] externalsensorname = new string[7];
- public string[] ExternalSensorName
- {
- get => externalsensorname;
- set
- {
- externalsensorname = value;
- NotifyOfPropertyChange("ExternalSensorName");
- }
- }
- string[] externalsensor = new string[7];
- public string[] ExternalSensor
- {
- get => externalsensor;
- set
- {
- externalsensor = value;
- NotifyOfPropertyChange("ExternalSensor");
- }
- }
- public string FinishAutoProfile { get; set; }
- public string TempStabizeSelected { get; set; }
- public string ReachTemp { get; set; }
- public string O2Density { get; set; }
- public double ReachTempValue { get; set; }
- public int O2DensityValue { get; set; }
- public string ReachPressure { get; set; }
- public string ReachPressureVG { get; set; }
- public string PressureStabilizeVG { get; set; }
- public double ReachPressureValue { get; set; }
- public string PressureStabilizeSelected { get; set; }
- public string ProcessTimeToEnd { get; set; }
- public void CreateDefaultValues()
- {
- ExternalSensor = new string[] { "None", "None", "None", "None", "None", "None", "None" };
- TempStabilizeSets.Clear();
- ReachTempSets.Clear();
- ReachPressureSets.Clear();
- PressureStabilizeSets.Clear();
- for (int i = 0; i < 6; i++)
- {
- Dictionary<string, TempSetValues> tempSets = new Dictionary<string, TempSetValues>();
- tempSets.Add("TOP", new TempSetValues() { JudgmentTime = 0, StabilizeTemperatureMin = 0, StabilizeTemperatureMax = 0 });
- tempSets.Add("C3", new TempSetValues() { JudgmentTime = 0, StabilizeTemperatureMin = 0, StabilizeTemperatureMax = 0 });
- tempSets.Add("C2", new TempSetValues() { JudgmentTime = 0, StabilizeTemperatureMin = 0, StabilizeTemperatureMax = 0 });
- tempSets.Add("C1", new TempSetValues() { JudgmentTime = 0, StabilizeTemperatureMin = 0, StabilizeTemperatureMax = 0 });
- tempSets.Add("BTM", new TempSetValues() { JudgmentTime = 0, StabilizeTemperatureMin = 0, StabilizeTemperatureMax = 0 });
- TempStabilizeSets.Add(i, tempSets);
- PressureStabilizeSets.Add(i, new PressureSetValues() { DelayTime = 0, JudgmentTime = 0, StabilizePressureMin = 0, StabilizePressureMax = 0, PressureScaleMax = 0.0f });
- }
- for (int i = 0; i < TempStabilizeSets.Count; i++)
- {
- if (i == 0) continue;
- foreach (var subItem in TempStabilizeSets[i])
- {
- string strHeader = "PM1.RecipeEditParameter.TempStabilizeTable";
- subItem.Value.JudgmentTime = Convert.ToInt32(SystemConfigProvider.Instance.GetValueByName($"{strHeader}.Table{i}.{subItem.Key}.JudgmentTime"));
- subItem.Value.StabilizeTemperatureMin = Convert.ToInt32(SystemConfigProvider.Instance.GetValueByName($"{strHeader}.Table{i}.{subItem.Key}.MinValue"));
- subItem.Value.StabilizeTemperatureMax = Convert.ToInt32(SystemConfigProvider.Instance.GetValueByName($"{strHeader}.Table{i}.{subItem.Key}.MaxValue"));
- }
- {
- string strHeader = "PM1.RecipeEditParameter.PressureStabilizeTable";
- PressureStabilizeSets[i].PressureScaleMax = float.Parse(SystemConfigProvider.Instance.GetValueByName($"{strHeader}.Table{i}.MaxScale"));
- var unit = QueryDataClient.Instance.Service.GetConfig($"{strHeader}.Table{i}.MaxScale");
- PressureStabilizeSets[i].DelayTime = Convert.ToInt32(SystemConfigProvider.Instance.GetValueByName($"{strHeader}.Table{i}.DelayTime"));
- PressureStabilizeSets[i].StabilizePressureMax = Convert.ToInt32(SystemConfigProvider.Instance.GetValueByName($"{strHeader}.Table{i}.MaxValue"));
- PressureStabilizeSets[i].StabilizePressureMin = Convert.ToInt32(SystemConfigProvider.Instance.GetValueByName($"{strHeader}.Table{i}.MinValue"));
- PressureStabilizeSets[i].JudgmentTime = Convert.ToInt32(SystemConfigProvider.Instance.GetValueByName($"{strHeader}.Table{i}.JudgmentTime"));
- }
- }
- ReachTempSets.Add("Upper", new ReachAndUsedIntValues() { IsUsed = true, TempValue = 600 });
- ReachTempSets.Add("Lower", new ReachAndUsedIntValues() { IsUsed = true, TempValue = 300 });
- ReachPressureSets.Add("Upper", new ReachAndUsedFloatValues() { IsUsed = true, TempValue = 1.0f });
- ReachPressureSets.Add("Lower", new ReachAndUsedFloatValues() { IsUsed = true, TempValue = 0.1f });
- }
- public Dictionary<int, Dictionary<string, TempSetValues>> TempStabilizeSets = new Dictionary<int, Dictionary<string, TempSetValues>>();
- public Dictionary<string, ReachAndUsedIntValues> ReachTempSets = new Dictionary<string, ReachAndUsedIntValues>();
- public Dictionary<string, ReachAndUsedFloatValues> ReachPressureSets = new Dictionary<string, ReachAndUsedFloatValues>();
- public Dictionary<int, PressureSetValues> PressureStabilizeSets = new Dictionary<int, PressureSetValues>();
- }
- public class PressureSetValues : PropertyChangedBase
- {
- float _pressureScaleMax;
- public float PressureScaleMax
- {
- get => _pressureScaleMax;
- set
- {
- _pressureScaleMax = value;
- NotifyOfPropertyChange("PressureScaleMax");
- }
- }
- int _judgmentTime;
- public int JudgmentTime
- {
- get => _judgmentTime;
- set
- {
- _judgmentTime = value;
- NotifyOfPropertyChange("JudgmentTime");
- }
- }
- int _delayTime;
- public int DelayTime
- {
- get => _delayTime;
- set
- {
- _delayTime = value;
- NotifyOfPropertyChange("DelayTime");
- }
- }
- float _stabilizePressureMax;
- public float StabilizePressureMax
- {
- get => _stabilizePressureMax;
- set
- {
- _stabilizePressureMax = value;
- NotifyOfPropertyChange("StabilizePressureMax");
- }
- }
- float _stabilizePressureMin;
- public float StabilizePressureMin
- {
- get => _stabilizePressureMin;
- set
- {
- _stabilizePressureMin = value;
- NotifyOfPropertyChange("StabilizePressureMin");
- }
- }
- }
- public class TempSetValues : PropertyChangedBase
- {
- int _judgmentTime;
- public int JudgmentTime
- {
- get => _judgmentTime;
- set
- {
- _judgmentTime = value;
- NotifyOfPropertyChange("JudgmentTime");
- }
- }
- float _stabilizeTemperatureMax;
- public float StabilizeTemperatureMax
- {
- get => _stabilizeTemperatureMax;
- set
- {
- _stabilizeTemperatureMax = value;
- NotifyOfPropertyChange("StabilizeTemperatureMax");
- }
- }
- float _stabilizeTemperatureMin;
- public float StabilizeTemperatureMin
- {
- get => _stabilizeTemperatureMin;
- set
- {
- _stabilizeTemperatureMin = value;
- NotifyOfPropertyChange("StabilizeTemperatureMin");
- }
- }
- }
- public class ReachAndUsedIntValues : PropertyChangedBase
- {
- bool _isUsed;
- public bool IsUsed
- {
- get => _isUsed;
- set
- {
- _isUsed = value;
- NotifyOfPropertyChange("IsUsed");
- }
- }
- int _tempValue;
- public int TempValue
- {
- get => _tempValue;
- set
- {
- _tempValue = value;
- NotifyOfPropertyChange("TempValue");
- }
- }
- }
- public class ReachAndUsedFloatValues : PropertyChangedBase
- {
- bool _isUsed;
- public bool IsUsed
- {
- get => _isUsed;
- set
- {
- _isUsed = value;
- NotifyOfPropertyChange("IsUsed");
- }
- }
- float _tempValue;
- public float TempValue
- {
- get => _tempValue;
- set
- {
- _tempValue = value;
- NotifyOfPropertyChange("TempValue");
- }
- }
- }
- }
|