Search in sources :

Example 1 with HUToReport

use of de.metas.handlingunits.report.HUToReport 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 2 with HUToReport

use of de.metas.handlingunits.report.HUToReport in project metasfresh-webui-api by metasfresh.

the class WEBUI_M_HU_PrintReceiptLabel method checkPreconditionsApplicable.

@Override
public ProcessPreconditionsResolution checkPreconditionsApplicable() {
    if (!isHUEditorView()) {
        return ProcessPreconditionsResolution.rejectWithInternalReason("not the HU view");
    }
    final HUReportService huReportService = HUReportService.get();
    // note: at this point, the JavaProces's ctx was not set so we are using the global context
    final Properties ctx = Env.getCtx();
    final int adProcessId = huReportService.retrievePrintReceiptLabelProcessId();
    if (adProcessId <= 0) {
        return ProcessPreconditionsResolution.reject("Receipt label process not configured via sysconfig " + HUReportService.SYSCONFIG_RECEIPT_LABEL_PROCESS_ID);
    }
    if (!getSelectedRowIds().isSingleDocumentId()) {
        return ProcessPreconditionsResolution.reject("No (single) row selected");
    }
    final HUToReport hu = getSingleSelectedRow().getAsHUToReportOrNull();
    if (hu == null) {
        return ProcessPreconditionsResolution.reject("No (single) HU selected");
    }
    final List<HUToReport> husToProcess = huReportService.getHUsToProcess(hu, adProcessId);
    if (husToProcess.isEmpty()) {
        return ProcessPreconditionsResolution.reject("current HU's type does not match the receipt label process");
    }
    return ProcessPreconditionsResolution.accept();
}
Also used : HUToReport(de.metas.handlingunits.report.HUToReport) HUReportService(de.metas.handlingunits.report.HUReportService) Properties(java.util.Properties)

Aggregations

HUReportService (de.metas.handlingunits.report.HUReportService)2 HUToReport (de.metas.handlingunits.report.HUToReport)2 RunOutOfTrx (de.metas.process.RunOutOfTrx)1 Properties (java.util.Properties)1