Compare commits

...

185 Commits

Author SHA1 Message Date
ddc038add4 Finish v1.23.3(258) 2022-02-17 11:44:20 +01:00
f037617dd9 -> v1.23.3 (258) 2022-02-17 11:44:17 +01:00
84cff70567 aggiunto controllo su testate ordini per approvvigionamento da lavorazione 2022-02-17 11:43:33 +01:00
8a1b3a1b00 aggiunto controllo sulla qta ordinata nulla per rettifica giacenze 2022-02-17 11:43:04 +01:00
f11a81ef05 gestita where cond in caso di filtro null 2022-02-17 11:42:27 +01:00
eb8595e247 Finish v1.23.2(257) 2022-02-16 13:01:33 +01:00
85520b937f Finish v1.23.2(257) 2022-02-16 13:01:33 +01:00
ec5bee558c -> v1.23.2 (257) 2022-02-16 13:01:25 +01:00
857295d92b corretta conversione date string da query 2022-02-16 13:00:10 +01:00
4da2c43251 Merge remote-tracking branch 'origin/develop' into develop 2022-02-14 17:47:36 +01:00
fc1681d111 Implementato messaggio info extra in DialogInputQuantity (attualmente mostra un testo Human Readable delle quantità da prelevare). 2022-02-14 17:18:35 +01:00
692a350128 Aggiunta ricerca barcode articolo con conversione da 8 a 13 caratteri 2022-02-14 15:44:50 +01:00
47f29899a2 Aggiornate librerie google 2022-02-14 12:43:45 +01:00
a0dfd20110 Update AGP 7.1.1 2022-02-14 12:17:34 +01:00
92aadad5cb aggiunto controllo data scadenza
nascosta input tipo collo in accettazione se non ci sono tipi collo configurati
2022-02-14 11:37:24 +01:00
52092e7e9c GRAMM visualizzato peso articolo 2022-02-08 18:17:24 +01:00
ecfb8faf01 vg aggiunta possibilità di selezionare il tipo pedana in accettazione e visulizzati dettagli peso 2022-02-08 10:42:32 +01:00
e5dd4b15f4 Finish v1.23.1(256) 2022-02-08 10:38:43 +01:00
6e070285e3 Finish v1.23.1(256) 2022-02-08 10:38:43 +01:00
d13cdf63c2 -> v1.23.1 (256) 2022-02-08 10:38:36 +01:00
c3884774e1 corretto filtro in dialogChooseArts e aggiunta possibilità di aprirlo con filtro già attivo 2022-02-08 10:37:37 +01:00
983b70821a Finish v1.23.0(255) 2022-02-03 12:05:11 +01:00
8e60aa0249 Finish v1.23.0(255) 2022-02-03 12:05:11 +01:00
69962781aa -> v1.23.0 (255) 2022-02-03 12:05:06 +01:00
a921b83c1f unifificata gestione etichette posizioni in picking libero e rettifica giacenze 2022-02-03 12:03:17 +01:00
ea8be0559a [carelli - docInterni]
aggiunti dati al DTO di sincronizzazione
[MAGGIO - Picking libero]
Aggiunta possibilità di aprire la posizione definita in anagrafica articolo scansionando l'ean13 dello stesso
2022-02-02 17:01:41 +01:00
66f117186c Piccoli fix su doc interni 2022-01-28 10:23:46 +01:00
4ff39009d2 Finish v1.22.0(254) 2022-01-25 11:15:21 +01:00
981a42cd7e Finish v1.22.0(254) 2022-01-25 11:15:20 +01:00
062938d0e4 -> v1.22.0 (254) 2022-01-25 11:15:15 +01:00
cc7044c7de Tanto vario 2022-01-25 11:14:15 +01:00
7d771bf39b Implementato suggerimento della posizione (da mtb_aart) 2022-01-07 18:09:37 +01:00
3261aa7c41 Creati chips per filtro in picking accettazione 2022-01-07 16:16:01 +01:00
d79c13b370 Aggiunto cod_mart in caso di mancanza cod_art_forn 2022-01-07 10:56:41 +01:00
55c1cb40a2 Refactoring login 2022-01-04 15:06:35 +01:00
d570ab7e3d Finish v1.21.1(253) 2021-12-30 17:32:01 +01:00
e3ebfcb27d Finish v1.21.1(253) 2021-12-30 17:32:01 +01:00
2230dade45 -> v1.21.1 (253) 2021-12-30 17:31:39 +01:00
637e46b868 Rimosso datetime da MtbCols 2021-12-30 17:30:58 +01:00
473d5d1a5a Finish v1.21.0(252) 2021-12-28 11:21:37 +01:00
c37f4d62a4 Finish v1.21.0(252) 2021-12-28 11:21:36 +01:00
b8ac75ed6d -> v1.21.0 (252) 2021-12-28 11:21:31 +01:00
df9d3a80ac completata gestione documenti interni
Aggiunti campi complementari in generazione ordini di acquisto
restyling dialog ordini di acquisto
2021-12-28 11:20:02 +01:00
6aacaef720 Finish v1.20.4(251) 2021-12-02 17:09:31 +01:00
1fab62187f Finish v1.20.4(251) 2021-12-02 17:09:31 +01:00
0c4d0f2b59 -> v1.20.4 (251) 2021-12-02 17:09:27 +01:00
dbf183c7c6 Bug fix: in versamento meteriale a produzione la quantità residuo dopo ripartizionamento viene aggiunta due volte 2021-12-02 17:08:43 +01:00
42649cd5bb Finish v1.20.3(250) 2021-11-26 17:47:56 +01:00
1f1a8f75de Finish v1.20.3(250) 2021-11-26 17:47:56 +01:00
5215d43bf4 -> v1.20.3 (250) 2021-11-26 17:47:51 +01:00
d2f262a9b8 Merge remote-tracking branch 'origin/develop' into develop 2021-11-26 17:46:58 +01:00
1fc78d053b Aggiunto codice menu su Rientro merce 2021-11-26 17:46:55 +01:00
016be4799c Merge remote-tracking branch 'origin/develop' into develop 2021-11-26 17:46:40 +01:00
e837132996 Corretta aggiunta quantità di scarto sull'ordine maggiore in versamento merce a produzione (frudis) 2021-11-26 17:46:33 +01:00
925760720d Finish v1.20.2(249) 2021-11-26 16:40:35 +01:00
2e872c23aa Finish v1.20.2(249) 2021-11-26 16:40:34 +01:00
7a62c8855f -> v1.20.2 (249) 2021-11-26 16:40:31 +01:00
c1da07b23c Fix finestra caricamento in Spedizione 2021-11-26 16:39:54 +01:00
ba7e2a6d61 Finish v1.20.1(248) 2021-11-26 10:32:36 +01:00
e798db1427 Finish v1.20.1(248) 2021-11-26 10:32:35 +01:00
a79dee3574 -> v1.20.1 (248) 2021-11-26 10:32:26 +01:00
4f753399bf Merge remote-tracking branch 'origin/develop' into develop 2021-11-26 10:31:40 +01:00
80842e49e5 Migliorata gestione errori in versamento merce 2021-11-26 10:31:33 +01:00
2eac741bbb Finish v1.20.0(247) 2021-11-22 18:22:36 +01:00
c3e2a2a8fd Finish v1.20.0(247) 2021-11-22 18:22:36 +01:00
99f0691c55 -> v1.20.0 (247) 2021-11-22 18:22:31 +01:00
37ebd96a0f Gestione Documenti interni di carelli 2021-11-22 18:20:59 +01:00
c012c54805 Finish v1.19.5(246) 2021-11-12 16:33:47 +01:00
9de6dcce80 Finish v1.19.5(246) 2021-11-12 16:33:46 +01:00
fc403ec419 -> v1.19.5 (246) 2021-11-12 16:33:41 +01:00
4968f2f4fa Aggiunto ordinamento (da customizzareper azienda) sui filtri in spedizione 2021-11-12 16:32:18 +01:00
a7ea9b9022 Finish v1.19.4(245) 2021-11-12 11:32:57 +01:00
28a034f0d6 Finish v1.19.4(245) 2021-11-12 11:32:57 +01:00
ca3f1f5962 -> v1.19.4 (245) 2021-11-12 11:32:48 +01:00
4117e69278 risolto problema filtro non considerato in ritorno su lista filtrata dopo aver eseguito il picking 2021-11-12 11:31:34 +01:00
18ff1e2345 Finish v1.19.3(244) 2021-11-11 19:58:38 +01:00
37e3024220 Finish v1.19.3(244) 2021-11-11 19:58:37 +01:00
ed35ea6894 -> v1.19.3 (244) 2021-11-11 19:58:32 +01:00
bd28db7422 Corretti nuovi filtri 2021-11-11 19:56:43 +01:00
9beea9f2e9 corretto filtro tramite barcode scanner sugli ordini di spedizione
corretto refresh filtro testuale in accettazione
2021-11-11 19:37:01 +01:00
205af60edb Finish v1.19.2(243) 2021-11-11 13:41:18 +01:00
21f9a9819a Finish v1.19.2(243) 2021-11-11 13:41:17 +01:00
4059335e61 -> v1.19.2 (243) 2021-11-11 13:41:12 +01:00
14252f0f4b Fix su gestione in accettazione da ordine di lavorazione 2021-11-11 13:40:11 +01:00
c13eee355e Merge remote-tracking branch 'origin/develop' into develop 2021-11-11 13:19:51 +01:00
51528fda6f fix Menu 2021-11-11 13:19:31 +01:00
1486d39eb8 Finish v1.19.1(242) 2021-11-11 13:09:41 +01:00
1951d8e2a4 Finish v1.19.1(242) 2021-11-11 13:09:40 +01:00
420fdf6b4c -> v1.19.1 (242) 2021-11-11 13:09:31 +01:00
a14a593e4f Aggiunta ricerca nei filtri in vendita 2021-11-11 13:08:38 +01:00
5d7ffa02c4 Finish v1.19.0(241) 2021-11-09 13:14:07 +01:00
4942807104 Finish v1.19.0(241) 2021-11-09 13:14:06 +01:00
20dafb1250 -> v1.19.0 (241) 2021-11-09 13:13:57 +01:00
eb0746de0c Creato nuovo filtro per gli ordini in uscita. 2021-11-09 13:11:47 +01:00
2e255e0c47 Merge remote-tracking branch 'origin/develop' into develop 2021-10-26 12:32:14 +02:00
6baebda5e1 Rimosse eccezioni interne da Firebase 2021-10-26 12:32:08 +02:00
8f943829ec Finish v1.18.10(240) 2021-10-21 13:10:40 +02:00
bd19d8c1a2 Finish v1.18.10(240) 2021-10-21 13:10:39 +02:00
3e79d0a07a -> 1.18.10 (240) 2021-10-21 13:10:29 +02:00
d2111e36ee Risolto bug progress dialog in ordini acquisto pv 2021-10-21 13:09:21 +02:00
47a1ab8223 Finish v1.8.9(239) 2021-10-14 17:17:12 +02:00
45df794280 Finish v1.8.9(239) 2021-10-14 17:17:12 +02:00
7a9bd15cfa -> v1.18.9 (239) 2021-10-14 17:16:52 +02:00
f902439086 Implementato nuovo servizio di printEtichettaSSCC 2021-10-14 17:16:04 +02:00
e7334d358b Finish v1.8.8(238) 2021-10-13 16:16:03 +02:00
262986f02c Finish v1.8.8(238) 2021-10-13 16:16:02 +02:00
76188aa792 -> v1.18.8 (238) 2021-10-13 16:15:57 +02:00
eb67d2fc65 Fix su controllo fake giacenza 2021-10-13 16:15:20 +02:00
6e176c0b7f Finish v1.18.7(237) 2021-10-11 19:09:20 +02:00
83b2327247 Finish v1.18.7(237) 2021-10-11 19:09:20 +02:00
7605c4d70a -> v1.18.7 (237) 2021-10-11 19:09:11 +02:00
5a8935675c Riduzione caratteri usati nel filtro_ordini 2021-10-11 19:08:11 +02:00
1645fba77c Finish v1.18.6(236) 2021-10-07 10:53:32 +02:00
6929a386db Finish v1.18.6(236) 2021-10-07 10:53:32 +02:00
93c3350cb2 -> v1.18.6 (236) 2021-10-07 10:53:26 +02:00
2b97faaa65 Fix su decimali nel caso di FlagDig 2021-10-07 10:52:44 +02:00
9260379c5f Invalidata la cache del menu durante il logout 2021-09-30 15:23:54 +02:00
35e7fd60be Finish v1.18.5(235) 2021-09-30 13:35:49 +02:00
1bbe5818f8 Finish v1.18.5(235) 2021-09-30 13:35:48 +02:00
65d372c04c -> v1.18.5 (235) 2021-09-30 13:35:42 +02:00
be1c5ecd0b Sistemato caricamento menu laterale (Drawer) 2021-09-30 13:35:09 +02:00
30e16fb765 Finish v1.18.4(234) 2021-09-27 19:08:16 +02:00
effff99e9a Finish v1.18.4(234) 2021-09-27 19:08:15 +02:00
c40bb8d7b0 -> v1.18.4 (234) 2021-09-27 19:08:08 +02:00
a7063c70eb Invertito boolean di fakeGiacenza in Spedizione 2021-09-27 19:07:03 +02:00
512f5b0de3 Finish v1.18.3(233) 2021-09-27 12:50:13 +02:00
e306c28723 Finish v1.18.3(233) 2021-09-27 12:50:12 +02:00
f361701ad9 -> v1.18.3 (233) 2021-09-27 12:50:05 +02:00
aa00c440b0 Fix su qta_cnf in Fabbisogno linee prod 2021-09-27 12:49:24 +02:00
df2a566322 Finish v1.8.2(232) 2021-09-27 10:53:59 +02:00
eb83f8babb Finish v1.8.2(232) 2021-09-27 10:53:59 +02:00
e21946fe23 -> v1.18.2 (232) 2021-09-27 10:53:51 +02:00
30b5053a22 Risolto controllo su UL e CodArt in AddExtraItems 2021-09-27 10:53:06 +02:00
914618cfeb Finish v1.8.1(231) 2021-09-27 10:28:33 +02:00
53ebf6ff14 Finish v1.8.1(231) 2021-09-27 10:28:33 +02:00
34c2065041 -> v1.18.1 (231) 2021-09-27 10:28:26 +02:00
db7ceedb4a Rimosso controllo errato su ean128 2021-09-27 10:27:54 +02:00
1ef70c4f3a Sistemato arrotondamento decimali in fase di picking uscita 2021-09-24 12:12:37 +02:00
e1eae00e01 Finish v1.18.0(230) 2021-09-23 11:44:29 +02:00
f8533daeed Finish v1.18.0(230) 2021-09-23 11:44:28 +02:00
ff4d71e616 -> v1.18.0 (230) 2021-09-23 11:44:22 +02:00
8015961054 Finish MenuRefactoring 2021-09-23 11:42:02 +02:00
a9164109da Fix su refMtbColr 2021-09-23 11:41:32 +02:00
4a884b92ad Sistemata libreria Honeywell 2021-09-15 19:15:30 +02:00
6f15169157 Vario ed eliminazione delle personalizzazioni non più necessarie 2021-09-15 18:56:52 +02:00
eb99c9d8cf Aggiunto controllo su data scadenza < oggi 2021-09-10 12:22:04 +02:00
0cc31a4a8e Implementato controllo su barcode UL/Articolo in fase di add extra item. 2021-09-09 16:49:40 +02:00
a6664102db Vario 2021-09-02 09:56:15 +02:00
eaeef05e64 Vario 2021-08-12 11:02:50 +02:00
98b6a32126 Rename 2021-08-11 15:20:42 +02:00
fcddda8e3f Refactoring di Versamento e Recupero materiale produzione 2021-08-11 15:19:35 +02:00
9033548455 Refactoring dialog filtro accettazione ordini produzione 2021-08-06 15:35:25 +02:00
18b4b08e1b Refactoring accettazione ordini produzione 2021-08-06 13:30:03 +02:00
627d3646a6 Refactoring activity lista bancali 2021-08-06 11:37:26 +02:00
8d87970a75 Renaming 2021-08-06 10:22:48 +02:00
ea6b26e00f Refactoring activity contenuto bancale 2021-08-05 19:11:44 +02:00
624a880ad5 Refactoring main list accettazione 2021-08-05 18:24:50 +02:00
fbcda5eaf6 Implementato servizio di retrieve menu 2021-08-05 15:25:06 +02:00
fbe095b7f7 Refactoring splash screen 2021-08-05 13:07:05 +02:00
d4bd92ec90 Finish v1.17.9(229) 2021-07-26 11:52:29 +02:00
c3ee5519b4 Finish v1.17.9(229) 2021-07-26 11:52:28 +02:00
1394725286 -> v1.17.9 (928) 2021-07-26 11:52:22 +02:00
b4cf8f629c Implementato Assegna lotto su collo scarico 2021-07-26 11:42:21 +02:00
ec49384b58 Finish v1.17.8(228) 2021-07-21 17:49:30 +02:00
0404863e3d Finish v1.17.8(228) 2021-07-21 17:49:29 +02:00
b71d627f99 -> v1.17.8 (228) 2021-07-21 17:49:24 +02:00
403541c8e0 Fix su background color del DialogInputQuantity 2021-07-21 17:48:51 +02:00
f1e2a3a536 Finish v1.17.7(227) 2021-07-20 18:31:33 +02:00
23bb284cff Finish v1.17.7(227) 2021-07-20 18:31:32 +02:00
449955f182 -> v1.17.7 (227) 2021-07-20 18:31:27 +02:00
15d3b1858a Migliorie a Rientro Merce 2021-07-20 18:30:57 +02:00
cfb3acc33d Finish v1.17.6(226) 2021-07-20 13:07:07 +02:00
61768fb2d0 Finish v1.17.6(226) 2021-07-20 13:07:06 +02:00
d782e8667a -> v1.17.6 (226) 2021-07-20 13:07:01 +02:00
e3d366b7a5 Fix su rendering in Rientro Merce da produzione 2021-07-20 13:06:17 +02:00
c64112835b Merge tag 'v.1.17.5(225)' into develop
Finish v.1.17.5(225)
2021-07-20 12:01:09 +02:00
7ebc5de620 Finish v.1.17.5(225) 2021-07-20 12:01:08 +02:00
aa93dc489e -> 1.17.5 (225) 2021-07-20 12:00:58 +02:00
6c1be3a7bc Finish v1.7.4(224) 2021-07-20 10:31:34 +02:00
18593c7fa0 Merge branch 'master' into develop 2021-07-20 10:31:34 +02:00
3a6b87ba47 -> v1.7.4 (224) 2021-07-20 10:31:28 +02:00
95ee04fc2a Finish v1.17.4(223) 2021-07-20 10:01:54 +02:00
1d3113ce2e Merge branch 'master' into develop 2021-07-20 10:01:54 +02:00
ef3bac3b0b Revert build gradle 2021-07-20 10:01:47 +02:00
d5f590bfda Finish v1.17.4(222) 2021-07-19 19:17:58 +02:00
537 changed files with 25287 additions and 10809 deletions

1
.idea/.gitignore generated vendored Normal file
View File

@@ -0,0 +1 @@
/saveactions_settings.xml

16
.idea/deploymentTargetDropDown.xml generated Normal file
View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="deploymentTargetDropDown">
<runningDeviceTargetsSelectedWithDialog>
<Target>
<type value="RUNNING_DEVICE_TARGET" />
<deviceKey>
<Key>
<type value="SERIAL_NUMBER" />
<value value="20119B1E55" />
</Key>
</deviceKey>
</Target>
</runningDeviceTargetsSelectedWithDialog>
</component>
</project>

View File

@@ -1,13 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
</set>
</option>
</component>
</project>

View File

@@ -1,60 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="app_agricoper" type="AndroidRunConfigurationType" factoryName="Android App" activateToolWindowBeforeRun="false">
<module name="WMS_Native.app" />
<option name="DEPLOY" value="true" />
<option name="DEPLOY_APK_FROM_BUNDLE" value="false" />
<option name="DEPLOY_AS_INSTANT" value="false" />
<option name="ARTIFACT_NAME" value="" />
<option name="PM_INSTALL_OPTIONS" value="" />
<option name="ALL_USERS" value="false" />
<option name="ALWAYS_INSTALL_WITH_PM" value="false" />
<option name="DYNAMIC_FEATURES_DISABLED_LIST" value="WMS_Native.dynamic__base,WMS_Native.dynamic_frudis,WMS_Native.dynamic_gramm,WMS_Native.dynamic_ime,WMS_Native.dynamic_saporiveri,WMS_Native.dynamic_saporiveri_pv,WMS_Native.dynamic_vgalimenti,dynamic__base,dynamic_gramm,dynamic_ime,dynamic_saporiveri,dynamic_saporiveri_pv,dynamic_vgalimenti" />
<option name="ACTIVITY_EXTRA_FLAGS" value="" />
<option name="MODE" value="default_activity" />
<option name="CLEAR_LOGCAT" value="true" />
<option name="SHOW_LOGCAT_AUTOMATICALLY" value="true" />
<option name="SKIP_NOOP_APK_INSTALLATIONS" value="true" />
<option name="FORCE_STOP_RUNNING_APP" value="true" />
<option name="TARGET_SELECTION_MODE" value="SHOW_DIALOG" />
<option name="SELECTED_CLOUD_MATRIX_CONFIGURATION_ID" value="-1" />
<option name="SELECTED_CLOUD_MATRIX_PROJECT_ID" value="" />
<option name="DEBUGGER_TYPE" value="Auto" />
<Auto>
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
<option name="SHOW_STATIC_VARS" value="true" />
<option name="WORKING_DIR" value="" />
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
</Auto>
<Hybrid>
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
<option name="SHOW_STATIC_VARS" value="true" />
<option name="WORKING_DIR" value="" />
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
</Hybrid>
<Java />
<Native>
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
<option name="SHOW_STATIC_VARS" value="true" />
<option name="WORKING_DIR" value="" />
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
</Native>
<Profilers>
<option name="ADVANCED_PROFILING_ENABLED" value="true" />
<option name="STARTUP_PROFILING_ENABLED" value="false" />
<option name="STARTUP_CPU_PROFILING_ENABLED" value="false" />
<option name="STARTUP_CPU_PROFILING_CONFIGURATION_NAME" value="Sample Java Methods" />
<option name="STARTUP_NATIVE_MEMORY_PROFILING_ENABLED" value="false" />
<option name="NATIVE_MEMORY_SAMPLE_RATE_BYTES" value="2048" />
</Profilers>
<option name="DEEP_LINK" value="" />
<option name="ACTIVITY_CLASS" value="" />
<option name="SEARCH_ACTIVITY_IN_GLOBAL_SCOPE" value="false" />
<option name="SKIP_ACTIVITY_VALIDATION" value="false" />
<method v="2">
<option name="Android.Gradle.BeforeRunTask" enabled="true" />
</method>
</configuration>
</component>

View File

@@ -1,6 +1,6 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="app_base" type="AndroidRunConfigurationType" factoryName="Android App" activateToolWindowBeforeRun="false">
<module name="WMS_Native.app" />
<module name="WMS.app" />
<option name="DEPLOY" value="true" />
<option name="DEPLOY_APK_FROM_BUNDLE" value="false" />
<option name="DEPLOY_AS_INSTANT" value="false" />
@@ -8,7 +8,7 @@
<option name="PM_INSTALL_OPTIONS" value="" />
<option name="ALL_USERS" value="false" />
<option name="ALWAYS_INSTALL_WITH_PM" value="false" />
<option name="DYNAMIC_FEATURES_DISABLED_LIST" value="WMS_Native.dynamic_agricoper,WMS_Native.dynamic_frudis,WMS_Native.dynamic_gramm,WMS_Native.dynamic_ime,WMS_Native.dynamic_saporiveri,WMS_Native.dynamic_saporiveri_pv,WMS_Native.dynamic_vgalimenti,dynamic_frudis,dynamic_gramm,dynamic_ime,dynamic_saporiveri,dynamic_saporiveri_pv,dynamic_vgalimenti" />
<option name="DYNAMIC_FEATURES_DISABLED_LIST" value="WMS.dynamic_vgalimenti" />
<option name="ACTIVITY_EXTRA_FLAGS" value="" />
<option name="MODE" value="default_activity" />
<option name="CLEAR_LOGCAT" value="true" />

View File

@@ -1,60 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="app_frudis" type="AndroidRunConfigurationType" factoryName="Android App" activateToolWindowBeforeRun="false">
<module name="WMS_Native.app" />
<option name="DEPLOY" value="true" />
<option name="DEPLOY_APK_FROM_BUNDLE" value="false" />
<option name="DEPLOY_AS_INSTANT" value="false" />
<option name="ARTIFACT_NAME" value="" />
<option name="PM_INSTALL_OPTIONS" value="" />
<option name="ALL_USERS" value="false" />
<option name="ALWAYS_INSTALL_WITH_PM" value="false" />
<option name="DYNAMIC_FEATURES_DISABLED_LIST" value="WMS_Native.dynamic__base,WMS_Native.dynamic_agricoper,WMS_Native.dynamic_gramm,WMS_Native.dynamic_ime,WMS_Native.dynamic_saporiveri,WMS_Native.dynamic_saporiveri_pv,WMS_Native.dynamic_vgalimenti,dynamic__base,dynamic_gramm,dynamic_ime,dynamic_saporiveri,dynamic_saporiveri_pv,dynamic_vgalimenti" />
<option name="ACTIVITY_EXTRA_FLAGS" value="" />
<option name="MODE" value="default_activity" />
<option name="CLEAR_LOGCAT" value="true" />
<option name="SHOW_LOGCAT_AUTOMATICALLY" value="true" />
<option name="SKIP_NOOP_APK_INSTALLATIONS" value="true" />
<option name="FORCE_STOP_RUNNING_APP" value="true" />
<option name="TARGET_SELECTION_MODE" value="SHOW_DIALOG" />
<option name="SELECTED_CLOUD_MATRIX_CONFIGURATION_ID" value="-1" />
<option name="SELECTED_CLOUD_MATRIX_PROJECT_ID" value="" />
<option name="DEBUGGER_TYPE" value="Auto" />
<Auto>
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
<option name="SHOW_STATIC_VARS" value="true" />
<option name="WORKING_DIR" value="" />
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
</Auto>
<Hybrid>
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
<option name="SHOW_STATIC_VARS" value="true" />
<option name="WORKING_DIR" value="" />
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
</Hybrid>
<Java />
<Native>
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
<option name="SHOW_STATIC_VARS" value="true" />
<option name="WORKING_DIR" value="" />
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
</Native>
<Profilers>
<option name="ADVANCED_PROFILING_ENABLED" value="true" />
<option name="STARTUP_PROFILING_ENABLED" value="false" />
<option name="STARTUP_CPU_PROFILING_ENABLED" value="false" />
<option name="STARTUP_CPU_PROFILING_CONFIGURATION_NAME" value="Sample Java Methods" />
<option name="STARTUP_NATIVE_MEMORY_PROFILING_ENABLED" value="false" />
<option name="NATIVE_MEMORY_SAMPLE_RATE_BYTES" value="2048" />
</Profilers>
<option name="DEEP_LINK" value="" />
<option name="ACTIVITY_CLASS" value="" />
<option name="SEARCH_ACTIVITY_IN_GLOBAL_SCOPE" value="false" />
<option name="SKIP_ACTIVITY_VALIDATION" value="false" />
<method v="2">
<option name="Android.Gradle.BeforeRunTask" enabled="true" />
</method>
</configuration>
</component>

View File

@@ -1,60 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="app_gramm" type="AndroidRunConfigurationType" factoryName="Android App" activateToolWindowBeforeRun="false">
<module name="WMS_Native.app" />
<option name="DEPLOY" value="true" />
<option name="DEPLOY_APK_FROM_BUNDLE" value="false" />
<option name="DEPLOY_AS_INSTANT" value="false" />
<option name="ARTIFACT_NAME" value="" />
<option name="PM_INSTALL_OPTIONS" value="" />
<option name="ALL_USERS" value="false" />
<option name="ALWAYS_INSTALL_WITH_PM" value="false" />
<option name="DYNAMIC_FEATURES_DISABLED_LIST" value="WMS_Native.dynamic__base,WMS_Native.dynamic_agricoper,WMS_Native.dynamic_frudis,WMS_Native.dynamic_ime,WMS_Native.dynamic_saporiveri,WMS_Native.dynamic_saporiveri_pv,WMS_Native.dynamic_vgalimenti,dynamic__base,dynamic_frudis,dynamic_ime,dynamic_saporiveri,dynamic_saporiveri_pv,dynamic_vgalimenti" />
<option name="ACTIVITY_EXTRA_FLAGS" value="" />
<option name="MODE" value="default_activity" />
<option name="CLEAR_LOGCAT" value="true" />
<option name="SHOW_LOGCAT_AUTOMATICALLY" value="true" />
<option name="SKIP_NOOP_APK_INSTALLATIONS" value="false" />
<option name="FORCE_STOP_RUNNING_APP" value="true" />
<option name="TARGET_SELECTION_MODE" value="SHOW_DIALOG" />
<option name="SELECTED_CLOUD_MATRIX_CONFIGURATION_ID" value="-1" />
<option name="SELECTED_CLOUD_MATRIX_PROJECT_ID" value="" />
<option name="DEBUGGER_TYPE" value="Auto" />
<Auto>
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
<option name="SHOW_STATIC_VARS" value="true" />
<option name="WORKING_DIR" value="" />
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
</Auto>
<Hybrid>
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
<option name="SHOW_STATIC_VARS" value="true" />
<option name="WORKING_DIR" value="" />
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
</Hybrid>
<Java />
<Native>
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
<option name="SHOW_STATIC_VARS" value="true" />
<option name="WORKING_DIR" value="" />
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
</Native>
<Profilers>
<option name="ADVANCED_PROFILING_ENABLED" value="false" />
<option name="STARTUP_PROFILING_ENABLED" value="false" />
<option name="STARTUP_CPU_PROFILING_ENABLED" value="false" />
<option name="STARTUP_CPU_PROFILING_CONFIGURATION_NAME" value="Sample Java Methods" />
<option name="STARTUP_NATIVE_MEMORY_PROFILING_ENABLED" value="false" />
<option name="NATIVE_MEMORY_SAMPLE_RATE_BYTES" value="2048" />
</Profilers>
<option name="DEEP_LINK" value="" />
<option name="ACTIVITY_CLASS" value="" />
<option name="SEARCH_ACTIVITY_IN_GLOBAL_SCOPE" value="false" />
<option name="SKIP_ACTIVITY_VALIDATION" value="false" />
<method v="2">
<option name="Android.Gradle.BeforeRunTask" enabled="true" />
</method>
</configuration>
</component>

View File

@@ -1,60 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="app_ime" type="AndroidRunConfigurationType" factoryName="Android App" activateToolWindowBeforeRun="false">
<module name="WMS_Native.app" />
<option name="DEPLOY" value="true" />
<option name="DEPLOY_APK_FROM_BUNDLE" value="false" />
<option name="DEPLOY_AS_INSTANT" value="false" />
<option name="ARTIFACT_NAME" value="" />
<option name="PM_INSTALL_OPTIONS" value="" />
<option name="ALL_USERS" value="false" />
<option name="ALWAYS_INSTALL_WITH_PM" value="false" />
<option name="DYNAMIC_FEATURES_DISABLED_LIST" value="WMS_Native.dynamic__base,WMS_Native.dynamic_agricoper,WMS_Native.dynamic_frudis,WMS_Native.dynamic_gramm,WMS_Native.dynamic_saporiveri,WMS_Native.dynamic_saporiveri_pv,WMS_Native.dynamic_vgalimenti,dynamic__base,dynamic_frudis,dynamic_gramm,dynamic_saporiveri,dynamic_saporiveri_pv,dynamic_vgalimenti" />
<option name="ACTIVITY_EXTRA_FLAGS" value="" />
<option name="MODE" value="default_activity" />
<option name="CLEAR_LOGCAT" value="true" />
<option name="SHOW_LOGCAT_AUTOMATICALLY" value="true" />
<option name="SKIP_NOOP_APK_INSTALLATIONS" value="false" />
<option name="FORCE_STOP_RUNNING_APP" value="true" />
<option name="TARGET_SELECTION_MODE" value="SHOW_DIALOG" />
<option name="SELECTED_CLOUD_MATRIX_CONFIGURATION_ID" value="-1" />
<option name="SELECTED_CLOUD_MATRIX_PROJECT_ID" value="" />
<option name="DEBUGGER_TYPE" value="Auto" />
<Auto>
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
<option name="SHOW_STATIC_VARS" value="true" />
<option name="WORKING_DIR" value="" />
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
</Auto>
<Hybrid>
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
<option name="SHOW_STATIC_VARS" value="true" />
<option name="WORKING_DIR" value="" />
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
</Hybrid>
<Java />
<Native>
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
<option name="SHOW_STATIC_VARS" value="true" />
<option name="WORKING_DIR" value="" />
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
</Native>
<Profilers>
<option name="ADVANCED_PROFILING_ENABLED" value="false" />
<option name="STARTUP_PROFILING_ENABLED" value="false" />
<option name="STARTUP_CPU_PROFILING_ENABLED" value="false" />
<option name="STARTUP_CPU_PROFILING_CONFIGURATION_NAME" value="Sample Java Methods" />
<option name="STARTUP_NATIVE_MEMORY_PROFILING_ENABLED" value="false" />
<option name="NATIVE_MEMORY_SAMPLE_RATE_BYTES" value="2048" />
</Profilers>
<option name="DEEP_LINK" value="" />
<option name="ACTIVITY_CLASS" value="" />
<option name="SEARCH_ACTIVITY_IN_GLOBAL_SCOPE" value="false" />
<option name="SKIP_ACTIVITY_VALIDATION" value="false" />
<method v="2">
<option name="Android.Gradle.BeforeRunTask" enabled="true" />
</method>
</configuration>
</component>

View File

@@ -1,60 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="app_saporiveri" type="AndroidRunConfigurationType" factoryName="Android App" activateToolWindowBeforeRun="false">
<module name="WMS_Native.app" />
<option name="DEPLOY" value="true" />
<option name="DEPLOY_APK_FROM_BUNDLE" value="false" />
<option name="DEPLOY_AS_INSTANT" value="false" />
<option name="ARTIFACT_NAME" value="" />
<option name="PM_INSTALL_OPTIONS" value="" />
<option name="ALL_USERS" value="false" />
<option name="ALWAYS_INSTALL_WITH_PM" value="false" />
<option name="DYNAMIC_FEATURES_DISABLED_LIST" value="WMS_Native.dynamic__base,WMS_Native.dynamic_agricoper,WMS_Native.dynamic_frudis,WMS_Native.dynamic_gramm,WMS_Native.dynamic_ime,WMS_Native.dynamic_saporiveri_pv,WMS_Native.dynamic_vgalimenti,dynamic__base,dynamic_frudis,dynamic_gramm,dynamic_ime,dynamic_saporiveri_pv,dynamic_vgalimenti" />
<option name="ACTIVITY_EXTRA_FLAGS" value="" />
<option name="MODE" value="default_activity" />
<option name="CLEAR_LOGCAT" value="true" />
<option name="SHOW_LOGCAT_AUTOMATICALLY" value="true" />
<option name="SKIP_NOOP_APK_INSTALLATIONS" value="true" />
<option name="FORCE_STOP_RUNNING_APP" value="true" />
<option name="TARGET_SELECTION_MODE" value="SHOW_DIALOG" />
<option name="SELECTED_CLOUD_MATRIX_CONFIGURATION_ID" value="-1" />
<option name="SELECTED_CLOUD_MATRIX_PROJECT_ID" value="" />
<option name="DEBUGGER_TYPE" value="Auto" />
<Auto>
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
<option name="SHOW_STATIC_VARS" value="true" />
<option name="WORKING_DIR" value="" />
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
</Auto>
<Hybrid>
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
<option name="SHOW_STATIC_VARS" value="true" />
<option name="WORKING_DIR" value="" />
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
</Hybrid>
<Java />
<Native>
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
<option name="SHOW_STATIC_VARS" value="true" />
<option name="WORKING_DIR" value="" />
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
</Native>
<Profilers>
<option name="ADVANCED_PROFILING_ENABLED" value="false" />
<option name="STARTUP_PROFILING_ENABLED" value="false" />
<option name="STARTUP_CPU_PROFILING_ENABLED" value="false" />
<option name="STARTUP_CPU_PROFILING_CONFIGURATION_NAME" value="Sample Java Methods" />
<option name="STARTUP_NATIVE_MEMORY_PROFILING_ENABLED" value="false" />
<option name="NATIVE_MEMORY_SAMPLE_RATE_BYTES" value="2048" />
</Profilers>
<option name="DEEP_LINK" value="" />
<option name="ACTIVITY_CLASS" value="" />
<option name="SEARCH_ACTIVITY_IN_GLOBAL_SCOPE" value="false" />
<option name="SKIP_ACTIVITY_VALIDATION" value="false" />
<method v="2">
<option name="Android.Gradle.BeforeRunTask" enabled="true" />
</method>
</configuration>
</component>

View File

