Merge branch 'master' into develop
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good

This commit is contained in:
2025-07-09 14:52:52 +02:00

View File

@@ -420,7 +420,7 @@ public class GiacenzaService {
if (!UtilityString.isNullOrEmpty(codDtipRett)) {
sql =
Query.format(
"SELECT art.cod_mart_mov as cod_mart, sum(qta_col * art.qta_std) as qta_col, mtb_colt.data_ins as data_collo\n" +
"SELECT art.cod_mart_mov as cod_mart, sum(qta_col * art.qta_std) as qta_col, mtb_colr.datetime_row as data_collo\n" +
"FROM mtb_colt\n" +
" INNER JOIN mtb_colr ON mtb_colt.gestione = mtb_colr.gestione AND mtb_colt.data_collo = mtb_colr.data_collo AND\n" +
" mtb_colt.ser_collo = mtb_colr.ser_collo AND mtb_colt.num_collo = mtb_colr.num_collo\n" +
@@ -430,7 +430,7 @@ public class GiacenzaService {
" AND mtb_colt.ora_fine_prep is not null \n" +
" AND mtb_colt.cod_mdep = %s\n" +
" AND exists (select * from carelli_giacenza_prog c where c.cod_mdep = mtb_colt.cod_mdep and c.cod_mart = art.cod_mart_mov and (c.data_reg < mtb_colt.data_ins or IsNull(tipo_car, 'G') = 'G' ))\n " +
"GROUP BY art.cod_mart_mov, mtb_colt.data_ins",
"GROUP BY art.cod_mart_mov, mtb_colr.datetime_row",
codDtipRett, dataIniz, codMdep);
List<HashMap<String, Object>> datiDoc = UtilityDB.executeSimpleQuery(multiDBTransactionManager.getPrimaryConnection(), sql);
@@ -638,8 +638,8 @@ public class GiacenzaService {
" AND ntb_doct.cod_mdep = dtb_doct.cod_mdep)),\n" +
" inventario_provvisorio AS (SELECT art.cod_mart_mov AS cod_mart,\n" +
" SUM(qta_col * art.qta_std) AS qta_col,\n" +
" data_ins,\n" +
" MAX(data_ins) OVER ( PARTITION BY art.cod_mart_mov) AS max_data_ins\n" +
" datetime_row as data_ins,\n" +
" MAX(datetime_row) OVER ( PARTITION BY art.cod_mart_mov) AS max_data_ins\n" +
" FROM mtb_colt\n" +
" INNER JOIN mtb_colr\n" +
" ON mtb_colt.gestione = mtb_colr.gestione\n" +
@@ -658,7 +658,7 @@ public class GiacenzaService {
" WHERE mtb_colt.cod_dtip_provv = 'RGIAC'\n" +
" and exists (select * from carelli_giacenza_prog c where c.cod_mdep = mtb_colt.cod_mdep and c.cod_mart = art.cod_mart_mov and (c.data_reg < mtb_colt.data_ins or IsNull(tipo_car, 'G') = 'G' ))\n" +
" AND mtb_colt.cod_mdep IN (" + whereCond + ")\n" +
" GROUP BY art.cod_mart_mov, mtb_colt.data_collo, data_ins),\n" +
" GROUP BY art.cod_mart_mov, mtb_colt.data_collo, datetime_row),\n" +
" selezione_giacenza AS (SELECT ISNULL(ip.cod_mart, gp.cod_mart) AS cod_mart,\n" +
" ISNULL(ip.qta_col, gp.qta_car) AS qta_car,\n" +
" ISNULL(IIF(gp.data_ins < ip.data_ins, 0, gp.qta_scar), 0) AS qta_scar,\n" +