Compare commits

...

664 Commits

Author SHA1 Message Date
e6d0f236c3 Fix su flagSetNumProt
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
(cherry picked from commit ecd8bca2aa)
2025-11-21 10:36:04 +01:00
b7ac9ce072 Fix su gestione ordine in scaricoMateriaPrima
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-20 18:38:46 +01:00
164b2e60f3 Fix su changes detection
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
(cherry picked from commit a10876effc)
2025-11-20 18:03:11 +01:00
b88f0a3c7d Aggiunta cache su MtbDepo
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-20 12:28:58 +01:00
562116cb54 Merge remote-tracking branch 'origin/feature/RefactoringGestioneColli' into feature/RefactoringGestioneColli
Some checks are pending
IntegryManagementSystem_Multi/pipeline/head Build queued...
2025-11-20 12:28:24 +01:00
76d07ec9b0 Migliorata chiave colli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-20 12:27:36 +01:00
454eb8c3c0 utility funciton for cache 2025-11-20 10:38:12 +01:00
b10bc86db0 Fix causale nulla in createUDSLavorazioneMovement
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-20 10:23:25 +01:00
3a95372f18 Sistemata dataCons Localdatetime
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-19 17:00:33 +01:00
030d635dcd Aggiornato servizio di ScaricoMateriaPrimaDaPosizione/Ordine
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-19 16:04:16 +01:00
8ca15e4378 [MES ]
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
- fix date in serivizio ripianificazione ordini lav
2025-11-19 13:27:49 +01:00
773611c978 Merge branch 'master' into feature/RefactoringGestioneColli 2025-11-19 13:27:19 +01:00
8fb8e4c05a Merge branch 'hotfix/Hotfix-1'
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-19 13:26:46 +01:00
9b26849cb6 [MES]
- modificato servizio di ripianificazione ordini di lavorazione: le date degli step non devono essere resettate
2025-11-19 13:26:32 +01:00
c9104967cd Fix su EuroforkDataSyncronizerService
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-19 10:47:53 +01:00
6b0a1afc0b Fix su EuroforkDataSyncronizerService
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-19 10:43:56 +01:00
92e9f6fde7 Merge branch 'master' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-19 10:31:04 +01:00
b17d807ca3 Finish Hotfix-100
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-19 10:29:49 +01:00
4957cba34b sistemata registrazione movimenti contabili 2025-11-19 10:29:43 +01:00
61d0a62004 Aggiunto log su EuroforkDataSyncronizerService
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-19 10:22:05 +01:00
a99ccc5170 Merge branch 'master' into feature/RefactoringGestioneColli 2025-11-19 10:21:49 +01:00
5c60cd2558 Finish Hotfix-1
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-19 10:15:34 +01:00
5a824d0b3a Fix IntegryCustomerDB per 2M Holding (GRAMM) 2025-11-19 10:15:29 +01:00
3218cca2cc Migliori Eurofork Data Syncronizer
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-18 19:04:43 +01:00
5870865ce7 Rimosso eurofork syncronizer in debug
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-18 18:10:39 +01:00
6a190cde08 [MES ]
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
- fix date
2025-11-18 18:02:20 +01:00
9a2a77cc77 Merge branch 'master' into feature/RefactoringGestioneColli
Some checks failed
IntegryManagementSystem_Multi/pipeline/head There was a failure building this commit
2025-11-18 17:45:08 +01:00
70f11c559f Merge remote-tracking branch 'origin/feature/RefactoringGestioneColli' into feature/RefactoringGestioneColli 2025-11-18 17:44:48 +01:00
4ee64127b1 Merge branch 'hotfix/Hotfix-1'
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-18 17:43:57 +01:00
be4c2d149e Merge branch 'master' into hotfix/Hotfix-1 2025-11-18 17:43:43 +01:00
ccb8b81597 [MES]
- modificata data cons prod in ripianificazione ordini lav
2025-11-18 17:39:58 +01:00
68a45a9eea Finish Hotfix-101
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-18 17:27:09 +01:00
8fe752e595 Attivazione nuova gestione produzione 2025-11-18 17:26:52 +01:00
71ffc5b4cf Attivazione nuova gestione produzione 2025-11-18 17:26:44 +01:00
cc189f4761 Finish Hotfix-1
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit is unstable
2025-11-18 16:25:48 +01:00
bd3bf9a8dc FIx customer DB AtiSrl 2025-11-18 16:25:41 +01:00
a2edd0f29c Migliorie magazzino automatico eurofork
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-18 16:09:46 +01:00
dd62a4f5e0 Fix su controllo posizione in magazzino automatico Eurofork
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-18 11:55:33 +01:00
a2cdc5c52c [CMMS ]
- fix date in servizio assegnazione partita
2025-11-18 11:41:27 +01:00
7fd4b6236c Finish Hotfix-100
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-17 15:37:00 +01:00
5075e17078 sistemato servizio per aggiornare ordini di slim 2025-11-17 15:36:19 +01:00
656f2018a2 Finish Hotfix-100
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-17 13:02:20 +01:00
2b4cea4ada aggiunta murgia test 2025-11-17 13:02:12 +01:00
72ebb39b22 Finish Hotfix-100
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-17 12:42:52 +01:00
8e01509e99 aggiunto cod_mart 2025-11-17 12:41:43 +01:00
18da8c2763 Finish Hotfix-1
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-17 11:10:17 +01:00
a770e150a4 Aggiunta dataMod in JtbComt e tabelle clienti e prospect 2025-11-17 11:09:33 +01:00
0646fd6943 Merge branch 'master' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-17 10:15:30 +01:00
72059e4623 Finish Hotfix-1
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-17 10:13:32 +01:00
db5ee20a39 Fix su cache non funzionante su Integry Servers 2025-11-17 10:13:25 +01:00
35621cadf2 Fix after merge
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-17 09:56:44 +01:00
04f1a9e2e6 Merge branch 'master' into feature/RefactoringGestioneColli
# Conflicts:
#	ems-core/src/main/java/it/integry/ems/dbms_change_tracker/component/DbmsChangeTrackerComponent.java
#	ems-core/src/main/java/it/integry/ems/dynamic_cache/EntityCacheComponent.java
#	ems-core/src/main/java/it/integry/ems/rules/businessLogic/AccountingBusinessLogic.java
#	ems-core/src/main/java/it/integry/ems/rules/completing/CommonRules.java
#	ems-core/src/main/java/it/integry/ems/rules/completing/SalesRules.java
#	ems-core/src/main/java/it/integry/ems_model/business_logic/GeneraOrdLav.java
#	ems-core/src/main/resources/rules/contabilita.drl
#	ems-engine/src/main/java/it/integry/ems/customizations/production/service/ToscaProductionService.java
#	ems-engine/src/main/java/it/integry/ems/product/importaz/service/ImportAnagListiniService.java
#	ems-engine/src/main/java/it/integry/ems/product/importaz/service/ImportImeService.java
#	ems-engine/src/main/java/it/integry/ems/product/importaz/service/ImportListiniVenditaService.java
#	ems-engine/src/main/java/it/integry/ems/product/service/ListiniVenditaServices.java
#	ems-engine/src/main/java/it/integry/ems/production/dto/CreateUDCProduzioneRequestDTO.java
#	ems-engine/src/main/java/it/integry/ems/production/service/MesProductionServiceV2.java
#	ems-engine/src/main/java/it/integry/ems/retail/pvmRetail/service/PvmService.java
2025-11-17 09:47:18 +01:00
7b40578ea4 Finish Hotfix-100
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-17 09:06:03 +01:00
9685bff5ef per ora eliminata cache 2025-11-17 09:05:54 +01:00
bfa48cbbb1 Finish Hotfix-100
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit is unstable
2025-11-17 08:52:08 +01:00
4f2b251d20 aggiunto levanplastsrl 2025-11-17 08:52:00 +01:00
a1f1ffba95 modificata entity con deletechilds
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit is unstable
2025-11-14 15:30:38 +01:00
1ab59fa9a6 modificata entity mtbSsfam
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-14 14:27:34 +01:00
800407ebd7 Merge remote-tracking branch 'origin/develop' into develop
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-14 14:06:13 +01:00
3dad6790fc inserita entity child mtbSsfam nella mtbsgrp e mtbgrup 2025-11-14 14:05:58 +01:00
d073a8fd17 Merge branch 'master' into develop
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-14 13:34:07 +01:00
a9068c45cd Finish Hotfix-100
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-14 13:34:07 +01:00
ca78b09ad8 sistemata procedura di importazione colli da slim 2025-11-14 13:34:02 +01:00
3e17a7239a eliminato log
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-14 13:14:38 +01:00
d78597cba4 create get e set entity child mtbSsfam nella mtbSfam
Some checks failed
IntegryManagementSystem_Multi/pipeline/head There was a failure building this commit
2025-11-14 13:11:00 +01:00
91f28a8c82 Merge remote-tracking branch 'origin/develop' into develop
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-14 12:19:57 +01:00
03a7877899 [CMMS ]
- rimosso codice deposito da anagrafica macchinari
2025-11-14 12:17:55 +01:00
46e8a19c53 creata entity mtbSsfam come entity child mtbSfam
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-14 12:14:20 +01:00
81a42fc1d9 Merge remote-tracking branch 'origin/develop' into develop
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-13 19:06:16 +01:00
fdbcc0c539 Gestita data consegna produzione = null 2025-11-13 19:06:12 +01:00
7d51ddb868 Merge branch 'master' into develop
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-13 18:48:43 +01:00
9f25bd2bf6 Finish FixNoteCreaColloLav
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-13 18:48:16 +01:00
a9ce0d82b6 Corretta impostazione note createULLavorazione
(cherry picked from commit 83d2f329ce)
2025-11-13 18:47:54 +01:00
83d2f329ce Corretta impostazione note createULLavorazione
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-13 18:33:59 +01:00
7e06512598 modificato localdate
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-13 18:22:49 +01:00
b5776e82c9 modifiche a controllo resi
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-13 18:14:22 +01:00
05dd42b0bf Merge remote-tracking branch 'origin/develop' into develop
Some checks failed
IntegryManagementSystem_Multi/pipeline/head There was a failure building this commit
2025-11-13 18:02:35 +01:00
636774ed86 modifiche a inventari, listini e contabilità 2025-11-13 18:02:30 +01:00
6649af6e92 Creata inspection per chiamata SimpleDateFormat con LocalDate
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-13 17:37:28 +01:00
acfff8e8d6 Modifiche per carelli in chiusure promo e invio variazioni e moficati date in localdate nei listini di vendita
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-13 16:38:09 +01:00
44c1bd7cee Creata voce di menu ordini di vendita slim2k
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-13 15:35:13 +01:00
7f878b9a2e Merge remote-tracking branch 'origin/feature/RefactoringGestioneColli' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-13 15:27:10 +01:00
e2b56e37d4 Aggiunta commessa in recupera materiali 2025-11-13 15:27:01 +01:00
c712e729cc [GRAMM]
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
- gestione controlli di qualità nuovi
2025-11-13 15:25:46 +01:00
7956a895d2 Cambiato servizio di sync eurofork
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-13 15:03:47 +01:00
b684129f39 Merge branch 'hotfix/Hotfix-1' into develop
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-13 12:50:58 +01:00
1b339289c1 Merge branch 'hotfix/Hotfix-1'
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-13 12:50:57 +01:00
b246991600 odio 2025-11-13 12:50:45 +01:00
dc578d1f17 Merge branch 'hotfix/Hotfix-1' into develop
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-13 12:40:00 +01:00
6c6f6d4d7e Merge branch 'hotfix/Hotfix-1'
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-13 12:40:00 +01:00
50dcb999f1 [TOSCA]
- aggiunto servizio per recuperare ul non pubblicate per la sincronizzazione
2025-11-13 12:39:47 +01:00
c656cc95de Merge branch 'hotfix/Hotfix-1' into develop
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-13 11:50:48 +01:00
0b0b5bbf33 Merge branch 'hotfix/Hotfix-1'
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-13 11:50:47 +01:00
c2310327d2 rimosso parametro inutile 2025-11-13 11:50:35 +01:00
9962471f71 Merge branch 'hotfix/Hotfix-1' into develop
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-13 11:48:15 +01:00
8ad86f71d3 Merge branch 'hotfix/Hotfix-1'
Some checks failed
IntegryManagementSystem_Multi/pipeline/head Something is wrong with the build of this commit
2025-11-13 11:48:15 +01:00
3a42baab00 - corretta gestione profilo alla login
- corretta gestione preparedStatement in pubblicazioni sincronizzazioni
- aggiunto servizio di ripubblicazione impegnato tosca
2025-11-13 11:48:02 +01:00
a1bfd0150c Merge branch 'master' into develop
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-13 11:17:29 +01:00
2e420fc540 Finish Hotfix-100
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-13 11:17:28 +01:00
f591246ae3 sistemati nuovo controlli su partita di magazzino 2025-11-13 11:17:04 +01:00
c0d181fbfa Ripristinato check di validation della connessione nel datasource
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
(cherry picked from commit 28478cb11d)
2025-11-13 10:33:53 +01:00
d4c02cf504 Merge branch 'master' into develop
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-13 09:50:48 +01:00
e15878a9eb Finish Hotfix-100
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-13 09:50:47 +01:00
39f43b3361 varie correzioni per carelli 2025-11-13 09:50:26 +01:00
18a6756860 Rimosso update application name per device id
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-13 09:42:09 +01:00
3640b08041 Merge branch 'master' into develop
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-12 19:07:54 +01:00
928d47f772 Finish Hotfix-1
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-12 19:07:53 +01:00
28478cb11d Ripristinato check di validation della connessione nel datasource 2025-11-12 19:07:47 +01:00
0c48df7895 Modifica migrations per DMS
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-12 18:42:29 +01:00
6766e8e964 Aggiunto riallineamento commesse nella migration di aggiornamento della MvwSitartUdcDetInventario
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-12 18:40:38 +01:00
327f5af3dd Aggiunta unità di misura di magazzino e rapporto di conversione 1 in registazione inventario
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-12 16:36:00 +01:00
f20ed5b92a Aggiunto riallineamento commesse nella migration di aggiornamento della MvwSitartUdcDetInventario
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-12 10:35:30 +01:00
62234f2edf aggiunto n uovo campo su testata dei listini
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-11 17:32:08 +01:00
2fcba55965 aggiunto n uovo campo su testata dei listini
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-11 17:30:49 +01:00
d29768776a Merge remote-tracking branch 'origin/develop' into develop
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-11 16:43:07 +01:00
3dcf6d3ee0 Configurazione nuovo cliente EDI HALLES - GRAMM 2025-11-11 16:43:03 +01:00
7c2aa55eb8 Gestione chiusura commessa MAGGIO 2025-11-11 16:42:42 +01:00
a4a837edfb Rimossi usi di SimpleDateFormat con variabili di tipo LocalDate
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-11 15:24:16 +01:00
c5851f4e80 Merge branch 'master' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-11 15:15:10 +01:00
e92d64a05e Merge branch 'hotfix/Hotfix-1' into develop
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-11 15:14:54 +01:00
0fa021be3e Merge branch 'hotfix/Hotfix-1'
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-11 15:14:53 +01:00
086bd574d5 Aggiunta pezza in login per disallineamento profileDb != dbName 2025-11-11 15:13:47 +01:00
b46f26790d Merge remote-tracking branch 'origin/develop' into develop
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-11 12:24:35 +01:00
c364d57e86 [CONSEGNA] Cambiati i tipi indirizzo per le personeRif che devo riceve la bolla firmata e non 2025-11-11 12:24:22 +01:00
6d89e4d09b Rimosso select * in pvm_getassortimentoCliente
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-11 12:06:49 +01:00
3391051bb8 Finish FixSetupGestWebUser
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-11 11:35:58 +01:00
acba051357 Merge branch 'master' into develop
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-11 11:35:58 +01:00
785ae254ee Creazione stb_gest_setup presenti solo in wtb_gest_setup_user 2025-11-11 11:35:37 +01:00
21a189ea66 aggiunto controllo su [NULL]
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-11 10:44:20 +01:00
3a4a11d9e8 Migliorata gestione datasources in BasicConnectionPool
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-11 10:26:39 +01:00
09db33b259 Migliorie per implementazione Eurofork
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-10 18:42:09 +01:00
6d5d021884 Finish Hotfix-101
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-10 18:35:27 +01:00
185d403d7a Merge branch 'master' into develop
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-10 18:35:27 +01:00
349d983b7f Impostata truncate a 40 su ragione sociale in import Made In Masseria 2025-11-10 18:35:14 +01:00
85ed6b54f9 aggiunto n uovo campo su testata dei listini
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-10 18:10:15 +01:00
9b6b0c87aa sistemato metodo per errore avevo cambiato il requestparam
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-10 17:16:34 +01:00
dbba57fccc Nello spostamento delle pedane in un magazzino automatico viene riordinata la lista
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-10 17:15:55 +01:00
fd68a9b73a modifiche a contabilità per variazione movimento con creazione scadenza e pagamento nello stesso movimento
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-10 17:07:19 +01:00
433ab4b0ec Inserita voce menù per lanciare procedura di cancellazione movimenti contabili
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-10 16:29:30 +01:00
023aac21c9 Implementato check connection in DbmsChangeTracker
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-10 15:57:11 +01:00
449f38417e Implementato check connection in DbmsChangeTracker
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-10 15:56:24 +01:00
df9fbc7f65 Implementato check connection in DbmsChangeTracker
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-10 15:42:40 +01:00
17ffdd8957 Aggiunto fomrattazione per localdate
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-10 15:27:48 +01:00
d294100b28 Merge remote-tracking branch 'origin/feature/RefactoringGestioneColli' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-10 13:07:34 +01:00
fbe8891f86 [BIOLEVANTE - MPS ]
- fix calcolo ATP mps
2025-11-10 13:07:27 +01:00
a8253614b4 aggiunto +
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-10 13:07:21 +01:00
9977cae821 gestito pagamento contestuale alla registrazione della fattura
Some checks failed
IntegryManagementSystem_Multi/pipeline/head There was a failure building this commit
2025-11-10 12:46:48 +01:00
f740fff33d Aggiunta cache di StbEditLimit
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-10 12:28:14 +01:00
344010ed90 Aggiunta cache di StbEditLimit
Some checks failed
IntegryManagementSystem_Multi/pipeline/head There was a failure building this commit
2025-11-10 12:23:51 +01:00
1c51fb717a Merge remote-tracking branch 'origin/develop' into develop
Some checks failed
IntegryManagementSystem_Multi/pipeline/head There was a failure building this commit
2025-11-10 12:02:05 +01:00
81827a8368 Modifica migrations per DMS 2025-11-10 12:02:00 +01:00
21222a25e9 Gestita esclusione ordini annullati da Distribuzione materiali SMETAR 2025-11-10 12:01:48 +01:00
d24a033e01 Merge branch 'master' into develop
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-10 11:19:51 +01:00
5e76d8db2a Ingrandito campo note_incoterms a 40 in vtb_viaggi
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-10 11:00:13 +01:00
bae92e626b aggiunta setup per mrp
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-10 10:44:09 +01:00
0d471db37d Aggiunta migration per rimuovere barcode duplicati nella tabella mtb_aart_bar_code sul database Winact (Carelli) 2025-11-10 10:41:14 +01:00
0c3786c266 [BIOLEVANTE - MPS ]
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
- fix forecast mps
2025-11-10 09:55:15 +01:00
6269849a50 Fix import
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-10 09:51:48 +01:00
81108c58ef Merge branch 'master' into feature/RefactoringGestioneColli
Some checks failed
IntegryManagementSystem_Multi/pipeline/head There was a failure building this commit
# Conflicts:
#	ems-core/src/main/java/it/integry/ems/datasource/DataSource.java
#	ems-core/src/main/java/it/integry/ems/rules/completing/CommonRules.java
#	ems-core/src/main/java/it/integry/ems_model/utility/UtilityLocalDate.java
#	ems-engine/src/main/java/it/integry/ems/order/crm/service/CrmService.java
2025-11-10 09:48:25 +01:00
c4c6875e16 Merge remote-tracking branch 'origin/develop' into develop
Some checks failed
IntegryManagementSystem_Multi/pipeline/head There was a failure building this commit
2025-11-10 09:45:26 +01:00
3515e5c976 aggiunta possibilità di filtrare per numero ordine
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-10 09:28:41 +01:00
84a6f4c4f1 Aggiunta cache in servizi di completamento unt_mis e qta_cnf 2025-11-07 18:21:09 +01:00
ee9ec1a8a7 Sistemata EntityCacheComponent in debug 2025-11-07 18:20:29 +01:00
1884a9184e Check customerDb su EntityCacheComponent 2025-11-07 18:20:26 +01:00
caa62588b6 Fix su equals in getSetupList. 2025-11-07 18:20:23 +01:00
8bb9803f5b [BIOLEVANTE ]
- fix
2025-11-07 18:20:19 +01:00
ea27c26597 Fix su regole committate per errore.
Migliorato controllo alterObject in BaseMigration.
2025-11-07 18:20:14 +01:00
80aaa94036 Fix su Change Tracking 2025-11-07 18:20:03 +01:00
a82c0de415 Implementato primo sistema di Change Tracking per SQL Server 2025-11-07 18:18:40 +01:00
8c19cfb9fb [BIOLEVANTE - MPS ]
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
- fix forecast mps
2025-11-07 17:58:44 +01:00
5c40eea23c Aggiunta cache in servizi di completamento unt_mis e qta_cnf
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-07 17:02:55 +01:00
04dbf6dd93 Sistemata EntityCacheComponent in debug
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-07 15:20:28 +01:00
530defaea5 Check customerDb su EntityCacheComponent
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-07 12:19:07 +01:00
12196815ea Fix su equals in getSetupList.
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-07 12:12:10 +01:00
199fdfb3b0 [BIOLEVANTE ]
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
- fix
2025-11-07 10:58:09 +01:00
d3d113b884 Fix su regole committate per errore.
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
Migliorato controllo alterObject in BaseMigration.
2025-11-07 10:23:51 +01:00
7e8659b007 Merge remote-tracking branch 'origin/feature/RefactoringGestioneColli' into feature/RefactoringGestioneColli
Some checks failed
IntegryManagementSystem_Multi/pipeline/head There was a failure building this commit
2025-11-07 10:20:14 +01:00
63838e9189 [BIOLEVANTE - MPS]
- corrette migrations
2025-11-07 10:20:06 +01:00
bdc0e677fd Fix su Change Tracking
Some checks failed
IntegryManagementSystem_Multi/pipeline/head There was a failure building this commit
2025-11-07 10:14:51 +01:00
86734061c6 Implementato primo sistema di Change Tracking per SQL Server
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-07 09:54:13 +01:00
aeef7d2ec2 Merge remote-tracking branch 'origin/feature/RefactoringGestioneColli' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-07 09:42:22 +01:00
a3927d6f0f Subordinata cancellazione collo da lista colli solo se è stato effettuato il trasferimento 2025-11-07 09:40:06 +01:00
44c2c0886b Fix null in suggestPosizioneUl
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-07 09:37:49 +01:00
8c0ed8c4f6 Subordinata cancellazione collo da lista colli solo se è stato effettuato il trasferimento
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-07 09:33:56 +01:00
2634f6d520 Merge remote-tracking branch 'origin/feature/RefactoringGestioneColli' into feature/RefactoringGestioneColli 2025-11-07 09:33:18 +01:00
6436a6825f Subordinata cancellazione collo da lista colli solo se è stato effettuato il trasferimento 2025-11-07 09:33:13 +01:00
fa89398e40 Merge remote-tracking branch 'origin/feature/RefactoringGestioneColli' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-06 17:54:09 +01:00
b5cbbf7b0b [BIOLEVANTE - EUROFORK]
- aggiornata gestione missioni
2025-11-06 17:54:00 +01:00
db17e8c473 Rinominata classe AvailableConnectionModel
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-06 10:36:27 +01:00
c8b1a0ddfd Disattivato EuroforkDataSyncronizerService
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-06 10:17:46 +01:00
2ab3bb6043 Fix query di retrieve missioni
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-05 18:41:50 +01:00
29f6b7d2a4 [BIOLEVANTE - EUROFORK]
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
- aggiornata gestione missioni
2025-11-05 17:35:58 +01:00
2be30206ce Merge remote-tracking branch 'origin/feature/RefactoringGestioneColli' into feature/RefactoringGestioneColli 2025-11-05 10:36:02 +01:00
3306423e0a Merge remote-tracking branch 'origin/feature/RefactoringGestioneColli' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-04 20:00:20 +01:00
23a70c266e Migliorata sync eurofork, adesso viene presa in considerazione la posizione nel canale 2025-11-04 20:00:14 +01:00
672a055e55 [Biolevante]
- MPS
2025-11-04 18:14:11 +01:00
c2f427387b Merge remote-tracking branch 'origin/feature/RefactoringGestioneColli' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-04 16:02:57 +01:00
08be0a6ad2 [EuroFork]
- fix retrieve impegni/arrivi
2025-11-04 16:02:49 +01:00
7a9a72f11a Migliorata gestione status missioni
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-04 12:33:12 +01:00
68075b89fa Merge remote-tracking branch 'origin/feature/RefactoringGestioneColli' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-04 12:25:45 +01:00
e9ec1d1a83 Fix nel salvataggio dei documenti diretti
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-04 12:22:10 +01:00
9c4f8ff47e Merge branch 'master' into feature/RefactoringGestioneColli
# Conflicts:
#	ems-core/src/main/java/it/integry/ems/rules/completing/ProductionsRules.java
#	ems-engine/src/main/java/it/integry/ems/document/fatture/services/PassiveInvoiceService.java
2025-11-04 12:22:06 +01:00
09b28cccbe Migliorata gestione status missioni
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-11-03 18:26:54 +01:00
6d4a2bf31b [DOCUMENTI DIRETTI]
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
- corretto calcolo qtaCnf in fattura conto deposito
2025-11-03 12:16:22 +01:00
db78ca0cc0 [BIOLEVANTE]
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
- gestione magazzino automatico
2025-11-03 10:22:02 +01:00
5db8172b3c Merge branch 'master' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
# Conflicts:
#	ems-core/src/main/java/it/integry/ems/rules/completing/AccountingRules.java
#	ems-engine/src/main/java/it/integry/ems/document/fatture/base/PassiveInvoiceRecapObject.java
#	ems-engine/src/main/java/it/integry/ems/retail/wms/generic/service/WMSGenericService.java
2025-11-03 09:30:11 +01:00
5a07e918a4 Fix query di retrieve barcodes in posizione
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-10-31 15:56:59 +01:00
8ebac5dd33 Migliorata query di retrieve barcodes in posizione
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-10-31 15:49:07 +01:00
ff81f2129b Merge remote-tracking branch 'origin/feature/RefactoringGestioneColli' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-10-31 12:26:37 +01:00
04eb85b190 Fix calcolo numCnf in riproporzionamento scarichi
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-10-31 12:24:19 +01:00
db83ba4a3c Merge branch 'master' into feature/RefactoringGestioneColli
# Conflicts:
#	ems-engine/src/main/java/it/integry/ems/production/dto/CreateUDCProduzioneRequestDTO.java
#	ems-engine/src/main/java/it/integry/ems/retail/wms/dto/CreateUDCRequestDTO.java
#	ems-engine/src/main/java/it/integry/ems/retail/wms/lavorazione/service/WMSLavorazioneService.java
2025-10-31 12:23:38 +01:00
59788d83d7 Disattivato temporaneamente EuroforkDataSyncronizerService
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-10-31 11:36:15 +01:00
5fb2be5da0 Cambiati servizi magazzino automatico
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-10-31 11:35:08 +01:00
0760905c4f Merge remote-tracking branch 'origin/feature/RefactoringGestioneColli' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-10-31 11:33:21 +01:00
3f27ec44f8 [BIOLEVANTE]
- gestione magazzino automatico
2025-10-31 11:33:15 +01:00
69a938d076 Merge branch 'master' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-10-30 17:42:05 +01:00
e2a827f45a [ROSSOGARGANO]
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
- Corretti controlli in creazione documento da rettifica UL
2025-10-30 17:32:21 +01:00
f8b636f23d sistemato localdate
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-10-30 16:51:55 +01:00
981f5e4d67 Merge branch 'master' into feature/RefactoringGestioneColli
Some checks failed
IntegryManagementSystem_Multi/pipeline/head There was a failure building this commit
2025-10-30 16:13:46 +01:00
d9bc09e6f3 sistemata registrazione movimeto di reverse
Some checks failed
IntegryManagementSystem_Multi/pipeline/head There was a failure building this commit
2025-10-30 15:34:40 +01:00
1439050345 [ROSSOGARGANO]
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
- risolto problema in modifica scadenza partita di produzione dove la partitaMagProd diventava uguale alla partita stessa invece che restare quella originale
2025-10-30 11:26:41 +01:00
75eb189a11 Fix su authentication
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-10-28 11:50:05 +01:00
7eded8848f Fix vari
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-10-28 09:03:25 +01:00
87d377a83c modifiche a chiusura partite
Some checks failed
IntegryManagementSystem_Multi/pipeline/head There was a failure building this commit
2025-10-27 16:59:21 +01:00
cbf7ec5cdb sistemata entity
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-10-27 14:33:22 +01:00
ee83cd024e corretta formattazione data documento
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-10-27 12:36:42 +01:00
36a0a99755 Merge branch 'master' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-10-27 12:32:07 +01:00
a0f72ee7b1 Merge branch 'master' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-10-27 12:22:32 +01:00
c633d7c97e Merge branch 'master' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
# Conflicts:
#	ems-core/src/main/java/it/integry/ems/rules/completing/AccountingRules.java
#	ems-core/src/main/java/it/integry/ems/rules/completing/DocOrdRules.java
#	ems-core/src/main/java/it/integry/ems/rules/completing/DocumentRules.java
#	ems-core/src/main/java/it/integry/ems/rules/completing/OrderRules.java
#	ems-core/src/main/java/it/integry/ems_model/business_logic/GeneraOrdLav.java
#	ems-core/src/main/java/it/integry/ems_model/entity/CtbAmac.java
#	ems-core/src/main/java/it/integry/ems_model/entity/DtbOrdLogImport.java
#	ems-engine/src/main/java/it/integry/ems/order/Import/service/OrdiniWebImportService.java
2025-10-27 11:45:02 +01:00
44e48527c6 Fix errore query getOrderLastStep
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-10-27 09:58:54 +01:00
1faf5dd713 Fix null pointer se data cons null in CreateUDSRequestOrderDTO
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-10-24 19:26:54 +02:00
59a21796b8 Fix su login
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-10-24 18:26:22 +02:00
8457bfbc75 [BIOLEVANTE]
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
- risolto problema in Mapping di LocalDate e LocalDate time presi dall getOldPK()
2025-10-24 17:40:36 +02:00
5541742c0d [BIOLEVANTE]
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
- risolto problema in Mapping di valori null in LocalDateTime
2025-10-24 16:48:33 +02:00
6630e42024 Implementazioni varie per magazzino automatico
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-10-24 15:58:36 +02:00
50c41e9de2 Implementazioni varie per magazzino automatico
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-10-24 15:38:25 +02:00
6aae376098 Implementazioni varie per magazzino automatico
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-10-24 15:37:09 +02:00
7ee6e8d64a Implementazioni varie per magazzino automatico
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-10-24 13:20:44 +02:00
3daf60767f Fix vari dataDoc
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-10-23 16:13:47 +02:00
5ba9035238 Fix vari dataDoc
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-10-23 15:24:10 +02:00
a0035ad573 Fix vari dataDoc
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-10-23 12:48:31 +02:00
203a36cdba Fix dataDoc su entity child
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-10-23 12:41:12 +02:00
c18551d630 Fix vari dataDoc
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-10-23 11:21:45 +02:00
939cfde0c5 Fix vari dataDoc
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-10-23 11:08:05 +02:00
4231f7b6ae Fix vari dataDoc
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-10-23 10:42:29 +02:00
b7b60491d4 Fix vari dataDoc
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-10-23 10:25:36 +02:00
84e46ce609 Fix vari dataDoc
Some checks failed
IntegryManagementSystem_Multi/pipeline/head Something is wrong with the build of this commit
2025-10-23 10:23:55 +02:00
f49c622df0 Fix regola completeActivityIdOrdine
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-10-23 09:30:01 +02:00
f7f8bee8d0 Cambiato field dataDoc e dataOrd in LocalDate
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-10-22 17:53:12 +02:00
41e7c24b91 Merge branch 'master' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-10-22 17:26:56 +02:00
5a6fa368e4 Fix after merge
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-10-21 17:16:26 +02:00
07fdd0a5df [MES]
Some checks failed
IntegryManagementSystem_Multi/pipeline/head There was a failure building this commit
- destinazione out
2025-10-21 14:55:09 +02:00
fd4901c294 Aggiunta colonna priorità nelle missioni ed impostata priorità 1 per le missioni di carico
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-10-21 12:04:45 +02:00
6e65992b90 Rimosso ordinamento missioni magazzino automatico
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-10-21 11:33:53 +02:00
64399d4803 Creato metodo assegnaPosizioniOrdineLav
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-10-21 11:17:28 +02:00
c6c4f52e93 Merge branch 'master' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-10-21 10:03:08 +02:00
ab70242ebf Merge branch 'feature/GestioneMissioniMag' into feature/RefactoringGestioneColli
Some checks failed
IntegryManagementSystem_Multi/pipeline/head There was a failure building this commit
2025-10-21 09:49:53 +02:00
cf078ced9c Aggiunti servizi per gestione magazzino automatico
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-10-21 09:49:33 +02:00
6290c18046 Merge branch 'master' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-10-20 16:03:31 +02:00
c544679f1b Merge branch 'feature/RefactoringGestioneColli' into feature/GestioneMissioniMag
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-10-20 09:38:34 +02:00
95bc10950a Merge branch 'master' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
# Conflicts:
#	ems-engine/src/main/java/it/integry/ems/retail/wms/generic/service/WMSArticoloService.java
2025-10-20 09:37:25 +02:00
a6415486c3 Aggiunta application Connettore Eurofork
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-10-17 15:41:57 +02:00
f68f76e5ea Merge branch 'master' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-10-16 16:14:31 +02:00
8e934b8a38 Cambiato ordinamento retrieveMissioni Magazzino automatico
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-10-16 15:27:41 +02:00
3e9793eb76 Aggiunto servizio di moveItem in Magazzino Automatico
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-10-16 15:22:07 +02:00
ea6cb1e9d7 Aggiunte annotazioni nel dto di moveItems per Magazzino Automatico
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-10-16 12:50:37 +02:00
629cf3bf22 Aggiunto campo articolo in retrieveArts wms
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
(cherry picked from commit 5421cb12d2)
2025-10-15 18:32:06 +02:00
9e8b05cecf [ROSSOGARGANO - MES]
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
- aggiunto tipo pedana in clonazione ordine di lavorazione
2025-10-15 18:04:32 +02:00
b7c452d41f Merge branch 'master' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-10-15 13:21:38 +02:00
b3e5c78afb Aggiunto progressivo ul in mvw_sitart_udc_det_inventario
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-10-15 12:31:08 +02:00
7bd80d9e52 Vario magazzino automatico
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-10-14 12:36:22 +02:00
0019f03668 Merge branch 'feature/RefactoringGestioneColli' into feature/GestioneMissioniMag
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
# Conflicts:
#	ems-engine/src/main/java/it/integry/ems/retail/wms/generic/service/WMSMagazzinoAutomaticoService.java
2025-10-13 10:01:59 +02:00
d74661153a Merge branch 'master' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
# Conflicts:
#	ems-engine/src/main/java/it/integry/ems/retail/wms/generic/service/WMSGenericService.java
2025-10-13 09:43:08 +02:00
a898ef24eb Merge branch 'master' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
# Conflicts:
#	ems-engine/src/main/java/it/integry/ems/retail/wms/generic/service/WMSGenericService.java
2025-10-10 19:00:43 +02:00
a69466f5db Merge remote-tracking branch 'origin/feature/RefactoringGestioneColli' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-10-10 15:51:37 +02:00
cdcb1eb0b6 [WMS - Rettifica Collo]
- fix rettifica positiva su nuovo collo: il salvataggio avviene due volte (sia su nuovo collo come richieste che sul collo originale)
2025-10-10 15:51:31 +02:00
bd706155f6 Aggiornate migration Mvw nuova
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-10-10 10:33:34 +02:00
a01025853c Implementato servizio di debug per sincronizzare le posizioni delle pedane con eurofork
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-10-09 12:50:02 +02:00
884c051b18 Merge branch 'master' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
# Conflicts:
#	ems-engine/src/main/java/it/integry/ems/production/service/MesProductionServiceV2.java
2025-10-09 10:54:14 +02:00
20aea0c306 Merge branch 'feature/RefactoringGestioneColli' into feature/GestioneMissioniMag
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-10-06 10:06:18 +02:00
03e6db20b5 Merge branch 'master' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-10-06 10:05:40 +02:00
e53add6f0d Rimossa commessa missioni magazzino automatico
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-10-06 10:05:13 +02:00
2fc60c34c3 Merge branch 'feature/RefactoringGestioneColli' into feature/GestioneMissioniMag
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-10-03 12:47:01 +02:00
b2d2bd494a [ROSSOGARGANO - MES]
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
- fix in calcolo progressivo UL su UDC create alla mezzanotte
- aggiunto calcolo dataProd in base al lotto
2025-10-02 13:02:39 +02:00
58d900cc6b Merge branch 'master' into feature/RefactoringGestioneColli 2025-10-02 12:20:09 +02:00
cc21e43bd4 Cambiata struttura MtbMissioneMagAuto
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-10-02 11:05:48 +02:00
5acf3023b7 [ROSSOGARGANO]
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
- aggiunti riferimenti ordine in rettifica giacenze colli L+
2025-10-01 17:20:50 +02:00
9d9ce1f3ac Merge branch 'master' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-10-01 16:13:43 +02:00
7d6f11272f Merge branch 'feature/RefactoringGestioneColli' into feature/GestioneMissioniMag
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-10-01 10:15:20 +02:00
f9ab71462f Fix su clean directory
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-10-01 09:59:38 +02:00
f014e4b959 Merge branch 'master' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-09-30 16:36:30 +02:00
bd2f7126a9 [ROSSOGARGANO - ACCETTAZIONE]
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
- tolti commit automatici alla closeUDC di lavorazione per evitare problemi alla rollback di procedure più ampie
2025-09-30 16:06:14 +02:00
9007eda560 Merge branch 'feature/RefactoringGestioneColli' into feature/GestioneMissioniMag
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-09-29 18:41:46 +02:00
139fc94ed5 Creato servizio di logError missione 2025-09-29 18:41:41 +02:00
b51fc95057 Merge branch 'develop' into feature/GestioneMissioniMag
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-09-29 17:02:26 +02:00
0782d0206c Fix su query deposito utente errata
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
(cherry picked from commit eddd9ff8e7)
2025-09-29 16:54:09 +02:00
1eface5798 Merge branch 'develop' into feature/GestioneMissioniMag
Some checks failed
IntegryManagementSystem_Multi/pipeline/head There was a failure building this commit
2025-09-29 15:58:41 +02:00
3bc9e6629b Merge branch 'develop' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-09-29 09:57:05 +02:00
f10e90bc9b [BIOLEVANTE - SERBATOI]
- aggiunta eccezione in funzione isGestisciColli se il tipo deposito non è specificato
2025-09-29 09:55:32 +02:00
997c667f1b Merge branch 'develop' into feature/GestioneMissioniMag
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-09-29 09:55:00 +02:00
6efa6e7293 [Magazzino Automatico] Aggiunti servizi
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-09-29 09:21:27 +02:00
32229f7157 [Magazzino Automatico] Completato servizio di retrieve 2025-09-26 16:38:31 +02:00
7b09900a1f [Magazzino Automatico] Create entity per le missioni e servizi base 2025-09-26 12:21:23 +02:00
71cb4d0d88 Merge remote-tracking branch 'origin/feature/RefactoringGestioneColli' into feature/RefactoringGestioneColli
# Conflicts:
#	build/Jenkinsfile.groovy
2025-09-25 16:08:39 +02:00
0f42d5a2ba Aggiunto campo "backupAfterImport" utilizzato dalle importazioni da SFTP
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-09-24 17:36:52 +02:00
ebf9af7b8b Fix build command
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-09-24 11:48:19 +02:00
9476e99476 Fix build command 2025-09-24 11:48:17 +02:00
a338077542 Fix build command 2025-09-24 11:48:16 +02:00
db9a613fc9 Fix build command 2025-09-24 11:48:14 +02:00
0d4882b818 Prima build con podman 2025-09-24 11:48:12 +02:00
cbbc0739c6 Merge branch 'develop' into feature/RefactoringGestioneColli 2025-09-24 11:20:02 +02:00
e12f00984d Merge branch 'develop' into feature/RefactoringGestioneColli 2025-09-24 11:18:42 +02:00
5dc20c4e3f Merge branch 'develop' into feature/RefactoringGestioneColli 2025-09-24 11:18:11 +02:00
4a61a4b60c Merge branch 'master' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-09-23 17:25:31 +02:00
b82a3dd227 Merge branch 'master' into feature/RefactoringGestioneColli
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
2025-09-22 09:51:01 +02:00
ca9843f71a [RG]
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
- aggiunta dataProd nella partita di SL generata al cambio giornata
2025-09-18 19:03:12 +02:00
41b95b9dcb Spostata voce menu tracciabilita pvm in magazzino
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
(cherry picked from commit 6177a4b3c4)
2025-09-18 11:35:14 +02:00
1d16e2cc13 [WMS] Aggiunto servizio di retrieve ultimi versamenti merce per vecchia gestione colli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
(cherry picked from commit 7507ab834c)
2025-09-17 15:07:48 +02:00
2abf8b55ac Creato menu tracciabilita su pvm, setup per report ed update viste
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
(cherry picked from commit a24e26b436)
2025-09-17 12:26:59 +02:00
82972a537e Aggiunti file in gitignore
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-09-16 16:26:07 +02:00
5d77838838 Creata regola personalizzata per la generazione dei barcodeUl di OlioLevante
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-09-16 15:58:57 +02:00
9006da1383 Fix check tipo documento trasferimenti interni in spostaUl
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-09-16 11:46:52 +02:00
026f89d031 Fix migration biolevante
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-09-16 10:24:12 +02:00
1dd6d8b3fa Merge branch 'master' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-09-15 16:03:48 +02:00
67c1a8fba5 Merge branch 'master' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-09-15 15:56:36 +02:00
c4e8985642 Merge branch 'master' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-09-15 15:47:24 +02:00
d048ea1f9c Merge branch 'master' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-09-15 12:56:40 +02:00
6f2d485de7 Merge remote-tracking branch 'origin/feature/RefactoringGestioneColli' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-09-15 10:42:15 +02:00
9f46505136 Merge branch 'develop' into feature/RefactoringGestioneColli 2025-09-15 10:41:51 +02:00
4d2fbf610d Rimosso BiolevantePeppe
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-09-15 10:37:32 +02:00
3ec8d6d0e1 Merge branch 'master' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-09-15 09:24:48 +02:00
255de9a955 Fix su localDate in DocumentRules
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-09-08 12:01:29 +02:00
622c4c903c Merge branch 'master' into feature/RefactoringGestioneColli
# Conflicts:
#	ems-core/src/main/java/it/integry/ems/datasource/DataSource.java
#	ems-core/src/main/java/it/integry/ems/rules/completing/DocumentRules.java
2025-09-08 11:59:49 +02:00
e51fa4fa6b Fix su aggiornamento qta documenti diretti di vendita (il collo si sganciava e non veniva più riagganciato)
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-09-05 13:13:02 +02:00
febe8be89e Ulteriori fix su Datasource
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
(cherry picked from commit 94add3ecde)
2025-09-05 09:38:01 +02:00
3ad15c8457 Fix su connessioni del Connection Pool
Some checks failed
IntegryManagementSystem_Multi/pipeline/head There was a failure building this commit
(cherry picked from commit 1a76055a09)
2025-09-04 18:07:28 +02:00
3ae1d499c2 Fix profileDb ROSSOGARGANO_EXCHANGE
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-09-04 12:11:37 +02:00
b10c6e837c E' stato disabilitata la valorizzazione dei campi barcode_ul_in, posizione_in e cod_mdep_in nella creazione di una UDS di lavorazione
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-09-04 10:30:58 +02:00
1d07f15169 Rimossi comandi aggiuntivi nel DataSource
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
(cherry picked from commit 9f76fcfc72)
2025-09-04 09:22:04 +02:00
18e69f0195 Merge remote-tracking branch 'origin/feature/RefactoringGestioneColli' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-09-03 16:33:28 +02:00
3f4735f953 Impostato cod_anag_comp su riga collo
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-09-03 12:42:17 +02:00
edcd6ecf6b Impostato cod_anag_comp su riga collo
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-09-03 12:38:01 +02:00
b2ac734b5e Fix check certificato durante l'aggiornamento dei comuni
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-09-03 10:48:17 +02:00
481e8e35cc Fix su numero connessioni DataSource
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-09-02 09:50:39 +02:00
725b93be81 Merge branch 'develop' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-09-01 09:27:24 +02:00
7eac47b3b7 [rettifica colli]
- se la udc in rettifica ha subito già delle movimentazioni, è obbligatorio eseguire la rettifica in un nuovo movimento
2025-08-25 10:34:16 +02:00
8abb7c2842 Merge branch 'develop' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-08-25 09:53:58 +02:00
55e55bd64a Merge remote-tracking branch 'origin/feature/RefactoringGestioneColli' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-08-20 11:35:53 +02:00
7de563abf3 Aggiunto recupero del codMart da codArtFor per importazione sonoco
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-08-19 15:32:41 +02:00
12154ed089 [ROSSOGARGANO]
- corretto versamenti ribaltatori
- corretta gestione numeratore certficati pomodori
2025-08-19 14:44:49 +02:00
98e518e295 Gestite anomalie e corretta l'importazione colli di eviosys
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-08-19 10:43:16 +02:00
498ce2880e Corretta importazione colli vebad
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-08-18 17:58:09 +02:00
b828e5bfae Merge branch 'develop' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
# Conflicts:
#	ems-engine/src/main/java/it/integry/ems/logistic/service/ColliEviosysImportService.java
2025-08-18 15:37:26 +02:00
637fdca7ed Migliorata gestione dei colli di trasferimento verso i depositi che non gestiscono i colli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-08-14 17:23:27 +02:00
8778aecbeb Migliorata gestione dei colli di trasferimento verso i depositi che non gestiscono i colli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-08-14 16:42:23 +02:00
724bc750cf Risolti problemi riguardo il trasferimento delle pedane
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-08-13 14:48:09 +02:00
4c78c0cf37 Modifica segno_qta_car e segno_qta_scar
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-08-13 12:00:02 +02:00
c8c476f98c Modifica segno_qta_car e segno_qta_scar
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-08-13 11:48:55 +02:00
0c3cf9095f Aggiunto campo num_etich in fase di insertUdcRow e gestito segno in creazione documenti diretti
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-08-13 11:35:19 +02:00
f90688e969 Merge branch 'develop' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
# Conflicts:
#	ems-core/src/main/java/it/integry/ems/migration/model/Migration_20250807105039.java
#	ems-core/src/main/resources/rules/documenti.drl
2025-08-11 09:39:05 +02:00
c76417b917 Fix su utility WMS errata
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-08-08 17:39:38 +02:00
332b4fddd8 Creato servizio di createUdsWithRows
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-08-08 17:19:27 +02:00
fa2bca9c99 Fix su group by durante il riproporzionamento degli scarichi
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-08-08 12:56:23 +02:00
565cbc9f30 Aggiunto in retrive giacenza by articolo il parametro di ricerca tramite cod_jcom
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-08-07 18:43:00 +02:00
febd5d7e7f Aggiunta condizione tra parenti
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-08-07 18:40:56 +02:00
057d7961f2 Modifica export documenti consegnati
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-08-07 16:13:42 +02:00
8ead6d9fdb Gestito controllo data scadenza multipla in openStep MES
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
(cherry picked from commit 4656fbb61b)
2025-08-07 15:17:56 +02:00
08215fab9d Fix su registrazione datetime_row degli scarichi da collo
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-08-07 13:21:09 +02:00
73aed3e9d6 In fase di ridistribuzione degli scarichi a produzione è stata aggiunta la sum delle righe di scarico (le righe di rientro che erano negative creavano scarichi errati)
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-08-07 12:20:38 +02:00
1ae0ee3567 modifiche su utenti
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-08-07 11:57:24 +02:00
49f6664874 Fix cancellazione annotazioni in cq pomodori
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-08-06 12:46:09 +02:00
03fe0c7279 migliorato check delle UDS da trasferire durante la creazione di un documento diretto di vendita
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-08-05 15:23:13 +02:00
49b4fca63c Fix su sql server connection in menu configurator
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
(cherry picked from commit 6f3d8a7ef5)
2025-08-05 12:27:06 +02:00
36c425941a Fix connection su DB Distributore
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
(cherry picked from commit 54804ec4d6)
2025-08-05 09:58:48 +02:00
5fa3dc538f Fix su connessioni del SyncManager
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
(cherry picked from commit d266c8c9e1)
2025-08-04 19:11:36 +02:00
280474d038 Merge remote-tracking branch 'origin/feature/RefactoringGestioneColli' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-08-04 17:29:05 +02:00
518263d955 Aggiunto servizio che aggiorna endpoint portale Web 2025-08-04 17:28:54 +02:00
0f298bcd05 Merge branch 'master' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-08-04 17:28:12 +02:00
c8200f3690 riattivati trasferimenti
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-08-04 16:21:20 +02:00
08ff9e1940 SISTEMATA REGOLA
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-08-04 15:43:39 +02:00
165e81938c inibito traferimento
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-08-04 14:55:45 +02:00
c87404a4ee controllato deposito null
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-08-04 14:34:57 +02:00
92a9abf978 correzione su importazione docfinance
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-08-04 13:02:00 +02:00
71e99ed943 Merge branch 'master' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
# Conflicts:
#	build/Jenkinsfile.groovy
#	build/create_build_tag.bat
2025-08-04 12:30:40 +02:00
b1c337a238 Aggiornato jenkinsfile per env.properties
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-08-04 12:14:26 +02:00
21fa20e94f Fix after merge
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-08-04 09:27:20 +02:00
bf1b78ccc0 Merge branch 'develop' into feature/RefactoringGestioneColli
# Conflicts:
#	ems-core/src/main/java/it/integry/ems/migration/model/Migration_20241213163759.java
#	ems-engine/src/main/java/it/integry/ems/document/service/DocumentiDirettiService.java
#	ems-engine/src/main/java/it/integry/ems/retail/pvmRetail/service/PvmService.java
2025-08-04 09:26:05 +02:00
5325f3124a Implementate annotazioni durante il trasferimento pedane
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-07-31 16:53:14 +02:00
fce976b2df Fix controllo SQLServerConnection in EntityBase
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-07-31 10:39:35 +02:00
8caa0c924b Rimosso SET NOCOUNT ON all'inizializzazione della connessione 2025-07-31 10:39:32 +02:00
4af7155db9 Cambiati alcuni datasource
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-07-31 09:47:00 +02:00
ab682181ce Fix controllo SQLServerConnection in EntityBase
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
(cherry picked from commit 1d0fed90ae)
2025-07-30 18:59:22 +02:00
d6cda98855 Fix su connection pool size
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-07-30 17:51:43 +02:00
38c1c80abb [GIANT REFACTORING] Ristrutturazione sulla connection pool. Adesso la pool è gestita dal DataSource di Apache DBCP2.
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
# Conflicts:
#	ems-core/src/main/java/it/integry/ems/migration/model/Migration_20241213163759.java
#	ems-engine/src/main/java/it/integry/ems/retail/pvmRetail/service/PvmService.java
2025-07-30 17:49:08 +02:00
fed416de15 Fix Refactoring google maps api 2025-07-30 17:43:10 +02:00
d5bf6aef92 Fix Refactoring google maps api 2025-07-30 17:43:08 +02:00
5a0cfd160f Refactoring google maps api 2025-07-30 17:43:04 +02:00
bea182eea9 Fix import mancante in DocumentiDirettiService
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-07-29 16:47:36 +02:00
ce6a102f45 revisione calcolo totali per ordni web e documenti
(cherry picked from commit a7c3163d84)
2025-07-29 16:44:30 +02:00
9e1a600087 sistemato controllo per documenti imballo
Some checks failed
IntegryManagementSystem_Multi/pipeline/head There was a failure building this commit
2025-07-29 15:34:33 +02:00
89a6a8c2f4 Creata setup per poter mostrare il pulsante configurazione permessi in pvm
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
(cherry picked from commit 76972b00a1)
2025-07-29 12:47:44 +02:00
9fca434612 Correzione get e set flag_stampa_docu_vend - controllo su modifica ed inserimento ultimi 7 gg
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-07-29 10:30:54 +02:00
d675ce0e82 Fix calcolo progressivo in caso di partita diversa da quella dell'ordine
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-07-29 09:23:16 +02:00
ef2f2a91b3 [ROSSOGARGANO ]
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
- aggiunto flag fornitore socio in tabella atb_tipi
- inserite setup report per pagina accettazione da campo
2025-07-28 13:28:58 +02:00
49ff0c839b Merge branch 'develop' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
# Conflicts:
#	ems-engine/src/main/java/it/integry/ems/document/service/DocumentiDirettiService.java
2025-07-28 09:43:35 +02:00
bd5eb9c535 Fix su rollback del salvataggio dei trasferimenti. Fix su check imballi senza cod_mart.
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-07-25 15:55:37 +02:00
0851fe8915 Aggiunto parametro withTestataCollo in servizio di availableItems
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-07-24 11:55:12 +02:00
fa7e3a55ca Merge branch 'master' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-07-22 10:06:22 +02:00
52d34fa810 [ROSSOGARGNAO - ACCETTAZIONE]
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
- corretta seleziona ora inizio versamento
- corretto annullamento versamento
- corretto salvataggio cq pomodori
2025-07-21 16:03:44 +02:00
59624c8c17 [ROSSOGARGANO]
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
- corretta retrocompatibilità con gestione documenti vendita non aggiornata
2025-07-21 12:22:07 +02:00
cd53eca2e8 Aggiunto controllo su passaggio ordini
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-07-21 11:23:29 +02:00
a486b6102b Merge branch 'master' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
# Conflicts:
#	ems-core/src/main/resources/menus/menu_config.json
2025-07-21 10:11:01 +02:00
becfdab1a1 Merge remote-tracking branch 'origin/feature/RefactoringGestioneColli' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-07-17 17:28:51 +02:00
e6605c2feb [ROSSOGARGANO - Documenti]
- aggiunta distribuzione automatica su ordini di ul inserite in packing list
2025-07-17 17:28:46 +02:00
305c79a558 Merge branch 'master' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-07-17 12:20:53 +02:00
edcc08c9da Merge remote-tracking branch 'origin/feature/RefactoringGestioneColli' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-07-16 19:30:29 +02:00
89d0f95834 Nella rettifica dei documenti diretti di vendita ora si possono cambiare le qta dei colli venduti e precedentemente trasferiti 2025-07-16 19:30:23 +02:00
112dc51ac7 Merge remote-tracking branch 'origin/feature/RefactoringGestioneColli' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-07-16 19:05:38 +02:00
a93979c546 [ROSSOGARGANO - Accettazione]
- rimosso posizionamento pre-versamento sui ribaltatori
2025-07-16 19:05:32 +02:00
6b536b20c6 Completato delete UDS da un documento di vendita che ha dei colli trasferiti.
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-07-16 17:46:29 +02:00
17c832745f Disabilitato completeEntity in utility di deleteUL
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-07-16 11:09:18 +02:00
fcb62e3689 [ROSSOGARGANO - trasferimenti]
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
- gestito inserimento codAnag in collo di scarico verso P.V. per
2025-07-16 10:39:00 +02:00
bc88453914 Aggiunto servizio di availableItems
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-07-16 09:34:32 +02:00
a85173bc45 Cambiata delete UL in riproporzionamento scarichi lavorazione
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-07-15 19:32:27 +02:00
ed0c117bac Aggiornati LocalDate dataDoc in MtbColt. Cambiata whereCondColli in LoadColliService.
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-07-15 19:21:44 +02:00
557159cf7f Merge branch 'master' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-07-15 18:41:34 +02:00
46dcdd7745 Merge remote-tracking branch 'origin/feature/RefactoringGestioneColli' into feature/RefactoringGestioneColli 2025-07-15 18:34:10 +02:00
c30c7ec369 create setup nella W_DCOLLI_RESO_DLG per impostare giorni e consegne 2025-07-15 18:26:00 +02:00
8e99c0898d modificato controllo su gruppo merceologico in versamento materiale (presi i tipi SL & PF dalla tabella dei gruppi invece che dalla setup)
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-07-15 15:14:17 +02:00
b4ce3f8d27 Merge remote-tracking branch 'origin/feature/RefactoringGestioneColli' into feature/RefactoringGestioneColli
Some checks failed
IntegryManagementSystem_Multi/pipeline/head There was a failure building this commit
2025-07-15 14:15:12 +02:00
9549583c86 inserito deposito nel servizio resi 2025-07-15 14:15:03 +02:00
5b88fa632c Merge branch 'master' into feature/RefactoringGestioneColli
Some checks failed
IntegryManagementSystem_Multi/pipeline/head There was a failure building this commit
2025-07-15 13:03:39 +02:00
64425c2c4a inserito deposito nel servizio resi
Some checks failed
IntegryManagementSystem_Multi/pipeline/head There was a failure building this commit
2025-07-15 12:56:23 +02:00
e6d5df31dd Migliorie servizi resi
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-07-15 11:48:14 +02:00
f9be1f4463 Merge remote-tracking branch 'origin/feature/RefactoringGestioneColli' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-07-15 11:13:21 +02:00
1cfc7558ac Migliorie servizi resi 2025-07-15 11:13:13 +02:00
140c443030 Merge branch 'master' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-07-15 11:12:08 +02:00
0bfa110d6c Fix class naming di ArticoloPartitaCommessaDTO in ArticoloPartitaCommessaOrdineDTO
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-07-15 10:33:05 +02:00
374d143090 Aggiunto replace del \n\r nelle causali delle fatture elettroniche
Some checks failed
IntegryManagementSystem_Multi/pipeline/head There was a failure building this commit
2025-07-15 10:28:24 +02:00
32dc0b4f4c Merge branch 'master' into feature/RefactoringGestioneColli
Some checks failed
IntegryManagementSystem_Multi/pipeline/head There was a failure building this commit
2025-07-15 10:15:58 +02:00
75edd98223 Fix collisione classi ArticoloPartita
Some checks failed
IntegryManagementSystem_Multi/pipeline/head There was a failure building this commit
2025-07-14 18:58:38 +02:00
d89ddb447c [ROSSOGARGANO - Accettazione]
Some checks failed
IntegryManagementSystem_Multi/pipeline/head There was a failure building this commit
- corretto completamento numero documento certificato per gestione numerazione proposta
2025-07-14 18:08:44 +02:00
a2b668ed96 Merge branch 'master' into feature/RefactoringGestioneColli
Some checks failed
IntegryManagementSystem_Multi/pipeline/head There was a failure building this commit
2025-07-14 17:50:54 +02:00
d7aef97ae0 Aggiunto nuovo servizio di retrieve dati resi cliente
Some checks failed
IntegryManagementSystem_Multi/pipeline/head There was a failure building this commit
2025-07-14 17:45:09 +02:00
4f6eed564e Merge branch 'master' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-07-14 12:43:18 +02:00
e3cf9aa115 Merge branch 'master' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-07-14 12:14:52 +02:00
766e6a18cc Fix su logica di trasferimento pedane in spostaUl
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-07-14 11:51:32 +02:00
45c507cfcc Merge branch 'develop' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-07-14 09:30:05 +02:00
ebaee14167 Migliorato servizio di salvataggio documenti diretti: iniziata implementazione per cancellazione trasferimenti
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-07-14 09:29:38 +02:00
0a56b9dd25 Migliorato servizio di salvataggio documenti diretti: iniziata implementazione per cancellazione trasferimenti
Some checks failed
IntegryManagementSystem_Multi/pipeline/head There was a failure building this commit
2025-07-11 17:19:22 +02:00
51210cd8df [ROSSOGARGANO - Trasferimenti]
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
- gestito deposito dei colli di trasferimento in base al deposito del documento di arrivo
2025-07-11 16:04:15 +02:00
e80d8ee151 aggiunto flag_sezione
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-07-11 15:26:28 +02:00
3b461350d5 sistemato calcolo totale peso nel documento
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-07-11 12:07:18 +02:00
5724dc53c9 Merge remote-tracking branch 'origin/feature/RefactoringGestioneColli' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-07-11 10:02:09 +02:00
84ff15687e [WMS] Implementato servizio di stampa su Trasferimento Pedane
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-07-10 17:35:39 +02:00
422e09b072 Cambiata logica dei documenti diretti: quando deve esserci un trasferimento merce lo intercetta e crea un trasferimento ad-hoc.
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-07-10 16:11:14 +02:00
3dd1cd60cb Merge remote-tracking branch 'origin/feature/RefactoringGestioneColli' into feature/RefactoringGestioneColli 2025-07-08 19:54:44 +02:00
14cf0d60b5 Fix saveArticolo
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-07-08 15:57:09 +02:00
7a0cbebdfb Importazione eviosys check codArtForn
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-07-08 12:27:50 +02:00
f5e208a973 Merge remote-tracking branch 'origin/feature/RefactoringGestioneColli' into feature/RefactoringGestioneColli 2025-07-08 10:36:00 +02:00
f4189b71e0 Piccolo refactoring ICONImportService
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-07-08 10:01:46 +02:00
0d8101ec05 In importazione bolle vebad e eviosys aggiunto controllo colli già esistenti senza documento associato
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-07-07 18:20:20 +02:00
7f42ee47ce Aggiunto tipo_mgrp in getArticoloFromEan128 e rinominati metodi createUDCFromArt
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-07-07 16:47:38 +02:00
0b1310646c Aggiunto servizio per creazione colli con righe già agganciate
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-07-07 12:13:44 +02:00
ebde200a73 [Tosca - ordini V]
- corretta gestione anagrafiche vettori in importazione impegnato
2025-07-07 10:38:16 +02:00
502dc5e7a9 Merge branch 'develop' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
# Conflicts:
#	ems-engine/src/main/java/it/integry/ems/document/service/DocumentiDirettiService.java
2025-07-07 09:39:50 +02:00
4fca7a604b Merge branch 'master' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-07-03 17:28:58 +02:00
2b781e795a [ROSSOGARGANO - MES]
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
- rimosso criterio di calcolo progressivo pedane in base alla linea
2025-07-03 13:26:48 +02:00
cbfa2482da [ROSSOGARGANO - MES]
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
- aggiunto criterio di calcolo progressivo pedane in base alla linea
2025-07-03 13:13:17 +02:00
ef9bbe6198 scadenze bloccate docfinance
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-07-03 12:36:51 +02:00
4e78712c2f Merge remote-tracking branch 'origin/feature/RefactoringGestioneColli' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-07-03 11:59:34 +02:00
bcb23e8a42 [ROSSOGARGANO - MES]
- corretta salience regole progressivoUL per dare priorità alle regole custom di RG
2025-07-03 11:59:30 +02:00
4e9d2615b1 Merge remote-tracking branch 'origin/feature/RefactoringGestioneColli' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-07-03 11:32:01 +02:00
f8da37203c Rimosso valore N in bloccata nel tracciato docfinance
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-07-03 11:20:17 +02:00
29e67b3680 Risolto problema localDate 2025-07-03 11:19:20 +02:00
9a7508d05e rimossa eccezione in caso di suggerimento posizione ul che contiene più articoli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-07-03 11:05:47 +02:00
88da287d33 Aggiunte migration per carelli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-07-02 18:13:32 +02:00
b924e018ab [ROSSOGARGANO - MES]
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
- corretto criterio di check sui barcode versati in produzione togliendo il controllo sulla data scadenza del SL
2025-07-02 17:37:11 +02:00
b9f2ed0509 Merge remote-tracking branch 'origin/feature/RefactoringGestioneColli' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-07-02 17:16:37 +02:00
cecf45cc8f Cambiato SpostaUlRequestDTO, ora accetta una lista di barcode ul.
Creati servizi per trasferimento pedane.
2025-07-02 17:16:31 +02:00
2f6c642ef0 sistemato controllo su diacod
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-07-02 17:01:01 +02:00
c38608d92b sistemato salvataggio imballaggi
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-07-01 15:19:03 +02:00
08b91b91ef Fix su return null in retrieveArtsInGiacenzaByArticolo
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-07-01 15:00:25 +02:00
25d266b0f8 [ROSSOGARGANO]
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
- impostata correttamente la partitaMagProd in generazione partita post versamento semi lavorato
2025-07-01 13:14:35 +02:00
d9287659d2 sistemata regola
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-07-01 13:05:45 +02:00
9542465064 Merge branch 'develop' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-07-01 09:13:26 +02:00
4901067c3f Aggiornata vista mvw_sitart_udc_det_inventario con raggruppamenti per migliorare il datetime_posizionamento
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-06-30 16:46:58 +02:00
35727ef0af Merge branch 'master' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-06-30 16:45:42 +02:00
9aa60b6464 Merge branch 'develop' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-06-30 15:39:46 +02:00
c2d9ccf1b1 [ROSSOGARGANO]
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
- aggiunta gestione interfalde in trasferimenti
2025-06-30 10:33:39 +02:00
56764f5918 Merge remote-tracking branch 'origin/feature/RefactoringGestioneColli' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-06-30 09:32:43 +02:00
c11ead2b49 [ROSSOGARGANO]
- nuovi servizi per la stampa di più report contemporanei
- migration per nuovi report controllo giacenze
2025-06-30 09:32:30 +02:00
219fd1989a Merge branch 'develop' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
# Conflicts:
#	ems-core/src/main/resources/menus/menu_config.json
#	ems-engine/src/main/java/it/integry/ems/document/service/DocumentiDirettiService.java
2025-06-30 09:09:26 +02:00
78137519ec Aggiunto token Winclock
Some checks failed
IntegryManagementSystem_Multi/pipeline/head There was a failure building this commit
(cherry picked from commit a1b9d39ea4)
2025-06-27 12:36:15 +02:00
2010782da4 Aggiornato menu e fix su profilo di lancio MenuStaticCreator
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-06-27 10:48:51 +02:00
a9718b5fbe creata nuova voce menu per WMS Trasferimento Pedane 2025-06-27 10:29:13 +02:00
c995d2334f Creati servizi per gestire il suggerimento di posizione di una UL
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-06-26 18:28:51 +02:00
c0340b9863 Merge branch 'master' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-06-26 11:09:22 +02:00
e8d8f7db1a Ripristinato maggio srl in ems_settings.json
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-06-25 16:51:45 +02:00
e22c467a15 Aggiunto GiovMaggio nelle migraton della Mvw
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-06-25 11:26:02 +02:00
7ba89d3cfa Rimosso Maggio Peppe
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-06-25 11:18:46 +02:00
fbc13719db [ROSSOGARGANO - MES]
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
- corretta duplicazione ordini in versamento SL
2025-06-23 12:25:59 +02:00
5cbc6cce2e Fix su connection utilizzato in OrderRules.setRifOrd()
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-06-23 11:27:38 +02:00
c3871083b1 Merge branch 'develop' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-06-23 09:22:17 +02:00
33c85e3a18 Merge branch 'develop' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
# Conflicts:
#	build/Jenkinsfile.groovy
#	ems-core/pom.xml
2025-06-20 16:49:10 +02:00
e3863f5992 Rimosso slash nell'url dell'apk del WMS
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-06-20 12:11:28 +02:00
218f6b9306 Completati servizi per implementazione reso fornitore
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-06-19 09:46:31 +02:00
cf215fae02 Merge remote-tracking branch 'origin/feature/RefactoringGestioneColli' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-06-18 14:29:09 +02:00
358064102e Completati servizi per implementazione reso fornitore
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-06-18 12:09:09 +02:00
998b63301d Completati servizi per implementazione reso fornitore
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-06-18 11:39:39 +02:00
3055139b83 Aggiunti servizi per retrieve lista resi fornitori
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-06-18 10:12:49 +02:00
cf766e190e Merge remote-tracking branch 'origin/feature/RefactoringGestioneColli' into feature/RefactoringGestioneColli 2025-06-18 09:58:40 +02:00
d61cf134fb Aggiornato Jenkinsfile
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-06-17 18:09:14 +02:00
68238f0d6e Merge remote-tracking branch 'origin/feature/RefactoringGestioneColli' into feature/RefactoringGestioneColli 2025-06-17 12:10:05 +02:00
c3dd5fb59b sistemato aggiornamento contratti
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-06-16 18:54:03 +02:00
96a4ab4b39 Merge branch 'master' into feature/RefactoringGestioneColli
# Conflicts:
#	ems-engine/src/main/java/it/integry/ems/production/service/MesProductionServiceV2.java
2025-06-16 17:21:46 +02:00
e9411988d2 Aggiunti servizi di ricerca per udc nei resi da clienti
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-06-16 12:29:33 +02:00
db6319ad6c Migliorie su servizio di riproporzionamento scarichi produzione
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-06-16 10:00:32 +02:00
8a61bc87bc Merge branch 'master' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-06-16 09:15:45 +02:00
e580a12b0e Migliorie su servizio di riproporzionamento scarichi produzione
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-06-13 17:20:30 +02:00
5576834083 Migliorie su servizio di riproporzionamento scarichi produzione
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-06-13 16:46:24 +02:00
715e1fc6c3 Migliorie su servizio di riproporzionamento scarichi produzione
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-06-12 17:04:09 +02:00
090828aa8a Impostato skipCommit su tutti i processEntity in WMSUtility
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
(cherry picked from commit 696b28e130)
2025-06-12 13:41:45 +02:00
7c65f3a8f9 Impostato skipCommit in deleteUL
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
(cherry picked from commit cba813d062)
2025-06-12 13:37:19 +02:00
778141da66 Merge branch 'develop' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-06-12 13:00:36 +02:00
ceb7deb79f Merge branch 'develop' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
# Conflicts:
#	ems-engine/src/main/java/it/integry/ems/retail/pvmRetail/service/PvmService.java
2025-06-11 17:01:03 +02:00
0724f6ab83 -- fix vari 2025-06-11 17:00:07 +02:00
f910e6855f [ROSSOGARGANO - MES]
- recupero materiale su ordini in chiusura
2025-06-11 16:58:53 +02:00
acbd3e8ac2 [ROSSOGARGANO - MES]
- recupero materiale su ordini in chiusura
2025-06-11 16:57:41 +02:00
5e7209f060 Merge branch 'master' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-06-11 11:20:09 +02:00
5201b5b25d Merge remote-tracking branch 'origin/feature/RefactoringGestioneColli' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-06-11 10:26:30 +02:00
7126f9bf71 [ROSSOGARGANO]
allineamento accettazione da raccolta con nuova struttura colli
2025-06-11 10:26:26 +02:00
5a2ad13068 Fix su servizio di riproporzionamento scarichi produzione
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-06-10 17:32:38 +02:00
c0dc46935b Aggiornato servizio di cancellazione collo carico produzione
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-06-10 12:16:45 +02:00
f1c5d7cd2e Aggiornato servizio di importColliDaProduzione (usato in Rientro Merce WMS).
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
Sistemato servizio riproporzionaScarichiLavorazione utilizzando nuovi servizi di gestione UDC/UDS.
2025-06-10 10:30:04 +02:00
08c675b662 Fix gestione mtb_cols durante exchange colli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-06-09 09:20:03 +02:00
7d9ca973f5 Merge branch 'master' into feature/RefactoringGestioneColli
# Conflicts:
#	ts/ems-engine.module.ts
2025-06-09 09:19:44 +02:00
1b2a3c1203 Merge branch 'master' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-06-06 10:51:11 +02:00
ef7369c2a3 Fix condizione where cond nella vista WMS_OrdPrelievo
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-06-06 10:48:24 +02:00
1520d45609 Merge branch 'master' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-06-05 10:35:30 +02:00
820ae30ab4 Migliorata vista WMS_OrdPrelievo
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-06-04 17:27:15 +02:00
60683c0383 SISTEMATO ERRORE IN STAMPA DOCUMENTI
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-06-04 16:47:50 +02:00
90b955f6a4 Fix su clear internal sqlite db
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-06-04 13:01:10 +02:00
e0d63d5c44 Merge branch 'master' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-06-03 09:40:38 +02:00
d54401cd9e Rimossa dipendenza errata
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-05-30 17:36:38 +02:00
6f6232be13 Aggiunto controllo per evitare importazioni che exchange importi tabelle vuote (che cancellano tutto).
Some checks failed
IntegryManagementSystem_Multi/pipeline/head There was a failure building this commit
Aggiunti campi partita_mag_prod e data_scad_prod in equals di MtbPartitaMag
2025-05-30 17:31:46 +02:00
872503afb5 [WMS] Aggiunto ordine nella riga di rettifica del documento di scarico
Some checks failed
IntegryManagementSystem_Multi/pipeline/head There was a failure building this commit
2025-05-30 12:28:39 +02:00
edd50bed65 [WMS] Aggiunta commessa ordine durante il recupero dei materiali versati
Some checks failed
IntegryManagementSystem_Multi/pipeline/head There was a failure building this commit
2025-05-30 11:58:53 +02:00
aac8b151dc Creato anonimizzatore utenti stb_users
Some checks failed
IntegryManagementSystem_Multi/pipeline/head There was a failure building this commit
2025-05-29 16:11:24 +02:00
76785b22fe Cambiata connessione biolevante con biolevante_peppe
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-05-29 15:08:16 +02:00
bebf48f6c5 Aggiornate migration per nuova MVW
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-05-29 13:19:07 +02:00
79d0ea1967 Rimossa cartella TS
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-05-29 10:01:36 +02:00
069b652035 Fix su aggiornamento valori StbExchangeConfig
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-05-28 18:29:24 +02:00
6b3d579803 Aggiornato Jenkinsfile
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-05-28 17:04:55 +02:00
5acb744618 Gestito inserimento data collo e partita in createColloCaricoProdottoFinito
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-05-27 09:44:44 +02:00
0ee6c261e5 Aggiornati equals MtbColr
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-05-26 16:53:49 +02:00
0b6ad5d5dc Merge branch 'master' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-05-26 16:26:08 +02:00
19c8d1eee7 modificata selezione della partita
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-05-26 14:13:39 +02:00
201996e4b5 Migliorie gestione exchange
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-05-26 13:03:56 +02:00
2bf4edeffe Migliorata update colli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-05-26 12:57:33 +02:00
799c3be92d Merge branch 'master' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-05-26 10:51:08 +02:00
96102328c1 Merge branch 'master' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-05-26 09:19:16 +02:00
2d458e1836 Merge branch 'develop' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
# Conflicts:
#	ems-core/src/main/java/it/integry/ems/looper/service/LooperService.java
2025-05-23 18:47:54 +02:00
3f2ad37ff9 Gestito parametro data collo in scarico da collo 2025-05-23 18:39:28 +02:00
c343ec70ad Aggiornati servizi di recupera materiale con nuove logiche barcode
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-05-23 17:42:31 +02:00
4bb59eee38 Gestita possibilità di indicare la data del trasferimento in sposta ul
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-05-23 09:37:39 +02:00
585771cb2e Aggiornati plugin toolchain e Typescript generator
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-05-22 11:59:43 +02:00
51ad617bd3 Merge branch 'master' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
# Conflicts:
#	ems-core/src/main/java/it/integry/ems/utility/UtilityEntity.java
#	ems-engine/src/main/java/it/integry/ems/retail/wms/generic/controller/WMSGenericController.java
2025-05-22 10:16:49 +02:00
4c71015588 Merge remote-tracking branch 'origin/feature/RefactoringGestioneColli' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-05-22 10:04:53 +02:00
065fb956d3 Migliorato shutdown BasicConnectionPool 2025-05-22 10:04:38 +02:00
f096f72942 [Controllo giacenze]
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
- stampa sscc da distinta in stampa etichetta ul
2025-05-22 10:02:43 +02:00
f61f8283f0 Rimpiazzato utilizzo di LooperService con @Scheduler
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-05-21 18:48:19 +02:00
0682af0dee Migliorie allo shutdown di Tomcat
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-05-21 17:21:06 +02:00
fb09e637ee Convertito campo dataScad in LocalDate nel dto dell'ordine di lavoro (MES)
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-05-21 10:54:25 +02:00
aa4619e323 [ROSSOGARGANO]
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
- Documenti di trasferimento Raggruppati se provenienti dal MES
- gestita possibilità di scegliere se creare i documenti in rettifica colli
2025-05-21 10:41:03 +02:00
5e30e340a2 [ROSSOGARGANO]
- Documenti di trasferimento Raggruppati se provenienti dal MES
- gestita possibilità di scegliere se creare i documenti in rettifica colli
2025-05-21 10:40:56 +02:00
ca8fba8d6f Implementato servizio di retrieve uds già registrate
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-05-20 15:26:49 +02:00
7012dca4a6 Merge branch 'master' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-05-20 11:50:37 +02:00
8256c1e0ce Merge branch 'master' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
# Conflicts:
#	ems-engine/src/main/java/it/integry/ems/production/service/MesProductionServiceV2.java
2025-05-19 20:04:49 +02:00
f92de927ff Merge branch 'master' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-05-19 12:22:57 +02:00
fe5dc1f55b Merge branch 'develop' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
# Conflicts:
#	ems-engine/src/main/java/it/integry/ems/retail/wms/Utility/WMSUtility.java
2025-05-19 09:37:19 +02:00
557ada2363 Merge branch 'master' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-05-16 18:04:09 +02:00
6b30fea7b8 Aggiornata createULLavorazione nella sezione MES per supportare la nuova struttura
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-05-16 17:59:21 +02:00
71df21c003 sistemato controlo su traferimento
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-05-16 15:17:27 +02:00
d73f607e21 Aggiornata vista di getPickingList per WMS
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-05-16 13:02:53 +02:00
960f74e7cd Fix posizione in spostaMerceTraUl
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-05-15 18:28:20 +02:00
e1e9a3cbfc Rimosso Rossogargano_peppe da build docker
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-05-15 13:41:44 +02:00
48d5190586 Merge branch 'master' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
# Conflicts:
#	ems-engine/src/main/java/it/integry/ems/production/service/MesProductionServiceV2.java
2025-05-15 12:15:39 +02:00
36c6ec6c64 Merge remote-tracking branch 'origin/feature/RefactoringGestioneColli' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-05-15 10:19:47 +02:00
7f3c43f263 sistemato controllo per trasferimenti 2025-05-15 10:19:44 +02:00
4d0dfc5341 rimosso controllo su deposito collo diverso da documento in generazione CLAV
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-05-14 18:06:04 +02:00
b08e1ef6bb Merge branch 'master' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-05-14 17:36:57 +02:00
09b8d47c76 modifiche su creazione colli da documenti
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-05-14 16:01:45 +02:00
43f59ccf3b Merge branch 'master' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-05-13 20:25:50 +02:00
fee5320c37 Merge branch 'master' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-05-13 20:18:54 +02:00
3a55dcdb58 Merge branch 'master' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-05-13 19:51:20 +02:00
f5ea90a0d0 -corretta pubblicazione su azure di branch non classici
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-05-13 18:47:53 +02:00
b833fc79e8 Merge branch 'master' into feature/RefactoringGestioneColli
Some checks failed
IntegryManagementSystem_Multi/pipeline/head There was a failure building this commit
2025-05-13 18:39:00 +02:00
f52aa4d837 Merge branch 'hotfix/Hotfix-1'
Some checks failed
IntegryManagementSystem_Multi/pipeline/head There was a failure building this commit
2025-05-13 18:36:32 +02:00
fff5faf3be Merge branch 'master' into feature/RefactoringGestioneColli
Some checks failed
IntegryManagementSystem_Multi/pipeline/head There was a failure building this commit
2025-05-13 18:30:37 +02:00
978b42d18a Aggiunto barcode ul nella retrieveAlreadyRegisteredUDC
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-05-12 19:12:20 +02:00
c7c8b1be24 Aggiunto supporto procedura di versamento automatico con le nuove logiche dei colli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-05-12 18:45:20 +02:00
6034120f1f Aggiunto CodJfas in create UDC
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-05-12 12:17:51 +02:00
c2b6d4ba69 Rimosso _peppe da rossogargano
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-05-12 10:37:04 +02:00
bc97f9a573 Merge branch 'develop' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-05-12 10:25:30 +02:00
ce1f68deb2 Merge branch 'develop' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-05-12 09:41:02 +02:00
45bf3d67d1 Merge branch 'develop' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-05-12 09:27:46 +02:00
bf38dfe0d8 Merge branch 'develop' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-05-09 17:28:25 +02:00
af68b892f3 aggiunto trasferimento automatico in versamento materia prima su ordine di lavorazione
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-05-09 16:20:44 +02:00
af29eeba58 Merge branch 'develop' into feature/RefactoringGestioneColli
# Conflicts:
#	ems-engine/src/main/java/it/integry/ems/document/service/DocumentiDirettiService.java
#	ems-engine/src/main/java/it/integry/ems/retail/wms/lavorazione/service/WMSLavorazioneService.java
2025-05-09 13:23:54 +02:00
5698329cc8 Fix su distribuzione colli. Quando si distribuiva un collo con 2 righe dello stesso articolo / partita la distribuzione attribuiva ad entrambe le righe gli stessi collo_rif.
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-05-09 10:58:48 +02:00
d70efd3af2 aggiunti dati testata collo
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-05-08 18:52:52 +02:00
f99957eb41 Merge branch 'develop' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-05-08 16:52:15 +02:00
40104bcce7 Merge branch 'develop' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-05-06 10:39:46 +02:00
edda81733d Merge branch 'develop' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
# Conflicts:
#	ems-engine/src/main/java/it/integry/ems/document/service/DocumentiDirettiService.java
#	ems-engine/src/main/java/it/integry/ems/retail/wms/generic/service/WMSGenericService.java
2025-04-30 09:59:42 +02:00
ceb11d3261 aggiunti riferimenti collo in movimenti di cambio posizione ul
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-04-23 15:14:44 +02:00
a13671c51a Merge branch 'develop' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-04-22 11:46:08 +02:00
b94d9b1177 [TRASFERIMENTO UL]
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
corretto deposito testata movimento di scarico a PV
aggiunto rollback in errore trasferimento
2025-04-22 11:42:57 +02:00
d027f3ff20 Merge branch 'develop' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-04-18 15:23:17 +02:00
8601f4fd90 gestione documenti di trasferimento in emissione documenti di vendita
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-04-18 14:54:35 +02:00
73ade8691d Merge branch 'develop' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-04-18 10:39:28 +02:00
df2a7d6e36 Merge branch 'develop' into feature/RefactoringGestioneColli
Some checks failed
IntegryManagementSystem_Multi/pipeline/head There was a failure building this commit
2025-04-18 10:20:54 +02:00
c7c6affe3e Merge branch 'develop' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
# Conflicts:
#	ems-engine/src/main/java/it/integry/ems/production/service/MesProductionServiceV2.java
#	ems-engine/src/main/java/it/integry/ems/retail/pvmRetail/service/PvmService.java
#	ems-engine/src/main/java/it/integry/ems/retail/wms/generic/service/WMSGenericService.java
2025-04-17 15:32:22 +02:00
54fc28eb74 Fix su migration per nuova logica WMS
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-04-17 15:17:48 +02:00
ab1200ff84 Aggiunto tentativo di riconoscimento ean128 in createUDCFromArt
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-04-16 15:12:57 +02:00
22f65037f4 aggiunto riavvio automatico cache utenti all' invalidate
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-04-16 10:26:03 +02:00
ec2b83657a corretto servizio trasferimento UL 2025-04-15 16:38:28 +02:00
2511aabbdb Fix vari
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-04-11 17:04:19 +02:00
313fa6a8df Aggiunti controlli in createUDC
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-04-11 16:29:35 +02:00
9bb8751e21 Implementate nuove logiche di barcode_ul in rettifica giacenze
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-04-11 10:51:23 +02:00
24c4935dad Fix after merge
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-04-11 09:35:27 +02:00
61d76b03c4 Merge branch 'develop' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-04-11 09:33:25 +02:00
0f973c962a Refactoring creazione UL da MES
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-04-10 20:08:38 +02:00
cffe9082db Fix su qta in righe di rettifica 2025-04-10 19:14:38 +02:00
6c88b7b288 Fix barcode in versamento materiali MES
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-04-10 17:52:55 +02:00
ea2121e111 Fix vari
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-04-10 17:01:23 +02:00
1191f98485 Sistemato codice deposito e posizione durante la getColloByBarcode (ora vengono letti gli ultimi validi dalla giacenza)
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-04-10 13:27:12 +02:00
6c0e2d5259 Merge branch 'develop' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-04-10 12:52:49 +02:00
894da40182 Cambiato IntegryCustomerDB per puntare a Rossogargano_peppe 2025-04-10 12:52:09 +02:00
749a7e9750 Cambiato db RossoGargano in RossoGargano_peppe
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-04-10 12:27:17 +02:00
e5a66bfd15 Merge branch 'develop' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
# Conflicts:
#	ems-engine/src/main/java/it/integry/ems/production/service/OrtoFruttaProductionService.java
#	ems-engine/src/main/java/it/integry/ems/retail/wms/Utility/WMSUtility.java
#	ems-engine/src/main/java/it/integry/ems/retail/wms/accettazione/service/WMSAccettazioneBollaService.java
#	ems-engine/src/main/java/it/integry/ems/retail/wms/accettazione/service/WMSAccettazioneService.java
#	ems-engine/src/main/java/it/integry/ems/retail/wms/documenti/service/WMSDocumentService.java
#	ems-engine/src/main/java/it/integry/ems/retail/wms/generic/service/WMSGenericService.java
#	ems-engine/src/main/java/it/integry/ems/retail/wms/inventario/service/WMSInventarioService.java
#	ems-engine/src/main/java/it/integry/ems/retail/wms/lavorazione/dto/VersaMaterialiRequestDTO.java
#	ems-engine/src/main/java/it/integry/ems/retail/wms/lavorazione/service/WMSLavorazioneService.java
#	ems-engine/src/main/java/it/integry/ems/retail/wms/vendita/service/WMSSpedizioneService.java
2025-04-10 12:03:36 +02:00
9761d05a8e Merge branch 'develop' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-04-09 12:09:46 +02:00
050e8bd19e Merge branch 'develop' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-04-09 12:06:25 +02:00
a0c3d3a6b3 Fix after merge
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-04-09 11:33:59 +02:00
f06117d5ef Merge branch 'develop' into feature/RefactoringGestioneColli
# Conflicts:
#	ems-engine/src/main/java/it/integry/ems/retail/wms/Utility/WMSUtility.java
#	ems-engine/src/main/java/it/integry/ems/retail/wms/generic/service/WMSGiacenzaULService.java
#	ems-engine/src/main/java/it/integry/ems/retail/wms/lavorazione/controller/WMSMaterialiController.java
#	ems-engine/src/main/java/it/integry/ems/retail/wms/lavorazione/dto/VersaMaterialiRequestDTO.java
#	ems-engine/src/main/java/it/integry/ems/retail/wms/lavorazione/service/WMSMaterialiService.java
2025-04-09 11:32:45 +02:00
75262b5940 Fix in distribuzione colli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-04-09 10:53:12 +02:00
0b3f1ee9fc Aggiornato ems-settings docker
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-04-08 11:52:55 +02:00
7c19c93814 Aggiornato ems-settings docker
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-04-08 11:45:55 +02:00
532c12dd22 Iniziato refactoring VersamentoMateriali
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-04-08 09:04:17 +02:00
e81c2ac6b9 Merge branch 'refs/heads/develop' into feature/RefactoringGestioneColli 2025-04-08 09:04:01 +02:00
161ea5e5dd Fix Jenkinsfile
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-04-07 18:57:56 +02:00
260019d79f Fix Jenkinsfile
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-04-07 18:48:04 +02:00
08b68781e9 Refactoring del servizio di versamento e rientro del materiale da MES
Some checks failed
IntegryManagementSystem_Multi/pipeline/head Something is wrong with the build of this commit
2025-04-07 18:27:25 +02:00
760be03b18 Merge branch 'develop' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
# Conflicts:
#	ems-engine/src/main/java/it/integry/ems/retail/pvmRetail/service/PvmService.java
2025-04-07 09:40:00 +02:00
148a4359b6 Fix null
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-04-07 09:39:15 +02:00
b65d35cfd6 Migliorato servizio di retrieve UL in posizione con relativo stato
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-04-05 12:14:11 +02:00
54eb75a420 Sistemato riposizionamento UL
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-04-04 19:28:50 +02:00
e9d28c6f63 Merge branch 'develop' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-04-04 12:50:52 +02:00
212f14db36 Merge branch 'develop' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-04-04 11:49:55 +02:00
b50e25a0ee Aggiornate migration gramm
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-04-04 11:48:18 +02:00
0a49695d7c Aggiornato servizio di SpostaArtsTraUl
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-04-04 10:49:20 +02:00
9e5a2e8400 Merge branch 'develop' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-04-03 18:13:58 +02:00
f0fb85e6db Aggiunto servizio per il recupero dei barcode_ul in posizione e implementata migrazione per aggiornare i barcode_ul in mtb_colt e mtb_colr
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-04-03 17:44:59 +02:00
86081ec113 Refactoring servizio di retrieve colli in giacenza
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-04-02 19:04:50 +02:00
617 changed files with 31504 additions and 13346 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -2,6 +2,7 @@
<configuration default="false" name="MenuStaticCreator" type="Application" factoryName="Application" nameIsGenerated="true"> <configuration default="false" name="MenuStaticCreator" type="Application" factoryName="Application" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="it.integry.ems.menu.MenuStaticCreator" /> <option name="MAIN_CLASS_NAME" value="it.integry.ems.menu.MenuStaticCreator" />
<module name="ems-core" /> <module name="ems-core" />
<shortenClasspath name="MANIFEST" />
<extension name="coverage"> <extension name="coverage">
<pattern> <pattern>
<option name="PATTERN" value="it.integry.ems.menu.*" /> <option name="PATTERN" value="it.integry.ems.menu.*" />

6
.idea/sqldialects.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="SqlDialectMappings">
<file url="file://$PROJECT_DIR$/ems-engine/src/main/java/it/integry/ems/document/farm_mes/service/FarmMesImportService.java" dialect="GenericSQL" />
</component>
</project>

10
.idea/structuralSearch.xml generated Normal file
View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="StructuralSearch">
<searchConfiguration name="LocalDate passato a SimpleDateFormat" text="$formatter$.format($date$)" recursive="true" caseInsensitive="true" type="JAVA" pattern_context="default">
<constraint name="__context__" within="" contains="" />
<constraint name="formatter" nameOfExprType="java\.text\.SimpleDateFormat" within="" contains="" />
<constraint name="date" nameOfExprType="java\.time\.LocalDate" within="" contains="" />
</searchConfiguration>
</component>
</project>

View File

@@ -5,16 +5,7 @@
"primaryInstance" : true, "primaryInstance" : true,
"enableTokenCaching" : false, "enableTokenCaching" : false,
"systemPassword" : "?MF!jbI+&OkA", "systemPassword" : "?MF!jbI+&OkA",
"availableConnections" : [ { "availableConnections" : [{
"profileName" : "MAGGIOSRL",
"connectionType" : "MSSQL",
"dbName" : "MaggioSRL",
"username" : "sa",
"password" : "sZ",
"host" : "192.168.2.214",
"encryptedDbPsw" : true,
"internalDb" : true
}, {
"profileName" : "AGRICOPER", "profileName" : "AGRICOPER",
"connectionType" : "MSSQL", "connectionType" : "MSSQL",
"dbName" : "agricoper", "dbName" : "agricoper",
@@ -33,18 +24,18 @@
"encryptedDbPsw" : true, "encryptedDbPsw" : true,
"internalDb" : true "internalDb" : true
}, { }, {
"profileName" : "COAP", "profileName" : "RESINA_COLOR",
"connectionType" : "MSSQL", "connectionType" : "MSSQL",
"dbName" : "COAP", "dbName" : "RESINACOLOR",
"username" : "sa", "username" : "sa",
"password" : "sZ", "password" : "sZ",
"host" : "192.168.2.214", "host" : "192.168.2.214",
"encryptedDbPsw" : true, "encryptedDbPsw" : true,
"internalDb" : true "internalDb" : true
}, { }, {
"profileName" : "RESINA_COLOR", "profileName" : "RESINA_COLOR_PASQUALE",
"connectionType" : "MSSQL", "connectionType" : "MSSQL",
"dbName" : "RESINACOLOR", "dbName" : "RESINACOLOR_PASQUALE",
"username" : "sa", "username" : "sa",
"password" : "sZ", "password" : "sZ",
"host" : "192.168.2.214", "host" : "192.168.2.214",
@@ -242,12 +233,21 @@
}, { }, {
"profileName" : "GRAMM", "profileName" : "GRAMM",
"connectionType" : "MSSQL", "connectionType" : "MSSQL",
"dbName" : "gramm", "dbName" : "gramm_peppe",
"username" : "SA", "username" : "SA",
"password" : "sZ", "password" : "sZ",
"host" : "192.168.2.220", "host" : "192.168.2.220",
"encryptedDbPsw" : true, "encryptedDbPsw" : true,
"internalDb" : true "internalDb" : true
}, {
"profileName" : "MAGGIOSRL",
"connectionType" : "MSSQL",
"dbName" : "MaggioSRL",
"username" : "sa",
"password" : "sZ",
"host" : "192.168.2.214",
"encryptedDbPsw" : true,
"internalDb" : true
}, { }, {
"profileName" : "IDROTECNICA", "profileName" : "IDROTECNICA",
"connectionType" : "MSSQL", "connectionType" : "MSSQL",
@@ -278,7 +278,7 @@
}, { }, {
"profileName" : "IME_TE", "profileName" : "IME_TE",
"connectionType" : "MSSQL", "connectionType" : "MSSQL",
"dbName" : "IME_TE", "dbName" : "IME_TE_peppe",
"username" : "SA", "username" : "SA",
"password" : "sZ", "password" : "sZ",
"host" : "192.168.2.214", "host" : "192.168.2.214",
@@ -692,7 +692,7 @@
}, { }, {
"profileName" : "BIOLEVANTE", "profileName" : "BIOLEVANTE",
"connectionType" : "MSSQL", "connectionType" : "MSSQL",
"dbName" : "biolevante", "dbName": "biolevante",
"username" : "SA", "username" : "SA",
"password" : "sZ", "password" : "sZ",
"host" : "192.168.2.220", "host" : "192.168.2.220",

View File

@@ -19,6 +19,7 @@ import it.integry.WooCommerce.dto.product.variation.WooCommerceProductVariationD
import it.integry.WooCommerce.enums.ArticoloException; import it.integry.WooCommerce.enums.ArticoloException;
import it.integry.WooCommerce.enums.StockStatus; import it.integry.WooCommerce.enums.StockStatus;
import it.integry.WooCommerce.enums.SyncOrigin; import it.integry.WooCommerce.enums.SyncOrigin;
import it.integry.common.var.CommonConstants;
import it.integry.ems.Import.dto.AnomalieDTO; import it.integry.ems.Import.dto.AnomalieDTO;
import it.integry.ems.service.EntityProcessor; import it.integry.ems.service.EntityProcessor;
import it.integry.ems.service.MailService; import it.integry.ems.service.MailService;
@@ -29,7 +30,6 @@ import it.integry.ems_model.entity.WdtbOrds;
import it.integry.ems_model.entity.WdtbOrdt; import it.integry.ems_model.entity.WdtbOrdt;
import it.integry.ems_model.service.SetupGest; import it.integry.ems_model.service.SetupGest;
import it.integry.ems_model.types.OperationType; import it.integry.ems_model.types.OperationType;
import it.integry.ems_model.utility.UtilityDate;
import it.integry.ems_model.utility.UtilityStream; import it.integry.ems_model.utility.UtilityStream;
import it.integry.ems_model.utility.UtilityString; import it.integry.ems_model.utility.UtilityString;
import org.apache.commons.text.StringEscapeUtils; import org.apache.commons.text.StringEscapeUtils;
@@ -41,7 +41,7 @@ import org.springframework.stereotype.Service;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.text.SimpleDateFormat; import java.time.LocalDate;
import java.util.*; import java.util.*;
import java.util.concurrent.*; import java.util.concurrent.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -445,7 +445,8 @@ public class WooCommerceService {
} }
//CHIAVE ORDINE //CHIAVE ORDINE
Date dataOrd = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss").parse(orderDTO.getDateCreated()); LocalDate dataOrd = UtilityString.parseLocalDateTime(orderDTO.getDateCreated(), "yyyy-MM-dd'T'HH:mm:ss")
.toLocalDate();
ordineWeb ordineWeb
.setGestione("V") .setGestione("V")
@@ -453,7 +454,7 @@ public class WooCommerceService {
.setNumOrd(Integer.parseInt(orderDTO.getNumber())) .setNumOrd(Integer.parseInt(orderDTO.getNumber()))
//CHIAVE RIFERIMENTO ORDINE WOOCOMMERCE //CHIAVE RIFERIMENTO ORDINE WOOCOMMERCE
.setSerie(dataManager.getSetup("SERIE")) .setSerie(dataManager.getSetup("SERIE"))
.setRifOrd(UtilityString.left("RIF N." + orderDTO.getNumber() + " DEL " + UtilityDate.formatDate(dataOrd, "dd-MM-yy") + " " + orderDTO.getOrderKey(), 40)) .setRifOrd(UtilityString.left("RIF N." + orderDTO.getNumber() + " DEL " + CommonConstants.DATE_DMY_DASHED_FORMATTER.format(dataOrd) + " " + orderDTO.getOrderKey(), 40))
.setDataOrdRif(dataOrd) .setDataOrdRif(dataOrd)
.setNumOrdRif(Integer.parseInt(orderDTO.getNumber())) .setNumOrdRif(Integer.parseInt(orderDTO.getNumber()))
.setListino(dataManager.getSetup("LISTINO")); .setListino(dataManager.getSetup("LISTINO"));

View File

@@ -20,16 +20,17 @@ public class CommonConstants {
public static final String TIMESTAMP = "timestamp"; public static final String TIMESTAMP = "timestamp";
public static final String DATE_FORMAT_YMD = "yyyy-MM-dd"; public static final String DATE_FORMAT_YMD_SLASHED = "yyyy/MM/dd";
public static final String DATE_FORMAT_DMY = "dd/MM/yyyy"; public static final String DATE_FORMAT_YMD_DASHED = "yyyy-MM-dd";
public static final String DATE_FORMAT_DMY_SLASHED = "dd/MM/yyyy";
public static final String DATE_FORMAT_DMY_DASHED = "dd-MM-yyyy"; public static final String DATE_FORMAT_DMY_DASHED = "dd-MM-yyyy";
public static final String DATE_FORMAT_DMYHMS_UNSPACED = "ddMMyyyyHHmmss"; public static final String DATE_FORMAT_DMYHMS_UNSPACED = "ddMMyyyyHHmmss";
public static final String TIME_FORMAT = "HH:mm:ss"; public static final String TIME_FORMAT = "HH:mm:ss";
public static final String DATETIME_FORMAT_YMD = String.format("%s %s", DATE_FORMAT_YMD, TIME_FORMAT); public static final String DATETIME_FORMAT_YMD = String.format("%s %s", DATE_FORMAT_YMD_DASHED, TIME_FORMAT);
public static final String DATETIME_FORMAT_DMY = String.format("%s %s", DATE_FORMAT_DMY_DASHED, TIME_FORMAT); public static final String DATETIME_FORMAT_DMY = String.format("%s %s", DATE_FORMAT_DMY_DASHED, TIME_FORMAT);
public static final String DATETIME_FORMAT_DMY_SLASHED = String.format("%s %s", DATE_FORMAT_DMY, TIME_FORMAT); public static final String DATETIME_FORMAT_DMY_SLASHED = String.format("%s %s", DATE_FORMAT_DMY_SLASHED, TIME_FORMAT);
public static final String DATETIME_FORMAT_DMY_DASHED = String.format("%s %s", DATE_FORMAT_DMY_DASHED, TIME_FORMAT); public static final String DATETIME_FORMAT_DMY_DASHED = String.format("%s %s", DATE_FORMAT_DMY_DASHED, TIME_FORMAT);
@@ -46,12 +47,17 @@ public class CommonConstants {
.withZone(ZoneId.systemDefault()); .withZone(ZoneId.systemDefault());
public static final DateTimeFormatter DATE_YMD_DASHED_FORMATTER = DateTimeFormatter.ofPattern(CommonConstants.DATE_FORMAT_YMD) public static final DateTimeFormatter DATE_YMD_SLASHED_FORMATTER = DateTimeFormatter.ofPattern(CommonConstants.DATE_FORMAT_YMD_SLASHED)
.withZone(ZoneId.systemDefault());
public static final DateTimeFormatter DATE_YMD_DASHED_FORMATTER = DateTimeFormatter.ofPattern(CommonConstants.DATE_FORMAT_YMD_DASHED)
.withZone(ZoneId.systemDefault()); .withZone(ZoneId.systemDefault());
public static final DateTimeFormatter DATETIME_YMD_DASHED_FORMATTER = DateTimeFormatter.ofPattern(CommonConstants.DATETIME_FORMAT_YMD) public static final DateTimeFormatter DATETIME_YMD_DASHED_FORMATTER = DateTimeFormatter.ofPattern(CommonConstants.DATETIME_FORMAT_YMD)
.withZone(ZoneId.systemDefault()); .withZone(ZoneId.systemDefault());
public static final DateTimeFormatter DATE_DMY_SLASHED_FORMATTER = DateTimeFormatter.ofPattern(CommonConstants.DATE_FORMAT_DMY)
public static final DateTimeFormatter DATE_DMY_SLASHED_FORMATTER = DateTimeFormatter.ofPattern(CommonConstants.DATE_FORMAT_DMY_SLASHED)
.withZone(ZoneId.systemDefault());
public static final DateTimeFormatter DATE_DMY_DASHED_FORMATTER = DateTimeFormatter.ofPattern(CommonConstants.DATE_FORMAT_DMY_DASHED)
.withZone(ZoneId.systemDefault()); .withZone(ZoneId.systemDefault());
public static final DateTimeFormatter DATETIME_DMY_SLASHED_FORMATTER = DateTimeFormatter.ofPattern(CommonConstants.DATETIME_FORMAT_DMY_SLASHED) public static final DateTimeFormatter DATETIME_DMY_SLASHED_FORMATTER = DateTimeFormatter.ofPattern(CommonConstants.DATETIME_FORMAT_DMY_SLASHED)
.withZone(ZoneId.systemDefault()); .withZone(ZoneId.systemDefault());

View File

@@ -0,0 +1,269 @@
package it.integry.ems.anonymizer;
import java.security.SecureRandom;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
/**
* Generatore di nomi e cognomi italiani per l'anonimizzazione dei dati.
* Mantiene la coerenza del sesso tra nome e genere.
*/
public class ItalianNameGenerator {
private final Random random;
// Nomi maschili italiani (200+ nomi)
public static final List<String> MALE_NAMES = Arrays.asList(
"Alessandro", "Andrea", "Antonio", "Francesco", "Marco", "Matteo", "Giuseppe", "Luca",
"Giovanni", "Roberto", "Stefano", "Paolo", "Davide", "Michele", "Simone", "Federico",
"Riccardo", "Fabio", "Daniele", "Massimo", "Claudio", "Nicola", "Gabriele", "Vincenzo",
"Lorenzo", "Salvatore", "Emanuele", "Alberto", "Diego", "Tommaso", "Alessio", "Filippo",
"Giorgio", "Mattia", "Franco", "Bruno", "Enrico", "Mario", "Carlo", "Gianluca",
"Cristian", "Domenico", "Raffaele", "Sergio", "Pasquale", "Gianni", "Carmine", "Gennaro",
"Antonino", "Gaetano", "Rocco", "Mauro", "Pierluigi", "Valerio", "Mirko", "Dario",
"Enzo", "Alfredo", "Renzo", "Giancarlo", "Giampaolo", "Pierpaolo", "Gianfranco", "Guido",
"Nino", "Piero", "Armando", "Luciano", "Renato", "Angelo", "Aldo", "Giulio",
"Marcello", "Rodolfo", "Umberto", "Silvano", "Ivano", "Giampiero", "Silvio", "Maurizio",
"Leonardo", "Adriano", "Ferdinando", "Bernardo", "Teodoro", "Edoardo", "Arturo", "Gino",
"Biagio", "Fabrizio", "Fausto", "Ettore", "Cesare", "Elio", "Amerigo", "Italo",
"Orlando", "Romeo", "Sandro", "Tiziano", "Ignazio", "Ciro", "Loris", "Orazio",
"Lino", "Nello", "Rino", "Primo", "Secondo", "Terzo", "Quarto", "Quinto",
"Sesto", "Settimo", "Ottavio", "Nono", "Decimo", "Benito", "Dante", "Virgilio",
"Omero", "Eugenio", "Aurelio", "Valentino", "Corrado", "Manlio", "Emilio", "Tullio",
"Attilio", "Marcello", "Romolo", "Remo", "Amedeo", "Cosimo", "Damiano", "Sebastiano",
"Cristoforo", "Bartolomeo", "Giacomo", "Simone", "Pietro", "Girolamo", "Leopoldo", "Gaspare",
"Melchiorre", "Baldassarre", "Epifanio", "Gerardo", "Ruggero", "Tancredi", "Arnaldo", "Osvaldo",
"Rinaldo", "Romualdo", "Ubaldo", "Raimondo", "Edmondo", "Redento", "Crescenzo", "Innocenzo",
"Fiorenzo", "Vincenzo", "Enzo", "Renzo", "Nunzio", "Maurizio", "Patrizio", "Orazio",
"Flavio", "Claudio", "Giuliano", "Adriano", "Emiliano", "Massimiliano", "Gianmarco", "Marcantonio",
"Gianbattista", "Giovanbattista", "Giammarco", "Gianluigi", "Giampiero", "Gianmaria", "Giandomenico", "Gianpaolo",
"Pierfrancesco", "Piergiorgio", "Pierangelo", "Piermario", "Piercarlo", "Piergiuseppe", "Gioacchino", "Bartolomeo",
"Benedetto", "Benvenuto", "Bonaventura", "Bonifacio", "Camillo", "Calogero", "Carmelo", "Demetrio",
"Dionisio", "Donato", "Egidio", "Eliseo", "Erminio", "Eustachio", "Evandro", "Ezio",
"Fermo", "Fernando", "Ferruccio", "Fortunato", "Fulvio", "Gaetano", "Germano", "Giosuè",
"Gregorio", "Guglielmo", "Lamberto", "Lanfranco", "Liborio", "Lucio", "Luigi", "Manfredo"
);
// Nomi femminili italiani (200+ nomi)
public static final List<String> FEMALE_NAMES = Arrays.asList(
"Giulia", "Francesca", "Chiara", "Federica", "Sara", "Martina", "Valentina", "Alessandra",
"Silvia", "Elisa", "Giorgia", "Elena", "Paola", "Laura", "Roberta", "Alice", "Serena",
"Barbara", "Anna", "Maria", "Simona", "Claudia", "Monica", "Cristina", "Elisabetta",
"Stefania", "Valeria", "Daniela", "Manuela", "Antonella", "Giovanna", "Sabrina", "Emanuela",
"Ilaria", "Cinzia", "Rosanna", "Patrizia", "Teresa", "Carmela", "Giuseppina", "Rosa",
"Antonietta", "Concetta", "Caterina", "Angela", "Raffaella", "Luisa", "Lucia", "Michela",
"Franceschina", "Graziella", "Isabella", "Benedetta", "Beatrice", "Margherita", "Alessia", "Andrea",
"Cristiana", "Fabiana", "Gabriella", "Gianna", "Lorena", "Marisa", "Nicoletta", "Ornella",
"Rosaria", "Silvana", "Susanna", "Tiziana", "Viviana", "Adriana", "Agnese", "Albina",
"Amelia", "Andreina", "Angelica", "Antonella", "Arianna", "Armida", "Augusta", "Aurora",
"Bruna", "Brunella", "Camilla", "Carla", "Carolina", "Cecilia", "Clara", "Clelia",
"Concettina", "Corinna", "Cosima", "Costanza", "Cristiana", "Delia", "Diana", "Dora",
"Donatella", "Edvige", "Eleonora", "Elvira", "Emma", "Enrichetta", "Ester", "Eugenia",
"Eva", "Fabia", "Fabiola", "Fernanda", "Fiorella", "Fiorenza", "Flora", "Franca",
"Gaia", "Gemma", "Gilda", "Gina", "Gloria", "Grazia", "Ida", "Ilda",
"Immacolata", "Ines", "Iolanda", "Irene", "Iris", "Ivana", "Ivanka", "Lara",
"Letizia", "Licia", "Lidia", "Liliana", "Lina", "Linda", "Lisa", "Livia",
"Loredana", "Lorella", "Lorenza", "Luana", "Luciana", "Lucilla", "Lucrezia", "Ludovica",
"Luigia", "Luna", "Maddalena", "Mafalda", "Marcella", "Marella", "Marilena", "Marina",
"Marisa", "Marta", "Matilde", "Maura", "Mirella", "Miriam", "Morena", "Nadia",
"Natalia", "Natalina", "Nella", "Nelly", "Nicole", "Noemi", "Norma", "Olga",
"Olimpia", "Orietta", "Palmira", "Pamela", "Pascale", "Pasqualina", "Pia", "Piera",
"Pierina", "Priscilla", "Raffaela", "Rebecca", "Regina", "Renata", "Rita", "Romina",
"Rosalba", "Rosalia", "Rosangela", "Rosanna", "Rosella", "Rosetta", "Rosina", "Rossana",
"Rossella", "Samanta", "Sandra", "Santina", "Sebastiana", "Serafina", "Sonia", "Stella",
"Tecla", "Tina", "Tosca", "Tullia", "Uberta", "Umberta", "Ursula", "Vera",
"Veronica", "Vincenza", "Viola", "Virginia", "Vittoria", "Wanda", "Yvonne", "Zaira",
"Zelda", "Zita", "Zoe", "Ambra", "Azzurra", "Bianca", "Celeste", "Diamante",
"Fiamma", "Giada", "Perla", "Sole", "Stella", "Alba", "Alma", "Anya"
);
// Cognomi italiani (300+ cognomi)
public static final List<String> SURNAMES = Arrays.asList(
"Rossi", "Ferrari", "Russo", "Bianchi", "Romano", "Gallo", "Costa", "Fontana",
"Esposito", "Ricci", "Bruno", "Moretti", "Marino", "Greco", "Barbieri", "Lombardi",
"Giordano", "Colombo", "Rizzo", "Benedetti", "Palumbo", "Pellegrini", "Caruso", "Ferretti",
"Galli", "Marchetti", "Villa", "Mancini", "Conte", "Serra", "Ferrero", "Martinelli",
"Mariani", "Giuliani", "Vitale", "Santoro", "Ferrara", "Leone", "Longo", "Gentile",
"Martino", "Fabbri", "Rinaldi", "Messina", "Riva", "Conti", "Silvestri", "Coppola",
"Negri", "Milani", "Parisi", "Sala", "Cattaneo", "Orlando", "Fiore", "Marini",
"Guerra", "Pagano", "Bernardi", "Valenti", "Farina", "Ruggiero", "Caputo", "Monti",
"Grassi", "Montanari", "Santini", "Morelli", "Amato", "Neri", "Donati", "Testa",
"Bianco", "Sorrentino", "Rossini", "Giuliano", "Sartori", "De Angelis", "De Rosa",
"Basile", "Costantini", "Rizzi", "Barone", "Martini", "De Santis", "Basso", "Pellegrino",
"Carbone", "Gatti", "Coppola", "Rossetto", "Piras", "Ricci", "Martinelli", "Sanna",
"Torrisi", "Scuderi", "Priolo", "Anastasi", "Puglisi", "La Rosa", "Catalano", "Garofalo",
"Aiello", "Trovato", "Pappalardo", "Pulvirenti", "Marletta", "Di Marco", "Biondi", "Ferri",
"Testa", "Marchi", "Baldini", "Benedetti", "Colombi", "Gasparini", "Orlandi", "Barbera",
"Damico", "Guerriero", "Napolitano", "Romano", "Mazza", "Caruso", "Ferraro", "Gaeta",
"Di Stefano", "Palma", "Carbone", "Morrone", "Milazzo", "Calabrese", "Ventura", "Palmieri",
"Martello", "Fico", "Pastore", "Arena", "Maggio", "Sciacca", "Pagliaro", "Lupo",
"Mangano", "Capra", "Finocchiaro", "Grasso", "Morabito", "Pellicano", "Castelli", "Castaldo",
"Mauro", "Piazza", "Battaglia", "D Amico", "Forte", "Antonelli", "Delia", "Marino",
"Cosentino", "Lazzaro", "Vitale", "Lombardo", "Crisafulli", "Nicolosi", "Bellomo", "Morreale",
"Messina", "Vaccaro", "Nicosia", "Fazio", "Spina", "Russo", "Parisi", "Zappala",
"Riccobono", "Camilleri", "Barbagallo", "Oliveri", "Pistone", "Gambino", "Cavallaro", "Burgio",
"Gentile", "Restivo", "Di Bella", "Genovese", "Ferrante", "Gianninoto", "Vitrano", "Gargano",
"Lombardi", "Milani", "Picci", "De Luca", "Foti", "Giardina", "Di Pietro", "Russo",
"La Spina", "Morello", "Moschetti", "Penna", "Ferretti", "Colombo", "Marra", "De Simone",
"Cozzi", "Grimaldi", "Pellegrini", "Galdi", "Paolini", "Ferrara", "Santangelo", "Di Giovanni",
"Iannone", "Lucchese", "Orsini", "Mastroianni", "Fiorentino", "Capasso", "Di Napoli", "Giannini",
"Romano", "Vitale", "Fontana", "Galdi", "Giuliani", "Barbieri", "Lombardo", "Martinelli",
"De Rosa", "Ferri", "Caputo", "Castaldi", "Mauro", "Monti", "Villa", "Marcello",
"Ricci", "Ferretti", "Gallo", "Fabbri", "Marini", "Grasso", "Carbone", "Bevilacqua",
"Giannone", "Perna", "Pellegrino", "Di Lorenzo", "Napoli", "Amato", "Donato", "Riccio",
"Giuliano", "Mancuso", "Bellotti", "Bianchini", "Rossetti", "Mazza", "Silvestri", "Baldini",
"Martinelli", "Galli", "Colombo", "Ferraro", "Palumbo", "Marchetti", "Ferrera", "Rossi",
"Caruso", "Serra", "Marchese", "Benedetti", "Franzese", "Basile", "Di Mauro", "Torrisi",
"Licata", "Scuderi", "Platania", "Priolo", "Marletta", "Biondi", "Grassi", "Fontana",
"Pagano", "Gentile", "Moretti", "Guerra", "Santoro", "Longo", "Giordano", "Fiore",
"Marchetti", "Parisi", "Milani", "Orlando", "Sala", "Costa", "Cattaneo", "Neri",
"Donati", "Mancini", "Montanari", "Caputo", "De Angelis", "Sartori", "De Santis", "Basso"
);
public enum Gender {
MALE, FEMALE
}
/**
* Costruttore con seed random sicuro
*/
public ItalianNameGenerator() {
this.random = new SecureRandom();
}
/**
* Costruttore con seed personalizzato per risultati riproducibili
* @param seed seed per il generatore random
*/
public ItalianNameGenerator(long seed) {
this.random = new Random(seed);
}
/**
* Genera un genere casuale
* @return Gender casuale (MALE o FEMALE)
*/
public Gender generateGender() {
return random.nextBoolean() ? Gender.MALE : Gender.FEMALE;
}
/**
* Genera un nome casuale in base al sesso specificato
* @param gender il sesso per cui generare il nome
* @return nome casuale del sesso specificato
*/
public String generateFirstName(Gender gender) {
List<String> names = (gender == Gender.MALE) ? MALE_NAMES : FEMALE_NAMES;
return names.get(random.nextInt(names.size()));
}
/**
* Genera un cognome casuale
* @return cognome casuale
*/
public String generateSurname() {
return SURNAMES.get(random.nextInt(SURNAMES.size()));
}
/**
* Genera un nome completo (nome + cognome) in base al sesso
* @param gender il sesso per cui generare il nome completo
* @return nome completo del sesso specificato
*/
public String generateFullName(Gender gender) {
return generateFirstName(gender) + " " + generateSurname();
}
/**
* Genera un nome completo con sesso casuale
* @return nome completo con sesso casuale
*/
public String generateRandomFullName() {
Gender randomGender = random.nextBoolean() ? Gender.MALE : Gender.FEMALE;
return generateFullName(randomGender);
}
/**
* Genera una persona completa con nome, cognome e sesso
* @return oggetto Person con i dati generati
*/
public Person generatePerson() {
Gender gender = random.nextBoolean() ? Gender.MALE : Gender.FEMALE;
return new Person(generateFirstName(gender), generateSurname(), gender);
}
/**
* Genera una persona mantenendo il sesso specificato
* @param gender il sesso da mantenere
* @return oggetto Person con i dati generati
*/
public Person generatePerson(Gender gender) {
return new Person(generateFirstName(gender), generateSurname(), gender);
}
/**
* Classe interna per rappresentare una persona generata
*/
public static class Person {
private final String firstName;
private final String surname;
private final Gender gender;
public Person(String firstName, String surname, Gender gender) {
this.firstName = firstName;
this.surname = surname;
this.gender = gender;
}
public String getFirstName() {
return firstName;
}
public String getSurname() {
return surname;
}
public Gender getGender() {
return gender;
}
public String getFullName() {
return firstName + " " + surname;
}
@Override
public String toString() {
return String.format("Person{firstName='%s', surname='%s', gender=%s}",
firstName, surname, gender);
}
}
/**
* Metodo di utilità per ottenere il sesso da una stringa
* @param genderString stringa rappresentante il sesso ("M", "F", "MALE", "FEMALE", etc.)
* @return enum Gender corrispondente
* @throws IllegalArgumentException se la stringa non è riconosciuta
*/
public static Gender parseGender(String genderString) {
if (genderString == null) {
throw new IllegalArgumentException("Gender string cannot be null");
}
String normalized = genderString.trim().toUpperCase();
switch (normalized) {
case "M":
case "MALE":
case "MASCHIO":
case "UOMO":
return Gender.MALE;
case "F":
case "FEMALE":
case "FEMMINA":
case "DONNA":
return Gender.FEMALE;
default:
throw new IllegalArgumentException("Unrecognized gender: " + genderString);
}
}
}

View File

@@ -39,7 +39,6 @@ import it.integry.ems_model.entity.*;
import it.integry.ems_model.types.OperationType; import it.integry.ems_model.types.OperationType;
import it.integry.ems_model.utility.Base64Utility; import it.integry.ems_model.utility.Base64Utility;
import it.integry.ems_model.utility.UtilityDB; import it.integry.ems_model.utility.UtilityDB;
import it.integry.ems_model.utility.UtilityDate;
import it.integry.ems_model.utility.UtilityString; import it.integry.ems_model.utility.UtilityString;
import org.apache.commons.codec.binary.Base64; import org.apache.commons.codec.binary.Base64;
import org.apache.commons.text.StringEscapeUtils; import org.apache.commons.text.StringEscapeUtils;
@@ -69,6 +68,7 @@ import java.lang.reflect.ParameterizedType;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.sql.*; import java.sql.*;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
import java.util.Date; import java.util.Date;
@@ -840,7 +840,7 @@ public class EmsController {
@RequestParam Integer versione) throws Exception { @RequestParam Integer versione) throws Exception {
DtbDocPdf dtbDocPdf = new DtbDocPdf(); DtbDocPdf dtbDocPdf = new DtbDocPdf();
dtbDocPdf.setDataDoc(UtilityDate.RecognizeDate(dataDoc)); dtbDocPdf.setDataDoc(UtilityString.parseLocalDate(dataDoc));
dtbDocPdf.setSerDoc(serDoc); dtbDocPdf.setSerDoc(serDoc);
dtbDocPdf.setNumDoc(numDoc); dtbDocPdf.setNumDoc(numDoc);
dtbDocPdf.setCodAnag(codAnag); dtbDocPdf.setCodAnag(codAnag);
@@ -892,7 +892,7 @@ public class EmsController {
@RequestParam Integer versione) throws Exception { @RequestParam Integer versione) throws Exception {
DtbOrdPdf dtbOrdPdf = new DtbOrdPdf(); DtbOrdPdf dtbOrdPdf = new DtbOrdPdf();
dtbOrdPdf.setGestione(gestione); dtbOrdPdf.setGestione(gestione);
dtbOrdPdf.setDataOrd(UtilityDate.RecognizeDate(dataOrd)); dtbOrdPdf.setDataOrd(UtilityString.parseLocalDate(dataOrd));
dtbOrdPdf.setNumOrd(numOrd); dtbOrdPdf.setNumOrd(numOrd);
dtbOrdPdf.setVersione(versione); dtbOrdPdf.setVersione(versione);
dtbOrdPdf.setOperation(OperationType.SELECT_OBJECT); dtbOrdPdf.setOperation(OperationType.SELECT_OBJECT);
@@ -1043,7 +1043,7 @@ public class EmsController {
byte[] content = files[0].getBytes(); byte[] content = files[0].getBytes();
// content = UtilityZip.zlib_compress(content); // content = UtilityZip.zlib_compress(content);
Date dataDoc = UtilityDate.RecognizeDate(dataDocStr); LocalDate dataDoc = UtilityString.parseLocalDate(dataDocStr);
DtbDocPdf dtbDocPdf = new DtbDocPdf(); DtbDocPdf dtbDocPdf = new DtbDocPdf();
dtbDocPdf.setDataDoc(dataDoc); dtbDocPdf.setDataDoc(dataDoc);
@@ -1095,7 +1095,7 @@ public class EmsController {
String idAttach = null; String idAttach = null;
StbFilesAttached.TypeAttach typeAttach = null; StbFilesAttached.TypeAttach typeAttach = null;
Date dataDoc = UtilityDate.RecognizeDate(dataDocStr); LocalDate dataDoc = UtilityString.parseLocalDate(dataDocStr);
DrlDocAttached drlDocAttached = DrlDocAttached drlDocAttached =
new DrlDocAttached() new DrlDocAttached()

View File

@@ -6,6 +6,7 @@ import it.integry.ems.sync.MultiDBTransaction.Connection;
import it.integry.ems_model.config.EmsRestConstants; import it.integry.ems_model.config.EmsRestConstants;
import it.integry.ems_model.utility.UtilityDB; import it.integry.ems_model.utility.UtilityDB;
import it.integry.ems_model.utility.UtilityHashMap; import it.integry.ems_model.utility.UtilityHashMap;
import it.integry.ems_model.utility.UtilityString;
import org.apache.commons.dbcp2.BasicDataSource; import org.apache.commons.dbcp2.BasicDataSource;
import java.sql.SQLException; import java.sql.SQLException;
@@ -13,6 +14,8 @@ import java.util.HashMap;
public class DataSource extends BasicDataSource { public class DataSource extends BasicDataSource {
private final int POOL_SIZE;
private AvailableConnectionModel connectionModel; private AvailableConnectionModel connectionModel;
/** /**
@@ -24,6 +27,13 @@ public class DataSource extends BasicDataSource {
@Deprecated @Deprecated
public DataSource() { public DataSource() {
super(); super();
POOL_SIZE = 5;
}
@Deprecated
public DataSource(int poolSize) {
super();
POOL_SIZE = poolSize;
} }
public EmsRestConstants.DB_TYPE getTypeDB() { public EmsRestConstants.DB_TYPE getTypeDB() {
@@ -62,12 +72,20 @@ public class DataSource extends BasicDataSource {
} }
public synchronized void initialize(String profileDB) throws Exception { public synchronized void initialize(String profileDB) throws Exception {
initialize(profileDB, null);
}
public synchronized void initialize(String profileDB, String customAppName) throws Exception {
AvailableConnectionModel connectionsModel = SettingsModel.getInstance().findConnectionModel(profileDB); AvailableConnectionModel connectionsModel = SettingsModel.getInstance().findConnectionModel(profileDB);
initialize(connectionsModel); initialize(connectionsModel, customAppName);
} }
public synchronized void initialize(AvailableConnectionModel connectionModel) throws Exception { public synchronized void initialize(AvailableConnectionModel connectionModel) throws Exception {
initialize(connectionModel, null);
}
public synchronized void initialize(AvailableConnectionModel connectionModel, String customAppName) throws Exception {
if (connectionModel == null) { if (connectionModel == null) {
throw new Exception("Configurazione DB non trovata"); throw new Exception("Configurazione DB non trovata");
} }
@@ -76,7 +94,7 @@ public class DataSource extends BasicDataSource {
this.setDriverClassName(connectionModel.getDriverClassName()); this.setDriverClassName(connectionModel.getDriverClassName());
this.setUrl(connectionModel.getDbConnectionString("EMS Connection")); this.setUrl(connectionModel.getDbConnectionString(UtilityString.isNull(customAppName, "EMS Connection")));
this.setUsername(connectionModel.getUsername()); this.setUsername(connectionModel.getUsername());
this.setPassword(connectionModel.getPasswordDecrypted()); this.setPassword(connectionModel.getPasswordDecrypted());
this.setDefaultCatalog(connectionModel.getDbName()); this.setDefaultCatalog(connectionModel.getDbName());
@@ -87,9 +105,9 @@ public class DataSource extends BasicDataSource {
// ===== OTTIMIZZAZIONI CRITICHE ===== // ===== OTTIMIZZAZIONI CRITICHE =====
// Pool sizing ottimizzato per READ_UNCOMMITTED (meno locking = più connessioni possibili) // Pool sizing ottimizzato per READ_UNCOMMITTED (meno locking = più connessioni possibili)
this.setInitialSize(5); // Inizia con più connessioni this.setInitialSize(POOL_SIZE); // Inizia con più connessioni
this.setMaxTotal(-1); // Aumentato il massimo this.setMaxTotal(-1); // Aumentato il massimo
this.setMinIdle(5); // Non scendere sotto 5 this.setMinIdle(POOL_SIZE); // Non scendere sotto 5
this.setMaxIdle(-1); // Mantieni più connessioni idle this.setMaxIdle(-1); // Mantieni più connessioni idle
// Timeout ottimizzati per performance massime // Timeout ottimizzati per performance massime
@@ -97,8 +115,8 @@ public class DataSource extends BasicDataSource {
// Validazione veloce ed efficiente // Validazione veloce ed efficiente
this.setValidationQuery("SELECT 1"); this.setValidationQuery("SELECT 1");
// this.setValidationQueryTimeout(60); // Ridotto a 1 secondo this.setValidationQueryTimeout(30); // Ridotto a 1 secondo
// this.setTestWhileIdle(true); // Testa connessioni idle this.setTestWhileIdle(true); // Testa connessioni idle
// Eviction ottimizzata per READ_UNCOMMITTED // Eviction ottimizzata per READ_UNCOMMITTED
// this.setTimeBetweenEvictionRunsMillis(1 * 1000); // Ogni 30 secondi // this.setTimeBetweenEvictionRunsMillis(1 * 1000); // Ogni 30 secondi

View File

@@ -0,0 +1,291 @@
package it.integry.ems.dbms_change_tracker.component;
import com.microsoft.sqlserver.jdbc.SQLServerConnection;
import it.integry.ems.datasource.DataSource;
import it.integry.ems.dbms_change_tracker.model.ChangeTrackingConfigDTO;
import it.integry.ems.dbms_change_tracker.model.DetectedChangeDataDTO;
import it.integry.ems.sync.MultiDBTransaction.Connection;
import it.integry.ems_model.exception.DataConverterNotFoundException;
import it.integry.ems_model.utility.UtilityDB;
import it.integry.ems_model.utility.UtilityHashMap;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.stream.Collectors;
public class DbmsChangeTracker {
private DataSource dataSource;
private final Logger logger = LogManager.getLogger();
private final int CHANGE_RETENTION_HOURS = 1;
private final boolean AUTO_CLEANUP = true;
private Connection integryConnection;
private boolean trackerEnabled = false;
private long currentVersion;
private Listener eventListener;
public DbmsChangeTracker(String profileDb) throws Exception {
createDataSource(profileDb);
createConnection();
}
private void createDataSource(String profileDb) throws Exception {
DataSource ds = new DataSource(1);
ds.initialize(profileDb, "Integry Changes Tracker");
this.dataSource = ds;
}
private void createConnection() throws SQLException {
integryConnection = dataSource.getConnection();
if (!(integryConnection.isWrapperFor(SQLServerConnection.class))) {
integryConnection.close();
throw new SQLException("Connection is not a SQL Server connection");
}
}
private void checkConnection() {
try {
UtilityDB.executeSimpleQuery(integryConnection, "SELECT 1");
if (integryConnection.isClosed())
createConnection();
} catch (SQLException e) {
try {
integryConnection.close();
createConnection();
} catch (SQLException ex) {
logger.error("Unable to reestablish DB connection for Change Tracker", ex);
throw new RuntimeException("Unable to reestablish DB connection for Change Tracker");
}
}
}
public void enableTrackerInDbms() throws SQLException, DataConverterNotFoundException, InstantiationException, IllegalAccessException {
final ChangeTrackingConfigDTO currentConfig = retrieveTrackerCurrentConfig();
if (currentConfig != null) {
logInfo("Changes Tracker is already enabled (with " + currentConfig.getRetentionPeriod() + " " + currentConfig.getRetentionPeriodUnit().toLowerCase() + " retention and auto cleanup " + (currentConfig.isAutoCleanupOn() ? "ON" : "OFF") + ")");
return;
}
String enableSql = "ALTER DATABASE [" + integryConnection.getDbName() + "] \n" +
"SET CHANGE_TRACKING = ON (" +
"CHANGE_RETENTION = " + CHANGE_RETENTION_HOURS + " HOURS, " +
"AUTO_CLEANUP = " + (AUTO_CLEANUP ? "ON" : "OFF") +
");\n";
//COMMIT necessario perché ALTER DATABASE richiede che non ci siano altre transazioni attive
UtilityDB.executeStatement(integryConnection, "COMMIT", enableSql);
logInfo("Changes Tracker is now enabled (with " + CHANGE_RETENTION_HOURS + " hours retention and auto cleanup " + (AUTO_CLEANUP ? "ON" : "OFF") + ")");
}
public void enableTrackerOnTable(String tableName) throws SQLException {
if (isTableTrackingEnabled(tableName)) {
return;
}
UtilityDB.executeStatement(integryConnection, "ALTER TABLE dbo." + tableName + "\n" +
"ENABLE CHANGE_TRACKING WITH (TRACK_COLUMNS_UPDATED = ON);", "COMMIT");
}
public void disableTrackerOnNotUsedTables(List<String> usedTables) throws SQLException {
final List<String> trackedTables = retrieveTrackedTables();
trackedTables.removeAll(usedTables);
for (String tableName : trackedTables) {
disableTrackerOnTable(tableName);
}
}
public void disableTrackerOnTable(String tableName) throws SQLException {
if (!isTableTrackingEnabled(tableName)) {
return;
}
UtilityDB.executeStatement(integryConnection, "ALTER TABLE dbo." + tableName + "\n" +
"DISABLE CHANGE_TRACKING;", "COMMIT");
}
public void startTracking() throws SQLException {
currentVersion = retrieveCurrentVersion();
trackerEnabled = true;
}
public void checkForChanges() throws Exception {
if (!trackerEnabled)
return;
checkConnection();
final List<String> trackedTables = retrieveTrackedTables();
HashMap<Long, List<DetectedChangeDataDTO>> changesByVersion = new HashMap<>();
for (String trackedTable : trackedTables) {
long minValidVersion = getMinValidVersion(trackedTable);
if (currentVersion < minValidVersion) {
throw new SQLException("Change Tracking on table " + trackedTable + " has been reset. Current version: " + currentVersion + ", Min valid version: " + minValidVersion);
}
final List<DetectedChangeDataDTO> detectedChanges = retrieveChangeList(trackedTable);
detectedChanges.forEach(detectedChangeDataDTO -> {
changesByVersion.putIfAbsent(detectedChangeDataDTO.getSysChangeVersion(), new ArrayList<>());
changesByVersion.get(detectedChangeDataDTO.getSysChangeVersion()).add(detectedChangeDataDTO);
});
}
logTrace("Detected " + changesByVersion.size() + " changes since version " + currentVersion);
dispatchChanges(changesByVersion);
}
private void dispatchChanges(HashMap<Long, List<DetectedChangeDataDTO>> changesByVersion) throws Exception {
final List<Long> sortedChanges = changesByVersion.keySet().stream()
.sorted()
.collect(Collectors.toList());
for (Long changeId : sortedChanges) {
final List<DetectedChangeDataDTO> detectedChanges = changesByVersion.get(changeId);
for (DetectedChangeDataDTO detectedChange : detectedChanges) {
switch (detectedChange.getSysChangeOperation()) {
case INSERT:
if (eventListener != null)
eventListener.onInsertDetected(detectedChange.getTableName(), detectedChange.getPrimaryKey());
break;
case UPDATE:
if (eventListener != null)
eventListener.onUpdateDetected(detectedChange.getTableName(), detectedChange.getPrimaryKey());
break;
case DELETE:
if (eventListener != null)
eventListener.onDeleteDetected(detectedChange.getTableName(), detectedChange.getPrimaryKey());
break;
}
}
currentVersion = changeId;
}
}
private List<DetectedChangeDataDTO> retrieveChangeList(String tableName) throws SQLException {
String sql = "SELECT *\n" +
"FROM CHANGETABLE(CHANGES dbo." + tableName + ", " + currentVersion + ") AS c";
final List<HashMap<String, Object>> result = UtilityDB.executeSimpleQuery(integryConnection, sql);
return result.stream()
.map(x -> {
DetectedChangeDataDTO detectedChangeDataDTO = new DetectedChangeDataDTO()
.setTableName(tableName);
Long sysChangeVersion = UtilityHashMap.<Long>getValueIfExists(x, "SYS_CHANGE_VERSION");
detectedChangeDataDTO.setSysChangeVersion(sysChangeVersion);
Long sysChangeCreationVersion = UtilityHashMap.<Long>getValueIfExists(x, "SYS_CHANGE_CREATION_VERSION");
detectedChangeDataDTO.setSysChangeCreationVersion(sysChangeCreationVersion);
detectedChangeDataDTO.setSysChangeOperation(DetectedChangeDataDTO.Operation.from(UtilityHashMap.<String>getValueIfExists(x, "SYS_CHANGE_OPERATION")));
List<String> keysToRemove = new ArrayList<>();
for (String colName : x.keySet()) {
if (colName.startsWith("SYS_"))
keysToRemove.add(colName);
}
for (String colName : keysToRemove) {
x.remove(colName);
}
detectedChangeDataDTO.setPrimaryKey(x);
return detectedChangeDataDTO;
})
.collect(Collectors.toList());
}
private long retrieveCurrentVersion() throws SQLException {
String sql = "SELECT CHANGE_TRACKING_CURRENT_VERSION() AS current_version";
long currentVersion = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(integryConnection, sql);
return currentVersion;
}
private long getMinValidVersion(String table) throws SQLException {
String sql = "SELECT CHANGE_TRACKING_MIN_VALID_VERSION(OBJECT_ID(" + UtilityDB.valueToString(table) + "))";
long minValidVersion = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(integryConnection, sql);
return minValidVersion;
}
private List<String> retrieveTrackedTables() throws SQLException {
String sql = "SELECT OBJECT_NAME(object_id) AS table_name\n" +
" FROM sys.change_tracking_tables";
List<String> trackedTables = UtilityDB.executeSimpleQueryOnlyFirstColumn(integryConnection, sql);
return trackedTables;
}
private boolean isTableTrackingEnabled(String tableName) throws SQLException {
String sql = "SELECT CAST(COUNT(is_track_columns_updated_on) AS BIT) AS enabled\n" +
" FROM sys.change_tracking_tables \n" +
" WHERE object_id = OBJECT_ID('dbo." + tableName + "')";
boolean enabled = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(integryConnection, sql);
return enabled;
}
private ChangeTrackingConfigDTO retrieveTrackerCurrentConfig() throws SQLException, DataConverterNotFoundException, InstantiationException, IllegalAccessException {
String checkSql = "SELECT DB_NAME(database_id) as database_name,\n" +
"CAST(is_auto_cleanup_on AS BIT) AS is_auto_cleanup_on,\n" +
"retention_period,\n" +
"retention_period_units_desc,\n" +
"max_cleanup_version\n" +
"FROM sys.change_tracking_databases \n" +
"WHERE DB_NAME(database_id)=DB_NAME()";
final ChangeTrackingConfigDTO currentConfig = UtilityDB.executeSimpleQueryOnlyFirstRowDTO(integryConnection, checkSql, ChangeTrackingConfigDTO.class);
return currentConfig;
}
private void logInfo(String message) {
logger.info("[" + integryConnection.getProfileName() + "] " + message);
}
private void logTrace(String message) {
logger.trace("[" + integryConnection.getProfileName() + "] " + message);
}
public DbmsChangeTracker setEventListener(Listener eventListener) {
this.eventListener = eventListener;
return this;
}
public interface Listener {
void onInsertDetected(String tableName, HashMap<String, Object> primaryKey) throws Exception;
void onUpdateDetected(String tableName, HashMap<String, Object> primaryKey) throws Exception;
void onDeleteDetected(String tableName, HashMap<String, Object> primaryKey) throws Exception;
}
}

View File

@@ -0,0 +1,125 @@
package it.integry.ems.dbms_change_tracker.component;
import it.integry.annotations.PostContextAutowired;
import it.integry.annotations.PostContextConstruct;
import it.integry.ems.dbms_change_tracker.model.events.TableRecordDeletedEvent;
import it.integry.ems.dbms_change_tracker.model.events.TableRecordInsertedEvent;
import it.integry.ems.dbms_change_tracker.model.events.TableRecordUpdatedEvent;
import it.integry.ems.migration._base.IntegryCustomerDB;
import it.integry.ems.sync.MultiDBTransaction.Connection;
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
import it.integry.ems_model.entity.*;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
@Component
public class DbmsChangeTrackerComponent {
private final Logger logger = LogManager.getLogger();
private final HashMap<IntegryCustomerDB, DbmsChangeTracker> activeChangeTrackers = new HashMap<>();
private final ArrayList<String> trackedTables = new ArrayList<String>() {{
add(MtbAart.ENTITY);
add(MtbAartBarCode.ENTITY);
add(MtbUntMis.ENTITY);
add(MtbDepo.ENTITY);
add(StbEditLimit.ENTITY);
add(StbGestSetup.ENTITY);
add(StbGestSetupDepo.ENTITY);
add(WtbGestSetupUser.ENTITY);
}};
private final ApplicationEventPublisher applicationEventPublisher;
@PostContextAutowired
private MultiDBTransactionManager multiDBTransactionManager;
public DbmsChangeTrackerComponent(ApplicationEventPublisher applicationEventPublisher) {
this.applicationEventPublisher = applicationEventPublisher;
}
@PostContextConstruct(priority = 10)
public void init() throws Exception {
for (Connection conn : multiDBTransactionManager.getActiveConnections()) {
IntegryCustomerDB customerDB = IntegryCustomerDB.parse(conn.getDbName());
activeChangeTrackers.put(customerDB, new DbmsChangeTracker(conn.getProfileName()));
}
enableAllChangeTracking();
}
private void enableAllChangeTracking() throws Exception {
for (Map.Entry<IntegryCustomerDB, DbmsChangeTracker> entrySet : activeChangeTrackers.entrySet()) {
IntegryCustomerDB customerDB = entrySet.getKey();
DbmsChangeTracker dbmsChangeTracker = entrySet.getValue();
try {
dbmsChangeTracker.enableTrackerInDbms();
for (String tableName : trackedTables) {
dbmsChangeTracker.enableTrackerOnTable(tableName);
}
dbmsChangeTracker.disableTrackerOnNotUsedTables(trackedTables);
dbmsChangeTracker.setEventListener(new DbmsChangeTracker.Listener() {
@Override
public void onInsertDetected(String tableName, HashMap<String, Object> primaryKey) {
onItemInserted(customerDB, tableName, primaryKey);
}
@Override
public void onUpdateDetected(String tableName, HashMap<String, Object> primaryKey) {
onItemUpdated(customerDB, tableName, primaryKey);
}
@Override
public void onDeleteDetected(String tableName, HashMap<String, Object> primaryKey) {
onItemDeleted(customerDB, tableName, primaryKey);
}
});
dbmsChangeTracker.startTracking();
} catch (Exception e) {
throw new Exception("Errore durante l'abilitazione del DbmsChangeTracker per il customer: " + customerDB.getValue(), e);
}
}
}
@Scheduled(fixedDelay = 5, timeUnit = TimeUnit.SECONDS)
private void checkAllChanges() throws Exception {
for (DbmsChangeTracker dbmsChangeTracker : activeChangeTrackers.values()) {
dbmsChangeTracker.checkForChanges();
}
}
private void onItemInserted(IntegryCustomerDB customerDB, String tableName, HashMap<String, Object> primaryKey) {
logger.trace("Item inserted in profileDb {} table {} with primaryKey {}", customerDB.getValue(), tableName, primaryKey);
applicationEventPublisher.publishEvent(new TableRecordInsertedEvent(this, customerDB, tableName, primaryKey));
}
private void onItemUpdated(IntegryCustomerDB customerDB, String tableName, HashMap<String, Object> primaryKey) {
logger.trace("Item updated in profileDb {} table {} with primaryKey {}", customerDB.getValue(), tableName, primaryKey);
applicationEventPublisher.publishEvent(new TableRecordUpdatedEvent(this, customerDB, tableName, primaryKey));
}
private void onItemDeleted(IntegryCustomerDB customerDB, String tableName, HashMap<String, Object> primaryKey) {
logger.trace("Item deleted in profileDb {} table {} with primaryKey {}", customerDB.getValue(), tableName, primaryKey);
applicationEventPublisher.publishEvent(new TableRecordDeletedEvent(this, customerDB, tableName, primaryKey));
}
}

View File

@@ -0,0 +1,67 @@
package it.integry.ems.dbms_change_tracker.model;
import it.integry.ems_model.annotation.SqlField;
public class ChangeTrackingConfigDTO {
@SqlField("database_name")
private String databaseName;
@SqlField("is_auto_cleanup_on")
private boolean autoCleanupOn;
@SqlField("retention_period")
private int retentionPeriod;
@SqlField("retention_period_units_desc")
private String retentionPeriodUnit;
// @SqlField("max_cleanup_version")
private Object maxCleanupVersion;
public String getDatabaseName() {
return databaseName;
}
public ChangeTrackingConfigDTO setDatabaseName(String databaseName) {
this.databaseName = databaseName;
return this;
}
public boolean isAutoCleanupOn() {
return autoCleanupOn;
}
public ChangeTrackingConfigDTO setAutoCleanupOn(boolean autoCleanupOn) {
this.autoCleanupOn = autoCleanupOn;
return this;
}
public int getRetentionPeriod() {
return retentionPeriod;
}
public ChangeTrackingConfigDTO setRetentionPeriod(int retentionPeriod) {
this.retentionPeriod = retentionPeriod;
return this;
}
public String getRetentionPeriodUnit() {
return retentionPeriodUnit;
}
public ChangeTrackingConfigDTO setRetentionPeriodUnit(String retentionPeriodUnit) {
this.retentionPeriodUnit = retentionPeriodUnit;
return this;
}
public Object getMaxCleanupVersion() {
return maxCleanupVersion;
}
public ChangeTrackingConfigDTO setMaxCleanupVersion(Object maxCleanupVersion) {
this.maxCleanupVersion = maxCleanupVersion;
return this;
}
}

View File

@@ -0,0 +1,108 @@
package it.integry.ems.dbms_change_tracker.model;
import com.fasterxml.jackson.annotation.JsonValue;
import it.integry.ems_model.entity._enum.IBaseEnum;
import java.util.HashMap;
public class DetectedChangeDataDTO {
private long sysChangeVersion;
private Long sysChangeCreationVersion;
private Operation sysChangeOperation;
private String tableName;
private HashMap<String, Object> primaryKey;
public long getSysChangeVersion() {
return sysChangeVersion;
}
public DetectedChangeDataDTO setSysChangeVersion(long sysChangeVersion) {
this.sysChangeVersion = sysChangeVersion;
return this;
}
public Long getSysChangeCreationVersion() {
return sysChangeCreationVersion;
}
public DetectedChangeDataDTO setSysChangeCreationVersion(Long sysChangeCreationVersion) {
this.sysChangeCreationVersion = sysChangeCreationVersion;
return this;
}
public Operation getSysChangeOperation() {
return sysChangeOperation;
}
public DetectedChangeDataDTO setSysChangeOperation(Operation sysChangeOperation) {
this.sysChangeOperation = sysChangeOperation;
return this;
}
public String getTableName() {
return tableName;
}
public DetectedChangeDataDTO setTableName(String tableName) {
this.tableName = tableName;
return this;
}
public HashMap<String, Object> getPrimaryKey() {
return primaryKey;
}
public DetectedChangeDataDTO setPrimaryKey(HashMap<String, Object> primaryKey) {
this.primaryKey = primaryKey;
return this;
}
public enum Operation implements IBaseEnum<Operation> {
INSERT('I'),
UPDATE('U'),
DELETE('D');
private final char value;
Operation(char value) {
this.value = value;
}
public static Operation from(Object value) {
if (value instanceof String && ((String) value).length() == 1) {
value = ((String) value).charAt(0);
}
char castValue = (char) value;
for (Operation b : Operation.values()) {
if (b.value == castValue)
return b;
}
return null;
}
@JsonValue
public char getValue() {
return this.value;
}
@Override
public Object get() {
return this.value;
}
@Override
public Operation fromInternal(Object val) {
return from(val);
}
@Override
public String toString() {
return String.valueOf(value);
}
}
}

View File

@@ -0,0 +1,27 @@
package it.integry.ems.dbms_change_tracker.model.events;
import it.integry.ems.migration._base.IntegryCustomerDB;
import it.integry.event.BaseCustomerDBEvent;
import java.util.HashMap;
public class TableRecordDeletedEvent extends BaseCustomerDBEvent {
private final String tableName;
private final HashMap<String, Object> primaryKey;
public TableRecordDeletedEvent(Object source, IntegryCustomerDB integryCustomerDB, String tableName, HashMap<String, Object> primaryKey) {
super(source, integryCustomerDB);
this.tableName = tableName;
this.primaryKey = primaryKey;
}
public String getTableName() {
return tableName;
}
public HashMap<String, Object> getPrimaryKey() {
return primaryKey;
}
}

View File

@@ -0,0 +1,27 @@
package it.integry.ems.dbms_change_tracker.model.events;
import it.integry.ems.migration._base.IntegryCustomerDB;
import it.integry.event.BaseCustomerDBEvent;
import java.util.HashMap;
public class TableRecordInsertedEvent extends BaseCustomerDBEvent {
private final String tableName;
private final HashMap<String, Object> primaryKey;
public TableRecordInsertedEvent(Object source, IntegryCustomerDB integryCustomerDB, String tableName, HashMap<String, Object> primaryKey) {
super(source, integryCustomerDB);
this.tableName = tableName;
this.primaryKey = primaryKey;
}
public String getTableName() {
return tableName;
}
public HashMap<String, Object> getPrimaryKey() {
return primaryKey;
}
}

View File

@@ -0,0 +1,27 @@
package it.integry.ems.dbms_change_tracker.model.events;
import it.integry.ems.migration._base.IntegryCustomerDB;
import it.integry.event.BaseCustomerDBEvent;
import java.util.HashMap;
public class TableRecordUpdatedEvent extends BaseCustomerDBEvent {
private final String tableName;
private final HashMap<String, Object> primaryKey;
public TableRecordUpdatedEvent(Object source, IntegryCustomerDB customerDB, String tableName, HashMap<String, Object> primaryKey) {
super(source, customerDB);
this.tableName = tableName;
this.primaryKey = primaryKey;
}
public String getTableName() {
return tableName;
}
public HashMap<String, Object> getPrimaryKey() {
return primaryKey;
}
}

View File

@@ -28,7 +28,7 @@ public class DevicesRequestInterceptor implements HandlerInterceptor {
RequestDataDTO requestDataDTO = ContextLoader.getCurrentWebApplicationContext().getBean(RequestDataDTO.class); RequestDataDTO requestDataDTO = ContextLoader.getCurrentWebApplicationContext().getBean(RequestDataDTO.class);
if (requestDataDTO.isValidProfileDB() && requestDataDTO.isValidDeviceId()) { if (requestDataDTO.isValidProfileDB() && requestDataDTO.isValidDeviceId()) {
deviceService.updateUsage(requestDataDTO.getApplication(), requestDataDTO.getDeviceId()); deviceService.updateUsage(requestDataDTO.getDeviceId());
} }
return true; return true;

View File

@@ -0,0 +1,30 @@
package it.integry.ems.dto;
import java.util.Objects;
public class ArticoloPartitaCommessaDTO extends ArticoloPartitaDTO {
private String codJcom;
@Override
public boolean equals(Object o) {
if (!(o instanceof ArticoloPartitaCommessaDTO)) return false;
if (!super.equals(o)) return false;
ArticoloPartitaCommessaDTO that = (ArticoloPartitaCommessaDTO) o;
return Objects.equals(getCodJcom(), that.getCodJcom());
}
@Override
public int hashCode() {
return Objects.hash(super.hashCode(), getCodJcom());
}
public String getCodJcom() {
return codJcom;
}
public ArticoloPartitaCommessaDTO setCodJcom(String codJcom) {
this.codJcom = codJcom;
return this;
}
}

View File

@@ -1,4 +1,4 @@
package it.integry.ems.document.dto; package it.integry.ems.dto;
import java.util.Objects; import java.util.Objects;

View File

@@ -37,8 +37,7 @@ public class DynamicCacheService {
DATI_AZIENDA_KEY, DATI_AZIENDA_KEY,
ENTITY_LOGGER_SETUP, ENTITY_LOGGER_SETUP,
GRIGLIA_ACQUISTO_KEY, GRIGLIA_ACQUISTO_KEY,
ENTITY_SYNC_KEY, ENTITY_SYNC_KEY
STB_GEST_SETUP_KEY
} }
public void addItem(Keys key, int invalidateTimeInMins, RunnableWithReturn<Object> refreshAction) { public void addItem(Keys key, int invalidateTimeInMins, RunnableWithReturn<Object> refreshAction) {

View File

@@ -0,0 +1,249 @@
package it.integry.ems.dynamic_cache;
import it.integry.annotations.PostContextAutowired;
import it.integry.annotations.PostContextConstruct;
import it.integry.ems.dbms_change_tracker.component.DbmsChangeTrackerComponent;
import it.integry.ems.dbms_change_tracker.model.events.TableRecordDeletedEvent;
import it.integry.ems.dbms_change_tracker.model.events.TableRecordInsertedEvent;
import it.integry.ems.dbms_change_tracker.model.events.TableRecordUpdatedEvent;
import it.integry.ems.dto.EntityHierarchy;
import it.integry.ems.migration._base.IntegryCustomerDB;
import it.integry.ems.sync.MultiDBTransaction.Connection;
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
import it.integry.ems.utility.UtilityDebug;
import it.integry.ems_model.base.EntityBase;
import it.integry.ems_model.base.EntityPropertyHolder;
import it.integry.ems_model.entity.*;
import it.integry.ems_model.exception.DataConverterNotFoundException;
import it.integry.ems_model.utility.UtilityDB;
import it.integry.ems_model.utility.UtilityQuery;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@Component
public class EntityCacheComponent implements ApplicationListener {
private final Logger logger = LogManager.getLogger();
private final DbmsChangeTrackerComponent dbmsChangeTrackerComponent;
private final EntityPropertyHolder entityPropertyHolder;
private final HashMap<IntegryCustomerDB, ConcurrentHashMap<String, ConcurrentHashMap<HashMap<String, Object>, EntityBase>>> entityCache = new HashMap<>();
private final HashMap<String, Class<? extends EntityBase>> enabledEntities = new HashMap<String, Class<? extends EntityBase>>() {{
put(MtbAart.ENTITY, MtbAart.class);
put(MtbAartBarCode.ENTITY, MtbAartBarCode.class);
put(MtbUntMis.ENTITY, MtbUntMis.class);
put(MtbDepo.ENTITY, MtbDepo.class);
put(StbEditLimit.ENTITY, StbEditLimit.class);
put(StbGestSetup.ENTITY, StbGestSetup.class);
put(StbGestSetupDepo.ENTITY, StbGestSetupDepo.class);
put(WtbGestSetupUser.ENTITY, WtbGestSetupUser.class);
}};
public EntityCacheComponent(DbmsChangeTrackerComponent dbmsChangeTrackerComponent, EntityPropertyHolder entityPropertyHolder) {
this.dbmsChangeTrackerComponent = dbmsChangeTrackerComponent;
this.entityPropertyHolder = entityPropertyHolder;
}
@PostContextAutowired
private MultiDBTransactionManager multiDBTransactionManager;
@PostContextConstruct
private void init() throws Exception {
if (UtilityDebug.isDebugExecution() || UtilityDebug.isIntegryServer())
return;
for (Connection conn : multiDBTransactionManager.getActiveConnections()) {
IntegryCustomerDB customerDB = IntegryCustomerDB.parse(conn.getDbName());
if (customerDB == null)
throw new RuntimeException("Impossibile inizializzare IntegryCustomerDB per il database: " + conn.getDbName());
for (Map.Entry<String, Class<? extends EntityBase>> enabledEntity : enabledEntities.entrySet()) {
String tableName = enabledEntity.getKey();
refreshCacheForEntity(conn, customerDB, tableName);
}
}
}
private void refreshCacheForEntity(IntegryCustomerDB customerDB, String tableName) throws Exception {
try (MultiDBTransactionManager mdb = new MultiDBTransactionManager(customerDB)) {
Connection conn = mdb.getPrimaryConnection();
refreshCacheForEntity(conn, customerDB, tableName);
}
}
private void refreshCacheForEntity(Connection connection, IntegryCustomerDB customerDB, String tableName) throws Exception {
Class<? extends EntityBase> clazz = enabledEntities.get(tableName);
// if (clazz == null)
// throw new RuntimeException("Entity cache is not enabled for table " + tableName);
entityCache.putIfAbsent(customerDB, new ConcurrentHashMap<>());
entityCache.get(customerDB).remove(tableName);
ConcurrentHashMap<HashMap<String, Object>, EntityBase> entities = retrieveEntityList(connection, tableName, clazz);
entityCache.get(customerDB).put(tableName, entities);
logger.trace(String.format("[%s] Cached %d records for entity %s",
customerDB.getValue(),
entities.size(),
clazz.getSimpleName()));
}
public <T extends EntityBase> List<T> getCachedEntitiesList(IntegryCustomerDB customerDB, String tableName, Predicate<T> filterPredicate) {
return getCachedEntitiesStream(customerDB, tableName, filterPredicate)
.collect(Collectors.toList());
}
public <T extends EntityBase> Stream<T> getCachedEntitiesStream(IntegryCustomerDB customerDB, String tableName, Predicate<T> filterPredicate) {
if (!isCacheEnabled(customerDB, tableName)) {
try {
refreshCacheForEntity(customerDB, tableName);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
return entityCache.get(customerDB).get(tableName)
.values()
.parallelStream()
.map(x -> (T) x)
.filter(filterPredicate)
.map(x -> (T) x.clone());
}
@Override
public void onApplicationEvent(ApplicationEvent event) {
if (event instanceof TableRecordInsertedEvent) {
handleRecordInserted((TableRecordInsertedEvent) event);
} else if (event instanceof TableRecordUpdatedEvent) {
handleRecordUpdated((TableRecordUpdatedEvent) event);
} else if (event instanceof TableRecordDeletedEvent) {
handleRecordDeleted((TableRecordDeletedEvent) event);
}
}
private void handleRecordInserted(TableRecordInsertedEvent event) {
if (!isCacheEnabled(event.getCustomerDB(), event.getTableName()))
return;
HashMap<String, Object> entityPrimaryKey = convertSqlMapToEntityMap(event.getPrimaryKey(), enabledEntities.get(event.getTableName()));
try (MultiDBTransactionManager mdb = new MultiDBTransactionManager(event.getCustomerDB())) {
EntityBase newItem = retrieveEntityItem(mdb.getPrimaryConnection(), event.getTableName(),
enabledEntities.get(event.getTableName()),
event.getPrimaryKey());
entityCache.get(event.getCustomerDB())
.get(event.getTableName())
.put(entityPrimaryKey, newItem);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
private void handleRecordUpdated(TableRecordUpdatedEvent event) {
if (!isCacheEnabled(event.getCustomerDB(), event.getTableName()))
return;
HashMap<String, Object> entityPrimaryKey = convertSqlMapToEntityMap(event.getPrimaryKey(), enabledEntities.get(event.getTableName()));
try (MultiDBTransactionManager mdb = new MultiDBTransactionManager(event.getCustomerDB())) {
EntityBase newItem = retrieveEntityItem(mdb.getPrimaryConnection(), event.getTableName(),
enabledEntities.get(event.getTableName()),
event.getPrimaryKey());
entityCache.get(event.getCustomerDB())
.get(event.getTableName())
.put(entityPrimaryKey, newItem);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
private void handleRecordDeleted(TableRecordDeletedEvent event) {
if (!isCacheEnabled(event.getCustomerDB(), event.getTableName()))
return;
HashMap<String, Object> entityPrimaryKey = convertSqlMapToEntityMap(event.getPrimaryKey(), enabledEntities.get(event.getTableName()));
final EntityBase removedItem = entityCache.get(event.getCustomerDB())
.get(event.getTableName())
.remove(entityPrimaryKey);
}
private ConcurrentHashMap<HashMap<String, Object>, EntityBase> retrieveEntityList(Connection connection, String tableName, Class<? extends EntityBase> clazz) throws SQLException, DataConverterNotFoundException, InstantiationException, IllegalAccessException {
String sql = "SELECT * FROM " + tableName;
List<? extends EntityBase> objects = UtilityDB.executeSimpleQueryDTO(connection, sql, clazz);
if (objects == null)
objects = new ArrayList<>();
final List<EntityHierarchy.Field> pkFields = entityPropertyHolder.getEntityFields(clazz, EntityHierarchy.Field::isPrimaryKey);
ConcurrentHashMap<HashMap<String, Object>, EntityBase> objectsMap = new ConcurrentHashMap<>();
for (EntityBase object : objects) {
HashMap<String, Object> pkMap = new HashMap<>();
for (EntityHierarchy.Field pkField : pkFields) {
Object pkValue = pkField.getField().get(object);
pkMap.put(pkField.getFieldName(), pkValue);
}
objectsMap.put(pkMap, object);
}
return objectsMap;
}
private EntityBase retrieveEntityItem(Connection connection, String tableName, Class<?> clazz, HashMap<String, Object> primaryKey) throws SQLException, DataConverterNotFoundException, InstantiationException, IllegalAccessException {
String sql = "SELECT * FROM " + tableName + "\n" +
" WHERE " + UtilityQuery.concatFieldsInWhereCond(primaryKey);
final EntityBase object = (EntityBase) UtilityDB.executeSimpleQueryOnlyFirstRowDTO(connection, sql, clazz);
return object;
}
private HashMap<String, Object> convertSqlMapToEntityMap(HashMap<String, Object> sqlMap, Class<? extends EntityBase> clazz) {
HashMap<String, Object> entityMap = new HashMap<>();
for (Map.Entry<String, Object> entry : sqlMap.entrySet()) {
String fieldName = entityPropertyHolder.getEntityFields(clazz, f -> f.isSqlField() && f.getSqlField().value().equals(entry.getKey()))
.stream()
.findFirst()
.map(EntityHierarchy.Field::getFieldName)
.orElse(entry.getKey());
entityMap.put(fieldName, entry.getValue());
}
return entityMap;
}
private boolean isCacheEnabled(IntegryCustomerDB customerDB, String tableName) {
return (entityCache.containsKey(customerDB) && entityCache.get(customerDB).containsKey(tableName)) ||
!(UtilityDebug.isDebugExecution() || UtilityDebug.isIntegryServer());
}
}

View File

@@ -0,0 +1,371 @@
package it.integry.ems.entity_logger.db_schema_manager.component;
import it.integry.ems.entity_logger.db_schema_manager.dto.ForeignKeyDependency;
import it.integry.ems.entity_logger.db_schema_manager.dto.ForeignKeyDependencyReport;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.sql.*;
import java.util.ArrayList;
import java.util.List;
public class SQLServerForeignKeyManager {
private final Logger logger = LogManager.getLogger();
private Connection connection;
private boolean disableForeignKeyChecks;
public SQLServerForeignKeyManager(Connection connection) {
this(connection, false);
}
public SQLServerForeignKeyManager(Connection connection, boolean disableForeignKeyChecks) {
this.connection = connection;
this.disableForeignKeyChecks = disableForeignKeyChecks;
}
/**
* Aggiorna una foreign key e tutte le sue dipendenze in un'unica transazione
*
* @param tableName Nome della tabella principale
* @param columnName Nome della colonna che contiene la chiave primaria
* @param oldValue Valore attuale della chiave
* @param newValue Nuovo valore della chiave
* @return true se l'operazione è completata con successo
* @throws SQLException in caso di errore
*/
public <T> boolean updateForeignKeyWithDependencies(String tableName, String columnName,
T oldValue, T newValue) throws SQLException {
boolean originalAutoCommit = connection.getAutoCommit();
List<String> disabledConstraints = new ArrayList<>();
try {
// Disabilita auto-commit per gestire la transazione manualmente
connection.setAutoCommit(false);
logger.info(String.format("Inizio aggiornamento FK: %s.%s da %s a %s",
tableName, columnName, oldValue, newValue));
// 1. Disabilita i vincoli foreign key se richiesto
if (disableForeignKeyChecks) {
disabledConstraints = disableForeignKeyConstraints(tableName, columnName);
logger.info(String.format("Disabilitati %d vincoli foreign key", disabledConstraints.size()));
}
// 2. Trova tutte le dipendenze
List<ForeignKeyDependency> dependencies = findAllDependencies(tableName, columnName);
logger.info(String.format("Trovate %d dipendenze da aggiornare", dependencies.size()));
if (disableForeignKeyChecks) {
// Se i vincoli sono disabilitati, possiamo aggiornare in qualsiasi ordine
// Aggiorniamo prima la tabella principale per semplicità
updateMainTable(tableName, columnName, oldValue, newValue);
// Poi aggiorniamo tutte le tabelle dipendenti
for (ForeignKeyDependency dependency : dependencies) {
updateDependentTable(dependency, oldValue, newValue);
}
} else {
// Ordine normale: prima le dipendenti, poi la principale
for (ForeignKeyDependency dependency : dependencies) {
updateDependentTable(dependency, oldValue, newValue);
}
updateMainTable(tableName, columnName, oldValue, newValue);
}
// 3. Riabilita i vincoli foreign key se erano stati disabilitati
if (disableForeignKeyChecks && !disabledConstraints.isEmpty()) {
enableForeignKeyConstraints(disabledConstraints);
logger.info("Vincoli foreign key riabilitati");
// 4. Verifica l'integrità dei dati dopo aver riabilitato i vincoli
if (!checkConstraintIntegrity(disabledConstraints)) {
throw new SQLException("Violazione dell'integrità referenziale dopo l'aggiornamento");
}
}
// Commit della transazione
connection.commit();
logger.info("Aggiornamento completato con successo");
return true;
} catch (SQLException e) {
// Rollback in caso di errore
try {
connection.rollback();
logger.error("Errore durante l'aggiornamento, rollback eseguito: " + e.getMessage(), e);
// Se i vincoli erano stati disabilitati, prova a riabilitarli anche dopo il rollback
if (disableForeignKeyChecks && !disabledConstraints.isEmpty()) {
try {
enableForeignKeyConstraints(disabledConstraints);
logger.info("Vincoli foreign key riabilitati dopo rollback");
} catch (SQLException enableEx) {
logger.error("ATTENZIONE: Impossibile riabilitare i vincoli dopo rollback: " + enableEx.getMessage(), enableEx);
}
}
} catch (SQLException rollbackEx) {
logger.error("Errore durante il rollback: " + rollbackEx.getMessage(), rollbackEx);
}
throw e;
} finally {
// Ripristina l'auto-commit originale
connection.setAutoCommit(originalAutoCommit);
}
}
/**
* Disabilita tutti i vincoli foreign key che referenziano la tabella/colonna specificata
*/
private List<String> disableForeignKeyConstraints(String tableName, String columnName) throws SQLException {
List<String> disabledConstraints = new ArrayList<>();
List<ForeignKeyDependency> dependencies = findAllDependencies(tableName, columnName);
for (ForeignKeyDependency dependency : dependencies) {
String disableQuery = String.format(
"ALTER TABLE [%s].[%s] NOCHECK CONSTRAINT [%s]",
dependency.getDependentSchema(),
dependency.getDependentTable(),
dependency.getConstraintName()
);
try (Statement stmt = connection.createStatement()) {
stmt.execute(disableQuery);
disabledConstraints.add(String.format("%s.%s.%s",
dependency.getDependentSchema(),
dependency.getDependentTable(),
dependency.getConstraintName()));
logger.trace(String.format("Disabilitato vincolo: %s", dependency.getConstraintName()));
}
}
return disabledConstraints;
}
/**
* Riabilita i vincoli foreign key precedentemente disabilitati
*/
private void enableForeignKeyConstraints(List<String> constraintIdentifiers) throws SQLException {
for (String constraintId : constraintIdentifiers) {
String[] parts = constraintId.split("\\.");
if (parts.length != 3) {
logger.warn("Formato constraint identifier non valido: " + constraintId);
continue;
}
String schema = parts[0];
String table = parts[1];
String constraint = parts[2];
String enableQuery = String.format(
"ALTER TABLE [%s].[%s] CHECK CONSTRAINT [%s]",
schema, table, constraint
);
try (Statement stmt = connection.createStatement()) {
stmt.execute(enableQuery);
logger.trace(String.format("Riabilitato vincolo: %s", constraint));
}
}
}
/**
* Verifica l'integrità dei vincoli dopo averli riabilitati
*/
private boolean checkConstraintIntegrity(List<String> constraintIdentifiers) throws SQLException {
boolean allValid = true;
for (String constraintId : constraintIdentifiers) {
String[] parts = constraintId.split("\\.");
if (parts.length != 3) continue;
String schema = parts[0];
String table = parts[1];
String constraint = parts[2];
// Verifica se ci sono violazioni del vincolo
String checkQuery = String.format("SELECT COUNT(*) as violations\n" +
" FROM [%s].[%s] child\n" +
" LEFT JOIN (\n" +
" SELECT fkc.referenced_object_id, fkc.referenced_column_id,\n" +
" fkc.parent_object_id, fkc.parent_column_id\n" +
" FROM sys.foreign_key_columns fkc\n" +
" INNER JOIN sys.foreign_keys fk ON fkc.constraint_object_id = fk.object_id\n" +
" WHERE fk.name = '%s'\n" +
" ) fk_info ON 1=1\n" +
" LEFT JOIN sys.tables ref_table ON fk_info.referenced_object_id = ref_table.object_id\n" +
" LEFT JOIN sys.schemas ref_schema ON ref_table.schema_id = ref_schema.schema_id\n" +
" WHERE child.[%s] IS NOT NULL\n" +
" AND NOT EXISTS (\n" +
" SELECT 1 FROM [%s].[%s] parent\n" +
" WHERE parent.[%s] = child.[%s]\n" +
" )", schema, table, constraint,
"temp_col", // Questo dovrebbe essere sostituito con la colonna effettiva
"temp_schema", "temp_table", "temp_parent_col", "temp_col");
// Query semplificata per il check di integrità
String simpleCheckQuery = String.format(
"DBCC CHECKCONSTRAINTS('[%s].[%s].[%s]') WITH ALL_CONSTRAINTS",
schema, table, constraint
);
try (Statement stmt = connection.createStatement()) {
try (ResultSet rs = stmt.executeQuery("SELECT 1")) {
// Se la query non solleva eccezioni, il vincolo è valido
logger.trace(String.format("Vincolo %s superato controllo integrità", constraint));
} catch (SQLException e) {
logger.warn(String.format("Violazione integrità per vincolo %s: %s", constraint, e.getMessage()));
allValid = false;
}
}
}
return allValid;
}
/**
* Trova tutte le dipendenze foreign key di una tabella/colonna
*/
private List<ForeignKeyDependency> findAllDependencies(String tableName, String columnName) throws SQLException {
List<ForeignKeyDependency> dependencies = new ArrayList<>();
String query = "SELECT \n" +
" fk.name AS constraint_name,\n" +
" OBJECT_SCHEMA_NAME(fk.parent_object_id) AS dependent_schema,\n" +
" OBJECT_NAME(fk.parent_object_id) AS dependent_table,\n" +
" COL_NAME(fkc.parent_object_id, fkc.parent_column_id) AS dependent_column,\n" +
" OBJECT_SCHEMA_NAME(fk.referenced_object_id) AS referenced_schema,\n" +
" OBJECT_NAME(fk.referenced_object_id) AS referenced_table,\n" +
" COL_NAME(fkc.referenced_object_id, fkc.referenced_column_id) AS referenced_column\n" +
" FROM sys.foreign_keys fk\n" +
" INNER JOIN sys.foreign_key_columns fkc ON fk.object_id = fkc.constraint_object_id\n" +
" WHERE OBJECT_NAME(fk.referenced_object_id) = ?\n" +
" AND COL_NAME(fkc.referenced_object_id, fkc.referenced_column_id) = ?\n" +
" ORDER BY dependent_table";
try (PreparedStatement stmt = connection.prepareStatement(query)) {
stmt.setString(1, tableName);
stmt.setString(2, columnName);
try (ResultSet rs = stmt.executeQuery()) {
while (rs.next()) {
ForeignKeyDependency dependency = new ForeignKeyDependency(
rs.getString("constraint_name"),
rs.getString("dependent_schema"),
rs.getString("dependent_table"),
rs.getString("dependent_column"),
rs.getString("referenced_schema"),
rs.getString("referenced_table"),
rs.getString("referenced_column")
);
dependencies.add(dependency);
}
}
}
return dependencies;
}
/**
* Aggiorna una tabella dipendente
*/
private void updateDependentTable(ForeignKeyDependency dependency, Object oldValue, Object newValue) throws SQLException {
String updateQuery = String.format(
"UPDATE [%s].[%s] SET [%s] = ? WHERE [%s] = ?",
dependency.getDependentSchema(),
dependency.getDependentTable(),
dependency.getDependentColumn(),
dependency.getDependentColumn()
);
try (PreparedStatement stmt = connection.prepareStatement(updateQuery)) {
stmt.setObject(1, newValue);
stmt.setObject(2, oldValue);
int rowsAffected = stmt.executeUpdate();
logger.info(String.format("Aggiornate %d righe in %s.%s",
rowsAffected, dependency.getDependentTable(), dependency.getDependentColumn()));
}
}
/**
* Aggiorna la tabella principale
*/
private void updateMainTable(String tableName, String columnName, Object oldValue, Object newValue) throws SQLException {
String updateQuery = String.format("UPDATE [%s] SET [%s] = ? WHERE [%s] = ?",
tableName, columnName, columnName);
try (PreparedStatement stmt = connection.prepareStatement(updateQuery)) {
stmt.setObject(1, newValue);
stmt.setObject(2, oldValue);
int rowsAffected = stmt.executeUpdate();
logger.info(String.format("Aggiornate %d righe nella tabella principale %s.%s",
rowsAffected, tableName, columnName));
}
}
/**
* Verifica se un valore esiste già come chiave primaria
*/
public boolean checkIfValueExists(String tableName, String columnName, Object value) throws SQLException {
String query = String.format("SELECT COUNT(*) FROM [%s] WHERE [%s] = ?", tableName, columnName);
try (PreparedStatement stmt = connection.prepareStatement(query)) {
stmt.setObject(1, value);
try (ResultSet rs = stmt.executeQuery()) {
if (rs.next()) {
return rs.getInt(1) > 0;
}
}
}
return false;
}
/**
* Ottiene un rapporto dettagliato delle dipendenze prima dell'aggiornamento
*/
public ForeignKeyDependencyReport getDependencyReport(String tableName, String columnName, Object value) throws SQLException {
List<ForeignKeyDependency> dependencies = findAllDependencies(tableName, columnName);
ForeignKeyDependencyReport report = new ForeignKeyDependencyReport();
for (ForeignKeyDependency dependency : dependencies) {
int count = countDependentRecords(dependency, value);
report.addDependency(dependency, count);
}
return report;
}
private int countDependentRecords(ForeignKeyDependency dependency, Object value) throws SQLException {
String countQuery = String.format(
"SELECT COUNT(*) FROM [%s].[%s] WHERE [%s] = ?",
dependency.getDependentSchema(),
dependency.getDependentTable(),
dependency.getDependentColumn()
);
try (PreparedStatement stmt = connection.prepareStatement(countQuery)) {
stmt.setObject(1, value);
try (ResultSet rs = stmt.executeQuery()) {
return rs.next() ? rs.getInt(1) : 0;
}
}
}
// Setter per modificare il comportamento sui vincoli FK
public void setDisableForeignKeyChecks(boolean disableForeignKeyChecks) {
this.disableForeignKeyChecks = disableForeignKeyChecks;
}
public boolean isDisableForeignKeyChecks() {
return disableForeignKeyChecks;
}
}

View File

@@ -0,0 +1,40 @@
package it.integry.ems.entity_logger.db_schema_manager.dto;
public class ForeignKeyDependency {
private final String constraintName;
private final String dependentSchema;
private final String dependentTable;
private final String dependentColumn;
private final String referencedSchema;
private final String referencedTable;
private final String referencedColumn;
public ForeignKeyDependency(String constraintName, String dependentSchema,
String dependentTable, String dependentColumn,
String referencedSchema, String referencedTable,
String referencedColumn) {
this.constraintName = constraintName;
this.dependentSchema = dependentSchema;
this.dependentTable = dependentTable;
this.dependentColumn = dependentColumn;
this.referencedSchema = referencedSchema;
this.referencedTable = referencedTable;
this.referencedColumn = referencedColumn;
}
// Getter methods
public String getConstraintName() { return constraintName; }
public String getDependentSchema() { return dependentSchema; }
public String getDependentTable() { return dependentTable; }
public String getDependentColumn() { return dependentColumn; }
public String getReferencedSchema() { return referencedSchema; }
public String getReferencedTable() { return referencedTable; }
public String getReferencedColumn() { return referencedColumn; }
@Override
public String toString() {
return String.format("%s.%s.%s -> %s.%s.%s",
dependentSchema, dependentTable, dependentColumn,
referencedSchema, referencedTable, referencedColumn);
}
}

View File

@@ -0,0 +1,37 @@
package it.integry.ems.entity_logger.db_schema_manager.dto;
import java.util.HashMap;
import java.util.Map;
public class ForeignKeyDependencyReport {
private final Map<ForeignKeyDependency, Integer> dependencyCount = new HashMap<>();
public void addDependency(ForeignKeyDependency dependency, int count) {
dependencyCount.put(dependency, count);
}
public Map<ForeignKeyDependency, Integer> getDependencies() {
return new HashMap<>(dependencyCount);
}
public int getTotalRecordsAffected() {
return dependencyCount.values().stream().mapToInt(Integer::intValue).sum();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("=== RAPPORTO DIPENDENZE ===\n");
for (Map.Entry<ForeignKeyDependency, Integer> entry : dependencyCount.entrySet()) {
sb.append(String.format("Tabella: %s.%s, Colonna: %s, Record da aggiornare: %d\n",
entry.getKey().getDependentSchema(),
entry.getKey().getDependentTable(),
entry.getKey().getDependentColumn(),
entry.getValue()));
}
sb.append(String.format("TOTALE RECORD DA AGGIORNARE: %d\n", getTotalRecordsAffected()));
return sb.toString();
}
}

View File

@@ -2,8 +2,11 @@ package it.integry.ems.javabeans;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
import it.integry.common.var.CommonConstants; import it.integry.common.var.CommonConstants;
import it.integry.ems._context.ApplicationContextProvider;
import it.integry.ems.json.ResponseJSONObjectMapper; import it.integry.ems.json.ResponseJSONObjectMapper;
import it.integry.ems.migration._base.IntegryCustomerDB;
import it.integry.ems.model.IntegryApplicationEnum; import it.integry.ems.model.IntegryApplicationEnum;
import it.integry.ems.settings.Model.SettingsModel;
import it.integry.ems.user.dto.UserDTO; import it.integry.ems.user.dto.UserDTO;
import it.integry.ems_model.config.EmsRestConstants; import it.integry.ems_model.config.EmsRestConstants;
import it.integry.ems_model.utility.UtilityString; import it.integry.ems_model.utility.UtilityString;
@@ -138,6 +141,16 @@ public class RequestDataDTO {
return profileDB; return profileDB;
} }
public IntegryCustomerDB getCustomerDB() {
if (UtilityString.isNullOrEmpty(profileDB))
return null;
final SettingsModel settingsModel = ApplicationContextProvider.getApplicationContext().getBean(SettingsModel.class);
final String dbName = settingsModel.getDbNameFromProfileDb(profileDB);
return IntegryCustomerDB.parse(dbName);
}
public Long getDeviceId() { public Long getDeviceId() {
return deviceId; return deviceId;
} }

View File

@@ -11,7 +11,7 @@ import java.util.ArrayList;
import java.util.Random; import java.util.Random;
@Component @Component
public class LooperService { public class LooperService {
private final ArrayList<LoopDTO> mLoopsHandler = new ArrayList<>(); private final ArrayList<LoopDTO> mLoopsHandler = new ArrayList<>();
private final ArrayList<TaskModel> mLoopsTask = new ArrayList<>(); private final ArrayList<TaskModel> mLoopsTask = new ArrayList<>();

View File

@@ -75,6 +75,10 @@ public abstract class BaseMigration implements MigrationModelInterface {
return UtilityDB.executeSimpleQueryDTO(connection, sql, clazz); return UtilityDB.executeSimpleQueryDTO(connection, sql, clazz);
} }
protected @NotNull <T> List<T> executeQueryOnlyFirstColumn(String sql) throws SQLException {
return UtilityDB.executeSimpleQueryOnlyFirstColumn(connection, sql);
}
protected void executeStatement(String... sqls) throws SQLException { protected void executeStatement(String... sqls) throws SQLException {
executeStatement(connection, sqls); executeStatement(connection, sqls);
} }
@@ -141,6 +145,10 @@ public abstract class BaseMigration implements MigrationModelInterface {
} }
private void alterObject(SqlObjectTypeEnum sqlObject, String objectName, String sql) throws SQLException, IOException { private void alterObject(SqlObjectTypeEnum sqlObject, String objectName, String sql) throws SQLException, IOException {
if (UtilityString.isNullOrEmpty(objectName)) {
throw new IllegalArgumentException("ObjectName in createOrUpdateFunction(), createOrUpdateView(), createOrUpdateTrigger(), createOrUpdateProcedure() cannot be null or empty");
}
executeStatement("IF EXISTS (SELECT * FROM SYSOBJECTS WHERE id = object_id('" + objectName + "'))\r\n" + executeStatement("IF EXISTS (SELECT * FROM SYSOBJECTS WHERE id = object_id('" + objectName + "'))\r\n" +
"\tDROP " + sqlObject.toString() + " " + objectName, "\tDROP " + sqlObject.toString() + " " + objectName,
sql); sql);

View File

@@ -8,7 +8,7 @@ public enum IntegryCustomer {
IntegryCustomerDB.Agricoper_IlVisone, IntegryCustomerDB.Agricoper_IlVisone,
IntegryCustomerDB.Agricoper_Luva), IntegryCustomerDB.Agricoper_Luva),
ATI(IntegryCustomerDB.ATI_Finpart), ATI(IntegryCustomerDB.ATI, IntegryCustomerDB.ATI_Finpart),
Auricchio(IntegryCustomerDB.Auricchio_Auricchio, Auricchio(IntegryCustomerDB.Auricchio_Auricchio,
IntegryCustomerDB.Auricchio_AuricchioMiki, IntegryCustomerDB.Auricchio_AuricchioMiki,
IntegryCustomerDB.Auricchio_AuricchioSrl, IntegryCustomerDB.Auricchio_AuricchioSrl,

View File

@@ -9,7 +9,9 @@ public enum IntegryCustomerDB {
Agricoper_IlVisone("ilvisone"), Agricoper_IlVisone("ilvisone"),
Agricoper_Luva("luva"), Agricoper_Luva("luva"),
ATI("atisrl"),
ATI_Finpart("Finpart"), ATI_Finpart("Finpart"),
Auricchio_Auricchio("auricchio"), Auricchio_Auricchio("auricchio"),
Auricchio_AuricchioMiki("auricchio_miki"), Auricchio_AuricchioMiki("auricchio_miki"),
Auricchio_AuricchioSrl("auricchiosrl"), Auricchio_AuricchioSrl("auricchiosrl"),
@@ -31,6 +33,7 @@ public enum IntegryCustomerDB {
Carelli_Chiuso("chiuso"), Carelli_Chiuso("chiuso"),
Carelli_Format("format"), Carelli_Format("format"),
Carelli_Murgia("murgia"), Carelli_Murgia("murgia"),
Carelli_MurgiaTest("murgia_test"),
Carelli_Panimal("panimal"), Carelli_Panimal("panimal"),
Carelli_Winact("winact"), Carelli_Winact("winact"),
Carelli_Csgr("csgr"), Carelli_Csgr("csgr"),
@@ -89,10 +92,10 @@ public enum IntegryCustomerDB {
Frudis_Frudis("frudis"), Frudis_Frudis("frudis"),
Gramm_Gramm("gramm"), Gramm_Gramm("gramm_peppe"),
Gramm_PrimeOlive("primeolive"), Gramm_PrimeOlive("primeolive"),
Gramm_ProveStage("grammprovestage"), Gramm_ProveStage("grammprovestage"),
Gramm_2MHolding("2M_HOLDING"), Gramm_2MHolding("dueemme"),
Idrotecnica_Idrotecnica("idrotecnica"), Idrotecnica_Idrotecnica("idrotecnica"),
@@ -103,7 +106,7 @@ public enum IntegryCustomerDB {
Igood_ShopService("shop_service"), Igood_ShopService("shop_service"),
Ime_ImeTe("ime_te"), Ime_ImeTe("ime_te_peppe"),
Integry_Studioml("studioml"), Integry_Studioml("studioml"),
@@ -123,6 +126,7 @@ public enum IntegryCustomerDB {
Levanplast_Perilflor("perilflor"), Levanplast_Perilflor("perilflor"),
Levanplast_PerilflorSrl("perilflorsrl"), Levanplast_PerilflorSrl("perilflorsrl"),
Levanplast_Levanplast("levanplast"), Levanplast_Levanplast("levanplast"),
Levanplast_Levanplastsrl("levanplastsrl"),
Maggio_MaggioSrl("maggiosrl"), Maggio_MaggioSrl("maggiosrl"),
Maggio_GiovMaggio("giovmaggio"), Maggio_GiovMaggio("giovmaggio"),

View File

@@ -0,0 +1,508 @@
package it.integry.ems.migration.dto.common;
import it.integry.ems.migration.dto.SqlObjectTypeEnum;
import it.integry.ems.sync.MultiDBTransaction.Connection;
import it.integry.ems_model.entity.MtbColt;
import it.integry.ems_model.types.OperationType;
import it.integry.ems_model.utility.Query;
import it.integry.ems_model.utility.UtilityDB;
import it.integry.ems_model.utility.UtilityString;
import it.integry.ems_model.utility.dto.IndexTableDTO;
import java.io.IOException;
import java.sql.SQLException;
import java.sql.Statement;
import java.time.LocalDate;
import java.util.ArrayList;
public class MigrationMvwSitArtUdcDetInventarioDTO {
public static void apply(Connection connection) throws Exception {
//Aggiorno i campi barcode_ul_in, barcode_ul_out, posizione_in, posizione_out, cod_mdep_in, cod_mdep_out
updateNewFieldsInMtbColrs(connection);
//Migration di conversione aziende a nuova mvw_sitart_udc_det_inventario
createBackupOfOldView(connection);
dropView(connection, "mvw_sitart_udc_det_inventario");
createNewView(connection);
}
public static void updateNewFieldsInMtbColrs(Connection connection) throws Exception {
executeStatement(connection, "UPDATE mtb_colr\n" +
"SET barcode_ul_in = new_data.barcode_ul_in,\n" +
" barcode_ul_out = new_data.barcode_ul_out,\n" +
" posizione_in = new_data.posizione_in,\n" +
" posizione_out = new_data.posizione_out,\n" +
" cod_mdep_in = new_data.cod_mdep_in,\n" +
" cod_mdep_out = new_data.cod_mdep_out\n" +
"FROM mtb_colr\n" +
" INNER JOIN (SELECT mtb_colt.barcode_ul AS barcode_ul_in,\n" +
" IIF(num_collo_rif IS NOT NULL, mtb_colt_rif.barcode_ul, NULL) AS barcode_ul_out,\n" +
" mtb_colt.posizione AS posizione_in,\n" +
" IIF(num_collo_rif IS NOT NULL, mtb_colt_rif.posizione, NULL) AS posizione_out,\n" +
" mtb_colt.cod_mdep AS cod_mdep_in,\n" +
" IIF(num_collo_rif IS NOT NULL, mtb_colt_rif.cod_mdep, NULL) AS cod_mdep_out,\n" +
"\n" +
" mtb_colr.gestione,\n" +
" mtb_colr.data_collo,\n" +
" mtb_colr.ser_collo,\n" +
" mtb_colr.num_collo,\n" +
" mtb_colr.riga\n" +
"\n" +
" FROM dbo.mtb_colr\n" +
" INNER JOIN dbo.mtb_colt ON mtb_colr.gestione = mtb_colt.gestione AND\n" +
" mtb_colr.data_collo = mtb_colt.data_collo AND\n" +
" mtb_colr.ser_collo = mtb_colt.ser_collo AND\n" +
" mtb_colr.num_collo = mtb_colt.num_collo\n" +
"\n" +
" LEFT OUTER JOIN dbo.mtb_colt mtb_colt_rif\n" +
" ON mtb_colr.gestione_rif = mtb_colt_rif.gestione AND\n" +
" mtb_colr.data_collo_rif = mtb_colt_rif.data_collo AND\n" +
" mtb_colr.ser_collo_rif = mtb_colt_rif.ser_collo AND\n" +
" mtb_colr.num_collo_rif = mtb_colt_rif.num_collo) new_data\n" +
" ON mtb_colr.gestione = new_data.gestione AND\n" +
" mtb_colr.num_collo = new_data.num_collo AND\n" +
" mtb_colr.ser_collo = new_data.ser_collo AND\n" +
" mtb_colr.data_collo = new_data.data_collo AND\n" +
" mtb_colr.riga = new_data.riga");
}
public static void alignGiacenza(Connection connection) throws Exception {
//Creo un collo di scarico vuoto
MtbColt mtbColt = new MtbColt()
.setGestione("L")
.setSerCollo("RT")
.setSegno(-1)
.setDataCollo(LocalDate.now())
.setAnnotazioni("PASSAGGIO NUOVA MVW_SITART_UDC_DET_INVENTARIO")
.setCodMdep(getInternalCodMdep(connection));
mtbColt.setOperation(OperationType.INSERT);
mtbColt.dataCompleting(connection);
mtbColt.manageWithParentConnection(connection);
executeStatement(connection, Query.format(
"INSERT INTO mtb_colr (gestione, ser_collo, num_collo, data_collo, riga, cod_mart, cod_col, cod_tagl, partita_mag, gestione_rif, data_collo_rif, ser_collo_rif, num_collo_rif, datetime_row,\n" +
" cod_jcom, qta_col, num_cnf, qta_cnf, barcode_ul_out, cod_mdep_out, posizione_out)" +
" SELECT {} AS gestione,\n" +
" {} AS ser_collo,\n" +
" {} AS num_collo,\n" +
" CAST({} AS DATE) AS data_collo,\n" +
" ROW_NUMBER() OVER (PARTITION BY (SELECT NULL) ORDER BY v.data_collo) AS riga,\n" +
" v.cod_mart,\n" +
" v.cod_col,\n" +
" v.cod_tagl,\n" +
" v.partita_mag,\n" +
" v.gestione AS gestion_rif,\n" +
" v.data_collo AS data_collo_rif,\n" +
" v.ser_collo AS ser_collo_rif,\n" +
" v.num_collo AS num_collo_rif,\n" +
" GETDATE() AS datetime_row,\n" +
" v.cod_jcom,\n" +
" v.qta_col,\n" +
" v.num_cnf,\n" +
" v.qta_cnf,\n" +
" v.barcode_ul AS barcode_ul_out,\n" +
" v.cod_mdep AS cod_mdep_out,\n" +
" v.posizione AS posizione_out\n" +
"FROM mvw_sitart_udc_det_inventario v\n" +
" INNER JOIN (SELECT ser_collo,\n" +
" gestione,\n" +
" data_collo,\n" +
" num_collo,\n" +
" cod_mdep,\n" +
" posizione,\n" +
" cod_mart,\n" +
" partita_mag,\n" +
" cod_jcom-- Elenca tutte le colonne coinvolte\n" +
" FROM mvw_sitart_udc_det_inventario\n" +
"\n" +
" EXCEPT\n" +
"\n" +
" SELECT ser_collo,\n" +
" gestione,\n" +
" data_collo,\n" +
" num_collo,\n" +
" cod_mdep,\n" +
" posizione,\n" +
" cod_mart,\n" +
" partita_mag,\n" +
" cod_jcom -- Elenca le stesse colonne dalla vista vecchia\n" +
" FROM mvw_sitart_udc_det_inventario_old) t\n" +
" ON v.num_collo = t.num_collo AND v.data_collo = t.data_collo AND\n" +
" v.ser_collo = t.ser_collo AND v.gestione = t.gestione AND\n" +
" v.cod_mart = t.cod_mart AND v.cod_mdep = t.cod_mdep AND\n" +
" ISNULL(v.partita_mag, '') = ISNULL(t.partita_mag, '') AND\n" +
" ISNULL(v.posizione, '') = ISNULL(t.posizione, '') AND\n" +
" ISNULL(v.cod_jcom, '') = ISNULL(t.cod_jcom, '')" +
" WHERE qta_col > 0",
mtbColt.getGestione(), mtbColt.getSerCollo(), mtbColt.getNumCollo(), mtbColt.getDataCollo()));
}
private static String getInternalCodMdep(Connection connection) throws Exception {
String codMdepAz = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(connection, "SELECT TOP 1 cod_mdep" +
" FROM mtb_depo" +
" INNER JOIN dbo.gtb_anag ga ON mtb_depo.cod_anag = ga.cod_anag" +
" inner join azienda on ga.part_iva = azienda.part_iva");
if(UtilityString.isNullOrEmpty(codMdepAz)) {
codMdepAz = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(connection, "SELECT TOP 1 cod_mdep FROM mtb_depo");
}
return codMdepAz;
}
private static void createBackupOfOldView(Connection connection) throws Exception {
if (existsView(connection, "mvw_sitart_udc_det_inventario_old"))
return;
createOrUpdateView(connection, "mvw_sitart_udc_det_inventario_old", "CREATE VIEW [dbo].[mvw_sitart_udc_det_inventario_old] AS\n" +
"SELECT UL.gestione,\n" +
" data_collo,\n" +
" ser_collo,\n" +
" num_collo,\n" +
" segno,\n" +
" UL.cod_mdep,\n" +
" UL.posizione,\n" +
" mtb_depo_posizioni.priorita,\n" +
" mtb_aart.cod_mgrp AS codGruppo,\n" +
" mtb_grup.descrizione AS Gruppo,\n" +
" mtb_aart.cod_msgr AS CodSgruppo,\n" +
" mtb_sgrp.descrizione AS Sottogruppo,\n" +
" UL.cod_mart,\n" +
" diacod,\n" +
" mtb_aart.descrizione_estesa,\n" +
" partita_mag,\n" +
" UL.cod_jcom,\n" +
" jtb_comt.descrizione AS commessa,\n" +
" mtb_aart.unt_mis,\n" +
" qta_col,\n" +
" num_cnf,\n" +
" UL.qta_cnf,\n" +
" UL.peso_netto_kg,\n" +
" UL.peso_lordo_kg,\n" +
" UL.cod_jfas\n" +
"FROM [mvw_sitart_udc_det] UL\n" +
" LEFT OUTER JOIN jtb_comt ON UL.cod_jcom = jtb_comt.cod_jcom\n" +
" LEFT OUTER JOIN mtb_depo_posizioni\n" +
" ON UL.cod_mdep = mtb_depo_posizioni.cod_mdep AND UL.posizione = mtb_depo_posizioni.posizione,\n" +
" mtb_aart,\n" +
" mtb_grup,\n" +
" mtb_sgrp\n" +
"WHERE UL.cod_mart = mtb_aart.cod_mart\n" +
" AND mtb_aart.cod_mgrp = mtb_grup.cod_mgrp\n" +
" AND mtb_aart.cod_mgrp = mtb_sgrp.cod_mgrp\n" +
" AND mtb_aart.cod_msgr = mtb_sgrp.cod_msgr\n" +
" AND qta_col <> 0");
}
private static void createNewView(Connection connection) throws Exception {
if (!existsTable(connection, "stb_multiplier")) {
executeStatement(connection, "CREATE TABLE stb_multiplier\n" +
"(\n" +
" moltiplicatore INT NOT NULL\n" +
")",
"INSERT INTO stb_multiplier (moltiplicatore) VALUES (1)",
"INSERT INTO stb_multiplier (moltiplicatore) VALUES (-1)");
}
createOrUpdateView(connection, "mvw_mtb_colr_with_giacenza", "CREATE VIEW dbo.mvw_mtb_colr_with_giacenza\n" +
" WITH SCHEMABINDING\n" +
" AS\n" +
"SELECT COUNT_BIG(*) AS c,\n" +
" IIF(moltiplicatore = -1, mtb_colr.barcode_ul_out,\n" +
" mtb_colr.barcode_ul_in) AS barcode_ul,\n" +
" IIF(moltiplicatore = -1, mtb_colr.cod_mdep_out,\n" +
" mtb_colr.cod_mdep_in) AS cod_mdep,\n" +
" IIF(moltiplicatore = -1, mtb_colr.posizione_out,\n" +
" mtb_colr.posizione_in) AS posizione,\n" +
" SUM(mtb_colr.qta_col * moltiplicatore) AS qta_col,\n" +
" SUM(IIF(mtb_aart.flag_qta_cnf_fissa = 'S', mtb_colr.qta_col / mtb_aart.qta_cnf, mtb_colr.num_cnf) *\n" +
" moltiplicatore) AS num_cnf,\n" +
" mtb_colr.cod_mart,\n" +
" mtb_colr.cod_col,\n" +
" mtb_colr.cod_tagl,\n" +
" mtb_colr.partita_mag,\n" +
" SUM(mtb_colr.peso_netto_kg * moltiplicatore) AS peso_netto_kg,\n" +
" SUM(mtb_colr.peso_lordo_kg * moltiplicatore) AS peso_lordo_kg,\n" +
" IIF(mtb_colr.cod_jcom = 'MAG', NULL, mtb_colr.cod_jcom) AS cod_jcom,\n" +
" mtb_aart.flag_qta_cnf_fissa,\n" +
" mtb_aart.unt_mis,\n" +
" mtb_aart.diacod,\n" +
" mtb_aart.descrizione_estesa,\n" +
" mtb_aart.cod_mgrp,\n" +
" mtb_aart.cod_msgr,\n" +
" mtb_aart.cod_mtip,\n" +
" mtb_aart.cod_mstp,\n" +
" mtb_aart.cod_msfa,\n" +
" mtb_aart.qta_cnf AS qta_cnf_anag\n" +
"FROM dbo.mtb_colr\n" +
" INNER JOIN dbo.stb_multiplier ON (moltiplicatore = 1 AND mtb_colr.barcode_ul_in IS NOT NULL) OR\n" +
" (moltiplicatore = -1 AND mtb_colr.barcode_ul_out IS NOT NULL)\n" +
" INNER JOIN dbo.mtb_aart ON mtb_colr.cod_mart = mtb_aart.cod_mart\n" +
"GROUP BY mtb_colr.cod_mart,\n" +
" mtb_colr.cod_col,\n" +
" mtb_colr.cod_tagl,\n" +
" mtb_colr.partita_mag,\n" +
" IIF(moltiplicatore = -1, mtb_colr.barcode_ul_out,\n" +
" mtb_colr.barcode_ul_in),\n" +
" IIF(moltiplicatore = -1, mtb_colr.cod_mdep_out,\n" +
" mtb_colr.cod_mdep_in),\n" +
" IIF(moltiplicatore = -1, mtb_colr.posizione_out,\n" +
" mtb_colr.posizione_in),\n" +
" IIF(mtb_colr.cod_jcom = 'MAG', NULL, mtb_colr.cod_jcom),\n" +
" mtb_aart.flag_qta_cnf_fissa,\n" +
" mtb_aart.unt_mis,\n" +
" mtb_aart.diacod,\n" +
" mtb_aart.descrizione_estesa,\n" +
" mtb_aart.cod_mgrp,\n" +
" mtb_aart.cod_msgr,\n" +
" mtb_aart.cod_mtip,\n" +
" mtb_aart.cod_mstp,\n" +
" mtb_aart.cod_msfa,\n" +
" mtb_aart.qta_cnf");
dropIndex(connection, "mvw_mtb_colr_with_giacenza", "IDX_CLUSTERED_mvw_mtb_colr_with_giacenza");
createIndex(connection, new IndexTableDTO()
.setIndexName("IDX_CLUSTERED_mvw_mtb_colr_with_giacenza")
.setTableName("mvw_mtb_colr_with_giacenza")
.setUnique(true)
.setClustered(true)
.setMaxDop(1)
.setSortInTempDb(true)
.setColumnsIndex(new ArrayList<IndexTableDTO.ColumnIndex>() {{
add(new IndexTableDTO.ColumnIndex("barcode_ul"));
add(new IndexTableDTO.ColumnIndex("posizione"));
add(new IndexTableDTO.ColumnIndex("cod_mdep"));
add(new IndexTableDTO.ColumnIndex("cod_mart"));
add(new IndexTableDTO.ColumnIndex("partita_mag"));
add(new IndexTableDTO.ColumnIndex("cod_tagl"));
add(new IndexTableDTO.ColumnIndex("cod_col"));
add(new IndexTableDTO.ColumnIndex("cod_jcom"));
}}));
dropIndex(connection, "mvw_mtb_colr_with_giacenza", "IDX_mvw_qta_mtb_colr_with_giacenza");
createIndex(connection, new IndexTableDTO()
.setIndexName("IDX_mvw_qta_mtb_colr_with_giacenza")
.setTableName("mvw_mtb_colr_with_giacenza")
.setMaxDop(1)
.setSortInTempDb(true)
.setColumnsIndex(new ArrayList<IndexTableDTO.ColumnIndex>() {{
add(new IndexTableDTO.ColumnIndex("qta_col"));
add(new IndexTableDTO.ColumnIndex("num_cnf"));
}}));
dropIndex(connection, "mvw_mtb_colr_with_giacenza", "IDX_mvw_articolo_mtb_colr_with_giacenza");
createIndex(connection, new IndexTableDTO()
.setIndexName("IDX_mvw_articolo_mtb_colr_with_giacenza")
.setTableName("mvw_mtb_colr_with_giacenza")
.setMaxDop(1)
.setSortInTempDb(true)
.setColumnsIndex(new ArrayList<IndexTableDTO.ColumnIndex>() {{
add(new IndexTableDTO.ColumnIndex("cod_mart"));
add(new IndexTableDTO.ColumnIndex("partita_mag"));
add(new IndexTableDTO.ColumnIndex("cod_tagl"));
add(new IndexTableDTO.ColumnIndex("cod_col"));
}}));
dropIndex(connection, "mvw_mtb_colr_with_giacenza", "IDX_mvw_articolo_giac_mtb_colr_with_giacenza");
createIndex(connection, new IndexTableDTO()
.setIndexName("IDX_mvw_articolo_giac_mtb_colr_with_giacenza")
.setTableName("mvw_mtb_colr_with_giacenza")
.setMaxDop(1)
.setSortInTempDb(true)
.setColumnsIndex(new ArrayList<IndexTableDTO.ColumnIndex>() {{
add(new IndexTableDTO.ColumnIndex("cod_mart"));
add(new IndexTableDTO.ColumnIndex("partita_mag"));
add(new IndexTableDTO.ColumnIndex("cod_tagl"));
add(new IndexTableDTO.ColumnIndex("cod_col"));
}})
.setColumnsInclude("qta_col", "num_cnf"));
executeStatement(connection, "UPDATE STATISTICS dbo.mvw_mtb_colr_with_giacenza");
createOrUpdateView(connection, "mvw_sitart_udc_det_inventario", "CREATE VIEW [dbo].[mvw_sitart_udc_det_inventario] AS\n" +
" WITH baseMtbColr AS (SELECT c,\n" +
"\n" +
" ROUND(v.qta_col, cifre_dec) AS qta_col,\n" +
" ROUND(v.num_cnf, cifre_dec) AS num_cnf,\n" +
" IIF(flag_qta_cnf_fissa = 'S',\n" +
" v.qta_cnf_anag, v.qta_col / IIF(v.num_cnf = 0, 1, v.num_cnf)) AS qta_cnf,\n" +
" v.cod_mart,\n" +
" v.cod_col,\n" +
" v.cod_tagl,\n" +
" v.partita_mag,\n" +
" v.peso_netto_kg,\n" +
" v.peso_lordo_kg,\n" +
" mtb_colt.gestione,\n" +
" mtb_colt.data_collo,\n" +
" mtb_colt.ser_collo,\n" +
" mtb_colt.num_collo,\n" +
" v.cod_jcom,\n" +
" v.flag_qta_cnf_fissa,\n" +
" v.unt_mis,\n" +
" v.diacod,\n" +
" v.descrizione_estesa,\n" +
" v.cod_mgrp,\n" +
" mtb_grup.descrizione AS descrizione_gruppo,\n" +
" v.cod_msgr,\n" +
" mtb_sgrp.descrizione AS descrizione_sottogruppo,\n" +
" mtb_unt_mis.flag_dig,\n" +
" mtb_unt_mis.cifre_dec,\n" +
" mtb_colt.segno,\n" +
" v.cod_mdep,\n" +
" v.posizione,\n" +
" mtb_colt.cod_dtip,\n" +
" mtb_colt.cod_jfas,\n" +
" v.barcode_ul,\n" +
" v.qta_cnf_anag\n" +
" FROM mvw_mtb_colr_with_giacenza v WITH (NOEXPAND)\n" +
" INNER JOIN mtb_colt\n" +
" ON v.barcode_ul = mtb_colt.barcode_ul\n" +
" INNER JOIN dbo.mtb_unt_mis ON v.unt_mis = mtb_unt_mis.unt_mis\n" +
"\n" +
" INNER JOIN dbo.mtb_grup ON v.cod_mgrp = mtb_grup.cod_mgrp\n" +
" INNER JOIN dbo.mtb_sgrp ON v.cod_mgrp = mtb_sgrp.cod_mgrp\n" +
" AND v.cod_msgr = mtb_sgrp.cod_msgr\n" +
" WHERE qta_col > 0\n" +
" AND (segno = 1 OR (segno = -1 AND cod_dtip IS NULL AND mtb_colt.gestione = 'V'))\n" +
" ),\n" +
" final_stock AS (SELECT v.qta_col,\n" +
" v.num_cnf,\n" +
" v.qta_cnf,\n" +
" v.gestione,\n" +
" v.data_collo,\n" +
" v.ser_collo,\n" +
" v.num_collo,\n" +
" v.cod_mdep AS cod_mdep,\n" +
" v.posizione AS posizione,\n" +
" mtb_depo_posizioni.priorita,\n" +
" v.cod_mgrp AS codGruppo,\n" +
" v.descrizione_gruppo AS Gruppo,\n" +
" v.cod_msgr AS CodSgruppo,\n" +
" v.descrizione_sottogruppo AS Sottogruppo,\n" +
" v.cod_mart,\n" +
" v.diacod,\n" +
" v.descrizione_estesa,\n" +
" v.partita_mag,\n" +
" v.cod_col,\n" +
" v.cod_tagl,\n" +
" v.cod_jcom,\n" +
" v.peso_netto_kg,\n" +
" v.peso_lordo_kg,\n" +
" v.cod_jfas,\n" +
" v.flag_qta_cnf_fissa,\n" +
" v.unt_mis,\n" +
" v.segno,\n" +
" v.barcode_ul\n" +
" FROM baseMtbColr v\n" +
"\n" +
" LEFT OUTER JOIN mtb_depo_posizioni\n" +
" ON v.cod_mdep = mtb_depo_posizioni.cod_mdep\n" +
" AND v.posizione = mtb_depo_posizioni.posizione)\n" +
"\n" +
" SELECT qta_col,\n" +
" num_cnf,\n" +
" qta_cnf,\n" +
" gestione,\n" +
" data_collo,\n" +
" ser_collo,\n" +
" num_collo,\n" +
" cod_mdep,\n" +
" posizione,\n" +
" priorita,\n" +
" codGruppo,\n" +
" Gruppo,\n" +
" CodSgruppo,\n" +
" Sottogruppo,\n" +
" cod_mart,\n" +
" diacod,\n" +
" descrizione_estesa,\n" +
" partita_mag,\n" +
" cod_col,\n" +
" cod_tagl,\n" +
" cod_jcom,\n" +
" peso_netto_kg,\n" +
" peso_lordo_kg,\n" +
" cod_jfas,\n" +
" flag_qta_cnf_fissa,\n" +
" unt_mis,\n" +
" segno,\n" +
" barcode_ul\n" +
" FROM final_stock");
}
private static boolean existsView(Connection connection, String objectName) throws SQLException {
return UtilityDB.<Integer>executeSimpleQueryOnlyFirstRowFirstColumn(connection, "SELECT COUNT(*) FROM SYSOBJECTS WHERE id = object_id('" + objectName + "')") > 0;
}
private static void dropView(Connection connection, String objectName) throws SQLException, IOException {
UtilityDB.executeStatement(connection, "IF EXISTS (SELECT * FROM SYSOBJECTS WHERE id = object_id('" + objectName + "'))\r\n" +
"\tDROP " + SqlObjectTypeEnum.VIEW.toString() + " " + objectName);
}
private static boolean existsTable(Connection connection, String tableName) throws SQLException, IOException {
String schema = null;
if (tableName.contains(".")) {
schema = tableName.substring(0, tableName.indexOf("."));
tableName = tableName.replace(schema + ".", "");
}
String sql = Query.format("SELECT CAST(COUNT(*) AS BIT) AS exist FROM INFORMATION_SCHEMA.TABLES " +
"WHERE TABLE_NAME = N%s ", tableName);
if (schema != null)
sql += Query.format("AND TABLE_SCHEMA = N%s", schema);
return UtilityDB.<Boolean>executeSimpleQueryOnlyFirstRowFirstColumn(connection, sql);
}
private static void createIndex(Connection connection, IndexTableDTO indexTableDTO) throws Exception {
UtilityDB.createIndex(connection, indexTableDTO);
}
private static void dropIndex(Connection connection, String tableName, String indexName) throws Exception {
UtilityDB.dropIndex(connection, tableName, indexName);
}
private static void executeStatement(Connection connection, String... sqls) throws SQLException {
try (Statement statement = connection.createStatement()) {
for (String sql : sqls) {
statement.execute(sql);
}
}
}
private static void createOrUpdateView(Connection connection, String objectName, String createViewSql) throws SQLException, IOException {
alterObject(connection, SqlObjectTypeEnum.VIEW, objectName, createViewSql);
}
private static void alterObject(Connection connection, SqlObjectTypeEnum sqlObject, String objectName, String sql) throws SQLException, IOException {
executeStatement(connection, "IF EXISTS (SELECT * FROM SYSOBJECTS WHERE id = object_id('" + objectName + "'))\r\n" +
"\tDROP " + sqlObject.toString() + " " + objectName,
sql);
}
}

View File

@@ -3,14 +3,7 @@ package it.integry.ems.migration.model;
import it.integry.ems.migration._base.BaseMigration; import it.integry.ems.migration._base.BaseMigration;
import it.integry.ems.migration._base.IntegryCustomer; import it.integry.ems.migration._base.IntegryCustomer;
import it.integry.ems.migration._base.MigrationModelInterface; import it.integry.ems.migration._base.MigrationModelInterface;
import it.integry.ems_model.entity.MtbColt; import it.integry.ems.migration.dto.common.MigrationMvwSitArtUdcDetInventarioDTO;
import it.integry.ems_model.types.OperationType;
import it.integry.ems_model.utility.Query;
import it.integry.ems_model.utility.UtilityDB;
import it.integry.ems_model.utility.dto.IndexTableDTO;
import java.time.LocalDate;
import java.util.ArrayList;
public class Migration_20241213163759 extends BaseMigration implements MigrationModelInterface { public class Migration_20241213163759 extends BaseMigration implements MigrationModelInterface {
@@ -22,381 +15,8 @@ public class Migration_20241213163759 extends BaseMigration implements Migration
if (!isCustomer(IntegryCustomer.RossoGargano)) if (!isCustomer(IntegryCustomer.RossoGargano))
return; return;
//Migration di conversione aziende a nuova mvw_sitart_udc_det_inventario MigrationMvwSitArtUdcDetInventarioDTO.apply(connection);
createBackupOfOldView(); MigrationMvwSitArtUdcDetInventarioDTO.alignGiacenza(connection);
dropView("mvw_sitart_udc_det_inventario");
createNewView();
alignGiacenza();
}
private void createBackupOfOldView() throws Exception {
if (existsView("mvw_sitart_udc_det_inventario_old"))
return;
createOrUpdateView("mvw_sitart_udc_det_inventario_old", "CREATE VIEW [dbo].[mvw_sitart_udc_det_inventario_old] AS\n" +
"SELECT UL.gestione,\n" +
" data_collo,\n" +
" ser_collo,\n" +
" num_collo,\n" +
" segno,\n" +
" UL.cod_mdep,\n" +
" UL.posizione,\n" +
" mtb_depo_posizioni.priorita,\n" +
" mtb_aart.cod_mgrp AS codGruppo,\n" +
" mtb_grup.descrizione AS Gruppo,\n" +
" mtb_aart.cod_msgr AS CodSgruppo,\n" +
" mtb_sgrp.descrizione AS Sottogruppo,\n" +
" UL.cod_mart,\n" +
" diacod,\n" +
" mtb_aart.descrizione_estesa,\n" +
" partita_mag,\n" +
" UL.cod_jcom,\n" +
" jtb_comt.descrizione AS commessa,\n" +
" mtb_aart.unt_mis,\n" +
" qta_col,\n" +
" num_cnf,\n" +
" UL.qta_cnf,\n" +
" UL.peso_netto_kg,\n" +
" UL.peso_lordo_kg,\n" +
" UL.cod_jfas\n" +
"FROM [mvw_sitart_udc_det] UL\n" +
" LEFT OUTER JOIN jtb_comt ON UL.cod_jcom = jtb_comt.cod_jcom\n" +
" LEFT OUTER JOIN mtb_depo_posizioni\n" +
" ON UL.cod_mdep = mtb_depo_posizioni.cod_mdep AND UL.posizione = mtb_depo_posizioni.posizione,\n" +
" mtb_aart,\n" +
" mtb_grup,\n" +
" mtb_sgrp\n" +
"WHERE UL.cod_mart = mtb_aart.cod_mart\n" +
" AND mtb_aart.cod_mgrp = mtb_grup.cod_mgrp\n" +
" AND mtb_aart.cod_mgrp = mtb_sgrp.cod_mgrp\n" +
" AND mtb_aart.cod_msgr = mtb_sgrp.cod_msgr\n" +
" AND qta_col <> 0");
}
private void createNewView() throws Exception {
if (!existsTable("stb_multiplier")) {
executeStatement("CREATE TABLE stb_multiplier\n" +
"(\n" +
" moltiplicatore INT NOT NULL\n" +
")",
"INSERT INTO stb_multiplier (moltiplicatore) VALUES (1)",
"INSERT INTO stb_multiplier (moltiplicatore) VALUES (-1)");
}
createOrUpdateView("mvw_mtb_colr_with_giacenza", "CREATE VIEW dbo.mvw_mtb_colr_with_giacenza\n" +
" WITH SCHEMABINDING\n" +
"AS\n" +
"SELECT COUNT_BIG(*) AS c,\n" +
" IIF(moltiplicatore = -1 AND num_collo_rif IS NOT NULL, mtb_colr.gestione_rif,\n" +
" mtb_colr.gestione) AS gestione,\n" +
" IIF(moltiplicatore = -1 AND num_collo_rif IS NOT NULL, mtb_colr.data_collo_rif,\n" +
" mtb_colr.data_collo) AS data_collo,\n" +
" IIF(moltiplicatore = -1 AND num_collo_rif IS NOT NULL, mtb_colr.ser_collo_rif,\n" +
" mtb_colr.ser_collo) AS ser_collo,\n" +
" IIF(moltiplicatore = -1 AND num_collo_rif IS NOT NULL, mtb_colr.num_collo_rif,\n" +
" mtb_colr.num_collo) AS num_collo,\n" +
" SUM(mtb_colr.qta_col * moltiplicatore) AS qta_col,\n" +
"\n" +
" SUM(IIF(mtb_aart.flag_qta_cnf_fissa = 'S', mtb_colr.qta_col / mtb_aart.qta_cnf, mtb_colr.num_cnf) *\n" +
" moltiplicatore) AS num_cnf,\n" +
" mtb_colr.cod_mart,\n" +
" mtb_colr.cod_col,\n" +
" mtb_colr.cod_tagl,\n" +
" mtb_colr.partita_mag,\n" +
" SUM(mtb_colr.peso_netto_kg * moltiplicatore) AS peso_netto_kg,\n" +
" SUM(mtb_colr.peso_lordo_kg * moltiplicatore) AS peso_lordo_kg,\n" +
" IIF(mtb_colr.cod_jcom = 'MAG', NULL, mtb_colr.cod_jcom) AS cod_jcom,\n" +
" mtb_aart.flag_qta_cnf_fissa,\n" +
" mtb_aart.unt_mis,\n" +
" mtb_aart.diacod,\n" +
" mtb_aart.descrizione_estesa,\n" +
" mtb_aart.cod_mgrp,\n" +
" mtb_aart.cod_msgr,\n" +
" mtb_aart.cod_mtip,\n" +
" mtb_aart.cod_mstp,\n" +
" mtb_aart.cod_msfa,\n" +
" mtb_aart.qta_cnf AS qta_cnf_anag\n" +
"FROM dbo.mtb_colr\n" +
" INNER JOIN dbo.stb_multiplier ON moltiplicatore = 1 OR mtb_colr.num_collo_rif IS NOT NULL\n" +
" INNER JOIN dbo.mtb_aart ON mtb_colr.cod_mart = mtb_aart.cod_mart\n" +
"GROUP BY mtb_colr.cod_mart,\n" +
" mtb_colr.cod_col,\n" +
" mtb_colr.cod_tagl,\n" +
" mtb_colr.partita_mag,\n" +
" IIF(moltiplicatore = -1 AND num_collo_rif IS NOT NULL, mtb_colr.gestione_rif, mtb_colr.gestione),\n" +
" IIF(moltiplicatore = -1 AND num_collo_rif IS NOT NULL, mtb_colr.data_collo_rif,\n" +
" mtb_colr.data_collo),\n" +
" IIF(moltiplicatore = -1 AND num_collo_rif IS NOT NULL, mtb_colr.ser_collo_rif,\n" +
" mtb_colr.ser_collo),\n" +
" IIF(moltiplicatore = -1 AND num_collo_rif IS NOT NULL, mtb_colr.num_collo_rif,\n" +
" mtb_colr.num_collo),\n" +
" IIF(mtb_colr.cod_jcom = 'MAG', NULL, mtb_colr.cod_jcom),\n" +
" mtb_aart.flag_qta_cnf_fissa,\n" +
" mtb_aart.unt_mis,\n" +
" mtb_aart.diacod,\n" +
" mtb_aart.descrizione_estesa,\n" +
" mtb_aart.cod_mgrp,\n" +
" mtb_aart.cod_msgr,\n" +
" mtb_aart.cod_mtip,\n" +
" mtb_aart.cod_mstp,\n" +
" mtb_aart.cod_msfa,\n" +
" mtb_aart.qta_cnf");
dropIndex("mvw_mtb_colr_with_giacenza", "IDX_CLUSTERED_mvw_mtb_colr_with_giacenza");
createIndex(new IndexTableDTO()
.setIndexName("IDX_CLUSTERED_mvw_mtb_colr_with_giacenza")
.setTableName("mvw_mtb_colr_with_giacenza")
.setUnique(true)
.setClustered(true)
.setMaxDop(1)
.setSortInTempDb(true)
.setColumnsIndex(new ArrayList<IndexTableDTO.ColumnIndex>() {{
add(new IndexTableDTO.ColumnIndex("gestione"));
add(new IndexTableDTO.ColumnIndex("data_collo"));
add(new IndexTableDTO.ColumnIndex("num_collo"));
add(new IndexTableDTO.ColumnIndex("ser_collo"));
add(new IndexTableDTO.ColumnIndex("cod_mart"));
add(new IndexTableDTO.ColumnIndex("partita_mag"));
add(new IndexTableDTO.ColumnIndex("cod_tagl"));
add(new IndexTableDTO.ColumnIndex("cod_col"));
add(new IndexTableDTO.ColumnIndex("cod_jcom"));
}}));
dropIndex("mvw_mtb_colr_with_giacenza", "IDX_mvw_qta_mtb_colr_with_giacenza");
createIndex(new IndexTableDTO()
.setIndexName("IDX_mvw_qta_mtb_colr_with_giacenza")
.setTableName("mvw_mtb_colr_with_giacenza")
.setMaxDop(1)
.setSortInTempDb(true)
.setColumnsIndex(new ArrayList<IndexTableDTO.ColumnIndex>() {{
add(new IndexTableDTO.ColumnIndex("qta_col"));
add(new IndexTableDTO.ColumnIndex("num_cnf"));
}}));
dropIndex("mvw_mtb_colr_with_giacenza", "IDX_mvw_articolo_mtb_colr_with_giacenza");
createIndex(new IndexTableDTO()
.setIndexName("IDX_mvw_articolo_mtb_colr_with_giacenza")
.setTableName("mvw_mtb_colr_with_giacenza")
.setMaxDop(1)
.setSortInTempDb(true)
.setColumnsIndex(new ArrayList<IndexTableDTO.ColumnIndex>() {{
add(new IndexTableDTO.ColumnIndex("cod_mart"));
add(new IndexTableDTO.ColumnIndex("partita_mag"));
add(new IndexTableDTO.ColumnIndex("cod_tagl"));
add(new IndexTableDTO.ColumnIndex("cod_col"));
}}));
dropIndex("mvw_mtb_colr_with_giacenza", "IDX_mvw_articolo_giac_mtb_colr_with_giacenza");
createIndex(new IndexTableDTO()
.setIndexName("IDX_mvw_articolo_giac_mtb_colr_with_giacenza")
.setTableName("mvw_mtb_colr_with_giacenza")
.setMaxDop(1)
.setSortInTempDb(true)
.setColumnsIndex(new ArrayList<IndexTableDTO.ColumnIndex>() {{
add(new IndexTableDTO.ColumnIndex("cod_mart"));
add(new IndexTableDTO.ColumnIndex("partita_mag"));
add(new IndexTableDTO.ColumnIndex("cod_tagl"));
add(new IndexTableDTO.ColumnIndex("cod_col"));
}})
.setColumnsInclude("qta_col", "num_cnf"));
executeStatement("UPDATE STATISTICS dbo.mvw_mtb_colr_with_giacenza");
createOrUpdateView("mvw_sitart_udc_det_inventario", "CREATE VIEW mvw_sitart_udc_det_inventario AS\n" +
" WITH baseMtbColr AS (SELECT c,\n" +
"\n" +
" ROUND(v.qta_col, cifre_dec) AS qta_col,\n" +
" ROUND(v.num_cnf, cifre_dec) AS num_cnf,\n" +
" IIF(flag_qta_cnf_fissa = 'S',\n" +
" v.qta_cnf_anag, v.qta_col / IIF(v.num_cnf = 0, 1, v.num_cnf)) AS qta_cnf,\n" +
" v.cod_mart,\n" +
" v.cod_col,\n" +
" v.cod_tagl,\n" +
" v.partita_mag,\n" +
" v.peso_netto_kg,\n" +
" v.peso_lordo_kg,\n" +
" v.gestione,\n" +
" v.data_collo,\n" +
" v.ser_collo,\n" +
" v.num_collo,\n" +
" v.cod_jcom,\n" +
" v.flag_qta_cnf_fissa,\n" +
" v.unt_mis,\n" +
" v.diacod,\n" +
" v.descrizione_estesa,\n" +
" v.cod_mgrp,\n" +
" mtb_grup.descrizione AS descrizione_gruppo,\n" +
" v.cod_msgr,\n" +
" mtb_sgrp.descrizione AS descrizione_sottogruppo,\n" +
" mtb_unt_mis.flag_dig,\n" +
" mtb_unt_mis.cifre_dec,\n" +
" mtb_colt.segno,\n" +
" mtb_colt.cod_mdep,\n" +
" mtb_colt.posizione,\n" +
" mtb_colt.cod_dtip,\n" +
" mtb_colt.cod_jfas,\n" +
" mtb_colt.barcode_ul,\n" +
" v.qta_cnf_anag\n" +
" FROM mvw_mtb_colr_with_giacenza v WITH (NOEXPAND)\n" +
" INNER JOIN mtb_colt\n" +
" ON v.num_collo = mtb_colt.num_collo AND v.gestione = mtb_colt.gestione AND\n" +
" v.ser_collo = mtb_colt.ser_collo AND v.data_collo = mtb_colt.data_collo\n" +
" INNER JOIN dbo.mtb_unt_mis ON v.unt_mis = mtb_unt_mis.unt_mis\n" +
"\n" +
" INNER JOIN dbo.mtb_grup ON v.cod_mgrp = mtb_grup.cod_mgrp\n" +
" INNER JOIN dbo.mtb_sgrp ON v.cod_mgrp = mtb_sgrp.cod_mgrp\n" +
" AND v.cod_msgr = mtb_sgrp.cod_msgr\n" +
" WHERE qta_col > 0\n" +
" AND (segno = 1 OR (segno = -1 AND cod_dtip IS NULL AND v.gestione = 'V'))),\n" +
" final_stock AS (SELECT v.qta_col,\n" +
" v.num_cnf,\n" +
" v.qta_cnf,\n" +
" v.gestione,\n" +
" v.data_collo,\n" +
" v.ser_collo,\n" +
" v.num_collo,\n" +
" v.cod_mdep AS cod_mdep,\n" +
" v.posizione AS posizione,\n" +
" mtb_depo_posizioni.priorita,\n" +
" v.cod_mgrp AS codGruppo,\n" +
" v.descrizione_gruppo AS Gruppo,\n" +
" v.cod_msgr AS CodSgruppo,\n" +
" v.descrizione_sottogruppo AS Sottogruppo,\n" +
" v.cod_mart,\n" +
" v.diacod,\n" +
" v.descrizione_estesa,\n" +
" v.partita_mag,\n" +
" v.cod_col,\n" +
" v.cod_tagl,\n" +
" v.cod_jcom,\n" +
" v.peso_netto_kg,\n" +
" v.peso_lordo_kg,\n" +
" v.cod_jfas,\n" +
" v.flag_qta_cnf_fissa,\n" +
" v.unt_mis,\n" +
" v.segno,\n" +
" v.barcode_ul\n" +
" FROM baseMtbColr v\n" +
"\n" +
" LEFT OUTER JOIN mtb_depo_posizioni\n" +
" ON v.cod_mdep = mtb_depo_posizioni.cod_mdep\n" +
" AND v.posizione = mtb_depo_posizioni.posizione)\n" +
"\n" +
" SELECT qta_col,\n" +
" num_cnf,\n" +
" qta_cnf,\n" +
" gestione,\n" +
" data_collo,\n" +
" ser_collo,\n" +
" num_collo,\n" +
" cod_mdep,\n" +
" posizione,\n" +
" priorita,\n" +
" codGruppo,\n" +
" Gruppo,\n" +
" CodSgruppo,\n" +
" Sottogruppo,\n" +
" cod_mart,\n" +
" diacod,\n" +
" descrizione_estesa,\n" +
" partita_mag,\n" +
" cod_col,\n" +
" cod_tagl,\n" +
" cod_jcom,\n" +
" peso_netto_kg,\n" +
" peso_lordo_kg,\n" +
" cod_jfas,\n" +
" flag_qta_cnf_fissa,\n" +
" unt_mis,\n" +
" segno,\n" +
" barcode_ul\n" +
" FROM final_stock");
}
private void alignGiacenza() throws Exception {
//Creo un collo di scarico vuoto
MtbColt mtbColt = new MtbColt()
.setGestione("L")
.setSerCollo("RT")
.setSegno(-1)
.setDataCollo(LocalDate.now())
.setAnnotazioni("PASSAGGIO NUOVA MVW_SITART_UDC_DET_INVENTARIO")
.setCodMdep(getInternalCodMdep());
mtbColt.setOperation(OperationType.INSERT);
mtbColt.dataCompleting(connection);
mtbColt.manageWithParentConnection(connection);
executeStatement(Query.format(
"INSERT INTO mtb_colr (gestione, ser_collo, num_collo, data_collo, riga, cod_mart, cod_col, cod_tagl, partita_mag, gestione_rif, data_collo_rif, ser_collo_rif, num_collo_rif, datetime_row,\n" +
" cod_jcom, qta_col, num_cnf, qta_cnf)" +
" SELECT {} AS gestione,\n" +
" {} AS ser_collo,\n" +
" {} AS num_collo,\n" +
" CAST({} AS DATE) AS data_collo,\n" +
" ROW_NUMBER() OVER (PARTITION BY (SELECT NULL) ORDER BY v.data_collo) AS riga,\n" +
" v.cod_mart,\n" +
" v.cod_col,\n" +
" v.cod_tagl,\n" +
" v.partita_mag,\n" +
" v.gestione AS gestion_rif,\n" +
" v.data_collo AS data_collo_rif,\n" +
" v.ser_collo AS ser_collo_rif,\n" +
" v.num_collo AS num_collo_rif,\n" +
" GETDATE() AS datetime_row,\n" +
" v.cod_jcom,\n" +
" v.qta_col,\n" +
" v.num_cnf,\n" +
" v.qta_cnf\n" +
"FROM mvw_sitart_udc_det_inventario v\n" +
" INNER JOIN (SELECT ser_collo,\n" +
" gestione,\n" +
" data_collo,\n" +
" num_collo,\n" +
" cod_mdep,\n" +
" posizione,\n" +
" cod_mart,\n" +
" partita_mag,\n" +
" cod_jcom-- Elenca tutte le colonne coinvolte\n" +
" FROM mvw_sitart_udc_det_inventario\n" +
"\n" +
" EXCEPT\n" +
"\n" +
" SELECT ser_collo,\n" +
" gestione,\n" +
" data_collo,\n" +
" num_collo,\n" +
" cod_mdep,\n" +
" posizione,\n" +
" cod_mart,\n" +
" partita_mag,\n" +
" cod_jcom -- Elenca le stesse colonne dalla vista vecchia\n" +
" FROM mvw_sitart_udc_det_inventario_old) t\n" +
" ON v.num_collo = t.num_collo AND v.data_collo = t.data_collo AND\n" +
" v.ser_collo = t.ser_collo AND v.gestione = t.gestione AND\n" +
" v.cod_mart = t.cod_mart AND v.cod_mdep = t.cod_mdep AND\n" +
" ISNULL(v.partita_mag, '') = ISNULL(t.partita_mag, '') AND\n" +
" ISNULL(v.posizione, '') = ISNULL(t.posizione, '') AND\n" +
" ISNULL(v.cod_jcom, '') = ISNULL(t.cod_jcom, '')" +
" WHERE qta_col > 0",
mtbColt.getGestione(), mtbColt.getSerCollo(), mtbColt.getNumCollo(), mtbColt.getDataCollo()));
}
private String getInternalCodMdep() throws Exception {
return UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(connection, "SELECT TOP 1 cod_mdep" +
" FROM mtb_depo" +
" INNER JOIN dbo.gtb_anag ga ON mtb_depo.cod_anag = ga.cod_anag" +
" inner join azienda on ga.part_iva = azienda.part_iva");
} }
@Override @Override

View File

@@ -1,323 +0,0 @@
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;
import it.integry.ems_model.entity.MtbColt;
import it.integry.ems_model.types.OperationType;
import it.integry.ems_model.utility.Query;
import it.integry.ems_model.utility.UtilityDB;
import it.integry.ems_model.utility.dto.IndexTableDTO;
import java.time.LocalDate;
import java.util.ArrayList;
public class Migration_20250320121611 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
if (!isCustomer(IntegryCustomer.Tosca))
return;
//Migration di conversione aziende a nuova mvw_sitart_udc_det_inventario
createBackupOfOldView();
dropView("mvw_sitart_udc_det_inventario");
createNewView();
}
private void createBackupOfOldView() throws Exception {
if (existsView("mvw_sitart_udc_det_inventario_old"))
return;
createOrUpdateView("mvw_sitart_udc_det_inventario_old", "CREATE VIEW [dbo].[mvw_sitart_udc_det_inventario_old] AS\n" +
"SELECT UL.gestione,\n" +
" data_collo,\n" +
" ser_collo,\n" +
" num_collo,\n" +
" segno,\n" +
" UL.cod_mdep,\n" +
" UL.posizione,\n" +
" mtb_depo_posizioni.priorita,\n" +
" mtb_aart.cod_mgrp AS codGruppo,\n" +
" mtb_grup.descrizione AS Gruppo,\n" +
" mtb_aart.cod_msgr AS CodSgruppo,\n" +
" mtb_sgrp.descrizione AS Sottogruppo,\n" +
" UL.cod_mart,\n" +
" diacod,\n" +
" mtb_aart.descrizione_estesa,\n" +
" partita_mag,\n" +
" UL.cod_jcom,\n" +
" jtb_comt.descrizione AS commessa,\n" +
" mtb_aart.unt_mis,\n" +
" qta_col,\n" +
" num_cnf,\n" +
" UL.qta_cnf,\n" +
" UL.peso_netto_kg,\n" +
" UL.peso_lordo_kg,\n" +
" UL.cod_jfas\n" +
"FROM [mvw_sitart_udc_det] UL\n" +
" LEFT OUTER JOIN jtb_comt ON UL.cod_jcom = jtb_comt.cod_jcom\n" +
" LEFT OUTER JOIN mtb_depo_posizioni\n" +
" ON UL.cod_mdep = mtb_depo_posizioni.cod_mdep AND UL.posizione = mtb_depo_posizioni.posizione,\n" +
" mtb_aart,\n" +
" mtb_grup,\n" +
" mtb_sgrp\n" +
"WHERE UL.cod_mart = mtb_aart.cod_mart\n" +
" AND mtb_aart.cod_mgrp = mtb_grup.cod_mgrp\n" +
" AND mtb_aart.cod_mgrp = mtb_sgrp.cod_mgrp\n" +
" AND mtb_aart.cod_msgr = mtb_sgrp.cod_msgr\n" +
" AND qta_col <> 0");
}
private void createNewView() throws Exception {
if (!existsTable("stb_multiplier")) {
executeStatement("CREATE TABLE stb_multiplier\n" +
"(\n" +
" moltiplicatore INT NOT NULL\n" +
")",
"INSERT INTO stb_multiplier (moltiplicatore) VALUES (1)",
"INSERT INTO stb_multiplier (moltiplicatore) VALUES (-1)");
}
createOrUpdateView("mvw_mtb_colr_with_giacenza", "CREATE VIEW dbo.mvw_mtb_colr_with_giacenza\n" +
" WITH SCHEMABINDING\n" +
"AS\n" +
"SELECT COUNT_BIG(*) AS c,\n" +
" IIF(moltiplicatore = -1 AND num_collo_rif IS NOT NULL, mtb_colr.gestione_rif,\n" +
" mtb_colr.gestione) AS gestione,\n" +
" IIF(moltiplicatore = -1 AND num_collo_rif IS NOT NULL, mtb_colr.data_collo_rif,\n" +
" mtb_colr.data_collo) AS data_collo,\n" +
" IIF(moltiplicatore = -1 AND num_collo_rif IS NOT NULL, mtb_colr.ser_collo_rif,\n" +
" mtb_colr.ser_collo) AS ser_collo,\n" +
" IIF(moltiplicatore = -1 AND num_collo_rif IS NOT NULL, mtb_colr.num_collo_rif,\n" +
" mtb_colr.num_collo) AS num_collo,\n" +
" SUM(mtb_colr.qta_col * moltiplicatore) AS qta_col,\n" +
"\n" +
" SUM(IIF(mtb_aart.flag_qta_cnf_fissa = 'S', mtb_colr.qta_col / mtb_aart.qta_cnf, mtb_colr.num_cnf) *\n" +
" moltiplicatore) AS num_cnf,\n" +
" mtb_colr.cod_mart,\n" +
" mtb_colr.cod_col,\n" +
" mtb_colr.cod_tagl,\n" +
" mtb_colr.partita_mag,\n" +
" SUM(mtb_colr.peso_netto_kg * moltiplicatore) AS peso_netto_kg,\n" +
" SUM(mtb_colr.peso_lordo_kg * moltiplicatore) AS peso_lordo_kg,\n" +
" IIF(mtb_colr.cod_jcom = 'MAG', NULL, mtb_colr.cod_jcom) AS cod_jcom,\n" +
" mtb_aart.flag_qta_cnf_fissa,\n" +
" mtb_aart.unt_mis,\n" +
" mtb_aart.diacod,\n" +
" mtb_aart.descrizione_estesa,\n" +
" mtb_aart.cod_mgrp,\n" +
" mtb_aart.cod_msgr,\n" +
" mtb_aart.cod_mtip,\n" +
" mtb_aart.cod_mstp,\n" +
" mtb_aart.cod_msfa,\n" +
" mtb_aart.qta_cnf AS qta_cnf_anag\n" +
"FROM dbo.mtb_colr\n" +
" INNER JOIN dbo.stb_multiplier ON moltiplicatore = 1 OR mtb_colr.num_collo_rif IS NOT NULL\n" +
" INNER JOIN dbo.mtb_aart ON mtb_colr.cod_mart = mtb_aart.cod_mart\n" +
"GROUP BY mtb_colr.cod_mart,\n" +
" mtb_colr.cod_col,\n" +
" mtb_colr.cod_tagl,\n" +
" mtb_colr.partita_mag,\n" +
" IIF(moltiplicatore = -1 AND num_collo_rif IS NOT NULL, mtb_colr.gestione_rif, mtb_colr.gestione),\n" +
" IIF(moltiplicatore = -1 AND num_collo_rif IS NOT NULL, mtb_colr.data_collo_rif,\n" +
" mtb_colr.data_collo),\n" +
" IIF(moltiplicatore = -1 AND num_collo_rif IS NOT NULL, mtb_colr.ser_collo_rif,\n" +
" mtb_colr.ser_collo),\n" +
" IIF(moltiplicatore = -1 AND num_collo_rif IS NOT NULL, mtb_colr.num_collo_rif,\n" +
" mtb_colr.num_collo),\n" +
" IIF(mtb_colr.cod_jcom = 'MAG', NULL, mtb_colr.cod_jcom),\n" +
" mtb_aart.flag_qta_cnf_fissa,\n" +
" mtb_aart.unt_mis,\n" +
" mtb_aart.diacod,\n" +
" mtb_aart.descrizione_estesa,\n" +
" mtb_aart.cod_mgrp,\n" +
" mtb_aart.cod_msgr,\n" +
" mtb_aart.cod_mtip,\n" +
" mtb_aart.cod_mstp,\n" +
" mtb_aart.cod_msfa,\n" +
" mtb_aart.qta_cnf");
dropIndex("mvw_mtb_colr_with_giacenza", "IDX_CLUSTERED_mvw_mtb_colr_with_giacenza");
createIndex(new IndexTableDTO()
.setIndexName("IDX_CLUSTERED_mvw_mtb_colr_with_giacenza")
.setTableName("mvw_mtb_colr_with_giacenza")
.setUnique(true)
.setClustered(true)
.setMaxDop(1)
.setSortInTempDb(true)
.setColumnsIndex(new ArrayList<IndexTableDTO.ColumnIndex>() {{
add(new IndexTableDTO.ColumnIndex("gestione"));
add(new IndexTableDTO.ColumnIndex("data_collo"));
add(new IndexTableDTO.ColumnIndex("num_collo"));
add(new IndexTableDTO.ColumnIndex("ser_collo"));
add(new IndexTableDTO.ColumnIndex("cod_mart"));
add(new IndexTableDTO.ColumnIndex("partita_mag"));
add(new IndexTableDTO.ColumnIndex("cod_tagl"));
add(new IndexTableDTO.ColumnIndex("cod_col"));
add(new IndexTableDTO.ColumnIndex("cod_jcom"));
}}));
dropIndex("mvw_mtb_colr_with_giacenza", "IDX_mvw_qta_mtb_colr_with_giacenza");
createIndex(new IndexTableDTO()
.setIndexName("IDX_mvw_qta_mtb_colr_with_giacenza")
.setTableName("mvw_mtb_colr_with_giacenza")
.setMaxDop(1)
.setSortInTempDb(true)
.setColumnsIndex(new ArrayList<IndexTableDTO.ColumnIndex>() {{
add(new IndexTableDTO.ColumnIndex("qta_col"));
add(new IndexTableDTO.ColumnIndex("num_cnf"));
}}));
dropIndex("mvw_mtb_colr_with_giacenza", "IDX_mvw_articolo_mtb_colr_with_giacenza");
createIndex(new IndexTableDTO()
.setIndexName("IDX_mvw_articolo_mtb_colr_with_giacenza")
.setTableName("mvw_mtb_colr_with_giacenza")
.setMaxDop(1)
.setSortInTempDb(true)
.setColumnsIndex(new ArrayList<IndexTableDTO.ColumnIndex>() {{
add(new IndexTableDTO.ColumnIndex("cod_mart"));
add(new IndexTableDTO.ColumnIndex("partita_mag"));
add(new IndexTableDTO.ColumnIndex("cod_tagl"));
add(new IndexTableDTO.ColumnIndex("cod_col"));
}}));
dropIndex("mvw_mtb_colr_with_giacenza", "IDX_mvw_articolo_giac_mtb_colr_with_giacenza");
createIndex(new IndexTableDTO()
.setIndexName("IDX_mvw_articolo_giac_mtb_colr_with_giacenza")
.setTableName("mvw_mtb_colr_with_giacenza")
.setMaxDop(1)
.setSortInTempDb(true)
.setColumnsIndex(new ArrayList<IndexTableDTO.ColumnIndex>() {{
add(new IndexTableDTO.ColumnIndex("cod_mart"));
add(new IndexTableDTO.ColumnIndex("partita_mag"));
add(new IndexTableDTO.ColumnIndex("cod_tagl"));
add(new IndexTableDTO.ColumnIndex("cod_col"));
}})
.setColumnsInclude("qta_col", "num_cnf"));
executeStatement("UPDATE STATISTICS dbo.mvw_mtb_colr_with_giacenza");
createOrUpdateView("mvw_sitart_udc_det_inventario", "CREATE VIEW mvw_sitart_udc_det_inventario AS\n" +
" WITH baseMtbColr AS (SELECT c,\n" +
"\n" +
" ROUND(v.qta_col, cifre_dec) AS qta_col,\n" +
" ROUND(v.num_cnf, cifre_dec) AS num_cnf,\n" +
" IIF(flag_qta_cnf_fissa = 'S',\n" +
" v.qta_cnf_anag, v.qta_col / IIF(v.num_cnf = 0, 1, v.num_cnf)) AS qta_cnf,\n" +
" v.cod_mart,\n" +
" v.cod_col,\n" +
" v.cod_tagl,\n" +
" v.partita_mag,\n" +
" v.peso_netto_kg,\n" +
" v.peso_lordo_kg,\n" +
" v.gestione,\n" +
" v.data_collo,\n" +
" v.ser_collo,\n" +
" v.num_collo,\n" +
" v.cod_jcom,\n" +
" v.flag_qta_cnf_fissa,\n" +
" v.unt_mis,\n" +
" v.diacod,\n" +
" v.descrizione_estesa,\n" +
" v.cod_mgrp,\n" +
" mtb_grup.descrizione AS descrizione_gruppo,\n" +
" v.cod_msgr,\n" +
" mtb_sgrp.descrizione AS descrizione_sottogruppo,\n" +
" mtb_unt_mis.flag_dig,\n" +
" mtb_unt_mis.cifre_dec,\n" +
" mtb_colt.segno,\n" +
" mtb_colt.cod_mdep,\n" +
" mtb_colt.posizione,\n" +
" mtb_colt.cod_dtip,\n" +
" mtb_colt.cod_jfas,\n" +
" mtb_colt.barcode_ul,\n" +
" v.qta_cnf_anag\n" +
" FROM mvw_mtb_colr_with_giacenza v WITH (NOEXPAND)\n" +
" INNER JOIN mtb_colt\n" +
" ON v.num_collo = mtb_colt.num_collo AND v.gestione = mtb_colt.gestione AND\n" +
" v.ser_collo = mtb_colt.ser_collo AND v.data_collo = mtb_colt.data_collo\n" +
" INNER JOIN dbo.mtb_unt_mis ON v.unt_mis = mtb_unt_mis.unt_mis\n" +
"\n" +
" INNER JOIN dbo.mtb_grup ON v.cod_mgrp = mtb_grup.cod_mgrp\n" +
" INNER JOIN dbo.mtb_sgrp ON v.cod_mgrp = mtb_sgrp.cod_mgrp\n" +
" AND v.cod_msgr = mtb_sgrp.cod_msgr\n" +
" WHERE qta_col > 0\n" +
" AND (segno = 1 OR (segno = -1 AND cod_dtip IS NULL AND v.gestione = 'V'))),\n" +
" final_stock AS (SELECT v.qta_col,\n" +
" v.num_cnf,\n" +
" v.qta_cnf,\n" +
" v.gestione,\n" +
" v.data_collo,\n" +
" v.ser_collo,\n" +
" v.num_collo,\n" +
" v.cod_mdep AS cod_mdep,\n" +
" v.posizione AS posizione,\n" +
" mtb_depo_posizioni.priorita,\n" +
" v.cod_mgrp AS codGruppo,\n" +
" v.descrizione_gruppo AS Gruppo,\n" +
" v.cod_msgr AS CodSgruppo,\n" +
" v.descrizione_sottogruppo AS Sottogruppo,\n" +
" v.cod_mart,\n" +
" v.diacod,\n" +
" v.descrizione_estesa,\n" +
" v.partita_mag,\n" +
" v.cod_col,\n" +
" v.cod_tagl,\n" +
" v.cod_jcom,\n" +
" v.peso_netto_kg,\n" +
" v.peso_lordo_kg,\n" +
" v.cod_jfas,\n" +
" v.flag_qta_cnf_fissa,\n" +
" v.unt_mis,\n" +
" v.segno,\n" +
" v.barcode_ul\n" +
" FROM baseMtbColr v\n" +
"\n" +
" LEFT OUTER JOIN mtb_depo_posizioni\n" +
" ON v.cod_mdep = mtb_depo_posizioni.cod_mdep\n" +
" AND v.posizione = mtb_depo_posizioni.posizione)\n" +
"\n" +
" SELECT qta_col,\n" +
" num_cnf,\n" +
" qta_cnf,\n" +
" gestione,\n" +
" data_collo,\n" +
" ser_collo,\n" +
" num_collo,\n" +
" cod_mdep,\n" +
" posizione,\n" +
" priorita,\n" +
" codGruppo,\n" +
" Gruppo,\n" +
" CodSgruppo,\n" +
" Sottogruppo,\n" +
" cod_mart,\n" +
" diacod,\n" +
" descrizione_estesa,\n" +
" partita_mag,\n" +
" cod_col,\n" +
" cod_tagl,\n" +
" cod_jcom,\n" +
" peso_netto_kg,\n" +
" peso_lordo_kg,\n" +
" cod_jfas,\n" +
" flag_qta_cnf_fissa,\n" +
" unt_mis,\n" +
" segno,\n" +
" barcode_ul\n" +
" FROM final_stock");
}
@Override
public void down() throws Exception {
}
}

View File

@@ -0,0 +1,30 @@
package it.integry.ems.migration.model;
import it.integry.ems.migration._base.BaseMigration;
import it.integry.ems.migration._base.MigrationModelInterface;
public class Migration_20250402112610 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
// //Gia aggiornato
// if (isCustomer(IntegryCustomer.RossoGargano) ||
// isCustomer(IntegryCustomer.Tosca))
// return;
//
// //Azienda da aggiornare
// if (!isCustomer(IntegryCustomer.Gramm))
// return;
//
// MigrationMvwSitArtUdcDetInventarioDTO.apply(connection);
// MigrationMvwSitArtUdcDetInventarioDTO.alignGiacenza(connection);
}
@Override
public void down() throws Exception {
}
}

View File

@@ -0,0 +1,73 @@
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;
import it.integry.ems.migration.dto.common.MigrationMvwSitArtUdcDetInventarioDTO;
import it.integry.ems.rules.completing.PackagesRules;
import it.integry.ems_model.entity.MtbColt;
import it.integry.ems_model.types.OperationType;
import it.integry.ems_model.utility.Query;
import it.integry.ems_model.utility.UtilityDB;
import java.util.List;
public class Migration_20250403174531 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
if (!isCustomer(IntegryCustomer.RossoGargano))
return;
//Rigenero barcodeUl testate con barcode duplicato
regenerateDuplicatedBarcodeUlTestate();
//Aggiorno la view mvw_mtb_colr_with_giacenza
MigrationMvwSitArtUdcDetInventarioDTO.apply(connection);
MigrationMvwSitArtUdcDetInventarioDTO.alignGiacenza(connection);
}
@Override
public void down() throws Exception {
}
private void regenerateDuplicatedBarcodeUlTestate() throws Exception {
String retrieveDuplicatedSql = "SELECT barcode_ul\n" +
"FROM mtb_colt\n" +
"GROUP BY barcode_ul, ser_collo\n" +
"HAVING COUNT(barcode_ul) > 1";
final List<String> duplicatedBarcodes = UtilityDB.executeSimpleQueryOnlyFirstColumn(connection, retrieveDuplicatedSql);
for (String barcode : duplicatedBarcodes) {
String sql = Query.format("SELECT * FROM mtb_colt WHERE barcode_ul = {}", barcode);
List<MtbColt> loadedMtbColts = executeQueryDTO(sql, MtbColt.class);
for (MtbColt colt : loadedMtbColts) {
if (colt.getSerCollo().equalsIgnoreCase("T")) {
String newBarcodeUl = PackagesRules.completeBarcodeUl(connection,
colt.getGestione(),
colt.getDataCollo(),
colt.getSerCollo(),
colt.getNumCollo(),
null,
null);
colt.setBarcodeUl(newBarcodeUl);
colt.setOperation(OperationType.UPDATE);
colt.manageWithParentConnection(connection);
}
}
}
}
}

View File

@@ -0,0 +1,181 @@
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_20250403174532 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
if (isCustomer(IntegryCustomer.Gramm) ||
isCustomer(IntegryCustomer.RossoGargano) ||
isCustomer(IntegryCustomer.Carelli) ||
isDMS())
return;
//Cancello tutti i barcode UL dalle testate degli scarichi a lavorazione
executeStatement("UPDATE mtb_colt SET barcode_ul = NULL\n" +
"WHERE gestione = 'L' AND segno = -1\n" +
"AND barcode_ul IS NOT NULL");
executeStatement("UPDATE mtb_colt\n" +
"SET barcode_ul = EAN128.AI_00\n" +
"FROM mtb_colt\n" +
" CROSS APPLY (SELECT TOP 1 * FROM (SELECT DISTINCT AI_00\n" +
" FROM f_getEAN128UL(mtb_colt.gestione, mtb_colt.data_collo, mtb_colt.ser_collo,\n" +
" mtb_colt.num_collo,\n" +
" NULL)" +
" WHERE mtb_colt.ser_collo <> 'UL'\n" +
" UNION\n" +
" SELECT CONCAT('U', RIGHT(YEAR(mtb_colt.data_collo), 2), FORMAT(mtb_colt.num_collo, '0000000')) AS AI_00\n" +
" WHERE mtb_colt.ser_collo = 'UL') tmp) EAN128");
createOrUpdateFunction("f_getEAN128UL", "CREATE FUNCTION [dbo].[f_getEAN128UL](@gestione VARCHAR(1), @dataCollo DATETIME, @serCollo VARCHAR(2), @numCollo INT,\n" +
" @customPrefissoEan VARCHAR(7))\n" +
" RETURNS TABLE AS\n" +
" RETURN\n" +
" -- DECLARE @gestione AS VARCHAR(1) = 'L'\n" +
"-- DECLARE @serCollo AS VARCHAR(10) = 'GG'\n" +
"-- DECLARE @numCollo AS INT = 7837\n" +
"-- DECLARE @dataCollo AS DATETIME = '2025-03-10';\n" +
"-- DECLARE @customPrefissoEan AS VARCHAR(7);-- = '8017596';\n" +
"\n" +
" WITH barcodes AS (SELECT mtb_colt.barcode_ul AS AI_00,\n" +
" CASE\n" +
" WHEN mtb_aart.cod_barre_imb IS NOT NULL AND LEN(mtb_aart.cod_barre_imb) < 14 THEN\n" +
" FORMAT(CONVERT(NUMERIC, ISNULL(NULLIF(mtb_aart.cod_barre_imb, ''), '0')),\n" +
" REPLICATE('0', 14))\n" +
" ELSE mtb_aart.cod_barre_imb\n" +
" END AS AI_01,\n" +
" CASE\n" +
" WHEN mtb_aart.bar_code IS NOT NULL AND LEN(mtb_aart.bar_code) < 14\n" +
" THEN\n" +
" FORMAT(CONVERT(BIGINT, mtb_aart.bar_code), REPLICATE('0', 14))\n" +
" ELSE mtb_aart.bar_code\n" +
" END AS AI_02,\n" +
" CASE\n" +
" WHEN mtb_colr.partita_mag IS NOT NULL THEN\n" +
" mtb_colr.partita_mag + CHAR(29)\n" +
" END AS AI_10,\n" +
" CASE\n" +
" WHEN mtb_partita_mag.data_scad IS NOT NULL THEN\n" +
" REPLACE(CONVERT(VARCHAR(10), mtb_partita_mag.data_scad, 2), '.', '')\n" +
" END AS AI_15,\n" +
" CASE\n" +
" WHEN LEN(CAST(mtb_aart.peso_kg * mtb_colr.qta_cnf AS INTEGER)) <= 6 THEN\n" +
" REPLACE(FORMAT(mtb_aart.peso_kg * mtb_colr.qta_cnf, '000000'), '.', '')\n" +
" END AS AI_3100,\n" +
" CASE\n" +
" WHEN LEN(CAST(mtb_aart.peso_kg * mtb_colr.qta_cnf AS INTEGER)) <= 5 THEN\n" +
" REPLACE(FORMAT(mtb_aart.peso_kg * mtb_colr.qta_cnf, '00000.0'), '.', '')\n" +
" END AS AI_3101,\n" +
" CASE\n" +
" WHEN LEN(CAST(mtb_aart.peso_kg * mtb_colr.qta_cnf AS INTEGER)) <= 4 THEN\n" +
" REPLACE(FORMAT(mtb_aart.peso_kg * mtb_colr.qta_cnf, '0000.00'), '.', '')\n" +
" END AS AI_3102,\n" +
" CASE\n" +
" WHEN LEN(CAST(mtb_aart.peso_kg * mtb_colr.qta_cnf AS INTEGER)) <= 3 THEN\n" +
" REPLACE(FORMAT(mtb_aart.peso_kg * mtb_colr.qta_cnf, '000.000'), '.', '')\n" +
" END AS AI_3103,\n" +
" CASE\n" +
" WHEN LEN(CAST(mtb_aart.peso_kg * mtb_colr.qta_cnf AS INTEGER)) <= 2 THEN\n" +
" REPLACE(FORMAT(mtb_aart.peso_kg * mtb_colr.qta_cnf, '00.0000'), '.', '')\n" +
" END AS AI_3104,\n" +
" CASE\n" +
" WHEN LEN(CAST(mtb_aart.peso_kg * mtb_colr.qta_cnf AS INTEGER)) <= 1 THEN\n" +
" REPLACE(FORMAT(mtb_aart.peso_kg * mtb_colr.qta_cnf, '0.00000'), '.', '')\n" +
" END AS AI_3105,\n" +
" CASE\n" +
" WHEN LEN(CAST(mtb_colt.peso_kg AS INTEGER)) <= 6 THEN\n" +
" REPLACE(FORMAT(mtb_colt.peso_kg, '000000'), '.', '')\n" +
" END AS AI_3300,\n" +
" CASE\n" +
" WHEN LEN(CAST(mtb_colt.peso_kg AS INTEGER)) <= 5 THEN\n" +
" REPLACE(FORMAT(mtb_colt.peso_kg, '00000.0'), '.', '')\n" +
" END AS AI_3301,\n" +
" CASE\n" +
" WHEN LEN(CAST(mtb_colt.peso_kg AS INTEGER)) <= 4 THEN\n" +
" REPLACE(FORMAT(mtb_colt.peso_kg, '0000.00'), '.', '')\n" +
" END AS AI_3302,\n" +
" CASE\n" +
" WHEN LEN(CAST(mtb_colt.peso_kg AS INTEGER)) <= 3 THEN\n" +
" REPLACE(FORMAT(mtb_colt.peso_kg, '000.000'), '.', '')\n" +
" END AS AI_3303,\n" +
" CASE\n" +
" WHEN LEN(CAST(mtb_colt.peso_kg AS INTEGER)) <= 2 THEN\n" +
" REPLACE(FORMAT(mtb_colt.peso_kg, '00.0000'), '.', '')\n" +
" END AS AI_3304,\n" +
" CASE\n" +
" WHEN LEN(CAST(mtb_colt.peso_kg AS INTEGER)) <= 1 THEN\n" +
" REPLACE(FORMAT(mtb_colt.peso_kg, '0.00000'), '.', '')\n" +
" END AS AI_3305,\n" +
" CONVERT(VARCHAR, CONVERT(INTEGER, SUM(mtb_colr.qta_col / mtb_colr.qta_cnf))) AS AI_37\n" +
" FROM mtb_colt\n" +
" INNER JOIN mtb_colr\n" +
" ON mtb_colt.gestione = mtb_colr.gestione AND\n" +
" mtb_colt.data_collo = mtb_colr.data_collo AND\n" +
" mtb_colt.ser_collo = mtb_colr.ser_collo AND\n" +
" mtb_colt.num_collo = mtb_colr.num_collo\n" +
" INNER JOIN mtb_aart ON mtb_colr.cod_mart = mtb_aart.cod_mart\n" +
" LEFT OUTER JOIN mtb_partita_mag ON mtb_colr.cod_mart = mtb_partita_mag.cod_mart AND\n" +
" mtb_colr.partita_mag =\n" +
" mtb_partita_mag.partita_mag,\n" +
" azienda\n" +
" WHERE mtb_colt.gestione = @gestione\n" +
" AND mtb_colt.data_collo = @dataCollo\n" +
" AND mtb_colt.ser_collo = @serCollo\n" +
" AND mtb_colt.num_collo = @numCollo\n" +
" GROUP BY mtb_colr.qta_cnf,\n" +
" mtb_colt.data_vers,\n" +
" nome_ditta,\n" +
" azienda.indirizzo,\n" +
" azienda.cap,\n" +
" azienda.citta,\n" +
" azienda.prov,\n" +
" prefisso_ean,\n" +
" mtb_colt.data_collo,\n" +
" mtb_colt.num_collo,\n" +
" mtb_aart.cod_barre_imb,\n" +
" mtb_aart.bar_code,\n" +
" mtb_aart.descrizione_estesa,\n" +
" mtb_colr.partita_mag,\n" +
" mtb_partita_mag.data_scad,\n" +
" mtb_colt.peso_netto_kg,\n" +
" mtb_colr.cod_mart,\n" +
" mtb_colt.gestione,\n" +
" mtb_colt.peso_kg,\n" +
" mtb_aart.peso_kg, \n" +
" mtb_colt.barcode_ul)\n" +
" SELECT AI_00,\n" +
" IIF(AI_01 IS NOT NULL AND LEN(AI_01) = 13,\n" +
" CONCAT(AI_01, dbo.getCheckDigitITF14(AI_01)), AI_01) AS AI_01,\n" +
" AI_02,\n" +
" AI_10,\n" +
" AI_15,\n" +
" AI_3100,\n" +
" AI_3101,\n" +
" AI_3102,\n" +
" AI_3103,\n" +
" AI_3104,\n" +
" AI_3105,\n" +
" AI_3300,\n" +
" AI_3301,\n" +
" AI_3302,\n" +
" AI_3303,\n" +
" AI_3304,\n" +
" AI_3305,\n" +
" AI_37\n" +
" FROM barcodes\n" +
"GO");
}
@Override
public void down() throws Exception {
}
}

View File

@@ -0,0 +1,85 @@
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;
import it.integry.ems.migration.dto.common.MigrationMvwSitArtUdcDetInventarioDTO;
import java.sql.SQLException;
public class Migration_20250417110238 extends BaseMigration implements MigrationModelInterface {
//Migration per aggiornare la view mvw_sitart_udc_det_inventario
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
if (!isCustomer(IntegryCustomer.Maggio) &&
!isCustomer(IntegryCustomer.Biolevante) &&
!isCustomer(IntegryCustomer.Ime) &&
!isCustomerDb(IntegryCustomerDB.Gramm_Gramm))
return;
//Aggiorno la view mvw_mtb_colr_with_giacenza
MigrationMvwSitArtUdcDetInventarioDTO.apply(connection);
if (isCustomerDb(IntegryCustomerDB.Gramm_Gramm))
resetCodJcomColli();
//alignCodJcomScarichiFromCarichi();
MigrationMvwSitArtUdcDetInventarioDTO.alignGiacenza(connection);
}
private void resetCodJcomColli() throws SQLException {
executeStatement("UPDATE mtb_colr SET cod_jcom = NULL");
}
private void alignCodJcomScarichiFromCarichi() throws Exception {
String updateSql = "UPDATE mtb_colr\n" +
"SET mtb_colr.cod_jcom = tmp.cod_jcom_carico\n" +
" FROM mtb_colr\n" +
" INNER JOIN\n" +
" (SELECT mr_scarico.num_collo,\n" +
" mr_scarico.data_collo,\n" +
" mr_scarico.ser_collo,\n" +
" mr_scarico.gestione,\n" +
" mr_scarico.riga,\n" +
" mr_scarico.cod_mart,\n" +
" mr_scarico.partita_mag,\n" +
" mr_scarico.cod_jcom AS cod_jcom_scarico,\n" +
" mr_carico.num_collo AS num_collo_ccarico,\n" +
" mr_carico.cod_jcom AS cod_jcom_carico\n" +
" FROM mtb_colr mr_scarico\n" +
" INNER JOIN mtb_colt mt_scarico\n" +
" ON mr_scarico.gestione = mt_scarico.gestione AND\n" +
" mr_scarico.data_collo = mt_scarico.data_collo AND\n" +
" mr_scarico.num_collo = mt_scarico.num_collo AND\n" +
" mr_scarico.ser_collo = mt_scarico.ser_collo\n" +
" LEFT OUTER JOIN mtb_colr mr_carico\n" +
" ON mr_scarico.gestione_rif = mr_carico.gestione AND\n" +
" mr_scarico.data_collo_rif = mr_carico.data_collo AND\n" +
" mr_scarico.num_collo_rif = mr_carico.num_collo AND\n" +
" mr_scarico.ser_collo_rif = mr_carico.ser_collo AND\n" +
" mr_scarico.cod_mart = mr_carico.cod_mart AND\n" +
" ISNULL(mr_scarico.partita_mag, '') = ISNULL(mr_carico.partita_mag, '')\n" +
" WHERE\n" +
// " mt_scarico.segno = -1 AND\n" +
" mr_carico.num_collo IS NOT NULL\n" +
" AND ISNULL(mr_carico.cod_jcom, '') <> ISNULL(mr_scarico.cod_jcom, '')) tmp\n" +
"ON mtb_colr.num_collo = tmp.num_collo AND\n" +
" mtb_colr.data_collo = tmp.data_collo AND\n" +
" mtb_colr.gestione = tmp.gestione AND\n" +
" mtb_colr.ser_collo = tmp.ser_collo AND\n" +
" mtb_colr.riga = tmp.riga";
executeStatement(updateSql);
}
@Override
public void down() throws Exception {
}
}

View File

@@ -0,0 +1,207 @@
package it.integry.ems.migration.model;
import it.integry.ems.migration._base.BaseMigration;
import it.integry.ems.migration._base.MigrationModelInterface;
public class Migration_20250604172635 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
createOrUpdateView("WMS_OrdPrelievo", "CREATE VIEW [dbo].[WMS_OrdPrelievo] AS\n" +
"WITH elencoFornitoriInterni AS (SELECT value_string AS fornitore\n" +
" FROM dbo.ParseStringIntoArray((SELECT value\n" +
" FROM stb_gest_setup\n" +
" WHERE gest_name = 'PICKING'\n" +
" AND section = 'SPEDIZIONE'\n" +
" AND key_section = 'ELENCO_FORNITORI_INTERNI'),\n" +
" '|')),\n" +
" riservatoPerOrd AS (\n" +
"\n" +
"\n" +
"SELECT mtb_colt.gestione,\n" +
" mtb_colr.data_ord,\n" +
" mtb_colr.num_ord,\n" +
" mtb_colr.riga_ord,\n" +
" SUM(mtb_colr.qta_col) AS qtaCollo,\n" +
" SUM(mtb_colr.num_cnf) AS numCnfCollo,\n" +
" COUNT(DISTINCT mtb_colr.num_ord) AS ColliRiservati\n" +
" FROM mtb_colr\n" +
" INNER JOIN mtb_colt ON mtb_colr.gestione = mtb_colt.gestione AND\n" +
" mtb_colr.data_collo = mtb_colt.data_collo AND\n" +
" mtb_colr.ser_collo = mtb_colt.ser_collo AND\n" +
" mtb_colr.num_collo = mtb_colt.num_collo\n" +
" WHERE segno = - 1\n" +
" AND mtb_colr.gestione IN ('L', 'V')\n" +
" AND mtb_colr.data_ord IS NOT NULL\n" +
" GROUP BY mtb_colt.gestione, mtb_colr.data_ord, mtb_colr.num_ord, mtb_colr.riga_ord\n" +
"\n" +
" ), OrdVr AS (\n" +
" SELECT dtb_ordr.gestione,\n" +
" dtb_ordr.data_ord,\n" +
" dtb_ordr.num_ord,\n" +
" dtb_ordt.cod_vdes,\n" +
" IIF(dtb_ordr.gestione = 'V', LEFT(ISNULL(vtb_dest.citta + ' - ', '') + vtb_dest.indirizzo, 40),\n" +
" dtb_ordt.rif_ord) AS rif_ord,\n" +
" dtb_ordt.cod_anag,\n" +
" dtb_ordt.cod_prod,\n" +
" CASE dtb_ordr.gestione WHEN 'L' THEN '2' WHEN 'V' THEN '3' END +\n" +
" REPLACE(CONVERT(VARCHAR(10), dtb_ordr.data_ord, 105), '-', '') +\n" +
" REPLICATE('0', 5 - LEN(dtb_ordr.num_ord)) +\n" +
" CONVERT(VARCHAR(6), dtb_ordr.num_ord) AS chiave_ordine,\n" +
" dtb_ordr.cod_jcom,\n" +
" dtb_ordr.cod_mart,\n" +
" SUM(ROUND(dtb_ordr.qta_ord - dtb_ordr.qta_evasa, mtb_unt_mis.cifre_dec)) *\n" +
" dtb_ordr.rap_conv AS qta_inevasa,\n" +
" dtb_ordt.listino,\n" +
" dtb_ordt.term_cons,\n" +
" dtb_ordt.cod_auto,\n" +
" dtb_ordt.cod_vvet,\n" +
" dtb_ordt.data_iniz_trasp,\n" +
" dtb_ordt.cod_mdep,\n" +
" dtb_ordr.data_cons AS data_cons,\n" +
" dtb_ordr.id_viaggio,\n" +
" dtb_ordt.cod_vage,\n" +
" SUM(colli.qtaCollo) AS qtaCollo,\n" +
" SUM(ROUND((dtb_ordr.qta_ord - dtb_ordr.qta_evasa) * dtb_ordr.rap_conv -\n" +
" ISNULL(colli.qtaCollo, 0),\n" +
" mtb_unt_mis.cifre_dec)) AS qtaInevasaColli,\n" +
" SUM(colli.numCnfCollo) AS numCnfCollo,\n" +
" SUM(dtb_ordr.num_cnf - dtb_ordr.num_cnf_evasa -\n" +
" ISNULL(colli.numCnfCollo, 0)) AS numCnfInevasaColli,\n" +
" IIF((dtb_ordr.gestione = 'L' AND dtb_ordt.gestione_rif = 'T') OR\n" +
" elencoFornitoriInterni.fornitore IS NOT NULL, 'S', 'N') AS ord_trasf\n" +
" FROM dtb_ordt\n" +
" INNER JOIN dtb_ordr ON dtb_ordt.gestione = dtb_ordr.gestione AND\n" +
" dtb_ordt.data_ord = dtb_ordr.data_ord AND\n" +
" dtb_ordt.num_ord = dtb_ordr.num_ord\n" +
" INNER JOIN mtb_unt_mis ON mtb_unt_mis.unt_mis = dtb_ordr.unt_ord\n" +
" INNER JOIN mtb_aart ON dtb_ordr.cod_mart = mtb_aart.cod_mart\n" +
" LEFT OUTER JOIN vtb_dest ON dtb_ordt.cod_anag = vtb_dest.cod_anag AND\n" +
" dtb_ordt.cod_vdes = vtb_dest.cod_vdes\n" +
" LEFT OUTER JOIN riservatoPerOrd colli\n" +
" ON dtb_ordt.gestione = colli.gestione AND\n" +
" dtb_ordt.data_ord = colli.data_ord AND\n" +
" dtb_ordt.num_ord = colli.num_ord\n" +
" LEFT OUTER JOIN elencoFornitoriInterni ON fornitore = dtb_ordt.cod_anag\n" +
" WHERE dtb_ordt.flag_annulla = 'N'\n" +
" AND dtb_ordt.flag_sospeso = 'N'\n" +
" AND dtb_ordr.flag_evaso = 'I'\n" +
" AND dtb_ordt.flag_evaso_forzato = 'N'\n" +
" AND dtb_ordt.gestione IN ('L', 'V')\n" +
" AND ((mtb_aart.flag_qta_cnf_fissa = 'S' AND qta_ord > qta_evasa) OR\n" +
" (mtb_aart.flag_qta_cnf_fissa <> 'S' AND num_cnf > num_cnf_evasa))\n" +
" GROUP BY dtb_ordr.gestione, dtb_ordr.data_ord, dtb_ordr.num_ord, dtb_ordt.cod_vdes,\n" +
" vtb_dest.indirizzo,\n" +
" vtb_dest.citta, dtb_ordt.rif_ord, dtb_ordt.cod_anag, dtb_ordr.cod_jcom, dtb_ordr.cod_mart,\n" +
" dtb_ordt.cod_prod, dtb_ordt.listino, dtb_ordt.term_cons, dtb_ordt.cod_auto,\n" +
" dtb_ordt.cod_vvet, fornitore,\n" +
" dtb_ordt.data_iniz_trasp, dtb_ordt.cod_mdep, dtb_ordt.cod_vage, dtb_ordr.id_viaggio,\n" +
" colli.num_ord, dtb_ordr.data_cons, dtb_ordt.gestione_rif, dtb_ordr.rap_conv\n" +
"\n" +
"\n" +
" ), OrdV AS (\n" +
" SELECT gestione,\n" +
" data_ord,\n" +
" num_ord,\n" +
" rif_ord,\n" +
" cod_anag,\n" +
" chiave_ordine,\n" +
" cod_jcom,\n" +
" cod_prod,\n" +
" listino,\n" +
" term_cons,\n" +
" cod_auto,\n" +
" cod_vvet,\n" +
" data_iniz_trasp,\n" +
" data_cons,\n" +
" cod_vdes,\n" +
" cod_mdep,\n" +
" COUNT(DISTINCT cod_mart) AS arts_da_evadere,\n" +
" SUM(qtaInevasaColli) AS qtaInevasa,\n" +
" SUM(numCnfInevasaColli) AS numCnfInevasa,\n" +
" id_viaggio,\n" +
" cod_vage,\n" +
" COUNT(DISTINCT qtaCollo) AS colliRiservati,\n" +
" ord_trasf\n" +
" FROM OrdVr\n" +
" GROUP BY gestione, data_ord, num_ord, rif_ord, cod_anag, chiave_ordine, cod_jcom, cod_prod, listino,\n" +
" term_cons, cod_auto, cod_vvet, data_iniz_trasp, data_cons, cod_vdes, cod_mdep, cod_vage,\n" +
" id_viaggio, ord_trasf\n" +
"\n" +
" ),\n" +
" OrdV2 AS (SELECT OrdV.gestione,\n" +
" OrdV.data_ord,\n" +
" OrdV.num_ord,\n" +
" rif_ord,\n" +
" OrdV.cod_anag,\n" +
" chiave_ordine,\n" +
" cod_jcom,\n" +
" cod_prod,\n" +
" listino,\n" +
" term_cons,\n" +
" OrdV.cod_auto,\n" +
" ISNULL(vtb_viaggi.cod_vvet, OrdV.cod_vvet) AS cod_vvet,\n" +
" data_iniz_trasp,\n" +
" ISNULL(CONVERT(DATETIME, CONVERT(VARCHAR(10), vtb_viaggi.data_ora_iniz_trasp, 121)),\n" +
" data_cons) AS data_cons,\n" +
" cod_vdes,\n" +
" cod_mdep,\n" +
" arts_da_evadere AS ArtDaEvadere,\n" +
" OrdV.id_viaggio,\n" +
" cod_vage,\n" +
" ISNULL(ordV.ColliRiservati, 0) AS colli_riservati,\n" +
" qtaInevasa,\n" +
" numCnfInevasa,\n" +
" CAST(IIF(ISNULL(ordV.ColliRiservati, 0) > 0, 1, 0) AS BIT) exist_collo,\n" +
" CAST(IIF(ISNULL(qtaInevasa, 0) > 0,\n" +
" IIF(ISNULL(numCnfInevasa, 0) > 0, 0, IIF(ordV.colliRiservati > 0, 1, 0)), 1) AS BIT) AS flag_evaso,\n" +
" ord_trasf,\n" +
" IIF((SELECT azienda.part_iva\n" +
" FROM azienda\n" +
" WHERE azienda.part_iva = gtb_anag.part_iva) IS NULL, 'N', 'S') AS ord_aziendale\n" +
" FROM Ordv\n" +
" INNER JOIN gtb_anag ON OrdV.cod_anag = gtb_anag.cod_anag\n" +
" LEFT OUTER JOIN vtb_viaggi ON OrdV.id_viaggio = vtb_viaggi.id_viaggio\n" +
" WHERE (arts_da_evadere > 0 OR ISNULL(ColliRiservati, 0) > 0))\n" +
"SELECT gestione,\n" +
" data_ord,\n" +
" num_ord,\n" +
" rif_ord,\n" +
" cod_anag,\n" +
" chiave_ordine,\n" +
" cod_jcom,\n" +
" cod_prod,\n" +
" listino,\n" +
" term_cons,\n" +
" cod_auto,\n" +
" cod_vvet,\n" +
" data_iniz_trasp,\n" +
" data_cons,\n" +
" cod_vdes,\n" +
" cod_mdep,\n" +
" SUM(ArtDaEvadere) AS ArtDaEvadere,\n" +
" id_viaggio,\n" +
" cod_vage,\n" +
" SUM(colli_riservati) AS colli_riservati,\n" +
" SUM(qtaInevasa) AS qtaInevasa,\n" +
" SUM(numCnfInevasa) AS numCnfInevasa,\n" +
" exist_collo,\n" +
" flag_evaso,\n" +
" ord_trasf,\n" +
" ord_aziendale\n" +
"FROM OrdV2\n" +
"GROUP BY gestione, data_ord, num_ord, rif_ord, cod_anag, chiave_ordine, cod_jcom, cod_prod, listino, term_cons,\n" +
" cod_auto, cod_vvet, data_iniz_trasp, data_cons, cod_vdes, cod_mdep, id_viaggio, cod_vage, exist_collo,\n" +
" flag_evaso, ord_trasf, ord_aziendale");
}
@Override
public void down() throws Exception {
}
}

View File

@@ -0,0 +1,130 @@
package it.integry.ems.migration.model;
import it.integry.ems.migration._base.BaseMigration;
import it.integry.ems.migration._base.MigrationModelInterface;
public class Migration_20250618195259 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
createOrUpdateView("dvw_situazione_qta_docs", "CREATE VIEW dvw_situazione_qta_docs AS\n" +
"SELECT dtb_docr.[cod_anag],\n" +
" dtb_docr.[cod_dtip],\n" +
" dtb_docr.[data_doc],\n" +
" dtb_docr.[ser_doc],\n" +
" dtb_docr.[num_doc],\n" +
" dtb_docr.[id_riga],\n" +
" dtb_docr.[cod_mart],\n" +
" dtb_docr.[descrizione],\n" +
" dtb_docr.[unt_doc],\n" +
" (dtb_docr.[rap_conv] / dtb_docr.[rap_conv]) AS rap_conv,\n" +
" (dtb_docr.[qta_doc] * dtb_docr.[rap_conv]) - ISNULL(mtb_colr.qta_col, 0) AS qta_doc,\n" +
" dtb_docr.[val_unt],\n" +
" dtb_docr.[sconto5],\n" +
" dtb_docr.[sconto6],\n" +
" dtb_docr.[sconto7],\n" +
" dtb_docr.[sconto8],\n" +
" dtb_docr.[cod_aliq],\n" +
" dtb_docr.[perc_prov],\n" +
" dtb_docr.[val_prov],\n" +
" dtb_docr.[data_ord],\n" +
" dtb_docr.[num_ord],\n" +
" dtb_docr.[riga_ord],\n" +
" dtb_docr.[importo_riga],\n" +
" dtb_docr.[cod_col],\n" +
" dtb_docr.[cod_tagl],\n" +
" dtb_docr.[cod_jcom],\n" +
" dtb_docr.[cod_mdep],\n" +
" dtb_docr.[perc_gest],\n" +
" dtb_docr.[val_gest],\n" +
" dtb_docr.[partita_mag],\n" +
" dtb_docr.[val_unt_iva],\n" +
" (dtb_docr.[qta_cnf] * dtb_docr.[rap_conv]) AS qta_cnf,\n" +
" dtb_docr.[descrizione_estesa],\n" +
" dtb_docr.[costo_unt],\n" +
" dtb_docr.[perc_ispe],\n" +
" dtb_docr.[val_ispe],\n" +
" dtb_docr.[perc_promo],\n" +
" dtb_docr.[val_promo],\n" +
" dtb_docr.[perc_oneri],\n" +
" dtb_docr.[val_oneri],\n" +
" dtb_docr.[flag_evaso_forzato],\n" +
" dtb_docr.[cod_dtip_comp],\n" +
" dtb_docr.[data_doc_comp],\n" +
" dtb_docr.[ser_doc_comp],\n" +
" dtb_docr.[num_doc_comp],\n" +
" dtb_docr.[cod_promo],\n" +
" dtb_docr.[perc_prov2],\n" +
" dtb_docr.[val_prov2],\n" +
" dtb_docr.[cod_art_for],\n" +
" dtb_docr.[unt_doc2],\n" +
" dtb_docr.[qta_doc2],\n" +
" dtb_docr.[unt_doc3],\n" +
" dtb_docr.[qta_doc3],\n" +
" dtb_docr.[num_cnf] - ISNULL(mtb_colr.num_cnf, 0) AS num_cnf,\n" +
" dtb_docr.[peso_lordo],\n" +
" dtb_docr.[posizione],\n" +
" dtb_docr.[cod_anag_comp],\n" +
" dtb_docr.[cod_mtip],\n" +
" dtb_docr.[matricola],\n" +
" dtb_docr.[data_iniz_comp],\n" +
" dtb_docr.[data_fine_comp],\n" +
" dtb_docr.[cod_kit],\n" +
" dtb_docr.[cod_alis],\n" +
" dtb_docr.[data_ins_row],\n" +
" dtb_docr.[note],\n" +
" dtb_doct.[gestione],\n" +
" mtb_partita_mag.[data_scad] AS data_scad_partita_mag\n" +
"FROM dtb_docr\n" +
" INNER JOIN dtb_doct ON dtb_docr.num_doc = dtb_doct.num_doc AND dtb_docr.data_doc = dtb_doct.data_doc AND\n" +
" dtb_docr.cod_anag = dtb_doct.cod_anag AND dtb_docr.cod_dtip = dtb_doct.cod_dtip AND\n" +
" dtb_docr.ser_doc = dtb_doct.ser_doc\n" +
" INNER JOIN mtb_aart ON dtb_docr.cod_mart = mtb_aart.cod_mart\n" +
" LEFT OUTER JOIN mtb_partita_mag ON dtb_docr.cod_mart = mtb_partita_mag.cod_mart AND\n" +
" dtb_docr.partita_mag = mtb_partita_mag.partita_mag\n" +
" LEFT OUTER JOIN ctb_cont ON mtb_aart.cod_ccon_ricavi = ctb_cont.cod_ccon\n" +
" LEFT OUTER JOIN ctb_grup ON ctb_cont.cod_cgrp = ctb_grup.cod_cgrp\n" +
" LEFT OUTER JOIN (SELECT gestione,\n" +
" cod_mart,\n" +
" cod_col,\n" +
" cod_tagl,\n" +
" SUM(qta_col) AS qta_col,\n" +
" data_ord,\n" +
" num_ord,\n" +
" riga_ord,\n" +
" partita_mag,\n" +
" qta_cnf,\n" +
" gestione_rif,\n" +
" data_collo_rif,\n" +
" ser_collo_rif,\n" +
" num_collo_rif,\n" +
" cod_jcom,\n" +
" SUM(num_cnf) AS num_cnf,\n" +
" cod_anag_doc,\n" +
" cod_dtip_doc,\n" +
" data_doc,\n" +
" ser_doc,\n" +
" num_doc,\n" +
" id_riga_doc\n" +
" FROM mtb_colr\n" +
" GROUP BY gestione, cod_barre, cod_mart, cod_col, cod_tagl, data_ord, num_ord, riga_ord,\n" +
" partita_mag, qta_cnf, gestione_rif, data_collo_rif, ser_collo_rif, num_collo_rif,\n" +
" cod_jcom, cod_anag_doc, cod_dtip_doc, data_doc, ser_doc, num_doc,\n" +
" id_riga_doc) mtb_colr\n" +
" ON dtb_docr.cod_anag = mtb_colr.cod_anag_doc AND dtb_docr.cod_dtip = mtb_colr.cod_dtip_doc AND\n" +
" dtb_docr.ser_doc = mtb_colr.ser_doc AND dtb_docr.data_doc = mtb_colr.data_doc AND\n" +
" dtb_docr.num_doc = mtb_colr.num_doc AND dtb_docr.id_riga = mtb_colr.id_riga_doc\n" +
"WHERE (ctb_grup.sezione <> 1 OR ctb_grup.sezione IS NULL)\n" +
" AND (dtb_docr.[qta_doc] * dtb_docr.[rap_conv]) - ISNULL(mtb_colr.qta_col, 0) > 0");
}
@Override
public void down() throws Exception {
}
}

View File

@@ -0,0 +1,142 @@
package it.integry.ems.migration.model;
import it.integry.ems.migration._base.BaseMigration;
import it.integry.ems.migration._base.MigrationModelInterface;
public class Migration_20250625155432 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
createOrUpdateView("mvw_sitart_udc_det_inventario", "CREATE VIEW [dbo].[mvw_sitart_udc_det_inventario] AS\n" +
"WITH baseMtbColr AS (SELECT c,\n" +
"\n" +
" ROUND(v.qta_col, cifre_dec) AS qta_col,\n" +
" ROUND(v.num_cnf, cifre_dec) AS num_cnf,\n" +
" IIF(flag_qta_cnf_fissa = 'S',\n" +
" v.qta_cnf_anag, v.qta_col / IIF(v.num_cnf = 0, 1, v.num_cnf)) AS qta_cnf,\n" +
" v.cod_mart,\n" +
" v.cod_col,\n" +
" v.cod_tagl,\n" +
" v.partita_mag,\n" +
" v.peso_netto_kg,\n" +
" v.peso_lordo_kg,\n" +
" mtb_colt.gestione,\n" +
" mtb_colt.data_collo,\n" +
" mtb_colt.ser_collo,\n" +
" mtb_colt.num_collo,\n" +
" v.cod_jcom,\n" +
" v.flag_qta_cnf_fissa,\n" +
" v.unt_mis,\n" +
" v.diacod,\n" +
" v.descrizione_estesa,\n" +
" v.cod_mgrp,\n" +
" mtb_grup.descrizione AS descrizione_gruppo,\n" +
" v.cod_msgr,\n" +
" mtb_sgrp.descrizione AS descrizione_sottogruppo,\n" +
" mtb_unt_mis.flag_dig,\n" +
" mtb_unt_mis.cifre_dec,\n" +
" mtb_colt.segno,\n" +
" v.cod_mdep,\n" +
" v.posizione,\n" +
" mtb_colt.cod_dtip,\n" +
" mtb_colt.cod_jfas,\n" +
" v.barcode_ul,\n" +
" v.qta_cnf_anag,\n" +
" mtb_colr.datetime_row AS datetime_posizionamento\n" +
" FROM mvw_mtb_colr_with_giacenza v WITH (NOEXPAND)\n" +
" INNER JOIN mtb_colt\n" +
" ON v.barcode_ul = mtb_colt.barcode_ul\n" +
" LEFT OUTER JOIN mtb_colr ON\n" +
" v.barcode_ul = mtb_colr.barcode_ul_in AND\n" +
" v.cod_mart = mtb_colr.cod_mart AND\n" +
" ISNULL(v.partita_mag, '') = ISNULL(mtb_colr.partita_mag, '') AND\n" +
" ISNULL(v.cod_col, '') = ISNULL(mtb_colr.cod_col, '') AND\n" +
" ISNULL(v.cod_tagl, '') = ISNULL(mtb_colr.cod_tagl, '') AND\n" +
" ISNULL(v.cod_jcom, '') = ISNULL(mtb_colr.cod_jcom, '') AND\n" +
" ISNULL(v.posizione, '') = ISNULL(mtb_colr.posizione_in, '') AND\n" +
" ISNULL(v.cod_mdep, '') = ISNULL(mtb_colr.cod_mdep_in, '') AND\n" +
" ISNULL(mtb_colr.posizione_in, '') <> ISNULL(mtb_colr.posizione_out, '')\n" +
" INNER JOIN dbo.mtb_unt_mis ON v.unt_mis = mtb_unt_mis.unt_mis\n" +
"\n" +
" INNER JOIN dbo.mtb_grup ON v.cod_mgrp = mtb_grup.cod_mgrp\n" +
" INNER JOIN dbo.mtb_sgrp ON v.cod_mgrp = mtb_sgrp.cod_mgrp\n" +
" AND v.cod_msgr = mtb_sgrp.cod_msgr\n" +
" WHERE v.qta_col > 0\n" +
" AND (segno = 1 OR (segno = -1 AND cod_dtip IS NULL AND mtb_colt.gestione = 'V'))),\n" +
" final_stock AS (SELECT v.qta_col,\n" +
" v.num_cnf,\n" +
" v.qta_cnf,\n" +
" v.gestione,\n" +
" v.data_collo,\n" +
" v.ser_collo,\n" +
" v.num_collo,\n" +
" v.cod_mdep AS cod_mdep,\n" +
" v.posizione AS posizione,\n" +
" mtb_depo_posizioni.priorita,\n" +
" v.cod_mgrp AS codGruppo,\n" +
" v.descrizione_gruppo AS Gruppo,\n" +
" v.cod_msgr AS CodSgruppo,\n" +
" v.descrizione_sottogruppo AS Sottogruppo,\n" +
" v.cod_mart,\n" +
" v.diacod,\n" +
" v.descrizione_estesa,\n" +
" v.partita_mag,\n" +
" v.cod_col,\n" +
" v.cod_tagl,\n" +
" v.cod_jcom,\n" +
" v.peso_netto_kg,\n" +
" v.peso_lordo_kg,\n" +
" v.cod_jfas,\n" +
" v.flag_qta_cnf_fissa,\n" +
" v.unt_mis,\n" +
" v.segno,\n" +
" v.barcode_ul,\n" +
" v.datetime_posizionamento\n" +
" FROM baseMtbColr v\n" +
"\n" +
" LEFT OUTER JOIN mtb_depo_posizioni\n" +
" ON v.cod_mdep = mtb_depo_posizioni.cod_mdep\n" +
" AND v.posizione = mtb_depo_posizioni.posizione)\n" +
"\n" +
"SELECT qta_col,\n" +
" num_cnf,\n" +
" qta_cnf,\n" +
" gestione,\n" +
" data_collo,\n" +
" ser_collo,\n" +
" num_collo,\n" +
" cod_mdep,\n" +
" posizione,\n" +
" priorita,\n" +
" codGruppo,\n" +
" Gruppo,\n" +
" CodSgruppo,\n" +
" Sottogruppo,\n" +
" cod_mart,\n" +
" diacod,\n" +
" descrizione_estesa,\n" +
" partita_mag,\n" +
" cod_col,\n" +
" cod_tagl,\n" +
" cod_jcom,\n" +
" peso_netto_kg,\n" +
" peso_lordo_kg,\n" +
" cod_jfas,\n" +
" flag_qta_cnf_fissa,\n" +
" unt_mis,\n" +
" segno,\n" +
" barcode_ul,\n" +
" datetime_posizionamento\n" +
"FROM final_stock");
}
@Override
public void down() throws Exception {
}
}

View File

@@ -0,0 +1,26 @@
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_20250626142053 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
String reportNamePackingList = null;
if (isCustomer(IntegryCustomer.RossoGargano)) {
reportNamePackingList = "PackingListScarico";
}
createSetup("PVM", "CONTROLLO_GIACENZE", "REPORT_NAME_PACKING_LIST", reportNamePackingList, "Nome report per stampa packing list post trasferimento", "REPORT_NAME");
}
@Override
public void down() throws Exception {
}
}

View File

@@ -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_20250627184608 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
String value = null;
if (isCustomer(IntegryCustomer.RossoGargano)){
value = "ControlloGiacenzeSintetico";
}
createSetup("PVM","CONTROLLO_GIACENZE","REPORT_NAME_ELENCO_SINTETICO",value,"Report name per report giacenze sintetico da portale web","REPORT_NAME");
}
@Override
public void down() throws Exception {
}
}

View File

@@ -0,0 +1,174 @@
package it.integry.ems.migration.model;
import it.integry.ems.migration._base.BaseMigration;
import it.integry.ems.migration._base.MigrationModelInterface;
public class Migration_20250630164505 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
createOrUpdateView("mvw_sitart_udc_det_inventario", "CREATE VIEW [dbo].[mvw_sitart_udc_det_inventario] AS\n" +
"WITH baseMtbColr AS (SELECT c,\n" +
"\n" +
" ROUND(v.qta_col, cifre_dec) AS qta_col,\n" +
" ROUND(v.num_cnf, cifre_dec) AS num_cnf,\n" +
" IIF(flag_qta_cnf_fissa = 'S',\n" +
" v.qta_cnf_anag, v.qta_col / IIF(v.num_cnf = 0, 1, v.num_cnf)) AS qta_cnf,\n" +
" v.cod_mart,\n" +
" v.cod_col,\n" +
" v.cod_tagl,\n" +
" v.partita_mag,\n" +
" v.peso_netto_kg,\n" +
" v.peso_lordo_kg,\n" +
" mtb_colt.gestione,\n" +
" mtb_colt.data_collo,\n" +
" mtb_colt.ser_collo,\n" +
" mtb_colt.num_collo,\n" +
" v.cod_jcom,\n" +
" v.flag_qta_cnf_fissa,\n" +
" v.unt_mis,\n" +
" v.diacod,\n" +
" v.descrizione_estesa,\n" +
" v.cod_mgrp,\n" +
" mtb_grup.descrizione AS descrizione_gruppo,\n" +
" v.cod_msgr,\n" +
" mtb_sgrp.descrizione AS descrizione_sottogruppo,\n" +
" mtb_unt_mis.flag_dig,\n" +
" mtb_unt_mis.cifre_dec,\n" +
" mtb_colt.segno,\n" +
" v.cod_mdep,\n" +
" v.posizione,\n" +
" mtb_colt.cod_dtip,\n" +
" mtb_colt.cod_jfas,\n" +
" v.barcode_ul,\n" +
" v.qta_cnf_anag,\n" +
" MAX(mtb_colr.datetime_row) AS datetime_posizionamento\n" +
" FROM mvw_mtb_colr_with_giacenza v WITH (NOEXPAND)\n" +
" INNER JOIN mtb_colt\n" +
" ON v.barcode_ul = mtb_colt.barcode_ul\n" +
" LEFT OUTER JOIN mtb_colr ON\n" +
" v.barcode_ul = mtb_colr.barcode_ul_in AND\n" +
" v.cod_mart = mtb_colr.cod_mart AND\n" +
" ((v.partita_mag IS NULL AND mtb_colr.partita_mag IS NULL) OR\n" +
" (v.partita_mag = mtb_colr.partita_mag)) AND\n" +
" ((v.cod_col IS NULL AND mtb_colr.cod_col IS NULL) OR (v.cod_col = mtb_colr.cod_col)) AND\n" +
" ((v.cod_tagl IS NULL AND mtb_colr.cod_tagl IS NULL) OR (v.cod_tagl = mtb_colr.cod_tagl)) AND\n" +
" ((v.cod_jcom IS NULL AND mtb_colr.cod_jcom IS NULL) OR (v.cod_jcom = mtb_colr.cod_jcom)) AND\n" +
" ((v.posizione IS NULL AND mtb_colr.posizione_in IS NULL) OR (v.posizione = mtb_colr.posizione_in)) AND\n" +
" ((v.cod_mdep IS NULL AND mtb_colr.cod_mdep_in IS NULL) OR (v.cod_mdep = mtb_colr.cod_mdep_in)) AND\n" +
" ISNULL(mtb_colr.posizione_in, '') <> ISNULL(mtb_colr.posizione_out, '')\n" +
" INNER JOIN dbo.mtb_unt_mis ON v.unt_mis = mtb_unt_mis.unt_mis\n" +
"\n" +
" INNER JOIN dbo.mtb_grup ON v.cod_mgrp = mtb_grup.cod_mgrp\n" +
" INNER JOIN dbo.mtb_sgrp ON v.cod_mgrp = mtb_sgrp.cod_mgrp\n" +
" AND v.cod_msgr = mtb_sgrp.cod_msgr\n" +
" WHERE v.qta_col > 0\n" +
" AND (segno = 1 OR (segno = -1 AND cod_dtip IS NULL AND mtb_colt.gestione = 'V'))\n" +
" GROUP BY c,\n" +
" ROUND(v.qta_col, cifre_dec),\n" +
" ROUND(v.num_cnf, cifre_dec),\n" +
" IIF(flag_qta_cnf_fissa = 'S',\n" +
" v.qta_cnf_anag, v.qta_col / IIF(v.num_cnf = 0, 1, v.num_cnf)),\n" +
" v.cod_mart,\n" +
" v.cod_col,\n" +
" v.cod_tagl,\n" +
" v.partita_mag,\n" +
" v.peso_netto_kg,\n" +
" v.peso_lordo_kg,\n" +
" mtb_colt.gestione,\n" +
" mtb_colt.data_collo,\n" +
" mtb_colt.ser_collo,\n" +
" mtb_colt.num_collo,\n" +
" v.cod_jcom,\n" +
" v.flag_qta_cnf_fissa,\n" +
" v.unt_mis,\n" +
" v.diacod,\n" +
" v.descrizione_estesa,\n" +
" v.cod_mgrp,\n" +
" mtb_grup.descrizione,\n" +
" v.cod_msgr,\n" +
" mtb_sgrp.descrizione,\n" +
" mtb_unt_mis.flag_dig,\n" +
" mtb_unt_mis.cifre_dec,\n" +
" mtb_colt.segno,\n" +
" v.cod_mdep,\n" +
" v.posizione,\n" +
" mtb_colt.cod_dtip,\n" +
" mtb_colt.cod_jfas,\n" +
" v.barcode_ul,\n" +
" v.qta_cnf_anag),\n" +
" final_stock AS (SELECT v.qta_col,\n" +
" v.num_cnf,\n" +
" v.qta_cnf,\n" +
" v.gestione,\n" +
" v.data_collo,\n" +
" v.ser_collo,\n" +
" v.num_collo,\n" +
" v.cod_mdep AS cod_mdep,\n" +
" v.posizione AS posizione,\n" +
" mtb_depo_posizioni.priorita,\n" +
" v.cod_mgrp AS codGruppo,\n" +
" v.descrizione_gruppo AS Gruppo,\n" +
" v.cod_msgr AS CodSgruppo,\n" +
" v.descrizione_sottogruppo AS Sottogruppo,\n" +
" v.cod_mart,\n" +
" v.diacod,\n" +
" v.descrizione_estesa,\n" +
" v.partita_mag,\n" +
" v.cod_col,\n" +
" v.cod_tagl,\n" +
" v.cod_jcom,\n" +
" v.peso_netto_kg,\n" +
" v.peso_lordo_kg,\n" +
" v.cod_jfas,\n" +
" v.flag_qta_cnf_fissa,\n" +
" v.unt_mis,\n" +
" v.segno,\n" +
" v.barcode_ul,\n" +
" v.datetime_posizionamento\n" +
" FROM baseMtbColr v\n" +
"\n" +
" LEFT OUTER JOIN mtb_depo_posizioni\n" +
" ON v.cod_mdep = mtb_depo_posizioni.cod_mdep\n" +
" AND v.posizione = mtb_depo_posizioni.posizione)\n" +
"\n" +
"SELECT qta_col,\n" +
" num_cnf,\n" +
" qta_cnf,\n" +
" gestione,\n" +
" data_collo,\n" +
" ser_collo,\n" +
" num_collo,\n" +
" cod_mdep,\n" +
" posizione,\n" +
" priorita,\n" +
" codGruppo,\n" +
" Gruppo,\n" +
" CodSgruppo,\n" +
" Sottogruppo,\n" +
" cod_mart,\n" +
" diacod,\n" +
" descrizione_estesa,\n" +
" partita_mag,\n" +
" cod_col,\n" +
" cod_tagl,\n" +
" cod_jcom,\n" +
" peso_netto_kg,\n" +
" peso_lordo_kg,\n" +
" cod_jfas,\n" +
" flag_qta_cnf_fissa,\n" +
" unt_mis,\n" +
" segno,\n" +
" barcode_ul,\n" +
" datetime_posizionamento\n" +
"FROM final_stock");
}
@Override
public void down() throws Exception {
}
}

View File

@@ -0,0 +1,64 @@
package it.integry.ems.migration.model;
import it.integry.ems.migration._base.BaseMigration;
import it.integry.ems.migration._base.MigrationModelInterface;
public class Migration_20250714164813 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
createOrUpdateFunction("WMS_GetUltimeConsegneClienti", "CREATE FUNCTION [dbo].[WMS_GetUltimeConsegneClienti](@numConsegnePerClie INT, @codAnag VARCHAR(5), @codMart VARCHAR(15),\n" +
" @codMdep VARCHAR(5), @daysDiff INT)\n" +
"/*Funzione che restituisce le ultime consegne effettuate per conto di un cliente con possibilitÃÆÃ  di filtrare per articolo/deposito.\n" +
"Se il cliente non viene passato allora la funzione restituirÃÆÃ  le ultime consegne di tutti i clienti. */\n" +
" RETURNS TABLE AS RETURN\n" +
" SELECT DISTINCT *\n" +
" FROM (SELECT dtb_doct.cod_anag,\n" +
" DENSE_RANK() OVER (PARTITION BY dtb_doct.cod_anag ORDER BY dtb_doct.cod_anag ASC, dtb_doct.data_doc DESC, dtb_doct.num_doc) AS counter_consegna,\n" +
" dtb_doct.cod_dtip,\n" +
" dtb_doct.data_doc,\n" +
" dtb_doct.ser_doc,\n" +
" dtb_doct.num_doc,\n" +
" dtb_doct.compilato_da,\n" +
" dtb_doct.rif_ord,\n" +
" dtb_doct.data_ord,\n" +
" vtb_dest.destinatario,\n" +
" vtb_dest.indirizzo,\n" +
" dtb_doct.data_iniz_trasp\n" +
" FROM dtb_doct\n" +
" INNER JOIN dtb_docr ON dtb_doct.cod_anag = dtb_docr.cod_anag AND\n" +
" dtb_doct.cod_dtip = dtb_docr.cod_dtip AND\n" +
" dtb_doct.num_doc = dtb_docr.num_doc AND\n" +
" dtb_doct.data_doc = dtb_docr.data_doc AND\n" +
" dtb_doct.ser_doc = dtb_docr.ser_doc\n" +
" INNER JOIN dtb_tipi ON dtb_doct.cod_dtip = dtb_tipi.cod_dtip\n" +
" LEFT OUTER JOIN vtb_dest\n" +
" ON dtb_doct.cod_anag = vtb_dest.cod_anag\n" +
" AND dtb_doct.cod_vdes = vtb_dest.cod_vdes\n" +
"\n" +
" WHERE dtb_doct.gestione = 'V'\n" +
" AND dtb_tipi.tipo_emissione = 'DIRETTA'\n" +
" AND dtb_tipi.segno_qta_scar = 1\n" +
" AND DATEDIFF(DAY, dtb_doct.data_doc, GETDATE()) <= @daysDiff\n" +
"\n" +
"\n" +
" AND (@codMdep IS NULL\n" +
" OR dtb_doct.cod_mdep = @codMdep)\n" +
" AND (@codMart IS NULL\n" +
" OR dtb_docr.cod_mart = @codMart)\n" +
" AND (@codAnag IS NULL\n" +
" OR dtb_doct.cod_anag = @codAnag)) grouped_consegne\n" +
" WHERE @numConsegnePerClie IS NULL\n" +
" OR grouped_consegne.counter_consegna <= @numConsegnePerClie");
}
@Override
public void down() throws Exception {
}
}

View File

@@ -0,0 +1,66 @@
package it.integry.ems.migration.model;
import it.integry.ems.migration._base.BaseMigration;
import it.integry.ems.migration._base.MigrationModelInterface;
public class Migration_20250715110408 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
createOrUpdateFunction("WMS_GetUltimeConsegneClienti", "CREATE FUNCTION [dbo].[WMS_GetUltimeConsegneClienti](@numConsegnePerClie INT, @codAnag VARCHAR(5), @codVdes VARCHAR(5), @codMart VARCHAR(15),\n" +
" @codMdep VARCHAR(5), @daysDiff INT)\n" +
"/*Funzione che restituisce le ultime consegne effettuate per conto di un cliente con possibilitÃÆÃ  di filtrare per articolo/deposito.\n" +
"Se il cliente non viene passato allora la funzione restituirÃÆÃ  le ultime consegne di tutti i clienti. */\n" +
" RETURNS TABLE AS RETURN\n" +
" SELECT DISTINCT *\n" +
" FROM (SELECT dtb_doct.cod_anag,\n" +
" DENSE_RANK() OVER (PARTITION BY dtb_doct.cod_anag ORDER BY dtb_doct.cod_anag ASC, dtb_doct.data_doc DESC, dtb_doct.num_doc) AS counter_consegna,\n" +
" dtb_doct.cod_dtip,\n" +
" dtb_doct.data_doc,\n" +
" dtb_doct.ser_doc,\n" +
" dtb_doct.num_doc,\n" +
" dtb_doct.compilato_da,\n" +
" dtb_doct.rif_ord,\n" +
" dtb_doct.data_ord,\n" +
" vtb_dest.destinatario,\n" +
" vtb_dest.indirizzo,\n" +
" dtb_doct.data_iniz_trasp\n" +
" FROM dtb_doct\n" +
" INNER JOIN dtb_docr ON dtb_doct.cod_anag = dtb_docr.cod_anag AND\n" +
" dtb_doct.cod_dtip = dtb_docr.cod_dtip AND\n" +
" dtb_doct.num_doc = dtb_docr.num_doc AND\n" +
" dtb_doct.data_doc = dtb_docr.data_doc AND\n" +
" dtb_doct.ser_doc = dtb_docr.ser_doc\n" +
" INNER JOIN dtb_tipi ON dtb_doct.cod_dtip = dtb_tipi.cod_dtip\n" +
" LEFT OUTER JOIN vtb_dest\n" +
" ON dtb_doct.cod_anag = vtb_dest.cod_anag\n" +
" AND dtb_doct.cod_vdes = vtb_dest.cod_vdes\n" +
"\n" +
" WHERE dtb_doct.gestione = 'V'\n" +
" AND dtb_tipi.tipo_emissione = 'DIRETTA'\n" +
" AND dtb_tipi.segno_qta_scar = 1\n" +
" AND DATEDIFF(DAY, dtb_doct.data_doc, GETDATE()) <= @daysDiff\n" +
"\n" +
"\n" +
" AND (@codMdep IS NULL\n" +
" OR dtb_doct.cod_mdep = @codMdep)\n" +
" AND (@codMart IS NULL\n" +
" OR dtb_docr.cod_mart = @codMart)\n" +
" AND (@codAnag IS NULL\n" +
" OR dtb_doct.cod_anag = @codAnag)\n" +
" AND (@codVdes IS NULL\n" +
" OR dtb_doct.cod_vdes = @codVdes)) grouped_consegne\n" +
" WHERE @numConsegnePerClie IS NULL\n" +
" OR grouped_consegne.counter_consegna <= @numConsegnePerClie");
}
@Override
public void down() throws Exception {
}
}

View File

@@ -0,0 +1,25 @@
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_20250728095637 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
executeStatement("alter table dbo.atb_tipi add socio_aziendale BIT default 0 not null");
if (isCustomer(IntegryCustomer.RossoGargano)) {
executeStatement("UPDATE dbo.atb_tipi SET socio_aziendale = 1 where cod_atip in (N'C1050', N'C1055')");
}
}
@Override
public void down() throws Exception {
}
}

View File

@@ -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_20250728125101 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
String reportNameScar = null;
String reportNameLav = null;
if (isCustomer(IntegryCustomer.RossoGargano)) {
reportNameScar = "ReportScaricoProdotto";
reportNameLav = "RiepilogoLavorazioniMateriaPrimaGrezza";
}
createSetup("PVM","PIAN_ACC_ROSSG","REPORT_NAME_RIEP_SCARICO_PRODOTTO",reportNameScar,"Nome report stampa riepilogo scarico prodotti (da tab omonima in pagina accettazione da campo)","REPORT_NAME");
createSetup("PVM","PIAN_ACC_ROSSG","REPORT_NAME_RIEP_LAV_MATERIALE",reportNameLav,"Nome report stampa riepilogo lavorazioni del giorno (da tab Laborazioni in pagina accettazione da campo)","REPORT_NAME");
}
@Override
public void down() throws Exception {
}
}

View File

@@ -1,7 +1,7 @@
package it.integry.ems.migration.model; package it.integry.ems.migration.model;
import it.integry.ems.migration._base.BaseMigration; 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; import it.integry.ems.migration._base.MigrationModelInterface;
public class Migration_20250909162127 extends BaseMigration implements MigrationModelInterface { public class Migration_20250909162127 extends BaseMigration implements MigrationModelInterface {
@@ -10,7 +10,8 @@ public class Migration_20250909162127 extends BaseMigration implements Migration
public void up() throws Exception { public void up() throws Exception {
if (isHistoryDB()) if (isHistoryDB())
return; return;
if (!isCustomer(IntegryCustomer.Biolevante))
if (!isCustomerDb(IntegryCustomerDB.Biolevante_Biolevante))
return; return;
executeStatement( executeStatement(

View File

@@ -0,0 +1,55 @@
package it.integry.ems.migration.model;
import it.integry.ems.migration._base.BaseMigration;
import it.integry.ems.migration._base.MigrationModelInterface;
public class Migration_20250925103840 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
String sqlCreateMaster = "CREATE TABLE dbo.mtb_missione_mag_auto\n" +
"(\n" +
" id BIGINT IDENTITY\n" +
" CONSTRAINT mtb_missione_mag_auto_pk\n" +
" PRIMARY KEY,\n" +
" cod_mdep VARCHAR(5) NOT NULL,\n" +
" cod_area VARCHAR(15) NOT NULL,\n" +
" CONSTRAINT table_name_mtb_depo_area_cod_area_cod_mdep_fk\n" +
" FOREIGN KEY (cod_mdep, cod_area) REFERENCES dbo.mtb_depo_area (cod_mdep, cod_area),\n" +
" created_by VARCHAR(40) NOT NULL\n" +
" CONSTRAINT mtb_missione_mag_auto_stb_user_user_name_fk\n" +
" REFERENCES dbo.stb_user,\n" +
" created_at DATETIME DEFAULT GETDATE() NOT NULL\n" +
")";
String sqlCreateDetail = "CREATE TABLE dbo.mtb_missione_mag_auto_det\n" +
"(\n" +
" id BIGINT IDENTITY\n" +
" CONSTRAINT mtb_missione_mag_auto_det_pk\n" +
" PRIMARY KEY,\n" +
" parent_id BIGINT NOT NULL\n" +
" CONSTRAINT mtb_missione_mag_auto_det_mtb_missione_mag_auto_id_fk\n" +
" REFERENCES dbo.mtb_missione_mag_auto (id),\n" +
" sscc VARCHAR(18),\n" +
" posizione_in VARCHAR(40),\n" +
" posizione_out VARCHAR(40),\n" +
" error_message VARCHAR(MAX),\n" +
" completed BIT DEFAULT 0 NOT NULL,\n" +
" skipped BIT DEFAULT 0 NOT NULL,\n" +
" started_at DATETIME,\n" +
" ended_at DATETIME,\n" +
" created_at DATETIME DEFAULT GETDATE(),\n" +
" updated_at DATETIME DEFAULT GETDATE() NOT NULL\n" +
")";
executeStatement(sqlCreateMaster, sqlCreateDetail);
}
@Override
public void down() throws Exception {
}
}

View File

@@ -0,0 +1,19 @@
package it.integry.ems.migration.model;
import it.integry.ems.migration._base.BaseMigration;
import it.integry.ems.migration._base.MigrationModelInterface;
public class Migration_20251015111009 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
executeStatement("alter table dbo.dtb_ord_steps add posizione_out varchar(40)");
}
@Override
public void down() throws Exception {
}
}

View File

@@ -0,0 +1,610 @@
package it.integry.ems.migration.model;
import it.integry.ems.migration._base.BaseMigration;
import it.integry.ems.migration._base.MigrationModelInterface;
public class Migration_20251015111701 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
createOrUpdateFunction("MES_GetWorkOrders", "CREATE FUNCTION [dbo].[MES_GetWorkOrders](@codJfas VARCHAR(50), @dateStart DATE, @dateEnd DATE, @flagEvaso VARCHAR(1),\n" +
" @codAnag VARCHAR(5))\n" +
" RETURNS TABLE\n" +
" AS RETURN\n" +
" -- DECLARE @codJfas VARCHAR(5) = 'L1'\n" +
" -- DECLARE @dateStart DATE = DATEADD(MONTH, -1, GETDATE())\n" +
" -- DECLARE @dateEnd DATE = DATEADD(MONTH, 1, GETDATE())\n" +
" -- DECLARE @flagEvaso VARCHAR(1) = 'I'\n" +
" -- DECLARE @codAnag VARCHAR(5) = null;\n" +
"\n" +
"--Funzione per calcolare la sequenza di ordini su una linea e il RunTimeEND\n" +
" WITH setup AS (SELECT ISNULL(@dateStart, DATEADD(DAY, -14, GETDATE())) AS date_start,\n" +
" ISNULL(@dateEnd, GETDATE()) AS date_end,\n" +
" ISNULL(@flagEvaso, 'I') AS flag_evaso,\n" +
" @codJfas AS cod_jfas,\n" +
" @codAnag AS cod_anag),\n" +
"\n" +
" setup_depo AS (SELECT cod_mdep, value AS flag_carico_scarico_immediato\n" +
" FROM stb_gest_setup_depo\n" +
" WHERE gest_name = 'CARICO_SCARICO_PF'\n" +
" AND section = 'SETUP'\n" +
" AND key_section = 'GENERA_CARICO_SCARICO_IMMEDIATO'),\n" +
"\n" +
" setup_run_time AS (SELECT value AS flag_restart\n" +
" FROM stb_gest_setup\n" +
" WHERE gest_name = 'PVM'\n" +
" AND section = 'MONITORAGGIO_LINEE_V2'\n" +
" AND key_section = 'RESTART_RUN_TIME_END'),\n" +
"\n" +
" mtb_colr_sum_filtered_rows AS (SELECT gestione,\n" +
" data_collo,\n" +
" num_collo,\n" +
" ser_collo,\n" +
" cod_mart,\n" +
" data_ord,\n" +
" num_ord,\n" +
" qta_col,\n" +
" num_cnf\n" +
" FROM mtb_colr\n" +
" WHERE gestione_rif IS NULL\n" +
" AND data_collo_rif IS NULL\n" +
" AND ser_collo_rif IS NULL\n" +
" AND num_collo_rif IS NULL),\n" +
"\n" +
" mtb_colr_sum_valid_colli AS (SELECT DISTINCT gestione,\n" +
" data_collo,\n" +
" ser_collo,\n" +
" num_collo\n" +
" FROM mtb_colt\n" +
" CROSS APPLY setup\n" +
" WHERE segno = 1\n" +
" AND data_ord BETWEEN setup.date_start AND setup.date_end),\n" +
"\n" +
" mtb_colr_sum AS (SELECT colr.gestione,\n" +
" colr.data_collo,\n" +
" colr.num_collo,\n" +
" colr.ser_collo,\n" +
" colr.cod_mart,\n" +
" colr.data_ord,\n" +
" colr.num_ord,\n" +
" SUM(colr.qta_col) AS qta_col,\n" +
" SUM(colr.num_cnf) AS num_cnf\n" +
" FROM mtb_colr_sum_valid_colli colt\n" +
" INNER JOIN mtb_colr_sum_filtered_rows colr\n" +
" ON colr.gestione = colt.gestione\n" +
" AND colr.data_collo = colt.data_collo\n" +
" AND colr.num_collo = colt.num_collo\n" +
" AND colr.ser_collo = colt.ser_collo\n" +
" GROUP BY colr.gestione,\n" +
" colr.data_collo,\n" +
" colr.num_collo,\n" +
" colr.ser_collo,\n" +
" colr.cod_mart,\n" +
" colr.data_ord,\n" +
" colr.num_ord),\n" +
"\n" +
" machine_last_event AS (SELECT gestione,\n" +
" data_ord,\n" +
" num_ord,\n" +
" cod_cmac,\n" +
" MAX(data_mov) AS max_data_mov\n" +
" FROM dtb_ord_macc\n" +
" GROUP BY gestione, data_ord, num_ord, cod_cmac),\n" +
"\n" +
" machine_event_values AS (SELECT evento,\n" +
" IIF(tipologia = 'ENTRATA', 1, -1) AS value\n" +
" FROM dtb_ord_macc_eventi),\n" +
"\n" +
" in_production_machines AS (SELECT dtb.gestione,\n" +
" dtb.data_ord,\n" +
" dtb.num_ord,\n" +
" LAST_VALUE(dtb.data_mov) OVER (ORDER BY dtb.gestione,\n" +
" dtb.data_ord,\n" +
" dtb.num_ord) AS max_data_mov,\n" +
" LAST_VALUE(ev.value) OVER (ORDER BY dtb.gestione,\n" +
" dtb.data_ord,\n" +
" dtb.num_ord) AS final_value\n" +
" FROM dtb_ord_macc dtb\n" +
" INNER JOIN machine_last_event le\n" +
" ON dtb.data_ord = le.data_ord\n" +
" AND dtb.num_ord = le.num_ord\n" +
" AND dtb.gestione = le.gestione\n" +
" AND dtb.cod_cmac = le.cod_cmac\n" +
" AND dtb.data_mov = le.max_data_mov\n" +
" INNER JOIN machine_event_values ev\n" +
" ON dtb.evento = ev.evento\n" +
" CROSS APPLY setup\n" +
" WHERE dtb.data_ord BETWEEN setup.date_start AND setup.date_end),\n" +
"\n" +
" dtb_ord_with_max_step AS (SELECT gestione,\n" +
" data_ord,\n" +
" num_ord,\n" +
" id_step AS id_step,\n" +
" MAX(id_step) OVER (PARTITION BY gestione,\n" +
" data_ord,\n" +
" num_ord,\n" +
" dtb_ord_steps.cod_jfas,\n" +
" dtb_ord_steps.num_fase) AS max_id_step,\n" +
" num_fase,\n" +
" MAX(num_fase) OVER (PARTITION BY gestione,\n" +
" data_ord,\n" +
" num_ord) AS max_fase,\n" +
" dtb_ord_steps.cod_jfas,\n" +
" dtb_ord_steps.flag_step_attivo,\n" +
" dtb_ord_steps.data_iniz,\n" +
" dtb_ord_steps.data_fine,\n" +
" dtb_ord_steps.qta_lav,\n" +
" dtb_ord_steps.qta_prod,\n" +
" dtb_ord_steps.hr_num,\n" +
" dtb_ord_steps.posizione_out,\n" +
" dtb_ord_steps.descrizione_attivita,\n" +
" SUM(CAST(DATEDIFF(S, data_iniz, ISNULL(data_fine, GETDATE())) AS BIGINT))\n" +
" OVER (PARTITION BY gestione,\n" +
" data_ord,\n" +
" num_ord,\n" +
" num_fase,\n" +
" dtb_ord_steps.cod_jfas) AS elapsed_time\n" +
" FROM dtb_ord_steps\n" +
" CROSS APPLY setup\n" +
" WHERE data_ord BETWEEN setup.date_start AND setup.date_end\n" +
" AND gestione = 'L'),\n" +
"\n" +
" dtb_ord_max_step AS (SELECT DISTINCT IIF(in_production_machines.max_data_mov IS NOT NULL AND\n" +
" (dtb_ord_with_max_step.id_step = 0 OR\n" +
" (dtb_ord_with_max_step.id_step > 0 AND\n" +
" dtb_ord_with_max_step.data_fine IS NOT NULL AND\n" +
" DATEDIFF(MINUTE,\n" +
" dtb_ord_with_max_step.data_fine,\n" +
" in_production_machines.max_data_mov) >\n" +
" 5)), 1, 0) AS starting_machines,\n" +
" dtb_ord_with_max_step.*\n" +
" FROM dtb_ord_with_max_step\n" +
" LEFT OUTER JOIN in_production_machines\n" +
" ON dtb_ord_with_max_step.data_ord =\n" +
" in_production_machines.data_ord\n" +
" AND\n" +
" dtb_ord_with_max_step.num_ord =\n" +
" in_production_machines.num_ord\n" +
" AND\n" +
" dtb_ord_with_max_step.gestione =\n" +
" in_production_machines.gestione\n" +
" AND in_production_machines.final_value = 1\n" +
"\n" +
" WHERE max_id_step = id_step),\n" +
"\n" +
" riga_ord_prod_w_materia_prima AS (SELECT dtb_ordr.data_ord AS data_ord_prod,\n" +
" dtb_ordr.num_ord AS num_ord_prod,\n" +
" dtb_ordr.riga_ord AS riga_ord_prod,\n" +
" dtb_ordr.gestione AS gestione_ord_prod,\n" +
" IIF(CONVERT(DATE, dtb_ordr.data_ord) >= CONVERT(DATE, GETDATE()),\n" +
" 'S',\n" +
" 'N') AS flag_avviabile,\n" +
" mtb_aart_prod.flag_tracciabilita,\n" +
" dtb_ordr.unt_ord,\n" +
" dtb_ordr.rap_conv,\n" +
" dtb_ordr.unt_ord2,\n" +
" CAST(ROUND(dtb_ordr.qta_ord2 /\n" +
" ISNULL(NULLIF(dtb_ordr.qta_ord, 0), 1),\n" +
" 5) AS NUMERIC(20, 5)) AS rap_conv2,\n" +
" dtb_ordr.unt_ord3,\n" +
" CAST(ROUND(dtb_ordr.qta_ord3 /\n" +
" ISNULL(NULLIF(dtb_ordr.qta_ord, 0), 1),\n" +
" 5) AS NUMERIC(20, 5)) AS rap_conv3,\n" +
" dtb_ordr.qta_ord,\n" +
" dtb_ordr.qta_ord2,\n" +
" dtb_ordr.qta_ord3,\n" +
" dtb_ordr.num_cnf,\n" +
" IIF(mtb_aart_prod.unt_mis IN ('PZ', 'NR'), mtb_aart_prod.qta_cnf,\n" +
" IIF(mtb_aart_prod.unt_mis2 IN ('PZ', 'NR'),\n" +
" mtb_aart_prod.qta_cnf /\n" +
" ISNULL(NULLIF(mtb_aart_prod.rap_conv2, 0), 1),\n" +
" mtb_aart_prod.qta_cnf)) AS cal_qta_cnf,\n" +
" IIF(dtb_ordr.colli_pedana = 0 OR dtb_ordr.colli_pedana = 1,\n" +
" IIF(mtb_aart_prod.colli_pedana = 0, 1, mtb_aart_prod.colli_pedana),\n" +
" dtb_ordr.colli_pedana)\n" +
" AS colli_pedana,\n" +
" dtb_ordr.pos_riga,\n" +
" dtb_ordr.cod_mdep,\n" +
"\n" +
" IIF(mtb_aart_prod.unt_mis IN ('PZ', 'NR'), 1,\n" +
" IIF(mtb_aart_prod.unt_mis2 IN ('PZ', 'NR') AND\n" +
" NULLIF(mtb_aart_prod.rap_conv2, 0) IS NOT NULL,\n" +
" mtb_aart_prod.rap_conv2,\n" +
" 1)) AS calc_rap_conv,\n" +
" mtb_aart_prod.gg_scad_partita,\n" +
" mtb_aart_prod.qta_cnf\n" +
" FROM dtb_ordr\n" +
" INNER JOIN mtb_aart mtb_aart_prod ON mtb_aart_prod.cod_mart = dtb_ordr.cod_mart\n" +
" WHERE dtb_ordr.gestione = 'A'),\n" +
"\n" +
" ord_lav AS (SELECT dtb_ordt.cod_jcom,\n" +
" riga_ord_prod_w_materia_prima.data_ord_prod,\n" +
" riga_ord_prod_w_materia_prima.num_ord_prod,\n" +
" riga_ord_prod_w_materia_prima.riga_ord_prod,\n" +
" riga_ord_prod_w_materia_prima.flag_avviabile,\n" +
" riga_ord_prod_w_materia_prima.flag_tracciabilita,\n" +
" riga_ord_prod_w_materia_prima.unt_ord,\n" +
" CASE\n" +
" WHEN mtb_partita_mag.partita_mag IS NULL THEN\n" +
" riga_ord_prod_w_materia_prima.rap_conv\n" +
" ELSE CASE\n" +
" WHEN riga_ord_prod_w_materia_prima.unt_ord = mtb_aart.unt_mis THEN\n" +
" riga_ord_prod_w_materia_prima.rap_conv\n" +
" WHEN riga_ord_prod_w_materia_prima.unt_ord = mtb_aart.unt_mis2 THEN\n" +
" IIF(mtb_partita_mag.rap_conv2 IS NULL OR mtb_partita_mag.rap_conv2 = 0,\n" +
" riga_ord_prod_w_materia_prima.rap_conv2, mtb_partita_mag.rap_conv2)\n" +
" WHEN riga_ord_prod_w_materia_prima.unt_ord = mtb_aart.unt_mis3 THEN\n" +
" IIF(mtb_partita_mag.rap_conv3 IS NULL OR mtb_partita_mag.rap_conv3 = 0,\n" +
" riga_ord_prod_w_materia_prima.rap_conv3, mtb_partita_mag.rap_conv3)\n" +
" END\n" +
" END\n" +
" AS rap_conv,\n" +
" riga_ord_prod_w_materia_prima.unt_ord2,\n" +
" CASE\n" +
" WHEN mtb_partita_mag.partita_mag IS NULL THEN\n" +
" riga_ord_prod_w_materia_prima.rap_conv2\n" +
" ELSE CASE\n" +
" WHEN riga_ord_prod_w_materia_prima.unt_ord2 = mtb_aart.unt_mis THEN\n" +
" riga_ord_prod_w_materia_prima.rap_conv2\n" +
" WHEN riga_ord_prod_w_materia_prima.unt_ord2 = mtb_aart.unt_mis2 THEN\n" +
" IIF(mtb_partita_mag.rap_conv2 IS NULL OR mtb_partita_mag.rap_conv2 = 0,\n" +
" riga_ord_prod_w_materia_prima.rap_conv2, mtb_partita_mag.rap_conv2)\n" +
" WHEN riga_ord_prod_w_materia_prima.unt_ord2 = mtb_aart.unt_mis3 THEN\n" +
" IIF(mtb_partita_mag.rap_conv3 IS NULL OR mtb_partita_mag.rap_conv3 = 0,\n" +
" riga_ord_prod_w_materia_prima.rap_conv3, mtb_partita_mag.rap_conv3)\n" +
" END\n" +
" END\n" +
" AS rap_conv2,\n" +
" riga_ord_prod_w_materia_prima.unt_ord3,\n" +
" CASE\n" +
" WHEN mtb_partita_mag.partita_mag IS NULL THEN\n" +
" riga_ord_prod_w_materia_prima.rap_conv3\n" +
" ELSE CASE\n" +
" WHEN riga_ord_prod_w_materia_prima.unt_ord3 = mtb_aart.unt_mis THEN\n" +
" riga_ord_prod_w_materia_prima.rap_conv3\n" +
" WHEN riga_ord_prod_w_materia_prima.unt_ord3 = mtb_aart.unt_mis2 THEN\n" +
" IIF(mtb_partita_mag.rap_conv2 IS NULL OR mtb_partita_mag.rap_conv2 = 0,\n" +
" riga_ord_prod_w_materia_prima.rap_conv2, mtb_partita_mag.rap_conv2)\n" +
" WHEN riga_ord_prod_w_materia_prima.unt_ord3 = mtb_aart.unt_mis3 THEN\n" +
" IIF(mtb_partita_mag.rap_conv3 IS NULL OR mtb_partita_mag.rap_conv3 = 0,\n" +
" riga_ord_prod_w_materia_prima.rap_conv3, mtb_partita_mag.rap_conv3)\n" +
" END\n" +
" END\n" +
" AS rap_conv3,\n" +
" ISNULL(dtb_ordt.descr_estesa_prod, dtb_ordt.descrizione_prod) AS descrizione_prod,\n" +
" riga_ord_prod_w_materia_prima.num_cnf *\n" +
" riga_ord_prod_w_materia_prima.cal_qta_cnf AS num_pezzi,\n" +
" riga_ord_prod_w_materia_prima.num_cnf,\n" +
" riga_ord_prod_w_materia_prima.gg_scad_partita,\n" +
" riga_ord_prod_w_materia_prima.qta_cnf,\n" +
" riga_ord_prod_w_materia_prima.colli_pedana,\n" +
" riga_ord_prod_w_materia_prima.num_cnf /\n" +
" riga_ord_prod_w_materia_prima.colli_pedana AS num_pedane,\n" +
" riga_ord_prod_w_materia_prima.pos_riga,\n" +
" dtb_ordt.flag_evaso_prod,\n" +
" dtb_ordt.flag_evaso_forzato,\n" +
" CASE\n" +
" WHEN (dtb_ordt.flag_evaso_prod = 'I' OR\n" +
" (setupCaricoImmediato.flag_carico_scarico_immediato = 'S' AND\n" +
" flag_evaso_prod = 'E'))\n" +
" AND dtb_ordt.flag_evaso_forzato = 'N'\n" +
" THEN 'I'\n" +
" WHEN flag_evaso_prod <> 'I' AND dtb_ordt.flag_evaso_forzato = 'S'\n" +
" THEN flag_evaso_prod\n" +
" END AS flag_ordine_evaso,\n" +
" dtb_ordt.gestione,\n" +
" dtb_ordt.data_ord,\n" +
" dtb_ordt.cod_tcol_UL,\n" +
" mtb_tcol.descrizione AS descrizione_tcol,\n" +
" dtb_ordt.cod_anag,\n" +
" gtb_anag.rag_soc AS rag_soc_anag,\n" +
" gtb_anag.part_iva,\n" +
" dtb_ordt.rif_ord,\n" +
" dtb_ordt.cod_vdes,\n" +
" dtb_ordt.cod_mdep,\n" +
" ISNULL(riga_ord_prod_w_materia_prima.cod_mdep, dtb_ordt.cod_mdep) AS cod_mdep_prod,\n" +
" dtb_ordt.num_ord,\n" +
" dtb_ord_steps.cod_jfas,\n" +
" dtb_ordt.cod_jfas AS cod_jfas_lav,\n" +
" mtb_partita_mag.partita_mag,\n" +
" ISNULL(mtb_partita_mag.partita_mag_prod,\n" +
" mtb_partita_mag.partita_mag) AS partita_mag_prod,\n" +
" dtb_ordt.note AS note_lav,\n" +
" mtb_partita_mag.data_scad,\n" +
" dtb_ordt.cod_prod,\n" +
" jtb_comt.descrizione AS descrizione_commessa,\n" +
" dtb_ordt.data_iniz_prod,\n" +
" dtb_ord_steps.id_step,\n" +
" dtb_ord_steps.max_fase,\n" +
" dtb_ord_steps.num_fase,\n" +
" IIF(mtb_aart.flag_qta_cnf_fissa = 'S' AND\n" +
" (mtb_aart.qta_cnf > 1 OR riga_ord_prod_w_materia_prima.colli_pedana > 1), 'Colli',\n" +
" jtb_cicl.unt_mis_prod)\n" +
" AS unt_mis_prod,\n" +
" IIF(mtb_aart.flag_qta_cnf_fissa = 'S' AND\n" +
" (mtb_aart.qta_cnf > 1 OR riga_ord_prod_w_materia_prima.colli_pedana > 1),\n" +
" riga_ord_prod_w_materia_prima.colli_pedana, jtb_cicl.qta_prod)\n" +
" AS qta_batch_prod,\n" +
" IIF(mtb_aart.qta_cnf > 1 OR riga_ord_prod_w_materia_prima.colli_pedana > 1,\n" +
" mtb_aart.qta_cnf,\n" +
" jtb_cicl.rap_conv_prod) AS rap_conv_prod,\n" +
" dtb_ord_steps.data_iniz,\n" +
" dtb_ord_steps.data_fine,\n" +
" dtb_ord_steps.qta_lav AS qta_lav,\n" +
" IIF(dtb_ord_steps.qta_prod <> 0, dtb_ord_steps.qta_prod,\n" +
" dtb_ordt.qta_prod) AS qta_prod,\n" +
" dtb_ord_steps.hr_num,\n" +
" dtb_ord_steps.descrizione_attivita,\n" +
" dtb_ord_steps.posizione_out,\n" +
" 3600 / (ISNULL(NULLIF(jtb_dist_clav_dir.duration, 0), 1) /\n" +
" ISNULL(NULLIF(jtb_cicl.rap_conv_prod, 0), 1)) AS prod_std,\n" +
" dtb_ord_steps.elapsed_time,\n" +
" SUM(ISNULL(mtb_colr_carico.qta_col, 0)) AS qta_trasferite,\n" +
" COUNT(mtb_colr_carico.num_collo) AS udc_trasferiti,\n" +
" COUNT(colli_lotto.num_collo) AS uds_scaricati,\n" +
" CASE\n" +
" WHEN dtb_ord_steps.id_step = 0\n" +
" THEN IIF(dtb_ord_steps.starting_machines = 1, 'IN AVVIO', 'PROGRAMMATO')\n" +
" WHEN dtb_ord_steps.data_fine IS NULL\n" +
" THEN 'IN CORSO'\n" +
" ELSE 'IN PAUSA'\n" +
" END AS stato,\n" +
" CONVERT(INT, SUM(ISNULL(\n" +
" mtb_colr_carico.qta_col / riga_ord_prod_w_materia_prima.calc_rap_conv,\n" +
" 0))) AS pz_trasferiti,\n" +
" CASE\n" +
" WHEN (jtb_dist_clav_dir.duration / ISNULL(NULLIF(jtb_cicl.rap_conv_prod, 0), 1)) *\n" +
" (dtb_ordt.qta_prod * dtb_ordt.rap_conv_prod -\n" +
" SUM(ISNULL(mtb_colr_carico.qta_col, 0))) > 0\n" +
" THEN\n" +
" (jtb_dist_clav_dir.duration /\n" +
" ISNULL(NULLIF(jtb_cicl.rap_conv_prod, 0), 1)) *\n" +
" (dtb_ordt.qta_prod * dtb_ordt.rap_conv_prod -\n" +
" SUM(ISNULL(mtb_colr_carico.qta_col, 0)))\n" +
" ELSE 0 END AS run_time_sec,\n" +
" jl.id_lotto,\n" +
" jlt.data_lotto,\n" +
" mtb_aart.peso_kg,\n" +
" dtb_ordt.data_cons_prod_max\n" +
" FROM dtb_ord_max_step dtb_ord_steps\n" +
" INNER JOIN dtb_ordt ON dtb_ord_steps.data_ord = dtb_ordt.data_ord\n" +
" AND dtb_ord_steps.num_ord = dtb_ordt.num_ord\n" +
" AND dtb_ord_steps.gestione = dtb_ordt.gestione\n" +
" LEFT OUTER JOIN setup_depo setupCaricoImmediato\n" +
" ON dtb_ordt.cod_mdep = setupCaricoImmediato.cod_mdep\n" +
" LEFT OUTER JOIN jtb_dist_clav_dir\n" +
" ON dtb_ordt.cod_prod = jtb_dist_clav_dir.cod_prod AND\n" +
" dtb_ordt.cod_jfas = jtb_dist_clav_dir.cod_jfas\n" +
" LEFT OUTER JOIN mtb_partita_mag\n" +
" ON dtb_ordt.partita_mag = mtb_partita_mag.partita_mag AND\n" +
" dtb_ordt.cod_prod = mtb_partita_mag.cod_mart AND\n" +
" mtb_partita_mag.flag_stato = 'A'\n" +
" LEFT OUTER JOIN mtb_colr_sum mtb_colr_carico\n" +
" ON dtb_ordt.data_ord = mtb_colr_carico.data_ord AND\n" +
" dtb_ordt.gestione = mtb_colr_carico.gestione AND\n" +
" dtb_ordt.num_ord = mtb_colr_carico.num_ord AND\n" +
" dtb_ordt.cod_prod = mtb_colr_carico.cod_mart\n" +
" LEFT OUTER JOIN jtb_comt ON dtb_ordt.cod_jcom = jtb_comt.cod_jcom\n" +
" LEFT OUTER JOIN riga_ord_prod_w_materia_prima\n" +
" ON riga_ord_prod_w_materia_prima.gestione_ord_prod =\n" +
" dtb_ordt.gestione_rif AND\n" +
" riga_ord_prod_w_materia_prima.data_ord_prod =\n" +
" dtb_ordt.data_ord_rif AND\n" +
" riga_ord_prod_w_materia_prima.num_ord_prod =\n" +
" dtb_ordt.num_ord_rif AND\n" +
" riga_ord_prod_w_materia_prima.riga_ord_prod = dtb_ordt.riga_ord_rif\n" +
" LEFT OUTER JOIN jtb_cicl ON jtb_cicl.cod_prod = dtb_ordt.cod_prod\n" +
" LEFT OUTER JOIN mtb_aart ON mtb_aart.cod_mart = dtb_ordt.cod_prod\n" +
" LEFT OUTER JOIN gtb_anag ON dtb_ordt.cod_anag = gtb_anag.cod_anag\n" +
" LEFT OUTER JOIN mtb_tcol ON dtb_ordt.cod_tcol_UL = mtb_tcol.cod_tcol\n" +
" LEFT OUTER JOIN jtb_lotr jl\n" +
" ON dtb_ord_steps.cod_jfas = jl.cod_jfas AND\n" +
" dtb_ordt.gestione = jl.gestione AND\n" +
" dtb_ordt.data_ord = jl.data_ord AND\n" +
" dtb_ordt.num_ord = jl.num_ord\n" +
" LEFT OUTER JOIN jtb_lott jlt\n" +
" ON jl.cod_jfas = jlt.cod_jfas AND jl.id_lotto = jlt.id_lotto\n" +
" LEFT OUTER JOIN mtb_colt colli_lotto ON jlt.id_lotto = colli_lotto.id_lotto\n" +
"\n" +
" CROSS APPLY setup\n" +
" WHERE dtb_ordt.flag_annulla = 'N'\n" +
" AND dtb_ord_steps.data_ord BETWEEN setup.date_start AND setup.date_end\n" +
" AND (setup.flag_evaso IS NULL\n" +
" OR (\n" +
" (setup.flag_evaso = 'I'\n" +
" AND\n" +
" dtb_ord_steps.flag_step_attivo = 'S'\n" +
" AND (flag_evaso_prod = 'I'\n" +
" OR\n" +
" (setupCaricoImmediato.flag_carico_scarico_immediato = 'S'\n" +
" AND\n" +
" flag_evaso_prod = 'E'))\n" +
" AND dtb_ordt.flag_evaso_forzato = 'N'\n" +
" )\n" +
" OR (setup.flag_evaso = 'E'\n" +
" AND (flag_evaso_prod = 'E' OR jlt.data_chiusura IS NOT NULL)\n" +
" AND dtb_ordt.flag_evaso_forzato = 'S')\n" +
" )\n" +
" )\n" +
" AND (setup.cod_jfas IS NULL\n" +
" OR dtb_ord_steps.cod_jfas = setup.cod_jfas)\n" +
" AND (setup.cod_anag IS NULL\n" +
" OR dtb_ordt.cod_anag = setup.cod_anag)\n" +
" GROUP BY riga_ord_prod_w_materia_prima.data_ord_prod,\n" +
" riga_ord_prod_w_materia_prima.num_ord_prod,\n" +
" riga_ord_prod_w_materia_prima.riga_ord_prod,\n" +
" riga_ord_prod_w_materia_prima.flag_avviabile,\n" +
" riga_ord_prod_w_materia_prima.flag_tracciabilita,\n" +
" riga_ord_prod_w_materia_prima.unt_ord,\n" +
" mtb_partita_mag.rap_conv2,\n" +
" mtb_partita_mag.rap_conv3,\n" +
" dtb_ordt.note,\n" +
" riga_ord_prod_w_materia_prima.rap_conv,\n" +
" dtb_ordt.descrizione_prod,\n" +
" dtb_ordt.descr_estesa_prod,\n" +
" riga_ord_prod_w_materia_prima.num_cnf,\n" +
" mtb_aart.qta_cnf,\n" +
" mtb_aart.gg_scad_partita,\n" +
" mtb_aart.flag_qta_cnf_fissa,\n" +
" riga_ord_prod_w_materia_prima.pos_riga,\n" +
" dtb_ordt.flag_evaso_prod,\n" +
" dtb_ordt.flag_evaso_forzato,\n" +
" dtb_ordt.gestione,\n" +
" dtb_ordt.data_ord,\n" +
" dtb_ordt.num_ord,\n" +
" dtb_ord_steps.cod_jfas,\n" +
" dtb_ordt.cod_jfas,\n" +
" dtb_ordt.cod_jcom,\n" +
" mtb_partita_mag.partita_mag,\n" +
" mtb_partita_mag.partita_mag_prod,\n" +
" mtb_partita_mag.data_scad,\n" +
" dtb_ordt.cod_prod,\n" +
" dtb_ordt.data_iniz_prod,\n" +
" dtb_ord_steps.id_step,\n" +
" dtb_ord_steps.data_iniz,\n" +
" dtb_ord_steps.data_fine,\n" +
" dtb_ordt.cod_tcol_UL,\n" +
" dtb_ordt.cod_anag,\n" +
" gtb_anag.rag_soc,\n" +
" gtb_anag.part_iva,\n" +
" dtb_ordt.rif_ord,\n" +
" dtb_ordt.cod_vdes,\n" +
" dtb_ordt.cod_mdep,\n" +
" riga_ord_prod_w_materia_prima.cod_mdep,\n" +
" mtb_aart.colli_pedana,\n" +
" dtb_ord_steps.qta_prod,\n" +
" dtb_ordt.qta_prod,\n" +
" jtb_dist_clav_dir.duration,\n" +
" jtb_comt.descrizione,\n" +
" dtb_ord_steps.elapsed_time,\n" +
" riga_ord_prod_w_materia_prima.colli_pedana,\n" +
" dtb_ord_steps.hr_num,\n" +
" mtb_aart.unt_mis,\n" +
" mtb_aart.unt_mis2,\n" +
" mtb_aart.rap_conv2,\n" +
" mtb_aart.unt_mis3,\n" +
" mtb_aart.rap_conv3,\n" +
" riga_ord_prod_w_materia_prima.unt_ord2,\n" +
" riga_ord_prod_w_materia_prima.unt_ord3,\n" +
" riga_ord_prod_w_materia_prima.qta_ord,\n" +
" riga_ord_prod_w_materia_prima.qta_ord2,\n" +
" riga_ord_prod_w_materia_prima.qta_ord3,\n" +
" riga_ord_prod_w_materia_prima.rap_conv2,\n" +
" riga_ord_prod_w_materia_prima.rap_conv3,\n" +
" riga_ord_prod_w_materia_prima.qta_cnf,\n" +
" riga_ord_prod_w_materia_prima.cal_qta_cnf,\n" +
" riga_ord_prod_w_materia_prima.gg_scad_partita,\n" +
" jtb_cicl.qta_prod,\n" +
" jtb_cicl.rap_conv_prod,\n" +
" dtb_ord_steps.descrizione_attivita,\n" +
" dtb_ord_steps.posizione_out,\n" +
" jtb_cicl.unt_mis_prod,\n" +
" mtb_tcol.descrizione,\n" +
" dtb_ordt.qta_prod,\n" +
" dtb_ordt.rap_conv_prod,\n" +
" setupCaricoImmediato.flag_carico_scarico_immediato,\n" +
" dtb_ord_steps.num_fase, dtb_ord_steps.qta_lav,\n" +
" jl.id_lotto, jlt.data_lotto, mtb_aart.peso_kg, dtb_ordt.data_cons_prod_max,\n" +
" dtb_ord_steps.id_step,\n" +
" dtb_ord_steps.max_fase,\n" +
" dtb_ord_steps.starting_machines)\n" +
" SELECT ROW_NUMBER() OVER (ORDER BY data_ord, num_ord_prod, pos_riga, num_ord) AS sort,\n" +
" cod_jcom,\n" +
" data_ord_prod,\n" +
" num_ord_prod,\n" +
" riga_ord_prod,\n" +
" flag_avviabile,\n" +
" flag_tracciabilita,\n" +
" unt_ord,\n" +
" rap_conv,\n" +
" unt_ord2,\n" +
" rap_conv2,\n" +
" unt_ord3,\n" +
" rap_conv3,\n" +
" descrizione_prod,\n" +
" num_pezzi,\n" +
" num_cnf,\n" +
" gg_scad_partita,\n" +
" qta_cnf,\n" +
" colli_pedana,\n" +
" num_pedane,\n" +
" pos_riga,\n" +
" flag_evaso_prod,\n" +
" flag_evaso_forzato,\n" +
" flag_ordine_evaso,\n" +
" gestione,\n" +
" data_ord,\n" +
" cod_tcol_UL,\n" +
" descrizione_tcol,\n" +
" cod_anag,\n" +
" rag_soc_anag,\n" +
" part_iva,\n" +
" rif_ord,\n" +
" cod_vdes,\n" +
" cod_mdep,\n" +
" cod_mdep_prod,\n" +
" num_ord,\n" +
" cod_jfas,\n" +
" cod_jfas_lav,\n" +
" partita_mag,\n" +
" partita_mag_prod,\n" +
" note_lav,\n" +
" data_scad,\n" +
" cod_prod,\n" +
" descrizione_commessa,\n" +
" data_iniz_prod,\n" +
" id_step,\n" +
" unt_mis_prod,\n" +
" qta_batch_prod,\n" +
" rap_conv_prod,\n" +
" data_iniz,\n" +
" data_fine,\n" +
" qta_prod,\n" +
" qta_lav,\n" +
" max_fase,\n" +
" num_fase,\n" +
" hr_num,\n" +
" descrizione_attivita,\n" +
" posizione_out,\n" +
" prod_std,\n" +
" elapsed_time,\n" +
" qta_trasferite,\n" +
" udc_trasferiti,\n" +
" uds_scaricati,\n" +
" stato,\n" +
" pz_trasferiti,\n" +
" run_time_sec,\n" +
" SUM(run_time_sec) OVER (PARTITION BY cod_jfas, data_ord_prod) AS cumulative_run_time_sec,\n" +
" CONVERT(INT, run_time_sec / 3600) AS run_time_hour,\n" +
" ROUND((run_time_sec / 3600 - CONVERT(INT, run_time_sec / 3600)) * 60, 0) AS run_time_min,\n" +
" CASE\n" +
" WHEN setup_run_time.flag_restart = 'S' THEN\n" +
" DATEADD(SECOND, SUM(run_time_sec)\n" +
" OVER (PARTITION BY cod_jfas, data_ord_prod ORDER BY stato, cod_jfas, data_ord_prod, pos_riga ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW),\n" +
" CASE\n" +
" WHEN (data_ord_prod > GETDATE() AND (data_iniz IS NULL OR data_fine IS NOT NULL))\n" +
" THEN DATEADD(HH, 7, data_ord_prod)\n" +
" ELSE GETDATE() END)\n" +
" ELSE\n" +
" DATEADD(SECOND, SUM(run_time_sec)\n" +
" OVER (PARTITION BY cod_jfas ORDER BY stato, cod_jfas, data_ord_prod, num_ord_prod, pos_riga ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW),\n" +
" GETDATE())\n" +
" END AS run_time_end,\n" +
" id_lotto,\n" +
" data_lotto,\n" +
" peso_kg,\n" +
" data_cons_prod_max\n" +
" FROM ord_lav\n" +
" CROSS APPLY setup_run_time");
}
@Override
public void down() throws Exception {
}
}

View File

@@ -0,0 +1,179 @@
package it.integry.ems.migration.model;
import it.integry.ems.migration._base.BaseMigration;
import it.integry.ems.migration._base.MigrationModelInterface;
public class Migration_20251015120629 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
createOrUpdateView("mvw_sitart_udc_det_inventario", "CREATE VIEW [dbo].[mvw_sitart_udc_det_inventario] AS\n" +
"WITH baseMtbColr AS (SELECT c,\n" +
"\n" +
" ROUND(v.qta_col, cifre_dec) AS qta_col,\n" +
" ROUND(v.num_cnf, cifre_dec) AS num_cnf,\n" +
" IIF(flag_qta_cnf_fissa = 'S',\n" +
" v.qta_cnf_anag, v.qta_col / IIF(v.num_cnf = 0, 1, v.num_cnf)) AS qta_cnf,\n" +
" v.cod_mart,\n" +
" v.cod_col,\n" +
" v.cod_tagl,\n" +
" v.partita_mag,\n" +
" v.peso_netto_kg,\n" +
" v.peso_lordo_kg,\n" +
" mtb_colt.gestione,\n" +
" mtb_colt.data_collo,\n" +
" mtb_colt.ser_collo,\n" +
" mtb_colt.num_collo,\n" +
" v.cod_jcom,\n" +
" v.flag_qta_cnf_fissa,\n" +
" v.unt_mis,\n" +
" v.diacod,\n" +
" v.descrizione_estesa,\n" +
" v.cod_mgrp,\n" +
" mtb_grup.descrizione AS descrizione_gruppo,\n" +
" v.cod_msgr,\n" +
" mtb_sgrp.descrizione AS descrizione_sottogruppo,\n" +
" mtb_unt_mis.flag_dig,\n" +
" mtb_unt_mis.cifre_dec,\n" +
" mtb_colt.segno,\n" +
" v.cod_mdep,\n" +
" v.posizione,\n" +
" mtb_colt.cod_dtip,\n" +
" mtb_colt.cod_jfas,\n" +
" v.barcode_ul,\n" +
" v.qta_cnf_anag,\n" +
" MAX(mtb_colr.datetime_row) AS datetime_posizionamento,\n" +
" mtb_colt.progressivo_ul\n" +
" FROM mvw_mtb_colr_with_giacenza v WITH (NOEXPAND)\n" +
" INNER JOIN mtb_colt\n" +
" ON v.barcode_ul = mtb_colt.barcode_ul\n" +
" LEFT OUTER JOIN mtb_colr ON\n" +
" v.barcode_ul = mtb_colr.barcode_ul_in AND\n" +
" v.cod_mart = mtb_colr.cod_mart AND\n" +
" ((v.partita_mag IS NULL AND mtb_colr.partita_mag IS NULL) OR\n" +
" (v.partita_mag = mtb_colr.partita_mag)) AND\n" +
" ((v.cod_col IS NULL AND mtb_colr.cod_col IS NULL) OR (v.cod_col = mtb_colr.cod_col)) AND\n" +
" ((v.cod_tagl IS NULL AND mtb_colr.cod_tagl IS NULL) OR (v.cod_tagl = mtb_colr.cod_tagl)) AND\n" +
" ((v.cod_jcom IS NULL AND mtb_colr.cod_jcom IS NULL) OR (v.cod_jcom = mtb_colr.cod_jcom)) AND\n" +
" ((v.posizione IS NULL AND mtb_colr.posizione_in IS NULL) OR (v.posizione = mtb_colr.posizione_in)) AND\n" +
" ((v.cod_mdep IS NULL AND mtb_colr.cod_mdep_in IS NULL) OR (v.cod_mdep = mtb_colr.cod_mdep_in)) AND\n" +
" ISNULL(mtb_colr.posizione_in, '') <> ISNULL(mtb_colr.posizione_out, '')\n" +
" INNER JOIN dbo.mtb_unt_mis ON v.unt_mis = mtb_unt_mis.unt_mis\n" +
"\n" +
" INNER JOIN dbo.mtb_grup ON v.cod_mgrp = mtb_grup.cod_mgrp\n" +
" INNER JOIN dbo.mtb_sgrp ON v.cod_mgrp = mtb_sgrp.cod_mgrp\n" +
" AND v.cod_msgr = mtb_sgrp.cod_msgr\n" +
" WHERE v.qta_col > 0\n" +
" AND (segno = 1 OR (segno = -1 AND cod_dtip IS NULL AND mtb_colt.gestione = 'V'))\n" +
" GROUP BY c,\n" +
" ROUND(v.qta_col, cifre_dec),\n" +
" ROUND(v.num_cnf, cifre_dec),\n" +
" IIF(flag_qta_cnf_fissa = 'S',\n" +
" v.qta_cnf_anag, v.qta_col / IIF(v.num_cnf = 0, 1, v.num_cnf)),\n" +
" v.cod_mart,\n" +
" v.cod_col,\n" +
" v.cod_tagl,\n" +
" v.partita_mag,\n" +
" v.peso_netto_kg,\n" +
" v.peso_lordo_kg,\n" +
" mtb_colt.gestione,\n" +
" mtb_colt.data_collo,\n" +
" mtb_colt.ser_collo,\n" +
" mtb_colt.num_collo,\n" +
" v.cod_jcom,\n" +
" v.flag_qta_cnf_fissa,\n" +
" v.unt_mis,\n" +
" v.diacod,\n" +
" v.descrizione_estesa,\n" +
" v.cod_mgrp,\n" +
" mtb_grup.descrizione,\n" +
" v.cod_msgr,\n" +
" mtb_sgrp.descrizione,\n" +
" mtb_unt_mis.flag_dig,\n" +
" mtb_unt_mis.cifre_dec,\n" +
" mtb_colt.segno,\n" +
" v.cod_mdep,\n" +
" v.posizione,\n" +
" mtb_colt.cod_dtip,\n" +
" mtb_colt.cod_jfas,\n" +
" v.barcode_ul,\n" +
" v.qta_cnf_anag,\n" +
" mtb_colt.progressivo_ul),\n" +
" final_stock AS (SELECT v.qta_col,\n" +
" v.num_cnf,\n" +
" v.qta_cnf,\n" +
" v.gestione,\n" +
" v.data_collo,\n" +
" v.ser_collo,\n" +
" v.num_collo,\n" +
" v.cod_mdep AS cod_mdep,\n" +
" v.posizione AS posizione,\n" +
" mtb_depo_posizioni.priorita,\n" +
" v.cod_mgrp AS codGruppo,\n" +
" v.descrizione_gruppo AS Gruppo,\n" +
" v.cod_msgr AS CodSgruppo,\n" +
" v.descrizione_sottogruppo AS Sottogruppo,\n" +
" v.cod_mart,\n" +
" v.diacod,\n" +
" v.descrizione_estesa,\n" +
" v.partita_mag,\n" +
" v.cod_col,\n" +
" v.cod_tagl,\n" +
" v.cod_jcom,\n" +
" v.peso_netto_kg,\n" +
" v.peso_lordo_kg,\n" +
" v.cod_jfas,\n" +
" v.flag_qta_cnf_fissa,\n" +
" v.unt_mis,\n" +
" v.segno,\n" +
" v.barcode_ul,\n" +
" v.datetime_posizionamento,\n" +
" v.progressivo_ul\n" +
" FROM baseMtbColr v\n" +
"\n" +
" LEFT OUTER JOIN mtb_depo_posizioni\n" +
" ON v.cod_mdep = mtb_depo_posizioni.cod_mdep\n" +
" AND v.posizione = mtb_depo_posizioni.posizione)\n" +
"\n" +
"SELECT qta_col,\n" +
" num_cnf,\n" +
" qta_cnf,\n" +
" gestione,\n" +
" data_collo,\n" +
" ser_collo,\n" +
" num_collo,\n" +
" cod_mdep,\n" +
" posizione,\n" +
" priorita,\n" +
" codGruppo,\n" +
" Gruppo,\n" +
" CodSgruppo,\n" +
" Sottogruppo,\n" +
" cod_mart,\n" +
" diacod,\n" +
" descrizione_estesa,\n" +
" partita_mag,\n" +
" cod_col,\n" +
" cod_tagl,\n" +
" cod_jcom,\n" +
" peso_netto_kg,\n" +
" peso_lordo_kg,\n" +
" cod_jfas,\n" +
" flag_qta_cnf_fissa,\n" +
" unt_mis,\n" +
" segno,\n" +
" barcode_ul,\n" +
" datetime_posizionamento,\n" +
" progressivo_ul\n" +
"FROM final_stock");
}
@Override
public void down() throws Exception {
}
}

View File

@@ -0,0 +1,186 @@
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_20251015152419 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
if (isCustomer(IntegryCustomer.Biolevante))
createOrUpdateFunction("MPS_grid", "Create function dbo.MPS_grid(@timeBucket char(1) = 'W' )\n" +
" RETURNS TABLE AS\n" +
" RETURN\n" +
" (\n" +
" --@timeBucket D=giorno; W=settimana (default); M=Mese\n" +
" with horizon as\n" +
" (\n" +
" select dateadd(day,-1,convert(date, getdate())) as t0_from, dateadd(day,-1,convert(date, getdate())) as t0_to,\n" +
" dateadd(day, 0,convert(date, getdate())) as t1_from, \n" +
" case @timeBucket \n" +
" when 'D' then CONVERT(date, getdate())\n" +
" when 'W' then DATEADD(DAY, 8 - DATEPART(WEEKDAY, GETDATE()), CAST(GETDATE() AS DATE)) \n" +
" when 'M' then EOMonth(getdate())\n" +
" end as t1_to,\n" +
" case @timeBucket \n" +
" when 'D' then dateadd(day,1,CONVERT(date, getdate()))\n" +
" when 'W' then dateadd(DAY,1,DATEADD(DAY, 8 - DATEPART(WEEKDAY, GETDATE()), CAST(GETDATE() AS DATE)))\n" +
" when 'M' then dateadd(day,1,EOMonth(getdate()))\n" +
" end as t2_from,\n" +
" case @timeBucket \n" +
" when 'D' then dateadd(day,1,CONVERT(date, getdate()))\n" +
" when 'W' then dateadd(WEEK,1,DATEADD(DAY, 8 - DATEPART(WEEKDAY, GETDATE()), CAST(GETDATE() AS DATE)))\n" +
" when 'M' then dateadd(MONTH,1,EOMonth(getdate()))\n" +
" end as t2_to,\n" +
" case @timeBucket \n" +
" when 'D' then dateadd(day,1,dateadd(day,1,CONVERT(date, getdate())))\n" +
" when 'W' then dateadd(day,1,dateadd(WEEK,1,DATEADD(DAY, 8 - DATEPART(WEEKDAY, GETDATE()), CAST(GETDATE() AS DATE))))\n" +
" when 'M' then dateadd(day,1,dateadd(MONTH,1,EOMonth(getdate())))\n" +
" end as t3_from,\n" +
" case @timeBucket \n" +
" when 'D' then dateadd(day,2,CONVERT(date, getdate()))\n" +
" when 'W' then dateadd(WEEK,2,DATEADD(DAY, 8 - DATEPART(WEEKDAY, GETDATE()), CAST(GETDATE() AS DATE)))\n" +
" when 'M' then dateadd(MONTH,2,EOMonth(getdate()))\n" +
" end as t3_to,\n" +
" case @timeBucket \n" +
" when 'D' then dateadd(day,3,CONVERT(date, getdate()))\n" +
" when 'W' then dateadd(day,1,dateadd(WEEK,2,DATEADD(DAY, 8 - DATEPART(WEEKDAY, GETDATE()), CAST(GETDATE() AS DATE))))\n" +
" when 'M' then dateadd(day,1,dateadd(MONTH,2,EOMonth(getdate())))\n" +
" end as t4_from,\n" +
" case @timeBucket \n" +
" when 'D' then dateadd(day,3,CONVERT(date, getdate()))\n" +
" when 'W' then dateadd(WEEK,3,DATEADD(DAY, 8 - DATEPART(WEEKDAY, GETDATE()), CAST(GETDATE() AS DATE)))\n" +
" when 'M' then dateadd(MONTH,3,EOMonth(getdate()))\n" +
" end as t4_to,\n" +
" case @timeBucket \n" +
" when 'D' then dateadd(day,4,CONVERT(date, getdate()))\n" +
" when 'W' then dateadd(day,1,dateadd(WEEK,3,DATEADD(DAY, 8 - DATEPART(WEEKDAY, GETDATE()), CAST(GETDATE() AS DATE))))\n" +
" when 'M' then dateadd(day,1,dateadd(MONTH,3,EOMonth(getdate())))\n" +
" end as t5_from,\n" +
" case @timeBucket \n" +
" when 'D' then dateadd(day,4,CONVERT(date, getdate()))\n" +
" when 'W' then dateadd(WEEK,4,DATEADD(DAY, 8 - DATEPART(WEEKDAY, GETDATE()), CAST(GETDATE() AS DATE)))\n" +
" when 'M' then dateadd(MONTH,4,EOMonth(getdate()))\n" +
" end as t5_to,\n" +
" case @timeBucket \n" +
" when 'D' then dateadd(day,5,CONVERT(date, getdate()))\n" +
" when 'W' then dateadd(day,1,dateadd(WEEK,4,DATEADD(DAY, 8 - DATEPART(WEEKDAY, GETDATE()), CAST(GETDATE() AS DATE))))\n" +
" when 'M' then dateadd(day,1,dateadd(MONTH,4,EOMonth(getdate())))\n" +
" end as t6_from,\n" +
" case @timeBucket \n" +
" when 'D' then dateadd(day,5,CONVERT(date, getdate()))\n" +
" when 'W' then dateadd(WEEK,5,DATEADD(DAY, 8 - DATEPART(WEEKDAY, GETDATE()), CAST(GETDATE() AS DATE)))\n" +
" when 'M' then dateadd(MONTH,5,EOMonth(getdate()))\n" +
" end as t6_to\n" +
" ),\n" +
"\n" +
" AlberoDiCLassificazione as\n" +
" --Albero classificazione Articoli personalizzato per Olio Levante, da sostituire con vista su database di AI per forecast con algoritmo Tuidi\n" +
" (select distinct --mtb_aart.cod_mart, mtb_aart.descrizione, \n" +
" mtb_aart.cod_mgrp + Replicate('_',3-len(mtb_aart.cod_mgrp))+\n" +
" isNull(mtb_aart.cod_mstp,'0000')+\n" +
" ISNULL(mtb_aart.cod_msfa,'') as hierarchy_code,\n" +
" mtb_aart.cod_mgrp as level_1_code, mtb_grup.descrizione as level_1_description,\n" +
" isNull(mtb_aart.cod_mstp,'000') as level_2_code, isNull(mtb_tipi.descrizione+' '+mtb_stip.descrizione,'000') as level_2_description,\n" +
" mtb_aart.cod_msfa as level_3_code, mtb_sfam.descrizione as level_3_description\n" +
" from mtb_aart inner join mtb_grup on mtb_aart.cod_mgrp = mtb_grup.cod_mgrp\n" +
" inner join mtb_sgrp on mtb_aart.cod_mgrp = mtb_sgrp.cod_mgrp and mtb_aart.cod_msgr = mtb_sgrp.cod_msgr\n" +
" left outer join 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 mtb_tipi on mtb_aart.cod_mtip = mtb_tipi.cod_mtip\n" +
" left outer join mtb_stip on mtb_aart.cod_mtip = mtb_stip.cod_mtip and mtb_aart.cod_mstp = mtb_stip.cod_mstp\n" +
" \n" +
" Where mtb_aart.cod_mgrp in ('AP','C','CO','S','SO','SOR') and mtb_aart.flag_stato = 'A'\n" +
" )\n" +
" ,\n" +
" ArticoliRiclassificati as\n" +
" (\n" +
" --Vista Articoli personalizzata per Olio Levante, da sostituire con vista su database di AI per forecast con algoritmo Tuidi\n" +
" select \n" +
" cod_mart as art_code,\n" +
" descrizione_estesa as description,\n" +
" null as art_info,\n" +
" marchio as brand,\n" +
" bar_code as ean,\n" +
" null as img_url,\n" +
" gg_scad_partita as shelf_life,\n" +
" unt_mis as uom_purchase,\n" +
" unt_mis as uom_selling,\n" +
" peso_kg as weight,\n" +
" IIF(flag_stato='A',1,0) as status,\n" +
" mtb_aart.cod_mgrp + Replicate('_',3-len(mtb_aart.cod_mgrp))+\n" +
" isNull(mtb_aart.cod_mstp,'0000')+\n" +
" ISNULL(mtb_aart.cod_msfa,'') as hierarchy_code\n" +
" from mtb_aart inner join mtb_grup on mtb_aart.cod_mgrp = mtb_grup.cod_mgrp\n" +
" inner join mtb_sgrp on mtb_aart.cod_mgrp = mtb_sgrp.cod_mgrp and mtb_aart.cod_msgr = mtb_sgrp.cod_msgr\n" +
" left outer join 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 mtb_tipi on mtb_aart.cod_mtip = mtb_tipi.cod_mtip\n" +
" left outer join mtb_stip on mtb_aart.cod_mtip = mtb_stip.cod_mtip and mtb_aart.cod_mstp = mtb_stip.cod_mstp\n" +
" where mtb_aart.cod_mgrp in ('AP','C','CO','S','SO','SOR') and mtb_aart.flag_stato = 'A'\n" +
" ),\n" +
"\n" +
" forecast as\n" +
" (\n" +
" select 'FORECAST' as causale,\n" +
" mtb_aart.cod_mgrp, mtb_aart.cod_msgr,\n" +
" mtb_aart.cod_mart,\n" +
" mtb_aart.descrizione,\n" +
" dateadd(year, 1,vend.data_doc) as data_vend,\n" +
" -vend.qtaVendUM1 as qtaPrevista,\n" +
" null as partita_mag,\n" +
" 0 as qta_progressiva,\n" +
" null as gestione, null as data_ord, null as num_ord,\n" +
" null as cod_mdep,\n" +
" 'N' as isOrdTrasf,\n" +
" 'N' as flag_sospeso,\n" +
" null as stato_partita\n" +
" \n" +
" from OlapPPVendite vend inner join mtb_aart on vend.cod_prod = mtb_aart.cod_mart\n" +
" where data_doc between dateadd(year, -1, CONVERT(date, getDate())) and \n" +
" case @timeBucket\n" +
" when 'D' then DATEADD(DAY,6,dateadd(year, -1, CONVERT(date, getDate())))\n" +
" WHEN 'W' then DATEADD(week,6,dateadd(year, -1, CONVERT(date, getDate())))\n" +
" WHEN 'M' then DATEADD(month,6,dateadd(year, -1, CONVERT(date, getDate())))\n" +
" end\n" +
" )\n" +
"\n" +
"\n" +
" SELECT clas.*, --mrp.cod_mart, mrp.descrizione,\n" +
"\n" +
" --inserire qui la riga del forecast\n" +
" case when causale like 'FORECAST' then '1 - FORECAST'\n" +
" when causale like '%GIACENZA%' then '3 - DISPONIBILITA'\n" +
" when causale like '%ORD.VEND.%' then '2 - ORDINI VENDITA'\n" +
" when causale like '%ORD.LAVORAZ.%' then '4 - ORDINI LAVORAZIONE' end as MPS_row,\n" +
" case when causale like '%GIACENZA%' then mrp.qta else 0 end as bucket0,\n" +
" case when (mrp.data_mrp < horizon.t1_from OR mrp.data_mrp between horizon.t1_from and horizon.t1_to) and causale not like '%GIACENZA%' then mrp.qta else 0 end as bucket1,\n" +
" case when mrp.data_mrp between horizon.t2_from and horizon.t2_to then mrp.qta else 0 end as bucket2,\n" +
" case when mrp.data_mrp between horizon.t3_from and horizon.t3_to then mrp.qta else 0 end as bucket3,\n" +
" case when mrp.data_mrp between horizon.t4_from and horizon.t4_to then mrp.qta else 0 end as bucket4,\n" +
" case when mrp.data_mrp between horizon.t5_from and horizon.t5_to then mrp.qta else 0 end as bucket5,\n" +
" case when mrp.data_mrp between horizon.t6_from and horizon.t6_to then mrp.qta else 0 end as bucket6,\n" +
" case when mrp.data_mrp > horizon.t6_to then mrp.qta else 0 end as bucketOver,\n" +
" mtb_aart.unt_mis,\n" +
" mtb_aart.qta_cnf,\n" +
" isNull(jtb_cicl.lotto_min_ord, mtb_aart.qta_cnf*mtb_aart.colli_pedana) as LotSize,\n" +
" mrp.*\n" +
" FROM (\n" +
" select * from [dbo].[MRP_DailyMaterialReq] () \n" +
" union\n" +
" select * from forecast\n" +
" )\n" +
" \n" +
" mrp inner join ArticoliRiclassificati art on mrp.cod_mart = art.art_code\n" +
" inner join AlberoDiCLassificazione clas on art.hierarchy_code = clas.hierarchy_code\n" +
" inner join horizon on mrp.data_mrp >= horizon.t0_from\n" +
" inner join mtb_aart on mrp.cod_mart = mtb_aart.cod_mart\n" +
" left outer join jtb_cicl on mrp.cod_mart = jtb_cicl.cod_mart\n" +
" )");
}
@Override
public void down() throws Exception {
}
}

View File

@@ -0,0 +1,80 @@
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_20251020113516 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
createOrUpdateView("MPS_albero_classificazione","create view MPS_albero_classificazione as\n" +
"select distinct mtb_aart.cod_mart, mtb_aart.descrizione,\n" +
" mtb_aart.cod_mgrp + Replicate('_', 3 - len(mtb_aart.cod_mgrp)) +\n" +
" isNull(mtb_aart.cod_mstp, '0000') +\n" +
" ISNULL(mtb_aart.cod_msfa, '') as hierarchy_code,\n" +
" mtb_aart.cod_mgrp as level_1_code,\n" +
" mtb_grup.descrizione as level_1_description,\n" +
" isNull(mtb_aart.cod_mstp, '000') as level_2_code,\n" +
" isNull(mtb_tipi.descrizione + ' ' + mtb_stip.descrizione, '000') as level_2_description,\n" +
" mtb_aart.cod_msfa as level_3_code,\n" +
" mtb_sfam.descrizione as level_3_description\n" +
"from mtb_aart\n" +
" inner join mtb_grup on mtb_aart.cod_mgrp = mtb_grup.cod_mgrp\n" +
" inner join mtb_sgrp\n" +
" on mtb_aart.cod_mgrp = mtb_sgrp.cod_mgrp and mtb_aart.cod_msgr = mtb_sgrp.cod_msgr\n" +
" left outer join mtb_sfam on mtb_aart.cod_mgrp = mtb_sfam.cod_mgrp and\n" +
" mtb_aart.cod_msgr = mtb_sfam.cod_msgr and\n" +
" mtb_aart.cod_msfa = mtb_sfam.cod_msfa\n" +
" left outer join mtb_tipi on mtb_aart.cod_mtip = mtb_tipi.cod_mtip\n" +
" left outer join mtb_stip on mtb_aart.cod_mtip = mtb_stip.cod_mtip and\n" +
" mtb_aart.cod_mstp = mtb_stip.cod_mstp\n" +
"\n" +
"Where mtb_grup.tipo_mgrp in ('PF', 'SL')\n" +
" and mtb_aart.flag_stato = 'A'\n");
if (isCustomerDb(IntegryCustomerDB.Biolevante_Biolevante)){
createOrUpdateView("MPS_albero_classificazione","CREATE view MPS_albero_classificazione as\n" +
" select distinct mtb_aart.cod_mgrp + Replicate('_', 3 - len(mtb_aart.cod_mgrp)) +\n" +
" isNull(mtb_aart.cod_mstp, '0000') +\n" +
" ISNULL(mtb_aart.cod_msfa, '') as hierarchy_code,\n" +
" mtb_aart.cod_mart,\n" +
" mtb_aart.descrizione,\n" +
" mtb_aart.cod_mgrp as level_1_code,\n" +
" mtb_grup.descrizione as level_1_description,\n" +
" mtb_aart.cod_mstp as level_2_code,\n" +
" mtb_tipi.descrizione + ' ' + mtb_stip.descrizione as level_2_description,\n" +
" mtb_aart.cod_msfa as level_3_code,\n" +
" mtb_sfam.descrizione as level_3_description,\n" +
" mtb_aart.unt_mis,\n" +
" (IIF(jtb_cicl.lotto_min_ord > 0, jtb_cicl.lotto_min_ord * jtb_cicl.rap_conv_prod,\n" +
" mtb_aart.qta_cnf * mtb_aart.colli_pedana)) as lot_size\n" +
" from mtb_aart\n" +
" inner join mtb_grup on mtb_aart.cod_mgrp = mtb_grup.cod_mgrp\n" +
" inner join mtb_sgrp\n" +
" on mtb_aart.cod_mgrp = mtb_sgrp.cod_mgrp and mtb_aart.cod_msgr = mtb_sgrp.cod_msgr\n" +
" left outer join mtb_sfam on mtb_aart.cod_mgrp = mtb_sfam.cod_mgrp and\n" +
" mtb_aart.cod_msgr = mtb_sfam.cod_msgr and\n" +
" mtb_aart.cod_msfa = mtb_sfam.cod_msfa\n" +
" left outer join mtb_tipi on mtb_aart.cod_mtip = mtb_tipi.cod_mtip\n" +
" left outer join mtb_stip on mtb_aart.cod_mtip = mtb_stip.cod_mtip and\n" +
" mtb_aart.cod_mstp = mtb_stip.cod_mstp\n" +
" left outer join jtb_cicl on mtb_aart.cod_mart = jtb_cicl.cod_prod\n" +
"\n" +
"\n" +
" Where mtb_aart.cod_mgrp in ('AP', 'C', 'CO', 'S', 'SO', 'SOR')\n" +
" and not tipo_mgrp = 'ACC'\n" +
" and mtb_aart.flag_stato = 'A'\n" +
" \n");
}
}
@Override
public void down() throws Exception {
}
}

View File

@@ -0,0 +1,20 @@
package it.integry.ems.migration.model;
import it.integry.ems.migration._base.BaseMigration;
import it.integry.ems.migration._base.MigrationModelInterface;
public class Migration_20251021114611 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
executeStatement("ALTER TABLE mtb_missione_mag_auto\n" +
" ADD priorita SMALLINT DEFAULT 0 NOT NULL");
}
@Override
public void down() throws Exception {
}
}

View File

@@ -10,6 +10,8 @@ public class Migration_20251022125946 extends BaseMigration implements Migration
if (isHistoryDB()) if (isHistoryDB())
return; return;
if (isDMS())
return;
createOrUpdateFunction("getListinoVendita", "CREATE FUNCTION [dbo].[getListinoVendita](@datavalidita DATETIME, @codvlis VARCHAR(5), @codmart VARCHAR(15))\n" + createOrUpdateFunction("getListinoVendita", "CREATE FUNCTION [dbo].[getListinoVendita](@datavalidita DATETIME, @codvlis VARCHAR(5), @codmart VARCHAR(15))\n" +
" RETURNS TABLE AS\n" + " RETURNS TABLE AS\n" +

View File

@@ -0,0 +1,26 @@
package it.integry.ems.migration.model;
import it.integry.ems.migration._base.BaseMigration;
import it.integry.ems.migration._base.MigrationModelInterface;
public class Migration_20251024113416 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
executeStatement("ALTER TABLE mtb_missione_mag_auto_det " +
"ALTER COLUMN posizione_in VARCHAR (MAX);",
"ALTER TABLE mtb_missione_mag_auto_det " +
"ALTER COLUMN posizione_out VARCHAR (MAX);",
"ALTER TABLE dtb_ord_steps " +
"ALTER COLUMN posizione_out VARCHAR (MAX);");
}
@Override
public void down() throws Exception {
}
}

View File

@@ -10,6 +10,9 @@ public class Migration_20251024175524 extends BaseMigration implements Migration
if (isHistoryDB()) if (isHistoryDB())
return; return;
if (isDMS())
return;
executeStatement( executeStatement(
"exec DropForeignKey 'ctb_amac', 'mtb_depo_posizioni'", "exec DropForeignKey 'ctb_amac', 'mtb_depo_posizioni'",
"exec DropForeignKey 'jrl_fase_posizioni', 'mtb_depo_posizioni'", "exec DropForeignKey 'jrl_fase_posizioni', 'mtb_depo_posizioni'",

View File

@@ -13,6 +13,9 @@ public class Migration_20251027172319 extends BaseMigration implements Migration
if (isHistoryDB()) if (isHistoryDB())
return; return;
if (isDMS())
return;
executeStatement( executeStatement(
"CREATE TABLE [dbo].[mtb_ssfam](" "CREATE TABLE [dbo].[mtb_ssfam]("
+ " [cod_mgrp] varchar(5) NOT NULL, " + " [cod_mgrp] varchar(5) NOT NULL, "

View File

@@ -14,6 +14,9 @@ public class Migration_20251027173518 extends BaseMigration implements Migration
if (isHistoryDB()) if (isHistoryDB())
return; return;
if (isDMS())
return;
IndexTableDTO indexTableDTO = IndexTableDTO indexTableDTO =
new IndexTableDTO() new IndexTableDTO()
.setTableName("mtb_aart_marchio") .setTableName("mtb_aart_marchio")

View File

@@ -0,0 +1,34 @@
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.entity.MtbDepoPosizioni;
import it.integry.ems_model.utility.UtilityList;
import it.integry.ems_model.utility.dto.IndexTableDTO;
import java.util.ArrayList;
public class Migration_20251028122833 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
createIndex(
new IndexTableDTO()
.setIndexName("ix_metb_depo_posizioni_posizione_cod_mdep")
.setTableName(MtbDepoPosizioni.ENTITY)
.setColumnsIndex(new ArrayList<IndexTableDTO.ColumnIndex>() {{
add(new IndexTableDTO.ColumnIndex("posizione"));
add(new IndexTableDTO.ColumnIndex("cod_mdep"));
}})
);
}
@Override
public void down() throws Exception {
}
}

View File

@@ -10,6 +10,8 @@ public class Migration_20251029153203 extends BaseMigration implements Migration
if (isHistoryDB()) if (isHistoryDB())
return; return;
if (isDMS())
return;
createOrUpdateView("[vw_tracciabUDCVend]", "CREATE VIEW [dbo].[vw_tracciabUDCVend] AS\n" + createOrUpdateView("[vw_tracciabUDCVend]", "CREATE VIEW [dbo].[vw_tracciabUDCVend] AS\n" +
"SELECT mtb_colt.cod_anag AS codAnag,\n" + "SELECT mtb_colt.cod_anag AS codAnag,\n" +

View File

@@ -10,6 +10,8 @@ public class Migration_20251029170931 extends BaseMigration implements Migration
if (isHistoryDB()) if (isHistoryDB())
return; return;
if (isDMS())
return;
createOrUpdateFunction("getDettMatricoleDaOrdine", "CREATE Function [dbo].[getDettMatricoleDaOrdine] (@codJcom varchar(10)) \n" + createOrUpdateFunction("getDettMatricoleDaOrdine", "CREATE Function [dbo].[getDettMatricoleDaOrdine] (@codJcom varchar(10)) \n" +
"RETURNS @dettMatricole TABLE( cod_prod varchar(15),\n" + "RETURNS @dettMatricole TABLE( cod_prod varchar(15),\n" +

View File

@@ -21,6 +21,9 @@ public class Migration_20251029181607 extends BaseMigration implements Migration
if (isHistoryDB()) if (isHistoryDB())
return; return;
if (isDMS())
return;
executeStatement( executeStatement(
"EXEC sp_updateextendedproperty 'MS_Description',\n" + "EXEC sp_updateextendedproperty 'MS_Description',\n" +
" 'Valori possibili: 0 -> Testo, 1 -> Boolean, 2 -> Intero, 3 -> Decimale, 4 -> Date, 5 -> Datetime, 6 -> Time, 7 -> DropdownList',\n" + " 'Valori possibili: 0 -> Testo, 1 -> Boolean, 2 -> Intero, 3 -> Decimale, 4 -> Date, 5 -> Datetime, 6 -> Time, 7 -> DropdownList',\n" +

View File

@@ -10,6 +10,9 @@ public class Migration_20251031092657 extends BaseMigration implements Migration
if (isHistoryDB()) if (isHistoryDB())
return; return;
if (isDMS())
return;
executeStatement("alter table dtb_tipi add flag_delete_plk bit not null default 0"); executeStatement("alter table dtb_tipi add flag_delete_plk bit not null default 0");
} }

View File

@@ -10,6 +10,9 @@ public class Migration_20251031100008 extends BaseMigration implements Migration
if (isHistoryDB()) if (isHistoryDB())
return; return;
if (isDMS())
return;
executeStatement("exec sp_rename 'dtb_tipi.flag_delete_plk', 'flag_delete_pkl'"); executeStatement("exec sp_rename 'dtb_tipi.flag_delete_plk', 'flag_delete_pkl'");
} }

View File

@@ -10,6 +10,9 @@ public class Migration_20251103175252 extends BaseMigration implements Migration
if (isHistoryDB()) if (isHistoryDB())
return; return;
if (isDMS())
return;
executeStatement( executeStatement(
"CREATE TABLE mtb_colori (" "CREATE TABLE mtb_colori ("
+ " cod_col varchar(6) NOT NULL, " + " cod_col varchar(6) NOT NULL, "

View File

@@ -10,6 +10,9 @@ public class Migration_20251104122721 extends BaseMigration implements Migration
if (isHistoryDB()) if (isHistoryDB())
return; return;
if (isDMS())
return;
executeStatement( executeStatement(
"ALTER TABLE dbo.vtb_offt\n" + "ALTER TABLE dbo.vtb_offt\n" +
" ADD cod_banc VARCHAR(5)\n" + " ADD cod_banc VARCHAR(5)\n" +

View File

@@ -10,6 +10,9 @@ public class Migration_20251105171403 extends BaseMigration implements Migration
if (isHistoryDB()) if (isHistoryDB())
return; return;
if (isDMS())
return;
executeStatement("delete dtb_ordr\n" + executeStatement("delete dtb_ordr\n" +
"from dtb_ordr \n" + "from dtb_ordr \n" +
"where not exists (select *\n" + "where not exists (select *\n" +

View File

@@ -11,6 +11,9 @@ public class Migration_20251106104752 extends BaseMigration implements Migration
if (isHistoryDB()) if (isHistoryDB())
return; return;
if (isDMS())
return;
dropDefault("mtb_lisv", "flag_primario"); dropDefault("mtb_lisv", "flag_primario");
addDefault("mtb_lisv", "flag_primario", 1); addDefault("mtb_lisv", "flag_primario", 1);

View File

@@ -10,6 +10,9 @@ public class Migration_20251106113104 extends BaseMigration implements Migration
if (isHistoryDB()) if (isHistoryDB())
return; return;
if (isDMS())
return;
createOrUpdateFunction( createOrUpdateFunction(
"pvm_getassortimentoClientePedane", "pvm_getassortimentoClientePedane",
"CREATE FUNCTION [dbo].[pvm_getassortimentoClientePedane](\n" + "CREATE FUNCTION [dbo].[pvm_getassortimentoClientePedane](\n" +

View File

@@ -0,0 +1,33 @@
package it.integry.ems.migration.model;
import it.integry.ems.migration._base.BaseMigration;
import it.integry.ems.migration._base.IntegryCustomerDB;
import it.integry.ems.migration._base.MigrationModelInterface;
import it.integry.ems_model.entity.CtbAmac;
import it.integry.ems_model.types.OperationType;
public class Migration_20251106114932 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
if (isCustomerDb(IntegryCustomerDB.Biolevante_Biolevante)){
CtbAmac eurofork = new CtbAmac();
eurofork.setCodCmac("MAG-WH1")
.setDescrizione("MAGAZZINO AUTOMATICO EUROFORK L7")
.setCodJfas("L7")
.setPosizione("WH1C3")
.setFlagAttivo(true)
.setMachineType(CtbAmac.MachineType.SILOS_MACHINE.getValue())
.setOperation(OperationType.INSERT);
eurofork.manageWithParentConnection(connection);
}
}
@Override
public void down() throws Exception {
}
}

View File

@@ -0,0 +1,20 @@
package it.integry.ems.migration.model;
import it.integry.ems.migration._base.BaseMigration;
import it.integry.ems.migration._base.MigrationModelInterface;
public class Migration_20251110095557 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
createSetup("PVM","MRP", "COD_MDEP_PREF", null, "Inserire la lista dei depositi preselezionati per utente",
"COD_MDEP", true, true);
}
@Override
public void down() throws Exception {
}
}

View File

@@ -0,0 +1,42 @@
package it.integry.ems.migration.model;
import it.integry.ems.migration._base.BaseMigration;
import it.integry.ems.migration._base.IntegryCustomerDB;
import it.integry.ems.migration._base.MigrationModelInterface;
import it.integry.ems_model.utility.UtilityQuery;
import java.util.List;
public class Migration_20251110100959 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
if (!isCustomerDb(IntegryCustomerDB.Carelli_Winact))
return;
final List<String> duplicatedBarcodes = executeQueryOnlyFirstColumn("SELECT cod_barre\n" +
"FROM mtb_aart_bar_code\n" +
"GROUP BY cod_barre\n" +
"HAVING COUNT(cod_barre) > 1");
executeStatement("DELETE FROM dbo.mtb_aart_bar_code\n" +
"WHERE cod_barre IN (" + UtilityQuery.concatStringFieldsWithSeparator(duplicatedBarcodes, ",") + ")");
executeStatement("ALTER TABLE dbo.mtb_aart_bar_code\n" +
" ALTER COLUMN cod_mart VARCHAR(15) NOT NULL",
"ALTER TABLE dbo.mtb_aart_bar_code\n" +
" ALTER COLUMN cod_barre VARCHAR(40) NOT NULL",
"ALTER TABLE dbo.mtb_aart_bar_code\n" +
" ADD CONSTRAINT pk_mtb_aart_bar_code\n" +
" PRIMARY KEY (cod_mart, cod_barre)");
}
@Override
public void down() throws Exception {
}
}

View File

@@ -0,0 +1,25 @@
package it.integry.ems.migration.model;
import it.integry.ems.migration._base.BaseMigration;
import it.integry.ems.migration._base.MigrationModelInterface;
public class Migration_20251110104131 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
if (isDMS())
return;
executeStatement(
"ALTER TABLE dbo.vtb_viaggi\n" +
" ALTER COLUMN note_incoterms VARCHAR(40) NULL;"
);
}
@Override
public void down() throws Exception {
}
}

View File

@@ -11,6 +11,9 @@ public class Migration_20251110111625 extends BaseMigration implements Migration
if (isHistoryDB()) if (isHistoryDB())
return; return;
if (isDMS())
return;
createSetupQuery(null, null, "SELECT '1|Prezzo netto d''acquisto e ricalcola il prezzo di vendita (Ricarica fissa)' UNION SELECT '2|Prezzo netto d''acquisto e ricalcola ricarica (Prezzo di vendita fisso)' UNION SELECT '3|Prezzo netto d''acquisto e prezzo di vendita da prezzo lordo d''acquisto (Ricalcola ricarica)' UNION SELECT '4|Prezzo netto d''acquisto e ricalcola il prezzo di vendita (Ricarica fissa da Testata listino)' UNION SELECT '5|Prezzo netto d''acquisto, prezzo di vendita e ricarica fissa (Non ricalcolare prezzo)' UNION SELECT '6|Prezzo netto d''acquisto, prezzo di vendita = Prezzo Vendita Suggerito' UNION SELECT '7|Non ricalcolare il prezzo' "); createSetupQuery(null, null, "SELECT '1|Prezzo netto d''acquisto e ricalcola il prezzo di vendita (Ricarica fissa)' UNION SELECT '2|Prezzo netto d''acquisto e ricalcola ricarica (Prezzo di vendita fisso)' UNION SELECT '3|Prezzo netto d''acquisto e prezzo di vendita da prezzo lordo d''acquisto (Ricalcola ricarica)' UNION SELECT '4|Prezzo netto d''acquisto e ricalcola il prezzo di vendita (Ricarica fissa da Testata listino)' UNION SELECT '5|Prezzo netto d''acquisto, prezzo di vendita e ricarica fissa (Non ricalcolare prezzo)' UNION SELECT '6|Prezzo netto d''acquisto, prezzo di vendita = Prezzo Vendita Suggerito' UNION SELECT '7|Non ricalcolare il prezzo' ");
createSetup("VTB_LIST", "LISV4LISA", "CALC_PRZ_BASE", null, createSetup("VTB_LIST", "LISV4LISA", "CALC_PRZ_BASE", null,
"SELEZIONARE IL CRITERIO DI CALCOLO DEL PREZZO BASE", false, null, false, false, "SELEZIONARE IL CRITERIO DI CALCOLO DEL PREZZO BASE", false, null, false, false,

View File

@@ -0,0 +1,284 @@
package it.integry.ems.migration.model;
import it.integry.ems.migration._base.BaseMigration;
import it.integry.ems.migration._base.MigrationModelInterface;
public class Migration_20251110175256 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
if (isDMS())
return;
executeStatement("alter table vtb_list add tipo_um tinyint");
createOrUpdateFunction("getListinoVendita","CREATE FUNCTION [dbo].[getListinoVendita](@datavalidita DATETIME, @codvlis VARCHAR(5), @codmart VARCHAR(15))\n" +
" RETURNS TABLE AS\n" +
" RETURN\n" +
" SELECT vtb_list.cod_vlis,\n" +
" vtb_list.descrizione,\n" +
" CASE\n" +
" WHEN tmp_list.max_lisv IS NULL THEN NULL\n" +
" ELSE CONVERT(DATETIME, LEFT(tmp_list.max_lisv, 10)) END AS data_iniz,\n" +
" CASE\n" +
" WHEN tmp_list.max_lisv IS NULL THEN NULL\n" +
" ELSE CONVERT(INT, RIGHT(tmp_list.max_lisv, 4)) END AS versione,\n" +
" vtb_list.cod_divi,\n" +
" vtb_list.cambio,\n" +
" vtb_list.flag_arr_prz_iva,\n" +
" vtb_list.arr_ric,\n" +
" vtb_list.flag_list_iva_inclusa,\n" +
" vtb_list.flag_lisv_margine,\n" +
" vtb_list.flag_add_trasp,\n" +
" tmp_list.cod_mart AS 'cod_mart',\n" +
" mtb_lisv_data.unt_mis_ven AS unt_mis_ven,\n" +
" ISNULL(mtb_lisv_data.rap_conv, 1) AS rap_conv,\n" +
" ISNULL(mtb_lisv_data.prz_base, 0) AS prz_base,\n" +
" ISNULL(mtb_lisv_data.ricarica, 0) AS ricarico,\n" +
" CASE\n" +
" WHEN mtb_lisv_data.prz_vend IS NOT NULL AND mtb_lisv_data.prz_vend <> 0 THEN\n" +
" ROUND((ISNULL(mtb_lisv_data.prz_vend, 0) -\n" +
" (ISNULL(mtb_lisv_data.prz_base, 0) / (1 - mtb_aart.perc_sfrido / 100))) /\n" +
" ISNULL(mtb_lisv_data.prz_vend, 0) * 100, 2)\n" +
" ELSE 0 END AS margine_eff,\n" +
" --dbo.f_calcMargineEffettivo(IsNull(mtb_lisv_data.prz_base, 0), IsNull(mtb_lisv_data.prz_vend, 0), mtb_aart.perc_sfrido) as margine_eff,\n" +
" --dbo.f_calcRicaricoEffettivo(IsNull(mtb_lisv_data.prz_base, 0), IsNull(mtb_lisv_data.prz_vend, 0), mtb_aart.perc_sfrido) ricarico_eff, \n" +
" CASE\n" +
" WHEN mtb_lisv_data.prz_base IS NOT NULL AND mtb_lisv_data.prz_base <> 0 THEN\n" +
" ROUND((ISNULL(mtb_lisv_data.prz_vend, 0) -\n" +
" (ISNULL(mtb_lisv_data.prz_base, 0) / (1 - mtb_aart.perc_sfrido / 100))) /\n" +
" (ISNULL(mtb_lisv_data.prz_base, 0) / (1 - mtb_aart.perc_sfrido / 100)) * 100, 2)\n" +
" ELSE 0 END AS ricarico_eff,\n" +
"\n" +
" ISNULL(mtb_lisv_data.magg_prz_vend, 0) AS magg_prz_vend,\n" +
" ISNULL(mtb_lisv_data.prz_vend, 0) AS prz_vend,\n" +
" ISNULL(mtb_lisv_data.prz_vend_iva, 0) AS prz_vend_iva,\n" +
" ISNULL(mtb_lisv_data.perc_sco1, 0) AS perc_sco1,\n" +
" ISNULL(mtb_lisv_data.perc_sco2, 0) AS perc_sco2,\n" +
" ISNULL(mtb_lisv_data.perc_sco3, 0) AS perc_sco3,\n" +
" ISNULL(mtb_lisv_data.perc_sco4, 0) AS perc_sco4,\n" +
" ISNULL(mtb_lisv_data.perc_prov, 0) AS perc_prov,\n" +
" ISNULL(mtb_lisv_data.fisso_prov, 0) AS fisso_prov,\n" +
" ISNULL(mtb_lisv_data.posizione, '') AS posizione,\n" +
" ISNULL(mtb_lisv_data.perc_gest, 0) AS perc_gest,\n" +
" ISNULL(mtb_lisv_data.val_gest, 0) AS val_gest,\n" +
" mtb_lisv_data.data_agg_prz AS data_agg_prz,\n" +
" ISNULL(mtb_lisv_data.perc_ispe, 0) AS perc_ispe,\n" +
" ISNULL(mtb_lisv_data.val_ispe, 0) AS val_ispe,\n" +
" ISNULL(mtb_lisv_data.perc_promo, 0) AS perc_promo,\n" +
" ISNULL(mtb_lisv_data.val_promo, 0) AS val_promo,\n" +
" ISNULL(mtb_lisv_data.perc_oneri, 0) AS perc_oneri,\n" +
" ISNULL(mtb_lisv_data.val_oneri, 0) AS val_oneri,\n" +
" mtb_lisv_data.tipo_variazione AS tipo_variazione,\n" +
" mtb_lisv_data.note AS note,\n" +
" mtb_lisv_data.aggiornato_da AS aggiornato_da,\n" +
" mtb_lisv_data.prz_vend * (1 - mtb_lisv_data.perc_sco1 / 100) * (1 - mtb_lisv_data.perc_sco2 / 100) *\n" +
" (1 - mtb_lisv_data.perc_sco3 / 100) *\n" +
" (1 - mtb_lisv_data.perc_sco4 / 100) AS prz_vend_netto,\n" +
" CASE\n" +
" WHEN ISNULL(mtb_lisv_data.colli_pedana, 0) <> 0 THEN mtb_lisv_data.colli_pedana\n" +
" ELSE mtb_aart.colli_pedana END AS colli_pedana,\n" +
" mtb_lisv_data.cod_tcol_ul AS cod_tcol_ul,\n" +
" mtb_lisv_data.cod_tcol_ui AS cod_tcol_ui,\n" +
" ISNULL(mtb_lisv_data.prz_vend_sug, 0) AS prz_vend_sug,\n" +
" CASE\n" +
" WHEN ISNULL(mtb_lisv_data.qta_cnf, 0) <> 0\n" +
" AND dbo.getGestSetup('VTB_LIST', 'SETUP', 'QTA_CNF_LISTINO') = 'S' \n" +
" THEN mtb_lisv_data.qta_cnf\n" +
" ELSE mtb_aart.qta_cnf / ISNULL(mtb_lisv_data.rap_conv, 1) END AS qta_cnf,\n" +
" CASE\n" +
" WHEN ISNULL(mtb_lisv_data.colli_strato, 0) <> 0 THEN mtb_lisv_data.colli_strato\n" +
" ELSE mtb_aart.colli_strato END AS colli_strato,\n" +
" mtb_lisv_data.descrizione_html AS descrizione_html,\n" +
" mtb_lisv_data.colli_pedana AS colli_pedana_lisv,\n" +
" mtb_lisv_data.qta_cnf AS qta_cnf_lisv,\n" +
" mtb_lisv_data.colli_strato AS colli_strato_lisv,\n" +
" mtb_lisv_data.sconto_cartoni,\n" +
" mtb_lisv_data.sconto_strato,\n" +
" mtb_lisv_data.sconto_pedane,\n" +
" vtb_list.flag_attivo,\n" +
" vtb_list_data.note AS note_testata,\n" +
" ISNULL(mtb_lisv_data.flag_prz_bloccato, 'N') AS flag_prz_bloccato,\n" +
" vtb_list_data.porto AS porto,\n" +
" mtb_lisv_data.system_note,\n" +
" mtb_lisv.add_val_spese,\n" +
" mtb_lisv.add_ric_spese,\n" +
" mtb_lisv.add_sco_spese,\n" +
"\t\t\t mtb_aart.flag_incl_listino,\n" +
"\t\t\t mtb_lisv.flag_primario,\n" +
"\t\t\t mtb_aart.id_art_equi,\n" +
"\t\t\t vtb_list.tipo_um\n" +
" FROM (SELECT vtb_list.cod_vlis AS cod_vlis,\n" +
" mtb_lisv_data.cod_mart,\n" +
" MAX(CASE\n" +
" WHEN vtb_list_data.versione IS NULL THEN NULL\n" +
" ELSE CONVERT(VARCHAR(10), vtb_list_data.data_iniz, 111) + ' ' +\n" +
" REPLICATE('0', 5 - LEN(vtb_list_data.versione)) +\n" +
" CONVERT(VARCHAR(5), vtb_list_data.versione) END) AS max_lisv,\n" +
" vtb_list.cod_vlis AS 'cod_vlis_rif'\n" +
" FROM vtb_list\n" +
" INNER JOIN mtb_lisv_data ON vtb_list.cod_vlis = mtb_lisv_data.cod_vlis\n" +
" LEFT OUTER JOIN vtb_list_data ON mtb_lisv_data.cod_vlis = vtb_list_data.cod_vlis AND\n" +
" mtb_lisv_data.versione = vtb_list_data.versione AND\n" +
" vtb_list_data.cod_promo IS NULL AND\n" +
" vtb_list_data.data_iniz <= ISNULL(@datavalidita, GETDATE())\n" +
" WHERE vtb_list.cod_vlis_rif IS NULL\n" +
" GROUP BY vtb_list.cod_vlis,\n" +
" mtb_lisv_data.cod_mart\n" +
" UNION\n" +
" SELECT vtb_list.cod_vlis AS cod_vlis,\n" +
" mtb_lisv_data.cod_mart,\n" +
" MAX(CASE\n" +
" WHEN vtb_list_data.versione IS NULL THEN NULL\n" +
" ELSE CONVERT(VARCHAR(10), vtb_list_data.data_iniz, 111) + ' ' +\n" +
" REPLICATE('0', 5 - LEN(vtb_list_data.versione_rif)) +\n" +
" CONVERT(VARCHAR(5), vtb_list_data.versione_rif) END) AS max_lisv,\n" +
" vtb_list.cod_vlis_rif AS 'cod_vlis_rif'\n" +
" FROM vtb_list\n" +
" INNER JOIN vtb_list_data ON vtb_list.cod_vlis = vtb_list_data.cod_vlis\n" +
" INNER JOIN vtb_list_data vtb_list_data_rif\n" +
" ON vtb_list_data.versione_rif = vtb_list_data_rif.versione AND\n" +
" vtb_list_data.cod_vlis_rif = vtb_list_data_rif.cod_vlis\n" +
" INNER JOIN mtb_lisv_data ON vtb_list_data_rif.cod_vlis = mtb_lisv_data.cod_vlis AND\n" +
" vtb_list_data_rif.versione = mtb_lisv_data.versione\n" +
"\n" +
" WHERE vtb_list_data.data_iniz <= ISNULL(@datavalidita, GETDATE())\n" +
" AND vtb_list.cod_vlis_rif IS NOT NULL\n" +
" GROUP BY vtb_list.cod_vlis,\n" +
" mtb_lisv_data.cod_mart,\n" +
" vtb_list.cod_vlis_rif) tmp_list\n" +
" INNER JOIN vtb_list ON vtb_list.cod_vlis = tmp_list.cod_vlis\n" +
" INNER JOIN mtb_lisv\n" +
" ON tmp_list.cod_vlis_rif = mtb_lisv.cod_vlis AND tmp_list.cod_mart = mtb_lisv.cod_mart\n" +
" INNER JOIN mtb_aart ON tmp_list.cod_mart = mtb_aart.cod_mart\n" +
" LEFT OUTER JOIN mtb_lisv_data ON tmp_list.cod_vlis_rif = mtb_lisv_data.cod_vlis AND\n" +
" tmp_list.cod_mart = mtb_lisv_data.cod_mart AND\n" +
" CONVERT(INT, RIGHT(tmp_list.max_lisv, 5)) = mtb_lisv_data.versione\n" +
" LEFT OUTER JOIN vtb_list_data ON tmp_list.cod_vlis = vtb_list_data.cod_vlis AND\n" +
" CONVERT(INT, RIGHT(tmp_list.max_lisv, 5)) = vtb_list_data.versione\n" +
"\n" +
" WHERE (@codmart IS NULL OR tmp_list.cod_mart = @codmart)\n" +
" AND (@codvlis IS NULL OR tmp_list.cod_vlis = @codvlis)\n");
createOrUpdateFunction("getListinoVenditaPedane","CREATE FUNCTION [dbo].[getListinoVenditaPedane](@datavalidita DATETIME, @codvlis VARCHAR(5), @codmart VARCHAR(15), @pedane INT)\n" +
" RETURNS TABLE AS\n" +
" RETURN\n" +
" WITH trasp AS (SELECT mtb_lisv_data_spese.cod_vlis,\n" +
" mtb_lisv_data_spese.versione,\n" +
" mtb_lisv_data_spese.cod_spes,\n" +
" mtb_lisv_data_spese.perc_ricarico,\n" +
" mtb_lisv_data_spese.val_ricarico,\n" +
" mtb_lisv_data_spese.perc_sconto,\n" +
" mtb_lisv_data_spese.da,\n" +
" mtb_lisv_data_spese.a\n" +
" FROM vtb_list_data\n" +
" --riga Sotto Aggiunta da Massimo 08/01/25 per non fare uscire i range pedane quando il prezzo non deve essere addizionato del costo dei trasporti\n" +
" --inner join vtb_list on vtb_list_data.cod_vlis = vtb_list.cod_vlis and vtb_list.flag_add_trasp = 1\n" +
" INNER JOIN mtb_lisv_data_spese\n" +
" ON vtb_list_data.cod_vlis = mtb_lisv_data_spese.cod_vlis AND\n" +
" vtb_list_data.versione = mtb_lisv_data_spese.versione\n" +
" CROSS APPLY (SELECT MAX(id_listino) AS max_id_listino\n" +
" FROM vtb_list_data t\n" +
" WHERE t.data_iniz <= ISNULL(@datavalidita, CAST(GETDATE() AS DATE))\n" +
" AND vtb_list_data.cod_vlis = t.cod_vlis) max_lisv\n" +
" WHERE vtb_list_data.id_listino = max_lisv.max_id_listino)\n" +
"\n" +
" SELECT list.cod_vlis,\n" +
" list.descrizione,\n" +
" list.data_iniz,\n" +
" list.versione,\n" +
" list.cod_divi,\n" +
" list.cambio,\n" +
" list.flag_arr_prz_iva,\n" +
" list.arr_ric,\n" +
" list.flag_list_iva_inclusa,\n" +
" list.flag_lisv_margine,\n" +
" list.flag_add_trasp,\n" +
" list.cod_mart,\n" +
" list.unt_mis_ven,\n" +
" list.rap_conv,\n" +
" list.prz_base,\n" +
" list.ricarico,\n" +
" list.margine_eff,\n" +
" list.ricarico_eff,\n" +
" list.magg_prz_vend,\n" +
" list.prz_vend,\n" +
" list.prz_vend_iva,\n" +
" list.perc_sco1,\n" +
" list.perc_sco2,\n" +
" list.perc_sco3,\n" +
" list.perc_sco4,\n" +
" list.perc_prov,\n" +
" list.fisso_prov,\n" +
" list.posizione,\n" +
" list.perc_gest,\n" +
" list.val_gest,\n" +
" list.data_agg_prz,\n" +
" list.perc_ispe,\n" +
" list.val_ispe,\n" +
" list.perc_promo,\n" +
" list.val_promo,\n" +
" list.perc_oneri,\n" +
" list.val_oneri,\n" +
" list.tipo_variazione,\n" +
" list.note,\n" +
" list.aggiornato_da,\n" +
" list.prz_vend_netto,\n" +
" list.colli_pedana,\n" +
" list.cod_tcol_ul,\n" +
" list.cod_tcol_ui,\n" +
" list.prz_vend_sug,\n" +
" list.qta_cnf,\n" +
" list.colli_strato,\n" +
" list.descrizione_html,\n" +
" list.colli_pedana_lisv,\n" +
" list.qta_cnf_lisv,\n" +
" list.colli_strato_lisv,\n" +
" list.sconto_cartoni,\n" +
" list.sconto_strato,\n" +
" list.sconto_pedane,\n" +
" list.flag_attivo,\n" +
" list.note_testata,\n" +
" list.flag_prz_bloccato,\n" +
" list.porto,\n" +
" list.system_note,\n" +
" list.add_val_spese,\n" +
" list.add_ric_spese,\n" +
" list.add_sco_spese,\n" +
" list.flag_incl_listino,\n" +
" list.flag_primario,\n" +
" list.id_art_equi,\n" +
" trasp.cod_spes,\n" +
" trasp.perc_ricarico,\n" +
" trasp.val_ricarico,\n" +
" trasp.perc_sconto,\n" +
" trasp.da,\n" +
" trasp.a,\n" +
" (list.prz_vend +\n" +
" IIF(list.flag_add_trasp = 1, --Questa condizione si potrebbe togliere per la modifica fatta l'8/01/25\n" +
" ((ISNULL(val_ricarico, 0)) * list.add_val_spese) /\n" +
" IIF(ISNULL(list.colli_pedana, 1) = 0, 1, list.colli_pedana), 0)) +\n" +
" ((ISNULL(perc_ricarico, 0) * list.add_ric_spese * list.prz_vend) / 100) *\n" +
" (1 - (ISNULL(perc_sconto, 0) * list.add_sco_spese) / 100) prz_vend_trasp,\n" +
" ((list.prz_vend +\n" +
" IIF(list.flag_add_trasp = 1, --Questa condizione si potrebbe togliere per la modifica fatta l'8/01/25\n" +
" ((ISNULL(val_ricarico, 0)) * list.add_val_spese) /\n" +
" IIF(ISNULL(list.colli_pedana, 1) = 0, 1, list.colli_pedana), 0)) +\n" +
" ((ISNULL(perc_ricarico, 0) * list.add_ric_spese * list.prz_vend) / 100) *\n" +
" (1 - (ISNULL(perc_sconto, 0) * list.add_sco_spese) / 100)) * (1 - list.perc_sco1 / 100) *\n" +
" (1 - list.perc_sco2 / 100) *\n" +
" (1 - list.perc_sco3 / 100) *\n" +
" (1 - list.perc_sco4 / 100) AS prz_vend_trasp_netto,\n" +
"\t\t\t list.tipo_um\n" +
" FROM getlistinovendita(@datavalidita, @codvlis, @codmart) list\n" +
" LEFT OUTER JOIN trasp ON list.cod_vlis = trasp.cod_vlis AND\n" +
" (@pedane IS NULL OR @pedane BETWEEN da AND a OR\n" +
" (@pedane IS NOT NULL AND da = 0 AND a = 0))");
}
@Override
public void down() throws Exception {
}
}

View File

@@ -0,0 +1,45 @@
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.entity.StbGestSetup;
import it.integry.ems_model.types.OperationType;
import it.integry.ems_model.utility.UtilityDB;
import it.integry.ems_model.utility.UtilityList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
public class Migration_20251110184508 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
String sql = "SELECT DISTINCT wgsu.gest_name, wgsu.section, wgsu.key_section, 'S' AS flag_setup_user_web\n" +
"FROM wtb_gest_setup_user wgsu\n" +
"WHERE NOT EXISTS(SELECT sgs.gest_name, sgs.section, sgs.key_section\n" +
" FROM stb_gest_setup sgs\n" +
" WHERE wgsu.gest_name = sgs.gest_name\n" +
" AND wgsu.section = sgs.section\n" +
" AND wgsu.key_section = sgs.key_section)";
List<StbGestSetup> stbGestSetupsToCreate = UtilityDB.executeSimpleQueryDTO(connection, sql, StbGestSetup.class);
if (UtilityList.isNullOrEmpty(stbGestSetupsToCreate)) {
return;
}
for (StbGestSetup stbGestSetup : stbGestSetupsToCreate) {
stbGestSetup.setOperation(OperationType.INSERT);
stbGestSetup.manageWithParentConnection(connection);
}
}
@Override
public void down() throws Exception {
}
}

View File

@@ -0,0 +1,31 @@
package it.integry.ems.migration.model;
import it.integry.ems.migration._base.BaseMigration;
import it.integry.ems.migration._base.IntegryCustomer;
import it.integry.ems.migration._base.IntegryCustomerDB;
import it.integry.ems.migration._base.MigrationModelInterface;
public class Migration_20251111110443 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
if (isCustomer(IntegryCustomer.Salpar)){
executeStatement("INSERT INTO stb_tipi_indirizzi\n" +
"VALUES ('PUNTO VENDITA', 'ABRW'),\n" +
" ('PUNTO VENDITA', 'ABTW'),\n" +
" ('PUNTO VENDITA', 'BAMW'),\n" +
" ('PUNTO VENDITA', 'BATW')");
executeStatement("UPDATE vtb_clie_pers_rif\n" +
"SET tipo_indirizzo = 'PUNTO VENDITA'\n" +
"WHERE tipo_indirizzo = 'UFFICIO ACQUISTI'");
}
}
@Override
public void down() throws Exception {
}
}

View File

@@ -0,0 +1,69 @@
package it.integry.ems.migration.model;
import it.integry.ems.migration._base.BaseMigration;
import it.integry.ems.migration._base.MigrationModelInterface;
public class Migration_20251111120322 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
if (isDMS())
return;
createOrUpdateFunction(
"pvm_getassortimentoCliente",
"CREATE FUNCTION [dbo].[pvm_getassortimentoCliente](\n" +
" @codAnag VARCHAR(5), @codVlis VARCHAR(5), @codVdes VARCHAR(5), @dataValidita DATETIME, @viewPromo BIT\n" +
")\n" +
" RETURNS TABLE AS\n" +
" RETURN(SELECT cod_mart,\n" +
" cod_mart_anag,\n" +
" cod_vlis,\n" +
" data_iniz,\n" +
" data_fine,\n" +
" da,\n" +
" a,\n" +
" prz_vend,\n" +
" prz_vend_netto,\n" +
" perc_sco1,\n" +
" perc_sco2,\n" +
" perc_sco3,\n" +
" perc_sco4,\n" +
" perc_prov,\n" +
" qta_residua,\n" +
" id_contratto,\n" +
" rap_conv,\n" +
" note,\n" +
" cod_tcol_ul,\n" +
" unt_mis_ven,\n" +
" colli_pedana,\n" +
" tipo_variazione,\n" +
" tipo_promo,\n" +
" cod_paga,\n" +
" descr_paga,\n" +
" porto,\n" +
" qta_cnf,\n" +
" art_lisv,\n" +
" cod_vdes,\n" +
" note_incoterms,\n" +
" data_rif_scad,\n" +
" note_carico,\n" +
" term_cons,\n" +
" cod_banc,\n" +
" descr_banc,\n" +
" flag_primario\n" +
" FROM [dbo].pvm_getassortimentoClientePedane(\n" +
" @codAnag, @codVlis, @codVdes, @dataValidita, @viewPromo,\n" +
" DEFAULT))"
);
}
@Override
public void down() throws Exception {
}
}

View File

@@ -0,0 +1,30 @@
package it.integry.ems.migration.model;
import it.integry.ems.migration._base.BaseMigration;
import it.integry.ems.migration._base.IntegryCustomerDB;
import it.integry.ems.migration._base.MigrationModelInterface;
public class Migration_20251111151102 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
if (!isCustomerDb(IntegryCustomerDB.Gramm_Gramm))
return;
createSetup("W_VEDI_DESADV_DLG", "SETUP", "VERSIONE_C2835", "20",
null, false, null, false, false,
false, false, false, null, false, null);
createSetup("W_VEDI_DESADV_DLG", "SETUP", "DTM_C2835", "137",
"Qualificatore data ora riferimento (Data documento), per default è impostato a 2", false, null, false, false,
false, false, false, null, false, null);
}
@Override
public void down() throws Exception {
}
}

View File

@@ -0,0 +1,55 @@
package it.integry.ems.migration.model;
import it.integry.ems.migration._base.BaseMigration;
import it.integry.ems.migration._base.IntegryCustomerDB;
import it.integry.ems.migration._base.MigrationModelInterface;
import it.integry.ems_model.entity.JtbCiclCq;
import it.integry.ems_model.entity._enum.TipoValore;
import it.integry.ems_model.types.OperationType;
import it.integry.ems_model.utility.UtilityDB;
import it.integry.ems_model.utility.UtilityInteger;
import it.integry.ems_model.utility.UtilityList;
import java.util.List;
public class Migration_20251111170814 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
if (!isCustomerDb(IntegryCustomerDB.Gramm_Gramm))
return;
String sql = "select distinct jtb_cicl.cod_prod,MAX(jtb_cicl_cq.num_fase) as num_fase,max(jtb_cicl_cq.id_riga) as id_riga\n" +
"from jtb_dist_clav_dir dir\n" +
" inner join jtb_cicl on dir.cod_prod = jtb_cicl.cod_prod\n" +
" left outer join jtb_cicl_cq on jtb_cicl.cod_prod = jtb_cicl_cq.cod_prod\n" +
"where dir.cod_jfas like 'SC%'\n" +
" and jtb_cicl.flag_attiva = 'S'\n" +
"group by jtb_cicl.cod_prod";
List<JtbCiclCq> distinteDaAggiornare = UtilityDB.executeSimpleQueryDTO(connection, sql, JtbCiclCq.class);
if (UtilityList.isNullOrEmpty(distinteDaAggiornare))
return;
for (JtbCiclCq jtbCiclCq : distinteDaAggiornare) {
jtbCiclCq.setIdRiga(UtilityInteger.isNull(jtbCiclCq.getIdRiga(),0) + 1)
.setNumFase(UtilityInteger.isNull(jtbCiclCq.getNumFase(),0))
.setControllo("Check Etichetta Cartone")
.setTipoValore(TipoValore.BOOLEAN)
.setValoreRif("S")
.setNumRip(0)
.setTipologia("DETAILED_CQ")
.setOperation(OperationType.INSERT);
jtbCiclCq.manageWithParentConnection(connection);
}
}
@Override
public void down() throws Exception {
}
}

View File

@@ -0,0 +1,51 @@
package it.integry.ems.migration.model;
import it.integry.ems.migration._base.BaseMigration;
import it.integry.ems.migration._base.MigrationModelInterface;
public class Migration_20251111171747 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
if (isDMS())
return;
createOrUpdateFunction("lisv_getTipoUm", "CREATE FUNCTION dbo.lisv_getTipoUm\n" +
"( \n" +
" @codMart varchar(15), @tipoUmLisv tinyint\n" +
")\n" +
"RETURNS TABLE \n" +
"AS\n" +
"RETURN \n" +
"(\n" +
" with um as (\n" +
"select cod_mart, unt_mis, rap_conv\n" +
"from dbo.getUntMisArticolo(@codMart, null ) um\n" +
"where @tipoUmLisv is not null\n" +
"and ( (@tipoUmLisv = 1 and um.tipo_um = 'UI' ) or \n" +
"(@tipoUmLisv = 2 and flag_unita_kg = 'S'))\n" +
")\n" +
"\n" +
"select mtb_aart.cod_mart, \n" +
"case \n" +
"when @tipoUmLisv IS null then mtb_aart.unt_mis\n" +
"when @tipoUmLisv = 1 and mtb_aart.qta_cnf not in (0, 1) then mtb_aart.unt_mis\n" +
"when @tipoUmLisv = 2 and mtb_aart.peso_kg not in (0, 1) then mtb_aart.unt_mis\n" +
" else ISNULL(um.unt_mis, mtb_aart.unt_mis) end as unt_mis_ven, \n" +
"case \n" +
"when @tipoUmLisv IS null then 1\n" +
"when @tipoUmLisv = 1 and mtb_aart.qta_cnf not in (0, 1) then 1\n" +
"when @tipoUmLisv = 2 and mtb_aart.peso_kg not in (0, 1) then 1\n" +
" else ISNULL(um.rap_conv, 1) end as rap_conv_vend\n" +
"from mtb_aart left outer join um on mtb_aart.cod_mart = um.cod_mart\n" +
"where (@codMart is null or mtb_aart.cod_mart = @codMart )\n" +
")");
}
@Override
public void down() throws Exception {
}
}

View File

@@ -0,0 +1,19 @@
package it.integry.ems.migration.model;
import it.integry.ems.migration._base.BaseMigration;
import it.integry.ems.migration._base.MigrationModelInterface;
public class Migration_20251113102040 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
executeStatement("ALTER TABLE vtb_list_data ADD promo_chiusa bit DEFAULT 0 NOT NULL");
}
@Override
public void down() throws Exception {
}
}

View File

@@ -0,0 +1,208 @@
package it.integry.ems.migration.model;
import it.integry.ems.migration._base.BaseMigration;
import it.integry.ems.migration._base.MigrationModelInterface;
public class Migration_20251113105159 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
executeStatement("exec sp_rename 'vtb_list_data.promo_chiusa', 'chiusura_immediata'");
createOrUpdateFunction("getPromozioneVendita", "CREATE FUNCTION [dbo].[getPromozioneVendita](@dataIniz DATETIME, @dataFine DATETIME, @codVlis VARCHAR(5),\n" +
" @codPromo VARCHAR(10), @codMart VARCHAR(15))\n" +
" RETURNS TABLE AS\n" +
" RETURN\n" +
" SELECT vtb_list.cod_vlis,\n" +
" vtb_list.descrizione,\n" +
" vtb_list_data.data_iniz,\n" +
" vtb_list_data.data_fine,\n" +
" vtb_list_data.cod_promo,\n" +
" vtb_list_data.versione,\n" +
" vtb_list.cod_divi,\n" +
" vtb_list.flag_arr_prz_iva,\n" +
" vtb_list.arr_ric,\n" +
" vtb_list.flag_list_iva_inclusa,\n" +
" vtb_list.flag_lisv_margine,\n" +
" mtb_lisv_data.cod_mart AS cod_mart,\n" +
" mtb_lisv_data.unt_mis_ven AS unt_mis_ven,\n" +
" mtb_lisv_data.rap_conv AS rap_conv,\n" +
" mtb_lisv_data.prz_base AS prz_base,\n" +
" mtb_lisv_data.ricarica AS ricarico,\n" +
" --dbo.f_calcMargineEffettivo(mtb_lisv_data.prz_base, mtb_lisv_data.prz_vend, mtb_aart.perc_sfrido) as margine_eff,\n" +
" --dbo.f_calcRicaricoEffettivo(mtb_lisv_data.prz_base, mtb_lisv_data.prz_vend, mtb_aart.perc_sfrido) as ricarico_eff, \n" +
" CASE\n" +
" WHEN mtb_lisv_data.prz_vend IS NOT NULL AND mtb_lisv_data.prz_vend <> 0 THEN\n" +
" ROUND((ISNULL(mtb_lisv_data.prz_vend, 0) -\n" +
" (ISNULL(mtb_lisv_data.prz_base, 0) / (1 - mtb_aart.perc_sfrido / 100))) /\n" +
" ISNULL(mtb_lisv_data.prz_vend, 0) * 100, 2)\n" +
" ELSE 0 END AS margine_eff,\n" +
" CASE\n" +
" WHEN mtb_lisv_data.prz_base IS NOT NULL AND mtb_lisv_data.prz_base <> 0 THEN\n" +
" ROUND((ISNULL(mtb_lisv_data.prz_vend, 0) -\n" +
" (ISNULL(mtb_lisv_data.prz_base, 0) / (1 - mtb_aart.perc_sfrido / 100))) /\n" +
" (ISNULL(mtb_lisv_data.prz_base, 0) / (1 - mtb_aart.perc_sfrido / 100)) * 100, 2)\n" +
" ELSE 0 END AS ricarico_eff,\n" +
" mtb_lisv_data.prz_vend AS prz_vend,\n" +
" mtb_lisv_data.prz_vend_iva AS prz_vend_iva,\n" +
" mtb_lisv_data.perc_sco1 AS perc_sco1,\n" +
" mtb_lisv_data.perc_sco2 AS perc_sco2,\n" +
" mtb_lisv_data.perc_sco3 AS perc_sco3,\n" +
" mtb_lisv_data.perc_sco4 AS perc_sco4,\n" +
" mtb_lisv_data.perc_prov AS perc_prov,\n" +
" mtb_lisv_data.fisso_prov AS fisso_prov,\n" +
" mtb_lisv_data.posizione AS posizione,\n" +
" mtb_lisv_data.perc_gest AS perc_gest,\n" +
" mtb_lisv_data.val_gest AS val_gest,\n" +
" mtb_lisv_data.data_agg_prz AS data_agg_prz,\n" +
" mtb_lisv_data.perc_ispe AS perc_ispe,\n" +
" mtb_lisv_data.val_ispe AS val_ispe,\n" +
" mtb_lisv_data.perc_promo AS perc_promo,\n" +
" mtb_lisv_data.val_promo AS val_promo,\n" +
" mtb_lisv_data.perc_oneri AS perc_oneri,\n" +
" mtb_lisv_data.val_oneri AS val_oneri,\n" +
" mtb_lisv_data.tipo_variazione AS tipo_variazione,\n" +
" mtb_lisv_data.note AS note,\n" +
" mtb_lisv_data.aggiornato_da AS aggiornato_da,\n" +
" mtb_lisv_data.prz_vend * (1 - mtb_lisv_data.perc_sco1 / 100) * (1 - mtb_lisv_data.perc_sco2 / 100) *\n" +
" (1 - mtb_lisv_data.perc_sco3 / 100) * (1 - mtb_lisv_data.perc_sco4 / 100) AS prz_vend_netto,\n" +
" vtb_promo.descrizione AS 'descr_promo',\n" +
" vtb_promo.data_iniz_sell_out,\n" +
" vtb_promo.data_fine_sell_out,\n" +
" vtb_promo.flag_tipo_promo,\n" +
" mtb_lisv_data.sconto_cartoni,\n" +
" mtb_lisv_data.sconto_strato,\n" +
" mtb_lisv_data.sconto_pedane,\n" +
" mtb_lisv_data.giacenza,\n" +
" mtb_lisv_data.magg_prz_vend,\n" +
" vtb_promo.flag_sconto_contrattuale,\n" +
" vtb_promo.intercode_xml_variazioni,\n" +
" vtb_list_data.note AS note_testata,\n" +
" vtb_promo.flag_tipologia,\n" +
" vtb_promo.flag_volantino,\n" +
" mtb_lisv_data.inserito_da,\n" +
" vtb_list_data.chiusura_immediata\n" +
" FROM vtb_list\n" +
" INNER JOIN vtb_list_data ON vtb_list.cod_vlis = vtb_list_data.cod_vlis\n" +
" INNER JOIN mtb_lisv_data ON vtb_list_data.cod_vlis = mtb_lisv_data.cod_vlis AND\n" +
" vtb_list_data.versione = mtb_lisv_data.versione\n" +
" INNER JOIN mtb_aart ON mtb_lisv_data.cod_mart = mtb_aart.cod_mart\n" +
" INNER JOIN vtb_promo ON vtb_list_data.cod_promo = vtb_promo.cod_promo\n" +
" OUTER APPLY (SELECT COUNT(*) AS conta\n" +
" FROM vtb_list_data rif\n" +
" WHERE vtb_list_data.cod_vlis = rif.cod_vlis_rif\n" +
" AND vtb_list_data.versione = rif.versione) list_rif\n" +
" WHERE (@codMart IS NULL OR mtb_lisv_data.cod_mart = @codMart)\n" +
" AND (@codvlis IS NULL OR vtb_list_data.cod_vlis = @codVlis)\n" +
" AND vtb_list.cod_vlis_rif IS NULL\n" +
" AND (@codPromo IS NULL OR vtb_list_data.cod_promo = @codPromo)\n" +
" AND (((@dataFine IS NULL OR ISNULL(@dataIniz, CAST(GETDATE() AS DATE)) = @dataFine) AND\n" +
" ISNULL(@dataIniz, CAST(GETDATE() AS DATE)) BETWEEN vtb_list_data.data_iniz AND vtb_list_data.data_fine) OR\n" +
" (@dataFine IS NOT NULL AND ISNULL(@dataIniz, CAST(GETDATE() AS DATE)) <> @dataFine AND\n" +
" (vtb_list_data.data_iniz BETWEEN ISNULL(@dataIniz, CAST(GETDATE() AS DATE)) AND @dataFine OR\n" +
" vtb_list_data.data_fine BETWEEN ISNULL(@dataIniz, CAST(GETDATE() AS DATE)) AND @dataFine OR\n" +
" ISNULL(@dataIniz, CAST(GETDATE() AS DATE)) BETWEEN vtb_list_data.data_iniz AND vtb_list_data.data_fine OR\n" +
" @dataFine BETWEEN vtb_list_data.data_iniz AND vtb_list_data.data_fine)))\n" +
" AND (vtb_promo.flag_sconto_contrattuale = 'N' OR\n" +
" (vtb_promo.flag_sconto_contrattuale = 'S' AND list_rif.conta = 0))\n" +
" UNION\n" +
" SELECT vtb_list.cod_vlis,\n" +
" vtb_list.descrizione,\n" +
" vtb_list_data.data_iniz,\n" +
" vtb_list_data.data_fine,\n" +
" vtb_list_data.cod_promo,\n" +
" vtb_list_data.versione,\n" +
" vtb_list.cod_divi,\n" +
" vtb_list.flag_arr_prz_iva,\n" +
" vtb_list.arr_ric,\n" +
" vtb_list.flag_list_iva_inclusa,\n" +
" vtb_list.flag_lisv_margine,\n" +
" mtb_lisv_data.cod_mart AS cod_mart,\n" +
" mtb_lisv_data.unt_mis_ven AS unt_mis_ven,\n" +
" mtb_lisv_data.rap_conv AS rap_conv,\n" +
" mtb_lisv_data.prz_base AS prz_base,\n" +
" mtb_lisv_data.ricarica AS ricarico,\n" +
" --dbo.f_calcMargineEffettivo(mtb_lisv_data.prz_base, mtb_lisv_data.prz_vend, mtb_aart.perc_sfrido) as margine_eff,\n" +
" --dbo.f_calcRicaricoEffettivo(mtb_lisv_data.prz_base, mtb_lisv_data.prz_vend, mtb_aart.perc_sfrido) as ricarico_eff, \n" +
" CASE\n" +
" WHEN mtb_lisv_data.prz_vend IS NOT NULL AND mtb_lisv_data.prz_vend <> 0 THEN\n" +
" ROUND((ISNULL(mtb_lisv_data.prz_vend, 0) -\n" +
" (ISNULL(mtb_lisv_data.prz_base, 0) / (1 - mtb_aart.perc_sfrido / 100))) /\n" +
" ISNULL(mtb_lisv_data.prz_vend, 0) * 100, 2)\n" +
" ELSE 0 END AS margine_eff,\n" +
" CASE\n" +
" WHEN mtb_lisv_data.prz_base IS NOT NULL AND mtb_lisv_data.prz_base <> 0 THEN\n" +
" ROUND((ISNULL(mtb_lisv_data.prz_vend, 0) -\n" +
" (ISNULL(mtb_lisv_data.prz_base, 0) / (1 - mtb_aart.perc_sfrido / 100))) /\n" +
" (ISNULL(mtb_lisv_data.prz_base, 0) / (1 - mtb_aart.perc_sfrido / 100)) * 100, 2)\n" +
" ELSE 0 END AS ricarico_eff,\n" +
" mtb_lisv_data.prz_vend AS prz_vend,\n" +
" mtb_lisv_data.prz_vend_iva AS prz_vend_iva,\n" +
" mtb_lisv_data.perc_sco1 AS perc_sco1,\n" +
" mtb_lisv_data.perc_sco2 AS perc_sco2,\n" +
" mtb_lisv_data.perc_sco3 AS perc_sco3,\n" +
" mtb_lisv_data.perc_sco4 AS perc_sco4,\n" +
" mtb_lisv_data.perc_prov AS perc_prov,\n" +
" mtb_lisv_data.fisso_prov AS fisso_prov,\n" +
" mtb_lisv_data.posizione AS posizione,\n" +
" mtb_lisv_data.perc_gest AS perc_gest,\n" +
" mtb_lisv_data.val_gest AS val_gest,\n" +
" mtb_lisv_data.data_agg_prz AS data_agg_prz,\n" +
" mtb_lisv_data.perc_ispe AS perc_ispe,\n" +
" mtb_lisv_data.val_ispe AS val_ispe,\n" +
" mtb_lisv_data.perc_promo AS perc_promo,\n" +
" mtb_lisv_data.val_promo AS val_promo,\n" +
" mtb_lisv_data.perc_oneri AS perc_oneri,\n" +
" mtb_lisv_data.val_oneri AS val_oneri,\n" +
" mtb_lisv_data.tipo_variazione AS tipo_variazione,\n" +
" mtb_lisv_data.note AS note,\n" +
" mtb_lisv_data.aggiornato_da AS aggiornato_da,\n" +
" mtb_lisv_data.prz_vend * (1 - mtb_lisv_data.perc_sco1 / 100) * (1 - mtb_lisv_data.perc_sco2 / 100) *\n" +
" (1 - mtb_lisv_data.perc_sco3 / 100) * (1 - mtb_lisv_data.perc_sco4 / 100) AS prz_vend_netto,\n" +
" vtb_promo.descrizione AS 'descr_promo',\n" +
" vtb_promo.data_iniz_sell_out,\n" +
" vtb_promo.data_fine_sell_out,\n" +
" vtb_promo.flag_tipo_promo,\n" +
" mtb_lisv_data.sconto_cartoni,\n" +
" mtb_lisv_data.sconto_strato,\n" +
" mtb_lisv_data.sconto_pedane,\n" +
" mtb_lisv_data.giacenza,\n" +
" mtb_lisv_data.magg_prz_vend,\n" +
" vtb_promo.flag_sconto_contrattuale,\n" +
" vtb_promo.intercode_xml_variazioni,\n" +
" vtb_list_data.note AS note_testata,\n" +
" vtb_promo.flag_tipologia,\n" +
" vtb_promo.flag_volantino,\n" +
" mtb_lisv_data.inserito_da,\n" +
" vtb_list_data_rif.chiusura_immediata\n" +
" FROM vtb_list\n" +
" INNER JOIN vtb_list_data ON vtb_list.cod_vlis = vtb_list_data.cod_vlis\n" +
" INNER JOIN vtb_list_data vtb_list_data_rif\n" +
" ON vtb_list_data.cod_vlis_rif = vtb_list_data_rif.cod_vlis AND\n" +
" vtb_list_data.versione_rif = vtb_list_data_rif.versione\n" +
" INNER JOIN mtb_lisv_data ON vtb_list_data_rif.cod_vlis = mtb_lisv_data.cod_vlis AND\n" +
" vtb_list_data_rif.versione = mtb_lisv_data.versione\n" +
" INNER JOIN mtb_aart ON mtb_lisv_data.cod_mart = mtb_aart.cod_mart\n" +
" INNER JOIN vtb_promo ON vtb_list_data_rif.cod_promo = vtb_promo.cod_promo\n" +
" WHERE (@codMart IS NULL OR mtb_lisv_data.cod_mart = @codMart)\n" +
" AND (@codvlis IS NULL OR vtb_list_data.cod_vlis = @codVlis)\n" +
" AND (@codPromo IS NULL OR vtb_list_data.cod_promo = @codPromo)\n" +
" AND (((@dataFine IS NULL OR ISNULL(@dataIniz, CAST(GETDATE() AS DATE)) = @dataFine) AND\n" +
" ISNULL(@dataIniz, CAST(GETDATE() AS DATE)) BETWEEN vtb_list_data.data_iniz AND vtb_list_data.data_fine) OR\n" +
" (@dataFine IS NOT NULL AND ISNULL(@dataIniz, CAST(GETDATE() AS DATE)) <> @dataFine AND\n" +
" (vtb_list_data.data_iniz BETWEEN ISNULL(@dataIniz, CAST(GETDATE() AS DATE)) AND @dataFine OR\n" +
" vtb_list_data.data_fine BETWEEN ISNULL(@dataIniz, CAST(GETDATE() AS DATE)) AND @dataFine OR\n" +
" ISNULL(@dataIniz, CAST(GETDATE() AS DATE)) BETWEEN vtb_list_data.data_iniz AND vtb_list_data.data_fine OR\n" +
" @dataFine BETWEEN vtb_list_data.data_iniz AND vtb_list_data.data_fine)))");
}
@Override
public void down() throws Exception {
}
}

View File

@@ -0,0 +1,50 @@
package it.integry.ems.migration.model;
import it.integry.ems.migration._base.BaseMigration;
import it.integry.ems.migration._base.MigrationModelInterface;
public class Migration_20251113122313 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
createOrUpdateFunction("lisv_getTipoUm", "CREATE FUNCTION [dbo].[lisv_getTipoUm]\n" +
"(\t\n" +
"\t@codMart varchar(15), @tipoUmLisv tinyint\n" +
")\n" +
"RETURNS TABLE \n" +
"AS\n" +
"RETURN \n" +
"(\n" +
"\twith um as (\n" +
"select cod_mart, unt_mis, rap_conv\n" +
"from dbo.getUntMisArticolo(@codMart, null ) um\n" +
"where @tipoUmLisv is not null\n" +
"and ( (@tipoUmLisv = 1 and um.tipo_um = 'UI' ) or \n" +
"(@tipoUmLisv = 2 and flag_unita_kg = 'S'))\n" +
")\n" +
"\n" +
"select mtb_aart.cod_mart, \n" +
"case \n" +
"when @tipoUmLisv IS null then mtb_aart.unt_mis\n" +
"when @tipoUmLisv = 1 and mtb_aart.qta_cnf in (0, 1) then mtb_aart.unt_mis\n" +
"when @tipoUmLisv = 2 and mtb_aart.peso_kg in (0, 1) then mtb_aart.unt_mis\n" +
"\telse ISNULL(um.unt_mis, mtb_aart.unt_mis) end as unt_mis_ven, \n" +
"case \n" +
"when @tipoUmLisv IS null then 1\n" +
"when @tipoUmLisv = 1 and mtb_aart.qta_cnf in (0, 1) then 1\n" +
"when @tipoUmLisv = 2 and mtb_aart.peso_kg in (0, 1) then 1\n" +
"\telse ISNULL(um.rap_conv, 1) end as rap_conv_vend\n" +
"from mtb_aart left outer join um on mtb_aart.cod_mart = um.cod_mart\n" +
"where (@codMart is null or mtb_aart.cod_mart = @codMart )\n" +
")");
executeStatement("alter table mtb_var_lisv_log alter column versione int null");
}
@Override
public void down() throws Exception {
}
}

View File

@@ -0,0 +1,19 @@
package it.integry.ems.migration.model;
import it.integry.ems.migration._base.BaseMigration;
import it.integry.ems.migration._base.MigrationModelInterface;
public class Migration_20251113170159 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
executeStatement("ALTER TABLE wdtb_doct ADD merce_ricevuta BIT DEFAULT 0 NOT NULL");
}
@Override
public void down() throws Exception {
}
}

View File

@@ -0,0 +1,20 @@
package it.integry.ems.migration.model;
import it.integry.ems.migration._base.BaseMigration;
import it.integry.ems.migration._base.MigrationModelInterface;
public class Migration_20251114114334 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
executeStatement("ALTER TABLE ctb_amac DROP COLUMN cod_mdep;");
}
@Override
public void down() throws Exception {
}
}

View File

@@ -0,0 +1,19 @@
package it.integry.ems.migration.model;
import it.integry.ems.migration._base.BaseMigration;
import it.integry.ems.migration._base.MigrationModelInterface;
public class Migration_20251114150912 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
executeStatement("ALTER TABLE jtb_comt ADD data_mod DATETIME");
}
@Override
public void down() throws Exception {
}
}

View File

@@ -0,0 +1,21 @@
package it.integry.ems.migration.model;
import it.integry.ems.migration._base.BaseMigration;
import it.integry.ems.migration._base.MigrationModelInterface;
public class Migration_20251114163222 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
executeStatement("ALTER TABLE vtb_dest ADD data_mod DATETIME");
executeStatement("ALTER TABLE ptb_pros ADD data_mod DATETIME");
executeStatement("ALTER TABLE ptb_pros_rif ADD data_mod DATETIME");
}
@Override
public void down() throws Exception {
}
}

View File

@@ -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_20251117142928 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("W_jriep_presenze_dip_disp", "SETUP", "SET_DATA_FINE", "N",
"imposta data fine = fine mese", false, "SI_NO", false, false,
false, false, false, null, false, "SELECT 'S' UNION ALL SELECT 'N'");
if (isCustomer(IntegryCustomer.Integry))
updateSetupValue("W_jriep_presenze_dip_disp", "SETUP", "SET_DATA_FINE", "S");
}
@Override
public void down() throws Exception {
}
}

View File

@@ -0,0 +1,33 @@
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_20251117170957 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
if (!isCustomerDb(IntegryCustomerDB.Gramm_Gramm))
return;
executeStatement("update stb_gest_setup set value = 'S' where gest_name = 'DTB_ORDT' and key_section in ('NUOVA_PROCEDURA','DISABLE_TRIGGER_ORDL')");
executeStatement("update stb_gest_sync set syncronize = 'R' where gest_name like 'lord%'");
executeStatement("update stb_gest_sync set syncronize = 'R' where gest_name like 'pord%'");
executeStatement("insert into stb_abil \n" +
"select case when gest_name = 'lordi' then 'LG081' else 'AG031' end , user_name, 'S', case when gest_name = 'lordi' then 'lordi_tab' else 'pordi_tab' end from stb_abil \n" +
"where gest_name in ('lordi','pordi') and case when gest_name = 'lordi' then 'LG081' else 'AG031' end + user_name not in (select cod_opz + user_name from stb_abil where cod_opz in ('LG081','AG031'))");
executeStatement("update stb_abil set flag_abil = 'N' where gest_name in ('lordi','pordi')");
}
@Override
public void down() throws Exception {
}
}

View File

@@ -8,7 +8,10 @@ public enum IntegryApplicationEnum {
TASK("478f3a4c51824ad23cb50c1c60670c0f"), TASK("478f3a4c51824ad23cb50c1c60670c0f"),
SALESBOOK("f0484398-1f8b-42f5-ab79-5282c164e1d8"), SALESBOOK("f0484398-1f8b-42f5-ab79-5282c164e1d8"),
CONSEGNA("c012124f-4f11-471c-ae12-81bd4a97626c"), CONSEGNA("c012124f-4f11-471c-ae12-81bd4a97626c"),
WINCLOCK("54ceebf0-494f-49f1-850b-b15c57666146"); WINCLOCK("54ceebf0-494f-49f1-850b-b15c57666146"),
//Service Applications
SERVICE_EUROFORK_CONNECTOR("eadadd1c-13bb-4aae-87fd-4672573f8088");
private final String text; private final String text;

View File

@@ -30,7 +30,7 @@ public class AccountingBusinessLogic {
.setCodAnag(ctbMovt.getCodAnag()) .setCodAnag(ctbMovt.getCodAnag())
.setCodVage(ctbMovt.getCodVage()) .setCodVage(ctbMovt.getCodVage())
.setAnnoPart(annoPart) .setAnnoPart(annoPart)
.setDataDoc(ctbMovt.getDataDoc()) .setDataDoc(UtilityLocalDate.localDateFromDate(ctbMovt.getDataDoc()))
.setSerDoc(ctbMovt.getSerDoc()) .setSerDoc(ctbMovt.getSerDoc())
.setNumDoc(ctbMovt.getNumDoc()) .setNumDoc(ctbMovt.getNumDoc())
.setCodDiviCont(ctbMovt.getCodDiviCont()) .setCodDiviCont(ctbMovt.getCodDiviCont())
@@ -68,7 +68,7 @@ public class AccountingBusinessLogic {
"Attezione, codice pagamento non presente nel documento %s/%s del %s, %s %s", "Attezione, codice pagamento non presente nel documento %s/%s del %s, %s %s",
testata.getSerDoc(), testata.getSerDoc(),
testata.getNumDoc(), testata.getNumDoc(),
new SimpleDateFormat(CommonConstants.DATE_FORMAT_DMY).format(testata.getDataDoc()), new SimpleDateFormat(CommonConstants.DATE_FORMAT_DMY_SLASHED).format(testata.getDataDoc()),
(testata.getTipoAnag().equalsIgnoreCase("F") ? "fornitore" : "cliente"), (testata.getTipoAnag().equalsIgnoreCase("F") ? "fornitore" : "cliente"),
testata.getCodAnag())); testata.getCodAnag()));
@@ -120,7 +120,7 @@ public class AccountingBusinessLogic {
"Convert(numeric(20,5), importo_enasarco * cambio_divi_cont) as importo_enasarco " + "Convert(numeric(20,5), importo_enasarco * cambio_divi_cont) as importo_enasarco " +
" FROM ctb_rit_acc " + " FROM ctb_rit_acc " +
" WHERE num_cmov_fat = " + UtilityDB.valueToString(testata.getNumCmov()) + " AND " + " WHERE num_cmov_fat = " + UtilityDB.valueToString(testata.getNumCmov()) + " AND " +
" data_doc = " + UtilityDB.valueDateToString(testata.getDataDoc(), CommonConstants.DATE_FORMAT_YMD) + " AND " + " data_doc = " + UtilityDB.valueToString(testata.getDataDoc()) + " AND " +
" ser_doc = " + UtilityDB.valueToString(testata.getSerDoc()) + " AND " + " ser_doc = " + UtilityDB.valueToString(testata.getSerDoc()) + " AND " +
" num_doc = " + UtilityDB.valueToString(testata.getNumDoc()); " num_doc = " + UtilityDB.valueToString(testata.getNumDoc());
@@ -142,7 +142,7 @@ public class AccountingBusinessLogic {
.setAnnoPart(annoPart) .setAnnoPart(annoPart)
.setSerDoc(testata.getSerDoc()) .setSerDoc(testata.getSerDoc())
.setNumDoc(testata.getNumDoc()) .setNumDoc(testata.getNumDoc())
.setDataScad(testata.getDataDoc()); .setDataScad(UtilityLocalDate.localDateFromDate(testata.getDataDoc()));
if (testata.getTipoPartitaEnum() == TipoPartita.ATTIVA) { if (testata.getTipoPartitaEnum() == TipoPartita.ATTIVA) {
ctbScad.setImpDare(ritenuta); ctbScad.setImpDare(ritenuta);
ctbScad.setImpAvere(BigDecimal.ZERO); ctbScad.setImpAvere(BigDecimal.ZERO);
@@ -166,7 +166,7 @@ public class AccountingBusinessLogic {
.setAnnoPart(annoPart) .setAnnoPart(annoPart)
.setSerDoc(testata.getSerDoc()) .setSerDoc(testata.getSerDoc())
.setNumDoc(testata.getNumDoc()) .setNumDoc(testata.getNumDoc())
.setDataScad(testata.getDataDoc()); .setDataScad(UtilityLocalDate.localDateFromDate(testata.getDataDoc()));
if (testata.getTipoPartitaEnum() == TipoPartita.ATTIVA) { if (testata.getTipoPartitaEnum() == TipoPartita.ATTIVA) {
ctbScad.setImpDare(enasarco); ctbScad.setImpDare(enasarco);
ctbScad.setImpAvere(BigDecimal.ZERO); ctbScad.setImpAvere(BigDecimal.ZERO);
@@ -186,7 +186,7 @@ public class AccountingBusinessLogic {
"SELECT " + UtilityDB.valueToString(testata.getCodAnag()) + " as cod_anag, " "SELECT " + UtilityDB.valueToString(testata.getCodAnag()) + " as cod_anag, "
+ UtilityDB.valueToString(testata.getTipoAnag()) + " as tipo_anag, " + UtilityDB.valueToString(testata.getTipoAnag()) + " as tipo_anag, "
+ "Cast(" + UtilityDB.valueToString(annoPart) + " as int) as anno_part, " + "Cast(" + UtilityDB.valueToString(annoPart) + " as int) as anno_part, "
+ "Convert(datetime, " + UtilityDB.valueDateToString(testata.getDataDoc(), CommonConstants.DATE_FORMAT_YMD) + ") as data_doc, " + "Convert(datetime, " + UtilityDB.valueDateToString(testata.getDataDoc(), CommonConstants.DATE_FORMAT_YMD_SLASHED) + ") as data_doc, "
+ UtilityDB.valueToString(testata.getSerDoc()) + " as ser_doc, " + UtilityDB.valueToString(testata.getSerDoc()) + " as ser_doc, "
+ "Cast( " + UtilityDB.valueToString(testata.getNumDoc()) + " as int ) as num_doc, " + "Cast( " + UtilityDB.valueToString(testata.getNumDoc()) + " as int ) as num_doc, "
+ UtilityDB.valueToString(testata.getCodPaga()) + " as cod_paga, " + UtilityDB.valueToString(testata.getCodPaga()) + " as cod_paga, "
@@ -340,7 +340,7 @@ public class AccountingBusinessLogic {
+ "ctb_caur_rc.cod_ccon as 'cod_ccon'," + "ctb_caur_rc.cod_ccon as 'cod_ccon',"
+ "ctb_caur_rc.tipo_anag as 'tipo_anag', " + "ctb_caur_rc.tipo_anag as 'tipo_anag', "
+ "CASE WHEN ctb_caur_rc.tipo_anag is not null and ctb_grup.tipo = 2 and ctb_grup.sezione = 1 then " + UtilityDB.valueToString(testata.getCodAnag()) + " else null end as 'cod_anag', " + "CASE WHEN ctb_caur_rc.tipo_anag is not null and ctb_grup.tipo = 2 and ctb_grup.sezione = 1 then " + UtilityDB.valueToString(testata.getCodAnag()) + " else null end as 'cod_anag', "
+ "CAST(CASE WHEN ctb_caur_rc.tipo_anag is not null and ctb_grup.tipo = 2 and ctb_grup.sezione = 1 then Cast(DatePart(yy, " + UtilityDB.valueDateToString(testata.getDataDoc(), CommonConstants.DATE_FORMAT_YMD) + ") as varchar) else null end as int) as 'anno_part', " + "CAST(CASE WHEN ctb_caur_rc.tipo_anag is not null and ctb_grup.tipo = 2 and ctb_grup.sezione = 1 then Cast(DatePart(yy, " + UtilityDB.valueDateToString(testata.getDataDoc(), CommonConstants.DATE_FORMAT_YMD_SLASHED) + ") as varchar) else null end as int) as 'anno_part', "
+ "CASE WHEN ctb_caur_rc.tipo_anag is not null and ctb_grup.tipo = 2 and ctb_grup.sezione = 1 then " + UtilityDB.valueToString(testata.getSerDoc()) + " else null end as 'ser_doc', " + "CASE WHEN ctb_caur_rc.tipo_anag is not null and ctb_grup.tipo = 2 and ctb_grup.sezione = 1 then " + UtilityDB.valueToString(testata.getSerDoc()) + " else null end as 'ser_doc', "
+ "CAST( CASE WHEN ctb_caur_rc.tipo_anag is not null and ctb_grup.tipo = 2 and ctb_grup.sezione = 1 then " + UtilityDB.valueToString(testata.getNumDoc()) + " else null end as int) as 'num_doc', " + "CAST( CASE WHEN ctb_caur_rc.tipo_anag is not null and ctb_grup.tipo = 2 and ctb_grup.sezione = 1 then " + UtilityDB.valueToString(testata.getNumDoc()) + " else null end as int) as 'num_doc', "
+ "CONVERT ( numeric(20,5), CASE ctb_caur_rc.imp_dare " + "CONVERT ( numeric(20,5), CASE ctb_caur_rc.imp_dare "
@@ -413,10 +413,17 @@ public class AccountingBusinessLogic {
} }
public static BigDecimal pagaScadenze(Date dataCmov, BigDecimal residuo, List<CtbScad> elencoScadenze) { public static BigDecimal pagaScadenze(Date dataCmov, BigDecimal residuo, List<CtbScad> elencoScadenze) {
return pagaScadenze(dataCmov, residuo, elencoScadenze, null); return pagaScadenze(UtilityLocalDate.localDateFromDate(dataCmov), residuo, elencoScadenze, null);
} }
public static BigDecimal pagaScadenze(Date dataCmov, BigDecimal residuo, List<CtbScad> elencoScadenze, Integer idRigaMov) { public static BigDecimal pagaScadenze(Date dataCmov, BigDecimal residuo, List<CtbScad> elencoScadenze, Integer idRigaMov) {
return pagaScadenze(UtilityLocalDate.localDateFromDate(dataCmov), residuo, elencoScadenze, idRigaMov);
}
public static BigDecimal pagaScadenze(LocalDate dataCmov, BigDecimal residuo, List<CtbScad> elencoScadenze) {
return pagaScadenze(dataCmov, residuo, elencoScadenze, null);
}
public static BigDecimal pagaScadenze(LocalDate dataCmov, BigDecimal residuo, List<CtbScad> elencoScadenze, Integer idRigaMov) {
long countScad = long countScad =
Stream.of(elencoScadenze) Stream.of(elencoScadenze)
.distinctBy(x -> .distinctBy(x ->
@@ -554,7 +561,7 @@ public class AccountingBusinessLogic {
String whereCond = String.format("%s BETWEEN data_iniz AND data_fine", UtilityDB.valueToString(data)); String whereCond = String.format("%s BETWEEN data_iniz AND data_fine", UtilityDB.valueToString(data));
GtbPeriodoFisc gtbPeriodoFisc = getPeriodoFisc(conn, whereCond); GtbPeriodoFisc gtbPeriodoFisc = getPeriodoFisc(conn, whereCond);
if (gtbPeriodoFisc == null) { if (gtbPeriodoFisc == null) {
throw new Exception("Impossibile individuare il periodo fiscale per la data " + new SimpleDateFormat(CommonConstants.DATE_FORMAT_DMY).format(data)); throw new Exception("Impossibile individuare il periodo fiscale per la data " + new SimpleDateFormat(CommonConstants.DATE_FORMAT_DMY_SLASHED).format(data));
} }
return gtbPeriodoFisc; return gtbPeriodoFisc;
} }

View File

@@ -22,6 +22,7 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -83,7 +84,7 @@ public class DocumentBusinessLogic {
Optional<DtbDoct> bollaMax = Stream.of(dtbDoct.getDtbDoctBolle()).max((o1, o2) -> o1.getDataDoc().compareTo(o2.getDataDoc())); Optional<DtbDoct> bollaMax = Stream.of(dtbDoct.getDtbDoctBolle()).max((o1, o2) -> o1.getDataDoc().compareTo(o2.getDataDoc()));
if (bollaMax.isPresent()) { if (bollaMax.isPresent()) {
ctbMovt.setDataCompIva(bollaMax.get().getDataDoc()); ctbMovt.setDataCompIva(UtilityLocalDate.localDateToDate(bollaMax.get().getDataDoc()));
} }
} }
@@ -141,11 +142,11 @@ public class DocumentBusinessLogic {
codCconPaga = (String) datiCausPaga.get("cod_ccon_cassa"); codCconPaga = (String) datiCausPaga.get("cod_ccon_cassa");
} }
Date dataReg = dtbDoct.getDataCmov(); LocalDate dataReg = UtilityLocalDate.localDateFromDate(dtbDoct.getDataCmov());
if (dataReg == null) { if (dataReg == null) {
dataReg = dtbDoct.getDataReg(); dataReg = dtbDoct.getDataReg();
} }
Date dataDoc = dtbDoct.getDataDoc(); LocalDate dataDoc = dtbDoct.getDataDoc();
String serDoc = dtbDoct.getSerDoc(); String serDoc = dtbDoct.getSerDoc();
Integer numDoc = dtbDoct.getNumDoc(); Integer numDoc = dtbDoct.getNumDoc();
String codJcom = dtbDoct.getCodJcom(); String codJcom = dtbDoct.getCodJcom();
@@ -166,10 +167,10 @@ public class DocumentBusinessLogic {
//TESTATA //TESTATA
ctbMovt ctbMovt
.setNumCmov(numCmov) .setNumCmov(numCmov)
.setDataCmov(dataReg) .setDataCmov(UtilityLocalDate.localDateToDate(dataReg))
.setCodJcom(codJcom) .setCodJcom(codJcom)
.setCodCcau(codCcau) .setCodCcau(codCcau)
.setDataDoc(dataDoc) .setDataDoc(UtilityLocalDate.localDateToDate(dataDoc))
.setNumDoc(numDoc) .setNumDoc(numDoc)
.setSerDoc(serDoc) .setSerDoc(serDoc)
.setNumProt(numProt) .setNumProt(numProt)
@@ -195,7 +196,7 @@ public class DocumentBusinessLogic {
String idAttach = dtbDoct.getDrlDocAttached().get(0).getIdAttach(); String idAttach = dtbDoct.getDrlDocAttached().get(0).getIdAttach();
String sqlAttach = String sqlAttach =
"SELECT CASE WHEN " + UtilityDB.valueDateToString(dataRicMin, CommonConstants.DATE_FORMAT_YMD) + " is not null AND datetime_attach >= " + UtilityDB.valueDateToString(dataRicMin, CommonConstants.DATE_FORMAT_YMD) + " THEN datetime_attach ELSE null END " + "SELECT CASE WHEN " + UtilityDB.valueDateToString(dataRicMin, CommonConstants.DATE_FORMAT_YMD_DASHED) + " is not null AND datetime_attach >= " + UtilityDB.valueDateToString(dataRicMin, CommonConstants.DATE_FORMAT_YMD_DASHED) + " THEN datetime_attach ELSE null END " +
" FROM stb_files_attached " + " FROM stb_files_attached " +
" WHERE id_attach = " + UtilityDB.valueToString(idAttach); " WHERE id_attach = " + UtilityDB.valueToString(idAttach);
@@ -218,7 +219,7 @@ public class DocumentBusinessLogic {
"SELECT * " + "SELECT * " +
" FROM ctb_part " + " FROM ctb_part " +
"WHERE cod_anag = " + UtilityDB.valueToString(dtbDoct.getCodAnag()) + " AND " + "WHERE cod_anag = " + UtilityDB.valueToString(dtbDoct.getCodAnag()) + " AND " +
" data_doc = " + UtilityDB.valueDateToString(dtbDoct.getDataDoc(), CommonConstants.DATE_FORMAT_YMD) + " AND " + " data_doc = " + UtilityDB.valueToString(dtbDoct.getDataDoc()) + " AND " +
" ser_doc = " + UtilityDB.valueToString(dtbDoct.getSerDoc()) + " AND " + " ser_doc = " + UtilityDB.valueToString(dtbDoct.getSerDoc()) + " AND " +
" num_doc = " + UtilityDB.valueToString(dtbDoct.getNumDoc()) + " AND " + " num_doc = " + UtilityDB.valueToString(dtbDoct.getNumDoc()) + " AND " +
" tipo_partita = " + UtilityDB.valueToString(tipoPartita); " tipo_partita = " + UtilityDB.valueToString(tipoPartita);
@@ -346,9 +347,9 @@ public class DocumentBusinessLogic {
//REGISTRAZIONE ACCONTO //REGISTRAZIONE ACCONTO
if (!UtilityString.isNullOrEmpty(codCcauAnt) && acconto.compareTo(BigDecimal.ZERO) != 0) { if (!UtilityString.isNullOrEmpty(codCcauAnt) && acconto.compareTo(BigDecimal.ZERO) != 0) {
Integer annoPart = Integer.parseInt(new SimpleDateFormat("yyyy").format(dataDoc)); Integer annoPart = dataDoc.getYear();
regAcconto(insImpDare, codIreg, codCcauAnt, codCconAnt, numIreg, numProt, riga, ctbMovt, righeMov, regAcconto(insImpDare, codIreg, codCcauAnt, codCconAnt, numIreg, numProt, riga, ctbMovt, righeMov,
dataReg, tipoAnag, codAnag, codJcom, acconto, numCmov, codCconAnag, UtilityLocalDate.localDateToDate(dataReg), tipoAnag, codAnag, codJcom, acconto, numCmov, codCconAnag,
annoPart, serDoc, numDoc); annoPart, serDoc, numDoc);
if ("S".equalsIgnoreCase(ctbMovt.getGeneraScad()) && stornaAcconto) { if ("S".equalsIgnoreCase(ctbMovt.getGeneraScad()) && stornaAcconto) {
AccountingBusinessLogic.pagaScadenze(ctbMovt.getDataCmov(), acconto, elencoScad); AccountingBusinessLogic.pagaScadenze(ctbMovt.getDataCmov(), acconto, elencoScad);
@@ -361,7 +362,7 @@ public class DocumentBusinessLogic {
if (!UtilityString.isNullOrEmpty(codCcauAnt)) { if (!UtilityString.isNullOrEmpty(codCcauAnt)) {
totDoc = totDoc.subtract(acconto); totDoc = totDoc.subtract(acconto);
} }
regPagamento(insImpDare, regIva, riga, righeMov, dataDoc, tipoAnag, codAnag, serDoc, numDoc, totDoc, regPagamento(insImpDare, regIva, riga, righeMov, UtilityLocalDate.localDateToDate(dataDoc), tipoAnag, codAnag, serDoc, numDoc, totDoc,
codCconAnag, codCconPaga, codCcauPaga, elencoScad, codCconAnag, codCconPaga, codCcauPaga, elencoScad,
ctbMovt.getGeneraScad(), ctbMovt.getDataCmov()); ctbMovt.getGeneraScad(), ctbMovt.getDataCmov());
@@ -564,7 +565,7 @@ public class DocumentBusinessLogic {
if (regIva) { if (regIva) {
ctbMovr ctbMovr
.setAnnoPart(Integer.parseInt(new SimpleDateFormat("yyyy").format(dtbDoct.getDataDoc()))) .setAnnoPart(dtbDoct.getDataDoc().getYear())
.setSerDoc(dtbDoct.getSerDoc()) .setSerDoc(dtbDoct.getSerDoc())
.setNumDoc(dtbDoct.getNumDoc()); .setNumDoc(dtbDoct.getNumDoc());
} }
@@ -786,7 +787,7 @@ public class DocumentBusinessLogic {
.setCodAnag(dtbDoct.getCodAnag()); .setCodAnag(dtbDoct.getCodAnag());
if (regIva) { if (regIva) {
ctbMovr ctbMovr
.setAnnoPart(Integer.parseInt(new SimpleDateFormat("yyyy").format(dtbDoct.getDataDoc()))) .setAnnoPart(dtbDoct.getDataDoc().getYear())
.setSerDoc(dtbDoct.getSerDoc()) .setSerDoc(dtbDoct.getSerDoc())
.setNumDoc(dtbDoct.getNumDoc()); .setNumDoc(dtbDoct.getNumDoc());

View File

@@ -8,9 +8,9 @@ import it.integry.ems.rules.businessLogic.enums.FlagSezione;
import it.integry.ems.rules.completing.PackagesRules; import it.integry.ems.rules.completing.PackagesRules;
import it.integry.ems.service.EntityProcessor; import it.integry.ems.service.EntityProcessor;
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager; import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
import it.integry.ems_model.base.EntityBase;
import it.integry.ems_model.db.ResultSetMapper; import it.integry.ems_model.db.ResultSetMapper;
import it.integry.ems_model.entity.*; import it.integry.ems_model.entity.*;
import it.integry.ems_model.entity.key.MtbColtKey;
import it.integry.ems_model.service.SetupGest; import it.integry.ems_model.service.SetupGest;
import it.integry.ems_model.types.OperationType; import it.integry.ems_model.types.OperationType;
import it.integry.ems_model.utility.*; import it.integry.ems_model.utility.*;
@@ -24,6 +24,7 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
import static it.integry.ems.rules.completing.QueryRules.getSingleValue; import static it.integry.ems.rules.completing.QueryRules.getSingleValue;
@@ -55,12 +56,24 @@ public class LoadColliService {
this.currentAzienda = Azienda.getDefaultAzienda(multiDBTransactionManager.getPrimaryConnection()); this.currentAzienda = Azienda.getDefaultAzienda(multiDBTransactionManager.getPrimaryConnection());
String whereCond = "";
for (MtbColt mtbColt : loadColli.getColli()) { for (MtbColt mtbColt : loadColli.getColli()) {
mtbColt.setOperation(OperationType.SELECT_OBJECT); mtbColt.setOperation(OperationType.SELECT_OBJECT);
mtbColt.getMtbColr().forEach(mtbColr -> mtbColr.setOperation(OperationType.SELECT_OBJECT)); mtbColt.getMtbColr().forEach(mtbColr -> mtbColr.setOperation(OperationType.SELECT_OBJECT));
mtbColt.getMtbCols().forEach(mtbCols -> mtbCols.setOperation(OperationType.SELECT_OBJECT)); mtbColt.getMtbCols().forEach(mtbCols -> mtbCols.setOperation(OperationType.SELECT_OBJECT));
if(loadDatiFromDB){
entityProcessor.processEntity(mtbColt, true, multiDBTransactionManager);
}
if (mtbColt.getNumCollo() == null && mtbColt.getDataCollo() == null) {
mtbColt.setDataCollo(UtilityLocalDate.getNow());
int numCollo = PackagesRules.completeNumCollo(multiDBTransactionManager.getPrimaryConnection(),
mtbColt.getSerCollo(),
mtbColt.getDataCollo(),
mtbColt.getGestione());
mtbColt.setNumCollo(numCollo);
}
} }
if (UtilityString.isNullOrEmpty(loadColli.getGestione()) && !UtilityString.isNullOrEmpty(loadColli.getCodDtip())) { if (UtilityString.isNullOrEmpty(loadColli.getGestione()) && !UtilityString.isNullOrEmpty(loadColli.getCodDtip())) {
@@ -74,35 +87,31 @@ public class LoadColliService {
} }
if (loadDatiFromDB) { // String whereCond = "";
for (EntityBase entity : loadColli.getColli()) { // for (MtbColt collo : loadColli.getColli()) {
entityProcessor.processEntity(entity, false, multiDBTransactionManager); // if (!UtilityString.isNullOrEmpty(whereCond)) {
} // whereCond += " OR ";
} // }
//
// whereCond += "( mtb_colt.gestione = " + UtilityDB.valueToString(collo.getGestione()) + " AND " +
// " mtb_colt.data_collo = " + UtilityDB.valueToString(collo.getDataCollo()) + " AND " +
// " mtb_colt.ser_collo = " + UtilityDB.valueToString(collo.getSerCollo()) + " AND " +
// " mtb_colt.num_collo = " + UtilityDB.valueToString(collo.getNumCollo()) + ") ";
// }
checkColli(loadColli.getColli().stream()
.map(MtbColt::getKey)
.collect(Collectors.toList()), loadColli);
for (MtbColt mtbColt : loadColli.getColli()) { String whereCondColli = UtilityQuery.concatFieldListInWhereCond(loadColli.getColli().stream()
if (mtbColt.getNumCollo() == null && mtbColt.getDataCollo() == null) { .map(x -> new HashMap<String, Object>() {{
mtbColt.setDataCollo(UtilityLocalDate.getNow()); put("mtb_colt.gestione", x.getGestione());
int numCollo = PackagesRules.completeNumCollo(multiDBTransactionManager.getPrimaryConnection(), put("mtb_colt.num_collo", x.getNumCollo());
mtbColt.getSerCollo(), put("mtb_colt.data_collo", x.getDataCollo());
mtbColt.getDataCollo(), put("mtb_colt.ser_collo", x.getSerCollo());
mtbColt.getGestione()); }})
mtbColt.setNumCollo(numCollo); .collect(Collectors.toList()));
}
}
for (MtbColt collo : loadColli.getColli()) {
if (!UtilityString.isNullOrEmpty(whereCond)) {
whereCond += " OR ";
}
whereCond += "( mtb_colt.gestione = " + UtilityDB.valueToString(collo.getGestione()) + " AND " +
" mtb_colt.data_collo = " + UtilityDB.valueToString(collo.getDataCollo()) + " AND " +
" mtb_colt.ser_collo = " + UtilityDB.valueToString(collo.getSerCollo()) + " AND " +
" mtb_colt.num_collo = " + UtilityDB.valueToString(collo.getNumCollo()) + ") ";
}
checkColli(whereCond, loadColli);
DtbDoct dtbDoct; DtbDoct dtbDoct;
String query; String query;
@@ -175,7 +184,7 @@ public class LoadColliService {
" gtb_divi," + " gtb_divi," +
"(SELECT segno_qta_scar FROM dtb_tipi WHERE cod_dtip = " + UtilityDB.valueToString(loadColli.getCodDtip()) + ") tipoDoc " + "(SELECT segno_qta_scar FROM dtb_tipi WHERE cod_dtip = " + UtilityDB.valueToString(loadColli.getCodDtip()) + ") tipoDoc " +
" WHERE dtb_ordt.gestione =" + UtilityDB.valueToString(loadColli.getGestione()) + " AND" + " WHERE dtb_ordt.gestione =" + UtilityDB.valueToString(loadColli.getGestione()) + " AND" +
" dtb_ordt.data_ord = " + UtilityDB.valueDateToString(loadColli.getDataOrd(), CommonConstants.DATE_FORMAT_YMD) + " AND" + " dtb_ordt.data_ord = " + UtilityDB.valueToString(loadColli.getDataOrd()) + " AND" +
" dtb_ordt.num_ord = " + UtilityDB.valueToString(loadColli.getNumOrd()) + " AND" + " dtb_ordt.num_ord = " + UtilityDB.valueToString(loadColli.getNumOrd()) + " AND" +
" gtb_divi.cod_divi = dtb_ordt.cod_divi "; " gtb_divi.cod_divi = dtb_ordt.cod_divi ";
@@ -185,15 +194,17 @@ public class LoadColliService {
throw new Exception("Codice Deposito obbligatorio"); throw new Exception("Codice Deposito obbligatorio");
} }
if (loadDatiFromDB) { if (loadDatiFromDB) {
query = "SELECT DISTINCT mtb_colt.cod_vlis AS listino, " + query = "SELECT DISTINCT mtb_colt.cod_vlis AS listino, " +
" mtb_colt.cod_vdes " + " mtb_colt.cod_vdes " +
" FROM mtb_colt, mtb_colr " + " FROM mtb_colt " +
"WHERE mtb_colr.gestione = mtb_colt.gestione AND " + " INNER JOIN mtb_colr ON mtb_colr.gestione = mtb_colt.gestione AND " +
" mtb_colr.data_collo = mtb_colt.data_collo AND " + " mtb_colr.data_collo = mtb_colt.data_collo AND " +
" mtb_colr.ser_collo = mtb_colt.ser_collo AND " + " mtb_colr.ser_collo = mtb_colt.ser_collo AND " +
" mtb_colr.num_collo = mtb_colt.num_collo "; " mtb_colr.num_collo = mtb_colt.num_collo " +
query = UtilityDB.addwhereCond(query, whereCond, false); " WHERE " + whereCondColli;
dtbDoct = UtilityDB.executeSimpleQueryOnlyFirstRowDTO(multiDBTransactionManager.getPrimaryConnection(), query, DtbDoct.class); dtbDoct = UtilityDB.executeSimpleQueryOnlyFirstRowDTO(multiDBTransactionManager.getPrimaryConnection(), query, DtbDoct.class);
} else { } else {
dtbDoct = new DtbDoct(); dtbDoct = new DtbDoct();
@@ -229,7 +240,7 @@ public class LoadColliService {
" vtb_list.descrizione "; " vtb_list.descrizione ";
query = UtilityDB.addwhereCond(query, whereCond, false); query = UtilityDB.addwhereCond(query, whereCondColli, false);
List<HashMap<String, Object>> results = UtilityDB.executeSimpleQuery(multiDBTransactionManager.getPrimaryConnection(), query); List<HashMap<String, Object>> results = UtilityDB.executeSimpleQuery(multiDBTransactionManager.getPrimaryConnection(), query);
if (!results.isEmpty()) { if (!results.isEmpty()) {
dtbDoct.setCodDivi(UtilityHashMap.<String>getValueIfExists(results.get(0), "cod_divi")); dtbDoct.setCodDivi(UtilityHashMap.<String>getValueIfExists(results.get(0), "cod_divi"));
@@ -242,7 +253,7 @@ public class LoadColliService {
if (loadColli.getColli().isEmpty() && loadDatiFromDB) { if (loadColli.getColli().isEmpty() && loadDatiFromDB) {
query = "SELECT gestione, data_collo, ser_collo, num_collo " + query = "SELECT gestione, data_collo, ser_collo, num_collo " +
" FROM mtb_colt "; " FROM mtb_colt ";
query = UtilityDB.addwhereCond(query, whereCond, false); query = UtilityDB.addwhereCond(query, whereCondColli, false);
PreparedStatement ps = multiDBTransactionManager.prepareStatement(query); PreparedStatement ps = multiDBTransactionManager.prepareStatement(query);
ResultSet rs = ps.executeQuery(); ResultSet rs = ps.executeQuery();
@@ -256,7 +267,7 @@ public class LoadColliService {
// Acquisizione ID_LOTTO del primo collo da agganciare // Acquisizione ID_LOTTO del primo collo da agganciare
if (loadDatiFromDB) { if (loadDatiFromDB) {
query = "SELECT TOP 1 id_lotto FROM mtb_colt "; query = "SELECT TOP 1 id_lotto FROM mtb_colt ";
query = UtilityDB.addwhereCond(query, whereCond, false); query = UtilityDB.addwhereCond(query, whereCondColli, false);
Integer idLotto = (Integer) getSingleValue(multiDBTransactionManager.getPrimaryConnection(), query); Integer idLotto = (Integer) getSingleValue(multiDBTransactionManager.getPrimaryConnection(), query);
if (idLotto != null) { if (idLotto != null) {
dtbDoct.setIdLotto(idLotto); dtbDoct.setIdLotto(idLotto);
@@ -300,7 +311,7 @@ public class LoadColliService {
//VERIFICARE CHE USERNAME VENGA PASSATO //VERIFICARE CHE USERNAME VENGA PASSATO
List<DtbDocr> dtbDocr = loadRigheCollo(whereCond, loadColli); List<DtbDocr> dtbDocr = loadRigheCollo(whereCondColli, loadColli);
if (!dtbDocr.isEmpty()) { if (!dtbDocr.isEmpty()) {
dtbDocr.stream() dtbDocr.stream()
@@ -321,9 +332,19 @@ public class LoadColliService {
} }
private void checkColli(String whereCond, final LoadColliDTO loadColliDTO) throws Exception { private void checkColli(final List<MtbColtKey> mtbColtKeys, final LoadColliDTO loadColliDTO) throws Exception {
String query; String query;
String whereCondColli = UtilityQuery.concatFieldListInWhereCond(mtbColtKeys.stream()
.map(x -> new HashMap<String, Object>() {{
put("mtb_colt.gestione", x.getGestione());
put("mtb_colt.num_collo", x.getNumCollo());
put("mtb_colt.data_collo", x.getDataCollo());
put("mtb_colt.ser_collo", x.getSerCollo());
}})
.collect(Collectors.toList()));
//CONTROLLO COLLI AGGANCIATI A DOCUMENTI //CONTROLLO COLLI AGGANCIATI A DOCUMENTI
if (loadDatiFromDB) { if (loadDatiFromDB) {
query = query =
@@ -341,7 +362,7 @@ public class LoadColliService {
" mtb_colt.ser_collo = mtb_colr.ser_collo and " + " mtb_colt.ser_collo = mtb_colr.ser_collo and " +
" mtb_colt.num_collo = mtb_colr.num_collo "; " mtb_colt.num_collo = mtb_colr.num_collo ";
query = UtilityDB.addwhereCond(query, whereCond, false); query = UtilityDB.addwhereCond(query, whereCondColli, false);
List<HashMap<String, Object>> results = UtilityDB.executeSimpleQuery(multiDBTransactionManager.getPrimaryConnection(), query); List<HashMap<String, Object>> results = UtilityDB.executeSimpleQuery(multiDBTransactionManager.getPrimaryConnection(), query);
for (HashMap<String, Object> result : results) { for (HashMap<String, Object> result : results) {
@@ -353,20 +374,21 @@ public class LoadColliService {
int numDoc = UtilityHashMap.getValueIfExists(result, "num_doc"); int numDoc = UtilityHashMap.getValueIfExists(result, "num_doc");
throw new Exception("Il collo n° " + numCollo + throw new Exception("Il collo n° " + numCollo +
" del " + new SimpleDateFormat(CommonConstants.DATE_FORMAT_DMY).format(dataCollo) + " del " + new SimpleDateFormat(CommonConstants.DATE_FORMAT_DMY_SLASHED).format(dataCollo) +
" già agganciato al documento " + codDtip + " già agganciato al documento " + codDtip +
" del " + new SimpleDateFormat(CommonConstants.DATE_FORMAT_DMY).format(dataDoc) + " del " + new SimpleDateFormat(CommonConstants.DATE_FORMAT_DMY_SLASHED).format(dataDoc) +
" n. " + numDoc); " n. " + numDoc);
} }
} else { } else {
List<MtbColt> mtbColtWithDocAlready = Stream.of(loadColliDTO.getColli()) List<MtbColt> mtbColtWithDocAlready = loadColliDTO.getColli().stream()
.filter(mtbColt -> !UtilityString.isNullOrEmpty(mtbColt.getCodDtip())).toList(); .filter(mtbColt -> !UtilityString.isNullOrEmpty(mtbColt.getCodDtip()))
.collect(Collectors.toList());
if (mtbColtWithDocAlready != null && !mtbColtWithDocAlready.isEmpty()) { if (!mtbColtWithDocAlready.isEmpty()) {
throw new Exception("Il collo n° " + mtbColtWithDocAlready.get(0).getNumCollo() + throw new Exception("Il collo n° " + mtbColtWithDocAlready.get(0).getNumCollo() +
" del " + new SimpleDateFormat(CommonConstants.DATE_FORMAT_DMY).format(mtbColtWithDocAlready.get(0).getDataCollo()) + " del " + CommonConstants.DATE_DMY_SLASHED_FORMATTER.format(mtbColtWithDocAlready.get(0).getDataCollo()) +
" già agganciato al documento " + mtbColtWithDocAlready.get(0).getCodDtip() + " già agganciato al documento " + mtbColtWithDocAlready.get(0).getCodDtip() +
" del " + new SimpleDateFormat(CommonConstants.DATE_FORMAT_DMY).format(mtbColtWithDocAlready.get(0).getDataDoc()) + " del " + CommonConstants.DATE_DMY_SLASHED_FORMATTER.format(mtbColtWithDocAlready.get(0).getDataDoc()) +
" n. " + mtbColtWithDocAlready.get(0).getNumDoc()); " n. " + mtbColtWithDocAlready.get(0).getNumDoc());
} }
} }
@@ -381,7 +403,7 @@ public class LoadColliService {
"FROM mtb_colt " + "FROM mtb_colt " +
"WHERE mtb_colt.cod_mdep <> " + UtilityDB.valueToString(loadColliDTO.getCodMdep()); "WHERE mtb_colt.cod_mdep <> " + UtilityDB.valueToString(loadColliDTO.getCodMdep());
query = UtilityDB.addwhereCond(query, whereCond, false); query = UtilityDB.addwhereCond(query, whereCondColli, false);
List<HashMap<String, Object>> results = UtilityDB.executeSimpleQuery(multiDBTransactionManager.getPrimaryConnection(), query); List<HashMap<String, Object>> results = UtilityDB.executeSimpleQuery(multiDBTransactionManager.getPrimaryConnection(), query);
if (!results.isEmpty()) { if (!results.isEmpty()) {
@@ -407,7 +429,7 @@ public class LoadColliService {
" mtb_colr.data_ord = dtb_ordt.data_ord AND " + " mtb_colr.data_ord = dtb_ordt.data_ord AND " +
" mtb_colr.num_ord = dtb_ordt.num_ord "; " mtb_colr.num_ord = dtb_ordt.num_ord ";
query = UtilityDB.addwhereCond(query, whereCond, false); query = UtilityDB.addwhereCond(query, whereCondColli, false);
List<HashMap<String, Object>> results = UtilityDB.executeSimpleQuery(multiDBTransactionManager.getPrimaryConnection(), query); List<HashMap<String, Object>> results = UtilityDB.executeSimpleQuery(multiDBTransactionManager.getPrimaryConnection(), query);
if (!results.isEmpty()) { if (!results.isEmpty()) {
@@ -431,7 +453,7 @@ public class LoadColliService {
" mtb_colr.num_ord = dtb_ordt.num_ord " + " mtb_colr.num_ord = dtb_ordt.num_ord " +
"WHERE dtb_ordt.flag_sospeso = 'S'"; "WHERE dtb_ordt.flag_sospeso = 'S'";
query = UtilityDB.addwhereCond(query, whereCond, false); query = UtilityDB.addwhereCond(query, whereCondColli, false);
List<HashMap<String, Object>> results = UtilityDB.executeSimpleQuery(multiDBTransactionManager.getPrimaryConnection(), query); List<HashMap<String, Object>> results = UtilityDB.executeSimpleQuery(multiDBTransactionManager.getPrimaryConnection(), query);
@@ -682,7 +704,7 @@ public class LoadColliService {
mtbTcol.setOperation(OperationType.SELECT_OBJECT); mtbTcol.setOperation(OperationType.SELECT_OBJECT);
mtbTcol.setCodTcol(mtbColt.getCodTcol()); mtbTcol.setCodTcol(mtbColt.getCodTcol());
entityProcessor.processEntity(mtbTcol, multiDBTransactionManager); entityProcessor.processEntity(mtbTcol,true, multiDBTransactionManager);
if (mtbColt.getPesoKg() == null) mtbColt.setPesoKg(BigDecimal.ZERO); if (mtbColt.getPesoKg() == null) mtbColt.setPesoKg(BigDecimal.ZERO);
@@ -704,18 +726,18 @@ public class LoadColliService {
MtbAart mtbAart = new MtbAart(); MtbAart mtbAart = new MtbAart();
mtbAart.setCodMart(mtbColr.getCodMart()); mtbAart.setCodMart(mtbColr.getCodMart());
mtbAart.setOperation(OperationType.SELECT_OBJECT); mtbAart.setOperation(OperationType.SELECT_OBJECT);
entityProcessor.processEntity(mtbAart, multiDBTransactionManager); entityProcessor.processEntity(mtbAart,true, multiDBTransactionManager);
//Retrieve della riga ordine //Retrieve della riga ordine
DtbOrdr dtbOrdr = null; DtbOrdr dtbOrdr = null;
if (mtbColr.getNumOrd() != null && mtbColr.getRigaOrd() != null && mtbColr.getDataOrd() != null) { if (mtbColr.getNumOrd() != null && mtbColr.getRigaOrd() != null && mtbColr.getDataOrd() != null) {
dtbOrdr = new DtbOrdr(); dtbOrdr = new DtbOrdr();
dtbOrdr.setNumOrd(mtbColr.getNumOrd()); dtbOrdr.setNumOrd(mtbColr.getNumOrd());
dtbOrdr.setDataOrd(UtilityLocalDate.localDateToDate(mtbColr.getDataOrd())); dtbOrdr.setDataOrd(mtbColr.getDataOrd());
dtbOrdr.setRigaOrd(mtbColr.getRigaOrd()); dtbOrdr.setRigaOrd(mtbColr.getRigaOrd());
dtbOrdr.setOperation(OperationType.SELECT_OBJECT); dtbOrdr.setOperation(OperationType.SELECT_OBJECT);
entityProcessor.processEntity(dtbOrdr, multiDBTransactionManager); entityProcessor.processEntity(dtbOrdr,true, multiDBTransactionManager);
} }
DtbDocr dtbDocr = new DtbDocr(); DtbDocr dtbDocr = new DtbDocr();

View File

@@ -3,6 +3,7 @@ package it.integry.ems.rules.businessLogic.dto;
import it.integry.ems_model.entity.MtbColt; import it.integry.ems_model.entity.MtbColt;
import java.time.LocalDate;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@@ -13,13 +14,13 @@ public class LoadColliDTO {
private String codDtip; private String codDtip;
private String codAnag; private String codAnag;
private String codVdes; private String codVdes;
private Date dataDoc; private LocalDate dataDoc;
private String serDoc; private String serDoc;
private Integer numDoc; private Integer numDoc;
private String codMdep; private String codMdep;
private String calcPrz; private String calcPrz;
private boolean flagLeggiDatiOrd; private boolean flagLeggiDatiOrd;
private Date dataOrd; private LocalDate dataOrd;
private Integer numOrd; private Integer numOrd;
private String flagEvasoForzato; private String flagEvasoForzato;
private Date dataVers; private Date dataVers;
@@ -74,11 +75,11 @@ public class LoadColliDTO {
return this; return this;
} }
public Date getDataDoc() { public LocalDate getDataDoc() {
return dataDoc; return dataDoc;
} }
public LoadColliDTO setDataDoc(Date dataDoc) { public LoadColliDTO setDataDoc(LocalDate dataDoc) {
this.dataDoc = dataDoc; this.dataDoc = dataDoc;
return this; return this;
} }
@@ -128,11 +129,11 @@ public class LoadColliDTO {
return this; return this;
} }
public Date getDataOrd() { public LocalDate getDataOrd() {
return dataOrd; return dataOrd;
} }
public LoadColliDTO setDataOrd(Date dataOrd) { public LoadColliDTO setDataOrd(LocalDate dataOrd) {
this.dataOrd = dataOrd; this.dataOrd = dataOrd;
return this; return this;
} }

View File

@@ -18,6 +18,7 @@ import java.text.SimpleDateFormat;
import java.time.LocalDate; import java.time.LocalDate;
import java.util.Date; import java.util.Date;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
public class AccountingRules extends QueryRules { public class AccountingRules extends QueryRules {
@@ -138,14 +139,13 @@ public class AccountingRules extends QueryRules {
public static Integer completeNumDocMov(Connection conn, CtbMovt entity) throws Exception { public static Integer completeNumDocMov(Connection conn, CtbMovt entity) throws Exception {
return DocumentRules.nextNumDoc(conn, return DocumentRules.nextNumDoc(conn,
entity.getDataDoc(), UtilityLocalDate.localDateFromDate(entity.getDataDoc()),
entity.getCodIreg(), entity.getCodIreg(),
entity.getSerDoc(), entity.getSerDoc(),
entity.getNumIreg(), entity.getNumIreg(),
entity.getNumDoc() == null ? 0 : entity.getNumDoc()); entity.getNumDoc() == null ? 0 : entity.getNumDoc());
} }
public static Integer getAnnoComp(Connection conn, LocalDate dataCmov) throws SQLException { public static Integer getAnnoComp(Connection conn, LocalDate dataCmov) throws SQLException {
if (dataCmov == null) if (dataCmov == null)
return UtilityLocalDate.getNow().getYear(); return UtilityLocalDate.getNow().getYear();
@@ -182,7 +182,7 @@ public class AccountingRules extends QueryRules {
if (!UtilityString.isNullOrEmpty(codBiva)) { if (!UtilityString.isNullOrEmpty(codBiva)) {
for (CtbMovi ctbMovi : ctbMovt.getCtbMovi()) { for (CtbMovi ctbMovi : ctbMovt.getCtbMovi()) {
if (UtilityString.isNullOrEmpty(ctbMovi.getCodBiva())) { if (UtilityString.isNullOrEmpty(ctbMovi.getCodBiva()) && !ctbMovi.getCodBiva().equalsIgnoreCase(EmsRestConstants.NULL)) {
ctbMovi.setCodBiva(codBiva); ctbMovi.setCodBiva(codBiva);
} }
movi.add(ctbMovi); movi.add(ctbMovi);
@@ -204,7 +204,7 @@ public class AccountingRules extends QueryRules {
String setCompetenzaDaDoc = setupGest.getSetup(connection, "CTB_MOVI", "SETUP", "COMPETENZA_IVA_" + gestione); String setCompetenzaDaDoc = setupGest.getSetup(connection, "CTB_MOVI", "SETUP", "COMPETENZA_IVA_" + gestione);
sql = "SELECT dbo.f_getDataLiquidazioneIva(" + UtilityDB.valueDateToString(ctbMovt.getDataDoc(), CommonConstants.DATE_FORMAT_YMD) + ")"; sql = "SELECT dbo.f_getDataLiquidazioneIva(" + UtilityDB.valueDateToString(ctbMovt.getDataDoc(), CommonConstants.DATE_FORMAT_YMD_SLASHED) + ")";
Date dataCheck = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(connection, sql); Date dataCheck = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(connection, sql);
@@ -390,7 +390,7 @@ public class AccountingRules extends QueryRules {
.setCodAnag(ctbMovt.getCodAnag()) .setCodAnag(ctbMovt.getCodAnag())
.setCodVage(ctbMovt.getCodVage()) .setCodVage(ctbMovt.getCodVage())
.setAnnoPart(annoPart) .setAnnoPart(annoPart)
.setDataDoc(ctbMovt.getDataDoc()) .setDataDoc(UtilityLocalDate.localDateFromDate(ctbMovt.getDataDoc()))
.setSerDoc(ctbMovt.getSerDoc()) .setSerDoc(ctbMovt.getSerDoc())
.setNumDoc(ctbMovt.getNumDoc()) .setNumDoc(ctbMovt.getNumDoc())
.setCodDiviCont(ctbMovt.getCodDiviCont()) .setCodDiviCont(ctbMovt.getCodDiviCont())
@@ -658,7 +658,7 @@ public class AccountingRules extends QueryRules {
.setAnnoPart(ctbScad.getAnnoPart()) .setAnnoPart(ctbScad.getAnnoPart())
.setSerDoc(ctbScad.getSerDoc()) .setSerDoc(ctbScad.getSerDoc())
.setNumDoc(ctbScad.getNumDoc()) .setNumDoc(ctbScad.getNumDoc())
.setDataCmov(ctbMovr.getDataCmov()) .setDataCmov(UtilityLocalDate.localDateFromDate(ctbMovr.getDataCmov()))
.setIdRiga(ctbMovr.getIdRiga()) .setIdRiga(ctbMovr.getIdRiga())
.setImpDare(impDare) .setImpDare(impDare)
.setImpAvere(impAvere) .setImpAvere(impAvere)
@@ -736,7 +736,7 @@ public class AccountingRules extends QueryRules {
.setAnnoPart(ctbMovr.getAnnoPart()) .setAnnoPart(ctbMovr.getAnnoPart())
.setSerDoc(ctbMovr.getSerDoc()) .setSerDoc(ctbMovr.getSerDoc())
.setNumDoc(ctbMovr.getNumDoc()) .setNumDoc(ctbMovr.getNumDoc())
.setDataCmov(ctbMovr.getDataCmov()) .setDataCmov(UtilityLocalDate.localDateFromDate(ctbMovr.getDataCmov()))
.setIdRiga(ctbMovr.getIdRiga()) .setIdRiga(ctbMovr.getIdRiga())
.setImpDare(ctbMovr.getImpDare()) .setImpDare(ctbMovr.getImpDare())
.setImpAvere(ctbMovr.getImpAvere()) .setImpAvere(ctbMovr.getImpAvere())
@@ -963,18 +963,16 @@ public class AccountingRules extends QueryRules {
public static CtbMovt completeScadRitAcc(Connection conn, CtbRitAcc ctbRitAcc) throws Exception { public static CtbMovt completeScadRitAcc(Connection conn, CtbRitAcc ctbRitAcc) throws Exception {
String sql = String sql =
"SELECT count(*) as count_partita " + "SELECT count(*) as count_partita " +
" FROM ctb_part inner join ctb_parr on ctb_part.tipo_anag = ctb_parr.tipo_anag and " + " FROM ctb_part inner join ctb_parr on ctb_part.tipo_anag = ctb_parr.tipo_anag and " +
"ctb_part.cod_anag = ctb_parr.cod_anag and " + "ctb_part.cod_anag = ctb_parr.cod_anag and " +
"ctb_part.anno_part = ctb_parr.anno_part and " + "ctb_part.anno_part = ctb_parr.anno_part and " +
"ctb_part.ser_doc = ctb_parr.ser_doc and " + "ctb_part.ser_doc = ctb_parr.ser_doc and " +
"ctb_part.num_doc = ctb_parr.num_doc " + "ctb_part.num_doc = ctb_parr.num_doc " +
" WHERE ctb_parr.num_cmov = " + UtilityDB.valueToString(ctbRitAcc.getNumCmovFat()) + " AND " + " WHERE ctb_parr.num_cmov = " + UtilityDB.valueToString(ctbRitAcc.getNumCmovFat());
" ( ctb_part.dare_part = 0 or ctb_part.avere_part = 0 ) ";
Integer countPart = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(conn, sql); Integer countPart = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(conn, sql);
if (countPart > 0) { if (countPart <= 1) {
CtbMovt ctbMovt = new CtbMovt(); CtbMovt ctbMovt = new CtbMovt();
ctbMovt.setNumCmov(ctbRitAcc.getNumCmovFat()); ctbMovt.setNumCmov(ctbRitAcc.getNumCmovFat());
ctbMovt.setGeneraScad(ctbRitAcc.getGeneraScadenze()); ctbMovt.setGeneraScad(ctbRitAcc.getGeneraScadenze());
@@ -990,7 +988,7 @@ public class AccountingRules extends QueryRules {
for (CtbScad ctbScad : ctbMovt.getCtbScad()) { for (CtbScad ctbScad : ctbMovt.getCtbScad()) {
ctbScad.setTipoAnag(UtilityString.isNullOrEmpty(ctbScad.getTipoAnag()) ? ctbMovt.getTipoAnag() : ctbScad.getTipoAnag()); ctbScad.setTipoAnag(UtilityString.isNullOrEmpty(ctbScad.getTipoAnag()) ? ctbMovt.getTipoAnag() : ctbScad.getTipoAnag());
ctbScad.setCodAnag(UtilityString.isNullOrEmpty(ctbScad.getCodAnag()) ? ctbMovt.getCodAnag() : ctbScad.getCodAnag()); ctbScad.setCodAnag(UtilityString.isNullOrEmpty(ctbScad.getCodAnag()) ? ctbMovt.getCodAnag() : ctbScad.getCodAnag());
ctbScad.setDataDoc(UtilityString.isNullOrEmpty(ctbScad.getDataDoc()) ? ctbMovt.getDataDoc() : ctbScad.getDataDoc()); ctbScad.setDataDoc(UtilityLocalDate.isNull(ctbScad.getDataDoc(), UtilityLocalDate.localDateFromDate(ctbMovt.getDataDoc())));
ctbScad.setSerDoc(UtilityString.isNullOrEmpty(ctbScad.getSerDoc()) ? ctbMovt.getSerDoc() : ctbScad.getSerDoc()); ctbScad.setSerDoc(UtilityString.isNullOrEmpty(ctbScad.getSerDoc()) ? ctbMovt.getSerDoc() : ctbScad.getSerDoc());
ctbScad.setNumDoc(UtilityString.isNullOrEmpty(ctbScad.getNumDoc()) ? ctbMovt.getNumDoc() : ctbScad.getNumDoc()); ctbScad.setNumDoc(UtilityString.isNullOrEmpty(ctbScad.getNumDoc()) ? ctbMovt.getNumDoc() : ctbScad.getNumDoc());
Integer annoPart = Integer.parseInt(new SimpleDateFormat("yyyy").format(ctbMovt.getDataDoc())); Integer annoPart = Integer.parseInt(new SimpleDateFormat("yyyy").format(ctbMovt.getDataDoc()));
@@ -1127,5 +1125,16 @@ public class AccountingRules extends QueryRules {
} }
return ventilazione; return ventilazione;
} }
public static void checkRigaMovCtbParr( CtbMovt ctbMovt) {
List<CtbMovr> row = ctbMovt.getCtbMovr().stream()
.filter(x -> x.getCtbScad() != null && x.getCtbScad().size() > 0)
.collect(Collectors.toList());
for(CtbMovr r : row) {
r.getCtbScad()
.forEach(scad -> {scad.getCrlScadParr()
.stream()
.filter(x->x.getIdRigaMov() != r.getIdRiga())
.forEach(x->x.setIdRigaMov(r.getIdRiga()));});
}
}
} }

View File

@@ -10,6 +10,7 @@ import it.integry.ems_model.base.EntityBase;
import it.integry.ems_model.config.EmsRestConstants; import it.integry.ems_model.config.EmsRestConstants;
import it.integry.ems_model.db.ResultSetMapper; import it.integry.ems_model.db.ResultSetMapper;
import it.integry.ems_model.entity.*; import it.integry.ems_model.entity.*;
import it.integry.ems_model.entity._enum.ListinoEnum;
import it.integry.ems_model.entity.common.DtbBaseDocR; import it.integry.ems_model.entity.common.DtbBaseDocR;
import it.integry.ems_model.entity.common.DtbDocOrdR; import it.integry.ems_model.entity.common.DtbDocOrdR;
import it.integry.ems_model.entity.common.DtbDocOrdT; import it.integry.ems_model.entity.common.DtbDocOrdT;
@@ -20,6 +21,7 @@ import org.apache.commons.lang3.StringUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.time.LocalDate;
import java.util.*; import java.util.*;
import java.util.Map.Entry; import java.util.Map.Entry;
@@ -38,7 +40,7 @@ public class DocOrdCalTotaliRules extends QueryRules {
segno = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(conn, sql); segno = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(conn, sql);
} }
Date dataReg = null, dataValidita = null; LocalDate dataReg = null, dataValidita = null;
if (row instanceof DtbDocr) { if (row instanceof DtbDocr) {
dataReg = ((DtbDocr) row).getDataReg(); dataReg = ((DtbDocr) row).getDataReg();
dataValidita = ((DtbDocr) row).getDataDoc(); dataValidita = ((DtbDocr) row).getDataDoc();
@@ -189,22 +191,22 @@ public class DocOrdCalTotaliRules extends QueryRules {
componenti.add(rigaDocOrd); componenti.add(rigaDocOrd);
} else if (!esponiComp && "C".equals(flagCalcPrz)) { } else if (!esponiComp && "C".equals(flagCalcPrz)) {
if (CommonConstants.ULTC.equalsIgnoreCase(listino)) { if (CommonConstants.ULTC.equalsIgnoreCase(listino)) {
sql = " SELECT dbo.f_GetCostoUltArt_depo( " + UtilityDB.valueDateToString(dataReg, CommonConstants.DATE_FORMAT_YMD) + ", " sql = " SELECT dbo.f_GetCostoUltArt_depo( " + UtilityDB.valueToString(dataReg) + ", "
+ UtilityDB.valueToString(codMdep) + ", " + UtilityDB.valueToString(codMdep) + ", "
+ UtilityDB.valueToString(codComp) + ") as val_unt "; + UtilityDB.valueToString(codComp) + ") as val_unt ";
} else if ("V".equalsIgnoreCase(gestione)) { } else if ("V".equalsIgnoreCase(gestione)) {
if (flagPrzIva) { if (flagPrzIva) {
sql = "SELECT dbo.f_getPrzVendIva(" + UtilityDB.valueDateToString(dataValidita, CommonConstants.DATE_FORMAT_YMD) + ", " sql = "SELECT dbo.f_getPrzVendIva(" + UtilityDB.valueToString(dataValidita) + ", "
+ UtilityDB.valueToString(listino) + "," + UtilityDB.valueToString(listino) + ","
+ UtilityDB.valueToString(codComp) + ", 'S' ) as val_unt "; + UtilityDB.valueToString(codComp) + ", 'S' ) as val_unt ";
} else { } else {
sql = "SELECT dbo.f_getPrzVend(" + UtilityDB.valueDateToString(dataValidita, CommonConstants.DATE_FORMAT_YMD) + ", " sql = "SELECT dbo.f_getPrzVend(" + UtilityDB.valueToString(dataValidita) + ", "
+ UtilityDB.valueToString(listino) + "," + UtilityDB.valueToString(listino) + ","
+ UtilityDB.valueToString(codComp) + ", 'S' ) as val_unt "; + UtilityDB.valueToString(codComp) + ", 'S' ) as val_unt ";
} }
} else if ("A".equalsIgnoreCase(gestione)) { } else if ("A".equalsIgnoreCase(gestione)) {
sql = "SELECT dbo.f_getPrzNettoAcqArt (" + UtilityDB.valueDateToString(dataValidita, CommonConstants.DATE_FORMAT_YMD) + ", " sql = "SELECT dbo.f_getPrzNettoAcqArt (" + UtilityDB.valueToString(dataValidita) + ", "
+ UtilityDB.valueToString(listino) + ", " + UtilityDB.valueToString(listino) + ", "
+ "NULL, " + "NULL, "
+ UtilityDB.valueToString(codComp) + ") as val_unt "; + UtilityDB.valueToString(codComp) + ") as val_unt ";
@@ -239,7 +241,7 @@ public class DocOrdCalTotaliRules extends QueryRules {
public static void calcSconti(Connection conn, DtbDoct testata) throws Exception { public static void calcSconti(Connection conn, DtbDoct testata) throws Exception {
List<DtbDocOrdR> rows = new ArrayList<>(Stream.of(testata.getDtbDocr()).filter(x -> x.getRigaOrd() == null).toList()); List<DtbDocOrdR> rows = new ArrayList<>(Stream.of(testata.getDtbDocr()).filter(x -> x.getRigaOrd() == null).toList());
calcSconti(conn, testata.getDataDoc(), rows); calcSconti(conn, UtilityLocalDate.localDateToDate(testata.getDataDoc()), rows);
testata.setDtbDocr(Stream.of(rows).map(x -> (DtbDocr) x).toList()); testata.setDtbDocr(Stream.of(rows).map(x -> (DtbDocr) x).toList());
testata.getDtbDocr().addAll(Stream.of(testata.getDtbDocr()).filter(x -> x.getRigaOrd() != null).toList()); testata.getDtbDocr().addAll(Stream.of(testata.getDtbDocr()).filter(x -> x.getRigaOrd() != null).toList());
@@ -264,7 +266,7 @@ public class DocOrdCalTotaliRules extends QueryRules {
for (HashMap<String, String> artLisv : distinctArtLisv) { for (HashMap<String, String> artLisv : distinctArtLisv) {
String sql = "SELECT cod_mart, sconto_cartoni, sconto_strato, sconto_pedane " + String sql = "SELECT cod_mart, sconto_cartoni, sconto_strato, sconto_pedane " +
"FROM getListinoVendita (" + UtilityDB.valueDateToString(dataListino, CommonConstants.DATE_FORMAT_YMD) + ", " + "FROM getListinoVendita (" + UtilityDB.valueDateToString(dataListino, CommonConstants.DATE_FORMAT_YMD_DASHED) + ", " +
UtilityDB.valueToString(UtilityHashMap.getValueIfExists(artLisv, "listino")) + ", " + UtilityDB.valueToString(UtilityHashMap.getValueIfExists(artLisv, "listino")) + ", " +
UtilityDB.valueToString(UtilityHashMap.getValueIfExists(artLisv, "cod_mart")) + ")"; UtilityDB.valueToString(UtilityHashMap.getValueIfExists(artLisv, "cod_mart")) + ")";
@@ -471,7 +473,7 @@ public class DocOrdCalTotaliRules extends QueryRules {
//Dati Bolla //Dati Bolla
String codDtipBolla = null, serDocBolla = null; String codDtipBolla = null, serDocBolla = null;
Date dataDocBolla = null; LocalDate dataDocBolla = null;
Integer numDocBolla = null; Integer numDocBolla = null;
if (testata.getOperation() == OperationType.NO_OP) { if (testata.getOperation() == OperationType.NO_OP) {
@@ -646,12 +648,12 @@ public class DocOrdCalTotaliRules extends QueryRules {
} }
throw new Exception(String.format( throw new Exception(String.format(
"Impossibile salvare l'ordine %s del %s n. %s, riga %s senza aliquota IVA", "Impossibile salvare l'ordine %s del %s n. %s, riga %s senza aliquota IVA",
gestione, UtilityDate.formatDate(row.getDataOrd(), CommonConstants.DATE_FORMAT_DMY), row.getNumOrd(), riga)); gestione, CommonConstants.DATE_DMY_SLASHED_FORMATTER.format(row.getDataOrd()), row.getNumOrd(), riga));
} else { } else {
throw new Exception(String.format( throw new Exception(String.format(
"Impossibile salvare il documento %s del %s n. %s/%s, articolo %s senza aliquota IVA", "Impossibile salvare il documento %s del %s n. %s/%s, articolo %s senza aliquota IVA",
((DtbBaseDocR) row).getCodDtip(), ((DtbBaseDocR) row).getCodDtip(),
UtilityDate.formatDate(((DtbBaseDocR) row).getDataDoc(), CommonConstants.DATE_FORMAT_DMY), CommonConstants.DATE_DMY_SLASHED_FORMATTER.format(((DtbBaseDocR) row).getDataDoc()),
((DtbBaseDocR) row).getSerDoc(), ((DtbBaseDocR) row).getSerDoc(),
((DtbBaseDocR) row).getNumDoc(), (codMart == null ? "" : codMart + " - ") + row.getDescrizione() ((DtbBaseDocR) row).getNumDoc(), (codMart == null ? "" : codMart + " - ") + row.getDescrizione()
)); ));
@@ -674,7 +676,11 @@ public class DocOrdCalTotaliRules extends QueryRules {
if ("A".equals(gestione)) { if ("A".equals(gestione)) {
costo = DocumentRules.completeCostoUntDocA(conn, ((DtbDocr) row)); costo = DocumentRules.completeCostoUntDocA(conn, ((DtbDocr) row));
} else if ("L".equals(gestione)) { } else if ("L".equals(gestione)) {
costo = DocumentRules.completeCostoUntDocL(conn, ((DtbDocr) row), flagValCosto); if (testata.getListino().equalsIgnoreCase(ListinoEnum.COSTO_ULTIMO.getValue()) && !UtilityBigDecimal.isNullOrZero(row.getValUnt())) {
costo = row.getValUnt();
} else {
costo = DocumentRules.completeCostoUntDocL(conn, ((DtbDocr) row), flagValCosto);
}
} }
((DtbDocr) row).setCostoUnt(costo); ((DtbDocr) row).setCostoUnt(costo);
} }
@@ -720,7 +726,7 @@ public class DocOrdCalTotaliRules extends QueryRules {
" FROM dtb_docr " + " FROM dtb_docr " +
" WHERE dtb_docr.cod_anag = " + UtilityDB.valueToString(dtbDocr.getCodAnag()) + " AND " + " WHERE dtb_docr.cod_anag = " + UtilityDB.valueToString(dtbDocr.getCodAnag()) + " AND " +
"dtb_docr.cod_dtip = " + UtilityDB.valueToString(dtbDocr.getCodDtipBolla()) + " AND " + "dtb_docr.cod_dtip = " + UtilityDB.valueToString(dtbDocr.getCodDtipBolla()) + " AND " +
"dtb_docr.data_doc = " + UtilityDB.valueDateToString(dtbDocr.getDataDocBolla(), CommonConstants.DATE_FORMAT_YMD) + " AND " + "dtb_docr.data_doc = " + UtilityDB.valueDateToString(dtbDocr.getDataDocBolla(), CommonConstants.DATE_FORMAT_YMD_DASHED) + " AND " +
"dtb_docr.ser_doc = " + UtilityDB.valueToString(dtbDocr.getSerDocBolla()) + " AND " + "dtb_docr.ser_doc = " + UtilityDB.valueToString(dtbDocr.getSerDocBolla()) + " AND " +
"dtb_docr.num_doc = " + UtilityDB.valueToString(dtbDocr.getNumDocBolla()) + " AND " + "dtb_docr.num_doc = " + UtilityDB.valueToString(dtbDocr.getNumDocBolla()) + " AND " +
"dtb_docr.id_riga = " + UtilityDB.valueToString(dtbDocr.getIdRigaBolla()); "dtb_docr.id_riga = " + UtilityDB.valueToString(dtbDocr.getIdRigaBolla());
@@ -1178,7 +1184,7 @@ public class DocOrdCalTotaliRules extends QueryRules {
} }
private static List<CostiDTO> addCosti(final DtbDocr dtbDocr, List< private static List<CostiDTO> addCosti(final DtbDocr dtbDocr, List<
BigDecimal> sconti, List<CostiDTO> listaCosti, String codJfasTestata) throws Exception { BigDecimal> sconti, List<CostiDTO> listaCosti, String codJfasTestata) {
BigDecimal importo = dtbDocr.getImportoRiga(); BigDecimal importo = dtbDocr.getImportoRiga();
for (BigDecimal sconto : sconti) { for (BigDecimal sconto : sconti) {
if (sconto != null) { if (sconto != null) {
@@ -1189,8 +1195,8 @@ public class DocOrdCalTotaliRules extends QueryRules {
if (!UtilityBigDecimal.isNullOrZero(importo)) { if (!UtilityBigDecimal.isNullOrZero(importo)) {
String codJfas = UtilityString.isNull(dtbDocr.getCodJfas(), codJfasTestata); String codJfas = UtilityString.isNull(dtbDocr.getCodJfas(), codJfasTestata);
Date dataInizComp = UtilityDate.isNull(dtbDocr.getDataInizComp(), dtbDocr.getDataDoc()); Date dataInizComp = UtilityDate.isNull(dtbDocr.getDataInizComp(), UtilityLocalDate.localDateToDate(dtbDocr.getDataDoc()));
Date dataFineComp = UtilityDate.isNull(dtbDocr.getDataFineComp(), dtbDocr.getDataDoc()); Date dataFineComp = UtilityDate.isNull(dtbDocr.getDataFineComp(), UtilityLocalDate.localDateToDate(dtbDocr.getDataDoc()));
Optional<CostiDTO> optCosti = Stream.of(listaCosti) Optional<CostiDTO> optCosti = Stream.of(listaCosti)
.filter(value -> UtilityString.equalsIgnoreCase(value.getCodCcon(), dtbDocr.getCodCcon()) && .filter(value -> UtilityString.equalsIgnoreCase(value.getCodCcon(), dtbDocr.getCodCcon()) &&
UtilityString.equalsIgnoreCase(value.getCodJcom(), dtbDocr.getCodJcom()) && UtilityString.equalsIgnoreCase(value.getCodJcom(), dtbDocr.getCodJcom()) &&
@@ -1255,7 +1261,7 @@ public class DocOrdCalTotaliRules extends QueryRules {
" FROM mtb_spes INNER JOIN gtb_spes ON gtb_spes.cod_spes = mtb_spes.cod_spes " + " FROM mtb_spes INNER JOIN gtb_spes ON gtb_spes.cod_spes = mtb_spes.cod_spes " +
" INNER JOIN mtb_aart ON mtb_aart.cod_mart = mtb_spes.cod_mart " + " INNER JOIN mtb_aart ON mtb_aart.cod_mart = mtb_spes.cod_mart " +
" LEFT OUTER JOIN mtb_unt_mis ON gtb_spes.unt_mis = mtb_unt_mis.unt_mis " + " LEFT OUTER JOIN mtb_unt_mis ON gtb_spes.unt_mis = mtb_unt_mis.unt_mis " +
" LEFT OUTER JOIN dbo.getDatiCodSpesCONAI(null, " + UtilityDB.valueToString(testata.getCodAnag()) + ", " + UtilityDB.valueDateToString(testata.getDataDoc(), CommonConstants.DATE_FORMAT_YMD) + ")spesConai ON mtb_spes.cod_spes = spesConai.cod_conai " + " LEFT OUTER JOIN dbo.getDatiCodSpesCONAI(null, " + UtilityDB.valueToString(testata.getCodAnag()) + ", " + UtilityDB.valueToString(testata.getDataDoc()) + ")spesConai ON mtb_spes.cod_spes = spesConai.cod_conai " +
" WHERE mtb_spes.cod_mart = " + UtilityDB.valueToString(row.getCodMart()) + " AND " + " WHERE mtb_spes.cod_mart = " + UtilityDB.valueToString(row.getCodMart()) + " AND " +
" mtb_spes.flag_inc_in_prz = 'N' AND " + " mtb_spes.flag_inc_in_prz = 'N' AND " +
" dbo.f_chkFlagSpesaArtGestione(mtb_spes.cod_mart, mtb_spes.cod_spes, " + UtilityDB.valueToString(testata.getGestione()) + ") = 'S'"; " dbo.f_chkFlagSpesaArtGestione(mtb_spes.cod_mart, mtb_spes.cod_spes, " + UtilityDB.valueToString(testata.getGestione()) + ") = 'S'";
@@ -1405,7 +1411,7 @@ public class DocOrdCalTotaliRules extends QueryRules {
private static Integer setDtbDocs(DtbDoct testata, List<CtbMovi> castelletto, private static Integer setDtbDocs(DtbDoct testata, List<CtbMovi> castelletto,
GtbSpes gtbSpes, BigDecimal qta, BigDecimal importo, GtbSpes gtbSpes, BigDecimal qta, BigDecimal importo,
List<DtbDocs> speseCalc, Integer maxRigaSpesa, List<DtbDocs> speseCalc, Integer maxRigaSpesa,
Boolean ventilazione) throws Exception { Boolean ventilazione) {
maxRigaSpesa++; maxRigaSpesa++;
DtbDocs dtbDocs = new DtbDocs(); DtbDocs dtbDocs = new DtbDocs();
dtbDocs.setEntityHolder(testata.getEntityHolder()); dtbDocs.setEntityHolder(testata.getEntityHolder());
@@ -1631,7 +1637,7 @@ public class DocOrdCalTotaliRules extends QueryRules {
"SELECT saldo " + "SELECT saldo " +
" FROM dbo.GetSaldoContoAnalitico(" + UtilityDB.valueToString(testata.getDtbTipi().getCodCcauAnt()) + ',' " FROM dbo.GetSaldoContoAnalitico(" + UtilityDB.valueToString(testata.getDtbTipi().getCodCcauAnt()) + ','
+ UtilityDB.valueToString(testata.getCodAnag()) + "," + UtilityDB.valueToString(testata.getCodAnag()) + ","
+ UtilityDB.valueDateToString(testata.getDataDoc(), CommonConstants.DATE_FORMAT_YMD) + ")"; + UtilityDB.valueToString(testata.getDataDoc()) + ")";
BigDecimal saldoAcconto = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(connection, sql); BigDecimal saldoAcconto = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(connection, sql);
if (UtilityBigDecimal.isNullOrZero(saldoAcconto)) { if (UtilityBigDecimal.isNullOrZero(saldoAcconto)) {
@@ -1649,7 +1655,7 @@ public class DocOrdCalTotaliRules extends QueryRules {
} else if (DtbTipi.AccontoDa.fromValue(testata.getDtbTipi().getFlagAcconto()) == DtbTipi.AccontoDa.BOLLA && testata.getDtbTipi().getTipoEmissioneEnum() == TipoEmissione.DIFFERITA) { } else if (DtbTipi.AccontoDa.fromValue(testata.getDtbTipi().getFlagAcconto()) == DtbTipi.AccontoDa.BOLLA && testata.getDtbTipi().getTipoEmissioneEnum() == TipoEmissione.DIFFERITA) {
List<DtbDoct> elencoBolle = Stream.of(testata.getDtbDoctBolle()).distinctBy(dtbDoct -> dtbDoct.getCodAnag() + " - " + List<DtbDoct> elencoBolle = Stream.of(testata.getDtbDoctBolle()).distinctBy(dtbDoct -> dtbDoct.getCodAnag() + " - " +
dtbDoct.getCodDtip() + " - " + dtbDoct.getCodDtip() + " - " +
UtilityDate.formatDate(dtbDoct.getDataDoc(), CommonConstants.DATETIME_FORMAT_YMD) + " - " + CommonConstants.DATE_YMD_DASHED_FORMATTER.format(dtbDoct.getDataDoc()) + " - " +
dtbDoct.getSerDoc() + " - " + dtbDoct.getSerDoc() + " - " +
dtbDoct.getNumDoc()).toList(); dtbDoct.getNumDoc()).toList();
for (DtbDoct bolla : elencoBolle) { for (DtbDoct bolla : elencoBolle) {

Some files were not shown because too many files have changed in this diff Show More