// ******************************************************************************** // 文件名字: Command.S2F15 // 文件描述: Command.S2F15 // 开发人员: Michael // 创建时间: 2019/11/8 0:08 // // 更新历史: // + 创建 Command.S2F15.cs 文件. by Michael @2019/11/8 0:08 // ******************************************************************************** using ARI.EAP.HOST; using ARI.EAP.HOST.MQ.body; using ARI.EAP.HOST.SRD; using Glorysoft.SECS.EQP.Message; using Glorysoft.SECS.EQP.Utilities; using Glorysoft.SECSwell; using System; using System.Linq; namespace Glorysoft.SECS.EQP.Commands { public partial class Command { public static void S2F15Command(S2F15Item items, object tag = null) { if (SimulatorInfo.Instance.Context != null && SimulatorInfo.Instance.Context.IsConnected) { var trans = SimulatorInfo.Instance.Context.GetTransaction(2, 15, "S2F15"); if (tag.GetType()== typeof(int)) { ECChangeBody eCChangeBody = new ECChangeBody(); foreach (var item in items.ECs) { var ec = SECSUtil.CreateSECSItem(nameof(items.ECs), eSECS_FORMAT.LIST); ec.Add(SECSUtil.CreateSECSItem(nameof(item.ECID), eSECS_FORMAT.U4, item.ECID)); ec.Add(SECSUtil.CreateSECSItem(nameof(item.ECV), eSECS_FORMAT.U1, item.ECV)); trans.Primary.Root.Add(ec); eCChangeBody.ECList.Add($"{item.ECID}({Configurations.conf.sRDConfiguration.findEC(item.ECID)})", item.ECV.ToString()); } tag = eCChangeBody; } else { var content = Configurations.conf.commandContentCollection.findContent("S2F15_ControlState").content; foreach (string value in content) { var ec = SECSUtil.CreateSECSItem(nameof(items.ECs), eSECS_FORMAT.LIST); var ecv = Configurations.conf.sRDConfiguration.findEC(value); ec.Add(SECSUtil.CreateSECSItem(value, eSECS_FORMAT.U4, ecv.ecid)); trans.Primary.Root.Add(ec); } trans.Primary.Root.Item(1).Add(SECSUtil.CreateSECSItem("ECV", eSECS_FORMAT.U1, 5)); trans.Primary.Root.Item(2).Add(SECSUtil.CreateSECSItem("ECV", eSECS_FORMAT.U1, 5)); } trans.Tag = tag; SimulatorInfo.Instance.Context.SendMessage(trans); Global.MF.addlog(trans, LoggerService.Send, trans.Primary.Description, 0); LoggerService.SECSLogger.Info(trans.Primary); } } } }