diff --git a/BPASmartClient.ScreenALL/App.config b/BPASmartClient.ScreenALL/App.config index 04466302..7eeaad9e 100644 --- a/BPASmartClient.ScreenALL/App.config +++ b/BPASmartClient.ScreenALL/App.config @@ -1,9 +1,10 @@  - - - + + + + \ No newline at end of file diff --git a/BPASmartClient.ScreenALL/BPASmartClient.ScreenALL.csproj b/BPASmartClient.ScreenALL/BPASmartClient.ScreenALL.csproj index e66c9b2f..25d2c5e7 100644 --- a/BPASmartClient.ScreenALL/BPASmartClient.ScreenALL.csproj +++ b/BPASmartClient.ScreenALL/BPASmartClient.ScreenALL.csproj @@ -5,7 +5,7 @@ net6.0-windows enable true - 总监控大屏 + 海科食堂监控大屏 hbl.ico diff --git a/BPASmartClient.ScreenLib/BPASmartClient.ScreenLib.csproj b/BPASmartClient.ScreenLib/BPASmartClient.ScreenLib.csproj index c8f6e028..0a472b76 100644 --- a/BPASmartClient.ScreenLib/BPASmartClient.ScreenLib.csproj +++ b/BPASmartClient.ScreenLib/BPASmartClient.ScreenLib.csproj @@ -19,7 +19,7 @@ - + diff --git a/BPASmartClient.ScreenLib/Helper/Main.cs b/BPASmartClient.ScreenLib/Helper/Main.cs index 033bfe83..3071390c 100644 --- a/BPASmartClient.ScreenLib/Helper/Main.cs +++ b/BPASmartClient.ScreenLib/Helper/Main.cs @@ -70,7 +70,7 @@ namespace BPASmartClient.ScreenLib /// /// 设备数据 /// - public Dictionary> mqttDatasDic = new Dictionary>(); + public Dictionary mqttDatasDic = new Dictionary(); /// /// 配置数据 /// @@ -96,11 +96,23 @@ namespace BPASmartClient.ScreenLib if (msg.Count > 0 && msg.TryDequeue(out string s)) { SendScreenDataModel read= JsonConvert.DeserializeObject(s); - if (read != null) + if (read != null && read.Value!=null) { - read?.mqttAicDatasDic?.ToList().ForEach(data => { - mqttDatasDic[data.Key]= data.Value; - }); + switch (read.Name) + { + case ScreenDeviceType.大炒: + mqttDatasDic[read.Name] = JsonConvert.DeserializeObject(read.Value.ToString()); + break; + case ScreenDeviceType.小炒: + mqttDatasDic[read.Name] = JsonConvert.DeserializeObject(read.Value.ToString()); + break; + case ScreenDeviceType.分餐机: + mqttDatasDic[read.Name] = JsonConvert.DeserializeObject(read.Value.ToString()); + break; + case ScreenDeviceType.煮面机: + mqttDatasDic[read.Name] = JsonConvert.DeserializeObject(read.Value.ToString()); + break; + } } } } @@ -208,19 +220,49 @@ namespace BPASmartClient.ScreenLib { Name.Split(',')?.ToList().ForEach(x => { - mqttHelper.Subscrib(x); + if (x == "大炒") + { + mqttHelper.Subscrib(ScreenTOPIC.GetInstance.GetTopic(ScreenDeviceType.大炒)); + }else if (x == "小炒") + { + mqttHelper.Subscrib(ScreenTOPIC.GetInstance.GetTopic(ScreenDeviceType.小炒)); + } + else if (x == "分餐机") + { + mqttHelper.Subscrib(ScreenTOPIC.GetInstance.GetTopic(ScreenDeviceType.分餐机)); + } + else if (x == "煮面机") + { + mqttHelper.Subscrib(ScreenTOPIC.GetInstance.GetTopic(ScreenDeviceType.煮面机)); + } + }); } else { - mqttHelper.Subscrib(Name); + if (Name == "大炒") + { + mqttHelper.Subscrib(ScreenTOPIC.GetInstance.GetTopic(ScreenDeviceType.大炒)); + } + else if (Name == "小炒") + { + mqttHelper.Subscrib(ScreenTOPIC.GetInstance.GetTopic(ScreenDeviceType.小炒)); + } + else if (Name == "分餐机") + { + mqttHelper.Subscrib(ScreenTOPIC.GetInstance.GetTopic(ScreenDeviceType.分餐机)); + } + else if (Name == "煮面机") + { + mqttHelper.Subscrib(ScreenTOPIC.GetInstance.GetTopic(ScreenDeviceType.煮面机)); + } } }); mqttHelper.MessageRecive = new Action((s) => { msg.Enqueue(s); }); } catch (Exception ex) { - MessageLog.GetInstance.ShowEx($"{Name}:初始化连接Redis MQTT,原因:{ex.Message}"); + MessageLog.GetInstance.ShowEx($"{Name}:初始化连接 MQTT,原因:{ex.Message}"); } } diff --git a/BPASmartClient.ScreenLib/Model/DevRunStatus.cs b/BPASmartClient.ScreenLib/Model/DevRunStatus.cs deleted file mode 100644 index 33366505..00000000 --- a/BPASmartClient.ScreenLib/Model/DevRunStatus.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace BPASmartClient.ScreenLib -{ - public enum DevRunStatus - { - 正常, - 异常 - } - - public enum DevIsRun - { - 运行, - 停止 - } -} diff --git a/BPASmartClient.ScreenLib/Model/OrderMakeModel.cs b/BPASmartClient.ScreenLib/Model/OrderMakeModel.cs index 42adb5b8..a29e5515 100644 --- a/BPASmartClient.ScreenLib/Model/OrderMakeModel.cs +++ b/BPASmartClient.ScreenLib/Model/OrderMakeModel.cs @@ -12,7 +12,7 @@ namespace BPASmartClient.ScreenLib /// /// 订单制作Model /// - public class OrderMakeModel : NotifyBase + public class OrderMakeFormModel : NotifyBase { /// /// 状态 @@ -104,60 +104,4 @@ namespace BPASmartClient.ScreenLib } } - /// - /// 告警数据 - /// - public class AlarmMsModel : NotifyBase - { - private string _AlarmTime; - public string AlarmTime - { - get { return _AlarmTime; } - set - { - _AlarmTime = value; - OnPropertyChanged(); - } - } - - - private string _AlarmMs; - public string AlarmMs - { - get { return _AlarmMs; } - set - { - _AlarmMs = value; - OnPropertyChanged(); - } - } - } - - /// - /// 菜品类型 - /// - public class CookType : NotifyBase - { - private string _Name; - public string Name - { - get { return _Name; } - set - { - _Name = value; - OnPropertyChanged(); - } - } - - private string _Name1; - public string Name1 - { - get { return _Name1; } - set - { - _Name1 = value; - OnPropertyChanged(); - } - } - } } diff --git a/BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl1.xaml b/BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl1.xaml index de972084..585b9d31 100644 --- a/BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl1.xaml +++ b/BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl1.xaml @@ -33,7 +33,7 @@ - + - - - 设备当前状态 + + + 今日刷卡数 - + @@ -71,25 +60,23 @@ - - 今日刷卡数 + + 前一位刷卡人 - - 异常刷卡数 + + 当前刷卡人 - - + - public Uri GgAdder { get { return _GgAdder; } set { _GgAdder = value; OnPropertyChanged(); } } private Uri _GgAdder = new Uri(System.Configuration.ConfigurationManager.AppSettings["GgAdder"].ToString()); - - /// - /// 设备是否运行 - /// - public DevIsRun DevIsRun { get { return _DevIsRun; } set { _DevIsRun = value; OnPropertyChanged(); } } - private DevIsRun _DevIsRun = DevIsRun.停止; - - /// - /// 设备状态 - /// - public DevRunStatus RunStatus { get { return _RunStatus; } set { _RunStatus = value; OnPropertyChanged(); } } - private DevRunStatus _RunStatus = DevRunStatus.正常; - - /// - /// 订单数 - /// - public int DdCount { get { return _DdCount; } set { _DdCount = value; OnPropertyChanged(); } } - private int _DdCount = 0; - /// - /// 异常订单数 + /// 界面数据绑定 /// - public int YCDdCount { get { return _YCDdCount; } set { _YCDdCount = value; OnPropertyChanged(); } } - private int _YCDdCount = 0; - - /// - /// 正在制作订单数据 - /// - public ObservableCollection OrderMakeList { get { return _OrderMakeList; } set { - _OrderMakeList = value; - OnPropertyChanged(); - } } - private ObservableCollection _OrderMakeList = new ObservableCollection(); - - /// - /// 制作完成订单数据 - /// - public ObservableCollection OrderMakeListOver + public ScreenModelMaxWok ViewData { - get { return _OrderMakeListOver; } + get { return _ViewData; } set { - _OrderMakeListOver = value; + _ViewData = value; OnPropertyChanged(); } } - private ObservableCollection _OrderMakeListOver = new ObservableCollection(); + private ScreenModelMaxWok _ViewData = new ScreenModelMaxWok(); /// - /// 告警数据 + /// 当前刷新数据类型 /// - public ObservableCollection AlarmList - { - get { return _AlarmList; } - set - { - _AlarmList = value; - OnPropertyChanged(); - } - } - private ObservableCollection _AlarmList = new ObservableCollection(); - - - + public ScreenDeviceType type = ScreenDeviceType.大炒; #endregion - public ScreenMaxWokControlViewModel() - { - Init(); - } - /// - /// 初始化 - /// - public void Init() + public ScreenMaxWokControlViewModel() { 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_s = new List() { ORDER_STATUS.WAIT, ORDER_STATUS.COOKING }; - List oRDER_s1 = new List() { ORDER_STATUS.COMPLETED_COOK, ORDER_STATUS.COMPLETED_TAKE }; - - List name_s = new List() { "担担面", "鸡蛋面", "火鸡面", "扬州炒饭", "回锅肉盖饭" }; - OrderMakeList = new ObservableCollection(); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "011", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "012", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "013", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "014", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - - OrderMakeListOver = new ObservableCollection(); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "001", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "002", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "003", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "005", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "006", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "008", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "009", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "010", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - - - AlarmList = new ObservableCollection(); - 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机构出现故障!!!!" }); + if (Main.GetInstance.mqttDatasDic.ContainsKey(type)) + { + ScreenModelMaxWok modelMaxWok= Main.GetInstance.mqttDatasDic[type] as ScreenModelMaxWok; + if(modelMaxWok != null && modelMaxWok.Alarm!=null) + modelMaxWok.Alarm= modelMaxWok.Alarm?.OrderByDescending(k =>DateTime.Parse(k.AlarmTime)).ToList(); + ViewData = modelMaxWok; + } })); - Thread.Sleep(5000); + Thread.Sleep(1000); }), $"{DateTime.Now},线程服务"); } } diff --git a/BPASmartClient.ScreenLib/炒锅/ScreenMinWokControl.xaml b/BPASmartClient.ScreenLib/炒锅/ScreenMinWokControl.xaml index 6713b78f..5bfda26b 100644 --- a/BPASmartClient.ScreenLib/炒锅/ScreenMinWokControl.xaml +++ b/BPASmartClient.ScreenLib/炒锅/ScreenMinWokControl.xaml @@ -25,42 +25,119 @@ - + - - + + - 设备当前状态 + 设备状态 - - - 今日订单数 + + + + + + 工作状态 - 炒制作中 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -71,33 +148,11 @@ - - - - - + 炒锅加热挡位 - - - - - + 炒锅搅拌挡位 @@ -108,33 +163,11 @@ - - - - - + 炒锅翻转速度 - - - - - + 当前锅底温度 @@ -149,75 +182,149 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - + + - 设备当前状态 + 设备状态 - - - 今日订单数 + + + + + + 工作状态 - 炒制作中 + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -228,33 +335,11 @@ - - - - - + 炒锅加热挡位 - - - - - + 炒锅搅拌挡位 @@ -265,33 +350,11 @@ - - - - - + 炒锅翻转速度 - - - - - + 当前锅底温度 diff --git a/BPASmartClient.ScreenLib/炒锅/ScreenMinWokControlViewModel.cs b/BPASmartClient.ScreenLib/炒锅/ScreenMinWokControlViewModel.cs index e341c991..4500b69a 100644 --- a/BPASmartClient.ScreenLib/炒锅/ScreenMinWokControlViewModel.cs +++ b/BPASmartClient.ScreenLib/炒锅/ScreenMinWokControlViewModel.cs @@ -1,4 +1,5 @@ using BPA.Helper; +using BPA.Message; using BPA.Message.Enum; using System; using System.Collections.Generic; @@ -13,178 +14,46 @@ namespace BPASmartClient.ScreenLib public class ScreenMinWokControlViewModel : NotifyBase { #region 变量 - /// - /// 柱状图显示集合 - /// - public IEnumerable> Histogram { get { return _Histogram; } set { _Histogram = value; OnPropertyChanged(); } } - private IEnumerable> _Histogram = new List>(); - - /// - /// 设备是否运行 - /// - public DevIsRun DevIsRun { get { return _DevIsRun; } set { _DevIsRun = value; OnPropertyChanged(); } } - private DevIsRun _DevIsRun = DevIsRun.停止; - - /// - /// 设备状态 - /// - public DevRunStatus RunStatus { get { return _RunStatus; } set { _RunStatus = value; OnPropertyChanged(); } } - private DevRunStatus _RunStatus = DevRunStatus.正常; - - /// - /// 订单数 - /// - public int DdCount { get { return _DdCount; } set { _DdCount = value; OnPropertyChanged(); } } - private int _DdCount = 0; - - /// - /// 异常订单数 - /// - public int YCDdCount { get { return _YCDdCount; } set { _YCDdCount = value; OnPropertyChanged(); } } - private int _YCDdCount = 0; - /// /// 广告地址 /// public Uri GgAdder { get { return _GgAdder; } set { _GgAdder = value; OnPropertyChanged(); } } private Uri _GgAdder = new Uri(System.Configuration.ConfigurationManager.AppSettings["GgAdder"].ToString()); - /// - /// 正在制作订单数据 + /// 界面数据绑定 /// - public ObservableCollection OrderMakeList + public ScreenModelMinWok ViewData { - get { return _OrderMakeList; } + get { return _ViewData; } set { - _OrderMakeList = value; + _ViewData = value; OnPropertyChanged(); } } - private ObservableCollection _OrderMakeList = new ObservableCollection(); + private ScreenModelMinWok _ViewData = new ScreenModelMinWok(); /// - /// 制作完成订单数据 + /// 当前刷新数据类型 /// - public ObservableCollection OrderMakeListOver - { - get { return _OrderMakeListOver; } - set - { - _OrderMakeListOver = value; - OnPropertyChanged(); - } - } - private ObservableCollection _OrderMakeListOver = new ObservableCollection(); - - /// - /// 告警数据 - /// - public ObservableCollection AlarmList - { - get { return _AlarmList; } - set - { - _AlarmList = value; - OnPropertyChanged(); - } - } - private ObservableCollection _AlarmList = new ObservableCollection(); - + public ScreenDeviceType type = ScreenDeviceType.小炒; #endregion - public ScreenMinWokControlViewModel() - { - Init(); - } - /// - /// 初始化 - /// - public void Init() + public ScreenMinWokControlViewModel() { 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_s = new List() { ORDER_STATUS.WAIT, ORDER_STATUS.COOKING }; - List oRDER_s1 = new List() { ORDER_STATUS.COMPLETED_COOK, ORDER_STATUS.COMPLETED_TAKE }; - - List name_s = new List() { "担担面", "鸡蛋面", "火鸡面", "扬州炒饭", "回锅肉盖饭" }; - OrderMakeList = new ObservableCollection(); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "011", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "012", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "013", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "014", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - - OrderMakeListOver = new ObservableCollection(); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "001", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "002", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "003", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "005", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "006", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "008", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "009", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "010", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - - - AlarmList = new ObservableCollection(); - 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(name_s[0], new Random().Next(0,400)), - new KeyValuePair(name_s[1], new Random().Next(0,400)), - new KeyValuePair(name_s[2], new Random().Next(0,400)), - new KeyValuePair(name_s[3], new Random().Next(0,400)), - new KeyValuePair(name_s[4], new Random().Next(0,400))}; + if (Main.GetInstance.mqttDatasDic.ContainsKey(type)) + { + ScreenModelMinWok modelMaxWok = Main.GetInstance.mqttDatasDic[type] as ScreenModelMinWok; + if (modelMaxWok != null && modelMaxWok.Alarm != null) + modelMaxWok.Alarm = modelMaxWok.Alarm?.OrderByDescending(k => DateTime.Parse(k.AlarmTime)).ToList(); + ViewData = modelMaxWok; + } })); - Thread.Sleep(5000); + Thread.Sleep(1000); }), $"{DateTime.Now},线程服务"); } } diff --git a/BPASmartClient.ScreenLib/煮面机/ScreenMorksControl.xaml b/BPASmartClient.ScreenLib/煮面机/ScreenMorksControl.xaml index 566f2349..d5951f16 100644 --- a/BPASmartClient.ScreenLib/煮面机/ScreenMorksControl.xaml +++ b/BPASmartClient.ScreenLib/煮面机/ScreenMorksControl.xaml @@ -31,7 +31,7 @@ - + - 设备是否运行 + 设备状态 - + - 设备当前状态 + 工作状态 @@ -67,41 +70,41 @@ - + - + - + - + - + - + - + - + @@ -117,35 +120,32 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -157,32 +157,49 @@ - + 今日订单数 - - 机器人当前状态 + + + + + + 机器人状态 - + + - + @@ -190,14 +207,16 @@ 煮面炉1号 - + @@ -205,58 +224,64 @@ 煮面炉2号 - + - + - 煮面炉1号 + 煮面炉3号 - + - 煮面炉2号 + 煮面炉4号 - + - + @@ -264,14 +289,16 @@ 煮面炉5号 - + @@ -279,22 +306,25 @@ 煮面炉6号 - - + + + - + @@ -302,52 +332,44 @@ 温度状态 - - - - - + 料仓位置 - - + - + - 料仓上下物料检测 + 料仓物料检测 - + @@ -355,7 +377,6 @@ 落碗机构缺碗检测 - diff --git a/BPASmartClient.ScreenLib/煮面机/ScreenMorksControlViewModel.cs b/BPASmartClient.ScreenLib/煮面机/ScreenMorksControlViewModel.cs index 4c151d0f..136b4014 100644 --- a/BPASmartClient.ScreenLib/煮面机/ScreenMorksControlViewModel.cs +++ b/BPASmartClient.ScreenLib/煮面机/ScreenMorksControlViewModel.cs @@ -8,6 +8,7 @@ using System.Text; using System.Threading; using System.Threading.Tasks; using Newtonsoft.Json; +using BPA.Message; namespace BPASmartClient.ScreenLib { @@ -19,41 +20,29 @@ namespace BPASmartClient.ScreenLib /// public Uri GgAdder { get { return _GgAdder; } set { _GgAdder = value; OnPropertyChanged(); } } private Uri _GgAdder = new Uri(System.Configuration.ConfigurationManager.AppSettings["GgAdder"].ToString()); - - /// - /// 柱状图显示集合 - /// - public IEnumerable> Histogram { get { return _Histogram; } set { _Histogram = value; OnPropertyChanged(); } } - private IEnumerable> _Histogram = new List>(); - - /// - /// 设备是否运行 - /// - public DevIsRun DevIsRun { get { return _DevIsRun; } set { _DevIsRun = value; OnPropertyChanged(); } } - private DevIsRun _DevIsRun = DevIsRun.停止; - - /// - /// 设备状态 - /// - public DevRunStatus RunStatus { get { return _RunStatus; } set { _RunStatus = value; OnPropertyChanged(); } } - private DevRunStatus _RunStatus = DevRunStatus.正常; - /// - /// 订单数 + /// 界面数据绑定 /// - public int DdCount { get { return _DdCount; } set { _DdCount = value; OnPropertyChanged(); } } - private int _DdCount = 0; + public ScreenModelMorkS ViewData + { + get { return _ViewData; } + set + { + _ViewData = value; + OnPropertyChanged(); + } + } + private ScreenModelMorkS _ViewData = new ScreenModelMorkS(); /// - /// 异常订单数 + /// 当前刷新数据类型 /// - public int YCDdCount { get { return _YCDdCount; } set { _YCDdCount = value; OnPropertyChanged(); } } - private int _YCDdCount = 0; + public ScreenDeviceType type = ScreenDeviceType.煮面机; /// /// 正在制作订单数据 /// - public ObservableCollection OrderMakeList + public ObservableCollection OrderMakeList { get { return _OrderMakeList; } set @@ -62,12 +51,12 @@ namespace BPASmartClient.ScreenLib OnPropertyChanged(); } } - private ObservableCollection _OrderMakeList = new ObservableCollection(); + private ObservableCollection _OrderMakeList = new ObservableCollection(); /// /// 制作完成订单数据 /// - public ObservableCollection OrderMakeListOver + public ObservableCollection OrderMakeListOver { get { return _OrderMakeListOver; } set @@ -76,236 +65,27 @@ namespace BPASmartClient.ScreenLib OnPropertyChanged(); } } - private ObservableCollection _OrderMakeListOver = new ObservableCollection(); - - /// - /// 告警数据 - /// - public ObservableCollection AlarmList - { - get { return _AlarmList; } - set - { - _AlarmList = value; - OnPropertyChanged(); - } - } - private ObservableCollection _AlarmList = new ObservableCollection(); - + private ObservableCollection _OrderMakeListOver = new ObservableCollection(); #endregion - public ScreenMorksControlViewModel() - { - Init(); - } - /// - /// 初始化 - /// - public void Init() + public ScreenMorksControlViewModel() { 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_s = new List() { ORDER_STATUS.WAIT, ORDER_STATUS.COOKING }; - List oRDER_s1 = new List() { ORDER_STATUS.COMPLETED_COOK, ORDER_STATUS.COMPLETED_TAKE }; - - List name_s = new List() { "担担面", "鸡蛋面", "火鸡面", "扬州炒饭", "回锅肉盖饭" }; - OrderMakeList = new ObservableCollection(); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "011", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "012", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "013", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "014", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - - OrderMakeListOver = new ObservableCollection(); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "001", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "002", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "003", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "005", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "006", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "008", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "009", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "010", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); - - - AlarmList = new ObservableCollection(); - 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(name_s[0], new Random().Next(0,400)), - new KeyValuePair(name_s[1], new Random().Next(0,400)), - new KeyValuePair(name_s[2], new Random().Next(0,400)), - new KeyValuePair(name_s[3], new Random().Next(0,400)), - new KeyValuePair(name_s[4], new Random().Next(0,400))}; + if (Main.GetInstance.mqttDatasDic.ContainsKey(type)) + { + ScreenModelMorkS modelMaxWok = Main.GetInstance.mqttDatasDic[type] as ScreenModelMorkS; + if (modelMaxWok != null && modelMaxWok.Alarm != null) + modelMaxWok.Alarm = modelMaxWok.Alarm?.OrderByDescending(k => DateTime.Parse(k.AlarmTime)).ToList(); + ViewData = modelMaxWok; + OrderMakeList = JsonConvert.DeserializeObject>(JsonConvert.SerializeObject(ViewData.MakeOrder)); + OrderMakeListOver = JsonConvert.DeserializeObject>(JsonConvert.SerializeObject(ViewData.MakeOrderOver)); + } })); - Thread.Sleep(5000); + Thread.Sleep(1000); }), $"{DateTime.Now},线程服务"); } - - /// - /// 数据运行器 - /// - public void DataRun() - { - string Dev = "MorkS";//当前设备名称 - string name = Main.GetInstance.PZdic.ContainsKey($"{Dev}_Name") ? Main.GetInstance.PZdic[$"{Dev}_Name"].ToString(): DateTime.Now.ToString(); - //ThreadManage.GetInstance().StartLong(new Action(() => - //{ - // System.Windows.Application.Current?.Dispatcher.Invoke((Action)(() => - // { - // if (!string.IsNullOrEmpty(name) && Main.GetInstance.redisDatasDic != null && Main.GetInstance.redisDatasDic.ContainsKey(name) && Main.GetInstance.redisDatasDic[name]!=null) - // { - // List list=new List { "IsRun", "RunStatus", "OrderCount", "ErrorOrderCount", "OrderMakeList", "OrderMakeListOver", "AlarmList" }; - // list?.ForEach(x => { - // if (Main.GetInstance.PZdic.ContainsKey($"{Dev}_{x}")) - // { - // if (Main.GetInstance.redisDatasDic[name].ContainsKey(Main.GetInstance.PZdic[$"{Dev}_{x}"])) - // { - // string _value = Main.GetInstance.redisDatasDic[name][Main.GetInstance.PZdic[$"{Dev}_{x}"]].VarVaule; - // #region 执行更新界面数据 - // switch (x) - // { - // case "IsRun"://是否运行 - // DevIsRun = _value == "0" ? DevIsRun.停止 : DevIsRun.运行; - // break; - // case "RunStatus"://运行状态 - // DevIsRun = _value == "0" ? DevIsRun.停止 : DevIsRun.运行; - // break; - // case "OrderCount"://是否运行 - // try - // { - // DdCount = int.Parse(_value); - // } - // catch (Exception ex) - // { - // DdCount = 0; - // } - // break; - // case "ErrorOrderCount": - // try - // { - // YCDdCount = int.Parse(_value); - // } - // catch (Exception ex) - // { - // YCDdCount = 0; - // } - // break; - // case "OrderMakeList": - // try - // { - // OrderMakeList = new ObservableCollection(); - // JsonConvert.DeserializeObject>(_value)?.OrderBy(l => l.SortNum)?.ToList().ForEach(par => { - // OrderMakeList.Add(par); - // }); - // } - // catch (Exception ex) - // { - // OrderMakeList = new ObservableCollection(); - // } - // break; - // case "OrderMakeListOver": - // try - // { - // OrderMakeListOver = new ObservableCollection(); - // JsonConvert.DeserializeObject>(_value)?.OrderBy(l => l.SortNum)?.ToList().ForEach(par => { - // OrderMakeListOver.Add(par); - // }); - // //OrderMakeListOver?.ToList().FindAll(m => m.GoodName).di - // } - // catch (Exception ex) - // { - // OrderMakeListOver = new ObservableCollection(); - // } - // break; - // case "AlarmList": - // try - // { - // AlarmList = new ObservableCollection(); - // JsonConvert.DeserializeObject>(_value)?.OrderBy(l => l.AlarmTime)?.ToList().ForEach(par => { - // AlarmList.Add(par); - // }); - - - - // //Histogram=new - // //if (AlarmList.Count > 0) - // //{ - - // //} - // } - // catch (Exception ex) - // { - // OrderMakeListOver = new ObservableCollection(); - // } - // break; - // default: - // break; - // } - // #endregion - - // } - // } - - // }); - // } - - // //Histogram = new[] { - // // new KeyValuePair(name_s[0], new Random().Next(0,400)), - // // new KeyValuePair(name_s[1], new Random().Next(0,400)), - // // new KeyValuePair(name_s[2], new Random().Next(0,400)), - // // new KeyValuePair(name_s[3], new Random().Next(0,400)), - // // new KeyValuePair(name_s[4], new Random().Next(0,400))}; - // })); - // Thread.Sleep(500); - //}), $"{name},线程服务"); - } } } diff --git a/BPASmartClient.ScreenMinWok/App.config b/BPASmartClient.ScreenMinWok/App.config index 04466302..7eeaad9e 100644 --- a/BPASmartClient.ScreenMinWok/App.config +++ b/BPASmartClient.ScreenMinWok/App.config @@ -1,9 +1,10 @@  - - - + + + + \ No newline at end of file diff --git a/BPASmartClient.ScreenMorks/App.config b/BPASmartClient.ScreenMorks/App.config index 04466302..7eeaad9e 100644 --- a/BPASmartClient.ScreenMorks/App.config +++ b/BPASmartClient.ScreenMorks/App.config @@ -1,9 +1,10 @@  - - - + + + + \ No newline at end of file diff --git a/BPASmartClient.ScreenSplitMeals/App.config b/BPASmartClient.ScreenSplitMeals/App.config index 04466302..7eeaad9e 100644 --- a/BPASmartClient.ScreenSplitMeals/App.config +++ b/BPASmartClient.ScreenSplitMeals/App.config @@ -1,9 +1,10 @@  - - - + + + + \ No newline at end of file diff --git a/SmartClient.sln b/SmartClient.sln index aa81c08a..28119da9 100644 --- a/SmartClient.sln +++ b/SmartClient.sln @@ -192,6 +192,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.ScreenSplitM EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.ScreenLib", "BPASmartClient.ScreenLib\BPASmartClient.ScreenLib.csproj", "{798BBFFE-3BA2-40BA-BFE1-9502398F1F08}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpfTest", "WpfTest\WpfTest.csproj", "{CD43FABA-D1ED-4524-AC51-60ECDE2EAD44}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -1786,6 +1788,26 @@ Global {798BBFFE-3BA2-40BA-BFE1-9502398F1F08}.Release|x64.Build.0 = Release|Any CPU {798BBFFE-3BA2-40BA-BFE1-9502398F1F08}.Release|x86.ActiveCfg = Release|Any CPU {798BBFFE-3BA2-40BA-BFE1-9502398F1F08}.Release|x86.Build.0 = Release|Any CPU + {CD43FABA-D1ED-4524-AC51-60ECDE2EAD44}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CD43FABA-D1ED-4524-AC51-60ECDE2EAD44}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CD43FABA-D1ED-4524-AC51-60ECDE2EAD44}.Debug|ARM.ActiveCfg = Debug|Any CPU + {CD43FABA-D1ED-4524-AC51-60ECDE2EAD44}.Debug|ARM.Build.0 = Debug|Any CPU + {CD43FABA-D1ED-4524-AC51-60ECDE2EAD44}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {CD43FABA-D1ED-4524-AC51-60ECDE2EAD44}.Debug|ARM64.Build.0 = Debug|Any CPU + {CD43FABA-D1ED-4524-AC51-60ECDE2EAD44}.Debug|x64.ActiveCfg = Debug|Any CPU + {CD43FABA-D1ED-4524-AC51-60ECDE2EAD44}.Debug|x64.Build.0 = Debug|Any CPU + {CD43FABA-D1ED-4524-AC51-60ECDE2EAD44}.Debug|x86.ActiveCfg = Debug|Any CPU + {CD43FABA-D1ED-4524-AC51-60ECDE2EAD44}.Debug|x86.Build.0 = Debug|Any CPU + {CD43FABA-D1ED-4524-AC51-60ECDE2EAD44}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CD43FABA-D1ED-4524-AC51-60ECDE2EAD44}.Release|Any CPU.Build.0 = Release|Any CPU + {CD43FABA-D1ED-4524-AC51-60ECDE2EAD44}.Release|ARM.ActiveCfg = Release|Any CPU + {CD43FABA-D1ED-4524-AC51-60ECDE2EAD44}.Release|ARM.Build.0 = Release|Any CPU + {CD43FABA-D1ED-4524-AC51-60ECDE2EAD44}.Release|ARM64.ActiveCfg = Release|Any CPU + {CD43FABA-D1ED-4524-AC51-60ECDE2EAD44}.Release|ARM64.Build.0 = Release|Any CPU + {CD43FABA-D1ED-4524-AC51-60ECDE2EAD44}.Release|x64.ActiveCfg = Release|Any CPU + {CD43FABA-D1ED-4524-AC51-60ECDE2EAD44}.Release|x64.Build.0 = Release|Any CPU + {CD43FABA-D1ED-4524-AC51-60ECDE2EAD44}.Release|x86.ActiveCfg = Release|Any CPU + {CD43FABA-D1ED-4524-AC51-60ECDE2EAD44}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -1874,6 +1896,7 @@ Global {286A2E28-B04E-4EA6-9017-D6FA6F8B9A48} = {C5968A90-F4CF-4904-88C4-62C77C820A04} {135A0978-351F-4727-82CE-2B7A8632AF1B} = {C5968A90-F4CF-4904-88C4-62C77C820A04} {798BBFFE-3BA2-40BA-BFE1-9502398F1F08} = {C6984F48-A0FE-47A4-B63B-E4E5BCFCD6D3} + {CD43FABA-D1ED-4524-AC51-60ECDE2EAD44} = {7BE13E55-D8B1-4232-AE63-8BF122633297} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {9AEC9B81-0222-4DE9-B642-D915C29222AC} diff --git a/WpfTest/App.xaml b/WpfTest/App.xaml new file mode 100644 index 00000000..7e56dad0 --- /dev/null +++ b/WpfTest/App.xaml @@ -0,0 +1,9 @@ + + + + + diff --git a/WpfTest/App.xaml.cs b/WpfTest/App.xaml.cs new file mode 100644 index 00000000..48c85c26 --- /dev/null +++ b/WpfTest/App.xaml.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Data; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; + +namespace WpfTest +{ + /// + /// Interaction logic for App.xaml + /// + public partial class App : Application + { + } +} diff --git a/WpfTest/AssemblyInfo.cs b/WpfTest/AssemblyInfo.cs new file mode 100644 index 00000000..8b5504ec --- /dev/null +++ b/WpfTest/AssemblyInfo.cs @@ -0,0 +1,10 @@ +using System.Windows; + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] diff --git a/WpfTest/MainWindow.xaml b/WpfTest/MainWindow.xaml new file mode 100644 index 00000000..230909d2 --- /dev/null +++ b/WpfTest/MainWindow.xaml @@ -0,0 +1,12 @@ + + + + + diff --git a/WpfTest/MainWindow.xaml.cs b/WpfTest/MainWindow.xaml.cs new file mode 100644 index 00000000..43f2c72a --- /dev/null +++ b/WpfTest/MainWindow.xaml.cs @@ -0,0 +1,338 @@ +using BPA.Communication; +using BPA.Helper; +using BPA.Message; +using BPA.Message.Enum; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace WpfTest +{ + /// + /// Interaction logic for MainWindow.xaml + /// + public partial class MainWindow : Window + { + /// + /// MQTT连接信息 + /// + public string MQTTConnection { get; set; } = "10.2.1.254,1883,admin,public"; + + /// + /// Mqtt是否运行 + /// + public bool IsRunningMqtt = false; + /// + /// Mqtt + /// + public MqttHelper mqttHelper = new MqttHelper(); + + public MainWindow() + { + InitializeComponent(); + Connection(); + ThreadServer(); + } + public void ThreadServer() + { + ThreadManage.GetInstance().StartLong(new Action(() => + { + try + { + if (IsRunningMqtt) + { + Send(ScreenDeviceType.大炒); + Thread.Sleep(1000); + Send(ScreenDeviceType.小炒); Thread.Sleep(1000); + + Send(ScreenDeviceType.煮面机); Thread.Sleep(1000); + + Send(ScreenDeviceType.分餐机); Thread.Sleep(1000); + + } + } + catch (Exception ex) + { + MessageLog.GetInstance.ShowEx($"{Name}:线程服务异常,原因:{ex.Message}"); + } + Thread.Sleep(100); + }), $"{Name},线程服务"); + } + /// + /// 初始化连接Redis MQTT + /// + public void Connection() + { + try + { + //2.Mqtt连接 + if (!string.IsNullOrEmpty(this.MQTTConnection) && this.MQTTConnection.Contains(',')) + { + string[] mqttcom = this.MQTTConnection.Split(','); + if (mqttcom != null && mqttcom.Count() == 4) + { + mqttHelper.Connect(mqttcom[2], mqttcom[3], mqttcom[0], int.Parse(mqttcom[1]), $"{Name}:{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}"); + } + } + mqttHelper.Disconnect = new Action(() => + { + IsRunningMqtt = false; + MessageLog.GetInstance.ShowEx($"{Name}:MQTT异常断开...."); + }); + mqttHelper.ConnectOk = new Action(() => + { + IsRunningMqtt = true;//连接成功 + }); + } + catch (Exception ex) + { + MessageLog.GetInstance.ShowEx($"{Name}:初始化连接 MQTT,原因:{ex.Message}"); + } + + } + + public void Send(ScreenDeviceType screen) + { + List oRDER_STATUS = new List() { ORDER_STATUS.WAIT, ORDER_STATUS.COOKING, ORDER_STATUS.COMPLETED_COOK, ORDER_STATUS.COMPLETED_TAKE, ORDER_STATUS.ERR_NOT_REPLY_WHEN_COOKING }; + List name_s = new List() { "担担面", "鸡蛋面", "火鸡面", "扬州炒饭", "回锅肉盖饭" }; + List name_XM = new List() { "张三", "李四", "王五", "王麻子", "二狗子" }; + + int k = new Random().Next(0, 5); + int M = new Random().Next(0, 5); + if (screen == ScreenDeviceType.大炒) + { + SendScreenDataModel sendScreenData = new SendScreenDataModel(); + sendScreenData.Name = screen; + sendScreenData.Value = new ScreenModelMaxWok + { + IsRun = new Random().Next(0, 2) == 0 ? IsRun.运行 : IsRun.停止, + WorkStatus_1 = new Random().Next(0, 2) == 0 ? WorkStatus.工作 : WorkStatus.待机, + WorkStatus_2 = new Random().Next(0, 2) == 0 ? WorkStatus.工作 : WorkStatus.待机, + RobotStatu = new Random().Next(0, 2) == 0 ? WorkStatus.工作 : WorkStatus.待机, + Alarm = new List { + new AlarmModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" }, + new AlarmModel { AlarmTime = DateTime.Now.AddSeconds(1).ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" }, + new AlarmModel { AlarmTime = DateTime.Now.AddSeconds(2).ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" }, + }, + FailuresCount = 0, + StatsCount = new List { + new StatsModel{Name= name_s[0],Count=new Random().Next(0, 100)}, + new StatsModel{Name= name_s[1],Count=new Random().Next(0, 100)}, + new StatsModel{Name= name_s[2],Count=new Random().Next(0, 100)}, + new StatsModel{Name= name_s[3],Count=new Random().Next(0, 100)}, + new StatsModel{Name= name_s[4],Count=new Random().Next(0, 100)}, + }, + MaxWok_Dishes_1 = "猪肉炖粉条", + MaxWok_Task_1 = "炒菜中", + MaxWok_Process_1 = new List { + new ProcessModel{ Id=0,Name= "清洗", IsRun=M>=0 ?true:false}, + new ProcessModel{ Id=1,Name= "到菜", IsRun=M>=1 ?true:false}, + new ProcessModel{ Id=2,Name= "翻炒", IsRun=M>=2?true:false}, + new ProcessModel{ Id=3,Name= "调料", IsRun=M>=3 ?true:false}, + new ProcessModel{ Id=4,Name= "完成", IsRun=M>=4 ?true:false}, + }, + MaxWok_HeatGear_1 = "1", + MaxWok_StirGear_1 = "2", + MaxWok_FlipSpeed_1 = "30", + MaxWok_Temp_1 = "102", + MaxWok_OrderCount_1 = new Random().Next(0, 100), + MaxWok_ErrorOrderCount_1 = new Random().Next(0, 100), + + MaxWok_Dishes_2 = "烂肉排骨", + MaxWok_Task_2 = "结算中", + MaxWok_Process_2 = new List { + new ProcessModel{ Id=0,Name= "清洗", IsRun=k>=0 ?true:false}, + new ProcessModel{ Id=1,Name= "到菜", IsRun=k>=1 ?true:false}, + new ProcessModel{ Id=2,Name= "翻炒", IsRun=k>=2 ?true:false}, + new ProcessModel{ Id=3,Name= "调料", IsRun=k>=3 ?true:false}, + new ProcessModel{ Id=4,Name= "完成", IsRun=k>=4 ?true:false}, + }, + MaxWok_HeatGear_2 = "2", + MaxWok_StirGear_2 = "3", + MaxWok_FlipSpeed_2 = "32", + MaxWok_Temp_2 = "132", + MaxWok_OrderCount_2 = new Random().Next(0, 100), + MaxWok_ErrorOrderCount_2 = new Random().Next(0, 100), + }; + mqttHelper.Publish(ScreenTOPIC.GetInstance.GetTopic(screen), JsonConvert.SerializeObject(sendScreenData)); + } + else if (screen == ScreenDeviceType.小炒) + { + SendScreenDataModel sendScreenData = new SendScreenDataModel(); + sendScreenData.Name = screen; + sendScreenData.Value = new ScreenModelMinWok + { + IsRun = new Random().Next(0, 2) == 0 ? IsRun.运行 : IsRun.停止, + WorkStatus_1 = new Random().Next(0, 2) == 0 ? WorkStatus.工作 : WorkStatus.待机, + WorkStatus_2 = new Random().Next(0, 2) == 0 ? WorkStatus.工作 : WorkStatus.待机, + RobotStatu = new Random().Next(0, 2) == 0 ? WorkStatus.工作 : WorkStatus.待机, + Alarm = new List { + new AlarmModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" }, + new AlarmModel { AlarmTime = DateTime.Now.AddSeconds(1).ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" }, + new AlarmModel { AlarmTime = DateTime.Now.AddSeconds(2).ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" }, + }, + FailuresCount = 0, + StatsCount = new List { + new StatsModel{Name= name_s[0],Count=new Random().Next(0, 100)}, + new StatsModel{Name= name_s[1],Count=new Random().Next(0, 100)}, + new StatsModel{Name= name_s[2],Count=new Random().Next(0, 100)}, + new StatsModel{Name= name_s[3],Count=new Random().Next(0, 100)}, + new StatsModel{Name= name_s[4],Count=new Random().Next(0, 100)}, + }, + MinWok_Dishes_1 = "猪肉炖粉条", + MinWok_Task_1 = "炒菜中", + MinWok_Process_1 = new List { + new ProcessModel{ Id=0,Name= "清洗", IsRun=M>=0 ?true:false}, + new ProcessModel{ Id=1,Name= "到菜", IsRun=M>=1 ?true:false}, + new ProcessModel{ Id=2,Name= "翻炒", IsRun=M>=2?true:false}, + new ProcessModel{ Id=3,Name= "调料", IsRun=M>=3 ?true:false}, + new ProcessModel{ Id=4,Name= "完成", IsRun=M>=4 ?true:false}, + }, + MinWok_HeatGear_1 = "1", + MinWok_StirGear_1 = "2", + MinWok_FlipSpeed_1 = "30", + MinWok_Temp_1 = "102", + MinWok_OrderCount_1 = new Random().Next(0, 100), + MinWok_ErrorOrderCount_1 = new Random().Next(0, 100), + + MinWok_Dishes_2 = "烂肉排骨", + MinWok_Task_2 = "结算中", + MinWok_Process_2 = new List { + new ProcessModel{ Id=0,Name= "清洗", IsRun=k>=0 ?true:false}, + new ProcessModel{ Id=1,Name= "到菜", IsRun=k>=1 ?true:false}, + new ProcessModel{ Id=2,Name= "翻炒", IsRun=k>=2 ?true:false}, + new ProcessModel{ Id=3,Name= "调料", IsRun=k>=3 ?true:false}, + new ProcessModel{ Id=4,Name= "完成", IsRun=k>=4 ?true:false}, + }, + MinWok_HeatGear_2 = "2", + MinWok_StirGear_2 = "3", + MinWok_FlipSpeed_2 = "32", + MinWok_Temp_2 = "132", + MinWok_OrderCount_2 = new Random().Next(0, 100), + MinWok_ErrorOrderCount_2 = new Random().Next(0, 100), + }; + mqttHelper.Publish(ScreenTOPIC.GetInstance.GetTopic(screen), JsonConvert.SerializeObject(sendScreenData)); + } + else if (screen == ScreenDeviceType.煮面机) + { + SendScreenDataModel sendScreenData = new SendScreenDataModel(); + sendScreenData.Name = screen; + sendScreenData.Value = new ScreenModelMorkS + { + IsRun = new Random().Next(0, 2) == 0 ? IsRun.运行 : IsRun.停止, + WorkStatus = new Random().Next(0, 2) == 0 ? WorkStatus.工作 : WorkStatus.待机, + RobotStatu = new Random().Next(0, 2) == 0 ? WorkStatus.工作 : WorkStatus.待机, + Alarm = new List { + new AlarmModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" }, + new AlarmModel { AlarmTime = DateTime.Now.AddSeconds(1).ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" }, + new AlarmModel { AlarmTime = DateTime.Now.AddSeconds(2).ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" }, + }, + FailuresCount = 0, + StatsCount = new List { + new StatsModel{Name= name_s[0],Count=new Random().Next(0, 100)}, + new StatsModel{Name= name_s[1],Count=new Random().Next(0, 100)}, + new StatsModel{Name= name_s[2],Count=new Random().Next(0, 100)}, + new StatsModel{Name= name_s[3],Count=new Random().Next(0, 100)}, + new StatsModel{Name= name_s[4],Count=new Random().Next(0, 100)}, + }, + MorkS_OrderCount= new Random().Next(0, 100), + MorkS_ErrorOrderCount = new Random().Next(0, 100), + MorkS_NoodleUpOrDown_1 = new Random().Next(0, 2) == 0 ? "true" : "false", + MorkS_NoodleUpOrDown_2 = new Random().Next(0, 2) == 0 ? "true" : "false", + MorkS_NoodleUpOrDown_3 = new Random().Next(0, 2) == 0 ? "true" : "false", + MorkS_NoodleUpOrDown_4 = new Random().Next(0, 2) == 0 ? "true" : "false", + MorkS_NoodleUpOrDown_5 = new Random().Next(0, 2) == 0 ? "true" : "false", + MorkS_NoodleUpOrDown_6 = new Random().Next(0, 2) == 0 ? "true" : "false", + + MorkS_Temp = new Random().Next(0, 2) == 0 ? "true" : "false", + MorkS_BinLocation = new Random().Next(0, 6).ToString(), + MorkS_SiloMeas = new Random().Next(0, 2) == 0 ? "true" : "false", + MorkS_NoBowMeas = new Random().Next(0, 2) == 0 ? "true" : "false", + MakeOrder=new List { + new OrderMakeModel { GoodName= name_s[new Random().Next(0, 5)], StartTime=DateTime.Now.ToString("HH:mm:ss"), Status=oRDER_STATUS[new Random().Next(0, 5)], SortNum=new Random().Next(0,100).ToString()}, + new OrderMakeModel { GoodName= name_s[new Random().Next(0, 5)], StartTime=DateTime.Now.ToString("HH:mm:ss"), Status=oRDER_STATUS[new Random().Next(0, 5)], SortNum=new Random().Next(0,100).ToString()}, + new OrderMakeModel { GoodName= name_s[new Random().Next(0, 5)], StartTime=DateTime.Now.ToString("HH:mm:ss"), Status=oRDER_STATUS[new Random().Next(0, 5)], SortNum=new Random().Next(0,100).ToString()}, + new OrderMakeModel { GoodName= name_s[new Random().Next(0, 5)], StartTime=DateTime.Now.ToString("HH:mm:ss"), Status=oRDER_STATUS[new Random().Next(0, 5)], SortNum=new Random().Next(0,100).ToString()}, + new OrderMakeModel { GoodName= name_s[new Random().Next(0, 5)], StartTime=DateTime.Now.ToString("HH:mm:ss"), Status=oRDER_STATUS[new Random().Next(0, 5)], SortNum=new Random().Next(0,100).ToString()}, + new OrderMakeModel { GoodName= name_s[new Random().Next(0, 5)], StartTime=DateTime.Now.ToString("HH:mm:ss"), Status=oRDER_STATUS[new Random().Next(0, 5)], SortNum=new Random().Next(0,100).ToString()}, + new OrderMakeModel { GoodName= name_s[new Random().Next(0, 5)], StartTime=DateTime.Now.ToString("HH:mm:ss"), Status=oRDER_STATUS[new Random().Next(0, 5)], SortNum=new Random().Next(0,100).ToString()}, + new OrderMakeModel { GoodName= name_s[new Random().Next(0, 5)], StartTime=DateTime.Now.ToString("HH:mm:ss"), Status=oRDER_STATUS[new Random().Next(0, 5)], SortNum=new Random().Next(0,100).ToString()}, + new OrderMakeModel { GoodName= name_s[new Random().Next(0, 5)], StartTime=DateTime.Now.ToString("HH:mm:ss"), Status=oRDER_STATUS[new Random().Next(0, 5)], SortNum=new Random().Next(0,100).ToString()}, + new OrderMakeModel { GoodName= name_s[new Random().Next(0, 5)], StartTime=DateTime.Now.ToString("HH:mm:ss"), Status=oRDER_STATUS[new Random().Next(0, 5)], SortNum=new Random().Next(0,100).ToString()}, + new OrderMakeModel { GoodName= name_s[new Random().Next(0, 5)], StartTime=DateTime.Now.ToString("HH:mm:ss"), Status=oRDER_STATUS[new Random().Next(0, 5)], SortNum=new Random().Next(0,100).ToString()}, + }, + + }; + mqttHelper.Publish(ScreenTOPIC.GetInstance.GetTopic(screen), JsonConvert.SerializeObject(sendScreenData)); + } + else if (screen == ScreenDeviceType.分餐机) + { + SendScreenDataModel sendScreenData = new SendScreenDataModel(); + sendScreenData.Name = screen; + sendScreenData.Value = new ScreenModelSplitMeals + { + IsRun = new Random().Next(0, 2) == 0 ? IsRun.运行 : IsRun.停止, + WorkStatus = new Random().Next(0, 2) == 0 ? WorkStatus.工作 : WorkStatus.待机, + RobotStatu = new Random().Next(0, 2) == 0 ? WorkStatus.工作 : WorkStatus.待机, + Alarm = new List { + new AlarmModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" }, + new AlarmModel { AlarmTime = DateTime.Now.AddSeconds(1).ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" }, + new AlarmModel { AlarmTime = DateTime.Now.AddSeconds(2).ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" }, + }, + FailuresCount = 0, + StatsCount = new List { + new StatsModel { Name = name_s[0], Count = new Random().Next(0, 100) }, + new StatsModel { Name = name_s[1], Count = new Random().Next(0, 100) }, + new StatsModel { Name = name_s[2], Count = new Random().Next(0, 100) }, + new StatsModel { Name = name_s[3], Count = new Random().Next(0, 100) }, + new StatsModel { Name = name_s[4], Count = new Random().Next(0, 100) }, + }, + SplitMeals_CreditCardCount_1 = new Random().Next(0, 100), + SplitMeals_CreditCardNameBefore_1 = name_XM[new Random().Next(0, 5)], + SplitMeals_CreditCardName_1 = name_XM[new Random().Next(0, 5)], + SplitMeals_CookType_1 = new List() { "担担面", "鸡蛋面", "火鸡面" }, + + SplitMeals_CreditCardCount_2 = new Random().Next(0, 100), + SplitMeals_CreditCardNameBefore_2 = name_XM[new Random().Next(0, 5)], + SplitMeals_CreditCardName_2 = name_XM[new Random().Next(0, 5)], + SplitMeals_CookType_2 = new List() { "担担面", "鸡蛋面", "火鸡面" }, + + SplitMeals_CreditCardCount_3 = new Random().Next(0, 100), + SplitMeals_CreditCardNameBefore_3 = name_XM[new Random().Next(0, 5)], + SplitMeals_CreditCardName_3= name_XM[new Random().Next(0, 5)], + SplitMeals_CookType_3 = new List() { "担担面", "鸡蛋面", "火鸡面" }, + + SplitMeals_CreditCardCount_4 = new Random().Next(0, 100), + SplitMeals_CreditCardNameBefore_4 = name_XM[new Random().Next(0, 5)], + SplitMeals_CreditCardName_4 = name_XM[new Random().Next(0, 5)], + SplitMeals_CookType_4 = new List() { "担担面", "鸡蛋面", "火鸡面" }, + + SplitMeals_CreditCardCount_5 = new Random().Next(0, 100), + SplitMeals_CreditCardNameBefore_5 = name_XM[new Random().Next(0, 5)], + SplitMeals_CreditCardName_5 = name_XM[new Random().Next(0, 5)], + SplitMeals_CookType_5 = new List() { "担担面", "鸡蛋面", "火鸡面" }, + + SplitMeals_CreditCardCount_6 = new Random().Next(0, 100), + SplitMeals_CreditCardNameBefore_6 = name_XM[new Random().Next(0, 5)], + SplitMeals_CreditCardName_6 = name_XM[new Random().Next(0, 5)], + SplitMeals_CookType_6 = new List() { "担担面", "鸡蛋面", "火鸡面" }, + + }; + mqttHelper.Publish(ScreenTOPIC.GetInstance.GetTopic(screen), JsonConvert.SerializeObject(sendScreenData)); + } + } + } +} diff --git a/WpfTest/WpfTest.csproj b/WpfTest/WpfTest.csproj new file mode 100644 index 00000000..31e879ea --- /dev/null +++ b/WpfTest/WpfTest.csproj @@ -0,0 +1,14 @@ + + + + WinExe + net6.0-windows + enable + true + + + + + + +