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