Search in sources :

Example 1 with IHUProducerAllocationDestination

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

the class WEBUI_PickingSlotsClearingView_TakeOutHUAndAddToNewHU method doIt.

@Override
protected String doIt() throws Exception {
    if (qtyCU == null || qtyCU.signum() <= 0) {
        throw new FillMandatoryException(PARAM_QtyCU);
    }
    final I_M_HU fromHU = getSingleSelectedPickingSlotTopLevelHU();
    final IAllocationSource source = HUListAllocationSourceDestination.of(fromHU).setDestroyEmptyHUs(true);
    final IHUProducerAllocationDestination destination = createHUProducer(fromHU);
    HULoader.of(source, destination).setAllowPartialUnloads(false).setAllowPartialLoads(false).load(prepareUnloadRequest(fromHU, qtyCU).setForceQtyAllocation(true).create());
    // If the source HU was destroyed, then "remove" it from picking slots
    if (handlingUnitsBL.isDestroyedRefreshFirst(fromHU)) {
        pickingCandidateService.inactivateForHUId(fromHU.getM_HU_ID());
    }
    return MSG_OK;
}
Also used : IAllocationSource(de.metas.handlingunits.allocation.IAllocationSource) I_M_HU(de.metas.handlingunits.model.I_M_HU) IHUProducerAllocationDestination(de.metas.handlingunits.allocation.IHUProducerAllocationDestination) FillMandatoryException(org.adempiere.exceptions.FillMandatoryException)

Example 2 with IHUProducerAllocationDestination

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

the class WEBUI_PickingSlotsClearingView_TakeOutMultiHUsAndAddToNewHU method doIt.

@Override
protected String doIt() throws Exception {
    final List<I_M_HU> fromHUs = getSelectedPickingSlotTopLevelHUs();
    final IAllocationSource source = HUListAllocationSourceDestination.of(fromHUs).setDestroyEmptyHUs(true);
    final IHUProducerAllocationDestination destination = createHUProducer();
    HULoader.of(source, destination).setAllowPartialUnloads(false).setAllowPartialLoads(false).unloadAllFromSource();
    // If the source HU was destroyed, then "remove" it from picking slots
    final ImmutableSet<Integer> destroyedHUIds = fromHUs.stream().filter(handlingUnitsBL::isDestroyedRefreshFirst).map(I_M_HU::getM_HU_ID).collect(ImmutableSet.toImmutableSet());
    if (!destroyedHUIds.isEmpty()) {
        pickingCandidateService.inactivateForHUIds(destroyedHUIds);
    }
    return MSG_OK;
}
Also used : IAllocationSource(de.metas.handlingunits.allocation.IAllocationSource) I_M_HU(de.metas.handlingunits.model.I_M_HU) IHUProducerAllocationDestination(de.metas.handlingunits.allocation.IHUProducerAllocationDestination)

Aggregations

IAllocationSource (de.metas.handlingunits.allocation.IAllocationSource)2 IHUProducerAllocationDestination (de.metas.handlingunits.allocation.IHUProducerAllocationDestination)2 I_M_HU (de.metas.handlingunits.model.I_M_HU)2 FillMandatoryException (org.adempiere.exceptions.FillMandatoryException)1