@@ -1,60 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="app_saporiveri_pv" type="AndroidRunConfigurationType" factoryName="Android App" activateToolWindowBeforeRun="false">
<module name="WMS_Native.app" />
<option name="DEPLOY" value="true" />
<option name="DEPLOY_APK_FROM_BUNDLE" value="false" />
<option name="DEPLOY_AS_INSTANT" value="false" />
<option name="ARTIFACT_NAME" value="" />
<option name="PM_INSTALL_OPTIONS" value="" />
<option name="ALL_USERS" value="false" />
<option name="ALWAYS_INSTALL_WITH_PM" value="false" />
<option name="DYNAMIC_FEATURES_DISABLED_LIST" value="WMS_Native.dynamic__base,WMS_Native.dynamic_agricoper,WMS_Native.dynamic_frudis,WMS_Native.dynamic_gramm,WMS_Native.dynamic_ime,WMS_Native.dynamic_saporiveri,WMS_Native.dynamic_vgalimenti,dynamic__base,dynamic_frudis,dynamic_gramm,dynamic_ime,dynamic_saporiveri,dynamic_vgalimenti" />
<option name="ACTIVITY_EXTRA_FLAGS" value="" />
<option name="MODE" value="default_activity" />
<option name="CLEAR_LOGCAT" value="true" />
<option name="SHOW_LOGCAT_AUTOMATICALLY" value="true" />
<option name="SKIP_NOOP_APK_INSTALLATIONS" value="true" />
<option name="FORCE_STOP_RUNNING_APP" value="true" />
<option name="TARGET_SELECTION_MODE" value="SHOW_DIALOG" />
<option name="SELECTED_CLOUD_MATRIX_CONFIGURATION_ID" value="-1" />
<option name="SELECTED_CLOUD_MATRIX_PROJECT_ID" value="" />
<option name="DEBUGGER_TYPE" value="Auto" />
<Auto>
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
<option name="SHOW_STATIC_VARS" value="true" />
<option name="WORKING_DIR" value="" />
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
</Auto>
<Hybrid>
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
<option name="SHOW_STATIC_VARS" value="true" />
<option name="WORKING_DIR" value="" />
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
</Hybrid>
<Java />
<Native>
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
<option name="SHOW_STATIC_VARS" value="true" />
<option name="WORKING_DIR" value="" />
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
</Native>
<Profilers>
<option name="ADVANCED_PROFILING_ENABLED" value="false" />
<option name="STARTUP_PROFILING_ENABLED" value="false" />
<option name="STARTUP_CPU_PROFILING_ENABLED" value="false" />
<option name="STARTUP_CPU_PROFILING_CONFIGURATION_NAME" value="Sample Java Methods" />
<option name="STARTUP_NATIVE_MEMORY_PROFILING_ENABLED" value="false" />
<option name="NATIVE_MEMORY_SAMPLE_RATE_BYTES" value="2048" />
</Profilers>
<option name="DEEP_LINK" value="" />
<option name="ACTIVITY_CLASS" value="" />
<option name="SEARCH_ACTIVITY_IN_GLOBAL_SCOPE" value="false" />
<option name="SKIP_ACTIVITY_VALIDATION" value="false" />
<method v="2">
<option name="Android.Gradle.BeforeRunTask" enabled="true" />
</method>
</configuration>
</component>

View File

@@ -1,6 +1,6 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="app_vglimenti" type="AndroidRunConfigurationType" factoryName="Android App" activateToolWindowBeforeRun="false">
<module name="WMS_Native.app" />
<module name="WMS.app" />
<option name="DEPLOY" value="true" />
<option name="DEPLOY_APK_FROM_BUNDLE" value="false" />
<option name="DEPLOY_AS_INSTANT" value="false" />
@@ -8,7 +8,7 @@
<option name="PM_INSTALL_OPTIONS" value="" />
<option name="ALL_USERS" value="false" />
<option name="ALWAYS_INSTALL_WITH_PM" value="false" />
<option name="DYNAMIC_FEATURES_DISABLED_LIST" value="WMS_Native.dynamic__base,WMS_Native.dynamic_agricoper,WMS_Native.dynamic_frudis,WMS_Native.dynamic_gramm,WMS_Native.dynamic_ime,WMS_Native.dynamic_saporiveri,WMS_Native.dynamic_saporiveri_pv,dynamic__base,dynamic_frudis,dynamic_gramm,dynamic_ime,dynamic_saporiveri,dynamic_saporiveri_pv" />
<option name="DYNAMIC_FEATURES_DISABLED_LIST" value="WMS.dynamic__base" />
<option name="ACTIVITY_EXTRA_FLAGS" value="" />
<option name="MODE" value="default_activity" />
<option name="CLEAR_LOGCAT" value="true" />

View File

