Search in sources :

Example 81 with DocumentId

use of de.metas.ui.web.window.datatypes.DocumentId in project metasfresh-webui-api by metasfresh.

the class PurchaseRowsLoader method handleResultForAsyncAvailabilityCheck.

private void handleResultForAsyncAvailabilityCheck(@Nullable final Multimap<PurchaseCandidate, AvailabilityResult> availabilityCheckResult) {
    if (availabilityCheckResult == null) {
        return;
    }
    final // 
    Set<Entry<PurchaseCandidate, Collection<AvailabilityResult>>> entrySet = availabilityCheckResult.asMap().entrySet();
    final List<DocumentId> changedRowIds = new ArrayList<>();
    for (final Entry<PurchaseCandidate, Collection<AvailabilityResult>> entry : entrySet) {
        final PurchaseRow purchaseRowToAugment = purchaseCandidate2purchaseRow.get(entry.getKey());
        final ImmutableList.Builder<PurchaseRow> availabilityResultRows = ImmutableList.builder();
        for (final AvailabilityResult availabilityResult : entry.getValue()) {
            final PurchaseRow availabilityResultRow = purchaseRowFactory.rowFromAvailabilityResultBuilder().parentRow(purchaseRowToAugment).availabilityResult(availabilityResult).build();
            availabilityResultRows.add(availabilityResultRow);
        }
        purchaseRowToAugment.setAvailabilityInfoRows(availabilityResultRows.build());
        changedRowIds.add(purchaseRowToAugment.getId());
    }
    notifyViewOfChanges(changedRowIds);
}
Also used : AvailabilityResult(de.metas.purchasecandidate.availability.AvailabilityResult) Entry(java.util.Map.Entry) ImmutableList(com.google.common.collect.ImmutableList) DocumentId(de.metas.ui.web.window.datatypes.DocumentId) ArrayList(java.util.ArrayList) Collection(java.util.Collection) PurchaseCandidate(de.metas.purchasecandidate.PurchaseCandidate)

Example 82 with DocumentId

use of de.metas.ui.web.window.datatypes.DocumentId 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 List<Integer> allShipmentScheduleIds) {
    final CreateViewRequest requestEffective = request.unwrapFiltersAndCopy(getFilterDescriptorsProvider());
    final ViewId pickingViewId = requestEffective.getParentViewId();
    final DocumentId pickingRowId = requestEffective.getParentRowId();
    final ViewId pickingSlotViewId = PickingSlotViewsIndexStorage.createViewId(pickingViewId, pickingRowId);
    final int shipmentScheduleId = extractCurrentShipmentScheduleId(requestEffective);
    final PickingSlotRepoQuery query = createPickingSlotRowsQuery(requestEffective, allShipmentScheduleIds);
    final Supplier<List<PickingSlotRow>> rowsSupplier = () -> pickingSlotRepo.retrieveRows(query);
    return PickingSlotView.builder().viewId(pickingSlotViewId).parentViewId(pickingViewId).parentRowId(pickingRowId).currentShipmentScheduleId(shipmentScheduleId).rowsSupplier(rowsSupplier).additionalRelatedProcessDescriptors(createAdditionalRelatedProcessDescriptors()).filters(requestEffective.getFilters().getFilters()).build();
}
Also used : ViewId(de.metas.ui.web.view.ViewId) DocumentId(de.metas.ui.web.window.datatypes.DocumentId) ImmutableList(com.google.common.collect.ImmutableList) List(java.util.List) CreateViewRequest(de.metas.ui.web.view.CreateViewRequest)

Example 83 with DocumentId

use of de.metas.ui.web.window.datatypes.DocumentId in project metasfresh-webui-api by metasfresh.

the class PickingSlotViewsIndexStorage method getOrCreatePickingSlotView.

