|
|
@ -425,6 +425,9 @@ namespace BBWY.Server.Business |
|
|
|
/// <param name="autoCalculationCostRequest"></param>
|
|
|
|
public void AutoCalculationCost(AutoCalculationCostRequest autoCalculationCostRequest) |
|
|
|
{ |
|
|
|
if (autoCalculationCostRequest.PlatformCommissionRatio == 0M) |
|
|
|
autoCalculationCostRequest.PlatformCommissionRatio = 0.05M; |
|
|
|
|
|
|
|
var dbOrder = fsql.Select<Order>(autoCalculationCostRequest.OrderId).ToOne(); |
|
|
|
if (dbOrder == null) |
|
|
|
throw new BusinessException($"订单号{autoCalculationCostRequest.OrderId}不存在"); |
|
|
@ -519,15 +522,13 @@ namespace BBWY.Server.Business |
|
|
|
SkuAmount = purchaseOrder.SingleSkuAmount * deductionQuantity, |
|
|
|
StorageAmount = purchaseOrder.SingleStorageAmount * deductionQuantity |
|
|
|
}; |
|
|
|
orderCostDetail.SkuGrossProfit = orderSku.Price.Value * deductionQuantity - (orderCostDetail.TotalCost + orderCostDetail.DeliveryExpressFreight); |
|
|
|
orderCostDetail.SkuGrossProfit = orderSku.Price.Value * deductionQuantity - (orderCostDetail.TotalCost + orderCostDetail.DeliveryExpressFreight) - orderSku.Price.Value * deductionQuantity * autoCalculationCostRequest.PlatformCommissionRatio; |
|
|
|
insertOrderCostDetailList.Add(orderCostDetail); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (orderCost == null) |
|
|
|
{ |
|
|
|
if (autoCalculationCostRequest.PlatformCommissionRatio == 0M) |
|
|
|
autoCalculationCostRequest.PlatformCommissionRatio = 0.05M; |
|
|
|
#region 计算成本
|
|
|
|
orderCost = new OrderCost() |
|
|
|
{ |
|
|
@ -584,6 +585,8 @@ namespace BBWY.Server.Business |
|
|
|
/// <exception cref="BusinessException"></exception>
|
|
|
|
public void ManualCalculationCost(ManualCalculationCostRequest manualCalculationCostRequest) |
|
|
|
{ |
|
|
|
if (manualCalculationCostRequest.PlatformCommissionRatio == 0M) |
|
|
|
manualCalculationCostRequest.PlatformCommissionRatio = 0.05M; |
|
|
|
var dbOrder = fsql.Select<Order>(manualCalculationCostRequest.OrderId).ToOne(); |
|
|
|
if (dbOrder == null) |
|
|
|
throw new BusinessException($"订单号{manualCalculationCostRequest.OrderId}不存在"); |
|
|
@ -617,7 +620,8 @@ namespace BBWY.Server.Business |
|
|
|
if (osku != null) |
|
|
|
{ |
|
|
|
orderCostDetail.SkuGrossProfit = osku.Price.Value * orderCostDetail.DeductionQuantity - |
|
|
|
(orderCostDetail.TotalCost + orderCostDetail.DeliveryExpressFreight); |
|
|
|
(orderCostDetail.TotalCost + orderCostDetail.DeliveryExpressFreight) * |
|
|
|
osku.Price.Value * orderCostDetail.DeductionQuantity * manualCalculationCostRequest.PlatformCommissionRatio; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -627,8 +631,6 @@ namespace BBWY.Server.Business |
|
|
|
var orderCost = fsql.Select<OrderCost>(manualCalculationCostRequest.OrderId).ToOne(); |
|
|
|
if (orderCost == null) |
|
|
|
{ |
|
|
|
if (manualCalculationCostRequest.PlatformCommissionRatio == 0M) |
|
|
|
manualCalculationCostRequest.PlatformCommissionRatio = 0.05M; |
|
|
|
orderCost = new OrderCost() |
|
|
|
{ |
|
|
|
OrderId = manualCalculationCostRequest.OrderId, |
|
|
|