Finish Hotfix-1
Some checks are pending
IntegryManagementSystem_Multi/pipeline/head Build started...

This commit is contained in:
2025-03-03 10:10:54 +01:00
12 changed files with 413 additions and 7 deletions

View File

@@ -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_20250224174207 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
executeStatement("alter table dbo.ctb_amac_manutenzioni add esito_positivo BIT default 1");
}
@Override
public void down() throws Exception {
}
}

View File

@@ -0,0 +1,182 @@
package it.integry.ems.migration.model;
import it.integry.ems.migration._base.BaseMigration;
import it.integry.ems.migration._base.MigrationModelInterface;
public class Migration_20250225173549 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
createOrUpdateFunction("f_getEAN128UL","CREATE FUNCTION [dbo].[f_getEAN128UL](@gestione VARCHAR(1), @dataCollo DATETIME, @serCollo VARCHAR(2), @numCollo int, @customPrefissoEan VARCHAR(7))\n" +
" RETURNS TABLE AS\n" +
" RETURN\n" +
"\n" +
"-- DECLARE @gestione AS VARCHAR(1) = 'L'\n" +
"-- DECLARE @serCollo AS VARCHAR(10) = '/'\n" +
"-- DECLARE @numCollo AS INT = 4427\n" +
"-- DECLARE @dataCollo AS DATETIME = '2024-02-05';\n" +
"-- DECLARE @customPrefissoEan AS VARCHAR(7);-- = '8017596';\n" +
"\n" +
"WITH barcodes AS (\n" +
" SELECT CONCAT(CASE WHEN @customPrefissoEan IS NULL THEN azienda.prefisso_ean ELSE @customPrefissoEan END,\n" +
" CAST(CAST(mtb_colt.num_collo / 100000 AS INT) AS varchar),\n" +
" CASE mtb_colt.gestione\n" +
" WHEN 'A' THEN '1'\n" +
" WHEN 'L' THEN '2'\n" +
" WHEN 'V' THEN '3' END,\n" +
" RIGHT(CAST(DATEPART(YEAR, mtb_colt.data_collo) AS varchar), 2),\n" +
" RIGHT(FORMAT(mtb_colt.num_collo, REPLICATE('0', 5)), 5)) AS AI_00,\n" +
" CASE\n" +
" WHEN mtb_aart.cod_barre_imb IS NOT NULL AND LEN(mtb_aart.cod_barre_imb) < 14 THEN\n" +
" FORMAT(CONVERT(NUMERIC, ISNULL(NULLIF(mtb_aart.cod_barre_imb, ''), '0')), REPLICATE('0', 14))\n" +
" ELSE mtb_aart.cod_barre_imb\n" +
" END AS AI_01,\n" +
" CASE\n" +
" WHEN mtb_aart.bar_code IS NOT NULL AND LEN(mtb_aart.bar_code) < 14\n" +
" THEN\n" +
" FORMAT(CONVERT(BIGINT, mtb_aart.bar_code), REPLICATE('0', 14))\n" +
" ELSE mtb_aart.bar_code\n" +
" END AS AI_02,\n" +
" CASE\n" +
" WHEN mtb_colr.partita_mag IS NOT NULL THEN\n" +
" mtb_colr.partita_mag + CHAR(29)\n" +
" END AS AI_10,\n" +
" CASE\n" +
" WHEN mtb_partita_mag.data_scad IS NOT NULL THEN\n" +
" REPLACE(CONVERT(varchar(10), mtb_partita_mag.data_scad, 2), '.', '')\n" +
" END AS AI_15,\n" +
" CASE\n" +
" WHEN LEN(CAST(mtb_aart.peso_kg * mtb_colr.qta_cnf AS INTEGER)) <= 6 THEN\n" +
" REPLACE(FORMAT(mtb_aart.peso_kg * mtb_colr.qta_cnf, '000000'), '.', '')\n" +
" END AS AI_3100,\n" +
" CASE\n" +
" WHEN LEN(CAST(mtb_aart.peso_kg * mtb_colr.qta_cnf AS INTEGER)) <= 5 THEN\n" +
" REPLACE(FORMAT(mtb_aart.peso_kg * mtb_colr.qta_cnf, '00000.0'), '.', '')\n" +
" END AS AI_3101,\n" +
" CASE\n" +
" WHEN LEN(CAST(mtb_aart.peso_kg * mtb_colr.qta_cnf AS INTEGER)) <= 4 THEN\n" +
" REPLACE(FORMAT(mtb_aart.peso_kg * mtb_colr.qta_cnf, '0000.00'), '.', '')\n" +
" END AS AI_3102,\n" +
" CASE\n" +
" WHEN LEN(CAST(mtb_aart.peso_kg * mtb_colr.qta_cnf AS INTEGER)) <= 3 THEN\n" +
" REPLACE(FORMAT(mtb_aart.peso_kg * mtb_colr.qta_cnf, '000.000'), '.', '')\n" +
" END AS AI_3103,\n" +
" CASE\n" +
" WHEN LEN(CAST(mtb_aart.peso_kg * mtb_colr.qta_cnf AS INTEGER)) <= 2 THEN\n" +
" REPLACE(FORMAT(mtb_aart.peso_kg * mtb_colr.qta_cnf, '00.0000'), '.', '')\n" +
" END AS AI_3104,\n" +
" CASE\n" +
" WHEN LEN(CAST(mtb_aart.peso_kg * mtb_colr.qta_cnf AS INTEGER)) <= 1 THEN\n" +
" REPLACE(FORMAT(mtb_aart.peso_kg * mtb_colr.qta_cnf, '0.00000'), '.', '')\n" +
" END AS AI_3105,\n" +
" CASE\n" +
" WHEN LEN(CAST(mtb_colt.peso_kg AS INTEGER)) <= 6 THEN\n" +
" REPLACE(FORMAT(mtb_colt.peso_kg, '000000'), '.', '')\n" +
" END AS AI_3300,\n" +
" CASE\n" +
" WHEN LEN(CAST(mtb_colt.peso_kg AS INTEGER)) <= 5 THEN\n" +
" REPLACE(FORMAT(mtb_colt.peso_kg, '00000.0'), '.', '')\n" +
" END AS AI_3301,\n" +
" CASE\n" +
" WHEN LEN(CAST(mtb_colt.peso_kg AS INTEGER)) <= 4 THEN\n" +
" REPLACE(FORMAT(mtb_colt.peso_kg, '0000.00'), '.', '')\n" +
" END AS AI_3302,\n" +
" CASE\n" +
" WHEN LEN(CAST(mtb_colt.peso_kg AS INTEGER)) <= 3 THEN\n" +
" REPLACE(FORMAT(mtb_colt.peso_kg, '000.000'), '.', '')\n" +
" END AS AI_3303,\n" +
" CASE\n" +
" WHEN LEN(CAST(mtb_colt.peso_kg AS INTEGER)) <= 2 THEN\n" +
" REPLACE(FORMAT(mtb_colt.peso_kg, '00.0000'), '.', '')\n" +
" END AS AI_3304,\n" +
" CASE\n" +
" WHEN LEN(CAST(mtb_colt.peso_kg AS INTEGER)) <= 1 THEN\n" +
" REPLACE(FORMAT(mtb_colt.peso_kg, '0.00000'), '.', '')\n" +
" END AS AI_3305,\n" +
" CONVERT(varchar, CONVERT(integer, SUM(mtb_colr.qta_col / mtb_colr.qta_cnf))) AS AI_37\n" +
" FROM mtb_colt\n" +
" INNER JOIN mtb_colr\n" +
" ON mtb_colt.gestione = mtb_colr.gestione and mtb_colt.data_collo = mtb_colr.data_collo and\n" +
" mtb_colt.ser_collo = mtb_colr.ser_collo and mtb_colt.num_collo = mtb_colr.num_collo\n" +
" INNER JOIN mtb_aart ON mtb_colr.cod_mart = mtb_aart.cod_mart\n" +
" LEFT outer JOIN mtb_partita_mag ON mtb_colr.cod_mart = mtb_partita_mag.cod_mart AND\n" +
" mtb_colr.partita_mag = mtb_partita_mag.partita_mag,\n" +
" azienda\n" +
" WHERE mtb_colt.gestione = @gestione\n" +
" AND mtb_colt.data_collo = @dataCollo\n" +
" AND mtb_colt.ser_collo = @serCollo\n" +
" AND mtb_colt.num_collo = @numCollo\n" +
" GROUP BY \n" +
" mtb_colr.qta_cnf,\n" +
" mtb_colt.data_vers,\n" +
" nome_ditta,\n" +
" azienda.indirizzo,\n" +
" azienda.cap,\n" +
" azienda.citta,\n" +
" azienda.prov,\n" +
" prefisso_ean,\n" +
" mtb_colt.data_collo,\n" +
" mtb_colt.num_collo,\n" +
" mtb_aart.cod_barre_imb,\n" +
" mtb_aart.bar_code,\n" +
" mtb_aart.descrizione_estesa,\n" +
" mtb_colr.partita_mag,\n" +
" mtb_partita_mag.data_scad,\n" +
" mtb_colt.peso_netto_kg,\n" +
" mtb_colr.cod_mart, \n" +
"\t\t\t mtb_colt.gestione,\n" +
"\t\t\t mtb_colt.peso_kg,\n" +
"\t\t\t mtb_aart.peso_kg\n" +
"),\n" +
" appoggio AS (\n" +
" SELECT CONCAT(\n" +
" REPLICATE('0', 17 - LEN(AI_00)),\n" +
" AI_00) AS AI_00,\n" +
" CASE WHEN AI_01 IS NOT NULL AND LEN(AI_01) = 13 THEN CONCAT(AI_01, dbo.getCheckDigitITF14(AI_01)) ELSE AI_01 END AS AI_01,\n" +
" AI_02,\n" +
" AI_10,\n" +
" AI_15,\n" +
" AI_3100,\n" +
" AI_3101,\n" +
" AI_3102,\n" +
" AI_3103,\n" +
" AI_3104,\n" +
" AI_3105,\n" +
" AI_3300,\n" +
" AI_3301,\n" +
" AI_3302,\n" +
" AI_3303,\n" +
" AI_3304,\n" +
" AI_3305,\n" +
" AI_37\n" +
" FROM barcodes\n" +
" )\n" +
"SELECT CONCAT(AI_00,\n" +
" dbo.getCheckDigitSSCC(AI_00)) AS AI_00,\n" +
" AI_01,\n" +
" AI_02,\n" +
" AI_10,\n" +
" AI_15,\n" +
" AI_3100,\n" +
" AI_3101,\n" +
" AI_3102,\n" +
" AI_3103,\n" +
" AI_3104,\n" +
" AI_3105,\n" +
" AI_3300,\n" +
" AI_3301,\n" +
" AI_3302,\n" +
" AI_3303,\n" +
" AI_3304,\n" +
" AI_3305,\n" +
" AI_37\n" +
"FROM appoggio\n");
}
@Override
public void down() throws Exception {
}
}

