Impedito prelevamento merce posizionata su depositi diversi

This commit is contained in:
2024-01-19 17:27:38 +01:00
parent 648d908e95
commit e62e5d11f0
8 changed files with 104 additions and 26 deletions

View File

@@ -0,0 +1,10 @@
package it.integry.integrywmsnative.core.exception;
import it.integry.integrywmsnative.R;
import it.integry.integrywmsnative.core.utility.UtilityResources;
public final class InvalidCodMdepException extends Exception {
public InvalidCodMdepException() {
super(UtilityResources.getString(R.string.invalid_codmdep));
}
}

View File

@@ -13,6 +13,7 @@ import java.util.List;
import javax.inject.Inject;
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
import it.integry.integrywmsnative.core.exception.InvalidCodMdepException;
import it.integry.integrywmsnative.core.exception.NoLUFoundException;
import it.integry.integrywmsnative.core.exception.NoResultFromBarcodeException;
import it.integry.integrywmsnative.core.exception.ScannedPositionNotExistException;
@@ -211,7 +212,14 @@ public class PickingLiberoViewModel {
}
} else if (mtbColtList.size() == 1) {
this.mColliMagazzinoRESTConsumer.getByTestata(mtbColtList.get(0), true, false, mtbColt -> {
pickMerceULtoUL(mtbColt, articolo, onComplete);
boolean codMdepIsValid = Stream.of(SettingsManager.iDB().getAvailableCodMdep())
.anyMatch(x -> x.getCodMdep().equalsIgnoreCase(mtbColt.getCodMdep()));
if (codMdepIsValid) {
pickMerceULtoUL(mtbColt, articolo, onComplete);
} else this.sendError(new InvalidCodMdepException());
}, this::sendError);
} else {
this.sendError(new TooManyLUFoundInMonoLUPositionException());
@@ -235,7 +243,14 @@ public class PickingLiberoViewModel {
if (mtbColtScanned == null) {
this.sendError(new NoLUFoundException());
} else if ((mtbColtScanned.getGestioneEnum() == GestioneEnum.ACQUISTO || mtbColtScanned.getGestioneEnum() == GestioneEnum.LAVORAZIONE) && mtbColtScanned.getSegno() > 0) {
pickMerceULtoUL(mtbColtScanned, onComplete);
boolean codMdepIsValid = Stream.of(SettingsManager.iDB().getAvailableCodMdep())
.anyMatch(x -> x.getCodMdep().equalsIgnoreCase(mtbColtScanned.getCodMdep()));
if (codMdepIsValid) {
pickMerceULtoUL(mtbColtScanned, onComplete);
} else this.sendError(new InvalidCodMdepException());
} else {
this.sendError(new NoLUFoundException());
}

View File

@@ -324,7 +324,7 @@ public class ProdFabbisognoLineeProdFragment extends BaseFragment implements ITi
SpedizioneActivity.startActivity(getActivity(),
sitArtOrdDTOS,
null,
new ArrayList<>(),
new ArrayList<>(),
GestioneEnum.LAVORAZIONE,
+1,

View File

@@ -14,6 +14,7 @@ import java.util.List;
import javax.inject.Inject;
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
import it.integry.integrywmsnative.core.exception.InvalidCodMdepException;
import it.integry.integrywmsnative.core.exception.NoLUFoundException;
import it.integry.integrywmsnative.core.exception.NoResultFromBarcodeException;
import it.integry.integrywmsnative.core.exception.TooManyLUFoundInMonoLUPositionException;
@@ -109,7 +110,14 @@ public class ProdVersamentoMaterialeViewModel {
this.sendError(new NoLUFoundException());
} else if (mtbColtList.size() == 1) {
this.mColliMagazzinoRESTConsumer.getByTestata(mtbColtList.get(0), true, false, mtbColt -> {
this.onLUOpened(mtbColt);
boolean codMdepIsValid = Stream.of(SettingsManager.iDB().getAvailableCodMdep())
.anyMatch(x -> x.getCodMdep().equalsIgnoreCase(mtbColt.getCodMdep()));
if (codMdepIsValid) {
this.onLUOpened(mtbColt);
} else this.sendError(new InvalidCodMdepException());
}, this::sendError);
} else {
this.sendError(new TooManyLUFoundInMonoLUPositionException());
@@ -122,7 +130,12 @@ public class ProdVersamentoMaterialeViewModel {
private void executeEtichettaLU(String sscc) {
this.mColliMagazzinoRESTConsumer.getBySSCC(sscc, true, false, mtbColt -> {
this.onLUOpened(mtbColt);
boolean codMdepIsValid = Stream.of(SettingsManager.iDB().getAvailableCodMdep())
.anyMatch(x -> x.getCodMdep().equalsIgnoreCase(mtbColt.getCodMdep()));
if (codMdepIsValid) {
this.onLUOpened(mtbColt);
} else this.sendError(new InvalidCodMdepException());
}, this::sendError);
}

View File

@@ -20,6 +20,7 @@ import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
import it.integry.integrywmsnative.core.CommonConst;
import it.integry.integrywmsnative.core.data_recover.ColliDataRecoverService;
import it.integry.integrywmsnative.core.exception.EmptyLUException;
import it.integry.integrywmsnative.core.exception.InvalidCodMdepException;
import it.integry.integrywmsnative.core.exception.InvalidLUException;
import it.integry.integrywmsnative.core.exception.NoArtsFoundException;
import it.integry.integrywmsnative.core.exception.NoLUFoundException;
@@ -158,7 +159,7 @@ public class SpedizioneViewModel {
this.mEnableQuantityReset = enableQuantityReset;
this.mUseQtaOrd = useQtaOrd;
if (testateOrdini != null) {
if (testateOrdini != null && testateOrdini.size() > 0) {
this.mIsOrdTrasf = Stream.of(testateOrdini).map(OrdineUscitaInevasoDTO::isOrdTrasf).withoutNulls().distinctBy(x -> x).findFirst().get();
}
@@ -238,19 +239,18 @@ public class SpedizioneViewModel {
mDefaultFiltroOrdine.add(filtro);
});
}
if (mDefaultGestioneOfUL == GestioneEnum.VENDITA) {
mColliScaricoRESTConsumer = mColliSpedizioneRESTConsumer;
if (mDefaultGestioneOfUL == GestioneEnum.VENDITA) {
mColliScaricoRESTConsumer = mColliSpedizioneRESTConsumer;
} else if (mDefaultGestioneOfUL == GestioneEnum.LAVORAZIONE && mDefaultSegnoCol == -1) {
mColliScaricoRESTConsumer = mColliLavorazioneRESTConsumer;
} else if (mDefaultGestioneOfUL == GestioneEnum.LAVORAZIONE && mDefaultSegnoCol == +1) {
mColliScaricoRESTConsumer = mColliLavorazioneRESTConsumer;
} else {
this.sendError(new NotImplementedException(String.format("Gestione %s e segno %d non gestito", mDefaultGestioneOfUL.getText(), mDefaultSegnoCol)));
}
} else if (mDefaultGestioneOfUL == GestioneEnum.LAVORAZIONE && mDefaultSegnoCol == -1) {
mColliScaricoRESTConsumer = mColliLavorazioneRESTConsumer;
} else if (mDefaultGestioneOfUL == GestioneEnum.LAVORAZIONE && mDefaultSegnoCol == +1) {
mColliScaricoRESTConsumer = mColliLavorazioneRESTConsumer;
} else {
this.sendError(new NotImplementedException(String.format("Gestione %s e segno %d non gestito", mDefaultGestioneOfUL.getText(), mDefaultSegnoCol)));
}
}
@@ -492,7 +492,13 @@ public class SpedizioneViewModel {
}
} else {
this.createNewLU(null, null, () -> searchArtFromUL(mtbColt, onComplete));
boolean codMdepIsValid = Stream.of(SettingsManager.iDB().getAvailableCodMdep())
.anyMatch(x -> x.getCodMdep().equalsIgnoreCase(mtbColt.getCodMdep()));
if (codMdepIsValid) {
this.createNewLU(null, null, () -> searchArtFromUL(mtbColt, onComplete));
} else this.sendError(new InvalidCodMdepException());
}
}, this::sendError);
@@ -530,7 +536,14 @@ public class SpedizioneViewModel {
mColliMagazzinoRESTConsumer.getByTestata(mtbColtList.get(0), true, false, mtbColt -> {
if (mtbColt != null && mtbColt.getMtbColr() != null && mtbColt.getMtbColr().size() > 0) {
this.searchArtFromUL(mtbColt, onComplete);
boolean codMdepIsValid = Stream.of(SettingsManager.iDB().getAvailableCodMdep())
.anyMatch(x -> x.getCodMdep().equalsIgnoreCase(mtbColt.getCodMdep()));
if (codMdepIsValid) {
this.searchArtFromUL(mtbColt, onComplete);
} else this.sendError(new InvalidCodMdepException());
} else {
this.sendError(new EmptyLUException());
}
@@ -546,8 +559,17 @@ public class SpedizioneViewModel {
if (mtbColt != null && mtbColt.getMtbColr() != null && mtbColt.getMtbColr().size() > 0) {
if (mtbColt.getSegno() != -1) {
searchArtFromUL(mtbColt, onComplete);
} else this.sendError(new InvalidLUException());
boolean codMdepIsValid = Stream.of(SettingsManager.iDB().getAvailableCodMdep())
.anyMatch(x -> x.getCodMdep().equalsIgnoreCase(mtbColt.getCodMdep()));
if (codMdepIsValid) {
searchArtFromUL(mtbColt, onComplete);
} else this.sendError(new InvalidCodMdepException());
} else {
this.sendError(new InvalidLUException());
}
} else {
this.sendError(new EmptyLUException());
}
@@ -773,7 +795,7 @@ public class SpedizioneViewModel {
MtbColt refMtbColt = matchedItem.getRefMtbColt();
if (matchedItem.getMtbColts() != null && matchedItem.getMtbColts().size() == 1) {
refMtbColt = matchedItem.getMtbColts().get(0);
} else if(matchedItem.getTempPickData().getSourceMtbColt() != null){
} else if (matchedItem.getTempPickData().getSourceMtbColt() != null) {
refMtbColt = matchedItem.getTempPickData().getSourceMtbColt();
}
MtbColr refMtbColr = refMtbColt != null ? refMtbColt.getMtbColr().get(0) : null;
@@ -862,8 +884,6 @@ public class SpedizioneViewModel {
} else {
dispatchOrdineRowOnPostBatchLotSelection(pickingObjectDTO, refMtbColt, refMtbColr, null, canPartitaMagBeChanged);
}
}
private void dispatchOrdineRowOnPostBatchLotSelection(final PickingObjectDTO pickingObjectDTO, MtbColt refMtbColt, MtbColr refMtbColr, MtbColr scannedMtbColr, boolean canPartitaMagBeChanged) {

View File

@@ -14,6 +14,7 @@ import java.util.List;
import javax.inject.Inject;
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
import it.integry.integrywmsnative.core.exception.InvalidCodMdepException;
import it.integry.integrywmsnative.core.exception.InvalidLUGestioneException;
import it.integry.integrywmsnative.core.exception.NoArtsInLUException;
import it.integry.integrywmsnative.core.exception.NoLUFoundException;
@@ -135,7 +136,12 @@ public class VersamentoMerceViewModel {
mColliMagazzinoRESTConsumer.getByTestata(mtbColtList.get(0), true, false, mtbColt -> {
//TAKE HERE
pickMerceULtoUL(mtbColt, onComplete);
boolean codMdepIsValid = Stream.of(SettingsManager.iDB().getAvailableCodMdep())
.anyMatch(x -> x.getCodMdep().equalsIgnoreCase(mtbColt.getCodMdep()));
if (codMdepIsValid) {
pickMerceULtoUL(mtbColt, onComplete);
} else this.sendError(new InvalidCodMdepException());
}, this::sendError);
} else {
@@ -184,11 +190,23 @@ public class VersamentoMerceViewModel {
if (mtbColt == null) {
this.mColliMagazzinoRESTConsumer.createColloFromEtichettaAnonima(sscc, GestioneEnum.LAVORAZIONE, mtbColtAnonimo -> {
onComplete.run();
pickMerceULtoUL(mtbColtAnonimo, onComplete);
boolean codMdepIsValid = Stream.of(SettingsManager.iDB().getAvailableCodMdep())
.anyMatch(x -> x.getCodMdep().equalsIgnoreCase(mtbColt.getCodMdep()));
if (codMdepIsValid) {
pickMerceULtoUL(mtbColtAnonimo, onComplete);
} else this.sendError(new InvalidCodMdepException());
}, this::sendError);
} else {
pickMerceULtoUL(mtbColt, onComplete);
boolean codMdepIsValid = Stream.of(SettingsManager.iDB().getAvailableCodMdep())
.anyMatch(x -> x.getCodMdep().equalsIgnoreCase(mtbColt.getCodMdep()));
if (codMdepIsValid) {
pickMerceULtoUL(mtbColt, onComplete);
} else this.sendError(new InvalidCodMdepException());
}
}