Search in sources :

Example 11 with PickingSlotRow

use of de.metas.ui.web.picking.pickingslot.PickingSlotRow in project metasfresh-webui-api by metasfresh.

the class HUsToPickViewBasedProcess method addHUIdToCurrentPickingSlot.

protected final void addHUIdToCurrentPickingSlot(final int huId) {
    final PickingSlotView pickingSlotsView = getPickingSlotView();
    final PickingSlotRow pickingSlotRow = getPickingSlotRow();
    final int pickingSlotId = pickingSlotRow.getPickingSlotId();
    final int shipmentScheduleId = pickingSlotsView.getCurrentShipmentScheduleId();
    pickingCandidateService.addHUToPickingSlot(huId, pickingSlotId, shipmentScheduleId);
}
Also used : PickingSlotRow(de.metas.ui.web.picking.pickingslot.PickingSlotRow) PickingSlotView(de.metas.ui.web.picking.pickingslot.PickingSlotView)

Example 12 with PickingSlotRow

use of de.metas.ui.web.picking.pickingslot.PickingSlotRow in project metasfresh-webui-api by metasfresh.

the class WEBUI_HUsToPick_PickCU method pickCUs.

private void pickCUs() {
    final I_M_Product product = getProduct();
    final I_C_UOM uom = productBL.getStockingUOM(product);
    final Date date = SystemTime.asDate();
    final int huIdToSplit = retrieveHUIdToSplit();
    final List<I_M_HU> splitHUs = HUSplitBuilderCoreEngine.builder().huToSplit(load(huIdToSplit, I_M_HU.class)).requestProvider(huContext -> AllocationUtils.createAllocationRequestBuilder().setHUContext(huContext).setProduct(product).setQuantity(getQtyCU(), uom).setDate(date).setFromReferencedModel(// N/A
    null).setForceQtyAllocation(false).create()).destination(HUProducerDestination.ofVirtualPI()).build().withPropagateHUValues().withAllowPartialUnloads(// we allow partial loads and unloads so if a user enters a very large number, then that will just account to "all of it" and there will be no error
    true).performSplit();
    final I_M_HU splitCU = ListUtils.singleElement(splitHUs);
    addHUIdToCurrentPickingSlot(splitCU.getM_HU_ID());
    if (isAutoProcess) {
        final PickingSlotRow rowToProcess = getPickingSlotRow();
        pickingCandidateService.processForHUIds(ImmutableList.of(rowToProcess.getHuId()), rowToProcess.getPickingSlotId(), OptionalInt.empty());
    }
}
Also used : FillMandatoryException(org.adempiere.exceptions.FillMandatoryException) GuavaCollectors(org.adempiere.util.GuavaCollectors) Date(java.util.Date) HUSplitBuilderCoreEngine(de.metas.handlingunits.allocation.transfer.impl.HUSplitBuilderCoreEngine) InterfaceWrapperHelper.loadOutOfTrx(org.adempiere.model.InterfaceWrapperHelper.loadOutOfTrx) Autowired(org.springframework.beans.factory.annotation.Autowired) OptionalInt(java.util.OptionalInt) PickingCandidateService(de.metas.handlingunits.picking.PickingCandidateService) HUProducerDestination(de.metas.handlingunits.allocation.impl.HUProducerDestination) PackageableRow(de.metas.ui.web.picking.packageable.PackageableRow) BigDecimal(java.math.BigDecimal) IProductBL(de.metas.product.IProductBL) AllocationUtils(de.metas.handlingunits.allocation.impl.AllocationUtils) ImmutableList(com.google.common.collect.ImmutableList) SystemTime(org.adempiere.util.time.SystemTime) I_M_HU(de.metas.handlingunits.model.I_M_HU) IProcessDefaultParameter(de.metas.process.IProcessDefaultParameter) IProcessPrecondition(de.metas.process.IProcessPrecondition) DocumentIdsSelection(de.metas.ui.web.window.datatypes.DocumentIdsSelection) HUEditorRow(de.metas.ui.web.handlingunits.HUEditorRow) MSG_WEBUI_SELECT_ACTIVE_UNSELECTED_HU(de.metas.ui.web.handlingunits.WEBUI_HU_Constants.MSG_WEBUI_SELECT_ACTIVE_UNSELECTED_HU) PickingSlotRow(de.metas.ui.web.picking.pickingslot.PickingSlotRow) I_C_UOM(org.compiere.model.I_C_UOM) ITranslatableString(de.metas.i18n.ITranslatableString) ProcessPreconditionsResolution(de.metas.process.ProcessPreconditionsResolution) Services(org.adempiere.util.Services) List(java.util.List) Param(de.metas.process.Param) AdempiereException(org.adempiere.exceptions.AdempiereException) ListUtils(org.adempiere.util.collections.ListUtils) PickingConfigRepository(de.metas.picking.api.PickingConfigRepository) IProcessDefaultParametersProvider(de.metas.process.IProcessDefaultParametersProvider) IMsgBL(de.metas.i18n.IMsgBL) I_M_Product(de.metas.adempiere.model.I_M_Product) InterfaceWrapperHelper.load(org.adempiere.model.InterfaceWrapperHelper.load) IProcessParametersCallout(de.metas.process.IProcessParametersCallout) PickingSlotRow(de.metas.ui.web.picking.pickingslot.PickingSlotRow) I_M_Product(de.metas.adempiere.model.I_M_Product) I_M_HU(de.metas.handlingunits.model.I_M_HU) I_C_UOM(org.compiere.model.I_C_UOM) Date(java.util.Date)

