Prima implementazione magazzino automatico

This commit is contained in:
Giuseppe Scorrano 2023-01-25 17:44:32 +01:00
parent ab14d6736c
commit 6c41506a97
4 changed files with 122 additions and 72 deletions

15
.idea/git_toolbox_prj.xml generated Normal file
View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GitToolBoxProjectSettings">
<option name="commitMessageIssueKeyValidationOverride">
<BoolValueOverride>
<option name="enabled" value="true" />
</BoolValueOverride>
</option>
<option name="commitMessageValidationEnabledOverride">
<BoolValueOverride>
<option name="enabled" value="true" />
</BoolValueOverride>
</option>
</component>
</project>

View File

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

View File

@ -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();

View File

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