Search in sources :

Example 1 with RunOutOfTrx

use of de.metas.process.RunOutOfTrx in project metasfresh-webui-api by metasfresh.

the class WEBUI_PP_Order_Receipt method doIt.

@Override
@RunOutOfTrx
protected String doIt() throws Exception {
    final PPOrderLineRow selectedRow = getSingleSelectedRow();
    final IPPOrderReceiptHUProducer receiptCandidatesProducer = createReceiptCandidatesProducer(selectedRow);
    // Calculate and set the LU/TU config from packing info params and defaults
    final I_M_HU_LUTU_Configuration lutuConfig = getPackingInfoParams().createAndSaveNewLUTUConfig();
    receiptCandidatesProducer.setM_HU_LUTU_Configuration(lutuConfig);
    receiptCandidatesProducer.createReceiptCandidatesAndPlanningHUs();
    return MSG_OK;
}
Also used : I_M_HU_LUTU_Configuration(de.metas.handlingunits.model.I_M_HU_LUTU_Configuration) IPPOrderReceiptHUProducer(de.metas.handlingunits.pporder.api.IPPOrderReceiptHUProducer) PPOrderLineRow(de.metas.ui.web.pporder.PPOrderLineRow) RunOutOfTrx(de.metas.process.RunOutOfTrx)

Example 2 with RunOutOfTrx

use of de.metas.process.RunOutOfTrx in project metasfresh-webui-api by metasfresh.

the class WEBUI_M_HU_PrintReceiptLabel method doIt.

@Override
@RunOutOfTrx
protected String doIt() throws Exception {
    final HUReportService huReportService = HUReportService.get();
    final int adProcessId = huReportService.retrievePrintReceiptLabelProcessId();
    final HUToReport hu = getSingleSelectedRow().getAsHUToReport();
    final List<HUToReport> husToProcess = huReportService.getHUsToProcess(hu, adProcessId);
    HUReportExecutor.newInstance(getCtx()).windowNo(getProcessInfo().getWindowNo()).numberOfCopies(p_copies).executeHUReportAfterCommit(adProcessId, husToProcess);
    return MSG_OK;
}
Also used : HUToReport(de.metas.handlingunits.report.HUToReport) HUReportService(de.metas.handlingunits.report.HUReportService) RunOutOfTrx(de.metas.process.RunOutOfTrx)

Example 3 with RunOutOfTrx

use of de.metas.process.RunOutOfTrx 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 RunOutOfTrx

use of de.metas.process.RunOutOfTrx in project metasfresh-webui-api by metasfresh.

the class WEBUI_M_HU_ReverseReceipt method doIt.

@Override
@RunOutOfTrx
protected String doIt() throws Exception {
    final List<I_M_ReceiptSchedule> receiptSchedules = getM_ReceiptSchedules();
    final List<Integer> huIdsToReverse = retrieveHUsToReverse();
    boolean hasChanges = false;
    try {
        for (final I_M_ReceiptSchedule receiptSchedule : receiptSchedules) {
            final ReceiptCorrectHUsProcessor processor = ReceiptCorrectHUsProcessor.builder().setM_ReceiptSchedule(receiptSchedule).tolerateNoHUsFound().build();
            if (processor.isNoHUsFound()) {
                continue;
            }
            final List<I_M_InOut> receiptsToReverse = processor.getReceiptsToReverseFromHUIds(huIdsToReverse);
            if (receiptsToReverse.isEmpty()) {
                continue;
            }
            processor.reverseReceipts(receiptsToReverse);
            hasChanges = true;
        }
    } finally {
        if (hasChanges) {
            // Reset the view's affected HUs
            getView().removeHUIdsAndInvalidate(huIdsToReverse);
            // Notify all active views that given receipt schedules were changed
            viewsRepo.notifyRecordsChanged(TableRecordReference.ofSet(receiptSchedules));
        }
    }
    if (!hasChanges) {
        throw new AdempiereException("@NotFound@ @M_InOut_ID@");
    }
    return MSG_OK;
}
Also used : ReceiptCorrectHUsProcessor(de.metas.handlingunits.inout.ReceiptCorrectHUsProcessor) I_M_InOut(org.compiere.model.I_M_InOut) AdempiereException(org.adempiere.exceptions.AdempiereException) I_M_ReceiptSchedule(de.metas.handlingunits.model.I_M_ReceiptSchedule) RunOutOfTrx(de.metas.process.RunOutOfTrx)

Example 5 with RunOutOfTrx

use of de.metas.process.RunOutOfTrx in project metasfresh-webui-api by metasfresh.

the class WEBUI_DD_OrderLine_MoveHU method doIt.

@Override
@RunOutOfTrx
protected String doIt() throws Exception {
    final int ddOrderLineId = getSingleSelectedRow().getId().toInt();
    final I_DD_OrderLine ddOrderLine = load(ddOrderLineId, I_DD_OrderLine.class);
    final I_M_HU hu = load(p_M_HU_ID, I_M_HU.class);
    huDDOrderBL.createMovements().setDDOrderLines(ImmutableList.of(ddOrderLine)).setLocatorToIdOverride(p_M_LocatorTo_ID).setDoDirectMovements(true).setFailIfCannotAllocate(true).allocateHU(hu).processWithinOwnTrx();
    return MSG_OK;
}
Also used : I_M_HU(de.metas.handlingunits.model.I_M_HU) I_DD_OrderLine(org.eevolution.model.I_DD_OrderLine) RunOutOfTrx(de.metas.process.RunOutOfTrx)

Aggregations

RunOutOfTrx (de.metas.process.RunOutOfTrx)6 I_M_HU (de.metas.handlingunits.model.I_M_HU)2 I_M_HU_LUTU_Configuration (de.metas.handlingunits.model.I_M_HU_LUTU_Configuration)2 I_M_ReceiptSchedule (de.metas.handlingunits.model.I_M_ReceiptSchedule)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 IPPOrderReceiptHUProducer (de.metas.handlingunits.pporder.api.IPPOrderReceiptHUProducer)1 ReceiptScheduleHUGenerator (de.metas.handlingunits.receiptschedule.impl.ReceiptScheduleHUGenerator)1 HUReportService (de.metas.handlingunits.report.HUReportService)1 HUToReport (de.metas.handlingunits.report.HUToReport)1 Quantity (de.metas.quantity.Quantity)1 PPOrderLineRow (de.metas.ui.web.pporder.PPOrderLineRow)1 AdempiereException (org.adempiere.exceptions.AdempiereException)1 I_C_BPartner (org.compiere.model.I_C_BPartner)1 I_M_InOut (org.compiere.model.I_M_InOut)1 I_DD_OrderLine (org.eevolution.model.I_DD_OrderLine)1