大更新
This commit is contained in:
@@ -30,19 +30,21 @@ namespace ARI.EAP.HOST.SRD
|
||||
/// xml配置文件的实体类
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class Configuration
|
||||
public class Configurations
|
||||
{
|
||||
[XmlIgnore]
|
||||
public static Configuration conf { get; set; }
|
||||
public static Configurations conf { get; set; }
|
||||
public ConnectSetting connectSetting { get; set; }
|
||||
public EAPMonitorSetting eapMonitorSetting { get; set; }
|
||||
public MQConnectionCfg mQConnectionCfg { get; set; }
|
||||
public HttpConfiguration httpConfiguration { get; set; }
|
||||
public ScenarioCollection scenarioCollection { get; set; }
|
||||
public CommandContentCollection commandContentCollection { get; set; }
|
||||
public SRDConfiguration sRDConfiguration { get; set; }
|
||||
public Configuration()
|
||||
public Configurations()
|
||||
{
|
||||
connectSetting = new ConnectSetting();
|
||||
eapMonitorSetting = new EAPMonitorSetting();
|
||||
mQConnectionCfg = new MQConnectionCfg();
|
||||
httpConfiguration = new HttpConfiguration();
|
||||
scenarioCollection = new ScenarioCollection();
|
||||
@@ -64,6 +66,15 @@ namespace ARI.EAP.HOST.SRD
|
||||
public string remotePort { get; set; }
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class EAPMonitorSetting
|
||||
{
|
||||
[XmlAttribute]
|
||||
public string IPAddress { get; set; }
|
||||
[XmlAttribute]
|
||||
public string Port { get; set; }
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class HttpConfiguration
|
||||
{
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace ARI.EAP.HOST.Common
|
||||
/// </summary>
|
||||
public static class Constants
|
||||
{
|
||||
public const string equipmentName = "ACOAT_01";
|
||||
public const string equipmentName = "MARK_01";
|
||||
public const string configuerPath = "Configuration/" + equipmentName + ".xml";
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ namespace ARI.EAP.HOST.Common
|
||||
public static class EquipmentStatus
|
||||
{
|
||||
public static string S5F3 { get; set; } = "AlarmEnable";
|
||||
public static bool S1F1FuntionStatus { get; set; } = false;
|
||||
public static ushort SpoolingFlag { get; set; } = 0;
|
||||
public static Dictionary<string, IEventHandler> EventHandlers { get; set; }
|
||||
public static ushort commandCount { get; set; } = 0;
|
||||
@@ -18,6 +19,10 @@ namespace ARI.EAP.HOST.Common
|
||||
|
||||
public static MESHeartBit mESHeartBit;
|
||||
|
||||
public static SocketClient socketClient;
|
||||
|
||||
public static S1F1HeartBit S1F1HeartBit;
|
||||
|
||||
private static string _MQstate = ConnectState.disconnected;
|
||||
|
||||
private static string _EqConnectState = ConnectState.disconnected;
|
||||
@@ -68,6 +73,8 @@ namespace ARI.EAP.HOST.Common
|
||||
static EquipmentStatus()
|
||||
{
|
||||
mESHeartBit = new MESHeartBit();
|
||||
socketClient = new SocketClient();
|
||||
S1F1HeartBit = new S1F1HeartBit();
|
||||
EventHandlers = new Dictionary<string, IEventHandler>();
|
||||
foreach (Type item in MethodBase.GetCurrentMethod().DeclaringType.Assembly.GetTypes())
|
||||
{
|
||||
|
||||
@@ -28,31 +28,33 @@ namespace ARI.EAP.HOST.Common
|
||||
{
|
||||
/// <summary>
|
||||
/// MESHeartBit 的摘要说明
|
||||
/// 提供与MES的连接心跳
|
||||
/// 提供与MES的连接心跳和monitor的心跳
|
||||
/// </summary>
|
||||
public class MESHeartBit
|
||||
{
|
||||
private Timer timer;
|
||||
private string url = Configuration.conf.httpConfiguration.heartBitUrl;
|
||||
private Timer timer1;
|
||||
private string url = Configurations.conf.httpConfiguration.heartBitUrl;
|
||||
|
||||
public MESHeartBit()
|
||||
{
|
||||
timer = new Timer(60000);
|
||||
timer.Elapsed += new ElapsedEventHandler(Method);
|
||||
timer.AutoReset = true;
|
||||
timer.Enabled = true;
|
||||
timer1 = new Timer(60000);
|
||||
timer1.Elapsed += new ElapsedEventHandler(Method);
|
||||
timer1.AutoReset = true;
|
||||
timer1.Enabled = true;
|
||||
}
|
||||
|
||||
public void Method(object source, ElapsedEventArgs e)
|
||||
{
|
||||
string httpContent = SECSUtil.ToJson<MESHeartBitParam>(new MESHeartBitParam());
|
||||
HttpUtils.sentPOST(url,httpContent);
|
||||
EquipmentStatus.socketClient.SendMessage(httpContent);
|
||||
}
|
||||
|
||||
public void Method()
|
||||
{
|
||||
string httpContent = SECSUtil.ToJson<MESHeartBitParam>(new MESHeartBitParam());
|
||||
HttpUtils.sentPOST(url, httpContent);
|
||||
EquipmentStatus.socketClient.SendMessage(httpContent);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,10 +71,10 @@ namespace ARI.EAP.HOST.Common
|
||||
|
||||
public MESHeartBitParam()
|
||||
{
|
||||
this.deviceId = Configuration.conf.connectSetting.deviceId;
|
||||
this.equipmentName = Configuration.conf.connectSetting.name;
|
||||
this.ip = Configuration.conf.connectSetting.remoteIp;
|
||||
this.port = Configuration.conf.connectSetting.remotePort;
|
||||
this.deviceId = Configurations.conf.connectSetting.deviceId;
|
||||
this.equipmentName = Configurations.conf.connectSetting.name;
|
||||
this.ip = Configurations.conf.connectSetting.remoteIp;
|
||||
this.port = Configurations.conf.connectSetting.remotePort;
|
||||
this.connectStatus = EquipmentStatus.EqConnectState;
|
||||
this.mqStatus = EquipmentStatus.MQstate;
|
||||
this.eapStatus = EquipmentStatus.EapState.ToString();
|
||||
|
||||
49
Common/S1F1HeartBit.cs
Normal file
49
Common/S1F1HeartBit.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using Glorysoft.SECS.EQP.Commands;
|
||||
using Glorysoft.SECS.EQP.Utilities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Timers;
|
||||
|
||||
namespace ARI.EAP.HOST.Common
|
||||
{
|
||||
public class S1F1HeartBit
|
||||
{
|
||||
public Timer timer1;
|
||||
public Timer timer2;
|
||||
|
||||
public S1F1HeartBit()
|
||||
{
|
||||
timer1 = new Timer(60000);
|
||||
timer1.Elapsed += new ElapsedEventHandler(Method);
|
||||
timer1.AutoReset = true;
|
||||
timer1.Enabled = true;
|
||||
timer2 = new Timer(30000);
|
||||
timer2.Elapsed += new ElapsedEventHandler(Method1);
|
||||
timer2.AutoReset = false;
|
||||
timer2.Enabled = false;
|
||||
}
|
||||
|
||||
public void Method(object source, ElapsedEventArgs e)
|
||||
{
|
||||
if (EquipmentStatus.S1F1FuntionStatus)
|
||||
{
|
||||
if (EquipmentStatus.EqConnectState.Equals(ConnectState.connected))
|
||||
{
|
||||
Command.S1F1Command(null);
|
||||
timer2.Stop();
|
||||
timer2.Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Method1(object source, ElapsedEventArgs e)
|
||||
{
|
||||
LoggerService.SYSLogger.Debug("未收到S1F2回复,判断设备与EAP已断连,开始重连...");
|
||||
EquipmentStatus.EqConnectState = ConnectState.connecting;
|
||||
Global.MF.pushBotton("Connect");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -117,6 +117,8 @@ namespace Glorysoft.SECS.EQP.Common
|
||||
}
|
||||
if (Handlers.ContainsKey(msgName))
|
||||
{
|
||||
EquipmentStatus.S1F1HeartBit.timer1.Stop();
|
||||
EquipmentStatus.S1F1HeartBit.timer1.Start();
|
||||
Task.Run(() => Handlers[msgName].Execute(this, trans, err, errmsg));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user