fix(firstleg): finish only actual picked cargo owners
This commit is contained in:
@@ -165,6 +165,21 @@ public interface LoadingPickItemMapper extends BaseMapper<LoadingPickItemEntity>
|
||||
""")
|
||||
java.util.List<InboundOwner> selectInboundOwners(@Param("taskId") long taskId);
|
||||
|
||||
/** Only physical cargo owns completion checkpoints; retained SKIPPED rows are plan history. */
|
||||
@Select("""
|
||||
SELECT plan_item.account_id tenantId,plan_item.inbound_id inboundId
|
||||
FROM fl_loading_pick_item pick_item
|
||||
JOIN fl_loading_pick_task task ON task.id=pick_item.pick_task_id
|
||||
JOIN fl_loading_plan_item plan_item ON plan_item.id=pick_item.loading_plan_item_id
|
||||
AND plan_item.loading_plan_id=task.loading_plan_id AND plan_item.deleted=0
|
||||
WHERE pick_item.pick_task_id=#{taskId}
|
||||
AND pick_item.item_status IN ('PICKED','PARTIAL')
|
||||
AND pick_item.picked_package_count>0
|
||||
GROUP BY plan_item.account_id,plan_item.inbound_id
|
||||
ORDER BY plan_item.account_id,plan_item.inbound_id
|
||||
""")
|
||||
java.util.List<InboundOwner> selectCompletionOwners(@Param("taskId") long taskId);
|
||||
|
||||
record InboundOwner(Long tenantId, Long inboundId) {}
|
||||
|
||||
@Select("""
|
||||
|
||||
@@ -246,6 +246,10 @@ public class LoadingPickRepository {
|
||||
return items.selectInboundOwners(taskId);
|
||||
}
|
||||
|
||||
public List<LoadingPickItemMapper.InboundOwner> completionOwners(long taskId) {
|
||||
return items.selectCompletionOwners(taskId);
|
||||
}
|
||||
|
||||
public LoadingInboundMapper.Snapshot inbound(long tenantId, long inboundId) {
|
||||
return inbounds.find(tenantId, inboundId);
|
||||
}
|
||||
|
||||
@@ -576,7 +576,7 @@ public class LoadingPickService {
|
||||
throw conflict("存在尚未处理的PDA拣货明细,不能确认装柜完成");
|
||||
}
|
||||
if (repository.review(taskId) != null) throw conflict("PDA任务已经确认装柜完成");
|
||||
List<LoadingPickItemMapper.InboundOwner> discoveredOwners = repository.inboundOwners(taskId).stream()
|
||||
List<LoadingPickItemMapper.InboundOwner> discoveredOwners = repository.completionOwners(taskId).stream()
|
||||
.filter(owner -> owner.tenantId() != null && owner.inboundId() != null)
|
||||
.toList();
|
||||
if (discoveredOwners.isEmpty()) throw conflict("PDA任务未关联有效入库单");
|
||||
@@ -618,7 +618,7 @@ public class LoadingPickService {
|
||||
long taskId = command.getPickTaskId();
|
||||
inboundHoldGuard.requireTaskNotHeld(taskId);
|
||||
LoadingPickTaskEntity task = requiredTask(taskId);
|
||||
List<LoadingPickItemMapper.InboundOwner> owners = repository.inboundOwners(taskId).stream()
|
||||
List<LoadingPickItemMapper.InboundOwner> owners = repository.completionOwners(taskId).stream()
|
||||
.filter(owner -> owner.tenantId() != null && owner.inboundId() != null)
|
||||
.sorted(Comparator.comparing(LoadingPickItemMapper.InboundOwner::tenantId)
|
||||
.thenComparing(LoadingPickItemMapper.InboundOwner::inboundId))
|
||||
|
||||
Reference in New Issue
Block a user