From bbe11b2132746ce241f228182c58b20b79a9d165 Mon Sep 17 00:00:00 2001 From: yahaha Date: Mon, 5 Dec 2022 18:06:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=A7=E5=B1=8F=E4=BC=98=E5=8C=96=E3=80=82?= =?UTF-8?q?=20=E8=8F=9C=E5=93=81=E5=BA=93=E8=AE=A1=E7=AE=97=E4=BF=AE?= =?UTF-8?q?=E5=A4=8Dbug=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BPASmartClient.Business/LocalMqtt.cs | 3 +- BPASmartClient.MorkF/Control_MorkF.cs | 91 ++++++++++++------- BPASmartClient.MorkF/GVL_MorkF.cs | 11 ++- BPASmartClient.MorkF/View/DebugView.xaml | 6 ++ .../View/MaterialCalibration.xaml | 24 +++-- .../ViewModel/MaterialCalibrationViewModel.cs | 11 ++- 6 files changed, 97 insertions(+), 49 deletions(-) diff --git a/BPASmartClient.Business/LocalMqtt.cs b/BPASmartClient.Business/LocalMqtt.cs index cc91bc72..364cae91 100644 --- a/BPASmartClient.Business/LocalMqtt.cs +++ b/BPASmartClient.Business/LocalMqtt.cs @@ -33,7 +33,8 @@ namespace BPASmartClient.Business mQTTProxy.Subscrib(ScreenTOPIC.GetInstance.GetTopic(DeviceType)) ; }); - mQTTProxy.Connect("emqx_u_block", "emqx_p_admin3658765490789", "47.108.65.220", 1883, $"{DeviceType}_设备监听数据{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");//"10.2.1.254""admin", "public" + //mQTTProxy.Connect("emqx_u_block", "emqx_p_admin3658765490789", "47.108.65.220", 1883, $"{DeviceType}_设备监听数据{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");//"10.2.1.254""admin", "public" + mQTTProxy.Connect("admin", "public1", "171.221.208.23", 11883, $"{DeviceType}_设备监听数据{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");//"10.2.1.254""admin", "public" } public void Start() diff --git a/BPASmartClient.MorkF/Control_MorkF.cs b/BPASmartClient.MorkF/Control_MorkF.cs index abff1ff1..1059a741 100644 --- a/BPASmartClient.MorkF/Control_MorkF.cs +++ b/BPASmartClient.MorkF/Control_MorkF.cs @@ -136,6 +136,15 @@ namespace BPASmartClient.MorkF List resultorder = new List();//调试变量 + /// + /// 告警列表 + /// + private List alarmModel = new List(); + + /// + /// + /// + private List statsModels = new List(); /// /// 入口 /// @@ -559,7 +568,8 @@ namespace BPASmartClient.MorkF { ThreadManage.GetInstance().Start(new Action(() => { - OutFood(fryIndex); + string error; + OutFood(fryIndex,out error); }), "OutFood"); }), "OutFood"); @@ -575,7 +585,8 @@ namespace BPASmartClient.MorkF { ThreadManage.GetInstance().Start(new Action(() => { - StirArmGoWork(fryIndex); + string error; + StirArmGoWork(fryIndex, out error); }), "StirArmGoWork"); }), "StirArmGoWork"); @@ -1625,7 +1636,7 @@ namespace BPASmartClient.MorkF FirePot_Write(item, false, num); } } - }), "炒锅1初始化"); + }), $"炒锅{num}初始化"); } @@ -1685,12 +1696,13 @@ namespace BPASmartClient.MorkF Thread.Sleep(200); } //倒菜 - public bool OutFood(int num,bool isMaterial = false) + public bool OutFood(int num,out string error,bool isMaterial = false) { bool ret = true; if (!morkFs.ContainsKey(num)) { + error = $"编号为{num}的炒锅无法找到"; return false; } int i = 0; @@ -1710,6 +1722,7 @@ namespace BPASmartClient.MorkF Thread.Sleep(materialSleepTime); if (i >= materialSleepCount - 1) { + error = $"炒锅{num}倒菜超时:未能等到取菜完成,请检查菜品库是否正常运行"; MessageLog.GetInstance.ShowEx($"炒锅{num}倒菜超时:未能等到取菜完成"); ret &= false; } @@ -1734,6 +1747,7 @@ namespace BPASmartClient.MorkF Thread.Sleep(materialSleepTime); if (i >= materialSleepCount - 1) { + error = $"炒锅{num}倒菜超时,请联系相关工作人员"; MessageLog.GetInstance.ShowEx($"炒锅{num}倒菜超时"); ret &= false; } @@ -1743,6 +1757,7 @@ namespace BPASmartClient.MorkF Thread.Sleep(200); MessageLog.GetInstance.Show("倒菜完成"); morkFs[num].GetMaterialComplete = false; + error = string.Empty; return ret; } //搅拌臂去原点位 @@ -1771,11 +1786,13 @@ namespace BPASmartClient.MorkF } //搅拌臂去炒制位 - public bool StirArmGoWork(int num) + public bool StirArmGoWork(int num,out string error) { + error = string.Empty; bool ret = true; if (!morkFs.ContainsKey(num)) { + error = $"编号为{num}的炒锅无法找到"; return false; } @@ -1789,6 +1806,7 @@ namespace BPASmartClient.MorkF Thread.Sleep(sleepTime); if (i >= sleepCount - 1) { + error = $"炒锅{num}搅拌臂去炒制位超时"; MessageLog.GetInstance.ShowEx($"炒锅{num}搅拌臂去炒制位超时"); ret &= false; } @@ -2138,8 +2156,8 @@ namespace BPASmartClient.MorkF //遍历炒锅,找到合适、空闲的炒锅 for(int i = 0;i p.Name == res.GoodName); + if (statsModel != null) + { + statsModel.Count++; + } + else + { + statsModels.Add(new StatsModel() { Name = res.GoodName, Count = 0 }); + } } catch (Exception ex) { @@ -2360,9 +2384,9 @@ namespace BPASmartClient.MorkF nowStirFryGood[i] = null; //炒完后出队列 morkFs[i].StirFryGoodsQuenes.TryDequeue(out var orderQueue); - morkFs[i].FryWorking = false; + morkFs[i].FryWorking = false; //初始化大屏 - morkFs[i].ScreenInit(); + morkFs[i].ScreenClear(); } }), String.Format(striConst, i.ToString(), nowStirFryGood[i].GoodName)/*$"炒锅{i}炒制{res.GoodName}线程"*/, true); } @@ -2412,7 +2436,6 @@ namespace BPASmartClient.MorkF 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(); @@ -2441,11 +2464,11 @@ namespace BPASmartClient.MorkF ScreenModelMinWok maxWok = new ScreenModelMinWok { IsRun = IsHealth ? IsRun.运行 : IsRun.停止,//new Random().Next(0, 2) == 0 ? IsRun.运行 : IsRun.停止, //设备是否运行 - WorkStatus_1 = morkFs[0].FryPot1_InitialComplete ? WorkStatus.工作 : WorkStatus.停止,// (WorkStatus)new Random().Next(0, 3), //设备运行状态 - WorkStatus_2 = morkFs[1].FryPot1_InitialComplete ? WorkStatus.工作 : WorkStatus.停止,//(WorkStatus)new Random().Next(0, 3), //设备运行状态 + WorkStatus_1 = morkFs[0].FryPot1_InitialComplete ? ((morkFs[0].Task != null)? WorkStatus.工作:WorkStatus.待机) : WorkStatus.停止,// (WorkStatus)new Random().Next(0, 3), //设备运行状态 + WorkStatus_2 = morkFs[1].FryPot1_InitialComplete ? ((morkFs[1].Task != null) ? WorkStatus.工作 : WorkStatus.待机) : WorkStatus.停止,//(WorkStatus)new Random().Next(0, 3), //设备运行状态 RobotStatu = (WorkStatus)new Random().Next(0, 3), //机器人状态 待机 1 正常 - Alarm = new List(), //告警集合 - FailuresCount = 0, //故障数 + Alarm = alarmModel, //告警集合 + FailuresCount = alarmModel.Count, //故障数 StatsCount = statsModels, //统计菜品数量 MinWok_Dishes_1 = morkFs[0].GoodName,//"满汉全席",//当前炒制菜品名 MinWok_Dishes_2 = morkFs[1].GoodName, diff --git a/BPASmartClient.MorkF/GVL_MorkF.cs b/BPASmartClient.MorkF/GVL_MorkF.cs index d16ccedd..9eac7c89 100644 --- a/BPASmartClient.MorkF/GVL_MorkF.cs +++ b/BPASmartClient.MorkF/GVL_MorkF.cs @@ -243,6 +243,7 @@ namespace BPASmartClient.MorkF public void ScreenInit() { + Task = "准备"; processModels.Clear(); //初始化进度列表 processModels.Add(new ProcessModel() { Id = 1, Name = "开始", Status = ProcessStatus.未执行 }); @@ -251,6 +252,12 @@ namespace BPASmartClient.MorkF processModels.Add(new ProcessModel() { Id = 4, Name = "出餐", Status = ProcessStatus.未执行 }); processModels.Add(new ProcessModel() { Id = 5, Name = "完成", Status = ProcessStatus.未执行 }); } + public void ScreenClear() + { + processModels.Clear(); + Task = string.Empty; + GoodName = string.Empty; + } #endregion #region 调料通道 public bool PassWay1_1Compelete { get; set; } @@ -287,8 +294,8 @@ namespace BPASmartClient.MorkF PassWay1_Compelete.Add(13,PassWay1_13Compelete); PassWay1_Compelete.Add(14,PassWay1_14Compelete); - //初始化进度列表 - ScreenInit(); + ////初始化进度列表 + //ScreenInit(); } /// diff --git a/BPASmartClient.MorkF/View/DebugView.xaml b/BPASmartClient.MorkF/View/DebugView.xaml index d38f9db3..2ae08e07 100644 --- a/BPASmartClient.MorkF/View/DebugView.xaml +++ b/BPASmartClient.MorkF/View/DebugView.xaml @@ -5,6 +5,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:BPASmartClient.MorkF.View" xmlns:vm="clr-namespace:BPASmartClient.MorkF.ViewModel" + x:Name="调试界面" mc:Ignorable="d" d:DesignHeight="900" d:DesignWidth="1300"> @@ -19,6 +20,9 @@ + + + @@ -188,5 +192,7 @@ + + diff --git a/BPASmartClient.MorkF/View/MaterialCalibration.xaml b/BPASmartClient.MorkF/View/MaterialCalibration.xaml index ce2e698a..46d8cfa1 100644 --- a/BPASmartClient.MorkF/View/MaterialCalibration.xaml +++ b/BPASmartClient.MorkF/View/MaterialCalibration.xaml @@ -5,8 +5,9 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:BPASmartClient.MorkF.View" xmlns:vm="clr-namespace:BPASmartClient.MorkF.ViewModel" + x:Name="菜品库校验" mc:Ignorable="d" - d:DesignHeight="1200" d:DesignWidth="1300"> + d:DesignHeight="1000" d:DesignWidth="1300"> @@ -79,14 +80,15 @@ - - - - - - - - + + + + + + + + + @@ -680,6 +682,8 @@