Search in sources :

Example 1 with SecurPharmHUAttributesScanner

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();
}
Also used : DocumentIdsSelection(de.metas.ui.web.window.datatypes.DocumentIdsSelection) HuId(de.metas.handlingunits.HuId) SecurPharmHUAttributesScanner(de.metas.vertical.pharma.securpharm.service.SecurPharmHUAttributesScanner) HUEditorRow(de.metas.ui.web.handlingunits.HUEditorRow)

Example 2 with SecurPharmHUAttributesScanner

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();
}
Also used : DataMatrixCode(de.metas.vertical.pharma.securpharm.product.DataMatrixCode) SecurPharmHUAttributesScanner(de.metas.vertical.pharma.securpharm.service.SecurPharmHUAttributesScanner)

Example 3 with SecurPharmHUAttributesScanner

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();
}
Also used : SecurPharmHUAttributesScannerResult(de.metas.vertical.pharma.securpharm.service.SecurPharmHUAttributesScannerResult) HUEditorView(de.metas.ui.web.handlingunits.HUEditorView) SecurPharmHUAttributesScanner(de.metas.vertical.pharma.securpharm.service.SecurPharmHUAttributesScanner)

Aggregations

SecurPharmHUAttributesScanner (de.metas.vertical.pharma.securpharm.service.SecurPharmHUAttributesScanner)3 HuId (de.metas.handlingunits.HuId)1 HUEditorRow (de.metas.ui.web.handlingunits.HUEditorRow)1 HUEditorView (de.metas.ui.web.handlingunits.HUEditorView)1 DocumentIdsSelection (de.metas.ui.web.window.datatypes.DocumentIdsSelection)1 DataMatrixCode (de.metas.vertical.pharma.securpharm.product.DataMatrixCode)1 SecurPharmHUAttributesScannerResult (de.metas.vertical.pharma.securpharm.service.SecurPharmHUAttributesScannerResult)1