Merge remote-tracking branch 'origin/develop' into develop

This commit is contained in:
Giuseppe Scorrano 2024-01-23 11:14:46 +01:00
commit 48d1a34c52
11 changed files with 136 additions and 32 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

@ -213,10 +213,16 @@ public class MainFragment extends Fragment implements ITitledFragment, IScrollab
(recoveredMtbColt.getGestioneEnum() == GestioneEnum.VENDITA || (recoveredMtbColt.getGestioneEnum() == GestioneEnum.VENDITA ||
recoveredMtbColt.getGestioneEnum() == GestioneEnum.LAVORAZIONE)) { recoveredMtbColt.getGestioneEnum() == GestioneEnum.LAVORAZIONE)) {
String codMdep = SettingsManager.i().getUserSession().getDepo().getCodMdep();
if(recoveredMtbColtDto.getTestateOrdini() != null &&
!recoveredMtbColtDto.getTestateOrdini().isEmpty()){
codMdep = recoveredMtbColtDto.getTestateOrdini().get(0).getCodMdep();
}
var closeUDSRequestDto = new CloseUDSRequestDTO() var closeUDSRequestDto = new CloseUDSRequestDTO()
.setMtbColt(recoveredMtbColt) .setMtbColt(recoveredMtbColt)
//.setPrintSSCC(shouldPrint) //.setPrintSSCC(shouldPrint)
.setOrderCodMdep(recoveredMtbColtDto.getTestateOrdini().get(0).getCodMdep()); .setOrderCodMdep(codMdep);
RunnableArgs<CloseUDSResponseDTO> onRequestComplete = closeUDSResponseDto -> { RunnableArgs<CloseUDSResponseDTO> onRequestComplete = closeUDSResponseDto -> {
colliDataRecoverService.closeSession(recoveredMtbColtID); colliDataRecoverService.closeSession(recoveredMtbColtID);

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 -> {
boolean codMdepIsValid = Stream.of(SettingsManager.iDB().getAvailableCodMdep())
.anyMatch(x -> x.getCodMdep().equalsIgnoreCase(mtbColt.getCodMdep()));
if (codMdepIsValid) {
pickMerceULtoUL(mtbColt, articolo, onComplete); 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) {
boolean codMdepIsValid = Stream.of(SettingsManager.iDB().getAvailableCodMdep())
.anyMatch(x -> x.getCodMdep().equalsIgnoreCase(mtbColtScanned.getCodMdep()));
if (codMdepIsValid) {
pickMerceULtoUL(mtbColtScanned, onComplete); pickMerceULtoUL(mtbColtScanned, onComplete);
} else this.sendError(new InvalidCodMdepException());
} else { } else {
this.sendError(new NoLUFoundException()); this.sendError(new NoLUFoundException());
} }

View File

@ -20,6 +20,7 @@ import com.ravikoradiya.liveadapter.Type;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
@ -292,7 +293,19 @@ public class ProdFabbisognoLineeProdFragment extends BaseFragment implements ITi
.map(x -> ((ProdFabbisognoLineeItemModelDto) x).getOrdineLavorazioneDTO().getNumOrd().toString()) .map(x -> ((ProdFabbisognoLineeItemModelDto) x).getOrdineLavorazioneDTO().getNumOrd().toString())
.toList()); .toList());
this.mViewModel.loadFabbisogno(ordini, codMdep, this::startPickingActivity); Date dataInizio = Stream.of(mProdFabbisognoItemModel)
.filter(x -> x instanceof ProdFabbisognoLineeItemModelDto && ((ProdFabbisognoLineeItemModelDto) x).selected.get())
.map(x -> ((ProdFabbisognoLineeItemModelDto) x).getOrdineLavorazioneDTO().getDataOrdD())
.min(Date::compareTo)
.orElse(null);
Date dataFine = Stream.of(mProdFabbisognoItemModel)
.filter(x -> x instanceof ProdFabbisognoLineeItemModelDto && ((ProdFabbisognoLineeItemModelDto) x).selected.get())
.map(x -> ((ProdFabbisognoLineeItemModelDto) x).getOrdineLavorazioneDTO().getDataOrdD())
.max(Date::compareTo)
.orElse(null);
this.mViewModel.loadFabbisogno(ordini, codMdep, dataInizio, dataFine, this::startPickingActivity);
} }
@ -324,7 +337,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

