diff --git a/ems-core/src/main/java/it/integry/ems/migration/model/Migration_20250604115750.java b/ems-core/src/main/java/it/integry/ems/migration/model/Migration_20250604115750.java new file mode 100644 index 0000000000..8d52e485d2 --- /dev/null +++ b/ems-core/src/main/java/it/integry/ems/migration/model/Migration_20250604115750.java @@ -0,0 +1,56 @@ +package it.integry.ems.migration.model; + +import it.integry.ems.migration._base.BaseMigration; +import it.integry.ems.migration._base.MigrationModelInterface; + +public class Migration_20250604115750 extends BaseMigration implements MigrationModelInterface { + + @Override + public void up() throws Exception { + if (isHistoryDB()) + return; + + executeStatement("alter table dbo.jtb_fasi add tipo_concorrenza smallint default 0 not null", + "exec sp_addextendedproperty 'MS_Description', '0=Nessuna concorrenza, 1=Sequenziale, 2=Parallela', 'SCHEMA', 'dbo',\n" + + " 'TABLE', 'jtb_fasi', 'COLUMN', 'tipo_concorrenza'"); + + executeStatement("INSERT INTO stb_edit_limit (user_name, gest_name, dw_name, dw_colname, dw_value, dw_coltype,\n" + + " display_only, enabled, visible, required, duplicate, limit)\n" + + "SELECT a.utente,\n" + + " 'PVM',\n" + + " 'monitoraggio_linee_v2',\n" + + " 'btnStartProd',\n" + + " null,\n" + + " null,\n" + + " null,\n" + + " 'S',\n" + + " 'S',\n" + + " null,\n" + + " 'S',\n" + + " null\n" + + "from (select user_name as utente\n" + + " from stb_abil\n" + + " where cod_opz in (select cod_opz from stb_menu_opz where gest_name = 'monitoraggio_linee_v2' and flag_abil <> 'N')) a"); + + executeStatement( + "with setup as (\n" + + " select case when value = 'S' then 2 else 0 end as allowMultiple\n" + + " from stb_gest_setup where gest_name = 'PVM'\n" + + " and section = 'MONITORAGGIO_LINEE_V2'\n" + + " and key_section = 'ALLOW_MULTIPLE_ORDERS_OPEN'\n" + + ")\n" + + "update jtb_fasi\n" + + "set jtb_fasi.tipo_concorrenza = allowMultiple\n" + + "from jtb_fasi cross apply setup\n" + + "where tipo_concorrenza = 0\n" + + "and um_prod is not null and cod_mdep_lav is not null\n" + + "\n"); + + + + } + + @Override + public void down() throws Exception { + } +} \ No newline at end of file diff --git a/ems-core/src/main/java/it/integry/ems_model/entity/JtbFasi.java b/ems-core/src/main/java/it/integry/ems_model/entity/JtbFasi.java index b5d80cecc8..b4fdaa78d4 100644 --- a/ems-core/src/main/java/it/integry/ems_model/entity/JtbFasi.java +++ b/ems-core/src/main/java/it/integry/ems_model/entity/JtbFasi.java @@ -1,11 +1,14 @@ package it.integry.ems_model.entity; import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import it.integry.ems.dto.CreateZipDTO; import it.integry.ems_model.annotation.Master; import it.integry.ems_model.annotation.PK; import it.integry.ems_model.annotation.SqlField; import it.integry.ems_model.annotation.Table; import it.integry.ems_model.base.EntityBase; +import it.integry.ems_model.entity._enum.IBaseEnum; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.kie.api.definition.type.PropertyReactive; @@ -78,6 +81,9 @@ public class JtbFasi extends EntityBase { @SqlField(value = "progressivo_sscc", nullable = false) private Long progressivoSscc; + + @SqlField(value = "tipo_concorrenza") + private TipoConcorrenza tipoConcorrenza; public JtbFasi() { super(logger); @@ -228,4 +234,53 @@ public class JtbFasi extends EntityBase { this.progressivoSscc = progressivoSscc; return this; } + + public TipoConcorrenza getTipoConcorrenza() { + return tipoConcorrenza; + } + + public JtbFasi setTipoConcorrenza(TipoConcorrenza tipoConcorrenza) { + this.tipoConcorrenza = tipoConcorrenza; + return this; + } + + public enum TipoConcorrenza implements IBaseEnum { + STB_FILES_ATTACHED((short) 0), + STB_ACTIVITY_FILE((short) 1); + + private final short value; + + TipoConcorrenza(final short value) { + this.value = value; + } + + public static TipoConcorrenza from(Object value) { + short castValue = (short) value; + for (TipoConcorrenza b : TipoConcorrenza.values()) { + if (b.value == castValue) + return b; + } + return null; + } + + @JsonValue + public short getValue() { + return this.value; + } + + @Override + public Object get() { + return this.value; + } + + @Override + public TipoConcorrenza fromInternal(Object val) { + return from(val); + } + + @Override + public String toString() { + return String.valueOf(value); + } + } }