Search in sources :

Example 11 with HuId

use of de.metas.handlingunits.HuId in project metasfresh-webui-api by metasfresh.

the class HUEditorViewBuffer_HighVolume method huIdsPageFetcher.

private PageFetcher<HuId> huIdsPageFetcher(final DocumentQueryOrderByList orderBys) {
    final ViewEvaluationCtx viewEvalCtx = getViewEvaluationCtx();
    final ViewRowIdsOrderedSelection selection = getSelection(orderBys);
    return (firstRow, maxRows) -> huEditorRepo.retrieveHUIdsPage(viewEvalCtx, selection, firstRow, maxRows);
}
Also used : JSONOptions(de.metas.ui.web.window.datatypes.json.JSONOptions) ViewRowIdsOrderedSelection(de.metas.ui.web.view.ViewRowIdsOrderedSelection) ViewEvaluationCtx(de.metas.ui.web.view.ViewEvaluationCtx) DocumentId(de.metas.ui.web.window.datatypes.DocumentId) UnaryOperator(java.util.function.UnaryOperator) HUIdsFilterData(de.metas.ui.web.handlingunits.HUIdsFilterHelper.HUIdsFilterData) Supplier(java.util.function.Supplier) SynchronizedMutable(org.adempiere.util.lang.SynchronizedMutable) Mutables(org.adempiere.util.lang.Mutables) IteratorUtils(de.metas.util.collections.IteratorUtils) DocumentFilterList(de.metas.ui.web.document.filter.DocumentFilterList) I_M_HU(de.metas.handlingunits.model.I_M_HU) DocumentIdsSelection(de.metas.ui.web.window.datatypes.DocumentIdsSelection) SqlDocumentFilterConverterContext(de.metas.ui.web.document.filter.sql.SqlDocumentFilterConverterContext) ImmutableSet(com.google.common.collect.ImmutableSet) Iterator(java.util.Iterator) DocumentQueryOrderByList(de.metas.ui.web.window.model.DocumentQueryOrderByList) NonNull(lombok.NonNull) Collection(java.util.Collection) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) Set(java.util.Set) CCache(de.metas.cache.CCache) Objects(java.util.Objects) PageFetcher(de.metas.util.collections.PagedIterator.PageFetcher) EntityNotFoundException(de.metas.ui.web.exceptions.EntityNotFoundException) Stream(java.util.stream.Stream) HuId(de.metas.handlingunits.HuId) ViewRowsOrderBy(de.metas.ui.web.view.ViewRowsOrderBy) ViewId(de.metas.ui.web.view.ViewId) ViewEvaluationCtx(de.metas.ui.web.view.ViewEvaluationCtx) ViewRowIdsOrderedSelection(de.metas.ui.web.view.ViewRowIdsOrderedSelection)

Example 12 with HuId

use of de.metas.handlingunits.HuId in project metasfresh-webui-api by metasfresh.

the class HUEditorViewBuffer_HighVolume method getById.

@Override
public HUEditorRow getById(@NonNull final DocumentId rowId) throws EntityNotFoundException {
    final HUEditorRowId huRowId = HUEditorRowId.ofDocumentId(rowId);
    final HUEditorRowId topLevelRowId = huRowId.toTopLevelRowId();
    final HuId topLevelHUId = topLevelRowId.getTopLevelHUId();
    final HUEditorRow topLevelRow = cache_huRowsById.getOrLoad(topLevelRowId.toDocumentId(), () -> huEditorRepo.retrieveForHUId(topLevelHUId));
    if (topLevelRowId.equals(huRowId)) {
        return topLevelRow;
    } else {
        return topLevelRow.getIncludedRowById(rowId).orElseThrow(() -> new EntityNotFoundException("No row found for " + rowId).setParameter("topLevelRowId", topLevelRowId));
    }
}
Also used : HuId(de.metas.handlingunits.HuId) EntityNotFoundException(de.metas.ui.web.exceptions.EntityNotFoundException)

Example 13 with HuId

use of de.metas.handlingunits.HuId in project metasfresh-webui-api by metasfresh.

the class HUEditorViewBuffer_HighVolume method isHighVolume.

