using Aborlen.Opc.PlcBase;
|
|
using FrameWork.Log;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Aborlen.PlcCommunicationInit
|
|
{
|
|
public partial class WorkStation : StationBase
|
|
{
|
|
|
|
public WorkStation()
|
|
{
|
|
OpcTag.EventTagChanged += StationTagChanged;
|
|
|
|
}
|
|
|
|
private void StationTagChanged(string tagId, int tagMarkCode, object tagValue, DateTime timeTrigger)
|
|
{
|
|
try
|
|
{
|
|
//判断是否为当前工位 如果不是 直接return 工位ID 16位 反射调用对应function方法
|
|
|
|
if (tagId.Substring(2, 16) != ThisStationInfo.StationId)
|
|
{
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
if (ComOpcTagInfos.Where(p => p.TagId == tagId).First().TagClass == 10)
|
|
{
|
|
//触发Com事件
|
|
OpcTag_EventTagChanged(tagId, tagMarkCode, tagValue, timeTrigger);
|
|
|
|
|
|
}
|
|
|
|
if (tagMarkCode == 5010)
|
|
{
|
|
//触发报警
|
|
OpcTag_AlarmChanged(tagId, tagMarkCode, tagValue, timeTrigger);
|
|
|
|
|
|
|
|
}
|
|
|
|
GetDataChange4Log(tagId, tagMarkCode, tagValue, timeTrigger);
|
|
}
|
|
catch(Exception ex)
|
|
{
|
|
LogHelper.WriteLog(LogHelper.GetMethodInfo(), ex);
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
}
|