|
|
@ -547,14 +547,34 @@ namespace BBWYB.Server.Business |
|
|
|
|
|
|
|
var order = orderListResponse.Items.FirstOrDefault(); |
|
|
|
var orderCost = fsql.Select<OrderCost>(request.OrderId).ToOne(); |
|
|
|
var orderCostDetailList = fsql.Select<OrderCostDetail>().Where(ocd => ocd.OrderId == request.OrderId && ocd.IsEnabled == true).ToList(); |
|
|
|
|
|
|
|
IList<IUpdate<OrderSku>> updates_orderSku = new List<IUpdate<OrderSku>>(); |
|
|
|
IUpdate<OrderCost> updateOrderCost = null; |
|
|
|
IList<IUpdate<OrderCostDetail>> updateOrderCostDetailList = new List<IUpdate<OrderCostDetail>>(); |
|
|
|
|
|
|
|
|
|
|
|
foreach (var orderSku in order.OrderSkuList) |
|
|
|
{ |
|
|
|
updates_orderSku.Add(fsql.Update<OrderSku>(orderSku.Id).Set(osku => osku.Price, orderSku.SkuPrice) |
|
|
|
.Set(osku => osku.BuyerPayFreight, orderSku.FreightAmount) |
|
|
|
.Set(osku => osku.InPackAmount, orderSku.PackAmount)); |
|
|
|
|
|
|
|
var ocdList = orderCostDetailList.Where(ocd => ocd.SkuId == orderSku.SkuId).ToList(); |
|
|
|
if (ocdList != null && ocdList.Count()>0) |
|
|
|
{ |
|
|
|
foreach (var orderCostDetail in ocdList) |
|
|
|
{ |
|
|
|
orderCostDetail.CalculationOrderCostDetailCostAndProfit(orderSku.SkuPrice * orderSku.Quantity, |
|
|
|
orderSku.FreightAmount, |
|
|
|
orderSku.PackAmount, |
|
|
|
orderCostDetail.SkuAmount ?? 0M, |
|
|
|
orderCostDetail.PurchaseFreight ?? 0M, |
|
|
|
orderCostDetail.OutPackAmount ?? 0M, |
|
|
|
orderCostDetail.DeliveryExpressFreight ?? 0M); |
|
|
|
updateOrderCostDetailList.Add(fsql.Update<OrderCostDetail>(orderCostDetail.Id).Set(ocd => ocd.Profit, orderCostDetail.Profit)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (orderCost != null) |
|
|
@ -573,6 +593,7 @@ namespace BBWYB.Server.Business |
|
|
|
fsql.Update<Order>(request.OrderId).Set(o => o.OrderTotalPrice, order.OrderTotalAmount) |
|
|
|
.Set(o => o.OrderSellerPrice, order.OrderProductAmount) |
|
|
|
.Set(o => o.FreightPrice, order.FreightAmount) |
|
|
|
.Set(o => o.InPackAmount, order.PackAmount) |
|
|
|
.ExecuteAffrows(); |
|
|
|
updateOrderCost?.ExecuteAffrows(); |
|
|
|
|
|
|
@ -581,6 +602,11 @@ namespace BBWYB.Server.Business |
|
|
|
foreach (var update in updates_orderSku) |
|
|
|
update.ExecuteAffrows(); |
|
|
|
} |
|
|
|
if (updateOrderCostDetailList.Count() > 0) |
|
|
|
{ |
|
|
|
foreach (var update in updateOrderCostDetailList) |
|
|
|
update.ExecuteAffrows(); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
#region 通知C端
|
|
|
|