public static boolean isHighVolume(final DocumentFilterList stickyFilters) {
    final HUIdsFilterData huIdsFilterData = HUIdsFilterHelper.extractFilterDataOrNull(stickyFilters);
    if (huIdsFilterData == null) {
        return true;
    }
    final Set<HuId> huIds = huIdsFilterData.getInitialHUIds();
    if (huIds == null) {
        // high volume
        return true;
    } else if (huIds.isEmpty()) {
        // not high volume
        return false;
    } else {
        // consider high volume if it's above give threshold
        return huIds.size() >= HIGHVOLUME_THRESHOLD;
    }
}
Also used : HuId(de.metas.handlingunits.HuId) HUIdsFilterData(de.metas.ui.web.handlingunits.HUIdsFilterHelper.HUIdsFilterData)

Example 14 with HuId

use of de.metas.handlingunits.HuId in project metasfresh-webui-api by metasfresh.

the class HUEditorRowId method fromJson.

private static HUEditorRowId fromJson(@NonNull final String json, final DocumentId documentId) {
    // 
    // Split json to parts
    final Iterator<String> partsIterator;
    {
        final List<String> parts = PARTS_SPLITTER.splitToList(json);
        if (parts.isEmpty()) {
            throw new IllegalArgumentException("Invalid HU rowId: " + json);
        }
        partsIterator = parts.iterator();
    }
    // 
    // huId and storageProductId
    final HuId huId;
    final ProductId storageProductId;
    {
        final String idStrPart = partsIterator.next();
        final List<String> idParts = ID_SPLITTER.splitToList(idStrPart);
        if (idParts.size() == 1) {
            huId = HuId.ofRepoId(Integer.parseInt(idParts.get(0)));
            storageProductId = null;
        } else if (idParts.size() == 2) {
            huId = HuId.ofRepoId(Integer.parseInt(idParts.get(0)));
            storageProductId = ProductId.ofRepoId(Integer.parseInt(idParts.get(1)));
        } else {
            throw new IllegalArgumentException("Invalid HU rowId: " + json + ". Cannot parse ID part: " + idStrPart);
        }
    }
    // 
    // Others
    HuId topLevelHUId = null;
    while (partsIterator.hasNext()) {
        final String part = partsIterator.next();
        if (part.startsWith(PREFIX_TopLevelHUId)) {
            final String topLevelHUIdStr = part.substring(PREFIX_TopLevelHUId.length());
            topLevelHUId = HuId.ofRepoId(Integer.parseInt(topLevelHUIdStr));
        } else {
            throw new IllegalArgumentException("Invalid HU rowId: " + json + ". Cannot parse part: " + part);
        }
    }
    return new HUEditorRowId(huId, storageProductId, topLevelHUId, json, documentId);
}
Also used : List(java.util.List) HuId(de.metas.handlingunits.HuId) ProductId(de.metas.product.ProductId)

Example 15 with HuId

use of de.metas.handlingunits.HuId in project metasfresh-webui-api by metasfresh.

the class WEBUI_Picking_M_Picking_Candidate_Unprocess method doIt.

@Override
protected String doIt() {
    final PickingSlotRow rowToProcess = getSingleSelectedRow();
    final HuId huId = rowToProcess.getHuId();
    pickingCandidateService.unprocessForHUId(huId);
    return MSG_OK;
}
Also used : PickingSlotRow(de.metas.ui.web.picking.pickingslot.PickingSlotRow) HuId(de.metas.handlingunits.HuId)

Aggregations

HuId (de.metas.handlingunits.HuId)54 I_M_HU (de.metas.handlingunits.model.I_M_HU)17 AdempiereException (org.adempiere.exceptions.AdempiereException)11 ProductId (de.metas.product.ProductId)10 HUEditorRow (de.metas.ui.web.handlingunits.HUEditorRow)8 ImmutableSet (com.google.common.collect.ImmutableSet)7 IHandlingUnitsBL (de.metas.handlingunits.IHandlingUnitsBL)7 NonNull (lombok.NonNull)7 ImmutableList (com.google.common.collect.ImmutableList)6 IHandlingUnitsDAO (de.metas.handlingunits.IHandlingUnitsDAO)6 DocumentIdsSelection (de.metas.ui.web.window.datatypes.DocumentIdsSelection)6 Services (de.metas.util.Services)6 List (java.util.List)6 Set (java.util.Set)6 IHUQueryBuilder (de.metas.handlingunits.IHUQueryBuilder)5 PickingSlotId (de.metas.picking.api.PickingSlotId)5 Quantity (de.metas.quantity.Quantity)5 HUEditorView (de.metas.ui.web.handlingunits.HUEditorView)5 DocumentId (de.metas.ui.web.window.datatypes.DocumentId)5 OrderLineId (de.metas.order.OrderLineId)4