View File

@@ -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_20250226121941 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
executeStatement("alter table dbo.ctb_amac_manutenzioni add manutenzione_ordinaria BIT default 1");
}
@Override
public void down() throws Exception {
}
}

View File

@@ -0,0 +1,30 @@
package it.integry.ems.migration.model;
import it.integry.ems.migration._base.BaseMigration;
import it.integry.ems.migration._base.MigrationModelInterface;
public class Migration_20250226162435 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
executeStatement("create table dbo.crl_amac_manutenzioni_files\n" +
"(\n" +
" id_manutenzione BIGINT not null\n" +
" constraint fk_crl_amac_manutenzioni_files_ctb_amac_manutenzioni\n" +
" references dbo.ctb_amac_manutenzioni,\n" +
" id_attach VARCHAR(40) not null\n" +
" constraint fk_crl_amac_manutenzioni_files_stb_files_attached\n" +
" references dbo.stb_files_attached,\n" +
" constraint pk_crl_amac_manutenzioni_files\n" +
" primary key (id_manutenzione, id_attach)\n" +
")\n");
}
@Override
public void down() throws Exception {
}
}

View File

@@ -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_20250226174347 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
createSetup("PVM","MACCHINARI_PROD","REPORT_NAME_MANUTENZIONI",null,"Nome report stampa riepilogo manutenzioni macchina","REPORT_NAME");
}
@Override
public void down() throws Exception {
}
}

