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

51 líneas
1.7 KiB
C#

// ********************************************************************************
// 文件名字: S7F18Handler
// 文件描述: S7F18Handler
// 开发人员: Michael
// 创建时间: 2019/11/8 0:08
//
// 更新历史:
// + 创建 S7F18Handler.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.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace Glorysoft.SECS.EQP.Handlers
{
public class S7F20Handler : ISECSMessageHandler
{
public void Execute(SECSContext context, SECSTransaction trans, SECSErrors err, string errmsg)
{
Global.MF.addlog(trans, LoggerService.Receive, trans.Secondary.Description, 1);
LoggerService.SECSLogger.Info(trans.Secondary);
SECSMessage reply = trans.Secondary;
MQMessage mQMessage = new MQMessage();
mQMessage.header.messageName = "RecipeListSend";
RecipeListSendBody recipeListSendBody = new RecipeListSendBody();
for (int i = 1; i < reply.Root.ItemCount + 1; i++)
{
recipeListSendBody.recipeList.Add(reply.Root.Item(i).Value.ToString());
}
mQMessage.body = recipeListSendBody;
Task.Run(() => MainForm.mq.EAPRequest(mQMessage));
if (trans.Tag != null)
{
var scenario = trans.Tag as Scenario;
Thread.Sleep(500);
scenario.ExecuteNextStep();
}
}
}
}