Refactor Giacenza handling and add new endpoint for populating Giacenza table
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20250917135026 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
enableSaveToRest("vauto");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -151,12 +151,6 @@ public class ContrattiDiAcquistoHandlerService {
|
||||
List<EntityBase> ret = entityProcessor.processEntityList(atbOfftsToSave, mdb, false, RequestDataDTO.systemMockupData());
|
||||
UtilityEntity.throwEntitiesException(ret);
|
||||
|
||||
/*
|
||||
mailService.sendSystemErrorLog("[" + multiDBTransactionManager.getPrimaryDatasource().getDbName() + " - " + azienda.getNomeDitta() + "][" + UtilityServer.getHostName() + "] Verifica autofatture ",
|
||||
"Verifica autofatture",
|
||||
"Sull'azienda " + azienda.getNomeDitta() + " non è presente nessuna email con flag default contabilità, non sarà possibile inviare la mail di verifica.",
|
||||
(String) null, new Date());
|
||||
*/
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -61,4 +61,17 @@ public class GiacenzaController {
|
||||
giacenzaService.archiviazioneGiornaliera();
|
||||
return ServiceRestResponse.createPositiveResponse();
|
||||
}
|
||||
|
||||
@RequestMapping(value = "fill", method = RequestMethod.POST)
|
||||
public @ResponseBody
|
||||
ServiceRestResponse popolamentoTabellaGiacenza(@RequestParam(CommonConstants.PROFILE_DB) String profileDB,
|
||||
@RequestParam(required = false) String codMdep) throws Exception {
|
||||
|
||||
try {
|
||||
giacenzaService.popolaGiacenzaDaInventario(codMdep);
|
||||
return ServiceRestResponse.createPositiveResponse();
|
||||
} catch (Exception e) {
|
||||
return ServiceRestResponse.createNegativeResponse(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -768,20 +768,6 @@ public class PvmController {
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value = "popolaGiancezaDaInventario", method = RequestMethod.POST)
|
||||
public @ResponseBody
|
||||
ServiceRestResponse popolaGiacenzaDaInventario(@RequestParam(CommonConstants.PROFILE_DB) String profileDB,
|
||||
@RequestParam(required = false) String codMdep) throws Exception {
|
||||
|
||||
try {
|
||||
giacenzaService.popolaGiacenzaDaInventario(codMdep);
|
||||
return ServiceRestResponse.createPositiveResponse();
|
||||
} catch (Exception e) {
|
||||
return ServiceRestResponse.createNegativeResponse(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "pvm/gestione/{section}/permessi", method = RequestMethod.POST)
|
||||
public @ResponseBody
|
||||
ServiceRestResponse retrieveUserAuthorizations(@RequestParam(CommonConstants.PROFILE_DB) String profileDB,
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import it.integry.ems.exception.PrimaryDatabaseNotPresentException;
|
||||
import it.integry.ems.expansion.RunnableThrowable;
|
||||
import it.integry.ems.javabeans.RequestDataDTO;
|
||||
import it.integry.ems.json.ResponseJSONObjectMapper;
|
||||
import it.integry.ems.retail.dto.GiacenzaDTO;
|
||||
import it.integry.ems.retail.pvmRetail.service.PvmService;
|
||||
import it.integry.ems.service.EntityProcessor;
|
||||
@@ -771,7 +772,7 @@ public class GiacenzaService {
|
||||
"\n" +
|
||||
" , doc AS (SELECT wdtb_doct.cod_mdep,\n" +
|
||||
" wdtb_docr.cod_mart,\n" +
|
||||
" wdtb_docr.qta_doc\n" +
|
||||
" sum(wdtb_docr.qta_doc) as qta_doc \n" +
|
||||
" FROM wdtb_doct\n" +
|
||||
" INNER JOIN wdtb_docr ON wdtb_doct.cod_dtip = wdtb_docr.cod_dtip\n" +
|
||||
" AND wdtb_docr.cod_anag = wdtb_doct.cod_anag\n" +
|
||||
@@ -781,7 +782,9 @@ public class GiacenzaService {
|
||||
" AND wdtb_docr.cod_mart IS NOT NULL\n" +
|
||||
(listini != null && !listini.isEmpty() ? " AND wdtb_doct.listino IN (" + UtilityDB.listValueToString(listini) + ")\n" : "") +
|
||||
" WHERE wdtb_doct.cod_mdep = " + UtilityDB.valueToString(codMdep) + "\n" +
|
||||
" AND wdtb_doct.flag_elaborato = 'I')\n" +
|
||||
" AND wdtb_doct.flag_elaborato = 'I'" +
|
||||
" GROUP BY wdtb_doct.cod_mdep,\n" +
|
||||
" wdtb_docr.cod_mart )\n" +
|
||||
"\n" +
|
||||
"SELECT ISNULL(doc.cod_mdep, ordine.cod_mdep) AS cod_mdep,\n" +
|
||||
" ISNULL(doc.cod_mart, ordine.cod_mart) AS cod_mart,\n" +
|
||||
@@ -807,16 +810,21 @@ public class GiacenzaService {
|
||||
}
|
||||
}
|
||||
|
||||
// if ( codMdep.equalsIgnoreCase("LA") &&
|
||||
// listGiacenza.stream().anyMatch(x->x.getQtaInv().compareTo(BigDecimal.ZERO) < 0)) {
|
||||
// String pathFile = UtilityDirs.getEmsApiTempDirectoryPath() + File.separator + "Giacenza_" + codMdep + File.separator;
|
||||
// String fileName = codMdep + "_" + new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date()) + ".json";
|
||||
// StringWriter writer = new StringWriter();
|
||||
// List<CarelliGiacenzaProg> carelliGiacenzaProgs = UtilityDB.executeSimpleQueryDTO(multiDBTransactionManager.getPrimaryConnection(), "SELECT * FROM carelli_giacenza_prog WHERE cod_mdep = " + UtilityDB.valueToString(codMdep), CarelliGiacenzaProg.class);
|
||||
// new ObjectMapper().writeValue(writer, carelliGiacenzaProgs);
|
||||
// String contentBody = writer.toString();
|
||||
// UtilityFile.saveFile(pathFile, fileName, contentBody);
|
||||
// }
|
||||
boolean saveBackup = setupGest.getSetupDepoBoolean("DATI_AZIENDA", "GIACENZA_DA_INV", "ATTIVA_LOG", codMdep);
|
||||
|
||||
if ( saveBackup &&
|
||||
listGiacenza.stream().anyMatch(x->x.getQtaInv().compareTo(BigDecimal.ZERO) < 0)) {
|
||||
List<String> elencoArticoli =
|
||||
listGiacenza.stream()
|
||||
.filter(x -> x.getQtaInv().compareTo(BigDecimal.ZERO) < 0).map(GiacenzaDTO::getCodMart).collect(Collectors.toList());
|
||||
|
||||
multiDBTransactionManager.prepareStatement(
|
||||
"INSERT INTO carelli_giacenza_prog_bck " +
|
||||
"SELECT getDate(), * " +
|
||||
"FROM carelli_giacenza_prog " +
|
||||
"WHERE cod_mdep = " + UtilityDB.valueToString(codMdep) + " AND " +
|
||||
"cod_mart in (" + UtilityDB.listValueToString(elencoArticoli) + ")").execute();
|
||||
}
|
||||
|
||||
return listGiacenza;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user