ReadShiftTotalizerResponse.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. using Edge.Core.Parser.BinaryParser.Util;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.IO;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. namespace LanTian_Pump_664_Or_886.MessageEntity.Incoming
  9. {
  10. public class ReadShiftTotalizerResponse : MessageBase
  11. {
  12. /// <summary>
  13. /// Without decimal points
  14. /// </summary>
  15. public long VolumeTotalizer
  16. {
  17. get
  18. {
  19. if (base.BodyAndXRL.Count - 2 == 10)
  20. {
  21. /*Model 664*/
  22. return base.BodyAndXRL.Take(5).GetBcdLong();
  23. }
  24. else if (base.BodyAndXRL.Count - 2 == 12)
  25. {
  26. /*Model 886*/
  27. return base.BodyAndXRL.Take(6).GetBcdLong();
  28. }
  29. throw new InvalidDataException("data body length should either 10 or 12, but now is: " + (base.BodyAndXRL.Count - 1));
  30. }
  31. }
  32. /// <summary>
  33. /// Without decimal points
  34. /// </summary>
  35. public long AmountTotalizer
  36. {
  37. get
  38. {
  39. if (base.BodyAndXRL.Count - 2 == 10)
  40. {
  41. /*Model 664*/
  42. return base.BodyAndXRL.Skip(5).Take(5).GetBcdLong();
  43. }
  44. else if (base.BodyAndXRL.Count - 2 == 12)
  45. {
  46. /*Model 886*/
  47. return base.BodyAndXRL.Skip(6).Take(6).GetBcdLong();
  48. }
  49. throw new InvalidDataException("data body length should either 10 or 12, but now is: " + (base.BodyAndXRL.Count - 1));
  50. }
  51. }
  52. }
  53. }