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 智能仓储WCS管理系统.Api; namespace 智能仓储WCS管理系统.ViewModels { public class OutInventoryAddMatViewModel : BindableBase { #region Property private ObservableCollection dataGridItemSource = new ObservableCollection(); public ObservableCollection 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 /// /// 搜索 /// 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>>(LocalFile.Config.ApiIpHost + "matInventoryDetail/getMatInventorySummary", body, "POST"); if (Result != null && Result.Data != null) { DataGridItemSource = new ObservableCollection(Result.Data); } } catch (Exception ex) { Growl.Error("加载数据失败:" + ex.Message); } finally { } #endregion } #endregion } }