Completata gestione della nuova Rettifica Giacenze

This commit is contained in:
Giuseppe Scorrano 2020-05-14 10:05:44 +02:00
parent cff91c86fb
commit c6adc453f6

View File

@ -423,22 +423,47 @@ public class RettificaGiacenzeViewModel implements IRecyclerItemClicked<MtbColr>
.setCodMart(mtbAart.getCodMart())
.setPartitaMag(quantityDTO.batchLot.get())
.setDataScadPartita(quantityDTO.expireDate)
.setQtaCol(quantityDTO.qtaTot.getBigDecimal())
.setNumCnf(quantityDTO.numCnf.getBigDecimal())
.setDescrizione(mtbAart.getDescrizioneEstesa())
.setCausale(MtbColr.Causale.RETTIFICA)
.setUtente(SettingsManager.i().user.fullname);
mtbColr.setOperation(CommonModelConsts.OPERATION.INSERT_OR_UPDATE);
if (!isCreatedLU) {
mtbColr
.setQtaCol(BigDecimal.ZERO)
.setNumCnf(BigDecimal.ZERO)
.setDataCollo(mtbColt.get().getDataColloS())
.setNumCollo(mtbColt.get().getNumCollo())
.setGestione(mtbColt.get().getGestione())
.setSerCollo(mtbColt.get().getSerCollo());
ColliMagazzinoRESTConsumer.creaRettificaCollo(mtbColr,
quantityDTO.numCnf.getBigDecimal(),
quantityDTO.qtaTot.getBigDecimal(),
() -> {
mtbColr.setUntMis(mtbAart.getUntMis())
.setMtbAart(mtbAart);
mtbColt.get().getMtbColr().add(mtbColr);
FBToast.successToast(mContext, mContext.getResources().getString(R.string.data_saved), FBToast.LENGTH_SHORT);
resetTexts();
progress.dismiss();
}, ex -> {
UtilityExceptions.defaultException(mContext, ex, progress);
});
} else {
mtbColr
.setQtaCol(quantityDTO.qtaTot.getBigDecimal())
.setNumCnf(quantityDTO.numCnf.getBigDecimal());
MtbColt cloneMtbColt = (MtbColt) mtbColt.get().clone();
cloneMtbColt.setOperation(CommonModelConsts.OPERATION.NO_OP);
cloneMtbColt.setMtbColr(new ObservableArrayList());
cloneMtbColt.getMtbColr().add(mtbColr);
// ColliMagazzinoRESTConsumer.creaRettificaCollo(mtbColr);
ColliMagazzinoRESTConsumer.saveCollo(cloneMtbColt, new ISimpleOperationCallback<MtbColt>() {
@Override
public void onSuccess(MtbColt value) {
@ -465,6 +490,7 @@ public class RettificaGiacenzeViewModel implements IRecyclerItemClicked<MtbColr>
UtilityExceptions.defaultException(mContext, ex, progress);
}
});
}
}
@ -636,7 +662,7 @@ public class RettificaGiacenzeViewModel implements IRecyclerItemClicked<MtbColr>
.setRiga(null);
if(!isCreatedLU) {
if (!isCreatedLU) {
BigDecimal finalNewNumCnf = newNumCnf;
ColliMagazzinoRESTConsumer.creaRettificaCollo(
mtbColrToEditClone,
@ -711,7 +737,7 @@ public class RettificaGiacenzeViewModel implements IRecyclerItemClicked<MtbColr>
Dialog progressDialog = UtilityProgress.createDefaultProgressDialog(mContext);
if(!isCreatedLU) {
if (!isCreatedLU) {
ColliMagazzinoRESTConsumer.creaRettificaCollo(
mtbColrToDeleteClone,
BigDecimal.ZERO,