From 18de1194b4ccfda28318503f8c8fc0d374f5c40e Mon Sep 17 00:00:00 2001 From: shanj <18996038927@163.com> Date: Sat, 11 Nov 2023 10:18:43 +0800 Subject: [PATCH] =?UTF-8?q?sku=E8=AE=A2=E5=8D=95=E5=85=AC=E5=BC=8F?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BBWY.Server.Business/Order/OrderBusiness.cs | 20 +++++++++++-------- .../PurchaseOrder/PurchaseOrderBusiness.cs | 5 ++++- .../Sync/OrderSyncBusiness.cs | 2 +- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/BBWY.Server.Business/Order/OrderBusiness.cs b/BBWY.Server.Business/Order/OrderBusiness.cs index 23a17714..114d44bf 100644 --- a/BBWY.Server.Business/Order/OrderBusiness.cs +++ b/BBWY.Server.Business/Order/OrderBusiness.cs @@ -592,7 +592,8 @@ namespace BBWY.Server.Business SkuAmount = purchaseOrder.SingleSkuAmount * deductionQuantity, StorageAmount = purchaseOrder.SingleStorageAmount * deductionQuantity }; - orderCostDetail.SkuGrossProfit = orderSku.Price.Value * deductionQuantity - avgPreferential - (orderCostDetail.TotalCost + orderCostDetail.DeliveryExpressFreight) - orderSku.Price.Value * deductionQuantity * autoCalculationCostRequest.PlatformCommissionRatio; + //orderCostDetail.SkuGrossProfit = orderSku.Price.Value * deductionQuantity - avgPreferential - (orderCostDetail.TotalCost + orderCostDetail.DeliveryExpressFreight) - orderSku.Price.Value * deductionQuantity * autoCalculationCostRequest.PlatformCommissionRatio; + orderCostDetail.SkuGrossProfit = (orderSku.ShouldPay ?? 0M) - orderCostDetail.TotalCost - orderCostDetail.DeliveryExpressFreight; insertOrderCostDetailList.Add(orderCostDetail); } } @@ -660,7 +661,8 @@ namespace BBWY.Server.Business { osku.SkuId, osku.Price, - osku.ItemTotal + osku.ItemTotal, + osku.ShouldPay }); var avgPreferential = dbOrder.PreferentialAmount / orderSkuList.Count(); @@ -682,9 +684,10 @@ namespace BBWY.Server.Business var osku = orderSkuList.FirstOrDefault(o => o.SkuId == orderCostDetail.SkuId); if (osku != null) { - orderCostDetail.SkuGrossProfit = osku.Price.Value * orderCostDetail.DeductionQuantity - avgPreferential - - (orderCostDetail.TotalCost + orderCostDetail.DeliveryExpressFreight) - - osku.Price.Value * orderCostDetail.DeductionQuantity * manualCalculationCostRequest.PlatformCommissionRatio; + //orderCostDetail.SkuGrossProfit = osku.Price.Value * orderCostDetail.DeductionQuantity - avgPreferential - + // (orderCostDetail.TotalCost + orderCostDetail.DeliveryExpressFreight) - + // osku.Price.Value * orderCostDetail.DeductionQuantity * manualCalculationCostRequest.PlatformCommissionRatio; + orderCostDetail.SkuGrossProfit = (osku.ShouldPay ?? 0M) - orderCostDetail.TotalCost - orderCostDetail.DeliveryExpressFreight; } } @@ -940,9 +943,10 @@ namespace BBWY.Server.Business var dbOrderSku = dbOrderSkuList.FirstOrDefault(dbosku => dbosku.SkuId == relationOrderSku.SkuId); if (dbOrderSku != null) { - orderCostDetail.SkuGrossProfit = dbOrderSku.Price.Value * orderCostDetail.DeductionQuantity - avgPreferential - - (orderCostDetail.TotalCost + orderCostDetail.DeliveryExpressFreight) - - dbOrderSku.Price.Value * orderCostDetail.DeductionQuantity * relationPurchaseOrderRequestV2.PlatformCommissionRatio; + //orderCostDetail.SkuGrossProfit = dbOrderSku.Price.Value * orderCostDetail.DeductionQuantity - avgPreferential - + // (orderCostDetail.TotalCost + orderCostDetail.DeliveryExpressFreight) - + // dbOrderSku.Price.Value * orderCostDetail.DeductionQuantity * relationPurchaseOrderRequestV2.PlatformCommissionRatio; + orderCostDetail.SkuGrossProfit = (dbOrderSku.ShouldPay ?? 0M) - orderCostDetail.TotalCost - orderCostDetail.DeliveryExpressFreight; } #endregion } diff --git a/BBWY.Server.Business/PurchaseOrder/PurchaseOrderBusiness.cs b/BBWY.Server.Business/PurchaseOrder/PurchaseOrderBusiness.cs index 20d76e54..85734250 100644 --- a/BBWY.Server.Business/PurchaseOrder/PurchaseOrderBusiness.cs +++ b/BBWY.Server.Business/PurchaseOrder/PurchaseOrderBusiness.cs @@ -263,7 +263,10 @@ namespace BBWY.Server.Business //UnitCost = purchaseOrder.UnitCost, //TotalCost = currentOrderSkuProductAmount + currentOrderSkuFreightAmount//purchaseOrder.UnitCost * orderSku.ItemTotal.Value }; - orderCostDetail.SkuGrossProfit = orderSku.Price.Value * orderCostDetail.DeductionQuantity - avgPreferential - (orderCostDetail.TotalCost + orderCostDetail.DeliveryExpressFreight) - orderSku.Price.Value * orderCostDetail.DeductionQuantity * createOnlinePurchaseOrderRequest.PlatformCommissionRatio; + //orderCostDetail.SkuGrossProfit = orderSku.Price.Value * orderCostDetail.DeductionQuantity - avgPreferential - (orderCostDetail.TotalCost + orderCostDetail.DeliveryExpressFreight) - orderSku.Price.Value * orderCostDetail.DeductionQuantity * createOnlinePurchaseOrderRequest.PlatformCommissionRatio; + + orderCostDetail.SkuGrossProfit = (orderSku.ShouldPay ?? 0M) - orderCostDetail.TotalCost - orderCostDetail.DeliveryExpressFreight; + insertOrderCostDetails.Add(orderCostDetail); #endregion } diff --git a/BBWY.Server.Business/Sync/OrderSyncBusiness.cs b/BBWY.Server.Business/Sync/OrderSyncBusiness.cs index 1d559183..76f2a569 100644 --- a/BBWY.Server.Business/Sync/OrderSyncBusiness.cs +++ b/BBWY.Server.Business/Sync/OrderSyncBusiness.cs @@ -788,7 +788,7 @@ namespace BBWY.Server.Business //orderCostDetail.SkuGrossProfit = itemPrice * deductionQuantity - avgPreferential - // (orderCostDetail.TotalCost + orderCostDetail.DeliveryExpressFreight) - // itemPrice * deductionQuantity * platformCommissionRatio; - orderCostDetail.SkuGrossProfit = skuShouldPay ?? 0M - (orderCostDetail.TotalCost + orderCostDetail.DeliveryExpressFreight); + orderCostDetail.SkuGrossProfit = (skuShouldPay ?? 0M) - orderCostDetail.TotalCost - orderCostDetail.DeliveryExpressFreight; insertOrderCostDetailList.Add(orderCostDetail); } }