终端一体化运控平台
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 

77 satır
2.2 KiB

  1. using BPASmartClient.DRCoffee;
  2. using BPASmartClient.EventBus;
  3. using BPASmartClient.Helper;
  4. using BPASmartClient.Model;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. namespace BPASmartClient.DRCoffee
  11. {
  12. public class MorkCStatus : Singleton<MorkCStatus>
  13. {
  14. private DRCoffee_CoffeEndCookEvent coffeEndCook = new DRCoffee_CoffeEndCookEvent();
  15. private DateTime lastRefreshTime = DateTime.MinValue;
  16. /// <summary>
  17. /// 是否在线
  18. /// </summary>
  19. public bool OnLine { get { return DateTime.Now.Subtract(lastRefreshTime).TotalSeconds <= 3; } }
  20. /// <summary>
  21. /// 咖啡机状态
  22. /// </summary>
  23. public DrCoffeeStatus CoffeeStatus { get; set; }
  24. /// <summary>
  25. /// 应用状态
  26. /// </summary>
  27. public DrCoffeeAppStatus AppStatus { get; set; }
  28. /// <summary>
  29. /// 警告信息
  30. /// </summary>
  31. public DrCoffeeWarning Warning { get; set; }
  32. /// <summary>
  33. /// 故障信息
  34. /// </summary>
  35. public DrCoffeeFault Fault { get; set; }
  36. public bool CanDo
  37. {
  38. get
  39. {
  40. if (!OnLine)
  41. return false;
  42. if (Warning != DrCoffeeWarning.无警告)
  43. return false;
  44. if (Fault != DrCoffeeFault.无故障)
  45. return false;
  46. return true;
  47. }
  48. }
  49. /// <summary>
  50. /// 咖啡机状态解析
  51. /// </summary>
  52. /// <param name="package"></param>
  53. public void ProcessPackage(DrCoffeePackage package)
  54. {
  55. if (CoffeeStatus == DrCoffeeStatus.Running && package.Status != DrCoffeeStatus.Running)
  56. {
  57. CoffeeStatus = package.Status;
  58. coffeEndCook.Publish();
  59. }
  60. else
  61. {
  62. CoffeeStatus = package.Status;
  63. }
  64. AppStatus = package.ApplicationStatus;
  65. Warning = package.Warning;
  66. Fault = package.Fault;
  67. lastRefreshTime = DateTime.Now;
  68. }
  69. }
  70. }