dc/Common/EquipmentStatus.cs

94 wiersze
2.7 KiB
C#

2022-04-01 17:03:54 +08:00
using Glorysoft.SECS.EQP.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace ARI.EAP.HOST.Common
{
public static class EquipmentStatus
{
2022-07-27 14:46:20 +08:00
public static string S5F3 { get; set; } = "AlarmEnable";
2022-12-16 13:01:24 +08:00
public static bool S1F1FuntionStatus { get; set; } = false;
2022-07-27 14:46:20 +08:00
public static ushort SpoolingFlag { get; set; } = 0;
public static Dictionary<string, IEventHandler> EventHandlers { get; set; }
public static ushort commandCount { get; set; } = 0;
public static bool initStatus { get; set; } = false;
public static MESHeartBit mESHeartBit;
2022-12-16 13:01:24 +08:00
public static SocketClient socketClient;
public static S1F1HeartBit S1F1HeartBit;
2022-07-27 14:46:20 +08:00
private static string _MQstate = ConnectState.disconnected;
private static string _EqConnectState = ConnectState.disconnected;
private static RunState _EapState = RunState.Stop;
public static string MQstate
{
get { return _MQstate; }
set
{
if (!_MQstate.Equals(value))
{
_MQstate = value;
Global.MF.MQConnectStatusSet(value);
PublishStatus();
}
}
}
public static string EqConnectState
{
get { return _EqConnectState; }
set
{
if (!_EqConnectState.Equals(value))
{
_EqConnectState = value;
Global.MF.ConnectStatusSet(value);
PublishStatus();
}
}
}
public static RunState EapState
{
get { return _EapState; }
set
{
if (!_EapState.Equals(value))
{
_EapState = value;
PublishStatus();
}
}
}
2022-04-01 17:03:54 +08:00
static EquipmentStatus()
{
2022-07-27 14:46:20 +08:00
mESHeartBit = new MESHeartBit();
2022-12-16 13:01:24 +08:00
socketClient = new SocketClient();
S1F1HeartBit = new S1F1HeartBit();
2022-04-01 17:03:54 +08:00
EventHandlers = new Dictionary<string, IEventHandler>();
foreach (Type item in MethodBase.GetCurrentMethod().DeclaringType.Assembly.GetTypes())
{
if (item.IsClass && item.GetInterface(nameof(IEventHandler)) != null)
{
EventHandlers.Add(item.Name, Activator.CreateInstance(item) as IEventHandler);
}
}
}
2022-07-27 14:46:20 +08:00
static void PublishStatus() {
Task.Run(() => mESHeartBit.Method());
}
2022-04-01 17:03:54 +08:00
}
2022-07-27 14:46:20 +08:00
2022-04-01 17:03:54 +08:00
}