Compare commits

...

222 Commits

Author SHA1 Message Date
2c59e9beec Finish v1.45.01(483) 2025-03-17 11:51:24 +01:00
01af72bd2f -> v1.45.01 (483) 2025-03-17 11:51:18 +01:00
2f42958394 Fix su Rettifica Giacenze 2025-03-17 11:50:41 +01:00
fba3801994 Finish v1.45.00(482) 2025-03-14 18:20:01 +01:00
7ec722fc26 Finish v1.45.00(482) 2025-03-14 18:20:00 +01:00
64295d565a -> v1.45.00 (482) 2025-03-14 18:19:57 +01:00
2db0027fff Correzioni Verifica Giacenze 2025-03-14 18:19:09 +01:00
80dac639da Completata gestione verifica giacenze 2025-03-14 13:12:16 +01:00
a4fcc87088 Finish v1.44.12(481) 2025-03-12 19:29:55 +01:00
be1b993239 Finish v1.44.12(481) 2025-03-12 19:29:55 +01:00
63f9912347 -> v1.44.12 (481) 2025-03-12 19:29:49 +01:00
b887172032 Fix caricamento in closeOrder Spedizione 2025-03-12 19:28:18 +01:00
6229a1a4b1 Aggiornato DialogScanArt 2025-03-06 12:16:38 +01:00
a9028e65d9 Finish v1.44.11(480) 2025-03-04 11:02:32 +01:00
ba413e4d05 Finish v1.44.11(480) 2025-03-04 11:02:31 +01:00
6f759d969d -> v1.44.11 (480) 2025-03-04 11:02:26 +01:00
6f06eaf0a0 Rimosso vecchio dialog livello posizione 2025-03-04 10:57:35 +01:00
993191c083 Aggiornati dialog ask posizione e fixati problemi sul dismiss dei dialog 2025-03-04 10:56:19 +01:00
329d53f8d0 Migliorato controllo di generazione documenti carico/scarico durante il picking libero. 2025-03-03 18:09:39 +01:00
c3c3d32dfe Finish v1.44.10(479) 2025-03-03 11:52:21 +01:00
1756124b89 Finish v1.44.10(479) 2025-03-03 11:52:21 +01:00
5bc3619d6b -> v1.44.10 (479) 2025-03-03 11:52:17 +01:00
7ec04ac8da Fix su dialog caricamento in accettazione ordini 2025-03-03 11:51:31 +01:00
8d93f3bb61 Finish v1.44.09(478) 2025-03-03 10:12:14 +01:00
b31ea475c6 Finish v1.44.09(478) 2025-03-03 10:12:14 +01:00
a7e8ec4d99 -> v1.44.09 (478) 2025-03-03 10:12:08 +01:00
677ee127ff Fix su dismiss di dialog input quantity 2025-03-03 10:11:11 +01:00
a02035e9b8 Finish v1.44.08(477) 2025-02-28 16:58:53 +01:00
b61948dac3 Finish v1.44.08(477) 2025-02-28 16:58:53 +01:00
deee26d55b -> v1.44.08 (477) 2025-02-28 16:58:48 +01:00
00443b46c8 Fix su dialog info aggiuntive in accettazione 2025-02-28 16:57:57 +01:00
9228eaf01b Finish v1.44.07(476) 2025-02-28 11:51:16 +01:00
51f9e1f58c Finish v1.44.07(476) 2025-02-28 11:51:15 +01:00
6747ee077b -> v1.44.07 (476) 2025-02-28 11:51:11 +01:00
e11e270101 Migliorata gestione caricamenti del Picking libero. 2025-02-28 11:50:11 +01:00
bc27355ed6 Finish Release-2 2025-02-26 11:05:35 +01:00
078d9af116 Finish Release-2 2025-02-26 11:05:34 +01:00
9b14e1186e -> v1.44.06 (475) 2025-02-26 11:05:30 +01:00
779c606c2a Fix vari 2025-02-26 11:04:34 +01:00
581e56a245 Finish Release-1 2025-02-26 10:25:30 +01:00
7f468e19bd Finish Release-1 2025-02-26 10:25:29 +01:00
e8a511d49e -> v1.44.05 (474) 2025-02-26 10:25:25 +01:00
1988ad993f Implementato pulsante di verifica aggiornamenti nelle settings 2025-02-26 10:24:28 +01:00
6105c44dab Gestita installazione delle versioni beta 2025-02-26 10:04:02 +01:00
d3b7cd8cd6 Aggiunta impostazione che permette di abilitare la ricezione degli aggiornamenti beta 2025-02-25 16:52:09 +01:00
36c48f28d1 Finish v1.44.04(473) 2025-02-24 15:31:21 +01:00
93b18531ab Finish v1.44.04(473) 2025-02-24 15:31:21 +01:00
27edd84442 -> v1.44.04 (473) 2025-02-24 15:31:16 +01:00
e24e6858fb Fix su commessa nulla nel caso di picking libero 2025-02-24 15:30:34 +01:00
fa10973626 Migliorata gestione status code nel caso di UnauthorizedAccess nell'interceptor 2025-02-21 11:55:45 +01:00
521e2fe62b Finish v1.44.03(472) 2025-02-19 12:43:54 +01:00
7e7938ea1a Finish v1.44.03(472) 2025-02-19 12:43:53 +01:00
4fe48bd02a -> v1.44.03 (472) 2025-02-19 12:43:48 +01:00
f26bc28ba1 Fix su DialogProgressView 2025-02-19 12:42:58 +01:00
aaf8b96070 Finish v1.44.02(471) 2025-02-19 10:13:14 +01:00
c5720059f3 Finish v1.44.02(471) 2025-02-19 10:13:13 +01:00
361faf235d -> v1.44.02 (471) 2025-02-19 10:13:09 +01:00
f85f5d63a6 Fix su gestione access token negli interceptor 2025-02-19 10:09:10 +01:00
526bc11626 Fix su gestione rif nulla in bottomsheet 2025-02-19 09:37:09 +01:00
95d73b5bc5 Finish v1.44.01(470) 2025-02-18 13:24:11 +01:00
73e0f03886 Finish v1.44.01(470) 2025-02-18 13:24:11 +01:00
91bc82ed16 -> v1.44.01 (470) 2025-02-18 13:24:05 +01:00
c6a30588e6 Migliorata gestione di token scaduto in AuthInterceptor 2025-02-18 13:22:24 +01:00
26c09c02ab Finish v1.44.00(469) 2025-02-17 10:24:12 +01:00
c34e6723d8 Finish v1.44.00(469) 2025-02-17 10:24:11 +01:00
bf2a039700 -> v1.44.00 (469) 2025-02-17 10:24:07 +01:00
cebe5afd0a Fix di retrocompatibilità 2025-02-17 10:23:11 +01:00
2e8e4c0ccc Merge branch 'refs/heads/feature/TokenAuthentication' into develop 2025-02-17 09:54:33 +01:00
1c5c8c61cf Fix su UpdatesManager 2025-02-12 18:11:05 +01:00
726d9fd29c Fix login oauth 2025-02-12 16:28:08 +01:00
d7eeeeeac2 Merge branch 'develop' into feature/TokenAuthentication
# Conflicts:
#	.idea/deploymentTargetSelector.xml
#	app/build.gradle
#	app/src/main/java/it/integry/integrywmsnative/core/menu/MenuRESTConsumer.java
#	app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/ArticoloRESTConsumer.java
#	app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/AziendaRESTConsumer.java
#	app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/ColliMagazzinoRESTConsumer.java
#	app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/DocumentRESTConsumer.java
#	app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/GestSetupRESTConsumer.java
#	app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/GiacenzaRESTConsumer.java
#	app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/ImballiRESTConsumer.java
#	app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/PosizioniRESTConsumer.java
#	app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/PrinterRESTConsumer.java
#	app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/SystemRESTConsumer.java
#	app/src/main/java/it/integry/integrywmsnative/gest/accettazione_ordini_elenco/rest/OrdiniAccettazioneRESTConsumer.java
#	app/src/main/java/it/integry/integrywmsnative/gest/contab_doc_interni/rest/DocInterniRESTConsumer.java
#	app/src/main/java/it/integry/integrywmsnative/gest/login/rest/LoginRESTConsumer.java
#	app/src/main/java/it/integry/integrywmsnative/gest/prod_accettazione_ord_produzione/rest/ProdOrdineProduzioneRESTConsumer.java
#	app/src/main/java/it/integry/integrywmsnative/gest/prod_rientro_merce/order_detail/ProdRientroMerceOrderDetailModule.java
#	app/src/main/java/it/integry/integrywmsnative/gest/prod_rientro_merce/order_detail/rest/ProdRientroMerceOrderDetailRESTConsumer.java
2025-02-11 10:34:36 +01:00
ee72f8364e Finish v1.43.03(468) 2025-02-11 10:33:15 +01:00
a95ff0b0e5 Finish v1.43.03(468) 2025-02-11 10:33:13 +01:00
57ced048a0 -> v1.43.03 (468) 2025-02-11 10:33:06 +01:00
ca545e2d44 Vario 2025-02-11 10:31:36 +01:00
0b777137d5 Fix su DialogProgressView.
Aggiunto barcodeUl nel caso venga battezzata un'etichetta fornitore in DialogScanOrCreateLU.
2025-02-10 18:24:50 +01:00
d19f4de424 Merge remote-tracking branch 'origin/develop' into develop 2025-02-10 17:24:34 +01:00
56d509b07b In inputQuantity l'avviso partita inattiva non è più bloccante ma chiede di continuare 2025-02-10 17:24:30 +01:00
fe3a9d84d5 Fix su DialogProgressView.
Aggiunto barcodeUl nel caso venga battezzata un'etichetta anonima in DialogScanOrCreateLU.
2025-02-10 16:52:55 +01:00
dc38311125 Sostituito FBToast con snackbar nativo.
Rimosse librerie inutilizzate.
2025-02-06 15:11:21 +01:00
bce8f2a8b7 Fix visibilità posizione in rettifica giacenze 2025-02-05 12:59:35 +01:00
13ec0c745e Creato nuovo dialog per notificare gli aggiornamenti dell'app 2025-02-04 11:50:19 +01:00
b5f7e12f5a Fix post merge 2025-02-04 10:25:58 +01:00
90e8ff128c Merge remote-tracking branch 'origin/develop' into develop
# Conflicts:
#	app/src/main/java/it/integry/integrywmsnative/gest/accettazione_bolla_picking/AccettazioneBollaPickingViewModel.java
2025-02-04 10:08:13 +01:00
998b1057e0 Sostituiti controlli su size == 0 con isEmpty() sulle liste 2025-02-04 09:55:34 +01:00
d4a7dee121 Migrata gestione del recupero materiale in un servizio dedicato 2025-02-04 09:48:03 +01:00
e85e05a526 Aggiunto filtro commessa in Rientro Merce 2025-01-27 13:04:15 +01:00
7f953e78cf Finish v1.43.02(467) 2025-01-24 18:38:31 +01:00
8b536eb0b0 Finish v1.43.02(467) 2025-01-24 18:38:30 +01:00
f390548d66 -> v1.43.02 (467) 2025-01-24 18:38:22 +01:00
c6a2b8c6ea In accettazione bolla fatto in modo che vengono riconosciuti i kit quando leggono i componenti 2025-01-24 18:36:47 +01:00
a046e31412 Migliorati errori letti dalle chiamate REST 2025-01-24 18:09:27 +01:00
716f6d4daa Merge branch 'develop' into feature/GestioneDocumentiLavorazione 2025-01-23 11:48:12 +01:00
9b451ff1bc Merge 2025-01-22 10:30:16 +01:00
6d48182d90 Finish v1.43.01(466) 2025-01-21 13:07:14 +01:00
e3d8defa5b Finish v1.43.01(466) 2025-01-21 13:07:13 +01:00
dc24b43311 -> v1.43.01 (466) 2025-01-21 13:07:06 +01:00
75f55ebd44 Fix null point in retrieveImballiSyncronized 2025-01-21 13:05:14 +01:00
09cebb1c7e Merge branch 'develop' into feature/GestioneDocumentiLavorazione
# Conflicts:
#	app/src/main/java/it/integry/integrywmsnative/gest/prod_rientro_merce/order_detail/ProdRientroMerceOrderDetailPickedQuantityDTO.java
#	app/src/main/java/it/integry/integrywmsnative/view/dialogs/input_lu_prod/adapter/DialogInputLUProdTipoColloAdapter.java
#	build.gradle
2025-01-20 18:19:28 +01:00
9dc0935cc1 Finish v1.43.00(465) 2025-01-20 17:57:59 +01:00
5bfd695f2d Finish v1.43.00(465) 2025-01-20 17:57:58 +01:00
8e0b05b6af -> v1.43.00 (465) 2025-01-20 17:57:54 +01:00
ddc441e76e Refactoring UI di ContenutoBancale.
Refactoring del model MtbTcol, adesso è completamente observable.
2025-01-20 17:57:05 +01:00
20602cadb5 Fix sulla descrizione durante il salvataggio di un nuovo articolo 2025-01-20 12:54:54 +01:00
416ac0a2a5 Finish v1.42.04(463) 2025-01-17 13:14:36 +01:00
49933c8493 Finish v1.42.04(463) 2025-01-17 13:14:34 +01:00
b1bc72a1a5 -> v1.42.04 (464) 2025-01-17 13:14:29 +01:00
c498a373f5 Rimosso layout dialog_ask_should_print.xml non più utilizzato 2025-01-17 13:13:34 +01:00
bd04d6263e Aggiornati build.gradle
# Conflicts:
#	app/src/main/java/it/integry/integrywmsnative/MainApplicationComponent.java
#	app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/ColliMagazzinoRESTConsumer.java
#	app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/ColliMagazzinoRESTConsumerService.java
#	app/src/main/java/it/integry/integrywmsnative/gest/spedizione/SpedizioneViewModel.java
2025-01-17 13:12:12 +01:00
fbe9244000 Merge branch 'develop' into feature/GestioneDocumentiLavorazione
# Conflicts:
#	app/src/main/java/it/integry/integrywmsnative/MainApplicationComponent.java
#	app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/ColliMagazzinoRESTConsumer.java
#	app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/ColliMagazzinoRESTConsumerService.java
#	app/src/main/java/it/integry/integrywmsnative/gest/spedizione/SpedizioneViewModel.java
2025-01-17 10:20:50 +01:00
6e52a3c0c7 Finish v1.42.03(463) 2025-01-16 16:57:33 +01:00
9f92274720 Finish v1.42.03(463) 2025-01-16 16:57:33 +01:00
6d431bb251 -> v1.42.03 (463) 2025-01-16 16:57:28 +01:00
5265b949af Eliminato vecchio dialog di richiesta stampa (sostituito con DialogYesNo) 2025-01-16 16:56:40 +01:00
db875491d0 Merge remote-tracking branch 'origin/develop' into develop 2025-01-16 16:47:46 +01:00
778fdff69a Implementato cambio deposito in Spedizione (basandosi sulla prima UDC scansionata).
Aggiornata icona app.
2025-01-16 16:47:18 +01:00
4b54aa3c02 In fase di accettazione in inputQuantity proporre uno nelle confezioni non la quantità presente in bolla 2025-01-15 16:15:33 +01:00
019688a5cc In accettazione da bolla l'ultima referenza scansionata deve comparire all'inizio dell'elenco 2025-01-15 16:02:01 +01:00
00fc3a59eb Aggiunta possibilità di variare l'ordinamento avanti elenco accettazione bolla 2025-01-15 15:28:05 +01:00
e5244e75a3 Nelle righe dell'inventario aggiunto id dispositivo 2025-01-15 12:05:50 +01:00
cb77c21656 Implementato switch deposito in home page 2025-01-13 15:54:23 +01:00
7b0f7f16ba Fix after merge 2025-01-08 17:40:10 +01:00
e23446654d Finish v1.42.02(462) 2025-01-08 14:48:25 +01:00
b3641534c9 Finish v1.42.02(462) 2025-01-08 14:48:25 +01:00
a3a5f65e53 -> v1.42.02 (462) 2025-01-08 14:48:07 +01:00
d5c0f388db Ripristinato controllo su percentuale hr 2025-01-07 10:23:06 +01:00
8ae3820aa2 Merge branch 'develop' into feature/GestioneDocumentiLavorazione
# Conflicts:
#	app/build.gradle
#	app/src/main/java/it/integry/integrywmsnative/MainApplicationComponent.java
#	app/src/main/java/it/integry/integrywmsnative/core/settings/DBSettingsModel.java
#	app/src/main/java/it/integry/integrywmsnative/core/settings/SettingsManager.java
#	app/src/main/java/it/integry/integrywmsnative/gest/prod_recupero_materiale/rest/ProdRecuperMaterialeRESTConsumer.java
#	app/src/main/java/it/integry/integrywmsnative/view/dialogs/DialogProgressView.java
2025-01-07 10:06:05 +01:00
ac6f64d494 Fix cancellazione e modifica ul in Accettazione bolla 2024-12-19 10:09:42 +01:00
9d001f8896 Finish v1.42.01(461) 2024-12-10 11:02:45 +01:00
24e9cffeea Finish v1.42.01(461) 2024-12-10 11:02:44 +01:00
b0f2763a85 -> v1.42.01 (461) 2024-12-10 11:02:38 +01:00
cc343c296f Fix su null quando viene creato un nuovo articolo e deve avviare automaticamente la ricerca del nuovo articolo in Rettifica Giacenze 2024-12-10 11:02:00 +01:00
bc9b60b0ac Finish v1.42.00(460) 2024-12-09 19:20:58 +01:00
856592e1fe Finish v1.42.00(460) 2024-12-09 19:20:57 +01:00
cd28d01354 -> v1.42.00 (460) 2024-12-09 19:20:51 +01:00
653cd3fd75 Implementata creazione di un nuovo articolo da Rettifica Giacenze 2024-12-09 19:18:03 +01:00
73b1a77a12 Migliorata gestione degli Updates in modo da forzare gli aggiornamenti di default a meno che non venga specificato forced=false nel file version.txt 2024-12-06 11:37:09 +01:00
777d6a3c5b Finish v1.41.11(459) 2024-12-05 17:25:47 +01:00
98f520427e Finish v1.41.11(459) 2024-12-05 17:25:47 +01:00
403f2ec57c -> v1.41.11 (459) 2024-12-05 17:25:42 +01:00
e69d99fdf1 Merge remote-tracking branch 'origin/develop' into develop 2024-12-05 17:25:01 +01:00
b48b2fbac9 Fix su sorting partita mag nulla in Spedizione 2024-12-05 17:24:48 +01:00
00515aaf9b Merge remote-tracking branch 'origin/develop' into develop 2024-12-05 16:09:08 +01:00
e70d5697c3 aggiunto isnull su numero risorse in query recuper materiale versato 2024-12-05 16:08:48 +01:00
fb6d206203 Finish v1.41.10(456) 2024-12-04 10:26:44 +01:00
d3a9c87d14 Finish v1.41.10(456) 2024-12-04 10:26:43 +01:00
39841f6b0d -> v1.41.10 (458) 2024-12-04 10:26:38 +01:00
7ed3b421a1 Fix su setup nulla in DialogSelectDocInfoViewModel 2024-12-04 10:25:10 +01:00
3b5eb32190 Finish v1.41.09(457) 2024-11-25 11:48:21 +01:00
be31b87eac Finish v1.41.09(457) 2024-11-25 11:48:20 +01:00
3d341ac99d -> v1.41.09 (457) 2024-11-25 11:48:13 +01:00
9df1c37ee9 Fix su esportazione log 2024-11-25 11:40:13 +01:00
385a28c29b Finish v1.41.08(456) 2024-11-21 18:34:09 +01:00
e26568cdf1 Finish v1.41.08(456) 2024-11-21 18:34:09 +01:00
191953a003 -> v1.41.08 (456) 2024-11-21 18:34:04 +01:00
47143fe97d Fix sul caricamento degli ordini di acquisto 2024-11-21 18:33:20 +01:00
387ce6a555 Finish v1.41.07(455) 2024-11-18 18:31:49 +01:00
47ff01805c Finish v1.41.07(455) 2024-11-18 18:31:48 +01:00
0e24f7188c -> v1.41.07 (455) 2024-11-18 18:31:43 +01:00
8b3d1f2a2e Ulteriori fix su DialogProgressView 2024-11-18 18:31:01 +01:00
dcdc823b5f Finish v1.41.06(454) 2024-11-18 16:36:52 +01:00
7201e5c8f8 Finish v1.41.06(454) 2024-11-18 16:36:51 +01:00
929c52b94c -> v1.41.06 (454) 2024-11-18 16:36:45 +01:00
2adfda5f30 Ulteriori fix su DialogProgressView 2024-11-18 16:34:02 +01:00
421accaf15 Finish v1.41.05(453) 2024-11-18 11:39:03 +01:00
574ad6176b Finish v1.41.05(453) 2024-11-18 11:39:03 +01:00
290d737ff7 -> v1.41.05 (453) 2024-11-18 11:38:59 +01:00
4b0fbd0b6b Rimossi destinatari che non sono attivi 2024-11-15 19:14:04 +01:00
6327089a55 Finish v1.41.04(452) 2024-11-14 10:02:03 +01:00
807c3a8cde Finish v1.41.04(452) 2024-11-14 10:02:02 +01:00
665c261b9a -> v1.41.04 (452) 2024-11-14 10:01:56 +01:00
bdd6f21522 Fix su DialogProgressView 2024-11-14 09:59:39 +01:00
482243ceff Implementato CaricoProdFin in Rientro Merce 2024-11-14 09:58:40 +01:00
9890fbfec0 Merge branch 'develop' into feature/GestioneDocumentiLavorazione 2024-11-05 11:25:22 +01:00
2a0465dc0f Finish v1.41.03(451) 2024-11-05 11:24:45 +01:00
3ebe311728 Finish v1.41.03(451) 2024-11-05 11:24:44 +01:00
95a51ecc7a -> v1.41.03 (451) 2024-11-05 11:24:39 +01:00
342753aeac Migliorata gestione del loading dialog (evitate concorrenze di apertura) 2024-11-05 11:23:51 +01:00
2b467f56d7 Migliorato servizio di importColliDaProduzione 2024-11-05 10:43:32 +01:00
a27db0ab68 Merge branch 'develop' into feature/GestioneDocumentiLavorazione 2024-10-23 17:39:18 +02:00
845a4c8faa Aggiornato logo Integry 2024-10-18 11:11:51 +02:00
7b9959e68d Merge branch 'develop' into feature/GestioneDocumentiLavorazione
# Conflicts:
#	.idea/runConfigurations.xml
#	app/src/main/java/it/integry/integrywmsnative/core/settings/DBSettingsModel.java
#	build.gradle
#	gradle/wrapper/gradle-wrapper.properties
2024-10-18 10:13:22 +02:00
0328ebad85 Aggiornato Gradle Plugin 2024-10-18 10:11:08 +02:00
77c5252bf6 Finish v1.41.02(450) 2024-10-08 14:43:12 +02:00
c42a597bb4 Finish v1.41.02(450) 2024-10-08 14:43:12 +02:00
b40781db84 -> v1.41.02 (450) 2024-10-08 14:42:57 +02:00
f5a0bf67c8 In rettifica giacenze aggiunta setup per la richiesta della modifica posizione 2024-10-08 14:40:16 +02:00
044d60fb66 Finish v1.41.01(449) 2024-10-03 16:45:02 +02:00
7999e98bd9 Finish v1.41.01(449) 2024-10-03 16:45:01 +02:00
7c14688ef3 -> v1.41.01 (449) 2024-10-03 16:44:57 +02:00
8039d1942d Merge remote-tracking branch 'origin/develop' into develop 2024-10-03 16:43:44 +02:00
6c8fd2518e Stili 2024-10-03 16:43:10 +02:00
03e2f4390b Cambiato oggetto email log 2024-10-03 16:41:40 +02:00
08656ae276 Finish v1.41.00(448) 2024-09-17 18:33:30 +02:00
9f2ba56c59 Finish v1.41.00(448) 2024-09-17 18:33:29 +02:00
34e1ba8f95 -> v1.41.00 (448) 2024-09-17 18:33:22 +02:00
4e95f4f9c9 Aggiunto dialog per il suggerimento dei lotti già esistenti nei documenti interni 2024-09-17 18:32:09 +02:00
7ee59ea814 Implementata richiesta commessa in PickingLibero di Lavorazione.
Implementato servizio di spostamento arts tra UL in PickingLibero.
Implementata generazione documenti in CloseUDS in PickingLibero.
2024-09-16 10:33:59 +02:00
1463510b08 Finish v1.40.30(447) 2024-09-13 09:42:56 +02:00
a771335ff1 Finish v1.40.30(447) 2024-09-13 09:42:55 +02:00
7b1f58412a -> v1.40.30 (447) 2024-09-13 09:42:38 +02:00
d897c83165 Cambiato messaggio di warning per check documenti interni 2024-09-04 12:56:24 +02:00
44b9bc3fc1 Migliorato documento di reso quando effettuano le perdite 2024-09-03 10:19:07 +02:00
fa95ed1391 Finish v1.40.29(446) 2024-07-26 16:58:15 +02:00
26ca580ba4 Finish v1.40.29(446) 2024-07-26 16:58:15 +02:00
f65e69b745 -> v1.40.29 (446) 2024-07-26 16:58:10 +02:00
5a147fb0de Mini-improvement 2024-07-26 16:55:57 +02:00
64e38ce05a Aggiunto log eccezione in fase di ExportLog 2024-07-26 16:28:16 +02:00
6c79a1781d Finish v1.40.28(445) 2024-07-22 09:09:44 +02:00
6177d84131 Finish v1.40.28(445) 2024-07-22 09:09:43 +02:00
c6975badce -> v1.40.28 (445) 2024-07-22 09:09:27 +02:00
c548c6484f Aggiunto suggerimento data scadenza in caso di partita esistente 2024-07-19 17:55:14 +02:00
9aae16521f Finish v1.40.27(444) 2024-07-05 17:59:05 +02:00
559ff4e94c Finish v1.40.27(444) 2024-07-05 17:59:04 +02:00
7b11f503d8 -> v1.40.27 (444) 2024-07-05 17:58:49 +02:00
bc788c3a34 [DOLBO] Gestito extra quantity in duplica uds e aggiornamento quantità in elenco 2024-07-05 17:57:54 +02:00
25a7982a87 Finish v1.40.26(443) 2024-06-26 16:13:52 +02:00
91bca90e5d Fix AuthInterceptor 2024-05-07 18:35:51 +02:00
c5d09b0d8b Merge branch 'develop' into feature/TokenAuthentication 2024-05-07 18:32:48 +02:00
0da31ef866 Aggiunto interceptor per il refresh del token 2024-05-07 18:14:05 +02:00
56f14c064e Rimosse tutte le chiamate statiche a RESTBuilder 2024-05-07 17:30:45 +02:00
09c929803f Implementata login OAuth 2024-05-06 18:39:52 +02:00
512 changed files with 16453 additions and 5973 deletions

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

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AndroidProjectSystem">
<option name="providerId" value="com.android.tools.idea.GradleProjectSystem" />
</component>
</project>

View File

@@ -1,9 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AppInsightsSettings">
<option name="selectedTabId" value="Android Vitals" />
<option name="selectedTabId" value="Firebase Crashlytics" />
<option name="tabSettings">
<map>
<entry key="Android Vitals">
<value>
<InsightsFilterSettings>
<option name="connection">
<ConnectionSetting>
<option name="appId" value="it.integry.ordify.dulciar" />
</ConnectionSetting>
</option>
<option name="signal" value="SIGNAL_UNSPECIFIED" />
<option name="timeIntervalDays" value="SEVEN_DAYS" />
<option name="visibilityType" value="ALL" />
</InsightsFilterSettings>
</value>
</entry>
<entry key="Firebase Crashlytics">
<value>
<InsightsFilterSettings>

View File

@@ -4,6 +4,14 @@
<selectionStates>
<SelectionState runConfigName="app">
<option name="selectionMode" value="DROPDOWN" />
<DropdownSelection timestamp="2025-03-17T09:16:48.549771200Z">
<Target type="DEFAULT_BOOT">
<handle>
<DeviceId pluginId="PhysicalDevice" identifier="serial=21088B8EFD" />
</handle>
</Target>
</DropdownSelection>
<DialogSelection />
</SelectionState>
</selectionStates>
</component>

View File

@@ -123,4 +123,9 @@ Create the following layout resource file [dialog_${dashName}.xml]
return alertDialog;
}
@Override
public void dismiss() {
if(getDialog() != null) getDialog().dismiss();
}
}

2
.idea/kotlinc.xml generated
View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="KotlinJpsPluginSettings">
<option name="version" value="1.9.20" />
<option name="version" value="1.9.25" />
</component>
</project>

17
.idea/runConfigurations.xml generated Normal file
View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="com.intellij.execution.junit.AbstractAllInDirectoryConfigurationProducer" />
<option value="com.intellij.execution.junit.AllInPackageConfigurationProducer" />
<option value="com.intellij.execution.junit.PatternConfigurationProducer" />
<option value="com.intellij.execution.junit.TestInClassConfigurationProducer" />
<option value="com.intellij.execution.junit.UniqueIdConfigurationProducer" />
<option value="com.intellij.execution.junit.testDiscovery.JUnitTestDiscoveryConfigurationProducer" />
<option value="org.jetbrains.kotlin.idea.junit.KotlinJUnitRunConfigurationProducer" />
<option value="org.jetbrains.kotlin.idea.junit.KotlinPatternConfigurationProducer" />
</set>
</option>
</component>
</project>

View File

