use of de.metas.inoutcandidate.api.ShipmentScheduleId in project metasfresh-webui-api by metasfresh.
the class HUsToPickViewBasedProcess method addHUIdToCurrentPickingSlot.
protected final void addHUIdToCurrentPickingSlot(@NonNull final HuId huId) {
final PickingSlotView pickingSlotsView = getPickingSlotView();
final PickingSlotRow pickingSlotRow = getPickingSlotRow();
final PickingSlotId pickingSlotId = pickingSlotRow.getPickingSlotId();
final ShipmentScheduleId shipmentScheduleId = pickingSlotsView.getCurrentShipmentScheduleId();
pickingCandidateService.pickHU(PickRequest.builder().shipmentScheduleId(shipmentScheduleId).pickFrom(PickFrom.ofHuId(huId)).pickingSlotId(pickingSlotId).build());
}
use of de.metas.inoutcandidate.api.ShipmentScheduleId in project metasfresh-webui-api by metasfresh.
the class ShipmentCandidatesViewFactory method createView.
@Override
public ShipmentCandidatesView createView(@NonNull final CreateViewRequest request) {
final ViewId viewId = request.getViewId();
viewId.assertWindowId(WINDOWID);
final Set<ShipmentScheduleId> shipmentScheduleIds = ShipmentScheduleId.fromIntSet(request.getFilterOnlyIds());
final ShipmentCandidateRows rows = rowsRepo.getByShipmentScheduleIds(shipmentScheduleIds);
return ShipmentCandidatesView.builder().shipmentScheduleBL(shipmentScheduleBL).viewId(viewId).rows(rows).build();
}
use of de.metas.inoutcandidate.api.ShipmentScheduleId in project metasfresh-webui-api by metasfresh.
the class ShipmentCandidatesView_Launcher method doIt.
@Override
protected String doIt() {
final ImmutableSet<ShipmentScheduleId> shipmentScheduleIds = getSelectedShipmentScheduleIds();
if (shipmentScheduleIds.isEmpty()) {
throw new AdempiereException("@NoSelection@");
}
final ViewId viewId = viewsFactory.createView(CreateViewRequest.builder(ShipmentCandidatesViewFactory.WINDOWID).setFilterOnlyIds(ShipmentScheduleId.toIntSet(shipmentScheduleIds)).build()).getViewId();
getResult().setWebuiViewToOpen(WebuiViewToOpen.builder().viewId(viewId.getViewId()).target(ViewOpenTarget.ModalOverlay).build());
return MSG_OK;
}
use of de.metas.inoutcandidate.api.ShipmentScheduleId in project metasfresh-webui-api by metasfresh.
the class PickingSlotViewFactory method createView.
/**
* This method is called once for each shipment schedule (left-hand side) and creates the respective picking view (right-hand side)
*
* @param request
* @param allShipmentScheduleIds the shipment schedule IDs to display picking slots for; <br>
* may be {@code null} or empty, in this case we assume that only the given {@code request}'s {@code shipmentScheduleId} is available.
* @return
*/
public PickingSlotView createView(@NonNull final CreateViewRequest request, @Nullable final Set<ShipmentScheduleId> allShipmentScheduleIds) {
final DocumentFilterList filters = request.getFiltersUnwrapped(getFilterDescriptorsProvider());
final ViewId pickingViewId = request.getParentViewId();
final DocumentId pickingRowId = request.getParentRowId();
final ViewId pickingSlotViewId = PickingSlotViewsIndexStorage.createViewId(pickingViewId, pickingRowId);
final ShipmentScheduleId currentShipmentScheduleId = extractCurrentShipmentScheduleId(request);
final PickingSlotRepoQuery query = createPickingSlotRowsQuery(filters, currentShipmentScheduleId, allShipmentScheduleIds);
final Supplier<List<PickingSlotRow>> rowsSupplier = () -> pickingSlotRepo.retrieveRows(query);
return PickingSlotView.builder().viewId(pickingSlotViewId).parentViewId(pickingViewId).parentRowId(pickingRowId).currentShipmentScheduleId(currentShipmentScheduleId).rowsSupplier(rowsSupplier).additionalRelatedProcessDescriptors(createAdditionalRelatedProcessDescriptors()).filters(filters).build();
}
use of de.metas.inoutcandidate.api.ShipmentScheduleId in project metasfresh-webui-api by metasfresh.
the class PickingSlotViewRepositoryTests method testRetrievePickingSlotRows_One_TU_with_CU.
@Test
public void testRetrievePickingSlotRows_One_TU_with_CU() {
final ShipmentScheduleId shipmentScheduleId = createShipmentSchedule();
final PickingSlotId pickingSlotId = createPickingSlot();
final boolean pickingSlotRowProcessed = false;
// set up a picked TU with a CU to be returned by the pickingHUsRepo.
{
final ListMultimap<PickingSlotId, PickedHUEditorRow> husIndexedByPickingSlotId = ImmutableListMultimap.of(pickingSlotId, new PickedHUEditorRow(HUEditorRow.builder(WindowId.of(423)).setRowId(HUEditorRowId.ofTopLevelHU(HuId.ofRepoId(100))).setType(HUEditorRowType.TU).setTopLevel(true).addIncludedRow(HUEditorRow.builder(WindowId.of(423)).setRowId(HUEditorRowId.ofHU(HuId.ofRepoId(101), HuId.ofRepoId(100))).setType(HUEditorRowType.VHU).setTopLevel(false).build()).build(), pickingSlotRowProcessed));
Mockito.when(pickingHUsRepo.retrievePickedHUsIndexedByPickingSlotId(PickingCandidatesQuery.builder().shipmentScheduleId(shipmentScheduleId).onlyNotClosedOrNotRackSystem(true).build())).thenReturn(husIndexedByPickingSlotId);
}
final PickingSlotViewRepository pickingSlotViewRepository = createPickingSlotViewRepository();
final PickingSlotRepoQuery query = PickingSlotRepoQuery.of(shipmentScheduleId);
final List<PickingSlotRow> rowsByShipmentScheduleId = pickingSlotViewRepository.retrievePickingSlotRows(query);
assertThat(rowsByShipmentScheduleId).hasSize(1);
final PickingSlotRow pickingSlotRow = rowsByShipmentScheduleId.get(0);
assertThat(pickingSlotRow.isPickingSlotRow()).isTrue();
assertThat(pickingSlotRow.isPickedHURow()).isFalse();
assertThat(pickingSlotRow.isProcessed()).isEqualTo(pickingSlotRowProcessed);
assertThat(pickingSlotRow.getIncludedRows()).hasSize(1);
final PickingSlotRow tuRow = pickingSlotRow.getIncludedRows().get(0);
assertThat(tuRow.isPickingSlotRow()).isFalse();
assertThat(tuRow.isPickedHURow()).isTrue();
assertThat(tuRow.getHuId().getRepoId()).isEqualTo(100);
assertThat(tuRow.getIncludedRows()).hasSize(1);
final PickingSlotRow whuRow = tuRow.getIncludedRows().get(0);
assertThat(whuRow.isPickingSlotRow()).isFalse();
assertThat(whuRow.isPickedHURow()).isTrue();
assertThat(whuRow.getHuId().getRepoId()).isEqualTo(101);
}
Aggregations