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);
}
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();
}
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);
}
}
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);
}
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);
}
Aggregations