This commit is contained in:
2026-08-13 19:19:29 +08:00
parent cca1bc002e
commit 808fabaf41
11 changed files with 176 additions and 37 deletions
@@ -114,6 +114,9 @@ public class ContainerService {
if (containerNo == null) return;
LoadingPlanEntity plan = smartLoadingRepository.planByBooking(booking.getId());
if (plan == null || plan.getPreloadPushedAt() == null || !"EDITING".equals(plan.getPlanStatus())) return;
// The PDA task and its item versions are stable work identities. A later transport-number
// correction only changes the booking display value and must not resynchronize the task.
if (loadingPickRepository.taskByPlan(plan.getId()) != null) return;
loadingPickService.begin(plan.getId(), containerNo, operatorId, operatorName,
smartLoadingRepository.items(plan.getId()));
}
@@ -423,8 +423,21 @@ public class LoadingPickService {
if (item.getPickedPackageCount() > planItem.getPackageCount()) {
throw conflict("已拣货箱数不能低于计划箱数");
}
int pickedPackageCount = count(item.getPickedPackageCount());
String itemStatus = pickedPackageCount == 0 ? "PENDING"
: pickedPackageCount == planItem.getPackageCount() ? "PICKED" : "PICKING";
if (Objects.equals(item.getPickTaskId(), taskId)
&& Objects.equals(item.getInboundId(), planItem.getInboundId())
&& Objects.equals(item.getInboundDetailId(), planItem.getInboundDetailId())
&& Objects.equals(item.getPlannedPackageCount(), planItem.getPackageCount())
&& Objects.equals(item.getItemStatus(), itemStatus)) {
return;
}
item.setPickTaskId(taskId);
item.setInboundId(planItem.getInboundId());
item.setInboundDetailId(planItem.getInboundDetailId());
item.setPlannedPackageCount(planItem.getPackageCount());
item.setItemStatus(item.getPickedPackageCount().equals(planItem.getPackageCount()) ? "PICKED" : "PICKING");
item.setItemStatus(itemStatus);
repository.update(item);
}