dc/Handlers/S2F16Handler.cs
13118993771@163.com 562bd7a7b8 新版
2023-02-23 11:33:23 +08:00

62 lignes
2.4 KiB
C#

// ********************************************************************************
// 文件名字: S2F16Handler
// 文件描述: S2F16Handler
// 开发人员: Michael
// 创建时间: 2019/11/8 0:08
//
// 更新历史:
// + 创建 S2F16Handler.cs 文件. by Michael @2019/11/8 0:08
// ********************************************************************************
using Glorysoft.SECS.EQP.Common;
using Glorysoft.SECS.EQP.Message;
using Glorysoft.SECS.EQP.Utilities;
using Glorysoft.SECSwell;
using System.Linq;
using System.Threading;
using System;
using ARI.EAP.HOST;
using Glorysoft.SECS.EQP.Commands;
using ARI.EAP.HOST.MQ.body;
using ARI.EAP.HOST.MQ;
using System.Threading.Tasks;
using ARI.EAP.HOST.Common;
namespace Glorysoft.SECS.EQP.Handlers
{
public class S2F16Handler : ISECSMessageHandler
{
public void Execute(SECSContext context, SECSTransaction trans, SECSErrors err, string errmsg)
{
Global.MF.addlog(trans, LoggerService.Receive, "New Equipment Constants Send", 1);
LoggerService.SECSLogger.Info(trans.Secondary);
SECSMessage reply = trans.Secondary;
S2F16Item item = new S2F16Item();
item.EAC = reply.Root.Value.To<byte[]>().FirstOrDefault();
if (trans.Tag != null)
{
if (trans.Tag.GetType() == typeof(ECChangeBody))
{
if(item.EAC == 00)
{
MQMessage mQMessage = new MQMessage();
mQMessage.header.messageName = "ECChange";
ECChangeBody eCChangeBody = trans.Tag as ECChangeBody;
eCChangeBody.spoolingFlag = EquipmentStatus.SpoolingFlag.ToString();
eCChangeBody.eventTimestamp = System.DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss.fff");
mQMessage.body = eCChangeBody;
Task.Run(() => MainForm.mq.EAPRequest(mQMessage));
Command.S1F15Command();
Thread.Sleep(500);
Command.S1F17Command();
}
}
else
{
var scenario = trans.Tag as Scenario;
Thread.Sleep(500);
scenario.ExecuteNextStep();
}
}
}
}
}