Browse Source

fix LeakCheckStatus记录入库

jiangjy 1 day ago
parent
commit
5e3a9738f5

+ 1 - 0
FrameworkLocal/Common/Common.csproj

@@ -239,6 +239,7 @@
     <Compile Include="CommonData\DeviceData\AITWaterMappingData.cs" />
     <Compile Include="CommonData\DeviceData\AITWaterFlowSensorData.cs" />
     <Compile Include="CommonData\DeviceData\IDeviceData.cs" />
+    <Compile Include="CommonData\EnumData\LeakCheckStatusEnum.cs" />
     <Compile Include="CommonData\EnumData\MaintenanceProcessingCommandEnum.cs" />
     <Compile Include="CommonData\EnumData\RecipeExecEntryEnum.cs" />
     <Compile Include="CommonData\EnumData\RecipeTypeEnum.cs" />

+ 40 - 0
FrameworkLocal/Common/CommonData/EnumData/LeakCheckStatusEnum.cs

@@ -0,0 +1,40 @@
+using Aitex.Core.RT.Log;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Data;
+using System.Windows.Media;
+
+namespace MECF.Framework.Common.CommonData.EnumData
+{
+    public enum LeakCheckStatusEnum
+    {
+
+        None = 0,
+        BasePressureCheck = 10,
+        LeakCheck = 20,
+        LeakCheckDelay = 30,
+    }
+
+    public class LeakCheckStatusColorConverter : IValueConverter
+    {
+        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            if (value is int intValue)
+            {
+                var status = (LeakCheckStatusEnum)intValue;
+                return status.ToString();
+            }
+
+            throw new ArgumentException("Invalid type", nameof(value));
+        }
+
+        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            throw new NotImplementedException();
+        }
+    }
+}

+ 1 - 0
Furnace/FurnaceRT/Config/FurnaceGemModel.xml

@@ -711,6 +711,7 @@
     <SVID id="332880048" valueType="Boolean" logicalName="PM1.RunningModeIsDebug" value="" eventTrigger="" units="" description="" isArray="false" />
     <SVID id="332880049" valueType="Ascii" logicalName="PM1.SubRecipeCurrentLoopCount" value="" eventTrigger="" units="" description="" isArray="false" />
     <SVID id="332880050" valueType="Ascii" logicalName="PM1.SubRecipeLoopCount" value="" eventTrigger="" units="" description="" isArray="false" />
+    <SVID id="332880051" valueType="Ascii" logicalName="PM1.LeakCheckStatus" value="" eventTrigger="" units="" description="" isArray="false" />
     <SVID id="332890001" valueType="Boolean" logicalName="PM1.CMNT.Feedback" value="" eventTrigger="" units="" description="" isArray="false" />
     <SVID id="332890002" valueType="Boolean" logicalName="PM1.CMNT.SetPoint" value="" eventTrigger="" units="" description="" isArray="false" />
     <SVID id="332900001" valueType="F8" logicalName="PM1.ConcentrationO2.Value" value="" eventTrigger="" units="" description="" isArray="false" />

File diff suppressed because it is too large
+ 1 - 1
Furnace/FurnaceRT/Config/VIDs/_SVID.xml


+ 25 - 23
Furnace/FurnaceRT/Equipments/PMs/PMLeakCheck.cs

