Search in sources :

Example 1 with PackageableView

use of de.metas.ui.web.picking.packageable.PackageableView in project metasfresh-webui-api by metasfresh.

the class PickingSlotViewsIndexStorage method removeById.

@Override
public void removeById(@NonNull final ViewId pickingSlotViewId) {
    final DocumentId rowId = extractRowId(pickingSlotViewId);
    final PackageableView packageableView = getPackageableViewByPickingSlotViewId(pickingSlotViewId);
    packageableView.removePickingSlotView(rowId, ViewCloseReason.USER_REQUEST);
}
Also used : PackageableView(de.metas.ui.web.picking.packageable.PackageableView) DocumentId(de.metas.ui.web.window.datatypes.DocumentId)

Example 2 with PackageableView

use of de.metas.ui.web.picking.packageable.PackageableView in project metasfresh-webui-api by metasfresh.

the class PickingSlotViewsIndexStorage method put.

@Override
public void put(final IView pickingSlotView) {
    final ViewId pickingSlotViewId = pickingSlotView.getViewId();
    final PackageableView packageableView = getPackageableViewByPickingSlotViewId(pickingSlotViewId);
    final DocumentId rowId = extractRowId(pickingSlotViewId);
    packageableView.setPickingSlotView(rowId, PickingSlotView.cast(pickingSlotView));
}
Also used : PackageableView(de.metas.ui.web.picking.packageable.PackageableView) ViewId(de.metas.ui.web.view.ViewId) DocumentId(de.metas.ui.web.window.datatypes.DocumentId)

Example 3 with PackageableView

use of de.metas.ui.web.picking.packageable.PackageableView in project metasfresh-webui-api by metasfresh.

the class PickingSlotViewsIndexStorage method getPackageableViewByPickingSlotViewId.

private PackageableView getPackageableViewByPickingSlotViewId(final ViewId pickingSlotViewId) {
    final ViewId pickingViewId = extractPickingViewId(pickingSlotViewId);
    final PackageableView view = PackageableView.cast(getViewsRepository().getView(pickingViewId));
    return view;
}
Also used : PackageableView(de.metas.ui.web.picking.packageable.PackageableView) ViewId(de.metas.ui.web.view.ViewId)

Example 4 with PackageableView

use of de.metas.ui.web.picking.packageable.PackageableView in project metasfresh-webui-api by metasfresh.

the class HUsToPickViewBasedProcess method getSingleSelectedPackageableRow.

protected final PackageableRow getSingleSelectedPackageableRow() {
    final PickingSlotView pickingSlotView = getPickingSlotView();
    final ViewId packageablesViewId = pickingSlotView.getParentViewId();
    if (packageablesViewId == null) {
        throw new AdempiereException("Packageables view is not available");
    }
    final DocumentId packageableRowId = pickingSlotView.getParentRowId();
    if (packageableRowId == null) {
        throw new AdempiereException("There is no single packageable row selected");
    }
    final PackageableView packageableView = PackageableView.cast(viewsRepo.getView(packageablesViewId));
    return packageableView.getById(packageableRowId);
}
Also used : PickingSlotView(de.metas.ui.web.picking.pickingslot.PickingSlotView) AdempiereException(org.adempiere.exceptions.AdempiereException) PackageableView(de.metas.ui.web.picking.packageable.PackageableView) ViewId(de.metas.ui.web.view.ViewId) DocumentId(de.metas.ui.web.window.datatypes.DocumentId)

Example 5 with PackageableView

use of de.metas.ui.web.picking.packageable.PackageableView 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)

Aggregations

PackageableView (de.metas.ui.web.picking.packageable.PackageableView)5 DocumentId (de.metas.ui.web.window.datatypes.DocumentId)4 ViewId (de.metas.ui.web.view.ViewId)3 PackageableRow (de.metas.ui.web.picking.packageable.PackageableRow)1 PickingSlotView (de.metas.ui.web.picking.pickingslot.PickingSlotView)1 CreateViewRequest (de.metas.ui.web.view.CreateViewRequest)1 AdempiereException (org.adempiere.exceptions.AdempiereException)1