终端一体化运控平台
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 

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