Example 13 with PickingSlotRow

use of de.metas.ui.web.picking.pickingslot.PickingSlotRow in project metasfresh-webui-api by metasfresh.

the class WEBUI_PickingSlotsClearingView_TakeOutTUAndAddToLU method doIt.

@Override
protected String doIt() throws Exception {
    final PickingSlotRow pickingSlotRow = getSingleSelectedPickingSlotRow();
    Check.assume(pickingSlotRow.isTU(), "Picking slot HU shall be a TU: {}", pickingSlotRow);
    final I_M_HU tuHU = InterfaceWrapperHelper.load(pickingSlotRow.getHuId(), I_M_HU.class);
    final HUEditorRow packingHURow = getSingleSelectedPackingHUsRow();
    Check.assume(packingHURow.isLU(), "Pack to HU shall be a LU: {}", packingHURow);
    final I_M_HU luHU = packingHURow.getM_HU();
    final BigDecimal qtyTU = BigDecimal.ONE;
    final List<Integer> huIdsDestroyedCollector = new ArrayList<>();
    HUTransformService.builder().emptyHUListener(EmptyHUListener.doBeforeDestroyed(hu -> huIdsDestroyedCollector.add(hu.getM_HU_ID()))).build().tuToExistingLU(tuHU, qtyTU, luHU);
    // Remove from picking slots all destroyed HUs
    pickingCandidateService.inactivateForHUIds(huIdsDestroyedCollector);
    return MSG_OK;
}
Also used : HUEditorRow(de.metas.ui.web.handlingunits.HUEditorRow) PickingSlotRow(de.metas.ui.web.picking.pickingslot.PickingSlotRow) EmptyHUListener(de.metas.handlingunits.storage.EmptyHUListener) Autowired(org.springframework.beans.factory.annotation.Autowired) HUTransformService(de.metas.handlingunits.allocation.transfer.HUTransformService) PickingCandidateService(de.metas.handlingunits.picking.PickingCandidateService) ArrayList(java.util.ArrayList) ProcessPreconditionsResolution(de.metas.process.ProcessPreconditionsResolution) BigDecimal(java.math.BigDecimal) List(java.util.List) InterfaceWrapperHelper(org.adempiere.model.InterfaceWrapperHelper) Check(org.adempiere.util.Check) I_M_HU(de.metas.handlingunits.model.I_M_HU) IProcessPrecondition(de.metas.process.IProcessPrecondition) PickingSlotRow(de.metas.ui.web.picking.pickingslot.PickingSlotRow) I_M_HU(de.metas.handlingunits.model.I_M_HU) ArrayList(java.util.ArrayList) HUEditorRow(de.metas.ui.web.handlingunits.HUEditorRow) BigDecimal(java.math.BigDecimal)

