终端一体化运控平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

146 lines
6.6 KiB

  1. using BPA.Helper;
  2. using BPA.Message.Enum;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Collections.ObjectModel;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading;
  9. using System.Threading.Tasks;
  10. namespace BPASmartClient.ScreenLib
  11. {
  12. public class ScreenSplitMealsControl2ViewModel : NotifyBase
  13. {
  14. #region 变量
  15. /// <summary>
  16. /// 柱状图显示集合
  17. /// </summary>
  18. public IEnumerable<KeyValuePair<string, double>> Histogram { get { return _Histogram; } set { _Histogram = value; OnPropertyChanged(); } }
  19. private IEnumerable<KeyValuePair<string, double>> _Histogram = new List<KeyValuePair<string, double>>();
  20. /// <summary>
  21. /// 设备是否运行
  22. /// </summary>
  23. public DevIsRun DevIsRun { get { return _DevIsRun; } set { _DevIsRun = value; OnPropertyChanged(); } }
  24. private DevIsRun _DevIsRun = DevIsRun.停止;
  25. /// <summary>
  26. /// 设备状态
  27. /// </summary>
  28. public DevRunStatus RunStatus { get { return _RunStatus; } set { _RunStatus = value; OnPropertyChanged(); } }
  29. private DevRunStatus _RunStatus = DevRunStatus.正常;
  30. /// <summary>
  31. /// 订单数
  32. /// </summary>
  33. public int DdCount { get { return _DdCount; } set { _DdCount = value; OnPropertyChanged(); } }
  34. private int _DdCount = 0;
  35. /// <summary>
  36. /// 异常订单数
  37. /// </summary>
  38. public int YCDdCount { get { return _YCDdCount; } set { _YCDdCount = value; OnPropertyChanged(); } }
  39. private int _YCDdCount = 0;
  40. /// <summary>
  41. /// 广告地址
  42. /// </summary>
  43. public Uri GgAdder { get { return _GgAdder; } set { _GgAdder = value; OnPropertyChanged(); } }
  44. private Uri _GgAdder = new Uri(System.Configuration.ConfigurationManager.AppSettings["GgAdder"].ToString());
  45. /// <summary>
  46. /// 告警数据
  47. /// </summary>
  48. public ObservableCollection<AlarmMsModel> AlarmList
  49. {
  50. get { return _AlarmList; }
  51. set
  52. {
  53. _AlarmList = value;
  54. OnPropertyChanged();
  55. }
  56. }
  57. private ObservableCollection<AlarmMsModel> _AlarmList = new ObservableCollection<AlarmMsModel>();
  58. /// <summary>
  59. /// 菜品类型-左
  60. /// </summary>
  61. public ObservableCollection<CookType> CookTypeListLeft
  62. {
  63. get { return _CookTypeListLeft; }
  64. set
  65. {
  66. _CookTypeListLeft = value;
  67. OnPropertyChanged();
  68. }
  69. }
  70. private ObservableCollection<CookType> _CookTypeListLeft = new ObservableCollection<CookType>();
  71. /// <summary>
  72. /// 菜品类型-右边
  73. /// </summary>
  74. public ObservableCollection<CookType> CookTypeListReit
  75. {
  76. get { return _CookTypeListReit; }
  77. set
  78. {
  79. _CookTypeListReit = value;
  80. OnPropertyChanged();
  81. }
  82. }
  83. private ObservableCollection<CookType> _CookTypeListReit = new ObservableCollection<CookType>();
  84. #endregion
  85. public ScreenSplitMealsControl2ViewModel()
  86. {
  87. Init();
  88. }
  89. /// <summary>
  90. /// 初始化
  91. /// </summary>
  92. public void Init()
  93. {
  94. ThreadManage.GetInstance().StartLong(new Action(() =>
  95. {
  96. System.Windows.Application.Current?.Dispatcher.Invoke((Action)(() =>
  97. {
  98. RunStatus = RunStatus == DevRunStatus.正常 ? DevRunStatus.异常 : DevRunStatus.正常;
  99. DevIsRun = DevIsRun == DevIsRun.运行 ? DevIsRun.停止 : DevIsRun.运行;
  100. DdCount = new Random().Next(0, 400);
  101. YCDdCount = new Random().Next(0, 400);
  102. List<ORDER_STATUS> oRDER_s = new List<ORDER_STATUS>() { ORDER_STATUS.WAIT, ORDER_STATUS.COOKING };
  103. List<ORDER_STATUS> oRDER_s1 = new List<ORDER_STATUS>() { ORDER_STATUS.COMPLETED_COOK, ORDER_STATUS.COMPLETED_TAKE };
  104. List<string> name_s = new List<string>() { "担担面", "鸡蛋面", "火鸡面", "扬州炒饭", "回锅肉盖饭", "炒茄子" };
  105. CookTypeListReit = new ObservableCollection<CookType>();
  106. CookTypeListReit.Add(new CookType { Name = name_s[0], Name1 = name_s[1] });
  107. CookTypeListReit.Add(new CookType { Name = name_s[2], Name1 = name_s[3] });
  108. CookTypeListReit.Add(new CookType { Name = name_s[4], Name1 = name_s[5] });
  109. CookTypeListLeft = new ObservableCollection<CookType>();
  110. CookTypeListLeft.Add(new CookType { Name = name_s[0], Name1 = name_s[1] });
  111. CookTypeListLeft.Add(new CookType { Name = name_s[2], Name1 = name_s[3] });
  112. CookTypeListLeft.Add(new CookType { Name = name_s[4], Name1 = name_s[5] });
  113. AlarmList = new ObservableCollection<AlarmMsModel>();
  114. AlarmList.Add(new AlarmMsModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" });
  115. AlarmList.Add(new AlarmMsModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" });
  116. AlarmList.Add(new AlarmMsModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" });
  117. AlarmList.Add(new AlarmMsModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" });
  118. AlarmList.Add(new AlarmMsModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" });
  119. AlarmList.Add(new AlarmMsModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" });
  120. Histogram = new[] {
  121. new KeyValuePair<string, double>(name_s[0], new Random().Next(0,400)),
  122. new KeyValuePair<string, double>(name_s[1], new Random().Next(0,400)),
  123. new KeyValuePair<string, double>(name_s[2], new Random().Next(0,400)),
  124. new KeyValuePair<string, double>(name_s[3], new Random().Next(0,400)),
  125. new KeyValuePair<string, double>(name_s[4], new Random().Next(0,400))};
  126. }));
  127. Thread.Sleep(5000);
  128. }), $"{DateTime.Now}_2,线程服务");
  129. }
  130. }
  131. }