diff --git a/BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj b/BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj index a29b2e0c..b726d000 100644 --- a/BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj +++ b/BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj @@ -182,6 +182,17 @@ + + + + + + + Always + + + Always + diff --git a/BPASmartClient.CustomResource/Themes/MyStyle.xaml b/BPASmartClient.CustomResource/Themes/MyStyle.xaml index 98e7661c..f734aa46 100644 --- a/BPASmartClient.CustomResource/Themes/MyStyle.xaml +++ b/BPASmartClient.CustomResource/Themes/MyStyle.xaml @@ -779,7 +779,7 @@ - + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/BPASmartClient.CustomResource/Vioce/取餐通知.wav b/BPASmartClient.CustomResource/Vioce/取餐通知.wav new file mode 100644 index 00000000..1d5d35ca Binary files /dev/null and b/BPASmartClient.CustomResource/Vioce/取餐通知.wav differ diff --git a/BPASmartClient.CustomResource/Vioce/电子提示音.wav b/BPASmartClient.CustomResource/Vioce/电子提示音.wav new file mode 100644 index 00000000..e0d3fed3 Binary files /dev/null and b/BPASmartClient.CustomResource/Vioce/电子提示音.wav differ diff --git a/BPASmartClient.GSIceCream/IceCreamMachine.cs b/BPASmartClient.GSIceCream/IceCreamMachine.cs index 0005faff..4cde3dd9 100644 --- a/BPASmartClient.GSIceCream/IceCreamMachine.cs +++ b/BPASmartClient.GSIceCream/IceCreamMachine.cs @@ -176,6 +176,7 @@ namespace BPASmartClient.GSIceCream private void ProcessHeart(ICMSG_Heart_UP heartUpMsg) { + IsConnected = OnLine; status["IceCreamIsConnected"] = OnLine; status["IceCreamCurrentMode"] = heartUpMsg.MS; @@ -184,6 +185,8 @@ namespace BPASmartClient.GSIceCream status["IceCreamHJWD"] = BitConverter.ToInt16(new byte[] { heartUpMsg.HJWD_L, heartUpMsg.HJWD_H }, 0); status["IceCreamDL"] = BitConverter.ToInt16(new byte[] { heartUpMsg.DL_L, heartUpMsg.DL_H }, 0); status["IceCreamFault"] = (MORKI_FAULT)BitConverter.ToInt16(new byte[] { heartUpMsg.GZ_L, heartUpMsg.GZ_H }, 0); + heartUpMsg.HasGZ(out string msg); + status["IceCreamError"] = msg; status["IceCreamCXB"] = heartUpMsg.CXB; status["IceCreamDLCompleted"] = (heartUpMsg.DLTJ >> 4 & 1) == 1; diff --git a/BPASmartClient.GSIceCream/Protocal/ICMSG_Heart_UP.cs b/BPASmartClient.GSIceCream/Protocal/ICMSG_Heart_UP.cs index a2daf77e..7a0516fe 100644 --- a/BPASmartClient.GSIceCream/Protocal/ICMSG_Heart_UP.cs +++ b/BPASmartClient.GSIceCream/Protocal/ICMSG_Heart_UP.cs @@ -65,7 +65,7 @@ namespace BPASmartClient.GSIceCream msg += ((GZ_L >> 3) & 1) == 1 ? "皮带打滑" : string.Empty; msg += ((GZ_L >> 2) & 1) == 1 ? "冻缸报警" : string.Empty; msg += ((GZ_L >> 1) & 1) == 1 ? "缺料报警" : string.Empty; - + msg = msg == string.Empty ? "无异常" : msg; return string.IsNullOrEmpty(msg); } diff --git a/BPASmartClient.GSIceCream/Protocal/MORKI_FAULT.cs b/BPASmartClient.GSIceCream/Protocal/MORKI_FAULT.cs index 161aabc2..f7a99ad8 100644 --- a/BPASmartClient.GSIceCream/Protocal/MORKI_FAULT.cs +++ b/BPASmartClient.GSIceCream/Protocal/MORKI_FAULT.cs @@ -28,5 +28,6 @@ namespace BPASmartClient.GSIceCream 皮带打滑 = 1 >> 4, 冻缸报警 = 1 >> 5, 缺料报警 = 1 >> 6, + } } diff --git a/BPASmartClient.KLMCoffee/CoffeeMachine.cs b/BPASmartClient.KLMCoffee/CoffeeMachine.cs index 1c084580..e2a20f59 100644 --- a/BPASmartClient.KLMCoffee/CoffeeMachine.cs +++ b/BPASmartClient.KLMCoffee/CoffeeMachine.cs @@ -108,7 +108,7 @@ namespace BPASmartClient.KLMCoffee { byte item = dataStorage.GetData(); List data = new List() { item }; - if (Encoding.ASCII.GetString(data.ToArray()) == ":") + if (Encoding.ASCII.GetString(data.ToArray()) == ":") { temp.Add(item); while (dataStorage.GetSize() < 32) { Thread.Sleep(5); } @@ -119,10 +119,12 @@ namespace BPASmartClient.KLMCoffee } List vs = new List() { temp[temp.Count - 4], temp[temp.Count - 3], temp[temp.Count - 2], temp[temp.Count - 1] }; + string t = Encoding.ASCII.GetString(vs.ToArray()).ToLower(); //帧尾 - if (Encoding.ASCII.GetString(vs.ToArray()).ToLower() == "\\r\\n" || Encoding.ASCII.GetString(vs.ToArray()).ToLower() == "\r\n") + //if (Encoding.ASCII.GetString(vs.ToArray()).ToLower() == "\\r\\n" || Encoding.ASCII.GetString(vs.ToArray()).ToLower() == "\r\n") + var package = Encoding.ASCII.GetString(temp.ToArray()); + if(package.Contains("\\r\\n")) { - var package = Encoding.ASCII.GetString(temp.ToArray()); ProcessMsg(package); } temp.Clear(); @@ -136,25 +138,26 @@ namespace BPASmartClient.KLMCoffee { try { + lastRefreshTime = DateTime.Now; SystemStatusModel systemStatus = new K95Command().StateResolution(data); if (systemStatus != null) { - status["CoffeeIsconnected"] = OnLine; - if((K95SysTemStatus)status["Status"] == K95SysTemStatus.正在制作咖啡&&systemStatus.temStatus != K95SysTemStatus.正在制作咖啡) + status["CoffeeIsConnected"] = OnLine; + if((K95SysTemStatus)status["CoffeeStatus"] == K95SysTemStatus.正在制作咖啡&&systemStatus.temStatus != K95SysTemStatus.正在制作咖啡) { - status["Status"] = systemStatus.temStatus; + status["CoffeeStatus"] = systemStatus.temStatus; EventBus.EventBus.GetInstance().Publish(new KLMCoffee_CoffeEndCookEvent { DeviceId = DeviceId }); } else status["CoffeeStatus"] = systemStatus.temStatus; status["CoffeedrinkType"] = systemStatus.drinkType; status["CoffeeAppStatus"] = systemStatus.taskIndex; status["Coffeeprogress"] = systemStatus.progress; - status["CoffeeWarning"] = systemStatus.faultMessage.dataFault(); + status["CoffeeWarning"] = systemStatus.faultMessage?.dataFault(); status["CoffeeKeep"] = systemStatus.upkeepMessage; - if (systemStatus.faultMessage.IsFault() || systemStatus.upkeepMessage.IsUpkeep()) - IsWork = false; - else - IsWork = true; + //if (systemStatus.faultMessage.IsFault() || systemStatus.upkeepMessage.IsUpkeep()) + // IsWork = false; + //else + // IsWork = true; } } @@ -290,6 +293,7 @@ namespace BPASmartClient.KLMCoffee } }); InitStatus(); + Start(); } public override void WriteData(string address, object value) diff --git a/BPASmartClient.KLMCoffee/Protocal/SystemStatusModel.cs b/BPASmartClient.KLMCoffee/Protocal/SystemStatusModel.cs index 8a44c5de..720ddb58 100644 --- a/BPASmartClient.KLMCoffee/Protocal/SystemStatusModel.cs +++ b/BPASmartClient.KLMCoffee/Protocal/SystemStatusModel.cs @@ -90,11 +90,11 @@ namespace BPASmartClient.KLMCoffee.Protocal if (makeSta.Substring(2,1) == ((TaskIndex)Enum.Parse(typeof(TaskIndex),item)).GetString()) taskIndex = ((TaskIndex)Enum.Parse(typeof(TaskIndex),item)); } - - if (makeProgress1 != "0000") - progress = Convert.ToInt32(makeProgress,16) / Convert.ToInt32(makeProgress1,16); - faultMessage = new FaultMessage(ErrorL,ErrorH); + faultMessage = new FaultMessage(ErrorL, ErrorH); upkeepMessage = new UpkeepMessage(InFormation); + if ( makeProgress1 != "0000") + progress = Convert.ToInt32(makeProgress,16) / Convert.ToInt32(makeProgress1,16); + } catch (Exception ex) { diff --git a/BPASmartClient.LebaiRobot/LebaiHelper.cs b/BPASmartClient.LebaiRobot/LebaiHelper.cs index cb9bcbc4..9acf7a53 100644 --- a/BPASmartClient.LebaiRobot/LebaiHelper.cs +++ b/BPASmartClient.LebaiRobot/LebaiHelper.cs @@ -365,37 +365,18 @@ namespace BPASmartClient.LebaiRobot await client?.RunScene(id); MessageLog.GetInstance.Show($"调用场景:{id}"); } - /// - /// 设置输出 - /// - /// - /// - public void SetOutput(bool bDO, int pin = 0) - { - try - { - if (client == null) { return; } - var res = client.SetDIO(new DIO() { Pin = pin, Value = bDO ? 1 : 0 }); - } - catch (Exception ex) - { - MessageLog.GetInstance.ShowEx(ex.ToString()); - } - } - - public void MoveL(double pose) - { - //try - //{ - // if (client == null) { return; } - // var res = client.MovePT(new PVATRequest() { }) - - //} - //catch (Exception ex) - //{ - // MessageLog.GetInstance.ShowEx(ex.ToString()); - //} - } + //public async void ExecuteLua() + // { + // try + // { + // string lua = "" + // if (client == null) return; + // await client?.ExecuteLua() + + // } + // catch (Exception ex) + + // } } } diff --git a/BPASmartClient.MQTT/MQTTProxy.cs b/BPASmartClient.MQTT/MQTTProxy.cs index bdad1d69..43c31708 100644 --- a/BPASmartClient.MQTT/MQTTProxy.cs +++ b/BPASmartClient.MQTT/MQTTProxy.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; +using System.Threading; using System.Threading.Tasks; namespace BPASmartClient.MQTT @@ -23,7 +24,7 @@ namespace BPASmartClient.MQTT private IMqttClient client; public void Connect(string userName, string Password, string ip, int port, string clientId) - { + { IConfigurationBuilder configurationBuilder = new ConfigurationBuilder(); configurationBuilder.AddMqttClientHostedService(p => { @@ -63,6 +64,13 @@ namespace BPASmartClient.MQTT { if (client.IsConnected) await client.PublishAsync(topic, content); + else + { + client?.ReconnectAsync(); + Thread.Sleep(10); + } + + } public async void Subscrib(params string[] topics) diff --git a/BPASmartClient.Model/乐白机器人/Enum/Lebai_qsqdCode.cs b/BPASmartClient.Model/乐白机器人/Enum/Lebai_qsqdCode.cs index a6505da7..530bb3e5 100644 --- a/BPASmartClient.Model/乐白机器人/Enum/Lebai_qsqdCode.cs +++ b/BPASmartClient.Model/乐白机器人/Enum/Lebai_qsqdCode.cs @@ -9,6 +9,7 @@ namespace BPASmartClient.Model.乐白机器人.Enum public class Lebai_qsqdCode { #region 且时且多设备 + public const int SENCE_自嗨 = 10008; public const int SENCE_取咖啡杯 = 10031; public const int SENCE_取冰淇淋杯 = 10032; public const int SENCE_咖啡杯检测 = 10033; diff --git a/BPASmartClient.MorkS/BPASmartClient.MorkS.csproj b/BPASmartClient.MorkS/BPASmartClient.MorkS.csproj index f5f6ce16..a262445e 100644 --- a/BPASmartClient.MorkS/BPASmartClient.MorkS.csproj +++ b/BPASmartClient.MorkS/BPASmartClient.MorkS.csproj @@ -11,6 +11,7 @@ + diff --git a/BPASmartClient.MorkS/Control_Morks.cs b/BPASmartClient.MorkS/Control_Morks.cs index 0e080003..c2530892 100644 --- a/BPASmartClient.MorkS/Control_Morks.cs +++ b/BPASmartClient.MorkS/Control_Morks.cs @@ -18,6 +18,9 @@ using BPASmartClient.MorkS.Model; using System.Collections.ObjectModel; using BPASmartClient.MorkS.ViewModel; using BPASmartClient.Business; +using System.Speech.Synthesis; +using System.Windows.Forms; +using System.Media; namespace BPASmartClient.MorkS { @@ -29,6 +32,7 @@ namespace BPASmartClient.MorkS public override void DoMain() { + MonitorViewModel.DeviceId = DeviceId; ServerInit(); DataParse(); @@ -51,22 +55,26 @@ namespace BPASmartClient.MorkS } } - ActionManage.GetInstance.Register(new Action(() => + ActionManage.GetInstance.Register(new Action((o) => { - Random rd = new Random(); - ThreadManage.GetInstance().StartLong(new Action(() => + if (o.Length > 0 ) { - int NoodleLoc = rd.Next(1, 6); - int BowlLoc = rd.Next(10, 11); - string guid = new Guid().ToString(); + Random rd = new Random(); + ThreadManage.GetInstance().StartLong(new Action(() => + { + int NoodleLoc = (int)o[0] == 0? rd.Next(1, 6) : (int)o[0]; + int BowlLoc = (int)o[1] == 0 ? rd.Next(10, 12) : (int)o[1]; + + string guid = new Guid().ToString(); - mORKS.RBTakeNoodleTask.Enqueue(new OrderLocInfo() { Loc = (ushort)NoodleLoc, SuborderId = guid }); - MessageLog.GetInstance.Show($"添加订单:面条位置【{NoodleLoc}】"); + mORKS.RBTakeNoodleTask.Enqueue(new OrderLocInfo() { Loc = (ushort)NoodleLoc, SuborderId = guid }); + MessageLog.GetInstance.Show($"添加订单:面条位置【{NoodleLoc}】"); - mORKS.TakeBowlTask.Enqueue(new OrderLocInfo() { Loc = (ushort)BowlLoc, SuborderId = guid }); - MessageLog.GetInstance.Show($"添加订单:碗位置【{BowlLoc}】"); - Thread.Sleep(60000); - }), "ForOrder"); + mORKS.TakeBowlTask.Enqueue(new OrderLocInfo() { Loc = (ushort)BowlLoc, SuborderId = guid }); + MessageLog.GetInstance.Show($"添加订单:碗位置【{BowlLoc}】"); + Thread.Sleep(60000); + }), "ForOrder"); + } }), "EnableForOrder"); ActionManage.GetInstance.Register(new Action((o) => @@ -78,6 +86,7 @@ namespace BPASmartClient.MorkS if (o != null && o is WritePar writePar) WriteData(writePar.Address, writePar.Value); }), "WriteBools"); ActionManage.GetInstance.Register(new Action(() => { DeviceInit(); }), "InitDevice"); + } public override void ResetProgram() @@ -131,7 +140,7 @@ namespace BPASmartClient.MorkS private void GetStatus(string key, Action action) { if (peripheralStatus.ContainsKey(key)) - { + { if (peripheralStatus[key] != null) { action?.Invoke(peripheralStatus[key]); @@ -331,6 +340,7 @@ namespace BPASmartClient.MorkS if (orderLocInfo.Loc >= 10 && orderLocInfo.Loc <= 11) { mORKS.TakeBowlId = orderLocInfo.SuborderId; + mORKS.TakeBowName = orderLocInfo.GoodName; TakeBowlControl(orderLocInfo.Loc); SetRecipeNumber(orderLocInfo.RecipeNumber); OrderChange(mORKS.TakeBowlId, ORDER_STATUS.COOKING); @@ -346,6 +356,7 @@ namespace BPASmartClient.MorkS { if (mORKS.AllowRun && mORKS.TakeBowlTask.Count > 0 && !mORKS.TakeBowlIdle && !mORKS.TakeBowlInterlock) { + DeviceProcessLogShow("开始取碗流程"); ushort BowLoc = 0; var res = orderMaterialDelivery?.BatchingInfo?.Where(p => p.BatchingId == mORKS.TakeBowlTask.ElementAt(0).BatchingId).ToList(); if (res == null || res?.Count == 0) @@ -539,9 +550,11 @@ namespace BPASmartClient.MorkS mORKS.OutMealId = mORKS.IngredientsCompleteId; + mORKS.OutMealName = mORKS.IngredientsCompleteName; mORKS.IngredientsCompleteId = string.Empty; mORKS.CookNodelId[loc] = string.Empty; DeviceProcessLogShow($"{loc + 1} 号位置出餐控制,订单ID:{ mORKS.OutMealId}"); + mORKS.OutNoodleing = true; } } @@ -557,7 +570,9 @@ namespace BPASmartClient.MorkS if (RTrig.GetInstance("AllowFallNoodle").Start(mORKS.AllowFallNoodle)) { mORKS.IngredientsCompleteId = mORKS.TakeBowlId; + mORKS.IngredientsCompleteName = mORKS.TakeBowName; mORKS.TakeBowlId = string.Empty; + mORKS.TakeBowName = string.Empty; DeviceProcessLogShow($"碗到位,允许到面,{mORKS.IngredientsCompleteId}"); mORKS.TakeBowlInterlock = false; } @@ -569,6 +584,7 @@ namespace BPASmartClient.MorkS DeviceProcessLogShow($"订单【{mORKS.OutMealId}】制作完成"); mORKS.CookCompleteFlatBit = true; mORKS.OutNoodleing = false; + WaitMeaLSpeak(mORKS.OutMealName); } //取餐完成逻辑处理 @@ -579,6 +595,7 @@ namespace BPASmartClient.MorkS ResetCookComplete(); mORKS.CookCompleteFlatBit = false; mORKS.OutMealId = string.Empty; + mORKS.OutMealName = string.Empty; } //机器人取面完成信号检测 @@ -599,7 +616,17 @@ namespace BPASmartClient.MorkS } - + /// + /// 语音提醒取餐 + /// + /// + private void WaitMeaLSpeak(string meal) + { + VoiceAPI.m_SystemPlayWav(@"Vioce\电子提示音.wav"); + Thread.Sleep(1000); + mORKS.speech.Speak(meal); + VoiceAPI.m_SystemPlayWav(@"Vioce\取餐通知.wav"); + } #region PLC 控制函数 diff --git a/BPASmartClient.MorkS/GVL_MORKS.cs b/BPASmartClient.MorkS/GVL_MORKS.cs index 35702f06..84007e12 100644 --- a/BPASmartClient.MorkS/GVL_MORKS.cs +++ b/BPASmartClient.MorkS/GVL_MORKS.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; +using System.Speech.Synthesis; using System.Text; using System.Threading.Tasks; @@ -328,11 +329,19 @@ namespace BPASmartClient.MorkS /// 取碗订单ID /// public string TakeBowlId = string.Empty; + /// + /// 取碗订单名称 + /// + public string TakeBowName = string.Empty; /// /// 配料完成订单ID /// public string IngredientsCompleteId = string.Empty; + /// + /// 配料完成订单名称 + /// + public string IngredientsCompleteName = string.Empty; /// /// 煮面口对应的订单ID @@ -343,6 +352,10 @@ namespace BPASmartClient.MorkS /// 出餐订单ID /// public string OutMealId = string.Empty; + /// + /// 出餐订单名称 + /// + public string OutMealName = string.Empty; /// /// 转台位置轮询 @@ -355,6 +368,8 @@ namespace BPASmartClient.MorkS [VariableMonitor("转台当前启动位置")] public ushort CurrentLoc { get; set; } = 0; + public SpeechSynthesizer speech = new SpeechSynthesizer(); + #endregion } } diff --git a/BPASmartClient.MorkS/OrderLocInfo.cs b/BPASmartClient.MorkS/OrderLocInfo.cs index 5941b50f..ab815d02 100644 --- a/BPASmartClient.MorkS/OrderLocInfo.cs +++ b/BPASmartClient.MorkS/OrderLocInfo.cs @@ -1,4 +1,5 @@ -using System; +using BPA.Message; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -13,5 +14,10 @@ namespace BPASmartClient.MorkS public ushort RecipeNumber { get; set; } public int BatchingId { get; set; } public string GoodName { get; set; } + + public int RecipeId { get; set; } + + public List Recipes { get; set; } + } } diff --git a/BPASmartClient.MorkS/View/Debug.xaml b/BPASmartClient.MorkS/View/Debug.xaml index 2ab5d0fd..bca1cd80 100644 --- a/BPASmartClient.MorkS/View/Debug.xaml +++ b/BPASmartClient.MorkS/View/Debug.xaml @@ -25,6 +25,15 @@ + @@ -40,6 +49,8 @@ Foreground="{StaticResource TitleBorderColor}" Text="面条位置:" /> + + @@ -48,16 +59,37 @@ Foreground="{StaticResource TitleBorderColor}" Text="面碗位置:" /> + + +