83 rivejä
2.6 KiB
C#
83 rivejä
2.6 KiB
C#
#region << 版 本 注 释 >>
|
||
/*----------------------------------------------------------------
|
||
* 创建者:13118
|
||
* 创建时间:2022/3/17 15:08:35
|
||
* 版本:V1.0.0
|
||
* 描述:
|
||
*
|
||
* ----------------------------------------------------------------
|
||
* 修改人:
|
||
* 时间:
|
||
* 修改说明:
|
||
*
|
||
* 版本:V1.0.1
|
||
*----------------------------------------------------------------*/
|
||
#endregion << 版 本 注 释 >>
|
||
|
||
using ARI.EAP.HOST.SRD;
|
||
using ARI.EAP.HOST.Utilities;
|
||
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
|
||
{
|
||
/// <summary>
|
||
/// MESHeartBit 的摘要说明
|
||
/// 提供与MES的连接心跳和monitor的心跳
|
||
/// </summary>
|
||
public class MESHeartBit
|
||
{
|
||
private Timer timer1;
|
||
private string url = Configurations.conf.httpConfiguration.heartBitUrl;
|
||
|
||
public MESHeartBit()
|
||
{
|
||
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);
|
||
}
|
||
}
|
||
|
||
[Serializable]
|
||
public class MESHeartBitParam
|
||
{
|
||
public string connectStatus { get; set; }
|
||
public string deviceId { get; set; }
|
||
public string eapStatus { get; set; }
|
||
public string equipmentName { get; set; }
|
||
public string ip { get; set; }
|
||
public string mqStatus { get; set; }
|
||
public string port { get; set; }
|
||
|
||
public MESHeartBitParam()
|
||
{
|
||
this.deviceId = Configurations.conf.connectSetting.deviceId;
|
||
this.equipmentName = Configurations.conf.connectSetting.equipmentName1;
|
||
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();
|
||
}
|
||
}
|
||
} |