@ -66,11 +66,16 @@ public class ProdFabbisognoLineeProdViewModel {
return ordiniList; return ordiniList;
} }
public void loadFabbisogno(String ordini, String codMdep, RunnableArgs<List<ProdFabbisognoLineeProdDTO>> onComplete) { public void loadFabbisogno(String ordini, String codMdep, Date dataInizio, Date dataFine, RunnableArgs<List<ProdFabbisognoLineeProdDTO>> onComplete) {
this.sendOnLoadingStarted(); this.sendOnLoadingStarted();
this.mProdFabbisognoLineeProdRESTConsumer.loadFabbisogno(ordini, codMdep, jtbFasi -> { this.mProdFabbisognoLineeProdRESTConsumer.loadFabbisogno(ordini, codMdep, jtbFasi -> {
if (jtbFasi != null) { if (jtbFasi != null) {
Stream.of(jtbFasi)
.forEach(x -> {
x.setDataInizio(dataInizio);
x.setDataFine(dataFine);
});
this.sendOnLoadingEnded(); this.sendOnLoadingEnded();
onComplete.run(jtbFasi); onComplete.run(jtbFasi);
} else { } else {

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 -> {
boolean codMdepIsValid = Stream.of(SettingsManager.iDB().getAvailableCodMdep())
.anyMatch(x -> x.getCodMdep().equalsIgnoreCase(mtbColt.getCodMdep()));
if (codMdepIsValid) {
this.onLUOpened(mtbColt); 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 -> {
boolean codMdepIsValid = Stream.of(SettingsManager.iDB().getAvailableCodMdep())
.anyMatch(x -> x.getCodMdep().equalsIgnoreCase(mtbColt.getCodMdep()));
if (codMdepIsValid) {
this.onLUOpened(mtbColt); this.onLUOpened(mtbColt);
} else this.sendError(new InvalidCodMdepException());
}, this::sendError); }, this::sendError);
} }

View File

@ -168,7 +168,7 @@ public class RettificaGiacenzeViewModel {
if (onComplete != null) onComplete.run(); if (onComplete != null) onComplete.run();
if (mtbAartList != null && mtbAartList.size() > 0) { if (mtbAartList != null && mtbAartList.size() > 0) {
this.dispatchArt(mtbAartList.get(0), pickData); this.dispatchArts(mtbAartList);
} else { } else {
this.sendError(new NoResultFromBarcodeException(barcodeProd)); this.sendError(new NoResultFromBarcodeException(barcodeProd));
} }

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,6 +239,7 @@ public class SpedizioneViewModel {
mDefaultFiltroOrdine.add(filtro); mDefaultFiltroOrdine.add(filtro);
}); });
}
if (mDefaultGestioneOfUL == GestioneEnum.VENDITA) { if (mDefaultGestioneOfUL == GestioneEnum.VENDITA) {
mColliScaricoRESTConsumer = mColliSpedizioneRESTConsumer; mColliScaricoRESTConsumer = mColliSpedizioneRESTConsumer;
@ -250,8 +252,6 @@ public class SpedizioneViewModel {
} else { } else {
this.sendError(new NotImplementedException(String.format("Gestione %s e segno %d non gestito", mDefaultGestioneOfUL.getText(), mDefaultSegnoCol))); this.sendError(new NotImplementedException(String.format("Gestione %s e segno %d non gestito", mDefaultGestioneOfUL.getText(), mDefaultSegnoCol)));
} }
}
} }
private void onOrderClosedPrintingDone() { private void onOrderClosedPrintingDone() {
@ -492,7 +492,13 @@ public class SpedizioneViewModel {
} }
} else { } else {
boolean codMdepIsValid = Stream.of(SettingsManager.iDB().getAvailableCodMdep())
.anyMatch(x -> x.getCodMdep().equalsIgnoreCase(mtbColt.getCodMdep()));
if (codMdepIsValid) {
this.createNewLU(null, null, () -> searchArtFromUL(mtbColt, onComplete)); 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) {
boolean codMdepIsValid = Stream.of(SettingsManager.iDB().getAvailableCodMdep())
.anyMatch(x -> x.getCodMdep().equalsIgnoreCase(mtbColt.getCodMdep()));
if (codMdepIsValid) {
this.searchArtFromUL(mtbColt, onComplete); 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) {
boolean codMdepIsValid = Stream.of(SettingsManager.iDB().getAvailableCodMdep())
.anyMatch(x -> x.getCodMdep().equalsIgnoreCase(mtbColt.getCodMdep()));
if (codMdepIsValid) {
searchArtFromUL(mtbColt, onComplete); searchArtFromUL(mtbColt, onComplete);
} else this.sendError(new InvalidLUException()); } else this.sendError(new InvalidCodMdepException());
} else {
this.sendError(new InvalidLUException());
}
} else { } else {
this.sendError(new EmptyLUException()); this.sendError(new EmptyLUException());
} }
@ -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) {
@ -1489,11 +1509,13 @@ public class SpedizioneViewModel {
var clonedLuToClose = (MtbColt) this.mCurrentMtbColt.clone(); var clonedLuToClose = (MtbColt) this.mCurrentMtbColt.clone();
clonedLuToClose.setMtbColr(null); clonedLuToClose.setMtbColr(null);
String codMdep = SettingsManager.i().getUserSession().getDepo().getCodMdep();
if(mTestateOrdini != null && !mTestateOrdini.isEmpty()) codMdep = mTestateOrdini.get(0).getCodMdep();
var closeUDSRequestDto = new CloseUDSRequestDTO() var closeUDSRequestDto = new CloseUDSRequestDTO()
.setMtbColt(clonedLuToClose) .setMtbColt(clonedLuToClose)
//.setPrintSSCC(shouldPrint) //.setPrintSSCC(shouldPrint)
.setOrderCodMdep(mTestateOrdini.get(0).getCodMdep()); .setOrderCodMdep(codMdep);
this.mColliSpedizioneRESTConsumer.closeUDS(closeUDSRequestDto, closeResponse -> { this.mColliSpedizioneRESTConsumer.closeUDS(closeUDSRequestDto, closeResponse -> {
onComplete.run(closeResponse.getGeneratedMtbColts()); onComplete.run(closeResponse.getGeneratedMtbColts());

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
boolean codMdepIsValid = Stream.of(SettingsManager.iDB().getAvailableCodMdep())
.anyMatch(x -> x.getCodMdep().equalsIgnoreCase(mtbColt.getCodMdep()));
if (codMdepIsValid) {
pickMerceULtoUL(mtbColt, onComplete); 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();
boolean codMdepIsValid = Stream.of(SettingsManager.iDB().getAvailableCodMdep())
.anyMatch(x -> x.getCodMdep().equalsIgnoreCase(mtbColt.getCodMdep()));
if (codMdepIsValid) {
pickMerceULtoUL(mtbColtAnonimo, onComplete); pickMerceULtoUL(mtbColtAnonimo, onComplete);
} else this.sendError(new InvalidCodMdepException());
}, this::sendError); }, this::sendError);
} else { } else {
boolean codMdepIsValid = Stream.of(SettingsManager.iDB().getAvailableCodMdep())
.anyMatch(x -> x.getCodMdep().equalsIgnoreCase(mtbColt.getCodMdep()));
if (codMdepIsValid) {
pickMerceULtoUL(mtbColt, onComplete); 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>