Example 14 with PickingSlotRow

use of de.metas.ui.web.picking.pickingslot.PickingSlotRow in project metasfresh-webui-api by metasfresh.

the class WEBUI_PickingSlotsClearingView_TakeOutTUAndAddToLU method checkPreconditionsApplicable.

@Override
protected ProcessPreconditionsResolution checkPreconditionsApplicable() {
    // Validate the picking slots clearing selected row (left side)
    if (!isSingleSelectedPickingSlotRow()) {
        return ProcessPreconditionsResolution.rejectWithInternalReason("select one and only one picking slots HU");
    }
    final PickingSlotRow pickingSlotRow = getSingleSelectedPickingSlotRow();
    if (!pickingSlotRow.isTU()) {
        return ProcessPreconditionsResolution.rejectWithInternalReason("select a TU");
    }
    // Validate the packing HUs selected row (right side)
    if (!isSingleSelectedPackingHUsRow()) {
        return ProcessPreconditionsResolution.rejectWithInternalReason("select one and only one HU to pack to");
    }
    final HUEditorRow packingHURow = getSingleSelectedPackingHUsRow();
    if (!packingHURow.isLU()) {
        return ProcessPreconditionsResolution.rejectWithInternalReason("select a LU to pack too");
    }
    // 
    return ProcessPreconditionsResolution.accept();
}
Also used : PickingSlotRow(de.metas.ui.web.picking.pickingslot.PickingSlotRow) HUEditorRow(de.metas.ui.web.handlingunits.HUEditorRow)

Example 15 with PickingSlotRow

use of de.metas.ui.web.picking.pickingslot.PickingSlotRow in project metasfresh-webui-api by metasfresh.

the class WEBUI_Picking_TU_Label method doIt.

@Override
protected String doIt() throws Exception {
    final PickingSlotRow rowToProcess = getSingleSelectedRow();
    final I_M_HU hu = load(rowToProcess.getHuId(), I_M_HU.class);
    final HUToReportWrapper huToReport = HUToReportWrapper.of(hu);
    printPickingLabel(huToReport);
    return MSG_OK;
}
Also used : HUToReportWrapper(de.metas.handlingunits.report.HUToReportWrapper) PickingSlotRow(de.metas.ui.web.picking.pickingslot.PickingSlotRow) I_M_HU(de.metas.handlingunits.model.I_M_HU)

Aggregations

PickingSlotRow (de.metas.ui.web.picking.pickingslot.PickingSlotRow)21 I_M_HU (de.metas.handlingunits.model.I_M_HU)6 HUEditorRow (de.metas.ui.web.handlingunits.HUEditorRow)4 PickingCandidateService (de.metas.handlingunits.picking.PickingCandidateService)2 HUToReportWrapper (de.metas.handlingunits.report.HUToReportWrapper)2 IProcessPrecondition (de.metas.process.IProcessPrecondition)2 ProcessPreconditionsResolution (de.metas.process.ProcessPreconditionsResolution)2 DocumentIdsSelection (de.metas.ui.web.window.datatypes.DocumentIdsSelection)2 BigDecimal (java.math.BigDecimal)2 List (java.util.List)2 AdempiereException (org.adempiere.exceptions.AdempiereException)2 ImmutableList (com.google.common.collect.ImmutableList)1 I_M_Product (de.metas.adempiere.model.I_M_Product)1 IHUContext (de.metas.handlingunits.IHUContext)1 IHandlingUnitsBL (de.metas.handlingunits.IHandlingUnitsBL)1 AllocationUtils (de.metas.handlingunits.allocation.impl.AllocationUtils)1 HUProducerDestination (de.metas.handlingunits.allocation.impl.HUProducerDestination)1 HUTransformService (de.metas.handlingunits.allocation.transfer.HUTransformService)1 HUSplitBuilderCoreEngine (de.metas.handlingunits.allocation.transfer.impl.HUSplitBuilderCoreEngine)1 LUTUProducerDestination (de.metas.handlingunits.allocation.transfer.impl.LUTUProducerDestination)1