Browse Source

MFC 设定值超限 归零

jiangjy 1 month ago
parent
commit
8607ede86d

+ 14 - 4
Furnace/FurnaceUI/Views/Operations/Maintenances/ManualSetViewModel.cs

@@ -19,6 +19,7 @@ using MECF.Framework.UI.Client.CenterViews.Dialogs;
 using MECF.Framework.UI.Client.CenterViews.Editors.Recipe;
 using MECF.Framework.UI.Client.ClientBase;
 using OpenSEMI.ClientBase;
+using OpenSEMI.Ctrlib.Controls;
 using RecipeEditorLib.RecipeModel.Params;
 using System;
 using System.Collections.Generic;
@@ -1687,6 +1688,15 @@ namespace FurnaceUI.Views.Recipes
                     AITMfcData aITMfcData = (AITMfcData)property.GetValue(this);
                     double setValue = 0;
                     double.TryParse(value, out setValue);
+                    if (setValue > mFCData.MaxValue && type == "Value")
+                    {
+                        DialogBox.ShowWarning($"{mFCData.Name} Out of the setting range {0}~{mFCData.MaxValue}!");
+                        ((TextBoxEx)sender).ChangedColor = ((TextBoxEx)sender).NormalColor;
+                        ((TextBoxEx)sender).Text = $"0";
+                        return;
+                    }
+
+
                     switch (type)
                     {
                         case "Value":
@@ -2306,9 +2316,9 @@ namespace FurnaceUI.Views.Recipes
         }
 
 
-        private string _maxValue;
+        private double _maxValue;
 
-        public string MaxValue
+        public double MaxValue
         {
             get => _maxValue; set
             {
@@ -2317,9 +2327,9 @@ namespace FurnaceUI.Views.Recipes
             }
         }
 
-        private string _minValue;
+        private double _minValue;
 
-        public string MinValue
+        public double MinValue
         {
             get => _minValue; set
             {

+ 48 - 2
Furnace/FurnaceUI/Views/Recipes/RecipeProcessEditViewModel.cs

@@ -20,6 +20,7 @@ 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 OpenSEMI.Ctrlib.Controls;
 using RecipeEditorLib.RecipeModel.Params;
 using SciChart.Core.Extensions;
 using System;
@@ -1439,20 +1440,39 @@ namespace FurnaceUI.Views.Recipes
                     AppendStep2();
                     break;
                 case "InsertCopy":
+                 
                     InsertCopyStep();
                     break;
                 case "OverWrite"://任何步骤的内容都可以覆盖到选定的步骤中
                     OverWriteStep();
                     break;
                 case "PrevStepOverwrite"://用上一步的内容覆盖所选步骤
+                    if (DialogButton.No == DialogBox.ShowDialog(DialogButton.Yes | DialogButton.No,
+                        DialogType.CONFIRM,
+                        $"Make sure to PrevStep Overwrite the selected step?"))
+                    {
+                        return;
+                    }
                     PrevStepOverwriteStep();
                     break;
                 case "PrevStepInsert"://在选定步骤之前,插入带有前一步内容的新步骤。
+                    if (DialogButton.No == DialogBox.ShowDialog(DialogButton.Yes | DialogButton.No,
+                      DialogType.CONFIRM,
+                      $"Make sure to PrevStep nsert the selected step?"))
+                    {
+                        return;
+                    }
                     InsertPrevStep();
                     break;
                 case "PrevStepItem":
                     break;
                 case "CurrStepDelete":
+                    if (DialogButton.No == DialogBox.ShowDialog(DialogButton.Yes | DialogButton.No,
+                          DialogType.CONFIRM,
+                          $"Make sure to delete the selected step?"))
+                    {
+                        return;
+                    }
                     if (SelectedRecipeStep == null || CurrentRecipe == null)
                     { return; }
                     CurrDeleteStep();
@@ -2748,7 +2768,16 @@ namespace FurnaceUI.Views.Recipes
                 switch (type)
                 {
                     case "Value":
-                        InvokeClient.Instance.Service.DoOperation($"PM1.{mFCData.ControlName}.SetMfcVirtualValue", $"{value};{mFCData.Rampng.Value};{mFCData.AlarmValue}");
+                        double setValue = 0;
+                        double.TryParse(value, out setValue);
+                        double.TryParse(mFCData.ScaleValue, out double maxData);
+                        if (setValue > maxData)
+                        {
+                            DialogBox.ShowWarning($"{mFCData.ControlName} Out of the setting range {0}~{maxData}!");
+                            ((TextBoxEx)sender).ChangedColor = ((TextBoxEx)sender).NormalColor;
+                            SetSetPointValue(mFCData.ControlName, $"0");
+                            return;
+                        }
                         break;
                     case "Rampng":
                         InvokeClient.Instance.Service.DoOperation($"PM1.{mFCData.ControlName}.SetMfcVirtualValue", $"{mFCData.SetValue.Value};{value};{mFCData.AlarmValue}");
@@ -2759,7 +2788,24 @@ namespace FurnaceUI.Views.Recipes
                 }
             }
         }
-
+        private void SetSetPointValue(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.SetValue.SetValue(value);
+                    }
+                }
+            }
+        }
         public void PressTextChanged(string type, object sender, object item)
         {
             if (!string.IsNullOrEmpty(type) && item != null && sender != null)