@@ -25,6 +25,7 @@ namespace FurnaceRT.Equipments.PMs
 {
     public partial class PMModule
     {
+
         private string _currentLeakCheckFileName = "";
         private Dictionary<int, LeakCheckTableParameter> _leakCheckDic;
         private int _currentRetryCount = 0;
@@ -38,7 +39,7 @@ namespace FurnaceRT.Equipments.PMs
         private bool _isLeakCheckFinished = false;
         private Stopwatch _leakCheckDelayTimer = new Stopwatch();
         private Stopwatch _leakCheckTimer = new Stopwatch();
-        private string _leakCheckStatus = "None";
+        private int _leakCheckStatus = (int)LeakCheckStatusEnum.None;
         private LeakCheckTableParameter _leakCheckTableParameter = null;
         private void InitLeakCheckData()
         {
@@ -60,7 +61,7 @@ namespace FurnaceRT.Equipments.PMs
             DATA.Subscribe($"{Module}.LeakCheckLeakLimit", () => _leakCheckTableParameter != null ? _leakCheckTableParameter.LeakLimit : 0.0f);
             DATA.Subscribe($"{Module}.LeakCheckDelayMonitorPressure", () => _leakCheckTableParameter != null && _leakCheckDelayTimer.IsRunning && !_leakCheckTimer.IsRunning ? (float)_leakCheckDelayMonitorPressure : 0.0f);
             DATA.Subscribe($"{Module}.LeakCheckDelayStartPressure", () => _leakCheckTableParameter != null && _leakCheckDelayTimer.IsRunning ? (float)_leakCheckDelayStartPressure : 0.0f);
-            DATA.Subscribe($"{Module}.LeakCheckMonitorPressure", () => _leakCheckTableParameter != null && _leakCheckTimer.IsRunning && !_leakCheckDelayTimer.IsRunning  ? (float)_leakCheckMonitorPressure : 0.0f);
+            DATA.Subscribe($"{Module}.LeakCheckMonitorPressure", () => _leakCheckTableParameter != null && _leakCheckTimer.IsRunning && !_leakCheckDelayTimer.IsRunning ? (float)_leakCheckMonitorPressure : 0.0f);
             DATA.Subscribe($"{Module}.LeakCheckStartPressure", () => _leakCheckTableParameter != null && !_leakCheckDelayTimer.IsRunning && _leakCheckTimer.IsRunning ? (float)_leakCheckStartPressure : 0.0f);
             DATA.Subscribe($"{Module}.LeakCheckActualLeak", () => (float)_leakCheckActualLeak);
             DATA.Subscribe($"{Module}.LeakCheckRetryCurrentCount", () => _currentRetryCount);
@@ -74,7 +75,6 @@ namespace FurnaceRT.Equipments.PMs
             _basePressure = -1;
             _isLeakCheckFinished = false;
             _leakCheckActualLeak = 0;
-            _leakCheckDelayStartPressure = 0;
             _leakCheckDelayMonitorPressure = 0;
             _leakCheckStartPressure = 0;
 
@@ -86,7 +86,7 @@ namespace FurnaceRT.Equipments.PMs
             if (!ret)
                 return;
 
-            _leakCheckStatus = "BasePressureCheck";
+            _leakCheckStatus = (int)LeakCheckStatusEnum.BasePressureCheck;
 
             _currentLeakCheckIndex = index;
             _basePressure = _leakCheckTableParameter.PressureSensor.Value;
@@ -120,7 +120,7 @@ namespace FurnaceRT.Equipments.PMs
         }
         public void InitLeakCheck(string fileName)
         {
-            _leakCheckStatus = "None";
+            _leakCheckStatus = (int)LeakCheckStatusEnum.None;
             _currentRetryCount = 0;
             if (string.IsNullOrEmpty(fileName))
             {
@@ -246,27 +246,24 @@ namespace FurnaceRT.Equipments.PMs
         }
         public bool CheckLeakCheckFinish()
         {
-            if (_leakCheckStatus == "None")//没在leakCheck状态
+
+
+            if (_leakCheckDic == null || _currentLeakCheckIndex < 0)
+                return true;
+
+            if (_isLeakCheckFinished)
             {
+                StopLeakCheckTimer();
+
                 _currentRetryCount = 0;
                 return true;
             }
 
-            if (_leakCheckDic == null || _currentLeakCheckIndex < 0)
-                return true;
-
             var ret = _leakCheckDic.TryGetValue(_currentLeakCheckIndex, out var leakCheckParameter);
             if (!ret)
                 return true;
 
-            if (_isLeakCheckFinished)
-            {
-                if (_leakCheckDelayTimer.IsRunning)
-                    _leakCheckDelayTimer.Stop();
 
-                if (_leakCheckTimer.IsRunning)
-                    _leakCheckTimer.Stop();
-            }
 
             if (!_leakCheckDelayTimer.IsRunning && !_leakCheckTimer.IsRunning)
             {
@@ -276,7 +273,7 @@ namespace FurnaceRT.Equipments.PMs
 
             if (_leakCheckDelayTimer.IsRunning && _leakCheckDelayTimer.ElapsedMilliseconds >= leakCheckParameter.DelayTime * 1000)
             {
-                _leakCheckStatus = "LeakCheck";
+                _leakCheckStatus = (int)LeakCheckStatusEnum.LeakCheck;
                 if (!_leakCheckTimer.IsRunning)
                 {
                     _leakCheckDelayMonitorPressure = leakCheckParameter.PressureSensor.Value;
@@ -291,8 +288,8 @@ namespace FurnaceRT.Equipments.PMs
                 if (!_leakCheckTimer.IsRunning)
                 {
                     _leakCheckDelayMonitorPressure = leakCheckParameter.PressureSensor.Value;
-                    _leakCheckStatus = "LeakCheckDelay";
-           
+                    _leakCheckStatus = (int)LeakCheckStatusEnum.LeakCheckDelay;
+
 
                 }
             }
@@ -335,7 +332,7 @@ namespace FurnaceRT.Equipments.PMs
                 {
 
                     _isLeakCheckFinished = true;
-                    _leakCheckStatus = "None";
+                    _leakCheckStatus = (int)LeakCheckStatusEnum.None;
                     _leakCheckTimer.Stop();
                     _leakCheckDelayTimer.Stop();
                     LOG.Write($"Leak check completed, leak rate={_leakCheckActualLeak}, delay time={leakCheckParameter.DelayTime}, check time={leakCheckParameter.CheckTime}, leak limit={leakCheckParameter.LeakLimit}, retry info={_currentRetryCount}/{leakCheckParameter.RetryLimit}");
@@ -346,8 +343,13 @@ namespace FurnaceRT.Equipments.PMs
         }
         public void AbortLeakCheck()
         {
-            _leakCheckStatus = "None";
-         
+            _leakCheckStatus = (int)LeakCheckStatusEnum.None;
+            _currentRetryCount = 0;
+            StopLeakCheckTimer();
+        }
+        public void StopLeakCheckTimer()
+        {
+
             if (_leakCheckDelayTimer.IsRunning)
                 _leakCheckDelayTimer.Stop();
 
@@ -357,7 +359,7 @@ namespace FurnaceRT.Equipments.PMs
         private void ProcessLeakCheckErrorCommand(string command)
         {
             _isLeakCheckFinished = true;
-            _leakCheckStatus = "None";
+            _leakCheckStatus = (int)LeakCheckStatusEnum.None;
             var recipe = "";
             var recipeType = "";
             var recipeTable = "";

+ 1 - 1
Furnace/FurnaceRT/Equipments/PMs/RecipeExecutions/Process.cs

@@ -1264,7 +1264,7 @@ namespace FurnaceRT.Equipments.PMs.RecipeExecutions
         }
         public void JumpCurrentRecipeStep(int stepNumber, string stepName, bool isAlarmConditionCall = false)
         {
-            PMModule.AbortLeakCheck();
+            PMModule.StopLeakCheckTimer();
             LOG.Write($"Jump to step stepNumber={stepNumber} stepName={stepName}, currentStepNumber={_currentStepNumber}");
             if (_state == RecipeRunningState.ConditionWait || _state == RecipeRunningState.TimeWait ||
                 _state == RecipeRunningState.Paused || _state == RecipeRunningState.ExecStep)

+ 3 - 1
Furnace/FurnaceUI/Views/Operations/PressureDetailView.xaml

@@ -6,9 +6,11 @@
              xmlns:deviceControl="clr-namespace:Aitex.Core.UI.DeviceControl;assembly=MECF.Framework.UI.Core"
               xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"    xmlns:cal="http://www.caliburn.org" 
              xmlns:controls2="clr-namespace:MECF.Framework.UI.Client.IndustrialControl;assembly=MECF.Framework.UI.Client"
+           xmlns:enumData="clr-namespace:MECF.Framework.Common.CommonData.EnumData;assembly=MECF.Framework.Common"
              mc:Ignorable="d" 
              Height="820" Width="1200" FontFamily="Segoe" >
     <UserControl.Resources>
+        <enumData:LeakCheckStatusColorConverter x:Key="LeakCheckStatusColorConverter" />
         <Style TargetType="Border" BasedOn="{StaticResource WrapBorder}">
             <Setter Property="Background" Value="{StaticResource Area_BG_2}"/>
             <Setter Property="BorderBrush" Value="Black"/>
@@ -240,7 +242,7 @@
                                 <Border>
                                     <Label Content="Leak Check&#13;Status:"/>
                                 </Border>
-                                 <TextBox  Tag="None"  IsReadOnly="True"     Text="{Binding LeakCheckStatus}"/>
+                                <TextBox  Tag="None"  IsReadOnly="True"     Text="{Binding LeakCheckStatus,Converter={StaticResource LeakCheckStatusColorConverter}}"/>
                             </StackPanel>
                             <StackPanel Orientation="Horizontal" >
                                 <Border>

+ 6 - 5
Furnace/FurnaceUI/Views/Operations/PressureDetailViewModel.cs

@@ -3,6 +3,7 @@ using Aitex.Core.Util;
 using Caliburn.Micro;
 using FurnaceUI.Client.Dialog;
 using FurnaceUI.Models;
+using MECF.Framework.Common.CommonData.EnumData;
 using MECF.Framework.Common.DataCenter;
 using System.Collections.Generic;
 
@@ -34,7 +35,7 @@ namespace FurnaceUI.Views.Operations
         [Subscription("PM1.LeakCheckActualLeak")] public float LeakCheckActualLeak { get; set; }
         [Subscription("PM1.LeakCheckRetryCurrentCount")] public int LeakCheckRetryCurrentCount { get; set; }
         [Subscription("PM1.LeakCheckRetryLimit")] public int LeakCheckRetryLimit { get; set; }
-        [Subscription("PM1.LeakCheckStatus")] public string LeakCheckStatus { get; set; }
+        [Subscription("PM1.LeakCheckStatus")] public int LeakCheckStatus { get; set; }
 
         private float _leakCheckDelayProGress = 0;
         public float LeakCheckDelayProGress
@@ -66,19 +67,19 @@ namespace FurnaceUI.Views.Operations
         {
             base.InvokeAfterUpdateProperty(data);
 
-            if (LeakCheckStatus == "LeakCheckDelay")
+            if (LeakCheckStatus == (int)LeakCheckStatusEnum.LeakCheckDelay)
             {
                 LeakCheckProGress = 0;
                 LeakCheckDelayProGress = LeakCheckDelayElapseTime > 0 ? (LeakCheckDelayElapseTime / LeakCheckDelayTime) * 100.0f : 0;
 
             }
-            if (LeakCheckStatus == "LeakCheck")
+            if (LeakCheckStatus == (int)LeakCheckStatusEnum.LeakCheck)
             {
                 LeakCheckDelayProGress = 0;
-                LeakCheckProGress = (LeakCheckElapseTime > 0 ) ? (LeakCheckElapseTime / LeakCheckCheckTime) * 100.0f : 0;
+                LeakCheckProGress = (LeakCheckElapseTime > 0) ? (LeakCheckElapseTime / LeakCheckCheckTime) * 100.0f : 0;
 
             }
-            if (LeakCheckStatus == "None")
+            if (LeakCheckStatus == (int)LeakCheckStatusEnum.None)
             {
                 LeakCheckDelayProGress = LeakCheckProGress = 0;
             }