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

71 lines
3.3 KiB
C#

// ********************************************************************************
// 文件名字: Command.S2F33
// 文件描述: Command.S2F33
// 开发人员: Michael
// 创建时间: 2019/11/8 0:08
//
// 更新历史:
// + 创建 Command.S2F33.cs 文件. by Michael @2019/11/8 0:08
// ********************************************************************************
using ARI.EAP.HOST;
using ARI.EAP.HOST.Common;
using ARI.EAP.HOST.SRD;
using Glorysoft.SECS.EQP.Message;
using Glorysoft.SECS.EQP.Utilities;
using Glorysoft.SECSwell;
using System;
using System.Collections.Generic;
namespace Glorysoft.SECS.EQP.Commands
{
public partial class Command
{
public static void S2F33Command(S2F33Item items, object tag = null)
{
if (SimulatorInfo.Instance.Context != null && SimulatorInfo.Instance.Context.IsConnected)
{
var trans = SimulatorInfo.Instance.Context.GetTransaction(2, 33, "S2F33");
trans.Primary.Root.Item(1).SetValue(eSECS_FORMAT.U4,items.DATAID);
var sc = tag as Scenario;
if (!EquipmentStatus.initStatus)
{
foreach (var item in items.Reports)
{
var rpt = SECSUtil.CreateSECSItem("", eSECS_FORMAT.LIST);
rpt.Add(SECSUtil.CreateSECSItem(nameof(item.RPTID), eSECS_FORMAT.U4, item.RPTID));
rpt.Add(SECSUtil.CreateSECSItem("", eSECS_FORMAT.LIST));
//foreach (var svid in item.SVIDs)
//{
// rpt.Item(2).Add(SECSUtil.CreateSECSItem("SVID", eSECS_FORMAT.U4, svid));
//}
trans.Primary.Root.Item(2).Add(rpt);
}
}
else
{
foreach (var even in Configuration.conf.sRDConfiguration.events)
{
var rpt = SECSUtil.CreateSECSItem(even.name, eSECS_FORMAT.LIST);
rpt.Add(SECSUtil.CreateSECSItem(nameof(even.reportid), eSECS_FORMAT.U4, even.reportid));
rpt.Add(SECSUtil.CreateSECSItem("SVList", eSECS_FORMAT.LIST));
foreach(var id in even.validVariables)
{
rpt.Item(2).Add(SECSUtil.CreateSECSItem(Configuration.conf.sRDConfiguration.tryGetSVOrDV(id), eSECS_FORMAT.U4, id));
}
trans.Primary.Root.Item(2).Add(rpt);
}
}
trans.Tag = tag;
SimulatorInfo.Instance.Context.SendMessage(trans);
LoggerService.SECSLogger.Info(trans.Primary);
if (!EquipmentStatus.initStatus)
Global.MF.addlog(LoggerService.HtoE, $"S{trans.Primary.Stream}F{trans.Primary.Function}", LoggerService.Send, "Delete Reports", "=" + trans.Primary.SystemBytes.ToString());
else
Global.MF.addlog(LoggerService.HtoE, $"S{trans.Primary.Stream}F{trans.Primary.Function}", LoggerService.Send, "Define Reports", "=" + trans.Primary.SystemBytes.ToString());
LoggerService.SECSLogger.Info(trans.Primary);
}
}
}
}