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 } }