in posizionamento merce in caso di necessità definizione livello posizione non si chiude la progress dialog

This commit is contained in:
Valerio Castellana 2022-03-25 11:21:25 +01:00
parent 7206b3c37e
commit 7a3a207462

View File

@ -91,14 +91,22 @@ public class VersamentoMerceViewModel {
if (!UtilityString.equalsIgnoreCase(mCurrentMtbColt.getValue().getCodMdep(), foundPosizione.getCodMdep())) { if (!UtilityString.equalsIgnoreCase(mCurrentMtbColt.getValue().getCodMdep(), foundPosizione.getCodMdep())) {
this.sendOnSpostamentoTraDepConfirmRequired(mCurrentMtbColt.getValue().getCodMdep(), foundPosizione.getCodMdep(), canContinue -> { this.sendOnSpostamentoTraDepConfirmRequired(mCurrentMtbColt.getValue().getCodMdep(), foundPosizione.getCodMdep(), canContinue -> {
if (canContinue) {
updatePosizione(foundPosizione, UtilityPosizione.isPosizioneWithLivello(foundPosizione));
} else {
onComplete.run(); onComplete.run();
if (canContinue) {
if (UtilityPosizione.isPosizioneWithLivello(foundPosizione)) {
askLivelloPosizione(foundPosizione);
} else {
updatePosizione(foundPosizione);
}
} }
}); });
} else { } else {
updatePosizione(foundPosizione, UtilityPosizione.isPosizioneWithLivello(foundPosizione)); onComplete.run();
if (UtilityPosizione.isPosizioneWithLivello(foundPosizione)) {
askLivelloPosizione(foundPosizione);
} else {
updatePosizione(foundPosizione);
}
} }
} }
@ -239,19 +247,18 @@ public class VersamentoMerceViewModel {
} }
public void updatePosizione(MtbDepoPosizione mtbDepoPosizione, boolean shouldAskLivello) { public void askLivelloPosizione(MtbDepoPosizione mtbDepoPosizione) {
if (shouldAskLivello) {
this.sendOnLivelloPosizioneRequired(mtbDepoPosizione, newPosizione -> { this.sendOnLivelloPosizioneRequired(mtbDepoPosizione, newPosizione -> {
if (newPosizione == null) { if (newPosizione == null) {
updatePosizione(mtbDepoPosizione, shouldAskLivello); askLivelloPosizione(mtbDepoPosizione);
} else { } else {
updatePosizione(newPosizione, false); updatePosizione(newPosizione);
} }
}); });
} else { }
public void updatePosizione(MtbDepoPosizione mtbDepoPosizione) {
this.sendOnLoadingStarted(); this.sendOnLoadingStarted();
mColliMagazzinoRESTConsumer.changePosizione(mCurrentMtbColt.getValue(), mtbDepoPosizione, () -> { mColliMagazzinoRESTConsumer.changePosizione(mCurrentMtbColt.getValue(), mtbDepoPosizione, () -> {
this.sendOnLoadingEnded(); this.sendOnLoadingEnded();
@ -259,8 +266,6 @@ public class VersamentoMerceViewModel {
}, this::sendError); }, this::sendError);
} }
}
public MutableLiveData<MtbColt> getCurrentMtbColt() { public MutableLiveData<MtbColt> getCurrentMtbColt() {
return mCurrentMtbColt; return mCurrentMtbColt;