@@ -5,13 +5,13 @@ if (!project.hasProperty("disable-performance-plugin")) {
}
apply plugin: 'com.google.firebase.crashlytics'
apply plugin: 'kotlin-android'
//apply plugin: 'kotlin-android'
apply plugin: 'com.google.gms.google-services'
android {
def appVersionCode = 443
def appVersionName = '1.40.26'
def appVersionCode = 483
def appVersionName = '1.45.01'
signingConfigs {
release {
@@ -34,10 +34,10 @@ android {
defaultConfig {
applicationId "it.integry.integrywmsnative"
minSdkVersion 21
targetSdkVersion 34
targetSdkVersion 35
versionCode appVersionCode
versionName appVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
// testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
signingConfig signingConfigs.release
javaCompileOptions {
@@ -75,47 +75,59 @@ android {
build {
doLast {
delete "$projectDir/build/outputs/apk/release/version.txt"
file("$projectDir/build/outputs/apk/release/version.txt").text = appVersionCode + '\n' + appVersionName
file("$projectDir/build/outputs/apk/release/version.txt").text = appVersionCode + '\n' + appVersionName + '\n' + 'forced=true'
}
}
gradle.projectsEvaluated {
tasks.withType(JavaCompile.class) {
options.compilerArgs << "-Xmaxerrs" << "10000"
tasks.withType(JavaCompile.class).tap {
configureEach {
options.compilerArgs << "-Xmaxerrs" << "10000"
}
}
}
lint {
abortOnError false
}
namespace 'it.integry.integrywmsnative'
compileSdk 34
compileSdk 35
}
configurations {
all*.exclude group: 'org.jetbrains.kotlin', module: 'kotlin-stdlib-jdk7'
all*.exclude group: 'org.jetbrains.kotlin', module: 'kotlin-stdlib-jdk8'
}
dependencies {
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.4'
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.4'
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation('androidx.test.espresso:espresso-core:3.3.0', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
// androidTestImplementation('androidx.test.espresso:espresso-core:3.6.1', {
// exclude group: 'com.android.support', module: 'support-annotations'
// })
// implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'com.github.lupaulus:logger:2.3.2'
//Firebase
// Import the Firebase BoM
implementation platform('com.google.firebase:firebase-bom:32.8.1')
implementation platform('com.google.firebase:firebase-bom:33.8.0')
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.firebase:firebase-crashlytics'
implementation 'com.google.firebase:firebase-perf'
implementation 'com.google.android.gms:play-services-basement:18.3.0'
implementation 'com.google.android.gms:play-services-basement:18.5.0'
//JJWT
implementation 'io.jsonwebtoken:jjwt-api:0.11.5'
runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.11.5'
runtimeOnly 'io.jsonwebtoken:jjwt-jackson:0.11.5'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.appcompat:appcompat:1.7.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.11.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'com.google.android.material:material:1.12.0'
implementation 'androidx.constraintlayout:constraintlayout:2.2.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.3.2'
implementation 'androidx.recyclerview:recyclerview:1.4.0'
implementation('androidx.preference:preference-ktx:1.2.1') {
exclude group: 'androidx.lifecycle', module: 'lifecycle-viewmodel'
@@ -127,12 +139,12 @@ dependencies {
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation 'com.annimon:stream:1.2.2'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.7.0'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.8.7'
// implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'org.apache.commons:commons-text:1.9'
//MVVM
def dagger2_version = '2.46.1'
def dagger2_version = '2.55'
api "com.google.dagger:dagger:$dagger2_version"
annotationProcessor "com.google.dagger:dagger-compiler:$dagger2_version"
api "com.google.dagger:dagger-android:$dagger2_version"
@@ -143,10 +155,7 @@ dependencies {
//FAB
implementation 'com.github.clans:fab:1.6.4'
//CUSTOM VIEWS
implementation 'com.github.NaimishTrivedi:FBToast:1.0'
implementation 'com.github.cachapa:ExpandableLayout:2.9.2'
implementation 'com.github.frankiesardo:linearlistview:1.0.1@aar'
implementation 'com.github.fede87:StatusBarAlert:1.0.1'
implementation 'com.github.zhukic:sectioned-recyclerview:1.2.3'
implementation 'com.github.pedromassango:doubleClick:3.0'
@@ -157,9 +166,6 @@ dependencies {
annotationProcessor "androidx.room:room-compiler:$room_version"
implementation "androidx.room:room-rxjava3:$room_version"
//AppUpdate
implementation 'com.github.javiersantos:AppUpdater:2.7'
//Barcode
implementation project(':pointmobilescannerlibrary')
implementation project(':zebrascannerlibrary')
@@ -177,11 +183,17 @@ dependencies {
//Bluetooth device manager
implementation 'com.github.harry1453:android-bluetooth-serial:v1.1'
implementation 'com.github.harry1453:android-bluetooth-serial:v1.1.2'
// RxJava is also required.
implementation 'io.reactivex.rxjava2:rxjava:2.1.12'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
implementation 'org.greenrobot:eventbus:3.3.1'
//Barcode generator
// implementation group: 'com.google.zxing', name: 'core', version: '3.5.3'
implementation 'com.journeyapps:zxing-android-embedded:4.3.0'
}
repositories {

File diff suppressed because it is too large Load Diff

View File

@@ -24,8 +24,8 @@
android:allowBackup="true"
android:hardwareAccelerated="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:usesCleartextTraffic="true"

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

View File

@@ -29,6 +29,8 @@ import it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.DocInterniE
import it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.DocInterniEditFormModule;
import it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.dialog.selectDocRows.DialogSelectDocRowsComponent;
import it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.dialog.selectDocRows.DialogSelectDocRowsModule;
import it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.dialog.selectLotti.DialogSelectLottiComponent;
import it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.dialog.selectLotti.DialogSelectLottiModule;
import it.integry.integrywmsnative.gest.contenuto_bancale.ContenutoBancaleComponent;
import it.integry.integrywmsnative.gest.contenuto_bancale.ContenutoBancaleModule;
import it.integry.integrywmsnative.gest.inventario.ElencoInventariComponent;
@@ -69,6 +71,7 @@ import it.integry.integrywmsnative.gest.prod_recupero_materiale.ProdRecuperoMate
import it.integry.integrywmsnative.gest.prod_recupero_materiale.ProdRecuperoMaterialeModule;
import it.integry.integrywmsnative.gest.prod_rientro_merce.ProdRientroMerceComponent;
import it.integry.integrywmsnative.gest.prod_rientro_merce.order_detail.ProdRientroMerceOrderDetailComponent;
import it.integry.integrywmsnative.gest.prod_rientro_merce.order_list.ProdRientroMerceOrderListComponent;
import it.integry.integrywmsnative.gest.prod_riposizionamento_da_prod.ProdRiposizionamentoDaProdComponent;
import it.integry.integrywmsnative.gest.prod_riposizionamento_da_prod.ProdRiposizionamentoDaProdModule;
import it.integry.integrywmsnative.gest.prod_riposizionamento_da_prod.dialogs.info_giacenza.DialogInfoGiacenzaComponent;
@@ -86,6 +89,8 @@ import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.dialog.selectArt
import it.integry.integrywmsnative.gest.pv_ordini_acquisto.PVOrdiniAcquistoGrigliaComponent;
import it.integry.integrywmsnative.gest.pv_ordini_acquisto.PVOrdiniAcquistoGrigliaModule;
import it.integry.integrywmsnative.gest.pv_ordini_acquisto.dialogs.DialogScanGrigliaAcquistoComponent;
import it.integry.integrywmsnative.gest.pv_verifica_giacenze.VerificaGiacenzeComponent;
import it.integry.integrywmsnative.gest.pv_verifica_giacenze.VerificaGiacenzeModule;
import it.integry.integrywmsnative.gest.rettifica_giacenze.RettificaGiacenzeComponent;
import it.integry.integrywmsnative.gest.rettifica_giacenze.RettificaGiacenzeModule;
import it.integry.integrywmsnative.gest.settings.MainSettingsComponent;
@@ -110,12 +115,21 @@ import it.integry.integrywmsnative.view.bottom_sheet__mtb_colr_edit.BottomSheetM
import it.integry.integrywmsnative.view.bottom_sheet__mtb_colr_edit.BottomSheetMtbColrEditModalModule;
import it.integry.integrywmsnative.view.dialogs.ask_cliente.DialogAskClienteComponent;
import it.integry.integrywmsnative.view.dialogs.ask_cliente.DialogAskClienteModule;
import it.integry.integrywmsnative.view.dialogs.ask_commessa.DialogAskCommessaComponent;
import it.integry.integrywmsnative.view.dialogs.ask_deposito.DialogAskDepositoComponent;
import it.integry.integrywmsnative.view.dialogs.ask_deposito.DialogAskDepositoModule;
import it.integry.integrywmsnative.view.dialogs.ask_linea_prod.DialogAskLineaProdComponent;
import it.integry.integrywmsnative.view.dialogs.ask_linea_prod.DialogAskLineaProdModule;
import it.integry.integrywmsnative.view.dialogs.ask_livello_posizione.DialogAskLivelloPosizioneComponent;
import it.integry.integrywmsnative.view.dialogs.ask_livello_posizione.DialogAskLivelloPosizioneModule;
import it.integry.integrywmsnative.view.dialogs.ask_position_of_lu.DialogAskPositionOfLUComponent;
import it.integry.integrywmsnative.view.dialogs.ask_position_of_lu.DialogAskPositionOfLUModule;
import it.integry.integrywmsnative.view.dialogs.ask_unknown_barcode_notes.DialogAskUnknownBarcodeNotesComponent;
import it.integry.integrywmsnative.view.dialogs.ask_unknown_barcode_notes.DialogAskUnknownBarcodeNotesModule;
import it.integry.integrywmsnative.view.dialogs.ask_vettore.DialogAskVettoreComponent;
import it.integry.integrywmsnative.view.dialogs.ask_vettore.DialogAskVettoreModule;
import it.integry.integrywmsnative.view.dialogs.basket_lu.DialogBasketLUComponent;
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.DialogBindProductBarcodeWithPackageModule;
import it.integry.integrywmsnative.view.dialogs.choose_arts_from_lista_arts.DialogChooseArtsFromMtbAartListComponent;
@@ -124,6 +138,10 @@ import it.integry.integrywmsnative.view.dialogs.choose_arts_from_mtbcolr_list.Di
import it.integry.integrywmsnative.view.dialogs.choose_arts_from_mtbcolr_list.DialogChooseArtsFromMtbColrListModule;
import it.integry.integrywmsnative.view.dialogs.choose_batch_lot.DialogChooseBatchLotComponent;
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.DialogCreateNewArtModule;
import it.integry.integrywmsnative.view.dialogs.extra_info.DialogExtraInfoComponent;
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.DialogInfoAggiuntiveLUModule;
import it.integry.integrywmsnative.view.dialogs.input_lu_prod.DialogInputLUProdComponent;
@@ -140,8 +158,12 @@ import it.integry.integrywmsnative.view.dialogs.scan_art.DialogScanArtComponent;
import it.integry.integrywmsnative.view.dialogs.scan_art.DialogScanArtModule;
import it.integry.integrywmsnative.view.dialogs.scan_or_create_lu.DialogScanOrCreateLUComponent;
import it.integry.integrywmsnative.view.dialogs.scan_or_create_lu.DialogScanOrCreateLUModule;
import it.integry.integrywmsnative.view.dialogs.switch_user_depo.DialogSwitchUserDepoComponent;
import it.integry.integrywmsnative.view.dialogs.switch_user_depo.DialogSwitchUserDepoModule;
import it.integry.integrywmsnative.view.dialogs.tracciamento_imballi.DialogTracciamentoImballiComponent;
import it.integry.integrywmsnative.view.dialogs.tracciamento_imballi.DialogTracciamentoImballiModule;
import it.integry.integrywmsnative.view.dialogs.update_available.DialogUpdateAvailableComponent;
import it.integry.integrywmsnative.view.dialogs.update_available.DialogUpdateAvailableModule;
// Definition of the Application graph
@Singleton
@@ -173,6 +195,7 @@ import it.integry.integrywmsnative.view.dialogs.tracciamento_imballi.DialogTracc
DialogInputLUProdModule.class,
DialogScanArtModule.class,
DialogScanOrCreateLUModule.class,
DialogBasketLUModule.class,
ProdFabbisognoLineeProdModule.class,
VersamentoMerceModule.class,
DialogAskMagazzinoProssimitaModule.class,
@@ -186,6 +209,7 @@ import it.integry.integrywmsnative.view.dialogs.tracciamento_imballi.DialogTracc
DialogSelectDocInfoModule.class,
DocInterniEditFormModule.class,
DialogSelectDocRowsModule.class,
DialogSelectLottiModule.class,
DialogAskClienteModule.class,
DialogEditArticoloModule.class,
DialogPrintOrderSSCCListModule.class,
@@ -215,7 +239,16 @@ import it.integry.integrywmsnative.view.dialogs.tracciamento_imballi.DialogTracc
DialogInfoGiacenzaModule.class,
ArticoliInGiacenzaModule.class,
DialogTracciamentoImballiModule.class,
DialogAskVettoreModule.class
DialogAskVettoreModule.class,
DialogAskVettoreModule.class,
DialogCreateNewArtModule.class,
DialogSwitchUserDepoModule.class,
DialogUpdateAvailableModule.class,
DialogAskPositionOfLUModule.class,
DialogAskLivelloPosizioneModule.class,
VerificaGiacenzeModule.class,
DialogExtraInfoModule.class,
DialogAskDepositoModule.class
})
public interface MainApplicationComponent {
@@ -271,6 +304,8 @@ public interface MainApplicationComponent {
DialogScanOrCreateLUComponent.Factory dialogScanOrCreateLUComponent();
DialogBasketLUComponent.Factory dialogBasketLUComponent();
ProdFabbisognoLineeProdComponent.Factory prodFabbisognoLineeProdComponent();
VersamentoMerceComponent.Factory versamentoMerceComponent();
@@ -332,6 +367,7 @@ public interface MainApplicationComponent {
DialogInfoSituazioneArticoloComponent.Factory dialogInfoSituazioneArticoloComponent();
DialogSelectDocRowsComponent.Factory dialogSelectDocRowsNewComponent();
DialogSelectLottiComponent.Factory dialogSelectLottiComponent();
DialogSelectArtToOrderComponent.Factory dialogSelectArtToOrderNewComponent();
@@ -361,6 +397,26 @@ public interface MainApplicationComponent {
DialogAskVettoreComponent.Factory dialogAskVettoreComponent();
DialogAskCommessaComponent.Factory dialogAskCommessaComponent();
DialogCreateNewArtComponent.Factory dialogCreateNewArtComponent();
DialogSwitchUserDepoComponent.Factory dialogSwitchUserDepoComponent();
ProdRientroMerceOrderListComponent.Factory prodRientroMerceOrderListComponent();
DialogUpdateAvailableComponent.Factory dialogUpdateAvailableComponent();
DialogAskPositionOfLUComponent.Factory dialogAskPositionOfLUComponent();
DialogAskLivelloPosizioneComponent.Factory dialogAskLivelloPosizioneComponent();
VerificaGiacenzeComponent.Factory verificaGiacenzeComponent();
DialogExtraInfoComponent.Factory dialogExtraInfoComponent();
DialogAskDepositoComponent.Factory dialogAskDepositoComponent();
void inject(MainApplication mainApplication);
void inject(AppContext mainApplication);

View File

@@ -19,6 +19,8 @@ import it.integry.integrywmsnative.core.data_store.db.AppDatabase;
import it.integry.integrywmsnative.core.ean128.Ean128Service;
import it.integry.integrywmsnative.core.menu.MenuRESTConsumer;
import it.integry.integrywmsnative.core.menu.MenuService;
import it.integry.integrywmsnative.core.rest.AuthInterceptor;
import it.integry.integrywmsnative.core.rest.RESTBuilder;
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.AziendaRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
@@ -31,17 +33,20 @@ import it.integry.integrywmsnative.core.rest.consumers.DepositoRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.DocumentRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.EntityRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.GestSetupRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.GiacenzaPvRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.GiacenzaRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.ImballiRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.MagazzinoAutomaticoRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.MagazzinoBufferRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.MagazzinoRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.MaterialiRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.MesRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.OrdiniRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.PVOrdiniAcquistoRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.PrinterRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.ProductionLinesRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.ProduzioneRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.VettoriRESTConsumer;
import it.integry.integrywmsnative.core.services.inventario.InventarioService;
@@ -49,6 +54,7 @@ import it.integry.integrywmsnative.core.settings.SettingsManager;
import it.integry.integrywmsnative.core.sound.SoundAlertService;
import it.integry.integrywmsnative.core.update.UpdatesManager;
import it.integry.integrywmsnative.gest.contab_doc_interni.rest.DocInterniRESTConsumer;
import it.integry.integrywmsnative.gest.login.rest.AuthenticationRESTConsumer;
import it.integry.integrywmsnative.gest.prod_fabbisogno_linee_prod.rest.ProdFabbisognoLineeProdRESTConsumer;
import it.integry.integrywmsnative.view.dialogs.DialogProgressView;
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2View;
@@ -82,8 +88,8 @@ public class MainApplicationModule {
@Provides
@Singleton
public SettingsManager provideSettingsManager(SystemRESTConsumer systemRESTConsumer, AziendaRESTConsumer aziendaRESTConsumer, PosizioniRESTConsumer posizioniRESTConsumer, GestSetupRESTConsumer gestSetupRESTConsumer) {
return new SettingsManager(mApplication, systemRESTConsumer, aziendaRESTConsumer, gestSetupRESTConsumer, posizioniRESTConsumer);
public SettingsManager provideSettingsManager(SystemRESTConsumer systemRESTConsumer, ImballiRESTConsumer imballiRESTConsumer, AziendaRESTConsumer aziendaRESTConsumer, PosizioniRESTConsumer posizioniRESTConsumer, GestSetupRESTConsumer gestSetupRESTConsumer) {
return new SettingsManager(mApplication, systemRESTConsumer, imballiRESTConsumer, aziendaRESTConsumer, gestSetupRESTConsumer, posizioniRESTConsumer);
}
@Provides
@@ -94,8 +100,8 @@ public class MainApplicationModule {
@Provides
@Singleton
MainContext providesMainContextNew(MenuService menuService, AppDatabase appDatabase, SystemRESTConsumer systemRESTConsumer) {
return new MainContext(mApplication.getApplicationContext(), menuService, appDatabase, systemRESTConsumer);
MainContext providesMainContextNew(MenuService menuService, AppDatabase appDatabase, SystemRESTConsumer systemRESTConsumer, AuthenticationRESTConsumer authenticationRESTConsumer) {
return new MainContext(mApplication.getApplicationContext(), menuService, appDatabase, systemRESTConsumer, authenticationRESTConsumer);
}
@Provides
@@ -112,6 +118,13 @@ public class MainApplicationModule {
return new Ean128Service();
}
@Provides
@Singleton
RESTBuilder providesRESTBuilder(AuthInterceptor authInterceptor) {
return new RESTBuilder(authInterceptor);
}
@Provides
@Singleton
MenuService provideMenuService(MenuRESTConsumer menuRESTConsumer) {
@@ -120,8 +133,8 @@ public class MainApplicationModule {
@Provides
@Singleton
UpdatesManager provideUpdatesManager() {
return new UpdatesManager();
UpdatesManager provideUpdatesManager(ExecutorService executorService, Handler handler, SystemRESTConsumer systemRESTConsumer) {
return new UpdatesManager(executorService, handler, systemRESTConsumer);
}
@Provides
@@ -138,20 +151,20 @@ public class MainApplicationModule {
@Provides
@Singleton
OrdiniRESTConsumer provideOrdiniRESTConsumer(SystemRESTConsumer systemRESTConsumer, EntityRESTConsumer entityRESTConsumer) {
return new OrdiniRESTConsumer(systemRESTConsumer, entityRESTConsumer);
OrdiniRESTConsumer provideOrdiniRESTConsumer(RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer, EntityRESTConsumer entityRESTConsumer) {
return new OrdiniRESTConsumer(restBuilder, systemRESTConsumer, entityRESTConsumer);
}
@Provides
@Singleton
GestSetupRESTConsumer provideGestSetupRESTConsumer() {
return new GestSetupRESTConsumer();
GestSetupRESTConsumer provideGestSetupRESTConsumer(RESTBuilder restBuilder) {
return new GestSetupRESTConsumer(restBuilder);
}
@Provides
@Singleton
ArticoloRESTConsumer provideArticoloRESTConsumer(SystemRESTConsumer systemRESTConsumer) {
return new ArticoloRESTConsumer(systemRESTConsumer);
ArticoloRESTConsumer provideArticoloRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService, SystemRESTConsumer systemRESTConsumer) {
return new ArticoloRESTConsumer(restBuilder, executorService, systemRESTConsumer);
}
@Provides
@@ -168,41 +181,48 @@ public class MainApplicationModule {
@Provides
@Singleton
MenuRESTConsumer provideMenuRESTConsumer() {
return new MenuRESTConsumer();
MenuRESTConsumer provideMenuRESTConsumer(RESTBuilder restBuilder) {
return new MenuRESTConsumer(restBuilder);
}
@Provides
@Singleton
MagazzinoRESTConsumer provideMagazzinoRESTConsumer(ExecutorService executorService, SystemRESTConsumer systemRESTConsumer) {
return new MagazzinoRESTConsumer(executorService, systemRESTConsumer);
MagazzinoRESTConsumer provideMagazzinoRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService, SystemRESTConsumer systemRESTConsumer) {
return new MagazzinoRESTConsumer(restBuilder, executorService, systemRESTConsumer);
}
@Provides
@Singleton
MesRESTConsumer provideMesRESTConsumer(SystemRESTConsumer systemRESTConsumer) {
return new MesRESTConsumer(systemRESTConsumer);
MesRESTConsumer provideMesRESTConsumer(RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer) {
return new MesRESTConsumer(restBuilder, systemRESTConsumer);
}
@Provides
@Singleton
EntityRESTConsumer provideEntityRESTConsumer() {
return new EntityRESTConsumer();
EntityRESTConsumer provideEntityRESTConsumer(RESTBuilder restBuilder) {
return new EntityRESTConsumer(restBuilder);
}
@Provides
@Singleton
ColliMagazzinoRESTConsumer provideColliMagazzinoRESTConsumer(SystemRESTConsumer systemRESTConsumer,
ColliMagazzinoRESTConsumer provideColliMagazzinoRESTConsumer(RESTBuilder restBuilder,
SystemRESTConsumer systemRESTConsumer,
ArticoloRESTConsumer articoloRESTConsumer,
EntityRESTConsumer entityRESTConsumer,
SettingsManager settingsManager) {
return new ColliMagazzinoRESTConsumer(systemRESTConsumer, articoloRESTConsumer, entityRESTConsumer, settingsManager);
return new ColliMagazzinoRESTConsumer(restBuilder, systemRESTConsumer, articoloRESTConsumer, entityRESTConsumer, settingsManager);
}
@Provides
@Singleton
AziendaRESTConsumer provideAziendaRESTConsumer() {
return new AziendaRESTConsumer();
AziendaRESTConsumer provideAziendaRESTConsumer(RESTBuilder restBuilder) {
return new AziendaRESTConsumer(restBuilder);
}
@Provides
@Singleton
ProduzioneRESTConsumer provideProduzioneRESTConsumer(RESTBuilder restBuilder) {
return new ProduzioneRESTConsumer(restBuilder);
}
@Provides
@@ -213,56 +233,62 @@ public class MainApplicationModule {
@Provides
@Singleton
PrinterRESTConsumer providePrinterRESTConsumer() {
return new PrinterRESTConsumer();
PrinterRESTConsumer providePrinterRESTConsumer(RESTBuilder restBuilder) {
return new PrinterRESTConsumer(restBuilder);
}
@Provides
@Singleton
SystemRESTConsumer provideSystemRESTConsumer() {
return new SystemRESTConsumer();
SystemRESTConsumer provideSystemRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService) {
return new SystemRESTConsumer(restBuilder, executorService);
}
@Provides
@Singleton
PVOrdiniAcquistoRESTConsumer providesPVOrdiniAcquistoRESTConsumer(MagazzinoRESTConsumer magazzinoRESTConsumer) {
return new PVOrdiniAcquistoRESTConsumer(magazzinoRESTConsumer);
PVOrdiniAcquistoRESTConsumer providesPVOrdiniAcquistoRESTConsumer(RESTBuilder restBuilder, MagazzinoRESTConsumer magazzinoRESTConsumer) {
return new PVOrdiniAcquistoRESTConsumer(restBuilder, magazzinoRESTConsumer);
}
@Provides
@Singleton
PosizioniRESTConsumer providesPosizioniRESTConsumer(SystemRESTConsumer systemRESTConsumer) {
return new PosizioniRESTConsumer(systemRESTConsumer);
PosizioniRESTConsumer providesPosizioniRESTConsumer(RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer) {
return new PosizioniRESTConsumer(restBuilder, systemRESTConsumer);
}
@Provides
@Singleton
ProdFabbisognoLineeProdRESTConsumer providesProdFabbisognoLineeProdRESTConsumer(SystemRESTConsumer systemRESTConsumer) {
return new ProdFabbisognoLineeProdRESTConsumer(systemRESTConsumer);
ProdFabbisognoLineeProdRESTConsumer providesProdFabbisognoLineeProdRESTConsumer(RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer) {
return new ProdFabbisognoLineeProdRESTConsumer(restBuilder, systemRESTConsumer);
}
@Provides
@Singleton
DocInterniRESTConsumer provideDocInterniRESTConsumer(MagazzinoRESTConsumer magazzinoRESTConsumer) {
return new DocInterniRESTConsumer(magazzinoRESTConsumer);
DocInterniRESTConsumer provideDocInterniRESTConsumer(RESTBuilder restBuilder, MagazzinoRESTConsumer magazzinoRESTConsumer) {
return new DocInterniRESTConsumer(restBuilder, magazzinoRESTConsumer);
}
@Provides
@Singleton
GiacenzaRESTConsumer provideGiacenzaRESTConsumer(ArticoloRESTConsumer articoloRESTConsumer) {
return new GiacenzaRESTConsumer(articoloRESTConsumer);
GiacenzaRESTConsumer provideGiacenzaRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService, ArticoloRESTConsumer articoloRESTConsumer) {
return new GiacenzaRESTConsumer(restBuilder, executorService, articoloRESTConsumer);
}
@Provides
@Singleton
ImballiRESTConsumer provideImballiRESTConsumer(ExecutorService executorService) {
return new ImballiRESTConsumer(executorService);
GiacenzaPvRESTConsumer provideGiacenzaPvRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService) {
return new GiacenzaPvRESTConsumer(restBuilder, executorService);
}
@Provides
@Singleton
VettoriRESTConsumer provideVettoriRESTConsumer(ExecutorService executorService) {
return new VettoriRESTConsumer(executorService);
ImballiRESTConsumer provideImballiRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService) {
return new ImballiRESTConsumer(restBuilder, executorService);
}
@Provides
@Singleton
VettoriRESTConsumer provideVettoriRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService) {
return new VettoriRESTConsumer(restBuilder, executorService);
}
@Provides
@@ -273,44 +299,50 @@ public class MainApplicationModule {
@Provides
@Singleton
ProductionLinesRESTConsumer provideProductionLinesRESTConsumer() {
return new ProductionLinesRESTConsumer();
ProductionLinesRESTConsumer provideProductionLinesRESTConsumer(RESTBuilder restBuilder) {
return new ProductionLinesRESTConsumer(restBuilder);
}
@Provides
@Singleton
DocumentRESTConsumer provideDocumentiRESTConsumer() {
return new DocumentRESTConsumer();
DocumentRESTConsumer provideDocumentiRESTConsumer(RESTBuilder restBuilder) {
return new DocumentRESTConsumer(restBuilder);
}
@Provides
@Singleton
ColliAccettazioneRESTConsumer provideColliAccettazioneRESTConsumer() {
return new ColliAccettazioneRESTConsumer();
ColliAccettazioneRESTConsumer provideColliAccettazioneRESTConsumer(RESTBuilder restBuilder) {
return new ColliAccettazioneRESTConsumer(restBuilder);
}
@Provides
@Singleton
ColliSpedizioneRESTConsumer provideColliSpedizioneRESTConsumer() {
return new ColliSpedizioneRESTConsumer();
ColliSpedizioneRESTConsumer provideColliSpedizioneRESTConsumer(RESTBuilder restBuilder) {
return new ColliSpedizioneRESTConsumer(restBuilder);
}
@Provides
@Singleton
ColliLavorazioneRESTConsumer provideColliLavorazioneRESTConsumer(SettingsManager settingsManager) {
return new ColliLavorazioneRESTConsumer(settingsManager);
ColliLavorazioneRESTConsumer provideColliLavorazioneRESTConsumer(RESTBuilder restBuilder, SettingsManager settingsManager) {
return new ColliLavorazioneRESTConsumer(restBuilder, settingsManager);
}
@Provides
@Singleton
MagazzinoAutomaticoRESTConsumer provideMagazzinoAutomaticoRESTConsumer() {
return new MagazzinoAutomaticoRESTConsumer();
MagazzinoAutomaticoRESTConsumer provideMagazzinoAutomaticoRESTConsumer(RESTBuilder restBuilder) {
return new MagazzinoAutomaticoRESTConsumer(restBuilder);
}
@Provides
@Singleton
MagazzinoBufferRESTConsumer provideMagazzinoBufferRESTConsumer() {
return new MagazzinoBufferRESTConsumer();
MagazzinoBufferRESTConsumer provideMagazzinoBufferRESTConsumer(RESTBuilder restBuilder) {
return new MagazzinoBufferRESTConsumer(restBuilder);
}
@Provides
@Singleton
MaterialiRESTConsumer provideMaterialiRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService) {
return new MaterialiRESTConsumer(restBuilder, executorService);
}
@Provides

View File

@@ -103,12 +103,12 @@ public class SplashActivity extends BaseActivity implements MainContext.Listener
@Override
public void onDBDataLoading(String item) {
mBinding.loadingInfoTextview.setText("Caricamento " + item);
runOnUiThread(() -> mBinding.loadingInfoTextview.setText("Caricamento " + item));
}
@Override
public void onMenuLoading() {
mBinding.loadingInfoTextview.setText("Caricamento menù");
runOnUiThread(() -> mBinding.loadingInfoTextview.setText("Caricamento menù"));
}
@Override

View File

@@ -0,0 +1,21 @@
package it.integry.integrywmsnative.core.authentication;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jws;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.io.Decoders;
import io.jsonwebtoken.security.Keys;
public class JwtUtils {
private final static String SIGNING_KEY = "gICy3bjD56i/YFnBZZKe5ibiz3Snsp08nybGGziCV4ZcvyXBbyqWUnJ2wTrRXhOuf/xdljPXX0yBaqdAgvKthQ==";
public static Claims parseJwt(String token) {
Jws<Claims> jws = Jwts.parserBuilder()
.setSigningKey(Keys.hmacShaKeyFor(Decoders.BASE64.decode(SIGNING_KEY)))
.build()
.parseClaimsJws(token);
return jws.getBody();
}
}

View File

@@ -85,7 +85,7 @@ public class BarcodeManager {
private static BarcodeCallbackDTO getValidCallback() {
if (mBarcodeCallbacksStacktrace.size() > 0) {
if (!mBarcodeCallbacksStacktrace.isEmpty()) {
return mBarcodeCallbacksStacktrace.get(mBarcodeCallbacksStacktrace.size() - 1);
} else {
return null;
@@ -106,7 +106,7 @@ public class BarcodeManager {
int newID = -1;
if (mBarcodeCallbacksStacktrace.size() > 0) {
if (!mBarcodeCallbacksStacktrace.isEmpty()) {
newID = mBarcodeCallbacksStacktrace.get(mBarcodeCallbacksStacktrace.size() - 1).getID() + 1;
} else {
newID = 1;

View File

@@ -19,6 +19,7 @@ import it.integry.integrywmsnative.gest.prod_riposizionamento_da_prod.ProdRiposi
import it.integry.integrywmsnative.gest.prod_versamento_materiale.ProdVersamentoMaterialeFragment;
import it.integry.integrywmsnative.gest.prod_versamento_materiale_su_mag_prossimita.ProdVersamentoMaterialeInBufferFragment;
import it.integry.integrywmsnative.gest.pv_ordini_acquisto.PVOrdiniAcquistoGrigliaFragment;
import it.integry.integrywmsnative.gest.pv_verifica_giacenze.VerificaGiacenzeFragment;
import it.integry.integrywmsnative.gest.rettifica_giacenze.RettificaGiacenzeFragment;
import it.integry.integrywmsnative.gest.spedizione.dialogs.row_info.info_situazione_articolo.DialogInfoSituazioneArticoloView;
import it.integry.integrywmsnative.gest.ultime_consegne_cliente.UltimeConsegneClienteFragment;
@@ -88,7 +89,8 @@ public class MenuConfiguration extends BaseMenuConfiguration {
.setTitleText(R.string.free_picking)
.setTitleIcon(R.drawable.ic_dashboard_picking_libero)
.setDrawerIcon(R.drawable.ic_black_barcode_scanner)
.setFragmentFactory(() -> PickingLiberoFragment.newInstance(R.string.free_picking, GestioneEnum.VENDITA, SettingsManager.iDB().isFlagAskClienteInPickingLibero(), false)))
.setFragmentFactory(() -> PickingLiberoFragment.newInstance(R.string.free_picking, GestioneEnum.VENDITA,
SettingsManager.iDB().isFlagAskClienteInPickingLibero(), false, false)))
.addItem(new MenuItem()
.setID(R.id.nav_resi_cliente)
@@ -124,7 +126,8 @@ public class MenuConfiguration extends BaseMenuConfiguration {
.setTitleText(R.string.free_lav_picking)
.setTitleIcon(R.drawable.ic_dashboard_prod_picking_libero)
.setDrawerIcon(R.drawable.ic_black_barcode_scanner)
.setFragmentFactory(() -> PickingLiberoFragment.newInstance(R.string.free_lav_picking, GestioneEnum.LAVORAZIONE, SettingsManager.iDB().isFlagAskClienteInPickingLibero(), false)))
.setFragmentFactory(() -> PickingLiberoFragment.newInstance(R.string.free_lav_picking, GestioneEnum.LAVORAZIONE,
SettingsManager.iDB().isFlagAskClienteInPickingLibero(), false, SettingsManager.iDB().isFlagAskCommessaInPickingLiberoLav())))
.addItem(new MenuItem()
.setID(R.id.nav_prod_posizionamento_da_ord)
@@ -180,7 +183,7 @@ public class MenuConfiguration extends BaseMenuConfiguration {
.setTitleText(R.string.prod_versamento_su_ordine_title_fragment)
.setTitleIcon(R.drawable.ic_dashboard_prod_versamento_su_ord)
.setDrawerIcon(R.drawable.ic_black_external)
.setFragmentFactory(() -> PickingLiberoFragment.newInstance(R.string.prod_versamento_su_ordine_title_fragment, GestioneEnum.LAVORAZIONE, false, true)))
.setFragmentFactory(() -> PickingLiberoFragment.newInstance(R.string.prod_versamento_su_ordine_title_fragment, GestioneEnum.LAVORAZIONE, false, true, false)))
.addItem(new MenuItem()
.setID(R.id.nav_prod_riposizionamento_da_ord)
@@ -240,6 +243,7 @@ public class MenuConfiguration extends BaseMenuConfiguration {
.setTitleIcon(it.integry.integrywmsnative.R.drawable.ic_dashboard_purchase_orders_pv)
.setDrawerIcon(it.integry.integrywmsnative.R.drawable.ic_dashboard_purchase_orders_pv)
.setFragmentFactory(PVOrdiniAcquistoGrigliaFragment::newInstance))
.addItem(new MenuItem()
.setCodMenu("MG058")
.setID(it.integry.integrywmsnative.R.id.nav_pv_doc_interni)
@@ -248,6 +252,14 @@ public class MenuConfiguration extends BaseMenuConfiguration {
.setDrawerIcon(R.drawable.ic_documents_outline)
.setFragmentFactory(DocInterniFragment::newInstance))
.addItem(new MenuItem()
.setCodMenu("MG075")
.setID(it.integry.integrywmsnative.R.id.nav_pv_verifica_giacenze)
.setTitleText(R.string.verifica_giacenze_menu)
.setTitleIcon(R.drawable.ic_dashboard_verifica_giacenze)
.setDrawerIcon(R.drawable.ic_drawer_verifica_giacenze)
.setFragmentFactory(VerificaGiacenzeFragment::newInstance))
// .addItem(new MenuItem()
// .setID(it.integry.integrywmsnative.R.id.nav_pv_ordini_acquisto_trasmessi)
// .setTitleText(it.integry.integrywmsnative.R.string.transmitted_orders)

View File

@@ -19,6 +19,7 @@ import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
import it.integry.integrywmsnative.core.rest.watcher.ServerStatusChecker;
import it.integry.integrywmsnative.core.settings.SettingsManager;
import it.integry.integrywmsnative.core.utility.UtilityThread;
import it.integry.integrywmsnative.gest.login.rest.AuthenticationRESTConsumer;
@Singleton
public class MainContext {
@@ -27,18 +28,19 @@ public class MainContext {
private final MenuService menuService;
private final AppDatabase appDatabase;
private final SystemRESTConsumer systemRESTConsumer;
private final AuthenticationRESTConsumer authenticationRESTConsumer;
private Listener mListener;
public MainContext(Context applicationContext, MenuService menuService, AppDatabase appDatabase, SystemRESTConsumer systemRESTConsumer) {
public MainContext(Context applicationContext, MenuService menuService, AppDatabase appDatabase, SystemRESTConsumer systemRESTConsumer, AuthenticationRESTConsumer authenticationRESTConsumer) {
this.applicationContext = applicationContext;
this.menuService = menuService;
this.appDatabase = appDatabase;
this.systemRESTConsumer = systemRESTConsumer;
this.authenticationRESTConsumer = authenticationRESTConsumer;
}
public void init() {
try {
BarcodeManager.init(applicationContext);
} catch (Exception exception) {
@@ -46,20 +48,42 @@ public class MainContext {
}
this.initDeviceId(() -> {
//this.initAuthSession(() -> {
// this.initDeviceId(() -> {
this.initDBData(() -> {
this.initMenu(() -> {
if (mListener != null) mListener.onContextInitialized();
});
});
});
// });
//});
this.initServerStatusChecker();
// EventBus.getDefault().register(this);
}
// @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) {
this.authenticationRESTConsumer.me(obj -> {
onComplete.run();
}, ex -> {
if (mListener != null) mListener.onError(new SpannedString(ex.getMessage()));
});
}
private void initDeviceId(Runnable onComplete) {
if (SettingsManager.i().getUserSession().getDeviceId() != null) {
@@ -72,9 +96,9 @@ public class MainContext {
SettingsManager.i().getUserSession().setDeviceId(fid.getResult());
SettingsManager.update();
systemRESTConsumer.registerDevice(onComplete, ex -> {
if (mListener != null) mListener.onError(new SpannedString(ex.getMessage()));
});
// systemRESTConsumer.registerDevice(onComplete, ex -> {
// if (mListener != null) mListener.onError(new SpannedString(ex.getMessage()));
// });
});
}

View File

@@ -30,7 +30,7 @@ public class DataCache {
Object foundDataCache = null;
if(dataCacheTemp != null && dataCacheTemp.size() > 0) {
if(dataCacheTemp != null && !dataCacheTemp.isEmpty()) {
foundDataCache = dataCacheTemp.get(0).getItem();
dataCacheList.remove(dataCacheTemp.get(0));
}

View File

@@ -46,7 +46,7 @@ public class ColliDataRecoverService {
}
public boolean thereIsAnExistantSession() {
return mtbColtsSessions != null && mtbColtsSessions.size() > 0;
return mtbColtsSessions != null && !mtbColtsSessions.isEmpty();
}
public List<Integer> getAllSessionIDs() {

View File

@@ -22,14 +22,18 @@ import it.integry.integrywmsnative.core.data_store.db.dao.MtbColrDao;
import it.integry.integrywmsnative.core.data_store.db.dao.MtbColtDao;
import it.integry.integrywmsnative.core.data_store.db.dao.OrdineDao;
import it.integry.integrywmsnative.core.data_store.db.dao.RawDao;
import it.integry.integrywmsnative.core.data_store.db.dao.VerificaGiacenzeDao;
import it.integry.integrywmsnative.core.data_store.db.dao.VerificaGiacenzeRowDao;
import it.integry.integrywmsnative.core.data_store.db.entity.ArticoloGriglia;
import it.integry.integrywmsnative.core.data_store.db.entity.ArticoloOrdine;
import it.integry.integrywmsnative.core.data_store.db.entity.Griglia;
import it.integry.integrywmsnative.core.data_store.db.entity.InventarioRoomDTO;
import it.integry.integrywmsnative.core.data_store.db.entity.InventarioEntity;
import it.integry.integrywmsnative.core.data_store.db.entity.InventarioRowRoomDTO;
import it.integry.integrywmsnative.core.data_store.db.entity.Ordine;
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColr;
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColt;
import it.integry.integrywmsnative.core.data_store.db.entity.VerificaGiacenzeEntity;
import it.integry.integrywmsnative.core.data_store.db.entity.VerificaGiacenzeRowEntity;
@Database(entities = {
ArticoloGriglia.class,
@@ -38,10 +42,12 @@ import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColt;
ArticoloOrdine.class,
SqlMtbColt.class,
SqlMtbColr.class,
InventarioRoomDTO.class,
InventarioRowRoomDTO.class
InventarioEntity.class,
InventarioRowRoomDTO.class,
VerificaGiacenzeEntity.class,
VerificaGiacenzeRowEntity.class
},
version = 17)
version = 18)
@TypeConverters({
DateConverter.class,
BigDecimalConverter.class,
@@ -70,7 +76,8 @@ public abstract class AppDatabase extends RoomDatabase {
.addMigrations(MIGRATION_13_14)
.addMigrations(MIGRATION_14_15)
.addMigrations(MIGRATION_15_16)
.addMigrations(MIGRATION_16_17);
.addMigrations(MIGRATION_16_17)
.addMigrations(MIGRATION_17_18);
sInstance = builder.build();
}
@@ -95,6 +102,10 @@ public abstract class AppDatabase extends RoomDatabase {
public abstract InventarioRowDao inventarioRowDao();
public abstract VerificaGiacenzeDao verificaGiacenzeDao();
public abstract VerificaGiacenzeRowDao verificaGiacenzeRowDao();
static final Migration MIGRATION_10_11 = new Migration(10, 11) {
@@ -182,4 +193,28 @@ public abstract class AppDatabase extends RoomDatabase {
database.execSQL("DROP TABLE _inventario_rows_old;");
}
};
static final Migration MIGRATION_17_18 = new Migration(17, 18) {
@Override
public void migrate(@NonNull SupportSQLiteDatabase database) {
database.execSQL("CREATE TABLE IF NOT EXISTS verifica_giacenze (_id INTEGER PRIMARY KEY AUTOINCREMENT, cod_mdep TEXT NOT NULL, data INTEGER, remote_sync_date INTEGER);");
database.execSQL("CREATE INDEX IF NOT EXISTS index_verifica_giacenze__id ON verifica_giacenze (_id);");
database.execSQL("CREATE TABLE IF NOT EXISTS verifica_giacenze_rows (" +
"_id INTEGER PRIMARY KEY AUTOINCREMENT, " +
"parent_id INTEGER, " +
"created_at INTEGER DEFAULT CURRENT_TIMESTAMP, " +
"cod_mart TEXT, " +
"partita_mag TEXT, " +
"descrizione TEXT, " +
"qta_in_giacenza REAL NOT NULL DEFAULT 0, " +
"qta REAL NOT NULL DEFAULT 0, " +
"num_cnf REAL NOT NULL DEFAULT 0, " +
"qta_cnf REAL NOT NULL DEFAULT 0, " +
"scan_cod_barre TEXT, " +
"remote_sync_date INTEGER, " +
"FOREIGN KEY(parent_id) REFERENCES verifica_giacenze(_id) ON UPDATE NO ACTION ON DELETE CASCADE );");
database.execSQL("CREATE INDEX IF NOT EXISTS index_verifica_giacenze_rows__id ON verifica_giacenze_rows (_id)");
database.execSQL("CREATE INDEX IF NOT EXISTS index_verifica_giacenze_rows_parent_id ON verifica_giacenze_rows (parent_id)");
}
};
}

View File

@@ -18,6 +18,8 @@ import it.integry.integrywmsnative.core.data_store.db.dao.MtbColrDao;
import it.integry.integrywmsnative.core.data_store.db.dao.MtbColtDao;
import it.integry.integrywmsnative.core.data_store.db.dao.OrdineDao;
import it.integry.integrywmsnative.core.data_store.db.dao.RawDao;
import it.integry.integrywmsnative.core.data_store.db.dao.VerificaGiacenzeDao;
import it.integry.integrywmsnative.core.data_store.db.dao.VerificaGiacenzeRowDao;
import it.integry.integrywmsnative.core.data_store.db.repository.ArticoliOrdineRepository;
import it.integry.integrywmsnative.core.data_store.db.repository.ArticoloGrigliaRepository;
import it.integry.integrywmsnative.core.data_store.db.repository.GrigliaRepository;
@@ -32,10 +34,17 @@ import it.integry.integrywmsnative.core.data_store.db.repository.datasource.SqlM
import it.integry.integrywmsnative.core.data_store.db.repository.datasource.SqlMtbColtDataSource;
import it.integry.integrywmsnative.core.data_store.db.respository_new.InventarioRepository;
import it.integry.integrywmsnative.core.data_store.db.respository_new.InventarioRowRepository;
import it.integry.integrywmsnative.core.data_store.db.respository_new.VerificaGiacenzeRepository;
import it.integry.integrywmsnative.core.data_store.db.respository_new.VerificaGiacenzeRowRepository;
import it.integry.integrywmsnative.core.data_store.db.respository_new.data_source.InventarioLocalDataSource;
import it.integry.integrywmsnative.core.data_store.db.respository_new.data_source.InventarioRowLocalDataSource;
import it.integry.integrywmsnative.core.data_store.db.respository_new.data_source.VerificaGiacenzeLocalDataSource;
import it.integry.integrywmsnative.core.data_store.db.respository_new.data_source.VerificaGiacenzeRowLocalDataSource;
import it.integry.integrywmsnative.core.mapper.InventarioMapper;
import it.integry.integrywmsnative.core.mapper.InventarioRowMapper;
import it.integry.integrywmsnative.core.mapper.VerificaGiacenzeMapper;
import it.integry.integrywmsnative.core.mapper.VerificaGiacenzeRowMapper;
import it.integry.integrywmsnative.core.rest.consumers.GiacenzaPvRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.InventarioRESTConsumer;
@Module
@@ -108,6 +117,11 @@ public class RoomModule {
return appDatabase.inventarioRowDao();
}
@Singleton
@Provides
InventarioMapper providesInventarioMapper(InventarioRowMapper inventarioRowMapper) {
return new InventarioMapper(inventarioRowMapper);
}
@Singleton
@Provides
@@ -117,8 +131,26 @@ public class RoomModule {
@Singleton
@Provides
InventarioMapper providesInventarioMapper(InventarioRowMapper inventarioRowMapper) {
return new InventarioMapper(inventarioRowMapper);
VerificaGiacenzeDao providesVerificaGiacenzeDao(AppDatabase appDatabase) {
return appDatabase.verificaGiacenzeDao();
}
@Singleton
@Provides
VerificaGiacenzeRowDao providesVerificaGiacenzeRowDao(AppDatabase appDatabase) {
return appDatabase.verificaGiacenzeRowDao();
}
@Singleton
@Provides
VerificaGiacenzeMapper providesVerificaGiacenzeMapper(VerificaGiacenzeRowMapper verificaGiacenzeRowMapper) {
return new VerificaGiacenzeMapper(verificaGiacenzeRowMapper);
}
@Singleton
@Provides
VerificaGiacenzeRowMapper providesVerificaGiacenzeRowMapper() {
return new VerificaGiacenzeRowMapper();
}
@@ -182,4 +214,20 @@ public class RoomModule {
return new InventarioRowRepository(inventarioRowLocalDataSource, inventarioRESTConsumer, inventarioRowMapper, handler);
}
@Provides
VerificaGiacenzeRepository providesVerificaGiacenzeRepository(ExecutorService executorService, Handler handler,
VerificaGiacenzeLocalDataSource verificaGiacenzeLocalDataSource,
GiacenzaPvRESTConsumer giacenzaPvRESTConsumer,
VerificaGiacenzeMapper verificaGiacenzeMapper) {
return new VerificaGiacenzeRepository(verificaGiacenzeLocalDataSource, giacenzaPvRESTConsumer, verificaGiacenzeMapper, handler, executorService);
}
@Provides
VerificaGiacenzeRowRepository providesVerificaGiacenzeRowRepository(ExecutorService executorService, Handler handler,
VerificaGiacenzeRowLocalDataSource verificaGiacenzeRowLocalDataSource,
GiacenzaPvRESTConsumer giacenzaPvRESTConsumer,
VerificaGiacenzeRowMapper verificaGiacenzeRowMapper) {
return new VerificaGiacenzeRowRepository(verificaGiacenzeRowLocalDataSource, giacenzaPvRESTConsumer, verificaGiacenzeRowMapper, handler, executorService);
}
}

View File

@@ -7,21 +7,21 @@ import java.util.List;
import io.reactivex.rxjava3.core.Flowable;
import it.integry.integrywmsnative.core.data_store.db.entity.BaseSyncDTO;
import it.integry.integrywmsnative.core.data_store.db.entity.InventarioRoomDTO;
import it.integry.integrywmsnative.core.data_store.db.entity.InventarioEntity;
import it.integry.integrywmsnative.core.data_store.db.interfaces.EntityDaoInterface;
@Dao
public interface InventarioDao extends EntityDaoInterface<InventarioRoomDTO> {
public interface InventarioDao extends EntityDaoInterface<InventarioEntity> {
@Query("SELECT * FROM " + InventarioRoomDTO.TABLE_NAME +
@Query("SELECT * FROM " + InventarioEntity.TABLE_NAME +
" WHERE ((:toBeSync = 1 AND " + BaseSyncDTO.Columns.COLUMN_REMOTE_SYNC_DATE + " IS NULL) OR (:toBeSync = 0))")
List<InventarioRoomDTO> selectAll(boolean toBeSync);
List<InventarioEntity> selectAll(boolean toBeSync);
@Query("SELECT * FROM " + InventarioRoomDTO.TABLE_NAME +
@Query("SELECT * FROM " + InventarioEntity.TABLE_NAME +
" WHERE ((:toBeSync = 1 AND " + BaseSyncDTO.Columns.COLUMN_REMOTE_SYNC_DATE + " IS NULL) OR (:toBeSync = 0))" +
" ORDER BY " + InventarioRoomDTO.Columns.DATA_INVENTARIO + " DESC")
Flowable<List<InventarioRoomDTO>> selectAllFlowable(boolean toBeSync);
" ORDER BY " + InventarioEntity.Columns.DATA_INVENTARIO + " DESC")
Flowable<List<InventarioEntity>> selectAllFlowable(boolean toBeSync);
}

View File

@@ -0,0 +1,42 @@
package it.integry.integrywmsnative.core.data_store.db.dao;
import androidx.room.Dao;
import androidx.room.Query;
import androidx.room.Transaction;
import java.util.List;
import io.reactivex.rxjava3.core.Flowable;
import it.integry.integrywmsnative.core.data_store.db.entity.BaseSyncDTO;
import it.integry.integrywmsnative.core.data_store.db.entity.VerificaGiacenzeEntity;
import it.integry.integrywmsnative.core.data_store.db.entity.VerificaGiacenzeRowEntity;
import it.integry.integrywmsnative.core.data_store.db.interfaces.EntityDaoInterface;
import it.integry.integrywmsnative.core.data_store.db.wrappers.VerificaGiacenzeWithRowsWrapper;
@Dao
public interface VerificaGiacenzeDao extends EntityDaoInterface<VerificaGiacenzeEntity> {
@Transaction
@Query("SELECT * FROM " + VerificaGiacenzeEntity.TABLE_NAME +
" WHERE ((:toBeSync = 1 AND " + BaseSyncDTO.Columns.COLUMN_REMOTE_SYNC_DATE + " IS NULL) OR (:toBeSync = 0))")
List<VerificaGiacenzeWithRowsWrapper> selectAll(boolean toBeSync);
@Transaction
@Query("SELECT * FROM " + VerificaGiacenzeEntity.TABLE_NAME +
" WHERE ((:toBeSync = 1 AND " + BaseSyncDTO.Columns.COLUMN_REMOTE_SYNC_DATE + " IS NULL) OR (:toBeSync = 0))" +
" ORDER BY " + VerificaGiacenzeEntity.Columns.DATA + " DESC")
Flowable<List<VerificaGiacenzeWithRowsWrapper>> selectAllFlowable(boolean toBeSync);
@Transaction
@Query("SELECT * FROM " + VerificaGiacenzeEntity.TABLE_NAME +
" WHERE ((:toBeSync = 1 AND " + BaseSyncDTO.Columns.COLUMN_REMOTE_SYNC_DATE + " IS NULL) OR (:toBeSync = 0))" +
" ORDER BY " + VerificaGiacenzeEntity.Columns.DATA + " DESC" +
" LIMIT 1")
VerificaGiacenzeWithRowsWrapper selectLast(boolean toBeSync);
@Query("SELECT COALESCE(strftime('%s', 'now') - MAX(" + VerificaGiacenzeRowEntity.Columns.CREATED_AT + ") < :maxMinutes * 60, 0) as any_verifica_to_be_recovered" +
" FROM " + VerificaGiacenzeRowEntity.TABLE_NAME +
" WHERE (" + BaseSyncDTO.Columns.COLUMN_REMOTE_SYNC_DATE + " IS NULL)")
boolean isAnotherVerificaGiacenzeInProgress(int maxMinutes);
}

View File

@@ -0,0 +1,25 @@
package it.integry.integrywmsnative.core.data_store.db.dao;
import androidx.room.Dao;
import androidx.room.Query;
import java.util.List;
import io.reactivex.rxjava3.core.Flowable;
import it.integry.integrywmsnative.core.data_store.db.entity.BaseSyncDTO;
import it.integry.integrywmsnative.core.data_store.db.entity.VerificaGiacenzeRowEntity;
import it.integry.integrywmsnative.core.data_store.db.interfaces.EntityDaoInterface;
@Dao
public interface VerificaGiacenzeRowDao extends EntityDaoInterface<VerificaGiacenzeRowEntity> {
@Query("SELECT * FROM " + VerificaGiacenzeRowEntity.TABLE_NAME +
" WHERE ((:toBeSync = 1 AND " + BaseSyncDTO.Columns.COLUMN_REMOTE_SYNC_DATE + " IS NULL) OR (:toBeSync = 0))")
List<VerificaGiacenzeRowEntity> selectAll(boolean toBeSync);
@Query("SELECT * FROM " + VerificaGiacenzeRowEntity.TABLE_NAME +
" WHERE ((:toBeSync = 1 AND " + BaseSyncDTO.Columns.COLUMN_REMOTE_SYNC_DATE + " IS NULL) OR (:toBeSync = 0))")
Flowable<List<VerificaGiacenzeRowEntity>> selectAllFlowable(boolean toBeSync);
}

View File

@@ -12,8 +12,8 @@ import java.util.List;
import it.integry.integrywmsnative.core.data_store.db.interfaces.EntityModelInterface;
@Entity(tableName = InventarioRoomDTO.TABLE_NAME)
public class InventarioRoomDTO extends BaseSyncDTO implements EntityModelInterface {
@Entity(tableName = InventarioEntity.TABLE_NAME)
public class InventarioEntity extends BaseSyncDTO implements EntityModelInterface {
public static final String TABLE_NAME = "inventari";

View File

@@ -4,7 +4,6 @@ import androidx.annotation.NonNull;
import androidx.room.ColumnInfo;
import androidx.room.Entity;
import androidx.room.ForeignKey;
import androidx.room.PrimaryKey;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@@ -12,10 +11,11 @@ import java.time.LocalDateTime;
import it.integry.integrywmsnative.core.data_store.db.interfaces.EntityModelInterface;
@Entity(
inheritSuperIndices = true,
tableName = InventarioRowRoomDTO.TABLE_NAME,
foreignKeys = {
@ForeignKey(
entity = InventarioRoomDTO.class,
entity = InventarioEntity.class,
parentColumns = {BaseSyncDTO.Columns.ID},
childColumns = {InventarioRowRoomDTO.Columns.PARENT_ID},
onDelete = ForeignKey.CASCADE
@@ -40,13 +40,6 @@ public class InventarioRowRoomDTO extends BaseSyncDTO implements EntityModelInte
public static final String ZONA = "zona";
}
/**
* The unique ID
*/
@PrimaryKey(autoGenerate = true)
@ColumnInfo(index = true, name = BaseSyncDTO.Columns.ID)
private Long id;
@ColumnInfo(index = true, name = Columns.PARENT_ID)
private Long parentId;

View File

@@ -0,0 +1,78 @@
package it.integry.integrywmsnative.core.data_store.db.entity;
import androidx.annotation.NonNull;
import androidx.room.ColumnInfo;
import androidx.room.Entity;
import androidx.room.Ignore;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Objects;
import it.integry.integrywmsnative.core.data_store.db.interfaces.EntityModelInterface;
@Entity(
inheritSuperIndices = true,
tableName = VerificaGiacenzeEntity.TABLE_NAME
)
public class VerificaGiacenzeEntity extends BaseSyncDTO implements EntityModelInterface {
public static final String TABLE_NAME = "verifica_giacenze";
public static class Columns {
public static final String COD_MDEP = "cod_mdep";
public static final String DATA = "data";
}
@NonNull
@ColumnInfo(name = VerificaGiacenzeEntity.Columns.COD_MDEP)
private String codMdep;
@ColumnInfo(name = VerificaGiacenzeEntity.Columns.DATA)
private LocalDateTime data;
@Ignore
private List<VerificaGiacenzeRowEntity> verificaGiacenzeRowList;
@NonNull
public String getCodMdep() {
return codMdep;
}
public void setCodMdep(@NonNull String codMdep) {
this.codMdep = codMdep;
}
public LocalDateTime getData() {
return data;
}
public void setData(LocalDateTime data) {
this.data = data;
}
public List<VerificaGiacenzeRowEntity> getVerificaGiacenzeRowList() {
return verificaGiacenzeRowList;
}
public void setVerificaGiacenzeRowList(List<VerificaGiacenzeRowEntity> verificaGiacenzeRowList) {
this.verificaGiacenzeRowList = verificaGiacenzeRowList;
}
@Override
public boolean equals(Object o) {
if (o == null || getClass() != o.getClass()) return false;
VerificaGiacenzeEntity that = (VerificaGiacenzeEntity) o;
return getId().equals(that.getId()) && getCodMdep().equals(that.getCodMdep()) && Objects.equals(getData(), that.getData()) && Objects.equals(getVerificaGiacenzeRowList(), that.getVerificaGiacenzeRowList());
}
@Override
public int hashCode() {
int result = getId().hashCode();
result = 31 * result + getCodMdep().hashCode();
result = 31 * result + Objects.hashCode(getData());
result = 31 * result + Objects.hashCode(getVerificaGiacenzeRowList());
return result;
}
}

View File

@@ -0,0 +1,211 @@
package it.integry.integrywmsnative.core.data_store.db.entity;
import androidx.annotation.NonNull;
import androidx.room.ColumnInfo;
import androidx.room.Entity;
import androidx.room.ForeignKey;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Objects;
import it.integry.integrywmsnative.core.data_store.db.interfaces.EntityModelInterface;
@Entity(
inheritSuperIndices = true,
tableName = VerificaGiacenzeRowEntity.TABLE_NAME,
foreignKeys = {
@ForeignKey(
entity = VerificaGiacenzeEntity.class,
parentColumns = {BaseSyncDTO.Columns.ID},
childColumns = {VerificaGiacenzeRowEntity.Columns.PARENT_ID},
onDelete = ForeignKey.CASCADE
)
}
)
public class VerificaGiacenzeRowEntity extends BaseSyncDTO implements EntityModelInterface, Cloneable {
public static final String TABLE_NAME = "verifica_giacenze_rows";
public static class Columns {
public static final String PARENT_ID = "parent_id";
public static final String CREATED_AT = "created_at";
public static final String COD_MART = "cod_mart";
public static final String PARTITA_MAG = "partita_mag";
public static final String DESCRIZIONE = "descrizione";
public static final String QTA_IN_GIACENZA = "qta_in_giacenza";
public static final String QTA = "qta";
public static final String NUM_CNF = "num_cnf";
public static final String QTA_CNF = "qta_cnf";
public static final String SCAN_COD_BARRE = "scan_cod_barre";
}
@ColumnInfo(index = true, name = Columns.PARENT_ID)
private Long parentId;
@ColumnInfo(name = Columns.CREATED_AT, defaultValue = "CURRENT_TIMESTAMP")
private LocalDateTime createdAt = LocalDateTime.now();
@ColumnInfo(name = Columns.COD_MART)
private String codMart;
@ColumnInfo(name = Columns.PARTITA_MAG)
private String partitaMag;
@ColumnInfo(name = Columns.DESCRIZIONE)
private String descrizione;
@NonNull
@ColumnInfo(name = Columns.QTA_IN_GIACENZA, defaultValue = "0")
private BigDecimal qtaInGiacenza;
@NonNull
@ColumnInfo(name = Columns.QTA, defaultValue = "0")
private BigDecimal qta;
@NonNull
@ColumnInfo(name = Columns.NUM_CNF, defaultValue = "0")
private BigDecimal numConf;
@NonNull
@ColumnInfo(name = Columns.QTA_CNF, defaultValue = "0")
private BigDecimal qtaConf;
@ColumnInfo(name = Columns.SCAN_COD_BARRE)
private String scanCodBarre;
public Long getParentId() {
return parentId;
}
public void setParentId(Long parentId) {
this.parentId = parentId;
}
public LocalDateTime getCreatedAt() {
return createdAt;
}
public void setCreatedAt(LocalDateTime createdAt) {
this.createdAt = createdAt;
}
public String getCodMart() {
return codMart;
}
public void setCodMart(String codMart) {
this.codMart = codMart;
}
public String getPartitaMag() {
return partitaMag;
}
public void setPartitaMag(String partitaMag) {
this.partitaMag = partitaMag;
}
public String getDescrizione() {
return descrizione;
}
public void setDescrizione(String descrizione) {
this.descrizione = descrizione;
}
@NonNull
public BigDecimal getQtaInGiacenza() {
return qtaInGiacenza;
}
public void setQtaInGiacenza(@NonNull BigDecimal qtaInGiacenza) {
this.qtaInGiacenza = qtaInGiacenza;
}
@NonNull
public BigDecimal getQta() {
return qta;
}
public void setQta(@NonNull BigDecimal qta) {
this.qta = qta;
}
@NonNull
public BigDecimal getNumConf() {
return numConf;
}
public void setNumConf(@NonNull BigDecimal numConf) {
this.numConf = numConf;
}
@NonNull
public BigDecimal getQtaConf() {
return qtaConf;
}
public void setQtaConf(@NonNull BigDecimal qtaConf) {
this.qtaConf = qtaConf;
}
public String getScanCodBarre() {
return scanCodBarre;
}
public void setScanCodBarre(String scanCodBarre) {
this.scanCodBarre = scanCodBarre;
}
@Override
public boolean equals(Object o) {
if (o == null || getClass() != o.getClass()) return false;
VerificaGiacenzeRowEntity that = (VerificaGiacenzeRowEntity) o;
return getId().equals(that.getId()) && getParentId().equals(that.getParentId()) && getCodMart().equals(that.getCodMart()) && Objects.equals(getPartitaMag(), that.getPartitaMag()) && getQta().equals(that.getQta()) && getNumConf().equals(that.getNumConf()) && getQtaConf().equals(that.getQtaConf()) && Objects.equals(getScanCodBarre(), that.getScanCodBarre());
}
@Override
public int hashCode() {
int result = getId().hashCode();
result = 31 * result + getParentId().hashCode();
result = 31 * result + getCodMart().hashCode();
result = 31 * result + Objects.hashCode(getPartitaMag());
result = 31 * result + getQta().hashCode();
result = 31 * result + getNumConf().hashCode();
result = 31 * result + getQtaConf().hashCode();
result = 31 * result + Objects.hashCode(getScanCodBarre());
return result;
}
@NonNull
@Override
public VerificaGiacenzeRowEntity clone() throws CloneNotSupportedException {
try {
VerificaGiacenzeRowEntity clone = (VerificaGiacenzeRowEntity) super.clone();
// Clona ID
clone.setId(getId() != null ? new Long(getId()) : null);
clone.setParentId(getParentId() != null ? new Long(getParentId()) : null);
// Clona le stringhe
clone.setCodMart(getCodMart() != null ? new String(getCodMart()) : null);
clone.setPartitaMag(getPartitaMag() != null ? new String(getPartitaMag()) : null);
clone.setDescrizione(getDescrizione() != null ? new String(getDescrizione()) : null);
clone.setScanCodBarre(getScanCodBarre() != null ? new String(getScanCodBarre()) : null);
// Clona i BigDecimal
clone.setQta(getQta() != null ? new BigDecimal(getQta().toString()) : null);
clone.setNumConf(getNumConf() != null ? new BigDecimal(getNumConf().toString()) : null);
clone.setQtaConf(getQtaConf() != null ? new BigDecimal(getQtaConf().toString()) : null);
return clone;
} catch (CloneNotSupportedException e) {
throw new AssertionError(); // Can't happen
}
}
}

View File

@@ -15,7 +15,7 @@ import java.util.concurrent.ExecutorService;
import javax.inject.Inject;
import io.reactivex.rxjava3.schedulers.Schedulers;
import it.integry.integrywmsnative.core.data_store.db.entity.InventarioRoomDTO;
import it.integry.integrywmsnative.core.data_store.db.entity.InventarioEntity;
import it.integry.integrywmsnative.core.data_store.db.respository_new.data_source.InventarioLocalDataSource;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.mapper.InventarioMapper;
@@ -24,13 +24,13 @@ import it.integry.integrywmsnative.core.rest.consumers.InventarioRESTConsumer;
import it.integry.integrywmsnative.core.settings.SettingsManager;
import it.integry.integrywmsnative.core.utility.UtilityLiveData;
public class InventarioRepository extends _BaseRepository<MtbInvent, InventarioRoomDTO, InventarioMapper, InventarioLocalDataSource, InventarioRESTConsumer> {
public class InventarioRepository extends _BaseRepository<MtbInvent, InventarioEntity, InventarioMapper, InventarioLocalDataSource, InventarioRESTConsumer> {
private final ExecutorService executorService;
private final Handler handler;
private final MutableLiveData<List<InventarioRoomDTO>> internalLiveData = new MutableLiveData<>();
private final MutableLiveData<List<InventarioEntity>> internalLiveData = new MutableLiveData<>();
@Inject
public InventarioRepository(InventarioLocalDataSource localDataSource,
@@ -44,7 +44,7 @@ public class InventarioRepository extends _BaseRepository<MtbInvent, InventarioR
}
public LiveData<List<InventarioRoomDTO>> retrieve(Runnable onComplete, RunnableArgs<Exception> onError) {
public LiveData<List<InventarioEntity>> retrieve(Runnable onComplete, RunnableArgs<Exception> onError) {
localDataSource.makeSynchronousRetrieveAllLive(false)
.observeOn(Schedulers.io())
.subscribe(internalLiveData::postValue);
@@ -84,13 +84,13 @@ public class InventarioRepository extends _BaseRepository<MtbInvent, InventarioR
});
}
public void insert(InventarioRoomDTO inventarioDTO, Runnable onComplete, RunnableArgs<Exception> onError) {
public void insert(InventarioEntity inventarioDTO, Runnable onComplete, RunnableArgs<Exception> onError) {
localDataSource.makeInsertRequest(inventarioDTO, localResult -> {
if (onComplete != null) handler.post(onComplete);
}, onError);
}
public void export(InventarioRoomDTO inventarioDTO, Runnable onComplete, RunnableArgs<Exception> onError) {
public void export(InventarioEntity inventarioDTO, Runnable onComplete, RunnableArgs<Exception> onError) {
remoteDataSource.makeInsertRequest(dataMapper.mapRoomToRest(inventarioDTO), () -> {
inventarioDTO.setRemoteSyncDate(new Date());
@@ -100,7 +100,7 @@ public class InventarioRepository extends _BaseRepository<MtbInvent, InventarioR
}, onError);
}
public void delete(InventarioRoomDTO inventarioDTO, Runnable onComplete, RunnableArgs<Exception> onError) {
public void delete(InventarioEntity inventarioDTO, Runnable onComplete, RunnableArgs<Exception> onError) {
localDataSource.makeDeleteRequest(inventarioDTO, onComplete, onError);
}

View File

@@ -0,0 +1,59 @@
package it.integry.integrywmsnative.core.data_store.db.respository_new;
import android.os.Handler;
import java.util.List;
import java.util.concurrent.ExecutorService;
import it.integry.integrywmsnative.core.data_store.db.entity.VerificaGiacenzeEntity;
import it.integry.integrywmsnative.core.data_store.db.respository_new.data_source.VerificaGiacenzeLocalDataSource;
import it.integry.integrywmsnative.core.mapper.VerificaGiacenzeMapper;
import it.integry.integrywmsnative.core.rest.consumers.GiacenzaPvRESTConsumer;
import it.integry.integrywmsnative.core.rest.model.pv.VerificaGiacenzeDTO;
public class VerificaGiacenzeRepository extends _BaseRepository<VerificaGiacenzeDTO, VerificaGiacenzeEntity, VerificaGiacenzeMapper, VerificaGiacenzeLocalDataSource, GiacenzaPvRESTConsumer> {
private final ExecutorService executorService;
private final Handler handler;
public VerificaGiacenzeRepository(VerificaGiacenzeLocalDataSource localDataSource,
GiacenzaPvRESTConsumer remoteDataSource,
VerificaGiacenzeMapper dataMapper,
Handler handler,
ExecutorService executorService) {
super(dataMapper, localDataSource, remoteDataSource);
this.handler = handler;
this.executorService = executorService;
}
public List<VerificaGiacenzeEntity> retrieve() {
return localDataSource.makeSynchronousRetrieveAllRequest(false);
}
public VerificaGiacenzeEntity retrieveLast() {
return localDataSource.makeSynchronousRetrieveLastRequest(false);
}
public boolean isAnotherVerificaGiacenzeInProgress(int maxMinutes) {
return localDataSource.isAnotherVerificaGiacenzeInProgress(maxMinutes);
}
public void clearPreviousSessions() {
var entities = retrieve();
for (var entity : entities) {
localDataSource.makeSynchronousDeleteRequest(entity);
}
}
public void insert(VerificaGiacenzeEntity entity) {
localDataSource.makeSynchronousInsertRequest(entity);
}
public void delete(VerificaGiacenzeEntity entity) {
localDataSource.makeSynchronousDeleteRequest(entity);
}
}

View File

@@ -0,0 +1,55 @@
package it.integry.integrywmsnative.core.data_store.db.respository_new;
import android.os.Handler;
import java.util.concurrent.ExecutorService;
import it.integry.integrywmsnative.core.data_store.db.entity.VerificaGiacenzeRowEntity;
import it.integry.integrywmsnative.core.data_store.db.respository_new.data_source.VerificaGiacenzeRowLocalDataSource;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.mapper.VerificaGiacenzeRowMapper;
import it.integry.integrywmsnative.core.rest.consumers.GiacenzaPvRESTConsumer;
import it.integry.integrywmsnative.core.rest.model.pv.VerificaGiacenzeRowDTO;
public class VerificaGiacenzeRowRepository extends _BaseRepository<VerificaGiacenzeRowDTO, VerificaGiacenzeRowEntity, VerificaGiacenzeRowMapper, VerificaGiacenzeRowLocalDataSource, GiacenzaPvRESTConsumer> {
private final ExecutorService executorService;
private final Handler handler;
public VerificaGiacenzeRowRepository(VerificaGiacenzeRowLocalDataSource localDataSource,
GiacenzaPvRESTConsumer remoteDataSource,
VerificaGiacenzeRowMapper dataMapper,
Handler handler,
ExecutorService executorService) {
super(dataMapper, localDataSource, remoteDataSource);
this.handler = handler;
this.executorService = executorService;
}
public void insertSynchronized(VerificaGiacenzeRowEntity entity) {
localDataSource.makeSynchronousInsertRequest(entity);
}
public void insert(VerificaGiacenzeRowEntity entity, RunnableArgs<VerificaGiacenzeRowEntity> onComplete, RunnableArgs<Exception> onFailed) {
localDataSource.makeInsertRequest(entity, onComplete, onFailed);
}
public void updateSynchronized(VerificaGiacenzeRowEntity entity) {
localDataSource.makeSynchronousUpdateRequest(entity);
}
public void update(VerificaGiacenzeRowEntity entity, RunnableArgs<VerificaGiacenzeRowEntity> onComplete, RunnableArgs<Exception> onFailed) {
localDataSource.makeUpdateRequest(entity, onComplete, onFailed);
}
public void deleteSynchronized(VerificaGiacenzeRowEntity entity) {
localDataSource.makeSynchronousDeleteRequest(entity);
}
public void delete(VerificaGiacenzeRowEntity entity, Runnable onComplete, RunnableArgs<Exception> onFailed) {
localDataSource.makeDeleteRequest(entity, onComplete, onFailed);
}
}

View File

@@ -8,24 +8,24 @@ import javax.inject.Singleton;
import io.reactivex.rxjava3.core.Flowable;
import it.integry.integrywmsnative.core.data_store.db.dao.InventarioDao;
import it.integry.integrywmsnative.core.data_store.db.entity.InventarioRoomDTO;
import it.integry.integrywmsnative.core.data_store.db.entity.InventarioEntity;
@Singleton
public class InventarioLocalDataSource extends _BaseRoomDataSource<InventarioRoomDTO, InventarioDao> {
public class InventarioLocalDataSource extends _BaseRoomDataSource<InventarioEntity, InventarioDao> {
@Inject
public InventarioLocalDataSource(ExecutorService executorService, InventarioDao entityDao) {
super(executorService, entityDao, InventarioRoomDTO.TABLE_NAME);
super(executorService, entityDao, InventarioEntity.TABLE_NAME);
}
@Override
public List<InventarioRoomDTO> makeSynchronousRetrieveAllRequest(boolean onlyToBeSync) {
public List<InventarioEntity> makeSynchronousRetrieveAllRequest(boolean onlyToBeSync) {
return entityDao
.selectAll(onlyToBeSync);
}
@Override
public Flowable<List<InventarioRoomDTO>> makeSynchronousRetrieveAllLive(boolean onlyToBeSync) {
public Flowable<List<InventarioEntity>> makeSynchronousRetrieveAllLive(boolean onlyToBeSync) {
return entityDao
.selectAllFlowable(onlyToBeSync);
}

View File

@@ -0,0 +1,63 @@
package it.integry.integrywmsnative.core.data_store.db.respository_new.data_source;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.stream.Collectors;
import javax.inject.Inject;
import javax.inject.Singleton;
import io.reactivex.rxjava3.core.Flowable;
import it.integry.integrywmsnative.core.data_store.db.dao.VerificaGiacenzeDao;
import it.integry.integrywmsnative.core.data_store.db.entity.VerificaGiacenzeEntity;
import it.integry.integrywmsnative.core.data_store.db.wrappers.VerificaGiacenzeWithRowsWrapper;
@Singleton
public class VerificaGiacenzeLocalDataSource extends _BaseRoomDataSource<VerificaGiacenzeEntity, VerificaGiacenzeDao> {
@Inject
public VerificaGiacenzeLocalDataSource(ExecutorService executorService, VerificaGiacenzeDao entityDao) {
super(executorService, entityDao, VerificaGiacenzeEntity.TABLE_NAME);
}
@Override
public List<VerificaGiacenzeEntity> makeSynchronousRetrieveAllRequest(boolean onlyToBeSync) {
var data = entityDao
.selectAll(onlyToBeSync);
return data.stream()
.map(x -> {
x.verificaGiacenze.setVerificaGiacenzeRowList(x.verificaGiacenzeRowList);
return x.verificaGiacenze;
})
.collect(Collectors.toList());
}
@Override
public Flowable<List<VerificaGiacenzeEntity>> makeSynchronousRetrieveAllLive(boolean onlyToBeSync) {
Flowable<List<VerificaGiacenzeWithRowsWrapper>> listFlowable = entityDao
.selectAllFlowable(onlyToBeSync);
return listFlowable.map(x ->
x.stream()
.map(y -> {
y.verificaGiacenze.setVerificaGiacenzeRowList(y.verificaGiacenzeRowList);
return y.verificaGiacenze;
})
.collect(Collectors.toList())
);
}
public VerificaGiacenzeEntity makeSynchronousRetrieveLastRequest(boolean onlyToBeSync) {
var lastEntity = entityDao
.selectLast(onlyToBeSync);
lastEntity.verificaGiacenze.setVerificaGiacenzeRowList(lastEntity.verificaGiacenzeRowList);
return lastEntity.verificaGiacenze;
}
public boolean isAnotherVerificaGiacenzeInProgress(int maxMinutes) {
return entityDao.isAnotherVerificaGiacenzeInProgress(maxMinutes);
}
}

View File

@@ -0,0 +1,34 @@
package it.integry.integrywmsnative.core.data_store.db.respository_new.data_source;
import java.util.List;
import java.util.concurrent.ExecutorService;
import javax.inject.Inject;
import javax.inject.Singleton;
import io.reactivex.rxjava3.core.Flowable;
import it.integry.integrywmsnative.core.data_store.db.dao.VerificaGiacenzeRowDao;
import it.integry.integrywmsnative.core.data_store.db.entity.VerificaGiacenzeRowEntity;
@Singleton
public class VerificaGiacenzeRowLocalDataSource extends _BaseRoomDataSource<VerificaGiacenzeRowEntity, VerificaGiacenzeRowDao> {
@Inject
public VerificaGiacenzeRowLocalDataSource(ExecutorService executorService, VerificaGiacenzeRowDao entityDao) {
super(executorService, entityDao, VerificaGiacenzeRowEntity.TABLE_NAME);
}
@Override
public List<VerificaGiacenzeRowEntity> makeSynchronousRetrieveAllRequest(boolean onlyToBeSync) {
var data = entityDao
.selectAll(onlyToBeSync);
return data;
}
@Override
public Flowable<List<VerificaGiacenzeRowEntity>> makeSynchronousRetrieveAllLive(boolean onlyToBeSync) {
return entityDao
.selectAllFlowable(onlyToBeSync);
}
}

View File

@@ -0,0 +1,24 @@
package it.integry.integrywmsnative.core.data_store.db.wrappers;
import androidx.room.DatabaseView;
import androidx.room.Embedded;
import androidx.room.Relation;
import java.util.List;
import it.integry.integrywmsnative.core.data_store.db.entity.BaseSyncDTO;
import it.integry.integrywmsnative.core.data_store.db.entity.VerificaGiacenzeEntity;
import it.integry.integrywmsnative.core.data_store.db.entity.VerificaGiacenzeRowEntity;
@DatabaseView
public class VerificaGiacenzeWithRowsWrapper {
@Embedded
public VerificaGiacenzeEntity verificaGiacenze;
@Relation(
parentColumn = BaseSyncDTO.Columns.ID,
entityColumn = VerificaGiacenzeRowEntity.Columns.PARENT_ID
)
public List<VerificaGiacenzeRowEntity> verificaGiacenzeRowList;
}

View File

@@ -9,7 +9,7 @@ import java.math.BigDecimal;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
public class BindableBigDecimal implements Observable {
public class BindableBigDecimal implements Observable {
BigDecimal mValue;

View File

@@ -105,6 +105,28 @@ public class Converters {
view.setTag(R.id.bound_observable, new Pair<>(observableField, watcher));
view.addTextChangedListener(watcher);
}
String newValue = observableField != null ? observableField.get() : "";
if (!view.getText().toString().equals(newValue)) {
view.setText(newValue);
}
}
@BindingAdapter("binding")
public static void bindEditText(AppCompatTextView view, final ValidatableObservableField<String> observableField) {
Pair<ValidatableObservableField<String>, TextWatcherAdapter> pair = (Pair) view.getTag(R.id.bound_observable);
if (pair == null || pair.first != observableField) {
if (pair != null) {
view.removeTextChangedListener(pair.second);
}
TextWatcherAdapter watcher = new TextWatcherAdapter() {
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
if (observableField != null) observableField.set(s.toString());
}
};
view.setTag(R.id.bound_observable, new Pair<>(observableField, watcher));
view.addTextChangedListener(watcher);
}
String newValue = observableField.get();
if (!view.getText().toString().equals(newValue)) {
view.setText(newValue);
@@ -156,6 +178,28 @@ public class Converters {
}
}
@BindingAdapter("binding")
public static void bindEditText(EditText view, final ValidatableObservableField<String> observableString) {
Pair<ValidatableObservableField<String>, TextWatcherAdapter> pair = (Pair) view.getTag(R.id.bound_observable);
if (pair == null || pair.first != observableString) {
if (pair != null) {
view.removeTextChangedListener(pair.second);
}
TextWatcherAdapter watcher = new TextWatcherAdapter() {
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
observableString.set(s.toString());
}
};
view.setTag(R.id.bound_observable, new Pair<>(observableString, watcher));
view.addTextChangedListener(watcher);
}
String newValue = observableString.get();
if (!view.getText().toString().equals(newValue)) {
view.setText(newValue);
}
}
@BindingAdapter("binding")
public static void bindEditText(AutoCompleteTextView view, final ObservableField<String> observableString) {
Pair<ObservableField<String>, TextWatcherAdapter> pair = (Pair) view.getTag(R.id.bound_observable);
@@ -260,6 +304,36 @@ public class Converters {
}
}
@BindingAdapter("binding")
public static void bindTextInputEditTextBigDecimal(EditText view, final ValidatableObservableField<BigDecimal> observableBigDecimal) {
Pair<ValidatableObservableField<BigDecimal>, TextWatcherAdapter> pair = (Pair) view.getTag(R.id.bound_observable);
if (pair == null || pair.first != observableBigDecimal) {
if (pair != null) {
view.removeTextChangedListener(pair.second);
}
TextWatcherAdapter watcher = new TextWatcherAdapter() {
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
BigDecimal value = null;
String newValueString = s.toString().trim();
if (!UtilityString.isNullOrEmpty(newValueString))
value = new BigDecimal(newValueString);
observableBigDecimal.set(value);
}
};
view.setTag(R.id.bound_observable, new Pair<>(observableBigDecimal, watcher));
view.addTextChangedListener(watcher);
}
BigDecimal newValue = observableBigDecimal.get();
BigDecimal viewValue = !view.getText().toString().trim().isEmpty() ? new BigDecimal(view.getText().toString()) : null;
if (!UtilityBigDecimal.equalsTo(viewValue, newValue)) {
view.setText(UtilityNumber.decimalToString(newValue));
}
}
@BindingAdapter("binding")
public static void bindTextInputEditTextBigDecimal(TextInputEditText view, final BindableBigDecimal bindableBigDecimal) {
Pair<BindableBigDecimal, TextWatcherAdapter> pair = (Pair) view.getTag(R.id.bound_observable);
@@ -280,7 +354,7 @@ public class Converters {
view.addTextChangedListener(watcher);
}
BigDecimal newValue = bindableBigDecimal.get();
BigDecimal viewValue = view.getText().toString().trim().length() > 0 ? new BigDecimal(view.getText().toString()) : null;
BigDecimal viewValue = !view.getText().toString().trim().isEmpty() ? new BigDecimal(view.getText().toString()) : null;
if (!UtilityBigDecimal.equalsTo(viewValue, newValue)) {
view.setText(UtilityNumber.decimalToString(newValue));
@@ -307,7 +381,7 @@ public class Converters {
view.addTextChangedListener(watcher);
}
Integer newValue = bindableInteger.get();
Integer viewValue = view.getText().toString().trim().length() > 0 ? Integer.valueOf(view.getText().toString()) : Integer.valueOf(0);
Integer viewValue = !view.getText().toString().trim().isEmpty() ? Integer.valueOf(view.getText().toString()) : Integer.valueOf(0);
if (!(viewValue.compareTo(newValue) == 0)) {
view.setText(newValue.toString());
@@ -358,7 +432,7 @@ public class Converters {
view.addTextChangedListener(watcher);
}
Integer newValue = observableInteger.get();
Integer viewValue = view.getText().toString().trim().length() > 0 ? Integer.valueOf(view.getText().toString()) : Integer.valueOf(0);
Integer viewValue = !view.getText().toString().trim().isEmpty() ? Integer.valueOf(view.getText().toString()) : Integer.valueOf(0);
if (!viewValue.equals(newValue) && newValue != null) {
view.setText(newValue.toString());
@@ -385,7 +459,7 @@ public class Converters {
view.addTextChangedListener(watcher);
}
Long newValue = observableLong.get();
Long viewValue = view.getText().toString().trim().length() > 0 ? Long.valueOf(view.getText().toString()) : Long.valueOf(0);
Long viewValue = !view.getText().toString().trim().isEmpty() ? Long.valueOf(view.getText().toString()) : Long.valueOf(0);
if (!viewValue.equals(newValue) && newValue != null) {
view.setText(newValue.toString());
@@ -657,6 +731,30 @@ public class Converters {
view.setChecked(newValue);
}
@BindingAdapter("checked")
public static void bindCheckbox(AppCompatCheckBox view, final ObservableField<Boolean> bindableBoolean) {
if (view.getTag(R.id.bound_observable) != bindableBoolean) {
view.setTag(R.id.bound_observable, bindableBoolean);
view.setOnCheckedChangeListener((compoundButton, b) -> {
bindableBoolean.set(b);
});
}
Boolean newValue = bindableBoolean.get();
view.setChecked(newValue);
}
@BindingAdapter("checked")
public static void bindCheckbox(AppCompatCheckBox view, final ValidatableObservableField<Boolean> bindableBoolean) {
if (view.getTag(R.id.bound_observable) != bindableBoolean) {
view.setTag(R.id.bound_observable, bindableBoolean);
view.setOnCheckedChangeListener((compoundButton, b) -> {
bindableBoolean.set(b);
});
}
Boolean newValue = bindableBoolean.get();
view.setChecked(newValue);
}
@BindingAdapter("checked")
public static void bindCheckbox(CheckBox view, final BindableBoolean bindableBoolean) {
if (view.getTag(R.id.bound_observable) != bindableBoolean) {
@@ -721,10 +819,55 @@ public class Converters {
}
@BindingAdapter("visibilityWhenNotNull")
public static void bindViewVisibilityWhenNotNull(View view, ObservableField<?> bindableObject) {
if(bindableObject == null) return;
if (view.getTag(R.id.bound_observable) != bindableObject) {
view.setTag(R.id.bound_observable, bindableObject);
}
bindableObject.addOnPropertyChangedCallback(new Observable.OnPropertyChangedCallback() {
@Override
public void onPropertyChanged(Observable sender, int propertyId) {
view.setVisibility(bindableObject.get() == null ? View.GONE : View.VISIBLE);
}
});
view.setVisibility(bindableObject.get() == null ? View.GONE : View.VISIBLE);
}
@BindingAdapter("visibilityWhenNotNull")
public static void bindViewVisibilityWhenNotNull(View view, Object genericObject) {
view.setVisibility(genericObject == null ? View.GONE : View.VISIBLE);
}
@BindingAdapter("visibilityWhenNull")
public static void bindViewVisibilityWhenNull(View view, ObservableField<?> bindableObject) {
if (view.getTag(R.id.bound_observable_visibility) != bindableObject) {
view.setTag(R.id.bound_observable_visibility, bindableObject);
}
view.setVisibility(bindableObject == null || bindableObject.get() == null ? View.VISIBLE : View.GONE);
if(bindableObject == null) return;
bindableObject.addOnPropertyChangedCallback(new Observable.OnPropertyChangedCallback() {
@Override
public void onPropertyChanged(Observable sender, int propertyId) {
view.setVisibility(bindableObject.get() == null ? View.VISIBLE : View.GONE);
}
});
}
@BindingAdapter({"reverse_visibility"})
public static void bindViewReverseVisibility(View view, final BindableBoolean bindableBoolean) {
if (view.getTag(R.id.bound_observable) != bindableBoolean) {
view.setTag(R.id.bound_observable, bindableBoolean);
if (view.getTag(R.id.bound_reverse_visibility) != bindableBoolean) {
view.setTag(R.id.bound_reverse_visibility, bindableBoolean);
}
bindableBoolean.addOnPropertyChangedCallback(new Observable.OnPropertyChangedCallback() {
@Override

View File

@@ -0,0 +1,65 @@
package it.integry.integrywmsnative.core.di;
import androidx.annotation.Nullable;
import androidx.databinding.BaseObservable;
import androidx.databinding.Bindable;
import java.util.ArrayList;
import java.util.List;
import it.integry.integrywmsnative.BR;
import it.integry.integrywmsnative.core.di.validators.Validator;
public class ValidatableObservableField<T> extends BaseObservable {
private T mValue;
private final List<Validator<T>> validators = new ArrayList<>();
public String errorMessage;
public ValidatableObservableField() {
}
public ValidatableObservableField(T value) {
mValue = value;
}
/**
* @return the stored value.
*/
@Nullable
public T get() {
return mValue;
}
public void set(T value) {
if (value != mValue) {
mValue = value;
notifyChange();
validate();
}
}
public void addValidator(Validator<T> validator) {
validators.add(validator);
}
public boolean validate() {
for (Validator<T> validator : validators) {
if (!validator.isValid(mValue)) {
setErrorMessage(validator.getErrorMessage());
return false;
}
}
setErrorMessage(null);
return true;
}
@Bindable
public String getErrorMessage() {
return errorMessage;
}
private void setErrorMessage(String errorMessage) {
this.errorMessage = errorMessage;
notifyPropertyChanged(BR.errorMessage); // Notifica il cambiamento di errorMessage
}
}

View File

@@ -2,5 +2,25 @@ package it.integry.integrywmsnative.core.di.binders;
public class AutoCompleteTextViewBinders {
// @BindingAdapter("binding")
// public static void bindUntMisText(AppCompatAutoCompleteTextView view, ObservableField<MtbUntMis> untMisField) {
// Pair<ObservableField<MtbUntMis>, TextWatcherAdapter> pair = (Pair) view.getTag(R.id.bound_observable);
// if (pair == null || pair.first != untMisField) {
// if (pair != null) {
// view.removeTextChangedListener(pair.second);
// }
// TextWatcherAdapter watcher = new TextWatcherAdapter() {
// @Override
// public void onTextChanged(CharSequence s, int start, int before, int count) {
// if (untMisField != null) untMisField.set(s.toString());
// }
// };
// view.setTag(R.id.bound_observable, new Pair<>(untMisField, watcher));
// view.addTextChangedListener(watcher);
// }
// String newValue = untMisField != null && untMisField.get() != null ? Objects.requireNonNull(untMisField.get()).getUntMis() : "";
// if (!view.getText().toString().equals(newValue)) {
// view.setText(newValue);
// }
// }
}

View File

@@ -1,6 +1,7 @@
package it.integry.integrywmsnative.core.di.binders;
import androidx.databinding.BindingAdapter;
import com.google.android.material.textfield.TextInputLayout;
public class TextInputLayoutBinders {

View File

@@ -1,14 +1,15 @@
package it.integry.integrywmsnative.core.di.binders.recyclerview;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.Nullable;
import androidx.databinding.DataBindingUtil;
import androidx.databinding.ObservableArrayList;
import androidx.databinding.ObservableList;
import androidx.databinding.ViewDataBinding;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.lang.ref.WeakReference;
import java.util.Collection;

View File

@@ -0,0 +1,23 @@
package it.integry.integrywmsnative.core.di.validators;
import java.math.BigDecimal;
public class GreaterThenValidator implements Validator<BigDecimal> {
private final String errorMessage;
private final BigDecimal greaterThanValue;
public GreaterThenValidator(BigDecimal greaterThanValue, String errorMessage) {
this.greaterThanValue = greaterThanValue;
this.errorMessage = errorMessage;
}
@Override
public boolean isValid(BigDecimal value) {
return value != null && value.compareTo(greaterThanValue) > 0;
}
@Override
public String getErrorMessage() {
return errorMessage;
}
}

View File

@@ -0,0 +1,21 @@
package it.integry.integrywmsnative.core.di.validators;
public class MinLengthValidator implements Validator<String> {
private final int minLength;
private final String errorMessage;
public MinLengthValidator(int minLength, String errorMessage) {
this.minLength = minLength;
this.errorMessage = errorMessage;
}
@Override
public boolean isValid(String value) {
return value != null && value.length() >= minLength;
}
@Override
public String getErrorMessage() {
return errorMessage;
}
}

View File

@@ -0,0 +1,19 @@
package it.integry.integrywmsnative.core.di.validators;
public class NotEmptyValidator implements Validator<String> {
private final String errorMessage;
public NotEmptyValidator(String errorMessage) {
this.errorMessage = errorMessage;
}
@Override
public boolean isValid(String value) {
return value != null && !value.trim().isEmpty();
}
@Override
public String getErrorMessage() {
return errorMessage;
}
}

View File

@@ -0,0 +1,19 @@
package it.integry.integrywmsnative.core.di.validators;
public class NotNullValidator<T> implements Validator<T>{
private final String errorMessage;
public NotNullValidator(String errorMessage) {
this.errorMessage = errorMessage;
}
@Override
public boolean isValid(T value) {
return value != null;
}
@Override
public String getErrorMessage() {
return errorMessage;
}
}

View File

@@ -0,0 +1,7 @@
package it.integry.integrywmsnative.core.di.validators;
public interface Validator<T> {
boolean isValid(T value);
String getErrorMessage();
}

View File

@@ -228,13 +228,13 @@ public class Ean128Service {
case SHIP_TO_POST -> model.ShipToPost = aiValue.toString();
case SHIP_TO_POST_ISO ->
model.ShipToPostISO = convertToIsoValueModel(aiValue.toString(), 0,
new Callable<String, String>() {
new Callable<>() {
@Override
public String call(String input) {
return input;
}
},
new CallableII<String, Integer, String>() {
new CallableII<>() {
@Override
public String call(String input, Integer input2) {
return input;
@@ -300,7 +300,7 @@ public class Ean128Service {
T value = castFunc.call(splitFunc.call(sourceString.substring(3), numberOfDecimalDigits));
Ean128ISOValueModel<T> isoModel = new Ean128ISOValueModel<T>();
Ean128ISOValueModel<T> isoModel = new Ean128ISOValueModel<>();
isoModel.ISOCode = isoCode;
isoModel.Value = value;

View File

@@ -0,0 +1,4 @@
package it.integry.integrywmsnative.core.event;
public class SessionExpiredEvent {
}

View File

@@ -0,0 +1,8 @@
package it.integry.integrywmsnative.core.exception;
public class InvalidCodMdepBarcodeException extends RuntimeException {
public InvalidCodMdepBarcodeException(String message) {
super(message);
}
}

View File

@@ -1,10 +0,0 @@
package it.integry.integrywmsnative.core.exception;
import it.integry.integrywmsnative.R;
import it.integry.integrywmsnative.core.utility.UtilityResources;
public final class InvalidCodMdepException extends Exception {
public InvalidCodMdepException() {
super(UtilityResources.getString(R.string.invalid_codmdep));
}
}

View File

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

View File

@@ -0,0 +1,7 @@
package it.integry.integrywmsnative.core.exception;
public class UnauthorizedAccessException extends Exception {
public UnauthorizedAccessException() {
super("Accesso non autorizzato. Si prega di effettuare nuovamente l'accesso e riprovare");
}
}

View File

@@ -6,6 +6,8 @@ import android.view.KeyEvent;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import java.util.concurrent.ExecutorService;
import javax.inject.Inject;
import it.integry.integrywmsnative.MainApplication;
@@ -18,7 +20,8 @@ public class BaseActivity extends AppCompatActivity {
@Inject
public DialogProgressView mCurrentProgress;
private boolean progressOpened;
@Inject
public ExecutorService executorService;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
@@ -47,28 +50,19 @@ public class BaseActivity extends AppCompatActivity {
}
private void openProgress() {
BarcodeManager.disable();
if (!progressOpened && !this.mCurrentProgress.isAdded() && !this.mCurrentProgress.isInLayout()) {
this.progressOpened = true;
runOnUiThread(() -> {
try {
this.mCurrentProgress.show(getSupportFragmentManager(), "tag");
} catch (IllegalStateException ise) {
//ignored
}
});
}
// executorService.execute(() -> {
this.mCurrentProgress.show(getSupportFragmentManager());
// });
}
private void closeProgress() {
BarcodeManager.enable();
if (progressOpened) {
this.progressOpened = false;
runOnUiThread(() -> {
mCurrentProgress.dismiss();
});
}
// executorService.execute(() -> {
mCurrentProgress.dismiss();
// });
}
@Override

View File

@@ -2,15 +2,11 @@ package it.integry.integrywmsnative.core.expansion;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.view.KeyEvent;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
import it.integry.pointmobilescannerlibrary.PointMobileBarcodeReader;
public class BaseDialog extends Dialog {

View File

@@ -13,6 +13,8 @@ import androidx.fragment.app.DialogFragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import java.util.concurrent.ExecutorService;
import javax.inject.Inject;
import it.integry.integrywmsnative.MainApplication;
@@ -24,7 +26,9 @@ public abstract class BaseDialogFragment extends DialogFragment implements Dialo
@Inject
public DialogProgressView mCurrentProgress;
private boolean progressOpened;
@Inject
public ExecutorService executorService;
private boolean mBarcodeListener = false;
@@ -70,28 +74,26 @@ public abstract class BaseDialogFragment extends DialogFragment implements Dialo
BarcodeManager.enable();
}
private void openProgress() {
if (!progressOpened && !this.mCurrentProgress.isAdded() && !this.mCurrentProgress.isInLayout()) {
this.progressOpened = true;
requireActivity().runOnUiThread(() -> {
this.mCurrentProgress.show(requireActivity().getSupportFragmentManager(), "tag");
});
}
BarcodeManager.disable();
// executorService.execute(() -> {
this.mCurrentProgress.show(requireActivity().getSupportFragmentManager());
// });
}
private void closeProgress() {
if (progressOpened) {
this.progressOpened = false;
requireActivity().runOnUiThread(() -> {
mCurrentProgress.dismiss();
});
}
BarcodeManager.enable();
// executorService.execute(() -> {
mCurrentProgress.dismiss();
// });
}
public void onError(Exception ex) {
this.onLoadingEnded();
requireActivity().runOnUiThread(() -> {
this.onLoadingEnded();
UtilityExceptions.defaultException(requireActivity(), ex);
});
}

View File

@@ -1,6 +1,7 @@
package it.integry.integrywmsnative.core.expansion;
import android.os.Bundle;
import android.os.Handler;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -30,10 +31,12 @@ public abstract class BaseFragment extends Fragment {
@Inject
public ExecutorService executorService;
@Inject
public Handler handler;
protected ElevatedToolbar mToolbar;
protected final List<Runnable> mOnPreDestroyList = new ArrayList<>();
private boolean progressOpened;
public void setScrollToolbar(ElevatedToolbar toolbar) {
@@ -67,26 +70,20 @@ public abstract class BaseFragment extends Fragment {
private void openProgress() {
BarcodeManager.disable();
if (!progressOpened && !this.mCurrentProgress.isAdded() && !this.mCurrentProgress.isInLayout()) {
this.progressOpened = true;
executorService.execute(() -> {
this.mCurrentProgress.show(requireActivity().getSupportFragmentManager(), "tag");
});
}
// executorService.execute(() -> {
this.mCurrentProgress.show(requireActivity().getSupportFragmentManager());
// });
}
private void closeProgress() {
BarcodeManager.enable();
if (progressOpened) {
this.progressOpened = false;
executorService.execute(() -> {
mCurrentProgress.dismissAllowingStateLoss();
});
}
// executorService.execute(() -> {
mCurrentProgress.dismiss();
// });
}
public void onError(Exception ex) {
requireActivity().runOnUiThread(() -> {
handler.post(() -> {
this.closeProgress();
UtilityExceptions.defaultException(getActivity(), ex);
BarcodeManager.enable();
@@ -109,7 +106,7 @@ public abstract class BaseFragment extends Fragment {
protected void popMe() {
if (requireActivity() instanceof IPoppableActivity) {
requireActivity().runOnUiThread(() -> {
handler.post(() -> {
((IPoppableActivity) requireActivity()).pop();
});
} else {

View File

@@ -0,0 +1,26 @@
package it.integry.integrywmsnative.core.helper;
import android.content.Context;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
import it.integry.integrywmsnative.core.utility.UtilityContext;
public final class ContextHelper {
public static FragmentManager getFragmentManagerFromContext(Context context) {
if (context == null) {
throw new IllegalArgumentException("Context cannot be null");
}
if (context instanceof FragmentActivity) {
return ((FragmentActivity) context).getSupportFragmentManager();
} else if (UtilityContext.getMainActivity() != null) {
return UtilityContext.getMainActivity().getSupportFragmentManager();
}
return null;
}
}

View File

@@ -0,0 +1,16 @@
package it.integry.integrywmsnative.core.helper;
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
public final class GestioneToTextConverter {
public static String convert(GestioneEnum gestioneEnum) {
return switch (gestioneEnum) {
case ACQUISTO -> "Acquisto";
case PRODUZIONE -> "Produzione";
case LAVORAZIONE -> "Lavorazione";
case VENDITA -> "Vendita";
};
}
}

View File

@@ -2,11 +2,11 @@ package it.integry.integrywmsnative.core.mapper;
import javax.inject.Singleton;
import it.integry.integrywmsnative.core.data_store.db.entity.InventarioRoomDTO;
import it.integry.integrywmsnative.core.data_store.db.entity.InventarioEntity;
import it.integry.integrywmsnative.core.model.MtbInvent;
@Singleton
public class InventarioMapper extends BaseMapper<MtbInvent, InventarioRoomDTO> {
public class InventarioMapper extends BaseMapper<MtbInvent, InventarioEntity> {
private final InventarioRowMapper inventarioRowMapper;
@@ -15,10 +15,10 @@ public class InventarioMapper extends BaseMapper<MtbInvent, InventarioRoomDTO> {
}
@Override
public InventarioRoomDTO mapRestToRoom(MtbInvent inputData) {
public InventarioEntity mapRestToRoom(MtbInvent inputData) {
if(inputData == null) return null;
var data = new InventarioRoomDTO();
var data = new InventarioEntity();
data.setIdInventario(inputData.getIdInventario());
data.setCodMdep(inputData.getCodMdep());
data.setDataInventario(inputData.getDataInventario());
@@ -42,7 +42,7 @@ public class InventarioMapper extends BaseMapper<MtbInvent, InventarioRoomDTO> {
}
@Override
public MtbInvent mapRoomToRest(InventarioRoomDTO inputData) {
public MtbInvent mapRoomToRest(InventarioEntity inputData) {
if(inputData == null) return null;
var data = new MtbInvent();

View File

@@ -2,6 +2,7 @@ package it.integry.integrywmsnative.core.mapper;
import it.integry.integrywmsnative.core.data_store.db.entity.InventarioRowRoomDTO;
import it.integry.integrywmsnative.core.model.MtbInvenr;
import it.integry.integrywmsnative.core.settings.SettingsManager;
public class InventarioRowMapper extends BaseMapper<MtbInvenr, InventarioRowRoomDTO> {
@@ -32,6 +33,7 @@ public class InventarioRowMapper extends BaseMapper<MtbInvenr, InventarioRowRoom
data.setDataOraInv(inputData.getDataOraInv());
data.setScanCodBarre(inputData.getScanCodBarre());
data.setZona(inputData.getZona());
data.setIdDisp(SettingsManager.i().getUserSession().getDeviceId());
return data;
}
}

View File

@@ -0,0 +1,44 @@
package it.integry.integrywmsnative.core.mapper;
import javax.inject.Singleton;
import it.integry.integrywmsnative.core.data_store.db.entity.VerificaGiacenzeEntity;
import it.integry.integrywmsnative.core.rest.model.pv.VerificaGiacenzeDTO;
@Singleton
public class VerificaGiacenzeMapper extends BaseMapper<VerificaGiacenzeDTO, VerificaGiacenzeEntity> {
private final VerificaGiacenzeRowMapper verificaGiacenzeRowMapper;
public VerificaGiacenzeMapper(VerificaGiacenzeRowMapper verificaGiacenzeRowMapper) {
this.verificaGiacenzeRowMapper = verificaGiacenzeRowMapper;
}
@Override
public VerificaGiacenzeEntity mapRestToRoom(VerificaGiacenzeDTO inputData) {
if(inputData == null) return null;
var data = new VerificaGiacenzeEntity();
data.setCodMdep(inputData.getCodMdep());
data.setData(inputData.getDataVerifica());
data.setVerificaGiacenzeRowList(verificaGiacenzeRowMapper.mapRestsToRooms(inputData.getRows()));
return data;
}
@Override
public VerificaGiacenzeDTO mapRoomToRest(VerificaGiacenzeEntity inputData) {
if(inputData == null) return null;
var data = new VerificaGiacenzeDTO();
data.setCodMdep(inputData.getCodMdep());
data.setDataVerifica(inputData.getData());
data.setRows(verificaGiacenzeRowMapper.mapRoomsToRests(inputData.getVerificaGiacenzeRowList()));
return data;
}
}

View File

@@ -0,0 +1,40 @@
package it.integry.integrywmsnative.core.mapper;
import javax.inject.Singleton;
import it.integry.integrywmsnative.core.data_store.db.entity.VerificaGiacenzeRowEntity;
import it.integry.integrywmsnative.core.rest.model.pv.VerificaGiacenzeRowDTO;
@Singleton
public class VerificaGiacenzeRowMapper extends BaseMapper<VerificaGiacenzeRowDTO, VerificaGiacenzeRowEntity> {
@Override
public VerificaGiacenzeRowEntity mapRestToRoom(VerificaGiacenzeRowDTO inputData) {
if(inputData == null) return null;
var data = new VerificaGiacenzeRowEntity();
data.setCodMart(inputData.getCodMart());
data.setPartitaMag(inputData.getPartitaMag());
data.setQtaInGiacenza(inputData.getQtaInGiacenza());
data.setQta(inputData.getQta());
data.setNumConf(inputData.getNumCnf());
data.setQtaConf(inputData.getQtaCnf());
data.setScanCodBarre(inputData.getBarcode());
return data;
}
@Override
public VerificaGiacenzeRowDTO mapRoomToRest(VerificaGiacenzeRowEntity inputData) {
if(inputData == null) return null;
var data = new VerificaGiacenzeRowDTO();
data.setCodMart(inputData.getCodMart());
data.setPartitaMag(inputData.getPartitaMag());
data.setQtaInGiacenza(inputData.getQtaInGiacenza());
data.setQta(inputData.getQta());
data.setNumCnf(inputData.getNumConf());
data.setQtaCnf(inputData.getQtaConf());
data.setBarcode(inputData.getScanCodBarre());
return data;
}
}

View File

@@ -1,30 +1,38 @@
package it.integry.integrywmsnative.core.menu;
import androidx.annotation.NonNull;
import javax.inject.Singleton;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.model.StbMenu;
import it.integry.integrywmsnative.core.rest.RESTBuilder;
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.Callback;
import retrofit2.Response;
@Singleton
public class MenuRESTConsumer extends _BaseRESTConsumer {
private final RESTBuilder restBuilder;
public MenuRESTConsumer(RESTBuilder restBuilder) {
this.restBuilder = restBuilder;
}
public void retrieveMenu(String rootCodOpz, RunnableArgs<StbMenu> onComplete, RunnableArgs<Exception> onFailed) {
MenuRESTConsumerService menuRESTConsumerService = RESTBuilder.getService(MenuRESTConsumerService.class);
menuRESTConsumerService.retrieveMenuConfig(rootCodOpz).enqueue(new Callback<>() {
MenuRESTConsumerService menuRESTConsumerService = restBuilder.getService(MenuRESTConsumerService.class);
menuRESTConsumerService.retrieveMenuConfig(rootCodOpz).enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<StbMenu>> call, Response<ServiceRESTResponse<StbMenu>> response) {
analyzeAnswer(response, "retrieveMenu", onComplete, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<StbMenu>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<StbMenu>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}

View File

@@ -1,7 +1,5 @@
package it.integry.integrywmsnative.core.model;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import it.integry.integrywmsnative.core.utility.UtilityDate;

View File

@@ -3,6 +3,7 @@ package it.integry.integrywmsnative.core.model;
public class JtbComt extends EntityBase {
private String codJcom;
private String codAnag;
private String codJfas;
private String codJflav;
private String descrizione;
@@ -20,6 +21,15 @@ public class JtbComt extends EntityBase {
return this;
}
public String getCodAnag() {
return codAnag;
}
public JtbComt setCodAnag(String codAnag) {
this.codAnag = codAnag;
return this;
}
public String getCodJfas() {
return codJfas;
}

View File

@@ -26,7 +26,7 @@ public class MtbColr extends EntityBase {
private String gestioneRif;
private String serColloRif;
private String note;
private String dataOrd;
private LocalDate dataOrd;
private String dataColloRif;
private BigDecimal qtaCnf;
private BigDecimal qtaCol;
@@ -225,24 +225,15 @@ public class MtbColr extends EntityBase {
return this;
}
public String getDataOrdS() {
public LocalDate getDataOrd() {
return dataOrd;
}
public Date getDataOrdD() {
return UtilityDate.recognizeDateWithExceptionHandler(getDataOrdS());
}
public MtbColr setDataOrd(String dataOrd) {
public MtbColr setDataOrd(LocalDate dataOrd) {
this.dataOrd = dataOrd;
return this;
}
public MtbColr setDataOrd(Date dataOrd) {
this.dataOrd = UtilityDate.formatDate(dataOrd, UtilityDate.COMMONS_DATE_FORMATS.DMY_TIME_SLASH);
return this;
}
public String getDataColloRifS() {
return dataColloRif;
}

View File

@@ -3,6 +3,7 @@ package it.integry.integrywmsnative.core.model;
import android.text.TextUtils;
import androidx.databinding.ObservableArrayList;
import androidx.databinding.ObservableField;
import com.annimon.stream.Optional;
import com.annimon.stream.Stream;
@@ -16,6 +17,7 @@ import java.util.Date;
import java.util.List;
import it.integry.integrywmsnative.core.model.dto.InternalCodAnagsDTO;
import it.integry.integrywmsnative.core.model.observable.ObservableMtbTcol;
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
import it.integry.integrywmsnative.core.settings.SettingsManager;
import it.integry.integrywmsnative.core.utility.UtilityDB;
@@ -64,7 +66,7 @@ public class MtbColt extends EntityBase {
private BigDecimal altezzaCm;
private String codJcom;
private MtbTCol mtbTCol;
private final ObservableField<ObservableMtbTcol> mtbTCol = new ObservableField<>();
private Boolean disablePrint;
private String ragSocCliente;
@@ -258,6 +260,16 @@ public class MtbColt extends EntityBase {
public MtbColt setCodTcol(String codTcol) {
this.codTcol = codTcol;
if(!UtilityString.isNullOrEmpty(codTcol)) {
var fountMtbTcolObservable = SettingsManager.iDB().getInternalImballi().stream()
.filter(x -> x.getCodTcol().equalsIgnoreCase(codTcol))
.findFirst()
.orElse(null);
this.setMtbTCol(fountMtbTcolObservable);
} else
this.setMtbTCol(null);
return this;
}
@@ -532,15 +544,19 @@ public class MtbColt extends EntityBase {
return this;
}
public MtbTCol getMtbTCol() {
return mtbTCol;
public ObservableMtbTcol getMtbTCol() {
return mtbTCol.get();
}
public MtbColt setMtbTCol(MtbTCol mtbTCol) {
this.mtbTCol = mtbTCol;
public MtbColt setMtbTCol(ObservableMtbTcol mtbTCol) {
this.mtbTCol.set(mtbTCol);
return this;
}
public ObservableField<ObservableMtbTcol> mtbTcolProperty() {
return mtbTCol;
}
public void generaFiltroOrdineFromDTO(List<FiltroOrdineDTO> filtroOrdineDtos) {
String xmlPrefix = "{\"whereCond\": \"";

View File

@@ -5,7 +5,7 @@ import android.os.Parcelable;
import java.math.BigDecimal;
public class MtbDepo extends EntityBase implements Parcelable {
public class MtbDepo extends EntityBase {
private String codMdep;
@@ -41,79 +41,6 @@ public class MtbDepo extends EntityBase implements Parcelable {
type = "mtb_depo";
}
protected MtbDepo(Parcel in) {
codMdep = in.readString();
descrizione = in.readString();
flagVal = in.readString();
codAnag = in.readString();
indirizzo = in.readString();
cap = in.readString();
citta = in.readString();
prov = in.readString();
tel = in.readString();
nazione = in.readString();
fax = in.readString();
eMail = in.readString();
sitoWeb = in.readString();
codVdes = in.readString();
serie = in.readString();
flagMovimentabile = in.readString();
codJfas = in.readString();
codVlis = in.readString();
codCcau = in.readString();
codCcon = in.readString();
codDtip = in.readString();
codDtipFat = in.readString();
flagContoVendita = in.readString();
flagTipoNegozio = in.readString();
codMdepReso = in.readString();
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(codMdep);
dest.writeString(descrizione);
dest.writeString(flagVal);
dest.writeString(codAnag);
dest.writeString(indirizzo);
dest.writeString(cap);
dest.writeString(citta);
dest.writeString(prov);
dest.writeString(tel);
dest.writeString(nazione);
dest.writeString(fax);
dest.writeString(eMail);
dest.writeString(sitoWeb);
dest.writeString(codVdes);
dest.writeString(serie);
dest.writeString(flagMovimentabile);
dest.writeString(codJfas);
dest.writeString(codVlis);
dest.writeString(codCcau);
dest.writeString(codCcon);
dest.writeString(codDtip);
dest.writeString(codDtipFat);
dest.writeString(flagContoVendita);
dest.writeString(flagTipoNegozio);
dest.writeString(codMdepReso);
}
@Override
public int describeContents() {
return 0;
}
public static final Creator<MtbDepo> CREATOR = new Creator<MtbDepo>() {
@Override
public MtbDepo createFromParcel(Parcel in) {
return new MtbDepo(in);
}
@Override
public MtbDepo[] newArray(int size) {
return new MtbDepo[size];
}
};
public String getCodMdep() {
return codMdep;

View File

@@ -1,5 +1,8 @@
package it.integry.integrywmsnative.core.model;
import java.util.ArrayList;
import java.util.List;
public class MtbGrup extends EntityBase {
private String codMgrp;
@@ -8,6 +11,7 @@ public class MtbGrup extends EntityBase {
private String logoWeb;
private String criterioVal;
private String tipoMgrp;
private List<MtbSgrp> mtbSgrp = new ArrayList<>();
public MtbGrup() {
this.type = "mtb_grup";
@@ -66,4 +70,13 @@ public class MtbGrup extends EntityBase {
this.tipoMgrp = tipoMgrp;
return this;
}
public List<MtbSgrp> getMtbSgrp() {
return mtbSgrp;
}
public MtbGrup setMtbSgrp(List<MtbSgrp> mtbSgrp) {
this.mtbSgrp = mtbSgrp;
return this;
}
}

View File

@@ -0,0 +1,49 @@
package it.integry.integrywmsnative.core.model;
public class MtbSfam extends EntityBase {
private String codMgrp;
private String codMsgr;
private String codMsfa;
private String descrizione;
public MtbSfam() {
this.type = "mtb_sfam";
}
public String getCodMgrp() {
return codMgrp;
}
public MtbSfam setCodMgrp(String codMgrp) {
this.codMgrp = codMgrp;
return this;
}
public String getCodMsgr() {
return codMsgr;
}
public MtbSfam setCodMsgr(String codMsgr) {
this.codMsgr = codMsgr;
return this;
}
public String getCodMsfa() {
return codMsfa;
}
public MtbSfam setCodMsfa(String codMsfa) {
this.codMsfa = codMsfa;
return this;
}
public String getDescrizione() {
return descrizione;
}
public MtbSfam setDescrizione(String descrizione) {
this.descrizione = descrizione;
return this;
}
}

View File

@@ -0,0 +1,112 @@
package it.integry.integrywmsnative.core.model;
import java.util.ArrayList;
import java.util.List;
public class MtbSgrp extends EntityBase {
private String codMgrp;
private String codMsgr;
private String descrizione;
private String inclInStat;
private String contoRimFin;
private Integer ordinamento;
private Boolean chkGiacenzaNeg;
private Boolean flagReso;
private String codCconWip;
private List<MtbSfam> mtbSfam = new ArrayList<>();
public MtbSgrp() {
this.type = "mtb_sgrp";
}
public String getCodMgrp() {
return codMgrp;
}
public MtbSgrp setCodMgrp(String codMgrp) {
this.codMgrp = codMgrp;
return this;
}
public String getCodMsgr() {
return codMsgr;
}
public MtbSgrp setCodMsgr(String codMsgr) {
this.codMsgr = codMsgr;
return this;
}
public String getDescrizione() {
return descrizione;
}
public MtbSgrp setDescrizione(String descrizione) {
this.descrizione = descrizione;
return this;
}
public String getInclInStat() {
return inclInStat;
}
public MtbSgrp setInclInStat(String inclInStat) {
this.inclInStat = inclInStat;
return this;
}
public String getContoRimFin() {
return contoRimFin;
}
public MtbSgrp setContoRimFin(String contoRimFin) {
this.contoRimFin = contoRimFin;
return this;
}
public Integer getOrdinamento() {
return ordinamento;
}
public MtbSgrp setOrdinamento(Integer ordinamento) {
this.ordinamento = ordinamento;
return this;
}
public Boolean getChkGiacenzaNeg() {
return chkGiacenzaNeg;
}
public MtbSgrp setChkGiacenzaNeg(Boolean chkGiacenzaNeg) {
this.chkGiacenzaNeg = chkGiacenzaNeg;
return this;
}
public Boolean getFlagReso() {
return flagReso;
}
public MtbSgrp setFlagReso(Boolean flagReso) {
this.flagReso = flagReso;
return this;
}
public String getCodCconWip() {
return codCconWip;
}
public MtbSgrp setCodCconWip(String codCconWip) {
this.codCconWip = codCconWip;
return this;
}
public List<MtbSfam> getMtbSfam() {
return mtbSfam;
}
public MtbSgrp setMtbSfam(List<MtbSfam> mtbSfam) {
this.mtbSfam = mtbSfam;
return this;
}
}

View File

@@ -15,7 +15,7 @@ public class MtbTCol {
private BigDecimal taraKg;
private String descrizione;
private String codMart;
private FlagUiUlEnum flagUIUL;
private FlagUiUlEnum flagUiUl;
private String circuito;
public String getCodTcol() {
@@ -90,12 +90,12 @@ public class MtbTCol {
return this;
}
public FlagUiUlEnum getFlagUIUL() {
return flagUIUL;
public FlagUiUlEnum getFlagUiUl() {
return flagUiUl;
}
public void setFlagUIUL(FlagUiUlEnum flagUIUL) {
this.flagUIUL = flagUIUL;
public void setFlagUiUl(FlagUiUlEnum flagUiUl) {
this.flagUiUl = flagUiUl;
}
public String getCircuito() {

View File

@@ -1,7 +1,5 @@
package it.integry.integrywmsnative.core.model;
import java.util.Date;
public class StbGestSetup extends EntityBase{
private String gestName;

View File

@@ -55,7 +55,7 @@ public class VtbDest extends EntityBase implements Parcelable {
return 0;
}
public static final Creator<VtbDest> CREATOR = new Creator<VtbDest>() {
public static final Creator<VtbDest> CREATOR = new Creator<>() {
@Override
public VtbDest createFromParcel(Parcel in) {
return new VtbDest(in);

View File

@@ -1,7 +1,5 @@
package it.integry.integrywmsnative.core.model;
import android.os.Parcelable;
import java.math.BigDecimal;
public class VtbVetr extends EntityBase {

View File

@@ -0,0 +1,29 @@
package it.integry.integrywmsnative.core.model.mapper;
import androidx.databinding.ObservableArrayList;
import androidx.databinding.ObservableList;
import java.util.List;
import java.util.stream.Collectors;
import it.integry.integrywmsnative.core.model.MtbTCol;
import it.integry.integrywmsnative.core.model.observable.ObservableMtbTcol;
public class MtbTcolMapper {
public static ObservableMtbTcol fromDTO(MtbTCol dto) {
ObservableMtbTcol mtbTcol = new ObservableMtbTcol();
mtbTcol.updateFromDTO(dto);
return mtbTcol;
}
public static ObservableList<ObservableMtbTcol> fromDTOList(List<MtbTCol> dto) {
ObservableList<ObservableMtbTcol> mtbTCols = new ObservableArrayList<>();
mtbTCols.addAll(dto.stream().map(MtbTcolMapper::fromDTO)
.collect(Collectors.toUnmodifiableList()));
return mtbTCols;
}
}

View File

@@ -0,0 +1,127 @@
package it.integry.integrywmsnative.core.model.observable;
import androidx.databinding.BaseObservable;
import androidx.databinding.Bindable;
import androidx.databinding.ObservableField;
import java.math.BigDecimal;
import it.integry.integrywmsnative.core.model.MtbTCol;
public class ObservableMtbTcol extends BaseObservable {
private final ObservableField<String> codTcol = new ObservableField<>();
private final ObservableField<BigDecimal> pesoKg = new ObservableField<>();
private final ObservableField<BigDecimal> lunghezzaCm = new ObservableField<>();
private final ObservableField<BigDecimal> larghezzaCm = new ObservableField<>();
private final ObservableField<BigDecimal> altezzaCm = new ObservableField<>();
private final ObservableField<BigDecimal> taraKg = new ObservableField<>();
private final ObservableField<String> descrizione = new ObservableField<>();
private final ObservableField<String> codMart = new ObservableField<>();
private final ObservableField<MtbTCol.FlagUiUlEnum> flagUIUL = new ObservableField<>();
private final ObservableField<String> circuito = new ObservableField<>();
@Bindable
public String getCodTcol() {
return codTcol.get();
}
@Bindable
public BigDecimal getPesoKg() {
return pesoKg.get();
}
@Bindable
public BigDecimal getLunghezzaCm() {
return lunghezzaCm.get();
}
@Bindable
public BigDecimal getLarghezzaCm() {
return larghezzaCm.get();
}
@Bindable
public BigDecimal getAltezzaCm() {
return altezzaCm.get();
}
@Bindable
public BigDecimal getTaraKg() {
return taraKg.get();
}
@Bindable
public String getDescrizione() {
return descrizione.get();
}
@Bindable
public String getCodMart() {
return codMart.get();
}
@Bindable
public MtbTCol.FlagUiUlEnum getFlagUIUL() {
return flagUIUL.get();
}
@Bindable
public String getCircuito() {
return circuito.get();
}
public ObservableField<String> codTcolProperty() {
return codTcol;
}
public ObservableField<BigDecimal> pesoKgProperty() {
return pesoKg;
}
public ObservableField<BigDecimal> lunghezzaCmProperty() {
return lunghezzaCm;
}
public ObservableField<BigDecimal> larghezzaCmProperty() {
return larghezzaCm;
}
public ObservableField<BigDecimal> altezzaCmProperty() {
return altezzaCm;
}
public ObservableField<BigDecimal> taraKgProperty() {
return taraKg;
}
public ObservableField<String> descrizioneProperty() {
return descrizione;
}
public ObservableField<String> codMartProperty() {
return codMart;
}
public ObservableField<MtbTCol.FlagUiUlEnum> flagUIULProperty() {
return flagUIUL;
}
public ObservableField<String> circuitoProperty() {
return circuito;
}
public void updateFromDTO(MtbTCol mtbTCol) {
codTcol.set(mtbTCol.getCodTcol());
pesoKg.set(mtbTCol.getPesoKg());
lunghezzaCm.set(mtbTCol.getLunghezzaCm());
larghezzaCm.set(mtbTCol.getLarghezzaCm());
altezzaCm.set(mtbTCol.getAltezzaCm());
taraKg.set(mtbTCol.getTaraKg());
descrizione.set(mtbTCol.getDescrizione());
codMart.set(mtbTCol.getCodMart());
flagUIUL.set(mtbTCol.getFlagUiUl());
circuito.set(mtbTCol.getCircuito());
}
}

View File

@@ -0,0 +1,78 @@
package it.integry.integrywmsnative.core.rest;
import androidx.annotation.NonNull;
import java.io.IOException;
import io.jsonwebtoken.Claims;
import it.integry.integrywmsnative.core.authentication.JwtUtils;
import it.integry.integrywmsnative.core.exception.UnauthorizedAccessException;
import it.integry.integrywmsnative.core.settings.SettingsManager;
import it.integry.integrywmsnative.core.utility.UtilityDate;
import it.integry.integrywmsnative.gest.login.rest.RefreshRESTConsumer;
import okhttp3.Interceptor;
import okhttp3.Protocol;
import okhttp3.Response;
import okhttp3.ResponseBody;
public class AuthInterceptor implements Interceptor {
private final RefreshRESTConsumer refreshRESTConsumer;
public AuthInterceptor(RefreshRESTConsumer refreshRESTConsumer) {
this.refreshRESTConsumer = refreshRESTConsumer;
}
@NonNull
@Override
public Response intercept(@NonNull Chain chain) throws IOException {
var originalRequest = chain.request();
if (SettingsManager.i().getUserSession() != null) {
var accessToken = SettingsManager.i().getUserSession().getAccessToken();
var accessTokenExpiryDate = SettingsManager.i().getUserSession().getAccessTokenExpiryDate();
if (accessToken != null && (accessTokenExpiryDate == null || UtilityDate.getNowTime().isAfter(accessTokenExpiryDate.minusSeconds(20)))) {
// Make the token refresh request
try {
var response = refreshRESTConsumer.makeSynchronousRefreshTokenRequest();
Claims claims = JwtUtils.parseJwt(response.getAccessToken());
SettingsManager.i().getUserSession()
.setAccessToken(response.getAccessToken())
.setAccessTokenExpiryDate(UtilityDate.toLocalDateTime(claims.getExpiration()))
.setRefreshToken(response.getRefreshToken())
.setRefreshTokenExpiryDate(response.getExpiryDate());
SettingsManager.update();
} catch (UnauthorizedAccessException uae) {
// Crea una risposta 401 manualmente
return new Response.Builder()
.request(originalRequest)
.protocol(Protocol.HTTP_1_1)
.code(401)
.message("Unauthorized")
.body(ResponseBody.create(new byte[0], null))
.build();
} catch (Exception e) {
return chain.proceed(originalRequest);
}
// Add the access token to the request header
var authorizedRequest = originalRequest.newBuilder()
.header("Authorization", "Bearer " + SettingsManager.i().getUserSession().getAccessToken())
.build();
return chain.proceed(authorizedRequest);
} else
return chain.proceed(originalRequest);
} else
return chain.proceed(originalRequest);
}
}

View File

@@ -1,10 +1,9 @@
package it.integry.integrywmsnative.core.rest;
import android.util.Base64;
import java.io.IOException;
import it.integry.integrywmsnative.core.settings.SettingsManager;
import it.integry.integrywmsnative.core.utility.UtilityDate;
import okhttp3.HttpUrl;
import okhttp3.Interceptor;
import okhttp3.Request;
@@ -20,25 +19,33 @@ public class HttpInterceptor implements Interceptor {
public Response intercept(Chain chain) throws IOException {
final String PROFILE_DB = SettingsManager.i().getUserSession() == null ? null : SettingsManager.i().getUserSession().getProfileDB();
final String USERNAME = SettingsManager.i().getUser().getUsername();
final String PASSWORD = SettingsManager.i().getUser().getPassword();
final String DEVICE_ID = SettingsManager.i().getUserSession().getDeviceId();
final String APP_TOKEN = "fa3a21af-606b-4129-a22b-aedc2a52c7b6";
final Request request = chain.request();
final HttpUrl url = request.url().newBuilder()
.addQueryParameter("profileDb", PROFILE_DB)
.build();
String string = "Basic " + Base64.encodeToString((USERNAME + ":" + PASSWORD).getBytes(), Base64.NO_WRAP);
final Request newRequest = chain.request().newBuilder()
.addHeader("Authorization", string)
Request.Builder builder = chain.request().newBuilder()
.addHeader("Content-Type", "application/json")
.addHeader("Accept", "*/*")
.addHeader("username", USERNAME != null ? USERNAME : "")
.addHeader("password", PASSWORD != null ? PASSWORD : "")
.addHeader("device_id", DEVICE_ID != null ? DEVICE_ID : "")
.url(url).build();
.addHeader("x-app-token", APP_TOKEN);
String accessToken = null;
//Nel caso in cui il token è scaduto e devo richiamare la refresh non bisogna passare il vecchio token
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
.url(url)
.build();
return chain.proceed(newRequest);
}

View File

@@ -6,6 +6,7 @@ import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.util.concurrent.TimeUnit;
import javax.inject.Singleton;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
@@ -20,37 +21,47 @@ import retrofit2.converter.gson.GsonConverterFactory;
* Created by GiuseppeS on 06/03/2018.
*/
@Singleton
public class RESTBuilder {
private static final boolean ADD_LOGGER_INTERCEPTOR = false;
private final boolean ADD_LOGGER_INTERCEPTOR = false;
private final AuthInterceptor authInterceptor;
public static <T> T getService(final Class<T> service) {
public RESTBuilder(AuthInterceptor authInterceptor) {
this.authInterceptor = authInterceptor;
}
public <T> T getService(final Class<T> service) {
return getService(service, SettingsManager.i().getServer().getProtocol(), SettingsManager.i().getServer().getHost(), SettingsManager.i().getServer().getPort(), true);
}
public static <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);
}
public static <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, boolean addInterceptors) {
return getService(service, protocol, host, port, addInterceptors, true, 60);
}
public static <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 addInterceptors, boolean addEmsApi) {
return getService(service, protocol, host, port, addInterceptors, addEmsApi, 60);
}
public static <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 addInterceptors, boolean addEmsApi, int timeout) {
OkHttpClient.Builder clientBuilder = getDefaultHttpClient();
timeout = 0;
clientBuilder.connectTimeout(timeout, TimeUnit.SECONDS);
clientBuilder.readTimeout(timeout, TimeUnit.SECONDS);
clientBuilder.writeTimeout(timeout, TimeUnit.SECONDS);
clientBuilder.callTimeout(timeout, TimeUnit.SECONDS);
clientBuilder.retryOnConnectionFailure(true);
clientBuilder.addInterceptor(authInterceptor);
if (addInterceptors) clientBuilder.addInterceptor(new HttpInterceptor());
if (ADD_LOGGER_INTERCEPTOR) clientBuilder.addInterceptor(new HttpLoggerInterceptor());
@@ -71,15 +82,6 @@ public class RESTBuilder {
}
public static String getDefaultHost() {
return SettingsManager.i().getServer().getHost();
}
public static int getDefaultPort() {
return SettingsManager.i().getServer().getPort();
}
public static OkHttpClient.Builder getDefaultHttpClient() {
TrustManager[] trustAllCerts = new TrustManager[]{
new X509TrustManager() {

View File

@@ -1,5 +1,7 @@
package it.integry.integrywmsnative.core.rest.consumers;
import androidx.annotation.NonNull;
import com.annimon.stream.Stream;
import com.google.gson.reflect.TypeToken;
@@ -8,6 +10,9 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.ExecutorService;
import java.util.stream.Collectors;
import javax.inject.Singleton;
@@ -17,94 +22,154 @@ import it.integry.integrywmsnative.core.model.MtbGrup;
import it.integry.integrywmsnative.core.model.MtbUntMis;
import it.integry.integrywmsnative.core.model.dto.StatoArticoloDTO;
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.rest.model.articolo.ArticoloDTO;
import it.integry.integrywmsnative.core.rest.model.articolo.RetrieveArticoloByCodMartRequestDTO;
import it.integry.integrywmsnative.core.rest.model.articolo.SaveArticoloRequestDTO;
import it.integry.integrywmsnative.core.rest.model.articolo.SaveArticoloResponseDTO;
import it.integry.integrywmsnative.core.rest.model.articolo.SearchArticoloByBarcodeRequestDTO;
import it.integry.integrywmsnative.core.rest.model.articolo.SearchArticoloByBarcodeResponseDTO;
import it.integry.integrywmsnative.core.rest.model.articolo.UpdateBarcodeImballoRequestDTO;
import it.integry.integrywmsnative.core.utility.UtilityQuery;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
@Singleton
public class ArticoloRESTConsumer extends _BaseRESTConsumer {
private final RESTBuilder restBuilder;
private final ExecutorService executorService;
private final SystemRESTConsumer systemRESTConsumer;
public ArticoloRESTConsumer(SystemRESTConsumer systemRESTConsumer) {
public ArticoloRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService, SystemRESTConsumer systemRESTConsumer) {
this.restBuilder = restBuilder;
this.executorService = executorService;
this.systemRESTConsumer = systemRESTConsumer;
}
public void searchByBarcode(String barcodeProd, RunnableArgs<List<MtbAart>> onComplete, RunnableArgs<Exception> onFailed) {
ArticoloRESTConsumerService articoloRESTConsumerService = RESTBuilder.getService(ArticoloRESTConsumerService.class);
public void retrieveAvailableUntMis(RunnableArgs<List<MtbUntMis>> onComplete, RunnableArgs<Exception> onFailed) {
ArticoloRESTConsumerService articoloRESTConsumerService = restBuilder.getService(ArticoloRESTConsumerService.class);
articoloRESTConsumerService
.retrieveAvailableUntMis()
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<MtbUntMis>> call, Response<ServiceRESTResponse<MtbUntMis>> response) {
analyzeAnswerList(response, "retrieveAvailableUntMis", onComplete, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<MtbUntMis>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
public void retrieveAvailableGruppiMerceologici(RunnableArgs<List<MtbGrup>> onComplete, RunnableArgs<Exception> onFailed) {
ArticoloRESTConsumerService articoloRESTConsumerService = restBuilder.getService(ArticoloRESTConsumerService.class);
articoloRESTConsumerService
.retrieveAvailableGruppiMerceologici()
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<MtbGrup>> call, Response<ServiceRESTResponse<MtbGrup>> response) {
analyzeAnswerList(response, "retrieveAvailableGruppiMerceologici", onComplete, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<MtbGrup>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
public List<MtbAart> searchByBarcodeSynchronized(String barcodeProd) throws Exception {
ArticoloRESTConsumerService articoloRESTConsumerService = restBuilder.getService(ArticoloRESTConsumerService.class);
var request = new SearchArticoloByBarcodeRequestDTO()
.setBarcode(barcodeProd)
.setOnlyActive(true);
articoloRESTConsumerService
var response = articoloRESTConsumerService
.searchByBarcode(request)
.enqueue(new Callback<>() {
.execute();
analyzeAnswer(response, "searchByBarcode");
return response.body().getDto().getArts();
}
public void searchByBarcode(String barcodeProd, RunnableArgs<List<MtbAart>> onComplete, RunnableArgs<Exception> onFailed) {
executorService.execute(() -> {
try {
var mtbAarts = searchByBarcodeSynchronized(barcodeProd);
if (onComplete != null) onComplete.run(mtbAarts);
} catch (Exception ex) {
if (onFailed != null) onFailed.run(ex);
}
});
}
public void findIfIsKit(MtbAart mtbAart, RunnableArgs<MtbAart> onComplete, RunnableArgs<Exception> onFailed){
ArticoloRESTConsumerService articoloRESTConsumerService = restBuilder.getService(ArticoloRESTConsumerService.class);
articoloRESTConsumerService
.findIfIsKit(mtbAart)
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<SearchArticoloByBarcodeResponseDTO>> call, Response<ServiceRESTResponse<SearchArticoloByBarcodeResponseDTO>> response) {
analyzeAnswer(response, "searchByBarcode", (m) -> {
onComplete.run(response.body().getDto().getArts());
public void onResponse(@NonNull Call<ServiceRESTResponse<MtbAart>> call, @NonNull Response<ServiceRESTResponse<MtbAart>> response) {
analyzeAnswer(response, "findIfIsKit", (m) -> {
onComplete.run(response.body().getDto());
}, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<SearchArticoloByBarcodeResponseDTO>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<MtbAart>> call, @NonNull Exception e) {
onFailed.run(e);
}
});
}
public List<MtbAart> getByCodMartsSynchronized(List<String> codMartToFind) throws Exception {
var codMarts = codMartToFind.parallelStream()
.filter(Objects::nonNull)
.distinct()
.collect(Collectors.toUnmodifiableList());
public void getByCodMarts(List<String> codMartToFind, RunnableArgs<List<MtbAart>> onComplete, RunnableArgs<Exception> onFailed) {
getByCodMartsStatic(codMartToFind, onComplete, onFailed);
}
public static void getByCodMartsStatic(List<String> codMartToFind, RunnableArgs<List<MtbAart>> onComplete, RunnableArgs<Exception> onFailed) {
var codMarts = Stream.of(codMartToFind)
.withoutNulls()
.distinct().toList();
ArticoloRESTConsumerService articoloRESTConsumer = RESTBuilder.getService(ArticoloRESTConsumerService.class);
articoloRESTConsumer
ArticoloRESTConsumerService articoloRESTConsumer = restBuilder.getService(ArticoloRESTConsumerService.class);
var response = articoloRESTConsumer
.getByCodMart(new RetrieveArticoloByCodMartRequestDTO()
.setCodMarts(codMarts))
.enqueue(new Callback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<List<MtbAart>>> call, Response<ServiceRESTResponse<List<MtbAart>>> response) {
analyzeAnswer(response, "getByCodMart", onComplete, onFailed);
}
.execute();
return analyzeAnswer(response, "getByCodMart");
}
@Override
public void onFailure(Call<ServiceRESTResponse<List<MtbAart>>> call, Throwable t) {
onFailed.run(new Exception(t));
}
});
public void getByCodMarts(List<String> codMartToFind, RunnableArgs<List<MtbAart>> onComplete, RunnableArgs<Exception> onFailed) {
executorService.execute(() -> {
try {
var mtbAarts = getByCodMartsSynchronized(codMartToFind);
if (onComplete != null) onComplete.run(mtbAarts);
} catch (Exception ex) {
if (onFailed != null) onFailed.run(ex);
}
});
}
public List<StatoArticoloDTO> getStatoPartitaSynchronized(String codMart, String partitaMag) throws Exception {
ArticoloRESTConsumerService articoloRESTConsumer = restBuilder.getService(ArticoloRESTConsumerService.class);
var response = articoloRESTConsumer.getStatoPartita(codMart, partitaMag).execute();
var data = analyzeAnswer(response, "getStatoPartita");
return data;
}
public void getStatoPartita(String codMart, String partitaMag, RunnableArgs<List<StatoArticoloDTO>> onComplete, RunnableArgs<Exception> onFailed) {
ArticoloRESTConsumerService articoloRESTConsumer = RESTBuilder.getService(ArticoloRESTConsumerService.class);
articoloRESTConsumer.getStatoPartita(codMart, partitaMag).enqueue(new Callback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<List<StatoArticoloDTO>>> call, Response<ServiceRESTResponse<List<StatoArticoloDTO>>> response) {
analyzeAnswer(response, "getStatoPartita", onComplete, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<List<StatoArticoloDTO>>> call, Throwable t) {
onFailed.run(new Exception(t));
executorService.execute(() -> {
try {
var response = getStatoPartitaSynchronized(codMart, partitaMag);
if (onComplete != null) onComplete.run(response);
} catch (Exception ex) {
if (onFailed != null) onFailed.run(ex);
}
});
}
@@ -116,7 +181,7 @@ public class ArticoloRESTConsumer extends _BaseRESTConsumer {
}
public void getArtsGroups(List<String> groupsToFind, RunnableArgs<List<MtbGrup>> onComplete, RunnableArgs<Exception> onFailed) {
public List<MtbGrup> getArtsGroupsSynchronized(List<String> groupsToFind) throws Exception {
var whereCondMap = Stream.of(groupsToFind)
.map(x -> {
HashMap<String, Object> vars = new HashMap<>();
@@ -130,7 +195,18 @@ public class ArticoloRESTConsumer extends _BaseRESTConsumer {
Type typeOfObjectsList = new TypeToken<ArrayList<MtbGrup>>() {
}.getType();
this.systemRESTConsumer.processSql("SELECT * FROM mtb_grup " + whereCond, typeOfObjectsList, onComplete, onFailed);
return this.systemRESTConsumer.processSqlSynchronized("SELECT * FROM mtb_grup " + whereCond, typeOfObjectsList);
}
public void getArtsGroups(List<String> groupsToFind, RunnableArgs<List<MtbGrup>> onComplete, RunnableArgs<Exception> onFailed) {
executorService.execute(() -> {
try {
var data = getArtsGroupsSynchronized(groupsToFind);
if (onComplete != null) onComplete.run(data);
} catch (Exception ex) {
if (onFailed != null) onFailed.run(ex);
}
});
}
@@ -183,7 +259,7 @@ public class ArticoloRESTConsumer extends _BaseRESTConsumer {
public void updateBarcodeImballo(String codMart, String newBarcodeImballo, Runnable onComplete, RunnableArgs<Exception> onFailed) {
ArticoloRESTConsumerService articoloRESTConsumerService = RESTBuilder.getService(ArticoloRESTConsumerService.class);
ArticoloRESTConsumerService articoloRESTConsumerService = restBuilder.getService(ArticoloRESTConsumerService.class);
var request = new UpdateBarcodeImballoRequestDTO()
.setCodMart(codMart)
@@ -191,7 +267,7 @@ public class ArticoloRESTConsumer extends _BaseRESTConsumer {
articoloRESTConsumerService
.updateBarcodeImballo(request)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
analyzeAnswer(response, "updateBarcodeImballo", m -> {
@@ -200,8 +276,32 @@ public class ArticoloRESTConsumer extends _BaseRESTConsumer {
}
@Override
public void onFailure(Call<ServiceRESTResponse<Void>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
public void saveArticolo(ArticoloDTO articoloToSave, RunnableArgs<String> onComplete, RunnableArgs<Exception> onFailed) {
ArticoloRESTConsumerService articoloRESTConsumerService = restBuilder.getService(ArticoloRESTConsumerService.class);
var request = new SaveArticoloRequestDTO()
.setArtToSave(articoloToSave);
articoloRESTConsumerService
.saveArticolo(request)
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<SaveArticoloResponseDTO>> call, Response<ServiceRESTResponse<SaveArticoloResponseDTO>> response) {
analyzeAnswer(response, "saveArticolo", data -> {
onComplete.run(data.getCodMart());
}, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<SaveArticoloResponseDTO>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}

View File

@@ -3,9 +3,13 @@ package it.integry.integrywmsnative.core.rest.consumers;
import java.util.List;
import it.integry.integrywmsnative.core.model.MtbAart;
import it.integry.integrywmsnative.core.model.MtbGrup;
import it.integry.integrywmsnative.core.model.MtbUntMis;
import it.integry.integrywmsnative.core.model.dto.StatoArticoloDTO;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import it.integry.integrywmsnative.core.rest.model.articolo.RetrieveArticoloByCodMartRequestDTO;
import it.integry.integrywmsnative.core.rest.model.articolo.SaveArticoloRequestDTO;
import it.integry.integrywmsnative.core.rest.model.articolo.SaveArticoloResponseDTO;
import it.integry.integrywmsnative.core.rest.model.articolo.SearchArticoloByBarcodeRequestDTO;
import it.integry.integrywmsnative.core.rest.model.articolo.SearchArticoloByBarcodeResponseDTO;
import it.integry.integrywmsnative.core.rest.model.articolo.UpdateBarcodeImballoRequestDTO;
@@ -17,9 +21,19 @@ import retrofit2.http.Query;
public interface ArticoloRESTConsumerService {
@GET("wms/articolo/availableUntMis")
Call<ServiceRESTResponse<MtbUntMis>> retrieveAvailableUntMis();
@GET("wms/articolo/availableGruppiMerceologici")
Call<ServiceRESTResponse<MtbGrup>> retrieveAvailableGruppiMerceologici();
@POST("wms/articolo/searchByBarcode")
Call<ServiceRESTResponse<SearchArticoloByBarcodeResponseDTO>> searchByBarcode(@Body() SearchArticoloByBarcodeRequestDTO searchArticoloByBarcodeRequest);
@POST("wms/articolo/findIfIsKit")
Call<ServiceRESTResponse<MtbAart>> findIfIsKit(@Body MtbAart mtbAart);
@POST("wms/articolo/retrieveByCodMart")
Call<ServiceRESTResponse<List<MtbAart>>> getByCodMart(@Body RetrieveArticoloByCodMartRequestDTO retrieveArticoloByCodMartRequest);
@@ -29,4 +43,7 @@ public interface ArticoloRESTConsumerService {
@GET("getProductLotStatus")
Call<ServiceRESTResponse<List<StatoArticoloDTO>>> getStatoPartita(@Query("codMart") String codMart, @Query("partitaMag") String partitaMag);
@POST("wms/articolo/saveArticolo")
Call<ServiceRESTResponse<SaveArticoloResponseDTO>> saveArticolo(@Body SaveArticoloRequestDTO saveArticoloRequest);
}

View File

@@ -1,29 +1,37 @@
package it.integry.integrywmsnative.core.rest.consumers;
import androidx.annotation.NonNull;
import javax.inject.Singleton;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.model.Azienda;
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.Callback;
import retrofit2.Response;
@Singleton
public class AziendaRESTConsumer extends _BaseRESTConsumer {
private final RESTBuilder restBuilder;
public AziendaRESTConsumer(RESTBuilder restBuilder) {
this.restBuilder = restBuilder;
}
public void retrieveAzienda(RunnableArgs<Azienda> onComplete, RunnableArgs<Exception> onFailed) {
AziendaRESTConsumerService aziendaRESTConsumerService = RESTBuilder.getService(AziendaRESTConsumerService.class);
aziendaRESTConsumerService.retrieveDefaultAzienda().enqueue(new Callback<>() {
AziendaRESTConsumerService aziendaRESTConsumerService = restBuilder.getService(AziendaRESTConsumerService.class);
aziendaRESTConsumerService.retrieveDefaultAzienda().enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Azienda>> call, Response<ServiceRESTResponse<Azienda>> response) {
analyzeAnswer(response, "Retrieve default azienda", onComplete, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<Azienda>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<Azienda>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}

View File

@@ -16,6 +16,10 @@ public class BarcodeRESTConsumer extends _BaseRESTConsumer {
this.ean128Service = ean128Service;
}
public Ean128Model decodeEan128Synchronized(BarcodeScanDTO barcodeScanDTO) throws Exception {
return this.ean128Service.decode(barcodeScanDTO);
}
public void decodeEan128(BarcodeScanDTO barcodeObj, RunnableArgs<Ean128Model> onComplete, RunnableArgs<Exception> onFailed) {
try {
onComplete.run(this.ean128Service.decode(barcodeObj));

View File

@@ -1,5 +1,7 @@
package it.integry.integrywmsnative.core.rest.consumers;
import androidx.annotation.NonNull;
import javax.inject.Singleton;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
@@ -7,6 +9,7 @@ import it.integry.integrywmsnative.core.model.MtbColr;
import it.integry.integrywmsnative.core.model.MtbColt;
import it.integry.integrywmsnative.core.rest.RESTBuilder;
import it.integry.integrywmsnative.core.rest.consumers.interfaces.ColliCaricoRESTConsumerInterface;
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import it.integry.integrywmsnative.core.rest.model.udc.CloseUDCRequestDTO;
import it.integry.integrywmsnative.core.rest.model.udc.CloseUDCResponseDTO;
@@ -18,25 +21,30 @@ import it.integry.integrywmsnative.core.rest.model.udc.EditUDCRowResponseDTO;
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDCRowRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDCRowResponseDTO;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
@Singleton
public class ColliAccettazioneRESTConsumer extends _BaseRESTConsumer implements ColliCaricoRESTConsumerInterface {
private final RESTBuilder restBuilder;
public ColliAccettazioneRESTConsumer(RESTBuilder restBuilder) {
this.restBuilder = restBuilder;
}
public void createUDC(CreateUDCRequestDTO createUDCRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
ColliAccettazioneRESTConsumerService colliAccettazioneRESTConsumerService = RESTBuilder.getService(ColliAccettazioneRESTConsumerService.class);
ColliAccettazioneRESTConsumerService colliAccettazioneRESTConsumerService = restBuilder.getService(ColliAccettazioneRESTConsumerService.class);
colliAccettazioneRESTConsumerService.createUDC(createUDCRequestDTO)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<CreateUDCResponseDTO>> call, Response<ServiceRESTResponse<CreateUDCResponseDTO>> response) {
analyzeAnswer(response, "accettazione/createUDC", data -> onComplete.run(data.getMtbColt()), onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<CreateUDCResponseDTO>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<CreateUDCResponseDTO>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
@@ -44,89 +52,89 @@ public class ColliAccettazioneRESTConsumer extends _BaseRESTConsumer implements
@Override
public void closeUDC(CloseUDCRequestDTO closeUDCRequestDTO, RunnableArgs<CloseUDCResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
ColliAccettazioneRESTConsumerService colliAccettazioneRESTConsumerService = RESTBuilder.getService(ColliAccettazioneRESTConsumerService.class);
ColliAccettazioneRESTConsumerService colliAccettazioneRESTConsumerService = restBuilder.getService(ColliAccettazioneRESTConsumerService.class);
colliAccettazioneRESTConsumerService.closeUDC(closeUDCRequestDTO)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<CloseUDCResponseDTO>> call, Response<ServiceRESTResponse<CloseUDCResponseDTO>> response) {
analyzeAnswer(response, "accettazione/closeUDC", onComplete, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<CloseUDCResponseDTO>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<CloseUDCResponseDTO>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
@Override
public void insertUDCRow(InsertUDCRowRequestDTO insertUDCRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
ColliAccettazioneRESTConsumerService colliAccettazioneRESTConsumerService = RESTBuilder.getService(ColliAccettazioneRESTConsumerService.class);
ColliAccettazioneRESTConsumerService colliAccettazioneRESTConsumerService = restBuilder.getService(ColliAccettazioneRESTConsumerService.class);
colliAccettazioneRESTConsumerService.insertUDCRow(insertUDCRowRequestDTO)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<InsertUDCRowResponseDTO>> call, Response<ServiceRESTResponse<InsertUDCRowResponseDTO>> response) {
analyzeAnswer(response, "accettazione/insertUDCRow", data -> onComplete.run(data.getSavedMtbColr()), onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<InsertUDCRowResponseDTO>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<InsertUDCRowResponseDTO>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
@Override
public void editUDCRow(EditUDCRowRequestDTO editUDCRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
ColliAccettazioneRESTConsumerService colliAccettazioneRESTConsumerService = RESTBuilder.getService(ColliAccettazioneRESTConsumerService.class);
ColliAccettazioneRESTConsumerService colliAccettazioneRESTConsumerService = restBuilder.getService(ColliAccettazioneRESTConsumerService.class);
colliAccettazioneRESTConsumerService.editUDCRow(editUDCRowRequestDTO)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<EditUDCRowResponseDTO>> call, Response<ServiceRESTResponse<EditUDCRowResponseDTO>> response) {
analyzeAnswer(response, "accettazione/editUDCRow", data -> onComplete.run(data.getSavedMtbColr()), onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<EditUDCRowResponseDTO>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<EditUDCRowResponseDTO>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
@Override
public void deleteUDCRow(DeleteUDCRowRequestDTO deleteUDCRowRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
ColliAccettazioneRESTConsumerService colliAccettazioneRESTConsumerService = RESTBuilder.getService(ColliAccettazioneRESTConsumerService.class);
ColliAccettazioneRESTConsumerService colliAccettazioneRESTConsumerService = restBuilder.getService(ColliAccettazioneRESTConsumerService.class);
colliAccettazioneRESTConsumerService.deleteUDCRow(deleteUDCRowRequestDTO)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
analyzeAnswer(response, "accettazione/deleteUDCRow", data -> onComplete.run(), onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<Void>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
public void checkBarcodeUl(String barcodeUl, RunnableArgs<Boolean> onComplete, RunnableArgs<Exception> onFailed){
ColliAccettazioneRESTConsumerService colliAccettazioneRESTConsumerService = RESTBuilder.getService(ColliAccettazioneRESTConsumerService.class);
ColliAccettazioneRESTConsumerService colliAccettazioneRESTConsumerService = restBuilder.getService(ColliAccettazioneRESTConsumerService.class);
colliAccettazioneRESTConsumerService.checkIfBarcodeUlAlreadyRegistered(barcodeUl)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Boolean>> call, Response<ServiceRESTResponse<Boolean>> response) {
analyzeAnswer(response, "accettazione/checkIfBarcodeUlAlreadyRegistered", onComplete, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<Boolean>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<Boolean>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}

View File

@@ -1,5 +1,7 @@
package it.integry.integrywmsnative.core.rest.consumers;
import androidx.annotation.NonNull;
import java.math.BigDecimal;
import javax.inject.Singleton;
@@ -12,6 +14,7 @@ import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
import it.integry.integrywmsnative.core.rest.RESTBuilder;
import it.integry.integrywmsnative.core.rest.consumers.interfaces.ColliCaricoRESTConsumerInterface;
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.udc.CloseUDCRequestDTO;
import it.integry.integrywmsnative.core.rest.model.udc.CloseUDCResponseDTO;
@@ -34,104 +37,105 @@ import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowResponseDTO;
import it.integry.integrywmsnative.core.settings.SettingsManager;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
@Singleton
public class ColliLavorazioneRESTConsumer extends _BaseRESTConsumer implements ColliCaricoRESTConsumerInterface, ColliScaricoRESTConsumerInterface {
private final RESTBuilder restBuilder;
private final SettingsManager settingsManager;
public ColliLavorazioneRESTConsumer(SettingsManager settingsManager) {
public ColliLavorazioneRESTConsumer(RESTBuilder restBuilder, SettingsManager settingsManager) {
this.restBuilder = restBuilder;
this.settingsManager = settingsManager;
}
@Override
public void createUDC(CreateUDCRequestDTO createUDCRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = RESTBuilder.getService(ColliLavorazioneRESTConsumerService.class);
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
colliLavorazioneRESTConsumerService.createUDC(createUDCRequestDTO)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<CreateUDCResponseDTO>> call, Response<ServiceRESTResponse<CreateUDCResponseDTO>> response) {
analyzeAnswer(response, "lavorazione/createUDC", data -> onComplete.run(data.getMtbColt()), onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<CreateUDCResponseDTO>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<CreateUDCResponseDTO>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
@Override
public void closeUDC(CloseUDCRequestDTO closeUDCRequestDTO, RunnableArgs<CloseUDCResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = RESTBuilder.getService(ColliLavorazioneRESTConsumerService.class);
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
colliLavorazioneRESTConsumerService.closeUDC(closeUDCRequestDTO)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<CloseUDCResponseDTO>> call, Response<ServiceRESTResponse<CloseUDCResponseDTO>> response) {
analyzeAnswer(response, "lavorazione/closeUDC", onComplete, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<CloseUDCResponseDTO>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<CloseUDCResponseDTO>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
@Override
public void insertUDCRow(InsertUDCRowRequestDTO insertUDCRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = RESTBuilder.getService(ColliLavorazioneRESTConsumerService.class);
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
colliLavorazioneRESTConsumerService.insertUDCRow(insertUDCRowRequestDTO)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<InsertUDCRowResponseDTO>> call, Response<ServiceRESTResponse<InsertUDCRowResponseDTO>> response) {
analyzeAnswer(response, "lavorazione/insertUDCRow", data -> onComplete.run(data.getSavedMtbColr()), onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<InsertUDCRowResponseDTO>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<InsertUDCRowResponseDTO>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
@Override
public void editUDCRow(EditUDCRowRequestDTO editUDCRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = RESTBuilder.getService(ColliLavorazioneRESTConsumerService.class);
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
colliLavorazioneRESTConsumerService.editUDCRow(editUDCRowRequestDTO)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<EditUDCRowResponseDTO>> call, Response<ServiceRESTResponse<EditUDCRowResponseDTO>> response) {
analyzeAnswer(response, "lavorazione/editUDCRow", data -> onComplete.run(data.getSavedMtbColr()), onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<EditUDCRowResponseDTO>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<EditUDCRowResponseDTO>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
public void createUDS(CreateUDSRequestDTO createUDSRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = RESTBuilder.getService(ColliLavorazioneRESTConsumerService.class);
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
colliLavorazioneRESTConsumerService.createUDS(createUDSRequestDTO)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<CreateUDSResponseDTO>> call, Response<ServiceRESTResponse<CreateUDSResponseDTO>> response) {
analyzeAnswer(response, "lavorazione/createUDS", data -> onComplete.run(data.getMtbColt()), onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<CreateUDSResponseDTO>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<CreateUDSResponseDTO>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
@@ -139,89 +143,89 @@ public class ColliLavorazioneRESTConsumer extends _BaseRESTConsumer implements C
@Override
public void closeUDS(CloseUDSRequestDTO closeUDSRequestDTO, RunnableArgs<CloseUDSResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = RESTBuilder.getService(ColliLavorazioneRESTConsumerService.class);
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
colliLavorazioneRESTConsumerService.closeUDS(closeUDSRequestDTO)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<CloseUDSResponseDTO>> call, Response<ServiceRESTResponse<CloseUDSResponseDTO>> response) {
analyzeAnswer(response, "lavorazione/closeUDS", onComplete, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<CloseUDSResponseDTO>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<CloseUDSResponseDTO>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
@Override
public void insertUDSRow(InsertUDSRowRequestDTO insertUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = RESTBuilder.getService(ColliLavorazioneRESTConsumerService.class);
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
colliLavorazioneRESTConsumerService.insertUDSRow(insertUDSRowRequestDTO)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<InsertUDSRowResponseDTO>> call, Response<ServiceRESTResponse<InsertUDSRowResponseDTO>> response) {
analyzeAnswer(response, "lavorazione/insertUDSRow", data -> onComplete.run(data.getSavedMtbColr()), onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<InsertUDSRowResponseDTO>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<InsertUDSRowResponseDTO>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
public void editUDSRow(EditUDSRowRequestDTO editUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = RESTBuilder.getService(ColliLavorazioneRESTConsumerService.class);
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
colliLavorazioneRESTConsumerService.editUDSRow(editUDSRowRequestDTO)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<EditUDSRowResponseDTO>> call, Response<ServiceRESTResponse<EditUDSRowResponseDTO>> response) {
analyzeAnswer(response, "lavorazione/editUDSRow", data -> onComplete.run(data.getSavedMtbColr()), onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<EditUDSRowResponseDTO>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<EditUDSRowResponseDTO>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
@Override
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)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
analyzeAnswer(response, "lavorazione/deleteUDSRow", data -> onComplete.run(), onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<Void>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
@Override
public void deleteUDCRow(DeleteUDCRowRequestDTO deleteUDCRowRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = RESTBuilder.getService(ColliLavorazioneRESTConsumerService.class);
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
colliLavorazioneRESTConsumerService.deleteUDCRow(deleteUDCRowRequestDTO)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
analyzeAnswer(response, "lavorazione/deleteUDCRow", data -> onComplete.run(), onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<Void>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
@@ -249,18 +253,18 @@ public class ColliLavorazioneRESTConsumer extends _BaseRESTConsumer implements C
createUDSFromArtRequestDTO
.setCodJfas(posizione.getPosizione());
}
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = RESTBuilder.getService(ColliLavorazioneRESTConsumerService.class);
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
colliLavorazioneRESTConsumerService.createUDSFromArt(createUDSFromArtRequestDTO)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
analyzeAnswer(response, "lavorazione/createUDSFromArt", data -> onComplete.run(), onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<Void>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}

View File

@@ -1,5 +1,6 @@
package it.integry.integrywmsnative.core.rest.consumers;
import androidx.annotation.NonNull;
import androidx.databinding.ObservableArrayList;
import com.annimon.stream.Optional;
@@ -11,9 +12,12 @@ import org.jetbrains.annotations.NotNull;
import java.lang.reflect.Type;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import javax.inject.Singleton;
@@ -28,9 +32,13 @@ import it.integry.integrywmsnative.core.model.MtbColt;
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
import it.integry.integrywmsnative.core.rest.RESTBuilder;
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
import it.integry.integrywmsnative.core.rest.model.RettificaULDTO;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
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.UpdateTipoULRequestDTO;
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.DeleteULRequestDTO;
@@ -42,21 +50,22 @@ import it.integry.integrywmsnative.core.utility.UtilityQuery;
import it.integry.integrywmsnative.core.utility.UtilityString;
import it.integry.integrywmsnative.gest.prod_versamento_materiale.dto.OrdineLavorazioneDTO;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
@Singleton
public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
private final RESTBuilder restBuilder;
private final SystemRESTConsumer mSystemRESTConsumer;
private final ArticoloRESTConsumer mArticoloRESTConsumer;
private final EntityRESTConsumer mEntityRESTConsumer;
private final SettingsManager mSettingsManager;
public ColliMagazzinoRESTConsumer(SystemRESTConsumer systemRESTConsumer,
public ColliMagazzinoRESTConsumer(RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer,
ArticoloRESTConsumer articoloRESTConsumer,
EntityRESTConsumer entityRESTConsumer,
SettingsManager settingsManager) {
this.restBuilder = restBuilder;
this.mSystemRESTConsumer = systemRESTConsumer;
this.mArticoloRESTConsumer = articoloRESTConsumer;
this.mEntityRESTConsumer = entityRESTConsumer;
@@ -78,7 +87,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
.setMtbPartitaMag(null));
}
this.mEntityRESTConsumer.processEntity(mtbColtToSaveClone, new ISimpleOperationCallback<MtbColt>() {
this.mEntityRESTConsumer.processEntity(mtbColtToSaveClone, new ISimpleOperationCallback<>() {
@Override
public void onSuccess(MtbColt value) {
if (onComplete != null) onComplete.run(value);
@@ -280,13 +289,13 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
}
public void getBySSCC(String ssccString, boolean onlyResiduo, boolean throwExcIfNull, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
colliMagazzinoRESTConsumerService.getColloByBarcode(ssccString, onlyResiduo, throwExcIfNull).enqueue(new Callback<>() {
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
colliMagazzinoRESTConsumerService.getColloByBarcode(ssccString, onlyResiduo, throwExcIfNull).enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<MtbColt>> call, Response<ServiceRESTResponse<MtbColt>> response) {
analyzeAnswer(response, "GetBySSCC", mtbColt -> {
if (mtbColt != null && mtbColt.getMtbColr() != null && mtbColt.getMtbColr().size() > 0) {
if (mtbColt != null && mtbColt.getMtbColr() != null && !mtbColt.getMtbColr().isEmpty()) {
List<MtbColt> mtbColtList = new ArrayList<>();
mtbColtList.add(mtbColt);
fillMtbAartsOfMtbColts(mtbColtList, mtbColts -> onComplete.run(mtbColts.get(0)), onFailed);
@@ -298,40 +307,69 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
}
@Override
public void onFailure(Call<ServiceRESTResponse<MtbColt>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<MtbColt>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
public void fillMtbAartsOfMtbColts(List<MtbColt> mtbColts, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
fillMtbAartsOfMtbColtsStatic(mtbColts, onComplete, onFailed);
public void fillMtbAartsOfMtbColrs(List<MtbColr> mtbColrs, RunnableArgs<List<MtbColr>> onComplete, RunnableArgs<Exception> onFailed) {
List<String> codMarts = new ArrayList<>(mtbColrs.stream()
.map(MtbColr::getCodMart)
.filter(Objects::nonNull)
.distinct()
.collect(Collectors.toUnmodifiableList()));
mArticoloRESTConsumer.getByCodMarts(codMarts, arts -> {
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);
}
}
onComplete.run(mtbColrs);
}, onFailed);
}
public static void fillMtbAartsOfMtbColtsStatic(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<>();
for (MtbColt mtbColt : mtbColts) {
codMarts.addAll(Stream.of(mtbColt.getMtbColr())
codMarts.addAll(mtbColt.getMtbColr().stream()
.map(MtbColr::getCodMart)
.withoutNulls()
.filter(Objects::nonNull)
.distinct()
.toList());
.collect(Collectors.toUnmodifiableList()));
}
ArticoloRESTConsumer.getByCodMartsStatic(codMarts, arts -> {
mArticoloRESTConsumer.getByCodMarts(codMarts, arts -> {
if (arts != null && arts.size() > 0) {
if (arts != null && !arts.isEmpty()) {
for (MtbColt mtbColt : mtbColts) {
for (MtbColr mtbColr : mtbColt.getMtbColr()) {
MtbAart foundMtbAart = null;
List<MtbAart> mtbAartStream = Stream.of(arts)
.filter(x -> x.getCodMart().equalsIgnoreCase(mtbColr.getCodMart())).toList();
List<MtbAart> mtbAartStream = arts.stream()
.filter(x -> x.getCodMart().equalsIgnoreCase(mtbColr.getCodMart()))
.collect(Collectors.toList());
if (mtbAartStream != null && mtbAartStream.size() > 0) {
if (!mtbAartStream.isEmpty()) {
foundMtbAart = mtbAartStream.get(0);
}
@@ -380,35 +418,32 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
testata.setMtbColr(new ObservableArrayList<>());
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
colliMagazzinoRESTConsumerService.getColloInGiac(onlyResiduo, throwExcIfNull, testata).enqueue(new Callback<ServiceRESTResponse<MtbColt>>() {
@Override
public void onResponse(Call<ServiceRESTResponse<MtbColt>> call, Response<ServiceRESTResponse<MtbColt>> response) {
analyzeAnswer(response, "getColloInGiac", mtbColt -> {
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
colliMagazzinoRESTConsumerService.getColloInGiac(onlyResiduo, throwExcIfNull, testata)
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<MtbColt>> call, Response<ServiceRESTResponse<MtbColt>> response) {
analyzeAnswer(response, "getColloInGiac", mtbColt -> {
if (mtbColt != null && mtbColt.getMtbColr() != null && mtbColt.getMtbColr().size() > 0) {
List<MtbColt> mtbColtList = new ArrayList<>();
mtbColtList.add(mtbColt);
fillMtbAartsOfMtbColts(mtbColtList, mtbColts -> onComplete.run(mtbColts.get(0)), onFailed);
} else {
onComplete.run(mtbColt);
if (mtbColt != null && mtbColt.getMtbColr() != null && !mtbColt.getMtbColr().isEmpty()) {
List<MtbColt> mtbColtList = new ArrayList<>();
mtbColtList.add(mtbColt);
fillMtbAartsOfMtbColts(mtbColtList, mtbColts -> onComplete.run(mtbColts.get(0)), onFailed);
} else {
onComplete.run(mtbColt);
}
}, onFailed);
}
}, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<MtbColt>> call, Throwable t) {
onFailed.run(new Exception(t));
}
});
@Override
public void onFailure(Call<ServiceRESTResponse<MtbColt>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
public void changePosizione(MtbColt mtbColtToMove, MtbDepoPosizione posizione, Runnable onComplete, RunnableArgs<Exception> onFailed) {
String codMdep = posizione.getCodMdep();
String posizioneString = posizione.getPosizione();
public void spostaUL(MtbColt mtbColtToMove, String codMdep, String posizione, boolean createDocAutomatically, Runnable onComplete, RunnableArgs<Exception> onFailed) {
MtbColt mtbColtToMoveClone = (MtbColt) mtbColtToMove.clone();
for (int i = 0; i < mtbColtToMoveClone.getMtbColr().size(); i++) {
@@ -417,26 +452,66 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
.setMtbPartitaMag(null);
}
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
SpostaULRequestDTO spostaUlRequestDTO = new SpostaULRequestDTO()
.setCodMdep(codMdep)
.setPosizione(posizione)
.setMtbColtsToMove(Collections.singletonList(mtbColtToMoveClone))
.setCreateDocAutomatically(createDocAutomatically);
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
colliMagazzinoRESTConsumerService
.spostaULInPosizione(codMdep,
posizioneString,
mtbColtToMoveClone)
.enqueue(new Callback<ServiceRESTResponse<Object>>() {
.spostaUL(spostaUlRequestDTO)
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) {
analyzeAnswer(response, "changePosizione", mtbColts -> {
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
analyzeAnswer(response, "spostaUL", mtbColts -> {
onComplete.run();
}, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<Object>> call, Throwable t) {
if (onFailed != null) onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) {
if (onFailed != null) onFailed.run(e);
}
});
}
public void spostaUL(MtbColt mtbColtToMove, MtbDepoPosizione posizione, Runnable onComplete, RunnableArgs<Exception> onFailed) {
String codMdep = posizione.getCodMdep();
String posizioneString = posizione.getPosizione();
spostaUL(mtbColtToMove, codMdep, posizioneString, true, onComplete, onFailed);
}
public void updateTipoUL(MtbColt mtbColt, String codTcol, Runnable onComplete, RunnableArgs<Exception> onFailed) {
MtbColt mtbColtClone = (MtbColt) mtbColt.clone();
mtbColtClone.setMtbColr(new ObservableArrayList<>());
UpdateTipoULRequestDTO updateTipoULRequest = new UpdateTipoULRequestDTO()
.setMtbColt(mtbColtClone)
.setCodTcol(codTcol);
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
colliMagazzinoRESTConsumerService
.updateTipoUL(updateTipoULRequest)
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
analyzeAnswer(response, "updateTipoUL", mtbColts -> {
onComplete.run();
}, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) {
if (onFailed != null) onFailed.run(e);
}
});
}
public void updateDataFine(MtbColt mtbColt, Runnable onComplete, RunnableArgs<Exception> onFailed) {
MtbColt cloneMtbColt = (MtbColt) mtbColt.clone();
@@ -453,19 +528,19 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
}
public static void retrieveBasketColli(RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
colliMagazzinoRESTConsumerService.getColliInBasket(SettingsManager.i().getUserSession().getDepo().getCodMdep()).enqueue(new Callback<ServiceRESTResponse<List<MtbColt>>>() {
public void retrieveBasketColli(RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
colliMagazzinoRESTConsumerService.getColliInBasket(SettingsManager.i().getUserSession().getDepo().getCodMdep()).enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<List<MtbColt>>> call, Response<ServiceRESTResponse<List<MtbColt>>> response) {
analyzeAnswer(response, "getColliInBasket", mtbColts -> {
fillMtbAartsOfMtbColtsStatic(mtbColts, onComplete, onFailed);
fillMtbAartsOfMtbColts(mtbColts, onComplete, onFailed);
}, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<List<MtbColt>>> call, Throwable t) {
if (onFailed != null) onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<List<MtbColt>>> call, @NonNull final Exception e) {
if (onFailed != null) onFailed.run(e);
}
});
}
@@ -480,24 +555,24 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
.setNewNumCnf(newNumCnf)
.setNewQtaCol(newQtaTot);
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
colliMagazzinoRESTConsumerService.creaRettificaCollo(
SettingsManager.i().getUserSession().getDepo().getCodMdep(),
rettificaULDTO
).enqueue(new Callback<>() {
).enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<MtbColr>> call, Response<ServiceRESTResponse<MtbColr>> response) {
analyzeAnswer(response, "creaRettificaCollo", onComplete, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<MtbColr>> call, Throwable t) {
if (onFailed != null) onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<MtbColr>> call, @NonNull final Exception e) {
if (onFailed != null) onFailed.run(e);
}
});
}
public void spostaArtsTraUL(MtbColt sourceMtbColt, MtbColt destMtbColt, Runnable onComplete, RunnableArgs<Exception> onFailed) {
public void spostaArtsTraUL(MtbColt sourceMtbColt, MtbColt destMtbColt, boolean flagForceUseRefs, RunnableArgs<List<MtbColr>> onComplete, RunnableArgs<Exception> onFailed) {
new Thread(() -> {
MtbColt mtbColtToMoveClone = (MtbColt) sourceMtbColt.clone();
MtbColt mtbColtDestClone = (MtbColt) destMtbColt.clone();
@@ -512,20 +587,23 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
SpostaArtsTraULRequestDTO spostaArtsTraULRequestDTO = new SpostaArtsTraULRequestDTO()
.setSourceMtbColt(mtbColtToMoveClone)
.setDestinationMtbColt(mtbColtDestClone);
.setDestinationMtbColt(mtbColtDestClone)
.setFlagForceUseRefs(flagForceUseRefs);
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
colliMagazzinoRESTConsumerService.spostaArtsTraUL(spostaArtsTraULRequestDTO).enqueue(new Callback<>() {
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
colliMagazzinoRESTConsumerService.spostaArtsTraUL(spostaArtsTraULRequestDTO).enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) {
public void onResponse(Call<ServiceRESTResponse<SpostaArtsTraULResponseDTO>> call, Response<ServiceRESTResponse<SpostaArtsTraULResponseDTO>> response) {
analyzeAnswer(response, "spostaArtsTraUL", data -> {
onComplete.run();
fillMtbAartsOfMtbColrs(data.getGeneratedMtbColr(), onComplete, onFailed);
}, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<Object>> call, Throwable t) {
if (onFailed != null) onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<SpostaArtsTraULResponseDTO>> call, @NonNull final Exception e) {
if (onFailed != null) onFailed.run(e);
}
});
}).start();
@@ -540,8 +618,8 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
.setMtbPartitaMag(null);
}
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
colliMagazzinoRESTConsumerService.assegnaLottoSuColloScarico(sourceMtbColtClone).enqueue(new Callback<>() {
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
colliMagazzinoRESTConsumerService.assegnaLottoSuColloScarico(sourceMtbColtClone).enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<MtbColt>> call, Response<ServiceRESTResponse<MtbColt>> response) {
analyzeAnswer(response, "assegnaLottoSuColloScarico", data -> {
@@ -550,8 +628,8 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
}
@Override
public void onFailure(Call<ServiceRESTResponse<MtbColt>> call, Throwable t) {
if (onFailed != null) onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<MtbColt>> call, @NonNull final Exception e) {
if (onFailed != null) onFailed.run(e);
}
});
}
@@ -565,8 +643,8 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
.setMtbPartitaMag(null);
}
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
colliMagazzinoRESTConsumerService.versamentoAutomaticoUL(sourceMtbColtClone).enqueue(new Callback<>() {
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
colliMagazzinoRESTConsumerService.versamentoAutomaticoUL(sourceMtbColtClone).enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<VersamentoAutomaticoULResponseDTO>> call, Response<ServiceRESTResponse<VersamentoAutomaticoULResponseDTO>> response) {
analyzeAnswer(response, "versamentoAutomaticoUL", data -> {
@@ -603,8 +681,8 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
}
@Override
public void onFailure(Call<ServiceRESTResponse<VersamentoAutomaticoULResponseDTO>> call, Throwable t) {
if (onFailed != null) onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<VersamentoAutomaticoULResponseDTO>> call, @NonNull final Exception e) {
if (onFailed != null) onFailed.run(e);
}
});
}
@@ -613,8 +691,8 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
MtbColt sourceMtbColtClone = (MtbColt) sourceMtbColt.clone();
sourceMtbColtClone.setMtbColr(new ObservableArrayList<>());
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
colliMagazzinoRESTConsumerService.confirmGiacenzaUL(sourceMtbColtClone).enqueue(new Callback<>() {
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
colliMagazzinoRESTConsumerService.confirmGiacenzaUL(sourceMtbColtClone).enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) {
analyzeAnswer(response, "confirmGiacenzaUL", data -> {
@@ -624,8 +702,8 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
}
@Override
public void onFailure(Call<ServiceRESTResponse<Object>> call, Throwable t) {
if (onFailed != null) onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<Object>> call, @NonNull final Exception e) {
if (onFailed != null) onFailed.run(e);
}
});
}
@@ -661,36 +739,36 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
CanULBeDeletedRequestDTO canULBeDeletedRequestDTO = new CanULBeDeletedRequestDTO()
.setMtbColt(mtbColt);
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
colliMagazzinoRESTConsumerService.canULBeDeleted(canULBeDeletedRequestDTO)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Boolean>> call, Response<ServiceRESTResponse<Boolean>> response) {
analyzeAnswer(response, "generic/canULBeDeleted", onComplete, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<Boolean>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<Boolean>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
public void deleteUL(DeleteULRequestDTO deleteULRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
colliMagazzinoRESTConsumerService.deleteUL(deleteULRequestDTO)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
analyzeAnswer(response, "generic/deleteUL", Void -> onComplete.run(), onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<Void>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
@@ -702,18 +780,18 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
return;
}
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
colliMagazzinoRESTConsumerService.printUL(printULRequestDTO)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
analyzeAnswer(response, "generic/printUL", Void -> onComplete.run(), onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<Void>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});

View File

@@ -7,6 +7,9 @@ import it.integry.integrywmsnative.core.model.MtbColt;
import it.integry.integrywmsnative.core.rest.model.RettificaULDTO;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
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.UpdateTipoULRequestDTO;
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.DeleteULRequestDTO;
@@ -31,11 +34,14 @@ public interface ColliMagazzinoRESTConsumerService {
@POST("creaRettificaCollo")
Call<ServiceRESTResponse<MtbColr>> creaRettificaCollo(@Query("codMdep") String codMdep, @Body RettificaULDTO rettificaULDTO);
@POST("wms/spostaULInPosizione")
Call<ServiceRESTResponse<Object>> spostaULInPosizione(@Query("codMdep") String codMdep, @Query("posizione") String posizione, @Body MtbColt mtbColtToMove);
@POST("wms/updateTipoUL")
Call<ServiceRESTResponse<Void>> updateTipoUL(@Body UpdateTipoULRequestDTO requestDto);
@POST("wms/spostaUL")
Call<ServiceRESTResponse<Void>> spostaUL(@Body SpostaULRequestDTO requestDto);
@POST("wms/spostaArtsTraUL")
Call<ServiceRESTResponse<Object>> spostaArtsTraUL(@Body SpostaArtsTraULRequestDTO spostaArtsTraULRequestDTO);
Call<ServiceRESTResponse<SpostaArtsTraULResponseDTO>> spostaArtsTraUL(@Body SpostaArtsTraULRequestDTO spostaArtsTraULRequestDTO);
@POST("wms/assegnaLottoSuColloScarico")
Call<ServiceRESTResponse<MtbColt>> assegnaLottoSuColloScarico(@Body MtbColt mtbColt);

View File

@@ -9,6 +9,7 @@ import it.integry.integrywmsnative.core.model.MtbColr;
import it.integry.integrywmsnative.core.model.MtbColt;
import it.integry.integrywmsnative.core.rest.RESTBuilder;
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.uds.CloseUDSRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSResponseDTO;
@@ -22,113 +23,117 @@ 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.InsertUDSRowResponseDTO;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
@Singleton
public class ColliSpedizioneRESTConsumer extends _BaseRESTConsumer implements ColliScaricoRESTConsumerInterface {
private final RESTBuilder restBuilder;
public ColliSpedizioneRESTConsumer(RESTBuilder restBuilder) {
this.restBuilder = restBuilder;
}
public void createUDS(CreateUDSRequestDTO createUDSRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = RESTBuilder.getService(ColliSpedizioneRESTConsumerService.class);
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = restBuilder.getService(ColliSpedizioneRESTConsumerService.class);
colliSpedizioneRESTConsumerService.createUDS(createUDSRequestDTO)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@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, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<CreateUDSResponseDTO>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
public void closeUDS(CloseUDSRequestDTO closeUDSRequestDTO, RunnableArgs<CloseUDSResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = RESTBuilder.getService(ColliSpedizioneRESTConsumerService.class);
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = restBuilder.getService(ColliSpedizioneRESTConsumerService.class);
colliSpedizioneRESTConsumerService.closeUDS(closeUDSRequestDTO)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@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, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<CloseUDSResponseDTO>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
public void insertUDSRow(InsertUDSRowRequestDTO insertUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = RESTBuilder.getService(ColliSpedizioneRESTConsumerService.class);
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = restBuilder.getService(ColliSpedizioneRESTConsumerService.class);
colliSpedizioneRESTConsumerService.insertUDSRow(insertUDSRowRequestDTO)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<InsertUDSRowResponseDTO>> call, Response<ServiceRESTResponse<InsertUDSRowResponseDTO>> response) {
analyzeAnswer(response, "spedizione/insertUDSRow", data -> onComplete.run(data.getSavedMtbColr()), onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<InsertUDSRowResponseDTO>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<InsertUDSRowResponseDTO>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
public void editUDSRow(EditUDSRowRequestDTO editUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = RESTBuilder.getService(ColliSpedizioneRESTConsumerService.class);
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = restBuilder.getService(ColliSpedizioneRESTConsumerService.class);
colliSpedizioneRESTConsumerService.editUDSRow(editUDSRowRequestDTO)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<EditUDSRowResponseDTO>> call, Response<ServiceRESTResponse<EditUDSRowResponseDTO>> response) {
analyzeAnswer(response, "spedizione/editUDSRow", data -> onComplete.run(data.getSavedMtbColr()), onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<EditUDSRowResponseDTO>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<EditUDSRowResponseDTO>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
public void deleteUDSRow(DeleteUDSRowRequestDTO deleteUDSRowRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = RESTBuilder.getService(ColliSpedizioneRESTConsumerService.class);
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = restBuilder.getService(ColliSpedizioneRESTConsumerService.class);
colliSpedizioneRESTConsumerService.deleteUDSRow(deleteUDSRowRequestDTO)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@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, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
public void duplicateUDS(DuplicateUDSRequestDTO duplicateUDSRequestDTO, RunnableArgs<DuplicateUDSResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = RESTBuilder.getService(ColliSpedizioneRESTConsumerService.class);
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = restBuilder.getService(ColliSpedizioneRESTConsumerService.class);
colliSpedizioneRESTConsumerService.duplicateUDS(duplicateUDSRequestDTO)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(@NonNull Call<ServiceRESTResponse<DuplicateUDSResponseDTO>> call, @NonNull Response<ServiceRESTResponse<DuplicateUDSResponseDTO>> response) {
analyzeAnswer(response, "spedizione/duplicateUDS", onComplete, onFailed);
}
@Override
public void onFailure(@NonNull Call<ServiceRESTResponse<DuplicateUDSResponseDTO>> call, @NonNull Throwable t) {
public void onFailure(@NonNull Call<ServiceRESTResponse<DuplicateUDSResponseDTO>> call, @NonNull final Exception e) {
onFailed.run(new Exception());
}
});

View File

@@ -1,12 +1,12 @@
package it.integry.integrywmsnative.core.rest.consumers;
import com.annimon.stream.Stream;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.stream.Collectors;
import javax.inject.Singleton;
@@ -26,15 +26,15 @@ public class CommessaRESTConsumer extends _BaseRESTConsumer {
public void getJtbComts(List<String> itemsToFind, RunnableArgs<List<JtbComt>> onComplete, RunnableArgs<Exception> onFailed) {
var whereCondMap = Stream.of(itemsToFind)
.withoutNulls()
var whereCondMap = itemsToFind.stream()
.filter(x -> !UtilityString.isNullOrEmpty(x))
.map(x -> {
HashMap<String, Object> vars = new HashMap<>();
vars.put("cod_jcom", x);
return vars;
HashMap<String, Object> codJcom = new HashMap<>() {{
put("cod_jcom", x);
}};
return codJcom;
})
.toList();
.collect(Collectors.toUnmodifiableList());
if(whereCondMap.isEmpty()) {
onComplete.run(new ArrayList<>());

View File

@@ -2,7 +2,6 @@ package it.integry.integrywmsnative.core.rest.consumers;
import androidx.annotation.NonNull;
import java.util.Date;
import java.util.List;
import javax.inject.Singleton;
@@ -10,75 +9,80 @@ import javax.inject.Singleton;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.model.DtbDoct;
import it.integry.integrywmsnative.core.rest.RESTBuilder;
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
import it.integry.integrywmsnative.core.rest.model.LoadColliDTO;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import it.integry.integrywmsnative.core.rest.model.documento.RetrieveDocumentoArtsResponseDTO;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
@Singleton
public class DocumentRESTConsumer extends _BaseRESTConsumer {
private final RESTBuilder restBuilder;
public DocumentRESTConsumer(RESTBuilder restBuilder) {
this.restBuilder = restBuilder;
}
public void createDocsFromColli(List<LoadColliDTO> listColli, RunnableArgs<List<DtbDoct>> onComplete, RunnableArgs<Exception> onFailed) {
DocumentiRESTConsumerService documentiRESTConsumerService = RESTBuilder.getService(DocumentiRESTConsumerService.class);
documentiRESTConsumerService.createDocsFromColli(listColli).enqueue(new Callback<>() {
DocumentiRESTConsumerService documentiRESTConsumerService = restBuilder.getService(DocumentiRESTConsumerService.class);
documentiRESTConsumerService.createDocsFromColli(listColli).enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<List<DtbDoct>>> call, Response<ServiceRESTResponse<List<DtbDoct>>> response) {
analyzeAnswer(response, "createDocsFromColli", onComplete, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<List<DtbDoct>>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<List<DtbDoct>>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
public void createDocFromColli(LoadColliDTO loadColliDTO, RunnableArgs<DtbDoct> onComplete, RunnableArgs<Exception> onFailed) {
DocumentiRESTConsumerService documentiRESTConsumerService = RESTBuilder.getService(DocumentiRESTConsumerService.class);
documentiRESTConsumerService.createDocFromColli(loadColliDTO).enqueue(new Callback<>() {
DocumentiRESTConsumerService documentiRESTConsumerService = restBuilder.getService(DocumentiRESTConsumerService.class);
documentiRESTConsumerService.createDocFromColli(loadColliDTO).enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<DtbDoct>> call, Response<ServiceRESTResponse<DtbDoct>> response) {
analyzeAnswer(response, "createDocFromColli", onComplete, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<DtbDoct>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<DtbDoct>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
public void checkFrumaDocument(String fornitore, String numDoc, String dataDoc, RunnableArgs<Boolean> onComplete, RunnableArgs<Exception> onFailed) {
var inventarioRESTConsumerService = RESTBuilder.getService(DocumentiRESTConsumerService.class);
inventarioRESTConsumerService.checkFrumaDoc(fornitore, numDoc, dataDoc)
.enqueue(new Callback<>() {
public void checkDocument(String fornitore, String numDoc, String dataDoc, String tipoDoc, RunnableArgs<Boolean> onComplete, RunnableArgs<Exception> onFailed) {
var inventarioRESTConsumerService = restBuilder.getService(DocumentiRESTConsumerService.class);
inventarioRESTConsumerService.checkDocument(fornitore, numDoc,tipoDoc, dataDoc)
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(@NonNull Call<ServiceRESTResponse<Boolean>> call, @NonNull Response<ServiceRESTResponse<Boolean>> response) {
analyzeAnswer(response, "checkDocument", onComplete, onFailed);
}
@Override
public void onFailure(@NonNull Call<ServiceRESTResponse<Boolean>> call, @NonNull Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(@NonNull Call<ServiceRESTResponse<Boolean>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
public void loadDocumentAvailableArts(String codDtip, String codMgrp, String codAnagForn, RunnableArgs<RetrieveDocumentoArtsResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
var inventarioRESTConsumerService = RESTBuilder.getService(DocumentiRESTConsumerService.class);
var inventarioRESTConsumerService = restBuilder.getService(DocumentiRESTConsumerService.class);
inventarioRESTConsumerService.retrieveArts(codDtip, codMgrp, codAnagForn)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(@NonNull Call<ServiceRESTResponse<RetrieveDocumentoArtsResponseDTO>> call, @NonNull Response<ServiceRESTResponse<RetrieveDocumentoArtsResponseDTO>> response) {
analyzeAnswer(response, "loadDocumentoArts", onComplete, onFailed);
}
@Override
public void onFailure(@NonNull Call<ServiceRESTResponse<RetrieveDocumentoArtsResponseDTO>> call, @NonNull Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(@NonNull Call<ServiceRESTResponse<RetrieveDocumentoArtsResponseDTO>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}

View File

@@ -1,6 +1,5 @@
package it.integry.integrywmsnative.core.rest.consumers;
import java.util.Date;
import java.util.List;
import it.integry.integrywmsnative.core.model.DtbDoct;
@@ -21,10 +20,11 @@ public interface DocumentiRESTConsumerService {
@POST("createDocFromColli")
Call<ServiceRESTResponse<DtbDoct>> createDocFromColli(@Body LoadColliDTO listColli);
@GET("wms/documento/checkFruma")
Call<ServiceRESTResponse<Boolean>> checkFrumaDoc(
@GET("wms/documento/checkDoc")
Call<ServiceRESTResponse<Boolean>> checkDocument(
@Query("fornitore") String fornitore,
@Query("numDoc") String numDoc,
@Query("tipoDoc") String tipoDoc,
@Query("dataDoc") String dataDoc);
@GET("wms/documento/arts")

View File

@@ -2,6 +2,8 @@ package it.integry.integrywmsnative.core.rest.consumers;
import android.util.Log;
import androidx.annotation.NonNull;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
@@ -13,16 +15,21 @@ import javax.inject.Singleton;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.model.EntityBase;
import it.integry.integrywmsnative.core.rest.RESTBuilder;
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
import it.integry.integrywmsnative.core.rest.model.EsitoType;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import it.integry.integrywmsnative.core.utility.UtilityGson;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
@Singleton
public class EntityRESTConsumer extends _BaseRESTConsumer {
private final RESTBuilder restBuilder;
public EntityRESTConsumer(RESTBuilder restBuilder) {
this.restBuilder = restBuilder;
}
public <T extends EntityBase> void processEntity(T entityToSave, final ISimpleOperationCallback<T> callback, Class<T> type) {
@@ -30,10 +37,10 @@ public class EntityRESTConsumer extends _BaseRESTConsumer {
if (callback != null) callback.onFailed(ex);
};
EntityRESTConsumerService service = RESTBuilder.getService(EntityRESTConsumerService.class);
EntityRESTConsumerService service = restBuilder.getService(EntityRESTConsumerService.class);
service
.processEntity(entityToSave)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<JsonObject>> call, Response<ServiceRESTResponse<JsonObject>> response) {
if (response.isSuccessful()) {
@@ -59,9 +66,8 @@ public class EntityRESTConsumer extends _BaseRESTConsumer {
}
@Override
public void onFailure(Call<ServiceRESTResponse<JsonObject>> call, Throwable t) {
Log.e("EntityRESTConsumer", t.toString());
tmpFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<JsonObject>> call, @NonNull final Exception e) {
tmpFailed.run(e);
}
});
@@ -74,9 +80,9 @@ public class EntityRESTConsumer extends _BaseRESTConsumer {
if (onFailed != null) onFailed.run(ex);
};
EntityRESTConsumerService service = RESTBuilder.getService(EntityRESTConsumerService.class);
EntityRESTConsumerService service = restBuilder.getService(EntityRESTConsumerService.class);
Call<List<ServiceRESTResponse<JsonObject>>> request = service.processEntityList(singleTransaction, entitiesToSave);
request.enqueue(new Callback<>() {
request.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<List<ServiceRESTResponse<JsonObject>>> call, Response<List<ServiceRESTResponse<JsonObject>>> response) {
if (response.isSuccessful()) {
@@ -112,9 +118,8 @@ public class EntityRESTConsumer extends _BaseRESTConsumer {
}
@Override
public void onFailure(Call<List<ServiceRESTResponse<JsonObject>>> call, Throwable t) {
Log.e("EntityRESTConsumer", t.toString());
tmpFailed.run(new Exception(t));
public void onFailure(Call<List<ServiceRESTResponse<JsonObject>>> call, @NonNull final Exception e) {
tmpFailed.run(e);
}
});
@@ -124,9 +129,9 @@ public class EntityRESTConsumer extends _BaseRESTConsumer {
@Deprecated
public <T extends EntityBase> void selectEntity(T entityToSave, final ISimpleOperationCallback<List<T>> callback, Class type) {
EntityRESTConsumerService service = RESTBuilder.getService(EntityRESTConsumerService.class);
EntityRESTConsumerService service = restBuilder.getService(EntityRESTConsumerService.class);
Call<ServiceRESTResponse<JsonObject>> request = service.processEntity(entityToSave);
request.enqueue(new Callback<>() {
request.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<JsonObject>> call, Response<ServiceRESTResponse<JsonObject>> response) {
if (response.isSuccessful()) {
@@ -136,7 +141,7 @@ public class EntityRESTConsumer extends _BaseRESTConsumer {
Gson gson = UtilityGson.createObject();
List<JsonObject> jsons = response.body().getEntityList();
List<T> newList = new ArrayList<T>();
List<T> newList = new ArrayList<>();
if (jsons != null) {
for (int i = 0; i < jsons.size(); i++) {
@@ -163,9 +168,8 @@ public class EntityRESTConsumer extends _BaseRESTConsumer {
}
@Override
public void onFailure(Call<ServiceRESTResponse<JsonObject>> call, Throwable t) {
Log.e("EntityRESTConsumer", t.toString());
callback.onFailed(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<JsonObject>> call, @NonNull final Exception e) {
callback.onFailed(e);
}
});

View File

@@ -1,6 +1,6 @@
package it.integry.integrywmsnative.core.rest.consumers;
import android.util.Log;
import androidx.annotation.NonNull;
import java.util.List;
import java.util.stream.Collectors;
@@ -10,32 +10,35 @@ import javax.inject.Singleton;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.model.StbGestSetup;
import it.integry.integrywmsnative.core.rest.RESTBuilder;
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
import it.integry.integrywmsnative.core.rest.model.GestSetupDTO;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import it.integry.integrywmsnative.core.settings.StbGestSetupReader;
import it.integry.integrywmsnative.core.utility.UtilityLogger;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
@Singleton
public class GestSetupRESTConsumer extends _BaseRESTConsumer {
private final RESTBuilder restBuilder;
public GestSetupRESTConsumer(RESTBuilder restBuilder) {
this.restBuilder = restBuilder;
}
public void getValue(String gestName, String sectionName, String keySection, RunnableArgs<GestSetupDTO> onComplete, RunnableArgs<Exception> onFailed) {
GestSetupRESTConsumerService service = RESTBuilder.getService(GestSetupRESTConsumerService.class);
GestSetupRESTConsumerService service = restBuilder.getService(GestSetupRESTConsumerService.class);
service.getGestSetupValue(gestName, sectionName, keySection)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<GestSetupDTO>> call, Response<ServiceRESTResponse<GestSetupDTO>> response) {
analyzeAnswer(response, "GestSetup", onComplete, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<GestSetupDTO>> call, Throwable t) {
Log.e("GestSetup", t.toString());
// UtilityLogger.errorMe(new Exception(t));
if (onFailed != null) onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<GestSetupDTO>> call, @NonNull final Exception e) {
if (onFailed != null) onFailed.run(e);
}
});
}
@@ -51,18 +54,16 @@ public class GestSetupRESTConsumer extends _BaseRESTConsumer {
}
public void getValue(String gestName, String sectionName, String keySection, String codMdep, RunnableArgs<GestSetupDTO> onComplete, RunnableArgs<Exception> onFailed) {
GestSetupRESTConsumerService service = RESTBuilder.getService(GestSetupRESTConsumerService.class);
service.getGestSetupValue(gestName, sectionName, keySection, codMdep).enqueue(new Callback<ServiceRESTResponse<GestSetupDTO>>() {
GestSetupRESTConsumerService service = restBuilder.getService(GestSetupRESTConsumerService.class);
service.getGestSetupValue(gestName, sectionName, keySection, codMdep).enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<GestSetupDTO>> call, Response<ServiceRESTResponse<GestSetupDTO>> response) {
analyzeAnswer(response, "GestSetup", onComplete, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<GestSetupDTO>> call, Throwable t) {
Log.e("PrintCollo", t.toString());
UtilityLogger.error(new Exception(t));
if (onFailed != null) onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<GestSetupDTO>> call, @NonNull final Exception e) {
if (onFailed != null) onFailed.run(e);
}
});
}
@@ -81,8 +82,8 @@ public class GestSetupRESTConsumer extends _BaseRESTConsumer {
public void getValues(String codMdep, List<StbGestSetupReader> stbGestSetupList, RunnableArgs<List<StbGestSetupReader>> onComplete, RunnableArgs<Exception> onFailed) {
var stbGestSetups = stbGestSetupList.stream().map(x -> (StbGestSetup) x).collect(Collectors.toList());
GestSetupRESTConsumerService service = RESTBuilder.getService(GestSetupRESTConsumerService.class);
service.getGestSetupValues(codMdep, stbGestSetups).enqueue(new Callback<>() {
GestSetupRESTConsumerService service = restBuilder.getService(GestSetupRESTConsumerService.class);
service.getGestSetupValues(codMdep, stbGestSetups).enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<List<StbGestSetup>>> call, Response<ServiceRESTResponse<List<StbGestSetup>>> response) {
analyzeAnswer(response, "GestSetup", data -> {
@@ -100,9 +101,8 @@ public class GestSetupRESTConsumer extends _BaseRESTConsumer {
}
@Override
public void onFailure(Call<ServiceRESTResponse<List<StbGestSetup>>> call, Throwable t) {
UtilityLogger.error(new Exception(t));
if (onFailed != null) onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<List<StbGestSetup>>> call, @NonNull final Exception e) {
if (onFailed != null) onFailed.run(e);
}
});
}

View File

@@ -0,0 +1,41 @@
package it.integry.integrywmsnative.core.rest.consumers;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutorService;
import it.integry.integrywmsnative.core.rest.RESTBuilder;
import it.integry.integrywmsnative.core.rest.model.pv.GiacenzaPvDTO;
import it.integry.integrywmsnative.core.rest.model.pv.SaveNewVerificaRequestDTO;
public class GiacenzaPvRESTConsumer extends _BaseRESTConsumer {
private final RESTBuilder restBuilder;
private final ExecutorService executorService;
public GiacenzaPvRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService) {
this.restBuilder = restBuilder;
this.executorService = executorService;
}
public List<GiacenzaPvDTO> retrieveGiacenzeSynchronized(String codMdep) throws Exception {
GiacenzaPvRESTConsumerService giacenzaPvRESTConsumerService = restBuilder.getService(GiacenzaPvRESTConsumerService.class, 120);
var response = giacenzaPvRESTConsumerService.retrieve(codMdep)
.execute();
var giacenzeList = analyzeAnswer(response, "retrieve-giacenze-pv");
return giacenzeList != null ? giacenzeList : new ArrayList<>();
}
public void saveNewVerificaSynchronized(SaveNewVerificaRequestDTO saveNewVerificaRequest) throws Exception {
GiacenzaPvRESTConsumerService giacenzaPvRESTConsumerService = restBuilder.getService(GiacenzaPvRESTConsumerService.class, 0);
var response = giacenzaPvRESTConsumerService.saveNewVerifica(saveNewVerificaRequest)
.execute();
analyzeAnswer(response, "save-verifica-pv");
}
}

View File

@@ -0,0 +1,22 @@
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.pv.GiacenzaPvDTO;
import it.integry.integrywmsnative.core.rest.model.pv.SaveNewVerificaRequestDTO;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Query;
public interface GiacenzaPvRESTConsumerService {
@GET("giacenza/retrieve")
Call<ServiceRESTResponse<List<GiacenzaPvDTO>>> retrieve(@Query("codMdep") String codMdep);
@POST("wms/pv/verifica_giacenze/save_new_verifica")
Call<ServiceRESTResponse<Void>> saveNewVerifica(@Body SaveNewVerificaRequestDTO saveNewVerificaRequest);
}

View File

@@ -1,10 +1,14 @@
package it.integry.integrywmsnative.core.rest.consumers;
import androidx.annotation.NonNull;
import com.annimon.stream.Optional;
import com.annimon.stream.Stream;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.stream.Collectors;
import javax.inject.Singleton;
@@ -13,70 +17,75 @@ import it.integry.integrywmsnative.core.model.MtbAart;
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
import it.integry.integrywmsnative.core.model.MvwSitArtUdcDetInventario;
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.rest.model.giacenza.InstantItemSituationIncomingItemDto;
import it.integry.integrywmsnative.core.rest.model.giacenza.InstantItemSituationResponseDto;
import it.integry.integrywmsnative.core.utility.UtilityString;
import it.integry.integrywmsnative.gest.prod_riposizionamento_da_prod.dto.ArtsInGiacenzaDTO;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
@Singleton
public class GiacenzaRESTConsumer extends _BaseRESTConsumer {
private final RESTBuilder restBuilder;
private final ExecutorService executorService;
private final ArticoloRESTConsumer mArticoloRESTConsumer;
public GiacenzaRESTConsumer(ArticoloRESTConsumer articoloRESTConsumer) {
public GiacenzaRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService, ArticoloRESTConsumer articoloRESTConsumer) {
this.restBuilder = restBuilder;
this.executorService = executorService;
this.mArticoloRESTConsumer = articoloRESTConsumer;
}
public void getGiacenzeInPosizione(MtbDepoPosizione posizione, RunnableArgs<List<MvwSitArtUdcDetInventario>> onComplete, RunnableArgs<Exception> onFailed) {
GiacenzaRESTConsumerService giacenzaRESTConsumerService = RESTBuilder.getService(GiacenzaRESTConsumerService.class);
giacenzaRESTConsumerService.retrieveAvailableItems(posizione.getPosizione()).enqueue(new Callback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<List<MvwSitArtUdcDetInventario>>> call, Response<ServiceRESTResponse<List<MvwSitArtUdcDetInventario>>> response) {
analyzeAnswer(response, "getGiacenzeInPosizione", inventarioList -> {
public List<MvwSitArtUdcDetInventario> getGiacenzeInPosizioneSynchronized(MtbDepoPosizione posizione) throws Exception {
GiacenzaRESTConsumerService giacenzaRESTConsumerService = restBuilder.getService(GiacenzaRESTConsumerService.class);
var response = giacenzaRESTConsumerService.retrieveAvailableItems(posizione.getPosizione())
.execute();
if(inventarioList != null && !inventarioList.isEmpty()){
List<String> codMarts = Stream.of(inventarioList)
.map(x -> x.getCodMart().trim())
.toList();
var inventarioList = analyzeAnswer(response, "getGiacenzeInPosizione");
mArticoloRESTConsumer.getByCodMarts(codMarts, mtbAarts -> {
for (var row : inventarioList) {
if (inventarioList != null && !inventarioList.isEmpty()) {
List<String> codMarts = inventarioList.stream()
.map(x -> x.getCodMart().trim())
.collect(Collectors.toList());
MtbAart foundMtbAart = null;
Optional<MtbAart> mtbAartOpt = Stream.of(mtbAarts)
.filter(x -> x.getCodMart().equalsIgnoreCase(row.getCodMart()))
.findFirst();
var mtbAarts = mArticoloRESTConsumer.getByCodMartsSynchronized(codMarts);
for (var row : inventarioList) {
MtbAart foundMtbAart = null;
Optional<MtbAart> mtbAartOpt = Stream.of(mtbAarts)
.filter(x -> x.getCodMart().equalsIgnoreCase(row.getCodMart()))
.findFirst();
if (mtbAartOpt.isPresent()) {
foundMtbAart = mtbAartOpt.get();
}
if (mtbAartOpt.isPresent()) {
foundMtbAart = mtbAartOpt.get();
}
row.setMtbAart(foundMtbAart);
}
onComplete.run(inventarioList);
}, onFailed);
}else{
onComplete.run(new ArrayList<>());
}
}, onFailed);
row.setMtbAart(foundMtbAart);
}
@Override
public void onFailure(Call<ServiceRESTResponse<List<MvwSitArtUdcDetInventario>>> call, Throwable t) {
onFailed.run(new Exception(t));
return inventarioList;
}
return new ArrayList<>();
}
public void getGiacenzeInPosizione(MtbDepoPosizione posizione, RunnableArgs<List<MvwSitArtUdcDetInventario>> onComplete, RunnableArgs<Exception> onFailed) {
executorService.execute(() -> {
try {
var result = getGiacenzeInPosizioneSynchronized(posizione);
if (onComplete != null) onComplete.run(result);
} catch (Exception ex) {
if (onFailed != null) onFailed.run(ex);
}
});
}
public void getGiacenzeInPosizione(List<String> posizioni, boolean withTestataCollo, RunnableArgs<List<ArtsInGiacenzaDTO>> onComplete, RunnableArgs<Exception> onFailed) {
GiacenzaRESTConsumerService giacenzaRESTConsumerService = RESTBuilder.getService(GiacenzaRESTConsumerService.class);
giacenzaRESTConsumerService.retrieveAvailableItems(posizioni, withTestataCollo).enqueue(new Callback<>() {
GiacenzaRESTConsumerService giacenzaRESTConsumerService = restBuilder.getService(GiacenzaRESTConsumerService.class);
giacenzaRESTConsumerService.retrieveAvailableItems(posizioni, withTestataCollo).enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<List<ArtsInGiacenzaDTO>>> call, Response<ServiceRESTResponse<List<ArtsInGiacenzaDTO>>> response) {
analyzeAnswer(response, "getGiacenzeInPosizione", inventarioList -> {
@@ -88,8 +97,8 @@ public class GiacenzaRESTConsumer extends _BaseRESTConsumer {
mArticoloRESTConsumer.getByCodMarts(codMarts, mtbAarts -> {
for (var articoli : inventarioList) {
List<MvwSitArtUdcDetInventario> mvwSitArtUdcDetInventario = articoli.getMvwSitArtUdcDetInventarioDTO();
if (mvwSitArtUdcDetInventario != null && !mvwSitArtUdcDetInventario.isEmpty()){
for (var row : mvwSitArtUdcDetInventario){
if (mvwSitArtUdcDetInventario != null && !mvwSitArtUdcDetInventario.isEmpty()) {
for (var row : mvwSitArtUdcDetInventario) {
MtbAart foundMtbAart = null;
Optional<MtbAart> mtbAartOpt = Stream.of(mtbAarts)
.filter(x -> x.getCodMart().equalsIgnoreCase(row.getCodMart()))
@@ -110,19 +119,19 @@ public class GiacenzaRESTConsumer extends _BaseRESTConsumer {
}
@Override
public void onFailure(Call<ServiceRESTResponse<List<ArtsInGiacenzaDTO>>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<List<ArtsInGiacenzaDTO>>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
public void getGiacenzeByArticolo(String codMart, String partitaMag, RunnableArgs<List<MvwSitArtUdcDetInventario>> onComplete, RunnableArgs<Exception> onFailed) {
GiacenzaRESTConsumerService giacenzaRESTConsumerService = RESTBuilder.getService(GiacenzaRESTConsumerService.class);
GiacenzaRESTConsumerService giacenzaRESTConsumerService = restBuilder.getService(GiacenzaRESTConsumerService.class);
var serviceRESTResponseCall =
UtilityString.isNullOrEmpty(partitaMag) ?
giacenzaRESTConsumerService.retrieveAvailableItemsByArt(codMart) :
giacenzaRESTConsumerService.retrieveAvailableItemsByArt(codMart, partitaMag);
serviceRESTResponseCall.enqueue(new Callback<>() {
serviceRESTResponseCall.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<List<MvwSitArtUdcDetInventario>>> call, Response<ServiceRESTResponse<List<MvwSitArtUdcDetInventario>>> response) {
analyzeAnswer(response, "getGiacenzeByArticolo", inventarioList -> {
@@ -153,18 +162,18 @@ public class GiacenzaRESTConsumer extends _BaseRESTConsumer {
}
@Override
public void onFailure(Call<ServiceRESTResponse<List<MvwSitArtUdcDetInventario>>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<List<MvwSitArtUdcDetInventario>>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
public void getInstantItemSituation(String codMdep, String codMart, String partitaMag, String codJcom, RunnableArgs<InstantItemSituationResponseDto> onComplete, RunnableArgs<Exception> onFailed) {
GiacenzaRESTConsumerService giacenzaRESTConsumerService = RESTBuilder.getService(GiacenzaRESTConsumerService.class);
GiacenzaRESTConsumerService giacenzaRESTConsumerService = restBuilder.getService(GiacenzaRESTConsumerService.class);
giacenzaRESTConsumerService.retrieveInstantItemSituation(codMdep, codMart, partitaMag, codJcom)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<InstantItemSituationResponseDto>> call, Response<ServiceRESTResponse<InstantItemSituationResponseDto>> response) {
analyzeAnswer(response, "getInstantItemSituation", data -> {
@@ -174,8 +183,8 @@ public class GiacenzaRESTConsumer extends _BaseRESTConsumer {
}
@Override
public void onFailure(Call<ServiceRESTResponse<InstantItemSituationResponseDto>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<InstantItemSituationResponseDto>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}

View File

@@ -2,9 +2,7 @@ package it.integry.integrywmsnative.core.rest.consumers;
import java.util.List;
import it.integry.integrywmsnative.core.model.DtbDoct;
import it.integry.integrywmsnative.core.model.MvwSitArtUdcDetInventario;
import it.integry.integrywmsnative.core.rest.model.LoadColliDTO;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import it.integry.integrywmsnative.core.rest.model.giacenza.InstantItemSituationResponseDto;
import it.integry.integrywmsnative.gest.prod_riposizionamento_da_prod.dto.ArtsInGiacenzaDTO;

View File

@@ -1,5 +1,6 @@
package it.integry.integrywmsnative.core.rest.consumers;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutorService;
@@ -7,6 +8,8 @@ import javax.inject.Singleton;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.model.MtbTCol;
import it.integry.integrywmsnative.core.model.mapper.MtbTcolMapper;
import it.integry.integrywmsnative.core.model.observable.ObservableMtbTcol;
import it.integry.integrywmsnative.core.rest.RESTBuilder;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import it.integry.integrywmsnative.core.rest.model.imballi.ImballoQuantityDTO;
@@ -17,25 +20,29 @@ import retrofit2.Response;
@Singleton
public class ImballiRESTConsumer extends _BaseRESTConsumer {
private final RESTBuilder restBuilder;
private final ExecutorService executorService;
public ImballiRESTConsumer(ExecutorService executorService) {
public ImballiRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService) {
this.restBuilder = restBuilder;
this.executorService = executorService;
}
public List<MtbTCol> retrieveTipiColloSyncronized(MtbTCol.FlagUiUlEnum tipoImballo) throws Exception {
ImballiRESTConsumerService service = RESTBuilder.getService(ImballiRESTConsumerService.class);
Response<ServiceRESTResponse<List<MtbTCol>>> response = service.retrieveTipiCollo(tipoImballo)
public List<ObservableMtbTcol> retrieveImballiSyncronized(MtbTCol.FlagUiUlEnum tipoImballo) throws Exception {
ImballiRESTConsumerService service = restBuilder.getService(ImballiRESTConsumerService.class);
Response<ServiceRESTResponse<List<MtbTCol>>> response = service.retrieveImballi(tipoImballo)
.execute();
return analyzeAnswer(response, "retrieveTipiCollo");
List<MtbTCol> retrieveTipiCollo = analyzeAnswer(response, "retrieveTipiCollo");
retrieveTipiCollo = retrieveTipiCollo == null ? new ArrayList<>() : retrieveTipiCollo;
return MtbTcolMapper.fromDTOList(retrieveTipiCollo);
}
public void retrieveTipiCollo(MtbTCol.FlagUiUlEnum tipoImballo, RunnableArgs<List<MtbTCol>> onComplete, RunnableArgs<Exception> onFailed) {
public void retrieveImballi(MtbTCol.FlagUiUlEnum tipoImballo, RunnableArgs<List<ObservableMtbTcol>> onComplete, RunnableArgs<Exception> onFailed) {
executorService.execute(() -> {
try {
var response = retrieveTipiColloSyncronized(tipoImballo);
var response = retrieveImballiSyncronized(tipoImballo);
if (onComplete != null) onComplete.run(response);
} catch (Exception ex) {
if (onFailed != null) onFailed.run(ex);
@@ -45,7 +52,7 @@ public class ImballiRESTConsumer extends _BaseRESTConsumer {
public void registraCaricoSyncronized(String codAnag, List<ImballoQuantityDTO> imballi) throws Exception {
ImballiRESTConsumerService service = RESTBuilder.getService(ImballiRESTConsumerService.class);
ImballiRESTConsumerService service = restBuilder.getService(ImballiRESTConsumerService.class);
Response<ServiceRESTResponse<Void>> response = service.registraCarico(
new RegistraCaricoImballiRequestDTO()
.setCodAnag(codAnag)
@@ -68,7 +75,7 @@ public class ImballiRESTConsumer extends _BaseRESTConsumer {
public void registraScaricoSyncronized(String codVettore, List<ImballoQuantityDTO> imballi) throws Exception {
ImballiRESTConsumerService service = RESTBuilder.getService(ImballiRESTConsumerService.class);
ImballiRESTConsumerService service = restBuilder.getService(ImballiRESTConsumerService.class);
Response<ServiceRESTResponse<Void>> response = service.registraScarico(
new RegistraScaricoImballiRequestDTO()
.setCodVettore(codVettore)

View File

@@ -16,7 +16,7 @@ public interface ImballiRESTConsumerService {
@GET("wms/imballi/retrieve/{tipo}")
Call<ServiceRESTResponse<List<MtbTCol>>> retrieveTipiCollo(@Path("tipo") MtbTCol.FlagUiUlEnum tipo);
Call<ServiceRESTResponse<List<MtbTCol>>> retrieveImballi(@Path("tipo") MtbTCol.FlagUiUlEnum tipo);
@POST("wms/imballi/registraCarico")
Call<ServiceRESTResponse<Void>> registraCarico(@Body RegistraCaricoImballiRequestDTO registraCaricoImballiRequest);

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