Search in sources :

Example 6 with PPOrderLineRow

use of de.metas.ui.web.pporder.PPOrderLineRow 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 7 with PPOrderLineRow

use of de.metas.ui.web.pporder.PPOrderLineRow in project metasfresh-webui-api by metasfresh.

the class WEBUI_PP_Order_M_Source_HU_IssueTuQty method checkPreconditionsApplicable.

@Override
public final ProcessPreconditionsResolution checkPreconditionsApplicable() {
    if (!getSelectedRowIds().isSingleDocumentId()) {
        return ProcessPreconditionsResolution.rejectBecauseNotSingleSelection();
    }
    final PPOrderLineRow singleSelectedRow = getSingleSelectedRow();
    if (!singleSelectedRow.isIssue()) {
        final String internalReason = StringUtils.formatMessage("The selected row is not an issue-row; row={}", singleSelectedRow);
        return ProcessPreconditionsResolution.rejectWithInternalReason(internalReason);
    }
    if (singleSelectedRow.isProcessed()) {
        final String internalReason = StringUtils.formatMessage("The selected row is already processed; row={}", singleSelectedRow);
        return ProcessPreconditionsResolution.rejectWithInternalReason(internalReason);
    }
    final List<I_M_Source_HU> sourceHus = retrieveActiveSourceHus(singleSelectedRow);
    if (sourceHus.isEmpty()) {
        final String internalReason = StringUtils.formatMessage("There are no sourceHU records for the selected row; row={}", singleSelectedRow);
        return ProcessPreconditionsResolution.rejectWithInternalReason(internalReason);
    }
    return ProcessPreconditionsResolution.accept();
}
Also used : I_M_Source_HU(de.metas.handlingunits.model.I_M_Source_HU) PPOrderLineRow(de.metas.ui.web.pporder.PPOrderLineRow)

Aggregations

PPOrderLineRow (de.metas.ui.web.pporder.PPOrderLineRow)7 PPOrderLinesView (de.metas.ui.web.pporder.PPOrderLinesView)3 I_M_Source_HU (de.metas.handlingunits.model.I_M_Source_HU)2 HUsToNewTUsRequest (de.metas.handlingunits.allocation.transfer.HUTransformService.HUsToNewTUsRequest)1 I_M_HU (de.metas.handlingunits.model.I_M_HU)1 I_M_HU_LUTU_Configuration (de.metas.handlingunits.model.I_M_HU_LUTU_Configuration)1 IHUPPOrderBL (de.metas.handlingunits.pporder.api.IHUPPOrderBL)1 IPPOrderReceiptHUProducer (de.metas.handlingunits.pporder.api.IPPOrderReceiptHUProducer)1 EmptyHUListener (de.metas.handlingunits.storage.EmptyHUListener)1 RunOutOfTrx (de.metas.process.RunOutOfTrx)1 IView (de.metas.ui.web.view.IView)1 ViewId (de.metas.ui.web.view.ViewId)1 HashMap (java.util.HashMap)1 AdempiereException (org.adempiere.exceptions.AdempiereException)1