67 lines
1.8 KiB
C#
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
|
|
}
|
|
}
|