|
|
|
using BBWYB.Client.Models;
|
|
|
|
using BBWYB.Common.Http;
|
|
|
|
using BBWYB.Common.Models;
|
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Net.Http;
|
|
|
|
|
|
|
|
namespace BBWYB.Client.APIServices
|
|
|
|
{
|
|
|
|
public class PurchaseOrderService : BaseApiService, IDenpendency
|
|
|
|
{
|
|
|
|
public PurchaseOrderService(RestApiService restApiService, GlobalContext globalContext) : base(restApiService, globalContext)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 预览订单
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="consignee"></param>
|
|
|
|
/// <param name="purchaseSchemeProductSkuList"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
public ApiResponse<PreviewOrderResponse> PreviewPurchaseOrder(Consignee consignee, IList<PurchaseSchemeProductSku> purchaseSchemeProductSkuList, Platform purchasePlatform, PurchaseAccount purchaseAccount, PurchaseOrderMode purchaseOrderMode)
|
|
|
|
{
|
|
|
|
return SendRequest<PreviewOrderResponse>(globalContext.BBYWApiHost, "api/PurchaseOrder/PreviewPurchaseOrder", new
|
|
|
|
{
|
|
|
|
purchaseOrderMode,
|
|
|
|
consignee,
|
|
|
|
CargoParamList = purchaseSchemeProductSkuList.Select(sku => new
|
|
|
|
{
|
|
|
|
ProductId = sku.PurchaseProductId,
|
|
|
|
SkuId = sku.PurchaseSkuId,
|
|
|
|
SpecId = sku.PurchaseSkuSpecId,
|
|
|
|
Quantity = sku.ItemTotal,
|
|
|
|
BelongSkuId = sku.SkuId
|
|
|
|
}),
|
|
|
|
Platform = purchasePlatform,
|
|
|
|
purchaseAccount.AppKey,
|
|
|
|
purchaseAccount.AppSecret,
|
|
|
|
purchaseAccount.AppToken,
|
|
|
|
SaveResponseLog = true
|
|
|
|
}, null, HttpMethod.Post);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 创建采购单
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="consignee"></param>
|
|
|
|
/// <param name="purchaseSchemeProductSkuList"></param>
|
|
|
|
/// <param name="purchasePlatform"></param>
|
|
|
|
/// <param name="purchaseAccount"></param>
|
|
|
|
/// <param name="purchaseOrderMode"></param>
|
|
|
|
/// <param name="tradeMode"></param>
|
|
|
|
/// <param name="remark"></param>
|
|
|
|
/// <param name="orderId"></param>
|
|
|
|
/// <param name="shopId"></param>
|
|
|
|
/// <param name="purchaseAccountId"></param>
|
|
|
|
/// <param name="buyerAccount"></param>
|
|
|
|
/// <param name="sellerAccount"></param>
|
|
|
|
/// <param name="purchaserId"></param>
|
|
|
|
/// <param name="platformCommissionRatio"></param>
|
|
|
|
/// <param name="extensions"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
public ApiResponse<object> FastCreateOrder(Consignee consignee,
|
|
|
|
IList<PurchaseSchemeProductSku> purchaseSchemeProductSkuList,
|
|
|
|
Platform purchasePlatform,
|
|
|
|
PurchaseAccount purchaseAccount,
|
|
|
|
PurchaseOrderMode purchaseOrderMode,
|
|
|
|
string remark,
|
|
|
|
string orderId,
|
|
|
|
long shopId,
|
|
|
|
string purchaserName,
|
|
|
|
string extensions)
|
|
|
|
{
|
|
|
|
return SendRequest<object>(globalContext.BBYWApiHost, "api/purchaseOrder/CreatePurchaseOrder", new
|
|
|
|
{
|
|
|
|
purchaseOrderMode,
|
|
|
|
consignee,
|
|
|
|
CargoParamList = purchaseSchemeProductSkuList.Select(sku => new
|
|
|
|
{
|
|
|
|
ProductId = sku.PurchaseProductId,
|
|
|
|
SkuId = sku.PurchaseSkuId,
|
|
|
|
SpecId = sku.PurchaseSkuSpecId,
|
|
|
|
Quantity = sku.ItemTotal,
|
|
|
|
BelongSkuId = sku.SkuId
|
|
|
|
}),
|
|
|
|
Platform = purchasePlatform,
|
|
|
|
purchaseAccount.AppKey,
|
|
|
|
purchaseAccount.AppSecret,
|
|
|
|
purchaseAccount.AppToken,
|
|
|
|
SaveResponseLog = true,
|
|
|
|
remark,
|
|
|
|
orderId,
|
|
|
|
shopId,
|
|
|
|
purchaseAccountId = purchaseAccount.Id,
|
|
|
|
purchaseAccountName = purchaseAccount.AccountName,
|
|
|
|
purchaserName,
|
|
|
|
extensions
|
|
|
|
}, null, HttpMethod.Post);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 查询审核采购单
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="shopIdList"></param>
|
|
|
|
/// <param name="startDate"></param>
|
|
|
|
/// <param name="endDate"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
public ApiResponse<IList<AuditPurchaseOrderResponse>> GetAuditPurchaseOrderList(IList<long> shopIdList, DateTime startDate, DateTime endDate)
|
|
|
|
{
|
|
|
|
return SendRequest<IList<AuditPurchaseOrderResponse>>(globalContext.BBYWApiHost, "Api/PurchaseOrder/GetAuditPurchaseOrderList", new
|
|
|
|
{
|
|
|
|
startDate,
|
|
|
|
endDate,
|
|
|
|
shopIdList
|
|
|
|
}, null, HttpMethod.Post);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|