dc/Handlers/S5F6Handler.cs
13118993771@163.com eb23e102b4 大更新
2022-12-16 13:01:24 +08:00

61 lines
2.3 KiB
C#

// ********************************************************************************
// 文件名字: S1F4Handler
// 文件描述: S1F4Handler
// 开发人员: Michael
// 创建时间: 2019/11/8 0:08
//
// 更新历史:
// + 创建 S1F4Handler.cs 文件. by Michael @2019/11/8 0:08
// ********************************************************************************
using ARI.EAP.HOST;
using ARI.EAP.HOST.MQ;
using ARI.EAP.HOST.MQ.body;
using Glorysoft.SECS.EQP.Common;
using Glorysoft.SECS.EQP.Message;
using Glorysoft.SECS.EQP.Utilities;
using Glorysoft.SECSwell;
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
namespace Glorysoft.SECS.EQP.Handlers
{
public class S5F6Handler : ISECSMessageHandler
{
public void Execute(SECSContext context, SECSTransaction trans, SECSErrors err, string errmsg)
{
MQMessage mQMessage = new MQMessage();
mQMessage.header.messageName = "AlarmList";
AlarmListBody alarmListBody = new AlarmListBody();
int index = 0;
while (trans.Secondary.Root.ItemCount > index)
{
Alarm alarm = new Alarm();
byte[] b = (byte[])trans.Secondary.Root.Item(index + 1).Item(1).Value;
trans.Secondary.Root.Item(index + 1).Item(1).Name = nameof(alarm.ALCD);
alarm.ALCD = b[0].ToString();
alarm.ALID = trans.Secondary.Root.Item(index + 1).Item(2).Value.ToString();
trans.Secondary.Root.Item(index + 1).Item(2).Name = nameof(alarm.ALID);
alarm.ALTX = trans.Secondary.Root.Item(index + 1).Item(3).Value.ToString();
trans.Secondary.Root.Item(index + 1).Item(3).Name = nameof(alarm.ALTX);
alarmListBody.alarmList.Add(alarm);
index++;
}
Global.MF.addlog(trans, LoggerService.Receive, trans.Secondary.Description, 1);
LoggerService.SECSLogger.Info(trans.Secondary);
if (trans.Tag != null)
{
var scenario = trans.Tag as Scenario;
Thread.Sleep(500);
scenario.ExecuteNextStep();
}
else
{
mQMessage.body = alarmListBody;
Task.Run(() => MainForm.mq.EAPRequest(mQMessage));
}
}
}
}