invio tracciabilità gastronimia
This commit is contained in:
@@ -0,0 +1,32 @@
|
|||||||
|
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_20250513173451 extends BaseMigration implements MigrationModelInterface {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void up() throws Exception {
|
||||||
|
if (isHistoryDB())
|
||||||
|
return;
|
||||||
|
|
||||||
|
executeStatement("UPDATE stb_gest_setup SET TIPO_SETUP = 'DTB_TIPI' where key_section = 'DAYS_TO_EXP'");
|
||||||
|
|
||||||
|
if (isCustomer(IntegryCustomer.Carelli)) {
|
||||||
|
executeStatement(
|
||||||
|
"INSERT INTO stb_gest_setup_det " +
|
||||||
|
"select gest_name, section, key_section, tipo_setup, DOC.value_string, value " +
|
||||||
|
"from stb_gest_setup " +
|
||||||
|
"CROSS APPLY (SELECT value_STRING FROM dbo.ParseStringIntoArray((SELECT DBO.GETGESTSETUP('PVM','DOC_INTERNI', 'COD_DTIP_RESO')), '|')) DOC " +
|
||||||
|
"where key_section = 'DAYS_TO_EXP' ",
|
||||||
|
"INSERT INTO stb_gest_setup_det " +
|
||||||
|
"select gest_name, section, key_section, tipo_setup, 'TAGLI', 3 from stb_gest_setup where key_section = 'DAYS_TO_EXP' ");
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void down() throws Exception {
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -155,6 +155,9 @@ public class VariazioniDettaglioDTO {
|
|||||||
private String posizioneArticolo;
|
private String posizioneArticolo;
|
||||||
@MapToTable (value = "intercode_xml_variazioni")
|
@MapToTable (value = "intercode_xml_variazioni")
|
||||||
private String intercodeXmlVariazioni;
|
private String intercodeXmlVariazioni;
|
||||||
|
@MapToTable (value = "partita_mag")
|
||||||
|
private String partitaMag;
|
||||||
|
|
||||||
public Date getDataVariazione() {
|
public Date getDataVariazione() {
|
||||||
return dataVariazione;
|
return dataVariazione;
|
||||||
}
|
}
|
||||||
@@ -820,4 +823,13 @@ public class VariazioniDettaglioDTO {
|
|||||||
this.intercodeXmlVariazioni = intercodeXmlVariazioni;
|
this.intercodeXmlVariazioni = intercodeXmlVariazioni;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getPartitaMag() {
|
||||||
|
return partitaMag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public VariazioniDettaglioDTO setPartitaMag(String partitaMag) {
|
||||||
|
this.partitaMag = partitaMag;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,8 @@ public enum VariazioniReportType {
|
|||||||
VARIAZIONI("V"),
|
VARIAZIONI("V"),
|
||||||
GRIGLIA("G"),
|
GRIGLIA("G"),
|
||||||
PROMOZIONI("P"),
|
PROMOZIONI("P"),
|
||||||
LISTINO("L");
|
LISTINO("L"),
|
||||||
|
TRACCIABILITA("T");
|
||||||
|
|
||||||
private String text;
|
private String text;
|
||||||
|
|
||||||
|
|||||||
@@ -418,7 +418,7 @@ public class VariazioniPvService {
|
|||||||
inviaIngrOpz = invioIngredientiSetup;
|
inviaIngrOpz = invioIngredientiSetup;
|
||||||
}
|
}
|
||||||
String ingredienti = UtilityString.streNull(var.getIngredienti());
|
String ingredienti = UtilityString.streNull(var.getIngredienti());
|
||||||
IngredientiType ingredientiType = getIngredienti(objectFactory, codMart, variazioniPvInputDTO.getDataValidita(), variazioniPvInputDTO.getTipoReportEnum(), tipoVariazioneLisv, inviaIngrOpz, ingredienti);
|
IngredientiType ingredientiType = getIngredienti(objectFactory, codMart, variazioniPvInputDTO.getDataValidita(), variazioniPvInputDTO.getTipoReportEnum(), tipoVariazioneLisv, inviaIngrOpz, ingredienti, var.getPartitaMag());
|
||||||
codMartType.getContent().add(objectFactory.createCodMartTypeIngredienti(ingredientiType));
|
codMartType.getContent().add(objectFactory.createCodMartTypeIngredienti(ingredientiType));
|
||||||
|
|
||||||
//COMPONENTI
|
//COMPONENTI
|
||||||
@@ -519,7 +519,10 @@ public class VariazioniPvService {
|
|||||||
|
|
||||||
String queryAssortimento = getQueryAssortimento(variazioniPvDTO, setup, codVlis, selezionaGriglie);
|
String queryAssortimento = getQueryAssortimento(variazioniPvDTO, setup, codVlis, selezionaGriglie);
|
||||||
String query =
|
String query =
|
||||||
"SELECT listino.cod_vlis,\n" +
|
(variazioniPvDTO.getTipoReportEnum() == VariazioniReportType.TRACCIABILITA ?
|
||||||
|
queryAssortimento :
|
||||||
|
"WHIT assortimento (" + queryAssortimento + ")") +
|
||||||
|
"SELECT listino.cod_vlis,\n" +
|
||||||
" listino.descrizione AS 'descr_lisv',\n" +
|
" listino.descrizione AS 'descr_lisv',\n" +
|
||||||
" listino.flag_list_iva_inclusa,\n" +
|
" listino.flag_list_iva_inclusa,\n" +
|
||||||
" ISNULL(assortimento.cod_mart_view, listino.cod_mart) AS 'cod_mart',\n" +
|
" ISNULL(assortimento.cod_mart_view, listino.cod_mart) AS 'cod_mart',\n" +
|
||||||
@@ -616,8 +619,9 @@ public class VariazioniPvService {
|
|||||||
" THEN listino.cod_vlis + '_' + CAST(promozione.versione AS VARCHAR)\n" +
|
" THEN listino.cod_vlis + '_' + CAST(promozione.versione AS VARCHAR)\n" +
|
||||||
" ELSE NULL END AS 'id_promo',\n" +
|
" ELSE NULL END AS 'id_promo',\n" +
|
||||||
" mtb_aart.posizione AS 'posizione_art',\n" +
|
" mtb_aart.posizione AS 'posizione_art',\n" +
|
||||||
" promozione.intercode_xml_variazioni AS 'intercode_xml_variazioni'\n" +
|
" promozione.intercode_xml_variazioni AS 'intercode_xml_variazioni',\n" +
|
||||||
"FROM (" + queryAssortimento + ") assortimento\n" +
|
" assortimento.partita_mag \n" +
|
||||||
|
"FROM assortimento\n" +
|
||||||
" INNER JOIN dbo.getlistinovendita('[DATA_VARIAZIONE]', '[COD_VLIS]', NULL) listino\n" +
|
" INNER JOIN dbo.getlistinovendita('[DATA_VARIAZIONE]', '[COD_VLIS]', NULL) listino\n" +
|
||||||
" ON assortimento.cod_vlis = listino.cod_vlis AND assortimento.cod_mart = listino.cod_mart and listino.data_iniz is not null\n" +
|
" ON assortimento.cod_vlis = listino.cod_vlis AND assortimento.cod_mart = listino.cod_mart and listino.data_iniz is not null\n" +
|
||||||
" INNER JOIN mtb_aart ON listino.cod_mart = mtb_aart.cod_mart\n" +
|
" INNER JOIN mtb_aart ON listino.cod_mart = mtb_aart.cod_mart\n" +
|
||||||
@@ -669,7 +673,7 @@ public class VariazioniPvService {
|
|||||||
String queryAssortimento = null;
|
String queryAssortimento = null;
|
||||||
|
|
||||||
LocalDateTime dataInvioPrec = null;
|
LocalDateTime dataInvioPrec = null;
|
||||||
if (!UtilityString.isNullOrEmpty(variazioniPvDTO.getOraInvioPrec() )){
|
if (!UtilityString.isNullOrEmpty(variazioniPvDTO.getOraInvioPrec())) {
|
||||||
dataInvioPrec = UtilityLocalDate.addHourToLocalDate(LocalDate.now(), variazioniPvDTO.getOraInvioPrec());
|
dataInvioPrec = UtilityLocalDate.addHourToLocalDate(LocalDate.now(), variazioniPvDTO.getOraInvioPrec());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -684,7 +688,8 @@ public class VariazioniPvService {
|
|||||||
" lisv.cod_mart, " +
|
" lisv.cod_mart, " +
|
||||||
" 'A' as tipo_variazione, " +
|
" 'A' as tipo_variazione, " +
|
||||||
" Convert(varchar(15), null ) as 'cod_mart_view', " +
|
" Convert(varchar(15), null ) as 'cod_mart_view', " +
|
||||||
" 'N' as 'fine_promo' " +
|
" 'N' as 'fine_promo', " +
|
||||||
|
" Convert(varchar(25), null ) as lotto\n" +
|
||||||
" FROM mtb_lisv lisv " +
|
" FROM mtb_lisv lisv " +
|
||||||
" WHERE lisv.cod_vlis = %s ",
|
" WHERE lisv.cod_vlis = %s ",
|
||||||
codVlis);
|
codVlis);
|
||||||
@@ -697,7 +702,8 @@ public class VariazioniPvService {
|
|||||||
" mtb_lisv_data.cod_mart,\n" +
|
" mtb_lisv_data.cod_mart,\n" +
|
||||||
" 'P' AS tipo_variazione,\n" +
|
" 'P' AS tipo_variazione,\n" +
|
||||||
" CONVERT(VARCHAR(15), NULL) AS 'cod_mart_view',\n" +
|
" CONVERT(VARCHAR(15), NULL) AS 'cod_mart_view',\n" +
|
||||||
" 'N' AS 'fine_promo'\n" +
|
" 'N' AS 'fine_promo',\n" +
|
||||||
|
" Convert(varchar(25), null ) as lotto\n" +
|
||||||
"FROM vtb_list_data\n" +
|
"FROM vtb_list_data\n" +
|
||||||
" INNER JOIN mtb_lisv_data\n" +
|
" INNER JOIN mtb_lisv_data\n" +
|
||||||
" ON ISNULL(vtb_list_data.cod_vlis_rif, vtb_list_data.cod_vlis) = mtb_lisv_data.cod_vlis AND\n" +
|
" ON ISNULL(vtb_list_data.cod_vlis_rif, vtb_list_data.cod_vlis) = mtb_lisv_data.cod_vlis AND\n" +
|
||||||
@@ -705,13 +711,14 @@ public class VariazioniPvService {
|
|||||||
"WHERE vtb_list_data.data_iniz = '[DATA_VALIDITA]'\n" +
|
"WHERE vtb_list_data.data_iniz = '[DATA_VALIDITA]'\n" +
|
||||||
" AND vtb_list_data.cod_vlis = '[COD_VLIS]'\n" +
|
" AND vtb_list_data.cod_vlis = '[COD_VLIS]'\n" +
|
||||||
" AND vtb_list_data.cod_promo IS NULL\n" +
|
" AND vtb_list_data.cod_promo IS NULL\n" +
|
||||||
(variazioniPvDTO.getOraInvioPrec() ==null?"":"AND mtb_lisv_data.data_agg_prz > " + UtilityDB.valueToString(dataInvioPrec)) +
|
(variazioniPvDTO.getOraInvioPrec() == null ? "" : "AND mtb_lisv_data.data_agg_prz > " + UtilityDB.valueToString(dataInvioPrec)) +
|
||||||
"UNION\n" +
|
"UNION\n" +
|
||||||
"SELECT vtb_list_data.cod_vlis,\n" +
|
"SELECT vtb_list_data.cod_vlis,\n" +
|
||||||
" mtb_lisv_data.cod_mart,\n" +
|
" mtb_lisv_data.cod_mart,\n" +
|
||||||
" 'P' AS tipo_variazione,\n" +
|
" 'P' AS tipo_variazione,\n" +
|
||||||
" CONVERT(VARCHAR(15), NULL) AS 'cod_mart_view',\n" +
|
" CONVERT(VARCHAR(15), NULL) AS 'cod_mart_view',\n" +
|
||||||
" 'N' AS 'fine_promo'\n" +
|
" 'N' AS 'fine_promo',\n" +
|
||||||
|
" Convert(varchar(25), null ) as lotto\n" +
|
||||||
"FROM vtb_list_data\n" +
|
"FROM vtb_list_data\n" +
|
||||||
" INNER JOIN mtb_lisv_data ON vtb_list_data.cod_vlis = mtb_lisv_data.cod_vlis AND\n" +
|
" INNER JOIN mtb_lisv_data ON vtb_list_data.cod_vlis = mtb_lisv_data.cod_vlis AND\n" +
|
||||||
" vtb_list_data.versione = mtb_lisv_data.versione\n" +
|
" vtb_list_data.versione = mtb_lisv_data.versione\n" +
|
||||||
@@ -723,28 +730,32 @@ public class VariazioniPvService {
|
|||||||
" mtb_lisv_data.cod_mart = vr.cod_mart\n" +
|
" mtb_lisv_data.cod_mart = vr.cod_mart\n" +
|
||||||
"WHERE '[DATA_VALIDITA]' BETWEEN vtb_list_data.data_iniz AND vtb_list_data.data_fine\n" +
|
"WHERE '[DATA_VALIDITA]' BETWEEN vtb_list_data.data_iniz AND vtb_list_data.data_fine\n" +
|
||||||
" AND vtb_list_data.cod_vlis = '[COD_VLIS]'\n" +
|
" AND vtb_list_data.cod_vlis = '[COD_VLIS]'\n" +
|
||||||
(variazioniPvDTO.getOraInvioPrec() ==null?"":"AND mtb_lisv_data.data_agg_prz > " + UtilityDB.valueToString(dataInvioPrec)) +
|
(variazioniPvDTO.getOraInvioPrec() == null ? "" : "AND mtb_lisv_data.data_agg_prz > " + UtilityDB.valueToString(dataInvioPrec)) +
|
||||||
"UNION\n" +
|
"UNION\n" +
|
||||||
"SELECT lisv.cod_vlis\n" +
|
"SELECT lisv.cod_vlis\n" +
|
||||||
" , lisv.cod_mart\n" +
|
" , lisv.cod_mart\n" +
|
||||||
" , tipo_variazione\n" +
|
" , tipo_variazione\n" +
|
||||||
" , cod_mart_new\n" +
|
" , cod_mart_new\n" +
|
||||||
" , 'N' AS 'fine_promo'\n" +
|
" , 'N' AS 'fine_promo',\n" +
|
||||||
|
" Convert(varchar(25), null ) as lotto\n" +
|
||||||
"FROM (SELECT mtb_aart.cod_mart,\n" +
|
"FROM (SELECT mtb_aart.cod_mart,\n" +
|
||||||
" 'A' AS tipo_variazione,\n" +
|
" 'A' AS tipo_variazione,\n" +
|
||||||
" CONVERT(VARCHAR(15), NULL) AS cod_mart_new\n" +
|
" CONVERT(VARCHAR(15), NULL) AS cod_mart_new,\n" +
|
||||||
|
" Convert(varchar(25), null ) as lotto\n" +
|
||||||
" FROM mtb_aart\n" +
|
" FROM mtb_aart\n" +
|
||||||
" WHERE mtb_aart.data_ult_var BETWEEN dateAdd( day, -1, '[DATA_VALIDITA]') AND '[DATA_VALIDITA]'\n" +
|
" WHERE mtb_aart.data_ult_var BETWEEN dateAdd( day, -1, '[DATA_VALIDITA]') AND '[DATA_VALIDITA]'\n" +
|
||||||
" UNION\n" +
|
" UNION\n" +
|
||||||
" SELECT jtb_cicl.cod_prod,\n" +
|
" SELECT jtb_cicl.cod_prod,\n" +
|
||||||
" 'A' AS tipo_variazione,\n" +
|
" 'A' AS tipo_variazione,\n" +
|
||||||
" CONVERT(VARCHAR(15), NULL) AS cod_mart_new\n" +
|
" CONVERT(VARCHAR(15), NULL) AS cod_mart_new,\n" +
|
||||||
|
" Convert(varchar(25), null ) as lotto\n" +
|
||||||
" FROM jtb_cicl\n" +
|
" FROM jtb_cicl\n" +
|
||||||
" WHERE jtb_cicl.data_ult_var BETWEEN dateAdd( day, -1, '[DATA_VALIDITA]') AND '[DATA_VALIDITA]'\n" +
|
" WHERE jtb_cicl.data_ult_var BETWEEN dateAdd( day, -1, '[DATA_VALIDITA]') AND '[DATA_VALIDITA]'\n" +
|
||||||
" UNION\n" +
|
" UNION\n" +
|
||||||
" SELECT mtb_cambio_art.codice_nuovo,\n" +
|
" SELECT mtb_cambio_art.codice_nuovo,\n" +
|
||||||
" 'C' AS tipo_variazione,\n" +
|
" 'C' AS tipo_variazione,\n" +
|
||||||
" mtb_cambio_art.codice_vecchio\n" +
|
" mtb_cambio_art.codice_vecchio,\n" +
|
||||||
|
" Convert(varchar(25), null ) as lotto\n" +
|
||||||
" FROM mtb_cambio_art\n" +
|
" FROM mtb_cambio_art\n" +
|
||||||
" WHERE CAST(mtb_cambio_art.dataora_cambio AS DATE) BETWEEN dateAdd( day, -1, '[DATA_VALIDITA]') AND '[DATA_VALIDITA]') art\n" +
|
" WHERE CAST(mtb_cambio_art.dataora_cambio AS DATE) BETWEEN dateAdd( day, -1, '[DATA_VALIDITA]') AND '[DATA_VALIDITA]') art\n" +
|
||||||
" INNER JOIN (SELECT vtb_list.cod_vlis AS cod_vlis,\n" +
|
" INNER JOIN (SELECT vtb_list.cod_vlis AS cod_vlis,\n" +
|
||||||
@@ -765,7 +776,8 @@ public class VariazioniPvService {
|
|||||||
" atb_griglie_art.cod_mart,\n" +
|
" atb_griglie_art.cod_mart,\n" +
|
||||||
" 'G' AS tipo_variazione,\n" +
|
" 'G' AS tipo_variazione,\n" +
|
||||||
" CONVERT(VARCHAR(15), NULL) AS cod_mart_view,\n" +
|
" CONVERT(VARCHAR(15), NULL) AS cod_mart_view,\n" +
|
||||||
" 'N' AS 'fine_promo'\n" +
|
" 'N' AS 'fine_promo',\n" +
|
||||||
|
" Convert(varchar(25), null ) as lotto\n" +
|
||||||
"FROM atb_griglie_art\n" +
|
"FROM atb_griglie_art\n" +
|
||||||
" INNER JOIN mtb_depo ON atb_griglie_art.cod_mdep = mtb_depo.cod_mdep\n" +
|
" INNER JOIN mtb_depo ON atb_griglie_art.cod_mdep = mtb_depo.cod_mdep\n" +
|
||||||
"WHERE atb_griglie_art.data_validita BETWEEN DateAdd(day, -1, '[DATA_VALIDITA]') AND '[DATA_VALIDITA]'";
|
"WHERE atb_griglie_art.data_validita BETWEEN DateAdd(day, -1, '[DATA_VALIDITA]') AND '[DATA_VALIDITA]'";
|
||||||
@@ -785,7 +797,8 @@ public class VariazioniPvService {
|
|||||||
" CASE\n" +
|
" CASE\n" +
|
||||||
" WHEN MAX(vtb_list_data.data_iniz) = '[DATA_VALIDITA]' THEN 'N'\n" +
|
" WHEN MAX(vtb_list_data.data_iniz) = '[DATA_VALIDITA]' THEN 'N'\n" +
|
||||||
" WHEN vtb_promo.flag_tipo_promo = 'P' THEN 'N'\n" +
|
" WHEN vtb_promo.flag_tipo_promo = 'P' THEN 'N'\n" +
|
||||||
" ELSE 'S' END AS 'fine_promo'\n" +
|
" ELSE 'S' END AS 'fine_promo',\n" +
|
||||||
|
" Convert(varchar(25), null ) as lotto\n" +
|
||||||
"FROM vtb_list_data\n" +
|
"FROM vtb_list_data\n" +
|
||||||
" INNER JOIN mtb_lisv_data\n" +
|
" INNER JOIN mtb_lisv_data\n" +
|
||||||
" ON ISNULL(vtb_list_data.cod_vlis_rif, vtb_list_data.cod_vlis) = mtb_lisv_data.cod_vlis AND\n" +
|
" ON ISNULL(vtb_list_data.cod_vlis_rif, vtb_list_data.cod_vlis) = mtb_lisv_data.cod_vlis AND\n" +
|
||||||
@@ -809,6 +822,58 @@ public class VariazioniPvService {
|
|||||||
queryAssortimento = UtilityDB.addwhereCond(queryAssortimento, filtroPromoOrto, false);
|
queryAssortimento = UtilityDB.addwhereCond(queryAssortimento, filtroPromoOrto, false);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case TRACCIABILITA:
|
||||||
|
queryAssortimento =
|
||||||
|
"WITH doc AS (SELECT wdtb_doct.data_reg,\n" +
|
||||||
|
" wdtb_docr.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" +
|
||||||
|
" UNION ALL\n" +
|
||||||
|
" SELECT dtb_doct.data_reg, dtb_docr.cod_mart, dtb_docr.partita_mag, dtb_doct.cod_mdep, 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" +
|
||||||
|
" WHERE dtb_tipi.gestione = 'A' AND dtb_tipi.tipo_emissione = 'DIRETTA' AND dtb_tipi.segno_qta_car = 1 and flag_chk_tracciabilita = 1),\n" +
|
||||||
|
"tmp_assortimento as (" +
|
||||||
|
"SELECT mtb_depo.cod_vlis,\n" +
|
||||||
|
" kit.cod_comp as 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 doc\n" +
|
||||||
|
" INNER JOIN mtb_aart ON doc.cod_mart = mtb_aart.cod_mart\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) kit ON mtb_aart.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) = DATEADD(DD, -1, '[DATA_VALIDITA]')\n" +
|
||||||
|
" AND doc.partita_mag IS NOT NULL\n" +
|
||||||
|
" AND mtb_depo.cod_vlis = '[COD_VLIS]'\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";
|
||||||
|
|
||||||
|
queryAssortimento =
|
||||||
|
queryAssortimento
|
||||||
|
.replace("'[COD_VLIS]'", UtilityDB.valueToString(codVlis))
|
||||||
|
.replace("'[DATA_VALIDITA]'", UtilityDB.valueDateToString(variazioniPvDTO.getDataValidita(), CommonConstants.DATE_FORMAT_YMD));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -819,17 +884,23 @@ public class VariazioniPvService {
|
|||||||
|
|
||||||
String whereCond = variazioniPvDTO.getWhereCondArt();
|
String whereCond = variazioniPvDTO.getWhereCondArt();
|
||||||
String query =
|
String query =
|
||||||
"SELECT Convert(varchar(5), assortimento.cod_vlis) as cod_vlis,\n " +
|
(variazioniPvDTO.getTipoReportEnum() == VariazioniReportType.TRACCIABILITA ?
|
||||||
|
queryAssortimento :
|
||||||
|
"WHIT tmp_assortimento (" + queryAssortimento + ")") + ", " +
|
||||||
|
"assortimento as (" +
|
||||||
|
"SELECT Convert(varchar(5), assortimento.cod_vlis) as cod_vlis,\n " +
|
||||||
"Convert(varchar(15), assortimento.cod_mart) as cod_mart,\n " +
|
"Convert(varchar(15), assortimento.cod_mart) as cod_mart,\n " +
|
||||||
"Convert(varchar(1), max(assortimento.tipo_variazione)) as tipo_variazione,\n " +
|
"Convert(varchar(1), max(assortimento.tipo_variazione)) as tipo_variazione,\n " +
|
||||||
"Convert(varchar(15), assortimento.cod_mart_view) as cod_mart_view,\n " +
|
"Convert(varchar(15), assortimento.cod_mart_view) as cod_mart_view,\n " +
|
||||||
"Convert(varchar(1), max(assortimento.fine_promo)) as fine_promo\n " +
|
"Convert(varchar(1), max(assortimento.fine_promo)) as fine_promo,\n " +
|
||||||
" FROM (\n" + queryAssortimento + "\n) assortimento inner join mtb_aart on assortimento.cod_mart = mtb_aart.cod_mart\n " +
|
"Convert(varchar(25), max(assortimento.lotto)) as partita_mag\n " +
|
||||||
|
" FROM tmp_assortimento assortimento inner join mtb_aart on assortimento.cod_mart = mtb_aart.cod_mart\n " +
|
||||||
" WHERE mtb_aart.flag_incl_listino = 'S' AND\n " +
|
" WHERE mtb_aart.flag_incl_listino = 'S' AND\n " +
|
||||||
" EXISTS ( SELECT cod_barre from mvw_barcode WHERE mvw_barcode.cod_mart = mtb_aart.cod_mart )\n " +
|
" EXISTS ( SELECT cod_barre from mvw_barcode WHERE mvw_barcode.cod_mart = mtb_aart.cod_mart )\n " +
|
||||||
(UtilityString.isNullOrEmpty(whereCond) ? "" : " AND " + whereCond) +
|
(UtilityString.isNullOrEmpty(whereCond) ? "" : " AND " + whereCond) +
|
||||||
(UtilityString.isNullOrEmpty(filtroMenu) ? "" : " AND " + filtroMenu) +
|
(UtilityString.isNullOrEmpty(filtroMenu) ? "" : " AND " + filtroMenu) +
|
||||||
" GROUP BY assortimento.cod_vlis, assortimento.cod_mart, assortimento.cod_mart_view";
|
" GROUP BY assortimento.cod_vlis, assortimento.cod_mart, assortimento.cod_mart_view )";
|
||||||
|
|
||||||
return query;
|
return query;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -887,8 +958,11 @@ public class VariazioniPvService {
|
|||||||
return flagMxnType;
|
return flagMxnType;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IngredientiType getIngredienti(ObjectFactory objectFactory, String codMart, Date dataVariazioni, VariazioniReportType tipoReport, String tipoVariazioneLisv, String invioIngOpz, String ingredientiArt) throws Exception {
|
private IngredientiType getIngredienti(ObjectFactory objectFactory, String codMart, Date dataVariazioni,
|
||||||
|
VariazioniReportType tipoReport, String tipoVariazioneLisv, String invioIngOpz, String ingredientiArt,
|
||||||
|
String partitaMag) throws Exception {
|
||||||
IngredientiType ingredientiType = objectFactory.createIngredientiType();
|
IngredientiType ingredientiType = objectFactory.createIngredientiType();
|
||||||
|
String ingredientiLotto = "%s - Lotto: %s";
|
||||||
if (UtilityString.isNullOrEmpty(ingredientiArt)) {
|
if (UtilityString.isNullOrEmpty(ingredientiArt)) {
|
||||||
String whereCond = "";
|
String whereCond = "";
|
||||||
String query =
|
String query =
|
||||||
@@ -899,8 +973,9 @@ public class VariazioniPvService {
|
|||||||
" jtb_cicl.cod_prod = jtb_dist_mate.cod_prod " +
|
" jtb_cicl.cod_prod = jtb_dist_mate.cod_prod " +
|
||||||
" ORDER BY jtb_dist_mate.id_riga";
|
" ORDER BY jtb_dist_mate.id_riga";
|
||||||
|
|
||||||
if ("S".equalsIgnoreCase(invioIngOpz)) {
|
if ("S".equalsIgnoreCase(invioIngOpz) || tipoReport == VariazioniReportType.TRACCIABILITA) {
|
||||||
if (tipoReport.compareTo(VariazioniReportType.LISTINO) != 0 &&
|
if (tipoReport.compareTo(VariazioniReportType.LISTINO) != 0 &&
|
||||||
|
tipoReport != VariazioniReportType.TRACCIABILITA &&
|
||||||
!"I".equalsIgnoreCase(tipoVariazioneLisv)) {
|
!"I".equalsIgnoreCase(tipoVariazioneLisv)) {
|
||||||
whereCond = "jtb_cicl.data_ult_var = " + UtilityDB.valueDateToString(dataVariazioni, CommonConstants.DATE_FORMAT_YMD);
|
whereCond = "jtb_cicl.data_ult_var = " + UtilityDB.valueDateToString(dataVariazioni, CommonConstants.DATE_FORMAT_YMD);
|
||||||
query = UtilityDB.addwhereCond(query, whereCond, false);
|
query = UtilityDB.addwhereCond(query, whereCond, false);
|
||||||
@@ -913,6 +988,9 @@ public class VariazioniPvService {
|
|||||||
IngredientiArticoloType ingredientiArticoloType = objectFactory.createIngredientiArticoloType();
|
IngredientiArticoloType ingredientiArticoloType = objectFactory.createIngredientiArticoloType();
|
||||||
String descrIngr = UtilityString.streNull(i);
|
String descrIngr = UtilityString.streNull(i);
|
||||||
ingredientiArticoloType.setIdRiga(String.valueOf(contatore));
|
ingredientiArticoloType.setIdRiga(String.valueOf(contatore));
|
||||||
|
if (tipoReport == VariazioniReportType.TRACCIABILITA && !UtilityString.isNullOrEmpty(partitaMag) && contatore == ingredienti.size()) {
|
||||||
|
descrIngr = String.format(ingredientiLotto, descrIngr, partitaMag);
|
||||||
|
}
|
||||||
ingredientiArticoloType.setValue(descrIngr);
|
ingredientiArticoloType.setValue(descrIngr);
|
||||||
ingredientiType.getIngredientiArticolo().add(ingredientiArticoloType);
|
ingredientiType.getIngredientiArticolo().add(ingredientiArticoloType);
|
||||||
contatore++;
|
contatore++;
|
||||||
@@ -920,6 +998,9 @@ public class VariazioniPvService {
|
|||||||
} else {
|
} else {
|
||||||
IngredientiArticoloType ingredientiArticoloType = objectFactory.createIngredientiArticoloType();
|
IngredientiArticoloType ingredientiArticoloType = objectFactory.createIngredientiArticoloType();
|
||||||
ingredientiArticoloType.setIdRiga("1");
|
ingredientiArticoloType.setIdRiga("1");
|
||||||
|
if (tipoReport == VariazioniReportType.TRACCIABILITA && !UtilityString.isNullOrEmpty(partitaMag) ) {
|
||||||
|
ingredientiArt = String.format(ingredientiLotto, ingredientiArt, partitaMag);
|
||||||
|
}
|
||||||
ingredientiArticoloType.setValue(ingredientiArt);
|
ingredientiArticoloType.setValue(ingredientiArt);
|
||||||
ingredientiType.getIngredientiArticolo().add(ingredientiArticoloType);
|
ingredientiType.getIngredientiArticolo().add(ingredientiArticoloType);
|
||||||
}
|
}
|
||||||
@@ -1203,7 +1284,7 @@ public class VariazioniPvService {
|
|||||||
false, null);
|
false, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}catch (Exception e ){
|
} catch (Exception e) {
|
||||||
if (!UtilityString.isNullOrEmpty(emailForLog)) {
|
if (!UtilityString.isNullOrEmpty(emailForLog)) {
|
||||||
mailService.sendMailPrimary(multiDBTransactionManager,
|
mailService.sendMailPrimary(multiDBTransactionManager,
|
||||||
null, null,
|
null, null,
|
||||||
@@ -1334,7 +1415,7 @@ public class VariazioniPvService {
|
|||||||
|
|
||||||
String emailForLog = setupGest.getExportSetup(multiDBTransactionManager.getPrimaryConnection(), exportType, formatFile, "EMAIL_FOR_OK");
|
String emailForLog = setupGest.getExportSetup(multiDBTransactionManager.getPrimaryConnection(), exportType, formatFile, "EMAIL_FOR_OK");
|
||||||
int numVariazioni = variazioniPvInputDTO.getVariazioni().size();
|
int numVariazioni = variazioniPvInputDTO.getVariazioni().size();
|
||||||
if (!UtilityString.isNullOrEmpty(emailForLog) && numVariazioni > 0 ) {
|
if (!UtilityString.isNullOrEmpty(emailForLog) && numVariazioni > 0) {
|
||||||
String oggetto =
|
String oggetto =
|
||||||
"Esportazione " +
|
"Esportazione " +
|
||||||
variazioniPvInputDTO.getTipoReportEnum().toString() +
|
variazioniPvInputDTO.getTipoReportEnum().toString() +
|
||||||
|
|||||||
@@ -1950,14 +1950,21 @@ public class PvmService {
|
|||||||
chkTracciabilita = true;
|
chkTracciabilita = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (UtilityDebug.isDebugExecution()) {
|
// if (UtilityDebug.isDebugExecution()) {
|
||||||
chkTracciabilita = true;
|
// chkTracciabilita = true;
|
||||||
checkResi = true;
|
// checkResi = true;
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (chkTracciabilita) {
|
if (chkTracciabilita) {
|
||||||
String gg = setupGest.getSetup("PVM", "DOC_INTERNI", "DAYS_TO_EXP");
|
List<HashMap<String, Object>> setupSectionDet = setupGest.getSetupSectionDet(multiDBTransactionManager.getPrimaryConnection(), "PVM", "DOC_INTERNI", "DAYS_TO_EXP", "dtb_tipi");
|
||||||
|
|
||||||
|
String gg ="";
|
||||||
|
if (setupSectionDet != null && !setupSectionDet.isEmpty()) {
|
||||||
|
gg = setupSectionDet
|
||||||
|
.stream()
|
||||||
|
.filter(x -> x.get("val_col_rif") != null && ((String) x.get("val_col_rif")).equalsIgnoreCase(codDtip))
|
||||||
|
.findFirst().map(x -> (String) x.get("value")).orElse(null);
|
||||||
|
}
|
||||||
sql =
|
sql =
|
||||||
Query.format(
|
Query.format(
|
||||||
"WITH " +
|
"WITH " +
|
||||||
@@ -2113,6 +2120,11 @@ public class PvmService {
|
|||||||
if (qtaAcq != null && UtilityBigDecimal.greaterThan(UtilityHashMap.getValueIfExists(lotto, "qta_col"), qtaAcq)) {
|
if (qtaAcq != null && UtilityBigDecimal.greaterThan(UtilityHashMap.getValueIfExists(lotto, "qta_col"), qtaAcq)) {
|
||||||
anomalieResiDTO.add(setAnomalia(anomalieResiDTO, codMart, dataScad, String.format("Quantità resa maggiore di quantità acquistata %s", qtaAcq)));
|
anomalieResiDTO.add(setAnomalia(anomalieResiDTO, codMart, dataScad, String.format("Quantità resa maggiore di quantità acquistata %s", qtaAcq)));
|
||||||
}
|
}
|
||||||
|
} else if (!UtilityString.isNullOrEmpty(gg)) {
|
||||||
|
if (UtilityDate.DaysAfter(UtilityDate.getTodayWithoutTime(), dataScad) > Integer.parseInt(gg)) {
|
||||||
|
anomalieResiDTO.add(setAnomalia(anomalieResiDTO, codMart, dataScad, String.format("Impossibile effetture un %S di un articolo con scadenza %s.", codDtip, UtilityDate.formatDate(dataScad, CommonConstants.DATE_FORMAT_DMY))));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user