67 lines
2.3 KiB
C#
67 lines
2.3 KiB
C#
using bizFacade;
|
|
using MesServerWork;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace MesServerFunctions
|
|
{
|
|
partial class FunctionMES
|
|
{
|
|
/// <summary>
|
|
/// MES与PLC心跳监听
|
|
/// </summary>
|
|
/// <param name="OpName"></param>
|
|
/// <param name="tagValue"></param>
|
|
private void HeartBeat(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]["数值"]);
|
|
//}
|
|
|
|
//PA010 需要将当前选中订单的状态发送给PLC
|
|
if (OpName == "J07PA010")
|
|
{
|
|
DataTable workDt;
|
|
BaseDataSystemMES.Get_NowWorkOrder(OpName, out workDt);
|
|
// 获取数据 判断有没有条数 没有就全置0 有的话根据机型给 71 5s 72 6s
|
|
MIS_BASE.WritePLC(71, OpName, false);
|
|
MIS_BASE.WritePLC(72, OpName, false);
|
|
if (workDt.Rows.Count > 0)
|
|
{
|
|
if (Convert.ToInt32(workDt.Rows[0]["机型代码"]) == 1 || Convert.ToInt32(workDt.Rows[0]["机型代码"]) == 2)
|
|
{
|
|
// 5s
|
|
MIS_BASE.WritePLC(71, OpName, true);
|
|
}
|
|
else
|
|
{
|
|
MIS_BASE.WritePLC(72, OpName, true);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
catch (Exception err)
|
|
{
|
|
////ApplicationLog.WriteLog(err, "Function02:FalseGO");
|
|
}
|
|
}
|
|
}
|
|
}
|