Files
wcs/货架标准上位机/ViewModels/OutInventoryAddDucumentViewModel.cs
hehaibing-1996 aaf7c17562 提交代码
2024-04-23 08:31:37 +08:00

67 lines
1.8 KiB
C#

using HandyControl.Controls;
using Ping9719.WpfEx.Mvvm;
using System;
using System.Collections.ObjectModel;
using System.Windows;
using System.Windows.Input;
using WCS.BLL.DbModels;
using WCS.Model.ApiModel.MatInventoryDetail;
namespace .ViewModels
{
public class OutInventoryAddDucumentViewModel : BindableBase
{
#region Property
private ObservableCollection<MatInventorySummaryModel> dataGridItemSource;
public ObservableCollection<MatInventorySummaryModel> DataGridItemSource
{
get { return dataGridItemSource; }
set
{
SetProperty(ref dataGridItemSource, value);
}
}
#endregion
#region Command
/// <summary>
/// 新增物料
/// </summary>
public ICommand BtnAddCommand { get => new DelegateCommand(BtnAdd); }
public void BtnAdd()
{
var window = new OutInventoryAddMatView();
window.Owner = Application.Current.MainWindow;
var result = window.ShowDialog();
if (result == true)
{
if (DataGridItemSource == null)
DataGridItemSource = new ObservableCollection<MatInventorySummaryModel>();
DataGridItemSource.Add(window.inventorySummary);
}
else
{
return;
}
}
public ICommand DelCommand { get => new DelegateCommand<MatInventorySummaryModel>(Del); }
public void Del(MatInventorySummaryModel obj)
{
try
{
DataGridItemSource.Remove(obj);
;
}
catch (Exception ex)
{
}
}
#endregion
}
}