ChangePumpPriceRequest.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. using Edge.Core.Parser.BinaryParser.Attributes;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. namespace ZhongSheng_NonIC_Pump
  7. {
  8. /// <summary>
  9. /// PC机发送数据(油价)到加油机(油机收到命令后要应答给PC同样帧号的确认命令);
  10. /// </summary>
  11. public class ChangePumpPriceRequest : MessageTemplateBase
  12. {
  13. /// <summary>
  14. /// block count
  15. /// </summary>
  16. [Format(1, EncodingType.BIN, 1)]
  17. public byte 信息计数 { get; set; }
  18. [EnumerableFormat("信息计数", 2, EncodingType = EncodingType.BIN)]
  19. public List<NozzleAndPrice> NozzleAndPrices { get; set; }
  20. public ChangePumpPriceRequest(IEnumerable<NozzleAndPrice> nozzleAndPrices)
  21. {
  22. base.CommandCode = 0x34;
  23. this.信息计数 = (byte)nozzleAndPrices.Count();
  24. this.NozzleAndPrices = nozzleAndPrices.ToList();
  25. }
  26. public ChangePumpPriceRequest(byte nozzleNumber, int priceWithoutDecimal)
  27. : this(new[] {
  28. new NozzleAndPrice(){ 枪号 = nozzleNumber, 油价 =priceWithoutDecimal }
  29. })
  30. {
  31. }
  32. }
  33. public class NozzleAndPrice
  34. {
  35. /// <summary>
  36. /// 枪号为以整个加油站油枪为基础的油枪顺序编号
  37. /// </summary>
  38. [Format(1, EncodingType.BIN, 1)]
  39. public byte 枪号 { get; set; }
  40. /// <summary>
  41. /// 油价(带2位小数)
  42. /// </summary>
  43. [Format(3, EncodingType.BIN, 2)]
  44. public int 油价 { get; set; }
  45. }
  46. }