|
|
@ -5,19 +5,19 @@ using BBWY.Common.Extensions; |
|
|
|
using BBWY.Common.Models; |
|
|
|
using BBWY.Controls; |
|
|
|
using GalaSoft.MvvmLight.Command; |
|
|
|
using HandyControl.Controls; |
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Collections.ObjectModel; |
|
|
|
using System.Linq; |
|
|
|
using System.Threading.Tasks; |
|
|
|
using System.Windows; |
|
|
|
using System.Windows.Input; |
|
|
|
|
|
|
|
namespace BBWY.Client.ViewModels |
|
|
|
{ |
|
|
|
public class BatchPurchaseOrderListViewModel : BaseVM, IDenpendency |
|
|
|
{ |
|
|
|
private BatchPurchaseService batchPurchaseService; |
|
|
|
private BatchPurchaseService batchPurchaseService; |
|
|
|
private GlobalContext globalContext; |
|
|
|
private DateTime startDate; |
|
|
|
private DateTime endDate; |
|
|
@ -40,6 +40,9 @@ namespace BBWY.Client.ViewModels |
|
|
|
|
|
|
|
public ICommand OnPageIndexChangedCommand { get; set; } |
|
|
|
|
|
|
|
public ICommand PayPurchaseOrderCommand { get; set; } |
|
|
|
|
|
|
|
public ICommand CancelPurchaseOrderCommand { get; set; } |
|
|
|
|
|
|
|
public DateTime StartDate { get => startDate; set { Set(ref startDate, value); } } |
|
|
|
public DateTime EndDate { get => endDate; set { Set(ref endDate, value); } } |
|
|
@ -66,6 +69,9 @@ namespace BBWY.Client.ViewModels |
|
|
|
SearchPurchaseOrderCommand = new RelayCommand(InitQueryPurchaseOrder); |
|
|
|
OpenCreateNewPurchaseOrderDialogCommand = new RelayCommand(OpenCreateNewPurchaseOrderDialog); |
|
|
|
OnPageIndexChangedCommand = new RelayCommand<PageArgs>(OnPageIndexChanged); |
|
|
|
|
|
|
|
PayPurchaseOrderCommand = new RelayCommand<object>(PayPurchaseOrder); |
|
|
|
CancelPurchaseOrderCommand = new RelayCommand<object>(CancelPurchaseOrder); |
|
|
|
PageSize = 10; |
|
|
|
this.globalContext = globalContext; |
|
|
|
EndDate = DateTime.Now.Date; |
|
|
@ -74,6 +80,51 @@ namespace BBWY.Client.ViewModels |
|
|
|
InitQueryPurchaseOrder(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void CancelPurchaseOrder(object obj) |
|
|
|
{ |
|
|
|
MessageBoxResult result = MessageBox.Show("确定取消订单?", "提示", |
|
|
|
MessageBoxButton.YesNo, |
|
|
|
MessageBoxImage.Warning); |
|
|
|
if (result != MessageBoxResult.Yes) return; |
|
|
|
//;
|
|
|
|
var parameters = (object[])obj ; |
|
|
|
|
|
|
|
var PurchasePlatform = (Platform)parameters[0] ;//采购平台
|
|
|
|
|
|
|
|
|
|
|
|
var purchaseAccount = globalContext.User.Shop.PurchaseAccountList.FirstOrDefault(p => p.PurchasePlatformId == PurchasePlatform); |
|
|
|
|
|
|
|
var res = batchPurchaseService.CancelOrder(parameters[1].ToString(), PurchasePlatform, purchaseAccount, ""); |
|
|
|
if (res.Success) |
|
|
|
{ |
|
|
|
Task.Factory.StartNew(() => QueryPurchaseOrder(PageIndex)); |
|
|
|
return; |
|
|
|
} |
|
|
|
MessageBox.Show(res.Data.Msg); |
|
|
|
} |
|
|
|
|
|
|
|
private void PayPurchaseOrder(object obj) |
|
|
|
{ |
|
|
|
|
|
|
|
MessageBoxResult result = MessageBox.Show("确定支付订单?", "提示", |
|
|
|
MessageBoxButton.YesNo, |
|
|
|
MessageBoxImage.Warning); |
|
|
|
if (result != MessageBoxResult.Yes) return; |
|
|
|
|
|
|
|
var parameters = (object[])obj; |
|
|
|
var PurchasePlatform = (Platform)parameters[0];//采购平台
|
|
|
|
var purchaseAccount = globalContext.User.Shop.PurchaseAccountList.FirstOrDefault(p => p.PurchasePlatformId == PurchasePlatform); |
|
|
|
var res = batchPurchaseService.PayOrder(parameters[1].ToString(), PurchasePlatform, purchaseAccount); |
|
|
|
if (res.Success) |
|
|
|
{ |
|
|
|
Task.Factory.StartNew(() => QueryPurchaseOrder(PageIndex)); |
|
|
|
return; |
|
|
|
} |
|
|
|
MessageBox.Show(res.Data.Msg); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
private void InitQueryPurchaseOrder() |
|
|
|
{ |
|
|
|