From aea508a4acadab9aa41405f3e69de4b02d4d2311 Mon Sep 17 00:00:00 2001 From: ZhaoGang <15196688790@163.com> Date: Sat, 9 Sep 2023 16:12:34 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E6=B7=BB=E5=8A=A0=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E9=A1=B5=E9=9D=A2=E3=80=822.=20=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=BA=93=E4=BD=8D=E5=8F=AF=E4=BA=BA=E5=B7=A5=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E5=BA=93=E4=BD=8D=E4=BF=A1=E6=81=AF=E7=9A=84=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BPASmartClient.MorkCL/Control_MorkCL.cs | 28 ++++- BPASmartClient.MorkCL/GVL_MorkCL.cs | 23 +++- .../Model/Json/ConnectPar.cs | 2 + BPASmartClient.MorkCL/Server/OtherServer.cs | 6 +- .../View/EditFunctionParamView.xaml | 13 +- .../View/ItemStorageView.xaml | 32 ++++- .../View/ManualSetItemStorageView.xaml | 78 +++++++++++- .../View/ManualSetItemStorageView.xaml.cs | 12 ++ BPASmartClient.MorkCL/View/ParSet.xaml | 83 ++++++++++++- .../ViewModel/DebugViewModel.cs | 75 ++++++++++-- .../ViewModel/EditRawMaterialViewModel.cs | 11 +- .../ViewModel/ItemStorageViewModel.cs | 113 ++++++++++++++++-- .../ManualSetItemStorageViewModel.cs | 93 +++++++++++++- .../ViewModel/ParSetViewModel.cs | 41 +++++++ 14 files changed, 566 insertions(+), 44 deletions(-) create mode 100644 BPASmartClient.MorkCL/ViewModel/ParSetViewModel.cs diff --git a/BPASmartClient.MorkCL/Control_MorkCL.cs b/BPASmartClient.MorkCL/Control_MorkCL.cs index 877d2369..8c22a36d 100644 --- a/BPASmartClient.MorkCL/Control_MorkCL.cs +++ b/BPASmartClient.MorkCL/Control_MorkCL.cs @@ -8,6 +8,7 @@ using BPASmartClient.MorkCL.Model.DB; using BPASmartClient.MorkCL.Model.Json; using BPASmartClient.MorkCL.Server; using Newtonsoft.Json.Linq; +using Opc.Ua; using SqlSugar; using System; using System.Collections.Generic; @@ -651,7 +652,7 @@ namespace BPASmartClient.MorkCL device.DiningOutStart = false; DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-设置机器人取空盆。"); - + robot.IsIdle.Wait(Cts: TaskList[et].Cts); //TODO:暂时修改,后期优化。 while (!TaskList[et].Cts.IsCancellationRequested) @@ -763,7 +764,9 @@ namespace BPASmartClient.MorkCL { propertyInfos = morkCL.GetType().GetProperties().ToList(); } - + morkCL.RecipeQueueCount = morkCL.cds.Count; + morkCL.FryingPanTaskCount_1 = morkCL.cds.Count(data => data.DeviceType == EDeviceType.炒锅1); + morkCL.FryingPanTaskCount_2 = morkCL.cds.Count(data => data.DeviceType == EDeviceType.炒锅2); var fryingPan1 = (FryingPanServer)devices[EDeviceType.炒锅1]; var fryingPan2 = (FryingPanServer)devices[EDeviceType.炒锅2]; @@ -1048,12 +1051,18 @@ namespace BPASmartClient.MorkCL var weghier = (OtherServer)devices[EDeviceType.外部设备]; if (weghier.WeigherTare()) { - NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, Application.Current.MainWindow, "去皮成功", $"电子秤除皮操作成功。"); + Application.Current.Dispatcher.Invoke(() => + { + NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, Application.Current.MainWindow, "去皮成功", $"电子秤除皮操作成功。"); + }); DeviceProcessLogShow($"电子秤除皮操作成功。"); } else { - NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, Application.Current.MainWindow, "去皮失败", $"电子秤除皮操作失败。"); + Application.Current.Dispatcher.Invoke(() => + { + NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, Application.Current.MainWindow, "去皮失败", $"电子秤除皮操作失败。"); + }); DeviceProcessLogShow($"电子秤除皮操作失败。"); } @@ -1137,6 +1146,15 @@ namespace BPASmartClient.MorkCL DeviceProcessLogShow($"复位所有由上位机下发至机器人的变量失败。"); } }, "InitRobotAllVar", true); + + ActionManage.GetInstance.Register>(() => + { + if (morkCL.RecipeQueueCount > 0 || morkCL.FryingPanTaskCount_1 > 0 || morkCL.FryingPanTaskCount_2 > 0) + { + return true; + } + return false; + },"SystemIsBusy",true); } Func frypanIsIdle => (o) => @@ -1151,5 +1169,7 @@ namespace BPASmartClient.MorkCL } return false; }; + + } } diff --git a/BPASmartClient.MorkCL/GVL_MorkCL.cs b/BPASmartClient.MorkCL/GVL_MorkCL.cs index 6934d04e..77bad8b0 100644 --- a/BPASmartClient.MorkCL/GVL_MorkCL.cs +++ b/BPASmartClient.MorkCL/GVL_MorkCL.cs @@ -394,11 +394,32 @@ namespace BPASmartClient.MorkCL [VariableMonitor("出餐箱子在位检测", "LW630")] public bool[] BoxDetection { get; set; } = new bool[4]; + #region 其他变量 /// /// 入库操作许可 /// [VariableMonitor("入库操作许可")] public bool CanItemStorage { get; set; } + + /// + /// 总任务排队数量 + /// + [VariableMonitor("总任务排队数量")] + public int RecipeQueueCount { get; set; } + + /// + /// 炒锅1#排队任务数量 + /// + [VariableMonitor("炒锅1#排队任务数量")] + public int FryingPanTaskCount_1 { get; set; } + + /// + /// 炒锅2#排队任务数量 + /// + [VariableMonitor("炒锅2#排队任务数量")] + public int FryingPanTaskCount_2 { get; set; } #endregion + #endregion + } -} +} \ No newline at end of file diff --git a/BPASmartClient.MorkCL/Model/Json/ConnectPar.cs b/BPASmartClient.MorkCL/Model/Json/ConnectPar.cs index 72354e0b..fed972d1 100644 --- a/BPASmartClient.MorkCL/Model/Json/ConnectPar.cs +++ b/BPASmartClient.MorkCL/Model/Json/ConnectPar.cs @@ -77,5 +77,7 @@ namespace BPASmartClient.MorkCL.Model.Json /// 炒锅2辅料最大位置。 /// public int FryPanAccessoriesMax_2 { get; set; } = 8; + + //public float IngredientsDeviation { get; set; } } } diff --git a/BPASmartClient.MorkCL/Server/OtherServer.cs b/BPASmartClient.MorkCL/Server/OtherServer.cs index 68eaee47..fc0d663b 100644 --- a/BPASmartClient.MorkCL/Server/OtherServer.cs +++ b/BPASmartClient.MorkCL/Server/OtherServer.cs @@ -41,7 +41,7 @@ namespace BPASmartClient.MorkCL.Server Thread.Sleep(50); myDevice.SlaveAddress = 2; - myDevice.Read("LW8".ToModbusAdd()).OnSuccess(s => { CurrentWeight = s; }); + myDevice.Read("LW6".ToModbusAdd()).OnSuccess(s => { CurrentWeight = s; }); Thread.Sleep(50); }), $"其它外部设备-{PortName}", true); @@ -62,7 +62,7 @@ namespace BPASmartClient.MorkCL.Server { ModbusRtu weigher = (ModbusRtu)MyModbus; weigher.SlaveAddress = 2; - return weigher.Write("LB4", false).IsSuccess; + return weigher.Write("LB4".ToModbusAdd(), true).IsSuccess; } else return false; @@ -77,7 +77,7 @@ namespace BPASmartClient.MorkCL.Server { ModbusRtu weigher = (ModbusRtu)MyModbus; weigher.SlaveAddress = 2; - return weigher.Write("LB3", false).IsSuccess; + return weigher.Write("LB3".ToModbusAdd(), true).IsSuccess; } else return false; diff --git a/BPASmartClient.MorkCL/View/EditFunctionParamView.xaml b/BPASmartClient.MorkCL/View/EditFunctionParamView.xaml index 007a7f25..31260dd2 100644 --- a/BPASmartClient.MorkCL/View/EditFunctionParamView.xaml +++ b/BPASmartClient.MorkCL/View/EditFunctionParamView.xaml @@ -1,12 +1,12 @@  - + + @@ -34,13 +36,28 @@ - +