private PickingSlotView getOrCreatePickingSlotView(@NonNull final ViewId pickingSlotViewId, final boolean create) {
    final PackageableView packageableView = getPackageableViewByPickingSlotViewId(pickingSlotViewId);
    final DocumentId packageableRowId = extractRowId(pickingSlotViewId);
    if (create) {
        return packageableView.computePickingSlotViewIfAbsent(packageableRowId, () -> {
            final PackageableRow packageableRow = packageableView.getById(packageableRowId);
            final CreateViewRequest createViewRequest = CreateViewRequest.builder(PickingConstants.WINDOWID_PickingSlotView, JSONViewDataType.includedView).setParentViewId(packageableView.getViewId()).setParentRowId(packageableRow.getId()).build();
            // provide all pickingView's M_ShipmentSchedule_IDs to the factory, because we want to show the same picking slots and picked HU-rows for all of them.
            final List<Integer> allShipmentScheduleIds = packageableView.streamByIds(DocumentIdsSelection.ALL).map(PackageableRow::cast).map(PackageableRow::getShipmentScheduleId).collect(Collectors.toList());
            return pickingSlotViewFactory.createView(createViewRequest, allShipmentScheduleIds);
        });
    } else {
        return packageableView.getPickingSlotViewOrNull(packageableRowId);
    }
}
Also used : PackageableRow(de.metas.ui.web.picking.packageable.PackageableRow) PackageableView(de.metas.ui.web.picking.packageable.PackageableView) DocumentId(de.metas.ui.web.window.datatypes.DocumentId) CreateViewRequest(de.metas.ui.web.view.CreateViewRequest)

Example 84 with DocumentId

use of de.metas.ui.web.window.datatypes.DocumentId in project metasfresh-webui-api by metasfresh.

the class HUEditorRowId method ofHUStorage.

public static HUEditorRowId ofHUStorage(final int huId, final int topLevelHUId, final int storageProductId) {
    Preconditions.checkArgument(storageProductId > 0);
    // to be computed when needed
    final String json = null;
    // to be computed when needed
    final DocumentId documentId = null;
    return new HUEditorRowId(huId, storageProductId, topLevelHUId, json, documentId);
}
Also used : DocumentId(de.metas.ui.web.window.datatypes.DocumentId)

Example 85 with DocumentId

use of de.metas.ui.web.window.datatypes.DocumentId in project metasfresh-webui-api by metasfresh.

the class HUEditorRowId method ofTopLevelHU.

public static HUEditorRowId ofTopLevelHU(final int topLevelHUId) {
    final int storageProductId = -1;
    // to be computed when needed
    final String json = null;
    // to be computed when needed
    final DocumentId documentId = null;
    return new HUEditorRowId(topLevelHUId, // topLevelHUId parameter
    -1, storageProductId, json, documentId);
}
Also used : DocumentId(de.metas.ui.web.window.datatypes.DocumentId)

Aggregations

DocumentId (de.metas.ui.web.window.datatypes.DocumentId)99 DocumentPath (de.metas.ui.web.window.datatypes.DocumentPath)18 DocumentIdsSelection (de.metas.ui.web.window.datatypes.DocumentIdsSelection)14 List (java.util.List)14 ImmutableList (com.google.common.collect.ImmutableList)12 GetMapping (org.springframework.web.bind.annotation.GetMapping)12 AdempiereException (org.adempiere.exceptions.AdempiereException)11 JSONLookupValuesList (de.metas.ui.web.window.datatypes.json.JSONLookupValuesList)9 ArrayList (java.util.ArrayList)9 Set (java.util.Set)9 NonNull (lombok.NonNull)9 Test (org.junit.Test)9 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)9 UserSession (de.metas.ui.web.session.UserSession)8 ViewId (de.metas.ui.web.view.ViewId)8 DocumentEntityDescriptor (de.metas.ui.web.window.descriptor.DocumentEntityDescriptor)8 Document (de.metas.ui.web.window.model.Document)8 IDocumentChangesCollector (de.metas.ui.web.window.model.IDocumentChangesCollector)8 TableRecordReference (org.adempiere.util.lang.impl.TableRecordReference)8 Autowired (org.springframework.beans.factory.annotation.Autowired)8