✨ 待回单确认:司机列表分档、数字态、两套名称表、运次子单与总单已到达口径
This commit is contained in:
+14
-9
@@ -118,13 +118,18 @@ public class DriverWaybillServiceImpl implements IDriverWaybillService {
|
||||
private static final List<String> PENDING_STATUSES = Arrays.asList(
|
||||
STATUS_PENDING, STATUS_WAITING_DISPATCH, STATUS_DISPATCHING
|
||||
);
|
||||
/** Tab「全部」统计口径:待接 + 运输中 + 已完成(不含已取消) */
|
||||
/** Tab「全部」统计口径:待接 + 运输中 + 待回单确认 + 已完成(不含已取消) */
|
||||
private static final List<String> TAB_ALL_STATUSES = Arrays.asList(
|
||||
STATUS_PENDING, STATUS_WAITING_DISPATCH, STATUS_DISPATCHING, STATUS_RUNNING, STATUS_COMPLETED
|
||||
STATUS_PENDING, STATUS_WAITING_DISPATCH, STATUS_DISPATCHING, STATUS_RUNNING,
|
||||
WaybillProcessSupport.STATUS_PENDING_RETURN_CONFIRM, STATUS_COMPLETED
|
||||
);
|
||||
/** 允许完成运单的业务状态 */
|
||||
private static final List<String> COMPLETABLE_STATUSES = Arrays.asList(
|
||||
STATUS_RUNNING, STATUS_PENDING, STATUS_WAITING_DISPATCH, STATUS_DISPATCHING
|
||||
/**
|
||||
* 进行中口径:司机手上还没走完的单。
|
||||
* 待回单确认也算进行中——司机侧已打完末位卡,等业务员确认回单才变已完成。
|
||||
*/
|
||||
private static final List<String> ACTIVE_STATUSES = Arrays.asList(
|
||||
STATUS_RUNNING, STATUS_PENDING, STATUS_WAITING_DISPATCH, STATUS_DISPATCHING,
|
||||
WaybillProcessSupport.STATUS_PENDING_RETURN_CONFIRM
|
||||
);
|
||||
|
||||
private static final int DEFAULT_PREVIEW_SIZE = 2;
|
||||
@@ -838,7 +843,7 @@ public class DriverWaybillServiceImpl implements IDriverWaybillService {
|
||||
}
|
||||
switch (status) {
|
||||
case 0 -> wrapper.in(Waybill::getBusinessStatus, PENDING_STATUSES);
|
||||
case 1 -> wrapper.in(Waybill::getBusinessStatus, COMPLETABLE_STATUSES);
|
||||
case 1 -> wrapper.in(Waybill::getBusinessStatus, ACTIVE_STATUSES);
|
||||
case 2 -> wrapper.eq(Waybill::getBusinessStatus, STATUS_COMPLETED);
|
||||
case 3 -> wrapper.eq(Waybill::getBusinessStatus, STATUS_CANCELLED);
|
||||
default -> wrapper.in(Waybill::getBusinessStatus, TAB_ALL_STATUSES);
|
||||
@@ -1514,12 +1519,12 @@ public class DriverWaybillServiceImpl implements IDriverWaybillService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动完成的前置:业务状态允许完成,且没有未了结异常。
|
||||
* 自动完成的前置:业务状态在进行中口径内,且没有未了结异常。
|
||||
* <p>
|
||||
* 不满足返回 false,由调用方静默跳过,打卡不受影响。
|
||||
*/
|
||||
private boolean canAutoCompleteWaybill(Waybill waybill) {
|
||||
return COMPLETABLE_STATUSES.contains(waybill.getBusinessStatus())
|
||||
return ACTIVE_STATUSES.contains(waybill.getBusinessStatus())
|
||||
&& unresolvedExceptionNodeCodeList(waybill.getId()).isEmpty();
|
||||
}
|
||||
|
||||
@@ -1986,7 +1991,7 @@ public class DriverWaybillServiceImpl implements IDriverWaybillService {
|
||||
}
|
||||
return switch (businessStatus) {
|
||||
case STATUS_PENDING, STATUS_WAITING_DISPATCH, STATUS_DISPATCHING -> 0;
|
||||
case STATUS_RUNNING -> 1;
|
||||
case STATUS_RUNNING, WaybillProcessSupport.STATUS_PENDING_RETURN_CONFIRM -> 1;
|
||||
case STATUS_COMPLETED -> 2;
|
||||
case STATUS_CANCELLED -> 3;
|
||||
default -> null;
|
||||
|
||||
+12
-2
@@ -362,7 +362,7 @@ public class MasterOrderServiceImpl extends BaseServiceImpl<MasterOrderMapper, M
|
||||
Map<String, BigDecimal> dispatchedGoods = dispatchedGoods(routeWaybills, routePlans);
|
||||
route.put("dispatchedQuantity", dispatchedGoods.values().stream().reduce(BigDecimal.ZERO, BigDecimal::add));
|
||||
route.put("dispatchedGoods", dispatchedGoods);
|
||||
route.put("arrivedQuantity", routeWaybills.stream().filter(item -> "completed".equals(item.getBusinessStatus())).flatMap(item -> waybillGoods(item).stream()).map(item -> decimal(item, "quantity")).reduce(BigDecimal.ZERO, BigDecimal::add));
|
||||
route.put("arrivedQuantity", routeWaybills.stream().filter(item -> arrived(item.getBusinessStatus())).flatMap(item -> waybillGoods(item).stream()).map(item -> decimal(item, "quantity")).reduce(BigDecimal.ZERO, BigDecimal::add));
|
||||
route.put("waybills", routeWaybills);
|
||||
route.put("transportPlans", routePlans);
|
||||
}
|
||||
@@ -541,12 +541,22 @@ public class MasterOrderServiceImpl extends BaseServiceImpl<MasterOrderMapper, M
|
||||
}
|
||||
private BigDecimal completedQuantity(String masterNo, Map<String, Object> route) {
|
||||
return waybillsByMasterNo(masterNo).stream()
|
||||
.filter(item -> "completed".equals(item.getBusinessStatus()))
|
||||
.filter(item -> arrived(item.getBusinessStatus()))
|
||||
.filter(item -> belongsToRoute(item, route))
|
||||
.flatMap(item -> waybillGoods(item).stream())
|
||||
.map(item -> decimal(item, "quantity"))
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
}
|
||||
|
||||
/**
|
||||
* 已到达口径:待回单确认也算到达——货物确实到了,回单只是单据。
|
||||
* 不计入会按「调度总量不能大于上一段已到达数量」把多联总单的下一段挡在门外。
|
||||
*/
|
||||
static boolean arrived(String businessStatus) {
|
||||
return "completed".equals(businessStatus)
|
||||
|| WaybillProcessSupport.STATUS_PENDING_RETURN_CONFIRM.equals(businessStatus);
|
||||
}
|
||||
|
||||
private Map<String, BigDecimal> availableGoods(MasterOrder masterOrder) {
|
||||
Map<String, BigDecimal> available = new LinkedHashMap<>();
|
||||
for (Map<String, Object> goods : parseArray(masterOrder.getGoodsJson())) available.merge(goodsKey(goods), decimal(goods, "quantity"), BigDecimal::add);
|
||||
|
||||
+2
@@ -61,6 +61,7 @@ import org.springblade.transport.service.IFormalSettlementService;
|
||||
import org.springblade.transport.service.IPreSettlementService;
|
||||
import org.springblade.transport.service.IReceivablePayableDetailService;
|
||||
import org.springblade.transport.service.IWaybillService;
|
||||
import org.springblade.transport.support.WaybillProcessSupport;
|
||||
import org.springblade.transport.wrapper.ReceivablePayableDetailWrapper;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -3295,6 +3296,7 @@ public class ReceivablePayableDetailServiceImpl
|
||||
case "completed" -> "已完成";
|
||||
case "processing", "running", "in_progress", "inProgress" -> "进行中";
|
||||
case "pending", "created" -> "待执行";
|
||||
case WaybillProcessSupport.STATUS_PENDING_RETURN_CONFIRM -> "待回单确认";
|
||||
case "cancelled", "canceled" -> "已取消";
|
||||
default -> status;
|
||||
};
|
||||
|
||||
+3
-1
@@ -45,6 +45,7 @@ final class TripAggregation {
|
||||
static final String RUNNING = "running";
|
||||
static final String COMPLETED = "completed";
|
||||
static final String CANCELLED = "cancelled";
|
||||
static final String PENDING_RETURN_CONFIRM = WaybillProcessSupport.STATUS_PENDING_RETURN_CONFIRM;
|
||||
|
||||
/** 待接单档:与运单侧 Tab「待接单」取同一组状态 */
|
||||
static final List<String> PENDING_STATUSES = List.of(PENDING, WAITING_DISPATCH, DISPATCHING);
|
||||
@@ -53,9 +54,10 @@ final class TripAggregation {
|
||||
/**
|
||||
* 进运次的子单状态:草稿尚未派单、不成运次;已取消要进,
|
||||
* 否则「子单全已取消」会被算成运输中而不是已取消。
|
||||
* 待回单确认要进:子单漏在运次外,剩下那几张会被判成整趟车已走完。
|
||||
*/
|
||||
static final List<String> CHILD_STATUSES = List.of(
|
||||
PENDING, WAITING_DISPATCH, DISPATCHING, RUNNING, COMPLETED, CANCELLED
|
||||
PENDING, WAITING_DISPATCH, DISPATCHING, RUNNING, PENDING_RETURN_CONFIRM, COMPLETED, CANCELLED
|
||||
);
|
||||
|
||||
/** 待重新派单的口径:子单被拒且这趟车还没结束 */
|
||||
|
||||
+1
@@ -122,6 +122,7 @@ public class WaybillWrapper extends BaseEntityWrapper<Waybill, WaybillVO> {
|
||||
case "waiting_dispatch" -> "待调度";
|
||||
case "dispatching" -> "调度中";
|
||||
case "running", "processing", "in_progress", "inProgress" -> "进行中";
|
||||
case WaybillProcessSupport.STATUS_PENDING_RETURN_CONFIRM -> "待回单确认";
|
||||
case "completed" -> "已完成";
|
||||
case "cancelled" -> "已取消";
|
||||
case "closed" -> "已关闭";
|
||||
|
||||
Reference in New Issue
Block a user