@@ -1,13 +1,17 @@
apply plugin: 'com.android.application'
apply plugin: 'com.google.firebase.firebase-perf'
if (!project.hasProperty("disable-performance-plugin")) {
apply plugin: 'com.google.firebase.firebase-perf'
}
apply plugin: 'com.google.firebase.crashlytics'
apply plugin: 'kotlin-android'
apply plugin: 'com.google.gms.google-services'
android {
def appVersionCode = 222
def appVersionName = '1.17.4'
def appVersionCode = 258
def appVersionName = '1.23.3'
signingConfigs {
release {
@@ -15,6 +19,9 @@ android {
keyPassword 'inpmiy'
storeFile file('Integry.jks')
storePassword 'inpmiy'
enableV3Signing true
enableV4Signing true
}
}
@@ -24,12 +31,12 @@ android {
}
}
compileSdkVersion 30
compileSdkVersion 31
defaultConfig {
applicationId "it.integry.integrywmsnative"
minSdkVersion 21
targetSdkVersion 30
targetSdkVersion 31
versionCode appVersionCode
versionName appVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -50,8 +57,9 @@ android {
android.buildFeatures.dataBinding true
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
productFlavors {
}
@@ -72,19 +80,15 @@ android {
lintOptions {
abortOnError false
checkReleaseBuilds false
}
dynamicFeatures = [":dynamic__base", ":dynamic_vgalimenti", ":dynamic_ime", ":dynamic_frudis", ":dynamic_saporiveri_pv", ":dynamic_saporiveri", ':dynamic_gramm', ':dynamic_agricoper']
dynamicFeatures = [":dynamic__base", ":dynamic_vgalimenti"]
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.3.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1'
implementation 'androidx.fragment:fragment:1.2.5'
androidTestImplementation('androidx.test.espresso:espresso-core:3.3.0', {
exclude group: 'com.android.support', module: 'support-annotations'
})
@@ -94,37 +98,37 @@ dependencies {
//Firebase
// Import the Firebase BoM
implementation platform('com.google.firebase:firebase-bom:26.3.0')
implementation platform('com.google.firebase:firebase-bom:29.1.0')
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.firebase:firebase-core'
implementation 'com.google.firebase:firebase-crash'
implementation 'com.google.firebase:firebase-crashlytics'
implementation 'com.google.firebase:firebase-perf'
implementation 'com.google.android.gms:play-services-basement:17.6.0'
implementation 'com.google.android.gms:play-services-basement:18.0.0'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.2.0'
implementation 'androidx.preference:preference-ktx:1.1.1'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation 'androidx.preference:preference-ktx:1.2.0'
implementation 'com.squareup.okhttp3:okhttp:4.9.1'
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.3.1'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.4.1'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'androidx.lifecycle:lifecycle-common-java8:2.3.1'
implementation 'androidx.lifecycle:lifecycle-common-java8:2.4.1'
implementation 'org.apache.commons:commons-text:1.9'
//MVVM
def dagger2_version = '2.29.1'
def dagger2_version = '2.40'
api "com.google.dagger:dagger:$dagger2_version"
annotationProcessor "com.google.dagger:dagger-compiler:$dagger2_version"
api "com.google.dagger:dagger-android:$dagger2_version"
api "com.google.dagger:dagger-android-support:$dagger2_version" // if you use the support libraries
api "com.google.dagger:dagger-android-support:$dagger2_version"
// if you use the support libraries
annotationProcessor "com.google.dagger:dagger-android-processor:$dagger2_version"
//FAB
@@ -134,13 +138,12 @@ dependencies {
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.akshay2211:Stash:master'
testImplementation 'junit:junit:4.13.2'
implementation 'com.github.zhukic:sectioned-recyclerview:1.2.3'
implementation 'com.github.pedromassango:doubleClick:3.0'
//SQLite ROOM
def room_version = "2.3.0"
def room_version = "2.4.1"
implementation "androidx.room:room-runtime:$room_version"
annotationProcessor "androidx.room:room-compiler:$room_version"
@@ -156,6 +159,9 @@ dependencies {
implementation project(':keyobardemulatorscannerlibrary')
androidTestImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.1'
androidTestImplementation 'org.testng:testng:7.4.0'
implementation 'com.github.RaviKoradiya:LiveAdapter:1.3.4'
}
repositories {

View File

@@ -29,14 +29,19 @@
android:screenOrientation="portrait"
android:theme="@style/Light"
android:windowSoftInputMode="adjustNothing" />
<activity android:name=".gest.contab_doc_interni.edit_form.DocInterniEditFormActivity"
android:screenOrientation="portrait"
android:theme="@style/Light"
android:windowSoftInputMode="adjustNothing" />
<activity
android:name=".gest.picking_resi.PickingResiActivity"
android:screenOrientation="portrait"
android:theme="@style/Light" />
<activity
android:name=".MainActivity"
android:name=".gest.main.MainActivity"
android:theme="@style/Light"
android:windowSoftInputMode="adjustPan">
android:windowSoftInputMode="adjustNothing"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.CLIENTBARCODEACTIVITY" />
@@ -69,7 +74,8 @@
<activity
android:name=".SplashActivity"
android:label="@string/app_name"
android:theme="@style/SplashTheme">
android:theme="@style/SplashTheme"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

View File

@@ -4,6 +4,8 @@ import android.app.Application;
import android.content.res.Configuration;
import android.content.res.Resources;
import javax.inject.Inject;
import it.integry.integrywmsnative.core.context.AppContext;
import it.integry.integrywmsnative.core.data_store.db.RoomModule;
@@ -17,7 +19,8 @@ public class MainApplication extends Application {
public static MainApplicationModule appModule;
public static RoomModule roomModule;
private AppContext appContext = new AppContext(this);
@Inject
AppContext appContext;
@@ -27,16 +30,15 @@ public class MainApplication extends Application {
public void onCreate() {
super.onCreate();
appModule = new MainApplicationModule(MainApplication.this, this);
appModule = new MainApplicationModule(this);
roomModule = new RoomModule(this);
appComponent = DaggerMainApplicationComponent.builder()
.mainApplicationModule(appModule)
.roomModule(roomModule)
.build();
appComponent.inject(appContext);
appComponent.inject(this);
appContext.init();
res = getResources();
}

View File

@@ -5,24 +5,48 @@ import javax.inject.Singleton;
import dagger.Component;
import it.integry.integrywmsnative.core.context.AppContext;
import it.integry.integrywmsnative.core.data_store.db.RoomModule;
import it.integry.integrywmsnative.gest.accettazione.MainAccettazioneComponent;
import it.integry.integrywmsnative.gest.accettazione.MainAccettazioneModule;
import it.integry.integrywmsnative.gest.accettazione_picking.AccettazionePickingComponent;
import it.integry.integrywmsnative.gest.accettazione_picking.AccettazionePickingModule;
import it.integry.integrywmsnative.gest.contab_doc_interni.DocInterniComponent;
import it.integry.integrywmsnative.gest.contab_doc_interni.DocInterniModule;
import it.integry.integrywmsnative.gest.contab_doc_interni.dialog.DialogSelectDocInfoComponent;
import it.integry.integrywmsnative.gest.contab_doc_interni.dialog.DialogSelectDocInfoModule;
import it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.DocInterniEditFormComponent;
import it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.DocInterniEditFormModule;
import it.integry.integrywmsnative.gest.contenuto_bancale.ContenutoBancaleComponent;
import it.integry.integrywmsnative.gest.contenuto_bancale.ContenutoBancaleModule;
import it.integry.integrywmsnative.gest.lista_bancali.ListaBancaliComponent;
import it.integry.integrywmsnative.gest.lista_bancali.ListaBancaliModule;
import it.integry.integrywmsnative.gest.login.LoginComponent;
import it.integry.integrywmsnative.gest.login.LoginModule;
import it.integry.integrywmsnative.gest.main.MainActivityComponent;
import it.integry.integrywmsnative.gest.main.MainActivityModule;
import it.integry.integrywmsnative.gest.main.MainFragmentComponent;
import it.integry.integrywmsnative.gest.main.MainFragmentModule;
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.OrdiniUscitaElencoComponent;
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.OrdiniUscitaElencoModule;
import it.integry.integrywmsnative.gest.picking_libero.PickingLiberoComponent;
import it.integry.integrywmsnative.gest.picking_libero.PickingLiberoModule;
import it.integry.integrywmsnative.gest.picking_resi.PickingResiComponent;
import it.integry.integrywmsnative.gest.picking_resi.PickingResiModule;
import it.integry.integrywmsnative.gest.prod_accettazione_ord_produzione.ProdOrdineProduzioneElencoComponent;
import it.integry.integrywmsnative.gest.prod_accettazione_ord_produzione.ProdOrdineProduzioneElencoModule;
import it.integry.integrywmsnative.gest.prod_fabbisogno_linee_prod.ProdFabbisognoLineeProdComponent;
import it.integry.integrywmsnative.gest.prod_fabbisogno_linee_prod.ProdFabbisognoLineeProdModule;
import it.integry.integrywmsnative.gest.prod_fabbisogno_linee_prod.dialog_ask_mag_prossimita.DialogAskMagazzinoProssimitaComponent;
import it.integry.integrywmsnative.gest.prod_fabbisogno_linee_prod.dialog_ask_mag_prossimita.DialogAskMagazzinoProssimitaModule;
import it.integry.integrywmsnative.gest.prod_recupero_materiale.ProdRecuperoMaterialeComponent;
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_versamento_materiale.ProdVersamentoMaterialeComponent;
import it.integry.integrywmsnative.gest.prod_versamento_materiale.ProdVersamentoMaterialeModule;
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.PVOrdineAcquistoEditComponent;
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.PVOrdineAcquistoEditModule;
import it.integry.integrywmsnative.gest.pv_ordini_acquisto.PVOrdineAcquistoGrigliaComponent;
import it.integry.integrywmsnative.gest.pv_ordini_acquisto.PVOrdineAcquistoGrigliaModule;
import it.integry.integrywmsnative.gest.pv_ordini_acquisto.PVOrdiniAcquistoGrigliaComponent;
import it.integry.integrywmsnative.gest.pv_ordini_acquisto.PVOrdiniAcquistoGrigliaModule;
import it.integry.integrywmsnative.gest.rettifica_giacenze.RettificaGiacenzeComponent;
import it.integry.integrywmsnative.gest.rettifica_giacenze.RettificaGiacenzeModule;
import it.integry.integrywmsnative.gest.spedizione.SpedizioneComponent;
@@ -35,8 +59,11 @@ import it.integry.integrywmsnative.gest.ultimi_arrivi_fornitore.UltimiArriviForn
import it.integry.integrywmsnative.gest.ultimi_arrivi_fornitore.UltimiArriviFornitoreModule;
import it.integry.integrywmsnative.gest.versamento_merce.VersamentoMerceComponent;
import it.integry.integrywmsnative.gest.versamento_merce.VersamentoMerceModule;
import it.integry.integrywmsnative.view.dialogs.choose_arts_from_lista_arts.DialogChooseArtsFromListaArtsComponent;
import it.integry.integrywmsnative.view.dialogs.choose_arts_from_lista_arts.DialogChooseArtsFromListaArtsModule;
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.info_aggiuntive_lu.InfoAggiuntiveLUDialogComponent;
import it.integry.integrywmsnative.view.dialogs.input_lu_prod.DialogInputLUProdComponent;
import it.integry.integrywmsnative.view.dialogs.input_lu_prod.DialogInputLUProdModule;
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2Component;
@@ -49,10 +76,16 @@ import it.integry.integrywmsnative.view.dialogs.scan_or_create_lu.DialogScanOrCr
// Definition of the Application graph
@Singleton
@Component(modules = {
MainApplicationModule.class,
RoomModule.class,
SplashActivityModule.class,
MainApplicationModule.class,
LoginModule.class,
MainActivityModule.class,
PVOrdineAcquistoGrigliaModule.class,
MainFragmentModule.class,
MainAccettazioneModule.class,
ListaBancaliModule.class,
ContenutoBancaleModule.class,
PVOrdiniAcquistoGrigliaModule.class,
PVOrdineAcquistoEditModule.class,
PickingLiberoModule.class,
RettificaGiacenzeModule.class,
@@ -70,33 +103,91 @@ import it.integry.integrywmsnative.view.dialogs.scan_or_create_lu.DialogScanOrCr
VersamentoMerceModule.class,
DialogAskMagazzinoProssimitaModule.class,
DialogChooseBatchLotModule.class,
DialogRowInfoProdFabbisognoLineeProdModule.class})
DialogRowInfoProdFabbisognoLineeProdModule.class,
ProdOrdineProduzioneElencoModule.class,
ProdRecuperoMaterialeModule.class,
ProdVersamentoMaterialeModule.class,
DialogChooseArtsFromListaArtsModule.class,
DocInterniModule.class,
DialogSelectDocInfoModule.class,
DocInterniEditFormModule.class
})
public interface MainApplicationComponent {
SplashActivityComponent.Factory splashActivityComponent();
LoginComponent.Factory loginActivityComponent();
MainActivityComponent.Factory mainActivityComponent();
PVOrdineAcquistoGrigliaComponent.Factory pvOrdineAcquistoGrigliaComponent();
MainFragmentComponent.Factory mainFragmentComponent();
MainAccettazioneComponent.Factory mainAccettazioneComponent();
ListaBancaliComponent.Factory listaBancaliComponent();
ContenutoBancaleComponent.Factory contenutoBancaleComponent();
PVOrdiniAcquistoGrigliaComponent.Factory pvOrdineAcquistoGrigliaComponent();
PVOrdineAcquistoEditComponent.Factory pvOrdineAcquistoEditComponent();
PickingLiberoComponent.Factory pickingLiberoComponent();
RettificaGiacenzeComponent.Factory rettificaGiacenzeComponent();
SpedizioneComponent.Factory spedizioneComponent();
AccettazionePickingComponent.Factory accettazionePickingComponent();
UltimeConsegneClienteComponent.Factory ultimeConsegneClienteComponent();
UltimiArriviFornitoreComponent.Factory ultimiArriviFornitoreComponent();
PickingResiComponent.Factory pickingResiComponent();
OrdiniUscitaElencoComponent.Factory prodOrdineLavorazioneElencoComponent();
DialogInputQuantityV2Component.Factory dialogInputQuantityV2Component();
DialogInputLUProdComponent.Factory dialogInputLUProdComponent();
DialogScanArtComponent.Factory dialogScanArtComponent();
DialogScanOrCreateLUComponent.Factory dialogScanOrCreateLUComponent();
ProdFabbisognoLineeProdComponent.Factory prodFabbisognoLineeProdComponent();
VersamentoMerceComponent.Factory versamentoMerceComponent();
DialogAskMagazzinoProssimitaComponent.Factory dialogAskMagazzinoProssimitaComponent();
DialogChooseBatchLotComponent.Factory dialogChooseBatchLotComponent();
DialogRowInfoProdFabbisognoLineeProdComponent.Factory dialogRowInfoProdFabbisognoLineeProdComponent();
ProdRientroMerceComponent.Factory prodRientroMerceComponent();
ProdRientroMerceOrderDetailComponent.Factory prodRientroMerceOrderDetailComponent();
ProdOrdineProduzioneElencoComponent.Factory prodOrdineProduzioneElencoComponent();
void inject(AppContext appContext);
ProdRecuperoMaterialeComponent.Factory prodRecuperoMaterialeComponent();
ProdVersamentoMaterialeComponent.Factory prodVersamentoMaterialeComponent();
DialogChooseArtsFromListaArtsComponent.Factory dialogChooseArtsFromListaArtsComponent();
DocInterniComponent.Factory docInterniComponent();
DialogSelectDocInfoComponent.Factory dialogSelectMgrpDtipPairComponent();
DocInterniEditFormComponent.Factory docInterniEditFormComponent();
InfoAggiuntiveLUDialogComponent.Factory infoAggiuntiveLUDialogComponent();
void inject(MainApplication mainApplication);
void inject(AppContext mainApplication);
}

View File

@@ -1,33 +1,41 @@
package it.integry.integrywmsnative;
import android.app.Application;
import android.content.Context;
import javax.inject.Singleton;
import dagger.Module;
import dagger.Provides;
import it.integry.integrywmsnative.core.context.AppContext;
import it.integry.integrywmsnative.core.context.MainContext;
import it.integry.integrywmsnative.core.data_recover.ColliDataRecoverService;
import it.integry.integrywmsnative.core.data_store.db.AppDatabase;
import it.integry.integrywmsnative.core.menu.MenuRESTConsumer;
import it.integry.integrywmsnative.core.menu.MenuService;
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.CommessaRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.DepositoRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.EntityRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.GestSetupRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.GiacenzaRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.MagazzinoRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.MesRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.OrdiniRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.PrinterRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
import it.integry.integrywmsnative.core.services.inventario.InventarioService;
import it.integry.integrywmsnative.gest.contab_doc_interni.rest.DocInterniRESTConsumer;
import it.integry.integrywmsnative.gest.prod_fabbisogno_linee_prod.rest.ProdFabbisognoLineeProdRESTConsumer;
@Module
public class MainApplicationModule {
private final Context mContext;
private final Application mApplication;
public MainApplicationModule(Context context, Application application) {
this.mContext = context;
public MainApplicationModule(Application application) {
this.mApplication = application;
}
@@ -39,14 +47,34 @@ public class MainApplicationModule {
@Provides
@Singleton
ColliDataRecoverService provideColliDataRecoverService() {
return new ColliDataRecoverService();
AppContext providesAppContext() {
return new AppContext(mApplication);
}
@Provides
@Singleton
OrdiniRESTConsumer provideOrdiniRESTConsumer(SystemRESTConsumer systemRESTConsumer) {
return new OrdiniRESTConsumer(systemRESTConsumer);
MainContext providesMainContextNew(MenuService menuService, AppDatabase appDatabase) {
return new MainContext(mApplication.getApplicationContext(), menuService, appDatabase);
}
@Provides
@Singleton
ColliDataRecoverService provideColliDataRecoverService() {
ColliDataRecoverService colliDataRecoverService = new ColliDataRecoverService(mApplication.getApplicationContext());
colliDataRecoverService.init();
return colliDataRecoverService;
}
@Provides
@Singleton
MenuService provideMenuService(MenuRESTConsumer menuRESTConsumer) {
return new MenuService(menuRESTConsumer);
}
@Provides
@Singleton
OrdiniRESTConsumer provideOrdiniRESTConsumer(SystemRESTConsumer systemRESTConsumer, EntityRESTConsumer entityRESTConsumer) {
return new OrdiniRESTConsumer(systemRESTConsumer, entityRESTConsumer);
}
@Provides
@@ -57,8 +85,26 @@ public class MainApplicationModule {
@Provides
@Singleton
ArticoloRESTConsumer provideArticoloRESTConsumer() {
return new ArticoloRESTConsumer();
ArticoloRESTConsumer provideArticoloRESTConsumer(SystemRESTConsumer systemRESTConsumer) {
return new ArticoloRESTConsumer(systemRESTConsumer);
}
@Provides
@Singleton
CommessaRESTConsumer provideCommessaRESTConsumer(SystemRESTConsumer systemRESTConsumer) {
return new CommessaRESTConsumer(systemRESTConsumer);
}
@Provides
@Singleton
DepositoRESTConsumer provideDepositoRESTConsumer(EntityRESTConsumer entityRESTConsumer, SystemRESTConsumer systemRESTConsumer) {
return new DepositoRESTConsumer(entityRESTConsumer, systemRESTConsumer);
}
@Provides
@Singleton
MenuRESTConsumer provideMenuRESTConsumer() {
return new MenuRESTConsumer();
}
@Provides
@@ -75,8 +121,14 @@ public class MainApplicationModule {
@Provides
@Singleton
ColliMagazzinoRESTConsumer provideColliMagazzinoRESTConsumer(ArticoloRESTConsumer articoloRESTConsumer) {
return new ColliMagazzinoRESTConsumer(articoloRESTConsumer);
EntityRESTConsumer provideEntityRESTConsumer() {
return new EntityRESTConsumer();
}
@Provides
@Singleton
ColliMagazzinoRESTConsumer provideColliMagazzinoRESTConsumer(SystemRESTConsumer systemRESTConsumer, ArticoloRESTConsumer articoloRESTConsumer, EntityRESTConsumer entityRESTConsumer) {
return new ColliMagazzinoRESTConsumer(systemRESTConsumer, articoloRESTConsumer, entityRESTConsumer);
}
@Provides
@@ -109,6 +161,22 @@ public class MainApplicationModule {
return new ProdFabbisognoLineeProdRESTConsumer(systemRESTConsumer);
}
@Provides
@Singleton
DocInterniRESTConsumer provideDocInterniRESTConsumer() {
return new DocInterniRESTConsumer();
}
@Provides
@Singleton
GiacenzaRESTConsumer provideGiacenzaRESTConsumer(SystemRESTConsumer systemRESTConsumer, ArticoloRESTConsumer articoloRESTConsumer) {
return new GiacenzaRESTConsumer(systemRESTConsumer, articoloRESTConsumer);
}
@Provides
@Singleton
InventarioService provideInventarioService(GiacenzaRESTConsumer giacenzaRESTConsumer) {
return new InventarioService(giacenzaRESTConsumer);
}
}

View File

@@ -1,10 +1,12 @@
package it.integry.integrywmsnative;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.text.SpannableString;
import android.text.Spanned;
import android.view.LayoutInflater;
import androidx.databinding.DataBindingUtil;
@@ -12,6 +14,8 @@ import androidx.databinding.DataBindingUtil;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject;
import it.integry.integrywmsnative.core.context.MainContext;
import it.integry.integrywmsnative.core.expansion.BaseActivity;
import it.integry.integrywmsnative.core.expansion.RunnableArgsss;
@@ -20,47 +24,48 @@ import it.integry.integrywmsnative.core.utility.PermissionsHelper;
import it.integry.integrywmsnative.core.utility.UtilityContext;
import it.integry.integrywmsnative.databinding.ActivitySplashBinding;
import it.integry.integrywmsnative.gest.login.LoginActivity;
import it.integry.integrywmsnative.gest.main.MainActivity;
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
public class SplashActivity extends BaseActivity {
public class SplashActivity extends BaseActivity implements MainContext.Listener {
private ActivitySplashBinding mBinding;
private MainContext mainContext = new MainContext(this);
// private MainContext mainContext = new MainContext(this);
@Inject
MainContext mainContext;
private RunnableArgsss<Integer, String[], List<Integer>> onRequestPermissionResult;
public static void startActivity(Context context) {
Intent intent = new Intent(context, SplashActivity.class);
context.startActivity(intent);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
MainApplication.appComponent
.splashActivityComponent()
.create()
.inject(this);
mainContext.setListener(this);
mBinding = DataBindingUtil.inflate(LayoutInflater.from(this), R.layout.activity_splash, null, false);
setContentView(mBinding.getRoot());
UtilityContext.initMainActivity(this);
initAppVersion();
initAppVersion();
initPermissions(this::init);
}
private void initPermissions(Runnable onComplete) {
PermissionsHelper.askPermissions(this, () -> {
onComplete.run();
}, permanentlyDenied -> {
if(permanentlyDenied) {
DialogSimpleMessageView.makeErrorDialog(new SpannableString(getText(R.string.permissions_permanently_denied)), null, () -> {
this.finish();
})
.show(getSupportFragmentManager(), "tag");
} else {
initPermissions(onComplete);
}
});
}
private void initAppVersion() {
try {
PackageInfo pInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
@@ -68,7 +73,7 @@ public class SplashActivity extends BaseActivity {
String debugText = "";
if(BuildConfig.DEBUG) debugText += "\n[DEBUG VERSION]";
if (BuildConfig.DEBUG) debugText += "\n[DEBUG VERSION]";
mBinding.appVersionTextview.setText("v" + version + debugText);
} catch (PackageManager.NameNotFoundException e) {
@@ -76,15 +81,39 @@ public class SplashActivity extends BaseActivity {
}
}
private void initPermissions(Runnable onComplete) {
PermissionsHelper.askPermissions(this, onComplete, permanentlyDenied -> {
if (permanentlyDenied) {
onError(new SpannableString(getText(R.string.permissions_permanently_denied)));
} else {
initPermissions(onComplete);
}
});
}
private void init() {
if(!SettingsManager.i().isUserLoggedIn()){
if (!SettingsManager.i().isUserLoggedIn()) {
startLoginActivity();
} else {
mainContext.init(this::startMainActivity);
mainContext.init();
}
}
@Override
public void onDBDataLoading(String item) {
mBinding.loadingInfoTextview.setText("Caricamento " + item);
}
@Override
public void onMenuLoading() {
mBinding.loadingInfoTextview.setText("Caricamento menù");
}
@Override
public void onContextInitialized() {
startMainActivity();
}
public void setOnRequestPermissionsResult(RunnableArgsss<Integer, String[], List<Integer>> onRequestPermissionResult) {
@@ -95,9 +124,9 @@ public class SplashActivity extends BaseActivity {
@Override
public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if(this.onRequestPermissionResult != null) {
if (this.onRequestPermissionResult != null) {
List<Integer> grantResultsList = new ArrayList<>();
for(int i = 0; i < grantResults.length; i++) {
for (int i = 0; i < grantResults.length; i++) {
grantResultsList.add(grantResults[i]);
}
@@ -106,20 +135,26 @@ public class SplashActivity extends BaseActivity {
}
private void startLoginActivity(){
private void startLoginActivity() {
this.finish();
Intent myIntent = new Intent(this, LoginActivity.class);
startActivity(myIntent);
}
private void startMainActivity(){
private void startMainActivity() {
this.finish();
Intent myIntent = new Intent(this, MainActivity.class);
startActivity(myIntent);
}
@Override
public void onError(Spanned message) {
DialogSimpleMessageView.makeErrorDialog(
message, null, this::finish, R.string.logout, () -> {
this.mainContext.logout(MainApplication::exit);
})
.show(this.getSupportFragmentManager(), "tag");
}
}

View File

@@ -0,0 +1,15 @@
package it.integry.integrywmsnative;
import dagger.Subcomponent;
@Subcomponent
public interface SplashActivityComponent {
@Subcomponent.Factory
interface Factory {
SplashActivityComponent create();
}
void inject(SplashActivity mainActivity);
}

View File

@@ -0,0 +1,7 @@
package it.integry.integrywmsnative;
import dagger.Module;
@Module(subcomponents = SplashActivityComponent.class)
public class SplashActivityModule {
}

View File

@@ -1,33 +1,27 @@
package it.integry.integrywmsnative.core.barcode_reader;
import android.content.Context;
import android.view.KeyEvent;
import androidx.appcompat.app.AppCompatActivity;
import java.lang.reflect.Constructor;
import java.util.ArrayList;
import java.util.List;
import it.integry.barcode_base_android_library.exception.BarcodeAdapterNotFoundException;
import it.integry.barcode_base_android_library.interfaces.BarcodeReaderInterface;
import it.integry.honeywellscannerlibrary.HoneyWellBarcodeReader;
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
import it.integry.integrywmsnative.core.utility.UtilityLogger;
import it.integry.keyobardemulatorscannerlibrary.KeyboardEmulatorBarcodeReader;
import it.integry.pointmobilescannerlibrary.PointMobileBarcodeReader;
import it.integry.zebrascannerlibrary.ZebraBarcodeReader;
public class BarcodeManager {
private static AppCompatActivity context;
private static BarcodeReaderInterface mCurrentBarcodeInterface;
private static List<BarcodeCallbackDTO> mBarcodeCallbacksStacktrace = new ArrayList<>();
private static final List<BarcodeCallbackDTO> mBarcodeCallbacksStacktrace = new ArrayList<>();
private static boolean mEnabled = true;
private static Class<? extends BarcodeReaderInterface>[] registeredBarcodeReaderInterfaces = new Class[]{
private static final Class<? extends BarcodeReaderInterface>[] registeredBarcodeReaderInterfaces = new Class[]{
PointMobileBarcodeReader.class,
ZebraBarcodeReader.class,
HoneyWellBarcodeReader.class,
@@ -35,73 +29,60 @@ public class BarcodeManager {
};
public static void init(AppCompatActivity context) {
BarcodeManager.context = context;
public static void init(Context applicationContext) throws Exception {
initBarcodeReader();
initBarcodeReader(applicationContext);
}
private static void initBarcodeReader() {
private static void initBarcodeReader(Context applicationContext) throws Exception {
for (Class<? extends BarcodeReaderInterface> readerInterface : registeredBarcodeReaderInterfaces){
for (Class<? extends BarcodeReaderInterface> readerInterface : registeredBarcodeReaderInterfaces) {
Constructor<?> cons = null;
try {
cons = Class.forName(readerInterface.getName()).getConstructors()[0];
BarcodeReaderInterface object = (BarcodeReaderInterface) cons.newInstance(context);
Constructor<?> cons = Class.forName(readerInterface.getName()).getConstructors()[0];
BarcodeReaderInterface object = (BarcodeReaderInterface) cons.newInstance(applicationContext);
if(object.isRightAdapter()) {
mCurrentBarcodeInterface = object;
break;
}
} catch (Exception e) {
UtilityExceptions.defaultException(context,e);
if (object.isRightAdapter()) {
mCurrentBarcodeInterface = object;
break;
}
}
if(mCurrentBarcodeInterface != null) {
if (mCurrentBarcodeInterface != null) {
try {
mCurrentBarcodeInterface.init(() -> {
mCurrentBarcodeInterface.register(data -> {
BarcodeCallbackDTO callback = getValidCallback();
if(callback != null && mEnabled) {
callback.getOnScanSuccessfull().run(data);
}
}, ex -> {
BarcodeCallbackDTO callback = getValidCallback();
if(callback != null && mEnabled) {
callback.getOnScanFailed().run(ex);
}
});
mCurrentBarcodeInterface.init(() -> {
mCurrentBarcodeInterface.register(data -> {
BarcodeCallbackDTO callback = getValidCallback();
if (callback != null && mEnabled) {
callback.getOnScanSuccessfull().run(data);
}
}, ex -> {
BarcodeCallbackDTO callback = getValidCallback();
if (callback != null && mEnabled) {
callback.getOnScanFailed().run(ex);
}
});
} catch (BarcodeAdapterNotFoundException ex) {
UtilityExceptions.defaultException(context, ex);
}
});
}
}
private static BarcodeCallbackDTO getValidCallback() {
if(mBarcodeCallbacksStacktrace.size() > 0) {
return mBarcodeCallbacksStacktrace.get(mBarcodeCallbacksStacktrace.size() -1);
if (mBarcodeCallbacksStacktrace.size() > 0) {
return mBarcodeCallbacksStacktrace.get(mBarcodeCallbacksStacktrace.size() - 1);
} else {
return null;
}
}
public static boolean onKeyDown(int keyCode, KeyEvent keyEvent){
public static boolean onKeyDown(int keyCode, KeyEvent keyEvent) {
if (mCurrentBarcodeInterface != null)
mCurrentBarcodeInterface.onKeyEvent(keyEvent);
mCurrentBarcodeInterface.onKeyEvent(keyEvent);
return true;
}
@@ -113,8 +94,8 @@ public class BarcodeManager {
int newID = -1;
if(mBarcodeCallbacksStacktrace.size() > 0) {
newID = mBarcodeCallbacksStacktrace.get(mBarcodeCallbacksStacktrace.size() -1).getID() + 1;
if (mBarcodeCallbacksStacktrace.size() > 0) {
newID = mBarcodeCallbacksStacktrace.get(mBarcodeCallbacksStacktrace.size() - 1).getID() + 1;
} else {
newID = 1;
}
@@ -131,7 +112,7 @@ public class BarcodeManager {
//Rimuovo la callback con l'ID trovato e tutte quelle con >ID in modo che rimuovo tutte le call aggiunte successivamente
for (int i = 0; i < mBarcodeCallbacksStacktrace.size(); i++) {
if(mBarcodeCallbacksStacktrace.get(i).getID() == ID || callbackObjFound) {
if (mBarcodeCallbacksStacktrace.get(i).getID() == ID || callbackObjFound) {
mBarcodeCallbacksStacktrace.remove(i);
callbackObjFound = true;

View File

@@ -2,7 +2,6 @@ package it.integry.integrywmsnative.core.class_router;
import java.util.HashMap;
import it.integry.integrywmsnative.core.class_router.configs.MenuConfiguration;
import it.integry.integrywmsnative.core.class_router.interfaces.ICustomConfiguration;
import it.integry.integrywmsnative.core.utility.UtilityHashMap;
@@ -10,14 +9,12 @@ public class BaseCustomConfiguration implements ICustomConfiguration {
public static class Keys {
public static int MENU_CONFIGURATION = 0;
public static int FLAG_SHOW_COD_FORN_IN_SPEDIZIONE = 1;
public static int CUSTOM_DYNAMIC_VERSION_PATH = 2;
public static int FLAG_SPEDIZIONE_GROUP_BY_GRP_MERC = 3;
}
protected HashMap<Integer, Object> configurations = new HashMap<Integer, Object>() {{
put(Keys.MENU_CONFIGURATION, new MenuConfiguration());
protected HashMap<Integer, Object> configurations = new HashMap<>() {{
put(Keys.FLAG_SHOW_COD_FORN_IN_SPEDIZIONE, true);
put(Keys.FLAG_SPEDIZIONE_GROUP_BY_GRP_MERC, false);
}};

View File

@@ -6,8 +6,6 @@ import android.util.Pair;
import java.util.ArrayList;
import java.util.List;
import it.integry.integrywmsnative.core.class_router.exceptions.MethodPathNotRegisteredException;
public class ClassRouter {
public enum PATH {
@@ -21,8 +19,8 @@ public class ClassRouter {
private static List<Pair<PATH, Object>> mRouteClasses = new ArrayList<>();
public static void init(Context context) {
ClassRouter.context = context;
public static void init() {
// ClassRouter.context = context;
}
private static boolean checkIClassExists(PATH path) {
@@ -51,9 +49,7 @@ public class ClassRouter {
try {
mRouteClasses.add(new Pair<>(path, clazz.newInstance()));
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InstantiationException e) {
} catch (IllegalAccessException | InstantiationException e) {
e.printStackTrace();
}
}
@@ -69,15 +65,15 @@ public class ClassRouter {
try {
if (!checkIClassExists(path)) {
throw new MethodPathNotRegisteredException(path);
// throw new MethodPathNotRegisteredException(path);
}
Object instance = mRouteClasses.get(getClassIndex(path)).second;
return (T)instance;
} catch (MethodPathNotRegisteredException ex) {
// UtilityExceptions.defaultException(null, ex, true);
} catch (Exception ex) {
// UtilityExceptions.defaultException(null, ex, true);
}
return null;

View File

@@ -32,6 +32,8 @@ public class BaseMenuConfiguration {
@IdRes
private int mGroupId;
private String codMenu;
private List<MenuItem> mItems = new ArrayList<>();
public @IdRes int getGroupId() {
@@ -52,6 +54,15 @@ public class BaseMenuConfiguration {
return this;
}
public String getCodMenu() {
return codMenu;
}
public MenuGroup setCodMenu(String codMenu) {
this.codMenu = codMenu;
return this;
}
public List<MenuItem> getItems() {
return mItems;
}
@@ -67,6 +78,7 @@ public class BaseMenuConfiguration {
@StringRes private int mTitleText;
@DrawableRes private int mTitleIcon;
@DrawableRes private int mDrawerIcon;
private String codMenu;
private RunnableWithReturn<Fragment> fragmentFactory;
public int getID() {
@@ -105,6 +117,15 @@ public class BaseMenuConfiguration {
return this;
}
public String getCodMenu() {
return codMenu;
}
public MenuItem setCodMenu(String codMenu) {
this.codMenu = codMenu;
return this;
}
public RunnableWithReturn<Fragment> getFragmentFactory() {
return fragmentFactory;
}

View File

@@ -3,12 +3,15 @@ package it.integry.integrywmsnative.core.class_router.configs;
import it.integry.integrywmsnative.R;
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
import it.integry.integrywmsnative.gest.accettazione.MainAccettazioneFragment;
import it.integry.integrywmsnative.gest.contab_doc_interni.DocInterniFragment;
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.OrdiniUscitaElencoFragment;
import it.integry.integrywmsnative.gest.picking_libero.PickingLiberoFragment;
import it.integry.integrywmsnative.gest.prod_accettazione_ord_produzione.ProdOrdineProduzioneElencoFragment;
import it.integry.integrywmsnative.gest.prod_fabbisogno_linee_prod.ProdFabbisognoLineeProdFragment;
import it.integry.integrywmsnative.gest.prod_recupero_materiale.ProdRecuperoMaterialeFragment;
import it.integry.integrywmsnative.gest.prod_rientro_merce.ProdRientroMerceFragment;
import it.integry.integrywmsnative.gest.prod_versamento_materiale.ProdVersamentoMaterialeFragment;
import it.integry.integrywmsnative.gest.pv_ordini_acquisto.PVOrdiniAcquistoGrigliaFragment;
import it.integry.integrywmsnative.gest.rettifica_giacenze.RettificaGiacenzeFragment;
import it.integry.integrywmsnative.gest.ultime_consegne_cliente.UltimeConsegneClienteFragment;
import it.integry.integrywmsnative.gest.ultimi_arrivi_fornitore.UltimiArriviFornitoreFragment;
@@ -24,9 +27,11 @@ public class MenuConfiguration extends BaseMenuConfiguration {
new MenuGroup()
.setGroupText(R.string.purchase)
.setGroupId(R.id.nav_group_acquisto)
.setCodMenu("MM008")
.addItem(new MenuItem()
.setID(R.id.nav_accettazione)
.setCodMenu("MG044")
.setTitleText(R.string.accettazione_title_fragment)
.setTitleIcon(R.drawable.ic_dashboard_accettazione)
.setDrawerIcon(R.drawable.ic_black_download)
@@ -34,6 +39,7 @@ public class MenuConfiguration extends BaseMenuConfiguration {
.addItem(new MenuItem()
.setID(R.id.nav_resi_fornitore)
.setCodMenu("MG045")
.setTitleText(R.string.fragment_ultime_arrivi_fornitore_title)
.setTitleIcon(R.drawable.ic_latest_delivery)
.setDrawerIcon(R.drawable.ic_black_latest_delivery)
@@ -42,9 +48,11 @@ public class MenuConfiguration extends BaseMenuConfiguration {
new MenuGroup()
.setGroupText(R.string.checkout)
.setGroupId(R.id.nav_group_spedizione)
.setCodMenu("MM010")
.addItem(new MenuItem()
.setID(R.id.nav_spedizione)
.setCodMenu("MG046")
.setTitleText(R.string.vendita_title_fragment)
.setTitleIcon(R.drawable.ic_dashboard_spedizione)
.setDrawerIcon(R.drawable.ic_black_upload)
@@ -52,6 +60,7 @@ public class MenuConfiguration extends BaseMenuConfiguration {
.addItem(new MenuItem()
.setID(R.id.nav_free_picking)
.setCodMenu("MG047")
.setTitleText(R.string.free_picking)
.setTitleIcon(R.drawable.ic_dashboard_picking_libero)
.setDrawerIcon(R.drawable.ic_black_barcode_scanner)
@@ -59,6 +68,7 @@ public class MenuConfiguration extends BaseMenuConfiguration {
.addItem(new MenuItem()
.setID(R.id.nav_resi_cliente)
.setCodMenu("MG048")
.setTitleText(R.string.fragment_ultime_consegne_cliente_title)
.setTitleIcon(R.drawable.ic_latest_delivery_customer)
.setDrawerIcon(R.drawable.ic_black_latest_delivery)
@@ -66,9 +76,11 @@ public class MenuConfiguration extends BaseMenuConfiguration {
).addGroup(new MenuGroup()
.setGroupText(R.string.manufacture)
.setGroupId(R.id.nav_group_produzione)
.setCodMenu("MM009")
.addItem(new MenuItem()
.setID(R.id.nav_prod_ordine_produzione)
.setCodMenu("MG049")
.setTitleText(R.string.prod_ordine_produzione_title_fragment)
.setTitleIcon(R.drawable.ic_dashboard_prod_accettazione_produzione)
.setDrawerIcon(R.drawable.ic_black_external)
@@ -76,6 +88,7 @@ public class MenuConfiguration extends BaseMenuConfiguration {
.addItem(new MenuItem()
.setID(R.id.nav_prod_ordine_lavorazione)
.setCodMenu("MG050")
.setTitleText(R.string.prod_ordine_lavorazione_title_fragment)
.setTitleIcon(R.drawable.ic_dashboard_prod_picking_lavorazione)
.setDrawerIcon(R.drawable.ic_black_external)
@@ -83,6 +96,7 @@ public class MenuConfiguration extends BaseMenuConfiguration {
.addItem(new MenuItem()
.setID(R.id.nav_free_lav_picking)
.setCodMenu("MG051")
.setTitleText(it.integry.integrywmsnative.R.string.free_lav_picking)
.setTitleIcon(R.drawable.ic_dashboard_prod_picking_libero)
.setDrawerIcon(it.integry.integrywmsnative.R.drawable.ic_black_barcode_scanner)
@@ -90,6 +104,7 @@ public class MenuConfiguration extends BaseMenuConfiguration {
.addItem(new MenuItem()
.setID(R.id.nav_prod_posizionamento_da_ord)
.setCodMenu("MG052")
.setTitleText(R.string.prod_fabbisogno_linee_prod_title)
.setTitleIcon(R.drawable.ic_dashboard_prod_versamento_merce)
.setDrawerIcon(it.integry.integrywmsnative.R.drawable.ic_black_load_shelf)
@@ -97,6 +112,7 @@ public class MenuConfiguration extends BaseMenuConfiguration {
.addItem(new MenuItem()
.setID(R.id.nav_prod_versamento_materiale)
.setCodMenu("MG053")
.setTitleText(R.string.prod_versamento_materiale_title_fragment)
.setTitleIcon(R.drawable.ic_dashboard_prod_versamento_materiale)
.setDrawerIcon(R.drawable.ic_black_external)
@@ -104,32 +120,70 @@ public class MenuConfiguration extends BaseMenuConfiguration {
.addItem(new MenuItem()
.setID(R.id.nav_prod_recupero_materiale)
.setCodMenu("MG054")
.setTitleText(R.string.prod_recupero_materiale_title_fragment)
.setTitleIcon(R.drawable.ic_dashboard_prod_recupero_materiale)
.setDrawerIcon(R.drawable.ic_black_external)
.setFragmentFactory(ProdRecuperoMaterialeFragment::newInstance))
)
.addGroup(
new MenuGroup()
.setGroupText(R.string.internal_handling)
.setGroupId(R.id.nav_group_movimentazione_interna)
.addItem(new MenuItem()
.setID(R.id.nav_versamento_merce)
.setTitleText(R.string.versamento_merce_fragment_title)
.setTitleIcon(R.drawable.ic_dashboard_versamento_merce)
.setDrawerIcon(R.drawable.ic_black_load_shelf)
.setFragmentFactory(VersamentoMerceFragment::newInstance))
.addItem(new MenuItem()
.setID(it.integry.integrywmsnative.R.id.nav_prod_rientro_merce)
.setCodMenu("MG059")
.setTitleText(it.integry.integrywmsnative.R.string.rientro_merce_fragment_title)
.setTitleIcon(it.integry.integrywmsnative.R.drawable.ic_dashboard_prod_accettazione_produzione)
.setDrawerIcon(it.integry.integrywmsnative.R.drawable.ic_black_external)
.setFragmentFactory(ProdRientroMerceFragment::newInstance))
).addGroup(
new MenuGroup()
.setGroupText(R.string.internal_handling)
.setGroupId(R.id.nav_group_movimentazione_interna)
.setCodMenu("MM011")
.addItem(new MenuItem()
.setID(R.id.nav_rettifica_giacenze)
.setTitleText(R.string.rettifica_giacenze_fragment_title)
.setTitleIcon(R.drawable.ic_dashboard_rettifica_giacenze)
.setDrawerIcon(R.drawable.ic_black_empty_box)
.setFragmentFactory(RettificaGiacenzeFragment::newInstance))
.addItem(new MenuItem()
.setID(R.id.nav_versamento_merce)
.setCodMenu("MG055")
.setTitleText(R.string.versamento_merce_fragment_title)
.setTitleIcon(R.drawable.ic_dashboard_versamento_merce)
.setDrawerIcon(R.drawable.ic_black_load_shelf)
.setFragmentFactory(VersamentoMerceFragment::newInstance))
.addItem(new MenuItem()
.setID(R.id.nav_rettifica_giacenze)
.setCodMenu("MG056")
.setTitleText(R.string.rettifica_giacenze_fragment_title)
.setTitleIcon(R.drawable.ic_dashboard_rettifica_giacenze)
.setDrawerIcon(R.drawable.ic_black_empty_box)
.setFragmentFactory(RettificaGiacenzeFragment::newInstance))
);
).addGroup(
new MenuGroup()
.setCodMenu("MM012")
.setGroupText(it.integry.integrywmsnative.R.string.punto_vendita)
.setGroupId(it.integry.integrywmsnative.R.id.nav_group_puntivendita)
.addItem(new MenuItem()
.setCodMenu("MG057")
.setID(it.integry.integrywmsnative.R.id.nav_pv_ordini_acquisto)
.setTitleText(it.integry.integrywmsnative.R.string.generate_orders)
.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)
.setTitleText(it.integry.integrywmsnative.R.string.doc_interni)
.setTitleIcon(R.drawable.ic_dashboard_contab_doc_interni)
.setDrawerIcon(it.integry.integrywmsnative.R.drawable.ic_dashboard_contab_doc_interni)
.setFragmentFactory(DocInterniFragment::newInstance))
// .addItem(new MenuItem()
// .setID(it.integry.integrywmsnative.R.id.nav_pv_ordini_acquisto_trasmessi)
// .setTitleText(it.integry.integrywmsnative.R.string.transmitted_orders)
// .setTitleIcon(it.integry.integrywmsnative.R.drawable.ic_dashboard_trasmitted_orders_list)
// .setDrawerIcon(it.integry.integrywmsnative.R.drawable.ic_dashboard_trasmitted_orders_list)
// .setFragmentClass(PVOrdiniAcquistoTransmittedListFragment.newInstance()))
);
}

View File

@@ -7,31 +7,38 @@ import com.orhanobut.logger.AndroidLogAdapter;
import com.orhanobut.logger.Logger;
import javax.inject.Inject;
import javax.inject.Singleton;
import it.integry.integrywmsnative.BuildConfig;
import it.integry.integrywmsnative.MainApplication;
import it.integry.integrywmsnative.core.data_store.db.AppDatabase;
import it.integry.integrywmsnative.core.settings.SettingsManager;
import it.integry.integrywmsnative.core.settings.Stash;
import it.integry.integrywmsnative.core.utility.UtilityContext;
import it.integry.integrywmsnative.core.utility.UtilityResources;
import it.integry.integrywmsnative.core.utility.UtilitySettings;
import it.integry.integrywmsnative.core.utility.UtilityString;
import it.integry.integrywmsnative.core.utility.UtilityToast;
@Singleton
public class AppContext {
//Note: this is the Application Context NOT the Activity Context
private final Context mContext;
private final Context mApplicationContext;
@Inject
AppDatabase mAppDatabase;
public AppContext(Context context) {
this.mContext = context;
this.mApplicationContext = context;
MainApplication.appComponent
.inject(this);
}
@Inject
public void init() {
this.initUtilities();
@@ -43,10 +50,9 @@ public class AppContext {
}
private void initSettings() {
Stash.init(mContext);
SettingsManager.init(mContext);
Stash.init(mApplicationContext);
SettingsManager.init(mApplicationContext);
}
private void initCrashlytics() {
@@ -64,15 +70,13 @@ public class AppContext {
}
private void initUtilities() {
UtilityContext.initApplicationContext(mContext);
UtilityResources.init(mContext);
UtilityToast.init(mContext);
UtilitySettings.init(mAppDatabase);
UtilityContext.initApplicationContext(mApplicationContext);
UtilityResources.init(mApplicationContext);
UtilityToast.init(mApplicationContext);
}
private void initLogger() {
Logger.addLogAdapter(new AndroidLogAdapter());
}
}

View File

@@ -4,54 +4,81 @@ import android.content.Context;
import android.text.Html;
import android.text.SpannableString;
import android.text.Spanned;
import androidx.appcompat.app.AppCompatActivity;
import android.text.SpannedString;
import java.lang.reflect.Method;
import java.net.ConnectException;
import it.integry.integrywmsnative.MainApplication;
import it.integry.integrywmsnative.R;
import javax.inject.Singleton;
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
import it.integry.integrywmsnative.core.class_router.ClassRouter;
import it.integry.integrywmsnative.core.data_recover.ColliDataRecover;
import it.integry.integrywmsnative.core.data_store.db.AppDatabase;
import it.integry.integrywmsnative.core.menu.MenuService;
import it.integry.integrywmsnative.core.rest.watcher.ServerStatusChecker;
import it.integry.integrywmsnative.core.settings.SettingsManager;
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
import it.integry.integrywmsnative.core.utility.UtilitySettings;
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
import it.integry.integrywmsnative.core.utility.UtilityThread;
@Singleton
public class MainContext {
private final AppCompatActivity mContext;
private final Context applicationContext;
private final MenuService menuService;
private final AppDatabase appDatabase;
public MainContext(AppCompatActivity context) {
this.mContext = context;
private Listener mListener;
public MainContext(Context applicationContext, MenuService menuService, AppDatabase appDatabase) {
this.applicationContext = applicationContext;
this.menuService = menuService;
this.appDatabase = appDatabase;
}
public void init() {
public void init(Runnable onContextInitialized) {
try {
BarcodeManager.init(applicationContext);
} catch (Exception exception) {
BarcodeManager.init(mContext);
}
this.initDBData(() -> {
onContextInitialized.run();
this.initMenu(() -> {
this.initReflections();
if (mListener != null) mListener.onContextInitialized();
});
});
this.initReflections();
this.initServerStatusChecker();
ColliDataRecover.init(mContext);
}
public void logout(Runnable onLoggedOut) {
menuService.invalidateCache();
UtilityThread.executeParallel(() -> {
SettingsManager.i().setUser(null);
SettingsManager.i().setUserSession(null);
SettingsManager.update();
appDatabase.clearAllTables();
onLoggedOut.run();
}, true);
}
private void initServerStatusChecker() {
ServerStatusChecker.init();
}
private void initDBData(Runnable onComplete) {
SettingsManager.loadDBVariables(onComplete, ex -> {
SettingsManager.loadDBVariables(item -> {
if (mListener != null) mListener.onDBDataLoading(item);
},
onComplete,
ex -> {
Spanned message = null;
@@ -63,18 +90,21 @@ public class MainContext {
message = new SpannableString(ex.getMessage());
}
DialogSimpleMessageView.makeErrorDialog(
message, null, mContext::finish, R.string.logout, () -> {
UtilitySettings.logout();
MainApplication.exit();
})
.show(mContext.getSupportFragmentManager(), "tag");
if (mListener != null) mListener.onError(message);
}
);
}
private void initMenu(Runnable onComplete) {
if (mListener != null) mListener.onMenuLoading();
this.menuService.init(onComplete, ex -> {
if (mListener != null) mListener.onError(new SpannedString(ex.getMessage()));
});
}
private void initReflections() {
ClassRouter.init(mContext);
ClassRouter.init();
try {
String initMethod = "init";
@@ -87,14 +117,29 @@ public class MainContext {
// for static methods we can use null as instance of class
final Object newInstance = dynamicContextClass.newInstance();
m.invoke(newInstance, (Context) mContext);
m.invoke(newInstance, applicationContext);
break;
}
}
} catch (Exception e) {
UtilityExceptions.defaultException(mContext, e, true);
// UtilityExceptions.defaultException(mContext, e, true);
}
}
public MainContext setListener(Listener listener) {
this.mListener = listener;
return this;
}
public interface Listener {
void onDBDataLoading(String item);
void onMenuLoading();
void onContextInitialized();
void onError(Spanned message);
}
}

View File

@@ -1,235 +0,0 @@
package it.integry.integrywmsnative.core.data_recover;
import android.content.Context;
import androidx.appcompat.app.AppCompatActivity;
import com.annimon.stream.Optional;
import com.annimon.stream.Stream;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import it.integry.integrywmsnative.core.CommonConst;
import it.integry.integrywmsnative.core.model.MtbColt;
import it.integry.integrywmsnative.core.rest.model.OrdineUscitaInevasoDTO;
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
public class ColliDataRecover {
public static class RecoverDTO {
private int id;
private int numCollo;
private String serCollo;
private String dataCollo;
private String gestioneCollo;
private String filtro;
private List<OrdineUscitaInevasoDTO> testateOrdini;
public int getId() {
return id;
}
public RecoverDTO setId(int id) {
this.id = id;
return this;
}
public int getNumCollo() {
return numCollo;
}
public RecoverDTO setNumCollo(int numCollo) {
this.numCollo = numCollo;
return this;
}
public String getSerCollo() {
return serCollo;
}
public RecoverDTO setSerCollo(String serCollo) {
this.serCollo = serCollo;
return this;
}
public String getDataCollo() {
return dataCollo;
}
public RecoverDTO setDataCollo(String dataCollo) {
this.dataCollo = dataCollo;
return this;
}
public String getGestioneCollo() {
return gestioneCollo;
}
public RecoverDTO setGestioneCollo(String gestioneCollo) {
this.gestioneCollo = gestioneCollo;
return this;
}
public String getFiltro() {
return filtro;
}
public RecoverDTO setFiltro(String filtro) {
this.filtro = filtro;
return this;
}
public List<OrdineUscitaInevasoDTO> getTestateOrdini() {
return testateOrdini;
}
public RecoverDTO setTestateOrdini(List<OrdineUscitaInevasoDTO> testateOrdini) {
this.testateOrdini = testateOrdini;
return this;
}
public MtbColt getMtbColt() {
return new MtbColt()
.setNumCollo(getNumCollo())
.setSerCollo(getSerCollo())
.setGestione(getGestioneCollo())
.setDataCollo(getDataCollo())
.setFiltroOrdini(getFiltro());
}
}
private static AppCompatActivity mContext;
private static List<RecoverDTO> mtbColtsSessions = new ArrayList<>();
public static void init(AppCompatActivity context) {
mContext = context;
if(isFilePresent(CommonConst.Files.RECOVER_COLLO_FILE)) {
loadLocalFile();
}
}
public static boolean thereIsAnExistantSession() {
return mtbColtsSessions != null && mtbColtsSessions.size() > 0;
}
public static List<Integer> getAllSessionIDs() {
if(thereIsAnExistantSession()) {
return Stream.of(mtbColtsSessions)
.map(RecoverDTO::getId)
.toList();
} else return null;
}
public static RecoverDTO getSession(Integer sessionID) {
if(sessionID == null) return null;
return getIfExists(sessionID);
}
private static RecoverDTO getIfExists(int id) {
Optional<RecoverDTO> recoverDTOOptional = Stream.of(mtbColtsSessions)
.filter(x -> x.getId() == id)
.findSingle();
return recoverDTOOptional.isPresent() ? recoverDTOOptional.get() : null;
}
public static int startNewSession(MtbColt mtbColtSession, List<OrdineUscitaInevasoDTO> testateOrdini) {
Integer newId = null;
while(newId == null) {
int randomId = new Random().nextInt(1000);
RecoverDTO dto = getIfExists(randomId);
if(dto == null) newId = randomId;
}
RecoverDTO recoverDTO = new RecoverDTO()
.setId(newId)
.setDataCollo(mtbColtSession.getDataColloS())
.setNumCollo(mtbColtSession.getNumCollo())
.setSerCollo(mtbColtSession.getSerCollo())
.setGestioneCollo(mtbColtSession.getGestione())
.setFiltro(mtbColtSession.getFiltroOrdini())
.setTestateOrdini(testateOrdini);
mtbColtsSessions.add(recoverDTO);
updateLocalFile();
return newId;
}
public static void closeSession(int ID) {
RecoverDTO dto = getIfExists(ID);
if(dto != null) {
mtbColtsSessions.remove(dto);
updateLocalFile();
}
}
private static void loadLocalFile() {
InputStream inputStream;
Gson gson = new Gson();
try {
inputStream = mContext.openFileInput(CommonConst.Files.RECOVER_COLLO_FILE);
byte[] bytes = new byte[inputStream.available()];
inputStream.read(bytes);
inputStream.close();
String jsonString = new String(bytes);
Type listType = new TypeToken<ArrayList<RecoverDTO>>(){}.getType();
mtbColtsSessions = gson.fromJson(jsonString, listType);
if(mtbColtsSessions == null) mtbColtsSessions = new ArrayList<>();
} catch (Exception e) {
e.printStackTrace();
UtilityExceptions.defaultException(mContext, e);
}
}
private static void updateLocalFile() {
FileOutputStream outputStream;
Gson gson = new Gson();
String jsonText = gson.toJson(mtbColtsSessions);
try {
outputStream = mContext.openFileOutput(CommonConst.Files.RECOVER_COLLO_FILE, Context.MODE_PRIVATE);
outputStream.write(jsonText.getBytes());
outputStream.close();
} catch (Exception e) {
e.printStackTrace();
UtilityExceptions.defaultException(mContext, e);
}
}
private static boolean isFilePresent(String fileName) {
String path = mContext.getFilesDir().getAbsolutePath() + "/" + fileName;
File file = new File(path);
return file.exists();
}
}

View File

@@ -2,8 +2,6 @@ package it.integry.integrywmsnative.core.data_recover;
import android.content.Context;
import androidx.appcompat.app.AppCompatActivity;
import com.annimon.stream.Optional;
import com.annimon.stream.Stream;
import com.google.android.gms.common.util.IOUtils;
@@ -24,22 +22,20 @@ import javax.inject.Singleton;
import it.integry.integrywmsnative.core.CommonConst;
import it.integry.integrywmsnative.core.model.MtbColt;
import it.integry.integrywmsnative.core.rest.model.OrdineUscitaInevasoDTO;
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
@Singleton
public class ColliDataRecoverService {
private AppCompatActivity mContext;
private final Context mApplicationContext;
private List<ColliDataRecoverDTO> mtbColtsSessions = new ArrayList<>();
@Inject
public ColliDataRecoverService() {
public ColliDataRecoverService(Context applicationContext) {
this.mApplicationContext = applicationContext;
}
public void init(AppCompatActivity appCompatActivity) {
this.mContext = appCompatActivity;
@Inject
public void init() {
if(isFilePresent(CommonConst.Files.RECOVER_COLLO_FILE)) {
loadLocalFile();
}
@@ -114,7 +110,7 @@ public class ColliDataRecoverService {
Gson gson = new Gson();
try {
inputStream = mContext.openFileInput(CommonConst.Files.RECOVER_COLLO_FILE);
inputStream = mApplicationContext.openFileInput(CommonConst.Files.RECOVER_COLLO_FILE);
byte[] bytes = IOUtils.readInputStreamFully(inputStream);
String jsonString = new String(bytes);
@@ -125,7 +121,7 @@ public class ColliDataRecoverService {
inputStream.close();
} catch (Exception e) {
e.printStackTrace();
UtilityExceptions.defaultException(mContext, e);
// UtilityExceptions.defaultException(mContext, e);
}
}
@@ -137,17 +133,17 @@ public class ColliDataRecoverService {
String jsonText = gson.toJson(mtbColtsSessions);
try {
outputStream = mContext.openFileOutput(CommonConst.Files.RECOVER_COLLO_FILE, Context.MODE_PRIVATE);
outputStream = mApplicationContext.openFileOutput(CommonConst.Files.RECOVER_COLLO_FILE, Context.MODE_PRIVATE);
outputStream.write(jsonText.getBytes());
outputStream.close();
} catch (Exception e) {
e.printStackTrace();
UtilityExceptions.defaultException(mContext, e);
// UtilityExceptions.defaultException(mContext, e);
}
}
private boolean isFilePresent(String fileName) {
String path = mContext.getFilesDir().getAbsolutePath() + "/" + fileName;
String path = mApplicationContext.getFilesDir().getAbsolutePath() + "/" + fileName;
File file = new File(path);
return file.exists();
}

View File

@@ -8,13 +8,17 @@ import it.integry.integrywmsnative.core.data_store.db.converter.DateConverter;
import it.integry.integrywmsnative.core.data_store.db.dao.ArticoloGrigliaDao;
import it.integry.integrywmsnative.core.data_store.db.dao.ArticoloOrdineDao;
import it.integry.integrywmsnative.core.data_store.db.dao.GrigliaDao;
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.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.Ordine;
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColr;
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColt;
@Database(entities = {ArticoloGriglia.class, Griglia.class, Ordine.class, ArticoloOrdine.class}, version = 1, exportSchema = false)
@Database(entities = {ArticoloGriglia.class, Griglia.class, Ordine.class, ArticoloOrdine.class, SqlMtbColt.class, SqlMtbColr.class}, version = 5, exportSchema = false)
@TypeConverters({
DateConverter.class
})
@@ -30,26 +34,9 @@ public abstract class AppDatabase extends RoomDatabase {
public abstract ArticoloOrdineDao articoloOrdineDao();
// public static AppDatabase getDatabase(final Context context) {
// if (INSTANCE == null) {
// synchronized (AppDatabase.class) {
// if (INSTANCE == null) {
// INSTANCE = Room.databaseBuilder(context.getApplicationContext(),
// AppDatabase.class, "integry_wms")
// .fallbackToDestructiveMigration()
// .build();
// }
// }
// }
// return INSTANCE;
// }
public abstract MtbColtDao mtbColtDao();
// public AppDatabase(Application application) {
// mRoomInstance = Room.databaseBuilder(application,
// AppDatabase.class, "integry_wms")
// .fallbackToDestructiveMigration()
// .build();
// }
public abstract MtbColrDao mtbColrDao();
}

View File

@@ -11,15 +11,21 @@ import dagger.Provides;
import it.integry.integrywmsnative.core.data_store.db.dao.ArticoloGrigliaDao;
import it.integry.integrywmsnative.core.data_store.db.dao.ArticoloOrdineDao;
import it.integry.integrywmsnative.core.data_store.db.dao.GrigliaDao;
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.repository.ArticoliOrdineRepository;
import it.integry.integrywmsnative.core.data_store.db.repository.ArticoloGrigliaRepository;
import it.integry.integrywmsnative.core.data_store.db.repository.GrigliaRepository;
import it.integry.integrywmsnative.core.data_store.db.repository.MtbColrRepository;
import it.integry.integrywmsnative.core.data_store.db.repository.MtbColtRepository;
import it.integry.integrywmsnative.core.data_store.db.repository.OrdineRepository;
import it.integry.integrywmsnative.core.data_store.db.repository.implementations.ArticoliGrigliaDataSource;
import it.integry.integrywmsnative.core.data_store.db.repository.implementations.ArticoliOrdineDataSource;
import it.integry.integrywmsnative.core.data_store.db.repository.implementations.GrigliaDataSource;
import it.integry.integrywmsnative.core.data_store.db.repository.implementations.OrdineDataSource;
import it.integry.integrywmsnative.core.data_store.db.repository.implementations.SqlMtbColrDataSource;
import it.integry.integrywmsnative.core.data_store.db.repository.implementations.SqlMtbColtDataSource;
@Module
public class RoomModule {
@@ -66,6 +72,18 @@ public class RoomModule {
return appDatabase.articoloOrdineDao();
}
@Singleton
@Provides
MtbColtDao providesMtbColtDao(AppDatabase appDatabase) {
return appDatabase.mtbColtDao();
}
@Singleton
@Provides
MtbColrDao providesMtbColrDao(AppDatabase appDatabase) {
return appDatabase.mtbColrDao();
}
@@ -96,4 +114,16 @@ public class RoomModule {
return new OrdineDataSource(ordineDao);
}
@Singleton
@Provides
MtbColtRepository providesMtbColtRepository(MtbColtDao mtbColtDao) {
return new SqlMtbColtDataSource(mtbColtDao);
}
@Singleton
@Provides
MtbColrRepository providesMtbColrRepository(MtbColrDao mtbColrDao) {
return new SqlMtbColrDataSource(mtbColrDao);
}
}

View File

@@ -0,0 +1,30 @@
package it.integry.integrywmsnative.core.data_store.db.dao;
import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Query;
import androidx.room.Update;
import java.util.List;
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColr;
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColt;
@Dao
public interface MtbColrDao {
@Query("SELECT * from mtb_colr ")
List<SqlMtbColr> getAll();
@Insert
Long insert(SqlMtbColr mtbColr);
@Update
void update(SqlMtbColr mtbColr);
@Delete
void delete(SqlMtbColr mtbColr);
@Query("SELECT * from mtb_colr where id_collo = :idDocument")
List<SqlMtbColr> getDocumentRows(int idDocument);
}

View File

@@ -0,0 +1,43 @@
package it.integry.integrywmsnative.core.data_store.db.dao;
import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Query;
import androidx.room.Update;
import java.util.Date;
import java.util.List;
import it.integry.integrywmsnative.core.data_store.db.entity.Ordine;
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColt;
import it.integry.integrywmsnative.core.data_store.db.view_model.OrdineWithGriglia;
import it.integry.integrywmsnative.core.data_store.db.wrappers.DocInternoWrapper;
import it.integry.integrywmsnative.core.data_store.db.wrappers.OrdineWrapper;
@Dao
public interface MtbColtDao {
@Query("SELECT * from mtb_colt")
List<SqlMtbColt> getAll();
@Insert
Long insert(SqlMtbColt mtbColt);
@Update
void update(SqlMtbColt mtbColt);
@Delete
void delete(SqlMtbColt mtbColt);
@Query("SELECT mtb_colt.*, count(mtb_colr.id) as countArticoli from mtb_colt left outer join mtb_colr on (mtb_colr.id_collo = mtb_colt.id) where" +
" cod_dtip_provv = :codDtip " +
" AND ( cod_anag = :codAnag OR (cod_anag is null and :codAnag is null)) " +
" AND ( cod_vdes = :codVdes OR (cod_vdes is null and :codVdes is null)) " +
" AND ( mtb_colt.data_doc = :dataDoc OR (mtb_colt.data_doc is null and :dataDoc is null)) " +
" AND ( mtb_colt.num_doc = :numDoc OR (mtb_colt.num_doc is null and :numDoc is null)) " +
" and cod_dtip is null group by mtb_colt.id")
List<DocInternoWrapper> getLocalDocumentsByCodDtip(String codDtip, String codAnag, String codVdes, Date dataDoc, String numDoc);
@Query("SELECT ifnull(MAX(num_collo),0) +1 as num_collo from mtb_colt")
Integer getNextNumCollo();
}

View File

@@ -6,6 +6,8 @@ import androidx.room.ForeignKey;
import androidx.room.Index;
import androidx.room.PrimaryKey;
import java.math.BigDecimal;
import it.integry.integrywmsnative.core.utility.UtilityDate;
@Entity(
@@ -54,6 +56,18 @@ public class ArticoloGriglia {
@ColumnInfo(name = "qta_min_ordinabile")
private float qtaMinOrdinabile;
@ColumnInfo(name = "gg_scadenza")
private int ggScadenza;
@ColumnInfo(name = "giacenza")
private float giacenza;
@ColumnInfo(name = "qta_prevista_vendita")
private float qtaPrevistaVendita;
@ColumnInfo(name = "qta_proposta")
private float qtaProposta;
@ColumnInfo(name = "id_griglia")
private int idGriglia;
@@ -145,6 +159,38 @@ public class ArticoloGriglia {
this.idGriglia = idGriglia;
}
public int getGgScadenza() {
return ggScadenza;
}
public void setGgScadenza(int ggScadenza) {
this.ggScadenza = ggScadenza;
}
public float getGiacenza() {
return giacenza;
}
public void setGiacenza(float giacenza) {
this.giacenza = giacenza;
}
public float getQtaPrevistaVendita() {
return qtaPrevistaVendita;
}
public void setQtaPrevistaVendita(float qtaPrevistaVendita) {
this.qtaPrevistaVendita = qtaPrevistaVendita;
}
public float getQtaProposta() {
return qtaProposta;
}
public void setQtaProposta(float qtaProposta) {
this.qtaProposta = qtaProposta;
}
public ArticoloOrdine convertToArticoloOrdine(Ordine ordine) {
ArticoloOrdine articolo = new ArticoloOrdine();
@@ -160,6 +206,11 @@ public class ArticoloGriglia {
articolo.setUntMis(this.getUntMis());
articolo.setDescrizione(this.getDescrizione());
articolo.setDataIns(UtilityDate.getDateInstance());
articolo.setGgScadenza(this.getGgScadenza());
articolo.setGiacenza(BigDecimal.valueOf(this.getGiacenza()));
articolo.setQtaPrevistaVendita(BigDecimal.valueOf(this.getQtaPrevistaVendita()));
articolo.setQtaProposta(BigDecimal.valueOf(this.getQtaProposta()));
articolo.setQtaOrd(0);
return articolo;

View File

@@ -3,16 +3,19 @@ package it.integry.integrywmsnative.core.data_store.db.entity;
import androidx.room.ColumnInfo;
import androidx.room.Entity;
import androidx.room.ForeignKey;
import androidx.room.Ignore;
import androidx.room.Index;
import androidx.room.PrimaryKey;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Date;
@Entity(
tableName = "articoli_ordine",
indices = {
@Index(value = "id_ordine"),
@Index(value = {"id_ordine","cod_mart"}, unique = true)
@Index(value = {"id_ordine", "cod_mart"}, unique = true)
},
foreignKeys = {
@ForeignKey(
@@ -22,7 +25,7 @@ import java.util.Date;
onDelete = ForeignKey.CASCADE
)
}
)
)
public class ArticoloOrdine {
@PrimaryKey(autoGenerate = true)
@ColumnInfo(name = "articolo_ordine_id")
@@ -64,6 +67,20 @@ public class ArticoloOrdine {
@ColumnInfo(name = "data_ins")
private Date dataIns;
@Ignore
private int ggScadenza = 0;
@Ignore
private BigDecimal giacenza = BigDecimal.ZERO;
@Ignore
private BigDecimal qtaPrevistaVendita = BigDecimal.ZERO;
@Ignore
private BigDecimal qtaProposta = BigDecimal.ZERO;
public int getArticoloOrdineId() {
return articoloOrdineId;
}
@@ -167,4 +184,51 @@ public class ArticoloOrdine {
public void setDataIns(Date dataIns) {
this.dataIns = dataIns;
}
public int getGgScadenza() {
return ggScadenza;
}
public ArticoloOrdine setGgScadenza(int ggScadenza) {
this.ggScadenza = ggScadenza;
return this;
}
public BigDecimal getGiacenza() {
return giacenza;
}
public ArticoloOrdine setGiacenza(BigDecimal giacenza) {
this.giacenza = giacenza;
return this;
}
public BigDecimal getQtaPrevistaVendita() {
return qtaPrevistaVendita;
}
public ArticoloOrdine setQtaPrevistaVendita(BigDecimal qtaPrevistaVendita) {
this.qtaPrevistaVendita = qtaPrevistaVendita;
return this;
}
public BigDecimal getQtaProposta() {
return qtaProposta;
}
public ArticoloOrdine setQtaProposta(BigDecimal qtaProposta) {
this.qtaProposta = qtaProposta;
return this;
}
public BigDecimal getQtaCnfPrevistaVendita(){
return qtaPrevistaVendita.equals(BigDecimal.ZERO) ? BigDecimal.ZERO : qtaPrevistaVendita.divide(BigDecimal.valueOf(qtaCnf),0, RoundingMode.CEILING);
}
public BigDecimal getQtaCnfProposta(){
return qtaProposta.equals(BigDecimal.ZERO) ? BigDecimal.ZERO : qtaProposta.divide(BigDecimal.valueOf(qtaCnf),0, RoundingMode.CEILING);
}
public BigDecimal getQtaCnfGiacenza(){
return giacenza.equals(BigDecimal.ZERO) ? BigDecimal.ZERO : giacenza.divide(BigDecimal.valueOf(qtaCnf),0, RoundingMode.CEILING);
}
}

View File

@@ -0,0 +1,438 @@
package it.integry.integrywmsnative.core.data_store.db.entity;
import androidx.room.ColumnInfo;
import androidx.room.Entity;
import androidx.room.ForeignKey;
import androidx.room.Index;
import androidx.room.PrimaryKey;
import java.math.BigDecimal;
import java.util.Date;
@Entity(
tableName = "mtb_colr",
indices = {
@Index(value = {"data_collo", "ser_collo", "num_collo", "gestione","riga"}, unique = true),
@Index(value = {"id_collo"})
},
foreignKeys = {
@ForeignKey(
entity = SqlMtbColt.class,
parentColumns = "id",
childColumns = "id_collo",
onDelete = ForeignKey.CASCADE
)
}
)
public class SqlMtbColr {
@PrimaryKey(autoGenerate = true)
@ColumnInfo(name = "id")
private int id;
@ColumnInfo(name = "id_collo")
private int idCollo;
@ColumnInfo(name = "data_collo")
private Date dataCollo;
@ColumnInfo(name = "gestione")
private String gestione;
@ColumnInfo(name = "ser_collo")
private String serCollo;
@ColumnInfo(name = "descrizione")
private String descrizione;
@ColumnInfo(name = "num_collo")
private Integer numCollo;
@ColumnInfo(name = "riga")
private Integer riga;
@ColumnInfo(name = "riga_ord")
private Integer rigaOrd;
@ColumnInfo(name = "cod_mart")
private String codMart;
@ColumnInfo(name = "cod_barre")
private String codBarre;
@ColumnInfo(name = "cod_col")
private String codCol;
@ColumnInfo(name = "cod_tagl")
private String codTagl;
@ColumnInfo(name = "partita_mag")
private String partitaMag;
@ColumnInfo(name = "gestione_rif")
private String gestioneRif;
@ColumnInfo(name = "ser_collo_rif")
private String serColloRif;
@ColumnInfo(name = "note")
private String note;
@ColumnInfo(name = "data_ord")
private Date dataOrd;
@ColumnInfo(name = "data_collo_rif")
private Date dataColloRif;
@ColumnInfo(name = "qta_cnf")
private Float qtaCnf;
@ColumnInfo(name = "qta_col")
private Float qtaCol;
@ColumnInfo(name = "num_ord")
private Integer numOrd;
@ColumnInfo(name = "num_etich")
private Integer numEtich;
@ColumnInfo(name = "num_collo_rif")
private Integer numColloRif;
@ColumnInfo(name = "datetime_row")
private Date datetimeRow;
@ColumnInfo(name = "cod_jcom")
private String codJcom;
@ColumnInfo(name = "num_cnf")
private Float numCnf;
@ColumnInfo(name = "causale")
private String causale;
@ColumnInfo(name = "utente")
private String utente;
@ColumnInfo(name = "cod_anag_doc")
private String codAnagDoc;
@ColumnInfo(name = "cod_dtip_doc")
private String codDtipDoc;
@ColumnInfo(name = "data_doc")
private Date dataDoc;
@ColumnInfo(name = "ser_doc")
private String serDoc;
@ColumnInfo(name = "num_doc")
private Integer numDoc;
@ColumnInfo(name = "id_riga_doc")
private Integer idRigaDoc;
@ColumnInfo(name = "unt_mis")
private String untMis;
@ColumnInfo(name = "data_scad")
private Date dataScad;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getIdCollo() {
return idCollo;
}
public void setIdCollo(int idCollo) {
this.idCollo = idCollo;
}
public Date getDataCollo() {
return dataCollo;
}
public void setDataCollo(Date dataCollo) {
this.dataCollo = dataCollo;
}
public String getGestione() {
return gestione;
}
public void setGestione(String gestione) {
this.gestione = gestione;
}
public String getSerCollo() {
return serCollo;
}
public void setSerCollo(String serCollo) {
this.serCollo = serCollo;
}
public Integer getNumCollo() {
return numCollo;
}
public void setNumCollo(Integer numCollo) {
this.numCollo = numCollo;
}
public Integer getRiga() {
return riga;
}
public void setRiga(Integer riga) {
this.riga = riga;
}
public Integer getRigaOrd() {
return rigaOrd;
}
public void setRigaOrd(Integer rigaOrd) {
this.rigaOrd = rigaOrd;
}
public String getCodMart() {
return codMart;
}
public void setCodMart(String codMart) {
this.codMart = codMart;
}
public String getCodBarre() {
return codBarre;
}
public void setCodBarre(String codBarre) {
this.codBarre = codBarre;
}
public String getCodCol() {
return codCol;
}
public void setCodCol(String codCol) {
this.codCol = codCol;
}
public String getCodTagl() {
return codTagl;
}
public void setCodTagl(String codTagl) {
this.codTagl = codTagl;
}
public String getPartitaMag() {
return partitaMag;
}
public void setPartitaMag(String partitaMag) {
this.partitaMag = partitaMag;
}
public String getGestioneRif() {
return gestioneRif;
}
public void setGestioneRif(String gestioneRif) {
this.gestioneRif = gestioneRif;
}
public String getSerColloRif() {
return serColloRif;
}
public void setSerColloRif(String serColloRif) {
this.serColloRif = serColloRif;
}
public String getNote() {
return note;
}
public void setNote(String note) {
this.note = note;
}
public Date getDataOrd() {
return dataOrd;
}
public void setDataOrd(Date dataOrd) {
this.dataOrd = dataOrd;
}
public Date getDataColloRif() {
return dataColloRif;
}
public void setDataColloRif(Date dataColloRif) {
this.dataColloRif = dataColloRif;
}
public Float getQtaCnf() {
return qtaCnf;
}
public void setQtaCnf(Float qtaCnf) {
this.qtaCnf = qtaCnf;
}
public Float getQtaCol() {
return qtaCol;
}
public void setQtaCol(Float qtaCol) {
this.qtaCol = qtaCol;
}
public Integer getNumOrd() {
return numOrd;
}
public void setNumOrd(Integer numOrd) {
this.numOrd = numOrd;
}
public Integer getNumEtich() {
return numEtich;
}
public void setNumEtich(Integer numEtich) {
this.numEtich = numEtich;
}
public Integer getNumColloRif() {
return numColloRif;
}
public void setNumColloRif(Integer numColloRif) {
this.numColloRif = numColloRif;
}
public Date getDatetimeRow() {
return datetimeRow;
}
public void setDatetimeRow(Date datetimeRow) {
this.datetimeRow = datetimeRow;
}
public String getCodJcom() {
return codJcom;
}
public void setCodJcom(String codJcom) {
this.codJcom = codJcom;
}
public Float getNumCnf() {
return numCnf;
}
public void setNumCnf(Float numCnf) {
this.numCnf = numCnf;
}
public String getCausale() {
return causale;
}
public void setCausale(String causale) {
this.causale = causale;
}
public String getUtente() {
return utente;
}
public void setUtente(String utente) {
this.utente = utente;
}
public String getCodAnagDoc() {
return codAnagDoc;
}
public void setCodAnagDoc(String codAnagDoc) {
this.codAnagDoc = codAnagDoc;
}
public String getCodDtipDoc() {
return codDtipDoc;
}
public void setCodDtipDoc(String codDtipDoc) {
this.codDtipDoc = codDtipDoc;
}
public Date getDataDoc() {
return dataDoc;
}
public void setDataDoc(Date dataDoc) {
this.dataDoc = dataDoc;
}
public String getSerDoc() {
return serDoc;
}
public void setSerDoc(String serDoc) {
this.serDoc = serDoc;
}
public Integer getNumDoc() {
return numDoc;
}
public void setNumDoc(Integer numDoc) {
this.numDoc = numDoc;
}
public Integer getIdRigaDoc() {
return idRigaDoc;
}
public void setIdRigaDoc(Integer idRigaDoc) {
this.idRigaDoc = idRigaDoc;
}
public String getUntMis() {
return untMis;
}
public void setUntMis(String untMis) {
this.untMis = untMis;
}
public String getDescrizione() {
return descrizione;
}
public void setDescrizione(String descrizione) {
this.descrizione = descrizione;
}
public Date getDataScad() {
return dataScad;
}
public void setDataScad(Date dataScad) {
this.dataScad = dataScad;
}
}

View File

@@ -0,0 +1,341 @@
package it.integry.integrywmsnative.core.data_store.db.entity;
import androidx.room.ColumnInfo;
import androidx.room.Entity;
import androidx.room.Ignore;
import androidx.room.Index;
import androidx.room.PrimaryKey;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@Entity(
tableName = "mtb_colt",
indices = {
@Index(value = {"data_collo", "ser_collo", "num_collo", "gestione"}, unique = true)
}
)
public class SqlMtbColt {
@PrimaryKey(autoGenerate = true)
@ColumnInfo(name = "id")
private int id;
@ColumnInfo(name = "username")
private String username;
@ColumnInfo
private String gestione;
@ColumnInfo(name = "data_collo")
private Date dataCollo;
@ColumnInfo(name = "ser_collo")
private String serCollo;
@ColumnInfo(name = "num_collo")
private Integer numCollo;
@ColumnInfo(name = "rif_ord")
private String rifOrd;
@ColumnInfo(name = "cod_anag")
private String codAnag;
@ColumnInfo(name = "cod_vdes")
private String codVdes;
@ColumnInfo(name = "cod_mdep")
private String codMdep;
@ColumnInfo(name = "cod_vlis")
private String codVlis;
@ColumnInfo(name = "cod_dtip")
private String codDtip;
@ColumnInfo(name = "cod_tcol")
private String codTcol;
@ColumnInfo(name = "ser_doc")
private String serDoc;
@ColumnInfo(name = "annotazioni")
private String annotazioni;
@ColumnInfo(name = "posizione")
private String posizione;
@ColumnInfo(name = "cod_dtip_provv")
private String codDtipProvv;
@ColumnInfo(name = "ser_doc_provv")
private String serDocProvv;
@ColumnInfo(name = "cod_jfas")
private String codJfas;
@ColumnInfo(name = "data_ord")
private Date dataOrd;
@ColumnInfo(name = "data_doc")
private Date dataDoc;
@ColumnInfo(name = "data_doc_provv")
private Date dataDocProvv;
@ColumnInfo(name = "cod_mgrp")
private String codMgrp;
@ColumnInfo(name = "data_vers")
private Date dataVers;
@ColumnInfo(name = "segno")
private Integer segno;
@ColumnInfo(name = "num_ord")
private Integer numOrd;
@ColumnInfo(name = "num_doc")
private Integer numDoc;
@ColumnInfo(name = "num_doc_provv")
private Integer numDocProvv;
@Ignore
private List<SqlMtbColr> sqlMtbColrs = new ArrayList<>();
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getGestione() {
return gestione;
}
public void setGestione(String gestione) {
this.gestione = gestione;
}
public Date getDataCollo() {
return dataCollo;
}
public void setDataCollo(Date dataCollo) {
this.dataCollo = dataCollo;
}
public String getSerCollo() {
return serCollo;
}
public void setSerCollo(String serCollo) {
this.serCollo = serCollo;
}
public Integer getNumCollo() {
return numCollo;
}
public void setNumCollo(Integer numCollo) {
this.numCollo = numCollo;
}
public String getRifOrd() {
return rifOrd;
}
public void setRifOrd(String rifOrd) {
this.rifOrd = rifOrd;
}
public String getCodAnag() {
return codAnag;
}
public void setCodAnag(String codAnag) {
this.codAnag = codAnag;
}
public String getCodVdes() {
return codVdes;
}
public void setCodVdes(String codVdes) {
this.codVdes = codVdes;
}
public String getCodMdep() {
return codMdep;
}
public void setCodMdep(String codMdep) {
this.codMdep = codMdep;
}
public String getCodVlis() {
return codVlis;
}
public void setCodVlis(String codVlis) {
this.codVlis = codVlis;
}
public String getCodDtip() {
return codDtip;
}
public void setCodDtip(String codDtip) {
this.codDtip = codDtip;
}
public String getCodTcol() {
return codTcol;
}
public void setCodTcol(String codTcol) {
this.codTcol = codTcol;
}
public String getSerDoc() {
return serDoc;
}
public void setSerDoc(String serDoc) {
this.serDoc = serDoc;
}
public String getAnnotazioni() {
return annotazioni;
}
public void setAnnotazioni(String annotazioni) {
this.annotazioni = annotazioni;
}
public String getPosizione() {
return posizione;
}
public void setPosizione(String posizione) {
this.posizione = posizione;
}
public String getCodDtipProvv() {
return codDtipProvv;
}
public void setCodDtipProvv(String codDtipProvv) {
this.codDtipProvv = codDtipProvv;
}
public String getSerDocProvv() {
return serDocProvv;
}
public void setSerDocProvv(String serDocProvv) {
this.serDocProvv = serDocProvv;
}
public String getCodJfas() {
return codJfas;
}
public void setCodJfas(String codJfas) {
this.codJfas = codJfas;
}
public Date getDataOrd() {
return dataOrd;
}
public void setDataOrd(Date dataOrd) {
this.dataOrd = dataOrd;
}
public Date getDataDoc() {
return dataDoc;
}
public void setDataDoc(Date dataDoc) {
this.dataDoc = dataDoc;
}
public Date getDataDocProvv() {
return dataDocProvv;
}
public void setDataDocProvv(Date dataDocProvv) {
this.dataDocProvv = dataDocProvv;
}
public Date getDataVers() {
return dataVers;
}
public void setDataVers(Date dataVers) {
this.dataVers = dataVers;
}
public Integer getSegno() {
return segno;
}
public void setSegno(Integer segno) {
this.segno = segno;
}
public Integer getNumOrd() {
return numOrd;
}
public void setNumOrd(Integer numOrd) {
this.numOrd = numOrd;
}
public Integer getNumDoc() {
return numDoc;
}
public void setNumDoc(Integer numDoc) {
this.numDoc = numDoc;
}
public Integer getNumDocProvv() {
return numDocProvv;
}
public void setNumDocProvv(Integer numDocProvv) {
this.numDocProvv = numDocProvv;
}
public List<SqlMtbColr> getSqlMtbColrs() {
return sqlMtbColrs;
}
public void setSqlMtbColrs(List<SqlMtbColr> sqlMtbColrs) {
this.sqlMtbColrs = sqlMtbColrs;
}
public String getCodMgrp() {
return codMgrp;
}
public void setCodMgrp(String codMgrp) {
this.codMgrp = codMgrp;
}
}

View File

@@ -0,0 +1,21 @@
package it.integry.integrywmsnative.core.data_store.db.repository;
import java.util.List;
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.expansion.RunnableArgs;
public interface MtbColrRepository {
void selectAll(RunnableArgs<List<SqlMtbColr>> onSuccess, RunnableArgs<Exception> onError);
void insert(SqlMtbColr mtbColr, RunnableArgs<Integer> onSuccess, RunnableArgs<Exception> onError);
void update(SqlMtbColr mtbColr, RunnableArgs<SqlMtbColr> onSuccess, RunnableArgs<Exception> onError);
void delete(SqlMtbColr mtbColr, Runnable onSuccess, RunnableArgs<Exception> onError);
void getDocumentRows(SqlMtbColt sqlMtbColt, RunnableArgs<List<SqlMtbColr>> onSuccess, RunnableArgs<Exception> onError);
}

View File

@@ -0,0 +1,28 @@
package it.integry.integrywmsnative.core.data_store.db.repository;
import java.util.Date;
import java.util.List;
import it.integry.integrywmsnative.core.data_store.db.entity.Griglia;
import it.integry.integrywmsnative.core.data_store.db.entity.Ordine;
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColt;
import it.integry.integrywmsnative.core.data_store.db.view_model.OrdineWithGriglia;
import it.integry.integrywmsnative.core.data_store.db.wrappers.DocInternoWrapper;
import it.integry.integrywmsnative.core.data_store.db.wrappers.OrdineWrapper;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
public interface MtbColtRepository {
void selectAll(RunnableArgs<List<SqlMtbColt>> onSuccess, RunnableArgs<Exception> onError);
void insert(SqlMtbColt mtbColt, RunnableArgs<Integer> onSuccess, RunnableArgs<Exception> onError);
void update(SqlMtbColt mtbColt, RunnableArgs<SqlMtbColt> onSuccess, RunnableArgs<Exception> onError);
void delete(SqlMtbColt mtbColt, Runnable onSuccess, RunnableArgs<Exception> onError);
void getLocalDocumentsByCodDtip(String codDtip, String codAnag, String codVdes, Date dataDoc, String numDoc, RunnableArgs<List<DocInternoWrapper>> onSuccess, RunnableArgs<Exception> onError);
void getNextNumCollo(RunnableArgs<Integer> onSuccess, RunnableArgs<Exception> onError);
}

View File

@@ -0,0 +1,77 @@
package it.integry.integrywmsnative.core.data_store.db.repository.implementations;
import java.util.List;
import javax.inject.Inject;
import it.integry.integrywmsnative.core.data_store.db.dao.MtbColrDao;
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.repository.MtbColrRepository;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
public class SqlMtbColrDataSource extends Repository implements MtbColrRepository {
private MtbColrDao mMtbColrDao;
@Inject
public SqlMtbColrDataSource(MtbColrDao mtbColrDao) {
this.mMtbColrDao = mtbColrDao;
}
public void selectAll(RunnableArgs<List<SqlMtbColr>> onSuccess, RunnableArgs<Exception> onError) {
Runnable query = () -> {
try {
onSuccess.run(mMtbColrDao.getAll());
} catch (Exception e) {
onError.run(e);
}
};
execute(query);
}
public void insert(SqlMtbColr mtbColr, RunnableArgs<Integer> onSuccess, RunnableArgs<Exception> onError) {
execute(() -> {
try {
Long id = mMtbColrDao.insert(mtbColr);
onSuccess.run(id.intValue());
} catch (Exception e) {
onError.run(e);
}
});
}
public void update(SqlMtbColr mtbColr, RunnableArgs<SqlMtbColr> onSuccess, RunnableArgs<Exception> onError) {
execute(() -> {
try {
mMtbColrDao.update(mtbColr);
onSuccess.run(mtbColr);
} catch (Exception e) {
onError.run(e);
}
});
}
public void delete(SqlMtbColr mtbColr, Runnable onSuccess, RunnableArgs<Exception> onError) {
execute(() -> {
try {
mMtbColrDao.delete(mtbColr);
onSuccess.run();
} catch (Exception e) {
onError.run(e);
}
});
}
public void getDocumentRows(SqlMtbColt document, RunnableArgs<List<SqlMtbColr>> onSuccess, RunnableArgs<Exception> onError) {
Runnable query = () -> {
try {
onSuccess.run(mMtbColrDao.getDocumentRows(document.getId()));
} catch (Exception e) {
onError.run(e);
}
};
execute(query);
}
}

View File

@@ -0,0 +1,93 @@
package it.integry.integrywmsnative.core.data_store.db.repository.implementations;
import java.util.Date;
import java.util.List;
import javax.inject.Inject;
import it.integry.integrywmsnative.core.data_store.db.dao.MtbColtDao;
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColt;
import it.integry.integrywmsnative.core.data_store.db.repository.MtbColtRepository;
import it.integry.integrywmsnative.core.data_store.db.wrappers.DocInternoWrapper;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
public class SqlMtbColtDataSource extends Repository implements MtbColtRepository {
private MtbColtDao mMtbColtDao;
@Inject
public SqlMtbColtDataSource(MtbColtDao mtbColtDao) {
this.mMtbColtDao = mtbColtDao;
}
public void selectAll(RunnableArgs<List<SqlMtbColt>> onSuccess, RunnableArgs<Exception> onError) {
Runnable query = () -> {
try {
onSuccess.run(mMtbColtDao.getAll());
} catch (Exception e) {
onError.run(e);
}
};
execute(query);
}
public void insert(SqlMtbColt mtbColt, RunnableArgs<Integer> onSuccess, RunnableArgs<Exception> onError) {
execute(() -> {
try {
Long id = mMtbColtDao.insert(mtbColt);
onSuccess.run(id.intValue());
} catch (Exception e) {
onError.run(e);
}
});
}
public void update(SqlMtbColt mtbColt, RunnableArgs<SqlMtbColt> onSuccess, RunnableArgs<Exception> onError) {
execute(() -> {
try {
mMtbColtDao.update(mtbColt);
onSuccess.run(mtbColt);
} catch (Exception e) {
onError.run(e);
}
});
}
public void delete(SqlMtbColt mtbColt, Runnable onSuccess, RunnableArgs<Exception> onError) {
execute(() -> {
try {
mMtbColtDao.delete(mtbColt);
onSuccess.run();
} catch (Exception e) {
onError.run(e);
}
});
}
@Override
public void getLocalDocumentsByCodDtip(String codDtip, String codAnag, String codVdes, Date dataDoc, String numDoc, RunnableArgs<List<DocInternoWrapper>> onSuccess, RunnableArgs<Exception> onError) {
Runnable query = () -> {
try {
onSuccess.run(mMtbColtDao.getLocalDocumentsByCodDtip(codDtip,codAnag,codVdes,dataDoc,numDoc));
} catch (Exception e) {
onError.run(e);
}
};
execute(query);
}
@Override
public void getNextNumCollo(RunnableArgs<Integer> onSuccess, RunnableArgs<Exception> onError) {
Runnable query = () -> {
try {
onSuccess.run(mMtbColtDao.getNextNumCollo());
} catch (Exception e) {
onError.run(e);
}
};
execute(query);
}
}

View File

@@ -1,34 +1,38 @@
package it.integry.integrywmsnative.core.data_store.db.view_model;
import androidx.room.ColumnInfo;
import it.integry.integrywmsnative.core.data_store.db.entity.ArticoloGriglia;
public class ArticoloDTO {
private String codMart;
private String descrizione;
private String untMis;
private float qtaCnf;
private String barcode;
private float merceDaRic;
private float mediaSett;
private String flagQtaMultipla;
private float qtaCnf;
private float merceDaRic;
private float mediaSett;
private float qtaMinOrdinabile;
private int ggScadenza;
private float giacenza;
private float qtaPrevistaVendita;
private float qtaProposta;
public String getCodMart() {
return codMart;
}
@@ -101,8 +105,47 @@ public class ArticoloDTO {
this.qtaMinOrdinabile = qtaMinOrdinabile;
}
public String getBarcode() {
return barcode;
}
public ArticoloGriglia toArticoloGriglia(){
public void setBarcode(String barcode) {
this.barcode = barcode;
}
public int getGgScadenza() {
return ggScadenza;
}
public void setGgScadenza(int ggScadenza) {
this.ggScadenza = ggScadenza;
}
public float getGiacenza() {
return giacenza;
}
public void setGiacenza(float giacenza) {
this.giacenza = giacenza;
}
public float getQtaPrevistaVendita() {
return qtaPrevistaVendita;
}
public void setQtaPrevistaVendita(float qtaPrevistaVendita) {
this.qtaPrevistaVendita = qtaPrevistaVendita;
}
public float getQtaProposta() {
return qtaProposta;
}
public void setQtaProposta(float qtaProposta) {
this.qtaProposta = qtaProposta;
}
public ArticoloGriglia toArticoloGriglia() {
ArticoloGriglia result = new ArticoloGriglia();
result.setBarCode(this.getBarCode());
result.setDescrizione(this.getDescrizione());
@@ -113,6 +156,10 @@ public class ArticoloDTO {
result.setMediaSett(this.getMediaSett());
result.setFlagQtaMultipla(this.getFlagQtaMultipla());
result.setQtaMinOrdinabile(this.getQtaMinOrdinabile());
result.setGgScadenza(this.ggScadenza);
result.setGiacenza(this.giacenza);
result.setQtaPrevistaVendita(this.qtaPrevistaVendita);
result.setQtaProposta(this.qtaProposta);
return result;
}

View File

@@ -0,0 +1,30 @@
package it.integry.integrywmsnative.core.data_store.db.wrappers;
import androidx.room.ColumnInfo;
import androidx.room.Embedded;
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColt;
public class DocInternoWrapper {
@Embedded
private SqlMtbColt document;
@ColumnInfo(name = "countArticoli")
private int countArticoli = 0;
public SqlMtbColt getDocument() {
return document;
}
public void setDocument(SqlMtbColt document) {
this.document = document;
}
public int getCountArticoli() {
return countArticoli;
}
public void setCountArticoli(int countArticoli) {
this.countArticoli = countArticoli;
}
}

View File

@@ -0,0 +1,127 @@
package it.integry.integrywmsnative.core.di;
import androidx.annotation.NonNull;
import androidx.databinding.Bindable;
import androidx.databinding.Observable;
import androidx.databinding.PropertyChangeRegistry;
import java.math.BigDecimal;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
public class BindableBigDecimal implements Observable {
BigDecimal mValue;
private transient PropertyChangeRegistry mCallbacks;
public BindableBigDecimal() {
}
public BindableBigDecimal(BigDecimal startValue) {
this.mValue = startValue;
}
@Override
public void addOnPropertyChangedCallback(@NonNull OnPropertyChangedCallback callback) {
synchronized (this) {
if (mCallbacks == null) {
mCallbacks = new PropertyChangeRegistry();
}
}
mCallbacks.add(callback);
}
public void addOnPropertyChangedCallback(@NonNull Runnable callback) {
synchronized (this) {
if (mCallbacks == null) {
mCallbacks = new PropertyChangeRegistry();
}
}
mCallbacks.add(new OnPropertyChangedCallback() {
@Override
public void onPropertyChanged(Observable sender, int propertyId) {
callback.run();
}
});
}
@Override
public void removeOnPropertyChangedCallback(@NonNull OnPropertyChangedCallback callback) {
synchronized (this) {
if (mCallbacks == null) {
return;
}
}
mCallbacks.remove(callback);
}
public void resetOnPropertyChangedCallback() {
synchronized (this) {
if (mCallbacks == null) {
return;
}
}
mCallbacks.clear();
mCallbacks = null;
}
/**
* Notifies listeners that all properties of this instance have changed.
*/
public void notifyChange() {
synchronized (this) {
if (mCallbacks == null) {
return;
}
}
mCallbacks.notifyCallbacks(this, 0, null);
}
/**
* Notifies listeners that a specific property has changed. The getter for the property
* that changes should be marked with {@link Bindable} to generate a field in
* <code>BR</code> to be used as <code>fieldId</code>.
*
* @param fieldId The generated BR id for the Bindable field.
*/
public void notifyPropertyChanged(int fieldId) {
synchronized (this) {
if (mCallbacks == null) {
return;
}
}
mCallbacks.notifyCallbacks(this, fieldId, null);
}
public BigDecimal get() {
return mValue;
}
public void set(BigDecimal value) {
this.set(value, false);
}
public void set(BigDecimal value, boolean forceRefresh) {
if ((mValue == null) || !mValue.equals(value) || forceRefresh) {
this.mValue = value;
notifyChange();
}
}
public static void registerListener(BindableBigDecimal bindableBigDecimal, RunnableArgs<BigDecimal> onValueChanged) {
bindableBigDecimal.addOnPropertyChangedCallback(new OnPropertyChangedCallback() {
@Override
public void onPropertyChanged(Observable sender, int propertyId) {
if(onValueChanged != null) onValueChanged.run(bindableBigDecimal.get());
}
});
}
public static void resetListeners(BindableBigDecimal bindableBigDecimal){
BigDecimal oldValue = bindableBigDecimal.get();
bindableBigDecimal = new BindableBigDecimal();
bindableBigDecimal.set(oldValue);
}
}

View File

@@ -1,12 +1,11 @@
package it.integry.integrywmsnative.core.di;
import androidx.annotation.NonNull;
import androidx.databinding.BaseObservable;
import androidx.databinding.Bindable;
import androidx.databinding.Observable;
import androidx.databinding.PropertyChangeRegistry;
public class BindableBoolean implements Observable {
public class BindableBoolean implements Observable {
boolean mValue;
@@ -105,5 +104,9 @@ public class BindableBoolean implements Observable {
notifyChange();
}
}
public void toggle() {
set(!get());
}
}

View File

@@ -1,6 +1,9 @@
package it.integry.integrywmsnative.core.di;
import androidx.databinding.BaseObservable;
import androidx.databinding.Observable;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
public class BindableInteger extends BaseObservable {
Integer mValue;
@@ -34,4 +37,19 @@ public class BindableInteger extends BaseObservable {
return mValue == null;
}
public static void registerListener(BindableInteger bindableInteger, RunnableArgs<Integer> onValueChanged) {
bindableInteger.addOnPropertyChangedCallback(new OnPropertyChangedCallback() {
@Override
public void onPropertyChanged(Observable sender, int propertyId) {
if(onValueChanged != null) onValueChanged.run(bindableInteger.get());
}
});
}
public static void resetListeners(BindableInteger bindableInteger){
Integer oldValue = bindableInteger.get();
bindableInteger = new BindableInteger();
bindableInteger.set(oldValue);
}
}

View File

@@ -7,6 +7,20 @@ import it.integry.integrywmsnative.core.expansion.RunnableArgs;
public class BindableString extends BaseObservable {
String value;
private boolean isHtml = false;
public BindableString(){};
public BindableString(boolean isHtml){
this.isHtml = isHtml;
};
public BindableString(String startingValue ,boolean isHtml){
this.isHtml = isHtml;
this.set(startingValue);
};
public boolean isHtml() {
return isHtml;
}
public String get() {
return value != null ? value : "";

View File

@@ -2,6 +2,8 @@ package it.integry.integrywmsnative.core.di;
import android.app.DatePickerDialog;
import android.content.res.ColorStateList;
import android.text.Html;
import android.text.SpannableString;
import android.util.Log;
import android.view.View;
import android.widget.AutoCompleteTextView;
@@ -37,18 +39,20 @@ import java.util.Locale;
import it.integry.integrywmsnative.MainApplication;
import it.integry.integrywmsnative.R;
import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.utility.UtilityBigDecimal;
import it.integry.integrywmsnative.core.utility.UtilityDate;
import it.integry.integrywmsnative.core.utility.UtilityNumber;
import it.integry.integrywmsnative.core.utility.UtilityString;
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
public class Converters {
@BindingConversion
public static String convertBindableToString(BindableString bindableString) {
if(bindableString != null) return bindableString.get();
if (bindableString != null) return bindableString.get();
return "";
}
@@ -72,7 +76,8 @@ public class Converters {
TextWatcherAdapter watcher = new TextWatcherAdapter() {
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
if(bindableInteger != null) bindableInteger.set(Integer.parseInt(s.toString()));
if (bindableInteger != null)
bindableInteger.set(Integer.parseInt(s.toString()));
}
};
view.setTag(R.id.bound_observable, new Pair<>(bindableInteger, watcher));
@@ -94,7 +99,7 @@ public class Converters {
TextWatcherAdapter watcher = new TextWatcherAdapter() {
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
if(observableField != null) observableField.set(s.toString());
if (observableField != null) observableField.set(s.toString());
}
};
view.setTag(R.id.bound_observable, new Pair<>(observableField, watcher));
@@ -123,8 +128,9 @@ public class Converters {
view.addTextChangedListener(watcher);
}
String newValue = bindableString.get();
boolean isHtml = bindableString.isHtml();
if (!view.getText().toString().equals(newValue)) {
view.setText(newValue);
view.setText(isHtml ? Html.fromHtml(newValue) : newValue);
}
}
@@ -150,6 +156,28 @@ public class Converters {
}
}
@BindingAdapter("binding")
public static void bindEditText(AutoCompleteTextView view, final ObservableField<String> observableString) {
Pair<ObservableField<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, false);
}
}
@BindingAdapter("binding")
public static void bindTextInputEditText(TextInputEditText view, final BindableString bindableString) {
Pair<BindableString, TextWatcherAdapter> pair = (Pair) view.getTag(R.id.bound_observable);
@@ -183,7 +211,8 @@ public class Converters {
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
BigDecimal value = null;
if(!UtilityString.isNullOrEmpty(s.toString())) value = new BigDecimal(s.toString());
if (!UtilityString.isNullOrEmpty(s.toString()))
value = new BigDecimal(s.toString());
observableBigDecimal.set(value);
}
};
@@ -193,11 +222,65 @@ public class Converters {
BigDecimal newValue = observableBigDecimal.get();
BigDecimal viewValue = view.getText().toString().trim().length() > 0 ? new BigDecimal(view.getText().toString()) : null;
if(!UtilityBigDecimal.equalsTo(viewValue, newValue)) {
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);
if (pair == null || pair.first != bindableBigDecimal) {
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;
if (!UtilityString.isNullOrEmpty(s.toString()))
value = new BigDecimal(s.toString());
bindableBigDecimal.set(value);
}
};
view.setTag(R.id.bound_observable, new Pair<>(bindableBigDecimal, watcher));
view.addTextChangedListener(watcher);
}
BigDecimal newValue = bindableBigDecimal.get();
BigDecimal viewValue = view.getText().toString().trim().length() > 0 ? new BigDecimal(view.getText().toString()) : null;
if (!UtilityBigDecimal.equalsTo(viewValue, newValue)) {
view.setText(UtilityNumber.decimalToString(newValue));
}
}
@BindingAdapter("binding")
public static void bindTextInputEditTextInteger(TextInputEditText view, final BindableInteger bindableInteger) {
Pair<BindableInteger, TextWatcherAdapter> pair = (Pair) view.getTag(R.id.bound_observable);
if (pair == null || pair.first != bindableInteger) {
if (pair != null) {
view.removeTextChangedListener(pair.second);
}
TextWatcherAdapter watcher = new TextWatcherAdapter() {
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
Integer value = null;
if (!UtilityString.isNullOrEmpty(s.toString()))
value = Integer.valueOf(s.toString());
bindableInteger.set(value);
}
};
view.setTag(R.id.bound_observable, new Pair<>(bindableInteger, watcher));
view.addTextChangedListener(watcher);
}
Integer newValue = bindableInteger.get();
Integer viewValue = view.getText().toString().trim().length() > 0 ? Integer.valueOf(view.getText().toString()) : Integer.valueOf(0);
if (!(viewValue.compareTo(newValue) == 0)) {
view.setText(newValue.toString());
}
}
@BindingAdapter("binding")
public static void bindTextInputEditTextString(TextInputEditText view, final ObservableField<String> observableString) {
Pair<ObservableField<String>, TextWatcherAdapter> pair = (Pair) view.getTag(R.id.bound_observable);
@@ -217,13 +300,13 @@ public class Converters {
String newValue = observableString.get();
String viewValue = view.getText().toString();
if(!viewValue.equalsIgnoreCase(newValue)) {
if (!viewValue.equalsIgnoreCase(newValue)) {
view.setText(newValue);
}
}
@BindingAdapter({"binding"})
public static void bindTextInputEditTextDate(TextInputEditText view, final ObservableField<Date> observableDate) {
@BindingAdapter(value = {"binding", "parentView", "warningOnOldDates"}, requireAll = false)
public static void bindTextInputEditTextDate(TextInputEditText view, final ObservableField<Date> observableDate, BaseDialogFragment parentFragment, boolean warningOnOldDates) {
Pair<ObservableField<Date>, TextWatcherAdapter> pair = (Pair) view.getTag(R.id.bound_observable);
if (pair == null || pair.first != observableDate) {
if (pair != null) {
@@ -241,7 +324,7 @@ public class Converters {
// Get Current Date
Calendar c = UtilityDate.getCalendarInstance();
if(observableDate.get() != null) {
if (observableDate.get() != null) {
c.setTime(observableDate.get());
}
@@ -252,16 +335,28 @@ public class Converters {
DatePickerDialog datePickerDialog = new DatePickerDialog(view.getContext(),
(cView, year, month, day) -> {
Date resultDate = new GregorianCalendar(year, month, day).getTime();
view.setText(UtilityDate.formatDate(resultDate, UtilityDate.COMMONS_DATE_FORMATS.DMY_HUMAN));
observableDate.set(resultDate);
if (parentFragment != null && warningOnOldDates && resultDate.before(new Date())) {
DialogSimpleMessageView
.makeWarningDialog(new SpannableString("Hai scelto una data precedente a quella odierna. Continuare?"), null, () -> {
view.setText(UtilityDate.formatDate(resultDate, UtilityDate.COMMONS_DATE_FORMATS.DMY_HUMAN));
observableDate.set(resultDate);
}, () -> {
})
.show(parentFragment.requireActivity().getSupportFragmentManager(), "tag");
} else {
view.setText(UtilityDate.formatDate(resultDate, UtilityDate.COMMONS_DATE_FORMATS.DMY_HUMAN));
observableDate.set(resultDate);
}
}, mYear, mMonth, mDay);
datePickerDialog.show();
};
//Adding click-listener
view.setOnClickListener(onClick::run);
if(view.getParent() != null && view.getParent().getParent() != null && view.getParent().getParent() instanceof TextInputLayout) {
((FrameLayout)view.getParent()).setOnClickListener(onClick::run);
if (view.getParent() != null && view.getParent().getParent() != null && view.getParent().getParent() instanceof TextInputLayout) {
((FrameLayout) view.getParent()).setOnClickListener(onClick::run);
((TextInputLayout) view.getParent().getParent()).setOnClickListener(onClick::run);
}
}
@@ -330,8 +425,9 @@ public class Converters {
view.addTextChangedListener(watcher);
}
String newValue = bindableString.get();
boolean isHtml = bindableString.isHtml();
if (!view.getText().toString().equals(newValue)) {
view.setText(newValue);
view.setText(isHtml ? Html.fromHtml(newValue) : newValue);
}
}
@@ -440,7 +536,7 @@ public class Converters {
@BindingAdapter("visibility")
public static void bindView(View view, final ObservableField<Boolean> bindableBoolean) {
public static void bindViewVisibility(View view, final ObservableField<Boolean> bindableBoolean) {
if (view.getTag(R.id.bound_observable) != bindableBoolean) {
view.setTag(R.id.bound_observable, bindableBoolean);
}
@@ -455,6 +551,44 @@ public class Converters {
}
@BindingAdapter("visibility")
public static void bindViewVisibility(View view, boolean bool) {
view.setVisibility(bool ? 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);
}
bindableBoolean.addOnPropertyChangedCallback(new Observable.OnPropertyChangedCallback() {
@Override
public void onPropertyChanged(Observable sender, int propertyId) {
view.setVisibility(bindableBoolean.get() ? View.GONE : View.VISIBLE);
}
});
view.setVisibility(bindableBoolean.get() ? View.GONE : View.VISIBLE);
}
@BindingAdapter("reverse_visibility")
public static void bindViewReverseVisibility(View view, final ObservableField<Boolean> bindableBoolean) {
if (view.getTag(R.id.bound_observable) != bindableBoolean) {
view.setTag(R.id.bound_observable, bindableBoolean);
}
bindableBoolean.addOnPropertyChangedCallback(new Observable.OnPropertyChangedCallback() {
@Override
public void onPropertyChanged(Observable sender, int propertyId) {
view.setVisibility(bindableBoolean.get() ? View.GONE : View.VISIBLE);
}
});
view.setVisibility(bindableBoolean.get() ? View.GONE : View.VISIBLE);
}
@BindingAdapter("android:layout_weight")
public static void setLayoutWeight(View view, final Float weight) {

View File

@@ -6,6 +6,7 @@ import android.view.KeyEvent;
import androidx.appcompat.app.AppCompatActivity;
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
import it.integry.integrywmsnative.core.utility.UtilityProgress;
public class BaseActivity extends AppCompatActivity {
@@ -38,19 +39,45 @@ public class BaseActivity extends AppCompatActivity {
}
protected void openProgress() {
BarcodeManager.disable();
if (this.mCurrentProgress == null) {
this.mCurrentProgress = UtilityProgress.createDefaultProgressDialog(this);
}
runOnUiThread(() -> {
BarcodeManager.disable();
if (this.mCurrentProgress == null) {
this.mCurrentProgress = UtilityProgress.createDefaultProgressDialog(this);
}
});
}
protected void closeProgress() {
BarcodeManager.enable();
if (mCurrentProgress != null) {
mCurrentProgress.dismiss();
mCurrentProgress = null;
}
runOnUiThread(() -> {
BarcodeManager.enable();
if (mCurrentProgress != null) {
mCurrentProgress.dismiss();
mCurrentProgress = null;
}
});
}
public void onLoadingStarted() {
new Thread(() -> {
BarcodeManager.disable();
this.openProgress();
}).start();
}
public void onLoadingEnded() {
new Thread(() -> {
this.closeProgress();
BarcodeManager.enable();
}).start();
}
public void onError(Exception ex) {
this.runOnUiThread(() -> {
this.closeProgress();
UtilityExceptions.defaultException(this, ex, mCurrentProgress);
BarcodeManager.enable();
});
}
}

View File

@@ -2,14 +2,18 @@ package it.integry.integrywmsnative.core.expansion;
import android.app.Dialog;
import android.os.Bundle;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.DialogFragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
import it.integry.integrywmsnative.core.utility.UtilityProgress;
public class BaseDialogFragment extends DialogFragment {
@@ -22,6 +26,17 @@ public class BaseDialogFragment extends DialogFragment {
}
@Override
public void show(FragmentManager manager, String tag) {
try {
FragmentTransaction ft = manager.beginTransaction();
ft.add(this, tag);
ft.commit();
} catch (IllegalStateException e) {
Log.d("ABSDIALOGFRAG", "Exception", e);
}
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
@@ -65,7 +80,7 @@ public class BaseDialogFragment extends DialogFragment {
protected void openProgress() {
// new Thread(() -> {
getActivity().runOnUiThread(() -> {
requireActivity().runOnUiThread(() -> {
if (this.mCurrentProgress == null) {
this.mCurrentProgress = UtilityProgress.createDefaultProgressDialog(getActivity());
}
@@ -75,7 +90,7 @@ public class BaseDialogFragment extends DialogFragment {
protected void closeProgress() {
// new Thread(() -> {
getActivity().runOnUiThread(() -> {
requireActivity().runOnUiThread(() -> {
if (mCurrentProgress != null) {
mCurrentProgress.dismiss();
mCurrentProgress = null;
@@ -83,4 +98,12 @@ public class BaseDialogFragment extends DialogFragment {
});
// }).start();
}
public void onError(Exception ex) {
requireActivity().runOnUiThread(() -> {
this.closeProgress();
UtilityExceptions.defaultException(requireActivity(), ex);
});
}
}

View File

@@ -4,46 +4,46 @@ import android.app.Dialog;
import androidx.fragment.app.Fragment;
import java.util.ArrayList;
import java.util.List;
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
import it.integry.integrywmsnative.core.interfaces.IPoppableActivity;
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
import it.integry.integrywmsnative.core.utility.UtilityProgress;
import it.integry.integrywmsnative.ui.ElevatedToolbar;
public class BaseFragment extends Fragment {
public abstract class BaseFragment extends Fragment {
protected Dialog mCurrentProgress;
protected ElevatedToolbar mToolbar;
protected void openProgress() {
protected final List<Runnable> mOnPreDestroyList = new ArrayList<>();
// new Thread(() -> {
getActivity().runOnUiThread(() -> {
if (this.mCurrentProgress == null) {
this.mCurrentProgress = UtilityProgress.createDefaultProgressDialog(getActivity());
}
});
// }).start();
public void setScrollToolbar(ElevatedToolbar toolbar) {
mToolbar = toolbar;
}
protected void closeProgress() {
// new Thread(() -> {
getActivity().runOnUiThread(() -> {
if (mCurrentProgress != null) {
mCurrentProgress.dismiss();
mCurrentProgress = null;
}
});
// }).start();
public void addOnPreDestroy(Runnable onPreDestroy) {
this.mOnPreDestroyList.add(onPreDestroy);
}
public void onLoadingStarted() {
BarcodeManager.disable();
this.openProgress();
new Thread(() -> {
BarcodeManager.disable();
this.openProgress();
}).start();
}
public void onLoadingEnded() {
this.closeProgress();
BarcodeManager.enable();
new Thread(() -> {
this.closeProgress();
BarcodeManager.enable();
}).start();
}
public void onError(Exception ex) {
@@ -53,4 +53,37 @@ public class BaseFragment extends Fragment {
BarcodeManager.enable();
});
}
@Override
public void onDestroy() {
super.onDestroy();
for (Runnable onPreDestroy : mOnPreDestroyList) {
onPreDestroy.run();
}
}
protected void openProgress() {
getActivity().runOnUiThread(() -> {
if (this.mCurrentProgress == null) {
this.mCurrentProgress = UtilityProgress.createDefaultProgressDialog(getActivity());
}
});
}
protected void closeProgress() {
getActivity().runOnUiThread(() -> {
if (mCurrentProgress != null) {
mCurrentProgress.dismiss();
mCurrentProgress = null;
}
});
}
protected void popMe() {
getActivity().runOnUiThread(() -> {
((IPoppableActivity) requireActivity()).pop();
});
}
}

View File

@@ -0,0 +1,14 @@
package it.integry.integrywmsnative.core.expansion;
import androidx.databinding.Observable;
public abstract class OnGeneralChangedCallback extends Observable.OnPropertyChangedCallback implements Runnable{
@Override
public void onPropertyChanged(Observable sender, int propertyId) {
run();
}
// public abstract void run();
}

View File

@@ -2,7 +2,7 @@ package it.integry.integrywmsnative.core.interfaces;
import androidx.appcompat.widget.SearchView;
public interface ISearcableFragment extends SearchView.OnQueryTextListener, IDestroyableFragment {
public interface ISearchableFragment extends SearchView.OnQueryTextListener, IDestroyableFragment {
void onSearchEnabled();

View File

@@ -0,0 +1,34 @@
package it.integry.integrywmsnative.core.menu;
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.model.ServiceRESTResponse;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
@Singleton
public class MenuRESTConsumer extends _BaseRESTConsumer {
public void retrieveMenu(String rootCodOpz, RunnableArgs<StbMenu> onComplete, RunnableArgs<Exception> onFailed) {
MenuRESTConsumerService menuRESTConsumerService = RESTBuilder.getService(MenuRESTConsumerService.class);
menuRESTConsumerService.retrieveMenuConfig(rootCodOpz).enqueue(new Callback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<StbMenu>> call, Response<ServiceRESTResponse<StbMenu>> response) {
analyzeAnswer(response, "retrieveMenu", (m) -> {
onComplete.run(response.body().getEntity());
}, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<StbMenu>> call, Throwable t) {
onFailed.run(new Exception(t));
}
});
}
}

View File

@@ -0,0 +1,13 @@
package it.integry.integrywmsnative.core.menu;
import it.integry.integrywmsnative.core.model.StbMenu;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import retrofit2.Call;
import retrofit2.http.GET;
import retrofit2.http.Query;
public interface MenuRESTConsumerService {
@GET("retrieveMenuConfig")
Call<ServiceRESTResponse<StbMenu>> retrieveMenuConfig(@Query("rootCodOpz") String rootCodOpz);
}

View File

@@ -0,0 +1,81 @@
package it.integry.integrywmsnative.core.menu;
import com.annimon.stream.Stream;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject;
import javax.inject.Singleton;
import it.integry.integrywmsnative.core.class_router.configs.BaseMenuConfiguration;
import it.integry.integrywmsnative.core.class_router.configs.MenuConfiguration;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.menu.exception.MenuNotFoundException;
import it.integry.integrywmsnative.core.model.StbMenu;
@Singleton
public class MenuService {
private static final String MENU_COD_OPZ = "MM007";
private final MenuRESTConsumer menuRESTConsumer;
private List<StbMenu> mInternalCachedMenu;
private List<StbMenu> mInternalCachedFlatMenu;
@Inject
public MenuService(MenuRESTConsumer menuRESTConsumer) {
this.menuRESTConsumer = menuRESTConsumer;
}
public void init(Runnable onMenuInitialized, RunnableArgs<Exception> onFailed) {
menuRESTConsumer.retrieveMenu(MENU_COD_OPZ, menu -> {
if(menu != null) {
this.mInternalCachedMenu = menu.getStbMenuChildren();
this.mInternalCachedFlatMenu = new ArrayList<>();
flattenMenu(this.mInternalCachedMenu);
}
onMenuInitialized.run();
}, onFailed);
}
public List<StbMenu> getMenu() throws Exception {
if(mInternalCachedMenu == null) throw new MenuNotFoundException();
return mInternalCachedMenu;
}
public boolean isGroupEnabled(MenuConfiguration.MenuGroup androidMenuGroup) throws Exception {
List<StbMenu> dbMenu = getMenu();
return Stream.of(this.mInternalCachedFlatMenu)
.anyMatch(x -> x.getCodOpz().equalsIgnoreCase(androidMenuGroup.getCodMenu()));
}
public boolean isItemEnabled(BaseMenuConfiguration.MenuItem androidMenuItem) throws Exception {
List<StbMenu> dbMenu = getMenu();
return Stream.of(this.mInternalCachedFlatMenu)
.anyMatch(x -> x.getCodOpz().equalsIgnoreCase(androidMenuItem.getCodMenu()));
}
private void flattenMenu(List<StbMenu> menu) {
for(StbMenu stbMenu : menu) {
this.mInternalCachedFlatMenu.add(stbMenu);
if(stbMenu.getStbMenuChildren() != null && !stbMenu.getStbMenuChildren().isEmpty()) {
flattenMenu(stbMenu.getStbMenuChildren());
}
}
}
public void invalidateCache() {
this.mInternalCachedMenu = null;
this.mInternalCachedFlatMenu = null;
}
}

View File

@@ -0,0 +1,8 @@
package it.integry.integrywmsnative.core.menu.exception;
public class MenuNotFoundException extends Exception{
public MenuNotFoundException() {
super("Non è stato possibile caricare il menù");
}
}

View File

@@ -1,73 +0,0 @@
package it.integry.integrywmsnative.core.model;
import androidx.databinding.Observable;
import java.util.List;
import it.integry.integrywmsnative.core.di.BindableBoolean;
import it.integry.integrywmsnative.core.di.BindableFloat;
import it.integry.integrywmsnative.gest.prod_versamento_materiale.core.ChooseOrdsLavFromListItemModel;
public class CheckableOrdineLavoro {
private ChooseOrdsLavFromListItemModel item;
private BindableBoolean checked = new BindableBoolean(false);
private String testata;
public CheckableOrdineLavoro(ChooseOrdsLavFromListItemModel item) {
this.item = item;
}
public ChooseOrdsLavFromListItemModel getItem() {
return item;
}
public CheckableOrdineLavoro setItem(ChooseOrdsLavFromListItemModel item) {
this.item = item;
return this;
}
public BindableBoolean getChecked() {
return checked;
}
public CheckableOrdineLavoro setChecked(BindableBoolean checked) {
this.checked = checked;
return this;
}
public BindableFloat getQtaCol() {
return item.getOrdineLav().getQtaColVersamento();
}
public void setQtaCol(float qtaCnf) {
this.item.getOrdineLav().setQtaColVersamento(qtaCnf);
}
public void toggleCheck() {
this.checked.set(!this.checked.get());
}
public boolean isChecked() {
return checked.get();
}
public String getTestata() {
return testata;
}
public void setTestata(String testata) {
this.testata = testata;
}
public BindableFloat getNumCnf() {
return item.getOrdineLav().getNumCnfVersamento();
}
public void setNumCnf(float numCnf) {
this.item.getOrdineLav().setNumCnfVersamento(numCnf);
}
}

View File

@@ -106,6 +106,9 @@ public class DtbOrdt extends EntityBase {
private String noteConferma;
private String codJflav;
public DtbOrdt() {
this.type = "dtb_ordt";
}
public String getDataOrd() {
return dataOrd;

View File

@@ -0,0 +1,49 @@
package it.integry.integrywmsnative.core.model;
public class JtbComt extends EntityBase {
private String codJcom;
private String codJfas;
private String codJflav;
private String descrizione;
public JtbComt() {
this.type = "jtb_comt";
}
public String getCodJcom() {
return codJcom;
}
public JtbComt setCodJcom(String codJcom) {
this.codJcom = codJcom;
return this;
}
public String getCodJfas() {
return codJfas;
}
public JtbComt setCodJfas(String codJfas) {
this.codJfas = codJfas;
return this;
}
public String getCodJflav() {
return codJflav;
}
public JtbComt setCodJflav(String codJflav) {
this.codJflav = codJflav;
return this;
}
public String getDescrizione() {
return descrizione;
}
public JtbComt setDescrizione(String descrizione) {
this.descrizione = descrizione;
return this;
}
}

View File

@@ -53,12 +53,14 @@ public class MtbColr extends EntityBase {
private MtbAart mtbAart;
private MtbPartitaMag mtbPartitaMag;
private transient int id;
private transient MtbColr refMtbColr;
public MtbColr() {
type = "mtb_colr";
if(SettingsManager.i().isUserLoggedIn()) {
if (SettingsManager.i().isUserLoggedIn()) {
setUtente(SettingsManager.i().getUser().getFullname());
}
}
@@ -80,7 +82,6 @@ public class MtbColr extends EntityBase {
}
public MtbColr setGestione(GestioneEnum gestione) {
this.gestione = gestione.getText();
return this;
@@ -122,6 +123,11 @@ public class MtbColr extends EntityBase {
return this;
}
public MtbColr setDataCollo(Date dataCollo) {
setDataCollo(UtilityDate.formatDate(dataCollo, UtilityDate.COMMONS_DATE_FORMATS.DMY_TIME_SLASH));
return this;
}
public Integer getRiga() {
return riga;
@@ -299,8 +305,6 @@ public class MtbColr extends EntityBase {
}
public String getDatetimeRowS() {
return datetimeRow;
}
@@ -320,11 +324,6 @@ public class MtbColr extends EntityBase {
}
public String getCodJcom() {
return codJcom;
}
@@ -362,11 +361,6 @@ public class MtbColr extends EntityBase {
}
public String getDataScadPartitaS() {
return dataScadPartita;
}
@@ -396,7 +390,6 @@ public class MtbColr extends EntityBase {
}
public String getUntMis() {
return untMis;
}
@@ -516,6 +509,15 @@ public class MtbColr extends EntityBase {
return this;
}
public int getId() {
return id;
}
public MtbColr setId(int id) {
this.id = id;
return this;
}
public MtbColr getRefMtbColr() {
return refMtbColr;
}

View File

@@ -22,7 +22,7 @@ public class MtbCols extends EntityBase {
type = "mtb_cols";
setCodMdep(SettingsManager.i().getUserSession().getDepo().getCodMdep());
setModificatoDa(SettingsManager.i().getUser().getFullname());
setDataMove(UtilityDate.getDateInstance());
//setDataMove(UtilityDate.getDateInstance());
}
public String getDataCollo() {

View File

@@ -57,6 +57,7 @@ public class MtbColt extends EntityBase {
private String codJcom;
private List<MtbCols> mtbCols;
private MtbTCol mtbTCol;
private Boolean disablePrint;
private String ragSocCliente;
@@ -83,7 +84,6 @@ public class MtbColt extends EntityBase {
}
private ObservableArrayList<MtbColr> mtbColr = new ObservableArrayList<>();
public ObservableArrayList<MtbColr> getMtbColr() {
@@ -95,12 +95,12 @@ public class MtbColt extends EntityBase {
return this;
}
public MtbColt(){
public MtbColt() {
type = "mtb_colt";
setDataCollo(UtilityDate.getDateInstance());
setSerCollo("/");
if(SettingsManager.i().isUserLoggedIn()) {
if (SettingsManager.i().isUserLoggedIn()) {
setPreparatoDa(SettingsManager.i().getUser().getFullname());
}
}
@@ -137,11 +137,11 @@ public class MtbColt extends EntityBase {
Date dataColloD = null;
try {
dataColloD = getDataColloD();
} catch (Exception ex){
} catch (Exception ex) {
UtilityLogger.errorMe(ex);
}
if(dataColloD != null){
if (dataColloD != null) {
return UtilityDate.formatDate(dataColloD, UtilityDate.COMMONS_DATE_FORMATS.DMY_HUMAN_LONG);
} else return null;
}
@@ -385,6 +385,18 @@ public class MtbColt extends EntityBase {
return dataVers;
}
public Date getDataVersD() {
return UtilityDate.recognizeDateWithExceptionHandler(getDataVers());
}
public String getTimeVers() {
Date dataColloD = getDataVersD();
if (dataColloD != null) {
return UtilityDate.formatDate(dataColloD, UtilityDate.COMMONS_DATE_FORMATS.TIME);
} else return null;
}
public MtbColt setDataVers(String dataVers) {
this.dataVers = dataVers;
@@ -514,6 +526,15 @@ public class MtbColt extends EntityBase {
return this;
}
public MtbTCol getMtbTCol() {
return mtbTCol;
}
public MtbColt setMtbTCol(MtbTCol mtbTCol) {
this.mtbTCol = mtbTCol;
return this;
}
public void generaFiltroOrdineFromDTO(List<FiltroOrdineDTO> filtroOrdineDtos) {
String xmlPrefix = "{\"whereCond\": \"";
@@ -521,29 +542,27 @@ public class MtbColt extends EntityBase {
StringBuilder whereCond = new StringBuilder();
if(filtroOrdineDtos != null && filtroOrdineDtos.size() > 0) {
if (filtroOrdineDtos != null && filtroOrdineDtos.size() > 0) {
for(int i = 0; i < filtroOrdineDtos.size(); i++){
for (int i = 0; i < filtroOrdineDtos.size(); i++) {
FiltroOrdineDTO x = filtroOrdineDtos.get(i);
try {
whereCond.append("(");
whereCond.append(String.format("dtb_ordt.gestione = %s AND dtb_ordt.data_ord = %s and dtb_ordt.num_ord = %s",
whereCond.append(String.format("d.g = %s AND d.d = %s and d.n = %s",
UtilityDB.valueToString(x.getGestioneOrd()),
UtilityDB.valueToString(UtilityDate.formatDate(x.getDataOrdD(), UtilityDate.COMMONS_DATE_FORMATS.YMD_SLASH)),
UtilityDB.valueToString(x.getNumOrd())));
if(!UtilityString.isNullOrEmpty(x.getDataConsS())) {
whereCond.append(String.format(" AND dtb_ordr.data_cons = %s",
if (!UtilityString.isNullOrEmpty(x.getDataConsS())) {
whereCond.append(String.format(" AND dr.dc = %s",
UtilityDB.valueToString(UtilityDate.formatDate(x.getDataConsD(), UtilityDate.COMMONS_DATE_FORMATS.YMD_SLASH))));
}
whereCond.append(")");
if(i < filtroOrdineDtos.size()-1) {
if (i < filtroOrdineDtos.size() - 1) {
whereCond.append(" OR ");
}
//whereCond.append("<DTB_ORDT COND=\"OR\"><GESTIONE type=\"V\">" + x.getGestioneOrd() + "</GESTIONE><DATA_ORD type=\"D\">" + UtilityDate.formatDate(x.getDataOrdD(), UtilityDate.COMMONS_DATE_FORMATS.YMD_SLASH) + "</DATA_ORD><NUM_ORD type=\"N\">" + x.getNumOrd() + "</NUM_ORD></DTB_ORDT>");
} catch (Exception e) {
e.printStackTrace();
}

View File

@@ -36,12 +36,12 @@ public class MtbDepo extends EntityBase implements Parcelable {
private String flagTipoNegozio;
private String codMdepReso;
public MtbDepo() {
type = "mtb_depo";
}
protected MtbDepo(Parcel in) {
type = "mtb_depo";
codMdep = in.readString();
descrizione = in.readString();
flagVal = in.readString();
@@ -357,4 +357,19 @@ public class MtbDepo extends EntityBase implements Parcelable {
this.codMdepReso = codMdepReso;
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
MtbDepo mtbDepo = (MtbDepo) o;
return getCodMdep().equals(mtbDepo.getCodMdep());
}
@Override
public int hashCode() {
return getCodMdep().hashCode();
}
}

View File

@@ -0,0 +1,69 @@
package it.integry.integrywmsnative.core.model;
public class MtbGrup extends EntityBase {
private String codMgrp;
private String descrizione;
private String flagValMag;
private String logoWeb;
private String criterioVal;
private String tipoMgrp;
public MtbGrup() {
this.type = "mtb_grup";
}
public String getCodMgrp() {
return codMgrp;
}
public MtbGrup setCodMgrp(String codMgrp) {
this.codMgrp = codMgrp;
return this;
}
public String getDescrizione() {
return descrizione;
}
public MtbGrup setDescrizione(String descrizione) {
this.descrizione = descrizione;
return this;
}
public String getFlagValMag() {
return flagValMag;
}
public MtbGrup setFlagValMag(String flagValMag) {
this.flagValMag = flagValMag;
return this;
}
public String getLogoWeb() {
return logoWeb;
}
public MtbGrup setLogoWeb(String logoWeb) {
this.logoWeb = logoWeb;
return this;
}
public String getCriterioVal() {
return criterioVal;
}
public MtbGrup setCriterioVal(String criterioVal) {
this.criterioVal = criterioVal;
return this;
}
public String getTipoMgrp() {
return tipoMgrp;
}
public MtbGrup setTipoMgrp(String tipoMgrp) {
this.tipoMgrp = tipoMgrp;
return this;
}
}

View File

@@ -5,7 +5,7 @@ import java.util.Date;
import it.integry.integrywmsnative.core.utility.UtilityDate;
public class MtbPartitaMag {
public class MtbPartitaMag extends EntityBase{
private String codMart;
private String partitaMag;
@@ -30,6 +30,10 @@ public class MtbPartitaMag {
private String partitaMagSec;
private BigDecimal qtaAttesa;
public MtbPartitaMag() {
this.type = "mtb_partita_mag";
}
public String getCodMart() {
return codMart;

View File

@@ -0,0 +1,273 @@
package it.integry.integrywmsnative.core.model;
import java.math.BigDecimal;
import java.util.Date;
/**
* Created by ValerioC on 06/03/2018.
*/
public class MvwSitArtUdcDetInventario {
private String gestione;
private Date dataCollo;
private String serCollo;
private Integer numCollo;
private Integer segno;
private String codMdep;
private String posizione;
private Integer priorita;
private String codGruppo;
private String gruppo;
private String codSgruppo;
private String sottogruppo;
private String codMart;
private String diacod;
private String descrizioneEstesa;
private String partitaMag;
private String codJcom;
private String commessa;
private String untMis;
private BigDecimal qtaCol;
private BigDecimal numCnf;
private BigDecimal qtaCnf;
private BigDecimal pesoNettoKg;
private BigDecimal pesoLordoKg;
private String codJfas;
private MtbAart mtbAart;
public String getGestione() {
return gestione;
}
public MvwSitArtUdcDetInventario setGestione(String gestione) {
this.gestione = gestione;
return this;
}
public Date getDataCollo() {
return dataCollo;
}
public MvwSitArtUdcDetInventario setDataCollo(Date dataCollo) {
this.dataCollo = dataCollo;
return this;
}
public String getSerCollo() {
return serCollo;
}
public MvwSitArtUdcDetInventario setSerCollo(String serCollo) {
this.serCollo = serCollo;
return this;
}
public Integer getNumCollo() {
return numCollo;
}
public MvwSitArtUdcDetInventario setNumCollo(Integer numCollo) {
this.numCollo = numCollo;
return this;
}
public Integer getSegno() {
return segno;
}
public MvwSitArtUdcDetInventario setSegno(Integer segno) {
this.segno = segno;
return this;
}
public String getCodMdep() {
return codMdep;
}
public MvwSitArtUdcDetInventario setCodMdep(String codMdep) {
this.codMdep = codMdep;
return this;
}
public String getPosizione() {
return posizione;
}
public MvwSitArtUdcDetInventario setPosizione(String posizione) {
this.posizione = posizione;
return this;
}
public Integer getPriorita() {
return priorita;
}
public MvwSitArtUdcDetInventario setPriorita(Integer priorita) {
this.priorita = priorita;
return this;
}
public String getCodGruppo() {
return codGruppo;
}
public MvwSitArtUdcDetInventario setCodGruppo(String codGruppo) {
this.codGruppo = codGruppo;
return this;
}
public String getGruppo() {
return gruppo;
}
public MvwSitArtUdcDetInventario setGruppo(String gruppo) {
this.gruppo = gruppo;
return this;
}
public String getCodSgruppo() {
return codSgruppo;
}
public MvwSitArtUdcDetInventario setCodSgruppo(String codSgruppo) {
this.codSgruppo = codSgruppo;
return this;
}
public String getSottogruppo() {
return sottogruppo;
}
public MvwSitArtUdcDetInventario setSottogruppo(String sottogruppo) {
this.sottogruppo = sottogruppo;
return this;
}
public String getCodMart() {
return codMart;
}
public MvwSitArtUdcDetInventario setCodMart(String codMart) {
this.codMart = codMart;
return this;
}
public String getDiacod() {
return diacod;
}
public MvwSitArtUdcDetInventario setDiacod(String diacod) {
this.diacod = diacod;
return this;
}
public String getDescrizioneEstesa() {
return descrizioneEstesa;
}
public MvwSitArtUdcDetInventario setDescrizioneEstesa(String descrizioneEstesa) {
this.descrizioneEstesa = descrizioneEstesa;
return this;
}
public String getPartitaMag() {
return partitaMag;
}
public MvwSitArtUdcDetInventario setPartitaMag(String partitaMag) {
this.partitaMag = partitaMag;
return this;
}
public String getCodJcom() {
return codJcom;
}
public MvwSitArtUdcDetInventario setCodJcom(String codJcom) {
this.codJcom = codJcom;
return this;
}
public String getCommessa() {
return commessa;
}
public MvwSitArtUdcDetInventario setCommessa(String commessa) {
this.commessa = commessa;
return this;
}
public String getUntMis() {
return untMis;
}
public MvwSitArtUdcDetInventario setUntMis(String untMis) {
this.untMis = untMis;
return this;
}
public BigDecimal getQtaCol() {
return qtaCol;
}
public MvwSitArtUdcDetInventario setQtaCol(BigDecimal qtaCol) {
this.qtaCol = qtaCol;
return this;
}
public BigDecimal getNumCnf() {
return numCnf;
}
public MvwSitArtUdcDetInventario setNumCnf(BigDecimal numCnf) {
this.numCnf = numCnf;
return this;
}
public BigDecimal getQtaCnf() {
return qtaCnf;
}
public MvwSitArtUdcDetInventario setQtaCnf(BigDecimal qtaCnf) {
this.qtaCnf = qtaCnf;
return this;
}
public BigDecimal getPesoNettoKg() {
return pesoNettoKg;
}
public MvwSitArtUdcDetInventario setPesoNettoKg(BigDecimal pesoNettoKg) {
this.pesoNettoKg = pesoNettoKg;
return this;
}
public BigDecimal getPesoLordoKg() {
return pesoLordoKg;
}
public MvwSitArtUdcDetInventario setPesoLordoKg(BigDecimal pesoLordoKg) {
this.pesoLordoKg = pesoLordoKg;
return this;
}
public String getCodJfas() {
return codJfas;
}
public MvwSitArtUdcDetInventario setCodJfas(String codJfas) {
this.codJfas = codJfas;
return this;
}
public MtbAart getMtbAart() {
return mtbAart;
}
public MvwSitArtUdcDetInventario setMtbAart(MtbAart mtbAart) {
this.mtbAart = mtbAart;
return this;
}
}

View File

@@ -0,0 +1,217 @@
package it.integry.integrywmsnative.core.model;
import java.util.ArrayList;
import java.util.List;
public class StbMenu extends EntityBase {
public StbMenu() {
this.type = "stb_menu";
}
private String codOpz;
private String codParent;
private String tipoAzienda;
private String descrizione;
private String descrizioneEstesa;
private String entityName;
private String flagAttivo;
private String flagPrinterSetup;
private String gestName;
private String note;
private String objectType;
private String openType;
private String parameter;
private String pictureMenu;
private String pictureSelect;
private Integer pos;
private Integer posCliente;
private Integer posTipoAzienda;
private String urlDescrizione;
private final List<StbMenu> stbMenuChildren = new ArrayList<>();
public String getCodOpz() {
return codOpz;
}
public StbMenu setCodOpz(String codOpz) {
this.codOpz = codOpz;
return this;
}
public String getCodParent() {
return codParent;
}
public StbMenu setCodParent(String codParent) {
this.codParent = codParent;
return this;
}
public String getTipoAzienda() {
return tipoAzienda;
}
public StbMenu setTipoAzienda(String tipoAzienda) {
this.tipoAzienda = tipoAzienda;
return this;
}
public String getDescrizione() {
return descrizione;
}
public StbMenu setDescrizione(String descrizione) {
this.descrizione = descrizione;
return this;
}
public String getDescrizioneEstesa() {
return descrizioneEstesa;
}
public StbMenu setDescrizioneEstesa(String descrizioneEstesa) {
this.descrizioneEstesa = descrizioneEstesa;
return this;
}
public String getEntityName() {
return entityName;
}
public StbMenu setEntityName(String entityName) {
this.entityName = entityName;
return this;
}
public String getFlagAttivo() {
return flagAttivo;
}
public StbMenu setFlagAttivo(String flagAttivo) {
this.flagAttivo = flagAttivo;
return this;
}
public String getFlagPrinterSetup() {
return flagPrinterSetup;
}
public StbMenu setFlagPrinterSetup(String flagPrinterSetup) {
this.flagPrinterSetup = flagPrinterSetup;
return this;
}
public String getGestName() {
return gestName;
}
public StbMenu setGestName(String gestName) {
this.gestName = gestName;
return this;
}
public String getNote() {
return note;
}
public StbMenu setNote(String note) {
this.note = note;
return this;
}
public String getObjectType() {
return objectType;
}
public StbMenu setObjectType(String objectType) {
this.objectType = objectType;
return this;
}
public String getOpenType() {
return openType;
}
public StbMenu setOpenType(String openType) {
this.openType = openType;
return this;
}
public String getParameter() {
return parameter;
}
public StbMenu setParameter(String parameter) {
this.parameter = parameter;
return this;
}
public String getPictureMenu() {
return pictureMenu;
}
public StbMenu setPictureMenu(String pictureMenu) {
this.pictureMenu = pictureMenu;
return this;
}
public String getPictureSelect() {
return pictureSelect;
}
public StbMenu setPictureSelect(String pictureSelect) {
this.pictureSelect = pictureSelect;
return this;
}
public Integer getPos() {
return pos;
}
public StbMenu setPos(Integer pos) {
this.pos = pos;
return this;
}
public Integer getPosCliente() {
return posCliente;
}
public StbMenu setPosCliente(Integer posCliente) {
this.posCliente = posCliente;
return this;
}
public Integer getPosTipoAzienda() {
return posTipoAzienda;
}
public StbMenu setPosTipoAzienda(Integer posTipoAzienda) {
this.posTipoAzienda = posTipoAzienda;
return this;
}
public String getType() {
return type;
}
public StbMenu setType(String type) {
this.type = type;
return this;
}
public String getUrlDescrizione() {
return urlDescrizione;
}
public StbMenu setUrlDescrizione(String urlDescrizione) {
this.urlDescrizione = urlDescrizione;
return this;
}
public List<StbMenu> getStbMenuChildren() {
return stbMenuChildren;
}
}

View File

@@ -3,6 +3,7 @@ package it.integry.integrywmsnative.core.rest;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import java.lang.reflect.Modifier;
import java.util.concurrent.TimeUnit;
import it.integry.integrywmsnative.core.settings.SettingsManager;
@@ -17,12 +18,10 @@ import retrofit2.converter.gson.GsonConverterFactory;
public class RESTBuilder {
public static <T> T getService(final Class<T> service) {
// return getService(service, "192.168.2.13", 8080);
return getService(service, SettingsManager.i().getServer().getHost(), SettingsManager.i().getServer().getPort(), true);
}
public static <T> T getService(final Class<T> service, int timeout) {
// return getService(service, "192.168.2.13", 8080);
return getService(service, SettingsManager.i().getServer().getHost(), SettingsManager.i().getServer().getPort(), true, true, timeout);
}
@@ -52,19 +51,15 @@ public class RESTBuilder {
Gson gson = new GsonBuilder()
.setDateFormat("dd/MM/yyyy HH:mm:ss")
.excludeFieldsWithModifiers(Modifier.TRANSIENT)
.create();
Retrofit retrofit = new Retrofit.Builder()
.addConverterFactory(GsonConverterFactory.create(gson))
.baseUrl(endpoint)
.client(client)
.build();
return retrofit.create(service);
}
}

View File

@@ -2,15 +2,21 @@ package it.integry.integrywmsnative.core.rest.consumers;
import com.annimon.stream.Collectors;
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 javax.inject.Singleton;
import it.integry.integrywmsnative.core.rest.RESTBuilder;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.model.MtbAart;
import it.integry.integrywmsnative.core.model.MtbGrup;
import it.integry.integrywmsnative.core.rest.RESTBuilder;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import it.integry.integrywmsnative.core.utility.UtilityQuery;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
@@ -18,7 +24,13 @@ import retrofit2.Response;
@Singleton
public class ArticoloRESTConsumer extends _BaseRESTConsumer {
public static void getByBarcodeProdStatic(String barcodeProd, RunnableArgs<List<MtbAart>> onComplete, RunnableArgs<Exception> onFailed) {
private final SystemRESTConsumer systemRESTConsumer;
public ArticoloRESTConsumer(SystemRESTConsumer systemRESTConsumer) {
this.systemRESTConsumer = systemRESTConsumer;
}
public void getByBarcodeProd(String barcodeProd, RunnableArgs<List<MtbAart>> onComplete, RunnableArgs<Exception> onFailed) {
ArticoloRESTConsumerService articoloRESTConsumerService = RESTBuilder.getService(ArticoloRESTConsumerService.class);
articoloRESTConsumerService.getByBarcodeProd(barcodeProd).enqueue(new Callback<ServiceRESTResponse<MtbAart>>() {
@Override
@@ -35,10 +47,6 @@ public class ArticoloRESTConsumer extends _BaseRESTConsumer {
});
}
public void getByBarcodeProd(String barcodeProd, RunnableArgs<List<MtbAart>> onComplete, RunnableArgs<Exception> onFailed) {
getByBarcodeProdStatic(barcodeProd, onComplete, onFailed);
}
public void getByCodMarts(List<String> codMartToFind, RunnableArgs<List<MtbAart>> onComplete, RunnableArgs<Exception> onFailed) {
getByCodMartsStatic(codMartToFind, onComplete, onFailed);
@@ -75,7 +83,7 @@ public class ArticoloRESTConsumer extends _BaseRESTConsumer {
@Override
public void onResponse(Call<ServiceRESTResponse<MtbAart>> call, Response<ServiceRESTResponse<MtbAart>> response) {
analyzeAnswer(response, "getByCodMart", (m) -> {
if(response.body().getEntityList() != null && !response.body().getEntityList().isEmpty()) {
if (response.body().getEntityList() != null && !response.body().getEntityList().isEmpty()) {
onComplete.run(response.body().getEntityList().get(0));
} else onComplete.run(null);
@@ -89,4 +97,22 @@ public class ArticoloRESTConsumer extends _BaseRESTConsumer {
});
}
public void getArtsGroups(List<String> groupsToFind, RunnableArgs<List<MtbGrup>> onComplete, RunnableArgs<Exception> onFailed) {
var whereCondMap = Stream.of(groupsToFind)
.map(x -> {
HashMap<String, Object> vars = new HashMap<>();
vars.put("cod_mgrp", x);
return vars;
})
.toList();
var whereCond = whereCondMap.isEmpty() ? "" : " WHERE " + UtilityQuery.concatFieldListInWhereCond(whereCondMap);
Type typeOfObjectsList = new TypeToken<ArrayList<MtbGrup>>() {
}.getType();
this.systemRESTConsumer.processSql("SELECT * FROM mtb_grup " + whereCond, typeOfObjectsList, onComplete, onFailed);
}
}

View File

@@ -16,7 +16,7 @@ import retrofit2.Response;
@Singleton
public class BarcodeRESTConsumer extends _BaseRESTConsumer {
public static void decodeEan128Static(BarcodeScanDTO barcodeObj, RunnableArgs<Ean128Model> onComplete, RunnableArgs<Exception> onFailed) {
public void decodeEan128(BarcodeScanDTO barcodeObj, RunnableArgs<Ean128Model> onComplete, RunnableArgs<Exception> onFailed) {
IBarcodeCustomization barcodeCustomization = ClassRouter.getInstance(ClassRouter.PATH.BARCODE_CUSTOMIZATION);
@@ -42,8 +42,4 @@ public class BarcodeRESTConsumer extends _BaseRESTConsumer {
}
});
}
public void decodeEan128(BarcodeScanDTO barcodeObj, RunnableArgs<Ean128Model> onComplete, RunnableArgs<Exception> onFailed) {
BarcodeRESTConsumer.decodeEan128Static(barcodeObj, onComplete, onFailed);
}
}

View File

@@ -2,6 +2,7 @@ package it.integry.integrywmsnative.core.rest.consumers;
import androidx.databinding.ObservableArrayList;
import com.annimon.stream.Optional;
import com.annimon.stream.Stream;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
@@ -32,6 +33,7 @@ import it.integry.integrywmsnative.core.rest.model.DistribuzioneColloDTO;
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.VersamentoAutomaticoULResponseDTO;
import it.integry.integrywmsnative.core.settings.SettingsManager;
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
import it.integry.integrywmsnative.core.utility.UtilityDate;
@@ -45,30 +47,19 @@ import retrofit2.Response;
@Singleton
public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
private ArticoloRESTConsumer mArticoloRESTConsumer;
private final SystemRESTConsumer mSystemRESTConsumer;
private final ArticoloRESTConsumer mArticoloRESTConsumer;
private final EntityRESTConsumer mEntityRESTConsumer;
public ColliMagazzinoRESTConsumer(ArticoloRESTConsumer articoloRESTConsumer) {
public ColliMagazzinoRESTConsumer(SystemRESTConsumer systemRESTConsumer,
ArticoloRESTConsumer articoloRESTConsumer,
EntityRESTConsumer entityRESTConsumer) {
this.mSystemRESTConsumer = systemRESTConsumer;
this.mArticoloRESTConsumer = articoloRESTConsumer;
}
public static void saveColloStatic(MtbColt mtbColtToSave, final ISimpleOperationCallback<MtbColt> callback) {
for (int i = 0; i < mtbColtToSave.getMtbColr().size(); i++) {
mtbColtToSave.getMtbColr().get(i)
.setMtbAart(null)
.setMtbPartitaMag(null);
}
EntityRESTConsumer.processEntity(mtbColtToSave, callback, MtbColt.class);
this.mEntityRESTConsumer = entityRESTConsumer;
}
public void saveCollo(MtbColt mtbColtToSave, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
ColliMagazzinoRESTConsumer.saveColloStatic(mtbColtToSave, onComplete, onFailed);
}
public static void saveColloStatic(MtbColt mtbColtToSave, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
MtbColt mtbColtToSaveClone = (MtbColt) mtbColtToSave.clone();
mtbColtToSave.setOperation(CommonModelConsts.OPERATION.INSERT_OR_UPDATE);
@@ -81,7 +72,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
.setMtbPartitaMag(null));
}
EntityRESTConsumer.processEntity(mtbColtToSaveClone, new ISimpleOperationCallback<MtbColt>() {
this.mEntityRESTConsumer.processEntity(mtbColtToSaveClone, new ISimpleOperationCallback<MtbColt>() {
@Override
public void onSuccess(MtbColt value) {
if (onComplete != null) onComplete.run(value);
@@ -96,10 +87,6 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
}
public void saveColli(List<MtbColt> mtbColtsToSave, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
saveColliStatic(mtbColtsToSave, onComplete, onFailed);
}
public static void saveColliStatic(List<MtbColt> mtbColtsToSave, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
for (MtbColt mtbColt : mtbColtsToSave) {
mtbColt.setMtbCols(null);
@@ -111,17 +98,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
}
}
EntityRESTConsumer.processEntityList(mtbColtsToSave, new ISimpleOperationCallback<List<MtbColt>>() {
@Override
public void onSuccess(List<MtbColt> value) {
if (onComplete != null) onComplete.run(value);
}
@Override
public void onFailed(Exception ex) {
if (onFailed != null) onFailed.run(ex);
}
}, true, MtbColt.class);
this.mEntityRESTConsumer.processEntityList(mtbColtsToSave, true, MtbColt.class, onComplete, onFailed);
}
@@ -143,7 +120,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
});
}
public static void createColloScaricoDaCarico(MtbColt sourceMtbColt, MtbDepoPosizione posizione, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
public void createColloScaricoDaCarico(MtbColt sourceMtbColt, MtbDepoPosizione posizione, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
MtbColt newMtbColt = new MtbColt()
.initDefaultFields()
@@ -178,7 +155,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
mtbColrClone
.setNumCollo(null)
.setDataCollo(null)
.setDataCollo((String) null)
.setRiga(null)
.setGestione(GestioneEnum.LAVORAZIONE)
@@ -193,20 +170,10 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
}
saveColloStatic(newMtbColt, new ISimpleOperationCallback<MtbColt>() {
@Override
public void onSuccess(MtbColt value) {
if (onComplete != null) onComplete.run(value);
}
@Override
public void onFailed(Exception ex) {
if (onFailed != null) onFailed.run(ex);
}
});
saveCollo(newMtbColt, onComplete, onFailed);
}
public static void createColliScaricoDaOrdineLavorazione(MtbColt sourceMtbColt, MtbColr sourceMtbColr, MtbDepoPosizione posizione, List<OrdineLavorazioneDTO> ordini, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
public void createColliScaricoDaOrdineLavorazione(MtbColt sourceMtbColt, MtbColr sourceMtbColr, MtbDepoPosizione posizione, List<OrdineLavorazioneDTO> ordini, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
MtbColt newMtbColt = new MtbColt()
.initDefaultFields()
@@ -214,8 +181,8 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
.setGestione(GestioneEnum.LAVORAZIONE)
.setSegno(-1)
.setCodTcol(sourceMtbColt.getCodTcol())
.setPesoKg(sourceMtbColt.getPesoKg())
.setPesoNettoKg(sourceMtbColt.getPesoNettoKg())
// .setPesoKg(sourceMtbColt.getPesoKg())
// .setPesoNettoKg(sourceMtbColt.getPesoNettoKg())
.setLarghezzaCm(sourceMtbColt.getLarghezzaCm())
.setLunghezzaCm(sourceMtbColt.getLunghezzaCm())
.setAltezzaCm(sourceMtbColt.getAltezzaCm())
@@ -242,7 +209,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
MtbColr mtbColrClone = new MtbColr();
mtbColrClone
.setNumCollo(null)
.setDataCollo(null)
.setDataCollo((String) null)
.setRiga(null)
.setGestione(GestioneEnum.LAVORAZIONE)
.setDataColloRif(sourceMtbColt.getDataColloD())
@@ -269,21 +236,9 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
}
saveColloStatic(newMtbColt, new ISimpleOperationCallback<MtbColt>() {
@Override
public void onSuccess(MtbColt value) {
if (onComplete != null) onComplete.run(value);
}
@Override
public void onFailed(Exception ex) {
if (onFailed != null) onFailed.run(ex);
}
});
saveCollo(newMtbColt, onComplete, onFailed);
}
public void createColloFromEtichettaAnonima(BarcodeScanDTO barcodeScanDTO, GestioneEnum gestione, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
createColloFromEtichettaAnonima(barcodeScanDTO.getStringValue(), gestione, onComplete, onFailed);
}
@@ -314,11 +269,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
mtbColtToCreate
.setOperation(CommonModelConsts.OPERATION.INSERT);
saveCollo(mtbColtToCreate, value -> {
if (onComplete != null) onComplete.run(value);
}, ex -> {
if (onFailed != null) onFailed.run(ex);
});
saveCollo(mtbColtToCreate, onComplete, onFailed);
}
public void deleteCollo(MtbColt mtbColtToDelete, Runnable onComplete, RunnableArgs<Exception> onFailed) {
@@ -327,9 +278,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
saveCollo(mtbColtToDelete, value -> {
if (onComplete != null) onComplete.run();
}, ex -> {
if (onFailed != null) onFailed.run(ex);
});
}, onFailed);
}
public static void distribuisciCollo(MtbColt mtbColtToDistribute, DistribuzioneColloDTO.CriterioDistribuzione criterioDistribuzione, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
@@ -374,10 +323,6 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
}
public void getBySSCC(String ssccString, boolean onlyResiduo, boolean throwExcIfNull, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
ColliMagazzinoRESTConsumer.getBySSCCStatic(ssccString, onlyResiduo, throwExcIfNull, onComplete, onFailed);
}
public static void getBySSCCStatic(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<ServiceRESTResponse<MtbColt>>() {
@Override
@@ -447,20 +392,15 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
}
public void getMultipleByTestate(List<MtbColt> testate, boolean onlyResiduo, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
ColliMagazzinoRESTConsumer.getMultipleByTestateStatic(testate, onlyResiduo, onComplete, onFailed);
}
public static void getMultipleByTestateStatic(List<MtbColt> testate, boolean onlyResiduo, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
ArrayList<MtbColt> resultMtbColt = new ArrayList<>();
cyclicGetMultipleByTestate(testate.iterator(), onlyResiduo, resultMtbColt, () -> {
onComplete.run(resultMtbColt);
}, onFailed);
}
private static void cyclicGetMultipleByTestate(@NotNull Iterator<MtbColt> sourceMtbColts, boolean onlyResiduo, ArrayList<MtbColt> resultMtbColt, Runnable onComplete, RunnableArgs<Exception> onAbort) {
private void cyclicGetMultipleByTestate(@NotNull Iterator<MtbColt> sourceMtbColts, boolean onlyResiduo, ArrayList<MtbColt> resultMtbColt, Runnable onComplete, RunnableArgs<Exception> onAbort) {
if (sourceMtbColts.hasNext()) {
getByTestataStatic(sourceMtbColts.next(), onlyResiduo, false, mtbColt -> {
getByTestata(sourceMtbColts.next(), onlyResiduo, false, mtbColt -> {
resultMtbColt.add(mtbColt);
cyclicGetMultipleByTestate(sourceMtbColts, onlyResiduo, resultMtbColt, onComplete, onAbort);
}, onAbort);
@@ -476,14 +416,10 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
.setDataCollo(dataCollo)
.setSerCollo(serCollo);
ColliMagazzinoRESTConsumer.getByTestataStatic(mtbColtToRetrieve, onlyResiduo, throwExcIfNull, onComplete, onFailed);
getByTestata(mtbColtToRetrieve, onlyResiduo, throwExcIfNull, onComplete, onFailed);
}
public void getByTestata(MtbColt testata, boolean onlyResiduo, boolean throwExcIfNull, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
ColliMagazzinoRESTConsumer.getByTestataStatic(testata, onlyResiduo, throwExcIfNull, onComplete, onFailed);
}
public static void getByTestataStatic(MtbColt testata, boolean onlyResiduo, boolean throwExcIfNull, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
testata.setMtbColr(new ObservableArrayList<>());
@@ -511,7 +447,6 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
});
}
public void changePosizione(MtbColt mtbColtToMove, MtbDepoPosizione posizione, Runnable onComplete, RunnableArgs<Exception> onFailed) {
String codMdep = posizione.getCodMdep();
@@ -546,17 +481,13 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
}
public void updateDataFine(MtbColt mtbColt, Runnable onComplete, RunnableArgs<Exception> onFailed) {
ColliMagazzinoRESTConsumer.updateDataFineStatic(mtbColt, onComplete, onFailed);
}
public static void updateDataFineStatic(MtbColt mtbColt, Runnable onComplete, RunnableArgs<Exception> onFailed) {
MtbColt cloneMtbColt = (MtbColt) mtbColt.clone();
cloneMtbColt.setOperation(CommonModelConsts.OPERATION.UPDATE);
cloneMtbColt.setOraFinePrep(UtilityDate.getDateInstance());
cloneMtbColt.setMtbColr(new ObservableArrayList<>());
ColliMagazzinoRESTConsumer.saveColloStatic(cloneMtbColt, value -> {
saveCollo(cloneMtbColt, value -> {
onComplete.run();
}, ex -> {
if (onFailed != null) onFailed.run(ex);
@@ -565,10 +496,6 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
}
public void canLUBeDeleted(MtbColt mtbColt, RunnableArgs<Boolean> onComplete, RunnableArgs<Exception> onFailed) {
ColliMagazzinoRESTConsumer.canLUBeDeletedStatic(mtbColt, onComplete, onFailed);
}
public static void canLUBeDeletedStatic(MtbColt mtbColt, RunnableArgs<Boolean> onComplete, RunnableArgs<Exception> onFailed) {
HashMap<String, Object> params = new HashMap<>();
params.put("mtb_colt.gestione", mtbColt.getGestione());
@@ -610,12 +537,11 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
Type typeOfObjectsList = new TypeToken<ArrayList<MtbColt>>() {
}.getType();
SystemRESTConsumer.<ArrayList<MtbColt>>processSqlStatic(query, typeOfObjectsList, data -> {
this.mSystemRESTConsumer.<ArrayList<MtbColt>>processSql(query, typeOfObjectsList, data -> {
onComplete.run(data != null && data.size() > 0);
}, onFailed);
}
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>>>() {
@@ -647,7 +573,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
colliMagazzinoRESTConsumerService.creaRettificaCollo(
SettingsManager.i().getUserSession().getDepo().getCodMdep(),
rettificaULDTO
).enqueue(new Callback<ServiceRESTResponse<MtbColr>>() {
).enqueue(new Callback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<MtbColr>> call, Response<ServiceRESTResponse<MtbColr>> response) {
analyzeAnswer(response, "creaRettificaCollo", onComplete, onFailed);
@@ -677,9 +603,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
.setDestinationMtbColt(mtbColtDestClone);
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
colliMagazzinoRESTConsumerService.spostaArtsTraUL(
spostaArtsTraULRequestDTO
).enqueue(new Callback<ServiceRESTResponse<Object>>() {
colliMagazzinoRESTConsumerService.spostaArtsTraUL(spostaArtsTraULRequestDTO).enqueue(new Callback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) {
analyzeAnswer(response, "spostaArtsTraUL", data -> {
@@ -694,4 +618,82 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
});
}
public void assegnaLottoSuColloScarico(MtbColt sourceMtbColt, Runnable onComplete, RunnableArgs<Exception> onFailed) {
MtbColt sourceMtbColtClone = (MtbColt) sourceMtbColt.clone();
for (int i = 0; i < sourceMtbColtClone.getMtbColr().size(); i++) {
sourceMtbColtClone.getMtbColr().get(i)
.setMtbAart(null)
.setMtbPartitaMag(null);
}
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
colliMagazzinoRESTConsumerService.assegnaLottoSuColloScarico(sourceMtbColtClone).enqueue(new Callback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<MtbColt>> call, Response<ServiceRESTResponse<MtbColt>> response) {
analyzeAnswer(response, "assegnaLottoSuColloScarico", data -> {
onComplete.run();
}, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<MtbColt>> call, Throwable t) {
if (onFailed != null) onFailed.run(new Exception(t));
}
});
}
public void versamentoAutomaticoUL(MtbColt sourceMtbColt, RunnableArgs<VersamentoAutomaticoULResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
MtbColt sourceMtbColtClone = (MtbColt) sourceMtbColt.clone();
for (int i = 0; i < sourceMtbColtClone.getMtbColr().size(); i++) {
sourceMtbColtClone.getMtbColr().get(i)
.setMtbAart(null)
.setMtbPartitaMag(null);
}
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
colliMagazzinoRESTConsumerService.versamentoAutomaticoUL(sourceMtbColtClone).enqueue(new Callback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<VersamentoAutomaticoULResponseDTO>> call, Response<ServiceRESTResponse<VersamentoAutomaticoULResponseDTO>> response) {
analyzeAnswer(response, "versamentoAutomaticoUL", data -> {
var result = response.body().getDto();
List<MtbColr> allMtbColr = new ArrayList<>();
allMtbColr.addAll(result.getSuccess());
allMtbColr.addAll(result.getFailed());
List<String> codMarts = Stream.of(allMtbColr)
.map(x -> x.getCodMart().trim())
.toList();
mArticoloRESTConsumer.getByCodMarts(codMarts, mtbAarts -> {
for (var mtbColr : allMtbColr) {
MtbAart foundMtbAart = null;
Optional<MtbAart> mtbAartOpt = Stream.of(mtbAarts)
.filter(x -> x.getCodMart().equalsIgnoreCase(mtbColr.getCodMart()))
.findFirst();
if (mtbAartOpt.isPresent()) {
foundMtbAart = mtbAartOpt.get();
}
mtbColr.setMtbAart(foundMtbAart);
}
onComplete.run(result);
}, onFailed);
}, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<VersamentoAutomaticoULResponseDTO>> call, Throwable t) {
if (onFailed != null) onFailed.run(new Exception(t));
}
});
}
}

View File

@@ -10,6 +10,7 @@ import it.integry.integrywmsnative.core.rest.model.DistribuzioneColloDTO;
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.VersamentoAutomaticoULResponseDTO;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.GET;
@@ -18,7 +19,7 @@ import retrofit2.http.Query;
public interface ColliMagazzinoRESTConsumerService {
@POST("SM2DistribuzioneRigheCollo")
@POST("wms/distribuzioneRigheCollo")
Call<ServiceRESTResponse<JsonObject>> distribuisciCollo(@Body DistribuzioneColloDTO distribuzioneCollo);
@POST("getColloByBarcode")
@@ -39,4 +40,10 @@ public interface ColliMagazzinoRESTConsumerService {
@POST("wms/spostaArtsTraUL")
Call<ServiceRESTResponse<Object>> spostaArtsTraUL(@Body SpostaArtsTraULRequestDTO spostaArtsTraULRequestDTO);
@POST("wms/assegnaLottoSuColloScarico")
Call<ServiceRESTResponse<MtbColt>> assegnaLottoSuColloScarico(@Body MtbColt mtbColt);
@POST("wms/versamentoAutomaticoUL")
Call<ServiceRESTResponse<VersamentoAutomaticoULResponseDTO>> versamentoAutomaticoUL(@Body MtbColt mtbColt);
}

View File

@@ -0,0 +1,43 @@
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 javax.inject.Singleton;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.model.JtbComt;
import it.integry.integrywmsnative.core.utility.UtilityQuery;
@Singleton
public class CommessaRESTConsumer extends _BaseRESTConsumer {
private final SystemRESTConsumer systemRESTConsumer;
public CommessaRESTConsumer(SystemRESTConsumer systemRESTConsumer) {
this.systemRESTConsumer = systemRESTConsumer;
}
public void getJtbComts(List<String> itemsToFind, RunnableArgs<List<JtbComt>> onComplete, RunnableArgs<Exception> onFailed) {
var whereCondMap = Stream.of(itemsToFind)
.map(x -> {
HashMap<String, Object> vars = new HashMap<>();
vars.put("cod_jcom", x);
return vars;
})
.toList();
var whereCond = " WHERE " + UtilityQuery.concatFieldListInWhereCond(whereCondMap);
Type typeOfObjectsList = new TypeToken<ArrayList<JtbComt>>() {}.getType();
this.systemRESTConsumer.processSql("SELECT * FROM jtb_comt " + whereCond, typeOfObjectsList, onComplete, onFailed);
}
}

View File

@@ -1,32 +1,52 @@
package it.integry.integrywmsnative.core.rest.consumers;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Singleton;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.model.CommonModelConsts;
import it.integry.integrywmsnative.core.model.MtbDepo;
import it.integry.integrywmsnative.core.utility.UtilityLogger;
public class DepositoRESTConsumer {
@Singleton
public class DepositoRESTConsumer extends _BaseRESTConsumer {
public static void getDepoByCodMdep(String codMdep, RunnableArgs<MtbDepo> onComplete) {
private final EntityRESTConsumer entityRESTConsumer;
private final SystemRESTConsumer systemRESTConsumer;
public DepositoRESTConsumer(EntityRESTConsumer entityRESTConsumer, SystemRESTConsumer systemRESTConsumer) {
this.entityRESTConsumer = entityRESTConsumer;
this.systemRESTConsumer = systemRESTConsumer;
}
public void getAll(RunnableArgs<List<MtbDepo>> onComplete, RunnableArgs<Exception> onFailed) {
Type typeOfObjectsList = new TypeToken<ArrayList<MtbDepo>>() {
}.getType();
this.systemRESTConsumer.processSql("SELECT * FROM mtb_depo", typeOfObjectsList, onComplete, onFailed);
}
public void getDepoByCodMdep(String codMdep, RunnableArgs<MtbDepo> onComplete, RunnableArgs<Exception> onFailed) {
MtbDepo mtbDepo = new MtbDepo();
mtbDepo.setCodMdep(codMdep);
mtbDepo.setOperation(CommonModelConsts.OPERATION.SELECT);
mtbDepo.setOnlyPkMaster(false);
EntityRESTConsumer.selectEntity(mtbDepo, new ISimpleOperationCallback<List<MtbDepo>>() {
this.entityRESTConsumer.selectEntity(mtbDepo, new ISimpleOperationCallback<>() {
@Override
public void onSuccess(List<MtbDepo> value) {
if(value != null && value.size() > 0) {
if (value != null && value.size() > 0) {
onComplete.run(value.get(0));
}
}
@Override
public void onFailed(Exception ex) {
UtilityLogger.errorMe(ex);
onFailed.run(ex);
}
}, MtbDepo.class);
}

View File

@@ -4,42 +4,26 @@ import android.util.Log;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;
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.model.EsitoType;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import it.integry.integrywmsnative.core.model.EntityBase;
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class EntityRESTConsumer {
public static <T extends EntityBase> void processEntity(T entityToSave, RunnableArgs<T> onComplete, RunnableArgs<Exception> onFailed, Class<T> type) {
processEntity(entityToSave, new ISimpleOperationCallback<T>() {
@Override
public void onSuccess(T value) {
if(onComplete != null) onComplete.run(value);
}
@Override
public void onFailed(Exception ex) {
if(onFailed != null) onFailed.run(ex);
}
}, type);
}
@Singleton
public class EntityRESTConsumer extends _BaseRESTConsumer {
public static <T extends EntityBase> void processEntity(T entityToSave, final ISimpleOperationCallback<T> callback, Class<T> type) {
public <T extends EntityBase> void processEntity(T entityToSave, final ISimpleOperationCallback<T> callback, Class<T> type) {
RunnableArgs<Exception> tmpFailed = ex -> {
if (callback != null) callback.onFailed(ex);
@@ -48,7 +32,7 @@ public class EntityRESTConsumer {
EntityRESTConsumerService service = RESTBuilder.getService(EntityRESTConsumerService.class);
service
.processEntity(entityToSave)
.enqueue(new Callback<ServiceRESTResponse<JsonObject>>() {
.enqueue(new Callback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<JsonObject>> call, Response<ServiceRESTResponse<JsonObject>> response) {
if (response.isSuccessful()) {
@@ -82,16 +66,16 @@ public class EntityRESTConsumer {
}
public static <T extends EntityBase> void processEntityList(List<T> entitiesToSave, final ISimpleOperationCallback<List<T>> callback, boolean singleTransaction, Class<T> type) {
public <T extends EntityBase> void processEntityList(List<T> entitiesToSave, boolean singleTransaction, Class<T> type, final RunnableArgs<List<T>> onComplete, final RunnableArgs<Exception> onFailed) {
RunnableArgs<Exception> tmpFailed = ex -> {
// UtilityExceptions.defaultException(null, ex);
if (callback != null) callback.onFailed(ex);
if (onFailed != null) onFailed.run(ex);
};
EntityRESTConsumerService service = RESTBuilder.getService(EntityRESTConsumerService.class);
Call<List<ServiceRESTResponse<JsonObject>>> request = service.processEntityList(singleTransaction, entitiesToSave);
request.enqueue(new Callback<List<ServiceRESTResponse<JsonObject>>>() {
request.enqueue(new Callback<>() {
@Override
public void onResponse(Call<List<ServiceRESTResponse<JsonObject>>> call, Response<List<ServiceRESTResponse<JsonObject>>> response) {
if (response.isSuccessful()) {
@@ -115,7 +99,7 @@ public class EntityRESTConsumer {
}
}
callback.onSuccess(responseList);
onComplete.run(responseList);
} else {
Log.e("EntityRESTConsumer", response.message());
tmpFailed.run(new Exception(response.message()));
@@ -136,7 +120,7 @@ public class EntityRESTConsumer {
}
public static <T extends EntityBase> void selectEntity(T entityToSave, final ISimpleOperationCallback<List<T>> callback, Class type) {
public <T extends EntityBase> void selectEntity(T entityToSave, final ISimpleOperationCallback<List<T>> callback, Class type) {
EntityRESTConsumerService service = RESTBuilder.getService(EntityRESTConsumerService.class);
Call<ServiceRESTResponse<JsonObject>> request = service.processEntity(entityToSave);

View File

@@ -0,0 +1,69 @@
package it.integry.integrywmsnative.core.rest.consumers;
import com.annimon.stream.Optional;
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 javax.inject.Singleton;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
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.utility.UtilityQuery;
@Singleton
public class GiacenzaRESTConsumer extends _BaseRESTConsumer {
private final SystemRESTConsumer mSystemRESTConsumer;
private final ArticoloRESTConsumer mArticoloRESTConsumer;
public GiacenzaRESTConsumer(SystemRESTConsumer systemRESTConsumer, ArticoloRESTConsumer articoloRESTConsumer) {
this.mSystemRESTConsumer = systemRESTConsumer;
this.mArticoloRESTConsumer = articoloRESTConsumer;
}
public void getGiacenzeInPosizione(MtbDepoPosizione posizione, RunnableArgs<List<MvwSitArtUdcDetInventario>> onComplete, RunnableArgs<Exception> onFailed) {
HashMap<String, Object> params = new HashMap<>();
params.put("posizione", posizione.getPosizione());
String whereCond = UtilityQuery.concatFieldsInWhereCond(params);
String query = "SELECT * from mvw_sitart_udc_det_inventario" +
" WHERE " + whereCond;
Type typeOfObjectsList = new TypeToken<ArrayList<MvwSitArtUdcDetInventario>>() {
}.getType();
this.mSystemRESTConsumer.<ArrayList<MvwSitArtUdcDetInventario>>processSql(query, typeOfObjectsList, inventarioList -> {
List<String> codMarts = Stream.of(inventarioList)
.map(x -> x.getCodMart().trim())
.toList();
mArticoloRESTConsumer.getByCodMarts(codMarts, mtbAarts -> {
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();
}
row.setMtbAart(foundMtbAart);
}
onComplete.run(inventarioList);
}, onFailed);
}, onFailed);
}
}

View File

@@ -0,0 +1,4 @@
package it.integry.integrywmsnative.core.rest.consumers;
public interface GiacenzaRESTConsumerService {
}

View File

@@ -29,11 +29,11 @@ public class MesRESTConsumer extends _BaseRESTConsumer {
this.mSystemRESTConsumer = systemRESTConsumer;
}
public static void getOrdiniLavorazioneMateriale(String codJfas, String idMateriale, RunnableArgs<List<OrdineLavorazioneDTO>> onComplete, RunnableArgs<Exception> onFailed) {
public void getOrdiniLavorazioneMateriale(String codJfas, String idMateriale, RunnableArgs<List<OrdineLavorazioneDTO>> onComplete, RunnableArgs<Exception> onFailed) {
MesRESTConsumerService mesRESTConsumerService = RESTBuilder.getService(MesRESTConsumerService.class);
mesRESTConsumerService.getOrdiniLavorazioneMateriale(codJfas, idMateriale)
.enqueue(new Callback<ServiceRESTResponse<List<OrdineLavorazioneDTO>>>() {
.enqueue(new Callback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<List<OrdineLavorazioneDTO>>> call, Response<ServiceRESTResponse<List<OrdineLavorazioneDTO>>> response) {
analyzeAnswer(response, "getOrdiniLavorazioneMateriale", (m) -> onComplete.run(response.body().getDto()), onFailed);

View File

@@ -1,5 +1,6 @@
package it.integry.integrywmsnative.core.rest.consumers;
import com.annimon.stream.Optional;
import com.annimon.stream.Stream;
import com.google.gson.reflect.TypeToken;
import com.orhanobut.logger.Logger;
@@ -8,22 +9,27 @@ import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Random;
import javax.inject.Singleton;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.model.CommonModelConsts;
import it.integry.integrywmsnative.core.model.MtbColr;
import it.integry.integrywmsnative.core.model.MtbColt;
import it.integry.integrywmsnative.core.model.MtbPartitaMag;
import it.integry.integrywmsnative.core.model.OrdineInevasoDTO;
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
import it.integry.integrywmsnative.core.rest.RESTBuilder;
import it.integry.integrywmsnative.core.rest.model.GetPickingListDTO;
import it.integry.integrywmsnative.core.rest.model.OrdineUscitaInevasoDTO;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import it.integry.integrywmsnative.core.rest.model.SitArtOrdDTO;
import it.integry.integrywmsnative.core.utility.UtilityDB;
import it.integry.integrywmsnative.core.utility.UtilityLogger;
import it.integry.integrywmsnative.core.rest.model.OrdineUscitaInevasoDTO;
import it.integry.integrywmsnative.core.utility.UtilityQuery;
import it.integry.integrywmsnative.core.utility.UtilityString;
import it.integry.integrywmsnative.gest.spedizione.model.PickingObjectDTO;
import it.integry.integrywmsnative.core.rest.model.GetPickingListDTO;
import it.integry.integrywmsnative.core.rest.model.SitArtOrdDTO;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
@@ -32,9 +38,11 @@ import retrofit2.Response;
public class OrdiniRESTConsumer extends _BaseRESTConsumer {
private final SystemRESTConsumer mSystemRESTConsumer;
private final EntityRESTConsumer mEntityRESTConsumer;
public OrdiniRESTConsumer(SystemRESTConsumer systemRESTConsumer) {
public OrdiniRESTConsumer(SystemRESTConsumer systemRESTConsumer, EntityRESTConsumer entityRESTConsumer) {
this.mSystemRESTConsumer = systemRESTConsumer;
this.mEntityRESTConsumer = entityRESTConsumer;
}
public void getSuggestedPickingList(String codMdep, List<SitArtOrdDTO> sitArtOrdList, RunnableArgs<List<PickingObjectDTO>> onComplete, RunnableArgs<Exception> onFailed) {
@@ -43,10 +51,59 @@ public class OrdiniRESTConsumer extends _BaseRESTConsumer {
service
.getSuggestedPickingList(codMdep, sitArtOrdList)
.enqueue(new Callback<ServiceRESTResponse<List<PickingObjectDTO>>>() {
.enqueue(new Callback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<List<PickingObjectDTO>>> call, Response<ServiceRESTResponse<List<PickingObjectDTO>>> response) {
analyzeAnswer(response, "getSuggestedPickingList", onComplete, onFailed);
analyzeAnswer(response, "getSuggestedPickingList", pickingObjects -> {
List<MtbPartitaMag> batchLotsToSearch = new ArrayList<>();
for (PickingObjectDTO pickingObjectDTO : pickingObjects) {
for (MtbColt mtbColt : pickingObjectDTO.getMtbColts()) {
Stream.of(mtbColt.getMtbColr())
.filter(x -> !UtilityString.isNullOrEmpty(x.getPartitaMag()))
.forEach(x -> {
if (!Stream.of(batchLotsToSearch).anyMatch(batchLotToSearch -> batchLotToSearch.getCodMart().equalsIgnoreCase(x.getCodMart()) && batchLotToSearch.getPartitaMag().equalsIgnoreCase(x.getPartitaMag()))) {
MtbPartitaMag mtbPartitaMag = new MtbPartitaMag()
.setCodMart(x.getCodMart())
.setPartitaMag(x.getPartitaMag());
mtbPartitaMag.setOperation(CommonModelConsts.OPERATION.SELECT_OBJECT);
mtbPartitaMag.setOnlyPkMaster(false);
batchLotsToSearch.add(mtbPartitaMag);
}
});
}
}
Random rand = new Random();
retrievePartiteMag(batchLotsToSearch, partite -> {
for (PickingObjectDTO pickingObjectDTO : pickingObjects) {
for (MtbColt mtbColt : pickingObjectDTO.getMtbColts()) {
for (MtbColr mtbColr : mtbColt.getMtbColr()) {
mtbColr.setId(rand.nextInt());
Optional<MtbPartitaMag> optionalMtbPartitaMag = Stream.of(partite)
.filter(x -> x.getCodMart().equalsIgnoreCase(mtbColr.getCodMart())
&& (!UtilityString.isNullOrEmpty(x.getPartitaMag()) && x.getPartitaMag().equalsIgnoreCase(mtbColr.getPartitaMag())))
.findFirst();
if (optionalMtbPartitaMag.isPresent()) mtbColr.setMtbPartitaMag(optionalMtbPartitaMag.get());
}
}
}
onComplete.run(pickingObjects);
}, onFailed);
}, onFailed);
}
@Override
@@ -58,6 +115,11 @@ public class OrdiniRESTConsumer extends _BaseRESTConsumer {
}
private void retrievePartiteMag(List<MtbPartitaMag> partitaMag, RunnableArgs<List<MtbPartitaMag>> onComplete, RunnableArgs<Exception> onFailed) {
this.mEntityRESTConsumer.processEntityList(partitaMag, true, MtbPartitaMag.class, onComplete, onFailed);
}
public void getOrdiniInevasi(String codMdep, GestioneEnum gestione, RunnableArgs<List<OrdineUscitaInevasoDTO>> onComplete, RunnableArgs<Exception> onFailed) {
OrdiniRESTConsumerService service = RESTBuilder.getService(OrdiniRESTConsumerService.class);
@@ -67,18 +129,18 @@ public class OrdiniRESTConsumer extends _BaseRESTConsumer {
@Override
public void onResponse(Call<ServiceRESTResponse<List<OrdineUscitaInevasoDTO>>> call, Response<ServiceRESTResponse<List<OrdineUscitaInevasoDTO>>> response) {
analyzeAnswer(response, "getOrdiniInevasi", responseDtoList -> {
if(responseDtoList == null) responseDtoList = new ArrayList<>();
if (responseDtoList == null) responseDtoList = new ArrayList<>();
onComplete.run(responseDtoList);
}, ex -> {
Logger.e(ex, "Errore durante il caricamento degli ordini di lavorazione");
if(onFailed != null) onFailed.run(ex);
if (onFailed != null) onFailed.run(ex);
});
}
@Override
public void onFailure(Call<ServiceRESTResponse<List<OrdineUscitaInevasoDTO>>> call, Throwable t) {
Logger.e(t, "Errore durante il caricamento degli ordini di lavorazione");
if(onFailed != null) onFailed.run(new Exception(t));
if (onFailed != null) onFailed.run(new Exception(t));
}
});
}
@@ -113,7 +175,7 @@ public class OrdiniRESTConsumer extends _BaseRESTConsumer {
public void getBancaliGiaRegistrati(List<OrdineInevasoDTO> orders, GestioneEnum gestione, int segno, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
String whereCondGestione = "";
if(gestione != null) {
if (gestione != null) {
whereCondGestione = "mtb_colt.gestione = " + UtilityDB.valueToString(gestione.getText()) + " ";
} else {
whereCondGestione = "(mtb_colt.gestione = 'V' OR mtb_colt.gestione = 'L') ";
@@ -142,12 +204,13 @@ public class OrdiniRESTConsumer extends _BaseRESTConsumer {
baseSql += "(" + UtilityQuery.concatFieldListInWhereCond(whereCondMapList) + ")";
Type typeOfObjectsList = new TypeToken<ArrayList<MtbColt>>() {}.getType();
Type typeOfObjectsList = new TypeToken<ArrayList<MtbColt>>() {
}.getType();
this.mSystemRESTConsumer.<List<MtbColt>>processSql(baseSql, typeOfObjectsList, value -> {
if(onComplete != null) onComplete.run(value);
}, ex -> {
if(onFailed != null) onFailed.run(ex);
});
if (onComplete != null) onComplete.run(value);
}, ex -> {
if (onFailed != null) onFailed.run(ex);
});
}
}

View File

@@ -59,7 +59,7 @@ public class PVOrdiniAcquistoRESTConsumer extends _BaseRESTConsumer {
});
griglia.setGrigliaAcquistiChild(listaArticoli);
onSuccess.run(griglia);
});
}, false);
}, onFailed);
}

View File

@@ -11,12 +11,12 @@ import javax.inject.Singleton;
import it.integry.integrywmsnative.BuildConfig;
import it.integry.integrywmsnative.core.exception.NoPrintersFoundException;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.model.MtbColt;
import it.integry.integrywmsnative.core.rest.RESTBuilder;
import it.integry.integrywmsnative.core.rest.model.JasperDTO;
import it.integry.integrywmsnative.core.rest.model.JasperPairDTO;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.model.MtbColt;
import it.integry.integrywmsnative.core.utility.UtilityLogger;
import it.integry.integrywmsnative.core.utility.UtilityString;
import retrofit2.Call;
@@ -32,64 +32,12 @@ public class PrinterRESTConsumer extends _BaseRESTConsumer {
}
public static void getAvailablePrintersStatic(final ISimpleOperationCallback<List<String>> callback) {
PrinterRESTConsumerService printerService = RESTBuilder.getService(PrinterRESTConsumerService.class);
printerService.getAvailablePrinters().enqueue(new Callback<ServiceRESTResponse<List<String>>>() {
@Override
public void onResponse(Call<ServiceRESTResponse<List<String>>> call, Response<ServiceRESTResponse<List<String>>> response) {
analyzeAnswer(response, "GetAvailablePrinters", callback);
}
@Override
public void onFailure(Call<ServiceRESTResponse<List<String>>> call, Throwable t) {
}
});
}
public void getAvailablePrinters(String codMdep, final RunnableArgs<List<String>> onComplete, final RunnableArgs<Exception> onFailed) {
getAvailablePrintersStatic(codMdep, onComplete, onFailed);
}
public static void getAvailablePrintersStatic(String codMdep, final RunnableArgs<List<String>> onComplete, RunnableArgs<Exception> onFailed) {
PrinterRESTConsumerService printerService = RESTBuilder.getService(PrinterRESTConsumerService.class);
printerService.getAvailablePrinters(codMdep).enqueue(new Callback<ServiceRESTResponse<List<String>>>() {
@Override
public void onResponse(Call<ServiceRESTResponse<List<String>>> call, Response<ServiceRESTResponse<List<String>>> response) {
analyzeAnswer(response, "GetAvailablePrinters", new ISimpleOperationCallback<List<String>>() {
@Override
public void onSuccess(List<String> value) {
onComplete.run(value != null ? Stream.of(value).withoutNulls().toList() : null);
}
@Override
public void onFailed(Exception ex) {
onFailed.run(ex);
}
});
}
@Override
public void onFailure(Call<ServiceRESTResponse<List<String>>> call, Throwable t) {
Log.e("GetAvailablePrinters", t.toString());
UtilityLogger.errorMe(new Exception(t));
onFailed.run(new Exception(t));
}
});
}
public void getAvailablePrinters(String codMdep, Type printerType, RunnableArgs<List<String>> onComplete, RunnableArgs<Exception> onFailed) {
PrinterRESTConsumer.getAvailablePrintersStatic(codMdep, printerType, onComplete, onFailed);
}
public static void getAvailablePrintersStatic(String codMdep, Type printerType, RunnableArgs<List<String>> onComplete, RunnableArgs<Exception> onFailed) {
String printerTypeStr = printerType != null ? printerType.toString() : null;
PrinterRESTConsumerService printerService = RESTBuilder.getService(PrinterRESTConsumerService.class);
printerService.getAvailablePrinters(codMdep, printerTypeStr).enqueue(new Callback<ServiceRESTResponse<List<String>>>() {
printerService.getAvailablePrinters(codMdep, printerTypeStr).enqueue(new Callback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<List<String>>> call, Response<ServiceRESTResponse<List<String>>> response) {
analyzeAnswer(response, "GetAvailablePrinters", printerList -> {
@@ -107,51 +55,40 @@ public class PrinterRESTConsumer extends _BaseRESTConsumer {
});
}
public void printCollo(String printerName, MtbColt testataColloToPrint, int quantity, String reportName, Runnable onComplete, RunnableArgs<Exception> onFailed) {
printColloStatic(printerName, testataColloToPrint, quantity, reportName, onComplete, onFailed);
}
public void printCollo(Type printerType, MtbColt testataColloToPrint, Runnable onComplete, RunnableArgs<Exception> onFailed) {
public static void printColloStatic(String printerName, MtbColt testataColloToPrint, int quantity, String reportName, Runnable onComplete, RunnableArgs<Exception> onFailed) {
if(BuildConfig.DEBUG) {
onComplete.run();
return;
}
if(UtilityString.isNullOrEmpty(printerName)) {
onFailed.run(new Exception("Nessuna stampante configurata: valore null"));
return;
}
// if (BuildConfig.DEBUG) {
// onComplete.run();
// return;
// }
PrinterRESTConsumerService printerService = RESTBuilder.getService(PrinterRESTConsumerService.class);
printerService.printCollo(
printerName,
testataColloToPrint.getDataColloS(),
testataColloToPrint.getGestione(),
testataColloToPrint.getSerCollo(),
testataColloToPrint.getNumCollo(),
quantity,
reportName)
Call<ServiceRESTResponse<Object>> callable = null;
if (printerType != null)
callable = printerService.printCollo(printerType.toString(), testataColloToPrint);
else
callable = printerService.printCollo(testataColloToPrint);
.enqueue(new Callback<ServiceRESTResponse<Object>>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) {
analyzeAnswer(response, "printCollo", data -> {
onComplete.run();
}, onFailed);
}
callable.enqueue(new Callback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) {
analyzeAnswer(response, "printCollo", data -> {
onComplete.run();
}, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<Object>> call, Throwable t) {
if(t.getMessage().contains("Printer not found")) {
onFailed.run(new NoPrintersFoundException());
} else onFailed.run(new Exception(t));
}
});
@Override
public void onFailure(Call<ServiceRESTResponse<Object>> call, Throwable t) {
if (t.getMessage().contains("Printer not found")) {
onFailed.run(new NoPrintersFoundException());
} else onFailed.run(new Exception(t));
}
});
}
public void printReport(String printerName, String reportName, HashMap<String, Object> params, int quantity, Runnable onComplete, RunnableArgs<Exception> onFailed) {
// if(BuildConfig.DEBUG) {
// if (BuildConfig.DEBUG) {
// onComplete.run();
// return;
// }
@@ -165,7 +102,7 @@ public class PrinterRESTConsumer extends _BaseRESTConsumer {
PrinterRESTConsumerService printerService = RESTBuilder.getService(PrinterRESTConsumerService.class);
printerService
.processPrintReport(printerName, quantity, jasperDTO)
.enqueue(new Callback<ServiceRESTResponse<Object>>() {
.enqueue(new Callback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) {
analyzeAnswer(response, "printReport", data -> {
@@ -175,11 +112,11 @@ public class PrinterRESTConsumer extends _BaseRESTConsumer {
@Override
public void onFailure(Call<ServiceRESTResponse<Object>> call, Throwable t) {
if(t.getMessage().contains("Printer not found")) {
if (t.getMessage().contains("Printer not found")) {
onFailed.run(new NoPrintersFoundException());
} else onFailed.run(new Exception(t));
}
});
});
}
}

View File

@@ -2,20 +2,16 @@ package it.integry.integrywmsnative.core.rest.consumers;
import java.util.List;
import it.integry.integrywmsnative.core.model.MtbColt;
import it.integry.integrywmsnative.core.rest.model.JasperDTO;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.POST;
import retrofit2.http.Query;
public interface PrinterRESTConsumerService {
@POST("getAvailablePrinters")
Call<ServiceRESTResponse<List<String>>> getAvailablePrinters();
@POST("getAvailablePrinters")
Call<ServiceRESTResponse<List<String>>> getAvailablePrinters(@Query("codMdep") String codMdep);
@@ -23,19 +19,6 @@ public interface PrinterRESTConsumerService {
Call<ServiceRESTResponse<List<String>>> getAvailablePrinters(@Query("codMdep") String codMdep, @Query("printerType") String printerType);
@POST("pkgPrintLabel")
@FormUrlEncoded
Call<ServiceRESTResponse<Object>> printCollo(
@Query("printerName") String printerName,
@Field("dataCollo") String dataCollo,
@Field("gestione") String gestione,
@Field("serCollo") String serCollo,
@Field("numCollo") int numCollo,
@Query("printQuantity") int printQuantity,
@Query("reportName") String reportName
);
@POST("processPrintReport")
Call<ServiceRESTResponse<Object>> processPrintReport(
@Query("printerName") String printerName,
@@ -43,4 +26,16 @@ public interface PrinterRESTConsumerService {
@Body JasperDTO jasperDTO
);
@POST("wms/printEtichettaSSCC")
Call<ServiceRESTResponse<Object>> printCollo(
@Query("printerType") String printerType,
@Body MtbColt mtbColtToPrint
);
@POST("wms/printEtichettaSSCC")
Call<ServiceRESTResponse<Object>> printCollo(
@Body MtbColt mtbColtToPrint
);
}

View File

@@ -4,6 +4,9 @@ import android.text.TextUtils;
import android.util.Log;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonParseException;
import com.google.gson.reflect.TypeToken;
import com.orhanobut.logger.Logger;
@@ -13,20 +16,22 @@ import java.io.InputStreamReader;
import java.io.Reader;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.inject.Singleton;
import it.integry.integrywmsnative.BuildConfig;
import it.integry.integrywmsnative.core.CommonConst;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.model.Azienda;
import it.integry.integrywmsnative.core.rest.RESTBuilder;
import it.integry.integrywmsnative.core.rest.model.AvailableCodMdepsDTO;
import it.integry.integrywmsnative.core.rest.model.MailRequestDTO;
import it.integry.integrywmsnative.core.rest.model.NativeSqlRequestDTO;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.model.Azienda;
import it.integry.integrywmsnative.core.settings.SettingsManager;
import it.integry.integrywmsnative.core.utility.UtilityDate;
import it.integry.integrywmsnative.core.utility.UtilityLogger;
import it.integry.integrywmsnative.core.utility.UtilityString;
import retrofit2.Call;
@@ -42,27 +47,29 @@ public class SystemRESTConsumer extends _BaseRESTConsumer {
nativeSqlDTO.nativeSql = nativeSql;
SystemRESTConsumerService service = RESTBuilder.getService(SystemRESTConsumerService.class);
service.processSql(nativeSqlDTO).enqueue(new Callback<ServiceRESTResponse<Object>>() {
service.processSql(nativeSqlDTO).enqueue(new Callback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) {
analyzeAnswer(response, "ProcessSql", new ISimpleOperationCallback<Object>() {
@Override
public void onSuccess(Object value) {
Gson gson = new Gson();
String json = gson.toJson(value);
analyzeAnswer(response, "ProcessSql", o -> {
Gson gson = new GsonBuilder()
.registerTypeAdapter(Date.class, (JsonDeserializer) (json, typeOfT, context) -> {
try {
return UtilityDate.recognizeDate(json.getAsString());
} catch (Exception e) {
throw new JsonParseException(e);
}
})
.create();
InputStream ims = new ByteArrayInputStream(json.getBytes());
Reader reader = new InputStreamReader(ims);
T gsonObj = gson.fromJson(reader, clazz);
onComplete.run(gsonObj);
}
String json = gson.toJson(o);
@Override
public void onFailed(Exception ex) {
if(onFailed != null) onFailed.run(ex);
}
});
InputStream ims = new ByteArrayInputStream(json.getBytes());
Reader reader = new InputStreamReader(ims);
T gsonObj = gson.fromJson(reader, clazz);
onComplete.run(gsonObj);
}, onFailed);
}
@Override
@@ -73,6 +80,7 @@ public class SystemRESTConsumer extends _BaseRESTConsumer {
});
}
public static <T> void processSqlStatic(String nativeSql, final Type clazz, final ISimpleOperationCallback<T> callback) {
processSqlStatic(nativeSql, clazz, data -> {
@@ -86,19 +94,19 @@ public class SystemRESTConsumer extends _BaseRESTConsumer {
}
public static void getAvailableProfiles(final ISimpleOperationCallback<List<String>> callback){
public static void getAvailableProfiles(final RunnableArgs<List<String>> onSuccess, RunnableArgs<Exception> onFailed) {
SystemRESTConsumerService service = RESTBuilder.getService(SystemRESTConsumerService.class);
service.getAvailableProfiles(SettingsManager.i().getUser().getUsername(), SettingsManager.i().getUser().getPassword()).enqueue(new Callback<ServiceRESTResponse<List<String>>>() {
@Override
public void onResponse(Call<ServiceRESTResponse<List<String>>> call, Response<ServiceRESTResponse<List<String>>> response) {
analyzeAnswer(response, "ProfilesAvailable", callback);
analyzeAnswer(response, "ProfilesAvailable", onSuccess, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<List<String>>> call, final Throwable t) {
Log.e("ProfilesAvailable", t.toString());
callback.onFailed(new Exception(t));
onFailed.run(new Exception(t));
UtilityLogger.errorMe(new Exception(t));
}
});
@@ -107,23 +115,23 @@ public class SystemRESTConsumer extends _BaseRESTConsumer {
}
public void getAvailableCodMdeps(final RunnableArgs<List<AvailableCodMdepsDTO>> onSuccess, RunnableArgs<Exception> onFailed) {
getAvailableCodMdepsStatic(onSuccess, onFailed);
}
public static void getAvailableCodMdeps(final ISimpleOperationCallback<List<AvailableCodMdepsDTO>> callback){
public static void getAvailableCodMdepsStatic(final RunnableArgs<List<AvailableCodMdepsDTO>> onSuccess, RunnableArgs<Exception> onFailed) {
SystemRESTConsumerService service = RESTBuilder.getService(SystemRESTConsumerService.class);
service.getAvailableCodMdeps().enqueue(new Callback<ServiceRESTResponse<List<AvailableCodMdepsDTO>>>() {
service.getAvailableCodMdeps().enqueue(new Callback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<List<AvailableCodMdepsDTO>>> call, Response<ServiceRESTResponse<List<AvailableCodMdepsDTO>>> response) {
analyzeAnswer(response, "CodMdepsAvailable", callback);
analyzeAnswer(response, "CodMdepsAvailable", onSuccess, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<List<AvailableCodMdepsDTO>>> call, final Throwable t) {
Log.e("CodMdepsAvailable", t.toString());
callback.onFailed(new Exception(t));
// UtilityLogger.errorMe(new Exception(t));
onFailed.run(new Exception(t));
}
});
}
@@ -139,7 +147,7 @@ public class SystemRESTConsumer extends _BaseRESTConsumer {
String currentAzienda = UtilityString.isNullOrEmpty(SettingsManager.i().getUserSession().getProfileDB()) ? "" : " [" + SettingsManager.i().getUserSession().getProfileDB() + "]";
String dest = "";
if(BuildConfig.DEBUG) {
if (BuildConfig.DEBUG) {
dest = TextUtils.join(";", CommonConst.Mail.forErrorsDebug);
} else {
dest = TextUtils.join(";", CommonConst.Mail.forErrors);
@@ -155,10 +163,10 @@ public class SystemRESTConsumer extends _BaseRESTConsumer {
.setHtml(true);
sendMail(mailDTO, () -> {
if(onComplete != null) onComplete.run();
if (onComplete != null) onComplete.run();
}, ex -> {
Log.e(SystemRESTConsumer.class.getName(), "", ex);
if(onFailed != null) onFailed.run(ex);
if (onFailed != null) onFailed.run(ex);
});
}
@@ -169,12 +177,12 @@ public class SystemRESTConsumer extends _BaseRESTConsumer {
service.sendMail(mailDTO).enqueue(new Callback<ServiceRESTResponse<String>>() {
@Override
public void onResponse(Call<ServiceRESTResponse<String>> call, Response<ServiceRESTResponse<String>> response) {
if(onComplete != null) onComplete.run();
if (onComplete != null) onComplete.run();
}
@Override
public void onFailure(Call<ServiceRESTResponse<String>> call, Throwable t) {
if(onFailed != null) {
if (onFailed != null) {
onFailed.run(new Exception(t));
}
}
@@ -182,21 +190,21 @@ public class SystemRESTConsumer extends _BaseRESTConsumer {
}
public static void getAzienda(RunnableArgs<Azienda> onComplete, RunnableArgs<Exception> onFailed) {
String sql = "SELECT TOP 1 * FROM azienda";
Type typeOfObjectsList = new TypeToken<ArrayList<Azienda>>() {}.getType();
Type typeOfObjectsList = new TypeToken<ArrayList<Azienda>>() {
}.getType();
SystemRESTConsumer.processSqlStatic(sql, typeOfObjectsList, new ISimpleOperationCallback<List<Azienda>>() {
@Override
public void onSuccess(List<Azienda> value) {
if(onComplete != null) onComplete.run(value.get(0));
if (onComplete != null) onComplete.run(value.get(0));
}
@Override
public void onFailed(Exception ex) {
if(onFailed != null) onFailed.run(ex);
if (onFailed != null) onFailed.run(ex);
}
});

View File

@@ -14,96 +14,78 @@ import retrofit2.Response;
public class _BaseRESTConsumer {
public static <T> void analyzeAnswer(Response<ServiceRESTResponse<T>> response, String logTitle, final ISimpleOperationCallback<T> callback) {
public static <T> void analyzeAnswer(Response<ServiceRESTResponse<T>> response, String logTitle, RunnableArgs<T> onComplete, RunnableArgs<Exception> onFailed) {
if (response.isSuccessful()) {
if (response.body() != null) {
if (response.body().getEsito() == EsitoType.OK) {
if (!UtilityString.isNullOrEmpty(response.body().getErrorMessage())) {
callback.onFailed(new Exception(response.body().getErrorMessage()));
onFailed.run(new Exception(response.body().getErrorMessage()));
} else {
T dataObj = response.body().getDto() != null ?
response.body().getDto() :
response.body().getEntity();
callback.onSuccess(dataObj);
onComplete.run(dataObj);
}
} else {
Log.e(logTitle, response.body().getErrorMessage());
// callback.onFailed(new Exception(response.body().getErrorMessage()));
callback.onFailed(CommonRESTException.tryRecognizeException(response.body().getErrorMessage()));
onFailed.run(CommonRESTException.tryRecognizeException(response.body().getErrorMessage()));
}
} else {
Log.e(logTitle, response.message());
callback.onFailed(new Exception(response.message()));
onFailed.run(new Exception(response.message()));
}
} else {
Log.e(logTitle, "Status " + response.code() + ": " + response.message());
callback.onFailed(new Exception("Status " + response.code() + ": " + response.message()));
}
}
public static <T> void analyzeAnswer(Response<ServiceRESTResponse<T>> response, String logTitle, RunnableArgs<T> onComplete, RunnableArgs<Exception> onFailed) {
analyzeAnswer(response, logTitle, new ISimpleOperationCallback<T>() {
@Override
public void onSuccess(T value) {
onComplete.run(value);
}
@Override
public void onFailed(Exception ex) {
onFailed.run(ex);
}
});
}
public static <T> void analyzeAnswerList(Response<ServiceRESTResponse<T>> response, String logTitle, final ISimpleOperationCallback<List<T>> callback) {
if (response.isSuccessful()) {
if (response.body() != null) {
if (response.body().getEsito() == EsitoType.OK) {
if (!UtilityString.isNullOrEmpty(response.body().getErrorMessage())) {
callback.onFailed(new Exception(response.body().getErrorMessage()));
} else {
List<T> dataObj = response.body().getEntityList();
callback.onSuccess(dataObj);
}
} else {
Log.e(logTitle, response.body().getErrorMessage());
callback.onFailed(new Exception(response.body().getErrorMessage()));
}
if (response.code() == 404) {
Log.e(logTitle, "Errore " + response.code() + ": risorsa non trovata (" + response.raw().request().url().toString() + ")");
onFailed.run(new Exception("Errore " + response.code() + ": risorsa non trovata (" + logTitle + ")"));
} else {
Log.e(logTitle, response.message());
callback.onFailed(new Exception(response.message()));
Log.e(logTitle, "Status " + response.code() + ": " + response.message());
onFailed.run(new Exception("Status " + response.code() + ": " + response.message()));
}
} else {
Log.e(logTitle, "Status " + response.code() + ": " + response.message());
callback.onFailed(new Exception("Status " + response.code() + ": " + response.message()));
}
}
public static <T> void analyzeAnswerList(Response<ServiceRESTResponse<T>> response, String logTitle, RunnableArgs<List<T>> onComplete, RunnableArgs<Exception> onFailed) {
analyzeAnswerList(response, logTitle, new ISimpleOperationCallback<List<T>>() {
@Override
public void onSuccess(List<T> value) {
onComplete.run(value);
}
if (response.isSuccessful()) {
if (response.body() != null) {
if (response.body().getEsito() == EsitoType.OK) {
if (!UtilityString.isNullOrEmpty(response.body().getErrorMessage())) {
onFailed.run(new Exception(response.body().getErrorMessage()));
} else {
@Override
public void onFailed(Exception ex) {
onFailed.run(ex);
List<T> dataObj = response.body().getEntityList();
onComplete.run(dataObj);
}
} else {
Log.e(logTitle, response.body().getErrorMessage());
onFailed.run(new Exception(response.body().getErrorMessage()));
}
} else {
Log.e(logTitle, response.message());
onFailed.run(new Exception(response.message()));
}
});
} else {
if (response.code() == 404) {
Log.e(logTitle, "Errore " + response.code() + ": risorsa non trovata");
onFailed.run(new Exception("Errore " + response.code() + ": risorsa non trovata (" + logTitle + ")"));
} else {
Log.e(logTitle, "Status " + response.code() + ": " + response.message());
onFailed.run(new Exception("Status " + response.code() + ": " + response.message()));
}
}
}
public static <T> void analyzeListOfAnswers(Response<List<ServiceRESTResponse<T>>> responseList, String logTitle, RunnableArgs<List<T>> onComplete, RunnableArgs<Exception> onFailed) {
if (responseList.isSuccessful()) {
if (responseList.body() != null) {
List<T> analyzedList = new ArrayList<>();
for (ServiceRESTResponse<T> response : responseList.body()){
for (ServiceRESTResponse<T> response : responseList.body()) {
if (response.getEsito() == EsitoType.OK) {
if (!UtilityString.isNullOrEmpty(response.getErrorMessage())) {
onFailed.run(new Exception(response.getErrorMessage()));
@@ -111,7 +93,7 @@ public class _BaseRESTConsumer {
T dataObj = response.getDto() != null ?
response.getDto() :
response.getEntity();
if (dataObj !=null ) analyzedList.add(dataObj);
if (dataObj != null) analyzedList.add(dataObj);
}
} else {
@@ -126,8 +108,13 @@ public class _BaseRESTConsumer {
onFailed.run(new Exception(responseList.message()));
}
} else {
Log.e(logTitle, "Status " + responseList.code() + ": " + responseList.message());
onFailed.run(new Exception("Status " + responseList.code() + ": " + responseList.message()));
if (responseList.code() == 404) {
Log.e(logTitle, "Errore " + responseList.code() + ": risorsa non trovata");
onFailed.run(new Exception("Errore " + responseList.code() + ": risorsa non trovata (" + logTitle + ")"));
} else {
Log.e(logTitle, "Status " + responseList.code() + ": " + responseList.message());
onFailed.run(new Exception("Status " + responseList.code() + ": " + responseList.message()));
}
}
}
}

View File

@@ -3,6 +3,7 @@ package it.integry.integrywmsnative.core.rest.model;
import java.math.BigDecimal;
import java.text.ParseException;
import java.util.Date;
import java.util.List;
import it.integry.integrywmsnative.core.model.OrdineInevasoDTO;
import it.integry.integrywmsnative.core.utility.UtilityDate;
@@ -43,9 +44,7 @@ public class OrdineUscitaInevasoDTO extends OrdineInevasoDTO {
private boolean flagEvaso;
private String nomeAgente;
private String codJfas;
private List<AvailableClassMerc> availableClassMerc;
public Integer getIdViaggio() {
return idViaggio;
@@ -363,6 +362,16 @@ public class OrdineUscitaInevasoDTO extends OrdineInevasoDTO {
return this;
}
public List<AvailableClassMerc> getAvailableClassMerc() {
return availableClassMerc;
}
public OrdineUscitaInevasoDTO setAvailableClassMerc(List<AvailableClassMerc> availableClassMerc) {
this.availableClassMerc = availableClassMerc;
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
@@ -382,4 +391,28 @@ public class OrdineUscitaInevasoDTO extends OrdineInevasoDTO {
result = 31 * result + getGestione().hashCode();
return result;
}
public static class AvailableClassMerc {
private String codMgrp;
private List<String> codMsgr;
public String getCodMgrp() {
return codMgrp;
}
public AvailableClassMerc setCodMgrp(String codMgrp) {
this.codMgrp = codMgrp;
return this;
}
public List<String> getCodMsgr() {
return codMsgr;
}
public AvailableClassMerc setCodMsgr(List<String> codMsgr) {
this.codMsgr = codMsgr;
return this;
}
}
}

View File

@@ -0,0 +1,29 @@
package it.integry.integrywmsnative.core.rest.model;
import java.util.List;
import it.integry.integrywmsnative.core.model.MtbColr;
public class VersamentoAutomaticoULResponseDTO {
private List<MtbColr> success;
private List<MtbColr> failed;
public List<MtbColr> getSuccess() {
return success;
}
public VersamentoAutomaticoULResponseDTO setSuccess(List<MtbColr> success) {
this.success = success;
return this;
}
public List<MtbColr> getFailed() {
return failed;
}
public VersamentoAutomaticoULResponseDTO setFailed(List<MtbColr> failed) {
this.failed = failed;
return this;
}
}

View File

@@ -0,0 +1,104 @@
package it.integry.integrywmsnative.core.services.inventario;
import androidx.databinding.ObservableArrayList;
import com.annimon.stream.Stream;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Singleton;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.model.MtbAart;
import it.integry.integrywmsnative.core.model.MtbColr;
import it.integry.integrywmsnative.core.model.MtbColt;
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
import it.integry.integrywmsnative.core.model.MvwSitArtUdcDetInventario;
import it.integry.integrywmsnative.core.rest.consumers.GiacenzaRESTConsumer;
@Singleton
public class InventarioService {
private final GiacenzaRESTConsumer mGiacenzaRESTConsumer;
public InventarioService(GiacenzaRESTConsumer giacenzaRESTConsumer) {
this.mGiacenzaRESTConsumer = giacenzaRESTConsumer;
}
public void getInventarioDaPosizione(MtbDepoPosizione posizione, RunnableArgs<List<MvwSitArtUdcDetInventario>> onSuccess, RunnableArgs<Exception> onError) {
mGiacenzaRESTConsumer.getGiacenzeInPosizione(posizione, onSuccess, onError);
}
public void getInventarioDaPosizionePerArticolo(MtbDepoPosizione posizione, MtbAart articolo, RunnableArgs<List<MvwSitArtUdcDetInventario>> onSuccess, RunnableArgs<Exception> onError) {
getInventarioDaPosizione(posizione, (inventario) -> {
List<MvwSitArtUdcDetInventario> inventarioArticolo = Stream.of(inventario).filter(
x -> articolo.getCodMart().equalsIgnoreCase(x.getCodMart())
).toList();
onSuccess.run(inventarioArticolo);
}, onError);
}
public MtbColt mapInventarioToMtbColt(MvwSitArtUdcDetInventario inventario) {
return mapInventarioToMtbColt(inventario, true);
}
public MtbColt mapInventarioToMtbColt(MvwSitArtUdcDetInventario inventario, boolean includeRows) {
MtbColt mtbColt = new MtbColt();
mtbColt.setGestione(inventario.getGestione());
mtbColt.setDataCollo(inventario.getDataCollo());
mtbColt.setSerCollo(inventario.getSerCollo());
mtbColt.setNumCollo(inventario.getNumCollo());
mtbColt.setSegno(inventario.getSegno());
mtbColt.setCodMdep(inventario.getCodMdep());
mtbColt.setPosizione(inventario.getPosizione());
mtbColt.setCodJcom(inventario.getCodJcom());
mtbColt.setPesoNettoKg(inventario.getPesoNettoKg());
mtbColt.setPesoKg(inventario.getPesoLordoKg());
mtbColt.setCodJfas(inventario.getCodJfas());
if (includeRows) {
ObservableArrayList<MtbColr> rows = new ObservableArrayList<>();
rows.add(mapInventarioToMtbColr(inventario));
mtbColt.setMtbColr(rows);
}
return mtbColt;
}
public MtbColr mapInventarioToMtbColr(MvwSitArtUdcDetInventario inventario) {
MtbColr mtbColr = new MtbColr();
mtbColr.setGestione(inventario.getGestione());
mtbColr.setDataCollo(inventario.getDataCollo());
mtbColr.setSerCollo(inventario.getSerCollo());
mtbColr.setNumCollo(inventario.getNumCollo());
mtbColr.setCodMart(inventario.getCodMart());
mtbColr.setDescrizione(inventario.getDescrizioneEstesa());
mtbColr.setPartitaMag(inventario.getPartitaMag());
mtbColr.setCodJcom(inventario.getCodJcom());
mtbColr.setUntMis(inventario.getUntMis());
mtbColr.setQtaCol(inventario.getQtaCol());
mtbColr.setNumCnf(inventario.getNumCnf());
mtbColr.setQtaCnf(inventario.getQtaCnf());
mtbColr.setPesoNettoKg(inventario.getPesoNettoKg());
mtbColr.setPesoLordoKg(inventario.getPesoLordoKg());
mtbColr.setMtbAart(inventario.getMtbAart());
return mtbColr;
}
public List<MtbColt> mapInventarioToMtbColtList(List<MvwSitArtUdcDetInventario> inventario) {
return new ArrayList<>(Stream.of(inventario).groupBy(x -> x.getNumCollo() + "-" + x.getDataCollo() + "-" + x.getSerCollo() + x.getGestione()).map(inv -> {
List<MvwSitArtUdcDetInventario> rows = inv.getValue();
MtbColt mtbColt = mapInventarioToMtbColt(rows.get(0), false);
ObservableArrayList<MtbColr> mtbColrs = new ObservableArrayList<>();
mtbColrs.addAll(Stream.of(rows).map(this::mapInventarioToMtbColr).toList());
mtbColt.setMtbColr(mtbColrs);
return mtbColt;
}).toList());
}
}

View File

@@ -1,5 +1,6 @@
package it.integry.integrywmsnative.core.settings;
import java.util.ArrayList;
import java.util.List;
import it.integry.integrywmsnative.core.rest.model.AvailableCodMdepsDTO;
@@ -33,6 +34,7 @@ public class DBSettingsModel {
private boolean flagForceAllToColli;
private boolean flagSpedizioneEnableManualPick;
private boolean flagSpedizioneCanSelectMultipleOrders;
private List<String> notePerditaDocInterni = new ArrayList<>();
private boolean flagSpedizioneUseQtaOrd;
private String produzioneDefaultCodAnag;
private String reportNameSpedizionChiudiOrdine;
@@ -271,4 +273,13 @@ public class DBSettingsModel {
this.onNumCnfInputChanged = onNumCnfInputChanged;
return this;
}
public List<String> getNotePerditaDocInterni() {
return notePerditaDocInterni;
}
public DBSettingsModel setNotePerditaDocInterni(List<String> notePerditaDocInterni) {
this.notePerditaDocInterni = notePerditaDocInterni;
return this;
}
}

View File

@@ -7,13 +7,13 @@ import com.google.firebase.perf.metrics.Trace;
import java.net.SocketTimeoutException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import it.integry.integrywmsnative.R;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.model.StbGestSetup;
import it.integry.integrywmsnative.core.rest.consumers.GestSetupRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.ISimpleOperationCallback;
import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
import it.integry.integrywmsnative.core.rest.model.AvailableCodMdepsDTO;
@@ -30,12 +30,12 @@ public class SettingsManager {
private static Context mContext;
public static void init(Context context){
public static void init(Context context) {
mContext = context;
settingsModelIstance = (SettingsModel) Stash.getObject(TAG, SettingsModel.class);
if(settingsModelIstance == null) {
if (settingsModelIstance == null) {
settingsModelIstance = new SettingsModel();
settingsModelIstance.setServer(new SettingsModel.Server());
@@ -49,31 +49,28 @@ public class SettingsManager {
}
public static SettingsModel i(){
public static SettingsModel i() {
return settingsModelIstance;
}
public static DBSettingsModel iDB(){
public static DBSettingsModel iDB() {
return dbSettingsModelIstance;
}
public static boolean isFirstStart(){
public static boolean isFirstStart() {
return firstStart;
}
public static boolean isInstanceAvailable(){
public static boolean isInstanceAvailable() {
return i() != null;
}
public static void update(){
public static void update() {
Stash.put(TAG, settingsModelIstance);
}
public static void loadDBVariables(Runnable onComplete, RunnableArgs<Exception> onFailed){
public static void loadDBVariables(RunnableArgs<String> onProgress, Runnable onComplete, RunnableArgs<Exception> onFailed) {
dbSettingsModelIstance = new DBSettingsModel();
Trace perfTrace = UtilityFirebase.getNewPerformanceTrace("db_load_vars");
@@ -86,90 +83,93 @@ public class SettingsManager {
RunnableArgs<Exception> tmpOnFailed = ex -> {
perfTrace.putAttribute("failed", "true");
if(!(ex instanceof SocketTimeoutException)) onFailed.run(ex);
else onFailed.run(new Exception("Errore durante il caricamento dei dati. Riavviare l'applicazione!"));
if (!(ex instanceof SocketTimeoutException)) onFailed.run(ex);
else
onFailed.run(new Exception("Errore durante il caricamento dei dati. Riavviare l'applicazione!"));
};
loadDatiAzienda(() ->
loadAvailableProfiles(() ->
loadAvailableCodMdeps(() ->
loadAvailablePosizioni(() ->
loadGestSetupValues(tmpOnComplete, tmpOnFailed) ,tmpOnFailed), tmpOnFailed), tmpOnFailed), tmpOnFailed);
onProgress.run("dati azienda");
loadDatiAzienda(() -> {
onProgress.run("profili");
loadAvailableProfiles(() -> {
onProgress.run("depositi");
loadAvailableCodMdeps(() -> {
onProgress.run("posizioni");
loadAvailablePosizioni(() -> {
onProgress.run("impostazioni");
loadGestSetupValues(tmpOnComplete, tmpOnFailed);
}, tmpOnFailed);
}, tmpOnFailed);
}, tmpOnFailed);
}, tmpOnFailed);
}
private static void loadDatiAzienda(Runnable onComplete, RunnableArgs<Exception> onFailed) {
SystemRESTConsumer.getAzienda(datiAzienda -> {
SettingsManager.iDB().setDatiAzienda(datiAzienda);
if(onComplete != null) onComplete.run();
if (onComplete != null) onComplete.run();
}, onFailed);
}
private static void loadAvailableProfiles(Runnable onComplete, RunnableArgs<Exception> onFailed){
SystemRESTConsumer.getAvailableProfiles(new ISimpleOperationCallback<List<String>>() {
@Override
public void onSuccess(List<String> availableProfiles) {
dbSettingsModelIstance.setAvailableProfiles(availableProfiles);
private static void loadAvailableProfiles(Runnable onComplete, RunnableArgs<Exception> onFailed) {
SystemRESTConsumer.getAvailableProfiles(availableProfiles -> {
dbSettingsModelIstance.setAvailableProfiles(availableProfiles);
onComplete.run();
onComplete.run();
}
@Override
public void onFailed(Exception ex) {
//BOH
if(onFailed != null) onFailed.run(ex);
}
}, ex -> {
//BOH
if (onFailed != null) onFailed.run(ex);
});
}
private static void loadAvailableCodMdeps(Runnable onComplete, RunnableArgs<Exception> onFailed) {
SystemRESTConsumer.getAvailableCodMdeps(new ISimpleOperationCallback<List<AvailableCodMdepsDTO>>() {
@Override
public void onSuccess(List<AvailableCodMdepsDTO> availableCodMdeps) {
dbSettingsModelIstance.setAvailableCodMdep(availableCodMdeps);
SystemRESTConsumer.getAvailableCodMdepsStatic(availableCodMdeps -> {
dbSettingsModelIstance.setAvailableCodMdep(availableCodMdeps);
if(availableCodMdeps == null || availableCodMdeps.size() == 0) {
onFailed.run(new Exception(mContext.getText(R.string.no_codmdep_available).toString()));
return;
}
if (availableCodMdeps == null || availableCodMdeps.size() == 0) {
onFailed.run(new Exception(mContext.getText(R.string.no_codmdep_available).toString()));
return;
}
boolean codMdepExistsAnymore = false;
boolean codMdepExistsAnymore = false;
if(settingsModelIstance.getUserSession().getDepo() != null){
for(AvailableCodMdepsDTO availableCodMdepDTO : availableCodMdeps){
//Controllo se il codMdep salvato esiste ancora
if(availableCodMdepDTO.getCodMdep().equalsIgnoreCase(settingsModelIstance.getUserSession().getDepo().getCodMdep())) {
codMdepExistsAnymore = true;
break;
}
if (settingsModelIstance.getUserSession().getDepo() != null) {
for (AvailableCodMdepsDTO availableCodMdepDTO : availableCodMdeps) {
//Controllo se il codMdep salvato esiste ancora
if (availableCodMdepDTO.getCodMdep().equalsIgnoreCase(settingsModelIstance.getUserSession().getDepo().getCodMdep())) {
codMdepExistsAnymore = true;
break;
}
}
if(!codMdepExistsAnymore){
settingsModelIstance.getUserSession().setDepo(availableCodMdeps.get(0));
}
if(onComplete != null) onComplete.run();
}
@Override
public void onFailed(Exception ex) {
//BOH
if(onFailed != null) onFailed.run(ex);
if (!codMdepExistsAnymore) {
settingsModelIstance.getUserSession().setDepo(availableCodMdeps.get(0));
}
if (onComplete != null) onComplete.run();
}, ex -> {
//BOH
if (onFailed != null) onFailed.run(ex);
});
}
private static void loadAvailablePosizioni(Runnable onComplete, RunnableArgs<Exception> onFailed) {
PosizioniRESTConsumer.getAvailablePosizioni(availablePosizioni -> {
dbSettingsModelIstance.setAvailablePosizioni(availablePosizioni);
dbSettingsModelIstance.setAvailablePosizioni(availablePosizioni);
if(onComplete != null) onComplete.run();
}, ex -> {
if(onFailed != null) onFailed.run(ex);
}
if (onComplete != null) onComplete.run();
}, ex -> {
if (onFailed != null) onFailed.run(ex);
}
);
}
@@ -266,20 +266,24 @@ public class SettingsManager {
.setGestName("PICKING")
.setSection("SETUP")
.setKeySection("ON_NUM_CNF_INPUT_CHANGED"));
stbGestSetupList.add(new StbGestSetup()
.setGestName("PVM")
.setSection("DOC_INTERNI")
.setKeySection("NOTE_PERDITA"));
GestSetupRESTConsumer.getValues(stbGestSetupList, list -> {
dbSettingsModelIstance.setDefaultCausaleRettificaGiacenze(getValueFromList(list, "SETUP", "DEFAULT_CAUSALE_RETTIFICA_GIACENZE", String.class));
dbSettingsModelIstance.setEnableCheckPartitaMagCheckPickingV(getValueFromList(list, "SETUP","ENABLE_CHECK_PARTITA_MAG_PICKING_V", Boolean.class));
dbSettingsModelIstance.setFlagMultiClienteOrdV(getValueFromList(list, "SETUP","FLAG_MULTI_CLIENTE_ORD_VENDITA", Boolean.class));
dbSettingsModelIstance.setDefaultCodAnag(getValueFromList(list, "SETUP","COD_ANAG_DEFAULT", String.class));
dbSettingsModelIstance.setDefaultCriterioDistribuzione(getValueFromList(list, "SETUP","DEFAULT_CRITERIO_DISTRIBUZIONE", String.class));
dbSettingsModelIstance.setEnableCheckPartitaMagCheckPickingV(getValueFromList(list, "SETUP", "ENABLE_CHECK_PARTITA_MAG_PICKING_V", Boolean.class));
dbSettingsModelIstance.setFlagMultiClienteOrdV(getValueFromList(list, "SETUP", "FLAG_MULTI_CLIENTE_ORD_VENDITA", Boolean.class));
dbSettingsModelIstance.setDefaultCodAnag(getValueFromList(list, "SETUP", "COD_ANAG_DEFAULT", String.class));
dbSettingsModelIstance.setDefaultCriterioDistribuzione(getValueFromList(list, "SETUP", "DEFAULT_CRITERIO_DISTRIBUZIONE", String.class));
dbSettingsModelIstance.setFlagAskClienteInPickingLibero(getValueFromList(list, "PICKING_LIBERO", "FLAG_ASK_CLIENTE", Boolean.class));
dbSettingsModelIstance.setFlagAllowEmptyClienteInPickingLibero(getValueFromList(list, "PICKING_LIBERO", "FLAG_ALLOW_EMPTY_CLIENTE", Boolean.class));
dbSettingsModelIstance.setFlagCanAddExtraItemSpedizione(getValueFromList(list, "SPEDIZIONE", "FLAG_CAN_ADD_EXTRA_ITEMS", Boolean.class));
dbSettingsModelIstance.setFlagCanAutoOpenNewULAccettazione(getValueFromList(list, "ACCETTAZIONE", "FLAG_AUTO_OPEN_NEW_UL", Boolean.class));
dbSettingsModelIstance.setFlagCanAddExtraQuantitySpedizione(getValueFromList(list, "SPEDIZIONE", "FLAG_CAN_ADD_EXTRA_QUANTITY", Boolean.class));
dbSettingsModelIstance.setFlagEnableCheckDepositoSpedizione(getValueFromList(list,"SPEDIZIONE", "ENABLE_CHECK_DEPOSITO", Boolean.class));
dbSettingsModelIstance.setFlagEnableCheckDepositoSpedizione(getValueFromList(list, "SPEDIZIONE", "ENABLE_CHECK_DEPOSITO", Boolean.class));
dbSettingsModelIstance.setFlagForceAllToColli(getValueFromList(list, "SETUP", "FLAG_FORCE_ALL_TO_COLLI", Boolean.class));
dbSettingsModelIstance.setFlagAskPesoColloSpedizione(getValueFromList(list, "SETUP", "FLAG_ASK_PESO_COLLO", Boolean.class));
dbSettingsModelIstance.setFlagUseNewPickingListSpedizione(getValueFromList(list, "SPEDIZIONE", "FLAG_USE_NEW_PICKING_LIST", Boolean.class));
@@ -290,29 +294,33 @@ public class SettingsManager {
dbSettingsModelIstance.setFlagSpedizioneCanSelectMultipleOrders(getValueFromList(list, "SPEDIZIONE", "FLAG_CAN_SELECT_MULTIPLE_ORDERS", Boolean.class));
dbSettingsModelIstance.setReportNameSpedizionChiudiOrdine(getValueFromList(list, "SPEDIZIONE", "REPORT_PACKING_LIST", String.class));
dbSettingsModelIstance.setFlagSpedizioneUseQtaOrd(getValueFromList(list, "SPEDIZIONE", "FLAG_USE_QTA_ORD", Boolean.class));
String notePerdita = getValueFromList(list,"DOC_INTERNI","NOTE_PERDITA",String.class);
if (notePerdita != null){
dbSettingsModelIstance.setNotePerditaDocInterni(Arrays.asList(notePerdita.split("\\|")));
}
Integer onNumCnfInputChanged = getValueFromList(list, "SETUP", "ON_NUM_CNF_INPUT_CHANGED", Integer.class);
if(onNumCnfInputChanged != null) {
if (onNumCnfInputChanged != null) {
dbSettingsModelIstance.setOnNumCnfInputChanged(onNumCnfInputChanged);
}
if(onComplete != null) onComplete.run();
if (onComplete != null) onComplete.run();
}, onFailed);
}
public static <T>T getValueFromList(List<StbGestSetup> stbGestSetupList, String section, String keySectionName, Class<T> clazz) {
public static <T> T getValueFromList(List<StbGestSetup> stbGestSetupList, String section, String keySectionName, Class<T> clazz) {
StbGestSetup value = Stream.of(stbGestSetupList)
.filter(x -> x.getSection().equalsIgnoreCase(section) && x.getKeySection().equalsIgnoreCase(keySectionName))
.findFirst().get();
if(clazz == String.class) {
if (clazz == String.class) {
return clazz.cast(value.getValue());
} else if(clazz == Boolean.class) {
} else if (clazz == Boolean.class) {
return clazz.cast("S".equalsIgnoreCase(value.getValue()));
} else if(clazz == Integer.class && value.getValue() != null) {
} else if (clazz == Integer.class && value.getValue() != null) {
return clazz.cast(Integer.parseInt(value.getValue()));
} else return null;

View File

@@ -13,13 +13,19 @@ import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Set;
/**
* Created by akshay on 01/03/18.
*/
public class Stash {
private static Stash stash;
private static Context instance;
private SharedPreferences sp;
public static void init(Context context) {
stash = new Stash();
instance = context;
if (stash.sp == null) {
stash.sp = PreferenceManager.getDefaultSharedPreferences(context);
}
@@ -34,7 +40,7 @@ public class Stash {
public static void put(String key, String value) {
checkfornull();
try {
stash.sp.edit().putString(key, value).apply();
stash.sp.edit().putString(key, value).commit();
} catch (Exception e) {
e.printStackTrace();
}
@@ -44,7 +50,7 @@ public class Stash {
public static void put(String key, Set<String> value) {
checkfornull();
try {
stash.sp.edit().putStringSet(key, value).apply();
stash.sp.edit().putStringSet(key, value).commit();
} catch (Exception e) {
e.printStackTrace();
}
@@ -54,7 +60,7 @@ public class Stash {
public static void put(String key, int value) {
checkfornull();
try {
stash.sp.edit().putInt(key, value).apply();
stash.sp.edit().putInt(key, value).commit();
} catch (Exception e) {
e.printStackTrace();
}
@@ -64,7 +70,7 @@ public class Stash {
public static void put(String key, long value) {
checkfornull();
try {
stash.sp.edit().putLong(key, value).apply();
stash.sp.edit().putLong(key, value).commit();
} catch (Exception e) {
e.printStackTrace();
}
@@ -74,7 +80,7 @@ public class Stash {
public static void put(String key, float value) {
checkfornull();
try {
stash.sp.edit().putFloat(key, value).apply();
stash.sp.edit().putFloat(key, value).commit();
} catch (Exception e) {
e.printStackTrace();
}
@@ -84,7 +90,7 @@ public class Stash {
public static void put(String key, boolean value) {
checkfornull();
try {
stash.sp.edit().putBoolean(key, value).apply();
stash.sp.edit().putBoolean(key, value).commit();
} catch (Exception e) {
e.printStackTrace();
}
@@ -95,7 +101,7 @@ public class Stash {
checkfornull();
try {
Gson gson = new GsonBuilder().create();
stash.sp.edit().putString(key, gson.toJson(value).toString()).apply();
stash.sp.edit().putString(key, gson.toJson(value)).commit();
} catch (Exception e) {
e.printStackTrace();
}
@@ -112,18 +118,26 @@ public class Stash {
}
}
public static String getString(String key) {
return getString(key, "");
}
//getStringSet
public static Set<String> getStringSet(String key, Set<String> defaultvalue) {
checkfornull();
try {
return getStringSet(key, defaultvalue);
return stash.sp.getStringSet(key, defaultvalue);
} catch (Exception e) {
e.printStackTrace();
return defaultvalue;
}
}
public static Set<String> getStringSet(String key) {
return getStringSet(key, null);
}
//getInt
public static int getInt(String key, int defaultvalue) {
checkfornull();
@@ -135,6 +149,10 @@ public class Stash {
}
}
public static int getInt(String key) {
return getInt(key, 0);
}
//getLong
public static long getLong(String key, long defaultvalue) {
checkfornull();
@@ -146,6 +164,10 @@ public class Stash {
}
}
public static long getLong(String key) {
return getLong(key, (long) 0);
}
//getFloat
public static float getFloat(String key, float defaultvalue) {
checkfornull();
@@ -157,6 +179,10 @@ public class Stash {
}
}
public static float getFloat(String key) {
return getFloat(key, 0.0f);
}
//getBoolean
public static boolean getBoolean(String key, boolean defaultvalue) {
checkfornull();
@@ -168,6 +194,10 @@ public class Stash {
}
}
public static boolean getBoolean(String key) {
return getBoolean(key, false);
}
//getObject
public static <T> Object getObject(String key, Class<?> tClass) {
checkfornull();
@@ -196,7 +226,7 @@ public class Stash {
public static void clear(String key) {
checkfornull();
try {
stash.sp.edit().remove(key).apply();
stash.sp.edit().remove(key).commit();
} catch (Exception e) {
e.printStackTrace();
}
@@ -206,12 +236,22 @@ public class Stash {
public static void clearAll() {
checkfornull();
try {
stash.sp.edit().clear().apply();
stash.sp.edit().clear().commit();
} catch (Exception e) {
e.printStackTrace();
}
}
public static void addListener(StashListener listener){
checkfornull();
stash.sp.registerOnSharedPreferenceChangeListener(listener);
}
public static void removeListener(StashListener listener){
checkfornull();
stash.sp.unregisterOnSharedPreferenceChangeListener(listener);
}
private static class GenericType implements ParameterizedType {
private Type type;
@@ -238,4 +278,7 @@ public class Stash {
// implement equals method too! (as per javadoc)
}
}
public interface StashListener extends SharedPreferences.OnSharedPreferenceChangeListener {
}
}

View File

@@ -3,6 +3,8 @@ package it.integry.integrywmsnative.core.utility;
import java.math.BigDecimal;
import java.math.RoundingMode;
import it.integry.integrywmsnative.core.CommonConst;
public class UtilityBigDecimal {
public static boolean greaterThan(BigDecimal input, BigDecimal toCompareWith) {
@@ -76,7 +78,13 @@ public class UtilityBigDecimal {
}
public static BigDecimal multiply(BigDecimal input1, BigDecimal multiplier) {
if (input1 == null || multiplier == null) return null;
return input1.multiply(multiplier);
}
public static BigDecimal round(BigDecimal input) {
if (input == null) return null;
return input.setScale(CommonConst.Config.NUMBER_OF_DECIMAL_DIGITS, RoundingMode.HALF_EVEN);
}
}

View File

@@ -0,0 +1,9 @@
package it.integry.integrywmsnative.core.utility;
public class UtilityBoolean {
public static int toInt(boolean bool) {
return bool ? 1 : 0;
}
}

View File

@@ -2,11 +2,12 @@ package it.integry.integrywmsnative.core.utility;
import android.app.Dialog;
import android.content.Context;
import android.text.SpannableString;
import android.text.Html;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
import com.annimon.stream.Stream;
import com.google.firebase.crashlytics.FirebaseCrashlytics;
import com.orhanobut.logger.Logger;
@@ -16,51 +17,53 @@ import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
public class UtilityExceptions {
private static final Class<? extends Exception>[] FIREBASE_IGNORED_EXCEPTIONS = new Class[] {
public static void defaultException(Context context, Exception ex, Dialog progressDialog){
};
public static void defaultException(Context context, Exception ex, Dialog progressDialog) {
defaultException(context, ex);
if(progressDialog != null) progressDialog.dismiss();
if (progressDialog != null) progressDialog.dismiss();
}
public static void defaultException(Context context, Exception ex, Dialog progressDialog, boolean sendMail){
defaultException(context, ex, sendMail);
if(progressDialog != null) progressDialog.dismiss();
}
public static void defaultException(Context context, Exception ex){
public static void defaultException(Context context, Exception ex) {
defaultException(context, ex, false);
}
public static void defaultException(Context context, Exception ex, boolean sendEmail){
public static void defaultException(Context context, Exception ex, boolean sendEmail) {
if(ex.getMessage() != null) {
Logger.e(ex, ex.getMessage());
if (ex.getMessage() != null) {
Logger.e(ex, Html.fromHtml(ex.getMessage()).toString());
} else {
Logger.e(ex, "Errore");
}
String errorMessage = CommonRESTException.tryRecognizeThenGetMessage(ex);
if(errorMessage == null) {
if (errorMessage == null) {
errorMessage = ex.getMessage();
if(ex.getCause() != null) errorMessage += "<br />" + ex.getCause().getMessage();
if (ex.getCause() != null) errorMessage += "<br />" + ex.getCause().getMessage();
}
FragmentManager fm = null;
if(context != null && context instanceof FragmentActivity) {
if (context instanceof FragmentActivity) {
fm = ((FragmentActivity) context).getSupportFragmentManager();
} else if(UtilityContext.getMainActivity() != null) {
} else if (UtilityContext.getMainActivity() != null) {
fm = UtilityContext.getMainActivity().getSupportFragmentManager();
}
if(fm != null) {
DialogSimpleMessageView.makeErrorDialog(new SpannableString(errorMessage), null, null)
if (fm != null) {
DialogSimpleMessageView.makeErrorDialog(Html.fromHtml(errorMessage), null, null)
.show(fm, "tag");
}
if(!BuildConfig.DEBUG) {
// if(sendEmail) UtilityLogger.errorMe(ex);
boolean toIgnore = ex.getClass().getName().startsWith("it.integry.integrywmsnative") ||
Stream.of(FIREBASE_IGNORED_EXCEPTIONS).anyMatch(x -> x.isAssignableFrom(ex.getClass()));
if (!BuildConfig.DEBUG && !toIgnore) {
if (sendEmail) UtilityLogger.errorMe(ex);
FirebaseCrashlytics.getInstance().recordException(ex);
}
}

View File

@@ -1,7 +1,5 @@
package it.integry.integrywmsnative.core.utility;
import com.google.android.gms.common.internal.service.Common;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;

View File

@@ -1,22 +1,5 @@
package it.integry.integrywmsnative.core.utility;
import it.integry.integrywmsnative.core.data_store.db.AppDatabase;
import it.integry.integrywmsnative.core.settings.SettingsManager;
public class UtilitySettings {
private static AppDatabase mAppDatabase;
public static void init(AppDatabase appDatabase) {
mAppDatabase = appDatabase;
}
public static void logout(){
SettingsManager.i().setUser(null);
SettingsManager.i().setUserSession(null);
UtilityThread.executeParallel(mAppDatabase::clearAllTables);
SettingsManager.update();
}
}

View File

@@ -2,8 +2,17 @@ package it.integry.integrywmsnative.core.utility;
public class UtilityThread {
public static void executeParallel(Runnable runnable) {
new Thread(runnable).start();
public static void executeParallel(Runnable runnable, boolean waitEnd) {
Thread t = new Thread(runnable);
t.start();
if(waitEnd) {
try {
t.join();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}

View File

@@ -0,0 +1,15 @@
package it.integry.integrywmsnative.gest.accettazione;
import dagger.Subcomponent;
@Subcomponent
public interface MainAccettazioneComponent {
@Subcomponent.Factory
interface Factory {
MainAccettazioneComponent create();
}
void inject(MainAccettazioneFragment mainAccettazioneFragment);
}

View File

@@ -1,20 +1,17 @@
package it.integry.integrywmsnative.gest.accettazione;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.text.Html;
import android.text.SpannableString;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import androidx.appcompat.widget.AppCompatTextView;
import androidx.databinding.DataBindingUtil;
import androidx.fragment.app.Fragment;
import androidx.databinding.ObservableArrayList;
import androidx.recyclerview.widget.LinearLayoutManager;
import com.annimon.stream.Stream;
@@ -23,58 +20,56 @@ import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject;
import it.integry.integrywmsnative.MainApplication;
import it.integry.integrywmsnative.R;
import it.integry.integrywmsnative.core.data_cache.DataCache;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.di.BindableBoolean;
import it.integry.integrywmsnative.core.expansion.BaseFragment;
import it.integry.integrywmsnative.core.interfaces.IScrollableFragment;
import it.integry.integrywmsnative.core.interfaces.ISearcableFragment;
import it.integry.integrywmsnative.core.interfaces.ISearchableFragment;
import it.integry.integrywmsnative.core.interfaces.ITitledFragment;
import it.integry.integrywmsnative.core.rest.CommonRESTException;
import it.integry.integrywmsnative.core.settings.SettingsManager;
import it.integry.integrywmsnative.core.utility.UtilityBigDecimal;
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
import it.integry.integrywmsnative.core.utility.UtilityProgress;
import it.integry.integrywmsnative.core.utility.UtilityDate;
import it.integry.integrywmsnative.databinding.FragmentMainAccettazioneBinding;
import it.integry.integrywmsnative.gest.accettazione.core.AccettazioneHelper;
import it.integry.integrywmsnative.gest.accettazione.core.MainListAccettazioneAdapter;
import it.integry.integrywmsnative.gest.accettazione.ui.MainListAccettazioneAdapter;
import it.integry.integrywmsnative.gest.accettazione.ui.MainListAccettazioneClienteListModel;
import it.integry.integrywmsnative.gest.accettazione.ui.MainListAccettazioneListModel;
import it.integry.integrywmsnative.gest.accettazione.dto.OrdineAccettazioneInevasoDTO;
import it.integry.integrywmsnative.gest.accettazione.dto.SitArtOrdDTO;
import it.integry.integrywmsnative.gest.accettazione.rest.OrdiniAccettazioneRESTConsumer;
import it.integry.integrywmsnative.gest.accettazione_picking.AccettazionePickingActivity;
import it.integry.integrywmsnative.ui.ElevatedToolbar;
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
public class MainAccettazioneFragment extends Fragment implements ISearcableFragment, ITitledFragment, IScrollableFragment {
public class MainAccettazioneFragment extends BaseFragment implements ISearchableFragment, ITitledFragment, IScrollableFragment, MainAccettazioneViewModel.Listener {
public BindableBoolean fabVisible = new BindableBoolean(false);
@Inject
MainAccettazioneViewModel mViewModel;
private final List<Runnable> mOnPreDestroyList = new ArrayList<>();
private ElevatedToolbar mToolbar;
private String mTextFilter;
private FragmentMainAccettazioneBinding mBinding;
private AccettazioneHelper mHelper;
private MainListAccettazioneAdapter mAdapter;
private List<OrdineAccettazioneInevasoDTO> mOriginalOrderList;
private final List<OrdineAccettazioneInevasoDTO> mRenderedOrderList = new ArrayList<>();
private final ObservableArrayList<MainListAccettazioneListModel> mOrdiniInevasiMutableData = new ObservableArrayList<>();
private AppCompatTextView mAppBarTitle;
public MainAccettazioneFragment() {
// Required empty public constructor
}
public static MainAccettazioneFragment newInstance() {
MainAccettazioneFragment fragment = new MainAccettazioneFragment();
Bundle args = new Bundle();
fragment.setArguments(args);
return fragment;
return new MainAccettazioneFragment();
}
@Override
public void onCreateActionBar(AppCompatTextView titleText, Context context) {
mAppBarTitle = titleText;
@@ -87,21 +82,34 @@ public class MainAccettazioneFragment extends Fragment implements ISearcableFrag
mBinding = DataBindingUtil.inflate(inflater, R.layout.fragment_main_accettazione, container, false);
init();
MainApplication.appComponent
.mainAccettazioneComponent()
.create()
.inject(this);
mViewModel.setListener(this);
mBinding.setLifecycleOwner(this);
mBinding.setView(this);
mBinding.accettazioneMainList.setLayoutManager(new LinearLayoutManager(getActivity()));
mBinding.accettazioneMainFab.hide();
mBinding.accettazioneMainFab.setOnClickListener(v -> {
this.onAccettazioneMainFabClick();
});
this.initRecyclerView();
mToolbar.setRecyclerView(mBinding.accettazioneMainList);
return mBinding.getRoot();
}
@Override
public void onStart() {
super.onStart();
this.fabVisible.set(false);
String codMdep = SettingsManager.i().getUserSession().getDepo().getCodMdep();
mViewModel.init(codMdep);
}
@Override
public void onDestroy() {
for (Runnable onPreDestroy : mOnPreDestroyList) {
@@ -111,111 +119,95 @@ public class MainAccettazioneFragment extends Fragment implements ISearcableFrag
}
private void init() {
final Dialog progress = UtilityProgress.createDefaultProgressDialog(getActivity());
mHelper = new AccettazioneHelper(getActivity());
mHelper.loadOrdini(ordini -> {
if(ordini != null) {
Toast.makeText(getActivity(), "Caricati " + ordini.size() + " ordini", Toast.LENGTH_LONG).show();
mOriginalOrderList = ordini;
}
mBinding.ordiniAccettazioneEmptyView.setVisibility(ordini != null && ordini.size() > 0 ? View.GONE : View.VISIBLE);
refreshRenderedOrdini(ordini);
initRecyclerView();
progress.dismiss();
}, ex -> {
UtilityExceptions.defaultException(getActivity(), ex, progress);
private void initRecyclerView() {
this.mViewModel.getOrderList().observe(getViewLifecycleOwner(), x->{
this.refreshList(getFilteredList(mTextFilter));
});
}
MainListAccettazioneAdapter adapter = new MainListAccettazioneAdapter(getActivity(), mOrdiniInevasiMutableData)
.setOnGroupItemClicked(x -> {
Stream.of(mOrdiniInevasiMutableData)
.filter(y -> !y.getGroupTitle().equalsIgnoreCase(x) && y.getSelectedObservable().get())
.forEach(y -> y.getSelectedObservable().set(false));
private void initRecyclerView() {
mAdapter = new MainListAccettazioneAdapter(getActivity(), mRenderedOrderList, onSingleSelectionChanged);
mBinding.accettazioneMainList.setAdapter(mAdapter);
}
boolean allSelected = Stream.of(mOrdiniInevasiMutableData)
.filter(y -> y.getGroupTitle().equalsIgnoreCase(x))
.allMatch(y -> y.getSelectedObservable().get());
private void refreshRenderedOrdini(List<OrdineAccettazioneInevasoDTO> ordini) {
Stream.of(mOrdiniInevasiMutableData)
.filter(y -> y.getGroupTitle().equalsIgnoreCase(x))
.forEach(y -> y.getSelectedObservable().set(!allSelected));
})
.setOnItemChecked(x -> {
Stream.of(mOrdiniInevasiMutableData)
.filter(y -> !y.getGroupTitle().equalsIgnoreCase(x.getGroupTitle()) && y.getSelectedObservable().get())
.forEach(y -> y.getSelectedObservable().set(false));
mRenderedOrderList.clear();
if(ordini != null) mRenderedOrderList.addAll(ordini);
fabVisible.set(Stream.of(mOrdiniInevasiMutableData)
.anyMatch(y -> y.getSelectedObservable().get()));
});
adapter.setEmptyView(this.mBinding.ordiniAccettazioneEmptyView);
this.mBinding.accettazioneMainList.setAdapter(adapter);
this.mBinding.accettazioneMainList.setLayoutManager(new LinearLayoutManager(getActivity()));
if (mToolbar != null)
mToolbar.setRecyclerView(this.mBinding.accettazioneMainList);
}
private void refreshList(List<OrdineAccettazioneInevasoDTO> filteredList) {
private final RunnableArgs<OrdineAccettazioneInevasoDTO> onSingleSelectionChanged = dto -> {
List<OrdineAccettazioneInevasoDTO> selectedOrders = mHelper.getSelectedOrders(mOriginalOrderList);
List<OrdineAccettazioneInevasoDTO> tmpList = null;
if(dto.isSelected()) {
Stream.of(selectedOrders)
.filter(x -> !x.getCodAnagOrd().equalsIgnoreCase(dto.getCodAnagOrd()))
.forEach(x -> x.setSelected(false));
if (filteredList != null) {
tmpList = filteredList;
} else {
tmpList = mViewModel.getOrderList().getValue();
}
if(selectedOrders != null && selectedOrders.size() > 0) {
mBinding.accettazioneMainFab.show();
}
else {
mBinding.accettazioneMainFab.hide();
}
};
this.mOrdiniInevasiMutableData.clear();
this.mOrdiniInevasiMutableData.addAll(convertDataModelToListModel(tmpList));
}
private void onAccettazioneMainFabClick() {
private List<MainListAccettazioneListModel> convertDataModelToListModel(List<OrdineAccettazioneInevasoDTO> dataList) {
List<OrdineAccettazioneInevasoDTO> selectedOrders = mHelper.getSelectedOrders(mOriginalOrderList);
return Stream.of(dataList)
.distinctBy(OrdineAccettazioneInevasoDTO::getBarcode)
.sortBy(x -> x.getRagSocOrd() + (x.getDataConsD() != null ? UtilityDate.formatDate(x.getDataConsD(), UtilityDate.COMMONS_DATE_FORMATS.YMD_SLASH) : ""))
.map(x -> {
MainListAccettazioneListModel listModel = new MainListAccettazioneListModel();
final Dialog progress = UtilityProgress.createDefaultProgressDialog(getActivity());
listModel.setOriginalModel(x);
OrdiniAccettazioneRESTConsumer.retrievePickingListNewStatic(selectedOrders, sitArtOrds -> {
progress.dismiss();
long artsCounter = Stream.of(sitArtOrds)
.filter(x -> UtilityBigDecimal.greaterThan(x.getQtaDaEvadere(), BigDecimal.ZERO))
.map(SitArtOrdDTO::getCodMart)
.distinct()
.count();
long ordsCounter = Stream.of(sitArtOrds)
.distinctBy(x -> x.getDataOrd() + " " + x.getNumOrd() + " " + x.getGestione())
.count();
DialogSimpleMessageView.makeInfoDialog(getText(R.string.orders).toString(),
Html.fromHtml(String.format(getActivity().getResources().getQuantityString(R.plurals.loaded_orders_message, (int) ordsCounter), ordsCounter)
+ "<br /><br />" +
"<b>" + artsCounter + "</b> " + getActivity().getResources().getQuantityString(R.plurals.available_articles, (int) artsCounter)),
null,
() -> {
String cacheSitArtItemID = DataCache.addItem(sitArtOrds);
String cacheOrdersItemID = DataCache.addItem(selectedOrders);
Intent myIntent = new Intent(getActivity(), AccettazionePickingActivity.class);
myIntent.putExtra("keyOrders", cacheOrdersItemID);
myIntent.putExtra("keySitArts", cacheSitArtItemID);
getActivity().startActivity(myIntent);
}).show(getActivity().getSupportFragmentManager(), "tag");
}, ex -> {
progress.dismiss();
String errorMessage = CommonRESTException.tryRecognizeThenGetMessage(ex);
if(errorMessage == null) errorMessage = ex.getMessage() + "\n" + ex.getCause().getCause().getMessage();
DialogSimpleMessageView
.makeErrorDialog(new SpannableString(errorMessage), null, null)
.show(getActivity().getSupportFragmentManager(), "tag");
});
listModel.setGroupTitle(x.getRagSocOrd());
listModel.setDescription(String.format(getString(R.string.ord_acq_testata), x.getNumero().toString(), UtilityDate.formatDate(x.getDataD(), UtilityDate.COMMONS_DATE_FORMATS.DMY_HUMAN)));
List<MainListAccettazioneClienteListModel> clienti = Stream.of(dataList)
.filter(y -> y.getBarcode().equals(x.getBarcode()))
.map(y -> new MainListAccettazioneClienteListModel()
.setPrimaryText(y.getRifOrd())
.setRightText(UtilityDate.formatDate(y.getDataConsD(), UtilityDate.COMMONS_DATE_FORMATS.DMY_SLASH)))
.toList();
listModel.setClientiListModel(clienti);
return listModel;
})
.toList();
}
public void dispatchOrders() {
List<OrdineAccettazioneInevasoDTO> selectedOrders = Stream.of(this.mOrdiniInevasiMutableData)
.filter(x -> x.getSelectedObservable().get())
.map(MainListAccettazioneListModel::getOriginalModel)
.toList();
this.mViewModel.loadPicking(selectedOrders);
}
@@ -236,11 +228,27 @@ public class MainAccettazioneFragment extends Fragment implements ISearcableFrag
@Override
public boolean onQueryTextChange(String newText) {
final List<OrdineAccettazioneInevasoDTO> filtermodelist = mHelper.getFilteredOrdersByFornitore(mOriginalOrderList, newText);
mAdapter.updateItems(filtermodelist);
return true;
List<OrdineAccettazioneInevasoDTO> originalList = this.mViewModel.getOrderList().getValue();
if(originalList == null || originalList.isEmpty()) return false;
mTextFilter = newText;
List<OrdineAccettazioneInevasoDTO> filteredOrders = getFilteredList(newText);
refreshList(filteredOrders);
return true;
}
private List<OrdineAccettazioneInevasoDTO> getFilteredList(String newText) {
List<OrdineAccettazioneInevasoDTO> filteredOrders = new ArrayList<>();
List<OrdineAccettazioneInevasoDTO> originalList = this.mViewModel.getOrderList().getValue();
if(originalList == null || originalList.isEmpty() || newText == null) return originalList;
for(int i = 0; i < originalList.size(); i++){
if(originalList.get(i).getRagSocOrd().toLowerCase().contains(newText.toLowerCase())){
filteredOrders.add(originalList.get(i));
}
}
return filteredOrders;
}
@Override
public void setScrollToolbar(ElevatedToolbar toolbar) {
mToolbar = toolbar;
@@ -251,4 +259,35 @@ public class MainAccettazioneFragment extends Fragment implements ISearcableFrag
public void addOnPreDestroy(Runnable onPreDestroy) {
this.mOnPreDestroyList.add(onPreDestroy);
}
@Override
public void onOrdersDispatched(List<OrdineAccettazioneInevasoDTO> orders, List<SitArtOrdDTO> sitArts) {
long artsCounter = Stream.of(sitArts)
.filter(x -> UtilityBigDecimal.greaterThan(x.getQtaDaEvadere(), BigDecimal.ZERO))
.map(SitArtOrdDTO::getCodMart)
.distinct()
.count();
long ordsCounter = Stream.of(sitArts)
.distinctBy(x -> x.getDataOrd() + " " + x.getNumOrd() + " " + x.getGestione())
.count();
DialogSimpleMessageView.makeInfoDialog(getText(R.string.orders).toString(),
Html.fromHtml(String.format(getActivity().getResources().getQuantityString(R.plurals.loaded_orders_message, (int) ordsCounter), ordsCounter)
+ "<br /><br />" +
"<b>" + artsCounter + "</b> " + getActivity().getResources().getQuantityString(R.plurals.available_articles, (int) artsCounter)),
null,
() -> {
String cacheSitArtItemID = DataCache.addItem(sitArts);
String cacheOrdersItemID = DataCache.addItem(orders);
Intent myIntent = new Intent(getActivity(), AccettazionePickingActivity.class);
myIntent.putExtra("keyOrders", cacheOrdersItemID);
myIntent.putExtra("keySitArts", cacheSitArtItemID);
getActivity().startActivity(myIntent);
}).show(getActivity().getSupportFragmentManager(), "tag");
}
}

View File

@@ -0,0 +1,20 @@
package it.integry.integrywmsnative.gest.accettazione;
import dagger.Module;
import dagger.Provides;
import it.integry.integrywmsnative.gest.accettazione.rest.OrdiniAccettazioneRESTConsumer;
@Module(subcomponents = {MainAccettazioneComponent.class})
public class MainAccettazioneModule {
@Provides
OrdiniAccettazioneRESTConsumer providesOrdiniAccettazioneRESTConsumer() {
return new OrdiniAccettazioneRESTConsumer();
}
@Provides
MainAccettazioneViewModel providesMainAccettazioneViewModel(OrdiniAccettazioneRESTConsumer ordiniAccettazioneRESTConsumer) {
return new MainAccettazioneViewModel(ordiniAccettazioneRESTConsumer);
}
}

View File

@@ -0,0 +1,94 @@
package it.integry.integrywmsnative.gest.accettazione;
import androidx.lifecycle.MutableLiveData;
import java.util.List;
import javax.inject.Inject;
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
import it.integry.integrywmsnative.gest.accettazione.dto.OrdineAccettazioneInevasoDTO;
import it.integry.integrywmsnative.gest.accettazione.dto.SitArtOrdDTO;
import it.integry.integrywmsnative.gest.accettazione.rest.OrdiniAccettazioneRESTConsumer;
public class MainAccettazioneViewModel {
private final OrdiniAccettazioneRESTConsumer mOrdiniAccettazioneRESTConsumer;
private final MutableLiveData<List<OrdineAccettazioneInevasoDTO>> mOrderList = new MutableLiveData<>();
private Listener mListener;
private String codMdep;
@Inject
public MainAccettazioneViewModel(OrdiniAccettazioneRESTConsumer ordiniAccettazioneRESTConsumer) {
this.mOrdiniAccettazioneRESTConsumer = ordiniAccettazioneRESTConsumer;
}
public void init(String currentCodMdep) {
this.codMdep = currentCodMdep;
this.sendOnLoadingStarted();
new Thread(() -> {
mOrdiniAccettazioneRESTConsumer.getOrdiniInevasi(codMdep, orderList -> {
this.mOrderList.setValue(orderList);
this.sendOnLoadingEnded();
}, this::sendError);
}).start();
}
public void loadPicking(List<OrdineAccettazioneInevasoDTO> selectedOrders) {
this.sendOnLoadingStarted();
new Thread(() -> {
this.mOrdiniAccettazioneRESTConsumer.retrievePickingListNew(selectedOrders, sitArtOrds -> {
this.sendOnOrdersDispatched(selectedOrders, sitArtOrds);
this.sendOnLoadingEnded();
}, this::sendError);
}).start();
}
public MutableLiveData<List<OrdineAccettazioneInevasoDTO>> getOrderList() {
return mOrderList;
}
public MainAccettazioneViewModel setListener(Listener listener) {
this.mListener = listener;
return this;
}
private void sendOnLoadingStarted() {
if (this.mListener != null) mListener.onLoadingStarted();
}
private void sendOnLoadingEnded() {
if (this.mListener != null) mListener.onLoadingEnded();
}
private void sendError(Exception ex) {
if (this.mListener != null) mListener.onError(ex);
}
private void sendOnOrdersDispatched(List<OrdineAccettazioneInevasoDTO> orders, List<SitArtOrdDTO> sitArts) {
if (this.mListener != null) mListener.onOrdersDispatched(orders, sitArts);
}
public interface Listener extends ILoadingListener {
void onError(Exception ex);
void onOrdersDispatched(List<OrdineAccettazioneInevasoDTO> orders, List<SitArtOrdDTO> sitArts);
}
}

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