dc/Handlers/S5F4Handler.cs

71 行
2.6 KiB
C#
Raw 通常表示 履歴

2022-04-01 17:03:54 +08:00
// ********************************************************************************
// 文件名字: S5F4Handler
// 文件描述: S5F4Handler
// 开发人员: Michael
// 创建时间: 2019/11/8 0:08
//
// 更新历史:
// + 创建 S5F4Handler.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 ARI.EAP.HOST.Common;
using ARI.EAP.HOST.MQ;
using ARI.EAP.HOST.MQ.body;
using System.Threading.Tasks;
namespace Glorysoft.SECS.EQP.Handlers
{
public class S5F4Handler : ISECSMessageHandler
{
public void Execute(SECSContext context, SECSTransaction trans, SECSErrors err, string errmsg)
{
SECSMessage reply = trans.Secondary;
S5F4Item item = new S5F4Item();
item.ACKC5 = reply.Root.Value.To<byte[]>().FirstOrDefault();
MQMessage mQMessage = new MQMessage();
2022-12-16 13:01:24 +08:00
mQMessage.header.messageName = "DisableEnableAlarm";
2022-04-01 17:03:54 +08:00
S5F3Body s5F3Body = new S5F3Body();
s5F3Body.eventTimestamp = System.DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss.fff");
2023-02-23 11:33:23 +08:00
if (EquipmentStatus.S5F3 == "AlarmEnable" )
2022-04-01 17:03:54 +08:00
{
2022-12-16 13:01:24 +08:00
Global.MF.addlog(trans, LoggerService.Receive, "Alarm Disable", 1);
2022-04-01 17:03:54 +08:00
LoggerService.SECSLogger.Info(trans.Secondary);
2023-02-23 11:33:23 +08:00
if (item.ACKC5 == 0)
{
Global.MF.S5F3BottonUpdate(EquipmentStatus.S5F3);
s5F3Body.enableAlarmState = "0";
EquipmentStatus.S5F3 = "AlarmDisable";
}
2022-04-01 17:03:54 +08:00
}
2023-02-23 11:33:23 +08:00
else if(EquipmentStatus.S5F3 == "AlarmDisable" )
2022-04-01 17:03:54 +08:00
{
2022-12-16 13:01:24 +08:00
Global.MF.addlog(trans, LoggerService.Receive, "Alarm Enable", 1);
2022-04-01 17:03:54 +08:00
LoggerService.SECSLogger.Info(trans.Secondary);
2023-02-23 11:33:23 +08:00
if (item.ACKC5 == 0)
{
Global.MF.S5F3BottonUpdate(EquipmentStatus.S5F3);
s5F3Body.enableAlarmState = "1";
EquipmentStatus.S5F3 = "AlarmEnable";
}
2022-04-01 17:03:54 +08:00
}
if(item.ACKC5 == 0)
{
mQMessage.body = s5F3Body;
Task.Run(() => MainForm.mq.EAPRequest(mQMessage));
}
if (trans.Tag != null)
{
var scenario = trans.Tag as Scenario;
Thread.Sleep(500);
scenario.ExecuteNextStep();
}
}
}
}