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