use of de.metas.ui.web.pporder.PPOrderLinesView in project metasfresh-webui-api by metasfresh.
the class WEBUI_PP_Order_HUEditor_IssueTopLevelHUs method doIt.
@Override
protected String doIt() throws Exception {
final Stream<HUEditorRow> selectedTopLevelHuRows = streamSelectedRows(HUEditorRowFilter.select(Select.ONLY_TOPLEVEL));
final List<I_M_HU> selectedEligibleRows = retrieveEligibleHUEditorRows(selectedTopLevelHuRows).map(HUEditorRow::getM_HU).collect(ImmutableList.toImmutableList());
final HUEditorView huEditorView = getView();
if (selectedEligibleRows.isEmpty()) {
throw new AdempiereException("@NoSelection@");
}
final PPOrderLinesView ppOrderView = getPPOrderView().get();
final int ppOrderId = ppOrderView.getPP_Order_ID();
Services.get(IHUPPOrderBL.class).createIssueProducer().setTargetOrderBOMLinesByPPOrderId(ppOrderId).createDraftIssues(selectedEligibleRows);
huEditorView.removeHUsAndInvalidate(selectedEligibleRows);
ppOrderView.invalidateAll();
return MSG_OK;
}
use of de.metas.ui.web.pporder.PPOrderLinesView in project metasfresh-webui-api by metasfresh.
the class WEBUI_PP_Order_Receipt method checkPreconditionsApplicable.
@Override
protected ProcessPreconditionsResolution checkPreconditionsApplicable() {
if (!getSelectedRowIds().isSingleDocumentId()) {
return ProcessPreconditionsResolution.rejectBecauseNotSingleSelection();
}
final PPOrderLinesView ppOrder = getView();
if (!(ppOrder.isStatusPlanning() || ppOrder.isStatusReview())) {
return ProcessPreconditionsResolution.rejectWithInternalReason("not planning or in review");
}
final PPOrderLineRow ppOrderLineRow = getSingleSelectedRow();
if (!ppOrderLineRow.isReceipt()) {
return ProcessPreconditionsResolution.rejectWithInternalReason("ppOrderLineRow is not a receipt line; ppOrderLineRow=" + ppOrderLineRow);
}
if (ppOrderLineRow.isProcessed()) {
return ProcessPreconditionsResolution.rejectWithInternalReason("ppOrderLineRow is already processed; ppOrderLineRow=" + ppOrderLineRow);
}
//
// OK, Override caption with current packing info, if any
final String packingInfo = getSingleSelectedRow().getPackingInfo();
if (!Check.isEmpty(packingInfo, true)) {
return ProcessPreconditionsResolution.builder().setCaptionOverride(packingInfo).accept();
}
// OK
return ProcessPreconditionsResolution.accept();
}
use of de.metas.ui.web.pporder.PPOrderLinesView in project metasfresh-webui-api by metasfresh.
the class WEBUI_PP_Order_HUEditor_ProcessBase method getPPOrderView.
protected Optional<PPOrderLinesView> getPPOrderView() {
final ViewId parentViewId = getView().getParentViewId();
if (parentViewId == null) {
return Optional.empty();
}
final IViewsRepository viewsRepo = Adempiere.getSpringApplicationContext().getBean(IViewsRepository.class);
final PPOrderLinesView ppOrderView = viewsRepo.getView(parentViewId, PPOrderLinesView.class);
return Optional.of(ppOrderView);
}
Aggregations