Sistemato salvataggio causale in Rettifica Giacenze nel caso in cui si preme il tasto Back nella videata del collo

This commit is contained in:
Giuseppe Scorrano 2020-12-28 12:17:43 +01:00
parent ade37f07d6
commit d9844315a3

View File

@ -61,6 +61,8 @@ public class RettificaGiacenzeViewModel {
private String mCurrentCodMdep; private String mCurrentCodMdep;
private boolean mIsCreatedLU; private boolean mIsCreatedLU;
private boolean mAnyEditDone = false;
@Inject @Inject
public RettificaGiacenzeViewModel(ArticoloRESTConsumer articoloRESTConsumer, public RettificaGiacenzeViewModel(ArticoloRESTConsumer articoloRESTConsumer,
ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer, ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer,
@ -350,6 +352,8 @@ public class RettificaGiacenzeViewModel {
mCurrentMtbColt.getMtbColr().add(mtbColr); mCurrentMtbColt.getMtbColr().add(mtbColr);
this.mAnyEditDone = true;
this.sendOnRowSaved(); this.sendOnRowSaved();
this.sendOnLoadingEnded(); this.sendOnLoadingEnded();
@ -380,6 +384,8 @@ public class RettificaGiacenzeViewModel {
mCurrentMtbColt.getMtbColr().add(mtbColr); mCurrentMtbColt.getMtbColr().add(mtbColr);
this.mAnyEditDone = true;
this.sendOnRowSaved(); this.sendOnRowSaved();
this.sendOnLoadingEnded(); this.sendOnLoadingEnded();
@ -417,9 +423,11 @@ public class RettificaGiacenzeViewModel {
if(shouldChangePosition) { if(shouldChangePosition) {
this.savePosizione(mtbDepoPosizione, () -> { this.savePosizione(mtbDepoPosizione, () -> {
this.mAnyEditDone = false;
postSaveBehaviour(onComplete); postSaveBehaviour(onComplete);
}); });
} else { } else {
this.mAnyEditDone = false;
postSaveBehaviour(onComplete); postSaveBehaviour(onComplete);
} }
@ -427,7 +435,7 @@ public class RettificaGiacenzeViewModel {
}, this::sendError); }, this::sendError);
}; };
if (!UtilityString.isNullOrEmpty(mDefaultCausale)) { if (!UtilityString.isNullOrEmpty(mDefaultCausale) && (saveCausale || mAnyEditDone)) {
this.saveCausaleRettificaGiacenze(saveAction); this.saveCausaleRettificaGiacenze(saveAction);
} else { } else {
saveAction.run(); saveAction.run();
@ -564,6 +572,8 @@ public class RettificaGiacenzeViewModel {
this.mCurrentMtbColt.getMtbColr().remove(mtbColrToUpdate); this.mCurrentMtbColt.getMtbColr().remove(mtbColrToUpdate);
this.mCurrentMtbColt.getMtbColr().add(mtbColrToUpdate); this.mCurrentMtbColt.getMtbColr().add(mtbColrToUpdate);
this.mAnyEditDone = true;
this.sendOnRowSaved(); this.sendOnRowSaved();
}, },
this::sendError this::sendError
@ -602,6 +612,8 @@ public class RettificaGiacenzeViewModel {
this.mCurrentMtbColt.getMtbColr().remove(mtbColrToUpdate); this.mCurrentMtbColt.getMtbColr().remove(mtbColrToUpdate);
this.mCurrentMtbColt.getMtbColr().add(mtbColr); this.mCurrentMtbColt.getMtbColr().add(mtbColr);
this.mAnyEditDone = true;
this.sendOnRowSaved(); this.sendOnRowSaved();
this.sendOnLoadingEnded(); this.sendOnLoadingEnded();