diff --git a/BPASmartClient.MorkBF/Control_MorkBF.cs b/BPASmartClient.MorkBF/Control_MorkBF.cs index 0cee5160..e583c490 100644 --- a/BPASmartClient.MorkBF/Control_MorkBF.cs +++ b/BPASmartClient.MorkBF/Control_MorkBF.cs @@ -23,6 +23,7 @@ namespace BPASmartClient.MorkBF public class Control_MorkBF : BaseDevice { GVL_MorkBF morkBF = new GVL_MorkBF(); + DataReport dataReport = new DataReport(); public override DeviceClientType DeviceType => DeviceClientType.MORKCS; @@ -549,6 +550,23 @@ namespace BPASmartClient.MorkBF } }), 1); + GetStatus("VW2250", new Action((o) => + { + if (o == null) return; + if (o is int[] values && values.Length == 1) + { + dataReport.FirePot1_PotState = values[0]; + } + }), 1); + GetStatus("VW2350", new Action((o) => + { + if (o == null) return; + if (o is int[] values && values.Length == 1) + { + dataReport.FirePot2_PotState = values[0]; + } + }), 1); + } public override void ResetProgram() @@ -1104,9 +1122,10 @@ namespace BPASmartClient.MorkBF StatsCount = statsModels, MaxWok_Dishes_1 = "满汉全席", MaxWok_Dishes_2 = "海鲜大餐", - MaxWok_Task_1 = "无", - MaxWok_Task_2 = "无", - MaxWok_Process_1 = new List(), + MaxWok_Task_1 = ((PotState)dataReport.FirePot1_PotState).ToString(), + MaxWok_Task_2 = ((PotState)dataReport.FirePot2_PotState).ToString(), + MaxWok_Process_1 = SetFirePotPorcess(new Random().Next(0,11)), + MaxWok_Process_2 = SetFirePotPorcess(new Random().Next(0, 11)), MaxWok_HeatGear_1 = morkBF.FirePot1_FireGear.ToString(), MaxWok_HeatGear_2 = morkBF.FirePot2_FireGear.ToString(), MaxWok_StirGear_1 = morkBF.FirePot1_StirGear.ToString(), @@ -1127,5 +1146,43 @@ namespace BPASmartClient.MorkBF }), "大屏数据上报"); } + + private List SetFirePotPorcess(int potState) + { + + if (potState > 0) + { + if(potState <=3) + { + SetState(2); + } + else if(potState>3&&potState < 9) SetState(3); + else if(potState == 9) SetState(4); + else if (potState == 10) SetState(5); + } + else + { + foreach(var item in dataReport.processModels) + { + item.Status = ProcessStatus.未执行; + } + } + return dataReport.processModels; + + + } + + public void SetState(int c ) + { + for (int i = 0; i < dataReport.processModels.Count; i++) + { + if (i == c) + { + dataReport.processModels[i].Status = ProcessStatus.正在执行; + } + else if( i c ) dataReport.processModels[i].Status = ProcessStatus.未执行; + } + } } } diff --git a/BPASmartClient.MorkBF/Model/DataReport.cs b/BPASmartClient.MorkBF/Model/DataReport.cs new file mode 100644 index 00000000..83196c6a --- /dev/null +++ b/BPASmartClient.MorkBF/Model/DataReport.cs @@ -0,0 +1,49 @@ +using BPA.Message; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPASmartClient.MorkBF.Model +{ + public class DataReport + { + /// + /// 炒锅1工艺状态 + /// + public int FirePot1_PotState { get; set; } = 0; + /// + /// 炒锅2工艺状态 + /// + public int FirePot2_PotState { get; set; } = 0; + + public List processModels = new List(); + + public DataReport() + { + processModels.Add( new ProcessModel() { Id = 0, Name = "开始", Status = ProcessStatus.未执行 }); + processModels.Add(new ProcessModel() { Id = 1, Name = "热油", Status = ProcessStatus.未执行 }); + processModels.Add(new ProcessModel() { Id = 2, Name = "炒制", Status = ProcessStatus.未执行 }); + processModels.Add(new ProcessModel() { Id = 3, Name = "完成", Status = ProcessStatus.未执行 }); + processModels.Add(new ProcessModel() { Id = 4, Name = "出餐", Status = ProcessStatus.未执行 }); + + } + + } + + public enum PotState + { + 无任务=0, + 炒锅预热中 =1, + 开始抽油=2, + 油预热中=3, + 荤菜炒制中 =4, + 调料炒制中=5, + 素菜炒制中=6, + 辅料炒制中=7, + 关火焖制中=8, + 炒制完成=9, + 出餐完成=10, + } +} diff --git a/BPASmartClient.MorkF/Control_MorkF.cs b/BPASmartClient.MorkF/Control_MorkF.cs index 65be85b7..8b657e91 100644 --- a/BPASmartClient.MorkF/Control_MorkF.cs +++ b/BPASmartClient.MorkF/Control_MorkF.cs @@ -154,6 +154,8 @@ namespace BPASmartClient.MorkF //FoodLibInit(); Task2ReadMaterialData(); + ScreenDataServer(); + //读取坐标系 MaterialCoordinate materialCoordinate = ReadMaterialCoordinate(); if(materialCoordinate != null) @@ -2350,11 +2352,35 @@ namespace BPASmartClient.MorkF private void ScreenDataServer() { - LocalMqtt.GetInstance.Init(ScreenDeviceType.大炒); + LocalMqtt.GetInstance.Init(ScreenDeviceType.小炒); ThreadManage.GetInstance().StartLong(new Action(() => { List statsModels = new List(); statsModels.Add(new StatsModel() { Name = "帝王蟹", Count = 666 }); + int i = new Random().Next(0, 100); + List processModels= new List(); + switch ((i / 5) % 6) + { + case 0: + processModels = new List() { new ProcessModel() { Id = 1, Name = "启动", Status = ProcessStatus.正在执行 }, new ProcessModel() { Id = 1, Name = "热油", Status = ProcessStatus.未执行 }, new ProcessModel() { Id = 1, Name = "炒制", Status = ProcessStatus.未执行 }, new ProcessModel() { Id = 1, Name = "出餐", Status = ProcessStatus.未执行 }, new ProcessModel() { Id = 1, Name = "结束", Status = ProcessStatus.未执行 } }; + break; + case 1: + processModels = new List() { new ProcessModel() { Id = 1, Name = "启动", Status = ProcessStatus.执行完成 }, new ProcessModel() { Id = 1, Name = "热油", Status = ProcessStatus.正在执行 }, new ProcessModel() { Id = 1, Name = "炒制", Status = ProcessStatus.未执行 }, new ProcessModel() { Id = 1, Name = "出餐", Status = ProcessStatus.未执行 }, new ProcessModel() { Id = 1, Name = "结束", Status = ProcessStatus.未执行 } }; + break; + case 2: + processModels = new List() { new ProcessModel() { Id = 1, Name = "启动", Status = ProcessStatus.执行完成 }, new ProcessModel() { Id = 1, Name = "热油", Status = ProcessStatus.执行完成 }, new ProcessModel() { Id = 1, Name = "炒制", Status = ProcessStatus.正在执行 }, new ProcessModel() { Id = 1, Name = "出餐", Status = ProcessStatus.未执行 }, new ProcessModel() { Id = 1, Name = "结束", Status = ProcessStatus.未执行 } }; + break; + case 3: + processModels = new List() { new ProcessModel() { Id = 1, Name = "启动", Status = ProcessStatus.执行完成 }, new ProcessModel() { Id = 1, Name = "热油", Status = ProcessStatus.执行完成 }, new ProcessModel() { Id = 1, Name = "炒制", Status = ProcessStatus.执行完成 }, new ProcessModel() { Id = 1, Name = "出餐", Status = ProcessStatus.正在执行 }, new ProcessModel() { Id = 1, Name = "结束", Status = ProcessStatus.未执行 } }; + break; + case 4: + processModels = new List() { new ProcessModel() { Id = 1, Name = "启动", Status = ProcessStatus.执行完成 }, new ProcessModel() { Id = 1, Name = "热油", Status = ProcessStatus.执行完成 }, new ProcessModel() { Id = 1, Name = "炒制", Status = ProcessStatus.执行完成 }, new ProcessModel() { Id = 1, Name = "出餐", Status = ProcessStatus.执行完成 }, new ProcessModel() { Id = 1, Name = "结束", Status = ProcessStatus.正在执行 } }; + break; + case 5: + processModels = new List() { new ProcessModel() { Id = 1, Name = "启动", Status = ProcessStatus.执行完成 }, new ProcessModel() { Id = 1, Name = "热油", Status = ProcessStatus.执行完成 }, new ProcessModel() { Id = 1, Name = "炒制", Status = ProcessStatus.执行完成 }, new ProcessModel() { Id = 1, Name = "出餐", Status = ProcessStatus.执行完成 }, new ProcessModel() { Id = 1, Name = "结束", Status = ProcessStatus.执行完成 } }; + break; + default: break; + } ScreenModelMinWok maxWok = new ScreenModelMinWok { IsRun = new Random().Next(0, 2) == 0 ? IsRun.运行 : IsRun.停止, //设备是否运行 @@ -2368,7 +2394,8 @@ namespace BPASmartClient.MorkF MinWok_Dishes_2 = "海鲜大餐", MinWok_Task_1 = "炒制菜品",//当前任务 MinWok_Task_2 = "热油", //当前任务 - MinWok_Process_1 = new List(), //炒锅当前任务流程 + //MinWok_Process_1 = new List() { new ProcessModel() { Id = 1, Name = "启动", Status = ProcessStatus.正在执行 }, new ProcessModel() { Id = 1, Name = "热油", Status = ProcessStatus.未执行 }, new ProcessModel() { Id = 1, Name = "炒制", Status = ProcessStatus.未执行 }, new ProcessModel() { Id = 1, Name = "出餐", Status = ProcessStatus.未执行 }, new ProcessModel() { Id = 1, Name = "结束", Status = ProcessStatus.未执行 } }, + MinWok_Process_1 = processModels, //炒锅当前任务流程 MinWok_Process_2 = new List(), //炒锅当前任务流程 MinWok_HeatGear_1 = new Random().Next(0, 5).ToString(), //炒锅加热档位 MinWok_HeatGear_2 = new Random().Next(0, 5).ToString(), //炒锅加热档位