Files
wcs/货架标准上位机/ViewModels/OutInventoryAddMatViewModel.cs
2024-09-27 17:38:47 +08:00

105 lines
2.9 KiB
C#

using HandyControl.Controls;
using Ping9719.WpfEx.Mvvm;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
using WCS.BLL.DbModels;
using WCS.Model;
using WCS.Model.ApiModel.MatBaseInfo;
using WCS.Model.ApiModel.MatInventoryDetail;
using .Api;
namespace .ViewModels
{
public class OutInventoryAddMatViewModel : BindableBase
{
#region Property
private ObservableCollection<MatInventorySummaryModel> dataGridItemSource = new ObservableCollection<MatInventorySummaryModel>();
public ObservableCollection<MatInventorySummaryModel> DataGridItemSource
{
get { return dataGridItemSource; }
set
{
SetProperty(ref dataGridItemSource, value);
}
}
private MatInventorySummaryModel selectedataGridItem;
public MatInventorySummaryModel SelectedataGridItem
{
get { return selectedataGridItem; }
set
{
SetProperty(ref selectedataGridItem, value);
}
}
private string matCode;
public string MatCode
{
get { return matCode; }
set
{
SetProperty(ref matCode, value);
}
}
private string matName;
public string MatName
{
get { return matName; }
set
{
SetProperty(ref matName, value);
}
}
private int shelfTypeId;
public int ShelfTypeId
{
get => shelfTypeId;
set { SetProperty(ref shelfTypeId, value); }
}
#endregion
#region Command
/// <summary>
/// 搜索
/// </summary>
public ICommand BtnSearchCommand { get => new DelegateCommand(BtnSearch); }
public void BtnSearch()
{
#region
try
{
var body = new GetMatInventorySummaryRequest()
{
MatName = MatName,
MatCode = MatCode,
ShelfTypeId = ShelfTypeId,
};
var Result = ApiHelp.GetDataFromHttp<ResponseCommon<List<MatInventorySummaryModel>>>(LocalFile.Config.ApiIpHost + "matInventoryDetail/getMatInventorySummary", body, "POST");
if (Result != null && Result.Data != null)
{
DataGridItemSource = new ObservableCollection<MatInventorySummaryModel>(Result.Data);
}
}
catch (Exception ex)
{
Growl.Error("加载数据失败:" + ex.Message);
}
finally
{
}
#endregion
}
#endregion
}
}