using Edge.Core.Parser.BinaryParser.Attributes; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ZhongSheng_NonIC_Pump { /// /// PC机发送数据(油价)到加油机(油机收到命令后要应答给PC同样帧号的确认命令); /// public class ChangePumpPriceRequest : MessageTemplateBase { /// /// block count /// [Format(1, EncodingType.BIN, 1)] public byte 信息计数 { get; set; } [EnumerableFormat("信息计数", 2, EncodingType = EncodingType.BIN)] public List NozzleAndPrices { get; set; } public ChangePumpPriceRequest(IEnumerable nozzleAndPrices) { base.CommandCode = 0x34; this.信息计数 = (byte)nozzleAndPrices.Count(); this.NozzleAndPrices = nozzleAndPrices.ToList(); } public ChangePumpPriceRequest(byte nozzleNumber, int priceWithoutDecimal) : this(new[] { new NozzleAndPrice(){ 枪号 = nozzleNumber, 油价 =priceWithoutDecimal } }) { } } public class NozzleAndPrice { /// /// 枪号为以整个加油站油枪为基础的油枪顺序编号 /// [Format(1, EncodingType.BIN, 1)] public byte 枪号 { get; set; } /// /// 油价(带2位小数) /// [Format(3, EncodingType.BIN, 2)] public int 油价 { get; set; } } }