|
@@ -903,10 +903,12 @@ public class KwtWaybillOrderV1Service {
|
|
|
List<KwtLogisticsOrderAmount> logisticsOrderAmounts = logisticsOrderAmountDao.findByAddress(queryAmount);
|
|
List<KwtLogisticsOrderAmount> logisticsOrderAmounts = logisticsOrderAmountDao.findByAddress(queryAmount);
|
|
|
for (KwtLogisticsOrderAmount orderAmount : logisticsOrderAmounts) {
|
|
for (KwtLogisticsOrderAmount orderAmount : logisticsOrderAmounts) {
|
|
|
BigDecimal truckEntrustAmount = truckTotalEntrustAmount.get(orderAmount.getLAddressId());
|
|
BigDecimal truckEntrustAmount = truckTotalEntrustAmount.get(orderAmount.getLAddressId());
|
|
|
- //当前下游司机委派量 + 历史下游司机委派量 + 分包量
|
|
|
|
|
- BigDecimal actualAmount = truckEntrustAmount.add(entrustAmountTotal);
|
|
|
|
|
- if (actualAmount.doubleValue() > orderAmount.getAmount().doubleValue()) {
|
|
|
|
|
- return HttpResult.error("订单" + logisticsOrder.getLOrderNo() + "可运量小于累计派车量!");
|
|
|
|
|
|
|
+ //剩余可运量 = 当前上游委派量 - 历史下游司机委派量 - 分包量
|
|
|
|
|
+ BigDecimal surplusAmount = orderAmount.getAmount().subtract(orderAmount.getEntrustAmount()).subtract(orderAmount.getSubcontractAmount());
|
|
|
|
|
+ if (surplusAmount.doubleValue() > orderAmount.getAmount().doubleValue()) {
|
|
|
|
|
+ KwtLogisticsOrderAddress address = logisticsOrderAddressDao.selectById(orderAmount.getLAddressId());
|
|
|
|
|
+ return HttpResult.error(address.getName() + "剩余量为" + surplusAmount.doubleValue()
|
|
|
|
|
+ + ",当前累计派车量为" + truckEntrustAmount.doubleValue() +",可运量小于累计派车量则不能派车!");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|