|
- using BPA.Helper;
- using BPA.Message.Enum;
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.Linq;
- using System.Text;
- using System.Threading;
- using System.Threading.Tasks;
-
- namespace BPASmartClient.ScreenLib
- {
- public class ScreenSplitMealsControl2ViewModel : NotifyBase
- {
- #region 变量
- /// <summary>
- /// 柱状图显示集合
- /// </summary>
- public IEnumerable<KeyValuePair<string, double>> Histogram { get { return _Histogram; } set { _Histogram = value; OnPropertyChanged(); } }
- private IEnumerable<KeyValuePair<string, double>> _Histogram = new List<KeyValuePair<string, double>>();
-
- /// <summary>
- /// 设备是否运行
- /// </summary>
- public DevIsRun DevIsRun { get { return _DevIsRun; } set { _DevIsRun = value; OnPropertyChanged(); } }
- private DevIsRun _DevIsRun = DevIsRun.停止;
-
- /// <summary>
- /// 设备状态
- /// </summary>
- public DevRunStatus RunStatus { get { return _RunStatus; } set { _RunStatus = value; OnPropertyChanged(); } }
- private DevRunStatus _RunStatus = DevRunStatus.正常;
-
- /// <summary>
- /// 订单数
- /// </summary>
- public int DdCount { get { return _DdCount; } set { _DdCount = value; OnPropertyChanged(); } }
- private int _DdCount = 0;
-
- /// <summary>
- /// 异常订单数
- /// </summary>
- public int YCDdCount { get { return _YCDdCount; } set { _YCDdCount = value; OnPropertyChanged(); } }
- private int _YCDdCount = 0;
-
- /// <summary>
- /// 广告地址
- /// </summary>
- public Uri GgAdder { get { return _GgAdder; } set { _GgAdder = value; OnPropertyChanged(); } }
- private Uri _GgAdder = new Uri(System.Configuration.ConfigurationManager.AppSettings["GgAdder"].ToString());
-
- /// <summary>
- /// 告警数据
- /// </summary>
- public ObservableCollection<AlarmMsModel> AlarmList
- {
- get { return _AlarmList; }
- set
- {
- _AlarmList = value;
- OnPropertyChanged();
- }
- }
- private ObservableCollection<AlarmMsModel> _AlarmList = new ObservableCollection<AlarmMsModel>();
-
- /// <summary>
- /// 菜品类型-左
- /// </summary>
- public ObservableCollection<CookType> CookTypeListLeft
- {
- get { return _CookTypeListLeft; }
- set
- {
- _CookTypeListLeft = value;
- OnPropertyChanged();
- }
- }
- private ObservableCollection<CookType> _CookTypeListLeft = new ObservableCollection<CookType>();
-
- /// <summary>
- /// 菜品类型-右边
- /// </summary>
- public ObservableCollection<CookType> CookTypeListReit
- {
- get { return _CookTypeListReit; }
- set
- {
- _CookTypeListReit = value;
- OnPropertyChanged();
- }
- }
- private ObservableCollection<CookType> _CookTypeListReit = new ObservableCollection<CookType>();
- #endregion
- public ScreenSplitMealsControl2ViewModel()
- {
- Init();
- }
-
- /// <summary>
- /// 初始化
- /// </summary>
- public void Init()
- {
- ThreadManage.GetInstance().StartLong(new Action(() =>
- {
- System.Windows.Application.Current?.Dispatcher.Invoke((Action)(() =>
- {
- RunStatus = RunStatus == DevRunStatus.正常 ? DevRunStatus.异常 : DevRunStatus.正常;
- DevIsRun = DevIsRun == DevIsRun.运行 ? DevIsRun.停止 : DevIsRun.运行;
- DdCount = new Random().Next(0, 400);
- YCDdCount = new Random().Next(0, 400);
-
- List<ORDER_STATUS> oRDER_s = new List<ORDER_STATUS>() { ORDER_STATUS.WAIT, ORDER_STATUS.COOKING };
- List<ORDER_STATUS> oRDER_s1 = new List<ORDER_STATUS>() { ORDER_STATUS.COMPLETED_COOK, ORDER_STATUS.COMPLETED_TAKE };
-
- List<string> name_s = new List<string>() { "担担面", "鸡蛋面", "火鸡面", "扬州炒饭", "回锅肉盖饭", "炒茄子" };
- CookTypeListReit = new ObservableCollection<CookType>();
- CookTypeListReit.Add(new CookType { Name = name_s[0], Name1 = name_s[1] });
- CookTypeListReit.Add(new CookType { Name = name_s[2], Name1 = name_s[3] });
- CookTypeListReit.Add(new CookType { Name = name_s[4], Name1 = name_s[5] });
-
- CookTypeListLeft = new ObservableCollection<CookType>();
- CookTypeListLeft.Add(new CookType { Name = name_s[0], Name1 = name_s[1] });
- CookTypeListLeft.Add(new CookType { Name = name_s[2], Name1 = name_s[3] });
- CookTypeListLeft.Add(new CookType { Name = name_s[4], Name1 = name_s[5] });
-
- AlarmList = new ObservableCollection<AlarmMsModel>();
- AlarmList.Add(new AlarmMsModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" });
- AlarmList.Add(new AlarmMsModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" });
- AlarmList.Add(new AlarmMsModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" });
- AlarmList.Add(new AlarmMsModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" });
- AlarmList.Add(new AlarmMsModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" });
- AlarmList.Add(new AlarmMsModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" });
- Histogram = new[] {
- new KeyValuePair<string, double>(name_s[0], new Random().Next(0,400)),
- new KeyValuePair<string, double>(name_s[1], new Random().Next(0,400)),
- new KeyValuePair<string, double>(name_s[2], new Random().Next(0,400)),
- new KeyValuePair<string, double>(name_s[3], new Random().Next(0,400)),
- new KeyValuePair<string, double>(name_s[4], new Random().Next(0,400))};
- }));
- Thread.Sleep(5000);
- }), $"{DateTime.Now}_2,线程服务");
- }
- }
- }
|