Search in sources :

Example 1 with IReceiptScheduleBL

use of de.metas.inoutcandidate.api.IReceiptScheduleBL in project metasfresh-webui-api by metasfresh.

the class WEBUI_M_ReceiptSchedule_SelectHUsToReverse method checkPreconditionsApplicable.

@Override
public ProcessPreconditionsResolution checkPreconditionsApplicable(final IProcessPreconditionsContext context) {
    if (!context.isSingleSelection()) {
        return ProcessPreconditionsResolution.rejectBecauseNotSingleSelection();
    }
    // Receipt schedule shall not be already closed
    final IReceiptScheduleBL receiptScheduleBL = Services.get(IReceiptScheduleBL.class);
    final I_M_ReceiptSchedule receiptSchedule = context.getSelectedModel(I_M_ReceiptSchedule.class);
    if (receiptScheduleBL.isClosed(receiptSchedule)) {
        return ProcessPreconditionsResolution.reject("already closed");
    }
    // Receipt schedule shall not be about packing materials
    if (receiptSchedule.isPackagingMaterial()) {
        return ProcessPreconditionsResolution.reject("not applying for packing materials");
    }
    return ProcessPreconditionsResolution.accept();
}
Also used : I_M_ReceiptSchedule(de.metas.handlingunits.model.I_M_ReceiptSchedule) IReceiptScheduleBL(de.metas.inoutcandidate.api.IReceiptScheduleBL)

Aggregations

I_M_ReceiptSchedule (de.metas.handlingunits.model.I_M_ReceiptSchedule)1 IReceiptScheduleBL (de.metas.inoutcandidate.api.IReceiptScheduleBL)1