Search in sources :

Example 6 with PPOrderLinesView

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;
}
Also used : IHUPPOrderBL(de.metas.handlingunits.pporder.api.IHUPPOrderBL) PPOrderLinesView(de.metas.ui.web.pporder.PPOrderLinesView) I_M_HU(de.metas.handlingunits.model.I_M_HU) AdempiereException(org.adempiere.exceptions.AdempiereException) HUEditorView(de.metas.ui.web.handlingunits.HUEditorView) HUEditorRow(de.metas.ui.web.handlingunits.HUEditorRow)

Example 7 with PPOrderLinesView

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();
}
Also used : PPOrderLinesView(de.metas.ui.web.pporder.PPOrderLinesView) PPOrderLineRow(de.metas.ui.web.pporder.PPOrderLineRow)

Example 8 with PPOrderLinesView

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);
}
Also used : PPOrderLinesView(de.metas.ui.web.pporder.PPOrderLinesView) ViewId(de.metas.ui.web.view.ViewId) IViewsRepository(de.metas.ui.web.view.IViewsRepository)

Aggregations

PPOrderLinesView (de.metas.ui.web.pporder.PPOrderLinesView)8 I_M_HU (de.metas.handlingunits.model.I_M_HU)3 IHUPPOrderBL (de.metas.handlingunits.pporder.api.IHUPPOrderBL)3 PPOrderLineRow (de.metas.ui.web.pporder.PPOrderLineRow)3 AdempiereException (org.adempiere.exceptions.AdempiereException)3 HUsToNewTUsRequest (de.metas.handlingunits.allocation.transfer.HUTransformService.HUsToNewTUsRequest)2 HUEditorRow (de.metas.ui.web.handlingunits.HUEditorRow)2 I_M_Source_HU (de.metas.handlingunits.model.I_M_Source_HU)1 EmptyHUListener (de.metas.handlingunits.storage.EmptyHUListener)1 HUEditorView (de.metas.ui.web.handlingunits.HUEditorView)1 IViewsRepository (de.metas.ui.web.view.IViewsRepository)1 ViewId (de.metas.ui.web.view.ViewId)1 HashMap (java.util.HashMap)1