Corretto rollback su salvataggio documenti in caso di errore e creazione doc imballo se cod forn trasp impostato
Some checks failed
IntegryManagementSystem_Multi/pipeline/head Something is wrong with the build of this commit

This commit is contained in:
2025-09-24 11:23:41 +02:00
parent 685fa64f46
commit af6bc8ebe9

View File

@@ -106,33 +106,37 @@ public class DocumentiDirettiService {
entityList.addAll(mtbLisaCostoData);
}
List<EntityBase> entityRet = entityProcessor.processEntityList(entityList, true);
UtilityEntity.throwEntitiesException(entityRet);
try {
List<EntityBase> entityRet = entityProcessor.processEntityList(entityList, true);
UtilityEntity.throwEntitiesException(entityRet);
boolean salvaImballiAttiva = setupGest.getSetupBoolean("DTB_DOCT", "FATTURA_PEDANE", "ATTIVA");
boolean salvaImballiAttiva = setupGest.getSetupBoolean("DTB_DOCT", "FATTURA_PEDANE", "ATTIVA");
if (UtilityString.equalsIgnoreCase(gestione, "A")) {
List<MtbLisaCostoData> mtbLisaCostoData = documentService.popolaTabellaCosti(dtbDoct.getCodAnag(),
dtbDoct.getCodDtip(),
dtbDoct.getDataDoc(),
dtbDoct.getSerDoc(),
dtbDoct.getNumDoc(), false, false);
if (mtbLisaCostoData != null) {
entityRet = entityProcessor.processEntityList(mtbLisaCostoData, true);
UtilityEntity.throwEntitiesException(entityRet);
if (UtilityString.equalsIgnoreCase(gestione, "A")) {
List<MtbLisaCostoData> mtbLisaCostoData = documentService.popolaTabellaCosti(dtbDoct.getCodAnag(),
dtbDoct.getCodDtip(),
dtbDoct.getDataDoc(),
dtbDoct.getSerDoc(),
dtbDoct.getNumDoc(), false, false);
if (mtbLisaCostoData != null) {
entityRet = entityProcessor.processEntityList(mtbLisaCostoData, true);
UtilityEntity.throwEntitiesException(entityRet);
}
} else if (gestione.equalsIgnoreCase("V") && !UtilityString.isNullOrEmpty(dtbDoct.getCodFornTrasp()) &&
TipoEmissione.valueOf(UtilityHashMap.getValueIfExists(datiTipoDoc, "tipo_emissione")) == TipoEmissione.DIRETTA &&
!dtbDoct.getDtbDocImb().isEmpty() && salvaImballiAttiva) {
DtbDoct dtbDoctSave =
entityRet.stream().filter(x -> x instanceof DtbDoct && ((DtbDoct) x).getCodDtip().equals(dtbDoct.getCodDtip())).map(x -> (DtbDoct) x).findFirst().orElse(null);
saveDocImballi(dtbDoctSave, isInsert);
}
} else if (gestione.equalsIgnoreCase("V") &&
TipoEmissione.valueOf(UtilityHashMap.getValueIfExists(datiTipoDoc, "tipo_emissione")) == TipoEmissione.DIRETTA &&
!dtbDoct.getDtbDocImb().isEmpty() && salvaImballiAttiva) {
DtbDoct dtbDoctSave =
entityRet.stream().filter(x -> x instanceof DtbDoct && ((DtbDoct) x).getCodDtip().equals(dtbDoct.getCodDtip())).map(x -> (DtbDoct) x).findFirst().orElse(null);
saveDocImballi(dtbDoctSave, isInsert);
multiDBTransactionManager.commitAll();
return entityRet;
} catch (Exception e) {
multiDBTransactionManager.rollbackAll();
throw e;
}
multiDBTransactionManager.commitAll();
return entityRet;
}
private DtbDoct checkUDSForTransfer(DtbDoct dtbDoct, List<EntityBase> entityList, boolean isNewDoc) throws Exception {