Modifica riferimenti su inventario quando si modifica la chiave del documento INV
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good

This commit is contained in:
2025-02-06 10:30:25 +01:00
parent 547c87e1ed
commit 9bb42d08ca
7 changed files with 381 additions and 11 deletions

View File

@@ -1,6 +1,7 @@
package it.integry.ems.migration.model;
import it.integry.ems.migration._base.BaseMigration;
import it.integry.ems.migration._base.IntegryCustomerDB;
import it.integry.ems.migration._base.MigrationModelInterface;
public class Migration_20250128172026 extends BaseMigration implements MigrationModelInterface {
@@ -9,6 +10,10 @@ public class Migration_20250128172026 extends BaseMigration implements Migration
public void up() throws Exception {
if (isHistoryDB())
return;
if (isCustomerDb(IntegryCustomerDB.Siciliani_DMS))
return;
executeStatement("update atb_list_data set flag_riversa_promo = 1 where flag_riversa_promo is null");
addDefault("atb_list_data", "flag_riversa_promo", 1 );
executeStatement("alter table atb_list_data alter column flag_riversa_promo bit not null");

View File

@@ -1,6 +1,7 @@
package it.integry.ems.migration.model;
import it.integry.ems.migration._base.BaseMigration;
import it.integry.ems.migration._base.IntegryCustomerDB;
import it.integry.ems.migration._base.MigrationModelInterface;
public class Migration_20250203152831 extends BaseMigration implements MigrationModelInterface {
@@ -10,6 +11,9 @@ public class Migration_20250203152831 extends BaseMigration implements Migration
if (isHistoryDB())
return;
if (isCustomerDb(IntegryCustomerDB.Siciliani_DMS))
return;
createOrUpdateView("mvw_colr_sum",
"CREATE VIEW [dbo].[mvw_colr_sum] AS \n" +
"SELECT mtb_colt.gestione,\n" +

View File

@@ -1,6 +1,7 @@
package it.integry.ems.migration.model;
import it.integry.ems.migration._base.BaseMigration;
import it.integry.ems.migration._base.IntegryCustomerDB;
import it.integry.ems.migration._base.MigrationModelInterface;
public class Migration_20250203163432 extends BaseMigration implements MigrationModelInterface {
@@ -10,6 +11,8 @@ public class Migration_20250203163432 extends BaseMigration implements Migration
if (isHistoryDB())
return;
if (isCustomerDb(IntegryCustomerDB.Siciliani_DMS))
return;
createOrUpdateView("vvw_contratti_vendita", "CREATE VIEW [dbo].[vvw_contratti_vendita] AS\n" +
"WITH depo AS (SELECT TOP 1 cod_mdep\n" +

View File

@@ -1,15 +1,289 @@
package it.integry.ems.migration.model;import it.integry.ems.migration._base.BaseMigration;
package it.integry.ems.migration.model;
import it.integry.ems.migration._base.BaseMigration;
import it.integry.ems.migration._base.IntegryCustomerDB;
import it.integry.ems.migration._base.MigrationModelInterface;
public class Migration_20250204105553 extends BaseMigration implements MigrationModelInterface{
public class Migration_20250204105553 extends BaseMigration implements MigrationModelInterface {
@Override
public void up()throws Exception {
if(isHistoryDB())
public void up() throws Exception {
if (isHistoryDB())
return;
if (isCustomerDb(IntegryCustomerDB.Siciliani_DMS))
return;
executeStatement("ALTER view [dbo].[lvw_MovimentiPosture] as\n" +
"With setup AS (SELECT 'M00' as cod_mart_mischela\n" +
"\t\t\t\t/*SELECT value_string as cod_mart_mischela\n" +
" FROM DBO.ParseStringIntoArray(\n" +
" (select DBO.getGestSetup('DTB_DOCT', 'MOVIMENTAZIONE_OLIO',\n" +
" 'COD_MART_MISCELA')), '|')*/),\n" +
"MovimentiMixPosture as\n" +
" ( \n" +
" select CarT.cod_prod CarCodProd,\n" +
" CarT.partita_mag CartPartitaMag,\n" +
" MixT.cod_prod MixTCodProd,\n" +
" MixT.partita_mag as MixTPartita,\n" +
" CarR.cod_mart CarRCodMart,\n" +
" CarR.posizione CarRPos,\n" +
" MixR.cod_mart MixRCodMart,\n" +
" MixR.posizione MixRPos,\n" +
"\n" +
" MixT.data_reg,\n" +
" MixT.data_ins,\n" +
" MixT.cod_mdep,\n" +
" carT.gestione,\n" +
" CarT.cod_anag,\n" +
" gtb_anag.rag_soc,\n" +
" CarT.cod_dtip,\n" +
" dtb_tipi.descrizione as causale,\n" +
" CarT.data_doc,\n" +
" CarT.ser_doc,\n" +
" CarT.num_doc,\n" +
" Cart.cod_prod as cod_prod_fine,\n" +
" Cart.partita_mag as partita_mag_fine,\n" +
" MixT.cod_prod as Cod_prod_mix,\n" +
" MixT.partita_mag as partita_mag_mix,\n" +
" case\n" +
" when (MixT.cod_prod <> CarT.cod_prod and MixT.cod_prod not in (select cod_mart_mischela from setup))\n" +
" then\n" +
" mtb_partita_mag.posizione --Avvinamento\n" +
" else\n" +
" Case\n" +
" when MixR.cod_mart in (select cod_mart_mischela from setup)\n" +
" then null --La miscela termina nel confezionato quindi postura null\n" +
" else\n" +
" Case\n" +
" when MixT.cod_prod in (select cod_mart_mischela from setup)\n" +
" and CarR.posizione = MixR.posizione\n" +
" then null --Rigo di scarico a confezionamento di un olio senza serbatoio polomone\n" +
"\n" +
" else\n" +
" CarR.posizione end end end as Posizione_a,\n" +
" MixR.cod_dtip as cod_dtip_mix,\n" +
" MixR.cod_mart,\n" +
" mtb_aart.descrizione_estesa as descrizione_Articolo,\t\t\t \n" +
" MixR.partita_mag,\n" +
"\t\t\t\tCASE WHEN Isnull(carat_CarR.Confezionato, 'N') = 'S' -- Scarico olio confezionato\n" +
"\t\t\t\tTHEN null else MixR.posizione end as Posizione_da,\n" +
"\n" +
" MAX(Case\n" +
" when MixR.cod_mart in (select cod_mart_mischela from setup)\n" +
" then null\n" +
" else MixR.posizione end)\n" +
" over (PARTITION by CarT.cod_anag, CarT.cod_Dtip, CarT.data_doc, CarT.ser_doc, CarT.num_doc) as MaxPosizioneA,\n" +
" MAX(MixR.posizione)\n" +
" over (PARTITION by CarT.cod_anag, CarT.cod_Dtip, CarT.data_doc, CarT.ser_doc, CarT.num_doc) as MaxPosizioneDa,\t\t\t\t\t \n" +
" Case\n" +
"\t\t\t\t when isnull(carat_CarR.Confezionato , 'N') = 'S' THEN\n" +
"\t\t\t\t\t\tcase when tipoMix.segno_qta_car - tipoMix.segno_qta_scar > 0 THEN MixT.qta_prod eLSE 0 END --Sconfezionamento\t\t\t\t \t\t\t\t \n" +
" when MAX(Case\n" +
" when MixR.cod_mart in (select cod_mart_mischela from setup)\n" +
" then Null\n" +
" else MixR.posizione end)\n" +
" over (PARTITION by CarT.cod_anag, CarT.cod_Dtip, CarT.data_doc, CarT.ser_doc, CarT.num_doc) =\n" +
" MAX(MixR.posizione)\n" +
" over (PARTITION by CarT.cod_anag, CarT.cod_Dtip, CarT.data_doc, CarT.ser_doc, CarT.num_doc)\n" +
" and\n" +
" MixR.posizione = MAX(Case\n" +
" when MixR.cod_mart in (select cod_mart_mischela from setup)\n" +
" then null\n" +
" else MixR.posizione end)\n" +
" over (PARTITION by CarT.cod_anag, CarT.cod_Dtip, CarT.data_doc, CarT.ser_doc, CarT.num_doc)\n" +
" and MixR.cod_mart in (select cod_mart_mischela from setup)\n" +
" then 0 --Esclusione dei movimenti di M00 nei confezionamenti senza serbatoio polmone\n" +
" else\t\t\t\t\n" +
"\t\t\t\t\tMixR.qta_doc \n" +
" end as qta_doc\n" +
" from dtb_doct CarT \n" +
"\t\t\t\tINNER JOIN dtb_tipi on CarT.cod_dtip = dtb_tipi.cod_dtip \n" +
"\t\t\t\tINNER JOIN gtb_anag ON CarT.cod_anag = gtb_anag.cod_anag \n" +
"\t\t\t\tINNER JOIN dtb_docr CarR ON CarT.cod_anag = CarR.cod_anag\n" +
"\t\t\t\t\t\t\t\t\t\t\tand CarT.cod_dtip = CarR.cod_dtip\n" +
"\t\t\t\t\t\t\t\t\t\t\tand CarT.data_doc = CarR.data_doc\n" +
"\t\t\t\t\t\t\t\t\t\t\tand CarT.ser_doc = CarR.ser_doc\n" +
"\t\t\t\t\t\t\t\t\t\t\tand CarT.num_doc = CarR.num_doc\t\t\t\t\n" +
"\t\t\t\tINNER JOIn dtb_doct MixT ON CarR.activity_id_row = MixT.activity_id \n" +
"\t\t\t\tINNER JOIN dtb_tipi tipoMix on MixT.cod_dtip = tipoMix.cod_dtip\n" +
"\t\t\t\tINNER JOIN dtb_docr MixR ON MixT.cod_anag = MixR.cod_anag\n" +
"\t\t\t\t\t\t\t\t\tand MixT.cod_dtip = MixR.cod_dtip\n" +
"\t\t\t\t\t\t\t\t\tand MixT.data_doc = MixR.data_doc\n" +
"\t\t\t\t\t\t\t\t\tand MixT.ser_doc = MixR.ser_doc\n" +
"\t\t\t\t\t\t\t\t\tand MixT.num_doc = MixR.num_doc \n" +
"\t\t\t\tINNER JOIN mtb_partita_mag ON MixT.cod_prod = mtb_partita_mag.cod_mart and \n" +
"\t\t\t\t\t\t\t\t\t\t\t\tMixT.partita_mag = mtb_partita_mag.partita_mag\t\t \n" +
"\t\t\t\tINNER JOIN mtb_aart ON MixR.cod_mart = mtb_aart.cod_mart\n" +
"\t\t\t\tLEFT OUTER JOIN olvw_caratteristiche carat_CarR on CarR.cod_mart = carat_CarR.cod_mart\n" +
" where dtb_tipi.tipo_emissione = 'DIRETTA'\t\t\n" +
" and Carr.posizione is not null \n" +
"\t\t And (\n" +
" isNUll(mtb_partita_mag.posizione, '') <> isNull(MixR.posizione, '')\n" +
" and CarR.posizione <> isNull(MixR.posizione, '') --esclusione dei giroconti dovuti agli avvinamenti\n" +
"\n" +
" OR MixT.cod_prod in (select cod_mart_mischela from setup)\n" +
" and\n" +
" CarR.posizione = isNull(MixR.posizione, '') --Serve ad includere la riga dell'olio dei confezionamenti senza serbatoio polmone\n" +
"\t\t\t\t \n" +
" OR MixT.cod_prod not in (select cod_mart_mischela from setup)\n" +
" and ( MixT.cod_prod <> MixR.cod_mart \n" +
"\t\t\t\t\t\t\t\tOR (MixT.cod_prod = MixR.cod_mart AND IsNull(carat_CarR.Confezionato, 'N') = 'S' )\n" +
"\t\t\t\t\t\t\t\t)\n" +
"\t\t\t\t\t\tand CarR.posizione = isNull(MixR.posizione, '') --Serve ad includere la riga di riqualificazione dell'olio\n" +
" ) \n" +
" )\n" +
"\n" +
", movi as (\n" +
" --Carichi da Mix per movimento speciale\t\n" +
" Select data_reg,\n" +
" data_ins,\n" +
" MovimentiMixPosture.cod_mdep,\n" +
" gestione,\n" +
" cod_anag,\n" +
" rag_soc,\n" +
" cod_dtip,\n" +
" causale,\n" +
" data_doc,\n" +
" ser_doc,\n" +
" num_doc,\n" +
" posizione_a as Posizione,\n" +
" mtb_depo_posizioni.descrizione as descrizione_posizione,\n" +
" mtb_depo_posizioni.capacita,\n" +
" cod_mart,\n" +
" descrizione_Articolo,\n" +
" partita_mag,\n" +
" qta_doc as qta_Car,\n" +
" 0 as qta_Scar,\n" +
" ISNULL(cod_prod_fine, cod_prod_mix) as cod_prod,\n" +
" ISNULL(partita_mag_fine, partita_mag_mix) as partita_mag_prod\n" +
" from MovimentiMixPosture,\n" +
" mtb_depo_posizioni\n" +
" Where Posizione_a is not null\n" +
" and qta_doc <> 0\n" +
" /*and MovimentiMixPosture.cod_mdep = mtb_depo_posizioni.cod_mdep*/\n" +
" and MovimentiMixPosture.Posizione_a = mtb_depo_posizioni.posizione\n" +
" \n" +
" Union all\n" +
"\n" +
" --Scarichi da Mix per movimento speciale\n" +
" Select data_reg,\n" +
" data_ins,\n" +
" MovimentiMixPosture.cod_mdep,\n" +
" gestione,\n" +
" cod_anag,\n" +
" rag_soc,\n" +
" cod_dtip,\n" +
" causale,\n" +
" data_doc,\n" +
" ser_doc,\n" +
" num_doc,\n" +
" posizione_da as Posizione,\n" +
" mtb_depo_posizioni.descrizione as descrizione_posizione,\n" +
" mtb_depo_posizioni.capacita,\n" +
" cod_mart,\n" +
" descrizione_Articolo,\n" +
" partita_mag,\n" +
" 0 as qta_Car,\n" +
" qta_doc as qta_Scar,\n" +
" ISNULL(cod_prod_fine, cod_prod_mix) as cod_prod,\n" +
" ISNULL(partita_mag_fine, partita_mag_mix) as partita_mag_prod\n" +
" from MovimentiMixPosture,\n" +
" mtb_depo_posizioni\n" +
" Where Posizione_da is not null\n" +
" and qta_doc <> 0\n" +
" /*and MovimentiMixPosture.cod_mdep = mtb_depo_posizioni.cod_mdep*/\n" +
" and MovimentiMixPosture.Posizione_da = mtb_depo_posizioni.posizione\n" +
"\t \n" +
" union all\n" +
"\n" +
" --Carichi e scarichi da movimenti normali (inventari, ddt di vendita, etc)\n" +
" Select dtb_doct.data_reg,\n" +
" dtb_doct.data_ins,\n" +
" dtb_doct.cod_mdep,\n" +
" dtb_doct.gestione,\n" +
" dtb_doct.cod_anag,\n" +
" gtb_anag.rag_soc,\n" +
" dtb_doct.cod_dtip,\n" +
" dtb_tipi.descrizione as causale,\n" +
" dtb_doct.data_doc,\n" +
" dtb_doct.ser_doc,\n" +
" dtb_doct.num_doc,\n" +
" dtb_docr.posizione,\n" +
" mtb_depo_posizioni.descrizione as descrizione_posizione,\n" +
" mtb_depo_posizioni.capacita,\n" +
" dtb_docr.cod_mart,\n" +
" mtb_aart.descrizione_estesa,\n" +
" dtb_docr.partita_mag,\n" +
" dtb_docr.qta_doc * dtb_docr.rap_conv * (segno_qta_car) as qta_Car,\n" +
" dtb_docr.qta_doc * dtb_docr.rap_conv * (segno_qta_scar) as qta_sCar,\n" +
" dtb_doct.cod_prod,\n" +
" dtb_doct.partita_mag as partita_mag_prod\n" +
" from dtb_doct,\n" +
" dtb_docr\n" +
" left outer join mtb_depo_posizioni on dtb_docr.posizione = mtb_depo_posizioni.posizione,\n" +
" dtb_tipi,\n" +
" gtb_anag,\n" +
" mtb_aart\n" +
" Where dtb_doct.cod_anag = dtb_docr.cod_anag\n" +
" and dtb_doct.cod_dtip = dtb_docr.cod_dtip\n" +
" and dtb_doct.data_doc = dtb_docr.data_doc\n" +
" and dtb_doct.ser_doc = dtb_docr.ser_doc\n" +
" and dtb_doct.num_doc = dtb_docr.num_doc\n" +
" and dtb_doct.cod_anag = gtb_anag.cod_anag\n" +
" and dtb_doct.cod_dtip = dtb_tipi.cod_dtip\n" +
" and dtb_docr.cod_mart = mtb_aart.cod_mart\n" +
" and dtb_tipi.tipo_emissione = 'DIRETTA'\n" +
" and dtb_docr.posizione is not null\n" +
" and dtb_doct.activity_id is null\n" +
" and dtb_docr.cod_mart not in (select cod_mart_mischela from setup)\n" +
")\n" +
"\n" +
"select data_reg,\n" +
" data_ins,\n" +
" cod_mdep,\n" +
" gestione,\n" +
" cod_anag,\n" +
" rag_soc,\n" +
" cod_dtip,\n" +
" causale,\n" +
" data_doc,\n" +
" ser_doc,\n" +
" num_doc,\n" +
" Posizione,\n" +
" descrizione_posizione,\n" +
" capacita,\n" +
" cod_mart,\n" +
" descrizione_Articolo,\n" +
" partita_mag,\n" +
" sum(qta_Car) as qta_car,\n" +
" sum(qta_Scar) as qta_scar,\n" +
" cod_prod,\n" +
" partita_mag_prod\n" +
"from movi\n" +
"where data_reg between '2024-01-01' and '2025-01-22' and cod_mart <> isNull('',cod_prod) \n" +
"group by data_reg,\n" +
" data_ins,\n" +
" cod_mdep,\n" +
" gestione,\n" +
" cod_anag,\n" +
" rag_soc,\n" +
" cod_dtip,\n" +
" causale,\n" +
" data_doc,\n" +
" ser_doc,\n" +
" num_doc,\n" +
" Posizione,\n" +
" descrizione_posizione,\n" +
" capacita,\n" +
" cod_mart,\n" +
" descrizione_Articolo,\n" +
" partita_mag,\n" +
" cod_prod,\n" +
" partita_mag_prod ");
}
@Override
public void down()throws Exception {
public void down() throws Exception {
}
}

View File

@@ -1,15 +1,58 @@
package it.integry.ems.migration.model;import it.integry.ems.migration._base.BaseMigration;
package it.integry.ems.migration.model;
import it.integry.ems.migration._base.BaseMigration;
import it.integry.ems.migration._base.MigrationModelInterface;
public class Migration_20250206095719 extends BaseMigration implements MigrationModelInterface{
public class Migration_20250206095719 extends BaseMigration implements MigrationModelInterface {
@Override
public void up()throws Exception {
if(isHistoryDB())
public void up() throws Exception {
if (isHistoryDB())
return;
executeStatement("ALTER VIEW [dbo].[ovw_budget_ordv] as \n" +
"With budget as (\n" +
"select DENSE_RANK() over (partition by dtb_ordt.cod_mdep, dtb_ordr.cod_mart order by dtb_ordt.data_ord desc) AS id_ordine,\n" +
"dtb_ordt.num_ord,\n" +
"dtb_ordt.data_ord as data_iniz,\n" +
"first_value(dtb_ordr.data_cons) over (order by dtb_ordt.data_ord desc) as data_fine,\n" +
"dtb_ordr.cod_mart,\n" +
"mtb_aart.unt_mis,\n" +
"(dtb_ordr.qta_ord*dtb_ordr.rap_conv) as qta_bdg,\n" +
"dtb_ordt.cod_mdep\n" +
"from dtb_ordt inner join dtb_ordr on dtb_ordt.gestione = dtb_ordr.gestione and \n" +
"dtb_ordt.data_ord = dtb_ordr.data_ord and\n" +
"dtb_ordt.num_ord = dtb_ordr.num_ord \n" +
"inner join mtb_aart on dtb_ordr.cod_mart = mtb_aart.cod_mart\n" +
"where dtb_ordt.gestione = 'V' AND\n" +
"dtb_ordt.flag_annulla = 'N' AND\n" +
"dtb_ordt.flag_sospeso = 'S' AND\n" +
"--dtb_ordr.qta_ord <> 0 AND \n" +
"dtb_ordr.flag_evaso <> 'A' AND\n" +
"Cast(getDate() as date) BETWEEN dtb_ordt.data_ord AND dtb_ordr.data_cons and\n" +
"dtb_ordt.flag_budget = 1 \n" +
")\n" +
"\n" +
"\n" +
"select cod_mdep, num_ord, data_iniz, data_fine, cod_mart, unt_mis, qta_bdg, ISNULL(qta_ord, 0) as qta_ord, \n" +
"case when (qta_bdg - ISNULL(qta_ord, 0))<0 then 0 else (qta_bdg - ISNULL(qta_ord, 0)) end as qta_saldo\n" +
"from budget outer apply \n" +
" (select sum(dtb_ordr.qta_ord*dtb_ordr.rap_conv) as qta_ord\n" +
" from dtb_ordt inner join dtb_ordr on dtb_ordt.gestione = dtb_ordr.gestione and \n" +
" dtb_ordt.data_ord = dtb_ordr.data_ord and\n" +
" dtb_ordt.num_ord = dtb_ordr.num_ord \n" +
" where dtb_ordt.gestione = 'V' AND\n" +
" dtb_ordt.flag_annulla = 'N' AND\n" +
" dtb_ordt.flag_sospeso = 'N' AND\n" +
" dtb_ordr.qta_ord <> 0 AND \n" +
" dtb_ordr.flag_evaso = 'I' AND\n" +
" dtb_ordt.flag_budget = 0 AND\n" +
" dtb_ordr.cod_mart = budget.cod_mart AND \n" +
" dtb_ordt.data_ord between budget.data_iniz and budget.data_fine ) ord\n" +
"where id_ordine = 1");
}
@Override
public void down()throws Exception {
public void down() throws Exception {
}
}

View File

@@ -1241,4 +1241,36 @@ public class CommonRules extends QueryRules {
int maxProgressivoUl = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(conn, sql);
return maxProgressivoUl + 1;
}
public static void updateDatiInv(Connection conn, DtbDoct entity) throws Exception {
String codAnagOld = null, serDocOld = null, codDtipOld = null;
Integer numDocOld = null;
Date dataDocOld = null;
HashMap<String, Object> oldPk = entity.getOldPk();
if (oldPk != null && !oldPk.isEmpty()) {
if (oldPk.containsKey("codAnag")) codAnagOld = (String) oldPk.get("codAnag"); else codAnagOld = entity.getCodAnag();
if (oldPk.containsKey("codDtip")) codDtipOld = (String) oldPk.get("codDtip"); else codDtipOld = entity.getCodDtip();
if (oldPk.containsKey("dataDoc")) dataDocOld = UtilityString.parseDate((String) oldPk.get("dataDoc")); else dataDocOld = entity.getDataDoc();
if (oldPk.containsKey("serDoc")) serDocOld = (String) oldPk.get("serDoc"); else serDocOld = entity.getSerDoc();
if (oldPk.containsKey("numDoc")) numDocOld = (Integer) oldPk.get("numDoc"); else numDocOld = entity.getNumDoc();
if (!entity.getCodDtip().equals(codDtipOld) ||
!entity.getCodAnag().equals(codAnagOld) ||
!entity.getDataDoc().equals(dataDocOld) ||
entity.getSerDoc().equals(serDocOld) ||
!entity.getNumDoc().equals(numDocOld)){
String sql =
"UPDATE mtb_invent " +
"SET cod_anag = " + UtilityDB.valueToString(entity.getCodAnag())+ ", " +
"cod_dtip = " + UtilityDB.valueToString(entity.getCodDtip())+ ", " +
"data_doc = " + UtilityDB.valueDateToString(entity.getDataDoc(), CommonConstants.DATE_FORMAT_YMD) + ", " +
"ser_doc = " + UtilityDB.valueToString(entity.getSerDoc())+ ", " +
"num_doc = " + UtilityDB.valueToString(entity.getNumDoc());
sql = UtilityDB.addwhereCond(sql, entity.getWhereCondOldPk(null), false);
conn.createStatement().executeUpdate(sql);
}
}
}
}

View File

@@ -400,4 +400,13 @@ then
modify($mtbColt){
setProgressivoUl(progressivoToSave);
}
end
end
rule "updateDatiInv"
no-loop
when
eval(postRulesEnabled)
$testata: DtbDoct(operation != OperationType.DELETE && gestione == "L")
then
CommonRules.updateDatiInv(conn, $testata);
end