Search in sources :

Example 1 with ShipmentScheduleId

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());
}
Also used : PickingSlotRow(de.metas.ui.web.picking.pickingslot.PickingSlotRow) PickingSlotView(de.metas.ui.web.picking.pickingslot.PickingSlotView) PickingSlotId(de.metas.picking.api.PickingSlotId) ShipmentScheduleId(de.metas.inoutcandidate.api.ShipmentScheduleId)

Example 2 with ShipmentScheduleId

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();
}
Also used : ViewId(de.metas.ui.web.view.ViewId) ShipmentScheduleId(de.metas.inoutcandidate.api.ShipmentScheduleId)

Example 3 with ShipmentScheduleId

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;
}
Also used : AdempiereException(org.adempiere.exceptions.AdempiereException) ViewId(de.metas.ui.web.view.ViewId) ShipmentScheduleId(de.metas.inoutcandidate.api.ShipmentScheduleId)

Example 4 with ShipmentScheduleId

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();
}
Also used : ViewId(de.metas.ui.web.view.ViewId) DocumentId(de.metas.ui.web.window.datatypes.DocumentId) ShipmentScheduleId(de.metas.inoutcandidate.api.ShipmentScheduleId) ImmutableList(com.google.common.collect.ImmutableList) DocumentFilterList(de.metas.ui.web.document.filter.DocumentFilterList) List(java.util.List) DocumentFilterList(de.metas.ui.web.document.filter.DocumentFilterList)

Example 5 with ShipmentScheduleId

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);
}
Also used : PickingSlotId(de.metas.picking.api.PickingSlotId) ShipmentScheduleId(de.metas.inoutcandidate.api.ShipmentScheduleId) PickedHUEditorRow(de.metas.ui.web.picking.pickingslot.PickingHURowsRepository.PickedHUEditorRow) ListMultimap(com.google.common.collect.ListMultimap) ImmutableListMultimap(com.google.common.collect.ImmutableListMultimap) Test(org.junit.jupiter.api.Test)

Aggregations

ShipmentScheduleId (de.metas.inoutcandidate.api.ShipmentScheduleId)19 ViewId (de.metas.ui.web.view.ViewId)5 I_M_ShipmentSchedule (de.metas.handlingunits.model.I_M_ShipmentSchedule)3 IShipmentSchedulePA (de.metas.inoutcandidate.api.IShipmentSchedulePA)3 PickingSlotId (de.metas.picking.api.PickingSlotId)3 ProductId (de.metas.product.ProductId)3 Test (org.junit.jupiter.api.Test)3 HuId (de.metas.handlingunits.HuId)2 IShipmentScheduleEffectiveBL (de.metas.inoutcandidate.api.IShipmentScheduleEffectiveBL)2 PickingSlotRow (de.metas.ui.web.picking.pickingslot.PickingSlotRow)2 PickingSlotView (de.metas.ui.web.picking.pickingslot.PickingSlotView)2 CreateViewRequest (de.metas.ui.web.view.CreateViewRequest)2 DocumentId (de.metas.ui.web.window.datatypes.DocumentId)2 WarehouseId (org.adempiere.warehouse.WarehouseId)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 ImmutableList (com.google.common.collect.ImmutableList)1 ImmutableListMultimap (com.google.common.collect.ImmutableListMultimap)1 ImmutableSet (com.google.common.collect.ImmutableSet)1 ListMultimap (com.google.common.collect.ListMultimap)1 BPartnerId (de.metas.bpartner.BPartnerId)1