Merge branch 'develop' into feature/Feature-revisione_ordiniWeb
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,34 @@
|
||||
package it.integry.ems.adapter;
|
||||
|
||||
import it.integry.ems_model.utility.UtilityString;
|
||||
|
||||
import javax.xml.bind.annotation.adapters.XmlAdapter;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
public class XmlLocalDateAdapter extends XmlAdapter<String, LocalDate> {
|
||||
|
||||
private DateTimeFormatter sdf;
|
||||
|
||||
public XmlLocalDateAdapter() {
|
||||
sdf = DateTimeFormatter.ofPattern("dd-MM-yyyy");
|
||||
}
|
||||
|
||||
public XmlLocalDateAdapter(String format) {
|
||||
sdf = DateTimeFormatter.ofPattern(format);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String marshal(LocalDate arg0) throws Exception {
|
||||
return arg0.format(sdf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LocalDate unmarshal(String arg0) throws Exception {
|
||||
String format = UtilityString.determineDateFormat(arg0);
|
||||
if (format != null && !"dd-MM-yyyy".equals(format))
|
||||
sdf = DateTimeFormatter.ofPattern(format);
|
||||
return LocalDate.parse(arg0,sdf);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package it.integry.ems.adapter;
|
||||
|
||||
import it.integry.ems_model.utility.UtilityString;
|
||||
|
||||
import javax.xml.bind.annotation.adapters.XmlAdapter;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
public class XmlLocalDateTimeAdapter extends XmlAdapter<String, LocalDateTime> {
|
||||
|
||||
private DateTimeFormatter sdf;
|
||||
|
||||
public XmlLocalDateTimeAdapter() {
|
||||
sdf = DateTimeFormatter.ofPattern("dd-MM-yyyy HH:mm:ss");
|
||||
}
|
||||
|
||||
public XmlLocalDateTimeAdapter(String format) {
|
||||
sdf = DateTimeFormatter.ofPattern(format);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String marshal(LocalDateTime arg0) throws Exception {
|
||||
return arg0.format(sdf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LocalDateTime unmarshal(String arg0) throws Exception {
|
||||
String format = UtilityString.determineDateFormat(arg0);
|
||||
if (format != null && !"dd-MM-yyyy HH:mm:ss".equals(format))
|
||||
sdf = DateTimeFormatter.ofPattern(format);
|
||||
return LocalDateTime.parse(arg0,sdf);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -155,6 +155,11 @@ public abstract class BaseMigration implements MigrationModelInterface {
|
||||
UtilityDB.createIndex(connection, indexTableDTO);
|
||||
}
|
||||
|
||||
|
||||
protected void cloneTable(String sourceTable, String newTable,boolean fillNewTable, boolean dropOldTable, boolean renameNewTable) throws Exception {
|
||||
UtilityDB.cloneTable(connection, sourceTable, newTable, fillNewTable, dropOldTable, renameNewTable);
|
||||
}
|
||||
|
||||
protected void dropIndex(String tableName, String indexName) throws Exception {
|
||||
UtilityDB.dropIndex(connection, tableName, indexName);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ public class Migration_20250929172222 extends BaseMigration implements Migration
|
||||
return;
|
||||
|
||||
if (isCustomer(IntegryCustomer.Idrotecnica) || isCustomer(IntegryCustomer.Sabato) || isCustomer(IntegryCustomer.Ime) ||
|
||||
isCustomer(IntegryCustomer.Materica) || isCustomer(IntegryCustomer.Lippolis)) {
|
||||
isCustomer(IntegryCustomer.Materica) || isCustomer(IntegryCustomer.Lippolis) || isCustomer(IntegryCustomer.Integry)){
|
||||
|
||||
//Creo uno script SQL per cancellare e ricreare le FK che punteranno a stb_activity_old
|
||||
String fixFkSqlScript = "SELECT fk.name AS FK_Name,\n" +
|
||||
@@ -192,6 +192,20 @@ public class Migration_20250929172222 extends BaseMigration implements Migration
|
||||
dropIndex("stb_activity", "ix_stb_activity_alarm");
|
||||
|
||||
executeStatement(
|
||||
"UPDATE stb_activity\n" +
|
||||
"SET\n" +
|
||||
" estimated_time = ISNULL(estimated_time, estimated_date),\n" +
|
||||
" estimated_endtime = ISNULL(estimated_endtime, estimated_enddate),\n" +
|
||||
" effective_time = ISNULL(effective_time, effective_date),\n" +
|
||||
" effective_endtime = ISNULL(effective_endtime, effective_enddate),\n" +
|
||||
" alarm_time = ISNULL(alarm_time, alarm_date)\n" +
|
||||
"WHERE(\n" +
|
||||
" estimated_time IS NULL\n" +
|
||||
" OR estimated_endtime IS NULL\n" +
|
||||
" OR effective_time IS NULL\n" +
|
||||
" OR effective_endtime IS NULL\n" +
|
||||
" OR alarm_time IS NULL\n" +
|
||||
" );\n",
|
||||
"alter table stb_activity drop column data_ins_act ",
|
||||
"alter table stb_activity drop column estimated_date ",
|
||||
"alter table stb_activity drop column alarm_date ",
|
||||
|
||||
@@ -11,6 +11,9 @@ public class Migration_20251002154118 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
if (isCustomerDb(IntegryCustomerDB.Carelli_Winact)) {
|
||||
executeStatement(
|
||||
"ALTER TABLE mtb_aart\n" +
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomer;
|
||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251006171357 extends BaseMigration implements MigrationModelInterface {
|
||||
@@ -11,7 +11,7 @@ public class Migration_20251006171357 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (!isCustomer(IntegryCustomer.Biolevante)) return;
|
||||
if (!isCustomerDb(IntegryCustomerDB.Biolevante_Biolevante)) return;
|
||||
createOrUpdateView("mvw_TracciabRintracciabProd", "CREATE view [dbo].[mvw_TracciabRintracciabProd] as\n" +
|
||||
"SELECT produzioni.cod_mart AS idart,\n" +
|
||||
" produzioni.partita_mag AS idlotto,\n" +
|
||||
|
||||
@@ -0,0 +1,140 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251013091105 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
|
||||
createOrUpdateFunction("f_calcScad", "CREATE FUNCTION [dbo].[f_calcScad](@dataIniz DateTime,@codPaga varchar(5), @imponibile numeric(20,5), @imposta numeric(20,5)) \n" +
|
||||
"RETURNS @dateScad TABLE (numRata int, dataScad DateTime, impScad numeric(20,5) ) AS \n" +
|
||||
"\n" +
|
||||
"begin\n" +
|
||||
"\n" +
|
||||
" Declare @ldt_dataInizCalc datetime;\n" +
|
||||
" Declare @li_ggPrimaRata int;\n" +
|
||||
" Declare @li_ggTraRate int;\n" +
|
||||
" Declare @li_numRate int;\n" +
|
||||
" Declare @li_CountRata int; \n" +
|
||||
" Declare @addDay int;\n" +
|
||||
" Declare @lc_impRata numeric(20,5);\n" +
|
||||
" Declare @lc_impPrimaRata numeric(20,5);\n" +
|
||||
" Declare @lc_approssimazione numeric(20,5);\n" +
|
||||
" Declare @ls_ivaPrimaRata varchar(20);\n" +
|
||||
" Declare @ls_dataRif varchar(20);\n" +
|
||||
" \n" +
|
||||
" SELECT @li_CountRata = 2;\n" +
|
||||
" \n" +
|
||||
" SELECT @li_ggPrimaRata = gtb_paga.gg_prima_rata, \n" +
|
||||
" @li_ggTraRate = gtb_paga.gg_tra_rate,\n" +
|
||||
" @ls_ivaPrimaRata = Iva_prima_rata,\n" +
|
||||
" @ls_dataRif = gtb_paga.data_rif, \n" +
|
||||
" @li_numRate = gtb_paga.num_rate\n" +
|
||||
" FROM gtb_paga\n" +
|
||||
" WHERE gtb_paga.cod_paga = @codPaga;\n" +
|
||||
" \n" +
|
||||
" IF @li_numRate > 0 \n" +
|
||||
" begin\n" +
|
||||
" IF @ls_ivaPrimaRata = 'PRIMA RATA SOLO IVA'\n" +
|
||||
" begin\n" +
|
||||
" Select @lc_impRata = round(@imponibile/(@li_numRate - 1),2)\n" +
|
||||
" Select @lc_impPrimaRata = @imposta\n" +
|
||||
" end\n" +
|
||||
" else\n" +
|
||||
" begin\n" +
|
||||
" if @ls_ivaPrimaRata = 'SULLA PRIMA RATA'\n" +
|
||||
" begin\n" +
|
||||
" Select @lc_impRata = round(@imponibile/@li_numRate,2)\n" +
|
||||
" Select @lc_impPrimaRata = @lc_impRata + @imposta\n" +
|
||||
" end\n" +
|
||||
" else\n" +
|
||||
" begin\n" +
|
||||
" Select @lc_impRata = round((@imponibile + @imposta) /@li_numRate,2)\n" +
|
||||
" Select @lc_impPrimaRata = @lc_impRata \n" +
|
||||
" end\n" +
|
||||
" end\n" +
|
||||
" end\n" +
|
||||
" \n" +
|
||||
" SELECT @ldt_dataInizCalc = @dataIniz\n" +
|
||||
" \n" +
|
||||
" IF left(@ls_dataRif, 9) = 'FINE MESE'\n" +
|
||||
" begin\n" +
|
||||
" IF MONTH( @dataIniz ) = 12\n" +
|
||||
" begin\n" +
|
||||
" SELECT @ldt_dataInizCalc = DATEADD(day, -1, \n" +
|
||||
" CONVERT(datetime, \n" +
|
||||
" Convert(varchar(4),Convert(int, year( @dataIniz ) + 1 )) \n" +
|
||||
" + '-' + Convert( varchar(2), 1)\n" +
|
||||
" + '-' + Convert( varchar(2),1), 121))\n" +
|
||||
" end \n" +
|
||||
" ELSE\n" +
|
||||
" begin\n" +
|
||||
" SELECT @ldt_dataInizCalc = DATEADD(day, -1, \n" +
|
||||
" CONVERT(datetime, \n" +
|
||||
" Convert(varchar(4),Convert(int, year( @dataIniz ))) \n" +
|
||||
" + '-' + Convert( varchar(2), (MONTH( @dataIniz ) + 1))\n" +
|
||||
" + '-' + Convert( varchar(2),1), 121))\n" +
|
||||
" end\n" +
|
||||
" end \n" +
|
||||
" \n" +
|
||||
" \n" +
|
||||
" IF @li_ggPrimaRata > 0 \n" +
|
||||
" begin\n" +
|
||||
" select @ldt_dataInizCalc = dbo.f_aggiungiGiorniScad(@ldt_dataInizCalc, @li_ggPrimaRata, @ls_dataRif )\n" +
|
||||
" Insert into @dateScad values (1, @ldt_dataInizCalc, @lc_impPrimaRata)\n" +
|
||||
" end \n" +
|
||||
" ELSE\n" +
|
||||
" begin\n" +
|
||||
" Insert into @dateScad values (1, @ldt_dataInizCalc, @lc_impPrimaRata)\n" +
|
||||
" end\n" +
|
||||
"\n" +
|
||||
" WHILE @li_CountRata <= @li_numRate \n" +
|
||||
" begin\n" +
|
||||
" select @ldt_dataInizCalc = dbo.f_aggiungiGiorniScad(@ldt_dataInizCalc,@li_ggTraRate, @ls_dataRif )\n" +
|
||||
"\n" +
|
||||
" Insert into @dateScad values (@li_CountRata, @ldt_dataInizCalc, @lc_impRata)\n" +
|
||||
" SELECT @li_CountRata = @li_CountRata + 1\n" +
|
||||
" end \n" +
|
||||
" \n" +
|
||||
" /*** Calcolo eventuale residuo di approssimazione da imputare sull'ultima rata ***/\n" +
|
||||
" Select @lc_approssimazione = @lc_impRata * (@li_numRate - 1) + @lc_impPrimaRata - (@imponibile + @imposta)\n" +
|
||||
" IF @lc_approssimazione <> 0 \n" +
|
||||
" begin\n" +
|
||||
" Update @dateScad set impScad = impScad-@lc_approssimazione\n" +
|
||||
" WHERE numRata = @li_numRate\n" +
|
||||
" end\n" +
|
||||
" \n" +
|
||||
" Select @li_CountRata = 1\n" +
|
||||
" Select @addDay = 0\n" +
|
||||
" WHILE @li_CountRata <= @li_numRate \n" +
|
||||
" begin \n" +
|
||||
" IF @ls_dataRif = 'FINE MESE+1GG' \n" +
|
||||
" SELECT @addDay = 1\n" +
|
||||
" IF @ls_dataRif = 'FINE MESE+5GG' \n" +
|
||||
" SELECT @addDay = 5\n" +
|
||||
" IF @ls_dataRif = 'FINE MESE+10GG' \n" +
|
||||
" SELECT @addDay = 10\n" +
|
||||
" \n" +
|
||||
" IF @addDay > 0\n" +
|
||||
" begin \n" +
|
||||
" Update @dateScad set dataScad = DATEADD(day, @addDay , dataScad)\n" +
|
||||
" WHERE numRata = @li_CountRata\n" +
|
||||
" end \n" +
|
||||
" SELECT @li_CountRata = @li_CountRata + 1\n" +
|
||||
" end\n" +
|
||||
"\n" +
|
||||
" return\n" +
|
||||
"end");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251013103907 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
executeStatement("ALTER TABLE stb_activity ADD extra_project BIT DEFAULT 0 NOT NULL",
|
||||
"ALTER TABLE stb_activity ADD view_in_meeting BIT DEFAULT 0 NOT NULL");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomer;
|
||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251013174133 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (!isCustomer(IntegryCustomer.Carelli)) return;
|
||||
|
||||
if (isCustomerDb(IntegryCustomerDB.Carelli_Format)) return;
|
||||
|
||||
createOrUpdateView("avw_last_acq_lotto_w"
|
||||
, "CREATE VIEW avw_last_acq_lotto_w WITH SCHEMABINDING AS\n" +
|
||||
" SELECT wdtb_doct.data_reg,\n" +
|
||||
" cod_mart,\n" +
|
||||
" wdtb_docr.partita_mag,\n" +
|
||||
" wdtb_doct.cod_mdep,\n" +
|
||||
" wdtb_doct.data_ins,\n" +
|
||||
" mtb_depo.cod_vlis,\n" +
|
||||
" wdtb_docr.id_riga\n" +
|
||||
" FROM dbo.wdtb_doct\n" +
|
||||
" INNER JOIN dbo.wdtb_docr ON wdtb_doct.cod_anag = wdtb_docr.cod_anag AND\n" +
|
||||
" wdtb_doct.cod_dtip = wdtb_docr.cod_dtip AND\n" +
|
||||
" wdtb_doct.data_doc = wdtb_docr.data_doc AND\n" +
|
||||
" wdtb_doct.ser_doc = wdtb_docr.ser_doc AND\n" +
|
||||
" wdtb_doct.num_doc = wdtb_docr.num_doc\n" +
|
||||
" inner join dbo.mtb_depo on mtb_depo.cod_mdep = wdtb_doct.cod_mdep\n" +
|
||||
" WHERE wdtb_docr.partita_mag IS NOT NULL");
|
||||
|
||||
executeStatement("CREATE UNIQUE CLUSTERED INDEX [IDX_CLUSTERED_avw_last_acq_lotto_w] ON [dbo].avw_last_acq_lotto_w\n" +
|
||||
" (\n" +
|
||||
" data_reg,\n" +
|
||||
" cod_mart,\n" +
|
||||
" partita_mag,\n" +
|
||||
" cod_mdep,\n" +
|
||||
" data_ins,\n" +
|
||||
" id_riga\n" +
|
||||
" )",
|
||||
"CREATE NONCLUSTERED INDEX ix_avw_last_acq_lotto_w_2\n" +
|
||||
" ON [dbo].[avw_last_acq_lotto_w] ([cod_mart],[cod_mdep],[data_reg])\n" +
|
||||
" INCLUDE ([data_ins],[cod_vlis])",
|
||||
"CREATE NONCLUSTERED INDEX ix_avw_last_acq_lotto_w_1\n" +
|
||||
" ON [dbo].[avw_last_acq_lotto_w] ([cod_mdep],[data_reg],[cod_vlis])\n" +
|
||||
" INCLUDE ([cod_mart],[data_ins])");
|
||||
|
||||
createOrUpdateView("avw_last_acq_lotto", "CREATE VIEW avw_last_acq_lotto WITH SCHEMABINDING AS\n" +
|
||||
" SELECT dtb_doct.data_reg,\n" +
|
||||
" cod_mart,\n" +
|
||||
" dtb_docr.partita_mag,\n" +
|
||||
" dtb_doct.cod_mdep,\n" +
|
||||
" dtb_doct.data_ins,\n" +
|
||||
" mtb_depo.cod_vlis,\n" +
|
||||
" dtb_docr.id_riga,\n" +
|
||||
" CAST(dtb_doct.cod_anag AS VARCHAR(10))\n" +
|
||||
" + '_' + dtb_doct.cod_dtip\n" +
|
||||
" + '_' + convert(varchar(10), dtb_doct.data_doc, 112)\n" +
|
||||
" + '_' + dtb_doct.ser_doc\n" +
|
||||
" + '_' + CAST(dtb_doct.num_doc AS VARCHAR(10)) AS chiave_doc\n" +
|
||||
" FROM dbo.dtb_doct\n" +
|
||||
" INNER JOIN dbo.dtb_docr\n" +
|
||||
" ON dtb_doct.cod_anag = dtb_docr.cod_anag AND dtb_doct.cod_dtip = dtb_docr.cod_dtip AND\n" +
|
||||
" dtb_doct.data_doc = dtb_docr.data_doc AND dtb_doct.ser_doc = dtb_docr.ser_doc AND\n" +
|
||||
" dtb_doct.num_doc = dtb_docr.num_doc\n" +
|
||||
" INNER JOIN dbo.dtb_tipi ON dtb_doct.cod_dtip = dtb_tipi.cod_dtip\n" +
|
||||
" inner join dbo.mtb_depo on mtb_depo.cod_mdep = dtb_doct.cod_mdep\n" +
|
||||
" WHERE dtb_tipi.gestione = 'A'\n" +
|
||||
" AND dtb_docr.partita_mag IS NOT NULL\n" +
|
||||
" AND dtb_tipi.tipo_emissione = 'DIRETTA'\n" +
|
||||
" AND dtb_tipi.segno_qta_car = 1\n" +
|
||||
" AND flag_chk_tracciabilita = 1\n" +
|
||||
" and dtb_doct.data_reg >= CONVERT(datetime, '20230101', 112)");
|
||||
|
||||
executeStatement("CREATE UNIQUE CLUSTERED INDEX [IDX_CLUSTERED_avw_last_acq_lotto] ON [dbo].avw_last_acq_lotto\n" +
|
||||
" (\n" +
|
||||
" data_reg,\n" +
|
||||
" cod_mart,\n" +
|
||||
" partita_mag,\n" +
|
||||
" cod_mdep,\n" +
|
||||
" data_ins,\n" +
|
||||
" id_riga,\n" +
|
||||
" chiave_doc\n" +
|
||||
" )");
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomer;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251014154051 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
|
||||
if (isCustomer(IntegryCustomer.Auricchio) || isCustomer(IntegryCustomer.Florapulia)) return;
|
||||
updateSetupValue("DATI_AZIENDA", "SETUP", "INVIO_EMAIL_NEW", "S");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
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_20251014182929 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (!isCustomerDb(IntegryCustomerDB.Gramm_Gramm))
|
||||
return;
|
||||
|
||||
executeStatement("INSERT INTO stb_gest_setup VALUES (\n" +
|
||||
" 'w_vedi_invoic_dlg',\n" +
|
||||
" 'SASU',\n" +
|
||||
" 'NAI_NAZIONE_PARTIVA',\n" +
|
||||
" 'S',\n" +
|
||||
" NULL,\n" +
|
||||
" 'N',\n" +
|
||||
" NULL,\n" +
|
||||
" 'N',\n" +
|
||||
" '2025-10-14 18:17:28.000',\n" +
|
||||
" 'Administrator',\n" +
|
||||
" 'N',\n" +
|
||||
" 'N',\n" +
|
||||
" 'N',\n" +
|
||||
" 'N',\n" +
|
||||
" NULL,\n" +
|
||||
" 0)");
|
||||
|
||||
executeStatement("INSERT INTO stb_gest_setup VALUES (\n" +
|
||||
" 'w_vedi_invoic_dlg',\n" +
|
||||
" 'SASU_CORA',\n" +
|
||||
" 'NAI_NAZIONE_PARTIVA',\n" +
|
||||
" 'S',\n" +
|
||||
" NULL,\n" +
|
||||
" 'N',\n" +
|
||||
" NULL,\n" +
|
||||
" 'N',\n" +
|
||||
" '2025-10-14 18:17:28.000',\n" +
|
||||
" 'Administrator',\n" +
|
||||
" 'N',\n" +
|
||||
" 'N',\n" +
|
||||
" 'N',\n" +
|
||||
" 'N',\n" +
|
||||
" NULL,\n" +
|
||||
" 0)");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomer;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251015102126 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
createSetup("W_VMOVIMENTAZIONI_DISP", "DATAWINDOW", "D_VMOVIM_CLIENTE_REP", null,
|
||||
null, false, null, false, false,
|
||||
false, false, false, null, false, null);
|
||||
createSetup("W_VMOVIMENTAZIONI_DISP", "DATAWINDOW", "D_VMOVIM_ARTICOLO_REP", null,
|
||||
null, false, null, false, false,
|
||||
false, false, false, null, false, null);
|
||||
createSetup("W_VMOVIMENTAZIONI_DISP", "DATAWINDOW", "D_VMOVIM_CLIENTE_STATISTICO_REP", null,
|
||||
null, false, null, false, false,
|
||||
false, false, false, null, false, null);
|
||||
createSetup("W_VMOVIMENTAZIONI_DISP", "DATAWINDOW", "D_VMOVIM_ARTICOLO_STATISTICO_REP", null,
|
||||
null, false, null, false, false,
|
||||
false, false, false, null, false, null);
|
||||
|
||||
if(isCustomer(IntegryCustomer.Fiume)) {
|
||||
updateSetupValue("W_VMOVIMENTAZIONI_DISP", "DATAWINDOW", "D_VMOVIM_CLIENTE_REP", "D_VMOVIM_CLIENTE_REP_LICOR");
|
||||
updateSetupValue("W_VMOVIMENTAZIONI_DISP", "DATAWINDOW", "D_VMOVIM_ARTICOLO_REP", "D_VMOVIM_ARTICOLO_REP_LICOR");
|
||||
updateSetupValue("W_VMOVIMENTAZIONI_DISP", "DATAWINDOW", "D_VMOVIM_CLIENTE_STATISTICO_REP", "D_VMOVIM_CLIENTE_STATISTICO_REP_LICOR");
|
||||
updateSetupValue("W_VMOVIMENTAZIONI_DISP", "DATAWINDOW", "D_VMOVIM_ARTICOLO_STATISTICO_REP", "D_VMOVIM_ARTICOLO_STATISTICO_REP_LICOR");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,219 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251015125141 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
executeStatement(";alter table mtb_lisv add flag_primario bit default 0 not null");
|
||||
|
||||
createOrUpdateFunction("getListinoVendita", "CREATE FUNCTION [dbo].[getListinoVendita](@datavalidita DATETIME, @codvlis VARCHAR(5), @codmart VARCHAR(15))\n" +
|
||||
" RETURNS TABLE AS\n" +
|
||||
" RETURN\n" +
|
||||
" SELECT vtb_list.cod_vlis,\n" +
|
||||
" vtb_list.descrizione,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN tmp_list.max_lisv IS NULL THEN NULL\n" +
|
||||
" ELSE CONVERT(DATETIME, LEFT(tmp_list.max_lisv, 10)) END AS data_iniz,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN tmp_list.max_lisv IS NULL THEN NULL\n" +
|
||||
" ELSE CONVERT(INT, RIGHT(tmp_list.max_lisv, 4)) END AS versione,\n" +
|
||||
" vtb_list.cod_divi,\n" +
|
||||
" vtb_list.cambio,\n" +
|
||||
" vtb_list.flag_arr_prz_iva,\n" +
|
||||
" vtb_list.arr_ric,\n" +
|
||||
" vtb_list.flag_list_iva_inclusa,\n" +
|
||||
" vtb_list.flag_lisv_margine,\n" +
|
||||
" vtb_list.flag_add_trasp,\n" +
|
||||
" tmp_list.cod_mart AS 'cod_mart',\n" +
|
||||
" mtb_lisv_data.unt_mis_ven AS unt_mis_ven,\n" +
|
||||
" ISNULL(mtb_lisv_data.rap_conv, 1) AS rap_conv,\n" +
|
||||
" ISNULL(mtb_lisv_data.prz_base, 0) AS prz_base,\n" +
|
||||
" ISNULL(mtb_lisv_data.ricarica, 0) AS ricarico,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN mtb_lisv_data.prz_vend IS NOT NULL AND mtb_lisv_data.prz_vend <> 0 THEN\n" +
|
||||
" ROUND((ISNULL(mtb_lisv_data.prz_vend, 0) -\n" +
|
||||
" (ISNULL(mtb_lisv_data.prz_base, 0) / (1 - mtb_aart.perc_sfrido / 100))) /\n" +
|
||||
" ISNULL(mtb_lisv_data.prz_vend, 0) * 100, 2)\n" +
|
||||
" ELSE 0 END AS margine_eff,\n" +
|
||||
" --dbo.f_calcMargineEffettivo(IsNull(mtb_lisv_data.prz_base, 0), IsNull(mtb_lisv_data.prz_vend, 0), mtb_aart.perc_sfrido) as margine_eff,\n" +
|
||||
" --dbo.f_calcRicaricoEffettivo(IsNull(mtb_lisv_data.prz_base, 0), IsNull(mtb_lisv_data.prz_vend, 0), mtb_aart.perc_sfrido) ricarico_eff, \n" +
|
||||
" CASE\n" +
|
||||
" WHEN mtb_lisv_data.prz_base IS NOT NULL AND mtb_lisv_data.prz_base <> 0 THEN\n" +
|
||||
" ROUND((ISNULL(mtb_lisv_data.prz_vend, 0) -\n" +
|
||||
" (ISNULL(mtb_lisv_data.prz_base, 0) / (1 - mtb_aart.perc_sfrido / 100))) /\n" +
|
||||
" (ISNULL(mtb_lisv_data.prz_base, 0) / (1 - mtb_aart.perc_sfrido / 100)) * 100, 2)\n" +
|
||||
" ELSE 0 END AS ricarico_eff,\n" +
|
||||
"\n" +
|
||||
" ISNULL(mtb_lisv_data.magg_prz_vend, 0) AS magg_prz_vend,\n" +
|
||||
" ISNULL(mtb_lisv_data.prz_vend, 0) AS prz_vend,\n" +
|
||||
" ISNULL(mtb_lisv_data.prz_vend_iva, 0) AS prz_vend_iva,\n" +
|
||||
" ISNULL(mtb_lisv_data.perc_sco1, 0) AS perc_sco1,\n" +
|
||||
" ISNULL(mtb_lisv_data.perc_sco2, 0) AS perc_sco2,\n" +
|
||||
" ISNULL(mtb_lisv_data.perc_sco3, 0) AS perc_sco3,\n" +
|
||||
" ISNULL(mtb_lisv_data.perc_sco4, 0) AS perc_sco4,\n" +
|
||||
" ISNULL(mtb_lisv_data.perc_prov, 0) AS perc_prov,\n" +
|
||||
" ISNULL(mtb_lisv_data.fisso_prov, 0) AS fisso_prov,\n" +
|
||||
" ISNULL(mtb_lisv_data.posizione, '') AS posizione,\n" +
|
||||
" ISNULL(mtb_lisv_data.perc_gest, 0) AS perc_gest,\n" +
|
||||
" ISNULL(mtb_lisv_data.val_gest, 0) AS val_gest,\n" +
|
||||
" mtb_lisv_data.data_agg_prz AS data_agg_prz,\n" +
|
||||
" ISNULL(mtb_lisv_data.perc_ispe, 0) AS perc_ispe,\n" +
|
||||
" ISNULL(mtb_lisv_data.val_ispe, 0) AS val_ispe,\n" +
|
||||
" ISNULL(mtb_lisv_data.perc_promo, 0) AS perc_promo,\n" +
|
||||
" ISNULL(mtb_lisv_data.val_promo, 0) AS val_promo,\n" +
|
||||
" ISNULL(mtb_lisv_data.perc_oneri, 0) AS perc_oneri,\n" +
|
||||
" ISNULL(mtb_lisv_data.val_oneri, 0) AS val_oneri,\n" +
|
||||
" mtb_lisv_data.tipo_variazione AS tipo_variazione,\n" +
|
||||
" mtb_lisv_data.note AS note,\n" +
|
||||
" mtb_lisv_data.aggiornato_da AS aggiornato_da,\n" +
|
||||
" mtb_lisv_data.prz_vend * (1 - mtb_lisv_data.perc_sco1 / 100) * (1 - mtb_lisv_data.perc_sco2 / 100) *\n" +
|
||||
" (1 - mtb_lisv_data.perc_sco3 / 100) *\n" +
|
||||
" (1 - mtb_lisv_data.perc_sco4 / 100) AS prz_vend_netto,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN ISNULL(mtb_lisv_data.colli_pedana, 0) <> 0 THEN mtb_lisv_data.colli_pedana\n" +
|
||||
" ELSE mtb_aart.colli_pedana END AS colli_pedana,\n" +
|
||||
" mtb_lisv_data.cod_tcol_ul AS cod_tcol_ul,\n" +
|
||||
" mtb_lisv_data.cod_tcol_ui AS cod_tcol_ui,\n" +
|
||||
" ISNULL(mtb_lisv_data.prz_vend_sug, 0) AS prz_vend_sug,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN ISNULL(mtb_lisv_data.qta_cnf, 0) <> 0\n" +
|
||||
" AND dbo.getGestSetup('VTB_LIST', 'SETUP', 'QTA_CNF_LISTINO') = 'S' \n" +
|
||||
" THEN mtb_lisv_data.qta_cnf\n" +
|
||||
" ELSE mtb_aart.qta_cnf / ISNULL(mtb_lisv_data.rap_conv, 1) END AS qta_cnf,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN ISNULL(mtb_lisv_data.colli_strato, 0) <> 0 THEN mtb_lisv_data.colli_strato\n" +
|
||||
" ELSE mtb_aart.colli_strato END AS colli_strato,\n" +
|
||||
" mtb_lisv_data.descrizione_html AS descrizione_html,\n" +
|
||||
" mtb_lisv_data.colli_pedana AS colli_pedana_lisv,\n" +
|
||||
" mtb_lisv_data.qta_cnf AS qta_cnf_lisv,\n" +
|
||||
" mtb_lisv_data.colli_strato AS colli_strato_lisv,\n" +
|
||||
" mtb_lisv_data.sconto_cartoni,\n" +
|
||||
" mtb_lisv_data.sconto_strato,\n" +
|
||||
" mtb_lisv_data.sconto_pedane,\n" +
|
||||
" vtb_list.flag_attivo,\n" +
|
||||
" vtb_list_data.note AS note_testata,\n" +
|
||||
" ISNULL(mtb_lisv_data.flag_prz_bloccato, 'N') AS flag_prz_bloccato,\n" +
|
||||
" vtb_list_data.porto AS porto,\n" +
|
||||
" mtb_lisv_data.system_note,\n" +
|
||||
" mtb_lisv.add_val_spese,\n" +
|
||||
" mtb_lisv.add_ric_spese,\n" +
|
||||
" mtb_lisv.add_sco_spese,\n" +
|
||||
" mtb_aart.flag_incl_listino,\n" +
|
||||
" mtb_lisv.flag_primario\n" +
|
||||
" FROM (SELECT vtb_list.cod_vlis AS cod_vlis,\n" +
|
||||
" mtb_lisv_data.cod_mart,\n" +
|
||||
" MAX(CASE\n" +
|
||||
" WHEN vtb_list_data.versione IS NULL THEN NULL\n" +
|
||||
" ELSE CONVERT(VARCHAR(10), vtb_list_data.data_iniz, 111) + ' ' +\n" +
|
||||
" REPLICATE('0', 5 - LEN(vtb_list_data.versione)) +\n" +
|
||||
" CONVERT(VARCHAR(5), vtb_list_data.versione) END) AS max_lisv,\n" +
|
||||
" vtb_list.cod_vlis AS 'cod_vlis_rif'\n" +
|
||||
" FROM vtb_list\n" +
|
||||
" INNER JOIN mtb_lisv_data ON vtb_list.cod_vlis = mtb_lisv_data.cod_vlis\n" +
|
||||
" LEFT OUTER JOIN vtb_list_data ON mtb_lisv_data.cod_vlis = vtb_list_data.cod_vlis AND\n" +
|
||||
" mtb_lisv_data.versione = vtb_list_data.versione AND\n" +
|
||||
" vtb_list_data.cod_promo IS NULL AND\n" +
|
||||
" vtb_list_data.data_iniz <= ISNULL(@datavalidita, GETDATE())\n" +
|
||||
" WHERE vtb_list.cod_vlis_rif IS NULL\n" +
|
||||
" GROUP BY vtb_list.cod_vlis,\n" +
|
||||
" mtb_lisv_data.cod_mart\n" +
|
||||
" UNION\n" +
|
||||
" SELECT vtb_list.cod_vlis AS cod_vlis,\n" +
|
||||
" mtb_lisv_data.cod_mart,\n" +
|
||||
" MAX(CASE\n" +
|
||||
" WHEN vtb_list_data.versione IS NULL THEN NULL\n" +
|
||||
" ELSE CONVERT(VARCHAR(10), vtb_list_data.data_iniz, 111) + ' ' +\n" +
|
||||
" REPLICATE('0', 5 - LEN(vtb_list_data.versione_rif)) +\n" +
|
||||
" CONVERT(VARCHAR(5), vtb_list_data.versione_rif) END) AS max_lisv,\n" +
|
||||
" vtb_list.cod_vlis_rif AS 'cod_vlis_rif'\n" +
|
||||
" FROM vtb_list\n" +
|
||||
" INNER JOIN vtb_list_data ON vtb_list.cod_vlis = vtb_list_data.cod_vlis\n" +
|
||||
" INNER JOIN vtb_list_data vtb_list_data_rif\n" +
|
||||
" ON vtb_list_data.versione_rif = vtb_list_data_rif.versione AND\n" +
|
||||
" vtb_list_data.cod_vlis_rif = vtb_list_data_rif.cod_vlis\n" +
|
||||
" INNER JOIN mtb_lisv_data ON vtb_list_data_rif.cod_vlis = mtb_lisv_data.cod_vlis AND\n" +
|
||||
" vtb_list_data_rif.versione = mtb_lisv_data.versione\n" +
|
||||
"\n" +
|
||||
" WHERE vtb_list_data.data_iniz <= ISNULL(@datavalidita, GETDATE())\n" +
|
||||
" AND vtb_list.cod_vlis_rif IS NOT NULL\n" +
|
||||
" GROUP BY vtb_list.cod_vlis,\n" +
|
||||
" mtb_lisv_data.cod_mart,\n" +
|
||||
" vtb_list.cod_vlis_rif) tmp_list\n" +
|
||||
" INNER JOIN vtb_list ON vtb_list.cod_vlis = tmp_list.cod_vlis\n" +
|
||||
" INNER JOIN mtb_lisv\n" +
|
||||
" ON tmp_list.cod_vlis_rif = mtb_lisv.cod_vlis AND tmp_list.cod_mart = mtb_lisv.cod_mart\n" +
|
||||
" INNER JOIN mtb_aart ON tmp_list.cod_mart = mtb_aart.cod_mart\n" +
|
||||
" LEFT OUTER JOIN mtb_lisv_data ON tmp_list.cod_vlis_rif = mtb_lisv_data.cod_vlis AND\n" +
|
||||
" tmp_list.cod_mart = mtb_lisv_data.cod_mart AND\n" +
|
||||
" CONVERT(INT, RIGHT(tmp_list.max_lisv, 5)) = mtb_lisv_data.versione\n" +
|
||||
" LEFT OUTER JOIN vtb_list_data ON tmp_list.cod_vlis = vtb_list_data.cod_vlis AND\n" +
|
||||
" CONVERT(INT, RIGHT(tmp_list.max_lisv, 5)) = vtb_list_data.versione\n" +
|
||||
"\n" +
|
||||
" WHERE (@codmart IS NULL OR tmp_list.cod_mart = @codmart)\n" +
|
||||
" AND (@codvlis IS NULL OR tmp_list.cod_vlis = @codvlis)");
|
||||
createOrUpdateFunction("getListinoVenditaPedane", "CREATE FUNCTION [dbo].[getListinoVenditaPedane](@datavalidita DATETIME, @codvlis VARCHAR(5), @codmart VARCHAR(15), @pedane INT)\n" +
|
||||
" RETURNS TABLE AS\n" +
|
||||
" RETURN\n" +
|
||||
" WITH trasp AS (SELECT mtb_lisv_data_spese.cod_vlis,\n" +
|
||||
" mtb_lisv_data_spese.versione,\n" +
|
||||
" mtb_lisv_data_spese.cod_spes,\n" +
|
||||
" mtb_lisv_data_spese.perc_ricarico,\n" +
|
||||
" mtb_lisv_data_spese.val_ricarico,\n" +
|
||||
" mtb_lisv_data_spese.perc_sconto,\n" +
|
||||
" mtb_lisv_data_spese.da,\n" +
|
||||
" mtb_lisv_data_spese.a\n" +
|
||||
" FROM vtb_list_data\n" +
|
||||
" --riga Sotto Aggiunta da Massimo 08/01/25 per non fare uscire i range pedane quando il prezzo non deve essere addizionato del costo dei trasporti\n" +
|
||||
" --inner join vtb_list on vtb_list_data.cod_vlis = vtb_list.cod_vlis and vtb_list.flag_add_trasp = 1\n" +
|
||||
" INNER JOIN mtb_lisv_data_spese\n" +
|
||||
" ON vtb_list_data.cod_vlis = mtb_lisv_data_spese.cod_vlis AND\n" +
|
||||
" vtb_list_data.versione = mtb_lisv_data_spese.versione\n" +
|
||||
" CROSS APPLY (SELECT MAX(id_listino) AS max_id_listino\n" +
|
||||
" FROM vtb_list_data t\n" +
|
||||
" WHERE t.data_iniz <= ISNULL(@datavalidita, CAST(GETDATE() AS DATE))\n" +
|
||||
" AND vtb_list_data.cod_vlis = t.cod_vlis) max_lisv\n" +
|
||||
" WHERE vtb_list_data.id_listino = max_lisv.max_id_listino)\n" +
|
||||
"\n" +
|
||||
" SELECT list.*,\n" +
|
||||
" trasp.cod_spes,\n" +
|
||||
" trasp.perc_ricarico,\n" +
|
||||
" trasp.val_ricarico,\n" +
|
||||
" trasp.perc_sconto,\n" +
|
||||
" trasp.da,\n" +
|
||||
" trasp.a,\n" +
|
||||
" (list.prz_vend +\n" +
|
||||
" IIF(list.flag_add_trasp = 1, --Questa condizione si potrebbe togliere per la modifica fatta l'8/01/25\n" +
|
||||
" ((ISNULL(val_ricarico, 0)) * list.add_val_spese) /\n" +
|
||||
" IIF(ISNULL(list.colli_pedana, 1) = 0, 1, list.colli_pedana), 0)) +\n" +
|
||||
" ((ISNULL(perc_ricarico, 0) * list.add_ric_spese * list.prz_vend) / 100) *\n" +
|
||||
" (1 - (ISNULL(perc_sconto, 0) * list.add_sco_spese) / 100) prz_vend_trasp,\n" +
|
||||
" ((list.prz_vend +\n" +
|
||||
" IIF(list.flag_add_trasp = 1, --Questa condizione si potrebbe togliere per la modifica fatta l'8/01/25\n" +
|
||||
" ((ISNULL(val_ricarico, 0)) * list.add_val_spese) /\n" +
|
||||
" IIF(ISNULL(list.colli_pedana, 1) = 0, 1, list.colli_pedana), 0)) +\n" +
|
||||
" ((ISNULL(perc_ricarico, 0) * list.add_ric_spese * list.prz_vend) / 100) *\n" +
|
||||
" (1 - (ISNULL(perc_sconto, 0) * list.add_sco_spese) / 100)) * (1 - list.perc_sco1 / 100) *\n" +
|
||||
" (1 - list.perc_sco2 / 100) *\n" +
|
||||
" (1 - list.perc_sco3 / 100) *\n" +
|
||||
" (1 - list.perc_sco4 / 100) AS prz_vend_trasp_netto\n" +
|
||||
" FROM getlistinovendita(@datavalidita, @codvlis, @codmart) list\n" +
|
||||
" LEFT OUTER JOIN trasp ON list.cod_vlis = trasp.cod_vlis AND\n" +
|
||||
" (@pedane IS NULL OR @pedane BETWEEN da AND a OR\n" +
|
||||
" (@pedane IS NOT NULL AND da = 0 AND a = 0))");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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_20251015125257 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
executeStatement("ALTER TABLE srl_user_table ADD flag_abil varchar(5) NOT NULL DEFAULT 'N'");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomer;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251017095838 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
createSetupQuery("SI_NO", "SI_NO", "SELECT 'S' UNION ALL SELECT 'N'");
|
||||
createSetup("W_SUPTABLE", "SETUP", "LIMITA_TABELLE", "N",
|
||||
"Limita la visualizzazione delle tabelle per utente ( inserire il dettaglio nella gestione utenti ) ", false, "SI_NO", false, false,
|
||||
false, false, false, null, false, "SELECT 'S' UNION ALL SELECT 'N'");
|
||||
|
||||
if (isCustomer(IntegryCustomer.Carelli))
|
||||
updateSetupValue("W_SUPTABLE", "SETUP", "LIMITA_TABELLE", "S");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251020090242 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
|
||||
createOrUpdateView("[vw_tracciabUDCProd]", "CREATE VIEW [dbo].[vw_tracciabUDCProd] AS\n" +
|
||||
"SELECT mtb_colr.data_ord AS dataOrdProd,\n" +
|
||||
" mtb_colr.num_ord AS numOrdProd,\n" +
|
||||
" mtb_colt.cod_anag AS codAnag,\n" +
|
||||
" gtb_anag.rag_soc AS produttore,\n" +
|
||||
" mtb_colt.cod_jfas AS linea,\n" +
|
||||
" mtb_colr.datetime_row AS dataOraProd,\n" +
|
||||
" mtb_colt.cod_dtip AS codDtip,\n" +
|
||||
" mtb_colt.data_doc AS dataDoc,\n" +
|
||||
" mtb_colt.ser_doc AS serDoc,\n" +
|
||||
" mtb_colt.num_doc AS numDoc,\n" +
|
||||
" mtb_colt.segno,\n" +
|
||||
" dtb_ordt.cod_prod AS codProd,\n" +
|
||||
" dtb_ordt.descrizione_prod AS DescrizioneProd,\n" +
|
||||
" IIF(mtb_colt.segno = 1, mtb_colr.partita_mag, NULL) AS lottoProd,\n" +
|
||||
" IIF(mtb_colt.segno = 1, mtb_colt.progressivo_ul, NULL) AS numUDCProd,\n" +
|
||||
" IIF(mtb_colt.segno = 1, mtb_colr.barcode_ul_in, NULL) AS UDCProd,\n" +
|
||||
" IIF(mtb_colt.segno = 1, mtb_aart.unt_mis, NULL) AS untMisProd,\n" +
|
||||
" IIF(mtb_colt.segno = 1, mtb_colr.qta_col, 0) AS qtaProd,\n" +
|
||||
" IIF(mtb_colt.segno = 1, mtb_colr.num_cnf, 0) AS colliProd,\n" +
|
||||
" IIF(mtb_colt.segno = -1, mtb_colr.cod_mart, NULL) AS codMP,\n" +
|
||||
" IIF(mtb_colt.segno = -1, mtb_aart.descrizione_estesa, NULL) AS DescrizioneMP,\n" +
|
||||
" IIF(mtb_colt.segno = -1, mtb_colr.partita_mag, NULL) AS lottoMP,\n" +
|
||||
" IIF(mtb_colt.segno = -1, udc.progressivo_ul, NULL) AS numUDCMP,\n" +
|
||||
" IIF(mtb_colt.segno = -1, mtb_colr.barcode_ul_out, NULL) AS UDCMP,\n" +
|
||||
" IIF(mtb_colt.segno = -1, mtb_aart.unt_mis, NULL) AS untMisMP,\n" +
|
||||
" IIF(mtb_colt.segno = -1, mtb_colr.qta_col, 0) AS qtaScar\n" +
|
||||
"FROM mtb_colt\n" +
|
||||
" INNER JOIN mtb_colr ON mtb_colt.gestione = mtb_colr.gestione AND\n" +
|
||||
" mtb_colt.data_collo = mtb_colr.data_collo AND\n" +
|
||||
" mtb_colt.ser_collo = mtb_colr.ser_collo AND\n" +
|
||||
" mtb_colt.num_collo = mtb_colr.num_collo\n" +
|
||||
" LEFT OUTER JOIN mtb_colt udc ON udc.gestione = mtb_colr.gestione_rif AND\n" +
|
||||
" udc.data_collo = mtb_colr.data_collo_rif AND\n" +
|
||||
" udc.ser_collo = mtb_colr.ser_collo_rif AND\n" +
|
||||
" udc.num_collo = mtb_colr.num_collo_rif\n" +
|
||||
" INNER JOIN mtb_aart ON mtb_colr.cod_mart = mtb_aart.cod_mart\n" +
|
||||
" INNER JOIN gtb_anag ON mtb_colt.cod_anag = gtb_anag.cod_anag\n" +
|
||||
" LEFT OUTER JOIN dtb_ordt ON mtb_colt.gestione = dtb_ordt.gestione AND mtb_colt.data_ord = dtb_ordt.data_ord AND\n" +
|
||||
" mtb_colt.num_ord = dtb_ordt.num_ord\n" +
|
||||
"WHERE mtb_colt.gestione = 'L'\n" +
|
||||
" AND mtb_colr.data_ord IS NOT NULL\n" +
|
||||
"UNION ALL\n" +
|
||||
"SELECT dtb_doct.data_ord AS dataOrdProd,\n" +
|
||||
" dtb_doct.num_ord AS num_ordProd,\n" +
|
||||
" dtb_doct.cod_anag,\n" +
|
||||
" gtb_anag.rag_soc,\n" +
|
||||
" dtb_doct.cod_jfas,\n" +
|
||||
" step_ordine.data_iniz AS dataOraProd,\n" +
|
||||
" dtb_doct.cod_Dtip,\n" +
|
||||
" dtb_doct.data_doc,\n" +
|
||||
" dtb_doct.ser_doc,\n" +
|
||||
" dtb_doct.num_doc,\n" +
|
||||
" -1 AS segno,\n" +
|
||||
" dtb_doct.cod_prod AS codProd,\n" +
|
||||
" dtb_ordt.descrizione_prod AS descrizioneProd,\n" +
|
||||
" NULL AS LottoProd,\n" +
|
||||
" NULL AS NumUdcProd,\n" +
|
||||
" NULL AS UDCProd,\n" +
|
||||
" NULL AS untMisProd,\n" +
|
||||
" NULL AS qtaProd,\n" +
|
||||
" NULL AS colliProd,\n" +
|
||||
" dtb_docr.cod_mart AS codMp,\n" +
|
||||
" dtb_docr.descrizione AS DescrizioneMP,\n" +
|
||||
" dtb_docr.partita_mag AS LottMP,\n" +
|
||||
" NULL AS numUDCMP,\n" +
|
||||
" NULL AS UDCMP,\n" +
|
||||
" dtb_docr.unt_doc AS UntMisMP,\n" +
|
||||
" dtb_docr.qta_doc AS qtaScar\n" +
|
||||
"FROM dtb_doct\n" +
|
||||
" INNER JOIN dtb_docr ON dtb_doct.cod_anag = dtb_docr.cod_anag AND\n" +
|
||||
" dtb_doct.cod_dtip = dtb_docr.cod_dtip AND\n" +
|
||||
" dtb_doct.data_doc = dtb_docr.data_doc AND\n" +
|
||||
" dtb_doct.ser_doc = dtb_docr.ser_doc AND\n" +
|
||||
" dtb_doct.num_doc = dtb_docr.num_doc\n" +
|
||||
" INNER JOIN gtb_anag ON dtb_doct.cod_anag = gtb_anag.cod_anag\n" +
|
||||
" INNER JOIN mtb_aart ON dtb_docr.cod_mart = mtb_aart.cod_mart AND mtb_aart.flag_tracciabilita = 'S'\n" +
|
||||
" INNER JOIN mtb_grup ON mtb_aart.cod_mgrp = mtb_grup.cod_mgrp AND mtb_grup.tipo_mgrp = 'IMB'\n" +
|
||||
" INNER JOIN dtb_ordt ON dtb_ordt.gestione = dtb_doct.gestione AND dtb_ordt.data_ord = dtb_doct.data_ord AND\n" +
|
||||
" dtb_ordt.num_ord = dtb_doct.num_ord\n" +
|
||||
" INNER JOIN (SELECT gestione, data_ord, num_ord, MIN(data_iniz) AS data_iniz\n" +
|
||||
" FROM dtb_ord_steps\n" +
|
||||
" WHERE gestione = 'L'\n" +
|
||||
" GROUP BY gestione, data_ord, num_ord) step_ordine\n" +
|
||||
" ON step_ordine.gestione = dtb_doct.gestione AND step_ordine.data_ord = dtb_doct.data_ord AND\n" +
|
||||
" step_ordine.num_ord = dtb_doct.num_ord\n" +
|
||||
" INNER JOIN (SELECT cod_anag, cod_dtip, data_doc, ser_doc, num_doc\n" +
|
||||
" FROM dtb_doct\n" +
|
||||
" WHERE dtb_doct.cod_dtip IN ('H2', 'SLAV')\n" +
|
||||
" EXCEPT\n" +
|
||||
" SELECT cod_anag, cod_Dtip, data_doc, ser_doc, num_doc\n" +
|
||||
" FROM mtb_colt\n" +
|
||||
" WHERE cod_dtip IN ('H2', 'SLAV')) DocNoPackList ON dtb_doct.cod_anag = DocNoPackList.cod_anag AND\n" +
|
||||
" dtb_doct.cod_Dtip = DocNoPackList.cod_Dtip AND\n" +
|
||||
" dtb_doct.data_doc = DocNoPackList.data_doc AND\n" +
|
||||
" dtb_doct.ser_doc = DocNoPackList.ser_doc AND\n" +
|
||||
" dtb_doct.num_doc = DocNoPackList.num_doc");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -40,6 +40,15 @@ public class DocumentRules extends QueryRules {
|
||||
return dataRicezione;
|
||||
}
|
||||
|
||||
public static String getCodPagaDocV(DtbDoct dtbDoct) {
|
||||
if (!UtilityString.isNullOrEmpty(dtbDoct.getDtbTipi().getCodPaga())) {
|
||||
return dtbDoct.getDtbTipi().getCodPaga();
|
||||
} else if (UtilityString.isNullOrEmpty(dtbDoct.getVtbClie().getCodPaga())) {
|
||||
return dtbDoct.getVtbClie().getCodPaga();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void completeIdRigaDrlTipiNoteDoc(Connection conn, DtbNoteDoc dtbNoteDoc) throws SQLException {
|
||||
if (!dtbNoteDoc.getDrlTipiNoteDoc().isEmpty()) {
|
||||
for (DrlTipiNoteDoc drlTipiNoteDoc : dtbNoteDoc.getDrlTipiNoteDoc()) {
|
||||
@@ -77,122 +86,6 @@ public class DocumentRules extends QueryRules {
|
||||
return numDocNew;
|
||||
}
|
||||
|
||||
public static Boolean chkNumeroFuoriSequenza(Connection conn, DtbDoct entity) {
|
||||
Boolean numeroFuoriSequenza = false;
|
||||
/*
|
||||
int li_annoDoc, li_numIreg, li_numDoc, li_count;
|
||||
String ls_codIreg, ls_tipoNumeraz, ls_serDoc;
|
||||
Date ld_dataDoc = null;
|
||||
ResultSet res;
|
||||
boolean lb_returnVal;
|
||||
PreparedStatement Info;
|
||||
SimpleDateFormat annoFormat = new SimpleDateFormat("yyyy");
|
||||
return_class lcl_return = new return_class();
|
||||
|
||||
try{
|
||||
|
||||
// ACQUISIZIONE DATI DOCUMENTO
|
||||
li_annoDoc = Integer.valueOf(annoFormat.format(getDataDoc())).intValue();
|
||||
li_numDoc = getNumDoc().intValue();
|
||||
ls_serDoc = getSerDoc();
|
||||
|
||||
// ACQUISIZIONE DATI TIPO DOCUMENTO
|
||||
lb_returnVal = true;
|
||||
ls_codIreg = getValueTipoDoc(nameFieldsTipiDoc.is_codIreg);
|
||||
li_numIreg = utilityNumber.StringToInt(getValueTipoDoc(nameFieldsTipiDoc.is_numIreg));
|
||||
ls_tipoNumeraz = getValueTipoDoc(nameFieldsTipiDoc.is_tipoNumeraz);
|
||||
|
||||
|
||||
if (ls_tipoNumeraz.compareTo(nameFieldsTipiDoc.is_tipoNumMANUALE) != 0){
|
||||
if (li_numDoc > 1){
|
||||
// CONTROLLO PRESENZA DOCUMENTO PRECEDENTE ALL'ATTUALE
|
||||
li_count = 0;
|
||||
is_query =
|
||||
"SELECT data_doc, " +
|
||||
" ser_doc, " +
|
||||
" num_doc " +
|
||||
" FROM dtb_doct, " +
|
||||
" dtb_tipi" +
|
||||
" WHERE dtb_doct.cod_dtip = dtb_tipi.cod_dtip and " +
|
||||
" dtb_tipi.cod_ireg = " + utilityDB.valueToString(ls_codIreg) + " AND " +
|
||||
" dtb_tipi.num_ireg = " + utilityDB.valueIntToString(li_numIreg) + " AND " +
|
||||
" Datepart(year, dtb_doct.data_doc) = " + utilityDB.valueIntToString(li_annoDoc) + " AND " +
|
||||
" ser_doc = " + utilityDB.valueToString(ls_serDoc) + " AND " +
|
||||
" num_doc = " + utilityDB.valueIntToString(li_numDoc -1);
|
||||
|
||||
Info = connect.prepareStatement(is_query, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
|
||||
res = Info.executeQuery();
|
||||
while(res.next()){
|
||||
li_count++;
|
||||
ld_dataDoc = res.getDate(1);
|
||||
ls_serDoc = res.getString(2);
|
||||
li_numDoc = res.getInt(3);
|
||||
}
|
||||
res.close();Info.close();
|
||||
|
||||
|
||||
if (li_count == 0){
|
||||
// ERRORE: NON ESISTE IL DOCUMENTO PRECEDENTE
|
||||
lb_returnVal = false;
|
||||
}else{
|
||||
if (ld_dataDoc.after(getDataDoc())){
|
||||
// ERRORE: IL DOCUMENTO PRECEDENTE HA DATA MAGGIORE
|
||||
lb_returnVal = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (lb_returnVal == true){
|
||||
// CONTROLLO DELLA PRESENZA DEL DOCUMENTO SUCCESSIVO
|
||||
li_count = 0;
|
||||
is_query =
|
||||
"SELECT data_doc, " +
|
||||
" ser_doc, " +
|
||||
" num_doc " +
|
||||
" FROM dtb_doct, " +
|
||||
" dtb_tipi " +
|
||||
" WHERE dtb_doct.cod_dtip = dtb_tipi.cod_dtip and " +
|
||||
" dtb_tipi.cod_ireg = " + utilityDB.valueToString(ls_codIreg) + " AND " +
|
||||
" dtb_tipi.num_ireg = " + utilityDB.valueIntToString(li_numIreg) + " AND " +
|
||||
" Datepart(year, dtb_doct.data_doc) = " + utilityDB.valueIntToString(li_annoDoc) + " AND " +
|
||||
" ser_doc = " + utilityDB.valueToString(ls_serDoc) + " AND " +
|
||||
" num_doc = " + utilityDB.valueIntToString(li_numDoc + 1);
|
||||
|
||||
Info = connect.prepareStatement(is_query, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
|
||||
res = Info.executeQuery();
|
||||
while(res.next()){
|
||||
li_count++;
|
||||
ld_dataDoc = res.getDate(1);
|
||||
ls_serDoc = res.getString(2);
|
||||
li_numDoc = res.getInt(3);
|
||||
}
|
||||
res.close();Info.close();
|
||||
|
||||
if (li_count == 0){
|
||||
// NON ESISTE IL DOCUMENTO SUCCESSIVO
|
||||
if (ld_dataDoc != null){
|
||||
if (getDataDoc().before(ld_dataDoc)){
|
||||
// ERRORE: IL DOCUMENTO SUCCESSIVO A DATA MINORE
|
||||
lb_returnVal = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// SEGNALAZIONE ERRORE
|
||||
if (lb_returnVal == false){
|
||||
lcl_return.setReturnId(GlobalVariables.stateKO);
|
||||
lcl_return.setErrorText("DOCUMENTO INTESTATO A " + getCodAnag() + " - " + getCodDtip() + " N° " + utilityString.IntegerToString(getNumDoc()) + "/" + getSerDoc() + " DEL " + utilityString.DateToString(getDataDoc(), "dd-MM-yyyy") + " FUORI SEQUENZA");
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
lcl_return = utilityOBJ.GetExceptionMessage(utilityOBJ.GetCurrentClassName(this), utilityOBJ.GetCurrentMethodName(this), getProfileDB(), e, is_query);
|
||||
}
|
||||
return lcl_return;
|
||||
*/
|
||||
return numeroFuoriSequenza;
|
||||
}
|
||||
|
||||
public static Integer nextNumDoc(Connection conn, Date dataDoc, String codIreg, String serDoc, Integer numIreg, Integer numDoc) throws SQLException {
|
||||
|
||||
Short anno = new Short(new SimpleDateFormat("yyyy").format(dataDoc));
|
||||
|
||||
@@ -1053,11 +1053,12 @@ public class SalesRules extends QueryRules {
|
||||
mtbLisv.setOperation(OperationType.INSERT_OR_UPDATE);
|
||||
}
|
||||
|
||||
if (mtbLisvData.getAddRicSpese() != null || mtbLisvData.getAddScoSpese() != null || mtbLisvData.getAddValSpese() != null) {
|
||||
if (mtbLisvData.getAddRicSpese() != null || mtbLisvData.getAddScoSpese() != null || mtbLisvData.getAddValSpese() != null || mtbLisvData.getFlagPrimario() != null) {
|
||||
mtbLisv
|
||||
.setAddRicSpese(mtbLisvData.getAddRicSpese())
|
||||
.setAddScoSpese(mtbLisvData.getAddScoSpese())
|
||||
.setAddValSpese(mtbLisvData.getAddValSpese());
|
||||
.setAddValSpese(mtbLisvData.getAddValSpese())
|
||||
.setFlagPrimario(mtbLisvData.getFlagPrimario());
|
||||
mtbLisv.setOperation(OperationType.INSERT_OR_UPDATE);
|
||||
}
|
||||
|
||||
@@ -1195,6 +1196,7 @@ public class SalesRules extends QueryRules {
|
||||
" 0 AS giacenza,\n" +
|
||||
" ISNULL(lisv.cod_tcol_ui, articoli.cod_tcol_ui) AS cod_tcol_ui,\n" +
|
||||
" ISNULL(lisv.cod_tcol_ul, articoli.cod_tcol_ul) AS cod_tcol_ul,\n" +
|
||||
" ISNULL(lisv.flag_primario, 0) AS flag_primario,\n" +
|
||||
" :flagPrzBloccato AS flag_prz_bloccato,\n" +
|
||||
" :przVendSug AS prz_vend_sug,\n" +
|
||||
" CASE \n" +
|
||||
|
||||
@@ -128,6 +128,9 @@ public class MtbLisv extends EntityBase {
|
||||
@SqlField(value = "add_sco_spese", nullable = false, defaultObjectValue = "0")
|
||||
private Boolean addScoSpese;
|
||||
|
||||
@SqlField(value = "flag_primario", nullable = false, defaultObjectValue = "0")
|
||||
private Boolean flagPrimario;
|
||||
|
||||
public String getCodMart() {
|
||||
return codMart;
|
||||
}
|
||||
@@ -424,4 +427,13 @@ public class MtbLisv extends EntityBase {
|
||||
this.addScoSpese = addScoSpese;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Boolean getFlagPrimario() {
|
||||
return flagPrimario;
|
||||
}
|
||||
|
||||
public MtbLisv setFlagPrimario(Boolean flagPrimario) {
|
||||
this.flagPrimario = flagPrimario;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,6 +175,8 @@ public class MtbLisvData extends EntityBase {
|
||||
|
||||
private Boolean addScoSpese;
|
||||
|
||||
private Boolean flagPrimario;
|
||||
|
||||
@ImportFromParent
|
||||
@MapToTable("data_iniz")
|
||||
private Date dataIniz;
|
||||
@@ -748,6 +750,15 @@ public class MtbLisvData extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Boolean getFlagPrimario() {
|
||||
return flagPrimario;
|
||||
}
|
||||
|
||||
public MtbLisvData setFlagPrimario(Boolean flagPrimario) {
|
||||
this.flagPrimario = flagPrimario;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getInseritoDa() {
|
||||
return inseritoDa;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
package it.integry.ems_model.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import it.integry.ems_model.annotation.*;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
|
||||
@Master()
|
||||
@PropertyReactive()
|
||||
@Table(value = SrlUserTable.ENTITY)
|
||||
@JsonTypeName(value = SrlUserTable.ENTITY)
|
||||
public class SrlUserTable extends EntityBase {
|
||||
|
||||
public final static String ENTITY = "srl_user_table";
|
||||
|
||||
private final static Long serialVersionUID = 1L;
|
||||
|
||||
private final static Logger logger = LogManager.getLogger();
|
||||
|
||||
public SrlUserTable() {
|
||||
super(logger);
|
||||
}
|
||||
|
||||
@PK()
|
||||
@SqlField(value = "table_name", maxLength = 255, nullable = false)
|
||||
private String tableName;
|
||||
|
||||
@PK()
|
||||
@SqlField(value = "user_name", maxLength = 40, nullable = false)
|
||||
@FK(tableName = StbUser.ENTITY, columnName = "user_name")
|
||||
private String userName;
|
||||
|
||||
@SqlField(value = "flag_abil", maxLength = 5, nullable = false, defaultObjectValue = "N")
|
||||
private String flagAbil;
|
||||
|
||||
public String getTableName() {
|
||||
return tableName;
|
||||
}
|
||||
|
||||
public SrlUserTable setTableName(String tableName) {
|
||||
this.tableName = tableName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public SrlUserTable setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getFlagAbil() {
|
||||
return flagAbil;
|
||||
}
|
||||
|
||||
public SrlUserTable setFlagAbil(String flagAbil) {
|
||||
this.flagAbil = flagAbil;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -182,6 +182,12 @@ public class StbActivity extends EntityBase {
|
||||
@SqlField(value = "id_posizione")
|
||||
private Long idPosizione;
|
||||
|
||||
@SqlField(value = "extra_project", nullable = false, defaultObjectValue = "0")
|
||||
private Boolean extraProject;
|
||||
|
||||
@SqlField(value = "view_in_meeting", nullable = false, defaultObjectValue = "0")
|
||||
private Boolean viewInMeeting;
|
||||
|
||||
@EntityChild
|
||||
private List<StbActivityCosts> stbActivityCosts = new ArrayList<>();
|
||||
|
||||
@@ -618,6 +624,24 @@ public class StbActivity extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Boolean getExtraProject() {
|
||||
return extraProject;
|
||||
}
|
||||
|
||||
public StbActivity setExtraProject(Boolean extraProject) {
|
||||
this.extraProject = extraProject;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Boolean getViewInMeeting() {
|
||||
return viewInMeeting;
|
||||
}
|
||||
|
||||
public StbActivity setViewInMeeting(Boolean viewInMeeting) {
|
||||
this.viewInMeeting = viewInMeeting;
|
||||
return this;
|
||||
}
|
||||
|
||||
public LocalDateTime getEstimatedTime() {
|
||||
return estimatedTime;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,8 @@ import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems_model.annotation.*;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
import java.util.Date;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
@@ -39,7 +40,7 @@ public class StbActivityPublications extends EntityBase {
|
||||
|
||||
@PK
|
||||
@SqlField(value = "data_pub", nullable = false, defaultObjectValue = CommonConstants.TIMESTAMP)
|
||||
private Date dataPub;
|
||||
private LocalDate dataPub;
|
||||
|
||||
@SqlField(value = "custom_activity_description", maxLength = 1024)
|
||||
private String customActivityDescription;
|
||||
@@ -74,11 +75,11 @@ public class StbActivityPublications extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataPub() {
|
||||
public LocalDate getDataPub() {
|
||||
return dataPub;
|
||||
}
|
||||
|
||||
public StbActivityPublications setDataPub(Date dataPub) {
|
||||
public StbActivityPublications setDataPub(LocalDate dataPub) {
|
||||
this.dataPub = dataPub;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static it.integry.ems_model.utility.UtilityString.countSeparator;
|
||||
import static it.integry.ems_model.utility.UtilityString.replaceSubString;
|
||||
@@ -740,4 +741,136 @@ public class UtilityDB {
|
||||
return result;
|
||||
}
|
||||
|
||||
public static void cloneTable(Connection conn, String sourceTable, String newTable,boolean fillNewTable, boolean dropOldTable, boolean renameNewTable) throws Exception {
|
||||
//CREAZIONE TABELLA NUOVA
|
||||
executeStatement(conn, String.format("SELECT TOP 0 * INTO %s FROM %s", newTable, sourceTable));
|
||||
|
||||
String fileGroup = executeSimpleQueryOnlyFirstRowFirstColumn(conn,
|
||||
Query.format("SELECT fg.name\n" +
|
||||
"FROM sys.tables AS t \n" +
|
||||
"inner JOIN sys.indexes AS i ON t.object_id = i.object_id \n" +
|
||||
"inner JOIN sys.filegroups AS fg ON i.data_space_id = fg.data_space_id \n" +
|
||||
"WHERE t.name = %s\n" +
|
||||
"and i.type = 1", sourceTable));
|
||||
|
||||
String sql =
|
||||
Query.format("SELECT c.name\n" +
|
||||
"FROM sys.key_constraints kc\n" +
|
||||
" JOIN sys.index_columns ic ON kc.parent_object_id = ic.object_id AND kc.unique_index_id = ic.index_id\n" +
|
||||
" JOIN sys.columns c ON ic.object_id = c.object_id AND ic.column_id = c.column_id\n" +
|
||||
"\n" +
|
||||
"WHERE kc.parent_object_id = OBJECT_ID(%s)\n" +
|
||||
" AND kc.type = 'PK'\n" +
|
||||
"ORDER BY ic.key_ordinal", sourceTable);
|
||||
|
||||
List<String> listColPK = UtilityDB.executeSimpleQueryOnlyFirstColumn(conn, sql);
|
||||
|
||||
//Creazione PK
|
||||
executeStatement(conn,
|
||||
String.format("ALTER TABLE %s ADD CONSTRAINT [pk_%s] PRIMARY KEY ( %s ) %s",
|
||||
newTable, newTable, StringUtils.join(listColPK, ","),
|
||||
(fileGroup.equalsIgnoreCase("PRIMARY") ? "" : "ON " + fileGroup)));
|
||||
|
||||
//Creazione indici
|
||||
sql =
|
||||
Query.format(
|
||||
"SELECT i.name as index_name, i.is_unique, fg.name as file_name\n" +
|
||||
"FROM sys.indexes i inner join sys.tables AS t on i.object_id = t.object_id \n" +
|
||||
"JOIN sys.filegroups AS fg ON i.data_space_id = fg.data_space_id and i.is_primary_key = 1 \n" +
|
||||
"WHERE i.object_id = OBJECT_ID(%s)\n" +
|
||||
" AND i.is_primary_key = 0\n" +
|
||||
" AND i.is_unique_constraint = 0", sourceTable
|
||||
);
|
||||
|
||||
List<HashMap<String, Object>> indexList = UtilityDB.executeSimpleQuery(conn, sql);
|
||||
|
||||
for(HashMap<String, Object> i: indexList) {
|
||||
sql = Query.format(
|
||||
"SELECT c.name\n" +
|
||||
"FROM sys.indexes i\n" +
|
||||
"JOIN sys.index_columns ic ON i.object_id = ic.object_id AND i.index_id = ic.index_id\n" +
|
||||
"JOIN sys.columns c ON ic.object_id = c.object_id AND ic.column_id = c.column_id\n" +
|
||||
"WHERE i.object_id = OBJECT_ID(%s)\n" +
|
||||
" AND i.name = %s\n" +
|
||||
"ORDER BY ic.key_ordinal",
|
||||
sourceTable, i.get("index_name")
|
||||
);
|
||||
|
||||
List<String> listColIndex = UtilityDB.executeSimpleQueryOnlyFirstColumn(conn, sql);
|
||||
|
||||
executeStatement(conn, String.format("CREATE %s INDEX %s ON %s ( %s ) %s",
|
||||
(Boolean.TRUE.equals(i.get("is_unique")) ? "UNIQUE" : ""),
|
||||
i.get("index_name"),
|
||||
newTable,
|
||||
StringUtils.join(listColIndex, ","),
|
||||
((String) i.get("file_name")).equalsIgnoreCase("PRIMARY") ? "" : "ON " + (String) i.get("file_name")
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
//creazione default
|
||||
sql = Query.format("SELECT \n" +
|
||||
" dc.name AS DefaultName,\n" +
|
||||
" c.name AS ColumnName,\n" +
|
||||
" dc.definition\n" +
|
||||
"FROM sys.default_constraints dc\n" +
|
||||
"JOIN sys.columns c ON dc.parent_object_id = c.object_id AND dc.parent_column_id = c.column_id\n" +
|
||||
"WHERE dc.parent_object_id = OBJECT_ID(%s)",
|
||||
sourceTable);
|
||||
|
||||
List<HashMap<String, Object>> listDefatult = UtilityDB.executeSimpleQuery(conn, sql);
|
||||
|
||||
for(HashMap<String, Object> i: listDefatult) {
|
||||
executeStatement(conn, String.format("ALTER TABLE %s ADD CONSTRAINT %s DEFAULT %s FOR %s",
|
||||
newTable,
|
||||
((String) i.get("DefaultName")).toLowerCase().replace(sourceTable.toLowerCase(), newTable.toLowerCase()),
|
||||
i.get("definition"),
|
||||
i.get("ColumnName")
|
||||
));
|
||||
}
|
||||
|
||||
//creazione foreign key
|
||||
sql = Query.format("SELECT fk.name as fk_name, OBJECT_NAME(fk.referenced_object_id) as ref_tab\n" +
|
||||
"FROM sys.foreign_keys fk\n" +
|
||||
"WHERE fk.parent_object_id = OBJECT_ID(%s);",
|
||||
sourceTable);
|
||||
|
||||
List<HashMap<String, Object>> listFk = UtilityDB.executeSimpleQuery(conn, sql);
|
||||
|
||||
for(HashMap<String, Object> fk: listFk) {
|
||||
sql = String.format(
|
||||
"SELECT COL_NAME(fkc.parent_object_id, fkc.parent_column_id) AS column_name, \n" +
|
||||
"COL_NAME(fkc.referenced_object_id, fkc.referenced_column_id) AS column_ref\n" +
|
||||
"FROM sys.foreign_keys fk\n" +
|
||||
"INNER JOIN sys.foreign_key_columns fkc ON fk.object_id = fkc.constraint_object_id\n" +
|
||||
"WHERE fk.parent_object_id = OBJECT_ID(%s) AND fk.name = %S;",sourceTable, fk.get("fk_name")
|
||||
);
|
||||
|
||||
List<HashMap<String, Object>> listFkColumns = UtilityDB.executeSimpleQuery(conn, sql);
|
||||
|
||||
String colNames = StringUtils.join(listFkColumns.stream().map(x -> (String)x.get("column_name")).collect(Collectors.toList()), ",");
|
||||
String colRef = StringUtils.join(listFkColumns.stream().map(x -> (String)x.get("column_ref")).collect(Collectors.toList()), ",");
|
||||
|
||||
sql = String.format("ALTER TABLE %s ADD CONSTRAINT [ %s_NEW] FOREIGN KEY ([%s]) REFERENCES [%s]([%s]);",
|
||||
newTable,
|
||||
fk.get("fk_name"),
|
||||
colNames,
|
||||
fk.get("ref_tab"),
|
||||
colRef
|
||||
);
|
||||
|
||||
executeStatement(conn, sql);
|
||||
}
|
||||
//RIEMPIMENTO TABELLA NUOVA
|
||||
if (fillNewTable) {
|
||||
executeStatement(conn, String.format("INSERT INTO %s SELECT * FROM %s", newTable, sourceTable));
|
||||
|
||||
if (dropOldTable) {
|
||||
executeStatement(conn, "DROP TABLE " + sourceTable);
|
||||
if (renameNewTable)
|
||||
executeStatement(conn, Query.format("EXEC sp_rename %s, %s;", newTable, sourceTable));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -77,8 +77,11 @@ public class UtilityQuery {
|
||||
" TempCount.* " +
|
||||
"FROM TempResult, " +
|
||||
" TempCount " +
|
||||
"ORDER BY row_number " +
|
||||
"OFFSET (" + pageNumber + " - 1) * " + pageSize + " ROWS FETCH NEXT " + pageSize + " ROWS ONLY";
|
||||
"ORDER BY row_number ";
|
||||
|
||||
if (pageNumber > 0 && pageSize > 0) {
|
||||
sql += "OFFSET (" + pageNumber + " - 1) * " + pageSize + " ROWS FETCH NEXT " + pageSize + " ROWS ONLY";
|
||||
}
|
||||
|
||||
return sql;
|
||||
}
|
||||
|
||||
@@ -25,26 +25,7 @@ public class UtilityString {
|
||||
|
||||
//private static final Logger logger = LogManager.getLogger();
|
||||
|
||||
private static final Map<String, String> DATE_FORMAT_REGEXPS = new HashMap<String, String>() {{
|
||||
|
||||
//-----------------------------------------------------------------------------------------
|
||||
//giorno-mese-giorno
|
||||
put("^\\d{1,2}/\\d{1,2}/\\d{4}$", "dd/MM/yyyy");
|
||||
put("^\\d{1,2}\\.\\d{1,2}\\.\\d{4}$", "dd.MM.yyyy");
|
||||
put("^\\d{1,2}-\\d{1,2}-\\d{4}$", "dd-MM-yyyy");
|
||||
|
||||
//anno-mese-giorno
|
||||
put("^\\d{4}/\\d{1,2}/\\d{1,2}$", "yyyy/MM/dd");
|
||||
put("^\\d{4}\\.\\d{1,2}\\.\\d{1,2}$", "yyyy.MM.dd");
|
||||
put("^\\d{4}-\\d{1,2}-\\d{1,2}$", "yyyy-MM-dd");
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------------------
|
||||
//senza spazi
|
||||
put("^\\d{8}$", "yyyyMMdd");
|
||||
put("^\\d{6}$", "yyMMdd");
|
||||
put("^\\d{1,2}\\s[a-z]{3}\\s\\d{4}$", "dd MMM yyyy");
|
||||
put("^\\d{1,2}\\s[a-z]{4,}\\s\\d{4}$", "dd MMMM yyyy");
|
||||
private static final Map<String, String> DATETIME_FORMAT_REGEXPS = new HashMap<String, String>() {{
|
||||
|
||||
put("^\\d{12}$", "yyyyMMddHHmm");
|
||||
put("^\\d{8}\\s\\d{4}$", "yyyyMMdd HHmm");
|
||||
@@ -110,6 +91,29 @@ public class UtilityString {
|
||||
put("^(\\d{4})-(\\d{2})-(\\d{2})t(\\d{2}):(\\d{2}):(\\d{2})((\\+|-)(\\d{2}):(\\d{2}))$", "yyyy-MM-dd'T'HH:mm:ss");
|
||||
}};
|
||||
|
||||
private static final Map<String, String> DATE_FORMAT_REGEXPS = new HashMap<String, String>() {{
|
||||
|
||||
//-----------------------------------------------------------------------------------------
|
||||
//giorno-mese-giorno
|
||||
put("^\\d{1,2}/\\d{1,2}/\\d{4}$", "dd/MM/yyyy");
|
||||
put("^\\d{1,2}\\.\\d{1,2}\\.\\d{4}$", "dd.MM.yyyy");
|
||||
put("^\\d{1,2}-\\d{1,2}-\\d{4}$", "dd-MM-yyyy");
|
||||
|
||||
//anno-mese-giorno
|
||||
put("^\\d{4}/\\d{1,2}/\\d{1,2}$", "yyyy/MM/dd");
|
||||
put("^\\d{4}\\.\\d{1,2}\\.\\d{1,2}$", "yyyy.MM.dd");
|
||||
put("^\\d{4}-\\d{1,2}-\\d{1,2}$", "yyyy-MM-dd");
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------------------
|
||||
//senza spazi
|
||||
put("^\\d{8}$", "yyyyMMdd");
|
||||
put("^\\d{6}$", "yyMMdd");
|
||||
put("^\\d{1,2}\\s[a-z]{3}\\s\\d{4}$", "dd MMM yyyy");
|
||||
put("^\\d{1,2}\\s[a-z]{4,}\\s\\d{4}$", "dd MMMM yyyy");
|
||||
|
||||
}};
|
||||
|
||||
private static final Map<String, String> TIME_FORMAT_REGEXPS = new HashMap<String, String>() {{
|
||||
put("^\\d{1,2}:\\d{2}$", "HH:mm");
|
||||
put("^\\d{2}:\\d{2}$", "HH:mm");
|
||||
@@ -123,6 +127,11 @@ public class UtilityString {
|
||||
return DATE_FORMAT_REGEXPS.get(regexp);
|
||||
}
|
||||
}
|
||||
for (String regexp : DATETIME_FORMAT_REGEXPS.keySet()) {
|
||||
if (timeString.toLowerCase().matches(regexp)) {
|
||||
return DATETIME_FORMAT_REGEXPS.get(regexp);
|
||||
}
|
||||
}
|
||||
return null; // Unknown format.
|
||||
}
|
||||
|
||||
@@ -209,8 +218,15 @@ public class UtilityString {
|
||||
|
||||
if (format == null)
|
||||
throw new IOException("Impossibile riconoscere il formato data per " + value);
|
||||
|
||||
if (format.equalsIgnoreCase("yyyy-MM-dd'T'HH:mm:ss") && value.length() > 19)
|
||||
format += "z";
|
||||
|
||||
else if (DATE_FORMAT_REGEXPS.containsValue(format)) {
|
||||
final LocalDate localDate = parseLocalDate(value, format);
|
||||
return localDate.atStartOfDay();
|
||||
}
|
||||
|
||||
return parseLocalDateTime(value, format);
|
||||
}
|
||||
|
||||
@@ -731,10 +747,9 @@ public class UtilityString {
|
||||
}
|
||||
|
||||
public static boolean isEmail(String email) {
|
||||
String regex = "^(.+)@(.+)$";
|
||||
String regex = "^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}$";
|
||||
Pattern pattern = Pattern.compile(regex);
|
||||
Matcher matcher = pattern.matcher(email);
|
||||
return matcher.matches();
|
||||
|
||||
}
|
||||
}
|
||||
@@ -61,6 +61,22 @@ public class AuthController {
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/create-app-token", method = RequestMethod.POST)
|
||||
public ServiceRestResponse createAppToken(HttpServletRequest request, HttpServletResponse response,
|
||||
@RequestBody LoginRequestDTO loginRequestDTO) {
|
||||
try {
|
||||
String profileDb = multiDBTransactionManager.getPrimaryConnection().getProfileName();
|
||||
return ServiceRestResponse.createPositiveResponse(authService.createAppToken(profileDb, loginRequestDTO));
|
||||
} catch (AuthorizationExpriredException ex) {
|
||||
logger.error(request.getRequestURI(), ex);
|
||||
response.setStatus(420);
|
||||
return ServiceRestResponse.createNegativeResponse(ex);
|
||||
} catch (Exception e) {
|
||||
logger.error(request.getRequestURI(), e);
|
||||
return ServiceRestResponse.createNegativeResponse(e);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/me", method = RequestMethod.GET)
|
||||
@PreAuthorize("isAuthenticated()")
|
||||
public ServiceRestResponse user(@RequestParam(CommonConstants.PROFILE_DB) String profileDb) {
|
||||
|
||||
@@ -60,25 +60,27 @@ public class AuthService {
|
||||
private SettingsModel settingsModel;
|
||||
|
||||
|
||||
|
||||
public JwtResponse createAppToken(String profileDb, LoginRequestDTO loginRequestDTO) throws Exception {
|
||||
return login(profileDb, loginRequestDTO, true);
|
||||
}
|
||||
|
||||
|
||||
public JwtResponse login(String profileDb, LoginRequestDTO loginRequestDTO) throws Exception {
|
||||
if (UtilityString.isNullOrEmpty(loginRequestDTO.getUsername())) {
|
||||
return login(profileDb, loginRequestDTO, false);
|
||||
}
|
||||
|
||||
private JwtResponse login(String profileDb, LoginRequestDTO loginRequestDTO, boolean disableExpiration) throws Exception {
|
||||
if (UtilityString.isNullOrEmpty(loginRequestDTO.getUsername()))
|
||||
throw new Exception("Username mancante.");
|
||||
}
|
||||
|
||||
if (UtilityString.isNullOrEmpty(loginRequestDTO.getPassword())) {
|
||||
if (UtilityString.isNullOrEmpty(loginRequestDTO.getPassword()))
|
||||
throw new Exception("Password mancante.");
|
||||
}
|
||||
|
||||
if (UtilityString.isNullOrEmpty(loginRequestDTO.getDeviceId())) {
|
||||
if (UtilityString.isNullOrEmpty(loginRequestDTO.getDeviceId()))
|
||||
throw new Exception("Device id mancante.");
|
||||
}
|
||||
|
||||
if (requestDataDTO.getApplication() == null) {
|
||||
if (requestDataDTO.getApplication() == null)
|
||||
throw new Exception("X-App-Token mancante.");
|
||||
}
|
||||
|
||||
String username = loginRequestDTO.getUsername();
|
||||
String password = loginRequestDTO.getPassword();
|
||||
@@ -113,12 +115,14 @@ public class AuthService {
|
||||
stbDevices.getId()
|
||||
);
|
||||
|
||||
String oldAccessToken = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), sql);
|
||||
|
||||
String primaryProfileDb = multiDBTransactionManager.getPrimaryConnection().getProfileName();
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(oldAccessToken)) {
|
||||
applicationEventPublisher.publishEvent(new TokenExpireEvent(primaryProfileDb, oldAccessToken));
|
||||
if (!disableExpiration) {
|
||||
String oldAccessToken = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), sql);
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(oldAccessToken)) {
|
||||
applicationEventPublisher.publishEvent(new TokenExpireEvent(primaryProfileDb, oldAccessToken));
|
||||
}
|
||||
}
|
||||
|
||||
// Ricreo token di accesso e refresh
|
||||
@@ -127,7 +131,8 @@ public class AuthService {
|
||||
password,
|
||||
foundUser.getKeyGroup(),
|
||||
primaryProfileDb,
|
||||
stbDevices.getId()
|
||||
stbDevices.getId(),
|
||||
disableExpiration
|
||||
);
|
||||
|
||||
applicationEventPublisher.publishEvent(new TokenCreateEvent(primaryProfileDb, stbAuthToken));
|
||||
@@ -139,6 +144,7 @@ public class AuthService {
|
||||
.setExpireIn(ChronoUnit.SECONDS.between(UtilityLocalDate.getNowTime(), stbAuthToken.getExpiryDate()));
|
||||
}
|
||||
|
||||
|
||||
public void logout(String profileDb, LogoutRequestDTO logoutRequestDTO) {
|
||||
|
||||
TokenExpireEvent tokenExpireEvent = new TokenExpireEvent(profileDb, logoutRequestDTO.getToken());
|
||||
|
||||
@@ -99,7 +99,8 @@ public class RefreshTokenService {
|
||||
user.getPassword(),
|
||||
user.getKeyGroup(),
|
||||
profileDb,
|
||||
stbAuthToken.getDeviceId());
|
||||
stbAuthToken.getDeviceId(),
|
||||
false);
|
||||
|
||||
applicationEventPublisher.publishEvent(new TokenCreateEvent(profileDb, newRefreshToken));
|
||||
|
||||
@@ -116,8 +117,10 @@ public class RefreshTokenService {
|
||||
}
|
||||
}
|
||||
|
||||
public StbAuthToken createRefreshTokenIfNotExists(String username, String password, Integer keyGroup, String profileDb, Long deviceId) throws Exception {
|
||||
LocalDateTime expiryDate = LocalDateTime.now().plusDays(settingsModel.getRefreshTokenExpireDays());
|
||||
public StbAuthToken createRefreshTokenIfNotExists(String username, String password, Integer keyGroup, String profileDb, Long deviceId, boolean disableExpiration) throws Exception {
|
||||
LocalDateTime expiryDate = disableExpiration ?
|
||||
LocalDateTime.of(2099, 12, 31, 23, 59) :
|
||||
LocalDateTime.now().plusDays(settingsModel.getRefreshTokenExpireDays());
|
||||
|
||||
if (deviceId == null)
|
||||
throw new Exception("Impossibile creare un refresh token");
|
||||
|
||||
@@ -37,7 +37,6 @@ then
|
||||
setCodVage(QueryRules.<String>getEntityData(dati.getCodVage(), $docT.getCodVage())),
|
||||
setCodVzon(QueryRules.<String>getEntityData(dati.getCodVzon(), $docT.getCodVzon())),
|
||||
setCodBanc(QueryRules.<String>getEntityData(dati.getCodBanc(), $docT.getCodBanc())),
|
||||
setCodPaga(QueryRules.<String>getEntityData(dati.getCodPaga(), $docT.getCodPaga())),
|
||||
setPorto(QueryRules.<String>getEntityData(dati.getPorto(), $docT.getPorto())),
|
||||
setMezzo(QueryRules.<String>getEntityData(dati.getMezzo(), $docT.getMezzo())),
|
||||
setSconto1(QueryRules.<BigDecimal>getEntityData(dati.getSconto1(), $docT.getSconto1())),
|
||||
@@ -51,6 +50,19 @@ then
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
rule "completeCodPagaTipoDocV"
|
||||
no-loop
|
||||
when
|
||||
eval(completeRulesEnabled)
|
||||
$docT : DtbDoct(gestione == "V" && dtbTipi != null && vtbClie != null && codPaga == null)
|
||||
then
|
||||
String codPaga = DocumentRules.getCodPagaDocV($docT);
|
||||
modify($docT){
|
||||
setCodPaga(codPaga)
|
||||
}
|
||||
end
|
||||
|
||||
rule "completeCodLinguaDocV"
|
||||
no-loop
|
||||
when
|
||||
|
||||
@@ -444,4 +444,15 @@ when
|
||||
$vtbDist : VtbDist(numCmov !=null && operation == OperationType.DELETE )
|
||||
then
|
||||
throw new CheckConstraintException("Non è possibile cancellare una distinta già registrata.");
|
||||
end
|
||||
end
|
||||
|
||||
rule "checkEmailAnag"
|
||||
no-loop
|
||||
when
|
||||
eval(checkRulesEnabled)
|
||||
$vtbCliePersRif : VtbCliePersRif (eMail !=null && operation != OperationType.DELETE )
|
||||
eval(!UtilityString.isEmail($vtbCliePersRif.geteMail()))
|
||||
then
|
||||
throw new CheckConstraintException(String.format("Attenzione! Email non valida per la persona di riferimento %s.",
|
||||
$vtbCliePersRif.getPersonaRif()));
|
||||
end
|
||||
|
||||
@@ -131,20 +131,23 @@ public class ActivityController {
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = EmsRestConstants.PATH_UPLOAD_STB_ACTIVITY_FILE_ATTACHMENT, method = RequestMethod.POST)
|
||||
@PostMapping(value = "uploadStbActivityFileAttachment")
|
||||
public ServiceRestResponse uploadStbActivityFileAttachment(@RequestParam(CommonConstants.PROFILE_DB) String config,
|
||||
@RequestParam() String activityId,
|
||||
@RequestPart() MultipartFile[] files) throws Exception {
|
||||
if (files == null || files.length == 0) {
|
||||
if (files == null || files.length == 0)
|
||||
throw new Exception("Nessun file è stato rilevato");
|
||||
}
|
||||
|
||||
StbActivity stbActivity = activityService.uploadAttachment(activityId, files);
|
||||
return ServiceRestResponse.createPositiveResponse(activityService.uploadAttachment(activityId, files));
|
||||
}
|
||||
|
||||
ServiceRestResponse serviceRestResponse = ServiceRestResponse.createPositiveResponse();
|
||||
serviceRestResponse.setEntityList(stbActivity.getStbActivityFile());
|
||||
@GetMapping(value = "activity/removeAttachment")
|
||||
public ServiceRestResponse removeAttachment(@RequestParam(CommonConstants.PROFILE_DB) String config,
|
||||
@RequestParam() String activityId,
|
||||
@RequestParam() String fileName) throws Exception {
|
||||
|
||||
return serviceRestResponse;
|
||||
activityService.removeAttachment(activityId, fileName);
|
||||
return ServiceRestResponse.createPositiveResponse();
|
||||
}
|
||||
|
||||
@RequestMapping(value = EmsRestConstants.PATH_ACTIVITY_GET_ACTIVITY, method = RequestMethod.GET)
|
||||
@@ -390,4 +393,13 @@ public class ActivityController {
|
||||
public ServiceRestResponse getAvgResolutionTime(@RequestParam(CommonConstants.PROFILE_DB) String config) throws Exception {
|
||||
return ServiceRestResponse.createPositiveResponse(activityService.getAvgResolutionTime());
|
||||
}
|
||||
|
||||
@RequestMapping(value = "activity/insertPublication", method = RequestMethod.POST)
|
||||
public ServiceRestResponse insertPublication(HttpServletRequest request,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String configuration,
|
||||
@RequestBody(required = false) ActivityPublicationDTO activityPublicationDTO) throws Exception {
|
||||
|
||||
activityService.insertPublication(activityPublicationDTO);
|
||||
return ServiceRestResponse.createPositiveResponse();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package it.integry.ems.activity.dto;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
public class ActivityPublicationDTO {private String activityId;
|
||||
private String activityDescription;
|
||||
private String projectDescription;
|
||||
private LocalDate dataPubblicazione;
|
||||
private List<String> commesse;
|
||||
|
||||
public String getActivityId() {
|
||||
return activityId;
|
||||
}
|
||||
|
||||
public ActivityPublicationDTO setActivityId(String activityId) {
|
||||
this.activityId = activityId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getActivityDescription() {
|
||||
return activityDescription;
|
||||
}
|
||||
|
||||
public ActivityPublicationDTO setActivityDescription(String activityDescription) {
|
||||
this.activityDescription = activityDescription;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getProjectDescription() {
|
||||
return projectDescription;
|
||||
}
|
||||
|
||||
public ActivityPublicationDTO setProjectDescription(String projectDescription) {
|
||||
this.projectDescription = projectDescription;
|
||||
return this;
|
||||
}
|
||||
|
||||
public LocalDate getDataPubblicazione() {
|
||||
return dataPubblicazione;
|
||||
}
|
||||
|
||||
public ActivityPublicationDTO setDataPubblicazione(LocalDate dataPubblicazione) {
|
||||
this.dataPubblicazione = dataPubblicazione;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<String> getCommesse() {
|
||||
return commesse;
|
||||
}
|
||||
|
||||
public ActivityPublicationDTO setCommesse(List<String> commesse) {
|
||||
this.commesse = commesse;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -127,12 +127,19 @@ public class ActivityService {
|
||||
}
|
||||
|
||||
public void removeAttachment(String activityId, String fileName) throws Exception {
|
||||
StbActivityFile activityFile = new StbActivityFile();
|
||||
if (activityId == null || fileName == null)
|
||||
throw new Exception("activityId e fileName sono obbligatori");
|
||||
|
||||
StbActivityFile activityFile = new StbActivityFile()
|
||||
.setId(activityId)
|
||||
.setFileName(fileName);
|
||||
activityFile.setOperation(OperationType.DELETE);
|
||||
activityFile.setId(activityId);
|
||||
activityFile.setFileName(fileName);
|
||||
entityProcessor.processEntity(activityFile, multiDBTransactionManager);
|
||||
multiDBTransactionManager.commitAll();
|
||||
|
||||
StbActivity stbActivity = new StbActivity().setActivityId(activityId);
|
||||
stbActivity.getStbActivityFile().add(activityFile);
|
||||
stbActivity.setOperation(OperationType.NO_OP);
|
||||
|
||||
entityProcessor.processEntity(stbActivity, multiDBTransactionManager);
|
||||
}
|
||||
|
||||
public List<AttivitaDTO> save(List<AttivitaDTO> listAttivita) throws Exception {
|
||||
@@ -487,10 +494,12 @@ public class ActivityService {
|
||||
|
||||
String activityId = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), sql);
|
||||
|
||||
long seconds = (long) (stbActivity.getOreRapportino().floatValue() * 60L * 60L);
|
||||
long minuti = (long) (stbActivity.getOreRapportino().floatValue() * 60L);
|
||||
|
||||
if (stbActivity.getEffectiveTime() != null) {
|
||||
stbActivity.setEffectiveEndtime(stbActivity.getEffectiveTime().plusSeconds(seconds));
|
||||
stbActivity.setEffectiveEndtime(stbActivity.getEffectiveTime().plusMinutes(minuti));
|
||||
} else {
|
||||
stbActivity.setEffectiveTime(stbActivity.getEffectiveEndtime().minusMinutes(minuti));
|
||||
}
|
||||
|
||||
if (UtilityString.isNullOrEmpty(activityId)) {
|
||||
@@ -755,6 +764,33 @@ public class ActivityService {
|
||||
}
|
||||
}
|
||||
|
||||
public void insertPublication(ActivityPublicationDTO activityPublicationDTO) throws Exception {
|
||||
List<StbActivityPublications> publications = new ArrayList<>();
|
||||
if (UtilityString.isNullOrEmpty(activityPublicationDTO.getActivityDescription()))
|
||||
throw new Exception("La descrizione personalizzata dell'attività non può essere vuota");
|
||||
if (UtilityString.isNullOrEmpty(activityPublicationDTO.getProjectDescription()))
|
||||
throw new Exception("La descrizione personalizzata del progetto non può essere vuota");
|
||||
|
||||
if (activityPublicationDTO.getCommesse() == null || activityPublicationDTO.getCommesse().isEmpty())
|
||||
throw new Exception("Deve essere selezionata almeno una commessa per la pubblicazione");
|
||||
|
||||
if (activityPublicationDTO.getDataPubblicazione() == null)
|
||||
throw new Exception("La data di pubblicazione non può essere vuota");
|
||||
|
||||
for(String codJcom: activityPublicationDTO.getCommesse()){
|
||||
StbActivityPublications publication = new StbActivityPublications()
|
||||
.setActivityId(activityPublicationDTO.getActivityId())
|
||||
.setCodJcom(codJcom)
|
||||
.setDataPub(activityPublicationDTO.getDataPubblicazione())
|
||||
.setCustomActivityDescription(activityPublicationDTO.getActivityDescription())
|
||||
.setCustomProjectDescription(activityPublicationDTO.getProjectDescription());
|
||||
publication.setOperation(OperationType.INSERT);
|
||||
publications.add(publication);
|
||||
}
|
||||
|
||||
UtilityEntity.throwEntitiesException(entityProcessor.processEntityList(publications, true));
|
||||
}
|
||||
|
||||
public ActivityDTO changeCodJcom(String activityId, String codJcom, String parentActivityId) throws Exception {
|
||||
String sql =
|
||||
Query.format("SELECT cod_jcom FROM stb_activity WHERE activity_id = %s", activityId);
|
||||
@@ -952,14 +988,14 @@ public class ActivityService {
|
||||
" ELSE 5 /*completata*/ END AS stato_attivita,\n" +
|
||||
" CAST(ISNULL(integry_tag.is_bug, 0) AS BIT) AS is_bug,\n" +
|
||||
" integry_tag.tags,\n" +
|
||||
" DENSE_RANK() OVER (ORDER BY parent.project_description, parent.activity_description) AS 'id_processo',\n" +
|
||||
" DENSE_RANK() OVER (ORDER BY parent.project_description, parent.activity_description) AS id_processo,\n" +
|
||||
" gtb_anag.rag_soc,\n " +
|
||||
" task.dapagare AS da_pagare,\n " +
|
||||
" task.acanone AS a_canone\n ";
|
||||
if (daInstallare) {
|
||||
sql += ", lastUpdt.data AS 'ultimo_aggiornamento'\n";
|
||||
sql += ", CAST(lastUpdt.data AS DATETIME) AS ultimo_aggiornamento\n";
|
||||
} else {
|
||||
sql += ", null AS 'ultimo_aggiornamento'\n";
|
||||
sql += ", CAST(NULL AS DATETIME) AS ultimo_aggiornamento\n";
|
||||
}
|
||||
sql += " FROM stb_activity\n" +
|
||||
" INNER JOIN stb_user ON stb_activity.user_name = stb_user.user_name\n" +
|
||||
@@ -967,12 +1003,12 @@ public class ActivityService {
|
||||
" LEFT OUTER JOIN pvw_clienti_prospect gtb_anag on stb_activity.cod_anag = gtb_anag.cod_ppro and stb_activity.tipo_anag = gtb_anag.tipologia\n" +
|
||||
" AND gtb_anag.flag_stato = 'A'\n" +
|
||||
" LEFT OUTER JOIN mtb_aart ON stb_activity.cod_mart = mtb_aart.cod_mart\n" +
|
||||
" LEFT OUTER JOIN (SELECT parent.activity_description AS 'project_description',\n" +
|
||||
" stb_activity.activity_description AS 'activity_description',\n" +
|
||||
" LEFT OUTER JOIN (SELECT parent.activity_description AS project_description,\n" +
|
||||
" stb_activity.activity_description AS activity_description,\n" +
|
||||
" stb_activity.activity_id,\n" +
|
||||
" stb_activity.user_name,\n" +
|
||||
" stb_activity.activity_type_id,\n" +
|
||||
" stb_activity.persona_rif AS 'responabile_progetto'\n" +
|
||||
" stb_activity.persona_rif AS responabile_progetto\n" +
|
||||
" FROM stb_activity\n" +
|
||||
" LEFT OUTER JOIN stb_activity parent\n" +
|
||||
" ON stb_activity.parent_activity_id = parent.activity_id\n" +
|
||||
@@ -2095,6 +2131,7 @@ public class ActivityService {
|
||||
" FROM stb_activity p\n" +
|
||||
" INNER JOIN jtb_comt ON jtb_comt.cod_jcom = p.cod_jcom\n" +
|
||||
" WHERE stato_commessa IN ('IN CORSO', 'POST VENDITA', 'TRATTATIVA')\n" +
|
||||
" AND jtb_comt.cod_jcom NOT LIKE 'integry%'\n" +
|
||||
" AND activity_type_id = 'ticket'\n" +
|
||||
"),\n" +
|
||||
"figlie AS (\n" +
|
||||
|
||||
@@ -1,18 +1,20 @@
|
||||
package it.integry.ems.document.farm_mes.dto;
|
||||
|
||||
import it.integry.ems.adapter.XmlDateAdapter;
|
||||
import it.integry.ems.adapter.XmlLocalDateTimeAdapter;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
|
||||
@XmlRootElement(name = "NOTE_PRODUTTIVE")
|
||||
public class NoteProduttive {
|
||||
private Date dataOrd;
|
||||
private LocalDate dataNota;
|
||||
private LocalDateTime dataNota;
|
||||
int numOrd;
|
||||
String gestione, note;
|
||||
|
||||
@@ -26,13 +28,13 @@ public class NoteProduttive {
|
||||
this.dataOrd = dataOrd;
|
||||
}
|
||||
|
||||
public LocalDate getDataNota() {
|
||||
public LocalDateTime getDataNota() {
|
||||
return dataNota;
|
||||
}
|
||||
|
||||
@XmlElement(name = "DATA_NOTA")
|
||||
@XmlJavaTypeAdapter(XmlDateAdapter.class)
|
||||
public void setDataNota(LocalDate dataNota) {
|
||||
@XmlJavaTypeAdapter(XmlLocalDateTimeAdapter.class)
|
||||
public void setDataNota(LocalDateTime dataNota) {
|
||||
this.dataNota = dataNota;
|
||||
}
|
||||
|
||||
|
||||
@@ -853,7 +853,7 @@ public class FarmMesImportService {
|
||||
ldt_dataOrd = noteProduttive.getDataOrd();
|
||||
numOrd = noteProduttive.getNumOrd();
|
||||
noteProd = noteProduttive.getNote();
|
||||
dataNota = noteProduttive.getDataNota().atStartOfDay();
|
||||
dataNota = noteProduttive.getDataNota();
|
||||
|
||||
// ACQUISIZIONE DATI ORDINE
|
||||
sql =
|
||||
|
||||
@@ -58,6 +58,18 @@ public class ProductionWarehouseService {
|
||||
rettificaDto.getNewQtaCol(),
|
||||
true,
|
||||
true));
|
||||
|
||||
if (rettifica == null) {
|
||||
throw new Exception(String.format(
|
||||
"Nessuna rettifica da effettuare per articolo %s, qta collo da %f a %f, num cnf da %f a %f",
|
||||
rettificaDto.getSourceMtbColr().getCodMart(),
|
||||
rettificaDto.getSourceMtbColr().getQtaCol(),
|
||||
rettificaDto.getNewQtaCol(),
|
||||
rettificaDto.getSourceMtbColr().getNumCnf(),
|
||||
rettificaDto.getNewNumCnf()
|
||||
));
|
||||
}
|
||||
|
||||
MtbColt testata = new MtbColt();
|
||||
testata.setNumCollo(rettifica.getNumCollo());
|
||||
testata.setDataCollo(rettifica.getDataCollo());
|
||||
|
||||
@@ -829,72 +829,95 @@ public class VariazioniPvService {
|
||||
queryAssortimento =
|
||||
"WITH componenti AS (SELECT cod_mart, cod_mart AS cod_comp\n" +
|
||||
" FROM mtb_aart\n" +
|
||||
" WHERE articolo_composto = 'N'\n" +
|
||||
" UNION ALL\n" +
|
||||
" SELECT mtb_comp.cod_mart, cod_comp\n" +
|
||||
" FROM mtb_comp\n" +
|
||||
" INNER JOIN mtb_aart ON mtb_comp.cod_mart = mtb_aart.cod_mart AND articolo_composto = 'S'),\n" +
|
||||
" doc AS (SELECT wdtb_doct.data_reg,\n" +
|
||||
" FROM mtb_comp),\n" +
|
||||
" doc AS (SELECT avw_last_acq_lotto_w.data_reg,\n" +
|
||||
" componenti.cod_comp AS cod_mart,\n" +
|
||||
" wdtb_docr.partita_mag,\n" +
|
||||
" wdtb_doct.cod_mdep,\n" +
|
||||
" wdtb_doct.data_ins\n" +
|
||||
" FROM wdtb_doct\n" +
|
||||
" INNER JOIN wdtb_docr ON wdtb_doct.cod_anag = wdtb_docr.cod_anag AND\n" +
|
||||
" wdtb_doct.cod_dtip = wdtb_docr.cod_dtip AND\n" +
|
||||
" wdtb_doct.data_doc = wdtb_docr.data_doc AND\n" +
|
||||
" wdtb_doct.ser_doc = wdtb_docr.ser_doc AND\n" +
|
||||
" wdtb_doct.num_doc = wdtb_docr.num_doc\n" +
|
||||
" INNER JOIN componenti ON wdtb_docr.cod_mart = componenti.cod_mart\n" +
|
||||
" avw_last_acq_lotto_w.partita_mag,\n" +
|
||||
" avw_last_acq_lotto_w.cod_mdep,\n" +
|
||||
" avw_last_acq_lotto_w.data_ins,\n" +
|
||||
" avw_last_acq_lotto_w.cod_vlis\n" +
|
||||
" FROM avw_last_acq_lotto_w\n" +
|
||||
" INNER JOIN componenti ON avw_last_acq_lotto_w.cod_mart = componenti.cod_mart\n" +
|
||||
" WHERE avw_last_acq_lotto_w.cod_vlis = '[COD_VLIS]'\n" +
|
||||
" UNION ALL\n" +
|
||||
" SELECT dtb_doct.data_reg,\n" +
|
||||
" SELECT avw_last_acq_lotto.data_reg,\n" +
|
||||
" componenti.cod_comp AS cod_mart,\n" +
|
||||
" dtb_docr.partita_mag,\n" +
|
||||
" dtb_doct.cod_mdep,\n" +
|
||||
" dtb_doct.data_ins\n" +
|
||||
" FROM dtb_doct\n" +
|
||||
" INNER JOIN dtb_docr\n" +
|
||||
" ON dtb_doct.cod_anag = dtb_docr.cod_anag AND dtb_doct.cod_dtip = dtb_docr.cod_dtip AND\n" +
|
||||
" dtb_doct.data_doc = dtb_docr.data_doc AND dtb_doct.ser_doc = dtb_docr.ser_doc AND\n" +
|
||||
" dtb_doct.num_doc = dtb_docr.num_doc\n" +
|
||||
" INNER JOIN dtb_tipi ON dtb_doct.cod_dtip = dtb_docr.cod_dtip\n" +
|
||||
" INNER JOIN componenti ON dtb_docr.cod_mart = componenti.cod_mart\n" +
|
||||
" WHERE dtb_tipi.gestione = 'A'\n" +
|
||||
" AND dtb_tipi.tipo_emissione = 'DIRETTA'\n" +
|
||||
" AND dtb_tipi.segno_qta_car = 1\n" +
|
||||
" AND flag_chk_tracciabilita = 1),\n" +
|
||||
" last_doc AS (SELECT mtb_depo.cod_vlis,\n" +
|
||||
" kit.cod_comp AS cod_mart,\n" +
|
||||
" doc.partita_mag,\n" +
|
||||
" DENSE_RANK() OVER (PARTITION BY kit.cod_comp ORDER BY doc.data_ins DESC ) AS ord\n" +
|
||||
" FROM doc\n" +
|
||||
" INNER JOIN (SELECT cod_mart, cod_mart AS cod_comp\n" +
|
||||
" FROM mtb_aart\n" +
|
||||
" UNION ALL\n" +
|
||||
" SELECT cod_mart, cod_comp\n" +
|
||||
" FROM mtb_comp\n" +
|
||||
" UNION ALL\n" +
|
||||
" SELECT cod_comp, cod_mart\n" +
|
||||
" FROM mtb_comp) kit ON doc.cod_mart = kit.cod_mart\n" +
|
||||
" INNER JOIN mtb_depo ON doc.cod_mdep = mtb_depo.cod_mdep\n" +
|
||||
" WHERE CAST(doc.data_ins AS DATE) BETWEEN DATEADD(DD, -8, '[DATA_VALIDITA]') AND DATEADD(DD, -1, '[DATA_VALIDITA]')\n" +
|
||||
" AND doc.partita_mag IS NOT NULL\n" +
|
||||
" AND mtb_depo.cod_vlis = '[COD_VLIS]'\n" +
|
||||
" avw_last_acq_lotto.partita_mag,\n" +
|
||||
" avw_last_acq_lotto.cod_mdep,\n" +
|
||||
" avw_last_acq_lotto.data_ins,\n" +
|
||||
" avw_last_acq_lotto.cod_vlis\n" +
|
||||
" FROM avw_last_acq_lotto\n" +
|
||||
" INNER JOIN componenti ON avw_last_acq_lotto.cod_mart = componenti.cod_mart\n" +
|
||||
" WHERE avw_last_acq_lotto.cod_vlis = '[COD_VLIS]')\n" +
|
||||
" ,\n" +
|
||||
" max_doc AS (SELECT cod_mart,\n" +
|
||||
" cod_mdep,\n" +
|
||||
" MAX(data_ins) AS last_ins\n" +
|
||||
" FROM doc\n" +
|
||||
" WHERE data_reg <= '2025/10/14'\n" +
|
||||
" GROUP BY cod_mdep, cod_mart),\n" +
|
||||
" last_doc_tot AS (SELECT doc.*\n" +
|
||||
" FROM max_doc\n" +
|
||||
" INNER JOIN doc ON doc.cod_mdep = max_doc.cod_mdep\n" +
|
||||
" AND doc.cod_mart = max_doc.cod_mart\n" +
|
||||
" AND doc.data_ins = max_doc.last_ins)\n" +
|
||||
" ,\n" +
|
||||
" last_doc AS (SELECT *\n" +
|
||||
" FROM last_doc_tot\n" +
|
||||
" WHERE CAST(last_doc_tot.data_ins AS DATE) BETWEEN DATEADD(DD, -8, '[DATA_VALIDITA]') AND DATEADD(DD, -1, '[DATA_VALIDITA]')\n" +
|
||||
" AND NOT EXISTS (SELECT *\n" +
|
||||
" FROM doc d\n" +
|
||||
" WHERE d.data_ins < DATEADD(DD, -1, '[DATA_VALIDITA]')\n" +
|
||||
" AND d.data_reg > doc.data_reg\n" +
|
||||
" AND d.cod_mart = doc.cod_mart\n" +
|
||||
" AND d.cod_mdep = doc.cod_mdep)),\n" +
|
||||
" AND d.data_reg > last_doc_tot.data_reg\n" +
|
||||
" AND d.cod_mart = last_doc_tot.cod_mart\n" +
|
||||
" AND d.cod_mdep = last_doc_tot.cod_mdep)),\n" +
|
||||
" last_doc_kit AS (SELECT last_doc.data_reg,\n" +
|
||||
" last_doc.cod_mart,\n" +
|
||||
" last_doc.partita_mag,\n" +
|
||||
" last_doc.cod_mdep,\n" +
|
||||
" last_doc.data_ins,\n" +
|
||||
" last_doc.cod_vlis\n" +
|
||||
" FROM last_doc\n" +
|
||||
" UNION\n" +
|
||||
" SELECT last_doc.data_reg,\n" +
|
||||
" mtb_comp.cod_comp,\n" +
|
||||
" last_doc.partita_mag,\n" +
|
||||
" last_doc.cod_mdep,\n" +
|
||||
" last_doc.data_ins,\n" +
|
||||
" last_doc.cod_vlis\n" +
|
||||
" FROM last_doc\n" +
|
||||
" INNER JOIN mtb_comp ON last_doc.cod_mart = mtb_comp.cod_mart\n" +
|
||||
" UNION\n" +
|
||||
" SELECT last_doc.data_reg,\n" +
|
||||
" last_doc.cod_mart,\n" +
|
||||
" last_doc.partita_mag,\n" +
|
||||
" last_doc.cod_mdep,\n" +
|
||||
" last_doc.data_ins,\n" +
|
||||
" last_doc.cod_vlis\n" +
|
||||
" FROM last_doc\n" +
|
||||
" UNION\n" +
|
||||
" SELECT last_doc.data_reg,\n" +
|
||||
" mtb_comp.cod_mart,\n" +
|
||||
" STUFF((SELECT DISTINCT '-' + partita_mag\n" +
|
||||
" FROM mtb_comp kit\n" +
|
||||
" INNER JOIN last_doc_tot doc ON kit.cod_comp = doc.cod_mart AND\n" +
|
||||
" doc.cod_mdep = '[COD_VLIS]'\n" +
|
||||
" WHERE kit.cod_mart = mtb_comp.cod_mart\n" +
|
||||
" FOR XML PATH(''), TYPE).value('.', 'NVARCHAR(MAX)'), 1, 1, '') AS partita_mag,\n" +
|
||||
" last_doc.cod_mdep,\n" +
|
||||
" last_doc.data_ins,\n" +
|
||||
" last_doc.cod_vlis\n" +
|
||||
" FROM mtb_comp\n" +
|
||||
" INNER JOIN last_doc ON mtb_comp.cod_comp = last_doc.cod_mart),\n" +
|
||||
" tmp_assortimento AS (SELECT cod_vlis,\n" +
|
||||
" doc.cod_mart,\n" +
|
||||
" 'A' AS tipo_variazione,\n" +
|
||||
" CONVERT(VARCHAR(15), NULL) AS cod_mart_view,\n" +
|
||||
" 'N' AS 'fine_promo',\n" +
|
||||
" CONVERT(VARCHAR(25), doc.partita_mag) AS lotto\n" +
|
||||
" FROM last_doc doc\n" +
|
||||
" INNER JOIN mtb_aart ON doc.cod_mart = mtb_aart.cod_mart\n" +
|
||||
" WHERE doc.ord = 1)\n";
|
||||
" FROM last_doc_kit doc)\n";
|
||||
|
||||
queryAssortimento =
|
||||
queryAssortimento
|
||||
|
||||
@@ -226,7 +226,7 @@ public class MmposServices {
|
||||
} else if (!flagTrans.equalsIgnoreCase("CS") &&
|
||||
"C".equals(flagTrans.substring(0, 1)) || "R".equals(flagTrans.substring(0, 1))) {
|
||||
List<NtbDocr> ntbDocr;
|
||||
if ( row.getFlTrans().equalsIgnoreCase("CX") && row.getOpTrans().equalsIgnoreCase("ST"))
|
||||
if (row.getFlTrans().equalsIgnoreCase("CX") && row.getOpTrans().equalsIgnoreCase("ST"))
|
||||
continue;
|
||||
|
||||
ntbDocr = getRow(row, multiDBTransactionManager.getPrimaryConnection(), impostaDatiOrdine, impostaKit, mmpos.getPrimaryConnection(), elencoPromozioni);
|
||||
@@ -446,7 +446,7 @@ public class MmposServices {
|
||||
}
|
||||
ntbDocr.setPrzUntIva(przUnt);
|
||||
boolean isStorno = false;
|
||||
if (!UtilityString.isNullOrEmpty(row.getKeysRef()) && row.getParam1() != null) {
|
||||
if (row.getParam1() != null) {
|
||||
isStorno = true;
|
||||
try {
|
||||
if (Integer.parseInt(row.getParam1()) != 0) {
|
||||
@@ -454,6 +454,7 @@ public class MmposServices {
|
||||
BigDecimal valsco = row.getPrezzo().subtract(
|
||||
row.getPrezzoNetto().divide(param1, 5, RoundingMode.HALF_UP).multiply(row.getQuantita()));
|
||||
ntbDocr.setValSco(valsco);
|
||||
|
||||
} else {
|
||||
ntbDocr.setValSco(BigDecimal.ZERO);
|
||||
}
|
||||
|
||||
@@ -175,7 +175,7 @@ public class ScontriniZucchettiExportServices {
|
||||
|
||||
|
||||
if ( !dati.isEmpty()) {
|
||||
String fileName = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()) + ".csv";
|
||||
String fileName = "Forecast_" + new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()) + ".csv";
|
||||
File file = new File(fileName);
|
||||
|
||||
CsvMapper<ZucchettiHrDTO> mapper = new CsvMapper<>();
|
||||
|
||||
@@ -204,7 +204,7 @@ public class RecuperoScontriniService {
|
||||
String pathFile = setup.get("PATH_FILE");
|
||||
String profileDb = setup.get("PROFILE_DB");
|
||||
|
||||
String dataString = UtilityLocalDate.formatDate(dataIniz, CommonConstants.DATE_FORMAT_YMD);
|
||||
String dataString = UtilityLocalDate.formatDate(dataIniz, "yyyy/MM/dd");
|
||||
List<String> rows = new ArrayList<>();
|
||||
String rowFile = profileDb + CommonConstants.TAB +
|
||||
codMdep + CommonConstants.TAB +
|
||||
@@ -218,7 +218,8 @@ public class RecuperoScontriniService {
|
||||
|
||||
if (maxIdScontrList.size() > 0) {
|
||||
rows.addAll(
|
||||
listScontrini.stream().map(x -> String.format(rowFile, ">" + x)).collect(Collectors.toList()));
|
||||
maxIdScontrList.stream().map(x ->
|
||||
String.format(rowFile, ">" + x.get("max_id_scontr") )).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
//Salvare il file
|
||||
|
||||
@@ -14,6 +14,9 @@ public class ArticoloDTO {
|
||||
@SqlField("mtb_aart.descrizione")
|
||||
private String descrizione;
|
||||
|
||||
@SqlField("CONCAT(mtb_aart.cod_mart, ' - ', mtb_aart.descrizione)")
|
||||
private String articolo;
|
||||
|
||||
@SqlField("mtb_aart.unt_mis")
|
||||
private String untMis;
|
||||
|
||||
@@ -84,6 +87,15 @@ public class ArticoloDTO {
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getArticolo() {
|
||||
return articolo;
|
||||
}
|
||||
|
||||
public ArticoloDTO setArticolo(String articolo) {
|
||||
this.articolo = articolo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getUntMis() {
|
||||
return untMis;
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -97,34 +98,42 @@ public class WMSArticoloService {
|
||||
|
||||
|
||||
public RetrieveArticoloResponseDTO retrieveArts(FilterDTO filter, int page, int pageSize ) throws Exception {
|
||||
|
||||
|
||||
String query = "SELECT mtb_aart.cod_mart AS [mtb_aart.cod_mart], " +
|
||||
" mtb_aart.descrizione AS [mtb_aart.descrizione], " +
|
||||
" mtb_aart.descrizione_estesa AS [mtb_aart.descrizione_estesa], " +
|
||||
" mtb_aart.unt_mis AS [mtb_aart.unt_mis], " +
|
||||
" mtb_aart.cod_mgrp AS [mtb_aart.cod_mgrp], " +
|
||||
" mtb_aart.cod_msgr AS [mtb_aart.cod_msgr], " +
|
||||
" mtb_aart.cod_msfa AS [mtb_aart.cod_msfa], " +
|
||||
" mtb_aart.qta_cnf AS [mtb_aart.qta_cnf], " +
|
||||
" mtb_aart.cod_aliq AS [mtb_aart.cod_aliq], " +
|
||||
" mtb_aart.posizione AS [posizione], " +
|
||||
" bar_code AS [barcode], " +
|
||||
" cod_barre_imb AS [cod_barre_imb], " +
|
||||
" mtb_grup.descrizione AS [mtb_grup.descrizione], " +
|
||||
" mtb_sgrp.descrizione AS [mtb_sgrp.descrizione], " +
|
||||
" mtb_sfam.descrizione AS [mtb_sfam.descrizione] " +
|
||||
"FROM mtb_aart " +
|
||||
" INNER JOIN mtb_grup ON mtb_aart.cod_mgrp = mtb_grup.cod_mgrp " +
|
||||
" LEFT OUTER JOIN mtb_sgrp ON mtb_aart.cod_mgrp = mtb_sgrp.cod_mgrp AND mtb_aart.cod_msgr = mtb_sgrp.cod_msgr " +
|
||||
" LEFT OUTER JOIN mtb_sfam ON mtb_aart.cod_mgrp = mtb_sfam.cod_mgrp AND mtb_aart.cod_msgr = mtb_sfam.cod_msgr AND " +
|
||||
" mtb_aart.cod_msfa = mtb_sfam.cod_msfa ";
|
||||
String query = String.format(
|
||||
"SELECT mtb_aart.cod_mart AS [mtb_aart.cod_mart], " +
|
||||
" mtb_aart.descrizione AS [mtb_aart.descrizione], " +
|
||||
" CONCAT(mtb_aart.cod_mart, ' - ', mtb_aart.descrizione) AS [CONCAT(mtb_aart.cod_mart, ' - ', mtb_aart.descrizione)], " +
|
||||
" mtb_aart.descrizione_estesa AS [mtb_aart.descrizione_estesa], " +
|
||||
" mtb_aart.unt_mis AS [mtb_aart.unt_mis], " +
|
||||
" mtb_aart.cod_mgrp AS [mtb_aart.cod_mgrp], " +
|
||||
" mtb_aart.cod_msgr AS [mtb_aart.cod_msgr], " +
|
||||
" mtb_aart.cod_msfa AS [mtb_aart.cod_msfa], " +
|
||||
" mtb_aart.qta_cnf AS [mtb_aart.qta_cnf], " +
|
||||
" mtb_aart.cod_aliq AS [mtb_aart.cod_aliq], " +
|
||||
" mtb_aart.posizione AS [posizione], " +
|
||||
" bar_code AS [barcode], " +
|
||||
" cod_barre_imb AS [cod_barre_imb], " +
|
||||
" mtb_grup.descrizione AS [mtb_grup.descrizione], " +
|
||||
" mtb_sgrp.descrizione AS [mtb_sgrp.descrizione], " +
|
||||
" mtb_sfam.descrizione AS [mtb_sfam.descrizione] " +
|
||||
"FROM mtb_aart " +
|
||||
" INNER JOIN mtb_grup ON mtb_aart.cod_mgrp = mtb_grup.cod_mgrp " +
|
||||
" LEFT OUTER JOIN mtb_sgrp ON mtb_aart.cod_mgrp = mtb_sgrp.cod_mgrp AND mtb_aart.cod_msgr = mtb_sgrp.cod_msgr " +
|
||||
" LEFT OUTER JOIN mtb_sfam ON mtb_aart.cod_mgrp = mtb_sfam.cod_mgrp AND mtb_aart.cod_msgr = mtb_sfam.cod_msgr AND " +
|
||||
" mtb_aart.cod_msfa = mtb_sfam.cod_msfa " +
|
||||
"WHERE (mtb_grup.tipo_mgrp IS NULL OR mtb_grup.tipo_mgrp NOT IN (%s))",
|
||||
UtilityDB.listValueToString(Arrays.asList(
|
||||
MtbGrup.TipoGruppo.ACCONTI_SCONTI.getValue(),
|
||||
MtbGrup.TipoGruppo.FITTIZIO.getValue(),
|
||||
MtbGrup.TipoGruppo.MATERIALE_ACCESSORI.getValue(),
|
||||
MtbGrup.TipoGruppo.SERVIZI.getValue()
|
||||
))
|
||||
);
|
||||
|
||||
if (filter != null && filter.getFilters().length > 0) {
|
||||
UtilityFilter.convertFilterDtoFieldsToSqlFields(filter, ArticoloDTO.class);
|
||||
|
||||
String filterString = UtilityFilter.processFilters(filter);
|
||||
query += " WHERE " + filterString;
|
||||
query += " AND " + filterString;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -675,6 +675,9 @@ public class SystemController {
|
||||
activity.setActivityTypeId("TICKET");
|
||||
}
|
||||
|
||||
if (activity.getParentActivityId() == null)
|
||||
throw new Exception( "Attenzione, 'parentActivityId' obbligatorio");
|
||||
|
||||
activity.setActivityDescription(HtmlUtils.htmlUnescape(activity.getActivityDescription()));
|
||||
|
||||
String notificationType;
|
||||
|
||||
@@ -332,17 +332,23 @@ public class SystemService {
|
||||
}
|
||||
|
||||
for (String profile : profiles) {
|
||||
UserDTO foundUserTmp = null;
|
||||
|
||||
String dbName = settingsModel.getDbNameFromProfileDb(profile);
|
||||
|
||||
//MD5 utilizzato da Ordikids
|
||||
//MD5 utilizzato da Ordikids e Farmmes
|
||||
if (UtilityString.isNullOrEmpty(password) && !UtilityString.isNullOrEmpty(md5User)) {
|
||||
foundUser = userCacheService.retrieveUser(dbName, md5User);
|
||||
foundUserTmp = userCacheService.retrieveUser(dbName, md5User);
|
||||
} else
|
||||
foundUser = userCacheService.retrieveUser(dbName, username, password, requestDataDTO.getApplication());
|
||||
foundUserTmp = userCacheService.retrieveUser(dbName, username, password, requestDataDTO.getApplication());
|
||||
|
||||
if (foundUser == null || !foundUser.isAttivo())
|
||||
if (foundUserTmp == null || !foundUserTmp.isAttivo())
|
||||
continue;
|
||||
|
||||
if (foundUser == null) {
|
||||
foundUser = foundUserTmp;
|
||||
}
|
||||
|
||||
if (!foundUser.getAvailableProfiles().contains(profile)) {
|
||||
foundUser.getAvailableProfiles().add(profile);
|
||||
}
|
||||
@@ -351,7 +357,7 @@ public class SystemService {
|
||||
|
||||
if (foundUser == null) {
|
||||
logger.error(String.format("Credenziali non valide utente: %s ( %s) ",
|
||||
username, multiDBTransactionManager.getPrimaryConnection().getCatalog() + " )"));
|
||||
UtilityString.isNull(username,md5User), UtilityString.isNull(profileDB,multiDBTransactionManager.getPrimaryConnection().getCatalog()) + " )"));
|
||||
throw new Exception("Credenziali non valide");
|
||||
} else if (!foundUser.isAttivo()) {
|
||||
throw new Exception("Utente non attivo");
|
||||
|
||||
Reference in New Issue
Block a user