Merge branch 'master' into feature/RefactoringGestioneColli
# Conflicts: # ems-core/src/main/java/it/integry/ems/dbms_change_tracker/component/DbmsChangeTrackerComponent.java # ems-core/src/main/java/it/integry/ems/dynamic_cache/EntityCacheComponent.java # ems-core/src/main/java/it/integry/ems/rules/businessLogic/AccountingBusinessLogic.java # ems-core/src/main/java/it/integry/ems/rules/completing/CommonRules.java # ems-core/src/main/java/it/integry/ems/rules/completing/SalesRules.java # ems-core/src/main/java/it/integry/ems_model/business_logic/GeneraOrdLav.java # ems-core/src/main/resources/rules/contabilita.drl # ems-engine/src/main/java/it/integry/ems/customizations/production/service/ToscaProductionService.java # ems-engine/src/main/java/it/integry/ems/product/importaz/service/ImportAnagListiniService.java # ems-engine/src/main/java/it/integry/ems/product/importaz/service/ImportImeService.java # ems-engine/src/main/java/it/integry/ems/product/importaz/service/ImportListiniVenditaService.java # ems-engine/src/main/java/it/integry/ems/product/service/ListiniVenditaServices.java # ems-engine/src/main/java/it/integry/ems/production/dto/CreateUDCProduzioneRequestDTO.java # ems-engine/src/main/java/it/integry/ems/production/service/MesProductionServiceV2.java # ems-engine/src/main/java/it/integry/ems/retail/pvmRetail/service/PvmService.java
This commit is contained in:
1701
.idea/inspectionProfiles/LocalDate_passato_a_SimpleDate.xml
generated
Normal file
1701
.idea/inspectionProfiles/LocalDate_passato_a_SimpleDate.xml
generated
Normal file
File diff suppressed because it is too large
Load Diff
10
.idea/structuralSearch.xml
generated
Normal file
10
.idea/structuralSearch.xml
generated
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="StructuralSearch">
|
||||
<searchConfiguration name="LocalDate passato a SimpleDateFormat" text="$formatter$.format($date$)" recursive="true" caseInsensitive="true" type="JAVA" pattern_context="default">
|
||||
<constraint name="__context__" within="" contains="" />
|
||||
<constraint name="formatter" nameOfExprType="java\.text\.SimpleDateFormat" within="" contains="" />
|
||||
<constraint name="date" nameOfExprType="java\.time\.LocalDate" within="" contains="" />
|
||||
</searchConfiguration>
|
||||
</component>
|
||||
</project>
|
||||
@@ -49,7 +49,7 @@ public class DbmsChangeTrackerComponent {
|
||||
}
|
||||
|
||||
|
||||
@PostContextConstruct
|
||||
@PostContextConstruct(priority = 10)
|
||||
public void init() throws Exception {
|
||||
for (Connection conn : multiDBTransactionManager.getActiveConnections()) {
|
||||
IntegryCustomerDB customerDB = IntegryCustomerDB.parse(conn.getDbName());
|
||||
|
||||
@@ -28,7 +28,7 @@ public class DevicesRequestInterceptor implements HandlerInterceptor {
|
||||
RequestDataDTO requestDataDTO = ContextLoader.getCurrentWebApplicationContext().getBean(RequestDataDTO.class);
|
||||
|
||||
if (requestDataDTO.isValidProfileDB() && requestDataDTO.isValidDeviceId()) {
|
||||
deviceService.updateUsage(requestDataDTO.getApplication(), requestDataDTO.getDeviceId());
|
||||
deviceService.updateUsage(requestDataDTO.getDeviceId());
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -63,7 +63,7 @@ public class EntityCacheComponent implements ApplicationListener {
|
||||
|
||||
@PostContextConstruct
|
||||
private void init() throws Exception {
|
||||
if (UtilityDebug.isDebugExecution())
|
||||
if (UtilityDebug.isDebugExecution() || UtilityDebug.isIntegryServer())
|
||||
return;
|
||||
|
||||
for (Connection conn : multiDBTransactionManager.getActiveConnections()) {
|
||||
|
||||
@@ -75,6 +75,10 @@ public abstract class BaseMigration implements MigrationModelInterface {
|
||||
return UtilityDB.executeSimpleQueryDTO(connection, sql, clazz);
|
||||
}
|
||||
|
||||
protected @NotNull <T> List<T> executeQueryOnlyFirstColumn(String sql) throws SQLException {
|
||||
return UtilityDB.executeSimpleQueryOnlyFirstColumn(connection, sql);
|
||||
}
|
||||
|
||||
protected void executeStatement(String... sqls) throws SQLException {
|
||||
executeStatement(connection, sqls);
|
||||
}
|
||||
|
||||
@@ -123,6 +123,7 @@ public enum IntegryCustomerDB {
|
||||
Levanplast_Perilflor("perilflor"),
|
||||
Levanplast_PerilflorSrl("perilflorsrl"),
|
||||
Levanplast_Levanplast("levanplast"),
|
||||
Levanplast_Levanplastsrl("levanplastsrl"),
|
||||
|
||||
Maggio_MaggioSrl("maggiosrl"),
|
||||
Maggio_GiovMaggio("giovmaggio"),
|
||||
|
||||
@@ -10,6 +10,8 @@ public class Migration_20251022125946 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
createOrUpdateFunction("getListinoVendita", "CREATE FUNCTION [dbo].[getListinoVendita](@datavalidita DATETIME, @codvlis VARCHAR(5), @codmart VARCHAR(15))\n" +
|
||||
" RETURNS TABLE AS\n" +
|
||||
|
||||
@@ -10,6 +10,9 @@ public class Migration_20251024175524 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
executeStatement(
|
||||
"exec DropForeignKey 'ctb_amac', 'mtb_depo_posizioni'",
|
||||
"exec DropForeignKey 'jrl_fase_posizioni', 'mtb_depo_posizioni'",
|
||||
|
||||
@@ -13,6 +13,9 @@ public class Migration_20251027172319 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
executeStatement(
|
||||
"CREATE TABLE [dbo].[mtb_ssfam]("
|
||||
+ " [cod_mgrp] varchar(5) NOT NULL, "
|
||||
|
||||
@@ -14,6 +14,9 @@ public class Migration_20251027173518 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
IndexTableDTO indexTableDTO =
|
||||
new IndexTableDTO()
|
||||
.setTableName("mtb_aart_marchio")
|
||||
|
||||
@@ -10,6 +10,8 @@ public class Migration_20251029153203 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
createOrUpdateView("[vw_tracciabUDCVend]", "CREATE VIEW [dbo].[vw_tracciabUDCVend] AS\n" +
|
||||
"SELECT mtb_colt.cod_anag AS codAnag,\n" +
|
||||
|
||||
@@ -10,6 +10,8 @@ public class Migration_20251029170931 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
createOrUpdateFunction("getDettMatricoleDaOrdine", "CREATE Function [dbo].[getDettMatricoleDaOrdine] (@codJcom varchar(10)) \n" +
|
||||
"RETURNS @dettMatricole TABLE( cod_prod varchar(15),\n" +
|
||||
|
||||
@@ -21,6 +21,9 @@ public class Migration_20251029181607 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
executeStatement(
|
||||
"EXEC sp_updateextendedproperty 'MS_Description',\n" +
|
||||
" 'Valori possibili: 0 -> Testo, 1 -> Boolean, 2 -> Intero, 3 -> Decimale, 4 -> Date, 5 -> Datetime, 6 -> Time, 7 -> DropdownList',\n" +
|
||||
|
||||
@@ -10,6 +10,9 @@ public class Migration_20251031092657 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
executeStatement("alter table dtb_tipi add flag_delete_plk bit not null default 0");
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,9 @@ public class Migration_20251031100008 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
executeStatement("exec sp_rename 'dtb_tipi.flag_delete_plk', 'flag_delete_pkl'");
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,9 @@ public class Migration_20251103175252 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
executeStatement(
|
||||
"CREATE TABLE mtb_colori ("
|
||||
+ " cod_col varchar(6) NOT NULL, "
|
||||
|
||||
@@ -10,6 +10,9 @@ public class Migration_20251104122721 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
executeStatement(
|
||||
"ALTER TABLE dbo.vtb_offt\n" +
|
||||
" ADD cod_banc VARCHAR(5)\n" +
|
||||
|
||||
@@ -10,6 +10,9 @@ public class Migration_20251105171403 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
executeStatement("delete dtb_ordr\n" +
|
||||
"from dtb_ordr \n" +
|
||||
"where not exists (select *\n" +
|
||||
|
||||
@@ -11,6 +11,9 @@ public class Migration_20251106104752 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
dropDefault("mtb_lisv", "flag_primario");
|
||||
|
||||
addDefault("mtb_lisv", "flag_primario", 1);
|
||||
|
||||
@@ -10,6 +10,9 @@ public class Migration_20251106113104 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
createOrUpdateFunction(
|
||||
"pvm_getassortimentoClientePedane",
|
||||
"CREATE FUNCTION [dbo].[pvm_getassortimentoClientePedane](\n" +
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251110095557 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
createSetup("PVM","MRP", "COD_MDEP_PREF", null, "Inserire la lista dei depositi preselezionati per utente",
|
||||
"COD_MDEP", true, true);
|
||||
}
|
||||
|
||||
@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.IntegryCustomerDB;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
import it.integry.ems_model.utility.UtilityQuery;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Migration_20251110100959 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
|
||||
if (!isCustomerDb(IntegryCustomerDB.Carelli_Winact))
|
||||
return;
|
||||
|
||||
final List<String> duplicatedBarcodes = executeQueryOnlyFirstColumn("SELECT cod_barre\n" +
|
||||
"FROM mtb_aart_bar_code\n" +
|
||||
"GROUP BY cod_barre\n" +
|
||||
"HAVING COUNT(cod_barre) > 1");
|
||||
|
||||
executeStatement("DELETE FROM dbo.mtb_aart_bar_code\n" +
|
||||
"WHERE cod_barre IN (" + UtilityQuery.concatStringFieldsWithSeparator(duplicatedBarcodes, ",") + ")");
|
||||
|
||||
|
||||
executeStatement("ALTER TABLE dbo.mtb_aart_bar_code\n" +
|
||||
" ALTER COLUMN cod_mart VARCHAR(15) NOT NULL",
|
||||
"ALTER TABLE dbo.mtb_aart_bar_code\n" +
|
||||
" ALTER COLUMN cod_barre VARCHAR(40) NOT NULL",
|
||||
"ALTER TABLE dbo.mtb_aart_bar_code\n" +
|
||||
" ADD CONSTRAINT pk_mtb_aart_bar_code\n" +
|
||||
" PRIMARY KEY (cod_mart, cod_barre)");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251110104131 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
executeStatement(
|
||||
"ALTER TABLE dbo.vtb_viaggi\n" +
|
||||
" ALTER COLUMN note_incoterms VARCHAR(40) NULL;"
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,9 @@ public class Migration_20251110111625 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
createSetupQuery(null, null, "SELECT '1|Prezzo netto d''acquisto e ricalcola il prezzo di vendita (Ricarica fissa)' UNION SELECT '2|Prezzo netto d''acquisto e ricalcola ricarica (Prezzo di vendita fisso)' UNION SELECT '3|Prezzo netto d''acquisto e prezzo di vendita da prezzo lordo d''acquisto (Ricalcola ricarica)' UNION SELECT '4|Prezzo netto d''acquisto e ricalcola il prezzo di vendita (Ricarica fissa da Testata listino)' UNION SELECT '5|Prezzo netto d''acquisto, prezzo di vendita e ricarica fissa (Non ricalcolare prezzo)' UNION SELECT '6|Prezzo netto d''acquisto, prezzo di vendita = Prezzo Vendita Suggerito' UNION SELECT '7|Non ricalcolare il prezzo' ");
|
||||
createSetup("VTB_LIST", "LISV4LISA", "CALC_PRZ_BASE", null,
|
||||
"SELEZIONARE IL CRITERIO DI CALCOLO DEL PREZZO BASE", false, null, false, false,
|
||||
|
||||
@@ -0,0 +1,284 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251110175256 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
executeStatement("alter table vtb_list add tipo_um tinyint");
|
||||
createOrUpdateFunction("getListinoVendita","CREATE FUNCTION [dbo].[getListinoVendita](@datavalidita DATETIME, @codvlis VARCHAR(5), @codmart VARCHAR(15))\n" +
|
||||
" RETURNS TABLE AS\n" +
|
||||
" RETURN\n" +
|
||||
" SELECT vtb_list.cod_vlis,\n" +
|
||||
" vtb_list.descrizione,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN tmp_list.max_lisv IS NULL THEN NULL\n" +
|
||||
" ELSE CONVERT(DATETIME, LEFT(tmp_list.max_lisv, 10)) END AS data_iniz,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN tmp_list.max_lisv IS NULL THEN NULL\n" +
|
||||
" ELSE CONVERT(INT, RIGHT(tmp_list.max_lisv, 4)) END AS versione,\n" +
|
||||
" vtb_list.cod_divi,\n" +
|
||||
" vtb_list.cambio,\n" +
|
||||
" vtb_list.flag_arr_prz_iva,\n" +
|
||||
" vtb_list.arr_ric,\n" +
|
||||
" vtb_list.flag_list_iva_inclusa,\n" +
|
||||
" vtb_list.flag_lisv_margine,\n" +
|
||||
" vtb_list.flag_add_trasp,\n" +
|
||||
" tmp_list.cod_mart AS 'cod_mart',\n" +
|
||||
" mtb_lisv_data.unt_mis_ven AS unt_mis_ven,\n" +
|
||||
" ISNULL(mtb_lisv_data.rap_conv, 1) AS rap_conv,\n" +
|
||||
" ISNULL(mtb_lisv_data.prz_base, 0) AS prz_base,\n" +
|
||||
" ISNULL(mtb_lisv_data.ricarica, 0) AS ricarico,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN mtb_lisv_data.prz_vend IS NOT NULL AND mtb_lisv_data.prz_vend <> 0 THEN\n" +
|
||||
" ROUND((ISNULL(mtb_lisv_data.prz_vend, 0) -\n" +
|
||||
" (ISNULL(mtb_lisv_data.prz_base, 0) / (1 - mtb_aart.perc_sfrido / 100))) /\n" +
|
||||
" ISNULL(mtb_lisv_data.prz_vend, 0) * 100, 2)\n" +
|
||||
" ELSE 0 END AS margine_eff,\n" +
|
||||
" --dbo.f_calcMargineEffettivo(IsNull(mtb_lisv_data.prz_base, 0), IsNull(mtb_lisv_data.prz_vend, 0), mtb_aart.perc_sfrido) as margine_eff,\n" +
|
||||
" --dbo.f_calcRicaricoEffettivo(IsNull(mtb_lisv_data.prz_base, 0), IsNull(mtb_lisv_data.prz_vend, 0), mtb_aart.perc_sfrido) ricarico_eff, \n" +
|
||||
" CASE\n" +
|
||||
" WHEN mtb_lisv_data.prz_base IS NOT NULL AND mtb_lisv_data.prz_base <> 0 THEN\n" +
|
||||
" ROUND((ISNULL(mtb_lisv_data.prz_vend, 0) -\n" +
|
||||
" (ISNULL(mtb_lisv_data.prz_base, 0) / (1 - mtb_aart.perc_sfrido / 100))) /\n" +
|
||||
" (ISNULL(mtb_lisv_data.prz_base, 0) / (1 - mtb_aart.perc_sfrido / 100)) * 100, 2)\n" +
|
||||
" ELSE 0 END AS ricarico_eff,\n" +
|
||||
"\n" +
|
||||
" ISNULL(mtb_lisv_data.magg_prz_vend, 0) AS magg_prz_vend,\n" +
|
||||
" ISNULL(mtb_lisv_data.prz_vend, 0) AS prz_vend,\n" +
|
||||
" ISNULL(mtb_lisv_data.prz_vend_iva, 0) AS prz_vend_iva,\n" +
|
||||
" ISNULL(mtb_lisv_data.perc_sco1, 0) AS perc_sco1,\n" +
|
||||
" ISNULL(mtb_lisv_data.perc_sco2, 0) AS perc_sco2,\n" +
|
||||
" ISNULL(mtb_lisv_data.perc_sco3, 0) AS perc_sco3,\n" +
|
||||
" ISNULL(mtb_lisv_data.perc_sco4, 0) AS perc_sco4,\n" +
|
||||
" ISNULL(mtb_lisv_data.perc_prov, 0) AS perc_prov,\n" +
|
||||
" ISNULL(mtb_lisv_data.fisso_prov, 0) AS fisso_prov,\n" +
|
||||
" ISNULL(mtb_lisv_data.posizione, '') AS posizione,\n" +
|
||||
" ISNULL(mtb_lisv_data.perc_gest, 0) AS perc_gest,\n" +
|
||||
" ISNULL(mtb_lisv_data.val_gest, 0) AS val_gest,\n" +
|
||||
" mtb_lisv_data.data_agg_prz AS data_agg_prz,\n" +
|
||||
" ISNULL(mtb_lisv_data.perc_ispe, 0) AS perc_ispe,\n" +
|
||||
" ISNULL(mtb_lisv_data.val_ispe, 0) AS val_ispe,\n" +
|
||||
" ISNULL(mtb_lisv_data.perc_promo, 0) AS perc_promo,\n" +
|
||||
" ISNULL(mtb_lisv_data.val_promo, 0) AS val_promo,\n" +
|
||||
" ISNULL(mtb_lisv_data.perc_oneri, 0) AS perc_oneri,\n" +
|
||||
" ISNULL(mtb_lisv_data.val_oneri, 0) AS val_oneri,\n" +
|
||||
" mtb_lisv_data.tipo_variazione AS tipo_variazione,\n" +
|
||||
" mtb_lisv_data.note AS note,\n" +
|
||||
" mtb_lisv_data.aggiornato_da AS aggiornato_da,\n" +
|
||||
" mtb_lisv_data.prz_vend * (1 - mtb_lisv_data.perc_sco1 / 100) * (1 - mtb_lisv_data.perc_sco2 / 100) *\n" +
|
||||
" (1 - mtb_lisv_data.perc_sco3 / 100) *\n" +
|
||||
" (1 - mtb_lisv_data.perc_sco4 / 100) AS prz_vend_netto,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN ISNULL(mtb_lisv_data.colli_pedana, 0) <> 0 THEN mtb_lisv_data.colli_pedana\n" +
|
||||
" ELSE mtb_aart.colli_pedana END AS colli_pedana,\n" +
|
||||
" mtb_lisv_data.cod_tcol_ul AS cod_tcol_ul,\n" +
|
||||
" mtb_lisv_data.cod_tcol_ui AS cod_tcol_ui,\n" +
|
||||
" ISNULL(mtb_lisv_data.prz_vend_sug, 0) AS prz_vend_sug,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN ISNULL(mtb_lisv_data.qta_cnf, 0) <> 0\n" +
|
||||
" AND dbo.getGestSetup('VTB_LIST', 'SETUP', 'QTA_CNF_LISTINO') = 'S' \n" +
|
||||
" THEN mtb_lisv_data.qta_cnf\n" +
|
||||
" ELSE mtb_aart.qta_cnf / ISNULL(mtb_lisv_data.rap_conv, 1) END AS qta_cnf,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN ISNULL(mtb_lisv_data.colli_strato, 0) <> 0 THEN mtb_lisv_data.colli_strato\n" +
|
||||
" ELSE mtb_aart.colli_strato END AS colli_strato,\n" +
|
||||
" mtb_lisv_data.descrizione_html AS descrizione_html,\n" +
|
||||
" mtb_lisv_data.colli_pedana AS colli_pedana_lisv,\n" +
|
||||
" mtb_lisv_data.qta_cnf AS qta_cnf_lisv,\n" +
|
||||
" mtb_lisv_data.colli_strato AS colli_strato_lisv,\n" +
|
||||
" mtb_lisv_data.sconto_cartoni,\n" +
|
||||
" mtb_lisv_data.sconto_strato,\n" +
|
||||
" mtb_lisv_data.sconto_pedane,\n" +
|
||||
" vtb_list.flag_attivo,\n" +
|
||||
" vtb_list_data.note AS note_testata,\n" +
|
||||
" ISNULL(mtb_lisv_data.flag_prz_bloccato, 'N') AS flag_prz_bloccato,\n" +
|
||||
" vtb_list_data.porto AS porto,\n" +
|
||||
" mtb_lisv_data.system_note,\n" +
|
||||
" mtb_lisv.add_val_spese,\n" +
|
||||
" mtb_lisv.add_ric_spese,\n" +
|
||||
" mtb_lisv.add_sco_spese,\n" +
|
||||
"\t\t\t mtb_aart.flag_incl_listino,\n" +
|
||||
"\t\t\t mtb_lisv.flag_primario,\n" +
|
||||
"\t\t\t mtb_aart.id_art_equi,\n" +
|
||||
"\t\t\t vtb_list.tipo_um\n" +
|
||||
" FROM (SELECT vtb_list.cod_vlis AS cod_vlis,\n" +
|
||||
" mtb_lisv_data.cod_mart,\n" +
|
||||
" MAX(CASE\n" +
|
||||
" WHEN vtb_list_data.versione IS NULL THEN NULL\n" +
|
||||
" ELSE CONVERT(VARCHAR(10), vtb_list_data.data_iniz, 111) + ' ' +\n" +
|
||||
" REPLICATE('0', 5 - LEN(vtb_list_data.versione)) +\n" +
|
||||
" CONVERT(VARCHAR(5), vtb_list_data.versione) END) AS max_lisv,\n" +
|
||||
" vtb_list.cod_vlis AS 'cod_vlis_rif'\n" +
|
||||
" FROM vtb_list\n" +
|
||||
" INNER JOIN mtb_lisv_data ON vtb_list.cod_vlis = mtb_lisv_data.cod_vlis\n" +
|
||||
" LEFT OUTER JOIN vtb_list_data 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.cod_promo IS NULL AND\n" +
|
||||
" vtb_list_data.data_iniz <= ISNULL(@datavalidita, GETDATE())\n" +
|
||||
" WHERE vtb_list.cod_vlis_rif IS NULL\n" +
|
||||
" GROUP BY vtb_list.cod_vlis,\n" +
|
||||
" mtb_lisv_data.cod_mart\n" +
|
||||
" UNION\n" +
|
||||
" SELECT vtb_list.cod_vlis AS cod_vlis,\n" +
|
||||
" mtb_lisv_data.cod_mart,\n" +
|
||||
" MAX(CASE\n" +
|
||||
" WHEN vtb_list_data.versione IS NULL THEN NULL\n" +
|
||||
" ELSE CONVERT(VARCHAR(10), vtb_list_data.data_iniz, 111) + ' ' +\n" +
|
||||
" REPLICATE('0', 5 - LEN(vtb_list_data.versione_rif)) +\n" +
|
||||
" CONVERT(VARCHAR(5), vtb_list_data.versione_rif) END) AS max_lisv,\n" +
|
||||
" vtb_list.cod_vlis_rif AS 'cod_vlis_rif'\n" +
|
||||
" FROM vtb_list\n" +
|
||||
" INNER JOIN vtb_list_data ON vtb_list.cod_vlis = vtb_list_data.cod_vlis\n" +
|
||||
" INNER JOIN vtb_list_data vtb_list_data_rif\n" +
|
||||
" ON vtb_list_data.versione_rif = vtb_list_data_rif.versione AND\n" +
|
||||
" vtb_list_data.cod_vlis_rif = vtb_list_data_rif.cod_vlis\n" +
|
||||
" INNER JOIN mtb_lisv_data ON vtb_list_data_rif.cod_vlis = mtb_lisv_data.cod_vlis AND\n" +
|
||||
" vtb_list_data_rif.versione = mtb_lisv_data.versione\n" +
|
||||
"\n" +
|
||||
" WHERE vtb_list_data.data_iniz <= ISNULL(@datavalidita, GETDATE())\n" +
|
||||
" AND vtb_list.cod_vlis_rif IS NOT NULL\n" +
|
||||
" GROUP BY vtb_list.cod_vlis,\n" +
|
||||
" mtb_lisv_data.cod_mart,\n" +
|
||||
" vtb_list.cod_vlis_rif) tmp_list\n" +
|
||||
" INNER JOIN vtb_list ON vtb_list.cod_vlis = tmp_list.cod_vlis\n" +
|
||||
" INNER JOIN mtb_lisv\n" +
|
||||
" ON tmp_list.cod_vlis_rif = mtb_lisv.cod_vlis AND tmp_list.cod_mart = mtb_lisv.cod_mart\n" +
|
||||
" INNER JOIN mtb_aart ON tmp_list.cod_mart = mtb_aart.cod_mart\n" +
|
||||
" LEFT OUTER JOIN mtb_lisv_data ON tmp_list.cod_vlis_rif = mtb_lisv_data.cod_vlis AND\n" +
|
||||
" tmp_list.cod_mart = mtb_lisv_data.cod_mart AND\n" +
|
||||
" CONVERT(INT, RIGHT(tmp_list.max_lisv, 5)) = mtb_lisv_data.versione\n" +
|
||||
" LEFT OUTER JOIN vtb_list_data ON tmp_list.cod_vlis = vtb_list_data.cod_vlis AND\n" +
|
||||
" CONVERT(INT, RIGHT(tmp_list.max_lisv, 5)) = vtb_list_data.versione\n" +
|
||||
"\n" +
|
||||
" WHERE (@codmart IS NULL OR tmp_list.cod_mart = @codmart)\n" +
|
||||
" AND (@codvlis IS NULL OR tmp_list.cod_vlis = @codvlis)\n");
|
||||
|
||||
createOrUpdateFunction("getListinoVenditaPedane","CREATE FUNCTION [dbo].[getListinoVenditaPedane](@datavalidita DATETIME, @codvlis VARCHAR(5), @codmart VARCHAR(15), @pedane INT)\n" +
|
||||
" RETURNS TABLE AS\n" +
|
||||
" RETURN\n" +
|
||||
" WITH trasp AS (SELECT mtb_lisv_data_spese.cod_vlis,\n" +
|
||||
" mtb_lisv_data_spese.versione,\n" +
|
||||
" mtb_lisv_data_spese.cod_spes,\n" +
|
||||
" mtb_lisv_data_spese.perc_ricarico,\n" +
|
||||
" mtb_lisv_data_spese.val_ricarico,\n" +
|
||||
" mtb_lisv_data_spese.perc_sconto,\n" +
|
||||
" mtb_lisv_data_spese.da,\n" +
|
||||
" mtb_lisv_data_spese.a\n" +
|
||||
" FROM vtb_list_data\n" +
|
||||
" --riga Sotto Aggiunta da Massimo 08/01/25 per non fare uscire i range pedane quando il prezzo non deve essere addizionato del costo dei trasporti\n" +
|
||||
" --inner join vtb_list on vtb_list_data.cod_vlis = vtb_list.cod_vlis and vtb_list.flag_add_trasp = 1\n" +
|
||||
" INNER JOIN mtb_lisv_data_spese\n" +
|
||||
" ON vtb_list_data.cod_vlis = mtb_lisv_data_spese.cod_vlis AND\n" +
|
||||
" vtb_list_data.versione = mtb_lisv_data_spese.versione\n" +
|
||||
" CROSS APPLY (SELECT MAX(id_listino) AS max_id_listino\n" +
|
||||
" FROM vtb_list_data t\n" +
|
||||
" WHERE t.data_iniz <= ISNULL(@datavalidita, CAST(GETDATE() AS DATE))\n" +
|
||||
" AND vtb_list_data.cod_vlis = t.cod_vlis) max_lisv\n" +
|
||||
" WHERE vtb_list_data.id_listino = max_lisv.max_id_listino)\n" +
|
||||
"\n" +
|
||||
" SELECT list.cod_vlis,\n" +
|
||||
" list.descrizione,\n" +
|
||||
" list.data_iniz,\n" +
|
||||
" list.versione,\n" +
|
||||
" list.cod_divi,\n" +
|
||||
" list.cambio,\n" +
|
||||
" list.flag_arr_prz_iva,\n" +
|
||||
" list.arr_ric,\n" +
|
||||
" list.flag_list_iva_inclusa,\n" +
|
||||
" list.flag_lisv_margine,\n" +
|
||||
" list.flag_add_trasp,\n" +
|
||||
" list.cod_mart,\n" +
|
||||
" list.unt_mis_ven,\n" +
|
||||
" list.rap_conv,\n" +
|
||||
" list.prz_base,\n" +
|
||||
" list.ricarico,\n" +
|
||||
" list.margine_eff,\n" +
|
||||
" list.ricarico_eff,\n" +
|
||||
" list.magg_prz_vend,\n" +
|
||||
" list.prz_vend,\n" +
|
||||
" list.prz_vend_iva,\n" +
|
||||
" list.perc_sco1,\n" +
|
||||
" list.perc_sco2,\n" +
|
||||
" list.perc_sco3,\n" +
|
||||
" list.perc_sco4,\n" +
|
||||
" list.perc_prov,\n" +
|
||||
" list.fisso_prov,\n" +
|
||||
" list.posizione,\n" +
|
||||
" list.perc_gest,\n" +
|
||||
" list.val_gest,\n" +
|
||||
" list.data_agg_prz,\n" +
|
||||
" list.perc_ispe,\n" +
|
||||
" list.val_ispe,\n" +
|
||||
" list.perc_promo,\n" +
|
||||
" list.val_promo,\n" +
|
||||
" list.perc_oneri,\n" +
|
||||
" list.val_oneri,\n" +
|
||||
" list.tipo_variazione,\n" +
|
||||
" list.note,\n" +
|
||||
" list.aggiornato_da,\n" +
|
||||
" list.prz_vend_netto,\n" +
|
||||
" list.colli_pedana,\n" +
|
||||
" list.cod_tcol_ul,\n" +
|
||||
" list.cod_tcol_ui,\n" +
|
||||
" list.prz_vend_sug,\n" +
|
||||
" list.qta_cnf,\n" +
|
||||
" list.colli_strato,\n" +
|
||||
" list.descrizione_html,\n" +
|
||||
" list.colli_pedana_lisv,\n" +
|
||||
" list.qta_cnf_lisv,\n" +
|
||||
" list.colli_strato_lisv,\n" +
|
||||
" list.sconto_cartoni,\n" +
|
||||
" list.sconto_strato,\n" +
|
||||
" list.sconto_pedane,\n" +
|
||||
" list.flag_attivo,\n" +
|
||||
" list.note_testata,\n" +
|
||||
" list.flag_prz_bloccato,\n" +
|
||||
" list.porto,\n" +
|
||||
" list.system_note,\n" +
|
||||
" list.add_val_spese,\n" +
|
||||
" list.add_ric_spese,\n" +
|
||||
" list.add_sco_spese,\n" +
|
||||
" list.flag_incl_listino,\n" +
|
||||
" list.flag_primario,\n" +
|
||||
" list.id_art_equi,\n" +
|
||||
" trasp.cod_spes,\n" +
|
||||
" trasp.perc_ricarico,\n" +
|
||||
" trasp.val_ricarico,\n" +
|
||||
" trasp.perc_sconto,\n" +
|
||||
" trasp.da,\n" +
|
||||
" trasp.a,\n" +
|
||||
" (list.prz_vend +\n" +
|
||||
" IIF(list.flag_add_trasp = 1, --Questa condizione si potrebbe togliere per la modifica fatta l'8/01/25\n" +
|
||||
" ((ISNULL(val_ricarico, 0)) * list.add_val_spese) /\n" +
|
||||
" IIF(ISNULL(list.colli_pedana, 1) = 0, 1, list.colli_pedana), 0)) +\n" +
|
||||
" ((ISNULL(perc_ricarico, 0) * list.add_ric_spese * list.prz_vend) / 100) *\n" +
|
||||
" (1 - (ISNULL(perc_sconto, 0) * list.add_sco_spese) / 100) prz_vend_trasp,\n" +
|
||||
" ((list.prz_vend +\n" +
|
||||
" IIF(list.flag_add_trasp = 1, --Questa condizione si potrebbe togliere per la modifica fatta l'8/01/25\n" +
|
||||
" ((ISNULL(val_ricarico, 0)) * list.add_val_spese) /\n" +
|
||||
" IIF(ISNULL(list.colli_pedana, 1) = 0, 1, list.colli_pedana), 0)) +\n" +
|
||||
" ((ISNULL(perc_ricarico, 0) * list.add_ric_spese * list.prz_vend) / 100) *\n" +
|
||||
" (1 - (ISNULL(perc_sconto, 0) * list.add_sco_spese) / 100)) * (1 - list.perc_sco1 / 100) *\n" +
|
||||
" (1 - list.perc_sco2 / 100) *\n" +
|
||||
" (1 - list.perc_sco3 / 100) *\n" +
|
||||
" (1 - list.perc_sco4 / 100) AS prz_vend_trasp_netto,\n" +
|
||||
"\t\t\t list.tipo_um\n" +
|
||||
" FROM getlistinovendita(@datavalidita, @codvlis, @codmart) list\n" +
|
||||
" LEFT OUTER JOIN trasp ON list.cod_vlis = trasp.cod_vlis AND\n" +
|
||||
" (@pedane IS NULL OR @pedane BETWEEN da AND a OR\n" +
|
||||
" (@pedane IS NOT NULL AND da = 0 AND a = 0))");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomer;
|
||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251111110443 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isCustomer(IntegryCustomer.Salpar)){
|
||||
executeStatement("INSERT INTO stb_tipi_indirizzi\n" +
|
||||
"VALUES ('PUNTO VENDITA', 'ABRW'),\n" +
|
||||
" ('PUNTO VENDITA', 'ABTW'),\n" +
|
||||
" ('PUNTO VENDITA', 'BAMW'),\n" +
|
||||
" ('PUNTO VENDITA', 'BATW')");
|
||||
|
||||
executeStatement("UPDATE vtb_clie_pers_rif\n" +
|
||||
"SET tipo_indirizzo = 'PUNTO VENDITA'\n" +
|
||||
"WHERE tipo_indirizzo = 'UFFICIO ACQUISTI'");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251111120322 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
createOrUpdateFunction(
|
||||
"pvm_getassortimentoCliente",
|
||||
"CREATE FUNCTION [dbo].[pvm_getassortimentoCliente](\n" +
|
||||
" @codAnag VARCHAR(5), @codVlis VARCHAR(5), @codVdes VARCHAR(5), @dataValidita DATETIME, @viewPromo BIT\n" +
|
||||
")\n" +
|
||||
" RETURNS TABLE AS\n" +
|
||||
" RETURN(SELECT cod_mart,\n" +
|
||||
" 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" +
|
||||
" note,\n" +
|
||||
" cod_tcol_ul,\n" +
|
||||
" unt_mis_ven,\n" +
|
||||
" colli_pedana,\n" +
|
||||
" tipo_variazione,\n" +
|
||||
" tipo_promo,\n" +
|
||||
" cod_paga,\n" +
|
||||
" descr_paga,\n" +
|
||||
" porto,\n" +
|
||||
" qta_cnf,\n" +
|
||||
" art_lisv,\n" +
|
||||
" 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 [dbo].pvm_getassortimentoClientePedane(\n" +
|
||||
" @codAnag, @codVlis, @codVdes, @dataValidita, @viewPromo,\n" +
|
||||
" DEFAULT))"
|
||||
);
|
||||
}
|
||||
|
||||
@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.IntegryCustomerDB;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251111151102 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (!isCustomerDb(IntegryCustomerDB.Gramm_Gramm))
|
||||
return;
|
||||
|
||||
createSetup("W_VEDI_DESADV_DLG", "SETUP", "VERSIONE_C2835", "20",
|
||||
null, false, null, false, false,
|
||||
false, false, false, null, false, null);
|
||||
createSetup("W_VEDI_DESADV_DLG", "SETUP", "DTM_C2835", "137",
|
||||
"Qualificatore data ora riferimento (Data documento), per default è impostato a 2", false, null, false, false,
|
||||
false, false, false, null, false, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
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;
|
||||
import it.integry.ems_model.entity.JtbCiclCq;
|
||||
import it.integry.ems_model.entity._enum.TipoValore;
|
||||
import it.integry.ems_model.types.OperationType;
|
||||
import it.integry.ems_model.utility.UtilityDB;
|
||||
import it.integry.ems_model.utility.UtilityInteger;
|
||||
import it.integry.ems_model.utility.UtilityList;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Migration_20251111170814 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (!isCustomerDb(IntegryCustomerDB.Gramm_Gramm))
|
||||
return;
|
||||
|
||||
|
||||
String sql = "select distinct jtb_cicl.cod_prod,MAX(jtb_cicl_cq.num_fase) as num_fase,max(jtb_cicl_cq.id_riga) as id_riga\n" +
|
||||
"from jtb_dist_clav_dir dir\n" +
|
||||
" inner join jtb_cicl on dir.cod_prod = jtb_cicl.cod_prod\n" +
|
||||
" left outer join jtb_cicl_cq on jtb_cicl.cod_prod = jtb_cicl_cq.cod_prod\n" +
|
||||
"where dir.cod_jfas like 'SC%'\n" +
|
||||
" and jtb_cicl.flag_attiva = 'S'\n" +
|
||||
"group by jtb_cicl.cod_prod";
|
||||
|
||||
List<JtbCiclCq> distinteDaAggiornare = UtilityDB.executeSimpleQueryDTO(connection, sql, JtbCiclCq.class);
|
||||
if (UtilityList.isNullOrEmpty(distinteDaAggiornare))
|
||||
return;
|
||||
|
||||
for (JtbCiclCq jtbCiclCq : distinteDaAggiornare) {
|
||||
jtbCiclCq.setIdRiga(UtilityInteger.isNull(jtbCiclCq.getIdRiga(),0) + 1)
|
||||
.setNumFase(UtilityInteger.isNull(jtbCiclCq.getNumFase(),0))
|
||||
.setControllo("Check Etichetta Cartone")
|
||||
.setTipoValore(TipoValore.BOOLEAN)
|
||||
.setValoreRif("S")
|
||||
.setNumRip(0)
|
||||
.setTipologia("DETAILED_CQ")
|
||||
.setOperation(OperationType.INSERT);
|
||||
|
||||
jtbCiclCq.manageWithParentConnection(connection);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251111171747 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
createOrUpdateFunction("lisv_getTipoUm", "CREATE FUNCTION dbo.lisv_getTipoUm\n" +
|
||||
"( \n" +
|
||||
" @codMart varchar(15), @tipoUmLisv tinyint\n" +
|
||||
")\n" +
|
||||
"RETURNS TABLE \n" +
|
||||
"AS\n" +
|
||||
"RETURN \n" +
|
||||
"(\n" +
|
||||
" with um as (\n" +
|
||||
"select cod_mart, unt_mis, rap_conv\n" +
|
||||
"from dbo.getUntMisArticolo(@codMart, null ) um\n" +
|
||||
"where @tipoUmLisv is not null\n" +
|
||||
"and ( (@tipoUmLisv = 1 and um.tipo_um = 'UI' ) or \n" +
|
||||
"(@tipoUmLisv = 2 and flag_unita_kg = 'S'))\n" +
|
||||
")\n" +
|
||||
"\n" +
|
||||
"select mtb_aart.cod_mart, \n" +
|
||||
"case \n" +
|
||||
"when @tipoUmLisv IS null then mtb_aart.unt_mis\n" +
|
||||
"when @tipoUmLisv = 1 and mtb_aart.qta_cnf not in (0, 1) then mtb_aart.unt_mis\n" +
|
||||
"when @tipoUmLisv = 2 and mtb_aart.peso_kg not in (0, 1) then mtb_aart.unt_mis\n" +
|
||||
" else ISNULL(um.unt_mis, mtb_aart.unt_mis) end as unt_mis_ven, \n" +
|
||||
"case \n" +
|
||||
"when @tipoUmLisv IS null then 1\n" +
|
||||
"when @tipoUmLisv = 1 and mtb_aart.qta_cnf not in (0, 1) then 1\n" +
|
||||
"when @tipoUmLisv = 2 and mtb_aart.peso_kg not in (0, 1) then 1\n" +
|
||||
" else ISNULL(um.rap_conv, 1) end as rap_conv_vend\n" +
|
||||
"from mtb_aart left outer join um on mtb_aart.cod_mart = um.cod_mart\n" +
|
||||
"where (@codMart is null or mtb_aart.cod_mart = @codMart )\n" +
|
||||
")");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251113102040 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
executeStatement("ALTER TABLE vtb_list_data ADD promo_chiusa bit DEFAULT 0 NOT NULL");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,208 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251113105159 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
executeStatement("exec sp_rename 'vtb_list_data.promo_chiusa', 'chiusura_immediata'");
|
||||
|
||||
|
||||
createOrUpdateFunction("getPromozioneVendita", "CREATE FUNCTION [dbo].[getPromozioneVendita](@dataIniz DATETIME, @dataFine DATETIME, @codVlis VARCHAR(5),\n" +
|
||||
" @codPromo VARCHAR(10), @codMart VARCHAR(15))\n" +
|
||||
" RETURNS TABLE AS\n" +
|
||||
" RETURN\n" +
|
||||
" SELECT vtb_list.cod_vlis,\n" +
|
||||
" vtb_list.descrizione,\n" +
|
||||
" vtb_list_data.data_iniz,\n" +
|
||||
" vtb_list_data.data_fine,\n" +
|
||||
" vtb_list_data.cod_promo,\n" +
|
||||
" vtb_list_data.versione,\n" +
|
||||
" vtb_list.cod_divi,\n" +
|
||||
" vtb_list.flag_arr_prz_iva,\n" +
|
||||
" vtb_list.arr_ric,\n" +
|
||||
" vtb_list.flag_list_iva_inclusa,\n" +
|
||||
" vtb_list.flag_lisv_margine,\n" +
|
||||
" mtb_lisv_data.cod_mart AS cod_mart,\n" +
|
||||
" mtb_lisv_data.unt_mis_ven AS unt_mis_ven,\n" +
|
||||
" mtb_lisv_data.rap_conv AS rap_conv,\n" +
|
||||
" mtb_lisv_data.prz_base AS prz_base,\n" +
|
||||
" mtb_lisv_data.ricarica AS ricarico,\n" +
|
||||
" --dbo.f_calcMargineEffettivo(mtb_lisv_data.prz_base, mtb_lisv_data.prz_vend, mtb_aart.perc_sfrido) as margine_eff,\n" +
|
||||
" --dbo.f_calcRicaricoEffettivo(mtb_lisv_data.prz_base, mtb_lisv_data.prz_vend, mtb_aart.perc_sfrido) as ricarico_eff, \n" +
|
||||
" CASE\n" +
|
||||
" WHEN mtb_lisv_data.prz_vend IS NOT NULL AND mtb_lisv_data.prz_vend <> 0 THEN\n" +
|
||||
" ROUND((ISNULL(mtb_lisv_data.prz_vend, 0) -\n" +
|
||||
" (ISNULL(mtb_lisv_data.prz_base, 0) / (1 - mtb_aart.perc_sfrido / 100))) /\n" +
|
||||
" ISNULL(mtb_lisv_data.prz_vend, 0) * 100, 2)\n" +
|
||||
" ELSE 0 END AS margine_eff,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN mtb_lisv_data.prz_base IS NOT NULL AND mtb_lisv_data.prz_base <> 0 THEN\n" +
|
||||
" ROUND((ISNULL(mtb_lisv_data.prz_vend, 0) -\n" +
|
||||
" (ISNULL(mtb_lisv_data.prz_base, 0) / (1 - mtb_aart.perc_sfrido / 100))) /\n" +
|
||||
" (ISNULL(mtb_lisv_data.prz_base, 0) / (1 - mtb_aart.perc_sfrido / 100)) * 100, 2)\n" +
|
||||
" ELSE 0 END AS ricarico_eff,\n" +
|
||||
" mtb_lisv_data.prz_vend AS prz_vend,\n" +
|
||||
" mtb_lisv_data.prz_vend_iva AS prz_vend_iva,\n" +
|
||||
" mtb_lisv_data.perc_sco1 AS perc_sco1,\n" +
|
||||
" mtb_lisv_data.perc_sco2 AS perc_sco2,\n" +
|
||||
" mtb_lisv_data.perc_sco3 AS perc_sco3,\n" +
|
||||
" mtb_lisv_data.perc_sco4 AS perc_sco4,\n" +
|
||||
" mtb_lisv_data.perc_prov AS perc_prov,\n" +
|
||||
" mtb_lisv_data.fisso_prov AS fisso_prov,\n" +
|
||||
" mtb_lisv_data.posizione AS posizione,\n" +
|
||||
" mtb_lisv_data.perc_gest AS perc_gest,\n" +
|
||||
" mtb_lisv_data.val_gest AS val_gest,\n" +
|
||||
" mtb_lisv_data.data_agg_prz AS data_agg_prz,\n" +
|
||||
" mtb_lisv_data.perc_ispe AS perc_ispe,\n" +
|
||||
" mtb_lisv_data.val_ispe AS val_ispe,\n" +
|
||||
" mtb_lisv_data.perc_promo AS perc_promo,\n" +
|
||||
" mtb_lisv_data.val_promo AS val_promo,\n" +
|
||||
" mtb_lisv_data.perc_oneri AS perc_oneri,\n" +
|
||||
" mtb_lisv_data.val_oneri AS val_oneri,\n" +
|
||||
" mtb_lisv_data.tipo_variazione AS tipo_variazione,\n" +
|
||||
" mtb_lisv_data.note AS note,\n" +
|
||||
" mtb_lisv_data.aggiornato_da AS aggiornato_da,\n" +
|
||||
" mtb_lisv_data.prz_vend * (1 - mtb_lisv_data.perc_sco1 / 100) * (1 - mtb_lisv_data.perc_sco2 / 100) *\n" +
|
||||
" (1 - mtb_lisv_data.perc_sco3 / 100) * (1 - mtb_lisv_data.perc_sco4 / 100) AS prz_vend_netto,\n" +
|
||||
" vtb_promo.descrizione AS 'descr_promo',\n" +
|
||||
" vtb_promo.data_iniz_sell_out,\n" +
|
||||
" vtb_promo.data_fine_sell_out,\n" +
|
||||
" vtb_promo.flag_tipo_promo,\n" +
|
||||
" mtb_lisv_data.sconto_cartoni,\n" +
|
||||
" mtb_lisv_data.sconto_strato,\n" +
|
||||
" mtb_lisv_data.sconto_pedane,\n" +
|
||||
" mtb_lisv_data.giacenza,\n" +
|
||||
" mtb_lisv_data.magg_prz_vend,\n" +
|
||||
" vtb_promo.flag_sconto_contrattuale,\n" +
|
||||
" vtb_promo.intercode_xml_variazioni,\n" +
|
||||
" vtb_list_data.note AS note_testata,\n" +
|
||||
" vtb_promo.flag_tipologia,\n" +
|
||||
" vtb_promo.flag_volantino,\n" +
|
||||
" mtb_lisv_data.inserito_da,\n" +
|
||||
" vtb_list_data.chiusura_immediata\n" +
|
||||
" FROM vtb_list\n" +
|
||||
" INNER JOIN vtb_list_data ON vtb_list.cod_vlis = vtb_list_data.cod_vlis\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" +
|
||||
" INNER JOIN mtb_aart ON mtb_lisv_data.cod_mart = mtb_aart.cod_mart\n" +
|
||||
" INNER JOIN vtb_promo ON vtb_list_data.cod_promo = vtb_promo.cod_promo\n" +
|
||||
" OUTER APPLY (SELECT COUNT(*) AS conta\n" +
|
||||
" FROM vtb_list_data rif\n" +
|
||||
" WHERE vtb_list_data.cod_vlis = rif.cod_vlis_rif\n" +
|
||||
" AND vtb_list_data.versione = rif.versione) list_rif\n" +
|
||||
" WHERE (@codMart IS NULL OR mtb_lisv_data.cod_mart = @codMart)\n" +
|
||||
" AND (@codvlis IS NULL OR vtb_list_data.cod_vlis = @codVlis)\n" +
|
||||
" AND vtb_list.cod_vlis_rif IS NULL\n" +
|
||||
" AND (@codPromo IS NULL OR vtb_list_data.cod_promo = @codPromo)\n" +
|
||||
" AND (((@dataFine IS NULL OR ISNULL(@dataIniz, CAST(GETDATE() AS DATE)) = @dataFine) AND\n" +
|
||||
" ISNULL(@dataIniz, CAST(GETDATE() AS DATE)) BETWEEN vtb_list_data.data_iniz AND vtb_list_data.data_fine) OR\n" +
|
||||
" (@dataFine IS NOT NULL AND ISNULL(@dataIniz, CAST(GETDATE() AS DATE)) <> @dataFine AND\n" +
|
||||
" (vtb_list_data.data_iniz BETWEEN ISNULL(@dataIniz, CAST(GETDATE() AS DATE)) AND @dataFine OR\n" +
|
||||
" vtb_list_data.data_fine BETWEEN ISNULL(@dataIniz, CAST(GETDATE() AS DATE)) AND @dataFine OR\n" +
|
||||
" ISNULL(@dataIniz, CAST(GETDATE() AS DATE)) BETWEEN vtb_list_data.data_iniz AND vtb_list_data.data_fine OR\n" +
|
||||
" @dataFine BETWEEN vtb_list_data.data_iniz AND vtb_list_data.data_fine)))\n" +
|
||||
" AND (vtb_promo.flag_sconto_contrattuale = 'N' OR\n" +
|
||||
" (vtb_promo.flag_sconto_contrattuale = 'S' AND list_rif.conta = 0))\n" +
|
||||
" UNION\n" +
|
||||
" SELECT vtb_list.cod_vlis,\n" +
|
||||
" vtb_list.descrizione,\n" +
|
||||
" vtb_list_data.data_iniz,\n" +
|
||||
" vtb_list_data.data_fine,\n" +
|
||||
" vtb_list_data.cod_promo,\n" +
|
||||
" vtb_list_data.versione,\n" +
|
||||
" vtb_list.cod_divi,\n" +
|
||||
" vtb_list.flag_arr_prz_iva,\n" +
|
||||
" vtb_list.arr_ric,\n" +
|
||||
" vtb_list.flag_list_iva_inclusa,\n" +
|
||||
" vtb_list.flag_lisv_margine,\n" +
|
||||
" mtb_lisv_data.cod_mart AS cod_mart,\n" +
|
||||
" mtb_lisv_data.unt_mis_ven AS unt_mis_ven,\n" +
|
||||
" mtb_lisv_data.rap_conv AS rap_conv,\n" +
|
||||
" mtb_lisv_data.prz_base AS prz_base,\n" +
|
||||
" mtb_lisv_data.ricarica AS ricarico,\n" +
|
||||
" --dbo.f_calcMargineEffettivo(mtb_lisv_data.prz_base, mtb_lisv_data.prz_vend, mtb_aart.perc_sfrido) as margine_eff,\n" +
|
||||
" --dbo.f_calcRicaricoEffettivo(mtb_lisv_data.prz_base, mtb_lisv_data.prz_vend, mtb_aart.perc_sfrido) as ricarico_eff, \n" +
|
||||
" CASE\n" +
|
||||
" WHEN mtb_lisv_data.prz_vend IS NOT NULL AND mtb_lisv_data.prz_vend <> 0 THEN\n" +
|
||||
" ROUND((ISNULL(mtb_lisv_data.prz_vend, 0) -\n" +
|
||||
" (ISNULL(mtb_lisv_data.prz_base, 0) / (1 - mtb_aart.perc_sfrido / 100))) /\n" +
|
||||
" ISNULL(mtb_lisv_data.prz_vend, 0) * 100, 2)\n" +
|
||||
" ELSE 0 END AS margine_eff,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN mtb_lisv_data.prz_base IS NOT NULL AND mtb_lisv_data.prz_base <> 0 THEN\n" +
|
||||
" ROUND((ISNULL(mtb_lisv_data.prz_vend, 0) -\n" +
|
||||
" (ISNULL(mtb_lisv_data.prz_base, 0) / (1 - mtb_aart.perc_sfrido / 100))) /\n" +
|
||||
" (ISNULL(mtb_lisv_data.prz_base, 0) / (1 - mtb_aart.perc_sfrido / 100)) * 100, 2)\n" +
|
||||
" ELSE 0 END AS ricarico_eff,\n" +
|
||||
" mtb_lisv_data.prz_vend AS prz_vend,\n" +
|
||||
" mtb_lisv_data.prz_vend_iva AS prz_vend_iva,\n" +
|
||||
" mtb_lisv_data.perc_sco1 AS perc_sco1,\n" +
|
||||
" mtb_lisv_data.perc_sco2 AS perc_sco2,\n" +
|
||||
" mtb_lisv_data.perc_sco3 AS perc_sco3,\n" +
|
||||
" mtb_lisv_data.perc_sco4 AS perc_sco4,\n" +
|
||||
" mtb_lisv_data.perc_prov AS perc_prov,\n" +
|
||||
" mtb_lisv_data.fisso_prov AS fisso_prov,\n" +
|
||||
" mtb_lisv_data.posizione AS posizione,\n" +
|
||||
" mtb_lisv_data.perc_gest AS perc_gest,\n" +
|
||||
" mtb_lisv_data.val_gest AS val_gest,\n" +
|
||||
" mtb_lisv_data.data_agg_prz AS data_agg_prz,\n" +
|
||||
" mtb_lisv_data.perc_ispe AS perc_ispe,\n" +
|
||||
" mtb_lisv_data.val_ispe AS val_ispe,\n" +
|
||||
" mtb_lisv_data.perc_promo AS perc_promo,\n" +
|
||||
" mtb_lisv_data.val_promo AS val_promo,\n" +
|
||||
" mtb_lisv_data.perc_oneri AS perc_oneri,\n" +
|
||||
" mtb_lisv_data.val_oneri AS val_oneri,\n" +
|
||||
" mtb_lisv_data.tipo_variazione AS tipo_variazione,\n" +
|
||||
" mtb_lisv_data.note AS note,\n" +
|
||||
" mtb_lisv_data.aggiornato_da AS aggiornato_da,\n" +
|
||||
" mtb_lisv_data.prz_vend * (1 - mtb_lisv_data.perc_sco1 / 100) * (1 - mtb_lisv_data.perc_sco2 / 100) *\n" +
|
||||
" (1 - mtb_lisv_data.perc_sco3 / 100) * (1 - mtb_lisv_data.perc_sco4 / 100) AS prz_vend_netto,\n" +
|
||||
" vtb_promo.descrizione AS 'descr_promo',\n" +
|
||||
" vtb_promo.data_iniz_sell_out,\n" +
|
||||
" vtb_promo.data_fine_sell_out,\n" +
|
||||
" vtb_promo.flag_tipo_promo,\n" +
|
||||
" mtb_lisv_data.sconto_cartoni,\n" +
|
||||
" mtb_lisv_data.sconto_strato,\n" +
|
||||
" mtb_lisv_data.sconto_pedane,\n" +
|
||||
" mtb_lisv_data.giacenza,\n" +
|
||||
" mtb_lisv_data.magg_prz_vend,\n" +
|
||||
" vtb_promo.flag_sconto_contrattuale,\n" +
|
||||
" vtb_promo.intercode_xml_variazioni,\n" +
|
||||
" vtb_list_data.note AS note_testata,\n" +
|
||||
" vtb_promo.flag_tipologia,\n" +
|
||||
" vtb_promo.flag_volantino,\n" +
|
||||
" mtb_lisv_data.inserito_da,\n" +
|
||||
" vtb_list_data_rif.chiusura_immediata\n" +
|
||||
" FROM vtb_list\n" +
|
||||
" INNER JOIN vtb_list_data ON vtb_list.cod_vlis = vtb_list_data.cod_vlis\n" +
|
||||
" INNER JOIN vtb_list_data vtb_list_data_rif\n" +
|
||||
" ON vtb_list_data.cod_vlis_rif = vtb_list_data_rif.cod_vlis AND\n" +
|
||||
" vtb_list_data.versione_rif = vtb_list_data_rif.versione\n" +
|
||||
" INNER JOIN mtb_lisv_data ON vtb_list_data_rif.cod_vlis = mtb_lisv_data.cod_vlis AND\n" +
|
||||
" vtb_list_data_rif.versione = mtb_lisv_data.versione\n" +
|
||||
" INNER JOIN mtb_aart ON mtb_lisv_data.cod_mart = mtb_aart.cod_mart\n" +
|
||||
" INNER JOIN vtb_promo ON vtb_list_data_rif.cod_promo = vtb_promo.cod_promo\n" +
|
||||
" WHERE (@codMart IS NULL OR mtb_lisv_data.cod_mart = @codMart)\n" +
|
||||
" AND (@codvlis IS NULL OR vtb_list_data.cod_vlis = @codVlis)\n" +
|
||||
" AND (@codPromo IS NULL OR vtb_list_data.cod_promo = @codPromo)\n" +
|
||||
" AND (((@dataFine IS NULL OR ISNULL(@dataIniz, CAST(GETDATE() AS DATE)) = @dataFine) AND\n" +
|
||||
" ISNULL(@dataIniz, CAST(GETDATE() AS DATE)) BETWEEN vtb_list_data.data_iniz AND vtb_list_data.data_fine) OR\n" +
|
||||
" (@dataFine IS NOT NULL AND ISNULL(@dataIniz, CAST(GETDATE() AS DATE)) <> @dataFine AND\n" +
|
||||
" (vtb_list_data.data_iniz BETWEEN ISNULL(@dataIniz, CAST(GETDATE() AS DATE)) AND @dataFine OR\n" +
|
||||
" vtb_list_data.data_fine BETWEEN ISNULL(@dataIniz, CAST(GETDATE() AS DATE)) AND @dataFine OR\n" +
|
||||
" ISNULL(@dataIniz, CAST(GETDATE() AS DATE)) BETWEEN vtb_list_data.data_iniz AND vtb_list_data.data_fine OR\n" +
|
||||
" @dataFine BETWEEN vtb_list_data.data_iniz AND vtb_list_data.data_fine)))");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251113122313 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
createOrUpdateFunction("lisv_getTipoUm", "CREATE FUNCTION [dbo].[lisv_getTipoUm]\n" +
|
||||
"(\t\n" +
|
||||
"\t@codMart varchar(15), @tipoUmLisv tinyint\n" +
|
||||
")\n" +
|
||||
"RETURNS TABLE \n" +
|
||||
"AS\n" +
|
||||
"RETURN \n" +
|
||||
"(\n" +
|
||||
"\twith um as (\n" +
|
||||
"select cod_mart, unt_mis, rap_conv\n" +
|
||||
"from dbo.getUntMisArticolo(@codMart, null ) um\n" +
|
||||
"where @tipoUmLisv is not null\n" +
|
||||
"and ( (@tipoUmLisv = 1 and um.tipo_um = 'UI' ) or \n" +
|
||||
"(@tipoUmLisv = 2 and flag_unita_kg = 'S'))\n" +
|
||||
")\n" +
|
||||
"\n" +
|
||||
"select mtb_aart.cod_mart, \n" +
|
||||
"case \n" +
|
||||
"when @tipoUmLisv IS null then mtb_aart.unt_mis\n" +
|
||||
"when @tipoUmLisv = 1 and mtb_aart.qta_cnf in (0, 1) then mtb_aart.unt_mis\n" +
|
||||
"when @tipoUmLisv = 2 and mtb_aart.peso_kg in (0, 1) then mtb_aart.unt_mis\n" +
|
||||
"\telse ISNULL(um.unt_mis, mtb_aart.unt_mis) end as unt_mis_ven, \n" +
|
||||
"case \n" +
|
||||
"when @tipoUmLisv IS null then 1\n" +
|
||||
"when @tipoUmLisv = 1 and mtb_aart.qta_cnf in (0, 1) then 1\n" +
|
||||
"when @tipoUmLisv = 2 and mtb_aart.peso_kg in (0, 1) then 1\n" +
|
||||
"\telse ISNULL(um.rap_conv, 1) end as rap_conv_vend\n" +
|
||||
"from mtb_aart left outer join um on mtb_aart.cod_mart = um.cod_mart\n" +
|
||||
"where (@codMart is null or mtb_aart.cod_mart = @codMart )\n" +
|
||||
")");
|
||||
|
||||
executeStatement("alter table mtb_var_lisv_log alter column versione int null");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251113170159 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
executeStatement("ALTER TABLE wdtb_doct ADD merce_ricevuta BIT DEFAULT 0 NOT NULL");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251114114334 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
|
||||
executeStatement("ALTER TABLE ctb_amac DROP COLUMN cod_mdep;");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -30,7 +30,7 @@ public class AccountingBusinessLogic {
|
||||
.setCodAnag(ctbMovt.getCodAnag())
|
||||
.setCodVage(ctbMovt.getCodVage())
|
||||
.setAnnoPart(annoPart)
|
||||
.setDataDoc(ctbMovt.getDataDoc())
|
||||
.setDataDoc(UtilityLocalDate.localDateFromDate(ctbMovt.getDataDoc()))
|
||||
.setSerDoc(ctbMovt.getSerDoc())
|
||||
.setNumDoc(ctbMovt.getNumDoc())
|
||||
.setCodDiviCont(ctbMovt.getCodDiviCont())
|
||||
@@ -120,7 +120,7 @@ public class AccountingBusinessLogic {
|
||||
"Convert(numeric(20,5), importo_enasarco * cambio_divi_cont) as importo_enasarco " +
|
||||
" FROM ctb_rit_acc " +
|
||||
" WHERE num_cmov_fat = " + UtilityDB.valueToString(testata.getNumCmov()) + " AND " +
|
||||
" data_doc = " + UtilityDB.valueDateToString(testata.getDataDoc(), CommonConstants.DATE_FORMAT_YMD_SLASHED) + " AND " +
|
||||
" data_doc = " + UtilityDB.valueToString(testata.getDataDoc()) + " AND " +
|
||||
" ser_doc = " + UtilityDB.valueToString(testata.getSerDoc()) + " AND " +
|
||||
" num_doc = " + UtilityDB.valueToString(testata.getNumDoc());
|
||||
|
||||
@@ -142,7 +142,7 @@ public class AccountingBusinessLogic {
|
||||
.setAnnoPart(annoPart)
|
||||
.setSerDoc(testata.getSerDoc())
|
||||
.setNumDoc(testata.getNumDoc())
|
||||
.setDataScad(testata.getDataDoc());
|
||||
.setDataScad(UtilityLocalDate.localDateFromDate(testata.getDataDoc()));
|
||||
if (testata.getTipoPartitaEnum() == TipoPartita.ATTIVA) {
|
||||
ctbScad.setImpDare(ritenuta);
|
||||
ctbScad.setImpAvere(BigDecimal.ZERO);
|
||||
@@ -166,7 +166,7 @@ public class AccountingBusinessLogic {
|
||||
.setAnnoPart(annoPart)
|
||||
.setSerDoc(testata.getSerDoc())
|
||||
.setNumDoc(testata.getNumDoc())
|
||||
.setDataScad(testata.getDataDoc());
|
||||
.setDataScad(UtilityLocalDate.localDateFromDate(testata.getDataDoc()));
|
||||
if (testata.getTipoPartitaEnum() == TipoPartita.ATTIVA) {
|
||||
ctbScad.setImpDare(enasarco);
|
||||
ctbScad.setImpAvere(BigDecimal.ZERO);
|
||||
@@ -413,10 +413,17 @@ public class AccountingBusinessLogic {
|
||||
}
|
||||
|
||||
public static BigDecimal pagaScadenze(Date dataCmov, BigDecimal residuo, List<CtbScad> elencoScadenze) {
|
||||
return pagaScadenze(dataCmov, residuo, elencoScadenze, null);
|
||||
return pagaScadenze(UtilityLocalDate.localDateFromDate(dataCmov), residuo, elencoScadenze, null);
|
||||
}
|
||||
|
||||
public static BigDecimal pagaScadenze(Date dataCmov, BigDecimal residuo, List<CtbScad> elencoScadenze, Integer idRigaMov) {
|
||||
return pagaScadenze(UtilityLocalDate.localDateFromDate(dataCmov), residuo, elencoScadenze, idRigaMov);
|
||||
}
|
||||
|
||||
public static BigDecimal pagaScadenze(LocalDate dataCmov, BigDecimal residuo, List<CtbScad> elencoScadenze) {
|
||||
return pagaScadenze(dataCmov, residuo, elencoScadenze, null);
|
||||
}
|
||||
public static BigDecimal pagaScadenze(LocalDate dataCmov, BigDecimal residuo, List<CtbScad> elencoScadenze, Integer idRigaMov) {
|
||||
long countScad =
|
||||
Stream.of(elencoScadenze)
|
||||
.distinctBy(x ->
|
||||
|
||||
@@ -18,6 +18,7 @@ import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Date;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
public class AccountingRules extends QueryRules {
|
||||
@@ -181,7 +182,7 @@ public class AccountingRules extends QueryRules {
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(codBiva)) {
|
||||
for (CtbMovi ctbMovi : ctbMovt.getCtbMovi()) {
|
||||
if (UtilityString.isNullOrEmpty(ctbMovi.getCodBiva())) {
|
||||
if (UtilityString.isNullOrEmpty(ctbMovi.getCodBiva()) && !ctbMovi.getCodBiva().equalsIgnoreCase(EmsRestConstants.NULL)) {
|
||||
ctbMovi.setCodBiva(codBiva);
|
||||
}
|
||||
movi.add(ctbMovi);
|
||||
@@ -389,7 +390,7 @@ public class AccountingRules extends QueryRules {
|
||||
.setCodAnag(ctbMovt.getCodAnag())
|
||||
.setCodVage(ctbMovt.getCodVage())
|
||||
.setAnnoPart(annoPart)
|
||||
.setDataDoc(ctbMovt.getDataDoc())
|
||||
.setDataDoc(UtilityLocalDate.localDateFromDate(ctbMovt.getDataDoc()))
|
||||
.setSerDoc(ctbMovt.getSerDoc())
|
||||
.setNumDoc(ctbMovt.getNumDoc())
|
||||
.setCodDiviCont(ctbMovt.getCodDiviCont())
|
||||
@@ -657,7 +658,7 @@ public class AccountingRules extends QueryRules {
|
||||
.setAnnoPart(ctbScad.getAnnoPart())
|
||||
.setSerDoc(ctbScad.getSerDoc())
|
||||
.setNumDoc(ctbScad.getNumDoc())
|
||||
.setDataCmov(ctbMovr.getDataCmov())
|
||||
.setDataCmov(UtilityLocalDate.localDateFromDate(ctbMovr.getDataCmov()))
|
||||
.setIdRiga(ctbMovr.getIdRiga())
|
||||
.setImpDare(impDare)
|
||||
.setImpAvere(impAvere)
|
||||
@@ -735,7 +736,7 @@ public class AccountingRules extends QueryRules {
|
||||
.setAnnoPart(ctbMovr.getAnnoPart())
|
||||
.setSerDoc(ctbMovr.getSerDoc())
|
||||
.setNumDoc(ctbMovr.getNumDoc())
|
||||
.setDataCmov(ctbMovr.getDataCmov())
|
||||
.setDataCmov(UtilityLocalDate.localDateFromDate(ctbMovr.getDataCmov()))
|
||||
.setIdRiga(ctbMovr.getIdRiga())
|
||||
.setImpDare(ctbMovr.getImpDare())
|
||||
.setImpAvere(ctbMovr.getImpAvere())
|
||||
@@ -962,18 +963,16 @@ public class AccountingRules extends QueryRules {
|
||||
public static CtbMovt completeScadRitAcc(Connection conn, CtbRitAcc ctbRitAcc) throws Exception {
|
||||
String sql =
|
||||
"SELECT count(*) as count_partita " +
|
||||
" FROM ctb_part inner join ctb_parr on ctb_part.tipo_anag = ctb_parr.tipo_anag and " +
|
||||
"ctb_part.cod_anag = ctb_parr.cod_anag and " +
|
||||
"ctb_part.anno_part = ctb_parr.anno_part and " +
|
||||
"ctb_part.ser_doc = ctb_parr.ser_doc and " +
|
||||
"ctb_part.num_doc = ctb_parr.num_doc " +
|
||||
" WHERE ctb_parr.num_cmov = " + UtilityDB.valueToString(ctbRitAcc.getNumCmovFat()) + " AND " +
|
||||
" ( ctb_part.dare_part = 0 or ctb_part.avere_part = 0 ) ";
|
||||
" FROM ctb_part inner join ctb_parr on ctb_part.tipo_anag = ctb_parr.tipo_anag and " +
|
||||
"ctb_part.cod_anag = ctb_parr.cod_anag and " +
|
||||
"ctb_part.anno_part = ctb_parr.anno_part and " +
|
||||
"ctb_part.ser_doc = ctb_parr.ser_doc and " +
|
||||
"ctb_part.num_doc = ctb_parr.num_doc " +
|
||||
" WHERE ctb_parr.num_cmov = " + UtilityDB.valueToString(ctbRitAcc.getNumCmovFat());
|
||||
|
||||
Integer countPart = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(conn, sql);
|
||||
|
||||
if (countPart > 0) {
|
||||
|
||||
if (countPart <= 1) {
|
||||
CtbMovt ctbMovt = new CtbMovt();
|
||||
ctbMovt.setNumCmov(ctbRitAcc.getNumCmovFat());
|
||||
ctbMovt.setGeneraScad(ctbRitAcc.getGeneraScadenze());
|
||||
@@ -989,7 +988,7 @@ public class AccountingRules extends QueryRules {
|
||||
for (CtbScad ctbScad : ctbMovt.getCtbScad()) {
|
||||
ctbScad.setTipoAnag(UtilityString.isNullOrEmpty(ctbScad.getTipoAnag()) ? ctbMovt.getTipoAnag() : ctbScad.getTipoAnag());
|
||||
ctbScad.setCodAnag(UtilityString.isNullOrEmpty(ctbScad.getCodAnag()) ? ctbMovt.getCodAnag() : ctbScad.getCodAnag());
|
||||
ctbScad.setDataDoc(UtilityString.isNullOrEmpty(ctbScad.getDataDoc()) ? ctbMovt.getDataDoc() : ctbScad.getDataDoc());
|
||||
ctbScad.setDataDoc(UtilityLocalDate.isNull(ctbScad.getDataDoc(), UtilityLocalDate.localDateFromDate(ctbMovt.getDataDoc())));
|
||||
ctbScad.setSerDoc(UtilityString.isNullOrEmpty(ctbScad.getSerDoc()) ? ctbMovt.getSerDoc() : ctbScad.getSerDoc());
|
||||
ctbScad.setNumDoc(UtilityString.isNullOrEmpty(ctbScad.getNumDoc()) ? ctbMovt.getNumDoc() : ctbScad.getNumDoc());
|
||||
Integer annoPart = Integer.parseInt(new SimpleDateFormat("yyyy").format(ctbMovt.getDataDoc()));
|
||||
@@ -1126,5 +1125,16 @@ public class AccountingRules extends QueryRules {
|
||||
}
|
||||
return ventilazione;
|
||||
}
|
||||
|
||||
public static void checkRigaMovCtbParr( CtbMovt ctbMovt) {
|
||||
List<CtbMovr> row = ctbMovt.getCtbMovr().stream()
|
||||
.filter(x -> x.getCtbScad() != null && x.getCtbScad().size() > 0)
|
||||
.collect(Collectors.toList());
|
||||
for(CtbMovr r : row) {
|
||||
r.getCtbScad()
|
||||
.forEach(scad -> {scad.getCrlScadParr()
|
||||
.stream()
|
||||
.filter(x->x.getIdRigaMov() != r.getIdRiga())
|
||||
.forEach(x->x.setIdRigaMov(r.getIdRiga()));});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -412,12 +412,12 @@ public class CommonRules extends QueryRules {
|
||||
}
|
||||
}
|
||||
|
||||
public static void completeRigaCtbMovr(EntityBase testata) {
|
||||
public static void completeRigaCtbMovr(CtbMovt testata) {
|
||||
//questo campo definisce anche l'ordinemanto delle righe quindi viene sempre riassegnato.
|
||||
Integer startRiga = 0;
|
||||
|
||||
List<CtbMovr> rows =
|
||||
Stream.of(((CtbMovt) testata).getCtbMovr())
|
||||
Stream.of(testata.getCtbMovr())
|
||||
.filter(x -> x.getOperation() != OperationType.DELETE)
|
||||
.toList();
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ 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.entity._enum.ListinoEnum;
|
||||
import it.integry.ems_model.entity.common.DtbBaseDocR;
|
||||
import it.integry.ems_model.entity.common.DtbDocOrdR;
|
||||
import it.integry.ems_model.entity.common.DtbDocOrdT;
|
||||
@@ -675,7 +676,11 @@ public class DocOrdCalTotaliRules extends QueryRules {
|
||||
if ("A".equals(gestione)) {
|
||||
costo = DocumentRules.completeCostoUntDocA(conn, ((DtbDocr) row));
|
||||
} else if ("L".equals(gestione)) {
|
||||
costo = DocumentRules.completeCostoUntDocL(conn, ((DtbDocr) row), flagValCosto);
|
||||
if (testata.getListino().equalsIgnoreCase(ListinoEnum.COSTO_ULTIMO.getValue()) && !UtilityBigDecimal.isNullOrZero(row.getValUnt())) {
|
||||
costo = row.getValUnt();
|
||||
} else {
|
||||
costo = DocumentRules.completeCostoUntDocL(conn, ((DtbDocr) row), flagValCosto);
|
||||
}
|
||||
}
|
||||
((DtbDocr) row).setCostoUnt(costo);
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import java.sql.ResultSetMetaData;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -72,8 +73,8 @@ public class SalesRules extends QueryRules {
|
||||
|
||||
if (dataFine != null) {
|
||||
|
||||
if (dataFine.equals(UtilityLocalDate.localDateFromDate(vtbListData.getDataFine())) &&
|
||||
vtbListData.getDataIniz().before((UtilityDate.getTodayWithoutTime())) &&
|
||||
if (dataFine.equals(vtbListData.getDataFine()) &&
|
||||
vtbListData.getDataIniz().isBefore(LocalDate.now()) &&
|
||||
!vtbListData.getMtbLisvData().isEmpty()) {
|
||||
throw new Exception("Impossibile modificare gli articoli di una promozione con data inizio antecedente a oggi");
|
||||
|
||||
@@ -84,7 +85,7 @@ public class SalesRules extends QueryRules {
|
||||
|
||||
}
|
||||
|
||||
if (vtbListData.getDataIniz().before((UtilityDate.getTodayWithoutTime())))
|
||||
if (vtbListData.getDataIniz().isBefore(LocalDate.now()))
|
||||
throw new Exception(String.format("Impossibile inserire una %s data inizio antecedente a oggi",
|
||||
(vtbListData.getDataFine() != null ? "promozione" : "variazione")));
|
||||
|
||||
@@ -94,13 +95,13 @@ public class SalesRules extends QueryRules {
|
||||
|
||||
|
||||
public static boolean checkDataFine(Connection conn, VtbListData vtbListData) throws Exception {
|
||||
LocalDate dataIniz = UtilityLocalDate.localDateFromDate(vtbListData.getDataIniz());
|
||||
LocalDate dataFine = UtilityLocalDate.localDateFromDate(vtbListData.getDataFine());
|
||||
LocalDate dataIniz = vtbListData.getDataIniz();
|
||||
LocalDate dataFine = vtbListData.getDataFine();
|
||||
|
||||
if (dataFine.isBefore(dataIniz))
|
||||
throw new Exception(String.format("Impossibile inserire//modificare una promozione con data fine (%s) antecedente a data inizio ( %s )",
|
||||
new SimpleDateFormat(CommonConstants.DATE_FORMAT_DMY_SLASHED).format(vtbListData.getDataFine()),
|
||||
new SimpleDateFormat(CommonConstants.DATE_FORMAT_DMY_SLASHED).format(vtbListData.getDataIniz())));
|
||||
UtilityLocalDate.formatDate(vtbListData.getDataFine(), CommonConstants.DATE_FORMAT_DMY),
|
||||
UtilityLocalDate.formatDate(vtbListData.getDataIniz(), CommonConstants.DATE_FORMAT_DMY)));
|
||||
|
||||
String promoEscluse = setupGest.getSetup(conn, "VTB_LIST", "CHECK_DATA_FINE", "PROMO_ESCLUSE");
|
||||
if (!UtilityString.isNullOrEmpty(promoEscluse)) {
|
||||
@@ -112,7 +113,7 @@ public class SalesRules extends QueryRules {
|
||||
if (vtbListData.getCheckDataFine() != null && vtbListData.getCheckDataFine()) {
|
||||
if (UtilityLocalDate.isBeforeToday(dataFine))
|
||||
throw new Exception(String.format("Impossibile inserire//modificare una promozione con data fine (%s) antecedente ad oggi",
|
||||
new SimpleDateFormat(CommonConstants.DATE_FORMAT_DMY_SLASHED).format(vtbListData.getDataFine())));
|
||||
UtilityLocalDate.formatDate(vtbListData.getDataFine(), CommonConstants.DATE_FORMAT_DMY)));
|
||||
}
|
||||
|
||||
if (vtbListData.getCheckDataFine() != null && vtbListData.getCheckDataFine()) {
|
||||
@@ -254,8 +255,8 @@ public class SalesRules extends QueryRules {
|
||||
public static String completeCodPromo(Connection connection, VtbListData vtbListData) throws Exception {
|
||||
String partialCode =
|
||||
vtbListData.getCodVlis() + ";" +
|
||||
new SimpleDateFormat(CommonConstants.DATE_FORMAT_YMD_DASHED).format(vtbListData.getDataIniz()) + ";" +
|
||||
new SimpleDateFormat(CommonConstants.DATE_FORMAT_YMD_DASHED).format(vtbListData.getDataFine());
|
||||
UtilityLocalDate.formatDate(vtbListData.getDataIniz(), CommonConstants.DATE_FORMAT_YMD) + ";" +
|
||||
UtilityLocalDate.formatDate(vtbListData.getDataFine(), CommonConstants.DATE_FORMAT_YMD);
|
||||
|
||||
String sql = "SELECT dbo.f_suggestCodeCodPromoVend( " + UtilityDB.valueToString(partialCode) + " ) ";
|
||||
String codPromo = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(connection, sql);
|
||||
@@ -277,7 +278,7 @@ public class SalesRules extends QueryRules {
|
||||
"vtb_list_data.versione = mtb_lisv_data.versione " +
|
||||
"where mtb_lisv_data.cod_mart = " + UtilityDB.valueToString(mtbLisvData.getCodMart()) + " and " +
|
||||
"vtb_list_data.cod_vlis = " + UtilityDB.valueToString(mtbLisvData.getCodVlis()) + " and " +
|
||||
"vtb_list_data.data_iniz <= " + UtilityDB.valueDateToString(mtbLisvData.getDataIniz(), CommonConstants.DATE_FORMAT_YMD_DASHED) +
|
||||
"vtb_list_data.data_iniz <= " + UtilityDB.valueToString(mtbLisvData.getDataIniz()) +
|
||||
(mtbLisvData.getVersione() != null ? " AND vtb_list_data.versione <> " + UtilityDB.valueToString(mtbLisvData.getVersione()) : "") +
|
||||
" ORDER BY vtb_list_data.data_iniz desc";
|
||||
|
||||
@@ -346,9 +347,9 @@ public class SalesRules extends QueryRules {
|
||||
|
||||
public static void setDataUltVar(Connection connection, VtbListData testata) throws Exception {
|
||||
if (testata.getOperation() == OperationType.INSERT || testata.getOperation() == OperationType.UPDATE || testata.getOperation() == OperationType.INSERT_OR_UPDATE) {
|
||||
testata.setDataUltVar(new Date());
|
||||
testata.setDataUltVar(LocalDateTime.now());
|
||||
} else if ( testata.getMtbLisvData() != null && testata.getMtbLisvData().stream().anyMatch(x-> x.getOperation() == OperationType.INSERT || x.getOperation() == OperationType.UPDATE || x.getOperation() == OperationType.INSERT_OR_UPDATE )){
|
||||
testata.setDataUltVar(new Date());
|
||||
testata.setDataUltVar(LocalDateTime.now());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -371,7 +372,7 @@ public class SalesRules extends QueryRules {
|
||||
" FROM vtb_list_data " +
|
||||
" WHERE cod_vlis = " + UtilityDB.valueToString(vtbListData.getCodVlis()) + " AND " +
|
||||
"versione = " + UtilityDB.valueToString(vtbListData.getVersione()) + " AND " +
|
||||
"data_iniz = " + UtilityDB.valueDateToString(vtbListData.getDataIniz(), CommonConstants.DATE_FORMAT_YMD_DASHED);
|
||||
"data_iniz = " + UtilityDB.valueToString(vtbListData.getDataIniz());
|
||||
|
||||
boolean existLisv = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(conn, query);
|
||||
|
||||
@@ -388,7 +389,7 @@ public class SalesRules extends QueryRules {
|
||||
+ " WHERE cod_vlis = "
|
||||
+ UtilityDB.valueToString(vtbListData.getCodVlis())
|
||||
+ " AND data_iniz = "
|
||||
+ UtilityDB.valueDateToString(vtbListData.getDataIniz(), CommonConstants.DATE_FORMAT_YMD_DASHED)
|
||||
+ UtilityDB.valueToString(vtbListData.getDataIniz())
|
||||
+ " AND cod_promo IS NULL"
|
||||
+ " AND isNull(note, '') = IsNull(" + UtilityDB.valueToString(vtbListData.getNote()) + ", '') ";
|
||||
versioneNew = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(conn, query);
|
||||
@@ -399,9 +400,9 @@ public class SalesRules extends QueryRules {
|
||||
+ " WHERE cod_vlis = "
|
||||
+ UtilityDB.valueToString(vtbListData.getCodVlis())
|
||||
+ " AND data_iniz = "
|
||||
+ UtilityDB.valueDateToString(vtbListData.getDataIniz(), CommonConstants.DATE_FORMAT_YMD_DASHED)
|
||||
+ UtilityDB.valueToString(vtbListData.getDataIniz())
|
||||
+ " AND data_fine = "
|
||||
+ UtilityDB.valueDateToString(vtbListData.getDataFine(), CommonConstants.DATE_FORMAT_YMD_DASHED) + " AND "
|
||||
+ UtilityDB.valueToString(vtbListData.getDataFine()) + " AND "
|
||||
+ " cod_promo = " + UtilityDB.valueToString(vtbListData.getCodPromo()) + " AND "
|
||||
+ " ( note = " + UtilityDB.valueToString(vtbListData.getNote()) + " OR "
|
||||
+ UtilityDB.valueToString(vtbListData.getNote()) + " is null ) ";
|
||||
@@ -413,17 +414,6 @@ public class SalesRules extends QueryRules {
|
||||
if (versioneNew == null || versioneNew == 0) {
|
||||
if (vtbListData.getOperation() == OperationType.INSERT_OR_UPDATE)
|
||||
vtbListData.setOperation(OperationType.INSERT);
|
||||
// query = " SELECT max(versione) versione"
|
||||
// + " FROM vtb_list_data "
|
||||
// + " WHERE cod_vlis = "
|
||||
// + UtilityDB.valueToString(vtbListData.getCodVlis());
|
||||
// versioneNew = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(conn, query);
|
||||
//
|
||||
// if (versioneNew == null) {
|
||||
// versioneNew = 1;
|
||||
// } else {
|
||||
// versioneNew = versioneNew + 1;
|
||||
// }
|
||||
} else {
|
||||
vtbListData.setOperation(OperationType.UPDATE);
|
||||
}
|
||||
@@ -432,12 +422,11 @@ public class SalesRules extends QueryRules {
|
||||
return versioneNew;
|
||||
}
|
||||
|
||||
public static BigDecimal completeRicaricaRow(Connection connection, String codVlis, String codMart, Date dataIniz) throws Exception {
|
||||
public static BigDecimal completeRicaricaRow(Connection connection, String codVlis, String codMart, LocalDate dataIniz) throws Exception {
|
||||
|
||||
String sql = "SELECT distinct ricarico FROM dbo.ftx_getListinoVendita(" + UtilityDB.valueDateToString(dataIniz, CommonConstants.DATE_FORMAT_YMD_DASHED) + ","
|
||||
String sql = "SELECT distinct ricarico FROM dbo.ftx_getListinoVendita(" + UtilityDB.valueToString(dataIniz) + ","
|
||||
+ UtilityDB.valueToString(codVlis) + "," + UtilityDB.valueToString(codMart) + ", 'N')";
|
||||
|
||||
|
||||
BigDecimal ricarico = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(connection, sql);
|
||||
|
||||
return ricarico;
|
||||
@@ -447,7 +436,7 @@ public class SalesRules extends QueryRules {
|
||||
if (entity.getListData() == null) {
|
||||
String codVlis = entity.getCodVlis();
|
||||
String codMart = entity.getCodMart();
|
||||
Date dataIniz = entity.getDataIniz();
|
||||
LocalDate dataIniz = entity.getDataIniz();
|
||||
|
||||
String sql =
|
||||
"SELECT Cast(count(*) as bit) as existLisv " +
|
||||
@@ -489,7 +478,7 @@ public class SalesRules extends QueryRules {
|
||||
+ "sconto_strato, "
|
||||
+ "sconto_pedane, "
|
||||
+ "flag_prz_bloccato "
|
||||
+ " FROM dbo.getListinoVendita(" + UtilityDB.valueDateToString(dataIniz, CommonConstants.DATE_FORMAT_YMD_DASHED) + ","
|
||||
+ " FROM dbo.getListinoVendita(" + UtilityDB.valueToString(dataIniz) + ","
|
||||
+ UtilityDB.valueToString(codVlis) + ","
|
||||
+ UtilityDB.valueToString(codMart) + ") ";
|
||||
|
||||
@@ -947,15 +936,16 @@ public class SalesRules extends QueryRules {
|
||||
public static Boolean checkChangeRicarico(Connection conn, MtbLisvData entity) throws Exception {
|
||||
Boolean ret = false;
|
||||
String query =
|
||||
"SELECT user_name " +
|
||||
"SELECT Cast(count(*) as bit) " +
|
||||
" FROM stb_user " +
|
||||
" WHERE stb_user.user_name = " + UtilityDB.valueToString(entity.getUsername()) + " AND " +
|
||||
"stb_user.flag_dba = 'N' AND " +
|
||||
"stb_user.user_name not in (select user_name from stb_gest_setup_user WHERE section = 'W_VLIST_RC' AND key_section = 'DISABLE_CHK_RICARICO' and value = 'S') ";
|
||||
|
||||
PreparedStatement ps = conn.prepareStatement(query);
|
||||
ResultSet rs = ps.executeQuery();
|
||||
if (rs.next()) {
|
||||
Boolean checkRicarico = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(conn, query);
|
||||
if (checkRicarico == null) checkRicarico = false;
|
||||
|
||||
if (checkRicarico) {
|
||||
query =
|
||||
"SELECT ricarico_min, " +
|
||||
"ricarico_max, " +
|
||||
@@ -966,15 +956,12 @@ public class SalesRules extends QueryRules {
|
||||
" vtb_range_ricarico.cod_msgr = mtb_aart.cod_msgr " +
|
||||
" WHERE mtb_aart.cod_mart = " + UtilityDB.valueToString(entity.getCodMart()) + "AND " +
|
||||
"( vtb_range_ricarico.ricarico_min <> 0 OR vtb_range_ricarico.ricarico_max <> 0 )";
|
||||
ps = conn.prepareStatement(query);
|
||||
rs = ps.executeQuery();
|
||||
if (rs.next()) {
|
||||
BigDecimal ricaricoMin = rs.getBigDecimal(1);
|
||||
BigDecimal ricaricoMax = rs.getBigDecimal(2);
|
||||
String descrizioneArt = rs.getString(3);
|
||||
String flagTipoRicarico = rs.getString(4);
|
||||
rs.close();
|
||||
ps.close();
|
||||
HashMap<String, Object> dati = UtilityDB.executeSimpleQueryOnlyFirstRow(conn, query);
|
||||
if (UtilityHashMap.isPresent(dati)) {
|
||||
BigDecimal ricaricoMin = UtilityHashMap.getValueIfExists(dati, "ricarico_min");
|
||||
BigDecimal ricaricoMax = UtilityHashMap.getValueIfExists(dati, "ricarico_max");
|
||||
String descrizioneArt = UtilityHashMap.getValueIfExists(dati, "descrizione");
|
||||
String flagTipoRicarico = UtilityHashMap.getValueIfExists(dati, "flag_tipo_ricarico");
|
||||
|
||||
BigDecimal ricaricoCalc = BigDecimal.ZERO;
|
||||
if ("P".equals(flagTipoRicarico)) {
|
||||
@@ -984,14 +971,8 @@ public class SalesRules extends QueryRules {
|
||||
" mtb_aart.perc_sfrido)" +
|
||||
" FROM mtb_aart " +
|
||||
" WHERE mtb_aart.cod_mart = " + UtilityDB.valueToString(entity.getCodMart());
|
||||
ps = conn.prepareStatement(query);
|
||||
rs = ps.executeQuery();
|
||||
|
||||
if (rs.next()) {
|
||||
ricaricoCalc = rs.getBigDecimal(1);
|
||||
}
|
||||
rs.close();
|
||||
ps.close();
|
||||
ricaricoCalc = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(conn, query);
|
||||
} else {
|
||||
ricaricoCalc = entity.getPrzVend().subtract(entity.getPrzBase());
|
||||
}
|
||||
@@ -1003,8 +984,6 @@ public class SalesRules extends QueryRules {
|
||||
}
|
||||
|
||||
}
|
||||
rs.close();
|
||||
ps.close();
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1017,7 +996,7 @@ public class SalesRules extends QueryRules {
|
||||
String flagPrzBloccato = "N";
|
||||
if (chkPrzBloccato) {
|
||||
query = "SELECT flag_prz_bloccato " +
|
||||
"FROM dbo.GetListinoVendita(" + UtilityDB.valueDateToString(entity.getDataIniz(), CommonConstants.DATE_FORMAT_YMD_DASHED) + ", " +
|
||||
"FROM dbo.GetListinoVendita(" + UtilityDB.valueToString(entity.getDataIniz()) + ", " +
|
||||
UtilityDB.valueToString(entity.getCodVlis()) + ", " +
|
||||
UtilityDB.valueToString(entity.getCodMart()) + ") lisv ";
|
||||
flagPrzBloccato = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(conn, query);
|
||||
@@ -1357,7 +1336,7 @@ public class SalesRules extends QueryRules {
|
||||
public static Long completeIdMtbLisvDataSpese(Connection connection, MtbLisvDataSpese mtbLisvDataSpese) throws SQLException {
|
||||
VtbListData vtbListData = (VtbListData) mtbLisvDataSpese.getParent();
|
||||
|
||||
Date dataIniz = vtbListData.getDataIniz();
|
||||
LocalDate dataIniz = vtbListData.getDataIniz();
|
||||
|
||||
String sql = Query.format(
|
||||
"SELECT id\n" +
|
||||
@@ -1371,4 +1350,19 @@ public class SalesRules extends QueryRules {
|
||||
|
||||
return UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(connection, sql);
|
||||
}
|
||||
|
||||
public static boolean checkMtbLisvDelete(Connection conn, MtbLisv mtbLisv) throws Exception {
|
||||
String sql = Query.format(
|
||||
"SELECT Cast(count(*) As BIT)\n" +
|
||||
"FROM mtb_lisv_data " +
|
||||
"WHERE cod_vlis = %s AND cod_mart = %s",
|
||||
mtbLisv.getCodVlis(),
|
||||
mtbLisv.getCodMart()
|
||||
);
|
||||
|
||||
Boolean exist = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(conn, sql);
|
||||
if (exist == null) exist = false;
|
||||
|
||||
return exist;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.context.ContextLoader;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@@ -186,8 +187,7 @@ public class AsyncManager {
|
||||
.orElse(null);
|
||||
|
||||
try (MultiDBTransactionManager multiDBTransactionManager = new MultiDBTransactionManager(connectionModel);
|
||||
SQLServerPreparedStatement insertBulkPs = (SQLServerPreparedStatement) multiDBTransactionManager.prepareStatement(insertSQL)) {
|
||||
|
||||
PreparedStatement insertBulkPs = multiDBTransactionManager.prepareStatement(insertSQL)) {
|
||||
insertBulkPs.setLong(1, stbTransactionLog.getPublicationGroupId());
|
||||
insertBulkPs.setObject(2, stbTransactionLog.getCreatedAt());
|
||||
insertBulkPs.setString(3, stbTransactionLog.getUserName());
|
||||
|
||||
@@ -21,7 +21,7 @@ public class BasicConnectionPool {
|
||||
@Autowired
|
||||
private SettingsModel settingsModel;
|
||||
|
||||
private final ConcurrentHashMap<String, DataSource> registeredDatasources = new ConcurrentHashMap<>();
|
||||
private final ConcurrentHashMap<AvailableConnectionModel, DataSource> registeredDatasources = new ConcurrentHashMap<>();
|
||||
|
||||
private volatile boolean initialized = false;
|
||||
private final Object initLock = new Object(); // Lock più leggero solo per inizializzazione
|
||||
@@ -63,7 +63,7 @@ public class BasicConnectionPool {
|
||||
|
||||
private void initializeConnections() {
|
||||
final List<AvailableConnectionModel> availableConnections =
|
||||
settingsModel.getAvailableConnectionsWithoutDuplicatedProfiles(false);
|
||||
settingsModel.getAvailableConnections(false);
|
||||
|
||||
for (AvailableConnectionModel model : availableConnections) {
|
||||
try {
|
||||
@@ -89,14 +89,15 @@ public class BasicConnectionPool {
|
||||
try {
|
||||
registerDataSourceIfNotExists(connectionsModel);
|
||||
|
||||
String dbName = connectionsModel.getDbName();
|
||||
DataSource ds = registeredDatasources.get(dbName);
|
||||
DataSource ds = registeredDatasources.get(connectionsModel);
|
||||
|
||||
if (ds == null) {
|
||||
throw new IllegalArgumentException("No datasource registered for profile: " + connectionsModel.getProfileName());
|
||||
}
|
||||
|
||||
String dbName = connectionsModel.getDbName();
|
||||
Connection connection = ds.getConnection();
|
||||
|
||||
if (!connection.getCatalog().equalsIgnoreCase(dbName)) {
|
||||
throw new IllegalArgumentException("Connection for profile " + connectionsModel.getProfileName() + " is not for database " + dbName);
|
||||
}
|
||||
@@ -110,9 +111,8 @@ public class BasicConnectionPool {
|
||||
|
||||
|
||||
private void registerDataSourceIfNotExists(AvailableConnectionModel connectionModel) throws Exception {
|
||||
String dbName = connectionModel.getDbName();
|
||||
if (!registeredDatasources.containsKey(dbName)) {
|
||||
registeredDatasources.put(dbName, createNewDataSource(connectionModel));
|
||||
if (!registeredDatasources.containsKey(connectionModel)) {
|
||||
registeredDatasources.put(connectionModel, createNewDataSource(connectionModel));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@JsonInclude(JsonInclude.Include.ALWAYS)
|
||||
public class UserDTO {
|
||||
public class UserDTO implements Cloneable{
|
||||
|
||||
@SqlField("user_name")
|
||||
private String username;
|
||||
@@ -288,4 +288,14 @@ public class UserDTO {
|
||||
this.availableProfiles = availableProfiles;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserDTO clone() {
|
||||
try {
|
||||
UserDTO clone = (UserDTO) super.clone();
|
||||
return clone;
|
||||
} catch (CloneNotSupportedException e) {
|
||||
throw new AssertionError();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1457,48 +1457,51 @@ public class GeneraOrdLav {
|
||||
activityID = (String) datiOrdL.get("activity_id");
|
||||
}
|
||||
|
||||
Integer ggDiff = Math.toIntExact(UtilityLocalDate.daysAfterDate(dataInizProdOld, dataInizNew));
|
||||
if (ggDiff != 0) {
|
||||
sql = "SELECT * FROM dtb_ordr";
|
||||
sql = UtilityDB.addwhereCond(sql, ordT.getPkWhereCond(), true);
|
||||
List<DtbOrdr> dtbOrdrL = UtilityDB.executeSimpleQueryDTO(conn, sql, DtbOrdr.class);
|
||||
|
||||
if (dtbOrdrL != null && !dtbOrdrL.isEmpty()) {
|
||||
dtbOrdrL.stream().forEach(x -> {
|
||||
if (dataInizProdOld != null && dataInizNew != null && dataInizProdOld != EmsRestConstants.LOCAL_DATE_NULL && dataInizNew != EmsRestConstants.LOCAL_DATE_NULL){
|
||||
Integer ggDiff = Math.toIntExact(UtilityLocalDate.daysAfterDate(dataInizProdOld, dataInizNew));
|
||||
if (ggDiff != 0) {
|
||||
sql = "SELECT * FROM dtb_ordr";
|
||||
sql = UtilityDB.addwhereCond(sql, ordT.getPkWhereCond(), true);
|
||||
List<DtbOrdr> dtbOrdrL = UtilityDB.executeSimpleQueryDTO(conn, sql, DtbOrdr.class);
|
||||
|
||||
if (dtbOrdrL != null && !dtbOrdrL.isEmpty()) {
|
||||
dtbOrdrL.stream().forEach(x -> {
|
||||
x.setDataCons(x.getDataCons().plusDays(ggDiff));
|
||||
x.setOperation(OperationType.UPDATE);
|
||||
});
|
||||
|
||||
ordT.setDtbOrdr(dtbOrdrL);
|
||||
}
|
||||
|
||||
sql = "SELECT * FROM dtb_ord_steps";
|
||||
sql = UtilityDB.addwhereCond(sql, ordT.getPkWhereCond(), true);
|
||||
List<DtbOrdSteps> dtbOrdSteps = UtilityDB.executeSimpleQueryDTO(conn, sql, DtbOrdSteps.class);
|
||||
|
||||
dtbOrdSteps.stream().forEach(x -> {
|
||||
x.setDataIniz(x.getDataIniz() != null ? x.getDataIniz().plusDays(ggDiff) : null);
|
||||
x.setDataFine(x.getDataFine() != null ? x.getDataFine().plusDays(ggDiff) : null);
|
||||
x.setOperation(OperationType.UPDATE);
|
||||
});
|
||||
|
||||
ordT.setDtbOrdr(dtbOrdrL);
|
||||
}
|
||||
ordT.setDtbOrdSteps(dtbOrdSteps);
|
||||
|
||||
sql = "SELECT * FROM dtb_ord_steps";
|
||||
sql = UtilityDB.addwhereCond(sql, ordT.getPkWhereCond(), true);
|
||||
List<DtbOrdSteps> dtbOrdSteps = UtilityDB.executeSimpleQueryDTO(conn, sql, DtbOrdSteps.class);
|
||||
// FABIO: DA CAPIRE COME VALORIZZATA LE ATTIVITA MODIFICATE
|
||||
if (assegnaAttivita) {
|
||||
sql = "SELECT stb_activity.* " +
|
||||
" FROM stb_activity " +
|
||||
" where (activity_id = " + UtilityDB.valueToString(activityID) + " or " +
|
||||
" parent_activity_id = " + UtilityDB.valueToString(activityID) + ")";
|
||||
List<StbActivity> stbActivity = UtilityDB.executeSimpleQueryDTO(conn, sql, StbActivity.class);
|
||||
|
||||
dtbOrdSteps.stream().forEach(x -> {
|
||||
x.setDataIniz(x.getDataIniz() != null ? x.getDataIniz().plusDays(ggDiff) : null);
|
||||
x.setDataFine(x.getDataFine() != null ? x.getDataFine().plusDays(ggDiff) : null);
|
||||
x.setOperation(OperationType.UPDATE);
|
||||
});
|
||||
stbActivity.stream().forEach(x -> {
|
||||
x.setEstimatedTime(x.getEstimatedTime().plusDays(ggDiff));
|
||||
x.setEstimatedEndtime(x.getEstimatedEndtime().plusDays(ggDiff));
|
||||
x.setOperation(OperationType.INSERT_OR_UPDATE);
|
||||
});
|
||||
|
||||
ordT.setDtbOrdSteps(dtbOrdSteps);
|
||||
|
||||
// FABIO: DA CAPIRE COME VALORIZZATA LE ATTIVITA MODIFICATE
|
||||
if (assegnaAttivita) {
|
||||
sql = "SELECT stb_activity.* " +
|
||||
" FROM stb_activity " +
|
||||
" where (activity_id = " + UtilityDB.valueToString(activityID) + " or " +
|
||||
" parent_activity_id = " + UtilityDB.valueToString(activityID) + ")";
|
||||
List<StbActivity> stbActivity = UtilityDB.executeSimpleQueryDTO(conn, sql, StbActivity.class);
|
||||
|
||||
stbActivity.stream().forEach(x -> {
|
||||
x.setEstimatedTime(x.getEstimatedTime().plusDays(ggDiff));
|
||||
x.setEstimatedEndtime(x.getEstimatedEndtime().plusDays(ggDiff));
|
||||
x.setOperation(OperationType.INSERT_OR_UPDATE);
|
||||
});
|
||||
|
||||
row.setStbActivityList(stbActivity);
|
||||
row.setStbActivityList(stbActivity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,9 +65,6 @@ public class CtbAmac extends EntityBase {
|
||||
@SqlField(value = "flag_attivo", nullable = false, defaultObjectValue = "1")
|
||||
private Boolean flagAttivo;
|
||||
|
||||
@SqlField(value = "cod_mdep")
|
||||
private String codMdep;
|
||||
|
||||
@SqlField(value = "posizione")
|
||||
@FK(tableName = MtbDepoPosizioni.ENTITY)
|
||||
private String posizione;
|
||||
@@ -241,15 +238,6 @@ public class CtbAmac extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodMdep() {
|
||||
return codMdep;
|
||||
}
|
||||
|
||||
public CtbAmac setCodMdep(String codMdep) {
|
||||
this.codMdep = codMdep;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPosizione() {
|
||||
return posizione;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import org.apache.logging.log4j.Logger;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
@PropertyReactive
|
||||
@@ -61,7 +61,7 @@ public class CtbParr extends EntityBase {
|
||||
|
||||
@ImportFromParent
|
||||
@SqlField(value = "data_cmov", nullable = false)
|
||||
private Date dataCmov;
|
||||
private LocalDate dataCmov;
|
||||
|
||||
@SqlField(value = "imp_dare", nullable = false, defaultObjectValue = "0")
|
||||
private BigDecimal impDare;
|
||||
@@ -86,7 +86,7 @@ public class CtbParr extends EntityBase {
|
||||
private BigDecimal cambioDiviCont;
|
||||
|
||||
@ImportFromParent
|
||||
private Date dataDoc;
|
||||
private LocalDate dataDoc;
|
||||
|
||||
@ImportFromParent
|
||||
private String chiudiScad;
|
||||
@@ -174,11 +174,11 @@ public class CtbParr extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataCmov() {
|
||||
public LocalDate getDataCmov() {
|
||||
return dataCmov;
|
||||
}
|
||||
|
||||
public CtbParr setDataCmov(Date dataCmov) {
|
||||
public CtbParr setDataCmov(LocalDate dataCmov) {
|
||||
this.dataCmov = dataCmov;
|
||||
return this;
|
||||
}
|
||||
@@ -237,11 +237,11 @@ public class CtbParr extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataDoc() {
|
||||
public LocalDate getDataDoc() {
|
||||
return dataDoc;
|
||||
}
|
||||
|
||||
public CtbParr setDataDoc(Date dataDoc) {
|
||||
public CtbParr setDataDoc(LocalDate dataDoc) {
|
||||
this.dataDoc = dataDoc;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import it.integry.ems_model.annotation.*;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
@@ -46,7 +46,7 @@ public class CtbPart extends EntityBase {
|
||||
|
||||
@ImportFromParent (value = "data_doc")
|
||||
@SqlField(value = "data_doc")
|
||||
private Date dataDoc;
|
||||
private LocalDate dataDoc;
|
||||
|
||||
@SqlField(value = "tot_imponib", nullable = false, defaultObjectValue = "0")
|
||||
private BigDecimal totImponib;
|
||||
@@ -185,11 +185,11 @@ public class CtbPart extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataDoc() {
|
||||
public LocalDate getDataDoc() {
|
||||
return dataDoc;
|
||||
}
|
||||
|
||||
public CtbPart setDataDoc(Date dataDoc) {
|
||||
public CtbPart setDataDoc(LocalDate dataDoc) {
|
||||
this.dataDoc = dataDoc;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -10,8 +10,8 @@ import org.apache.logging.log4j.Logger;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@PropertyReactive
|
||||
@@ -58,11 +58,11 @@ public class CtbScad extends EntityBase {
|
||||
private String codPaga;
|
||||
|
||||
@ImportFromParent( value = "data_doc")
|
||||
@SqlField(value = "data_doc", nullable = false, format = CommonConstants.SYSDATE)
|
||||
private Date dataDoc;
|
||||
@SqlField(value = "data_doc", nullable = false)
|
||||
private LocalDate dataDoc;
|
||||
|
||||
@SqlField(value = "data_scad", nullable = false, format = CommonConstants.SYSDATE)
|
||||
private Date dataScad;
|
||||
@SqlField(value = "data_scad", nullable = false)
|
||||
private LocalDate dataScad;
|
||||
|
||||
@SqlField(value = "imp_dare", nullable = false, defaultObjectValue = "0")
|
||||
private BigDecimal impDare;
|
||||
@@ -70,14 +70,14 @@ public class CtbScad extends EntityBase {
|
||||
@SqlField(value = "imp_avere", nullable = false, defaultObjectValue = "0")
|
||||
private BigDecimal impAvere;
|
||||
|
||||
@SqlField(value = "data_pag", format = CommonConstants.SYSDATE)
|
||||
private Date dataPag;
|
||||
@SqlField(value = "data_pag")
|
||||
private LocalDate dataPag;
|
||||
|
||||
@SqlField(value = "descriz_pag", maxLength = 40)
|
||||
private String descrizPag;
|
||||
|
||||
@SqlField(value = "data_ult_soll")
|
||||
private Date dataUltSoll;
|
||||
private LocalDate dataUltSoll;
|
||||
|
||||
@SqlField(value = "ult_soll")
|
||||
private Integer ultSoll;
|
||||
@@ -85,17 +85,17 @@ public class CtbScad extends EntityBase {
|
||||
@SqlField(value = "note", maxLength = 40)
|
||||
private String note;
|
||||
|
||||
@SqlField(value = "data_ant_provv", format = CommonConstants.SYSDATE)
|
||||
private Date dataAntProvv;
|
||||
@SqlField(value = "data_ant_provv")
|
||||
private LocalDate dataAntProvv;
|
||||
|
||||
@SqlField(value = "data_titolo", format = CommonConstants.SYSDATE)
|
||||
private Date dataTitolo;
|
||||
@SqlField(value = "data_titolo")
|
||||
private LocalDate dataTitolo;
|
||||
|
||||
@SqlField(value = "gestione", maxLength = 1)
|
||||
private String gestione;
|
||||
|
||||
@SqlField(value = "data_ord", format = CommonConstants.SYSDATE)
|
||||
private Date dataOrd;
|
||||
private LocalDate dataOrd;
|
||||
|
||||
@SqlField(value = "num_ord")
|
||||
private Integer numOrd;
|
||||
@@ -203,24 +203,44 @@ public class CtbScad extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataDoc() {
|
||||
public LocalDate getDataDoc() {
|
||||
return dataDoc;
|
||||
}
|
||||
|
||||
public CtbScad setDataDoc(Date dataDoc) {
|
||||
public CtbScad setDataDoc(LocalDate dataDoc) {
|
||||
this.dataDoc = dataDoc;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataScad() {
|
||||
public LocalDate getDataScad() {
|
||||
return dataScad;
|
||||
}
|
||||
|
||||
public CtbScad setDataScad(Date dataScad) {
|
||||
public CtbScad setDataScad(LocalDate dataScad) {
|
||||
this.dataScad = dataScad;
|
||||
return this;
|
||||
}
|
||||
|
||||
public CtbScad setDataUltSoll(LocalDate dataUltSoll) {
|
||||
this.dataUltSoll = dataUltSoll;
|
||||
return this;
|
||||
}
|
||||
|
||||
public CtbScad setDataAntProvv(LocalDate dataAntProvv) {
|
||||
this.dataAntProvv = dataAntProvv;
|
||||
return this;
|
||||
}
|
||||
|
||||
public CtbScad setDataTitolo(LocalDate dataTitolo) {
|
||||
this.dataTitolo = dataTitolo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public CtbScad setDataOrd(LocalDate dataOrd) {
|
||||
this.dataOrd = dataOrd;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getImpDare() {
|
||||
return impDare;
|
||||
}
|
||||
@@ -239,11 +259,11 @@ public class CtbScad extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataPag() {
|
||||
public LocalDate getDataPag() {
|
||||
return dataPag;
|
||||
}
|
||||
|
||||
public CtbScad setDataPag(Date dataPag) {
|
||||
public CtbScad setDataPag(LocalDate dataPag) {
|
||||
this.dataPag = dataPag;
|
||||
return this;
|
||||
}
|
||||
@@ -257,15 +277,6 @@ public class CtbScad extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataUltSoll() {
|
||||
return dataUltSoll;
|
||||
}
|
||||
|
||||
public CtbScad setDataUltSoll(Date dataUltSoll) {
|
||||
this.dataUltSoll = dataUltSoll;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getUltSoll() {
|
||||
return ultSoll;
|
||||
}
|
||||
@@ -284,21 +295,28 @@ public class CtbScad extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataAntProvv() {
|
||||
public LocalDate getDataUltSoll() {
|
||||
return dataUltSoll;
|
||||
}
|
||||
|
||||
public LocalDate getDataAntProvv() {
|
||||
return dataAntProvv;
|
||||
}
|
||||
|
||||
public CtbScad setDataAntProvv(Date dataAntProvv) {
|
||||
this.dataAntProvv = dataAntProvv;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataTitolo() {
|
||||
public LocalDate getDataTitolo() {
|
||||
return dataTitolo;
|
||||
}
|
||||
|
||||
public CtbScad setDataTitolo(Date dataTitolo) {
|
||||
this.dataTitolo = dataTitolo;
|
||||
public LocalDate getDataOrd() {
|
||||
return dataOrd;
|
||||
}
|
||||
|
||||
public Boolean getInsoluto() {
|
||||
return isInsoluto;
|
||||
}
|
||||
|
||||
public CtbScad setInsoluto(Boolean insoluto) {
|
||||
isInsoluto = insoluto;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -311,15 +329,6 @@ public class CtbScad extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataOrd() {
|
||||
return dataOrd;
|
||||
}
|
||||
|
||||
public CtbScad setDataOrd(Date dataOrd) {
|
||||
this.dataOrd = dataOrd;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getNumOrd() {
|
||||
return numOrd;
|
||||
}
|
||||
|
||||
@@ -63,6 +63,13 @@ public class MtbGrup extends EntityBase implements EquatableEntityInterface<MtbG
|
||||
@EntityChild
|
||||
private List<MtbSfam> mtbSfam = new ArrayList<>();
|
||||
|
||||
@EntityChild
|
||||
private List<MtbSsfam> mtbSsfam;
|
||||
|
||||
{
|
||||
mtbSsfam = new ArrayList<>();
|
||||
}
|
||||
|
||||
public MtbGrup() {
|
||||
super(logger);
|
||||
}
|
||||
@@ -169,6 +176,8 @@ public class MtbGrup extends EntityBase implements EquatableEntityInterface<MtbG
|
||||
|
||||
@Override
|
||||
protected void deleteChilds() throws Exception {
|
||||
MtbSsfam mtbSsfam = new MtbSsfam();
|
||||
mtbSsfam.deleteAllEntities(connection, this);
|
||||
MtbSfam mtbSfam = new MtbSfam();
|
||||
mtbSfam.deleteAllEntities(connection, this);
|
||||
MtbSgrp mtbSgrp = new MtbSgrp();
|
||||
|
||||
@@ -2,13 +2,13 @@ package it.integry.ems_model.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems_model.annotation.*;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import it.integry.ems_model.types.ApplicationName;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
@@ -102,8 +102,8 @@ public class MtbLisvData extends EntityBase {
|
||||
@SqlField(value = "val_oneri", nullable = false, defaultObjectValue = "0")
|
||||
private BigDecimal valOneri;
|
||||
|
||||
@SqlField(value = "data_agg_prz", defaultObjectValue = CommonConstants.TIMESTAMP)
|
||||
private Date dataAggPrz;
|
||||
@SqlField(value = "data_agg_prz")
|
||||
private LocalDateTime dataAggPrz;
|
||||
|
||||
@SqlField(value = "tipo_variazione", maxLength = 1, nullable = false)
|
||||
private String tipoVariazione;
|
||||
@@ -183,11 +183,11 @@ public class MtbLisvData extends EntityBase {
|
||||
|
||||
@ImportFromParent
|
||||
@MapToTable("data_iniz")
|
||||
private Date dataIniz;
|
||||
private LocalDate dataIniz;
|
||||
|
||||
@ImportFromParent
|
||||
@MapToTable("data_fine")
|
||||
private Date dataFine;
|
||||
private LocalDate dataFine;
|
||||
|
||||
@ImportFromParent
|
||||
@MapToTable("cod_promo")
|
||||
@@ -210,6 +210,8 @@ public class MtbLisvData extends EntityBase {
|
||||
@JsonProperty("elenco_lisv_rif")
|
||||
private String elencoLisvRif;
|
||||
|
||||
private Boolean chiusuraImmediata;
|
||||
|
||||
@EntityChild
|
||||
private List<TtbLisvTaglieData> ttbLisvTaglieData = new ArrayList<>();
|
||||
|
||||
@@ -438,11 +440,11 @@ public class MtbLisvData extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataAggPrz() {
|
||||
public LocalDateTime getDataAggPrz() {
|
||||
return dataAggPrz;
|
||||
}
|
||||
|
||||
public MtbLisvData setDataAggPrz(Date dataAggPrz) {
|
||||
public MtbLisvData setDataAggPrz(LocalDateTime dataAggPrz) {
|
||||
this.dataAggPrz = dataAggPrz;
|
||||
return this;
|
||||
}
|
||||
@@ -627,20 +629,20 @@ public class MtbLisvData extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataIniz() {
|
||||
public LocalDate getDataIniz() {
|
||||
return dataIniz;
|
||||
}
|
||||
|
||||
public MtbLisvData setDataIniz(Date dataIniz) {
|
||||
public MtbLisvData setDataIniz(LocalDate dataIniz) {
|
||||
this.dataIniz = dataIniz;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataFine() {
|
||||
public LocalDate getDataFine() {
|
||||
return dataFine;
|
||||
}
|
||||
|
||||
public MtbLisvData setDataFine(Date dataFine) {
|
||||
public MtbLisvData setDataFine(LocalDate dataFine) {
|
||||
this.dataFine = dataFine;
|
||||
return this;
|
||||
}
|
||||
@@ -699,6 +701,15 @@ public class MtbLisvData extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Boolean getChiusuraImmediata() {
|
||||
return chiusuraImmediata;
|
||||
}
|
||||
|
||||
public MtbLisvData setChiusuraImmediata(Boolean chiusuraImmediata) {
|
||||
this.chiusuraImmediata = chiusuraImmediata;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getFlagEquiPrezzo() {
|
||||
return flagEquiPrezzo;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import org.apache.logging.log4j.Logger;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.time.LocalDate;
|
||||
|
||||
@PropertyReactive
|
||||
@Table(MtbLisvDataSpese.ENTITY)
|
||||
@@ -53,7 +53,7 @@ public class MtbLisvDataSpese extends EntityBase {
|
||||
private Integer a;
|
||||
|
||||
@ImportFromParent
|
||||
private Date dataIniz;
|
||||
private LocalDate dataIniz;
|
||||
|
||||
public MtbLisvDataSpese() {
|
||||
super(logger);
|
||||
@@ -135,11 +135,11 @@ public class MtbLisvDataSpese extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataIniz() {
|
||||
public LocalDate getDataIniz() {
|
||||
return dataIniz;
|
||||
}
|
||||
|
||||
public void setDataIniz(Date dataIniz) {
|
||||
public void setDataIniz(LocalDate dataIniz) {
|
||||
this.dataIniz = dataIniz;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package it.integry.ems_model.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import it.integry.ems_model.annotation.EntityChild;
|
||||
import it.integry.ems_model.annotation.PK;
|
||||
import it.integry.ems_model.annotation.SqlField;
|
||||
import it.integry.ems_model.annotation.Table;
|
||||
@@ -10,6 +11,8 @@ import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@PropertyReactive
|
||||
@@ -38,6 +41,13 @@ public class MtbSfam extends EntityBase implements EquatableEntityInterface<MtbS
|
||||
@SqlField(value = "descrizione", maxLength = 40, nullable = false)
|
||||
private String descrizione;
|
||||
|
||||
@EntityChild
|
||||
private List<MtbSsfam> mtbSsfam;
|
||||
|
||||
{
|
||||
mtbSsfam = new ArrayList<>();
|
||||
}
|
||||
|
||||
public MtbSfam() {
|
||||
super(logger);
|
||||
}
|
||||
@@ -74,6 +84,21 @@ public class MtbSfam extends EntityBase implements EquatableEntityInterface<MtbS
|
||||
this.descrizione = descrizione;
|
||||
}
|
||||
|
||||
public List<MtbSsfam> getMtbSsfam() {
|
||||
return mtbSsfam;
|
||||
}
|
||||
|
||||
public MtbSfam setMtbSsfam(List<MtbSsfam> mtbSsfam) {
|
||||
this.mtbSsfam = mtbSsfam;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void deleteChilds() throws Exception {
|
||||
MtbSsfam mtbSsfam = new MtbSsfam();
|
||||
mtbSsfam.deleteAllEntities(connection, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equalsKey(MtbSfam other) {
|
||||
if (this == other)
|
||||
|
||||
@@ -59,6 +59,13 @@ public class MtbSgrp extends EntityBase implements EquatableEntityInterface<MtbS
|
||||
@EntityChild
|
||||
private List<MtbSfam> mtbSfam = new ArrayList<>();
|
||||
|
||||
@EntityChild
|
||||
private List<MtbSsfam> mtbSsfam;
|
||||
|
||||
{
|
||||
mtbSsfam = new ArrayList<>();
|
||||
}
|
||||
|
||||
public MtbSgrp() {
|
||||
super(logger);
|
||||
}
|
||||
@@ -162,6 +169,8 @@ public class MtbSgrp extends EntityBase implements EquatableEntityInterface<MtbS
|
||||
|
||||
@Override
|
||||
protected void deleteChilds() throws Exception {
|
||||
MtbSsfam mtbSsfam = new MtbSsfam();
|
||||
mtbSsfam.deleteAllEntities(connection, this);
|
||||
MtbSfam mtbSfam = new MtbSfam();
|
||||
mtbSfam.deleteAllEntities(connection, this);
|
||||
}
|
||||
|
||||
131
ems-core/src/main/java/it/integry/ems_model/entity/MtbSsfam.java
Normal file
131
ems-core/src/main/java/it/integry/ems_model/entity/MtbSsfam.java
Normal file
@@ -0,0 +1,131 @@
|
||||
package it.integry.ems_model.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import it.integry.ems_model.annotation.FK;
|
||||
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(MtbSsfam.ENTITY)
|
||||
@JsonTypeName( MtbSsfam.ENTITY)
|
||||
public class MtbSsfam extends EntityBase implements EquatableEntityInterface<MtbSsfam> {
|
||||
|
||||
public final static String ENTITY = "mtb_ssfam";
|
||||
|
||||
private final static Long serialVersionUID = 1L;
|
||||
|
||||
private final static Logger logger = LogManager.getLogger();
|
||||
|
||||
public MtbSsfam() {
|
||||
super(logger);
|
||||
}
|
||||
|
||||
@PK()
|
||||
@SqlField(value = "cod_mgrp", maxLength = 5, nullable = false)
|
||||
@FK(tableName = MtbGrup.ENTITY, columnName = "cod_mgrp")
|
||||
@FK(tableName = MtbSfam.ENTITY, columnName = "cod_mgrp")
|
||||
@FK(tableName = MtbSgrp.ENTITY, columnName = "cod_mgrp")
|
||||
private String codMgrp;
|
||||
|
||||
@PK()
|
||||
@SqlField(value = "cod_msgr", maxLength = 5, nullable = false)
|
||||
@FK(tableName = MtbSfam.ENTITY, columnName = "cod_msgr")
|
||||
@FK(tableName = MtbSgrp.ENTITY, columnName = "cod_msgr")
|
||||
private String codMsgr;
|
||||
|
||||
@PK()
|
||||
@SqlField(value = "cod_msfa", maxLength = 6, nullable = false)
|
||||
@FK(tableName = MtbSfam.ENTITY, columnName = "cod_msfa")
|
||||
private String codMsfa;
|
||||
|
||||
@PK()
|
||||
@SqlField(value = "cod_mssfa", maxLength = 6, nullable = false)
|
||||
private String codMssfa;
|
||||
|
||||
@SqlField(value = "descrizione", maxLength = 40, nullable = false)
|
||||
private String descrizione;
|
||||
|
||||
public String getCodMgrp() {
|
||||
return codMgrp;
|
||||
}
|
||||
|
||||
public MtbSsfam setCodMgrp(String codMgrp) {
|
||||
this.codMgrp = codMgrp;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodMsgr() {
|
||||
return codMsgr;
|
||||
}
|
||||
|
||||
public MtbSsfam setCodMsgr(String codMsgr) {
|
||||
this.codMsgr = codMsgr;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodMsfa() {
|
||||
return codMsfa;
|
||||
}
|
||||
|
||||
public MtbSsfam setCodMsfa(String codMsfa) {
|
||||
this.codMsfa = codMsfa;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodMssfa() {
|
||||
return codMssfa;
|
||||
}
|
||||
|
||||
public MtbSsfam setCodMssfa(String codMssfa) {
|
||||
this.codMssfa = codMssfa;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDescrizione() {
|
||||
return descrizione;
|
||||
}
|
||||
|
||||
public MtbSsfam setDescrizione(String descrizione) {
|
||||
this.descrizione = descrizione;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equalsKey(MtbSsfam other) {
|
||||
if (this == other)
|
||||
return true;
|
||||
|
||||
if(hashCodeKey() != other.hashCodeKey())
|
||||
return false;
|
||||
|
||||
return Objects.equals(getCodMgrp(), other.getCodMgrp()) && Objects.equals(getCodMsgr(), other.getCodMsgr()) && Objects.equals(getCodMsfa(), other.getCodMsfa()) && Objects.equals(getCodMssfa(), other.getCodMssfa());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCodeKey() {
|
||||
return Objects.hash(getCodMgrp(), getCodMsgr(), getCodMsfa() , getCodMssfa());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof MtbSsfam)) return false;
|
||||
MtbSsfam mtbSsfam = (MtbSsfam) o;
|
||||
return Objects.equals(getCodMgrp(), mtbSsfam.getCodMgrp()) && Objects.equals(getCodMsgr(), mtbSsfam.getCodMsgr()) && Objects.equals(getCodMsfa(), mtbSsfam.getCodMsfa())&& Objects.equals(getCodMssfa(), mtbSsfam.getCodMssfa()) && Objects.equals(getDescrizione(), mtbSsfam.getDescrizione());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(getCodMgrp(), getCodMsgr(), getCodMsfa(), getCodMssfa(), getDescrizione());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -48,7 +48,7 @@ public class MtbVarLisvLog extends EntityBase {
|
||||
@SqlField(value = "cod_vlis", maxLength = 5, nullable = false)
|
||||
private String codVlis;
|
||||
|
||||
@SqlField(value = "versione", nullable = false)
|
||||
@SqlField(value = "versione")
|
||||
private Integer versione;
|
||||
|
||||
@SqlField(value = "cod_promo", maxLength = 10, nullable = true)
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import it.integry.ems_model.annotation.*;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import it.integry.ems_model.entity._enum.IBaseEnum;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
@@ -111,6 +112,9 @@ public class VtbList extends EntityBase {
|
||||
@SqlField(value = "flag_add_trasp", nullable = false, defaultObjectValue = "1")
|
||||
private Boolean flagAddTrasp;
|
||||
|
||||
@SqlField(value = "tipo_um", nullable = true)
|
||||
private Short tipoUm;
|
||||
|
||||
@JsonProperty("versioneRif")
|
||||
private Integer versioneRif;
|
||||
|
||||
@@ -123,6 +127,9 @@ public class VtbList extends EntityBase {
|
||||
@EntityChild
|
||||
private List<VtbListPremi> vtbListPremi = new ArrayList<>();
|
||||
|
||||
@EntityChild
|
||||
private List<MtbLisv> mtbLisv = new ArrayList<>();
|
||||
|
||||
public VtbList() {
|
||||
super(logger);
|
||||
}
|
||||
@@ -334,6 +341,15 @@ public class VtbList extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Short getTipoUm() {
|
||||
return tipoUm;
|
||||
}
|
||||
|
||||
public VtbList setTipoUm(Short tipoUm) {
|
||||
this.tipoUm = tipoUm;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getVersioneRif() {
|
||||
return versioneRif;
|
||||
}
|
||||
@@ -370,18 +386,13 @@ public class VtbList extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void insertChilds() throws Exception {
|
||||
for (VtbListPremi vtbListPremi : getVtbListPremi()) {
|
||||
vtbListPremi.manageWithParentConnection(connection, vtbListPremi.getOperation(), dataCompleting, entityHolder);
|
||||
}
|
||||
public List<MtbLisv> getMtbLisv() {
|
||||
return mtbLisv;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateChilds() throws Exception {
|
||||
for (VtbListPremi vtbListPremi : getVtbListPremi()) {
|
||||
vtbListPremi.manageWithParentConnection(connection, vtbListPremi.getOperation(), dataCompleting, entityHolder);
|
||||
}
|
||||
public VtbList setMtbLisv(List<MtbLisv> mtbLisv) {
|
||||
this.mtbLisv = mtbLisv;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -389,4 +400,44 @@ public class VtbList extends EntityBase {
|
||||
VtbListPremi vtbListPremi = new VtbListPremi();
|
||||
vtbListPremi.deleteAllEntities(connection, this);
|
||||
}
|
||||
|
||||
public enum TipoUm implements IBaseEnum<TipoUm> {
|
||||
ARTICOLO(null),
|
||||
COLLI((short) 1),
|
||||
PESO_KG((short) 2);
|
||||
|
||||
private Short value;
|
||||
|
||||
TipoUm(Short value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public static TipoUm fromValue(Object value) {
|
||||
for (TipoUm tipoUm : TipoUm.values()) {
|
||||
if (tipoUm.value==value) {
|
||||
return tipoUm;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Short getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object get() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TipoUm fromInternal(Object val) {
|
||||
return fromValue(val);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,8 +15,9 @@ import org.kie.api.definition.type.PropertyReactive;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.Statement;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -41,13 +42,13 @@ public class VtbListData extends EntityBase {
|
||||
private Integer versione;
|
||||
|
||||
@SqlField(value = "data_iniz", nullable = false, defaultObjectValue = CommonConstants.SYSDATE)
|
||||
private Date dataIniz;
|
||||
private LocalDate dataIniz;
|
||||
|
||||
@SqlField(value = "data_fine")
|
||||
private Date dataFine;
|
||||
private LocalDate dataFine;
|
||||
|
||||
@SqlField(value = "data_att")
|
||||
private Date dataAtt;
|
||||
private LocalDate dataAtt;
|
||||
|
||||
@SqlField(value = "ricarica", nullable = false)
|
||||
private BigDecimal ricarica;
|
||||
@@ -59,14 +60,14 @@ public class VtbListData extends EntityBase {
|
||||
@SqlField(value = "cod_promo", maxLength = 10)
|
||||
private String codPromo;
|
||||
|
||||
@SqlField(value = "data_ult_var", defaultObjectValue = CommonConstants.TIMESTAMP)
|
||||
private Date dataUltVar;
|
||||
@SqlField(value = "data_ult_var")
|
||||
private LocalDateTime dataUltVar;
|
||||
|
||||
@SqlField(value = "data_trasmissione")
|
||||
private Date dataTrasmissione;
|
||||
private LocalDateTime dataTrasmissione;
|
||||
|
||||
@SqlField(value = "data_trasmissione_fine_promo")
|
||||
private Date dataTrasmissioneFinePromo;
|
||||
private LocalDateTime dataTrasmissioneFinePromo;
|
||||
|
||||
@SqlField(value = "porto", maxLength = 20)
|
||||
private String porto;
|
||||
@@ -83,6 +84,9 @@ public class VtbListData extends EntityBase {
|
||||
@SqlField(value = "condizioni_comm")
|
||||
private String condizioniComm;
|
||||
|
||||
@SqlField(value = "chiusura_immediata", nullable = false, defaultObjectValue = "0")
|
||||
private Boolean chiusuraImmediata;
|
||||
|
||||
@MapToTable("descr_promo")
|
||||
private String descrPromo;
|
||||
|
||||
@@ -137,29 +141,29 @@ public class VtbListData extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataIniz() {
|
||||
public LocalDate getDataIniz() {
|
||||
return dataIniz;
|
||||
}
|
||||
|
||||
public VtbListData setDataIniz(Date dataIniz) {
|
||||
public VtbListData setDataIniz(LocalDate dataIniz) {
|
||||
this.dataIniz = dataIniz;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataFine() {
|
||||
public LocalDate getDataFine() {
|
||||
return dataFine;
|
||||
}
|
||||
|
||||
public VtbListData setDataFine(Date dataFine) {
|
||||
public VtbListData setDataFine(LocalDate dataFine) {
|
||||
this.dataFine = dataFine;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataAtt() {
|
||||
public LocalDate getDataAtt() {
|
||||
return dataAtt;
|
||||
}
|
||||
|
||||
public VtbListData setDataAtt(Date dataAtt) {
|
||||
public VtbListData setDataAtt(LocalDate dataAtt) {
|
||||
this.dataAtt = dataAtt;
|
||||
return this;
|
||||
}
|
||||
@@ -191,29 +195,29 @@ public class VtbListData extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataUltVar() {
|
||||
public LocalDateTime getDataUltVar() {
|
||||
return dataUltVar;
|
||||
}
|
||||
|
||||
public VtbListData setDataUltVar(Date dataUltVar) {
|
||||
public VtbListData setDataUltVar(LocalDateTime dataUltVar) {
|
||||
this.dataUltVar = dataUltVar;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataTrasmissione() {
|
||||
public LocalDateTime getDataTrasmissione() {
|
||||
return dataTrasmissione;
|
||||
}
|
||||
|
||||
public VtbListData setDataTrasmissione(Date dataTrasmissione) {
|
||||
public VtbListData setDataTrasmissione(LocalDateTime dataTrasmissione) {
|
||||
this.dataTrasmissione = dataTrasmissione;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataTrasmissioneFinePromo() {
|
||||
public LocalDateTime getDataTrasmissioneFinePromo() {
|
||||
return dataTrasmissioneFinePromo;
|
||||
}
|
||||
|
||||
public VtbListData setDataTrasmissioneFinePromo(Date dataTrasmissioneFinePromo) {
|
||||
public VtbListData setDataTrasmissioneFinePromo(LocalDateTime dataTrasmissioneFinePromo) {
|
||||
this.dataTrasmissioneFinePromo = dataTrasmissioneFinePromo;
|
||||
return this;
|
||||
}
|
||||
@@ -263,6 +267,15 @@ public class VtbListData extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Boolean getChiusuraImmediata() {
|
||||
return chiusuraImmediata;
|
||||
}
|
||||
|
||||
public VtbListData setChiusuraImmediata(Boolean chiusuraImmediata) {
|
||||
this.chiusuraImmediata = chiusuraImmediata;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDescrPromo() {
|
||||
return descrPromo;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import it.integry.ems_model.annotation.Table;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.time.LocalDate;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
@@ -33,16 +33,16 @@ public class VtbPromo extends EntityBase {
|
||||
private String descrizione;
|
||||
|
||||
@SqlField(value = "data_iniz_sell_in")
|
||||
private Date dataInizSellIn;
|
||||
private LocalDate dataInizSellIn;
|
||||
|
||||
@SqlField(value = "data_fine_sell_in")
|
||||
private Date dataFineSellIn;
|
||||
private LocalDate dataFineSellIn;
|
||||
|
||||
@SqlField(value = "data_iniz_sell_out")
|
||||
private Date dataInizSellOut;
|
||||
private LocalDate dataInizSellOut;
|
||||
|
||||
@SqlField(value = "data_fine_sell_out")
|
||||
private Date dataFineSellOut;
|
||||
private LocalDate dataFineSellOut;
|
||||
|
||||
@SqlField(value = "flag_promo_rimb", maxLength = 1, nullable = false, defaultObjectValue = "S")
|
||||
private String flagPromoRimb;
|
||||
@@ -123,42 +123,39 @@ public class VtbPromo extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataInizSellIn() {
|
||||
public LocalDate getDataInizSellIn() {
|
||||
return dataInizSellIn;
|
||||
}
|
||||
|
||||
public VtbPromo setDataInizSellIn(Date dataInizSellIn) {
|
||||
public VtbPromo setDataInizSellIn(LocalDate dataInizSellIn) {
|
||||
this.dataInizSellIn = dataInizSellIn;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataFineSellIn() {
|
||||
return dataFineSellIn;
|
||||
}
|
||||
|
||||
public VtbPromo setDataFineSellIn(Date dataFineSellIn) {
|
||||
this.dataFineSellIn = dataFineSellIn;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataInizSellOut() {
|
||||
return dataInizSellOut;
|
||||
}
|
||||
|
||||
public VtbPromo setDataInizSellOut(Date dataInizSellOut) {
|
||||
public VtbPromo setDataInizSellOut(LocalDate dataInizSellOut) {
|
||||
this.dataInizSellOut = dataInizSellOut;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataFineSellOut() {
|
||||
public LocalDate getDataFineSellOut() {
|
||||
return dataFineSellOut;
|
||||
}
|
||||
|
||||
public VtbPromo setDataFineSellOut(Date dataFineSellOut) {
|
||||
public LocalDate getDataFineSellIn() {
|
||||
return dataFineSellIn;
|
||||
}
|
||||
|
||||
public VtbPromo setDataFineSellIn(LocalDate dataFineSellIn) {
|
||||
this.dataFineSellIn = dataFineSellIn;
|
||||
return this;
|
||||
}
|
||||
|
||||
public VtbPromo setDataFineSellOut(LocalDate dataFineSellOut) {
|
||||
this.dataFineSellOut = dataFineSellOut;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public String getFlagPromoRimb() {
|
||||
return flagPromoRimb;
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ public class VtbViaggi extends EntityBase {
|
||||
@SqlField(value = "incoterms", maxLength = 20)
|
||||
private String incoterms;
|
||||
|
||||
@SqlField(value = "note_incoterms", maxLength = 20)
|
||||
@SqlField(value = "note_incoterms", maxLength = 40)
|
||||
private String noteIncoterms;
|
||||
|
||||
@Priority(value = 101, copyPk = false)
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
package it.integry.ems_model.entity._enum;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
|
||||
public enum ListinoEnum implements IBaseEnum<ListinoEnum> {
|
||||
COSTO_MEDIO("CMED")
|
||||
, DISTINTA("DIST"), COSTO_ULTIMO("ULTC");
|
||||
|
||||
private final String value;
|
||||
|
||||
ListinoEnum(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public static ListinoEnum from(Object value) {
|
||||
String castValue = null;
|
||||
|
||||
if (value instanceof String)
|
||||
castValue = (String) value;
|
||||
|
||||
|
||||
for (ListinoEnum b : ListinoEnum.values()) {
|
||||
if (b.value == castValue)
|
||||
return b;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object get() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ListinoEnum fromInternal(Object val) {
|
||||
return from(val);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,18 @@ public class DtbOrdtKey {
|
||||
this.numOrd = numOrd;
|
||||
}
|
||||
|
||||
public String getGestione() {
|
||||
return gestione;
|
||||
}
|
||||
|
||||
public Date getDataOrd() {
|
||||
return dataOrd;
|
||||
}
|
||||
|
||||
public Integer getNumOrd() {
|
||||
return numOrd;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
|
||||
@@ -62,11 +62,11 @@ public class DeviceService {
|
||||
return UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), sql);
|
||||
}
|
||||
|
||||
public void updateUsage(IntegryApplicationEnum application, long deviceId) throws Exception {
|
||||
public void updateUsage(long deviceId) throws Exception {
|
||||
MultiDBTransactionManager multiDBTransactionManager = ContextLoader.getCurrentWebApplicationContext().getBean(MultiDBTransactionManager.class);
|
||||
String updateSql = Query.format("UPDATE stb_devices " +
|
||||
" SET last_use = {}, name = {}" +
|
||||
" WHERE id = {}", UtilityLocalDate.getNowTime(), application.name(), deviceId);
|
||||
" SET last_use = {}" +
|
||||
" WHERE id = {}", UtilityLocalDate.getNowTime(), deviceId);
|
||||
|
||||
UtilityDB.executeSimpleUpdate(multiDBTransactionManager.getPrimaryConnection(), updateSql);
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -37,7 +37,7 @@ end
|
||||
rule "completeValUntDISTDocL"
|
||||
when
|
||||
eval(completeRulesEnabled)
|
||||
$docR : DtbDocr(valUnt == null && rapConv != null && ("DIST" == listino || listino == null) && codMart != null && gestione == "L")
|
||||
$docR : DtbDocr(valUnt == null && rapConv != null && ("DIST" == listino) && codMart != null && gestione == "L")
|
||||
then
|
||||
BigDecimal valUnt = CommonRules.completeValUntDIST(conn, $docR);
|
||||
modify ( $docR ) { setValUnt(valUnt) }
|
||||
@@ -46,7 +46,7 @@ end
|
||||
rule "completeValUntCMEDDocL"
|
||||
when
|
||||
eval(completeRulesEnabled)
|
||||
$docR : DtbDocr(valUnt == null && rapConv != null && ("CMED" == listino || listino == null) && codMart != null && gestione == "L")
|
||||
$docR : DtbDocr(valUnt == null && rapConv != null && ("CMED" == listino ) && codMart != null && gestione == "L")
|
||||
then
|
||||
BigDecimal valUnt= CommonRules.completeValUntCMED(conn, $docR);
|
||||
modify ( $docR ) { setValUnt(valUnt) }
|
||||
|
||||
@@ -11,6 +11,7 @@ import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||
import org.drools.core.util.bitmask.LongBitMask
|
||||
import it.integry.ems.utility.UtilityEntity
|
||||
import it.integry.ems_model.utility.UtilityDB
|
||||
import java.time.LocalDate
|
||||
|
||||
global Connection conn
|
||||
global String username
|
||||
@@ -53,7 +54,7 @@ when
|
||||
eval(completeRulesEnabled)
|
||||
$lisvData: VtbListData(dataIniz == null)
|
||||
then
|
||||
Date dataIniz = (Date) CommonRules.completeWithDefault(VtbListData.class, "dataIniz");
|
||||
LocalDate dataIniz = (LocalDate) CommonRules.completeWithDefault(VtbListData.class, "dataIniz");
|
||||
modify ( $lisvData ) { setDataIniz(dataIniz) }
|
||||
end
|
||||
|
||||
@@ -388,7 +389,7 @@ when
|
||||
eval(completeRulesEnabled)
|
||||
$entity : MtbLisvData(codVlis != null && operation != OperationType.DELETE)
|
||||
then
|
||||
modify ( $entity ) { setDataAggPrz(new Date()) }
|
||||
modify ( $entity ) { setDataAggPrz(LocalDateTime.now()) }
|
||||
end
|
||||
|
||||
rule "completeCodVlisRif"
|
||||
|
||||
@@ -456,3 +456,15 @@ then
|
||||
throw new CheckConstraintException(String.format("Attenzione! Email non valida per la persona di riferimento %s.",
|
||||
$vtbCliePersRif.getPersonaRif()));
|
||||
end
|
||||
|
||||
|
||||
rule "checkMtbLisvDelete"
|
||||
no-loop
|
||||
when
|
||||
eval(checkRulesEnabled)
|
||||
$entity : MtbLisv(operation == OperationType.DELETE)
|
||||
eval(SalesRules.checkMtbLisvDelete(conn, $entity))
|
||||
then
|
||||
throw new CheckConstraintException(
|
||||
String.format("Attezione!Impossibile cancellare l'articolo %s dal listino %s ci sono variazioni future. ", $entity.getCodMart(), $entity.getCodVlis()));
|
||||
end
|
||||
@@ -15,6 +15,7 @@ import it.integry.ems_model.utility.UtilityHashMap
|
||||
import it.integry.ems_model.utility.UtilityDate
|
||||
import it.integry.ems_model.utility.UtilityDB
|
||||
import it.integry.ems_model.utility.UtilityLocalDate
|
||||
import it.integry.ems_model.config.EmsRestConstants
|
||||
|
||||
global Connection conn
|
||||
global String username
|
||||
@@ -261,7 +262,7 @@ when
|
||||
eval(completeRulesEnabled)
|
||||
$entity: CtbPart(annoPart == null && dataDoc != null && operation != OperationType.DELETE )
|
||||
then
|
||||
int annoPart = UtilityDate.getYear($entity.getDataDoc());
|
||||
int annoPart = $entity.getDataDoc().getYear();
|
||||
modify ( $entity ) { setAnnoPart(annoPart)}
|
||||
end
|
||||
|
||||
@@ -425,7 +426,7 @@ then
|
||||
"ser_doc = '" + $entity.getSerDoc() + "' AND " +
|
||||
"num_doc = " + $entity.getNumDoc();
|
||||
Date dataDoc = (Date) QueryRules.getSingleValue(conn, sql);
|
||||
modify ( $entity ) { setDataDoc(dataDoc) }
|
||||
modify ( $entity ) { setDataDoc(UtilityLocalDate.localDateFromDate(dataDoc)) }
|
||||
end
|
||||
|
||||
|
||||
@@ -437,10 +438,9 @@ when
|
||||
$entity: CtbScad(riaperta != null && riaperta && numCmov !=null)
|
||||
then
|
||||
List<CrlScadParr> crlScadParrs = AccountingRules.completeCrlParrScadScad(conn, $entity);
|
||||
Date dataNull = new Date(-2208992400000L);
|
||||
modify ( $entity ) {
|
||||
setCrlScadParr(crlScadParrs),
|
||||
setDataPag(dataNull) }
|
||||
setDataPag(EmsRestConstants.LOCAL_DATE_NULL) }
|
||||
end
|
||||
|
||||
|
||||
@@ -480,8 +480,7 @@ when
|
||||
eval(completeRulesEnabled)
|
||||
$entity: CtbScad( (impAvere != null && impAvere == 0 ) || (impDare != null && impDare == 0 ))
|
||||
then
|
||||
Date dataNull = new Date(-2208992400000L);
|
||||
modify ( $entity ) { setDataPag(dataNull ) }//impostiamo la data a null
|
||||
modify ( $entity ) { setDataPag(EmsRestConstants.LOCAL_DATE_NULL ) }//impostiamo la data a null
|
||||
end
|
||||
|
||||
rule "completeInseritoDaCtbMovt"
|
||||
|
||||
@@ -195,12 +195,11 @@ when
|
||||
eval(postRulesEnabled)
|
||||
$ctbMovt: CtbMovt()
|
||||
$entity : EntityBase() from $ctbMovt
|
||||
//$iva: java.util.ArrayList(size > 0) from collect(EntityBase() from $ctbMovt.ctbMovi)
|
||||
$list: java.util.ArrayList(size > 0) from collect(EntityBase() from $ctbMovt.ctbMovr)
|
||||
then
|
||||
CommonRules.reloadRow(conn, $entity);
|
||||
/*Sulla ctb_movr abbiamo 2 campi riga da valorizzare*/
|
||||
CommonRules.completeRigaCtbMovr( $entity);
|
||||
CommonRules.completeRigaCtbMovr( $ctbMovt );
|
||||
AccountingRules.checkRigaMovCtbParr( $ctbMovt );
|
||||
AccountingRules.setImportoMov( $ctbMovt );
|
||||
AccountingRules.chkMovimentoBilanciato($ctbMovt);
|
||||
end
|
||||
|
||||
@@ -536,8 +536,8 @@ public class ContabilImportService {
|
||||
|
||||
if (ctbPart != null) {
|
||||
CtbScad ctbScad = new CtbScad();
|
||||
ctbScad.setDataScad(dataScad);
|
||||
ctbScad.setDataPag(dataScad);
|
||||
ctbScad.setDataScad(UtilityLocalDate.localDateFromDate(dataScad));
|
||||
ctbScad.setDataPag(UtilityLocalDate.localDateFromDate(dataScad));
|
||||
ctbScad.setDescrizPag(pagamento);
|
||||
|
||||
BigDecimal impRata = UtilityString.isNullOrEmpty(importoRata) ? null : new BigDecimal(importoRata);
|
||||
@@ -557,8 +557,8 @@ public class ContabilImportService {
|
||||
if (!impPagato.equals(impRata) && !UtilityString.isNullOrEmpty(stringResiduo)) {
|
||||
CtbScad ctbScadResiduo = new CtbScad();
|
||||
ctbScadResiduo.setOperation(OperationType.INSERT);
|
||||
ctbScadResiduo.setDataScad(dataScad);
|
||||
ctbScadResiduo.setDataPag(dataScad);
|
||||
ctbScadResiduo.setDataScad(UtilityLocalDate.localDateFromDate(dataScad));
|
||||
ctbScadResiduo.setDataPag(UtilityLocalDate.localDateFromDate(dataScad));
|
||||
ctbScadResiduo.setDescrizPag(pagamento);
|
||||
if (residuoIsNegative) {
|
||||
ctbScadResiduo.setImpAvere(positiveResiduo);
|
||||
|
||||
@@ -24,6 +24,7 @@ import java.io.File;
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
@@ -73,8 +74,8 @@ public class ScadenzeImportService {
|
||||
impAvere = importo;
|
||||
}
|
||||
|
||||
Date dataScad = UtilityDate.StringToDate(line.substring(57, 65), "ddMMyyyy");
|
||||
Date dataDoc = UtilityDate.StringToDate(line.substring(267, 275), "ddMMyyyy");
|
||||
LocalDate dataScad = UtilityString.parseLocalDate(line.substring(57, 65), "ddMMyyyy");
|
||||
LocalDate dataDoc = UtilityString.parseLocalDate(line.substring(267, 275), "ddMMyyyy");
|
||||
String diacod = line.substring(92, 108).trim();
|
||||
Integer numDoc = UtilityString.isIntNumber(line.substring(185, 197).trim()) ? UtilityInteger.stringToInteger(line.substring(185, 197).trim()) : null;
|
||||
String intercode = line.substring(197, 223);
|
||||
@@ -137,7 +138,8 @@ public class ScadenzeImportService {
|
||||
forceIn2021 = true;
|
||||
}
|
||||
|
||||
if (forceIn2021 || (ctbPart == null && (anno != null && (anno < 2021 || dataDoc.before(UtilityDate.StringToDate("2021/07/01", "yyyy/MM/dd")))))) {
|
||||
if (forceIn2021 || (ctbPart == null && (anno != null && (anno < 2021 ||
|
||||
dataDoc.isBefore(UtilityString.parseLocalDate("2021/07/01", "yyyy/MM/dd")))))) {
|
||||
sql = Query.format(
|
||||
"SELECT *\n" +
|
||||
"FROM ctb_part\n" +
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package it.integry.ems.contabil.controller;
|
||||
|
||||
import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems.contabil.dto.MovimentiContabileDeleteDTO;
|
||||
import it.integry.ems.contabil.service.MovimentiContabiliService;
|
||||
import it.integry.ems.response.ServiceRestResponse;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
@@ -42,9 +43,9 @@ public class MovimentiContabiliController {
|
||||
@PostMapping(value = "delete")
|
||||
public @ResponseBody
|
||||
ServiceRestResponse delete(HttpServletRequest request,
|
||||
@RequestParam String whereCond) throws Exception {
|
||||
@RequestBody MovimentiContabileDeleteDTO movimentiContabileDeleteDTO) throws Exception {
|
||||
|
||||
return ServiceRestResponse.createPositiveResponse(movimentiContabiliServices.delete(multiDBTransactionManager,whereCond));
|
||||
return ServiceRestResponse.createPositiveResponse(movimentiContabiliServices.delete(multiDBTransactionManager,movimentiContabileDeleteDTO));
|
||||
}
|
||||
|
||||
@PostMapping(value = "generateReverseCharge")
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package it.integry.ems.contabil.dto;
|
||||
|
||||
public class MovimentiContabileDeleteDTO {
|
||||
private String whereCond;
|
||||
|
||||
public String getWhereCond() {
|
||||
return whereCond;
|
||||
}
|
||||
|
||||
public MovimentiContabileDeleteDTO setWhereCond(String whereCond) {
|
||||
this.whereCond = whereCond;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1401,10 +1401,10 @@ public class ContabilService {
|
||||
if (UtilityBigDecimal.isNullOrZero(impIncasso)) {
|
||||
impIncasso = impIncasso.multiply(new BigDecimal(-1));
|
||||
CtbScad ctbScadInsoluto = new CtbScad()
|
||||
.setDataScad(ctbMovt.getDataCmov())
|
||||
.setDataScad(UtilityLocalDate.localDateFromDate(ctbMovt.getDataCmov()))
|
||||
.setImpDare(impIncasso)
|
||||
.setImpAvere(impIncasso)
|
||||
.setDataPag(ctbMovt.getDataCmov());
|
||||
.setDataPag(UtilityLocalDate.localDateFromDate(ctbMovt.getDataCmov()));
|
||||
ctbScadInsoluto.setOperation(OperationType.INSERT);
|
||||
|
||||
ctbScads.add(ctbScadInsoluto);
|
||||
@@ -1422,7 +1422,7 @@ public class ContabilService {
|
||||
}
|
||||
|
||||
ctbScadInsoluto = new CtbScad()
|
||||
.setDataScad(ctbMovt.getDataCmov())
|
||||
.setDataScad(UtilityLocalDate.localDateFromDate(ctbMovt.getDataCmov()))
|
||||
.setImpDare(impDareIns)
|
||||
.setImpAvere(impAvereIns);
|
||||
ctbScadInsoluto.setOperation(OperationType.INSERT);
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package it.integry.ems.contabil.service;
|
||||
|
||||
import it.integry.ems.contabil.dto.MovimentiContabileDeleteDTO;
|
||||
import it.integry.ems.rules.businessLogic.AccountingBusinessLogic;
|
||||
import it.integry.ems.service.EntityProcessor;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems.utility.UtilityEntity;
|
||||
@@ -12,10 +14,9 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
|
||||
@@ -27,6 +28,7 @@ public class MovimentiContabiliService {
|
||||
List<EntityBase> entitiesToSave = new ArrayList<>();
|
||||
|
||||
if (ctbMovt.getNumCmov() != null && ctbMovt.getOperation() != OperationType.DELETE) {
|
||||
|
||||
if (ctbMovt.getCodAnag() != null) {
|
||||
String sql =
|
||||
Query.format("SELECT cod_anag FROM ctb_movt WHERE num_cmov = %s", ctbMovt.getNumCmov());
|
||||
@@ -57,6 +59,56 @@ public class MovimentiContabiliService {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ctbMovt.getCtbMovr() != null) {
|
||||
if ( ctbMovt.getOperation() == null) {
|
||||
ctbMovt.setOperation(OperationType.SELECT_OBJECT);
|
||||
entityProcessor.processEntity(ctbMovt, multiDBTransactionManager);
|
||||
ctbMovt.setOperation(OperationType.NO_OP);
|
||||
}
|
||||
String sql = Query.format("SELECT azione_su_partita FROM ctb_caus WHERE cod_ccau = %s", ctbMovt.getCodCcau());
|
||||
Integer azioneSuPartita = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), sql);
|
||||
if (azioneSuPartita != null && azioneSuPartita == 0) {
|
||||
Integer annoPart = UtilityDate.datePart(Calendar.YEAR, ctbMovt.getDataDoc());
|
||||
|
||||
List<CtbMovr> righe =
|
||||
ctbMovt.getCtbMovr()
|
||||
.stream()
|
||||
.filter(x ->
|
||||
Objects.equals(x.getAnnoPart(),annoPart) &&
|
||||
x.getSerDoc().equalsIgnoreCase(ctbMovt.getSerDoc()) &&
|
||||
Objects.equals(x.getNumDoc(), ctbMovt.getNumDoc()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
CtbMovr rigaPaga = righe.isEmpty() && righe.size() > 1 ? null : righe.get(righe.size() - 1);
|
||||
|
||||
if (rigaPaga != null) {
|
||||
if (rigaPaga.getCtbScad() == null || rigaPaga.getCtbScad().isEmpty()) {
|
||||
List<CtbScad> elencoScad = ctbMovt.getCtbScad();
|
||||
BigDecimal importo = rigaPaga.getImpDare() == BigDecimal.ZERO ? rigaPaga.getImpAvere() : rigaPaga.getImpDare();
|
||||
AccountingBusinessLogic.pagaScadenze(ctbMovt.getDataCmov(), importo, elencoScad, rigaPaga.getIdRiga());
|
||||
rigaPaga.setCtbScad(elencoScad.stream().filter(x -> x.getIdRigaMov() == rigaPaga.getIdRiga()).collect(Collectors.toList()));
|
||||
} else {
|
||||
List<Integer> idRigaScad = rigaPaga.getCtbScad().stream()
|
||||
.filter(x ->
|
||||
Objects.equals(x.getAnnoPart(), annoPart) &&
|
||||
x.getSerDoc().equalsIgnoreCase(ctbMovt.getSerDoc()) &&
|
||||
Objects.equals(x.getNumDoc(), ctbMovt.getNumDoc()))
|
||||
.map(x -> x.getIdRiga()).distinct().collect(Collectors.toList());
|
||||
|
||||
List<CtbScad> elencoScad =
|
||||
ctbMovt.getCtbScad()
|
||||
.stream()
|
||||
.filter(x ->
|
||||
Objects.equals(x.getAnnoPart(),annoPart) &&
|
||||
x.getSerDoc().equalsIgnoreCase(ctbMovt.getSerDoc()) &&
|
||||
Objects.equals(x.getNumDoc(), ctbMovt.getNumDoc()) &&
|
||||
(x.getIdRiga() == null || !idRigaScad.contains(x.getIdRiga()))).collect(Collectors.toList());
|
||||
ctbMovt.setCtbScad(elencoScad);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
entitiesToSave.add(ctbMovt);
|
||||
} else {
|
||||
entitiesToSave = Collections.singletonList(ctbMovt);
|
||||
@@ -84,10 +136,10 @@ public class MovimentiContabiliService {
|
||||
return save(multiDBTransactionManager, ctbMovt);
|
||||
}
|
||||
|
||||
public List<CtbMovt> delete(MultiDBTransactionManager multiDBTransactionManager, String whereCond) throws Exception {
|
||||
public List<CtbMovt> delete(MultiDBTransactionManager multiDBTransactionManager, MovimentiContabileDeleteDTO movimentiContabileDeleteDTO) throws Exception {
|
||||
String sql = "SELECT num_cmov " +
|
||||
" FROM " + CtbMovt.ENTITY +
|
||||
" WHERE " + whereCond;
|
||||
" WHERE " + movimentiContabileDeleteDTO.getWhereCond();
|
||||
|
||||
List<CtbMovt> ctbMovts = UtilityDB.executeSimpleQueryDTO(multiDBTransactionManager.getPrimaryConnection(), sql, CtbMovt.class);
|
||||
|
||||
@@ -129,7 +181,7 @@ public class MovimentiContabiliService {
|
||||
|
||||
boolean flagReverseCharge = (boolean) datiMov.get("flag_reverse_charge");
|
||||
|
||||
if ( flagReverseCharge ) {
|
||||
if (flagReverseCharge) {
|
||||
CtbMovt ctbMovt = new CtbMovt()
|
||||
.setNumCmov(numCmov);
|
||||
ctbMovt.setOperation(OperationType.UPDATE);
|
||||
|
||||
@@ -1080,7 +1080,7 @@ public class RossoGarganoSyncService {
|
||||
|
||||
CtbPart ctbPart =
|
||||
new CtbPart()
|
||||
.setDataDoc(ctbMovt.getDataDoc())
|
||||
.setDataDoc(UtilityLocalDate.localDateFromDate(ctbMovt.getDataDoc()))
|
||||
.setSerDoc(ctbMovt.getSerDoc())
|
||||
.setAnnoPart(annoPart)
|
||||
.setNumDoc(ctbMovt.getNumDoc())
|
||||
|
||||
@@ -6,6 +6,7 @@ import it.integry.ems.customizations.production.service.ToscaProductionService;
|
||||
import it.integry.ems.response.EsitoType;
|
||||
import it.integry.ems.response.ServiceRestResponse;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems_model.utility.UtilityLocalDate;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -13,6 +14,10 @@ import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Date;
|
||||
|
||||
@RestController
|
||||
@Scope(value = "request")
|
||||
@@ -92,4 +97,26 @@ public class ToscaProductionController {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "ripubblicaUl", method = RequestMethod.POST)
|
||||
public @ResponseBody
|
||||
ServiceRestResponse ripubblicaUl(HttpServletRequest request,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String profileDB,
|
||||
@RequestParam String startDate) {
|
||||
try {
|
||||
toscaProductionService.ripubblicaUl(LocalDateTime.parse(startDate, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
||||
return ServiceRestResponse.createPositiveResponse();
|
||||
|
||||
} catch (Exception e) {
|
||||
try {
|
||||
multiDBTransactionManager.rollbackAll();
|
||||
} catch (Exception ex) {
|
||||
logger.error(request.getRequestURI(), e);
|
||||
}
|
||||
|
||||
logger.error(request.getRequestURI(), e);
|
||||
return new ServiceRestResponse(EsitoType.KO, profileDB, e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,10 +6,7 @@ import it.integry.ems.service.EntityProcessor;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems_model.entity.*;
|
||||
import it.integry.ems_model.types.OperationType;
|
||||
import it.integry.ems_model.utility.Query;
|
||||
import it.integry.ems_model.utility.UtilityDB;
|
||||
import it.integry.ems_model.utility.UtilityHashMap;
|
||||
import it.integry.ems_model.utility.UtilityLocalDate;
|
||||
import it.integry.ems_model.utility.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -19,9 +16,11 @@ import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@Scope("request")
|
||||
@@ -193,4 +192,29 @@ public class ToscaProductionService {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void ripubblicaUl(LocalDateTime start) throws Exception {
|
||||
|
||||
|
||||
String sql = "SELECT * from mtb_colt where data_vers >= " + UtilityDB.valueToString(start);
|
||||
|
||||
|
||||
List<MtbColt> mtbColtList = UtilityDB.executeSimpleQueryDTO(multiDBTransactionManager.getPrimaryConnection(), sql, MtbColt.class);
|
||||
if (UtilityList.isNullOrEmpty(mtbColtList)) return;
|
||||
|
||||
for (MtbColt mtbColt : mtbColtList) {
|
||||
mtbColt.setOperation(OperationType.INSERT_OR_UPDATE);
|
||||
String rowsSql = "SELECT * from mtb_colr where " + mtbColt.getPkWhereCond();
|
||||
List<MtbColr> rows = UtilityDB.executeSimpleQueryDTO(multiDBTransactionManager.getPrimaryConnection(), rowsSql, MtbColr.class);
|
||||
if (!UtilityList.isNullOrEmpty(rows))
|
||||
mtbColt.setMtbColr(rows.stream().peek(x -> x.setOperation(OperationType.INSERT_OR_UPDATE)).collect(Collectors.toList()));
|
||||
|
||||
String colsSql = "SELECT * from mtb_cols where " + mtbColt.getPkWhereCond();
|
||||
List<MtbCols> cols = UtilityDB.executeSimpleQueryDTO(multiDBTransactionManager.getPrimaryConnection(), colsSql, MtbCols.class);
|
||||
if (!UtilityList.isNullOrEmpty(cols))
|
||||
mtbColt.setMtbCols(cols.stream().peek(x -> x.setOperation(OperationType.INSERT_OR_UPDATE)).collect(Collectors.toList()));
|
||||
|
||||
entityProcessor.processEntity(mtbColt, true, multiDBTransactionManager);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,4 +50,25 @@ public class ToscaSalesController {
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "ripubblicaImpegnato", method = RequestMethod.POST)
|
||||
public @ResponseBody
|
||||
ServiceRestResponse ripubblicaImpegnato(HttpServletRequest request,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String profileDB
|
||||
) {
|
||||
try {
|
||||
toscaSalesService.republishOrders();
|
||||
return ServiceRestResponse.createPositiveResponse();
|
||||
|
||||
} catch (Exception e) {
|
||||
try {
|
||||
multiDBTransactionManager.rollbackAll();
|
||||
} catch (Exception ex) {
|
||||
logger.error(request.getRequestURI(), e);
|
||||
}
|
||||
|
||||
logger.error(request.getRequestURI(), e);
|
||||
return new ServiceRestResponse(EsitoType.KO, profileDB, e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems.utility.UtilityEntity;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import it.integry.ems_model.entity.*;
|
||||
import it.integry.ems_model.entity.key.DtbOrdtKey;
|
||||
import it.integry.ems_model.types.OperationType;
|
||||
import it.integry.ems_model.utility.*;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
@@ -330,4 +331,43 @@ public class ToscaSalesService {
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void republishOrders() throws Exception {
|
||||
String sql = "SELECT dtb_ordr.*\n" +
|
||||
"FROM dtb_ordt\n" +
|
||||
" INNER JOIN dtb_ordr ON dtb_ordr.gestione = dtb_ordt.gestione\n" +
|
||||
" AND dtb_ordr.data_ord = dtb_ordt.data_ord\n" +
|
||||
" AND dtb_ordr.num_ord = dtb_ordt.num_ord\n" +
|
||||
"where dtb_ordt.gestione = 'V' \n" +
|
||||
" AND not dtb_ordr.flag_evaso_forzato = 'S'";
|
||||
|
||||
List<DtbOrdr> righeOrdiniDaPubblicare = UtilityDB.executeSimpleQueryDTO(multiDBTransactionManager.getPrimaryConnection(), sql, DtbOrdr.class);
|
||||
if (UtilityList.isNullOrEmpty(righeOrdiniDaPubblicare))
|
||||
return;
|
||||
righeOrdiniDaPubblicare.stream().forEach(x -> x.setFlagEvasoForzato("N").setOperation(OperationType.INSERT_OR_UPDATE));
|
||||
List<DtbOrdtKey> ordiniDaPubblicare = righeOrdiniDaPubblicare.stream().map(row -> new DtbOrdtKey(row.getGestione(), row.getDataOrd(), row.getNumOrd())).collect(Collectors.toList());
|
||||
|
||||
for (DtbOrdtKey key : ordiniDaPubblicare) {
|
||||
DtbOrdt ordt = new DtbOrdt(key.getGestione(), UtilityLocalDate.localDateFromDate(key.getDataOrd()), key.getNumOrd());
|
||||
ordt.setOperation(OperationType.SELECT_OBJECT);
|
||||
entityProcessor.processEntity(ordt, true, multiDBTransactionManager);
|
||||
|
||||
GtbAnag anag = new GtbAnag();
|
||||
anag.setCodAnag(ordt.getCodAnag())
|
||||
.setOperation(OperationType.SELECT_OBJECT);
|
||||
entityProcessor.processEntity(anag, true, multiDBTransactionManager);
|
||||
VtbClie clie = new VtbClie();
|
||||
clie.setCodAnag(ordt.getCodAnag())
|
||||
.setOperation(OperationType.SELECT_OBJECT);
|
||||
entityProcessor.processEntity(clie, true, multiDBTransactionManager);
|
||||
anag.setOperation(OperationType.INSERT_OR_UPDATE);
|
||||
clie.setOperation(OperationType.INSERT_OR_UPDATE);
|
||||
anag.setVtbClie(clie);
|
||||
entityProcessor.processEntity(anag, true, multiDBTransactionManager);
|
||||
|
||||
ordt.setOperation(OperationType.INSERT_OR_UPDATE);
|
||||
ordt.getDtbOrdr().addAll(righeOrdiniDaPubblicare.stream().filter(row -> key.equals(new DtbOrdtKey(row.getGestione(), row.getDataOrd(), row.getNumOrd()))).collect(Collectors.toList()));
|
||||
entityProcessor.processEntity(ordt, true, multiDBTransactionManager);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ public class DocumentiProdDaFabbDTO {
|
||||
|
||||
private String generaScarico;
|
||||
|
||||
private String generaCaricoMatricola;
|
||||
private String chiudiCommessaSenzaMatricola;
|
||||
|
||||
public String getGestione() {
|
||||
return gestione;
|
||||
@@ -97,11 +97,11 @@ public class DocumentiProdDaFabbDTO {
|
||||
this.generaScarico = generaScarico;
|
||||
}
|
||||
|
||||
public String getGeneraCaricoMatricola() {
|
||||
return generaCaricoMatricola;
|
||||
public String getChiudiCommessaSenzaMatricola() {
|
||||
return chiudiCommessaSenzaMatricola;
|
||||
}
|
||||
|
||||
public void setGeneraCaricoMatricola(String generaCaricoMatricola) {
|
||||
this.generaCaricoMatricola = generaCaricoMatricola;
|
||||
public void setChiudiCommessaSenzaMatricola(String chiudiCommessaSenzaMatricola) {
|
||||
this.chiudiCommessaSenzaMatricola = chiudiCommessaSenzaMatricola;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -349,7 +349,7 @@ public class DocumentiProdDaFabb {
|
||||
/*Per il momento devono poter scegliere da WINGEST*/
|
||||
/*String generaCaricProdPadre = setupGest.getImportSetup(connect, type, format, "GENERA_CARICO_PROD_PADRE");*/
|
||||
|
||||
String generaCaricProdPadre = ordini.get(0).getGeneraCaricoMatricola();
|
||||
/*String generaCaricProdPadre = ordini.get(0).getChiudiCommessaSenzaMatricola();*/
|
||||
|
||||
|
||||
if (!ordini.isEmpty()) {
|
||||
@@ -388,7 +388,7 @@ public class DocumentiProdDaFabb {
|
||||
|
||||
if (index == 1) {
|
||||
// Creazione testata documento di carico
|
||||
if (generaCaricProdPadre.equals("S")){
|
||||
/*if (generaCaricProdPadre.equals("S")){
|
||||
docCar = new DtbDoct();
|
||||
docCar.setOperation(OperationType.INSERT);
|
||||
docCar.setCodDtip(codDtipCar);
|
||||
@@ -413,7 +413,7 @@ public class DocumentiProdDaFabb {
|
||||
docRCar.setRigaOrd(0);
|
||||
docRCar.setMatricola(riga.getMatricola());
|
||||
docCar.getDtbDocr().add(docRCar);
|
||||
}
|
||||
}*/
|
||||
|
||||
// ----------------------------
|
||||
// Gestione giroconto
|
||||
|
||||
@@ -2187,7 +2187,7 @@ public class DocumentService {
|
||||
" INNER JOIN stb_tipi_indirizzi ON stb_tipi_indirizzi.tipo_indirizzo = vtb_clie_pers_rif.tipo_indirizzo\n" +
|
||||
"WHERE tipo_documento = %s\n" +
|
||||
" AND cod_anag = %s\n" +
|
||||
" AND stb_tipi_indirizzi.tipo_indirizzo = 'UFFICIO ACQUISTI'\n" +
|
||||
" AND stb_tipi_indirizzi.tipo_indirizzo = 'PUNTO VENDITA'\n" +
|
||||
" AND ((:codVdes IS NULL AND cod_vdes IS NULL) OR (:codVdes IS NOT NULL AND ISNULL(cod_vdes, :codVdes) = :codVdes))",
|
||||
codDtip, printDocumentRequest.getCodAnag()
|
||||
).replace(":codVdes", UtilityDB.valueToString(codVdes));
|
||||
|
||||
@@ -395,7 +395,7 @@ public class ConSegnaService {
|
||||
" INNER JOIN stb_tipi_indirizzi ON stb_tipi_indirizzi.tipo_indirizzo = vtb_clie_pers_rif.tipo_indirizzo\n" +
|
||||
"WHERE tipo_documento = %s\n" +
|
||||
" AND cod_anag = %s\n" +
|
||||
" AND stb_tipi_indirizzi.tipo_indirizzo = 'UFFICIO ACQUISTI'\n" +
|
||||
" AND stb_tipi_indirizzi.tipo_indirizzo IN ('PUNTO VENDITA', 'UFFICIO ACQUISTI')\n" +
|
||||
" AND ((:codVdes IS NULL AND cod_vdes IS NULL) OR (:codVdes IS NOT NULL AND ISNULL(cod_vdes, :codVdes) = :codVdes))",
|
||||
datiConsegna.getCodDtip(), datiConsegna.getCodAnag()
|
||||
).replace(":codVdes", UtilityDB.valueToString(datiConsegna.getCodVdes()));
|
||||
|
||||
@@ -46,19 +46,6 @@ public class DepositiService {
|
||||
.setOperation(OperationType.UPDATE));
|
||||
entityToSave.addAll(jrlFasePosizionis);
|
||||
}
|
||||
sql = String.format(
|
||||
"SELECT cod_cmac, cod_mdep, posizione FROM ctb_amac WHERE posizione IN (%s)",
|
||||
UtilityDB.listValueToString(posizioni));
|
||||
|
||||
List<CtbAmac> ctbAmacs = UtilityDB.executeSimpleQueryDTO(multiDBTransactionManager.getPrimaryConnection(), sql, CtbAmac.class);
|
||||
|
||||
if (ctbAmacs != null) {
|
||||
ctbAmacs.forEach(x ->
|
||||
x
|
||||
.setCodMdep(mtbDepo.getCodMdep())
|
||||
.setOperation(OperationType.UPDATE));
|
||||
entityToSave.addAll(ctbAmacs);
|
||||
}
|
||||
}
|
||||
|
||||
List<String> aree = mtbDepo.getMtbDepoArea().stream().map(x -> x.getCodArea()).collect(Collectors.toList());
|
||||
|
||||
@@ -15,6 +15,7 @@ import it.integry.ems_model.entity.DtbDocr;
|
||||
import it.integry.ems_model.entity.DtbDoct;
|
||||
import it.integry.ems_model.entity.MtbInvenr;
|
||||
import it.integry.ems_model.entity.MtbInvent;
|
||||
import it.integry.ems_model.entity._enum.ListinoEnum;
|
||||
import it.integry.ems_model.resolver.SqlFieldHolder;
|
||||
import it.integry.ems_model.service.SetupGest;
|
||||
import it.integry.ems_model.types.ApplicationName;
|
||||
@@ -954,7 +955,8 @@ public class InventarioService {
|
||||
" mtb_invent.data_ver, " +
|
||||
" DateAdd(dd, (case when flag_operazione = 0 then -1 else 0 end), mtb_invent.data_inventario) as data_reg, " +
|
||||
" mtb_depo.cod_anag, " +
|
||||
" mtb_depo.cod_vdes " +
|
||||
" mtb_depo.cod_vdes, " +
|
||||
" regola_calcolo_costo " +
|
||||
" FROM mtb_invent inner join mtb_depo on mtb_invent.cod_mdep = mtb_depo.cod_mdep ";
|
||||
query = UtilityDB.addwhereCond(query, whereCondInv, false);
|
||||
|
||||
@@ -966,6 +968,7 @@ public class InventarioService {
|
||||
LocalDate dataRegMax = UtilityLocalDate.localDateFromDate(UtilityHashMap.getValueIfExists(datiInv, "data_reg"));
|
||||
String codAnagDepo = UtilityHashMap.getValueIfExists(datiInv, "cod_anag");
|
||||
String codVdesDepo = UtilityHashMap.getValueIfExists(datiInv, "cod_vdes");
|
||||
String regolaCalcoloCosto = UtilityHashMap.getValueIfExists(datiInv, "regola_calcolo_costo");
|
||||
|
||||
LocalDate dataDoc = UtilityLocalDate.isNull(datiDoc.getDataDoc(), dataRegMax);
|
||||
|
||||
@@ -1000,6 +1003,19 @@ public class InventarioService {
|
||||
throw new Exception("Attenzione sono stati inseriti/modificati dei documenti dopo la verifica dell'inventario. Prima di registrare questo inventario rifare la verifica.");
|
||||
}
|
||||
|
||||
String listino = null;
|
||||
switch (regolaCalcoloCosto) {
|
||||
case "M":
|
||||
listino = ListinoEnum.COSTO_MEDIO.getValue();
|
||||
break;
|
||||
case "D":
|
||||
listino = ListinoEnum.DISTINTA.getValue();
|
||||
break;
|
||||
default:
|
||||
listino = ListinoEnum.COSTO_ULTIMO.getValue();
|
||||
break;
|
||||
}
|
||||
|
||||
DtbDoct dtbDoct = new DtbDoct()
|
||||
.setGestione(gestione)
|
||||
.setCodMdep(codMdep)
|
||||
@@ -1008,7 +1024,8 @@ public class InventarioService {
|
||||
.setCodVdes(codVdes)
|
||||
.setDataDoc(dataDoc)
|
||||
.setSerDoc(datiDoc.getSerDoc())
|
||||
.setDataReg(dataDoc);
|
||||
.setDataReg(dataDoc)
|
||||
.setListino(listino);
|
||||
dtbDoct.setOperation(OperationType.INSERT);
|
||||
dtbDoct.setDtbDocr(new ArrayList<>());
|
||||
|
||||
@@ -1022,7 +1039,8 @@ public class InventarioService {
|
||||
" mtb_invenr.costo_inv, " +
|
||||
" Convert(numeric(15,5), num_conf - giacenza_conf ) as num_conf, " +
|
||||
" mtb_invent.tipo_giacenza, " +
|
||||
" mtb_aart.flag_qta_cnf_fissa " +
|
||||
" mtb_aart.flag_qta_cnf_fissa, " +
|
||||
" mtb_aart.unt_mis " +
|
||||
" FROM mtb_invent INNER JOIN mtb_invenr ON mtb_invent.id_inventario = mtb_invenr.id_inventario and " +
|
||||
" mtb_invent.cod_mdep = mtb_invenr.cod_mdep " +
|
||||
" LEFT OUTER JOIN mtb_aart ON mtb_invenr.cod_mart = mtb_aart.cod_mart " +
|
||||
@@ -1045,6 +1063,7 @@ public class InventarioService {
|
||||
BigDecimal numConf = UtilityHashMap.getValueIfExists(riga, "num_conf");
|
||||
String tipoGiacenza = UtilityHashMap.getValueIfExists(riga, "tipo_giacenza");
|
||||
String flagQtaCnfFissa = UtilityHashMap.getValueIfExists(riga, "flag_qta_cnf_fissa");
|
||||
String untMis = UtilityHashMap.getValueIfExists(riga, "unt_mis");
|
||||
qtaDoc = qtaDoc.multiply(segno);
|
||||
if (numConf != null) numConf = numConf.multiply(segno);
|
||||
|
||||
@@ -1055,7 +1074,9 @@ public class InventarioService {
|
||||
.setCodCol(codCol)
|
||||
.setCodTagl(codTagl)
|
||||
.setQtaDoc(qtaDoc)
|
||||
.setNumCnf(numConf);
|
||||
.setNumCnf(numConf)
|
||||
.setUntMis(untMis)
|
||||
.setRapConv(BigDecimal.ONE);
|
||||
if (numConf != null && numConf.compareTo(BigDecimal.ZERO) == 0 && flagQtaCnfFissa.equalsIgnoreCase("N")) {
|
||||
dtbDocr.setQtaCnf(null);
|
||||
} else if (tipoGiacenza.compareTo("LI") == 0) {
|
||||
@@ -1068,7 +1089,7 @@ public class InventarioService {
|
||||
dtbDocr.setNumCnf(numConf);
|
||||
dtbDocr.setQtaCnf(qtaCnf);
|
||||
} else {
|
||||
dtbDocr.setLoadedFromDb(true);
|
||||
dtbDocr.setLoadedFromDb(true);
|
||||
}
|
||||
|
||||
if ("V".equals(gestione)) {
|
||||
|
||||
@@ -421,33 +421,46 @@ public class Slim2kLogisticService {
|
||||
);
|
||||
|
||||
List<MtbPartitaMag> listaPartita = UtilityDB.executeSimpleQueryDTO(multiDBTransactionManager.getPrimaryConnection(), q, MtbPartitaMag.class);
|
||||
|
||||
Optional<MtbPartitaMag> first = listaPartita.stream().filter(x -> x.getDataScad().equals(dataScad)).findFirst();
|
||||
|
||||
MtbPartitaMag mtbPartitaMag;
|
||||
if (first.isPresent()) {
|
||||
mtbPartitaMag = first.get();
|
||||
if (listaPartita == null || listaPartita.isEmpty()) {
|
||||
mtbPartitaMag = new MtbPartitaMag()
|
||||
.setCodMart(codMart)
|
||||
.setPartitaMag(partitaMag)
|
||||
.setDataScad(dataScad)
|
||||
.setPartitaMagProd(partitaMag);
|
||||
mtbPartitaMag.setOperation(OperationType.INSERT);
|
||||
} else {
|
||||
String lastPartitaMag = listaPartita.stream()
|
||||
.max(Comparator.comparing(MtbPartitaMag::getPartitaMag))
|
||||
.map(x -> x.getPartitaMag())
|
||||
.orElse(null);
|
||||
Optional<MtbPartitaMag> first = listaPartita.stream().filter(x -> x.getDataScad() == null || x.getDataScad().equals(dataScad)).findFirst();
|
||||
|
||||
String id = lastPartitaMag.substring(partitaMag.length());
|
||||
if (UtilityString.isNullOrEmpty(id)) {
|
||||
id = "1";
|
||||
|
||||
if (first.isPresent()) {
|
||||
mtbPartitaMag = first.get();
|
||||
if (mtbPartitaMag.getDataScad() == null) {
|
||||
mtbPartitaMag.setDataScad(dataScad);
|
||||
mtbPartitaMag.setOperation(OperationType.UPDATE);
|
||||
}
|
||||
} else {
|
||||
id = Integer.toString(Integer.parseInt(id) + 1);
|
||||
String lastPartitaMag = listaPartita.stream()
|
||||
.max(Comparator.comparing(MtbPartitaMag::getPartitaMag))
|
||||
.map(x -> x.getPartitaMag())
|
||||
.orElse(null);
|
||||
|
||||
String id = lastPartitaMag.substring(partitaMag.length());
|
||||
if (UtilityString.isNullOrEmpty(id)) {
|
||||
id = "1";
|
||||
} else {
|
||||
id = Integer.toString(Integer.parseInt(id) + 1);
|
||||
}
|
||||
|
||||
String partitaMagNew = partitaMag + "_" + id;
|
||||
|
||||
mtbPartitaMag = new MtbPartitaMag()
|
||||
.setCodMart(codMart)
|
||||
.setPartitaMag(partitaMagNew)
|
||||
.setDataScad(dataScad)
|
||||
.setPartitaMagProd(partitaMag);
|
||||
mtbPartitaMag.setOperation(OperationType.INSERT);
|
||||
}
|
||||
|
||||
String partitaMagNew = partitaMag + "_" + id;
|
||||
|
||||
mtbPartitaMag = new MtbPartitaMag()
|
||||
.setCodMart(codMart)
|
||||
.setPartitaMag(partitaMagNew)
|
||||
.setDataScad(dataScad)
|
||||
.setPartitaMagProd(partitaMag);
|
||||
mtbPartitaMag.setOperation(OperationType.INSERT);
|
||||
}
|
||||
return mtbPartitaMag;
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ public class OrdiniImporter extends BaseEntityImporter<List<EntityBase>> impleme
|
||||
OrdiniImportService ordiniImportService = getContextBean(OrdiniImportService.class);
|
||||
|
||||
for (DialogoJsonDTO dto: dialogoJsonDTO) {
|
||||
result.add(ordiniImportService.importOrdineDialogo(dto, type, format));
|
||||
result.add(ordiniImportService.importOrdineTuidi(dto, type, format));
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ public class OrdiniImportService {
|
||||
private GeocodingService geocodingService;
|
||||
|
||||
|
||||
public EntityBase importOrdineDialogo(DialogoJsonDTO dialogoJsonDTO, String type, String format) throws Exception {
|
||||
public EntityBase importOrdineTuidi(DialogoJsonDTO dialogoJsonDTO, String type, String format) throws Exception {
|
||||
boolean isAcquisto = dialogoJsonDTO.getFornitore() != null;
|
||||
|
||||
String sql = (
|
||||
|
||||
@@ -286,7 +286,7 @@ public class OrdifyService {
|
||||
ctbPart.setCodAnag(docSospeso.getCodAnag());
|
||||
ctbPart.setTipoAnag("C");
|
||||
ctbPart.setAnnoPart(dataDoc.get(Calendar.YEAR));
|
||||
ctbPart.setDataDoc(dataDoc.getTime());
|
||||
ctbPart.setDataDoc(UtilityLocalDate.localDateFromDate(dataDoc.getTime()));
|
||||
ctbPart.setSerDoc(docSospeso.getSerDoc());
|
||||
ctbPart.setNumDoc(docSospeso.getNumDoc());
|
||||
ctbPart.setFlagVerificata("S");
|
||||
|
||||
@@ -12,6 +12,7 @@ import it.integry.ems_model.entity.DtbOrdr;
|
||||
import it.integry.ems_model.entity.DtbOrdt;
|
||||
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.stereotype.Service;
|
||||
@@ -56,8 +57,13 @@ public class OrdiniVSlim2kService {
|
||||
articoli.add(datiArt);
|
||||
qtaCnf = (BigDecimal) datiArt.get("qta_cnf");
|
||||
}
|
||||
dtbOrdr.setQtaCnf(qtaCnf)
|
||||
.setQtaOrd(dtbOrdr.getNumCnf().multiply(qtaCnf));
|
||||
|
||||
dtbOrdr.setQtaCnf(qtaCnf);
|
||||
if (UtilityBigDecimal.isNullOrZero(dtbOrdr.getNumCnf())) {
|
||||
dtbOrdr.setNumCnf(dtbOrdr.getQtaOrd().divide(qtaCnf));
|
||||
} else {
|
||||
dtbOrdr.setQtaOrd(dtbOrdr.getNumCnf().multiply(qtaCnf));
|
||||
}
|
||||
dtbOrdr.setOperation(OperationType.UPDATE);
|
||||
ord.getDtbOrdr().add(dtbOrdr);
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.lang.reflect.Method;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@@ -50,7 +51,7 @@ public class ListiniVenditaArticoliEquivalentiController {
|
||||
ServiceRestResponse allinemanetoPrezziArtEqui(
|
||||
HttpServletRequest request,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String configuration,
|
||||
@RequestParam Date dataValidita,
|
||||
@RequestParam LocalDate dataValidita,
|
||||
@RequestBody (required = false) ListiniVenditaAllinePrezziDTO input) {
|
||||
|
||||
try {
|
||||
|
||||
@@ -14,7 +14,10 @@ import it.integry.ems.status.ServiceChecker;
|
||||
import it.integry.ems.utility.UtilityEntity;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import it.integry.ems_model.entity.MtbLisvData;
|
||||
import it.integry.ems_model.entity.VtbList;
|
||||
import it.integry.ems_model.utility.UtilityDate;
|
||||
import it.integry.ems_model.utility.UtilityLocalDate;
|
||||
import it.integry.ems_model.utility.UtilityString;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -23,8 +26,12 @@ import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.lang.reflect.Method;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@RestController
|
||||
@Scope(value = "request")
|
||||
@@ -40,7 +47,7 @@ public class ListiniVenditaController {
|
||||
@Autowired
|
||||
Lisv4LisaService lisv4LisaService;
|
||||
|
||||
@RequestMapping(value = "status", method = RequestMethod.GET)
|
||||
@GetMapping(value = "status")
|
||||
public @ResponseBody
|
||||
List<StatusResponse> status(HttpServletRequest request) {
|
||||
|
||||
@@ -49,7 +56,7 @@ public class ListiniVenditaController {
|
||||
return serviceChecker.getServiceStatus(methods, clazz);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "duplica-promozioni", method = RequestMethod.POST)
|
||||
@PostMapping(value = "duplica-promozioni")
|
||||
public @ResponseBody
|
||||
ServiceRestResponse duplicaPromoVend(HttpServletRequest request,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String configuration,
|
||||
@@ -60,19 +67,19 @@ public class ListiniVenditaController {
|
||||
return ServiceRestResponse.createEntityPositiveResponse(listiniVenditaServices.duplicaPromozione(codVlis, versione, whereCondLisv));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "consolida-variazioni", method = RequestMethod.POST)
|
||||
@PostMapping(value = "consolida-variazioni")
|
||||
public @ResponseBody
|
||||
ServiceRestResponse consolidaListinoVend(HttpServletRequest request,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String configuration,
|
||||
@RequestParam("dataVar") String dataVar,
|
||||
@RequestParam(value = "whereCond", required = false) String whereCondLisv) throws Exception {
|
||||
|
||||
Date dataValidita = UtilityDate.RecognizeDate(dataVar);
|
||||
LocalDate dataValidita = UtilityString.parseLocalDate(dataVar);
|
||||
listiniVenditaServices.consolidaListinoVend(dataValidita, whereCondLisv);
|
||||
return ServiceRestResponse.createPositiveResponse();
|
||||
}
|
||||
|
||||
@RequestMapping(value = "update", method = RequestMethod.POST)
|
||||
@PostMapping(value = "update")
|
||||
public @ResponseBody
|
||||
ServiceRestResponse updateLisv(HttpServletRequest request,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String configuration,
|
||||
@@ -81,7 +88,7 @@ public class ListiniVenditaController {
|
||||
return ServiceRestResponse.createEntityPositiveResponse(listiniVenditaServices.updateLisv(entityList, true));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "duplica", method = RequestMethod.POST)
|
||||
@PostMapping(value = "duplica")
|
||||
public @ResponseBody
|
||||
List<ServiceRestResponse> duplicaListino(@RequestBody DuplicaListinoDTO duplicaListinoDTO) throws Exception {
|
||||
|
||||
@@ -89,25 +96,25 @@ public class ListiniVenditaController {
|
||||
return UtilityEntity.toServiceRestResponse(entities);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "insertPromo", method = RequestMethod.POST)
|
||||
@PostMapping(value = "insertPromo")
|
||||
public ServiceRestResponse insertPromo(@RequestParam(CommonConstants.PROFILE_DB) String config,
|
||||
@RequestBody InsertPromoRequestDTO insertPromoRequest) throws Exception {
|
||||
|
||||
InsertPromoResponseDTO response = listiniVenditaServices.InsertPromo(insertPromoRequest);
|
||||
InsertPromoResponseDTO response = listiniVenditaServices.insertPromo(insertPromoRequest);
|
||||
|
||||
return ServiceRestResponse.createPositiveResponse(
|
||||
response.getEntityBases()
|
||||
).setMessagesFromAnomalie(response.getAnomalie());
|
||||
}
|
||||
|
||||
@RequestMapping(value = "insertVariazioni", method = RequestMethod.POST)
|
||||
@PostMapping(value = "insertVariazioni")
|
||||
public ServiceRestResponse insertVariazioni(@RequestParam(CommonConstants.PROFILE_DB) String config,
|
||||
@RequestBody InsertVariazioniRequestDTO insertVariazioniRequestDTO) throws Exception {
|
||||
|
||||
return ServiceRestResponse.createPositiveResponse(listiniVenditaServices.inserisciVariazioni(insertVariazioniRequestDTO));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "aggiorna4Lisa", method = RequestMethod.POST)
|
||||
@PostMapping(value = "aggiorna4Lisa")
|
||||
public @ResponseBody
|
||||
ServiceRestResponse aggiorna4Lisa(@RequestParam(CommonConstants.PROFILE_DB) String configuration,
|
||||
@RequestParam (required = false) boolean headless,
|
||||
@@ -115,5 +122,19 @@ public class ListiniVenditaController {
|
||||
return ServiceRestResponse.createPositiveResponse(lisv4LisaService.importAggiornaLisv(lisv4LisaDTO, headless));
|
||||
|
||||
}
|
||||
|
||||
@GetMapping(value = "tipoUm")
|
||||
public @ResponseBody
|
||||
ServiceRestResponse getTipoUm() {
|
||||
List<HashMap<Object, Object>> list = Arrays.stream(VtbList.TipoUm.values())
|
||||
.map(e -> {
|
||||
HashMap<Object, Object> m = new HashMap<>();
|
||||
m.put("valore", e.getValue());
|
||||
m.put("chiave", e.name());
|
||||
return m;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
return ServiceRestResponse.createPositiveResponse(list);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.lang.reflect.Method;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
@@ -158,7 +159,7 @@ public class ProductController {
|
||||
@RequestParam(value = "codVlisNew") String codVlisNew,
|
||||
@RequestParam(value = "includiOrdini") String includiOrdini,
|
||||
@RequestParam(value = "cancellaArticoli") String cancellaArticoli,
|
||||
@RequestParam(value = "dataValidita") Date dataValidita) {
|
||||
@RequestParam(value = "dataValidita") LocalDate dataValidita) {
|
||||
|
||||
List<ServiceRestResponse> respList = new ArrayList<ServiceRestResponse>();
|
||||
try {
|
||||
|
||||
@@ -8,7 +8,7 @@ import java.util.Date;
|
||||
public class DuplicaListinoDTO {
|
||||
private String newCodVlis;
|
||||
private String newDescrizione;
|
||||
private Date newDataIniz;
|
||||
private LocalDate newDataIniz;
|
||||
private String newCodDivi;
|
||||
private VtbListData listino;
|
||||
private LocalDate dataValidita;
|
||||
@@ -31,11 +31,11 @@ public class DuplicaListinoDTO {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getNewDataIniz() {
|
||||
public LocalDate getNewDataIniz() {
|
||||
return newDataIniz;
|
||||
}
|
||||
|
||||
public DuplicaListinoDTO setNewDataIniz(Date newDataIniz) {
|
||||
public DuplicaListinoDTO setNewDataIniz(LocalDate newDataIniz) {
|
||||
this.newDataIniz = newDataIniz;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -12,6 +12,8 @@ import it.integry.ems_model.types.OperationType;
|
||||
import org.springframework.web.context.ContextLoader;
|
||||
import org.springframework.web.context.WebApplicationContext;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@@ -54,7 +56,7 @@ public class ListiniVenditaExporter extends BaseEntityExporter implements IEntit
|
||||
|
||||
|
||||
for (VtbListData vtbListData : vtbListDataList) {
|
||||
vtbListData.setDataTrasmissione(new Date());
|
||||
vtbListData.setDataTrasmissione(LocalDateTime.now());
|
||||
vtbListData.setMtbLisvData(new ArrayList<>());
|
||||
vtbListData.setOperation(OperationType.UPDATE);
|
||||
entityList.add(vtbListData);
|
||||
|
||||
@@ -588,7 +588,7 @@ public class ImportAnagListiniService {
|
||||
|
||||
|
||||
} else if ((entityList.get(0) instanceof MtbLisvData) || (entityList.get(0) instanceof MtbLisvDataSpese)) {
|
||||
VtbListData vtbListData = getVtbListData(conn, entityList.get(0), entityList);
|
||||
EntityBase vtbListData = getVtbListData(conn, entityList.get(0), entityList);
|
||||
entitySave.add(vtbListData);
|
||||
} else if ((entityList.get(0) instanceof MtbLisa)) {
|
||||
codAlis = ((MtbLisa) entityList.get(0)).getCodAlis();
|
||||
@@ -802,76 +802,81 @@ public class ImportAnagListiniService {
|
||||
return tableName;
|
||||
}
|
||||
|
||||
private VtbListData getVtbListData(Connection conn, EntityBase entityBase, List<EntityBase> entityList) throws Exception {
|
||||
VtbListData vtbListData;
|
||||
private EntityBase getVtbListData(Connection conn, EntityBase entityBase, List<EntityBase> entityList) throws Exception {
|
||||
VtbListData vtbListData = null;
|
||||
VtbList vtbList = null;
|
||||
if (entityBase instanceof MtbLisvData) {
|
||||
vtbListData =
|
||||
new VtbListData()
|
||||
.setCodVlis(((MtbLisvData) entityBase).getCodVlis())
|
||||
.setDataIniz(((MtbLisvData) entityBase).getDataIniz())
|
||||
.setDataFine(((MtbLisvData) entityBase).getDataFine())
|
||||
.setCodPromo(((MtbLisvData) entityBase).getCodPromo())
|
||||
.setVersione(((MtbLisvData) entityBase).getVersione())
|
||||
.setNote(((MtbLisvData) entityBase).getNoteLisv())
|
||||
.setDescrPromo(((MtbLisvData) entityBase).getDescrPromo());
|
||||
MtbLisvData lisvData = (MtbLisvData) entityBase;
|
||||
if (lisvData.getVersione() == null && lisvData.getDataIniz() == null) {
|
||||
vtbList =
|
||||
new VtbList()
|
||||
.setCodVlis(lisvData.getCodVlis());
|
||||
|
||||
String queryLisvRif =
|
||||
"SELECT cod_vlis, " +
|
||||
UtilityDB.valueDateToString(((MtbLisvData) entityBase).getDataIniz(), CommonConstants.DATE_FORMAT_YMD_DASHED) + " as data_iniz, " +
|
||||
UtilityDB.valueDateToString(((MtbLisvData) entityBase).getDataFine(), CommonConstants.DATE_FORMAT_YMD_DASHED) + " as data_fine, " +
|
||||
"Cast(" + UtilityDB.valueToString(((MtbLisvData) entityBase).getCodPromo()) + " as varchar) as cod_promo, " +
|
||||
"Cast(" + UtilityDB.valueToString(((MtbLisvData) entityBase).getNote()) + " as varchar) as note "
|
||||
+ "FROM vtb_list "
|
||||
+ "WHERE cod_vlis_rif = " + UtilityDB.valueToString(((MtbLisvData) entityBase).getCodVlis()) + " AND "
|
||||
+ "flag_attivo = 'S'";
|
||||
MtbLisv mtbLisv = new MtbLisv()
|
||||
.setCodMart(lisvData.getCodMart());
|
||||
mtbLisv.setOperation(lisvData.getOperation());
|
||||
vtbList.getMtbLisv().add(mtbLisv);
|
||||
entityList.remove(lisvData);
|
||||
} else {
|
||||
vtbListData =
|
||||
new VtbListData()
|
||||
.setCodVlis(lisvData.getCodVlis())
|
||||
.setDataIniz(lisvData.getDataIniz())
|
||||
.setDataFine(lisvData.getDataFine())
|
||||
.setCodPromo(lisvData.getCodPromo())
|
||||
.setVersione(lisvData.getVersione())
|
||||
.setNote(lisvData.getNoteLisv())
|
||||
.setDescrPromo(lisvData.getDescrPromo());
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(((MtbLisvData) entityBase).getElencoLisvRif())) {
|
||||
queryLisvRif += " AND vtb_list.cod_vlis in (" + ((MtbLisvData) entityBase).getElencoLisvRif() + ")";
|
||||
String queryLisvRif =
|
||||
"SELECT cod_vlis, " +
|
||||
UtilityDB.valueToString(lisvData.getDataIniz()) + " as data_iniz, " +
|
||||
UtilityDB.valueToString(lisvData.getDataFine()) + " as data_fine, " +
|
||||
"Cast(" + UtilityDB.valueToString(lisvData.getCodPromo()) + " as varchar) as cod_promo, " +
|
||||
"Cast(" + UtilityDB.valueToString(lisvData.getNote()) + " as varchar) as note "
|
||||
+ "FROM vtb_list "
|
||||
+ "WHERE cod_vlis_rif = " + UtilityDB.valueToString(lisvData.getCodVlis()) + " AND "
|
||||
+ "flag_attivo = 'S'";
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(lisvData.getElencoLisvRif())) {
|
||||
queryLisvRif += " AND vtb_list.cod_vlis in (" + lisvData.getElencoLisvRif() + ")";
|
||||
}
|
||||
|
||||
List<VtbListData> listVtbLisvData = new ResultSetMapper()
|
||||
.mapQuerySetToList(conn, queryLisvRif, VtbListData.class, OperationType.INSERT_OR_UPDATE);
|
||||
vtbListData.setVtbListData(listVtbLisvData);
|
||||
|
||||
VtbListData finalVtbListData = vtbListData;
|
||||
List<MtbLisvData> mtbLisvData =
|
||||
Stream.of(entityList)
|
||||
.filter(y ->
|
||||
y instanceof MtbLisvData &&
|
||||
((MtbLisvData) y).getCodVlis().equalsIgnoreCase(finalVtbListData.getCodVlis()) &&
|
||||
Objects.equals(((MtbLisvData) y).getVersione(), finalVtbListData.getVersione()) &&
|
||||
Objects.equals(((MtbLisvData) y).getDataIniz(), finalVtbListData.getDataIniz()) &&
|
||||
Objects.equals(((MtbLisvData) y).getDataFine(), finalVtbListData.getDataFine()) &&
|
||||
Objects.equals(((MtbLisvData) y).getCodPromo(), finalVtbListData.getCodPromo()) &&
|
||||
Objects.equals(((MtbLisvData) y).getNoteLisv(), finalVtbListData.getNote())
|
||||
)
|
||||
.map(y -> (MtbLisvData) y)
|
||||
.toList();
|
||||
|
||||
entityList.removeAll(mtbLisvData);
|
||||
vtbListData.getMtbLisvData().addAll(mtbLisvData);
|
||||
|
||||
if (entityBase.getOperation() != OperationType.DELETE && entityBase.getOperation() != OperationType.UPDATE) {
|
||||
vtbListData.setVersione(null);
|
||||
}
|
||||
}
|
||||
|
||||
List<VtbListData> listVtbLisvData = new ResultSetMapper()
|
||||
.mapQuerySetToList(conn, queryLisvRif, VtbListData.class, OperationType.INSERT_OR_UPDATE);
|
||||
vtbListData.setVtbListData(listVtbLisvData);
|
||||
} else {
|
||||
|
||||
} else if (entityBase instanceof MtbLisvDataSpese) {
|
||||
vtbListData = new VtbListData()
|
||||
.setCodVlis(((MtbLisvDataSpese) entityBase).getCodVlis())
|
||||
.setDataIniz(((MtbLisvDataSpese) entityBase).getDataIniz())
|
||||
.setVersione(((MtbLisvDataSpese) entityBase).getVersione());
|
||||
}
|
||||
|
||||
OperationType operationLisv = entityBase.getOperation();
|
||||
if (operationLisv == null) {
|
||||
operationLisv = OperationType.INSERT_OR_UPDATE;
|
||||
} else if (operationLisv == OperationType.DELETE || operationLisv == OperationType.SUBSTITUTE || operationLisv == OperationType.DELETE_THEN_INSERT) {
|
||||
operationLisv = OperationType.NO_OP;
|
||||
}
|
||||
|
||||
vtbListData.setOperation(operationLisv);
|
||||
|
||||
if (entityBase instanceof MtbLisvData) {
|
||||
List<MtbLisvData> mtbLisvData =
|
||||
Stream.of(entityList)
|
||||
.filter(y ->
|
||||
y instanceof MtbLisvData &&
|
||||
((MtbLisvData) y).getCodVlis().equalsIgnoreCase(vtbListData.getCodVlis()) &&
|
||||
Objects.equals(((MtbLisvData) y).getVersione(), vtbListData.getVersione()) &&
|
||||
Objects.equals(((MtbLisvData) y).getDataIniz(), vtbListData.getDataIniz()) &&
|
||||
Objects.equals(((MtbLisvData) y).getDataFine(), vtbListData.getDataFine()) &&
|
||||
Objects.equals(((MtbLisvData) y).getCodPromo(), vtbListData.getCodPromo()) &&
|
||||
Objects.equals(((MtbLisvData) y).getNoteLisv(), vtbListData.getNote())
|
||||
)
|
||||
.map(y -> (MtbLisvData) y)
|
||||
.toList();
|
||||
|
||||
entityList.removeAll(mtbLisvData);
|
||||
vtbListData.getMtbLisvData().addAll(mtbLisvData);
|
||||
|
||||
if (entityBase.getOperation() != OperationType.DELETE && entityBase.getOperation() != OperationType.UPDATE) {
|
||||
vtbListData.setVersione(null);
|
||||
}
|
||||
}
|
||||
|
||||
if (entityBase instanceof MtbLisvDataSpese) {
|
||||
List<MtbLisvDataSpese> mtbLisvDataSpese =
|
||||
Stream.of(entityList)
|
||||
.filter(y ->
|
||||
@@ -889,10 +894,21 @@ public class ImportAnagListiniService {
|
||||
if (entityBase.getOperation() != OperationType.DELETE && entityBase.getOperation() != OperationType.UPDATE) {
|
||||
vtbListData.setVersione(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return vtbListData;
|
||||
if (vtbListData == null) {
|
||||
return vtbList;
|
||||
} else {
|
||||
OperationType operationLisv = entityBase.getOperation();
|
||||
if (operationLisv == null) {
|
||||
operationLisv = OperationType.INSERT_OR_UPDATE;
|
||||
} else if (operationLisv == OperationType.DELETE || operationLisv == OperationType.SUBSTITUTE || operationLisv == OperationType.DELETE_THEN_INSERT) {
|
||||
operationLisv = OperationType.NO_OP;
|
||||
}
|
||||
|
||||
vtbListData.setOperation(operationLisv);
|
||||
return vtbListData;
|
||||
}
|
||||
}
|
||||
|
||||
private List<VtbCompensiTdt> getVtbCompensiTdt(List<EntityBase> entityList) {
|
||||
|
||||
@@ -116,13 +116,13 @@ public class ImportImeService {
|
||||
Connection connMexal2Wingest = dsMexal2Wingest.getConnection();
|
||||
|
||||
LocalDate dataIniz = null;
|
||||
String dataInizLisv = new SimpleDateFormat(CommonConstants.DATE_FORMAT_YMD_DASHED).format(new Date());
|
||||
LocalDate dataInizLisv = LocalDate.now();
|
||||
sql = "SELECT max(data_iniz) as data_iniz FROM vtb_list_data WHERE cod_vlis = " + UtilityDB.valueToString(codVlis);
|
||||
|
||||
infoInternal = conn.prepareStatement(sql, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
|
||||
resInternal = infoInternal.executeQuery();
|
||||
while (resInternal.next()) {
|
||||
dataInizLisv = new SimpleDateFormat(CommonConstants.DATE_FORMAT_YMD_DASHED).format(resInternal.getDate("data_iniz"));
|
||||
dataInizLisv = UtilityLocalDate.localDateFromDate(resInternal.getDate("data_iniz"));
|
||||
}
|
||||
resInternal.close();
|
||||
infoInternal.close();
|
||||
@@ -563,7 +563,7 @@ public class ImportImeService {
|
||||
mtblisvData.setCodVlis(codVlis);
|
||||
mtblisvData.setUntMisVen(um1);
|
||||
mtblisvData.setRapConv(BigDecimal.ONE);
|
||||
mtblisvData.setDataIniz(UtilityDate.StringToDate(dataInizLisv, CommonConstants.DATE_FORMAT_YMD_DASHED));
|
||||
mtblisvData.setDataIniz(dataInizLisv);
|
||||
mtblisvData.setCodMart(codMart);
|
||||
mtblisvData.setPrzBase(przBase);
|
||||
mtblisvData.setRicarica(ricarico);
|
||||
|
||||
@@ -138,8 +138,8 @@ public class ImportListiniAcquistoService {
|
||||
AtbListData atbListData
|
||||
= new AtbListData()
|
||||
.setCodAlis(vtbListData.getCodVlis())
|
||||
.setDataIniz(UtilityLocalDate.localDateFromDate(vtbListData.getDataIniz()))
|
||||
.setDataFine(UtilityLocalDate.localDateFromDate(vtbListData.getDataFine()))
|
||||
.setDataIniz(vtbListData.getDataIniz())
|
||||
.setDataFine(vtbListData.getDataFine())
|
||||
.setCodPromo(vtbListData.getCodPromo())
|
||||
.setNote(vtbListData.getVersione() + (vtbListData.getNote()==null?"":" " + vtbListData.getNote()));
|
||||
atbListData.setOperation(OperationType.INSERT_OR_UPDATE);
|
||||
|
||||
@@ -38,6 +38,7 @@ import java.sql.ResultSet;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.DecimalFormatSymbols;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
@@ -62,7 +63,7 @@ public class ImportListiniVenditaService {
|
||||
private MailService mailService;
|
||||
|
||||
|
||||
public EntityBase importLisv4Griglia(String codVlis, String codMdep, String codVlisNew, String includiOrdini, String cancellaArticoli, Date dataValidita) throws Exception {
|
||||
public EntityBase importLisv4Griglia(String codVlis, String codMdep, String codVlisNew, String includiOrdini, String cancellaArticoli, LocalDate dataValidita) throws Exception {
|
||||
VtbListData vtbListData = new VtbListData();
|
||||
vtbListData.setCodVlis(codVlisNew);
|
||||
vtbListData.setDataIniz(dataValidita);
|
||||
@@ -106,7 +107,7 @@ public class ImportListiniVenditaService {
|
||||
+ " CASE WHEN " + UtilityDB.valueToString(cancellaArticoli) + " = 'S' THEN 'D' ELSE null END AS tipo_variazione "
|
||||
+ "FROM (SELECT "
|
||||
+ " cod_mart "
|
||||
+ " FROM dbo.getGrigliaAcquisto(" + UtilityDB.valueDateToString(dataValidita, CommonConstants.DATE_FORMAT_YMD_DASHED) + ", NULL, " + UtilityDB.valueToString(codMdep) + ", NULL, NULL) "
|
||||
+ " FROM dbo.getGrigliaAcquisto(" + UtilityDB.valueToString(dataValidita) + ", NULL, " + UtilityDB.valueToString(codMdep) + ", NULL, NULL) "
|
||||
+ " WHERE ((" + UtilityDB.valueToString(cancellaArticoli) + " = 'N' AND tipo_variazione <> 'D' ) OR "
|
||||
+ " (" + UtilityDB.valueToString(cancellaArticoli) + " = 'S' AND tipo_variazione <> 'D' )) "
|
||||
+ " UNION ALL "
|
||||
@@ -120,7 +121,7 @@ public class ImportListiniVenditaService {
|
||||
+ " AND dtb_ordt.cod_mdep = " + UtilityDB.valueToString(codMdep)
|
||||
+ " AND dtb_ordt.gestione = 'A' "
|
||||
+ " AND " + UtilityDB.valueToString(includiOrdini) + " = 'S' "
|
||||
+ " AND dtb_ordt.data_ord <= " + UtilityDB.valueDateToString(dataValidita, CommonConstants.DATE_FORMAT_YMD_DASHED)
|
||||
+ " AND dtb_ordt.data_ord <= " + UtilityDB.valueToString(dataValidita)
|
||||
+ " GROUP BY dtb_ordr.cod_mart) griglia "
|
||||
+ " INNER JOIN (SELECT "
|
||||
+ " mtb_aart.cod_mart, "
|
||||
@@ -139,7 +140,7 @@ public class ImportListiniVenditaService {
|
||||
+ " ON griglia.cod_mart = art_mov.cod_mart "
|
||||
+ " INNER JOIN (SELECT "
|
||||
+ " * "
|
||||
+ " FROM dbo.getListinoVendita(" + UtilityDB.valueDateToString(dataValidita, CommonConstants.DATE_FORMAT_YMD_DASHED) + ", " + UtilityDB.valueToString(codVlis) + ", NULL) "
|
||||
+ " FROM dbo.getListinoVendita(" + UtilityDB.valueToString(dataValidita) + ", " + UtilityDB.valueToString(codVlis) + ", NULL) "
|
||||
+ " WHERE tipo_variazione <> 'D') lisv "
|
||||
+ " ON art_mov.cod_mart_mov = lisv.cod_mart, "
|
||||
+ " mtb_aart "
|
||||
@@ -304,7 +305,7 @@ public class ImportListiniVenditaService {
|
||||
|
||||
public List<EntityBase> importListinoCarelli(String type, String format, ImportRequestDTO requestDTO, List<AnomalieDTO> anomalie, boolean headless) throws Exception {
|
||||
List<EntityBase> entityList = null;
|
||||
Date dataInizio = null, dataFine = null, localDate = new Date(), currentDataInizio = null, currentDataFine;
|
||||
LocalDate dataInizio = null, dataFine = null, currentDataInizio = null, currentDataFine;
|
||||
boolean areDatesEqual = true, isVolantino = format.equalsIgnoreCase(ListiniVenditaImporter.Format.VOLANTINI.toString());
|
||||
List<MtbLisvData> listMtbLisvData = new ArrayList<>();
|
||||
|
||||
@@ -338,14 +339,14 @@ public class ImportListiniVenditaService {
|
||||
String dataInizioString = dataInizioFine(true, row);
|
||||
String dataFineString = dataInizioFine(false, row);
|
||||
|
||||
SimpleDateFormat formatDate = new SimpleDateFormat("dd/MM/yyyy");
|
||||
String formatDate = "dd/MM/yyyy";
|
||||
|
||||
if (!dataInizioString.isEmpty()) {
|
||||
currentDataInizio = formatDate.parse(dataInizioString);
|
||||
currentDataInizio = UtilityString.parseLocalDate(dataInizioString, formatDate);
|
||||
|
||||
// Verifica che dataInizio sia maggiore di localDate
|
||||
if (currentDataInizio.compareTo(localDate) <= 0) {
|
||||
throw new Exception(String.format("La data di inizio è precedente o uguale alla data corrente. (Riga: %s)", row.getRowNum() + 1));
|
||||
if (currentDataInizio.isBefore(LocalDate.now()) ) {
|
||||
throw new Exception(String.format("La data di inizio è precedente. (Riga: %s)", row.getRowNum() + 1));
|
||||
}
|
||||
|
||||
// Controlla se la data di inizio è diversa dalla prima data
|
||||
@@ -361,7 +362,7 @@ public class ImportListiniVenditaService {
|
||||
}
|
||||
|
||||
if (!dataFineString.isEmpty()) {
|
||||
currentDataFine = formatDate.parse(dataFineString);
|
||||
currentDataFine = UtilityString.parseLocalDate(dataFineString, formatDate);
|
||||
|
||||
// Verifica che dataFine sia maggiore di dataInizio
|
||||
if (currentDataFine.compareTo(currentDataInizio) < 0) {
|
||||
@@ -387,7 +388,7 @@ public class ImportListiniVenditaService {
|
||||
"MAX_GG_PROMO"));
|
||||
|
||||
if (maxGiorni != 0) {
|
||||
int count = UtilityDate.DaysAfter(dataInizio, dataFine);
|
||||
long count = UtilityLocalDate.daysAfterDate(dataInizio, dataFine);
|
||||
if (count > maxGiorni) {
|
||||
throw new Exception(String.format("Differenza tra data inizio e data fine maggiore di: %s (Riga: %s)", maxGiorni, row.getRowNum() + 1));
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user