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

71 lines
3.1 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 Configurations.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(Configurations.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(trans, LoggerService.Send, "Delete Reports", 0);
else
Global.MF.addlog(trans, LoggerService.Send, "Define Reports", 0);
LoggerService.SECSLogger.Info(trans.Primary);
}
}
}
}