Merge branch 'hotfix/Hotfix-1' into develop
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good

This commit is contained in:
2025-10-02 12:18:08 +02:00
2 changed files with 112 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
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;
import it.integry.ems_model.entity.JtbFasi;
public class Migration_20251002111947 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
createSetup("MES", "SETUP", "VINCOLA_DATA_PROD_AL_LOTTO", "N", "Se true, sulle linee su cui è impostata la data produzione della partita verrà calcolata in base alla partita stessa (es. dal giorno giuliano selezionato)", false, "SI_NO", false, false, false, false, false, JtbFasi.ENTITY, false, null);
if (isCustomer(IntegryCustomer.RossoGargano)){
executeStatement("INSERT INTO stb_gest_setup_det (gest_name, section, key_section, tipo_setup, val_col_rif, value)\n" +
"SELECT N'MES',\n" +
" N'SETUP',\n" +
" N'VINCOLA_DATA_PROD_AL_LOTTO',\n" +
" N'" + JtbFasi.ENTITY + "',\n" +
" cod_jfas,\n" +
" 'S'\n" +
"FROM jtb_fasi\n" +
"WHERE cod_jfas IN ('E5')\n");
}
}
@Override
public void down() throws Exception {
}
}

View File

@@ -0,0 +1,79 @@
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_20251002112352 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
createOrUpdateFunction("f_suggestDataProdPartitaMag","CREATE FUNCTION [dbo].[f_suggestDataProdPartitaMag](@codMart VARCHAR(15),@partitaMag VARCHAR(20), @codJfas varchar(5))\n" +
" RETURNS DATE\n" +
"AS\n" +
"BEGIN\n" +
"\n" +
"RETURN NULL\n" +
"END\n"
);
if (isCustomer(IntegryCustomer.RossoGargano)){
createOrUpdateFunction("f_suggestDataProdPartitaMag","CREATE FUNCTION [dbo].[f_suggestDataProdPartitaMag](@codMart VARCHAR(15), @partitaMag VARCHAR(20), @codJfas varchar(5))\n" +
" RETURNS DATE\n" +
" AS\n" +
" BEGIN\n" +
"\n" +
" DECLARE @idProduttore VARCHAR(10), @idProduttorePartita varchar(10);\n" +
" DECLARE @idLottoLav VARCHAR(5);\n" +
" DECLARE @codMdep VARCHAR(5);\n" +
" DECLARE @annoLottoLav smallint;\n" +
" DECLARE @ggGiuliano smallint;\n" +
" DECLARE @dataProd date;\n" +
"\n" +
"\n" +
" SELECT @codMdep = cod_mdep_lav from jtb_fasi where cod_jfas = @codJfas;\n" +
"\n" +
" SELECT @idProduttore = ISNULL(stb_gest_setup_depo.value, stb_gest_setup.value)\n" +
" FROM stb_gest_setup\n" +
" LEFT OUTER JOIN stb_gest_setup_depo ON stb_gest_setup.gest_name = stb_gest_setup_depo.gest_name AND\n" +
" stb_gest_setup.section = stb_gest_setup_depo.section AND\n" +
" stb_gest_setup.key_section = stb_gest_setup_depo.key_section\n" +
" AND stb_gest_setup_depo.cod_mdep = @codMdep\n" +
" WHERE stb_gest_setup.gest_name = 'DATI_AZIENDA'\n" +
" AND stb_gest_setup.section = 'SETUP'\n" +
" AND stb_gest_setup.key_section = 'COD_PRODUTTORE';\n" +
"\n" +
"\n" +
" SELECT @idProduttorePartita = SUBSTRING(@partitaMag, 1, LEN(@idProduttore));\n" +
"\n" +
" if not @idProduttorePartita = @idProduttore\n" +
" return null;\n" +
"\n" +
" select @partitaMag = REPLACE(@partitaMag, @idProduttore, '');\n" +
"\n" +
"\n" +
" SELECT @idLottoLav = SUBSTRING(@partitaMag, 1, 1);\n" +
" SELECT @annoLottoLav = anno from gtb_anni_divi where id_lotto_lav = @idLottoLav;\n" +
"\n" +
" if @annoLottoLav is null\n" +
" return null;\n" +
"\n" +
" SELECT @ggGiuliano = SUBSTRING(@partitaMag, 2, 3);\n" +
"\n" +
"\n" +
"\n" +
" SELECT @dataProd = DATEADD(DAY, @ggGiuliano - 1, DATEFROMPARTS(@annoLottoLav, 1, 1));\n" +
" return @dataProd\n" +
"\n" +
" END\n");
}
}
@Override
public void down() throws Exception {
}
}