diff --git a/blade-service/blade-transport/src/main/java/org/springblade/transport/service/impl/DriverWaybillServiceImpl.java b/blade-service/blade-transport/src/main/java/org/springblade/transport/service/impl/DriverWaybillServiceImpl.java index ae825828..9590a442 100644 --- a/blade-service/blade-transport/src/main/java/org/springblade/transport/service/impl/DriverWaybillServiceImpl.java +++ b/blade-service/blade-transport/src/main/java/org/springblade/transport/service/impl/DriverWaybillServiceImpl.java @@ -520,19 +520,32 @@ public class DriverWaybillServiceImpl implements IDriverWaybillService { nodePunchMapper.insert(punch); advanceCurrentProcessNode(waybill, nodeCfg); - // 末位打卡节点是到货/卸货/签收、且回单无需确认完成时,本次打卡一并把运单置为完成; + // 末位打卡节点是到货/卸货/签收、且运单本身允许完成时,本次打卡就是运单的去向决定点: + // 回单无需确认 → 一并完成;回单需业务员确认 → 停在待回单确认等业务员确认。 // isLastDriverPunchNode 与 returnNeedsNoConfirmation 传的就是上面那份 processJson,未再调 resolveProcessJson 取过程配置。 String nodeKey = WaybillProcessSupport.nodeKey(nodeCfg); String nodeName = WaybillProcessSupport.nodeName(nodeCfg); + String waybillBusinessStatus = waybill.getBusinessStatus(); boolean completed = false; if (WaybillProcessSupport.isLastDriverPunchNode(processJson, nodeKey) && WaybillProcessSupport.isDeliveryNode(nodeKey, nodeName) - && WaybillProcessSupport.returnNeedsNoConfirmation(processJson) && canAutoCompleteWaybill(waybill)) { - completed = waybillService.completeWithoutDeptCheck(waybill.getId()); + if (WaybillProcessSupport.returnNeedsNoConfirmation(processJson)) { + completed = waybillService.completeWithoutDeptCheck(waybill.getId()); + if (completed) { + waybillBusinessStatus = STATUS_COMPLETED; + } + } else if (WaybillProcessSupport.STATUS_RUNNING.equals(waybill.getBusinessStatus())) { + // 只有进行中能进入:canAutoCompleteWaybill 的状态口径含待执行/待调度等,不能替代这一条; + // 待回单确认在 isPunchEnded 里算已结束,不能从结束态重进。 + waybill.setBusinessStatus(WaybillProcessSupport.STATUS_PENDING_RETURN_CONFIRM); + waybillService.updateById(waybill); + waybillBusinessStatus = WaybillProcessSupport.STATUS_PENDING_RETURN_CONFIRM; + } } DriverNodePunchVO vo = toNodePunchVO(punch); vo.setWaybillCompleted(completed); + vo.setWaybillBusinessStatus(waybillBusinessStatus); return vo; }