ソースを参照

1、4.2派车逻辑调整;

zk 1 年間 前
コミット
fc174e4e60

+ 6 - 4
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/KwtWaybillOrderV1Service.java

@@ -903,10 +903,12 @@ public class KwtWaybillOrderV1Service {
             List<KwtLogisticsOrderAmount> logisticsOrderAmounts = logisticsOrderAmountDao.findByAddress(queryAmount);
             for (KwtLogisticsOrderAmount orderAmount : logisticsOrderAmounts) {
                 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() +",可运量小于累计派车量则不能派车!");
                 }
             }
         }