Search in sources :

Example 1 with I_M_ReceiptSchedule

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

the class WEBUI_M_ReceiptSchedule_SelectHUsToReverse method checkPreconditionsApplicable.

@Override
public ProcessPreconditionsResolution checkPreconditionsApplicable(final IProcessPreconditionsContext context) {
    if (!context.isSingleSelection()) {
        return ProcessPreconditionsResolution.rejectBecauseNotSingleSelection();
    }
    // Receipt schedule shall not be already closed
    final IReceiptScheduleBL receiptScheduleBL = Services.get(IReceiptScheduleBL.class);
    final I_M_ReceiptSchedule receiptSchedule = context.getSelectedModel(I_M_ReceiptSchedule.class);
    if (receiptScheduleBL.isClosed(receiptSchedule)) {
        return ProcessPreconditionsResolution.reject("already closed");
    }
    // Receipt schedule shall not be about packing materials
    if (receiptSchedule.isPackagingMaterial()) {
        return ProcessPreconditionsResolution.reject("not applying for packing materials");
    }
    return ProcessPreconditionsResolution.accept();
}
Also used : I_M_ReceiptSchedule(de.metas.handlingunits.model.I_M_ReceiptSchedule) IReceiptScheduleBL(de.metas.inoutcandidate.api.IReceiptScheduleBL)

Example 2 with I_M_ReceiptSchedule

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

the class WEBUI_M_ReceiptSchedule_RunMaterialReceiptJasper method doIt.

@Override
protected String doIt() throws Exception {
    final I_M_ReceiptSchedule receiptSchedule = getRecord(I_M_ReceiptSchedule.class);
    HUReceiptScheduleReportExecutor.get(receiptSchedule).executeHUReport();
    return MSG_OK;
}
Also used : I_M_ReceiptSchedule(de.metas.handlingunits.model.I_M_ReceiptSchedule)

Example 3 with I_M_ReceiptSchedule

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

the class WEBUI_M_ReceiptSchedule_ReceiveHUs_Base method doIt.

@Override
@RunOutOfTrx
protected final String doIt() throws Exception {
    final I_M_ReceiptSchedule receiptSchedule = getM_ReceiptSchedule();
    final ReceiptScheduleHUGenerator huGenerator = ReceiptScheduleHUGenerator.newInstance(this).addM_ReceiptSchedule(receiptSchedule).setUpdateReceiptScheduleDefaultConfiguration(isUpdateReceiptScheduleDefaultConfiguration());
    // 
    // Get/Create the initial LU/TU configuration
    final I_M_HU_LUTU_Configuration lutuConfigurationOrig = getCurrentLUTUConfiguration(receiptSchedule);
    // 
    // Create the effective LU/TU configuration
    final I_M_HU_LUTU_Configuration lutuConfiguration = createM_HU_LUTU_Configuration(lutuConfigurationOrig);
    Services.get(ILUTUConfigurationFactory.class).save(lutuConfiguration);
    huGenerator.setM_HU_LUTU_Configuration(lutuConfiguration);
    // 
    // Calculate the target CUs that we want to allocate
    final ILUTUProducerAllocationDestination lutuProducer = huGenerator.getLUTUProducerAllocationDestination();
    final Quantity qtyCUsTotal = lutuProducer.calculateTotalQtyCU();
    if (qtyCUsTotal.isInfinite()) {
        throw new TerminalException("LU/TU configuration is resulting to infinite quantity: " + lutuConfiguration);
    }
    huGenerator.setQtyToAllocateTarget(qtyCUsTotal);
    // 
    // Generate the HUs
    final List<I_M_HU> hus = huGenerator.generateWithinOwnTransaction();
    openHUsToReceive(hus);
    return MSG_OK;
}
Also used : I_M_HU_LUTU_Configuration(de.metas.handlingunits.model.I_M_HU_LUTU_Configuration) I_M_HU(de.metas.handlingunits.model.I_M_HU) TerminalException(de.metas.adempiere.form.terminal.TerminalException) I_M_ReceiptSchedule(de.metas.handlingunits.model.I_M_ReceiptSchedule) Quantity(de.metas.quantity.Quantity) ILUTUConfigurationFactory(de.metas.handlingunits.allocation.ILUTUConfigurationFactory) ILUTUProducerAllocationDestination(de.metas.handlingunits.allocation.ILUTUProducerAllocationDestination) ReceiptScheduleHUGenerator(de.metas.handlingunits.receiptschedule.impl.ReceiptScheduleHUGenerator) RunOutOfTrx(de.metas.process.RunOutOfTrx)

