From e29e7aa6e348025af987b8187dc01d22c3db69c7 Mon Sep 17 00:00:00 2001 From: maqiao <625215135@qq.com> Date: Thu, 26 Sep 2024 10:06:34 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=91=E5=AE=9A=E9=A1=B5=E9=9D=A2=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E9=80=89=E6=8B=A9=E8=8D=AF=E5=93=81=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E8=8D=AF=E5=93=81=E5=9F=BA=E6=95=B0=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BindBoxPackageWindowViewModel.cs | 50 ++++++++++++++++++- .../ViewModels/OpenBoxNewWindowViewModel.cs | 2 +- DM_Weight/Views/BindBoxPackageWindow.xaml | 6 ++- 3 files changed, 54 insertions(+), 4 deletions(-) diff --git a/DM_Weight/ViewModels/BindBoxPackageWindowViewModel.cs b/DM_Weight/ViewModels/BindBoxPackageWindowViewModel.cs index 378f562..9f48a15 100644 --- a/DM_Weight/ViewModels/BindBoxPackageWindowViewModel.cs +++ b/DM_Weight/ViewModels/BindBoxPackageWindowViewModel.cs @@ -60,7 +60,15 @@ namespace DM_Weight.ViewModels public ChannelStock Channel { get { return _channelStock; } - set { SetProperty(ref _channelStock, value); } + set + { + if (value != null) + { + DrugInfo = DrugInfos.Where(di => di.DrugId == value.DrugInfo.DrugId).First(); + BaseQuantity = value.BaseQuantity.ToString(); + } + SetProperty(ref _channelStock, value); + } } @@ -312,6 +320,44 @@ namespace DM_Weight.ViewModels } } + //保存修改的药品基数 + public DelegateCommand SaveCommand + { + get => new DelegateCommand(() => + { + if (DrugInfo.DrugId != Channel.DrugId) + { + SnackbarBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#b71c1c")); + SnackbarMessageQueue.Enqueue("只能修改药品基数,不能更换绑定药品!"); + return; + } + int baseQty = 0; + if (int.TryParse(BaseQuantity, out baseQty)) + { + Channel.BaseQuantity = Convert.ToInt32(baseQty); + int iUpdate= SqlSugarHelper.Db.Updateable(Channel).ExecuteCommand(); + if (iUpdate > 0) + { + + SnackbarBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#00e676")); + SnackbarMessageQueue.Enqueue("保存修改完成!"); + } + else + { + + SnackbarBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#00e676")); + SnackbarMessageQueue.Enqueue("保存修改失败!"); + } + } + else + { + SnackbarBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#b71c1c")); + SnackbarMessageQueue.Enqueue("药品基数只能是正整数,请检查输入!"); + return; + } + + }); + } //刷新 public DelegateCommand Query @@ -346,7 +392,7 @@ namespace DM_Weight.ViewModels IsEnable = false; Status = 1; Console.WriteLine($"正在打开{iList[i]}号药箱"); - ModbusHelper.GetInstance().OpenBoxDoor(iList[i]-1); + ModbusHelper.GetInstance().OpenBoxDoor(iList[i] - 1); //iNumber++; } diff --git a/DM_Weight/ViewModels/OpenBoxNewWindowViewModel.cs b/DM_Weight/ViewModels/OpenBoxNewWindowViewModel.cs index f985980..13fda60 100644 --- a/DM_Weight/ViewModels/OpenBoxNewWindowViewModel.cs +++ b/DM_Weight/ViewModels/OpenBoxNewWindowViewModel.cs @@ -517,7 +517,7 @@ namespace DM_Weight.ViewModels Operator = HomeWindowViewModel.Operator?.Id, OperationTime = DateTime.Now, Type = 55, - InvoiceId = $"打开{iList[i]}号药箱", + InvoiceId = $"打开{iList[i].DrawerNo}号药箱", OptionType= SelfContent.Substring(0,1)=="取"? 0:1 }).ExecuteCommand(); //记录药箱打开时间 diff --git a/DM_Weight/Views/BindBoxPackageWindow.xaml b/DM_Weight/Views/BindBoxPackageWindow.xaml index e234391..5e6c9b4 100644 --- a/DM_Weight/Views/BindBoxPackageWindow.xaml +++ b/DM_Weight/Views/BindBoxPackageWindow.xaml @@ -176,7 +176,7 @@ ToolTip="解绑" Content="解绑" Command="{Binding RemoveBinding}" /> -