Search in sources :

Example 6 with ShipmentScheduleId

use of de.metas.inoutcandidate.api.ShipmentScheduleId in project metasfresh-webui-api by metasfresh.

the class PickingTerminalViewInvalidationAdvisor method findAffectedRowIds.

@Override
public Set<DocumentId> findAffectedRowIds(final TableRecordReferenceSet recordRefs, final IView view) {
    final Set<ShipmentScheduleId> shipmentScheduleIds = extractShipmentScheduleIds(recordRefs);
    if (shipmentScheduleIds.isEmpty()) {
        return ImmutableSet.of();
    }
    final SqlViewKeyColumnNamesMap keyColumnNamesMap = SqlViewKeyColumnNamesMap.ofIntKeyField(I_M_Packageable_V.COLUMNNAME_M_ShipmentSchedule_ID);
    return SqlViewRowIdsOrderedSelectionFactory.retrieveRowIdsForLineIds(keyColumnNamesMap, view.getViewId(), ShipmentScheduleId.toIntSet(shipmentScheduleIds));
}
Also used : ShipmentScheduleId(de.metas.inoutcandidate.api.ShipmentScheduleId) SqlViewKeyColumnNamesMap(de.metas.ui.web.view.descriptor.SqlViewKeyColumnNamesMap)

Example 7 with ShipmentScheduleId

use of de.metas.inoutcandidate.api.ShipmentScheduleId in project metasfresh-webui-api by metasfresh.

the class PickingTerminalViewInvalidationAdvisor method extractShipmentScheduleIds.

private Set<ShipmentScheduleId> extractShipmentScheduleIds(final TableRecordReferenceSet recordRefs) {
    if (recordRefs.isEmpty()) {
        return ImmutableSet.of();
    }
    final Set<ShipmentScheduleId> shipmentScheduleIds = new HashSet<>();
    final Set<PickingCandidateId> pickingCandidateIds = new HashSet<>();
    for (TableRecordReference recordRef : recordRefs) {
        final String tableName = recordRef.getTableName();
        if (I_M_ShipmentSchedule.Table_Name.equals(tableName)) {
            shipmentScheduleIds.add(ShipmentScheduleId.ofRepoId(recordRef.getRecord_ID()));
        } else if (I_M_Picking_Candidate.Table_Name.equals(tableName)) {
            pickingCandidateIds.add(PickingCandidateId.ofRepoId(recordRef.getRecord_ID()));
        }
    }
    if (!pickingCandidateIds.isEmpty()) {
        shipmentScheduleIds.addAll(pickingCandidateRepository.getShipmentScheduleIdsByPickingCandidateIds(pickingCandidateIds));
    }
    return shipmentScheduleIds;
}
Also used : TableRecordReference(org.adempiere.util.lang.impl.TableRecordReference) PickingCandidateId(de.metas.handlingunits.picking.PickingCandidateId) ShipmentScheduleId(de.metas.inoutcandidate.api.ShipmentScheduleId) HashSet(java.util.HashSet)

Example 8 with ShipmentScheduleId

use of de.metas.inoutcandidate.api.ShipmentScheduleId in project metasfresh-webui-api by metasfresh.

the class WEBUI_Picking_With_M_Source_HU_Base method retrieveQtyToPick.

protected final Quantity retrieveQtyToPick() {
    final ShipmentScheduleId shipmentScheduleId = getCurrentShipmentScheduleId();
    final I_M_ShipmentSchedule shipmentSchedule = getCurrentShipmentSchedule();
    final Quantity qtyToDeliverTarget = Services.get(IShipmentScheduleBL.class).getQtyToDeliver(shipmentSchedule);
    final Quantity qtyPickedPlanned = Services.get(IPackagingDAO.class).retrieveQtyPickedPlanned(shipmentScheduleId).orElse(null);
    if (qtyPickedPlanned == null) {
        return qtyToDeliverTarget.toZero();
    }
    return qtyToDeliverTarget.subtract(qtyPickedPlanned).toZeroIfNegative();
}
Also used : ShipmentScheduleId(de.metas.inoutcandidate.api.ShipmentScheduleId) Quantity(de.metas.quantity.Quantity) I_M_ShipmentSchedule(de.metas.handlingunits.model.I_M_ShipmentSchedule) IShipmentScheduleBL(de.metas.inoutcandidate.api.IShipmentScheduleBL)

Example 9 with ShipmentScheduleId

use of de.metas.inoutcandidate.api.ShipmentScheduleId in project metasfresh-webui-api by metasfresh.

the class WEBUI_Picking_M_Picking_Candidate_Process method doIt.

@Override
protected String doIt() throws Exception {
    final PickingSlotRow rowToProcess = getSingleSelectedRow();
    final ShipmentScheduleId shipmentScheduleId = null;
    pickingCandidateService.processForHUIds(ImmutableSet.of(rowToProcess.getHuId()), shipmentScheduleId);
    return MSG_OK;
}
Also used : PickingSlotRow(de.metas.ui.web.picking.pickingslot.PickingSlotRow) ShipmentScheduleId(de.metas.inoutcandidate.api.ShipmentScheduleId)

Example 10 with ShipmentScheduleId

use of de.metas.inoutcandidate.api.ShipmentScheduleId in project metasfresh-webui-api by metasfresh.

the class WEBUI_M_HU_Pick method pickHU.

private void pickHU(final HURow row) {
    final HuId huId = row.getHuId();
    final PickingSlotId pickingSlotId = PickingSlotId.ofRepoId(pickingSlotIdInt);
    final ShipmentScheduleId shipmentScheduleId = ShipmentScheduleId.ofRepoId(shipmentScheduleIdInt);
    pickingCandidateService.pickHU(PickRequest.builder().shipmentScheduleId(shipmentScheduleId).pickFrom(PickFrom.ofHuId(huId)).pickingSlotId(pickingSlotId).build());
    // NOTE: we are not moving the HU to shipment schedule's locator.
    pickingCandidateService.processForHUIds(ImmutableSet.of(huId), shipmentScheduleId);
}
Also used : PickingSlotId(de.metas.picking.api.PickingSlotId) ShipmentScheduleId(de.metas.inoutcandidate.api.ShipmentScheduleId) HuId(de.metas.handlingunits.HuId)

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