|
|
@ -744,11 +744,17 @@ namespace BBWYB.Server.Business |
|
|
|
throw new BusinessException("未查询到订单"); |
|
|
|
if (order.OrderState != Enums.OrderState.待核算) |
|
|
|
throw new BusinessException("订单状态不正确,只有待核算的订单才允许核算"); |
|
|
|
var orderCost = fsql.Select<OrderCost>(orderId).ToOne(); |
|
|
|
if (orderCost == null) |
|
|
|
throw new BusinessException("未查询到订单成本"); |
|
|
|
if (Math.Abs(orderCost.Profit ?? 0) > 1M) |
|
|
|
throw new BusinessException("订单利润绝对值不能大于1"); |
|
|
|
//var orderCost = fsql.Select<OrderCost>(orderId).ToOne();
|
|
|
|
//if (orderCost == null)
|
|
|
|
// throw new BusinessException("未查询到订单成本");
|
|
|
|
//if (Math.Abs(orderCost.Profit ?? 0) > 1M)
|
|
|
|
// throw new BusinessException("订单利润绝对值不能大于1");
|
|
|
|
|
|
|
|
var orderSkuCostList = fsql.Select<OrderSkuCost>().Where(o => o.OrderId == orderId).ToList(); |
|
|
|
if (orderSkuCostList.Count() == 0) |
|
|
|
throw new BusinessException("未查询到订单sku成本"); |
|
|
|
if (orderSkuCostList.Any(osc => Math.Abs(osc.Profit ?? 0) > 1)) |
|
|
|
throw new BusinessException("订单sku利润绝对值不能大于1"); |
|
|
|
|
|
|
|
fsql.Transaction(() => |
|
|
|
{ |
|
|
|