64 changed files with 15266 additions and 1630 deletions
@ -0,0 +1,139 @@ |
|||
using BBWY.Client.Models; |
|||
using BBWY.Common.Http; |
|||
using BBWY.Common.Models; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Net.Http; |
|||
|
|||
namespace BBWY.Client.APIServices |
|||
{ |
|||
public class BatchPurchaseService : BaseApiService, IDenpendency |
|||
{ |
|||
public BatchPurchaseService(RestApiService restApiService, GlobalContext globalContext) : base(restApiService, globalContext) |
|||
{ |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 获取包含对应平台采购方案的sku列表
|
|||
/// </summary>
|
|||
/// <param name="sku"></param>
|
|||
/// <param name="spu"></param>
|
|||
/// <returns></returns>
|
|||
public ApiResponse<IList<ProductSkuWithSchemeResponse>> GetProductSkuAndSchemeList(string sku, string spu) |
|||
{ |
|||
return SendRequest<IList<ProductSkuWithSchemeResponse>>(globalContext.BBYWApiHost, "api/BatchPurchase/GetProductSkuAndSchemeList", new |
|||
{ |
|||
globalContext.User.Shop.Platform, |
|||
globalContext.User.Shop.AppKey, |
|||
globalContext.User.Shop.AppSecret, |
|||
globalContext.User.Shop.AppToken, |
|||
globalContext.User.Shop.ShopId, |
|||
sku, |
|||
spu |
|||
}, null, HttpMethod.Post); |
|||
} |
|||
|
|||
public ApiResponse<PreviewOrderResponse> PreviewOrder(IList<ProductSkuWithScheme> productSkuWithSchemeList, |
|||
Consignee consignee, |
|||
PurchaseOrderMode purchaseOrderMode, |
|||
IList<PurchaseAccount> purchaseAccountList) |
|||
{ |
|||
var productParamList = new List<object>(); |
|||
foreach (var productSkuWithScheme in productSkuWithSchemeList) |
|||
{ |
|||
foreach (var purchaseSchemeProductSku in productSkuWithScheme.PurchaseSchemeProductSkuList) |
|||
{ |
|||
productParamList.Add(new |
|||
{ |
|||
purchaseSchemeProductSku.PurchaseProductId, |
|||
purchaseSchemeProductSku.PurchaseSkuId, |
|||
PurchaseSpecId = purchaseSchemeProductSku.PurchaseSkuSpecId, |
|||
Quantity = purchaseSchemeProductSku.ItemTotal, |
|||
productSkuWithScheme.PurchaserId, |
|||
productSkuWithScheme.PurchaserName, |
|||
productSkuWithScheme.PurchasePlatform, |
|||
BelongSkuId = productSkuWithScheme.SkuId |
|||
}); |
|||
} |
|||
} |
|||
|
|||
return SendRequest<PreviewOrderResponse>(globalContext.BBYWApiHost, "api/BatchPurchase/PreviewOrder", new |
|||
{ |
|||
consignee, |
|||
purchaseOrderMode, |
|||
purchaseAccountList, |
|||
productParamList |
|||
}, null, HttpMethod.Post); |
|||
} |
|||
|
|||
public ApiResponse<BatchCreareOrderResponse> CreateOrder(IList<ProductSkuWithScheme> productSkuWithSchemeList, |
|||
Consignee consignee, |
|||
PurchaseOrderMode purchaseOrderMode, |
|||
IList<PurchaseAccount> purchaseAccountList, |
|||
string extensions, |
|||
string remark) |
|||
{ |
|||
var productParamList = new List<object>(); |
|||
foreach (var productSkuWithScheme in productSkuWithSchemeList) |
|||
{ |
|||
foreach (var purchaseSchemeProductSku in productSkuWithScheme.PurchaseSchemeProductSkuList) |
|||
{ |
|||
productParamList.Add(new |
|||
{ |
|||
purchaseSchemeProductSku.PurchaseProductId, |
|||
purchaseSchemeProductSku.PurchaseSkuId, |
|||
PurchaseSpecId = purchaseSchemeProductSku.PurchaseSkuSpecId, |
|||
Quantity = purchaseSchemeProductSku.ItemTotal, |
|||
productSkuWithScheme.PurchaserId, |
|||
productSkuWithScheme.PurchaserName, |
|||
productSkuWithScheme.PurchasePlatform, |
|||
BelongSkuId = productSkuWithScheme.SkuId, |
|||
BelongProductId = productSkuWithScheme.ProductId, |
|||
BelongPrice = productSkuWithScheme.Price, |
|||
BelongSkuTitle = productSkuWithScheme.Title, |
|||
BelongLogo = productSkuWithScheme.Logo, |
|||
BelongQuantity = productSkuWithScheme.Quantity, |
|||
BelongPurchaseSchemeId = productSkuWithScheme.PurchaseSchemeId |
|||
}); |
|||
} |
|||
} |
|||
|
|||
return SendRequest<BatchCreareOrderResponse>(globalContext.BBYWApiHost, "api/BatchPurchase/BatchCreateOrder", new |
|||
{ |
|||
consignee, |
|||
purchaseOrderMode, |
|||
purchaseAccountList, |
|||
productParamList, |
|||
extensions, |
|||
remark, |
|||
globalContext.User.Shop.ShopId, |
|||
globalContext.User.Shop.ShopName |
|||
}, null, HttpMethod.Post); |
|||
} |
|||
|
|||
public ApiResponse<PurchaseOrderV2ListResponse> GetPurchaseOrderList(string spu, |
|||
string sku, |
|||
string purchaserName, |
|||
string purchaseOrderId, |
|||
int pageIndex, |
|||
int pageSize, |
|||
DateTime startDate, |
|||
DateTime endDate, |
|||
PurchaseOrderState? purchaseOrderState) |
|||
{ |
|||
return SendRequest<PurchaseOrderV2ListResponse>(globalContext.BBYWApiHost, "api/BatchPurchase/GetPurchaseOrderList", new |
|||
{ |
|||
sku, |
|||
spu, |
|||
purchaseOrderId, |
|||
globalContext.User.Shop.ShopId, |
|||
purchaserName, |
|||
purchaseOrderState, |
|||
pageIndex, |
|||
pageSize, |
|||
startDate, |
|||
endDate |
|||
}, null, HttpMethod.Post); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,21 @@ |
|||
using System.Collections.Generic; |
|||
|
|||
namespace BBWY.Client.Models |
|||
{ |
|||
public class BatchCreareOrderResponse |
|||
{ |
|||
/// <summary>
|
|||
/// 已经成功下单的SkuId集合
|
|||
/// </summary>
|
|||
public IList<string> SuccessSkuIdList { get; set; } |
|||
|
|||
public IList<BatchCreareOrderFailDetail> FailSkuList { get; set; } |
|||
} |
|||
|
|||
public class BatchCreareOrderFailDetail |
|||
{ |
|||
public string SkuId { get; set; } |
|||
|
|||
public string ErrorMsg { get; set; } |
|||
} |
|||
} |
@ -0,0 +1,40 @@ |
|||
using System; |
|||
|
|||
namespace BBWY.Client.Models |
|||
{ |
|||
/// <summary>
|
|||
/// 包含采购方案的Sku商品信息
|
|||
/// </summary>
|
|||
public class ProductSkuWithSchemeResponse |
|||
{ |
|||
public string Id { get; set; } |
|||
|
|||
public string ProductId { get; set; } |
|||
|
|||
public string SkuId { get; set; } |
|||
|
|||
public decimal Price { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// Sku标题
|
|||
/// </summary>
|
|||
public string Title { get; set; } |
|||
|
|||
public string Logo { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 京东Sku状态【1:上架 2:下架 4:删除】
|
|||
/// </summary>
|
|||
public int State { get; set; } |
|||
|
|||
public DateTime? CreateTime { get; set; } |
|||
|
|||
public long PurchaseSchemeId { get; set; } |
|||
|
|||
public string PurchaserId { get; set; } |
|||
|
|||
public string PurchaserName { get; set; } |
|||
|
|||
public Platform? PurchasePlatform { get; set; } |
|||
} |
|||
} |
@ -0,0 +1,99 @@ |
|||
using System; |
|||
|
|||
namespace BBWY.Client.Models |
|||
{ |
|||
public class PurchaseOrderSkuResponse |
|||
{ |
|||
public long Id { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 打包耗材费
|
|||
/// </summary>
|
|||
public decimal? ConsumableAmount { get; set; } = 0.00M; |
|||
|
|||
/// <summary>
|
|||
/// 创建时间
|
|||
/// </summary>
|
|||
public DateTime? CreateTime { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 头程运费
|
|||
/// </summary>
|
|||
public decimal? FirstFreight { get; set; } = 0.00M; |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 入仓费
|
|||
/// </summary>
|
|||
public decimal? InStorageAmount { get; set; } = 0.00M; |
|||
|
|||
/// <summary>
|
|||
/// Sku Logo
|
|||
/// </summary>
|
|||
|
|||
public string Logo { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 单价
|
|||
/// </summary>
|
|||
public decimal? Price { get; set; } = 0.00M; |
|||
|
|||
/// <summary>
|
|||
/// 采购货款
|
|||
/// </summary>
|
|||
public decimal? ProductAmount { get; set; } |
|||
|
|||
public string ProductId { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 采购金额(采购货款+采购运费)
|
|||
/// </summary>
|
|||
public decimal? PurchaseAmount { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 采购运费
|
|||
/// </summary>
|
|||
public decimal? PurchaseFreight { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 采购单Id
|
|||
/// </summary>
|
|||
public string PurchaseOrderId { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 采购方案Id
|
|||
/// </summary>
|
|||
|
|||
public long? PurchaseSchemeId { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 采购SkuId串
|
|||
/// </summary>
|
|||
public string PurchaseSkuIds { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 质检费
|
|||
/// </summary>
|
|||
public decimal? QualityInspectionAmount { get; set; } = 0.00M; |
|||
|
|||
/// <summary>
|
|||
/// 采购数量
|
|||
/// </summary>
|
|||
|
|||
public int? Quantity { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 店铺Id
|
|||
/// </summary>
|
|||
|
|||
public long? ShopId { get; set; } |
|||
|
|||
public string SkuId { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// Sku标题
|
|||
/// </summary>
|
|||
|
|||
public string SkuTitle { get; set; } |
|||
} |
|||
} |
@ -0,0 +1,11 @@ |
|||
using System.Collections.Generic; |
|||
|
|||
namespace BBWY.Client.Models |
|||
{ |
|||
public class PurchaseOrderV2ListResponse |
|||
{ |
|||
public long Count { get; set; } |
|||
|
|||
public IList<PurchaseOrderV2Response> ItemList { get; set; } |
|||
} |
|||
} |
@ -0,0 +1,177 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
|
|||
namespace BBWY.Client.Models |
|||
{ |
|||
public class PurchaseOrderV2Response |
|||
{ |
|||
/// <summary>
|
|||
/// 采购单号
|
|||
/// </summary>
|
|||
public string Id { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 完成时间
|
|||
/// </summary>
|
|||
public DateTime? CompletionTime { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 收货详细地址
|
|||
/// </summary>
|
|||
|
|||
public string ConsigneeAddress { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 收货市
|
|||
/// </summary>
|
|||
public string ConsigneeCity { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 收货联系人名称
|
|||
/// </summary>
|
|||
public string ConsigneeContactName { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 收货区
|
|||
/// </summary>
|
|||
public string ConsigneeCounty { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 收货联系人电话
|
|||
/// </summary>
|
|||
public string ConsigneeMobile { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 收货省
|
|||
/// </summary>
|
|||
public string ConsigneeProvince { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 收货镇
|
|||
/// </summary>
|
|||
public string ConsigneeTown { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 打包耗材费
|
|||
/// </summary>
|
|||
public decimal? ConsumableAmount { get; set; } = 0.00M; |
|||
|
|||
/// <summary>
|
|||
/// 创建时间
|
|||
/// </summary>
|
|||
public DateTime? CreateTime { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 快递公司
|
|||
/// </summary>
|
|||
public string ExpressName { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 头程运费
|
|||
/// </summary>
|
|||
public decimal? FirstFreight { get; set; } = 0.00M; |
|||
|
|||
/// <summary>
|
|||
/// 入仓费
|
|||
/// </summary>
|
|||
public decimal? InStorageAmount { get; set; } = 0.00M; |
|||
|
|||
/// <summary>
|
|||
/// 是否转入库存
|
|||
/// </summary>
|
|||
|
|||
public bool? IsConvertToStock { get; set; } = false; |
|||
|
|||
/// <summary>
|
|||
/// 是否订阅快递100
|
|||
/// </summary>
|
|||
|
|||
public bool? IsSubscribeKuaiDi100 { get; set; } = false; |
|||
|
|||
/// <summary>
|
|||
/// 采购单状态(待付款=0,待发货=1,待收货=2,待质检=3,待打包=4,待结算=5,已完成=6)
|
|||
/// </summary>
|
|||
public PurchaseOrderState? OrderState { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 支付时间
|
|||
/// </summary>
|
|||
public DateTime? PayTime { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 采购货款
|
|||
/// </summary>
|
|||
public decimal? ProductAmount { get; set; } = 0.00M; |
|||
|
|||
/// <summary>
|
|||
/// 采购账号Id
|
|||
/// </summary>
|
|||
|
|||
public long? PurchaseAccountId { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 采购金额(采购货款+采购运费)
|
|||
/// </summary>
|
|||
public decimal? PurchaseAmount { get; set; } = 0.00M; |
|||
|
|||
/// <summary>
|
|||
/// 采购运费
|
|||
/// </summary>
|
|||
public decimal? PurchaseFreight { get; set; } = 0.00M; |
|||
|
|||
/// <summary>
|
|||
/// 采购平台
|
|||
/// </summary>
|
|||
public Platform? PurchasePlatform { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 商家Id
|
|||
/// </summary>
|
|||
public string PurchaserId { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 商家名称
|
|||
/// </summary>
|
|||
public string PurchaserName { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 质检费
|
|||
/// </summary>
|
|||
public decimal? QualityInspectionAmount { get; set; } = 0.00M; |
|||
|
|||
/// <summary>
|
|||
/// 备注信息
|
|||
/// </summary>
|
|||
|
|||
public string Remark { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 店铺Id
|
|||
/// </summary>
|
|||
|
|||
public long ShopId { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 签收时间
|
|||
/// </summary>
|
|||
public DateTime? SignTime { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 快递单号
|
|||
/// </summary>
|
|||
public string WaybillNo { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 采购方式(线上=0, 线下=1)
|
|||
/// </summary>
|
|||
public PurchaseMethod PurchaseMethod { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 采购单模式 批发 = 0,代发 = 1
|
|||
/// </summary>
|
|||
public PurchaseOrderMode PurchaseOrderMode { get; set; } |
|||
|
|||
|
|||
public IList<PurchaseOrderSkuResponse> ItemList { get; set; } |
|||
} |
|||
} |
@ -0,0 +1,68 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Collections.ObjectModel; |
|||
|
|||
namespace BBWY.Client.Models |
|||
{ |
|||
public class ProductSkuWithScheme : NotifyObject |
|||
{ |
|||
private int quantity; |
|||
private bool isSelected; |
|||
public string Id { get; set; } |
|||
|
|||
public string SkuId { get; set; } |
|||
|
|||
public string ProductId { get; set; } |
|||
|
|||
public decimal Price { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// Sku标题
|
|||
/// </summary>
|
|||
public string Title { get; set; } |
|||
|
|||
public string Logo { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 京东Sku状态【1:上架 2:下架 4:删除】
|
|||
/// </summary>
|
|||
public int State { get; set; } |
|||
|
|||
public DateTime? CreateTime { get; set; } |
|||
|
|||
public long PurchaseSchemeId { get; set; } |
|||
|
|||
public string PurchaserId { get; set; } |
|||
|
|||
public string PurchaserName { get; set; } |
|||
|
|||
public Platform? PurchasePlatform { get; set; } |
|||
|
|||
public int Quantity { get => quantity; set { if (Set(ref quantity, value)) OnQuantityChanged(); } } |
|||
|
|||
public IList<PurchaseSchemeProductSku> PurchaseSchemeProductSkuList { get; set; } |
|||
|
|||
public bool IsSelected |
|||
{ |
|||
get => isSelected; set { if (Set(ref isSelected, value)) OnSelectChanged(); } |
|||
} |
|||
|
|||
public ProductSkuWithScheme() |
|||
{ |
|||
PurchaseSchemeProductSkuList = new ObservableCollection<PurchaseSchemeProductSku>(); |
|||
} |
|||
|
|||
private void OnSelectChanged() |
|||
{ |
|||
if (IsSelected && Quantity <= 0) |
|||
Quantity = 1; |
|||
else if (!IsSelected) |
|||
Quantity = 0; |
|||
} |
|||
|
|||
private void OnQuantityChanged() |
|||
{ |
|||
IsSelected = Quantity > 0; |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,6 @@ |
|||
namespace BBWY.Client.Models |
|||
{ |
|||
public class PurchaseOrderSku : PurchaseOrderSkuResponse |
|||
{ |
|||
} |
|||
} |
@ -0,0 +1,10 @@ |
|||
using System.Collections.Generic; |
|||
|
|||
namespace BBWY.Client.Models |
|||
{ |
|||
public class PurchaseOrderV2 : PurchaseOrderV2Response |
|||
{ |
|||
|
|||
public new IList<PurchaseOrderSku> ItemList { get; set; } |
|||
} |
|||
} |
@ -0,0 +1,207 @@ |
|||
using BBWY.Client.APIServices; |
|||
using BBWY.Client.Models; |
|||
using GalaSoft.MvvmLight.Command; |
|||
using System.Collections.Generic; |
|||
using System.Collections.ObjectModel; |
|||
using System.Linq; |
|||
using System.Threading.Tasks; |
|||
using System.Windows; |
|||
using System.Windows.Input; |
|||
using BBWY.Common.Extensions; |
|||
|
|||
namespace BBWY.Client.ViewModels |
|||
{ |
|||
public class BatchPurchaseAddProductSkuViewModel : BaseVM |
|||
{ |
|||
private BatchPurchaseService batchPurchaseService; |
|||
private bool isLoading; |
|||
private string sku; |
|||
private string spu; |
|||
private Purchaser selectedPurchaser; |
|||
private Purchaser defaultPurchaser; |
|||
|
|||
private KVModel selectedPurchasePlatform; |
|||
private KVModel defaultPurchasePlatform; |
|||
|
|||
private bool allSelected; |
|||
|
|||
public ICommand SearchCommand { get; set; } |
|||
public ICommand FilterCommand { get; set; } |
|||
public ICommand SaveCommand { get; set; } |
|||
|
|||
public ICommand AddQuantityCommand { get; set; } |
|||
|
|||
public ICommand SubtractQuantityCommand { get; set; } |
|||
|
|||
public string Sku { get => sku; set { Set(ref sku, value); } } |
|||
public string Spu { get => spu; set { Set(ref spu, value); } } |
|||
|
|||
public IList<Purchaser> PurchaserList { get; set; } |
|||
public IList<KVModel> PurchasePlatformList { get; set; } |
|||
public Purchaser SelectedPurchaser |
|||
{ |
|||
get => selectedPurchaser; set { Set(ref selectedPurchaser, value); } |
|||
} |
|||
|
|||
public KVModel SelectedPurchasePlatform |
|||
{ |
|||
get => selectedPurchasePlatform; set { Set(ref selectedPurchasePlatform, value); } |
|||
} |
|||
|
|||
public IList<ProductSkuWithScheme> SourceList { get; set; } |
|||
public IList<ProductSkuWithScheme> FilterList { get; set; } |
|||
public bool IsLoading { get => isLoading; set { Set(ref isLoading, value); } } |
|||
|
|||
public bool AllSelected |
|||
{ |
|||
get => allSelected; set |
|||
{ |
|||
if (Set(ref allSelected, value)) |
|||
OnAllSelectedChanged(); |
|||
} |
|||
} |
|||
|
|||
public BatchPurchaseAddProductSkuViewModel(BatchPurchaseService batchPurchaseService) |
|||
{ |
|||
this.batchPurchaseService = batchPurchaseService; |
|||
defaultPurchaser = new Purchaser() { Id = "-1", Name = "全部" }; |
|||
defaultPurchasePlatform = new KVModel() { Key = "-1", Value = "全部" }; |
|||
|
|||
PurchaserList = new ObservableCollection<Purchaser>() { defaultPurchaser }; |
|||
PurchasePlatformList = new ObservableCollection<KVModel>() |
|||
{ |
|||
defaultPurchasePlatform, |
|||
new KVModel(){ Key=((int)Platform.拳探).ToString(),Value = Platform.拳探.ToString() }, |
|||
new KVModel(){ Key=((int)Platform.阿里巴巴).ToString(),Value = Platform.阿里巴巴.ToString() } |
|||
}; |
|||
|
|||
SourceList = new List<ProductSkuWithScheme>(); |
|||
FilterList = new ObservableCollection<ProductSkuWithScheme>(); |
|||
SearchCommand = new RelayCommand(Search); |
|||
FilterCommand = new RelayCommand(Filter); |
|||
SaveCommand = new RelayCommand(Save); |
|||
AddQuantityCommand = new RelayCommand<ProductSkuWithScheme>(AddQuantity); |
|||
SubtractQuantityCommand = new RelayCommand<ProductSkuWithScheme>(SubtractQuantity); |
|||
SelectedPurchaser = PurchaserList[0]; |
|||
SelectedPurchasePlatform = PurchasePlatformList[0]; |
|||
} |
|||
|
|||
private void Search() |
|||
{ |
|||
IsLoading = true; |
|||
Task.Factory.StartNew(() => batchPurchaseService.GetProductSkuAndSchemeList(Sku, Spu)).ContinueWith(t => |
|||
{ |
|||
IsLoading = false; |
|||
var response = t.Result; |
|||
if (!response.Success) |
|||
{ |
|||
App.Current.Dispatcher.Invoke(() => MessageBox.Show(response.Msg, "提示")); |
|||
return; |
|||
} |
|||
SourceList.Clear(); |
|||
|
|||
App.Current.Dispatcher.Invoke(() => |
|||
{ |
|||
PurchaserList.Clear(); |
|||
FilterList.Clear(); |
|||
|
|||
PurchaserList.Add(defaultPurchaser); |
|||
SelectedPurchaser = PurchaserList[0]; |
|||
SelectedPurchasePlatform = PurchasePlatformList[0]; |
|||
}); |
|||
|
|||
if (response.Data == null || response.Data.Count() == 0) |
|||
return; |
|||
var list = response.Data.Map<IList<ProductSkuWithScheme>>(); |
|||
|
|||
#region 提取采购商
|
|||
var purchaserList = list.Where(item => item.PurchaseSchemeId != 0) |
|||
.Select(item => new Purchaser() { Id = item.PurchaserId, Name = item.PurchaserName, Platform = item.PurchasePlatform.Value }) |
|||
.Distinct(new PurchaserComparer()); |
|||
#endregion
|
|||
|
|||
App.Current.Dispatcher.Invoke(() => |
|||
{ |
|||
foreach (var purchaser in purchaserList) |
|||
PurchaserList.Add(purchaser); |
|||
foreach (var item in list) |
|||
{ |
|||
SourceList.Add(item); |
|||
} |
|||
Filter(); |
|||
}); |
|||
}); |
|||
} |
|||
|
|||
private void Filter() |
|||
{ |
|||
FilterList.Clear(); |
|||
if (SourceList.Count() == 0) |
|||
return; |
|||
var resultList = new List<ProductSkuWithScheme>(); |
|||
resultList.AddRange(SourceList); |
|||
|
|||
if (SelectedPurchaser.Id != "-1") |
|||
{ |
|||
for (var i = 0; i < resultList.Count(); i++) |
|||
{ |
|||
if (resultList[i].PurchaserId != SelectedPurchaser.Id) |
|||
{ |
|||
resultList.Remove(resultList[i]); |
|||
i--; |
|||
} |
|||
} |
|||
} |
|||
|
|||
if (SelectedPurchasePlatform.Key != "-1") |
|||
{ |
|||
for (var i = 0; i < resultList.Count(); i++) |
|||
{ |
|||
if (resultList[i].PurchasePlatform != (Platform)int.Parse(SelectedPurchasePlatform.Key)) |
|||
{ |
|||
resultList.Remove(resultList[i]); |
|||
i--; |
|||
} |
|||
} |
|||
} |
|||
|
|||
if (resultList.Count() > 0) |
|||
{ |
|||
foreach (var item in resultList) |
|||
FilterList.Add(item); |
|||
} |
|||
} |
|||
|
|||
private void Save() |
|||
{ |
|||
var selectedList = FilterList.Where(item => item.IsSelected).ToList(); |
|||
if (selectedList == null || selectedList.Count() == 0) |
|||
{ |
|||
MessageBox.Show("至少选择一个商品"); |
|||
return; |
|||
} |
|||
GalaSoft.MvvmLight.Messaging.Messenger.Default.Send(selectedList, "BatchPurchaseAddProductSkuSave"); |
|||
} |
|||
|
|||
private void OnAllSelectedChanged() |
|||
{ |
|||
foreach (var item in FilterList) |
|||
{ |
|||
if (item.PurchaseSchemeId == 0) |
|||
continue; |
|||
item.IsSelected = AllSelected; |
|||
} |
|||
} |
|||
|
|||
private void AddQuantity(ProductSkuWithScheme item) |
|||
{ |
|||
item.Quantity++; |
|||
} |
|||
|
|||
private void SubtractQuantity(ProductSkuWithScheme item) |
|||
{ |
|||
if (item.Quantity > 0) |
|||
item.Quantity--; |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,369 @@ |
|||
using BBWY.Client.APIServices; |
|||
using BBWY.Client.Models; |
|||
using BBWY.Client.Views.BatchPurchase; |
|||
using BBWY.Common.Trigger; |
|||
using GalaSoft.MvvmLight.Command; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Collections.ObjectModel; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading; |
|||
using System.Threading.Tasks; |
|||
using System.Windows; |
|||
using System.Windows.Input; |
|||
|
|||
namespace BBWY.Client.ViewModels |
|||
{ |
|||
public class BatchPurchaseCreateNewOrderViewModel : BaseVM |
|||
{ |
|||
private GlobalContext globalContext; |
|||
private PurchaseProductAPIService purchaseProductAPIService; |
|||
private PurchaseService purchaseService; |
|||
private BatchPurchaseService batchPurchaseService; |
|||
private DelayTrigger delayTrigger; |
|||
|
|||
private bool isLoading; |
|||
private decimal productAmount; |
|||
private decimal freightAmount; |
|||
private decimal totalAmount; |
|||
private string contactName; |
|||
private string address; |
|||
private string mobile; |
|||
private string province; |
|||
private string city; |
|||
private string county; |
|||
private string town; |
|||
private string purchaseRemark; |
|||
private PurchaseOrderMode purchaseOrderMode = PurchaseOrderMode.批发; |
|||
|
|||
//private string tradeMode;
|
|||
private string extensions; |
|||
|
|||
public bool IsLoading { get => isLoading; set { Set(ref isLoading, value); } } |
|||
|
|||
public decimal ProductAmount { get => productAmount; set { Set(ref productAmount, value); } } |
|||
public decimal FreightAmount { get => freightAmount; set { Set(ref freightAmount, value); } } |
|||
public decimal TotalAmount { get => totalAmount; set { Set(ref totalAmount, value); } } |
|||
public string ContactName { get => contactName; set { Set(ref contactName, value); } } |
|||
public string Address { get => address; set { Set(ref address, value); } } |
|||
public string Mobile { get => mobile; set { Set(ref mobile, value); } } |
|||
public string Province { get => province; set { Set(ref province, value); } } |
|||
public string City { get => city; set { Set(ref city, value); } } |
|||
public string County { get => county; set { Set(ref county, value); } } |
|||
public string Town { get => town; set { Set(ref town, value); } } |
|||
public string PurchaseRemark { get => purchaseRemark; set { Set(ref purchaseRemark, value); } } |
|||
|
|||
public PurchaseOrderMode PurchaseOrderMode |
|||
{ |
|||
get => purchaseOrderMode; set |
|||
{ |
|||
if (Set(ref purchaseOrderMode, value)) |
|||
OnDelayTriggerExecute(Guid.NewGuid().ToString()); |
|||
} |
|||
} |
|||
public IList<ProductSkuWithScheme> ProductSkuWithSchemeList { get; set; } |
|||
|
|||
|
|||
public ICommand FastCreateOrderCommand { get; set; } |
|||
public ICommand PreviewOrderCommand { get; set; } |
|||
public ICommand AddProductSkuCommand { get; set; } |
|||
public ICommand DeleteProductSkuWithSchemeCommand { get; set; } |
|||
|
|||
public ICommand EditQuantityRatioCommand { get; set; } |
|||
|
|||
public ICommand AddQuantityCommand { get; set; } |
|||
|
|||
public ICommand SubtractQuantityCommand { get; set; } |
|||
|
|||
public BatchPurchaseCreateNewOrderViewModel(PurchaseProductAPIService purchaseProductAPIService, |
|||
PurchaseService purchaseService, |
|||
GlobalContext globalContext, |
|||
BatchPurchaseService batchPurchaseService) |
|||
{ |
|||
this.globalContext = globalContext; |
|||
this.purchaseProductAPIService = purchaseProductAPIService; |
|||
this.purchaseService = purchaseService; |
|||
this.batchPurchaseService = batchPurchaseService; |
|||
ProductSkuWithSchemeList = new ObservableCollection<ProductSkuWithScheme>(); |
|||
|
|||
FastCreateOrderCommand = new RelayCommand(FastCreateOrder); |
|||
PreviewOrderCommand = new RelayCommand(PreviewOrder); |
|||
AddProductSkuCommand = new RelayCommand(AddProductSku); |
|||
DeleteProductSkuWithSchemeCommand = new RelayCommand<ProductSkuWithScheme>(DeleteProductSkuWithScheme); |
|||
EditQuantityRatioCommand = new RelayCommand<object>(EditQuantityRatio); |
|||
AddQuantityCommand = new RelayCommand<PurchaseSchemeProductSku>(AddQuantity); |
|||
SubtractQuantityCommand = new RelayCommand<PurchaseSchemeProductSku>(SubtractQuantity); |
|||
this.delayTrigger = new DelayTrigger(); |
|||
this.delayTrigger.OnExecute = OnDelayTriggerExecute; |
|||
} |
|||
|
|||
private void OnDelayTriggerExecute(string key) |
|||
{ |
|||
if (string.IsNullOrEmpty(key)) |
|||
{ |
|||
IsLoading = false; |
|||
return; |
|||
} |
|||
|
|||
if (ProductSkuWithSchemeList.Count() == 0) |
|||
{ |
|||
ProductAmount = 0; |
|||
FreightAmount = 0; |
|||
TotalAmount = 0; |
|||
IsLoading = false; |
|||
return; |
|||
} |
|||
|
|||
if (string.IsNullOrEmpty(ContactName) || |
|||
string.IsNullOrEmpty(Address) || |
|||
string.IsNullOrEmpty(Mobile) || |
|||
string.IsNullOrEmpty(Province) || |
|||
string.IsNullOrEmpty(City) || |
|||
string.IsNullOrEmpty(County)) |
|||
{ |
|||
IsLoading = false; |
|||
MessageBox.Show("缺少完整的收货信息", "提示"); |
|||
return; |
|||
} |
|||
|
|||
IsLoading = true; |
|||
Task.Factory.StartNew(() => batchPurchaseService.PreviewOrder(ProductSkuWithSchemeList, new Consignee() |
|||
{ |
|||
Address = Address, |
|||
City = City, |
|||
ContactName = ContactName, |
|||
County = County, |
|||
Mobile = Mobile, |
|||
Province = Province, |
|||
TelePhone = Mobile, |
|||
Town = Town |
|||
}, this.PurchaseOrderMode, globalContext.User.Shop.PurchaseAccountList)) |
|||
.ContinueWith(t => |
|||
{ |
|||
IsLoading = false; |
|||
var r = t.Result; |
|||
if (!r.Success) |
|||
{ |
|||
ProductAmount = FreightAmount = TotalAmount = 0; |
|||
//tradeMode = string.Empty;
|
|||
App.Current.Dispatcher.Invoke(() => MessageBox.Show(r.Msg, "预览订单报价")); |
|||
return; |
|||
} |
|||
ProductAmount = r.Data.ProductAmount; |
|||
FreightAmount = r.Data.FreightAmount; |
|||
TotalAmount = r.Data.TotalAmount; |
|||
//tradeMode = r.Data.OrderTradeType?.Code;
|
|||
extensions = r.Data.Extensions; |
|||
}); |
|||
} |
|||
|
|||
private void PreviewOrder() |
|||
{ |
|||
OnDelayTriggerExecute(Guid.NewGuid().ToString()); |
|||
} |
|||
|
|||
private void FastCreateOrder() |
|||
{ |
|||
if (IsLoading) |
|||
return; |
|||
if (TotalAmount == 0) |
|||
{ |
|||
MessageBox.Show("总金额为0不能提交订单", "提示"); |
|||
return; |
|||
} |
|||
if (string.IsNullOrEmpty(Mobile) || |
|||
string.IsNullOrEmpty(Address) || |
|||
string.IsNullOrEmpty(City) || |
|||
string.IsNullOrEmpty(Province) || |
|||
string.IsNullOrEmpty(County) || |
|||
string.IsNullOrEmpty(Town) || |
|||
string.IsNullOrEmpty(ContactName)) |
|||
{ |
|||
MessageBox.Show("收货人信息不全", "下单"); |
|||
return; |
|||
} |
|||
|
|||
IsLoading = true; |
|||
|
|||
Task.Factory.StartNew(() => batchPurchaseService.CreateOrder(ProductSkuWithSchemeList, |
|||
new Consignee() |
|||
{ |
|||
Address = Address, |
|||
City = City, |
|||
ContactName = ContactName, |
|||
County = County, |
|||
Mobile = Mobile, |
|||
Province = Province, |
|||
TelePhone = Mobile, |
|||
Town = Town |
|||
}, |
|||
this.PurchaseOrderMode, |
|||
globalContext.User.Shop.PurchaseAccountList, |
|||
this.extensions, |
|||
this.PurchaseRemark)).ContinueWith(t => |
|||
{ |
|||
IsLoading = false; |
|||
var response = t.Result; |
|||
if (!response.Success) |
|||
{ |
|||
App.Current.Dispatcher.Invoke(() => MessageBox.Show(response.Msg, "创建采购单")); |
|||
return; |
|||
} |
|||
|
|||
if (response.Data.SuccessSkuIdList != null && response.Data.SuccessSkuIdList.Count() > 0) |
|||
{ |
|||
//删除下单成功的订单
|
|||
App.Current.Dispatcher.Invoke(() => |
|||
{ |
|||
for (var i = 0; i < ProductSkuWithSchemeList.Count(); i++) |
|||
{ |
|||
if (response.Data.SuccessSkuIdList.Contains(ProductSkuWithSchemeList[i].SkuId)) |
|||
{ |
|||
ProductSkuWithSchemeList.Remove(ProductSkuWithSchemeList[i]); |
|||
i--; |
|||
} |
|||
} |
|||
}); |
|||
} |
|||
|
|||
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() |
|||
{ |
|||
var addProductSkuWindow = new BatchPurchaseAddProductSku(); |
|||
if (addProductSkuWindow.ShowDialog() != true) |
|||
return; |
|||
|
|||
var newProductSkuWithSchemeList = addProductSkuWindow.SelectedProductSkuWithSchemeList; |
|||
var waitList = new List<EventWaitHandle>(); |
|||
foreach (var newProductSkuWithScheme in newProductSkuWithSchemeList) |
|||
{ |
|||
if (ProductSkuWithSchemeList.Any(item => item.SkuId == newProductSkuWithScheme.SkuId)) |
|||
continue; |
|||
ProductSkuWithSchemeList.Add(newProductSkuWithScheme); |
|||
var ewh = new ManualResetEvent(false); |
|||
waitList.Add(ewh); |
|||
Task.Factory.StartNew(() => LoadPurchaseScheme(newProductSkuWithScheme, ewh)); |
|||
} |
|||
if (waitList.Count() == 0) |
|||
return; |
|||
IsLoading = true; |
|||
Task.Factory.StartNew(() => |
|||
{ |
|||
WaitHandle.WaitAll(waitList.ToArray()); |
|||
PreviewOrder(); //预览订单
|
|||
}); |
|||
} |
|||
|
|||
private void LoadPurchaseScheme(ProductSkuWithScheme productSkuWithScheme, EventWaitHandle ewh) |
|||
{ |
|||
try |
|||
{ |
|||
#region 加载采购方案
|
|||
var purchaseSchemeResponse = purchaseService.GetPurchaseSchemeList(shopId: globalContext.User.Shop.ShopId, schemeId: productSkuWithScheme.PurchaseSchemeId); |
|||
if (!purchaseSchemeResponse.Success) |
|||
{ |
|||
App.Current.Dispatcher.Invoke(() => MessageBox.Show($"方案Id{productSkuWithScheme.PurchaseSchemeId}\r\n{purchaseSchemeResponse.Msg}", "加载采购方案失败")); |
|||
return; |
|||
} |
|||
|
|||
var purchaseScheme = purchaseSchemeResponse.Data[0]; |
|||
#endregion
|
|||
|
|||
#region 完善采购方案基本信息
|
|||
foreach (var purchaseSchemeProduct in purchaseScheme.PurchaseSchemeProductList) |
|||
{ |
|||
var data = purchaseProductAPIService.GetProductInfo(productSkuWithScheme.PurchasePlatform.Value, |
|||
productSkuWithScheme.ProductId, |
|||
productSkuWithScheme.SkuId, |
|||
purchaseSchemeProduct.PurchaseProductId, |
|||
PurchaseOrderMode.批发, |
|||
PurchaseProductAPIMode.Spider); |
|||
|
|||
if (data != null && data.Value.purchaseSchemeProductSkus != null && data.Value.purchaseSchemeProductSkus.Count > 0) |
|||
{ |
|||
App.Current.Dispatcher.Invoke(() => |
|||
{ |
|||
foreach (var purchaseSchemeProductSku in data.Value.purchaseSchemeProductSkus) |
|||
{ |
|||
if (purchaseSchemeProduct.PurchaseSchemeProductSkuList.Any(s => s.PurchaseSkuId == purchaseSchemeProductSku.PurchaseSkuId)) |
|||
{ |
|||
productSkuWithScheme.PurchaseSchemeProductSkuList.Add(purchaseSchemeProductSku); |
|||
|
|||
purchaseSchemeProductSku.ItemTotal = productSkuWithScheme.Quantity; |
|||
purchaseSchemeProductSku.OnItemTotalChanged = OnItemTotalChanged; |
|||
} |
|||
} |
|||
}); |
|||
} |
|||
} |
|||
#endregion
|
|||
} |
|||
catch |
|||
{ |
|||
|
|||
} |
|||
finally |
|||
{ |
|||
ewh.Set(); |
|||
} |
|||
} |
|||
|
|||
private void OnItemTotalChanged(int itemTotal) |
|||
{ |
|||
Console.WriteLine($"OnItemTotalChanged {DateTime.Now} {itemTotal}"); |
|||
this.delayTrigger.SetKey(Guid.NewGuid().ToString()); |
|||
} |
|||
|
|||
private void DeleteProductSkuWithScheme(ProductSkuWithScheme productSkuWithScheme) |
|||
{ |
|||
ProductSkuWithSchemeList.Remove(productSkuWithScheme); |
|||
this.delayTrigger.SetKey(Guid.NewGuid().ToString()); |
|||
} |
|||
|
|||
private void EditQuantityRatio(object param) |
|||
{ |
|||
var paramList = (object[])param; |
|||
var skuQuantity = Convert.ToInt32(paramList[0]); |
|||
var purchaseSchemeProductSku = paramList[1] as PurchaseSchemeProductSku; |
|||
|
|||
var editWindow = new EditQuantityRatioWindow(purchaseSchemeProductSku.QuantityRatio); |
|||
if (editWindow.ShowDialog() == true) |
|||
{ |
|||
var quantityRatio = editWindow.QuantityRatio; |
|||
purchaseSchemeProductSku.QuantityRatio = quantityRatio; |
|||
purchaseSchemeProductSku.ItemTotal = quantityRatio * skuQuantity; |
|||
} |
|||
} |
|||
|
|||
private void AddQuantity(PurchaseSchemeProductSku purchaseSchemeProductSku) |
|||
{ |
|||
purchaseSchemeProductSku.ItemTotal++; |
|||
} |
|||
|
|||
private void SubtractQuantity(PurchaseSchemeProductSku purchaseSchemeProductSku) |
|||
{ |
|||
if (purchaseSchemeProductSku.ItemTotal > 1) |
|||
purchaseSchemeProductSku.ItemTotal--; |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,145 @@ |
|||
using BBWY.Client.APIServices; |
|||
using BBWY.Client.Models; |
|||
using BBWY.Client.Views.BatchPurchase; |
|||
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.Input; |
|||
|
|||
namespace BBWY.Client.ViewModels |
|||
{ |
|||
public class BatchPurchaseOrderListViewModel : BaseVM, IDenpendency |
|||
{ |
|||
private BatchPurchaseService batchPurchaseService; |
|||
private GlobalContext globalContext; |
|||
private DateTime startDate; |
|||
private DateTime endDate; |
|||
private string searchPurchaseOrderId; |
|||
private string searchPurchaseName; |
|||
private string searchProductId; |
|||
private string searchSkuId; |
|||
private PurchaseOrderState? purchaseOrderState; |
|||
private int pageIndex; |
|||
private int pageSize; |
|||
private bool isLoading; |
|||
private long totalCount; |
|||
|
|||
public ICommand SearchPurchaseOrderCommand { get; set; } |
|||
public ICommand OpenCreateNewPurchaseOrderDialogCommand { get; set; } |
|||
|
|||
public ICommand SetSearchDateCommand { get; set; } |
|||
|
|||
public ICommand SetPurchaseOrderStateCommand { get; set; } |
|||
|
|||
public ICommand OnPageIndexChangedCommand { get; set; } |
|||
|
|||
|
|||
public DateTime StartDate { get => startDate; set { Set(ref startDate, value); } } |
|||
public DateTime EndDate { get => endDate; set { Set(ref endDate, value); } } |
|||
public string SearchPurchaseOrderId { get => searchPurchaseOrderId; set { Set(ref searchPurchaseOrderId, value); } } |
|||
public string SearchPurchaseName { get => searchPurchaseName; set { Set(ref searchPurchaseName, value); } } |
|||
public string SearchProductId { get => searchProductId; set { Set(ref searchProductId, value); } } |
|||
public string SearchSkuId { get => searchSkuId; set { Set(ref searchSkuId, value); } } |
|||
public PurchaseOrderState? PurchaseOrderState { get => purchaseOrderState; set { Set(ref purchaseOrderState, value); } } |
|||
public int PageIndex { get => pageIndex; set { Set(ref pageIndex, value); } } |
|||
|
|||
public int PageSize { get => pageSize; set { Set(ref pageSize, value); } } |
|||
|
|||
public bool IsLoading { get => isLoading; set { Set(ref isLoading, value); } } |
|||
|
|||
public long TotalCount { get => totalCount; set { Set(ref totalCount, value); } } |
|||
|
|||
public IList<PurchaseOrderV2> PurchaseOrderList { get; set; } |
|||
|
|||
public BatchPurchaseOrderListViewModel(GlobalContext globalContext, BatchPurchaseService batchPurchaseService) |
|||
{ |
|||
this.batchPurchaseService = batchPurchaseService; |
|||
SetSearchDateCommand = new RelayCommand<int>(SetSearchDate); |
|||
SetPurchaseOrderStateCommand = new RelayCommand<PurchaseOrderState?>(SetPurchaseOrderState); |
|||
SearchPurchaseOrderCommand = new RelayCommand(InitQueryPurchaseOrder); |
|||
OpenCreateNewPurchaseOrderDialogCommand = new RelayCommand(OpenCreateNewPurchaseOrderDialog); |
|||
OnPageIndexChangedCommand = new RelayCommand<PageArgs>(OnPageIndexChanged); |
|||
PageSize = 10; |
|||
this.globalContext = globalContext; |
|||
EndDate = DateTime.Now.Date; |
|||
StartDate = DateTime.Now.Date.AddDays(-15); |
|||
PurchaseOrderList = new ObservableCollection<PurchaseOrderV2>(); |
|||
InitQueryPurchaseOrder(); |
|||
} |
|||
|
|||
|
|||
private void InitQueryPurchaseOrder() |
|||
{ |
|||
PageIndex = 1; |
|||
Task.Factory.StartNew(() => QueryPurchaseOrder(PageIndex)); |
|||
} |
|||
|
|||
private void SetPurchaseOrderState(PurchaseOrderState? purchaseOrderState) |
|||
{ |
|||
this.PurchaseOrderState = purchaseOrderState; |
|||
InitQueryPurchaseOrder(); |
|||
} |
|||
|
|||
private void SetSearchDate(int d) |
|||
{ |
|||
EndDate = d == 1 ? DateTime.Now.Date.AddDays(-1) : DateTime.Now; |
|||
StartDate = DateTime.Now.Date.AddDays(d * -1); |
|||
InitQueryPurchaseOrder(); |
|||
} |
|||
|
|||
private void QueryPurchaseOrder(int pageIndex) |
|||
{ |
|||
IsLoading = true; |
|||
var response = batchPurchaseService.GetPurchaseOrderList(SearchProductId, |
|||
SearchSkuId, |
|||
SearchPurchaseName, |
|||
SearchPurchaseOrderId, |
|||
pageIndex, |
|||
PageSize, |
|||
StartDate, |
|||
EndDate, |
|||
this.PurchaseOrderState); |
|||
IsLoading = false; |
|||
if (!response.Success) |
|||
{ |
|||
App.Current.Dispatcher.Invoke(() => MessageBox.Show(response.Msg, "提示")); |
|||
return; |
|||
} |
|||
|
|||
TotalCount = response.Data.Count; |
|||
App.Current.Dispatcher.Invoke(() => PurchaseOrderList.Clear()); |
|||
|
|||
if (response.Data.ItemList == null || response.Data.ItemList.Count() == 0) |
|||
return; |
|||
|
|||
var list = response.Data.ItemList.Map<IList<PurchaseOrderV2>>(); |
|||
|
|||
App.Current.Dispatcher.Invoke(() => |
|||
{ |
|||
foreach (var p in list) |
|||
PurchaseOrderList.Add(p); |
|||
}); |
|||
} |
|||
|
|||
private void OpenCreateNewPurchaseOrderDialog() |
|||
{ |
|||
var createWindow = new BatchCreateNewPurchaseOrder(); |
|||
if (createWindow.ShowDialog() == true) |
|||
{ |
|||
InitQueryPurchaseOrder(); //刷新采购单页面
|
|||
} |
|||
} |
|||
|
|||
private void OnPageIndexChanged(PageArgs pageArgs) |
|||
{ |
|||
Task.Factory.StartNew(() => QueryPurchaseOrder(pageArgs.PageIndex)); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,346 @@ |
|||
<c:BWindow x:Class="BBWY.Client.Views.BatchPurchase.BatchCreateNewPurchaseOrder" |
|||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
|||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
|||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
|||
xmlns:local="clr-namespace:BBWY.Client.Views.BatchPurchase" |
|||
xmlns:ctr="clr-namespace:BBWY.Client.Converters" |
|||
mc:Ignorable="d" |
|||
xmlns:cmodel="clr-namespace:BBWY.Client.Models" |
|||
xmlns:c="clr-namespace:BBWY.Controls;assembly=BBWY.Controls" |
|||
xmlns:b="http://schemas.microsoft.com/xaml/behaviors" |
|||
Style="{StaticResource bwstyle}" |
|||
DataContext="{Binding BatchPurchaseCreateNewOrder,Source={StaticResource Locator}}" |
|||
Title="新建采购单" Height="768" Width="1024" |
|||
MinButtonVisibility="Collapsed" |
|||
MaxButtonVisibility="Collapsed"> |
|||
<c:BWindow.Resources> |
|||
<ctr:MultiParameterTransferConverter x:Key="mptConverter"/> |
|||
</c:BWindow.Resources> |
|||
<Grid> |
|||
<Grid.RowDefinitions> |
|||
<RowDefinition Height="30"/> |
|||
<RowDefinition/> |
|||
<RowDefinition Height="60"/> |
|||
<RowDefinition Height="100"/> |
|||
<RowDefinition Height="40"/> |
|||
</Grid.RowDefinitions> |
|||
<c:RoundWaitProgress Play="{Binding IsLoading}" Panel.ZIndex="999" Grid.RowSpan="5"/> |
|||
|
|||
<Border BorderThickness="0,0,0,1" BorderBrush="{StaticResource MainMenu.BorderBrush}" |
|||
Background="{StaticResource Border.Background}"> |
|||
<TextBlock Text="新建采购单" HorizontalAlignment="Center" VerticalAlignment="Center"/> |
|||
</Border> |
|||
<Grid Margin="5" Grid.Row="1"> |
|||
<Grid.RowDefinitions> |
|||
<RowDefinition Height="30"/> |
|||
<RowDefinition Height="*"/> |
|||
<RowDefinition Height="100"/> |
|||
<RowDefinition Height="auto"/> |
|||
</Grid.RowDefinitions> |
|||
|
|||
<Border Background="{StaticResource Border.Background}" |
|||
BorderThickness="1" |
|||
BorderBrush="{StaticResource Border.Brush}" |
|||
SnapsToDevicePixels="True" |
|||
UseLayoutRounding="True"> |
|||
<Grid> |
|||
<Grid.ColumnDefinitions> |
|||
<ColumnDefinition Width="300"/> |
|||
<ColumnDefinition Width="1*"/> |
|||
<ColumnDefinition Width="80"/> |
|||
<ColumnDefinition Width="90"/> |
|||
<ColumnDefinition Width="70"/> |
|||
<ColumnDefinition Width="60"/> |
|||
<ColumnDefinition Width="60"/> |
|||
</Grid.ColumnDefinitions> |
|||
<TextBlock Text="店铺商品信息" Style="{StaticResource middleTextBlock}"/> |
|||
<TextBlock Text="采购商品信息" Style="{StaticResource middleTextBlock}" Grid.Column="1"/> |
|||
|
|||
<StackPanel Grid.Column="2" VerticalAlignment="Center" HorizontalAlignment="Center" Orientation="Horizontal"> |
|||
<TextBlock Text="组合配置"/> |
|||
<Path Style="{StaticResource path_question}" |
|||
Width="14" Margin="5,0,0,0" Fill="{StaticResource Text.Pink}" ToolTipService.InitialShowDelay="0"> |
|||
<Path.ToolTip> |
|||
<ToolTip Style="{StaticResource OrderCouponToolipStyle}"> |
|||
<TextBlock Text="该数量为组合配置比例,非实际采购数量"/> |
|||
</ToolTip> |
|||
</Path.ToolTip> |
|||
</Path> |
|||
</StackPanel> |
|||
|
|||
<TextBlock Text="数量" Style="{StaticResource middleTextBlock}" Grid.Column="3"/> |
|||
<TextBlock Text="单价" Style="{StaticResource middleTextBlock}" Grid.Column="4"/> |
|||
<TextBlock Text="总额" Style="{StaticResource middleTextBlock}" Grid.Column="5"/> |
|||
<TextBlock Text="操作" Style="{StaticResource middleTextBlock}" Grid.Column="6"/> |
|||
|
|||
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}"/> |
|||
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="1"/> |
|||
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="2"/> |
|||
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="3"/> |
|||
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="4"/> |
|||
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="5"/> |
|||
</Grid> |
|||
</Border> |
|||
|
|||
<ListBox x:Name="listbox_ProductSkuWithSchemeList" Grid.Row="1" |
|||
ItemContainerStyle="{StaticResource NoBgListBoxItemStyle}" |
|||
BorderThickness="1,0,1,1" |
|||
BorderBrush="{StaticResource Border.Brush}" |
|||
ItemsSource="{Binding ProductSkuWithSchemeList}"> |
|||
<ListBox.ItemTemplate> |
|||
<DataTemplate> |
|||
<Grid Width="{Binding ActualWidth,ElementName=listbox_ProductSkuWithSchemeList}"> |
|||
<Grid.ColumnDefinitions> |
|||
<ColumnDefinition Width="300"/> |
|||
<ColumnDefinition Width="1*"/> |
|||
<ColumnDefinition Width="60"/> |
|||
</Grid.ColumnDefinitions> |
|||
<Grid> |
|||
<Grid.ColumnDefinitions> |
|||
<ColumnDefinition Width="90"/> |
|||
<ColumnDefinition/> |
|||
</Grid.ColumnDefinitions> |
|||
|
|||
<c:BAsyncImage UrlSource="{Binding Logo}" |
|||
Width="80" DecodePixelWidth="80" |
|||
VerticalAlignment="Top" Margin="0,5,0,0" |
|||
Cursor="Hand"/> |
|||
|
|||
<StackPanel Grid.Column="1" Orientation="Vertical" VerticalAlignment="Top" Margin="0,5,0,0"> |
|||
<StackPanel Orientation="Horizontal"> |
|||
<TextBlock Text="SKU:"/> |
|||
<c:BButton Content="{Binding SkuId}" Style="{StaticResource LinkButton}" |
|||
Command="{Binding DataContext.CopyTextCommand,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}" |
|||
CommandParameter="{Binding SkuId}" |
|||
Margin=" 5,0,0,0"/> |
|||
</StackPanel> |
|||
<TextBlock TextTrimming="CharacterEllipsis" |
|||
Margin="0,17,0,0"> |
|||
<Run Text="名称:"/> |
|||
<Run Text="{Binding Title}"/> |
|||
<TextBlock.ToolTip> |
|||
<ToolTip Style="{StaticResource OrderCouponToolipStyle}"> |
|||
<TextBlock Text="{Binding Title}"/> |
|||
</ToolTip> |
|||
</TextBlock.ToolTip> |
|||
</TextBlock> |
|||
<StackPanel Orientation="Horizontal" Margin="0,17,0,0"> |
|||
<TextBlock> |
|||
<Run Text="单价:"/> |
|||
<Run Text="{Binding Price}"/> |
|||
</TextBlock> |
|||
<TextBlock Margin="10,0,0,0"> |
|||
<Run Text="数量:"/> |
|||
<Run Text="{Binding Quantity}"/> |
|||
</TextBlock> |
|||
</StackPanel> |
|||
|
|||
</StackPanel> |
|||
</Grid> |
|||
|
|||
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}"/> |
|||
<Border Height="1" VerticalAlignment="Bottom" Background="{StaticResource Border.Brush}"/> |
|||
|
|||
<ListBox x:Name="listbox_PurchaseSchemeProductSkuList" Grid.Column="1" |
|||
ItemContainerStyle="{StaticResource NoBgListBoxItemStyle}" |
|||
Style="{StaticResource NoScrollViewListBoxStyle}" |
|||
ItemsSource="{Binding PurchaseSchemeProductSkuList}"> |
|||
<ListBox.ItemTemplate> |
|||
<DataTemplate> |
|||
<Grid Width="{Binding ActualWidth,ElementName=listbox_PurchaseSchemeProductSkuList}"> |
|||
<Grid.ColumnDefinitions> |
|||
<ColumnDefinition Width="1*"/> |
|||
<ColumnDefinition Width="80"/> |
|||
<ColumnDefinition Width="90"/> |
|||
<ColumnDefinition Width="70"/> |
|||
<ColumnDefinition Width="60"/> |
|||
</Grid.ColumnDefinitions> |
|||
|
|||
<Grid> |
|||
<Grid.ColumnDefinitions> |
|||
<ColumnDefinition Width="90"/> |
|||
<ColumnDefinition/> |
|||
</Grid.ColumnDefinitions> |
|||
|
|||
<c:BAsyncImage UrlSource="{Binding Logo}" |
|||
Width="80" DecodePixelWidth="80" |
|||
VerticalAlignment="Top" Margin="0,5,0,5" |
|||
Cursor="Hand"/> |
|||
|
|||
<StackPanel Grid.Column="1" Orientation="Vertical" VerticalAlignment="Top" Margin="0,5,0,0"> |
|||
<StackPanel Orientation="Horizontal"> |
|||
<TextBlock Text="SKU:"/> |
|||
<c:BButton Content="{Binding PurchaseSkuId}" Style="{StaticResource LinkButton}" |
|||
Command="{Binding DataContext.CopyTextCommand,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}" |
|||
CommandParameter="{Binding PurchaseSkuId}" |
|||
Margin=" 5,0,0,0"/> |
|||
</StackPanel> |
|||
<TextBlock TextTrimming="CharacterEllipsis" |
|||
Margin="0,17,0,0"> |
|||
<Run Text="名称:"/> |
|||
<Run Text="{Binding Title}"/> |
|||
<TextBlock.ToolTip> |
|||
<ToolTip Style="{StaticResource OrderCouponToolipStyle}"> |
|||
<TextBlock Text="{Binding Title}"/> |
|||
</ToolTip> |
|||
</TextBlock.ToolTip> |
|||
</TextBlock> |
|||
<StackPanel Orientation="Horizontal" Margin="0,17,0,0"> |
|||
<TextBlock> |
|||
<Run Text="采购平台:"/> |
|||
<Run Text="{Binding DataContext.PurchasePlatform,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type ListBox},AncestorLevel=1}}"/> |
|||
</TextBlock> |
|||
<TextBlock Margin="10,0,0,0"> |
|||
<TextBlock.ToolTip> |
|||
<ToolTip Style="{StaticResource OrderCouponToolipStyle}"> |
|||
<TextBlock Text="{Binding DataContext.PurchaserName,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type ListBox},AncestorLevel=1}}"/> |
|||
</ToolTip> |
|||
</TextBlock.ToolTip> |
|||
<Run Text="采购商:"/> |
|||
<Run Text="{Binding DataContext.PurchaserName,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type ListBox},AncestorLevel=1}}"/> |
|||
</TextBlock> |
|||
</StackPanel> |
|||
|
|||
</StackPanel> |
|||
</Grid> |
|||
|
|||
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Margin="0,0,2,0"/> |
|||
|
|||
<TextBlock Text="{Binding QuantityRatio}" Style="{StaticResource middleTextBlock}" Grid.Column="1" Margin="0,0,0,25"/> |
|||
<c:BButton Content="修改" Grid.Column="1" VerticalAlignment="Bottom" |
|||
Background="White" |
|||
Foreground="{StaticResource Text.Color}" |
|||
Command="{Binding DataContext.EditQuantityRatioCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type Window}}}"> |
|||
<c:BButton.CommandParameter> |
|||
<MultiBinding Converter="{StaticResource mptConverter}"> |
|||
<Binding Path="DataContext.Quantity" RelativeSource="{RelativeSource Mode=FindAncestor,AncestorType={x:Type ListBox},AncestorLevel=1}"/> |
|||
<Binding Path="."/> |
|||
</MultiBinding> |
|||
</c:BButton.CommandParameter> |
|||
</c:BButton> |
|||
<Border Grid.Column="1" Height="1" Background="{StaticResource Border.Brush}" VerticalAlignment="Bottom" Margin="-2,0,2,30"/> |
|||
|
|||
|
|||
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Margin="0,0,2,0" Grid.Column="1"/> |
|||
|
|||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Grid.Column="2" Margin="0,0,5,0"> |
|||
<c:BButton Content="-" Background="White" Foreground="Black" |
|||
BorderBrush="{StaticResource Border.Brush}" |
|||
BorderThickness="1" |
|||
Width="15" |
|||
Height="18" |
|||
Command="{Binding DataContext.SubtractQuantityCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type Window}}}" |
|||
CommandParameter="{Binding }"/> |
|||
<c:BTextBox Text="{Binding ItemTotal,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Margin="5,0" VerticalAlignment="Center" |
|||
Width="40" HorizontalContentAlignment="Center" Padding="0,0,3,0" |
|||
DisableBgColor="{StaticResource TextBox.Disable.BgColor}"/> |
|||
<c:BButton Content="+" Background="White" Foreground="Black" |
|||
BorderBrush="{StaticResource Border.Brush}" |
|||
BorderThickness="1" |
|||
Width="15" |
|||
Height="18" |
|||
Command="{Binding DataContext.AddQuantityCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type Window}}}" |
|||
CommandParameter="{Binding }"/> |
|||
</StackPanel> |
|||
|
|||
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Margin="0,0,2,0" Grid.Column="2"/> |
|||
|
|||
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Margin="0,0,2,0" Grid.Column="3"/> |
|||
<TextBlock Grid.Column="3" Text="{Binding Price}" Style="{StaticResource middleTextBlock}"/> |
|||
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Margin="0,0,2,0" Grid.Column="4"/> |
|||
<TextBlock Grid.Column="4" Text="{Binding SkuAmount}" Style="{StaticResource middleTextBlock}"/> |
|||
|
|||
<Border Height="1" VerticalAlignment="Bottom" Background="{StaticResource Border.Brush}" Grid.ColumnSpan="5" Margin="0,0,2,0"/> |
|||
</Grid> |
|||
</DataTemplate> |
|||
</ListBox.ItemTemplate> |
|||
</ListBox> |
|||
|
|||
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="1" Margin="0,0,2,0"/> |
|||
|
|||
<c:BButton Content="删除" Style="{StaticResource LinkButton}" Grid.Column="2" VerticalAlignment="Top" Margin="0,30,0,0" |
|||
Command="{Binding DataContext.DeleteProductSkuWithSchemeCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type Window}}}" |
|||
CommandParameter="{Binding }"/> |
|||
</Grid> |
|||
</DataTemplate> |
|||
</ListBox.ItemTemplate> |
|||
</ListBox> |
|||
|
|||
<Border Grid.Row="2" BorderBrush="{StaticResource Border.Brush}" BorderThickness="1,0,1,1"> |
|||
<c:BButton Style="{StaticResource LinkButton}" Command="{Binding AddProductSkuCommand}"> |
|||
<StackPanel> |
|||
<Path Style="{StaticResource path_add}" Fill="{StaticResource Text.Link.Color}" Width="18"/> |
|||
<TextBlock Text="添加商品" Margin="0,2,0,0"/> |
|||
</StackPanel> |
|||
</c:BButton> |
|||
</Border> |
|||
</Grid> |
|||
|
|||
<Grid Grid.Row="2" Margin="5,0"> |
|||
<Grid.ColumnDefinitions> |
|||
<ColumnDefinition Width="0.8*"/> |
|||
<ColumnDefinition Width="0.2*"/> |
|||
</Grid.ColumnDefinitions> |
|||
<c:BTextBox Text="{Binding PurchaseRemark,Mode=OneWayToSource,UpdateSourceTrigger=PropertyChanged}" |
|||
WaterRemark="留言信息" |
|||
Height="60" |
|||
VerticalContentAlignment="Top" |
|||
Padding="3,5,0,0" |
|||
TextWrapping="Wrap"/> |
|||
|
|||
<StackPanel Grid.Column="1" VerticalAlignment="Center"> |
|||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center"> |
|||
<RadioButton Content="批发" Padding="0" VerticalContentAlignment="Center" |
|||
GroupName="OrderMode" |
|||
IsChecked="{Binding PurchaseOrderMode,Converter={StaticResource enumToBooleanConverter},ConverterParameter={x:Static cmodel:PurchaseOrderMode.批发}}"/> |
|||
<RadioButton Content="分销" Padding="0" VerticalContentAlignment="Center" Margin="20,0,0,0" |
|||
GroupName="OrderMode" |
|||
IsChecked="{Binding PurchaseOrderMode,Converter={StaticResource enumToBooleanConverter},ConverterParameter={x:Static cmodel:PurchaseOrderMode.代发}}"/> |
|||
</StackPanel> |
|||
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,5,0,0"> |
|||
<Run Text="货品总金额"/> |
|||
<Run Text="{Binding ProductAmount,Mode=OneWay,UpdateSourceTrigger=PropertyChanged}" Foreground="#EC808D"/> |
|||
<Run Text="元"/> |
|||
<LineBreak/> |
|||
<Run Text="运费共计"/> |
|||
<Run Text="{Binding FreightAmount,Mode=OneWay,UpdateSourceTrigger=PropertyChanged}" Foreground="#EC808D"/> |
|||
<Run Text="元"/> |
|||
</TextBlock> |
|||
</StackPanel> |
|||
|
|||
</Grid> |
|||
|
|||
<StackPanel HorizontalAlignment="Stretch" VerticalAlignment="Center" Grid.Row="3" Margin="5,0"> |
|||
<c:BTextBox Text="{Binding ContactName,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" WaterRemark="收货人"/> |
|||
<Grid> |
|||
<Grid.ColumnDefinitions> |
|||
<ColumnDefinition Width="80"/> |
|||
<ColumnDefinition Width="80"/> |
|||
<ColumnDefinition Width="80"/> |
|||
<ColumnDefinition Width="80"/> |
|||
<ColumnDefinition/> |
|||
</Grid.ColumnDefinitions> |
|||
<c:BTextBox Text="{Binding Province,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" WaterRemark="省" BorderThickness="1,1,0,1"/> |
|||
<c:BTextBox Text="{Binding City,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" WaterRemark="市" Grid.Column="1" BorderThickness="1,1,0,1"/> |
|||
<c:BTextBox Text="{Binding County,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" WaterRemark="区/县" Grid.Column="2" BorderThickness="1,1,0,1"/> |
|||
<c:BTextBox Text="{Binding Town,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" WaterRemark="镇" Grid.Column="3" BorderThickness="1,1,0,1"/> |
|||
<c:BTextBox Text="{Binding Address,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Margin="0,2.5" WaterRemark="街道地址" Grid.Column="4"/> |
|||
</Grid> |
|||
|
|||
<c:BTextBox Text="{Binding Mobile,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" WaterRemark="电话"/> |
|||
</StackPanel> |
|||
|
|||
<TextBlock Grid.Row="4" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="5,0,0,0" FontSize="16"> |
|||
<Run Text="应付总额(含运费)"/> |
|||
<Run Text="{Binding TotalAmount,Mode=OneWay,UpdateSourceTrigger=PropertyChanged}" Foreground="#EC808D"/> |
|||
<Run Text="元"/> |
|||
</TextBlock> |
|||
<StackPanel Orientation="Horizontal" Grid.Row="4" VerticalAlignment="Center" HorizontalAlignment="Right"> |
|||
<c:BButton Content="预览订单" Width="80" HorizontalAlignment="Right" Margin="5,0,0,0" |
|||
Command="{Binding PreviewOrderCommand}" Background="#1CC2A2"/> |
|||
<c:BButton Content="提交订单" Width="80" HorizontalAlignment="Right" |
|||
Command="{Binding FastCreateOrderCommand}" Margin="0,0,5,0"/> |
|||
</StackPanel> |
|||
</Grid> |
|||
</c:BWindow> |
@ -0,0 +1,32 @@ |
|||
using BBWY.Controls; |
|||
using System.Windows; |
|||
|
|||
namespace BBWY.Client.Views.BatchPurchase |
|||
{ |
|||
/// <summary>
|
|||
/// BatchCreateNewPurchaseOrder.xaml 的交互逻辑
|
|||
/// </summary>
|
|||
public partial class BatchCreateNewPurchaseOrder : BWindow |
|||
{ |
|||
public BatchCreateNewPurchaseOrder() |
|||
{ |
|||
InitializeComponent(); |
|||
this.Loaded += BatchCreateNewPurchaseOrder_Loaded; |
|||
this.Unloaded += BatchCreateNewPurchaseOrder_Unloaded; |
|||
} |
|||
|
|||
private void BatchCreateNewPurchaseOrder_Unloaded(object sender, RoutedEventArgs e) |
|||
{ |
|||
GalaSoft.MvvmLight.Messaging.Messenger.Default.Unregister(this); |
|||
} |
|||
|
|||
private void BatchCreateNewPurchaseOrder_Loaded(object sender, RoutedEventArgs e) |
|||
{ |
|||
GalaSoft.MvvmLight.Messaging.Messenger.Default.Register<bool>(this, "BatchCreateNewPurchaseOrderClose", (r) => |
|||
{ |
|||
this.DialogResult = r; |
|||
this.Close(); |
|||
}); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,175 @@ |
|||
<c:BWindow x:Class="BBWY.Client.Views.BatchPurchase.BatchPurchaseAddProductSku" |
|||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
|||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
|||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
|||
xmlns:local="clr-namespace:BBWY.Client.Views.BatchPurchase" |
|||
mc:Ignorable="d" |
|||
xmlns:cmodel="clr-namespace:BBWY.Client.Models" |
|||
xmlns:c="clr-namespace:BBWY.Controls;assembly=BBWY.Controls" |
|||
xmlns:b="http://schemas.microsoft.com/xaml/behaviors" |
|||
Style="{StaticResource bwstyle}" |
|||
Title="BatchPurchaseAddProductSku" Height="600" Width="550" |
|||
DataContext="{Binding BatchPurchaseAddProductSku,Source={StaticResource Locator}}" |
|||
MinButtonVisibility="Collapsed" |
|||
MaxButtonVisibility="Collapsed"> |
|||
<Grid> |
|||
<Grid.RowDefinitions> |
|||
<RowDefinition Height="30"/> |
|||
<RowDefinition Height="100"/> |
|||
<RowDefinition/> |
|||
<RowDefinition Height="40"/> |
|||
</Grid.RowDefinitions> |
|||
<c:RoundWaitProgress Play="{Binding IsLoading}" Panel.ZIndex="999" Grid.RowSpan="5"/> |
|||
|
|||
<Border BorderThickness="0,0,0,1" BorderBrush="{StaticResource MainMenu.BorderBrush}" |
|||
Background="{StaticResource Border.Background}"> |
|||
<TextBlock Text="添加商品" HorizontalAlignment="Center" VerticalAlignment="Center"/> |
|||
</Border> |
|||
|
|||
<Grid Grid.Row="1" Margin="5,0"> |
|||
<Grid.ColumnDefinitions> |
|||
<ColumnDefinition Width="50"/> |
|||
<ColumnDefinition/> |
|||
<ColumnDefinition Width="50"/> |
|||
<ColumnDefinition/> |
|||
<ColumnDefinition Width="5"/> |
|||
<ColumnDefinition Width="Auto"/> |
|||
</Grid.ColumnDefinitions> |
|||
<Grid.RowDefinitions> |
|||
<RowDefinition/> |
|||
<RowDefinition/> |
|||
</Grid.RowDefinitions> |
|||
<TextBlock Text="SPU" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,5,0"/> |
|||
<c:BTextBox Grid.Column="1" Text="{Binding Spu}"/> |
|||
|
|||
<TextBlock Text="SKU" HorizontalAlignment="Right" VerticalAlignment="Center" Grid.Column="2" Margin="0,0,5,0"/> |
|||
<c:BTextBox Grid.Column="3" Text="{Binding Sku}"/> |
|||
|
|||
<c:BButton Grid.Column="5" Content="搜索" Width="70" Command="{Binding SearchCommand}"/> |
|||
|
|||
<TextBlock Text="采购商" HorizontalAlignment="Right" VerticalAlignment="Center" Grid.Row="1" Margin="0,0,5,0"/> |
|||
<ComboBox Grid.Column="1" Grid.Row="1" Height="30" |
|||
ItemsSource="{Binding PurchaserList}" |
|||
SelectedItem="{Binding SelectedPurchaser}" |
|||
DisplayMemberPath="Name" |
|||
VerticalContentAlignment="Center"/> |
|||
|
|||
<TextBlock Text="平台" HorizontalAlignment="Right" VerticalAlignment="Center" Grid.Column="2" Grid.Row="1" Margin="0,0,5,0"/> |
|||
<ComboBox Grid.Column="3" Grid.Row="1" Height="30" |
|||
ItemsSource="{Binding PurchasePlatformList}" |
|||
SelectedItem="{Binding SelectedPurchasePlatform}" |
|||
DisplayMemberPath="Value" |
|||
VerticalContentAlignment="Center"/> |
|||
|
|||
<c:BButton Grid.Column="5" Content="筛选" Width="70" Grid.Row="1" Background="#2879FF" Command="{Binding FilterCommand}"/> |
|||
|
|||
|
|||
</Grid> |
|||
|
|||
<DataGrid Grid.Row="2" |
|||
ItemsSource="{Binding FilterList}" |
|||
Margin="5,0" |
|||
BorderBrush="{StaticResource Border.Brush}" |
|||
BorderThickness="1" |
|||
RowHeight="90"> |
|||
<DataGrid.RowStyle> |
|||
<Style TargetType="DataGridRow"> |
|||
<Setter Property="IsEnabled" Value="{Binding PurchaseSchemeId,ConverterParameter=0:false:true,Converter={StaticResource objConverter}}"/> |
|||
</Style> |
|||
</DataGrid.RowStyle> |
|||
<DataGrid.Columns> |
|||
<DataGridTemplateColumn Width="35"> |
|||
<DataGridTemplateColumn.HeaderTemplate> |
|||
<DataTemplate> |
|||
<CheckBox Margin="5,0,0,0" |
|||
IsChecked="{Binding DataContext.AllSelected,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type DataGrid}}}"/> |
|||
</DataTemplate> |
|||
</DataGridTemplateColumn.HeaderTemplate> |
|||
<DataGridTemplateColumn.CellTemplate> |
|||
<DataTemplate> |
|||
<CheckBox IsChecked="{Binding IsSelected,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Center" VerticalAlignment="Center"/> |
|||
</DataTemplate> |
|||
</DataGridTemplateColumn.CellTemplate> |
|||
</DataGridTemplateColumn> |
|||
<DataGridTemplateColumn Header="商品信息" Width="*" HeaderStyle="{StaticResource ColumnHeaderStyle_Center}"> |
|||
<DataGridTemplateColumn.CellTemplate> |
|||
<DataTemplate> |
|||
<Grid> |
|||
<Grid.ColumnDefinitions> |
|||
<ColumnDefinition Width="90"/> |
|||
<ColumnDefinition/> |
|||
</Grid.ColumnDefinitions> |
|||
|
|||
<!--{Binding Logo}--> |
|||
<c:BAsyncImage UrlSource="{Binding Logo}" |
|||
Width="80" DecodePixelWidth="80" |
|||
VerticalAlignment="Top" Margin="0,5,0,0" |
|||
Cursor="Hand"/> |
|||
|
|||
<StackPanel Grid.Column="1" Orientation="Vertical" Margin="0,5,0,5"> |
|||
<StackPanel Orientation="Horizontal"> |
|||
<TextBlock Text="SKU:"/> |
|||
<c:BButton Content="{Binding SkuId}" Style="{StaticResource LinkButton}" |
|||
Command="{Binding DataContext.CopyTextCommand,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type DataGrid}}}" |
|||
CommandParameter="{Binding SkuId}" |
|||
Margin=" 5,0,0,0" |
|||
DisableText="{Binding SkuId}"/> |
|||
</StackPanel> |
|||
<TextBlock TextTrimming="CharacterEllipsis" |
|||
Margin="0,17,0,0"> |
|||
<Run Text="名称:"/> |
|||
<Run Text="{Binding Title}"/> |
|||
<TextBlock.ToolTip> |
|||
<ToolTip Style="{StaticResource OrderCouponToolipStyle}"> |
|||
<TextBlock Text="{Binding Title}"/> |
|||
</ToolTip> |
|||
</TextBlock.ToolTip> |
|||
</TextBlock> |
|||
<StackPanel Orientation="Horizontal" Margin="0,17,0,0"> |
|||
<TextBlock> |
|||
<Run Text="采购平台:"/> |
|||
<Run Text="{Binding PurchasePlatform}"/> |
|||
</TextBlock> |
|||
<TextBlock Margin="10,0,0,0"> |
|||
<Run Text="采购商:"/> |
|||
<Run Text="{Binding PurchaserName}"/> |
|||
</TextBlock> |
|||
</StackPanel> |
|||
|
|||
</StackPanel> |
|||
</Grid> |
|||
</DataTemplate> |
|||
</DataGridTemplateColumn.CellTemplate> |
|||
</DataGridTemplateColumn> |
|||
<DataGridTemplateColumn Header="数量" Width="100" HeaderStyle="{StaticResource ColumnHeaderStyle_Center}"> |
|||
<DataGridTemplateColumn.CellTemplate> |
|||
<DataTemplate> |
|||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center"> |
|||
<c:BButton Content="-" Background="White" Foreground="Black" |
|||
BorderBrush="{StaticResource Border.Brush}" |
|||
BorderThickness="1" |
|||
Width="15" |
|||
Height="18" |
|||
Command="{Binding DataContext.SubtractQuantityCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type DataGrid}}}" |
|||
CommandParameter="{Binding }"/> |
|||
<c:BTextBox Text="{Binding Quantity,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Margin="5,0" VerticalAlignment="Center" |
|||
Width="40" HorizontalContentAlignment="Center" Padding="0,0,3,0" |
|||
DisableBgColor="{StaticResource TextBox.Disable.BgColor}"/> |
|||
<c:BButton Content="+" Background="White" Foreground="Black" |
|||
BorderBrush="{StaticResource Border.Brush}" |
|||
BorderThickness="1" |
|||
Width="15" |
|||
Height="18" |
|||
Command="{Binding DataContext.AddQuantityCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type DataGrid}}}" |
|||
CommandParameter="{Binding }"/> |
|||
</StackPanel> |
|||
</DataTemplate> |
|||
</DataGridTemplateColumn.CellTemplate> |
|||
</DataGridTemplateColumn> |
|||
</DataGrid.Columns> |
|||
</DataGrid> |
|||
|
|||
<c:BButton Grid.Column="4" Content="确定" Width="80" Grid.Row="3" Command="{Binding SaveCommand}" HorizontalAlignment="Right" Margin="0,0,5,0"/> |
|||
</Grid> |
|||
</c:BWindow> |
@ -0,0 +1,37 @@ |
|||
using BBWY.Client.Models; |
|||
using BBWY.Controls; |
|||
using System.Collections.Generic; |
|||
using System.Windows; |
|||
|
|||
namespace BBWY.Client.Views.BatchPurchase |
|||
{ |
|||
/// <summary>
|
|||
/// BatchPurchaseAddProductSku.xaml 的交互逻辑
|
|||
/// </summary>
|
|||
public partial class BatchPurchaseAddProductSku : BWindow |
|||
{ |
|||
public IList<ProductSkuWithScheme> SelectedProductSkuWithSchemeList { get; private set; } |
|||
|
|||
public BatchPurchaseAddProductSku() |
|||
{ |
|||
InitializeComponent(); |
|||
this.Loaded += BatchPurchaseAddProductSku_Loaded; |
|||
this.Unloaded += BatchPurchaseAddProductSku_Unloaded; |
|||
} |
|||
|
|||
private void BatchPurchaseAddProductSku_Unloaded(object sender, RoutedEventArgs e) |
|||
{ |
|||
GalaSoft.MvvmLight.Messaging.Messenger.Default.Unregister(this); |
|||
} |
|||
|
|||
private void BatchPurchaseAddProductSku_Loaded(object sender, RoutedEventArgs e) |
|||
{ |
|||
GalaSoft.MvvmLight.Messaging.Messenger.Default.Register<List<ProductSkuWithScheme>>(this, "BatchPurchaseAddProductSkuSave", (list) => |
|||
{ |
|||
SelectedProductSkuWithSchemeList = list; |
|||
this.DialogResult = true; |
|||
this.Close(); |
|||
}); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,388 @@ |
|||
<Page x:Class="BBWY.Client.Views.BatchPurchase.BatchPurchaseOrderList" |
|||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
|||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
|||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
|||
xmlns:c="clr-namespace:BBWY.Controls;assembly=BBWY.Controls" |
|||
xmlns:b="http://schemas.microsoft.com/xaml/behaviors" |
|||
xmlns:local="clr-namespace:BBWY.Client.Views.BatchPurchase" |
|||
mc:Ignorable="d" |
|||
xmlns:cmodel="clr-namespace:BBWY.Client.Models" |
|||
xmlns:sys="clr-namespace:System;assembly=mscorlib" |
|||
d:DesignHeight="1080" d:DesignWidth="1920" |
|||
Title="BatchPurchaseOrderList" |
|||
Foreground="{StaticResource Text.Color}" |
|||
DataContext="{Binding BatchPurchaseOrderListVM,Source={StaticResource Locator}}"> |
|||
<Page.Resources> |
|||
<sys:Int32 x:Key="d0">0</sys:Int32> |
|||
<sys:Int32 x:Key="d1">1</sys:Int32> |
|||
<sys:Int32 x:Key="d3">2</sys:Int32> |
|||
<sys:Int32 x:Key="d7">6</sys:Int32> |
|||
<sys:Int32 x:Key="d15">14</sys:Int32> |
|||
<sys:Int32 x:Key="d30">29</sys:Int32> |
|||
</Page.Resources> |
|||
<Grid> |
|||
<c:RoundWaitProgress Play="{Binding IsLoading}" Panel.ZIndex="999"/> |
|||
|
|||
<Grid Margin="5,0"> |
|||
<Grid.RowDefinitions> |
|||
<RowDefinition Height="auto"/> |
|||
<RowDefinition Height="5"/> |
|||
<RowDefinition Height="30"/> |
|||
<RowDefinition Height="5"/> |
|||
<RowDefinition Height="30"/> |
|||
<RowDefinition/> |
|||
<RowDefinition Height="30"/> |
|||
</Grid.RowDefinitions> |
|||
|
|||
<Grid Background="{StaticResource Border.Background}" HorizontalAlignment="Left" Height="75" Panel.ZIndex="999"> |
|||
<Grid.ColumnDefinitions> |
|||
<ColumnDefinition/> |
|||
<ColumnDefinition Width="auto"/> |
|||
</Grid.ColumnDefinitions> |
|||
<Grid.RowDefinitions> |
|||
<RowDefinition Height="0.5*"/> |
|||
<RowDefinition Height="5"/> |
|||
<RowDefinition Height="0.5*"/> |
|||
</Grid.RowDefinitions> |
|||
<StackPanel Orientation="Horizontal" Margin="0,5,0,0" Height="30"> |
|||
<StackPanel.Resources> |
|||
<Style TargetType="DatePickerTextBox"> |
|||
<Setter Property="IsReadOnly" Value="True"/> |
|||
</Style> |
|||
</StackPanel.Resources> |
|||
<TextBlock Text="下单时间" VerticalAlignment="Center" Margin="5,0,0,0"/> |
|||
<DatePicker SelectedDate="{Binding StartDate}" Width="133.5" Height="30" VerticalContentAlignment="Center" FocusVisualStyle="{x:Null}" Margin="5,0,0,0"/> |
|||
<DatePicker SelectedDate="{Binding EndDate}" Width="133.5" Height="30" VerticalContentAlignment="Center" FocusVisualStyle="{x:Null}" Margin="5,0,0,0"/> |
|||
<TextBlock Text="采购单" VerticalAlignment="Center" Margin="5,0,0,0"/> |
|||
<c:BTextBox Width="150" Margin="5,0,0,0" Text="{Binding SearchPurchaseOrderId}" WaterRemark="精确匹配"/> |
|||
<TextBlock Text="SPU" VerticalAlignment="Center" Margin="5,0,0,0"/> |
|||
<c:BTextBox Width="150" Margin="5,0,0,0" WaterRemark="精确匹配" Text="{Binding SearchProductId}"/> |
|||
</StackPanel> |
|||
<StackPanel Orientation="Horizontal" Grid.Row="2" Margin="0,0,0,5" Height="30"> |
|||
<c:BButton Content="今天" Width="50" Height="25" Margin="5,0,0,0" |
|||
Command="{Binding SetSearchDateCommand}" |
|||
CommandParameter="{StaticResource d0}"/> |
|||
<c:BButton Content="昨天" Width="50" Height="25" Margin="5,0,0,0" |
|||
Command="{Binding SetSearchDateCommand}" |
|||
CommandParameter="{StaticResource d1}"/> |
|||
<c:BButton Content="近3天" Width="50" Height="25" Margin="5,0,0,0" |
|||
Command="{Binding SetSearchDateCommand}" |
|||
CommandParameter="{StaticResource d3}"/> |
|||
<c:BButton Content="近7天" Width="50" Height="24" Margin="5,0,0,0" |
|||
Command="{Binding SetSearchDateCommand}" |
|||
CommandParameter="{StaticResource d7}"/> |
|||
<c:BButton Content="近15天" Width="50" Height="25" Margin="5,0,0,0" |
|||
Command="{Binding SetSearchDateCommand}" |
|||
CommandParameter="{StaticResource d15}"/> |
|||
<c:BButton Content="近30天" Width="50" Height="25" Margin="5,0,0,0" |
|||
Command="{Binding SetSearchDateCommand}" |
|||
CommandParameter="{StaticResource d30}"/> |
|||
<TextBlock VerticalAlignment="Center" Margin="5,0,0,0" Text="采购商"/> |
|||
<c:BTextBox Width="150" Margin="5,0,0,0" Text="{Binding SearchPurchaseName}" WaterRemark="精确匹配"/> |
|||
<TextBlock Text="SKU" VerticalAlignment="Center" Margin="5,0,0,0"/> |
|||
<c:BTextBox Width="150" Margin="5,0,0,0" Text="{Binding SearchSkuId}" WaterRemark="精确匹配"/> |
|||
|
|||
<c:BButton Content="同步" Width="50" Margin="5,0,0,0" Command="{Binding SyncOrderCommand}" ToolTipService.InitialShowDelay="0" ToolTipService.ShowDuration="10000" |
|||
Visibility="Collapsed"> |
|||
<c:BButton.ToolTip> |
|||
<StackPanel> |
|||
<TextBlock Text="1.使用筛选条件中的开始时间和结束时间进行同步"/> |
|||
<TextBlock Text="2.从开始时间起每次同步3小时时长的订单直到到达结束时间"/> |
|||
<TextBlock Text="3.已存在未结束的同步任务将不会重复执行"/> |
|||
</StackPanel> |
|||
</c:BButton.ToolTip> |
|||
</c:BButton> |
|||
</StackPanel> |
|||
|
|||
<Grid Grid.Column="1" Grid.RowSpan="3"> |
|||
<Grid.ColumnDefinitions> |
|||
<ColumnDefinition/> |
|||
<ColumnDefinition/> |
|||
</Grid.ColumnDefinitions> |
|||
<Button Content="搜索" Width="50" VerticalAlignment="Stretch" Margin="5,0,0,0" Command="{Binding SearchPurchaseOrderCommand}" |
|||
Grid.RowSpan="2" Background="{StaticResource Button.Selected.Background}" BorderThickness="0" Foreground="White"/> |
|||
<Button Content="导出" Command="{Binding ExportCommand}" Width="50" Grid.Column="1" |
|||
Visibility="{Binding Visibility,ElementName=listbox_order}" Background="#1CC2A2" BorderThickness="0" Foreground="White"/> |
|||
<!--<Button Content="同步" Command="{Binding SyncOrderCommand}" Width="50" Grid.Column="1" Grid.Row="1" |
|||
Visibility="{Binding Visibility,ElementName=listbox_order}" Background="#02A7F0" BorderThickness="0" Foreground="White"/>--> |
|||
</Grid> |
|||
</Grid> |
|||
|
|||
<StackPanel Grid.Row="2" HorizontalAlignment="Left" Orientation="Horizontal"> |
|||
<c:BButton Content="新建采购单" Padding="10,0" Margin="0,0,10,0" Background="#2879FF" |
|||
Command="{Binding OpenCreateNewPurchaseOrderDialogCommand}"/> |
|||
<c:BButton Content="全部" Width="100" Margin="5,0,0,0" |
|||
Background="{Binding PurchaseOrderState,Converter={StaticResource objConverter},ConverterParameter=#null:#8080FF:#F2F2F2}" |
|||
Foreground="{Binding PurchaseOrderState,Converter={StaticResource objConverter},ConverterParameter=#null:White:#4A4A4A}" |
|||
Command="{Binding SetPurchaseOrderStateCommand}" CommandParameter="{x:Null}"/> |
|||
<c:BButton Content="待付款" Width="100" |
|||
Background="{Binding PurchaseOrderState,Converter={StaticResource objConverter},ConverterParameter=待付款:#8080FF:#F2F2F2}" |
|||
Foreground="{Binding PurchaseOrderState,Converter={StaticResource objConverter},ConverterParameter=待付款:White:#4A4A4A}" |
|||
Command="{Binding SetPurchaseOrderStateCommand}" CommandParameter="{x:Static cmodel:PurchaseOrderState.待付款}"/> |
|||
<c:BButton Content="待发货" Width="100" |
|||
Background="{Binding PurchaseOrderState,Converter={StaticResource objConverter},ConverterParameter=待发货:#8080FF:#F2F2F2}" |
|||
Foreground="{Binding PurchaseOrderState,Converter={StaticResource objConverter},ConverterParameter=待发货:White:#4A4A4A}" |
|||
Command="{Binding SetPurchaseOrderStateCommand}" CommandParameter="{x:Static cmodel:PurchaseOrderState.待发货}"/> |
|||
<c:BButton Content="待收货" Width="100" |
|||
Background="{Binding PurchaseOrderState,Converter={StaticResource objConverter},ConverterParameter=待收货:#8080FF:#F2F2F2}" |
|||
Foreground="{Binding PurchaseOrderState,Converter={StaticResource objConverter},ConverterParameter=待收货:White:#4A4A4A}" |
|||
Command="{Binding SetPurchaseOrderStateCommand}" CommandParameter="{x:Static cmodel:PurchaseOrderState.待收货}"/> |
|||
<c:BButton Content="待质检" Width="100" |
|||
Background="{Binding PurchaseOrderState,Converter={StaticResource objConverter},ConverterParameter=待质检:#8080FF:#F2F2F2}" |
|||
Foreground="{Binding PurchaseOrderState,Converter={StaticResource objConverter},ConverterParameter=待质检:White:#4A4A4A}" |
|||
Command="{Binding SetPurchaseOrderStateCommand}" CommandParameter="{x:Static cmodel:PurchaseOrderState.待质检}"/> |
|||
<c:BButton Content="待打包" Width="100" |
|||
Background="{Binding PurchaseOrderState,Converter={StaticResource objConverter},ConverterParameter=待打包:#8080FF:#F2F2F2}" |
|||
Foreground="{Binding PurchaseOrderState,Converter={StaticResource objConverter},ConverterParameter=待打包:White:#4A4A4A}" |
|||
Command="{Binding SetPurchaseOrderStateCommand}" CommandParameter="{x:Static cmodel:PurchaseOrderState.待打包}"/> |
|||
<c:BButton Content="待结算" Width="100" |
|||
Background="{Binding PurchaseOrderState,Converter={StaticResource objConverter},ConverterParameter=待结算:#8080FF:#F2F2F2}" |
|||
Foreground="{Binding PurchaseOrderState,Converter={StaticResource objConverter},ConverterParameter=待结算:White:#4A4A4A}" |
|||
Command="{Binding SetPurchaseOrderStateCommand}" CommandParameter="{x:Static cmodel:PurchaseOrderState.待结算}"/> |
|||
<c:BButton Content="已完成" Width="100" |
|||
Background="{Binding PurchaseOrderState,Converter={StaticResource objConverter},ConverterParameter=已完成:#8080FF:#F2F2F2}" |
|||
Foreground="{Binding PurchaseOrderState,Converter={StaticResource objConverter},ConverterParameter=已完成:White:#4A4A4A}" |
|||
Command="{Binding SetPurchaseOrderStateCommand}" CommandParameter="{x:Static cmodel:PurchaseOrderState.已完成}"/> |
|||
</StackPanel> |
|||
|
|||
<Border BorderBrush="{StaticResource Border.Brush}" BorderThickness="1,1,1,0" |
|||
Background="#F2F2F2" Grid.Row="4"> |
|||
<Grid> |
|||
<Grid.ColumnDefinitions> |
|||
<ColumnDefinition Width="380"/> |
|||
<ColumnDefinition/> |
|||
<ColumnDefinition/> |
|||
<ColumnDefinition/> |
|||
<ColumnDefinition/> |
|||
<ColumnDefinition/> |
|||
<ColumnDefinition Width="80"/> |
|||
</Grid.ColumnDefinitions> |
|||
|
|||
<TextBlock Text="商品信息" Style="{StaticResource middleTextBlock}"/> |
|||
<TextBlock Text="采购信息" Grid.Column="1" Style="{StaticResource middleTextBlock}"/> |
|||
<TextBlock Text="采购成本" Grid.Column="2" Style="{StaticResource middleTextBlock}"/> |
|||
<TextBlock Text="其他成本" Grid.Column="3" Style="{StaticResource middleTextBlock}"/> |
|||
<TextBlock Text="物流信息" Grid.Column="4" Style="{StaticResource middleTextBlock}"/> |
|||
<TextBlock Text="备注信息" Grid.Column="5" Style="{StaticResource middleTextBlock}"/> |
|||
<TextBlock Text="操作" Grid.Column="6" Style="{StaticResource middleTextBlock}"/> |
|||
|
|||
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}"/> |
|||
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="1"/> |
|||
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="2"/> |
|||
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="3"/> |
|||
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="4"/> |
|||
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="5"/> |
|||
</Grid> |
|||
</Border> |
|||
|
|||
<ListBox x:Name="listbox_purchaseOrder" |
|||
Grid.Row="5" |
|||
ItemsSource="{Binding PurchaseOrderList}" |
|||
ItemContainerStyle="{StaticResource NoBgListBoxItemStyle}" |
|||
BorderThickness="1" |
|||
BorderBrush="{StaticResource Border.Brush}" |
|||
Foreground="{StaticResource Text.Color}"> |
|||
<ListBox.ItemTemplate> |
|||
<DataTemplate> |
|||
<Grid Width="{Binding ActualWidth,ElementName=listbox_purchaseOrder,Converter={StaticResource widthConverter},ConverterParameter=-0}"> |
|||
<Grid.RowDefinitions> |
|||
<RowDefinition Height="30"/> |
|||
<RowDefinition/> |
|||
</Grid.RowDefinitions> |
|||
|
|||
<Grid Background="#F2F2F2" Grid.ColumnSpan="2"> |
|||
<StackPanel Orientation="Horizontal"> |
|||
<TextBlock Text="{Binding CreateTime,StringFormat=yyyy-MM-dd HH:mm:ss}" VerticalAlignment="Center" Margin="5,0,0,0"/> |
|||
<TextBlock VerticalAlignment="Center" Text="订单号:" Margin="5,0,0,0" /> |
|||
<c:BButton Content="{Binding Id}" Style="{StaticResource LinkButton}" |
|||
Command="{Binding DataContext.CopyTextCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type ListBox}}}" |
|||
CommandParameter="{Binding Id}" Margin="5,0,0,0"/> |
|||
<c:BButton x:Name="btn_orderState" Content="{Binding OrderState}" Margin="5,0,0,0" Height="25" Padding="5,0" Background="{StaticResource Text.Link.Color}"/> |
|||
<Border Width="1" Margin="5,5,0,5" Background="{StaticResource Border.Brush}"/> |
|||
<StackPanel x:Name="txt_consignee" Margin="5,0,0,0" Orientation="Horizontal" VerticalAlignment="Center"> |
|||
<TextBlock Text="下单账号:"/> |
|||
<c:BButton Content="{Binding PurchaseAccountId}" Style="{StaticResource LinkButton}" |
|||
Command="{Binding DataContext.CopyTextCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type ListBox}}}" |
|||
CommandParameter="{Binding PurchaseAccountId}" Margin="5,0,0,0"/> |
|||
|
|||
<TextBlock Text="收货人:" Margin="5,0,0,0"/> |
|||
<c:BButton Content="{Binding ConsigneeContactName}" Style="{StaticResource LinkButton}" |
|||
Command="{Binding DataContext.CopyTextCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type ListBox}}}" |
|||
CommandParameter="{Binding ConsigneeContactName}" Margin="5,0,0,0"/> |
|||
|
|||
<TextBlock Text="联系电话" Margin="5,0,0,0"/> |
|||
<c:BButton Content="{Binding ConsigneeMobile}" Style="{StaticResource LinkButton}" |
|||
Command="{Binding DataContext.CopyTextCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type ListBox}}}" |
|||
CommandParameter="{Binding ConsigneeMobile}" Margin="5,0,0,0"/> |
|||
</StackPanel> |
|||
</StackPanel> |
|||
<Border VerticalAlignment="Bottom" Height="1" Background="{StaticResource Border.Brush}"/> |
|||
</Grid> |
|||
|
|||
<Grid Grid.Row="1"> |
|||
<Grid.ColumnDefinitions> |
|||
<ColumnDefinition Width="380"/> |
|||
<ColumnDefinition/> |
|||
<ColumnDefinition/> |
|||
<ColumnDefinition/> |
|||
<ColumnDefinition/> |
|||
<ColumnDefinition/> |
|||
<ColumnDefinition Width="80"/> |
|||
</Grid.ColumnDefinitions> |
|||
|
|||
<ListBox x:Name="listbox_purchaseOrderSku" ItemsSource="{Binding ItemList}" |
|||
Style="{StaticResource NoScrollViewListBoxStyle}" |
|||
ItemContainerStyle="{StaticResource NoBgListBoxItemStyle}" |
|||
Foreground="{StaticResource Text.Color}"> |
|||
<ListBox.ItemTemplate> |
|||
<DataTemplate> |
|||
<Grid Width="{Binding ActualWidth,ElementName=listbox_orerSku}"> |
|||
<Grid.ColumnDefinitions> |
|||
<ColumnDefinition Width="90"/> |
|||
<ColumnDefinition/> |
|||
</Grid.ColumnDefinitions> |
|||
|
|||
<!--{Binding Logo}--> |
|||
<c:BAsyncImage UrlSource="{Binding Logo}" |
|||
Width="80" DecodePixelWidth="80" |
|||
VerticalAlignment="Top" Margin="0,5,0,5" |
|||
Cursor="Hand"/> |
|||
|
|||
<StackPanel Grid.Column="1" Orientation="Vertical" Margin="0,5,0,5"> |
|||
<TextBlock TextTrimming="CharacterEllipsis"> |
|||
<TextBlock.ToolTip> |
|||
<ToolTip Style="{StaticResource OrderCouponToolipStyle}"> |
|||
<TextBlock Text="{Binding SkuTitle}"/> |
|||
</ToolTip> |
|||
</TextBlock.ToolTip> |
|||
<Run Text="SKU名称:"/> |
|||
<Run Text="{Binding SkuTitle}"/> |
|||
</TextBlock> |
|||
<TextBlock TextWrapping="Wrap"> |
|||
<Run Text="单价:"/> |
|||
<Run Text="{Binding Price}" Foreground="{StaticResource Text.Pink}"/> |
|||
</TextBlock> |
|||
<TextBlock TextWrapping="Wrap"> |
|||
<Run Text="数量:"/> |
|||
<Run Text="{Binding Quantity}" Foreground="{StaticResource Text.Pink}"/> |
|||
</TextBlock> |
|||
<StackPanel Orientation="Horizontal"> |
|||
<StackPanel Orientation="Vertical"> |
|||
<StackPanel Orientation="Horizontal"> |
|||
<TextBlock Text="SPU:"/> |
|||
<c:BButton Content="{Binding ProductId}" Style="{StaticResource LinkButton}" |
|||
Command="{Binding DataContext.CopyTextCommand,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Page}}}" |
|||
CommandParameter="{Binding ProductId}" |
|||
Margin=" 5,0,0,0"/> |
|||
</StackPanel> |
|||
<StackPanel Orientation="Horizontal"> |
|||
<TextBlock Text="SKU:"/> |
|||
<c:BButton Content="{Binding SkuId}" Style="{StaticResource LinkButton}" |
|||
Command="{Binding DataContext.CopyTextCommand,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Page}}}" |
|||
CommandParameter="{Binding SkuId}" |
|||
Margin=" 5,0,0,0"/> |
|||
</StackPanel> |
|||
</StackPanel> |
|||
</StackPanel> |
|||
</StackPanel> |
|||
</Grid> |
|||
</DataTemplate> |
|||
</ListBox.ItemTemplate> |
|||
</ListBox> |
|||
|
|||
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}"/> |
|||
|
|||
<StackPanel Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Center"> |
|||
<TextBlock> |
|||
<Run Text="采购平台:"/> |
|||
<Run Text="{Binding PurchasePlatform}"/> |
|||
</TextBlock> |
|||
<TextBlock> |
|||
<Run Text="采购商家:"/> |
|||
<Run Text="{Binding PurchaserName}"/> |
|||
</TextBlock> |
|||
<TextBlock> |
|||
<Run Text="采购账号:"/> |
|||
<Run Text="{Binding PurchaseAccountId}"/> |
|||
</TextBlock> |
|||
</StackPanel> |
|||
<Border Width="1" Grid.Column="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}"/> |
|||
|
|||
<StackPanel Grid.Column="2" VerticalAlignment="Center" HorizontalAlignment="Center"> |
|||
<TextBlock> |
|||
<Run Text="采购货款:"/> |
|||
<Run Text="{Binding ProductAmount}" Foreground="{StaticResource Text.Pink}"/> |
|||
</TextBlock> |
|||
<TextBlock> |
|||
<Run Text="采购运费:"/> |
|||
<Run Text="{Binding PurchaseFreight}" Foreground="{StaticResource Text.Pink}"/> |
|||
</TextBlock> |
|||
<TextBlock> |
|||
<Run Text="采购金额:"/> |
|||
<Run Text="{Binding PurchaseAmount}" Foreground="{StaticResource Text.Pink}"/> |
|||
</TextBlock> |
|||
</StackPanel> |
|||
|
|||
<Border Width="1" Grid.Column="2" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}"/> |
|||
|
|||
<StackPanel Grid.Column="3" VerticalAlignment="Center" HorizontalAlignment="Center"> |
|||
<TextBlock> |
|||
<Run Text="质检:"/> |
|||
<Run Text="{Binding QualityInspectionAmount}" Foreground="{StaticResource Text.Pink}"/> |
|||
</TextBlock> |
|||
<TextBlock> |
|||
<Run Text="打包:"/> |
|||
<Run Text="{Binding ConsumableAmount}" Foreground="{StaticResource Text.Pink}"/> |
|||
</TextBlock> |
|||
<TextBlock> |
|||
<Run Text="发货入仓:"/> |
|||
<Run Text="{Binding InStorageAmount}" Foreground="{StaticResource Text.Pink}"/> |
|||
</TextBlock> |
|||
<TextBlock> |
|||
<Run Text="头程运费:"/> |
|||
<Run Text="{Binding FirstFreight}" Foreground="{StaticResource Text.Pink}"/> |
|||
</TextBlock> |
|||
</StackPanel> |
|||
|
|||
<Border Width="1" Grid.Column="3" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}"/> |
|||
|
|||
<StackPanel Grid.Column="4" VerticalAlignment="Center" HorizontalAlignment="Center"> |
|||
<TextBlock> |
|||
<Run Text="快递公司:"/> |
|||
<Run Text="{Binding ExpressName}"/> |
|||
</TextBlock> |
|||
<TextBlock> |
|||
<Run Text="快递单号:"/> |
|||
<Run Text="{Binding WaybillNo}"/> |
|||
</TextBlock> |
|||
</StackPanel> |
|||
|
|||
<Border Width="1" Grid.Column="4" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}"/> |
|||
|
|||
<TextBlock Grid.Column="5" Text="{Binding Remark}" VerticalAlignment="Center" HorizontalAlignment="Center" |
|||
TextWrapping="Wrap"/> |
|||
<Border Width="1" Grid.Column="5" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}"/> |
|||
</Grid> |
|||
|
|||
<Border Grid.Row="1" VerticalAlignment="Bottom" Height="1" Background="{StaticResource Border.Brush}"/> |
|||
</Grid> |
|||
</DataTemplate> |
|||
</ListBox.ItemTemplate> |
|||
</ListBox> |
|||
|
|||
|
|||
<c:PageControl PageIndex="{Binding PageIndex}" |
|||
PageSize="{Binding PageSize}" |
|||
RecordCount="{Binding TotalCount}" |
|||
Grid.Row="6" |
|||
HorizontalAlignment="Left"> |
|||
<b:Interaction.Triggers> |
|||
<b:EventTrigger EventName="OnPageIndexChanged"> |
|||
<b:InvokeCommandAction Command="{Binding OnPageIndexChangedCommand}" PassEventArgsToCommand="True"/> |
|||
</b:EventTrigger> |
|||
</b:Interaction.Triggers> |
|||
</c:PageControl> |
|||
</Grid> |
|||
</Grid> |
|||
</Page> |
@ -0,0 +1,26 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Text; |
|||
using System.Windows; |
|||
using System.Windows.Controls; |
|||
using System.Windows.Data; |
|||
using System.Windows.Documents; |
|||
using System.Windows.Input; |
|||
using System.Windows.Media; |
|||
using System.Windows.Media.Imaging; |
|||
using System.Windows.Navigation; |
|||
using System.Windows.Shapes; |
|||
|
|||
namespace BBWY.Client.Views.BatchPurchase |
|||
{ |
|||
/// <summary>
|
|||
/// BatchPurchaseOrderList.xaml 的交互逻辑
|
|||
/// </summary>
|
|||
public partial class BatchPurchaseOrderList : Page |
|||
{ |
|||
public BatchPurchaseOrderList() |
|||
{ |
|||
InitializeComponent(); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,39 @@ |
|||
<c:BWindow x:Class="BBWY.Client.Views.BatchPurchase.EditQuantityRatioWindow" |
|||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
|||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
|||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
|||
xmlns:local="clr-namespace:BBWY.Client.Views.BatchPurchase" |
|||
mc:Ignorable="d" |
|||
xmlns:c="clr-namespace:BBWY.Controls;assembly=BBWY.Controls" |
|||
Title="EditQuantityRatioWindow" Height="150" Width="300" |
|||
Style="{StaticResource bwstyle}" |
|||
MinButtonVisibility="Collapsed" |
|||
MaxButtonVisibility="Collapsed"> |
|||
<Grid> |
|||
<Grid.RowDefinitions> |
|||
<RowDefinition Height="30"/> |
|||
<RowDefinition/> |
|||
<RowDefinition Height="40"/> |
|||
</Grid.RowDefinitions> |
|||
<Border BorderThickness="0,0,0,1" BorderBrush="{StaticResource MainMenu.BorderBrush}" |
|||
Background="{StaticResource Border.Background}"> |
|||
<TextBlock Text="组合配置" HorizontalAlignment="Center" VerticalAlignment="Center"/> |
|||
</Border> |
|||
|
|||
<StackPanel Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Center"> |
|||
<StackPanel Orientation="Horizontal"> |
|||
<TextBlock VerticalAlignment="Center"> |
|||
<Run Text="1件" Foreground="{StaticResource Text.Pink}"/> |
|||
<Run Text="店铺SKU需要配置的数量"/> |
|||
</TextBlock> |
|||
<c:BTextBox x:Name="txt_quantityRatio" Width="55" Margin="5,0,0,0"/> |
|||
</StackPanel> |
|||
<TextBlock Text="该数量为组合配置比例,非实际采购数量" Margin="0,10,0,0" |
|||
Foreground="Gray"/> |
|||
</StackPanel> |
|||
|
|||
<c:BButton x:Name="btn_Save" Content="保存" Grid.Row="2" Width="60" HorizontalAlignment="Right" Margin="0,0,8,0" |
|||
Click="btn_Save_Click"/> |
|||
</Grid> |
|||
</c:BWindow> |
@ -0,0 +1,43 @@ |
|||
using BBWY.Controls; |
|||
using System.Windows; |
|||
|
|||
namespace BBWY.Client.Views.BatchPurchase |
|||
{ |
|||
/// <summary>
|
|||
/// EditQuantityRatioWindow.xaml 的交互逻辑
|
|||
/// </summary>
|
|||
public partial class EditQuantityRatioWindow : BWindow |
|||
{ |
|||
public int QuantityRatio; |
|||
|
|||
public EditQuantityRatioWindow(int quantityRatio) |
|||
{ |
|||
InitializeComponent(); |
|||
this.QuantityRatio = quantityRatio; |
|||
this.Loaded += EditQuantityRatioWindow_Loaded; |
|||
} |
|||
|
|||
private void EditQuantityRatioWindow_Loaded(object sender, RoutedEventArgs e) |
|||
{ |
|||
txt_quantityRatio.Text = QuantityRatio.ToString(); |
|||
} |
|||
|
|||
private void btn_Save_Click(object sender, RoutedEventArgs e) |
|||
{ |
|||
if (!int.TryParse(txt_quantityRatio.Text, out int quantityRatio)) |
|||
{ |
|||
MessageBox.Show("无效数字", "提示"); |
|||
return; |
|||
} |
|||
if (quantityRatio <= 0) |
|||
{ |
|||
MessageBox.Show("无效数字", "提示"); |
|||
return; |
|||
} |
|||
|
|||
this.QuantityRatio = quantityRatio; |
|||
this.DialogResult = true; |
|||
this.Close(); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,62 @@ |
|||
using BBWY.Server.Business; |
|||
using BBWY.Server.Model.Dto; |
|||
using Microsoft.AspNetCore.Http; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using System.Collections.Generic; |
|||
|
|||
namespace BBWY.Server.API.Controllers |
|||
{ |
|||
public class BatchPurchaseController : BaseApiController |
|||
{ |
|||
private BatchPurchaseBusiness batchPurchaseBusiness; |
|||
|
|||
public BatchPurchaseController(IHttpContextAccessor httpContextAccessor, BatchPurchaseBusiness batchPurchaseBusiness) : base(httpContextAccessor) |
|||
{ |
|||
this.batchPurchaseBusiness = batchPurchaseBusiness; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 获取包含采购方案的sku列表
|
|||
/// </summary>
|
|||
/// <param name="request"></param>
|
|||
/// <returns></returns>
|
|||
[HttpPost] |
|||
public IList<ProductSkuWithSchemeResponse> GetProductSkuAndSchemeList([FromBody] SearchProductSkuAndSchemeRequest request) |
|||
{ |
|||
return batchPurchaseBusiness.GetProductSkuAndSchemeList(request); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 预览订单价格
|
|||
/// </summary>
|
|||
/// <param name="request"></param>
|
|||
/// <returns></returns>
|
|||
[HttpPost] |
|||
public PreviewOrderResponse PreviewOrder([FromBody] BatchPurchasePreviewOrderRequest request) |
|||
{ |
|||
return batchPurchaseBusiness.PreviewOrder(request); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 批量创建采购单
|
|||
/// </summary>
|
|||
/// <param name="request"></param>
|
|||
/// <returns></returns>
|
|||
[HttpPost] |
|||
public BatchCreareOrderResponse BatchCreateOrder([FromBody] BatchPurchaseCreateOrderRequest request) |
|||
{ |
|||
return batchPurchaseBusiness.BatchCreateOrder(request); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 获取采购单列表
|
|||
/// </summary>
|
|||
/// <param name="request"></param>
|
|||
/// <returns></returns>
|
|||
[HttpPost] |
|||
public PurchaseOrderV2ListResponse GetPurchaseOrderList([FromBody] SearchPurchaseOrderV2Request request) |
|||
{ |
|||
return batchPurchaseBusiness.GetPurchaseOrderList(request); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,389 @@ |
|||
using BBWY.Common.Models; |
|||
using BBWY.Server.Model; |
|||
using BBWY.Server.Model.Db; |
|||
using BBWY.Server.Model.Dto; |
|||
using FreeSql; |
|||
using Jd.Api.Domain; |
|||
using Newtonsoft.Json; |
|||
using Newtonsoft.Json.Linq; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using Yitter.IdGenerator; |
|||
|
|||
namespace BBWY.Server.Business |
|||
{ |
|||
public class BatchPurchaseBusiness : BaseBusiness, IDenpendency |
|||
{ |
|||
private ProductBusiness productBusiness; |
|||
private IEnumerable<PlatformSDKBusiness> platformSDKBusinessList; |
|||
|
|||
public BatchPurchaseBusiness(IFreeSql fsql, |
|||
NLogManager nLogManager, |
|||
IIdGenerator idGenerator, |
|||
ProductBusiness productBusiness, |
|||
IEnumerable<PlatformSDKBusiness> platformSDKBusinessList) : base(fsql, nLogManager, idGenerator) |
|||
{ |
|||
this.productBusiness = productBusiness; |
|||
this.platformSDKBusinessList = platformSDKBusinessList; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 获取包含对应平台采购方案的sku列表
|
|||
/// </summary>
|
|||
/// <param name="request"></param>
|
|||
/// <returns></returns>
|
|||
/// <exception cref="BusinessException"></exception>
|
|||
public IList<ProductSkuWithSchemeResponse> GetProductSkuAndSchemeList(SearchProductSkuAndSchemeRequest request) |
|||
{ |
|||
if (string.IsNullOrEmpty(request.Spu) && string.IsNullOrEmpty(request.Sku)) |
|||
throw new BusinessException("至少具备一个Sku或Spu条件"); |
|||
|
|||
var productSkuList = productBusiness.GetProductSkuList(new SearchProductSkuRequest() |
|||
{ |
|||
AppKey = request.AppKey, |
|||
AppSecret = request.AppSecret, |
|||
AppToken = request.AppToken, |
|||
Platform = request.Platform, |
|||
Sku = request.Sku, |
|||
Spu = request.Spu |
|||
}); |
|||
if (productSkuList == null || productSkuList.Count() == 0) |
|||
return null; |
|||
|
|||
var skuIdList = productSkuList.Select(s => s.Id).ToList(); |
|||
var schemeList = fsql.Select<PurchaseScheme, Purchaser>().InnerJoin((ps, p) => ps.PurchaserId == p.Id) |
|||
.Where((ps, p) => ps.ShopId == request.ShopId) |
|||
.Where((ps, p) => skuIdList.Contains(ps.SkuId)) |
|||
.ToList((ps, p) => new |
|||
{ |
|||
PurchaseSchemeId = ps.Id, |
|||
ps.PurchaserId, |
|||
PurchaserName = p.Name, |
|||
ps.PurchasePlatform, |
|||
ps.SkuId |
|||
}); |
|||
var list = new List<ProductSkuWithSchemeResponse>(); |
|||
foreach (var productSku in productSkuList) |
|||
{ |
|||
var currentSchemeList = schemeList.Where(ps => ps.SkuId == productSku.Id).ToList(); |
|||
if (currentSchemeList == null || currentSchemeList.Count() == 0) |
|||
{ |
|||
list.Add(new ProductSkuWithSchemeResponse() |
|||
{ |
|||
Id = productSku.Id, |
|||
SkuId = productSku.Id, |
|||
ProductId = productSku.ProductId, |
|||
CreateTime = productSku.CreateTime, |
|||
Logo = productSku.Logo, |
|||
Price = productSku.Price, |
|||
Title = productSku.Title, |
|||
State = productSku.State |
|||
}); |
|||
} |
|||
else |
|||
{ |
|||
foreach (var currentScheme in currentSchemeList) |
|||
{ |
|||
list.Add(new ProductSkuWithSchemeResponse() |
|||
{ |
|||
Id = $"{productSku.Id}_{currentScheme.PurchaseSchemeId}", |
|||
SkuId = productSku.Id, |
|||
ProductId = productSku.ProductId, |
|||
CreateTime = productSku.CreateTime, |
|||
Logo = productSku.Logo, |
|||
Price = productSku.Price, |
|||
Title = productSku.Title, |
|||
State = productSku.State, |
|||
PurchaserName = currentScheme.PurchaserName, |
|||
PurchasePlatform = currentScheme.PurchasePlatform, |
|||
PurchaserId = currentScheme.PurchaserId, |
|||
PurchaseSchemeId = currentScheme.PurchaseSchemeId |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
return list; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 预览订单
|
|||
/// </summary>
|
|||
/// <param name="request"></param>
|
|||
/// <returns></returns>
|
|||
/// <exception cref="BusinessException"></exception>
|
|||
public PreviewOrderResponse PreviewOrder(BatchPurchasePreviewOrderRequest request) |
|||
{ |
|||
/* |
|||
记录报价日志 |
|||
*/ |
|||
|
|||
if (request.ProductParamList == null || request.ProductParamList.Count() == 0) |
|||
throw new BusinessException("缺少商品参数"); |
|||
if (request.Consignee == null || |
|||
string.IsNullOrEmpty(request.Consignee.Address) || |
|||
string.IsNullOrEmpty(request.Consignee.Mobile) || |
|||
string.IsNullOrEmpty(request.Consignee.ContactName)) |
|||
throw new BusinessException("缺少收货人信息"); |
|||
if (request.PurchaseAccountList == null || request.PurchaseAccountList.Count() == 0) |
|||
throw new BusinessException("缺少采购账号"); |
|||
|
|||
var skuGroups = request.ProductParamList.GroupBy(p => p.BelongSkuId); |
|||
var extJArray = new List<object>(); |
|||
var errorBuilder = new StringBuilder(); |
|||
var freightAmount = 0M; |
|||
var productAmount = 0M; |
|||
var totalAmount = 0M; |
|||
|
|||
|
|||
foreach (var skuGroup in skuGroups) |
|||
{ |
|||
var productParamList = skuGroup.ToList(); |
|||
try |
|||
{ |
|||
var purchasePlatform = productParamList.FirstOrDefault().PurchasePlatform; |
|||
var purchaseAccount = request.PurchaseAccountList.FirstOrDefault(pa => pa.PurchasePlatformId == purchasePlatform); |
|||
|
|||
if (purchaseAccount == null) |
|||
throw new BusinessException($"缺少{purchasePlatform}采购平台账号,请在店铺配置中设置"); |
|||
|
|||
var platformSDKBusiness = platformSDKBusinessList.FirstOrDefault(p => p.Platform == purchasePlatform); |
|||
var previewOrderResponse = platformSDKBusiness.PreviewOrder(new PreviewOrderReuqest() |
|||
{ |
|||
AppKey = purchaseAccount.AppKey, |
|||
AppSecret = purchaseAccount.AppSecret, |
|||
AppToken = purchaseAccount.AppToken, |
|||
Consignee = request.Consignee, |
|||
Platform = purchasePlatform, |
|||
PurchaseOrderMode = request.PurchaseOrderMode, |
|||
CargoParamList = productParamList.Select(p => new CargoParamRequest() |
|||
{ |
|||
ProductId = p.PurchaseProductId, |
|||
SkuId = p.PurchaseSkuId, |
|||
Quantity = p.Quantity, |
|||
SpecId = p.PurchaseSpecId |
|||
}).ToList() |
|||
}); |
|||
|
|||
if (purchasePlatform == Enums.Platform.拳探) |
|||
extJArray.Add(new { BelongSkuId = skuGroup.Key, CardId = previewOrderResponse.Extensions }); |
|||
else if (purchasePlatform == Enums.Platform.阿里巴巴) |
|||
extJArray.Add(new { BelongSkuId = skuGroup.Key, OrderTradeTypeCode = previewOrderResponse.OrderTradeType?.Code }); |
|||
|
|||
freightAmount += previewOrderResponse.FreightAmount; |
|||
productAmount += previewOrderResponse.ProductAmount; |
|||
totalAmount += previewOrderResponse.TotalAmount; |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
errorBuilder.AppendLine($"采购商:{productParamList.FirstOrDefault().PurchaserName}"); |
|||
errorBuilder.AppendLine($"店铺SkuId:{skuGroup.Key}"); |
|||
errorBuilder.AppendLine(ex.Message); |
|||
throw new BusinessException(errorBuilder.ToString()); |
|||
} |
|||
} |
|||
|
|||
return new PreviewOrderResponse() |
|||
{ |
|||
Extensions = JsonConvert.SerializeObject(extJArray), |
|||
FreightAmount = freightAmount, |
|||
ProductAmount = productAmount, |
|||
TotalAmount = totalAmount |
|||
}; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 创建订单
|
|||
/// </summary>
|
|||
/// <param name="request"></param>
|
|||
public BatchCreareOrderResponse BatchCreateOrder(BatchPurchaseCreateOrderRequest request) |
|||
{ |
|||
/* |
|||
下单报价日志 |
|||
*/ |
|||
|
|||
if (request.ProductParamList == null || request.ProductParamList.Count() == 0) |
|||
throw new BusinessException("缺少商品参数"); |
|||
if (request.Consignee == null || |
|||
string.IsNullOrEmpty(request.Consignee.Address) || |
|||
string.IsNullOrEmpty(request.Consignee.Mobile) || |
|||
string.IsNullOrEmpty(request.Consignee.ContactName)) |
|||
throw new BusinessException("缺少收货人信息"); |
|||
if (request.PurchaseAccountList == null || request.PurchaseAccountList.Count() == 0) |
|||
throw new BusinessException("缺少采购账号"); |
|||
|
|||
var successSkuIdList = new List<string>(); |
|||
var failSkuList = new List<BatchCreareOrderFailDetail>(); |
|||
|
|||
var extJArray = JsonConvert.DeserializeObject<JArray>(request.Extensions); |
|||
var skuGroups = request.ProductParamList.GroupBy(p => p.BelongSkuId); |
|||
|
|||
foreach (var skuGroup in skuGroups) |
|||
{ |
|||
var productParamList = skuGroup.ToList(); |
|||
try |
|||
{ |
|||
var firstProductParam = productParamList.FirstOrDefault(); |
|||
|
|||
|
|||
var purchaseAccount = request.PurchaseAccountList.FirstOrDefault(pa => pa.PurchasePlatformId == firstProductParam.PurchasePlatform); |
|||
var platformSDKBusiness = platformSDKBusinessList.FirstOrDefault(p => p.Platform == firstProductParam.PurchasePlatform); |
|||
string tradeMode = "", cardId = ""; |
|||
|
|||
var extJson = extJArray.FirstOrDefault(j => j.Value<string>("BelongSkuId") == skuGroup.Key); |
|||
if (firstProductParam.PurchasePlatform == Enums.Platform.拳探) |
|||
cardId = extJson.Value<string>("CardId"); |
|||
else if (firstProductParam.PurchasePlatform == Enums.Platform.阿里巴巴) |
|||
tradeMode = extJson.Value<string>("OrderTradeTypeCode"); |
|||
|
|||
var createOrderResponse = platformSDKBusinessList.FirstOrDefault(p => p.Platform == firstProductParam.PurchasePlatform) |
|||
.FastCreateOrder(new CreateOnlinePurchaseOrderRequest() |
|||
{ |
|||
AppKey = purchaseAccount.AppKey, |
|||
AppSecret = purchaseAccount.AppSecret, |
|||
AppToken = purchaseAccount.AppToken, |
|||
Platform = firstProductParam.PurchasePlatform, |
|||
Consignee = request.Consignee, |
|||
PurchaseOrderMode = request.PurchaseOrderMode, |
|||
Remark = request.Remark, |
|||
SourceShopName = request.ShopName, |
|||
SourceSku = skuGroup.Key, |
|||
CargoParamList = productParamList.Select(p => new CargoParamRequest() |
|||
{ |
|||
ProductId = p.PurchaseProductId, |
|||
SkuId = p.PurchaseSkuId, |
|||
Quantity = p.Quantity, |
|||
SpecId = p.PurchaseSpecId |
|||
}).ToList(), |
|||
TradeMode = tradeMode, |
|||
Extensions = cardId |
|||
}); |
|||
|
|||
|
|||
|
|||
|
|||
var purchaseOrderSimpleInfo = platformSDKBusinessList.FirstOrDefault(p => p.Platform == firstProductParam.PurchasePlatform).GetOrderSimpleInfo(new GetOrderInfoRequest() |
|||
{ |
|||
AppKey = purchaseAccount.AppKey, |
|||
AppSecret = purchaseAccount.AppSecret, |
|||
AppToken = purchaseAccount.AppToken, |
|||
OrderId = createOrderResponse.PurchaseOrderId, |
|||
Platform = firstProductParam.PurchasePlatform |
|||
}); |
|||
|
|||
var purchaseOrderV2 = new PurchaseOrderV2() |
|||
{ |
|||
Id = createOrderResponse.PurchaseOrderId, |
|||
ShopId = request.ShopId, |
|||
OrderState = createOrderResponse.IsPay ? Enums.PurchaseOrderState.待发货 : Enums.PurchaseOrderState.待付款, |
|||
PurchasePlatform = firstProductParam.PurchasePlatform, |
|||
ConsigneeContactName = request.Consignee.ContactName, |
|||
ConsigneeMobile = request.Consignee.Mobile, |
|||
ConsigneeProvince = request.Consignee.Province, |
|||
ConsigneeCity = request.Consignee.City, |
|||
ConsigneeCounty = request.Consignee.County, |
|||
ConsigneeTown = request.Consignee.Town, |
|||
ConsigneeAddress = request.Consignee.Address, |
|||
PurchaserId = firstProductParam.PurchaserId, |
|||
PurchaserName = firstProductParam.PurchaserName, |
|||
PurchaseAccountId = purchaseAccount.Id, |
|||
PurchaseAmount = purchaseOrderSimpleInfo.TotalAmount, |
|||
ProductAmount = purchaseOrderSimpleInfo.ProductAmount, |
|||
PurchaseFreight = purchaseOrderSimpleInfo.FreightAmount, |
|||
Remark = request.Remark, |
|||
CreateTime = DateTime.Now, |
|||
PurchaseMethod = Enums.PurchaseMethod.线上采购, |
|||
PurchaseOrderMode = request.PurchaseOrderMode |
|||
}; |
|||
if (createOrderResponse.IsPay) |
|||
purchaseOrderV2.PayTime = DateTime.Now; |
|||
|
|||
var purchaseOrderSku = new PurchaseOrderSku() |
|||
{ |
|||
Id = idGenerator.NewLong(), |
|||
ShopId = request.ShopId, |
|||
PurchaseOrderId = createOrderResponse.PurchaseOrderId, |
|||
ProductId = firstProductParam.BelongProductId, |
|||
SkuId = firstProductParam.BelongSkuId, |
|||
Price = firstProductParam.BelongPrice, |
|||
SkuTitle = firstProductParam.BelongSkuTitle, |
|||
Logo = firstProductParam.BelongLogo, |
|||
Quantity = firstProductParam.BelongQuantity, |
|||
PurchaseSchemeId = firstProductParam.BelongPurchaseSchemeId, |
|||
PurchaseSkuIds = string.Join(",", productParamList.Select(p => p.PurchaseSkuId).ToList()), |
|||
PurchaseAmount = purchaseOrderSimpleInfo.TotalAmount, |
|||
ProductAmount = purchaseOrderSimpleInfo.ProductAmount, |
|||
PurchaseFreight = purchaseOrderSimpleInfo.FreightAmount, |
|||
CreateTime = DateTime.Now |
|||
}; |
|||
|
|||
fsql.Transaction(() => |
|||
{ |
|||
fsql.Insert(purchaseOrderV2).ExecuteAffrows(); |
|||
fsql.Insert(purchaseOrderSku).ExecuteAffrows(); |
|||
}); |
|||
successSkuIdList.Add(skuGroup.Key); |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
//var errorBuilder = new StringBuilder();
|
|||
//errorBuilder.AppendLine($"采购商:{productParamList.FirstOrDefault().PurchaserName}");
|
|||
//errorBuilder.AppendLine($"店铺SkuId:{skuGroup.Key}");
|
|||
//errorBuilder.AppendLine(ex.Message);
|
|||
|
|||
failSkuList.Add(new BatchCreareOrderFailDetail() |
|||
{ |
|||
SkuId = skuGroup.Key, |
|||
ErrorMsg = ex.Message |
|||
}); |
|||
|
|||
//throw new BusinessException(errorBuilder.ToString());
|
|||
} |
|||
} |
|||
|
|||
return new BatchCreareOrderResponse() |
|||
{ |
|||
FailSkuList = failSkuList, |
|||
SuccessSkuIdList = successSkuIdList |
|||
}; |
|||
} |
|||
|
|||
public PurchaseOrderV2ListResponse GetPurchaseOrderList(SearchPurchaseOrderV2Request request) |
|||
{ |
|||
if (request.EndDate != null) |
|||
request.EndDate = request.EndDate.Value.Date.AddDays(1).AddSeconds(-1); |
|||
|
|||
var select = fsql.Select<PurchaseOrderV2>().Where(p => p.ShopId == request.ShopId); |
|||
if (!string.IsNullOrEmpty(request.PurchaseOrderId)) |
|||
{ |
|||
select = select.Where(p => p.Id == request.PurchaseOrderId); |
|||
} |
|||
else |
|||
{ |
|||
if (!string.IsNullOrEmpty(request.Spu) || !string.IsNullOrEmpty(request.Sku)) |
|||
{ |
|||
var childSelect = fsql.Select<PurchaseOrderSku>().As("posku") |
|||
.WhereIf(!string.IsNullOrEmpty(request.Sku), posku => posku.SkuId == request.Sku) |
|||
.WhereIf(!string.IsNullOrEmpty(request.Spu), posku => posku.ProductId == request.Spu); |
|||
|
|||
select = select.Where(p => childSelect.Where(posku => posku.PurchaseOrderId == p.Id).Any()); |
|||
} |
|||
select = select.WhereIf(request.PurchaserName != null, p => p.PurchaserName == request.PurchaserName) |
|||
.WhereIf(request.PurchaseOrderState != null, p => p.OrderState == request.PurchaseOrderState) |
|||
.WhereIf(request.StartDate != null, p => p.CreateTime >= request.StartDate) |
|||
.WhereIf(request.EndDate != null, p => p.CreateTime <= request.EndDate); |
|||
} |
|||
var purchaseOrderList = select.OrderByDescending(p => p.CreateTime) |
|||
.Count(out var total) |
|||
.Page(request.PageIndex, request.PageSize) |
|||
.ToList<PurchaseOrderV2Response>(); |
|||
|
|||
var purchaseOrderIdList = purchaseOrderList.Select(p => p.Id).ToList(); |
|||
var purchaseOrderSkuList = fsql.Select<PurchaseOrderSku>().Where(posku => purchaseOrderIdList.Contains(posku.PurchaseOrderId)).ToList<PurchaseOrderSkuResponse>(); |
|||
foreach (var purchaseOrder in purchaseOrderList) |
|||
purchaseOrder.ItemList = purchaseOrderSkuList.Where(posku => posku.PurchaseOrderId == purchaseOrder.Id).ToList(); |
|||
return new PurchaseOrderV2ListResponse() { Count = total, ItemList = purchaseOrderList }; |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,122 @@ |
|||
using FreeSql.DataAnnotations; |
|||
using Newtonsoft.Json; |
|||
using System; |
|||
|
|||
namespace BBWY.Server.Model.Db |
|||
{ |
|||
|
|||
/// <summary>
|
|||
/// 采购商品表
|
|||
/// </summary>
|
|||
[Table(Name = "purchaseordersku", DisableSyncStructure = true)] |
|||
public partial class PurchaseOrderSku |
|||
{ |
|||
[Column(IsPrimary = true)] |
|||
public long Id { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 打包耗材费
|
|||
/// </summary>
|
|||
[Column(DbType = "decimal(18,2)")] |
|||
public decimal? ConsumableAmount { get; set; } = 0.00M; |
|||
|
|||
/// <summary>
|
|||
/// 创建时间
|
|||
/// </summary>
|
|||
[Column(DbType = "datetime")] |
|||
public DateTime? CreateTime { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 头程运费
|
|||
/// </summary>
|
|||
[Column(DbType = "decimal(18,2)")] |
|||
public decimal? FirstFreight { get; set; } = 0.00M; |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 入仓费
|
|||
/// </summary>
|
|||
[Column(DbType = "decimal(18,2)")] |
|||
public decimal? InStorageAmount { get; set; } = 0.00M; |
|||
|
|||
/// <summary>
|
|||
/// Sku Logo
|
|||
/// </summary>
|
|||
|
|||
public string Logo { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 单价
|
|||
/// </summary>
|
|||
[Column(DbType = "decimal(18,2)")] |
|||
public decimal? Price { get; set; } = 0.00M; |
|||
|
|||
/// <summary>
|
|||
/// 采购货款
|
|||
/// </summary>
|
|||
[Column(DbType = "decimal(18,2)")] |
|||
public decimal? ProductAmount { get; set; } |
|||
|
|||
[Column(StringLength = 100)] |
|||
public string ProductId { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 采购金额(采购货款+采购运费)
|
|||
/// </summary>
|
|||
[Column(DbType = "decimal(18,2)")] |
|||
public decimal? PurchaseAmount { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 采购运费
|
|||
/// </summary>
|
|||
[Column(DbType = "decimal(18,2)")] |
|||
public decimal? PurchaseFreight { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 采购单Id
|
|||
/// </summary>
|
|||
[Column(StringLength = 100)] |
|||
public string PurchaseOrderId { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 采购方案Id
|
|||
/// </summary>
|
|||
|
|||
public long? PurchaseSchemeId { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 采购SkuId串
|
|||
/// </summary>
|
|||
[Column(StringLength = 500)] |
|||
public string PurchaseSkuIds { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 质检费
|
|||
/// </summary>
|
|||
[Column(DbType = "decimal(18,2)")] |
|||
public decimal? QualityInspectionAmount { get; set; } = 0.00M; |
|||
|
|||
/// <summary>
|
|||
/// 采购数量
|
|||
/// </summary>
|
|||
|
|||
public int? Quantity { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 店铺Id
|
|||
/// </summary>
|
|||
|
|||
public long? ShopId { get; set; } |
|||
|
|||
[Column(StringLength = 100)] |
|||
public string SkuId { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// Sku标题
|
|||
/// </summary>
|
|||
|
|||
public string SkuTitle { get; set; } |
|||
|
|||
} |
|||
|
|||
} |
@ -0,0 +1,208 @@ |
|||
using FreeSql.DataAnnotations; |
|||
using Newtonsoft.Json; |
|||
using System; |
|||
|
|||
namespace BBWY.Server.Model.Db |
|||
{ |
|||
|
|||
/// <summary>
|
|||
/// 采购单表
|
|||
/// </summary>
|
|||
[Table(Name = "purchaseorderv2", DisableSyncStructure = true)] |
|||
public partial class PurchaseOrderV2 |
|||
{ |
|||
|
|||
/// <summary>
|
|||
/// 采购单号
|
|||
/// </summary>
|
|||
[Column(StringLength = 100, IsPrimary = true, IsNullable = false)] |
|||
public string Id { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 完成时间
|
|||
/// </summary>
|
|||
[Column(DbType = "datetime")] |
|||
public DateTime? CompletionTime { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 收货详细地址
|
|||
/// </summary>
|
|||
|
|||
public string ConsigneeAddress { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 收货市
|
|||
/// </summary>
|
|||
[Column(StringLength = 30)] |
|||
public string ConsigneeCity { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 收货联系人名称
|
|||
/// </summary>
|
|||
[Column(StringLength = 50)] |
|||
public string ConsigneeContactName { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 收货区
|
|||
/// </summary>
|
|||
[Column(StringLength = 30)] |
|||
public string ConsigneeCounty { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 收货联系人电话
|
|||
/// </summary>
|
|||
[Column(StringLength = 50)] |
|||
public string ConsigneeMobile { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 收货省
|
|||
/// </summary>
|
|||
[Column(StringLength = 30)] |
|||
public string ConsigneeProvince { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 收货镇
|
|||
/// </summary>
|
|||
[Column(StringLength = 30)] |
|||
public string ConsigneeTown { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 打包耗材费
|
|||
/// </summary>
|
|||
[Column(DbType = "decimal(18,2)")] |
|||
public decimal? ConsumableAmount { get; set; } = 0.00M; |
|||
|
|||
/// <summary>
|
|||
/// 创建时间
|
|||
/// </summary>
|
|||
[Column(DbType = "datetime")] |
|||
public DateTime? CreateTime { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 快递公司
|
|||
/// </summary>
|
|||
[Column(StringLength = 100)] |
|||
public string ExpressName { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 头程运费
|
|||
/// </summary>
|
|||
[Column(DbType = "decimal(18,2)")] |
|||
public decimal? FirstFreight { get; set; } = 0.00M; |
|||
|
|||
/// <summary>
|
|||
/// 入仓费
|
|||
/// </summary>
|
|||
[Column(DbType = "decimal(18,2)")] |
|||
public decimal? InStorageAmount { get; set; } = 0.00M; |
|||
|
|||
/// <summary>
|
|||
/// 是否转入库存
|
|||
/// </summary>
|
|||
|
|||
public bool? IsConvertToStock { get; set; } = false; |
|||
|
|||
/// <summary>
|
|||
/// 是否订阅快递100
|
|||
/// </summary>
|
|||
|
|||
public bool? IsSubscribeKuaiDi100 { get; set; } = false; |
|||
|
|||
/// <summary>
|
|||
/// 采购单状态(待付款=0,待发货=1,待收货=2,待质检=3,待打包=4,待结算=5,已完成=6)
|
|||
/// </summary>
|
|||
[Column(MapType = typeof(int?))] |
|||
public Enums.PurchaseOrderState? OrderState { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 支付时间
|
|||
/// </summary>
|
|||
[Column(DbType = "datetime")] |
|||
public DateTime? PayTime { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 采购货款
|
|||
/// </summary>
|
|||
[Column(DbType = "decimal(18,2)")] |
|||
public decimal? ProductAmount { get; set; } = 0.00M; |
|||
|
|||
/// <summary>
|
|||
/// 采购账号Id
|
|||
/// </summary>
|
|||
|
|||
public long? PurchaseAccountId { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 采购金额(采购货款+采购运费)
|
|||
/// </summary>
|
|||
[Column(DbType = "decimal(18,2)")] |
|||
public decimal? PurchaseAmount { get; set; } = 0.00M; |
|||
|
|||
/// <summary>
|
|||
/// 采购运费
|
|||
/// </summary>
|
|||
[Column(DbType = "decimal(18,2)")] |
|||
public decimal? PurchaseFreight { get; set; } = 0.00M; |
|||
|
|||
/// <summary>
|
|||
/// 采购平台
|
|||
/// </summary>
|
|||
[Column(MapType = typeof(int?))] |
|||
public Enums.Platform? PurchasePlatform { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 商家Id
|
|||
/// </summary>
|
|||
[Column(StringLength = 20)] |
|||
public string PurchaserId { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 商家名称
|
|||
/// </summary>
|
|||
[Column(StringLength = 100)] |
|||
public string PurchaserName { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 质检费
|
|||
/// </summary>
|
|||
[Column(DbType = "decimal(18,2)")] |
|||
public decimal? QualityInspectionAmount { get; set; } = 0.00M; |
|||
|
|||
/// <summary>
|
|||
/// 备注信息
|
|||
/// </summary>
|
|||
|
|||
public string Remark { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 店铺Id
|
|||
/// </summary>
|
|||
|
|||
public long ShopId { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 签收时间
|
|||
/// </summary>
|
|||
[Column(DbType = "datetime")] |
|||
public DateTime? SignTime { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 快递单号
|
|||
/// </summary>
|
|||
[Column(StringLength = 100)] |
|||
public string WaybillNo { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 采购方式(线上=0, 线下=1)
|
|||
/// </summary>
|
|||
[Column(MapType = typeof(int))] |
|||
public Enums.PurchaseMethod PurchaseMethod { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 采购单模式 批发 = 0,代发 = 1
|
|||
/// </summary>
|
|||
[Column(MapType = typeof(int))] |
|||
public Enums.PurchaseOrderMode PurchaseOrderMode { get; set; } |
|||
} |
|||
|
|||
} |
@ -0,0 +1,19 @@ |
|||
namespace BBWY.Server.Model.Dto |
|||
{ |
|||
public class BatchPurchaseCreateOrderRequest : BatchPurchasePreviewOrderRequest |
|||
{ |
|||
/// <summary>
|
|||
/// 扩展字段 ,格式参考报价接口返回值
|
|||
/// </summary>
|
|||
public string Extensions { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 下单备注
|
|||
/// </summary>
|
|||
public string Remark { get; set; } |
|||
|
|||
public long ShopId { get; set; } |
|||
|
|||
public string ShopName { get; set; } |
|||
} |
|||
} |
@ -0,0 +1,43 @@ |
|||
using BBWY.Server.Model.Db; |
|||
using System.Collections.Generic; |
|||
|
|||
namespace BBWY.Server.Model.Dto |
|||
{ |
|||
public class BatchPurchasePreviewOrderRequest |
|||
{ |
|||
public Enums.PurchaseOrderMode PurchaseOrderMode { get; set; } |
|||
|
|||
public IList<PurchaseAccount> PurchaseAccountList { get; set; } |
|||
|
|||
public ConsigneeRequest Consignee { get; set; } |
|||
|
|||
public IList<BatchPurchasePreviewOrderProductParamRequest> ProductParamList { get; set; } |
|||
} |
|||
|
|||
public class BatchPurchasePreviewOrderProductParamRequest |
|||
{ |
|||
public string PurchaseProductId { get; set; } |
|||
public string PurchaseSkuId { get; set; } |
|||
public string PurchaseSpecId { get; set; } |
|||
public int Quantity { get; set; } |
|||
public string PurchaserId { get; set; } |
|||
public string PurchaserName { get; set; } |
|||
public Enums.Platform PurchasePlatform { get; set; } |
|||
|
|||
|
|||
|
|||
public string BelongSkuId { get; set; } |
|||
|
|||
public string BelongProductId { get; set; } |
|||
|
|||
public decimal BelongPrice { get; set; } |
|||
|
|||
public string BelongSkuTitle { get; set; } |
|||
|
|||
public string BelongLogo { get; set; } |
|||
|
|||
public int BelongQuantity { get; set; } |
|||
|
|||
public long BelongPurchaseSchemeId { get; set; } |
|||
} |
|||
} |
@ -0,0 +1,11 @@ |
|||
namespace BBWY.Server.Model.Dto |
|||
{ |
|||
public class SearchProductSkuAndSchemeRequest : PlatformRequest |
|||
{ |
|||
public long ShopId { get; set; } |
|||
|
|||
public string Spu { get; set; } |
|||
|
|||
public string Sku { get; set; } |
|||
} |
|||
} |
@ -0,0 +1,27 @@ |
|||
using System; |
|||
|
|||
namespace BBWY.Server.Model.Dto |
|||
{ |
|||
public class SearchPurchaseOrderV2Request |
|||
{ |
|||
public string Sku { get; set; } |
|||
|
|||
public string Spu { get; set; } |
|||
|
|||
public string PurchaseOrderId { get; set; } |
|||
|
|||
public long ShopId { get; set; } |
|||
|
|||
public string PurchaserName { get; set; } |
|||
|
|||
public Enums.PurchaseOrderState? PurchaseOrderState { get; set; } |
|||
|
|||
public int PageIndex { get; set; } |
|||
|
|||
public int PageSize { get; set; } |
|||
|
|||
public DateTime? StartDate { get; set; } |
|||
|
|||
public DateTime? EndDate { get; set; } |
|||
} |
|||
} |
@ -0,0 +1,21 @@ |
|||
using System.Collections.Generic; |
|||
|
|||
namespace BBWY.Server.Model.Dto |
|||
{ |
|||
public class BatchCreareOrderResponse |
|||
{ |
|||
/// <summary>
|
|||
/// 已经成功下单的SkuId集合
|
|||
/// </summary>
|
|||
public IList<string> SuccessSkuIdList { get; set; } |
|||
|
|||
public IList<BatchCreareOrderFailDetail> FailSkuList { get; set; } |
|||
} |
|||
|
|||
public class BatchCreareOrderFailDetail |
|||
{ |
|||
public string SkuId { get; set; } |
|||
|
|||
public string ErrorMsg { get; set; } |
|||
} |
|||
} |
@ -0,0 +1,40 @@ |
|||
using System; |
|||
|
|||
namespace BBWY.Server.Model.Dto |
|||
{ |
|||
/// <summary>
|
|||
/// 包含采购方案的Sku商品信息
|
|||
/// </summary>
|
|||
public class ProductSkuWithSchemeResponse |
|||
{ |
|||
public string Id { get; set; } |
|||
|
|||
public string SkuId { get; set; } |
|||
|
|||
public string ProductId { get; set; } |
|||
|
|||
public decimal Price { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// Sku标题
|
|||
/// </summary>
|
|||
public string Title { get; set; } |
|||
|
|||
public string Logo { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 京东Sku状态【1:上架 2:下架 4:删除】
|
|||
/// </summary>
|
|||
public int State { get; set; } |
|||
|
|||
public DateTime? CreateTime { get; set; } |
|||
|
|||
public long PurchaseSchemeId { get; set; } |
|||
|
|||
public string PurchaserId { get; set; } |
|||
|
|||
public string PurchaserName { get; set; } |
|||
|
|||
public Enums.Platform? PurchasePlatform { get; set; } |
|||
} |
|||
} |
@ -0,0 +1,8 @@ |
|||
using BBWY.Server.Model.Db; |
|||
|
|||
namespace BBWY.Server.Model.Dto |
|||
{ |
|||
public class PurchaseOrderSkuResponse : PurchaseOrderSku |
|||
{ |
|||
} |
|||
} |
@ -0,0 +1,17 @@ |
|||
using BBWY.Server.Model.Db; |
|||
using System.Collections.Generic; |
|||
|
|||
namespace BBWY.Server.Model.Dto |
|||
{ |
|||
public class PurchaseOrderV2Response : PurchaseOrderV2 |
|||
{ |
|||
public IList<PurchaseOrderSkuResponse> ItemList { get; set; } |
|||
} |
|||
|
|||
public class PurchaseOrderV2ListResponse |
|||
{ |
|||
public long Count { get; set; } |
|||
|
|||
public IList<PurchaseOrderV2Response> ItemList { get; set; } |
|||
} |
|||
} |
File diff suppressed because it is too large
File diff suppressed because it is too large
File diff suppressed because it is too large
File diff suppressed because it is too large
Loading…
Reference in new issue