dc/Handlers/S1F4Handler.cs
13118993771@163.com 5e9d0f1e2d EAP
2022-04-01 17:03:54 +08:00

65 lines
3.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 S1F4Handler : ISECSMessageHandler
{
public void Execute(SECSContext context, SECSTransaction trans, SECSErrors err, string errmsg)
{
MQMessage mQMessage = new MQMessage();
mQMessage.header.messageName = "SVList";
SVListBody sVListBody = new SVListBody();
sVListBody.eventTimestamp = trans.Secondary.Root.Item(1).Value.ToString();
trans.Secondary.Root.Item(1).Name = nameof(sVListBody.eventTimestamp);
sVListBody.CommunicationState = trans.Secondary.Root.Item(2).Value.ToString();
trans.Secondary.Root.Item(2).Name = nameof(sVListBody.CommunicationState);
sVListBody.ControlState = trans.Secondary.Root.Item(3).Value.ToString();
trans.Secondary.Root.Item(3).Name = nameof(sVListBody.ControlState);
sVListBody.PreviousControlState = trans.Secondary.Root.Item(4).Value.ToString();
trans.Secondary.Root.Item(4).Name = nameof(sVListBody.PreviousControlState);
sVListBody.CurrentEquipmentState = trans.Secondary.Root.Item(5).Value.ToString();
trans.Secondary.Root.Item(5).Name = nameof(sVListBody.CurrentEquipmentState);
sVListBody.PreviousEquipmentState = trans.Secondary.Root.Item(6).Value.ToString();
trans.Secondary.Root.Item(6).Name = nameof(sVListBody.PreviousEquipmentState);
sVListBody.PPExecName = trans.Secondary.Root.Item(7).Value.ToString();
trans.Secondary.Root.Item(7).Name = nameof(sVListBody.PPExecName);
sVListBody.SpoolingState = trans.Secondary.Root.Item(8).Value.ToString();
trans.Secondary.Root.Item(8).Name = nameof(sVListBody.SpoolingState);
sVListBody.SpoolCountActual = trans.Secondary.Root.Item(9).Value.ToString();
trans.Secondary.Root.Item(9).Name = nameof(sVListBody.SpoolCountActual);
sVListBody.SpoolCountTotal = trans.Secondary.Root.Item(10).Value.ToString();
trans.Secondary.Root.Item(10).Name = nameof(sVListBody.SpoolCountTotal);
Global.MF.addlog(LoggerService.EtoH, $"S{trans.Secondary.Stream}F{trans.Secondary.Function}", LoggerService.Receive, trans.Description, "=" + trans.Secondary.SystemBytes.ToString());
LoggerService.SECSLogger.Info(trans.Secondary);
mQMessage.body = sVListBody;
Task.Run(() => MainForm.mq.EAPRequest(mQMessage));
if (trans.Tag != null)
{
var scenario = trans.Tag as Scenario;
Thread.Sleep(500);
scenario.ExecuteNextStep();
}
}
}
}