终端一体化运控平台
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 

93 rindas
3.3 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. using Newtonsoft.Json;
  11. using BPA.Message;
  12. using System.Windows;
  13. namespace BPASmartClient.ScreenLib
  14. {
  15. public class ScreenMorksControlViewModel : NotifyBase
  16. {
  17. #region 变量
  18. /// <summary>
  19. /// 广告地址
  20. /// </summary>
  21. public Uri GgAdder { get { return _GgAdder; } set { _GgAdder = value; OnPropertyChanged(); } }
  22. private Uri _GgAdder = new Uri(System.Configuration.ConfigurationManager.AppSettings["GgAdder"].ToString());
  23. /// <summary>
  24. /// 界面数据绑定
  25. /// </summary>
  26. public ScreenModelMorkS ViewData
  27. {
  28. get { return _ViewData; }
  29. set
  30. {
  31. _ViewData = value;
  32. OnPropertyChanged();
  33. }
  34. }
  35. private ScreenModelMorkS _ViewData = new ScreenModelMorkS();
  36. /// <summary>
  37. /// 当前刷新数据类型
  38. /// </summary>
  39. public ScreenDeviceType type = ScreenDeviceType.煮面机;
  40. /// <summary>
  41. /// 正在制作订单数据
  42. /// </summary>
  43. public ObservableCollection<OrderMakeFormModel> OrderMakeList
  44. {
  45. get { return _OrderMakeList; }
  46. set
  47. {
  48. _OrderMakeList = value;
  49. OnPropertyChanged();
  50. }
  51. }
  52. private ObservableCollection<OrderMakeFormModel> _OrderMakeList = new ObservableCollection<OrderMakeFormModel>();
  53. /// <summary>
  54. /// 制作完成订单数据
  55. /// </summary>
  56. public ObservableCollection<OrderMakeFormModel> OrderMakeListOver
  57. {
  58. get { return _OrderMakeListOver; }
  59. set
  60. {
  61. _OrderMakeListOver = value;
  62. OnPropertyChanged();
  63. }
  64. }
  65. private ObservableCollection<OrderMakeFormModel> _OrderMakeListOver = new ObservableCollection<OrderMakeFormModel>();
  66. #endregion
  67. public ScreenMorksControlViewModel()
  68. {
  69. ThreadManage.GetInstance().StartLong(new Action(() =>
  70. {
  71. System.Windows.Application.Current?.Dispatcher.Invoke((Action)(() =>
  72. {
  73. if (Main.GetInstance.mqttDatasDic.ContainsKey(type))
  74. {
  75. ScreenModelMorkS modelMaxWok = Main.GetInstance.mqttDatasDic[type] as ScreenModelMorkS;
  76. if (modelMaxWok != null && modelMaxWok.Alarm != null)
  77. modelMaxWok.Alarm = modelMaxWok.Alarm?.OrderByDescending(k => DateTime.Parse(k.AlarmTime)).ToList();
  78. ViewData = modelMaxWok;
  79. OrderMakeList = JsonConvert.DeserializeObject<ObservableCollection<OrderMakeFormModel>>(JsonConvert.SerializeObject(ViewData.MakeOrder));
  80. OrderMakeListOver = JsonConvert.DeserializeObject<ObservableCollection<OrderMakeFormModel>>(JsonConvert.SerializeObject(ViewData.MakeOrderOver));
  81. }
  82. }));
  83. Thread.Sleep(100);
  84. }), $"{DateTime.Now},线程服务");
  85. }
  86. }
  87. }