提交代码
This commit is contained in:
66
货架标准上位机/ViewModels/OutInventoryAddDucumentViewModel.cs
Normal file
66
货架标准上位机/ViewModels/OutInventoryAddDucumentViewModel.cs
Normal file
@ -0,0 +1,66 @@
|
||||
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
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user