From 4ba62bfbbf75c4c8a1f5d31d9111627863381791 Mon Sep 17 00:00:00 2001 From: SL <123@123.com> Date: Tue, 15 Aug 2023 15:36:38 +0800 Subject: [PATCH] =?UTF-8?q?[UI.Core]=20=E7=A7=BB=E9=99=A4EngMode=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E7=9A=84Converters=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [UI.Client] ModuleStatusIndicator对象增加Warning图标和Warning图标Tips。 [RT.Equipment] PMModuleBase对象新增IsInterlockBypassed属性,用于指示PM模组是否旁路互锁。 --- .../Interlock/InterlockDaemonManager.cs | 10 ++++-- .../MECF/Framework/Common/IOCore/IoManager.cs | 4 +-- .../LogicUnits/PMs/PMModuleBase.cs | 9 +++--- .../Modules/PM/PMProcessViewModel.cs | 12 +++---- .../Controls/ModuleStatusIndicator.xaml | 30 ++++++++++++------ .../Controls/ModuleStatusIndicator.xaml.cs | 25 +++++++++++---- .../Converters/EngModeToBdColorConverter.cs | 28 ----------------- .../EngModeToBdThicknessConverter.cs | 31 ------------------- ...EngModeToBgWatermarkVisibilityConverter.cs | 28 ----------------- .../MECF.Framework.UI.Core.csproj | 3 -- 10 files changed, 58 insertions(+), 122 deletions(-) delete mode 100644 MECF.Framework.UI.Core/Converters/EngModeToBdColorConverter.cs delete mode 100644 MECF.Framework.UI.Core/Converters/EngModeToBdThicknessConverter.cs delete mode 100644 MECF.Framework.UI.Core/Converters/EngModeToBgWatermarkVisibilityConverter.cs diff --git a/MECF.Framework.Common/Aitex/Core/RT/IOCore/Interlock/InterlockDaemonManager.cs b/MECF.Framework.Common/Aitex/Core/RT/IOCore/Interlock/InterlockDaemonManager.cs index 9cb142d..438c64b 100644 --- a/MECF.Framework.Common/Aitex/Core/RT/IOCore/Interlock/InterlockDaemonManager.cs +++ b/MECF.Framework.Common/Aitex/Core/RT/IOCore/Interlock/InterlockDaemonManager.cs @@ -66,10 +66,16 @@ public class InterlockDaemonManager : Singleton out string reason) { reason = ""; - + + if (string.IsNullOrEmpty(interlockDaemonFile)) + { + reason = "interlock daemon config file does not specified"; + return false; + } + if (!File.Exists(interlockDaemonFile)) { - reason = $"Interlock Daemon config file does not exist"; + reason = $"interlock daemon config file does not exist"; return false; } diff --git a/MECF.Framework.Common/MECF/Framework/Common/IOCore/IoManager.cs b/MECF.Framework.Common/MECF/Framework/Common/IOCore/IoManager.cs index 65eaa89..45f8e9e 100644 --- a/MECF.Framework.Common/MECF/Framework/Common/IOCore/IoManager.cs +++ b/MECF.Framework.Common/MECF/Framework/Common/IOCore/IoManager.cs @@ -55,7 +55,7 @@ namespace MECF.Framework.Common.IOCore { if (!InterlockManager.Instance.Initialize(interlockConfigFile, _doMap, _diMap, _aiMap, _aoMap, out var reason1)) - throw new Exception($"init {nameof(InterlockManager)} error: \r\n {reason1}"); + throw new Exception($"init {nameof(InterlockManager)} error: \r\n{reason1}"); if (!InterlockDaemonManager.Instance.Initialize(daemonConfigFile, _doMap, _diMap, _aiMap, _aoMap, out var reason2)) @@ -63,7 +63,7 @@ namespace MECF.Framework.Common.IOCore //TODO 暂时允许不定义Daemon配置文件 // throw new Exception($"init {nameof(InterlockDaemonManager)} error: \r\n {reason2}"); - LOG.Error($"init {nameof(InterlockDaemonManager)} error: \r\n {reason2}"); + LOG.Error($"init {nameof(InterlockDaemonManager)} error: \r\n{reason2}"); } } diff --git a/MECF.Framework.RT.EquipmentLibrary/LogicUnits/PMs/PMModuleBase.cs b/MECF.Framework.RT.EquipmentLibrary/LogicUnits/PMs/PMModuleBase.cs index d3ba420..0a7e12b 100644 --- a/MECF.Framework.RT.EquipmentLibrary/LogicUnits/PMs/PMModuleBase.cs +++ b/MECF.Framework.RT.EquipmentLibrary/LogicUnits/PMs/PMModuleBase.cs @@ -45,6 +45,8 @@ namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.PMs public abstract bool IsService { get; } + public bool IsInterlockBypassed => SC.GetValue($"PM.{Module}.BypassInterlock"); + #endregion #region Methods @@ -62,11 +64,8 @@ namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.PMs /// protected void DoIfInterlockNotBypassed(Action action) { - // 读取系统配置 - var byPassInterlock = SC.GetValue($"PM.{Module}.BypassInterlock"); - - if (byPassInterlock) - EV.PostWarningLog(Module, $"PM.{Module}.BypassInterlock is True"); + if (IsInterlockBypassed) + EV.PostWarningLog(Module, $"Interlock is bypassed"); else action.Invoke(); } diff --git a/MECF.Framework.UI.Client/CenterViews/Modules/PM/PMProcessViewModel.cs b/MECF.Framework.UI.Client/CenterViews/Modules/PM/PMProcessViewModel.cs index dea4fa6..bf7e3f2 100644 --- a/MECF.Framework.UI.Client/CenterViews/Modules/PM/PMProcessViewModel.cs +++ b/MECF.Framework.UI.Client/CenterViews/Modules/PM/PMProcessViewModel.cs @@ -29,6 +29,7 @@ using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.GasFlow; using System.Threading; using Sicentury.Core.EventArgs; using System.Linq; +using Aitex.Core.RT.DataCenter; namespace MECF.Framework.UI.Client.CenterViews.Modules.PM { @@ -59,7 +60,6 @@ namespace MECF.Framework.UI.Client.CenterViews.Modules.PM public PMProcessViewModel() { _recipeGasFlowCalculator = IoC.Get(); - Subscribe("System.IsEngMode"); IsBusyGasFlowSum = false; _busyIndicatorContentExport = new Progress(e => { @@ -91,9 +91,7 @@ namespace MECF.Framework.UI.Client.CenterViews.Modules.PM NotifyOfPropertyChange(); } } - - public bool IsEngMode { get; private set; } - + [Subscription("IsBusy")] public bool IsBusy { get; set; } @@ -440,9 +438,6 @@ namespace MECF.Framework.UI.Client.CenterViews.Modules.PM { try { - if (data.TryGetValue("System.IsEngMode", out var isEngMode) && isEngMode is bool b) - IsEngMode = b; - if (needLoadRecipe) needLoadRecipe = false; @@ -854,7 +849,8 @@ namespace MECF.Framework.UI.Client.CenterViews.Modules.PM public void StartProcess() { - if (IsEngMode) + var isInterlockBypassed = DATA.Poll(SystemName, "IsInterlockBypassed"); + if (isInterlockBypassed) { DialogBox.ShowError("Interlock is bypassed, can not start process."); return; diff --git a/MECF.Framework.UI.Client/Ctrlib/Controls/ModuleStatusIndicator.xaml b/MECF.Framework.UI.Client/Ctrlib/Controls/ModuleStatusIndicator.xaml index cadd557..1698ebe 100644 --- a/MECF.Framework.UI.Client/Ctrlib/Controls/ModuleStatusIndicator.xaml +++ b/MECF.Framework.UI.Client/Ctrlib/Controls/ModuleStatusIndicator.xaml @@ -9,10 +9,11 @@ d:DesignHeight="450" d:DesignWidth="800"> + - + - + + + + + diff --git a/MECF.Framework.UI.Client/Ctrlib/Controls/ModuleStatusIndicator.xaml.cs b/MECF.Framework.UI.Client/Ctrlib/Controls/ModuleStatusIndicator.xaml.cs index 535dbbf..49ee6c3 100644 --- a/MECF.Framework.UI.Client/Ctrlib/Controls/ModuleStatusIndicator.xaml.cs +++ b/MECF.Framework.UI.Client/Ctrlib/Controls/ModuleStatusIndicator.xaml.cs @@ -101,15 +101,28 @@ namespace MECF.Framework.UI.Client.Ctrlib.Controls #endregion - #region DP - IsInterlockBypassed + #region DP - HasWarning - public static readonly DependencyProperty IsInterlockBypassedProperty = DependencyProperty.Register( - nameof(IsInterlockBypassed), typeof(bool), typeof(ModuleStatusIndicator), new PropertyMetadata(default(bool))); + public static readonly DependencyProperty HasWarningProperty = DependencyProperty.Register( + nameof(HasWarning), typeof(bool), typeof(ModuleStatusIndicator), new PropertyMetadata(default(bool))); - public bool IsInterlockBypassed + public bool HasWarning { - get => (bool)GetValue(IsInterlockBypassedProperty); - set => SetValue(IsInterlockBypassedProperty, value); + get => (bool)GetValue(HasWarningProperty); + set => SetValue(HasWarningProperty, value); + } + + #endregion + + #region DP - WarningTips + + public static readonly DependencyProperty WarningTipProperty = DependencyProperty.Register( + nameof(WarningTip), typeof(string), typeof(ModuleStatusIndicator), new PropertyMetadata(default(string))); + + public string WarningTip + { + get => (string)GetValue(WarningTipProperty); + set => SetValue(WarningTipProperty, value); } #endregion diff --git a/MECF.Framework.UI.Core/Converters/EngModeToBdColorConverter.cs b/MECF.Framework.UI.Core/Converters/EngModeToBdColorConverter.cs deleted file mode 100644 index 0e4d6be..0000000 --- a/MECF.Framework.UI.Core/Converters/EngModeToBdColorConverter.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using System.Globalization; -using System.Windows.Data; -using System.Windows.Media; - -namespace MECF.Framework.UI.Core.Converters -{ - /// - /// EngMode转换为主界面边框颜色 - /// - public class EngModeToBdColorConverter : IValueConverter - { - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - if (value is bool isEngMode) - { - return isEngMode ? new SolidColorBrush(Colors.OrangeRed) : new SolidColorBrush(Colors.LightCyan); - } - - return new SolidColorBrush(Colors.Red); - } - - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - throw new NotImplementedException(); - } - } -} diff --git a/MECF.Framework.UI.Core/Converters/EngModeToBdThicknessConverter.cs b/MECF.Framework.UI.Core/Converters/EngModeToBdThicknessConverter.cs deleted file mode 100644 index 5f77da8..0000000 --- a/MECF.Framework.UI.Core/Converters/EngModeToBdThicknessConverter.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System; -using System.Globalization; -using System.Windows; -using System.Windows.Data; - -namespace MECF.Framework.UI.Core.Converters -{ - /// - /// EngMode转换为主界面边框宽度 - /// - public class EngModeToBdThicknessConverter : IValueConverter - { - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - /* - if (value is bool isEngMode) - { - return isEngMode ? new Thickness(5) : new Thickness(2); - } - */ - - return new Thickness(2); - } - - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - throw new NotImplementedException(); - } - } -} - diff --git a/MECF.Framework.UI.Core/Converters/EngModeToBgWatermarkVisibilityConverter.cs b/MECF.Framework.UI.Core/Converters/EngModeToBgWatermarkVisibilityConverter.cs deleted file mode 100644 index 9305ea0..0000000 --- a/MECF.Framework.UI.Core/Converters/EngModeToBgWatermarkVisibilityConverter.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using System.Globalization; -using System.Windows; -using System.Windows.Data; - -namespace MECF.Framework.UI.Core.Converters -{ - /// - /// EngMode转换为主界面背景水印显示状态 - /// - public class EngModeToBgWatermarkVisibilityConverter : IValueConverter - { - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - if (value is bool isEngMode) - { - return isEngMode ? Visibility.Visible : Visibility.Hidden; - } - - return Visibility.Visible; - } - - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - throw new NotImplementedException(); - } - } -} diff --git a/MECF.Framework.UI.Core/MECF.Framework.UI.Core.csproj b/MECF.Framework.UI.Core/MECF.Framework.UI.Core.csproj index 115a039..8c537da 100644 --- a/MECF.Framework.UI.Core/MECF.Framework.UI.Core.csproj +++ b/MECF.Framework.UI.Core/MECF.Framework.UI.Core.csproj @@ -326,9 +326,6 @@ - - -