From e1c558a627285bd86dfdc63e52f02cc5c4a09902 Mon Sep 17 00:00:00 2001 From: hehaibing-1996 Date: Fri, 27 Sep 2024 17:38:47 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=91=E5=B7=9D=20=E6=9C=AA=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E7=89=A9=E6=96=99=E6=8A=A5=E9=94=99bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 货架标准上位机/ViewModels/OutInventoryAddMatViewModel.cs | 2 +- 货架标准上位机/Views/OutInventoryAddMatView.xaml.cs | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/货架标准上位机/ViewModels/OutInventoryAddMatViewModel.cs b/货架标准上位机/ViewModels/OutInventoryAddMatViewModel.cs index f235045..b81c6c4 100644 --- a/货架标准上位机/ViewModels/OutInventoryAddMatViewModel.cs +++ b/货架标准上位机/ViewModels/OutInventoryAddMatViewModel.cs @@ -18,7 +18,7 @@ namespace 货架标准上位机.ViewModels public class OutInventoryAddMatViewModel : BindableBase { #region Property - private ObservableCollection dataGridItemSource; + private ObservableCollection dataGridItemSource = new ObservableCollection(); public ObservableCollection DataGridItemSource { get { return dataGridItemSource; } diff --git a/货架标准上位机/Views/OutInventoryAddMatView.xaml.cs b/货架标准上位机/Views/OutInventoryAddMatView.xaml.cs index c5a7ad8..e94ffab 100644 --- a/货架标准上位机/Views/OutInventoryAddMatView.xaml.cs +++ b/货架标准上位机/Views/OutInventoryAddMatView.xaml.cs @@ -40,7 +40,11 @@ namespace 货架标准上位机 private void comfirmClick(object sender, RoutedEventArgs e) { - // + if (viewModel.DataGridItemSource == null) + { + HandyControl.Controls.MessageBox.Show("请搜索后选择物料!若不需要添加请点击【取消】按钮!"); + return; + } var item = viewModel.DataGridItemSource.Where(t => t.isSelected).FirstOrDefault(); if (item == null) {