Example 4 with I_M_ReceiptSchedule

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

the class WEBUI_M_ReceiptSchedule_ReceiveHUs_UsingDefaults method buildDefaultPackingInfo.

private String buildDefaultPackingInfo(final IProcessPreconditionsContext context) {
    final I_M_ReceiptSchedule receiptSchedule = context.getSelectedModel(I_M_ReceiptSchedule.class);
    if (receiptSchedule == null) {
        // no override
        return null;
    }
    final I_M_HU_LUTU_Configuration lutuConfig = getCurrentLUTUConfiguration(receiptSchedule);
    adjustLUTUConfiguration(lutuConfig, receiptSchedule);
    return HUPackingInfoFormatter.newInstance().setShowLU(// NOTE: don't show LU info because makes the whole label to long. see https://github.com/metasfresh/metasfresh-webui-frontend/issues/315#issuecomment-280624562
    false).format(HUPackingInfos.of(lutuConfig));
}
Also used : I_M_HU_LUTU_Configuration(de.metas.handlingunits.model.I_M_HU_LUTU_Configuration) I_M_ReceiptSchedule(de.metas.handlingunits.model.I_M_ReceiptSchedule)

Example 5 with I_M_ReceiptSchedule

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

the class WEBUI_M_ReceiptSchedule_ReceiveHUs_UsingConfig method getDefaultLUTUConfiguration.

private I_M_HU_LUTU_Configuration getDefaultLUTUConfiguration() {
    if (_defaultLUTUConfiguration == null) {
        final I_M_ReceiptSchedule receiptSchedule = getM_ReceiptSchedule();
        final I_M_HU_LUTU_Configuration defaultLUTUConfiguration = getCurrentLUTUConfiguration(receiptSchedule);
        adjustLUTUConfiguration(defaultLUTUConfiguration, receiptSchedule);
        _defaultLUTUConfiguration = defaultLUTUConfiguration;
    }
    return _defaultLUTUConfiguration;
}
Also used : I_M_HU_LUTU_Configuration(de.metas.handlingunits.model.I_M_HU_LUTU_Configuration) I_M_ReceiptSchedule(de.metas.handlingunits.model.I_M_ReceiptSchedule)

Aggregations

I_M_ReceiptSchedule (de.metas.handlingunits.model.I_M_ReceiptSchedule)9 I_M_HU_LUTU_Configuration (de.metas.handlingunits.model.I_M_HU_LUTU_Configuration)3 I_M_HU (de.metas.handlingunits.model.I_M_HU)2 RunOutOfTrx (de.metas.process.RunOutOfTrx)2 AdempiereException (org.adempiere.exceptions.AdempiereException)2 TerminalException (de.metas.adempiere.form.terminal.TerminalException)1 ILUTUConfigurationFactory (de.metas.handlingunits.allocation.ILUTUConfigurationFactory)1 ILUTUProducerAllocationDestination (de.metas.handlingunits.allocation.ILUTUProducerAllocationDestination)1 ReceiptCorrectHUsProcessor (de.metas.handlingunits.inout.ReceiptCorrectHUsProcessor)1 IHUReceiptScheduleBL (de.metas.handlingunits.receiptschedule.IHUReceiptScheduleBL)1 ReceiptScheduleHUGenerator (de.metas.handlingunits.receiptschedule.impl.ReceiptScheduleHUGenerator)1 IReceiptScheduleBL (de.metas.inoutcandidate.api.IReceiptScheduleBL)1 Quantity (de.metas.quantity.Quantity)1 EntityNotFoundException (de.metas.ui.web.exceptions.EntityNotFoundException)1 BufferedImage (java.awt.image.BufferedImage)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 I_M_InOut (org.compiere.model.I_M_InOut)1 MImage (org.compiere.model.MImage)1