Commit 03f200e5 authored by 潘栩锋's avatar 潘栩锋 🚴

1. 定点图配置添加密码

2. 报警大提示框,改为扫描报警大提示框
parent 5d631bd5
...@@ -72,11 +72,11 @@ ...@@ -72,11 +72,11 @@
</GroupBox.Header> </GroupBox.Header>
<StackPanel> <StackPanel>
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<StackPanel Margin="5"> <StackPanel Margin="{StaticResource ControlMargin}">
<TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable}" Text="使能" /> <TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable}" Text="使能" />
<ToggleButton Style="{StaticResource ToggleButtonStyle1}" HorizontalAlignment="Left" IsChecked="{Binding EnableLCUS1}" /> <ToggleButton Style="{StaticResource ToggleButtonStyle1}" HorizontalAlignment="Left" IsChecked="{Binding EnableLCUS1}" />
</StackPanel> </StackPanel>
<StackPanel Margin="5"> <StackPanel Margin="{StaticResource ControlMargin}">
<TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable}" Text="串口地址" /> <TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable}" Text="串口地址" />
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<TextBox Style="{StaticResource TextBoxStyle_FieldContent}" Text="{Binding LCUS1_PortName}" HorizontalAlignment="Left" Tag="Full"/> <TextBox Style="{StaticResource TextBoxStyle_FieldContent}" Text="{Binding LCUS1_PortName}" HorizontalAlignment="Left" Tag="Full"/>
...@@ -100,17 +100,13 @@ ...@@ -100,17 +100,13 @@
</GroupBox> </GroupBox>
<GroupBox Style="{x:Null}" Margin="5"> <GroupBox Style="{x:Null}" Margin="5">
<GroupBox.Header> <GroupBox.Header>
<TextBlock Style="{StaticResource TextBlockStyle_FieldHeader}" Text="大屏报警" VerticalAlignment="Bottom"/> <TextBlock Style="{StaticResource TextBlockStyle_FieldHeader}" Text="大屏显示扫描报警" VerticalAlignment="Bottom"/>
</GroupBox.Header> </GroupBox.Header>
<StackPanel Orientation="Horizontal" x:Name="spErrCodes"> <StackPanel Orientation="Horizontal" x:Name="spErrCodes">
<StackPanel Margin="5"> <StackPanel Margin="{StaticResource ControlMargin}">
<StackPanel Orientation="Horizontal"> <StackPanel Margin="{StaticResource ControlMargin}">
<TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable}" Text="出错码" /> <TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable}" Text="使能" />
<TextBlock Style="{StaticResource TextBlockStyle_FieldContent_mm}" Text="格式为:11,12" /> <ToggleButton Style="{StaticResource ToggleButtonStyle1}" HorizontalAlignment="Left" IsChecked="{Binding EnableScanErrBigTip}" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBox Style="{StaticResource TextBoxStyle_FieldContent}" Text="{Binding ErrCodesOfTip}" MinWidth="300" HorizontalAlignment="Left" Tag="Full"/>
</StackPanel> </StackPanel>
</StackPanel> </StackPanel>
</StackPanel> </StackPanel>
......
...@@ -52,9 +52,9 @@ namespace FLY.Thick.Base.UI.CustomSection ...@@ -52,9 +52,9 @@ namespace FLY.Thick.Base.UI.CustomSection
public int WarningDurationSec { get; set; } public int WarningDurationSec { get; set; }
/// <summary> /// <summary>
/// 显示报警信息的 报警编号 /// 大屏幕提示扫描报警
/// </summary> /// </summary>
public string ErrCodesOfTip { get; set; } public bool EnableScanErrBigTip { get; set; }
/// <summary> /// <summary>
/// USB 继电器 串口地址 /// USB 继电器 串口地址
...@@ -96,21 +96,21 @@ namespace FLY.Thick.Base.UI.CustomSection ...@@ -96,21 +96,21 @@ namespace FLY.Thick.Base.UI.CustomSection
WarningTipPath = this.paramDictionary.GetValue(ParamDistItemKeys.WarningTipPath, ""); WarningTipPath = this.paramDictionary.GetValue(ParamDistItemKeys.WarningTipPath, "");
var v = this.paramDictionary.GetValue<int>(ParamDistItemKeys.WarningDurationSec); var v = this.paramDictionary.GetValue<int>(ParamDistItemKeys.WarningDurationSec);
WarningDurationSec = this.paramDictionary.GetValue(ParamDistItemKeys.WarningDurationSec, 5); WarningDurationSec = this.paramDictionary.GetValue(ParamDistItemKeys.WarningDurationSec, 5);
ErrCodesOfTip = this.paramDictionary.GetValue(ParamDistItemKeys.ErrCodesOfTip, "11,12"); EnableScanErrBigTip = this.paramDictionary.GetValue(ParamDistItemKeys.EnableScanErrBigTip, false);
LCUS1_PortName = this.paramDictionary.GetValue(ParamDistItemKeys.LCUS1_PortName, "COM1"); LCUS1_PortName = this.paramDictionary.GetValue(ParamDistItemKeys.LCUS1_PortName, "COM1");
EnableLCUS1 = this.paramDictionary.GetValue(ParamDistItemKeys.EnableLCUS1, false); EnableLCUS1 = this.paramDictionary.GetValue(ParamDistItemKeys.EnableLCUS1, false);
this.PropertyChanged += (s, e) => this.PropertyChanged += (s, e) =>
{ {
if (e.PropertyName == ParamDistItemKeys.WarningTipPath) if (e.PropertyName == "WarningTipPath")
this.paramDictionary.SetValue(ParamDistItemKeys.WarningTipPath, WarningTipPath); this.paramDictionary.SetValue(ParamDistItemKeys.WarningTipPath, WarningTipPath);
else if (e.PropertyName == ParamDistItemKeys.WarningDurationSec) else if (e.PropertyName == "WarningDurationSec")
this.paramDictionary.SetValue(ParamDistItemKeys.WarningDurationSec, WarningDurationSec); this.paramDictionary.SetValue(ParamDistItemKeys.WarningDurationSec, WarningDurationSec);
else if (e.PropertyName == ParamDistItemKeys.ErrCodesOfTip) else if (e.PropertyName == "EnableScanErrBigTip")
this.paramDictionary.SetValue(ParamDistItemKeys.ErrCodesOfTip, ErrCodesOfTip); this.paramDictionary.SetValue(ParamDistItemKeys.EnableScanErrBigTip, EnableScanErrBigTip);
else if (e.PropertyName == ParamDistItemKeys.LCUS1_PortName) else if (e.PropertyName == "LCUS1_PortName")
this.paramDictionary.SetValue(ParamDistItemKeys.LCUS1_PortName, LCUS1_PortName); this.paramDictionary.SetValue(ParamDistItemKeys.LCUS1_PortName, LCUS1_PortName);
else if (e.PropertyName == ParamDistItemKeys.EnableLCUS1) else if (e.PropertyName == "EnableLCUS1")
this.paramDictionary.SetValue(ParamDistItemKeys.EnableLCUS1, EnableLCUS1); this.paramDictionary.SetValue(ParamDistItemKeys.EnableLCUS1, EnableLCUS1);
}; };
......
...@@ -20,13 +20,14 @@ ...@@ -20,13 +20,14 @@
<StackPanel.Resources> <StackPanel.Resources>
<Style x:Key="TextBlockStyle_GridFieldHeader" TargetType="TextBlock" BasedOn="{StaticResource TextBlockStyle_FieldHeaderEditable}"> <Style x:Key="TextBlockStyle_GridFieldHeader" TargetType="TextBlock" BasedOn="{StaticResource TextBlockStyle_FieldHeaderEditable}">
<Setter Property="Width" Value="100"/> <Setter Property="Width" Value="100"/>
<Setter Property="Margin" Value="1,0"/> <Setter Property="Margin" Value="1.5,0"/>
<Setter Property="Foreground" Value="White"/> <Setter Property="Foreground" Value="White"/>
<Setter Property="Background" Value="{StaticResource Color_theme_activity}"/> <Setter Property="Background" Value="{StaticResource Color_theme_activity}"/>
</Style> </Style>
<Style x:Key="TextBlockStyle_GridFieldContent" TargetType="TextBlock" BasedOn="{StaticResource TextBlockStyle_FieldContent}"> <Style x:Key="TextBlockStyle_GridFieldContent" TargetType="TextBlock" BasedOn="{StaticResource TextBlockStyle_FieldContent}">
<Setter Property="Width" Value="100"/> <Setter Property="Width" Value="100"/>
<Setter Property="Margin" Value="1,0"/> <Setter Property="Margin" Value="1.5,0"/>
<Setter Property="Background" Value="White"/>
</Style> </Style>
<Style x:Key="ComboBoxStyle_GridFieldContent" TargetType="ComboBox" > <Style x:Key="ComboBoxStyle_GridFieldContent" TargetType="ComboBox" >
<Setter Property="Width" Value="100"/> <Setter Property="Width" Value="100"/>
...@@ -34,7 +35,7 @@ ...@@ -34,7 +35,7 @@
<Setter Property="FontSize" Value="25"/> <Setter Property="FontSize" Value="25"/>
</Style> </Style>
</StackPanel.Resources> </StackPanel.Resources>
<StackPanel Orientation="Horizontal" Margin="3"> <StackPanel Orientation="Horizontal" Margin="3,1.5">
<TextBlock Style="{StaticResource TextBlockStyle_GridFieldHeader}" <TextBlock Style="{StaticResource TextBlockStyle_GridFieldHeader}"
Text="状态" /> Text="状态" />
<TextBlock Style="{StaticResource TextBlockStyle_GridFieldHeader}" <TextBlock Style="{StaticResource TextBlockStyle_GridFieldHeader}"
...@@ -48,13 +49,18 @@ ...@@ -48,13 +49,18 @@
</ItemsControl.ItemsPanel> </ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate> <ItemsControl.ItemTemplate>
<DataTemplate> <DataTemplate>
<StackPanel Orientation="Horizontal" Margin="3"> <StackPanel>
<StackPanel Orientation="Horizontal" Margin="3,1.5">
<TextBlock Style="{StaticResource TextBlockStyle_GridFieldContent}" Text="{Binding ControllerState}"/> <TextBlock Style="{StaticResource TextBlockStyle_GridFieldContent}" Text="{Binding ControllerState}"/>
<TextBlock Style="{StaticResource TextBlockStyle_GridFieldContent}" Text="{Binding Header}"/> <TextBlock Style="{StaticResource TextBlockStyle_GridFieldContent}" Text="{Binding Header}"/>
<Button Style="{StaticResource ButtonStyle_icon}" Click="button_del_Click" Tag="{Binding .}"> <Button Style="{StaticResource ButtonStyle_icon}" Click="button_del_Click" Tag="{Binding .}" Foreground="{StaticResource ValidationBrush5}">
<iconPacks:PackIconMaterial Kind="CloseCircle"/> <iconPacks:PackIconMaterial Kind="CloseCircle"/>
</Button> </Button>
</StackPanel> </StackPanel>
</StackPanel>
</DataTemplate> </DataTemplate>
</ItemsControl.ItemTemplate> </ItemsControl.ItemTemplate>
</ItemsControl> </ItemsControl>
......
...@@ -10,6 +10,7 @@ using System.Threading; ...@@ -10,6 +10,7 @@ using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using FLY.Thick.Base.UI; using FLY.Thick.Base.UI;
using Unity; using Unity;
using FLY.Thick.Base.Common;
namespace FLY.Thick.Base.UI.OnInit namespace FLY.Thick.Base.UI.OnInit
{ {
...@@ -24,6 +25,8 @@ namespace FLY.Thick.Base.UI.OnInit ...@@ -24,6 +25,8 @@ namespace FLY.Thick.Base.UI.OnInit
ParamDictionary paramDictionary; ParamDictionary paramDictionary;
IUnityContainer container; IUnityContainer container;
bool enableScanErrBigTip;
int warningTipId=-1;
public int Level { get; } public int Level { get; }
public OnInitError( public OnInitError(
IUnityContainer container, IUnityContainer container,
...@@ -43,76 +46,63 @@ namespace FLY.Thick.Base.UI.OnInit ...@@ -43,76 +46,63 @@ namespace FLY.Thick.Base.UI.OnInit
paramDictionary.ValueChanged += ParamDictionary_ValueChanged; paramDictionary.ValueChanged += ParamDictionary_ValueChanged;
warningReasonWindow.Record.CollectionChanged += Record_CollectionChanged; warningReasonWindow.Record.CollectionChanged += Record_CollectionChanged;
updateErrCodesOfTip();
} }
private void ParamDictionary_ValueChanged(object sender, ParamDictionaryValueChangedEventArgs e) private void ParamDictionary_ValueChanged(object sender, ParamDictionaryValueChangedEventArgs e)
{ {
if (e.Key == ParamDistItemKeys.ErrCodesOfTip) if (e.Key == ParamDistItemKeys.EnableScanErrBigTip)
{ {
updateErrCodesOfTip(); updateErrCodesOfTip();
} }
} }
List<int> errCodes = new List<int>();
void updateErrCodesOfTip() void updateErrCodesOfTip()
{ {
errCodes.Clear(); enableScanErrBigTip = paramDictionary.GetValue<bool>(ParamDistItemKeys.EnableScanErrBigTip, false);
string str = paramDictionary.GetValue<string>(ParamDistItemKeys.ErrCodesOfTip);
if (string.IsNullOrEmpty(str))
return;
int[] codes = null;
try
{
codes = Newtonsoft.Json.JsonConvert.DeserializeObject<int[]>($"[{str}]");
}
catch (Exception ex)
{
return;
}
if (codes == null)
return;
if (codes.Count() == 0)
return;
errCodes.AddRange(codes);
} }
private void Record_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) private void Record_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{ {
if (errCodes.Count() == 0) if (!enableScanErrBigTip)
return; return;
FObjBase.PollModule.Current.Poll_JustOnce( FObjBase.PollModule.Current.Poll_JustOnce(
new FObjBase.PollModule.PollHandler(delegate () new FObjBase.PollModule.PollHandler(delegate ()
{ {
List<int> errCodes = new List<int> { ERRNOs.SCAN_ERRNO_OVERCTRL.Code, ERRNOs.SCAN_ERRNO_OVERTOL.Code };
var record = warningReasonWindow.Record; var record = warningReasonWindow.Record;
//判断当前报警是否包含 errCodes
var rs = from r in record where errCodes.Contains(r.ErrCode) select r; var rs = from r in record where errCodes.Contains(r.ErrCode) select r;
if (rs.Count() == 0) if (rs.Count() == 0) {
{//没有一个需要报警 //不需要提示
FLY.ControlLibrary.Window_WarningTip.Stop(); if (warningTipId != -1)
}
else
{ {
//需要把之前的报警关闭
FLY.ControlLibrary.Window_WarningTip.Stop(warningTipId);
warningTipId = -1;
}
}
else {
int errcode = rs.First().ErrCode; int errcode = rs.First().ErrCode;
string msg = rs.First().Description; string msg = rs.First().Description;
string path = paramDictionary.GetValue<string>(ParamDistItemKeys.WarningTipPath); string path = paramDictionary.GetValue<string>(ParamDistItemKeys.WarningTipPath);
//报警!!!!!!!! //报警!!!!!!!!
FLY.ControlLibrary.Window_WarningTip.Show( //记录打开的报警提示框Id,用于以后关闭
warningTipId = FLY.ControlLibrary.Window_WarningTip.Show(
$"编码={errcode}", $"编码={errcode}",
msg, msg,
TimeSpan.MaxValue, TimeSpan.MaxValue,
path, path,
warningService.Reset warningService.Reset
); );
} }
}), this, MARKNO_WARNING_RING); }), this, MARKNO_WARNING_RING);
} }
......
...@@ -13,7 +13,7 @@ namespace FLY.Thick.Base.UI ...@@ -13,7 +13,7 @@ namespace FLY.Thick.Base.UI
public const string Language = "Language"; public const string Language = "Language";
public const string WarningTipPath = "WarningTipPath"; public const string WarningTipPath = "WarningTipPath";
public const string WarningDurationSec = "WarningDurationSec"; public const string WarningDurationSec = "WarningDurationSec";
public const string ErrCodesOfTip = "ErrCodesOfTip"; public const string EnableScanErrBigTip = "EnableScanErrBigTip";
public const string LCUS1_PortName = "LCUS1_PortName"; public const string LCUS1_PortName = "LCUS1_PortName";
public const string EnableLCUS1 = "EnableLCUS1"; public const string EnableLCUS1 = "EnableLCUS1";
public const string WindowSize = "WindowSize"; public const string WindowSize = "WindowSize";
......
...@@ -148,6 +148,9 @@ namespace FLY.Thick.Base.UI.UiModule ...@@ -148,6 +148,9 @@ namespace FLY.Thick.Base.UI.UiModule
private void button_save_Click(object sender, RoutedEventArgs e) private void button_save_Click(object sender, RoutedEventArgs e)
{ {
if (!WdPassword.Authorize("GraphConfig"))
return;
graphparam_clone.CopyTo(mGraphParam); graphparam_clone.CopyTo(mGraphParam);
FixGraphParams.Current.Save(); FixGraphParams.Current.Save();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment