Merge branch 'master' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
# Conflicts: # ems-core/src/main/java/it/integry/ems/migration/model/Migration_20250917111031.java # ems-engine/src/main/java/it/integry/ems/retail/wms/lavorazione/dto/HistoryVersamentoULDTO.java # ems-engine/src/main/java/it/integry/ems/retail/wms/lavorazione/service/WMSMaterialiService.java
This commit is contained in:
@@ -49,7 +49,7 @@ public class RequestDataDTO {
|
||||
@PostConstruct
|
||||
public void init() throws IOException, InterruptedException {
|
||||
|
||||
if (request != null && request.getQueryString() != null && request.getQueryString().contains(CommonConstants.PROFILE_DB)) {
|
||||
if (request != null && request.getParameter(CommonConstants.PROFILE_DB) != null) {
|
||||
profileDB = request.getParameter(CommonConstants.PROFILE_DB);
|
||||
} else if (request != null && request.getHeader(CommonConstants.PROFILE_DB) != null) {
|
||||
profileDB = request.getHeader(CommonConstants.PROFILE_DB);
|
||||
|
||||
@@ -10,6 +10,7 @@ public class Migration_20250908160026 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS()) return;
|
||||
|
||||
createOrUpdateView("cvw_marg_contr_com", "CREATE VIEW [dbo].[cvw_marg_contr_com] (cod_jcom,descrizione,costo_lavorazione,costo_materiali,costo_servizi,altri_costi,ricavi,ore_lavorazione, data) AS \n" +
|
||||
"SELECT jtb_rlavr.cod_jcom AS cod_jcom,\n" +
|
||||
|
||||
@@ -10,6 +10,7 @@ public class Migration_20250909175525 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS()) return;
|
||||
|
||||
createOrUpdateTrigger("t_UpdProgMagaR", "CREATE TRIGGER [dbo].[t_UpdProgMagaR] ON [dbo].[dtb_ordr] \n" +
|
||||
"FOR UPDATE, DELETE, INSERT\n" +
|
||||
|
||||
@@ -10,6 +10,8 @@ public class Migration_20250910105805 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS()) return;
|
||||
|
||||
executeStatement(
|
||||
"ALTER TABLE dbo.vtb_offt\n" +
|
||||
" ADD CONSTRAINT vtb_offt_gtb_porto_porto_fk\n" +
|
||||
|
||||
@@ -10,6 +10,7 @@ public class Migration_20250911191115 extends BaseMigration implements Migration
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
if (isDMS()) return;
|
||||
|
||||
createOrUpdateFunction("getDettMatricoleDaOrdine", "CREATE Function [dbo].[getDettMatricoleDaOrdine] (@codJcom varchar(10)) \n" +
|
||||
"RETURNS @dettMatricole TABLE( cod_prod varchar(15),\n" +
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
import it.integry.ems_model.utility.dto.IndexTableDTO;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Migration_20250915091459 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
executeStatement("ALTER TABLE vtb_auto ADD costo_aci NUMERIC(20, 5)");
|
||||
|
||||
executeStatement("ALTER TABLE vtb_auto_km ADD id BIGINT IDENTITY NOT NULL");
|
||||
|
||||
executeStatement(
|
||||
"ALTER TABLE vtb_auto_km\n" +
|
||||
" ADD user_name VARCHAR(40) NULL,\n" +
|
||||
" luogo_destinazione VARCHAR(40) NULL,\n" +
|
||||
" km_percorsi NUMERIC(20,5) NOT NULL DEFAULT 0,\n" +
|
||||
" ora_partenza TIME NULL,\n" +
|
||||
" ora_arrivo TIME NULL,\n" +
|
||||
" note VARCHAR(MAX) NULL"
|
||||
);
|
||||
|
||||
executeStatement("ALTER TABLE vtb_auto_km DROP CONSTRAINT pk_vtb_auto_km");
|
||||
|
||||
executeStatement("ALTER TABLE vtb_auto_km ALTER COLUMN cod_vvet VARCHAR(5) NULL");
|
||||
|
||||
executeStatement("ALTER TABLE vtb_auto_km ADD CONSTRAINT pk_vtb_auto_km PRIMARY KEY (id)");
|
||||
|
||||
executeStatement("ALTER TABLE dbo.vtb_auto_km\n" +
|
||||
" ADD CONSTRAINT fk_vtb_auto_km_stb_user\n" +
|
||||
" FOREIGN KEY (User_name)\n" +
|
||||
" REFERENCES dbo.stb_user(User_name)");
|
||||
|
||||
List<IndexTableDTO.ColumnIndex> columnsIndex = new ArrayList<>();
|
||||
columnsIndex.add(new IndexTableDTO.ColumnIndex("cod_auto"));
|
||||
columnsIndex.add(new IndexTableDTO.ColumnIndex("cod_vvet"));
|
||||
columnsIndex.add(new IndexTableDTO.ColumnIndex("user_name"));
|
||||
columnsIndex.add(new IndexTableDTO.ColumnIndex("data_cons"));
|
||||
|
||||
createIndex(
|
||||
new IndexTableDTO()
|
||||
.setTableName("vtb_auto_km")
|
||||
.setIndexName("idx_vtb_auto_km_unique")
|
||||
.setColumnsIndex(columnsIndex)
|
||||
.setUnique(true)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20250915155856 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS()) return;
|
||||
|
||||
createOrUpdateFunction("getNumDoc4NumDocForn", "-- =============================================\n" +
|
||||
"-- Author: <Author,,Name>\n" +
|
||||
"-- Create date: <Create Date,,>\n" +
|
||||
"-- Description: <Description,,>\n" +
|
||||
"-- =============================================\n" +
|
||||
"CREATE FUNCTION getNumDoc4NumDocForn\n" +
|
||||
"( \n" +
|
||||
" @numdocOrig varchar(60), @annoComp varchar(4)\n" +
|
||||
")\n" +
|
||||
"\n" +
|
||||
"RETURNS @numTable TABLE \n" +
|
||||
"(\n" +
|
||||
" num_doc_orig varchar(max), num_doc int\n" +
|
||||
")\n" +
|
||||
"AS\n" +
|
||||
"BEGIN\n" +
|
||||
" \n" +
|
||||
" declare @sep varchar(5), @numDoc varchar(60), @rowc int\n" +
|
||||
"\n" +
|
||||
" select @numdocOrig = LTRIM(RTRIM(@numdocOrig))\n" +
|
||||
"\n" +
|
||||
" declare @tmpChar table (sep varchar(5));\n" +
|
||||
" declare @splitString table (numOrig varchar(60), numNew varchar(60), is_numeric int);\n" +
|
||||
"\n" +
|
||||
" SET @numdocOrig = REPLACE(@numdocOrig, '-', ',');\n" +
|
||||
" SET @numdocOrig = REPLACE(@numdocOrig, '.', ',');\n" +
|
||||
" SET @numdocOrig = REPLACE(@numdocOrig, ' ', ',');\n" +
|
||||
" SET @numdocOrig = REPLACE(@numdocOrig, '/', ',');\n" +
|
||||
" SET @numdocOrig = REPLACE(@numdocOrig, '\', ',');\n" +
|
||||
" \n" +
|
||||
" ;with tab_p as (\n" +
|
||||
" select value_string as num_new, \n" +
|
||||
" COUNT(*) over (partition by (select 1)) as tot_row, \n" +
|
||||
" ROW_NUMBER() over (order by (select 1)) as id,\n" +
|
||||
" LEN(value_string) as lunghezza\n" +
|
||||
" from dbo.parseStringIntoArray(@numdocOrig, ',')\n" +
|
||||
" where ISNUMERIC(value_string) = 1 )\n" +
|
||||
" \n" +
|
||||
" insert into @numTable\n" +
|
||||
" select @numdocOrig as num_doc_forn, cast(num_new as int ) as num_doc\n" +
|
||||
" from (\n" +
|
||||
" select * from tab_p ) t\n" +
|
||||
" where (tot_row = 1 or (tot_row > 1 AND \n" +
|
||||
" num_new <> cast(@annoComp as varchar) and\n" +
|
||||
" num_new <> cast(right(@annoComp,2) as varchar) )) \n" +
|
||||
" union all\n" +
|
||||
" select @numdocOrig, @numdocOrig\n" +
|
||||
" where not exists (select * from tab_p)\n" +
|
||||
" \n" +
|
||||
" \n" +
|
||||
"\n" +
|
||||
" RETURN \n" +
|
||||
"END");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
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_20250916122341 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
deleteSetup("w_ddocu_rc", "SETUP", "INVIO_EMAIL");
|
||||
|
||||
createSetup("w_vdocu_rc", "SETUP", "INVIO_EMAIL", "N",
|
||||
"Attiva invio email direttamente dalla gestione", false, "SI_NO", false, false,
|
||||
false, false, false, null, false, "SELECT 'S' UNION ALL SELECT 'N'");
|
||||
|
||||
createSetup("w_ldocu_rc", "SETUP", "INVIO_EMAIL", "N",
|
||||
"Attiva invio email direttamente dalla gestione", false, "SI_NO", false, false,
|
||||
false, false, false, null, false, "SELECT 'S' UNION ALL SELECT 'N'");
|
||||
|
||||
if (isCustomer(IntegryCustomer.RossoGargano))
|
||||
updateSetupValue("w_vdocu_rc", "SETUP", "INVIO_EMAIL", "S");
|
||||
|
||||
if (isCustomerDb(IntegryCustomerDB.Carelli_Chiuso))
|
||||
updateSetupValue("w_ldocu_rc", "SETUP", "INVIO_EMAIL", "S");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20250916163520 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS()) return;
|
||||
|
||||
createOrUpdateFunction("[getNumDoc4NumDocForn]", "-- =============================================\n" +
|
||||
"-- Author: <Author,,Name>\n" +
|
||||
"-- Create date: <Create Date,,>\n" +
|
||||
"-- Description: <Description,,>\n" +
|
||||
"-- =============================================\n" +
|
||||
"CREATE FUNCTION [dbo].[getNumDoc4NumDocForn]\n" +
|
||||
"( \n" +
|
||||
" @numdocorig varchar(60), @annoComp varchar(4)\n" +
|
||||
")\n" +
|
||||
"\n" +
|
||||
"RETURNS @numTable TABLE \n" +
|
||||
"(\n" +
|
||||
" num_doc_orig varchar(max), num_doc int\n" +
|
||||
")\n" +
|
||||
"AS\n" +
|
||||
"BEGIN\n" +
|
||||
" \n" +
|
||||
" declare @sep varchar(5), @numDoc varchar(60), @rowc int, @numDocForn varchar(60)\n" +
|
||||
"\n" +
|
||||
" select @numDocForn = LTRIM(RTRIM(@numdocOrig))\n" +
|
||||
"\n" +
|
||||
" declare @tmpChar table (sep varchar(5));\n" +
|
||||
" declare @splitString table (numOrig varchar(60), numNew varchar(60), is_numeric int);\n" +
|
||||
"\n" +
|
||||
" SET @numDocForn = REPLACE(@numDocForn, '-', ',');\n" +
|
||||
" SET @numDocForn = REPLACE(@numDocForn, '.', ',');\n" +
|
||||
" SET @numDocForn = REPLACE(@numDocForn, ' ', ',');\n" +
|
||||
" SET @numDocForn = REPLACE(@numDocForn, '/', ',');\n" +
|
||||
" SET @numDocForn = REPLACE(@numDocForn, '', ',');\n" +
|
||||
" \n" +
|
||||
" ;with tab_p as (\n" +
|
||||
" select value_string as num_new, \n" +
|
||||
" COUNT(*) over (partition by (select 1)) as tot_row, \n" +
|
||||
" ROW_NUMBER() over (order by (select 1)) as id,\n" +
|
||||
" LEN(value_string) as lunghezza\n" +
|
||||
" from dbo.parseStringIntoArray(@numDocForn, ',')\n" +
|
||||
" where ISNUMERIC(value_string) = 1 )\n" +
|
||||
" \n" +
|
||||
" insert into @numTable\n" +
|
||||
" select @numdocOrig as num_doc_forn, try_cast(num_new as int ) as num_doc\n" +
|
||||
" from (\n" +
|
||||
" select * from tab_p ) t\n" +
|
||||
" where (tot_row = 1 or (tot_row > 1 AND \n" +
|
||||
" num_new <> cast(@annoComp as varchar) and\n" +
|
||||
" num_new <> cast(right(@annoComp,2) as varchar) )) AND \n" +
|
||||
" try_cast(num_new as int ) is not null \n" +
|
||||
" union \n" +
|
||||
" select @numdocOrig, @numDocForn\n" +
|
||||
" where not exists (select * from tab_p)\n" +
|
||||
" union \n" +
|
||||
" select @numdocOrig, TRY_CAST(Left(@numDocForn,6) as int)\n" +
|
||||
" where TRY_CAST(left(@numDocForn,6) as int) is not null\n" +
|
||||
" union \n" +
|
||||
" select @numdocOrig, TRY_CAST(Right(@numDocForn,6) as int)\n" +
|
||||
" where TRY_CAST(Right(@numDocForn,6) as int) is not null\n" +
|
||||
" \n" +
|
||||
" \n" +
|
||||
"\n" +
|
||||
" RETURN \n" +
|
||||
"END");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
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_20250916175210 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
createSetup("DATI_AZIENDA", "GIACENZA_DA_INV", "ATTIVA_LOG", "N",
|
||||
"Attiva log articoli negativi", false, "SI_NO", false, true,
|
||||
false, false, false, null, false, "SELECT 'S' UNION ALL SELECT 'N'");
|
||||
|
||||
if (existsTable("carelli_giacenza_prog"))
|
||||
executeStatement("SELECT getDate() as datetime_ins, *\n" +
|
||||
"into carelli_giacenza_prog_bck\n" +
|
||||
"FROM carelli_giacenza_prog\n" +
|
||||
"where 1 <> 1");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -39,6 +39,8 @@ public class Migration_20250917111031 extends BaseMigration implements Migration
|
||||
"Nome report stampa tracciabilità udc vendite", false, "REPORT_NAME", false, false,
|
||||
false, false, false, null, false, "SELECT REPORT_NAME FROM WTB_JREPT ORDER BY 1");
|
||||
|
||||
if (isDMS()) return;
|
||||
|
||||
createOrUpdateView("vw_tracciabUDCACQ",
|
||||
"CREATE VIEW [dbo].[vw_tracciabUDCACQ] AS\n" +
|
||||
"SELECT doct.cod_anag AS codAnag,\n" +
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
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_20250917135026 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
enableSaveToRest("vauto");
|
||||
|
||||
if ( isCustomer(IntegryCustomer.Carelli))
|
||||
executeStatement("insert into stb_abil\n" +
|
||||
" select 'LG082', user_name, flag_abil, gest_name\n" +
|
||||
" from stb_abil\n" +
|
||||
" where cod_opz = 'LG005'\n" +
|
||||
" and not exists(select * from stb_abil s where s.user_name = stb_abil.user_name and s.cod_opz = 'LG082')",
|
||||
"update stb_abil set flag_abil = 'N' where cod_opz = 'LG005'");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomer;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20250917162650 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if ( isCustomer(IntegryCustomer.Biolevante)) {
|
||||
executeStatement(";with moduli as (\n" +
|
||||
"select *\n" +
|
||||
"from dtb_mod_stampa\n" +
|
||||
"where mod_stampa in ('CMR', 'PACK', 'PACKC') and report_id is not null)\n" +
|
||||
"insert into drl_tipi_report ( cod_dtip, report_id, sort_id, report_type)\n" +
|
||||
"select cod_dtip, moduli.report_id, \n" +
|
||||
"ROW_NUMBER() over (partition by cod_dtip order by moduli.mod_stampa desc) as sort_id,\n" +
|
||||
"IIF(moduli.mod_stampa ='CMR',2, 1) as report_type\n" +
|
||||
"from dtb_tipi,\n" +
|
||||
"moduli\n" +
|
||||
"where dtb_tipi.tipo_emissione = 'DIRETTA'\n" +
|
||||
"and ((gestione = 'A' AND moduli.mod_stampa = 'PACKC') OR\n" +
|
||||
"(gestione = 'V' AND moduli.mod_stampa IN( 'CMR','PACK') ) OR \n" +
|
||||
"(gestione = 'L' AND segno_qta_car - segno_val_scar > 0 AND moduli.mod_stampa = 'PACKC') OR\n" +
|
||||
"(gestione = 'L' AND segno_qta_car - segno_val_scar < 0 AND moduli.mod_stampa = 'PACK')\n" +
|
||||
")\n" +
|
||||
"order by 1");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20250918105103 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (!existsSetup("PICKING", "ACCETTAZIONE", "FLAG_GROUP_LIST_FORN")) {
|
||||
createSetup("PICKING", "ACCETTAZIONE", "FLAG_GROUP_LIST_FORN", "", "Permette di scegliere il raggruppamento delle bolle per fornitore (true) o per listino (false)", "SI_NO");
|
||||
}
|
||||
if (!existsSetup("PICKING", "ACCETTAZIONE_BOLLA", "FLAG_EXCLUDE_KG")) {
|
||||
createSetup("PICKING", "ACCETTAZIONE_BOLLA", "FLAG_EXCLUDE_KG", "N", "Flag per escludere gli articoli a peso variabile", "SI_NO");
|
||||
}
|
||||
if (!existsSetup("PICKING", "ACCETTAZIONE_BOLLA", "FLAG_QTA_TOT_EDITABLE")) {
|
||||
createSetup("PICKING", "ACCETTAZIONE_BOLLA", "FLAG_QTA_TOT_EDITABLE", "S", "Se abilitato rende editabile il campo ''Qta tot''", "SI_NO");
|
||||
}
|
||||
if (!existsSetup("PICKING", "IMBALLI", "COD_DTIP_CARICO")) {
|
||||
createSetup("PICKING", "IMBALLI", "COD_DTIP_CARICO", "", "Codice documento che identifica il carico degli imballi", "COD_DTIP");
|
||||
}
|
||||
if (!existsSetup("PICKING", "IMBALLI", "COD_DTIP_SCARICO")) {
|
||||
createSetup("PICKING", "IMBALLI", "COD_DTIP_SCARICO", "", "Codice documento che identifica lo scarico degli imballi", "COD_DTIP");
|
||||
}
|
||||
if (!existsSetup("PICKING", "PICKING_LIBERO", "ENABLE_SCAN_ART")) {
|
||||
createSetup("PICKING", "PICKING_LIBERO", "ENABLE_SCAN_ART", "", "Permette di abilitare la scansione dei barcode inerenti all'articolo o alla confezione senza dover usare il barcode UL.", "SI_NO");
|
||||
}
|
||||
|
||||
if (!existsSetup("PICKING", "PICKING_LIBERO", "FLAG_ASK_COMMESSA_LAV")) {
|
||||
createSetup("PICKING", "PICKING_LIBERO", "FLAG_ASK_COMMESSA_LAV", "N", "Se 'S' allora all'apertura del Picking Libero di lavorazione verrà chiesta la commessa", "SI_NO");
|
||||
}
|
||||
if (!existsSetup("PICKING", "PRODUZIONE", "FLAG_GENERA_DOC_CAR")) {
|
||||
createSetup("PICKING", "PRODUZIONE", "FLAG_GENERA_DOC_CAR", "N", "Se 'S' abilita la generazione dei documenti di carico lavorazione. Il codice documento è letto dalla setup W_PORDI_RC > SETUP_DOCUMENTI > COD_DTIP_CAR.", "SI_NO");
|
||||
}
|
||||
if (!existsSetup("PICKING", "PRODUZIONE", "FLAG_GENERA_DOC_SCAR")) {
|
||||
createSetup("PICKING", "PRODUZIONE", "FLAG_GENERA_DOC_SCAR", "N", "Se 'S' abilita la generazione dei documenti di scarico lavorazione. Il codice documento è letto dalla setup W_PORDI_RC > SETUP_DOCUMENTI > COD_DTIP_SCAR.", "SI_NO");
|
||||
}
|
||||
if (!existsSetup("PICKING", "RETTIFICA_GIACENZE", "FLAG_ENABLE_MOVIMENTO_FISCALE")) {
|
||||
createSetup("PICKING", "RETTIFICA_GIACENZE", "FLAG_ENABLE_MOVIMENTO_FISCALE", "N", "Flag che abilita o meno la generazione automatica di un movimento fiscale quando viene effettuata una rettifica giacenze", "SI_NO");
|
||||
}
|
||||
if (!existsSetup("PICKING", "RETTIFICA_GIACENZE", "TIPO_MOVIMENTO_FISCALE")) {
|
||||
createSetup("PICKING", "RETTIFICA_GIACENZE", "TIPO_MOVIMENTO_FISCALE", "", "Indica il tipo documento del movimento fiscale da utilizzare", "COD_DTIP");
|
||||
}
|
||||
if (!existsSetup("PICKING", "SETUP", "ENABLE_ART_CREATION")) {
|
||||
createSetup("PICKING", "SETUP", "ENABLE_ART_CREATION", "N", "Permette agli utenti di creare gli articoli", "SI_NO");
|
||||
}
|
||||
if (!existsSetup("PICKING", "SETUP", "ENABLE_ART_CREATION_GRP_MERC")) {
|
||||
createSetup("PICKING", "SETUP", "ENABLE_ART_CREATION_GRP_MERC", "", "Vincola la creazione degli articoli solo ad alcuni gruppi merceologici", "COD_MGRP");
|
||||
}
|
||||
if (!existsSetup("PICKING", "SETUP", "ENABLE_POSITION_CHANGE_REQUEST")) {
|
||||
createSetup("PICKING", "SETUP", "ENABLE_POSITION_CHANGE_REQUEST", "S", "Permette di abilitare il pop-up di richiesta di modifica posizione", "SI_NO");
|
||||
}
|
||||
if (!existsSetup("PICKING", "SETUP", "VIEW_SWITCH_DEPO_BUTTON")) {
|
||||
createSetup("PICKING", "SETUP", "VIEW_SWITCH_DEPO_BUTTON", "S", "Permette di abilitare la selezione del deposito in home page", "SI_NO");
|
||||
}
|
||||
if (!existsSetup("PICKING", "SPEDIZIONE", "ADD_DATACONS_IN_FILTRO")) {
|
||||
createSetup("PICKING", "SPEDIZIONE", "ADD_DATACONS_IN_FILTRO", "S", "Permettere l'inserimento di data_cons in filtro ordine della MtbColt", "SI_NO");
|
||||
}
|
||||
if (!existsSetup("PICKING", "SPEDIZIONE", "ELENCO_FORNITORI_INTERNI")) {
|
||||
createSetup("PICKING", "SPEDIZIONE", "ELENCO_FORNITORI_INTERNI", "", "Elenco utilizzato per riconoscere i fornitori del gruppo. Separati da pipe", "");
|
||||
}
|
||||
if (!existsSetup("PICKING", "SPEDIZIONE", "ENABLE_FAST_PICKING")) {
|
||||
createSetup("PICKING", "SPEDIZIONE", "ENABLE_FAST_PICKING", "N", "Permette di abilitare il fast picking: abilita la scansione degli SSCC direttamente nel popup di inserimento delle quantità procedendo alla chiusura UL automatica e successiva apertura di una nuova UL.", "SI_NO");
|
||||
}
|
||||
if (!existsSetup("PICKING", "SPEDIZIONE", "FLAG_ASK_DUPLICATE_UDS")) {
|
||||
createSetup("PICKING", "SPEDIZIONE", "FLAG_ASK_DUPLICATE_UDS", "N", "Questo flag permetta all'utente di creare nel picking di vendita più UDS partendo da una già creata solo se l'UDS non ha riferimenti a colli di carico.", "SI_NO");
|
||||
}
|
||||
if (!existsSetup("PICKING", "SPEDIZIONE", "FLAG_USE_COLLI_PEDANA")) {
|
||||
createSetup("PICKING", "SPEDIZIONE", "FLAG_USE_COLLI_PEDANA", "N", "Questo flag permette, durante il picking, di proporre automaticamente la qta dei colli pedana presente nell'anagrafica articolo. Questa setup prevale su FLAG_USE_QTA_ORD se entrambe attive.", "SI_NO");
|
||||
}
|
||||
if (!existsSetup("PICKING", "SPEDIZIONE", "REPORT_PACKING_LIST")) {
|
||||
createSetup("PICKING", "SPEDIZIONE", "REPORT_PACKING_LIST", "", "Selezionare la stampa del packing list che verrà lanciata alla pressione del tasto \"Chiudi ordine\" del WMS", "REPORT_NAME");
|
||||
}
|
||||
if (!existsSetup("PICKING", "SPEDIZIONE", "SUGGEST_DATA_SCAD")) {
|
||||
createSetup("PICKING", "SPEDIZIONE", "SUGGEST_DATA_SCAD", "N", "Suggerisce la data di scadenza di una partita già esistente", "SI_NO");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20250918115332 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (!isTextiles()) return;
|
||||
createOrUpdateFunction("ftx_calcCostoProd", "CREATE FUNCTION ftx_calcCostoProd\n" +
|
||||
"(\n" +
|
||||
" -- Add the parameters for the function here\n" +
|
||||
" @codStyle varchar(15)\n" +
|
||||
")\n" +
|
||||
"RETURNS numeric(20,5)\n" +
|
||||
"AS\n" +
|
||||
"BEGIN\n" +
|
||||
" declare @costoProd numeric(20,5);\n" +
|
||||
"\n" +
|
||||
"WITH \n" +
|
||||
"CostoAcquisto AS (\n" +
|
||||
" SELECT \n" +
|
||||
" ttb_style.cod_style, \n" +
|
||||
" ROUND(SUM(ttb_style_taglie.costo) / COUNT(ttb_style_taglie.costo), 5) AS costo_acquisto\n" +
|
||||
" FROM ttb_style \n" +
|
||||
" INNER JOIN ttb_style_taglie \n" +
|
||||
" ON ttb_style.cod_style = ttb_style_taglie.cod_style\n" +
|
||||
" WHERE ttb_style.cod_style = @codStyle\n" +
|
||||
" GROUP BY ttb_style.cod_style\n" +
|
||||
"),\n" +
|
||||
"CostoMateriali AS (\n" +
|
||||
" SELECT \n" +
|
||||
" ttb_style.cod_style,\n" +
|
||||
" SUM(ISNULL(costo_unt, 0) * ISNULL(jtb_dist_mate.qta_std, 0) * (1 + ISNULL(jtb_dist_mate.perc_sfrido, 0) / 100)) AS costo_materiali\n" +
|
||||
" FROM jtb_dist_mate \n" +
|
||||
" INNER JOIN ttb_style \n" +
|
||||
" ON jtb_dist_mate.cod_prod = ttb_style.cod_style\n" +
|
||||
" WHERE ttb_style.cod_style = @codStyle\n" +
|
||||
" GROUP BY ttb_style.cod_style\n" +
|
||||
"),\n" +
|
||||
"CostiDirettiPerc AS (\n" +
|
||||
" SELECT \n" +
|
||||
" jtb_dist_clav_ind.cod_prod AS cod_style,\n" +
|
||||
" SUM(\n" +
|
||||
" CASE \n" +
|
||||
" WHEN jtb_clav_ind.tipo_calcolo = 'A' THEN ISNULL(ROUND(CostoAcquisto.costo_acquisto * jtb_dist_clav_ind.perc_cost / 100, 5), 0)\n" +
|
||||
" WHEN jtb_clav_ind.tipo_calcolo = 'M' THEN ISNULL(ROUND(CostoMateriali.costo_materiali * jtb_dist_clav_ind.perc_cost / 100, 5), 0)\n" +
|
||||
" ELSE 0\n" +
|
||||
" END\n" +
|
||||
" ) AS costi_perc_lav\n" +
|
||||
" FROM jtb_dist_clav_ind \n" +
|
||||
" INNER JOIN jtb_clav_ind \n" +
|
||||
" ON jtb_dist_clav_ind.cod_jcos_ind = jtb_clav_ind.cod_jcos_ind\n" +
|
||||
" LEFT JOIN CostoAcquisto \n" +
|
||||
" ON CostoAcquisto.cod_style = jtb_dist_clav_ind.cod_prod\n" +
|
||||
" LEFT JOIN CostoMateriali \n" +
|
||||
" ON CostoMateriali.cod_style = jtb_dist_clav_ind.cod_prod\n" +
|
||||
" WHERE jtb_clav_ind.tipo_calcolo IN ('A', 'M')\n" +
|
||||
" GROUP BY jtb_dist_clav_ind.cod_prod\n" +
|
||||
"),\n" +
|
||||
"CostiDiretti AS (\n" +
|
||||
" SELECT \n" +
|
||||
" CostoAcquisto.cod_style,\n" +
|
||||
" ISNULL(CostoAcquisto.costo_acquisto, 0) AS costo_acquisto,\n" +
|
||||
" ISNULL(CostoMateriali.costo_materiali, 0) AS costo_materiali,\n" +
|
||||
" ISNULL(CostiDirettiPerc.costi_perc_lav, 0) AS costi_perc_lav,\n" +
|
||||
" ROUND(\n" +
|
||||
" ISNULL(CostoAcquisto.costo_acquisto, 0) + \n" +
|
||||
" ISNULL(CostoMateriali.costo_materiali, 0) + \n" +
|
||||
" ISNULL(CostiDirettiPerc.costi_perc_lav, 0), \n" +
|
||||
" 5) AS costi_diretti\n" +
|
||||
" FROM CostoAcquisto\n" +
|
||||
" LEFT JOIN CostoMateriali ON CostoAcquisto.cod_style = CostoMateriali.cod_style\n" +
|
||||
" LEFT JOIN CostiDirettiPerc ON CostoAcquisto.cod_style = CostiDirettiPerc.cod_style\n" +
|
||||
"),\n" +
|
||||
"CostiIndiretti AS (\n" +
|
||||
" SELECT \n" +
|
||||
" jtb_dist_clav_ind.cod_prod AS cod_style,\n" +
|
||||
" SUM(ISNULL(ROUND(CostiDiretti.costi_diretti * jtb_dist_clav_ind.perc_cost / 100, 5), 0)) AS costi_indiretti\n" +
|
||||
" FROM jtb_dist_clav_ind\n" +
|
||||
" INNER JOIN jtb_clav_ind ON jtb_dist_clav_ind.cod_jcos_ind = jtb_clav_ind.cod_jcos_ind\n" +
|
||||
" INNER JOIN CostiDiretti ON CostiDiretti.cod_style = jtb_dist_clav_ind.cod_prod\n" +
|
||||
" WHERE jtb_clav_ind.tipo_calcolo = 'D'\n" +
|
||||
" and jtb_dist_clav_ind.cod_prod = @codStyle\n" +
|
||||
" GROUP BY jtb_dist_clav_ind.cod_prod\n" +
|
||||
"),\n" +
|
||||
"AltriCosti AS (\n" +
|
||||
" SELECT\n" +
|
||||
" jtb_dist_clav_dir.cod_prod AS cod_style,\n" +
|
||||
" SUM(ISNULL(jtb_dist_clav_dir.val_unt, 0)) AS altri_costi\n" +
|
||||
" FROM jtb_dist_clav_dir\n" +
|
||||
" LEFT JOIN gtb_spes ON jtb_dist_clav_dir.cod_jcos_dir = gtb_spes.cod_spes\n" +
|
||||
" LEFT JOIN gtb_anag ON jtb_dist_clav_dir.cod_forn = gtb_anag.cod_anag\n" +
|
||||
" LEFT JOIN jtb_lisa_lav ON jtb_dist_clav_dir.cod_forn = jtb_lisa_lav.cod_forn\n" +
|
||||
" AND jtb_dist_clav_dir.cod_lav_forn = jtb_lisa_lav.cod_lav_forn\n" +
|
||||
" INNER JOIN CostoAcquisto ON jtb_dist_clav_dir.cod_prod = CostoAcquisto.cod_style\n" +
|
||||
" where jtb_dist_clav_dir.cod_prod = @codStyle\n" +
|
||||
" GROUP BY jtb_dist_clav_dir.cod_prod\n" +
|
||||
")\n" +
|
||||
"\n" +
|
||||
"SELECT \n" +
|
||||
" @costoProd = \n" +
|
||||
" ROUND(\n" +
|
||||
" CostiDiretti.costi_diretti + \n" +
|
||||
" ISNULL(CostiIndiretti.costi_indiretti, 0) + \n" +
|
||||
" ISNULL(AltriCosti.altri_costi, 0), 2\n" +
|
||||
" ) \n" +
|
||||
"FROM CostiDiretti\n" +
|
||||
"LEFT JOIN CostiIndiretti ON CostiDiretti.cod_style = CostiIndiretti.cod_style\n" +
|
||||
"LEFT JOIN AltriCosti ON CostiDiretti.cod_style = AltriCosti.cod_style\n" +
|
||||
"\n" +
|
||||
"return @costoProd\n" +
|
||||
"\n" +
|
||||
"END");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,199 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20250919095906 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS()) return;
|
||||
|
||||
createOrUpdateFunction("f_getNumDoc4NumDocForn", "CREATE FUNCTION [dbo].[f_getNumDoc4NumDocForn](@numdocOrig varchar(60), @annoComp varchar(4))\n" +
|
||||
"RETURNS int\n" +
|
||||
"AS\n" +
|
||||
"BEGIN \n" +
|
||||
" DECLARE @numDoc int\n" +
|
||||
"\n" +
|
||||
" select @numDoc = num_doc\n" +
|
||||
" from(\n" +
|
||||
"select *, COUNT(*) over (partition by len(num_doc)) as conta_len, ROW_NUMBER() over(order by len(num_doc) desc) as sort\n" +
|
||||
"from dbo.getNumDoc4NumDocForn(@numDocOrig, @annoComp) )t\n" +
|
||||
"where sort = 1 AND conta_len = 1\n" +
|
||||
"\n" +
|
||||
" return @numDoc\n" +
|
||||
"END");
|
||||
createOrUpdateFunction("f_getNumDoc4NumDocFornOld", "CREATE FUNCTION [dbo].[f_getNumDoc4NumDocFornOld](@numdocOrig varchar(60), @annoComp varchar(4))\n" +
|
||||
"RETURNS int\n" +
|
||||
"AS\n" +
|
||||
"BEGIN \n" +
|
||||
"\n" +
|
||||
"declare @sep varchar(5), @numDoc varchar(60), @rowc int\n" +
|
||||
"\n" +
|
||||
" select @numdocOrig = LTRIM(RTRIM(@numdocOrig))\n" +
|
||||
"\n" +
|
||||
" declare @tmpChar table (sep varchar(5));\n" +
|
||||
" declare @splitString table (numOrig varchar(60), numNew varchar(60), is_numeric int);\n" +
|
||||
" \n" +
|
||||
"\n" +
|
||||
" insert into @tmpChar values ('-')\n" +
|
||||
" insert into @tmpChar values ('.') \n" +
|
||||
" insert into @tmpChar values (' ')\n" +
|
||||
" insert into @tmpChar values ('/')\n" +
|
||||
" insert into @tmpChar values ('\')\n" +
|
||||
"\n" +
|
||||
" declare @string varchar(1), @i int , @parseString varchar(60), @find int\n" +
|
||||
"\n" +
|
||||
" set @i = 1\n" +
|
||||
"\n" +
|
||||
" select @string = left(@numdocOrig, 1)\n" +
|
||||
"\n" +
|
||||
" while @string <> '' and @string is not null\n" +
|
||||
" begin\n" +
|
||||
" select @find = count(*)from @tmpChar where sep = @string\n" +
|
||||
"\n" +
|
||||
" if @find > 0 \n" +
|
||||
" begin\n" +
|
||||
" insert @splitString values (@numdocOrig, @parseString, IsNumeric(@parseString))\n" +
|
||||
" set @parseString = ''\n" +
|
||||
" end \n" +
|
||||
" else\n" +
|
||||
" begin\n" +
|
||||
" select @parseString = IsNull(@parseString, '') + @string\n" +
|
||||
" end \n" +
|
||||
" select @i = @i + 1\n" +
|
||||
" select @string = substring(@numdocOrig, @i, 1)\n" +
|
||||
" end\n" +
|
||||
"\n" +
|
||||
" insert @splitString values (@numdocOrig, @parseString, IsNumeric(@parseString))\n" +
|
||||
"\n" +
|
||||
" select @rowc = count(*) From @splitString\n" +
|
||||
" \n" +
|
||||
" /*select *\n" +
|
||||
" from @splitString\n" +
|
||||
" where value <> @annoComp\n" +
|
||||
" and IsNumeric(value) <> 0 \n" +
|
||||
" and cast(value as bigint) <> 0 \n" +
|
||||
" and ((value <> @numdocOrig and ISNUMERIC(@numdocOrig) = 0) or ISNUMERIC(@numdocOrig) = 1)\n" +
|
||||
" */\n" +
|
||||
"\n" +
|
||||
" select @numDoc = numNew from @splitString\n" +
|
||||
" where ( numNew <> @annoComp and numNew <> RIGHT( @annoComp, 2)) and \n" +
|
||||
" is_numeric <> 0 and \n" +
|
||||
" cast(numNew as bigint) <> 0 and\n" +
|
||||
" numNew <> @numdocOrig\n" +
|
||||
" \n" +
|
||||
" Set @rowc = @@ROWCOUNT\n" +
|
||||
"\n" +
|
||||
" if @rowc = 0\n" +
|
||||
" begin\n" +
|
||||
" --Analizzare la stringa \n" +
|
||||
" set @i = 0\n" +
|
||||
" while @i < Len(@numdocOrig)\n" +
|
||||
" begin\n" +
|
||||
" select @i = @i+1\n" +
|
||||
" --select substring(@numdocOrig, @i, 1)\n" +
|
||||
" if isNumeric(substring(@numdocOrig, @i, 1) ) = 1 AND (select count(*) FROM @tmpChar WHERE sep = substring(@numdocOrig, @i, 1) ) = 0\n" +
|
||||
" begin\n" +
|
||||
" select @numdoc = IsNull(@numdoc, '') + substring(@numdocOrig, @i, 1)\n" +
|
||||
" end\n" +
|
||||
" else\n" +
|
||||
" begin \n" +
|
||||
" if LEN (@numDoc) > 0\n" +
|
||||
" begin\n" +
|
||||
" break\n" +
|
||||
" end \n" +
|
||||
" \n" +
|
||||
" end\n" +
|
||||
"\n" +
|
||||
" end\n" +
|
||||
" end\n" +
|
||||
" else if @rowC > 1\n" +
|
||||
" begin\n" +
|
||||
" select @numDoc = 0\n" +
|
||||
" end\n" +
|
||||
"\n" +
|
||||
"\n" +
|
||||
" select @numDoc = (SELECT numDoc from ( select @numDoc as numDoc except SELECT * from @tmpChar ) t)\n" +
|
||||
" \n" +
|
||||
" select @numDoc = right(@numDoc, 6)\n" +
|
||||
" \n" +
|
||||
" return cast (@numDoc as int)\n" +
|
||||
"END");
|
||||
|
||||
createOrUpdateFunction("getNumDoc4NumDocForn", "CREATE FUNCTION [dbo].[getNumDoc4NumDocForn]\n" +
|
||||
"(\t\n" +
|
||||
"\t@numdocorig varchar(60), @annoComp varchar(4)\n" +
|
||||
")\n" +
|
||||
"\n" +
|
||||
"RETURNS @numTable TABLE \n" +
|
||||
"(\n" +
|
||||
"\tnum_doc_orig varchar(max), num_doc int\n" +
|
||||
")\n" +
|
||||
"AS\n" +
|
||||
"BEGIN\n" +
|
||||
"\t\n" +
|
||||
"\tdeclare @sep varchar(5), @numDoc varchar(60), @rowc int, @numDocForn varchar(60)\n" +
|
||||
"\n" +
|
||||
"\tselect @numDocForn = LTRIM(RTRIM(@numdocOrig))\n" +
|
||||
"\n" +
|
||||
"\tdeclare @tmpChar table (sep varchar(5));\n" +
|
||||
"\tdeclare @splitString table (numOrig varchar(60), numNew varchar(60), is_numeric int);\n" +
|
||||
"\n" +
|
||||
"\tSET @numDocForn = REPLACE(@numDocForn, '-', ',');\n" +
|
||||
"\tSET @numDocForn = REPLACE(@numDocForn, '.', ',');\n" +
|
||||
"\tSET @numDocForn = REPLACE(@numDocForn, '_', ',');\n" +
|
||||
"\tSET @numDocForn = REPLACE(@numDocForn, ' ', ',');\n" +
|
||||
"\tSET @numDocForn = REPLACE(@numDocForn, '/', ',');\n" +
|
||||
"\tSET @numDocForn = REPLACE(@numDocForn, '', ',');\n" +
|
||||
"\tSET @numDocForn = REPLACE(@numDocForn, '@', ',');\n" +
|
||||
"\n" +
|
||||
"\tselect @numDocForn = IIF(left(@numDocForn, 2)='IT', substring(@numDocForn, 3, len(@numDocForn) - 2),@numDocForn)\n" +
|
||||
"\n" +
|
||||
"\t\n" +
|
||||
"\t;with tab_p as (\n" +
|
||||
"\tselect value_string as num_new, \n" +
|
||||
"\tCOUNT(*) over (partition by (select 1)) as tot_row, \n" +
|
||||
"\tROW_NUMBER() over (order by (select 1)) as id,\n" +
|
||||
"\tLEN(value_string) as lunghezza\n" +
|
||||
"\tfrom dbo.parseStringIntoArray(@numDocForn, ',')\n" +
|
||||
"\twhere ISNUMERIC(value_string) = 1 )\n" +
|
||||
"\n" +
|
||||
"\t,\n" +
|
||||
"\ttab_union as (\t \n" +
|
||||
"\tselect @numdocOrig as num_doc_forn, try_cast(IIF(try_cast(num_new as bigint) > 2147483647, right(num_new,6), num_new) as int ) as num_doc\n" +
|
||||
"\tfrom (\n" +
|
||||
"\tselect * from tab_p ) t\n" +
|
||||
"\twhere ((num_new <> @annoComp and\n" +
|
||||
"\tnum_new <> right(@annoComp,2)) or tot_row = 1 ) \n" +
|
||||
"\tunion \n" +
|
||||
"\tselect @numdocOrig, Try_cast(@numDocForn as int )\n" +
|
||||
"\twhere not exists (select * from tab_p)\n" +
|
||||
"\tunion\n" +
|
||||
"\tselect @numdocOrig, \n" +
|
||||
"\tcoalesce(TRY_CAST(Right(@numDocForn,6) as int), \n" +
|
||||
"\tIIF(PATINDEX('%[0-9]%', @numDocForn) > 0, try_cast(SUBSTRING(@numDocForn, PATINDEX('%[0-9]%', @numDocForn), len(@numDocForn)) as int), null), \n" +
|
||||
"\tIIF(PATINDEX('%[a-Z]%', @numDocForn) > 0, try_cast(left(@numDocForn, PATINDEX('%[a-Z]%', @numDocForn) - 1) as int), null))\n" +
|
||||
"\twhere not exists (select * from tab_p)\n" +
|
||||
"\t)\n" +
|
||||
"\n" +
|
||||
"\tinsert into @numTable\n" +
|
||||
"\tselect *\n" +
|
||||
"\tfrom tab_union\n" +
|
||||
"\twhere num_doc is not null\n" +
|
||||
"\tand num_doc<> 0\n" +
|
||||
"\t\n" +
|
||||
"\t\n" +
|
||||
"\tRETURN \n" +
|
||||
"END");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomer;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20250919102659 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
createSetupQuery("SI_NO", "SI_NO", "SELECT 'S' UNION ALL SELECT 'N'");
|
||||
createSetup("DATI_AZIENDA", "FATTURAZIONE_ELETTRONICA", "FIRST_NUM_DOC", "N",
|
||||
"seleziona sempre il primo numero con lunghezza maggiore dal numero che ci invia il fornitore in fattura elettronica", false, "SI_NO", false, false,
|
||||
false, false, false, null, false, "SELECT 'S' UNION ALL SELECT 'N'");
|
||||
|
||||
if (isCustomer(IntegryCustomer.RossoGargano))
|
||||
updateSetupValue("DATI_AZIENDA", "FATTURAZIONE_ELETTRONICA", "FIRST_NUM_DOC", "S");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20250919102944 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS()) return;
|
||||
|
||||
createOrUpdateFunction("f_getNumDoc4NumDocForn", "CREATE FUNCTION [dbo].[f_getNumDoc4NumDocForn](@numdocOrig varchar(60), @annoComp varchar(4))\n" +
|
||||
"RETURNS int\n" +
|
||||
"AS\n" +
|
||||
"BEGIN \n" +
|
||||
" DECLARE @numDoc int, @selectFirst bit\n" +
|
||||
"\n" +
|
||||
" select @selectFirst = cast(IIF(value = 'S',1,0) as bit) FROM stb_gest_setup WHERe gest_name = 'DATI_AZIENDA' AND section = 'FATTURAZIONE_ELETTRONICA' AND key_section = 'FIRST_NUM_DOC'; \n" +
|
||||
"\n" +
|
||||
" select @numDoc = num_doc\n" +
|
||||
" from(\n" +
|
||||
"select *, COUNT(*) over (partition by len(num_doc)) as conta_len, ROW_NUMBER() over(order by len(num_doc) desc) as sort,\n" +
|
||||
"COUNT(*) over (partition by (select 1)) as tot_num\n" +
|
||||
"from dbo.getNumDoc4NumDocForn(@numDocOrig, @annoComp) )t\n" +
|
||||
"where ((@selectFirst = 1 AND sort = 1 AND conta_len = 1) or (@selectFirst = 0 and tot_num = 1))\n" +
|
||||
"\n" +
|
||||
"\n" +
|
||||
" return @numDoc\n" +
|
||||
"END");
|
||||
createOrUpdateFunction("getNumDoc4NumDocForn", "CREATE FUNCTION [dbo].[getNumDoc4NumDocForn]\n" +
|
||||
"( \n" +
|
||||
" @numdocorig varchar(60), @annoComp varchar(4)\n" +
|
||||
")\n" +
|
||||
"\n" +
|
||||
"RETURNS @numTable TABLE \n" +
|
||||
"(\n" +
|
||||
" num_doc_orig varchar(max), num_doc int\n" +
|
||||
")\n" +
|
||||
"AS\n" +
|
||||
"BEGIN\n" +
|
||||
" \n" +
|
||||
" declare @sep varchar(5), @numDoc varchar(60), @rowc int, @numDocForn varchar(60)\n" +
|
||||
"\n" +
|
||||
" select @numDocForn = LTRIM(RTRIM(@numdocOrig))\n" +
|
||||
"\n" +
|
||||
" declare @tmpChar table (sep varchar(5));\n" +
|
||||
" declare @splitString table (numOrig varchar(60), numNew varchar(60), is_numeric int);\n" +
|
||||
"\n" +
|
||||
" SET @numDocForn = REPLACE(@numDocForn, '-', ',');\n" +
|
||||
" SET @numDocForn = REPLACE(@numDocForn, '.', ',');\n" +
|
||||
" SET @numDocForn = REPLACE(@numDocForn, '_', ',');\n" +
|
||||
" SET @numDocForn = REPLACE(@numDocForn, ' ', ',');\n" +
|
||||
" SET @numDocForn = REPLACE(@numDocForn, '/', ',');\n" +
|
||||
" SET @numDocForn = REPLACE(@numDocForn, '', ',');\n" +
|
||||
" SET @numDocForn = REPLACE(@numDocForn, '@', ',');\n" +
|
||||
"\n" +
|
||||
" select @numDocForn = IIF(left(@numDocForn, 2)='IT', substring(@numDocForn, 3, len(@numDocForn) - 2),@numDocForn)\n" +
|
||||
"\n" +
|
||||
" \n" +
|
||||
" ;with tab_p as (\n" +
|
||||
" select value_string as num_new, \n" +
|
||||
" COUNT(*) over (partition by (select 1)) as tot_row, \n" +
|
||||
" ROW_NUMBER() over (order by (select 1)) as id,\n" +
|
||||
" LEN(value_string) as lunghezza\n" +
|
||||
" from dbo.parseStringIntoArray(@numDocForn, ',')\n" +
|
||||
" where ISNUMERIC(value_string) = 1 )\n" +
|
||||
"\n" +
|
||||
" ,\n" +
|
||||
" tab_union as ( \n" +
|
||||
" select @numdocOrig as num_doc_forn, try_cast(IIF(try_cast(num_new as bigint) > 2147483647, right(num_new,6), num_new) as int ) as num_doc\n" +
|
||||
" from (\n" +
|
||||
" select * from tab_p ) t\n" +
|
||||
" where ((num_new <> @annoComp and\n" +
|
||||
" num_new <> right(@annoComp,2)) or tot_row = 1 ) \n" +
|
||||
" union \n" +
|
||||
" select @numdocOrig, Try_cast(@numDocForn as int )\n" +
|
||||
" where not exists (select * from tab_p)\n" +
|
||||
" union\n" +
|
||||
" select @numdocOrig, \n" +
|
||||
" coalesce(TRY_CAST(Right(@numDocForn,6) as int), \n" +
|
||||
" IIF(PATINDEX('%[0-9]%', @numDocForn) > 0, try_cast(SUBSTRING(@numDocForn, PATINDEX('%[0-9]%', @numDocForn), len(@numDocForn)) as int), null), \n" +
|
||||
" IIF(PATINDEX('%[a-Z]%', @numDocForn) > 0, try_cast(left(@numDocForn, PATINDEX('%[a-Z]%', @numDocForn) - 1) as int), null))\n" +
|
||||
" where not exists (select * from tab_p)\n" +
|
||||
" )\n" +
|
||||
"\n" +
|
||||
" insert into @numTable\n" +
|
||||
" select *\n" +
|
||||
" from tab_union\n" +
|
||||
" where num_doc is not null\n" +
|
||||
" and num_doc<> 0\n" +
|
||||
" \n" +
|
||||
" \n" +
|
||||
" RETURN \n" +
|
||||
"END");
|
||||
|
||||
createOrUpdateView("svw_fattura_elettronica_files",
|
||||
"CREATE View [dbo].[svw_fattura_elettronica_files] as\n" +
|
||||
"SELECT description,\n" +
|
||||
" stb_files_attached.id_attach,\n" +
|
||||
" datetime_attach,\n" +
|
||||
" dtb_fatture_passive.part_iva,\n" +
|
||||
" dtb_fatture_passive.data_doc,\n" +
|
||||
" dtb_fatture_passive.num_doc,\n" +
|
||||
" dtb_fatture_passive.tot_doc,\n" +
|
||||
" dtb_fatture_passive.iban,\n" +
|
||||
" dtb_fatture_passive.cod_dtip,\n" +
|
||||
" (SELECT TOP 1 cod_paga_fe\n" +
|
||||
" FROM dtb_fatture_passive_scad\n" +
|
||||
" WHERE dtb_fatture_passive_scad.id_attach = dtb_fatture_passive.id_attach) AS cod_paga_fe\n" +
|
||||
"FROM stb_files_attached\n" +
|
||||
" INNER JOIN dtb_fatture_passive ON stb_files_attached.parent_id_attach = dtb_fatture_passive.id_attach AND dtb_fatture_passive.part_iva is not null\n" +
|
||||
"WHERE file_ext IN ('P7M', 'XML')\n" +
|
||||
" AND type_attach = 'FP'\n" +
|
||||
" AND stb_files_attached.id_attach = parent_id_attach\n");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomer;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20250919110702 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
executeStatement("alter table mtb_sgrp add flag_miscela bit default 0 not null;\n",
|
||||
"CREATE UNIQUE INDEX ux_mtb_sgrp_flag_miscela ON dbo.mtb_sgrp (flag_miscela) WHERE flag_miscela = 1;");
|
||||
|
||||
if (isCustomer(IntegryCustomer.Biolevante))
|
||||
executeStatement("update mtb_sgrp set flag_miscela = 1 WHERE cod_mgrp = 'S' AND cod_msgr = 'M00'\n");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -1051,7 +1051,7 @@ public class EmsServices {
|
||||
String url = String.format("%sphpinfo.php?get=1", pvmUrl.endsWith("/") ? pvmUrl : pvmUrl + "/");
|
||||
|
||||
StringBuilder srb = new StringBuilder();
|
||||
int status = HttpRestWrapper.callGeneric(url, null, null, null, ContentType.APPLICATION_JSON, srb, null);
|
||||
int status = HttpRestWrapper.callGenericGet(url, null, null, srb, null, null, ContentType.APPLICATION_JSON);
|
||||
|
||||
if (status != 200)
|
||||
throw new Exception("La richiesta \"" + url + "\" ha generato status code: " + status + " [" + srb + "]");
|
||||
|
||||
@@ -212,7 +212,6 @@ public class EmsRestConstants {
|
||||
public static final String PATH_GIACENZA_ART_IN_PV = PATH + "giacenzaArtInPV";
|
||||
public static final String PATH_GET_COLLI_ROW = PATH + "getColliRow";
|
||||
public static final String PATH_DOCUMENTO_SCONTRINO = PATH + "documentoDaScontrini";
|
||||
public static final String PATH_GENERA_CORRISPETTIVI = PATH + "generaCorrispettivi";
|
||||
public static final String PATH_STORNA_SCONTRINO_DA_DOC = PATH + "stornaScontrinoDaDocumento";
|
||||
public static final String PATH_CONTOVENDITA_SCONTRINO = PATH + "ContoVenditaDaScontrini";
|
||||
public static final String PATH_VERIFICA_INVENTARIO = PATH + "verificaInventario";
|
||||
|
||||
@@ -53,7 +53,7 @@ public class CtbMovt extends EntityBase {
|
||||
@SqlField(value = "data_doc", format = CommonConstants.SYSDATE)
|
||||
private Date dataDoc;
|
||||
|
||||
@SqlField(value = "ser_doc", maxLength = 2, defaultObjectValue = "/")
|
||||
@SqlField(value = "ser_doc", maxLength = 2)
|
||||
private String serDoc;
|
||||
|
||||
@SqlField(value = "num_doc")
|
||||
|
||||
@@ -53,6 +53,9 @@ public class MtbSgrp extends EntityBase implements EquatableEntityInterface<MtbS
|
||||
@SqlField(value = "cod_ccon_wip", maxLength = 6)
|
||||
private String codCconWip;
|
||||
|
||||
@SqlField(value = "flag_miscela", defaultObjectValue = "0")
|
||||
private Boolean flagMiscela;
|
||||
|
||||
@EntityChild
|
||||
private List<MtbSfam> mtbSfam = new ArrayList<>();
|
||||
|
||||
@@ -148,6 +151,15 @@ public class MtbSgrp extends EntityBase implements EquatableEntityInterface<MtbS
|
||||
this.codCconWip = codCconWip;
|
||||
}
|
||||
|
||||
public Boolean getFlagMiscela() {
|
||||
return flagMiscela;
|
||||
}
|
||||
|
||||
public MtbSgrp setFlagMiscela(Boolean flagMiscela) {
|
||||
this.flagMiscela = flagMiscela;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void deleteChilds() throws Exception {
|
||||
MtbSfam mtbSfam = new MtbSfam();
|
||||
@@ -175,11 +187,11 @@ public class MtbSgrp extends EntityBase implements EquatableEntityInterface<MtbS
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof MtbSgrp)) return false;
|
||||
MtbSgrp mtbSgrp = (MtbSgrp) o;
|
||||
return Objects.equals(getCodMgrp(), mtbSgrp.getCodMgrp()) && Objects.equals(getCodMsgr(), mtbSgrp.getCodMsgr()) && Objects.equals(getDescrizione(), mtbSgrp.getDescrizione()) && Objects.equals(getInclInStat(), mtbSgrp.getInclInStat()) && Objects.equals(getContoRimFin(), mtbSgrp.getContoRimFin()) && Objects.equals(getOrdinamento(), mtbSgrp.getOrdinamento()) && Objects.equals(getChkGiacenzaNeg(), mtbSgrp.getChkGiacenzaNeg()) && Objects.equals(getFlagReso(), mtbSgrp.getFlagReso());
|
||||
return Objects.equals(getCodMgrp(), mtbSgrp.getCodMgrp()) && Objects.equals(getCodMsgr(), mtbSgrp.getCodMsgr()) && Objects.equals(getDescrizione(), mtbSgrp.getDescrizione()) && Objects.equals(getInclInStat(), mtbSgrp.getInclInStat()) && Objects.equals(getContoRimFin(), mtbSgrp.getContoRimFin()) && Objects.equals(getOrdinamento(), mtbSgrp.getOrdinamento()) && Objects.equals(getChkGiacenzaNeg(), mtbSgrp.getChkGiacenzaNeg()) && Objects.equals(getFlagReso(), mtbSgrp.getFlagReso()) && Objects.equals(getFlagMiscela(), mtbSgrp.getFlagMiscela());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(getCodMgrp(), getCodMsgr(), getDescrizione(), getInclInStat(), getContoRimFin(), getOrdinamento(), getChkGiacenzaNeg(), getFlagReso());
|
||||
return Objects.hash(getCodMgrp(), getCodMsgr(), getDescrizione(), getInclInStat(), getContoRimFin(), getOrdinamento(), getChkGiacenzaNeg(), getFlagReso(), getFlagMiscela());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,6 +47,9 @@ public class VtbAuto extends EntityBase {
|
||||
@SqlField(value = "cod_bene", maxLength = 10)
|
||||
private String codBene;
|
||||
|
||||
@SqlField(value = "costo_aci")
|
||||
private BigDecimal costoAci;
|
||||
|
||||
@EntityChild
|
||||
private List<VtbAutoKm> vtbAutoKm = new ArrayList<>();
|
||||
|
||||
@@ -61,80 +64,99 @@ public class VtbAuto extends EntityBase {
|
||||
return codAuto;
|
||||
}
|
||||
|
||||
public void setCodAuto(String codAuto) {
|
||||
public VtbAuto setCodAuto(String codAuto) {
|
||||
this.codAuto = codAuto;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDescrizione() {
|
||||
return descrizione;
|
||||
}
|
||||
|
||||
public void setDescrizione(String descrizione) {
|
||||
public VtbAuto setDescrizione(String descrizione) {
|
||||
this.descrizione = descrizione;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getTarga() {
|
||||
return targa;
|
||||
}
|
||||
|
||||
public void setTarga(String targa) {
|
||||
public VtbAuto setTarga(String targa) {
|
||||
this.targa = targa;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getLicenza() {
|
||||
return licenza;
|
||||
}
|
||||
|
||||
public void setLicenza(String licenza) {
|
||||
public VtbAuto setLicenza(String licenza) {
|
||||
this.licenza = licenza;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getPortataQli() {
|
||||
return portataQli;
|
||||
}
|
||||
|
||||
public void setPortataQli(BigDecimal portataQli) {
|
||||
public VtbAuto setPortataQli(BigDecimal portataQli) {
|
||||
this.portataQli = portataQli;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getFlagAutomezzoTv() {
|
||||
return flagAutomezzoTv;
|
||||
}
|
||||
|
||||
public void setFlagAutomezzoTv(String flagAutomezzoTv) {
|
||||
public VtbAuto setFlagAutomezzoTv(String flagAutomezzoTv) {
|
||||
this.flagAutomezzoTv = flagAutomezzoTv;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getFlagInUso() {
|
||||
return flagInUso;
|
||||
}
|
||||
|
||||
public void setFlagInUso(String flagInUso) {
|
||||
public VtbAuto setFlagInUso(String flagInUso) {
|
||||
this.flagInUso = flagInUso;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodBene() {
|
||||
return codBene;
|
||||
}
|
||||
|
||||
public void setCodBene(String codBene) {
|
||||
public VtbAuto setCodBene(String codBene) {
|
||||
this.codBene = codBene;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getCostoAci() {
|
||||
return costoAci;
|
||||
}
|
||||
|
||||
public VtbAuto setCostoAci(BigDecimal costoAci) {
|
||||
this.costoAci = costoAci;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<VtbAutoKm> getVtbAutoKm() {
|
||||
return vtbAutoKm;
|
||||
}
|
||||
|
||||
public void setVtbAutoKm(List<VtbAutoKm> vtbAutoKm) {
|
||||
public VtbAuto setVtbAutoKm(List<VtbAutoKm> vtbAutoKm) {
|
||||
this.vtbAutoKm = vtbAutoKm;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<VtbAutoScad> getVtbAutoScad() {
|
||||
return vtbAutoScad;
|
||||
}
|
||||
|
||||
public void setVtbAutoScad(List<VtbAutoScad> vtbAutoScad) {
|
||||
public VtbAuto setVtbAutoScad(List<VtbAutoScad> vtbAutoScad) {
|
||||
this.vtbAutoScad = vtbAutoScad;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,16 +1,18 @@
|
||||
package it.integry.ems_model.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import it.integry.ems_model.annotation.PK;
|
||||
import it.integry.ems_model.annotation.SqlField;
|
||||
import it.integry.ems_model.annotation.Table;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import it.integry.ems_model.annotation.Table;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import it.integry.ems_model.annotation.SqlField;
|
||||
import it.integry.ems_model.annotation.FK;
|
||||
import java.util.Date;
|
||||
import java.math.BigDecimal;
|
||||
import it.integry.ems_model.annotation.PK;
|
||||
import it.integry.ems_model.annotation.Identity;
|
||||
import java.sql.Time;
|
||||
|
||||
@PropertyReactive
|
||||
@Table(VtbAutoKm.ENTITY)
|
||||
@@ -23,98 +25,192 @@ public class VtbAutoKm extends EntityBase {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@PK
|
||||
@PK()
|
||||
@Identity()
|
||||
@SqlField(value = "id", nullable = false)
|
||||
private Long id;
|
||||
|
||||
@SqlField(value = "cod_auto", maxLength = 5, nullable = false)
|
||||
@FK(tableName = VtbAuto.ENTITY, columnName = "cod_auto")
|
||||
private String codAuto;
|
||||
|
||||
@PK
|
||||
@SqlField(value = "cod_vvet", maxLength = 5, nullable = false)
|
||||
@SqlField(value = "cod_vvet", maxLength = 5)
|
||||
@FK(tableName = VtbVett.ENTITY, columnName = "cod_vvet")
|
||||
private String codVvet;
|
||||
|
||||
@PK
|
||||
@SqlField(value = "data_cons", nullable = false)
|
||||
private Date dataCons;
|
||||
|
||||
@SqlField(value = "km_inizio", nullable = false, defaultObjectValue = "0")
|
||||
private int kmInizio;
|
||||
@SqlField(value = "km_inizio", nullable = false)
|
||||
private Integer kmInizio;
|
||||
|
||||
@SqlField(value = "km_fine", nullable = false, defaultObjectValue = "0")
|
||||
private int kmFine;
|
||||
@SqlField(value = "km_fine", nullable = false)
|
||||
private Integer kmFine;
|
||||
|
||||
@SqlField(value = "qta_carb", nullable = false, defaultObjectValue = "0")
|
||||
@SqlField(value = "qta_carb", nullable = false)
|
||||
private BigDecimal qtaCarb;
|
||||
|
||||
@SqlField(value = "imp_carb", nullable = false, defaultObjectValue = "0")
|
||||
@SqlField(value = "imp_carb", nullable = false)
|
||||
private BigDecimal impCarb;
|
||||
|
||||
@SqlField(value = "luogo_partenza", maxLength = 40)
|
||||
private String luogoPartenza;
|
||||
|
||||
@SqlField(value = "user_name", maxLength = 40)
|
||||
@FK(tableName = StbUser.ENTITY, columnName = "user_name")
|
||||
private String userName;
|
||||
|
||||
@SqlField(value = "luogo_destinazione", maxLength = 40)
|
||||
private String luogoDestinazione;
|
||||
|
||||
@SqlField(value = "km_percorsi", nullable = false)
|
||||
private BigDecimal kmPercorsi;
|
||||
|
||||
@SqlField(value = "ora_partenza")
|
||||
private Time oraPartenza;
|
||||
|
||||
@SqlField(value = "ora_arrivo")
|
||||
private Time oraArrivo;
|
||||
|
||||
@SqlField(value = "note")
|
||||
private String note;
|
||||
|
||||
public VtbAutoKm() {
|
||||
super(logger);
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public VtbAutoKm setId(Long id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodAuto() {
|
||||
return codAuto;
|
||||
}
|
||||
|
||||
public void setCodAuto(String codAuto) {
|
||||
public VtbAutoKm setCodAuto(String codAuto) {
|
||||
this.codAuto = codAuto;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodVvet() {
|
||||
return codVvet;
|
||||
}
|
||||
|
||||
public void setCodVvet(String codVvet) {
|
||||
public VtbAutoKm setCodVvet(String codVvet) {
|
||||
this.codVvet = codVvet;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataCons() {
|
||||
return dataCons;
|
||||
}
|
||||
|
||||
public void setDataCons(Date dataCons) {
|
||||
public VtbAutoKm setDataCons(Date dataCons) {
|
||||
this.dataCons = dataCons;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getKmInizio() {
|
||||
public Integer getKmInizio() {
|
||||
return kmInizio;
|
||||
}
|
||||
|
||||
public void setKmInizio(int kmInizio) {
|
||||
public VtbAutoKm setKmInizio(Integer kmInizio) {
|
||||
this.kmInizio = kmInizio;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getKmFine() {
|
||||
public Integer getKmFine() {
|
||||
return kmFine;
|
||||
}
|
||||
|
||||
public void setKmFine(int kmFine) {
|
||||
public VtbAutoKm setKmFine(Integer kmFine) {
|
||||
this.kmFine = kmFine;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getQtaCarb() {
|
||||
return qtaCarb;
|
||||
}
|
||||
|
||||
public void setQtaCarb(BigDecimal qtaCarb) {
|
||||
public VtbAutoKm setQtaCarb(BigDecimal qtaCarb) {
|
||||
this.qtaCarb = qtaCarb;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getImpCarb() {
|
||||
return impCarb;
|
||||
}
|
||||
|
||||
public void setImpCarb(BigDecimal impCarb) {
|
||||
public VtbAutoKm setImpCarb(BigDecimal impCarb) {
|
||||
this.impCarb = impCarb;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getLuogoPartenza() {
|
||||
return luogoPartenza;
|
||||
}
|
||||
|
||||
public void setLuogoPartenza(String luogoPartenza) {
|
||||
public VtbAutoKm setLuogoPartenza(String luogoPartenza) {
|
||||
this.luogoPartenza = luogoPartenza;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public VtbAutoKm setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getLuogoDestinazione() {
|
||||
return luogoDestinazione;
|
||||
}
|
||||
|
||||
public VtbAutoKm setLuogoDestinazione(String luogoDestinazione) {
|
||||
this.luogoDestinazione = luogoDestinazione;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getKmPercorsi() {
|
||||
return kmPercorsi;
|
||||
}
|
||||
|
||||
public VtbAutoKm setKmPercorsi(BigDecimal kmPercorsi) {
|
||||
this.kmPercorsi = kmPercorsi;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Time getOraPartenza() {
|
||||
return oraPartenza;
|
||||
}
|
||||
|
||||
public VtbAutoKm setOraPartenza(Time oraPartenza) {
|
||||
this.oraPartenza = oraPartenza;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Time getOraArrivo() {
|
||||
return oraArrivo;
|
||||
}
|
||||
|
||||
public VtbAutoKm setOraArrivo(Time oraArrivo) {
|
||||
this.oraArrivo = oraArrivo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getNote() {
|
||||
return note;
|
||||
}
|
||||
|
||||
public VtbAutoKm setNote(String note) {
|
||||
this.note = note;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -361,6 +361,29 @@ then
|
||||
}
|
||||
end
|
||||
|
||||
rule "completeSerDocCtbMovt"
|
||||
no-loop
|
||||
when
|
||||
eval(completeRulesEnabled)
|
||||
$entity: CtbMovt((serDoc == null || serDoc == "" ) && dataDoc != null && codAnag != null && tipoAnag != null && codIreg != null && numIreg != null)
|
||||
then
|
||||
modify ( $entity ) {
|
||||
setSerDoc("/")
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
rule "completeSerDocCtbMovr"
|
||||
no-loop
|
||||
when
|
||||
eval(completeRulesEnabled)
|
||||
$entity: CtbMovr((serDoc == null || serDoc == "") && annoPart != null && codAnag != null && tipoAnag != null && numDoc != null)
|
||||
then
|
||||
modify ( $entity ) {
|
||||
setSerDoc("/")
|
||||
}
|
||||
end
|
||||
|
||||
rule "completeInsertCtbParr"
|
||||
no-loop
|
||||
when
|
||||
|
||||
@@ -75,14 +75,34 @@ public class StampaSchedaCostiJavabean extends BaseReportJavabean implements IRe
|
||||
" mtb_lisv_data.unt_mis_ven,\n" +
|
||||
" mtb_lisv_data.cod_vlis,\n" +
|
||||
" mtb_lisv_data.note,\n" +
|
||||
" mtb_lisv_data.prz_vend,\n" +
|
||||
" (mtb_lisv_data.prz_vend / mtb_lisv_data.rap_conv) / mtb_aart.peso_kg AS prz_vend_kg,\n" +
|
||||
" vtb_list.descrizione AS descr_lisv\n" +
|
||||
" mtb_lisv_data.prz_vend * \n" +
|
||||
" (1 - mtb_lisv_data.perc_sco1 / 100) *\n" +
|
||||
" (1 - mtb_lisv_data.perc_sco2 / 100) *\n" +
|
||||
" (1 - mtb_lisv_data.perc_sco3 / 100) *\n" +
|
||||
" (1 - mtb_lisv_data.perc_sco4 / 100) *\n" +
|
||||
" (1 - IsNull(vtb_clie.sconto1,0) / 100) *\n" +
|
||||
" (1 - IsNull(vtb_clie.sconto2,0) / 100) AS prz_vend,\n" +
|
||||
" ((mtb_lisv_data.prz_vend * \n" +
|
||||
" (1 - mtb_lisv_data.perc_sco1 / 100) * \n" +
|
||||
" (1 - mtb_lisv_data.perc_sco2 / 100) * \n" +
|
||||
" (1 - mtb_lisv_data.perc_sco3 / 100) * \n" +
|
||||
" (1 - mtb_lisv_data.perc_sco4 / 100) * \n" +
|
||||
" (1 - IsNull(vtb_clie.sconto1,0) / 100) *\n" +
|
||||
" (1 - IsNull(vtb_clie.sconto2,0) / 100) ) / mtb_lisv_data.rap_conv) / mtb_aart.peso_kg AS prz_vend_kg,\n" +
|
||||
" vtb_list.descrizione AS descr_lisv\n" +
|
||||
"FROM mtb_lisv_data\n" +
|
||||
" INNER JOIN mtb_aart ON mtb_lisv_data.cod_mart = mtb_aart.cod_mart\n" +
|
||||
" INNER JOIN vtb_list ON mtb_lisv_data.cod_vlis = vtb_list.cod_vlis\n" +
|
||||
" INNER 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\n" +
|
||||
" LEFT OUTER JOIN (SELECT cod_vlis, \n " +
|
||||
" MAX(sconto1) AS sconto1,\n" +
|
||||
" MAX(sconto2) AS sconto2,\n" +
|
||||
" COUNT(distinct sconto1 + sconto2) AS contasconti\n" +
|
||||
" FROM vtb_clie\n" +
|
||||
" WHERE cod_vlis IS NOT NULL\n" +
|
||||
" AND vtb_clie.flag_stato = 'A'\n" +
|
||||
" GROUP BY cod_vlis) vtb_clie ON vtb_clie.cod_vlis = vtb_list_data.cod_vlis and vtb_clie.contasconti = 1\n" +
|
||||
"WHERE system_note IS NOT NULL\n" +
|
||||
" AND mtb_lisv_data.cod_mart = %s\n" +
|
||||
" AND mtb_lisv_data.cod_vlis = %s\n" +
|
||||
|
||||
@@ -579,6 +579,7 @@ public class ActivityService {
|
||||
if (parentStbActivity == null) {
|
||||
throw new Exception("Nessun obiettivo o ticket trovato con l'ID: " + planActivityDTO.getActivityId());
|
||||
}
|
||||
boolean attvitaHelpDesk = parentStbActivity.getUserName().equalsIgnoreCase("T0003");
|
||||
|
||||
Date startDateParent = UtilityDate.getWeekStartDate(planActivityDTO.getAgenda().get(0).getData());
|
||||
Date endDateParent = UtilityDate.getWeekEndDate(planActivityDTO.getAgenda().get(planActivityDTO.getAgenda().size() - 1).getData());
|
||||
@@ -704,41 +705,56 @@ public class ActivityService {
|
||||
newStbActivity.setOperation(OperationType.INSERT);
|
||||
entityProcessor.processEntity(newStbActivity, true, multiDBTransactionManager);
|
||||
|
||||
if (!user.getUsername().equalsIgnoreCase(requestDataDTO.getUsername())) {
|
||||
sql = Query.format(
|
||||
"SELECT descrizione\n" +
|
||||
"FROM jtb_comt\n" +
|
||||
"WHERE cod_jcom = %s",
|
||||
newStbActivity.getCodJcom()
|
||||
);
|
||||
String commessa = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(conn, sql);
|
||||
List<String> utenti = new ArrayList<>();
|
||||
if (!user.getUsername().equalsIgnoreCase(requestDataDTO.getUsername()) ||
|
||||
attvitaHelpDesk) {
|
||||
if (attvitaHelpDesk) {
|
||||
utenti.add("F0003");
|
||||
utenti.add("F0237");
|
||||
utenti.add("F0060");
|
||||
} else
|
||||
utenti.add(user.getUsername());
|
||||
|
||||
sql = Query.format(
|
||||
"SELECT full_name\n" +
|
||||
"FROM stb_user\n" +
|
||||
"WHERE user_name = %s",
|
||||
requestDataDTO.getUsername()
|
||||
);
|
||||
String fullname = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(conn, sql);
|
||||
for (String utente : utenti) {
|
||||
|
||||
String title = String.format("Nuova attività pianificata su: %s", commessa);
|
||||
String message = String.format("Ti è stata pianificata un'attività da: %s (#%s)", fullname, newStbActivity.getActivityId());
|
||||
String link = String.format("/activity/task/%s", newStbActivity.getActivityId());
|
||||
sql = Query.format(
|
||||
"SELECT descrizione\n" +
|
||||
"FROM jtb_comt\n" +
|
||||
"WHERE cod_jcom = %s",
|
||||
newStbActivity.getCodJcom()
|
||||
);
|
||||
String commessa = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(conn, sql);
|
||||
|
||||
notificationService.sendNotificationToUserDevices(new MessageDTO()
|
||||
.setUserName(user.getUsername())
|
||||
.setAppName(WtbUserDeviceToken.AppName.TASK)
|
||||
.setNotification(new NotificationDTO()
|
||||
.setTitle(title)
|
||||
.setBody(message)
|
||||
)
|
||||
.setApns(new ApnsConfigDTO()
|
||||
.setAps(new ApsDTO()
|
||||
.setSound("default")
|
||||
.setContentAvailable(true)
|
||||
)
|
||||
)
|
||||
);
|
||||
sql = Query.format(
|
||||
"SELECT full_name\n" +
|
||||
"FROM stb_user\n" +
|
||||
"WHERE user_name = %s",
|
||||
utente
|
||||
);
|
||||
String fullname = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(conn, sql);
|
||||
|
||||
String title = String.format("Nuova attività pianificata su: %s", commessa);
|
||||
String message = String.format("Ti è stata pianificata un'attività da: %s (#%s)", fullname, newStbActivity.getActivityId());
|
||||
if (attvitaHelpDesk) {
|
||||
message = String.format("Il ticket #%s è stato pianificato all'utente %s", newStbActivity.getActivityId(), newStbActivity.getUserName());
|
||||
}
|
||||
String link = String.format("/activity/task/%s", newStbActivity.getActivityId());
|
||||
|
||||
notificationService.sendNotificationToUserDevices(new MessageDTO()
|
||||
.setUserName(user.getUsername())
|
||||
.setAppName(WtbUserDeviceToken.AppName.TASK)
|
||||
.setNotification(new NotificationDTO()
|
||||
.setTitle(title)
|
||||
.setBody(message)
|
||||
)
|
||||
.setApns(new ApnsConfigDTO()
|
||||
.setAps(new ApsDTO()
|
||||
.setSound("default")
|
||||
.setContentAvailable(true)
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1345,19 +1361,23 @@ public class ActivityService {
|
||||
);
|
||||
StbActivity oldActivity = UtilityDB.executeSimpleQueryOnlyFirstRowDTO(conn, sql, StbActivity.class);
|
||||
|
||||
if (oldActivity != null && !UtilityString.equalsIgnoreCase(oldActivity.getActivityResultId(), activity.getEsito())) {
|
||||
if (!activity.getEsito().equalsIgnoreCase(EmsRestConstants.NULL)) {
|
||||
List<String> utenti = new ArrayList<>();
|
||||
if (oldActivity != null && !UtilityString.equalsIgnoreCase(oldActivity.getActivityResultId(), activity.getEsito()) || oldActivity.getUserName().equalsIgnoreCase("T0003")) {
|
||||
boolean sendNotification = false;
|
||||
if (oldActivity.getUserName().equalsIgnoreCase("T0003")) {
|
||||
sendNotification = true;
|
||||
utenti.add("F0003");
|
||||
utenti.add("F0237");
|
||||
utenti.add("F0060");
|
||||
} else if (!activity.getEsito().equalsIgnoreCase(EmsRestConstants.NULL)) {
|
||||
sql = Query.format(
|
||||
"SELECT CAST(IIF(flag_invio_notifica = 'N', 0, 1) AS BIT)\n" +
|
||||
"FROM stb_activity_result\n" +
|
||||
"WHERE activity_result_id = %s",
|
||||
activity.getEsito()
|
||||
);
|
||||
boolean sendNotification = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(conn, sql);
|
||||
|
||||
sendNotification = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(conn, sql);
|
||||
if (sendNotification) {
|
||||
String username;
|
||||
|
||||
sql = Query.format(
|
||||
"SELECT cod_jflav_tec\n" +
|
||||
"FROM jtb_comt\n" +
|
||||
@@ -1368,11 +1388,15 @@ public class ActivityService {
|
||||
String responsabile = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(conn, sql);
|
||||
|
||||
if (responsabile != null) {
|
||||
username = responsabile;
|
||||
utenti.add(responsabile);
|
||||
} else {
|
||||
username = oldActivity.getUserCreator();
|
||||
utenti.add(oldActivity.getUserCreator());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (sendNotification && utenti.size() > 0) {
|
||||
for (String username : utenti) {
|
||||
if (username != null || (!username.equalsIgnoreCase(requestDataDTO.getUsername()))) {
|
||||
sql = Query.format(
|
||||
"SELECT full_name\n" +
|
||||
@@ -1382,9 +1406,14 @@ public class ActivityService {
|
||||
);
|
||||
String fullname = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(conn, sql);
|
||||
|
||||
String title = String.format("%s ha aggiornato un'attività", fullname);
|
||||
String message = String.format("L'attività: #%s è stata aggiornata con esito %s.", activity.getIdAttivita(), activity.getEsito());
|
||||
|
||||
String title, message;
|
||||
if ( oldActivity.getUserName().equalsIgnoreCase("T0003")) {
|
||||
title = String.format("%s ha aggiornato un'attività", fullname);
|
||||
message = String.format("L'attività: #%s ti è stata assegnata ", activity.getIdAttivita(), activity.getUserName());
|
||||
} else {
|
||||
title = String.format("%s ha aggiornato un'attività", fullname);
|
||||
message = String.format("L'attività: #%s è stata aggiornata con esito %s.", activity.getIdAttivita(), activity.getEsito());
|
||||
}
|
||||
notificationService.sendNotificationToUserDevices(new MessageDTO()
|
||||
.setUserName(username)
|
||||
.setAppName(WtbUserDeviceToken.AppName.TASK)
|
||||
@@ -1401,6 +1430,7 @@ public class ActivityService {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
package it.integry.ems.contabil.rimborsiKm.controller;
|
||||
|
||||
import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems.contabil.rimborsiKm.dto.RimborsiKmSaveRequestDTO;
|
||||
import it.integry.ems.contabil.rimborsiKm.service.RimborsiKmService;
|
||||
import it.integry.ems.order.crm.dto.transferProspect.CRMTransferProspectRequestDTO;
|
||||
import it.integry.ems.response.ServiceRestResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
@RestController
|
||||
@Scope("request")
|
||||
@RequestMapping("rimborsi-chilometrici")
|
||||
public class RimborsiKmController {
|
||||
|
||||
@Autowired
|
||||
private RimborsiKmService riborsiKmService;
|
||||
|
||||
@GetMapping(value = "retrieveVehicles")
|
||||
public ServiceRestResponse retrieveVehicles(@RequestParam(CommonConstants.PROFILE_DB) String config) throws Exception {
|
||||
|
||||
return ServiceRestResponse.createPositiveResponse(riborsiKmService.retrieveVehicles());
|
||||
}
|
||||
|
||||
@GetMapping(value = "retrieve")
|
||||
public ServiceRestResponse retrieve(@RequestParam(CommonConstants.PROFILE_DB) String config,
|
||||
@RequestParam() String userName,
|
||||
@RequestParam() @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate startDate,
|
||||
@RequestParam() @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate endDate) throws Exception {
|
||||
|
||||
return ServiceRestResponse.createPositiveResponse(riborsiKmService.retrieve(userName, startDate, endDate));
|
||||
}
|
||||
|
||||
@PostMapping(value = "save")
|
||||
public ServiceRestResponse save(@RequestParam(CommonConstants.PROFILE_DB) String config,
|
||||
@RequestBody RimborsiKmSaveRequestDTO request) throws Exception {
|
||||
|
||||
riborsiKmService.save(request);
|
||||
return ServiceRestResponse.createPositiveResponse();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
package it.integry.ems.contabil.rimborsiKm.dto;
|
||||
|
||||
import it.integry.ems_model.annotation.SqlField;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.Time;
|
||||
|
||||
public class RimborsiKmRetrieveResponseDTO {
|
||||
|
||||
@SqlField("cod_auto")
|
||||
private String codAuto;
|
||||
|
||||
@SqlField("descrizione_mezzo")
|
||||
private String descrizioneMezzo;
|
||||
|
||||
@SqlField("luogo_partenza")
|
||||
private String luogoPartenza;
|
||||
|
||||
@SqlField("ora_partenza")
|
||||
private Time oraPartenza;
|
||||
|
||||
@SqlField("km_inizio")
|
||||
private Integer kmInizio;
|
||||
|
||||
@SqlField("luogo_destinazione")
|
||||
private String luogoDestinazione;
|
||||
|
||||
@SqlField("ora_arrivo")
|
||||
private Time oraArrivo;
|
||||
|
||||
@SqlField("km_fine")
|
||||
private Integer kmFine;
|
||||
|
||||
@SqlField("km_percorsi")
|
||||
private BigDecimal kmPercorsi;
|
||||
|
||||
@SqlField("note")
|
||||
private String note;
|
||||
|
||||
public String getCodAuto() {
|
||||
return codAuto;
|
||||
}
|
||||
|
||||
public RimborsiKmRetrieveResponseDTO setCodAuto(String codAuto) {
|
||||
this.codAuto = codAuto;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDescrizioneMezzo() {
|
||||
return descrizioneMezzo;
|
||||
}
|
||||
|
||||
public RimborsiKmRetrieveResponseDTO setDescrizioneMezzo(String descrizioneMezzo) {
|
||||
this.descrizioneMezzo = descrizioneMezzo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getLuogoPartenza() {
|
||||
return luogoPartenza;
|
||||
}
|
||||
|
||||
public RimborsiKmRetrieveResponseDTO setLuogoPartenza(String luogoPartenza) {
|
||||
this.luogoPartenza = luogoPartenza;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Time getOraPartenza() {
|
||||
return oraPartenza;
|
||||
}
|
||||
|
||||
public RimborsiKmRetrieveResponseDTO setOraPartenza(Time oraPartenza) {
|
||||
this.oraPartenza = oraPartenza;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getKmInizio() {
|
||||
return kmInizio;
|
||||
}
|
||||
|
||||
public RimborsiKmRetrieveResponseDTO setKmInizio(Integer kmInizio) {
|
||||
this.kmInizio = kmInizio;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getLuogoDestinazione() {
|
||||
return luogoDestinazione;
|
||||
}
|
||||
|
||||
public RimborsiKmRetrieveResponseDTO setLuogoDestinazione(String luogoDestinazione) {
|
||||
this.luogoDestinazione = luogoDestinazione;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Time getOraArrivo() {
|
||||
return oraArrivo;
|
||||
}
|
||||
|
||||
public RimborsiKmRetrieveResponseDTO setOraArrivo(Time oraArrivo) {
|
||||
this.oraArrivo = oraArrivo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getKmFine() {
|
||||
return kmFine;
|
||||
}
|
||||
|
||||
public RimborsiKmRetrieveResponseDTO setKmFine(Integer kmFine) {
|
||||
this.kmFine = kmFine;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getKmPercorsi() {
|
||||
return kmPercorsi;
|
||||
}
|
||||
|
||||
public RimborsiKmRetrieveResponseDTO setKmPercorsi(BigDecimal kmPercorsi) {
|
||||
this.kmPercorsi = kmPercorsi;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getNote() {
|
||||
return note;
|
||||
}
|
||||
|
||||
public RimborsiKmRetrieveResponseDTO setNote(String note) {
|
||||
this.note = note;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package it.integry.ems.contabil.rimborsiKm.dto;
|
||||
|
||||
import it.integry.ems_model.annotation.SqlField;
|
||||
|
||||
public class RimborsiKmRetrieveVehiclesResponseDTO {
|
||||
|
||||
@SqlField("cod_auto")
|
||||
private String codAuto;
|
||||
|
||||
@SqlField("descrizione")
|
||||
private String descrizioneMezzo;
|
||||
|
||||
@SqlField("targa")
|
||||
private String targa;
|
||||
|
||||
@SqlField("costo_aci")
|
||||
private String costoAci;
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
package it.integry.ems.contabil.rimborsiKm.dto;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.Time;
|
||||
import java.util.Date;
|
||||
|
||||
public class RimborsiKmSaveRequestDTO {
|
||||
|
||||
private String userName;
|
||||
private String codAuto;
|
||||
private Date data;
|
||||
private String luogoPartenza;
|
||||
private Time oraPartenza;
|
||||
private Integer kmInizio;
|
||||
private String luogoDestinazione;
|
||||
private Time oraArrivo;
|
||||
private Integer kmFine;
|
||||
private BigDecimal kmPercorsi;
|
||||
private String note;
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public RimborsiKmSaveRequestDTO setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodAuto() {
|
||||
return codAuto;
|
||||
}
|
||||
|
||||
public RimborsiKmSaveRequestDTO setCodAuto(String codAuto) {
|
||||
this.codAuto = codAuto;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public RimborsiKmSaveRequestDTO setData(Date data) {
|
||||
this.data = data;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getLuogoPartenza() {
|
||||
return luogoPartenza;
|
||||
}
|
||||
|
||||
public RimborsiKmSaveRequestDTO setLuogoPartenza(String luogoPartenza) {
|
||||
this.luogoPartenza = luogoPartenza;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Time getOraPartenza() {
|
||||
return oraPartenza;
|
||||
}
|
||||
|
||||
public RimborsiKmSaveRequestDTO setOraPartenza(Time oraPartenza) {
|
||||
this.oraPartenza = oraPartenza;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getKmInizio() {
|
||||
return kmInizio;
|
||||
}
|
||||
|
||||
public RimborsiKmSaveRequestDTO setKmInizio(Integer kmInizio) {
|
||||
this.kmInizio = kmInizio;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getLuogoDestinazione() {
|
||||
return luogoDestinazione;
|
||||
}
|
||||
|
||||
public RimborsiKmSaveRequestDTO setLuogoDestinazione(String luogoDestinazione) {
|
||||
this.luogoDestinazione = luogoDestinazione;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Time getOraArrivo() {
|
||||
return oraArrivo;
|
||||
}
|
||||
|
||||
public RimborsiKmSaveRequestDTO setOraArrivo(Time oraArrivo) {
|
||||
this.oraArrivo = oraArrivo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getKmFine() {
|
||||
return kmFine;
|
||||
}
|
||||
|
||||
public RimborsiKmSaveRequestDTO setKmFine(Integer kmFine) {
|
||||
this.kmFine = kmFine;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getKmPercorsi() {
|
||||
return kmPercorsi;
|
||||
}
|
||||
|
||||
public RimborsiKmSaveRequestDTO setKmPercorsi(BigDecimal kmPercorsi) {
|
||||
this.kmPercorsi = kmPercorsi;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getNote() {
|
||||
return note;
|
||||
}
|
||||
|
||||
public RimborsiKmSaveRequestDTO setNote(String note) {
|
||||
this.note = note;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package it.integry.ems.contabil.rimborsiKm.service;
|
||||
|
||||
import it.integry.ems.contabil.rimborsiKm.dto.RimborsiKmRetrieveResponseDTO;
|
||||
import it.integry.ems.contabil.rimborsiKm.dto.RimborsiKmRetrieveVehiclesResponseDTO;
|
||||
import it.integry.ems.contabil.rimborsiKm.dto.RimborsiKmSaveRequestDTO;
|
||||
import it.integry.ems.license.LicenseStatusDTO;
|
||||
import it.integry.ems.service.EntityProcessor;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems_model.entity.VtbAuto;
|
||||
import it.integry.ems_model.entity.VtbAutoKm;
|
||||
import it.integry.ems_model.types.OperationType;
|
||||
import it.integry.ems_model.utility.Query;
|
||||
import it.integry.ems_model.utility.UtilityDB;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@Scope("request")
|
||||
public class RimborsiKmService {
|
||||
|
||||
@Autowired
|
||||
private MultiDBTransactionManager multiDBTransactionManager;
|
||||
|
||||
@Autowired
|
||||
private EntityProcessor entityProcessor;
|
||||
|
||||
public List<RimborsiKmRetrieveVehiclesResponseDTO> retrieveVehicles() throws Exception {
|
||||
String sql = Query.format(
|
||||
"SELECT * " +
|
||||
"FROM vtb_auto " +
|
||||
"WHERE flag_in_uso = 'S' " +
|
||||
"ORDER BY cod_auto"
|
||||
);
|
||||
|
||||
return UtilityDB.executeSimpleQueryDTO(multiDBTransactionManager.getPrimaryConnection(), sql, RimborsiKmRetrieveVehiclesResponseDTO.class);
|
||||
}
|
||||
|
||||
public List<RimborsiKmRetrieveResponseDTO> retrieve(String userName, LocalDate startDate, LocalDate endDate) throws Exception {
|
||||
String sql = Query.format(
|
||||
"SELECT vtb_auto.cod_auto,\n" +
|
||||
" descrizione AS descrizione_mezzo,\n" +
|
||||
" luogo_partenza,\n" +
|
||||
" ora_partenza,\n" +
|
||||
" km_inizio,\n" +
|
||||
" luogo_destinazione,\n" +
|
||||
" ora_arrivo,\n" +
|
||||
" km_fine,\n" +
|
||||
" km_percorsi,\n" +
|
||||
" note\n" +
|
||||
"FROM vtb_auto_km\n" +
|
||||
" INNER JOIN vtb_auto ON vtb_auto.cod_auto = vtb_auto_km.cod_auto\n" +
|
||||
"WHERE user_name = %s\n" +
|
||||
" AND data_cons >= %s\n" +
|
||||
" AND data_cons <= %s",
|
||||
userName, startDate, endDate
|
||||
);
|
||||
|
||||
return UtilityDB.executeSimpleQueryDTO(multiDBTransactionManager.getPrimaryConnection(), sql, RimborsiKmRetrieveResponseDTO.class);
|
||||
}
|
||||
|
||||
public void save(RimborsiKmSaveRequestDTO saveRequest) throws Exception {
|
||||
VtbAuto vtbAuto = new VtbAuto()
|
||||
.setCodAuto(saveRequest.getCodAuto());
|
||||
|
||||
VtbAutoKm vtbAutoKm = new VtbAutoKm()
|
||||
.setUserName(saveRequest.getUserName())
|
||||
.setCodAuto(saveRequest.getCodAuto())
|
||||
.setDataCons(saveRequest.getData())
|
||||
.setLuogoPartenza(saveRequest.getLuogoPartenza())
|
||||
.setOraPartenza(saveRequest.getOraPartenza())
|
||||
.setKmInizio(saveRequest.getKmInizio())
|
||||
.setLuogoDestinazione(saveRequest.getLuogoDestinazione())
|
||||
.setKmFine(saveRequest.getKmFine())
|
||||
.setOraArrivo(saveRequest.getOraArrivo())
|
||||
.setKmPercorsi(saveRequest.getKmPercorsi())
|
||||
.setNote(saveRequest.getNote());
|
||||
|
||||
vtbAuto.getVtbAutoKm().add(vtbAutoKm);
|
||||
vtbAuto.setOperation(OperationType.NO_OP);
|
||||
vtbAutoKm.setOperation(OperationType.INSERT_OR_UPDATE);
|
||||
|
||||
entityProcessor.processEntity(vtbAuto, multiDBTransactionManager);
|
||||
}
|
||||
}
|
||||
@@ -323,20 +323,12 @@ public class DocumentController {
|
||||
return listResponse;
|
||||
}
|
||||
|
||||
@RequestMapping(value = EmsRestConstants.PATH_GENERA_CORRISPETTIVI, method = RequestMethod.POST)
|
||||
@RequestMapping(value = "generaCorrispettivi", method = RequestMethod.POST)
|
||||
public @ResponseBody
|
||||
List<ServiceRestResponse> generaCorrispettivi(HttpServletRequest request,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String configuration) {
|
||||
List<ServiceRestResponse> listResponse = new ArrayList<ServiceRestResponse>();
|
||||
try {
|
||||
|
||||
List<EntityBase> entityList = generaCorrispettivi.generaCorrispettivi();
|
||||
listResponse.add(ServiceRestResponse.createPositiveResponse((Object) entityList));
|
||||
} catch (Exception e) {
|
||||
logger.error(request.getRequestURI(), e);
|
||||
listResponse.add(new ServiceRestResponse(EsitoType.KO, configuration, e));
|
||||
}
|
||||
return listResponse;
|
||||
ServiceRestResponse generaCorrispettivi(HttpServletRequest request,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String configuration) throws Exception {
|
||||
List<EntityBase> entityList = generaCorrispettivi.generaCorrispettivi();
|
||||
return ServiceRestResponse.createEntityPositiveResponse(entityList);
|
||||
}
|
||||
|
||||
@RequestMapping(value = EmsRestConstants.PATH_STORNA_SCONTRINO_DA_DOC, method = RequestMethod.POST)
|
||||
|
||||
@@ -271,7 +271,7 @@ public class SicilianiDMSExportService {
|
||||
" case when dtb_ordt_local.piattaforma2 is null then null else id_riga_contratto_piatt2 end , " +
|
||||
" case when dtb_ordt_local.piattaforma1 is null then 0 else round(costo_kg_con_piatt1 " + columnPercPesoOrdine + ", 5) end , " +
|
||||
" case when dtb_ordt_local.piattaforma2 is null then 0 else round(costo_kg_con_piatt2 " + columnPercPesoOrdine + ", 5) end, " +
|
||||
" dtb_ordt_local.id_scarico " +
|
||||
" ISNULL(dtb_ordt_local.id_scarico, 0) " +
|
||||
" from dtb_ordt_local INNER JOIN " + serverObject + ".dtb_ordt ON dtb_ordt_local.key_ord_alyante = dtb_ordt.key_ord COLLATE Latin1_General_100_CI_AS " +
|
||||
" LEFT OUTER JOIN (select distinct * from vtb_vett_orgcons_local )vtb_vett_orgcons_local ON dtb_ordt_local.id_viaggio = vtb_vett_orgcons_local.id_viaggio and " +
|
||||
" ISNULL(dtb_ordt_local.cod_vvet, '') = ISNULL(vtb_vett_orgcons_local.cod_vvet, '') and " +
|
||||
@@ -323,7 +323,7 @@ public class SicilianiDMSExportService {
|
||||
Integer idRigacontrattoPiatt2 = res.getInt(28);
|
||||
BigDecimal importoConPiatt1 = res.getBigDecimal(29);
|
||||
BigDecimal importoConPiatt2 = res.getBigDecimal(30);
|
||||
Integer idScarico = res.getInt(31);
|
||||
Integer idScarico = res.getInt(31);
|
||||
|
||||
// Verifica esistenza ordine
|
||||
Integer flagExistOrd = 0;
|
||||
@@ -397,7 +397,7 @@ public class SicilianiDMSExportService {
|
||||
" importoPiat2, " +
|
||||
" importoforfaitPiat1, " +
|
||||
" importoForfaitPiat2, " +
|
||||
" id_scarico)" +
|
||||
" priority)" +
|
||||
"VALUES (" + UtilityDB.valueToString(codiceDitta) + ", " +
|
||||
" " + UtilityDB.valueToString(keyOrdAlyante) + ", " +
|
||||
" " + UtilityDB.valueToString(keyOrd) + ", " +
|
||||
@@ -463,7 +463,7 @@ public class SicilianiDMSExportService {
|
||||
" importoPiat2 = " + UtilityDB.valueToString(importoPiatt2) + ", " +
|
||||
" importoForfaitPiat1 = " + UtilityDB.valueToString(importoConPiatt1) + ", " +
|
||||
" importoForfaitPiat2 = " + UtilityDB.valueToString(importoConPiatt2) + ", " +
|
||||
" id_scarico = " + UtilityDB.valueToString(idScarico) +
|
||||
" priority = " + UtilityDB.valueToString(idScarico) +
|
||||
" WHERE key_ord = " + UtilityDB.valueToString(keyOrdAlyante);
|
||||
}
|
||||
PreparedStatement infoUpd = conAlyante.prepareStatement(sql, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
|
||||
|
||||
@@ -41,7 +41,6 @@ public class Slim2kLogisticController {
|
||||
@RequestParam(value = "listcode", required = false) String listCode) {
|
||||
List<ServiceRestResponse> list = new ArrayList<ServiceRestResponse>();
|
||||
try {
|
||||
multiDBTransactionManager.setPrimaryDB(configuration);
|
||||
logger.debug(requestDataDTO.getUsername() + " " + requestDataDTO.getPassword() + " " + requestDataDTO.getProfileDB());
|
||||
list.add(ServiceRestResponse.createEntityPositiveResponse(slim2kLogisticService.importListeDiScarico(listType, listCode)));
|
||||
} catch (Exception e) {
|
||||
@@ -64,7 +63,6 @@ public class Slim2kLogisticController {
|
||||
List<ServiceRestResponse> list = new ArrayList<ServiceRestResponse>();
|
||||
try {
|
||||
logger.debug(requestDataDTO.getUsername() + " " + requestDataDTO.getPassword() + " " + requestDataDTO.getProfileDB());
|
||||
multiDBTransactionManager.setPrimaryDB(configuration);
|
||||
list.add(ServiceRestResponse.createEntityPositiveResponse(slim2kLogisticService.importListeDiCarico(scode, dcode, docdate, docnum, refdoc)));
|
||||
} catch (Exception e) {
|
||||
logger.error(request.getRequestURI(), e);
|
||||
|
||||
@@ -680,7 +680,7 @@ public class Slim2kLogisticService {
|
||||
.setCodMart((String) righeInv.get("item"))
|
||||
.setPartitaMag((String) righeInv.get("partita_mag"))
|
||||
.setDataScadPartitaMag((Date) righeInv.get("dataScad"))
|
||||
.setQtaInv((BigDecimal) righeInv.get("Giacenza"))
|
||||
.setQtaInv((BigDecimal) righeInv.get("giacenza"))
|
||||
.setZona((String) righeInv.get("location"));
|
||||
mtbInvent.getMtbInvenr().add(mtbInvenr);
|
||||
}
|
||||
|
||||
@@ -14,6 +14,8 @@ public class CRMTransferProspectResponseDTO {
|
||||
private CtbAnag ctbAnag;
|
||||
|
||||
private AnagClieDTO anagClie;
|
||||
private List<VtbDest> vtbDest;
|
||||
private List<VtbCliePersRif> vtbCliePersRif;
|
||||
|
||||
private List<WdtbOrdt> wdtbOrdts = new ArrayList<>();
|
||||
private List<JtbComt> jtbComts = new ArrayList<>();
|
||||
@@ -57,6 +59,24 @@ public class CRMTransferProspectResponseDTO {
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<VtbDest> getVtbDest() {
|
||||
return vtbDest;
|
||||
}
|
||||
|
||||
public CRMTransferProspectResponseDTO setVtbDest(List<VtbDest> vtbDest) {
|
||||
this.vtbDest = vtbDest;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<VtbCliePersRif> getVtbCliePersRif() {
|
||||
return vtbCliePersRif;
|
||||
}
|
||||
|
||||
public CRMTransferProspectResponseDTO setVtbCliePersRif(List<VtbCliePersRif> vtbCliePersRif) {
|
||||
this.vtbCliePersRif = vtbCliePersRif;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<WdtbOrdt> getWdtbOrdts() {
|
||||
return wdtbOrdts;
|
||||
}
|
||||
@@ -103,8 +123,12 @@ public class CRMTransferProspectResponseDTO {
|
||||
}
|
||||
|
||||
public List<EntityBase> getEntityToProcess() {
|
||||
return getEntityToProcess(true);
|
||||
}
|
||||
|
||||
public List<EntityBase> getEntityToProcess(boolean includeGtbAnag) {
|
||||
List<EntityBase> entities = new ArrayList<>();
|
||||
if (gtbAnag != null) {
|
||||
if (gtbAnag != null && includeGtbAnag) {
|
||||
entities.add(gtbAnag);
|
||||
}
|
||||
|
||||
|
||||
@@ -524,51 +524,29 @@ public class CrmService {
|
||||
}
|
||||
|
||||
public CRMTransferProspectResponseDTO transferProspect(CRMTransferProspectRequestDTO request) throws Exception {
|
||||
Connection conn = multiDBTransactionManager.getPrimaryConnection();
|
||||
CRMTransferProspectResponseDTO transferProspectResponse =
|
||||
CRMUtility.prospectToClie(
|
||||
multiDBTransactionManager.getPrimaryConnection(), request.getCodAnag(), request.getCodPpro()
|
||||
conn , request.getCodAnag(), request.getCodPpro()
|
||||
);
|
||||
|
||||
try {
|
||||
entityProcessor.processEntityList(transferProspectResponse.getEntityToProcess(), multiDBTransactionManager, true);
|
||||
transferProspectResponse.setCodAnag(transferProspectResponse.getGtbAnag().getCodAnag());
|
||||
GtbAnag gtbAnag = transferProspectResponse.getGtbAnag();
|
||||
entityProcessor.processEntity(gtbAnag, multiDBTransactionManager, true);
|
||||
String codAnag = gtbAnag.getCodAnag();
|
||||
transferProspectResponse.setCodAnag(codAnag);
|
||||
|
||||
String sql = Query.format(
|
||||
"SELECT gtb_anag.cod_anag,\n" +
|
||||
" vtb_clie.cod_vtip,\n" +
|
||||
" vtb_clie.cod_vage,\n" +
|
||||
" vtb_clie.flag_stato,\n" +
|
||||
" rag_soc,\n" +
|
||||
" indirizzo,\n" +
|
||||
" cap,\n" +
|
||||
" citta,\n" +
|
||||
" prov,\n" +
|
||||
" nazione,\n" +
|
||||
" telefono,\n" +
|
||||
" fax,\n" +
|
||||
" part_iva,\n" +
|
||||
" cod_fisc,\n" +
|
||||
" gtb_anag.note,\n" +
|
||||
" persona_rif,\n" +
|
||||
" e_mail,\n" +
|
||||
" nome,\n" +
|
||||
" data_ins,\n" +
|
||||
" num_cell,\n" +
|
||||
" e_mail_pec,\n" +
|
||||
" cognome,\n" +
|
||||
" diacod,\n" +
|
||||
" lat,\n" +
|
||||
" lng,\n" +
|
||||
" data_mod\n" +
|
||||
"FROM gtb_anag\n" +
|
||||
" INNER JOIN vtb_clie ON gtb_anag.cod_anag = vtb_clie.cod_anag\n" +
|
||||
"WHERE gtb_anag.cod_anag = %s",
|
||||
transferProspectResponse.getCodAnag()
|
||||
entityProcessor.processEntityList(
|
||||
CRMUtility.addNewClieToOldEntity(transferProspectResponse, codAnag, request.getCodPpro(), conn).getEntityToProcess(false),
|
||||
multiDBTransactionManager, true
|
||||
);
|
||||
|
||||
transferProspectResponse.setAnagClie(UtilityDB.executeSimpleQueryOnlyFirstRowDTO(
|
||||
multiDBTransactionManager.getPrimaryConnection(), sql, AnagClieDTO.class
|
||||
));
|
||||
CRMSyncResponseDTO crmSyncResponse = retrieveClienti(new CRMAnagRequestDTO().setCodAnag(codAnag));
|
||||
if (!crmSyncResponse.getAnagClie().isEmpty()){
|
||||
transferProspectResponse.setAnagClie(crmSyncResponse.getAnagClie().get(0));
|
||||
}
|
||||
transferProspectResponse.setVtbDest(crmSyncResponse.getVtbDest());
|
||||
transferProspectResponse.setVtbCliePersRif(crmSyncResponse.getVtbCliePersRif());
|
||||
|
||||
return transferProspectResponse;
|
||||
} catch (Exception e) {
|
||||
@@ -889,13 +867,13 @@ public class CrmService {
|
||||
|
||||
String sql = "SELECT * FROM ptb_pros WHERE cod_anag IS NULL";
|
||||
if (requestDTO.getFilterDate() != null)
|
||||
sql = UtilityDB.addwhereCond(sql, " AND data_ins >= " + UtilityDB.valueToString(requestDTO.getFilterDate()), false);
|
||||
sql = UtilityDB.addwhereCond(sql, "data_ins >= " + UtilityDB.valueToString(requestDTO.getFilterDate()), false);
|
||||
|
||||
if (requestDTO.getPartitaIva() != null)
|
||||
sql = UtilityDB.addwhereCond(sql, " AND part_iva = " + UtilityDB.valueToString(requestDTO.getPartitaIva()), false);
|
||||
sql = UtilityDB.addwhereCond(sql, "part_iva = " + UtilityDB.valueToString(requestDTO.getPartitaIva()), false);
|
||||
|
||||
if (requestDTO.getCodPpro() != null)
|
||||
sql = UtilityDB.addwhereCond(sql, " AND cod_ppro = " + UtilityDB.valueToString(requestDTO.getCodPpro()), false);
|
||||
sql = UtilityDB.addwhereCond(sql, "cod_ppro = " + UtilityDB.valueToString(requestDTO.getCodPpro()), false);
|
||||
|
||||
taskSyncResponse.setPtbPros(
|
||||
UtilityDB.executeSimpleQueryDTO(multiDBTransactionManager.getPrimaryConnection(), sql, PtbPros.class)
|
||||
@@ -982,6 +960,10 @@ public class CrmService {
|
||||
sql = "SELECT *\n" +
|
||||
"FROM vtb_dest\n" +
|
||||
"WHERE EXISTS(SELECT * FROM vtb_clie WHERE vtb_clie.cod_anag = vtb_dest.cod_anag)";
|
||||
|
||||
if (requestDTO.getCodAnag() != null)
|
||||
sql = UtilityDB.addwhereCond(sql, "cod_anag = " + UtilityDB.valueToString(requestDTO.getCodAnag()), false);
|
||||
|
||||
taskSyncResponse.setVtbDest(
|
||||
UtilityDB.executeSimpleQueryDTO(multiDBTransactionManager.getPrimaryConnection(), sql, VtbDest.class)
|
||||
);
|
||||
@@ -989,6 +971,10 @@ public class CrmService {
|
||||
sql = "SELECT *\n" +
|
||||
"FROM vtb_clie_pers_rif\n" +
|
||||
"WHERE EXISTS(SELECT * FROM vtb_clie WHERE vtb_clie.cod_anag = vtb_clie_pers_rif.cod_anag)";
|
||||
|
||||
if (requestDTO.getCodAnag() != null)
|
||||
sql = UtilityDB.addwhereCond(sql, "cod_anag = " + UtilityDB.valueToString(requestDTO.getCodAnag()), false);
|
||||
|
||||
taskSyncResponse.setVtbCliePersRif(
|
||||
UtilityDB.executeSimpleQueryDTO(multiDBTransactionManager.getPrimaryConnection(), sql, VtbCliePersRif.class)
|
||||
);
|
||||
|
||||
@@ -313,38 +313,13 @@ public class CRMUtility {
|
||||
}
|
||||
|
||||
public static CRMTransferProspectResponseDTO prospectToClie(Connection conn, String codAnag, String codPpro) throws Exception {
|
||||
if (UtilityString.isNullOrEmpty(codAnag))
|
||||
throw new Exception("Codice cliente da generare obbligatorio");
|
||||
|
||||
if (UtilityString.isNullOrEmpty(codPpro))
|
||||
throw new Exception("Codice prospect da trasferire in anagrafica obbligatorio");
|
||||
|
||||
CRMTransferProspectResponseDTO response = new CRMTransferProspectResponseDTO();
|
||||
|
||||
//Verifica esistenza prospect
|
||||
String sql = Query.format(
|
||||
"SELECT CAST(COUNT(*) AS BIT)\n" +
|
||||
"FROM ptb_pros\n" +
|
||||
"WHERE cod_ppro = %s",
|
||||
codPpro
|
||||
);
|
||||
boolean existingCodPpro = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(conn, sql);
|
||||
if (!existingCodPpro)
|
||||
throw new Exception("Codice prospect inesistente (" + codPpro + ")");
|
||||
|
||||
//Verifica esisteza cliente
|
||||
sql = Query.format(
|
||||
"SELECT CAST(COUNT(*) AS BIT)\n" +
|
||||
"FROM gtb_anag\n" +
|
||||
"WHERE cod_anag = %s",
|
||||
codAnag
|
||||
);
|
||||
boolean existingCodAnag = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(conn, sql);
|
||||
if (existingCodAnag)
|
||||
throw new Exception("Codice cliente già esistente (" + codAnag + ")");
|
||||
|
||||
//Verifica esistenza cliente trasformato in prospect
|
||||
sql = Query.format(
|
||||
String sql = Query.format(
|
||||
"SELECT cod_anag\n" +
|
||||
"FROM ptb_pros\n" +
|
||||
"WHERE cod_ppro = %s\n" +
|
||||
@@ -355,10 +330,33 @@ public class CRMUtility {
|
||||
if (!UtilityString.isNullOrEmpty(codAnagInPtbPros))
|
||||
throw new Exception("Codice prospect già trasferito in anagrafica (Codice cliente: " + codAnagInPtbPros + ")");
|
||||
|
||||
//Verifica esistenza prospect
|
||||
sql = Query.format(
|
||||
"SELECT CAST(COUNT(*) AS BIT)\n" +
|
||||
"FROM ptb_pros\n" +
|
||||
"WHERE cod_ppro = %s",
|
||||
codPpro
|
||||
);
|
||||
boolean existingCodPpro = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(conn, sql);
|
||||
if (!existingCodPpro)
|
||||
throw new Exception("Codice prospect inesistente (" + codPpro + ")");
|
||||
|
||||
//Verifica esisteza cliente
|
||||
if (codAnag != null) {
|
||||
sql = Query.format(
|
||||
"SELECT CAST(COUNT(*) AS BIT)\n" +
|
||||
"FROM gtb_anag\n" +
|
||||
"WHERE cod_anag = %s",
|
||||
codAnag
|
||||
);
|
||||
boolean existingCodAnag = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(conn, sql);
|
||||
if (existingCodAnag)
|
||||
throw new Exception("Codice cliente già esistente (" + codAnag + ")");
|
||||
}
|
||||
|
||||
//Acquisizione dati anagrafici
|
||||
sql = Query.format(
|
||||
"SELECT %s AS cod_anag,\n" +
|
||||
" ptb_pros.rag_soc,\n" +
|
||||
"SELECT ptb_pros.rag_soc,\n" +
|
||||
" ptb_pros.indirizzo,\n" +
|
||||
" ptb_pros.cap,\n" +
|
||||
" ptb_pros.citta,\n" +
|
||||
@@ -371,19 +369,16 @@ public class CRMUtility {
|
||||
" ptb_pros.note,\n" +
|
||||
" ptb_pros.e_mail,\n" +
|
||||
" ptb_pros.rag_soc2,\n" +
|
||||
" ptb_pros.persona_rif,\n" +
|
||||
" 'S' AS allegato,\n" +
|
||||
" 'G' AS flag_persona_fg,\n" +
|
||||
" 0 AS classe_merito\n" +
|
||||
" ptb_pros.persona_rif\n" +
|
||||
"FROM ptb_pros\n" +
|
||||
"WHERE cod_ppro = %s",
|
||||
codAnag, codPpro
|
||||
codPpro
|
||||
);
|
||||
GtbAnag gtbAnag = UtilityDB.executeSimpleQueryOnlyFirstRowDTO(conn, sql, GtbAnag.class);
|
||||
gtbAnag.setCodAnag(codAnag);
|
||||
gtbAnag.setOperation(OperationType.INSERT);
|
||||
|
||||
CtbAnag ctbAnag = new CtbAnag()
|
||||
.setCodCcon(getCodCcon(conn));
|
||||
CtbAnag ctbAnag = new CtbAnag().setCodCcon(getCodCcon(conn));
|
||||
ctbAnag.setOperation(OperationType.INSERT);
|
||||
gtbAnag.setCtbAnag(ctbAnag);
|
||||
|
||||
@@ -399,13 +394,7 @@ public class CRMUtility {
|
||||
" ptb_pros.cod_cab,\n" +
|
||||
" ptb_pros.cod_paga,\n" +
|
||||
" ptb_pros.cod_vlis,\n" +
|
||||
" ISNULL(ptb_pros.sconto1, 0),\n" +
|
||||
" ISNULL(ptb_pros.sconto2, 0),\n" +
|
||||
" ptb_pros.cod_aliq,\n" +
|
||||
" 0 AS fido,\n" +
|
||||
" 'S' AS flag_spese,\n" +
|
||||
" 0 AS perc_prov,\n" +
|
||||
" 'A' AS flag_stato,\n" +
|
||||
" 'GIORNALIERA' AS period_fat,\n" +
|
||||
" 'SINGOLA BOLLA' AS tipo_fat_dif,\n" +
|
||||
" ptb_pros.fonte,\n" +
|
||||
@@ -467,8 +456,15 @@ public class CRMUtility {
|
||||
gtbAnag.setVtbCliePersRif(persRif);
|
||||
}
|
||||
|
||||
response.setGtbAnag(gtbAnag);
|
||||
|
||||
if (codAnag == null) return response;
|
||||
else return addNewClieToOldEntity(response, codAnag, codPpro, conn);
|
||||
}
|
||||
|
||||
public static CRMTransferProspectResponseDTO addNewClieToOldEntity(CRMTransferProspectResponseDTO response, String codAnag, String codPpro, Connection conn) throws Exception {
|
||||
//Assegnazione nuovo cliente a eventuali offerte
|
||||
sql = Query.format(
|
||||
String sql = Query.format(
|
||||
"SELECT *\n" +
|
||||
"FROM ptb_prevt\n" +
|
||||
"WHERE cod_ppro = %s",
|
||||
@@ -550,8 +546,6 @@ public class CRMUtility {
|
||||
response.getWdtbOrdts().addAll(wdtbOrdtToUpdate);
|
||||
}
|
||||
|
||||
response.setGtbAnag(gtbAnag);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
@@ -76,7 +76,11 @@ public class Slim2kService {
|
||||
"wnet," +
|
||||
"timeduration," +
|
||||
"ratetolerance," +
|
||||
"mintake)" +
|
||||
"mintake," +
|
||||
"freefield1," +
|
||||
"freefield2," +
|
||||
"freefield3," +
|
||||
"freefield4 )" +
|
||||
"SELECT 'FOD'," +
|
||||
" mtb_aart.cod_mart," +
|
||||
" 'I'," +
|
||||
@@ -104,8 +108,15 @@ public class Slim2kService {
|
||||
" CONVERT(NUMERIC(10, 3), (mtb_aart.peso_kg * mtb_aart.qta_cnf)) END AS PesoNettoPz," +
|
||||
" mtb_aart.gg_scad_partita," +
|
||||
" IsNull(rate_to_tolerance, 10)," +
|
||||
" IIF(mtb_part.scorta_min IS NULL, 0, mtb_part.scorta_min) AS scorta_min " +
|
||||
" IIF(mtb_part.scorta_min IS NULL, 0, mtb_part.scorta_min) AS scorta_min, " +
|
||||
" LEFT(mtb_grup.descrizione, 16) , " +
|
||||
" LEFT(mtb_sgrp.descrizione, 16) , " +
|
||||
" mtb_aart.cod_msfa, " +
|
||||
" LEFT(mtb_sfam.descrizione, 16) " +
|
||||
"FROM format.dbo.mtb_aart" +
|
||||
" INNER JOIN format.dbo.mtb_grup ON mtb_aart.cod_mgrp = mtb_grup.cod_mgrp \n"+
|
||||
" INNER JOIN format.dbo.mtb_sgrp ON mtb_aart.cod_mgrp = mtb_sgrp.cod_mgrp AND mtb_aart.cod_msgr = mtb_sgrp.cod_msgr\n"+
|
||||
" LEFT OUTER JOIN format.dbo.mtb_sfam ON mtb_aart.cod_mgrp = mtb_sfam.cod_mgrp AND mtb_aart.cod_msgr = mtb_sfam.cod_msgr AND mtb_aart.cod_msfa = mtb_sfam.cod_msfa \n"+
|
||||
" LEFT OUTER JOIN format.dbo.mtb_part ON mtb_aart.cod_mart = mtb_part.cod_mart AND mtb_part.cod_mdep = " + UtilityDB.valueToString(codMdep) +
|
||||
" LEFT OUTER JOIN format.dbo.mtb_shelf_life_tolerance ON mtb_aart.cod_mgrp = mtb_shelf_life_tolerance.cod_mgrp AND \n" +
|
||||
" mtb_aart.gg_scad_partita between mtb_shelf_life_tolerance.shelf_life_min and mtb_shelf_life_tolerance.shelf_life_max " +
|
||||
|
||||
@@ -479,7 +479,7 @@ public class Lisv4LisaService {
|
||||
if (!mtbLisvDataListDel.isEmpty()) {
|
||||
entityList.addAll(mtbLisvDataListDel);
|
||||
|
||||
List<MtbAart> arts = mtbLisvDataListDel.stream().map(x -> {
|
||||
/*List<MtbAart> arts = mtbLisvDataListDel.stream().map(x -> {
|
||||
MtbAart mtbAart = new MtbAart()
|
||||
.setCodMart(x.getCodMart())
|
||||
.setFlagStato("I");
|
||||
@@ -488,7 +488,7 @@ public class Lisv4LisaService {
|
||||
}).collect(Collectors.toList());
|
||||
if (!arts.isEmpty()) {
|
||||
entityList.addAll(arts);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -151,12 +151,6 @@ public class ContrattiDiAcquistoHandlerService {
|
||||
List<EntityBase> ret = entityProcessor.processEntityList(atbOfftsToSave, mdb, false, RequestDataDTO.systemMockupData());
|
||||
UtilityEntity.throwEntitiesException(ret);
|
||||
|
||||
/*
|
||||
mailService.sendSystemErrorLog("[" + multiDBTransactionManager.getPrimaryDatasource().getDbName() + " - " + azienda.getNomeDitta() + "][" + UtilityServer.getHostName() + "] Verifica autofatture ",
|
||||
"Verifica autofatture",
|
||||
"Sull'azienda " + azienda.getNomeDitta() + " non è presente nessuna email con flag default contabilità, non sarà possibile inviare la mail di verifica.",
|
||||
(String) null, new Date());
|
||||
*/
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -708,7 +708,7 @@ public class VariazioniPvService {
|
||||
"FROM vtb_list_data\n" +
|
||||
" INNER JOIN mtb_lisv_data\n" +
|
||||
" ON ISNULL(vtb_list_data.cod_vlis_rif, vtb_list_data.cod_vlis) = mtb_lisv_data.cod_vlis AND\n" +
|
||||
" vtb_list_data.versione = mtb_lisv_data.versione\n" +
|
||||
" ISNULL(vtb_list_data.versione_rif, vtb_list_data.versione) = mtb_lisv_data.versione\n" +
|
||||
"WHERE vtb_list_data.data_iniz = '[DATA_VALIDITA]'\n" +
|
||||
" AND vtb_list_data.cod_vlis = '[COD_VLIS]'\n" +
|
||||
" AND vtb_list_data.cod_promo IS NULL\n" +
|
||||
@@ -803,7 +803,7 @@ public class VariazioniPvService {
|
||||
"FROM vtb_list_data\n" +
|
||||
" INNER JOIN mtb_lisv_data\n" +
|
||||
" ON ISNULL(vtb_list_data.cod_vlis_rif, vtb_list_data.cod_vlis) = mtb_lisv_data.cod_vlis AND\n" +
|
||||
" vtb_list_data.versione = mtb_lisv_data.versione\n" +
|
||||
" ISNULL(vtb_list_data.versione_rif, vtb_list_data.versione) = mtb_lisv_data.versione\n" +
|
||||
" INNER JOIN vtb_promo ON vtb_list_data.cod_promo = vtb_promo.cod_promo\n" +
|
||||
"WHERE vtb_list_data.cod_vlis = '[COD_VLIS]'\n" +
|
||||
" AND (vtb_list_data.data_iniz = '[DATA_VALIDITA]' \n" +
|
||||
|
||||
@@ -61,4 +61,17 @@ public class GiacenzaController {
|
||||
giacenzaService.archiviazioneGiornaliera();
|
||||
return ServiceRestResponse.createPositiveResponse();
|
||||
}
|
||||
|
||||
@RequestMapping(value = "fill", method = RequestMethod.POST)
|
||||
public @ResponseBody
|
||||
ServiceRestResponse popolamentoTabellaGiacenza(@RequestParam(CommonConstants.PROFILE_DB) String profileDB,
|
||||
@RequestParam(required = false) String codMdep) throws Exception {
|
||||
|
||||
try {
|
||||
giacenzaService.popolaGiacenzaDaInventario(codMdep);
|
||||
return ServiceRestResponse.createPositiveResponse();
|
||||
} catch (Exception e) {
|
||||
return ServiceRestResponse.createNegativeResponse(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -782,20 +782,6 @@ public class PvmController {
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value = "popolaGiancezaDaInventario", method = RequestMethod.POST)
|
||||
public @ResponseBody
|
||||
ServiceRestResponse popolaGiacenzaDaInventario(@RequestParam(CommonConstants.PROFILE_DB) String profileDB,
|
||||
@RequestParam(required = false) String codMdep) throws Exception {
|
||||
|
||||
try {
|
||||
giacenzaService.popolaGiacenzaDaInventario(codMdep);
|
||||
return ServiceRestResponse.createPositiveResponse();
|
||||
} catch (Exception e) {
|
||||
return ServiceRestResponse.createNegativeResponse(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "pvm/gestione/{section}/permessi", method = RequestMethod.POST)
|
||||
public @ResponseBody
|
||||
ServiceRestResponse retrieveUserAuthorizations(@RequestParam(CommonConstants.PROFILE_DB) String profileDB,
|
||||
|
||||
@@ -146,7 +146,7 @@ public class SmartEnterpriseService {
|
||||
" ISNULL(' - ' + vtb_dest.destinatario, '') +\n" +
|
||||
" ISNULL(' - ' + vtb_dest.indirizzo, '') +\n" +
|
||||
" ISNULL(', ' + vtb_dest.citta, ''),\n" +
|
||||
" ISNULL(mtb_depo.descrizione, vtb_dest.destinatario)) AS destinazione,\n" +
|
||||
" ISNULL(mtb_depo.cod_mdep + ' - ' + mtb_depo.descrizione, vtb_dest.destinatario)) AS destinazione,\n" +
|
||||
" gtb_anag.cod_anag,\n" +
|
||||
" vtb_dest.cod_vdes,\n" +
|
||||
" CASE\n" +
|
||||
|
||||
@@ -110,8 +110,8 @@ public class BilanceService {
|
||||
UtilityEntity.throwEntitiesException(entityList);
|
||||
|
||||
// Move a file to imported directory
|
||||
// File importedFile = new File(pathFileImported + File.separator + fileName);
|
||||
// FileUtils.moveFile(file, importedFile);
|
||||
File importedFile = new File(pathFileImported + File.separator + fileName);
|
||||
FileUtils.moveFile(file, importedFile);
|
||||
|
||||
returnList.addAll(entityList);
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import it.integry.ems.exception.PrimaryDatabaseNotPresentException;
|
||||
import it.integry.ems.expansion.RunnableThrowable;
|
||||
import it.integry.ems.javabeans.RequestDataDTO;
|
||||
import it.integry.ems.json.ResponseJSONObjectMapper;
|
||||
import it.integry.ems.retail.dto.GiacenzaDTO;
|
||||
import it.integry.ems.retail.pvmRetail.service.PvmService;
|
||||
import it.integry.ems.service.EntityProcessor;
|
||||
@@ -771,7 +772,7 @@ public class GiacenzaService {
|
||||
"\n" +
|
||||
" , doc AS (SELECT wdtb_doct.cod_mdep,\n" +
|
||||
" wdtb_docr.cod_mart,\n" +
|
||||
" wdtb_docr.qta_doc\n" +
|
||||
" sum(wdtb_docr.qta_doc) as qta_doc \n" +
|
||||
" FROM wdtb_doct\n" +
|
||||
" INNER JOIN wdtb_docr ON wdtb_doct.cod_dtip = wdtb_docr.cod_dtip\n" +
|
||||
" AND wdtb_docr.cod_anag = wdtb_doct.cod_anag\n" +
|
||||
@@ -781,7 +782,9 @@ public class GiacenzaService {
|
||||
" AND wdtb_docr.cod_mart IS NOT NULL\n" +
|
||||
(listini != null && !listini.isEmpty() ? " AND wdtb_doct.listino IN (" + UtilityDB.listValueToString(listini) + ")\n" : "") +
|
||||
" WHERE wdtb_doct.cod_mdep = " + UtilityDB.valueToString(codMdep) + "\n" +
|
||||
" AND wdtb_doct.flag_elaborato = 'I')\n" +
|
||||
" AND wdtb_doct.flag_elaborato = 'I'" +
|
||||
" GROUP BY wdtb_doct.cod_mdep,\n" +
|
||||
" wdtb_docr.cod_mart )\n" +
|
||||
"\n" +
|
||||
"SELECT ISNULL(doc.cod_mdep, ordine.cod_mdep) AS cod_mdep,\n" +
|
||||
" ISNULL(doc.cod_mart, ordine.cod_mart) AS cod_mart,\n" +
|
||||
@@ -807,13 +810,20 @@ public class GiacenzaService {
|
||||
}
|
||||
}
|
||||
|
||||
if ( codMdep.equalsIgnoreCase("LA")) {
|
||||
String pathFile = UtilityDirs.getEmsApiTempDirectoryPath() + File.separator + "Giacenza_" + codMdep + File.separator;
|
||||
String fileName = codMdep + "_" + new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date()) + ".json";
|
||||
StringWriter writer = new StringWriter();
|
||||
new ObjectMapper().writeValue(writer, listGiacenza);
|
||||
String contentBody = writer.toString();
|
||||
UtilityFile.saveFile(pathFile, fileName, contentBody);
|
||||
boolean saveBackup = setupGest.getSetupDepoBoolean("DATI_AZIENDA", "GIACENZA_DA_INV", "ATTIVA_LOG", codMdep);
|
||||
|
||||
if ( saveBackup &&
|
||||
listGiacenza.stream().anyMatch(x->x.getQtaInv().compareTo(BigDecimal.ZERO) < 0)) {
|
||||
List<String> elencoArticoli =
|
||||
listGiacenza.stream()
|
||||
.filter(x -> x.getQtaInv().compareTo(BigDecimal.ZERO) < 0).map(GiacenzaDTO::getCodMart).collect(Collectors.toList());
|
||||
|
||||
multiDBTransactionManager.prepareStatement(
|
||||
"INSERT INTO carelli_giacenza_prog_bck " +
|
||||
"SELECT getDate(), * " +
|
||||
"FROM carelli_giacenza_prog " +
|
||||
"WHERE cod_mdep = " + UtilityDB.valueToString(codMdep) + " AND " +
|
||||
"cod_mart in (" + UtilityDB.listValueToString(elencoArticoli) + ")").execute();
|
||||
}
|
||||
|
||||
return listGiacenza;
|
||||
|
||||
@@ -68,6 +68,10 @@ public class WMSAccettazioneBollaService {
|
||||
}
|
||||
|
||||
public List<SitBollaAccettazioneDTO> retrievePickingListBolle(List<BollaAccettazioneDTO> bolle) throws Exception {
|
||||
|
||||
if (bolle == null || bolle.isEmpty())
|
||||
throw new Exception("Non ci sono bolle selezionate per l'accettazione");
|
||||
|
||||
String sql = "SELECT CAST(IIF(value = 'S', 1, 0) AS BIT)\n" +
|
||||
"FROM stb_gest_setup\n" +
|
||||
"WHERE gest_name = 'PICKING'\n" +
|
||||
|
||||
@@ -153,6 +153,8 @@ public class WMSMaterialiService {
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user