View File

@@ -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_20250226175035 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
createSetup("PVM","MONITORAGGIO_LINEE_V2","ENABLE_MODIFICA_LOTTO_SUGGERITO","N","Se abilitato permette la modifica del lotto proposto in fase di assegnazione lotto all'ordine","SI_NO",false,true);
}
@Override
public void down() throws Exception {
}
}

View File

@@ -0,0 +1,24 @@
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_20250228114017 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
String value = null;
if (isCustomer(IntegryCustomer.RossoGargano))
value = "StampaColloAccettazione";
createSetup("PVM","GESTIONE_RICAMBISTICA","REPORT_NAME_ETICHETTA_UDC",value,"nome report etichetta udc","REPORT_NAME");
}
@Override
public void down() throws Exception {
}
}

View File

@@ -0,0 +1,52 @@
package it.integry.ems_model.entity;
import com.fasterxml.jackson.annotation.JsonTypeName;
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 org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.kie.api.definition.type.PropertyReactive;
@PropertyReactive
@Table(CrlAmacManutenzioniFiles.ENTITY)
@JsonTypeName(CrlAmacManutenzioniFiles.ENTITY)
public class CrlAmacManutenzioniFiles extends EntityBase {
public CrlAmacManutenzioniFiles() {
super(logger);
}
private static final long serialVersionUID = 1L;
private final static Logger logger = LogManager.getLogger();
public static final String ENTITY = "crl_amac_manutenzioni_files";
@PK
@SqlField(value = "id_manutenzione", nullable = false)
private Integer idManutenzione;
@PK
@SqlField(value = "id_attach", maxLength = 40, nullable = false)
private String idAttach;
public Integer getIdManutenzione() {
return idManutenzione;
}
public CrlAmacManutenzioniFiles setIdManutenzione(Integer idManutenzione) {
this.idManutenzione = idManutenzione;
return this;
}
public String getIdAttach() {
return idAttach;
}
public CrlAmacManutenzioniFiles setIdAttach(String idAttach) {
this.idAttach = idAttach;
return this;
}
}

