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