|
|
|
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 OrderService : BaseApiService, IDenpendency
|
|
|
|
{
|
|
|
|
public OrderService(RestApiService restApiService, GlobalContext globalContext) : base(restApiService, globalContext)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public ApiResponse<OrderListResponse> GetOrderList(string orderId,
|
|
|
|
DateTime startDate,
|
|
|
|
DateTime endDate,
|
|
|
|
OrderState? orderState,
|
|
|
|
string sku,
|
|
|
|
string productNo,
|
|
|
|
string waybill,
|
|
|
|
string contactName,
|
|
|
|
int pageIndex,
|
|
|
|
int pageSize,
|
|
|
|
long shopId,
|
|
|
|
bool onlyDF,
|
|
|
|
bool excludeSD,
|
|
|
|
bool excludeCanceled)
|
|
|
|
{
|
|
|
|
return SendRequest<OrderListResponse>(globalContext.BBYWApiHost, "api/order/getOrderList", new
|
|
|
|
{
|
|
|
|
orderId,
|
|
|
|
startDate,
|
|
|
|
EndDate = endDate.Date.AddDays(1).AddSeconds(-1),
|
|
|
|
orderState,
|
|
|
|
pageIndex,
|
|
|
|
pageSize,
|
|
|
|
shopId,
|
|
|
|
sku,
|
|
|
|
productNo,
|
|
|
|
waybill,
|
|
|
|
contactName,
|
|
|
|
onlyDF,
|
|
|
|
excludeSD,
|
|
|
|
excludeCanceled
|
|
|
|
}, null, HttpMethod.Post);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 解密收货人信息
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="orderId"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
public ApiResponse<ConsigneeSimpleResponse> DecodeConsignee(string orderId)
|
|
|
|
{
|
|
|
|
return SendRequest<ConsigneeSimpleResponse>(globalContext.BBYWApiHost, "Api/Order/DecryptConsignee", new
|
|
|
|
{
|
|
|
|
globalContext.User.Shop.Platform,
|
|
|
|
globalContext.User.Shop.AppKey,
|
|
|
|
globalContext.User.Shop.AppSecret,
|
|
|
|
globalContext.User.Shop.AppToken,
|
|
|
|
saveResponseLog = true,
|
|
|
|
orderId,
|
|
|
|
saveDb = true
|
|
|
|
}, null, HttpMethod.Post);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 自动计算成本
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="orderId"></param>
|
|
|
|
/// <param name="isSetStorageType">是否设置仓储类型</param>
|
|
|
|
/// <param name="storageType"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
public ApiResponse<object> AutoCalculationCost(string orderId, bool isSetStorageType, StorageType storageType)
|
|
|
|
{
|
|
|
|
return SendRequest<object>(globalContext.BBYWApiHost, "api/order/AutoCalculationCost", new { orderId, isSetStorageType, storageType }, null, HttpMethod.Post);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 手动计算成本
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="orderId"></param>
|
|
|
|
/// <param name="isSetStorageType">是否设置仓储类型</param>
|
|
|
|
/// <param name="storageType"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
public ApiResponse<object> ManualCalculationCost(string orderId, bool isSetStorageType, StorageType storageType, decimal purchaseCost, decimal deliveryExpressFreight)
|
|
|
|
{
|
|
|
|
return SendRequest<object>(globalContext.BBYWApiHost, "api/order/ManualCalculationCost",
|
|
|
|
new
|
|
|
|
{
|
|
|
|
orderId,
|
|
|
|
isSetStorageType,
|
|
|
|
storageType,
|
|
|
|
purchaseCost,
|
|
|
|
deliveryExpressFreight
|
|
|
|
}, null, HttpMethod.Post);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 设置刷单成本
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="orderId"></param>
|
|
|
|
/// <param name="isSetStorageType"></param>
|
|
|
|
/// <param name="sdCommissionAmount"></param>
|
|
|
|
/// <param name="deliveryExpressFreight"></param>
|
|
|
|
/// <param name="sdType"></param>
|
|
|
|
/// <param name="flag"></param>
|
|
|
|
/// <param name="venderRemark"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
public ApiResponse<object> SDCalculationCost(string orderId,
|
|
|
|
bool isSetStorageType,
|
|
|
|
decimal sdCommissionAmount,
|
|
|
|
decimal deliveryExpressFreight,
|
|
|
|
SDType sdType,
|
|
|
|
string flag,
|
|
|
|
string venderRemark)
|
|
|
|
{
|
|
|
|
return SendRequest<object>(globalContext.BBYWApiHost, "api/order/SDCalculationCost", new
|
|
|
|
{
|
|
|
|
orderId,
|
|
|
|
isSetStorageType,
|
|
|
|
flag,
|
|
|
|
venderRemark,
|
|
|
|
sdType,
|
|
|
|
sdCommissionAmount,
|
|
|
|
deliveryExpressFreight,
|
|
|
|
Platform = globalContext.User.Shop.Platform,
|
|
|
|
AppKey = globalContext.User.Shop.AppKey,
|
|
|
|
AppSecret = globalContext.User.Shop.AppSecret,
|
|
|
|
AppToken = globalContext.User.Shop.AppToken
|
|
|
|
}, null, HttpMethod.Post);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 关联代发订单
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="orderDropShipping"></param>
|
|
|
|
/// <param name="relationPurchaseOrderSkuList"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
public ApiResponse<object> RelationPurchaseOrder(OrderDropShipping orderDropShipping, IList<RelationPurchaseOrderSku> relationPurchaseOrderSkuList)
|
|
|
|
{
|
|
|
|
return SendRequest<object>(globalContext.BBYWApiHost, "api/order/RelationPurchaseOrder", new
|
|
|
|
{
|
|
|
|
orderDropShipping,
|
|
|
|
relationPurchaseOrderSkuList
|
|
|
|
}, null, HttpMethod.Post);
|
|
|
|
}
|
|
|
|
|
|
|
|
public ApiResponse<object> OutStock(string orderId, string waybillNo, string logisticsId)
|
|
|
|
{
|
|
|
|
return SendRequest<object>(globalContext.BBYWApiHost, "api/order/outstock", new
|
|
|
|
{
|
|
|
|
orderId,
|
|
|
|
waybillNo,
|
|
|
|
logisticsId,
|
|
|
|
Platform = globalContext.User.Shop.Platform,
|
|
|
|
AppKey = globalContext.User.Shop.AppKey,
|
|
|
|
AppSecret = globalContext.User.Shop.AppSecret,
|
|
|
|
AppToken = globalContext.User.Shop.AppToken
|
|
|
|
}, null, HttpMethod.Post);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|