View File

@@ -56,6 +56,7 @@ public class CtbAmacHistory extends EntityBase {
@SqlField(value = "value", maxLength = 8000, nullable = false)
private String value;
@ImportFromParent
@SqlField(value = "id_attach", maxLength = 40)
private String idAttach;

View File

@@ -47,7 +47,7 @@ public class CtbAmacManutenzioni extends EntityBase {
private Date dataFine;
@SqlField(value = "stato", nullable = false)
private int stato;
private MaintenanceStatus stato;
@SqlField(value = "esito", maxLength = 8000)
private String esito;
@@ -58,6 +58,12 @@ public class CtbAmacManutenzioni extends EntityBase {
@SqlField(value = "ore_lavoro")
private Float oreLavoro;
@SqlField(value = "esito_positivo")
private Boolean esitoPositivo = true;
@SqlField(value = "manutenzione_ordinaria")
private Boolean manutenzioneOrdinaria = true;
public CtbAmacManutenzioni() {
super(logger);
}
@@ -125,11 +131,11 @@ public class CtbAmacManutenzioni extends EntityBase {
return this;
}
public int getStato() {
public MaintenanceStatus getStato() {
return stato;
}
public CtbAmacManutenzioni setStato(int stato) {
public CtbAmacManutenzioni setStato(MaintenanceStatus stato) {
this.stato = stato;
return this;
}
@@ -174,18 +180,36 @@ public class CtbAmacManutenzioni extends EntityBase {
protected void deleteChilds() throws Exception {
}
public Boolean getEsitoPositivo() {
return esitoPositivo;
}
public CtbAmacManutenzioni setEsitoPositivo(Boolean esitoPositivo) {
this.esitoPositivo = esitoPositivo;
return this;
}
public Boolean getManutenzioneOrdinaria() {
return manutenzioneOrdinaria;
}
public CtbAmacManutenzioni setManutenzioneOrdinaria(Boolean manutenzioneOrdinaria) {
this.manutenzioneOrdinaria = manutenzioneOrdinaria;
return this;
}
public enum MaintenanceStatus implements IBaseEnum<MaintenanceStatus> {
PROGRAMMATA((short) 0), AVVIATA((short) 1), TERMINATA((short) 2), ANNULLATA((short) 3);
PROGRAMMATA(0), AVVIATA(1), TERMINATA(2), ANNULLATA(3);
private final short value;
private final int value;
MaintenanceStatus(short value) {
MaintenanceStatus(int value) {
this.value = value;
}
public static MaintenanceStatus from(Object value) {
short castValue = (short) value;
int castValue = (int) value;
for (MaintenanceStatus b : MaintenanceStatus.values()) {
if (b.value == castValue)
return b;

View File

@@ -111,6 +111,9 @@ public class StbFilesAttached extends EntityBase {
@EntityChild
private SrlUserAttached srlUserAttached;
@EntityChild
private CrlAmacManutenzioniFiles crlAmacManutenzioniFiles;
public StbFilesAttached() {
super(logger);
}
@@ -358,6 +361,15 @@ public class StbFilesAttached extends EntityBase {
return this;
}
public CrlAmacManutenzioniFiles getCrlAmacManutenzioniFiles() {
return crlAmacManutenzioniFiles;
}
public StbFilesAttached setCrlAmacManutenzioniFiles(CrlAmacManutenzioniFiles crlAmacManutenzioniFiles) {
this.crlAmacManutenzioniFiles = crlAmacManutenzioniFiles;
return this;
}
public String getRefUuid() {
return refUuid;
}
@@ -385,6 +397,8 @@ public class StbFilesAttached extends EntityBase {
grlAnagNoteFiles.deleteAllEntities(connection, this);
CtbAmacHistory ctbAmacHistory = new CtbAmacHistory();
ctbAmacHistory.deleteAllEntities(connection, this);
CrlAmacManutenzioniFiles crlAmacManutenzioniFiles1 = new CrlAmacManutenzioniFiles();
crlAmacManutenzioniFiles1.deleteAllEntities(connection, this);
WtbNotificationImage wtbNotificationImage = new WtbNotificationImage();
String whereCond = "attach_id = " + UtilityDB.valueToString(idAttach);
wtbNotificationImage.deleteAllEntities(connection, whereCond);

View File

@@ -5,9 +5,11 @@ import it.integry.ems.order.dto.OrderKeyDTO;
import it.integry.ems.production.machine.dto.MachineOrderEventDTO;
import it.integry.ems.production.machine.service.MachineProductionService;
import it.integry.ems.response.ServiceRestResponse;
import it.integry.ems_model.entity.CtbAmacManutenzioni;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;