| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- using GalaSoft.MvvmLight;
- using GalaSoft.MvvmLight.Command;
- using Microsoft.Practices.ServiceLocation;
- using Muchinfo.MTPClient.Data.Model.Sale;
- using Muchinfo.MTPClient.Infrastructure.MessageBox;
- using Muchinfo.MTPClient.Infrastructure.Utilities;
- using Muchinfo.MTPClient.IService;
- using Muchinfo.MTPClient.Resources;
- using Muchinfo.PC.Common.Extensions;
- using Muchinfo.WPF.Controls.Windows;
- using System.Collections.Generic;
- using System.Threading.Tasks;
- namespace Muchinfo.MTPClient.Sale.ViewModels
- {
- public class QueryDealPurchaseViewModel : ViewModelBase
- {
- private ISaleService _saleService;
- #region 构造函数
- public QueryDealPurchaseViewModel()
- {
- _saleService = ServiceLocator.Current.GetInstance<ISaleService>();
- }
- #endregion
- #region 成员变量
- private List<SaleApply> _saleGoodsApplyList;
- public List<SaleApply> SaleGoodsApplyList
- {
- get
- {
- return _saleGoodsApplyList;
- }
- set
- {
- Set(() => SaleGoodsApplyList, ref _saleGoodsApplyList, value);
- }
- }
- private string _goodCode = string.Empty;
- /// <summary>
- /// 商品代码
- /// </summary>
- public string GoodCode
- {
- get
- {
- return _goodCode.Trim();
- }
- set
- {
- Set(() => GoodCode, ref _goodCode, value);
- }
- }
- private bool _isBusy;
- /// <summary>
- /// 是否在查询
- /// </summary>
- public bool IsBusy
- {
- get { return _isBusy; }
- set { Set(() => IsBusy, ref _isBusy, value); }
- }
- /// <summary>
- /// 是否显示撤单
- /// </summary>
- private bool _isCancelSaleCammand = false;
- public bool IsCancelSaleCammand
- {
- get
- {
- return _isCancelSaleCammand;
- }
- set
- {
- Set(() => IsCancelSaleCammand, ref _isCancelSaleCammand, value);
- }
- }
- #endregion
- #region 私有方法
- /// <summary>
- /// 查询
- /// </summary>
- public RelayCommand SelectCommand
- {
- get
- {
- return new RelayCommand(() =>
- {
- if (string.IsNullOrEmpty(GoodCode))
- {
- MessageBoxHelper.ShowInfo("请输入准确的商品代码!", Client_Resource.MessageBox_Error_Title);
- return;
- }
- IsBusy = true;
- Task.Factory.TryStartNew(() =>
- {
- SaleGoodsApplyList = _saleService.QuerySaleApplyRpt(UserManager.CurrentTradeAccount, GoodCode);
- }, () =>
- {
- IsBusy = false;
- });
- });
- }
- }
- /// <summary>
- /// 重置
- /// </summary>
- public RelayCommand ResetCommand
- {
- get
- {
- return new RelayCommand(() =>
- {
- GoodCode = string.Empty;
- });
- }
- }
- #endregion
- }
- }
|