fix(firstleg): finalize loading before customs acceptance
This commit is contained in:
@@ -298,6 +298,12 @@ public class SmartLoadingService {
|
||||
LoadingPlanItemEntity item = repository.item(planId, itemId);
|
||||
if (item == null) throw new BizException(ResultCode.NOT_FOUND, "装柜明细不存在");
|
||||
if (!Objects.equals(item.getVersion(), request.expectedItemVersion())) throw conflict("装柜明细版本冲突");
|
||||
LoadingPickService.MutationSnapshot pickSnapshot = loadingPickService.mutationSnapshot(planId);
|
||||
int pickedPackageCount = pickSnapshot == null ? 0
|
||||
: pickSnapshot.pickedByPlanItem().getOrDefault(itemId, 0);
|
||||
if (request.packageCount() < pickedPackageCount) {
|
||||
throw conflict("计划箱数不能低于已拣货箱数");
|
||||
}
|
||||
ContainerBookingEntity booking = requireBooking(plan.getContainerBookingId());
|
||||
Candidate candidate = repository.candidate(booking.getWarehouseId(), item.getInboundId(), item.getInboundDetailId());
|
||||
if (candidate == null || request.packageCount() > candidate.availablePackageCount() + item.getPackageCount()) throw validation("调整箱数超过可用箱数");
|
||||
|
||||
Reference in New Issue
Block a user