电子药箱通讯服务端
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

RequestSupplyDrugProtocol.cs 1.8KB

7 месяцев назад
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Collections.Specialized;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using System.Windows.Media;
  8. namespace Rdh.SocketServer.Client.Models
  9. {
  10. public class RequestSupplyDrugProtocol : EleMedKitProtocol
  11. {
  12. public RequestSupplyDrugProtocol()
  13. {
  14. this.Command = EleMedKitCommand.RequestSupplyList;
  15. this.MinLines = base.MinLines + 3;
  16. }
  17. public UserInfoProtocol? UserInfo { get; set; }
  18. public List<string>? ListBarcode { get; set; }
  19. public string LineEnd { get => EleMedKitProtocolFlags.LineSpiltor; }
  20. public override string GetContent()
  21. {
  22. return base.GetContent()
  23. + UserInfo?.ToString()
  24. + AddList<string>(ListBarcode)
  25. + AddLineContent(LineEnd)
  26. + AddLineContent(CountFlag);
  27. }
  28. public override bool ParseContent(string[] lines)
  29. {
  30. if (!base.ParseContent(lines)
  31. || lines.Length < MinLines)
  32. {
  33. return false;
  34. }
  35. if (!lines[lines.Length - 2].Contains(LineEnd))
  36. {
  37. return false;
  38. }
  39. UserInfo = new UserInfoProtocol();
  40. if (!UserInfo.ParseContent(lines[2]))
  41. {
  42. return false;
  43. }
  44. ListBarcode = new List<string>();
  45. for (int i = 3; i < lines.Length - 2; i++)
  46. {
  47. string barcode = EleMedKitProtocolHelper.GetLineContent(lines[i]);
  48. if (barcode.Length > 0)
  49. {
  50. ListBarcode.Add(barcode);
  51. }
  52. }
  53. return ListBarcode.Count > 0;
  54. }
  55. }
  56. }