From 77cc4205527d61a7a065de62938f806f93c0bbb2 Mon Sep 17 00:00:00 2001 From: shanji <18996038927@163.com> Date: Sun, 17 Dec 2023 17:00:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=A2=84=E4=BC=B0=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sync/OrderEstimateCostSyncBusiness.cs | 3 +- .../Sync/OrderSyncBusiness.cs | 36 ++++++++++--------- 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/BBWY.Server.Business/Sync/OrderEstimateCostSyncBusiness.cs b/BBWY.Server.Business/Sync/OrderEstimateCostSyncBusiness.cs index 79c3370e..b5121092 100644 --- a/BBWY.Server.Business/Sync/OrderEstimateCostSyncBusiness.cs +++ b/BBWY.Server.Business/Sync/OrderEstimateCostSyncBusiness.cs @@ -267,13 +267,14 @@ namespace BBWY.Server.Business { try { + var jcycStorageTypeList = new List() { Enums.StorageType.京仓, Enums.StorageType.云仓 }; var shopId = long.Parse(shop.ShopId); var orderList = fsql.Select().Where(o => o.ShopId == shopId && o.ModifyTime >= startTime && o.ModifyTime <= endTime && !invalidOrderStateList.Contains(o.OrderState) && o.IsGift == false && - o.StorageType == null && + (o.StorageType == null || jcycStorageTypeList.Contains(o.StorageType)) && !fsql.Select().Where(oc => oc.OrderId == o.Id).Any()) .ToList(); Console.WriteLine($"预估成本-{shop.ShopName},符合条件且没有成本的订单一共{orderList.Count()}个"); diff --git a/BBWY.Server.Business/Sync/OrderSyncBusiness.cs b/BBWY.Server.Business/Sync/OrderSyncBusiness.cs index 6edcd567..bd5aab0b 100644 --- a/BBWY.Server.Business/Sync/OrderSyncBusiness.cs +++ b/BBWY.Server.Business/Sync/OrderSyncBusiness.cs @@ -915,23 +915,27 @@ namespace BBWY.Server.Business #endregion #region 计算成本 - orderCost = new OrderCost() + //当具备订单明细成本的时候,才为其创建订单成本 + if (insertOrderCostDetailList.Any(iocd => iocd.OrderId == orderId)) { - OrderId = orderId, - PlatformCommissionRatio = platformCommissionRatio, - PreferentialAmount = (dbOrderTotal?.TotalPingTaiChengDanYouHuiQuan) ?? dbOrder.PreferentialAmount, - Profit = 0, - PurchaseAmount = orderCostPurchaseAmount, - DeliveryExpressFreight = orderDeliveryExpressFreight, - CreateTime = DateTime.Now, - IsEstimateCost = false - }; - if (dbOrder.OrderTotalPrice != 0) - orderCost.CalculationOrderProfitAndCost(dbOrder, null); - else - orderCost.CalculationOrderProfitAndCost(actualAmount, null); - - insertOrderCostList.Add(orderCost); + orderCost = new OrderCost() + { + OrderId = orderId, + PlatformCommissionRatio = platformCommissionRatio, + PreferentialAmount = (dbOrderTotal?.TotalPingTaiChengDanYouHuiQuan) ?? dbOrder.PreferentialAmount, + Profit = 0, + PurchaseAmount = orderCostPurchaseAmount, + DeliveryExpressFreight = orderDeliveryExpressFreight, + CreateTime = DateTime.Now, + IsEstimateCost = false + }; + if (dbOrder.OrderTotalPrice != 0) + orderCost.CalculationOrderProfitAndCost(dbOrder, null); + else + orderCost.CalculationOrderProfitAndCost(actualAmount, null); + + insertOrderCostList.Add(orderCost); + } #endregion } }