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;
}
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;
}
Aggregations