71 lines
2.2 KiB
C#
71 lines
2.2 KiB
C#
using bizFacade;
|
|
using MesServerWork;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace MesServerFunctions
|
|
{
|
|
partial class FunctionMES
|
|
{
|
|
/// <summary>
|
|
/// MES与PLC心跳监听
|
|
/// </summary>
|
|
/// <param name="OpName"></param>
|
|
/// <param name="tagValue"></param>
|
|
private void HeartBeatMES(object e)
|
|
{
|
|
try
|
|
{
|
|
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
|
string OpName = Convert.ToString(msgEvent.OpName);
|
|
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
|
|
|
//返写在MES心跳中
|
|
//MIS_BASE.WritePLC(15, OpName, tagValue);
|
|
|
|
if(tagValue == 1)
|
|
{
|
|
//DataTable tempDt;
|
|
//BaseDataSystemMES.Get_TempData(OpName, "登陆状态", out tempDt);
|
|
//if (tempDt.Rows.Count > 0) MIS_BASE.WritePLC(54, OpName, tempDt.Rows[0]["数值"]);
|
|
}
|
|
}
|
|
catch (Exception err)
|
|
{
|
|
////ApplicationLog.WriteLog(err, "Function02:FalseGO");
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// MES与PLC心跳监听
|
|
/// </summary>
|
|
/// <param name="OpName"></param>
|
|
/// <param name="tagValue"></param>
|
|
private void HeartBeatPLC(object e)
|
|
{
|
|
try
|
|
{
|
|
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
|
string OpName = Convert.ToString(msgEvent.OpName);
|
|
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
|
|
|
int HeartBeatPLC;
|
|
//读取PLC心跳数据
|
|
HeartBeatPLC = Convert.ToInt32(MIS_BASE.ReadPLC(14, OpName));
|
|
//通知WEB修改状态
|
|
string message = "MES|HeartBeatPLC|" + OpName + "|" + HeartBeatPLC.ToString();
|
|
SendMessage.AsyncSendMessage(message);
|
|
}
|
|
catch (Exception err)
|
|
{
|
|
////ApplicationLog.WriteLog(err, "Function02:FalseGO");
|
|
}
|
|
}
|
|
}
|
|
}
|