Compare commits
95 Commits
v1.44.09(4
...
v1.46.02(4
| Author | SHA1 | Date | |
|---|---|---|---|
| f6c7d98efa | |||
| e8821b0caf | |||
| 627a0b402b | |||
| fd89c6394f | |||
| d72f685e01 | |||
| ea1f39a9db | |||
| 518e6f0853 | |||
| 7bdb9b47f4 | |||
| 68bf6767b9 | |||
| 184d1f759c | |||
| 2a26236d94 | |||
| 71a00ac140 | |||
| f10aaaba6b | |||
| 296675f0b0 | |||
| 7f365be53d | |||
| 9e85204d04 | |||
| d5d80e71e7 | |||
| 73b360f427 | |||
| 722094bc3e | |||
| 645b2cfe5d | |||
| afcaa82069 | |||
| 393bffe14c | |||
| d44b6f00c6 | |||
| de68c3b49f | |||
| 0591b60fad | |||
| a6cebccad9 | |||
| 4186d90a32 | |||
| bb21441c3d | |||
| 12b1b89713 | |||
| 26512f5dc1 | |||
| 4d29e2ab41 | |||
| 6c6fd38482 | |||
| 2e37e874c3 | |||
| c99e32998b | |||
| 22ce078c74 | |||
| a93d80b2e2 | |||
| 1b4df1ecd1 | |||
| ce5ab1cfc2 | |||
| 3ac021d7ef | |||
| fa7d561189 | |||
| 2c59e9beec | |||
| 01af72bd2f | |||
| 2f42958394 | |||
| 4613f13eae | |||
| fba3801994 | |||
| 7ec722fc26 | |||
| 64295d565a | |||
| 2db0027fff | |||
| 71f077a617 | |||
| a80cf53f08 | |||
| 80dac639da | |||
| ff73a124f0 | |||
| a4fcc87088 | |||
| be1b993239 | |||
| 63f9912347 | |||
| b887172032 | |||
| 18937a3315 | |||
| fb6a74aef8 | |||
| cd89ce917e | |||
| 6229a1a4b1 | |||
| eb5ae8443d | |||
| a9028e65d9 | |||
| ba413e4d05 | |||
| 6f759d969d | |||
| 044bcbd852 | |||
| 53ba5a962b | |||
| 6f06eaf0a0 | |||
| 993191c083 | |||
| db178ce991 | |||
| 329d53f8d0 | |||
| 7c35e19ed4 | |||
| 326a3a00b2 | |||
| 086597985b | |||
| c3c3d32dfe | |||
| 1756124b89 | |||
| 5bc3619d6b | |||
| 7ec04ac8da | |||
| b31ea475c6 | |||
| d238cb1d88 | |||
| 5694d8bd1c | |||
| e5a4cf59c4 | |||
| 12fe5059a6 | |||
| e75121b0bd | |||
| 0312f972bc | |||
| 9d48fec426 | |||
| 645045b492 | |||
| 1988fae4f9 | |||
| 6c621d5ca8 | |||
| b8c8a9d8ea | |||
| 002e855d82 | |||
| 1c6de11e04 | |||
| ce3dfca6e0 | |||
| 706878b1e4 | |||
| 6c59e22101 | |||
| 2d48f6687c |
6
.idea/AndroidProjectSystem.xml
generated
Normal file
6
.idea/AndroidProjectSystem.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="AndroidProjectSystem">
|
||||||
|
<option name="providerId" value="com.android.tools.idea.GradleProjectSystem" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
2
.idea/deploymentTargetSelector.xml
generated
2
.idea/deploymentTargetSelector.xml
generated
@@ -4,7 +4,7 @@
|
|||||||
<selectionStates>
|
<selectionStates>
|
||||||
<SelectionState runConfigName="app">
|
<SelectionState runConfigName="app">
|
||||||
<option name="selectionMode" value="DROPDOWN" />
|
<option name="selectionMode" value="DROPDOWN" />
|
||||||
<DropdownSelection timestamp="2025-01-27T15:42:06.256113400Z">
|
<DropdownSelection timestamp="2025-03-17T09:16:48.549771200Z">
|
||||||
<Target type="DEFAULT_BOOT">
|
<Target type="DEFAULT_BOOT">
|
||||||
<handle>
|
<handle>
|
||||||
<DeviceId pluginId="PhysicalDevice" identifier="serial=21088B8EFD" />
|
<DeviceId pluginId="PhysicalDevice" identifier="serial=21088B8EFD" />
|
||||||
|
|||||||
5
.idea/fileTemplates/Android Dialog.java
generated
5
.idea/fileTemplates/Android Dialog.java
generated
@@ -123,4 +123,9 @@ Create the following layout resource file [dialog_${dashName}.xml]
|
|||||||
return alertDialog;
|
return alertDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dismiss() {
|
||||||
|
if(getDialog() != null) getDialog().dismiss();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -10,8 +10,8 @@ apply plugin: 'com.google.gms.google-services'
|
|||||||
|
|
||||||
android {
|
android {
|
||||||
|
|
||||||
def appVersionCode = 478
|
def appVersionCode = 490
|
||||||
def appVersionName = '1.44.09'
|
def appVersionName = '1.46.02'
|
||||||
|
|
||||||
signingConfigs {
|
signingConfigs {
|
||||||
release {
|
release {
|
||||||
@@ -62,6 +62,8 @@ android {
|
|||||||
android.buildFeatures.dataBinding true
|
android.buildFeatures.dataBinding true
|
||||||
android.buildFeatures.buildConfig true
|
android.buildFeatures.buildConfig true
|
||||||
|
|
||||||
|
android.dataBinding.enabledForTests true
|
||||||
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
sourceCompatibility JavaVersion.VERSION_17
|
sourceCompatibility JavaVersion.VERSION_17
|
||||||
targetCompatibility JavaVersion.VERSION_17
|
targetCompatibility JavaVersion.VERSION_17
|
||||||
@@ -110,7 +112,7 @@ dependencies {
|
|||||||
//Firebase
|
//Firebase
|
||||||
|
|
||||||
// Import the Firebase BoM
|
// Import the Firebase BoM
|
||||||
implementation platform('com.google.firebase:firebase-bom:33.8.0')
|
implementation platform('com.google.firebase:firebase-bom:33.9.0')
|
||||||
implementation 'com.google.firebase:firebase-analytics'
|
implementation 'com.google.firebase:firebase-analytics'
|
||||||
implementation 'com.google.firebase:firebase-crashlytics'
|
implementation 'com.google.firebase:firebase-crashlytics'
|
||||||
implementation 'com.google.firebase:firebase-perf'
|
implementation 'com.google.firebase:firebase-perf'
|
||||||
@@ -121,6 +123,7 @@ dependencies {
|
|||||||
runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.11.5'
|
runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.11.5'
|
||||||
runtimeOnly 'io.jsonwebtoken:jjwt-jackson:0.11.5'
|
runtimeOnly 'io.jsonwebtoken:jjwt-jackson:0.11.5'
|
||||||
|
|
||||||
|
implementation 'com.google.guava:guava:33.4.0-android'
|
||||||
|
|
||||||
implementation 'androidx.appcompat:appcompat:1.7.0'
|
implementation 'androidx.appcompat:appcompat:1.7.0'
|
||||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||||
@@ -139,8 +142,7 @@ dependencies {
|
|||||||
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
|
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
|
||||||
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
|
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
|
||||||
implementation 'com.annimon:stream:1.2.2'
|
implementation 'com.annimon:stream:1.2.2'
|
||||||
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.8.7'
|
implementation 'androidx.lifecycle:lifecycle-runtime:2.8.7'
|
||||||
// implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
|
|
||||||
implementation 'org.apache.commons:commons-text:1.9'
|
implementation 'org.apache.commons:commons-text:1.9'
|
||||||
|
|
||||||
//MVVM
|
//MVVM
|
||||||
@@ -192,7 +194,8 @@ dependencies {
|
|||||||
implementation 'org.greenrobot:eventbus:3.3.1'
|
implementation 'org.greenrobot:eventbus:3.3.1'
|
||||||
|
|
||||||
//Barcode generator
|
//Barcode generator
|
||||||
implementation group: 'com.google.zxing', name: 'core', version: '3.5.3'
|
// implementation group: 'com.google.zxing', name: 'core', version: '3.5.3'
|
||||||
|
implementation 'com.journeyapps:zxing-android-embedded:4.3.0'
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -89,6 +89,8 @@ import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.dialog.selectArt
|
|||||||
import it.integry.integrywmsnative.gest.pv_ordini_acquisto.PVOrdiniAcquistoGrigliaComponent;
|
import it.integry.integrywmsnative.gest.pv_ordini_acquisto.PVOrdiniAcquistoGrigliaComponent;
|
||||||
import it.integry.integrywmsnative.gest.pv_ordini_acquisto.PVOrdiniAcquistoGrigliaModule;
|
import it.integry.integrywmsnative.gest.pv_ordini_acquisto.PVOrdiniAcquistoGrigliaModule;
|
||||||
import it.integry.integrywmsnative.gest.pv_ordini_acquisto.dialogs.DialogScanGrigliaAcquistoComponent;
|
import it.integry.integrywmsnative.gest.pv_ordini_acquisto.dialogs.DialogScanGrigliaAcquistoComponent;
|
||||||
|
import it.integry.integrywmsnative.gest.pv_verifica_giacenze.VerificaGiacenzeComponent;
|
||||||
|
import it.integry.integrywmsnative.gest.pv_verifica_giacenze.VerificaGiacenzeModule;
|
||||||
import it.integry.integrywmsnative.gest.rettifica_giacenze.RettificaGiacenzeComponent;
|
import it.integry.integrywmsnative.gest.rettifica_giacenze.RettificaGiacenzeComponent;
|
||||||
import it.integry.integrywmsnative.gest.rettifica_giacenze.RettificaGiacenzeModule;
|
import it.integry.integrywmsnative.gest.rettifica_giacenze.RettificaGiacenzeModule;
|
||||||
import it.integry.integrywmsnative.gest.settings.MainSettingsComponent;
|
import it.integry.integrywmsnative.gest.settings.MainSettingsComponent;
|
||||||
@@ -114,8 +116,14 @@ import it.integry.integrywmsnative.view.bottom_sheet__mtb_colr_edit.BottomSheetM
|
|||||||
import it.integry.integrywmsnative.view.dialogs.ask_cliente.DialogAskClienteComponent;
|
import it.integry.integrywmsnative.view.dialogs.ask_cliente.DialogAskClienteComponent;
|
||||||
import it.integry.integrywmsnative.view.dialogs.ask_cliente.DialogAskClienteModule;
|
import it.integry.integrywmsnative.view.dialogs.ask_cliente.DialogAskClienteModule;
|
||||||
import it.integry.integrywmsnative.view.dialogs.ask_commessa.DialogAskCommessaComponent;
|
import it.integry.integrywmsnative.view.dialogs.ask_commessa.DialogAskCommessaComponent;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.ask_deposito.DialogAskDepositoComponent;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.ask_deposito.DialogAskDepositoModule;
|
||||||
import it.integry.integrywmsnative.view.dialogs.ask_linea_prod.DialogAskLineaProdComponent;
|
import it.integry.integrywmsnative.view.dialogs.ask_linea_prod.DialogAskLineaProdComponent;
|
||||||
import it.integry.integrywmsnative.view.dialogs.ask_linea_prod.DialogAskLineaProdModule;
|
import it.integry.integrywmsnative.view.dialogs.ask_linea_prod.DialogAskLineaProdModule;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.ask_livello_posizione.DialogAskLivelloPosizioneComponent;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.ask_livello_posizione.DialogAskLivelloPosizioneModule;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.ask_position_of_lu.DialogAskPositionOfLUComponent;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.ask_position_of_lu.DialogAskPositionOfLUModule;
|
||||||
import it.integry.integrywmsnative.view.dialogs.ask_unknown_barcode_notes.DialogAskUnknownBarcodeNotesComponent;
|
import it.integry.integrywmsnative.view.dialogs.ask_unknown_barcode_notes.DialogAskUnknownBarcodeNotesComponent;
|
||||||
import it.integry.integrywmsnative.view.dialogs.ask_unknown_barcode_notes.DialogAskUnknownBarcodeNotesModule;
|
import it.integry.integrywmsnative.view.dialogs.ask_unknown_barcode_notes.DialogAskUnknownBarcodeNotesModule;
|
||||||
import it.integry.integrywmsnative.view.dialogs.ask_vettore.DialogAskVettoreComponent;
|
import it.integry.integrywmsnative.view.dialogs.ask_vettore.DialogAskVettoreComponent;
|
||||||
@@ -132,6 +140,8 @@ import it.integry.integrywmsnative.view.dialogs.choose_batch_lot.DialogChooseBat
|
|||||||
import it.integry.integrywmsnative.view.dialogs.choose_batch_lot.DialogChooseBatchLotModule;
|
import it.integry.integrywmsnative.view.dialogs.choose_batch_lot.DialogChooseBatchLotModule;
|
||||||
import it.integry.integrywmsnative.view.dialogs.create_new_art.DialogCreateNewArtComponent;
|
import it.integry.integrywmsnative.view.dialogs.create_new_art.DialogCreateNewArtComponent;
|
||||||
import it.integry.integrywmsnative.view.dialogs.create_new_art.DialogCreateNewArtModule;
|
import it.integry.integrywmsnative.view.dialogs.create_new_art.DialogCreateNewArtModule;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.extra_info.DialogExtraInfoComponent;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.extra_info.DialogExtraInfoModule;
|
||||||
import it.integry.integrywmsnative.view.dialogs.info_aggiuntive_lu.DialogInfoAggiuntiveLUComponent;
|
import it.integry.integrywmsnative.view.dialogs.info_aggiuntive_lu.DialogInfoAggiuntiveLUComponent;
|
||||||
import it.integry.integrywmsnative.view.dialogs.info_aggiuntive_lu.DialogInfoAggiuntiveLUModule;
|
import it.integry.integrywmsnative.view.dialogs.info_aggiuntive_lu.DialogInfoAggiuntiveLUModule;
|
||||||
import it.integry.integrywmsnative.view.dialogs.input_lu_prod.DialogInputLUProdComponent;
|
import it.integry.integrywmsnative.view.dialogs.input_lu_prod.DialogInputLUProdComponent;
|
||||||
@@ -233,7 +243,12 @@ import it.integry.integrywmsnative.view.dialogs.update_available.DialogUpdateAva
|
|||||||
DialogAskVettoreModule.class,
|
DialogAskVettoreModule.class,
|
||||||
DialogCreateNewArtModule.class,
|
DialogCreateNewArtModule.class,
|
||||||
DialogSwitchUserDepoModule.class,
|
DialogSwitchUserDepoModule.class,
|
||||||
DialogUpdateAvailableModule.class
|
DialogUpdateAvailableModule.class,
|
||||||
|
DialogAskPositionOfLUModule.class,
|
||||||
|
DialogAskLivelloPosizioneModule.class,
|
||||||
|
VerificaGiacenzeModule.class,
|
||||||
|
DialogExtraInfoModule.class,
|
||||||
|
DialogAskDepositoModule.class
|
||||||
})
|
})
|
||||||
public interface MainApplicationComponent {
|
public interface MainApplicationComponent {
|
||||||
|
|
||||||
@@ -392,6 +407,16 @@ public interface MainApplicationComponent {
|
|||||||
|
|
||||||
DialogUpdateAvailableComponent.Factory dialogUpdateAvailableComponent();
|
DialogUpdateAvailableComponent.Factory dialogUpdateAvailableComponent();
|
||||||
|
|
||||||
|
DialogAskPositionOfLUComponent.Factory dialogAskPositionOfLUComponent();
|
||||||
|
|
||||||
|
DialogAskLivelloPosizioneComponent.Factory dialogAskLivelloPosizioneComponent();
|
||||||
|
|
||||||
|
VerificaGiacenzeComponent.Factory verificaGiacenzeComponent();
|
||||||
|
|
||||||
|
DialogExtraInfoComponent.Factory dialogExtraInfoComponent();
|
||||||
|
|
||||||
|
DialogAskDepositoComponent.Factory dialogAskDepositoComponent();
|
||||||
|
|
||||||
void inject(MainApplication mainApplication);
|
void inject(MainApplication mainApplication);
|
||||||
|
|
||||||
void inject(AppContext mainApplication);
|
void inject(AppContext mainApplication);
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ import it.integry.integrywmsnative.core.rest.consumers.DepositoRESTConsumer;
|
|||||||
import it.integry.integrywmsnative.core.rest.consumers.DocumentRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.DocumentRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.EntityRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.EntityRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.GestSetupRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.GestSetupRESTConsumer;
|
||||||
|
import it.integry.integrywmsnative.core.rest.consumers.GiacenzaPvRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.GiacenzaRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.GiacenzaRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.ImballiRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.ImballiRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.MagazzinoAutomaticoRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.MagazzinoAutomaticoRESTConsumer;
|
||||||
@@ -48,6 +49,7 @@ import it.integry.integrywmsnative.core.rest.consumers.ProductionLinesRESTConsum
|
|||||||
import it.integry.integrywmsnative.core.rest.consumers.ProduzioneRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.ProduzioneRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.VettoriRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.VettoriRESTConsumer;
|
||||||
|
import it.integry.integrywmsnative.core.rest.watcher.ServerStatusChecker;
|
||||||
import it.integry.integrywmsnative.core.services.inventario.InventarioService;
|
import it.integry.integrywmsnative.core.services.inventario.InventarioService;
|
||||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||||
import it.integry.integrywmsnative.core.sound.SoundAlertService;
|
import it.integry.integrywmsnative.core.sound.SoundAlertService;
|
||||||
@@ -99,8 +101,14 @@ public class MainApplicationModule {
|
|||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
MainContext providesMainContextNew(MenuService menuService, AppDatabase appDatabase, SystemRESTConsumer systemRESTConsumer, AuthenticationRESTConsumer authenticationRESTConsumer) {
|
ServerStatusChecker providesServerStatusChecker(Handler handler) {
|
||||||
return new MainContext(mApplication.getApplicationContext(), menuService, appDatabase, systemRESTConsumer, authenticationRESTConsumer);
|
return new ServerStatusChecker(handler);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
MainContext providesMainContextNew(MenuService menuService, AppDatabase appDatabase, AuthenticationRESTConsumer authenticationRESTConsumer, ExecutorService executorService, Handler handler, ServerStatusChecker serverStatusChecker) {
|
||||||
|
return new MainContext(mApplication.getApplicationContext(), menuService, appDatabase, authenticationRESTConsumer, executorService, handler, serverStatusChecker);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@@ -150,8 +158,8 @@ public class MainApplicationModule {
|
|||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
OrdiniRESTConsumer provideOrdiniRESTConsumer(RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer, EntityRESTConsumer entityRESTConsumer) {
|
OrdiniRESTConsumer provideOrdiniRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService, SystemRESTConsumer systemRESTConsumer, EntityRESTConsumer entityRESTConsumer) {
|
||||||
return new OrdiniRESTConsumer(restBuilder, systemRESTConsumer, entityRESTConsumer);
|
return new OrdiniRESTConsumer(restBuilder, executorService, systemRESTConsumer, entityRESTConsumer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@@ -162,20 +170,20 @@ public class MainApplicationModule {
|
|||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
ArticoloRESTConsumer provideArticoloRESTConsumer(RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer) {
|
ArticoloRESTConsumer provideArticoloRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService, SystemRESTConsumer systemRESTConsumer) {
|
||||||
return new ArticoloRESTConsumer(restBuilder, systemRESTConsumer);
|
return new ArticoloRESTConsumer(restBuilder, executorService, systemRESTConsumer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
CommessaRESTConsumer provideCommessaRESTConsumer(SystemRESTConsumer systemRESTConsumer) {
|
CommessaRESTConsumer provideCommessaRESTConsumer(ExecutorService executorService, SystemRESTConsumer systemRESTConsumer) {
|
||||||
return new CommessaRESTConsumer(systemRESTConsumer);
|
return new CommessaRESTConsumer(executorService, systemRESTConsumer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
DepositoRESTConsumer provideDepositoRESTConsumer(EntityRESTConsumer entityRESTConsumer, SystemRESTConsumer systemRESTConsumer) {
|
DepositoRESTConsumer provideDepositoRESTConsumer(ExecutorService executorService, SystemRESTConsumer systemRESTConsumer) {
|
||||||
return new DepositoRESTConsumer(entityRESTConsumer, systemRESTConsumer);
|
return new DepositoRESTConsumer(executorService, systemRESTConsumer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@@ -198,18 +206,19 @@ public class MainApplicationModule {
|
|||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
EntityRESTConsumer provideEntityRESTConsumer(RESTBuilder restBuilder) {
|
EntityRESTConsumer provideEntityRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService) {
|
||||||
return new EntityRESTConsumer(restBuilder);
|
return new EntityRESTConsumer(restBuilder, executorService);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
ColliMagazzinoRESTConsumer provideColliMagazzinoRESTConsumer(RESTBuilder restBuilder,
|
ColliMagazzinoRESTConsumer provideColliMagazzinoRESTConsumer(ExecutorService executorService,
|
||||||
|
RESTBuilder restBuilder,
|
||||||
SystemRESTConsumer systemRESTConsumer,
|
SystemRESTConsumer systemRESTConsumer,
|
||||||
ArticoloRESTConsumer articoloRESTConsumer,
|
ArticoloRESTConsumer articoloRESTConsumer,
|
||||||
EntityRESTConsumer entityRESTConsumer,
|
EntityRESTConsumer entityRESTConsumer,
|
||||||
SettingsManager settingsManager) {
|
SettingsManager settingsManager) {
|
||||||
return new ColliMagazzinoRESTConsumer(restBuilder, systemRESTConsumer, articoloRESTConsumer, entityRESTConsumer, settingsManager);
|
return new ColliMagazzinoRESTConsumer(executorService, restBuilder, systemRESTConsumer, articoloRESTConsumer, entityRESTConsumer, settingsManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@@ -238,8 +247,8 @@ public class MainApplicationModule {
|
|||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
SystemRESTConsumer provideSystemRESTConsumer(ExecutorService executorService, RESTBuilder restBuilder) {
|
SystemRESTConsumer provideSystemRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService) {
|
||||||
return new SystemRESTConsumer(executorService, restBuilder);
|
return new SystemRESTConsumer(restBuilder, executorService);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@@ -250,8 +259,8 @@ public class MainApplicationModule {
|
|||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
PosizioniRESTConsumer providesPosizioniRESTConsumer(RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer) {
|
PosizioniRESTConsumer providesPosizioniRESTConsumer(RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer, ExecutorService executorService) {
|
||||||
return new PosizioniRESTConsumer(restBuilder, systemRESTConsumer);
|
return new PosizioniRESTConsumer(restBuilder, systemRESTConsumer, executorService);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@@ -268,8 +277,14 @@ public class MainApplicationModule {
|
|||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
GiacenzaRESTConsumer provideGiacenzaRESTConsumer(RESTBuilder restBuilder, ArticoloRESTConsumer articoloRESTConsumer) {
|
GiacenzaRESTConsumer provideGiacenzaRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService, ArticoloRESTConsumer articoloRESTConsumer) {
|
||||||
return new GiacenzaRESTConsumer(restBuilder, articoloRESTConsumer);
|
return new GiacenzaRESTConsumer(restBuilder, executorService, articoloRESTConsumer);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
GiacenzaPvRESTConsumer provideGiacenzaPvRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService) {
|
||||||
|
return new GiacenzaPvRESTConsumer(restBuilder, executorService);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@@ -310,20 +325,20 @@ public class MainApplicationModule {
|
|||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
ColliSpedizioneRESTConsumer provideColliSpedizioneRESTConsumer(RESTBuilder restBuilder) {
|
ColliSpedizioneRESTConsumer provideColliSpedizioneRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService) {
|
||||||
return new ColliSpedizioneRESTConsumer(restBuilder);
|
return new ColliSpedizioneRESTConsumer(restBuilder, executorService);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
ColliLavorazioneRESTConsumer provideColliLavorazioneRESTConsumer(RESTBuilder restBuilder, SettingsManager settingsManager) {
|
ColliLavorazioneRESTConsumer provideColliLavorazioneRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService, SettingsManager settingsManager) {
|
||||||
return new ColliLavorazioneRESTConsumer(restBuilder, settingsManager);
|
return new ColliLavorazioneRESTConsumer(restBuilder, executorService, settingsManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
MagazzinoAutomaticoRESTConsumer provideMagazzinoAutomaticoRESTConsumer(RESTBuilder restBuilder) {
|
MagazzinoAutomaticoRESTConsumer provideMagazzinoAutomaticoRESTConsumer(ExecutorService executorService, RESTBuilder restBuilder) {
|
||||||
return new MagazzinoAutomaticoRESTConsumer(restBuilder);
|
return new MagazzinoAutomaticoRESTConsumer(executorService, restBuilder);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import android.content.Intent;
|
|||||||
import android.content.pm.PackageInfo;
|
import android.content.pm.PackageInfo;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.Handler;
|
||||||
import android.text.SpannableString;
|
import android.text.SpannableString;
|
||||||
import android.text.Spanned;
|
import android.text.Spanned;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
@@ -37,6 +38,9 @@ public class SplashActivity extends BaseActivity implements MainContext.Listener
|
|||||||
@Inject
|
@Inject
|
||||||
MainContext mainContext;
|
MainContext mainContext;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
Handler handler;
|
||||||
|
|
||||||
private RunnableArgsss<Integer, String[], List<Integer>> onRequestPermissionResult;
|
private RunnableArgsss<Integer, String[], List<Integer>> onRequestPermissionResult;
|
||||||
|
|
||||||
public static void startActivity(Context context) {
|
public static void startActivity(Context context) {
|
||||||
@@ -103,12 +107,12 @@ public class SplashActivity extends BaseActivity implements MainContext.Listener
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDBDataLoading(String item) {
|
public void onDBDataLoading(String item) {
|
||||||
runOnUiThread(() -> mBinding.loadingInfoTextview.setText("Caricamento " + item));
|
handler.post(() -> mBinding.loadingInfoTextview.setText("Caricamento " + item));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMenuLoading() {
|
public void onMenuLoading() {
|
||||||
runOnUiThread(() -> mBinding.loadingInfoTextview.setText("Caricamento menù"));
|
handler.post(() -> mBinding.loadingInfoTextview.setText("Caricamento menù"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -151,11 +155,13 @@ public class SplashActivity extends BaseActivity implements MainContext.Listener
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(Spanned message) {
|
public void onError(Spanned message) {
|
||||||
|
handler.post(() -> {
|
||||||
DialogSimpleMessageView.makeErrorDialog(
|
DialogSimpleMessageView.makeErrorDialog(
|
||||||
message, null, this::finish, R.string.logout, () -> {
|
message, null, this::finish, R.string.logout, () -> {
|
||||||
this.mainContext.logout(MainApplication::exit);
|
this.mainContext.logout(MainApplication::exit);
|
||||||
})
|
})
|
||||||
.show(this.getSupportFragmentManager(), "tag");
|
.show(this.getSupportFragmentManager(), "tag");
|
||||||
|
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ public class BarcodeCallbackDTO {
|
|||||||
|
|
||||||
private int ID = -1;
|
private int ID = -1;
|
||||||
|
|
||||||
|
private boolean enabled = true;
|
||||||
private RunnableArgs<BarcodeScanDTO> onScanSuccessfull;
|
private RunnableArgs<BarcodeScanDTO> onScanSuccessfull;
|
||||||
private RunnableArgs<Exception> onScanFailed;
|
private RunnableArgs<Exception> onScanFailed;
|
||||||
|
|
||||||
@@ -19,6 +20,15 @@ public class BarcodeCallbackDTO {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isEnabled() {
|
||||||
|
return enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BarcodeCallbackDTO setEnabled(boolean enabled) {
|
||||||
|
this.enabled = enabled;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public RunnableArgs<BarcodeScanDTO> getOnScanSuccessfull() {
|
public RunnableArgs<BarcodeScanDTO> getOnScanSuccessfull() {
|
||||||
return onScanSuccessfull;
|
return onScanSuccessfull;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,10 +24,15 @@ public class BarcodeManager {
|
|||||||
private static BarcodeReaderInterface mCurrentBarcodeInterface;
|
private static BarcodeReaderInterface mCurrentBarcodeInterface;
|
||||||
private static final List<BarcodeCallbackDTO> mBarcodeCallbacksStacktrace = new ArrayList<>();
|
private static final List<BarcodeCallbackDTO> mBarcodeCallbacksStacktrace = new ArrayList<>();
|
||||||
|
|
||||||
private static boolean mEnabled = true;
|
// private static boolean mEnabled = true;
|
||||||
|
|
||||||
|
|
||||||
private static final Class<? extends BarcodeReaderInterface>[] registeredBarcodeReaderInterfaces = new Class[]{PointMobileBarcodeReader.class, ZebraBarcodeReader.class, HoneyWellBarcodeReader.class, KeyboardEmulatorBarcodeReader.class};
|
private static final Class<? extends BarcodeReaderInterface>[] registeredBarcodeReaderInterfaces = new Class[]{
|
||||||
|
PointMobileBarcodeReader.class,
|
||||||
|
ZebraBarcodeReader.class,
|
||||||
|
HoneyWellBarcodeReader.class,
|
||||||
|
KeyboardEmulatorBarcodeReader.class
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
public static void init(Context applicationContext) throws Exception {
|
public static void init(Context applicationContext) throws Exception {
|
||||||
@@ -56,12 +61,12 @@ public class BarcodeManager {
|
|||||||
|
|
||||||
mCurrentBarcodeInterface.register(data -> {
|
mCurrentBarcodeInterface.register(data -> {
|
||||||
BarcodeCallbackDTO callback = getValidCallback();
|
BarcodeCallbackDTO callback = getValidCallback();
|
||||||
if (callback != null && mEnabled) {
|
if (callback != null && callback.isEnabled()) {
|
||||||
callback.getOnScanSuccessfull().run(data);
|
callback.getOnScanSuccessfull().run(data);
|
||||||
}
|
}
|
||||||
}, ex -> {
|
}, ex -> {
|
||||||
BarcodeCallbackDTO callback = getValidCallback();
|
BarcodeCallbackDTO callback = getValidCallback();
|
||||||
if (callback != null && mEnabled) {
|
if (callback != null && callback.isEnabled()) {
|
||||||
callback.getOnScanFailed().run(ex);
|
callback.getOnScanFailed().run(ex);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -103,7 +108,6 @@ public class BarcodeManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static int addCallback(BarcodeCallbackDTO barcodeCallbackDTO) {
|
public static int addCallback(BarcodeCallbackDTO barcodeCallbackDTO) {
|
||||||
|
|
||||||
int newID = -1;
|
int newID = -1;
|
||||||
|
|
||||||
if (!mBarcodeCallbacksStacktrace.isEmpty()) {
|
if (!mBarcodeCallbacksStacktrace.isEmpty()) {
|
||||||
@@ -133,18 +137,39 @@ public class BarcodeManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void disable() {
|
public static void disable(int instanceId) {
|
||||||
mEnabled = false;
|
mBarcodeCallbacksStacktrace.stream().filter(x -> x.getID() == instanceId)
|
||||||
// UtilityLogger.info("Barcode reader disabled");
|
.findFirst().ifPresent(x -> x.setEnabled(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void enable() {
|
public static void disableLastCallback() {
|
||||||
mEnabled = true;
|
BarcodeCallbackDTO validCallback = getValidCallback();
|
||||||
// UtilityLogger.info("Barcode reader enabled");
|
if (validCallback != null) {
|
||||||
|
validCallback.setEnabled(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isEnabled() {
|
public static void enable(int instanceId) {
|
||||||
return mEnabled;
|
mBarcodeCallbacksStacktrace.stream().filter(x -> x.getID() == instanceId)
|
||||||
|
.findFirst().ifPresent(x -> x.setEnabled(true));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void enableLastCallback() {
|
||||||
|
BarcodeCallbackDTO validCallback = getValidCallback();
|
||||||
|
if (validCallback != null) {
|
||||||
|
validCallback.setEnabled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isEnabled(int instanceId) {
|
||||||
|
return mBarcodeCallbacksStacktrace.stream().filter(x -> x.getID() == instanceId)
|
||||||
|
.findFirst()
|
||||||
|
.map(BarcodeCallbackDTO::isEnabled)
|
||||||
|
.orElse(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isLastCallbackEnabled() {
|
||||||
|
return getValidCallback() != null && getValidCallback().isEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void changeSettings(List<Pair<String, Object>> settings) {
|
public static void changeSettings(List<Pair<String, Object>> settings) {
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import it.integry.integrywmsnative.gest.prod_riposizionamento_da_prod.ProdRiposi
|
|||||||
import it.integry.integrywmsnative.gest.prod_versamento_materiale.ProdVersamentoMaterialeFragment;
|
import it.integry.integrywmsnative.gest.prod_versamento_materiale.ProdVersamentoMaterialeFragment;
|
||||||
import it.integry.integrywmsnative.gest.prod_versamento_materiale_su_mag_prossimita.ProdVersamentoMaterialeInBufferFragment;
|
import it.integry.integrywmsnative.gest.prod_versamento_materiale_su_mag_prossimita.ProdVersamentoMaterialeInBufferFragment;
|
||||||
import it.integry.integrywmsnative.gest.pv_ordini_acquisto.PVOrdiniAcquistoGrigliaFragment;
|
import it.integry.integrywmsnative.gest.pv_ordini_acquisto.PVOrdiniAcquistoGrigliaFragment;
|
||||||
|
import it.integry.integrywmsnative.gest.pv_verifica_giacenze.VerificaGiacenzeFragment;
|
||||||
import it.integry.integrywmsnative.gest.rettifica_giacenze.RettificaGiacenzeFragment;
|
import it.integry.integrywmsnative.gest.rettifica_giacenze.RettificaGiacenzeFragment;
|
||||||
import it.integry.integrywmsnative.gest.spedizione.dialogs.row_info.info_situazione_articolo.DialogInfoSituazioneArticoloView;
|
import it.integry.integrywmsnative.gest.spedizione.dialogs.row_info.info_situazione_articolo.DialogInfoSituazioneArticoloView;
|
||||||
import it.integry.integrywmsnative.gest.ultime_consegne_cliente.UltimeConsegneClienteFragment;
|
import it.integry.integrywmsnative.gest.ultime_consegne_cliente.UltimeConsegneClienteFragment;
|
||||||
@@ -242,6 +243,7 @@ public class MenuConfiguration extends BaseMenuConfiguration {
|
|||||||
.setTitleIcon(it.integry.integrywmsnative.R.drawable.ic_dashboard_purchase_orders_pv)
|
.setTitleIcon(it.integry.integrywmsnative.R.drawable.ic_dashboard_purchase_orders_pv)
|
||||||
.setDrawerIcon(it.integry.integrywmsnative.R.drawable.ic_dashboard_purchase_orders_pv)
|
.setDrawerIcon(it.integry.integrywmsnative.R.drawable.ic_dashboard_purchase_orders_pv)
|
||||||
.setFragmentFactory(PVOrdiniAcquistoGrigliaFragment::newInstance))
|
.setFragmentFactory(PVOrdiniAcquistoGrigliaFragment::newInstance))
|
||||||
|
|
||||||
.addItem(new MenuItem()
|
.addItem(new MenuItem()
|
||||||
.setCodMenu("MG058")
|
.setCodMenu("MG058")
|
||||||
.setID(it.integry.integrywmsnative.R.id.nav_pv_doc_interni)
|
.setID(it.integry.integrywmsnative.R.id.nav_pv_doc_interni)
|
||||||
@@ -250,6 +252,14 @@ public class MenuConfiguration extends BaseMenuConfiguration {
|
|||||||
.setDrawerIcon(R.drawable.ic_documents_outline)
|
.setDrawerIcon(R.drawable.ic_documents_outline)
|
||||||
.setFragmentFactory(DocInterniFragment::newInstance))
|
.setFragmentFactory(DocInterniFragment::newInstance))
|
||||||
|
|
||||||
|
.addItem(new MenuItem()
|
||||||
|
.setCodMenu("MG075")
|
||||||
|
.setID(it.integry.integrywmsnative.R.id.nav_pv_verifica_giacenze)
|
||||||
|
.setTitleText(R.string.verifica_giacenze_menu)
|
||||||
|
.setTitleIcon(R.drawable.ic_dashboard_verifica_giacenze)
|
||||||
|
.setDrawerIcon(R.drawable.ic_drawer_verifica_giacenze)
|
||||||
|
.setFragmentFactory(VerificaGiacenzeFragment::newInstance))
|
||||||
|
|
||||||
// .addItem(new MenuItem()
|
// .addItem(new MenuItem()
|
||||||
// .setID(it.integry.integrywmsnative.R.id.nav_pv_ordini_acquisto_trasmessi)
|
// .setID(it.integry.integrywmsnative.R.id.nav_pv_ordini_acquisto_trasmessi)
|
||||||
// .setTitleText(it.integry.integrywmsnative.R.string.transmitted_orders)
|
// .setTitleText(it.integry.integrywmsnative.R.string.transmitted_orders)
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package it.integry.integrywmsnative.core.context;
|
package it.integry.integrywmsnative.core.context;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.os.Handler;
|
||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
import android.text.SpannableString;
|
import android.text.SpannableString;
|
||||||
import android.text.Spanned;
|
import android.text.Spanned;
|
||||||
@@ -9,16 +10,15 @@ import android.text.SpannedString;
|
|||||||
import com.google.firebase.installations.FirebaseInstallations;
|
import com.google.firebase.installations.FirebaseInstallations;
|
||||||
|
|
||||||
import java.net.ConnectException;
|
import java.net.ConnectException;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.AppDatabase;
|
import it.integry.integrywmsnative.core.data_store.db.AppDatabase;
|
||||||
import it.integry.integrywmsnative.core.menu.MenuService;
|
import it.integry.integrywmsnative.core.menu.MenuService;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
|
||||||
import it.integry.integrywmsnative.core.rest.watcher.ServerStatusChecker;
|
import it.integry.integrywmsnative.core.rest.watcher.ServerStatusChecker;
|
||||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityThread;
|
|
||||||
import it.integry.integrywmsnative.gest.login.rest.AuthenticationRESTConsumer;
|
import it.integry.integrywmsnative.gest.login.rest.AuthenticationRESTConsumer;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
@@ -27,17 +27,21 @@ public class MainContext {
|
|||||||
private final Context applicationContext;
|
private final Context applicationContext;
|
||||||
private final MenuService menuService;
|
private final MenuService menuService;
|
||||||
private final AppDatabase appDatabase;
|
private final AppDatabase appDatabase;
|
||||||
private final SystemRESTConsumer systemRESTConsumer;
|
|
||||||
private final AuthenticationRESTConsumer authenticationRESTConsumer;
|
private final AuthenticationRESTConsumer authenticationRESTConsumer;
|
||||||
|
private final ExecutorService executorService;
|
||||||
|
private final Handler handler;
|
||||||
|
private final ServerStatusChecker serverStatusChecker;
|
||||||
|
|
||||||
private Listener mListener;
|
private Listener mListener;
|
||||||
|
|
||||||
public MainContext(Context applicationContext, MenuService menuService, AppDatabase appDatabase, SystemRESTConsumer systemRESTConsumer, AuthenticationRESTConsumer authenticationRESTConsumer) {
|
public MainContext(Context applicationContext, MenuService menuService, AppDatabase appDatabase, AuthenticationRESTConsumer authenticationRESTConsumer, ExecutorService executorService, Handler handler, ServerStatusChecker serverStatusChecker) {
|
||||||
this.applicationContext = applicationContext;
|
this.applicationContext = applicationContext;
|
||||||
this.menuService = menuService;
|
this.menuService = menuService;
|
||||||
this.appDatabase = appDatabase;
|
this.appDatabase = appDatabase;
|
||||||
this.systemRESTConsumer = systemRESTConsumer;
|
|
||||||
this.authenticationRESTConsumer = authenticationRESTConsumer;
|
this.authenticationRESTConsumer = authenticationRESTConsumer;
|
||||||
|
this.executorService = executorService;
|
||||||
|
this.handler = handler;
|
||||||
|
this.serverStatusChecker = serverStatusChecker;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init() {
|
public void init() {
|
||||||
@@ -48,33 +52,30 @@ public class MainContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//this.initAuthSession(() -> {
|
executorService.execute(() -> {
|
||||||
this.initDeviceId(() -> {
|
|
||||||
this.initDBData(() -> {
|
try {
|
||||||
this.initMenu(() -> {
|
this.initDBData();
|
||||||
|
this.initMenu();
|
||||||
|
serverStatusChecker.init();
|
||||||
|
|
||||||
if (mListener != null) mListener.onContextInitialized();
|
if (mListener != null) mListener.onContextInitialized();
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
//});
|
|
||||||
|
|
||||||
|
} catch (Exception ex) {
|
||||||
|
Spanned message = null;
|
||||||
|
|
||||||
this.initServerStatusChecker();
|
if (ex.getCause() != null && ex.getCause() instanceof ConnectException) {
|
||||||
|
message = Html.fromHtml("Impossibile collegarsi all'host <b>" + SettingsManager.i().getServer().getHost() + ":" + SettingsManager.i().getServer().getPort() + "</b>. Riprovare più tardi.");
|
||||||
// EventBus.getDefault().register(this);
|
} else if (ex.getMessage().startsWith("Status 404:")) {
|
||||||
|
message = Html.fromHtml("Errore 404. Non è stato possibile soddisfare la richiesta sull'host <b>" + SettingsManager.i().getServer().getHost() + ":" + SettingsManager.i().getServer().getPort() + "</b>. Riprovare più tardi.");
|
||||||
|
} else {
|
||||||
|
message = new SpannableString(ex.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Subscribe(threadMode = ThreadMode.MAIN)
|
if (mListener != null) mListener.onError(message);
|
||||||
// public void onSessionExpired(SessionExpiredEvent event) {
|
}
|
||||||
// DialogSimpleMessageView.makeErrorDialog(
|
});
|
||||||
// new SpannedString("La sessione è scaduta. Effettua nuovamente la login"),
|
}
|
||||||
// null,
|
|
||||||
// () -> {
|
|
||||||
// logout(MainApplication::exit);
|
|
||||||
// })
|
|
||||||
// .show(activity.getSupportFragmentManager(), "expired-session-error");
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
private void initAuthSession(Runnable onComplete) {
|
private void initAuthSession(Runnable onComplete) {
|
||||||
@@ -96,61 +97,39 @@ public class MainContext {
|
|||||||
SettingsManager.i().getUserSession().setDeviceId(fid.getResult());
|
SettingsManager.i().getUserSession().setDeviceId(fid.getResult());
|
||||||
SettingsManager.update();
|
SettingsManager.update();
|
||||||
|
|
||||||
systemRESTConsumer.registerDevice(onComplete, ex -> {
|
// systemRESTConsumer.registerDevice(onComplete, ex -> {
|
||||||
if (mListener != null) mListener.onError(new SpannedString(ex.getMessage()));
|
// if (mListener != null) mListener.onError(new SpannedString(ex.getMessage()));
|
||||||
});
|
// });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void logout(Runnable onLoggedOut) {
|
public void logout(Runnable onLoggedOut) {
|
||||||
menuService.invalidateCache();
|
menuService.invalidateCache();
|
||||||
UtilityThread.executeParallel(() -> {
|
executorService.execute(() -> {
|
||||||
SettingsManager.i().setUser(null);
|
SettingsManager.i().setUser(null);
|
||||||
SettingsManager.i().setUserSession(null);
|
SettingsManager.i().setUserSession(null);
|
||||||
SettingsManager.update();
|
SettingsManager.update();
|
||||||
appDatabase.clearAllTables();
|
appDatabase.clearAllTables();
|
||||||
|
|
||||||
|
handler.post(() -> {
|
||||||
onLoggedOut.run();
|
onLoggedOut.run();
|
||||||
}, true);
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initServerStatusChecker() {
|
private void initDBData() throws Exception {
|
||||||
ServerStatusChecker.init();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initDBData(Runnable onComplete) {
|
|
||||||
|
|
||||||
|
|
||||||
SettingsManager.loadDBVariables(item -> {
|
SettingsManager.loadDBVariables(item -> {
|
||||||
if (mListener != null) mListener.onDBDataLoading(item);
|
if (mListener != null) mListener.onDBDataLoading(item);
|
||||||
},
|
|
||||||
onComplete,
|
|
||||||
ex -> {
|
|
||||||
|
|
||||||
Spanned message = null;
|
|
||||||
|
|
||||||
if (ex.getCause() != null && ex.getCause() instanceof ConnectException) {
|
|
||||||
message = Html.fromHtml("Impossibile collegarsi all'host <b>" + SettingsManager.i().getServer().getHost() + ":" + SettingsManager.i().getServer().getPort() + "</b>. Riprovare più tardi.");
|
|
||||||
} else if (ex.getMessage().startsWith("Status 404:")) {
|
|
||||||
message = Html.fromHtml("Errore 404. Non è stato possibile soddisfare la richiesta sull'host <b>" + SettingsManager.i().getServer().getHost() + ":" + SettingsManager.i().getServer().getPort() + "</b>. Riprovare più tardi.");
|
|
||||||
} else {
|
|
||||||
message = new SpannableString(ex.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mListener != null) mListener.onError(message);
|
|
||||||
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initMenu(Runnable onComplete) {
|
|
||||||
if (mListener != null) mListener.onMenuLoading();
|
|
||||||
this.menuService.init(onComplete, ex -> {
|
|
||||||
if (mListener != null) mListener.onError(new SpannedString(ex.getMessage()));
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void initMenu() throws Exception {
|
||||||
|
if (mListener != null) mListener.onMenuLoading();
|
||||||
|
this.menuService.init();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public MainContext setListener(Listener listener) {
|
public MainContext setListener(Listener listener) {
|
||||||
this.mListener = listener;
|
this.mListener = listener;
|
||||||
|
|||||||
@@ -22,14 +22,18 @@ import it.integry.integrywmsnative.core.data_store.db.dao.MtbColrDao;
|
|||||||
import it.integry.integrywmsnative.core.data_store.db.dao.MtbColtDao;
|
import it.integry.integrywmsnative.core.data_store.db.dao.MtbColtDao;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.dao.OrdineDao;
|
import it.integry.integrywmsnative.core.data_store.db.dao.OrdineDao;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.dao.RawDao;
|
import it.integry.integrywmsnative.core.data_store.db.dao.RawDao;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.dao.VerificaGiacenzeDao;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.dao.VerificaGiacenzeRowDao;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.entity.ArticoloGriglia;
|
import it.integry.integrywmsnative.core.data_store.db.entity.ArticoloGriglia;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.entity.ArticoloOrdine;
|
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.Griglia;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.entity.InventarioRoomDTO;
|
import it.integry.integrywmsnative.core.data_store.db.entity.InventarioEntity;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.entity.InventarioRowRoomDTO;
|
import it.integry.integrywmsnative.core.data_store.db.entity.InventarioRowRoomDTO;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.entity.Ordine;
|
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.SqlMtbColr;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColt;
|
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColt;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.entity.VerificaGiacenzeEntity;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.entity.VerificaGiacenzeRowEntity;
|
||||||
|
|
||||||
@Database(entities = {
|
@Database(entities = {
|
||||||
ArticoloGriglia.class,
|
ArticoloGriglia.class,
|
||||||
@@ -38,10 +42,12 @@ import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColt;
|
|||||||
ArticoloOrdine.class,
|
ArticoloOrdine.class,
|
||||||
SqlMtbColt.class,
|
SqlMtbColt.class,
|
||||||
SqlMtbColr.class,
|
SqlMtbColr.class,
|
||||||
InventarioRoomDTO.class,
|
InventarioEntity.class,
|
||||||
InventarioRowRoomDTO.class
|
InventarioRowRoomDTO.class,
|
||||||
|
VerificaGiacenzeEntity.class,
|
||||||
|
VerificaGiacenzeRowEntity.class
|
||||||
},
|
},
|
||||||
version = 17)
|
version = 18)
|
||||||
@TypeConverters({
|
@TypeConverters({
|
||||||
DateConverter.class,
|
DateConverter.class,
|
||||||
BigDecimalConverter.class,
|
BigDecimalConverter.class,
|
||||||
@@ -70,7 +76,8 @@ public abstract class AppDatabase extends RoomDatabase {
|
|||||||
.addMigrations(MIGRATION_13_14)
|
.addMigrations(MIGRATION_13_14)
|
||||||
.addMigrations(MIGRATION_14_15)
|
.addMigrations(MIGRATION_14_15)
|
||||||
.addMigrations(MIGRATION_15_16)
|
.addMigrations(MIGRATION_15_16)
|
||||||
.addMigrations(MIGRATION_16_17);
|
.addMigrations(MIGRATION_16_17)
|
||||||
|
.addMigrations(MIGRATION_17_18);
|
||||||
|
|
||||||
sInstance = builder.build();
|
sInstance = builder.build();
|
||||||
}
|
}
|
||||||
@@ -95,6 +102,10 @@ public abstract class AppDatabase extends RoomDatabase {
|
|||||||
|
|
||||||
public abstract InventarioRowDao inventarioRowDao();
|
public abstract InventarioRowDao inventarioRowDao();
|
||||||
|
|
||||||
|
public abstract VerificaGiacenzeDao verificaGiacenzeDao();
|
||||||
|
|
||||||
|
public abstract VerificaGiacenzeRowDao verificaGiacenzeRowDao();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static final Migration MIGRATION_10_11 = new Migration(10, 11) {
|
static final Migration MIGRATION_10_11 = new Migration(10, 11) {
|
||||||
@@ -182,4 +193,28 @@ public abstract class AppDatabase extends RoomDatabase {
|
|||||||
database.execSQL("DROP TABLE _inventario_rows_old;");
|
database.execSQL("DROP TABLE _inventario_rows_old;");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
static final Migration MIGRATION_17_18 = new Migration(17, 18) {
|
||||||
|
@Override
|
||||||
|
public void migrate(@NonNull SupportSQLiteDatabase database) {
|
||||||
|
database.execSQL("CREATE TABLE IF NOT EXISTS verifica_giacenze (_id INTEGER PRIMARY KEY AUTOINCREMENT, cod_mdep TEXT NOT NULL, data INTEGER, remote_sync_date INTEGER);");
|
||||||
|
database.execSQL("CREATE INDEX IF NOT EXISTS index_verifica_giacenze__id ON verifica_giacenze (_id);");
|
||||||
|
|
||||||
|
database.execSQL("CREATE TABLE IF NOT EXISTS verifica_giacenze_rows (" +
|
||||||
|
"_id INTEGER PRIMARY KEY AUTOINCREMENT, " +
|
||||||
|
"parent_id INTEGER, " +
|
||||||
|
"created_at INTEGER DEFAULT CURRENT_TIMESTAMP, " +
|
||||||
|
"cod_mart TEXT, " +
|
||||||
|
"partita_mag TEXT, " +
|
||||||
|
"descrizione TEXT, " +
|
||||||
|
"qta_in_giacenza REAL NOT NULL DEFAULT 0, " +
|
||||||
|
"qta REAL NOT NULL DEFAULT 0, " +
|
||||||
|
"num_cnf REAL NOT NULL DEFAULT 0, " +
|
||||||
|
"qta_cnf REAL NOT NULL DEFAULT 0, " +
|
||||||
|
"scan_cod_barre TEXT, " +
|
||||||
|
"remote_sync_date INTEGER, " +
|
||||||
|
"FOREIGN KEY(parent_id) REFERENCES verifica_giacenze(_id) ON UPDATE NO ACTION ON DELETE CASCADE );");
|
||||||
|
database.execSQL("CREATE INDEX IF NOT EXISTS index_verifica_giacenze_rows__id ON verifica_giacenze_rows (_id)");
|
||||||
|
database.execSQL("CREATE INDEX IF NOT EXISTS index_verifica_giacenze_rows_parent_id ON verifica_giacenze_rows (parent_id)");
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ import it.integry.integrywmsnative.core.data_store.db.dao.MtbColrDao;
|
|||||||
import it.integry.integrywmsnative.core.data_store.db.dao.MtbColtDao;
|
import it.integry.integrywmsnative.core.data_store.db.dao.MtbColtDao;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.dao.OrdineDao;
|
import it.integry.integrywmsnative.core.data_store.db.dao.OrdineDao;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.dao.RawDao;
|
import it.integry.integrywmsnative.core.data_store.db.dao.RawDao;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.dao.VerificaGiacenzeDao;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.dao.VerificaGiacenzeRowDao;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.repository.ArticoliOrdineRepository;
|
import it.integry.integrywmsnative.core.data_store.db.repository.ArticoliOrdineRepository;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.repository.ArticoloGrigliaRepository;
|
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.GrigliaRepository;
|
||||||
@@ -32,10 +34,17 @@ import it.integry.integrywmsnative.core.data_store.db.repository.datasource.SqlM
|
|||||||
import it.integry.integrywmsnative.core.data_store.db.repository.datasource.SqlMtbColtDataSource;
|
import it.integry.integrywmsnative.core.data_store.db.repository.datasource.SqlMtbColtDataSource;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.respository_new.InventarioRepository;
|
import it.integry.integrywmsnative.core.data_store.db.respository_new.InventarioRepository;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.respository_new.InventarioRowRepository;
|
import it.integry.integrywmsnative.core.data_store.db.respository_new.InventarioRowRepository;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.respository_new.VerificaGiacenzeRepository;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.respository_new.VerificaGiacenzeRowRepository;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.respository_new.data_source.InventarioLocalDataSource;
|
import it.integry.integrywmsnative.core.data_store.db.respository_new.data_source.InventarioLocalDataSource;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.respository_new.data_source.InventarioRowLocalDataSource;
|
import it.integry.integrywmsnative.core.data_store.db.respository_new.data_source.InventarioRowLocalDataSource;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.respository_new.data_source.VerificaGiacenzeLocalDataSource;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.respository_new.data_source.VerificaGiacenzeRowLocalDataSource;
|
||||||
import it.integry.integrywmsnative.core.mapper.InventarioMapper;
|
import it.integry.integrywmsnative.core.mapper.InventarioMapper;
|
||||||
import it.integry.integrywmsnative.core.mapper.InventarioRowMapper;
|
import it.integry.integrywmsnative.core.mapper.InventarioRowMapper;
|
||||||
|
import it.integry.integrywmsnative.core.mapper.VerificaGiacenzeMapper;
|
||||||
|
import it.integry.integrywmsnative.core.mapper.VerificaGiacenzeRowMapper;
|
||||||
|
import it.integry.integrywmsnative.core.rest.consumers.GiacenzaPvRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.InventarioRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.InventarioRESTConsumer;
|
||||||
|
|
||||||
@Module
|
@Module
|
||||||
@@ -108,6 +117,11 @@ public class RoomModule {
|
|||||||
return appDatabase.inventarioRowDao();
|
return appDatabase.inventarioRowDao();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Singleton
|
||||||
|
@Provides
|
||||||
|
InventarioMapper providesInventarioMapper(InventarioRowMapper inventarioRowMapper) {
|
||||||
|
return new InventarioMapper(inventarioRowMapper);
|
||||||
|
}
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
@Provides
|
@Provides
|
||||||
@@ -117,8 +131,26 @@ public class RoomModule {
|
|||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
@Provides
|
@Provides
|
||||||
InventarioMapper providesInventarioMapper(InventarioRowMapper inventarioRowMapper) {
|
VerificaGiacenzeDao providesVerificaGiacenzeDao(AppDatabase appDatabase) {
|
||||||
return new InventarioMapper(inventarioRowMapper);
|
return appDatabase.verificaGiacenzeDao();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Singleton
|
||||||
|
@Provides
|
||||||
|
VerificaGiacenzeRowDao providesVerificaGiacenzeRowDao(AppDatabase appDatabase) {
|
||||||
|
return appDatabase.verificaGiacenzeRowDao();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Singleton
|
||||||
|
@Provides
|
||||||
|
VerificaGiacenzeMapper providesVerificaGiacenzeMapper(VerificaGiacenzeRowMapper verificaGiacenzeRowMapper) {
|
||||||
|
return new VerificaGiacenzeMapper(verificaGiacenzeRowMapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Singleton
|
||||||
|
@Provides
|
||||||
|
VerificaGiacenzeRowMapper providesVerificaGiacenzeRowMapper() {
|
||||||
|
return new VerificaGiacenzeRowMapper();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -182,4 +214,20 @@ public class RoomModule {
|
|||||||
return new InventarioRowRepository(inventarioRowLocalDataSource, inventarioRESTConsumer, inventarioRowMapper, handler);
|
return new InventarioRowRepository(inventarioRowLocalDataSource, inventarioRESTConsumer, inventarioRowMapper, handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
VerificaGiacenzeRepository providesVerificaGiacenzeRepository(ExecutorService executorService, Handler handler,
|
||||||
|
VerificaGiacenzeLocalDataSource verificaGiacenzeLocalDataSource,
|
||||||
|
GiacenzaPvRESTConsumer giacenzaPvRESTConsumer,
|
||||||
|
VerificaGiacenzeMapper verificaGiacenzeMapper) {
|
||||||
|
return new VerificaGiacenzeRepository(verificaGiacenzeLocalDataSource, giacenzaPvRESTConsumer, verificaGiacenzeMapper, handler, executorService);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
VerificaGiacenzeRowRepository providesVerificaGiacenzeRowRepository(ExecutorService executorService, Handler handler,
|
||||||
|
VerificaGiacenzeRowLocalDataSource verificaGiacenzeRowLocalDataSource,
|
||||||
|
GiacenzaPvRESTConsumer giacenzaPvRESTConsumer,
|
||||||
|
VerificaGiacenzeRowMapper verificaGiacenzeRowMapper) {
|
||||||
|
return new VerificaGiacenzeRowRepository(verificaGiacenzeRowLocalDataSource, giacenzaPvRESTConsumer, verificaGiacenzeRowMapper, handler, executorService);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,21 +7,21 @@ import java.util.List;
|
|||||||
|
|
||||||
import io.reactivex.rxjava3.core.Flowable;
|
import io.reactivex.rxjava3.core.Flowable;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.entity.BaseSyncDTO;
|
import it.integry.integrywmsnative.core.data_store.db.entity.BaseSyncDTO;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.entity.InventarioRoomDTO;
|
import it.integry.integrywmsnative.core.data_store.db.entity.InventarioEntity;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.interfaces.EntityDaoInterface;
|
import it.integry.integrywmsnative.core.data_store.db.interfaces.EntityDaoInterface;
|
||||||
|
|
||||||
@Dao
|
@Dao
|
||||||
public interface InventarioDao extends EntityDaoInterface<InventarioRoomDTO> {
|
public interface InventarioDao extends EntityDaoInterface<InventarioEntity> {
|
||||||
|
|
||||||
|
|
||||||
@Query("SELECT * FROM " + InventarioRoomDTO.TABLE_NAME +
|
@Query("SELECT * FROM " + InventarioEntity.TABLE_NAME +
|
||||||
" WHERE ((:toBeSync = 1 AND " + BaseSyncDTO.Columns.COLUMN_REMOTE_SYNC_DATE + " IS NULL) OR (:toBeSync = 0))")
|
" WHERE ((:toBeSync = 1 AND " + BaseSyncDTO.Columns.COLUMN_REMOTE_SYNC_DATE + " IS NULL) OR (:toBeSync = 0))")
|
||||||
List<InventarioRoomDTO> selectAll(boolean toBeSync);
|
List<InventarioEntity> selectAll(boolean toBeSync);
|
||||||
|
|
||||||
|
|
||||||
@Query("SELECT * FROM " + InventarioRoomDTO.TABLE_NAME +
|
@Query("SELECT * FROM " + InventarioEntity.TABLE_NAME +
|
||||||
" WHERE ((:toBeSync = 1 AND " + BaseSyncDTO.Columns.COLUMN_REMOTE_SYNC_DATE + " IS NULL) OR (:toBeSync = 0))" +
|
" WHERE ((:toBeSync = 1 AND " + BaseSyncDTO.Columns.COLUMN_REMOTE_SYNC_DATE + " IS NULL) OR (:toBeSync = 0))" +
|
||||||
" ORDER BY " + InventarioRoomDTO.Columns.DATA_INVENTARIO + " DESC")
|
" ORDER BY " + InventarioEntity.Columns.DATA_INVENTARIO + " DESC")
|
||||||
Flowable<List<InventarioRoomDTO>> selectAllFlowable(boolean toBeSync);
|
Flowable<List<InventarioEntity>> selectAllFlowable(boolean toBeSync);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package it.integry.integrywmsnative.core.data_store.db.dao;
|
||||||
|
|
||||||
|
import androidx.room.Dao;
|
||||||
|
import androidx.room.Query;
|
||||||
|
import androidx.room.Transaction;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import io.reactivex.rxjava3.core.Flowable;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.entity.BaseSyncDTO;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.entity.VerificaGiacenzeEntity;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.entity.VerificaGiacenzeRowEntity;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.interfaces.EntityDaoInterface;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.wrappers.VerificaGiacenzeWithRowsWrapper;
|
||||||
|
|
||||||
|
@Dao
|
||||||
|
public interface VerificaGiacenzeDao extends EntityDaoInterface<VerificaGiacenzeEntity> {
|
||||||
|
|
||||||
|
|
||||||
|
@Transaction
|
||||||
|
@Query("SELECT * FROM " + VerificaGiacenzeEntity.TABLE_NAME +
|
||||||
|
" WHERE ((:toBeSync = 1 AND " + BaseSyncDTO.Columns.COLUMN_REMOTE_SYNC_DATE + " IS NULL) OR (:toBeSync = 0))")
|
||||||
|
List<VerificaGiacenzeWithRowsWrapper> selectAll(boolean toBeSync);
|
||||||
|
|
||||||
|
@Transaction
|
||||||
|
@Query("SELECT * FROM " + VerificaGiacenzeEntity.TABLE_NAME +
|
||||||
|
" WHERE ((:toBeSync = 1 AND " + BaseSyncDTO.Columns.COLUMN_REMOTE_SYNC_DATE + " IS NULL) OR (:toBeSync = 0))" +
|
||||||
|
" ORDER BY " + VerificaGiacenzeEntity.Columns.DATA + " DESC")
|
||||||
|
Flowable<List<VerificaGiacenzeWithRowsWrapper>> selectAllFlowable(boolean toBeSync);
|
||||||
|
|
||||||
|
@Transaction
|
||||||
|
@Query("SELECT * FROM " + VerificaGiacenzeEntity.TABLE_NAME +
|
||||||
|
" WHERE ((:toBeSync = 1 AND " + BaseSyncDTO.Columns.COLUMN_REMOTE_SYNC_DATE + " IS NULL) OR (:toBeSync = 0))" +
|
||||||
|
" ORDER BY " + VerificaGiacenzeEntity.Columns.DATA + " DESC" +
|
||||||
|
" LIMIT 1")
|
||||||
|
VerificaGiacenzeWithRowsWrapper selectLast(boolean toBeSync);
|
||||||
|
|
||||||
|
@Query("SELECT COALESCE(strftime('%s', 'now') - MAX(" + VerificaGiacenzeRowEntity.Columns.CREATED_AT + ") < :maxMinutes * 60, 0) as any_verifica_to_be_recovered" +
|
||||||
|
" FROM " + VerificaGiacenzeRowEntity.TABLE_NAME +
|
||||||
|
" WHERE (" + BaseSyncDTO.Columns.COLUMN_REMOTE_SYNC_DATE + " IS NULL)")
|
||||||
|
boolean isAnotherVerificaGiacenzeInProgress(int maxMinutes);
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package it.integry.integrywmsnative.core.data_store.db.dao;
|
||||||
|
|
||||||
|
import androidx.room.Dao;
|
||||||
|
import androidx.room.Query;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import io.reactivex.rxjava3.core.Flowable;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.entity.BaseSyncDTO;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.entity.VerificaGiacenzeRowEntity;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.interfaces.EntityDaoInterface;
|
||||||
|
|
||||||
|
@Dao
|
||||||
|
public interface VerificaGiacenzeRowDao extends EntityDaoInterface<VerificaGiacenzeRowEntity> {
|
||||||
|
|
||||||
|
|
||||||
|
@Query("SELECT * FROM " + VerificaGiacenzeRowEntity.TABLE_NAME +
|
||||||
|
" WHERE ((:toBeSync = 1 AND " + BaseSyncDTO.Columns.COLUMN_REMOTE_SYNC_DATE + " IS NULL) OR (:toBeSync = 0))")
|
||||||
|
List<VerificaGiacenzeRowEntity> selectAll(boolean toBeSync);
|
||||||
|
|
||||||
|
@Query("SELECT * FROM " + VerificaGiacenzeRowEntity.TABLE_NAME +
|
||||||
|
" WHERE ((:toBeSync = 1 AND " + BaseSyncDTO.Columns.COLUMN_REMOTE_SYNC_DATE + " IS NULL) OR (:toBeSync = 0))")
|
||||||
|
Flowable<List<VerificaGiacenzeRowEntity>> selectAllFlowable(boolean toBeSync);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -12,8 +12,8 @@ import java.util.List;
|
|||||||
|
|
||||||
import it.integry.integrywmsnative.core.data_store.db.interfaces.EntityModelInterface;
|
import it.integry.integrywmsnative.core.data_store.db.interfaces.EntityModelInterface;
|
||||||
|
|
||||||
@Entity(tableName = InventarioRoomDTO.TABLE_NAME)
|
@Entity(tableName = InventarioEntity.TABLE_NAME)
|
||||||
public class InventarioRoomDTO extends BaseSyncDTO implements EntityModelInterface {
|
public class InventarioEntity extends BaseSyncDTO implements EntityModelInterface {
|
||||||
|
|
||||||
public static final String TABLE_NAME = "inventari";
|
public static final String TABLE_NAME = "inventari";
|
||||||
|
|
||||||
@@ -4,7 +4,6 @@ import androidx.annotation.NonNull;
|
|||||||
import androidx.room.ColumnInfo;
|
import androidx.room.ColumnInfo;
|
||||||
import androidx.room.Entity;
|
import androidx.room.Entity;
|
||||||
import androidx.room.ForeignKey;
|
import androidx.room.ForeignKey;
|
||||||
import androidx.room.PrimaryKey;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
@@ -12,10 +11,11 @@ import java.time.LocalDateTime;
|
|||||||
import it.integry.integrywmsnative.core.data_store.db.interfaces.EntityModelInterface;
|
import it.integry.integrywmsnative.core.data_store.db.interfaces.EntityModelInterface;
|
||||||
|
|
||||||
@Entity(
|
@Entity(
|
||||||
|
inheritSuperIndices = true,
|
||||||
tableName = InventarioRowRoomDTO.TABLE_NAME,
|
tableName = InventarioRowRoomDTO.TABLE_NAME,
|
||||||
foreignKeys = {
|
foreignKeys = {
|
||||||
@ForeignKey(
|
@ForeignKey(
|
||||||
entity = InventarioRoomDTO.class,
|
entity = InventarioEntity.class,
|
||||||
parentColumns = {BaseSyncDTO.Columns.ID},
|
parentColumns = {BaseSyncDTO.Columns.ID},
|
||||||
childColumns = {InventarioRowRoomDTO.Columns.PARENT_ID},
|
childColumns = {InventarioRowRoomDTO.Columns.PARENT_ID},
|
||||||
onDelete = ForeignKey.CASCADE
|
onDelete = ForeignKey.CASCADE
|
||||||
@@ -40,13 +40,6 @@ public class InventarioRowRoomDTO extends BaseSyncDTO implements EntityModelInte
|
|||||||
public static final String ZONA = "zona";
|
public static final String ZONA = "zona";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* The unique ID
|
|
||||||
*/
|
|
||||||
@PrimaryKey(autoGenerate = true)
|
|
||||||
@ColumnInfo(index = true, name = BaseSyncDTO.Columns.ID)
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
@ColumnInfo(index = true, name = Columns.PARENT_ID)
|
@ColumnInfo(index = true, name = Columns.PARENT_ID)
|
||||||
private Long parentId;
|
private Long parentId;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,78 @@
|
|||||||
|
package it.integry.integrywmsnative.core.data_store.db.entity;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.room.ColumnInfo;
|
||||||
|
import androidx.room.Entity;
|
||||||
|
import androidx.room.Ignore;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.interfaces.EntityModelInterface;
|
||||||
|
|
||||||
|
@Entity(
|
||||||
|
inheritSuperIndices = true,
|
||||||
|
tableName = VerificaGiacenzeEntity.TABLE_NAME
|
||||||
|
)
|
||||||
|
public class VerificaGiacenzeEntity extends BaseSyncDTO implements EntityModelInterface {
|
||||||
|
|
||||||
|
public static final String TABLE_NAME = "verifica_giacenze";
|
||||||
|
|
||||||
|
public static class Columns {
|
||||||
|
public static final String COD_MDEP = "cod_mdep";
|
||||||
|
public static final String DATA = "data";
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@ColumnInfo(name = VerificaGiacenzeEntity.Columns.COD_MDEP)
|
||||||
|
private String codMdep;
|
||||||
|
|
||||||
|
@ColumnInfo(name = VerificaGiacenzeEntity.Columns.DATA)
|
||||||
|
private LocalDateTime data;
|
||||||
|
|
||||||
|
@Ignore
|
||||||
|
private List<VerificaGiacenzeRowEntity> verificaGiacenzeRowList;
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
public String getCodMdep() {
|
||||||
|
return codMdep;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCodMdep(@NonNull String codMdep) {
|
||||||
|
this.codMdep = codMdep;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocalDateTime getData() {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setData(LocalDateTime data) {
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<VerificaGiacenzeRowEntity> getVerificaGiacenzeRowList() {
|
||||||
|
return verificaGiacenzeRowList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVerificaGiacenzeRowList(List<VerificaGiacenzeRowEntity> verificaGiacenzeRowList) {
|
||||||
|
this.verificaGiacenzeRowList = verificaGiacenzeRowList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
|
VerificaGiacenzeEntity that = (VerificaGiacenzeEntity) o;
|
||||||
|
return getId().equals(that.getId()) && getCodMdep().equals(that.getCodMdep()) && Objects.equals(getData(), that.getData()) && Objects.equals(getVerificaGiacenzeRowList(), that.getVerificaGiacenzeRowList());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int result = getId().hashCode();
|
||||||
|
result = 31 * result + getCodMdep().hashCode();
|
||||||
|
result = 31 * result + Objects.hashCode(getData());
|
||||||
|
result = 31 * result + Objects.hashCode(getVerificaGiacenzeRowList());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,211 @@
|
|||||||
|
package it.integry.integrywmsnative.core.data_store.db.entity;
|
||||||
|
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.room.ColumnInfo;
|
||||||
|
import androidx.room.Entity;
|
||||||
|
import androidx.room.ForeignKey;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.interfaces.EntityModelInterface;
|
||||||
|
|
||||||
|
@Entity(
|
||||||
|
inheritSuperIndices = true,
|
||||||
|
tableName = VerificaGiacenzeRowEntity.TABLE_NAME,
|
||||||
|
foreignKeys = {
|
||||||
|
@ForeignKey(
|
||||||
|
entity = VerificaGiacenzeEntity.class,
|
||||||
|
parentColumns = {BaseSyncDTO.Columns.ID},
|
||||||
|
childColumns = {VerificaGiacenzeRowEntity.Columns.PARENT_ID},
|
||||||
|
onDelete = ForeignKey.CASCADE
|
||||||
|
)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
public class VerificaGiacenzeRowEntity extends BaseSyncDTO implements EntityModelInterface, Cloneable {
|
||||||
|
public static final String TABLE_NAME = "verifica_giacenze_rows";
|
||||||
|
|
||||||
|
public static class Columns {
|
||||||
|
public static final String PARENT_ID = "parent_id";
|
||||||
|
public static final String CREATED_AT = "created_at";
|
||||||
|
public static final String COD_MART = "cod_mart";
|
||||||
|
public static final String PARTITA_MAG = "partita_mag";
|
||||||
|
public static final String DESCRIZIONE = "descrizione";
|
||||||
|
public static final String QTA_IN_GIACENZA = "qta_in_giacenza";
|
||||||
|
public static final String QTA = "qta";
|
||||||
|
public static final String NUM_CNF = "num_cnf";
|
||||||
|
public static final String QTA_CNF = "qta_cnf";
|
||||||
|
public static final String SCAN_COD_BARRE = "scan_cod_barre";
|
||||||
|
}
|
||||||
|
|
||||||
|
@ColumnInfo(index = true, name = Columns.PARENT_ID)
|
||||||
|
private Long parentId;
|
||||||
|
|
||||||
|
@ColumnInfo(name = Columns.CREATED_AT, defaultValue = "CURRENT_TIMESTAMP")
|
||||||
|
private LocalDateTime createdAt = LocalDateTime.now();
|
||||||
|
|
||||||
|
@ColumnInfo(name = Columns.COD_MART)
|
||||||
|
private String codMart;
|
||||||
|
|
||||||
|
@ColumnInfo(name = Columns.PARTITA_MAG)
|
||||||
|
private String partitaMag;
|
||||||
|
|
||||||
|
@ColumnInfo(name = Columns.DESCRIZIONE)
|
||||||
|
private String descrizione;
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@ColumnInfo(name = Columns.QTA_IN_GIACENZA, defaultValue = "0")
|
||||||
|
private BigDecimal qtaInGiacenza;
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@ColumnInfo(name = Columns.QTA, defaultValue = "0")
|
||||||
|
private BigDecimal qta;
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@ColumnInfo(name = Columns.NUM_CNF, defaultValue = "0")
|
||||||
|
private BigDecimal numConf;
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@ColumnInfo(name = Columns.QTA_CNF, defaultValue = "0")
|
||||||
|
private BigDecimal qtaConf;
|
||||||
|
|
||||||
|
@ColumnInfo(name = Columns.SCAN_COD_BARRE)
|
||||||
|
private String scanCodBarre;
|
||||||
|
|
||||||
|
|
||||||
|
public Long getParentId() {
|
||||||
|
return parentId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParentId(Long parentId) {
|
||||||
|
this.parentId = parentId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocalDateTime getCreatedAt() {
|
||||||
|
return createdAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreatedAt(LocalDateTime createdAt) {
|
||||||
|
this.createdAt = createdAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCodMart() {
|
||||||
|
return codMart;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCodMart(String codMart) {
|
||||||
|
this.codMart = codMart;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPartitaMag() {
|
||||||
|
return partitaMag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPartitaMag(String partitaMag) {
|
||||||
|
this.partitaMag = partitaMag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescrizione() {
|
||||||
|
return descrizione;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescrizione(String descrizione) {
|
||||||
|
this.descrizione = descrizione;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
public BigDecimal getQtaInGiacenza() {
|
||||||
|
return qtaInGiacenza;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQtaInGiacenza(@NonNull BigDecimal qtaInGiacenza) {
|
||||||
|
this.qtaInGiacenza = qtaInGiacenza;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
public BigDecimal getQta() {
|
||||||
|
return qta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQta(@NonNull BigDecimal qta) {
|
||||||
|
this.qta = qta;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
public BigDecimal getNumConf() {
|
||||||
|
return numConf;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNumConf(@NonNull BigDecimal numConf) {
|
||||||
|
this.numConf = numConf;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
public BigDecimal getQtaConf() {
|
||||||
|
return qtaConf;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQtaConf(@NonNull BigDecimal qtaConf) {
|
||||||
|
this.qtaConf = qtaConf;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getScanCodBarre() {
|
||||||
|
return scanCodBarre;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setScanCodBarre(String scanCodBarre) {
|
||||||
|
this.scanCodBarre = scanCodBarre;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
|
VerificaGiacenzeRowEntity that = (VerificaGiacenzeRowEntity) o;
|
||||||
|
return getId().equals(that.getId()) && getParentId().equals(that.getParentId()) && getCodMart().equals(that.getCodMart()) && Objects.equals(getPartitaMag(), that.getPartitaMag()) && getQta().equals(that.getQta()) && getNumConf().equals(that.getNumConf()) && getQtaConf().equals(that.getQtaConf()) && Objects.equals(getScanCodBarre(), that.getScanCodBarre());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int result = getId().hashCode();
|
||||||
|
result = 31 * result + getParentId().hashCode();
|
||||||
|
result = 31 * result + getCodMart().hashCode();
|
||||||
|
result = 31 * result + Objects.hashCode(getPartitaMag());
|
||||||
|
result = 31 * result + getQta().hashCode();
|
||||||
|
result = 31 * result + getNumConf().hashCode();
|
||||||
|
result = 31 * result + getQtaConf().hashCode();
|
||||||
|
result = 31 * result + Objects.hashCode(getScanCodBarre());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public VerificaGiacenzeRowEntity clone() throws CloneNotSupportedException {
|
||||||
|
try {
|
||||||
|
VerificaGiacenzeRowEntity clone = (VerificaGiacenzeRowEntity) super.clone();
|
||||||
|
|
||||||
|
// Clona ID
|
||||||
|
clone.setId(getId() != null ? new Long(getId()) : null);
|
||||||
|
clone.setParentId(getParentId() != null ? new Long(getParentId()) : null);
|
||||||
|
|
||||||
|
// Clona le stringhe
|
||||||
|
clone.setCodMart(getCodMart() != null ? new String(getCodMart()) : null);
|
||||||
|
clone.setPartitaMag(getPartitaMag() != null ? new String(getPartitaMag()) : null);
|
||||||
|
clone.setDescrizione(getDescrizione() != null ? new String(getDescrizione()) : null);
|
||||||
|
clone.setScanCodBarre(getScanCodBarre() != null ? new String(getScanCodBarre()) : null);
|
||||||
|
|
||||||
|
// Clona i BigDecimal
|
||||||
|
clone.setQta(getQta() != null ? new BigDecimal(getQta().toString()) : null);
|
||||||
|
clone.setNumConf(getNumConf() != null ? new BigDecimal(getNumConf().toString()) : null);
|
||||||
|
clone.setQtaConf(getQtaConf() != null ? new BigDecimal(getQtaConf().toString()) : null);
|
||||||
|
|
||||||
|
return clone;
|
||||||
|
} catch (CloneNotSupportedException e) {
|
||||||
|
throw new AssertionError(); // Can't happen
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -15,7 +15,7 @@ import java.util.concurrent.ExecutorService;
|
|||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import io.reactivex.rxjava3.schedulers.Schedulers;
|
import io.reactivex.rxjava3.schedulers.Schedulers;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.entity.InventarioRoomDTO;
|
import it.integry.integrywmsnative.core.data_store.db.entity.InventarioEntity;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.respository_new.data_source.InventarioLocalDataSource;
|
import it.integry.integrywmsnative.core.data_store.db.respository_new.data_source.InventarioLocalDataSource;
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
import it.integry.integrywmsnative.core.mapper.InventarioMapper;
|
import it.integry.integrywmsnative.core.mapper.InventarioMapper;
|
||||||
@@ -24,13 +24,13 @@ import it.integry.integrywmsnative.core.rest.consumers.InventarioRESTConsumer;
|
|||||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityLiveData;
|
import it.integry.integrywmsnative.core.utility.UtilityLiveData;
|
||||||
|
|
||||||
public class InventarioRepository extends _BaseRepository<MtbInvent, InventarioRoomDTO, InventarioMapper, InventarioLocalDataSource, InventarioRESTConsumer> {
|
public class InventarioRepository extends _BaseRepository<MtbInvent, InventarioEntity, InventarioMapper, InventarioLocalDataSource, InventarioRESTConsumer> {
|
||||||
|
|
||||||
private final ExecutorService executorService;
|
private final ExecutorService executorService;
|
||||||
|
|
||||||
private final Handler handler;
|
private final Handler handler;
|
||||||
|
|
||||||
private final MutableLiveData<List<InventarioRoomDTO>> internalLiveData = new MutableLiveData<>();
|
private final MutableLiveData<List<InventarioEntity>> internalLiveData = new MutableLiveData<>();
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public InventarioRepository(InventarioLocalDataSource localDataSource,
|
public InventarioRepository(InventarioLocalDataSource localDataSource,
|
||||||
@@ -44,7 +44,7 @@ public class InventarioRepository extends _BaseRepository<MtbInvent, InventarioR
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public LiveData<List<InventarioRoomDTO>> retrieve(Runnable onComplete, RunnableArgs<Exception> onError) {
|
public LiveData<List<InventarioEntity>> retrieve(Runnable onComplete, RunnableArgs<Exception> onError) {
|
||||||
localDataSource.makeSynchronousRetrieveAllLive(false)
|
localDataSource.makeSynchronousRetrieveAllLive(false)
|
||||||
.observeOn(Schedulers.io())
|
.observeOn(Schedulers.io())
|
||||||
.subscribe(internalLiveData::postValue);
|
.subscribe(internalLiveData::postValue);
|
||||||
@@ -84,13 +84,13 @@ public class InventarioRepository extends _BaseRepository<MtbInvent, InventarioR
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void insert(InventarioRoomDTO inventarioDTO, Runnable onComplete, RunnableArgs<Exception> onError) {
|
public void insert(InventarioEntity inventarioDTO, Runnable onComplete, RunnableArgs<Exception> onError) {
|
||||||
localDataSource.makeInsertRequest(inventarioDTO, localResult -> {
|
localDataSource.makeInsertRequest(inventarioDTO, localResult -> {
|
||||||
if (onComplete != null) handler.post(onComplete);
|
if (onComplete != null) handler.post(onComplete);
|
||||||
}, onError);
|
}, onError);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void export(InventarioRoomDTO inventarioDTO, Runnable onComplete, RunnableArgs<Exception> onError) {
|
public void export(InventarioEntity inventarioDTO, Runnable onComplete, RunnableArgs<Exception> onError) {
|
||||||
remoteDataSource.makeInsertRequest(dataMapper.mapRoomToRest(inventarioDTO), () -> {
|
remoteDataSource.makeInsertRequest(dataMapper.mapRoomToRest(inventarioDTO), () -> {
|
||||||
inventarioDTO.setRemoteSyncDate(new Date());
|
inventarioDTO.setRemoteSyncDate(new Date());
|
||||||
|
|
||||||
@@ -100,7 +100,7 @@ public class InventarioRepository extends _BaseRepository<MtbInvent, InventarioR
|
|||||||
}, onError);
|
}, onError);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void delete(InventarioRoomDTO inventarioDTO, Runnable onComplete, RunnableArgs<Exception> onError) {
|
public void delete(InventarioEntity inventarioDTO, Runnable onComplete, RunnableArgs<Exception> onError) {
|
||||||
localDataSource.makeDeleteRequest(inventarioDTO, onComplete, onError);
|
localDataSource.makeDeleteRequest(inventarioDTO, onComplete, onError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,59 @@
|
|||||||
|
package it.integry.integrywmsnative.core.data_store.db.respository_new;
|
||||||
|
|
||||||
|
import android.os.Handler;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.entity.VerificaGiacenzeEntity;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.respository_new.data_source.VerificaGiacenzeLocalDataSource;
|
||||||
|
import it.integry.integrywmsnative.core.mapper.VerificaGiacenzeMapper;
|
||||||
|
import it.integry.integrywmsnative.core.rest.consumers.GiacenzaPvRESTConsumer;
|
||||||
|
import it.integry.integrywmsnative.core.rest.model.pv.VerificaGiacenzeDTO;
|
||||||
|
|
||||||
|
public class VerificaGiacenzeRepository extends _BaseRepository<VerificaGiacenzeDTO, VerificaGiacenzeEntity, VerificaGiacenzeMapper, VerificaGiacenzeLocalDataSource, GiacenzaPvRESTConsumer> {
|
||||||
|
|
||||||
|
private final ExecutorService executorService;
|
||||||
|
private final Handler handler;
|
||||||
|
|
||||||
|
|
||||||
|
public VerificaGiacenzeRepository(VerificaGiacenzeLocalDataSource localDataSource,
|
||||||
|
GiacenzaPvRESTConsumer remoteDataSource,
|
||||||
|
VerificaGiacenzeMapper dataMapper,
|
||||||
|
Handler handler,
|
||||||
|
ExecutorService executorService) {
|
||||||
|
super(dataMapper, localDataSource, remoteDataSource);
|
||||||
|
this.handler = handler;
|
||||||
|
this.executorService = executorService;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public List<VerificaGiacenzeEntity> retrieve() {
|
||||||
|
return localDataSource.makeSynchronousRetrieveAllRequest(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public VerificaGiacenzeEntity retrieveLast() {
|
||||||
|
return localDataSource.makeSynchronousRetrieveLastRequest(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean isAnotherVerificaGiacenzeInProgress(int maxMinutes) {
|
||||||
|
return localDataSource.isAnotherVerificaGiacenzeInProgress(maxMinutes);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clearPreviousSessions() {
|
||||||
|
var entities = retrieve();
|
||||||
|
for (var entity : entities) {
|
||||||
|
localDataSource.makeSynchronousDeleteRequest(entity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void insert(VerificaGiacenzeEntity entity) {
|
||||||
|
localDataSource.makeSynchronousInsertRequest(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void delete(VerificaGiacenzeEntity entity) {
|
||||||
|
localDataSource.makeSynchronousDeleteRequest(entity);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
package it.integry.integrywmsnative.core.data_store.db.respository_new;
|
||||||
|
|
||||||
|
import android.os.Handler;
|
||||||
|
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.entity.VerificaGiacenzeRowEntity;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.respository_new.data_source.VerificaGiacenzeRowLocalDataSource;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
|
import it.integry.integrywmsnative.core.mapper.VerificaGiacenzeRowMapper;
|
||||||
|
import it.integry.integrywmsnative.core.rest.consumers.GiacenzaPvRESTConsumer;
|
||||||
|
import it.integry.integrywmsnative.core.rest.model.pv.VerificaGiacenzeRowDTO;
|
||||||
|
|
||||||
|
public class VerificaGiacenzeRowRepository extends _BaseRepository<VerificaGiacenzeRowDTO, VerificaGiacenzeRowEntity, VerificaGiacenzeRowMapper, VerificaGiacenzeRowLocalDataSource, GiacenzaPvRESTConsumer> {
|
||||||
|
|
||||||
|
private final ExecutorService executorService;
|
||||||
|
private final Handler handler;
|
||||||
|
|
||||||
|
|
||||||
|
public VerificaGiacenzeRowRepository(VerificaGiacenzeRowLocalDataSource localDataSource,
|
||||||
|
GiacenzaPvRESTConsumer remoteDataSource,
|
||||||
|
VerificaGiacenzeRowMapper dataMapper,
|
||||||
|
Handler handler,
|
||||||
|
ExecutorService executorService) {
|
||||||
|
super(dataMapper, localDataSource, remoteDataSource);
|
||||||
|
this.handler = handler;
|
||||||
|
this.executorService = executorService;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void insertSynchronized(VerificaGiacenzeRowEntity entity) {
|
||||||
|
localDataSource.makeSynchronousInsertRequest(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void insert(VerificaGiacenzeRowEntity entity, RunnableArgs<VerificaGiacenzeRowEntity> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
|
localDataSource.makeInsertRequest(entity, onComplete, onFailed);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateSynchronized(VerificaGiacenzeRowEntity entity) {
|
||||||
|
localDataSource.makeSynchronousUpdateRequest(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update(VerificaGiacenzeRowEntity entity, RunnableArgs<VerificaGiacenzeRowEntity> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
|
localDataSource.makeUpdateRequest(entity, onComplete, onFailed);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteSynchronized(VerificaGiacenzeRowEntity entity) {
|
||||||
|
localDataSource.makeSynchronousDeleteRequest(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void delete(VerificaGiacenzeRowEntity entity, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
|
localDataSource.makeDeleteRequest(entity, onComplete, onFailed);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,24 +8,24 @@ import javax.inject.Singleton;
|
|||||||
|
|
||||||
import io.reactivex.rxjava3.core.Flowable;
|
import io.reactivex.rxjava3.core.Flowable;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.dao.InventarioDao;
|
import it.integry.integrywmsnative.core.data_store.db.dao.InventarioDao;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.entity.InventarioRoomDTO;
|
import it.integry.integrywmsnative.core.data_store.db.entity.InventarioEntity;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class InventarioLocalDataSource extends _BaseRoomDataSource<InventarioRoomDTO, InventarioDao> {
|
public class InventarioLocalDataSource extends _BaseRoomDataSource<InventarioEntity, InventarioDao> {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public InventarioLocalDataSource(ExecutorService executorService, InventarioDao entityDao) {
|
public InventarioLocalDataSource(ExecutorService executorService, InventarioDao entityDao) {
|
||||||
super(executorService, entityDao, InventarioRoomDTO.TABLE_NAME);
|
super(executorService, entityDao, InventarioEntity.TABLE_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<InventarioRoomDTO> makeSynchronousRetrieveAllRequest(boolean onlyToBeSync) {
|
public List<InventarioEntity> makeSynchronousRetrieveAllRequest(boolean onlyToBeSync) {
|
||||||
return entityDao
|
return entityDao
|
||||||
.selectAll(onlyToBeSync);
|
.selectAll(onlyToBeSync);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Flowable<List<InventarioRoomDTO>> makeSynchronousRetrieveAllLive(boolean onlyToBeSync) {
|
public Flowable<List<InventarioEntity>> makeSynchronousRetrieveAllLive(boolean onlyToBeSync) {
|
||||||
return entityDao
|
return entityDao
|
||||||
.selectAllFlowable(onlyToBeSync);
|
.selectAllFlowable(onlyToBeSync);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,63 @@
|
|||||||
|
package it.integry.integrywmsnative.core.data_store.db.respository_new.data_source;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
|
import io.reactivex.rxjava3.core.Flowable;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.dao.VerificaGiacenzeDao;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.entity.VerificaGiacenzeEntity;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.wrappers.VerificaGiacenzeWithRowsWrapper;
|
||||||
|
|
||||||
|
@Singleton
|
||||||
|
public class VerificaGiacenzeLocalDataSource extends _BaseRoomDataSource<VerificaGiacenzeEntity, VerificaGiacenzeDao> {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public VerificaGiacenzeLocalDataSource(ExecutorService executorService, VerificaGiacenzeDao entityDao) {
|
||||||
|
super(executorService, entityDao, VerificaGiacenzeEntity.TABLE_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<VerificaGiacenzeEntity> makeSynchronousRetrieveAllRequest(boolean onlyToBeSync) {
|
||||||
|
var data = entityDao
|
||||||
|
.selectAll(onlyToBeSync);
|
||||||
|
|
||||||
|
return data.stream()
|
||||||
|
.map(x -> {
|
||||||
|
x.verificaGiacenze.setVerificaGiacenzeRowList(x.verificaGiacenzeRowList);
|
||||||
|
return x.verificaGiacenze;
|
||||||
|
})
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Flowable<List<VerificaGiacenzeEntity>> makeSynchronousRetrieveAllLive(boolean onlyToBeSync) {
|
||||||
|
Flowable<List<VerificaGiacenzeWithRowsWrapper>> listFlowable = entityDao
|
||||||
|
.selectAllFlowable(onlyToBeSync);
|
||||||
|
|
||||||
|
return listFlowable.map(x ->
|
||||||
|
x.stream()
|
||||||
|
.map(y -> {
|
||||||
|
y.verificaGiacenze.setVerificaGiacenzeRowList(y.verificaGiacenzeRowList);
|
||||||
|
return y.verificaGiacenze;
|
||||||
|
})
|
||||||
|
.collect(Collectors.toList())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public VerificaGiacenzeEntity makeSynchronousRetrieveLastRequest(boolean onlyToBeSync) {
|
||||||
|
var lastEntity = entityDao
|
||||||
|
.selectLast(onlyToBeSync);
|
||||||
|
|
||||||
|
lastEntity.verificaGiacenze.setVerificaGiacenzeRowList(lastEntity.verificaGiacenzeRowList);
|
||||||
|
|
||||||
|
return lastEntity.verificaGiacenze;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isAnotherVerificaGiacenzeInProgress(int maxMinutes) {
|
||||||
|
return entityDao.isAnotherVerificaGiacenzeInProgress(maxMinutes);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package it.integry.integrywmsnative.core.data_store.db.respository_new.data_source;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
|
import io.reactivex.rxjava3.core.Flowable;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.dao.VerificaGiacenzeRowDao;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.entity.VerificaGiacenzeRowEntity;
|
||||||
|
|
||||||
|
@Singleton
|
||||||
|
public class VerificaGiacenzeRowLocalDataSource extends _BaseRoomDataSource<VerificaGiacenzeRowEntity, VerificaGiacenzeRowDao> {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public VerificaGiacenzeRowLocalDataSource(ExecutorService executorService, VerificaGiacenzeRowDao entityDao) {
|
||||||
|
super(executorService, entityDao, VerificaGiacenzeRowEntity.TABLE_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<VerificaGiacenzeRowEntity> makeSynchronousRetrieveAllRequest(boolean onlyToBeSync) {
|
||||||
|
var data = entityDao
|
||||||
|
.selectAll(onlyToBeSync);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Flowable<List<VerificaGiacenzeRowEntity>> makeSynchronousRetrieveAllLive(boolean onlyToBeSync) {
|
||||||
|
return entityDao
|
||||||
|
.selectAllFlowable(onlyToBeSync);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package it.integry.integrywmsnative.core.data_store.db.wrappers;
|
||||||
|
|
||||||
|
import androidx.room.DatabaseView;
|
||||||
|
import androidx.room.Embedded;
|
||||||
|
import androidx.room.Relation;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.entity.BaseSyncDTO;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.entity.VerificaGiacenzeEntity;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.entity.VerificaGiacenzeRowEntity;
|
||||||
|
|
||||||
|
@DatabaseView
|
||||||
|
public class VerificaGiacenzeWithRowsWrapper {
|
||||||
|
|
||||||
|
@Embedded
|
||||||
|
public VerificaGiacenzeEntity verificaGiacenze;
|
||||||
|
|
||||||
|
@Relation(
|
||||||
|
parentColumn = BaseSyncDTO.Columns.ID,
|
||||||
|
entityColumn = VerificaGiacenzeRowEntity.Columns.PARENT_ID
|
||||||
|
)
|
||||||
|
public List<VerificaGiacenzeRowEntity> verificaGiacenzeRowList;
|
||||||
|
}
|
||||||
@@ -24,6 +24,10 @@ import androidx.databinding.BindingAdapter;
|
|||||||
import androidx.databinding.BindingConversion;
|
import androidx.databinding.BindingConversion;
|
||||||
import androidx.databinding.Observable;
|
import androidx.databinding.Observable;
|
||||||
import androidx.databinding.ObservableField;
|
import androidx.databinding.ObservableField;
|
||||||
|
import androidx.lifecycle.LifecycleOwner;
|
||||||
|
import androidx.lifecycle.LiveData;
|
||||||
|
import androidx.lifecycle.Observer;
|
||||||
|
import androidx.lifecycle.ViewTreeLifecycleOwner;
|
||||||
|
|
||||||
import com.google.android.material.datepicker.MaterialDatePicker;
|
import com.google.android.material.datepicker.MaterialDatePicker;
|
||||||
import com.google.android.material.textfield.TextInputEditText;
|
import com.google.android.material.textfield.TextInputEditText;
|
||||||
@@ -820,11 +824,11 @@ public class Converters {
|
|||||||
|
|
||||||
|
|
||||||
@BindingAdapter("visibilityWhenNotNull")
|
@BindingAdapter("visibilityWhenNotNull")
|
||||||
public static void bindViewVisibilityWhenNotNull(View view, ObservableField<?> bindableObject) {
|
public static void bindViewVisibilityObservableFieldWhenNotNull(View view, ObservableField<?> bindableObject) {
|
||||||
if(bindableObject == null) return;
|
if(bindableObject == null) return;
|
||||||
|
|
||||||
if (view.getTag(R.id.bound_observable) != bindableObject) {
|
if (view.getTag(R.id.bound_observable_visibility) != bindableObject) {
|
||||||
view.setTag(R.id.bound_observable, bindableObject);
|
view.setTag(R.id.bound_observable_visibility, bindableObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
bindableObject.addOnPropertyChangedCallback(new Observable.OnPropertyChangedCallback() {
|
bindableObject.addOnPropertyChangedCallback(new Observable.OnPropertyChangedCallback() {
|
||||||
@@ -838,6 +842,36 @@ public class Converters {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@BindingAdapter("visibilityWhenNotNull")
|
||||||
|
public static void bindViewVisibilityLiveDataWhenNotNull(View view, LiveData<?> liveData) {
|
||||||
|
// Se il LiveData è null, nascondi la view e esci
|
||||||
|
if (liveData == null) {
|
||||||
|
view.setVisibility(View.GONE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ottieni il LifecycleOwner dalla view
|
||||||
|
LifecycleOwner lifecycleOwner = ViewTreeLifecycleOwner.get(view);
|
||||||
|
if (lifecycleOwner == null) return;
|
||||||
|
|
||||||
|
// Rimuovi eventuali observer precedenti
|
||||||
|
Observer<Object> oldObserver = (Observer<Object>) view.getTag(R.id.bound_observable_visibility);
|
||||||
|
if (oldObserver != null) {
|
||||||
|
liveData.removeObserver(oldObserver);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Crea e registra il nuovo observer
|
||||||
|
Observer<Object> newObserver = value ->
|
||||||
|
view.setVisibility(value == null ? View.GONE : View.VISIBLE);
|
||||||
|
|
||||||
|
liveData.observe(lifecycleOwner, newObserver);
|
||||||
|
view.setTag(R.id.bound_observable_visibility, newObserver);
|
||||||
|
|
||||||
|
// Imposta lo stato iniziale
|
||||||
|
view.setVisibility(liveData.getValue() == null ? View.GONE : View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@BindingAdapter("visibilityWhenNotNull")
|
@BindingAdapter("visibilityWhenNotNull")
|
||||||
public static void bindViewVisibilityWhenNotNull(View view, Object genericObject) {
|
public static void bindViewVisibilityWhenNotNull(View view, Object genericObject) {
|
||||||
view.setVisibility(genericObject == null ? View.GONE : View.VISIBLE);
|
view.setVisibility(genericObject == null ? View.GONE : View.VISIBLE);
|
||||||
@@ -845,7 +879,7 @@ public class Converters {
|
|||||||
|
|
||||||
|
|
||||||
@BindingAdapter("visibilityWhenNull")
|
@BindingAdapter("visibilityWhenNull")
|
||||||
public static void bindViewVisibilityWhenNull(View view, ObservableField<?> bindableObject) {
|
public static void bindViewVisibilityObservableFieldWhenNull(View view, ObservableField<?> bindableObject) {
|
||||||
|
|
||||||
if (view.getTag(R.id.bound_observable_visibility) != bindableObject) {
|
if (view.getTag(R.id.bound_observable_visibility) != bindableObject) {
|
||||||
view.setTag(R.id.bound_observable_visibility, bindableObject);
|
view.setTag(R.id.bound_observable_visibility, bindableObject);
|
||||||
@@ -864,6 +898,36 @@ public class Converters {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@BindingAdapter("visibilityWhenNull")
|
||||||
|
public static void bindViewVisibilityLiveDataWhenNull(View view, LiveData<?> liveData) {
|
||||||
|
// Se il LiveData è null, nascondi la view e esci
|
||||||
|
if (liveData == null) {
|
||||||
|
view.setVisibility(View.VISIBLE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ottieni il LifecycleOwner dalla view
|
||||||
|
LifecycleOwner lifecycleOwner = ViewTreeLifecycleOwner.get(view);
|
||||||
|
if (lifecycleOwner == null) return;
|
||||||
|
|
||||||
|
// Rimuovi eventuali observer precedenti
|
||||||
|
Observer<Object> oldObserver = (Observer<Object>) view.getTag(R.id.bound_observable_visibility);
|
||||||
|
if (oldObserver != null) {
|
||||||
|
liveData.removeObserver(oldObserver);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Crea e registra il nuovo observer
|
||||||
|
Observer<Object> newObserver = value ->
|
||||||
|
view.setVisibility(value == null ? View.VISIBLE : View.GONE);
|
||||||
|
|
||||||
|
liveData.observe(lifecycleOwner, newObserver);
|
||||||
|
view.setTag(R.id.bound_observable_visibility, newObserver);
|
||||||
|
|
||||||
|
// Imposta lo stato iniziale
|
||||||
|
view.setVisibility(liveData.getValue() == null ? View.VISIBLE : View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@BindingAdapter({"reverse_visibility"})
|
@BindingAdapter({"reverse_visibility"})
|
||||||
public static void bindViewReverseVisibility(View view, final BindableBoolean bindableBoolean) {
|
public static void bindViewReverseVisibility(View view, final BindableBoolean bindableBoolean) {
|
||||||
if (view.getTag(R.id.bound_reverse_visibility) != bindableBoolean) {
|
if (view.getTag(R.id.bound_reverse_visibility) != bindableBoolean) {
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package it.integry.integrywmsnative.core.exception;
|
||||||
|
|
||||||
|
public class InvalidCodMdepBarcodeException extends RuntimeException {
|
||||||
|
|
||||||
|
public InvalidCodMdepBarcodeException(String message) {
|
||||||
|
super("Il deposito scansionato non è valido: " + message);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,7 +4,13 @@ import it.integry.integrywmsnative.R;
|
|||||||
import it.integry.integrywmsnative.core.utility.UtilityResources;
|
import it.integry.integrywmsnative.core.utility.UtilityResources;
|
||||||
|
|
||||||
public final class InvalidCodMdepException extends Exception {
|
public final class InvalidCodMdepException extends Exception {
|
||||||
|
|
||||||
public InvalidCodMdepException() {
|
public InvalidCodMdepException() {
|
||||||
super(UtilityResources.getString(R.string.invalid_codmdep));
|
super(UtilityResources.getString(R.string.invalid_codmdep_error_message));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public InvalidCodMdepException(String codMdep) {
|
||||||
|
super(UtilityResources.getString(R.string.invalid_codmdep_error_message) + "(" + codMdep + ")");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ public class BaseActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onLoadingStarted() {
|
public void onLoadingStarted() {
|
||||||
BarcodeManager.disable();
|
|
||||||
this.openProgress();
|
this.openProgress();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,14 +51,14 @@ public class BaseActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
|
|
||||||
private void openProgress() {
|
private void openProgress() {
|
||||||
BarcodeManager.disable();
|
BarcodeManager.disableLastCallback();
|
||||||
// executorService.execute(() -> {
|
// executorService.execute(() -> {
|
||||||
this.mCurrentProgress.show(getSupportFragmentManager());
|
this.mCurrentProgress.show(getSupportFragmentManager());
|
||||||
// });
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
private void closeProgress() {
|
private void closeProgress() {
|
||||||
BarcodeManager.enable();
|
BarcodeManager.enableLastCallback();
|
||||||
// executorService.execute(() -> {
|
// executorService.execute(() -> {
|
||||||
mCurrentProgress.dismiss();
|
mCurrentProgress.dismiss();
|
||||||
// });
|
// });
|
||||||
@@ -67,7 +66,7 @@ public class BaseActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean dispatchKeyEvent(KeyEvent event) {
|
public boolean dispatchKeyEvent(KeyEvent event) {
|
||||||
if (BarcodeManager.isEnabled() && BarcodeManager.isKeyboardEmulator()) {
|
if (BarcodeManager.isLastCallbackEnabled() && BarcodeManager.isKeyboardEmulator()) {
|
||||||
if (event.getAction() == KeyEvent.ACTION_DOWN || event.getAction() == KeyEvent.ACTION_MULTIPLE && !isControlKey(event)) {
|
if (event.getAction() == KeyEvent.ACTION_DOWN || event.getAction() == KeyEvent.ACTION_MULTIPLE && !isControlKey(event)) {
|
||||||
return BarcodeManager.onKeyDown(event.getKeyCode(), event);
|
return BarcodeManager.onKeyDown(event.getKeyCode(), event);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ public class BaseDialog extends Dialog {
|
|||||||
|
|
||||||
public BaseDialog(@NonNull Context context) {
|
public BaseDialog(@NonNull Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
if (BarcodeManager.isEnabled() && BarcodeManager.isKeyboardEmulator()) {
|
if (BarcodeManager.isLastCallbackEnabled() && BarcodeManager.isKeyboardEmulator()) {
|
||||||
setOnKeyListener((dialog, keyCode, event) -> {
|
setOnKeyListener((dialog, keyCode, event) -> {
|
||||||
if (mBarcodeListener && (event.getAction() == KeyEvent.ACTION_DOWN || event.getAction() == KeyEvent.ACTION_MULTIPLE) && !isControlKey(event)) {
|
if (mBarcodeListener && (event.getAction() == KeyEvent.ACTION_DOWN || event.getAction() == KeyEvent.ACTION_MULTIPLE) && !isControlKey(event)) {
|
||||||
return BarcodeManager.onKeyDown(event.getKeyCode(), event);
|
return BarcodeManager.onKeyDown(event.getKeyCode(), event);
|
||||||
|
|||||||
@@ -65,25 +65,23 @@ public abstract class BaseDialogFragment extends DialogFragment implements Dialo
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onLoadingStarted() {
|
public void onLoadingStarted() {
|
||||||
BarcodeManager.disable();
|
|
||||||
this.openProgress();
|
this.openProgress();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onLoadingEnded() {
|
public void onLoadingEnded() {
|
||||||
this.closeProgress();
|
this.closeProgress();
|
||||||
BarcodeManager.enable();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void openProgress() {
|
private void openProgress() {
|
||||||
BarcodeManager.disable();
|
BarcodeManager.disableLastCallback();
|
||||||
// executorService.execute(() -> {
|
// executorService.execute(() -> {
|
||||||
this.mCurrentProgress.show(requireActivity().getSupportFragmentManager());
|
this.mCurrentProgress.show(requireActivity().getSupportFragmentManager());
|
||||||
// });
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
private void closeProgress() {
|
private void closeProgress() {
|
||||||
BarcodeManager.enable();
|
BarcodeManager.enableLastCallback();
|
||||||
// executorService.execute(() -> {
|
// executorService.execute(() -> {
|
||||||
mCurrentProgress.dismiss();
|
mCurrentProgress.dismiss();
|
||||||
// });
|
// });
|
||||||
@@ -91,9 +89,8 @@ public abstract class BaseDialogFragment extends DialogFragment implements Dialo
|
|||||||
|
|
||||||
|
|
||||||
public void onError(Exception ex) {
|
public void onError(Exception ex) {
|
||||||
this.onLoadingEnded();
|
|
||||||
|
|
||||||
requireActivity().runOnUiThread(() -> {
|
requireActivity().runOnUiThread(() -> {
|
||||||
|
this.onLoadingEnded();
|
||||||
UtilityExceptions.defaultException(requireActivity(), ex);
|
UtilityExceptions.defaultException(requireActivity(), ex);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -130,7 +127,7 @@ public abstract class BaseDialogFragment extends DialogFragment implements Dialo
|
|||||||
.create()
|
.create()
|
||||||
.inject(this);
|
.inject(this);
|
||||||
|
|
||||||
if (BarcodeManager.isEnabled() && BarcodeManager.isKeyboardEmulator() && getDialog() != null) {
|
if (BarcodeManager.isLastCallbackEnabled() && BarcodeManager.isKeyboardEmulator() && getDialog() != null) {
|
||||||
getDialog().setOnKeyListener((dialog, keyCode, event) -> {
|
getDialog().setOnKeyListener((dialog, keyCode, event) -> {
|
||||||
if (mBarcodeListener && (event.getAction() == KeyEvent.ACTION_DOWN || event.getAction() == KeyEvent.ACTION_MULTIPLE) && !isControlKey(event)) {
|
if (mBarcodeListener && (event.getAction() == KeyEvent.ACTION_DOWN || event.getAction() == KeyEvent.ACTION_MULTIPLE) && !isControlKey(event)) {
|
||||||
return BarcodeManager.onKeyDown(event.getKeyCode(), event);
|
return BarcodeManager.onKeyDown(event.getKeyCode(), event);
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package it.integry.integrywmsnative.core.expansion;
|
package it.integry.integrywmsnative.core.expansion;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.Handler;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
@@ -30,6 +31,9 @@ public abstract class BaseFragment extends Fragment {
|
|||||||
@Inject
|
@Inject
|
||||||
public ExecutorService executorService;
|
public ExecutorService executorService;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public Handler handler;
|
||||||
|
|
||||||
protected ElevatedToolbar mToolbar;
|
protected ElevatedToolbar mToolbar;
|
||||||
|
|
||||||
protected final List<Runnable> mOnPreDestroyList = new ArrayList<>();
|
protected final List<Runnable> mOnPreDestroyList = new ArrayList<>();
|
||||||
@@ -65,24 +69,23 @@ public abstract class BaseFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void openProgress() {
|
private void openProgress() {
|
||||||
BarcodeManager.disable();
|
BarcodeManager.disableLastCallback();
|
||||||
// executorService.execute(() -> {
|
// executorService.execute(() -> {
|
||||||
this.mCurrentProgress.show(requireActivity().getSupportFragmentManager());
|
this.mCurrentProgress.show(requireActivity().getSupportFragmentManager());
|
||||||
// });
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
private void closeProgress() {
|
private void closeProgress() {
|
||||||
BarcodeManager.enable();
|
BarcodeManager.enableLastCallback();
|
||||||
// executorService.execute(() -> {
|
// executorService.execute(() -> {
|
||||||
mCurrentProgress.dismiss();
|
mCurrentProgress.dismiss();
|
||||||
// });
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onError(Exception ex) {
|
public void onError(Exception ex) {
|
||||||
requireActivity().runOnUiThread(() -> {
|
handler.post(() -> {
|
||||||
this.closeProgress();
|
this.closeProgress();
|
||||||
UtilityExceptions.defaultException(getActivity(), ex);
|
UtilityExceptions.defaultException(getActivity(), ex);
|
||||||
BarcodeManager.enable();
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,7 +105,7 @@ public abstract class BaseFragment extends Fragment {
|
|||||||
|
|
||||||
protected void popMe() {
|
protected void popMe() {
|
||||||
if (requireActivity() instanceof IPoppableActivity) {
|
if (requireActivity() instanceof IPoppableActivity) {
|
||||||
requireActivity().runOnUiThread(() -> {
|
handler.post(() -> {
|
||||||
((IPoppableActivity) requireActivity()).pop();
|
((IPoppableActivity) requireActivity()).pop();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package it.integry.integrywmsnative.core.expansion.view;
|
||||||
|
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
|
import androidx.databinding.ObservableArrayList;
|
||||||
|
import androidx.databinding.ObservableList;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.expansion.OnListGeneralChangedCallback;
|
||||||
|
|
||||||
|
public abstract class ExtendedSectionedRecyclerViewNew<T, SH extends RecyclerView.ViewHolder, VH extends RecyclerView.ViewHolder>
|
||||||
|
extends SectionedRecyclerViewAdapter<SH, VH> {
|
||||||
|
|
||||||
|
private View mEmptyView;
|
||||||
|
|
||||||
|
public ExtendedSectionedRecyclerViewNew(ObservableArrayList<T> myDataset) {
|
||||||
|
super();
|
||||||
|
|
||||||
|
myDataset.addOnListChangedCallback(new OnListGeneralChangedCallback<T>() {
|
||||||
|
@Override
|
||||||
|
public void onChanged(ObservableList<T> sender) {
|
||||||
|
checkIfEmpty();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
checkIfEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ExtendedSectionedRecyclerViewNew<T, SH, VH> setEmptyView(View emptyView) {
|
||||||
|
this.mEmptyView = emptyView;
|
||||||
|
this.checkIfEmpty();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void checkIfEmpty() {
|
||||||
|
if (mEmptyView != null) {
|
||||||
|
final boolean emptyViewVisible = getItemCount() == 0;
|
||||||
|
mEmptyView.setVisibility(emptyViewVisible ? View.VISIBLE : View.GONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,218 @@
|
|||||||
|
package it.integry.integrywmsnative.core.expansion.view;
|
||||||
|
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.Looper;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.util.SparseArray;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import java.lang.ref.WeakReference;
|
||||||
|
import java.util.ArrayDeque;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
public class RecyclerViewProfiler {
|
||||||
|
private static final String TAG = "RVProfiler";
|
||||||
|
private final SparseArray<Long> bindingTimes;
|
||||||
|
private final SparseArray<Long> creationTimes;
|
||||||
|
private final Handler mainHandler;
|
||||||
|
private WeakReference<RecyclerView> recyclerViewRef;
|
||||||
|
private boolean isProfilingEnabled = true;
|
||||||
|
|
||||||
|
// Metriche di performance
|
||||||
|
private long totalBindingTime = 0;
|
||||||
|
private long totalCreationTime = 0;
|
||||||
|
private int bindCount = 0;
|
||||||
|
private int createCount = 0;
|
||||||
|
private long firstBindTime = 0;
|
||||||
|
private final ArrayDeque<Long> recentBindTimes;
|
||||||
|
private static final int MAX_RECENT_TIMES = 50;
|
||||||
|
|
||||||
|
public RecyclerViewProfiler(RecyclerView recyclerView) {
|
||||||
|
this.recyclerViewRef = new WeakReference<>(recyclerView);
|
||||||
|
this.bindingTimes = new SparseArray<>();
|
||||||
|
this.creationTimes = new SparseArray<>();
|
||||||
|
this.mainHandler = new Handler(Looper.getMainLooper());
|
||||||
|
this.recentBindTimes = new ArrayDeque<>();
|
||||||
|
|
||||||
|
setupRecyclerViewCallbacks();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setupRecyclerViewCallbacks() {
|
||||||
|
RecyclerView recyclerView = recyclerViewRef.get();
|
||||||
|
if (recyclerView == null) return;
|
||||||
|
|
||||||
|
recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||||
|
@Override
|
||||||
|
public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
|
||||||
|
if (newState == RecyclerView.SCROLL_STATE_IDLE) {
|
||||||
|
logPerformanceMetrics();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Monitora il pre-layout
|
||||||
|
recyclerView.addOnLayoutChangeListener((v, left, top, right, bottom,
|
||||||
|
oldLeft, oldTop, oldRight, oldBottom) -> {
|
||||||
|
if (firstBindTime == 0) {
|
||||||
|
mainHandler.postDelayed(this::checkInitialPerformance, 500);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onPreBind(int position) {
|
||||||
|
if (!isProfilingEnabled) return;
|
||||||
|
bindingTimes.put(position, System.nanoTime());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onPostBind(int position) {
|
||||||
|
if (!isProfilingEnabled) return;
|
||||||
|
|
||||||
|
Long startTime = bindingTimes.get(position);
|
||||||
|
if (startTime != null) {
|
||||||
|
long bindTime = System.nanoTime() - startTime;
|
||||||
|
bindingTimes.remove(position);
|
||||||
|
|
||||||
|
if (firstBindTime == 0) {
|
||||||
|
firstBindTime = bindTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
totalBindingTime += bindTime;
|
||||||
|
bindCount++;
|
||||||
|
|
||||||
|
recentBindTimes.addLast(bindTime);
|
||||||
|
if (recentBindTimes.size() > MAX_RECENT_TIMES) {
|
||||||
|
recentBindTimes.removeFirst();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Segnala binding lenti
|
||||||
|
if (bindTime > TimeUnit.MILLISECONDS.toNanos(16)) { // 1 frame
|
||||||
|
Log.w(TAG, String.format("Slow binding at position %d: %.2fms",
|
||||||
|
position, bindTime / 1_000_000.0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onPreCreate(int viewType) {
|
||||||
|
if (!isProfilingEnabled) return;
|
||||||
|
creationTimes.put(viewType, System.nanoTime());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onPostCreate(int viewType) {
|
||||||
|
if (!isProfilingEnabled) return;
|
||||||
|
|
||||||
|
Long startTime = creationTimes.get(viewType);
|
||||||
|
if (startTime != null) {
|
||||||
|
long createTime = System.nanoTime() - startTime;
|
||||||
|
creationTimes.remove(viewType);
|
||||||
|
|
||||||
|
totalCreationTime += createTime;
|
||||||
|
createCount++;
|
||||||
|
|
||||||
|
// Segnala creazioni lente
|
||||||
|
if (createTime > TimeUnit.MILLISECONDS.toNanos(8)) {
|
||||||
|
Log.w(TAG, String.format("Slow view creation for type %d: %.2fms",
|
||||||
|
viewType, createTime / 1_000_000.0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void checkInitialPerformance() {
|
||||||
|
RecyclerView recyclerView = recyclerViewRef.get();
|
||||||
|
if (recyclerView == null) return;
|
||||||
|
|
||||||
|
// Verifica inflazione layout
|
||||||
|
long avgBindTime = bindCount > 0 ? totalBindingTime / bindCount : 0;
|
||||||
|
if (avgBindTime > TimeUnit.MILLISECONDS.toNanos(8)) {
|
||||||
|
Log.w(TAG, String.format("High average binding time: %.2fms. " +
|
||||||
|
"Consider using AsyncLayoutInflater", avgBindTime / 1_000_000.0));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Verifica dimensione view pool
|
||||||
|
RecyclerView.RecycledViewPool pool = recyclerView.getRecycledViewPool();
|
||||||
|
if (pool != null) {
|
||||||
|
int[] viewTypes = getViewTypes(recyclerView);
|
||||||
|
for (int type : viewTypes) {
|
||||||
|
if (pool.getRecycledViewCount(type) == 0) {
|
||||||
|
Log.w(TAG, "ViewPool empty for type " + type +
|
||||||
|
". Consider increasing pool size");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Verifica prefetch
|
||||||
|
if (recyclerView.getLayoutManager() instanceof LinearLayoutManager) {
|
||||||
|
LinearLayoutManager lm = (LinearLayoutManager) recyclerView.getLayoutManager();
|
||||||
|
if (!lm.isItemPrefetchEnabled()) {
|
||||||
|
Log.w(TAG, "Item prefetch is disabled. Enable it for better performance");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void logPerformanceMetrics() {
|
||||||
|
if (!isProfilingEnabled || recentBindTimes.isEmpty()) return;
|
||||||
|
|
||||||
|
// Calcola la varianza dei tempi di binding recenti
|
||||||
|
double mean = recentBindTimes.stream()
|
||||||
|
.mapToLong(Long::longValue)
|
||||||
|
.average()
|
||||||
|
.orElse(0.0);
|
||||||
|
|
||||||
|
double variance = recentBindTimes.stream()
|
||||||
|
.mapToDouble(time -> Math.pow(time - mean, 2))
|
||||||
|
.average()
|
||||||
|
.orElse(0.0);
|
||||||
|
|
||||||
|
Log.d(TAG, String.format("Performance metrics:\n" +
|
||||||
|
"Avg binding time: %.2fms\n" +
|
||||||
|
"Binding time variance: %.2f\n" +
|
||||||
|
"View creation rate: %.1f%%",
|
||||||
|
mean / 1_000_000.0,
|
||||||
|
variance / 1_000_000.0,
|
||||||
|
createCount * 100.0 / (bindCount + 1)));
|
||||||
|
}
|
||||||
|
|
||||||
|
private int[] getViewTypes(RecyclerView recyclerView) {
|
||||||
|
RecyclerView.Adapter<?> adapter = recyclerView.getAdapter();
|
||||||
|
if (adapter == null) return new int[0];
|
||||||
|
|
||||||
|
Set<Integer> types = new HashSet<>();
|
||||||
|
for (int i = 0; i < adapter.getItemCount(); i++) {
|
||||||
|
types.add(adapter.getItemViewType(i));
|
||||||
|
}
|
||||||
|
return types.stream().mapToInt(Integer::intValue).toArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void enableProfiling(boolean enabled) {
|
||||||
|
isProfilingEnabled = enabled;
|
||||||
|
if (!enabled) {
|
||||||
|
bindingTimes.clear();
|
||||||
|
creationTimes.clear();
|
||||||
|
recentBindTimes.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getProfilingStats() {
|
||||||
|
if (bindCount == 0) return "No data collected yet";
|
||||||
|
|
||||||
|
return String.format(Locale.US,
|
||||||
|
"Profiling Statistics:\n" +
|
||||||
|
"Total bindings: %d\n" +
|
||||||
|
"Average binding time: %.2fms\n" +
|
||||||
|
"Total view creations: %d\n" +
|
||||||
|
"Average creation time: %.2fms\n" +
|
||||||
|
"First binding time: %.2fms\n" +
|
||||||
|
"Creation/Binding ratio: %.1f%%",
|
||||||
|
bindCount,
|
||||||
|
(totalBindingTime / bindCount) / 1_000_000.0,
|
||||||
|
createCount,
|
||||||
|
(totalCreationTime / createCount) / 1_000_000.0,
|
||||||
|
firstBindTime / 1_000_000.0,
|
||||||
|
createCount * 100.0 / bindCount);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,352 @@
|
|||||||
|
package it.integry.integrywmsnative.core.expansion.view;
|
||||||
|
|
||||||
|
import android.util.SparseArray;
|
||||||
|
import android.util.SparseIntArray;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.BuildConfig;
|
||||||
|
|
||||||
|
public abstract class SectionedRecyclerViewAdapter<H extends RecyclerView.ViewHolder,
|
||||||
|
I extends RecyclerView.ViewHolder> extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||||
|
|
||||||
|
private RecyclerViewProfiler profiler;
|
||||||
|
|
||||||
|
private static final int TYPE_HEADER = 0;
|
||||||
|
private static final int TYPE_ITEM = 1;
|
||||||
|
|
||||||
|
// Utilizziamo SparseArray invece di HashMap per migliori performance su Android
|
||||||
|
private final SparseArray<Section> sectionsByPosition;
|
||||||
|
private final ArrayList<Section> sections;
|
||||||
|
|
||||||
|
// Cache per le posizioni degli item per evitare ricalcoli frequenti
|
||||||
|
private final SparseIntArray positionCache;
|
||||||
|
private int lastCacheUpdateCount;
|
||||||
|
|
||||||
|
// Pool di View per riutilizzo
|
||||||
|
private final RecyclerView.RecycledViewPool sharedPool;
|
||||||
|
|
||||||
|
// Dimensione massima della cache delle posizioni
|
||||||
|
private static final int MAX_POSITION_CACHE_SIZE = 2000;
|
||||||
|
|
||||||
|
public SectionedRecyclerViewAdapter() {
|
||||||
|
this.sections = new ArrayList<>();
|
||||||
|
this.sectionsByPosition = new SparseArray<>();
|
||||||
|
this.positionCache = new SparseIntArray(MAX_POSITION_CACHE_SIZE);
|
||||||
|
this.sharedPool = new RecyclerView.RecycledViewPool();
|
||||||
|
|
||||||
|
// Aumentiamo il pool di ViewHolder per tipo
|
||||||
|
sharedPool.setMaxRecycledViews(TYPE_HEADER, 500);
|
||||||
|
sharedPool.setMaxRecycledViews(TYPE_ITEM, 2000);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAttachedToRecyclerView(@NonNull RecyclerView recyclerView) {
|
||||||
|
super.onAttachedToRecyclerView(recyclerView);
|
||||||
|
profiler = new RecyclerViewProfiler(recyclerView);
|
||||||
|
profiler.enableProfiling(BuildConfig.DEBUG);
|
||||||
|
|
||||||
|
recyclerView.setRecycledViewPool(sharedPool);
|
||||||
|
|
||||||
|
// Ottimizziamo il layout manager per le prestazioni
|
||||||
|
if (recyclerView.getLayoutManager() instanceof LinearLayoutManager) {
|
||||||
|
LinearLayoutManager layoutManager = (LinearLayoutManager) recyclerView.getLayoutManager();
|
||||||
|
layoutManager.setItemPrefetchEnabled(true);
|
||||||
|
// layoutManager.setInitialPrefetchItemCount(20);
|
||||||
|
}
|
||||||
|
|
||||||
|
// recyclerView.postDelayed(() -> {
|
||||||
|
// Precarica alcuni ViewHolder
|
||||||
|
// for (int i = 0; i < 100; i++) {
|
||||||
|
// sharedPool.putRecycledView(
|
||||||
|
// createViewHolder(recyclerView, TYPE_HEADER));
|
||||||
|
// }
|
||||||
|
// for (int i = 0; i < 100; i++) {
|
||||||
|
// sharedPool.putRecycledView(
|
||||||
|
// createViewHolder(recyclerView, TYPE_ITEM));
|
||||||
|
// }
|
||||||
|
// }, 50);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static class Section {
|
||||||
|
private final Object headerData;
|
||||||
|
private final ArrayList<Object> itemsData;
|
||||||
|
private int globalStartPosition; // Posizione globale di inizio sezione
|
||||||
|
|
||||||
|
public Section(Object headerData, int initialCapacity) {
|
||||||
|
this.headerData = headerData;
|
||||||
|
this.itemsData = new ArrayList<>(initialCapacity);
|
||||||
|
this.globalStartPosition = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getHeaderData() {
|
||||||
|
return headerData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Object> getItemsData() {
|
||||||
|
return itemsData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addItem(Object item) {
|
||||||
|
itemsData.add(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getItemCount() {
|
||||||
|
return itemsData.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGlobalStartPosition(int position) {
|
||||||
|
this.globalStartPosition = position;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getGlobalStartPosition() {
|
||||||
|
return globalStartPosition;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ViewHolder pooling e caching
|
||||||
|
@Override
|
||||||
|
public void onViewRecycled(@NonNull RecyclerView.ViewHolder holder) {
|
||||||
|
super.onViewRecycled(holder);
|
||||||
|
// Pulizia custom del ViewHolder se necessario
|
||||||
|
if (holder instanceof OnRecycleListener) {
|
||||||
|
((OnRecycleListener) holder).onRecycle();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Interfaccia per gestire la pulizia custom dei ViewHolder
|
||||||
|
public interface OnRecycleListener {
|
||||||
|
void onRecycle();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@NonNull
|
||||||
|
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
|
profiler.onPreCreate(viewType);
|
||||||
|
RecyclerView.ViewHolder holder;
|
||||||
|
if (viewType == TYPE_HEADER) {
|
||||||
|
holder = onCreateHeaderViewHolder(parent);
|
||||||
|
} else {
|
||||||
|
holder = onCreateItemViewHolder(parent);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Applichiamo ViewHolder pooling
|
||||||
|
if (holder.itemView.getLayoutParams() == null) {
|
||||||
|
holder.itemView.setLayoutParams(
|
||||||
|
new ViewGroup.LayoutParams(
|
||||||
|
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||||
|
ViewGroup.LayoutParams.WRAP_CONTENT
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
profiler.onPostCreate(viewType);
|
||||||
|
return holder;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||||
|
profiler.onPreBind(position);
|
||||||
|
PositionInfo posInfo = getItemPositionInfo(position);
|
||||||
|
|
||||||
|
if (getItemViewType(position) == TYPE_HEADER) {
|
||||||
|
onBindHeaderViewHolder((H) holder,
|
||||||
|
sections.get(posInfo.sectionPosition).getHeaderData(),
|
||||||
|
posInfo.sectionPosition);
|
||||||
|
} else {
|
||||||
|
Section section = sections.get(posInfo.sectionPosition);
|
||||||
|
onBindItemViewHolder((I) holder,
|
||||||
|
section.getItemsData().get(posInfo.itemPosition),
|
||||||
|
posInfo.sectionPosition,
|
||||||
|
posInfo.itemPosition);
|
||||||
|
}
|
||||||
|
profiler.onPostBind(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position, @NonNull List<Object> payloads) {
|
||||||
|
if (payloads.isEmpty()) {
|
||||||
|
super.onBindViewHolder(holder, position, payloads);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Supporto per aggiornamenti parziali
|
||||||
|
if (getItemViewType(position) == TYPE_HEADER) {
|
||||||
|
onBindHeaderViewHolderPartial((H) holder, position, payloads);
|
||||||
|
} else {
|
||||||
|
onBindItemViewHolderPartial((I) holder, position, payloads);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Metodi per gestire aggiornamenti parziali
|
||||||
|
protected void onBindHeaderViewHolderPartial(H holder, int position, List<Object> payloads) {
|
||||||
|
onBindViewHolder(holder, position);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void onBindItemViewHolderPartial(I holder, int position, List<Object> payloads) {
|
||||||
|
onBindViewHolder(holder, position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
int count = 0;
|
||||||
|
for (Section section : sections) {
|
||||||
|
count += section.getItemCount() + 1;
|
||||||
|
}
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemViewType(int position) {
|
||||||
|
return isHeader(position) ? TYPE_HEADER : TYPE_ITEM;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Metodi ottimizzati per la gestione delle sezioni
|
||||||
|
public <T> void addSection(T headerData, int expectedItems) {
|
||||||
|
sections.add(new Section(headerData, expectedItems));
|
||||||
|
updatePositionCache();
|
||||||
|
notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addItem(int sectionPosition, Object item) {
|
||||||
|
if (sectionPosition >= 0 && sectionPosition < sections.size()) {
|
||||||
|
sections.get(sectionPosition).addItem(item);
|
||||||
|
updatePositionCache();
|
||||||
|
// Notifichiamo solo l'inserimento invece di un refresh completo
|
||||||
|
notifyItemInserted(getGlobalPositionForItem(sectionPosition,
|
||||||
|
sections.get(sectionPosition).getItemCount() - 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T extends Object, S extends Object> void setSections(List<T> headers, Map<T, List<S>> items) {
|
||||||
|
sections.clear();
|
||||||
|
sectionsByPosition.clear();
|
||||||
|
|
||||||
|
int position = 0;
|
||||||
|
for (T header : headers) {
|
||||||
|
List<S> sectionItems = items.get(header);
|
||||||
|
Section section = new Section(header, sectionItems != null ? sectionItems.size() : 5);
|
||||||
|
if (sectionItems != null) {
|
||||||
|
section.getItemsData().addAll(sectionItems);
|
||||||
|
}
|
||||||
|
section.setGlobalStartPosition(position);
|
||||||
|
sections.add(section);
|
||||||
|
sectionsByPosition.put(position, section);
|
||||||
|
|
||||||
|
position += section.getItemCount() + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
updatePositionCache();
|
||||||
|
notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Gestione efficiente della cache delle posizioni
|
||||||
|
private void updatePositionCache() {
|
||||||
|
if (sections.size() > MAX_POSITION_CACHE_SIZE) {
|
||||||
|
positionCache.clear();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int currentPosition = 0;
|
||||||
|
for (int i = 0; i < sections.size(); i++) {
|
||||||
|
Section section = sections.get(i);
|
||||||
|
section.setGlobalStartPosition(currentPosition);
|
||||||
|
sectionsByPosition.put(currentPosition, section);
|
||||||
|
currentPosition += section.getItemCount() + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
lastCacheUpdateCount = getItemCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isHeader(int position) {
|
||||||
|
Section section = sectionsByPosition.get(position);
|
||||||
|
if (section != null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < sections.size(); i++) {
|
||||||
|
section = sections.get(i);
|
||||||
|
if (position == section.getGlobalStartPosition()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (position < section.getGlobalStartPosition() + section.getItemCount() + 1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class PositionInfo {
|
||||||
|
final int sectionPosition;
|
||||||
|
final int itemPosition;
|
||||||
|
|
||||||
|
PositionInfo(int sectionPosition, int itemPosition) {
|
||||||
|
this.sectionPosition = sectionPosition;
|
||||||
|
this.itemPosition = itemPosition;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private PositionInfo getItemPositionInfo(int position) {
|
||||||
|
// Controllo cache
|
||||||
|
int cachedSection = positionCache.get(position, -1);
|
||||||
|
if (cachedSection != -1 && lastCacheUpdateCount == getItemCount()) {
|
||||||
|
Section section = sections.get(cachedSection);
|
||||||
|
int relativePos = position - section.getGlobalStartPosition();
|
||||||
|
if (relativePos == 0) {
|
||||||
|
return new PositionInfo(cachedSection, -1);
|
||||||
|
}
|
||||||
|
return new PositionInfo(cachedSection, relativePos - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ricerca ottimizzata
|
||||||
|
Section targetSection = sectionsByPosition.get(position);
|
||||||
|
if (targetSection != null) {
|
||||||
|
int sectionIndex = sections.indexOf(targetSection);
|
||||||
|
return new PositionInfo(sectionIndex, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ricerca binaria nelle sezioni
|
||||||
|
int left = 0;
|
||||||
|
int right = sections.size() - 1;
|
||||||
|
|
||||||
|
while (left <= right) {
|
||||||
|
int mid = (left + right) >>> 1;
|
||||||
|
Section section = sections.get(mid);
|
||||||
|
int sectionStart = section.getGlobalStartPosition();
|
||||||
|
int sectionEnd = sectionStart + section.getItemCount() + 1;
|
||||||
|
|
||||||
|
if (position >= sectionStart && position < sectionEnd) {
|
||||||
|
int relativePos = position - sectionStart;
|
||||||
|
if (relativePos == 0) {
|
||||||
|
return new PositionInfo(mid, -1);
|
||||||
|
}
|
||||||
|
return new PositionInfo(mid, relativePos - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (position < sectionStart) {
|
||||||
|
right = mid - 1;
|
||||||
|
} else {
|
||||||
|
left = mid + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new IndexOutOfBoundsException("Position " + position + " is out of bounds");
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getGlobalPositionForItem(int sectionPosition, int itemPosition) {
|
||||||
|
return sections.get(sectionPosition).getGlobalStartPosition() + itemPosition + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Metodi astratti che devono essere implementati
|
||||||
|
protected abstract H onCreateHeaderViewHolder(ViewGroup parent);
|
||||||
|
protected abstract I onCreateItemViewHolder(ViewGroup parent);
|
||||||
|
protected abstract void onBindHeaderViewHolder(H holder, Object headerData, int sectionPosition);
|
||||||
|
protected abstract void onBindItemViewHolder(I holder, Object itemData, int sectionPosition, int itemPosition);
|
||||||
|
}
|
||||||
@@ -2,11 +2,11 @@ package it.integry.integrywmsnative.core.mapper;
|
|||||||
|
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.data_store.db.entity.InventarioRoomDTO;
|
import it.integry.integrywmsnative.core.data_store.db.entity.InventarioEntity;
|
||||||
import it.integry.integrywmsnative.core.model.MtbInvent;
|
import it.integry.integrywmsnative.core.model.MtbInvent;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class InventarioMapper extends BaseMapper<MtbInvent, InventarioRoomDTO> {
|
public class InventarioMapper extends BaseMapper<MtbInvent, InventarioEntity> {
|
||||||
|
|
||||||
private final InventarioRowMapper inventarioRowMapper;
|
private final InventarioRowMapper inventarioRowMapper;
|
||||||
|
|
||||||
@@ -15,10 +15,10 @@ public class InventarioMapper extends BaseMapper<MtbInvent, InventarioRoomDTO> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InventarioRoomDTO mapRestToRoom(MtbInvent inputData) {
|
public InventarioEntity mapRestToRoom(MtbInvent inputData) {
|
||||||
if(inputData == null) return null;
|
if(inputData == null) return null;
|
||||||
|
|
||||||
var data = new InventarioRoomDTO();
|
var data = new InventarioEntity();
|
||||||
data.setIdInventario(inputData.getIdInventario());
|
data.setIdInventario(inputData.getIdInventario());
|
||||||
data.setCodMdep(inputData.getCodMdep());
|
data.setCodMdep(inputData.getCodMdep());
|
||||||
data.setDataInventario(inputData.getDataInventario());
|
data.setDataInventario(inputData.getDataInventario());
|
||||||
@@ -42,7 +42,7 @@ public class InventarioMapper extends BaseMapper<MtbInvent, InventarioRoomDTO> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MtbInvent mapRoomToRest(InventarioRoomDTO inputData) {
|
public MtbInvent mapRoomToRest(InventarioEntity inputData) {
|
||||||
if(inputData == null) return null;
|
if(inputData == null) return null;
|
||||||
|
|
||||||
var data = new MtbInvent();
|
var data = new MtbInvent();
|
||||||
|
|||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package it.integry.integrywmsnative.core.mapper;
|
||||||
|
|
||||||
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.entity.VerificaGiacenzeEntity;
|
||||||
|
import it.integry.integrywmsnative.core.rest.model.pv.VerificaGiacenzeDTO;
|
||||||
|
|
||||||
|
@Singleton
|
||||||
|
public class VerificaGiacenzeMapper extends BaseMapper<VerificaGiacenzeDTO, VerificaGiacenzeEntity> {
|
||||||
|
|
||||||
|
private final VerificaGiacenzeRowMapper verificaGiacenzeRowMapper;
|
||||||
|
|
||||||
|
public VerificaGiacenzeMapper(VerificaGiacenzeRowMapper verificaGiacenzeRowMapper) {
|
||||||
|
this.verificaGiacenzeRowMapper = verificaGiacenzeRowMapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VerificaGiacenzeEntity mapRestToRoom(VerificaGiacenzeDTO inputData) {
|
||||||
|
if(inputData == null) return null;
|
||||||
|
|
||||||
|
var data = new VerificaGiacenzeEntity();
|
||||||
|
data.setCodMdep(inputData.getCodMdep());
|
||||||
|
data.setData(inputData.getDataVerifica());
|
||||||
|
|
||||||
|
data.setVerificaGiacenzeRowList(verificaGiacenzeRowMapper.mapRestsToRooms(inputData.getRows()));
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VerificaGiacenzeDTO mapRoomToRest(VerificaGiacenzeEntity inputData) {
|
||||||
|
if(inputData == null) return null;
|
||||||
|
|
||||||
|
var data = new VerificaGiacenzeDTO();
|
||||||
|
data.setCodMdep(inputData.getCodMdep());
|
||||||
|
data.setDataVerifica(inputData.getData());
|
||||||
|
|
||||||
|
data.setRows(verificaGiacenzeRowMapper.mapRoomsToRests(inputData.getVerificaGiacenzeRowList()));
|
||||||
|
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package it.integry.integrywmsnative.core.mapper;
|
||||||
|
|
||||||
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.entity.VerificaGiacenzeRowEntity;
|
||||||
|
import it.integry.integrywmsnative.core.rest.model.pv.VerificaGiacenzeRowDTO;
|
||||||
|
|
||||||
|
@Singleton
|
||||||
|
public class VerificaGiacenzeRowMapper extends BaseMapper<VerificaGiacenzeRowDTO, VerificaGiacenzeRowEntity> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VerificaGiacenzeRowEntity mapRestToRoom(VerificaGiacenzeRowDTO inputData) {
|
||||||
|
if(inputData == null) return null;
|
||||||
|
|
||||||
|
var data = new VerificaGiacenzeRowEntity();
|
||||||
|
data.setCodMart(inputData.getCodMart());
|
||||||
|
data.setPartitaMag(inputData.getPartitaMag());
|
||||||
|
data.setQtaInGiacenza(inputData.getQtaInGiacenza());
|
||||||
|
data.setQta(inputData.getQta());
|
||||||
|
data.setNumConf(inputData.getNumCnf());
|
||||||
|
data.setQtaConf(inputData.getQtaCnf());
|
||||||
|
data.setScanCodBarre(inputData.getBarcode());
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VerificaGiacenzeRowDTO mapRoomToRest(VerificaGiacenzeRowEntity inputData) {
|
||||||
|
if(inputData == null) return null;
|
||||||
|
|
||||||
|
var data = new VerificaGiacenzeRowDTO();
|
||||||
|
data.setCodMart(inputData.getCodMart());
|
||||||
|
data.setPartitaMag(inputData.getPartitaMag());
|
||||||
|
data.setQtaInGiacenza(inputData.getQtaInGiacenza());
|
||||||
|
data.setQta(inputData.getQta());
|
||||||
|
data.setNumCnf(inputData.getNumConf());
|
||||||
|
data.setQtaCnf(inputData.getQtaConf());
|
||||||
|
data.setBarcode(inputData.getScanCodBarre());
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,17 +1,10 @@
|
|||||||
package it.integry.integrywmsnative.core.menu;
|
package it.integry.integrywmsnative.core.menu;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
|
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
|
||||||
import it.integry.integrywmsnative.core.model.StbMenu;
|
import it.integry.integrywmsnative.core.model.StbMenu;
|
||||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers._BaseRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers._BaseRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
|
|
||||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
|
||||||
import retrofit2.Call;
|
|
||||||
import retrofit2.Response;
|
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class MenuRESTConsumer extends _BaseRESTConsumer {
|
public class MenuRESTConsumer extends _BaseRESTConsumer {
|
||||||
@@ -22,19 +15,12 @@ public class MenuRESTConsumer extends _BaseRESTConsumer {
|
|||||||
this.restBuilder = restBuilder;
|
this.restBuilder = restBuilder;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void retrieveMenu(String rootCodOpz, RunnableArgs<StbMenu> onComplete, RunnableArgs<Exception> onFailed) {
|
public StbMenu retrieveMenuSynchronized(String rootCodOpz) throws Exception {
|
||||||
MenuRESTConsumerService menuRESTConsumerService = restBuilder.getService(MenuRESTConsumerService.class);
|
MenuRESTConsumerService menuRESTConsumerService = restBuilder.getService(MenuRESTConsumerService.class);
|
||||||
menuRESTConsumerService.retrieveMenuConfig(rootCodOpz).enqueue(new ManagedErrorCallback<>() {
|
var response = menuRESTConsumerService.retrieveMenuConfig(rootCodOpz)
|
||||||
@Override
|
.execute();
|
||||||
public void onResponse(Call<ServiceRESTResponse<StbMenu>> call, Response<ServiceRESTResponse<StbMenu>> response) {
|
|
||||||
analyzeAnswer(response, "retrieveMenu", onComplete, onFailed);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
return analyzeAnswer(response, "retrieveMenu");
|
||||||
public void onFailure(Call<ServiceRESTResponse<StbMenu>> call, @NonNull final Exception e) {
|
|
||||||
onFailed.run(e);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import javax.inject.Singleton;
|
|||||||
|
|
||||||
import it.integry.integrywmsnative.core.class_router.configs.BaseMenuConfiguration;
|
import it.integry.integrywmsnative.core.class_router.configs.BaseMenuConfiguration;
|
||||||
import it.integry.integrywmsnative.core.class_router.configs.MenuConfiguration;
|
import it.integry.integrywmsnative.core.class_router.configs.MenuConfiguration;
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
|
||||||
import it.integry.integrywmsnative.core.menu.exception.MenuNotFoundException;
|
import it.integry.integrywmsnative.core.menu.exception.MenuNotFoundException;
|
||||||
import it.integry.integrywmsnative.core.model.StbMenu;
|
import it.integry.integrywmsnative.core.model.StbMenu;
|
||||||
|
|
||||||
@@ -29,16 +28,14 @@ public class MenuService {
|
|||||||
this.menuRESTConsumer = menuRESTConsumer;
|
this.menuRESTConsumer = menuRESTConsumer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init(Runnable onMenuInitialized, RunnableArgs<Exception> onFailed) {
|
public void init() throws Exception {
|
||||||
menuRESTConsumer.retrieveMenu(MENU_COD_OPZ, menu -> {
|
var menu = menuRESTConsumer.retrieveMenuSynchronized(MENU_COD_OPZ);
|
||||||
|
|
||||||
if (menu != null) {
|
if (menu != null) {
|
||||||
this.mInternalCachedMenu = menu.getStbMenuChildren();
|
this.mInternalCachedMenu = menu.getStbMenuChildren();
|
||||||
this.mInternalCachedFlatMenu = new ArrayList<>();
|
this.mInternalCachedFlatMenu = new ArrayList<>();
|
||||||
flattenMenu(this.mInternalCachedMenu);
|
flattenMenu(this.mInternalCachedMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
onMenuInitialized.run();
|
|
||||||
}, onFailed);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<StbMenu> getMenu() throws Exception {
|
public List<StbMenu> getMenu() throws Exception {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package it.integry.integrywmsnative.core.model;
|
package it.integry.integrywmsnative.core.model;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||||
@@ -108,6 +109,104 @@ public class MtbAart extends EntityBase {
|
|||||||
this.type = "mtb_aart";
|
this.type = "mtb_aart";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MtbAart(MtbAart other) {
|
||||||
|
this();
|
||||||
|
|
||||||
|
this.codMart = other.codMart;
|
||||||
|
this.descrizione = other.descrizione;
|
||||||
|
this.untMis = other.untMis;
|
||||||
|
this.barCode = other.barCode;
|
||||||
|
this.pesoKg = other.pesoKg; // BigDecimal è immutabile
|
||||||
|
this.qtaCnf = other.qtaCnf;
|
||||||
|
this.codAliq = other.codAliq;
|
||||||
|
this.codScoArt = other.codScoArt;
|
||||||
|
this.codTcolUi = other.codTcolUi;
|
||||||
|
this.codTcolUl = other.codTcolUl;
|
||||||
|
this.articoloComposto = other.articoloComposto;
|
||||||
|
this.esposizioneComp = other.esposizioneComp;
|
||||||
|
this.descrizioneEstesa = other.descrizioneEstesa;
|
||||||
|
this.codUltForn = other.codUltForn;
|
||||||
|
this.dataUltCar = other.dataUltCar;
|
||||||
|
this.valUltCar = other.valUltCar;
|
||||||
|
this.codUltClie = other.codUltClie;
|
||||||
|
this.dataUltScar = other.dataUltScar;
|
||||||
|
this.valUltScar = other.valUltScar;
|
||||||
|
this.tipoCodice = other.tipoCodice;
|
||||||
|
this.note = other.note;
|
||||||
|
this.posizione = other.posizione;
|
||||||
|
this.colliPedana = other.colliPedana;
|
||||||
|
this.untMis2 = other.untMis2;
|
||||||
|
this.rapConv2 = other.rapConv2;
|
||||||
|
this.flagInclListino = other.flagInclListino;
|
||||||
|
this.untMis3 = other.untMis3;
|
||||||
|
this.rapConv3 = other.rapConv3;
|
||||||
|
this.codMartStat = other.codMartStat;
|
||||||
|
this.codMcon = other.codMcon;
|
||||||
|
this.codMgrp = other.codMgrp;
|
||||||
|
this.codMsfa = other.codMsfa;
|
||||||
|
this.codMsgr = other.codMsgr;
|
||||||
|
this.codMstp = other.codMstp;
|
||||||
|
this.codMtip = other.codMtip;
|
||||||
|
this.descrizioneStat = other.descrizioneStat;
|
||||||
|
this.flagStato = other.flagStato;
|
||||||
|
this.cambioDiviCar = other.cambioDiviCar;
|
||||||
|
this.cambioDiviScar = other.cambioDiviScar;
|
||||||
|
this.ggScadPartita = other.ggScadPartita;
|
||||||
|
this.volumeMc = other.volumeMc;
|
||||||
|
this.flagEsponiPrz = other.flagEsponiPrz;
|
||||||
|
this.dataUltVar = other.dataUltVar;
|
||||||
|
this.percSfrido = other.percSfrido;
|
||||||
|
this.codBarreImb = other.codBarreImb;
|
||||||
|
this.flagCalcPrz = other.flagCalcPrz;
|
||||||
|
this.esposizioneCompAcq = other.esposizioneCompAcq;
|
||||||
|
this.flagCalcPrzAcq = other.flagCalcPrzAcq;
|
||||||
|
this.diacod = other.diacod;
|
||||||
|
this.plu = other.plu;
|
||||||
|
this.partIvaProd = other.partIvaProd;
|
||||||
|
this.ragSocProd = other.ragSocProd;
|
||||||
|
this.flagRapConvVariabile = other.flagRapConvVariabile;
|
||||||
|
this.flagMovArtMag = other.flagMovArtMag;
|
||||||
|
this.flagTracciabilita = other.flagTracciabilita;
|
||||||
|
this.taraKg = other.taraKg;
|
||||||
|
this.colliStrato = other.colliStrato;
|
||||||
|
this.flagQtaCnfFissa = other.flagQtaCnfFissa;
|
||||||
|
this.flagColliPedanaFisso = other.flagColliPedanaFisso;
|
||||||
|
this.codCconCosti = other.codCconCosti;
|
||||||
|
this.codCconRicavi = other.codCconRicavi;
|
||||||
|
this.codDgrpArt = other.codDgrpArt;
|
||||||
|
this.codDiviCar = other.codDiviCar;
|
||||||
|
this.codDiviScar = other.codDiviScar;
|
||||||
|
this.codEcrCat = other.codEcrCat;
|
||||||
|
this.codEcrMcat = other.codEcrMcat;
|
||||||
|
this.codEcrRep = other.codEcrRep;
|
||||||
|
this.codEcrStipo = other.codEcrStipo;
|
||||||
|
this.codEcrTipo = other.codEcrTipo;
|
||||||
|
this.codGrpBolla = other.codGrpBolla;
|
||||||
|
this.ingredienti = other.ingredienti;
|
||||||
|
this.idArtEqui = other.idArtEqui;
|
||||||
|
this.descrCassa = other.descrCassa;
|
||||||
|
this.codNcIntracee = other.codNcIntracee;
|
||||||
|
this.marchio = other.marchio;
|
||||||
|
this.sezione = other.sezione;
|
||||||
|
this.untMisRifPeso = other.untMisRifPeso; // Enum è immutabile
|
||||||
|
|
||||||
|
this.qtaEsistente = other.qtaEsistente;
|
||||||
|
this.qtaImpegnata = other.qtaImpegnata;
|
||||||
|
this.numCnfEsistente = other.numCnfEsistente;
|
||||||
|
this.numCnfImpegnata = other.numCnfImpegnata;
|
||||||
|
|
||||||
|
// Deep copy della lista
|
||||||
|
if (other.mtbUntMis != null) {
|
||||||
|
this.mtbUntMis = new ArrayList<>();
|
||||||
|
for (MtbUntMis untMis : other.mtbUntMis) {
|
||||||
|
this.mtbUntMis.add(new MtbUntMis(untMis)); // Assicurati che MtbUntMis abbia un costruttore di copia
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public boolean isFlagTracciabilitaBoolean() {
|
public boolean isFlagTracciabilitaBoolean() {
|
||||||
return flagTracciabilita != null && flagTracciabilita.equalsIgnoreCase("S");
|
return flagTracciabilita != null && flagTracciabilita.equalsIgnoreCase("S");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,6 +67,58 @@ public class MtbColr extends EntityBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MtbColr(MtbColr other) {
|
||||||
|
this();
|
||||||
|
|
||||||
|
this.gestione = other.gestione;
|
||||||
|
this.serCollo = other.serCollo;
|
||||||
|
this.numCollo = other.numCollo;
|
||||||
|
this.dataCollo = other.dataCollo;
|
||||||
|
this.riga = other.riga;
|
||||||
|
this.rigaOrd = other.rigaOrd;
|
||||||
|
this.codMart = other.codMart;
|
||||||
|
this.codBarre = other.codBarre;
|
||||||
|
this.codCol = other.codCol;
|
||||||
|
this.codTagl = other.codTagl;
|
||||||
|
this.partitaMag = other.partitaMag;
|
||||||
|
this.gestioneRif = other.gestioneRif;
|
||||||
|
this.serColloRif = other.serColloRif;
|
||||||
|
this.note = other.note;
|
||||||
|
this.dataOrd = other.dataOrd; // LocalDate è immutabile
|
||||||
|
this.dataColloRif = other.dataColloRif;
|
||||||
|
this.qtaCnf = other.qtaCnf; // BigDecimal è immutabile
|
||||||
|
this.qtaCol = other.qtaCol;
|
||||||
|
this.numOrd = other.numOrd;
|
||||||
|
this.numEtich = other.numEtich;
|
||||||
|
this.numColloRif = other.numColloRif;
|
||||||
|
this.datetimeRow = other.datetimeRow;
|
||||||
|
this.codJcom = other.codJcom;
|
||||||
|
this.numCnf = other.numCnf;
|
||||||
|
this.insPartitaMag = other.insPartitaMag;
|
||||||
|
this.mtbPartitaMag_descrizione = other.mtbPartitaMag_descrizione;
|
||||||
|
this.dataScadPartita = other.dataScadPartita;
|
||||||
|
this.descrizione = other.descrizione;
|
||||||
|
this.untMis = other.untMis;
|
||||||
|
this.causale = other.causale;
|
||||||
|
this.utente = other.utente;
|
||||||
|
this.codAnagDoc = other.codAnagDoc;
|
||||||
|
this.codDtipDoc = other.codDtipDoc;
|
||||||
|
this.dataDoc = other.dataDoc;
|
||||||
|
this.serDoc = other.serDoc;
|
||||||
|
this.numDoc = other.numDoc;
|
||||||
|
this.idRigaDoc = other.idRigaDoc;
|
||||||
|
this.pesoNettoKg = other.pesoNettoKg;
|
||||||
|
this.pesoLordoKg = other.pesoLordoKg;
|
||||||
|
|
||||||
|
// Deep copy degli oggetti complessi
|
||||||
|
this.mtbAart = other.mtbAart != null ? new MtbAart(other.mtbAart) : null;
|
||||||
|
this.mtbPartitaMag = other.mtbPartitaMag != null ? new MtbPartitaMag(other.mtbPartitaMag) : null;
|
||||||
|
|
||||||
|
// Non copiamo i campi transient
|
||||||
|
// this.id = other.id;
|
||||||
|
// this.refMtbColr = other.refMtbColr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static class Causale {
|
public static class Causale {
|
||||||
public static final int DEFAULT = 0;
|
public static final int DEFAULT = 0;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package it.integry.integrywmsnative.core.model;
|
|||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
|
||||||
import androidx.databinding.ObservableArrayList;
|
import androidx.databinding.ObservableArrayList;
|
||||||
import androidx.databinding.ObservableField;
|
import androidx.lifecycle.MutableLiveData;
|
||||||
|
|
||||||
import com.annimon.stream.Optional;
|
import com.annimon.stream.Optional;
|
||||||
import com.annimon.stream.Stream;
|
import com.annimon.stream.Stream;
|
||||||
@@ -66,7 +66,7 @@ public class MtbColt extends EntityBase {
|
|||||||
private BigDecimal altezzaCm;
|
private BigDecimal altezzaCm;
|
||||||
private String codJcom;
|
private String codJcom;
|
||||||
|
|
||||||
private final ObservableField<ObservableMtbTcol> mtbTCol = new ObservableField<>();
|
private final transient MutableLiveData<ObservableMtbTcol> mtbTCol = new MutableLiveData<>();
|
||||||
|
|
||||||
private Boolean disablePrint;
|
private Boolean disablePrint;
|
||||||
private String ragSocCliente;
|
private String ragSocCliente;
|
||||||
@@ -545,15 +545,15 @@ public class MtbColt extends EntityBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ObservableMtbTcol getMtbTCol() {
|
public ObservableMtbTcol getMtbTCol() {
|
||||||
return mtbTCol.get();
|
return mtbTCol.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
public MtbColt setMtbTCol(ObservableMtbTcol mtbTCol) {
|
public MtbColt setMtbTCol(ObservableMtbTcol mtbTCol) {
|
||||||
this.mtbTCol.set(mtbTCol);
|
this.mtbTCol.postValue(mtbTCol);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ObservableField<ObservableMtbTcol> mtbTcolProperty() {
|
public MutableLiveData<ObservableMtbTcol> mtbTcolProperty() {
|
||||||
return mtbTCol;
|
return mtbTCol;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -631,8 +631,20 @@ public class MtbColt extends EntityBase {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EntityBase clone() {
|
public EntityBase clone() {
|
||||||
|
return clone(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MtbColt clone(boolean withMtbColr) {
|
||||||
MtbColt mtbColt = (MtbColt) super.clone();
|
MtbColt mtbColt = (MtbColt) super.clone();
|
||||||
mtbColt.setMtbColr((ObservableArrayList<MtbColr>) mtbColt.getMtbColr().clone());
|
mtbColt.setMtbColr(new ObservableArrayList<>());
|
||||||
|
|
||||||
|
if(!withMtbColr) return mtbColt;
|
||||||
|
|
||||||
|
this.getMtbColr().stream()
|
||||||
|
.map(MtbColr::new) //Genera un clone
|
||||||
|
.forEach(mtbColr -> {
|
||||||
|
mtbColt.getMtbColr().add(mtbColr);
|
||||||
|
});
|
||||||
return mtbColt;
|
return mtbColt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import android.os.Parcelable;
|
|||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
public class MtbDepo extends EntityBase implements Parcelable {
|
public class MtbDepo extends EntityBase {
|
||||||
|
|
||||||
|
|
||||||
private String codMdep;
|
private String codMdep;
|
||||||
@@ -41,79 +41,6 @@ public class MtbDepo extends EntityBase implements Parcelable {
|
|||||||
type = "mtb_depo";
|
type = "mtb_depo";
|
||||||
}
|
}
|
||||||
|
|
||||||
protected MtbDepo(Parcel in) {
|
|
||||||
codMdep = in.readString();
|
|
||||||
descrizione = in.readString();
|
|
||||||
flagVal = in.readString();
|
|
||||||
codAnag = in.readString();
|
|
||||||
indirizzo = in.readString();
|
|
||||||
cap = in.readString();
|
|
||||||
citta = in.readString();
|
|
||||||
prov = in.readString();
|
|
||||||
tel = in.readString();
|
|
||||||
nazione = in.readString();
|
|
||||||
fax = in.readString();
|
|
||||||
eMail = in.readString();
|
|
||||||
sitoWeb = in.readString();
|
|
||||||
codVdes = in.readString();
|
|
||||||
serie = in.readString();
|
|
||||||
flagMovimentabile = in.readString();
|
|
||||||
codJfas = in.readString();
|
|
||||||
codVlis = in.readString();
|
|
||||||
codCcau = in.readString();
|
|
||||||
codCcon = in.readString();
|
|
||||||
codDtip = in.readString();
|
|
||||||
codDtipFat = in.readString();
|
|
||||||
flagContoVendita = in.readString();
|
|
||||||
flagTipoNegozio = in.readString();
|
|
||||||
codMdepReso = in.readString();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
|
||||||
dest.writeString(codMdep);
|
|
||||||
dest.writeString(descrizione);
|
|
||||||
dest.writeString(flagVal);
|
|
||||||
dest.writeString(codAnag);
|
|
||||||
dest.writeString(indirizzo);
|
|
||||||
dest.writeString(cap);
|
|
||||||
dest.writeString(citta);
|
|
||||||
dest.writeString(prov);
|
|
||||||
dest.writeString(tel);
|
|
||||||
dest.writeString(nazione);
|
|
||||||
dest.writeString(fax);
|
|
||||||
dest.writeString(eMail);
|
|
||||||
dest.writeString(sitoWeb);
|
|
||||||
dest.writeString(codVdes);
|
|
||||||
dest.writeString(serie);
|
|
||||||
dest.writeString(flagMovimentabile);
|
|
||||||
dest.writeString(codJfas);
|
|
||||||
dest.writeString(codVlis);
|
|
||||||
dest.writeString(codCcau);
|
|
||||||
dest.writeString(codCcon);
|
|
||||||
dest.writeString(codDtip);
|
|
||||||
dest.writeString(codDtipFat);
|
|
||||||
dest.writeString(flagContoVendita);
|
|
||||||
dest.writeString(flagTipoNegozio);
|
|
||||||
dest.writeString(codMdepReso);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int describeContents() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final Creator<MtbDepo> CREATOR = new Creator<>() {
|
|
||||||
@Override
|
|
||||||
public MtbDepo createFromParcel(Parcel in) {
|
|
||||||
return new MtbDepo(in);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public MtbDepo[] newArray(int size) {
|
|
||||||
return new MtbDepo[size];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
public String getCodMdep() {
|
public String getCodMdep() {
|
||||||
return codMdep;
|
return codMdep;
|
||||||
|
|||||||
@@ -32,6 +32,32 @@ public class MtbPartitaMag extends EntityBase{
|
|||||||
public MtbPartitaMag() {
|
public MtbPartitaMag() {
|
||||||
this.type = "mtb_partita_mag";
|
this.type = "mtb_partita_mag";
|
||||||
}
|
}
|
||||||
|
public MtbPartitaMag(MtbPartitaMag other) {
|
||||||
|
this();
|
||||||
|
|
||||||
|
this.codMart = other.codMart;
|
||||||
|
this.partitaMag = other.partitaMag;
|
||||||
|
this.descrizione = other.descrizione;
|
||||||
|
this.dataIns = other.dataIns; // LocalDateTime è immutabile
|
||||||
|
this.dataScad = other.dataScad; // LocalDate è immutabile
|
||||||
|
this.scelta = other.scelta;
|
||||||
|
this.costoUntUmMag = other.costoUntUmMag; // BigDecimal è immutabile
|
||||||
|
this.valUntUmMag = other.valUntUmMag;
|
||||||
|
this.taraCnfKg = other.taraCnfKg;
|
||||||
|
this.qtaCnf = other.qtaCnf;
|
||||||
|
this.flagImballoArendere = other.flagImballoArendere;
|
||||||
|
this.flagStato = other.flagStato;
|
||||||
|
this.codDiviCont = other.codDiviCont;
|
||||||
|
this.cambioDiviCont = other.cambioDiviCont;
|
||||||
|
this.barcode = other.barcode;
|
||||||
|
this.note = other.note;
|
||||||
|
this.rapConv2 = other.rapConv2;
|
||||||
|
this.rapConv3 = other.rapConv3;
|
||||||
|
this.posizione = other.posizione;
|
||||||
|
this.dataAggPrz = other.dataAggPrz;
|
||||||
|
this.partitaMagSec = other.partitaMagSec;
|
||||||
|
this.qtaAttesa = other.qtaAttesa;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getCodMart() {
|
public String getCodMart() {
|
||||||
|
|||||||
@@ -15,6 +15,18 @@ public class MtbUntMis extends EntityBase {
|
|||||||
this.type = "mtb_unt_mis";
|
this.type = "mtb_unt_mis";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Costruttore di copia
|
||||||
|
public MtbUntMis(MtbUntMis other) {
|
||||||
|
this();
|
||||||
|
|
||||||
|
this.untMis = other.untMis;
|
||||||
|
this.flagDig = other.flagDig;
|
||||||
|
this.cifreDec = other.cifreDec; // BigDecimal è immutabile
|
||||||
|
this.tipoUm = other.tipoUm;
|
||||||
|
this.flagUnitaKg = other.flagUnitaKg;
|
||||||
|
this.flagAttivo = other.flagAttivo;
|
||||||
|
}
|
||||||
|
|
||||||
public String getUntMis() {
|
public String getUntMis() {
|
||||||
return untMis;
|
return untMis;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ public class HttpInterceptor implements Interceptor {
|
|||||||
|
|
||||||
//Nel caso in cui il token è scaduto e devo richiamare la refresh non bisogna passare il vecchio token
|
//Nel caso in cui il token è scaduto e devo richiamare la refresh non bisogna passare il vecchio token
|
||||||
if(SettingsManager.i().getUserSession().getAccessTokenExpiryDate() != null &&
|
if(SettingsManager.i().getUserSession().getAccessTokenExpiryDate() != null &&
|
||||||
UtilityDate.getNowTime().isBefore(SettingsManager.i().getUserSession().getAccessTokenExpiryDate())) {
|
UtilityDate.getNowTime().isBefore(SettingsManager.i().getUserSession().getAccessTokenExpiryDate().minusSeconds(20))) {
|
||||||
accessToken = SettingsManager.i().getUserSession().getAccessToken();
|
accessToken = SettingsManager.i().getUserSession().getAccessToken();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -52,9 +52,12 @@ public class RESTBuilder {
|
|||||||
public <T> T getService(final Class<T> service, String protocol, String host, int port, boolean addInterceptors, boolean addEmsApi, int timeout) {
|
public <T> T getService(final Class<T> service, String protocol, String host, int port, boolean addInterceptors, boolean addEmsApi, int timeout) {
|
||||||
OkHttpClient.Builder clientBuilder = getDefaultHttpClient();
|
OkHttpClient.Builder clientBuilder = getDefaultHttpClient();
|
||||||
|
|
||||||
|
timeout = 0;
|
||||||
|
|
||||||
clientBuilder.connectTimeout(timeout, TimeUnit.SECONDS);
|
clientBuilder.connectTimeout(timeout, TimeUnit.SECONDS);
|
||||||
clientBuilder.readTimeout(timeout, TimeUnit.SECONDS);
|
clientBuilder.readTimeout(timeout, TimeUnit.SECONDS);
|
||||||
clientBuilder.writeTimeout(timeout, TimeUnit.SECONDS);
|
clientBuilder.writeTimeout(timeout, TimeUnit.SECONDS);
|
||||||
|
clientBuilder.callTimeout(timeout, TimeUnit.SECONDS);
|
||||||
|
|
||||||
clientBuilder.retryOnConnectionFailure(true);
|
clientBuilder.retryOnConnectionFailure(true);
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,9 @@ import java.util.ArrayList;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
@@ -26,7 +29,6 @@ import it.integry.integrywmsnative.core.rest.model.articolo.RetrieveArticoloByCo
|
|||||||
import it.integry.integrywmsnative.core.rest.model.articolo.SaveArticoloRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.articolo.SaveArticoloRequestDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.articolo.SaveArticoloResponseDTO;
|
import it.integry.integrywmsnative.core.rest.model.articolo.SaveArticoloResponseDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.articolo.SearchArticoloByBarcodeRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.articolo.SearchArticoloByBarcodeRequestDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.articolo.SearchArticoloByBarcodeResponseDTO;
|
|
||||||
import it.integry.integrywmsnative.core.rest.model.articolo.UpdateBarcodeImballoRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.articolo.UpdateBarcodeImballoRequestDTO;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityQuery;
|
import it.integry.integrywmsnative.core.utility.UtilityQuery;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
@@ -36,10 +38,12 @@ import retrofit2.Response;
|
|||||||
public class ArticoloRESTConsumer extends _BaseRESTConsumer {
|
public class ArticoloRESTConsumer extends _BaseRESTConsumer {
|
||||||
|
|
||||||
private final RESTBuilder restBuilder;
|
private final RESTBuilder restBuilder;
|
||||||
|
private final ExecutorService executorService;
|
||||||
private final SystemRESTConsumer systemRESTConsumer;
|
private final SystemRESTConsumer systemRESTConsumer;
|
||||||
|
|
||||||
public ArticoloRESTConsumer(RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer) {
|
public ArticoloRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService, SystemRESTConsumer systemRESTConsumer) {
|
||||||
this.restBuilder = restBuilder;
|
this.restBuilder = restBuilder;
|
||||||
|
this.executorService = executorService;
|
||||||
this.systemRESTConsumer = systemRESTConsumer;
|
this.systemRESTConsumer = systemRESTConsumer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,26 +82,28 @@ public class ArticoloRESTConsumer extends _BaseRESTConsumer {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void searchByBarcode(String barcodeProd, RunnableArgs<List<MtbAart>> onComplete, RunnableArgs<Exception> onFailed) {
|
public List<MtbAart> searchByBarcodeSynchronized(String barcodeProd) throws Exception {
|
||||||
ArticoloRESTConsumerService articoloRESTConsumerService = restBuilder.getService(ArticoloRESTConsumerService.class);
|
ArticoloRESTConsumerService articoloRESTConsumerService = restBuilder.getService(ArticoloRESTConsumerService.class);
|
||||||
|
|
||||||
var request = new SearchArticoloByBarcodeRequestDTO()
|
var request = new SearchArticoloByBarcodeRequestDTO()
|
||||||
.setBarcode(barcodeProd)
|
.setBarcode(barcodeProd)
|
||||||
.setOnlyActive(true);
|
.setOnlyActive(true);
|
||||||
|
|
||||||
articoloRESTConsumerService
|
var response = articoloRESTConsumerService
|
||||||
.searchByBarcode(request)
|
.searchByBarcode(request)
|
||||||
.enqueue(new ManagedErrorCallback<>() {
|
.execute();
|
||||||
@Override
|
|
||||||
public void onResponse(Call<ServiceRESTResponse<SearchArticoloByBarcodeResponseDTO>> call, Response<ServiceRESTResponse<SearchArticoloByBarcodeResponseDTO>> response) {
|
analyzeAnswer(response, "searchByBarcode");
|
||||||
analyzeAnswer(response, "searchByBarcode", (m) -> {
|
return response.body().getDto().getArts();
|
||||||
onComplete.run(response.body().getDto().getArts());
|
|
||||||
}, onFailed);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public void searchByBarcode(String barcodeProd, RunnableArgs<List<MtbAart>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
public void onFailure(Call<ServiceRESTResponse<SearchArticoloByBarcodeResponseDTO>> call, @NonNull final Exception e) {
|
executorService.execute(() -> {
|
||||||
onFailed.run(e);
|
try {
|
||||||
|
var mtbAarts = searchByBarcodeSynchronized(barcodeProd);
|
||||||
|
if (onComplete != null) onComplete.run(mtbAarts);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
if (onFailed != null) onFailed.run(ex);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -122,45 +128,47 @@ public class ArticoloRESTConsumer extends _BaseRESTConsumer {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getByCodMarts(List<String> codMartToFind, RunnableArgs<List<MtbAart>> onComplete, RunnableArgs<Exception> onFailed) {
|
public List<MtbAart> getByCodMartsSynchronized(List<String> codMartToFind) throws Exception {
|
||||||
var codMarts = Stream.of(codMartToFind)
|
var codMarts = codMartToFind.parallelStream()
|
||||||
.withoutNulls()
|
.filter(Objects::nonNull)
|
||||||
.distinct().toList();
|
.distinct()
|
||||||
|
.collect(Collectors.toUnmodifiableList());
|
||||||
|
|
||||||
ArticoloRESTConsumerService articoloRESTConsumer = restBuilder.getService(ArticoloRESTConsumerService.class);
|
ArticoloRESTConsumerService articoloRESTConsumer = restBuilder.getService(ArticoloRESTConsumerService.class);
|
||||||
articoloRESTConsumer
|
var response = articoloRESTConsumer
|
||||||
.getByCodMart(new RetrieveArticoloByCodMartRequestDTO()
|
.getByCodMart(new RetrieveArticoloByCodMartRequestDTO()
|
||||||
.setCodMarts(codMarts))
|
.setCodMarts(codMarts))
|
||||||
.enqueue(new ManagedErrorCallback<>() {
|
.execute();
|
||||||
@Override
|
return analyzeAnswer(response, "getByCodMart");
|
||||||
public void onResponse(Call<ServiceRESTResponse<List<MtbAart>>> call, Response<ServiceRESTResponse<List<MtbAart>>> response) {
|
|
||||||
analyzeAnswer(response, "getByCodMart", onComplete, onFailed);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public void getByCodMarts(List<String> codMartToFind, RunnableArgs<List<MtbAart>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
public void onFailure(Call<ServiceRESTResponse<List<MtbAart>>> call, @NonNull final Exception e) {
|
executorService.execute(() -> {
|
||||||
onFailed.run(e);
|
try {
|
||||||
|
var mtbAarts = getByCodMartsSynchronized(codMartToFind);
|
||||||
|
if (onComplete != null) onComplete.run(mtbAarts);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
if (onFailed != null) onFailed.run(ex);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<StatoArticoloDTO> getStatoPartitaSynchronized(String codMart, String partitaMag) throws Exception {
|
||||||
|
ArticoloRESTConsumerService articoloRESTConsumer = restBuilder.getService(ArticoloRESTConsumerService.class);
|
||||||
|
var response = articoloRESTConsumer.getStatoPartita(codMart, partitaMag).execute();
|
||||||
|
|
||||||
|
var data = analyzeAnswer(response, "getStatoPartita");
|
||||||
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getStatoPartita(String codMart, String partitaMag, RunnableArgs<List<StatoArticoloDTO>> onComplete, RunnableArgs<Exception> onFailed) {
|
public void getStatoPartita(String codMart, String partitaMag, RunnableArgs<List<StatoArticoloDTO>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
|
executorService.execute(() -> {
|
||||||
ArticoloRESTConsumerService articoloRESTConsumer = restBuilder.getService(ArticoloRESTConsumerService.class);
|
try {
|
||||||
articoloRESTConsumer.getStatoPartita(codMart, partitaMag).enqueue(new ManagedErrorCallback<>() {
|
var response = getStatoPartitaSynchronized(codMart, partitaMag);
|
||||||
@Override
|
if (onComplete != null) onComplete.run(response);
|
||||||
public void onResponse(Call<ServiceRESTResponse<List<StatoArticoloDTO>>> call, Response<ServiceRESTResponse<List<StatoArticoloDTO>>> response) {
|
} catch (Exception ex) {
|
||||||
analyzeAnswer(response, "getStatoPartita", onComplete, onFailed);
|
if (onFailed != null) onFailed.run(ex);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(Call<ServiceRESTResponse<List<StatoArticoloDTO>>> call, @NonNull final Exception e) {
|
|
||||||
onFailed.run(e);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -172,7 +180,7 @@ public class ArticoloRESTConsumer extends _BaseRESTConsumer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void getArtsGroups(List<String> groupsToFind, RunnableArgs<List<MtbGrup>> onComplete, RunnableArgs<Exception> onFailed) {
|
public List<MtbGrup> getArtsGroupsSynchronized(List<String> groupsToFind) throws Exception {
|
||||||
var whereCondMap = Stream.of(groupsToFind)
|
var whereCondMap = Stream.of(groupsToFind)
|
||||||
.map(x -> {
|
.map(x -> {
|
||||||
HashMap<String, Object> vars = new HashMap<>();
|
HashMap<String, Object> vars = new HashMap<>();
|
||||||
@@ -186,29 +194,41 @@ public class ArticoloRESTConsumer extends _BaseRESTConsumer {
|
|||||||
Type typeOfObjectsList = new TypeToken<ArrayList<MtbGrup>>() {
|
Type typeOfObjectsList = new TypeToken<ArrayList<MtbGrup>>() {
|
||||||
}.getType();
|
}.getType();
|
||||||
|
|
||||||
this.systemRESTConsumer.processSql("SELECT * FROM mtb_grup " + whereCond, typeOfObjectsList, onComplete, onFailed);
|
return this.systemRESTConsumer.processSqlSynchronized("SELECT * FROM mtb_grup " + whereCond, typeOfObjectsList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void getArtsGroups(List<String> groupsToFind, RunnableArgs<List<MtbGrup>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
|
executorService.execute(() -> {
|
||||||
|
try {
|
||||||
|
var data = getArtsGroupsSynchronized(groupsToFind);
|
||||||
|
if (onComplete != null) onComplete.run(data);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
if (onFailed != null) onFailed.run(ex);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void getUntMisArts(List<String> inputUntMis, RunnableArgs<List<MtbUntMis>> onComplete, RunnableArgs<Exception> onFailed) {
|
public List<MtbUntMis> getUntMisArtsSynchronized(List<String> inputUntMis) throws Exception {
|
||||||
List<HashMap<String, Object>> whereCondList = Stream.of(inputUntMis)
|
List<HashMap<String, Object>> whereCondList = inputUntMis.parallelStream()
|
||||||
.distinct()
|
.distinct()
|
||||||
.withoutNulls()
|
.filter(Objects::nonNull)
|
||||||
.map(x -> {
|
.map(x -> {
|
||||||
HashMap<String, Object> data = new HashMap<>();
|
HashMap<String, Object> data = new HashMap<>();
|
||||||
data.put("unt_mis", x);
|
data.put("unt_mis", x);
|
||||||
return data;
|
return data;
|
||||||
})
|
})
|
||||||
.toList();
|
.collect(Collectors.toUnmodifiableList());
|
||||||
|
|
||||||
var whereCond = whereCondList.isEmpty() ? "" : " WHERE " + UtilityQuery.concatFieldListInWhereCond(whereCondList);
|
var whereCond = whereCondList.isEmpty() ? "" : " WHERE " + UtilityQuery.concatFieldListInWhereCond(whereCondList);
|
||||||
|
|
||||||
Type typeOfObjectsList = new TypeToken<ArrayList<MtbUntMis>>() {
|
Type typeOfObjectsList = new TypeToken<ArrayList<MtbUntMis>>() {
|
||||||
}.getType();
|
}.getType();
|
||||||
this.systemRESTConsumer.processSql("SELECT * FROM mtb_unt_mis " + whereCond, typeOfObjectsList, onComplete, onFailed);
|
|
||||||
|
return this.systemRESTConsumer.processSqlSynchronized("SELECT * FROM mtb_unt_mis " + whereCond, typeOfObjectsList);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void fillMtbAartsWithMtbUntMis(List<MtbAart> inputMtbAart, RunnableArgs<List<MtbAart>> onComplete, RunnableArgs<Exception> onFailed) {
|
public List<MtbAart> fillMtbAartsWithMtbUntMisSynchronized(List<MtbAart> inputMtbAart) throws Exception {
|
||||||
var inputUntMis = new ArrayList<String>();
|
var inputUntMis = new ArrayList<String>();
|
||||||
|
|
||||||
if (inputMtbAart != null && !inputMtbAart.isEmpty()) {
|
if (inputMtbAart != null && !inputMtbAart.isEmpty()) {
|
||||||
@@ -220,21 +240,23 @@ public class ArticoloRESTConsumer extends _BaseRESTConsumer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (inputUntMis.isEmpty()) {
|
if (inputUntMis.isEmpty()) {
|
||||||
onComplete.run(inputMtbAart);
|
return inputMtbAart;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getUntMisArts(inputUntMis, mtbUntMiss -> {
|
var mtbUntMiss = getUntMisArtsSynchronized(inputUntMis);
|
||||||
|
|
||||||
for (var item : inputMtbAart) {
|
for (var item : inputMtbAart) {
|
||||||
var mtbUntMis = Stream.of(mtbUntMiss).filter(x -> x.getUntMis().equalsIgnoreCase(item.getUntMis()))
|
var mtbUntMis = mtbUntMiss.stream()
|
||||||
.findFirstOrElse(null);
|
.filter(x -> x.getUntMis().equalsIgnoreCase(item.getUntMis()))
|
||||||
|
.findFirst()
|
||||||
|
.orElse(null);
|
||||||
|
|
||||||
if (mtbUntMis != null)
|
if (mtbUntMis != null)
|
||||||
item.setMtbUntMis(Collections.singletonList(mtbUntMis));
|
item.setMtbUntMis(Collections.singletonList(mtbUntMis));
|
||||||
}
|
}
|
||||||
|
|
||||||
onComplete.run(inputMtbAart);
|
return inputMtbAart;
|
||||||
}, onFailed);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +1,9 @@
|
|||||||
package it.integry.integrywmsnative.core.rest.consumers;
|
package it.integry.integrywmsnative.core.rest.consumers;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
|
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
|
||||||
import it.integry.integrywmsnative.core.model.Azienda;
|
import it.integry.integrywmsnative.core.model.Azienda;
|
||||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||||
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
|
|
||||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
|
||||||
import retrofit2.Call;
|
|
||||||
import retrofit2.Response;
|
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class AziendaRESTConsumer extends _BaseRESTConsumer {
|
public class AziendaRESTConsumer extends _BaseRESTConsumer {
|
||||||
@@ -21,19 +14,12 @@ public class AziendaRESTConsumer extends _BaseRESTConsumer {
|
|||||||
this.restBuilder = restBuilder;
|
this.restBuilder = restBuilder;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void retrieveAzienda(RunnableArgs<Azienda> onComplete, RunnableArgs<Exception> onFailed) {
|
public Azienda retrieveAziendaSynchronized() throws Exception {
|
||||||
AziendaRESTConsumerService aziendaRESTConsumerService = restBuilder.getService(AziendaRESTConsumerService.class);
|
AziendaRESTConsumerService aziendaRESTConsumerService = restBuilder.getService(AziendaRESTConsumerService.class);
|
||||||
aziendaRESTConsumerService.retrieveDefaultAzienda().enqueue(new ManagedErrorCallback<>() {
|
var response = aziendaRESTConsumerService.retrieveDefaultAzienda()
|
||||||
@Override
|
.execute();
|
||||||
public void onResponse(Call<ServiceRESTResponse<Azienda>> call, Response<ServiceRESTResponse<Azienda>> response) {
|
|
||||||
analyzeAnswer(response, "Retrieve default azienda", onComplete, onFailed);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
return analyzeAnswer(response, "Retrieve default azienda");
|
||||||
public void onFailure(Call<ServiceRESTResponse<Azienda>> call, @NonNull final Exception e) {
|
|
||||||
onFailed.run(e);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,10 @@ public class BarcodeRESTConsumer extends _BaseRESTConsumer {
|
|||||||
this.ean128Service = ean128Service;
|
this.ean128Service = ean128Service;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Ean128Model decodeEan128Synchronized(BarcodeScanDTO barcodeScanDTO) throws Exception {
|
||||||
|
return this.ean128Service.decode(barcodeScanDTO);
|
||||||
|
}
|
||||||
|
|
||||||
public void decodeEan128(BarcodeScanDTO barcodeObj, RunnableArgs<Ean128Model> onComplete, RunnableArgs<Exception> onFailed) {
|
public void decodeEan128(BarcodeScanDTO barcodeObj, RunnableArgs<Ean128Model> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
try {
|
try {
|
||||||
onComplete.run(this.ean128Service.decode(barcodeObj));
|
onComplete.run(this.ean128Service.decode(barcodeObj));
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package it.integry.integrywmsnative.core.rest.consumers;
|
|||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
@@ -27,10 +28,8 @@ import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSRequestDTO;
|
|||||||
import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSResponseDTO;
|
import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSResponseDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSFromArtRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSFromArtRequestDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSRequestDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSResponseDTO;
|
|
||||||
import it.integry.integrywmsnative.core.rest.model.uds.DeleteUDSRowRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.uds.DeleteUDSRowRequestDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.uds.EditUDSRowRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.uds.EditUDSRowRequestDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.uds.EditUDSRowResponseDTO;
|
|
||||||
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDCRowRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDCRowRequestDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDCRowResponseDTO;
|
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDCRowResponseDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowRequestDTO;
|
||||||
@@ -44,10 +43,12 @@ public class ColliLavorazioneRESTConsumer extends _BaseRESTConsumer implements C
|
|||||||
|
|
||||||
|
|
||||||
private final RESTBuilder restBuilder;
|
private final RESTBuilder restBuilder;
|
||||||
|
private final ExecutorService executorService;
|
||||||
private final SettingsManager settingsManager;
|
private final SettingsManager settingsManager;
|
||||||
|
|
||||||
public ColliLavorazioneRESTConsumer(RESTBuilder restBuilder, SettingsManager settingsManager) {
|
public ColliLavorazioneRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService, SettingsManager settingsManager) {
|
||||||
this.restBuilder = restBuilder;
|
this.restBuilder = restBuilder;
|
||||||
|
this.executorService = executorService;
|
||||||
this.settingsManager = settingsManager;
|
this.settingsManager = settingsManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,91 +124,109 @@ public class ColliLavorazioneRESTConsumer extends _BaseRESTConsumer implements C
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MtbColt createUDSSynchronized(CreateUDSRequestDTO createUDSRequestDTO) throws Exception {
|
||||||
|
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||||
|
|
||||||
|
var response = colliLavorazioneRESTConsumerService.createUDS(createUDSRequestDTO)
|
||||||
|
.execute();
|
||||||
|
|
||||||
|
var data = analyzeAnswer(response, "lavorazione/createUDS");
|
||||||
|
return data.getMtbColt();
|
||||||
|
}
|
||||||
|
|
||||||
public void createUDS(CreateUDSRequestDTO createUDSRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
public void createUDS(CreateUDSRequestDTO createUDSRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
executorService.execute(() -> {
|
||||||
|
try {
|
||||||
colliLavorazioneRESTConsumerService.createUDS(createUDSRequestDTO)
|
var response = createUDSSynchronized(createUDSRequestDTO);
|
||||||
.enqueue(new ManagedErrorCallback<>() {
|
if (onComplete != null) onComplete.run(response);
|
||||||
@Override
|
} catch (Exception ex) {
|
||||||
public void onResponse(Call<ServiceRESTResponse<CreateUDSResponseDTO>> call, Response<ServiceRESTResponse<CreateUDSResponseDTO>> response) {
|
if (onFailed != null) onFailed.run(ex);
|
||||||
analyzeAnswer(response, "lavorazione/createUDS", data -> onComplete.run(data.getMtbColt()), onFailed);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(Call<ServiceRESTResponse<CreateUDSResponseDTO>> call, @NonNull final Exception e) {
|
|
||||||
onFailed.run(e);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public CloseUDSResponseDTO closeUDSSynchronized(CloseUDSRequestDTO closeUDSRequestDTO) throws Exception {
|
||||||
|
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||||
|
|
||||||
|
var response = colliLavorazioneRESTConsumerService.closeUDS(closeUDSRequestDTO)
|
||||||
|
.execute();
|
||||||
|
|
||||||
|
var data = analyzeAnswer(response, "lavorazione/closeUDS");
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
public void closeUDS(CloseUDSRequestDTO closeUDSRequestDTO, RunnableArgs<CloseUDSResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
public void closeUDS(CloseUDSRequestDTO closeUDSRequestDTO, RunnableArgs<CloseUDSResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
executorService.execute(() -> {
|
||||||
|
try {
|
||||||
colliLavorazioneRESTConsumerService.closeUDS(closeUDSRequestDTO)
|
var response = closeUDSSynchronized(closeUDSRequestDTO);
|
||||||
.enqueue(new ManagedErrorCallback<>() {
|
if (onComplete != null) onComplete.run(response);
|
||||||
@Override
|
} catch (Exception ex) {
|
||||||
public void onResponse(Call<ServiceRESTResponse<CloseUDSResponseDTO>> call, Response<ServiceRESTResponse<CloseUDSResponseDTO>> response) {
|
if (onFailed != null) onFailed.run(ex);
|
||||||
analyzeAnswer(response, "lavorazione/closeUDS", onComplete, onFailed);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(Call<ServiceRESTResponse<CloseUDSResponseDTO>> call, @NonNull final Exception e) {
|
|
||||||
onFailed.run(e);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MtbColr insertUDSRowSynchronized(InsertUDSRowRequestDTO insertUDSRowRequestDTO) throws Exception {
|
||||||
|
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||||
|
|
||||||
|
Response<ServiceRESTResponse<InsertUDSRowResponseDTO>> response = colliLavorazioneRESTConsumerService.insertUDSRow(insertUDSRowRequestDTO)
|
||||||
|
.execute();
|
||||||
|
|
||||||
|
var data = analyzeAnswer(response, "lavorazione/insertUDSRow");
|
||||||
|
return data.getSavedMtbColr();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void insertUDSRow(InsertUDSRowRequestDTO insertUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
|
public void insertUDSRow(InsertUDSRowRequestDTO insertUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
executorService.execute(() -> {
|
||||||
|
try {
|
||||||
colliLavorazioneRESTConsumerService.insertUDSRow(insertUDSRowRequestDTO)
|
var response = insertUDSRowSynchronized(insertUDSRowRequestDTO);
|
||||||
.enqueue(new ManagedErrorCallback<>() {
|
if (onComplete != null) onComplete.run(response);
|
||||||
@Override
|
} catch (Exception ex) {
|
||||||
public void onResponse(Call<ServiceRESTResponse<InsertUDSRowResponseDTO>> call, Response<ServiceRESTResponse<InsertUDSRowResponseDTO>> response) {
|
if (onFailed != null) onFailed.run(ex);
|
||||||
analyzeAnswer(response, "lavorazione/insertUDSRow", data -> onComplete.run(data.getSavedMtbColr()), onFailed);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(Call<ServiceRESTResponse<InsertUDSRowResponseDTO>> call, @NonNull final Exception e) {
|
|
||||||
onFailed.run(e);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MtbColr editUDSRowSynchronized(EditUDSRowRequestDTO editUDSRowRequestDTO) throws Exception {
|
||||||
|
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||||
|
|
||||||
|
var response = colliLavorazioneRESTConsumerService.editUDSRow(editUDSRowRequestDTO)
|
||||||
|
.execute();
|
||||||
|
|
||||||
|
var data = analyzeAnswer(response, "lavorazione/editUDSRow");
|
||||||
|
return data.getSavedMtbColr();
|
||||||
|
}
|
||||||
|
|
||||||
public void editUDSRow(EditUDSRowRequestDTO editUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
|
public void editUDSRow(EditUDSRowRequestDTO editUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
executorService.execute(() -> {
|
||||||
|
try {
|
||||||
colliLavorazioneRESTConsumerService.editUDSRow(editUDSRowRequestDTO)
|
var response = editUDSRowSynchronized(editUDSRowRequestDTO);
|
||||||
.enqueue(new ManagedErrorCallback<>() {
|
if (onComplete != null) onComplete.run(response);
|
||||||
@Override
|
} catch (Exception ex) {
|
||||||
public void onResponse(Call<ServiceRESTResponse<EditUDSRowResponseDTO>> call, Response<ServiceRESTResponse<EditUDSRowResponseDTO>> response) {
|
if (onFailed != null) onFailed.run(ex);
|
||||||
analyzeAnswer(response, "lavorazione/editUDSRow", data -> onComplete.run(data.getSavedMtbColr()), onFailed);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(Call<ServiceRESTResponse<EditUDSRowResponseDTO>> call, @NonNull final Exception e) {
|
|
||||||
onFailed.run(e);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public void deleteUDSRowSynchronized(DeleteUDSRowRequestDTO deleteUDSRowRequestDTO) throws Exception {
|
||||||
public void deleteUDSRow(DeleteUDSRowRequestDTO deleteUDSRowRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
|
||||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||||
|
|
||||||
colliLavorazioneRESTConsumerService.deleteUDSRow(deleteUDSRowRequestDTO)
|
var response = colliLavorazioneRESTConsumerService.deleteUDSRow(deleteUDSRowRequestDTO)
|
||||||
.enqueue(new ManagedErrorCallback<>() {
|
.execute();
|
||||||
@Override
|
|
||||||
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
|
analyzeAnswer(response, "lavorazione/deleteUDSRow");
|
||||||
analyzeAnswer(response, "lavorazione/deleteUDSRow", data -> onComplete.run(), onFailed);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public void deleteUDSRow(DeleteUDSRowRequestDTO deleteUDSRowRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) {
|
executorService.execute(() -> {
|
||||||
onFailed.run(e);
|
try {
|
||||||
|
deleteUDSRowSynchronized(deleteUDSRowRequestDTO);
|
||||||
|
if (onComplete != null) onComplete.run();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
if (onFailed != null) onFailed.run(ex);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import java.util.HashMap;
|
|||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
@@ -36,8 +37,8 @@ import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
|
|||||||
import it.integry.integrywmsnative.core.rest.model.RettificaULDTO;
|
import it.integry.integrywmsnative.core.rest.model.RettificaULDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||||
import it.integry.integrywmsnative.core.rest.model.SpostaArtsTraULRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.SpostaArtsTraULRequestDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.SpostaArtsTraULResponseDTO;
|
|
||||||
import it.integry.integrywmsnative.core.rest.model.SpostaULRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.SpostaULRequestDTO;
|
||||||
|
import it.integry.integrywmsnative.core.rest.model.UpdatePosizioneULRequestDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.UpdateTipoULRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.UpdateTipoULRequestDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.VersamentoAutomaticoULResponseDTO;
|
import it.integry.integrywmsnative.core.rest.model.VersamentoAutomaticoULResponseDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.uds.CanULBeDeletedRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.uds.CanULBeDeletedRequestDTO;
|
||||||
@@ -60,8 +61,9 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
private final ArticoloRESTConsumer mArticoloRESTConsumer;
|
private final ArticoloRESTConsumer mArticoloRESTConsumer;
|
||||||
private final EntityRESTConsumer mEntityRESTConsumer;
|
private final EntityRESTConsumer mEntityRESTConsumer;
|
||||||
private final SettingsManager mSettingsManager;
|
private final SettingsManager mSettingsManager;
|
||||||
|
private final ExecutorService executorService;
|
||||||
|
|
||||||
public ColliMagazzinoRESTConsumer(RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer,
|
public ColliMagazzinoRESTConsumer(ExecutorService executorService, RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer,
|
||||||
ArticoloRESTConsumer articoloRESTConsumer,
|
ArticoloRESTConsumer articoloRESTConsumer,
|
||||||
EntityRESTConsumer entityRESTConsumer,
|
EntityRESTConsumer entityRESTConsumer,
|
||||||
SettingsManager settingsManager) {
|
SettingsManager settingsManager) {
|
||||||
@@ -70,38 +72,36 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
this.mArticoloRESTConsumer = articoloRESTConsumer;
|
this.mArticoloRESTConsumer = articoloRESTConsumer;
|
||||||
this.mEntityRESTConsumer = entityRESTConsumer;
|
this.mEntityRESTConsumer = entityRESTConsumer;
|
||||||
this.mSettingsManager = settingsManager;
|
this.mSettingsManager = settingsManager;
|
||||||
|
this.executorService = executorService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void saveCollo(MtbColt mtbColtToSave, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
public MtbColt saveColloSynchronized(MtbColt mtbColtToSave) throws Exception {
|
||||||
MtbColt mtbColtToSaveClone = (MtbColt) mtbColtToSave.clone();
|
MtbColt mtbColtToSaveClone = (MtbColt) mtbColtToSave.clone();
|
||||||
mtbColtToSaveClone.setOperation(CommonModelConsts.OPERATION.INSERT_OR_UPDATE);
|
mtbColtToSaveClone.setOperation(CommonModelConsts.OPERATION.INSERT_OR_UPDATE);
|
||||||
mtbColtToSaveClone.setOnlyPkMaster(false);
|
mtbColtToSaveClone.setOnlyPkMaster(false);
|
||||||
|
|
||||||
|
|
||||||
mtbColtToSaveClone.setMtbColr(new ObservableArrayList<>());
|
|
||||||
|
|
||||||
for (int i = 0; i < mtbColtToSave.getMtbColr().size(); i++) {
|
for (int i = 0; i < mtbColtToSave.getMtbColr().size(); i++) {
|
||||||
mtbColtToSaveClone.getMtbColr().add(
|
mtbColtToSaveClone.getMtbColr().get(i)
|
||||||
((MtbColr) mtbColtToSave.getMtbColr().get(i).clone())
|
|
||||||
.setMtbAart(null)
|
.setMtbAart(null)
|
||||||
.setMtbPartitaMag(null));
|
.setMtbPartitaMag(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.mEntityRESTConsumer.processEntity(mtbColtToSaveClone, new ISimpleOperationCallback<>() {
|
return this.mEntityRESTConsumer.processEntitySynchronized(mtbColtToSaveClone, MtbColt.class);
|
||||||
@Override
|
|
||||||
public void onSuccess(MtbColt value) {
|
|
||||||
if (onComplete != null) onComplete.run(value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public void saveCollo(MtbColt mtbColtToSave, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
public void onFailed(Exception ex) {
|
executorService.execute(() -> {
|
||||||
|
try {
|
||||||
|
var mtbColt = saveColloSynchronized(mtbColtToSave);
|
||||||
|
if (onComplete != null) onComplete.run(mtbColt);
|
||||||
|
} catch (Exception ex) {
|
||||||
if (onFailed != null) onFailed.run(ex);
|
if (onFailed != null) onFailed.run(ex);
|
||||||
}
|
}
|
||||||
}, MtbColt.class);
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void saveColli(List<MtbColt> mtbColtsToSave, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
|
public List<MtbColt> saveColliSynchronized(List<MtbColt> mtbColtsToSave) throws Exception {
|
||||||
|
|
||||||
for (MtbColt mtbColt : mtbColtsToSave) {
|
for (MtbColt mtbColt : mtbColtsToSave) {
|
||||||
for (int i = 0; i < mtbColt.getMtbColr().size(); i++) {
|
for (int i = 0; i < mtbColt.getMtbColr().size(); i++) {
|
||||||
@@ -111,26 +111,9 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.mEntityRESTConsumer.processEntityList(mtbColtsToSave, true, MtbColt.class, onComplete, onFailed);
|
return this.mEntityRESTConsumer.processEntityListSynchronized(mtbColtsToSave, true, MtbColt.class);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createColloLavorazione(int segno, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
|
||||||
MtbColt mtbColtToCreate = new MtbColt()
|
|
||||||
.setSegno(segno);
|
|
||||||
|
|
||||||
mtbColtToCreate.initDefaultFields(GestioneEnum.LAVORAZIONE);
|
|
||||||
|
|
||||||
mtbColtToCreate
|
|
||||||
.setOperation(CommonModelConsts.OPERATION.INSERT);
|
|
||||||
|
|
||||||
|
|
||||||
saveCollo(mtbColtToCreate, value -> {
|
|
||||||
if (onComplete != null) onComplete.run(value);
|
|
||||||
}, ex -> {
|
|
||||||
if (onFailed != null) onFailed.run(ex);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public void createColloScaricoDaCarico(MtbColt sourceMtbColt, MtbDepoPosizione posizione, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
public void createColloScaricoDaCarico(MtbColt sourceMtbColt, MtbDepoPosizione posizione, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
|
|
||||||
@@ -212,7 +195,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// if (sourceMtbColt.getMtbColr().size() != 1) {
|
// if (sourceMtbColt.getMtbColr().getValue().size() != 1) {
|
||||||
// onFailed.run(new Exception());
|
// onFailed.run(new Exception());
|
||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
@@ -288,32 +271,34 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
saveCollo(mtbColtToCreate, onComplete, onFailed);
|
saveCollo(mtbColtToCreate, onComplete, onFailed);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getBySSCC(String ssccString, boolean onlyResiduo, boolean throwExcIfNull, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
public MtbColt getBySsccSynchronized(String ssccString, boolean onlyResiduo, boolean throwExcIfNull) throws Exception {
|
||||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||||
colliMagazzinoRESTConsumerService.getColloByBarcode(ssccString, onlyResiduo, throwExcIfNull).enqueue(new ManagedErrorCallback<>() {
|
var colloResponse = colliMagazzinoRESTConsumerService.getColloByBarcode(ssccString, onlyResiduo, throwExcIfNull)
|
||||||
@Override
|
.execute();
|
||||||
public void onResponse(Call<ServiceRESTResponse<MtbColt>> call, Response<ServiceRESTResponse<MtbColt>> response) {
|
var mtbColt = analyzeAnswer(colloResponse, "GetBySSCC");
|
||||||
analyzeAnswer(response, "GetBySSCC", mtbColt -> {
|
|
||||||
|
|
||||||
if (mtbColt != null && mtbColt.getMtbColr() != null && !mtbColt.getMtbColr().isEmpty()) {
|
if (mtbColt != null && mtbColt.getMtbColr() != null && !mtbColt.getMtbColr().isEmpty()) {
|
||||||
List<MtbColt> mtbColtList = new ArrayList<>();
|
List<MtbColt> mtbColtList = new ArrayList<>();
|
||||||
mtbColtList.add(mtbColt);
|
mtbColtList.add(mtbColt);
|
||||||
fillMtbAartsOfMtbColts(mtbColtList, mtbColts -> onComplete.run(mtbColts.get(0)), onFailed);
|
var mtbColts = fillMtbAartsOfMtbColtsSynchronized(mtbColtList);
|
||||||
} else {
|
return mtbColts.get(0);
|
||||||
onComplete.run(mtbColt);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}, onFailed);
|
return mtbColt;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public void getBySSCC(String ssccString, boolean onlyResiduo, boolean throwExcIfNull, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
public void onFailure(Call<ServiceRESTResponse<MtbColt>> call, @NonNull final Exception e) {
|
executorService.execute(() -> {
|
||||||
onFailed.run(e);
|
try {
|
||||||
|
var mtbColt = getBySsccSynchronized(ssccString, onlyResiduo, throwExcIfNull);
|
||||||
|
if (onComplete != null) onComplete.run(mtbColt);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
if (onFailed != null) onFailed.run(ex);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void fillMtbAartsOfMtbColrs(List<MtbColr> mtbColrs, RunnableArgs<List<MtbColr>> onComplete, RunnableArgs<Exception> onFailed) {
|
public List<MtbColr> fillMtbAartsOfMtbColrsSynchronized(List<MtbColr> mtbColrs) throws Exception {
|
||||||
|
|
||||||
List<String> codMarts = new ArrayList<>(mtbColrs.stream()
|
List<String> codMarts = new ArrayList<>(mtbColrs.stream()
|
||||||
.map(MtbColr::getCodMart)
|
.map(MtbColr::getCodMart)
|
||||||
@@ -321,11 +306,11 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
.distinct()
|
.distinct()
|
||||||
.collect(Collectors.toUnmodifiableList()));
|
.collect(Collectors.toUnmodifiableList()));
|
||||||
|
|
||||||
mArticoloRESTConsumer.getByCodMarts(codMarts, arts -> {
|
var arts = mArticoloRESTConsumer.getByCodMartsSynchronized(codMarts);
|
||||||
|
|
||||||
|
|
||||||
if (arts != null && !arts.isEmpty()) {
|
if (arts != null && !arts.isEmpty()) {
|
||||||
for (MtbColr mtbColr : mtbColrs) {
|
for (MtbColr mtbColr : mtbColrs) {
|
||||||
|
|
||||||
MtbAart foundMtbAart = null;
|
MtbAart foundMtbAart = null;
|
||||||
|
|
||||||
List<MtbAart> mtbAartStream = arts.stream()
|
List<MtbAart> mtbAartStream = arts.stream()
|
||||||
@@ -340,32 +325,29 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onComplete.run(mtbColrs);
|
return mtbColrs;
|
||||||
}, onFailed);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void fillMtbAartsOfMtbColts(List<MtbColt> mtbColts, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
|
public List<MtbColt> fillMtbAartsOfMtbColtsSynchronized(List<MtbColt> mtbColts) throws Exception {
|
||||||
List<String> codMarts = new ArrayList<>();
|
List<String> codMarts = new ArrayList<>();
|
||||||
|
|
||||||
for (MtbColt mtbColt : mtbColts) {
|
for (MtbColt mtbColt : mtbColts) {
|
||||||
codMarts.addAll(mtbColt.getMtbColr().stream()
|
codMarts.addAll(mtbColt.getMtbColr().stream()
|
||||||
.map(MtbColr::getCodMart)
|
.map(MtbColr::getCodMart)
|
||||||
.filter(Objects::nonNull)
|
.filter(x -> !UtilityString.isNullOrEmpty(x))
|
||||||
.distinct()
|
.distinct()
|
||||||
.collect(Collectors.toUnmodifiableList()));
|
.collect(Collectors.toList()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<MtbAart> mtbAarts = mArticoloRESTConsumer.getByCodMartsSynchronized(codMarts);
|
||||||
|
|
||||||
mArticoloRESTConsumer.getByCodMarts(codMarts, arts -> {
|
|
||||||
|
|
||||||
if (arts != null && !arts.isEmpty()) {
|
|
||||||
for (MtbColt mtbColt : mtbColts) {
|
for (MtbColt mtbColt : mtbColts) {
|
||||||
for (MtbColr mtbColr : mtbColt.getMtbColr()) {
|
for (MtbColr mtbColr : mtbColt.getMtbColr()) {
|
||||||
|
|
||||||
|
if (mtbAarts != null && !mtbAarts.isEmpty()) {
|
||||||
MtbAart foundMtbAart = null;
|
MtbAart foundMtbAart = null;
|
||||||
|
|
||||||
List<MtbAart> mtbAartStream = arts.stream()
|
List<MtbAart> mtbAartStream = mtbAarts.parallelStream()
|
||||||
.filter(x -> x.getCodMart().equalsIgnoreCase(mtbColr.getCodMart()))
|
.filter(x -> x.getCodMart().equalsIgnoreCase(mtbColr.getCodMart()))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
@@ -374,16 +356,27 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mtbColr.setMtbAart(foundMtbAart);
|
mtbColr.setMtbAart(foundMtbAart);
|
||||||
|
}
|
||||||
|
|
||||||
mtbColr.setGestione(mtbColt.getGestione());
|
mtbColr.setGestione(mtbColt.getGestione());
|
||||||
mtbColr.setSerCollo(mtbColt.getSerCollo());
|
mtbColr.setSerCollo(mtbColt.getSerCollo());
|
||||||
mtbColr.setNumCollo(mtbColt.getNumCollo());
|
mtbColr.setNumCollo(mtbColt.getNumCollo());
|
||||||
mtbColr.setDataCollo(mtbColt.getDataColloS());
|
mtbColr.setDataCollo(mtbColt.getDataColloS());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return mtbColts;
|
||||||
}
|
}
|
||||||
|
|
||||||
onComplete.run(mtbColts);
|
public void fillMtbAartsOfMtbColts(List<MtbColt> mtbColts, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
}, onFailed);
|
executorService.execute(() -> {
|
||||||
|
try {
|
||||||
|
List<MtbColt> returnedMtbColts = fillMtbAartsOfMtbColtsSynchronized(mtbColts);
|
||||||
|
if (onComplete != null) onComplete.run(returnedMtbColts);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
if (onFailed != null) onFailed.run(ex);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getMultipleByTestate(List<MtbColt> testate, boolean onlyResiduo, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
|
public void getMultipleByTestate(List<MtbColt> testate, boolean onlyResiduo, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
@@ -404,6 +397,16 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MtbColt getByChiaveColloSynchronized(GestioneEnum gestione, int numCollo, String dataCollo, String serCollo, boolean onlyResiduo, boolean throwExcIfNull) throws Exception {
|
||||||
|
MtbColt mtbColtToRetrieve = new MtbColt()
|
||||||
|
.setGestione(gestione)
|
||||||
|
.setNumCollo(numCollo)
|
||||||
|
.setDataCollo(dataCollo)
|
||||||
|
.setSerCollo(serCollo);
|
||||||
|
|
||||||
|
return getByTestataSynchronized(mtbColtToRetrieve, onlyResiduo, throwExcIfNull);
|
||||||
|
}
|
||||||
|
|
||||||
public void getByChiaveCollo(GestioneEnum gestione, int numCollo, String dataCollo, String serCollo, boolean onlyResiduo, boolean throwExcIfNull, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
public void getByChiaveCollo(GestioneEnum gestione, int numCollo, String dataCollo, String serCollo, boolean onlyResiduo, boolean throwExcIfNull, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
MtbColt mtbColtToRetrieve = new MtbColt()
|
MtbColt mtbColtToRetrieve = new MtbColt()
|
||||||
.setGestione(gestione)
|
.setGestione(gestione)
|
||||||
@@ -414,36 +417,34 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
getByTestata(mtbColtToRetrieve, onlyResiduo, throwExcIfNull, onComplete, onFailed);
|
getByTestata(mtbColtToRetrieve, onlyResiduo, throwExcIfNull, onComplete, onFailed);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getByTestata(MtbColt testata, boolean onlyResiduo, boolean throwExcIfNull, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
public MtbColt getByTestataSynchronized(MtbColt testata, boolean onlyResiduo, boolean throwExcIfNull) throws Exception {
|
||||||
testata.setMtbColr(new ObservableArrayList<>());
|
testata.setMtbColr(new ObservableArrayList<>());
|
||||||
|
|
||||||
|
|
||||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||||
colliMagazzinoRESTConsumerService.getColloInGiac(onlyResiduo, throwExcIfNull, testata)
|
var response = colliMagazzinoRESTConsumerService.getColloInGiac(onlyResiduo, throwExcIfNull, testata)
|
||||||
.enqueue(new ManagedErrorCallback<>() {
|
.execute();
|
||||||
@Override
|
var mtbColt = analyzeAnswer(response, "getColloInGiac");
|
||||||
public void onResponse(Call<ServiceRESTResponse<MtbColt>> call, Response<ServiceRESTResponse<MtbColt>> response) {
|
|
||||||
analyzeAnswer(response, "getColloInGiac", mtbColt -> {
|
|
||||||
|
|
||||||
if (mtbColt != null && mtbColt.getMtbColr() != null && !mtbColt.getMtbColr().isEmpty()) {
|
if (mtbColt != null && mtbColt.getMtbColr() != null && !mtbColt.getMtbColr().isEmpty()) {
|
||||||
List<MtbColt> mtbColtList = new ArrayList<>();
|
var mtbColts = fillMtbAartsOfMtbColtsSynchronized(Collections.singletonList(mtbColt));
|
||||||
mtbColtList.add(mtbColt);
|
return mtbColts.get(0);
|
||||||
fillMtbAartsOfMtbColts(mtbColtList, mtbColts -> onComplete.run(mtbColts.get(0)), onFailed);
|
|
||||||
} else {
|
|
||||||
onComplete.run(mtbColt);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}, onFailed);
|
return mtbColt;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public void getByTestata(MtbColt testata, boolean onlyResiduo, boolean throwExcIfNull, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
public void onFailure(Call<ServiceRESTResponse<MtbColt>> call, @NonNull final Exception e) {
|
executorService.execute(() -> {
|
||||||
onFailed.run(e);
|
try {
|
||||||
|
var data = getByTestataSynchronized(testata, onlyResiduo, throwExcIfNull);
|
||||||
|
if (onComplete != null) onComplete.run(data);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
if (onFailed != null) onFailed.run(ex);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void spostaUL(MtbColt mtbColtToMove, String codMdep, String posizione, boolean createDocAutomatically, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
public void spostaUlSynchronized(MtbColt mtbColtToMove, String codMdep, String posizione, boolean createDocAutomatically) throws Exception {
|
||||||
MtbColt mtbColtToMoveClone = (MtbColt) mtbColtToMove.clone();
|
MtbColt mtbColtToMoveClone = (MtbColt) mtbColtToMove.clone();
|
||||||
|
|
||||||
for (int i = 0; i < mtbColtToMoveClone.getMtbColr().size(); i++) {
|
for (int i = 0; i < mtbColtToMoveClone.getMtbColr().size(); i++) {
|
||||||
@@ -459,19 +460,21 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
.setCreateDocAutomatically(createDocAutomatically);
|
.setCreateDocAutomatically(createDocAutomatically);
|
||||||
|
|
||||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||||
colliMagazzinoRESTConsumerService
|
Response<ServiceRESTResponse<Void>> response = colliMagazzinoRESTConsumerService
|
||||||
.spostaUL(spostaUlRequestDTO)
|
.spostaUL(spostaUlRequestDTO)
|
||||||
.enqueue(new ManagedErrorCallback<>() {
|
.execute();
|
||||||
@Override
|
|
||||||
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
|
analyzeAnswer(response, "spostaUL");
|
||||||
analyzeAnswer(response, "spostaUL", mtbColts -> {
|
|
||||||
onComplete.run();
|
|
||||||
}, onFailed);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) {
|
public void spostaUL(MtbColt mtbColtToMove, String codMdep, String posizione, boolean createDocAutomatically, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
if (onFailed != null) onFailed.run(e);
|
executorService.execute(() -> {
|
||||||
|
try {
|
||||||
|
spostaUlSynchronized(mtbColtToMove, codMdep, posizione, createDocAutomatically);
|
||||||
|
if (onComplete != null) onComplete.run();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
if (onFailed != null) onFailed.run(ex);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -484,7 +487,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
spostaUL(mtbColtToMove, codMdep, posizioneString, true, onComplete, onFailed);
|
spostaUL(mtbColtToMove, codMdep, posizioneString, true, onComplete, onFailed);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateTipoUL(MtbColt mtbColt, String codTcol, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
public void updateTipoULSynchronized(MtbColt mtbColt, String codTcol) throws Exception {
|
||||||
|
|
||||||
MtbColt mtbColtClone = (MtbColt) mtbColt.clone();
|
MtbColt mtbColtClone = (MtbColt) mtbColt.clone();
|
||||||
mtbColtClone.setMtbColr(new ObservableArrayList<>());
|
mtbColtClone.setMtbColr(new ObservableArrayList<>());
|
||||||
@@ -494,22 +497,52 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
.setCodTcol(codTcol);
|
.setCodTcol(codTcol);
|
||||||
|
|
||||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||||
colliMagazzinoRESTConsumerService
|
Response<ServiceRESTResponse<Void>> response = colliMagazzinoRESTConsumerService
|
||||||
.updateTipoUL(updateTipoULRequest)
|
.updateTipoUL(updateTipoULRequest)
|
||||||
.enqueue(new ManagedErrorCallback<>() {
|
.execute();
|
||||||
@Override
|
|
||||||
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
|
analyzeAnswer(response, "updateTipoUL");
|
||||||
analyzeAnswer(response, "updateTipoUL", mtbColts -> {
|
|
||||||
onComplete.run();
|
|
||||||
}, onFailed);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) {
|
public void updateTipoUL(MtbColt mtbColt, String codTcol, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
if (onFailed != null) onFailed.run(e);
|
executorService.execute(() -> {
|
||||||
|
try {
|
||||||
|
updateTipoULSynchronized(mtbColt, codTcol);
|
||||||
|
if (onComplete != null) onComplete.run();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
if (onFailed != null) onFailed.run(ex);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updatePosizioneULSynchronized(MtbColt mtbColt, String posizione) throws Exception {
|
||||||
|
|
||||||
|
MtbColt mtbColtClone = (MtbColt) mtbColt.clone();
|
||||||
|
mtbColtClone.setMtbColr(new ObservableArrayList<>());
|
||||||
|
|
||||||
|
UpdatePosizioneULRequestDTO updateTipoULRequest = new UpdatePosizioneULRequestDTO()
|
||||||
|
.setMtbColt(mtbColtClone)
|
||||||
|
.setPosizione(posizione);
|
||||||
|
|
||||||
|
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||||
|
Response<ServiceRESTResponse<Void>> response = colliMagazzinoRESTConsumerService
|
||||||
|
.updatePosizioneUL(updateTipoULRequest)
|
||||||
|
.execute();
|
||||||
|
|
||||||
|
analyzeAnswer(response, "updatePosizioneUL");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void updatePosizioneUL(MtbColt mtbColt, String posizione, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
|
executorService.execute(() -> {
|
||||||
|
try {
|
||||||
|
updatePosizioneULSynchronized(mtbColt, posizione);
|
||||||
|
if (onComplete != null) onComplete.run();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
if (onFailed != null) onFailed.run(ex);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateDataFine(MtbColt mtbColt, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
public void updateDataFine(MtbColt mtbColt, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
@@ -572,8 +605,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void spostaArtsTraUL(MtbColt sourceMtbColt, MtbColt destMtbColt, boolean flagForceUseRefs, RunnableArgs<List<MtbColr>> onComplete, RunnableArgs<Exception> onFailed) {
|
public List<MtbColr> spostaArtsTraULSynchronized(MtbColt sourceMtbColt, MtbColt destMtbColt, boolean flagForceUseRefs) throws Exception {
|
||||||
new Thread(() -> {
|
|
||||||
MtbColt mtbColtToMoveClone = (MtbColt) sourceMtbColt.clone();
|
MtbColt mtbColtToMoveClone = (MtbColt) sourceMtbColt.clone();
|
||||||
MtbColt mtbColtDestClone = (MtbColt) destMtbColt.clone();
|
MtbColt mtbColtDestClone = (MtbColt) destMtbColt.clone();
|
||||||
|
|
||||||
@@ -591,25 +623,27 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
.setFlagForceUseRefs(flagForceUseRefs);
|
.setFlagForceUseRefs(flagForceUseRefs);
|
||||||
|
|
||||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||||
colliMagazzinoRESTConsumerService.spostaArtsTraUL(spostaArtsTraULRequestDTO).enqueue(new ManagedErrorCallback<>() {
|
var response = colliMagazzinoRESTConsumerService.spostaArtsTraUL(spostaArtsTraULRequestDTO)
|
||||||
@Override
|
.execute();
|
||||||
public void onResponse(Call<ServiceRESTResponse<SpostaArtsTraULResponseDTO>> call, Response<ServiceRESTResponse<SpostaArtsTraULResponseDTO>> response) {
|
|
||||||
analyzeAnswer(response, "spostaArtsTraUL", data -> {
|
|
||||||
|
|
||||||
fillMtbAartsOfMtbColrs(data.getGeneratedMtbColr(), onComplete, onFailed);
|
var data = analyzeAnswer(response, "spostaArtsTraUL");
|
||||||
|
var mtbColrs = fillMtbAartsOfMtbColrsSynchronized(data.getGeneratedMtbColr());
|
||||||
|
|
||||||
}, onFailed);
|
return mtbColrs;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public void spostaArtsTraUL(MtbColt sourceMtbColt, MtbColt destMtbColt, boolean flagForceUseRefs, RunnableArgs<List<MtbColr>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
public void onFailure(Call<ServiceRESTResponse<SpostaArtsTraULResponseDTO>> call, @NonNull final Exception e) {
|
executorService.execute(() -> {
|
||||||
if (onFailed != null) onFailed.run(e);
|
try {
|
||||||
|
var result = spostaArtsTraULSynchronized(sourceMtbColt, destMtbColt, flagForceUseRefs);
|
||||||
|
if (onComplete != null) onComplete.run(result);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
if (onFailed != null) onFailed.run(ex);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}).start();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void assegnaLottoSuColloScarico(MtbColt sourceMtbColt, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
public MtbColt assegnaLottoSuColloScaricoSynchronized(MtbColt sourceMtbColt) throws Exception {
|
||||||
MtbColt sourceMtbColtClone = (MtbColt) sourceMtbColt.clone();
|
MtbColt sourceMtbColtClone = (MtbColt) sourceMtbColt.clone();
|
||||||
|
|
||||||
for (int i = 0; i < sourceMtbColtClone.getMtbColr().size(); i++) {
|
for (int i = 0; i < sourceMtbColtClone.getMtbColr().size(); i++) {
|
||||||
@@ -619,17 +653,20 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||||
colliMagazzinoRESTConsumerService.assegnaLottoSuColloScarico(sourceMtbColtClone).enqueue(new ManagedErrorCallback<>() {
|
var response = colliMagazzinoRESTConsumerService.assegnaLottoSuColloScarico(sourceMtbColtClone)
|
||||||
@Override
|
.execute();
|
||||||
public void onResponse(Call<ServiceRESTResponse<MtbColt>> call, Response<ServiceRESTResponse<MtbColt>> response) {
|
|
||||||
analyzeAnswer(response, "assegnaLottoSuColloScarico", data -> {
|
var data = analyzeAnswer(response, "assegnaLottoSuColloScarico");
|
||||||
onComplete.run();
|
return data;
|
||||||
}, onFailed);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public void assegnaLottoSuColloScarico(MtbColt sourceMtbColt, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
public void onFailure(Call<ServiceRESTResponse<MtbColt>> call, @NonNull final Exception e) {
|
executorService.execute(() -> {
|
||||||
if (onFailed != null) onFailed.run(e);
|
try {
|
||||||
|
var result = assegnaLottoSuColloScaricoSynchronized(sourceMtbColt);
|
||||||
|
if (onComplete != null) onComplete.run();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
if (onFailed != null) onFailed.run(ex);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -735,40 +772,46 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void canULBeDeleted(MtbColt mtbColt, RunnableArgs<Boolean> onComplete, RunnableArgs<Exception> onFailed) {
|
public Boolean canULBeDeletedSynchronized(MtbColt mtbColt) throws Exception {
|
||||||
CanULBeDeletedRequestDTO canULBeDeletedRequestDTO = new CanULBeDeletedRequestDTO()
|
CanULBeDeletedRequestDTO canULBeDeletedRequestDTO = new CanULBeDeletedRequestDTO()
|
||||||
.setMtbColt(mtbColt);
|
.setMtbColt(mtbColt);
|
||||||
|
|
||||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||||
|
|
||||||
colliMagazzinoRESTConsumerService.canULBeDeleted(canULBeDeletedRequestDTO)
|
var response = colliMagazzinoRESTConsumerService.canULBeDeleted(canULBeDeletedRequestDTO)
|
||||||
.enqueue(new ManagedErrorCallback<>() {
|
.execute();
|
||||||
@Override
|
|
||||||
public void onResponse(Call<ServiceRESTResponse<Boolean>> call, Response<ServiceRESTResponse<Boolean>> response) {
|
var data = analyzeAnswer(response, "generic/canULBeDeleted");
|
||||||
analyzeAnswer(response, "generic/canULBeDeleted", onComplete, onFailed);
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public void canULBeDeleted(MtbColt mtbColt, RunnableArgs<Boolean> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
public void onFailure(Call<ServiceRESTResponse<Boolean>> call, @NonNull final Exception e) {
|
executorService.execute(() -> {
|
||||||
onFailed.run(e);
|
try {
|
||||||
|
var result = canULBeDeletedSynchronized(mtbColt);
|
||||||
|
if (onComplete != null) onComplete.run(result);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
if (onFailed != null) onFailed.run(ex);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteULSynchronized(DeleteULRequestDTO deleteULRequestDTO) throws Exception {
|
||||||
|
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||||
|
|
||||||
|
var response = colliMagazzinoRESTConsumerService.deleteUL(deleteULRequestDTO)
|
||||||
|
.execute();
|
||||||
|
|
||||||
|
analyzeAnswer(response, "generic/deleteUL");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deleteUL(DeleteULRequestDTO deleteULRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
public void deleteUL(DeleteULRequestDTO deleteULRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
executorService.execute(() -> {
|
||||||
|
try {
|
||||||
colliMagazzinoRESTConsumerService.deleteUL(deleteULRequestDTO)
|
deleteULSynchronized(deleteULRequestDTO);
|
||||||
.enqueue(new ManagedErrorCallback<>() {
|
if (onComplete != null) onComplete.run();
|
||||||
@Override
|
} catch (Exception ex) {
|
||||||
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
|
if (onFailed != null) onFailed.run(ex);
|
||||||
analyzeAnswer(response, "generic/deleteUL", Void -> onComplete.run(), onFailed);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) {
|
|
||||||
onFailed.run(e);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
|||||||
import it.integry.integrywmsnative.core.rest.model.SpostaArtsTraULRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.SpostaArtsTraULRequestDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.SpostaArtsTraULResponseDTO;
|
import it.integry.integrywmsnative.core.rest.model.SpostaArtsTraULResponseDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.SpostaULRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.SpostaULRequestDTO;
|
||||||
|
import it.integry.integrywmsnative.core.rest.model.UpdatePosizioneULRequestDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.UpdateTipoULRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.UpdateTipoULRequestDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.VersamentoAutomaticoULResponseDTO;
|
import it.integry.integrywmsnative.core.rest.model.VersamentoAutomaticoULResponseDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.uds.CanULBeDeletedRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.uds.CanULBeDeletedRequestDTO;
|
||||||
@@ -37,6 +38,9 @@ public interface ColliMagazzinoRESTConsumerService {
|
|||||||
@POST("wms/updateTipoUL")
|
@POST("wms/updateTipoUL")
|
||||||
Call<ServiceRESTResponse<Void>> updateTipoUL(@Body UpdateTipoULRequestDTO requestDto);
|
Call<ServiceRESTResponse<Void>> updateTipoUL(@Body UpdateTipoULRequestDTO requestDto);
|
||||||
|
|
||||||
|
@POST("wms/updatePosizioneUL")
|
||||||
|
Call<ServiceRESTResponse<Void>> updatePosizioneUL(@Body UpdatePosizioneULRequestDTO requestDto);
|
||||||
|
|
||||||
@POST("wms/spostaUL")
|
@POST("wms/spostaUL")
|
||||||
Call<ServiceRESTResponse<Void>> spostaUL(@Body SpostaULRequestDTO requestDto);
|
Call<ServiceRESTResponse<Void>> spostaUL(@Body SpostaULRequestDTO requestDto);
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package it.integry.integrywmsnative.core.rest.consumers;
|
package it.integry.integrywmsnative.core.rest.consumers;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import java.util.concurrent.ExecutorService;
|
||||||
|
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
@@ -9,132 +9,150 @@ import it.integry.integrywmsnative.core.model.MtbColr;
|
|||||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.interfaces.ColliScaricoRESTConsumerInterface;
|
import it.integry.integrywmsnative.core.rest.consumers.interfaces.ColliScaricoRESTConsumerInterface;
|
||||||
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
|
|
||||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||||
import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSRequestDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSResponseDTO;
|
import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSResponseDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSRequestDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSResponseDTO;
|
|
||||||
import it.integry.integrywmsnative.core.rest.model.uds.DeleteUDSRowRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.uds.DeleteUDSRowRequestDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.uds.DuplicateUDSRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.uds.DuplicateUDSRequestDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.uds.DuplicateUDSResponseDTO;
|
import it.integry.integrywmsnative.core.rest.model.uds.DuplicateUDSResponseDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.uds.EditUDSRowRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.uds.EditUDSRowRequestDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.uds.EditUDSRowResponseDTO;
|
|
||||||
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowRequestDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowResponseDTO;
|
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowResponseDTO;
|
||||||
import retrofit2.Call;
|
|
||||||
import retrofit2.Response;
|
import retrofit2.Response;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class ColliSpedizioneRESTConsumer extends _BaseRESTConsumer implements ColliScaricoRESTConsumerInterface {
|
public class ColliSpedizioneRESTConsumer extends _BaseRESTConsumer implements ColliScaricoRESTConsumerInterface {
|
||||||
|
|
||||||
private final RESTBuilder restBuilder;
|
private final RESTBuilder restBuilder;
|
||||||
|
private final ExecutorService executorService;
|
||||||
|
|
||||||
public ColliSpedizioneRESTConsumer(RESTBuilder restBuilder) {
|
public ColliSpedizioneRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService) {
|
||||||
this.restBuilder = restBuilder;
|
this.restBuilder = restBuilder;
|
||||||
|
this.executorService = executorService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MtbColt createUDSSynchronized(CreateUDSRequestDTO createUDSRequestDTO) throws Exception {
|
||||||
|
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = restBuilder.getService(ColliSpedizioneRESTConsumerService.class);
|
||||||
|
|
||||||
|
var response = colliSpedizioneRESTConsumerService.createUDS(createUDSRequestDTO)
|
||||||
|
.execute();
|
||||||
|
|
||||||
|
var data = analyzeAnswer(response, "spedizione/createUDS");
|
||||||
|
return data.getMtbColt();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createUDS(CreateUDSRequestDTO createUDSRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
public void createUDS(CreateUDSRequestDTO createUDSRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = restBuilder.getService(ColliSpedizioneRESTConsumerService.class);
|
executorService.execute(() -> {
|
||||||
|
try {
|
||||||
colliSpedizioneRESTConsumerService.createUDS(createUDSRequestDTO)
|
var response = createUDSSynchronized(createUDSRequestDTO);
|
||||||
.enqueue(new ManagedErrorCallback<>() {
|
if (onComplete != null) onComplete.run(response);
|
||||||
@Override
|
} catch (Exception ex) {
|
||||||
public void onResponse(Call<ServiceRESTResponse<CreateUDSResponseDTO>> call, Response<ServiceRESTResponse<CreateUDSResponseDTO>> response) {
|
if (onFailed != null) onFailed.run(ex);
|
||||||
analyzeAnswer(response, "spedizione/createUDS", data -> onComplete.run(data.getMtbColt()), onFailed);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(Call<ServiceRESTResponse<CreateUDSResponseDTO>> call, @NonNull final Exception e) {
|
|
||||||
onFailed.run(e);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public CloseUDSResponseDTO closeUDSSynchronized(CloseUDSRequestDTO closeUDSRequestDTO) throws Exception {
|
||||||
|
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = restBuilder.getService(ColliSpedizioneRESTConsumerService.class);
|
||||||
|
|
||||||
|
var response = colliSpedizioneRESTConsumerService.closeUDS(closeUDSRequestDTO)
|
||||||
|
.execute();
|
||||||
|
|
||||||
|
var data = analyzeAnswer(response, "spedizione/closeUDS");
|
||||||
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void closeUDS(CloseUDSRequestDTO closeUDSRequestDTO, RunnableArgs<CloseUDSResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
public void closeUDS(CloseUDSRequestDTO closeUDSRequestDTO, RunnableArgs<CloseUDSResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = restBuilder.getService(ColliSpedizioneRESTConsumerService.class);
|
executorService.execute(() -> {
|
||||||
|
try {
|
||||||
colliSpedizioneRESTConsumerService.closeUDS(closeUDSRequestDTO)
|
var response = closeUDSSynchronized(closeUDSRequestDTO);
|
||||||
.enqueue(new ManagedErrorCallback<>() {
|
if (onComplete != null) onComplete.run(response);
|
||||||
@Override
|
} catch (Exception ex) {
|
||||||
public void onResponse(Call<ServiceRESTResponse<CloseUDSResponseDTO>> call, Response<ServiceRESTResponse<CloseUDSResponseDTO>> response) {
|
if (onFailed != null) onFailed.run(ex);
|
||||||
analyzeAnswer(response, "spedizione/closeUDS", onComplete, onFailed);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(Call<ServiceRESTResponse<CloseUDSResponseDTO>> call, @NonNull final Exception e) {
|
|
||||||
onFailed.run(e);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public MtbColr insertUDSRowSynchronized(InsertUDSRowRequestDTO insertUDSRowRequestDTO) throws Exception {
|
||||||
|
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = restBuilder.getService(ColliSpedizioneRESTConsumerService.class);
|
||||||
|
|
||||||
|
Response<ServiceRESTResponse<InsertUDSRowResponseDTO>> response = colliSpedizioneRESTConsumerService.insertUDSRow(insertUDSRowRequestDTO)
|
||||||
|
.execute();
|
||||||
|
|
||||||
|
var data = analyzeAnswer(response, "spedizione/insertUDSRow");
|
||||||
|
return data.getSavedMtbColr();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void insertUDSRow(InsertUDSRowRequestDTO insertUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
|
public void insertUDSRow(InsertUDSRowRequestDTO insertUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = restBuilder.getService(ColliSpedizioneRESTConsumerService.class);
|
executorService.execute(() -> {
|
||||||
|
try {
|
||||||
colliSpedizioneRESTConsumerService.insertUDSRow(insertUDSRowRequestDTO)
|
var response = insertUDSRowSynchronized(insertUDSRowRequestDTO);
|
||||||
.enqueue(new ManagedErrorCallback<>() {
|
if (onComplete != null) onComplete.run(response);
|
||||||
@Override
|
} catch (Exception ex) {
|
||||||
public void onResponse(Call<ServiceRESTResponse<InsertUDSRowResponseDTO>> call, Response<ServiceRESTResponse<InsertUDSRowResponseDTO>> response) {
|
if (onFailed != null) onFailed.run(ex);
|
||||||
analyzeAnswer(response, "spedizione/insertUDSRow", data -> onComplete.run(data.getSavedMtbColr()), onFailed);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(Call<ServiceRESTResponse<InsertUDSRowResponseDTO>> call, @NonNull final Exception e) {
|
|
||||||
onFailed.run(e);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MtbColr editUDSRowSynchronized(EditUDSRowRequestDTO editUDSRowRequestDTO) throws Exception {
|
||||||
|
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = restBuilder.getService(ColliSpedizioneRESTConsumerService.class);
|
||||||
|
|
||||||
|
var response = colliSpedizioneRESTConsumerService.editUDSRow(editUDSRowRequestDTO)
|
||||||
|
.execute();
|
||||||
|
|
||||||
|
var data = analyzeAnswer(response, "spedizione/editUDSRow");
|
||||||
|
return data.getSavedMtbColr();
|
||||||
|
}
|
||||||
|
|
||||||
public void editUDSRow(EditUDSRowRequestDTO editUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
|
public void editUDSRow(EditUDSRowRequestDTO editUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = restBuilder.getService(ColliSpedizioneRESTConsumerService.class);
|
executorService.execute(() -> {
|
||||||
|
try {
|
||||||
colliSpedizioneRESTConsumerService.editUDSRow(editUDSRowRequestDTO)
|
var response = editUDSRowSynchronized(editUDSRowRequestDTO);
|
||||||
.enqueue(new ManagedErrorCallback<>() {
|
if (onComplete != null) onComplete.run(response);
|
||||||
@Override
|
} catch (Exception ex) {
|
||||||
public void onResponse(Call<ServiceRESTResponse<EditUDSRowResponseDTO>> call, Response<ServiceRESTResponse<EditUDSRowResponseDTO>> response) {
|
if (onFailed != null) onFailed.run(ex);
|
||||||
analyzeAnswer(response, "spedizione/editUDSRow", data -> onComplete.run(data.getSavedMtbColr()), onFailed);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(Call<ServiceRESTResponse<EditUDSRowResponseDTO>> call, @NonNull final Exception e) {
|
|
||||||
onFailed.run(e);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void deleteUDSRowSynchronized(DeleteUDSRowRequestDTO deleteUDSRowRequestDTO) throws Exception {
|
||||||
|
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = restBuilder.getService(ColliSpedizioneRESTConsumerService.class);
|
||||||
|
|
||||||
|
var response = colliSpedizioneRESTConsumerService.deleteUDSRow(deleteUDSRowRequestDTO)
|
||||||
|
.execute();
|
||||||
|
|
||||||
|
analyzeAnswer(response, "spedizione/deleteUDSRow");
|
||||||
|
}
|
||||||
|
|
||||||
public void deleteUDSRow(DeleteUDSRowRequestDTO deleteUDSRowRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
public void deleteUDSRow(DeleteUDSRowRequestDTO deleteUDSRowRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = restBuilder.getService(ColliSpedizioneRESTConsumerService.class);
|
executorService.execute(() -> {
|
||||||
|
try {
|
||||||
colliSpedizioneRESTConsumerService.deleteUDSRow(deleteUDSRowRequestDTO)
|
deleteUDSRowSynchronized(deleteUDSRowRequestDTO);
|
||||||
.enqueue(new ManagedErrorCallback<>() {
|
if (onComplete != null) onComplete.run();
|
||||||
@Override
|
} catch (Exception ex) {
|
||||||
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
|
if (onFailed != null) onFailed.run(ex);
|
||||||
analyzeAnswer(response, "spedizione/deleteUDSRow", data -> onComplete.run(), onFailed);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) {
|
|
||||||
onFailed.run(e);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public DuplicateUDSResponseDTO duplicateUDSSynchronized(DuplicateUDSRequestDTO duplicateUDSRequestDTO) throws Exception {
|
||||||
|
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = restBuilder.getService(ColliSpedizioneRESTConsumerService.class);
|
||||||
|
|
||||||
|
var response = colliSpedizioneRESTConsumerService.duplicateUDS(duplicateUDSRequestDTO)
|
||||||
|
.execute();
|
||||||
|
|
||||||
|
var data = analyzeAnswer(response, "spedizione/duplicateUDS");
|
||||||
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void duplicateUDS(DuplicateUDSRequestDTO duplicateUDSRequestDTO, RunnableArgs<DuplicateUDSResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
public void duplicateUDS(DuplicateUDSRequestDTO duplicateUDSRequestDTO, RunnableArgs<DuplicateUDSResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = restBuilder.getService(ColliSpedizioneRESTConsumerService.class);
|
executorService.execute(() -> {
|
||||||
|
try {
|
||||||
colliSpedizioneRESTConsumerService.duplicateUDS(duplicateUDSRequestDTO)
|
var data = duplicateUDSSynchronized(duplicateUDSRequestDTO);
|
||||||
.enqueue(new ManagedErrorCallback<>() {
|
if (onComplete != null) onComplete.run(data);
|
||||||
@Override
|
} catch (Exception ex) {
|
||||||
public void onResponse(@NonNull Call<ServiceRESTResponse<DuplicateUDSResponseDTO>> call, @NonNull Response<ServiceRESTResponse<DuplicateUDSResponseDTO>> response) {
|
if (onFailed != null) onFailed.run(ex);
|
||||||
analyzeAnswer(response, "spedizione/duplicateUDS", onComplete, onFailed);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(@NonNull Call<ServiceRESTResponse<DuplicateUDSResponseDTO>> call, @NonNull final Exception e) {
|
|
||||||
onFailed.run(new Exception());
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import java.lang.reflect.Type;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
@@ -18,34 +19,42 @@ import it.integry.integrywmsnative.core.utility.UtilityString;
|
|||||||
@Singleton
|
@Singleton
|
||||||
public class CommessaRESTConsumer extends _BaseRESTConsumer {
|
public class CommessaRESTConsumer extends _BaseRESTConsumer {
|
||||||
|
|
||||||
|
private final ExecutorService executorService;
|
||||||
private final SystemRESTConsumer systemRESTConsumer;
|
private final SystemRESTConsumer systemRESTConsumer;
|
||||||
|
|
||||||
public CommessaRESTConsumer(SystemRESTConsumer systemRESTConsumer) {
|
public CommessaRESTConsumer(ExecutorService executorService, SystemRESTConsumer systemRESTConsumer) {
|
||||||
|
this.executorService = executorService;
|
||||||
this.systemRESTConsumer = systemRESTConsumer;
|
this.systemRESTConsumer = systemRESTConsumer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void getJtbComts(List<String> itemsToFind, RunnableArgs<List<JtbComt>> onComplete, RunnableArgs<Exception> onFailed) {
|
public List<JtbComt> getJtbComtsSynchronized(List<String> itemsToFind) throws Exception {
|
||||||
var whereCondMap = itemsToFind.stream()
|
List<HashMap<String, Object>> whereCondMap = itemsToFind.stream()
|
||||||
.filter(x -> !UtilityString.isNullOrEmpty(x))
|
.filter(x -> !UtilityString.isNullOrEmpty(x))
|
||||||
.map(x -> {
|
.map(x -> new HashMap<String, Object>() {{
|
||||||
HashMap<String, Object> codJcom = new HashMap<>() {{
|
|
||||||
put("cod_jcom", x);
|
put("cod_jcom", x);
|
||||||
}};
|
}})
|
||||||
return codJcom;
|
|
||||||
})
|
|
||||||
.collect(Collectors.toUnmodifiableList());
|
.collect(Collectors.toUnmodifiableList());
|
||||||
|
|
||||||
if(whereCondMap.isEmpty()) {
|
if(whereCondMap.isEmpty()) {
|
||||||
onComplete.run(new ArrayList<>());
|
return new ArrayList<>();
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var whereCond = " WHERE " + UtilityQuery.concatFieldListInWhereCond(whereCondMap);
|
var whereCond = " WHERE " + UtilityQuery.concatFieldListInWhereCond(whereCondMap);
|
||||||
|
|
||||||
Type typeOfObjectsList = new TypeToken<ArrayList<JtbComt>>() {}.getType();
|
Type typeOfObjectsList = new TypeToken<ArrayList<JtbComt>>() {}.getType();
|
||||||
this.systemRESTConsumer.processSql("SELECT * FROM jtb_comt " + whereCond, typeOfObjectsList, onComplete, onFailed);
|
return this.systemRESTConsumer.processSqlSynchronized("SELECT * FROM jtb_comt " + whereCond, typeOfObjectsList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void getJtbComts(List<String> itemsToFind, RunnableArgs<List<JtbComt>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
|
executorService.execute(() -> {
|
||||||
|
try {
|
||||||
|
var data = getJtbComtsSynchronized(itemsToFind);
|
||||||
|
if (onComplete != null) onComplete.run(data);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
if (onFailed != null) onFailed.run(ex);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,26 +5,26 @@ import com.google.gson.reflect.TypeToken;
|
|||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
|
||||||
import it.integry.integrywmsnative.core.model.MtbDepo;
|
import it.integry.integrywmsnative.core.model.MtbDepo;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class DepositoRESTConsumer extends _BaseRESTConsumer {
|
public class DepositoRESTConsumer extends _BaseRESTConsumer {
|
||||||
|
|
||||||
private final EntityRESTConsumer entityRESTConsumer;
|
private final ExecutorService executorService;
|
||||||
private final SystemRESTConsumer systemRESTConsumer;
|
private final SystemRESTConsumer systemRESTConsumer;
|
||||||
|
|
||||||
public DepositoRESTConsumer(EntityRESTConsumer entityRESTConsumer, SystemRESTConsumer systemRESTConsumer) {
|
public DepositoRESTConsumer(ExecutorService executorService, SystemRESTConsumer systemRESTConsumer) {
|
||||||
this.entityRESTConsumer = entityRESTConsumer;
|
this.executorService = executorService;
|
||||||
this.systemRESTConsumer = systemRESTConsumer;
|
this.systemRESTConsumer = systemRESTConsumer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getAll(RunnableArgs<List<MtbDepo>> onComplete, RunnableArgs<Exception> onFailed) {
|
public List<MtbDepo> getAllSynchronized() throws Exception {
|
||||||
Type typeOfObjectsList = new TypeToken<ArrayList<MtbDepo>>() {
|
Type typeOfObjectsList = new TypeToken<ArrayList<MtbDepo>>() {
|
||||||
}.getType();
|
}.getType();
|
||||||
this.systemRESTConsumer.processSql("SELECT * FROM mtb_depo", typeOfObjectsList, onComplete, onFailed);
|
return this.systemRESTConsumer.processSqlSynchronized("SELECT * FROM mtb_depo", typeOfObjectsList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import com.google.gson.JsonObject;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
@@ -26,72 +27,62 @@ import retrofit2.Response;
|
|||||||
public class EntityRESTConsumer extends _BaseRESTConsumer {
|
public class EntityRESTConsumer extends _BaseRESTConsumer {
|
||||||
|
|
||||||
private final RESTBuilder restBuilder;
|
private final RESTBuilder restBuilder;
|
||||||
|
private final ExecutorService executorService;
|
||||||
|
|
||||||
public EntityRESTConsumer(RESTBuilder restBuilder) {
|
public EntityRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService) {
|
||||||
this.restBuilder = restBuilder;
|
this.restBuilder = restBuilder;
|
||||||
|
this.executorService = executorService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T extends EntityBase> void processEntity(T entityToSave, final ISimpleOperationCallback<T> callback, Class<T> type) {
|
public <T extends EntityBase> T processEntitySynchronized(T entityToSave, Class<T> type) throws Exception {
|
||||||
|
|
||||||
RunnableArgs<Exception> tmpFailed = ex -> {
|
|
||||||
if (callback != null) callback.onFailed(ex);
|
|
||||||
};
|
|
||||||
|
|
||||||
EntityRESTConsumerService service = restBuilder.getService(EntityRESTConsumerService.class);
|
EntityRESTConsumerService service = restBuilder.getService(EntityRESTConsumerService.class);
|
||||||
service
|
var response = service
|
||||||
.processEntity(entityToSave)
|
.processEntity(entityToSave)
|
||||||
.enqueue(new ManagedErrorCallback<>() {
|
.execute();
|
||||||
@Override
|
|
||||||
public void onResponse(Call<ServiceRESTResponse<JsonObject>> call, Response<ServiceRESTResponse<JsonObject>> response) {
|
|
||||||
if (response.isSuccessful()) {
|
|
||||||
|
|
||||||
|
if (response.isSuccessful()) {
|
||||||
if (response.body() != null) {
|
if (response.body() != null) {
|
||||||
if (response.body().getEsito() == EsitoType.OK) {
|
if (response.body().getEsito() == EsitoType.OK) {
|
||||||
Gson gson = UtilityGson.createObject();
|
Gson gson = UtilityGson.createObject();
|
||||||
T object = gson.fromJson(response.body().getEntity(), type);
|
|
||||||
|
|
||||||
callback.onSuccess(object);
|
return gson.fromJson(response.body().getEntity(), type);
|
||||||
} else {
|
} else {
|
||||||
Log.e("EntityRESTConsumer", response.body().getErrorMessage());
|
Log.e("EntityRESTConsumer", response.body().getErrorMessage());
|
||||||
tmpFailed.run(new Exception(response.body().getErrorMessage()));
|
throw new Exception(response.body().getErrorMessage());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.e("EntityRESTConsumer", response.message());
|
Log.e("EntityRESTConsumer", response.message());
|
||||||
tmpFailed.run(new Exception(response.message()));
|
throw new Exception(response.message());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.e("EntityRESTConsumer", "Status " + response.code() + ": " + response.message());
|
Log.e("EntityRESTConsumer", "Status " + response.code() + ": " + response.message());
|
||||||
tmpFailed.run(new Exception("Status " + response.code() + ": " + response.message()));
|
throw new Exception("Status " + response.code() + ": " + response.message());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public <T extends EntityBase> void processEntity(T entityToSave, final ISimpleOperationCallback<T> callback, Class<T> type) {
|
||||||
public void onFailure(Call<ServiceRESTResponse<JsonObject>> call, @NonNull final Exception e) {
|
executorService.execute(() -> {
|
||||||
tmpFailed.run(e);
|
try {
|
||||||
|
var data = processEntitySynchronized(entityToSave, type);
|
||||||
|
if (callback != null) callback.onSuccess(data);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
if (callback != null) callback.onFailed(ex);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T extends EntityBase> void processEntityList(List<T> entitiesToSave, boolean singleTransaction, Class<T> type, final RunnableArgs<List<T>> onComplete, final RunnableArgs<Exception> onFailed) {
|
public <T extends EntityBase> List<T> processEntityListSynchronized(List<T> entitiesToSave, boolean singleTransaction, Class<T> type) throws Exception {
|
||||||
|
|
||||||
RunnableArgs<Exception> tmpFailed = ex -> {
|
|
||||||
// UtilityExceptions.defaultException(null, ex);
|
|
||||||
if (onFailed != null) onFailed.run(ex);
|
|
||||||
};
|
|
||||||
|
|
||||||
EntityRESTConsumerService service = restBuilder.getService(EntityRESTConsumerService.class);
|
EntityRESTConsumerService service = restBuilder.getService(EntityRESTConsumerService.class);
|
||||||
Call<List<ServiceRESTResponse<JsonObject>>> request = service.processEntityList(singleTransaction, entitiesToSave);
|
var response = service.processEntityList(singleTransaction, entitiesToSave)
|
||||||
request.enqueue(new ManagedErrorCallback<>() {
|
.execute();
|
||||||
@Override
|
|
||||||
public void onResponse(Call<List<ServiceRESTResponse<JsonObject>>> call, Response<List<ServiceRESTResponse<JsonObject>>> response) {
|
|
||||||
if (response.isSuccessful()) {
|
if (response.isSuccessful()) {
|
||||||
|
|
||||||
if (response.body() != null) {
|
if (response.body() != null) {
|
||||||
|
|
||||||
ArrayList<T> responseList = new ArrayList<>();
|
ArrayList<T> responseList = new ArrayList<>();
|
||||||
Gson gson = UtilityGson.createObject();
|
Gson gson = UtilityGson.createObject();
|
||||||
// Type typeOfObjectsList = new TypeToken<T>() {}.getType();
|
|
||||||
|
|
||||||
for (ServiceRESTResponse<JsonObject> jsonSingleObject : response.body()) {
|
for (ServiceRESTResponse<JsonObject> jsonSingleObject : response.body()) {
|
||||||
|
|
||||||
@@ -100,26 +91,29 @@ public class EntityRESTConsumer extends _BaseRESTConsumer {
|
|||||||
responseList.add(gson.fromJson(jsonText, type));
|
responseList.add(gson.fromJson(jsonText, type));
|
||||||
} else {
|
} else {
|
||||||
Log.e("EntityRESTConsumer", jsonSingleObject.getErrorMessage());
|
Log.e("EntityRESTConsumer", jsonSingleObject.getErrorMessage());
|
||||||
tmpFailed.run(new Exception(jsonSingleObject.getErrorMessage()));
|
throw new Exception(jsonSingleObject.getErrorMessage());
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onComplete.run(responseList);
|
return responseList;
|
||||||
} else {
|
} else {
|
||||||
Log.e("EntityRESTConsumer", response.message());
|
Log.e("EntityRESTConsumer", response.message());
|
||||||
tmpFailed.run(new Exception(response.message()));
|
throw new Exception(response.message());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.e("EntityRESTConsumer", "Status " + response.code() + ": " + response.message());
|
Log.e("EntityRESTConsumer", "Status " + response.code() + ": " + response.message());
|
||||||
tmpFailed.run(new Exception("Status " + response.code() + ": " + response.message()));
|
throw new Exception("Status " + response.code() + ": " + response.message());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
}
|
||||||
public void onFailure(Call<List<ServiceRESTResponse<JsonObject>>> call, @NonNull final Exception e) {
|
|
||||||
tmpFailed.run(e);
|
public <T extends EntityBase> void processEntityList(List<T> entitiesToSave, boolean singleTransaction, Class<T> type, final RunnableArgs<List<T>> onComplete, final RunnableArgs<Exception> onFailed) {
|
||||||
|
executorService.execute(() -> {
|
||||||
|
try {
|
||||||
|
var data = processEntityListSynchronized(entitiesToSave, singleTransaction, type);
|
||||||
|
if (onComplete != null) onComplete.run(data);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
if (onFailed != null) onFailed.run(ex);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -79,15 +79,13 @@ public class GestSetupRESTConsumer extends _BaseRESTConsumer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void getValues(String codMdep, List<StbGestSetupReader> stbGestSetupList, RunnableArgs<List<StbGestSetupReader>> onComplete, RunnableArgs<Exception> onFailed) {
|
public List<StbGestSetupReader> getValuesSynchronized(String codMdep, List<StbGestSetupReader> stbGestSetupList) throws Exception {
|
||||||
var stbGestSetups = stbGestSetupList.stream().map(x -> (StbGestSetup) x).collect(Collectors.toList());
|
var stbGestSetups = stbGestSetupList.stream().map(x -> (StbGestSetup) x).collect(Collectors.toList());
|
||||||
|
|
||||||
GestSetupRESTConsumerService service = restBuilder.getService(GestSetupRESTConsumerService.class);
|
GestSetupRESTConsumerService service = restBuilder.getService(GestSetupRESTConsumerService.class);
|
||||||
service.getGestSetupValues(codMdep, stbGestSetups).enqueue(new ManagedErrorCallback<>() {
|
var response = service.getGestSetupValues(codMdep, stbGestSetups)
|
||||||
@Override
|
.execute();
|
||||||
public void onResponse(Call<ServiceRESTResponse<List<StbGestSetup>>> call, Response<ServiceRESTResponse<List<StbGestSetup>>> response) {
|
var data = analyzeAnswer(response, "GestSetup");
|
||||||
analyzeAnswer(response, "GestSetup", data -> {
|
|
||||||
|
|
||||||
for (StbGestSetup stbGestSetup : data) {
|
for (StbGestSetup stbGestSetup : data) {
|
||||||
stbGestSetupList.stream().filter(x -> stbGestSetup.getGestName().equalsIgnoreCase(x.getGestName()) &&
|
stbGestSetupList.stream().filter(x -> stbGestSetup.getGestName().equalsIgnoreCase(x.getGestName()) &&
|
||||||
stbGestSetup.getSection().equalsIgnoreCase(x.getSection()) &&
|
stbGestSetup.getSection().equalsIgnoreCase(x.getSection()) &&
|
||||||
@@ -96,15 +94,7 @@ public class GestSetupRESTConsumer extends _BaseRESTConsumer {
|
|||||||
.ifPresent(x -> x.setValue(stbGestSetup.getValue()));
|
.ifPresent(x -> x.setValue(stbGestSetup.getValue()));
|
||||||
}
|
}
|
||||||
|
|
||||||
onComplete.run(stbGestSetupList);
|
return stbGestSetupList;
|
||||||
}, onFailed);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(Call<ServiceRESTResponse<List<StbGestSetup>>> call, @NonNull final Exception e) {
|
|
||||||
if (onFailed != null) onFailed.run(e);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package it.integry.integrywmsnative.core.rest.consumers;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||||
|
import it.integry.integrywmsnative.core.rest.model.pv.GiacenzaPvDTO;
|
||||||
|
import it.integry.integrywmsnative.core.rest.model.pv.SaveNewVerificaRequestDTO;
|
||||||
|
|
||||||
|
public class GiacenzaPvRESTConsumer extends _BaseRESTConsumer {
|
||||||
|
|
||||||
|
|
||||||
|
private final RESTBuilder restBuilder;
|
||||||
|
private final ExecutorService executorService;
|
||||||
|
|
||||||
|
public GiacenzaPvRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService) {
|
||||||
|
this.restBuilder = restBuilder;
|
||||||
|
this.executorService = executorService;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public List<GiacenzaPvDTO> retrieveGiacenzeSynchronized(String codMdep) throws Exception {
|
||||||
|
GiacenzaPvRESTConsumerService giacenzaPvRESTConsumerService = restBuilder.getService(GiacenzaPvRESTConsumerService.class, 120);
|
||||||
|
var response = giacenzaPvRESTConsumerService.retrieve(codMdep)
|
||||||
|
.execute();
|
||||||
|
|
||||||
|
var giacenzeList = analyzeAnswer(response, "retrieve-giacenze-pv");
|
||||||
|
|
||||||
|
return giacenzeList != null ? giacenzeList : new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void saveNewVerificaSynchronized(SaveNewVerificaRequestDTO saveNewVerificaRequest) throws Exception {
|
||||||
|
GiacenzaPvRESTConsumerService giacenzaPvRESTConsumerService = restBuilder.getService(GiacenzaPvRESTConsumerService.class, 0);
|
||||||
|
var response = giacenzaPvRESTConsumerService.saveNewVerifica(saveNewVerificaRequest)
|
||||||
|
.execute();
|
||||||
|
|
||||||
|
analyzeAnswer(response, "save-verifica-pv");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package it.integry.integrywmsnative.core.rest.consumers;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||||
|
import it.integry.integrywmsnative.core.rest.model.pv.GiacenzaPvDTO;
|
||||||
|
import it.integry.integrywmsnative.core.rest.model.pv.SaveNewVerificaRequestDTO;
|
||||||
|
import retrofit2.Call;
|
||||||
|
import retrofit2.http.Body;
|
||||||
|
import retrofit2.http.GET;
|
||||||
|
import retrofit2.http.POST;
|
||||||
|
import retrofit2.http.Query;
|
||||||
|
|
||||||
|
public interface GiacenzaPvRESTConsumerService {
|
||||||
|
|
||||||
|
@GET("wms/pv/verifica_giacenze/retrieve")
|
||||||
|
Call<ServiceRESTResponse<List<GiacenzaPvDTO>>> retrieve(@Query("codMdep") String codMdep);
|
||||||
|
|
||||||
|
|
||||||
|
@POST("wms/pv/verifica_giacenze/save_new_verifica")
|
||||||
|
Call<ServiceRESTResponse<Void>> saveNewVerifica(@Body SaveNewVerificaRequestDTO saveNewVerificaRequest);
|
||||||
|
}
|
||||||
@@ -7,6 +7,8 @@ import com.annimon.stream.Stream;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
@@ -28,29 +30,30 @@ import retrofit2.Response;
|
|||||||
public class GiacenzaRESTConsumer extends _BaseRESTConsumer {
|
public class GiacenzaRESTConsumer extends _BaseRESTConsumer {
|
||||||
|
|
||||||
private final RESTBuilder restBuilder;
|
private final RESTBuilder restBuilder;
|
||||||
|
private final ExecutorService executorService;
|
||||||
private final ArticoloRESTConsumer mArticoloRESTConsumer;
|
private final ArticoloRESTConsumer mArticoloRESTConsumer;
|
||||||
|
|
||||||
public GiacenzaRESTConsumer(RESTBuilder restBuilder, ArticoloRESTConsumer articoloRESTConsumer) {
|
public GiacenzaRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService, ArticoloRESTConsumer articoloRESTConsumer) {
|
||||||
this.restBuilder = restBuilder;
|
this.restBuilder = restBuilder;
|
||||||
|
this.executorService = executorService;
|
||||||
this.mArticoloRESTConsumer = articoloRESTConsumer;
|
this.mArticoloRESTConsumer = articoloRESTConsumer;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getGiacenzeInPosizione(MtbDepoPosizione posizione, RunnableArgs<List<MvwSitArtUdcDetInventario>> onComplete, RunnableArgs<Exception> onFailed) {
|
public List<MvwSitArtUdcDetInventario> getGiacenzeInPosizioneSynchronized(MtbDepoPosizione posizione) throws Exception {
|
||||||
GiacenzaRESTConsumerService giacenzaRESTConsumerService = restBuilder.getService(GiacenzaRESTConsumerService.class);
|
GiacenzaRESTConsumerService giacenzaRESTConsumerService = restBuilder.getService(GiacenzaRESTConsumerService.class);
|
||||||
giacenzaRESTConsumerService.retrieveAvailableItems(posizione.getPosizione()).enqueue(new ManagedErrorCallback<>() {
|
var response = giacenzaRESTConsumerService.retrieveAvailableItems(posizione.getPosizione())
|
||||||
@Override
|
.execute();
|
||||||
public void onResponse(Call<ServiceRESTResponse<List<MvwSitArtUdcDetInventario>>> call, Response<ServiceRESTResponse<List<MvwSitArtUdcDetInventario>>> response) {
|
|
||||||
analyzeAnswer(response, "getGiacenzeInPosizione", inventarioList -> {
|
var inventarioList = analyzeAnswer(response, "getGiacenzeInPosizione");
|
||||||
|
|
||||||
if (inventarioList != null && !inventarioList.isEmpty()) {
|
if (inventarioList != null && !inventarioList.isEmpty()) {
|
||||||
List<String> codMarts = Stream.of(inventarioList)
|
List<String> codMarts = inventarioList.stream()
|
||||||
.map(x -> x.getCodMart().trim())
|
.map(x -> x.getCodMart().trim())
|
||||||
.toList();
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
mArticoloRESTConsumer.getByCodMarts(codMarts, mtbAarts -> {
|
var mtbAarts = mArticoloRESTConsumer.getByCodMartsSynchronized(codMarts);
|
||||||
for (var row : inventarioList) {
|
for (var row : inventarioList) {
|
||||||
|
|
||||||
MtbAart foundMtbAart = null;
|
MtbAart foundMtbAart = null;
|
||||||
Optional<MtbAart> mtbAartOpt = Stream.of(mtbAarts)
|
Optional<MtbAart> mtbAartOpt = Stream.of(mtbAarts)
|
||||||
.filter(x -> x.getCodMart().equalsIgnoreCase(row.getCodMart()))
|
.filter(x -> x.getCodMart().equalsIgnoreCase(row.getCodMart()))
|
||||||
@@ -63,17 +66,19 @@ public class GiacenzaRESTConsumer extends _BaseRESTConsumer {
|
|||||||
row.setMtbAart(foundMtbAart);
|
row.setMtbAart(foundMtbAart);
|
||||||
}
|
}
|
||||||
|
|
||||||
onComplete.run(inventarioList);
|
return inventarioList;
|
||||||
}, onFailed);
|
|
||||||
}else{
|
|
||||||
onComplete.run(new ArrayList<>());
|
|
||||||
}
|
|
||||||
}, onFailed);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
return new ArrayList<>();
|
||||||
public void onFailure(Call<ServiceRESTResponse<List<MvwSitArtUdcDetInventario>>> call, @NonNull final Exception e) {
|
}
|
||||||
onFailed.run(e);
|
|
||||||
|
public void getGiacenzeInPosizione(MtbDepoPosizione posizione, RunnableArgs<List<MvwSitArtUdcDetInventario>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
|
executorService.execute(() -> {
|
||||||
|
try {
|
||||||
|
var result = getGiacenzeInPosizioneSynchronized(posizione);
|
||||||
|
if (onComplete != null) onComplete.run(result);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
if (onFailed != null) onFailed.run(ex);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -164,27 +169,28 @@ public class GiacenzaRESTConsumer extends _BaseRESTConsumer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void getInstantItemSituation(String codMdep, String codMart, String partitaMag, String codJcom, RunnableArgs<InstantItemSituationResponseDto> onComplete, RunnableArgs<Exception> onFailed) {
|
public InstantItemSituationResponseDto getInstantItemSituationSynchronized(String codMdep, String codMart, String partitaMag, String codJcom) throws Exception {
|
||||||
GiacenzaRESTConsumerService giacenzaRESTConsumerService = restBuilder.getService(GiacenzaRESTConsumerService.class);
|
GiacenzaRESTConsumerService giacenzaRESTConsumerService = restBuilder.getService(GiacenzaRESTConsumerService.class);
|
||||||
|
|
||||||
giacenzaRESTConsumerService.retrieveInstantItemSituation(codMdep, codMart, partitaMag, codJcom)
|
var response = giacenzaRESTConsumerService.retrieveInstantItemSituation(codMdep, codMart, partitaMag, codJcom)
|
||||||
.enqueue(new ManagedErrorCallback<>() {
|
.execute();
|
||||||
@Override
|
|
||||||
public void onResponse(Call<ServiceRESTResponse<InstantItemSituationResponseDto>> call, Response<ServiceRESTResponse<InstantItemSituationResponseDto>> response) {
|
|
||||||
analyzeAnswer(response, "getInstantItemSituation", data -> {
|
|
||||||
|
|
||||||
fillInstantItemSituationWithMtbAarts(data, onComplete, onFailed);
|
var data = analyzeAnswer(response, "getInstantItemSituation");
|
||||||
}, onFailed);
|
return fillInstantItemSituationWithMtbAartsSynchronized(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public void getInstantItemSituation(String codMdep, String codMart, String partitaMag, String codJcom, RunnableArgs<InstantItemSituationResponseDto> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
public void onFailure(Call<ServiceRESTResponse<InstantItemSituationResponseDto>> call, @NonNull final Exception e) {
|
executorService.execute(() -> {
|
||||||
onFailed.run(e);
|
try {
|
||||||
|
var response = getInstantItemSituationSynchronized(codMdep, codMart, partitaMag, codJcom);
|
||||||
|
if (onComplete != null) onComplete.run(response);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
if (onFailed != null) onFailed.run(ex);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fillInstantItemSituationWithMtbAarts(InstantItemSituationResponseDto data, RunnableArgs<InstantItemSituationResponseDto> onComplete, RunnableArgs<Exception> onFailed) {
|
private InstantItemSituationResponseDto fillInstantItemSituationWithMtbAartsSynchronized(InstantItemSituationResponseDto data) throws Exception {
|
||||||
var inputCodMarts = new ArrayList<String>();
|
var inputCodMarts = new ArrayList<String>();
|
||||||
|
|
||||||
if (data.getIncomingItems() != null && !data.getIncomingItems().isEmpty()) {
|
if (data.getIncomingItems() != null && !data.getIncomingItems().isEmpty()) {
|
||||||
@@ -200,13 +206,12 @@ public class GiacenzaRESTConsumer extends _BaseRESTConsumer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (inputCodMarts.isEmpty()) {
|
if (inputCodMarts.isEmpty()) {
|
||||||
onComplete.run(data);
|
return null;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mArticoloRESTConsumer.getByCodMarts(inputCodMarts, mtbAarts -> {
|
var mtbAarts = mArticoloRESTConsumer.getByCodMartsSynchronized(inputCodMarts);
|
||||||
|
var newMtbAarts = mArticoloRESTConsumer.fillMtbAartsWithMtbUntMisSynchronized(mtbAarts);
|
||||||
|
|
||||||
mArticoloRESTConsumer.fillMtbAartsWithMtbUntMis(mtbAarts, newMtbAarts -> {
|
|
||||||
if (data.getIncomingItems() != null && !data.getIncomingItems().isEmpty()) {
|
if (data.getIncomingItems() != null && !data.getIncomingItems().isEmpty()) {
|
||||||
for (var item : data.getIncomingItems()) {
|
for (var item : data.getIncomingItems()) {
|
||||||
var mtbAart = Stream.of(newMtbAarts).filter(x -> x.getCodMart().equalsIgnoreCase(item.getCodMart()))
|
var mtbAart = Stream.of(newMtbAarts).filter(x -> x.getCodMart().equalsIgnoreCase(item.getCodMart()))
|
||||||
@@ -227,10 +232,7 @@ public class GiacenzaRESTConsumer extends _BaseRESTConsumer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onComplete.run(data);
|
return data;
|
||||||
}, onFailed);
|
|
||||||
|
|
||||||
}, onFailed);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ package it.integry.integrywmsnative.core.rest.consumers;
|
|||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
@@ -18,24 +20,29 @@ import retrofit2.Response;
|
|||||||
public class MagazzinoAutomaticoRESTConsumer extends _BaseRESTConsumer {
|
public class MagazzinoAutomaticoRESTConsumer extends _BaseRESTConsumer {
|
||||||
|
|
||||||
|
|
||||||
|
private final ExecutorService executorService;
|
||||||
private final RESTBuilder restBuilder;
|
private final RESTBuilder restBuilder;
|
||||||
|
|
||||||
public MagazzinoAutomaticoRESTConsumer(RESTBuilder restBuilder) {
|
public MagazzinoAutomaticoRESTConsumer(ExecutorService executorService, RESTBuilder restBuilder) {
|
||||||
|
this.executorService = executorService;
|
||||||
this.restBuilder = restBuilder;
|
this.restBuilder = restBuilder;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void pickItems(MtbDepoPosizione posizione, MagazzinoAutomaticoPickItemsRequestDTO magazzinoAutomaticoPickItemsRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
public void pickItemsSynchronized(MtbDepoPosizione posizione, MagazzinoAutomaticoPickItemsRequestDTO magazzinoAutomaticoPickItemsRequestDTO) throws Exception {
|
||||||
MagazzinoAutomaticoRESTConsumerService magazzinoAutomaticoRESTConsumerService = restBuilder.getService(MagazzinoAutomaticoRESTConsumerService.class);
|
MagazzinoAutomaticoRESTConsumerService magazzinoAutomaticoRESTConsumerService = restBuilder.getService(MagazzinoAutomaticoRESTConsumerService.class);
|
||||||
magazzinoAutomaticoRESTConsumerService.pickItems(posizione.getPosizione(), magazzinoAutomaticoPickItemsRequestDTO)
|
var response = magazzinoAutomaticoRESTConsumerService.pickItems(posizione.getPosizione(), magazzinoAutomaticoPickItemsRequestDTO)
|
||||||
.enqueue(new ManagedErrorCallback<>() {
|
.execute();
|
||||||
@Override
|
|
||||||
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
|
analyzeAnswer(response, "magazzino-automatico/pickItems");
|
||||||
analyzeAnswer(response, "magazzino-automatico/pickItems", data -> onComplete.run(), onFailed);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public void pickItems(MtbDepoPosizione posizione, MagazzinoAutomaticoPickItemsRequestDTO magazzinoAutomaticoPickItemsRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) {
|
executorService.execute(() -> {
|
||||||
onFailed.run(e);
|
try {
|
||||||
|
pickItemsSynchronized(posizione, magazzinoAutomaticoPickItemsRequestDTO);
|
||||||
|
if (onComplete != null) onComplete.run();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
if (onFailed != null) onFailed.run(ex);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -5,13 +5,13 @@ import androidx.annotation.NonNull;
|
|||||||
import com.annimon.stream.Optional;
|
import com.annimon.stream.Optional;
|
||||||
import com.annimon.stream.Stream;
|
import com.annimon.stream.Stream;
|
||||||
import com.google.gson.reflect.TypeToken;
|
import com.google.gson.reflect.TypeToken;
|
||||||
import com.orhanobut.logger.Logger;
|
|
||||||
|
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
@@ -39,12 +39,14 @@ import retrofit2.Response;
|
|||||||
public class OrdiniRESTConsumer extends _BaseRESTConsumer {
|
public class OrdiniRESTConsumer extends _BaseRESTConsumer {
|
||||||
|
|
||||||
private final RESTBuilder restBuilder;
|
private final RESTBuilder restBuilder;
|
||||||
|
private final ExecutorService executorService;
|
||||||
|
|
||||||
private final SystemRESTConsumer mSystemRESTConsumer;
|
private final SystemRESTConsumer mSystemRESTConsumer;
|
||||||
private final EntityRESTConsumer mEntityRESTConsumer;
|
private final EntityRESTConsumer mEntityRESTConsumer;
|
||||||
|
|
||||||
public OrdiniRESTConsumer(RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer, EntityRESTConsumer entityRESTConsumer) {
|
public OrdiniRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService,SystemRESTConsumer systemRESTConsumer, EntityRESTConsumer entityRESTConsumer) {
|
||||||
this.restBuilder = restBuilder;
|
this.restBuilder = restBuilder;
|
||||||
|
this.executorService = executorService;
|
||||||
this.mSystemRESTConsumer = systemRESTConsumer;
|
this.mSystemRESTConsumer = systemRESTConsumer;
|
||||||
this.mEntityRESTConsumer = entityRESTConsumer;
|
this.mEntityRESTConsumer = entityRESTConsumer;
|
||||||
}
|
}
|
||||||
@@ -61,7 +63,7 @@ public class OrdiniRESTConsumer extends _BaseRESTConsumer {
|
|||||||
|
|
||||||
for (PickingObjectDTO pickingObjectDTO : pickingObjects) {
|
for (PickingObjectDTO pickingObjectDTO : pickingObjects) {
|
||||||
for (MtbColt mtbColt : pickingObjectDTO.getMtbColts()) {
|
for (MtbColt mtbColt : pickingObjectDTO.getMtbColts()) {
|
||||||
Stream.of(mtbColt.getMtbColr())
|
mtbColt.getMtbColr().stream()
|
||||||
.filter(x -> !UtilityString.isNullOrEmpty(x.getPartitaMag()))
|
.filter(x -> !UtilityString.isNullOrEmpty(x.getPartitaMag()))
|
||||||
.forEach(x -> {
|
.forEach(x -> {
|
||||||
|
|
||||||
@@ -125,26 +127,22 @@ public class OrdiniRESTConsumer extends _BaseRESTConsumer {
|
|||||||
this.mEntityRESTConsumer.processEntityList(partitaMag, true, MtbPartitaMag.class, onComplete, onFailed);
|
this.mEntityRESTConsumer.processEntityList(partitaMag, true, MtbPartitaMag.class, onComplete, onFailed);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getOrdiniInevasi(String codMdep, GestioneEnum gestione, RunnableArgs<List<OrdineUscitaInevasoDTO>> onComplete, RunnableArgs<Exception> onFailed) {
|
public List<OrdineUscitaInevasoDTO> getOrdiniInevasiSynchronized(String codMdep, GestioneEnum gestione) throws Exception {
|
||||||
|
|
||||||
OrdiniRESTConsumerService service = restBuilder.getService(OrdiniRESTConsumerService.class);
|
OrdiniRESTConsumerService service = restBuilder.getService(OrdiniRESTConsumerService.class);
|
||||||
|
|
||||||
service.getOrdiniInevasi(codMdep, gestione.getText())
|
var response = service.getOrdiniInevasi(codMdep, gestione.getText())
|
||||||
.enqueue(new ManagedErrorCallback<>() {
|
.execute();
|
||||||
@Override
|
var data = analyzeAnswer(response, "getOrdiniInevasi");
|
||||||
public void onResponse(Call<ServiceRESTResponse<List<OrdineUscitaInevasoDTO>>> call, Response<ServiceRESTResponse<List<OrdineUscitaInevasoDTO>>> response) {
|
return data == null ? new ArrayList<>() : data;
|
||||||
analyzeAnswer(response, "getOrdiniInevasi", responseDtoList -> {
|
|
||||||
if (responseDtoList == null) responseDtoList = new ArrayList<>();
|
|
||||||
onComplete.run(responseDtoList);
|
|
||||||
}, ex -> {
|
|
||||||
Logger.e(ex, "Errore durante il caricamento degli ordini di lavorazione");
|
|
||||||
if (onFailed != null) onFailed.run(ex);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public void getOrdiniInevasi(String codMdep, GestioneEnum gestione, RunnableArgs<List<OrdineUscitaInevasoDTO>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
public void onFailure(Call<ServiceRESTResponse<List<OrdineUscitaInevasoDTO>>> call, @NonNull final Exception e) {
|
executorService.execute(() -> {
|
||||||
if (onFailed != null) onFailed.run(e);
|
try {
|
||||||
|
var result = getOrdiniInevasiSynchronized(codMdep, gestione);
|
||||||
|
if (onComplete != null) onComplete.run(result);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
if (onFailed != null) onFailed.run(ex);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
package it.integry.integrywmsnative.core.rest.consumers;
|
package it.integry.integrywmsnative.core.rest.consumers;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
|
|
||||||
import com.google.gson.reflect.TypeToken;
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
@@ -14,44 +13,33 @@ import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
|||||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||||
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
||||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||||
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
|
|
||||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityDB;
|
import it.integry.integrywmsnative.core.utility.UtilityDB;
|
||||||
import retrofit2.Call;
|
|
||||||
import retrofit2.Response;
|
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class PosizioniRESTConsumer extends _BaseRESTConsumer {
|
public class PosizioniRESTConsumer extends _BaseRESTConsumer {
|
||||||
|
|
||||||
private final RESTBuilder restBuilder;
|
private final RESTBuilder restBuilder;
|
||||||
private final SystemRESTConsumer mSystemRESTConsumer;
|
private final SystemRESTConsumer mSystemRESTConsumer;
|
||||||
|
private final ExecutorService executorService;
|
||||||
|
|
||||||
public PosizioniRESTConsumer(RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer) {
|
public PosizioniRESTConsumer(RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer, ExecutorService executorService) {
|
||||||
this.restBuilder = restBuilder;
|
this.restBuilder = restBuilder;
|
||||||
this.mSystemRESTConsumer = systemRESTConsumer;
|
this.mSystemRESTConsumer = systemRESTConsumer;
|
||||||
|
this.executorService = executorService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getAvailablePosizioni(RunnableArgs<List<MtbDepoPosizione>> onComplete, RunnableArgs<Exception> onFailed) {
|
public List<MtbDepoPosizione> getAvailablePosizioniSynchronized() throws Exception {
|
||||||
String codMdep = null;
|
String codMdep = null;
|
||||||
|
|
||||||
PosizioniRESTConsumerService posizioniRESTConsumerService = restBuilder.getService(PosizioniRESTConsumerService.class);
|
PosizioniRESTConsumerService posizioniRESTConsumerService = restBuilder.getService(PosizioniRESTConsumerService.class);
|
||||||
posizioniRESTConsumerService.getAvailablePosizioni(codMdep).enqueue(new ManagedErrorCallback<>() {
|
var response = posizioniRESTConsumerService.getAvailablePosizioni(codMdep)
|
||||||
@Override
|
.execute();
|
||||||
public void onResponse(Call<ServiceRESTResponse<List<MtbDepoPosizione>>> call, Response<ServiceRESTResponse<List<MtbDepoPosizione>>> response) {
|
|
||||||
analyzeAnswer(response, "getAvailablePosizioni", (m) -> {
|
var data = analyzeAnswer(response, "getAvailablePosizioni");
|
||||||
onComplete.run(response.body().getDto());
|
return response.body().getDto();
|
||||||
}, onFailed);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public ArrayList<MtbColt> getBancaliInPosizioneSynchronized(MtbDepoPosizione mtbDepoPosizione) throws Exception {
|
||||||
public void onFailure(Call<ServiceRESTResponse<List<MtbDepoPosizione>>> call, @NonNull final Exception e) {
|
|
||||||
onFailed.run(e);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void getBancaliInPosizione(MtbDepoPosizione mtbDepoPosizione, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
|
|
||||||
String sql = "SELECT * FROM mtb_colt " +
|
String sql = "SELECT * FROM mtb_colt " +
|
||||||
"WHERE segno > 0 " +
|
"WHERE segno > 0 " +
|
||||||
"AND cod_mdep = " + UtilityDB.valueToString(mtbDepoPosizione.getCodMdep()) + " " +
|
"AND cod_mdep = " + UtilityDB.valueToString(mtbDepoPosizione.getCodMdep()) + " " +
|
||||||
@@ -61,10 +49,18 @@ public class PosizioniRESTConsumer extends _BaseRESTConsumer {
|
|||||||
Type typeOfObjectsList = new TypeToken<ArrayList<MtbColt>>() {
|
Type typeOfObjectsList = new TypeToken<ArrayList<MtbColt>>() {
|
||||||
}.getType();
|
}.getType();
|
||||||
|
|
||||||
mSystemRESTConsumer.<ArrayList<MtbColt>>processSql(sql, typeOfObjectsList, value -> {
|
var value = mSystemRESTConsumer.<ArrayList<MtbColt>>processSqlSynchronized(sql, typeOfObjectsList);
|
||||||
if (onComplete != null) onComplete.run(value);
|
return value;
|
||||||
}, ex -> {
|
}
|
||||||
|
|
||||||
|
public void getBancaliInPosizione(MtbDepoPosizione mtbDepoPosizione, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
|
executorService.execute(() -> {
|
||||||
|
try {
|
||||||
|
var result = getBancaliInPosizioneSynchronized(mtbDepoPosizione);
|
||||||
|
if (onComplete != null) onComplete.run(result);
|
||||||
|
} catch (Exception ex) {
|
||||||
if (onFailed != null) onFailed.run(ex);
|
if (onFailed != null) onFailed.run(ex);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -123,27 +123,16 @@ public class PrinterRESTConsumer extends _BaseRESTConsumer {
|
|||||||
printReportType(reportType, codMdep, null, params, onComplete, onFailed);
|
printReportType(reportType, codMdep, null, params, onComplete, onFailed);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void printClosedOrders(PrintOrderCloseDTO dto, String codMdep, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
public void printClosedOrdersSynchronized(PrintOrderCloseDTO dto, String codMdep) throws Exception {
|
||||||
if (BuildConfig.DEBUG) {
|
if (BuildConfig.DEBUG) {
|
||||||
onComplete.run();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
PrinterRESTConsumerService printerService = restBuilder.getService(PrinterRESTConsumerService.class, 240);
|
PrinterRESTConsumerService printerService = restBuilder.getService(PrinterRESTConsumerService.class, 240);
|
||||||
Call<ServiceRESTResponse<Object>> callable = printerService.printClosedOrders(codMdep, dto);
|
Call<ServiceRESTResponse<Object>> callable = printerService.printClosedOrders(codMdep, dto);
|
||||||
callable.enqueue(new ManagedErrorCallback<>() {
|
|
||||||
@Override
|
|
||||||
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) {
|
|
||||||
analyzeAnswer(response, "printCollo", data -> {
|
|
||||||
onComplete.run();
|
|
||||||
}, onFailed);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
var response = callable.execute();
|
||||||
public void onFailure(Call<ServiceRESTResponse<Object>> call, @NonNull final Exception e) {
|
analyzeAnswer(response, "printCollo");
|
||||||
onFailed.run(e);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ import it.integry.integrywmsnative.core.rest.model.MailRequestDTO;
|
|||||||
import it.integry.integrywmsnative.core.rest.model.NativeSqlRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.NativeSqlRequestDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||||
import it.integry.integrywmsnative.core.rest.model.system.LatestAppVersionInfoDTO;
|
import it.integry.integrywmsnative.core.rest.model.system.LatestAppVersionInfoDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.system.RegisterDeviceRequestDTO;
|
|
||||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityGson;
|
import it.integry.integrywmsnative.core.utility.UtilityGson;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||||
@@ -40,9 +39,9 @@ public class SystemRESTConsumer extends _BaseRESTConsumer {
|
|||||||
private final ExecutorService executorService;
|
private final ExecutorService executorService;
|
||||||
private final RESTBuilder restBuilder;
|
private final RESTBuilder restBuilder;
|
||||||
|
|
||||||
public SystemRESTConsumer(ExecutorService executorService, RESTBuilder restBuilder) {
|
public SystemRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService) {
|
||||||
this.executorService = executorService;
|
|
||||||
this.restBuilder = restBuilder;
|
this.restBuilder = restBuilder;
|
||||||
|
this.executorService = executorService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LatestAppVersionInfoDTO retrieveUpdatesInfoSynchronized(boolean betaVersion) throws Exception {
|
public LatestAppVersionInfoDTO retrieveUpdatesInfoSynchronized(boolean betaVersion) throws Exception {
|
||||||
@@ -57,58 +56,44 @@ public class SystemRESTConsumer extends _BaseRESTConsumer {
|
|||||||
return analyzeAnswerGeneric(response, "updates");
|
return analyzeAnswerGeneric(response, "updates");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public <T> T processSqlSynchronized(String nativeSql, final Type clazz) throws Exception {
|
||||||
public void registerDevice(final Runnable onSuccess, final RunnableArgs<Exception> onFailed) {
|
|
||||||
RegisterDeviceRequestDTO registerDeviceRequestDTO = new RegisterDeviceRequestDTO()
|
|
||||||
.setApp("WMS");
|
|
||||||
|
|
||||||
SystemRESTConsumerService systemRESTConsumerService = restBuilder.getService(SystemRESTConsumerService.class);
|
|
||||||
systemRESTConsumerService.registerDevice(registerDeviceRequestDTO)
|
|
||||||
.enqueue(new ManagedErrorCallback<>() {
|
|
||||||
@Override
|
|
||||||
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
|
|
||||||
analyzeAnswer(response, "device/register", Void -> onSuccess.run(), onFailed);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) {
|
|
||||||
onFailed.run(e);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public <T> void processSql(String nativeSql, final Type clazz, final RunnableArgs<T> onComplete, final RunnableArgs<Exception> onFailed) {
|
|
||||||
NativeSqlRequestDTO nativeSqlDTO = new NativeSqlRequestDTO()
|
NativeSqlRequestDTO nativeSqlDTO = new NativeSqlRequestDTO()
|
||||||
.setNativeSql(nativeSql);
|
.setNativeSql(nativeSql);
|
||||||
|
|
||||||
SystemRESTConsumerService service = restBuilder.getService(SystemRESTConsumerService.class);
|
SystemRESTConsumerService service = restBuilder.getService(SystemRESTConsumerService.class);
|
||||||
service
|
var response = service
|
||||||
.processSql(nativeSqlDTO)
|
.processSql(nativeSqlDTO)
|
||||||
.enqueue(new ManagedErrorCallback<>() {
|
.execute();
|
||||||
@Override
|
|
||||||
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) {
|
var data = analyzeAnswer(response, "processSql");
|
||||||
analyzeAnswer(response, "ProcessSql", o -> {
|
|
||||||
Gson gson = UtilityGson.createObject();
|
Gson gson = UtilityGson.createObject();
|
||||||
|
String json = gson.toJson(data);
|
||||||
|
|
||||||
String json = gson.toJson(o);
|
|
||||||
|
|
||||||
InputStream ims = new ByteArrayInputStream(json.getBytes());
|
InputStream ims = new ByteArrayInputStream(json.getBytes());
|
||||||
Reader reader = new InputStreamReader(ims);
|
Reader reader = new InputStreamReader(ims);
|
||||||
T gsonObj = gson.fromJson(reader, clazz);
|
T gsonObj = gson.fromJson(reader, clazz);
|
||||||
|
|
||||||
onComplete.run(gsonObj);
|
return gsonObj;
|
||||||
}, onFailed);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(Call<ServiceRESTResponse<Object>> call, @NonNull final Exception e) {
|
public <T> void processSql(String nativeSql, final Type clazz, final RunnableArgs<T> onComplete, final RunnableArgs<Exception> onFailed) {
|
||||||
onFailed.run(e);
|
executorService.execute(() -> {
|
||||||
|
try {
|
||||||
|
T result = processSqlSynchronized(nativeSql, clazz);
|
||||||
|
if (onComplete != null) onComplete.run(result);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
if (onFailed != null) onFailed.run(ex);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<AvailableCodMdepsDTO> getAvailableCodMdepsSynchronized() throws Exception {
|
||||||
|
SystemRESTConsumerService service = restBuilder.getService(SystemRESTConsumerService.class);
|
||||||
|
var response = service.getAvailableCodMdeps().execute();
|
||||||
|
return analyzeAnswer(response, "CodMdepsAvailable");
|
||||||
|
}
|
||||||
|
|
||||||
public void getAvailableCodMdeps(final RunnableArgs<List<AvailableCodMdepsDTO>> onSuccess, RunnableArgs<Exception> onFailed) {
|
public void getAvailableCodMdeps(final RunnableArgs<List<AvailableCodMdepsDTO>> onSuccess, RunnableArgs<Exception> onFailed) {
|
||||||
SystemRESTConsumerService service = restBuilder.getService(SystemRESTConsumerService.class);
|
SystemRESTConsumerService service = restBuilder.getService(SystemRESTConsumerService.class);
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import it.integry.integrywmsnative.core.rest.model.MailRequestDTO;
|
|||||||
import it.integry.integrywmsnative.core.rest.model.NativeSqlRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.NativeSqlRequestDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||||
import it.integry.integrywmsnative.core.rest.model.system.LatestAppVersionInfoDTO;
|
import it.integry.integrywmsnative.core.rest.model.system.LatestAppVersionInfoDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.system.RegisterDeviceRequestDTO;
|
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.http.Body;
|
import retrofit2.http.Body;
|
||||||
import retrofit2.http.GET;
|
import retrofit2.http.GET;
|
||||||
@@ -19,9 +18,6 @@ public interface SystemRESTConsumerService {
|
|||||||
@GET("wms/currentVersion")
|
@GET("wms/currentVersion")
|
||||||
Call<LatestAppVersionInfoDTO> retrieveUpdatesInfo(@Query("suffix") String suffix);
|
Call<LatestAppVersionInfoDTO> retrieveUpdatesInfo(@Query("suffix") String suffix);
|
||||||
|
|
||||||
@POST("device/register")
|
|
||||||
Call<ServiceRESTResponse<Void>> registerDevice(@Body RegisterDeviceRequestDTO registerDeviceRequestDTO);
|
|
||||||
|
|
||||||
@POST("processSql")
|
@POST("processSql")
|
||||||
Call<ServiceRESTResponse<Object>> processSql(@Body NativeSqlRequestDTO nativeSqlDTO);
|
Call<ServiceRESTResponse<Object>> processSql(@Body NativeSqlRequestDTO nativeSqlDTO);
|
||||||
|
|
||||||
|
|||||||
@@ -12,13 +12,23 @@ import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowRequestDTO;
|
|||||||
|
|
||||||
public interface ColliScaricoRESTConsumerInterface {
|
public interface ColliScaricoRESTConsumerInterface {
|
||||||
|
|
||||||
|
MtbColt createUDSSynchronized(CreateUDSRequestDTO createUDSRequestDTO) throws Exception;
|
||||||
|
|
||||||
void createUDS(CreateUDSRequestDTO createUDSRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed);
|
void createUDS(CreateUDSRequestDTO createUDSRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed);
|
||||||
|
|
||||||
|
CloseUDSResponseDTO closeUDSSynchronized(CloseUDSRequestDTO closeUDSRequestDTO) throws Exception;
|
||||||
|
|
||||||
void closeUDS(CloseUDSRequestDTO closeUDSRequestDTO, RunnableArgs<CloseUDSResponseDTO> onComplete, RunnableArgs<Exception> onFailed);
|
void closeUDS(CloseUDSRequestDTO closeUDSRequestDTO, RunnableArgs<CloseUDSResponseDTO> onComplete, RunnableArgs<Exception> onFailed);
|
||||||
|
|
||||||
|
MtbColr insertUDSRowSynchronized(InsertUDSRowRequestDTO insertUDSRowRequestDTO) throws Exception;
|
||||||
|
|
||||||
void insertUDSRow(InsertUDSRowRequestDTO insertUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed);
|
void insertUDSRow(InsertUDSRowRequestDTO insertUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed);
|
||||||
|
|
||||||
|
MtbColr editUDSRowSynchronized(EditUDSRowRequestDTO editUDSRowRequestDTO) throws Exception;
|
||||||
|
|
||||||
void editUDSRow(EditUDSRowRequestDTO editUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed);
|
void editUDSRow(EditUDSRowRequestDTO editUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed);
|
||||||
|
|
||||||
|
void deleteUDSRowSynchronized(DeleteUDSRowRequestDTO deleteUDSRequestDTO) throws Exception;
|
||||||
|
|
||||||
void deleteUDSRow(DeleteUDSRowRequestDTO deleteUDSRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed);
|
void deleteUDSRow(DeleteUDSRowRequestDTO deleteUDSRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package it.integry.integrywmsnative.core.rest.deserializer;
|
||||||
|
|
||||||
|
import androidx.lifecycle.MutableLiveData;
|
||||||
|
|
||||||
|
import com.google.gson.JsonDeserializationContext;
|
||||||
|
import com.google.gson.JsonDeserializer;
|
||||||
|
import com.google.gson.JsonElement;
|
||||||
|
import com.google.gson.JsonParseException;
|
||||||
|
|
||||||
|
import java.lang.reflect.ParameterizedType;
|
||||||
|
import java.lang.reflect.Type;
|
||||||
|
|
||||||
|
public class MutableLiveDataDeserializer implements JsonDeserializer<MutableLiveData<?>> {
|
||||||
|
@Override
|
||||||
|
public MutableLiveData<?> deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
|
||||||
|
Type type = ((ParameterizedType) typeOfT).getActualTypeArguments()[0];
|
||||||
|
MutableLiveData<Object> liveData = new MutableLiveData<>();
|
||||||
|
liveData.setValue(context.deserialize(json, type));
|
||||||
|
return liveData;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -337,7 +337,7 @@ public class Ean128Model {
|
|||||||
public String Internal3; //Cod-Jfas
|
public String Internal3; //Cod-Jfas
|
||||||
|
|
||||||
///<summary>Informazioni interne</summary>
|
///<summary>Informazioni interne</summary>
|
||||||
public String Internal4;
|
public String Internal4; //Cod-Mdep
|
||||||
|
|
||||||
///<summary>Informazioni interne</summary>
|
///<summary>Informazioni interne</summary>
|
||||||
public String Internal5;
|
public String Internal5;
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package it.integry.integrywmsnative.core.rest.model;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||||
|
|
||||||
|
public class UpdatePosizioneULRequestDTO {
|
||||||
|
|
||||||
|
private MtbColt mtbColt;
|
||||||
|
private String posizione;
|
||||||
|
|
||||||
|
public MtbColt getMtbColt() {
|
||||||
|
return mtbColt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public UpdatePosizioneULRequestDTO setMtbColt(MtbColt mtbColt) {
|
||||||
|
this.mtbColt = mtbColt;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPosizione() {
|
||||||
|
return posizione;
|
||||||
|
}
|
||||||
|
|
||||||
|
public UpdatePosizioneULRequestDTO setPosizione(String posizione) {
|
||||||
|
this.posizione = posizione;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
package it.integry.integrywmsnative.core.rest.model.pv;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
public class GiacenzaPvDTO {
|
||||||
|
|
||||||
|
private String codMart;
|
||||||
|
private String descrizione;
|
||||||
|
private BigDecimal qtaInv;
|
||||||
|
private Date dtaInventario;
|
||||||
|
private String codMdep;
|
||||||
|
private BigDecimal incomingStock;
|
||||||
|
|
||||||
|
|
||||||
|
public String getCodMart() {
|
||||||
|
return codMart;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GiacenzaPvDTO setCodMart(String codMart) {
|
||||||
|
this.codMart = codMart;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescrizione() {
|
||||||
|
return descrizione;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GiacenzaPvDTO setDescrizione(String descrizione) {
|
||||||
|
this.descrizione = descrizione;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getQtaInv() {
|
||||||
|
return qtaInv;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GiacenzaPvDTO setQtaInv(BigDecimal qtaInv) {
|
||||||
|
this.qtaInv = qtaInv;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDtaInventario() {
|
||||||
|
return dtaInventario;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GiacenzaPvDTO setDtaInventario(Date dtaInventario) {
|
||||||
|
this.dtaInventario = dtaInventario;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCodMdep() {
|
||||||
|
return codMdep;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GiacenzaPvDTO setCodMdep(String codMdep) {
|
||||||
|
this.codMdep = codMdep;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getIncomingStock() {
|
||||||
|
return incomingStock;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GiacenzaPvDTO setIncomingStock(BigDecimal incomingStock) {
|
||||||
|
this.incomingStock = incomingStock;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package it.integry.integrywmsnative.core.rest.model.pv;
|
||||||
|
|
||||||
|
public class SaveNewVerificaRequestDTO {
|
||||||
|
|
||||||
|
private VerificaGiacenzeDTO data;
|
||||||
|
|
||||||
|
public VerificaGiacenzeDTO getData() {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SaveNewVerificaRequestDTO setData(VerificaGiacenzeDTO data) {
|
||||||
|
this.data = data;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package it.integry.integrywmsnative.core.rest.model.pv;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.model.BaseRestDTO;
|
||||||
|
|
||||||
|
public class VerificaGiacenzeDTO extends BaseRestDTO {
|
||||||
|
|
||||||
|
private String codMdep;
|
||||||
|
private LocalDateTime dataVerifica;
|
||||||
|
|
||||||
|
private List<VerificaGiacenzeRowDTO> rows;
|
||||||
|
|
||||||
|
public String getCodMdep() {
|
||||||
|
return codMdep;
|
||||||
|
}
|
||||||
|
|
||||||
|
public VerificaGiacenzeDTO setCodMdep(String codMdep) {
|
||||||
|
this.codMdep = codMdep;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocalDateTime getDataVerifica() {
|
||||||
|
return dataVerifica;
|
||||||
|
}
|
||||||
|
|
||||||
|
public VerificaGiacenzeDTO setDataVerifica(LocalDateTime dataVerifica) {
|
||||||
|
this.dataVerifica = dataVerifica;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<VerificaGiacenzeRowDTO> getRows() {
|
||||||
|
return rows;
|
||||||
|
}
|
||||||
|
|
||||||
|
public VerificaGiacenzeDTO setRows(List<VerificaGiacenzeRowDTO> rows) {
|
||||||
|
this.rows = rows;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
package it.integry.integrywmsnative.core.rest.model.pv;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.model.BaseRestDTO;
|
||||||
|
|
||||||
|
public class VerificaGiacenzeRowDTO extends BaseRestDTO {
|
||||||
|
|
||||||
|
private String codMart;
|
||||||
|
private String partitaMag;
|
||||||
|
private BigDecimal qtaInGiacenza;
|
||||||
|
private BigDecimal qta;
|
||||||
|
private BigDecimal qtaCnf;
|
||||||
|
private BigDecimal numCnf;
|
||||||
|
private String barcode;
|
||||||
|
|
||||||
|
public String getCodMart() {
|
||||||
|
return codMart;
|
||||||
|
}
|
||||||
|
|
||||||
|
public VerificaGiacenzeRowDTO setCodMart(String codMart) {
|
||||||
|
this.codMart = codMart;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPartitaMag() {
|
||||||
|
return partitaMag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public VerificaGiacenzeRowDTO setPartitaMag(String partitaMag) {
|
||||||
|
this.partitaMag = partitaMag;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getQtaInGiacenza() {
|
||||||
|
return qtaInGiacenza;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQtaInGiacenza(BigDecimal qtaInGiacenza) {
|
||||||
|
this.qtaInGiacenza = qtaInGiacenza;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getQta() {
|
||||||
|
return qta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public VerificaGiacenzeRowDTO setQta(BigDecimal qta) {
|
||||||
|
this.qta = qta;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getQtaCnf() {
|
||||||
|
return qtaCnf;
|
||||||
|
}
|
||||||
|
|
||||||
|
public VerificaGiacenzeRowDTO setQtaCnf(BigDecimal qtaCnf) {
|
||||||
|
this.qtaCnf = qtaCnf;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getNumCnf() {
|
||||||
|
return numCnf;
|
||||||
|
}
|
||||||
|
|
||||||
|
public VerificaGiacenzeRowDTO setNumCnf(BigDecimal numCnf) {
|
||||||
|
this.numCnf = numCnf;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBarcode() {
|
||||||
|
return barcode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public VerificaGiacenzeRowDTO setBarcode(String barcode) {
|
||||||
|
this.barcode = barcode;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
package it.integry.integrywmsnative.core.rest.model.system;
|
|
||||||
|
|
||||||
public class RegisterDeviceRequestDTO {
|
|
||||||
|
|
||||||
private String app;
|
|
||||||
|
|
||||||
public String getApp() {
|
|
||||||
return app;
|
|
||||||
}
|
|
||||||
|
|
||||||
public RegisterDeviceRequestDTO setApp(String app) {
|
|
||||||
this.app = app;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package it.integry.integrywmsnative.core.rest.serializer;
|
||||||
|
|
||||||
|
import androidx.lifecycle.MutableLiveData;
|
||||||
|
|
||||||
|
import com.google.gson.JsonElement;
|
||||||
|
import com.google.gson.JsonSerializationContext;
|
||||||
|
import com.google.gson.JsonSerializer;
|
||||||
|
|
||||||
|
import java.lang.reflect.Type;
|
||||||
|
|
||||||
|
public class MutableLiveDataSerializer implements JsonSerializer<MutableLiveData<?>> {
|
||||||
|
@Override
|
||||||
|
public JsonElement serialize(MutableLiveData<?> src, Type typeOfSrc, JsonSerializationContext context) {
|
||||||
|
return context.serialize(src.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -12,7 +12,11 @@ import it.integry.integrywmsnative.core.utility.UtilityString;
|
|||||||
|
|
||||||
public class ServerStatusChecker {
|
public class ServerStatusChecker {
|
||||||
|
|
||||||
private static final ServerStatusChecker instance = new ServerStatusChecker();
|
|
||||||
|
private final Handler handler;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private final List<RunnableArgs<Boolean>> mCallback = new ArrayList<>();
|
private final List<RunnableArgs<Boolean>> mCallback = new ArrayList<>();
|
||||||
|
|
||||||
@@ -26,7 +30,29 @@ public class ServerStatusChecker {
|
|||||||
private final long MILLIS_DELAY = 5 * 1000;
|
private final long MILLIS_DELAY = 5 * 1000;
|
||||||
|
|
||||||
|
|
||||||
private final Handler handler = new Handler();
|
public ServerStatusChecker(Handler handler) {
|
||||||
|
this.handler = handler;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addCallback(RunnableArgs<Boolean> callback) {
|
||||||
|
this.mCallback.add(callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeCallback(RunnableArgs<Boolean> callback) {
|
||||||
|
this.mCallback.remove(callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void init() {
|
||||||
|
this.shouldExecute = true;
|
||||||
|
|
||||||
|
this.handler.post(this.runnableCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void dispose() {
|
||||||
|
this.shouldExecute = false;
|
||||||
|
}
|
||||||
|
|
||||||
private final Runnable runnableCode = new Runnable() {
|
private final Runnable runnableCode = new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@@ -42,27 +68,4 @@ public class ServerStatusChecker {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public void addCallback(RunnableArgs<Boolean> callback) {
|
|
||||||
this.mCallback.add(callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void removeCallback(RunnableArgs<Boolean> callback) {
|
|
||||||
this.mCallback.remove(callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static void init() {
|
|
||||||
instance.shouldExecute = true;
|
|
||||||
|
|
||||||
instance.handler.post(instance.runnableCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void dispose() {
|
|
||||||
instance.shouldExecute = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ServerStatusChecker getInstance() {
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,6 +96,7 @@ public class DBSettingsModel {
|
|||||||
private boolean flagEnableArtCreation;
|
private boolean flagEnableArtCreation;
|
||||||
private List<String> allowedCodMgrpForArtCreation;
|
private List<String> allowedCodMgrpForArtCreation;
|
||||||
private boolean flagAccettazioneGroupListForn = false;
|
private boolean flagAccettazioneGroupListForn = false;
|
||||||
|
private boolean flagSpedizioneEnableFastPicking = false;
|
||||||
|
|
||||||
public boolean isFlagSpedizioneEnableFakeGiacenza() {
|
public boolean isFlagSpedizioneEnableFakeGiacenza() {
|
||||||
return flagSpedizioneEnableFakeGiacenza;
|
return flagSpedizioneEnableFakeGiacenza;
|
||||||
@@ -806,4 +807,12 @@ public class DBSettingsModel {
|
|||||||
public void setFlagAccettazioneGroupListForn(boolean flagAccettazioneGroupListForn) {
|
public void setFlagAccettazioneGroupListForn(boolean flagAccettazioneGroupListForn) {
|
||||||
this.flagAccettazioneGroupListForn = flagAccettazioneGroupListForn;
|
this.flagAccettazioneGroupListForn = flagAccettazioneGroupListForn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isFlagSpedizioneEnableFastPicking() {
|
||||||
|
return flagSpedizioneEnableFastPicking;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFlagSpedizioneEnableFastPicking(boolean flagSpedizioneEnableFastPicking) {
|
||||||
|
this.flagSpedizioneEnableFastPicking = flagSpedizioneEnableFastPicking;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -102,68 +102,60 @@ public class SettingsManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void loadDBVariables(RunnableArgs<String> onProgress, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
public static void loadDBVariables(RunnableArgs<String> onProgress) throws Exception {
|
||||||
dbSettingsModelIstance = new DBSettingsModel();
|
dbSettingsModelIstance = new DBSettingsModel();
|
||||||
|
|
||||||
Trace perfTrace = UtilityFirebase.getNewPerformanceTrace("db_load_vars");
|
Trace perfTrace = UtilityFirebase.getNewPerformanceTrace("db_load_vars");
|
||||||
perfTrace.start();
|
perfTrace.start();
|
||||||
|
|
||||||
Runnable tmpOnComplete = () -> {
|
try {
|
||||||
perfTrace.stop();
|
|
||||||
onComplete.run();
|
|
||||||
};
|
|
||||||
|
|
||||||
RunnableArgs<Exception> tmpOnFailed = ex -> {
|
|
||||||
UtilityLogger.error(ex);
|
|
||||||
perfTrace.putAttribute("failed", "true");
|
|
||||||
if (!(ex instanceof SocketTimeoutException)) onFailed.run(ex);
|
|
||||||
else
|
|
||||||
onFailed.run(new Exception("Errore durante il caricamento dei dati. Riavviare l'applicazione!"));
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
onProgress.run("depositi");
|
onProgress.run("depositi");
|
||||||
loadAvailableCodMdeps(() -> {
|
loadAvailableCodMdeps();
|
||||||
|
|
||||||
onProgress.run("posizioni");
|
onProgress.run("posizioni");
|
||||||
loadAvailablePosizioni(() -> {
|
loadAvailablePosizioni();
|
||||||
|
|
||||||
|
|
||||||
onProgress.run("impostazioni");
|
onProgress.run("impostazioni");
|
||||||
loadGestSetupValues(() -> {
|
loadGestSetupValues();
|
||||||
|
|
||||||
|
|
||||||
onProgress.run("dati azienda");
|
onProgress.run("dati azienda");
|
||||||
loadDatiAzienda(() -> {
|
loadDatiAzienda();
|
||||||
|
loadTipiCollo();
|
||||||
|
|
||||||
loadTipiCollo(tmpOnComplete, tmpOnFailed);
|
perfTrace.stop();
|
||||||
|
|
||||||
}, tmpOnFailed);
|
} catch (Exception ex) {
|
||||||
}, tmpOnFailed);
|
UtilityLogger.error(ex);
|
||||||
}, tmpOnFailed);
|
perfTrace.putAttribute("failed", "true");
|
||||||
}, tmpOnFailed);
|
|
||||||
|
if (!(ex instanceof SocketTimeoutException))
|
||||||
|
throw ex;
|
||||||
|
else
|
||||||
|
throw new Exception("Errore durante il caricamento dei dati. Riavviare l'applicazione!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void loadTipiCollo(Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
private static void loadTipiCollo() throws Exception {
|
||||||
mImballiRESTConsumer.retrieveImballi(MtbTCol.FlagUiUlEnum.UL, tipiColloUl -> {
|
var tipiColloUl = mImballiRESTConsumer.retrieveImballiSyncronized(MtbTCol.FlagUiUlEnum.UL);
|
||||||
mImballiRESTConsumer.retrieveImballi(MtbTCol.FlagUiUlEnum.UI, tipiColloUi -> {
|
var tipiColloUi = mImballiRESTConsumer.retrieveImballiSyncronized(MtbTCol.FlagUiUlEnum.UI);
|
||||||
|
|
||||||
var imballiList = new ObservableArrayList<ObservableMtbTcol>();
|
var imballiList = new ObservableArrayList<ObservableMtbTcol>();
|
||||||
|
|
||||||
imballiList.addAll(tipiColloUi);
|
imballiList.addAll(tipiColloUi);
|
||||||
imballiList.addAll(tipiColloUl);
|
imballiList.addAll(tipiColloUl);
|
||||||
|
|
||||||
SettingsManager.iDB().setInternalImballi(imballiList);
|
SettingsManager.iDB().setInternalImballi(imballiList);
|
||||||
onComplete.run();
|
|
||||||
}, onFailed);
|
|
||||||
}, onFailed);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void loadDatiAzienda(Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
private static void loadDatiAzienda() throws Exception {
|
||||||
|
|
||||||
|
var datiAzienda = mAziendaRESTConsumer.retrieveAziendaSynchronized();
|
||||||
|
|
||||||
mAziendaRESTConsumer.retrieveAzienda(datiAzienda -> {
|
|
||||||
SettingsManager.iDB().setDatiAzienda(datiAzienda);
|
SettingsManager.iDB().setDatiAzienda(datiAzienda);
|
||||||
|
|
||||||
if (!SettingsManager.iDB().isFlagUseCodAnagAziendale()) {
|
if (!SettingsManager.iDB().isFlagUseCodAnagAziendale()) {
|
||||||
onComplete.run();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,22 +169,17 @@ public class SettingsManager {
|
|||||||
|
|
||||||
Type type = new TypeToken<List<InternalCodAnagsDTO>>() {
|
Type type = new TypeToken<List<InternalCodAnagsDTO>>() {
|
||||||
}.getType();
|
}.getType();
|
||||||
mSystemRESTConsumer.<List<InternalCodAnagsDTO>>processSql(internalCodAnagsQuery, type, internalCodAnagsList -> {
|
var internalCodAnagsList = mSystemRESTConsumer.<List<InternalCodAnagsDTO>>processSqlSynchronized(internalCodAnagsQuery, type);
|
||||||
SettingsManager.iDB().setInternalCodAnags(internalCodAnagsList);
|
SettingsManager.iDB().setInternalCodAnags(internalCodAnagsList);
|
||||||
|
|
||||||
if (onComplete != null) onComplete.run();
|
|
||||||
}, onFailed);
|
|
||||||
|
|
||||||
}, onFailed);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void loadAvailableCodMdeps(Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
private static void loadAvailableCodMdeps() throws Exception {
|
||||||
mSystemRESTConsumer.getAvailableCodMdeps(availableCodMdeps -> {
|
var availableCodMdeps = mSystemRESTConsumer.getAvailableCodMdepsSynchronized();
|
||||||
|
|
||||||
dbSettingsModelIstance.setAvailableCodMdep(availableCodMdeps);
|
dbSettingsModelIstance.setAvailableCodMdep(availableCodMdeps);
|
||||||
|
|
||||||
if (availableCodMdeps == null || availableCodMdeps.isEmpty()) {
|
if (availableCodMdeps == null || availableCodMdeps.isEmpty()) {
|
||||||
onFailed.run(new Exception(mContext.getText(R.string.no_codmdep_available).toString()));
|
throw new Exception(mContext.getText(R.string.no_codmdep_available).toString());
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean codMdepExistsAnymore = false;
|
boolean codMdepExistsAnymore = false;
|
||||||
@@ -210,28 +197,16 @@ public class SettingsManager {
|
|||||||
if (!codMdepExistsAnymore) {
|
if (!codMdepExistsAnymore) {
|
||||||
settingsModelIstance.getUserSession().setDepo(availableCodMdeps.get(0));
|
settingsModelIstance.getUserSession().setDepo(availableCodMdeps.get(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (onComplete != null) onComplete.run();
|
|
||||||
}, ex -> {
|
|
||||||
//BOH
|
|
||||||
if (onFailed != null) onFailed.run(ex);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static void loadAvailablePosizioni(Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
private static void loadAvailablePosizioni() throws Exception {
|
||||||
mPosizioniRESTConsumer.getAvailablePosizioni(availablePosizioni -> {
|
var availablePosizioni = mPosizioniRESTConsumer.getAvailablePosizioniSynchronized();
|
||||||
dbSettingsModelIstance.setAvailablePosizioni(availablePosizioni);
|
dbSettingsModelIstance.setAvailablePosizioni(availablePosizioni);
|
||||||
|
|
||||||
if (onComplete != null) onComplete.run();
|
|
||||||
}, ex -> {
|
|
||||||
if (onFailed != null) onFailed.run(ex);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static void loadGestSetupValues(Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
private static void loadGestSetupValues() throws Exception {
|
||||||
|
|
||||||
List<StbGestSetupReader> stbGestSetupReaderList = new ArrayList<>();
|
List<StbGestSetupReader> stbGestSetupReaderList = new ArrayList<>();
|
||||||
|
|
||||||
@@ -583,6 +558,12 @@ public class SettingsManager {
|
|||||||
.setKeySection("ENABLE_POSITION_CHANGE_REQUEST")
|
.setKeySection("ENABLE_POSITION_CHANGE_REQUEST")
|
||||||
.setSetter(dbSettingsModelIstance::setFlagPositionChangeRequest)
|
.setSetter(dbSettingsModelIstance::setFlagPositionChangeRequest)
|
||||||
.setDefaultValue(true));
|
.setDefaultValue(true));
|
||||||
|
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
|
||||||
|
.setGestName("PICKING")
|
||||||
|
.setSection("SPEDIZIONE")
|
||||||
|
.setKeySection("ENABLE_FAST_PICKING")
|
||||||
|
.setSetter(dbSettingsModelIstance::setFlagSpedizioneEnableFastPicking)
|
||||||
|
.setDefaultValue(false));
|
||||||
|
|
||||||
stbGestSetupReaderList.add(new StbGestSetupReader<>(String.class)
|
stbGestSetupReaderList.add(new StbGestSetupReader<>(String.class)
|
||||||
.setGestName("PICKING")
|
.setGestName("PICKING")
|
||||||
@@ -648,7 +629,8 @@ public class SettingsManager {
|
|||||||
String codMdep = SettingsManager.i().getUserSession().getDepo().getCodMdep();
|
String codMdep = SettingsManager.i().getUserSession().getDepo().getCodMdep();
|
||||||
|
|
||||||
|
|
||||||
mGestSetupRESTConsumer.getValues(codMdep, stbGestSetupReaderList, list -> {
|
var list = mGestSetupRESTConsumer.getValuesSynchronized(codMdep, stbGestSetupReaderList);
|
||||||
|
|
||||||
|
|
||||||
for (var stbGestSetupReader : list) {
|
for (var stbGestSetupReader : list) {
|
||||||
var value = stbGestSetupReader.getValue();
|
var value = stbGestSetupReader.getValue();
|
||||||
@@ -674,8 +656,6 @@ public class SettingsManager {
|
|||||||
stbGestSetupReader.getSetter().run(finalValue);
|
stbGestSetupReader.getSetter().run(finalValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (onComplete != null) onComplete.run();
|
|
||||||
}, onFailed);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,17 @@
|
|||||||
package it.integry.integrywmsnative.core.utility;
|
package it.integry.integrywmsnative.core.utility;
|
||||||
|
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.Color;
|
|
||||||
|
|
||||||
import com.annimon.stream.Stream;
|
|
||||||
import com.google.zxing.BarcodeFormat;
|
import com.google.zxing.BarcodeFormat;
|
||||||
|
import com.google.zxing.EncodeHintType;
|
||||||
import com.google.zxing.MultiFormatWriter;
|
import com.google.zxing.MultiFormatWriter;
|
||||||
import com.google.zxing.common.BitMatrix;
|
import com.google.zxing.common.BitMatrix;
|
||||||
|
import com.journeyapps.barcodescanner.BarcodeEncoder;
|
||||||
|
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
||||||
import it.integry.barcode_base_android_library.model.BarcodeType;
|
import it.integry.barcode_base_android_library.model.BarcodeType;
|
||||||
@@ -17,6 +20,7 @@ import it.integry.integrywmsnative.core.settings.SettingsManager;
|
|||||||
|
|
||||||
public class UtilityBarcode {
|
public class UtilityBarcode {
|
||||||
|
|
||||||
|
public static final char FNC1 = 0x00f1;
|
||||||
|
|
||||||
public static boolean isBarcodeOrdineV(BarcodeScanDTO barcodeScanDTO) {
|
public static boolean isBarcodeOrdineV(BarcodeScanDTO barcodeScanDTO) {
|
||||||
return (isEan13(barcodeScanDTO) || isEtichetta128(barcodeScanDTO)) && barcodeScanDTO.getStringValue().startsWith("3");
|
return (isEan13(barcodeScanDTO) || isEtichetta128(barcodeScanDTO)) && barcodeScanDTO.getStringValue().startsWith("3");
|
||||||
@@ -57,7 +61,7 @@ public class UtilityBarcode {
|
|||||||
boolean isPosizione = false;
|
boolean isPosizione = false;
|
||||||
|
|
||||||
if (SettingsManager.iDB().getAvailablePosizioni() != null) {
|
if (SettingsManager.iDB().getAvailablePosizioni() != null) {
|
||||||
Stream<MtbDepoPosizione> tmpStream = Stream.of(SettingsManager.iDB().getAvailablePosizioni())
|
Stream<MtbDepoPosizione> tmpStream = SettingsManager.iDB().getAvailablePosizioni().stream()
|
||||||
.filter(x -> x.getPosizione().equalsIgnoreCase(barcode) && (!enableCheckCodMdep || currentCodMdep.equalsIgnoreCase(x.getCodMdep())));
|
.filter(x -> x.getPosizione().equalsIgnoreCase(barcode) && (!enableCheckCodMdep || currentCodMdep.equalsIgnoreCase(x.getCodMdep())));
|
||||||
|
|
||||||
if (tmpStream.count() > 0) {
|
if (tmpStream.count() > 0) {
|
||||||
@@ -177,25 +181,49 @@ public class UtilityBarcode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Bitmap generateBarcodeImage(String barcode, BarcodeType type, int width, int height) throws Exception {
|
public static Bitmap generateBarcodeImage(String barcode, BarcodeType type, int width, int height) throws Exception {
|
||||||
// Genera la matrice del codice a barre
|
|
||||||
MultiFormatWriter writer = new MultiFormatWriter();
|
|
||||||
|
|
||||||
|
if (barcode == null) return null;
|
||||||
|
|
||||||
|
Bitmap bitmap = null;
|
||||||
|
|
||||||
|
if (type == BarcodeType.EAN128) {
|
||||||
|
if(barcode.charAt(0) != FNC1) {
|
||||||
|
barcode = FNC1 + barcode;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<EncodeHintType, Object> hints = new HashMap<>();
|
||||||
|
hints.put(EncodeHintType.CHARACTER_SET, "ISO-8859-1");
|
||||||
|
hints.put(EncodeHintType.MARGIN, 10); // Quiet zone
|
||||||
|
|
||||||
|
// Crea il codice a barre
|
||||||
|
MultiFormatWriter multiFormatWriter = new MultiFormatWriter();
|
||||||
|
BitMatrix bitMatrix = multiFormatWriter.encode(
|
||||||
|
barcode,
|
||||||
|
BarcodeFormat.CODE_128,
|
||||||
|
width, // Larghezza
|
||||||
|
height, // Altezza
|
||||||
|
hints
|
||||||
|
);
|
||||||
|
|
||||||
|
// Converti in bitmap
|
||||||
|
BarcodeEncoder barcodeEncoder = new BarcodeEncoder();
|
||||||
|
bitmap = barcodeEncoder.createBitmap(bitMatrix);
|
||||||
|
} else {
|
||||||
BarcodeFormat barcodeFormat = switch (type) {
|
BarcodeFormat barcodeFormat = switch (type) {
|
||||||
case EAN8 -> BarcodeFormat.EAN_8;
|
case EAN8 -> BarcodeFormat.EAN_8;
|
||||||
case EAN13 -> BarcodeFormat.EAN_13;
|
case EAN13 -> BarcodeFormat.EAN_13;
|
||||||
case INTERLEAVED_2OF5 -> BarcodeFormat.ITF;
|
case INTERLEAVED_2OF5 -> BarcodeFormat.ITF;
|
||||||
case CODE128 -> BarcodeFormat.CODE_128;
|
case CODE128 -> BarcodeFormat.CODE_128;
|
||||||
default -> throw new Exception("Barcode " + barcode + " non valido (tipo: " + type + ")");
|
default ->
|
||||||
|
throw new Exception("Barcode " + barcode + " non valido (tipo: " + type + ")");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
MultiFormatWriter writer = new MultiFormatWriter();
|
||||||
BitMatrix bitMatrix = writer.encode(barcode, barcodeFormat, width, height);
|
BitMatrix bitMatrix = writer.encode(barcode, barcodeFormat, width, height);
|
||||||
|
|
||||||
// Crea un bitmap a partire dalla matrice
|
|
||||||
Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
|
BarcodeEncoder barcodeEncoder = new BarcodeEncoder();
|
||||||
for (int x = 0; x < width; x++) {
|
bitmap = barcodeEncoder.createBitmap(bitMatrix);
|
||||||
for (int y = 0; y < height; y++) {
|
|
||||||
bitmap.setPixel(x, y, bitMatrix.get(x, y) ? Color.BLACK : Color.WHITE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return bitmap;
|
return bitmap;
|
||||||
|
|||||||
@@ -40,4 +40,5 @@ public class UtilityDialog {
|
|||||||
// dialog.getWindow().setLayout(width, LinearLayout.LayoutParams.WRAP_CONTENT);
|
// dialog.getWindow().setLayout(width, LinearLayout.LayoutParams.WRAP_CONTENT);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import com.google.firebase.crashlytics.FirebaseCrashlytics;
|
|||||||
import com.orhanobut.logger.Logger;
|
import com.orhanobut.logger.Logger;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.BuildConfig;
|
import it.integry.integrywmsnative.BuildConfig;
|
||||||
|
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
||||||
import it.integry.integrywmsnative.core.exception.InvalidConnectionException;
|
import it.integry.integrywmsnative.core.exception.InvalidConnectionException;
|
||||||
import it.integry.integrywmsnative.core.exception.InvalidLUException;
|
import it.integry.integrywmsnative.core.exception.InvalidLUException;
|
||||||
import it.integry.integrywmsnative.core.exception.InvalidLUGestioneException;
|
import it.integry.integrywmsnative.core.exception.InvalidLUGestioneException;
|
||||||
@@ -24,6 +25,7 @@ public class UtilityExceptions {
|
|||||||
InvalidLUGestioneException.class,
|
InvalidLUGestioneException.class,
|
||||||
InvalidLUException.class
|
InvalidLUException.class
|
||||||
};
|
};
|
||||||
|
|
||||||
public static void defaultException(Context context, Exception ex) {
|
public static void defaultException(Context context, Exception ex) {
|
||||||
defaultException(context, ex, false);
|
defaultException(context, ex, false);
|
||||||
}
|
}
|
||||||
@@ -47,7 +49,11 @@ public class UtilityExceptions {
|
|||||||
FragmentManager fm = ContextHelper.getFragmentManagerFromContext(context);
|
FragmentManager fm = ContextHelper.getFragmentManagerFromContext(context);
|
||||||
|
|
||||||
if (fm != null) {
|
if (fm != null) {
|
||||||
DialogSimpleMessageView.makeErrorDialog(Html.fromHtml(errorMessage), null, null)
|
boolean isBarcodeEnabled = BarcodeManager.isLastCallbackEnabled();
|
||||||
|
if (isBarcodeEnabled) BarcodeManager.disableLastCallback();
|
||||||
|
DialogSimpleMessageView.makeErrorDialog(Html.fromHtml(errorMessage), null, () -> {
|
||||||
|
if (isBarcodeEnabled) BarcodeManager.enableLastCallback();
|
||||||
|
})
|
||||||
.show(fm, "tag");
|
.show(fm, "tag");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package it.integry.integrywmsnative.core.utility;
|
package it.integry.integrywmsnative.core.utility;
|
||||||
|
|
||||||
|
import androidx.lifecycle.MutableLiveData;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.GsonBuilder;
|
import com.google.gson.GsonBuilder;
|
||||||
|
|
||||||
@@ -12,10 +14,12 @@ import it.integry.integrywmsnative.core.model.secondary.StatoPartitaMag;
|
|||||||
import it.integry.integrywmsnative.core.rest.deserializer.LocalDateDeserializer;
|
import it.integry.integrywmsnative.core.rest.deserializer.LocalDateDeserializer;
|
||||||
import it.integry.integrywmsnative.core.rest.deserializer.LocalDateTimeDeserializer;
|
import it.integry.integrywmsnative.core.rest.deserializer.LocalDateTimeDeserializer;
|
||||||
import it.integry.integrywmsnative.core.rest.deserializer.MtbTcolFlagUiUlDeserializer;
|
import it.integry.integrywmsnative.core.rest.deserializer.MtbTcolFlagUiUlDeserializer;
|
||||||
|
import it.integry.integrywmsnative.core.rest.deserializer.MutableLiveDataDeserializer;
|
||||||
import it.integry.integrywmsnative.core.rest.deserializer.StatoPartitaMagDeserializer;
|
import it.integry.integrywmsnative.core.rest.deserializer.StatoPartitaMagDeserializer;
|
||||||
import it.integry.integrywmsnative.core.rest.serializer.LocalDateSerializer;
|
import it.integry.integrywmsnative.core.rest.serializer.LocalDateSerializer;
|
||||||
import it.integry.integrywmsnative.core.rest.serializer.LocalDateTimeSerializer;
|
import it.integry.integrywmsnative.core.rest.serializer.LocalDateTimeSerializer;
|
||||||
import it.integry.integrywmsnative.core.rest.serializer.MtbTcolFlagUiUlSerializer;
|
import it.integry.integrywmsnative.core.rest.serializer.MtbTcolFlagUiUlSerializer;
|
||||||
|
import it.integry.integrywmsnative.core.rest.serializer.MutableLiveDataSerializer;
|
||||||
import it.integry.integrywmsnative.core.rest.serializer.StatoPartitaMagSerializer;
|
import it.integry.integrywmsnative.core.rest.serializer.StatoPartitaMagSerializer;
|
||||||
|
|
||||||
public class UtilityGson {
|
public class UtilityGson {
|
||||||
@@ -24,6 +28,8 @@ public class UtilityGson {
|
|||||||
return new GsonBuilder()
|
return new GsonBuilder()
|
||||||
.setDateFormat("dd/MM/yyyy HH:mm:ss")
|
.setDateFormat("dd/MM/yyyy HH:mm:ss")
|
||||||
.excludeFieldsWithModifiers(Modifier.TRANSIENT)
|
.excludeFieldsWithModifiers(Modifier.TRANSIENT)
|
||||||
|
.registerTypeAdapter(MutableLiveData.class, new MutableLiveDataDeserializer())
|
||||||
|
.registerTypeAdapter(MutableLiveData.class, new MutableLiveDataSerializer())
|
||||||
.registerTypeAdapter(LocalDate.class, new LocalDateDeserializer())
|
.registerTypeAdapter(LocalDate.class, new LocalDateDeserializer())
|
||||||
.registerTypeAdapter(LocalDate.class, new LocalDateSerializer())
|
.registerTypeAdapter(LocalDate.class, new LocalDateSerializer())
|
||||||
.registerTypeAdapter(LocalDateTime.class, new LocalDateTimeDeserializer())
|
.registerTypeAdapter(LocalDateTime.class, new LocalDateTimeDeserializer())
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import android.content.Intent;
|
|||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.text.Html;
|
||||||
import android.text.SpannableString;
|
import android.text.SpannableString;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
|
|
||||||
@@ -98,7 +99,7 @@ public class AccettazioneBollaPickingActivity extends BaseActivity implements Ac
|
|||||||
public BindableBoolean noLUPresent = new BindableBoolean(true);
|
public BindableBoolean noLUPresent = new BindableBoolean(true);
|
||||||
public BindableBoolean bottomSheetEnabled = new BindableBoolean(false);
|
public BindableBoolean bottomSheetEnabled = new BindableBoolean(false);
|
||||||
|
|
||||||
private int barcodeScannerIstanceID = -1;
|
private int mBarcodeScannerInstanceID = -1;
|
||||||
private boolean mShowSecondaryUntMis = true;
|
private boolean mShowSecondaryUntMis = true;
|
||||||
private boolean mShouldCloseActivity;
|
private boolean mShouldCloseActivity;
|
||||||
private AccettazioneBollaPickingOrderBy.Enum mCurrentOrderBy;
|
private AccettazioneBollaPickingOrderBy.Enum mCurrentOrderBy;
|
||||||
@@ -182,10 +183,10 @@ public class AccettazioneBollaPickingActivity extends BaseActivity implements Ac
|
|||||||
this.mBindings.bottomSheetLuContent.collapse();
|
this.mBindings.bottomSheetLuContent.collapse();
|
||||||
} else if (!noLUPresent.get()) {
|
} else if (!noLUPresent.get()) {
|
||||||
this.mShouldCloseActivity = true;
|
this.mShouldCloseActivity = true;
|
||||||
BarcodeManager.removeCallback(barcodeScannerIstanceID);
|
BarcodeManager.removeCallback(mBarcodeScannerInstanceID);
|
||||||
this.mViewModel.closeLU();
|
this.mViewModel.closeLU();
|
||||||
} else {
|
} else {
|
||||||
BarcodeManager.removeCallback(barcodeScannerIstanceID);
|
BarcodeManager.removeCallback(mBarcodeScannerInstanceID);
|
||||||
super.onBackPressed();
|
super.onBackPressed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -199,7 +200,7 @@ public class AccettazioneBollaPickingActivity extends BaseActivity implements Ac
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initBarcodeReader() {
|
private void initBarcodeReader() {
|
||||||
barcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
mBarcodeScannerInstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
||||||
.setOnScanSuccessful(onScanSuccessful)
|
.setOnScanSuccessful(onScanSuccessful)
|
||||||
.setOnScanFailed(ex -> UtilityExceptions.defaultException(this, ex, false)));
|
.setOnScanFailed(ex -> UtilityExceptions.defaultException(this, ex, false)));
|
||||||
}
|
}
|
||||||
@@ -590,7 +591,7 @@ public class AccettazioneBollaPickingActivity extends BaseActivity implements Ac
|
|||||||
UtilityExceptions.defaultException(this, ex);
|
UtilityExceptions.defaultException(this, ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
BarcodeManager.enable();
|
BarcodeManager.enable(mBarcodeScannerInstanceID);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -600,7 +601,7 @@ public class AccettazioneBollaPickingActivity extends BaseActivity implements Ac
|
|||||||
totalQtaToBeTaken, BigDecimal totalNumCnfToBeTaken, BigDecimal qtaCnfToBeTaken, BigDecimal
|
totalQtaToBeTaken, BigDecimal totalNumCnfToBeTaken, BigDecimal qtaCnfToBeTaken, BigDecimal
|
||||||
totalQtaAvailable, BigDecimal totalNumCnfAvailable, BigDecimal qtaCnfAvailable, String
|
totalQtaAvailable, BigDecimal totalNumCnfAvailable, BigDecimal qtaCnfAvailable, String
|
||||||
partitaMag, LocalDate dataScad, boolean canPartitaMagBeChanged,
|
partitaMag, LocalDate dataScad, boolean canPartitaMagBeChanged,
|
||||||
boolean canOverflowQuantity, RunnableArgss<PickedQuantityDTO, Boolean> onComplete) {
|
boolean canOverflowQuantity, RunnableArgs<PickedQuantityDTO> onComplete) {
|
||||||
DialogInputQuantityV2DTO dialogInputQuantityV2DTO = new DialogInputQuantityV2DTO()
|
DialogInputQuantityV2DTO dialogInputQuantityV2DTO = new DialogInputQuantityV2DTO()
|
||||||
.setMtbAart(mtbAart)
|
.setMtbAart(mtbAart)
|
||||||
.setInitialNumCnf(initialNumCnf)
|
.setInitialNumCnf(initialNumCnf)
|
||||||
@@ -608,7 +609,7 @@ public class AccettazioneBollaPickingActivity extends BaseActivity implements Ac
|
|||||||
.setInitialQtaTot(initialQtaTot)
|
.setInitialQtaTot(initialQtaTot)
|
||||||
.setTotalQtaOrd(totalQtaOrd)
|
.setTotalQtaOrd(totalQtaOrd)
|
||||||
.setTotalNumCnfOrd(totalNumCnfOrd)
|
.setTotalNumCnfOrd(totalNumCnfOrd)
|
||||||
.setQtaCnfOrd(qtaCnfOrd)
|
.setTotalQtaCnfOrd(qtaCnfOrd)
|
||||||
.setTotalQtaToBeTaken(totalQtaToBeTaken)
|
.setTotalQtaToBeTaken(totalQtaToBeTaken)
|
||||||
.setTotalNumCnfToBeTaken(totalNumCnfToBeTaken)
|
.setTotalNumCnfToBeTaken(totalNumCnfToBeTaken)
|
||||||
.setQtaCnfToBeTaken(qtaCnfToBeTaken)
|
.setQtaCnfToBeTaken(qtaCnfToBeTaken)
|
||||||
@@ -625,14 +626,19 @@ public class AccettazioneBollaPickingActivity extends BaseActivity implements Ac
|
|||||||
if (!mDialogInputQuantityV2View.isVisible())
|
if (!mDialogInputQuantityV2View.isVisible())
|
||||||
mDialogInputQuantityV2View
|
mDialogInputQuantityV2View
|
||||||
.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
|
.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
|
||||||
.setOnComplete((resultDTO, shouldCloseLU) -> {
|
.setOnComplete(resultDTO -> {
|
||||||
|
if(resultDTO.isAborted()) {
|
||||||
|
this.mViewModel.resetMatchedRows();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO()
|
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO()
|
||||||
.setNumCnf(resultDTO.getNumCnf())
|
.setNumCnf(resultDTO.getNumCnf())
|
||||||
.setQtaCnf(resultDTO.getQtaCnf())
|
.setQtaCnf(resultDTO.getQtaCnf())
|
||||||
.setQtaTot(resultDTO.getQtaTot())
|
.setQtaTot(resultDTO.getQtaTot())
|
||||||
.setPartitaMag(resultDTO.getPartitaMag())
|
.setPartitaMag(resultDTO.getPartitaMag())
|
||||||
.setDataScad(resultDTO.getDataScad());
|
.setDataScad(resultDTO.getDataScad());
|
||||||
onComplete.run(pickedQuantityDTO, shouldCloseLU);
|
onComplete.run(pickedQuantityDTO);
|
||||||
})
|
})
|
||||||
.setOnAbort(() -> this.mViewModel.resetMatchedRows())
|
.setOnAbort(() -> this.mViewModel.resetMatchedRows())
|
||||||
.show(getSupportFragmentManager(), "tag");
|
.show(getSupportFragmentManager(), "tag");
|
||||||
@@ -690,4 +696,15 @@ public class AccettazioneBollaPickingActivity extends BaseActivity implements Ac
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onConfirmAnomalie(int anomalie, RunnableArgs<Boolean> onConfirm) {
|
||||||
|
DialogSimpleMessageView.makeWarningDialog(new SpannableString(Html.fromHtml(String.format(getString(R.string.confirm_anomalie), anomalie))),
|
||||||
|
null, () -> {
|
||||||
|
onConfirm.run(true);
|
||||||
|
}, () -> {
|
||||||
|
onConfirm.run(false);
|
||||||
|
})
|
||||||
|
.show(getSupportFragmentManager(), "tag");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -305,8 +305,8 @@ public class AccettazioneBollaPickingViewModel {
|
|||||||
private void loadArticolo(String barcodeProd, PickDataDTO pickData, Runnable onComplete) {
|
private void loadArticolo(String barcodeProd, PickDataDTO pickData, Runnable onComplete) {
|
||||||
this.mArticoloRESTConsumer.searchByBarcode(barcodeProd, mtbAartList -> {
|
this.mArticoloRESTConsumer.searchByBarcode(barcodeProd, mtbAartList -> {
|
||||||
|
|
||||||
if (mtbAartList != null && mtbAartList.size() > 0) {
|
if (mtbAartList != null && !mtbAartList.isEmpty()) {
|
||||||
this.searchArtFromAnag(mtbAartList.get(0), pickData, onComplete);
|
this.searchArtFromAnag(mtbAartList.get(0), pickData, null, onComplete);
|
||||||
} else {
|
} else {
|
||||||
this.manageUnknownBarcode(barcodeProd, onComplete);
|
this.manageUnknownBarcode(barcodeProd, onComplete);
|
||||||
}
|
}
|
||||||
@@ -315,28 +315,41 @@ public class AccettazioneBollaPickingViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void searchArtFromAnag(MtbAart mtbAart, PickDataDTO pickData, Runnable onComplete) {
|
private void searchArtFromAnag(MtbAart mtbAart, PickDataDTO pickData, ArrayList<MtbAart> previousSearchedArts, Runnable onComplete) {
|
||||||
|
if (previousSearchedArts == null) previousSearchedArts = new ArrayList<>();
|
||||||
|
|
||||||
|
if (previousSearchedArts.contains(mtbAart)) {
|
||||||
|
manageNoArtFound(mtbAart, pickData);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
previousSearchedArts.add(mtbAart);
|
||||||
|
|
||||||
final List<PickingObjectDTO> pickingList = mPickingList.getValue();
|
final List<PickingObjectDTO> pickingList = mPickingList.getValue();
|
||||||
|
|
||||||
List<PickingObjectDTO> matchPickingObject = Stream.of(pickingList)
|
List<PickingObjectDTO> matchPickingObject = pickingList == null ? new ArrayList<>() :
|
||||||
|
pickingList.stream()
|
||||||
.filter(x -> UtilityString.equalsIgnoreCase(mtbAart.getCodMart(), x.getSitBollaAccettazione().getCodMart()))
|
.filter(x -> UtilityString.equalsIgnoreCase(mtbAart.getCodMart(), x.getSitBollaAccettazione().getCodMart()))
|
||||||
.toList();
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
for (PickingObjectDTO pickingObjectDTO : matchPickingObject) {
|
for (PickingObjectDTO pickingObjectDTO : matchPickingObject) {
|
||||||
pickingObjectDTO.setTempPickData(pickData);
|
pickingObjectDTO.setTempPickData(pickData);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.loadMatchedRows(matchPickingObject, mtbAart, pickData);
|
this.loadMatchedRows(matchPickingObject, mtbAart, pickData, previousSearchedArts);
|
||||||
onComplete.run();
|
onComplete.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadMatchedRows(List<PickingObjectDTO> matchedRows, MtbAart mtbAart, PickDataDTO pickDataDTO) {
|
private void loadMatchedRows(List<PickingObjectDTO> matchedRows, MtbAart mtbAart, PickDataDTO pickDataDTO, ArrayList<MtbAart> previousSearchedArts) {
|
||||||
if (matchedRows == null || matchedRows.isEmpty()) {
|
if (matchedRows == null || matchedRows.isEmpty()) {
|
||||||
|
this.sendOnLoadingStarted();
|
||||||
this.mArticoloRESTConsumer.findIfIsKit(mtbAart, mtbAartFind -> {
|
this.mArticoloRESTConsumer.findIfIsKit(mtbAart, mtbAartFind -> {
|
||||||
|
this.sendOnLoadingEnded();
|
||||||
if (mtbAartFind == null) {
|
if (mtbAartFind == null) {
|
||||||
manageNoArtFound(mtbAart, pickDataDTO);
|
manageNoArtFound(mtbAart, pickDataDTO);
|
||||||
} else {
|
} else {
|
||||||
searchArtFromAnag(mtbAartFind, pickDataDTO, () -> {});
|
searchArtFromAnag(mtbAartFind, pickDataDTO, previousSearchedArts, () -> {
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}, this::sendError);
|
}, this::sendError);
|
||||||
} else if (matchedRows.size() == 1) {
|
} else if (matchedRows.size() == 1) {
|
||||||
@@ -594,14 +607,14 @@ public class AccettazioneBollaPickingViewModel {
|
|||||||
partitaMag,
|
partitaMag,
|
||||||
dataScad,
|
dataScad,
|
||||||
true,
|
true,
|
||||||
(pickedQuantityDTO, shouldCloseLU) -> {
|
pickedQuantityDTO -> {
|
||||||
this.saveNewRow(pickingObjectDTO,
|
this.saveNewRow(pickingObjectDTO,
|
||||||
pickedQuantityDTO.getNumCnf(),
|
pickedQuantityDTO.getNumCnf(),
|
||||||
pickedQuantityDTO.getQtaCnf(),
|
pickedQuantityDTO.getQtaCnf(),
|
||||||
pickedQuantityDTO.getQtaTot(),
|
pickedQuantityDTO.getQtaTot(),
|
||||||
pickedQuantityDTO.getPartitaMag(),
|
pickedQuantityDTO.getPartitaMag(),
|
||||||
pickedQuantityDTO.getDataScad(),
|
pickedQuantityDTO.getDataScad(),
|
||||||
shouldCloseLU);
|
pickedQuantityDTO.isShouldCloseLu());
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.saveNewRow(
|
this.saveNewRow(
|
||||||
@@ -643,7 +656,6 @@ public class AccettazioneBollaPickingViewModel {
|
|||||||
.setQtaCnf(qtaCnf)
|
.setQtaCnf(qtaCnf)
|
||||||
.setNumCnf(numCnf)
|
.setNumCnf(numCnf)
|
||||||
.setPartitaMag(partitaMag)
|
.setPartitaMag(partitaMag)
|
||||||
// .setCodJcom(pickingObjectDTO.getSitBollaAccettazione().getCodJcom())
|
|
||||||
.setDataDoc(sitBolla != null ? sitBolla.getDataDoc() : firstAvailableBolla.getDataDoc())
|
.setDataDoc(sitBolla != null ? sitBolla.getDataDoc() : firstAvailableBolla.getDataDoc())
|
||||||
.setNumDoc(sitBolla != null ? sitBolla.getNumDoc() : firstAvailableBolla.getNumDoc())
|
.setNumDoc(sitBolla != null ? sitBolla.getNumDoc() : firstAvailableBolla.getNumDoc())
|
||||||
.setCodDtip(sitBolla != null ? sitBolla.getCodDtip() : firstAvailableBolla.getCodDtip())
|
.setCodDtip(sitBolla != null ? sitBolla.getCodDtip() : firstAvailableBolla.getCodDtip())
|
||||||
@@ -662,7 +674,7 @@ public class AccettazioneBollaPickingViewModel {
|
|||||||
.setMtbAart(pickingObjectDTO.getMtbAart());
|
.setMtbAart(pickingObjectDTO.getMtbAart());
|
||||||
|
|
||||||
pickingObjectDTO.getWithdrawMtbColrs().add(insertedMtbColr);
|
pickingObjectDTO.getWithdrawMtbColrs().add(insertedMtbColr);
|
||||||
mCurrentMtbColt.getMtbColr().add(insertedMtbColr);
|
mCurrentMtbColt.getMtbColr().add(0, insertedMtbColr);
|
||||||
|
|
||||||
//Chiamato removeListFilter perché cosi mi cancella tutti i dati di pick temporanei
|
//Chiamato removeListFilter perché cosi mi cancella tutti i dati di pick temporanei
|
||||||
resetMatchedRows();
|
resetMatchedRows();
|
||||||
@@ -694,7 +706,9 @@ public class AccettazioneBollaPickingViewModel {
|
|||||||
mtbColrToEdit.getPartitaMag(),
|
mtbColrToEdit.getPartitaMag(),
|
||||||
mtbColrToEdit.getDataScadPartita(),
|
mtbColrToEdit.getDataScadPartita(),
|
||||||
true,
|
true,
|
||||||
(pickedQuantityDTO, shouldCloseLU) -> {
|
pickedQuantityDTO -> {
|
||||||
|
if (pickedQuantityDTO == null)
|
||||||
|
return;
|
||||||
|
|
||||||
this.saveEditedRow(mtbColrToEdit,
|
this.saveEditedRow(mtbColrToEdit,
|
||||||
pickedQuantityDTO.getNumCnf(),
|
pickedQuantityDTO.getNumCnf(),
|
||||||
@@ -702,7 +716,7 @@ public class AccettazioneBollaPickingViewModel {
|
|||||||
pickedQuantityDTO.getQtaTot(),
|
pickedQuantityDTO.getQtaTot(),
|
||||||
pickedQuantityDTO.getPartitaMag(),
|
pickedQuantityDTO.getPartitaMag(),
|
||||||
pickedQuantityDTO.getDataScad(),
|
pickedQuantityDTO.getDataScad(),
|
||||||
shouldCloseLU);
|
pickedQuantityDTO.isShouldCloseLu());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -801,6 +815,29 @@ public class AccettazioneBollaPickingViewModel {
|
|||||||
} else {
|
} else {
|
||||||
CloseUDCRequestDTO closeUDCRequestDTO = new CloseUDCRequestDTO()
|
CloseUDCRequestDTO closeUDCRequestDTO = new CloseUDCRequestDTO()
|
||||||
.setMtbColt(mCurrentMtbColt);
|
.setMtbColt(mCurrentMtbColt);
|
||||||
|
|
||||||
|
ObservableArrayList<MtbColr> mtbColr = mCurrentMtbColt.getMtbColr();
|
||||||
|
List<PickingObjectDTO> pickingList = getPickingList().getValue();
|
||||||
|
|
||||||
|
int listCount = pickingList != null ? pickingList.size() : 0;
|
||||||
|
int anomalie = listCount > 0 ? listCount - mtbColr.size() : 0;
|
||||||
|
|
||||||
|
if (anomalie == 0) {
|
||||||
|
closeUdc(closeUDCRequestDTO);
|
||||||
|
} else {
|
||||||
|
onConfirmAnomalie(anomalie, canBeClose -> {
|
||||||
|
if (canBeClose) {
|
||||||
|
closeUdc(closeUDCRequestDTO);
|
||||||
|
} else {
|
||||||
|
this.sendOnLoadingEnded();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, this::sendError);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void closeUdc(CloseUDCRequestDTO closeUDCRequestDTO) {
|
||||||
mColliCaricoRESTConsumer.closeUDC(closeUDCRequestDTO, closeUDCResponse -> {
|
mColliCaricoRESTConsumer.closeUDC(closeUDCRequestDTO, closeUDCResponse -> {
|
||||||
|
|
||||||
Runnable onVersamentoCompleted = () -> {
|
Runnable onVersamentoCompleted = () -> {
|
||||||
@@ -813,8 +850,6 @@ public class AccettazioneBollaPickingViewModel {
|
|||||||
manageVersamentoAutomatico(onVersamentoCompleted);
|
manageVersamentoAutomatico(onVersamentoCompleted);
|
||||||
}, this::sendError);
|
}, this::sendError);
|
||||||
}
|
}
|
||||||
}, this::sendError);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void manageVersamentoAutomatico(Runnable onComplete) {
|
private void manageVersamentoAutomatico(Runnable onComplete) {
|
||||||
|
|
||||||
@@ -982,7 +1017,7 @@ public class AccettazioneBollaPickingViewModel {
|
|||||||
String partitaMag,
|
String partitaMag,
|
||||||
LocalDate dataScad,
|
LocalDate dataScad,
|
||||||
boolean canPartitaMagBeChanged,
|
boolean canPartitaMagBeChanged,
|
||||||
RunnableArgss<PickedQuantityDTO, Boolean> onComplete) {
|
RunnableArgs<PickedQuantityDTO> onComplete) {
|
||||||
if (this.mListener != null) mListener.onItemDispatched(pickingObjectDTO,
|
if (this.mListener != null) mListener.onItemDispatched(pickingObjectDTO,
|
||||||
mtbAart,
|
mtbAart,
|
||||||
initialNumCnf,
|
initialNumCnf,
|
||||||
@@ -1038,6 +1073,9 @@ public class AccettazioneBollaPickingViewModel {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void onConfirmAnomalie(int anomalie, RunnableArgs<Boolean> onConfirm) {
|
||||||
|
if (this.mListener != null) mListener.onConfirmAnomalie(anomalie, onConfirm);
|
||||||
|
}
|
||||||
|
|
||||||
public interface Listener extends ILoadingListener, ILUPrintListener, ILUBaseOperationsListener {
|
public interface Listener extends ILoadingListener, ILUPrintListener, ILUBaseOperationsListener {
|
||||||
|
|
||||||
@@ -1065,7 +1103,7 @@ public class AccettazioneBollaPickingViewModel {
|
|||||||
LocalDate dataScad,
|
LocalDate dataScad,
|
||||||
boolean canPartitaMagBeChanged,
|
boolean canPartitaMagBeChanged,
|
||||||
boolean canOverflowQuantity,
|
boolean canOverflowQuantity,
|
||||||
RunnableArgss<PickedQuantityDTO, Boolean> onComplete);
|
RunnableArgs<PickedQuantityDTO> onComplete);
|
||||||
|
|
||||||
void onFilterCodMartApplied(String codMartToFilter);
|
void onFilterCodMartApplied(String codMartToFilter);
|
||||||
|
|
||||||
@@ -1075,6 +1113,8 @@ public class AccettazioneBollaPickingViewModel {
|
|||||||
|
|
||||||
void onUnknownBarcodeScanned(String barcode, RunnableArgs<String> done, Runnable abort);
|
void onUnknownBarcodeScanned(String barcode, RunnableArgs<String> done, Runnable abort);
|
||||||
|
|
||||||
|
void onConfirmAnomalie(int anomalie, RunnableArgs<Boolean> onConfirm);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -2,12 +2,10 @@ package it.integry.integrywmsnative.gest.accettazione_bolla_picking.ui;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.os.Build;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
import androidx.annotation.RequiresApi;
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.core.content.res.ResourcesCompat;
|
import androidx.core.content.res.ResourcesCompat;
|
||||||
import androidx.databinding.ObservableArrayList;
|
import androidx.databinding.ObservableArrayList;
|
||||||
@@ -17,7 +15,6 @@ import androidx.recyclerview.widget.RecyclerView;
|
|||||||
import com.zhukic.sectionedrecyclerview.SectionedRecyclerViewAdapter;
|
import com.zhukic.sectionedrecyclerview.SectionedRecyclerViewAdapter;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.R;
|
import it.integry.integrywmsnative.R;
|
||||||
@@ -65,29 +62,10 @@ public class AccettazioneBollaPickingListAdapter extends SectionedRecyclerViewAd
|
|||||||
this.mShowSecondaryUntMis = showSecondaryUntMis;
|
this.mShowSecondaryUntMis = showSecondaryUntMis;
|
||||||
|
|
||||||
mutableDataSet.addOnListChangedCallback(new OnListGeneralChangedCallback() {
|
mutableDataSet.addOnListChangedCallback(new OnListGeneralChangedCallback() {
|
||||||
@RequiresApi(api = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
|
|
||||||
@Override
|
@Override
|
||||||
public void onChanged(ObservableList sender) {
|
public void onChanged(ObservableList sender) {
|
||||||
List<AccettazioneBollaPickingListModel> listaOrdinata = new ArrayList<>();
|
|
||||||
if (!sender.isEmpty()) {
|
|
||||||
listaOrdinata = new ArrayList<>(sender);
|
|
||||||
|
|
||||||
Collections.sort(listaOrdinata, (a, b) -> {
|
|
||||||
|
|
||||||
boolean condA = a.getQtaEvasa().floatValue() > 0;
|
|
||||||
boolean condB = b.getQtaEvasa().floatValue() > 0;
|
|
||||||
|
|
||||||
if (condA && !condB) {
|
|
||||||
return -1;
|
|
||||||
} else if (!condA && condB) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
mDataset.clear();
|
mDataset.clear();
|
||||||
mDataset.addAll(listaOrdinata);
|
mDataset.addAll(sender);
|
||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
notifyDataChanged();
|
notifyDataChanged();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ public class AccettazioneOrdiniPickingActivity extends BaseActivity implements A
|
|||||||
public BindableBoolean noLUPresent = new BindableBoolean(true);
|
public BindableBoolean noLUPresent = new BindableBoolean(true);
|
||||||
public BindableBoolean bottomSheetEnabled = new BindableBoolean(false);
|
public BindableBoolean bottomSheetEnabled = new BindableBoolean(false);
|
||||||
|
|
||||||
private int barcodeScannerIstanceID = -1;
|
private int mBarcodeScannerInstanceID = -1;
|
||||||
|
|
||||||
private List<OrdineAccettazioneInevasoDTO> mOrders;
|
private List<OrdineAccettazioneInevasoDTO> mOrders;
|
||||||
private List<SitArtOrdDTO> mSitArts;
|
private List<SitArtOrdDTO> mSitArts;
|
||||||
@@ -310,10 +310,10 @@ public class AccettazioneOrdiniPickingActivity extends BaseActivity implements A
|
|||||||
this.mBindings.bottomSheetLuContent.collapse();
|
this.mBindings.bottomSheetLuContent.collapse();
|
||||||
} else if (!noLUPresent.get()) {
|
} else if (!noLUPresent.get()) {
|
||||||
this.mShouldCloseActivity = true;
|
this.mShouldCloseActivity = true;
|
||||||
BarcodeManager.removeCallback(barcodeScannerIstanceID);
|
BarcodeManager.removeCallback(mBarcodeScannerInstanceID);
|
||||||
this.mViewModel.closeLU();
|
this.mViewModel.closeLU();
|
||||||
} else {
|
} else {
|
||||||
BarcodeManager.removeCallback(barcodeScannerIstanceID);
|
BarcodeManager.removeCallback(mBarcodeScannerInstanceID);
|
||||||
super.onBackPressed();
|
super.onBackPressed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -344,7 +344,7 @@ public class AccettazioneOrdiniPickingActivity extends BaseActivity implements A
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initBarcodeReader() {
|
private void initBarcodeReader() {
|
||||||
barcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO().setOnScanSuccessful(onScanSuccessful).setOnScanFailed(ex -> UtilityExceptions.defaultException(this, ex, false)));
|
mBarcodeScannerInstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO().setOnScanSuccessful(onScanSuccessful).setOnScanFailed(ex -> UtilityExceptions.defaultException(this, ex, false)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initRecyclerView() {
|
private void initRecyclerView() {
|
||||||
@@ -654,9 +654,17 @@ public class AccettazioneOrdiniPickingActivity extends BaseActivity implements A
|
|||||||
this.fabPopupMenu.dismiss();
|
this.fabPopupMenu.dismiss();
|
||||||
this.onLoadingStarted();
|
this.onLoadingStarted();
|
||||||
|
|
||||||
|
executorService.execute(() -> {
|
||||||
|
try {
|
||||||
|
//Aggiunto perchè a volte rimaneva il dialog di caricamento avanti a tutto
|
||||||
|
Thread.sleep(1000);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
this.mViewModel.createNewLU(null, null, null, false, () -> {
|
this.mViewModel.createNewLU(null, null, null, false, () -> {
|
||||||
this.onLoadingEnded();
|
this.onLoadingEnded();
|
||||||
});
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void trackPackaging() {
|
public void trackPackaging() {
|
||||||
@@ -759,7 +767,7 @@ public class AccettazioneOrdiniPickingActivity extends BaseActivity implements A
|
|||||||
UtilityExceptions.defaultException(this, ex);
|
UtilityExceptions.defaultException(this, ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
BarcodeManager.enable();
|
BarcodeManager.enable(mBarcodeScannerInstanceID);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -774,13 +782,20 @@ public class AccettazioneOrdiniPickingActivity extends BaseActivity implements A
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onItemDispatched(PickingObjectDTO pickingObjectDTO, MtbAart mtbAart, BigDecimal initialNumCnf, BigDecimal initialQtaCnf, BigDecimal initialQtaTot, BigDecimal totalQtaOrd, BigDecimal totalNumCnfOrd, BigDecimal qtaCnfOrd, BigDecimal totalQtaToBeTaken, BigDecimal totalNumCnfToBeTaken, BigDecimal qtaCnfToBeTaken, BigDecimal totalQtaAvailable, BigDecimal totalNumCnfAvailable, BigDecimal qtaCnfAvailable, String partitaMag, LocalDate dataScad, boolean canPartitaMagBeChanged, boolean canOverflowQuantity, String customArtDescription, RunnableArgss<PickedQuantityDTO, Boolean> onComplete) {
|
public void onItemDispatched(PickingObjectDTO pickingObjectDTO, MtbAart mtbAart, BigDecimal initialNumCnf, BigDecimal initialQtaCnf, BigDecimal initialQtaTot, BigDecimal totalQtaOrd, BigDecimal totalNumCnfOrd, BigDecimal qtaCnfOrd, BigDecimal totalQtaToBeTaken, BigDecimal totalNumCnfToBeTaken, BigDecimal qtaCnfToBeTaken, BigDecimal totalQtaAvailable, BigDecimal totalNumCnfAvailable, BigDecimal qtaCnfAvailable, String partitaMag, LocalDate dataScad, boolean canPartitaMagBeChanged, boolean canOverflowQuantity, String customArtDescription, RunnableArgss<PickedQuantityDTO, Boolean> onComplete) {
|
||||||
DialogInputQuantityV2DTO dialogInputQuantityV2DTO = new DialogInputQuantityV2DTO().setMtbAart(mtbAart).setInitialNumCnf(initialNumCnf).setInitialQtaCnf(initialQtaCnf).setInitialQtaTot(initialQtaTot).setTotalQtaOrd(totalQtaOrd).setTotalNumCnfOrd(totalNumCnfOrd).setQtaCnfOrd(qtaCnfOrd).setTotalQtaToBeTaken(totalQtaToBeTaken).setTotalNumCnfToBeTaken(totalNumCnfToBeTaken).setQtaCnfToBeTaken(qtaCnfToBeTaken).setTotalQtaAvailable(totalQtaAvailable).setTotalNumCnfAvailable(totalNumCnfAvailable).setQtaCnfAvailable(qtaCnfAvailable).setPartitaMag(partitaMag).setDataScad(dataScad).setCanPartitaMagBeChanged(canPartitaMagBeChanged).setCanLUBeClosed(true).setCanOverflowOrderQuantity(canOverflowQuantity).setCustomArtDescription(customArtDescription);
|
DialogInputQuantityV2DTO dialogInputQuantityV2DTO = new DialogInputQuantityV2DTO().setMtbAart(mtbAart).setInitialNumCnf(initialNumCnf).setInitialQtaCnf(initialQtaCnf).setInitialQtaTot(initialQtaTot).setTotalQtaOrd(totalQtaOrd).setTotalNumCnfOrd(totalNumCnfOrd).setTotalQtaCnfOrd(qtaCnfOrd).setTotalQtaToBeTaken(totalQtaToBeTaken).setTotalNumCnfToBeTaken(totalNumCnfToBeTaken).setQtaCnfToBeTaken(qtaCnfToBeTaken).setTotalQtaAvailable(totalQtaAvailable).setTotalNumCnfAvailable(totalNumCnfAvailable).setQtaCnfAvailable(qtaCnfAvailable).setPartitaMag(partitaMag).setDataScad(dataScad).setCanPartitaMagBeChanged(canPartitaMagBeChanged).setCanLUBeClosed(true).setCanOverflowOrderQuantity(canOverflowQuantity).setCustomArtDescription(customArtDescription);
|
||||||
|
|
||||||
if (!mDialogInputQuantityV2View.isVisible())
|
if (!mDialogInputQuantityV2View.isVisible())
|
||||||
mDialogInputQuantityV2View.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO).setOnComplete((resultDTO, shouldCloseLU) -> {
|
mDialogInputQuantityV2View
|
||||||
|
.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO).setOnComplete(resultDTO -> {
|
||||||
|
if (resultDTO == null) {
|
||||||
|
this.mViewModel.resetMatchedRows();
|
||||||
|
return;
|
||||||
|
}
|
||||||
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO().setNumCnf(resultDTO.getNumCnf()).setQtaCnf(resultDTO.getQtaCnf()).setQtaTot(resultDTO.getQtaTot()).setPartitaMag(resultDTO.getPartitaMag()).setDataScad(resultDTO.getDataScad());
|
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO().setNumCnf(resultDTO.getNumCnf()).setQtaCnf(resultDTO.getQtaCnf()).setQtaTot(resultDTO.getQtaTot()).setPartitaMag(resultDTO.getPartitaMag()).setDataScad(resultDTO.getDataScad());
|
||||||
onComplete.run(pickedQuantityDTO, shouldCloseLU);
|
onComplete.run(pickedQuantityDTO, pickedQuantityDTO.isShouldCloseLu());
|
||||||
}).setOnAbort(() -> this.mViewModel.resetMatchedRows()).show(getSupportFragmentManager(), "tag");
|
})
|
||||||
|
.setOnAbort(() -> this.mViewModel.resetMatchedRows())
|
||||||
|
.show(getSupportFragmentManager(), "tag");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ public class ArticoliInGiacenzaFragment extends BaseFragment implements ITitledF
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void choosePosition(RunnableArgs<MtbDepoPosizione> onComplete) {
|
private void choosePosition(RunnableArgs<MtbDepoPosizione> onComplete) {
|
||||||
DialogAskPositionOfLUView.makeBase(false, (status, mtbDepoPosizione) -> {
|
DialogAskPositionOfLUView.newInstance(false, (status, mtbDepoPosizione) -> {
|
||||||
|
|
||||||
if (status == DialogConsts.Results.ABORT) {
|
if (status == DialogConsts.Results.ABORT) {
|
||||||
popMe();
|
popMe();
|
||||||
@@ -107,7 +107,7 @@ public class ArticoliInGiacenzaFragment extends BaseFragment implements ITitledF
|
|||||||
onComplete.run(mtbDepoPosizione);
|
onComplete.run(mtbDepoPosizione);
|
||||||
}
|
}
|
||||||
|
|
||||||
}, this::onError)
|
})
|
||||||
.show(requireActivity().getSupportFragmentManager(), "tag");
|
.show(requireActivity().getSupportFragmentManager(), "tag");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
|||||||
DialogInputQuantityV2View dialogInputQuantityV2View;
|
DialogInputQuantityV2View dialogInputQuantityV2View;
|
||||||
|
|
||||||
|
|
||||||
private int mBarcodeScannerIstanceID;
|
private int mBarcodeScannerInstanceID;
|
||||||
private ActivityContabDocInterniEditBinding binding;
|
private ActivityContabDocInterniEditBinding binding;
|
||||||
public BindableString documentHeader = new BindableString(true);
|
public BindableString documentHeader = new BindableString(true);
|
||||||
public BindableString documentRifHeader = new BindableString(true);
|
public BindableString documentRifHeader = new BindableString(true);
|
||||||
@@ -238,12 +238,12 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void manualSearch() {
|
public void manualSearch() {
|
||||||
BarcodeManager.disable();
|
BarcodeManager.disable(mBarcodeScannerInstanceID);
|
||||||
DialogSimpleInputHelper.makeInputDialog(this,
|
DialogSimpleInputHelper.makeInputDialog(this,
|
||||||
"Ricerca articolo",
|
"Ricerca articolo",
|
||||||
null,
|
null,
|
||||||
"Cod articolo / Barcode",
|
"Cod articolo / Barcode",
|
||||||
barcodeProd -> this.viewModel.loadArticoloByCodMartOrBarcode(barcodeProd), BarcodeManager::enable).show();
|
barcodeProd -> this.viewModel.loadArticoloByCodMartOrBarcode(barcodeProd), () -> BarcodeManager.enable(mBarcodeScannerInstanceID)).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -263,7 +263,7 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mBarcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
mBarcodeScannerInstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
||||||
.setOnScanSuccessful(this.viewModel::processBarcode)
|
.setOnScanSuccessful(this.viewModel::processBarcode)
|
||||||
.setOnScanFailed(this::onError));
|
.setOnScanFailed(this::onError));
|
||||||
this.viewModel.fetchDocumentRows();
|
this.viewModel.fetchDocumentRows();
|
||||||
@@ -271,7 +271,7 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
BarcodeManager.removeCallback(mBarcodeScannerIstanceID);
|
BarcodeManager.removeCallback(mBarcodeScannerInstanceID);
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -356,7 +356,9 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
|||||||
|
|
||||||
if (!dialogInputQuantityV2View.isAdded())
|
if (!dialogInputQuantityV2View.isAdded())
|
||||||
dialogInputQuantityV2View.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
|
dialogInputQuantityV2View.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
|
||||||
.setOnComplete((resultDTO, shouldCloseLU) -> {
|
.setOnComplete(resultDTO -> {
|
||||||
|
if(resultDTO == null || resultDTO.isAborted()) return;
|
||||||
|
|
||||||
this.onLoadingStarted();
|
this.onLoadingStarted();
|
||||||
this.viewModel.saveRow(row, resultDTO);
|
this.viewModel.saveRow(row, resultDTO);
|
||||||
})
|
})
|
||||||
@@ -385,7 +387,7 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBackPressed() {
|
public void onBackPressed() {
|
||||||
BarcodeManager.removeCallback(mBarcodeScannerIstanceID);
|
BarcodeManager.removeCallback(mBarcodeScannerInstanceID);
|
||||||
super.onBackPressed();
|
super.onBackPressed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import javax.inject.Inject;
|
|||||||
import it.integry.integrywmsnative.BR;
|
import it.integry.integrywmsnative.BR;
|
||||||
import it.integry.integrywmsnative.MainApplication;
|
import it.integry.integrywmsnative.MainApplication;
|
||||||
import it.integry.integrywmsnative.R;
|
import it.integry.integrywmsnative.R;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.entity.InventarioRoomDTO;
|
import it.integry.integrywmsnative.core.data_store.db.entity.InventarioEntity;
|
||||||
import it.integry.integrywmsnative.core.expansion.BaseFragment;
|
import it.integry.integrywmsnative.core.expansion.BaseFragment;
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgss;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgss;
|
||||||
import it.integry.integrywmsnative.core.interfaces.ILifecycleFragment;
|
import it.integry.integrywmsnative.core.interfaces.ILifecycleFragment;
|
||||||
@@ -43,7 +43,7 @@ public class ElencoInventariFragment extends BaseFragment implements ITitledFrag
|
|||||||
|
|
||||||
public ObservableField<Boolean> canCreateInventario = new ObservableField<>(false);
|
public ObservableField<Boolean> canCreateInventario = new ObservableField<>(false);
|
||||||
|
|
||||||
private int barcodeScannerIstanceID = -1;
|
private int mBarcodeScannerInstanceID = -1;
|
||||||
|
|
||||||
public ElencoInventariFragment() {
|
public ElencoInventariFragment() {
|
||||||
// Required empty public constructor
|
// Required empty public constructor
|
||||||
@@ -94,7 +94,7 @@ public class ElencoInventariFragment extends BaseFragment implements ITitledFrag
|
|||||||
mBinding.emptyView.setVisibility(data == null || data.isEmpty() ? View.VISIBLE : View.GONE);
|
mBinding.emptyView.setVisibility(data == null || data.isEmpty() ? View.VISIBLE : View.GONE);
|
||||||
});
|
});
|
||||||
|
|
||||||
var itemType = new Type<InventarioRoomDTO, FragmentElencoInventarioListSingleItemBinding>(R.layout.fragment_elenco_inventario_list_single_item, BR.item);
|
var itemType = new Type<InventarioEntity, FragmentElencoInventarioListSingleItemBinding>(R.layout.fragment_elenco_inventario_list_single_item, BR.item);
|
||||||
itemType.onClick(x -> {
|
itemType.onClick(x -> {
|
||||||
|
|
||||||
var item = x.getBinding().getItem();
|
var item = x.getBinding().getItem();
|
||||||
@@ -123,7 +123,7 @@ public class ElencoInventariFragment extends BaseFragment implements ITitledFrag
|
|||||||
});
|
});
|
||||||
|
|
||||||
new LiveAdapter(mViewModel.getInventarioList(), this)
|
new LiveAdapter(mViewModel.getInventarioList(), this)
|
||||||
.map(InventarioRoomDTO.class, itemType)
|
.map(InventarioEntity.class, itemType)
|
||||||
.into(this.mBinding.inventarioList);
|
.into(this.mBinding.inventarioList);
|
||||||
|
|
||||||
|
|
||||||
@@ -152,8 +152,8 @@ public class ElencoInventariFragment extends BaseFragment implements ITitledFrag
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onInventarioLoaded(InventarioRoomDTO inventarioRoomDTO, List<InventarioArtDTO> listaArts) {
|
public void onInventarioLoaded(InventarioEntity inventarioEntity, List<InventarioArtDTO> listaArts) {
|
||||||
startPicking(inventarioRoomDTO, listaArts);
|
startPicking(inventarioEntity, listaArts);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -173,8 +173,8 @@ public class ElencoInventariFragment extends BaseFragment implements ITitledFrag
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void startPicking(InventarioRoomDTO inventarioRoomDTO, List<InventarioArtDTO> listArts) {
|
private void startPicking(InventarioEntity inventarioEntity, List<InventarioArtDTO> listArts) {
|
||||||
PickingInventarioActivity.startActivity(requireContext(), inventarioRoomDTO, listArts);
|
PickingInventarioActivity.startActivity(requireContext(), inventarioEntity, listArts);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -196,13 +196,13 @@ public class ElencoInventariFragment extends BaseFragment implements ITitledFrag
|
|||||||
.show(requireActivity().getSupportFragmentManager(), "tag");
|
.show(requireActivity().getSupportFragmentManager(), "tag");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deleteInventarioRequest(InventarioRoomDTO inventarioRoomDTO) {
|
public void deleteInventarioRequest(InventarioEntity inventarioEntity) {
|
||||||
DialogYesNoView
|
DialogYesNoView
|
||||||
.newInstance(null, "Vuoi cancellare l'inventario?",
|
.newInstance(null, "Vuoi cancellare l'inventario?",
|
||||||
dialogResponse -> {
|
dialogResponse -> {
|
||||||
switch (dialogResponse) {
|
switch (dialogResponse) {
|
||||||
case YES:
|
case YES:
|
||||||
this.mViewModel.deleteInventario(inventarioRoomDTO);
|
this.mViewModel.deleteInventario(inventarioEntity);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NO:
|
case NO:
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import com.annimon.stream.Stream;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.data_store.db.entity.InventarioRoomDTO;
|
import it.integry.integrywmsnative.core.data_store.db.entity.InventarioEntity;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.respository_new.InventarioRepository;
|
import it.integry.integrywmsnative.core.data_store.db.respository_new.InventarioRepository;
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgss;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgss;
|
||||||
@@ -25,7 +25,7 @@ public class ElencoInventariViewModel {
|
|||||||
private final SettingsManager settingsManager;
|
private final SettingsManager settingsManager;
|
||||||
private Listener listener;
|
private Listener listener;
|
||||||
|
|
||||||
private LiveData<List<InventarioRoomDTO>> inventarioList;
|
private LiveData<List<InventarioEntity>> inventarioList;
|
||||||
|
|
||||||
private final String codMdep;
|
private final String codMdep;
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@ public class ElencoInventariViewModel {
|
|||||||
inventarioList = null;
|
inventarioList = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LiveData<List<InventarioRoomDTO>> getInventarioList() {
|
public LiveData<List<InventarioEntity>> getInventarioList() {
|
||||||
return inventarioList;
|
return inventarioList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,12 +101,12 @@ public class ElencoInventariViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void createNewInventario(long inventoryId, String zone, RunnableArgss<InventarioRoomDTO, List<InventarioArtDTO>> onComplete) {
|
public void createNewInventario(long inventoryId, String zone, RunnableArgss<InventarioEntity, List<InventarioArtDTO>> onComplete) {
|
||||||
this.sendOnLoadingStarted();
|
this.sendOnLoadingStarted();
|
||||||
|
|
||||||
var codMdep = settingsManager.getSettings().getUserSession().getDepo().getCodMdep();
|
var codMdep = settingsManager.getSettings().getUserSession().getDepo().getCodMdep();
|
||||||
|
|
||||||
var createdInventario = new InventarioRoomDTO();
|
var createdInventario = new InventarioEntity();
|
||||||
createdInventario.setIdInventario(inventoryId);
|
createdInventario.setIdInventario(inventoryId);
|
||||||
createdInventario.setZona(zone);
|
createdInventario.setZona(zone);
|
||||||
createdInventario.setCodMdep(codMdep);
|
createdInventario.setCodMdep(codMdep);
|
||||||
@@ -121,8 +121,8 @@ public class ElencoInventariViewModel {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deleteInventario(InventarioRoomDTO inventarioRoomDTO) {
|
public void deleteInventario(InventarioEntity inventarioEntity) {
|
||||||
inventarioRepository.delete(inventarioRoomDTO, null, this::sendOnError);
|
inventarioRepository.delete(inventarioEntity, null, this::sendOnError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -134,8 +134,8 @@ public class ElencoInventariViewModel {
|
|||||||
if (listener != null) listener.onInventarioInfoRequest(onComplete);
|
if (listener != null) listener.onInventarioInfoRequest(onComplete);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendOnInventarioLoaded(InventarioRoomDTO inventarioRoomDTO, List<InventarioArtDTO> listaArts) {
|
private void sendOnInventarioLoaded(InventarioEntity inventarioEntity, List<InventarioArtDTO> listaArts) {
|
||||||
if (listener != null) listener.onInventarioLoaded(inventarioRoomDTO, listaArts);
|
if (listener != null) listener.onInventarioLoaded(inventarioEntity, listaArts);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendCreateInventarioRequest(long inventoryId, String zone) {
|
private void sendCreateInventarioRequest(long inventoryId, String zone) {
|
||||||
@@ -170,7 +170,7 @@ public class ElencoInventariViewModel {
|
|||||||
|
|
||||||
void onInventarioInfoRequest(RunnableArgss<Long, String> onComplete);
|
void onInventarioInfoRequest(RunnableArgss<Long, String> onComplete);
|
||||||
|
|
||||||
void onInventarioLoaded(InventarioRoomDTO inventarioRoomDTO, List<InventarioArtDTO> listaArts);
|
void onInventarioLoaded(InventarioEntity inventarioEntity, List<InventarioArtDTO> listaArts);
|
||||||
|
|
||||||
void onInventoriesLoadingStarted();
|
void onInventoriesLoadingStarted();
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
|||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.MainApplication;
|
import it.integry.integrywmsnative.MainApplication;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.entity.InventarioRoomDTO;
|
import it.integry.integrywmsnative.core.data_store.db.entity.InventarioEntity;
|
||||||
import it.integry.integrywmsnative.databinding.BottomSheetInventarioActionsViewBinding;
|
import it.integry.integrywmsnative.databinding.BottomSheetInventarioActionsViewBinding;
|
||||||
|
|
||||||
public class BottomSheetInventarioActionsView extends BottomSheetDialogFragment {
|
public class BottomSheetInventarioActionsView extends BottomSheetDialogFragment {
|
||||||
@@ -28,9 +28,9 @@ public class BottomSheetInventarioActionsView extends BottomSheetDialogFragment
|
|||||||
private BottomSheetInventarioActionsViewBinding mBinding;
|
private BottomSheetInventarioActionsViewBinding mBinding;
|
||||||
private Listener mListener;
|
private Listener mListener;
|
||||||
|
|
||||||
private final InventarioRoomDTO inputItem;
|
private final InventarioEntity inputItem;
|
||||||
|
|
||||||
public BottomSheetInventarioActionsView(InventarioRoomDTO inputItem) {
|
public BottomSheetInventarioActionsView(InventarioEntity inputItem) {
|
||||||
this.inputItem = inputItem;
|
this.inputItem = inputItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,17 +2,17 @@ package it.integry.integrywmsnative.gest.inventario.bottom_sheet__inventario_act
|
|||||||
|
|
||||||
import androidx.lifecycle.MutableLiveData;
|
import androidx.lifecycle.MutableLiveData;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.data_store.db.entity.InventarioRoomDTO;
|
import it.integry.integrywmsnative.core.data_store.db.entity.InventarioEntity;
|
||||||
|
|
||||||
public class BottomSheetInventarioActionsViewModel {
|
public class BottomSheetInventarioActionsViewModel {
|
||||||
|
|
||||||
private final MutableLiveData<InventarioRoomDTO> mCurrentItem = new MutableLiveData<>();
|
private final MutableLiveData<InventarioEntity> mCurrentItem = new MutableLiveData<>();
|
||||||
|
|
||||||
public void init(InventarioRoomDTO item) {
|
public void init(InventarioEntity item) {
|
||||||
this.mCurrentItem.postValue(item);
|
this.mCurrentItem.postValue(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MutableLiveData<InventarioRoomDTO> getCurrentItem() {
|
public MutableLiveData<InventarioEntity> getCurrentItem() {
|
||||||
return mCurrentItem;
|
return mCurrentItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import it.integry.integrywmsnative.R;
|
|||||||
import it.integry.integrywmsnative.core.barcode_reader.BarcodeCallbackDTO;
|
import it.integry.integrywmsnative.core.barcode_reader.BarcodeCallbackDTO;
|
||||||
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
||||||
import it.integry.integrywmsnative.core.data_cache.DataCache;
|
import it.integry.integrywmsnative.core.data_cache.DataCache;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.entity.InventarioRoomDTO;
|
import it.integry.integrywmsnative.core.data_store.db.entity.InventarioEntity;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.entity.InventarioRowRoomDTO;
|
import it.integry.integrywmsnative.core.data_store.db.entity.InventarioRowRoomDTO;
|
||||||
import it.integry.integrywmsnative.core.expansion.BaseActivity;
|
import it.integry.integrywmsnative.core.expansion.BaseActivity;
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
@@ -61,13 +61,13 @@ public class PickingInventarioActivity extends BaseActivity implements PickingIn
|
|||||||
|
|
||||||
private static final String KEY_INVENTARIO = "key_inventario";
|
private static final String KEY_INVENTARIO = "key_inventario";
|
||||||
private static final String KEY_INVENTARIO_ARTS = "key_inventario_arts";
|
private static final String KEY_INVENTARIO_ARTS = "key_inventario_arts";
|
||||||
private int barcodeScannerIstanceID;
|
private int mBarcodeScannerInstanceID;
|
||||||
|
|
||||||
//Pass here all external parameters
|
//Pass here all external parameters
|
||||||
public static void startActivity(Context context, InventarioRoomDTO inventarioRoomDTO, List<InventarioArtDTO> inventarioArts) {
|
public static void startActivity(Context context, InventarioEntity inventarioEntity, List<InventarioArtDTO> inventarioArts) {
|
||||||
Intent myIntent = new Intent(context, PickingInventarioActivity.class);
|
Intent myIntent = new Intent(context, PickingInventarioActivity.class);
|
||||||
|
|
||||||
String keyExtraItem = DataCache.addItem(inventarioRoomDTO);
|
String keyExtraItem = DataCache.addItem(inventarioEntity);
|
||||||
myIntent.putExtra(KEY_INVENTARIO, keyExtraItem);
|
myIntent.putExtra(KEY_INVENTARIO, keyExtraItem);
|
||||||
|
|
||||||
String keyExtraArtsItem = DataCache.addItem(inventarioArts);
|
String keyExtraArtsItem = DataCache.addItem(inventarioArts);
|
||||||
@@ -125,7 +125,7 @@ public class PickingInventarioActivity extends BaseActivity implements PickingIn
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBackPressed() {
|
public void onBackPressed() {
|
||||||
BarcodeManager.removeCallback(barcodeScannerIstanceID);
|
BarcodeManager.removeCallback(mBarcodeScannerInstanceID);
|
||||||
super.onBackPressed();
|
super.onBackPressed();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,7 +177,7 @@ public class PickingInventarioActivity extends BaseActivity implements PickingIn
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initBarcodeReader() {
|
private void initBarcodeReader() {
|
||||||
barcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
mBarcodeScannerInstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
||||||
.setOnScanSuccessful(onScanSuccessful)
|
.setOnScanSuccessful(onScanSuccessful)
|
||||||
.setOnScanFailed(ex -> UtilityExceptions.defaultException(this, ex, false)));
|
.setOnScanFailed(ex -> UtilityExceptions.defaultException(this, ex, false)));
|
||||||
}
|
}
|
||||||
@@ -209,14 +209,14 @@ public class PickingInventarioActivity extends BaseActivity implements PickingIn
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void manualSearch() {
|
public void manualSearch() {
|
||||||
BarcodeManager.disable();
|
BarcodeManager.disable(mBarcodeScannerInstanceID);
|
||||||
DialogSimpleInputHelper.makeInputDialog(this,
|
DialogSimpleInputHelper.makeInputDialog(this,
|
||||||
"Ricerca articolo",
|
"Ricerca articolo",
|
||||||
null,
|
null,
|
||||||
"Cod articolo / Barcode",
|
"Cod articolo / Barcode",
|
||||||
barcodeProd ->
|
barcodeProd ->
|
||||||
this.mViewModel.loadArticoloByCodMartOrBarcode(barcodeProd, BarcodeManager::enable),
|
this.mViewModel.loadArticoloByCodMartOrBarcode(barcodeProd, () -> BarcodeManager.enable(mBarcodeScannerInstanceID)),
|
||||||
BarcodeManager::enable)
|
() -> BarcodeManager.enable(mBarcodeScannerInstanceID))
|
||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -241,7 +241,9 @@ public class PickingInventarioActivity extends BaseActivity implements PickingIn
|
|||||||
|
|
||||||
if (!mDialogInputQuantityV2View.isVisible())
|
if (!mDialogInputQuantityV2View.isVisible())
|
||||||
mDialogInputQuantityV2View.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
|
mDialogInputQuantityV2View.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
|
||||||
.setOnComplete((resultDTO, shouldCloseLU) -> {
|
.setOnComplete(resultDTO -> {
|
||||||
|
if(resultDTO == null || resultDTO.isAborted()) return;
|
||||||
|
|
||||||
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO()
|
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO()
|
||||||
.setNumCnf(resultDTO.getNumCnf())
|
.setNumCnf(resultDTO.getNumCnf())
|
||||||
.setQtaCnf(resultDTO.getQtaCnf())
|
.setQtaCnf(resultDTO.getQtaCnf())
|
||||||
@@ -249,7 +251,7 @@ public class PickingInventarioActivity extends BaseActivity implements PickingIn
|
|||||||
.setPartitaMag(resultDTO.getPartitaMag())
|
.setPartitaMag(resultDTO.getPartitaMag())
|
||||||
.setDataScad(resultDTO.getDataScad());
|
.setDataScad(resultDTO.getDataScad());
|
||||||
|
|
||||||
onComplete.run(pickedQuantityDTO, shouldCloseLU);
|
onComplete.run(pickedQuantityDTO, pickedQuantityDTO.isShouldCloseLu());
|
||||||
})
|
})
|
||||||
.show(getSupportFragmentManager(), "tag");
|
.show(getSupportFragmentManager(), "tag");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.entity.InventarioRoomDTO;
|
import it.integry.integrywmsnative.core.data_store.db.entity.InventarioEntity;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.entity.InventarioRowRoomDTO;
|
import it.integry.integrywmsnative.core.data_store.db.entity.InventarioRowRoomDTO;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.respository_new.InventarioRepository;
|
import it.integry.integrywmsnative.core.data_store.db.respository_new.InventarioRepository;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.respository_new.InventarioRowRepository;
|
import it.integry.integrywmsnative.core.data_store.db.respository_new.InventarioRowRepository;
|
||||||
@@ -41,7 +41,7 @@ public class PickingInventarioViewModel extends ViewModel {
|
|||||||
private final BarcodeRESTConsumer barcodeRESTConsumer;
|
private final BarcodeRESTConsumer barcodeRESTConsumer;
|
||||||
private final InventarioRepository inventarioRepository;
|
private final InventarioRepository inventarioRepository;
|
||||||
private final InventarioRowRepository inventarioRowRepository;
|
private final InventarioRowRepository inventarioRowRepository;
|
||||||
public MutableLiveData<InventarioRoomDTO> currentInventario = new MutableLiveData<>();
|
public MutableLiveData<InventarioEntity> currentInventario = new MutableLiveData<>();
|
||||||
public LiveData<List<InventarioRowRoomDTO>> currentInventarioRows = new MutableLiveData<>();
|
public LiveData<List<InventarioRowRoomDTO>> currentInventarioRows = new MutableLiveData<>();
|
||||||
private boolean canAddUnknownItems;
|
private boolean canAddUnknownItems;
|
||||||
private boolean flagShouldAskToCreateOrUpdateRowInventario;
|
private boolean flagShouldAskToCreateOrUpdateRowInventario;
|
||||||
@@ -56,14 +56,14 @@ public class PickingInventarioViewModel extends ViewModel {
|
|||||||
this.barcodeRESTConsumer = barcodeRESTConsumer;
|
this.barcodeRESTConsumer = barcodeRESTConsumer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init(InventarioRoomDTO inventarioRoomDTO, List<InventarioArtDTO> inventarioArts, boolean canAddUnknownItems, boolean flagShouldAskToCreateOrUpdateRowInventario) {
|
public void init(InventarioEntity inventarioEntity, List<InventarioArtDTO> inventarioArts, boolean canAddUnknownItems, boolean flagShouldAskToCreateOrUpdateRowInventario) {
|
||||||
this.canAddUnknownItems = canAddUnknownItems;
|
this.canAddUnknownItems = canAddUnknownItems;
|
||||||
this.flagShouldAskToCreateOrUpdateRowInventario = flagShouldAskToCreateOrUpdateRowInventario;
|
this.flagShouldAskToCreateOrUpdateRowInventario = flagShouldAskToCreateOrUpdateRowInventario;
|
||||||
|
|
||||||
this.sendOnLoadingStarted();
|
this.sendOnLoadingStarted();
|
||||||
|
|
||||||
this.currentInventario.postValue(inventarioRoomDTO);
|
this.currentInventario.postValue(inventarioEntity);
|
||||||
this.currentInventarioRows = inventarioRowRepository.retrieve(inventarioRoomDTO.getId());
|
this.currentInventarioRows = inventarioRowRepository.retrieve(inventarioEntity.getId());
|
||||||
this.availableInventarioArts = inventarioArts == null ? new ArrayList<>() : inventarioArts;
|
this.availableInventarioArts = inventarioArts == null ? new ArrayList<>() : inventarioArts;
|
||||||
|
|
||||||
UtilityLiveData.observeOnce(this.currentInventarioRows, data -> {
|
UtilityLiveData.observeOnce(this.currentInventarioRows, data -> {
|
||||||
@@ -73,7 +73,7 @@ public class PickingInventarioViewModel extends ViewModel {
|
|||||||
this.sendOnLoadingEnded();
|
this.sendOnLoadingEnded();
|
||||||
}
|
}
|
||||||
|
|
||||||
public LiveData<InventarioRoomDTO> getCurrentInventario() {
|
public LiveData<InventarioEntity> getCurrentInventario() {
|
||||||
return currentInventario;
|
return currentInventario;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user