diff --git a/.idea/git_toolbox_prj.xml b/.idea/git_toolbox_prj.xml new file mode 100644 index 00000000..02b915b8 --- /dev/null +++ b/.idea/git_toolbox_prj.xml @@ -0,0 +1,15 @@ + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/it/integry/integrywmsnative/core/model/MtbDepoPosizione.java b/app/src/main/java/it/integry/integrywmsnative/core/model/MtbDepoPosizione.java index 8b06a471..2f315ca7 100644 --- a/app/src/main/java/it/integry/integrywmsnative/core/model/MtbDepoPosizione.java +++ b/app/src/main/java/it/integry/integrywmsnative/core/model/MtbDepoPosizione.java @@ -1,6 +1,7 @@ package it.integry.integrywmsnative.core.model; import it.integry.integrywmsnative.core.utility.UtilityLogger; +import it.integry.integrywmsnative.core.utility.UtilityString; public class MtbDepoPosizione { @@ -11,6 +12,8 @@ public class MtbDepoPosizione { private String flagLineaProduzione; private Integer priorita; + private String tipoMagazAutomatico; + public MtbDepoPosizione clone() { @@ -85,4 +88,17 @@ public class MtbDepoPosizione { this.priorita = priorita; return this; } + + public String getTipoMagazAutomatico() { + return tipoMagazAutomatico; + } + + public MtbDepoPosizione setTipoMagazAutomatico(String tipoMagazAutomatico) { + this.tipoMagazAutomatico = tipoMagazAutomatico; + return this; + } + + public boolean isMagazzinoAutomatico() { + return !UtilityString.isNullOrEmpty(getTipoMagazAutomatico()); + } } 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 30228ed2..117cb021 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 @@ -81,6 +81,7 @@ import it.integry.integrywmsnative.core.utility.UtilityDate; import it.integry.integrywmsnative.core.utility.UtilityPosizione; import it.integry.integrywmsnative.core.utility.UtilityString; import it.integry.integrywmsnative.gest.spedizione.exceptions.CurrentMonoLUPositionIsNotCorrectException; +import it.integry.integrywmsnative.gest.spedizione.exceptions.InvalidMagazzinoAutomaticoMovementException; import it.integry.integrywmsnative.gest.spedizione.exceptions.InvalidPesoKGException; import it.integry.integrywmsnative.gest.spedizione.exceptions.NotCurrentYearLUException; import it.integry.integrywmsnative.gest.spedizione.exceptions.OrdersLoadException; @@ -364,45 +365,53 @@ public class SpedizioneViewModel { private void processBarcodePosizioneNotOpenedLU(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) { MtbDepoPosizione foundPosizione = UtilityPosizione.getFromCache(barcodeScanDTO.getStringValue()); - if (foundPosizione != null) { - if (foundPosizione.isFlagMonoCollo()) { - - this.mPosizioneRESTConsumer.getBancaliInPosizione(foundPosizione, mtbColtList -> { - if (mtbColtList == null || mtbColtList.size() != 1) { - //Nessuna UL trovata oppure più UL nella stessa posizione - this.sendError(new NoLUFoundException()); - } else { - mColliMagazzinoRESTConsumer.getByTestata(mtbColtList.get(0), true, false, mtbColt -> { - - if (mtbColt.getSegno() != mDefaultSegnoCol) { - this.sendError(new InvalidLUException()); - onComplete.run(); - } else { - //Reset of existant mtbColrs - mtbColt.setMtbColr(new ObservableArrayList<>()); - - this.mCurrentMtbColt = mtbColt; - mMtbColtSessionID = this.mColliDataRecoverService.startNewSession(mtbColt, mTestateOrdini); - this.mIsNewLU = false; - - this.sendLUOpened(mtbColt); - - onComplete.run(); - } - - }, this::sendError); - } - }, this::sendError); - - } else { - //La posizione non è Mono-UL - this.sendError(new CurrentMonoLUPositionIsNotCorrectException()); - } - - } else { + if (foundPosizione == null) { //Nessuna posizione trovata con questo barcode this.sendError(new ScannedPositionNotExistException()); + return; } + + if (!foundPosizione.isFlagMonoCollo()) { + //La posizione non è Mono-UL + this.sendError(new CurrentMonoLUPositionIsNotCorrectException()); + return; + } + + if (foundPosizione.isMagazzinoAutomatico()) { + //La posizione è di un magazzino automatico + this.sendError(new InvalidMagazzinoAutomaticoMovementException(foundPosizione)); + return; + } + + this.mPosizioneRESTConsumer.getBancaliInPosizione(foundPosizione, mtbColtList -> { + if (mtbColtList == null || mtbColtList.size() != 1) { + //Nessuna UL trovata oppure più UL nella stessa posizione + this.sendError(new NoLUFoundException()); + return; + } + + mColliMagazzinoRESTConsumer.getByTestata(mtbColtList.get(0), true, false, mtbColt -> { + + if (mtbColt.getSegno() != mDefaultSegnoCol) { + this.sendError(new InvalidLUException()); + onComplete.run(); + return; + } + + //Reset of existant mtbColrs + mtbColt.setMtbColr(new ObservableArrayList<>()); + + this.mCurrentMtbColt = mtbColt; + this.mMtbColtSessionID = this.mColliDataRecoverService.startNewSession(mtbColt, mTestateOrdini); + this.mIsNewLU = false; + + this.sendLUOpened(mtbColt); + + onComplete.run(); + + }, this::sendError); + }, this::sendError); + } private void processBarcodeNotOpenedLU(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) { @@ -460,38 +469,43 @@ public class SpedizioneViewModel { private void executeEtichettaPosizione(String posizione, Runnable onComplete) { MtbDepoPosizione foundPosizione = UtilityPosizione.getFromCache(posizione); - if (foundPosizione != null) { - if (foundPosizione.isFlagMonoCollo()) { - - this.mPosizioneRESTConsumer.getBancaliInPosizione(foundPosizione, mtbColtList -> { - - if (mtbColtList == null || mtbColtList.size() != 1) { - //Nessuna UL trovata oppure più UL nella stessa posizione - this.sendError(new NoLUFoundException()); - - } else { - mColliMagazzinoRESTConsumer.getByTestata(mtbColtList.get(0), true, false, mtbColt -> { - if (mtbColt != null && mtbColt.getMtbColr() != null && mtbColt.getMtbColr().size() > 0) { - searchArtFromUL(mtbColt, onComplete); - } else { - this.sendError(new EmptyLUException()); - } - - }, this::sendError); - } - - }, this::sendError); - - } else { - //La posizione non è Mono-UL - this.sendError(new CurrentMonoLUPositionIsNotCorrectException()); - } - - } else { + if (foundPosizione == null) { //Nessuna posizione trovata con questo barcode this.sendError(new ScannedPositionNotExistException()); - + return; } + + if (!foundPosizione.isFlagMonoCollo()) { + //La posizione non è Mono-UL + this.sendError(new CurrentMonoLUPositionIsNotCorrectException()); + return; + } + + if(foundPosizione.isMagazzinoAutomatico()) { + //Eseguo picking da magazzino automatico + return; + } + + + this.mPosizioneRESTConsumer.getBancaliInPosizione(foundPosizione, mtbColtList -> { + + if (mtbColtList == null || mtbColtList.size() != 1) { + //Nessuna UL trovata oppure più UL nella stessa posizione + this.sendError(new NoLUFoundException()); + return; + } + + mColliMagazzinoRESTConsumer.getByTestata(mtbColtList.get(0), true, false, mtbColt -> { + if (mtbColt != null && mtbColt.getMtbColr() != null && mtbColt.getMtbColr().size() > 0) { + searchArtFromUL(mtbColt, onComplete); + } else { + this.sendError(new EmptyLUException()); + } + + }, this::sendError); + + }, this::sendError); + } private void executeEtichettaLU(String SSCC, Runnable onComplete) { @@ -1156,7 +1170,7 @@ public class SpedizioneViewModel { pickingObjectDTO.getTempPickData().getSourceMtbColt() != null && pickingObjectDTO.getTempPickData().getSourceMtbColt().getMtbColr() != null && pickingObjectDTO.getTempPickData().getSourceMtbColt().getMtbColr().size() > 0 ? - pickingObjectDTO.getTempPickData().getSourceMtbColt().getMtbColr().get(0) : null; + pickingObjectDTO.getTempPickData().getSourceMtbColt().getMtbColr().get(0) : null; // if (mtbColrToDispatch != null) { @@ -1204,7 +1218,6 @@ public class SpedizioneViewModel { } - var insertUDSRowRequestDto = new InsertUDSRowRequestDTO() .setSourceMtbColr(mtbColrToDispatch) .setCodMart(pickingObjectDTO.getMtbAart().getCodMart()) @@ -1214,7 +1227,7 @@ public class SpedizioneViewModel { .setPartitaMag(partitaMag) .setTargetMtbColt(mCurrentMtbColt); - if(dataScad != null) + if (dataScad != null) insertUDSRowRequestDto .setDataScad(UtilityDate.toLocalDate(dataScad)); @@ -1261,9 +1274,6 @@ public class SpedizioneViewModel { }, this::sendError); - - - // boolean finalShouldPrint = shouldPrint; // mColliMagazzinoRESTConsumer.saveCollo(cloneMtbColt, value -> { // @@ -1351,7 +1361,7 @@ public class SpedizioneViewModel { public void requestDeleteRow(MtbColr mtbColrToDelete) { this.sendMtbColrDeleteRequest(canDelete -> { - if(!canDelete) + if (!canDelete) return; this.sendOnLoadingStarted(); diff --git a/app/src/main/java/it/integry/integrywmsnative/gest/spedizione/exceptions/InvalidMagazzinoAutomaticoMovementException.java b/app/src/main/java/it/integry/integrywmsnative/gest/spedizione/exceptions/InvalidMagazzinoAutomaticoMovementException.java new file mode 100644 index 00000000..808c3f64 --- /dev/null +++ b/app/src/main/java/it/integry/integrywmsnative/gest/spedizione/exceptions/InvalidMagazzinoAutomaticoMovementException.java @@ -0,0 +1,9 @@ +package it.integry.integrywmsnative.gest.spedizione.exceptions; + +import it.integry.integrywmsnative.core.model.MtbDepoPosizione; + +public class InvalidMagazzinoAutomaticoMovementException extends Exception { + public InvalidMagazzinoAutomaticoMovementException(MtbDepoPosizione mtbDepoPosizione) { + super(String.format("Non è possibile movimentare una posizione legata ad un magazzino automatico (%s)", mtbDepoPosizione.getPosizione())); + } +}