Skip to content

Commit

Permalink
add candidates to picking slot queue only on "closing"
Browse files Browse the repository at this point in the history
518: Picking prototype (v6)

Task-Url: #518
  • Loading branch information
metas-ts committed Jul 24, 2017
1 parent a444203 commit 5d4575b
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/main/java/de/metas/ui/web/picking/PickingCandidateCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,9 @@ public int setCandidatesProcessed(@NonNull final List<Integer> huIds)
}

/**
* For the given {@code huIds}, this method selects the {@link I_M_Picking_Candidate}s that reference those HUs
* and have {@code status == 'PR'} (processed) and updates them to {@code status='CL'} (closed).<br>
* For the given {@code shipmentScheduleIds}, this method selects the {@link I_M_Picking_Candidate}s that reference those HUs
* and have {@code status == 'PR'} (processed) and updates them to {@code status='CL'} (closed)<br>
* <b>and</b> adds the respective candidates to the picking slot queue.<br>
* Closed candidates are not shown in the webui's picking view.
* <p>
* Note: no model interceptors etc are fired when this method is called.
Expand All @@ -280,20 +281,23 @@ public void setCandidatesClosed(@NonNull final List<Integer> shipmentScheduleIds
{
final IQueryBL queryBL = Services.get(IQueryBL.class);


final IQuery<I_M_Picking_Candidate> query = queryBL.createQueryBuilder(I_M_Picking_Candidate.class)
.addOnlyActiveRecordsFilter()
.addEqualsFilter(I_M_Picking_Candidate.COLUMNNAME_Status, X_M_Picking_Candidate.STATUS_PR)
.addInArrayFilter(I_M_Picking_Candidate.COLUMN_M_ShipmentSchedule_ID, shipmentScheduleIds)
.create();


final IHUPickingSlotBL huPickingSlotBL = Services.get(IHUPickingSlotBL.class);
huPickingSlotBL.addToPickingSlotQueue(pickingSlot, hu);


final ICompositeQueryUpdater<I_M_Picking_Candidate> updater = queryBL.createCompositeQueryUpdater(I_M_Picking_Candidate.class)
.addSetColumnValue(I_M_Picking_Candidate.COLUMNNAME_Status, X_M_Picking_Candidate.STATUS_CL);
query.updateDirectly(updater);
// note that we only closed "processed" candidates. what's still open shall stay open.

final List<I_M_Picking_Candidate> pickingCandidates = query.list();
for (final I_M_Picking_Candidate pickingCandidate : pickingCandidates)
{
final IHUPickingSlotBL huPickingSlotBL = Services.get(IHUPickingSlotBL.class);
huPickingSlotBL.addToPickingSlotQueue(pickingCandidate.getM_PickingSlot(), pickingCandidate.getM_HU());
}

}
}

0 comments on commit 5d4575b

Please sign in to comment.