|
|
@ -509,7 +509,9 @@ namespace BBWY.Server.Business |
|
|
|
var dbAfterSaleOrderList = fsql.Select<AfterSaleOrder>().Where(aso => aso.OrderId == autoCalculationCostRequest.OrderId).ToList(); |
|
|
|
|
|
|
|
var orderCost = fsql.Select<OrderCost>(autoCalculationCostRequest.OrderId).ToOne(); |
|
|
|
var orderCostDetails = fsql.Select<OrderCostDetail>().Where(ocd => ocd.OrderId == autoCalculationCostRequest.OrderId && ocd.IsEnabled == true).ToList(); |
|
|
|
var orderCostDetails = fsql.Select<OrderCostDetail>().Where(ocd => ocd.OrderId == autoCalculationCostRequest.OrderId && |
|
|
|
ocd.IsEnabled == true && |
|
|
|
ocd.IsEstimateCost == false).ToList(); |
|
|
|
|
|
|
|
IUpdate<Order> orderUpdate = null; |
|
|
|
IUpdate<OrderCost> updateOrderCost = null; |
|
|
@ -630,7 +632,8 @@ namespace BBWY.Server.Business |
|
|
|
Profit = 0, |
|
|
|
PurchaseAmount = orderCostPurchaseAmount, |
|
|
|
DeliveryExpressFreight = orderDeliveryExpressFreight, |
|
|
|
CreateTime = DateTime.Now |
|
|
|
CreateTime = DateTime.Now, |
|
|
|
IsEstimateCost = false |
|
|
|
}; |
|
|
|
orderCost.CalculationOrderProfitAndCost(dbOrder, dbAfterSaleOrderList); |
|
|
|
insertOrderCost = fsql.Insert(orderCost); |
|
|
@ -638,6 +641,7 @@ namespace BBWY.Server.Business |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
orderCost.IsEstimateCost = false; |
|
|
|
orderCost.PurchaseAmount += orderCostPurchaseAmount; |
|
|
|
orderCost.DeliveryExpressFreight += orderDeliveryExpressFreight; |
|
|
|
orderCost.CalculationOrderProfitAndCost(dbOrder, dbAfterSaleOrderList); |
|
|
@ -654,6 +658,12 @@ namespace BBWY.Server.Business |
|
|
|
foreach (var update in updatePurchaseOrderList) |
|
|
|
update.ExecuteAffrows(); |
|
|
|
} |
|
|
|
fsql.Update<OrderCostDetail>() |
|
|
|
.Set(ocd => ocd.IsEnabled, false) |
|
|
|
.Where(ocd => ocd.OrderId == autoCalculationCostRequest.OrderId && |
|
|
|
ocd.IsEnabled == true && |
|
|
|
ocd.IsEstimateCost == true) |
|
|
|
.ExecuteAffrows(); |
|
|
|
if (insertOrderCostDetailList.Count > 0) |
|
|
|
fsql.Insert(insertOrderCostDetailList).ExecuteAffrows(); |
|
|
|
}); |
|
|
@ -708,7 +718,7 @@ namespace BBWY.Server.Business |
|
|
|
orderCostDetail.CreateTime = DateTime.Now; |
|
|
|
orderCostDetail.OrderId = manualCalculationCostRequest.OrderId; |
|
|
|
orderCostDetail.PurchaseOrderPKId = 0; |
|
|
|
|
|
|
|
orderCostDetail.IsEstimateCost = false; |
|
|
|
var osku = orderSkuList.FirstOrDefault(o => o.SkuId == orderCostDetail.SkuId); |
|
|
|
if (osku != null) |
|
|
|
{ |
|
|
@ -745,7 +755,8 @@ namespace BBWY.Server.Business |
|
|
|
PurchaseAmount = totalPurchaseCost, |
|
|
|
DeliveryExpressFreight = totalDeliveryExpressFreight, |
|
|
|
CreateTime = DateTime.Now, |
|
|
|
IsManualEdited = true |
|
|
|
IsManualEdited = true, |
|
|
|
IsEstimateCost = false |
|
|
|
}; |
|
|
|
//orderCost.PlatformCommissionAmount = dbOrder.OrderSellerPrice * orderCost.PlatformCommissionRatio;
|
|
|
|
//orderCost.Profit = dbOrder.OrderSellerPrice +
|
|
|
@ -767,6 +778,7 @@ namespace BBWY.Server.Business |
|
|
|
// orderCost.PlatformCommissionAmount;
|
|
|
|
orderCost.CalculationOrderProfitAndCost(dbOrder, dbAfterSaleOrderList); |
|
|
|
orderCost.IsManualEdited = true; |
|
|
|
orderCost.IsEstimateCost = false; |
|
|
|
updateOrderCost = fsql.Update<OrderCost>().SetSource(orderCost); |
|
|
|
} |
|
|
|
|
|
|
@ -855,6 +867,7 @@ namespace BBWY.Server.Business |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
orderCost.IsEstimateCost = false; |
|
|
|
orderCost.SDCommissionAmount = sdCalculationCostRequest.SDCommissionAmount; |
|
|
|
orderCost.SDOrderAmount = sdCalculationCostRequest.SDOrderAmount; |
|
|
|
orderCost.DeliveryExpressFreight = sdCalculationCostRequest.DeliveryExpressFreight; |
|
|
@ -866,6 +879,7 @@ namespace BBWY.Server.Business |
|
|
|
|
|
|
|
fsql.Transaction(() => |
|
|
|
{ |
|
|
|
fsql.Update<OrderCostDetail>().Set(ocd => ocd.IsEnabled, false).Where(ocd => ocd.OrderId == sdCalculationCostRequest.OrderId).ExecuteAffrows(); |
|
|
|
orderUpdate?.ExecuteAffrows(); |
|
|
|
updateOrderCost?.ExecuteAffrows(); |
|
|
|
insertOrderCost?.ExecuteAffrows(); |
|
|
@ -1014,6 +1028,8 @@ namespace BBWY.Server.Business |
|
|
|
orderCost.PurchaseAmount - |
|
|
|
orderCost.DeliveryExpressFreight - |
|
|
|
orderCost.PlatformCommissionAmount; |
|
|
|
orderCost.IsEstimateCost = false; |
|
|
|
orderCost.IsManualEdited = true; |
|
|
|
updateOrderCost = fsql.Update<OrderCost>().SetSource(orderCost).IgnoreColumns(oc => new |
|
|
|
{ |
|
|
|
oc.CreateTime, |
|
|
|