Compare commits

...

342 Commits

Author SHA1 Message Date
e0b86db09d Finish v1.49.02(546)
Some checks failed
WMS - Android (New)/pipeline/head Something is wrong with the build of this commit
2025-11-26 13:28:37 +01:00
9d871f3ae4 -> v1.49.02 (546) 2025-11-26 13:28:32 +01:00
e025b234a7 Aggiunto deposito reale nell'header di ogni richiesta 2025-11-26 13:27:50 +01:00
809ef43445 Finish v1.49.01(545) 2025-11-24 17:20:23 +01:00
1079c38a5f Finish v1.49.01(545)
All checks were successful
WMS - Android (New)/pipeline/head This commit looks good
2025-11-24 17:20:22 +01:00
f6388eff1c -> v1.49.01 (545) 2025-11-24 17:20:18 +01:00
495a8dae92 Mini migrazione di dataCollo a LocalDate 2025-11-24 13:11:55 +01:00
ed938815bb Finish v1.49.00(544) 2025-11-24 09:38:12 +01:00
539e8b7c31 Finish v1.49.00(544)
All checks were successful
WMS - Android (New)/pipeline/head This commit looks good
2025-11-24 09:38:11 +01:00
92da8cde53 -> v1.49.00 (544) 2025-11-24 09:37:54 +01:00
3d0f7f16f9 Finish v1.48.03(543)
All checks were successful
WMS - Android (New)/pipeline/head This commit looks good
2025-11-21 13:32:21 +01:00
501ca404ff Finish v1.48.03(543) 2025-11-21 13:32:21 +01:00
5ad4fd7821 -> v1.48.03 (543) 2025-11-21 13:32:10 +01:00
1ba2fb96ba Finish v1.48.02(542) 2025-11-20 11:43:17 +01:00
ffdd1a1df5 Finish v1.48.02(542)
All checks were successful
WMS - Android (New)/pipeline/head This commit looks good
2025-11-20 11:43:16 +01:00
0205255f7d -> v1.48.02 (542) 2025-11-20 11:43:03 +01:00
c21e856a0f Finish v1.48.01(541) 2025-11-19 10:59:03 +01:00
b673940dd6 Finish v1.48.01(541)
All checks were successful
WMS - Android (New)/pipeline/head This commit looks good
2025-11-19 10:59:03 +01:00
b0ce11cbf7 -> v1.48.01 (541) 2025-11-19 10:58:54 +01:00
4ef2c209c8 Finish v1.48.00(540) 2025-11-18 10:22:03 +01:00
41d77b806f Finish v1.48.00(540)
All checks were successful
WMS - Android (New)/pipeline/head This commit looks good
2025-11-18 10:22:02 +01:00
6b65c4a570 -> v1.48.00 (540) 2025-11-18 10:21:46 +01:00
4d5c0e5509 In DtbDoct sostituite date in localDate 2025-11-11 11:50:01 +01:00
21af5fc0a9 In accettazione aggiunta proposta lotto se presente nell'ordine 2025-11-07 13:28:14 +01:00
09b984f5d0 Passato barcode di etichetta anonima in fase di creazione collo 2025-11-06 09:49:18 +01:00
dd473412cc Finish v1.47.26#2 2025-10-29 15:51:00 +01:00
4f0c5bf6dd Finish v1.47.26#2
All checks were successful
WMS - Android (New)/pipeline/head This commit looks good
2025-10-29 15:50:59 +01:00
90e4e2e464 Fix Jenkinsfile 2025-10-29 15:50:24 +01:00
50e2605ea5 Finish v1.47.26(539)
All checks were successful
WMS - Android (New)/pipeline/head This commit looks good
2025-10-29 11:11:43 +01:00
4752e3a3a2 Finish v1.47.26(539) 2025-10-29 11:11:43 +01:00
3fe903cc12 -> v1.47.26 (539) 2025-10-29 11:11:32 +01:00
3f95a70039 Fix addEmsApi in restConsumer 2025-10-29 11:10:11 +01:00
067443698a In Rientro merce, quando si effettua un carico è stato aggiunta la richiesta di versamento automatico 2025-10-28 16:37:23 +01:00
990a4d1538 Finish v1.47.25(538)
All checks were successful
WMS - Android (New)/pipeline/head This commit looks good
2025-10-28 11:33:12 +01:00
55c16e602d Finish v1.47.25(538) 2025-10-28 11:33:12 +01:00
6097a7f736 -> v1.47.25 (538) 2025-10-28 11:32:05 +01:00
f8b92901fd Attivato di default l'http interceptor 2025-10-28 10:38:52 +01:00
6c6daa4809 Finish v1.47.24(537) 2025-10-21 18:33:28 +02:00
de8b48d938 Finish v1.47.24(537)
All checks were successful
WMS - Android (New)/pipeline/head This commit looks good
2025-10-21 18:33:27 +02:00
bfa69ca78b -> v1.47.24 (537) 2025-10-21 18:33:17 +02:00
bffb471015 Fix null in spedizione 2025-10-21 18:32:15 +02:00
087e3e261c Finish v1.47.23(536)
All checks were successful
WMS - Android (New)/pipeline/head This commit looks good
2025-10-15 11:14:03 +02:00
2eff03dee6 Finish v1.47.23(536) 2025-10-15 11:14:03 +02:00
fc34a555bd -> v1.47.23 (536) 2025-10-15 11:13:55 +02:00
0bf21c046f Migliorie UI Dark per Documenti Interni 2025-10-15 11:13:17 +02:00
473ed536fb Finish v1.47.22(535)
All checks were successful
WMS - Android (New)/pipeline/head This commit looks good
2025-10-08 19:29:27 +02:00
dc342c1fee Finish v1.47.22(535) 2025-10-08 19:29:27 +02:00
81507938b1 -> v1.47.22 (535) 2025-10-08 19:29:23 +02:00
cff52140bd Fix UI Dark.
Fix separatore virgola nel dialog input quantity.
2025-10-08 19:28:34 +02:00
24d90b58f9 Implementato popup di Device in end of life 2025-10-02 18:02:13 +02:00
b5d049aa1d Rimosso style AppTheme.NewMaterial.Text.Medium e rimpiazzato con Material 2025-10-02 11:49:59 +02:00
01028f9888 Rimossa tab bar dal main fragment 2025-10-02 11:29:48 +02:00
2774eaecbf Aggiornato Jenkinsfile
All checks were successful
WMS - Android (New)/pipeline/head This commit looks good
2025-10-02 10:45:31 +02:00
648a572752 Finish v1.47.21(534) 2025-10-01 18:29:07 +02:00
022a56a584 Finish v1.47.21(534)
All checks were successful
WMS - Android (New)/pipeline/head This commit looks good
2025-10-01 18:29:06 +02:00
ea97e8f249 -> v1.47.21 (534) 2025-10-01 18:29:01 +02:00
571ad1590f .gitignore 2025-10-01 18:28:30 +02:00
03c02d6625 Migliorie dark mode 2025-10-01 18:22:10 +02:00
ba1118fdd8 Fix decodifica barcode in recupero materiale 2025-10-01 17:45:26 +02:00
7878748548 Miglioramenti UI dark mode 2025-10-01 16:36:34 +02:00
172a8256b6 Aggiornato style AppBar 2025-10-01 14:45:25 +02:00
c16f5c1747 Aggiornato style di alcune textbox 2025-10-01 12:50:02 +02:00
33860a0cfe Finish v1.47.20(533)
All checks were successful
WMS - Android (New)/pipeline/head This commit looks good
2025-09-30 17:44:40 +02:00
15a946dfb6 Finish v1.47.20(533) 2025-09-30 17:44:40 +02:00
62adf49157 -> v1.47.20 (533) 2025-09-30 17:44:34 +02:00
64fcb7ccc8 Fix tara pedana nulla in Bottom Sheet Fragment 2025-09-30 17:42:47 +02:00
3ebdc72642 Finish v1.47.19(532) 2025-09-23 18:03:02 +02:00
aacf5ca76e Finish v1.47.19(532)
All checks were successful
WMS - Android (New)/pipeline/head This commit looks good
2025-09-23 18:03:01 +02:00
4f134bfc8e -> v1.47.19 (532) 2025-09-23 18:02:52 +02:00
6bd1e62190 Fix errori multipli quando il menu non viene caricato 2025-09-18 17:43:44 +02:00
f9f02452d7 Finish v1.47.18(531)
All checks were successful
WMS - Android (New)/pipeline/head This commit looks good
2025-09-17 15:22:44 +02:00
b653ae39af Finish v1.47.18(531) 2025-09-17 15:22:44 +02:00
63d1d9ecf0 -> v1.47.18 (531) 2025-09-17 15:22:40 +02:00
9c72a2a628 Fix su retrieve degli ultimi versamenti di materiale 2025-09-17 15:09:01 +02:00
5f1b7ef4a4 Finish v1.47.17(530)
All checks were successful
WMS - Android (New)/pipeline/head This commit looks good
2025-09-16 17:41:52 +02:00
c36bc9d8c2 Finish v1.47.17(530) 2025-09-16 17:41:52 +02:00
ba9da26ca0 -> v1.47.17 (530) 2025-09-16 17:41:48 +02:00
b2ad4fdb62 Migliorata gestione file di log 2025-09-16 17:40:15 +02:00
60e725f554 Fix su caricamento durante il chiudi ordini spedizione 2025-09-16 12:28:52 +02:00
2f6f9b54c2 Finish v1.47.16(529)
All checks were successful
WMS - Android (New)/pipeline/head This commit looks good
2025-09-16 10:05:39 +02:00
a2ef35e353 Finish v1.47.16(529) 2025-09-16 10:05:39 +02:00
b06f058ecf -> v1.47.16 (529) 2025-09-16 10:05:35 +02:00
e67cbd3760 Merge remote-tracking branch 'origin/develop' into develop 2025-09-15 17:42:12 +02:00
ce9d304043 Aggiunto invio del file raw del log nel caso in cui vada in eccezione il parsine 2025-09-15 17:36:37 +02:00
fc30b8253d Finish v1.47.15(528) 2025-09-11 13:37:26 +02:00
e8da16cb8a Finish v1.47.15(528)
All checks were successful
WMS - Android (New)/pipeline/head This commit looks good
2025-09-11 13:37:25 +02:00
dff725ea92 -> v1.47.15 (528) 2025-09-11 13:37:14 +02:00
e4248c8c48 Fix postValue in recupero materiale 2025-09-11 13:35:57 +02:00
819cc97113 Finish v1.47.14(527) 2025-09-10 16:36:08 +02:00
05d806f9f2 Finish v1.47.14(527)
All checks were successful
WMS - Android (New)/pipeline/head This commit looks good
2025-09-10 16:36:08 +02:00
6fdadffe77 -> v1.47.14 (527) 2025-09-10 16:36:04 +02:00
5ae9371c51 Fix su loading che appare sul popup di conferma chiusura ordine 2025-09-10 16:31:50 +02:00
4861c689d7 Fix su codMdep non ricevuto nel caso di picking Extra Item in Spedizione 2025-09-10 15:50:02 +02:00
1c63908b3b Finish v1.47.13(526) 2025-09-05 11:25:31 +02:00
a622e89058 Finish v1.47.13(526)
All checks were successful
WMS - Android (New)/pipeline/head This commit looks good
2025-09-05 11:25:30 +02:00
ac4500e2a2 -> v1.47.13 (526) 2025-09-05 11:25:26 +02:00
6ebcbc2d6c Merge remote-tracking branch 'origin/develop' into develop
# Conflicts:
#	app/build.gradle
2025-09-05 11:24:48 +02:00
150be3cae2 Rimosso minify 2025-09-05 11:24:37 +02:00
72edf5228a Rimosso minify 2025-09-05 11:24:11 +02:00
b72a3321d9 Finish v1.47.12(525)
All checks were successful
WMS - Android (New)/pipeline/head This commit looks good
2025-09-05 11:03:49 +02:00
5bf71a1b0c Finish v1.47.12(525) 2025-09-05 11:03:49 +02:00
ee10427048 -> v1.47.12 (525) 2025-09-05 11:03:45 +02:00
7fb7cbf8ec Merge remote-tracking branch 'origin/develop' into develop
# Conflicts:
#	app/proguard-rules.pro
2025-09-05 11:02:17 +02:00
3a43e9238b Aggiunta esclusione classi JJWT dall'obfuscation 2025-09-05 11:01:58 +02:00
007d58a17e Aggiunta esclusione classi JJWT dall'obfuscation 2025-09-05 11:00:48 +02:00
998a59cffc Finish v1.47.11(524)#3 2025-09-05 10:37:51 +02:00
11b353a91d Finish v1.47.11(524)#3
All checks were successful
WMS - Android (New)/pipeline/head This commit looks good
2025-09-05 10:37:50 +02:00
8772d11e02 Aggiunto upload simboli su Firebase 2025-09-05 10:37:36 +02:00
3d772e3722 Finish v1.47.11(524)#2 2025-09-05 10:36:55 +02:00
41cfbc273e Finish v1.47.11(524)#2
Some checks failed
WMS - Android (New)/pipeline/head Something is wrong with the build of this commit
2025-09-05 10:36:54 +02:00
bc67098ae0 Aggiunto upload simboli su Firebase 2025-09-05 10:36:33 +02:00
0e49c93678 Finish v1.47.11(524)#1
Some checks failed
WMS - Android (New)/pipeline/head Something is wrong with the build of this commit
2025-09-05 10:35:58 +02:00
ed93b88ee8 Finish v1.47.11(524)#1 2025-09-05 10:35:58 +02:00
2cb184f24b Aggiunto upload simboli su Firebase 2025-09-05 10:35:40 +02:00
126846aef2 Finish v1.47.11(524)
Some checks failed
WMS - Android (New)/pipeline/head There was a failure building this commit
2025-09-05 10:26:20 +02:00
8ac595c6c5 Finish v1.47.11(524) 2025-09-05 10:26:20 +02:00
fc2c0fbe0c -> v1.47.11 (524) 2025-09-05 10:26:15 +02:00
0aa0b09afa Fix su null della variabile Server in Login 2025-09-05 09:47:11 +02:00
9436236eaa Fix postValue in Rientro Merce 2025-09-03 16:51:48 +02:00
fc5568a046 Finish v1.47.10(523) 2025-09-03 13:25:30 +02:00
590e9ec24e Finish v1.47.10(523)
All checks were successful
WMS - Android (New)/pipeline/head This commit looks good
2025-09-03 13:25:29 +02:00
984a4a156b -> v1.47.10 (523) 2025-09-03 13:25:25 +02:00
04afb4cfca Aggiunti serialized name nei DTO del dialog di selezione cliente 2025-09-03 13:24:51 +02:00
81eda94fe0 Finish v1.47.09(522) 2025-09-03 13:01:53 +02:00
8f02dfbee4 Finish v1.47.09(522)
All checks were successful
WMS - Android (New)/pipeline/head This commit looks good
2025-09-03 13:01:52 +02:00
75e1447a54 -> v1.47.09 (522) 2025-09-03 13:01:48 +02:00
d8f9886f82 Aggiornamenti librerie 2025-09-01 18:04:45 +02:00
3279c4e2af Merge remote-tracking branch 'origin/develop' into develop 2025-09-01 17:05:15 +02:00
6f070e6998 Migliorie varie 2025-09-01 17:04:50 +02:00
df4bfcc955 Finish v1.47.08(521) 2025-08-27 12:37:31 +02:00
c1983cf73c Finish v1.47.08(521)
All checks were successful
WMS - Android (New)/pipeline/head This commit looks good
2025-08-27 12:37:30 +02:00
da9bbd0b1c -> v1.47.08 (521) 2025-08-27 12:37:16 +02:00
cd84d3e9a8 Fix gestione errori in spedizione 2025-08-27 12:34:39 +02:00
595f4a8797 Finish v1.47.07(520) 2025-08-26 15:11:00 +02:00
388f08a02f Finish v1.47.07(520)
All checks were successful
WMS - Android (New)/pipeline/head This commit looks good
2025-08-26 15:10:59 +02:00
c562735661 -> v1.47.07 (520) 2025-08-26 15:10:50 +02:00
ab137ad828 Aggiunto controllo della lunghezza di 13 per il barcode nella verifica dell'eanPeso 2025-08-26 15:09:38 +02:00
b56f209084 Modificato il toString del fornitore per il DialogSelectDocInfo 2025-08-26 15:08:42 +02:00
5107897888 Finish v1.47.06(519)
All checks were successful
WMS - Android (New)/pipeline/head This commit looks good
2025-08-06 10:42:50 +02:00
d91eaf3412 Finish v1.47.06(519) 2025-08-06 10:42:50 +02:00
caa6a7cd75 -> v1.47.06 (519) 2025-08-06 10:42:44 +02:00
567b288e4d Migliorata registrazione errore di ExportLog 2025-08-06 10:41:54 +02:00
86121bfa93 Finish v1.47.05(518)
All checks were successful
WMS - Android (New)/pipeline/head This commit looks good
2025-07-29 11:21:53 +02:00
669a38732f Finish v1.47.05(518) 2025-07-29 11:21:53 +02:00
e3e7a7d7c6 -> v1.47.05 (518) 2025-07-29 11:21:47 +02:00
75914ab9c9 Finish v1.47.04(517) 2025-07-28 17:52:40 +02:00
d1976f3e21 Finish v1.47.04(517)
All checks were successful
WMS - Android (New)/pipeline/head This commit looks good
2025-07-28 17:52:39 +02:00
5ef5c4b28a -> v1.47.04 (517) 2025-07-28 17:52:34 +02:00
2c3d4bbc22 Finish v1.47.03(516) 2025-07-14 16:14:39 +02:00
fd8bb8e7da Finish v1.47.03(516)
All checks were successful
WMS - Android (New)/pipeline/head This commit looks good
2025-07-14 16:14:38 +02:00
60a088a7f4 -> v1.47.03 (516) 2025-07-14 16:14:31 +02:00
8ca5207a58 Aggiornato AGP a 8.11.1 2025-07-14 16:13:56 +02:00
f2cc31e08a Finish v1.47.02(515)
All checks were successful
WMS - Android (New)/pipeline/head This commit looks good
2025-07-08 16:18:50 +02:00
e541031efe Finish v1.47.02(515) 2025-07-08 16:18:50 +02:00
d4b220d1e6 -> v1.47.02 (515) 2025-07-08 16:18:46 +02:00
798835cb4c Finish v1.47.01(514)
All checks were successful
WMS - Android (New)/pipeline/head This commit looks good
2025-07-08 12:00:28 +02:00
ba72284c87 Finish v1.47.01(514) 2025-07-08 12:00:28 +02:00
603c5dd8b7 -> v1.47.01 (514) 2025-07-08 12:00:24 +02:00
43fc8be493 Aggiornato AGP a 8.11.0 2025-07-08 11:59:48 +02:00
22bace2402 Finish v1.47.00(513)
All checks were successful
WMS - Android (New)/pipeline/head This commit looks good
2025-07-02 17:22:13 +02:00
3b86460f48 Finish v1.47.00(513) 2025-07-02 17:22:13 +02:00
ddac54b513 -> v1.47.00 (513) 2025-07-02 17:22:08 +02:00
a385b01584 In verifica giagenza gestito salvataggio online per ogni riga 2025-07-01 15:40:02 +02:00
7920166110 Gestita setup per mostrare o no il cambio deposito 2025-06-30 15:31:48 +02:00
e6f4cc9d6d Finish v1.46.24(512)
All checks were successful
WMS - Android (New)/pipeline/head This commit looks good
2025-06-26 11:41:01 +02:00
13d9c40119 Finish v1.46.24(512) 2025-06-26 11:41:01 +02:00
1d7125a821 -> v1.46.24 (512) 2025-06-26 11:40:57 +02:00
deb4d77203 Rimossa eliminazione del primo carattere (se 0) da SSCC durante la decodifica ean128 2025-06-26 11:40:08 +02:00
520a1cb07a Finish v1.46.23(511) 2025-06-24 16:49:12 +02:00
c620e9cb96 Finish v1.46.23(511)
All checks were successful
WMS - Android (New)/pipeline/head This commit looks good
2025-06-24 16:49:11 +02:00
6ef4961074 -> v1.46.23 (511) 2025-06-24 16:49:07 +02:00
688a8e4bad Finish v1.46.22(510) 2025-06-20 18:49:21 +02:00
12796b11e5 Finish v1.46.22(510)
Some checks failed
WMS - Android (New)/pipeline/head Something is wrong with the build of this commit
2025-06-20 18:49:21 +02:00
f7dc857587 -> v1.46.22 (510) 2025-06-20 18:49:16 +02:00
f99c0e5514 Aggiornato Jenkinsfile 2025-06-20 11:58:45 +02:00
f1c304eaeb Finish v1.46.21(509) 2025-06-09 09:48:01 +02:00
7b3fde1d71 Finish v1.46.21(509)
All checks were successful
WMS - Android (New)/pipeline/head This commit looks good
2025-06-09 09:48:00 +02:00
3c337fc138 -> v1.46.21 (509) 2025-06-09 09:47:57 +02:00
021f6974f1 Aggiornato Jenkinsfile
All checks were successful
WMS - Android (New)/pipeline/head This commit looks good
2025-06-03 09:49:13 +02:00
92abfe1da4 Finish v1.46.20(508) 2025-06-03 09:47:38 +02:00
6338c1dfa6 Finish v1.46.20(508)
Some checks failed
WMS - Android (New)/pipeline/head There was a failure building this commit
2025-06-03 09:47:37 +02:00
657d85be86 -> v1.46.20 (508) 2025-06-03 09:47:33 +02:00
97c907c992 Aggiornato build.gradle
All checks were successful
WMS - Android (New)/pipeline/head This commit looks good
2025-05-28 13:41:10 +02:00
caed709b64 Aggiornato build.gradle 2025-05-28 13:32:06 +02:00
13800eecab Aggiornato build.gradle
All checks were successful
WMS - Android (New)/pipeline/head This commit looks good
2025-05-28 13:03:55 +02:00
c4357f662c Finish v1.46.19(507) 2025-05-28 12:51:09 +02:00
67a8ca94db Finish v1.46.19(507)
Some checks failed
WMS - Android (New)/pipeline/head There was a failure building this commit
2025-05-28 12:51:09 +02:00
0bfd56c011 -> v1.46.19 (507) 2025-05-28 12:51:05 +02:00
eead844ac1 Aggiunte definizioni di @SerializedName per evitare minify di Proguard 2025-05-28 12:50:21 +02:00
65cfadcb6e Finish v1.46.18(506)
All checks were successful
WMS - Android (New)/pipeline/head This commit looks good
2025-05-28 12:29:40 +02:00
00067ca1c9 Finish v1.46.18(506) 2025-05-28 12:29:40 +02:00
73ca8bb366 -> v1.46.18 (506) 2025-05-28 12:29:36 +02:00
3ffdb2c220 Fix AuthInterceptor 2025-05-28 12:28:13 +02:00
a5479595c7 Aggiornato build.gradle
Some checks failed
WMS - Android (New)/pipeline/head There was a failure building this commit
2025-05-28 12:24:24 +02:00
cff971bef8 Merge branch 'master' into develop
# Conflicts:
#	Jenkinsfile.groovy
2025-05-28 11:47:20 +02:00
a5d3388665 Aggiornato build.gradle
All checks were successful
WMS - Android (New)/pipeline/head This commit looks good
2025-05-28 11:45:51 +02:00
22ad23c5b7 Aggiornato build.gradle
Some checks failed
WMS - Android (New)/pipeline/head There was a failure building this commit
2025-05-28 11:44:41 +02:00
b1d5e10db4 Aggiornato build.gradle 2025-05-28 11:32:35 +02:00
bde41d21be Modificato Jenkinsfile
Some checks failed
WMS - Android (New)/pipeline/head Something is wrong with the build of this commit
2025-05-28 11:26:12 +02:00
9d8228419c Modificato Jenkinsfile
All checks were successful
WMS - Android (New)/pipeline/head This commit looks good
2025-05-28 11:25:14 +02:00
ad7d9059c0 Modificato Jenkinsfile
All checks were successful
WMS - Android (New)/pipeline/head This commit looks good
2025-05-28 11:19:57 +02:00
4831a7ce19 Modificato Jenkinsfile
Some checks failed
WMS - Android (New)/pipeline/head There was a failure building this commit
2025-05-28 11:19:10 +02:00
552b82feda Modificato Jenkinsfile
All checks were successful
WMS - Android (New)/pipeline/head This commit looks good
2025-05-28 11:10:39 +02:00
6d62a7b10e Modificato Jenkinsfile
All checks were successful
WMS - Android (New)/pipeline/head This commit looks good
2025-05-28 10:57:42 +02:00
667f4aea74 Modificato Jenkinsfile
Some checks failed
WMS - Android (New)/pipeline/head There was a failure building this commit
2025-05-28 10:53:55 +02:00
f80225b7bf Modificato Jenkinsfile
Some checks failed
WMS - Android (New)/pipeline/head There was a failure building this commit
2025-05-28 10:47:00 +02:00
7a02e1d8ad Modificato Jenkinsfile
Some checks failed
WMS - Android (New)/pipeline/head There was a failure building this commit
2025-05-28 10:46:25 +02:00
9cc70f4ee6 Modificato Jenkinsfile
Some checks failed
WMS - Android (New)/pipeline/head There was a failure building this commit
2025-05-28 10:42:51 +02:00
7c4c5da1d6 Modificato Jenkinsfile
Some checks failed
WMS - Android (New)/pipeline/head There was a failure building this commit
2025-05-28 10:41:32 +02:00
b960b6319a Modificato Jenkinsfile
Some checks failed
WMS - Android (New)/pipeline/head There was a failure building this commit
2025-05-28 10:40:47 +02:00
08ddaa7a11 Modificato Jenkinsfile
Some checks failed
WMS - Android (New)/pipeline/head There was a failure building this commit
2025-05-28 10:39:56 +02:00
bcce40094c Modificato Jenkinsfile
Some checks failed
WMS - Android (New)/pipeline/head There was a failure building this commit
2025-05-28 10:33:59 +02:00
960388adf8 Modificato Jenkinsfile 2025-05-28 10:31:48 +02:00
e76722018f Fix AuthInterceptor in caso di AccessToken nullo 2025-05-28 10:30:19 +02:00
fc30017021 Finish v1.46.17(505) 2025-05-28 10:18:03 +02:00
e1dd4f2140 Finish v1.46.17(505) 2025-05-28 10:18:03 +02:00
67a0679de7 -> v1.46.17 (505) 2025-05-28 10:17:58 +02:00
dfc87f7aec Fix AuthInterceptor in caso di AccessToken nullo 2025-05-28 10:17:09 +02:00
886ef6ba08 Finish v1.46.16(504) 2025-05-27 18:44:03 +02:00
fe77f90a7a Finish v1.46.16(504) 2025-05-27 18:44:02 +02:00
7a1f0d6cf6 -> v1.46.16 (504) 2025-05-27 18:43:56 +02:00
004bc3b926 Migliorie sulla gestione dell'access token nell'interceptor e durante il refresh.
Migliorie al loading popup durante il chiudi ordine in spedizione.
2025-05-27 18:43:01 +02:00
5a0b45c6f9 Finish v1.46.15(503) 2025-05-27 17:48:12 +02:00
be5ebb89d7 Finish v1.46.15(503) 2025-05-27 17:48:12 +02:00
f81d61c4c5 -> v1.46.15 (503) 2025-05-27 17:47:59 +02:00
634bc502ce Fix null dovuto alla getBancaliGiaRegistratiSynchronized 2025-05-27 17:45:24 +02:00
d13dbf1ad3 Finish v1.46.14(502) 2025-05-26 09:44:01 +02:00
2f9ee642da Finish v1.46.14(502) 2025-05-26 09:44:00 +02:00
afecc11364 -> v1.46.14 (502) 2025-05-26 09:43:55 +02:00
b33d566abd Implementato servizio di retrieve uds già registrate 2025-05-20 15:25:48 +02:00
69d880b587 Finish v1.46.13(501) 2025-05-15 18:30:56 +02:00
aeadea42e1 Finish v1.46.13(501) 2025-05-15 18:30:56 +02:00
f5c3dcfdc9 -> v1.46.13 (501) 2025-05-15 18:30:52 +02:00
d30af1e2a6 In VerificaGiacenze abilitato OverflowOrderQuantity 2025-05-15 12:53:12 +02:00
71a18e9ffa Fix scansione barcode alternativi in VerificaGiacenze 2025-05-15 12:52:42 +02:00
40e1fb4f83 Finish v1.46.12(500) 2025-05-14 12:05:35 +02:00
f3f0fd8fd8 Finish v1.46.12(500) 2025-05-14 12:05:35 +02:00
ed53b9e3b4 -> v1.46.12 (500) 2025-05-14 12:05:30 +02:00
37ac05b8ab Aggiornato gradle e librerie 2025-05-14 12:04:49 +02:00
823d0d7a33 Finish v1.46.11(499) 2025-05-07 12:01:10 +02:00
5b07ff5efa Finish v1.46.11(499) 2025-05-07 12:01:09 +02:00
c5639a643a -> v1.46.11 (499) 2025-05-07 12:01:00 +02:00
012f75198b Fix null sitArts 2025-05-07 12:00:17 +02:00
d7e0e858d2 Finish v1.46.10(498) 2025-05-05 17:00:41 +02:00
339a5e5b68 Finish v1.46.10(498) 2025-05-05 17:00:40 +02:00
02a13911d8 -> v1.46.10 (498) 2025-05-05 17:00:34 +02:00
b6f51971f1 Fix su DialogChooseArtFromListaArts 2025-05-05 16:59:43 +02:00
57079c0062 Finish v1.46.09(497) 2025-04-29 11:50:02 +02:00
63c353a83c Finish v1.46.09(497) 2025-04-29 11:50:02 +02:00
c069d21cbf -> v1.46.09 (497) 2025-04-29 11:49:53 +02:00
afeb9ecc23 Fix thread picking libero 2025-04-29 11:48:36 +02:00
2ff8d80da3 In verifica giacenza permettere di caricare 0 nella quantità 2025-04-28 17:13:19 +02:00
891e2641fa Aggiunta possibilità di rendere non editabile qtaTot in accettazione bolla 2025-04-28 17:08:30 +02:00
ca79107809 Finish v1.46.08(496) 2025-04-28 13:08:20 +02:00
5c37b986ce Finish v1.46.08(496) 2025-04-28 13:08:19 +02:00
c426250cd5 -> v1.46.08 (496) 2025-04-28 13:08:04 +02:00
f090c11146 Fix scan barcode in verifica giacenze 2025-04-28 13:06:03 +02:00
5c90f22a49 Finish V1.46.07(495) 2025-04-16 12:54:27 +02:00
f1ddaa1fca Finish V1.46.07(495) 2025-04-16 12:54:27 +02:00
8490553a32 -> v1.46.07 (495) 2025-04-16 12:54:15 +02:00
66824fccb1 Fix thread scanBarcode in DialogInputQuantity 2025-04-16 12:53:13 +02:00
39dce4d23f Merge remote-tracking branch 'origin/develop' into develop 2025-04-16 10:36:30 +02:00
c1dbbde905 Cambiato barcode di creazione UL in DialogScanOrCreateLUViewModel 2025-04-16 10:36:17 +02:00
8d2d0ad195 Finish v1.46.06(494) 2025-04-15 18:41:01 +02:00
927b14c9fc Finish v1.46.06(494) 2025-04-15 18:41:01 +02:00
f342cd0e5f -> v1.46.06 (494) 2025-04-15 18:40:53 +02:00
c287852ce6 Fix modal BatchLotSelection 2025-04-15 18:39:38 +02:00
edc9470e9b Finish v1.46.05(493) 2025-04-10 10:21:37 +02:00
7adeee589e Finish v1.46.05(493) 2025-04-10 10:21:37 +02:00
52a393c260 -> 1.46.05 (493) 2025-04-10 10:21:29 +02:00
60a405536c Fix thread su creaUl in PickingResi e su DialogBasket 2025-04-10 10:20:19 +02:00
5f5117c0f6 Finish v1.46.04(492) 2025-04-09 15:32:17 +02:00
0740faa964 Finish v1.46.04(492) 2025-04-09 15:32:16 +02:00
2f40302791 -> v1.46.04 (492) 2025-04-09 15:32:03 +02:00
13b3d5e63b Refactor dialog choose art form list Arts 2025-04-09 15:29:59 +02:00
58521997c1 Fix su popup filtro resi Acquisto/Vendita 2025-04-09 14:53:10 +02:00
af64ca04f9 Iniziata migrazione del nuovo versamento materiali 2025-04-09 09:29:44 +02:00
1e9d048264 Finish v1.46.03(491) 2025-04-08 15:54:57 +02:00
6f202c0c7a Finish v1.46.03(491) 2025-04-08 15:54:56 +02:00
94a9690045 -> v1.46.03 (491) 2025-04-08 15:54:52 +02:00
2b4aa11021 Fix su Spedizione e picking libero 2025-04-08 15:49:39 +02:00
f2d5bb76c5 Fix su loop nel caso di ricerca barcode kit in accettazione da bolla 2025-04-08 15:49:19 +02:00
7bdb9b47f4 Fix su qtaCnfOrd in VerificaGiacenze 2025-04-01 17:27:36 +02:00
68bf6767b9 Implementato servizio di changePosizione 2025-04-01 16:52:24 +02:00
184d1f759c Finish v1.46.00(488) 2025-03-31 10:36:19 +02:00
2a26236d94 Finish v1.46.00(488) 2025-03-31 10:36:18 +02:00
71a00ac140 Finish v1.46.00/488) 2025-03-31 10:35:44 +02:00
f10aaaba6b Finish v1.46.00/488) 2025-03-31 10:35:43 +02:00
296675f0b0 -> v1.46.00 (488) 2025-03-31 10:35:39 +02:00
7f365be53d Finish FastPickingSpedizione 2025-03-31 10:33:46 +02:00
9e85204d04 Merge branch 'develop' into feature/FastPickingSpedizione 2025-03-27 10:35:31 +01:00
d5d80e71e7 Finish v1.45.05(487) 2025-03-27 10:34:52 +01:00
73b360f427 Finish v1.45.05(487) 2025-03-27 10:34:52 +01:00
722094bc3e -> v1.45.05 (487) 2025-03-27 10:34:47 +01:00
645b2cfe5d Cambiato servizio di retrieve giacenza in VerificaGiacenze 2025-03-27 10:32:41 +01:00
afcaa82069 Finish v1.45.04(486) 2025-03-19 18:22:08 +01:00
393bffe14c Finish v1.45.04(486) 2025-03-19 18:22:08 +01:00
d44b6f00c6 -> v1.45.04 (486) 2025-03-19 18:22:03 +01:00
de68c3b49f Merge remote-tracking branch 'origin/develop' into develop 2025-03-19 18:20:07 +01:00
0591b60fad Rimossa randomizzazione dati Verifica Giacenze 2025-03-19 18:18:42 +01:00
a6cebccad9 Merge branch 'develop' into feature/FastPickingSpedizione 2025-03-18 17:54:49 +01:00
4186d90a32 Finish v1.45.03(485) 2025-03-18 17:54:28 +01:00
bb21441c3d Finish v1.45.03(485) 2025-03-18 17:54:27 +01:00
12b1b89713 -> v1.45.03 (485) 2025-03-18 17:54:15 +01:00
26512f5dc1 Merge branch 'develop' into feature/FastPickingSpedizione 2025-03-18 17:51:36 +01:00
4d29e2ab41 In accettazione bolla sitemato ordinamento righe e aggiunto controllo anomalie 2025-03-18 17:50:48 +01:00
6c6fd38482 Merge branch 'develop' into feature/FastPickingSpedizione
# Conflicts:
#	app/src/main/java/it/integry/integrywmsnative/gest/spedizione/SpedizioneActivity.java
#	app/src/main/java/it/integry/integrywmsnative/gest/spedizione/SpedizioneModule.java
#	app/src/main/java/it/integry/integrywmsnative/gest/spedizione/SpedizioneViewModel.java
2025-03-18 12:20:54 +01:00
2e37e874c3 Finish v1.45.02(484) 2025-03-18 12:17:24 +01:00
1b4df1ecd1 Implementato flag che abilita/disabilita il fast-picking 2025-03-17 18:59:47 +01:00
ce5ab1cfc2 Resa synchronized l'init iniziale dell'app 2025-03-17 18:31:45 +01:00
3ac021d7ef Merge branch 'develop' into feature/FastPickingSpedizione 2025-03-17 11:51:44 +01:00
4613f13eae Merge branch 'develop' into feature/FastPickingSpedizione 2025-03-14 18:20:18 +01:00
71f077a617 Fix after merge 2025-03-14 13:25:40 +01:00
a80cf53f08 Merge branch 'develop' into feature/FastPickingSpedizione
# Conflicts:
#	app/src/main/java/it/integry/integrywmsnative/MainApplicationModule.java
#	app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/ArticoloRESTConsumer.java
#	app/src/main/java/it/integry/integrywmsnative/gest/picking_libero/PickingLiberoViewModel.java
#	app/src/main/java/it/integry/integrywmsnative/gest/spedizione/SpedizioneViewModel.java
2025-03-14 13:23:32 +01:00
ff73a124f0 Merge branch 'develop' into feature/FastPickingSpedizione
# Conflicts:
#	app/src/main/java/it/integry/integrywmsnative/gest/spedizione/SpedizioneViewModel.java
2025-03-12 19:30:44 +01:00
18937a3315 Fix vari su Synchronized e MainThread 2025-03-12 19:26:45 +01:00
fb6a74aef8 Merge branch 'develop' into feature/FastPickingSpedizione
# Conflicts:
#	app/src/main/java/it/integry/integrywmsnative/view/dialogs/scan_art/DialogScanArtView.java
2025-03-12 18:16:07 +01:00
cd89ce917e Fix vari su Synchronized e MainThread 2025-03-12 18:11:53 +01:00
eb5ae8443d Merge branch 'develop' into feature/FastPickingSpedizione 2025-03-04 11:02:46 +01:00
044bcbd852 Fix after merge 2025-03-04 11:01:38 +01:00
53ba5a962b Merge branch 'develop' into feature/FastPickingSpedizione
# Conflicts:
#	app/src/main/java/it/integry/integrywmsnative/view/dialogs/ask_position_of_lu/DialogAskPositionOfLUView.java
#	app/src/main/java/it/integry/integrywmsnative/view/dialogs/scan_or_create_lu/DialogScanOrCreateLUView.java
2025-03-04 10:58:15 +01:00
db178ce991 Merge branch 'develop' into feature/FastPickingSpedizione
# Conflicts:
#	app/src/main/java/it/integry/integrywmsnative/gest/picking_libero/PickingLiberoViewModel.java
2025-03-03 18:10:13 +01:00
7c35e19ed4 Fix vari 2025-03-03 17:50:18 +01:00
326a3a00b2 Fix check deposito 2025-03-03 13:30:43 +01:00
086597985b Merge branch 'develop' into feature/FastPickingSpedizione
# Conflicts:
#	app/src/main/java/it/integry/integrywmsnative/view/dialogs/input_quantity_v2/DialogInputQuantityV2View.java
2025-03-03 12:35:33 +01:00
d238cb1d88 Merge branch 'develop' into feature/FastPickingSpedizione 2025-02-28 17:01:03 +01:00
5694d8bd1c Migliorata gestione callback e chiamate in background per Picking Libero 2025-02-28 15:26:02 +01:00
e5a4cf59c4 Merge branch 'develop' into feature/FastPickingSpedizione
# Conflicts:
#	app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/ColliMagazzinoRESTConsumer.java
#	app/src/main/java/it/integry/integrywmsnative/gest/picking_libero/PickingLiberoFragment.java
#	app/src/main/java/it/integry/integrywmsnative/view/dialogs/input_quantity_v2/DialogInputQuantityV2View.java
2025-02-28 11:56:58 +01:00
12fe5059a6 Merge branch 'master-beta' into feature/FastPickingSpedizione 2025-02-26 19:10:48 +01:00
e75121b0bd Refactor: Improve data recovery in MainFragment
- Replaced the previous data recovery mechanism with an ExecutorService-based approach.
- This allows for concurrent recovery operations, improving overall efficiency.
- Improved error handling by removing unnecessary callbacks and handling exceptions directly.
- Replaced cyclic recursion with a simpler iterative loop for session recovery.
2025-02-26 19:10:30 +01:00
0312f972bc Refactor: Update weight input dialog and LU closing logic
- Changed `DialogInputPesoLUView` to use `BindableBigDecimal` for weight fields.
- Updated `DialogInputPesoLUView` to invoke onComplete only after user confirmation
- Refactored `SpedizioneViewModel` to correctly set values coming from the weight input dialog
- Removed commented-out code in `SpedizioneViewModel`
- Added handling for null values in weight fields.
- `SpedizioneActivity` changed to pass current values to `DialogInputPesoLUView`
- Fixed recovery mode UI not collapsing
2025-02-26 19:01:04 +01:00
9d48fec426 Aggiunto controllo su deposito in fase di picking uscita 2025-02-26 18:36:17 +01:00
645045b492 Fix su filtri ordini uscita 2025-02-26 13:50:20 +01:00
1988fae4f9 Aggiunto profiler recyclerview solo in caso di debug 2025-02-26 13:12:00 +01:00
6c621d5ca8 Migliorie sul caricamento della lista di ordini di uscita 2025-02-26 13:06:56 +01:00
b8c8a9d8ea Merge branch 'develop' into feature/FastPickingSpedizione 2025-02-26 11:05:52 +01:00
002e855d82 Merge branch 'feature/GestioneDocumentiLavorazione' into feature/FastPickingSpedizione 2025-02-26 10:29:35 +01:00
1c6de11e04 Merge branch 'develop' into feature/FastPickingSpedizione
# Conflicts:
#	app/src/main/java/it/integry/integrywmsnative/MainApplicationModule.java
#	app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/SystemRESTConsumer.java
2025-02-26 10:27:27 +01:00
ce3dfca6e0 Rimosso parametro inutilizzato in build.gradle 2025-02-24 18:55:45 +01:00
706878b1e4 Migliorato adapter avantielenco ordini di uscita 2025-02-24 18:35:17 +01:00
6c59e22101 Merge branch 'develop' into feature/FastPickingSpedizione 2025-02-24 15:31:40 +01:00
2d48f6687c Aggiunta logica di fast picking in spedizione, scansionando un barcode di una UL all'interno di DialogInputQuantity verrà automaticamente chiusa l'ul attuale e riavviato il processo di scansione del barcode 2025-02-24 12:05:39 +01:00
356 changed files with 8964 additions and 5781 deletions

3
.gitignore vendored
View File

@@ -149,3 +149,6 @@ crashlytics.properties
crashlytics-build.properties crashlytics-build.properties
### AndroidStudio Patch ### ### AndroidStudio Patch ###
!/gradle/wrapper/gradle-wrapper.jar !/gradle/wrapper/gradle-wrapper.jar
copilot.*.xml
/.idea/dataSources.xml

View File

@@ -1,5 +1,40 @@
<component name="ProjectCodeStyleConfiguration"> <component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173"> <code_scheme name="Project" version="173">
<JavaCodeStyleSettings>
<option name="IMPORT_LAYOUT_TABLE">
<value>
<package name="" withSubpackages="true" static="false" module="true" />
<package name="android" withSubpackages="true" static="true" />
<package name="androidx" withSubpackages="true" static="true" />
<package name="com" withSubpackages="true" static="true" />
<package name="junit" withSubpackages="true" static="true" />
<package name="net" withSubpackages="true" static="true" />
<package name="org" withSubpackages="true" static="true" />
<package name="java" withSubpackages="true" static="true" />
<package name="javax" withSubpackages="true" static="true" />
<package name="" withSubpackages="true" static="true" />
<emptyLine />
<package name="android" withSubpackages="true" static="false" />
<emptyLine />
<package name="androidx" withSubpackages="true" static="false" />
<emptyLine />
<package name="com" withSubpackages="true" static="false" />
<emptyLine />
<package name="junit" withSubpackages="true" static="false" />
<emptyLine />
<package name="net" withSubpackages="true" static="false" />
<emptyLine />
<package name="org" withSubpackages="true" static="false" />
<emptyLine />
<package name="java" withSubpackages="true" static="false" />
<emptyLine />
<package name="javax" withSubpackages="true" static="false" />
<emptyLine />
<package name="" withSubpackages="true" static="false" />
<emptyLine />
</value>
</option>
</JavaCodeStyleSettings>
<JetCodeStyleSettings> <JetCodeStyleSettings>
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" /> <option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</JetCodeStyleSettings> </JetCodeStyleSettings>

View File

@@ -4,10 +4,10 @@
<selectionStates> <selectionStates>
<SelectionState runConfigName="app"> <SelectionState runConfigName="app">
<option name="selectionMode" value="DROPDOWN" /> <option name="selectionMode" value="DROPDOWN" />
<DropdownSelection timestamp="2025-03-17T09:16:48.549771200Z"> <DropdownSelection timestamp="2025-10-02T11:26:10.944286600Z">
<Target type="DEFAULT_BOOT"> <Target type="DEFAULT_BOOT">
<handle> <handle>
<DeviceId pluginId="PhysicalDevice" identifier="serial=21088B8EFD" /> <DeviceId pluginId="PhysicalDevice" identifier="serial=7da0808" />
</handle> </handle>
</Target> </Target>
</DropdownSelection> </DropdownSelection>

View File

@@ -1,6 +1,7 @@
<component name="ProjectRunConfigurationManager"> <component name="ProjectRunConfigurationManager">
<configuration default="false" name="app" type="AndroidRunConfigurationType" factoryName="Android App"> <configuration default="false" name="app" type="AndroidRunConfigurationType" factoryName="Android App">
<module name="WMS.app.main" /> <module name="WMS.app" />
<option name="ANDROID_RUN_CONFIGURATION_SCHEMA_VERSION" value="1" />
<option name="DEPLOY" value="true" /> <option name="DEPLOY" value="true" />
<option name="DEPLOY_APK_FROM_BUNDLE" value="false" /> <option name="DEPLOY_APK_FROM_BUNDLE" value="false" />
<option name="DEPLOY_AS_INSTANT" value="false" /> <option name="DEPLOY_AS_INSTANT" value="false" />
@@ -8,14 +9,17 @@
<option name="PM_INSTALL_OPTIONS" value="" /> <option name="PM_INSTALL_OPTIONS" value="" />
<option name="ALL_USERS" value="false" /> <option name="ALL_USERS" value="false" />
<option name="ALWAYS_INSTALL_WITH_PM" value="false" /> <option name="ALWAYS_INSTALL_WITH_PM" value="false" />
<option name="ALLOW_ASSUME_VERIFIED" value="false" />
<option name="CLEAR_APP_STORAGE" value="false" /> <option name="CLEAR_APP_STORAGE" value="false" />
<option name="DYNAMIC_FEATURES_DISABLED_LIST" value="" /> <option name="DYNAMIC_FEATURES_DISABLED_LIST" value="" />
<option name="ACTIVITY_EXTRA_FLAGS" value="" /> <option name="ACTIVITY_EXTRA_FLAGS" value="" />
<option name="MODE" value="default_activity" /> <option name="MODE" value="default_activity" />
<option name="RESTORE_ENABLED" value="false" />
<option name="RESTORE_FILE" value="" />
<option name="RESTORE_FRESH_INSTALL_ONLY" value="false" />
<option name="CLEAR_LOGCAT" value="false" /> <option name="CLEAR_LOGCAT" value="false" />
<option name="SHOW_LOGCAT_AUTOMATICALLY" value="false" /> <option name="SHOW_LOGCAT_AUTOMATICALLY" value="false" />
<option name="INSPECTION_WITHOUT_ACTIVITY_RESTART" value="false" /> <option name="TARGET_SELECTION_MODE" value="DEVICE_AND_SNAPSHOT_COMBO_BOX" />
<option name="TARGET_SELECTION_MODE" value="SHOW_DIALOG" />
<option name="SELECTED_CLOUD_MATRIX_CONFIGURATION_ID" value="-1" /> <option name="SELECTED_CLOUD_MATRIX_CONFIGURATION_ID" value="-1" />
<option name="SELECTED_CLOUD_MATRIX_PROJECT_ID" value="" /> <option name="SELECTED_CLOUD_MATRIX_PROJECT_ID" value="" />
<option name="DEBUGGER_TYPE" value="Auto" /> <option name="DEBUGGER_TYPE" value="Auto" />
@@ -59,6 +63,7 @@
<option name="NATIVE_MEMORY_SAMPLE_RATE_BYTES" value="2048" /> <option name="NATIVE_MEMORY_SAMPLE_RATE_BYTES" value="2048" />
</Profilers> </Profilers>
<option name="DEEP_LINK" value="" /> <option name="DEEP_LINK" value="" />
<option name="ACTIVITY" value="" />
<option name="ACTIVITY_CLASS" value="" /> <option name="ACTIVITY_CLASS" value="" />
<option name="SEARCH_ACTIVITY_IN_GLOBAL_SCOPE" value="false" /> <option name="SEARCH_ACTIVITY_IN_GLOBAL_SCOPE" value="false" />
<option name="SKIP_ACTIVITY_VALIDATION" value="false" /> <option name="SKIP_ACTIVITY_VALIDATION" value="false" />

72
Jenkinsfile.groovy Normal file
View File

@@ -0,0 +1,72 @@
pipeline {
agent {
label 'master'
}
options {
buildDiscarder(logRotator(numToKeepStr: '30', artifactNumToKeepStr: '10'))
disableConcurrentBuilds()
}
environment {
// ANDROID_HOME = "/usr/local/android/sdk" // Cambia in base al tuo sistema
JAVA_HOME = tool 'JDK 17.0.6 x64' // Nome dello strumento configurato in Jenkins
PATH = "${env.JAVA_HOME}\\bin;${env.PATH}"
}
stages {
stage('Preparing') {
when {
expression {
return env.GIT_BRANCH == "master-beta"
}
}
steps {
bat "./gradlew addBetaSuffix"
}
}
stage('Build') {
steps {
bat "./gradlew assembleRelease"
archiveArtifacts artifacts: 'app/build/outputs/apk/release/', onlyIfSuccessful: true
}
}
stage('Publish') {
steps {
azureUpload allowAnonymousAccess: true, fileShareName: 'storage-ci', filesPath: 'app/build/outputs/apk/release/*.apk,app/build/outputs/apk/release/*.txt', removePrefixPath: 'app/build/outputs/apk/release/', storageCredentialId: '83a86793-c1d6-4776-b20f-1ff652a57fee', storageType: 'filestorage', uploadArtifactsOnlyIfSuccessful: true, verbose: true, virtualPath: 'wms'
}
}
}
post {
success {
script {
bat 'curl -k "https://devservices.studioml.it/ems-api/updateWMSApp?overrideForced=false"'
bat 'curl -k "https://devservices.studioml.it/ems-api/updateWMSApp?overrideForced=false&suffix=beta"'
bat 'curl -k "https://services.studioml.it/ems-api/updateWMSApp?overrideForced=false"'
bat 'curl -k "https://services.studioml.it/ems-api/updateWMSApp?overrideForced=false&suffix=beta"'
if (env.GIT_BRANCH == "master" || env.GIT_BRANCH == "master-beta") {
office365ConnectorSend adaptiveCards: true, color: '#008000', message: 'WMS è stato compilato con successo', status: 'SUCCESS', webhookUrl: 'https://default0b9c060c159c4e5f82a77459a72572.16.environment.api.powerplatform.com:443/powerautomate/automations/direct/workflows/a73f903a4044474c84ad9a0d68a9a479/triggers/manual/paths/invoke?api-version=1&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=gXc43FQXqIq7Xpfvis2XgFoPl8lpg0Sf5HtuxZG_jeI'
}
}
}
unstable {
script {
if (env.GIT_BRANCH == "master" || env.GIT_BRANCH == "master-beta") {
office365ConnectorSend adaptiveCards: true, color: '#FFDE21', message: 'WMS è INSTABILE', status: 'UNSTABLE', webhookUrl: 'https://default0b9c060c159c4e5f82a77459a72572.16.environment.api.powerplatform.com:443/powerautomate/automations/direct/workflows/a73f903a4044474c84ad9a0d68a9a479/triggers/manual/paths/invoke?api-version=1&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=gXc43FQXqIq7Xpfvis2XgFoPl8lpg0Sf5HtuxZG_jeI'
}
}
}
failure {
script {
if (env.GIT_BRANCH == "master" || env.GIT_BRANCH == "master-beta") {
office365ConnectorSend adaptiveCards: true, color: '#FF2C2C', message: 'Errore di compilazione su WMS', status: 'FAILURE', webhookUrl: 'https://default0b9c060c159c4e5f82a77459a72572.16.environment.api.powerplatform.com:443/powerautomate/automations/direct/workflows/a73f903a4044474c84ad9a0d68a9a479/triggers/manual/paths/invoke?api-version=1&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=gXc43FQXqIq7Xpfvis2XgFoPl8lpg0Sf5HtuxZG_jeI'
}
}
}
}
}

View File

@@ -8,10 +8,11 @@ apply plugin: 'com.google.firebase.crashlytics'
//apply plugin: 'kotlin-android' //apply plugin: 'kotlin-android'
apply plugin: 'com.google.gms.google-services' apply plugin: 'com.google.gms.google-services'
android { android {
def appVersionCode = 484 def appVersionCode = 546
def appVersionName = '1.45.02' def appVersionName = '1.49.02'
signingConfigs { signingConfigs {
release { release {
@@ -34,7 +35,7 @@ android {
defaultConfig { defaultConfig {
applicationId "it.integry.integrywmsnative" applicationId "it.integry.integrywmsnative"
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 35 targetSdk 36
versionCode appVersionCode versionCode appVersionCode
versionName appVersionName versionName appVersionName
// testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" // testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -51,17 +52,26 @@ android {
buildTypes { buildTypes {
debug { debug {
ext.enableCrashlytics = false ext.enableCrashlytics = false
// minifyEnabled true // Abilita la minimizzazione del codice
// shrinkResources true // Rimuove risorse non utilizzate
// proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
} }
release { release {
minifyEnabled false // minifyEnabled true // Abilita la minimizzazione del codice
// shrinkResources true // Rimuove risorse non utilizzate
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release signingConfig signingConfigs.release
firebaseCrashlytics {
mappingFileUploadEnabled true
}
} }
} }
android.buildFeatures.dataBinding true android.buildFeatures.dataBinding true
android.buildFeatures.buildConfig true android.buildFeatures.buildConfig true
android.dataBinding.enabledForTests true
compileOptions { compileOptions {
sourceCompatibility JavaVersion.VERSION_17 sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17 targetCompatibility JavaVersion.VERSION_17
@@ -72,12 +82,7 @@ android {
} }
build {
doLast {
delete "$projectDir/build/outputs/apk/release/version.txt"
file("$projectDir/build/outputs/apk/release/version.txt").text = appVersionCode + '\n' + appVersionName + '\n' + 'forced=true'
}
}
gradle.projectsEvaluated { gradle.projectsEvaluated {
tasks.withType(JavaCompile.class).tap { tasks.withType(JavaCompile.class).tap {
@@ -90,7 +95,7 @@ android {
abortOnError false abortOnError false
} }
namespace 'it.integry.integrywmsnative' namespace 'it.integry.integrywmsnative'
compileSdk 35 compileSdk 36
} }
configurations { configurations {
@@ -99,35 +104,33 @@ configurations {
} }
dependencies { dependencies {
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.4' coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.5'
implementation fileTree(include: ['*.jar'], dir: 'libs') implementation fileTree(include: ['*.jar'], dir: 'libs')
// androidTestImplementation('androidx.test.espresso:espresso-core:3.6.1', { // androidTestImplementation('androidx.test.espresso:espresso-core:3.6.1', {
// exclude group: 'com.android.support', module: 'support-annotations' // exclude group: 'com.android.support', module: 'support-annotations'
// }) // })
// implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" // implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'com.github.lupaulus:logger:2.3.2' implementation 'com.github.lupaulus:logger:2.3.2'
//Firebase
// Import the Firebase BoM // Import the Firebase BoM
implementation platform('com.google.firebase:firebase-bom:33.8.0') implementation platform('com.google.firebase:firebase-bom:33.16.0')
implementation 'com.google.firebase:firebase-analytics' implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.firebase:firebase-crashlytics' implementation 'com.google.firebase:firebase-crashlytics'
implementation 'com.google.firebase:firebase-perf' implementation 'com.google.firebase:firebase-perf'
implementation 'com.google.android.gms:play-services-basement:18.5.0' implementation 'com.google.android.gms:play-services-basement:18.7.1'
//JJWT //JJWT
implementation 'io.jsonwebtoken:jjwt-api:0.11.5' implementation 'io.jsonwebtoken:jjwt-api:0.13.0'
runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.11.5' runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.13.0'
runtimeOnly 'io.jsonwebtoken:jjwt-jackson:0.11.5' runtimeOnly 'io.jsonwebtoken:jjwt-jackson:0.13.0'
implementation 'androidx.appcompat:appcompat:1.7.1'
implementation 'androidx.appcompat:appcompat:1.7.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.12.0' implementation 'com.google.android.material:material:1.12.0'
implementation 'androidx.constraintlayout:constraintlayout:2.2.0' implementation 'androidx.constraintlayout:constraintlayout:2.2.1'
implementation 'androidx.cardview:cardview:1.0.0' implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.4.0' implementation 'androidx.recyclerview:recyclerview:1.4.0'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
implementation('androidx.preference:preference-ktx:1.2.1') { implementation('androidx.preference:preference-ktx:1.2.1') {
exclude group: 'androidx.lifecycle', module: 'lifecycle-viewmodel' exclude group: 'androidx.lifecycle', module: 'lifecycle-viewmodel'
@@ -135,20 +138,18 @@ dependencies {
} }
implementation "androidx.slidingpanelayout:slidingpanelayout:1.2.0" implementation "androidx.slidingpanelayout:slidingpanelayout:1.2.0"
implementation 'com.squareup.okhttp3:okhttp:4.10.0' implementation 'com.squareup.retrofit2:retrofit:3.0.0'
implementation 'com.squareup.retrofit2:retrofit:2.9.0' implementation 'com.squareup.retrofit2:converter-gson:3.0.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation 'com.annimon:stream:1.2.2' implementation 'com.annimon:stream:1.2.2'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.8.7' implementation 'androidx.lifecycle:lifecycle-runtime:2.9.3'
// implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0' implementation 'org.apache.commons:commons-text:1.14.0'
implementation 'org.apache.commons:commons-text:1.9'
//MVVM //MVVM
def dagger2_version = '2.55' def dagger2_version = '2.57.1'
api "com.google.dagger:dagger:$dagger2_version" implementation "com.google.dagger:dagger:$dagger2_version"
annotationProcessor "com.google.dagger:dagger-compiler:$dagger2_version" annotationProcessor "com.google.dagger:dagger-compiler:$dagger2_version"
api "com.google.dagger:dagger-android:$dagger2_version" implementation "com.google.dagger:dagger-android:$dagger2_version"
api "com.google.dagger:dagger-android-support:$dagger2_version" implementation "com.google.dagger:dagger-android-support:$dagger2_version"
// if you use the support libraries // if you use the support libraries
annotationProcessor "com.google.dagger:dagger-android-processor:$dagger2_version" annotationProcessor "com.google.dagger:dagger-android-processor:$dagger2_version"
@@ -160,7 +161,7 @@ dependencies {
implementation 'com.github.pedromassango:doubleClick:3.0' implementation 'com.github.pedromassango:doubleClick:3.0'
//SQLite ROOM //SQLite ROOM
def room_version = "2.6.1" def room_version = "2.7.2"
implementation "androidx.room:room-runtime:$room_version" implementation "androidx.room:room-runtime:$room_version"
annotationProcessor "androidx.room:room-compiler:$room_version" annotationProcessor "androidx.room:room-compiler:$room_version"
@@ -186,14 +187,13 @@ dependencies {
implementation 'com.github.harry1453:android-bluetooth-serial:v1.1.2' implementation 'com.github.harry1453:android-bluetooth-serial:v1.1.2'
// RxJava is also required. // RxJava is also required.
implementation 'io.reactivex.rxjava2:rxjava:2.1.12' implementation 'io.reactivex.rxjava2:rxjava:2.2.21'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2' implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
implementation 'org.greenrobot:eventbus:3.3.1'
//Barcode generator //Barcode generator
// implementation group: 'com.google.zxing', name: 'core', version: '3.5.3'
implementation 'com.journeyapps:zxing-android-embedded:4.3.0' implementation 'com.journeyapps:zxing-android-embedded:4.3.0'
implementation("org.javatuples:javatuples:1.2")
} }
repositories { repositories {
@@ -201,3 +201,49 @@ repositories {
google() google()
maven { url 'https://jitpack.io' } maven { url 'https://jitpack.io' }
} }
tasks.register('addBetaSuffix') {
doLast {
def gradleFile = file("build.gradle")
def content = gradleFile.text
// Modifica appVersionName
content = content.replaceAll(/appVersionName\s*=\s*'(.*?)'/) { fullMatch, version ->
"appVersionName = '${version}-beta'"
}
// Modifica outputFileName
content = content.replaceAll(/output\.outputFileName\s*=\s*"(.*?)"/) { fullMatch, filename ->
"output.outputFileName = \"${filename.replace('.apk', '-beta.apk')}\""
}
// Modifica direttamente la riga che crea 'version.txt' in 'version-beta.txt'
content = content.replace(
"def versionFile = new File(outputDir, \"version.txt\")",
"def versionFile = new File(outputDir, \"version-beta.txt\")"
)
// Sovrascrivi il file
gradleFile.write(content)
}
}
tasks.register('createVersionFile') {
doLast {
def outputDir = file("${projectDir}/build/outputs/apk/release")
def versionFile = new File(outputDir, "version.txt")
// Cancella il file se esiste
if (versionFile.exists()) {
versionFile.delete()
}
// Crea il file con i contenuti desiderati
versionFile.write("${android.defaultConfig.versionCode}\n${android.defaultConfig.versionName}\nforced=true")
}
}
afterEvaluate {
tasks.assembleRelease.finalizedBy createVersionFile
}

View File

@@ -23,3 +23,26 @@
# If you keep the line number information, uncomment this to # If you keep the line number information, uncomment this to
# hide the original source file name. # hide the original source file name.
#-renamesourcefileattribute SourceFile #-renamesourcefileattribute SourceFile
# Prevent proguard from stripping interface information from TypeAdapter, TypeAdapterFactory,
# JsonSerializer, JsonDeserializer instances (so they can be used in @JsonAdapter)
-keep class * extends com.google.gson.TypeAdapter
-keep class * implements com.google.gson.TypeAdapterFactory
-keep class * implements com.google.gson.JsonSerializer
-keep class * implements com.google.gson.JsonDeserializer
# Prevent R8 from leaving Data object members always null
-keepclasseswithmembers class * {
<init>(...);
@com.google.gson.annotations.SerializedName <fields>;
}
# Per JJWT
-keep class io.jsonwebtoken.** { *; }
-keepnames class io.jsonwebtoken.* { *; }
-keepnames interface io.jsonwebtoken.* { *; }
# Retain generic signatures of TypeToken and its subclasses with R8 version 3.0 and higher.
-keep,allowobfuscation,allowshrinking class com.google.gson.reflect.TypeToken
-keep,allowobfuscation,allowshrinking class * extends com.google.gson.reflect.TypeToken
-keep class it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse { *; }
-keep class * extends it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse { *; }

View File

@@ -132,6 +132,8 @@ import it.integry.integrywmsnative.view.dialogs.basket_lu.DialogBasketLUComponen
import it.integry.integrywmsnative.view.dialogs.basket_lu.DialogBasketLUModule; import it.integry.integrywmsnative.view.dialogs.basket_lu.DialogBasketLUModule;
import it.integry.integrywmsnative.view.dialogs.bind_product_barcode_with_package.DialogBindProductBarcodeWithPackageComponent; import it.integry.integrywmsnative.view.dialogs.bind_product_barcode_with_package.DialogBindProductBarcodeWithPackageComponent;
import it.integry.integrywmsnative.view.dialogs.bind_product_barcode_with_package.DialogBindProductBarcodeWithPackageModule; import it.integry.integrywmsnative.view.dialogs.bind_product_barcode_with_package.DialogBindProductBarcodeWithPackageModule;
import it.integry.integrywmsnative.view.dialogs.choose_art_from_lista_arts.DialogChooseArtFromListaArtsComponent;
import it.integry.integrywmsnative.view.dialogs.choose_art_from_lista_arts.DialogChooseArtFromListaArtsModule;
import it.integry.integrywmsnative.view.dialogs.choose_arts_from_lista_arts.DialogChooseArtsFromMtbAartListComponent; import it.integry.integrywmsnative.view.dialogs.choose_arts_from_lista_arts.DialogChooseArtsFromMtbAartListComponent;
import it.integry.integrywmsnative.view.dialogs.choose_arts_from_lista_arts.DialogChooseArtsFromMtbAartListModule; import it.integry.integrywmsnative.view.dialogs.choose_arts_from_lista_arts.DialogChooseArtsFromMtbAartListModule;
import it.integry.integrywmsnative.view.dialogs.choose_arts_from_mtbcolr_list.DialogChooseArtsFromMtbColrListComponent; import it.integry.integrywmsnative.view.dialogs.choose_arts_from_mtbcolr_list.DialogChooseArtsFromMtbColrListComponent;
@@ -140,6 +142,8 @@ import it.integry.integrywmsnative.view.dialogs.choose_batch_lot.DialogChooseBat
import it.integry.integrywmsnative.view.dialogs.choose_batch_lot.DialogChooseBatchLotModule; import it.integry.integrywmsnative.view.dialogs.choose_batch_lot.DialogChooseBatchLotModule;
import it.integry.integrywmsnative.view.dialogs.create_new_art.DialogCreateNewArtComponent; import it.integry.integrywmsnative.view.dialogs.create_new_art.DialogCreateNewArtComponent;
import it.integry.integrywmsnative.view.dialogs.create_new_art.DialogCreateNewArtModule; import it.integry.integrywmsnative.view.dialogs.create_new_art.DialogCreateNewArtModule;
import it.integry.integrywmsnative.view.dialogs.device_end_of_life.DialogDeviceEndOfLifeComponent;
import it.integry.integrywmsnative.view.dialogs.device_end_of_life.DialogDeviceEndOfLifeModule;
import it.integry.integrywmsnative.view.dialogs.extra_info.DialogExtraInfoComponent; import it.integry.integrywmsnative.view.dialogs.extra_info.DialogExtraInfoComponent;
import it.integry.integrywmsnative.view.dialogs.extra_info.DialogExtraInfoModule; import it.integry.integrywmsnative.view.dialogs.extra_info.DialogExtraInfoModule;
import it.integry.integrywmsnative.view.dialogs.info_aggiuntive_lu.DialogInfoAggiuntiveLUComponent; import it.integry.integrywmsnative.view.dialogs.info_aggiuntive_lu.DialogInfoAggiuntiveLUComponent;
@@ -248,7 +252,9 @@ import it.integry.integrywmsnative.view.dialogs.update_available.DialogUpdateAva
DialogAskLivelloPosizioneModule.class, DialogAskLivelloPosizioneModule.class,
VerificaGiacenzeModule.class, VerificaGiacenzeModule.class,
DialogExtraInfoModule.class, DialogExtraInfoModule.class,
DialogAskDepositoModule.class DialogAskDepositoModule.class,
DialogChooseArtFromListaArtsModule.class,
DialogDeviceEndOfLifeModule.class
}) })
public interface MainApplicationComponent { public interface MainApplicationComponent {
@@ -417,6 +423,10 @@ public interface MainApplicationComponent {
DialogAskDepositoComponent.Factory dialogAskDepositoComponent(); DialogAskDepositoComponent.Factory dialogAskDepositoComponent();
DialogChooseArtFromListaArtsComponent.Factory dialogChooseArtFromListaArtsComponent();
DialogDeviceEndOfLifeComponent.Factory dialogDeviceEndOfLifeComponent();
void inject(MainApplication mainApplication); void inject(MainApplication mainApplication);
void inject(AppContext mainApplication); void inject(AppContext mainApplication);

View File

@@ -49,6 +49,7 @@ import it.integry.integrywmsnative.core.rest.consumers.ProductionLinesRESTConsum
import it.integry.integrywmsnative.core.rest.consumers.ProduzioneRESTConsumer; import it.integry.integrywmsnative.core.rest.consumers.ProduzioneRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer; import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.VettoriRESTConsumer; import it.integry.integrywmsnative.core.rest.consumers.VettoriRESTConsumer;
import it.integry.integrywmsnative.core.rest.watcher.ServerStatusChecker;
import it.integry.integrywmsnative.core.services.inventario.InventarioService; import it.integry.integrywmsnative.core.services.inventario.InventarioService;
import it.integry.integrywmsnative.core.settings.SettingsManager; import it.integry.integrywmsnative.core.settings.SettingsManager;
import it.integry.integrywmsnative.core.sound.SoundAlertService; import it.integry.integrywmsnative.core.sound.SoundAlertService;
@@ -100,8 +101,14 @@ public class MainApplicationModule {
@Provides @Provides
@Singleton @Singleton
MainContext providesMainContextNew(MenuService menuService, AppDatabase appDatabase, SystemRESTConsumer systemRESTConsumer, AuthenticationRESTConsumer authenticationRESTConsumer) { ServerStatusChecker providesServerStatusChecker(Handler handler) {
return new MainContext(mApplication.getApplicationContext(), menuService, appDatabase, systemRESTConsumer, authenticationRESTConsumer); return new ServerStatusChecker(handler);
}
@Provides
@Singleton
MainContext providesMainContextNew(MenuService menuService, AppDatabase appDatabase, AuthenticationRESTConsumer authenticationRESTConsumer, ExecutorService executorService, Handler handler, ServerStatusChecker serverStatusChecker) {
return new MainContext(mApplication.getApplicationContext(), menuService, appDatabase, authenticationRESTConsumer, executorService, handler, serverStatusChecker);
} }
@Provides @Provides
@@ -151,8 +158,8 @@ public class MainApplicationModule {
@Provides @Provides
@Singleton @Singleton
OrdiniRESTConsumer provideOrdiniRESTConsumer(RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer, EntityRESTConsumer entityRESTConsumer) { OrdiniRESTConsumer provideOrdiniRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService, SystemRESTConsumer systemRESTConsumer, EntityRESTConsumer entityRESTConsumer) {
return new OrdiniRESTConsumer(restBuilder, systemRESTConsumer, entityRESTConsumer); return new OrdiniRESTConsumer(restBuilder, executorService, systemRESTConsumer, entityRESTConsumer);
} }
@Provides @Provides
@@ -169,14 +176,14 @@ public class MainApplicationModule {
@Provides @Provides
@Singleton @Singleton
CommessaRESTConsumer provideCommessaRESTConsumer(SystemRESTConsumer systemRESTConsumer) { CommessaRESTConsumer provideCommessaRESTConsumer(ExecutorService executorService, SystemRESTConsumer systemRESTConsumer) {
return new CommessaRESTConsumer(systemRESTConsumer); return new CommessaRESTConsumer(executorService, systemRESTConsumer);
} }
@Provides @Provides
@Singleton @Singleton
DepositoRESTConsumer provideDepositoRESTConsumer(EntityRESTConsumer entityRESTConsumer, SystemRESTConsumer systemRESTConsumer) { DepositoRESTConsumer provideDepositoRESTConsumer(ExecutorService executorService, SystemRESTConsumer systemRESTConsumer) {
return new DepositoRESTConsumer(entityRESTConsumer, systemRESTConsumer); return new DepositoRESTConsumer(executorService, systemRESTConsumer);
} }
@Provides @Provides
@@ -199,18 +206,19 @@ public class MainApplicationModule {
@Provides @Provides
@Singleton @Singleton
EntityRESTConsumer provideEntityRESTConsumer(RESTBuilder restBuilder) { EntityRESTConsumer provideEntityRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService) {
return new EntityRESTConsumer(restBuilder); return new EntityRESTConsumer(restBuilder, executorService);
} }
@Provides @Provides
@Singleton @Singleton
ColliMagazzinoRESTConsumer provideColliMagazzinoRESTConsumer(RESTBuilder restBuilder, ColliMagazzinoRESTConsumer provideColliMagazzinoRESTConsumer(ExecutorService executorService,
RESTBuilder restBuilder,
SystemRESTConsumer systemRESTConsumer, SystemRESTConsumer systemRESTConsumer,
ArticoloRESTConsumer articoloRESTConsumer, ArticoloRESTConsumer articoloRESTConsumer,
EntityRESTConsumer entityRESTConsumer, EntityRESTConsumer entityRESTConsumer,
SettingsManager settingsManager) { SettingsManager settingsManager) {
return new ColliMagazzinoRESTConsumer(restBuilder, systemRESTConsumer, articoloRESTConsumer, entityRESTConsumer, settingsManager); return new ColliMagazzinoRESTConsumer(executorService, restBuilder, systemRESTConsumer, articoloRESTConsumer, entityRESTConsumer, settingsManager);
} }
@Provides @Provides
@@ -251,8 +259,8 @@ public class MainApplicationModule {
@Provides @Provides
@Singleton @Singleton
PosizioniRESTConsumer providesPosizioniRESTConsumer(RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer) { PosizioniRESTConsumer providesPosizioniRESTConsumer(RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer, ExecutorService executorService) {
return new PosizioniRESTConsumer(restBuilder, systemRESTConsumer); return new PosizioniRESTConsumer(restBuilder, systemRESTConsumer, executorService);
} }
@Provides @Provides
@@ -305,8 +313,8 @@ public class MainApplicationModule {
@Provides @Provides
@Singleton @Singleton
DocumentRESTConsumer provideDocumentiRESTConsumer(RESTBuilder restBuilder) { DocumentRESTConsumer provideDocumentiRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService) {
return new DocumentRESTConsumer(restBuilder); return new DocumentRESTConsumer(restBuilder, executorService);
} }
@Provides @Provides
@@ -317,20 +325,20 @@ public class MainApplicationModule {
@Provides @Provides
@Singleton @Singleton
ColliSpedizioneRESTConsumer provideColliSpedizioneRESTConsumer(RESTBuilder restBuilder) { ColliSpedizioneRESTConsumer provideColliSpedizioneRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService) {
return new ColliSpedizioneRESTConsumer(restBuilder); return new ColliSpedizioneRESTConsumer(restBuilder, executorService);
} }
@Provides @Provides
@Singleton @Singleton
ColliLavorazioneRESTConsumer provideColliLavorazioneRESTConsumer(RESTBuilder restBuilder, SettingsManager settingsManager) { ColliLavorazioneRESTConsumer provideColliLavorazioneRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService, SettingsManager settingsManager) {
return new ColliLavorazioneRESTConsumer(restBuilder, settingsManager); return new ColliLavorazioneRESTConsumer(restBuilder, executorService, settingsManager);
} }
@Provides @Provides
@Singleton @Singleton
MagazzinoAutomaticoRESTConsumer provideMagazzinoAutomaticoRESTConsumer(RESTBuilder restBuilder) { MagazzinoAutomaticoRESTConsumer provideMagazzinoAutomaticoRESTConsumer(ExecutorService executorService, RESTBuilder restBuilder) {
return new MagazzinoAutomaticoRESTConsumer(restBuilder); return new MagazzinoAutomaticoRESTConsumer(executorService, restBuilder);
} }
@Provides @Provides

View File

@@ -4,15 +4,19 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.pm.PackageInfo; import android.content.pm.PackageInfo;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler;
import android.text.SpannableString; import android.text.SpannableString;
import android.text.Spanned; import android.text.Spanned;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import androidx.databinding.DataBindingUtil; import androidx.databinding.DataBindingUtil;
import java.time.LocalDate;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.concurrent.CountDownLatch;
import javax.inject.Inject; import javax.inject.Inject;
@@ -26,6 +30,7 @@ import it.integry.integrywmsnative.databinding.ActivitySplashBinding;
import it.integry.integrywmsnative.gest.login.LoginActivity; import it.integry.integrywmsnative.gest.login.LoginActivity;
import it.integry.integrywmsnative.gest.main.MainActivity; import it.integry.integrywmsnative.gest.main.MainActivity;
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView; import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
import it.integry.integrywmsnative.view.dialogs.device_end_of_life.DialogDeviceEndOfLifeView;
public class SplashActivity extends BaseActivity implements MainContext.Listener { public class SplashActivity extends BaseActivity implements MainContext.Listener {
@@ -37,6 +42,9 @@ public class SplashActivity extends BaseActivity implements MainContext.Listener
@Inject @Inject
MainContext mainContext; MainContext mainContext;
@Inject
Handler handler;
private RunnableArgsss<Integer, String[], List<Integer>> onRequestPermissionResult; private RunnableArgsss<Integer, String[], List<Integer>> onRequestPermissionResult;
public static void startActivity(Context context) { public static void startActivity(Context context) {
@@ -61,9 +69,24 @@ public class SplashActivity extends BaseActivity implements MainContext.Listener
UtilityContext.initMainActivity(this); UtilityContext.initMainActivity(this);
LocalDate endSupportDate = LocalDate.of(2026, 1, 31);
initAppVersion(); boolean isOldAndroid = Build.VERSION.SDK_INT < Build.VERSION_CODES.O;
initPermissions(this::init);
executorService.execute(() -> {
if (isOldAndroid)
showDeviceEndOfLifeMessage();
handler.post(() -> {
if (LocalDate.now().isBefore(endSupportDate) || !isOldAndroid) {
initAppVersion();
initPermissions(this::init);
} else {
this.finish();
}
});
});
} }
private void initAppVersion() { private void initAppVersion() {
@@ -101,14 +124,29 @@ public class SplashActivity extends BaseActivity implements MainContext.Listener
} }
} }
private void showDeviceEndOfLifeMessage() {
CountDownLatch latch = new CountDownLatch(1);
DialogDeviceEndOfLifeView.newInstance(latch::countDown)
.show(this.getSupportFragmentManager(), "dialog_device_end_of_life");
try {
latch.await();
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
@Override @Override
public void onDBDataLoading(String item) { public void onDBDataLoading(String item) {
runOnUiThread(() -> mBinding.loadingInfoTextview.setText("Caricamento " + item)); handler.post(() -> mBinding.loadingInfoTextview.setText("Caricamento " + item));
} }
@Override @Override
public void onMenuLoading() { public void onMenuLoading() {
runOnUiThread(() -> mBinding.loadingInfoTextview.setText("Caricamento menù")); handler.post(() -> mBinding.loadingInfoTextview.setText("Caricamento menù"));
} }
@Override @Override
@@ -151,11 +189,13 @@ public class SplashActivity extends BaseActivity implements MainContext.Listener
@Override @Override
public void onError(Spanned message) { public void onError(Spanned message) {
handler.post(() -> {
DialogSimpleMessageView.makeErrorDialog(
message, null, this::finish, R.string.logout, () -> {
this.mainContext.logout(MainApplication::exit);
})
.show(this.getSupportFragmentManager(), "tag");
DialogSimpleMessageView.makeErrorDialog( });
message, null, this::finish, R.string.logout, () -> {
this.mainContext.logout(MainApplication::exit);
})
.show(this.getSupportFragmentManager(), "tag");
} }
} }

View File

@@ -24,19 +24,4 @@ public class CommonConst {
public static String RECOVER_COLLO_FILE = "recover_ul.json"; public static String RECOVER_COLLO_FILE = "recover_ul.json";
} }
public static class Mail {
public static String[] forErrorsDebug = {
"g.scorrano@integry.it",
"v.castellana@integry.it"
};
public static String[] forErrors = {
// "syslogs@integry.it",
"g.scorrano@integry.it",
"v.castellana@integry.it"
};
}
} }

View File

@@ -11,11 +11,11 @@ public class JwtUtils {
private final static String SIGNING_KEY = "gICy3bjD56i/YFnBZZKe5ibiz3Snsp08nybGGziCV4ZcvyXBbyqWUnJ2wTrRXhOuf/xdljPXX0yBaqdAgvKthQ=="; private final static String SIGNING_KEY = "gICy3bjD56i/YFnBZZKe5ibiz3Snsp08nybGGziCV4ZcvyXBbyqWUnJ2wTrRXhOuf/xdljPXX0yBaqdAgvKthQ==";
public static Claims parseJwt(String token) { public static Claims parseJwt(String token) {
Jws<Claims> jws = Jwts.parserBuilder() Jws<Claims> jws = Jwts.parser()
.setSigningKey(Keys.hmacShaKeyFor(Decoders.BASE64.decode(SIGNING_KEY))) .verifyWith(Keys.hmacShaKeyFor(Decoders.BASE64.decode(SIGNING_KEY)))
.build() .build()
.parseClaimsJws(token); .parseSignedClaims(token);
return jws.getBody(); return jws.getPayload();
} }
} }

View File

@@ -7,6 +7,7 @@ public class BarcodeCallbackDTO {
private int ID = -1; private int ID = -1;
private boolean enabled = true;
private RunnableArgs<BarcodeScanDTO> onScanSuccessfull; private RunnableArgs<BarcodeScanDTO> onScanSuccessfull;
private RunnableArgs<Exception> onScanFailed; private RunnableArgs<Exception> onScanFailed;
@@ -19,6 +20,15 @@ public class BarcodeCallbackDTO {
return this; return this;
} }
public boolean isEnabled() {
return enabled;
}
public BarcodeCallbackDTO setEnabled(boolean enabled) {
this.enabled = enabled;
return this;
}
public RunnableArgs<BarcodeScanDTO> getOnScanSuccessfull() { public RunnableArgs<BarcodeScanDTO> getOnScanSuccessfull() {
return onScanSuccessfull; return onScanSuccessfull;
} }

View File

@@ -24,10 +24,15 @@ public class BarcodeManager {
private static BarcodeReaderInterface mCurrentBarcodeInterface; private static BarcodeReaderInterface mCurrentBarcodeInterface;
private static final List<BarcodeCallbackDTO> mBarcodeCallbacksStacktrace = new ArrayList<>(); private static final List<BarcodeCallbackDTO> mBarcodeCallbacksStacktrace = new ArrayList<>();
private static boolean mEnabled = true; // private static boolean mEnabled = true;
private static final Class<? extends BarcodeReaderInterface>[] registeredBarcodeReaderInterfaces = new Class[]{PointMobileBarcodeReader.class, ZebraBarcodeReader.class, HoneyWellBarcodeReader.class, KeyboardEmulatorBarcodeReader.class}; private static final Class<? extends BarcodeReaderInterface>[] registeredBarcodeReaderInterfaces = new Class[]{
PointMobileBarcodeReader.class,
ZebraBarcodeReader.class,
HoneyWellBarcodeReader.class,
KeyboardEmulatorBarcodeReader.class
};
public static void init(Context applicationContext) throws Exception { public static void init(Context applicationContext) throws Exception {
@@ -56,12 +61,12 @@ public class BarcodeManager {
mCurrentBarcodeInterface.register(data -> { mCurrentBarcodeInterface.register(data -> {
BarcodeCallbackDTO callback = getValidCallback(); BarcodeCallbackDTO callback = getValidCallback();
if (callback != null && mEnabled) { if (callback != null && callback.isEnabled()) {
callback.getOnScanSuccessfull().run(data); callback.getOnScanSuccessfull().run(data);
} }
}, ex -> { }, ex -> {
BarcodeCallbackDTO callback = getValidCallback(); BarcodeCallbackDTO callback = getValidCallback();
if (callback != null && mEnabled) { if (callback != null && callback.isEnabled()) {
callback.getOnScanFailed().run(ex); callback.getOnScanFailed().run(ex);
} }
}); });
@@ -103,7 +108,6 @@ public class BarcodeManager {
} }
public static int addCallback(BarcodeCallbackDTO barcodeCallbackDTO) { public static int addCallback(BarcodeCallbackDTO barcodeCallbackDTO) {
int newID = -1; int newID = -1;
if (!mBarcodeCallbacksStacktrace.isEmpty()) { if (!mBarcodeCallbacksStacktrace.isEmpty()) {
@@ -133,18 +137,39 @@ public class BarcodeManager {
} }
public static void disable() { public static void disable(int instanceId) {
mEnabled = false; mBarcodeCallbacksStacktrace.stream().filter(x -> x.getID() == instanceId)
// UtilityLogger.info("Barcode reader disabled"); .findFirst().ifPresent(x -> x.setEnabled(false));
} }
public static void enable() { public static void disableLastCallback() {
mEnabled = true; BarcodeCallbackDTO validCallback = getValidCallback();
// UtilityLogger.info("Barcode reader enabled"); if (validCallback != null) {
validCallback.setEnabled(false);
}
} }
public static boolean isEnabled() { public static void enable(int instanceId) {
return mEnabled; mBarcodeCallbacksStacktrace.stream().filter(x -> x.getID() == instanceId)
.findFirst().ifPresent(x -> x.setEnabled(true));
}
public static void enableLastCallback() {
BarcodeCallbackDTO validCallback = getValidCallback();
if (validCallback != null) {
validCallback.setEnabled(true);
}
}
public static boolean isEnabled(int instanceId) {
return mBarcodeCallbacksStacktrace.stream().filter(x -> x.getID() == instanceId)
.findFirst()
.map(BarcodeCallbackDTO::isEnabled)
.orElse(false);
}
public static boolean isLastCallbackEnabled() {
return getValidCallback() != null && getValidCallback().isEnabled();
} }
public static void changeSettings(List<Pair<String, Object>> settings) { public static void changeSettings(List<Pair<String, Object>> settings) {

View File

@@ -89,11 +89,25 @@ public class AppContext {
private void initLogger() { private void initLogger() {
Logger.addLogAdapter(new AndroidLogAdapter()); Logger.addLogAdapter(new AndroidLogAdapter());
logsFolder = new File(mApplicationContext.getExternalFilesDir(null).getAbsolutePath()); File dataDir = mApplicationContext.getExternalFilesDir(null);
int maxBytesSize = 5 * 1024 * 1024;
Logger.addLogAdapter(new DiskLogAdapter(logsFolder, maxBytesSize)); logsFolder = new File(dataDir, "logs");
if (!logsFolder.exists())
logsFolder.mkdirs();
//Temporary clean
File[] wrongFilesToBeDeleted = dataDir.listFiles((file, s) -> s.startsWith("logs_"));
if (wrongFilesToBeDeleted != null)
for (File fileToDelete : wrongFilesToBeDeleted) {
fileToDelete.delete();
}
removeOldLogs(logsFolder); removeOldLogs(logsFolder);
int maxBytesSize = 5 * 1024 * 1024;
Logger.addLogAdapter(new DiskLogAdapter(logsFolder, maxBytesSize));
} }
private void removeOldLogs(File logsFolder) { private void removeOldLogs(File logsFolder) {

View File

@@ -1,6 +1,7 @@
package it.integry.integrywmsnative.core.context; package it.integry.integrywmsnative.core.context;
import android.content.Context; import android.content.Context;
import android.os.Handler;
import android.text.Html; import android.text.Html;
import android.text.SpannableString; import android.text.SpannableString;
import android.text.Spanned; import android.text.Spanned;
@@ -9,16 +10,15 @@ import android.text.SpannedString;
import com.google.firebase.installations.FirebaseInstallations; import com.google.firebase.installations.FirebaseInstallations;
import java.net.ConnectException; import java.net.ConnectException;
import java.util.concurrent.ExecutorService;
import javax.inject.Singleton; import javax.inject.Singleton;
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager; import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
import it.integry.integrywmsnative.core.data_store.db.AppDatabase; import it.integry.integrywmsnative.core.data_store.db.AppDatabase;
import it.integry.integrywmsnative.core.menu.MenuService; import it.integry.integrywmsnative.core.menu.MenuService;
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
import it.integry.integrywmsnative.core.rest.watcher.ServerStatusChecker; import it.integry.integrywmsnative.core.rest.watcher.ServerStatusChecker;
import it.integry.integrywmsnative.core.settings.SettingsManager; import it.integry.integrywmsnative.core.settings.SettingsManager;
import it.integry.integrywmsnative.core.utility.UtilityThread;
import it.integry.integrywmsnative.gest.login.rest.AuthenticationRESTConsumer; import it.integry.integrywmsnative.gest.login.rest.AuthenticationRESTConsumer;
@Singleton @Singleton
@@ -27,17 +27,21 @@ public class MainContext {
private final Context applicationContext; private final Context applicationContext;
private final MenuService menuService; private final MenuService menuService;
private final AppDatabase appDatabase; private final AppDatabase appDatabase;
private final SystemRESTConsumer systemRESTConsumer;
private final AuthenticationRESTConsumer authenticationRESTConsumer; private final AuthenticationRESTConsumer authenticationRESTConsumer;
private final ExecutorService executorService;
private final Handler handler;
private final ServerStatusChecker serverStatusChecker;
private Listener mListener; private Listener mListener;
public MainContext(Context applicationContext, MenuService menuService, AppDatabase appDatabase, SystemRESTConsumer systemRESTConsumer, AuthenticationRESTConsumer authenticationRESTConsumer) { public MainContext(Context applicationContext, MenuService menuService, AppDatabase appDatabase, AuthenticationRESTConsumer authenticationRESTConsumer, ExecutorService executorService, Handler handler, ServerStatusChecker serverStatusChecker) {
this.applicationContext = applicationContext; this.applicationContext = applicationContext;
this.menuService = menuService; this.menuService = menuService;
this.appDatabase = appDatabase; this.appDatabase = appDatabase;
this.systemRESTConsumer = systemRESTConsumer;
this.authenticationRESTConsumer = authenticationRESTConsumer; this.authenticationRESTConsumer = authenticationRESTConsumer;
this.executorService = executorService;
this.handler = handler;
this.serverStatusChecker = serverStatusChecker;
} }
public void init() { public void init() {
@@ -48,34 +52,31 @@ public class MainContext {
} }
//this.initAuthSession(() -> { executorService.execute(() -> {
// this.initDeviceId(() -> {
this.initDBData(() -> {
this.initMenu(() -> {
if (mListener != null) mListener.onContextInitialized(); try {
}); this.initDBData();
}); this.initMenu();
// }); serverStatusChecker.init();
//});
if (mListener != null) mListener.onContextInitialized();
this.initServerStatusChecker(); } catch (Exception ex) {
Spanned message = null;
// EventBus.getDefault().register(this); if (ex.getCause() != null && ex.getCause() instanceof ConnectException) {
message = Html.fromHtml("Impossibile collegarsi all'host <b>" + SettingsManager.i().getServer().getHost() + ":" + SettingsManager.i().getServer().getPort() + "</b>. Riprovare più tardi.");
} else if (ex.getMessage().startsWith("Status 404:")) {
message = Html.fromHtml("Errore 404. Non è stato possibile soddisfare la richiesta sull'host <b>" + SettingsManager.i().getServer().getHost() + ":" + SettingsManager.i().getServer().getPort() + "</b>. Riprovare più tardi.");
} else {
message = new SpannableString(ex.getMessage());
}
if (mListener != null) mListener.onError(message);
}
});
} }
// @Subscribe(threadMode = ThreadMode.MAIN)
// public void onSessionExpired(SessionExpiredEvent event) {
// DialogSimpleMessageView.makeErrorDialog(
// new SpannedString("La sessione è scaduta. Effettua nuovamente la login"),
// null,
// () -> {
// logout(MainApplication::exit);
// })
// .show(activity.getSupportFragmentManager(), "expired-session-error");
// }
private void initAuthSession(Runnable onComplete) { private void initAuthSession(Runnable onComplete) {
this.authenticationRESTConsumer.me(obj -> { this.authenticationRESTConsumer.me(obj -> {
@@ -105,50 +106,28 @@ public class MainContext {
public void logout(Runnable onLoggedOut) { public void logout(Runnable onLoggedOut) {
menuService.invalidateCache(); menuService.invalidateCache();
UtilityThread.executeParallel(() -> { executorService.execute(() -> {
SettingsManager.i().setUser(null); SettingsManager.i().setUser(null);
SettingsManager.i().setUserSession(null); SettingsManager.i().setUserSession(null);
SettingsManager.update(); SettingsManager.update();
appDatabase.clearAllTables(); appDatabase.clearAllTables();
onLoggedOut.run(); handler.post(() -> {
}, true); onLoggedOut.run();
});
});
} }
private void initServerStatusChecker() { private void initDBData() throws Exception {
ServerStatusChecker.init();
}
private void initDBData(Runnable onComplete) {
SettingsManager.loadDBVariables(item -> { SettingsManager.loadDBVariables(item -> {
if (mListener != null) mListener.onDBDataLoading(item); if (mListener != null) mListener.onDBDataLoading(item);
}, });
onComplete,
ex -> {
Spanned message = null;
if (ex.getCause() != null && ex.getCause() instanceof ConnectException) {
message = Html.fromHtml("Impossibile collegarsi all'host <b>" + SettingsManager.i().getServer().getHost() + ":" + SettingsManager.i().getServer().getPort() + "</b>. Riprovare più tardi.");
} else if (ex.getMessage().startsWith("Status 404:")) {
message = Html.fromHtml("Errore 404. Non è stato possibile soddisfare la richiesta sull'host <b>" + SettingsManager.i().getServer().getHost() + ":" + SettingsManager.i().getServer().getPort() + "</b>. Riprovare più tardi.");
} else {
message = new SpannableString(ex.getMessage());
}
if (mListener != null) mListener.onError(message);
}
);
} }
private void initMenu(Runnable onComplete) { private void initMenu() throws Exception {
if (mListener != null) mListener.onMenuLoading(); if (mListener != null) mListener.onMenuLoading();
this.menuService.init(onComplete, ex -> { this.menuService.init();
if (mListener != null) mListener.onError(new SpannedString(ex.getMessage()));
});
} }

View File

@@ -1,5 +1,6 @@
package it.integry.integrywmsnative.core.data_recover; package it.integry.integrywmsnative.core.data_recover;
import java.time.LocalDate;
import java.util.List; import java.util.List;
import it.integry.integrywmsnative.core.model.MtbColt; import it.integry.integrywmsnative.core.model.MtbColt;
@@ -10,7 +11,7 @@ public class ColliDataRecoverDTO {
private int id; private int id;
private int numCollo; private int numCollo;
private String serCollo; private String serCollo;
private String dataCollo; private LocalDate dataCollo;
private String gestioneCollo; private String gestioneCollo;
private String filtro; private String filtro;
@@ -43,11 +44,11 @@ public class ColliDataRecoverDTO {
return this; return this;
} }
public String getDataCollo() { public LocalDate getDataCollo() {
return dataCollo; return dataCollo;
} }
public ColliDataRecoverDTO setDataCollo(String dataCollo) { public ColliDataRecoverDTO setDataCollo(LocalDate dataCollo) {
this.dataCollo = dataCollo; this.dataCollo = dataCollo;
return this; return this;
} }

View File

@@ -2,7 +2,6 @@ package it.integry.integrywmsnative.core.data_recover;
import android.content.Context; import android.content.Context;
import com.annimon.stream.Optional;
import com.annimon.stream.Stream; import com.annimon.stream.Stream;
import com.google.android.gms.common.util.IOUtils; import com.google.android.gms.common.util.IOUtils;
import com.google.gson.Gson; import com.google.gson.Gson;
@@ -14,6 +13,7 @@ import java.io.InputStream;
import java.lang.reflect.Type; import java.lang.reflect.Type;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Optional;
import java.util.Random; import java.util.Random;
import javax.inject.Inject; import javax.inject.Inject;
@@ -65,9 +65,9 @@ public class ColliDataRecoverService {
} }
private ColliDataRecoverDTO getIfExists(int id) { private ColliDataRecoverDTO getIfExists(int id) {
Optional<ColliDataRecoverDTO> recoverDTOOptional = Stream.of(mtbColtsSessions) Optional<ColliDataRecoverDTO> recoverDTOOptional = mtbColtsSessions.stream()
.filter(x -> x.getId() == id) .filter(x -> x.getId() == id)
.findSingle(); .findFirst();
return recoverDTOOptional.isPresent() ? recoverDTOOptional.get() : null; return recoverDTOOptional.isPresent() ? recoverDTOOptional.get() : null;
@@ -85,7 +85,7 @@ public class ColliDataRecoverService {
ColliDataRecoverDTO recoverDTO = new ColliDataRecoverDTO() ColliDataRecoverDTO recoverDTO = new ColliDataRecoverDTO()
.setId(newId) .setId(newId)
.setDataCollo(mtbColtSession.getDataColloS()) .setDataCollo(mtbColtSession.getDataColloLD())
.setNumCollo(mtbColtSession.getNumCollo()) .setNumCollo(mtbColtSession.getNumCollo())
.setSerCollo(mtbColtSession.getSerCollo()) .setSerCollo(mtbColtSession.getSerCollo())
.setGestioneCollo(mtbColtSession.getGestione()) .setGestioneCollo(mtbColtSession.getGestione())

View File

@@ -4,9 +4,6 @@ import androidx.databinding.BaseObservable;
import java.math.BigDecimal; import java.math.BigDecimal;
import it.integry.integrywmsnative.core.CommonConst;
import it.integry.integrywmsnative.core.utility.UtilityNumber;
public class BindableFloat extends BaseObservable { public class BindableFloat extends BaseObservable {
private Float value; private Float value;
@@ -15,10 +12,6 @@ public class BindableFloat extends BaseObservable {
} }
public BigDecimal getBigDecimal() { public BigDecimal getBigDecimal() {
int numberOfDigits = UtilityNumber.countNumberOfDecimalDigits(get());
if(numberOfDigits > CommonConst.Config.NUMBER_OF_DECIMAL_DIGITS) numberOfDigits = CommonConst.Config.NUMBER_OF_DECIMAL_DIGITS;
return BigDecimal.valueOf(get()); return BigDecimal.valueOf(get());
} }

View File

@@ -11,6 +11,7 @@ import android.widget.EditText;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.RadioButton; import android.widget.RadioButton;
import android.widget.RadioGroup; import android.widget.RadioGroup;
import android.widget.TextView;
import androidx.annotation.ColorRes; import androidx.annotation.ColorRes;
import androidx.appcompat.widget.AppCompatCheckBox; import androidx.appcompat.widget.AppCompatCheckBox;
@@ -24,6 +25,10 @@ import androidx.databinding.BindingAdapter;
import androidx.databinding.BindingConversion; import androidx.databinding.BindingConversion;
import androidx.databinding.Observable; import androidx.databinding.Observable;
import androidx.databinding.ObservableField; import androidx.databinding.ObservableField;
import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewTreeLifecycleOwner;
import com.google.android.material.datepicker.MaterialDatePicker; import com.google.android.material.datepicker.MaterialDatePicker;
import com.google.android.material.textfield.TextInputEditText; import com.google.android.material.textfield.TextInputEditText;
@@ -33,6 +38,8 @@ import java.math.BigDecimal;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols; import java.text.DecimalFormatSymbols;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.Locale; import java.util.Locale;
@@ -41,6 +48,7 @@ import it.integry.integrywmsnative.MainApplication;
import it.integry.integrywmsnative.R; import it.integry.integrywmsnative.R;
import it.integry.integrywmsnative.core.expansion.BaseDialogFragment; import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
import it.integry.integrywmsnative.core.expansion.RunnableArgs; import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.utility.LocaleDecimalKeyListener;
import it.integry.integrywmsnative.core.utility.UtilityBigDecimal; import it.integry.integrywmsnative.core.utility.UtilityBigDecimal;
import it.integry.integrywmsnative.core.utility.UtilityDate; import it.integry.integrywmsnative.core.utility.UtilityDate;
import it.integry.integrywmsnative.core.utility.UtilityNumber; import it.integry.integrywmsnative.core.utility.UtilityNumber;
@@ -257,7 +265,7 @@ public class Converters {
BigDecimal value = null; BigDecimal value = null;
if (!UtilityString.isNullOrEmpty(s.toString())) if (!UtilityString.isNullOrEmpty(s.toString()))
value = new BigDecimal(s.toString()); value = UtilityNumber.parseBigDecimal(s.toString(), Locale.getDefault());
observableBigDecimal.set(value); observableBigDecimal.set(value);
} }
@@ -267,7 +275,7 @@ public class Converters {
} }
BigDecimal newValue = observableBigDecimal.get(); BigDecimal newValue = observableBigDecimal.get();
BigDecimal viewValue = !view.getText().toString().trim().isEmpty() ? new BigDecimal(view.getText().toString()) : null; BigDecimal viewValue = !view.getText().toString().trim().isEmpty() ? UtilityNumber.parseBigDecimal(view.getText().toString(), Locale.getDefault()) : null;
if (!UtilityBigDecimal.equalsTo(viewValue, newValue)) { if (!UtilityBigDecimal.equalsTo(viewValue, newValue)) {
view.setText(UtilityNumber.decimalToString(newValue)); view.setText(UtilityNumber.decimalToString(newValue));
@@ -288,7 +296,7 @@ public class Converters {
String newValueString = s.toString().trim(); String newValueString = s.toString().trim();
if (!UtilityString.isNullOrEmpty(newValueString)) if (!UtilityString.isNullOrEmpty(newValueString))
value = new BigDecimal(newValueString); value = UtilityNumber.parseBigDecimal(newValueString, Locale.getDefault());
observableBigDecimal.set(value); observableBigDecimal.set(value);
} }
@@ -297,7 +305,7 @@ public class Converters {
view.addTextChangedListener(watcher); view.addTextChangedListener(watcher);
} }
BigDecimal newValue = observableBigDecimal.get(); BigDecimal newValue = observableBigDecimal.get();
BigDecimal viewValue = !view.getText().toString().trim().isEmpty() ? new BigDecimal(view.getText().toString()) : null; BigDecimal viewValue = !view.getText().toString().trim().isEmpty() ? UtilityNumber.parseBigDecimal(view.getText().toString(), Locale.getDefault()) : null;
if (!UtilityBigDecimal.equalsTo(viewValue, newValue)) { if (!UtilityBigDecimal.equalsTo(viewValue, newValue)) {
view.setText(UtilityNumber.decimalToString(newValue)); view.setText(UtilityNumber.decimalToString(newValue));
@@ -318,7 +326,7 @@ public class Converters {
String newValueString = s.toString().trim(); String newValueString = s.toString().trim();
if (!UtilityString.isNullOrEmpty(newValueString)) if (!UtilityString.isNullOrEmpty(newValueString))
value = new BigDecimal(newValueString); value = UtilityNumber.parseBigDecimal(newValueString, Locale.getDefault());
observableBigDecimal.set(value); observableBigDecimal.set(value);
} }
@@ -327,7 +335,7 @@ public class Converters {
view.addTextChangedListener(watcher); view.addTextChangedListener(watcher);
} }
BigDecimal newValue = observableBigDecimal.get(); BigDecimal newValue = observableBigDecimal.get();
BigDecimal viewValue = !view.getText().toString().trim().isEmpty() ? new BigDecimal(view.getText().toString()) : null; BigDecimal viewValue = !view.getText().toString().trim().isEmpty() ? UtilityNumber.parseBigDecimal(view.getText().toString(), Locale.getDefault()) : null;
if (!UtilityBigDecimal.equalsTo(viewValue, newValue)) { if (!UtilityBigDecimal.equalsTo(viewValue, newValue)) {
view.setText(UtilityNumber.decimalToString(newValue)); view.setText(UtilityNumber.decimalToString(newValue));
@@ -346,7 +354,8 @@ public class Converters {
public void onTextChanged(CharSequence s, int start, int before, int count) { public void onTextChanged(CharSequence s, int start, int before, int count) {
BigDecimal value = null; BigDecimal value = null;
if (!UtilityString.isNullOrEmpty(s.toString())) if (!UtilityString.isNullOrEmpty(s.toString()))
value = new BigDecimal(s.toString()); value = UtilityNumber.parseBigDecimal(s.toString(), Locale.getDefault());
bindableBigDecimal.set(value); bindableBigDecimal.set(value);
} }
}; };
@@ -354,7 +363,7 @@ public class Converters {
view.addTextChangedListener(watcher); view.addTextChangedListener(watcher);
} }
BigDecimal newValue = bindableBigDecimal.get(); BigDecimal newValue = bindableBigDecimal.get();
BigDecimal viewValue = !view.getText().toString().trim().isEmpty() ? new BigDecimal(view.getText().toString()) : null; BigDecimal viewValue = !view.getText().toString().trim().isEmpty() ? UtilityNumber.parseBigDecimal(view.getText().toString(), Locale.getDefault()) : null;
if (!UtilityBigDecimal.equalsTo(viewValue, newValue)) { if (!UtilityBigDecimal.equalsTo(viewValue, newValue)) {
view.setText(UtilityNumber.decimalToString(newValue)); view.setText(UtilityNumber.decimalToString(newValue));
@@ -820,11 +829,11 @@ public class Converters {
@BindingAdapter("visibilityWhenNotNull") @BindingAdapter("visibilityWhenNotNull")
public static void bindViewVisibilityWhenNotNull(View view, ObservableField<?> bindableObject) { public static void bindViewVisibilityObservableFieldWhenNotNull(View view, ObservableField<?> bindableObject) {
if(bindableObject == null) return; if(bindableObject == null) return;
if (view.getTag(R.id.bound_observable) != bindableObject) { if (view.getTag(R.id.bound_observable_visibility) != bindableObject) {
view.setTag(R.id.bound_observable, bindableObject); view.setTag(R.id.bound_observable_visibility, bindableObject);
} }
bindableObject.addOnPropertyChangedCallback(new Observable.OnPropertyChangedCallback() { bindableObject.addOnPropertyChangedCallback(new Observable.OnPropertyChangedCallback() {
@@ -838,6 +847,36 @@ public class Converters {
} }
@BindingAdapter("visibilityWhenNotNull")
public static void bindViewVisibilityLiveDataWhenNotNull(View view, LiveData<?> liveData) {
// Se il LiveData è null, nascondi la view e esci
if (liveData == null) {
view.setVisibility(View.GONE);
return;
}
// Ottieni il LifecycleOwner dalla view
LifecycleOwner lifecycleOwner = ViewTreeLifecycleOwner.get(view);
if (lifecycleOwner == null) return;
// Rimuovi eventuali observer precedenti
Observer<Object> oldObserver = (Observer<Object>) view.getTag(R.id.bound_observable_visibility);
if (oldObserver != null) {
liveData.removeObserver(oldObserver);
}
// Crea e registra il nuovo observer
Observer<Object> newObserver = value ->
view.setVisibility(value == null ? View.GONE : View.VISIBLE);
liveData.observe(lifecycleOwner, newObserver);
view.setTag(R.id.bound_observable_visibility, newObserver);
// Imposta lo stato iniziale
view.setVisibility(liveData.getValue() == null ? View.GONE : View.VISIBLE);
}
@BindingAdapter("visibilityWhenNotNull") @BindingAdapter("visibilityWhenNotNull")
public static void bindViewVisibilityWhenNotNull(View view, Object genericObject) { public static void bindViewVisibilityWhenNotNull(View view, Object genericObject) {
view.setVisibility(genericObject == null ? View.GONE : View.VISIBLE); view.setVisibility(genericObject == null ? View.GONE : View.VISIBLE);
@@ -845,7 +884,7 @@ public class Converters {
@BindingAdapter("visibilityWhenNull") @BindingAdapter("visibilityWhenNull")
public static void bindViewVisibilityWhenNull(View view, ObservableField<?> bindableObject) { public static void bindViewVisibilityObservableFieldWhenNull(View view, ObservableField<?> bindableObject) {
if (view.getTag(R.id.bound_observable_visibility) != bindableObject) { if (view.getTag(R.id.bound_observable_visibility) != bindableObject) {
view.setTag(R.id.bound_observable_visibility, bindableObject); view.setTag(R.id.bound_observable_visibility, bindableObject);
@@ -864,6 +903,36 @@ public class Converters {
} }
@BindingAdapter("visibilityWhenNull")
public static void bindViewVisibilityLiveDataWhenNull(View view, LiveData<?> liveData) {
// Se il LiveData è null, nascondi la view e esci
if (liveData == null) {
view.setVisibility(View.VISIBLE);
return;
}
// Ottieni il LifecycleOwner dalla view
LifecycleOwner lifecycleOwner = ViewTreeLifecycleOwner.get(view);
if (lifecycleOwner == null) return;
// Rimuovi eventuali observer precedenti
Observer<Object> oldObserver = (Observer<Object>) view.getTag(R.id.bound_observable_visibility);
if (oldObserver != null) {
liveData.removeObserver(oldObserver);
}
// Crea e registra il nuovo observer
Observer<Object> newObserver = value ->
view.setVisibility(value == null ? View.VISIBLE : View.GONE);
liveData.observe(lifecycleOwner, newObserver);
view.setTag(R.id.bound_observable_visibility, newObserver);
// Imposta lo stato iniziale
view.setVisibility(liveData.getValue() == null ? View.VISIBLE : View.GONE);
}
@BindingAdapter({"reverse_visibility"}) @BindingAdapter({"reverse_visibility"})
public static void bindViewReverseVisibility(View view, final BindableBoolean bindableBoolean) { public static void bindViewReverseVisibility(View view, final BindableBoolean bindableBoolean) {
if (view.getTag(R.id.bound_reverse_visibility) != bindableBoolean) { if (view.getTag(R.id.bound_reverse_visibility) != bindableBoolean) {
@@ -910,4 +979,64 @@ public class Converters {
view.setLayoutParams(layoutParams); view.setLayoutParams(layoutParams);
} }
} /**
* BindingAdapter per bindare una LocalDate diretta su una TextView con un formato specificato.
* Esempio di utilizzo in XML:
* app:localDateText="@{myLocalDate}" app:dateFormat="@{@string/my_date_format}"
*/
@BindingAdapter(value = {"localDateText", "dateFormat"}, requireAll = false)
public static void bindLocalDateText(TextView view, LocalDate date, String dateFormat) {
if (date == null) {
view.setText("");
return;
}
String pattern = dateFormat != null ? dateFormat : "dd/MM/yyyy";
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern);
view.setText(date.format(formatter));
}
@BindingAdapter(value = {"localDateTimeText", "dateFormat"}, requireAll = false)
public static void bindLocalDateText(TextView view, LocalDateTime date, String dateFormat) {
if (date == null) {
view.setText("");
return;
}
String pattern = dateFormat != null ? dateFormat : "dd/MM/yyyy hh:mm";
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern);
view.setText(date.format(formatter));
}
/**
* BindingAdapter per bindare una ObservableField<LocalDate> su una TextView con un formato specificato.
* Esempio di utilizzo in XML:
* app:localDateObservableText="@{myObservableLocalDate}" app:dateFormat="@{@string/my_date_format}"
*/
@BindingAdapter(value = {"localDateObservableText", "dateFormat"}, requireAll = false)
public static void bindObservableLocalDateText(TextView view, ObservableField<LocalDate> observableDate, String dateFormat) {
if (observableDate == null) {
view.setText("");
return;
}
LocalDate date = observableDate.get();
if (date == null) {
view.setText("");
return;
}
String pattern = dateFormat != null ? dateFormat : "dd/MM/yyyy";
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern);
view.setText(date.format(formatter));
}
/**
* BindingAdapter che applica automaticamente il KeyListener localizzato
* ai campi con inputType numberDecimal, permettendo l'uso della virgola
* come separatore decimale in base al locale del dispositivo.
*/
@BindingAdapter("useLocaleDecimalInput")
public static void setLocaleDecimalInput(EditText view, boolean useLocaleInput) {
if (useLocaleInput) {
view.setKeyListener(LocaleDecimalKeyListener.getInstance());
}
}
}

View File

@@ -66,9 +66,6 @@ public class Ean128Service {
switch (aiModel.AI) { switch (aiModel.AI) {
case SSCC -> { case SSCC -> {
if (aiValue.length() > 0 && (aiValue.charAt(0) == '0' || aiValue.charAt(0) == '9')) {
aiValue = new StringBuilder(aiValue.substring(1));
}
model.Sscc = aiValue.toString(); model.Sscc = aiValue.toString();
} }
case GTIN -> { case GTIN -> {

View File

@@ -3,6 +3,6 @@ package it.integry.integrywmsnative.core.exception;
public class InvalidCodMdepBarcodeException extends RuntimeException { public class InvalidCodMdepBarcodeException extends RuntimeException {
public InvalidCodMdepBarcodeException(String message) { public InvalidCodMdepBarcodeException(String message) {
super(message); super("Il deposito scansionato non è valido: " + message);
} }
} }

View File

@@ -3,13 +3,13 @@ package it.integry.integrywmsnative.core.exception;
import it.integry.integrywmsnative.R; import it.integry.integrywmsnative.R;
import it.integry.integrywmsnative.core.utility.UtilityResources; import it.integry.integrywmsnative.core.utility.UtilityResources;
public final class InvalidCodMdepLUException extends Exception { public final class InvalidCodMdepException extends Exception {
public InvalidCodMdepLUException() { public InvalidCodMdepException() {
super(UtilityResources.getString(R.string.invalid_codmdep_error_message)); super(UtilityResources.getString(R.string.invalid_codmdep_error_message));
} }
public InvalidCodMdepLUException(String codMdep) { public InvalidCodMdepException(String codMdep) {
super(UtilityResources.getString(R.string.invalid_codmdep_error_message) + "(" + codMdep + ")"); super(UtilityResources.getString(R.string.invalid_codmdep_error_message) + "(" + codMdep + ")");
} }

View File

@@ -34,7 +34,6 @@ public class BaseActivity extends AppCompatActivity {
} }
public void onLoadingStarted() { public void onLoadingStarted() {
BarcodeManager.disable();
this.openProgress(); this.openProgress();
} }
@@ -52,14 +51,14 @@ public class BaseActivity extends AppCompatActivity {
private void openProgress() { private void openProgress() {
BarcodeManager.disable(); BarcodeManager.disableLastCallback();
// executorService.execute(() -> { // executorService.execute(() -> {
this.mCurrentProgress.show(getSupportFragmentManager()); this.mCurrentProgress.show(getSupportFragmentManager());
// }); // });
} }
private void closeProgress() { private void closeProgress() {
BarcodeManager.enable(); BarcodeManager.enableLastCallback();
// executorService.execute(() -> { // executorService.execute(() -> {
mCurrentProgress.dismiss(); mCurrentProgress.dismiss();
// }); // });
@@ -67,7 +66,7 @@ public class BaseActivity extends AppCompatActivity {
@Override @Override
public boolean dispatchKeyEvent(KeyEvent event) { public boolean dispatchKeyEvent(KeyEvent event) {
if (BarcodeManager.isEnabled() && BarcodeManager.isKeyboardEmulator()) { if (BarcodeManager.isLastCallbackEnabled() && BarcodeManager.isKeyboardEmulator()) {
if (event.getAction() == KeyEvent.ACTION_DOWN || event.getAction() == KeyEvent.ACTION_MULTIPLE && !isControlKey(event)) { if (event.getAction() == KeyEvent.ACTION_DOWN || event.getAction() == KeyEvent.ACTION_MULTIPLE && !isControlKey(event)) {
return BarcodeManager.onKeyDown(event.getKeyCode(), event); return BarcodeManager.onKeyDown(event.getKeyCode(), event);
} }

View File

@@ -14,7 +14,7 @@ public class BaseDialog extends Dialog {
public BaseDialog(@NonNull Context context) { public BaseDialog(@NonNull Context context) {
super(context); super(context);
if (BarcodeManager.isEnabled() && BarcodeManager.isKeyboardEmulator()) { if (BarcodeManager.isLastCallbackEnabled() && BarcodeManager.isKeyboardEmulator()) {
setOnKeyListener((dialog, keyCode, event) -> { setOnKeyListener((dialog, keyCode, event) -> {
if (mBarcodeListener && (event.getAction() == KeyEvent.ACTION_DOWN || event.getAction() == KeyEvent.ACTION_MULTIPLE) && !isControlKey(event)) { if (mBarcodeListener && (event.getAction() == KeyEvent.ACTION_DOWN || event.getAction() == KeyEvent.ACTION_MULTIPLE) && !isControlKey(event)) {
return BarcodeManager.onKeyDown(event.getKeyCode(), event); return BarcodeManager.onKeyDown(event.getKeyCode(), event);

View File

@@ -65,25 +65,23 @@ public abstract class BaseDialogFragment extends DialogFragment implements Dialo
} }
public void onLoadingStarted() { public void onLoadingStarted() {
BarcodeManager.disable();
this.openProgress(); this.openProgress();
} }
public void onLoadingEnded() { public void onLoadingEnded() {
this.closeProgress(); this.closeProgress();
BarcodeManager.enable();
} }
private void openProgress() { private void openProgress() {
BarcodeManager.disable(); BarcodeManager.disableLastCallback();
// executorService.execute(() -> { // executorService.execute(() -> {
this.mCurrentProgress.show(requireActivity().getSupportFragmentManager()); this.mCurrentProgress.show(requireActivity().getSupportFragmentManager());
// }); // });
} }
private void closeProgress() { private void closeProgress() {
BarcodeManager.enable(); BarcodeManager.enableLastCallback();
// executorService.execute(() -> { // executorService.execute(() -> {
mCurrentProgress.dismiss(); mCurrentProgress.dismiss();
// }); // });
@@ -91,9 +89,8 @@ public abstract class BaseDialogFragment extends DialogFragment implements Dialo
public void onError(Exception ex) { public void onError(Exception ex) {
this.onLoadingEnded();
requireActivity().runOnUiThread(() -> { requireActivity().runOnUiThread(() -> {
this.onLoadingEnded();
UtilityExceptions.defaultException(requireActivity(), ex); UtilityExceptions.defaultException(requireActivity(), ex);
}); });
} }
@@ -130,7 +127,7 @@ public abstract class BaseDialogFragment extends DialogFragment implements Dialo
.create() .create()
.inject(this); .inject(this);
if (BarcodeManager.isEnabled() && BarcodeManager.isKeyboardEmulator() && getDialog() != null) { if (BarcodeManager.isLastCallbackEnabled() && BarcodeManager.isKeyboardEmulator() && getDialog() != null) {
getDialog().setOnKeyListener((dialog, keyCode, event) -> { getDialog().setOnKeyListener((dialog, keyCode, event) -> {
if (mBarcodeListener && (event.getAction() == KeyEvent.ACTION_DOWN || event.getAction() == KeyEvent.ACTION_MULTIPLE) && !isControlKey(event)) { if (mBarcodeListener && (event.getAction() == KeyEvent.ACTION_DOWN || event.getAction() == KeyEvent.ACTION_MULTIPLE) && !isControlKey(event)) {
return BarcodeManager.onKeyDown(event.getKeyCode(), event); return BarcodeManager.onKeyDown(event.getKeyCode(), event);

View File

@@ -69,14 +69,14 @@ public abstract class BaseFragment extends Fragment {
} }
private void openProgress() { private void openProgress() {
BarcodeManager.disable(); BarcodeManager.disableLastCallback();
// executorService.execute(() -> { // executorService.execute(() -> {
this.mCurrentProgress.show(requireActivity().getSupportFragmentManager()); this.mCurrentProgress.show(requireActivity().getSupportFragmentManager());
// }); // });
} }
private void closeProgress() { private void closeProgress() {
BarcodeManager.enable(); BarcodeManager.enableLastCallback();
// executorService.execute(() -> { // executorService.execute(() -> {
mCurrentProgress.dismiss(); mCurrentProgress.dismiss();
// }); // });
@@ -86,7 +86,6 @@ public abstract class BaseFragment extends Fragment {
handler.post(() -> { handler.post(() -> {
this.closeProgress(); this.closeProgress();
UtilityExceptions.defaultException(getActivity(), ex); UtilityExceptions.defaultException(getActivity(), ex);
BarcodeManager.enable();
}); });
} }

View File

@@ -0,0 +1,44 @@
package it.integry.integrywmsnative.core.expansion.view;
import android.view.View;
import androidx.databinding.ObservableArrayList;
import androidx.databinding.ObservableList;
import androidx.recyclerview.widget.RecyclerView;
import it.integry.integrywmsnative.core.expansion.OnListGeneralChangedCallback;
public abstract class ExtendedSectionedRecyclerViewNew<T, SH extends RecyclerView.ViewHolder, VH extends RecyclerView.ViewHolder>
extends SectionedRecyclerViewAdapter<SH, VH> {
private View mEmptyView;
public ExtendedSectionedRecyclerViewNew(ObservableArrayList<T> myDataset) {
super();
myDataset.addOnListChangedCallback(new OnListGeneralChangedCallback<T>() {
@Override
public void onChanged(ObservableList<T> sender) {
checkIfEmpty();
}
});
checkIfEmpty();
}
public ExtendedSectionedRecyclerViewNew<T, SH, VH> setEmptyView(View emptyView) {
this.mEmptyView = emptyView;
this.checkIfEmpty();
return this;
}
private void checkIfEmpty() {
if (mEmptyView != null) {
final boolean emptyViewVisible = getItemCount() == 0;
mEmptyView.setVisibility(emptyViewVisible ? View.VISIBLE : View.GONE);
}
}
}

View File

@@ -0,0 +1,218 @@
package it.integry.integrywmsnative.core.expansion.view;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import android.util.SparseArray;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import java.lang.ref.WeakReference;
import java.util.ArrayDeque;
import java.util.HashSet;
import java.util.Locale;
import java.util.Set;
import java.util.concurrent.TimeUnit;
public class RecyclerViewProfiler {
private static final String TAG = "RVProfiler";
private final SparseArray<Long> bindingTimes;
private final SparseArray<Long> creationTimes;
private final Handler mainHandler;
private WeakReference<RecyclerView> recyclerViewRef;
private boolean isProfilingEnabled = true;
// Metriche di performance
private long totalBindingTime = 0;
private long totalCreationTime = 0;
private int bindCount = 0;
private int createCount = 0;
private long firstBindTime = 0;
private final ArrayDeque<Long> recentBindTimes;
private static final int MAX_RECENT_TIMES = 50;
public RecyclerViewProfiler(RecyclerView recyclerView) {
this.recyclerViewRef = new WeakReference<>(recyclerView);
this.bindingTimes = new SparseArray<>();
this.creationTimes = new SparseArray<>();
this.mainHandler = new Handler(Looper.getMainLooper());
this.recentBindTimes = new ArrayDeque<>();
setupRecyclerViewCallbacks();
}
private void setupRecyclerViewCallbacks() {
RecyclerView recyclerView = recyclerViewRef.get();
if (recyclerView == null) return;
recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
if (newState == RecyclerView.SCROLL_STATE_IDLE) {
logPerformanceMetrics();
}
}
});
// Monitora il pre-layout
recyclerView.addOnLayoutChangeListener((v, left, top, right, bottom,
oldLeft, oldTop, oldRight, oldBottom) -> {
if (firstBindTime == 0) {
mainHandler.postDelayed(this::checkInitialPerformance, 500);
}
});
}
public void onPreBind(int position) {
if (!isProfilingEnabled) return;
bindingTimes.put(position, System.nanoTime());
}
public void onPostBind(int position) {
if (!isProfilingEnabled) return;
Long startTime = bindingTimes.get(position);
if (startTime != null) {
long bindTime = System.nanoTime() - startTime;
bindingTimes.remove(position);
if (firstBindTime == 0) {
firstBindTime = bindTime;
}
totalBindingTime += bindTime;
bindCount++;
recentBindTimes.addLast(bindTime);
if (recentBindTimes.size() > MAX_RECENT_TIMES) {
recentBindTimes.removeFirst();
}
// Segnala binding lenti
if (bindTime > TimeUnit.MILLISECONDS.toNanos(16)) { // 1 frame
Log.w(TAG, String.format("Slow binding at position %d: %.2fms",
position, bindTime / 1_000_000.0));
}
}
}
public void onPreCreate(int viewType) {
if (!isProfilingEnabled) return;
creationTimes.put(viewType, System.nanoTime());
}
public void onPostCreate(int viewType) {
if (!isProfilingEnabled) return;
Long startTime = creationTimes.get(viewType);
if (startTime != null) {
long createTime = System.nanoTime() - startTime;
creationTimes.remove(viewType);
totalCreationTime += createTime;
createCount++;
// Segnala creazioni lente
if (createTime > TimeUnit.MILLISECONDS.toNanos(8)) {
Log.w(TAG, String.format("Slow view creation for type %d: %.2fms",
viewType, createTime / 1_000_000.0));
}
}
}
private void checkInitialPerformance() {
RecyclerView recyclerView = recyclerViewRef.get();
if (recyclerView == null) return;
// Verifica inflazione layout
long avgBindTime = bindCount > 0 ? totalBindingTime / bindCount : 0;
if (avgBindTime > TimeUnit.MILLISECONDS.toNanos(8)) {
Log.w(TAG, String.format("High average binding time: %.2fms. " +
"Consider using AsyncLayoutInflater", avgBindTime / 1_000_000.0));
}
// Verifica dimensione view pool
RecyclerView.RecycledViewPool pool = recyclerView.getRecycledViewPool();
if (pool != null) {
int[] viewTypes = getViewTypes(recyclerView);
for (int type : viewTypes) {
if (pool.getRecycledViewCount(type) == 0) {
Log.w(TAG, "ViewPool empty for type " + type +
". Consider increasing pool size");
}
}
}
// Verifica prefetch
if (recyclerView.getLayoutManager() instanceof LinearLayoutManager) {
LinearLayoutManager lm = (LinearLayoutManager) recyclerView.getLayoutManager();
if (!lm.isItemPrefetchEnabled()) {
Log.w(TAG, "Item prefetch is disabled. Enable it for better performance");
}
}
}
private void logPerformanceMetrics() {
if (!isProfilingEnabled || recentBindTimes.isEmpty()) return;
// Calcola la varianza dei tempi di binding recenti
double mean = recentBindTimes.stream()
.mapToLong(Long::longValue)
.average()
.orElse(0.0);
double variance = recentBindTimes.stream()
.mapToDouble(time -> Math.pow(time - mean, 2))
.average()
.orElse(0.0);
Log.d(TAG, String.format("Performance metrics:\n" +
"Avg binding time: %.2fms\n" +
"Binding time variance: %.2f\n" +
"View creation rate: %.1f%%",
mean / 1_000_000.0,
variance / 1_000_000.0,
createCount * 100.0 / (bindCount + 1)));
}
private int[] getViewTypes(RecyclerView recyclerView) {
RecyclerView.Adapter<?> adapter = recyclerView.getAdapter();
if (adapter == null) return new int[0];
Set<Integer> types = new HashSet<>();
for (int i = 0; i < adapter.getItemCount(); i++) {
types.add(adapter.getItemViewType(i));
}
return types.stream().mapToInt(Integer::intValue).toArray();
}
public void enableProfiling(boolean enabled) {
isProfilingEnabled = enabled;
if (!enabled) {
bindingTimes.clear();
creationTimes.clear();
recentBindTimes.clear();
}
}
public String getProfilingStats() {
if (bindCount == 0) return "No data collected yet";
return String.format(Locale.US,
"Profiling Statistics:\n" +
"Total bindings: %d\n" +
"Average binding time: %.2fms\n" +
"Total view creations: %d\n" +
"Average creation time: %.2fms\n" +
"First binding time: %.2fms\n" +
"Creation/Binding ratio: %.1f%%",
bindCount,
(totalBindingTime / bindCount) / 1_000_000.0,
createCount,
(totalCreationTime / createCount) / 1_000_000.0,
firstBindTime / 1_000_000.0,
createCount * 100.0 / bindCount);
}
}

View File

@@ -0,0 +1,352 @@
package it.integry.integrywmsnative.core.expansion.view;
import android.util.SparseArray;
import android.util.SparseIntArray;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import it.integry.integrywmsnative.BuildConfig;
public abstract class SectionedRecyclerViewAdapter<H extends RecyclerView.ViewHolder,
I extends RecyclerView.ViewHolder> extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private RecyclerViewProfiler profiler;
private static final int TYPE_HEADER = 0;
private static final int TYPE_ITEM = 1;
// Utilizziamo SparseArray invece di HashMap per migliori performance su Android
private final SparseArray<Section> sectionsByPosition;
private final ArrayList<Section> sections;
// Cache per le posizioni degli item per evitare ricalcoli frequenti
private final SparseIntArray positionCache;
private int lastCacheUpdateCount;
// Pool di View per riutilizzo
private final RecyclerView.RecycledViewPool sharedPool;
// Dimensione massima della cache delle posizioni
private static final int MAX_POSITION_CACHE_SIZE = 2000;
public SectionedRecyclerViewAdapter() {
this.sections = new ArrayList<>();
this.sectionsByPosition = new SparseArray<>();
this.positionCache = new SparseIntArray(MAX_POSITION_CACHE_SIZE);
this.sharedPool = new RecyclerView.RecycledViewPool();
// Aumentiamo il pool di ViewHolder per tipo
sharedPool.setMaxRecycledViews(TYPE_HEADER, 500);
sharedPool.setMaxRecycledViews(TYPE_ITEM, 2000);
}
@Override
public void onAttachedToRecyclerView(@NonNull RecyclerView recyclerView) {
super.onAttachedToRecyclerView(recyclerView);
profiler = new RecyclerViewProfiler(recyclerView);
profiler.enableProfiling(BuildConfig.DEBUG);
recyclerView.setRecycledViewPool(sharedPool);
// Ottimizziamo il layout manager per le prestazioni
if (recyclerView.getLayoutManager() instanceof LinearLayoutManager) {
LinearLayoutManager layoutManager = (LinearLayoutManager) recyclerView.getLayoutManager();
layoutManager.setItemPrefetchEnabled(true);
// layoutManager.setInitialPrefetchItemCount(20);
}
// recyclerView.postDelayed(() -> {
// Precarica alcuni ViewHolder
// for (int i = 0; i < 100; i++) {
// sharedPool.putRecycledView(
// createViewHolder(recyclerView, TYPE_HEADER));
// }
// for (int i = 0; i < 100; i++) {
// sharedPool.putRecycledView(
// createViewHolder(recyclerView, TYPE_ITEM));
// }
// }, 50);
}
protected static class Section {
private final Object headerData;
private final ArrayList<Object> itemsData;
private int globalStartPosition; // Posizione globale di inizio sezione
public Section(Object headerData, int initialCapacity) {
this.headerData = headerData;
this.itemsData = new ArrayList<>(initialCapacity);
this.globalStartPosition = 0;
}
public Object getHeaderData() {
return headerData;
}
public List<Object> getItemsData() {
return itemsData;
}
public void addItem(Object item) {
itemsData.add(item);
}
public int getItemCount() {
return itemsData.size();
}
public void setGlobalStartPosition(int position) {
this.globalStartPosition = position;
}
public int getGlobalStartPosition() {
return globalStartPosition;
}
}
// ViewHolder pooling e caching
@Override
public void onViewRecycled(@NonNull RecyclerView.ViewHolder holder) {
super.onViewRecycled(holder);
// Pulizia custom del ViewHolder se necessario
if (holder instanceof OnRecycleListener) {
((OnRecycleListener) holder).onRecycle();
}
}
// Interfaccia per gestire la pulizia custom dei ViewHolder
public interface OnRecycleListener {
void onRecycle();
}
@Override
@NonNull
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
profiler.onPreCreate(viewType);
RecyclerView.ViewHolder holder;
if (viewType == TYPE_HEADER) {
holder = onCreateHeaderViewHolder(parent);
} else {
holder = onCreateItemViewHolder(parent);
}
// Applichiamo ViewHolder pooling
if (holder.itemView.getLayoutParams() == null) {
holder.itemView.setLayoutParams(
new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT
)
);
}
profiler.onPostCreate(viewType);
return holder;
}
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
profiler.onPreBind(position);
PositionInfo posInfo = getItemPositionInfo(position);
if (getItemViewType(position) == TYPE_HEADER) {
onBindHeaderViewHolder((H) holder,
sections.get(posInfo.sectionPosition).getHeaderData(),
posInfo.sectionPosition);
} else {
Section section = sections.get(posInfo.sectionPosition);
onBindItemViewHolder((I) holder,
section.getItemsData().get(posInfo.itemPosition),
posInfo.sectionPosition,
posInfo.itemPosition);
}
profiler.onPostBind(position);
}
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position, @NonNull List<Object> payloads) {
if (payloads.isEmpty()) {
super.onBindViewHolder(holder, position, payloads);
return;
}
// Supporto per aggiornamenti parziali
if (getItemViewType(position) == TYPE_HEADER) {
onBindHeaderViewHolderPartial((H) holder, position, payloads);
} else {
onBindItemViewHolderPartial((I) holder, position, payloads);
}
}
// Metodi per gestire aggiornamenti parziali
protected void onBindHeaderViewHolderPartial(H holder, int position, List<Object> payloads) {
onBindViewHolder(holder, position);
}
protected void onBindItemViewHolderPartial(I holder, int position, List<Object> payloads) {
onBindViewHolder(holder, position);
}
@Override
public int getItemCount() {
int count = 0;
for (Section section : sections) {
count += section.getItemCount() + 1;
}
return count;
}
@Override
public int getItemViewType(int position) {
return isHeader(position) ? TYPE_HEADER : TYPE_ITEM;
}
// Metodi ottimizzati per la gestione delle sezioni
public <T> void addSection(T headerData, int expectedItems) {
sections.add(new Section(headerData, expectedItems));
updatePositionCache();
notifyDataSetChanged();
}
public void addItem(int sectionPosition, Object item) {
if (sectionPosition >= 0 && sectionPosition < sections.size()) {
sections.get(sectionPosition).addItem(item);
updatePositionCache();
// Notifichiamo solo l'inserimento invece di un refresh completo
notifyItemInserted(getGlobalPositionForItem(sectionPosition,
sections.get(sectionPosition).getItemCount() - 1));
}
}
public <T extends Object, S extends Object> void setSections(List<T> headers, Map<T, List<S>> items) {
sections.clear();
sectionsByPosition.clear();
int position = 0;
for (T header : headers) {
List<S> sectionItems = items.get(header);
Section section = new Section(header, sectionItems != null ? sectionItems.size() : 5);
if (sectionItems != null) {
section.getItemsData().addAll(sectionItems);
}
section.setGlobalStartPosition(position);
sections.add(section);
sectionsByPosition.put(position, section);
position += section.getItemCount() + 1;
}
updatePositionCache();
notifyDataSetChanged();
}
// Gestione efficiente della cache delle posizioni
private void updatePositionCache() {
if (sections.size() > MAX_POSITION_CACHE_SIZE) {
positionCache.clear();
return;
}
int currentPosition = 0;
for (int i = 0; i < sections.size(); i++) {
Section section = sections.get(i);
section.setGlobalStartPosition(currentPosition);
sectionsByPosition.put(currentPosition, section);
currentPosition += section.getItemCount() + 1;
}
lastCacheUpdateCount = getItemCount();
}
private boolean isHeader(int position) {
Section section = sectionsByPosition.get(position);
if (section != null) {
return true;
}
for (int i = 0; i < sections.size(); i++) {
section = sections.get(i);
if (position == section.getGlobalStartPosition()) {
return true;
}
if (position < section.getGlobalStartPosition() + section.getItemCount() + 1) {
return false;
}
}
return false;
}
private static class PositionInfo {
final int sectionPosition;
final int itemPosition;
PositionInfo(int sectionPosition, int itemPosition) {
this.sectionPosition = sectionPosition;
this.itemPosition = itemPosition;
}
}
private PositionInfo getItemPositionInfo(int position) {
// Controllo cache
int cachedSection = positionCache.get(position, -1);
if (cachedSection != -1 && lastCacheUpdateCount == getItemCount()) {
Section section = sections.get(cachedSection);
int relativePos = position - section.getGlobalStartPosition();
if (relativePos == 0) {
return new PositionInfo(cachedSection, -1);
}
return new PositionInfo(cachedSection, relativePos - 1);
}
// Ricerca ottimizzata
Section targetSection = sectionsByPosition.get(position);
if (targetSection != null) {
int sectionIndex = sections.indexOf(targetSection);
return new PositionInfo(sectionIndex, -1);
}
// Ricerca binaria nelle sezioni
int left = 0;
int right = sections.size() - 1;
while (left <= right) {
int mid = (left + right) >>> 1;
Section section = sections.get(mid);
int sectionStart = section.getGlobalStartPosition();
int sectionEnd = sectionStart + section.getItemCount() + 1;
if (position >= sectionStart && position < sectionEnd) {
int relativePos = position - sectionStart;
if (relativePos == 0) {
return new PositionInfo(mid, -1);
}
return new PositionInfo(mid, relativePos - 1);
}
if (position < sectionStart) {
right = mid - 1;
} else {
left = mid + 1;
}
}
throw new IndexOutOfBoundsException("Position " + position + " is out of bounds");
}
private int getGlobalPositionForItem(int sectionPosition, int itemPosition) {
return sections.get(sectionPosition).getGlobalStartPosition() + itemPosition + 1;
}
// Metodi astratti che devono essere implementati
protected abstract H onCreateHeaderViewHolder(ViewGroup parent);
protected abstract I onCreateItemViewHolder(ViewGroup parent);
protected abstract void onBindHeaderViewHolder(H holder, Object headerData, int sectionPosition);
protected abstract void onBindItemViewHolder(I holder, Object itemData, int sectionPosition, int itemPosition);
}

View File

@@ -1,17 +1,10 @@
package it.integry.integrywmsnative.core.menu; package it.integry.integrywmsnative.core.menu;
import androidx.annotation.NonNull;
import javax.inject.Singleton; import javax.inject.Singleton;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.model.StbMenu; import it.integry.integrywmsnative.core.model.StbMenu;
import it.integry.integrywmsnative.core.rest.RESTBuilder; import it.integry.integrywmsnative.core.rest.RESTBuilder;
import it.integry.integrywmsnative.core.rest.consumers._BaseRESTConsumer; import it.integry.integrywmsnative.core.rest.consumers._BaseRESTConsumer;
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import retrofit2.Call;
import retrofit2.Response;
@Singleton @Singleton
public class MenuRESTConsumer extends _BaseRESTConsumer { public class MenuRESTConsumer extends _BaseRESTConsumer {
@@ -22,19 +15,12 @@ public class MenuRESTConsumer extends _BaseRESTConsumer {
this.restBuilder = restBuilder; this.restBuilder = restBuilder;
} }
public void retrieveMenu(String rootCodOpz, RunnableArgs<StbMenu> onComplete, RunnableArgs<Exception> onFailed) { public StbMenu retrieveMenuSynchronized(String rootCodOpz) throws Exception {
MenuRESTConsumerService menuRESTConsumerService = restBuilder.getService(MenuRESTConsumerService.class); MenuRESTConsumerService menuRESTConsumerService = restBuilder.getService(MenuRESTConsumerService.class);
menuRESTConsumerService.retrieveMenuConfig(rootCodOpz).enqueue(new ManagedErrorCallback<>() { var response = menuRESTConsumerService.retrieveMenuConfig(rootCodOpz)
@Override .execute();
public void onResponse(Call<ServiceRESTResponse<StbMenu>> call, Response<ServiceRESTResponse<StbMenu>> response) {
analyzeAnswer(response, "retrieveMenu", onComplete, onFailed);
}
@Override return analyzeAnswer(response, "retrieveMenu");
public void onFailure(Call<ServiceRESTResponse<StbMenu>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
} }
} }

View File

@@ -10,7 +10,6 @@ import javax.inject.Singleton;
import it.integry.integrywmsnative.core.class_router.configs.BaseMenuConfiguration; import it.integry.integrywmsnative.core.class_router.configs.BaseMenuConfiguration;
import it.integry.integrywmsnative.core.class_router.configs.MenuConfiguration; import it.integry.integrywmsnative.core.class_router.configs.MenuConfiguration;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.menu.exception.MenuNotFoundException; import it.integry.integrywmsnative.core.menu.exception.MenuNotFoundException;
import it.integry.integrywmsnative.core.model.StbMenu; import it.integry.integrywmsnative.core.model.StbMenu;
@@ -29,20 +28,18 @@ public class MenuService {
this.menuRESTConsumer = menuRESTConsumer; this.menuRESTConsumer = menuRESTConsumer;
} }
public void init(Runnable onMenuInitialized, RunnableArgs<Exception> onFailed) { public void init() throws Exception {
menuRESTConsumer.retrieveMenu(MENU_COD_OPZ, menu -> { var menu = menuRESTConsumer.retrieveMenuSynchronized(MENU_COD_OPZ);
if(menu != null) {
this.mInternalCachedMenu = menu.getStbMenuChildren();
this.mInternalCachedFlatMenu = new ArrayList<>();
flattenMenu(this.mInternalCachedMenu);
}
onMenuInitialized.run(); if (menu != null) {
}, onFailed); this.mInternalCachedMenu = menu.getStbMenuChildren();
this.mInternalCachedFlatMenu = new ArrayList<>();
flattenMenu(this.mInternalCachedMenu);
}
} }
public List<StbMenu> getMenu() throws Exception { public List<StbMenu> getMenu() throws Exception {
if(mInternalCachedMenu == null) throw new MenuNotFoundException(); if (mInternalCachedMenu == null) throw new MenuNotFoundException();
return mInternalCachedMenu; return mInternalCachedMenu;
} }
@@ -64,10 +61,10 @@ public class MenuService {
} }
private void flattenMenu(List<StbMenu> menu) { private void flattenMenu(List<StbMenu> menu) {
for(StbMenu stbMenu : menu) { for (StbMenu stbMenu : menu) {
this.mInternalCachedFlatMenu.add(stbMenu); this.mInternalCachedFlatMenu.add(stbMenu);
if(stbMenu.getStbMenuChildren() != null && !stbMenu.getStbMenuChildren().isEmpty()) { if (stbMenu.getStbMenuChildren() != null && !stbMenu.getStbMenuChildren().isEmpty()) {
flattenMenu(stbMenu.getStbMenuChildren()); flattenMenu(stbMenu.getStbMenuChildren());
} }
} }

View File

@@ -1,7 +1,7 @@
package it.integry.integrywmsnative.core.model; package it.integry.integrywmsnative.core.model;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.time.LocalDate;
import java.util.List; import java.util.List;
public class DtbDoct { public class DtbDoct {
@@ -10,7 +10,7 @@ public class DtbDoct {
private String codAnag; private String codAnag;
private String codDtip; private String codDtip;
private Date dataDoc; private LocalDate dataDoc;
private Integer numDoc; private Integer numDoc;
private String serDoc; private String serDoc;
private BigDecimal acconto; private BigDecimal acconto;
@@ -41,14 +41,14 @@ public class DtbDoct {
private String compilatoDa; private String compilatoDa;
private String userName; private String userName;
private String controllatoDa; private String controllatoDa;
private Date dataChkDoc; private LocalDate dataChkDoc;
private Date dataDocVal; private LocalDate dataDocVal;
private Date dataInizTrasp; private LocalDate dataInizTrasp;
private Date dataIns; private LocalDate dataIns;
private Date dataOrd; private LocalDate dataOrd;
private Date dataReg; private LocalDate dataReg;
private Date dataRifScad; private LocalDate dataRifScad;
private Date dataUltMod; private LocalDate dataUltMod;
private String descrizionePaga; private String descrizionePaga;
private String flagPrzScontati; private String flagPrzScontati;
private String gestione; private String gestione;
@@ -89,7 +89,7 @@ public class DtbDoct {
private String targa; private String targa;
private Integer postiPallet; private Integer postiPallet;
private BigDecimal tempMedia; private BigDecimal tempMedia;
private Date dataCons; private LocalDate dataCons;
private BigDecimal nolo; private BigDecimal nolo;
private BigDecimal nolo2; private BigDecimal nolo2;
private String conducente; private String conducente;
@@ -102,7 +102,7 @@ public class DtbDoct {
private String setDataDecorrenza2DataRic; private String setDataDecorrenza2DataRic;
private BigDecimal totSpese; private BigDecimal totSpese;
private String chkArtListino; private String chkArtListino;
private Date dataCmov; private LocalDate dataCmov;
private String reso; private String reso;
private Integer numCmovAutofattura; private Integer numCmovAutofattura;
private Object dtbTipi; private Object dtbTipi;
@@ -141,11 +141,11 @@ public class DtbDoct {
return this; return this;
} }
public Date getDataDoc() { public LocalDate getDataDoc() {
return dataDoc; return dataDoc;
} }
public DtbDoct setDataDoc(Date dataDoc) { public DtbDoct setDataDoc(LocalDate dataDoc) {
this.dataDoc = dataDoc; this.dataDoc = dataDoc;
return this; return this;
} }
@@ -420,74 +420,74 @@ public class DtbDoct {
return this; return this;
} }
public Date getDataChkDoc() { public LocalDate getDataChkDoc() {
return dataChkDoc; return dataChkDoc;
} }
public DtbDoct setDataChkDoc(Date dataChkDoc) { public DtbDoct setDataChkDoc(LocalDate dataChkDoc) {
this.dataChkDoc = dataChkDoc; this.dataChkDoc = dataChkDoc;
return this; return this;
} }
public Date getDataDocVal() { public LocalDate getDataDocVal() {
return dataDocVal; return dataDocVal;
} }
public DtbDoct setDataDocVal(Date dataDocVal) { public DtbDoct setDataDocVal(LocalDate dataDocVal) {
this.dataDocVal = dataDocVal; this.dataDocVal = dataDocVal;
return this; return this;
} }
public Date getDataInizTrasp() { public LocalDate getDataInizTrasp() {
return dataInizTrasp; return dataInizTrasp;
} }
public DtbDoct setDataInizTrasp(Date dataInizTrasp) { public DtbDoct setDataInizTrasp(LocalDate dataInizTrasp) {
this.dataInizTrasp = dataInizTrasp; this.dataInizTrasp = dataInizTrasp;
return this; return this;
} }
public Date getDataIns() { public LocalDate getDataIns() {
return dataIns; return dataIns;
} }
public DtbDoct setDataIns(Date dataIns) { public DtbDoct setDataIns(LocalDate dataIns) {
this.dataIns = dataIns; this.dataIns = dataIns;
return this; return this;
} }
public Date getDataOrd() { public LocalDate getDataOrd() {
return dataOrd; return dataOrd;
} }
public DtbDoct setDataOrd(Date dataOrd) { public DtbDoct setDataOrd(LocalDate dataOrd) {
this.dataOrd = dataOrd; this.dataOrd = dataOrd;
return this; return this;
} }
public Date getDataReg() { public LocalDate getDataReg() {
return dataReg; return dataReg;
} }
public DtbDoct setDataReg(Date dataReg) { public DtbDoct setDataReg(LocalDate dataReg) {
this.dataReg = dataReg; this.dataReg = dataReg;
return this; return this;
} }
public Date getDataRifScad() { public LocalDate getDataRifScad() {
return dataRifScad; return dataRifScad;
} }
public DtbDoct setDataRifScad(Date dataRifScad) { public DtbDoct setDataRifScad(LocalDate dataRifScad) {
this.dataRifScad = dataRifScad; this.dataRifScad = dataRifScad;
return this; return this;
} }
public Date getDataUltMod() { public LocalDate getDataUltMod() {
return dataUltMod; return dataUltMod;
} }
public DtbDoct setDataUltMod(Date dataUltMod) { public DtbDoct setDataUltMod(LocalDate dataUltMod) {
this.dataUltMod = dataUltMod; this.dataUltMod = dataUltMod;
return this; return this;
} }
@@ -852,11 +852,11 @@ public class DtbDoct {
return this; return this;
} }
public Date getDataCons() { public LocalDate getDataCons() {
return dataCons; return dataCons;
} }
public DtbDoct setDataCons(Date dataCons) { public DtbDoct setDataCons(LocalDate dataCons) {
this.dataCons = dataCons; this.dataCons = dataCons;
return this; return this;
} }
@@ -969,11 +969,11 @@ public class DtbDoct {
return this; return this;
} }
public Date getDataCmov() { public LocalDate getDataCmov() {
return dataCmov; return dataCmov;
} }
public DtbDoct setDataCmov(Date dataCmov) { public DtbDoct setDataCmov(LocalDate dataCmov) {
this.dataCmov = dataCmov; this.dataCmov = dataCmov;
return this; return this;
} }

View File

@@ -1,6 +1,7 @@
package it.integry.integrywmsnative.core.model; package it.integry.integrywmsnative.core.model;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import it.integry.integrywmsnative.core.utility.UtilityString; import it.integry.integrywmsnative.core.utility.UtilityString;
@@ -96,6 +97,8 @@ public class MtbAart extends EntityBase {
private List<MtbUntMis> mtbUntMis; private List<MtbUntMis> mtbUntMis;
private List<MtbAartBarCode> mtbAartBarCode;
public enum UntMisRifPesoEnum { public enum UntMisRifPesoEnum {
C, C,
@@ -108,6 +111,104 @@ public class MtbAart extends EntityBase {
this.type = "mtb_aart"; this.type = "mtb_aart";
} }
public MtbAart(MtbAart other) {
this();
this.codMart = other.codMart;
this.descrizione = other.descrizione;
this.untMis = other.untMis;
this.barCode = other.barCode;
this.pesoKg = other.pesoKg; // BigDecimal è immutabile
this.qtaCnf = other.qtaCnf;
this.codAliq = other.codAliq;
this.codScoArt = other.codScoArt;
this.codTcolUi = other.codTcolUi;
this.codTcolUl = other.codTcolUl;
this.articoloComposto = other.articoloComposto;
this.esposizioneComp = other.esposizioneComp;
this.descrizioneEstesa = other.descrizioneEstesa;
this.codUltForn = other.codUltForn;
this.dataUltCar = other.dataUltCar;
this.valUltCar = other.valUltCar;
this.codUltClie = other.codUltClie;
this.dataUltScar = other.dataUltScar;
this.valUltScar = other.valUltScar;
this.tipoCodice = other.tipoCodice;
this.note = other.note;
this.posizione = other.posizione;
this.colliPedana = other.colliPedana;
this.untMis2 = other.untMis2;
this.rapConv2 = other.rapConv2;
this.flagInclListino = other.flagInclListino;
this.untMis3 = other.untMis3;
this.rapConv3 = other.rapConv3;
this.codMartStat = other.codMartStat;
this.codMcon = other.codMcon;
this.codMgrp = other.codMgrp;
this.codMsfa = other.codMsfa;
this.codMsgr = other.codMsgr;
this.codMstp = other.codMstp;
this.codMtip = other.codMtip;
this.descrizioneStat = other.descrizioneStat;
this.flagStato = other.flagStato;
this.cambioDiviCar = other.cambioDiviCar;
this.cambioDiviScar = other.cambioDiviScar;
this.ggScadPartita = other.ggScadPartita;
this.volumeMc = other.volumeMc;
this.flagEsponiPrz = other.flagEsponiPrz;
this.dataUltVar = other.dataUltVar;
this.percSfrido = other.percSfrido;
this.codBarreImb = other.codBarreImb;
this.flagCalcPrz = other.flagCalcPrz;
this.esposizioneCompAcq = other.esposizioneCompAcq;
this.flagCalcPrzAcq = other.flagCalcPrzAcq;
this.diacod = other.diacod;
this.plu = other.plu;
this.partIvaProd = other.partIvaProd;
this.ragSocProd = other.ragSocProd;
this.flagRapConvVariabile = other.flagRapConvVariabile;
this.flagMovArtMag = other.flagMovArtMag;
this.flagTracciabilita = other.flagTracciabilita;
this.taraKg = other.taraKg;
this.colliStrato = other.colliStrato;
this.flagQtaCnfFissa = other.flagQtaCnfFissa;
this.flagColliPedanaFisso = other.flagColliPedanaFisso;
this.codCconCosti = other.codCconCosti;
this.codCconRicavi = other.codCconRicavi;
this.codDgrpArt = other.codDgrpArt;
this.codDiviCar = other.codDiviCar;
this.codDiviScar = other.codDiviScar;
this.codEcrCat = other.codEcrCat;
this.codEcrMcat = other.codEcrMcat;
this.codEcrRep = other.codEcrRep;
this.codEcrStipo = other.codEcrStipo;
this.codEcrTipo = other.codEcrTipo;
this.codGrpBolla = other.codGrpBolla;
this.ingredienti = other.ingredienti;
this.idArtEqui = other.idArtEqui;
this.descrCassa = other.descrCassa;
this.codNcIntracee = other.codNcIntracee;
this.marchio = other.marchio;
this.sezione = other.sezione;
this.untMisRifPeso = other.untMisRifPeso; // Enum è immutabile
this.qtaEsistente = other.qtaEsistente;
this.qtaImpegnata = other.qtaImpegnata;
this.numCnfEsistente = other.numCnfEsistente;
this.numCnfImpegnata = other.numCnfImpegnata;
// Deep copy della lista
if (other.mtbUntMis != null) {
this.mtbUntMis = new ArrayList<>();
for (MtbUntMis untMis : other.mtbUntMis) {
this.mtbUntMis.add(new MtbUntMis(untMis)); // Assicurati che MtbUntMis abbia un costruttore di copia
}
}
}
public boolean isFlagTracciabilitaBoolean() { public boolean isFlagTracciabilitaBoolean() {
return flagTracciabilita != null && flagTracciabilita.equalsIgnoreCase("S"); return flagTracciabilita != null && flagTracciabilita.equalsIgnoreCase("S");
} }
@@ -866,6 +967,13 @@ public class MtbAart extends EntityBase {
return getMtbUntMis() != null && !getMtbUntMis().isEmpty() ? getMtbUntMis().get(0) : null; return getMtbUntMis() != null && !getMtbUntMis().isEmpty() ? getMtbUntMis().get(0) : null;
} }
public List<MtbAartBarCode> getMtbAartBarCode() {
return mtbAartBarCode;
}
public void setMtbAartBarCode(List<MtbAartBarCode> mtbAartBarCode) {
this.mtbAartBarCode = mtbAartBarCode;
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {

View File

@@ -0,0 +1,55 @@
package it.integry.integrywmsnative.core.model;
import java.math.BigDecimal;
public class MtbAartBarCode extends EntityBase {
private String codBarre;
private String codMart;
private BigDecimal qtaCnf;
private String flagPrimario;
private String tipoCodBarre;
public MtbAartBarCode() {
this.type = "mtb_aart_bar_code";
}
public String getCodBarre() {
return codBarre;
}
public void setCodBarre(String codBarre) {
this.codBarre = codBarre;
}
public String getCodMart() {
return codMart;
}
public void setCodMart(String codMart) {
this.codMart = codMart;
}
public BigDecimal getQtaCnf() {
return qtaCnf;
}
public void setQtaCnf(BigDecimal qtaCnf) {
this.qtaCnf = qtaCnf;
}
public String getFlagPrimario() {
return flagPrimario;
}
public void setFlagPrimario(String flagPrimario) {
this.flagPrimario = flagPrimario;
}
public String getTipoCodBarre() {
return tipoCodBarre;
}
public void setTipoCodBarre(String tipoCodBarre) {
this.tipoCodBarre = tipoCodBarre;
}
}

View File

@@ -15,7 +15,7 @@ public class MtbColr extends EntityBase {
private String gestione; private String gestione;
private String serCollo; private String serCollo;
private Integer numCollo; private Integer numCollo;
private String dataCollo; private LocalDate dataCollo;
private Integer riga; private Integer riga;
private Integer rigaOrd; private Integer rigaOrd;
private String codMart; private String codMart;
@@ -27,7 +27,7 @@ public class MtbColr extends EntityBase {
private String serColloRif; private String serColloRif;
private String note; private String note;
private LocalDate dataOrd; private LocalDate dataOrd;
private String dataColloRif; private LocalDate dataColloRif;
private BigDecimal qtaCnf; private BigDecimal qtaCnf;
private BigDecimal qtaCol; private BigDecimal qtaCol;
private Integer numOrd; private Integer numOrd;
@@ -67,6 +67,58 @@ public class MtbColr extends EntityBase {
} }
} }
public MtbColr(MtbColr other) {
this();
this.gestione = other.gestione;
this.serCollo = other.serCollo;
this.numCollo = other.numCollo;
this.dataCollo = other.dataCollo;
this.riga = other.riga;
this.rigaOrd = other.rigaOrd;
this.codMart = other.codMart;
this.codBarre = other.codBarre;
this.codCol = other.codCol;
this.codTagl = other.codTagl;
this.partitaMag = other.partitaMag;
this.gestioneRif = other.gestioneRif;
this.serColloRif = other.serColloRif;
this.note = other.note;
this.dataOrd = other.dataOrd; // LocalDate è immutabile
this.dataColloRif = other.dataColloRif;
this.qtaCnf = other.qtaCnf; // BigDecimal è immutabile
this.qtaCol = other.qtaCol;
this.numOrd = other.numOrd;
this.numEtich = other.numEtich;
this.numColloRif = other.numColloRif;
this.datetimeRow = other.datetimeRow;
this.codJcom = other.codJcom;
this.numCnf = other.numCnf;
this.insPartitaMag = other.insPartitaMag;
this.mtbPartitaMag_descrizione = other.mtbPartitaMag_descrizione;
this.dataScadPartita = other.dataScadPartita;
this.descrizione = other.descrizione;
this.untMis = other.untMis;
this.causale = other.causale;
this.utente = other.utente;
this.codAnagDoc = other.codAnagDoc;
this.codDtipDoc = other.codDtipDoc;
this.dataDoc = other.dataDoc;
this.serDoc = other.serDoc;
this.numDoc = other.numDoc;
this.idRigaDoc = other.idRigaDoc;
this.pesoNettoKg = other.pesoNettoKg;
this.pesoLordoKg = other.pesoLordoKg;
// Deep copy degli oggetti complessi
this.mtbAart = other.mtbAart != null ? new MtbAart(other.mtbAart) : null;
this.mtbPartitaMag = other.mtbPartitaMag != null ? new MtbPartitaMag(other.mtbPartitaMag) : null;
// Non copiamo i campi transient
// this.id = other.id;
// this.refMtbColr = other.refMtbColr;
}
public static class Causale { public static class Causale {
public static final int DEFAULT = 0; public static final int DEFAULT = 0;
@@ -112,21 +164,18 @@ public class MtbColr extends EntityBase {
return this; return this;
} }
public String getDataColloS() {
public LocalDate getDataColloLD() {
return dataCollo; return dataCollo;
} }
public Date getDataColloD() {
return UtilityDate.recognizeDateWithExceptionHandler(getDataColloS());
}
public MtbColr setDataCollo(String dataCollo) { public MtbColr setDataCollo(String dataCollo) {
this.dataCollo = dataCollo; this.dataCollo = UtilityDate.recognizeLocalDateWithExceptionHandler(dataCollo);
return this; return this;
} }
public MtbColr setDataCollo(Date dataCollo) { public MtbColr setDataCollo(LocalDate dataCollo) {
setDataCollo(UtilityDate.formatDate(dataCollo, UtilityDate.COMMONS_DATE_FORMATS.DMY_TIME_SLASH)); this.dataCollo = dataCollo;
return this; return this;
} }
@@ -235,25 +284,24 @@ public class MtbColr extends EntityBase {
} }
public String getDataColloRifS() { public String getDataColloRifS() {
return dataColloRif; return dataColloRif != null ? UtilityDate.COMMONS_DATE_FORMATS.DATE_DMY_SLASHED_FORMATTER.format(dataColloRif) : null;
} }
public Date getDataColloRifD() { public Date getDataColloRifD() {
return UtilityDate.recognizeDateWithExceptionHandler(getDataColloRifS()); return UtilityDate.recognizeDateWithExceptionHandler(getDataColloRifS());
} }
public MtbColr setDataColloRif(String dataColloRif) { public LocalDate getDataColloRifLD() {
this.dataColloRif = dataColloRif; return dataColloRif;
return this;
} }
public MtbColr setDataColloRif(Date dataColloRif) { public MtbColr setDataColloRif(String dataColloRif) {
this.dataColloRif = UtilityDate.formatDate(dataColloRif, UtilityDate.COMMONS_DATE_FORMATS.DMY_TIME_SLASH); this.dataColloRif = UtilityDate.recognizeLocalDateWithExceptionHandler(dataColloRif);
return this; return this;
} }
public MtbColr setDataColloRif(LocalDate dataColloRif) { public MtbColr setDataColloRif(LocalDate dataColloRif) {
this.dataColloRif = UtilityDate.formatDate(dataColloRif, UtilityDate.COMMONS_DATE_FORMATS.DMY_SLASH); this.dataColloRif = dataColloRif;
return this; return this;
} }

View File

@@ -3,7 +3,7 @@ package it.integry.integrywmsnative.core.model;
import android.text.TextUtils; import android.text.TextUtils;
import androidx.databinding.ObservableArrayList; import androidx.databinding.ObservableArrayList;
import androidx.databinding.ObservableField; import androidx.lifecycle.MutableLiveData;
import com.annimon.stream.Optional; import com.annimon.stream.Optional;
import com.annimon.stream.Stream; import com.annimon.stream.Stream;
@@ -22,7 +22,6 @@ import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
import it.integry.integrywmsnative.core.settings.SettingsManager; import it.integry.integrywmsnative.core.settings.SettingsManager;
import it.integry.integrywmsnative.core.utility.UtilityDB; import it.integry.integrywmsnative.core.utility.UtilityDB;
import it.integry.integrywmsnative.core.utility.UtilityDate; import it.integry.integrywmsnative.core.utility.UtilityDate;
import it.integry.integrywmsnative.core.utility.UtilityLogger;
import it.integry.integrywmsnative.core.utility.UtilityString; import it.integry.integrywmsnative.core.utility.UtilityString;
/** /**
@@ -31,7 +30,7 @@ import it.integry.integrywmsnative.core.utility.UtilityString;
public class MtbColt extends EntityBase { public class MtbColt extends EntityBase {
private String gestione; private String gestione;
private String dataCollo; private LocalDate dataCollo;
private String serCollo; private String serCollo;
private Integer numCollo; private Integer numCollo;
private String rifOrd; private String rifOrd;
@@ -66,7 +65,9 @@ public class MtbColt extends EntityBase {
private BigDecimal altezzaCm; private BigDecimal altezzaCm;
private String codJcom; private String codJcom;
private final ObservableField<ObservableMtbTcol> mtbTCol = new ObservableField<>(); private String barcodeUl;
private final transient MutableLiveData<ObservableMtbTcol> mtbTCol = new MutableLiveData<>();
private Boolean disablePrint; private Boolean disablePrint;
private String ragSocCliente; private String ragSocCliente;
@@ -84,7 +85,7 @@ public class MtbColt extends EntityBase {
public MtbColt() { public MtbColt() {
type = "mtb_colt"; type = "mtb_colt";
setDataCollo(UtilityDate.getDateInstance()); setDataCollo(LocalDate.now());
setSerCollo("/"); setSerCollo("/");
if (SettingsManager.i().isUserLoggedIn()) { if (SettingsManager.i().isUserLoggedIn()) {
@@ -143,20 +144,13 @@ public class MtbColt extends EntityBase {
} }
public String getDataColloHumanLong() { public String getDataColloHumanLong() {
Date dataColloD = null; if (dataCollo != null) {
try { return UtilityDate.COMMONS_DATE_FORMATS.DATE_DMY_HUMAN_FORMATTER.format(dataCollo);
dataColloD = getDataColloD();
} catch (Exception ex) {
UtilityLogger.error(ex);
}
if (dataColloD != null) {
return UtilityDate.formatDate(dataColloD, UtilityDate.COMMONS_DATE_FORMATS.DMY_HUMAN_LONG);
} else return null; } else return null;
} }
public String getDataColloS() { public String getDataColloS() {
return dataCollo; return dataCollo != null ? UtilityDate.COMMONS_DATE_FORMATS.DATE_DMY_SLASHED_FORMATTER.format(dataCollo) : null;
} }
public Date getDataColloD() { public Date getDataColloD() {
@@ -164,21 +158,16 @@ public class MtbColt extends EntityBase {
} }
public LocalDate getDataColloLD() { public LocalDate getDataColloLD() {
return UtilityDate.recognizeLocalDateWithExceptionHandler(getDataColloS()); return dataCollo;
} }
public MtbColt setDataCollo(String dataCollo) { public MtbColt setDataCollo(String dataCollo) {
this.dataCollo = dataCollo; this.dataCollo = UtilityDate.recognizeLocalDateWithExceptionHandler(dataCollo);
return this;
}
public MtbColt setDataCollo(Date dataCollo) {
this.dataCollo = UtilityDate.formatDate(dataCollo, UtilityDate.COMMONS_DATE_FORMATS.DMY_TIME_SLASH);
return this; return this;
} }
public MtbColt setDataCollo(LocalDate dataCollo) { public MtbColt setDataCollo(LocalDate dataCollo) {
this.dataCollo = UtilityDate.formatDate(dataCollo, UtilityDate.COMMONS_DATE_FORMATS.DMY_SLASH); this.dataCollo = dataCollo;
return this; return this;
} }
@@ -261,7 +250,7 @@ public class MtbColt extends EntityBase {
public MtbColt setCodTcol(String codTcol) { public MtbColt setCodTcol(String codTcol) {
this.codTcol = codTcol; this.codTcol = codTcol;
if(!UtilityString.isNullOrEmpty(codTcol)) { if (!UtilityString.isNullOrEmpty(codTcol)) {
var fountMtbTcolObservable = SettingsManager.iDB().getInternalImballi().stream() var fountMtbTcolObservable = SettingsManager.iDB().getInternalImballi().stream()
.filter(x -> x.getCodTcol().equalsIgnoreCase(codTcol)) .filter(x -> x.getCodTcol().equalsIgnoreCase(codTcol))
.findFirst() .findFirst()
@@ -544,16 +533,25 @@ public class MtbColt extends EntityBase {
return this; return this;
} }
public ObservableMtbTcol getMtbTCol() { public String getBarcodeUl() {
return mtbTCol.get(); return barcodeUl;
} }
public MtbColt setMtbTCol(ObservableMtbTcol mtbTCol) { public MtbColt setBarcodeUl(String barcodeUl) {
this.mtbTCol.set(mtbTCol); this.barcodeUl = barcodeUl;
return this; return this;
} }
public ObservableField<ObservableMtbTcol> mtbTcolProperty() { public ObservableMtbTcol getMtbTCol() {
return mtbTCol.getValue();
}
public MtbColt setMtbTCol(ObservableMtbTcol mtbTCol) {
this.mtbTCol.postValue(mtbTCol);
return this;
}
public MutableLiveData<ObservableMtbTcol> mtbTcolProperty() {
return mtbTCol; return mtbTCol;
} }
@@ -631,8 +629,20 @@ public class MtbColt extends EntityBase {
@Override @Override
public EntityBase clone() { public EntityBase clone() {
return clone(true);
}
public MtbColt clone(boolean withMtbColr) {
MtbColt mtbColt = (MtbColt) super.clone(); MtbColt mtbColt = (MtbColt) super.clone();
mtbColt.setMtbColr((ObservableArrayList<MtbColr>) mtbColt.getMtbColr().clone()); mtbColt.setMtbColr(new ObservableArrayList<>());
if(!withMtbColr) return mtbColt;
this.getMtbColr().stream()
.map(MtbColr::new) //Genera un clone
.forEach(mtbColr -> {
mtbColt.getMtbColr().add(mtbColr);
});
return mtbColt; return mtbColt;
} }
} }

View File

@@ -4,34 +4,60 @@ import java.math.BigDecimal;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
public class MtbPartitaMag extends EntityBase{ public class MtbPartitaMag extends EntityBase {
private String codMart; private String codMart;
private String partitaMag; private String partitaMag;
private String descrizione; private String descrizione;
private LocalDateTime dataIns; private LocalDateTime dataIns;
private LocalDate dataScad; private LocalDate dataScad;
private Integer scelta; private Integer scelta;
private BigDecimal costoUntUmMag; private BigDecimal costoUntUmMag;
private BigDecimal valUntUmMag; private BigDecimal valUntUmMag;
private BigDecimal taraCnfKg; private BigDecimal taraCnfKg;
private BigDecimal qtaCnf; private BigDecimal qtaCnf;
private String flagImballoArendere; private String flagImballoArendere;
private String flagStato; private String flagStato;
private String codDiviCont; private String codDiviCont;
private BigDecimal cambioDiviCont; private BigDecimal cambioDiviCont;
private String barcode; private String barcode;
private String note; private String note;
private BigDecimal rapConv2; private BigDecimal rapConv2;
private BigDecimal rapConv3; private BigDecimal rapConv3;
private String posizione; private String posizione;
private String dataAggPrz; private String dataAggPrz;
private String partitaMagSec; private String partitaMagSec;
private BigDecimal qtaAttesa; private BigDecimal qtaAttesa;
public MtbPartitaMag() { public MtbPartitaMag() {
this.type = "mtb_partita_mag"; this.type = "mtb_partita_mag";
} }
public MtbPartitaMag(MtbPartitaMag other) {
this();
this.codMart = other.codMart;
this.partitaMag = other.partitaMag;
this.descrizione = other.descrizione;
this.dataIns = other.dataIns; // LocalDateTime è immutabile
this.dataScad = other.dataScad; // LocalDate è immutabile
this.scelta = other.scelta;
this.costoUntUmMag = other.costoUntUmMag; // BigDecimal è immutabile
this.valUntUmMag = other.valUntUmMag;
this.taraCnfKg = other.taraCnfKg;
this.qtaCnf = other.qtaCnf;
this.flagImballoArendere = other.flagImballoArendere;
this.flagStato = other.flagStato;
this.codDiviCont = other.codDiviCont;
this.cambioDiviCont = other.cambioDiviCont;
this.barcode = other.barcode;
this.note = other.note;
this.rapConv2 = other.rapConv2;
this.rapConv3 = other.rapConv3;
this.posizione = other.posizione;
this.dataAggPrz = other.dataAggPrz;
this.partitaMagSec = other.partitaMagSec;
this.qtaAttesa = other.qtaAttesa;
}
public String getCodMart() { public String getCodMart() {

View File

@@ -15,6 +15,18 @@ public class MtbUntMis extends EntityBase {
this.type = "mtb_unt_mis"; this.type = "mtb_unt_mis";
} }
// Costruttore di copia
public MtbUntMis(MtbUntMis other) {
this();
this.untMis = other.untMis;
this.flagDig = other.flagDig;
this.cifreDec = other.cifreDec; // BigDecimal è immutabile
this.tipoUm = other.tipoUm;
this.flagUnitaKg = other.flagUnitaKg;
this.flagAttivo = other.flagAttivo;
}
public String getUntMis() { public String getUntMis() {
return untMis; return untMis;
} }

View File

@@ -4,7 +4,6 @@ import java.math.BigDecimal;
import java.time.LocalDate; import java.time.LocalDate;
import java.util.Date; import java.util.Date;
import it.integry.integrywmsnative.core.utility.UtilityDate;
import it.integry.integrywmsnative.core.utility.UtilityNumber; import it.integry.integrywmsnative.core.utility.UtilityNumber;
import it.integry.integrywmsnative.core.utility.UtilityString; import it.integry.integrywmsnative.core.utility.UtilityString;
@@ -306,7 +305,7 @@ public class MvwSitArtUdcDetInventario {
return new MtbColr() return new MtbColr()
.setCodJcom(getCodJcom()) .setCodJcom(getCodJcom())
.setCodMart(getCodMart()) .setCodMart(getCodMart())
.setDataCollo(UtilityDate.toDate(getDataCollo())) .setDataCollo(getDataCollo())
.setNumCollo(getNumCollo()) .setNumCollo(getNumCollo())
.setSerCollo(getSerCollo()) .setSerCollo(getSerCollo())
.setGestione(getGestione()) .setGestione(getGestione())

View File

@@ -3,7 +3,7 @@ package it.integry.integrywmsnative.core.model.dto;
import it.integry.integrywmsnative.core.model.MtbColt; import it.integry.integrywmsnative.core.model.MtbColt;
public class AlreadyRegisteredUDCDTO { public class AlreadyRegisteredUlDTO {
private MtbColt mtbColt; private MtbColt mtbColt;
@@ -13,7 +13,7 @@ public class AlreadyRegisteredUDCDTO {
return mtbColt; return mtbColt;
} }
public AlreadyRegisteredUDCDTO setMtbColt(MtbColt mtbColt) { public AlreadyRegisteredUlDTO setMtbColt(MtbColt mtbColt) {
this.mtbColt = mtbColt; this.mtbColt = mtbColt;
return this; return this;
} }
@@ -22,7 +22,7 @@ public class AlreadyRegisteredUDCDTO {
return canBeRecovered; return canBeRecovered;
} }
public AlreadyRegisteredUDCDTO setCanBeRecovered(boolean canBeRecovered) { public AlreadyRegisteredUlDTO setCanBeRecovered(boolean canBeRecovered) {
this.canBeRecovered = canBeRecovered; this.canBeRecovered = canBeRecovered;
return this; return this;
} }

View File

@@ -28,7 +28,7 @@ public class AuthInterceptor implements Interceptor {
public Response intercept(@NonNull Chain chain) throws IOException { public Response intercept(@NonNull Chain chain) throws IOException {
var originalRequest = chain.request(); var originalRequest = chain.request();
if (SettingsManager.i().getUserSession() != null) { if (SettingsManager.i().getUserSession() != null && SettingsManager.i().getUserSession().getAccessToken() != null) {
var accessToken = SettingsManager.i().getUserSession().getAccessToken(); var accessToken = SettingsManager.i().getUserSession().getAccessToken();
var accessTokenExpiryDate = SettingsManager.i().getUserSession().getAccessTokenExpiryDate(); var accessTokenExpiryDate = SettingsManager.i().getUserSession().getAccessTokenExpiryDate();
@@ -55,21 +55,22 @@ public class AuthInterceptor implements Interceptor {
.protocol(Protocol.HTTP_1_1) .protocol(Protocol.HTTP_1_1)
.code(401) .code(401)
.message("Unauthorized") .message("Unauthorized")
.body(ResponseBody.create(new byte[0], null)) .body(ResponseBody.create(okhttp3.MediaType.get("application/json"), new byte[0]))
.build(); .build();
} catch (Exception e) { } catch (Exception e) {
return chain.proceed(originalRequest); return chain.proceed(originalRequest);
} }
//Retrieve the new access token after refresh
accessToken = SettingsManager.i().getUserSession().getAccessToken();
}
// Add the access token to the request header // Add the access token to the request header
var authorizedRequest = originalRequest.newBuilder() var authorizedRequest = originalRequest.newBuilder()
.header("Authorization", "Bearer " + SettingsManager.i().getUserSession().getAccessToken()) .header("Authorization", "Bearer " + accessToken)
.build(); .build();
return chain.proceed(authorizedRequest); return chain.proceed(authorizedRequest);
} else
return chain.proceed(originalRequest);
} else } else
return chain.proceed(originalRequest); return chain.proceed(originalRequest);
} }

View File

@@ -3,7 +3,7 @@ package it.integry.integrywmsnative.core.rest;
import java.io.IOException; import java.io.IOException;
import it.integry.integrywmsnative.core.settings.SettingsManager; import it.integry.integrywmsnative.core.settings.SettingsManager;
import it.integry.integrywmsnative.core.utility.UtilityDate; import it.integry.integrywmsnative.core.utility.UtilityString;
import okhttp3.HttpUrl; import okhttp3.HttpUrl;
import okhttp3.Interceptor; import okhttp3.Interceptor;
import okhttp3.Request; import okhttp3.Request;
@@ -18,30 +18,28 @@ public class HttpInterceptor implements Interceptor {
@Override @Override
public Response intercept(Chain chain) throws IOException { public Response intercept(Chain chain) throws IOException {
final String PROFILE_DB = SettingsManager.i().getUserSession() == null ? null : SettingsManager.i().getUserSession().getProfileDB(); final String PROFILE_DB = SettingsManager.i().getUserSession() == null ? null : SettingsManager.i().getUserSession().getProfileDB();
final String APP_TOKEN = "fa3a21af-606b-4129-a22b-aedc2a52c7b6"; final String APP_TOKEN = "fa3a21af-606b-4129-a22b-aedc2a52c7b6";
final Request request = chain.request(); HttpUrl.Builder urlBuilder = chain.request().url().newBuilder();
final HttpUrl url = request.url().newBuilder()
.addQueryParameter("profileDb", PROFILE_DB)
.build();
Request.Builder builder = chain.request().newBuilder() if (!UtilityString.isNullOrEmpty(PROFILE_DB))
urlBuilder
.addQueryParameter("profileDb", PROFILE_DB);
HttpUrl url = urlBuilder.build();
final Request.Builder requestBuilder = chain.request().newBuilder();
Request.Builder builder = requestBuilder
.addHeader("Content-Type", "application/json") .addHeader("Content-Type", "application/json")
.addHeader("Accept", "*/*") .addHeader("Accept", "*/*")
.addHeader("x-app-token", APP_TOKEN); .addHeader("x-app-token", APP_TOKEN);
if (SettingsManager.i().getUserSession() != null &&
String accessToken = null; SettingsManager.i().getUserSession().getDepo() != null &&
!UtilityString.isNullOrEmpty(SettingsManager.i().getUserSession().getDepo().getCodMdep()))
//Nel caso in cui il token è scaduto e devo richiamare la refresh non bisogna passare il vecchio token builder.addHeader("codMdep", SettingsManager.i().getUserSession().getDepo().getCodMdep());
if(SettingsManager.i().getUserSession().getAccessTokenExpiryDate() != null &&
UtilityDate.getNowTime().isBefore(SettingsManager.i().getUserSession().getAccessTokenExpiryDate())) {
accessToken = SettingsManager.i().getUserSession().getAccessToken();
}
if(accessToken != null)
builder.header("Authorization", "Bearer " + accessToken);
var newRequest = builder var newRequest = builder
.url(url) .url(url)

View File

@@ -37,19 +37,19 @@ public class RESTBuilder {
} }
public <T> T getService(final Class<T> service, int timeout) { public <T> T getService(final Class<T> service, int timeout) {
return getService(service, SettingsManager.i().getServer().getProtocol(), SettingsManager.i().getServer().getHost(), SettingsManager.i().getServer().getPort(), true, true, timeout); return getService(service, SettingsManager.i().getServer().getProtocol(), SettingsManager.i().getServer().getHost(), SettingsManager.i().getServer().getPort(), true, timeout);
} }
public <T> T getService(final Class<T> service, String protocol, String host, int port, boolean addInterceptors) { public <T> T getService(final Class<T> service, String protocol, String host, int port) {
return getService(service, protocol, host, port, addInterceptors, true, 60); return getService(service, protocol, host, port, true, 60);
} }
public <T> T getService(final Class<T> service, String protocol, String host, int port, boolean addInterceptors, boolean addEmsApi) { public <T> T getService(final Class<T> service, String protocol, String host, int port, boolean addEmsApi) {
return getService(service, protocol, host, port, addInterceptors, addEmsApi, 60); return getService(service, protocol, host, port, addEmsApi, 60);
} }
public <T> T getService(final Class<T> service, String protocol, String host, int port, boolean addInterceptors, boolean addEmsApi, int timeout) { public <T> T getService(final Class<T> service, String protocol, String host, int port, boolean addEmsApi, int timeout) {
OkHttpClient.Builder clientBuilder = getDefaultHttpClient(); OkHttpClient.Builder clientBuilder = getDefaultHttpClient();
timeout = 0; timeout = 0;
@@ -62,7 +62,7 @@ public class RESTBuilder {
clientBuilder.retryOnConnectionFailure(true); clientBuilder.retryOnConnectionFailure(true);
clientBuilder.addInterceptor(authInterceptor); clientBuilder.addInterceptor(authInterceptor);
if (addInterceptors) clientBuilder.addInterceptor(new HttpInterceptor()); clientBuilder.addInterceptor(new HttpInterceptor());
if (ADD_LOGGER_INTERCEPTOR) clientBuilder.addInterceptor(new HttpLoggerInterceptor()); if (ADD_LOGGER_INTERCEPTOR) clientBuilder.addInterceptor(new HttpLoggerInterceptor());
OkHttpClient client = clientBuilder.build(); OkHttpClient client = clientBuilder.build();

View File

@@ -108,7 +108,7 @@ public class ArticoloRESTConsumer extends _BaseRESTConsumer {
}); });
} }
public void findIfIsKit(MtbAart mtbAart, RunnableArgs<MtbAart> onComplete, RunnableArgs<Exception> onFailed){ public void findIfIsKit(MtbAart mtbAart, RunnableArgs<MtbAart> onComplete, RunnableArgs<Exception> onFailed) {
ArticoloRESTConsumerService articoloRESTConsumerService = restBuilder.getService(ArticoloRESTConsumerService.class); ArticoloRESTConsumerService articoloRESTConsumerService = restBuilder.getService(ArticoloRESTConsumerService.class);
articoloRESTConsumerService articoloRESTConsumerService
@@ -132,8 +132,7 @@ public class ArticoloRESTConsumer extends _BaseRESTConsumer {
var codMarts = codMartToFind.parallelStream() var codMarts = codMartToFind.parallelStream()
.filter(Objects::nonNull) .filter(Objects::nonNull)
.distinct() .distinct()
.collect(Collectors.toUnmodifiableList()); .collect(Collectors.toUnmodifiableList());
ArticoloRESTConsumerService articoloRESTConsumer = restBuilder.getService(ArticoloRESTConsumerService.class); ArticoloRESTConsumerService articoloRESTConsumer = restBuilder.getService(ArticoloRESTConsumerService.class);
var response = articoloRESTConsumer var response = articoloRESTConsumer
.getByCodMart(new RetrieveArticoloByCodMartRequestDTO() .getByCodMart(new RetrieveArticoloByCodMartRequestDTO()
@@ -210,25 +209,26 @@ public class ArticoloRESTConsumer extends _BaseRESTConsumer {
} }
public void getUntMisArts(List<String> inputUntMis, RunnableArgs<List<MtbUntMis>> onComplete, RunnableArgs<Exception> onFailed) { public List<MtbUntMis> getUntMisArtsSynchronized(List<String> inputUntMis) throws Exception {
List<HashMap<String, Object>> whereCondList = Stream.of(inputUntMis) List<HashMap<String, Object>> whereCondList = inputUntMis.parallelStream()
.distinct() .distinct()
.withoutNulls() .filter(Objects::nonNull)
.map(x -> { .map(x -> {
HashMap<String, Object> data = new HashMap<>(); HashMap<String, Object> data = new HashMap<>();
data.put("unt_mis", x); data.put("unt_mis", x);
return data; return data;
}) })
.toList(); .collect(Collectors.toUnmodifiableList());
var whereCond = whereCondList.isEmpty() ? "" : " WHERE " + UtilityQuery.concatFieldListInWhereCond(whereCondList); var whereCond = whereCondList.isEmpty() ? "" : " WHERE " + UtilityQuery.concatFieldListInWhereCond(whereCondList);
Type typeOfObjectsList = new TypeToken<ArrayList<MtbUntMis>>() { Type typeOfObjectsList = new TypeToken<ArrayList<MtbUntMis>>() {
}.getType(); }.getType();
this.systemRESTConsumer.processSql("SELECT * FROM mtb_unt_mis " + whereCond, typeOfObjectsList, onComplete, onFailed);
return this.systemRESTConsumer.processSqlSynchronized("SELECT * FROM mtb_unt_mis " + whereCond, typeOfObjectsList);
} }
public void fillMtbAartsWithMtbUntMis(List<MtbAart> inputMtbAart, RunnableArgs<List<MtbAart>> onComplete, RunnableArgs<Exception> onFailed) { public List<MtbAart> fillMtbAartsWithMtbUntMisSynchronized(List<MtbAart> inputMtbAart) throws Exception {
var inputUntMis = new ArrayList<String>(); var inputUntMis = new ArrayList<String>();
if (inputMtbAart != null && !inputMtbAart.isEmpty()) { if (inputMtbAart != null && !inputMtbAart.isEmpty()) {
@@ -240,21 +240,23 @@ public class ArticoloRESTConsumer extends _BaseRESTConsumer {
} }
if (inputUntMis.isEmpty()) { if (inputUntMis.isEmpty()) {
onComplete.run(inputMtbAart); return inputMtbAart;
return;
} }
getUntMisArts(inputUntMis, mtbUntMiss -> { var mtbUntMiss = getUntMisArtsSynchronized(inputUntMis);
for (var item : inputMtbAart) {
var mtbUntMis = Stream.of(mtbUntMiss).filter(x -> x.getUntMis().equalsIgnoreCase(item.getUntMis()))
.findFirstOrElse(null);
if (mtbUntMis != null) for (var item : inputMtbAart) {
item.setMtbUntMis(Collections.singletonList(mtbUntMis)); var mtbUntMis = mtbUntMiss.stream()
} .filter(x -> x.getUntMis().equalsIgnoreCase(item.getUntMis()))
.findFirst()
.orElse(null);
if (mtbUntMis != null)
item.setMtbUntMis(Collections.singletonList(mtbUntMis));
}
return inputMtbAart;
onComplete.run(inputMtbAart);
}, onFailed);
} }

View File

@@ -1,16 +1,9 @@
package it.integry.integrywmsnative.core.rest.consumers; package it.integry.integrywmsnative.core.rest.consumers;
import androidx.annotation.NonNull;
import javax.inject.Singleton; import javax.inject.Singleton;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.model.Azienda; import it.integry.integrywmsnative.core.model.Azienda;
import it.integry.integrywmsnative.core.rest.RESTBuilder; import it.integry.integrywmsnative.core.rest.RESTBuilder;
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import retrofit2.Call;
import retrofit2.Response;
@Singleton @Singleton
public class AziendaRESTConsumer extends _BaseRESTConsumer { public class AziendaRESTConsumer extends _BaseRESTConsumer {
@@ -21,19 +14,12 @@ public class AziendaRESTConsumer extends _BaseRESTConsumer {
this.restBuilder = restBuilder; this.restBuilder = restBuilder;
} }
public void retrieveAzienda(RunnableArgs<Azienda> onComplete, RunnableArgs<Exception> onFailed) { public Azienda retrieveAziendaSynchronized() throws Exception {
AziendaRESTConsumerService aziendaRESTConsumerService = restBuilder.getService(AziendaRESTConsumerService.class); AziendaRESTConsumerService aziendaRESTConsumerService = restBuilder.getService(AziendaRESTConsumerService.class);
aziendaRESTConsumerService.retrieveDefaultAzienda().enqueue(new ManagedErrorCallback<>() { var response = aziendaRESTConsumerService.retrieveDefaultAzienda()
@Override .execute();
public void onResponse(Call<ServiceRESTResponse<Azienda>> call, Response<ServiceRESTResponse<Azienda>> response) {
analyzeAnswer(response, "Retrieve default azienda", onComplete, onFailed);
}
@Override return analyzeAnswer(response, "Retrieve default azienda");
public void onFailure(Call<ServiceRESTResponse<Azienda>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
} }
} }

View File

@@ -3,6 +3,7 @@ package it.integry.integrywmsnative.core.rest.consumers;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.concurrent.ExecutorService;
import javax.inject.Singleton; import javax.inject.Singleton;
@@ -27,10 +28,8 @@ import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSResponseDTO; import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSResponseDTO;
import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSFromArtRequestDTO; import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSFromArtRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSRequestDTO; import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSResponseDTO;
import it.integry.integrywmsnative.core.rest.model.uds.DeleteUDSRowRequestDTO; import it.integry.integrywmsnative.core.rest.model.uds.DeleteUDSRowRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.EditUDSRowRequestDTO; import it.integry.integrywmsnative.core.rest.model.uds.EditUDSRowRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.EditUDSRowResponseDTO;
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDCRowRequestDTO; import it.integry.integrywmsnative.core.rest.model.uds.InsertUDCRowRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDCRowResponseDTO; import it.integry.integrywmsnative.core.rest.model.uds.InsertUDCRowResponseDTO;
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowRequestDTO; import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowRequestDTO;
@@ -44,10 +43,12 @@ public class ColliLavorazioneRESTConsumer extends _BaseRESTConsumer implements C
private final RESTBuilder restBuilder; private final RESTBuilder restBuilder;
private final ExecutorService executorService;
private final SettingsManager settingsManager; private final SettingsManager settingsManager;
public ColliLavorazioneRESTConsumer(RESTBuilder restBuilder, SettingsManager settingsManager) { public ColliLavorazioneRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService, SettingsManager settingsManager) {
this.restBuilder = restBuilder; this.restBuilder = restBuilder;
this.executorService = executorService;
this.settingsManager = settingsManager; this.settingsManager = settingsManager;
} }
@@ -123,93 +124,111 @@ public class ColliLavorazioneRESTConsumer extends _BaseRESTConsumer implements C
}); });
} }
public void createUDS(CreateUDSRequestDTO createUDSRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) { public MtbColt createUDSSynchronized(CreateUDSRequestDTO createUDSRequestDTO) throws Exception {
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class); ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
colliLavorazioneRESTConsumerService.createUDS(createUDSRequestDTO) var response = colliLavorazioneRESTConsumerService.createUDS(createUDSRequestDTO)
.enqueue(new ManagedErrorCallback<>() { .execute();
@Override
public void onResponse(Call<ServiceRESTResponse<CreateUDSResponseDTO>> call, Response<ServiceRESTResponse<CreateUDSResponseDTO>> response) {
analyzeAnswer(response, "lavorazione/createUDS", data -> onComplete.run(data.getMtbColt()), onFailed);
}
@Override var data = analyzeAnswer(response, "lavorazione/createUDS");
public void onFailure(Call<ServiceRESTResponse<CreateUDSResponseDTO>> call, @NonNull final Exception e) { return data.getMtbColt();
onFailed.run(e); }
}
});
public void createUDS(CreateUDSRequestDTO createUDSRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
executorService.execute(() -> {
try {
var response = createUDSSynchronized(createUDSRequestDTO);
if (onComplete != null) onComplete.run(response);
} catch (Exception ex) {
if (onFailed != null) onFailed.run(ex);
}
});
}
public CloseUDSResponseDTO closeUDSSynchronized(CloseUDSRequestDTO closeUDSRequestDTO) throws Exception {
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
var response = colliLavorazioneRESTConsumerService.closeUDS(closeUDSRequestDTO)
.execute();
var data = analyzeAnswer(response, "lavorazione/closeUDS");
return data;
}
public void closeUDS(CloseUDSRequestDTO closeUDSRequestDTO, RunnableArgs<CloseUDSResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
executorService.execute(() -> {
try {
var response = closeUDSSynchronized(closeUDSRequestDTO);
if (onComplete != null) onComplete.run(response);
} catch (Exception ex) {
if (onFailed != null) onFailed.run(ex);
}
});
} }
@Override @Override
public void closeUDS(CloseUDSRequestDTO closeUDSRequestDTO, RunnableArgs<CloseUDSResponseDTO> onComplete, RunnableArgs<Exception> onFailed) { public MtbColr insertUDSRowSynchronized(InsertUDSRowRequestDTO insertUDSRowRequestDTO) throws Exception {
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class); ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
colliLavorazioneRESTConsumerService.closeUDS(closeUDSRequestDTO) Response<ServiceRESTResponse<InsertUDSRowResponseDTO>> response = colliLavorazioneRESTConsumerService.insertUDSRow(insertUDSRowRequestDTO)
.enqueue(new ManagedErrorCallback<>() { .execute();
@Override
public void onResponse(Call<ServiceRESTResponse<CloseUDSResponseDTO>> call, Response<ServiceRESTResponse<CloseUDSResponseDTO>> response) {
analyzeAnswer(response, "lavorazione/closeUDS", onComplete, onFailed);
}
@Override var data = analyzeAnswer(response, "lavorazione/insertUDSRow");
public void onFailure(Call<ServiceRESTResponse<CloseUDSResponseDTO>> call, @NonNull final Exception e) { return data.getSavedMtbColr();
onFailed.run(e);
}
});
} }
@Override @Override
public void insertUDSRow(InsertUDSRowRequestDTO insertUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) { public void insertUDSRow(InsertUDSRowRequestDTO insertUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
executorService.execute(() -> {
try {
var response = insertUDSRowSynchronized(insertUDSRowRequestDTO);
if (onComplete != null) onComplete.run(response);
} catch (Exception ex) {
if (onFailed != null) onFailed.run(ex);
}
});
}
public MtbColr editUDSRowSynchronized(EditUDSRowRequestDTO editUDSRowRequestDTO) throws Exception {
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class); ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
colliLavorazioneRESTConsumerService.insertUDSRow(insertUDSRowRequestDTO) var response = colliLavorazioneRESTConsumerService.editUDSRow(editUDSRowRequestDTO)
.enqueue(new ManagedErrorCallback<>() { .execute();
@Override
public void onResponse(Call<ServiceRESTResponse<InsertUDSRowResponseDTO>> call, Response<ServiceRESTResponse<InsertUDSRowResponseDTO>> response) {
analyzeAnswer(response, "lavorazione/insertUDSRow", data -> onComplete.run(data.getSavedMtbColr()), onFailed);
}
@Override var data = analyzeAnswer(response, "lavorazione/editUDSRow");
public void onFailure(Call<ServiceRESTResponse<InsertUDSRowResponseDTO>> call, @NonNull final Exception e) { return data.getSavedMtbColr();
onFailed.run(e);
}
});
} }
public void editUDSRow(EditUDSRowRequestDTO editUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) { public void editUDSRow(EditUDSRowRequestDTO editUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class); executorService.execute(() -> {
try {
colliLavorazioneRESTConsumerService.editUDSRow(editUDSRowRequestDTO) var response = editUDSRowSynchronized(editUDSRowRequestDTO);
.enqueue(new ManagedErrorCallback<>() { if (onComplete != null) onComplete.run(response);
@Override } catch (Exception ex) {
public void onResponse(Call<ServiceRESTResponse<EditUDSRowResponseDTO>> call, Response<ServiceRESTResponse<EditUDSRowResponseDTO>> response) { if (onFailed != null) onFailed.run(ex);
analyzeAnswer(response, "lavorazione/editUDSRow", data -> onComplete.run(data.getSavedMtbColr()), onFailed); }
} });
@Override
public void onFailure(Call<ServiceRESTResponse<EditUDSRowResponseDTO>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
} }
@Override public void deleteUDSRowSynchronized(DeleteUDSRowRequestDTO deleteUDSRowRequestDTO) throws Exception {
public void deleteUDSRow(DeleteUDSRowRequestDTO deleteUDSRowRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class); ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
colliLavorazioneRESTConsumerService.deleteUDSRow(deleteUDSRowRequestDTO) var response = colliLavorazioneRESTConsumerService.deleteUDSRow(deleteUDSRowRequestDTO)
.enqueue(new ManagedErrorCallback<>() { .execute();
@Override
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
analyzeAnswer(response, "lavorazione/deleteUDSRow", data -> onComplete.run(), onFailed);
}
@Override analyzeAnswer(response, "lavorazione/deleteUDSRow");
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) { }
onFailed.run(e);
} public void deleteUDSRow(DeleteUDSRowRequestDTO deleteUDSRowRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
}); executorService.execute(() -> {
try {
deleteUDSRowSynchronized(deleteUDSRowRequestDTO);
if (onComplete != null) onComplete.run();
} catch (Exception ex) {
if (onFailed != null) onFailed.run(ex);
}
});
} }
@Override @Override

View File

@@ -11,12 +11,14 @@ import org.jetbrains.annotations.NotNull;
import java.lang.reflect.Type; import java.lang.reflect.Type;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.concurrent.ExecutorService;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import javax.inject.Singleton; import javax.inject.Singleton;
@@ -36,8 +38,8 @@ import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
import it.integry.integrywmsnative.core.rest.model.RettificaULDTO; import it.integry.integrywmsnative.core.rest.model.RettificaULDTO;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse; import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import it.integry.integrywmsnative.core.rest.model.SpostaArtsTraULRequestDTO; import it.integry.integrywmsnative.core.rest.model.SpostaArtsTraULRequestDTO;
import it.integry.integrywmsnative.core.rest.model.SpostaArtsTraULResponseDTO;
import it.integry.integrywmsnative.core.rest.model.SpostaULRequestDTO; import it.integry.integrywmsnative.core.rest.model.SpostaULRequestDTO;
import it.integry.integrywmsnative.core.rest.model.UpdatePosizioneULRequestDTO;
import it.integry.integrywmsnative.core.rest.model.UpdateTipoULRequestDTO; import it.integry.integrywmsnative.core.rest.model.UpdateTipoULRequestDTO;
import it.integry.integrywmsnative.core.rest.model.VersamentoAutomaticoULResponseDTO; import it.integry.integrywmsnative.core.rest.model.VersamentoAutomaticoULResponseDTO;
import it.integry.integrywmsnative.core.rest.model.uds.CanULBeDeletedRequestDTO; import it.integry.integrywmsnative.core.rest.model.uds.CanULBeDeletedRequestDTO;
@@ -60,8 +62,9 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
private final ArticoloRESTConsumer mArticoloRESTConsumer; private final ArticoloRESTConsumer mArticoloRESTConsumer;
private final EntityRESTConsumer mEntityRESTConsumer; private final EntityRESTConsumer mEntityRESTConsumer;
private final SettingsManager mSettingsManager; private final SettingsManager mSettingsManager;
private final ExecutorService executorService;
public ColliMagazzinoRESTConsumer(RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer, public ColliMagazzinoRESTConsumer(ExecutorService executorService, RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer,
ArticoloRESTConsumer articoloRESTConsumer, ArticoloRESTConsumer articoloRESTConsumer,
EntityRESTConsumer entityRESTConsumer, EntityRESTConsumer entityRESTConsumer,
SettingsManager settingsManager) { SettingsManager settingsManager) {
@@ -70,38 +73,36 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
this.mArticoloRESTConsumer = articoloRESTConsumer; this.mArticoloRESTConsumer = articoloRESTConsumer;
this.mEntityRESTConsumer = entityRESTConsumer; this.mEntityRESTConsumer = entityRESTConsumer;
this.mSettingsManager = settingsManager; this.mSettingsManager = settingsManager;
this.executorService = executorService;
} }
public void saveCollo(MtbColt mtbColtToSave, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) { public MtbColt saveColloSynchronized(MtbColt mtbColtToSave) throws Exception {
MtbColt mtbColtToSaveClone = (MtbColt) mtbColtToSave.clone(); MtbColt mtbColtToSaveClone = (MtbColt) mtbColtToSave.clone();
mtbColtToSaveClone.setOperation(CommonModelConsts.OPERATION.INSERT_OR_UPDATE); mtbColtToSaveClone.setOperation(CommonModelConsts.OPERATION.INSERT_OR_UPDATE);
mtbColtToSaveClone.setOnlyPkMaster(false); mtbColtToSaveClone.setOnlyPkMaster(false);
mtbColtToSaveClone.setMtbColr(new ObservableArrayList<>());
for (int i = 0; i < mtbColtToSave.getMtbColr().size(); i++) { for (int i = 0; i < mtbColtToSave.getMtbColr().size(); i++) {
mtbColtToSaveClone.getMtbColr().add( mtbColtToSaveClone.getMtbColr().get(i)
((MtbColr) mtbColtToSave.getMtbColr().get(i).clone()) .setMtbAart(null)
.setMtbAart(null) .setMtbPartitaMag(null);
.setMtbPartitaMag(null));
} }
this.mEntityRESTConsumer.processEntity(mtbColtToSaveClone, new ISimpleOperationCallback<>() { return this.mEntityRESTConsumer.processEntitySynchronized(mtbColtToSaveClone, MtbColt.class);
@Override }
public void onSuccess(MtbColt value) {
if (onComplete != null) onComplete.run(value);
}
@Override public void saveCollo(MtbColt mtbColtToSave, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
public void onFailed(Exception ex) { executorService.execute(() -> {
try {
var mtbColt = saveColloSynchronized(mtbColtToSave);
if (onComplete != null) onComplete.run(mtbColt);
} catch (Exception ex) {
if (onFailed != null) onFailed.run(ex); if (onFailed != null) onFailed.run(ex);
} }
}, MtbColt.class); });
} }
public void saveColli(List<MtbColt> mtbColtsToSave, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) { public List<MtbColt> saveColliSynchronized(List<MtbColt> mtbColtsToSave) throws Exception {
for (MtbColt mtbColt : mtbColtsToSave) { for (MtbColt mtbColt : mtbColtsToSave) {
for (int i = 0; i < mtbColt.getMtbColr().size(); i++) { for (int i = 0; i < mtbColt.getMtbColr().size(); i++) {
@@ -111,28 +112,22 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
} }
} }
this.mEntityRESTConsumer.processEntityList(mtbColtsToSave, true, MtbColt.class, onComplete, onFailed); return this.mEntityRESTConsumer.processEntityListSynchronized(mtbColtsToSave, true, MtbColt.class);
}
public void createColloLavorazione(int segno, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
MtbColt mtbColtToCreate = new MtbColt()
.setSegno(segno);
mtbColtToCreate.initDefaultFields(GestioneEnum.LAVORAZIONE);
mtbColtToCreate
.setOperation(CommonModelConsts.OPERATION.INSERT);
saveCollo(mtbColtToCreate, value -> {
if (onComplete != null) onComplete.run(value);
}, ex -> {
if (onFailed != null) onFailed.run(ex);
});
} }
public void createColloScaricoDaCarico(MtbColt sourceMtbColt, MtbDepoPosizione posizione, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) { public void createColloScaricoDaCarico(MtbColt sourceMtbColt, MtbDepoPosizione posizione, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
executorService.execute(() -> {
try {
var mtbColt = createColloScaricoDaCaricoSynchronized(sourceMtbColt, posizione);
if (onComplete != null) onComplete.run(mtbColt);
} catch (Exception ex) {
if (onFailed != null) onFailed.run(ex);
}
});
}
public MtbColt createColloScaricoDaCaricoSynchronized(MtbColt sourceMtbColt, MtbDepoPosizione posizione) throws Exception {
MtbColt newMtbColt = new MtbColt() MtbColt newMtbColt = new MtbColt()
.initDefaultFields(GestioneEnum.LAVORAZIONE) .initDefaultFields(GestioneEnum.LAVORAZIONE)
@@ -166,11 +161,11 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
mtbColrClone mtbColrClone
.setNumCollo(null) .setNumCollo(null)
.setDataCollo((String) null) .setDataCollo((LocalDate) null)
.setRiga(null) .setRiga(null)
.setGestione(GestioneEnum.LAVORAZIONE) .setGestione(GestioneEnum.LAVORAZIONE)
.setDataColloRif(sourceMtbColt.getDataColloD()) .setDataColloRif(sourceMtbColt.getDataColloLD())
.setNumColloRif(sourceMtbColt.getNumCollo()) .setNumColloRif(sourceMtbColt.getNumCollo())
.setGestioneRif(sourceMtbColt.getGestione()) .setGestioneRif(sourceMtbColt.getGestione())
.setSerColloRif(sourceMtbColt.getSerCollo()) .setSerColloRif(sourceMtbColt.getSerCollo())
@@ -181,7 +176,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
} }
saveCollo(newMtbColt, onComplete, onFailed); return saveColloSynchronized(newMtbColt);
} }
@@ -212,7 +207,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
} }
// if (sourceMtbColt.getMtbColr().size() != 1) { // if (sourceMtbColt.getMtbColr().getValue().size() != 1) {
// onFailed.run(new Exception()); // onFailed.run(new Exception());
// return; // return;
// } // }
@@ -220,10 +215,10 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
MtbColr mtbColrClone = new MtbColr(); MtbColr mtbColrClone = new MtbColr();
mtbColrClone mtbColrClone
.setNumCollo(null) .setNumCollo(null)
.setDataCollo((String) null) .setDataCollo((LocalDate) null)
.setRiga(null) .setRiga(null)
.setGestione(GestioneEnum.LAVORAZIONE) .setGestione(GestioneEnum.LAVORAZIONE)
.setDataColloRif(sourceMtbColt.getDataColloD()) .setDataColloRif(sourceMtbColt.getDataColloLD())
.setNumColloRif(sourceMtbColt.getNumCollo()) .setNumColloRif(sourceMtbColt.getNumCollo())
.setGestioneRif(sourceMtbColt.getGestione()) .setGestioneRif(sourceMtbColt.getGestione())
.setSerColloRif(sourceMtbColt.getSerCollo()) .setSerColloRif(sourceMtbColt.getSerCollo())
@@ -288,32 +283,34 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
saveCollo(mtbColtToCreate, onComplete, onFailed); saveCollo(mtbColtToCreate, onComplete, onFailed);
} }
public void getBySSCC(String ssccString, boolean onlyResiduo, boolean throwExcIfNull, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) { public MtbColt getBySsccSynchronized(String ssccString, boolean onlyResiduo, boolean throwExcIfNull) throws Exception {
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class); ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
colliMagazzinoRESTConsumerService.getColloByBarcode(ssccString, onlyResiduo, throwExcIfNull).enqueue(new ManagedErrorCallback<>() { var colloResponse = colliMagazzinoRESTConsumerService.getColloByBarcode(ssccString, onlyResiduo, throwExcIfNull)
@Override .execute();
public void onResponse(Call<ServiceRESTResponse<MtbColt>> call, Response<ServiceRESTResponse<MtbColt>> response) { var mtbColt = analyzeAnswer(colloResponse, "GetBySSCC");
analyzeAnswer(response, "GetBySSCC", mtbColt -> {
if (mtbColt != null && mtbColt.getMtbColr() != null && !mtbColt.getMtbColr().isEmpty()) { if (mtbColt != null && mtbColt.getMtbColr() != null && !mtbColt.getMtbColr().isEmpty()) {
List<MtbColt> mtbColtList = new ArrayList<>(); List<MtbColt> mtbColtList = new ArrayList<>();
mtbColtList.add(mtbColt); mtbColtList.add(mtbColt);
fillMtbAartsOfMtbColts(mtbColtList, mtbColts -> onComplete.run(mtbColts.get(0)), onFailed); var mtbColts = fillMtbAartsOfMtbColtsSynchronized(mtbColtList);
} else { return mtbColts.get(0);
onComplete.run(mtbColt); }
}
}, onFailed); return mtbColt;
} }
@Override public void getBySSCC(String ssccString, boolean onlyResiduo, boolean throwExcIfNull, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
public void onFailure(Call<ServiceRESTResponse<MtbColt>> call, @NonNull final Exception e) { executorService.execute(() -> {
onFailed.run(e); try {
var mtbColt = getBySsccSynchronized(ssccString, onlyResiduo, throwExcIfNull);
if (onComplete != null) onComplete.run(mtbColt);
} catch (Exception ex) {
if (onFailed != null) onFailed.run(ex);
} }
}); });
} }
public void fillMtbAartsOfMtbColrs(List<MtbColr> mtbColrs, RunnableArgs<List<MtbColr>> onComplete, RunnableArgs<Exception> onFailed) { public List<MtbColr> fillMtbAartsOfMtbColrsSynchronized(List<MtbColr> mtbColrs) throws Exception {
List<String> codMarts = new ArrayList<>(mtbColrs.stream() List<String> codMarts = new ArrayList<>(mtbColrs.stream()
.map(MtbColr::getCodMart) .map(MtbColr::getCodMart)
@@ -321,14 +318,48 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
.distinct() .distinct()
.collect(Collectors.toUnmodifiableList())); .collect(Collectors.toUnmodifiableList()));
mArticoloRESTConsumer.getByCodMarts(codMarts, arts -> { var arts = mArticoloRESTConsumer.getByCodMartsSynchronized(codMarts);
if (arts != null && !arts.isEmpty()) {
for (MtbColr mtbColr : mtbColrs) {
if (arts != null && !arts.isEmpty()) {
for (MtbColr mtbColr : mtbColrs) {
MtbAart foundMtbAart = null;
List<MtbAart> mtbAartStream = arts.stream()
.filter(x -> x.getCodMart().equalsIgnoreCase(mtbColr.getCodMart()))
.collect(Collectors.toList());
if (!mtbAartStream.isEmpty()) {
foundMtbAart = mtbAartStream.get(0);
}
mtbColr.setMtbAart(foundMtbAart);
}
}
return mtbColrs;
}
public List<MtbColt> fillMtbAartsOfMtbColtsSynchronized(List<MtbColt> mtbColts) throws Exception {
List<String> codMarts = new ArrayList<>();
for (MtbColt mtbColt : mtbColts) {
codMarts.addAll(mtbColt.getMtbColr().stream()
.map(MtbColr::getCodMart)
.filter(x -> !UtilityString.isNullOrEmpty(x))
.distinct()
.collect(Collectors.toList()));
}
List<MtbAart> mtbAarts = mArticoloRESTConsumer.getByCodMartsSynchronized(codMarts);
for (MtbColt mtbColt : mtbColts) {
for (MtbColr mtbColr : mtbColt.getMtbColr()) {
if (mtbAarts != null && !mtbAarts.isEmpty()) {
MtbAart foundMtbAart = null; MtbAart foundMtbAart = null;
List<MtbAart> mtbAartStream = arts.stream() List<MtbAart> mtbAartStream = mtbAarts.parallelStream()
.filter(x -> x.getCodMart().equalsIgnoreCase(mtbColr.getCodMart())) .filter(x -> x.getCodMart().equalsIgnoreCase(mtbColr.getCodMart()))
.collect(Collectors.toList()); .collect(Collectors.toList());
@@ -338,52 +369,26 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
mtbColr.setMtbAart(foundMtbAart); mtbColr.setMtbAart(foundMtbAart);
} }
mtbColr.setGestione(mtbColt.getGestione());
mtbColr.setSerCollo(mtbColt.getSerCollo());
mtbColr.setNumCollo(mtbColt.getNumCollo());
mtbColr.setDataCollo(mtbColt.getDataColloLD());
} }
}
onComplete.run(mtbColrs); return mtbColts;
}, onFailed);
} }
public void fillMtbAartsOfMtbColts(List<MtbColt> mtbColts, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) { public void fillMtbAartsOfMtbColts(List<MtbColt> mtbColts, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
List<String> codMarts = new ArrayList<>(); executorService.execute(() -> {
try {
for (MtbColt mtbColt : mtbColts) { List<MtbColt> returnedMtbColts = fillMtbAartsOfMtbColtsSynchronized(mtbColts);
codMarts.addAll(mtbColt.getMtbColr().stream() if (onComplete != null) onComplete.run(returnedMtbColts);
.map(MtbColr::getCodMart) } catch (Exception ex) {
.filter(Objects::nonNull) if (onFailed != null) onFailed.run(ex);
.distinct()
.collect(Collectors.toUnmodifiableList()));
}
mArticoloRESTConsumer.getByCodMarts(codMarts, arts -> {
if (arts != null && !arts.isEmpty()) {
for (MtbColt mtbColt : mtbColts) {
for (MtbColr mtbColr : mtbColt.getMtbColr()) {
MtbAart foundMtbAart = null;
List<MtbAart> mtbAartStream = arts.stream()
.filter(x -> x.getCodMart().equalsIgnoreCase(mtbColr.getCodMart()))
.collect(Collectors.toList());
if (!mtbAartStream.isEmpty()) {
foundMtbAart = mtbAartStream.get(0);
}
mtbColr.setMtbAart(foundMtbAart);
mtbColr.setGestione(mtbColt.getGestione());
mtbColr.setSerCollo(mtbColt.getSerCollo());
mtbColr.setNumCollo(mtbColt.getNumCollo());
mtbColr.setDataCollo(mtbColt.getDataColloS());
}
}
} }
});
onComplete.run(mtbColts);
}, onFailed);
} }
public void getMultipleByTestate(List<MtbColt> testate, boolean onlyResiduo, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) { public void getMultipleByTestate(List<MtbColt> testate, boolean onlyResiduo, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
@@ -404,7 +409,17 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
} }
} }
public void getByChiaveCollo(GestioneEnum gestione, int numCollo, String dataCollo, String serCollo, boolean onlyResiduo, boolean throwExcIfNull, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) { public MtbColt getByChiaveColloSynchronized(GestioneEnum gestione, int numCollo, LocalDate dataCollo, String serCollo, boolean onlyResiduo, boolean throwExcIfNull) throws Exception {
MtbColt mtbColtToRetrieve = new MtbColt()
.setGestione(gestione)
.setNumCollo(numCollo)
.setDataCollo(dataCollo)
.setSerCollo(serCollo);
return getByTestataSynchronized(mtbColtToRetrieve, onlyResiduo, throwExcIfNull);
}
public void getByChiaveCollo(GestioneEnum gestione, int numCollo, LocalDate dataCollo, String serCollo, boolean onlyResiduo, boolean throwExcIfNull, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
MtbColt mtbColtToRetrieve = new MtbColt() MtbColt mtbColtToRetrieve = new MtbColt()
.setGestione(gestione) .setGestione(gestione)
.setNumCollo(numCollo) .setNumCollo(numCollo)
@@ -414,36 +429,34 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
getByTestata(mtbColtToRetrieve, onlyResiduo, throwExcIfNull, onComplete, onFailed); getByTestata(mtbColtToRetrieve, onlyResiduo, throwExcIfNull, onComplete, onFailed);
} }
public void getByTestata(MtbColt testata, boolean onlyResiduo, boolean throwExcIfNull, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) { public MtbColt getByTestataSynchronized(MtbColt testata, boolean onlyResiduo, boolean throwExcIfNull) throws Exception {
testata.setMtbColr(new ObservableArrayList<>()); testata.setMtbColr(new ObservableArrayList<>());
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class); ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
colliMagazzinoRESTConsumerService.getColloInGiac(onlyResiduo, throwExcIfNull, testata) var response = colliMagazzinoRESTConsumerService.getColloInGiac(onlyResiduo, throwExcIfNull, testata)
.enqueue(new ManagedErrorCallback<>() { .execute();
@Override var mtbColt = analyzeAnswer(response, "getColloInGiac");
public void onResponse(Call<ServiceRESTResponse<MtbColt>> call, Response<ServiceRESTResponse<MtbColt>> response) { if (mtbColt != null && mtbColt.getMtbColr() != null && !mtbColt.getMtbColr().isEmpty()) {
analyzeAnswer(response, "getColloInGiac", mtbColt -> { var mtbColts = fillMtbAartsOfMtbColtsSynchronized(Collections.singletonList(mtbColt));
return mtbColts.get(0);
}
if (mtbColt != null && mtbColt.getMtbColr() != null && !mtbColt.getMtbColr().isEmpty()) { return mtbColt;
List<MtbColt> mtbColtList = new ArrayList<>();
mtbColtList.add(mtbColt);
fillMtbAartsOfMtbColts(mtbColtList, mtbColts -> onComplete.run(mtbColts.get(0)), onFailed);
} else {
onComplete.run(mtbColt);
}
}, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<MtbColt>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
} }
public void spostaUL(MtbColt mtbColtToMove, String codMdep, String posizione, boolean createDocAutomatically, Runnable onComplete, RunnableArgs<Exception> onFailed) { public void getByTestata(MtbColt testata, boolean onlyResiduo, boolean throwExcIfNull, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
executorService.execute(() -> {
try {
var data = getByTestataSynchronized(testata, onlyResiduo, throwExcIfNull);
if (onComplete != null) onComplete.run(data);
} catch (Exception ex) {
if (onFailed != null) onFailed.run(ex);
}
});
}
public void spostaUlSynchronized(MtbColt mtbColtToMove, String codMdep, String posizione, boolean createDocAutomatically) throws Exception {
MtbColt mtbColtToMoveClone = (MtbColt) mtbColtToMove.clone(); MtbColt mtbColtToMoveClone = (MtbColt) mtbColtToMove.clone();
for (int i = 0; i < mtbColtToMoveClone.getMtbColr().size(); i++) { for (int i = 0; i < mtbColtToMoveClone.getMtbColr().size(); i++) {
@@ -459,21 +472,23 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
.setCreateDocAutomatically(createDocAutomatically); .setCreateDocAutomatically(createDocAutomatically);
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class); ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
colliMagazzinoRESTConsumerService Response<ServiceRESTResponse<Void>> response = colliMagazzinoRESTConsumerService
.spostaUL(spostaUlRequestDTO) .spostaUL(spostaUlRequestDTO)
.enqueue(new ManagedErrorCallback<>() { .execute();
@Override
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
analyzeAnswer(response, "spostaUL", mtbColts -> {
onComplete.run();
}, onFailed);
}
@Override analyzeAnswer(response, "spostaUL");
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) { }
if (onFailed != null) onFailed.run(e);
}
}); public void spostaUL(MtbColt mtbColtToMove, String codMdep, String posizione, boolean createDocAutomatically, Runnable onComplete, RunnableArgs<Exception> onFailed) {
executorService.execute(() -> {
try {
spostaUlSynchronized(mtbColtToMove, codMdep, posizione, createDocAutomatically);
if (onComplete != null) onComplete.run();
} catch (Exception ex) {
if (onFailed != null) onFailed.run(ex);
}
});
} }
public void spostaUL(MtbColt mtbColtToMove, MtbDepoPosizione posizione, Runnable onComplete, RunnableArgs<Exception> onFailed) { public void spostaUL(MtbColt mtbColtToMove, MtbDepoPosizione posizione, Runnable onComplete, RunnableArgs<Exception> onFailed) {
@@ -484,7 +499,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
spostaUL(mtbColtToMove, codMdep, posizioneString, true, onComplete, onFailed); spostaUL(mtbColtToMove, codMdep, posizioneString, true, onComplete, onFailed);
} }
public void updateTipoUL(MtbColt mtbColt, String codTcol, Runnable onComplete, RunnableArgs<Exception> onFailed) { public void updateTipoULSynchronized(MtbColt mtbColt, String codTcol) throws Exception {
MtbColt mtbColtClone = (MtbColt) mtbColt.clone(); MtbColt mtbColtClone = (MtbColt) mtbColt.clone();
mtbColtClone.setMtbColr(new ObservableArrayList<>()); mtbColtClone.setMtbColr(new ObservableArrayList<>());
@@ -494,22 +509,52 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
.setCodTcol(codTcol); .setCodTcol(codTcol);
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class); ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
colliMagazzinoRESTConsumerService Response<ServiceRESTResponse<Void>> response = colliMagazzinoRESTConsumerService
.updateTipoUL(updateTipoULRequest) .updateTipoUL(updateTipoULRequest)
.enqueue(new ManagedErrorCallback<>() { .execute();
@Override
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
analyzeAnswer(response, "updateTipoUL", mtbColts -> {
onComplete.run();
}, onFailed);
}
@Override analyzeAnswer(response, "updateTipoUL");
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) { }
if (onFailed != null) onFailed.run(e);
}
});
public void updateTipoUL(MtbColt mtbColt, String codTcol, Runnable onComplete, RunnableArgs<Exception> onFailed) {
executorService.execute(() -> {
try {
updateTipoULSynchronized(mtbColt, codTcol);
if (onComplete != null) onComplete.run();
} catch (Exception ex) {
if (onFailed != null) onFailed.run(ex);
}
});
}
public void updatePosizioneULSynchronized(MtbColt mtbColt, String posizione) throws Exception {
MtbColt mtbColtClone = (MtbColt) mtbColt.clone();
mtbColtClone.setMtbColr(new ObservableArrayList<>());
UpdatePosizioneULRequestDTO updateTipoULRequest = new UpdatePosizioneULRequestDTO()
.setMtbColt(mtbColtClone)
.setPosizione(posizione);
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
Response<ServiceRESTResponse<Void>> response = colliMagazzinoRESTConsumerService
.updatePosizioneUL(updateTipoULRequest)
.execute();
analyzeAnswer(response, "updatePosizioneUL");
}
public void updatePosizioneUL(MtbColt mtbColt, String posizione, Runnable onComplete, RunnableArgs<Exception> onFailed) {
executorService.execute(() -> {
try {
updatePosizioneULSynchronized(mtbColt, posizione);
if (onComplete != null) onComplete.run();
} catch (Exception ex) {
if (onFailed != null) onFailed.run(ex);
}
});
} }
public void updateDataFine(MtbColt mtbColt, Runnable onComplete, RunnableArgs<Exception> onFailed) { public void updateDataFine(MtbColt mtbColt, Runnable onComplete, RunnableArgs<Exception> onFailed) {
@@ -572,44 +617,45 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
}); });
} }
public void spostaArtsTraUL(MtbColt sourceMtbColt, MtbColt destMtbColt, boolean flagForceUseRefs, RunnableArgs<List<MtbColr>> onComplete, RunnableArgs<Exception> onFailed) { public List<MtbColr> spostaArtsTraULSynchronized(MtbColt sourceMtbColt, MtbColt destMtbColt, boolean flagForceUseRefs) throws Exception {
new Thread(() -> { MtbColt mtbColtToMoveClone = (MtbColt) sourceMtbColt.clone();
MtbColt mtbColtToMoveClone = (MtbColt) sourceMtbColt.clone(); MtbColt mtbColtDestClone = (MtbColt) destMtbColt.clone();
MtbColt mtbColtDestClone = (MtbColt) destMtbColt.clone();
for (int i = 0; i < mtbColtToMoveClone.getMtbColr().size(); i++) { for (int i = 0; i < mtbColtToMoveClone.getMtbColr().size(); i++) {
mtbColtToMoveClone.getMtbColr().get(i) mtbColtToMoveClone.getMtbColr().get(i)
.setMtbAart(null) .setMtbAart(null)
.setMtbPartitaMag(null); .setMtbPartitaMag(null);
} }
mtbColtDestClone.setMtbColr(null); mtbColtDestClone.setMtbColr(null);
SpostaArtsTraULRequestDTO spostaArtsTraULRequestDTO = new SpostaArtsTraULRequestDTO() SpostaArtsTraULRequestDTO spostaArtsTraULRequestDTO = new SpostaArtsTraULRequestDTO()
.setSourceMtbColt(mtbColtToMoveClone) .setSourceMtbColt(mtbColtToMoveClone)
.setDestinationMtbColt(mtbColtDestClone) .setDestinationMtbColt(mtbColtDestClone)
.setFlagForceUseRefs(flagForceUseRefs); .setFlagForceUseRefs(flagForceUseRefs);
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class); ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
colliMagazzinoRESTConsumerService.spostaArtsTraUL(spostaArtsTraULRequestDTO).enqueue(new ManagedErrorCallback<>() { var response = colliMagazzinoRESTConsumerService.spostaArtsTraUL(spostaArtsTraULRequestDTO)
@Override .execute();
public void onResponse(Call<ServiceRESTResponse<SpostaArtsTraULResponseDTO>> call, Response<ServiceRESTResponse<SpostaArtsTraULResponseDTO>> response) {
analyzeAnswer(response, "spostaArtsTraUL", data -> {
fillMtbAartsOfMtbColrs(data.getGeneratedMtbColr(), onComplete, onFailed); var data = analyzeAnswer(response, "spostaArtsTraUL");
var mtbColrs = fillMtbAartsOfMtbColrsSynchronized(data.getGeneratedMtbColr());
}, onFailed); return mtbColrs;
}
@Override
public void onFailure(Call<ServiceRESTResponse<SpostaArtsTraULResponseDTO>> call, @NonNull final Exception e) {
if (onFailed != null) onFailed.run(e);
}
});
}).start();
} }
public void assegnaLottoSuColloScarico(MtbColt sourceMtbColt, Runnable onComplete, RunnableArgs<Exception> onFailed) { public void spostaArtsTraUL(MtbColt sourceMtbColt, MtbColt destMtbColt, boolean flagForceUseRefs, RunnableArgs<List<MtbColr>> onComplete, RunnableArgs<Exception> onFailed) {
executorService.execute(() -> {
try {
var result = spostaArtsTraULSynchronized(sourceMtbColt, destMtbColt, flagForceUseRefs);
if (onComplete != null) onComplete.run(result);
} catch (Exception ex) {
if (onFailed != null) onFailed.run(ex);
}
});
}
public MtbColt assegnaLottoSuColloScaricoSynchronized(MtbColt sourceMtbColt) throws Exception {
MtbColt sourceMtbColtClone = (MtbColt) sourceMtbColt.clone(); MtbColt sourceMtbColtClone = (MtbColt) sourceMtbColt.clone();
for (int i = 0; i < sourceMtbColtClone.getMtbColr().size(); i++) { for (int i = 0; i < sourceMtbColtClone.getMtbColr().size(); i++) {
@@ -619,17 +665,20 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
} }
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class); ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
colliMagazzinoRESTConsumerService.assegnaLottoSuColloScarico(sourceMtbColtClone).enqueue(new ManagedErrorCallback<>() { var response = colliMagazzinoRESTConsumerService.assegnaLottoSuColloScarico(sourceMtbColtClone)
@Override .execute();
public void onResponse(Call<ServiceRESTResponse<MtbColt>> call, Response<ServiceRESTResponse<MtbColt>> response) {
analyzeAnswer(response, "assegnaLottoSuColloScarico", data -> {
onComplete.run();
}, onFailed);
}
@Override var data = analyzeAnswer(response, "assegnaLottoSuColloScarico");
public void onFailure(Call<ServiceRESTResponse<MtbColt>> call, @NonNull final Exception e) { return data;
if (onFailed != null) onFailed.run(e); }
public void assegnaLottoSuColloScarico(MtbColt sourceMtbColt, Runnable onComplete, RunnableArgs<Exception> onFailed) {
executorService.execute(() -> {
try {
var result = assegnaLottoSuColloScaricoSynchronized(sourceMtbColt);
if (onComplete != null) onComplete.run();
} catch (Exception ex) {
if (onFailed != null) onFailed.run(ex);
} }
}); });
} }
@@ -735,42 +784,48 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
} }
public void canULBeDeleted(MtbColt mtbColt, RunnableArgs<Boolean> onComplete, RunnableArgs<Exception> onFailed) { public Boolean canULBeDeletedSynchronized(MtbColt mtbColt) throws Exception {
CanULBeDeletedRequestDTO canULBeDeletedRequestDTO = new CanULBeDeletedRequestDTO() CanULBeDeletedRequestDTO canULBeDeletedRequestDTO = new CanULBeDeletedRequestDTO()
.setMtbColt(mtbColt); .setMtbColt(mtbColt);
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class); ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
colliMagazzinoRESTConsumerService.canULBeDeleted(canULBeDeletedRequestDTO) var response = colliMagazzinoRESTConsumerService.canULBeDeleted(canULBeDeletedRequestDTO)
.enqueue(new ManagedErrorCallback<>() { .execute();
@Override
public void onResponse(Call<ServiceRESTResponse<Boolean>> call, Response<ServiceRESTResponse<Boolean>> response) {
analyzeAnswer(response, "generic/canULBeDeleted", onComplete, onFailed);
}
@Override var data = analyzeAnswer(response, "generic/canULBeDeleted");
public void onFailure(Call<ServiceRESTResponse<Boolean>> call, @NonNull final Exception e) { return data;
onFailed.run(e); }
}
});
public void canULBeDeleted(MtbColt mtbColt, RunnableArgs<Boolean> onComplete, RunnableArgs<Exception> onFailed) {
executorService.execute(() -> {
try {
var result = canULBeDeletedSynchronized(mtbColt);
if (onComplete != null) onComplete.run(result);
} catch (Exception ex) {
if (onFailed != null) onFailed.run(ex);
}
});
}
public void deleteULSynchronized(DeleteULRequestDTO deleteULRequestDTO) throws Exception {
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
var response = colliMagazzinoRESTConsumerService.deleteUL(deleteULRequestDTO)
.execute();
analyzeAnswer(response, "generic/deleteUL");
} }
public void deleteUL(DeleteULRequestDTO deleteULRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) { public void deleteUL(DeleteULRequestDTO deleteULRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class); executorService.execute(() -> {
try {
colliMagazzinoRESTConsumerService.deleteUL(deleteULRequestDTO) deleteULSynchronized(deleteULRequestDTO);
.enqueue(new ManagedErrorCallback<>() { if (onComplete != null) onComplete.run();
@Override } catch (Exception ex) {
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) { if (onFailed != null) onFailed.run(ex);
analyzeAnswer(response, "generic/deleteUL", Void -> onComplete.run(), onFailed); }
} });
@Override
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
} }

View File

@@ -9,6 +9,7 @@ import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import it.integry.integrywmsnative.core.rest.model.SpostaArtsTraULRequestDTO; import it.integry.integrywmsnative.core.rest.model.SpostaArtsTraULRequestDTO;
import it.integry.integrywmsnative.core.rest.model.SpostaArtsTraULResponseDTO; import it.integry.integrywmsnative.core.rest.model.SpostaArtsTraULResponseDTO;
import it.integry.integrywmsnative.core.rest.model.SpostaULRequestDTO; import it.integry.integrywmsnative.core.rest.model.SpostaULRequestDTO;
import it.integry.integrywmsnative.core.rest.model.UpdatePosizioneULRequestDTO;
import it.integry.integrywmsnative.core.rest.model.UpdateTipoULRequestDTO; import it.integry.integrywmsnative.core.rest.model.UpdateTipoULRequestDTO;
import it.integry.integrywmsnative.core.rest.model.VersamentoAutomaticoULResponseDTO; import it.integry.integrywmsnative.core.rest.model.VersamentoAutomaticoULResponseDTO;
import it.integry.integrywmsnative.core.rest.model.uds.CanULBeDeletedRequestDTO; import it.integry.integrywmsnative.core.rest.model.uds.CanULBeDeletedRequestDTO;
@@ -37,6 +38,9 @@ public interface ColliMagazzinoRESTConsumerService {
@POST("wms/updateTipoUL") @POST("wms/updateTipoUL")
Call<ServiceRESTResponse<Void>> updateTipoUL(@Body UpdateTipoULRequestDTO requestDto); Call<ServiceRESTResponse<Void>> updateTipoUL(@Body UpdateTipoULRequestDTO requestDto);
@POST("wms/updatePosizioneUL")
Call<ServiceRESTResponse<Void>> updatePosizioneUL(@Body UpdatePosizioneULRequestDTO requestDto);
@POST("wms/spostaUL") @POST("wms/spostaUL")
Call<ServiceRESTResponse<Void>> spostaUL(@Body SpostaULRequestDTO requestDto); Call<ServiceRESTResponse<Void>> spostaUL(@Body SpostaULRequestDTO requestDto);

View File

@@ -1,6 +1,6 @@
package it.integry.integrywmsnative.core.rest.consumers; package it.integry.integrywmsnative.core.rest.consumers;
import androidx.annotation.NonNull; import java.util.concurrent.ExecutorService;
import javax.inject.Singleton; import javax.inject.Singleton;
@@ -9,134 +9,152 @@ import it.integry.integrywmsnative.core.model.MtbColr;
import it.integry.integrywmsnative.core.model.MtbColt; import it.integry.integrywmsnative.core.model.MtbColt;
import it.integry.integrywmsnative.core.rest.RESTBuilder; import it.integry.integrywmsnative.core.rest.RESTBuilder;
import it.integry.integrywmsnative.core.rest.consumers.interfaces.ColliScaricoRESTConsumerInterface; import it.integry.integrywmsnative.core.rest.consumers.interfaces.ColliScaricoRESTConsumerInterface;
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse; import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSRequestDTO; import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSResponseDTO; import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSResponseDTO;
import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSRequestDTO; import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSResponseDTO;
import it.integry.integrywmsnative.core.rest.model.uds.DeleteUDSRowRequestDTO; import it.integry.integrywmsnative.core.rest.model.uds.DeleteUDSRowRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.DuplicateUDSRequestDTO; import it.integry.integrywmsnative.core.rest.model.uds.DuplicateUDSRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.DuplicateUDSResponseDTO; import it.integry.integrywmsnative.core.rest.model.uds.DuplicateUDSResponseDTO;
import it.integry.integrywmsnative.core.rest.model.uds.EditUDSRowRequestDTO; import it.integry.integrywmsnative.core.rest.model.uds.EditUDSRowRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.EditUDSRowResponseDTO;
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowRequestDTO; import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowResponseDTO; import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowResponseDTO;
import retrofit2.Call;
import retrofit2.Response; import retrofit2.Response;
@Singleton @Singleton
public class ColliSpedizioneRESTConsumer extends _BaseRESTConsumer implements ColliScaricoRESTConsumerInterface { public class ColliSpedizioneRESTConsumer extends _BaseRESTConsumer implements ColliScaricoRESTConsumerInterface {
private final RESTBuilder restBuilder; private final RESTBuilder restBuilder;
private final ExecutorService executorService;
public ColliSpedizioneRESTConsumer(RESTBuilder restBuilder) { public ColliSpedizioneRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService) {
this.restBuilder = restBuilder; this.restBuilder = restBuilder;
this.executorService = executorService;
}
public MtbColt createUDSSynchronized(CreateUDSRequestDTO createUDSRequestDTO) throws Exception {
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = restBuilder.getService(ColliSpedizioneRESTConsumerService.class);
var response = colliSpedizioneRESTConsumerService.createUDS(createUDSRequestDTO)
.execute();
var data = analyzeAnswer(response, "spedizione/createUDS");
return data.getMtbColt();
} }
public void createUDS(CreateUDSRequestDTO createUDSRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) { public void createUDS(CreateUDSRequestDTO createUDSRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
executorService.execute(() -> {
try {
var response = createUDSSynchronized(createUDSRequestDTO);
if (onComplete != null) onComplete.run(response);
} catch (Exception ex) {
if (onFailed != null) onFailed.run(ex);
}
});
}
public CloseUDSResponseDTO closeUDSSynchronized(CloseUDSRequestDTO closeUDSRequestDTO) throws Exception {
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = restBuilder.getService(ColliSpedizioneRESTConsumerService.class); ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = restBuilder.getService(ColliSpedizioneRESTConsumerService.class);
colliSpedizioneRESTConsumerService.createUDS(createUDSRequestDTO) var response = colliSpedizioneRESTConsumerService.closeUDS(closeUDSRequestDTO)
.enqueue(new ManagedErrorCallback<>() { .execute();
@Override
public void onResponse(Call<ServiceRESTResponse<CreateUDSResponseDTO>> call, Response<ServiceRESTResponse<CreateUDSResponseDTO>> response) {
analyzeAnswer(response, "spedizione/createUDS", data -> onComplete.run(data.getMtbColt()), onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<CreateUDSResponseDTO>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
var data = analyzeAnswer(response, "spedizione/closeUDS");
return data;
} }
public void closeUDS(CloseUDSRequestDTO closeUDSRequestDTO, RunnableArgs<CloseUDSResponseDTO> onComplete, RunnableArgs<Exception> onFailed) { public void closeUDS(CloseUDSRequestDTO closeUDSRequestDTO, RunnableArgs<CloseUDSResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
executorService.execute(() -> {
try {
var response = closeUDSSynchronized(closeUDSRequestDTO);
if (onComplete != null) onComplete.run(response);
} catch (Exception ex) {
if (onFailed != null) onFailed.run(ex);
}
});
}
public MtbColr insertUDSRowSynchronized(InsertUDSRowRequestDTO insertUDSRowRequestDTO) throws Exception {
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = restBuilder.getService(ColliSpedizioneRESTConsumerService.class); ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = restBuilder.getService(ColliSpedizioneRESTConsumerService.class);
colliSpedizioneRESTConsumerService.closeUDS(closeUDSRequestDTO) Response<ServiceRESTResponse<InsertUDSRowResponseDTO>> response = colliSpedizioneRESTConsumerService.insertUDSRow(insertUDSRowRequestDTO)
.enqueue(new ManagedErrorCallback<>() { .execute();
@Override
public void onResponse(Call<ServiceRESTResponse<CloseUDSResponseDTO>> call, Response<ServiceRESTResponse<CloseUDSResponseDTO>> response) {
analyzeAnswer(response, "spedizione/closeUDS", onComplete, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<CloseUDSResponseDTO>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
var data = analyzeAnswer(response, "spedizione/insertUDSRow");
return data.getSavedMtbColr();
} }
public void insertUDSRow(InsertUDSRowRequestDTO insertUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) { public void insertUDSRow(InsertUDSRowRequestDTO insertUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
executorService.execute(() -> {
try {
var response = insertUDSRowSynchronized(insertUDSRowRequestDTO);
if (onComplete != null) onComplete.run(response);
} catch (Exception ex) {
if (onFailed != null) onFailed.run(ex);
}
});
}
public MtbColr editUDSRowSynchronized(EditUDSRowRequestDTO editUDSRowRequestDTO) throws Exception {
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = restBuilder.getService(ColliSpedizioneRESTConsumerService.class); ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = restBuilder.getService(ColliSpedizioneRESTConsumerService.class);
colliSpedizioneRESTConsumerService.insertUDSRow(insertUDSRowRequestDTO) var response = colliSpedizioneRESTConsumerService.editUDSRow(editUDSRowRequestDTO)
.enqueue(new ManagedErrorCallback<>() { .execute();
@Override
public void onResponse(Call<ServiceRESTResponse<InsertUDSRowResponseDTO>> call, Response<ServiceRESTResponse<InsertUDSRowResponseDTO>> response) {
analyzeAnswer(response, "spedizione/insertUDSRow", data -> onComplete.run(data.getSavedMtbColr()), onFailed);
}
@Override var data = analyzeAnswer(response, "spedizione/editUDSRow");
public void onFailure(Call<ServiceRESTResponse<InsertUDSRowResponseDTO>> call, @NonNull final Exception e) { return data.getSavedMtbColr();
onFailed.run(e);
}
});
} }
public void editUDSRow(EditUDSRowRequestDTO editUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) { public void editUDSRow(EditUDSRowRequestDTO editUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
executorService.execute(() -> {
try {
var response = editUDSRowSynchronized(editUDSRowRequestDTO);
if (onComplete != null) onComplete.run(response);
} catch (Exception ex) {
if (onFailed != null) onFailed.run(ex);
}
});
}
public void deleteUDSRowSynchronized(DeleteUDSRowRequestDTO deleteUDSRowRequestDTO) throws Exception {
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = restBuilder.getService(ColliSpedizioneRESTConsumerService.class); ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = restBuilder.getService(ColliSpedizioneRESTConsumerService.class);
colliSpedizioneRESTConsumerService.editUDSRow(editUDSRowRequestDTO) var response = colliSpedizioneRESTConsumerService.deleteUDSRow(deleteUDSRowRequestDTO)
.enqueue(new ManagedErrorCallback<>() { .execute();
@Override
public void onResponse(Call<ServiceRESTResponse<EditUDSRowResponseDTO>> call, Response<ServiceRESTResponse<EditUDSRowResponseDTO>> response) {
analyzeAnswer(response, "spedizione/editUDSRow", data -> onComplete.run(data.getSavedMtbColr()), onFailed);
}
@Override analyzeAnswer(response, "spedizione/deleteUDSRow");
public void onFailure(Call<ServiceRESTResponse<EditUDSRowResponseDTO>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
} }
public void deleteUDSRow(DeleteUDSRowRequestDTO deleteUDSRowRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) { public void deleteUDSRow(DeleteUDSRowRequestDTO deleteUDSRowRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
executorService.execute(() -> {
try {
deleteUDSRowSynchronized(deleteUDSRowRequestDTO);
if (onComplete != null) onComplete.run();
} catch (Exception ex) {
if (onFailed != null) onFailed.run(ex);
}
});
}
public DuplicateUDSResponseDTO duplicateUDSSynchronized(DuplicateUDSRequestDTO duplicateUDSRequestDTO) throws Exception {
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = restBuilder.getService(ColliSpedizioneRESTConsumerService.class); ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = restBuilder.getService(ColliSpedizioneRESTConsumerService.class);
colliSpedizioneRESTConsumerService.deleteUDSRow(deleteUDSRowRequestDTO) var response = colliSpedizioneRESTConsumerService.duplicateUDS(duplicateUDSRequestDTO)
.enqueue(new ManagedErrorCallback<>() { .execute();
@Override
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
analyzeAnswer(response, "spedizione/deleteUDSRow", data -> onComplete.run(), onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
var data = analyzeAnswer(response, "spedizione/duplicateUDS");
return data;
} }
public void duplicateUDS(DuplicateUDSRequestDTO duplicateUDSRequestDTO, RunnableArgs<DuplicateUDSResponseDTO> onComplete, RunnableArgs<Exception> onFailed) { public void duplicateUDS(DuplicateUDSRequestDTO duplicateUDSRequestDTO, RunnableArgs<DuplicateUDSResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = restBuilder.getService(ColliSpedizioneRESTConsumerService.class); executorService.execute(() -> {
try {
colliSpedizioneRESTConsumerService.duplicateUDS(duplicateUDSRequestDTO) var data = duplicateUDSSynchronized(duplicateUDSRequestDTO);
.enqueue(new ManagedErrorCallback<>() { if (onComplete != null) onComplete.run(data);
@Override } catch (Exception ex) {
public void onResponse(@NonNull Call<ServiceRESTResponse<DuplicateUDSResponseDTO>> call, @NonNull Response<ServiceRESTResponse<DuplicateUDSResponseDTO>> response) { if (onFailed != null) onFailed.run(ex);
analyzeAnswer(response, "spedizione/duplicateUDS", onComplete, onFailed); }
} });
@Override
public void onFailure(@NonNull Call<ServiceRESTResponse<DuplicateUDSResponseDTO>> call, @NonNull final Exception e) {
onFailed.run(new Exception());
}
});
} }
} }

View File

@@ -6,6 +6,7 @@ import java.lang.reflect.Type;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import javax.inject.Singleton; import javax.inject.Singleton;
@@ -18,34 +19,42 @@ import it.integry.integrywmsnative.core.utility.UtilityString;
@Singleton @Singleton
public class CommessaRESTConsumer extends _BaseRESTConsumer { public class CommessaRESTConsumer extends _BaseRESTConsumer {
private final ExecutorService executorService;
private final SystemRESTConsumer systemRESTConsumer; private final SystemRESTConsumer systemRESTConsumer;
public CommessaRESTConsumer(SystemRESTConsumer systemRESTConsumer) { public CommessaRESTConsumer(ExecutorService executorService, SystemRESTConsumer systemRESTConsumer) {
this.executorService = executorService;
this.systemRESTConsumer = systemRESTConsumer; this.systemRESTConsumer = systemRESTConsumer;
} }
public void getJtbComts(List<String> itemsToFind, RunnableArgs<List<JtbComt>> onComplete, RunnableArgs<Exception> onFailed) { public List<JtbComt> getJtbComtsSynchronized(List<String> itemsToFind) throws Exception {
var whereCondMap = itemsToFind.stream() List<HashMap<String, Object>> whereCondMap = itemsToFind.stream()
.filter(x -> !UtilityString.isNullOrEmpty(x)) .filter(x -> !UtilityString.isNullOrEmpty(x))
.map(x -> { .map(x -> new HashMap<String, Object>() {{
HashMap<String, Object> codJcom = new HashMap<>() {{ put("cod_jcom", x);
put("cod_jcom", x); }})
}};
return codJcom;
})
.collect(Collectors.toUnmodifiableList()); .collect(Collectors.toUnmodifiableList());
if(whereCondMap.isEmpty()) { if(whereCondMap.isEmpty()) {
onComplete.run(new ArrayList<>()); return new ArrayList<>();
return;
} }
var whereCond = " WHERE " + UtilityQuery.concatFieldListInWhereCond(whereCondMap); var whereCond = " WHERE " + UtilityQuery.concatFieldListInWhereCond(whereCondMap);
Type typeOfObjectsList = new TypeToken<ArrayList<JtbComt>>() {}.getType(); Type typeOfObjectsList = new TypeToken<ArrayList<JtbComt>>() {}.getType();
this.systemRESTConsumer.processSql("SELECT * FROM jtb_comt " + whereCond, typeOfObjectsList, onComplete, onFailed); return this.systemRESTConsumer.processSqlSynchronized("SELECT * FROM jtb_comt " + whereCond, typeOfObjectsList);
}
public void getJtbComts(List<String> itemsToFind, RunnableArgs<List<JtbComt>> onComplete, RunnableArgs<Exception> onFailed) {
executorService.execute(() -> {
try {
var data = getJtbComtsSynchronized(itemsToFind);
if (onComplete != null) onComplete.run(data);
} catch (Exception ex) {
if (onFailed != null) onFailed.run(ex);
}
});
} }
} }

View File

@@ -5,26 +5,26 @@ import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type; import java.lang.reflect.Type;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.concurrent.ExecutorService;
import javax.inject.Singleton; import javax.inject.Singleton;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.model.MtbDepo; import it.integry.integrywmsnative.core.model.MtbDepo;
@Singleton @Singleton
public class DepositoRESTConsumer extends _BaseRESTConsumer { public class DepositoRESTConsumer extends _BaseRESTConsumer {
private final EntityRESTConsumer entityRESTConsumer; private final ExecutorService executorService;
private final SystemRESTConsumer systemRESTConsumer; private final SystemRESTConsumer systemRESTConsumer;
public DepositoRESTConsumer(EntityRESTConsumer entityRESTConsumer, SystemRESTConsumer systemRESTConsumer) { public DepositoRESTConsumer(ExecutorService executorService, SystemRESTConsumer systemRESTConsumer) {
this.entityRESTConsumer = entityRESTConsumer; this.executorService = executorService;
this.systemRESTConsumer = systemRESTConsumer; this.systemRESTConsumer = systemRESTConsumer;
} }
public void getAll(RunnableArgs<List<MtbDepo>> onComplete, RunnableArgs<Exception> onFailed) { public List<MtbDepo> getAllSynchronized() throws Exception {
Type typeOfObjectsList = new TypeToken<ArrayList<MtbDepo>>() { Type typeOfObjectsList = new TypeToken<ArrayList<MtbDepo>>() {
}.getType(); }.getType();
this.systemRESTConsumer.processSql("SELECT * FROM mtb_depo", typeOfObjectsList, onComplete, onFailed); return this.systemRESTConsumer.processSqlSynchronized("SELECT * FROM mtb_depo", typeOfObjectsList);
} }
} }

View File

@@ -3,6 +3,7 @@ package it.integry.integrywmsnative.core.rest.consumers;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import java.util.List; import java.util.List;
import java.util.concurrent.ExecutorService;
import javax.inject.Singleton; import javax.inject.Singleton;
@@ -20,9 +21,11 @@ import retrofit2.Response;
public class DocumentRESTConsumer extends _BaseRESTConsumer { public class DocumentRESTConsumer extends _BaseRESTConsumer {
private final RESTBuilder restBuilder; private final RESTBuilder restBuilder;
private final ExecutorService executorService;
public DocumentRESTConsumer(RESTBuilder restBuilder) { public DocumentRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService) {
this.restBuilder = restBuilder; this.restBuilder = restBuilder;
this.executorService = executorService;
} }
public void createDocsFromColli(List<LoadColliDTO> listColli, RunnableArgs<List<DtbDoct>> onComplete, RunnableArgs<Exception> onFailed) { public void createDocsFromColli(List<LoadColliDTO> listColli, RunnableArgs<List<DtbDoct>> onComplete, RunnableArgs<Exception> onFailed) {
@@ -40,17 +43,22 @@ public class DocumentRESTConsumer extends _BaseRESTConsumer {
}); });
} }
public void createDocFromColli(LoadColliDTO loadColliDTO, RunnableArgs<DtbDoct> onComplete, RunnableArgs<Exception> onFailed) { public DtbDoct makeSynchronousCreateDocFromColliRequest(LoadColliDTO loadColliDTO) throws Exception {
DocumentiRESTConsumerService documentiRESTConsumerService = restBuilder.getService(DocumentiRESTConsumerService.class); DocumentiRESTConsumerService documentiRESTConsumerService = restBuilder.getService(DocumentiRESTConsumerService.class);
documentiRESTConsumerService.createDocFromColli(loadColliDTO).enqueue(new ManagedErrorCallback<>() { var response = documentiRESTConsumerService
@Override .createDocFromColli(loadColliDTO)
public void onResponse(Call<ServiceRESTResponse<DtbDoct>> call, Response<ServiceRESTResponse<DtbDoct>> response) { .execute();
analyzeAnswer(response, "createDocFromColli", onComplete, onFailed);
}
@Override return analyzeAnswer(response, "createDocFromColli");
public void onFailure(Call<ServiceRESTResponse<DtbDoct>> call, @NonNull final Exception e) { }
onFailed.run(e);
public void makeCreateDocFromColliRequest(LoadColliDTO loadColliDTO, RunnableArgs<DtbDoct> onComplete, RunnableArgs<Exception> onFailed) {
executorService.execute(() -> {
try {
var result = makeSynchronousCreateDocFromColliRequest(loadColliDTO);
if (onComplete != null) onComplete.run(result);
} catch (Exception ex) {
if (onFailed != null) onFailed.run(ex);
} }
}); });
} }

View File

@@ -9,6 +9,7 @@ import com.google.gson.JsonObject;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.concurrent.ExecutorService;
import javax.inject.Singleton; import javax.inject.Singleton;
@@ -26,100 +27,93 @@ import retrofit2.Response;
public class EntityRESTConsumer extends _BaseRESTConsumer { public class EntityRESTConsumer extends _BaseRESTConsumer {
private final RESTBuilder restBuilder; private final RESTBuilder restBuilder;
private final ExecutorService executorService;
public EntityRESTConsumer(RESTBuilder restBuilder) { public EntityRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService) {
this.restBuilder = restBuilder; this.restBuilder = restBuilder;
this.executorService = executorService;
}
public <T extends EntityBase> T processEntitySynchronized(T entityToSave, Class<T> type) throws Exception {
EntityRESTConsumerService service = restBuilder.getService(EntityRESTConsumerService.class);
var response = service
.processEntity(entityToSave)
.execute();
if (response.isSuccessful()) {
if (response.body() != null) {
if (response.body().getEsito() == EsitoType.OK) {
Gson gson = UtilityGson.createObject();
return gson.fromJson(response.body().getEntity(), type);
} else {
Log.e("EntityRESTConsumer", response.body().getErrorMessage());
throw new Exception(response.body().getErrorMessage());
}
} else {
Log.e("EntityRESTConsumer", response.message());
throw new Exception(response.message());
}
} else {
Log.e("EntityRESTConsumer", "Status " + response.code() + ": " + response.message());
throw new Exception("Status " + response.code() + ": " + response.message());
}
} }
public <T extends EntityBase> void processEntity(T entityToSave, final ISimpleOperationCallback<T> callback, Class<T> type) { public <T extends EntityBase> void processEntity(T entityToSave, final ISimpleOperationCallback<T> callback, Class<T> type) {
executorService.execute(() -> {
try {
var data = processEntitySynchronized(entityToSave, type);
if (callback != null) callback.onSuccess(data);
} catch (Exception ex) {
if (callback != null) callback.onFailed(ex);
}
});
RunnableArgs<Exception> tmpFailed = ex -> { }
if (callback != null) callback.onFailed(ex);
};
public <T extends EntityBase> List<T> processEntityListSynchronized(List<T> entitiesToSave, boolean singleTransaction, Class<T> type) throws Exception {
EntityRESTConsumerService service = restBuilder.getService(EntityRESTConsumerService.class); EntityRESTConsumerService service = restBuilder.getService(EntityRESTConsumerService.class);
service var response = service.processEntityList(singleTransaction, entitiesToSave)
.processEntity(entityToSave) .execute();
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<JsonObject>> call, Response<ServiceRESTResponse<JsonObject>> response) {
if (response.isSuccessful()) {
if (response.body() != null) { if (response.isSuccessful()) {
if (response.body().getEsito() == EsitoType.OK) {
Gson gson = UtilityGson.createObject();
T object = gson.fromJson(response.body().getEntity(), type);
callback.onSuccess(object); if (response.body() != null) {
} else {
Log.e("EntityRESTConsumer", response.body().getErrorMessage()); ArrayList<T> responseList = new ArrayList<>();
tmpFailed.run(new Exception(response.body().getErrorMessage())); Gson gson = UtilityGson.createObject();
}
} else { for (ServiceRESTResponse<JsonObject> jsonSingleObject : response.body()) {
Log.e("EntityRESTConsumer", response.message());
tmpFailed.run(new Exception(response.message())); if (jsonSingleObject.getEsito() == EsitoType.OK) {
} String jsonText = gson.toJson(jsonSingleObject.getEntity());
} else { responseList.add(gson.fromJson(jsonText, type));
Log.e("EntityRESTConsumer", "Status " + response.code() + ": " + response.message()); } else {
tmpFailed.run(new Exception("Status " + response.code() + ": " + response.message())); Log.e("EntityRESTConsumer", jsonSingleObject.getErrorMessage());
} throw new Exception(jsonSingleObject.getErrorMessage());
} }
}
@Override return responseList;
public void onFailure(Call<ServiceRESTResponse<JsonObject>> call, @NonNull final Exception e) { } else {
tmpFailed.run(e); Log.e("EntityRESTConsumer", response.message());
} throw new Exception(response.message());
}); }
} else {
Log.e("EntityRESTConsumer", "Status " + response.code() + ": " + response.message());
throw new Exception("Status " + response.code() + ": " + response.message());
}
} }
public <T extends EntityBase> void processEntityList(List<T> entitiesToSave, boolean singleTransaction, Class<T> type, final RunnableArgs<List<T>> onComplete, final RunnableArgs<Exception> onFailed) { public <T extends EntityBase> void processEntityList(List<T> entitiesToSave, boolean singleTransaction, Class<T> type, final RunnableArgs<List<T>> onComplete, final RunnableArgs<Exception> onFailed) {
executorService.execute(() -> {
RunnableArgs<Exception> tmpFailed = ex -> { try {
// UtilityExceptions.defaultException(null, ex); var data = processEntityListSynchronized(entitiesToSave, singleTransaction, type);
if (onFailed != null) onFailed.run(ex); if (onComplete != null) onComplete.run(data);
}; } catch (Exception ex) {
if (onFailed != null) onFailed.run(ex);
EntityRESTConsumerService service = restBuilder.getService(EntityRESTConsumerService.class);
Call<List<ServiceRESTResponse<JsonObject>>> request = service.processEntityList(singleTransaction, entitiesToSave);
request.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<List<ServiceRESTResponse<JsonObject>>> call, Response<List<ServiceRESTResponse<JsonObject>>> response) {
if (response.isSuccessful()) {
if (response.body() != null) {
ArrayList<T> responseList = new ArrayList<>();
Gson gson = UtilityGson.createObject();
// Type typeOfObjectsList = new TypeToken<T>() {}.getType();
for (ServiceRESTResponse<JsonObject> jsonSingleObject : response.body()) {
if (jsonSingleObject.getEsito() == EsitoType.OK) {
String jsonText = gson.toJson(jsonSingleObject.getEntity());
responseList.add(gson.fromJson(jsonText, type));
} else {
Log.e("EntityRESTConsumer", jsonSingleObject.getErrorMessage());
tmpFailed.run(new Exception(jsonSingleObject.getErrorMessage()));
return;
}
}
onComplete.run(responseList);
} else {
Log.e("EntityRESTConsumer", response.message());
tmpFailed.run(new Exception(response.message()));
}
} else {
Log.e("EntityRESTConsumer", "Status " + response.code() + ": " + response.message());
tmpFailed.run(new Exception("Status " + response.code() + ": " + response.message()));
}
}
@Override
public void onFailure(Call<List<ServiceRESTResponse<JsonObject>>> call, @NonNull final Exception e) {
tmpFailed.run(e);
} }
}); });

View File

@@ -79,32 +79,22 @@ public class GestSetupRESTConsumer extends _BaseRESTConsumer {
} }
public void getValues(String codMdep, List<StbGestSetupReader> stbGestSetupList, RunnableArgs<List<StbGestSetupReader>> onComplete, RunnableArgs<Exception> onFailed) { public List<StbGestSetupReader> getValuesSynchronized(String codMdep, List<StbGestSetupReader> stbGestSetupList) throws Exception {
var stbGestSetups = stbGestSetupList.stream().map(x -> (StbGestSetup) x).collect(Collectors.toList()); var stbGestSetups = stbGestSetupList.stream().map(x -> (StbGestSetup) x).collect(Collectors.toList());
GestSetupRESTConsumerService service = restBuilder.getService(GestSetupRESTConsumerService.class); GestSetupRESTConsumerService service = restBuilder.getService(GestSetupRESTConsumerService.class);
service.getGestSetupValues(codMdep, stbGestSetups).enqueue(new ManagedErrorCallback<>() { var response = service.getGestSetupValues(codMdep, stbGestSetups)
@Override .execute();
public void onResponse(Call<ServiceRESTResponse<List<StbGestSetup>>> call, Response<ServiceRESTResponse<List<StbGestSetup>>> response) { var data = analyzeAnswer(response, "GestSetup");
analyzeAnswer(response, "GestSetup", data -> { for (StbGestSetup stbGestSetup : data) {
stbGestSetupList.stream().filter(x -> stbGestSetup.getGestName().equalsIgnoreCase(x.getGestName()) &&
stbGestSetup.getSection().equalsIgnoreCase(x.getSection()) &&
stbGestSetup.getKeySection().equalsIgnoreCase(x.getKeySection()))
.findFirst()
.ifPresent(x -> x.setValue(stbGestSetup.getValue()));
}
for (StbGestSetup stbGestSetup : data) { return stbGestSetupList;
stbGestSetupList.stream().filter(x -> stbGestSetup.getGestName().equalsIgnoreCase(x.getGestName()) &&
stbGestSetup.getSection().equalsIgnoreCase(x.getSection()) &&
stbGestSetup.getKeySection().equalsIgnoreCase(x.getKeySection()))
.findFirst()
.ifPresent(x -> x.setValue(stbGestSetup.getValue()));
}
onComplete.run(stbGestSetupList);
}, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<List<StbGestSetup>>> call, @NonNull final Exception e) {
if (onFailed != null) onFailed.run(e);
}
});
} }

View File

@@ -5,8 +5,11 @@ import java.util.List;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import it.integry.integrywmsnative.core.rest.RESTBuilder; import it.integry.integrywmsnative.core.rest.RESTBuilder;
import it.integry.integrywmsnative.core.rest.model.pv.CloseVerificaRequestDTO;
import it.integry.integrywmsnative.core.rest.model.pv.DeleteRowVerificaRequestDTO;
import it.integry.integrywmsnative.core.rest.model.pv.GiacenzaPvDTO; import it.integry.integrywmsnative.core.rest.model.pv.GiacenzaPvDTO;
import it.integry.integrywmsnative.core.rest.model.pv.SaveNewVerificaRequestDTO; import it.integry.integrywmsnative.core.rest.model.pv.SaveNewRowVerificaRequestDTO;
import it.integry.integrywmsnative.core.rest.model.pv.UpdateRowVerificaRequestDTO;
public class GiacenzaPvRESTConsumer extends _BaseRESTConsumer { public class GiacenzaPvRESTConsumer extends _BaseRESTConsumer {
@@ -30,12 +33,36 @@ public class GiacenzaPvRESTConsumer extends _BaseRESTConsumer {
return giacenzeList != null ? giacenzeList : new ArrayList<>(); return giacenzeList != null ? giacenzeList : new ArrayList<>();
} }
public void saveNewVerificaSynchronized(SaveNewVerificaRequestDTO saveNewVerificaRequest) throws Exception { public void saveNewRowSynchronized(SaveNewRowVerificaRequestDTO saveNewRowVerificaRequest) throws Exception {
GiacenzaPvRESTConsumerService giacenzaPvRESTConsumerService = restBuilder.getService(GiacenzaPvRESTConsumerService.class, 0); GiacenzaPvRESTConsumerService giacenzaPvRESTConsumerService = restBuilder.getService(GiacenzaPvRESTConsumerService.class, 0);
var response = giacenzaPvRESTConsumerService.saveNewVerifica(saveNewVerificaRequest) var response = giacenzaPvRESTConsumerService.saveNewRowVerifica(saveNewRowVerificaRequest)
.execute(); .execute();
analyzeAnswer(response, "save-verifica-pv"); analyzeAnswer(response, "save-row-verifica-pv");
}
public void updateRowSynchronized(UpdateRowVerificaRequestDTO updateRowVerificaRequest) throws Exception {
GiacenzaPvRESTConsumerService giacenzaPvRESTConsumerService = restBuilder.getService(GiacenzaPvRESTConsumerService.class, 0);
var response = giacenzaPvRESTConsumerService.updateRowVerifica(updateRowVerificaRequest)
.execute();
analyzeAnswer(response, "update-row-verifica-pv");
}
public void deleteRowSynchronized(DeleteRowVerificaRequestDTO deleteRowVerificaRequest) throws Exception {
GiacenzaPvRESTConsumerService giacenzaPvRESTConsumerService = restBuilder.getService(GiacenzaPvRESTConsumerService.class, 0);
var response = giacenzaPvRESTConsumerService.deleteRowVerifica(deleteRowVerificaRequest)
.execute();
analyzeAnswer(response, "delete-row-verifica-pv");
}
public void closeVerifica(CloseVerificaRequestDTO closeVerificaRequestDTO) throws Exception {
GiacenzaPvRESTConsumerService giacenzaPvRESTConsumerService = restBuilder.getService(GiacenzaPvRESTConsumerService.class, 0);
var response = giacenzaPvRESTConsumerService.closeVerifica(closeVerificaRequestDTO)
.execute();
analyzeAnswer(response, "close-verifica-pv");
} }
} }

View File

@@ -3,8 +3,11 @@ package it.integry.integrywmsnative.core.rest.consumers;
import java.util.List; import java.util.List;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse; import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import it.integry.integrywmsnative.core.rest.model.pv.CloseVerificaRequestDTO;
import it.integry.integrywmsnative.core.rest.model.pv.DeleteRowVerificaRequestDTO;
import it.integry.integrywmsnative.core.rest.model.pv.GiacenzaPvDTO; import it.integry.integrywmsnative.core.rest.model.pv.GiacenzaPvDTO;
import it.integry.integrywmsnative.core.rest.model.pv.SaveNewVerificaRequestDTO; import it.integry.integrywmsnative.core.rest.model.pv.SaveNewRowVerificaRequestDTO;
import it.integry.integrywmsnative.core.rest.model.pv.UpdateRowVerificaRequestDTO;
import retrofit2.Call; import retrofit2.Call;
import retrofit2.http.Body; import retrofit2.http.Body;
import retrofit2.http.GET; import retrofit2.http.GET;
@@ -13,10 +16,19 @@ import retrofit2.http.Query;
public interface GiacenzaPvRESTConsumerService { public interface GiacenzaPvRESTConsumerService {
@GET("giacenza/retrieve") @GET("wms/pv/verifica_giacenze/retrieve")
Call<ServiceRESTResponse<List<GiacenzaPvDTO>>> retrieve(@Query("codMdep") String codMdep); Call<ServiceRESTResponse<List<GiacenzaPvDTO>>> retrieve(@Query("codMdep") String codMdep);
@POST("wms/pv/verifica_giacenze/save_new_verifica") @POST("wms/pv/verifica_giacenze/save_new_row")
Call<ServiceRESTResponse<Void>> saveNewVerifica(@Body SaveNewVerificaRequestDTO saveNewVerificaRequest); Call<ServiceRESTResponse<Void>> saveNewRowVerifica(@Body SaveNewRowVerificaRequestDTO saveNewRowVerificaRequest);
@POST("wms/pv/verifica_giacenze/update_row")
Call<ServiceRESTResponse<Void>> updateRowVerifica(@Body UpdateRowVerificaRequestDTO updateRowVerificaRequest);
@POST("wms/pv/verifica_giacenze/delete_row")
Call<ServiceRESTResponse<Void>> deleteRowVerifica(@Body DeleteRowVerificaRequestDTO deleteRowVerificaRequest);
@POST("wms/pv/verifica_giacenze/close_verifica")
Call<ServiceRESTResponse<Void>> closeVerifica(@Body CloseVerificaRequestDTO closeVerificaRequest);
} }

View File

@@ -169,27 +169,28 @@ public class GiacenzaRESTConsumer extends _BaseRESTConsumer {
} }
public void getInstantItemSituation(String codMdep, String codMart, String partitaMag, String codJcom, RunnableArgs<InstantItemSituationResponseDto> onComplete, RunnableArgs<Exception> onFailed) { public InstantItemSituationResponseDto getInstantItemSituationSynchronized(String codMdep, String codMart, String partitaMag, String codJcom) throws Exception {
GiacenzaRESTConsumerService giacenzaRESTConsumerService = restBuilder.getService(GiacenzaRESTConsumerService.class); GiacenzaRESTConsumerService giacenzaRESTConsumerService = restBuilder.getService(GiacenzaRESTConsumerService.class);
giacenzaRESTConsumerService.retrieveInstantItemSituation(codMdep, codMart, partitaMag, codJcom) var response = giacenzaRESTConsumerService.retrieveInstantItemSituation(codMdep, codMart, partitaMag, codJcom)
.enqueue(new ManagedErrorCallback<>() { .execute();
@Override
public void onResponse(Call<ServiceRESTResponse<InstantItemSituationResponseDto>> call, Response<ServiceRESTResponse<InstantItemSituationResponseDto>> response) {
analyzeAnswer(response, "getInstantItemSituation", data -> {
fillInstantItemSituationWithMtbAarts(data, onComplete, onFailed); var data = analyzeAnswer(response, "getInstantItemSituation");
}, onFailed); return fillInstantItemSituationWithMtbAartsSynchronized(data);
}
@Override
public void onFailure(Call<ServiceRESTResponse<InstantItemSituationResponseDto>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
} }
private void fillInstantItemSituationWithMtbAarts(InstantItemSituationResponseDto data, RunnableArgs<InstantItemSituationResponseDto> onComplete, RunnableArgs<Exception> onFailed) { public void getInstantItemSituation(String codMdep, String codMart, String partitaMag, String codJcom, RunnableArgs<InstantItemSituationResponseDto> onComplete, RunnableArgs<Exception> onFailed) {
executorService.execute(() -> {
try {
var response = getInstantItemSituationSynchronized(codMdep, codMart, partitaMag, codJcom);
if (onComplete != null) onComplete.run(response);
} catch (Exception ex) {
if (onFailed != null) onFailed.run(ex);
}
});
}
private InstantItemSituationResponseDto fillInstantItemSituationWithMtbAartsSynchronized(InstantItemSituationResponseDto data) throws Exception {
var inputCodMarts = new ArrayList<String>(); var inputCodMarts = new ArrayList<String>();
if (data.getIncomingItems() != null && !data.getIncomingItems().isEmpty()) { if (data.getIncomingItems() != null && !data.getIncomingItems().isEmpty()) {
@@ -205,37 +206,33 @@ public class GiacenzaRESTConsumer extends _BaseRESTConsumer {
} }
if (inputCodMarts.isEmpty()) { if (inputCodMarts.isEmpty()) {
onComplete.run(data); return null;
return;
} }
mArticoloRESTConsumer.getByCodMarts(inputCodMarts, mtbAarts -> { var mtbAarts = mArticoloRESTConsumer.getByCodMartsSynchronized(inputCodMarts);
var newMtbAarts = mArticoloRESTConsumer.fillMtbAartsWithMtbUntMisSynchronized(mtbAarts);
mArticoloRESTConsumer.fillMtbAartsWithMtbUntMis(mtbAarts, newMtbAarts -> { if (data.getIncomingItems() != null && !data.getIncomingItems().isEmpty()) {
if (data.getIncomingItems() != null && !data.getIncomingItems().isEmpty()) { for (var item : data.getIncomingItems()) {
for (var item : data.getIncomingItems()) { var mtbAart = Stream.of(newMtbAarts).filter(x -> x.getCodMart().equalsIgnoreCase(item.getCodMart()))
var mtbAart = Stream.of(newMtbAarts).filter(x -> x.getCodMart().equalsIgnoreCase(item.getCodMart())) .findFirstOrElse(null);
.findFirstOrElse(null);
if (mtbAart != null) if (mtbAart != null)
item.setMtbAart(mtbAart); item.setMtbAart(mtbAart);
} }
} }
if (data.getAvailableItems() != null && !data.getAvailableItems().isEmpty()) { if (data.getAvailableItems() != null && !data.getAvailableItems().isEmpty()) {
for (var item : data.getAvailableItems()) { for (var item : data.getAvailableItems()) {
var mtbAart = Stream.of(newMtbAarts).filter(x -> x.getCodMart().equalsIgnoreCase(item.getCodMart())) var mtbAart = Stream.of(newMtbAarts).filter(x -> x.getCodMart().equalsIgnoreCase(item.getCodMart()))
.findFirstOrElse(null); .findFirstOrElse(null);
if (mtbAart != null) if (mtbAart != null)
item.setMtbAart(mtbAart); item.setMtbAart(mtbAart);
} }
} }
onComplete.run(data); return data;
}, onFailed);
}, onFailed);
} }

View File

@@ -2,6 +2,8 @@ package it.integry.integrywmsnative.core.rest.consumers;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import java.util.concurrent.ExecutorService;
import javax.inject.Singleton; import javax.inject.Singleton;
import it.integry.integrywmsnative.core.expansion.RunnableArgs; import it.integry.integrywmsnative.core.expansion.RunnableArgs;
@@ -18,26 +20,31 @@ import retrofit2.Response;
public class MagazzinoAutomaticoRESTConsumer extends _BaseRESTConsumer { public class MagazzinoAutomaticoRESTConsumer extends _BaseRESTConsumer {
private final ExecutorService executorService;
private final RESTBuilder restBuilder; private final RESTBuilder restBuilder;
public MagazzinoAutomaticoRESTConsumer(RESTBuilder restBuilder) { public MagazzinoAutomaticoRESTConsumer(ExecutorService executorService, RESTBuilder restBuilder) {
this.executorService = executorService;
this.restBuilder = restBuilder; this.restBuilder = restBuilder;
} }
public void pickItems(MtbDepoPosizione posizione, MagazzinoAutomaticoPickItemsRequestDTO magazzinoAutomaticoPickItemsRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) { public void pickItemsSynchronized(MtbDepoPosizione posizione, MagazzinoAutomaticoPickItemsRequestDTO magazzinoAutomaticoPickItemsRequestDTO) throws Exception {
MagazzinoAutomaticoRESTConsumerService magazzinoAutomaticoRESTConsumerService = restBuilder.getService(MagazzinoAutomaticoRESTConsumerService.class); MagazzinoAutomaticoRESTConsumerService magazzinoAutomaticoRESTConsumerService = restBuilder.getService(MagazzinoAutomaticoRESTConsumerService.class);
magazzinoAutomaticoRESTConsumerService.pickItems(posizione.getPosizione(), magazzinoAutomaticoPickItemsRequestDTO) var response = magazzinoAutomaticoRESTConsumerService.pickItems(posizione.getPosizione(), magazzinoAutomaticoPickItemsRequestDTO)
.enqueue(new ManagedErrorCallback<>() { .execute();
@Override
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
analyzeAnswer(response, "magazzino-automatico/pickItems", data -> onComplete.run(), onFailed);
}
@Override analyzeAnswer(response, "magazzino-automatico/pickItems");
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) { }
onFailed.run(e);
} public void pickItems(MtbDepoPosizione posizione, MagazzinoAutomaticoPickItemsRequestDTO magazzinoAutomaticoPickItemsRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
}); executorService.execute(() -> {
try {
pickItemsSynchronized(posizione, magazzinoAutomaticoPickItemsRequestDTO);
if (onComplete != null) onComplete.run();
} catch (Exception ex) {
if (onFailed != null) onFailed.run(ex);
}
});
} }

View File

@@ -1,5 +1,6 @@
package it.integry.integrywmsnative.core.rest.consumers; package it.integry.integrywmsnative.core.rest.consumers;
import java.util.List;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import javax.inject.Singleton; import javax.inject.Singleton;
@@ -8,6 +9,8 @@ import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.model.MtbColt; import it.integry.integrywmsnative.core.model.MtbColt;
import it.integry.integrywmsnative.core.rest.RESTBuilder; import it.integry.integrywmsnative.core.rest.RESTBuilder;
import it.integry.integrywmsnative.core.rest.model.materiali.RecuperaMaterialiRequestDTO; import it.integry.integrywmsnative.core.rest.model.materiali.RecuperaMaterialiRequestDTO;
import it.integry.integrywmsnative.core.rest.model.materiali.VersaMaterialiRequestDTO;
import it.integry.integrywmsnative.gest.prod_recupero_materiale.dto.HistoryVersamentoProdULRestDTO;
@Singleton @Singleton
public class MaterialiRESTConsumer extends _BaseRESTConsumer { public class MaterialiRESTConsumer extends _BaseRESTConsumer {
@@ -20,6 +23,28 @@ public class MaterialiRESTConsumer extends _BaseRESTConsumer {
this.executorService = executorService; this.executorService = executorService;
} }
public List<HistoryVersamentoProdULRestDTO> makeSynchronousRetrieveLastVersamentiRequest(String codJfas) throws Exception {
var materialiRESTConsumerService = restBuilder.getService(MaterialiRESTConsumerService.class);
var response = materialiRESTConsumerService.retrieveLastVersamenti(codJfas)
.execute();
var data = analyzeAnswer(response, "retrieveLastVersamenti");
return data;
}
public void makeRetrieveLastVersamentiRequest(String codJfas, final RunnableArgs<List<HistoryVersamentoProdULRestDTO>> onComplete, final RunnableArgs<Exception> onFailed) {
executorService.execute(() -> {
try {
var response = makeSynchronousRetrieveLastVersamentiRequest(codJfas);
if (onComplete != null) onComplete.run(response);
} catch (Exception ex) {
if (onFailed != null) onFailed.run(ex);
}
});
}
public MtbColt makeSynchronousRecuperaRequest(RecuperaMaterialiRequestDTO request) throws Exception { public MtbColt makeSynchronousRecuperaRequest(RecuperaMaterialiRequestDTO request) throws Exception {
var materialiRESTConsumerService = restBuilder.getService(MaterialiRESTConsumerService.class); var materialiRESTConsumerService = restBuilder.getService(MaterialiRESTConsumerService.class);
@@ -43,4 +68,27 @@ public class MaterialiRESTConsumer extends _BaseRESTConsumer {
}); });
} }
public void makeSynchronousVersaRequest(VersaMaterialiRequestDTO request) throws Exception {
var materialiRESTConsumerService = restBuilder.getService(MaterialiRESTConsumerService.class);
var response = materialiRESTConsumerService.versa(request)
.execute();
var data = analyzeAnswer(response, "versaMateriali");
// if (data == null) return null;
// return data.getUpdatedMtbColtScarico();
}
public void makeVersaRequest(VersaMaterialiRequestDTO request, final Runnable onComplete, final RunnableArgs<Exception> onFailed) {
executorService.execute(() -> {
try {
makeSynchronousVersaRequest(request);
if (onComplete != null) onComplete.run();
} catch (Exception ex) {
if (onFailed != null) onFailed.run(ex);
}
});
}
} }

View File

@@ -1,14 +1,27 @@
package it.integry.integrywmsnative.core.rest.consumers; package it.integry.integrywmsnative.core.rest.consumers;
import java.util.List;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse; import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import it.integry.integrywmsnative.core.rest.model.materiali.RecuperaMaterialiRequestDTO; import it.integry.integrywmsnative.core.rest.model.materiali.RecuperaMaterialiRequestDTO;
import it.integry.integrywmsnative.core.rest.model.materiali.RecuperaMaterialiResponseDTO; import it.integry.integrywmsnative.core.rest.model.materiali.RecuperaMaterialiResponseDTO;
import it.integry.integrywmsnative.core.rest.model.materiali.VersaMaterialiRequestDTO;
import it.integry.integrywmsnative.core.rest.model.materiali.VersaMaterialiResponseDTO;
import it.integry.integrywmsnative.gest.prod_recupero_materiale.dto.HistoryVersamentoProdULRestDTO;
import retrofit2.Call; import retrofit2.Call;
import retrofit2.http.Body; import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.POST; import retrofit2.http.POST;
import retrofit2.http.Query;
public interface MaterialiRESTConsumerService { public interface MaterialiRESTConsumerService {
@POST("wms/materiali/versa")
Call<ServiceRESTResponse<VersaMaterialiResponseDTO>> versa(@Body VersaMaterialiRequestDTO request);
@GET("wms/materiali/retrieveLastVersamenti")
Call<ServiceRESTResponse<List<HistoryVersamentoProdULRestDTO>>> retrieveLastVersamenti(@Query("codJfas") String codJfas);
@POST("wms/materiali/recupera") @POST("wms/materiali/recupera")
Call<ServiceRESTResponse<RecuperaMaterialiResponseDTO>> recupera(@Body RecuperaMaterialiRequestDTO request); Call<ServiceRESTResponse<RecuperaMaterialiResponseDTO>> recupera(@Body RecuperaMaterialiRequestDTO request);

View File

@@ -4,14 +4,11 @@ import androidx.annotation.NonNull;
import com.annimon.stream.Optional; import com.annimon.stream.Optional;
import com.annimon.stream.Stream; import com.annimon.stream.Stream;
import com.google.gson.reflect.TypeToken;
import com.orhanobut.logger.Logger;
import java.lang.reflect.Type;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
import java.util.concurrent.ExecutorService;
import javax.inject.Singleton; import javax.inject.Singleton;
@@ -21,6 +18,7 @@ import it.integry.integrywmsnative.core.model.MtbColr;
import it.integry.integrywmsnative.core.model.MtbColt; import it.integry.integrywmsnative.core.model.MtbColt;
import it.integry.integrywmsnative.core.model.MtbPartitaMag; import it.integry.integrywmsnative.core.model.MtbPartitaMag;
import it.integry.integrywmsnative.core.model.OrdineInevasoDTO; import it.integry.integrywmsnative.core.model.OrdineInevasoDTO;
import it.integry.integrywmsnative.core.model.dto.AlreadyRegisteredUlDTO;
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum; import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
import it.integry.integrywmsnative.core.rest.RESTBuilder; import it.integry.integrywmsnative.core.rest.RESTBuilder;
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback; import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
@@ -28,8 +26,7 @@ import it.integry.integrywmsnative.core.rest.model.GetPickingListDTO;
import it.integry.integrywmsnative.core.rest.model.OrdineUscitaInevasoDTO; import it.integry.integrywmsnative.core.rest.model.OrdineUscitaInevasoDTO;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse; import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import it.integry.integrywmsnative.core.rest.model.SitArtOrdDTO; import it.integry.integrywmsnative.core.rest.model.SitArtOrdDTO;
import it.integry.integrywmsnative.core.utility.UtilityDB; import it.integry.integrywmsnative.core.rest.model.uds.RetrieveAlreadyRegisteredUdsRequestDTO;
import it.integry.integrywmsnative.core.utility.UtilityQuery;
import it.integry.integrywmsnative.core.utility.UtilityString; import it.integry.integrywmsnative.core.utility.UtilityString;
import it.integry.integrywmsnative.gest.spedizione.model.PickingObjectDTO; import it.integry.integrywmsnative.gest.spedizione.model.PickingObjectDTO;
import retrofit2.Call; import retrofit2.Call;
@@ -39,12 +36,14 @@ import retrofit2.Response;
public class OrdiniRESTConsumer extends _BaseRESTConsumer { public class OrdiniRESTConsumer extends _BaseRESTConsumer {
private final RESTBuilder restBuilder; private final RESTBuilder restBuilder;
private final ExecutorService executorService;
private final SystemRESTConsumer mSystemRESTConsumer; private final SystemRESTConsumer mSystemRESTConsumer;
private final EntityRESTConsumer mEntityRESTConsumer; private final EntityRESTConsumer mEntityRESTConsumer;
public OrdiniRESTConsumer(RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer, EntityRESTConsumer entityRESTConsumer) { public OrdiniRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService,SystemRESTConsumer systemRESTConsumer, EntityRESTConsumer entityRESTConsumer) {
this.restBuilder = restBuilder; this.restBuilder = restBuilder;
this.executorService = executorService;
this.mSystemRESTConsumer = systemRESTConsumer; this.mSystemRESTConsumer = systemRESTConsumer;
this.mEntityRESTConsumer = entityRESTConsumer; this.mEntityRESTConsumer = entityRESTConsumer;
} }
@@ -61,7 +60,7 @@ public class OrdiniRESTConsumer extends _BaseRESTConsumer {
for (PickingObjectDTO pickingObjectDTO : pickingObjects) { for (PickingObjectDTO pickingObjectDTO : pickingObjects) {
for (MtbColt mtbColt : pickingObjectDTO.getMtbColts()) { for (MtbColt mtbColt : pickingObjectDTO.getMtbColts()) {
Stream.of(mtbColt.getMtbColr()) mtbColt.getMtbColr().stream()
.filter(x -> !UtilityString.isNullOrEmpty(x.getPartitaMag())) .filter(x -> !UtilityString.isNullOrEmpty(x.getPartitaMag()))
.forEach(x -> { .forEach(x -> {
@@ -125,28 +124,24 @@ public class OrdiniRESTConsumer extends _BaseRESTConsumer {
this.mEntityRESTConsumer.processEntityList(partitaMag, true, MtbPartitaMag.class, onComplete, onFailed); this.mEntityRESTConsumer.processEntityList(partitaMag, true, MtbPartitaMag.class, onComplete, onFailed);
} }
public void getOrdiniInevasi(String codMdep, GestioneEnum gestione, RunnableArgs<List<OrdineUscitaInevasoDTO>> onComplete, RunnableArgs<Exception> onFailed) { public List<OrdineUscitaInevasoDTO> getOrdiniInevasiSynchronized(String codMdep, GestioneEnum gestione) throws Exception {
OrdiniRESTConsumerService service = restBuilder.getService(OrdiniRESTConsumerService.class); OrdiniRESTConsumerService service = restBuilder.getService(OrdiniRESTConsumerService.class);
service.getOrdiniInevasi(codMdep, gestione.getText()) var response = service.getOrdiniInevasi(codMdep, gestione.getText())
.enqueue(new ManagedErrorCallback<>() { .execute();
@Override var data = analyzeAnswer(response, "getOrdiniInevasi");
public void onResponse(Call<ServiceRESTResponse<List<OrdineUscitaInevasoDTO>>> call, Response<ServiceRESTResponse<List<OrdineUscitaInevasoDTO>>> response) { return data == null ? new ArrayList<>() : data;
analyzeAnswer(response, "getOrdiniInevasi", responseDtoList -> { }
if (responseDtoList == null) responseDtoList = new ArrayList<>();
onComplete.run(responseDtoList);
}, ex -> {
Logger.e(ex, "Errore durante il caricamento degli ordini di lavorazione");
if (onFailed != null) onFailed.run(ex);
});
}
@Override public void getOrdiniInevasi(String codMdep, GestioneEnum gestione, RunnableArgs<List<OrdineUscitaInevasoDTO>> onComplete, RunnableArgs<Exception> onFailed) {
public void onFailure(Call<ServiceRESTResponse<List<OrdineUscitaInevasoDTO>>> call, @NonNull final Exception e) { executorService.execute(() -> {
if (onFailed != null) onFailed.run(e); try {
} var result = getOrdiniInevasiSynchronized(codMdep, gestione);
}); if (onComplete != null) onComplete.run(result);
} catch (Exception ex) {
if (onFailed != null) onFailed.run(ex);
}
});
} }
public void retrieveListaArticoliFromOrdiniUscita(String codMdep, List<OrdineUscitaInevasoDTO> orders, RunnableArgs<List<SitArtOrdDTO>> onComplete, RunnableArgs<Exception> onFailed) { public void retrieveListaArticoliFromOrdiniUscita(String codMdep, List<OrdineUscitaInevasoDTO> orders, RunnableArgs<List<SitArtOrdDTO>> onComplete, RunnableArgs<Exception> onFailed) {
@@ -182,44 +177,27 @@ public class OrdiniRESTConsumer extends _BaseRESTConsumer {
}); });
} }
public void getBancaliGiaRegistrati(List<OrdineInevasoDTO> orders, GestioneEnum gestione, int segno, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) { public List<AlreadyRegisteredUlDTO> getBancaliGiaRegistratiSynchronized(List<? extends OrdineInevasoDTO> orders, int segno) throws Exception {
String whereCondGestione = ""; OrdiniRESTConsumerService service = restBuilder.getService(OrdiniRESTConsumerService.class);
if (gestione != null) { var request = new RetrieveAlreadyRegisteredUdsRequestDTO()
whereCondGestione = "mtb_colt.gestione = " + UtilityDB.valueToString(gestione.getText()) + " "; .setOrdini(orders)
} else { .setSegno(segno);
whereCondGestione = "(mtb_colt.gestione = 'V' OR mtb_colt.gestione = 'L') ";
}
String baseSql = "SELECT DISTINCT mtb_colt.* " + var response = service.retrieveAlreadyRegisteredUDS(request)
"FROM mtb_colt " + .execute();
" INNER JOIN mtb_colr ON " + var data = analyzeAnswer(response, "getBancaliGiaRegistrati");
" mtb_colt.gestione = mtb_colr.gestione " + return data == null || data.getUdsList() == null ? new ArrayList<>() : data.getUdsList();
" AND mtb_colt.ser_collo = mtb_colr.ser_collo " + }
" AND mtb_colt.data_collo = mtb_colr.data_collo " +
" AND mtb_colt.num_collo = mtb_colr.num_collo " +
" WHERE " + whereCondGestione +
" AND mtb_colt.segno = " + UtilityDB.valueToString(segno) + " " +
" AND mtb_colt.data_doc IS NULL AND ";
List<HashMap<String, Object>> whereCondMapList = new ArrayList<>(); public void getBancaliGiaRegistrati(List<OrdineInevasoDTO> orders, int segno, RunnableArgs<List<AlreadyRegisteredUlDTO>> onComplete, RunnableArgs<Exception> onFailed) {
for (OrdineInevasoDTO ordineInevaso : orders) { executorService.execute(() -> {
HashMap<String, Object> whereCondMap = new HashMap<>(); try {
whereCondMap.put("mtb_colr.data_ord", ordineInevaso.getDataOrdD()); var result = getBancaliGiaRegistratiSynchronized(orders, segno);
whereCondMap.put("mtb_colr.num_ord", ordineInevaso.getNumOrd()); if (onComplete != null) onComplete.run(result);
whereCondMap.put("mtb_colr.gestione", ordineInevaso.getGestione()); } catch (Exception ex) {
if (onFailed != null) onFailed.run(ex);
whereCondMapList.add(whereCondMap); }
}
baseSql += "(" + UtilityQuery.concatFieldListInWhereCond(whereCondMapList) + ")";
Type typeOfObjectsList = new TypeToken<ArrayList<MtbColt>>() {
}.getType();
this.mSystemRESTConsumer.<List<MtbColt>>processSql(baseSql, typeOfObjectsList, value -> {
if (onComplete != null) onComplete.run(value);
}, ex -> {
if (onFailed != null) onFailed.run(ex);
}); });
} }

View File

@@ -5,6 +5,8 @@ import java.util.List;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse; import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import it.integry.integrywmsnative.core.rest.model.SitArtOrdDTO; import it.integry.integrywmsnative.core.rest.model.SitArtOrdDTO;
import it.integry.integrywmsnative.core.rest.model.OrdineUscitaInevasoDTO; import it.integry.integrywmsnative.core.rest.model.OrdineUscitaInevasoDTO;
import it.integry.integrywmsnative.core.rest.model.uds.RetrieveAlreadyRegisteredUdsRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.RetrieveAlreadyRegisteredUdsResponseDTO;
import it.integry.integrywmsnative.gest.spedizione.model.PickingObjectDTO; import it.integry.integrywmsnative.gest.spedizione.model.PickingObjectDTO;
import it.integry.integrywmsnative.core.rest.model.GetPickingListDTO; import it.integry.integrywmsnative.core.rest.model.GetPickingListDTO;
import retrofit2.Call; import retrofit2.Call;
@@ -23,4 +25,7 @@ public interface OrdiniRESTConsumerService {
@GET("SM2GetOrdiniVenditaInevasi") @GET("SM2GetOrdiniVenditaInevasi")
Call<ServiceRESTResponse<List<OrdineUscitaInevasoDTO>>> getOrdiniInevasi(@Query("codMdep") String codMdep, @Query("gestione") String gestione); Call<ServiceRESTResponse<List<OrdineUscitaInevasoDTO>>> getOrdiniInevasi(@Query("codMdep") String codMdep, @Query("gestione") String gestione);
@POST("wms/spedizione/retrieveAlreadyRegisteredUDS")
Call<ServiceRESTResponse<RetrieveAlreadyRegisteredUdsResponseDTO>> retrieveAlreadyRegisteredUDS(@Body RetrieveAlreadyRegisteredUdsRequestDTO request);
} }

View File

@@ -1,12 +1,11 @@
package it.integry.integrywmsnative.core.rest.consumers; package it.integry.integrywmsnative.core.rest.consumers;
import androidx.annotation.NonNull;
import com.google.gson.reflect.TypeToken; import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type; import java.lang.reflect.Type;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.concurrent.ExecutorService;
import javax.inject.Singleton; import javax.inject.Singleton;
@@ -14,44 +13,33 @@ import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.model.MtbColt; import it.integry.integrywmsnative.core.model.MtbColt;
import it.integry.integrywmsnative.core.model.MtbDepoPosizione; import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
import it.integry.integrywmsnative.core.rest.RESTBuilder; import it.integry.integrywmsnative.core.rest.RESTBuilder;
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import it.integry.integrywmsnative.core.utility.UtilityDB; import it.integry.integrywmsnative.core.utility.UtilityDB;
import retrofit2.Call;
import retrofit2.Response;
@Singleton @Singleton
public class PosizioniRESTConsumer extends _BaseRESTConsumer { public class PosizioniRESTConsumer extends _BaseRESTConsumer {
private final RESTBuilder restBuilder; private final RESTBuilder restBuilder;
private final SystemRESTConsumer mSystemRESTConsumer; private final SystemRESTConsumer mSystemRESTConsumer;
private final ExecutorService executorService;
public PosizioniRESTConsumer(RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer) { public PosizioniRESTConsumer(RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer, ExecutorService executorService) {
this.restBuilder = restBuilder; this.restBuilder = restBuilder;
this.mSystemRESTConsumer = systemRESTConsumer; this.mSystemRESTConsumer = systemRESTConsumer;
this.executorService = executorService;
} }
public void getAvailablePosizioni(RunnableArgs<List<MtbDepoPosizione>> onComplete, RunnableArgs<Exception> onFailed) { public List<MtbDepoPosizione> getAvailablePosizioniSynchronized() throws Exception {
String codMdep = null; String codMdep = null;
PosizioniRESTConsumerService posizioniRESTConsumerService = restBuilder.getService(PosizioniRESTConsumerService.class); PosizioniRESTConsumerService posizioniRESTConsumerService = restBuilder.getService(PosizioniRESTConsumerService.class);
posizioniRESTConsumerService.getAvailablePosizioni(codMdep).enqueue(new ManagedErrorCallback<>() { var response = posizioniRESTConsumerService.getAvailablePosizioni(codMdep)
@Override .execute();
public void onResponse(Call<ServiceRESTResponse<List<MtbDepoPosizione>>> call, Response<ServiceRESTResponse<List<MtbDepoPosizione>>> response) {
analyzeAnswer(response, "getAvailablePosizioni", (m) -> {
onComplete.run(response.body().getDto());
}, onFailed);
}
@Override var data = analyzeAnswer(response, "getAvailablePosizioni");
public void onFailure(Call<ServiceRESTResponse<List<MtbDepoPosizione>>> call, @NonNull final Exception e) { return response.body().getDto();
onFailed.run(e);
}
});
} }
public ArrayList<MtbColt> getBancaliInPosizioneSynchronized(MtbDepoPosizione mtbDepoPosizione) throws Exception {
public void getBancaliInPosizione(MtbDepoPosizione mtbDepoPosizione, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
String sql = "SELECT * FROM mtb_colt " + String sql = "SELECT * FROM mtb_colt " +
"WHERE segno > 0 " + "WHERE segno > 0 " +
"AND cod_mdep = " + UtilityDB.valueToString(mtbDepoPosizione.getCodMdep()) + " " + "AND cod_mdep = " + UtilityDB.valueToString(mtbDepoPosizione.getCodMdep()) + " " +
@@ -61,10 +49,18 @@ public class PosizioniRESTConsumer extends _BaseRESTConsumer {
Type typeOfObjectsList = new TypeToken<ArrayList<MtbColt>>() { Type typeOfObjectsList = new TypeToken<ArrayList<MtbColt>>() {
}.getType(); }.getType();
mSystemRESTConsumer.<ArrayList<MtbColt>>processSql(sql, typeOfObjectsList, value -> { var value = mSystemRESTConsumer.<ArrayList<MtbColt>>processSqlSynchronized(sql, typeOfObjectsList);
if (onComplete != null) onComplete.run(value); return value;
}, ex -> { }
if (onFailed != null) onFailed.run(ex);
public void getBancaliInPosizione(MtbDepoPosizione mtbDepoPosizione, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
executorService.execute(() -> {
try {
var result = getBancaliInPosizioneSynchronized(mtbDepoPosizione);
if (onComplete != null) onComplete.run(result);
} catch (Exception ex) {
if (onFailed != null) onFailed.run(ex);
}
}); });
} }

View File

@@ -123,27 +123,15 @@ public class PrinterRESTConsumer extends _BaseRESTConsumer {
printReportType(reportType, codMdep, null, params, onComplete, onFailed); printReportType(reportType, codMdep, null, params, onComplete, onFailed);
} }
public void printClosedOrders(PrintOrderCloseDTO dto, String codMdep, Runnable onComplete, RunnableArgs<Exception> onFailed) { public void printClosedOrdersSynchronized(PrintOrderCloseDTO dto, String codMdep) throws Exception {
if (BuildConfig.DEBUG) { if (BuildConfig.DEBUG) {
onComplete.run(); // return;
return;
} }
PrinterRESTConsumerService printerService = restBuilder.getService(PrinterRESTConsumerService.class, 240); PrinterRESTConsumerService printerService = restBuilder.getService(PrinterRESTConsumerService.class, 240);
Call<ServiceRESTResponse<Object>> callable = printerService.printClosedOrders(codMdep, dto);
callable.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) {
analyzeAnswer(response, "printCollo", data -> {
onComplete.run();
}, onFailed);
}
@Override var response = printerService.printClosedOrders(codMdep, dto).execute();
public void onFailure(Call<ServiceRESTResponse<Object>> call, @NonNull final Exception e) { analyzeAnswer(response, "printCollo");
onFailed.run(e);
}
});
} }

View File

@@ -1,8 +1,5 @@
package it.integry.integrywmsnative.core.rest.consumers; package it.integry.integrywmsnative.core.rest.consumers;
import android.text.TextUtils;
import android.util.Log;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import com.google.gson.Gson; import com.google.gson.Gson;
@@ -17,8 +14,6 @@ import java.util.concurrent.ExecutorService;
import javax.inject.Singleton; import javax.inject.Singleton;
import it.integry.integrywmsnative.BuildConfig;
import it.integry.integrywmsnative.core.CommonConst;
import it.integry.integrywmsnative.core.expansion.RunnableArgs; import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.rest.RESTBuilder; import it.integry.integrywmsnative.core.rest.RESTBuilder;
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback; import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
@@ -27,9 +22,7 @@ import it.integry.integrywmsnative.core.rest.model.MailRequestDTO;
import it.integry.integrywmsnative.core.rest.model.NativeSqlRequestDTO; import it.integry.integrywmsnative.core.rest.model.NativeSqlRequestDTO;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse; import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import it.integry.integrywmsnative.core.rest.model.system.LatestAppVersionInfoDTO; import it.integry.integrywmsnative.core.rest.model.system.LatestAppVersionInfoDTO;
import it.integry.integrywmsnative.core.settings.SettingsManager;
import it.integry.integrywmsnative.core.utility.UtilityGson; import it.integry.integrywmsnative.core.utility.UtilityGson;
import it.integry.integrywmsnative.core.utility.UtilityString;
import retrofit2.Call; import retrofit2.Call;
import retrofit2.Response; import retrofit2.Response;
@@ -89,6 +82,11 @@ public class SystemRESTConsumer extends _BaseRESTConsumer {
}); });
} }
public List<AvailableCodMdepsDTO> getAvailableCodMdepsSynchronized() throws Exception {
SystemRESTConsumerService service = restBuilder.getService(SystemRESTConsumerService.class);
var response = service.getAvailableCodMdeps().execute();
return analyzeAnswer(response, "CodMdepsAvailable");
}
public void getAvailableCodMdeps(final RunnableArgs<List<AvailableCodMdepsDTO>> onSuccess, RunnableArgs<Exception> onFailed) { public void getAvailableCodMdeps(final RunnableArgs<List<AvailableCodMdepsDTO>> onSuccess, RunnableArgs<Exception> onFailed) {
SystemRESTConsumerService service = restBuilder.getService(SystemRESTConsumerService.class); SystemRESTConsumerService service = restBuilder.getService(SystemRESTConsumerService.class);
@@ -105,36 +103,6 @@ public class SystemRESTConsumer extends _BaseRESTConsumer {
}); });
} }
public void sendErrorLogMail(String message, Runnable onComplete, RunnableArgs<Exception> onFailed) {
String currentAzienda = UtilityString.isNullOrEmpty(SettingsManager.i().getUserSession().getProfileDB()) ? "" : " [" + SettingsManager.i().getUserSession().getProfileDB() + "]";
String dest = "";
if (BuildConfig.DEBUG) {
dest = TextUtils.join(";", CommonConst.Mail.forErrorsDebug);
} else {
dest = TextUtils.join(";", CommonConst.Mail.forErrors);
}
MailRequestDTO mailDTO = new MailRequestDTO()
.setFrom("sender@integry.it")
.setFromName((BuildConfig.DEBUG ? "[DEBUG] " : "") + "WMS Android")
.setTo(dest)
.setSubject("Bug notification" + currentAzienda)
.setMsgText(message)
.setHtml(true);
sendMail(mailDTO, () -> {
if (onComplete != null) onComplete.run();
}, ex -> {
Log.e(SystemRESTConsumer.class.getName(), "", ex);
if (onFailed != null) onFailed.run(ex);
});
}
public void sendMailSynchronized(MailRequestDTO mailDTO) throws Exception { public void sendMailSynchronized(MailRequestDTO mailDTO) throws Exception {
SystemRESTConsumerService service = restBuilder.getService(SystemRESTConsumerService.class); SystemRESTConsumerService service = restBuilder.getService(SystemRESTConsumerService.class);
var response = service.sendMail(mailDTO).execute(); var response = service.sendMail(mailDTO).execute();

View File

@@ -12,13 +12,23 @@ import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowRequestDTO;
public interface ColliScaricoRESTConsumerInterface { public interface ColliScaricoRESTConsumerInterface {
MtbColt createUDSSynchronized(CreateUDSRequestDTO createUDSRequestDTO) throws Exception;
void createUDS(CreateUDSRequestDTO createUDSRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed); void createUDS(CreateUDSRequestDTO createUDSRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed);
CloseUDSResponseDTO closeUDSSynchronized(CloseUDSRequestDTO closeUDSRequestDTO) throws Exception;
void closeUDS(CloseUDSRequestDTO closeUDSRequestDTO, RunnableArgs<CloseUDSResponseDTO> onComplete, RunnableArgs<Exception> onFailed); void closeUDS(CloseUDSRequestDTO closeUDSRequestDTO, RunnableArgs<CloseUDSResponseDTO> onComplete, RunnableArgs<Exception> onFailed);
MtbColr insertUDSRowSynchronized(InsertUDSRowRequestDTO insertUDSRowRequestDTO) throws Exception;
void insertUDSRow(InsertUDSRowRequestDTO insertUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed); void insertUDSRow(InsertUDSRowRequestDTO insertUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed);
MtbColr editUDSRowSynchronized(EditUDSRowRequestDTO editUDSRowRequestDTO) throws Exception;
void editUDSRow(EditUDSRowRequestDTO editUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed); void editUDSRow(EditUDSRowRequestDTO editUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed);
void deleteUDSRowSynchronized(DeleteUDSRowRequestDTO deleteUDSRequestDTO) throws Exception;
void deleteUDSRow(DeleteUDSRowRequestDTO deleteUDSRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed); void deleteUDSRow(DeleteUDSRowRequestDTO deleteUDSRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed);
} }

View File

@@ -0,0 +1,21 @@
package it.integry.integrywmsnative.core.rest.deserializer;
import androidx.lifecycle.MutableLiveData;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonParseException;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
public class MutableLiveDataDeserializer implements JsonDeserializer<MutableLiveData<?>> {
@Override
public MutableLiveData<?> deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
Type type = ((ParameterizedType) typeOfT).getActualTypeArguments()[0];
MutableLiveData<Object> liveData = new MutableLiveData<>();
liveData.setValue(context.deserialize(json, type));
return liveData;
}
}

View File

@@ -1,8 +1,13 @@
package it.integry.integrywmsnative.core.rest.model; package it.integry.integrywmsnative.core.rest.model;
import com.google.gson.annotations.SerializedName;
public class AvailableCodMdepsDTO { public class AvailableCodMdepsDTO {
@SerializedName("codMdep")
private String codMdep; private String codMdep;
@SerializedName("descrizione")
private String descrizione; private String descrizione;
public String getCodMdep() { public String getCodMdep() {

View File

@@ -0,0 +1,27 @@
package it.integry.integrywmsnative.core.rest.model;
import it.integry.integrywmsnative.core.model.MtbColt;
public class UpdatePosizioneULRequestDTO {
private MtbColt mtbColt;
private String posizione;
public MtbColt getMtbColt() {
return mtbColt;
}
public UpdatePosizioneULRequestDTO setMtbColt(MtbColt mtbColt) {
this.mtbColt = mtbColt;
return this;
}
public String getPosizione() {
return posizione;
}
public UpdatePosizioneULRequestDTO setPosizione(String posizione) {
this.posizione = posizione;
return this;
}
}

View File

@@ -0,0 +1,110 @@
package it.integry.integrywmsnative.core.rest.model.materiali;
import java.math.BigDecimal;
import java.time.LocalDate;
public class VersaMaterialiRequestDTO {
private String codMart;
private String partitaMag;
private BigDecimal numCnf;
private BigDecimal qtaCnf;
private BigDecimal qtaTot;
private Integer numCollo;
private LocalDate dataCollo;
private String gestione;
private String serCollo;
private String barcodeUl;
public String getCodMart() {
return codMart;
}
public VersaMaterialiRequestDTO setCodMart(String codMart) {
this.codMart = codMart;
return this;
}
public String getPartitaMag() {
return partitaMag;
}
public VersaMaterialiRequestDTO setPartitaMag(String partitaMag) {
this.partitaMag = partitaMag;
return this;
}
public BigDecimal getNumCnf() {
return numCnf;
}
public VersaMaterialiRequestDTO setNumCnf(BigDecimal numCnf) {
this.numCnf = numCnf;
return this;
}
public BigDecimal getQtaCnf() {
return qtaCnf;
}
public VersaMaterialiRequestDTO setQtaCnf(BigDecimal qtaCnf) {
this.qtaCnf = qtaCnf;
return this;
}
public BigDecimal getQtaTot() {
return qtaTot;
}
public VersaMaterialiRequestDTO setQtaTot(BigDecimal qtaTot) {
this.qtaTot = qtaTot;
return this;
}
public Integer getNumCollo() {
return numCollo;
}
public VersaMaterialiRequestDTO setNumCollo(Integer numCollo) {
this.numCollo = numCollo;
return this;
}
public LocalDate getDataCollo() {
return dataCollo;
}
public VersaMaterialiRequestDTO setDataCollo(LocalDate dataCollo) {
this.dataCollo = dataCollo;
return this;
}
public String getGestione() {
return gestione;
}
public VersaMaterialiRequestDTO setGestione(String gestione) {
this.gestione = gestione;
return this;
}
public String getSerCollo() {
return serCollo;
}
public VersaMaterialiRequestDTO setSerCollo(String serCollo) {
this.serCollo = serCollo;
return this;
}
public String getBarcodeUl() {
return barcodeUl;
}
public VersaMaterialiRequestDTO setBarcodeUl(String barcodeUl) {
this.barcodeUl = barcodeUl;
return this;
}
}

View File

@@ -0,0 +1,4 @@
package it.integry.integrywmsnative.core.rest.model.materiali;
public class VersaMaterialiResponseDTO {
}

View File

@@ -0,0 +1,27 @@
package it.integry.integrywmsnative.core.rest.model.pv;
import java.time.LocalDateTime;
public class CloseVerificaRequestDTO {
private String codMdep;
private LocalDateTime dataVerifica;
public String getCodMdep() {
return codMdep;
}
public CloseVerificaRequestDTO setCodMdep(String codMdep) {
this.codMdep = codMdep;
return this;
}
public LocalDateTime getDataVerifica() {
return dataVerifica;
}
public CloseVerificaRequestDTO setDataVerifica(LocalDateTime dataVerifica) {
this.dataVerifica = dataVerifica;
return this;
}
}

View File

@@ -0,0 +1,37 @@
package it.integry.integrywmsnative.core.rest.model.pv;
import java.time.LocalDateTime;
public class DeleteRowVerificaRequestDTO {
private String codMdep;
private LocalDateTime dataVerifica;
private VerificaGiacenzeRowDTO row;
public String getCodMdep() {
return codMdep;
}
public DeleteRowVerificaRequestDTO setCodMdep(String codMdep) {
this.codMdep = codMdep;
return this;
}
public LocalDateTime getDataVerifica() {
return dataVerifica;
}
public DeleteRowVerificaRequestDTO setDataVerifica(LocalDateTime dataVerifica) {
this.dataVerifica = dataVerifica;
return this;
}
public VerificaGiacenzeRowDTO getRow() {
return row;
}
public DeleteRowVerificaRequestDTO setRow(VerificaGiacenzeRowDTO row) {
this.row = row;
return this;
}
}

View File

@@ -0,0 +1,38 @@
package it.integry.integrywmsnative.core.rest.model.pv;
import java.time.LocalDateTime;
public class SaveNewRowVerificaRequestDTO {
private String codMdep;
private LocalDateTime dataVerifica;
private VerificaGiacenzeRowDTO row;
public String getCodMdep() {
return codMdep;
}
public SaveNewRowVerificaRequestDTO setCodMdep(String codMdep) {
this.codMdep = codMdep;
return this;
}
public LocalDateTime getDataVerifica() {
return dataVerifica;
}
public SaveNewRowVerificaRequestDTO setDataVerifica(LocalDateTime dataVerifica) {
this.dataVerifica = dataVerifica;
return this;
}
public VerificaGiacenzeRowDTO getRow() {
return row;
}
public SaveNewRowVerificaRequestDTO setRow(VerificaGiacenzeRowDTO row) {
this.row = row;
return this;
}
}

View File

@@ -1,15 +0,0 @@
package it.integry.integrywmsnative.core.rest.model.pv;
public class SaveNewVerificaRequestDTO {
private VerificaGiacenzeDTO data;
public VerificaGiacenzeDTO getData() {
return data;
}
public SaveNewVerificaRequestDTO setData(VerificaGiacenzeDTO data) {
this.data = data;
return this;
}
}

View File

@@ -0,0 +1,38 @@
package it.integry.integrywmsnative.core.rest.model.pv;
import java.time.LocalDateTime;
public class UpdateRowVerificaRequestDTO {
private String codMdep;
private LocalDateTime dataVerifica;
private VerificaGiacenzeRowDTO row;
public String getCodMdep() {
return codMdep;
}
public UpdateRowVerificaRequestDTO setCodMdep(String codMdep) {
this.codMdep = codMdep;
return this;
}
public LocalDateTime getDataVerifica() {
return dataVerifica;
}
public UpdateRowVerificaRequestDTO setDataVerifica(LocalDateTime dataVerifica) {
this.dataVerifica = dataVerifica;
return this;
}
public VerificaGiacenzeRowDTO getRow() {
return row;
}
public UpdateRowVerificaRequestDTO setRow(VerificaGiacenzeRowDTO row) {
this.row = row;
return this;
}
}

View File

@@ -0,0 +1,29 @@
package it.integry.integrywmsnative.core.rest.model.uds;
import java.util.List;
import it.integry.integrywmsnative.core.model.OrdineInevasoDTO;
public class RetrieveAlreadyRegisteredUdsRequestDTO {
private List<? extends OrdineInevasoDTO> ordini;
private int segno;
public List<? extends OrdineInevasoDTO> getOrdini() {
return ordini;
}
public RetrieveAlreadyRegisteredUdsRequestDTO setOrdini(List<? extends OrdineInevasoDTO> ordini) {
this.ordini = ordini;
return this;
}
public int getSegno() {
return segno;
}
public RetrieveAlreadyRegisteredUdsRequestDTO setSegno(int segno) {
this.segno = segno;
return this;
}
}

View File

@@ -0,0 +1,19 @@
package it.integry.integrywmsnative.core.rest.model.uds;
import java.util.List;
import it.integry.integrywmsnative.core.model.dto.AlreadyRegisteredUlDTO;
public class RetrieveAlreadyRegisteredUdsResponseDTO {
private List<AlreadyRegisteredUlDTO> udsList;
public List<AlreadyRegisteredUlDTO> getUdsList() {
return udsList;
}
public RetrieveAlreadyRegisteredUdsResponseDTO setUdsList(List<AlreadyRegisteredUlDTO> udsList) {
this.udsList = udsList;
return this;
}
}

View File

@@ -0,0 +1,16 @@
package it.integry.integrywmsnative.core.rest.serializer;
import androidx.lifecycle.MutableLiveData;
import com.google.gson.JsonElement;
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;
import java.lang.reflect.Type;
public class MutableLiveDataSerializer implements JsonSerializer<MutableLiveData<?>> {
@Override
public JsonElement serialize(MutableLiveData<?> src, Type typeOfSrc, JsonSerializationContext context) {
return context.serialize(src.getValue());
}
}

View File

@@ -12,7 +12,11 @@ import it.integry.integrywmsnative.core.utility.UtilityString;
public class ServerStatusChecker { public class ServerStatusChecker {
private static final ServerStatusChecker instance = new ServerStatusChecker();
private final Handler handler;
private final List<RunnableArgs<Boolean>> mCallback = new ArrayList<>(); private final List<RunnableArgs<Boolean>> mCallback = new ArrayList<>();
@@ -26,7 +30,29 @@ public class ServerStatusChecker {
private final long MILLIS_DELAY = 5 * 1000; private final long MILLIS_DELAY = 5 * 1000;
private final Handler handler = new Handler(); public ServerStatusChecker(Handler handler) {
this.handler = handler;
}
public void addCallback(RunnableArgs<Boolean> callback) {
this.mCallback.add(callback);
}
public void removeCallback(RunnableArgs<Boolean> callback) {
this.mCallback.remove(callback);
}
public void init() {
this.shouldExecute = true;
this.handler.post(this.runnableCode);
}
public void dispose() {
this.shouldExecute = false;
}
private final Runnable runnableCode = new Runnable() { private final Runnable runnableCode = new Runnable() {
@Override @Override
public void run() { public void run() {
@@ -42,27 +68,4 @@ public class ServerStatusChecker {
} }
}; };
public void addCallback(RunnableArgs<Boolean> callback) {
this.mCallback.add(callback);
}
public void removeCallback(RunnableArgs<Boolean> callback) {
this.mCallback.remove(callback);
}
public static void init() {
instance.shouldExecute = true;
instance.handler.post(instance.runnableCode);
}
public static void dispose() {
instance.shouldExecute = false;
}
public static ServerStatusChecker getInstance() {
return instance;
}
} }

View File

@@ -16,7 +16,6 @@ import it.integry.integrywmsnative.core.model.MtbColt;
import it.integry.integrywmsnative.core.model.MtbDepoPosizione; import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
import it.integry.integrywmsnative.core.model.MvwSitArtUdcDetInventario; import it.integry.integrywmsnative.core.model.MvwSitArtUdcDetInventario;
import it.integry.integrywmsnative.core.rest.consumers.GiacenzaRESTConsumer; import it.integry.integrywmsnative.core.rest.consumers.GiacenzaRESTConsumer;
import it.integry.integrywmsnative.core.utility.UtilityDate;
@Singleton @Singleton
public class InventarioService { public class InventarioService {
@@ -48,7 +47,7 @@ public class InventarioService {
MtbColt mtbColt = new MtbColt(); MtbColt mtbColt = new MtbColt();
mtbColt.setGestione(inventario.getGestione()); mtbColt.setGestione(inventario.getGestione());
mtbColt.setDataCollo(UtilityDate.toDate(inventario.getDataCollo())); mtbColt.setDataCollo(inventario.getDataCollo());
mtbColt.setSerCollo(inventario.getSerCollo()); mtbColt.setSerCollo(inventario.getSerCollo());
mtbColt.setNumCollo(inventario.getNumCollo()); mtbColt.setNumCollo(inventario.getNumCollo());
mtbColt.setSegno(inventario.getSegno()); mtbColt.setSegno(inventario.getSegno());
@@ -71,7 +70,7 @@ public class InventarioService {
MtbColr mtbColr = new MtbColr(); MtbColr mtbColr = new MtbColr();
mtbColr.setGestione(inventario.getGestione()); mtbColr.setGestione(inventario.getGestione());
mtbColr.setDataCollo(UtilityDate.toDate(inventario.getDataCollo())); mtbColr.setDataCollo(inventario.getDataCollo());
mtbColr.setSerCollo(inventario.getSerCollo()); mtbColr.setSerCollo(inventario.getSerCollo());
mtbColr.setNumCollo(inventario.getNumCollo()); mtbColr.setNumCollo(inventario.getNumCollo());
mtbColr.setCodMart(inventario.getCodMart()); mtbColr.setCodMart(inventario.getCodMart());

View File

@@ -96,7 +96,11 @@ public class DBSettingsModel {
private boolean flagEnableArtCreation; private boolean flagEnableArtCreation;
private List<String> allowedCodMgrpForArtCreation; private List<String> allowedCodMgrpForArtCreation;
private boolean flagAccettazioneGroupListForn = false; private boolean flagAccettazioneGroupListForn = false;
private boolean flagSpedizioneEnableFastPicking = false;
private boolean flagAccettazioneBollaEditableQtaTot = true;
private boolean flagViewSwitchDepoButton = true;
private boolean flagProduzioneSkipAskVersamentoAutomatico;
private boolean flagAccettazioneViewLotto = false;
public boolean isFlagSpedizioneEnableFakeGiacenza() { public boolean isFlagSpedizioneEnableFakeGiacenza() {
return flagSpedizioneEnableFakeGiacenza; return flagSpedizioneEnableFakeGiacenza;
} }
@@ -806,4 +810,46 @@ public class DBSettingsModel {
public void setFlagAccettazioneGroupListForn(boolean flagAccettazioneGroupListForn) { public void setFlagAccettazioneGroupListForn(boolean flagAccettazioneGroupListForn) {
this.flagAccettazioneGroupListForn = flagAccettazioneGroupListForn; this.flagAccettazioneGroupListForn = flagAccettazioneGroupListForn;
} }
public boolean isFlagSpedizioneEnableFastPicking() {
return flagSpedizioneEnableFastPicking;
}
public void setFlagSpedizioneEnableFastPicking(boolean flagSpedizioneEnableFastPicking) {
this.flagSpedizioneEnableFastPicking = flagSpedizioneEnableFastPicking;
}
public boolean isFlagAccettazioneBollaEditableQtaTot() {
return flagAccettazioneBollaEditableQtaTot;
}
public void setFlagAccettazioneBollaEditableQtaTot(boolean flagAccettazioneBollaEditableQtaTot) {
this.flagAccettazioneBollaEditableQtaTot = flagAccettazioneBollaEditableQtaTot;
}
public boolean isFlagViewSwitchDepoButton() {
return flagViewSwitchDepoButton;
}
public void setFlagViewSwitchDepoButton(boolean flagViewSwitchDepoButton) {
this.flagViewSwitchDepoButton = flagViewSwitchDepoButton;
}
public boolean isFlagProduzioneSkipAskVersamentoAutomatico() {
return flagProduzioneSkipAskVersamentoAutomatico;
}
public DBSettingsModel setFlagProduzioneSkipAskVersamentoAutomatico(boolean flagProduzioneSkipAskVersamentoAutomatico) {
this.flagProduzioneSkipAskVersamentoAutomatico = flagProduzioneSkipAskVersamentoAutomatico;
return this;
}
public boolean isFlagAccettazioneViewLotto() {
return flagAccettazioneViewLotto;
}
public DBSettingsModel setFlagAccettazioneViewLotto(boolean flagAccettazioneViewLotto) {
this.flagAccettazioneViewLotto = flagAccettazioneViewLotto;
return this;
}
} }

View File

@@ -39,8 +39,6 @@ public class SettingsManager {
private static SettingsModel settingsModelIstance; private static SettingsModel settingsModelIstance;
private static DBSettingsModel dbSettingsModelIstance; private static DBSettingsModel dbSettingsModelIstance;
private static boolean firstStart = false;
private static Context mContext; private static Context mContext;
private static SystemRESTConsumer mSystemRESTConsumer; private static SystemRESTConsumer mSystemRESTConsumer;
private static ImballiRESTConsumer mImballiRESTConsumer; private static ImballiRESTConsumer mImballiRESTConsumer;
@@ -65,15 +63,15 @@ public class SettingsManager {
public void init() { public void init() {
settingsModelIstance = (SettingsModel) Stash.getObject(TAG, SettingsModel.class); settingsModelIstance = (SettingsModel) Stash.getObject(TAG, SettingsModel.class);
if (settingsModelIstance == null) { if (settingsModelIstance == null)
settingsModelIstance = new SettingsModel(); settingsModelIstance = new SettingsModel();
if (settingsModelIstance.getServer() == null)
settingsModelIstance.setServer(new SettingsModel.Server()); settingsModelIstance.setServer(new SettingsModel.Server());
firstStart = true;
}
dbSettingsModelIstance = new DBSettingsModel(); dbSettingsModelIstance = new DBSettingsModel();
} }
public SettingsModel getSettings() { public SettingsModel getSettings() {
@@ -89,10 +87,6 @@ public class SettingsManager {
return dbSettingsModelIstance; return dbSettingsModelIstance;
} }
public static boolean isFirstStart() {
return firstStart;
}
public static boolean isInstanceAvailable() { public static boolean isInstanceAvailable() {
return i() != null; return i() != null;
} }
@@ -102,136 +96,111 @@ public class SettingsManager {
} }
public static void loadDBVariables(RunnableArgs<String> onProgress, Runnable onComplete, RunnableArgs<Exception> onFailed) { public static void loadDBVariables(RunnableArgs<String> onProgress) throws Exception {
dbSettingsModelIstance = new DBSettingsModel(); dbSettingsModelIstance = new DBSettingsModel();
Trace perfTrace = UtilityFirebase.getNewPerformanceTrace("db_load_vars"); Trace perfTrace = UtilityFirebase.getNewPerformanceTrace("db_load_vars");
perfTrace.start(); perfTrace.start();
Runnable tmpOnComplete = () -> { try {
perfTrace.stop(); onProgress.run("depositi");
onComplete.run(); loadAvailableCodMdeps();
};
RunnableArgs<Exception> tmpOnFailed = ex -> {
UtilityLogger.error(ex);
perfTrace.putAttribute("failed", "true");
if (!(ex instanceof SocketTimeoutException)) onFailed.run(ex);
else
onFailed.run(new Exception("Errore durante il caricamento dei dati. Riavviare l'applicazione!"));
};
onProgress.run("depositi");
loadAvailableCodMdeps(() -> {
onProgress.run("posizioni"); onProgress.run("posizioni");
loadAvailablePosizioni(() -> { loadAvailablePosizioni();
onProgress.run("impostazioni");
loadGestSetupValues(() -> {
onProgress.run("dati azienda"); onProgress.run("impostazioni");
loadDatiAzienda(() -> { loadGestSetupValues();
loadTipiCollo(tmpOnComplete, tmpOnFailed);
}, tmpOnFailed); onProgress.run("dati azienda");
}, tmpOnFailed); loadDatiAzienda();
}, tmpOnFailed); loadTipiCollo();
}, tmpOnFailed);
perfTrace.stop();
} catch (Exception ex) {
UtilityLogger.error(ex);
perfTrace.putAttribute("failed", "true");
if (!(ex instanceof SocketTimeoutException))
throw ex;
else
throw new Exception("Errore durante il caricamento dei dati. Riavviare l'applicazione!");
}
} }
private static void loadTipiCollo(Runnable onComplete, RunnableArgs<Exception> onFailed) { private static void loadTipiCollo() throws Exception {
mImballiRESTConsumer.retrieveImballi(MtbTCol.FlagUiUlEnum.UL, tipiColloUl -> { var tipiColloUl = mImballiRESTConsumer.retrieveImballiSyncronized(MtbTCol.FlagUiUlEnum.UL);
mImballiRESTConsumer.retrieveImballi(MtbTCol.FlagUiUlEnum.UI, tipiColloUi -> { var tipiColloUi = mImballiRESTConsumer.retrieveImballiSyncronized(MtbTCol.FlagUiUlEnum.UI);
var imballiList = new ObservableArrayList<ObservableMtbTcol>(); var imballiList = new ObservableArrayList<ObservableMtbTcol>();
imballiList.addAll(tipiColloUi);
imballiList.addAll(tipiColloUl);
SettingsManager.iDB().setInternalImballi(imballiList); imballiList.addAll(tipiColloUi);
onComplete.run(); imballiList.addAll(tipiColloUl);
}, onFailed);
}, onFailed);
SettingsManager.iDB().setInternalImballi(imballiList);
} }
private static void loadDatiAzienda(Runnable onComplete, RunnableArgs<Exception> onFailed) { private static void loadDatiAzienda() throws Exception {
mAziendaRESTConsumer.retrieveAzienda(datiAzienda -> { var datiAzienda = mAziendaRESTConsumer.retrieveAziendaSynchronized();
SettingsManager.iDB().setDatiAzienda(datiAzienda);
if (!SettingsManager.iDB().isFlagUseCodAnagAziendale()) { SettingsManager.iDB().setDatiAzienda(datiAzienda);
onComplete.run();
return;
}
String internalCodAnagsQuery = "SELECT ga.cod_anag,\n" + if (!SettingsManager.iDB().isFlagUseCodAnagAziendale()) {
" CAST(CASE WHEN vc.cod_anag IS NOT NULL THEN 1 ELSE 0 END AS BIT) AS is_cliente,\n" + return;
" CAST(CASE WHEN af.cod_anag IS NOT NULL THEN 1 ELSE 0 END AS BIT) AS is_fornitore\n" + }
"FROM azienda\n" +
"INNER JOIN gtb_anag ga on azienda.part_iva = ga.part_iva\n" +
"LEFT OUTER JOIN vtb_clie vc on ga.cod_anag = vc.cod_anag AND vc.flag_stato = 'A'\n" +
"LEFT OUTER JOIN atb_forn af on ga.cod_anag = af.cod_anag AND af.flag_stato = 'A'";
Type type = new TypeToken<List<InternalCodAnagsDTO>>() { String internalCodAnagsQuery = "SELECT ga.cod_anag,\n" +
}.getType(); " CAST(CASE WHEN vc.cod_anag IS NOT NULL THEN 1 ELSE 0 END AS BIT) AS is_cliente,\n" +
mSystemRESTConsumer.<List<InternalCodAnagsDTO>>processSql(internalCodAnagsQuery, type, internalCodAnagsList -> { " CAST(CASE WHEN af.cod_anag IS NOT NULL THEN 1 ELSE 0 END AS BIT) AS is_fornitore\n" +
SettingsManager.iDB().setInternalCodAnags(internalCodAnagsList); "FROM azienda\n" +
"INNER JOIN gtb_anag ga on azienda.part_iva = ga.part_iva\n" +
"LEFT OUTER JOIN vtb_clie vc on ga.cod_anag = vc.cod_anag AND vc.flag_stato = 'A'\n" +
"LEFT OUTER JOIN atb_forn af on ga.cod_anag = af.cod_anag AND af.flag_stato = 'A'";
if (onComplete != null) onComplete.run(); Type type = new TypeToken<List<InternalCodAnagsDTO>>() {
}, onFailed); }.getType();
var internalCodAnagsList = mSystemRESTConsumer.<List<InternalCodAnagsDTO>>processSqlSynchronized(internalCodAnagsQuery, type);
}, onFailed); SettingsManager.iDB().setInternalCodAnags(internalCodAnagsList);
} }
private static void loadAvailableCodMdeps(Runnable onComplete, RunnableArgs<Exception> onFailed) { private static void loadAvailableCodMdeps() throws Exception {
mSystemRESTConsumer.getAvailableCodMdeps(availableCodMdeps -> { var availableCodMdeps = mSystemRESTConsumer.getAvailableCodMdepsSynchronized();
dbSettingsModelIstance.setAvailableCodMdep(availableCodMdeps);
if (availableCodMdeps == null || availableCodMdeps.isEmpty()) { dbSettingsModelIstance.setAvailableCodMdep(availableCodMdeps);
onFailed.run(new Exception(mContext.getText(R.string.no_codmdep_available).toString()));
return;
}
boolean codMdepExistsAnymore = false; if (availableCodMdeps == null || availableCodMdeps.isEmpty()) {
throw new Exception(mContext.getText(R.string.no_codmdep_available).toString());
}
if (settingsModelIstance.getUserSession().getDepo() != null) { boolean codMdepExistsAnymore = false;
for (AvailableCodMdepsDTO availableCodMdepDTO : availableCodMdeps) {
//Controllo se il codMdep salvato esiste ancora if (settingsModelIstance.getUserSession().getDepo() != null) {
if (availableCodMdepDTO.getCodMdep().equalsIgnoreCase(settingsModelIstance.getUserSession().getDepo().getCodMdep())) { for (AvailableCodMdepsDTO availableCodMdepDTO : availableCodMdeps) {
codMdepExistsAnymore = true; //Controllo se il codMdep salvato esiste ancora
break; if (availableCodMdepDTO.getCodMdep().equalsIgnoreCase(settingsModelIstance.getUserSession().getDepo().getCodMdep())) {
} codMdepExistsAnymore = true;
break;
} }
} }
}
if (!codMdepExistsAnymore) { if (!codMdepExistsAnymore) {
settingsModelIstance.getUserSession().setDepo(availableCodMdeps.get(0)); settingsModelIstance.getUserSession().setDepo(availableCodMdeps.get(0));
} }
if (onComplete != null) onComplete.run();
}, ex -> {
//BOH
if (onFailed != null) onFailed.run(ex);
});
} }
private static void loadAvailablePosizioni(Runnable onComplete, RunnableArgs<Exception> onFailed) { private static void loadAvailablePosizioni() throws Exception {
mPosizioniRESTConsumer.getAvailablePosizioni(availablePosizioni -> { var availablePosizioni = mPosizioniRESTConsumer.getAvailablePosizioniSynchronized();
dbSettingsModelIstance.setAvailablePosizioni(availablePosizioni); dbSettingsModelIstance.setAvailablePosizioni(availablePosizioni);
if (onComplete != null) onComplete.run();
}, ex -> {
if (onFailed != null) onFailed.run(ex);
}
);
} }
private static void loadGestSetupValues(Runnable onComplete, RunnableArgs<Exception> onFailed) { private static void loadGestSetupValues() throws Exception {
List<StbGestSetupReader> stbGestSetupReaderList = new ArrayList<>(); List<StbGestSetupReader> stbGestSetupReaderList = new ArrayList<>();
@@ -285,6 +254,11 @@ public class SettingsManager {
.setSection("ACCETTAZIONE") .setSection("ACCETTAZIONE")
.setKeySection("FLAG_DELETE_ROW_ON_CLOSE") .setKeySection("FLAG_DELETE_ROW_ON_CLOSE")
.setSetter(dbSettingsModelIstance::setFlagAccettazioneDeleteRowOnClose)); .setSetter(dbSettingsModelIstance::setFlagAccettazioneDeleteRowOnClose));
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
.setGestName("PICKING")
.setSection("ACCETTAZIONE")
.setKeySection("FLAG_VIEW_LOTTO")
.setSetter(dbSettingsModelIstance::setFlagAccettazioneViewLotto));
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class) stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
.setGestName("PICKING") .setGestName("PICKING")
.setSection("SPEDIZIONE") .setSection("SPEDIZIONE")
@@ -332,6 +306,12 @@ public class SettingsManager {
.setSection("PRODUZIONE") .setSection("PRODUZIONE")
.setKeySection("VIEW_POSIZIONI") .setKeySection("VIEW_POSIZIONI")
.setSetter(dbSettingsModelIstance::setViewPosizioni)); .setSetter(dbSettingsModelIstance::setViewPosizioni));
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
.setGestName("PICKING")
.setSection("PRODUZIONE")
.setKeySection("FLAG_SKIP_ASK_VERSAMENTO_AUTOMATICO")
.setSetter(dbSettingsModelIstance::setFlagProduzioneSkipAskVersamentoAutomatico)
.setDefaultValue(false));
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class) stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
.setGestName("PICKING") .setGestName("PICKING")
.setSection("SPEDIZIONE") .setSection("SPEDIZIONE")
@@ -583,6 +563,18 @@ public class SettingsManager {
.setKeySection("ENABLE_POSITION_CHANGE_REQUEST") .setKeySection("ENABLE_POSITION_CHANGE_REQUEST")
.setSetter(dbSettingsModelIstance::setFlagPositionChangeRequest) .setSetter(dbSettingsModelIstance::setFlagPositionChangeRequest)
.setDefaultValue(true)); .setDefaultValue(true));
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
.setGestName("PICKING")
.setSection("SPEDIZIONE")
.setKeySection("ENABLE_FAST_PICKING")
.setSetter(dbSettingsModelIstance::setFlagSpedizioneEnableFastPicking)
.setDefaultValue(false));
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
.setGestName("PICKING")
.setSection("ACCETTAZIONE_BOLLA")
.setKeySection("FLAG_QTA_TOT_EDITABLE")
.setSetter(dbSettingsModelIstance::setFlagAccettazioneBollaEditableQtaTot)
.setDefaultValue(true));
stbGestSetupReaderList.add(new StbGestSetupReader<>(String.class) stbGestSetupReaderList.add(new StbGestSetupReader<>(String.class)
.setGestName("PICKING") .setGestName("PICKING")
@@ -636,6 +628,13 @@ public class SettingsManager {
.setKeySection("ENABLE_ART_CREATION") .setKeySection("ENABLE_ART_CREATION")
.setSetter(dbSettingsModelIstance::setFlagEnableArtCreation)); .setSetter(dbSettingsModelIstance::setFlagEnableArtCreation));
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
.setGestName("PICKING")
.setSection("SETUP")
.setKeySection("VIEW_SWITCH_DEPO_BUTTON")
.setSetter(dbSettingsModelIstance::setFlagViewSwitchDepoButton)
);
stbGestSetupReaderList.add(new StbGestSetupReader<>(String.class) stbGestSetupReaderList.add(new StbGestSetupReader<>(String.class)
.setGestName("PICKING") .setGestName("PICKING")
.setSection("SETUP") .setSection("SETUP")
@@ -648,34 +647,33 @@ public class SettingsManager {
String codMdep = SettingsManager.i().getUserSession().getDepo().getCodMdep(); String codMdep = SettingsManager.i().getUserSession().getDepo().getCodMdep();
mGestSetupRESTConsumer.getValues(codMdep, stbGestSetupReaderList, list -> { var list = mGestSetupRESTConsumer.getValuesSynchronized(codMdep, stbGestSetupReaderList);
for (var stbGestSetupReader : list) {
var value = stbGestSetupReader.getValue();
var clazz = stbGestSetupReader.getClazz();
Object finalValue = null; for (var stbGestSetupReader : list) {
if (value != null) { var value = stbGestSetupReader.getValue();
if (clazz == String.class) { var clazz = stbGestSetupReader.getClazz();
finalValue = clazz.cast(value);
} else if (clazz == Boolean.class) {
finalValue = clazz.cast("S".equalsIgnoreCase(value));
} else if (clazz == Integer.class && value != null) {
finalValue = clazz.cast(Integer.parseInt(value));
}
} else if (stbGestSetupReader.getDefaultValue() == null) {
if (clazz == Boolean.class) {
finalValue = clazz.cast(Boolean.FALSE);
} else if (clazz == Integer.class) {
finalValue = clazz.cast(0);
}
} else finalValue = stbGestSetupReader.getDefaultValue();
stbGestSetupReader.getSetter().run(finalValue); Object finalValue = null;
} if (value != null) {
if (clazz == String.class) {
finalValue = clazz.cast(value);
} else if (clazz == Boolean.class) {
finalValue = clazz.cast("S".equalsIgnoreCase(value));
} else if (clazz == Integer.class && value != null) {
finalValue = clazz.cast(Integer.parseInt(value));
}
} else if (stbGestSetupReader.getDefaultValue() == null) {
if (clazz == Boolean.class) {
finalValue = clazz.cast(Boolean.FALSE);
} else if (clazz == Integer.class) {
finalValue = clazz.cast(0);
}
} else finalValue = stbGestSetupReader.getDefaultValue();
stbGestSetupReader.getSetter().run(finalValue);
}
if (onComplete != null) onComplete.run();
}, onFailed);
} }

View File

@@ -0,0 +1,29 @@
package it.integry.integrywmsnative.core.utility;
import android.text.method.DigitsKeyListener;
import java.text.DecimalFormatSymbols;
import java.util.Locale;
/**
* KeyListener personalizzato che accetta numeri decimali
* usando il separatore decimale del locale corrente (virgola per italiano)
*/
public class LocaleDecimalKeyListener {
/**
* Ottiene un'istanza del KeyListener per il locale corrente
*/
public static DigitsKeyListener getInstance() {
return getInstance(Locale.getDefault());
}
/**
* Ottiene un'istanza del KeyListener per un locale specifico
*/
public static DigitsKeyListener getInstance(Locale locale) {
DecimalFormatSymbols symbols = new DecimalFormatSymbols(locale);
char decimalSeparator = symbols.getDecimalSeparator();
return DigitsKeyListener.getInstance("0123456789" + decimalSeparator);
}
}

View File

@@ -2,7 +2,6 @@ package it.integry.integrywmsnative.core.utility;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import com.annimon.stream.Stream;
import com.google.zxing.BarcodeFormat; import com.google.zxing.BarcodeFormat;
import com.google.zxing.EncodeHintType; import com.google.zxing.EncodeHintType;
import com.google.zxing.MultiFormatWriter; import com.google.zxing.MultiFormatWriter;
@@ -12,6 +11,7 @@ import com.journeyapps.barcodescanner.BarcodeEncoder;
import java.util.Calendar; import java.util.Calendar;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.stream.Stream;
import it.integry.barcode_base_android_library.model.BarcodeScanDTO; import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
import it.integry.barcode_base_android_library.model.BarcodeType; import it.integry.barcode_base_android_library.model.BarcodeType;
@@ -61,7 +61,7 @@ public class UtilityBarcode {
boolean isPosizione = false; boolean isPosizione = false;
if (SettingsManager.iDB().getAvailablePosizioni() != null) { if (SettingsManager.iDB().getAvailablePosizioni() != null) {
Stream<MtbDepoPosizione> tmpStream = Stream.of(SettingsManager.iDB().getAvailablePosizioni()) Stream<MtbDepoPosizione> tmpStream = SettingsManager.iDB().getAvailablePosizioni().stream()
.filter(x -> x.getPosizione().equalsIgnoreCase(barcode) && (!enableCheckCodMdep || currentCodMdep.equalsIgnoreCase(x.getCodMdep()))); .filter(x -> x.getPosizione().equalsIgnoreCase(barcode) && (!enableCheckCodMdep || currentCodMdep.equalsIgnoreCase(x.getCodMdep())));
if (tmpStream.count() > 0) { if (tmpStream.count() > 0) {
@@ -78,7 +78,7 @@ public class UtilityBarcode {
public static boolean isEanPeso(BarcodeScanDTO barcodeScanDTO) { public static boolean isEanPeso(BarcodeScanDTO barcodeScanDTO) {
return (isEtichetta128(barcodeScanDTO) || isEan13(barcodeScanDTO)) && barcodeScanDTO.getStringValue().startsWith("2"); return (isEtichetta128(barcodeScanDTO) || isEan13(barcodeScanDTO)) && barcodeScanDTO.getStringValue().length() == 13 && barcodeScanDTO.getStringValue().startsWith("2");
} }
public static boolean isEan8(BarcodeScanDTO barcodeScanDTO) { public static boolean isEan8(BarcodeScanDTO barcodeScanDTO) {

View File

@@ -41,6 +41,19 @@ public class UtilityDate {
public static final String DM_HUMAN = "dd MMM"; public static final String DM_HUMAN = "dd MMM";
public static final String DMY_HUMAN = "dd MMM yyyy"; public static final String DMY_HUMAN = "dd MMM yyyy";
public static final String DMY_HUMAN_LONG = "dd MMMM yyyy"; public static final String DMY_HUMAN_LONG = "dd MMMM yyyy";
public static final DateTimeFormatter DATE_DMY_SLASHED_FORMATTER = DateTimeFormatter.ofPattern(DMY_SLASH)
.withZone(ZoneId.systemDefault());
public static final DateTimeFormatter DATETIME_DMY_SLASHED_FORMATTER = DateTimeFormatter.ofPattern(DMY_TIME_SLASH)
.withZone(ZoneId.systemDefault());
public static final DateTimeFormatter DATE_DMY_HUMAN_FORMATTER = DateTimeFormatter.ofPattern(DMY_HUMAN_LONG)
.withZone(ZoneId.systemDefault());
} }
public static Date recognizeDateWithExceptionHandler(String dateString) { public static Date recognizeDateWithExceptionHandler(String dateString) {

View File

@@ -40,4 +40,5 @@ public class UtilityDialog {
// dialog.getWindow().setLayout(width, LinearLayout.LayoutParams.WRAP_CONTENT); // dialog.getWindow().setLayout(width, LinearLayout.LayoutParams.WRAP_CONTENT);
// } // }
} }

View File

@@ -10,6 +10,7 @@ import com.google.firebase.crashlytics.FirebaseCrashlytics;
import com.orhanobut.logger.Logger; import com.orhanobut.logger.Logger;
import it.integry.integrywmsnative.BuildConfig; import it.integry.integrywmsnative.BuildConfig;
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
import it.integry.integrywmsnative.core.exception.InvalidConnectionException; import it.integry.integrywmsnative.core.exception.InvalidConnectionException;
import it.integry.integrywmsnative.core.exception.InvalidLUException; import it.integry.integrywmsnative.core.exception.InvalidLUException;
import it.integry.integrywmsnative.core.exception.InvalidLUGestioneException; import it.integry.integrywmsnative.core.exception.InvalidLUGestioneException;
@@ -19,11 +20,12 @@ import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
public class UtilityExceptions { public class UtilityExceptions {
private static final Class<?>[] FIREBASE_IGNORED_EXCEPTIONS = new Class[] { private static final Class<?>[] FIREBASE_IGNORED_EXCEPTIONS = new Class[]{
InvalidConnectionException.class, InvalidConnectionException.class,
InvalidLUGestioneException.class, InvalidLUGestioneException.class,
InvalidLUException.class InvalidLUException.class
}; };
public static void defaultException(Context context, Exception ex) { public static void defaultException(Context context, Exception ex) {
defaultException(context, ex, false); defaultException(context, ex, false);
} }
@@ -47,7 +49,11 @@ public class UtilityExceptions {
FragmentManager fm = ContextHelper.getFragmentManagerFromContext(context); FragmentManager fm = ContextHelper.getFragmentManagerFromContext(context);
if (fm != null) { if (fm != null) {
DialogSimpleMessageView.makeErrorDialog(Html.fromHtml(errorMessage), null, null) boolean isBarcodeEnabled = BarcodeManager.isLastCallbackEnabled();
if (isBarcodeEnabled) BarcodeManager.disableLastCallback();
DialogSimpleMessageView.makeErrorDialog(Html.fromHtml(errorMessage), null, () -> {
if (isBarcodeEnabled) BarcodeManager.enableLastCallback();
})
.show(fm, "tag"); .show(fm, "tag");
} }

View File

@@ -1,5 +1,7 @@
package it.integry.integrywmsnative.core.utility; package it.integry.integrywmsnative.core.utility;
import androidx.lifecycle.MutableLiveData;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.GsonBuilder; import com.google.gson.GsonBuilder;
@@ -12,10 +14,12 @@ import it.integry.integrywmsnative.core.model.secondary.StatoPartitaMag;
import it.integry.integrywmsnative.core.rest.deserializer.LocalDateDeserializer; import it.integry.integrywmsnative.core.rest.deserializer.LocalDateDeserializer;
import it.integry.integrywmsnative.core.rest.deserializer.LocalDateTimeDeserializer; import it.integry.integrywmsnative.core.rest.deserializer.LocalDateTimeDeserializer;
import it.integry.integrywmsnative.core.rest.deserializer.MtbTcolFlagUiUlDeserializer; import it.integry.integrywmsnative.core.rest.deserializer.MtbTcolFlagUiUlDeserializer;
import it.integry.integrywmsnative.core.rest.deserializer.MutableLiveDataDeserializer;
import it.integry.integrywmsnative.core.rest.deserializer.StatoPartitaMagDeserializer; import it.integry.integrywmsnative.core.rest.deserializer.StatoPartitaMagDeserializer;
import it.integry.integrywmsnative.core.rest.serializer.LocalDateSerializer; import it.integry.integrywmsnative.core.rest.serializer.LocalDateSerializer;
import it.integry.integrywmsnative.core.rest.serializer.LocalDateTimeSerializer; import it.integry.integrywmsnative.core.rest.serializer.LocalDateTimeSerializer;
import it.integry.integrywmsnative.core.rest.serializer.MtbTcolFlagUiUlSerializer; import it.integry.integrywmsnative.core.rest.serializer.MtbTcolFlagUiUlSerializer;
import it.integry.integrywmsnative.core.rest.serializer.MutableLiveDataSerializer;
import it.integry.integrywmsnative.core.rest.serializer.StatoPartitaMagSerializer; import it.integry.integrywmsnative.core.rest.serializer.StatoPartitaMagSerializer;
public class UtilityGson { public class UtilityGson {
@@ -24,6 +28,8 @@ public class UtilityGson {
return new GsonBuilder() return new GsonBuilder()
.setDateFormat("dd/MM/yyyy HH:mm:ss") .setDateFormat("dd/MM/yyyy HH:mm:ss")
.excludeFieldsWithModifiers(Modifier.TRANSIENT) .excludeFieldsWithModifiers(Modifier.TRANSIENT)
.registerTypeAdapter(MutableLiveData.class, new MutableLiveDataDeserializer())
.registerTypeAdapter(MutableLiveData.class, new MutableLiveDataSerializer())
.registerTypeAdapter(LocalDate.class, new LocalDateDeserializer()) .registerTypeAdapter(LocalDate.class, new LocalDateDeserializer())
.registerTypeAdapter(LocalDate.class, new LocalDateSerializer()) .registerTypeAdapter(LocalDate.class, new LocalDateSerializer())
.registerTypeAdapter(LocalDateTime.class, new LocalDateTimeDeserializer()) .registerTypeAdapter(LocalDateTime.class, new LocalDateTimeDeserializer())

View File

@@ -1,6 +1,7 @@
package it.integry.integrywmsnative.core.utility; package it.integry.integrywmsnative.core.utility;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols; import java.text.DecimalFormatSymbols;
import java.util.Locale; import java.util.Locale;
@@ -9,7 +10,8 @@ import it.integry.integrywmsnative.core.CommonConst;
public class UtilityNumber { public class UtilityNumber {
private static DecimalFormat decimalFormatInstance; // Locale italiano per la formattazione
private static final Locale ITALIAN_LOCALE = new Locale("it", "IT");
public static String decimalToString(Float bigDecimal){ public static String decimalToString(Float bigDecimal){
if(bigDecimal == null) return "0"; if(bigDecimal == null) return "0";
@@ -23,71 +25,59 @@ public class UtilityNumber {
public static String decimalToString(BigDecimal bigDecimal, int decimal){ public static String decimalToString(BigDecimal bigDecimal, int decimal){
if(bigDecimal == null) return "0"; if(bigDecimal == null) return "0";
return decimalToString(bigDecimal.floatValue(), decimal);
// Usa stripTrailingZeros per rimuovere gli zeri finali
BigDecimal stripped = bigDecimal.stripTrailingZeros();
// Limita il numero di decimali visualizzati
int scale = Math.min(stripped.scale(), decimal);
stripped = stripped.setScale(scale, RoundingMode.DOWN);
// Configura il formato italiano con virgola come separatore decimale
DecimalFormatSymbols italianSymbols = new DecimalFormatSymbols(ITALIAN_LOCALE);
italianSymbols.setDecimalSeparator(',');
// Crea il pattern dinamico basato sul numero di decimali
StringBuilder patternBuilder = new StringBuilder("0");
if (scale > 0) {
patternBuilder.append(".");
for (int i = 0; i < scale; i++) {
patternBuilder.append("0");
}
}
DecimalFormat formatter = new DecimalFormat(patternBuilder.toString(), italianSymbols);
String result = formatter.format(stripped);
// Se il risultato termina con ',', rimuovilo (per i numeri interi)
if (result.endsWith(",")) {
result = result.substring(0, result.length() - 1);
}
return result;
} }
public static String decimalToString(float floatValue, int decimal) { public static String decimalToString(float floatValue, int decimal) {
DecimalFormatSymbols otherSymbols = new DecimalFormatSymbols(Locale.getDefault()); return decimalToString(BigDecimal.valueOf(floatValue), decimal);
otherSymbols.setDecimalSeparator('.');
otherSymbols.setGroupingSeparator(',');
final DecimalFormat decimalFormat = new DecimalFormat();
decimalFormat.setMaximumFractionDigits(decimal);
decimalFormat.setDecimalFormatSymbols(otherSymbols);
decimalFormat.setGroupingUsed(false);
decimalFormat.setMinimumFractionDigits(Math.min(2, decimal));
return decimalFormat.format(floatValue);
} }
public static DecimalFormat getNumberFormatInstance() { public static BigDecimal parseBigDecimal(String value, Locale locale) {
if (value == null || value.trim().isEmpty()) return null;
if(decimalFormatInstance == null) { try {
DecimalFormatSymbols otherSymbols = new DecimalFormatSymbols(Locale.getDefault()); DecimalFormatSymbols symbols = new DecimalFormatSymbols(locale);
otherSymbols.setDecimalSeparator('.'); DecimalFormat format = new DecimalFormat();
otherSymbols.setGroupingSeparator(','); format.setDecimalFormatSymbols(symbols);
format.setParseBigDecimal(true);
decimalFormatInstance = new DecimalFormat(); return (BigDecimal) format.parse(value);
decimalFormatInstance.setMaximumFractionDigits(CommonConst.Config.NUMBER_OF_DECIMAL_DIGITS); } catch (Exception e) {
decimalFormatInstance.setDecimalFormatSymbols(otherSymbols); return null;
decimalFormatInstance.setGroupingUsed(false);
} }
return decimalFormatInstance;
} }
public static int countNumberOfDecimalDigits(Float value) { /**
String text = getNumberFormatInstance().format(Math.abs(value)); * Parsa una stringa numerica italiana (con virgola come separatore decimale)
int integerPlaces = text.indexOf('.'); * e restituisce un BigDecimal
int decimalPlaces = text.length() - integerPlaces - 1; */
public static BigDecimal parseItalianBigDecimal(String value) {
return decimalPlaces; return parseBigDecimal(value, ITALIAN_LOCALE);
}
public static String normalizeStringNumber(String numberString) {
return numberString.replaceAll(",", ".");
}
public static Float decimalToFloat(BigDecimal bigDecimalValue) {
float multiplier = (float) Math.pow(10, CommonConst.Config.NUMBER_OF_DECIMAL_DIGITS);
Float floatValue = null;
if(bigDecimalValue != null) {
int intValue = (int) (bigDecimalValue.floatValue() * multiplier);
floatValue = Float.valueOf(intValue / multiplier);
}
return floatValue;
}
public static float truncateToDecimal(float v, int i) {
int delta = 10*i;
return ((int)v*delta)/delta;
} }
} }

View File

@@ -3,9 +3,15 @@ package it.integry.integrywmsnative.core.utility;
import android.content.Context; import android.content.Context;
import android.content.pm.PackageInfo; import android.content.pm.PackageInfo;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.content.res.ColorStateList;
import android.util.TypedValue;
import androidx.annotation.AttrRes;
import androidx.annotation.ColorInt;
import androidx.annotation.ColorRes;
import androidx.annotation.RawRes; import androidx.annotation.RawRes;
import androidx.annotation.StringRes; import androidx.annotation.StringRes;
import androidx.core.content.ContextCompat;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.IOException; import java.io.IOException;
@@ -69,4 +75,23 @@ public class UtilityResources {
return 0; return 0;
} }
// Funzione di utilità per ottenere un colore da un attributo del tema
public static @ColorRes int getColorResourceFromAttr(Context context, @AttrRes int attrRes) {
TypedValue typedValue = new TypedValue();
context.getTheme().resolveAttribute(attrRes, typedValue, true);
return typedValue.data;
}
public static @ColorInt int getColorFromAttr(Context context, @AttrRes int attrRes) {
return ContextCompat.getColor(context, getColorResourceFromAttr(context, attrRes));
}
public static ColorStateList getColorStateListFromAttr(Context context, @AttrRes int attrRes) {
return ColorStateList.valueOf(getColorResourceFromAttr(context, attrRes));
}
} }

View File

@@ -2,6 +2,7 @@ package it.integry.integrywmsnative.gest.accettazione_bolla_elenco.rest;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.inject.Singleton; import javax.inject.Singleton;
@@ -54,7 +55,7 @@ public class BolleAccettazioneRESTConsumer extends _BaseRESTConsumer {
.enqueue(new ManagedErrorCallback<>() { .enqueue(new ManagedErrorCallback<>() {
@Override @Override
public void onResponse(Call<ServiceRESTResponse<RetrieveElencoArticoliAccettazioneBollaResponseDTO>> call, Response<ServiceRESTResponse<RetrieveElencoArticoliAccettazioneBollaResponseDTO>> response) { public void onResponse(Call<ServiceRESTResponse<RetrieveElencoArticoliAccettazioneBollaResponseDTO>> call, Response<ServiceRESTResponse<RetrieveElencoArticoliAccettazioneBollaResponseDTO>> response) {
analyzeAnswer(response, "retrievePickingListBolle", data -> onComplete.run(data.getSitArticoli()), onFailed); analyzeAnswer(response, "retrievePickingListBolle", data -> onComplete.run(data.getSitArticoli() == null ? new ArrayList<>() : data.getSitArticoli()), onFailed);
} }
@Override @Override

View File

@@ -5,6 +5,7 @@ import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.res.Resources; import android.content.res.Resources;
import android.os.Bundle; import android.os.Bundle;
import android.text.Html;
import android.text.SpannableString; import android.text.SpannableString;
import android.view.Gravity; import android.view.Gravity;
@@ -41,7 +42,7 @@ import it.integry.integrywmsnative.core.expansion.RunnableArgss;
import it.integry.integrywmsnative.core.model.MtbAart; import it.integry.integrywmsnative.core.model.MtbAart;
import it.integry.integrywmsnative.core.model.MtbColr; import it.integry.integrywmsnative.core.model.MtbColr;
import it.integry.integrywmsnative.core.model.MtbColt; import it.integry.integrywmsnative.core.model.MtbColt;
import it.integry.integrywmsnative.core.model.dto.AlreadyRegisteredUDCDTO; import it.integry.integrywmsnative.core.model.dto.AlreadyRegisteredUlDTO;
import it.integry.integrywmsnative.core.model.observable.ObservableMtbTcol; import it.integry.integrywmsnative.core.model.observable.ObservableMtbTcol;
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum; import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
import it.integry.integrywmsnative.core.report.ReportManager; import it.integry.integrywmsnative.core.report.ReportManager;
@@ -98,7 +99,7 @@ public class AccettazioneBollaPickingActivity extends BaseActivity implements Ac
public BindableBoolean noLUPresent = new BindableBoolean(true); public BindableBoolean noLUPresent = new BindableBoolean(true);
public BindableBoolean bottomSheetEnabled = new BindableBoolean(false); public BindableBoolean bottomSheetEnabled = new BindableBoolean(false);
private int barcodeScannerIstanceID = -1; private int mBarcodeScannerInstanceID = -1;
private boolean mShowSecondaryUntMis = true; private boolean mShowSecondaryUntMis = true;
private boolean mShouldCloseActivity; private boolean mShouldCloseActivity;
private AccettazioneBollaPickingOrderBy.Enum mCurrentOrderBy; private AccettazioneBollaPickingOrderBy.Enum mCurrentOrderBy;
@@ -182,10 +183,10 @@ public class AccettazioneBollaPickingActivity extends BaseActivity implements Ac
this.mBindings.bottomSheetLuContent.collapse(); this.mBindings.bottomSheetLuContent.collapse();
} else if (!noLUPresent.get()) { } else if (!noLUPresent.get()) {
this.mShouldCloseActivity = true; this.mShouldCloseActivity = true;
BarcodeManager.removeCallback(barcodeScannerIstanceID); BarcodeManager.removeCallback(mBarcodeScannerInstanceID);
this.mViewModel.closeLU(); this.mViewModel.closeLU();
} else { } else {
BarcodeManager.removeCallback(barcodeScannerIstanceID); BarcodeManager.removeCallback(mBarcodeScannerInstanceID);
super.onBackPressed(); super.onBackPressed();
} }
} }
@@ -199,7 +200,7 @@ public class AccettazioneBollaPickingActivity extends BaseActivity implements Ac
} }
private void initBarcodeReader() { private void initBarcodeReader() {
barcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO() mBarcodeScannerInstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
.setOnScanSuccessful(onScanSuccessful) .setOnScanSuccessful(onScanSuccessful)
.setOnScanFailed(ex -> UtilityExceptions.defaultException(this, ex, false))); .setOnScanFailed(ex -> UtilityExceptions.defaultException(this, ex, false)));
} }
@@ -451,12 +452,12 @@ public class AccettazioneBollaPickingActivity extends BaseActivity implements Ac
dialog.show(); dialog.show();
} }
public void startListaBancaliRegistratiActivity(List<AlreadyRegisteredUDCDTO> mtbColts) { public void startListaBancaliRegistratiActivity(List<AlreadyRegisteredUlDTO> mtbColts) {
Intent myIntent = ListaBancaliActivity.createIntent(this, Intent myIntent = ListaBancaliActivity.createIntent(this,
Stream.of(mtbColts) Stream.of(mtbColts)
.map(AlreadyRegisteredUDCDTO::getMtbColt) .map(AlreadyRegisteredUlDTO::getMtbColt)
.toList(), .toList(),
input -> Stream.of(mtbColts) input -> Stream.of(mtbColts)
@@ -590,7 +591,7 @@ public class AccettazioneBollaPickingActivity extends BaseActivity implements Ac
UtilityExceptions.defaultException(this, ex); UtilityExceptions.defaultException(this, ex);
} }
BarcodeManager.enable(); BarcodeManager.enable(mBarcodeScannerInstanceID);
} }
@Override @Override
@@ -600,7 +601,7 @@ public class AccettazioneBollaPickingActivity extends BaseActivity implements Ac
totalQtaToBeTaken, BigDecimal totalNumCnfToBeTaken, BigDecimal qtaCnfToBeTaken, BigDecimal totalQtaToBeTaken, BigDecimal totalNumCnfToBeTaken, BigDecimal qtaCnfToBeTaken, BigDecimal
totalQtaAvailable, BigDecimal totalNumCnfAvailable, BigDecimal qtaCnfAvailable, String totalQtaAvailable, BigDecimal totalNumCnfAvailable, BigDecimal qtaCnfAvailable, String
partitaMag, LocalDate dataScad, boolean canPartitaMagBeChanged, partitaMag, LocalDate dataScad, boolean canPartitaMagBeChanged,
boolean canOverflowQuantity, RunnableArgss<PickedQuantityDTO, Boolean> onComplete) { boolean canOverflowQuantity, RunnableArgs<PickedQuantityDTO> onComplete) {
DialogInputQuantityV2DTO dialogInputQuantityV2DTO = new DialogInputQuantityV2DTO() DialogInputQuantityV2DTO dialogInputQuantityV2DTO = new DialogInputQuantityV2DTO()
.setMtbAart(mtbAart) .setMtbAart(mtbAart)
.setInitialNumCnf(initialNumCnf) .setInitialNumCnf(initialNumCnf)
@@ -608,7 +609,7 @@ public class AccettazioneBollaPickingActivity extends BaseActivity implements Ac
.setInitialQtaTot(initialQtaTot) .setInitialQtaTot(initialQtaTot)
.setTotalQtaOrd(totalQtaOrd) .setTotalQtaOrd(totalQtaOrd)
.setTotalNumCnfOrd(totalNumCnfOrd) .setTotalNumCnfOrd(totalNumCnfOrd)
.setQtaCnfOrd(qtaCnfOrd) .setTotalQtaCnfOrd(qtaCnfOrd)
.setTotalQtaToBeTaken(totalQtaToBeTaken) .setTotalQtaToBeTaken(totalQtaToBeTaken)
.setTotalNumCnfToBeTaken(totalNumCnfToBeTaken) .setTotalNumCnfToBeTaken(totalNumCnfToBeTaken)
.setQtaCnfToBeTaken(qtaCnfToBeTaken) .setQtaCnfToBeTaken(qtaCnfToBeTaken)
@@ -619,20 +620,26 @@ public class AccettazioneBollaPickingActivity extends BaseActivity implements Ac
.setDataScad(dataScad) .setDataScad(dataScad)
.setCanPartitaMagBeChanged(canPartitaMagBeChanged) .setCanPartitaMagBeChanged(canPartitaMagBeChanged)
.setCanLUBeClosed(true) .setCanLUBeClosed(true)
.setQtaTotEditable(SettingsManager.iDB().isFlagAccettazioneBollaEditableQtaTot())
.setCanOverflowOrderQuantity(canOverflowQuantity) .setCanOverflowOrderQuantity(canOverflowQuantity)
.setDisableTracciabilitaCheck(SettingsManager.iDB().isFlagAccettazioneBollaDisableMandatoryTracciabilita()); .setDisableTracciabilitaCheck(SettingsManager.iDB().isFlagAccettazioneBollaDisableMandatoryTracciabilita());
if (!mDialogInputQuantityV2View.isVisible()) if (!mDialogInputQuantityV2View.isVisible())
mDialogInputQuantityV2View mDialogInputQuantityV2View
.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO) .setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
.setOnComplete((resultDTO, shouldCloseLU) -> { .setOnComplete(resultDTO -> {
if(resultDTO.isAborted()) {
this.mViewModel.resetMatchedRows();
return;
}
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO() PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO()
.setNumCnf(resultDTO.getNumCnf()) .setNumCnf(resultDTO.getNumCnf())
.setQtaCnf(resultDTO.getQtaCnf()) .setQtaCnf(resultDTO.getQtaCnf())
.setQtaTot(resultDTO.getQtaTot()) .setQtaTot(resultDTO.getQtaTot())
.setPartitaMag(resultDTO.getPartitaMag()) .setPartitaMag(resultDTO.getPartitaMag())
.setDataScad(resultDTO.getDataScad()); .setDataScad(resultDTO.getDataScad());
onComplete.run(pickedQuantityDTO, shouldCloseLU); onComplete.run(pickedQuantityDTO);
}) })
.setOnAbort(() -> this.mViewModel.resetMatchedRows()) .setOnAbort(() -> this.mViewModel.resetMatchedRows())
.show(getSupportFragmentManager(), "tag"); .show(getSupportFragmentManager(), "tag");
@@ -690,4 +697,15 @@ public class AccettazioneBollaPickingActivity extends BaseActivity implements Ac
} }
} }
} }
@Override
public void onConfirmAnomalie(int anomalie, RunnableArgs<Boolean> onConfirm) {
DialogSimpleMessageView.makeWarningDialog(new SpannableString(Html.fromHtml(String.format(getString(R.string.confirm_anomalie), anomalie))),
null, () -> {
onConfirm.run(true);
}, () -> {
onConfirm.run(false);
})
.show(getSupportFragmentManager(), "tag");
}
} }

View File

@@ -30,7 +30,7 @@ import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingL
import it.integry.integrywmsnative.core.model.MtbAart; import it.integry.integrywmsnative.core.model.MtbAart;
import it.integry.integrywmsnative.core.model.MtbColr; import it.integry.integrywmsnative.core.model.MtbColr;
import it.integry.integrywmsnative.core.model.MtbColt; import it.integry.integrywmsnative.core.model.MtbColt;
import it.integry.integrywmsnative.core.model.dto.AlreadyRegisteredUDCDTO; import it.integry.integrywmsnative.core.model.dto.AlreadyRegisteredUlDTO;
import it.integry.integrywmsnative.core.model.dto.PickDataDTO; import it.integry.integrywmsnative.core.model.dto.PickDataDTO;
import it.integry.integrywmsnative.core.model.observable.ObservableMtbTcol; import it.integry.integrywmsnative.core.model.observable.ObservableMtbTcol;
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum; import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
@@ -160,7 +160,7 @@ public class AccettazioneBollaPickingViewModel {
} }
public void retrieveExistentLU(RunnableArgs<List<AlreadyRegisteredUDCDTO>> onComplete) { public void retrieveExistentLU(RunnableArgs<List<AlreadyRegisteredUlDTO>> onComplete) {
this.sendOnLoadingStarted(); this.sendOnLoadingStarted();
this.mAccettazioneBollaPickingRESTConsumer.retrieveAlreadyRegisteredUDC(this.mBolle, mtbColtList -> { this.mAccettazioneBollaPickingRESTConsumer.retrieveAlreadyRegisteredUDC(this.mBolle, mtbColtList -> {
@@ -305,8 +305,8 @@ public class AccettazioneBollaPickingViewModel {
private void loadArticolo(String barcodeProd, PickDataDTO pickData, Runnable onComplete) { private void loadArticolo(String barcodeProd, PickDataDTO pickData, Runnable onComplete) {
this.mArticoloRESTConsumer.searchByBarcode(barcodeProd, mtbAartList -> { this.mArticoloRESTConsumer.searchByBarcode(barcodeProd, mtbAartList -> {
if (mtbAartList != null && mtbAartList.size() > 0) { if (mtbAartList != null && !mtbAartList.isEmpty()) {
this.searchArtFromAnag(mtbAartList.get(0), pickData, onComplete); this.searchArtFromAnag(mtbAartList.get(0), pickData, null, onComplete);
} else { } else {
this.manageUnknownBarcode(barcodeProd, onComplete); this.manageUnknownBarcode(barcodeProd, onComplete);
} }
@@ -315,28 +315,41 @@ public class AccettazioneBollaPickingViewModel {
} }
private void searchArtFromAnag(MtbAart mtbAart, PickDataDTO pickData, Runnable onComplete) { private void searchArtFromAnag(MtbAart mtbAart, PickDataDTO pickData, ArrayList<MtbAart> previousSearchedArts, Runnable onComplete) {
if (previousSearchedArts == null) previousSearchedArts = new ArrayList<>();
if (previousSearchedArts.contains(mtbAart)) {
manageNoArtFound(mtbAart, pickData);
return;
}
previousSearchedArts.add(mtbAart);
final List<PickingObjectDTO> pickingList = mPickingList.getValue(); final List<PickingObjectDTO> pickingList = mPickingList.getValue();
List<PickingObjectDTO> matchPickingObject = Stream.of(pickingList) List<PickingObjectDTO> matchPickingObject = pickingList == null ? new ArrayList<>() :
.filter(x -> UtilityString.equalsIgnoreCase(mtbAart.getCodMart(), x.getSitBollaAccettazione().getCodMart())) pickingList.stream()
.toList(); .filter(x -> UtilityString.equalsIgnoreCase(mtbAart.getCodMart(), x.getSitBollaAccettazione().getCodMart()))
.collect(Collectors.toList());
for (PickingObjectDTO pickingObjectDTO : matchPickingObject) { for (PickingObjectDTO pickingObjectDTO : matchPickingObject) {
pickingObjectDTO.setTempPickData(pickData); pickingObjectDTO.setTempPickData(pickData);
} }
this.loadMatchedRows(matchPickingObject, mtbAart, pickData); this.loadMatchedRows(matchPickingObject, mtbAart, pickData, previousSearchedArts);
onComplete.run(); onComplete.run();
} }
private void loadMatchedRows(List<PickingObjectDTO> matchedRows, MtbAart mtbAart, PickDataDTO pickDataDTO) { private void loadMatchedRows(List<PickingObjectDTO> matchedRows, MtbAart mtbAart, PickDataDTO pickDataDTO, ArrayList<MtbAart> previousSearchedArts) {
if (matchedRows == null || matchedRows.isEmpty()) { if (matchedRows == null || matchedRows.isEmpty()) {
this.sendOnLoadingStarted();
this.mArticoloRESTConsumer.findIfIsKit(mtbAart, mtbAartFind -> { this.mArticoloRESTConsumer.findIfIsKit(mtbAart, mtbAartFind -> {
if (mtbAartFind == null){ this.sendOnLoadingEnded();
if (mtbAartFind == null) {
manageNoArtFound(mtbAart, pickDataDTO); manageNoArtFound(mtbAart, pickDataDTO);
} else { } else {
searchArtFromAnag(mtbAartFind, pickDataDTO, () -> {}); searchArtFromAnag(mtbAartFind, pickDataDTO, previousSearchedArts, () -> {
});
} }
}, this::sendError); }, this::sendError);
} else if (matchedRows.size() == 1) { } else if (matchedRows.size() == 1) {
@@ -442,7 +455,7 @@ public class AccettazioneBollaPickingViewModel {
dispatchBollaRow(pickingObjectDTO); dispatchBollaRow(pickingObjectDTO);
} }
public void dispatchBollaRow(final PickingObjectDTO pickingObjectDTO){ public void dispatchBollaRow(final PickingObjectDTO pickingObjectDTO) {
dispatchBollaRow(pickingObjectDTO, false); dispatchBollaRow(pickingObjectDTO, false);
} }
@@ -554,7 +567,7 @@ public class AccettazioneBollaPickingViewModel {
UtilityBigDecimal.greaterThan(initialNumCnf, pickingObjectDTO.getMtbAart().getColliPedana())) { UtilityBigDecimal.greaterThan(initialNumCnf, pickingObjectDTO.getMtbAart().getColliPedana())) {
initialNumCnf = pickingObjectDTO.getMtbAart().getColliPedana(); initialNumCnf = pickingObjectDTO.getMtbAart().getColliPedana();
initialQtaTot = initialNumCnf.multiply(initialQtaCnf); initialQtaTot = initialNumCnf.multiply(initialQtaCnf);
} else if(UtilityBigDecimal.greaterThan(initialNumCnf, BigDecimal.ONE) && pickingObjectDTO.getMtbAart().isFlagQtaCnfFissaBoolean()) { } else if (UtilityBigDecimal.greaterThan(initialNumCnf, BigDecimal.ONE) && pickingObjectDTO.getMtbAart().isFlagQtaCnfFissaBoolean()) {
initialNumCnf = BigDecimal.ONE; initialNumCnf = BigDecimal.ONE;
initialQtaTot = initialNumCnf.multiply(initialQtaCnf); initialQtaTot = initialNumCnf.multiply(initialQtaCnf);
} }
@@ -577,7 +590,7 @@ public class AccettazioneBollaPickingViewModel {
} }
} }
if (!longClick){ if (!longClick) {
this.sendOnItemDispatched( this.sendOnItemDispatched(
pickingObjectDTO, pickingObjectDTO,
pickingObjectDTO.getMtbAart(), pickingObjectDTO.getMtbAart(),
@@ -594,14 +607,14 @@ public class AccettazioneBollaPickingViewModel {
partitaMag, partitaMag,
dataScad, dataScad,
true, true,
(pickedQuantityDTO, shouldCloseLU) -> { pickedQuantityDTO -> {
this.saveNewRow(pickingObjectDTO, this.saveNewRow(pickingObjectDTO,
pickedQuantityDTO.getNumCnf(), pickedQuantityDTO.getNumCnf(),
pickedQuantityDTO.getQtaCnf(), pickedQuantityDTO.getQtaCnf(),
pickedQuantityDTO.getQtaTot(), pickedQuantityDTO.getQtaTot(),
pickedQuantityDTO.getPartitaMag(), pickedQuantityDTO.getPartitaMag(),
pickedQuantityDTO.getDataScad(), pickedQuantityDTO.getDataScad(),
shouldCloseLU); pickedQuantityDTO.isShouldCloseLu());
}); });
} else { } else {
this.saveNewRow( this.saveNewRow(
@@ -643,7 +656,6 @@ public class AccettazioneBollaPickingViewModel {
.setQtaCnf(qtaCnf) .setQtaCnf(qtaCnf)
.setNumCnf(numCnf) .setNumCnf(numCnf)
.setPartitaMag(partitaMag) .setPartitaMag(partitaMag)
// .setCodJcom(pickingObjectDTO.getSitBollaAccettazione().getCodJcom())
.setDataDoc(sitBolla != null ? sitBolla.getDataDoc() : firstAvailableBolla.getDataDoc()) .setDataDoc(sitBolla != null ? sitBolla.getDataDoc() : firstAvailableBolla.getDataDoc())
.setNumDoc(sitBolla != null ? sitBolla.getNumDoc() : firstAvailableBolla.getNumDoc()) .setNumDoc(sitBolla != null ? sitBolla.getNumDoc() : firstAvailableBolla.getNumDoc())
.setCodDtip(sitBolla != null ? sitBolla.getCodDtip() : firstAvailableBolla.getCodDtip()) .setCodDtip(sitBolla != null ? sitBolla.getCodDtip() : firstAvailableBolla.getCodDtip())
@@ -662,7 +674,7 @@ public class AccettazioneBollaPickingViewModel {
.setMtbAart(pickingObjectDTO.getMtbAart()); .setMtbAart(pickingObjectDTO.getMtbAart());
pickingObjectDTO.getWithdrawMtbColrs().add(insertedMtbColr); pickingObjectDTO.getWithdrawMtbColrs().add(insertedMtbColr);
mCurrentMtbColt.getMtbColr().add(insertedMtbColr); mCurrentMtbColt.getMtbColr().add(0, insertedMtbColr);
//Chiamato removeListFilter perché cosi mi cancella tutti i dati di pick temporanei //Chiamato removeListFilter perché cosi mi cancella tutti i dati di pick temporanei
resetMatchedRows(); resetMatchedRows();
@@ -694,7 +706,9 @@ public class AccettazioneBollaPickingViewModel {
mtbColrToEdit.getPartitaMag(), mtbColrToEdit.getPartitaMag(),
mtbColrToEdit.getDataScadPartita(), mtbColrToEdit.getDataScadPartita(),
true, true,
(pickedQuantityDTO, shouldCloseLU) -> { pickedQuantityDTO -> {
if (pickedQuantityDTO == null)
return;
this.saveEditedRow(mtbColrToEdit, this.saveEditedRow(mtbColrToEdit,
pickedQuantityDTO.getNumCnf(), pickedQuantityDTO.getNumCnf(),
@@ -702,7 +716,7 @@ public class AccettazioneBollaPickingViewModel {
pickedQuantityDTO.getQtaTot(), pickedQuantityDTO.getQtaTot(),
pickedQuantityDTO.getPartitaMag(), pickedQuantityDTO.getPartitaMag(),
pickedQuantityDTO.getDataScad(), pickedQuantityDTO.getDataScad(),
shouldCloseLU); pickedQuantityDTO.isShouldCloseLu());
}); });
} }
@@ -801,21 +815,42 @@ public class AccettazioneBollaPickingViewModel {
} else { } else {
CloseUDCRequestDTO closeUDCRequestDTO = new CloseUDCRequestDTO() CloseUDCRequestDTO closeUDCRequestDTO = new CloseUDCRequestDTO()
.setMtbColt(mCurrentMtbColt); .setMtbColt(mCurrentMtbColt);
mColliCaricoRESTConsumer.closeUDC(closeUDCRequestDTO, closeUDCResponse -> {
Runnable onVersamentoCompleted = () -> { ObservableArrayList<MtbColr> mtbColr = mCurrentMtbColt.getMtbColr();
managePrintCollo(this::postCloseOperations); List<PickingObjectDTO> pickingList = getPickingList().getValue();
this.sendLUClosed(); int listCount = pickingList != null ? pickingList.size() : 0;
this.sendOnLoadingEnded(); int anomalie = listCount > 0 ? listCount - mtbColr.size() : 0;
};
manageVersamentoAutomatico(onVersamentoCompleted); if (anomalie == 0) {
}, this::sendError); closeUdc(closeUDCRequestDTO);
} else {
onConfirmAnomalie(anomalie, canBeClose -> {
if (canBeClose) {
closeUdc(closeUDCRequestDTO);
} else {
this.sendOnLoadingEnded();
}
});
}
} }
}, this::sendError); }, this::sendError);
} }
private void closeUdc(CloseUDCRequestDTO closeUDCRequestDTO) {
mColliCaricoRESTConsumer.closeUDC(closeUDCRequestDTO, closeUDCResponse -> {
Runnable onVersamentoCompleted = () -> {
managePrintCollo(this::postCloseOperations);
this.sendLUClosed();
this.sendOnLoadingEnded();
};
manageVersamentoAutomatico(onVersamentoCompleted);
}, this::sendError);
}
private void manageVersamentoAutomatico(Runnable onComplete) { private void manageVersamentoAutomatico(Runnable onComplete) {
if (!SettingsManager.iDB().isFlagAccettazioneBollaAskVersamentoAutomatico()) { if (!SettingsManager.iDB().isFlagAccettazioneBollaAskVersamentoAutomatico()) {
@@ -982,7 +1017,7 @@ public class AccettazioneBollaPickingViewModel {
String partitaMag, String partitaMag,
LocalDate dataScad, LocalDate dataScad,
boolean canPartitaMagBeChanged, boolean canPartitaMagBeChanged,
RunnableArgss<PickedQuantityDTO, Boolean> onComplete) { RunnableArgs<PickedQuantityDTO> onComplete) {
if (this.mListener != null) mListener.onItemDispatched(pickingObjectDTO, if (this.mListener != null) mListener.onItemDispatched(pickingObjectDTO,
mtbAart, mtbAart,
initialNumCnf, initialNumCnf,
@@ -1038,6 +1073,9 @@ public class AccettazioneBollaPickingViewModel {
return this; return this;
} }
private void onConfirmAnomalie(int anomalie, RunnableArgs<Boolean> onConfirm) {
if (this.mListener != null) mListener.onConfirmAnomalie(anomalie, onConfirm);
}
public interface Listener extends ILoadingListener, ILUPrintListener, ILUBaseOperationsListener { public interface Listener extends ILoadingListener, ILUPrintListener, ILUBaseOperationsListener {
@@ -1065,7 +1103,7 @@ public class AccettazioneBollaPickingViewModel {
LocalDate dataScad, LocalDate dataScad,
boolean canPartitaMagBeChanged, boolean canPartitaMagBeChanged,
boolean canOverflowQuantity, boolean canOverflowQuantity,
RunnableArgss<PickedQuantityDTO, Boolean> onComplete); RunnableArgs<PickedQuantityDTO> onComplete);
void onFilterCodMartApplied(String codMartToFilter); void onFilterCodMartApplied(String codMartToFilter);
@@ -1075,6 +1113,8 @@ public class AccettazioneBollaPickingViewModel {
void onUnknownBarcodeScanned(String barcode, RunnableArgs<String> done, Runnable abort); void onUnknownBarcodeScanned(String barcode, RunnableArgs<String> done, Runnable abort);
void onConfirmAnomalie(int anomalie, RunnableArgs<Boolean> onConfirm);
} }
} }

View File

@@ -2,17 +2,17 @@ package it.integry.integrywmsnative.gest.accettazione_bolla_picking.dto;
import java.util.List; import java.util.List;
import it.integry.integrywmsnative.core.model.dto.AlreadyRegisteredUDCDTO; import it.integry.integrywmsnative.core.model.dto.AlreadyRegisteredUlDTO;
public class RetrieveAlreadyRegisteredULAccettazioneBollaResponseDTO { public class RetrieveAlreadyRegisteredULAccettazioneBollaResponseDTO {
private List<AlreadyRegisteredUDCDTO> udcList; private List<AlreadyRegisteredUlDTO> udcList;
public List<AlreadyRegisteredUDCDTO> getUdcList() { public List<AlreadyRegisteredUlDTO> getUdcList() {
return udcList; return udcList;
} }
public RetrieveAlreadyRegisteredULAccettazioneBollaResponseDTO setUdcList(List<AlreadyRegisteredUDCDTO> udcList) { public RetrieveAlreadyRegisteredULAccettazioneBollaResponseDTO setUdcList(List<AlreadyRegisteredUlDTO> udcList) {
this.udcList = udcList; this.udcList = udcList;
return this; return this;
} }

View File

@@ -9,7 +9,7 @@ import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
import it.integry.integrywmsnative.core.expansion.RunnableArgs; import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.model.dto.AlreadyRegisteredUDCDTO; import it.integry.integrywmsnative.core.model.dto.AlreadyRegisteredUlDTO;
import it.integry.integrywmsnative.core.rest.RESTBuilder; import it.integry.integrywmsnative.core.rest.RESTBuilder;
import it.integry.integrywmsnative.core.rest.consumers._BaseRESTConsumer; import it.integry.integrywmsnative.core.rest.consumers._BaseRESTConsumer;
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback; import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
@@ -32,7 +32,7 @@ public class AccettazioneBollaPickingRESTConsumer extends _BaseRESTConsumer {
} }
public void retrieveAlreadyRegisteredUDC(List<TestataBollaAccettazioneDTO> bolle, RunnableArgs<List<AlreadyRegisteredUDCDTO>> onComplete, RunnableArgs<Exception> onFailed) { public void retrieveAlreadyRegisteredUDC(List<TestataBollaAccettazioneDTO> bolle, RunnableArgs<List<AlreadyRegisteredUlDTO>> onComplete, RunnableArgs<Exception> onFailed) {
AccettazioneBollaPickingRESTConsumerService service = restBuilder.getService(AccettazioneBollaPickingRESTConsumerService.class); AccettazioneBollaPickingRESTConsumerService service = restBuilder.getService(AccettazioneBollaPickingRESTConsumerService.class);
var request = new RetrieveAlreadyRegisteredULAccettazioneBollaRequestDTO() var request = new RetrieveAlreadyRegisteredULAccettazioneBollaRequestDTO()

View File

@@ -2,12 +2,10 @@ package it.integry.integrywmsnative.gest.accettazione_bolla_picking.ui;
import android.content.Context; import android.content.Context;
import android.graphics.Color; import android.graphics.Color;
import android.os.Build;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.res.ResourcesCompat; import androidx.core.content.res.ResourcesCompat;
import androidx.databinding.ObservableArrayList; import androidx.databinding.ObservableArrayList;
@@ -17,7 +15,6 @@ import androidx.recyclerview.widget.RecyclerView;
import com.zhukic.sectionedrecyclerview.SectionedRecyclerViewAdapter; import com.zhukic.sectionedrecyclerview.SectionedRecyclerViewAdapter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
import it.integry.integrywmsnative.R; import it.integry.integrywmsnative.R;
@@ -65,29 +62,10 @@ public class AccettazioneBollaPickingListAdapter extends SectionedRecyclerViewAd
this.mShowSecondaryUntMis = showSecondaryUntMis; this.mShowSecondaryUntMis = showSecondaryUntMis;
mutableDataSet.addOnListChangedCallback(new OnListGeneralChangedCallback() { mutableDataSet.addOnListChangedCallback(new OnListGeneralChangedCallback() {
@RequiresApi(api = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
@Override @Override
public void onChanged(ObservableList sender) { public void onChanged(ObservableList sender) {
List<AccettazioneBollaPickingListModel> listaOrdinata = new ArrayList<>();
if (!sender.isEmpty()) {
listaOrdinata = new ArrayList<>(sender);
Collections.sort(listaOrdinata, (a, b) -> {
boolean condA = a.getQtaEvasa().floatValue() > 0;
boolean condB = b.getQtaEvasa().floatValue() > 0;
if (condA && !condB) {
return -1;
} else if (!condA && condB) {
return 1;
}
return 0;
});
}
mDataset.clear(); mDataset.clear();
mDataset.addAll(listaOrdinata); mDataset.addAll(sender);
notifyDataSetChanged(); notifyDataSetChanged();
notifyDataChanged(); notifyDataChanged();
} }
@@ -136,7 +114,7 @@ public class AccettazioneBollaPickingListAdapter extends SectionedRecyclerViewAd
} else if (position % 2 == 1) { } else if (position % 2 == 1) {
holder.mBinding.getRoot().setBackgroundColor(Color.WHITE); holder.mBinding.getRoot().setBackgroundColor(Color.WHITE);
} else { } else {
holder.mBinding.getRoot().setBackgroundColor(mContext.getResources().getColor(R.color.letturaFacilitataBG)); holder.mBinding.getRoot().setBackgroundColor(mContext.getResources().getColor(R.color.letturaFacilitataBGLight));
} }
holder.mBinding.deactivatedOverBg.setVisibility(!pickingObjectDTO.isActive() ? View.VISIBLE : View.GONE); holder.mBinding.deactivatedOverBg.setVisibility(!pickingObjectDTO.isActive() ? View.VISIBLE : View.GONE);

View File

@@ -36,6 +36,7 @@ public class SitArtOrdDTO {
private String descrizioneEstesaArt; private String descrizioneEstesaArt;
private String descrizioneEstesaOrd; private String descrizioneEstesaOrd;
private Date dataCons; private Date dataCons;
private String partitaMag;
public String getDescrizioneEstesaOrd() { public String getDescrizioneEstesaOrd() {
return descrizioneEstesaOrd; return descrizioneEstesaOrd;
@@ -301,4 +302,13 @@ public class SitArtOrdDTO {
this.dataCons = dataCons; this.dataCons = dataCons;
return this; return this;
} }
public String getPartitaMag() {
return partitaMag;
}
public SitArtOrdDTO setPartitaMag(String partitaMag) {
this.partitaMag = partitaMag;
return this;
}
} }

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