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