Impedito prelevamento merce posizionata su depositi diversi

This commit is contained in:
Marco Elefante 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 javax.inject.Inject;
import it.integry.barcode_base_android_library.model.BarcodeScanDTO; 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.NoLUFoundException;
import it.integry.integrywmsnative.core.exception.NoResultFromBarcodeException; import it.integry.integrywmsnative.core.exception.NoResultFromBarcodeException;
import it.integry.integrywmsnative.core.exception.ScannedPositionNotExistException; import it.integry.integrywmsnative.core.exception.ScannedPositionNotExistException;
@ -211,7 +212,14 @@ public class PickingLiberoViewModel {
} }
} else if (mtbColtList.size() == 1) { } else if (mtbColtList.size() == 1) {
this.mColliMagazzinoRESTConsumer.getByTestata(mtbColtList.get(0), true, false, mtbColt -> { 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); }, this::sendError);
} else { } else {
this.sendError(new TooManyLUFoundInMonoLUPositionException()); this.sendError(new TooManyLUFoundInMonoLUPositionException());
@ -235,7 +243,14 @@ public class PickingLiberoViewModel {
if (mtbColtScanned == null) { if (mtbColtScanned == null) {
this.sendError(new NoLUFoundException()); this.sendError(new NoLUFoundException());
} else if ((mtbColtScanned.getGestioneEnum() == GestioneEnum.ACQUISTO || mtbColtScanned.getGestioneEnum() == GestioneEnum.LAVORAZIONE) && mtbColtScanned.getSegno() > 0) { } 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 { } else {
this.sendError(new NoLUFoundException()); this.sendError(new NoLUFoundException());
} }

View File

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

View File

@ -14,6 +14,7 @@ import java.util.List;
import javax.inject.Inject; import javax.inject.Inject;
import it.integry.barcode_base_android_library.model.BarcodeScanDTO; 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.NoLUFoundException;
import it.integry.integrywmsnative.core.exception.NoResultFromBarcodeException; import it.integry.integrywmsnative.core.exception.NoResultFromBarcodeException;
import it.integry.integrywmsnative.core.exception.TooManyLUFoundInMonoLUPositionException; import it.integry.integrywmsnative.core.exception.TooManyLUFoundInMonoLUPositionException;
@ -109,7 +110,14 @@ public class ProdVersamentoMaterialeViewModel {
this.sendError(new NoLUFoundException()); this.sendError(new NoLUFoundException());
} else if (mtbColtList.size() == 1) { } else if (mtbColtList.size() == 1) {
this.mColliMagazzinoRESTConsumer.getByTestata(mtbColtList.get(0), true, false, mtbColt -> { 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); }, this::sendError);
} else { } else {
this.sendError(new TooManyLUFoundInMonoLUPositionException()); this.sendError(new TooManyLUFoundInMonoLUPositionException());
@ -122,7 +130,12 @@ public class ProdVersamentoMaterialeViewModel {
private void executeEtichettaLU(String sscc) { private void executeEtichettaLU(String sscc) {
this.mColliMagazzinoRESTConsumer.getBySSCC(sscc, true, false, mtbColt -> { 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); }, 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.CommonConst;
import it.integry.integrywmsnative.core.data_recover.ColliDataRecoverService; import it.integry.integrywmsnative.core.data_recover.ColliDataRecoverService;
import it.integry.integrywmsnative.core.exception.EmptyLUException; 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.InvalidLUException;
import it.integry.integrywmsnative.core.exception.NoArtsFoundException; import it.integry.integrywmsnative.core.exception.NoArtsFoundException;
import it.integry.integrywmsnative.core.exception.NoLUFoundException; import it.integry.integrywmsnative.core.exception.NoLUFoundException;
@ -158,7 +159,7 @@ public class SpedizioneViewModel {
this.mEnableQuantityReset = enableQuantityReset; this.mEnableQuantityReset = enableQuantityReset;
this.mUseQtaOrd = useQtaOrd; 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(); this.mIsOrdTrasf = Stream.of(testateOrdini).map(OrdineUscitaInevasoDTO::isOrdTrasf).withoutNulls().distinctBy(x -> x).findFirst().get();
} }
@ -238,19 +239,18 @@ public class SpedizioneViewModel {
mDefaultFiltroOrdine.add(filtro); mDefaultFiltroOrdine.add(filtro);
}); });
}
if (mDefaultGestioneOfUL == GestioneEnum.VENDITA) { if (mDefaultGestioneOfUL == GestioneEnum.VENDITA) {
mColliScaricoRESTConsumer = mColliSpedizioneRESTConsumer; mColliScaricoRESTConsumer = mColliSpedizioneRESTConsumer;
} else if (mDefaultGestioneOfUL == GestioneEnum.LAVORAZIONE && mDefaultSegnoCol == -1) { } else if (mDefaultGestioneOfUL == GestioneEnum.LAVORAZIONE && mDefaultSegnoCol == -1) {
mColliScaricoRESTConsumer = mColliLavorazioneRESTConsumer; 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 {
this.sendError(new NotImplementedException(String.format("Gestione %s e segno %d non gestito", mDefaultGestioneOfUL.getText(), mDefaultSegnoCol)));
} }
} }
@ -492,7 +492,13 @@ public class SpedizioneViewModel {
} }
} else { } 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); }, this::sendError);
@ -530,7 +536,14 @@ public class SpedizioneViewModel {
mColliMagazzinoRESTConsumer.getByTestata(mtbColtList.get(0), true, false, mtbColt -> { mColliMagazzinoRESTConsumer.getByTestata(mtbColtList.get(0), true, false, mtbColt -> {
if (mtbColt != null && mtbColt.getMtbColr() != null && mtbColt.getMtbColr().size() > 0) { 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 { } else {
this.sendError(new EmptyLUException()); this.sendError(new EmptyLUException());
} }
@ -546,8 +559,17 @@ public class SpedizioneViewModel {
if (mtbColt != null && mtbColt.getMtbColr() != null && mtbColt.getMtbColr().size() > 0) { if (mtbColt != null && mtbColt.getMtbColr() != null && mtbColt.getMtbColr().size() > 0) {
if (mtbColt.getSegno() != -1) { 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 { } else {
this.sendError(new EmptyLUException()); this.sendError(new EmptyLUException());
} }
@ -773,7 +795,7 @@ public class SpedizioneViewModel {
MtbColt refMtbColt = matchedItem.getRefMtbColt(); MtbColt refMtbColt = matchedItem.getRefMtbColt();
if (matchedItem.getMtbColts() != null && matchedItem.getMtbColts().size() == 1) { if (matchedItem.getMtbColts() != null && matchedItem.getMtbColts().size() == 1) {
refMtbColt = matchedItem.getMtbColts().get(0); refMtbColt = matchedItem.getMtbColts().get(0);
} else if(matchedItem.getTempPickData().getSourceMtbColt() != null){ } else if (matchedItem.getTempPickData().getSourceMtbColt() != null) {
refMtbColt = matchedItem.getTempPickData().getSourceMtbColt(); refMtbColt = matchedItem.getTempPickData().getSourceMtbColt();
} }
MtbColr refMtbColr = refMtbColt != null ? refMtbColt.getMtbColr().get(0) : null; MtbColr refMtbColr = refMtbColt != null ? refMtbColt.getMtbColr().get(0) : null;
@ -862,8 +884,6 @@ public class SpedizioneViewModel {
} else { } else {
dispatchOrdineRowOnPostBatchLotSelection(pickingObjectDTO, refMtbColt, refMtbColr, null, canPartitaMagBeChanged); dispatchOrdineRowOnPostBatchLotSelection(pickingObjectDTO, refMtbColt, refMtbColr, null, canPartitaMagBeChanged);
} }
} }
private void dispatchOrdineRowOnPostBatchLotSelection(final PickingObjectDTO pickingObjectDTO, MtbColt refMtbColt, MtbColr refMtbColr, MtbColr scannedMtbColr, boolean 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 javax.inject.Inject;
import it.integry.barcode_base_android_library.model.BarcodeScanDTO; 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.InvalidLUGestioneException;
import it.integry.integrywmsnative.core.exception.NoArtsInLUException; import it.integry.integrywmsnative.core.exception.NoArtsInLUException;
import it.integry.integrywmsnative.core.exception.NoLUFoundException; import it.integry.integrywmsnative.core.exception.NoLUFoundException;
@ -135,7 +136,12 @@ public class VersamentoMerceViewModel {
mColliMagazzinoRESTConsumer.getByTestata(mtbColtList.get(0), true, false, mtbColt -> { mColliMagazzinoRESTConsumer.getByTestata(mtbColtList.get(0), true, false, mtbColt -> {
//TAKE HERE //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); }, this::sendError);
} else { } else {
@ -184,11 +190,23 @@ public class VersamentoMerceViewModel {
if (mtbColt == null) { if (mtbColt == null) {
this.mColliMagazzinoRESTConsumer.createColloFromEtichettaAnonima(sscc, GestioneEnum.LAVORAZIONE, mtbColtAnonimo -> { this.mColliMagazzinoRESTConsumer.createColloFromEtichettaAnonima(sscc, GestioneEnum.LAVORAZIONE, mtbColtAnonimo -> {
onComplete.run(); 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); }, this::sendError);
} else { } 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());
} }
} }

View File

@ -143,6 +143,7 @@
<string name="server_cod_azienda_not_valid"><![CDATA[Il codice azienda <b>%s</b> non è valido. Controllalo e riprova]]></string> <string name="server_cod_azienda_not_valid"><![CDATA[Il codice azienda <b>%s</b> non è valido. Controllalo e riprova]]></string>
<string name="server_not_reachable"><![CDATA[L\'host <b>%s</b> sulla porta <b>%d</b> non è al momento raggiungibile. Riprova più tardi]]></string> <string name="server_not_reachable"><![CDATA[L\'host <b>%s</b> sulla porta <b>%d</b> non è al momento raggiungibile. Riprova più tardi]]></string>
<string name="no_codmdep_available">Nessun deposito trovato per l\'utente corrente</string> <string name="no_codmdep_available">Nessun deposito trovato per l\'utente corrente</string>
<string name="invalid_codmdep">Impossibile utilizzare unità logistiche di altri depositi</string>
<string name="action_choose_profile_db">Seleziona un database</string> <string name="action_choose_profile_db">Seleziona un database</string>
<string name="empty_rows_in_mtbcolt">Nessuna riga presente nell\'Unità Logistica</string> <string name="empty_rows_in_mtbcolt">Nessuna riga presente nell\'Unità Logistica</string>

View File

@ -141,6 +141,7 @@
<string name="server_cod_azienda_not_valid"><![CDATA[Code <b>%s</b> is not valid. Check and retry later]]></string> <string name="server_cod_azienda_not_valid"><![CDATA[Code <b>%s</b> is not valid. Check and retry later]]></string>
<string name="server_not_reachable"><![CDATA[The host <b>%s</b> on port <b>%d</b> is not reachable. Retry later]]></string> <string name="server_not_reachable"><![CDATA[The host <b>%s</b> on port <b>%d</b> is not reachable. Retry later]]></string>
<string name="no_codmdep_available">No deposit available with current user</string> <string name="no_codmdep_available">No deposit available with current user</string>
<string name="invalid_codmdep">Unable to use logistics units from other depots</string>
<string name="action_choose_profile_db">Choose a database</string> <string name="action_choose_profile_db">Choose a database</string>
<string name="empty_rows_in_mtbcolt">No rows found in LU</string> <string name="empty_rows_in_mtbcolt">No rows found in LU</string>