[ROSSOGARGANO - AnomalieMerce]
- nuova gestione anomalie merce
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
package it.integry.ems.adapter;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
import com.fasterxml.jackson.databind.JsonDeserializer;
|
||||
import it.integry.ems_model.config.EmsRestConstants;
|
||||
import it.integry.ems_model.utility.UtilityString;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class LongDeserializer extends JsonDeserializer<Long> {
|
||||
|
||||
@Override
|
||||
public Long deserialize(JsonParser parser, DeserializationContext context)
|
||||
throws IOException {
|
||||
String string = parser.getText();
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(string)) {
|
||||
if (string.equalsIgnoreCase("null")) {
|
||||
return EmsRestConstants.LONG_NULL;
|
||||
}
|
||||
return new Long(string);
|
||||
} else
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -33,6 +33,7 @@ public class JsonObjectMapperConfig {
|
||||
|
||||
module.addDeserializer(BigDecimal.class, new BigDecimalDeserialize());
|
||||
module.addDeserializer(Integer.class, new IntegerDeserializer());
|
||||
module.addDeserializer(Long.class, new LongDeserializer());
|
||||
|
||||
module.addDeserializer(String.class, new StringUnicodeDeserialize());
|
||||
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
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_20251125100117 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
executeStatement("create table dbo.mtb_livelli_anomalie\n" +
|
||||
"(\n" +
|
||||
" id bigint identity\n" +
|
||||
" constraint pk_mtb_livelli_anomalie\n" +
|
||||
" primary key,\n" +
|
||||
" descrizione varchar(255) not null,\n" +
|
||||
" hex_colore varchar(20) default '#ffffff',\n" +
|
||||
" escludi_picking_vendita bit default 0 not null,\n" +
|
||||
" escludi_picking_lavorazione bit default 0 not null\n" +
|
||||
")");
|
||||
|
||||
executeStatement("create table dbo.mtb_anomalie_ul\n" +
|
||||
"(\n" +
|
||||
" id bigint identity\n" +
|
||||
" constraint pk_mtb_anomalie_ul\n" +
|
||||
" primary key,\n" +
|
||||
" descrizione varchar(200) not null,\n" +
|
||||
" annotazioni varchar(400),\n" +
|
||||
" inizio_anomalia datetime,\n" +
|
||||
" fine_anomalia datetime,\n" +
|
||||
" id_livello_anomalia bigint not null\n" +
|
||||
" constraint mtb_anomalie_ul_mtb_livelli_anomalie_id_fk\n" +
|
||||
" references dbo.mtb_livelli_anomalie,\n" +
|
||||
" cod_jfas varchar(5)\n" +
|
||||
" constraint mtb_anomalie_ul_jtb_fasi_cod_jfas_fk\n" +
|
||||
" references dbo.jtb_fasi\n" +
|
||||
")");
|
||||
|
||||
executeStatement("alter table dbo.mtb_colt\n" +
|
||||
" add id_anomalia bigint\n" +
|
||||
" constraint mtb_colt_mtb_anomalie_ul_id_fk\n" +
|
||||
" references dbo.mtb_anomalie_ul (id)");
|
||||
|
||||
if (isCustomerDb(IntegryCustomerDB.RossoGargano_RossoGargano)) {
|
||||
executeInsertStatement("INSERT INTO mtb_livelli_anomalie (descrizione, hex_colore, escludi_picking_vendita, escludi_picking_lavorazione) VALUES (N'Prodotto non conforme', N'#FF0000', 1, 1)");
|
||||
executeInsertStatement("INSERT INTO mtb_livelli_anomalie (descrizione, hex_colore, escludi_picking_vendita, escludi_picking_lavorazione) VALUES (N'Prodotto uscito con alte temperature', N'#E36C0A', 1, 0)");
|
||||
executeInsertStatement("INSERT INTO mtb_livelli_anomalie (descrizione, hex_colore, escludi_picking_vendita, escludi_picking_lavorazione) VALUES (N'Pedana in osservazione', N'#FFC000', 1, 0)");
|
||||
executeInsertStatement("INSERT INTO mtb_livelli_anomalie (descrizione, hex_colore, escludi_picking_vendita, escludi_picking_lavorazione) VALUES (N'Barattoli con difetto di marcatura', N'#00B050', 0, 0)");
|
||||
executeInsertStatement("INSERT INTO mtb_livelli_anomalie (descrizione, hex_colore, escludi_picking_vendita, escludi_picking_lavorazione) VALUES (N'Barattoli difettati', N'#00B0F0', 0, 1)");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,256 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251205111526 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
|
||||
createOrUpdateView("mvw_sitart_udc_det_all","CREATE VIEW [dbo].[mvw_sitart_udc_det_all] AS\n" +
|
||||
"WITH SitMtbColr AS (\n" +
|
||||
" /*Vengono presi tutti i Colli di carico*/\n" +
|
||||
" SELECT mtb_colt.gestione,\n" +
|
||||
" mtb_colt.data_collo,\n" +
|
||||
" mtb_colt.ser_collo,\n" +
|
||||
" mtb_colt.num_collo,\n" +
|
||||
" mtb_colt.segno,\n" +
|
||||
" mtb_colt.cod_anag,\n" +
|
||||
" mtb_colt.cod_vdes,\n" +
|
||||
" mtb_colt.cod_mdep,\n" +
|
||||
" mtb_colr.cod_mart,\n" +
|
||||
" mtb_colr.cod_col,\n" +
|
||||
" mtb_colr.cod_tagl,\n" +
|
||||
" mtb_colr.partita_mag,\n" +
|
||||
" mtb_colr.cod_jcom,\n" +
|
||||
" qta_col,\n" +
|
||||
" num_cnf,\n" +
|
||||
" qta_cnf,\n" +
|
||||
" mtb_colr.peso_netto_kg,\n" +
|
||||
" peso_lordo_kg,\n" +
|
||||
" mtb_colt.posizione,\n" +
|
||||
" mtb_colt.cod_jfas,\n" +
|
||||
" mtb_colt.id_anomalia as id_anomalia\n" +
|
||||
" FROM mtb_colr\n" +
|
||||
" inner join mtb_colt on\n" +
|
||||
" mtb_colt.gestione = mtb_colr.gestione\n" +
|
||||
" AND mtb_colt.data_collo = mtb_colr.data_collo\n" +
|
||||
" AND mtb_colt.num_collo = mtb_colr.num_collo\n" +
|
||||
" AND mtb_colt.ser_collo = mtb_colr.ser_collo\n" +
|
||||
" WHERE mtb_colr.data_collo >= '2020/01/01'\n" +
|
||||
" AND segno = 1\n" +
|
||||
"\n" +
|
||||
" UNION ALL\n" +
|
||||
" /*Vengono presi, a storno, tutti i colli che fanno riferimento ad altri colli di carico*/\n" +
|
||||
" SELECT mtb_colr.gestione_rif,\n" +
|
||||
" mtb_colr.data_collo_rif,\n" +
|
||||
" mtb_colr.ser_collo_rif,\n" +
|
||||
" mtb_colr.num_collo_rif,\n" +
|
||||
" collo_rif.segno,\n" +
|
||||
" collo_rif.cod_anag,\n" +
|
||||
" collo_rif.cod_vdes,\n" +
|
||||
" collo_rif.cod_mdep,\n" +
|
||||
" mtb_colr.cod_mart,\n" +
|
||||
" mtb_colr.cod_col,\n" +
|
||||
" mtb_colr.cod_tagl,\n" +
|
||||
" mtb_colr.partita_mag,\n" +
|
||||
" NULL AS cod_jcom,\n" +
|
||||
" -qta_col,\n" +
|
||||
" -num_cnf,\n" +
|
||||
" qta_cnf,\n" +
|
||||
" -mtb_colr.peso_netto_kg,\n" +
|
||||
" -peso_lordo_kg,\n" +
|
||||
" collo_rif.posizione,\n" +
|
||||
" collo_rif.cod_jfas,\n" +
|
||||
" NULL as id_anomalia\n" +
|
||||
" FROM mtb_colr\n" +
|
||||
" LEFT OUTER JOIN mtb_colt AS collo_rif\n" +
|
||||
" ON mtb_colr.gestione_rif = collo_rif.gestione AND\n" +
|
||||
" mtb_colr.data_collo_rif = collo_rif.data_collo AND\n" +
|
||||
" mtb_colr.num_collo_rif = collo_rif.num_collo AND\n" +
|
||||
" mtb_colr.ser_collo_rif = collo_rif.ser_collo\n" +
|
||||
" WHERE mtb_colr.data_collo >= '2020/01/01'\n" +
|
||||
" AND gestione_rif IS NOT NULL /*and mtb_colt.segno = -1 */\n" +
|
||||
" UNION ALL\n" +
|
||||
" /*Vengono presi anche tutti i colli di scarico non ancora agganciati a documento tranne quelli di scarico a lavorazione perche' il materiale versato nelle linee di produzione si ritiene subito consumato*/\n" +
|
||||
" SELECT mtb_colt.gestione,\n" +
|
||||
" mtb_colt.data_collo,\n" +
|
||||
" mtb_colt.ser_collo,\n" +
|
||||
" mtb_colt.num_collo,\n" +
|
||||
" mtb_colt.segno,\n" +
|
||||
" mtb_colt.cod_anag,\n" +
|
||||
" mtb_colt.cod_vdes,\n" +
|
||||
" mtb_colt.cod_mdep,\n" +
|
||||
" mtb_colr.cod_mart,\n" +
|
||||
" mtb_colr.cod_col,\n" +
|
||||
" mtb_colr.cod_tagl,\n" +
|
||||
" mtb_colr.partita_mag,\n" +
|
||||
" mtb_colr.cod_jcom,\n" +
|
||||
" qta_col,\n" +
|
||||
" num_cnf,\n" +
|
||||
" qta_cnf,\n" +
|
||||
" mtb_colr.peso_netto_kg,\n" +
|
||||
" peso_lordo_kg,\n" +
|
||||
" mtb_colt.posizione,\n" +
|
||||
" mtb_colt.cod_jfas,\n" +
|
||||
" NULL as id_anomalia\n" +
|
||||
" FROM mtb_colr\n" +
|
||||
" inner join mtb_colt on\n" +
|
||||
" mtb_colt.gestione = mtb_colr.gestione\n" +
|
||||
" AND mtb_colt.data_collo = mtb_colr.data_collo\n" +
|
||||
" AND mtb_colt.num_collo = mtb_colr.num_collo\n" +
|
||||
" AND mtb_colt.ser_collo = mtb_colr.ser_collo\n" +
|
||||
" WHERE mtb_colr.data_collo >= '2020/01/01'\n" +
|
||||
" AND segno = -1\n" +
|
||||
" AND cod_dtip IS NULL\n" +
|
||||
" AND mtb_colt.gestione <> 'L'),\n" +
|
||||
" SitMtbColt AS (SELECT SitMtbColr.gestione,\n" +
|
||||
" SitMtbColr.data_collo,\n" +
|
||||
" SitMtbColr.ser_collo,\n" +
|
||||
" SitMtbColr.num_collo,\n" +
|
||||
" SitMtbColr.segno,\n" +
|
||||
" SitMtbColr.cod_mdep,\n" +
|
||||
" SitMtbColr.posizione,\n" +
|
||||
" SitMtbColr.cod_mart,\n" +
|
||||
" SitMtbColr.cod_col,\n" +
|
||||
" SitMtbColr.cod_tagl,\n" +
|
||||
" SitMtbColr.partita_mag,\n" +
|
||||
" mtb_partita_mag.data_scad,\n" +
|
||||
" MAX(SitMtbColr.cod_jcom) AS cod_jcom,\n" +
|
||||
" SUM(qta_col) AS qta_col,\n" +
|
||||
" SUM(num_cnf) AS num_cnf,\n" +
|
||||
" AVG(SitMtbColr.qta_cnf) AS qta_cnf,\n" +
|
||||
" SUM(SitMtbColr.peso_netto_kg) AS peso_netto_kg,\n" +
|
||||
" SUM(peso_lordo_kg) AS peso_lordo_kg,\n" +
|
||||
" SitMtbColr.cod_jfas,\n" +
|
||||
" flag_qta_cnf_fissa,\n" +
|
||||
" MAX(SitMtbColr.id_anomalia) as id_anomalia\n" +
|
||||
" FROM SitMtbColr\n" +
|
||||
" LEFT OUTER JOIN mtb_partita_mag ON SitMtbColr.cod_mart = mtb_partita_mag.cod_mart AND\n" +
|
||||
" SitMtbColr.partita_mag = mtb_partita_mag.partita_mag\n" +
|
||||
" INNER JOIN mtb_aart ON SitMtbColr.cod_mart = mtb_aart.cod_mart\n" +
|
||||
" GROUP BY SitMtbColr.gestione, SitMtbColr.data_collo, SitMtbColr.ser_collo, SitMtbColr.num_collo,\n" +
|
||||
" SitMtbColr.segno, SitMtbColr.cod_mdep,\n" +
|
||||
" SitMtbColr.posizione, SitMtbColr.cod_mart, SitMtbColr.cod_col, SitMtbColr.cod_tagl,\n" +
|
||||
" SitMtbColr.partita_mag,\n" +
|
||||
" mtb_partita_mag.data_scad, SitMtbColr.cod_jfas, mtb_aart.flag_qta_cnf_fissa)\n" +
|
||||
"SELECT gestione,\n" +
|
||||
" data_collo,\n" +
|
||||
" ser_collo,\n" +
|
||||
" num_collo,\n" +
|
||||
" segno,\n" +
|
||||
" cod_mdep,\n" +
|
||||
" SitMtbColt.posizione,\n" +
|
||||
" SitMtbColt.cod_mart,\n" +
|
||||
" cod_col,\n" +
|
||||
" cod_tagl,\n" +
|
||||
" partita_mag,\n" +
|
||||
" data_scad,\n" +
|
||||
" cod_jcom,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN flag_dig = 'S' THEN\n" +
|
||||
" CAST(qta_col AS INT)\n" +
|
||||
" ELSE ROUND(qta_col, cifre_dec)\n" +
|
||||
" END as qta_col,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN flag_dig = 'S' THEN\n" +
|
||||
" CASE\n" +
|
||||
" WHEN flag_dig = 'S' THEN\n" +
|
||||
" CAST(qta_col AS INT)\n" +
|
||||
" ELSE ROUND(qta_col, cifre_dec)\n" +
|
||||
" END / case when SitMtbColt.qta_cnf = 0 then 1 else SitMtbColt.qta_cnf end\n" +
|
||||
" ELSE num_cnf\n" +
|
||||
" END as num_cnf,\n" +
|
||||
" --qta_col,\n" +
|
||||
" --num_cnf,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN SitMtbColt.flag_qta_cnf_fissa = 'S'\n" +
|
||||
" THEN SitMtbColt.qta_cnf\n" +
|
||||
" ELSE qta_col / CASE WHEN num_cnf = 0 THEN 1 ELSE num_cnf END\n" +
|
||||
" END AS qta_cnf,\n" +
|
||||
" peso_netto_kg,\n" +
|
||||
" peso_lordo_kg,\n" +
|
||||
" cod_jfas,\n" +
|
||||
" SitMtbColt.flag_qta_cnf_fissa,\n" +
|
||||
" mtb_unt_mis.flag_dig,\n" +
|
||||
" mtb_unt_mis.cifre_dec,\n" +
|
||||
" SitMtbColt.id_anomalia\n" +
|
||||
"FROM SitMtbColt\n" +
|
||||
" INNER JOIN mtb_aart ON SitMtbColt.cod_mart = mtb_aart.cod_mart\n" +
|
||||
" INNER JOIN mtb_unt_mis ON mtb_aart.unt_mis = mtb_unt_mis.unt_mis");
|
||||
|
||||
|
||||
|
||||
createOrUpdateView("mvw_sitart_udc_det","CREATE VIEW [dbo].[mvw_sitart_udc_det] AS\n" +
|
||||
"SELECT gestione,\n" +
|
||||
" data_collo,\n" +
|
||||
" ser_collo,\n" +
|
||||
" num_collo,\n" +
|
||||
" segno,\n" +
|
||||
" cod_mdep,\n" +
|
||||
" posizione,\n" +
|
||||
" cod_mart,\n" +
|
||||
" cod_col,\n" +
|
||||
" cod_tagl,\n" +
|
||||
" partita_mag,\n" +
|
||||
" data_scad,\n" +
|
||||
" cod_jcom,\n" +
|
||||
" qta_col,\n" +
|
||||
" num_cnf,\n" +
|
||||
" qta_cnf,\n" +
|
||||
" peso_netto_kg,\n" +
|
||||
" peso_lordo_kg,\n" +
|
||||
" cod_jfas,\n" +
|
||||
" id_anomalia\n" +
|
||||
"FROM mvw_sitart_udc_det_all\n" +
|
||||
"WHERE qta_col > 0");
|
||||
|
||||
createOrUpdateView("mvw_sitart_udc_det_inventario","CREATE VIEW [dbo].[mvw_sitart_udc_det_inventario] as\n" +
|
||||
"SELECT UL.gestione,\n" +
|
||||
" data_collo,\n" +
|
||||
" ser_collo,\n" +
|
||||
" num_collo,\n" +
|
||||
" segno,\n" +
|
||||
" UL.cod_mdep,\n" +
|
||||
" UL.posizione,\n" +
|
||||
" mtb_depo_posizioni.priorita,\n" +
|
||||
" mtb_aart.cod_mgrp AS codGruppo,\n" +
|
||||
" mtb_grup.descrizione AS Gruppo,\n" +
|
||||
" mtb_aart.cod_msgr AS CodSgruppo,\n" +
|
||||
" mtb_sgrp.descrizione AS Sottogruppo,\n" +
|
||||
" UL.cod_mart,\n" +
|
||||
" diacod,\n" +
|
||||
" mtb_aart.descrizione_estesa,\n" +
|
||||
" partita_mag,\n" +
|
||||
" UL.cod_jcom,\n" +
|
||||
" jtb_comt.descrizione AS commessa,\n" +
|
||||
" mtb_aart.unt_mis,\n" +
|
||||
" qta_col,\n" +
|
||||
" num_cnf,\n" +
|
||||
" UL.qta_cnf,\n" +
|
||||
" UL.peso_netto_kg,\n" +
|
||||
" UL.peso_lordo_kg,\n" +
|
||||
" UL.cod_jfas,\n" +
|
||||
" UL.id_anomalia\n" +
|
||||
"FROM [mvw_sitart_udc_det] UL\n" +
|
||||
" LEFT OUTER JOIN jtb_comt ON UL.cod_jcom = jtb_comt.cod_jcom\n" +
|
||||
" LEFT OUTER JOIN mtb_depo_posizioni\n" +
|
||||
" on UL.cod_mdep = mtb_depo_posizioni.cod_mdep and UL.posizione = mtb_depo_posizioni.posizione,\n" +
|
||||
" mtb_aart,\n" +
|
||||
" mtb_grup,\n" +
|
||||
" mtb_sgrp\n" +
|
||||
"WHERE UL.cod_mart = mtb_aart.cod_mart\n" +
|
||||
" AND mtb_aart.cod_mgrp = mtb_grup.cod_mgrp\n" +
|
||||
" AND mtb_aart.cod_mgrp = mtb_sgrp.cod_mgrp\n" +
|
||||
" AND mtb_aart.cod_msgr = mtb_sgrp.cod_msgr\n" +
|
||||
" AND qta_col <> 0\n");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,7 @@ public class ForeignKeyDTO {
|
||||
put(WtbJrept.ENTITY, "Report inesistente");
|
||||
put(StbDevices.ENTITY, "Dispositivo inesistente");
|
||||
put(StbPublications.ENTITY, "Pubblicazione inesistente");
|
||||
put(MtbAnomalieUl.ENTITY, "Anomalia inesistente");
|
||||
}};
|
||||
|
||||
String tableName;
|
||||
|
||||
@@ -70,6 +70,7 @@ public class UtilityEntity {
|
||||
(field instanceof LocalDateTime && ((LocalDateTime)field).isEqual(EmsRestConstants.LOCAL_DATE_TIME_NULL)) ||
|
||||
(field instanceof BigDecimal && ((BigDecimal) field).compareTo(EmsRestConstants.BIGDECIMAL_NULL) == 0) ||
|
||||
(field instanceof Integer && field.equals(EmsRestConstants.INTEGER_NULL)) ||
|
||||
(field instanceof Long && field.equals(EmsRestConstants.LONG_NULL)) ||
|
||||
(field instanceof String && ((String) field).equalsIgnoreCase(EmsRestConstants.NULL)));
|
||||
|
||||
}
|
||||
|
||||
@@ -1152,7 +1152,11 @@ public abstract class EntityBase implements Serializable, Cloneable, EntityInter
|
||||
}
|
||||
}
|
||||
Object value = field.get(entity);
|
||||
if (value != null && !(value instanceof String && ((String) value).equalsIgnoreCase(EmsRestConstants.NULL))) {
|
||||
if (value != null &&
|
||||
!(value instanceof String && ((String) value).equalsIgnoreCase(EmsRestConstants.NULL)) &&
|
||||
!(value instanceof Long && ((Long) value) == (EmsRestConstants.LONG_NULL)) &&
|
||||
!(value instanceof Integer && ((Integer) value) == (EmsRestConstants.INTEGER_NULL))
|
||||
) {
|
||||
sqlFields.put(columnName, field.get(entity));
|
||||
} else {
|
||||
sqlFields.clear();
|
||||
|
||||
@@ -15,6 +15,7 @@ public class EmsRestConstants {
|
||||
public static final LocalTime LOCAL_TIME_NULL = LocalTime.MAX; // 23:59:59.99999
|
||||
public static final LocalDateTime LOCAL_DATE_TIME_NULL = LocalDateTime.of(1900, 1, 1, 0, 0, 0); // 1/1/1900
|
||||
public static final Integer INTEGER_NULL = Integer.MIN_VALUE;
|
||||
public static final Long LONG_NULL = Long.MIN_VALUE;
|
||||
public static final BigDecimal BIGDECIMAL_NULL = new BigDecimal(Integer.MIN_VALUE);
|
||||
|
||||
public static final String ENTITY_TYPE = "type";
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
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;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Master
|
||||
@PropertyReactive
|
||||
@Table(MtbAnomalieUl.ENTITY)
|
||||
@JsonTypeName(MtbAnomalieUl.ENTITY)
|
||||
public class MtbAnomalieUl extends EntityBase {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private final static Logger logger = LogManager.getLogger();
|
||||
|
||||
public static final String ENTITY = "mtb_anomalie_ul";
|
||||
|
||||
public MtbAnomalieUl() {
|
||||
super(logger);
|
||||
}
|
||||
|
||||
@PK
|
||||
@Identity
|
||||
@SqlField(value = "id", nullable = false)
|
||||
private Long id;
|
||||
|
||||
@SqlField("descrizione")
|
||||
private String descrizione;
|
||||
|
||||
@SqlField("annotazioni")
|
||||
private String annotazioni;
|
||||
|
||||
@SqlField("inizio_anomalia")
|
||||
private LocalDateTime inizioAnomalia;
|
||||
|
||||
@SqlField("fine_anomalia")
|
||||
private LocalDateTime fineAnomalia;
|
||||
|
||||
@SqlField("cod_jfas")
|
||||
private String codJfas;
|
||||
|
||||
@FK(tableName = MtbLivelliAnomalie.ENTITY, columnName = "id")
|
||||
@SqlField("id_livello_anomalia")
|
||||
private Long idLivelloAnomalia;
|
||||
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public MtbAnomalieUl setId(Long id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDescrizione() {
|
||||
return descrizione;
|
||||
}
|
||||
|
||||
public MtbAnomalieUl setDescrizione(String descrizione) {
|
||||
this.descrizione = descrizione;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getAnnotazioni() {
|
||||
return annotazioni;
|
||||
}
|
||||
|
||||
public MtbAnomalieUl setAnnotazioni(String annotazioni) {
|
||||
this.annotazioni = annotazioni;
|
||||
return this;
|
||||
}
|
||||
|
||||
public LocalDateTime getInizioAnomalia() {
|
||||
return inizioAnomalia;
|
||||
}
|
||||
|
||||
public MtbAnomalieUl setInizioAnomalia(LocalDateTime inizioAnomalia) {
|
||||
this.inizioAnomalia = inizioAnomalia;
|
||||
return this;
|
||||
}
|
||||
|
||||
public LocalDateTime getFineAnomalia() {
|
||||
return fineAnomalia;
|
||||
}
|
||||
|
||||
public MtbAnomalieUl setFineAnomalia(LocalDateTime fineAnomalia) {
|
||||
this.fineAnomalia = fineAnomalia;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodJfas() {
|
||||
return codJfas;
|
||||
}
|
||||
|
||||
public MtbAnomalieUl setCodJfas(String codJfas) {
|
||||
this.codJfas = codJfas;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Long getIdLivelloAnomalia() {
|
||||
return idLivelloAnomalia;
|
||||
}
|
||||
|
||||
public MtbAnomalieUl setIdLivelloAnomalia(Long idLivelloAnomalia) {
|
||||
this.idLivelloAnomalia = idLivelloAnomalia;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -176,6 +176,10 @@ public class MtbColt extends EntityBase implements EquatableEntityInterface<MtbC
|
||||
@SqlField(value = "progressivo_ul", nullable = false)
|
||||
private Integer progressivoUl;
|
||||
|
||||
@FK(tableName = MtbAnomalieUl.ENTITY, columnName = "id")
|
||||
@SqlField(value = "id_anomalia")
|
||||
private Long idAnomalia;
|
||||
|
||||
private String insPartitaMag;
|
||||
|
||||
private transient String stpPrz;
|
||||
@@ -733,6 +737,15 @@ public class MtbColt extends EntityBase implements EquatableEntityInterface<MtbC
|
||||
return this;
|
||||
}
|
||||
|
||||
public Long getIdAnomalia() {
|
||||
return idAnomalia;
|
||||
}
|
||||
|
||||
public MtbColt setIdAnomalia(Long idAnomalia) {
|
||||
this.idAnomalia = idAnomalia;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equalsKey(MtbColt other) {
|
||||
if (this == other)
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
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(MtbLivelliAnomalie.ENTITY)
|
||||
@JsonTypeName(MtbLivelliAnomalie.ENTITY)
|
||||
public class MtbLivelliAnomalie extends EntityBase {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private final static Logger logger = LogManager.getLogger();
|
||||
public static final String ENTITY = "mtb_livelli_anomalie";
|
||||
public MtbLivelliAnomalie() {
|
||||
super(logger);
|
||||
}
|
||||
|
||||
@PK
|
||||
@Identity
|
||||
@SqlField("id")
|
||||
private Long id;
|
||||
|
||||
@SqlField("descrizione")
|
||||
private String descrizione;
|
||||
|
||||
@SqlField(value = "hex_colore",maxLength = 20)
|
||||
private String hexColore;
|
||||
|
||||
@SqlField(value = "escludi_picking_vendita",nullable = false, defaultObjectValue = "0")
|
||||
private Boolean escludiPickingVendita = false;
|
||||
|
||||
@SqlField(value = "escludi_picking_lavorazione",nullable = false, defaultObjectValue = "0")
|
||||
private Boolean escludiPickingLavorazione = false;
|
||||
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public MtbLivelliAnomalie setId(Long id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDescrizione() {
|
||||
return descrizione;
|
||||
}
|
||||
|
||||
public MtbLivelliAnomalie setDescrizione(String descrizione) {
|
||||
this.descrizione = descrizione;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getHexColore() {
|
||||
return hexColore;
|
||||
}
|
||||
|
||||
public MtbLivelliAnomalie setHexColore(String hexColore) {
|
||||
this.hexColore = hexColore;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Boolean getEscludiPickingVendita() {
|
||||
return escludiPickingVendita;
|
||||
}
|
||||
|
||||
public MtbLivelliAnomalie setEscludiPickingVendita(Boolean escludiPickingVendita) {
|
||||
this.escludiPickingVendita = escludiPickingVendita;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Boolean getEscludiPickingLavorazione() {
|
||||
return escludiPickingLavorazione;
|
||||
}
|
||||
|
||||
public MtbLivelliAnomalie setEscludiPickingLavorazione(Boolean escludiPickingLavorazione) {
|
||||
this.escludiPickingLavorazione = escludiPickingLavorazione;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -880,6 +880,11 @@ public class SqlFieldHolder {
|
||||
dato = "null";
|
||||
} else
|
||||
dato = obj.toString();
|
||||
} else if (obj instanceof Long) {
|
||||
if (obj.equals(EmsRestConstants.LONG_NULL)) {
|
||||
dato = "null";
|
||||
} else
|
||||
dato = obj.toString();
|
||||
} else if (obj instanceof BigDecimal) {
|
||||
if (obj.equals(EmsRestConstants.BIGDECIMAL_NULL)) {
|
||||
dato = "null";
|
||||
@@ -968,6 +973,11 @@ public class SqlFieldHolder {
|
||||
dato = null;
|
||||
} else
|
||||
dato = obj;
|
||||
} else if (obj instanceof Long) {
|
||||
if (obj.equals(EmsRestConstants.LONG_NULL)) {
|
||||
dato = null;
|
||||
} else
|
||||
dato = obj;
|
||||
} else if (obj instanceof BigDecimal) {
|
||||
if (obj.equals(EmsRestConstants.BIGDECIMAL_NULL)) {
|
||||
dato = null;
|
||||
|
||||
@@ -136,7 +136,7 @@ public class UtilityFilter {
|
||||
})
|
||||
.collect(Collectors.joining(" " + logic + " "));
|
||||
|
||||
return "(" + sql + ")";
|
||||
return UtilityString.hasContent(sql) ? "(" + sql + ")" : "1=1";
|
||||
}
|
||||
|
||||
public static String processSort(SortDTO[] sort) {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package it.integry.ems_model.utility;
|
||||
|
||||
import it.integry.ems.expansion.RunnableArgsWithReturn;
|
||||
import it.integry.ems_model.annotation.SqlField;
|
||||
import it.integry.ems_model.resolver.SqlFieldHolder;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import javax.validation.constraints.NotNull;
|
||||
@@ -76,7 +78,7 @@ public class UtilityHashMap {
|
||||
}
|
||||
|
||||
// Metodo ausiliario per conversioni di tipi
|
||||
private static Object convertValue(Object value, Class<?> targetType) {
|
||||
private static Object convertValue(Object value, Class<?> targetType) throws Exception {
|
||||
if (targetType == int.class || targetType == Integer.class) {
|
||||
return Integer.parseInt(value.toString());
|
||||
} else if (targetType == long.class || targetType == Long.class) {
|
||||
@@ -89,6 +91,11 @@ public class UtilityHashMap {
|
||||
return Boolean.parseBoolean(value.toString());
|
||||
} else if (targetType == String.class) {
|
||||
return value.toString();
|
||||
}else{
|
||||
final RunnableArgsWithReturn<Object, Object> converter = SqlFieldHolder.getConverter(value.getClass(), targetType);
|
||||
if( converter != null){
|
||||
return converter.run(value);
|
||||
}
|
||||
}
|
||||
return null; // Aggiungi altre conversioni se necessario
|
||||
}
|
||||
|
||||
@@ -427,6 +427,8 @@ public class ProductionOrdersLifecycleService {
|
||||
.setCodJfas(codJfas)
|
||||
.setDataOrd(UtilityLocalDate.localDateToDate(dataPianificazione))
|
||||
.setNumOrd(null)
|
||||
.setNumOrdRif(null)
|
||||
.setDataOrdRif(null)
|
||||
.setGeneraOrdLavDaProd(false)
|
||||
.setOrdTrasf(false);
|
||||
dtbOrdtP.setOperation(OperationType.INSERT);
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
package it.integry.ems.retail.controller;
|
||||
|
||||
import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems.retail.dto.SaveAnomaliaRequestDTO;
|
||||
import it.integry.ems.retail.dto.SaveLivelloAnomaliaRequestDTO;
|
||||
import it.integry.ems.retail.service.AnomalieUlService;
|
||||
import it.integry.ems.response.ServiceRestResponse;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems_model.utility.dto.PageableRequestDTO;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@Scope("request")
|
||||
@RequestMapping("magazzino/anomalie")
|
||||
|
||||
public class AnomalieController {
|
||||
private final AnomalieUlService anomalieProdService;
|
||||
private MultiDBTransactionManager multiDBTransactionManager;
|
||||
|
||||
public AnomalieController(MultiDBTransactionManager multiDBTransactionManager, AnomalieUlService anomalieProdService) {
|
||||
this.multiDBTransactionManager = multiDBTransactionManager;
|
||||
this.anomalieProdService = anomalieProdService;
|
||||
}
|
||||
|
||||
@GetMapping(value = "/lista")
|
||||
public ServiceRestResponse listaAnomalie(HttpServletRequest request,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String profileDB,
|
||||
@RequestBody PageableRequestDTO requestData) throws Exception {
|
||||
return ServiceRestResponse.createPositiveResponse(anomalieProdService.getAnomalieProd(requestData, multiDBTransactionManager.getPrimaryConnection()));
|
||||
|
||||
}
|
||||
|
||||
@GetMapping(value = "/livelli/lista")
|
||||
public ServiceRestResponse listaLivelliAnomalie(HttpServletRequest request,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String profileDB) throws Exception {
|
||||
return ServiceRestResponse.createPositiveResponse(anomalieProdService.listaLivelliAnomalie(multiDBTransactionManager.getPrimaryConnection()));
|
||||
|
||||
}
|
||||
|
||||
@PostMapping(value = "/livelli/salva")
|
||||
public ServiceRestResponse salvaLivelloAnomalia(HttpServletRequest request,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String profileDB,
|
||||
@RequestBody SaveLivelloAnomaliaRequestDTO saveDto) throws Exception {
|
||||
try {
|
||||
return ServiceRestResponse.createPositiveResponse(anomalieProdService.salvaLivelloAnomalia(multiDBTransactionManager, saveDto));
|
||||
} catch (Exception e) {
|
||||
multiDBTransactionManager.rollbackAll();
|
||||
throw e;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@GetMapping(value = "/{id}/ul")
|
||||
public ServiceRestResponse getUlAnomalia(HttpServletRequest request,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String profileDB,
|
||||
@PathVariable Long id) throws Exception {
|
||||
return ServiceRestResponse.createPositiveResponse(anomalieProdService.getUlAnomalia(multiDBTransactionManager.getPrimaryConnection(), id));
|
||||
}
|
||||
|
||||
@PostMapping(value = "/{id}/elimina")
|
||||
public ServiceRestResponse deleteAnomalia(HttpServletRequest request,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String profileDB,
|
||||
@PathVariable Long id) throws Exception {
|
||||
try {
|
||||
return ServiceRestResponse.createPositiveResponse(anomalieProdService.deleteAnomalia(multiDBTransactionManager, id));
|
||||
} catch (Exception e) {
|
||||
multiDBTransactionManager.rollbackAll();
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping(value = "/salva")
|
||||
public ServiceRestResponse saveAnomalia(HttpServletRequest request,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String profileDB,
|
||||
@RequestBody SaveAnomaliaRequestDTO saveDto) throws Exception {
|
||||
try {
|
||||
return ServiceRestResponse.createPositiveResponse(anomalieProdService.saveAnomalia(multiDBTransactionManager, saveDto));
|
||||
} catch (Exception e) {
|
||||
multiDBTransactionManager.rollbackAll();
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping(value = "/{id}/detachUls")
|
||||
public ServiceRestResponse detachUls(HttpServletRequest request,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String profileDB,
|
||||
@PathVariable Long id,
|
||||
@RequestBody List<String> ulsToRemove) throws Exception {
|
||||
try {
|
||||
return ServiceRestResponse.createPositiveResponse(anomalieProdService.detachUls(multiDBTransactionManager, id, ulsToRemove));
|
||||
} catch (Exception e) {
|
||||
multiDBTransactionManager.rollbackAll();
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
package it.integry.ems.retail.dto;
|
||||
|
||||
import it.integry.ems_model.annotation.SqlField;
|
||||
import it.integry.ems_model.entity.MtbAnomalieUl;
|
||||
import it.integry.ems_model.entity.MtbLivelliAnomalie;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
public class AnomalieMerceDTO {
|
||||
@SqlField(value = "id", nullable = false)
|
||||
private Long id;
|
||||
@SqlField("descrizione")
|
||||
private String descrizione;
|
||||
@SqlField("annotazioni")
|
||||
private String annotazioni;
|
||||
@SqlField("inizio_anomalia")
|
||||
private LocalDateTime inizioAnomalia;
|
||||
@SqlField("fine_anomalia")
|
||||
private LocalDateTime fineAnomalia;
|
||||
@SqlField("cod_jfas")
|
||||
private String codJfas;
|
||||
|
||||
@SqlField("id_livello_anomalia")
|
||||
private Long idLivelloAnomalia;
|
||||
|
||||
private MtbLivelliAnomalie livelloAnomalia;
|
||||
|
||||
private List<String> barcodeList;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public AnomalieMerceDTO setId(Long id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDescrizione() {
|
||||
return descrizione;
|
||||
}
|
||||
|
||||
public AnomalieMerceDTO setDescrizione(String descrizione) {
|
||||
this.descrizione = descrizione;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getAnnotazioni() {
|
||||
return annotazioni;
|
||||
}
|
||||
|
||||
public AnomalieMerceDTO setAnnotazioni(String annotazioni) {
|
||||
this.annotazioni = annotazioni;
|
||||
return this;
|
||||
}
|
||||
|
||||
public LocalDateTime getInizioAnomalia() {
|
||||
return inizioAnomalia;
|
||||
}
|
||||
|
||||
public AnomalieMerceDTO setInizioAnomalia(LocalDateTime inizioAnomalia) {
|
||||
this.inizioAnomalia = inizioAnomalia;
|
||||
return this;
|
||||
}
|
||||
|
||||
public LocalDateTime getFineAnomalia() {
|
||||
return fineAnomalia;
|
||||
}
|
||||
|
||||
public AnomalieMerceDTO setFineAnomalia(LocalDateTime fineAnomalia) {
|
||||
this.fineAnomalia = fineAnomalia;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodJfas() {
|
||||
return codJfas;
|
||||
}
|
||||
|
||||
public AnomalieMerceDTO setCodJfas(String codJfas) {
|
||||
this.codJfas = codJfas;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Long getIdLivelloAnomalia() {
|
||||
return idLivelloAnomalia;
|
||||
}
|
||||
|
||||
public AnomalieMerceDTO setIdLivelloAnomalia(Long idLivelloAnomalia) {
|
||||
this.idLivelloAnomalia = idLivelloAnomalia;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<String> getBarcodeList() {
|
||||
return barcodeList;
|
||||
}
|
||||
|
||||
public AnomalieMerceDTO setBarcodeList(List<String> barcodeList) {
|
||||
this.barcodeList = barcodeList;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MtbLivelliAnomalie getLivelloAnomalia() {
|
||||
return livelloAnomalia;
|
||||
}
|
||||
|
||||
public AnomalieMerceDTO setLivelloAnomalia(MtbLivelliAnomalie livelloAnomalia) {
|
||||
this.livelloAnomalia = livelloAnomalia;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
package it.integry.ems.retail.dto;
|
||||
|
||||
import it.integry.ems_model.annotation.SqlField;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
|
||||
public class DettaglioULDTO {
|
||||
|
||||
@SqlField("barcode_ul")
|
||||
private String barcodeUl;
|
||||
@SqlField("cod_mart")
|
||||
private String codMart;
|
||||
@SqlField("descrizione")
|
||||
private String descrizione;
|
||||
@SqlField("descrizione_estesa")
|
||||
private String descrizioneEstesa;
|
||||
@SqlField("unt_mis")
|
||||
private String untMis;
|
||||
@SqlField("qta_col")
|
||||
private BigDecimal qtaCol;
|
||||
@SqlField("partita_mag")
|
||||
private String partitaMag;
|
||||
@SqlField("cod_jfas")
|
||||
private String codJfas;
|
||||
@SqlField("gestione")
|
||||
private String gestione;
|
||||
@SqlField("data_collo")
|
||||
private LocalDate dataCollo;
|
||||
@SqlField("ser_collo")
|
||||
private String serCollo;
|
||||
@SqlField("num_collo")
|
||||
private Integer numCollo;
|
||||
|
||||
public String getBarcodeUl() {
|
||||
return barcodeUl;
|
||||
}
|
||||
|
||||
public DettaglioULDTO setBarcodeUl(String barcodeUl) {
|
||||
this.barcodeUl = barcodeUl;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodMart() {
|
||||
return codMart;
|
||||
}
|
||||
|
||||
public DettaglioULDTO setCodMart(String codMart) {
|
||||
this.codMart = codMart;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDescrizione() {
|
||||
return descrizione;
|
||||
}
|
||||
|
||||
public DettaglioULDTO setDescrizione(String descrizione) {
|
||||
this.descrizione = descrizione;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDescrizioneEstesa() {
|
||||
return descrizioneEstesa;
|
||||
}
|
||||
|
||||
public DettaglioULDTO setDescrizioneEstesa(String descrizioneEstesa) {
|
||||
this.descrizioneEstesa = descrizioneEstesa;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getUntMis() {
|
||||
return untMis;
|
||||
}
|
||||
|
||||
public DettaglioULDTO setUntMis(String untMis) {
|
||||
this.untMis = untMis;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getQtaCol() {
|
||||
return qtaCol;
|
||||
}
|
||||
|
||||
public DettaglioULDTO setQtaCol(BigDecimal qtaCol) {
|
||||
this.qtaCol = qtaCol;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPartitaMag() {
|
||||
return partitaMag;
|
||||
}
|
||||
|
||||
public DettaglioULDTO setPartitaMag(String partitaMag) {
|
||||
this.partitaMag = partitaMag;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodJfas() {
|
||||
return codJfas;
|
||||
}
|
||||
|
||||
public DettaglioULDTO setCodJfas(String codJfas) {
|
||||
this.codJfas = codJfas;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getGestione() {
|
||||
return gestione;
|
||||
}
|
||||
|
||||
public DettaglioULDTO setGestione(String gestione) {
|
||||
this.gestione = gestione;
|
||||
return this;
|
||||
}
|
||||
|
||||
public LocalDate getDataCollo() {
|
||||
return dataCollo;
|
||||
}
|
||||
|
||||
public DettaglioULDTO setDataCollo(LocalDate dataCollo) {
|
||||
this.dataCollo = dataCollo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getSerCollo() {
|
||||
return serCollo;
|
||||
}
|
||||
|
||||
public DettaglioULDTO setSerCollo(String serCollo) {
|
||||
this.serCollo = serCollo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getNumCollo() {
|
||||
return numCollo;
|
||||
}
|
||||
|
||||
public DettaglioULDTO setNumCollo(Integer numCollo) {
|
||||
this.numCollo = numCollo;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package it.integry.ems.retail.dto;
|
||||
|
||||
import it.integry.ems_model.entity.MtbAnomalieUl;
|
||||
import it.integry.ems_model.entity.MtbLivelliAnomalie;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
public class SaveAnomaliaRequestDTO {
|
||||
private Long id;
|
||||
private String descrizione;
|
||||
private String annotazioni;
|
||||
private LocalDateTime inizioAnomalia;
|
||||
private LocalDateTime fineAnomalia;
|
||||
private String codJfas;
|
||||
private Long idLivelloAnomalia;
|
||||
List<String> barcodeList;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public SaveAnomaliaRequestDTO setId(Long id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDescrizione() {
|
||||
return descrizione;
|
||||
}
|
||||
|
||||
public SaveAnomaliaRequestDTO setDescrizione(String descrizione) {
|
||||
this.descrizione = descrizione;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getAnnotazioni() {
|
||||
return annotazioni;
|
||||
}
|
||||
|
||||
public SaveAnomaliaRequestDTO setAnnotazioni(String annotazioni) {
|
||||
this.annotazioni = annotazioni;
|
||||
return this;
|
||||
}
|
||||
|
||||
public LocalDateTime getInizioAnomalia() {
|
||||
return inizioAnomalia;
|
||||
}
|
||||
|
||||
public SaveAnomaliaRequestDTO setInizioAnomalia(LocalDateTime inizioAnomalia) {
|
||||
this.inizioAnomalia = inizioAnomalia;
|
||||
return this;
|
||||
}
|
||||
|
||||
public LocalDateTime getFineAnomalia() {
|
||||
return fineAnomalia;
|
||||
}
|
||||
|
||||
public SaveAnomaliaRequestDTO setFineAnomalia(LocalDateTime fineAnomalia) {
|
||||
this.fineAnomalia = fineAnomalia;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodJfas() {
|
||||
return codJfas;
|
||||
}
|
||||
|
||||
public SaveAnomaliaRequestDTO setCodJfas(String codJfas) {
|
||||
this.codJfas = codJfas;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Long getIdLivelloAnomalia() {
|
||||
return idLivelloAnomalia;
|
||||
}
|
||||
|
||||
public SaveAnomaliaRequestDTO setIdLivelloAnomalia(Long idLivelloAnomalia) {
|
||||
this.idLivelloAnomalia = idLivelloAnomalia;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<String> getBarcodeList() {
|
||||
return barcodeList;
|
||||
}
|
||||
|
||||
public SaveAnomaliaRequestDTO setBarcodeList(List<String> barcodeList) {
|
||||
this.barcodeList = barcodeList;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package it.integry.ems.retail.dto;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
public class SaveLivelloAnomaliaRequestDTO {
|
||||
private Long id;
|
||||
private String descrizione;
|
||||
private String hexColore;
|
||||
private Boolean escludiPickingVendita = false;
|
||||
private Boolean escludiPickingLavorazione = false;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public SaveLivelloAnomaliaRequestDTO setId(Long id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDescrizione() {
|
||||
return descrizione;
|
||||
}
|
||||
|
||||
public SaveLivelloAnomaliaRequestDTO setDescrizione(String descrizione) {
|
||||
this.descrizione = descrizione;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getHexColore() {
|
||||
return hexColore;
|
||||
}
|
||||
|
||||
public SaveLivelloAnomaliaRequestDTO setHexColore(String hexColore) {
|
||||
this.hexColore = hexColore;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Boolean getEscludiPickingVendita() {
|
||||
return escludiPickingVendita;
|
||||
}
|
||||
|
||||
public SaveLivelloAnomaliaRequestDTO setEscludiPickingVendita(Boolean escludiPickingVendita) {
|
||||
this.escludiPickingVendita = escludiPickingVendita;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Boolean getEscludiPickingLavorazione() {
|
||||
return escludiPickingLavorazione;
|
||||
}
|
||||
|
||||
public SaveLivelloAnomaliaRequestDTO setEscludiPickingLavorazione(Boolean escludiPickingLavorazione) {
|
||||
this.escludiPickingLavorazione = escludiPickingLavorazione;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,176 @@
|
||||
package it.integry.ems.retail.service;
|
||||
|
||||
import it.integry.ems.dynamic_cache.EntityCacheComponent;
|
||||
import it.integry.ems.production.agribook.model.AgribookOrderDTO;
|
||||
import it.integry.ems.retail.dto.AnomalieMerceDTO;
|
||||
import it.integry.ems.retail.dto.DettaglioULDTO;
|
||||
import it.integry.ems.retail.dto.SaveAnomaliaRequestDTO;
|
||||
import it.integry.ems.retail.dto.SaveLivelloAnomaliaRequestDTO;
|
||||
import it.integry.ems.retail.wms.Utility.WMSUtility;
|
||||
import it.integry.ems.retail.wms.generic.dto.MvwSitArtUdcDetInventarioDTO;
|
||||
import it.integry.ems.service.EntityProcessor;
|
||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems.utility.UtilityEntity;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import it.integry.ems_model.config.EmsRestConstants;
|
||||
import it.integry.ems_model.entity.MtbAart;
|
||||
import it.integry.ems_model.entity.MtbAnomalieUl;
|
||||
import it.integry.ems_model.entity.MtbColt;
|
||||
import it.integry.ems_model.entity.MtbLivelliAnomalie;
|
||||
import it.integry.ems_model.types.OperationType;
|
||||
import it.integry.ems_model.utility.*;
|
||||
import it.integry.ems_model.utility.dto.PageableRequestDTO;
|
||||
import it.integry.ems_model.utility.dto.PaginatedDTO;
|
||||
import org.jfree.util.ObjectList;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@Service
|
||||
public class AnomalieUlService {
|
||||
|
||||
private final EntityCacheComponent entityCacheComponent;
|
||||
private final EntityProcessor entityProcessor;
|
||||
|
||||
public AnomalieUlService(EntityCacheComponent entityCacheComponent, EntityProcessor entityProcessor) {
|
||||
this.entityCacheComponent = entityCacheComponent;
|
||||
this.entityProcessor = entityProcessor;
|
||||
}
|
||||
|
||||
public PaginatedDTO<AnomalieMerceDTO> getAnomalieProd(PageableRequestDTO requestDTO, Connection connection) throws Exception {
|
||||
|
||||
List<MtbLivelliAnomalie> livelliAnomalie = UtilityDB.executeSimpleQueryDTO(connection, "Select * from " + MtbLivelliAnomalie.ENTITY, MtbLivelliAnomalie.class);
|
||||
if (UtilityString.isNullOrEmpty(livelliAnomalie))
|
||||
return new PaginatedDTO<>();
|
||||
|
||||
Map<Long, MtbLivelliAnomalie> mapLivelliAnomalie = livelliAnomalie.stream().collect(Collectors.toMap(MtbLivelliAnomalie::getId, x -> x));
|
||||
String sql = "SELECT * from mtb_anomalie_ul";
|
||||
PaginatedDTO<AnomalieMerceDTO> results = UtilityDB.executePaginatedQueryDTO(connection, sql, AnomalieMerceDTO.class, requestDTO);
|
||||
List<HashMap<String,Object>> barcodes;
|
||||
if (!UtilityList.isNullOrEmpty(results.getData())) {
|
||||
List<Long> ids = results.getData().stream().map(AnomalieMerceDTO::getId).collect(Collectors.toList());
|
||||
barcodes = UtilityDB.executeSimpleQuery(connection,
|
||||
"SELECT id_anomalia, barcode_ul from mtb_colt where id_anomalia in (" + UtilityDB.listValueToString(ids) + ")"
|
||||
);
|
||||
} else {
|
||||
barcodes = new ArrayList<>();
|
||||
}
|
||||
|
||||
results.getData().forEach(x -> {
|
||||
x.setBarcodeList(barcodes.stream().filter(y->x.getId().equals(y.get("id_anomalia"))).map(y->y.get("barcode_ul").toString()).collect(Collectors.toList()));
|
||||
x.setLivelloAnomalia(mapLivelliAnomalie.get(x.getIdLivelloAnomalia()));
|
||||
});
|
||||
return results;
|
||||
}
|
||||
|
||||
public List<DettaglioULDTO> getUlAnomalia(Connection connection, Long idAnomalia) throws Exception {
|
||||
List<DettaglioULDTO> ulDetails = UtilityDB.executeSimpleQueryDTO(connection, "select mtb_colt.gestione, mtb_colt.ser_collo, mtb_colt.data_collo, mtb_colt.num_collo, barcode_ul, cod_mart, progressivo_ul, qta_col, cod_jfas\n" +
|
||||
"from mtb_colt\n" +
|
||||
" inner join mtb_colr on mtb_colt.gestione = mtb_colr.gestione and mtb_colt.data_collo = mtb_colr.data_collo and\n" +
|
||||
" mtb_colt.num_collo = mtb_colr.num_collo and mtb_colt.ser_collo = mtb_colr.ser_collo\n" +
|
||||
"where id_anomalia = " + idAnomalia, DettaglioULDTO.class);
|
||||
|
||||
if (UtilityList.isNullOrEmpty(ulDetails))
|
||||
return new ArrayList<>();
|
||||
|
||||
List<String> codMarts = ulDetails.stream().map(DettaglioULDTO::getCodMart).distinct().collect(Collectors.toList());
|
||||
Map<String, MtbAart> artMap = entityCacheComponent.<MtbAart>getCachedEntitiesStream(connection.getIntegryCustomerDB(), MtbAart.ENTITY, art -> codMarts.contains(art.getCodMart())).collect(Collectors.toMap(MtbAart::getCodMart, x -> x));
|
||||
ulDetails.forEach(ul -> {
|
||||
MtbAart art = artMap.get(ul.getCodMart());
|
||||
ul.setDescrizione(art.getDescrizione())
|
||||
.setDescrizioneEstesa(art.getDescrizioneEstesa())
|
||||
.setUntMis(art.getUntMis());
|
||||
});
|
||||
|
||||
return ulDetails;
|
||||
}
|
||||
|
||||
public List<MtbColt> detachUls(MultiDBTransactionManager multiDBTransactionManager, Long idAnomalia, List<String> ulsToRemove) throws Exception {
|
||||
String sql = "SELECT * from mtb_colt where barcode_ul in (" + UtilityDB.listValueToString(ulsToRemove) + ") and id_anomalia = " + idAnomalia;
|
||||
|
||||
List<MtbColt> uls = UtilityDB.executeSimpleQueryDTO(multiDBTransactionManager.getPrimaryConnection(), sql, MtbColt.class);
|
||||
|
||||
uls.forEach(x -> x.setIdAnomalia(EmsRestConstants.LONG_NULL).setOperation(OperationType.UPDATE));
|
||||
entityProcessor.processEntityList(uls, multiDBTransactionManager, true);
|
||||
return uls;
|
||||
}
|
||||
|
||||
public MtbAnomalieUl saveAnomalia(MultiDBTransactionManager multiDBTransactionManager, SaveAnomaliaRequestDTO saveRequestDTO) throws Exception {
|
||||
|
||||
MtbAnomalieUl anomalia = new MtbAnomalieUl();
|
||||
anomalia.setId(UtilityLong.isNullOrZero(saveRequestDTO.getId()) ? null : saveRequestDTO.getId())
|
||||
.setDescrizione(saveRequestDTO.getDescrizione())
|
||||
.setIdLivelloAnomalia(saveRequestDTO.getIdLivelloAnomalia())
|
||||
.setAnnotazioni(saveRequestDTO.getAnnotazioni())
|
||||
.setInizioAnomalia(saveRequestDTO.getInizioAnomalia())
|
||||
.setFineAnomalia(saveRequestDTO.getFineAnomalia())
|
||||
.setCodJfas(saveRequestDTO.getCodJfas())
|
||||
.setOperation(OperationType.INSERT_OR_UPDATE);
|
||||
entityProcessor.processEntity(anomalia, true, multiDBTransactionManager);
|
||||
|
||||
if (!UtilityList.isNullOrEmpty(saveRequestDTO.getBarcodeList())) {
|
||||
List<MtbColt> ulsAffected = new ArrayList<>();
|
||||
getUlAnomalia(multiDBTransactionManager.getPrimaryConnection(), anomalia.getId()).stream().forEach(x -> {
|
||||
if (!saveRequestDTO.getBarcodeList().contains(x.getBarcodeUl())) {
|
||||
MtbColt mtbColt = new MtbColt(x.getGestione(), x.getDataCollo(), x.getNumCollo(), x.getSerCollo());
|
||||
mtbColt.setIdAnomalia(EmsRestConstants.LONG_NULL).setOperation(OperationType.UPDATE);
|
||||
ulsAffected.add(mtbColt);
|
||||
}
|
||||
});
|
||||
Map<String, MtbColt> newAnomalies = WMSUtility.retrieveUlsByBarcodes(multiDBTransactionManager.getPrimaryConnection(), saveRequestDTO.getBarcodeList()).stream().collect(Collectors.toMap(MtbColt::getBarcodeUl, x -> x));
|
||||
|
||||
saveRequestDTO.getBarcodeList().forEach(barcode -> {
|
||||
MtbColt ul = newAnomalies.get(barcode);
|
||||
if (ul == null)
|
||||
return;
|
||||
ul.setIdAnomalia(anomalia.getId()).setOperation(OperationType.UPDATE);
|
||||
ulsAffected.add(ul);
|
||||
});
|
||||
|
||||
entityProcessor.processEntityList(ulsAffected, multiDBTransactionManager, true);
|
||||
}
|
||||
|
||||
|
||||
return anomalia;
|
||||
}
|
||||
|
||||
public Object deleteAnomalia(MultiDBTransactionManager multiDBTransactionManager, Long id) throws Exception {
|
||||
List<EntityBase> entities = new ArrayList<>();
|
||||
MtbAnomalieUl anomalia = new MtbAnomalieUl();
|
||||
anomalia.setId(id)
|
||||
.setOperation(OperationType.DELETE);
|
||||
|
||||
List<MtbColt> ulAnomalia = UtilityDB.executeSimpleQueryDTO(multiDBTransactionManager.getPrimaryConnection(),
|
||||
"SELECT gestione,data_collo,ser_collo,num_collo from mtb_colt where id_anomalia = " + id,
|
||||
MtbColt.class);
|
||||
|
||||
ulAnomalia.forEach(x -> x.setIdAnomalia(EmsRestConstants.LONG_NULL).setOperation(OperationType.UPDATE));
|
||||
entities.addAll(ulAnomalia);
|
||||
entities.add(anomalia);
|
||||
entityProcessor.processEntityList(entities, multiDBTransactionManager, true);
|
||||
UtilityEntity.throwEntitiesException(entities);
|
||||
return entities;
|
||||
}
|
||||
|
||||
public List<MtbLivelliAnomalie> listaLivelliAnomalie(Connection connection) throws Exception {
|
||||
return UtilityDB.executeSimpleQueryDTO(connection, "SELECT * from " + MtbLivelliAnomalie.ENTITY, MtbLivelliAnomalie.class);
|
||||
}
|
||||
|
||||
public MtbLivelliAnomalie salvaLivelloAnomalia(MultiDBTransactionManager multiDBTransactionManager, SaveLivelloAnomaliaRequestDTO saveDto) throws Exception {
|
||||
MtbLivelliAnomalie livelloAnomalia = new MtbLivelliAnomalie();
|
||||
livelloAnomalia
|
||||
.setId(saveDto.getId())
|
||||
.setDescrizione(saveDto.getDescrizione())
|
||||
.setHexColore(saveDto.getHexColore())
|
||||
.setEscludiPickingLavorazione(saveDto.getEscludiPickingLavorazione())
|
||||
.setEscludiPickingVendita(saveDto.getEscludiPickingVendita())
|
||||
.setOperation(OperationType.INSERT_OR_UPDATE);
|
||||
livelloAnomalia.setOnlyPkMaster(false);
|
||||
entityProcessor.processEntity(livelloAnomalia, true, multiDBTransactionManager);
|
||||
return livelloAnomalia;
|
||||
}
|
||||
}
|
||||
@@ -702,6 +702,24 @@ public class WMSUtility {
|
||||
String selectSql = Query.format("SELECT mtb_depo.* FROM mtb_depo " +
|
||||
" INNER JOIN mtb_depo_tipi ON mtb_depo.flag_tipo_negozio = mtb_depo_tipi.cod_tipo_depo " +
|
||||
" WHERE mtb_depo_tipi.gestisci_colli = 1");
|
||||
return UtilityDB.executeSimpleQueryDTO(primaryConnection,selectSql,MtbDepo.class);
|
||||
return UtilityDB.executeSimpleQueryDTO(primaryConnection, selectSql, MtbDepo.class);
|
||||
}
|
||||
|
||||
public static List<String> retrieveBarcodesByBarcodeAndCodJfas(Connection primaryConnection, String barcodeUl, String codJfas, Integer maxResults) throws Exception {
|
||||
if (maxResults == null) maxResults = 100;
|
||||
String selectSql = "SELECT top " + maxResults + " barcode_ul FROM mtb_colt " +
|
||||
" WHERE barcode_ul like '%" + barcodeUl + "%'";
|
||||
if (!UtilityString.isNullOrEmpty(codJfas)) {
|
||||
selectSql += " AND cod_jfas = " + UtilityDB.valueToString(codJfas);
|
||||
}
|
||||
|
||||
selectSql += " ORDER BY barcode_ul desc";
|
||||
return UtilityDB.executeSimpleQueryOnlyFirstColumn(primaryConnection, selectSql);
|
||||
}
|
||||
|
||||
public static List<MtbColt> retrieveUlsByBarcodes(Connection connection, List<String> barcodeList) throws Exception {
|
||||
if (barcodeList == null || barcodeList.isEmpty()) return new ArrayList<>();
|
||||
|
||||
return UtilityDB.executeSimpleQueryDTO(connection,Query.format("SELECT * from mtb_colt where barcode_ul in ("+UtilityDB.listValueToString(barcodeList)+")"), MtbColt.class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ public class WMSGenericController {
|
||||
String androidAppVersionFilePath = Paths.get(UtilityDirs.getWebAppPath(), "wms", "version" + suffix + ".txt").toString();
|
||||
HttpRestWrapper.downloadFile(baseDownloadUrl + "version" + suffix + ".txt" + azureToken, androidAppVersionFilePath);
|
||||
|
||||
if(overrideForced != null ) {
|
||||
if (overrideForced != null) {
|
||||
File versionFile = new File(androidAppVersionFilePath);
|
||||
String versionFileContent = IOUtils.getFile(versionFile);
|
||||
versionFileContent = versionFileContent.replaceAll("forced=true", "forced=" + overrideForced);
|
||||
@@ -697,4 +697,12 @@ public class WMSGenericController {
|
||||
ServiceRestResponse getDepositiWMS() throws Exception {
|
||||
return ServiceRestResponse.createPositiveResponse(WMSUtility.retrieveDepositiWithColli(multiDBTransactionManager.getPrimaryConnection()));
|
||||
}
|
||||
|
||||
@GetMapping("wms/barcodes/list")
|
||||
ServiceRestResponse searchBarcodes(@RequestParam(required = true) String barcodeUl,
|
||||
@RequestParam(required = false) String codJfas,
|
||||
@RequestParam(required = false) Integer maxResults
|
||||
) throws Exception {
|
||||
return ServiceRestResponse.createPositiveResponse(WMSUtility.retrieveBarcodesByBarcodeAndCodJfas(multiDBTransactionManager.getPrimaryConnection(),barcodeUl,codJfas, maxResults));
|
||||
}
|
||||
}
|
||||
@@ -109,6 +109,9 @@ public class MvwSitArtUdcDetInventarioDTO {
|
||||
@SqlField("progressivo_ul")
|
||||
private Integer progressivoUl;
|
||||
|
||||
@SqlField("id_anomalia")
|
||||
private Long idAnomalia;
|
||||
|
||||
public BigDecimal getQtaOrd() {
|
||||
return qtaOrd;
|
||||
}
|
||||
@@ -412,4 +415,13 @@ public class MvwSitArtUdcDetInventarioDTO {
|
||||
.setPartitaMag(partitaMag);
|
||||
return dto;
|
||||
}
|
||||
|
||||
public Long getIdAnomalia() {
|
||||
return idAnomalia;
|
||||
}
|
||||
|
||||
public MvwSitArtUdcDetInventarioDTO setIdAnomalia(Long idAnomalia) {
|
||||
this.idAnomalia = idAnomalia;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user