use of de.metas.vertical.pharma.securpharm.service.SecurPharmHUAttributesScanner in project metasfresh-webui-api by metasfresh.
the class WEBUI_M_HU_SecurPharmScan method checkPreconditionsApplicable.
@Override
public ProcessPreconditionsResolution checkPreconditionsApplicable() {
final DocumentIdsSelection selectedRowIds = getSelectedRowIds();
if (selectedRowIds.isEmpty()) {
return ProcessPreconditionsResolution.rejectBecauseNoSelection();
}
if (!securPharmService.hasConfig()) {
return ProcessPreconditionsResolution.rejectWithInternalReason("no SecurPharm config");
}
if (!selectedRowIds.isSingleDocumentId()) {
return ProcessPreconditionsResolution.rejectBecauseNotSingleSelection().toInternal();
}
final HUEditorRow row = getSingleSelectedRow();
final HuId huId = row.getHuId();
final SecurPharmHUAttributesScanner scanner = securPharmService.newHUScanner();
if (!scanner.isEligible(huId)) {
return ProcessPreconditionsResolution.rejectWithInternalReason("HU not eligible");
}
return ProcessPreconditionsResolution.accept();
}
use of de.metas.vertical.pharma.securpharm.service.SecurPharmHUAttributesScanner in project metasfresh-webui-api by metasfresh.
the class WEBUI_M_HU_ReturnFromCustomer_Pharma method doIt.
@Override
protected String doIt() {
final DataMatrixCode dataMatrix = getDataMatrix();
final SecurPharmHUAttributesScanner scanner = securPharmService.newHUScanner();
streamSelectedHUs(Select.ONLY_TOPLEVEL).forEach(hu -> scanner.scanAndUpdateHUAttributes(dataMatrix, hu));
return super.doIt();
}
use of de.metas.vertical.pharma.securpharm.service.SecurPharmHUAttributesScanner in project metasfresh-webui-api by metasfresh.
the class WEBUI_M_HU_SecurPharmScan method doIt.
@Override
protected String doIt() {
final SecurPharmHUAttributesScanner scanner = securPharmService.newHUScanner();
final SecurPharmHUAttributesScannerResult result = scanner.scanAndUpdateHUAttributes(getDataMatrix(), getSelectedHuId());
//
// Update view
final HUEditorView view = getView();
if (result.getExtractedCUId() != null) {
view.addHUId(result.getExtractedCUId());
}
view.invalidateAll();
return result.getResultMessageAndCode();
}
Aggregations