Compare commits
43 Commits
feature-re
...
ababbf6142
| Author | SHA1 | Date | |
|---|---|---|---|
| ababbf6142 | |||
| e97fd0aacb | |||
| a9be8f7003 | |||
| 7522092a12 | |||
| 4dc0174800 | |||
| a04b2fa4a1 | |||
| 04317470c6 | |||
| 187216dd9f | |||
| e11172a90f | |||
| 51d5b05bd3 | |||
| 3a2ceaf217 | |||
| c783f69a49 | |||
| 1c8695095b | |||
| fc28af761c | |||
| fd4db5ab3b | |||
| f7e1d1f6ca | |||
| 0b8f82f041 | |||
| 99680dccd8 | |||
| e948855fc0 | |||
| 0854acacfb | |||
| 1aba141c9f | |||
| 741cb960d4 | |||
| 313bfc21ff | |||
| 36f50ad846 | |||
| 4e3d15ebd8 | |||
| 8afa01d8ef | |||
| db1949b5b6 | |||
| 92cd4b1af5 | |||
| 671c2e99d0 | |||
| e8a1a8ca0b | |||
| 78dbf9f7e3 | |||
| 1d52f79337 | |||
| 0e1adccb7c | |||
| fa76a8e92d | |||
| 9b34a51bd9 | |||
| b75f7e3810 | |||
| 4aeccdfa76 | |||
| 39db8e6e1b | |||
| 1b87cacca2 | |||
| 326bd4294e | |||
| e887aceaaf | |||
| 55f23b2dfc | |||
| 1ef49b87e8 |
@@ -32,6 +32,7 @@ public class DbmsChangeTrackerComponent {
|
||||
add(MtbAartBarCode.ENTITY);
|
||||
add(MtbUntMis.ENTITY);
|
||||
add(MtbDepo.ENTITY);
|
||||
add(MtbDepoPosizioni.ENTITY);
|
||||
add(StbEditLimit.ENTITY);
|
||||
add(StbGestSetup.ENTITY);
|
||||
add(StbGestSetupDepo.ENTITY);
|
||||
|
||||
@@ -57,6 +57,7 @@ public class EntityCacheComponent implements ApplicationListener {
|
||||
put(MtbAartBarCode.ENTITY, MtbAartBarCode.class);
|
||||
put(MtbUntMis.ENTITY, MtbUntMis.class);
|
||||
put(MtbDepo.ENTITY, MtbDepo.class);
|
||||
put(MtbDepoPosizioni.ENTITY, MtbDepoPosizioni.class);
|
||||
put(StbEditLimit.ENTITY, StbEditLimit.class);
|
||||
put(StbGestSetup.ENTITY, StbGestSetup.class);
|
||||
put(StbGestSetupDepo.ENTITY, StbGestSetupDepo.class);
|
||||
|
||||
@@ -119,8 +119,10 @@ public enum IntegryCustomer {
|
||||
IntegryCustomerDB.Suit_TenutaArianna,
|
||||
IntegryCustomerDB.Suit_Valpietro),
|
||||
Tempesta(IntegryCustomerDB.Tempesta_Tempesta,
|
||||
IntegryCustomerDB.Tempesta_DI,
|
||||
IntegryCustomerDB.Tempesta_VivaiTempesta,
|
||||
IntegryCustomerDB.Tempesta_DI),
|
||||
IntegryCustomerDB.Tempesta_VivaiTempesta_DI
|
||||
),
|
||||
Tosca(IntegryCustomerDB.Tosca_Ba,
|
||||
IntegryCustomerDB.Tosca_Ce,
|
||||
IntegryCustomerDB.Tosca_Cz,
|
||||
|
||||
@@ -198,8 +198,9 @@ public enum IntegryCustomerDB {
|
||||
|
||||
|
||||
Tempesta_Tempesta("tempesta"),
|
||||
Tempesta_VivaiTempesta("vivaitempesta"),
|
||||
Tempesta_DI("tempestadi"),
|
||||
Tempesta_VivaiTempesta("vivaitempesta"),
|
||||
Tempesta_VivaiTempesta_DI("vivaitempestadi"),
|
||||
|
||||
|
||||
Tosca_Ba("tosca_ba"),
|
||||
|
||||
@@ -13,6 +13,10 @@ public class Migration_20251201105344 extends BaseMigration implements Migration
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
|
||||
createOrUpdateTrigger("tr_changeTipoRiep", "CREATE TRIGGER [dbo].[tr_changeTipoRiep]\n" +
|
||||
" ON [dbo].[ctb_cont]\n" +
|
||||
" INSTEAD OF update\n" +
|
||||
|
||||
@@ -10,6 +10,10 @@ public class Migration_20251202161223 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
|
||||
createOrUpdateView("cvw_saldo_scad", "CREATE VIEW dbo.cvw_saldo_scad\n" +
|
||||
" WITH SCHEMABINDING\n" +
|
||||
" AS\n" +
|
||||
|
||||
@@ -10,6 +10,9 @@ public class Migration_20251203121227 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
|
||||
createOrUpdateFunction("f_AggiungiGiorniScad", "CREATE FUNCTION [dbo].[f_AggiungiGiorniScad](@dataIniz DateTime, @giorni int, @ls_dataRif varchar(20)) \n" +
|
||||
"RETURNS dateTime\n" +
|
||||
|
||||
@@ -10,6 +10,10 @@ public class Migration_20251205101442 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
|
||||
executeStatement("alter table srl_activity_type_user add activity_default bit not null default 0;\n",
|
||||
"CREATE UNIQUE INDEX ux_srl_activity_type_user_default\n" +
|
||||
"ON srl_activity_type_user (user_name, flag_tipologia)\n" +
|
||||
|
||||
@@ -10,6 +10,9 @@ public class Migration_20251205111526 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
|
||||
createOrUpdateView("mvw_sitart_udc_det_all","CREATE VIEW [dbo].[mvw_sitart_udc_det_all] AS\n" +
|
||||
"WITH SitMtbColr AS (\n" +
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251209113110 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
executeStatement("alter table mtb_aart alter column ingredienti varchar(8000)");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251209154901 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
executeStatement(
|
||||
"insert into mtb_unt_mis ( unt_mis)\n" +
|
||||
"select *\n" +
|
||||
"from (\n" +
|
||||
"select unt_mis\n" +
|
||||
"from mtb_aart\n" +
|
||||
"union\n" +
|
||||
"select unt_mis2\n" +
|
||||
"from mtb_aart\n" +
|
||||
"where unt_mis2 is not null\n" +
|
||||
"union\n" +
|
||||
"select unt_mis3\n" +
|
||||
"from mtb_aart\n" +
|
||||
"where unt_mis3 is not null\n" +
|
||||
") um \n" +
|
||||
"where not exists (select 1 from mtb_unt_mis where mtb_unt_mis.unt_mis = um.unt_mis )",
|
||||
"ALTER TABLE MTB_AART ADD CONSTRAINT FK_MTB_AART_UNT_MIS FOREIGN KEY (UNT_MIS) REFERENCES DBO.MTB_UNT_MIS (UNT_MIS)",
|
||||
"ALTER TABLE MTB_AART ALTER COLUMN UNT_MIS2 VARCHAR(3)",
|
||||
"ALTER TABLE MTB_AART ADD CONSTRAINT FK_MTB_AART_UNT_MIS2 FOREIGN KEY (UNT_MIS2) REFERENCES DBO.MTB_UNT_MIS (UNT_MIS)",
|
||||
"ALTER TABLE MTB_AART ADD CONSTRAINT FK_MTB_AART_UNT_MIS3 FOREIGN KEY (UNT_MIS3) REFERENCES DBO.MTB_UNT_MIS (UNT_MIS)" );
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251210095206 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
executeStatement("ALTER TABLE mtb_aart_anag ADD cod_vdes varchar(5);");
|
||||
|
||||
if(isCustomerDb(IntegryCustomerDB.Carelli_Format) && isCustomerDb(IntegryCustomerDB.Carelli_GestFood)){
|
||||
executeStatement("delete from mtb_aart_anag\n" +
|
||||
"from (\n" +
|
||||
"select cod_mart, cod_mart_anag, cod_anag, ROW_NUMBER() over (partition by cod_mart, cod_anag order by cod_mart, cod_mart_anag, cod_anag ) as id\n" +
|
||||
"from mtb_aart_anag ) m inner join mtb_aart_anag on m.cod_anag = mtb_aart_anag.cod_anag and m.cod_mart = mtb_aart_anag.cod_mart and mtb_aart_anag.cod_mart_anag = m.cod_mart_anag\n" +
|
||||
"and m.id > 1");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,253 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251210111441 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
createOrUpdateFunction("pvm_getassortimentoClientePedane","CREATE FUNCTION [dbo].[pvm_getassortimentoClientePedane](\n" +
|
||||
" @codAnag VARCHAR(5), @codVlis VARCHAR(5), @codVdes VARCHAR(5), @dataValidita DATETIME, @viewPromo BIT,\n" +
|
||||
" @pedane INT = 0\n" +
|
||||
")\n" +
|
||||
" RETURNS TABLE\n" +
|
||||
" AS\n" +
|
||||
" RETURN( /*\n" +
|
||||
"\n" +
|
||||
"\t\t\tdeclare @codAnag VARCHAR(5), @codVlis VARCHAR(5), @dataValidita DATETIME, @viewPromo BIT\n" +
|
||||
"\t\t\tset @codAnag = 'C3355'\n" +
|
||||
"\t\t\tset @codVlis = 'C3355'\n" +
|
||||
"\t\t\tset @dataValidita = '2023/04/04'\n" +
|
||||
"\t\t\tset @viewPromo = 1;\n" +
|
||||
"\t\t\t*/\n" +
|
||||
" WITH assortimento AS (SELECT vtb_griglia_art.cod_mart\n" +
|
||||
" FROM vtb_clie\n" +
|
||||
" INNER JOIN vtb_griglia ON vtb_clie.cod_griglia = vtb_griglia.cod_griglia\n" +
|
||||
" INNER JOIN vtb_griglia_art\n" +
|
||||
" ON vtb_griglia.cod_griglia = vtb_griglia_art.cod_griglia AND\n" +
|
||||
" vtb_griglia.data_validita = vtb_griglia_art.data_validita\n" +
|
||||
" WHERE vtb_clie.cod_anag = @codAnag\n" +
|
||||
" AND vtb_griglia.data_validita = (SELECT MAX(g.data_validita)\n" +
|
||||
" FROM vtb_griglia g\n" +
|
||||
" WHERE g.cod_griglia = vtb_clie.cod_griglia\n" +
|
||||
" AND g.data_validita <= ISNULL(@dataValidita, CAST(GETDATE() AS DATE)))),\n" +
|
||||
" lisv AS (SELECT cod_vlis, cod_vlis AS cod_vlis_rif\n" +
|
||||
" FROM vtb_list\n" +
|
||||
" WHERE cod_vlis_rif IS NULL\n" +
|
||||
" UNION ALL\n" +
|
||||
" SELECT cod_vlis, cod_vlis_rif\n" +
|
||||
" FROM vtb_list\n" +
|
||||
" WHERE cod_vlis_rif IS NOT NULL),\n" +
|
||||
" listino AS (SELECT DISTINCT cod_mart, tipo_variazione\n" +
|
||||
" FROM (SELECT lisv.cod_vlis,\n" +
|
||||
" mtb_lisv.cod_mart,\n" +
|
||||
" LAST_VALUE(CASE\n" +
|
||||
" WHEN vtb_list_data.data_iniz IS NULL THEN NULL\n" +
|
||||
" ELSE mtb_lisv_data.tipo_variazione END)\n" +
|
||||
" OVER (PARTITION BY lisv.cod_vlis, mtb_lisv.cod_mart\n" +
|
||||
" ORDER BY vtb_list_data.data_iniz, CASE WHEN vtb_list_data.cod_promo IS NULL THEN 0 ELSE 1 END, vtb_list_data.versione\n" +
|
||||
" RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS tipo_variazione\n" +
|
||||
" FROM lisv\n" +
|
||||
" INNER JOIN mtb_lisv ON lisv.cod_vlis_rif = mtb_lisv.cod_vlis\n" +
|
||||
" INNER JOIN mtb_lisv_data ON mtb_lisv.cod_vlis = mtb_lisv_data.cod_vlis AND\n" +
|
||||
" mtb_lisv.cod_mart = mtb_lisv_data.cod_mart\n" +
|
||||
" LEFT OUTER JOIN vtb_list_data\n" +
|
||||
" ON mtb_lisv_data.cod_vlis = vtb_list_data.cod_vlis AND\n" +
|
||||
" mtb_lisv_data.versione = vtb_list_data.versione AND\n" +
|
||||
" vtb_list_data.data_iniz <=\n" +
|
||||
" ISNULL(@dataValidita, CAST(GETDATE() AS DATE))\n" +
|
||||
" WHERE lisv.cod_vlis = @codVlis\n" +
|
||||
" AND NOT EXISTS(SELECT cod_mart FROM assortimento)) t\n" +
|
||||
" WHERE (t.tipo_variazione IS NULL OR t.tipo_variazione <> 'D')),\n" +
|
||||
" tmp_lisv AS (SELECT l.cod_mart,\n" +
|
||||
" l.cod_vlis,\n" +
|
||||
" ISNULL(p.data_iniz, l.data_iniz) AS data_iniz,\n" +
|
||||
" p.data_fine,\n" +
|
||||
" l.da,\n" +
|
||||
" l.a,\n" +
|
||||
" ISNULL(p.prz_vend, l.prz_vend_trasp) AS prz_vend,\n" +
|
||||
" ISNULL(p.prz_vend_netto, l.prz_vend_trasp_netto) AS prz_vend_netto,\n" +
|
||||
" ISNULL(p.perc_sco1, l.perc_sco1) AS perc_sco1,\n" +
|
||||
" ISNULL(p.perc_sco2, l.perc_sco2) AS perc_sco2,\n" +
|
||||
" ISNULL(p.perc_sco3, l.perc_sco3) AS perc_sco3,\n" +
|
||||
" ISNULL(p.perc_sco4, l.perc_sco4) AS perc_sco4,\n" +
|
||||
" p.perc_prov,\n" +
|
||||
" CONVERT(NUMERIC(20, 5), 0) AS qta_residua,\n" +
|
||||
" CONVERT(BIGINT, NULL) AS id_contratto,\n" +
|
||||
" ISNULL(p.rap_conv, l.rap_conv) AS rap_conv,\n" +
|
||||
" ISNULL(p.note, l.note) AS note,\n" +
|
||||
" CAST(NULL AS VARCHAR(5)) AS cod_vdes,\n" +
|
||||
" l.cod_tcol_ul AS cod_tcol_ul,\n" +
|
||||
" ISNULL(p.unt_mis_ven, l.unt_mis_ven) AS unt_mis_ven,\n" +
|
||||
" l.colli_pedana AS colli_pedana,\n" +
|
||||
" ISNULL(p.tipo_variazione, l.tipo_variazione) AS tipo_variazione,\n" +
|
||||
" CONVERT(VARCHAR(1), CASE\n" +
|
||||
" WHEN p.cod_promo IS NULL THEN NULL\n" +
|
||||
" ELSE 'P' END) AS tipo_promo,\n" +
|
||||
" CONVERT(VARCHAR(5), NULL) AS cod_paga,\n" +
|
||||
" CONVERT(VARCHAR(5), NULL) AS descr_paga,\n" +
|
||||
" l.porto,\n" +
|
||||
" l.qta_cnf,\n" +
|
||||
" NULL AS note_incoterms,\n" +
|
||||
" NULL AS data_rif_scad,\n" +
|
||||
" NULL AS note_carico,\n" +
|
||||
" NULL AS term_cons,\n" +
|
||||
" NULL AS cod_banc,\n" +
|
||||
" NULL AS descr_banc,\n" +
|
||||
" l.flag_primario\n" +
|
||||
" FROM dbo.getListinoVenditaPedane(@dataValidita, @codVlis, NULL, @pedane) l\n" +
|
||||
" LEFT OUTER JOIN dbo.getPromozioneVendita(@dataValidita, @dataValidita,\n" +
|
||||
" @codVlis, NULL, NULL) p\n" +
|
||||
" ON l.cod_vlis = p.cod_vlis AND l.cod_mart = p.cod_mart AND\n" +
|
||||
" ISNULL(@viewPromo, 0) = 1\n" +
|
||||
" WHERE l.cod_vlis = @codVlis\n" +
|
||||
" AND l.cod_mart IN (SELECT cod_mart\n" +
|
||||
" FROM assortimento\n" +
|
||||
" UNION ALL\n" +
|
||||
" SELECT cod_mart\n" +
|
||||
" FROM listino)\n" +
|
||||
" AND l.tipo_variazione <> 'D'\n" +
|
||||
" AND l.tipo_variazione IS NOT NULL\n" +
|
||||
" AND l.flag_attivo = 'S'\n" +
|
||||
" UNION ALL\n" +
|
||||
" SELECT l.cod_mart,\n" +
|
||||
" l.cod_vlis,\n" +
|
||||
" NULL AS data_iniz,\n" +
|
||||
" NULL AS data_fine,\n" +
|
||||
" NULL AS da,\n" +
|
||||
" NULL AS a,\n" +
|
||||
" NULL AS prz_vend,\n" +
|
||||
" NULL AS prz_vend_netto,\n" +
|
||||
" NULL AS perc_sco1,\n" +
|
||||
" NULL AS perc_sco2,\n" +
|
||||
" NULL AS perc_sco3,\n" +
|
||||
" NULL AS perc_sco4,\n" +
|
||||
" NULL AS perc_prov,\n" +
|
||||
" NULL AS qta_residua,\n" +
|
||||
" NULL AS id_contratto,\n" +
|
||||
" um.rap_conv AS rap_conv,\n" +
|
||||
" NULL AS note,\n" +
|
||||
" CAST(NULL AS VARCHAR(5)) AS cod_vdes,\n" +
|
||||
" NULL AS cod_tcol_ul,\n" +
|
||||
" l.unt_mis_ven AS unt_mis_ven,\n" +
|
||||
" NULL AS colli_pedana,\n" +
|
||||
" NULL AS tipo_variazione,\n" +
|
||||
" NULL AS tipo_promo,\n" +
|
||||
" CONVERT(VARCHAR(5), NULL) AS cod_paga,\n" +
|
||||
" CONVERT(VARCHAR(5), NULL) AS descr_paga,\n" +
|
||||
" NULL porto,\n" +
|
||||
" mtb_aart.qta_cnf,\n" +
|
||||
" NULL AS note_incoterms,\n" +
|
||||
" NULL AS data_rif_scad,\n" +
|
||||
" NULL AS note_carico,\n" +
|
||||
" NULL AS term_cons,\n" +
|
||||
" NULL AS cod_banc,\n" +
|
||||
" NULL AS descr_banc,\n" +
|
||||
" 1 AS flag_primario\n" +
|
||||
" FROM mtb_lisv l\n" +
|
||||
" INNER JOIN listino ON l.cod_mart = listino.cod_mart\n" +
|
||||
" INNER JOIN mtb_aart ON l.cod_mart = mtb_aart.cod_mart\n" +
|
||||
" CROSS APPLY dbo.getUntMisArticolo(l.cod_mart, l.unt_mis_ven) um\n" +
|
||||
" WHERE l.cod_vlis = @codVlis\n" +
|
||||
" AND listino.tipo_variazione IS NULL\n" +
|
||||
" UNION ALL\n" +
|
||||
" SELECT vvw_contratti_vendita.cod_mart,\n" +
|
||||
" NULL AS cod_vlis,\n" +
|
||||
" vvw_contratti_vendita.data_iniz,\n" +
|
||||
" vvw_contratti_vendita.data_fine,\n" +
|
||||
" NULL AS da,\n" +
|
||||
" NULL AS a,\n" +
|
||||
" vvw_contratti_vendita.prz_vend,\n" +
|
||||
" ROUND(vvw_contratti_vendita.prz_vend *\n" +
|
||||
" (1 - ISNULL(vvw_contratti_vendita.perc_sco1, 0))\n" +
|
||||
" * (1 - ISNULL(vvw_contratti_vendita.perc_sco2, 0))\n" +
|
||||
" * (1 - ISNULL(vvw_contratti_vendita.perc_sco3, 0))\n" +
|
||||
" * (1 - ISNULL(vvw_contratti_vendita.perc_sco4, 0)),\n" +
|
||||
" 5) AS prz_vend_netto,\n" +
|
||||
" vvw_contratti_vendita.perc_sco1,\n" +
|
||||
" vvw_contratti_vendita.perc_sco2,\n" +
|
||||
" vvw_contratti_vendita.perc_sco3,\n" +
|
||||
" vvw_contratti_vendita.perc_sco4,\n" +
|
||||
" vvw_contratti_vendita.perc_prov,\n" +
|
||||
" vvw_contratti_vendita.qta_residua,\n" +
|
||||
" vvw_contratti_vendita.id_contratto,\n" +
|
||||
" vvw_contratti_vendita.rap_conv,\n" +
|
||||
" vvw_contratti_vendita.note,\n" +
|
||||
" vvw_contratti_vendita.cod_vdes,\n" +
|
||||
" NULL,\n" +
|
||||
" vvw_contratti_vendita.unt_mis_ven,\n" +
|
||||
" NULL,\n" +
|
||||
" NULL,\n" +
|
||||
" 'C' AS tipo_promo,\n" +
|
||||
" vvw_contratti_vendita.cod_paga,\n" +
|
||||
" vvw_contratti_vendita.descrizione_paga AS descr_paga,\n" +
|
||||
" vvw_contratti_vendita.incoterms AS porto,\n" +
|
||||
" mtb_aart.qta_cnf,\n" +
|
||||
" vvw_contratti_vendita.note_incoterms,\n" +
|
||||
" vvw_contratti_vendita.data_rif_scad,\n" +
|
||||
" vvw_contratti_vendita.note_carico,\n" +
|
||||
" vvw_contratti_vendita.term_cons,\n" +
|
||||
" vvw_contratti_vendita.cod_banc,\n" +
|
||||
" vvw_contratti_vendita.descr_banc,\n" +
|
||||
" 1 AS flag_primario\n" +
|
||||
" FROM vvw_contratti_vendita\n" +
|
||||
" INNER JOIN mtb_aart ON vvw_contratti_vendita.cod_mart = mtb_aart.cod_mart\n" +
|
||||
" WHERE vvw_contratti_vendita.cod_anag = @codAnag\n" +
|
||||
" AND (@codVdes IS NULL OR vvw_contratti_vendita.cod_vdes IS NULL OR\n" +
|
||||
" vvw_contratti_vendita.cod_vdes = @codVdes)\n" +
|
||||
" AND (ISNULL(@dataValidita, CAST(GETDATE() AS DATE)) BETWEEN\n" +
|
||||
" vvw_contratti_vendita.data_iniz AND vvw_contratti_vendita.data_fine)\n" +
|
||||
"-- AND vvw_contratti_vendita.qta_residua >= 0\n" +
|
||||
" )\n" +
|
||||
"\n" +
|
||||
" SELECT tmp_lisv.cod_mart,\n" +
|
||||
" ISNULL(maa.cod_mart_anag, tmp_lisv.cod_mart) AS cod_mart_anag,\n" +
|
||||
" cod_vlis,\n" +
|
||||
" data_iniz,\n" +
|
||||
" data_fine,\n" +
|
||||
" da,\n" +
|
||||
" a,\n" +
|
||||
" prz_vend,\n" +
|
||||
" prz_vend_netto,\n" +
|
||||
" perc_sco1,\n" +
|
||||
" perc_sco2,\n" +
|
||||
" perc_sco3,\n" +
|
||||
" perc_sco4,\n" +
|
||||
" perc_prov,\n" +
|
||||
" qta_residua,\n" +
|
||||
" id_contratto,\n" +
|
||||
" rap_conv,\n" +
|
||||
" ISNULL(maa.note, tmp_lisv.note) AS note,\n" +
|
||||
" cod_tcol_ul,\n" +
|
||||
" unt_mis_ven,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN maa.colli_pedana IS NULL OR maa.colli_pedana = 0 THEN tmp_lisv.colli_pedana\n" +
|
||||
" ELSE maa.colli_pedana END AS colli_pedana,\n" +
|
||||
" tipo_variazione,\n" +
|
||||
" tipo_promo,\n" +
|
||||
" cod_paga,\n" +
|
||||
" descr_paga,\n" +
|
||||
" porto,\n" +
|
||||
" qta_cnf,\n" +
|
||||
" CAST(CASE WHEN tmp_lisv.data_iniz IS NULL THEN 0 ELSE 1 END AS BIT) AS art_lisv,\n" +
|
||||
" tmp_lisv.cod_vdes,\n" +
|
||||
" note_incoterms,\n" +
|
||||
" data_rif_scad,\n" +
|
||||
" note_carico,\n" +
|
||||
" term_cons,\n" +
|
||||
" cod_banc,\n" +
|
||||
" descr_banc,\n" +
|
||||
" flag_primario\n" +
|
||||
" FROM tmp_lisv\n" +
|
||||
" LEFT OUTER JOIN mtb_aart_anag maa\n" +
|
||||
" ON tmp_lisv.cod_mart = maa.cod_mart AND maa.cod_anag = @codAnag)");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
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_20251211085116 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
createSetup("W_CREG_IVA_DISP", "DATAWINDOW", "D_CREG_IVA_REP", null,
|
||||
null, false, null, false, false,
|
||||
false, false, false, null, false, null);
|
||||
|
||||
if(isCustomer(IntegryCustomer.Cosmapack)) {
|
||||
updateSetupValue("W_CREG_IVA_DISP", "DATAWINDOW", "D_CREG_IVA_REP", "d_creg_iva_cosmopack_rep");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251211162655 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
createSetupQuery("SI_NO", "SI_NO", "SELECT 'S' UNION ALL SELECT 'N'");
|
||||
createSetup("PVM", "ORDINI_V_SLIM2K", "EXPORT_ORDINI", "N",
|
||||
"Esporta gli ordini già esportati", false, "SI_NO", false, false,
|
||||
false, false, false, null, false, "SELECT 'S' UNION ALL SELECT 'N'");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
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_20251211165528 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
createSetup("w_vriepfattagecomp_disp", "CB_VIS_DETTAGLIO", "VISIBLE", "N",
|
||||
null, false, null, false, false,
|
||||
false, false, false, null, false, null);
|
||||
|
||||
if(isCustomer(IntegryCustomer.RossoGargano)) {
|
||||
updateSetupValue("w_vriepfattagecomp_disp", "CB_VIS_DETTAGLIO", "VISIBLE", "S");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
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_20251212095000 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if(isCustomer(IntegryCustomer.RossoGargano)) {
|
||||
executeStatement("INSERT INTO dtb_note_doc (note, data_iniz, data_fine, flag_bio)\n" +
|
||||
"SELECT \n" +
|
||||
" (\n" +
|
||||
" SELECT value \n" +
|
||||
" FROM stb_gest_setup \n" +
|
||||
" WHERE gest_name = 'stampa_documenti'\n" +
|
||||
" AND section = 'bio'\n" +
|
||||
" AND key_section = 'descrizione'\n" +
|
||||
" )\n" +
|
||||
" + ' ' +\n" +
|
||||
" (\n" +
|
||||
" SELECT value \n" +
|
||||
" FROM stb_gest_setup \n" +
|
||||
" WHERE gest_name = 'stampa_documenti'\n" +
|
||||
" AND section = 'bio'\n" +
|
||||
" AND key_section = 'certificato'\n" +
|
||||
" ) AS note,\n" +
|
||||
" '2025-07-01',\n" +
|
||||
" '2099-12-31',\n" +
|
||||
" 1;",
|
||||
"INSERT INTO drl_tipi_note_doc (cod_dtip, id_note, id_riga)\n" +
|
||||
"SELECT\n" +
|
||||
" t.cod_dtip,\n" +
|
||||
" n.id_note,\n" +
|
||||
" ISNULL(\n" +
|
||||
" (\n" +
|
||||
" SELECT MAX(d.id_riga)\n" +
|
||||
" FROM drl_tipi_note_doc d\n" +
|
||||
" WHERE d.cod_dtip = t.cod_dtip\n" +
|
||||
" ), 0\n" +
|
||||
" ) + 1 AS id_riga\n" +
|
||||
"FROM (\n" +
|
||||
" SELECT MAX(id) AS id_note\n" +
|
||||
" FROM dtb_note_doc\n" +
|
||||
" WHERE flag_bio = 1\n" +
|
||||
" ) n\n" +
|
||||
"JOIN (\n" +
|
||||
" SELECT cod_dtip\n" +
|
||||
" FROM dtb_tipi\n" +
|
||||
" WHERE gestione = 'V'\n" +
|
||||
" AND mod_stamp IN ('bolac', 'fat', 'fatac')\n" +
|
||||
" ) t\n" +
|
||||
"ON 1 = 1;",
|
||||
"UPDATE stb_gest_setup set value = null \n" +
|
||||
"WHERE gest_name = 'stampa_documenti'\n" +
|
||||
" AND section = 'bio'\n" +
|
||||
" AND key_section IN ('certificato','descrizione');");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -184,7 +184,7 @@ public class AccountingRules extends QueryRules {
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(codBiva)) {
|
||||
for (CtbMovi ctbMovi : ctbMovt.getCtbMovi()) {
|
||||
if (UtilityString.isNullOrEmpty(ctbMovi.getCodBiva()) && !ctbMovi.getCodBiva().equalsIgnoreCase(EmsRestConstants.NULL)) {
|
||||
if (ctbMovi.getCodBiva() != null && ctbMovi.getCodBiva().trim().isEmpty()) {
|
||||
ctbMovi.setCodBiva(codBiva);
|
||||
}
|
||||
movi.add(ctbMovi);
|
||||
|
||||
@@ -730,7 +730,7 @@ public class CommonRules extends QueryRules {
|
||||
public static String completeFlagQtaCnfFissa(Connection connection, IntegryCustomerDB customerDB, String codMart) {
|
||||
final EntityCacheComponent entityCacheComponent = ApplicationContextProvider.getApplicationContext().getBean(EntityCacheComponent.class);
|
||||
|
||||
final List<MtbAart> cachedMtbAarts = entityCacheComponent.getCachedEntitiesList(customerDB, MtbAart.ENTITY, x -> x.getCodMart().equals(codMart));
|
||||
final List<MtbAart> cachedMtbAarts = entityCacheComponent.getCachedEntitiesList(customerDB, MtbAart.ENTITY, x -> x.getCodMart().equalsIgnoreCase(codMart));
|
||||
|
||||
if (cachedMtbAarts == null || cachedMtbAarts.isEmpty())
|
||||
return null;
|
||||
|
||||
@@ -435,12 +435,12 @@ public class DocumentCheckRules {
|
||||
}
|
||||
|
||||
if (returnVal && entity.getOperation() == OperationType.INSERT) {
|
||||
throw new Exception("DOCUMENTO INTESTATO A " + entity.getCodAnag() + " - " + entity.getCodDtip() + " N. " + entity.getNumDoc().toString() + "/" + entity.getSerDoc() + " DEL " + new SimpleDateFormat(CommonConstants.DATE_FORMAT_DMY).format(entity.getDataDoc()) + " GIA' ESISTENTE");
|
||||
throw new Exception(String.format("Documento intestato a %s - %s numero %s/%d già esistente", entity.getCodAnag(), entity.getCodDtip(), entity.getSerDoc(), entity.getNumDoc()));
|
||||
} else {
|
||||
if (checkDocInSequenza(conn, entity) == false && "AUTOMATICA".equalsIgnoreCase(tipoNumeraz) &&
|
||||
entity.getOperation() != OperationType.UPDATE) {
|
||||
String valueDataDoc = new SimpleDateFormat(CommonConstants.DATE_FORMAT_DMY).format(dataDoc);
|
||||
throw new Exception("(DOC. " + codDtip + " N° " + numDoc + "/" + serDoc + " DEL " + valueDataDoc + " INTESTATO A " + codAnag + " FUORI SEQUENZA)");
|
||||
throw new Exception("(Doc. " + codDtip + " N° " + numDoc + "/" + serDoc + " del " + valueDataDoc + " intestato a " + codAnag + " fuori sequenza)");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package it.integry.ems.utility.entity;
|
||||
|
||||
import it.integry.ems._context.ApplicationContextProvider;
|
||||
import it.integry.ems.dynamic_cache.EntityCacheComponent;
|
||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||
import it.integry.ems_model.entity.MtbAartBarCode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class MtbAartBarcodeUtils {
|
||||
|
||||
|
||||
public static final List<MtbAartBarCode> getAlternativeMtbAartBarCodes(List<String> codMarts, Connection conn) {
|
||||
codMarts = codMarts.stream()
|
||||
.distinct().collect(Collectors.toList());
|
||||
|
||||
final EntityCacheComponent entityCacheComponent = ApplicationContextProvider.getApplicationContext().getBean(EntityCacheComponent.class);
|
||||
|
||||
List<String> finalCodMarts = codMarts;
|
||||
List<MtbAartBarCode> barCodeList = entityCacheComponent.getCachedEntitiesList(
|
||||
conn.getIntegryCustomerDB(),
|
||||
MtbAartBarCode.ENTITY,
|
||||
x -> finalCodMarts.stream().anyMatch(y -> y.equalsIgnoreCase(x.getCodMart())));
|
||||
|
||||
return barCodeList != null ? barCodeList : new ArrayList<>();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package it.integry.ems.utility.entity;
|
||||
|
||||
import com.annimon.stream.Optional;
|
||||
import com.annimon.stream.Stream;
|
||||
import it.integry.ems._context.ApplicationContextProvider;
|
||||
import it.integry.ems.dynamic_cache.EntityCacheComponent;
|
||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||
import it.integry.ems_model.entity.MtbAart;
|
||||
import it.integry.ems_model.entity.MtbAartBarCode;
|
||||
import it.integry.ems_model.entity.MtbUntMis;
|
||||
import it.integry.ems_model.utility.UtilityString;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class MtbAartUtils {
|
||||
|
||||
public static MtbAart getArticoloByCodMart(String codMart, Connection connection) throws Exception {
|
||||
if (UtilityString.isNullOrEmpty(codMart))
|
||||
return null;
|
||||
|
||||
List<MtbAart> mtbAarts = getArticoliByCodMarts(new ArrayList<>(Collections.singleton(codMart)), connection);
|
||||
if (mtbAarts == null || mtbAarts.isEmpty())
|
||||
return null;
|
||||
|
||||
return mtbAarts.get(0);
|
||||
}
|
||||
|
||||
public static List<MtbAart> getArticoliByCodMarts(List<String> codMarts, Connection connection) throws Exception {
|
||||
if (codMarts == null || codMarts.isEmpty()) return null;
|
||||
|
||||
codMarts.replaceAll(String::toUpperCase);
|
||||
|
||||
final EntityCacheComponent entityCacheComponent = ApplicationContextProvider.getApplicationContext().getBean(EntityCacheComponent.class);
|
||||
|
||||
List<MtbAart> listMtbAart = entityCacheComponent.getCachedEntitiesList(
|
||||
connection.getIntegryCustomerDB(), MtbAart.ENTITY, x -> codMarts.contains(x.getCodMart().toUpperCase()));
|
||||
|
||||
List<MtbAartBarCode> barCodeFromCod = MtbAartBarcodeUtils.getAlternativeMtbAartBarCodes(codMarts, connection);
|
||||
|
||||
if (listMtbAart != null && !listMtbAart.isEmpty()) {
|
||||
List<String> untMisStrings = listMtbAart.stream()
|
||||
.map(MtbAart::getUntMis)
|
||||
.collect(Collectors.toList());
|
||||
List<MtbUntMis> listUntMis = MtbUntMisUtils.getFromCods(untMisStrings, connection);
|
||||
|
||||
for (final MtbAart mtbAart : listMtbAart) {
|
||||
Optional<MtbUntMis> mtbUntMis = Stream.of(listUntMis)
|
||||
.filter(mtbUntMis1 -> mtbUntMis1.getUntMis().equalsIgnoreCase(mtbAart.getUntMis()))
|
||||
.findFirst();
|
||||
|
||||
List<MtbAartBarCode> barcodeList = Stream.of(barCodeFromCod)
|
||||
.filter(x -> x.getCodMart().equalsIgnoreCase(mtbAart.getCodMart()))
|
||||
.toList();
|
||||
|
||||
if (!barcodeList.isEmpty()) {
|
||||
mtbAart.getMtbAartBarCode().addAll(barcodeList);
|
||||
}
|
||||
|
||||
if (mtbUntMis.isPresent()) {
|
||||
mtbAart.setMtbUntMis(new ArrayList<>());
|
||||
mtbAart.getMtbUntMis().add(mtbUntMis.get());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return listMtbAart;
|
||||
}
|
||||
|
||||
public static final HashMap<String, MtbAart> getArticoliByCodMartsAsMap(List<String> codMarts, Connection connection) throws Exception {
|
||||
List<MtbAart> mtbAarts = getArticoliByCodMarts(codMarts, connection);
|
||||
if (mtbAarts == null || mtbAarts.isEmpty()) return new HashMap<>();
|
||||
|
||||
return mtbAarts.stream()
|
||||
.collect(Collectors.toMap(MtbAart::getCodMart, a -> a, (a, b) -> a, HashMap::new));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package it.integry.ems.utility.entity;
|
||||
|
||||
import it.integry.ems._context.ApplicationContextProvider;
|
||||
import it.integry.ems.dynamic_cache.EntityCacheComponent;
|
||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||
import it.integry.ems_model.entity.MtbDepoPosizioni;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class MtbDepoPosizioniUtils {
|
||||
|
||||
|
||||
public static final List<MtbDepoPosizioni> getAllMonoUlPositions(IntegryCustomerDB customerDB) {
|
||||
final EntityCacheComponent entityCacheComponent = ApplicationContextProvider.getApplicationContext().getBean(EntityCacheComponent.class);
|
||||
|
||||
return entityCacheComponent.<MtbDepoPosizioni>getCachedEntitiesList(customerDB, MtbDepoPosizioni.ENTITY,
|
||||
x -> x.isFlagMonoCollo());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package it.integry.ems.utility.entity;
|
||||
|
||||
import it.integry.ems._context.ApplicationContextProvider;
|
||||
import it.integry.ems.dynamic_cache.EntityCacheComponent;
|
||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||
import it.integry.ems_model.entity.MtbAart;
|
||||
import it.integry.ems_model.entity.MtbUntMis;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class MtbUntMisUtils {
|
||||
|
||||
public static final MtbUntMis getMtbUntMisFromCodMart(IntegryCustomerDB customerDB, String codMart) throws SQLException {
|
||||
final EntityCacheComponent entityCacheComponent = ApplicationContextProvider.getApplicationContext().getBean(EntityCacheComponent.class);
|
||||
|
||||
MtbAart mtbAart = entityCacheComponent.<MtbAart>getCachedEntitiesStream(customerDB, MtbAart.ENTITY,
|
||||
x -> x.getCodMart().equalsIgnoreCase(codMart))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
|
||||
if (mtbAart != null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
final MtbUntMis mtbUntMis = entityCacheComponent.<MtbUntMis>getCachedEntitiesStream(customerDB, MtbUntMis.ENTITY,
|
||||
x -> x.getUntMis().equalsIgnoreCase(mtbAart.getUntMis()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
|
||||
return mtbUntMis;
|
||||
}
|
||||
|
||||
|
||||
public static List<MtbUntMis> getFromCods(List<String> untMisCods, Connection connection) {
|
||||
List<String> untMisStrings = untMisCods.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
final EntityCacheComponent entityCacheComponent = ApplicationContextProvider.getApplicationContext().getBean(EntityCacheComponent.class);
|
||||
|
||||
List<MtbUntMis> mtbUntMis = entityCacheComponent.getCachedEntitiesList(
|
||||
connection.getIntegryCustomerDB(),
|
||||
MtbUntMis.ENTITY,
|
||||
x -> untMisCods.contains(x.getUntMis()));
|
||||
|
||||
return mtbUntMis != null ? mtbUntMis : new ArrayList<>();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,6 +12,7 @@ import it.integry.ems_model.utility.UtilityDB;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
@@ -38,6 +39,7 @@ public class MtbAart extends EntityBase implements EquatableEntityInterface<MtbA
|
||||
@SqlField(value = "descrizione", maxLength = 40, nullable = false)
|
||||
private String descrizione;
|
||||
|
||||
@FK(tableName = "mtb_unt_mis", columnName = "unt_mis")
|
||||
@SqlField(value = "unt_mis", maxLength = 3, nullable = false)
|
||||
private String untMis;
|
||||
|
||||
@@ -101,7 +103,8 @@ public class MtbAart extends EntityBase implements EquatableEntityInterface<MtbA
|
||||
@SqlField(value = "colli_pedana", defaultObjectValue = "1")
|
||||
private BigDecimal colliPedana;
|
||||
|
||||
@SqlField(value = "unt_mis2", maxLength = 5)
|
||||
@FK(tableName = "mtb_unt_mis", columnName = "unt_mis")
|
||||
@SqlField(value = "unt_mis2", maxLength = 3)
|
||||
private String untMis2;
|
||||
|
||||
@SqlField(value = "rap_conv2", defaultObjectValue = "1")
|
||||
@@ -110,6 +113,7 @@ public class MtbAart extends EntityBase implements EquatableEntityInterface<MtbA
|
||||
@SqlField(value = "flag_incl_listino", maxLength = 1, nullable = false, defaultObjectValue = "S")
|
||||
private String flagInclListino;
|
||||
|
||||
@FK(tableName = "mtb_unt_mis", columnName = "unt_mis")
|
||||
@SqlField(value = "unt_mis3", maxLength = 3)
|
||||
private String untMis3;
|
||||
|
||||
@@ -242,7 +246,7 @@ public class MtbAart extends EntityBase implements EquatableEntityInterface<MtbA
|
||||
@SqlField(value = "cod_grp_bolla", maxLength = 5)
|
||||
private String codGrpBolla;
|
||||
|
||||
@SqlField(value = "ingredienti", maxLength = 1024)
|
||||
@SqlField(value = "ingredienti", maxLength = 8000)
|
||||
private String ingredienti;
|
||||
|
||||
@SqlField(value = "id_art_equi", maxLength = 25)
|
||||
@@ -1258,8 +1262,9 @@ public class MtbAart extends EntityBase implements EquatableEntityInterface<MtbA
|
||||
return mtbAartCarat;
|
||||
}
|
||||
|
||||
public void setMtbAartCarat(List<MtbAartCarat> mtbAartCarat) {
|
||||
public MtbAart setMtbAartCarat(List<MtbAartCarat> mtbAartCarat) {
|
||||
this.mtbAartCarat = mtbAartCarat;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<MtbAartLink> getMtbAartLink() {
|
||||
|
||||
@@ -63,6 +63,9 @@ public class MtbAartAnag extends EntityBase {
|
||||
@SqlField(value = "note", maxLength = 255)
|
||||
private String note;
|
||||
|
||||
@SqlField(value = "cod_vdes", maxLength = 5)
|
||||
private String codVdes;
|
||||
|
||||
public MtbAartAnag() {
|
||||
super(logger);
|
||||
}
|
||||
@@ -174,4 +177,13 @@ public class MtbAartAnag extends EntityBase {
|
||||
this.note = note;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodVdes() {
|
||||
return codVdes;
|
||||
}
|
||||
|
||||
public MtbAartAnag setCodVdes(String codVdes) {
|
||||
this.codVdes = codVdes;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,14 +5,17 @@ import it.integry.ems_model.annotation.PK;
|
||||
import it.integry.ems_model.annotation.SqlField;
|
||||
import it.integry.ems_model.annotation.Table;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import it.integry.ems_model.base.EquatableEntityInterface;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@PropertyReactive
|
||||
@Table(MtbAartDesc.ENTITY)
|
||||
@JsonTypeName(MtbAartDesc.ENTITY)
|
||||
public class MtbAartDesc extends EntityBase {
|
||||
public class MtbAartDesc extends EntityBase implements EquatableEntityInterface<MtbAartDesc> {
|
||||
|
||||
private final static Logger logger = LogManager.getLogger();
|
||||
|
||||
@@ -34,6 +37,9 @@ public class MtbAartDesc extends EntityBase {
|
||||
@SqlField(value = "descrizione", maxLength = 40, nullable = false)
|
||||
private String descrizione;
|
||||
|
||||
@SqlField(value = "descrizione_html")
|
||||
private String descrizioneHtml;
|
||||
|
||||
public MtbAartDesc() {
|
||||
super(logger);
|
||||
}
|
||||
@@ -69,4 +75,40 @@ public class MtbAartDesc extends EntityBase {
|
||||
public void setDescrizione(String descrizione) {
|
||||
this.descrizione = descrizione;
|
||||
}
|
||||
|
||||
public String getDescrizioneHtml() {
|
||||
return descrizioneHtml;
|
||||
}
|
||||
|
||||
public MtbAartDesc setDescrizioneHtml(String descrizioneHtml) {
|
||||
this.descrizioneHtml = descrizioneHtml;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (!(o instanceof MtbAartDesc)) return false;
|
||||
MtbAartDesc that = (MtbAartDesc) o;
|
||||
return Objects.equals(getCodMart(), that.getCodMart()) && Objects.equals(getCodLingua(), that.getCodLingua()) && Objects.equals(getDescrizioneEstesa(), that.getDescrizioneEstesa()) && Objects.equals(getDescrizione(), that.getDescrizione()) && Objects.equals(getDescrizioneHtml(), that.getDescrizioneHtml());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(getCodMart(), getCodLingua(), getDescrizioneEstesa(), getDescrizione(), getDescrizioneHtml());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCodeKey() {
|
||||
return Objects.hash(getCodMart(), getCodLingua());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equalsKey(MtbAartDesc other) {
|
||||
if (this == other) return true;
|
||||
if (!(other instanceof MtbAartDesc)) return false;
|
||||
MtbAartDesc mtbAartDesc = other;
|
||||
return Objects.equals(getCodLingua(), mtbAartDesc.getCodLingua()) &&
|
||||
Objects.equals(getCodMart(), mtbAartDesc.getCodMart());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +41,9 @@ public class MtbAartEqui extends EntityBase implements EquatableEntityInterface<
|
||||
@SqlField(value = "descrizione_estera", maxLength = 255, nullable = false)
|
||||
private String descrizioneEstera;
|
||||
|
||||
@SqlField(value = "flag_equi_anag", maxLength = 1, nullable = false, defaultObjectValue = "0")
|
||||
private Boolean flagEquiAnag;
|
||||
|
||||
public MtbAartEqui() {
|
||||
super(logger);
|
||||
}
|
||||
@@ -89,16 +92,26 @@ public class MtbAartEqui extends EntityBase implements EquatableEntityInterface<
|
||||
this.descrizioneEstera = descrizioneEstera;
|
||||
}
|
||||
|
||||
public Boolean getFlagEquiAnag() {
|
||||
return flagEquiAnag;
|
||||
}
|
||||
|
||||
public MtbAartEqui setFlagEquiAnag(Boolean flagEquiAnag) {
|
||||
this.flagEquiAnag = flagEquiAnag;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (!(o instanceof MtbAartEqui)) return false;
|
||||
MtbAartEqui that = (MtbAartEqui) o;
|
||||
return Objects.equals(getIdArtEqui(), that.getIdArtEqui()) && Objects.equals(getDescrizione(), that.getDescrizione()) && Objects.equals(getFlagEquiPrezzo(), that.getFlagEquiPrezzo()) && Objects.equals(getFlagEquiCosto(), that.getFlagEquiCosto()) && Objects.equals(getDescrizioneEstera(), that.getDescrizioneEstera());
|
||||
return Objects.equals(getIdArtEqui(), that.getIdArtEqui()) && Objects.equals(getDescrizione(), that.getDescrizione()) && Objects.equals(getFlagEquiPrezzo(), that.getFlagEquiPrezzo()) && Objects.equals(getFlagEquiCosto(), that.getFlagEquiCosto()) && Objects.equals(getDescrizioneEstera(), that.getDescrizioneEstera())
|
||||
&& Objects.equals(getFlagEquiAnag(), that.getFlagEquiAnag());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(getIdArtEqui(), getDescrizione(), getFlagEquiPrezzo(), getFlagEquiCosto(), getDescrizioneEstera());
|
||||
return Objects.hash(getIdArtEqui(), getDescrizione(), getFlagEquiPrezzo(), getFlagEquiCosto(), getDescrizioneEstera(),getFlagEquiAnag());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -18,6 +18,7 @@ import java.time.LocalDate
|
||||
import it.integry.ems_model.utility.UtilityLocalDate;
|
||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||
import it.integry.ems.migration._base.IntegryCustomer
|
||||
import it.integry.ems.utility.entity.MtbUntMisUtils
|
||||
|
||||
global Connection conn
|
||||
global String username
|
||||
@@ -225,14 +226,13 @@ when
|
||||
eval(completeRulesEnabled)
|
||||
$entity : MtbColr(artAPeso == null && codMart != null )
|
||||
then
|
||||
String sql =
|
||||
"SELECT CASE WHEN dbo.f_getTipoUntMis(mtb_aart.unt_mis) = 'KG' THEN 'S' ELSE 'N' END " +
|
||||
" FROM mtb_aart WHERE cod_mart = " + UtilityDB.valueToString($entity.getCodMart());
|
||||
MtbUntMis mtbUntMis = MtbUntMisUtils.getMtbUntMisFromCodMart(customerDb, $entity.getCodMart());
|
||||
|
||||
String artAPeso = "N";
|
||||
|
||||
if (mtbUntMis != null)
|
||||
artAPeso = "KG".equalsIgnoreCase(mtbUntMis.getUntMis()) ? "S" : "N";
|
||||
|
||||
String artAPeso = (String) QueryRules.getSingleValue(conn, sql);
|
||||
if (artAPeso == null ) {
|
||||
artAPeso = "N";
|
||||
}
|
||||
modify ( $entity ) { setArtAPeso(artAPeso) }
|
||||
end
|
||||
|
||||
|
||||
@@ -7,9 +7,9 @@ import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems._context.ApplicationContextProvider;
|
||||
import it.integry.ems.logistic.dto.sm2.FiltroDistribuzioneColloDTO;
|
||||
import it.integry.ems.product.importaz.service.ProductServices;
|
||||
import it.integry.ems.retail.wms.Utility.WMSUtility;
|
||||
import it.integry.ems.service.EntityProcessor;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems.utility.entity.MtbAartUtils;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import it.integry.ems_model.base.EntityNotFound;
|
||||
import it.integry.ems_model.entity.*;
|
||||
@@ -116,7 +116,7 @@ public class DistribuzioneColliService {
|
||||
.map(MtbColr::getCodMart)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
List<MtbAart> mtbAarts = WMSUtility.getArticoliByCodMarts(codMarts, multiDBTransactionManager.getPrimaryConnection());
|
||||
List<MtbAart> mtbAarts = MtbAartUtils.getArticoliByCodMarts(codMarts, multiDBTransactionManager.getPrimaryConnection());
|
||||
|
||||
|
||||
//Lettura del filtro ordini
|
||||
|
||||
@@ -3,11 +3,11 @@ package it.integry.ems.order.Import.service;
|
||||
import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems._context.ApplicationContextProvider;
|
||||
import it.integry.ems.exception.PrimaryDatabaseNotPresentException;
|
||||
import it.integry.ems.retail.wms.Utility.WMSUtility;
|
||||
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.utility.entity.MtbAartUtils;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import it.integry.ems_model.config.EmsRestConstants;
|
||||
import it.integry.ems_model.entity.*;
|
||||
@@ -132,7 +132,7 @@ public class OrdiniMaxiDataImportService {
|
||||
if (schedeProduzione == null || schedeProduzione.isEmpty())
|
||||
return new ArrayList<>();
|
||||
|
||||
List<MtbAart> anafraficheArticoli = WMSUtility.getArticoliByCodMarts(
|
||||
List<MtbAart> anafraficheArticoli = MtbAartUtils.getArticoliByCodMarts(
|
||||
schedeProduzione.stream()
|
||||
.map(MaxidataUveBII40V2BLLUVE2kSchedeProd::getIdProdotto)
|
||||
.distinct()
|
||||
|
||||
@@ -10,11 +10,13 @@ import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import it.integry.ems_model.entity.DtbOrdr;
|
||||
import it.integry.ems_model.entity.DtbOrdt;
|
||||
import it.integry.ems_model.service.SetupGest;
|
||||
import it.integry.ems_model.types.OperationType;
|
||||
import it.integry.ems_model.utility.Query;
|
||||
import it.integry.ems_model.utility.UtilityBigDecimal;
|
||||
import it.integry.ems_model.utility.UtilityDB;
|
||||
import it.integry.ems_model.utility.UtilityHashMap;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@@ -26,6 +28,9 @@ public class OrdiniVSlim2kService {
|
||||
private final EntityProcessor entityProcessor;
|
||||
private final EmsServices emsServices;
|
||||
|
||||
@Autowired
|
||||
private SetupGest setupGest;
|
||||
|
||||
public OrdiniVSlim2kService(EntityProcessor entityProcessor, EmsServices emsServices) {
|
||||
this.entityProcessor = entityProcessor;
|
||||
this.emsServices = emsServices;
|
||||
@@ -43,11 +48,11 @@ public class OrdiniVSlim2kService {
|
||||
List<HashMap<String, Object>> articoli = new ArrayList<>();
|
||||
List<HashMap<String, Object>> export = new ArrayList<>();
|
||||
|
||||
for(DtbOrdt ord : groupOrdini.keySet()) {
|
||||
for (DtbOrdt ord : groupOrdini.keySet()) {
|
||||
for (DtbOrdr dtbOrdr : groupOrdini.get(ord)) {
|
||||
String sql =
|
||||
Query.format("SELECT * FROM dtb_ordt WHERE gestione = %s AND data_ord = %s AND num_ord = %s",
|
||||
ord.getGestione(), ord.getDataOrd(), ord.getNumOrd());
|
||||
ord.getGestione(), ord.getDataOrd(), ord.getNumOrd());
|
||||
|
||||
ord = UtilityDB.executeSimpleQueryOnlyFirstRowDTO(multiDBTransactionManager.getPrimaryConnection(), sql, DtbOrdt.class);
|
||||
BigDecimal qtaCnf;
|
||||
@@ -73,48 +78,51 @@ public class OrdiniVSlim2kService {
|
||||
}
|
||||
|
||||
entityProcessor.processEntity(ord, multiDBTransactionManager, false);
|
||||
boolean exportOrdini = setupGest.getSetupBoolean(multiDBTransactionManager.getPrimaryConnection(), "PVM", "ORDINI_V_SLIM2K", "EXPORT_ORDINI");
|
||||
|
||||
DtbOrdt finalOrd = ord;
|
||||
Optional<HashMap<String, Object>> exportOpt = export.stream()
|
||||
.filter(x -> ((String) x.get("cod_anag")).equalsIgnoreCase(finalOrd.getCodAnag())).findFirst();
|
||||
HashMap<String, Object> datiExport;
|
||||
if ( exportOpt.isPresent() ) {
|
||||
datiExport = exportOpt.get();
|
||||
} else {
|
||||
String query =
|
||||
Query.format(
|
||||
"SELECT wtb_clie.cod_anag, " +
|
||||
"wtb_users.user_name, wtb_users.password, wtb_users_info.format_file, COUNT(wtb_users_info.format_file) over (partition by wtb_users_info.user_name) as count_export" +
|
||||
" FROM wtb_users " +
|
||||
"INNER JOIN wtb_users_info ON wtb_users.User_name = wtb_users_info.user_name " +
|
||||
"INNER JOIN wtb_clie ON wtb_users.User_name = wtb_clie.user_name " +
|
||||
" WHERE wtb_users_info.flag_state = 'S' and " +
|
||||
" wtb_clie.cod_anag = %s AND \n" +
|
||||
" wtb_users_info.export_type = %s",
|
||||
ord.getCodAnag(), EntityExportType.ORDINI_VENDITA.getText());
|
||||
|
||||
datiExport = UtilityDB.executeSimpleQueryOnlyFirstRow(multiDBTransactionManager.getPrimaryConnection(), query);
|
||||
export.add(datiExport);
|
||||
}
|
||||
|
||||
if (UtilityHashMap.isPresent(datiExport)) {
|
||||
String userNameExport = UtilityHashMap.getValueIfExists(datiExport, "user_name");
|
||||
String passwordExport = UtilityHashMap.getValueIfExists(datiExport, "password");
|
||||
String formatExport = UtilityHashMap.getValueIfExists(datiExport, "format_file");
|
||||
Integer countExport = UtilityHashMap.getValueIfExists(datiExport, "count_export");
|
||||
|
||||
if (countExport == 1) {
|
||||
RequestDataDTO requestDataDTO = new RequestDataDTO();
|
||||
requestDataDTO.setUsername(userNameExport);
|
||||
requestDataDTO.setPassword(passwordExport);
|
||||
String whereCond =
|
||||
if (ord.getDataEsportazione() != null && exportOrdini) {
|
||||
DtbOrdt finalOrd = ord;
|
||||
Optional<HashMap<String, Object>> exportOpt = export.stream()
|
||||
.filter(x -> ((String) x.get("cod_anag")).equalsIgnoreCase(finalOrd.getCodAnag())).findFirst();
|
||||
HashMap<String, Object> datiExport;
|
||||
if (exportOpt.isPresent()) {
|
||||
datiExport = exportOpt.get();
|
||||
} else {
|
||||
String query =
|
||||
Query.format(
|
||||
"dtb_ordt.gestione = %s AND dtb_ordt.data_ord = %s AND dtb_ordt.num_ord = %s",
|
||||
ord.getGestione(), ord.getDataOrd(), ord.getNumOrd());
|
||||
"SELECT wtb_clie.cod_anag, " +
|
||||
"wtb_users.user_name, wtb_users.password, wtb_users_info.format_file, COUNT(wtb_users_info.format_file) over (partition by wtb_users_info.user_name) as count_export" +
|
||||
" FROM wtb_users " +
|
||||
"INNER JOIN wtb_users_info ON wtb_users.User_name = wtb_users_info.user_name " +
|
||||
"INNER JOIN wtb_clie ON wtb_users.User_name = wtb_clie.user_name " +
|
||||
" WHERE wtb_users_info.flag_state = 'S' and " +
|
||||
" wtb_clie.cod_anag = %s AND \n" +
|
||||
" wtb_users_info.export_type = %s",
|
||||
ord.getCodAnag(), EntityExportType.ORDINI_VENDITA.getText());
|
||||
|
||||
ObjectNode jsonNode = JsonNodeFactory.instance.objectNode();
|
||||
jsonNode.put("whereCond", whereCond);
|
||||
emsServices.export(multiDBTransactionManager, requestDataDTO, EntityExportType.ORDINI_VENDITA.getText(), formatExport, jsonNode, true);
|
||||
datiExport = UtilityDB.executeSimpleQueryOnlyFirstRow(multiDBTransactionManager.getPrimaryConnection(), query);
|
||||
export.add(datiExport);
|
||||
}
|
||||
|
||||
if (UtilityHashMap.isPresent(datiExport)) {
|
||||
String userNameExport = UtilityHashMap.getValueIfExists(datiExport, "user_name");
|
||||
String passwordExport = UtilityHashMap.getValueIfExists(datiExport, "password");
|
||||
String formatExport = UtilityHashMap.getValueIfExists(datiExport, "format_file");
|
||||
Integer countExport = UtilityHashMap.getValueIfExists(datiExport, "count_export");
|
||||
|
||||
if (countExport == 1) {
|
||||
RequestDataDTO requestDataDTO = new RequestDataDTO();
|
||||
requestDataDTO.setUsername(userNameExport);
|
||||
requestDataDTO.setPassword(passwordExport);
|
||||
String whereCond =
|
||||
Query.format(
|
||||
"dtb_ordt.gestione = %s AND dtb_ordt.data_ord = %s AND dtb_ordt.num_ord = %s",
|
||||
ord.getGestione(), ord.getDataOrd(), ord.getNumOrd());
|
||||
|
||||
ObjectNode jsonNode = JsonNodeFactory.instance.objectNode();
|
||||
jsonNode.put("whereCond", whereCond);
|
||||
emsServices.export(multiDBTransactionManager, requestDataDTO, EntityExportType.ORDINI_VENDITA.getText(), formatExport, jsonNode, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,12 +11,12 @@ import it.integry.ems.product.importaz.dto.ArticoliMorganteDTO;
|
||||
import it.integry.ems.product.importaz.dto.ContrattiVenditaDTO;
|
||||
import it.integry.ems.product.importaz.dto.StatoArticoloDTO;
|
||||
import it.integry.ems.properties.EmsProperties;
|
||||
import it.integry.ems.retail.wms.Utility.WMSUtility;
|
||||
import it.integry.ems.rules.completing.QueryRules;
|
||||
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.utility.entity.MtbAartUtils;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import it.integry.ems_model.db.ResultSetMapper;
|
||||
import it.integry.ems_model.entity.*;
|
||||
@@ -235,7 +235,7 @@ public class ProductServices {
|
||||
}
|
||||
|
||||
public List<MtbAart> getArticoliByCodMarts(List<String> codMarts) throws Exception {
|
||||
return WMSUtility.getArticoliByCodMarts(codMarts, multiDBTransactionManager.getPrimaryConnection());
|
||||
return MtbAartUtils.getArticoliByCodMarts(codMarts, multiDBTransactionManager.getPrimaryConnection());
|
||||
}
|
||||
|
||||
public List<EntityBase> importArticoliBiolevante() throws Exception {
|
||||
|
||||
@@ -22,7 +22,6 @@ import it.integry.ems.production.event.ProductionUlCreatedEvent;
|
||||
import it.integry.ems.report.dto.JasperDTO;
|
||||
import it.integry.ems.report.dto.PairsDTO;
|
||||
import it.integry.ems.retail.pvmRetail.service.PvmService;
|
||||
import it.integry.ems.retail.wms.Utility.WMSUtility;
|
||||
import it.integry.ems.retail.wms.accettazione.service.WMSAccettazioneService;
|
||||
import it.integry.ems.retail.wms.dto.*;
|
||||
import it.integry.ems.retail.wms.generic.dto.MvwSitArtUdcDetInventarioDTO;
|
||||
@@ -42,6 +41,7 @@ import it.integry.ems.service.production.ProductionOrderDataHandlerService;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems.utility.UtilityDebug;
|
||||
import it.integry.ems.utility.UtilityEntity;
|
||||
import it.integry.ems.utility.entity.MtbAartUtils;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import it.integry.ems_model.business_logic.dto.DatiMaterialiDTO;
|
||||
import it.integry.ems_model.config.EmsRestConstants;
|
||||
@@ -1126,7 +1126,7 @@ public class MesProductionServiceV2 {
|
||||
entityProcessor.processEntity(ordineLav, true, multiDBTransactionManager);
|
||||
|
||||
MtbAart mtbAart =
|
||||
WMSUtility.getArticoloByCodMart(ordineLav.getCodProd(), multiDBTransactionManager.getPrimaryConnection());
|
||||
MtbAartUtils.getArticoloByCodMart(ordineLav.getCodProd(), multiDBTransactionManager.getPrimaryConnection());
|
||||
|
||||
if (UtilityBigDecimal.isNullOrZero(dto.getQtaCollo())) {
|
||||
if (UtilityBigDecimal.isNullOrZero(dto.getColliPedana())) {
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
package it.integry.ems.retail.wms.Utility;
|
||||
|
||||
import com.annimon.stream.Optional;
|
||||
import com.annimon.stream.Stream;
|
||||
import it.integry.ems._context.ApplicationContextProvider;
|
||||
import it.integry.ems.dynamic_cache.EntityCacheComponent;
|
||||
import it.integry.ems.exception.MissingDataException;
|
||||
import it.integry.ems.exception.PrimaryDatabaseNotPresentException;
|
||||
import it.integry.ems.javabeans.RequestDataDTO;
|
||||
@@ -19,6 +17,7 @@ import it.integry.ems.service.production.ProductionOrderDataHandlerService;
|
||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems.utility.UtilityEntity;
|
||||
import it.integry.ems.utility.entity.MtbAartUtils;
|
||||
import it.integry.ems_model.entity.*;
|
||||
import it.integry.ems_model.entity._enum.GestioneEnum;
|
||||
import it.integry.ems_model.rulescompleting.DroolsDataCompleting;
|
||||
@@ -30,7 +29,10 @@ import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.SQLException;
|
||||
import java.time.LocalDate;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class WMSUtility {
|
||||
@@ -252,7 +254,7 @@ public class WMSUtility {
|
||||
if (targetMtbColt == null)
|
||||
throw new Exception("Nessun collo di destinazione specificato durante l'inserimento di una riga in una UDS (targetMtbColt null)");
|
||||
|
||||
MtbAart mtbAart = WMSUtility.getArticoloByCodMart(insertUDSRowRequestDTO.getCodMart(), connection);
|
||||
MtbAart mtbAart = MtbAartUtils.getArticoloByCodMart(insertUDSRowRequestDTO.getCodMart(), connection);
|
||||
if (mtbAart == null)
|
||||
throw new InvalidArticoloException(insertUDSRowRequestDTO.getCodMart());
|
||||
|
||||
@@ -538,7 +540,7 @@ public class WMSUtility {
|
||||
|
||||
|
||||
if (insertUDCRowRequestDTO.getCodMart() != null) {
|
||||
MtbAart mtbAart = getArticoloByCodMart(insertUDCRowRequestDTO.getCodMart(), multiDBTransactionManager.getPrimaryConnection());
|
||||
MtbAart mtbAart = MtbAartUtils.getArticoloByCodMart(insertUDCRowRequestDTO.getCodMart(), multiDBTransactionManager.getPrimaryConnection());
|
||||
if (mtbAart == null)
|
||||
throw new InvalidArticoloException(insertUDCRowRequestDTO.getCodMart());
|
||||
|
||||
@@ -567,84 +569,7 @@ public class WMSUtility {
|
||||
.setSavedMtbColr(targetMtbColr);
|
||||
}
|
||||
|
||||
public static MtbAart getArticoloByCodMart(String codMart, Connection connection) throws Exception {
|
||||
if (UtilityString.isNullOrEmpty(codMart))
|
||||
return null;
|
||||
|
||||
List<MtbAart> mtbAarts = getArticoliByCodMarts(new ArrayList<>(Collections.singleton(codMart)), connection);
|
||||
if (mtbAarts == null || mtbAarts.isEmpty())
|
||||
return null;
|
||||
|
||||
return mtbAarts.get(0);
|
||||
}
|
||||
|
||||
public static List<MtbAart> getArticoliByCodMarts(List<String> codMarts, Connection connection) throws Exception {
|
||||
if (codMarts == null || codMarts.isEmpty()) return null;
|
||||
|
||||
codMarts.replaceAll(String::toUpperCase);
|
||||
|
||||
final EntityCacheComponent entityCacheComponent = ApplicationContextProvider.getApplicationContext().getBean(EntityCacheComponent.class);
|
||||
|
||||
List<MtbAart> listMtbAart = entityCacheComponent.getCachedEntitiesList(
|
||||
connection.getIntegryCustomerDB(), MtbAart.ENTITY, x -> codMarts.contains(x.getCodMart().toUpperCase()));
|
||||
|
||||
List<MtbAartBarCode> barCodeFromCod = getAlternativeMtbAartBarCodes(codMarts, connection);
|
||||
|
||||
if (listMtbAart != null && !listMtbAart.isEmpty()) {
|
||||
List<String> untMisStrings = listMtbAart.stream()
|
||||
.map(MtbAart::getUntMis)
|
||||
.collect(Collectors.toList());
|
||||
List<MtbUntMis> listUntMis = getUntMisFromCod(untMisStrings, connection);
|
||||
|
||||
for (final MtbAart mtbAart : listMtbAart) {
|
||||
Optional<MtbUntMis> mtbUntMis = Stream.of(listUntMis)
|
||||
.filter(mtbUntMis1 -> mtbUntMis1.getUntMis().equalsIgnoreCase(mtbAart.getUntMis()))
|
||||
.findFirst();
|
||||
|
||||
List<MtbAartBarCode> barcodeList = Stream.of(barCodeFromCod)
|
||||
.filter(x -> x.getCodMart().equalsIgnoreCase(mtbAart.getCodMart()))
|
||||
.toList();
|
||||
|
||||
if (!barcodeList.isEmpty()) {
|
||||
mtbAart.getMtbAartBarCode().addAll(barcodeList);
|
||||
}
|
||||
|
||||
if (mtbUntMis.isPresent()) {
|
||||
mtbAart.setMtbUntMis(new ArrayList<>());
|
||||
mtbAart.getMtbUntMis().add(mtbUntMis.get());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return listMtbAart;
|
||||
}
|
||||
|
||||
public static List<MtbUntMis> getUntMisFromCod(List<String> untMisCods, Connection connection) throws Exception {
|
||||
List<String> untMisStrings = Stream.of(untMisCods)
|
||||
.withoutNulls()
|
||||
.distinct()
|
||||
.toList();
|
||||
|
||||
String queryUntMis = "SELECT * FROM mtb_unt_mis WHERE unt_mis IN (" + UtilityQuery.concatStringFieldsWithSeparator(untMisStrings, ",") + ")";
|
||||
final List<MtbUntMis> mtbUntMis = UtilityDB.executeSimpleQueryDTO(connection, queryUntMis, MtbUntMis.class);
|
||||
return mtbUntMis != null ? mtbUntMis : new ArrayList<>();
|
||||
}
|
||||
|
||||
public static List<MtbAartBarCode> getAlternativeMtbAartBarCodes(List<String> codMarts, Connection conn) {
|
||||
codMarts = codMarts.stream()
|
||||
.distinct().collect(Collectors.toList());
|
||||
|
||||
final EntityCacheComponent entityCacheComponent = ApplicationContextProvider.getApplicationContext().getBean(EntityCacheComponent.class);
|
||||
|
||||
List<String> finalCodMarts = codMarts;
|
||||
List<MtbAartBarCode> barCodeList = entityCacheComponent.getCachedEntitiesList(
|
||||
conn.getIntegryCustomerDB(),
|
||||
MtbAartBarCode.ENTITY,
|
||||
x -> finalCodMarts.stream().anyMatch(y -> y.equalsIgnoreCase(x.getCodMart())));
|
||||
|
||||
return barCodeList != null ? barCodeList : new ArrayList<>();
|
||||
}
|
||||
|
||||
public static MtbColt createInternalMovement(String codMdep) {
|
||||
|
||||
@@ -665,6 +590,10 @@ public class WMSUtility {
|
||||
return null;
|
||||
|
||||
return new MtbColr()
|
||||
.setNumCollo(inputData.getNumCollo())
|
||||
.setDataCollo(inputData.getDataCollo())
|
||||
.setGestione(inputData.getGestione())
|
||||
.setSerCollo(inputData.getSerCollo())
|
||||
.setCodMart(inputData.getCodMart())
|
||||
.setPartitaMag(inputData.getPartitaMag())
|
||||
// .setCodCol(inputData.getCodCol())
|
||||
@@ -728,4 +657,14 @@ public class WMSUtility {
|
||||
|
||||
return UtilityDB.executeSimpleQueryDTO(connection,Query.format("SELECT * from mtb_colt where barcode_ul in ("+UtilityDB.listValueToString(barcodeList)+")"), MtbColt.class);
|
||||
}
|
||||
|
||||
public static MtbColt getUlPosizioneMonoUl(Connection connection, String posizione) throws Exception {
|
||||
String sql = "SELECT * FROM mtb_colt " +
|
||||
" inner join mtb_depo_posizioni on mtb_colt.posizione = mtb_depo_posizioni.posizione" +
|
||||
" WHERE mtb_colt.segno = 1 AND mtb_depo_posizioni.flag_mono_collo = 'S' and mtb_depo_posizioni.posizione = " + UtilityDB.valueToString(posizione) ;
|
||||
List<MtbColt> listaUl = UtilityDB.executeSimpleQueryDTO(connection,sql,MtbColt.class);
|
||||
if (listaUl.isEmpty()) throw new Exception("Nessuna UL trovata per la posizione " + posizione);
|
||||
if (listaUl.size() > 1) throw new Exception("Ci sono più UL disponibili per la posizione " + posizione);
|
||||
return listaUl.get(0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,13 +2,13 @@ package it.integry.ems.retail.wms.accettazione.service;
|
||||
|
||||
import it.integry.ems.javabeans.RequestDataDTO;
|
||||
import it.integry.ems.product.importaz.service.ProductServices;
|
||||
import it.integry.ems.retail.wms.Utility.WMSUtility;
|
||||
import it.integry.ems.retail.wms.accettazione.dto.AlreadyRegisteredUlDTO;
|
||||
import it.integry.ems.retail.wms.accettazione.dto.BollaAccettazioneDTO;
|
||||
import it.integry.ems.retail.wms.accettazione.dto.SitBollaAccettazioneDTO;
|
||||
import it.integry.ems.service.EntityProcessor;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems.user.UserSession;
|
||||
import it.integry.ems.utility.entity.MtbAartUtils;
|
||||
import it.integry.ems_model.entity.MtbAart;
|
||||
import it.integry.ems_model.entity.WdtbDoct;
|
||||
import it.integry.ems_model.types.OperationType;
|
||||
@@ -166,7 +166,7 @@ public class WMSAccettazioneBollaService {
|
||||
|
||||
if (sitBollaAccettazioneDTOS == null || sitBollaAccettazioneDTOS.isEmpty()) return null;
|
||||
|
||||
final List<MtbAart> articoliByCodMarts = WMSUtility.getArticoliByCodMarts(sitBollaAccettazioneDTOS.stream()
|
||||
final List<MtbAart> articoliByCodMarts = MtbAartUtils.getArticoliByCodMarts(sitBollaAccettazioneDTOS.stream()
|
||||
.map(SitBollaAccettazioneDTO::getCodMart)
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
|
||||
@@ -4,11 +4,11 @@ import it.integry.ems.product.importaz.service.ProductServices;
|
||||
import it.integry.ems.retail.pvmRetail.dto.PvmArticoliChildDTO;
|
||||
import it.integry.ems.retail.pvmRetail.dto.PvmArticoliDTO;
|
||||
import it.integry.ems.retail.pvmRetail.service.PvmService;
|
||||
import it.integry.ems.retail.wms.Utility.WMSUtility;
|
||||
import it.integry.ems.retail.wms.documenti.dto.DocumentArtDTO;
|
||||
import it.integry.ems.retail.wms.documenti.dto.RetrieveLottiDTO;
|
||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems.utility.entity.MtbUntMisUtils;
|
||||
import it.integry.ems_model.entity.MtbUntMis;
|
||||
import it.integry.ems_model.entity._enum.GestioneEnum;
|
||||
import it.integry.ems_model.service.SetupGest;
|
||||
@@ -114,7 +114,7 @@ public class WMSDocumentService {
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
final List<MtbUntMis> untMisFromCod = WMSUtility.getUntMisFromCod(untMiss,multiDBTransactionManager.getPrimaryConnection());
|
||||
final List<MtbUntMis> untMisFromCod = MtbUntMisUtils.getFromCods(untMiss, multiDBTransactionManager.getPrimaryConnection());
|
||||
|
||||
for (DocumentArtDTO art : arts) {
|
||||
final MtbUntMis mtbUntMis = untMisFromCod.stream().filter(x -> x.getUntMis().equalsIgnoreCase(art.getUntMis()))
|
||||
|
||||
@@ -556,9 +556,13 @@ public class WMSGenericController {
|
||||
public @ResponseBody
|
||||
ServiceRestResponse spostaULInPosizione(@RequestParam(CommonConstants.PROFILE_DB) String configuration,
|
||||
@RequestBody SpostaUlRequestDTO requestDTO) throws Exception {
|
||||
wmsGenericService.spostaUL(requestDTO);
|
||||
return ServiceRestResponse.createPositiveResponse();
|
||||
|
||||
try {
|
||||
wmsGenericService.spostaUL(requestDTO);
|
||||
return ServiceRestResponse.createPositiveResponse();
|
||||
} catch (Exception e) {
|
||||
multiDBTransactionManager.rollbackAll();
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -705,4 +709,11 @@ public class WMSGenericController {
|
||||
) throws Exception {
|
||||
return ServiceRestResponse.createPositiveResponse(WMSUtility.retrieveBarcodesByBarcodeAndCodJfas(multiDBTransactionManager.getPrimaryConnection(),barcodeUl,codJfas, maxResults));
|
||||
}
|
||||
|
||||
@GetMapping("wms/resetta-posizioni-mono-ul")
|
||||
ServiceRestResponse resettaPosizioniMonoUl() throws Exception {
|
||||
wmsGenericService.resettaPosizioniMonoUL(multiDBTransactionManager, entityProcessor);
|
||||
|
||||
return ServiceRestResponse.createPositiveResponse();
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package it.integry.ems.retail.wms.generic.dto;
|
||||
import it.integry.ems_model.entity.MtbColt;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public class SpostaUlRequestDTO {
|
||||
@@ -10,6 +11,9 @@ public class SpostaUlRequestDTO {
|
||||
private String codMdep;
|
||||
private String posizione;
|
||||
private String annotazioni;
|
||||
private Date dataTrasf;
|
||||
private Integer numTrasf;
|
||||
private String codVvet;
|
||||
private boolean createDocAutomatically = true;
|
||||
private List<MtbColt> mtbColtsToMove = new ArrayList<>();
|
||||
|
||||
@@ -49,6 +53,33 @@ public class SpostaUlRequestDTO {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataTrasf() {
|
||||
return dataTrasf;
|
||||
}
|
||||
|
||||
public SpostaUlRequestDTO setDataTrasf(Date dataTrasf) {
|
||||
this.dataTrasf = dataTrasf;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getNumTrasf() {
|
||||
return numTrasf;
|
||||
}
|
||||
|
||||
public SpostaUlRequestDTO setNumTrasf(Integer numTrasf) {
|
||||
this.numTrasf = numTrasf;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodVvet() {
|
||||
return codVvet;
|
||||
}
|
||||
|
||||
public SpostaUlRequestDTO setCodVvet(String codVvet) {
|
||||
this.codVvet = codVvet;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isCreateDocAutomatically() {
|
||||
return createDocAutomatically;
|
||||
}
|
||||
|
||||
@@ -36,10 +36,13 @@ import it.integry.ems.service.dto.production.OrdineInevasoGroupMercDTO;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems.user.UserSession;
|
||||
import it.integry.ems.utility.UtilityEntity;
|
||||
import it.integry.ems.utility.entity.MtbAartUtils;
|
||||
import it.integry.ems.utility.entity.MtbDepoPosizioniUtils;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import it.integry.ems_model.config.EmsRestConstants;
|
||||
import it.integry.ems_model.db.ResultSetMapper;
|
||||
import it.integry.ems_model.entity.*;
|
||||
import it.integry.ems_model.exception.GestSetupNotFoundException;
|
||||
import it.integry.ems_model.service.SetupGest;
|
||||
import it.integry.ems_model.types.OperationType;
|
||||
import it.integry.ems_model.types.SetupGestKeySection;
|
||||
@@ -101,6 +104,8 @@ public class WMSGenericService {
|
||||
|
||||
@Autowired
|
||||
private WMSAccettazioneService wmsAccettazioneService;
|
||||
@Autowired
|
||||
private WMSGiacenzaULService wmsGiacenzaULService;
|
||||
|
||||
public List<AvailableCodMdepDTO> getAvailableCodMdepsForUser() throws Exception {
|
||||
|
||||
@@ -782,7 +787,7 @@ public class WMSGenericService {
|
||||
.distinct()
|
||||
.toList();
|
||||
|
||||
final List<MtbAart> mtbAarts = WMSUtility.getArticoliByCodMarts(codMarts, multiDBTransactionManager.getPrimaryConnection());
|
||||
final List<MtbAart> mtbAarts = MtbAartUtils.getArticoliByCodMarts(codMarts, multiDBTransactionManager.getPrimaryConnection());
|
||||
|
||||
|
||||
//Carico la giacenza degli articoli
|
||||
@@ -1714,11 +1719,16 @@ public class WMSGenericService {
|
||||
anomalieList.add(AnomalieDTO.error("Non è stato trovato alcun articolo in giacenza"));
|
||||
continue;
|
||||
}
|
||||
List<String> articoliDaScaricare = Stream.of(results).map(MvwSitArtUdcDetInventarioDTO::getCodMart).distinct().toList();
|
||||
List<String> articoliDaScaricare = results.stream()
|
||||
.map(MvwSitArtUdcDetInventarioDTO::getCodMart)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
|
||||
for (String codMart : articoliDaScaricare) {
|
||||
List<MvwSitArtUdcDetInventarioDTO> giacenzeArticolo = Stream.of(results).filter(x -> x.getCodMart().equalsIgnoreCase(codMart)).toList();
|
||||
List<MvwSitArtUdcDetInventarioDTO> giacenzeArticolo = results.stream()
|
||||
.filter(x -> x.getCodMart().equalsIgnoreCase(codMart))
|
||||
.collect(Collectors.toList());
|
||||
if (giacenzeArticolo.isEmpty()) {
|
||||
anomalieList.add(AnomalieDTO.warning("Non è stato possibile scaricare la quantita di materia prima dell'articolo " + codMart + ". "));
|
||||
continue; //throw new Exception("Non è stato trovato alcun articolo in giacenza");
|
||||
@@ -2040,9 +2050,9 @@ public class WMSGenericService {
|
||||
|
||||
boolean gestisciColli = WMSUtility.isGestisciColli(mtbDepo, entityProcessor, multiDBTransactionManager);
|
||||
|
||||
MtbDepoPosizioni mtbDepoPosizioni = new MtbDepoPosizioni();
|
||||
if (!UtilityString.isNullOrEmpty(requestDTO.getPosizione())) {
|
||||
MtbDepoPosizioni mtbDepoPosizioni = new MtbDepoPosizioni()
|
||||
.setCodMdep(requestDTO.getCodMdep())
|
||||
mtbDepoPosizioni.setCodMdep(requestDTO.getCodMdep())
|
||||
.setPosizione(requestDTO.getPosizione());
|
||||
mtbDepoPosizioni.setOperation(OperationType.SELECT_OBJECT);
|
||||
|
||||
@@ -2060,7 +2070,7 @@ public class WMSGenericService {
|
||||
String codDtipToUse = setupGest.getSetupDepo(multiDBTransactionManager.getPrimaryConnection(), "PICKING", "LOGISTICA", "COD_DTIP_DOC_TRASF_INTERNI", requestDTO.getCodMdep());
|
||||
|
||||
if (UtilityString.isNullOrEmpty(codDtipToUse))
|
||||
throw new Exception("La configurazione della setup gest non è completa per gestire gli spostamenti tra depositi");
|
||||
throw new GestSetupNotFoundException("PICKING", "LOGISTICA", "COD_DTIP_DOC_TRASF_INTERNI");
|
||||
|
||||
String codAnag = mtbDepo.getCodAnag();
|
||||
String codVdes = mtbDepo.getCodVdes();
|
||||
@@ -2092,6 +2102,9 @@ public class WMSGenericService {
|
||||
.setCodMdep(codMdepDoc)
|
||||
.setCodVdes(codVdes)
|
||||
.setCodAnag(codAnag)
|
||||
.setDataDoc(requestDTO.getDataTrasf())
|
||||
.setNumDoc(requestDTO.getNumTrasf())
|
||||
.setCodVvet(requestDTO.getCodVvet())
|
||||
.setAnnotazioni(requestDTO.getAnnotazioni())
|
||||
.setCodDtip(codDtipToUse);
|
||||
|
||||
@@ -2155,13 +2168,19 @@ public class WMSGenericService {
|
||||
WMSUtility.trasferisciPedane(mtbColtToMove, listaPedane, dtbDoct);
|
||||
}
|
||||
|
||||
mtbColtToMove.setOperation(OperationType.UPDATE);
|
||||
mtbColtToMove
|
||||
.setMtbColr(new ArrayList<>())
|
||||
.setPosizione(UtilityString.isNull(requestDTO.getPosizione(), EmsRestConstants.NULL))
|
||||
.setCodMdep(requestDTO.getCodMdep());
|
||||
if (!UtilityString.isNullOrEmpty(mtbDepoPosizioni.getPosizione()) && mtbDepoPosizioni.isFlagMonoCollo()) {
|
||||
MtbColt ulMonocollo = WMSUtility.getUlPosizioneMonoUl(multiDBTransactionManager.getPrimaryConnection(),mtbDepoPosizioni.getPosizione());
|
||||
WMSUtility.spostaArtsTraUL(multiDBTransactionManager.getPrimaryConnection(), mtbColtToMove, ulMonocollo, false, entityProcessor, requestDataDTO);
|
||||
} else {
|
||||
|
||||
mtbColtToMove.setOperation(OperationType.UPDATE);
|
||||
mtbColtToMove
|
||||
.setMtbColr(new ArrayList<>())
|
||||
.setPosizione(UtilityString.isNull(requestDTO.getPosizione(), EmsRestConstants.NULL))
|
||||
.setCodMdep(requestDTO.getCodMdep());
|
||||
entitiesToSave.add(mtbColtToMove);
|
||||
}
|
||||
|
||||
entitiesToSave.add(mtbColtToMove);
|
||||
}
|
||||
|
||||
if (dtbDoct != null && !UtilityString.isNullOrEmpty(requestDTO.getAnnotazioni())) {
|
||||
@@ -2509,7 +2528,7 @@ public class WMSGenericService {
|
||||
.distinct()
|
||||
.toList();
|
||||
|
||||
List<MtbAart> mtbAarts = WMSUtility.getArticoliByCodMarts(codMarts, multiDBTransactionManager.getPrimaryConnection());
|
||||
List<MtbAart> mtbAarts = MtbAartUtils.getArticoliByCodMarts(codMarts, multiDBTransactionManager.getPrimaryConnection());
|
||||
|
||||
List<MtbColt> mtbColtToSave = new ArrayList<>();
|
||||
List<MtbColr> successMtbColr = new ArrayList<>();
|
||||
@@ -3088,4 +3107,59 @@ public class WMSGenericService {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public void resettaPosizioniMonoUL(MultiDBTransactionManager multiDBTransactionManager, EntityProcessor entityProcessor) throws Exception {
|
||||
List<MtbDepoPosizioni> posizioniMonoUL = MtbDepoPosizioniUtils.getAllMonoUlPositions(multiDBTransactionManager.getPrimaryConnection().getIntegryCustomerDB());
|
||||
|
||||
try {
|
||||
for (MtbDepoPosizioni posizione : posizioniMonoUL) {
|
||||
final List<MtbColt> oldUdcs = getULInPosizione(posizione, false);
|
||||
|
||||
if (oldUdcs == null)
|
||||
continue;
|
||||
|
||||
oldUdcs.removeIf(ul -> ul.getSegno() != 1); //consider only Lavorazione UDCs
|
||||
|
||||
|
||||
if (oldUdcs.isEmpty()) {
|
||||
//skip position
|
||||
continue;
|
||||
} else if (oldUdcs.size() > 1) {
|
||||
throw new Exception("Posizione " + posizione.getPosizione() + " contiene più di una UDC in una posizione mono UL");
|
||||
}
|
||||
final MtbColt newUdc = wmsLavorazioneService.createUDC(new CreateUDCRequestDTO()
|
||||
.setCodMdep(posizione.getCodMdep())
|
||||
.setPosizione(posizione.getPosizione()));
|
||||
|
||||
final MtbColt oldUdc = oldUdcs.get(0);
|
||||
|
||||
final List<MvwSitArtUdcDetInventarioDTO> giacenzaItems = wmsGiacenzaULService.retrieveArtsInGiacenzaByPosition(multiDBTransactionManager.getPrimaryConnection(), posizione.getPosizione());
|
||||
|
||||
if (giacenzaItems != null) {
|
||||
oldUdc.setMtbColr(WMSUtility.convertMvwItemsToMtbColrs(giacenzaItems));
|
||||
|
||||
WMSUtility.spostaArtsTraUL(multiDBTransactionManager.getPrimaryConnection(),
|
||||
oldUdc, newUdc, false, entityProcessor, RequestDataDTO.systemMockupData());
|
||||
|
||||
}
|
||||
|
||||
//remove position from old UL
|
||||
UtilityDB.executeStatement(multiDBTransactionManager.getPrimaryConnection(),
|
||||
"UPDATE mtb_colt SET posizione = NULL " +
|
||||
"WHERE gestione = " + UtilityDB.valueToString(oldUdc.getGestione()) + " " +
|
||||
"AND data_collo = " + UtilityDB.valueToString(oldUdc.getDataCollo()) + " " +
|
||||
"AND ser_collo = " + UtilityDB.valueToString(oldUdc.getSerCollo()) + " " +
|
||||
"AND num_collo = " + UtilityDB.valueToString(oldUdc.getNumCollo())
|
||||
);
|
||||
|
||||
//save all
|
||||
}
|
||||
|
||||
} catch (Exception ex) {
|
||||
multiDBTransactionManager.rollbackAll();
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,12 +6,12 @@ import it.integry.ems.product.importaz.service.ProductServices;
|
||||
import it.integry.ems.retail.pvmRetail.dto.PvmArticoliChildDTO;
|
||||
import it.integry.ems.retail.pvmRetail.dto.PvmArticoliDTO;
|
||||
import it.integry.ems.retail.pvmRetail.service.PvmService;
|
||||
import it.integry.ems.retail.wms.Utility.WMSUtility;
|
||||
import it.integry.ems.retail.wms.inventario.dto.InventarioArtDTO;
|
||||
import it.integry.ems.service.EntityProcessor;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems.utility.UtilityDirs;
|
||||
import it.integry.ems.utility.UtilityFile;
|
||||
import it.integry.ems.utility.entity.MtbUntMisUtils;
|
||||
import it.integry.ems_model.entity.MtbInvenr;
|
||||
import it.integry.ems_model.entity.MtbInvent;
|
||||
import it.integry.ems_model.entity.MtbUntMis;
|
||||
@@ -136,7 +136,7 @@ public class WMSInventarioService {
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
final List<MtbUntMis> untMisFromCod = WMSUtility.getUntMisFromCod(untMiss,multiDBTransactionManager.getPrimaryConnection());
|
||||
final List<MtbUntMis> untMisFromCod = MtbUntMisUtils.getFromCods(untMiss, multiDBTransactionManager.getPrimaryConnection());
|
||||
|
||||
for (InventarioArtDTO art : arts) {
|
||||
final MtbUntMis mtbUntMis = untMisFromCod.stream().filter(x -> x.getUntMis().equalsIgnoreCase(art.getUntMis()))
|
||||
|
||||
@@ -23,6 +23,7 @@ import it.integry.ems.service.production.ProductionOrderDataHandlerService;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems.user.UserSession;
|
||||
import it.integry.ems.utility.UtilityEntity;
|
||||
import it.integry.ems.utility.entity.MtbAartUtils;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import it.integry.ems_model.entity.*;
|
||||
import it.integry.ems_model.entity._enum.GestioneEnum;
|
||||
@@ -264,7 +265,7 @@ public class WMSLavorazioneService {
|
||||
entityProcessor.processEntity(targetMtbColt, true, multiDBTransactionManager);
|
||||
|
||||
|
||||
MtbAart mtbAart = WMSUtility.getArticoloByCodMart(insertUDSRowRequestDTO.getCodMart(), multiDBTransactionManager.getPrimaryConnection());
|
||||
MtbAart mtbAart = MtbAartUtils.getArticoloByCodMart(insertUDSRowRequestDTO.getCodMart(), multiDBTransactionManager.getPrimaryConnection());
|
||||
if (mtbAart == null)
|
||||
throw new InvalidArticoloException(insertUDSRowRequestDTO.getCodMart());
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ import it.integry.ems.service.EntityProcessor;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems.user.UserSession;
|
||||
import it.integry.ems.utility.UtilityEntity;
|
||||
import it.integry.ems.utility.entity.MtbAartUtils;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import it.integry.ems_model.entity.*;
|
||||
import it.integry.ems_model.service.SetupGest;
|
||||
@@ -93,7 +94,7 @@ public class WMSMaterialiService {
|
||||
if (!versamentoDirettoEnabled) {
|
||||
MvwSitArtUdcDetInventarioDTO itemDaVersare = artsInGiacenza.get(0);
|
||||
|
||||
MtbAart mtbAart = WMSUtility.getArticoloByCodMart(itemDaVersare.getCodMart(), multiDBTransactionManager.getPrimaryConnection());
|
||||
MtbAart mtbAart = MtbAartUtils.getArticoloByCodMart(itemDaVersare.getCodMart(), multiDBTransactionManager.getPrimaryConnection());
|
||||
if (mtbAart == null)
|
||||
throw new InvalidArticoloException(request.getCodMart());
|
||||
|
||||
@@ -134,7 +135,7 @@ public class WMSMaterialiService {
|
||||
// throw new Exception("Impossibile recuperare le informazioni della posizione (" + request.getPosizioneVersamento() + ")");
|
||||
//
|
||||
// for(MvwSitArtUdcDetInventarioDTO artInGiacenza : artsInGiacenza) {
|
||||
// final MtbAart currentArtAnag = WMSUtility.getArticoloByCodMart(artInGiacenza.getCodMart(), multiDBTransactionManager.getPrimaryConnection());
|
||||
// final MtbAart currentArtAnag = MtbAartUtils.getArticoloByCodMart(artInGiacenza.getCodMart(), multiDBTransactionManager.getPrimaryConnection());
|
||||
//
|
||||
// if(currentArtAnag == null)
|
||||
// continue;
|
||||
@@ -275,7 +276,7 @@ public class WMSMaterialiService {
|
||||
final boolean versamentoDirettoEnabled = setupGest.getSetupBoolean(multiDBTransactionManager.getPrimaryConnection(), "PICKING", "PRODUZIONE", "FLAG_VERSAMENTO_DIRETTO");
|
||||
final boolean forceAllToColli = setupGest.getSetupBoolean(multiDBTransactionManager.getPrimaryConnection(), "PICKING", "SETUP", "FLAG_FORCE_ALL_TO_COLLI");
|
||||
|
||||
MtbAart mtbAart = WMSUtility.getArticoloByCodMart(request.getCodMart(), multiDBTransactionManager.getPrimaryConnection());
|
||||
MtbAart mtbAart = MtbAartUtils.getArticoloByCodMart(request.getCodMart(), multiDBTransactionManager.getPrimaryConnection());
|
||||
if (mtbAart == null)
|
||||
throw new InvalidArticoloException(request.getCodMart());
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ import it.integry.ems.service.EntityProcessor;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems.user.UserSession;
|
||||
import it.integry.ems.utility.UtilityEntity;
|
||||
import it.integry.ems.utility.entity.MtbAartUtils;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import it.integry.ems_model.entity.DtbOrdt;
|
||||
import it.integry.ems_model.entity.MtbAart;
|
||||
@@ -244,7 +245,7 @@ public class WMSSpedizioneService {
|
||||
entityProcessor.processEntity(targetMtbColt, multiDBTransactionManager);
|
||||
|
||||
|
||||
MtbAart mtbAart = WMSUtility.getArticoloByCodMart(insertUDSRowRequestDTO.getCodMart(), multiDBTransactionManager.getPrimaryConnection());
|
||||
MtbAart mtbAart = MtbAartUtils.getArticoloByCodMart(insertUDSRowRequestDTO.getCodMart(), multiDBTransactionManager.getPrimaryConnection());
|
||||
if (mtbAart == null)
|
||||
throw new InvalidArticoloException(insertUDSRowRequestDTO.getCodMart());
|
||||
|
||||
|
||||
@@ -106,6 +106,7 @@ public class ExchangeArticoliImportService {
|
||||
x.getMtbAartBarCode().forEach(y -> y.setOperation(y.getOperation() == OperationType.INSERT ? OperationType.INSERT_OR_UPDATE : y.getOperation()));
|
||||
x.getMtbAartCarat().forEach(y -> y.setOperation(y.getOperation() == OperationType.INSERT ? OperationType.INSERT_OR_UPDATE : y.getOperation()));
|
||||
x.getMtbAartColori().forEach(y -> y.setOperation(y.getOperation() == OperationType.INSERT ? OperationType.INSERT_OR_UPDATE : y.getOperation()));
|
||||
x.getMtbAartDesc().forEach(y -> y.setOperation(y.getOperation() == OperationType.INSERT ? OperationType.INSERT_OR_UPDATE : y.getOperation()));
|
||||
});
|
||||
|
||||
final Exception[] firstExceptionToThrow = {null};
|
||||
@@ -150,6 +151,7 @@ public class ExchangeArticoliImportService {
|
||||
final List<MtbAartBarCode> mtbAartBarCode = retrieveMtbAartBarcode(connection, retrieveAlreadyImported, useTempTable);
|
||||
final List<MtbAartColori> mtbAartColori = retrieveMtbAartColori(connection, retrieveAlreadyImported, useTempTable);
|
||||
final List<MtbAartCarat> mtbAartCarat = retrieveMtbAartCarat(connection, retrieveAlreadyImported, useTempTable);
|
||||
final List<MtbAartDesc> mtbAartDesc = retrieveMtbAartDesc(connection, retrieveAlreadyImported, useTempTable);
|
||||
|
||||
mtbAart
|
||||
.parallelStream()
|
||||
@@ -162,6 +164,10 @@ public class ExchangeArticoliImportService {
|
||||
.filter(y -> y.getCodMart().equalsIgnoreCase(x.getCodMart()))
|
||||
.collect(Collectors.toList()))
|
||||
.setMtbAartCarat(mtbAartCarat.stream()
|
||||
.map(y -> y)
|
||||
.filter(y -> y.getCodMart().equalsIgnoreCase(x.getCodMart()))
|
||||
.collect(Collectors.toList()))
|
||||
.setMtbAartDesc(mtbAartDesc.stream()
|
||||
.map(y -> y)
|
||||
.filter(y -> y.getCodMart().equalsIgnoreCase(x.getCodMart()))
|
||||
.collect(Collectors.toList())));
|
||||
@@ -178,13 +184,38 @@ public class ExchangeArticoliImportService {
|
||||
|
||||
exchangeImportDataManagerService.updateImportedStatus(connection, "mtb_aart", importedKey, useTempTable);
|
||||
|
||||
final List<HashMap<String, Object>> importedMtbSgrpKeys = importedMtbAart.getMtbAartColori().stream()
|
||||
final List<HashMap<String, Object>> importedMtbAartColori = importedMtbAart.getMtbAartColori().stream()
|
||||
.map(x -> new HashMap<String, Object>() {{
|
||||
put("cod_col", x.getCodCol());
|
||||
}})
|
||||
.collect(Collectors.toList());
|
||||
|
||||
exchangeImportDataManagerService.updateImportedStatus(connection, "mtb_aart_colori", importedMtbSgrpKeys, useTempTable);
|
||||
exchangeImportDataManagerService.updateImportedStatus(connection, "mtb_aart_colori", importedMtbAartColori, useTempTable);
|
||||
|
||||
final List<HashMap<String, Object>> importedMtbAartCarat = importedMtbAart.getMtbAartCarat().stream()
|
||||
.map(x -> new HashMap<String, Object>() {{
|
||||
put("carat", x.getCarat());
|
||||
}})
|
||||
.collect(Collectors.toList());
|
||||
|
||||
exchangeImportDataManagerService.updateImportedStatus(connection, "mtb_aart_carat", importedMtbAartCarat, useTempTable);
|
||||
|
||||
final List<HashMap<String, Object>> importedMtbAartBarcode = importedMtbAart.getMtbAartBarCode().stream()
|
||||
.map(x -> new HashMap<String, Object>() {{
|
||||
put("cod_barre", x.getCodBarre());
|
||||
}})
|
||||
.collect(Collectors.toList());
|
||||
|
||||
exchangeImportDataManagerService.updateImportedStatus(connection, "mtb_aart_bar_code", importedMtbAartBarcode, useTempTable);
|
||||
|
||||
|
||||
final List<HashMap<String, Object>> importedMtbAartDesc = importedMtbAart.getMtbAartDesc().stream()
|
||||
.map(x -> new HashMap<String, Object>() {{
|
||||
put("cod_lingua", x.getCodLingua());
|
||||
}})
|
||||
.collect(Collectors.toList());
|
||||
|
||||
exchangeImportDataManagerService.updateImportedStatus(connection, "mtb_aart_desc", importedMtbAartDesc, useTempTable);
|
||||
}
|
||||
|
||||
|
||||
@@ -677,7 +708,7 @@ public class ExchangeArticoliImportService {
|
||||
false, useTempTable);
|
||||
|
||||
List<EquatableEntityInterface> allData = exchangeImportDataManagerService
|
||||
.runSync(MtbAartMarchio.class, exchangeImportedData, exchangeUpdatedData);
|
||||
.runSync(MtbTipi.class, exchangeImportedData, exchangeUpdatedData);
|
||||
|
||||
allData.forEach(x -> x.setOperation(x.getOperation() == OperationType.INSERT ? OperationType.INSERT_OR_UPDATE : x.getOperation()));
|
||||
|
||||
@@ -993,5 +1024,22 @@ public class ExchangeArticoliImportService {
|
||||
tableName, null, retrieveAlreadyImported);
|
||||
}
|
||||
|
||||
private List<MtbAartDesc> retrieveMtbAartDesc(Connection connection, boolean retrieveAlreadyImported, boolean useTempTable) throws Exception {
|
||||
String originalTableName = "mtb_aart_desc";
|
||||
String tableName = originalTableName + (useTempTable ? "_tmp" : "");
|
||||
|
||||
|
||||
if (useTempTable) {
|
||||
UtilityDB.executeStatement(connection,
|
||||
"INSERT INTO " + tableName +
|
||||
" SELECT * FROM " + originalTableName
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
return exchangeImportDataManagerService.retrieveDataFromExchange(connection, MtbAartDesc.class,
|
||||
tableName, null, retrieveAlreadyImported);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -108,6 +108,7 @@ public class ExchangeImportSchemaManagerService {
|
||||
put("mtb_aart_bar_code", MtbAartBarCode.class);
|
||||
put("mtb_aart_carat", MtbAartCarat.class);
|
||||
put("mtb_aart_equi", MtbAartEqui.class);
|
||||
put("mtb_aart_desc", MtbAartDesc.class);
|
||||
}});
|
||||
put(SchemaType.PartiteMagazzinoLavorazione, new HashMap<String, Class<? extends EntityInterface>>() {{
|
||||
put("mtb_partita_mag_lav", MtbPartitaMag.class);
|
||||
|
||||
Reference in New Issue
Block a user