金川 未选择物料报错bug

This commit is contained in:
hehaibing-1996
2024-09-27 17:38:47 +08:00
parent d7622ee5bb
commit e1c558a627
2 changed files with 6 additions and 2 deletions

View File

@ -18,7 +18,7 @@ namespace 货架标准上位机.ViewModels
public class OutInventoryAddMatViewModel : BindableBase public class OutInventoryAddMatViewModel : BindableBase
{ {
#region Property #region Property
private ObservableCollection<MatInventorySummaryModel> dataGridItemSource; private ObservableCollection<MatInventorySummaryModel> dataGridItemSource = new ObservableCollection<MatInventorySummaryModel>();
public ObservableCollection<MatInventorySummaryModel> DataGridItemSource public ObservableCollection<MatInventorySummaryModel> DataGridItemSource
{ {
get { return dataGridItemSource; } get { return dataGridItemSource; }

View File

@ -40,7 +40,11 @@ namespace 货架标准上位机
private void comfirmClick(object sender, RoutedEventArgs e) 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(); var item = viewModel.DataGridItemSource.Where(t => t.isSelected).FirstOrDefault();
if (item == null) if (item == null)
{ {