parent
0cfe77d1aa
commit
66ddf8b742
|
@ -56,7 +56,19 @@ namespace Aitex.Core.Common.DeviceData
|
|||
[DataMember]
|
||||
public bool IsBuzzer5On { get; set; }
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
[DataMember]
|
||||
public string RedLightEvent { get; set; }
|
||||
|
||||
[DataMember]
|
||||
public string YellowLightEvent { get; set; }
|
||||
|
||||
[DataMember]
|
||||
public string GreenLightEvent { get; set; }
|
||||
|
||||
[DataMember]
|
||||
public string BuzzerEvent { get; set; }
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
public void InvokePropertyChanged(string propertyName)
|
||||
{
|
||||
|
|
|
@ -229,8 +229,8 @@ namespace Aitex.Core.RT.Event
|
|||
OP.Subscribe("System.Diagnosis.GenPjDoneEvent", (s, args) =>
|
||||
{
|
||||
//WriteEvent(ModuleName.System.ToString(), "PJ_DONE", "LoadLock", "0");
|
||||
EV.PostMessage(ModuleName.System.ToString(), EventEnum.PJ_DONE, "LoadLock", "0");
|
||||
OP.DoOperation("System.AlertJobDone");
|
||||
//EV.PostMessage(ModuleName.System.ToString(), EventEnum.PJ_DONE, "LoadLock", "0");
|
||||
OP.DoOperation("System.AlertJobDone", ModuleName.LoadLock, 0);
|
||||
return true;
|
||||
});
|
||||
|
||||
|
|
|
@ -88,7 +88,6 @@ namespace MECF.Framework.Common.Device.Bases
|
|||
/// </summary>
|
||||
/// <param name="module">当前模组名称。</param>
|
||||
/// <param name="node">设备配置文件。</param>
|
||||
/// <param name="dictStLightActions"></param>
|
||||
/// <param name="ioModule">所属Module的名称。</param>
|
||||
public SignalTowerBase(string module, XmlElement node, string ioModule = "")
|
||||
: base(module, node, ioModule)
|
||||
|
@ -112,10 +111,10 @@ namespace MECF.Framework.Common.Device.Bases
|
|||
var eventFile = node.GetAttribute("eventFile");
|
||||
|
||||
// 红、黄、绿、蜂鸣器是必须定义的元件。
|
||||
Debug.Assert(doRedLight != null, "DO RedLight is not valid");
|
||||
Debug.Assert(doYellowLight != null, "DO RedLight is not valid");
|
||||
Debug.Assert(doGreenLight != null, "DO RedLight is not valid");
|
||||
Debug.Assert(doBuzzer != null, "DO RedLight is not valid");
|
||||
Debug.Assert(doRedLight != null, "DO of RedLight not defined");
|
||||
Debug.Assert(doYellowLight != null, "DO of YellowLight not defined");
|
||||
Debug.Assert(doGreenLight != null, "DO of GreenLight not defined");
|
||||
Debug.Assert(doBuzzer != null, "DO of Buzzer not defined");
|
||||
|
||||
// 创建三色灯控制元件。
|
||||
CreateSTLight(STLightTypes.Red, doRedLight);
|
||||
|
@ -165,6 +164,10 @@ namespace MECF.Framework.Common.Device.Bases
|
|||
IsBuzzer3On = GetSignalTowerPartValue(STLightTypes.Buzzer3),
|
||||
IsBuzzer4On = GetSignalTowerPartValue(STLightTypes.Buzzer4),
|
||||
IsBuzzer5On = GetSignalTowerPartValue(STLightTypes.Buzzer5),
|
||||
GreenLightEvent = _dictStLights[STLightTypes.Green]?.Action?.EventName ?? "",
|
||||
YellowLightEvent = _dictStLights[STLightTypes.Yellow]?.Action?.EventName ?? "",
|
||||
RedLightEvent = _dictStLights[STLightTypes.Red]?.Action?.EventName ?? "",
|
||||
BuzzerEvent = _dictStLights[STLightTypes.Buzzer]?.Action?.EventName ?? ""
|
||||
};
|
||||
|
||||
#endregion
|
||||
|
@ -180,7 +183,7 @@ namespace MECF.Framework.Common.Device.Bases
|
|||
private void CreateSTLight(STLightTypes light, DOAccessor doSw, AOAccessor aoBlinkFreq = null)
|
||||
{
|
||||
if (doSw != null)
|
||||
_dictStLights.Add(light, new SignalTowerLightBase(light, doSw, aoBlinkFreq));
|
||||
_dictStLights.Add(light, new SignalTowerLightBase(Module, light, doSw, aoBlinkFreq));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -298,7 +301,7 @@ namespace MECF.Framework.Common.Device.Bases
|
|||
light.Monitor();
|
||||
|
||||
// remove the cycle done action from dynamic STEvent dictionary
|
||||
var currAction = light.GetAction();
|
||||
var currAction = light.Action;
|
||||
if (currAction is { IsCycleDone: true }
|
||||
&& _dictDynamicSTLightActions.TryGetValue(currAction.EventName, out var actions))
|
||||
{
|
||||
|
|
|
@ -61,10 +61,12 @@ namespace MECF.Framework.Common.Device.Bases
|
|||
/// <summary>
|
||||
/// 构建信号塔元件对象的实例。
|
||||
/// </summary>
|
||||
/// <param name="module">所属模组</param>
|
||||
/// <param name="light">信号塔元件类型,请参考<see cref="STLightTypes"/>。</param>
|
||||
/// <param name="doSwitch">控制元件开关的DO。</param>
|
||||
/// <param name="aoBlinkFreq">控制Blink频率的AO。</param>
|
||||
public SignalTowerLightBase(STLightTypes light, DOAccessor doSwitch, AOAccessor aoBlinkFreq)
|
||||
public SignalTowerLightBase(string module, STLightTypes light, DOAccessor doSwitch, AOAccessor aoBlinkFreq)
|
||||
:base(module, light.ToString(), null, null)
|
||||
{
|
||||
_lightType = light;
|
||||
_doLight = doSwitch;
|
||||
|
@ -83,6 +85,10 @@ namespace MECF.Framework.Common.Device.Bases
|
|||
/// </summary>
|
||||
public STLightTypes Type => _lightType;
|
||||
|
||||
/// <summary>
|
||||
/// 返回正在执行的动作
|
||||
/// </summary>
|
||||
public STAction Action => _action;
|
||||
|
||||
/// <summary>
|
||||
/// 返回当前信号塔组件是否为蜂鸣器。
|
||||
|
@ -241,15 +247,6 @@ namespace MECF.Framework.Common.Device.Bases
|
|||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取信号塔元件当前正在执行的动作。
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public STAction GetAction()
|
||||
{
|
||||
return _action;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取信号塔元件映射PLC IO的输出状态。
|
||||
/// </summary>
|
||||
|
@ -281,12 +278,15 @@ namespace MECF.Framework.Common.Device.Bases
|
|||
// 如果没有指定动作,则默认关闭组件
|
||||
if (_action == null)
|
||||
{
|
||||
LOG.Debug($"{this} action cleared");
|
||||
_blinkCycleDownCounter = 0;
|
||||
_doLight.Value = false;
|
||||
Reset(); // 复位状态机
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
LOG.Debug($"{this} action set for event {action.EventName}");
|
||||
|
||||
// 执行动作
|
||||
switch (_action.Output)
|
||||
{
|
||||
|
@ -374,7 +374,7 @@ namespace MECF.Framework.Common.Device.Bases
|
|||
/// <inheritdoc />
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{_lightType}";
|
||||
return $"{Module}.{_lightType}";
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -15,11 +15,12 @@ namespace MECF.Framework.RT.EquipmentLibrary.Devices
|
|||
/// <summary>
|
||||
/// 构造IoSignalTowerPart对象。
|
||||
/// </summary>
|
||||
/// <param name="module">所属模组</param>
|
||||
/// <param name="light">信号塔元件类型,请参考<see cref="STLightTypes"/>。</param>
|
||||
/// <param name="doSw">控制元件开关的DO。</param>
|
||||
/// <param name="aoBlinkFreq">控制Blink频率的AO。</param>
|
||||
public IoSignalTowerLight(STLightTypes light, DOAccessor doSw, AOAccessor aoBlinkFreq)
|
||||
: base(light, doSw, aoBlinkFreq)
|
||||
public IoSignalTowerLight(string module, STLightTypes light, DOAccessor doSw, AOAccessor aoBlinkFreq)
|
||||
: base(module, light, doSw, aoBlinkFreq)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -7,17 +7,18 @@
|
|||
d:DesignHeight="105"
|
||||
d:DesignWidth="30"
|
||||
mc:Ignorable="d">
|
||||
<Grid Width="30" Height="85">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="20" />
|
||||
<RowDefinition Height="20" />
|
||||
<RowDefinition Height="20" />
|
||||
<RowDefinition Height="20" />
|
||||
<RowDefinition Height="20" />
|
||||
<Border x:Name="TopGrid" Background="Transparent">
|
||||
<Grid Width="30" Height="85">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="20" />
|
||||
<RowDefinition Height="20" />
|
||||
<RowDefinition Height="20" />
|
||||
<RowDefinition Height="20" />
|
||||
<RowDefinition Height="20" />
|
||||
|
||||
</Grid.RowDefinitions>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Image
|
||||
<Image
|
||||
Name="rectangle1"
|
||||
Canvas.Left="0"
|
||||
Canvas.Top="0"
|
||||
|
@ -26,17 +27,17 @@
|
|||
VerticalAlignment="Top"
|
||||
Source="pack://application:,,,/MECF.Framework.UI.Core;component/Resources/red.png"
|
||||
Stretch="Fill">
|
||||
<Image.Effect>
|
||||
<DropShadowEffect
|
||||
<Image.Effect>
|
||||
<DropShadowEffect
|
||||
BlurRadius="20"
|
||||
Opacity="1"
|
||||
RenderingBias="Performance"
|
||||
ShadowDepth="0"
|
||||
Color="Red" />
|
||||
</Image.Effect>
|
||||
</Image.Effect>
|
||||
|
||||
</Image>
|
||||
<Image
|
||||
</Image>
|
||||
<Image
|
||||
Name="rectangle2"
|
||||
Grid.Row="1"
|
||||
Canvas.Left="0"
|
||||
|
@ -47,19 +48,19 @@
|
|||
PreviewMouseDown="rectangle2_PreviewMouseDown"
|
||||
Source="pack://application:,,,/MECF.Framework.UI.Core;component/Resources/yellow.png"
|
||||
Stretch="Fill">
|
||||
<Image.Effect>
|
||||
<DropShadowEffect
|
||||
<Image.Effect>
|
||||
<DropShadowEffect
|
||||
BlurRadius="20"
|
||||
Opacity="1"
|
||||
RenderingBias="Performance"
|
||||
ShadowDepth="0"
|
||||
Color="Green" />
|
||||
<!--<BlurEffect RenderingBias="Performance" Radius="15" >
|
||||
<!--<BlurEffect RenderingBias="Performance" Radius="15" >
|
||||
|
||||
</BlurEffect>-->
|
||||
</Image.Effect>
|
||||
</Image>
|
||||
<Image
|
||||
</Image.Effect>
|
||||
</Image>
|
||||
<Image
|
||||
Name="rectangle3"
|
||||
Grid.Row="2"
|
||||
Canvas.Left="0"
|
||||
|
@ -67,19 +68,19 @@
|
|||
Width="30"
|
||||
Source="pack://application:,,,/MECF.Framework.UI.Core;component/Resources/Lime.png"
|
||||
Stretch="Fill">
|
||||
<Image.Effect>
|
||||
<DropShadowEffect
|
||||
<Image.Effect>
|
||||
<DropShadowEffect
|
||||
BlurRadius="20"
|
||||
Opacity="1"
|
||||
RenderingBias="Performance"
|
||||
ShadowDepth="0"
|
||||
Color="Green" />
|
||||
<!--<BlurEffect RenderingBias="Performance" Radius="15" >
|
||||
<!--<BlurEffect RenderingBias="Performance" Radius="15" >
|
||||
|
||||
</BlurEffect>-->
|
||||
</Image.Effect>
|
||||
</Image>
|
||||
<Image
|
||||
</Image.Effect>
|
||||
</Image>
|
||||
<Image
|
||||
Name="rectangle4"
|
||||
Grid.Row="3"
|
||||
Canvas.Left="0"
|
||||
|
@ -89,19 +90,19 @@
|
|||
Source="pack://application:,,,/MECF.Framework.UI.Core;component/Resources/Blue.png"
|
||||
Stretch="Fill"
|
||||
Visibility="Hidden">
|
||||
<Image.Effect>
|
||||
<DropShadowEffect
|
||||
<Image.Effect>
|
||||
<DropShadowEffect
|
||||
BlurRadius="20"
|
||||
Opacity="1"
|
||||
RenderingBias="Performance"
|
||||
ShadowDepth="0"
|
||||
Color="Green" />
|
||||
<!--<BlurEffect RenderingBias="Performance" Radius="15" >
|
||||
<!--<BlurEffect RenderingBias="Performance" Radius="15" >
|
||||
|
||||
</BlurEffect>-->
|
||||
</Image.Effect>
|
||||
</Image>
|
||||
<Image
|
||||
</Image.Effect>
|
||||
</Image>
|
||||
<Image
|
||||
Name="rectangle5"
|
||||
Grid.Row="3"
|
||||
Canvas.Left="0"
|
||||
|
@ -110,17 +111,18 @@
|
|||
Height="30"
|
||||
Source="pack://application:,,,/MECF.Framework.UI.Core;component/Resources/lights.png"
|
||||
Stretch="Fill">
|
||||
<Image.Effect>
|
||||
<DropShadowEffect
|
||||
<Image.Effect>
|
||||
<DropShadowEffect
|
||||
BlurRadius="20"
|
||||
Opacity="1"
|
||||
RenderingBias="Performance"
|
||||
ShadowDepth="0"
|
||||
Color="White" />
|
||||
<!--<BlurEffect RenderingBias="Performance" Radius="15" >
|
||||
<!--<BlurEffect RenderingBias="Performance" Radius="15" >
|
||||
|
||||
</BlurEffect>-->
|
||||
</Image.Effect>
|
||||
</Image>
|
||||
</Grid>
|
||||
</Image.Effect>
|
||||
</Image>
|
||||
</Grid>
|
||||
</Border>
|
||||
</UserControl>
|
||||
|
|
|
@ -1,85 +1,64 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Effects;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using Aitex.Core.Common.DeviceData;
|
||||
using Aitex.Core.UI.ControlDataContext;
|
||||
|
||||
namespace Aitex.Core.UI.DeviceControl
|
||||
{
|
||||
public partial class AITSignalTower : UserControl
|
||||
{
|
||||
public static readonly DependencyProperty DeviceDataProperty = DependencyProperty.Register(
|
||||
"DeviceData", typeof(AITSignalTowerData), typeof(AITSignalTower),
|
||||
new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.AffectsRender));
|
||||
nameof(DeviceData), typeof(AITSignalTowerData), typeof(AITSignalTower),
|
||||
new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.AffectsRender));
|
||||
|
||||
public static readonly DependencyProperty BuzzingWarningConfigCommandProperty = DependencyProperty.Register(
|
||||
"BuzzingWarningConfigCallback", typeof(Action), typeof(AITSignalTower),
|
||||
nameof(BuzzingWarningConfigCallback), typeof(Action), typeof(AITSignalTower),
|
||||
new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.None));
|
||||
|
||||
public Action BuzzingWarningConfigCallback
|
||||
{
|
||||
get
|
||||
{
|
||||
return (Action)GetValue(BuzzingWarningConfigCommandProperty);
|
||||
}
|
||||
set
|
||||
{
|
||||
SetValue(BuzzingWarningConfigCommandProperty, value);
|
||||
}
|
||||
get => (Action)GetValue(BuzzingWarningConfigCommandProperty);
|
||||
set => SetValue(BuzzingWarningConfigCommandProperty, value);
|
||||
}
|
||||
|
||||
public AITSignalTowerData DeviceData
|
||||
{
|
||||
get
|
||||
{
|
||||
return (AITSignalTowerData)GetValue(DeviceDataProperty);
|
||||
}
|
||||
set
|
||||
{
|
||||
SetValue(DeviceDataProperty, value);
|
||||
}
|
||||
get => (AITSignalTowerData)GetValue(DeviceDataProperty);
|
||||
set => SetValue(DeviceDataProperty, value);
|
||||
}
|
||||
|
||||
DropShadowEffect redLightEffect = new DropShadowEffect();
|
||||
DropShadowEffect yellowLightEffect = new DropShadowEffect();
|
||||
DropShadowEffect greenLightEffect = new DropShadowEffect();
|
||||
DropShadowEffect blueLightEffect = new DropShadowEffect();
|
||||
DropShadowEffect buzzerLightEffect = new DropShadowEffect();
|
||||
private readonly DropShadowEffect _redLightEffect = new();
|
||||
private readonly DropShadowEffect _yellowLightEffect = new();
|
||||
private readonly DropShadowEffect _greenLightEffect = new();
|
||||
private readonly DropShadowEffect _blueLightEffect = new();
|
||||
private readonly DropShadowEffect _buzzerLightEffect = new();
|
||||
public double OutLights = 0.2;
|
||||
|
||||
public AITSignalTower()
|
||||
{
|
||||
InitializeComponent();
|
||||
redLightEffect.BlurRadius = 20;
|
||||
redLightEffect.Opacity = 1;
|
||||
redLightEffect.Color = Colors.Red;
|
||||
_redLightEffect.BlurRadius = 20;
|
||||
_redLightEffect.Opacity = 1;
|
||||
_redLightEffect.Color = Colors.Red;
|
||||
|
||||
yellowLightEffect.BlurRadius = 20;
|
||||
yellowLightEffect.Opacity = 1;
|
||||
yellowLightEffect.Color = Colors.Yellow;
|
||||
_yellowLightEffect.BlurRadius = 20;
|
||||
_yellowLightEffect.Opacity = 1;
|
||||
_yellowLightEffect.Color = Colors.Yellow;
|
||||
|
||||
greenLightEffect.BlurRadius = 20;
|
||||
greenLightEffect.Opacity = 1;
|
||||
greenLightEffect.Color = Colors.Green;
|
||||
_greenLightEffect.BlurRadius = 20;
|
||||
_greenLightEffect.Opacity = 1;
|
||||
_greenLightEffect.Color = Colors.Green;
|
||||
|
||||
blueLightEffect.BlurRadius = 20;
|
||||
blueLightEffect.Opacity = 1;
|
||||
blueLightEffect.Color = Colors.Blue;
|
||||
_blueLightEffect.BlurRadius = 20;
|
||||
_blueLightEffect.Opacity = 1;
|
||||
_blueLightEffect.Color = Colors.Blue;
|
||||
|
||||
buzzerLightEffect.BlurRadius = 20;
|
||||
buzzerLightEffect.Opacity = 1;
|
||||
buzzerLightEffect.Color = Colors.White;
|
||||
_buzzerLightEffect.BlurRadius = 20;
|
||||
_buzzerLightEffect.Opacity = 1;
|
||||
_buzzerLightEffect.Color = Colors.White;
|
||||
}
|
||||
|
||||
|
||||
|
@ -97,7 +76,7 @@ namespace Aitex.Core.UI.DeviceControl
|
|||
if (rectangle1.Opacity != 1)
|
||||
{
|
||||
rectangle1.Opacity = 1;
|
||||
rectangle1.Effect = redLightEffect;
|
||||
rectangle1.Effect = _redLightEffect;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -114,7 +93,7 @@ namespace Aitex.Core.UI.DeviceControl
|
|||
if (rectangle2.Opacity != 1)
|
||||
{
|
||||
rectangle2.Opacity = 1;
|
||||
rectangle2.Effect = yellowLightEffect;
|
||||
rectangle2.Effect = _yellowLightEffect;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -131,7 +110,7 @@ namespace Aitex.Core.UI.DeviceControl
|
|||
if (rectangle3.Opacity != 1)
|
||||
{
|
||||
rectangle3.Opacity = 1;
|
||||
rectangle3.Effect = greenLightEffect;
|
||||
rectangle3.Effect = _greenLightEffect;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -148,7 +127,7 @@ namespace Aitex.Core.UI.DeviceControl
|
|||
if (rectangle4.Opacity != 1)
|
||||
{
|
||||
rectangle4.Opacity = 1;
|
||||
rectangle4.Effect = blueLightEffect;
|
||||
rectangle4.Effect = _blueLightEffect;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -160,12 +139,13 @@ namespace Aitex.Core.UI.DeviceControl
|
|||
}
|
||||
}
|
||||
|
||||
if (DeviceData.IsBuzzerOn || DeviceData.IsBuzzer1On|| DeviceData.IsBuzzer2On|| DeviceData.IsBuzzer3On|| DeviceData.IsBuzzer4On)
|
||||
if (DeviceData.IsBuzzerOn || DeviceData.IsBuzzer1On || DeviceData.IsBuzzer2On || DeviceData.IsBuzzer3On ||
|
||||
DeviceData.IsBuzzer4On)
|
||||
{
|
||||
if (rectangle5.Opacity != 1)
|
||||
{
|
||||
rectangle5.Opacity = 1;
|
||||
rectangle5.Effect = buzzerLightEffect;
|
||||
rectangle5.Effect = _buzzerLightEffect;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -187,5 +167,13 @@ namespace Aitex.Core.UI.DeviceControl
|
|||
BuzzingWarningConfigCallback.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
private void TopGrid_OnMouseEnter(object sender, MouseEventArgs e)
|
||||
{
|
||||
TopGrid.ToolTip = $"Red: {DeviceData.RedLightEvent}\r\n" +
|
||||
$"Yellow: {DeviceData.YellowLightEvent}\r\n" +
|
||||
$"Green: {DeviceData.GreenLightEvent}\r\n" +
|
||||
$"Buzzer: {DeviceData.BuzzerEvent}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue