|
@ -7,6 +7,7 @@ using System; |
|
|
using System.Collections.Generic; |
|
|
using System.Collections.Generic; |
|
|
using System.Collections.ObjectModel; |
|
|
using System.Collections.ObjectModel; |
|
|
using System.Linq; |
|
|
using System.Linq; |
|
|
|
|
|
using System.Text; |
|
|
using System.Threading; |
|
|
using System.Threading; |
|
|
using System.Threading.Tasks; |
|
|
using System.Threading.Tasks; |
|
|
using System.Windows; |
|
|
using System.Windows; |
|
@ -33,10 +34,10 @@ namespace BBWY.Client.ViewModels |
|
|
private string city; |
|
|
private string city; |
|
|
private string county; |
|
|
private string county; |
|
|
private string town; |
|
|
private string town; |
|
|
private string prucahseRemark; |
|
|
private string purchaseRemark; |
|
|
private PurchaseOrderMode purchaseOrderMode = PurchaseOrderMode.批发; |
|
|
private PurchaseOrderMode purchaseOrderMode = PurchaseOrderMode.批发; |
|
|
|
|
|
|
|
|
private string tradeMode; |
|
|
//private string tradeMode;
|
|
|
private string extensions; |
|
|
private string extensions; |
|
|
|
|
|
|
|
|
public bool IsLoading { get => isLoading; set { Set(ref isLoading, value); } } |
|
|
public bool IsLoading { get => isLoading; set { Set(ref isLoading, value); } } |
|
@ -51,7 +52,7 @@ namespace BBWY.Client.ViewModels |
|
|
public string City { get => city; set { Set(ref city, value); } } |
|
|
public string City { get => city; set { Set(ref city, value); } } |
|
|
public string County { get => county; set { Set(ref county, value); } } |
|
|
public string County { get => county; set { Set(ref county, value); } } |
|
|
public string Town { get => town; set { Set(ref town, value); } } |
|
|
public string Town { get => town; set { Set(ref town, value); } } |
|
|
public string PrucahseRemark { get => prucahseRemark; set { Set(ref prucahseRemark, value); } } |
|
|
public string PurchaseRemark { get => purchaseRemark; set { Set(ref purchaseRemark, value); } } |
|
|
|
|
|
|
|
|
public PurchaseOrderMode PurchaseOrderMode |
|
|
public PurchaseOrderMode PurchaseOrderMode |
|
|
{ |
|
|
{ |
|
@ -145,14 +146,14 @@ namespace BBWY.Client.ViewModels |
|
|
if (!r.Success) |
|
|
if (!r.Success) |
|
|
{ |
|
|
{ |
|
|
ProductAmount = FreightAmount = TotalAmount = 0; |
|
|
ProductAmount = FreightAmount = TotalAmount = 0; |
|
|
tradeMode = string.Empty; |
|
|
//tradeMode = string.Empty;
|
|
|
App.Current.Dispatcher.Invoke(() => MessageBox.Show(r.Msg, "预览订单报价")); |
|
|
App.Current.Dispatcher.Invoke(() => MessageBox.Show(r.Msg, "预览订单报价")); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
ProductAmount = r.Data.ProductAmount; |
|
|
ProductAmount = r.Data.ProductAmount; |
|
|
FreightAmount = r.Data.FreightAmount; |
|
|
FreightAmount = r.Data.FreightAmount; |
|
|
TotalAmount = r.Data.TotalAmount; |
|
|
TotalAmount = r.Data.TotalAmount; |
|
|
tradeMode = r.Data.OrderTradeType?.Code; |
|
|
//tradeMode = r.Data.OrderTradeType?.Code;
|
|
|
extensions = r.Data.Extensions; |
|
|
extensions = r.Data.Extensions; |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
@ -183,46 +184,67 @@ namespace BBWY.Client.ViewModels |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//IsLoading = true;
|
|
|
IsLoading = true; |
|
|
//Task.Factory.StartNew(() => purchaseOrderService.FastCreateOrder(new Consignee()
|
|
|
|
|
|
//{
|
|
|
Task.Factory.StartNew(() => batchPurchaseService.CreateOrder(ProductSkuWithSchemeList, |
|
|
// Address = Address,
|
|
|
new Consignee() |
|
|
// City = City,
|
|
|
{ |
|
|
// ContactName = ContactName,
|
|
|
Address = Address, |
|
|
// County = County,
|
|
|
City = City, |
|
|
// Mobile = Mobile,
|
|
|
ContactName = ContactName, |
|
|
// Province = Province,
|
|
|
County = County, |
|
|
// TelePhone = Mobile,
|
|
|
Mobile = Mobile, |
|
|
// Town = Town
|
|
|
Province = Province, |
|
|
//}, PurchaseSchemeProductSkuList,
|
|
|
TelePhone = Mobile, |
|
|
// purchaseAccount.PurchasePlatformId,
|
|
|
Town = Town |
|
|
// purchaseAccount,
|
|
|
}, |
|
|
// PurchaseOrderMode,
|
|
|
this.PurchaseOrderMode, |
|
|
// tradeMode,
|
|
|
globalContext.User.Shop.PurchaseAccountList, |
|
|
// PrucahseRemark,
|
|
|
this.extensions, |
|
|
// order.Id,
|
|
|
this.PurchaseRemark)).ContinueWith(t => |
|
|
// globalContext.User.Shop.ShopId,
|
|
|
{ |
|
|
// purchaseAccount.Id,
|
|
|
IsLoading = false; |
|
|
// purchaseAccount.AccountName,
|
|
|
var response = t.Result; |
|
|
// purchaseSchemeList[0].PurchaserName,
|
|
|
if (!response.Success) |
|
|
// purchaser.Id,
|
|
|
{ |
|
|
// globalContext.User.Shop.PlatformCommissionRatio ?? 0.05M,
|
|
|
App.Current.Dispatcher.Invoke(() => MessageBox.Show(response.Msg, "创建采购单")); |
|
|
// extensions)).ContinueWith(t =>
|
|
|
return; |
|
|
// {
|
|
|
} |
|
|
// IsLoading = false;
|
|
|
|
|
|
// var r = t.Result;
|
|
|
if (response.Data.SuccessSkuIdList != null && response.Data.SuccessSkuIdList.Count() > 0) |
|
|
// if (!r.Success)
|
|
|
{ |
|
|
// {
|
|
|
//删除下单成功的订单
|
|
|
// App.Current.Dispatcher.Invoke(() => MessageBox.Show(r.Msg, "下单"));
|
|
|
App.Current.Dispatcher.Invoke(() => |
|
|
// return;
|
|
|
{ |
|
|
// }
|
|
|
for (var i = 0; i < ProductSkuWithSchemeList.Count(); i++) |
|
|
|
|
|
{ |
|
|
// //刷新订单列表
|
|
|
if (response.Data.SuccessSkuIdList.Contains(ProductSkuWithSchemeList[i].SkuId)) |
|
|
// orderListViewModel.RefreshOrder(order.Id);
|
|
|
{ |
|
|
|
|
|
ProductSkuWithSchemeList.Remove(ProductSkuWithSchemeList[i]); |
|
|
// //关闭当前窗口
|
|
|
i--; |
|
|
// GalaSoft.MvvmLight.Messaging.Messenger.Default.Send<object>(null, "OnlinePurchase_Close");
|
|
|
} |
|
|
// });
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (response.Data.FailSkuList != null && response.Data.FailSkuList.Count() > 0) |
|
|
|
|
|
{ |
|
|
|
|
|
var errorBuilder = new StringBuilder(); |
|
|
|
|
|
foreach (var error in response.Data.FailSkuList) |
|
|
|
|
|
{ |
|
|
|
|
|
errorBuilder.AppendLine($"SkuId {error.SkuId}"); |
|
|
|
|
|
errorBuilder.AppendLine($"错误信息 {error.ErrorMsg}"); |
|
|
|
|
|
errorBuilder.AppendLine(); |
|
|
|
|
|
} |
|
|
|
|
|
App.Current.Dispatcher.Invoke(() => MessageBox.Show(errorBuilder.ToString(), "创建采购单")); |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
//关闭窗口
|
|
|
|
|
|
App.Current.Dispatcher.Invoke(() => GalaSoft.MvvmLight.Messaging.Messenger.Default.Send(true, "BatchCreateNewPurchaseOrderClose")); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private void AddProductSku() |
|
|
private void AddProductSku() |
|
|