diff --git a/app/build.gradle b/app/build.gradle index cadf3583..5206aeca 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ apply plugin: 'com.google.gms.google-services' android { - def appVersionCode = 493 - def appVersionName = '1.46.05' + def appVersionCode = 494 + def appVersionName = '1.46.06' signingConfigs { release { diff --git a/app/src/main/java/it/integry/integrywmsnative/gest/spedizione/SpedizioneViewModel.java b/app/src/main/java/it/integry/integrywmsnative/gest/spedizione/SpedizioneViewModel.java index 6c40c773..8ecdad6c 100644 --- a/app/src/main/java/it/integry/integrywmsnative/gest/spedizione/SpedizioneViewModel.java +++ b/app/src/main/java/it/integry/integrywmsnative/gest/spedizione/SpedizioneViewModel.java @@ -515,7 +515,6 @@ public class SpedizioneViewModel { } private Pair sendLUPositionChangeRequest() { - final CountDownLatch latch = new CountDownLatch(1); AtomicReference> result = new AtomicReference<>(); @@ -533,9 +532,22 @@ public class SpedizioneViewModel { return null; } - private void sendBatchLotSelectionRequest(List availableBatchLots, RunnableArgs onComplete) { - if (this.mListener != null) - mListener.onBatchLotSelectionRequest(availableBatchLots, onComplete); + private MtbPartitaMag sendBatchLotSelectionRequest(List availableBatchLots) { + final CountDownLatch latch = new CountDownLatch(1); + AtomicReference result = new AtomicReference<>(); + + mListener.onBatchLotSelectionRequest(availableBatchLots, item -> { + result.set(item); + latch.countDown(); + }); + + try { + latch.await(); // Attende che il dialog venga chiuso + return result.get(); + } catch (InterruptedException e) { + this.sendError(e); + } + return null; } public void processBarcodeDTO(BarcodeScanDTO barcodeScanDTO) throws Exception { @@ -1016,24 +1028,23 @@ public class SpedizioneViewModel { .collect(Collectors.toList())); } - this.sendBatchLotSelectionRequest(tmp, selected -> { - this.sendOnLoadingEnded(); + var selected = this.sendBatchLotSelectionRequest(tmp); + this.sendOnLoadingEnded(); - if (selected != null) { - MtbColr scannedMtbColr = pickingObjectDTO.getTempPickData().getSourceMtbColt().getMtbColr().stream() - .filter(x -> x.getCodMart().equalsIgnoreCase(pickingObjectDTO.getMtbAart().getCodMart()) && - ((x.getPartitaMag() != null && selected.getPartitaMag() != null && x.getPartitaMag().equalsIgnoreCase(selected.getPartitaMag())) - || (x.getPartitaMag() == null && selected.getPartitaMag() == null))) - .findFirst() - .orElse(null); + if (selected != null) { + MtbColr scannedMtbColr = pickingObjectDTO.getTempPickData().getSourceMtbColt().getMtbColr().stream() + .filter(x -> x.getCodMart().equalsIgnoreCase(pickingObjectDTO.getMtbAart().getCodMart()) && + ((x.getPartitaMag() != null && selected.getPartitaMag() != null && x.getPartitaMag().equalsIgnoreCase(selected.getPartitaMag())) + || (x.getPartitaMag() == null && selected.getPartitaMag() == null))) + .findFirst() + .orElse(null); - try { - dispatchOrdineRowOnPostBatchLotSelection(pickingObjectDTO, refMtbColt, refMtbColr, scannedMtbColr, canPartitaMagBeChanged, executeImmediately); - } catch (Exception e) { - this.sendError(e); - } + try { + dispatchOrdineRowOnPostBatchLotSelection(pickingObjectDTO, refMtbColt, refMtbColr, scannedMtbColr, canPartitaMagBeChanged, executeImmediately); + } catch (Exception e) { + this.sendError(e); } - }); + } } else { dispatchOrdineRowOnPostBatchLotSelection(pickingObjectDTO, refMtbColt, refMtbColr, scannedMtbColrs.get(0), canPartitaMagBeChanged, executeImmediately);