[UI.Core]

移除EngMode相关的Converters。

[UI.Client]
ModuleStatusIndicator对象增加Warning图标和Warning图标Tips。

[RT.Equipment]
PMModuleBase对象新增IsInterlockBypassed属性,用于指示PM模组是否旁路互锁。
This commit is contained in:
SL 2023-08-15 15:36:38 +08:00
parent 96630d9c96
commit 4ba62bfbbf
10 changed files with 58 additions and 122 deletions

View File

@ -66,10 +66,16 @@ public class InterlockDaemonManager : Singleton<InterlockDaemonManager>
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;
}

View File

@ -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}");
}
}

View File

@ -45,6 +45,8 @@ namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.PMs
public abstract bool IsService { get; }
public bool IsInterlockBypassed => SC.GetValue<bool>($"PM.{Module}.BypassInterlock");
#endregion
#region Methods
@ -62,11 +64,8 @@ namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.PMs
/// <returns></returns>
protected void DoIfInterlockNotBypassed(Action action)
{
// 读取系统配置
var byPassInterlock = SC.GetValue<bool>($"PM.{Module}.BypassInterlock");
if (byPassInterlock)
EV.PostWarningLog(Module, $"PM.{Module}.BypassInterlock is True");
if (IsInterlockBypassed)
EV.PostWarningLog(Module, $"Interlock is bypassed");
else
action.Invoke();
}

View File

@ -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<IRecipeGasFlowCalculator>();
Subscribe("System.IsEngMode");
IsBusyGasFlowSum = false;
_busyIndicatorContentExport = new Progress<ProgressUpdatingEventArgs>(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<bool>(SystemName, "IsInterlockBypassed");
if (isInterlockBypassed)
{
DialogBox.ShowError("Interlock is bypassed, can not start process.");
return;

View File

@ -9,10 +9,11 @@
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.Resources>
<converters:BoolReverseConverter x:Key="BoolReverseConverter"/>
<converters:BoolVisibilityConverter x:Key="BoolVisibilityConverter"/>
<local:ModuleIsOnlineToBgColorConverter x:Key="IsOnlineToBdrColor"/>
<local:ModuleStatusToBackgroundColorConverter x:Key="StatusToBgColor"/>
</UserControl.Resources>
<DockPanel DataContext="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}, Mode=OneTime}">
<DockPanel LastChildFill="True" DataContext="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}, Mode=OneTime}">
<Label
DockPanel.Dock="Left"
HorizontalContentAlignment="Center"
@ -40,13 +41,24 @@
</Label.ContextMenu>
</Label>
<TextBox
DockPanel.Dock="Left"
VerticalContentAlignment="Center"
Background="{Binding Status, Converter={StaticResource StatusToBgColor}}"
Style="{StaticResource TextBox_Top}"
Text="{Binding Status, Mode=OneWay}"
IsReadOnly="True"
TextWrapping="Wrap" Margin="0,2,2,2" />
<Grid>
<Image
Source="pack://application:,,,/MECF.Framework.UI.Core;component/Resources/SystemLog/Warning.png"
HorizontalAlignment="Right"
Margin="0 0 10 0"
Height="16"
Width="16"
Visibility="{Binding HasWarning, Converter={StaticResource BoolVisibilityConverter}, ConverterParameter=True}"
ToolTip="{Binding WarningTip}"
Panel.ZIndex="999"/>
<TextBox
VerticalContentAlignment="Center"
Background="{Binding Status, Converter={StaticResource StatusToBgColor}}"
Style="{StaticResource TextBox_Top}"
Text="{Binding Status, Mode=OneWay}"
IsReadOnly="True"
TextWrapping="Wrap" Margin="0,2,2,2" />
</Grid>
</DockPanel>
</UserControl>

View File

@ -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

View File

@ -1,28 +0,0 @@
using System;
using System.Globalization;
using System.Windows.Data;
using System.Windows.Media;
namespace MECF.Framework.UI.Core.Converters
{
/// <summary>
/// EngMode转换为主界面边框颜色
/// </summary>
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();
}
}
}

View File

@ -1,31 +0,0 @@
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
namespace MECF.Framework.UI.Core.Converters
{
/// <summary>
/// EngMode转换为主界面边框宽度
/// </summary>
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();
}
}
}

View File

@ -1,28 +0,0 @@
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
namespace MECF.Framework.UI.Core.Converters
{
/// <summary>
/// EngMode转换为主界面背景水印显示状态
/// </summary>
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();
}
}
}

View File

@ -326,9 +326,6 @@
<Compile Include="Converters\CenterBorderGapMaskConverter.cs" />
<Compile Include="Converters\ColorConverter_IsTestOK.cs" />
<Compile Include="Converters\ColorToBrushConverter.cs" />
<Compile Include="Converters\EngModeToBdColorConverter.cs" />
<Compile Include="Converters\EngModeToBdThicknessConverter.cs" />
<Compile Include="Converters\EngModeToBgWatermarkVisibilityConverter.cs" />
<Compile Include="Converters\GeneralConverter.cs" />
<Compile Include="Converters\MarkdownToHtmlConverter.cs" />
<Compile Include="Converters\NullToVisibilityConverter.cs" />