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