Compare commits
41 Commits
v1.8.8(238
...
v1.20.0(24
| Author | SHA1 | Date | |
|---|---|---|---|
| c3e2a2a8fd | |||
| 99f0691c55 | |||
| 37ebd96a0f | |||
| c012c54805 | |||
| 9de6dcce80 | |||
| fc403ec419 | |||
| 4968f2f4fa | |||
| a7ea9b9022 | |||
| 28a034f0d6 | |||
| ca3f1f5962 | |||
| 4117e69278 | |||
| 18ff1e2345 | |||
| 37e3024220 | |||
| ed35ea6894 | |||
| bd28db7422 | |||
| 9beea9f2e9 | |||
| 205af60edb | |||
| 21f9a9819a | |||
| 4059335e61 | |||
| 14252f0f4b | |||
| c13eee355e | |||
| 51528fda6f | |||
| 1486d39eb8 | |||
| 1951d8e2a4 | |||
| 420fdf6b4c | |||
| a14a593e4f | |||
| 5d7ffa02c4 | |||
| 4942807104 | |||
| 20dafb1250 | |||
| eb0746de0c | |||
| 2e255e0c47 | |||
| 6baebda5e1 | |||
| 8f943829ec | |||
| bd19d8c1a2 | |||
| 3e79d0a07a | |||
| d2111e36ee | |||
| 47a1ab8223 | |||
| 45df794280 | |||
| 7a9bd15cfa | |||
| f902439086 | |||
| e7334d358b |
16
.idea/deploymentTargetDropDown.xml
generated
Normal file
16
.idea/deploymentTargetDropDown.xml
generated
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="deploymentTargetDropDown">
|
||||||
|
<runningDeviceTargetsSelectedWithDialog>
|
||||||
|
<Target>
|
||||||
|
<type value="RUNNING_DEVICE_TARGET" />
|
||||||
|
<deviceKey>
|
||||||
|
<Key>
|
||||||
|
<type value="SERIAL_NUMBER" />
|
||||||
|
<value value="20119B1E55" />
|
||||||
|
</Key>
|
||||||
|
</deviceKey>
|
||||||
|
</Target>
|
||||||
|
</runningDeviceTargetsSelectedWithDialog>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
4
.idea/runConfigurations/app_base.xml
generated
4
.idea/runConfigurations/app_base.xml
generated
@@ -1,6 +1,6 @@
|
|||||||
<component name="ProjectRunConfigurationManager">
|
<component name="ProjectRunConfigurationManager">
|
||||||
<configuration default="false" name="app_base" type="AndroidRunConfigurationType" factoryName="Android App" activateToolWindowBeforeRun="false">
|
<configuration default="false" name="app_base" type="AndroidRunConfigurationType" factoryName="Android App" activateToolWindowBeforeRun="false">
|
||||||
<module name="WMS_Native.app" />
|
<module name="WMS.app" />
|
||||||
<option name="DEPLOY" value="true" />
|
<option name="DEPLOY" value="true" />
|
||||||
<option name="DEPLOY_APK_FROM_BUNDLE" value="false" />
|
<option name="DEPLOY_APK_FROM_BUNDLE" value="false" />
|
||||||
<option name="DEPLOY_AS_INSTANT" value="false" />
|
<option name="DEPLOY_AS_INSTANT" value="false" />
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
<option name="PM_INSTALL_OPTIONS" value="" />
|
<option name="PM_INSTALL_OPTIONS" value="" />
|
||||||
<option name="ALL_USERS" value="false" />
|
<option name="ALL_USERS" value="false" />
|
||||||
<option name="ALWAYS_INSTALL_WITH_PM" value="false" />
|
<option name="ALWAYS_INSTALL_WITH_PM" value="false" />
|
||||||
<option name="DYNAMIC_FEATURES_DISABLED_LIST" value="WMS_Native.dynamic_agricoper,WMS_Native.dynamic_frudis,WMS_Native.dynamic_gramm,WMS_Native.dynamic_ime,WMS_Native.dynamic_saporiveri,WMS_Native.dynamic_saporiveri_pv,WMS_Native.dynamic_vgalimenti,dynamic_frudis,dynamic_gramm,dynamic_ime,dynamic_saporiveri,dynamic_saporiveri_pv,dynamic_vgalimenti" />
|
<option name="DYNAMIC_FEATURES_DISABLED_LIST" value="WMS.dynamic_vgalimenti" />
|
||||||
<option name="ACTIVITY_EXTRA_FLAGS" value="" />
|
<option name="ACTIVITY_EXTRA_FLAGS" value="" />
|
||||||
<option name="MODE" value="default_activity" />
|
<option name="MODE" value="default_activity" />
|
||||||
<option name="CLEAR_LOGCAT" value="true" />
|
<option name="CLEAR_LOGCAT" value="true" />
|
||||||
|
|||||||
4
.idea/runConfigurations/app_vglimenti.xml
generated
4
.idea/runConfigurations/app_vglimenti.xml
generated
@@ -1,6 +1,6 @@
|
|||||||
<component name="ProjectRunConfigurationManager">
|
<component name="ProjectRunConfigurationManager">
|
||||||
<configuration default="false" name="app_vglimenti" type="AndroidRunConfigurationType" factoryName="Android App" activateToolWindowBeforeRun="false">
|
<configuration default="false" name="app_vglimenti" type="AndroidRunConfigurationType" factoryName="Android App" activateToolWindowBeforeRun="false">
|
||||||
<module name="WMS_Native.app" />
|
<module name="WMS.app" />
|
||||||
<option name="DEPLOY" value="true" />
|
<option name="DEPLOY" value="true" />
|
||||||
<option name="DEPLOY_APK_FROM_BUNDLE" value="false" />
|
<option name="DEPLOY_APK_FROM_BUNDLE" value="false" />
|
||||||
<option name="DEPLOY_AS_INSTANT" value="false" />
|
<option name="DEPLOY_AS_INSTANT" value="false" />
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
<option name="PM_INSTALL_OPTIONS" value="" />
|
<option name="PM_INSTALL_OPTIONS" value="" />
|
||||||
<option name="ALL_USERS" value="false" />
|
<option name="ALL_USERS" value="false" />
|
||||||
<option name="ALWAYS_INSTALL_WITH_PM" value="false" />
|
<option name="ALWAYS_INSTALL_WITH_PM" value="false" />
|
||||||
<option name="DYNAMIC_FEATURES_DISABLED_LIST" value="WMS_Native.dynamic__base,WMS_Native.dynamic_agricoper,WMS_Native.dynamic_frudis,WMS_Native.dynamic_gramm,WMS_Native.dynamic_ime,WMS_Native.dynamic_saporiveri,WMS_Native.dynamic_saporiveri_pv,dynamic__base,dynamic_frudis,dynamic_gramm,dynamic_ime,dynamic_saporiveri,dynamic_saporiveri_pv" />
|
<option name="DYNAMIC_FEATURES_DISABLED_LIST" value="WMS.dynamic__base" />
|
||||||
<option name="ACTIVITY_EXTRA_FLAGS" value="" />
|
<option name="ACTIVITY_EXTRA_FLAGS" value="" />
|
||||||
<option name="MODE" value="default_activity" />
|
<option name="MODE" value="default_activity" />
|
||||||
<option name="CLEAR_LOGCAT" value="true" />
|
<option name="CLEAR_LOGCAT" value="true" />
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ apply plugin: 'com.google.gms.google-services'
|
|||||||
|
|
||||||
android {
|
android {
|
||||||
|
|
||||||
def appVersionCode = 238
|
def appVersionCode = 247
|
||||||
def appVersionName = '1.18.8'
|
def appVersionName = '1.20.0'
|
||||||
|
|
||||||
signingConfigs {
|
signingConfigs {
|
||||||
release {
|
release {
|
||||||
@@ -103,12 +103,12 @@ dependencies {
|
|||||||
implementation 'com.google.android.gms:play-services-basement:17.6.0'
|
implementation 'com.google.android.gms:play-services-basement:17.6.0'
|
||||||
|
|
||||||
|
|
||||||
implementation 'androidx.appcompat:appcompat:1.2.0'
|
implementation 'androidx.appcompat:appcompat:1.3.1'
|
||||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||||
implementation 'com.google.android.material:material:1.3.0'
|
implementation 'com.google.android.material:material:1.4.0'
|
||||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
|
implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
|
||||||
implementation 'androidx.cardview:cardview:1.0.0'
|
implementation 'androidx.cardview:cardview:1.0.0'
|
||||||
implementation 'androidx.recyclerview:recyclerview:1.2.0'
|
implementation 'androidx.recyclerview:recyclerview:1.2.1'
|
||||||
implementation 'androidx.preference:preference-ktx:1.1.1'
|
implementation 'androidx.preference:preference-ktx:1.1.1'
|
||||||
implementation 'com.squareup.okhttp3:okhttp:4.9.1'
|
implementation 'com.squareup.okhttp3:okhttp:4.9.1'
|
||||||
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
|
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
|
||||||
@@ -120,7 +120,7 @@ dependencies {
|
|||||||
implementation 'org.apache.commons:commons-text:1.9'
|
implementation 'org.apache.commons:commons-text:1.9'
|
||||||
|
|
||||||
//MVVM
|
//MVVM
|
||||||
def dagger2_version = '2.29.1'
|
def dagger2_version = '2.35.1'
|
||||||
api "com.google.dagger:dagger:$dagger2_version"
|
api "com.google.dagger:dagger:$dagger2_version"
|
||||||
annotationProcessor "com.google.dagger:dagger-compiler:$dagger2_version"
|
annotationProcessor "com.google.dagger:dagger-compiler:$dagger2_version"
|
||||||
api "com.google.dagger:dagger-android:$dagger2_version"
|
api "com.google.dagger:dagger-android:$dagger2_version"
|
||||||
@@ -156,6 +156,10 @@ dependencies {
|
|||||||
implementation project(':keyobardemulatorscannerlibrary')
|
implementation project(':keyobardemulatorscannerlibrary')
|
||||||
androidTestImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.1'
|
androidTestImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.1'
|
||||||
androidTestImplementation 'org.testng:testng:7.4.0'
|
androidTestImplementation 'org.testng:testng:7.4.0'
|
||||||
|
|
||||||
|
|
||||||
|
implementation 'com.github.RaviKoradiya:LiveAdapter:1.3.4'
|
||||||
|
implementation 'org.reflections:reflections:0.10.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
|
|||||||
@@ -29,6 +29,10 @@
|
|||||||
android:screenOrientation="portrait"
|
android:screenOrientation="portrait"
|
||||||
android:theme="@style/Light"
|
android:theme="@style/Light"
|
||||||
android:windowSoftInputMode="adjustNothing" />
|
android:windowSoftInputMode="adjustNothing" />
|
||||||
|
<activity android:name=".gest.contab_doc_interni.edit_form.DocInterniEditFormActivity"
|
||||||
|
android:screenOrientation="portrait"
|
||||||
|
android:theme="@style/Light"
|
||||||
|
android:windowSoftInputMode="adjustNothing" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".gest.picking_resi.PickingResiActivity"
|
android:name=".gest.picking_resi.PickingResiActivity"
|
||||||
android:screenOrientation="portrait"
|
android:screenOrientation="portrait"
|
||||||
|
|||||||
@@ -9,6 +9,12 @@ import it.integry.integrywmsnative.gest.accettazione.MainAccettazioneComponent;
|
|||||||
import it.integry.integrywmsnative.gest.accettazione.MainAccettazioneModule;
|
import it.integry.integrywmsnative.gest.accettazione.MainAccettazioneModule;
|
||||||
import it.integry.integrywmsnative.gest.accettazione_picking.AccettazionePickingComponent;
|
import it.integry.integrywmsnative.gest.accettazione_picking.AccettazionePickingComponent;
|
||||||
import it.integry.integrywmsnative.gest.accettazione_picking.AccettazionePickingModule;
|
import it.integry.integrywmsnative.gest.accettazione_picking.AccettazionePickingModule;
|
||||||
|
import it.integry.integrywmsnative.gest.contab_doc_interni.DocInterniComponent;
|
||||||
|
import it.integry.integrywmsnative.gest.contab_doc_interni.DocInterniModule;
|
||||||
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dialog.DialogSelectMgrpDtipPairComponent;
|
||||||
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dialog.DialogSelectMgrpDtipPairModule;
|
||||||
|
import it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.DocInterniEditFormComponent;
|
||||||
|
import it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.DocInterniEditFormModule;
|
||||||
import it.integry.integrywmsnative.gest.contenuto_bancale.ContenutoBancaleComponent;
|
import it.integry.integrywmsnative.gest.contenuto_bancale.ContenutoBancaleComponent;
|
||||||
import it.integry.integrywmsnative.gest.contenuto_bancale.ContenutoBancaleModule;
|
import it.integry.integrywmsnative.gest.contenuto_bancale.ContenutoBancaleModule;
|
||||||
import it.integry.integrywmsnative.gest.lista_bancali.ListaBancaliComponent;
|
import it.integry.integrywmsnative.gest.lista_bancali.ListaBancaliComponent;
|
||||||
@@ -97,7 +103,10 @@ import it.integry.integrywmsnative.view.dialogs.scan_or_create_lu.DialogScanOrCr
|
|||||||
ProdOrdineProduzioneElencoModule.class,
|
ProdOrdineProduzioneElencoModule.class,
|
||||||
ProdRecuperoMaterialeModule.class,
|
ProdRecuperoMaterialeModule.class,
|
||||||
ProdVersamentoMaterialeModule.class,
|
ProdVersamentoMaterialeModule.class,
|
||||||
DialogChooseArtsFromListaArtsModule.class
|
DialogChooseArtsFromListaArtsModule.class,
|
||||||
|
DocInterniModule.class,
|
||||||
|
DialogSelectMgrpDtipPairModule.class,
|
||||||
|
DocInterniEditFormModule.class
|
||||||
})
|
})
|
||||||
public interface MainApplicationComponent {
|
public interface MainApplicationComponent {
|
||||||
|
|
||||||
@@ -132,7 +141,9 @@ public interface MainApplicationComponent {
|
|||||||
ProdRecuperoMaterialeComponent.Factory prodRecuperoMaterialeComponent();
|
ProdRecuperoMaterialeComponent.Factory prodRecuperoMaterialeComponent();
|
||||||
ProdVersamentoMaterialeComponent.Factory prodVersamentoMaterialeComponent();
|
ProdVersamentoMaterialeComponent.Factory prodVersamentoMaterialeComponent();
|
||||||
DialogChooseArtsFromListaArtsComponent.Factory dialogChooseArtsFromListaArtsComponent();
|
DialogChooseArtsFromListaArtsComponent.Factory dialogChooseArtsFromListaArtsComponent();
|
||||||
|
DocInterniComponent.Factory docInterniComponent();
|
||||||
|
DialogSelectMgrpDtipPairComponent.Factory dialogSelectMgrpDtipPairComponent();
|
||||||
|
DocInterniEditFormComponent.Factory docInterniEditFormComponent();
|
||||||
|
|
||||||
void inject(MainApplication mainApplication);
|
void inject(MainApplication mainApplication);
|
||||||
void inject(AppContext mainApplication);
|
void inject(AppContext mainApplication);
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import it.integry.integrywmsnative.core.menu.MenuService;
|
|||||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||||
|
import it.integry.integrywmsnative.core.rest.consumers.CommessaRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.DepositoRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.DepositoRESTConsumer;
|
||||||
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;
|
||||||
@@ -24,6 +25,7 @@ import it.integry.integrywmsnative.core.rest.consumers.OrdiniRESTConsumer;
|
|||||||
import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.PrinterRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.PrinterRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
||||||
|
import it.integry.integrywmsnative.gest.contab_doc_interni.rest.DocInterniRESTConsumer;
|
||||||
import it.integry.integrywmsnative.gest.prod_fabbisogno_linee_prod.rest.ProdFabbisognoLineeProdRESTConsumer;
|
import it.integry.integrywmsnative.gest.prod_fabbisogno_linee_prod.rest.ProdFabbisognoLineeProdRESTConsumer;
|
||||||
|
|
||||||
@Module
|
@Module
|
||||||
@@ -81,14 +83,20 @@ public class MainApplicationModule {
|
|||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
ArticoloRESTConsumer provideArticoloRESTConsumer() {
|
ArticoloRESTConsumer provideArticoloRESTConsumer(SystemRESTConsumer systemRESTConsumer) {
|
||||||
return new ArticoloRESTConsumer();
|
return new ArticoloRESTConsumer(systemRESTConsumer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
DepositoRESTConsumer provideDepositoRESTConsumer(EntityRESTConsumer entityRESTConsumer) {
|
CommessaRESTConsumer provideCommessaRESTConsumer(SystemRESTConsumer systemRESTConsumer) {
|
||||||
return new DepositoRESTConsumer(entityRESTConsumer);
|
return new CommessaRESTConsumer(systemRESTConsumer);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
DepositoRESTConsumer provideDepositoRESTConsumer(EntityRESTConsumer entityRESTConsumer, SystemRESTConsumer systemRESTConsumer) {
|
||||||
|
return new DepositoRESTConsumer(entityRESTConsumer, systemRESTConsumer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@@ -151,5 +159,11 @@ public class MainApplicationModule {
|
|||||||
return new ProdFabbisognoLineeProdRESTConsumer(systemRESTConsumer);
|
return new ProdFabbisognoLineeProdRESTConsumer(systemRESTConsumer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
DocInterniRESTConsumer provideDocInterniRESTConsumer() {
|
||||||
|
return new DocInterniRESTConsumer();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package it.integry.integrywmsnative.core.class_router;
|
|||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.class_router.configs.MenuConfiguration;
|
|
||||||
import it.integry.integrywmsnative.core.class_router.interfaces.ICustomConfiguration;
|
import it.integry.integrywmsnative.core.class_router.interfaces.ICustomConfiguration;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityHashMap;
|
import it.integry.integrywmsnative.core.utility.UtilityHashMap;
|
||||||
|
|
||||||
@@ -10,14 +9,12 @@ public class BaseCustomConfiguration implements ICustomConfiguration {
|
|||||||
|
|
||||||
|
|
||||||
public static class Keys {
|
public static class Keys {
|
||||||
public static int MENU_CONFIGURATION = 0;
|
|
||||||
public static int FLAG_SHOW_COD_FORN_IN_SPEDIZIONE = 1;
|
public static int FLAG_SHOW_COD_FORN_IN_SPEDIZIONE = 1;
|
||||||
public static int CUSTOM_DYNAMIC_VERSION_PATH = 2;
|
public static int CUSTOM_DYNAMIC_VERSION_PATH = 2;
|
||||||
public static int FLAG_SPEDIZIONE_GROUP_BY_GRP_MERC = 3;
|
public static int FLAG_SPEDIZIONE_GROUP_BY_GRP_MERC = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected HashMap<Integer, Object> configurations = new HashMap<Integer, Object>() {{
|
protected HashMap<Integer, Object> configurations = new HashMap<>() {{
|
||||||
put(Keys.MENU_CONFIGURATION, new MenuConfiguration());
|
|
||||||
put(Keys.FLAG_SHOW_COD_FORN_IN_SPEDIZIONE, true);
|
put(Keys.FLAG_SHOW_COD_FORN_IN_SPEDIZIONE, true);
|
||||||
put(Keys.FLAG_SPEDIZIONE_GROUP_BY_GRP_MERC, false);
|
put(Keys.FLAG_SPEDIZIONE_GROUP_BY_GRP_MERC, false);
|
||||||
}};
|
}};
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package it.integry.integrywmsnative.core.class_router.configs;
|
|||||||
import it.integry.integrywmsnative.R;
|
import it.integry.integrywmsnative.R;
|
||||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||||
import it.integry.integrywmsnative.gest.accettazione.MainAccettazioneFragment;
|
import it.integry.integrywmsnative.gest.accettazione.MainAccettazioneFragment;
|
||||||
|
import it.integry.integrywmsnative.gest.contab_doc_interni.DocInterniFragment;
|
||||||
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.OrdiniUscitaElencoFragment;
|
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.OrdiniUscitaElencoFragment;
|
||||||
import it.integry.integrywmsnative.gest.picking_libero.PickingLiberoFragment;
|
import it.integry.integrywmsnative.gest.picking_libero.PickingLiberoFragment;
|
||||||
import it.integry.integrywmsnative.gest.prod_accettazione_ord_produzione.ProdOrdineProduzioneElencoFragment;
|
import it.integry.integrywmsnative.gest.prod_accettazione_ord_produzione.ProdOrdineProduzioneElencoFragment;
|
||||||
@@ -159,6 +160,13 @@ 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()
|
||||||
|
.setCodMenu("MG058")
|
||||||
|
.setID(it.integry.integrywmsnative.R.id.nav_pv_doc_interni)
|
||||||
|
.setTitleText(it.integry.integrywmsnative.R.string.doc_interni)
|
||||||
|
.setTitleIcon(R.drawable.ic_dashboard_contab_doc_interni)
|
||||||
|
.setDrawerIcon(it.integry.integrywmsnative.R.drawable.ic_dashboard_contab_doc_interni)
|
||||||
|
.setFragmentFactory(DocInterniFragment::newInstance))
|
||||||
|
|
||||||
// .addItem(new MenuItem()
|
// .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)
|
||||||
|
|||||||
@@ -50,7 +50,6 @@ public class AppContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void initSettings() {
|
private void initSettings() {
|
||||||
Stash.init(mApplicationContext);
|
Stash.init(mApplicationContext);
|
||||||
SettingsManager.init(mApplicationContext);
|
SettingsManager.init(mApplicationContext);
|
||||||
@@ -80,5 +79,4 @@ public class AppContext {
|
|||||||
Logger.addLogAdapter(new AndroidLogAdapter());
|
Logger.addLogAdapter(new AndroidLogAdapter());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,13 +8,17 @@ import it.integry.integrywmsnative.core.data_store.db.converter.DateConverter;
|
|||||||
import it.integry.integrywmsnative.core.data_store.db.dao.ArticoloGrigliaDao;
|
import it.integry.integrywmsnative.core.data_store.db.dao.ArticoloGrigliaDao;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.dao.ArticoloOrdineDao;
|
import it.integry.integrywmsnative.core.data_store.db.dao.ArticoloOrdineDao;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.dao.GrigliaDao;
|
import it.integry.integrywmsnative.core.data_store.db.dao.GrigliaDao;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.dao.MtbColrDao;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.dao.MtbColtDao;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.dao.OrdineDao;
|
import it.integry.integrywmsnative.core.data_store.db.dao.OrdineDao;
|
||||||
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.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.SqlMtbColt;
|
||||||
|
|
||||||
@Database(entities = {ArticoloGriglia.class, Griglia.class, Ordine.class, ArticoloOrdine.class}, version = 1, exportSchema = false)
|
@Database(entities = {ArticoloGriglia.class, Griglia.class, Ordine.class, ArticoloOrdine.class, SqlMtbColt.class, SqlMtbColr.class}, version = 4, exportSchema = false)
|
||||||
@TypeConverters({
|
@TypeConverters({
|
||||||
DateConverter.class
|
DateConverter.class
|
||||||
})
|
})
|
||||||
@@ -30,26 +34,9 @@ public abstract class AppDatabase extends RoomDatabase {
|
|||||||
|
|
||||||
public abstract ArticoloOrdineDao articoloOrdineDao();
|
public abstract ArticoloOrdineDao articoloOrdineDao();
|
||||||
|
|
||||||
// public static AppDatabase getDatabase(final Context context) {
|
public abstract MtbColtDao mtbColtDao();
|
||||||
// if (INSTANCE == null) {
|
|
||||||
// synchronized (AppDatabase.class) {
|
|
||||||
// if (INSTANCE == null) {
|
|
||||||
// INSTANCE = Room.databaseBuilder(context.getApplicationContext(),
|
|
||||||
// AppDatabase.class, "integry_wms")
|
|
||||||
// .fallbackToDestructiveMigration()
|
|
||||||
// .build();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// return INSTANCE;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// public AppDatabase(Application application) {
|
public abstract MtbColrDao mtbColrDao();
|
||||||
// mRoomInstance = Room.databaseBuilder(application,
|
|
||||||
// AppDatabase.class, "integry_wms")
|
|
||||||
// .fallbackToDestructiveMigration()
|
|
||||||
// .build();
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,15 +11,21 @@ import dagger.Provides;
|
|||||||
import it.integry.integrywmsnative.core.data_store.db.dao.ArticoloGrigliaDao;
|
import it.integry.integrywmsnative.core.data_store.db.dao.ArticoloGrigliaDao;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.dao.ArticoloOrdineDao;
|
import it.integry.integrywmsnative.core.data_store.db.dao.ArticoloOrdineDao;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.dao.GrigliaDao;
|
import it.integry.integrywmsnative.core.data_store.db.dao.GrigliaDao;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.dao.MtbColrDao;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.dao.MtbColtDao;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.dao.OrdineDao;
|
import it.integry.integrywmsnative.core.data_store.db.dao.OrdineDao;
|
||||||
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;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.repository.MtbColrRepository;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.repository.MtbColtRepository;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.repository.OrdineRepository;
|
import it.integry.integrywmsnative.core.data_store.db.repository.OrdineRepository;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.repository.implementations.ArticoliGrigliaDataSource;
|
import it.integry.integrywmsnative.core.data_store.db.repository.implementations.ArticoliGrigliaDataSource;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.repository.implementations.ArticoliOrdineDataSource;
|
import it.integry.integrywmsnative.core.data_store.db.repository.implementations.ArticoliOrdineDataSource;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.repository.implementations.GrigliaDataSource;
|
import it.integry.integrywmsnative.core.data_store.db.repository.implementations.GrigliaDataSource;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.repository.implementations.OrdineDataSource;
|
import it.integry.integrywmsnative.core.data_store.db.repository.implementations.OrdineDataSource;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.repository.implementations.SqlMtbColrDataSource;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.repository.implementations.SqlMtbColtDataSource;
|
||||||
|
|
||||||
@Module
|
@Module
|
||||||
public class RoomModule {
|
public class RoomModule {
|
||||||
@@ -66,6 +72,18 @@ public class RoomModule {
|
|||||||
return appDatabase.articoloOrdineDao();
|
return appDatabase.articoloOrdineDao();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Singleton
|
||||||
|
@Provides
|
||||||
|
MtbColtDao providesMtbColtDao(AppDatabase appDatabase) {
|
||||||
|
return appDatabase.mtbColtDao();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Singleton
|
||||||
|
@Provides
|
||||||
|
MtbColrDao providesMtbColrDao(AppDatabase appDatabase) {
|
||||||
|
return appDatabase.mtbColrDao();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -96,4 +114,16 @@ public class RoomModule {
|
|||||||
return new OrdineDataSource(ordineDao);
|
return new OrdineDataSource(ordineDao);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Singleton
|
||||||
|
@Provides
|
||||||
|
MtbColtRepository providesMtbColtRepository(MtbColtDao mtbColtDao) {
|
||||||
|
return new SqlMtbColtDataSource(mtbColtDao);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Singleton
|
||||||
|
@Provides
|
||||||
|
MtbColrRepository providesMtbColrRepository(MtbColrDao mtbColrDao) {
|
||||||
|
return new SqlMtbColrDataSource(mtbColrDao);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package it.integry.integrywmsnative.core.data_store.db.dao;
|
||||||
|
|
||||||
|
import androidx.room.Dao;
|
||||||
|
import androidx.room.Delete;
|
||||||
|
import androidx.room.Insert;
|
||||||
|
import androidx.room.Query;
|
||||||
|
import androidx.room.Update;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColr;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColt;
|
||||||
|
|
||||||
|
@Dao
|
||||||
|
public interface MtbColrDao {
|
||||||
|
@Query("SELECT * from mtb_colr ")
|
||||||
|
List<SqlMtbColr> getAll();
|
||||||
|
|
||||||
|
@Insert
|
||||||
|
Long insert(SqlMtbColr mtbColr);
|
||||||
|
|
||||||
|
@Update
|
||||||
|
void update(SqlMtbColr mtbColr);
|
||||||
|
|
||||||
|
@Delete
|
||||||
|
void delete(SqlMtbColr mtbColr);
|
||||||
|
|
||||||
|
@Query("SELECT * from mtb_colr where id_collo = :idDocument")
|
||||||
|
List<SqlMtbColr> getDocumentRows(int idDocument);
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package it.integry.integrywmsnative.core.data_store.db.dao;
|
||||||
|
|
||||||
|
import androidx.room.Dao;
|
||||||
|
import androidx.room.Delete;
|
||||||
|
import androidx.room.Insert;
|
||||||
|
import androidx.room.Query;
|
||||||
|
import androidx.room.Update;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.entity.Ordine;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColt;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.view_model.OrdineWithGriglia;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.wrappers.DocInternoWrapper;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.wrappers.OrdineWrapper;
|
||||||
|
|
||||||
|
@Dao
|
||||||
|
public interface MtbColtDao {
|
||||||
|
@Query("SELECT * from mtb_colt")
|
||||||
|
List<SqlMtbColt> getAll();
|
||||||
|
|
||||||
|
@Insert
|
||||||
|
Long insert(SqlMtbColt mtbColt);
|
||||||
|
|
||||||
|
@Update
|
||||||
|
void update(SqlMtbColt mtbColt);
|
||||||
|
|
||||||
|
@Delete
|
||||||
|
void delete(SqlMtbColt mtbColt);
|
||||||
|
|
||||||
|
@Query("SELECT mtb_colt.*, count(mtb_colr.id) as countArticoli from mtb_colt left outer join mtb_colr on (mtb_colr.id_collo = mtb_colt.id) where cod_dtip_provv = :codDtip AND cod_mgrp = :codMgrp and cod_dtip is null group by mtb_colt.id")
|
||||||
|
List<DocInternoWrapper> getLocalDocumentsByCodDtipAndCodMgrp(String codDtip, String codMgrp);
|
||||||
|
|
||||||
|
@Query("SELECT ifnull(MAX(num_collo),0) +1 as num_collo from mtb_colt")
|
||||||
|
Integer getNextNumCollo();
|
||||||
|
}
|
||||||
@@ -0,0 +1,438 @@
|
|||||||
|
package it.integry.integrywmsnative.core.data_store.db.entity;
|
||||||
|
|
||||||
|
import androidx.room.ColumnInfo;
|
||||||
|
import androidx.room.Entity;
|
||||||
|
import androidx.room.ForeignKey;
|
||||||
|
import androidx.room.Index;
|
||||||
|
import androidx.room.PrimaryKey;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Entity(
|
||||||
|
tableName = "mtb_colr",
|
||||||
|
indices = {
|
||||||
|
@Index(value = {"data_collo", "ser_collo", "num_collo", "gestione","riga"}, unique = true),
|
||||||
|
@Index(value = {"id_collo"})
|
||||||
|
},
|
||||||
|
foreignKeys = {
|
||||||
|
@ForeignKey(
|
||||||
|
entity = SqlMtbColt.class,
|
||||||
|
parentColumns = "id",
|
||||||
|
childColumns = "id_collo",
|
||||||
|
onDelete = ForeignKey.CASCADE
|
||||||
|
)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
public class SqlMtbColr {
|
||||||
|
|
||||||
|
@PrimaryKey(autoGenerate = true)
|
||||||
|
@ColumnInfo(name = "id")
|
||||||
|
private int id;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "id_collo")
|
||||||
|
private int idCollo;
|
||||||
|
|
||||||
|
|
||||||
|
@ColumnInfo(name = "data_collo")
|
||||||
|
private Date dataCollo;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "gestione")
|
||||||
|
private String gestione;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "ser_collo")
|
||||||
|
private String serCollo;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "descrizione")
|
||||||
|
private String descrizione;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "num_collo")
|
||||||
|
private Integer numCollo;
|
||||||
|
|
||||||
|
|
||||||
|
@ColumnInfo(name = "riga")
|
||||||
|
private Integer riga;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "riga_ord")
|
||||||
|
private Integer rigaOrd;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "cod_mart")
|
||||||
|
private String codMart;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "cod_barre")
|
||||||
|
private String codBarre;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "cod_col")
|
||||||
|
private String codCol;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "cod_tagl")
|
||||||
|
private String codTagl;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "partita_mag")
|
||||||
|
private String partitaMag;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "gestione_rif")
|
||||||
|
private String gestioneRif;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "ser_collo_rif")
|
||||||
|
private String serColloRif;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "note")
|
||||||
|
private String note;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "data_ord")
|
||||||
|
private Date dataOrd;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "data_collo_rif")
|
||||||
|
private Date dataColloRif;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "qta_cnf")
|
||||||
|
private Float qtaCnf;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "qta_col")
|
||||||
|
private Float qtaCol;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "num_ord")
|
||||||
|
private Integer numOrd;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "num_etich")
|
||||||
|
private Integer numEtich;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "num_collo_rif")
|
||||||
|
private Integer numColloRif;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "datetime_row")
|
||||||
|
private Date datetimeRow;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "cod_jcom")
|
||||||
|
private String codJcom;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "num_cnf")
|
||||||
|
private Float numCnf;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "causale")
|
||||||
|
private String causale;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "utente")
|
||||||
|
private String utente;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "cod_anag_doc")
|
||||||
|
private String codAnagDoc;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "cod_dtip_doc")
|
||||||
|
private String codDtipDoc;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "data_doc")
|
||||||
|
private Date dataDoc;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "ser_doc")
|
||||||
|
private String serDoc;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "num_doc")
|
||||||
|
private Integer numDoc;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "id_riga_doc")
|
||||||
|
private Integer idRigaDoc;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "unt_mis")
|
||||||
|
private String untMis;
|
||||||
|
@ColumnInfo(name = "data_scad")
|
||||||
|
private Date dataScad;
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getIdCollo() {
|
||||||
|
return idCollo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIdCollo(int idCollo) {
|
||||||
|
this.idCollo = idCollo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDataCollo() {
|
||||||
|
return dataCollo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDataCollo(Date dataCollo) {
|
||||||
|
this.dataCollo = dataCollo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGestione() {
|
||||||
|
return gestione;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGestione(String gestione) {
|
||||||
|
this.gestione = gestione;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSerCollo() {
|
||||||
|
return serCollo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSerCollo(String serCollo) {
|
||||||
|
this.serCollo = serCollo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getNumCollo() {
|
||||||
|
return numCollo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNumCollo(Integer numCollo) {
|
||||||
|
this.numCollo = numCollo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getRiga() {
|
||||||
|
return riga;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRiga(Integer riga) {
|
||||||
|
this.riga = riga;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getRigaOrd() {
|
||||||
|
return rigaOrd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRigaOrd(Integer rigaOrd) {
|
||||||
|
this.rigaOrd = rigaOrd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCodMart() {
|
||||||
|
return codMart;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCodMart(String codMart) {
|
||||||
|
this.codMart = codMart;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCodBarre() {
|
||||||
|
return codBarre;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCodBarre(String codBarre) {
|
||||||
|
this.codBarre = codBarre;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCodCol() {
|
||||||
|
return codCol;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCodCol(String codCol) {
|
||||||
|
this.codCol = codCol;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCodTagl() {
|
||||||
|
return codTagl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCodTagl(String codTagl) {
|
||||||
|
this.codTagl = codTagl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPartitaMag() {
|
||||||
|
return partitaMag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPartitaMag(String partitaMag) {
|
||||||
|
this.partitaMag = partitaMag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGestioneRif() {
|
||||||
|
return gestioneRif;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGestioneRif(String gestioneRif) {
|
||||||
|
this.gestioneRif = gestioneRif;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSerColloRif() {
|
||||||
|
return serColloRif;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSerColloRif(String serColloRif) {
|
||||||
|
this.serColloRif = serColloRif;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNote() {
|
||||||
|
return note;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNote(String note) {
|
||||||
|
this.note = note;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDataOrd() {
|
||||||
|
return dataOrd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDataOrd(Date dataOrd) {
|
||||||
|
this.dataOrd = dataOrd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDataColloRif() {
|
||||||
|
return dataColloRif;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDataColloRif(Date dataColloRif) {
|
||||||
|
this.dataColloRif = dataColloRif;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Float getQtaCnf() {
|
||||||
|
return qtaCnf;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQtaCnf(Float qtaCnf) {
|
||||||
|
this.qtaCnf = qtaCnf;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Float getQtaCol() {
|
||||||
|
return qtaCol;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQtaCol(Float qtaCol) {
|
||||||
|
this.qtaCol = qtaCol;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getNumOrd() {
|
||||||
|
return numOrd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNumOrd(Integer numOrd) {
|
||||||
|
this.numOrd = numOrd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getNumEtich() {
|
||||||
|
return numEtich;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNumEtich(Integer numEtich) {
|
||||||
|
this.numEtich = numEtich;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getNumColloRif() {
|
||||||
|
return numColloRif;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNumColloRif(Integer numColloRif) {
|
||||||
|
this.numColloRif = numColloRif;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDatetimeRow() {
|
||||||
|
return datetimeRow;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDatetimeRow(Date datetimeRow) {
|
||||||
|
this.datetimeRow = datetimeRow;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCodJcom() {
|
||||||
|
return codJcom;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCodJcom(String codJcom) {
|
||||||
|
this.codJcom = codJcom;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Float getNumCnf() {
|
||||||
|
return numCnf;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNumCnf(Float numCnf) {
|
||||||
|
this.numCnf = numCnf;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCausale() {
|
||||||
|
return causale;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCausale(String causale) {
|
||||||
|
this.causale = causale;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUtente() {
|
||||||
|
return utente;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUtente(String utente) {
|
||||||
|
this.utente = utente;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCodAnagDoc() {
|
||||||
|
return codAnagDoc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCodAnagDoc(String codAnagDoc) {
|
||||||
|
this.codAnagDoc = codAnagDoc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCodDtipDoc() {
|
||||||
|
return codDtipDoc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCodDtipDoc(String codDtipDoc) {
|
||||||
|
this.codDtipDoc = codDtipDoc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDataDoc() {
|
||||||
|
return dataDoc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDataDoc(Date dataDoc) {
|
||||||
|
this.dataDoc = dataDoc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSerDoc() {
|
||||||
|
return serDoc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSerDoc(String serDoc) {
|
||||||
|
this.serDoc = serDoc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getNumDoc() {
|
||||||
|
return numDoc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNumDoc(Integer numDoc) {
|
||||||
|
this.numDoc = numDoc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getIdRigaDoc() {
|
||||||
|
return idRigaDoc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIdRigaDoc(Integer idRigaDoc) {
|
||||||
|
this.idRigaDoc = idRigaDoc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUntMis() {
|
||||||
|
return untMis;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUntMis(String untMis) {
|
||||||
|
this.untMis = untMis;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescrizione() {
|
||||||
|
return descrizione;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescrizione(String descrizione) {
|
||||||
|
this.descrizione = descrizione;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDataScad() {
|
||||||
|
return dataScad;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDataScad(Date dataScad) {
|
||||||
|
this.dataScad = dataScad;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,341 @@
|
|||||||
|
package it.integry.integrywmsnative.core.data_store.db.entity;
|
||||||
|
|
||||||
|
import androidx.room.ColumnInfo;
|
||||||
|
import androidx.room.Entity;
|
||||||
|
import androidx.room.Ignore;
|
||||||
|
import androidx.room.Index;
|
||||||
|
import androidx.room.PrimaryKey;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Entity(
|
||||||
|
tableName = "mtb_colt",
|
||||||
|
indices = {
|
||||||
|
@Index(value = {"data_collo", "ser_collo", "num_collo", "gestione"}, unique = true)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
public class SqlMtbColt {
|
||||||
|
|
||||||
|
@PrimaryKey(autoGenerate = true)
|
||||||
|
@ColumnInfo(name = "id")
|
||||||
|
private int id;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "username")
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
@ColumnInfo
|
||||||
|
private String gestione;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "data_collo")
|
||||||
|
private Date dataCollo;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "ser_collo")
|
||||||
|
private String serCollo;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "num_collo")
|
||||||
|
private Integer numCollo;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "rif_ord")
|
||||||
|
private String rifOrd;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "cod_anag")
|
||||||
|
private String codAnag;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "cod_vdes")
|
||||||
|
private String codVdes;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "cod_mdep")
|
||||||
|
private String codMdep;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "cod_vlis")
|
||||||
|
private String codVlis;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "cod_dtip")
|
||||||
|
private String codDtip;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "cod_tcol")
|
||||||
|
private String codTcol;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "ser_doc")
|
||||||
|
private String serDoc;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "annotazioni")
|
||||||
|
private String annotazioni;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "posizione")
|
||||||
|
private String posizione;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "cod_dtip_provv")
|
||||||
|
private String codDtipProvv;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "ser_doc_provv")
|
||||||
|
private String serDocProvv;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "cod_jfas")
|
||||||
|
private String codJfas;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "data_ord")
|
||||||
|
private Date dataOrd;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "data_doc")
|
||||||
|
private Date dataDoc;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "data_doc_provv")
|
||||||
|
private Date dataDocProvv;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "cod_mgrp")
|
||||||
|
private String codMgrp;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "data_vers")
|
||||||
|
private Date dataVers;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "segno")
|
||||||
|
private Integer segno;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "num_ord")
|
||||||
|
private Integer numOrd;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "num_doc")
|
||||||
|
private Integer numDoc;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "num_doc_provv")
|
||||||
|
private Integer numDocProvv;
|
||||||
|
|
||||||
|
@Ignore
|
||||||
|
private List<SqlMtbColr> sqlMtbColrs = new ArrayList<>();
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUsername() {
|
||||||
|
return username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUsername(String username) {
|
||||||
|
this.username = username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGestione() {
|
||||||
|
return gestione;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGestione(String gestione) {
|
||||||
|
this.gestione = gestione;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDataCollo() {
|
||||||
|
return dataCollo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDataCollo(Date dataCollo) {
|
||||||
|
this.dataCollo = dataCollo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSerCollo() {
|
||||||
|
return serCollo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSerCollo(String serCollo) {
|
||||||
|
this.serCollo = serCollo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getNumCollo() {
|
||||||
|
return numCollo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNumCollo(Integer numCollo) {
|
||||||
|
this.numCollo = numCollo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRifOrd() {
|
||||||
|
return rifOrd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRifOrd(String rifOrd) {
|
||||||
|
this.rifOrd = rifOrd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCodAnag() {
|
||||||
|
return codAnag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCodAnag(String codAnag) {
|
||||||
|
this.codAnag = codAnag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCodVdes() {
|
||||||
|
return codVdes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCodVdes(String codVdes) {
|
||||||
|
this.codVdes = codVdes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCodMdep() {
|
||||||
|
return codMdep;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCodMdep(String codMdep) {
|
||||||
|
this.codMdep = codMdep;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCodVlis() {
|
||||||
|
return codVlis;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCodVlis(String codVlis) {
|
||||||
|
this.codVlis = codVlis;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCodDtip() {
|
||||||
|
return codDtip;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCodDtip(String codDtip) {
|
||||||
|
this.codDtip = codDtip;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCodTcol() {
|
||||||
|
return codTcol;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCodTcol(String codTcol) {
|
||||||
|
this.codTcol = codTcol;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSerDoc() {
|
||||||
|
return serDoc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSerDoc(String serDoc) {
|
||||||
|
this.serDoc = serDoc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAnnotazioni() {
|
||||||
|
return annotazioni;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAnnotazioni(String annotazioni) {
|
||||||
|
this.annotazioni = annotazioni;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPosizione() {
|
||||||
|
return posizione;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPosizione(String posizione) {
|
||||||
|
this.posizione = posizione;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCodDtipProvv() {
|
||||||
|
return codDtipProvv;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCodDtipProvv(String codDtipProvv) {
|
||||||
|
this.codDtipProvv = codDtipProvv;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSerDocProvv() {
|
||||||
|
return serDocProvv;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSerDocProvv(String serDocProvv) {
|
||||||
|
this.serDocProvv = serDocProvv;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCodJfas() {
|
||||||
|
return codJfas;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCodJfas(String codJfas) {
|
||||||
|
this.codJfas = codJfas;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDataOrd() {
|
||||||
|
return dataOrd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDataOrd(Date dataOrd) {
|
||||||
|
this.dataOrd = dataOrd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDataDoc() {
|
||||||
|
return dataDoc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDataDoc(Date dataDoc) {
|
||||||
|
this.dataDoc = dataDoc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDataDocProvv() {
|
||||||
|
return dataDocProvv;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDataDocProvv(Date dataDocProvv) {
|
||||||
|
this.dataDocProvv = dataDocProvv;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDataVers() {
|
||||||
|
return dataVers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDataVers(Date dataVers) {
|
||||||
|
this.dataVers = dataVers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getSegno() {
|
||||||
|
return segno;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSegno(Integer segno) {
|
||||||
|
this.segno = segno;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getNumOrd() {
|
||||||
|
return numOrd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNumOrd(Integer numOrd) {
|
||||||
|
this.numOrd = numOrd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getNumDoc() {
|
||||||
|
return numDoc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNumDoc(Integer numDoc) {
|
||||||
|
this.numDoc = numDoc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getNumDocProvv() {
|
||||||
|
return numDocProvv;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNumDocProvv(Integer numDocProvv) {
|
||||||
|
this.numDocProvv = numDocProvv;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<SqlMtbColr> getSqlMtbColrs() {
|
||||||
|
return sqlMtbColrs;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSqlMtbColrs(List<SqlMtbColr> sqlMtbColrs) {
|
||||||
|
this.sqlMtbColrs = sqlMtbColrs;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCodMgrp() {
|
||||||
|
return codMgrp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCodMgrp(String codMgrp) {
|
||||||
|
this.codMgrp = codMgrp;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package it.integry.integrywmsnative.core.data_store.db.repository;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColr;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColt;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
|
|
||||||
|
public interface MtbColrRepository {
|
||||||
|
|
||||||
|
void selectAll(RunnableArgs<List<SqlMtbColr>> onSuccess, RunnableArgs<Exception> onError);
|
||||||
|
|
||||||
|
void insert(SqlMtbColr mtbColr, RunnableArgs<Integer> onSuccess, RunnableArgs<Exception> onError);
|
||||||
|
|
||||||
|
void update(SqlMtbColr mtbColr, RunnableArgs<SqlMtbColr> onSuccess, RunnableArgs<Exception> onError);
|
||||||
|
|
||||||
|
void delete(SqlMtbColr mtbColr, Runnable onSuccess, RunnableArgs<Exception> onError);
|
||||||
|
|
||||||
|
void getDocumentRows(SqlMtbColt sqlMtbColt, RunnableArgs<List<SqlMtbColr>> onSuccess, RunnableArgs<Exception> onError);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package it.integry.integrywmsnative.core.data_store.db.repository;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.entity.Griglia;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.entity.Ordine;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColt;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.view_model.OrdineWithGriglia;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.wrappers.DocInternoWrapper;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.wrappers.OrdineWrapper;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
|
|
||||||
|
public interface MtbColtRepository {
|
||||||
|
|
||||||
|
void selectAll(RunnableArgs<List<SqlMtbColt>> onSuccess, RunnableArgs<Exception> onError);
|
||||||
|
|
||||||
|
void insert(SqlMtbColt mtbColt, RunnableArgs<Integer> onSuccess, RunnableArgs<Exception> onError);
|
||||||
|
|
||||||
|
void update(SqlMtbColt mtbColt, RunnableArgs<SqlMtbColt> onSuccess, RunnableArgs<Exception> onError);
|
||||||
|
|
||||||
|
void delete(SqlMtbColt mtbColt, Runnable onSuccess, RunnableArgs<Exception> onError);
|
||||||
|
|
||||||
|
void getLocalDocumentsByCodDtipAndCodMgrp(String codDtip, String codMgrp, RunnableArgs<List<DocInternoWrapper>> onSuccess, RunnableArgs<Exception> onError);
|
||||||
|
|
||||||
|
void getNextNumCollo(RunnableArgs<Integer> onSuccess, RunnableArgs<Exception> onError);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
package it.integry.integrywmsnative.core.data_store.db.repository.implementations;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.dao.MtbColrDao;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColr;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColt;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.repository.MtbColrRepository;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
|
|
||||||
|
public class SqlMtbColrDataSource extends Repository implements MtbColrRepository {
|
||||||
|
|
||||||
|
private MtbColrDao mMtbColrDao;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public SqlMtbColrDataSource(MtbColrDao mtbColrDao) {
|
||||||
|
this.mMtbColrDao = mtbColrDao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void selectAll(RunnableArgs<List<SqlMtbColr>> onSuccess, RunnableArgs<Exception> onError) {
|
||||||
|
Runnable query = () -> {
|
||||||
|
try {
|
||||||
|
onSuccess.run(mMtbColrDao.getAll());
|
||||||
|
} catch (Exception e) {
|
||||||
|
onError.run(e);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
execute(query);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void insert(SqlMtbColr mtbColr, RunnableArgs<Integer> onSuccess, RunnableArgs<Exception> onError) {
|
||||||
|
execute(() -> {
|
||||||
|
try {
|
||||||
|
Long id = mMtbColrDao.insert(mtbColr);
|
||||||
|
onSuccess.run(id.intValue());
|
||||||
|
} catch (Exception e) {
|
||||||
|
onError.run(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void update(SqlMtbColr mtbColr, RunnableArgs<SqlMtbColr> onSuccess, RunnableArgs<Exception> onError) {
|
||||||
|
execute(() -> {
|
||||||
|
try {
|
||||||
|
mMtbColrDao.update(mtbColr);
|
||||||
|
onSuccess.run(mtbColr);
|
||||||
|
} catch (Exception e) {
|
||||||
|
onError.run(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void delete(SqlMtbColr mtbColr, Runnable onSuccess, RunnableArgs<Exception> onError) {
|
||||||
|
execute(() -> {
|
||||||
|
try {
|
||||||
|
mMtbColrDao.delete(mtbColr);
|
||||||
|
onSuccess.run();
|
||||||
|
} catch (Exception e) {
|
||||||
|
onError.run(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void getDocumentRows(SqlMtbColt document, RunnableArgs<List<SqlMtbColr>> onSuccess, RunnableArgs<Exception> onError) {
|
||||||
|
Runnable query = () -> {
|
||||||
|
try {
|
||||||
|
onSuccess.run(mMtbColrDao.getDocumentRows(document.getId()));
|
||||||
|
} catch (Exception e) {
|
||||||
|
onError.run(e);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
execute(query);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,92 @@
|
|||||||
|
package it.integry.integrywmsnative.core.data_store.db.repository.implementations;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.dao.MtbColtDao;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColt;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.repository.MtbColtRepository;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.wrappers.DocInternoWrapper;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
|
|
||||||
|
public class SqlMtbColtDataSource extends Repository implements MtbColtRepository {
|
||||||
|
|
||||||
|
private MtbColtDao mMtbColtDao;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public SqlMtbColtDataSource(MtbColtDao mtbColtDao) {
|
||||||
|
this.mMtbColtDao = mtbColtDao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void selectAll(RunnableArgs<List<SqlMtbColt>> onSuccess, RunnableArgs<Exception> onError) {
|
||||||
|
Runnable query = () -> {
|
||||||
|
try {
|
||||||
|
onSuccess.run(mMtbColtDao.getAll());
|
||||||
|
} catch (Exception e) {
|
||||||
|
onError.run(e);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
execute(query);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void insert(SqlMtbColt mtbColt, RunnableArgs<Integer> onSuccess, RunnableArgs<Exception> onError) {
|
||||||
|
execute(() -> {
|
||||||
|
try {
|
||||||
|
Long id = mMtbColtDao.insert(mtbColt);
|
||||||
|
onSuccess.run(id.intValue());
|
||||||
|
} catch (Exception e) {
|
||||||
|
onError.run(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void update(SqlMtbColt mtbColt, RunnableArgs<SqlMtbColt> onSuccess, RunnableArgs<Exception> onError) {
|
||||||
|
execute(() -> {
|
||||||
|
try {
|
||||||
|
mMtbColtDao.update(mtbColt);
|
||||||
|
onSuccess.run(mtbColt);
|
||||||
|
} catch (Exception e) {
|
||||||
|
onError.run(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void delete(SqlMtbColt mtbColt, Runnable onSuccess, RunnableArgs<Exception> onError) {
|
||||||
|
execute(() -> {
|
||||||
|
try {
|
||||||
|
mMtbColtDao.delete(mtbColt);
|
||||||
|
onSuccess.run();
|
||||||
|
} catch (Exception e) {
|
||||||
|
onError.run(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getLocalDocumentsByCodDtipAndCodMgrp(String codDtip, String codMgrp, RunnableArgs<List<DocInternoWrapper>> onSuccess, RunnableArgs<Exception> onError) {
|
||||||
|
Runnable query = () -> {
|
||||||
|
try {
|
||||||
|
onSuccess.run(mMtbColtDao.getLocalDocumentsByCodDtipAndCodMgrp(codDtip,codMgrp));
|
||||||
|
} catch (Exception e) {
|
||||||
|
onError.run(e);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
execute(query);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getNextNumCollo(RunnableArgs<Integer> onSuccess, RunnableArgs<Exception> onError) {
|
||||||
|
Runnable query = () -> {
|
||||||
|
try {
|
||||||
|
onSuccess.run(mMtbColtDao.getNextNumCollo());
|
||||||
|
} catch (Exception e) {
|
||||||
|
onError.run(e);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
execute(query);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package it.integry.integrywmsnative.core.data_store.db.wrappers;
|
||||||
|
|
||||||
|
import androidx.room.ColumnInfo;
|
||||||
|
import androidx.room.Embedded;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColt;
|
||||||
|
|
||||||
|
public class DocInternoWrapper {
|
||||||
|
@Embedded
|
||||||
|
private SqlMtbColt document;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "countArticoli")
|
||||||
|
private int countArticoli = 0;
|
||||||
|
|
||||||
|
public SqlMtbColt getDocument() {
|
||||||
|
return document;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDocument(SqlMtbColt document) {
|
||||||
|
this.document = document;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCountArticoli() {
|
||||||
|
return countArticoli;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCountArticoli(int countArticoli) {
|
||||||
|
this.countArticoli = countArticoli;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -104,5 +104,9 @@ public class BindableBoolean implements Observable {
|
|||||||
notifyChange();
|
notifyChange();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void toggle() {
|
||||||
|
set(!get());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,20 @@ import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
|||||||
|
|
||||||
public class BindableString extends BaseObservable {
|
public class BindableString extends BaseObservable {
|
||||||
String value;
|
String value;
|
||||||
|
private boolean isHtml = false;
|
||||||
|
|
||||||
|
public BindableString(){};
|
||||||
|
public BindableString(boolean isHtml){
|
||||||
|
this.isHtml = isHtml;
|
||||||
|
};
|
||||||
|
public BindableString(String startingValue ,boolean isHtml){
|
||||||
|
this.isHtml = isHtml;
|
||||||
|
this.set(startingValue);
|
||||||
|
};
|
||||||
|
|
||||||
|
public boolean isHtml() {
|
||||||
|
return isHtml;
|
||||||
|
}
|
||||||
|
|
||||||
public String get() {
|
public String get() {
|
||||||
return value != null ? value : "";
|
return value != null ? value : "";
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package it.integry.integrywmsnative.core.di;
|
|||||||
|
|
||||||
import android.app.DatePickerDialog;
|
import android.app.DatePickerDialog;
|
||||||
import android.content.res.ColorStateList;
|
import android.content.res.ColorStateList;
|
||||||
|
import android.text.Html;
|
||||||
import android.text.SpannableString;
|
import android.text.SpannableString;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@@ -126,8 +127,9 @@ public class Converters {
|
|||||||
view.addTextChangedListener(watcher);
|
view.addTextChangedListener(watcher);
|
||||||
}
|
}
|
||||||
String newValue = bindableString.get();
|
String newValue = bindableString.get();
|
||||||
|
boolean isHtml = bindableString.isHtml();
|
||||||
if (!view.getText().toString().equals(newValue)) {
|
if (!view.getText().toString().equals(newValue)) {
|
||||||
view.setText(newValue);
|
view.setText(isHtml ? Html.fromHtml(newValue) : newValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -367,8 +369,9 @@ public class Converters {
|
|||||||
view.addTextChangedListener(watcher);
|
view.addTextChangedListener(watcher);
|
||||||
}
|
}
|
||||||
String newValue = bindableString.get();
|
String newValue = bindableString.get();
|
||||||
|
boolean isHtml = bindableString.isHtml();
|
||||||
if (!view.getText().toString().equals(newValue)) {
|
if (!view.getText().toString().equals(newValue)) {
|
||||||
view.setText(newValue);
|
view.setText(isHtml ? Html.fromHtml(newValue) : newValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -477,7 +480,7 @@ public class Converters {
|
|||||||
|
|
||||||
|
|
||||||
@BindingAdapter("visibility")
|
@BindingAdapter("visibility")
|
||||||
public static void bindView(View view, final ObservableField<Boolean> bindableBoolean) {
|
public static void bindViewVisibility(View view, final ObservableField<Boolean> bindableBoolean) {
|
||||||
if (view.getTag(R.id.bound_observable) != bindableBoolean) {
|
if (view.getTag(R.id.bound_observable) != bindableBoolean) {
|
||||||
view.setTag(R.id.bound_observable, bindableBoolean);
|
view.setTag(R.id.bound_observable, bindableBoolean);
|
||||||
}
|
}
|
||||||
@@ -492,6 +495,38 @@ public class Converters {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@BindingAdapter({"reverse_visibility"})
|
||||||
|
public static void bindViewReverseVisibility(View view, final BindableBoolean bindableBoolean) {
|
||||||
|
if (view.getTag(R.id.bound_observable) != bindableBoolean) {
|
||||||
|
view.setTag(R.id.bound_observable, bindableBoolean);
|
||||||
|
}
|
||||||
|
bindableBoolean.addOnPropertyChangedCallback(new Observable.OnPropertyChangedCallback() {
|
||||||
|
@Override
|
||||||
|
public void onPropertyChanged(Observable sender, int propertyId) {
|
||||||
|
view.setVisibility(bindableBoolean.get() ? View.GONE : View.VISIBLE);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
view.setVisibility(bindableBoolean.get() ? View.GONE : View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@BindingAdapter("reverse_visibility")
|
||||||
|
public static void bindViewReverseVisibility(View view, final ObservableField<Boolean> bindableBoolean) {
|
||||||
|
if (view.getTag(R.id.bound_observable) != bindableBoolean) {
|
||||||
|
view.setTag(R.id.bound_observable, bindableBoolean);
|
||||||
|
}
|
||||||
|
bindableBoolean.addOnPropertyChangedCallback(new Observable.OnPropertyChangedCallback() {
|
||||||
|
@Override
|
||||||
|
public void onPropertyChanged(Observable sender, int propertyId) {
|
||||||
|
view.setVisibility(bindableBoolean.get() ? View.GONE : View.VISIBLE);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
view.setVisibility(bindableBoolean.get() ? View.GONE : View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@BindingAdapter("android:layout_weight")
|
@BindingAdapter("android:layout_weight")
|
||||||
public static void setLayoutWeight(View view, final Float weight) {
|
public static void setLayoutWeight(View view, final Float weight) {
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package it.integry.integrywmsnative.core.expansion;
|
||||||
|
|
||||||
|
import androidx.databinding.Observable;
|
||||||
|
|
||||||
|
public abstract class OnGeneralChangedCallback extends Observable.OnPropertyChangedCallback implements Runnable{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPropertyChanged(Observable sender, int propertyId) {
|
||||||
|
run();
|
||||||
|
}
|
||||||
|
|
||||||
|
// public abstract void run();
|
||||||
|
|
||||||
|
}
|
||||||
@@ -2,7 +2,7 @@ package it.integry.integrywmsnative.core.interfaces;
|
|||||||
|
|
||||||
import androidx.appcompat.widget.SearchView;
|
import androidx.appcompat.widget.SearchView;
|
||||||
|
|
||||||
public interface ISearcableFragment extends SearchView.OnQueryTextListener, IDestroyableFragment {
|
public interface ISearchableFragment extends SearchView.OnQueryTextListener, IDestroyableFragment {
|
||||||
|
|
||||||
void onSearchEnabled();
|
void onSearchEnabled();
|
||||||
|
|
||||||
@@ -106,6 +106,9 @@ public class DtbOrdt extends EntityBase {
|
|||||||
private String noteConferma;
|
private String noteConferma;
|
||||||
private String codJflav;
|
private String codJflav;
|
||||||
|
|
||||||
|
public DtbOrdt() {
|
||||||
|
this.type = "dtb_ordt";
|
||||||
|
}
|
||||||
|
|
||||||
public String getDataOrd() {
|
public String getDataOrd() {
|
||||||
return dataOrd;
|
return dataOrd;
|
||||||
|
|||||||
@@ -0,0 +1,49 @@
|
|||||||
|
package it.integry.integrywmsnative.core.model;
|
||||||
|
|
||||||
|
public class JtbComt extends EntityBase {
|
||||||
|
|
||||||
|
private String codJcom;
|
||||||
|
private String codJfas;
|
||||||
|
private String codJflav;
|
||||||
|
private String descrizione;
|
||||||
|
|
||||||
|
public JtbComt() {
|
||||||
|
this.type = "jtb_comt";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCodJcom() {
|
||||||
|
return codJcom;
|
||||||
|
}
|
||||||
|
|
||||||
|
public JtbComt setCodJcom(String codJcom) {
|
||||||
|
this.codJcom = codJcom;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCodJfas() {
|
||||||
|
return codJfas;
|
||||||
|
}
|
||||||
|
|
||||||
|
public JtbComt setCodJfas(String codJfas) {
|
||||||
|
this.codJfas = codJfas;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCodJflav() {
|
||||||
|
return codJflav;
|
||||||
|
}
|
||||||
|
|
||||||
|
public JtbComt setCodJflav(String codJflav) {
|
||||||
|
this.codJflav = codJflav;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescrizione() {
|
||||||
|
return descrizione;
|
||||||
|
}
|
||||||
|
|
||||||
|
public JtbComt setDescrizione(String descrizione) {
|
||||||
|
this.descrizione = descrizione;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -36,12 +36,12 @@ public class MtbDepo extends EntityBase implements Parcelable {
|
|||||||
private String flagTipoNegozio;
|
private String flagTipoNegozio;
|
||||||
private String codMdepReso;
|
private String codMdepReso;
|
||||||
|
|
||||||
|
|
||||||
public MtbDepo() {
|
public MtbDepo() {
|
||||||
type = "mtb_depo";
|
type = "mtb_depo";
|
||||||
}
|
}
|
||||||
|
|
||||||
protected MtbDepo(Parcel in) {
|
protected MtbDepo(Parcel in) {
|
||||||
type = "mtb_depo";
|
|
||||||
codMdep = in.readString();
|
codMdep = in.readString();
|
||||||
descrizione = in.readString();
|
descrizione = in.readString();
|
||||||
flagVal = in.readString();
|
flagVal = in.readString();
|
||||||
@@ -357,4 +357,19 @@ public class MtbDepo extends EntityBase implements Parcelable {
|
|||||||
this.codMdepReso = codMdepReso;
|
this.codMdepReso = codMdepReso;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) return true;
|
||||||
|
if (o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
|
MtbDepo mtbDepo = (MtbDepo) o;
|
||||||
|
|
||||||
|
return getCodMdep().equals(mtbDepo.getCodMdep());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return getCodMdep().hashCode();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,69 @@
|
|||||||
|
package it.integry.integrywmsnative.core.model;
|
||||||
|
|
||||||
|
public class MtbGrup extends EntityBase {
|
||||||
|
|
||||||
|
private String codMgrp;
|
||||||
|
private String descrizione;
|
||||||
|
private String flagValMag;
|
||||||
|
private String logoWeb;
|
||||||
|
private String criterioVal;
|
||||||
|
private String tipoMgrp;
|
||||||
|
|
||||||
|
public MtbGrup() {
|
||||||
|
this.type = "mtb_grup";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCodMgrp() {
|
||||||
|
return codMgrp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MtbGrup setCodMgrp(String codMgrp) {
|
||||||
|
this.codMgrp = codMgrp;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescrizione() {
|
||||||
|
return descrizione;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MtbGrup setDescrizione(String descrizione) {
|
||||||
|
this.descrizione = descrizione;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFlagValMag() {
|
||||||
|
return flagValMag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MtbGrup setFlagValMag(String flagValMag) {
|
||||||
|
this.flagValMag = flagValMag;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLogoWeb() {
|
||||||
|
return logoWeb;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MtbGrup setLogoWeb(String logoWeb) {
|
||||||
|
this.logoWeb = logoWeb;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCriterioVal() {
|
||||||
|
return criterioVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MtbGrup setCriterioVal(String criterioVal) {
|
||||||
|
this.criterioVal = criterioVal;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTipoMgrp() {
|
||||||
|
return tipoMgrp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MtbGrup setTipoMgrp(String tipoMgrp) {
|
||||||
|
this.tipoMgrp = tipoMgrp;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@ package it.integry.integrywmsnative.core.rest;
|
|||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.GsonBuilder;
|
import com.google.gson.GsonBuilder;
|
||||||
|
|
||||||
|
import java.lang.reflect.Modifier;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||||
@@ -50,6 +51,7 @@ public class RESTBuilder {
|
|||||||
|
|
||||||
Gson gson = new GsonBuilder()
|
Gson gson = new GsonBuilder()
|
||||||
.setDateFormat("dd/MM/yyyy HH:mm:ss")
|
.setDateFormat("dd/MM/yyyy HH:mm:ss")
|
||||||
|
.excludeFieldsWithModifiers(Modifier.TRANSIENT)
|
||||||
.create();
|
.create();
|
||||||
|
|
||||||
Retrofit retrofit = new Retrofit.Builder()
|
Retrofit retrofit = new Retrofit.Builder()
|
||||||
|
|||||||
@@ -2,15 +2,21 @@ package it.integry.integrywmsnative.core.rest.consumers;
|
|||||||
|
|
||||||
import com.annimon.stream.Collectors;
|
import com.annimon.stream.Collectors;
|
||||||
import com.annimon.stream.Stream;
|
import com.annimon.stream.Stream;
|
||||||
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
|
||||||
|
import java.lang.reflect.Type;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
|
||||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||||
|
import it.integry.integrywmsnative.core.model.MtbGrup;
|
||||||
|
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||||
|
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityQuery;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.Callback;
|
import retrofit2.Callback;
|
||||||
import retrofit2.Response;
|
import retrofit2.Response;
|
||||||
@@ -18,6 +24,11 @@ import retrofit2.Response;
|
|||||||
@Singleton
|
@Singleton
|
||||||
public class ArticoloRESTConsumer extends _BaseRESTConsumer {
|
public class ArticoloRESTConsumer extends _BaseRESTConsumer {
|
||||||
|
|
||||||
|
private final SystemRESTConsumer systemRESTConsumer;
|
||||||
|
|
||||||
|
public ArticoloRESTConsumer(SystemRESTConsumer systemRESTConsumer) {
|
||||||
|
this.systemRESTConsumer = systemRESTConsumer;
|
||||||
|
}
|
||||||
|
|
||||||
public void getByBarcodeProd(String barcodeProd, RunnableArgs<List<MtbAart>> onComplete, RunnableArgs<Exception> onFailed) {
|
public void getByBarcodeProd(String barcodeProd, RunnableArgs<List<MtbAart>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
ArticoloRESTConsumerService articoloRESTConsumerService = RESTBuilder.getService(ArticoloRESTConsumerService.class);
|
ArticoloRESTConsumerService articoloRESTConsumerService = RESTBuilder.getService(ArticoloRESTConsumerService.class);
|
||||||
@@ -86,4 +97,21 @@ public class ArticoloRESTConsumer extends _BaseRESTConsumer {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void getArtsGroups(List<String> groupsToFind, RunnableArgs<List<MtbGrup>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
|
var whereCondMap = Stream.of(groupsToFind)
|
||||||
|
.map(x -> {
|
||||||
|
HashMap<String, Object> vars = new HashMap<>();
|
||||||
|
vars.put("cod_mgrp", x);
|
||||||
|
return vars;
|
||||||
|
})
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
var whereCond = " WHERE " + UtilityQuery.concatFieldListInWhereCond(whereCondMap);
|
||||||
|
|
||||||
|
Type typeOfObjectsList = new TypeToken<ArrayList<MtbGrup>>() {}.getType();
|
||||||
|
this.systemRESTConsumer.processSql("SELECT * FROM mtb_grup " + whereCond, typeOfObjectsList, onComplete, onFailed);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package it.integry.integrywmsnative.core.rest.consumers;
|
||||||
|
|
||||||
|
import com.annimon.stream.Stream;
|
||||||
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
|
||||||
|
import java.lang.reflect.Type;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
|
import it.integry.integrywmsnative.core.model.JtbComt;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityQuery;
|
||||||
|
|
||||||
|
@Singleton
|
||||||
|
public class CommessaRESTConsumer extends _BaseRESTConsumer {
|
||||||
|
|
||||||
|
private final SystemRESTConsumer systemRESTConsumer;
|
||||||
|
|
||||||
|
public CommessaRESTConsumer(SystemRESTConsumer systemRESTConsumer) {
|
||||||
|
this.systemRESTConsumer = systemRESTConsumer;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void getJtbComts(List<String> itemsToFind, RunnableArgs<List<JtbComt>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
|
var whereCondMap = Stream.of(itemsToFind)
|
||||||
|
.map(x -> {
|
||||||
|
HashMap<String, Object> vars = new HashMap<>();
|
||||||
|
vars.put("cod_jcom", x);
|
||||||
|
return vars;
|
||||||
|
})
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
var whereCond = " WHERE " + UtilityQuery.concatFieldListInWhereCond(whereCondMap);
|
||||||
|
|
||||||
|
Type typeOfObjectsList = new TypeToken<ArrayList<JtbComt>>() {}.getType();
|
||||||
|
this.systemRESTConsumer.processSql("SELECT * FROM jtb_comt " + whereCond, typeOfObjectsList, onComplete, onFailed);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,5 +1,9 @@
|
|||||||
package it.integry.integrywmsnative.core.rest.consumers;
|
package it.integry.integrywmsnative.core.rest.consumers;
|
||||||
|
|
||||||
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
|
||||||
|
import java.lang.reflect.Type;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
@@ -12,9 +16,17 @@ import it.integry.integrywmsnative.core.model.MtbDepo;
|
|||||||
public class DepositoRESTConsumer extends _BaseRESTConsumer {
|
public class DepositoRESTConsumer extends _BaseRESTConsumer {
|
||||||
|
|
||||||
private final EntityRESTConsumer entityRESTConsumer;
|
private final EntityRESTConsumer entityRESTConsumer;
|
||||||
|
private final SystemRESTConsumer systemRESTConsumer;
|
||||||
|
|
||||||
public DepositoRESTConsumer(EntityRESTConsumer entityRESTConsumer) {
|
public DepositoRESTConsumer(EntityRESTConsumer entityRESTConsumer, SystemRESTConsumer systemRESTConsumer) {
|
||||||
this.entityRESTConsumer = entityRESTConsumer;
|
this.entityRESTConsumer = entityRESTConsumer;
|
||||||
|
this.systemRESTConsumer = systemRESTConsumer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void getAll(RunnableArgs<List<MtbDepo>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
|
Type typeOfObjectsList = new TypeToken<ArrayList<MtbDepo>>() {
|
||||||
|
}.getType();
|
||||||
|
this.systemRESTConsumer.processSql("SELECT * FROM mtb_depo", typeOfObjectsList, onComplete, onFailed);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getDepoByCodMdep(String codMdep, RunnableArgs<MtbDepo> onComplete, RunnableArgs<Exception> onFailed) {
|
public void getDepoByCodMdep(String codMdep, RunnableArgs<MtbDepo> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
|
|||||||
@@ -11,12 +11,12 @@ import javax.inject.Singleton;
|
|||||||
|
|
||||||
import it.integry.integrywmsnative.BuildConfig;
|
import it.integry.integrywmsnative.BuildConfig;
|
||||||
import it.integry.integrywmsnative.core.exception.NoPrintersFoundException;
|
import it.integry.integrywmsnative.core.exception.NoPrintersFoundException;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
|
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||||
import it.integry.integrywmsnative.core.rest.model.JasperDTO;
|
import it.integry.integrywmsnative.core.rest.model.JasperDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.JasperPairDTO;
|
import it.integry.integrywmsnative.core.rest.model.JasperPairDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
|
||||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityLogger;
|
import it.integry.integrywmsnative.core.utility.UtilityLogger;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
@@ -32,26 +32,6 @@ public class PrinterRESTConsumer extends _BaseRESTConsumer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void getAvailablePrinters(String codMdep, final RunnableArgs<List<String>> onComplete, final RunnableArgs<Exception> onFailed) {
|
|
||||||
PrinterRESTConsumerService printerService = RESTBuilder.getService(PrinterRESTConsumerService.class);
|
|
||||||
printerService.getAvailablePrinters(codMdep).enqueue(new Callback<>() {
|
|
||||||
@Override
|
|
||||||
public void onResponse(Call<ServiceRESTResponse<List<String>>> call, Response<ServiceRESTResponse<List<String>>> response) {
|
|
||||||
analyzeAnswer(response, "GetAvailablePrinters", printers -> {
|
|
||||||
onComplete.run(printers != null ? Stream.of(printers).withoutNulls().toList() : null);
|
|
||||||
}, onFailed);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(Call<ServiceRESTResponse<List<String>>> call, Throwable t) {
|
|
||||||
Log.e("GetAvailablePrinters", t.toString());
|
|
||||||
UtilityLogger.errorMe(new Exception(t));
|
|
||||||
onFailed.run(new Exception(t));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void getAvailablePrinters(String codMdep, Type printerType, RunnableArgs<List<String>> onComplete, RunnableArgs<Exception> onFailed) {
|
public void getAvailablePrinters(String codMdep, Type printerType, RunnableArgs<List<String>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
|
|
||||||
String printerTypeStr = printerType != null ? printerType.toString() : null;
|
String printerTypeStr = printerType != null ? printerType.toString() : null;
|
||||||
@@ -75,47 +55,40 @@ public class PrinterRESTConsumer extends _BaseRESTConsumer {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void printCollo(String printerName, MtbColt testataColloToPrint, int quantity, String reportName, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
public void printCollo(Type printerType, MtbColt testataColloToPrint, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
|
|
||||||
if (BuildConfig.DEBUG) {
|
// if (BuildConfig.DEBUG) {
|
||||||
onComplete.run();
|
// onComplete.run();
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (UtilityString.isNullOrEmpty(printerName)) {
|
|
||||||
onFailed.run(new Exception("Nessuna stampante configurata: valore null"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
PrinterRESTConsumerService printerService = RESTBuilder.getService(PrinterRESTConsumerService.class);
|
PrinterRESTConsumerService printerService = RESTBuilder.getService(PrinterRESTConsumerService.class);
|
||||||
printerService.printCollo(
|
Call<ServiceRESTResponse<Object>> callable = null;
|
||||||
printerName,
|
if (printerType != null)
|
||||||
testataColloToPrint.getDataColloS(),
|
callable = printerService.printCollo(printerType.toString(), testataColloToPrint);
|
||||||
testataColloToPrint.getGestione(),
|
else
|
||||||
testataColloToPrint.getSerCollo(),
|
callable = printerService.printCollo(testataColloToPrint);
|
||||||
testataColloToPrint.getNumCollo(),
|
|
||||||
quantity,
|
|
||||||
reportName)
|
|
||||||
|
|
||||||
.enqueue(new Callback<>() {
|
callable.enqueue(new Callback<>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) {
|
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) {
|
||||||
analyzeAnswer(response, "printCollo", data -> {
|
analyzeAnswer(response, "printCollo", data -> {
|
||||||
onComplete.run();
|
onComplete.run();
|
||||||
}, onFailed);
|
}, onFailed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Call<ServiceRESTResponse<Object>> call, Throwable t) {
|
public void onFailure(Call<ServiceRESTResponse<Object>> call, Throwable t) {
|
||||||
if (t.getMessage().contains("Printer not found")) {
|
if (t.getMessage().contains("Printer not found")) {
|
||||||
onFailed.run(new NoPrintersFoundException());
|
onFailed.run(new NoPrintersFoundException());
|
||||||
} else onFailed.run(new Exception(t));
|
} else onFailed.run(new Exception(t));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void printReport(String printerName, String reportName, HashMap<String, Object> params, int quantity, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
public void printReport(String printerName, String reportName, HashMap<String, Object> params, int quantity, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
// if(BuildConfig.DEBUG) {
|
// if (BuildConfig.DEBUG) {
|
||||||
// onComplete.run();
|
// onComplete.run();
|
||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
|
|||||||
@@ -2,20 +2,16 @@ package it.integry.integrywmsnative.core.rest.consumers;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||||
import it.integry.integrywmsnative.core.rest.model.JasperDTO;
|
import it.integry.integrywmsnative.core.rest.model.JasperDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.http.Body;
|
import retrofit2.http.Body;
|
||||||
import retrofit2.http.Field;
|
|
||||||
import retrofit2.http.FormUrlEncoded;
|
|
||||||
import retrofit2.http.POST;
|
import retrofit2.http.POST;
|
||||||
import retrofit2.http.Query;
|
import retrofit2.http.Query;
|
||||||
|
|
||||||
public interface PrinterRESTConsumerService {
|
public interface PrinterRESTConsumerService {
|
||||||
|
|
||||||
@POST("getAvailablePrinters")
|
|
||||||
Call<ServiceRESTResponse<List<String>>> getAvailablePrinters();
|
|
||||||
|
|
||||||
@POST("getAvailablePrinters")
|
@POST("getAvailablePrinters")
|
||||||
Call<ServiceRESTResponse<List<String>>> getAvailablePrinters(@Query("codMdep") String codMdep);
|
Call<ServiceRESTResponse<List<String>>> getAvailablePrinters(@Query("codMdep") String codMdep);
|
||||||
|
|
||||||
@@ -23,19 +19,6 @@ public interface PrinterRESTConsumerService {
|
|||||||
Call<ServiceRESTResponse<List<String>>> getAvailablePrinters(@Query("codMdep") String codMdep, @Query("printerType") String printerType);
|
Call<ServiceRESTResponse<List<String>>> getAvailablePrinters(@Query("codMdep") String codMdep, @Query("printerType") String printerType);
|
||||||
|
|
||||||
|
|
||||||
@POST("pkgPrintLabel")
|
|
||||||
@FormUrlEncoded
|
|
||||||
Call<ServiceRESTResponse<Object>> printCollo(
|
|
||||||
@Query("printerName") String printerName,
|
|
||||||
@Field("dataCollo") String dataCollo,
|
|
||||||
@Field("gestione") String gestione,
|
|
||||||
@Field("serCollo") String serCollo,
|
|
||||||
@Field("numCollo") int numCollo,
|
|
||||||
@Query("printQuantity") int printQuantity,
|
|
||||||
@Query("reportName") String reportName
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
@POST("processPrintReport")
|
@POST("processPrintReport")
|
||||||
Call<ServiceRESTResponse<Object>> processPrintReport(
|
Call<ServiceRESTResponse<Object>> processPrintReport(
|
||||||
@Query("printerName") String printerName,
|
@Query("printerName") String printerName,
|
||||||
@@ -43,4 +26,16 @@ public interface PrinterRESTConsumerService {
|
|||||||
@Body JasperDTO jasperDTO
|
@Body JasperDTO jasperDTO
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
@POST("wms/printEtichettaSSCC")
|
||||||
|
Call<ServiceRESTResponse<Object>> printCollo(
|
||||||
|
@Query("printerType") String printerType,
|
||||||
|
@Body MtbColt mtbColtToPrint
|
||||||
|
);
|
||||||
|
|
||||||
|
@POST("wms/printEtichettaSSCC")
|
||||||
|
Call<ServiceRESTResponse<Object>> printCollo(
|
||||||
|
@Body MtbColt mtbColtToPrint
|
||||||
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ public class _BaseRESTConsumer {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (response.code() == 404) {
|
if (response.code() == 404) {
|
||||||
Log.e(logTitle, "Errore " + response.code() + ": risorsa non trovata");
|
Log.e(logTitle, "Errore " + response.code() + ": risorsa non trovata (" + response.raw().request().url().toString() + ")");
|
||||||
onFailed.run(new Exception("Errore " + response.code() + ": risorsa non trovata (" + logTitle + ")"));
|
onFailed.run(new Exception("Errore " + response.code() + ": risorsa non trovata (" + logTitle + ")"));
|
||||||
} else {
|
} else {
|
||||||
Log.e(logTitle, "Status " + response.code() + ": " + response.message());
|
Log.e(logTitle, "Status " + response.code() + ": " + response.message());
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package it.integry.integrywmsnative.core.rest.model;
|
|||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.model.OrdineInevasoDTO;
|
import it.integry.integrywmsnative.core.model.OrdineInevasoDTO;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||||
@@ -43,9 +44,7 @@ public class OrdineUscitaInevasoDTO extends OrdineInevasoDTO {
|
|||||||
private boolean flagEvaso;
|
private boolean flagEvaso;
|
||||||
private String nomeAgente;
|
private String nomeAgente;
|
||||||
private String codJfas;
|
private String codJfas;
|
||||||
|
private List<AvailableClassMerc> availableClassMerc;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public Integer getIdViaggio() {
|
public Integer getIdViaggio() {
|
||||||
return idViaggio;
|
return idViaggio;
|
||||||
@@ -363,6 +362,16 @@ public class OrdineUscitaInevasoDTO extends OrdineInevasoDTO {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<AvailableClassMerc> getAvailableClassMerc() {
|
||||||
|
return availableClassMerc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrdineUscitaInevasoDTO setAvailableClassMerc(List<AvailableClassMerc> availableClassMerc) {
|
||||||
|
this.availableClassMerc = availableClassMerc;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if (this == o) return true;
|
||||||
@@ -382,4 +391,28 @@ public class OrdineUscitaInevasoDTO extends OrdineInevasoDTO {
|
|||||||
result = 31 * result + getGestione().hashCode();
|
result = 31 * result + getGestione().hashCode();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class AvailableClassMerc {
|
||||||
|
|
||||||
|
private String codMgrp;
|
||||||
|
private List<String> codMsgr;
|
||||||
|
|
||||||
|
public String getCodMgrp() {
|
||||||
|
return codMgrp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AvailableClassMerc setCodMgrp(String codMgrp) {
|
||||||
|
this.codMgrp = codMgrp;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getCodMsgr() {
|
||||||
|
return codMsgr;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AvailableClassMerc setCodMsgr(List<String> codMsgr) {
|
||||||
|
this.codMsgr = codMsgr;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package it.integry.integrywmsnative.core.utility;
|
||||||
|
|
||||||
|
public class UtilityBoolean {
|
||||||
|
|
||||||
|
public static int toInt(boolean bool) {
|
||||||
|
return bool ? 1 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -7,6 +7,7 @@ import android.text.Html;
|
|||||||
import androidx.fragment.app.FragmentActivity;
|
import androidx.fragment.app.FragmentActivity;
|
||||||
import androidx.fragment.app.FragmentManager;
|
import androidx.fragment.app.FragmentManager;
|
||||||
|
|
||||||
|
import com.annimon.stream.Stream;
|
||||||
import com.google.firebase.crashlytics.FirebaseCrashlytics;
|
import com.google.firebase.crashlytics.FirebaseCrashlytics;
|
||||||
import com.orhanobut.logger.Logger;
|
import com.orhanobut.logger.Logger;
|
||||||
|
|
||||||
@@ -16,6 +17,9 @@ import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
|||||||
|
|
||||||
public class UtilityExceptions {
|
public class UtilityExceptions {
|
||||||
|
|
||||||
|
private static final Class<? extends Exception>[] FIREBASE_IGNORED_EXCEPTIONS = new Class[] {
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
public static void defaultException(Context context, Exception ex, Dialog progressDialog) {
|
public static void defaultException(Context context, Exception ex, Dialog progressDialog) {
|
||||||
defaultException(context, ex);
|
defaultException(context, ex);
|
||||||
@@ -55,7 +59,10 @@ public class UtilityExceptions {
|
|||||||
.show(fm, "tag");
|
.show(fm, "tag");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!BuildConfig.DEBUG) {
|
boolean toIgnore = ex.getClass().getName().startsWith("it.integry.integrywmsnative") ||
|
||||||
|
Stream.of(FIREBASE_IGNORED_EXCEPTIONS).anyMatch(x -> x.isAssignableFrom(ex.getClass()));
|
||||||
|
|
||||||
|
if (!BuildConfig.DEBUG && !toIgnore) {
|
||||||
if (sendEmail) UtilityLogger.errorMe(ex);
|
if (sendEmail) UtilityLogger.errorMe(ex);
|
||||||
FirebaseCrashlytics.getInstance().recordException(ex);
|
FirebaseCrashlytics.getInstance().recordException(ex);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ import it.integry.integrywmsnative.core.data_cache.DataCache;
|
|||||||
import it.integry.integrywmsnative.core.di.BindableBoolean;
|
import it.integry.integrywmsnative.core.di.BindableBoolean;
|
||||||
import it.integry.integrywmsnative.core.expansion.BaseFragment;
|
import it.integry.integrywmsnative.core.expansion.BaseFragment;
|
||||||
import it.integry.integrywmsnative.core.interfaces.IScrollableFragment;
|
import it.integry.integrywmsnative.core.interfaces.IScrollableFragment;
|
||||||
import it.integry.integrywmsnative.core.interfaces.ISearcableFragment;
|
import it.integry.integrywmsnative.core.interfaces.ISearchableFragment;
|
||||||
import it.integry.integrywmsnative.core.interfaces.ITitledFragment;
|
import it.integry.integrywmsnative.core.interfaces.ITitledFragment;
|
||||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityBigDecimal;
|
import it.integry.integrywmsnative.core.utility.UtilityBigDecimal;
|
||||||
@@ -43,7 +43,7 @@ import it.integry.integrywmsnative.gest.accettazione_picking.AccettazionePicking
|
|||||||
import it.integry.integrywmsnative.ui.ElevatedToolbar;
|
import it.integry.integrywmsnative.ui.ElevatedToolbar;
|
||||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||||
|
|
||||||
public class MainAccettazioneFragment extends BaseFragment implements ISearcableFragment, ITitledFragment, IScrollableFragment, MainAccettazioneViewModel.Listener {
|
public class MainAccettazioneFragment extends BaseFragment implements ISearchableFragment, ITitledFragment, IScrollableFragment, MainAccettazioneViewModel.Listener {
|
||||||
|
|
||||||
public BindableBoolean fabVisible = new BindableBoolean(false);
|
public BindableBoolean fabVisible = new BindableBoolean(false);
|
||||||
|
|
||||||
@@ -53,6 +53,7 @@ public class MainAccettazioneFragment extends BaseFragment implements ISearcable
|
|||||||
private final List<Runnable> mOnPreDestroyList = new ArrayList<>();
|
private final List<Runnable> mOnPreDestroyList = new ArrayList<>();
|
||||||
private ElevatedToolbar mToolbar;
|
private ElevatedToolbar mToolbar;
|
||||||
|
|
||||||
|
private String mTextFilter;
|
||||||
private FragmentMainAccettazioneBinding mBinding;
|
private FragmentMainAccettazioneBinding mBinding;
|
||||||
|
|
||||||
private final ObservableArrayList<MainListAccettazioneListModel> mOrdiniInevasiMutableData = new ObservableArrayList<>();
|
private final ObservableArrayList<MainListAccettazioneListModel> mOrdiniInevasiMutableData = new ObservableArrayList<>();
|
||||||
@@ -65,10 +66,7 @@ public class MainAccettazioneFragment extends BaseFragment implements ISearcable
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static MainAccettazioneFragment newInstance() {
|
public static MainAccettazioneFragment newInstance() {
|
||||||
MainAccettazioneFragment fragment = new MainAccettazioneFragment();
|
return new MainAccettazioneFragment();
|
||||||
Bundle args = new Bundle();
|
|
||||||
fragment.setArguments(args);
|
|
||||||
return fragment;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -122,7 +120,9 @@ public class MainAccettazioneFragment extends BaseFragment implements ISearcable
|
|||||||
|
|
||||||
|
|
||||||
private void initRecyclerView() {
|
private void initRecyclerView() {
|
||||||
this.mViewModel.getOrderList().observe(getViewLifecycleOwner(), this::refreshList);
|
this.mViewModel.getOrderList().observe(getViewLifecycleOwner(), x->{
|
||||||
|
this.refreshList(getFilteredList(mTextFilter));
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
MainListAccettazioneAdapter adapter = new MainListAccettazioneAdapter(getActivity(), mOrdiniInevasiMutableData)
|
MainListAccettazioneAdapter adapter = new MainListAccettazioneAdapter(getActivity(), mOrdiniInevasiMutableData)
|
||||||
@@ -228,20 +228,25 @@ public class MainAccettazioneFragment extends BaseFragment implements ISearcable
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onQueryTextChange(String newText) {
|
public boolean onQueryTextChange(String newText) {
|
||||||
|
List<OrdineAccettazioneInevasoDTO> originalList = this.mViewModel.getOrderList().getValue();
|
||||||
|
if(originalList == null || originalList.isEmpty()) return false;
|
||||||
|
mTextFilter = newText;
|
||||||
|
List<OrdineAccettazioneInevasoDTO> filteredOrders = getFilteredList(newText);
|
||||||
|
|
||||||
|
refreshList(filteredOrders);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<OrdineAccettazioneInevasoDTO> getFilteredList(String newText) {
|
||||||
List<OrdineAccettazioneInevasoDTO> filteredOrders = new ArrayList<>();
|
List<OrdineAccettazioneInevasoDTO> filteredOrders = new ArrayList<>();
|
||||||
List<OrdineAccettazioneInevasoDTO> originalList = this.mViewModel.getOrderList().getValue();
|
List<OrdineAccettazioneInevasoDTO> originalList = this.mViewModel.getOrderList().getValue();
|
||||||
|
if(originalList == null || originalList.isEmpty() || newText == null) return originalList;
|
||||||
if(originalList == null || originalList.isEmpty()) return false;
|
|
||||||
|
|
||||||
for(int i = 0; i < originalList.size(); i++){
|
for(int i = 0; i < originalList.size(); i++){
|
||||||
|
|
||||||
if(originalList.get(i).getRagSocOrd().toLowerCase().contains(newText.toLowerCase())){
|
if(originalList.get(i).getRagSocOrd().toLowerCase().contains(newText.toLowerCase())){
|
||||||
filteredOrders.add(originalList.get(i));
|
filteredOrders.add(originalList.get(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return filteredOrders;
|
||||||
refreshList(filteredOrders);
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ import it.integry.integrywmsnative.core.exception.InvalidLUMultiGestioneExceptio
|
|||||||
import it.integry.integrywmsnative.core.exception.InvalidOrderTypeException;
|
import it.integry.integrywmsnative.core.exception.InvalidOrderTypeException;
|
||||||
import it.integry.integrywmsnative.core.exception.LUScanNotGrantedException;
|
import it.integry.integrywmsnative.core.exception.LUScanNotGrantedException;
|
||||||
import it.integry.integrywmsnative.core.exception.NoArtsFoundException;
|
import it.integry.integrywmsnative.core.exception.NoArtsFoundException;
|
||||||
import it.integry.integrywmsnative.core.exception.NoPrintersFoundException;
|
|
||||||
import it.integry.integrywmsnative.core.exception.NoResultFromBarcodeException;
|
import it.integry.integrywmsnative.core.exception.NoResultFromBarcodeException;
|
||||||
import it.integry.integrywmsnative.core.expansion.AtomicBigDecimal;
|
import it.integry.integrywmsnative.core.expansion.AtomicBigDecimal;
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
@@ -37,7 +36,6 @@ import it.integry.integrywmsnative.core.model.MtbColr;
|
|||||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||||
import it.integry.integrywmsnative.core.model.dto.PickDataDTO;
|
import it.integry.integrywmsnative.core.model.dto.PickDataDTO;
|
||||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||||
import it.integry.integrywmsnative.core.report.ReportManager;
|
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||||
@@ -532,10 +530,10 @@ public class AccettazionePickingViewModel {
|
|||||||
dataScad = c.getTime();
|
dataScad = c.getTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(partitaMag == null && dataScad == null) {
|
if (partitaMag == null && dataScad == null) {
|
||||||
HistoryMtbAartDTO historyMtbAartDTO = this.getHistoryItemIfExists(pickingObjectDTO.getMtbAart().getCodMart());
|
HistoryMtbAartDTO historyMtbAartDTO = this.getHistoryItemIfExists(pickingObjectDTO.getMtbAart().getCodMart());
|
||||||
|
|
||||||
if(historyMtbAartDTO != null) {
|
if (historyMtbAartDTO != null) {
|
||||||
partitaMag = historyMtbAartDTO.getPartitaMag();
|
partitaMag = historyMtbAartDTO.getPartitaMag();
|
||||||
dataScad = historyMtbAartDTO.getDataScad();
|
dataScad = historyMtbAartDTO.getDataScad();
|
||||||
}
|
}
|
||||||
@@ -788,25 +786,16 @@ public class AccettazionePickingViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void printCollo(Runnable onComplete) {
|
private void printCollo(Runnable onComplete) {
|
||||||
this.mPrinterRESTConsumer.getAvailablePrinters(mDefaultCodMdep, PrinterRESTConsumer.Type.SECONDARIA, printerList -> {
|
MtbColt cloneMtbColt = (MtbColt) mCurrentMtbColt.clone();
|
||||||
|
cloneMtbColt.setGestione(cloneMtbColt.getGestioneEnum() == GestioneEnum.LAVORAZIONE ? GestioneEnum.PRODUZIONE : cloneMtbColt.getGestioneEnum());
|
||||||
|
|
||||||
if (printerList == null || printerList.size() == 0) {
|
this.mPrinterRESTConsumer.printCollo(
|
||||||
this.sendError(new NoPrintersFoundException());
|
PrinterRESTConsumer.Type.SECONDARIA,
|
||||||
onComplete.run();
|
cloneMtbColt,
|
||||||
return;
|
() -> {
|
||||||
}
|
this.sendLUSuccessfullyPrinted();
|
||||||
|
onComplete.run();
|
||||||
String reportName = ReportManager.getReportNameLUFromGestione(GestioneEnum.ACQUISTO);
|
}, ex -> this.sendLUPrintError(ex, onComplete));
|
||||||
|
|
||||||
this.mPrinterRESTConsumer.printCollo(
|
|
||||||
printerList.get(0),
|
|
||||||
mCurrentMtbColt,
|
|
||||||
1,
|
|
||||||
reportName, () -> {
|
|
||||||
this.sendLUSuccessfullyPrinted();
|
|
||||||
onComplete.run();
|
|
||||||
}, ex -> this.sendLUPrintError(ex, onComplete));
|
|
||||||
}, this::sendError);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.contab_doc_interni;
|
||||||
|
|
||||||
|
import dagger.Subcomponent;
|
||||||
|
|
||||||
|
@Subcomponent()
|
||||||
|
public interface DocInterniComponent {
|
||||||
|
@Subcomponent.Factory
|
||||||
|
interface Factory {
|
||||||
|
DocInterniComponent create();
|
||||||
|
}
|
||||||
|
|
||||||
|
void inject(DocInterniFragment docInterniFragment);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,177 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.contab_doc_interni;
|
||||||
|
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import androidx.appcompat.widget.AppCompatTextView;
|
||||||
|
import androidx.databinding.DataBindingUtil;
|
||||||
|
import androidx.databinding.ObservableArrayList;
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
|
||||||
|
import com.annimon.stream.Stream;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.MainApplication;
|
||||||
|
import it.integry.integrywmsnative.R;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColt;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.wrappers.DocInternoWrapper;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.BaseFragment;
|
||||||
|
import it.integry.integrywmsnative.core.interfaces.IScrollableFragment;
|
||||||
|
import it.integry.integrywmsnative.core.interfaces.ITitledFragment;
|
||||||
|
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||||
|
import it.integry.integrywmsnative.databinding.FragmentDocInterniBinding;
|
||||||
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dialog.DialogSelectMgrpDtipPairView;
|
||||||
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dialog.DialogSelectMgrpDtipPairViewModel;
|
||||||
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.GrigliaAcquistiDTO;
|
||||||
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.TipiDocAndGruppiArtDTO;
|
||||||
|
import it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.DocInterniEditFormActivity;
|
||||||
|
import it.integry.integrywmsnative.gest.contab_doc_interni.ui.DocInterniListAdapter;
|
||||||
|
import it.integry.integrywmsnative.gest.contab_doc_interni.ui.DocInterniListModel;
|
||||||
|
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.PVOrdineAcquistoEditActivity;
|
||||||
|
import it.integry.integrywmsnative.gest.spedizione.ui.SpedizioneListAdapter;
|
||||||
|
import it.integry.integrywmsnative.ui.ElevatedToolbar;
|
||||||
|
|
||||||
|
public class DocInterniFragment extends BaseFragment implements ITitledFragment, IScrollableFragment, DocInterniViewModel.Listener {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
DocInterniViewModel mViewModel;
|
||||||
|
|
||||||
|
private final ObservableArrayList<DocInterniListModel> mDocInterniMutableData = new ObservableArrayList<>();
|
||||||
|
private ElevatedToolbar mToolbar;
|
||||||
|
private FragmentDocInterniBinding mBinding;
|
||||||
|
private TipiDocAndGruppiArtDTO mTipiDocAndGruppiArtDTO;
|
||||||
|
private final List<Runnable> mOnPreDestroyList = new ArrayList<>();
|
||||||
|
private boolean dialogInitialized = false;
|
||||||
|
|
||||||
|
|
||||||
|
public DocInterniFragment() {
|
||||||
|
// Required empty public constructor
|
||||||
|
}
|
||||||
|
|
||||||
|
public static DocInterniFragment newInstance() {
|
||||||
|
DocInterniFragment fragment = new DocInterniFragment();
|
||||||
|
Bundle args = new Bundle();
|
||||||
|
fragment.setArguments(args);
|
||||||
|
return fragment;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreateActionBar(AppCompatTextView titleText, Context context) {
|
||||||
|
titleText.setText(context.getText(R.string.doc_interni).toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
|
Bundle savedInstanceState) {
|
||||||
|
|
||||||
|
mBinding = DataBindingUtil.inflate(inflater, R.layout.fragment_doc_interni, container, false);
|
||||||
|
MainApplication.appComponent
|
||||||
|
.docInterniComponent()
|
||||||
|
.create()
|
||||||
|
.inject(this);
|
||||||
|
|
||||||
|
mViewModel.setListeners(this);
|
||||||
|
mBinding.setLifecycleOwner(this);
|
||||||
|
mBinding.setView(this);
|
||||||
|
mBinding.setViewModel(mViewModel);
|
||||||
|
this.initRecyclerView();
|
||||||
|
|
||||||
|
return mBinding.getRoot();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStart() {
|
||||||
|
super.onStart();
|
||||||
|
if (!this.mViewModel.hasDocDetails()){
|
||||||
|
mViewModel.init();
|
||||||
|
}else{
|
||||||
|
this.mViewModel.fetchDocuments();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroy() {
|
||||||
|
for (Runnable onPreDestroy : mOnPreDestroyList) {
|
||||||
|
onPreDestroy.run();
|
||||||
|
}
|
||||||
|
super.onDestroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onGruppiArtAndTipiDocFetch(TipiDocAndGruppiArtDTO tipiDocAndGruppiArtDTO) {
|
||||||
|
this.mTipiDocAndGruppiArtDTO = tipiDocAndGruppiArtDTO;
|
||||||
|
this.dialogInitialized = true;
|
||||||
|
this.selectCodMgrpAndCodDtip();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDocDetailsChanged(DialogSelectMgrpDtipPairViewModel selection) {
|
||||||
|
|
||||||
|
this.mViewModel.setSelectedDocDetails(selection);
|
||||||
|
this.mBinding.mainFab.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setScrollToolbar(ElevatedToolbar toolbar) {
|
||||||
|
mToolbar = toolbar;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addOnPreDestroy(Runnable onPreDestroy) {
|
||||||
|
this.mOnPreDestroyList.add(onPreDestroy);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void selectCodMgrpAndCodDtip() {
|
||||||
|
if (this.dialogInitialized){
|
||||||
|
DialogSelectMgrpDtipPairView.newInstance(
|
||||||
|
mTipiDocAndGruppiArtDTO,
|
||||||
|
this.mViewModel.dtbTipi.getValue(),
|
||||||
|
this.mViewModel.mtbGrup.getValue(),
|
||||||
|
this::onDocDetailsChanged
|
||||||
|
).show(requireActivity().getSupportFragmentManager(), "tag");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initRecyclerView() {
|
||||||
|
this.mViewModel.getDocsList().observe(getViewLifecycleOwner(), this::refreshList);
|
||||||
|
DocInterniListAdapter docInterniListAdapter = new DocInterniListAdapter(this.requireActivity(), this.mDocInterniMutableData);
|
||||||
|
docInterniListAdapter.setEmptyView(this.mBinding.docInterniEmptyView);
|
||||||
|
this.mBinding.docInterniMainList.setAdapter(docInterniListAdapter);
|
||||||
|
this.mBinding.docInterniMainList.setLayoutManager(new LinearLayoutManager(this.requireActivity()));
|
||||||
|
|
||||||
|
docInterniListAdapter.setOnItemClicked(this.mViewModel::editDocument);
|
||||||
|
if (mToolbar != null)
|
||||||
|
mToolbar.setRecyclerView(this.mBinding.docInterniMainList);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshList(List<DocInternoWrapper> filteredList) {
|
||||||
|
this.mDocInterniMutableData.clear();
|
||||||
|
this.mDocInterniMutableData.addAll(convertDataModelToListModel(mViewModel.getDocsList().getValue()));
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<DocInterniListModel> convertDataModelToListModel(List<DocInternoWrapper> dataList) {
|
||||||
|
|
||||||
|
return Stream.of(dataList)
|
||||||
|
.map(x -> {
|
||||||
|
DocInterniListModel listModel = new DocInterniListModel();
|
||||||
|
listModel.setDocument(x.getDocument());
|
||||||
|
listModel.setProductsCount(x.getCountArticoli());
|
||||||
|
return listModel;
|
||||||
|
})
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDocumentEditRequest(SqlMtbColt document, GrigliaAcquistiDTO arts) {
|
||||||
|
requireActivity().startActivity(DocInterniEditFormActivity.newInstance(requireActivity(),document,arts));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.contab_doc_interni;
|
||||||
|
|
||||||
|
import dagger.Module;
|
||||||
|
import dagger.Provides;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.repository.MtbColtRepository;
|
||||||
|
import it.integry.integrywmsnative.gest.contab_doc_interni.rest.DocInterniRESTConsumer;
|
||||||
|
|
||||||
|
@Module(subcomponents = DocInterniComponent.class)
|
||||||
|
public class DocInterniModule {
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
DocInterniViewModel docInterniViewModel(DocInterniRESTConsumer docInterniRESTConsumer, MtbColtRepository mtbColtRepository) {
|
||||||
|
return new DocInterniViewModel(docInterniRESTConsumer,mtbColtRepository);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,177 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.contab_doc_interni;
|
||||||
|
|
||||||
|
import androidx.lifecycle.MutableLiveData;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColt;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.repository.MtbColtRepository;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.wrappers.DocInternoWrapper;
|
||||||
|
import it.integry.integrywmsnative.core.di.BindableInteger;
|
||||||
|
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
|
||||||
|
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||||
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dialog.DialogSelectMgrpDtipPairViewModel;
|
||||||
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.GrigliaAcquistiDTO;
|
||||||
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.GruppiArticoloDTO;
|
||||||
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.TipiDocAndGruppiArtDTO;
|
||||||
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.TipiDocDTO;
|
||||||
|
import it.integry.integrywmsnative.gest.contab_doc_interni.rest.DocInterniRESTConsumer;
|
||||||
|
|
||||||
|
public class DocInterniViewModel {
|
||||||
|
|
||||||
|
private Listener mListener;
|
||||||
|
private final DocInterniRESTConsumer mDocInterniRESTConsumer;
|
||||||
|
private boolean productsFetched = true;
|
||||||
|
private boolean docsFetched = true;
|
||||||
|
private int nextNumCollo = 0;
|
||||||
|
private GrigliaAcquistiDTO productsList;
|
||||||
|
|
||||||
|
|
||||||
|
public final MutableLiveData<TipiDocDTO> dtbTipi = new MutableLiveData<>();
|
||||||
|
public final MutableLiveData<GruppiArticoloDTO> mtbGrup = new MutableLiveData<>();
|
||||||
|
private final MutableLiveData<List<DocInternoWrapper>> mDocsList = new MutableLiveData<>();
|
||||||
|
public final BindableInteger artsSize = new BindableInteger(0);
|
||||||
|
@Inject
|
||||||
|
MtbColtRepository documentRepository;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public DocInterniViewModel(DocInterniRESTConsumer docInterniRESTConsumer, MtbColtRepository documentRepository) {
|
||||||
|
mDocInterniRESTConsumer = docInterniRESTConsumer;
|
||||||
|
this.documentRepository = documentRepository;
|
||||||
|
this.mDocsList.setValue(new ArrayList<>());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void init() {
|
||||||
|
this.sendOnLoadingStarted();
|
||||||
|
// new Thread(() -> {
|
||||||
|
mDocInterniRESTConsumer.getDocTypesAndGroupArts(returnDto -> {
|
||||||
|
this.sendOnLoadingEnded();
|
||||||
|
this.mListener.onGruppiArtAndTipiDocFetch(returnDto);
|
||||||
|
}, this::sendError);
|
||||||
|
// }).start();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sendOnLoadingStarted() {
|
||||||
|
if (this.mListener != null) mListener.onLoadingStarted();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sendOnLoadingEnded() {
|
||||||
|
if (this.mListener != null) mListener.onLoadingEnded();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sendError(Exception ex) {
|
||||||
|
if (this.mListener != null) mListener.onError(ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
public DocInterniViewModel setListeners(Listener listener) {
|
||||||
|
this.mListener = listener;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MutableLiveData<List<DocInternoWrapper>> getDocsList() {
|
||||||
|
return mDocsList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSelectedDocDetails(DialogSelectMgrpDtipPairViewModel selection) {
|
||||||
|
if (selection.getSelectedGruppoArt() != null && selection.getSelectedTipoDoc() != null) {
|
||||||
|
if (this.dtbTipi.getValue() == null || this.mtbGrup.getValue() == null || !this.dtbTipi.getValue().equals(selection.getSelectedTipoDoc()) || !this.mtbGrup.getValue().equals(selection.getSelectedGruppoArt())) {
|
||||||
|
this.dtbTipi.setValue(selection.getSelectedTipoDoc());
|
||||||
|
this.mtbGrup.setValue(selection.getSelectedGruppoArt());
|
||||||
|
this.fetchProducts();
|
||||||
|
this.fetchDocuments();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void fetchProducts() {
|
||||||
|
this.productsFetched = false;
|
||||||
|
mDocInterniRESTConsumer.fetchProducts(this.dtbTipi.getValue().getCodDtip(), this.mtbGrup.getValue().getCodMgrp(), returnDto -> {
|
||||||
|
this.productsFetched = true;
|
||||||
|
this.productsList = returnDto;
|
||||||
|
this.artsSize.set(returnDto.getGrigliaAcquistiChild().size());
|
||||||
|
if (this.docsFetched) {
|
||||||
|
this.sendOnLoadingEnded();
|
||||||
|
}
|
||||||
|
}, this::sendError);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void fetchDocuments() {
|
||||||
|
this.docsFetched = false;
|
||||||
|
this.sendOnLoadingStarted();
|
||||||
|
documentRepository.getLocalDocumentsByCodDtipAndCodMgrp(this.getCodDtip(), this.getCodMgrp(), list -> {
|
||||||
|
documentRepository.getNextNumCollo(nextNumCollo->{
|
||||||
|
this.mDocsList.postValue(list);
|
||||||
|
this.setNextNumCollo(nextNumCollo);
|
||||||
|
this.docsFetched = true;
|
||||||
|
if (this.productsFetched) {
|
||||||
|
this.sendOnLoadingEnded();
|
||||||
|
}
|
||||||
|
},this::sendError);
|
||||||
|
},this::sendError);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setNextNumCollo(Integer nextNumCollo) {
|
||||||
|
this.nextNumCollo = nextNumCollo;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getCodDtip() {
|
||||||
|
if (this.dtbTipi.getValue() == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return this.dtbTipi.getValue().getCodDtip();
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getCodMgrp() {
|
||||||
|
if (this.mtbGrup.getValue() == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return this.mtbGrup.getValue().getCodMgrp();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void editDocument(SqlMtbColt document) {
|
||||||
|
this.mListener.onDocumentEditRequest(document, productsList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void newDocument() {
|
||||||
|
SqlMtbColt document = new SqlMtbColt();
|
||||||
|
if (this.dtbTipi.getValue() == null) {
|
||||||
|
this.sendError(new Exception("Nessun tipo documento selezionato!"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
document.setCodDtipProvv(this.getCodDtip());
|
||||||
|
document.setCodMgrp(this.getCodMgrp());
|
||||||
|
document.setDataCollo(new Date());
|
||||||
|
document.setCodMdep(SettingsManager.i().getUserSession().getDepo().getCodMdep());
|
||||||
|
document.setAnnotazioni("");
|
||||||
|
document.setSegno(-1);
|
||||||
|
document.setSerCollo("/");
|
||||||
|
document.setNumCollo(this.nextNumCollo);
|
||||||
|
document.setGestione("L");
|
||||||
|
documentRepository.insert(document,id->{
|
||||||
|
document.setId(id);
|
||||||
|
this.editDocument(document);
|
||||||
|
}, this::sendError);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasDocDetails() {
|
||||||
|
return this.dtbTipi.getValue() != null && this.mtbGrup.getValue() != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface Listener extends ILoadingListener {
|
||||||
|
|
||||||
|
void onError(Exception ex);
|
||||||
|
|
||||||
|
void onGruppiArtAndTipiDocFetch(TipiDocAndGruppiArtDTO tipiDocAndGruppiArtDTO);
|
||||||
|
|
||||||
|
void onDocDetailsChanged(DialogSelectMgrpDtipPairViewModel selection);
|
||||||
|
|
||||||
|
void onDocumentEditRequest(SqlMtbColt document, GrigliaAcquistiDTO arts);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.contab_doc_interni.dialog;
|
||||||
|
|
||||||
|
import dagger.Subcomponent;
|
||||||
|
import it.integry.integrywmsnative.gest.contab_doc_interni.DocInterniFragment;
|
||||||
|
|
||||||
|
@Subcomponent
|
||||||
|
public interface DialogSelectMgrpDtipPairComponent {
|
||||||
|
|
||||||
|
@Subcomponent.Factory
|
||||||
|
interface Factory {
|
||||||
|
DialogSelectMgrpDtipPairComponent create();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void inject(DialogSelectMgrpDtipPairView dialogSelectMgrpDtipPairView);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.contab_doc_interni.dialog;
|
||||||
|
|
||||||
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
|
import dagger.Module;
|
||||||
|
import dagger.Provides;
|
||||||
|
|
||||||
|
@Module(subcomponents = DialogSelectMgrpDtipPairComponent.class)
|
||||||
|
public class DialogSelectMgrpDtipPairModule {
|
||||||
|
|
||||||
|
@Singleton
|
||||||
|
@Provides
|
||||||
|
DialogSelectMgrpDtipPairViewModel dialogSelectMgrpDtipPairViewModel() {
|
||||||
|
return new DialogSelectMgrpDtipPairViewModel();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,161 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.contab_doc_interni.dialog;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.graphics.drawable.ColorDrawable;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.view.WindowManager;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.databinding.DataBindingUtil;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.MainApplication;
|
||||||
|
import it.integry.integrywmsnative.R;
|
||||||
|
import it.integry.integrywmsnative.core.di.BindableString;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
|
import it.integry.integrywmsnative.databinding.DialogSelectTipoDocAndGroupArtBinding;
|
||||||
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.GruppiArticoloDTO;
|
||||||
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.TipiDocAndGruppiArtDTO;
|
||||||
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.TipiDocDTO;
|
||||||
|
|
||||||
|
public class DialogSelectMgrpDtipPairView extends BaseDialogFragment {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
DialogSelectMgrpDtipPairViewModel mViewModel;
|
||||||
|
private Context mCurrentContext;
|
||||||
|
|
||||||
|
|
||||||
|
public BindableString codDtip = new BindableString();
|
||||||
|
public BindableString codMgrp = new BindableString();
|
||||||
|
private ArrayAdapter<String> arrayAdapterCodDtips;
|
||||||
|
private ArrayAdapter<String> arrayAdapterCodMgrps;
|
||||||
|
private DialogSelectTipoDocAndGroupArtBinding mBindings;
|
||||||
|
|
||||||
|
private RunnableArgs<DialogSelectMgrpDtipPairViewModel> currentOnFilterDone;
|
||||||
|
private TipiDocAndGruppiArtDTO mTipiDocAndGruppiArtDTO;
|
||||||
|
private TipiDocDTO mSelectedDtip;
|
||||||
|
private GruppiArticoloDTO mSelectedGrp;
|
||||||
|
|
||||||
|
|
||||||
|
public static DialogSelectMgrpDtipPairView newInstance(
|
||||||
|
TipiDocAndGruppiArtDTO tipiDocAndGruppiArtDTO,
|
||||||
|
TipiDocDTO tipiDocDTO,
|
||||||
|
GruppiArticoloDTO gruppiArticoloDTO,
|
||||||
|
RunnableArgs<DialogSelectMgrpDtipPairViewModel> onDismiss
|
||||||
|
) {
|
||||||
|
return new DialogSelectMgrpDtipPairView(tipiDocAndGruppiArtDTO,tipiDocDTO,gruppiArticoloDTO, onDismiss);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private DialogSelectMgrpDtipPairView(TipiDocAndGruppiArtDTO tipiDocAndGruppiArtDTO,TipiDocDTO tipiDocDTO, GruppiArticoloDTO gruppiArticoloDTO, RunnableArgs<DialogSelectMgrpDtipPairViewModel> onDismiss) {
|
||||||
|
super();
|
||||||
|
currentOnFilterDone = onDismiss;
|
||||||
|
mTipiDocAndGruppiArtDTO = tipiDocAndGruppiArtDTO;
|
||||||
|
mSelectedDtip = tipiDocDTO;
|
||||||
|
mSelectedGrp = gruppiArticoloDTO;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDismiss(@NonNull DialogInterface dialog) {
|
||||||
|
super.onDismiss(dialog);
|
||||||
|
if (currentOnFilterDone != null) currentOnFilterDone.run(mViewModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
|
this.mCurrentContext = this.requireActivity();
|
||||||
|
|
||||||
|
mBindings = DataBindingUtil.inflate(inflater, R.layout.dialog_select_tipo_doc_and_group_art, container, false);
|
||||||
|
mBindings.setLifecycleOwner(this);
|
||||||
|
|
||||||
|
MainApplication
|
||||||
|
.appComponent
|
||||||
|
.dialogSelectMgrpDtipPairComponent()
|
||||||
|
.create()
|
||||||
|
.inject(this);
|
||||||
|
mViewModel.init(mTipiDocAndGruppiArtDTO);
|
||||||
|
mBindings.setView(this);
|
||||||
|
mBindings.setViewmodel(mViewModel);
|
||||||
|
|
||||||
|
getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
|
||||||
|
getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||||
|
initView();
|
||||||
|
|
||||||
|
|
||||||
|
mBindings.positiveBtn.setOnClickListener(view -> {
|
||||||
|
if (this.isInputValid()) {
|
||||||
|
getDialog().dismiss();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
return mBindings.getRoot();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initView() {
|
||||||
|
initArrayAdapters();
|
||||||
|
initBindables();
|
||||||
|
if (mSelectedDtip != null){
|
||||||
|
codDtip.set(mSelectedDtip.getLabel());
|
||||||
|
}
|
||||||
|
if (mSelectedGrp != null){
|
||||||
|
codMgrp.set(mSelectedGrp.getLabel());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isInputValid() {
|
||||||
|
if (this.mViewModel.getSelectedTipoDoc() == null) {
|
||||||
|
mBindings.inputCodDtip.setErrorEnabled(true);
|
||||||
|
mBindings.inputCodDtip.setError("Seleziona un tipo documento");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (this.mViewModel.getSelectedGruppoArt() == null) {
|
||||||
|
mBindings.inputCodMgrps.setErrorEnabled(true);
|
||||||
|
mBindings.inputCodMgrps.setError("Seleziona un gruppo merceologico");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initArrayAdapters() {
|
||||||
|
|
||||||
|
arrayAdapterCodDtips = new ArrayAdapter<>(mCurrentContext, R.layout.dialog_select_tipo_doc_and_group_art__single_item);
|
||||||
|
arrayAdapterCodDtips.addAll(mViewModel.getAvailableCodDtips());
|
||||||
|
mBindings.filledExposedDropdownCodDtips.setAdapter(arrayAdapterCodDtips);
|
||||||
|
|
||||||
|
|
||||||
|
arrayAdapterCodMgrps = new ArrayAdapter<>(mCurrentContext, R.layout.dialog_select_tipo_doc_and_group_art__single_item);
|
||||||
|
arrayAdapterCodMgrps.addAll(mViewModel.getAvailableCodMgrps());
|
||||||
|
mBindings.filledExposedDropdownCodMgrps.setAdapter(arrayAdapterCodMgrps);
|
||||||
|
}
|
||||||
|
|
||||||
|
public DialogSelectMgrpDtipPairView setCodDtip(String codDtip) {
|
||||||
|
this.codDtip.set(codDtip);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DialogSelectMgrpDtipPairView setCodMgrp(String codMgrp) {
|
||||||
|
this.codMgrp.set(codMgrp);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void initBindables() {
|
||||||
|
|
||||||
|
BindableString.registerListener(codDtip, mViewModel::setCodDtip);
|
||||||
|
BindableString.registerListener(codMgrp, mViewModel::setCodMgrp);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.contab_doc_interni.dialog;
|
||||||
|
|
||||||
|
import com.annimon.stream.Stream;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.GruppiArticoloDTO;
|
||||||
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.TipiDocAndGruppiArtDTO;
|
||||||
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.TipiDocDTO;
|
||||||
|
|
||||||
|
|
||||||
|
public class DialogSelectMgrpDtipPairViewModel {
|
||||||
|
|
||||||
|
|
||||||
|
private TipiDocAndGruppiArtDTO mTipiDocAndGruppiArtDTO;
|
||||||
|
|
||||||
|
private String mTipoDoc;
|
||||||
|
private String mGruppoArt;
|
||||||
|
|
||||||
|
public void init(TipiDocAndGruppiArtDTO initialList) {
|
||||||
|
this.mTipiDocAndGruppiArtDTO = initialList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCodDtip() {
|
||||||
|
return mTipoDoc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCodDtip(String codDtip) {
|
||||||
|
this.mTipoDoc = codDtip;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCodMgrp() {
|
||||||
|
return mGruppoArt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCodMgrp(String codMgrp) {
|
||||||
|
this.mGruppoArt = codMgrp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getAvailableCodDtips() {
|
||||||
|
return Stream.of(mTipiDocAndGruppiArtDTO.getTipiDoc()).map(TipiDocDTO::getLabel).toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getAvailableCodMgrps() {
|
||||||
|
return Stream.of(mTipiDocAndGruppiArtDTO.getGruppiArt()).map(GruppiArticoloDTO::getLabel).toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public TipiDocDTO getSelectedTipoDoc(){
|
||||||
|
if (mTipoDoc == null){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return Stream.of(mTipiDocAndGruppiArtDTO.getTipiDoc()).filter(x->x.getLabel().equals(mTipoDoc)).findFirstOrElse(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public GruppiArticoloDTO getSelectedGruppoArt(){
|
||||||
|
if (mGruppoArt == null){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Stream.of(mTipiDocAndGruppiArtDTO.getGruppiArt()).filter(x->x.getLabel().equals(mGruppoArt)).findFirstOrElse(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,117 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.contab_doc_interni.dto;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
public class ArtDTO {
|
||||||
|
|
||||||
|
private Integer rigaOrd;
|
||||||
|
|
||||||
|
private String codMart;
|
||||||
|
|
||||||
|
private String barcode;
|
||||||
|
|
||||||
|
private String descrizione;
|
||||||
|
|
||||||
|
private Date dataIns;
|
||||||
|
|
||||||
|
private String untMis;
|
||||||
|
|
||||||
|
private BigDecimal qta;
|
||||||
|
|
||||||
|
private BigDecimal qtaCnf;
|
||||||
|
|
||||||
|
private BigDecimal colli;
|
||||||
|
|
||||||
|
private String partitaMag;
|
||||||
|
|
||||||
|
private Date dataScad;
|
||||||
|
|
||||||
|
public Integer getRigaOrd() {
|
||||||
|
return rigaOrd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRigaOrd(Integer rigaOrd) {
|
||||||
|
this.rigaOrd = rigaOrd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCodMart() {
|
||||||
|
return codMart;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCodMart(String codMart) {
|
||||||
|
this.codMart = codMart;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBarcode() {
|
||||||
|
return barcode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBarcode(String barcode) {
|
||||||
|
this.barcode = barcode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescrizione() {
|
||||||
|
return descrizione;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescrizione(String descrizione) {
|
||||||
|
this.descrizione = descrizione;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDataIns() {
|
||||||
|
return dataIns;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDataIns(Date dataIns) {
|
||||||
|
this.dataIns = dataIns;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUntMis() {
|
||||||
|
return untMis;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUntMis(String untMis) {
|
||||||
|
this.untMis = untMis;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getQta() {
|
||||||
|
return qta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQta(BigDecimal qta) {
|
||||||
|
this.qta = qta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getQtaCnf() {
|
||||||
|
return qtaCnf;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQtaCnf(BigDecimal qtaCnf) {
|
||||||
|
this.qtaCnf = qtaCnf;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getColli() {
|
||||||
|
return colli;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setColli(BigDecimal colli) {
|
||||||
|
this.colli = colli;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPartitaMag() {
|
||||||
|
return partitaMag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPartitaMag(String partitaMag) {
|
||||||
|
this.partitaMag = partitaMag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDataScad() {
|
||||||
|
return dataScad;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDataScad(Date dataScad) {
|
||||||
|
this.dataScad = dataScad;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,127 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.contab_doc_interni.dto;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class ColloDTO {
|
||||||
|
|
||||||
|
private String codMdep;
|
||||||
|
private String createdDate;
|
||||||
|
private String annotazioni;
|
||||||
|
private String gestione;
|
||||||
|
private String segno;
|
||||||
|
private String idDisp;
|
||||||
|
private String codDtip;
|
||||||
|
private List<ArtDTO> artRows = new ArrayList<>();
|
||||||
|
private RifOrd rifOrd;
|
||||||
|
|
||||||
|
public String getCodMdep() {
|
||||||
|
return codMdep;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCodMdep(String codMdep) {
|
||||||
|
this.codMdep = codMdep;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCreatedDate() {
|
||||||
|
return createdDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreatedDate(String createdDate) {
|
||||||
|
this.createdDate = createdDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAnnotazioni() {
|
||||||
|
return annotazioni;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAnnotazioni(String annotazioni) {
|
||||||
|
this.annotazioni = annotazioni;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGestione() {
|
||||||
|
return gestione;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGestione(String gestione) {
|
||||||
|
this.gestione = gestione;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSegno() {
|
||||||
|
return segno;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSegno(String segno) {
|
||||||
|
this.segno = segno;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIdDisp() {
|
||||||
|
return idDisp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIdDisp(String idDisp) {
|
||||||
|
this.idDisp = idDisp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCodDtip() {
|
||||||
|
return codDtip;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCodDtip(String codDtip) {
|
||||||
|
this.codDtip = codDtip;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ArtDTO> getArtRows() {
|
||||||
|
return artRows;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setArtRows(List<ArtDTO> artRows) {
|
||||||
|
this.artRows = artRows;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addArtRow(ArtDTO artRow){
|
||||||
|
this.artRows.add(artRow);
|
||||||
|
}
|
||||||
|
|
||||||
|
public RifOrd getRifOrd() {
|
||||||
|
return rifOrd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRifOrd(RifOrd rifOrd) {
|
||||||
|
this.rifOrd = rifOrd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class RifOrd {
|
||||||
|
|
||||||
|
private Date dataOrd;
|
||||||
|
|
||||||
|
private Integer numOrd;
|
||||||
|
|
||||||
|
private String chiaveOrd;
|
||||||
|
|
||||||
|
public Date getDataOrd() {
|
||||||
|
return dataOrd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDataOrd(Date dataOrd) {
|
||||||
|
this.dataOrd = dataOrd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getNumOrd() {
|
||||||
|
return numOrd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNumOrd(Integer numOrd) {
|
||||||
|
this.numOrd = numOrd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getChiaveOrd() {
|
||||||
|
return chiaveOrd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setChiaveOrd(String chiaveOrd) {
|
||||||
|
this.chiaveOrd = chiaveOrd;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,148 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.contab_doc_interni.dto;
|
||||||
|
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class DocFromPickingDTO {
|
||||||
|
String codAnag, codVdes, tipoLista, noteDoc;
|
||||||
|
Date dataDoc;
|
||||||
|
Integer numDoc;
|
||||||
|
List<DatiCollo> colli;
|
||||||
|
List<Pedane> pedane;
|
||||||
|
|
||||||
|
public String getCodAnag() {
|
||||||
|
return codAnag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DocFromPickingDTO setCodAnag(String codAnag) {
|
||||||
|
this.codAnag = codAnag;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCodVdes() {
|
||||||
|
return codVdes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DocFromPickingDTO setCodVdes(String codVdes) {
|
||||||
|
this.codVdes = codVdes;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTipoLista() {
|
||||||
|
return tipoLista;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DocFromPickingDTO setTipoLista(String tipoLista) {
|
||||||
|
this.tipoLista = tipoLista;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNoteDoc() {
|
||||||
|
return noteDoc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DocFromPickingDTO setNoteDoc(String noteDoc) {
|
||||||
|
this.noteDoc = noteDoc;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDataDoc() {
|
||||||
|
return dataDoc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DocFromPickingDTO setDataDoc(Date dataDoc) {
|
||||||
|
this.dataDoc = dataDoc;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getNumDoc() {
|
||||||
|
return numDoc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DocFromPickingDTO setNumDoc(Integer numDoc) {
|
||||||
|
this.numDoc = numDoc;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<DatiCollo> getColli() {
|
||||||
|
return colli;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DocFromPickingDTO setColli(List<DatiCollo> colli) {
|
||||||
|
this.colli = colli;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Pedane> getPedane() {
|
||||||
|
return pedane;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPedane(List<Pedane> pedane) {
|
||||||
|
this.pedane = pedane;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Pedane {
|
||||||
|
String codTcol;
|
||||||
|
BigDecimal qta;
|
||||||
|
|
||||||
|
public String getCodTcol() {
|
||||||
|
return codTcol;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCodTcol(String codTcol) {
|
||||||
|
this.codTcol = codTcol;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getQta() {
|
||||||
|
return qta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQta(BigDecimal qta) {
|
||||||
|
this.qta = qta;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class DatiCollo {
|
||||||
|
String gestione, serCollo;
|
||||||
|
Date dataCollo;
|
||||||
|
Integer numCollo;
|
||||||
|
|
||||||
|
public String getGestione() {
|
||||||
|
return gestione;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DatiCollo setGestione(String gestione) {
|
||||||
|
this.gestione = gestione;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSerCollo() {
|
||||||
|
return serCollo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DatiCollo setSerCollo(String serCollo) {
|
||||||
|
this.serCollo = serCollo;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDataCollo() {
|
||||||
|
return dataCollo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DatiCollo setDataCollo(Date dataCollo) {
|
||||||
|
this.dataCollo = dataCollo;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getNumCollo() {
|
||||||
|
return numCollo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DatiCollo setNumCollo(Integer numCollo) {
|
||||||
|
this.numCollo = numCollo;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,97 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.contab_doc_interni.dto;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
public class GrigliaAcquistiChildDTO {
|
||||||
|
|
||||||
|
public String codMart;
|
||||||
|
public String descrizione;
|
||||||
|
public String untMis;
|
||||||
|
public BigDecimal qtaCnf;
|
||||||
|
public String barcode;
|
||||||
|
public BigDecimal merceDaRic;
|
||||||
|
public BigDecimal mediaSett;
|
||||||
|
public String flagQtaMultipla;
|
||||||
|
public BigDecimal qtaMinOrdinabile;
|
||||||
|
|
||||||
|
public String getCodMart() {
|
||||||
|
return codMart;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GrigliaAcquistiChildDTO setCodMart(String codMart) {
|
||||||
|
this.codMart = codMart;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescrizione() {
|
||||||
|
return descrizione;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GrigliaAcquistiChildDTO setDescrizione(String descrizione) {
|
||||||
|
this.descrizione = descrizione;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUntMis() {
|
||||||
|
return untMis;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GrigliaAcquistiChildDTO setUntMis(String untMis) {
|
||||||
|
this.untMis = untMis;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getQtaCnf() {
|
||||||
|
return qtaCnf;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GrigliaAcquistiChildDTO setQtaCnf(BigDecimal qtaCnf) {
|
||||||
|
this.qtaCnf = qtaCnf;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBarcode() {
|
||||||
|
return barcode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GrigliaAcquistiChildDTO setBarcode(String barcode) {
|
||||||
|
this.barcode = barcode;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getMerceDaRic() {
|
||||||
|
return merceDaRic;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GrigliaAcquistiChildDTO setMerceDaRic(BigDecimal merceDaRic) {
|
||||||
|
this.merceDaRic = merceDaRic;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getMediaSett() {
|
||||||
|
return mediaSett;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GrigliaAcquistiChildDTO setMediaSett(BigDecimal mediaSett) {
|
||||||
|
this.mediaSett = mediaSett;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFlagQtaMultipla() {
|
||||||
|
return flagQtaMultipla;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GrigliaAcquistiChildDTO setFlagQtaMultipla(String flagQtaMultipla) {
|
||||||
|
this.flagQtaMultipla = flagQtaMultipla;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getQtaMinOrdinabile() {
|
||||||
|
return qtaMinOrdinabile;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GrigliaAcquistiChildDTO setQtaMinOrdinabile(BigDecimal qtaMinOrdinabile) {
|
||||||
|
this.qtaMinOrdinabile = qtaMinOrdinabile;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.contab_doc_interni.dto;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class GrigliaAcquistiDTO {
|
||||||
|
|
||||||
|
private String descrLisa;
|
||||||
|
|
||||||
|
private String descrDepo;
|
||||||
|
|
||||||
|
private List<GrigliaAcquistiChildDTO> grigliaAcquistiChild;
|
||||||
|
|
||||||
|
public String getDescrLisa() {
|
||||||
|
return descrLisa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescrLisa(String descrLisa) {
|
||||||
|
this.descrLisa = descrLisa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescrDepo() {
|
||||||
|
return descrDepo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescrDepo(String descrDepo) {
|
||||||
|
this.descrDepo = descrDepo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<GrigliaAcquistiChildDTO> getGrigliaAcquistiChild() {
|
||||||
|
return grigliaAcquistiChild;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGrigliaAcquistiChild(List<GrigliaAcquistiChildDTO> grigliaAcquistiChild) {
|
||||||
|
this.grigliaAcquistiChild = grigliaAcquistiChild;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.contab_doc_interni.dto;
|
||||||
|
|
||||||
|
public class GruppiArticoloDTO {
|
||||||
|
|
||||||
|
private String codMgrp;
|
||||||
|
private String descrizione;
|
||||||
|
|
||||||
|
public String getCodMgrp() {
|
||||||
|
return codMgrp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCodMgrp(String codMgrp) {
|
||||||
|
this.codMgrp = codMgrp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescrizione() {
|
||||||
|
return descrizione;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescrizione(String descrizione) {
|
||||||
|
this.descrizione = descrizione;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLabel() {
|
||||||
|
return this.codMgrp+" - "+this.descrizione;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.contab_doc_interni.dto;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by GiuseppeS on 28/06/2017.
|
||||||
|
*/
|
||||||
|
public class InventarioDTO {
|
||||||
|
|
||||||
|
private List<Object> rowList;
|
||||||
|
|
||||||
|
private Date dataCreate;
|
||||||
|
|
||||||
|
|
||||||
|
public List<Object> getRowList() {
|
||||||
|
return rowList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRowList(List<Object> rowList) {
|
||||||
|
this.rowList = rowList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDataCreate() {
|
||||||
|
return dataCreate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDataCreate(Date dataCreate) {
|
||||||
|
this.dataCreate = dataCreate;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.contab_doc_interni.dto;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class OrdineDTO {
|
||||||
|
|
||||||
|
private String chiaveGriglia;
|
||||||
|
private Date dataCons;
|
||||||
|
|
||||||
|
private List<ArtDTO> artRows;
|
||||||
|
|
||||||
|
public String getChiaveGriglia() {
|
||||||
|
return chiaveGriglia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setChiaveGriglia(String chiaveGriglia) {
|
||||||
|
this.chiaveGriglia = chiaveGriglia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDataCons() {
|
||||||
|
return dataCons;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDataCons(Date dataCons) {
|
||||||
|
this.dataCons = dataCons;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ArtDTO> getArtRows() {
|
||||||
|
return artRows;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setArtRows(List<ArtDTO> artRows) {
|
||||||
|
this.artRows = artRows;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,98 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.contab_doc_interni.dto;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class PropostaOrdineDTO {
|
||||||
|
|
||||||
|
List<ArticoliDTO> articoli;
|
||||||
|
private Date dataOrd;
|
||||||
|
private String compilatoDa;
|
||||||
|
|
||||||
|
public Date getDataOrd() {
|
||||||
|
return dataOrd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PropostaOrdineDTO setDataOrd(Date dataOrd) {
|
||||||
|
this.dataOrd = dataOrd;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCompilatoDa() {
|
||||||
|
return compilatoDa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PropostaOrdineDTO setCompilatoDa(String compilatoDa) {
|
||||||
|
this.compilatoDa = compilatoDa;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ArticoliDTO> getArticoli() {
|
||||||
|
return articoli;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PropostaOrdineDTO setArticoli(List<ArticoliDTO> articoli) {
|
||||||
|
this.articoli = articoli;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class ArticoliDTO {
|
||||||
|
String codMart, untMis, codArtFor, listino;
|
||||||
|
BigDecimal qtaOrd, qtaCnf;
|
||||||
|
|
||||||
|
public String getCodMart() {
|
||||||
|
return codMart;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArticoliDTO setCodMart(String codMart) {
|
||||||
|
this.codMart = codMart;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUntMis() {
|
||||||
|
return untMis;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArticoliDTO setUntMis(String untMis) {
|
||||||
|
this.untMis = untMis;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCodArtFor() {
|
||||||
|
return codArtFor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArticoliDTO setCodArtFor(String codArtFor) {
|
||||||
|
this.codArtFor = codArtFor;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getListino() {
|
||||||
|
return listino;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArticoliDTO setListino(String listino) {
|
||||||
|
this.listino = listino;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getQtaOrd() {
|
||||||
|
return qtaOrd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArticoliDTO setQtaOrd(BigDecimal qtaOrd) {
|
||||||
|
this.qtaOrd = qtaOrd;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getQtaCnf() {
|
||||||
|
return qtaCnf;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArticoliDTO setQtaCnf(BigDecimal qtaCnf) {
|
||||||
|
this.qtaCnf = qtaCnf;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,115 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.contab_doc_interni.dto;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
public class SaveDTO {
|
||||||
|
private String gestione;
|
||||||
|
private String codMdep;
|
||||||
|
private String idDisp;
|
||||||
|
private String zona;
|
||||||
|
private String segno;
|
||||||
|
private Date listCreate;
|
||||||
|
private String annotazioni;
|
||||||
|
private String codDtip;
|
||||||
|
private Integer idInventario;
|
||||||
|
|
||||||
|
private OrdineDTO ordineDTO;
|
||||||
|
private ColloDTO colloDTO;
|
||||||
|
private InventarioDTO inventarioDTO;
|
||||||
|
|
||||||
|
public String getGestione() {
|
||||||
|
return gestione;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGestione(String gestione) {
|
||||||
|
this.gestione = gestione;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCodMdep() {
|
||||||
|
return codMdep;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCodMdep(String codMdep) {
|
||||||
|
this.codMdep = codMdep;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIdDisp() {
|
||||||
|
return idDisp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIdDisp(String idDisp) {
|
||||||
|
this.idDisp = idDisp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getZona() {
|
||||||
|
return zona;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setZona(String zona) {
|
||||||
|
this.zona = zona;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSegno() {
|
||||||
|
return segno;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSegno(String segno) {
|
||||||
|
this.segno = segno;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getListCreate() {
|
||||||
|
return listCreate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setListCreate(Date listCreate) {
|
||||||
|
this.listCreate = listCreate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAnnotazioni() {
|
||||||
|
return annotazioni;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAnnotazioni(String annotazioni) {
|
||||||
|
this.annotazioni = annotazioni;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCodDtip() {
|
||||||
|
return codDtip;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCodDtip(String codDtip) {
|
||||||
|
this.codDtip = codDtip;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getIdInventario() {
|
||||||
|
return idInventario;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIdInventario(Integer idInventario) {
|
||||||
|
this.idInventario = idInventario;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrdineDTO getOrdineDTO() {
|
||||||
|
return ordineDTO;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOrdineDTO(OrdineDTO ordineDTO) {
|
||||||
|
this.ordineDTO = ordineDTO;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ColloDTO getColloDTO() {
|
||||||
|
return colloDTO;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setColloDTO(ColloDTO colloDTO) {
|
||||||
|
this.colloDTO = colloDTO;
|
||||||
|
}
|
||||||
|
|
||||||
|
public InventarioDTO getInventarioDTO() {
|
||||||
|
return inventarioDTO;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInventarioDTO(InventarioDTO inventarioDTO) {
|
||||||
|
this.inventarioDTO = inventarioDTO;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.contab_doc_interni.dto;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class TipiDocAndGruppiArtDTO {
|
||||||
|
|
||||||
|
|
||||||
|
private List<TipiDocDTO> tipiDoc;
|
||||||
|
|
||||||
|
|
||||||
|
private List<GruppiArticoloDTO> gruppiArt;
|
||||||
|
|
||||||
|
|
||||||
|
public List<TipiDocDTO> getTipiDoc() {
|
||||||
|
return tipiDoc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTipiDoc(List<TipiDocDTO> tipiDoc) {
|
||||||
|
this.tipiDoc = tipiDoc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<GruppiArticoloDTO> getGruppiArt() {
|
||||||
|
return gruppiArt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGruppiArt(List<GruppiArticoloDTO> gruppiArt) {
|
||||||
|
this.gruppiArt = gruppiArt;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.contab_doc_interni.dto;
|
||||||
|
|
||||||
|
public class TipiDocDTO {
|
||||||
|
|
||||||
|
private String codDtip;
|
||||||
|
private String descrizione;
|
||||||
|
|
||||||
|
public String getCodDtip() {
|
||||||
|
return codDtip;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCodDtip(String codDtip) {
|
||||||
|
this.codDtip = codDtip;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescrizione() {
|
||||||
|
return descrizione;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescrizione(String descrizione) {
|
||||||
|
this.descrizione = descrizione;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLabel(){
|
||||||
|
return this.codDtip +" - "+this.descrizione;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,295 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.contab_doc_interni.edit_form;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.text.Html;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.databinding.DataBindingUtil;
|
||||||
|
import androidx.databinding.ObservableArrayList;
|
||||||
|
import androidx.recyclerview.widget.DiffUtil;
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
|
||||||
|
import com.annimon.stream.Stream;
|
||||||
|
import com.ravikoradiya.liveadapter.LiveAdapter;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
||||||
|
import it.integry.integrywmsnative.BR;
|
||||||
|
import it.integry.integrywmsnative.MainApplication;
|
||||||
|
import it.integry.integrywmsnative.R;
|
||||||
|
import it.integry.integrywmsnative.core.barcode_reader.BarcodeCallbackDTO;
|
||||||
|
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
||||||
|
import it.integry.integrywmsnative.core.data_cache.DataCache;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.entity.ArticoloOrdine;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColr;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColt;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.repository.MtbColrRepository;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.repository.MtbColtRepository;
|
||||||
|
import it.integry.integrywmsnative.core.di.BindableBoolean;
|
||||||
|
import it.integry.integrywmsnative.core.di.BindableInteger;
|
||||||
|
import it.integry.integrywmsnative.core.di.BindableString;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.BaseActivity;
|
||||||
|
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||||
|
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||||
|
import it.integry.integrywmsnative.core.model.MtbPartitaMag;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||||
|
import it.integry.integrywmsnative.databinding.ActivityContabDocInterniEditBinding;
|
||||||
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.GrigliaAcquistiChildDTO;
|
||||||
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.GrigliaAcquistiDTO;
|
||||||
|
import it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.ui.DocumentRowsListAdapter;
|
||||||
|
import it.integry.integrywmsnative.gest.contab_doc_interni.ui.DocInterniListAdapter;
|
||||||
|
import it.integry.integrywmsnative.gest.contab_doc_interni.ui.DocInterniListModel;
|
||||||
|
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.FilterDepositoLayoutView;
|
||||||
|
import it.integry.integrywmsnative.gest.spedizione.model.PickedQuantityDTO;
|
||||||
|
import it.integry.integrywmsnative.ui.FabMenuCustomAnimations;
|
||||||
|
import it.integry.integrywmsnative.view.bottom_sheet__mtb_colr_edit.BottomSheetMtbColrEditView;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.DialogCommon;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleInputHelper;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2DTO;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2View;
|
||||||
|
|
||||||
|
public class DocInterniEditFormActivity extends BaseActivity implements DocInterniEditFormViewModel.Listener, BottomSheetMtbColrEditView.Listener {
|
||||||
|
|
||||||
|
private static String DATA_KEY_DOCUMENT = "document";
|
||||||
|
private static String DATA_KEY_PRODUCTS_LIST = "productsList";
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
MtbColrRepository documentRowsRepository;
|
||||||
|
@Inject
|
||||||
|
DocInterniEditFormViewModel viewModel;
|
||||||
|
|
||||||
|
|
||||||
|
private int mBarcodeScannerIstanceID;
|
||||||
|
private ActivityContabDocInterniEditBinding binding;
|
||||||
|
public BindableString documentHeader = new BindableString(true);
|
||||||
|
public BindableString codDtip = new BindableString();
|
||||||
|
public BindableString note = new BindableString();
|
||||||
|
public BindableString codMgrp = new BindableString();
|
||||||
|
public BindableInteger prodsCount = new BindableInteger(0);
|
||||||
|
public BindableBoolean isDocumentExportable = new BindableBoolean(false);
|
||||||
|
private final ObservableArrayList<SqlMtbColr> documentRowsObservableList = new ObservableArrayList<>();
|
||||||
|
|
||||||
|
public static Intent newInstance(Context context, SqlMtbColt document, GrigliaAcquistiDTO productList) {
|
||||||
|
Intent myIntent = new Intent(context, DocInterniEditFormActivity.class);
|
||||||
|
|
||||||
|
String doc = DataCache.addItem(document);
|
||||||
|
String productsKey = DataCache.addItem(productList);
|
||||||
|
myIntent.putExtra(DATA_KEY_DOCUMENT, doc);
|
||||||
|
myIntent.putExtra(DATA_KEY_PRODUCTS_LIST, productsKey);
|
||||||
|
return myIntent;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
binding = DataBindingUtil.setContentView(this, R.layout.activity_contab_doc_interni_edit);
|
||||||
|
MainApplication.appComponent
|
||||||
|
.docInterniEditFormComponent()
|
||||||
|
.create()
|
||||||
|
.inject(this);
|
||||||
|
SqlMtbColt document = DataCache.retrieveItem(getIntent().getStringExtra(DATA_KEY_DOCUMENT));
|
||||||
|
GrigliaAcquistiDTO griglia = DataCache.retrieveItem(getIntent().getStringExtra(DATA_KEY_PRODUCTS_LIST));
|
||||||
|
List<GrigliaAcquistiChildDTO> productList = griglia.getGrigliaAcquistiChild();
|
||||||
|
this.initViewModel(document, productList);
|
||||||
|
this.initView();
|
||||||
|
this.initBindables();
|
||||||
|
this.initRecyclerView();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initBindables() {
|
||||||
|
SqlMtbColt document = this.viewModel.getDocument();
|
||||||
|
this.codDtip.set(document.getCodDtipProvv());
|
||||||
|
this.note.set(document.getAnnotazioni());
|
||||||
|
this.codMgrp.set(document.getCodMgrp());
|
||||||
|
this.documentHeader.set(String.format(this.getString(R.string.doc_interni_doc_header), document.getId(), document.getCodDtipProvv()));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initView() {
|
||||||
|
binding.setViewModel(this.viewModel);
|
||||||
|
binding.setView(this);
|
||||||
|
setSupportActionBar(binding.toolbar);
|
||||||
|
binding.toolbar.setTitle(R.string.edit_doc);
|
||||||
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
FabMenuCustomAnimations.changeIconOnFocus(binding.closeActivityFab, R.drawable.ic_check_white_24dp, R.drawable.ic_close_24dp);
|
||||||
|
binding.bottomSheetMtbColrEdit.setListener(this);
|
||||||
|
binding.bottomSheetMtbColrEdit.init(binding.bottomSheetMtbColrEdit, binding.bottomSheetMtbColrEditBackground);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initViewModel(SqlMtbColt document, List<GrigliaAcquistiChildDTO> productList) {
|
||||||
|
this.viewModel.setListeners(this);
|
||||||
|
this.viewModel.setDocument(document);
|
||||||
|
this.viewModel.setProductsList(productList);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initRecyclerView() {
|
||||||
|
this.viewModel.docRows.observe(this, this::refreshList);
|
||||||
|
DocumentRowsListAdapter listAdapter = new DocumentRowsListAdapter(this, documentRowsObservableList);
|
||||||
|
listAdapter.setEmptyView(binding.scanArtSpinner);
|
||||||
|
binding.documentRowsList.setAdapter(listAdapter);
|
||||||
|
binding.documentRowsList.setLayoutManager(new LinearLayoutManager(this));
|
||||||
|
listAdapter.setOnItemClicked(row -> {
|
||||||
|
binding.bottomSheetMtbColrEdit.setMtbColr(sqlToEntity(row));
|
||||||
|
binding.bottomSheetMtbColrEdit.expand();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshList(List<SqlMtbColr> sqlMtbColrs) {
|
||||||
|
this.documentRowsObservableList.clear();
|
||||||
|
this.documentRowsObservableList.addAll(this.viewModel.docRows.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void editNote() {
|
||||||
|
BarcodeManager.disable();
|
||||||
|
DialogSimpleInputHelper.makeInputDialog(this, "Inserisci il codice a barre/codice articolo da cercare", note -> {
|
||||||
|
this.note.set(note);
|
||||||
|
this.viewModel.setNote(note);
|
||||||
|
BarcodeManager.enable();
|
||||||
|
}, BarcodeManager::enable).show();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void closeEdit() {
|
||||||
|
this.onBackPressed();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void manualSearch() {
|
||||||
|
BarcodeManager.disable();
|
||||||
|
DialogSimpleInputHelper.makeInputDialog(this, "Aggiungi delle annotazioni al documento", this.note.get(), this.viewModel::onSearch, BarcodeManager::enable).show();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onStart() {
|
||||||
|
super.onStart();
|
||||||
|
SqlMtbColt document = this.viewModel.getDocument();
|
||||||
|
if (document == null) {
|
||||||
|
Toast.makeText(this, "Nesusn documento selezionato!", Toast.LENGTH_SHORT).show();
|
||||||
|
closeEdit();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (document.getCodDtip() != null) {
|
||||||
|
Toast.makeText(this, "Impossibile modificare un documento esportato", Toast.LENGTH_SHORT).show();
|
||||||
|
closeEdit();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
mBarcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
||||||
|
.setOnScanSuccessfull(this.viewModel::onScanSuccessful)
|
||||||
|
.setOnScanFailed(this::onError));
|
||||||
|
this.viewModel.fetchDocumentRows();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
BarcodeManager.removeCallback(mBarcodeScannerIstanceID);
|
||||||
|
super.onDestroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onSupportNavigateUp() {
|
||||||
|
onBackPressed();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRowsChanged(List<SqlMtbColr> rows) {
|
||||||
|
this.prodsCount.set(rows.size());
|
||||||
|
this.isDocumentExportable.set(rows.size() > 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEditRowRequest(SqlMtbColr row) {
|
||||||
|
MtbAart mtbAart = new MtbAart();
|
||||||
|
mtbAart.setBarCode(row.getCodBarre());
|
||||||
|
mtbAart.setDiacod(row.getCodBarre());
|
||||||
|
mtbAart.setCodMart(row.getCodMart());
|
||||||
|
mtbAart.setFlagQtaCnfFissa("S");
|
||||||
|
mtbAart.setQtaCnf(BigDecimal.valueOf(row.getQtaCnf()));
|
||||||
|
mtbAart.setDescrizione(row.getDescrizione());
|
||||||
|
mtbAart.setDescrizioneEstesa(row.getDescrizione());
|
||||||
|
mtbAart.setUntMis(row.getUntMis());
|
||||||
|
|
||||||
|
DialogInputQuantityV2DTO dialogInputQuantityV2DTO = new DialogInputQuantityV2DTO()
|
||||||
|
.setMtbAart(mtbAart)
|
||||||
|
.setInitialNumCnf(BigDecimal.valueOf(row.getNumCnf()))
|
||||||
|
.setInitialQtaCnf(BigDecimal.valueOf(row.getQtaCnf()))
|
||||||
|
.setInitialQtaTot(BigDecimal.valueOf(row.getQtaCol()))
|
||||||
|
.setDataScad(row.getDataScad())
|
||||||
|
.setCanOverflowOrderQuantity(false)
|
||||||
|
.setCanLUBeClosed(false)
|
||||||
|
.setCanPartitaMagBeChanged(false);
|
||||||
|
|
||||||
|
DialogInputQuantityV2View
|
||||||
|
.newInstance(dialogInputQuantityV2DTO, (resultDTO, shouldCloseLU) -> {
|
||||||
|
this.onLoadingStarted();
|
||||||
|
this.viewModel.saveRow(row, resultDTO);
|
||||||
|
}, this::onLoadingEnded)
|
||||||
|
.show(getSupportFragmentManager(), "tag");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDocumentHoldRequest() {
|
||||||
|
this.closeEdit();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDocExported() {
|
||||||
|
runOnUiThread(() -> {
|
||||||
|
DialogCommon.showDataSaved(this, this::closeEdit);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBackPressed() {
|
||||||
|
BarcodeManager.removeCallback(mBarcodeScannerIstanceID);
|
||||||
|
super.onBackPressed();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onMtbColrEdit(MtbColr mtbColr) {
|
||||||
|
this.viewModel.editRow(entityToSql(mtbColr));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onMtbColrDelete(MtbColr mtbColr) {
|
||||||
|
this.viewModel.deleteRow(entityToSql(mtbColr));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private MtbColr sqlToEntity(SqlMtbColr sqlMtbColr) {
|
||||||
|
MtbColr entity = new MtbColr();
|
||||||
|
|
||||||
|
entity
|
||||||
|
.setCodMart(sqlMtbColr.getCodMart())
|
||||||
|
.setSerCollo(sqlMtbColr.getSerCollo())
|
||||||
|
.setGestione(sqlMtbColr.getGestione())
|
||||||
|
.setNumCollo(sqlMtbColr.getNumCollo())
|
||||||
|
.setDataCollo(UtilityDate.formatDate(sqlMtbColr.getDataCollo(), UtilityDate.COMMONS_DATE_FORMATS.DMY_TIME_SLASH))
|
||||||
|
.setRiga(sqlMtbColr.getRiga())
|
||||||
|
.setDescrizione(sqlMtbColr.getDescrizione())
|
||||||
|
.setUntMis(sqlMtbColr.getUntMis())
|
||||||
|
.setCodBarre(sqlMtbColr.getCodBarre())
|
||||||
|
.setQtaCnf(BigDecimal.valueOf(sqlMtbColr.getQtaCnf()))
|
||||||
|
.setNumCnf(BigDecimal.valueOf(sqlMtbColr.getNumCnf()))
|
||||||
|
.setMtbPartitaMag(new MtbPartitaMag().setDataScad(sqlMtbColr.getDataScad()))
|
||||||
|
.setQtaCol(BigDecimal.valueOf(sqlMtbColr.getQtaCol()));
|
||||||
|
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
|
||||||
|
private SqlMtbColr entityToSql(MtbColr mtbColr) {
|
||||||
|
|
||||||
|
return Stream.of(this.viewModel.getDocumentRows())
|
||||||
|
.filter(row -> row.getRiga().equals(mtbColr.getRiga()))
|
||||||
|
.findFirstOrElse(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.contab_doc_interni.edit_form;
|
||||||
|
|
||||||
|
import dagger.Subcomponent;
|
||||||
|
|
||||||
|
@Subcomponent
|
||||||
|
public interface DocInterniEditFormComponent {
|
||||||
|
|
||||||
|
@Subcomponent.Factory
|
||||||
|
interface Factory {
|
||||||
|
|
||||||
|
DocInterniEditFormComponent create();
|
||||||
|
}
|
||||||
|
|
||||||
|
void inject(DocInterniEditFormActivity docInterniEditFormActivity);
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.contab_doc_interni.edit_form;
|
||||||
|
|
||||||
|
import dagger.Module;
|
||||||
|
import dagger.Provides;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.repository.MtbColrRepository;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.repository.MtbColtRepository;
|
||||||
|
import it.integry.integrywmsnative.gest.contab_doc_interni.DocInterniComponent;
|
||||||
|
import it.integry.integrywmsnative.gest.contab_doc_interni.DocInterniViewModel;
|
||||||
|
import it.integry.integrywmsnative.gest.contab_doc_interni.rest.DocInterniRESTConsumer;
|
||||||
|
|
||||||
|
@Module(subcomponents = DocInterniEditFormComponent.class)
|
||||||
|
public class DocInterniEditFormModule {
|
||||||
|
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
DocInterniEditFormViewModel docInterniEditFormViewModel(DocInterniRESTConsumer docInterniRESTConsumer, MtbColrRepository mtbColrRepository, MtbColtRepository mtbColtRepository) {
|
||||||
|
return new DocInterniEditFormViewModel(docInterniRESTConsumer,mtbColrRepository, mtbColtRepository);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,250 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.contab_doc_interni.edit_form;
|
||||||
|
|
||||||
|
import androidx.lifecycle.MutableLiveData;
|
||||||
|
|
||||||
|
import com.annimon.stream.Stream;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColr;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColt;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.repository.MtbColrRepository;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.repository.MtbColtRepository;
|
||||||
|
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||||
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.ArtDTO;
|
||||||
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.ColloDTO;
|
||||||
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.GrigliaAcquistiChildDTO;
|
||||||
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.SaveDTO;
|
||||||
|
import it.integry.integrywmsnative.gest.contab_doc_interni.rest.DocInterniRESTConsumer;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2ResultDTO;
|
||||||
|
|
||||||
|
public class DocInterniEditFormViewModel {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
MtbColrRepository mtbColrRepository;
|
||||||
|
@Inject
|
||||||
|
MtbColtRepository mtbColtRepository;
|
||||||
|
private final DocInterniRESTConsumer docInterniRESTConsumer;
|
||||||
|
private DocInterniEditFormViewModel.Listener listener;
|
||||||
|
private List<GrigliaAcquistiChildDTO> productsList;
|
||||||
|
|
||||||
|
public MutableLiveData<SqlMtbColt> document = new MutableLiveData<>();
|
||||||
|
public MutableLiveData<List<SqlMtbColr>> docRows = new MutableLiveData<>();
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public DocInterniEditFormViewModel(DocInterniRESTConsumer docInterniRESTConsumer, MtbColrRepository mtbColrRepository, MtbColtRepository mtbColtRepository) {
|
||||||
|
this.docInterniRESTConsumer = docInterniRESTConsumer;
|
||||||
|
this.mtbColrRepository = mtbColrRepository;
|
||||||
|
this.mtbColtRepository = mtbColtRepository;
|
||||||
|
this.docRows.setValue(new ArrayList<>());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sendOnLoadingStarted() {
|
||||||
|
if (this.listener != null) listener.onLoadingStarted();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sendOnLoadingEnded() {
|
||||||
|
if (this.listener != null) listener.onLoadingEnded();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sendError(Exception ex) {
|
||||||
|
if (this.listener != null) listener.onError(ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void fetchDocumentRows() {
|
||||||
|
this.sendOnLoadingStarted();
|
||||||
|
mtbColrRepository.getDocumentRows(this.document.getValue(), rows -> {
|
||||||
|
this.docRows.postValue(rows);
|
||||||
|
this.listener.onRowsChanged(rows);
|
||||||
|
this.sendOnLoadingEnded();
|
||||||
|
}, this::sendError);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void editRow(SqlMtbColr row) {
|
||||||
|
this.listener.onEditRowRequest(row);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Integer getNextIdRiga() {
|
||||||
|
List<SqlMtbColr> rows = this.docRows.getValue();
|
||||||
|
if (rows == null || rows.size() <= 0) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return Stream.of(rows).mapToInt(SqlMtbColr::getRiga).max().getAsInt() + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void exportDocument() {
|
||||||
|
this.sendOnLoadingStarted();
|
||||||
|
docInterniRESTConsumer.saveDoc(this.getSaveDto(), obj -> {
|
||||||
|
SqlMtbColt document = this.getDocument();
|
||||||
|
document.setCodDtip(document.getCodDtipProvv());
|
||||||
|
mtbColtRepository.update(document, doc -> {
|
||||||
|
this.sendOnLoadingEnded();
|
||||||
|
this.listener.onDocExported();
|
||||||
|
}, this::sendError);
|
||||||
|
}, this::sendError);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void holdDocument() {
|
||||||
|
this.listener.onDocumentHoldRequest();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onSearch(String search) {
|
||||||
|
this.sendOnLoadingStarted();
|
||||||
|
GrigliaAcquistiChildDTO articolo = this.searchArticolo(search);
|
||||||
|
if (articolo == null) {
|
||||||
|
this.sendError(new Exception("Nessun articolo corrispondente al codice fornito!"));
|
||||||
|
this.sendOnLoadingEnded();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
SqlMtbColr row = this.getRowForArticolo(articolo);
|
||||||
|
this.editRow(row);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private SqlMtbColr getRowForArticolo(GrigliaAcquistiChildDTO articolo) {
|
||||||
|
List<SqlMtbColr> docRows = this.docRows.getValue();
|
||||||
|
if (docRows == null) {
|
||||||
|
docRows = new ArrayList<>();
|
||||||
|
}
|
||||||
|
SqlMtbColt document = this.document.getValue();
|
||||||
|
SqlMtbColr row = Stream.of(docRows).filter(docRow -> docRow.getCodMart().equalsIgnoreCase(articolo.getCodMart())).findFirstOrElse(null);
|
||||||
|
if (row == null) {
|
||||||
|
row = new SqlMtbColr();
|
||||||
|
row.setIdCollo(document.getId());
|
||||||
|
row.setRiga(getNextIdRiga());
|
||||||
|
row.setCodMart(articolo.getCodMart());
|
||||||
|
row.setSerCollo(document.getSerCollo());
|
||||||
|
row.setGestione(document.getGestione());
|
||||||
|
row.setNumCollo(document.getNumCollo());
|
||||||
|
row.setDataCollo(document.getDataCollo());
|
||||||
|
row.setDescrizione(articolo.getDescrizione());
|
||||||
|
row.setUntMis(articolo.getUntMis());
|
||||||
|
row.setCodBarre(articolo.getBarcode());
|
||||||
|
row.setQtaCnf(articolo.getQtaCnf().floatValue());
|
||||||
|
row.setNumCnf(0f);
|
||||||
|
row.setQtaCol(0f);
|
||||||
|
}
|
||||||
|
return row;
|
||||||
|
}
|
||||||
|
|
||||||
|
private GrigliaAcquistiChildDTO searchArticolo(String filter) {
|
||||||
|
return Stream.of(this.productsList).filter(dto -> dto.getCodMart().equalsIgnoreCase(filter) || dto.getBarcode().equalsIgnoreCase(filter)).findFirstOrElse(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
private SaveDTO getSaveDto() {
|
||||||
|
SqlMtbColt document = this.getDocument();
|
||||||
|
SaveDTO saveDTO = new SaveDTO();
|
||||||
|
saveDTO.setIdDisp("1");
|
||||||
|
saveDTO.setGestione(document.getGestione());
|
||||||
|
saveDTO.setCodMdep(document.getCodMdep());
|
||||||
|
saveDTO.setCodDtip(document.getCodDtipProvv());
|
||||||
|
saveDTO.setAnnotazioni(document.getAnnotazioni());
|
||||||
|
saveDTO.setSegno(document.getSegno().toString());
|
||||||
|
|
||||||
|
ColloDTO collo = new ColloDTO();
|
||||||
|
collo.setIdDisp("1");
|
||||||
|
collo.setGestione(document.getGestione());
|
||||||
|
collo.setCodMdep(document.getCodMdep());
|
||||||
|
collo.setCodDtip(document.getCodDtipProvv());
|
||||||
|
collo.setCreatedDate(UtilityDate.formatDate(document.getDataCollo(), UtilityDate.COMMONS_DATE_FORMATS.DMY_TIME_SLASH));
|
||||||
|
collo.setAnnotazioni(document.getAnnotazioni());
|
||||||
|
collo.setSegno(saveDTO.getSegno());
|
||||||
|
|
||||||
|
for (SqlMtbColr row : this.getDocumentRows()) {
|
||||||
|
ArtDTO artDto = new ArtDTO();
|
||||||
|
artDto.setBarcode(row.getCodBarre());
|
||||||
|
artDto.setQta(BigDecimal.valueOf(row.getQtaCol()));
|
||||||
|
artDto.setDataIns(row.getDataCollo());
|
||||||
|
artDto.setColli(BigDecimal.valueOf(row.getNumCnf()));
|
||||||
|
artDto.setUntMis(row.getUntMis());
|
||||||
|
artDto.setCodMart(row.getCodMart());
|
||||||
|
if (row.getDataScad() != null) {
|
||||||
|
artDto.setDataScad(row.getDataScad());
|
||||||
|
}
|
||||||
|
artDto.setDescrizione(row.getDescrizione());
|
||||||
|
collo.addArtRow(artDto);
|
||||||
|
}
|
||||||
|
saveDTO.setColloDTO(collo);
|
||||||
|
|
||||||
|
return saveDTO;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DocInterniEditFormViewModel setListeners(Listener listener) {
|
||||||
|
this.listener = listener;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDocument(SqlMtbColt document) {
|
||||||
|
this.document.setValue(document);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SqlMtbColt getDocument() {
|
||||||
|
return document.getValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<GrigliaAcquistiChildDTO> getProductsList() {
|
||||||
|
return productsList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProductsList(List<GrigliaAcquistiChildDTO> productsList) {
|
||||||
|
this.productsList = productsList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onScanSuccessful(BarcodeScanDTO dto) {
|
||||||
|
String code = dto.getStringValue();
|
||||||
|
this.onSearch(code);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void saveRow(SqlMtbColr row, DialogInputQuantityV2ResultDTO resultDTO) {
|
||||||
|
row.setQtaCnf(resultDTO.getQtaCnf().floatValue());
|
||||||
|
row.setNumCnf(resultDTO.getNumCnf().floatValue());
|
||||||
|
row.setQtaCol(resultDTO.getQtaTot().floatValue());
|
||||||
|
row.setDataScad(resultDTO.getDataScad());
|
||||||
|
if (row.getId() > 0) {
|
||||||
|
this.mtbColrRepository.update(row, id -> {
|
||||||
|
this.fetchDocumentRows();
|
||||||
|
}, this::sendError);
|
||||||
|
} else {
|
||||||
|
this.mtbColrRepository.insert(row, id -> {
|
||||||
|
this.fetchDocumentRows();
|
||||||
|
}, this::sendError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteRow(SqlMtbColr sqlMtbColr) {
|
||||||
|
mtbColrRepository.delete(sqlMtbColr, this::fetchDocumentRows, this::sendError);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNote(String note) {
|
||||||
|
SqlMtbColt document = this.document.getValue();
|
||||||
|
document.setAnnotazioni(note);
|
||||||
|
mtbColtRepository.update(document, doc -> this.document.postValue(doc), this::sendError);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<SqlMtbColr> getDocumentRows() {
|
||||||
|
return this.docRows.getValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface Listener extends ILoadingListener {
|
||||||
|
|
||||||
|
void onError(Exception ex);
|
||||||
|
|
||||||
|
void onRowsChanged(List<SqlMtbColr> rows);
|
||||||
|
|
||||||
|
void onEditRowRequest(SqlMtbColr row);
|
||||||
|
|
||||||
|
void onDocumentHoldRequest();
|
||||||
|
|
||||||
|
void onDocExported();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.ui;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.text.Html;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.databinding.DataBindingUtil;
|
||||||
|
import androidx.databinding.ObservableArrayList;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.R;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColr;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColt;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.view.ExtendedRecyclerView;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||||
|
import it.integry.integrywmsnative.databinding.ActivityContabDocInternoRowListSingleItemBinding;
|
||||||
|
import it.integry.integrywmsnative.databinding.DocInterniListModelBinding;
|
||||||
|
|
||||||
|
public class DocumentRowsListAdapter extends ExtendedRecyclerView<SqlMtbColr, DocumentRowsListAdapter.SingleItemViewHolder> {
|
||||||
|
|
||||||
|
private Context mContext;
|
||||||
|
|
||||||
|
private RunnableArgs<SqlMtbColr> mOnItemClicked;
|
||||||
|
|
||||||
|
public DocumentRowsListAdapter(Context context, ObservableArrayList<SqlMtbColr> myDataset) {
|
||||||
|
super(myDataset);
|
||||||
|
this.mContext = context;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public SingleItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
|
ActivityContabDocInternoRowListSingleItemBinding binding = DataBindingUtil.inflate(LayoutInflater.from(parent.getContext()), R.layout.activity_contab_doc_interno_row__list_single_item, parent, false);
|
||||||
|
return new SingleItemViewHolder(binding);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull SingleItemViewHolder holder, int position) {
|
||||||
|
final SqlMtbColr row = mDataset.get(position);
|
||||||
|
holder.binding.setItem(row);
|
||||||
|
holder.binding.executePendingBindings();
|
||||||
|
holder.binding.getRoot().setOnClickListener(v -> {
|
||||||
|
if (this.mOnItemClicked != null)
|
||||||
|
this.mOnItemClicked.run(row);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setOnItemClicked(RunnableArgs<SqlMtbColr> onItemClicked){
|
||||||
|
this.mOnItemClicked = onItemClicked;
|
||||||
|
}
|
||||||
|
static class SingleItemViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
|
||||||
|
ActivityContabDocInternoRowListSingleItemBinding binding;
|
||||||
|
|
||||||
|
SingleItemViewHolder(ActivityContabDocInternoRowListSingleItemBinding binding) {
|
||||||
|
super(binding.getRoot());
|
||||||
|
this.binding = binding;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.contab_doc_interni.rest;
|
||||||
|
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
|
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||||
|
import it.integry.integrywmsnative.core.rest.consumers._BaseRESTConsumer;
|
||||||
|
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||||
|
import it.integry.integrywmsnative.gest.accettazione.dto.SitArtOrdDTO;
|
||||||
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.GrigliaAcquistiDTO;
|
||||||
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.SaveDTO;
|
||||||
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.TipiDocAndGruppiArtDTO;
|
||||||
|
import retrofit2.Call;
|
||||||
|
import retrofit2.Callback;
|
||||||
|
import retrofit2.Response;
|
||||||
|
|
||||||
|
@Singleton
|
||||||
|
public class DocInterniRESTConsumer extends _BaseRESTConsumer {
|
||||||
|
|
||||||
|
public void getDocTypesAndGroupArts(RunnableArgs<TipiDocAndGruppiArtDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
|
DocInterniRESTConsumerService service = RESTBuilder.getService(DocInterniRESTConsumerService.class);
|
||||||
|
service.getDocTypesAndGroupArts().enqueue(new Callback<>() {
|
||||||
|
@Override
|
||||||
|
public void onResponse(Call<ServiceRESTResponse<TipiDocAndGruppiArtDTO>> call, Response<ServiceRESTResponse<TipiDocAndGruppiArtDTO>> response) {
|
||||||
|
analyzeAnswer(response, "getDocTypesAndGroupArts", onComplete, onFailed);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Call<ServiceRESTResponse<TipiDocAndGruppiArtDTO>> call, Throwable t) {
|
||||||
|
onFailed.run(new Exception(t));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void fetchProducts(String codDtip, String codMgrp, RunnableArgs<GrigliaAcquistiDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
|
DocInterniRESTConsumerService service = RESTBuilder.getService(DocInterniRESTConsumerService.class);
|
||||||
|
service.fetchProducts(codDtip,codMgrp,"L").enqueue(new Callback<>() {
|
||||||
|
@Override
|
||||||
|
public void onResponse(Call<ServiceRESTResponse<GrigliaAcquistiDTO>> call, Response<ServiceRESTResponse<GrigliaAcquistiDTO>> response) {
|
||||||
|
analyzeAnswer(response, "fetchProducts", onComplete, onFailed);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Call<ServiceRESTResponse<GrigliaAcquistiDTO>> call, Throwable t) {
|
||||||
|
onFailed.run(new Exception(t));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void saveDoc(SaveDTO saveDTO, RunnableArgs<JsonObject> onComplete, RunnableArgs<Exception> onFailed){
|
||||||
|
DocInterniRESTConsumerService service = RESTBuilder.getService(DocInterniRESTConsumerService.class);
|
||||||
|
service.save(saveDTO).enqueue(new Callback<>() {
|
||||||
|
@Override
|
||||||
|
public void onResponse(Call<ServiceRESTResponse<JsonObject>> call, Response<ServiceRESTResponse<JsonObject>> response) {
|
||||||
|
analyzeAnswer(response, "saveDoc", onComplete, onFailed);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Call<ServiceRESTResponse<JsonObject>> call, Throwable t) {
|
||||||
|
onFailed.run(new Exception(t));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.contab_doc_interni.rest;
|
||||||
|
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||||
|
import it.integry.integrywmsnative.gest.accettazione.dto.GetPickingListAccettazioneDTO;
|
||||||
|
import it.integry.integrywmsnative.gest.accettazione.dto.OrdineAccettazioneInevasoDTO;
|
||||||
|
import it.integry.integrywmsnative.gest.accettazione.dto.SitArtOrdDTO;
|
||||||
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.GrigliaAcquistiDTO;
|
||||||
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.SaveDTO;
|
||||||
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.TipiDocAndGruppiArtDTO;
|
||||||
|
import retrofit2.Call;
|
||||||
|
import retrofit2.http.Body;
|
||||||
|
import retrofit2.http.GET;
|
||||||
|
import retrofit2.http.POST;
|
||||||
|
import retrofit2.http.Query;
|
||||||
|
|
||||||
|
|
||||||
|
public interface DocInterniRESTConsumerService {
|
||||||
|
|
||||||
|
@GET("getDocTypesAndArtsGroups")
|
||||||
|
Call<ServiceRESTResponse<TipiDocAndGruppiArtDTO>> getDocTypesAndGroupArts();
|
||||||
|
|
||||||
|
@POST("SM2SaveTerminalinoWMS")
|
||||||
|
Call<ServiceRESTResponse<JsonObject>> save(@Body SaveDTO saveDTO);
|
||||||
|
|
||||||
|
@GET("getElencoArticoli")
|
||||||
|
Call<ServiceRESTResponse<GrigliaAcquistiDTO>> fetchProducts(@Query("codDtip") String codDtip, @Query("codMgrp") String codMgrp, @Query("gestione") String gestione);
|
||||||
|
}
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.contab_doc_interni.ui;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.text.Html;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.databinding.DataBindingUtil;
|
||||||
|
import androidx.databinding.ObservableArrayList;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.R;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColt;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.wrappers.DocInternoWrapper;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.view.ExtendedRecyclerView;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||||
|
import it.integry.integrywmsnative.databinding.DocInterniListModelBinding;
|
||||||
|
|
||||||
|
public class DocInterniListAdapter extends ExtendedRecyclerView<DocInterniListModel, DocInterniListAdapter.SingleItemViewHolder> {
|
||||||
|
|
||||||
|
private Context mContext;
|
||||||
|
|
||||||
|
private RunnableArgs<SqlMtbColt> mOnItemClicked;
|
||||||
|
|
||||||
|
public DocInterniListAdapter(Context context, ObservableArrayList<DocInterniListModel> myDataset) {
|
||||||
|
super(myDataset);
|
||||||
|
this.mContext = context;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public SingleItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
|
DocInterniListModelBinding binding = DataBindingUtil.inflate(LayoutInflater.from(parent.getContext()), R.layout.doc_interni_list_model, parent, false);
|
||||||
|
return new SingleItemViewHolder(binding);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull SingleItemViewHolder holder, int position) {
|
||||||
|
final DocInterniListModel doc = mDataset.get(position);
|
||||||
|
SqlMtbColt mtbColt = doc.getDocument();
|
||||||
|
|
||||||
|
String testataDocString = String.format(mContext.getString(R.string.doc_interni_doc_header), mtbColt.getId(), mtbColt.getCodDtipProvv());
|
||||||
|
holder.binding.dataDoc.setText(Html.fromHtml(UtilityDate.formatDate(mtbColt.getDataCollo(), UtilityDate.COMMONS_DATE_FORMATS.DM_HUMAN)));
|
||||||
|
holder.binding.docDescription.setText(Html.fromHtml(testataDocString));
|
||||||
|
holder.binding.numRows.setText(Html.fromHtml(String.format(mContext.getString(R.string.doc_interni_num_arts_doc), doc.getProductsCount())));
|
||||||
|
|
||||||
|
holder.binding.executePendingBindings();
|
||||||
|
holder.binding.getRoot().setOnClickListener(v -> {
|
||||||
|
if (this.mOnItemClicked != null)
|
||||||
|
this.mOnItemClicked.run(mtbColt);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setOnItemClicked(RunnableArgs<SqlMtbColt> onItemClicked){
|
||||||
|
this.mOnItemClicked = onItemClicked;
|
||||||
|
}
|
||||||
|
static class SingleItemViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
|
||||||
|
DocInterniListModelBinding binding;
|
||||||
|
|
||||||
|
SingleItemViewHolder(DocInterniListModelBinding binding) {
|
||||||
|
super(binding.getRoot());
|
||||||
|
this.binding = binding;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.contab_doc_interni.ui;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColt;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.wrappers.DocInternoWrapper;
|
||||||
|
|
||||||
|
public class DocInterniListModel {
|
||||||
|
|
||||||
|
|
||||||
|
private SqlMtbColt document;
|
||||||
|
private int productsCount;
|
||||||
|
|
||||||
|
public SqlMtbColt getDocument() {
|
||||||
|
return document;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDocument(SqlMtbColt document) {
|
||||||
|
this.document = document;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getProductsCount() {
|
||||||
|
return productsCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProductsCount(int productsCount) {
|
||||||
|
this.productsCount = productsCount;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -18,10 +18,8 @@ import it.integry.integrywmsnative.R;
|
|||||||
import it.integry.integrywmsnative.core.data_cache.DataCache;
|
import it.integry.integrywmsnative.core.data_cache.DataCache;
|
||||||
import it.integry.integrywmsnative.core.expansion.BaseActivity;
|
import it.integry.integrywmsnative.core.expansion.BaseActivity;
|
||||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||||
import it.integry.integrywmsnative.core.report.ReportManager;
|
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.DepositoRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.DepositoRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.PrinterRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.PrinterRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
|
||||||
import it.integry.integrywmsnative.databinding.ActivityContenutoBancaleBinding;
|
import it.integry.integrywmsnative.databinding.ActivityContenutoBancaleBinding;
|
||||||
import it.integry.integrywmsnative.gest.contenuto_bancale.ui.ContenutoBancaleListAdapter;
|
import it.integry.integrywmsnative.gest.contenuto_bancale.ui.ContenutoBancaleListAdapter;
|
||||||
import it.integry.integrywmsnative.ui.SimpleDividerItemDecoration;
|
import it.integry.integrywmsnative.ui.SimpleDividerItemDecoration;
|
||||||
@@ -144,39 +142,21 @@ public class ContenutoBancaleActivity extends BaseActivity implements ContenutoB
|
|||||||
public void printUL() {
|
public void printUL() {
|
||||||
this.bindings.contenutoBancaleFab.close(true);
|
this.bindings.contenutoBancaleFab.close(true);
|
||||||
this.onLoadingStarted();
|
this.onLoadingStarted();
|
||||||
|
try {
|
||||||
|
this.mPrinterRESTConsumer.printCollo(mPrinterType, mtbColt.get(),
|
||||||
|
() -> {
|
||||||
|
this.onLoadingEnded();
|
||||||
|
|
||||||
this.mPrinterRESTConsumer.getAvailablePrinters(SettingsManager.i().getUserSession().getDepo().getCodMdep(), mPrinterType, value -> {
|
Resources res = this.getResources();
|
||||||
if (value.size() > 0) {
|
String errorMessage = res.getText(R.string.alert_print_completed_message).toString();
|
||||||
|
DialogSimpleMessageView
|
||||||
try {
|
.makeSuccessDialog(res.getText(R.string.completed).toString(), new SpannableString(errorMessage), null, null)
|
||||||
String reportName = ReportManager.getReportNameLUFromGestione(mtbColt.get().getGestioneEnum());
|
.show(getSupportFragmentManager(), "tag");
|
||||||
reportName = mReportName != null ? mReportName : reportName;
|
}, this::onError);
|
||||||
|
|
||||||
this.mPrinterRESTConsumer.printCollo(value.get(0),
|
|
||||||
mtbColt.get(),
|
|
||||||
1,
|
|
||||||
reportName,
|
|
||||||
() -> {
|
|
||||||
this.onLoadingEnded();
|
|
||||||
|
|
||||||
Resources res = this.getResources();
|
|
||||||
String errorMessage = res.getText(R.string.alert_print_completed_message).toString();
|
|
||||||
DialogSimpleMessageView
|
|
||||||
.makeSuccessDialog(res.getText(R.string.completed).toString(), new SpannableString(errorMessage), null, null)
|
|
||||||
.show(getSupportFragmentManager(), "tag");
|
|
||||||
}, this::onError);
|
|
||||||
|
|
||||||
} catch (Exception ex) {
|
|
||||||
this.onError(ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
this.onLoadingEnded();
|
|
||||||
String errorMessage = "Nessuna stampante configurata";
|
|
||||||
this.onError(new Exception(errorMessage));
|
|
||||||
}
|
|
||||||
}, this::onError);
|
|
||||||
|
|
||||||
|
} catch (Exception ex) {
|
||||||
|
this.onError(ex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ import javax.inject.Inject;
|
|||||||
|
|
||||||
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.class_router.BaseCustomConfiguration;
|
|
||||||
import it.integry.integrywmsnative.core.class_router.ClassRouter;
|
import it.integry.integrywmsnative.core.class_router.ClassRouter;
|
||||||
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;
|
||||||
@@ -40,7 +39,7 @@ import it.integry.integrywmsnative.core.interfaces.IFilterableFragment;
|
|||||||
import it.integry.integrywmsnative.core.interfaces.ILifecycleFragment;
|
import it.integry.integrywmsnative.core.interfaces.ILifecycleFragment;
|
||||||
import it.integry.integrywmsnative.core.interfaces.IPoppableActivity;
|
import it.integry.integrywmsnative.core.interfaces.IPoppableActivity;
|
||||||
import it.integry.integrywmsnative.core.interfaces.IScrollableFragment;
|
import it.integry.integrywmsnative.core.interfaces.IScrollableFragment;
|
||||||
import it.integry.integrywmsnative.core.interfaces.ISearcableFragment;
|
import it.integry.integrywmsnative.core.interfaces.ISearchableFragment;
|
||||||
import it.integry.integrywmsnative.core.interfaces.ISelectAllFragment;
|
import it.integry.integrywmsnative.core.interfaces.ISelectAllFragment;
|
||||||
import it.integry.integrywmsnative.core.interfaces.ITitledFragment;
|
import it.integry.integrywmsnative.core.interfaces.ITitledFragment;
|
||||||
import it.integry.integrywmsnative.core.menu.MenuService;
|
import it.integry.integrywmsnative.core.menu.MenuService;
|
||||||
@@ -242,7 +241,7 @@ public class MainActivity extends BaseActivity
|
|||||||
|
|
||||||
private MenuConfiguration.MenuItem getMenuItem(@IdRes int menuId) {
|
private MenuConfiguration.MenuItem getMenuItem(@IdRes int menuId) {
|
||||||
ICustomConfiguration customConfiguration = ClassRouter.getInstance(ClassRouter.PATH.CUSTOM_CONFIGURATION);
|
ICustomConfiguration customConfiguration = ClassRouter.getInstance(ClassRouter.PATH.CUSTOM_CONFIGURATION);
|
||||||
BaseMenuConfiguration menuConfiguration = customConfiguration.getConfig(BaseCustomConfiguration.Keys.MENU_CONFIGURATION);
|
BaseMenuConfiguration menuConfiguration = new MenuConfiguration();
|
||||||
List<MenuConfiguration.MenuGroup> menuGroups = menuConfiguration.getGroups();
|
List<MenuConfiguration.MenuGroup> menuGroups = menuConfiguration.getGroups();
|
||||||
|
|
||||||
BaseMenuConfiguration.MenuItem menuItemToReturn = null;
|
BaseMenuConfiguration.MenuItem menuItemToReturn = null;
|
||||||
@@ -281,21 +280,21 @@ public class MainActivity extends BaseActivity
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void adaptViewToFragment(Fragment fragment) {
|
private void adaptViewToFragment(Fragment fragment) {
|
||||||
if (fragment instanceof ISearcableFragment) {
|
if (fragment instanceof ISearchableFragment) {
|
||||||
mBinding.appBarMain.mainSearch.setOnQueryTextListener((SearchView.OnQueryTextListener) fragment);
|
mBinding.appBarMain.mainSearch.setOnQueryTextListener((SearchView.OnQueryTextListener) fragment);
|
||||||
mBinding.appBarMain.mainSearch.setVisibility(View.VISIBLE);
|
mBinding.appBarMain.mainSearch.setVisibility(View.VISIBLE);
|
||||||
mBinding.appBarMain.mainSearch.setOnSearchClickListener(v -> {
|
mBinding.appBarMain.mainSearch.setOnSearchClickListener(v -> {
|
||||||
((ISearcableFragment) fragment).onSearchEnabled();
|
((ISearchableFragment) fragment).onSearchEnabled();
|
||||||
mBinding.appBarMain.toolbarTitleLeft.setVisibility(View.GONE);
|
mBinding.appBarMain.toolbarTitleLeft.setVisibility(View.GONE);
|
||||||
});
|
});
|
||||||
|
|
||||||
mBinding.appBarMain.mainSearch.setOnCloseListener(() -> {
|
mBinding.appBarMain.mainSearch.setOnCloseListener(() -> {
|
||||||
((ISearcableFragment) fragment).onSearchDisabled();
|
((ISearchableFragment) fragment).onSearchDisabled();
|
||||||
mBinding.appBarMain.toolbarTitleLeft.setVisibility(View.VISIBLE);
|
mBinding.appBarMain.toolbarTitleLeft.setVisibility(View.VISIBLE);
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
((ISearcableFragment) fragment).addOnPreDestroy(() -> {
|
((ISearchableFragment) fragment).addOnPreDestroy(() -> {
|
||||||
mBinding.appBarMain.mainSearch.setIconified(true);
|
mBinding.appBarMain.mainSearch.setIconified(true);
|
||||||
mBinding.appBarMain.mainSearch.setVisibility(View.GONE);
|
mBinding.appBarMain.mainSearch.setVisibility(View.GONE);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -276,9 +276,7 @@ public class MainFragment extends Fragment implements ITitledFragment, IScrollab
|
|||||||
groupBinding.mainList.setAdapter(menuListAdapter);
|
groupBinding.mainList.setAdapter(menuListAdapter);
|
||||||
groupBinding.mainList.setNestedScrollingEnabled(false);
|
groupBinding.mainList.setNestedScrollingEnabled(false);
|
||||||
|
|
||||||
menuListAdapter.setClickListener((view, position) -> {
|
menuListAdapter.setClickListener(this::onMenuClick);
|
||||||
onMenuClick(menuGroup.getItems().get(position));
|
|
||||||
});
|
|
||||||
|
|
||||||
mBindings.menuContainer.addView(groupBinding.getRoot());
|
mBindings.menuContainer.addView(groupBinding.getRoot());
|
||||||
|
|
||||||
|
|||||||
@@ -14,14 +14,15 @@ import androidx.recyclerview.widget.RecyclerView;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.R;
|
import it.integry.integrywmsnative.R;
|
||||||
|
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;
|
||||||
|
|
||||||
public class MenuListAdapter extends RecyclerView.Adapter<MenuListAdapter.ViewHolder> {
|
public class MenuListAdapter extends RecyclerView.Adapter<MenuListAdapter.ViewHolder> {
|
||||||
|
|
||||||
private Context mContext;
|
private final Context mContext;
|
||||||
|
|
||||||
private List<MenuConfiguration.MenuItem> mDataset;
|
private final List<MenuConfiguration.MenuItem> mDataset;
|
||||||
private LayoutInflater mInflater;
|
private final LayoutInflater mInflater;
|
||||||
private ItemClickListener mClickListener;
|
private ItemClickListener mClickListener;
|
||||||
|
|
||||||
// data is passed into the constructor
|
// data is passed into the constructor
|
||||||
@@ -44,6 +45,10 @@ public class MenuListAdapter extends RecyclerView.Adapter<MenuListAdapter.ViewHo
|
|||||||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||||
holder.mIcon.setImageDrawable(ResourcesCompat.getDrawable(mContext.getResources(), mDataset.get(position).getTitleIcon(), null));
|
holder.mIcon.setImageDrawable(ResourcesCompat.getDrawable(mContext.getResources(), mDataset.get(position).getTitleIcon(), null));
|
||||||
holder.mTitle.setText(mContext.getResources().getString(mDataset.get(position).getTitleText()));
|
holder.mTitle.setText(mContext.getResources().getString(mDataset.get(position).getTitleText()));
|
||||||
|
|
||||||
|
holder.itemView.setOnClickListener(v -> {
|
||||||
|
if (mClickListener != null) mClickListener.onItemClick(mDataset.get(position));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// total number of cells
|
// total number of cells
|
||||||
@@ -54,20 +59,14 @@ public class MenuListAdapter extends RecyclerView.Adapter<MenuListAdapter.ViewHo
|
|||||||
|
|
||||||
|
|
||||||
// stores and recycles views as they are scrolled off screen
|
// stores and recycles views as they are scrolled off screen
|
||||||
public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
|
public static class ViewHolder extends RecyclerView.ViewHolder {
|
||||||
private TextView mTitle;
|
private final TextView mTitle;
|
||||||
private ImageView mIcon;
|
private final ImageView mIcon;
|
||||||
|
|
||||||
ViewHolder(View itemView) {
|
ViewHolder(View itemView) {
|
||||||
super(itemView);
|
super(itemView);
|
||||||
mTitle = itemView.findViewById(R.id.menu_title);
|
mTitle = itemView.findViewById(R.id.menu_title);
|
||||||
mIcon = itemView.findViewById(R.id.menu_icon);
|
mIcon = itemView.findViewById(R.id.menu_icon);
|
||||||
itemView.setOnClickListener(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
if (mClickListener != null) mClickListener.onItemClick(view, getAdapterPosition());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,6 +78,6 @@ public class MenuListAdapter extends RecyclerView.Adapter<MenuListAdapter.ViewHo
|
|||||||
|
|
||||||
// parent activity will implement this method to respond to click events
|
// parent activity will implement this method to respond to click events
|
||||||
public interface ItemClickListener {
|
public interface ItemClickListener {
|
||||||
void onItemClick(View view, int position);
|
void onItemClick(BaseMenuConfiguration.MenuItem menuItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,99 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.ordini_uscita_elenco;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.FilterAgenteLayoutView;
|
||||||
|
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.FilterAutomezzoLayoutView;
|
||||||
|
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.FilterClienteLayoutView;
|
||||||
|
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.FilterDepositoLayoutView;
|
||||||
|
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.FilterGruppoMercLayoutView;
|
||||||
|
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.FilterNumeroOrdineLayoutView;
|
||||||
|
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.FilterPaeseLayoutView;
|
||||||
|
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.FilterTermConsLayoutView;
|
||||||
|
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.FilterVettoreLayoutView;
|
||||||
|
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.FilterViaggioLayoutView;
|
||||||
|
import it.integry.integrywmsnative.ui.filter_chips.FilterChipDTO;
|
||||||
|
|
||||||
|
public class OrdiniUscitaElencoBindings {
|
||||||
|
|
||||||
|
|
||||||
|
public static final int DEPOSITO_FILTER_ID = 0;
|
||||||
|
public static final int VIAGGIO_FILTER_ID = 1;
|
||||||
|
public static final int NUM_ORD_FILTER_ID = 2;
|
||||||
|
public static final int CLIENTE_FILTER_ID = 3;
|
||||||
|
public static final int VETTORE_FILTER_ID = 4;
|
||||||
|
public static final int AUTOMEZZO_FILTER_ID = 5;
|
||||||
|
public static final int PAESE_FILTER_ID = 6;
|
||||||
|
public static final int AGENTE_FILTER_ID = 7;
|
||||||
|
public static final int TERM_CONS_FILTER_ID = 8;
|
||||||
|
public static final int DATA_CONS_FILTER_ID = 9;
|
||||||
|
public static final int GRUPPO_MERC_FILTER_ID = 10;
|
||||||
|
|
||||||
|
public static final HashMap<Integer, FilterChipDTO> AVAILABLE_FILTERS = new HashMap<>() {{
|
||||||
|
put(DEPOSITO_FILTER_ID, new FilterChipDTO()
|
||||||
|
.setID(DEPOSITO_FILTER_ID)
|
||||||
|
.setPosizione(9)
|
||||||
|
.setFilterChipText("Deposito")
|
||||||
|
.setFilterLayoutView(new FilterDepositoLayoutView()));
|
||||||
|
|
||||||
|
put(VIAGGIO_FILTER_ID, new FilterChipDTO()
|
||||||
|
.setID(VIAGGIO_FILTER_ID)
|
||||||
|
.setPosizione(2)
|
||||||
|
.setFilterChipText("Viaggio")
|
||||||
|
.setFilterLayoutView(new FilterViaggioLayoutView()));
|
||||||
|
|
||||||
|
put(NUM_ORD_FILTER_ID, new FilterChipDTO()
|
||||||
|
.setID(NUM_ORD_FILTER_ID)
|
||||||
|
.setPosizione(0)
|
||||||
|
.setFilterChipText("Numero ordine")
|
||||||
|
.setFilterLayoutView(new FilterNumeroOrdineLayoutView()));
|
||||||
|
|
||||||
|
put(CLIENTE_FILTER_ID, new FilterChipDTO()
|
||||||
|
.setID(CLIENTE_FILTER_ID)
|
||||||
|
.setPosizione(1)
|
||||||
|
.setFilterChipText("Cliente")
|
||||||
|
.setFilterLayoutView(new FilterClienteLayoutView()));
|
||||||
|
|
||||||
|
put(VETTORE_FILTER_ID, new FilterChipDTO()
|
||||||
|
.setID(VETTORE_FILTER_ID)
|
||||||
|
.setPosizione(4)
|
||||||
|
.setFilterChipText("Vettore")
|
||||||
|
.setFilterLayoutView(new FilterVettoreLayoutView()));
|
||||||
|
|
||||||
|
put(AUTOMEZZO_FILTER_ID, new FilterChipDTO()
|
||||||
|
.setID(AUTOMEZZO_FILTER_ID)
|
||||||
|
.setPosizione(6)
|
||||||
|
.setFilterChipText("Automezzo")
|
||||||
|
.setFilterLayoutView(new FilterAutomezzoLayoutView()));
|
||||||
|
|
||||||
|
put(PAESE_FILTER_ID, new FilterChipDTO()
|
||||||
|
.setID(PAESE_FILTER_ID)
|
||||||
|
.setPosizione(8)
|
||||||
|
.setFilterChipText("Paese")
|
||||||
|
.setFilterLayoutView(new FilterPaeseLayoutView()));
|
||||||
|
|
||||||
|
put(AGENTE_FILTER_ID, new FilterChipDTO()
|
||||||
|
.setID(AGENTE_FILTER_ID)
|
||||||
|
.setPosizione(10)
|
||||||
|
.setFilterChipText("Agente")
|
||||||
|
.setFilterLayoutView(new FilterAgenteLayoutView()));
|
||||||
|
|
||||||
|
put(TERM_CONS_FILTER_ID, new FilterChipDTO()
|
||||||
|
.setID(TERM_CONS_FILTER_ID)
|
||||||
|
.setPosizione(5)
|
||||||
|
.setFilterChipText("Termini consegna")
|
||||||
|
.setFilterLayoutView(new FilterTermConsLayoutView()));
|
||||||
|
|
||||||
|
put(DATA_CONS_FILTER_ID, new FilterChipDTO()
|
||||||
|
.setID(DATA_CONS_FILTER_ID)
|
||||||
|
.setPosizione(3)
|
||||||
|
.setFilterChipText("Data consegna"));
|
||||||
|
|
||||||
|
put(GRUPPO_MERC_FILTER_ID, new FilterChipDTO()
|
||||||
|
.setID(GRUPPO_MERC_FILTER_ID)
|
||||||
|
.setPosizione(7)
|
||||||
|
.setFilterChipText("Gruppo merceologico")
|
||||||
|
.setFilterLayoutView(new FilterGruppoMercLayoutView()));
|
||||||
|
}};
|
||||||
|
|
||||||
|
}
|
||||||
@@ -15,9 +15,13 @@ import androidx.recyclerview.widget.LinearLayoutManager;
|
|||||||
|
|
||||||
import com.annimon.stream.ComparatorCompat;
|
import com.annimon.stream.ComparatorCompat;
|
||||||
import com.annimon.stream.Stream;
|
import com.annimon.stream.Stream;
|
||||||
|
import com.google.android.material.datepicker.MaterialDatePicker;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
@@ -29,36 +33,60 @@ 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.di.BindableBoolean;
|
import it.integry.integrywmsnative.core.di.BindableBoolean;
|
||||||
import it.integry.integrywmsnative.core.expansion.BaseFragment;
|
import it.integry.integrywmsnative.core.expansion.BaseFragment;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.OnGeneralChangedCallback;
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
import it.integry.integrywmsnative.core.interfaces.IFilterableFragment;
|
|
||||||
import it.integry.integrywmsnative.core.interfaces.IScrollableFragment;
|
import it.integry.integrywmsnative.core.interfaces.IScrollableFragment;
|
||||||
import it.integry.integrywmsnative.core.interfaces.ISelectAllFragment;
|
import it.integry.integrywmsnative.core.interfaces.ISelectAllFragment;
|
||||||
import it.integry.integrywmsnative.core.interfaces.ITitledFragment;
|
import it.integry.integrywmsnative.core.interfaces.ITitledFragment;
|
||||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||||
|
import it.integry.integrywmsnative.core.model.MtbDepo;
|
||||||
|
import it.integry.integrywmsnative.core.model.MtbGrup;
|
||||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||||
|
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||||
|
import it.integry.integrywmsnative.core.rest.consumers.DepositoRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.model.OrdineUscitaInevasoDTO;
|
import it.integry.integrywmsnative.core.rest.model.OrdineUscitaInevasoDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.SitArtOrdDTO;
|
import it.integry.integrywmsnative.core.rest.model.SitArtOrdDTO;
|
||||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||||
import it.integry.integrywmsnative.databinding.FragmentMainOrdiniUscitaBinding;
|
import it.integry.integrywmsnative.databinding.FragmentMainOrdiniUscitaBinding;
|
||||||
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.dialogs.DialogVenditaFiltroAvanzatoView;
|
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.FilterAgenteLayoutView;
|
||||||
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.dialogs.DialogVenditaFiltroAvanzatoViewModel;
|
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.FilterAutomezzoLayoutView;
|
||||||
|
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.FilterClienteLayoutView;
|
||||||
|
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.FilterDepositoLayoutView;
|
||||||
|
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.FilterGruppoMercLayoutView;
|
||||||
|
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.FilterNumeroOrdineLayoutView;
|
||||||
|
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.FilterPaeseLayoutView;
|
||||||
|
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.FilterTermConsLayoutView;
|
||||||
|
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.FilterVettoreLayoutView;
|
||||||
|
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.FilterViaggioLayoutView;
|
||||||
|
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.VenditaFiltroOrdiniViewModel;
|
||||||
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.ui.OrdiniUscitaElencoAdapter;
|
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.ui.OrdiniUscitaElencoAdapter;
|
||||||
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.ui.OrdiniUscitaElencoListModel;
|
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.ui.OrdiniUscitaElencoListModel;
|
||||||
import it.integry.integrywmsnative.gest.spedizione.SpedizioneActivity;
|
import it.integry.integrywmsnative.gest.spedizione.SpedizioneActivity;
|
||||||
import it.integry.integrywmsnative.gest.spedizione.dialogs.row_info.BaseDialogRowInfoView;
|
import it.integry.integrywmsnative.gest.spedizione.dialogs.row_info.BaseDialogRowInfoView;
|
||||||
import it.integry.integrywmsnative.ui.ElevatedToolbar;
|
import it.integry.integrywmsnative.ui.ElevatedToolbar;
|
||||||
|
import it.integry.integrywmsnative.ui.filter_chips.FilterChipDTO;
|
||||||
|
import it.integry.integrywmsnative.ui.filter_chips.FilterChipView;
|
||||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||||
|
|
||||||
public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledFragment, IScrollableFragment, ISelectAllFragment, IFilterableFragment, OrdiniUscitaElencoViewModel.Listener {
|
public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledFragment, IScrollableFragment, ISelectAllFragment, OrdiniUscitaElencoViewModel.Listener {
|
||||||
|
|
||||||
public BindableBoolean fabVisible = new BindableBoolean(false);
|
public BindableBoolean fabVisible = new BindableBoolean(false);
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
DepositoRESTConsumer mDepositoRESTConsumer;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
ArticoloRESTConsumer mArticoloRESTConsumer;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
OrdiniUscitaElencoViewModel mViewModel;
|
OrdiniUscitaElencoViewModel mViewModel;
|
||||||
|
|
||||||
|
private final VenditaFiltroOrdiniViewModel mAppliedFilterViewModel = new VenditaFiltroOrdiniViewModel();
|
||||||
|
|
||||||
private FragmentMainOrdiniUscitaBinding mBindings = null;
|
private FragmentMainOrdiniUscitaBinding mBindings = null;
|
||||||
|
|
||||||
private final ObservableArrayList<OrdiniUscitaElencoListModel> mOrdiniInevasiMutableData = new ObservableArrayList<>();
|
private final ObservableArrayList<OrdiniUscitaElencoListModel> mOrdiniInevasiMutableData = new ObservableArrayList<>();
|
||||||
@@ -73,6 +101,8 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
|
|||||||
|
|
||||||
private int barcodeScannerIstanceID = -1;
|
private int barcodeScannerIstanceID = -1;
|
||||||
|
|
||||||
|
private List<MtbDepo> mtbDepoCache;
|
||||||
|
private List<MtbGrup> mtbGrupCache;
|
||||||
|
|
||||||
public OrdiniUscitaElencoFragment() {
|
public OrdiniUscitaElencoFragment() {
|
||||||
// Required empty public constructor
|
// Required empty public constructor
|
||||||
@@ -125,15 +155,21 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
|
|||||||
this.initRecyclerView();
|
this.initRecyclerView();
|
||||||
this.initBarcodeReader();
|
this.initBarcodeReader();
|
||||||
|
|
||||||
|
this.initFilters();
|
||||||
|
|
||||||
return mBindings.getRoot();
|
return mBindings.getRoot();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStart() {
|
public void onStart() {
|
||||||
super.onStart();
|
super.onStart();
|
||||||
|
this.onLoadingStarted();
|
||||||
|
|
||||||
|
this.initMtbDepoCache(() -> {
|
||||||
|
String codMdep = SettingsManager.i().getUserSession().getDepo().getCodMdep();
|
||||||
|
mViewModel.init(codMdep, mCurrentGestioneOrd, mCurrentGestioneCol, mCurrentSegnoCol);
|
||||||
|
});
|
||||||
|
|
||||||
String codMdep = SettingsManager.i().getUserSession().getDepo().getCodMdep();
|
|
||||||
mViewModel.init(codMdep, mCurrentGestioneOrd, mCurrentGestioneCol, mCurrentSegnoCol);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -151,7 +187,14 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
|
|||||||
boolean canSelectMultipleOrdini = SettingsManager.iDB().isFlagSpedizioneCanSelectMultipleOrders();
|
boolean canSelectMultipleOrdini = SettingsManager.iDB().isFlagSpedizioneCanSelectMultipleOrders();
|
||||||
boolean canSelectMultipleClienti = SettingsManager.iDB().isFlagMultiClienteOrdV();
|
boolean canSelectMultipleClienti = SettingsManager.iDB().isFlagMultiClienteOrdV();
|
||||||
|
|
||||||
this.mViewModel.getOrderList().observe(getViewLifecycleOwner(), v -> this.refreshList(null));
|
this.mViewModel.getOrderList().observe(getViewLifecycleOwner(), v -> {
|
||||||
|
this.onLoadingStarted();
|
||||||
|
this.initMtbGrupsCache(this::onLoadingEnded);
|
||||||
|
|
||||||
|
mAppliedFilterViewModel.init(mViewModel.getOrderList().getValue());
|
||||||
|
|
||||||
|
this.refreshList(null);
|
||||||
|
});
|
||||||
|
|
||||||
OrdiniUscitaElencoAdapter ordiniUscitaElencoAdapter =
|
OrdiniUscitaElencoAdapter ordiniUscitaElencoAdapter =
|
||||||
new OrdiniUscitaElencoAdapter(getActivity(), mOrdiniInevasiMutableData)
|
new OrdiniUscitaElencoAdapter(getActivity(), mOrdiniInevasiMutableData)
|
||||||
@@ -187,8 +230,8 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
|
|||||||
this.mBindings.venditaMainList.setAdapter(ordiniUscitaElencoAdapter);
|
this.mBindings.venditaMainList.setAdapter(ordiniUscitaElencoAdapter);
|
||||||
this.mBindings.venditaMainList.setLayoutManager(new LinearLayoutManager(getActivity()));
|
this.mBindings.venditaMainList.setLayoutManager(new LinearLayoutManager(getActivity()));
|
||||||
|
|
||||||
if (mToolbar != null)
|
// if (mToolbar != null)
|
||||||
mToolbar.setRecyclerView(this.mBindings.venditaMainList);
|
// mToolbar.setRecyclerView(this.mBindings.venditaMainList);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initBarcodeReader() {
|
private void initBarcodeReader() {
|
||||||
@@ -199,6 +242,446 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
|
|||||||
BarcodeManager.enable();
|
BarcodeManager.enable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void initFilters() {
|
||||||
|
var onPredicateChanged = new OnGeneralChangedCallback() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
refreshList(null);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
mAppliedFilterViewModel.getCurrentDepositoPredicate().addOnPropertyChangedCallback(onPredicateChanged);
|
||||||
|
mAppliedFilterViewModel.getCurrentIdViaggioPredicate().addOnPropertyChangedCallback(onPredicateChanged);
|
||||||
|
mAppliedFilterViewModel.getCurrentNumOrdsPredicate().addOnPropertyChangedCallback(onPredicateChanged);
|
||||||
|
mAppliedFilterViewModel.getCurrentClientePredicate().addOnPropertyChangedCallback(onPredicateChanged);
|
||||||
|
mAppliedFilterViewModel.getCurrentVettorePredicate().addOnPropertyChangedCallback(onPredicateChanged);
|
||||||
|
mAppliedFilterViewModel.getCurrentAutomezzoPredicate().addOnPropertyChangedCallback(onPredicateChanged);
|
||||||
|
mAppliedFilterViewModel.getCurrentPaesePredicate().addOnPropertyChangedCallback(onPredicateChanged);
|
||||||
|
mAppliedFilterViewModel.getCurrentAgentePredicate().addOnPropertyChangedCallback(onPredicateChanged);
|
||||||
|
mAppliedFilterViewModel.getCurrentTermConsPredicate().addOnPropertyChangedCallback(onPredicateChanged);
|
||||||
|
mAppliedFilterViewModel.getCurrentDataConsPredicate().addOnPropertyChangedCallback(onPredicateChanged);
|
||||||
|
mAppliedFilterViewModel.getCurrentGruppoMercPredicate().addOnPropertyChangedCallback(onPredicateChanged);
|
||||||
|
|
||||||
|
List<FilterChipDTO> filterList = Stream.of(OrdiniUscitaElencoBindings.AVAILABLE_FILTERS.entrySet()).map(Map.Entry::getValue).sortBy(FilterChipDTO::getPosizione).toList();
|
||||||
|
|
||||||
|
for (FilterChipDTO filterChipDTO : filterList){
|
||||||
|
|
||||||
|
FilterChipView filterChipView = new FilterChipView(
|
||||||
|
requireActivity(),
|
||||||
|
filterChipDTO.getFilterChipText(),
|
||||||
|
v -> initBottomSheetDialogFilter(filterChipDTO));
|
||||||
|
|
||||||
|
switch (filterChipDTO.getID()) {
|
||||||
|
case OrdiniUscitaElencoBindings.DEPOSITO_FILTER_ID:
|
||||||
|
mAppliedFilterViewModel.getCurrentDepositoPredicate().addOnPropertyChangedCallback(new OnGeneralChangedCallback() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (mAppliedFilterViewModel.getCurrentDepositoPredicate().get() == null) {
|
||||||
|
filterChipView.disableCloseIcon();
|
||||||
|
|
||||||
|
mBindings.filterChipsGroup.removeView(filterChipView);
|
||||||
|
mBindings.filterChipsGroup.addView(filterChipView);
|
||||||
|
mBindings.filterChips.smoothScrollTo(0, 0);
|
||||||
|
} else {
|
||||||
|
filterChipView.enableCloseIcon();
|
||||||
|
|
||||||
|
mBindings.filterChipsGroup.removeView(filterChipView);
|
||||||
|
mBindings.filterChipsGroup.addView(filterChipView, 0);
|
||||||
|
mBindings.filterChips.smoothScrollTo(0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
filterChipView.setOnResetClicked(() -> mAppliedFilterViewModel.getCurrentDepositoPredicate().set(null));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case OrdiniUscitaElencoBindings.VIAGGIO_FILTER_ID:
|
||||||
|
mAppliedFilterViewModel.getCurrentIdViaggioPredicate().addOnPropertyChangedCallback(new OnGeneralChangedCallback() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (mAppliedFilterViewModel.getCurrentIdViaggioPredicate().get() == null) {
|
||||||
|
filterChipView.disableCloseIcon();
|
||||||
|
|
||||||
|
mBindings.filterChipsGroup.removeView(filterChipView);
|
||||||
|
mBindings.filterChipsGroup.addView(filterChipView);
|
||||||
|
mBindings.filterChips.smoothScrollTo(0, 0);
|
||||||
|
} else {
|
||||||
|
filterChipView.enableCloseIcon();
|
||||||
|
|
||||||
|
mBindings.filterChipsGroup.removeView(filterChipView);
|
||||||
|
mBindings.filterChipsGroup.addView(filterChipView, 0);
|
||||||
|
mBindings.filterChips.smoothScrollTo(0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
filterChipView.setOnResetClicked(() -> mAppliedFilterViewModel.getCurrentIdViaggioPredicate().set(null));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case OrdiniUscitaElencoBindings.NUM_ORD_FILTER_ID:
|
||||||
|
mAppliedFilterViewModel.getCurrentNumOrdsPredicate().addOnPropertyChangedCallback(new OnGeneralChangedCallback() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (mAppliedFilterViewModel.getCurrentNumOrdsPredicate().get() == null) {
|
||||||
|
filterChipView.disableCloseIcon();
|
||||||
|
|
||||||
|
mBindings.filterChipsGroup.removeView(filterChipView);
|
||||||
|
mBindings.filterChipsGroup.addView(filterChipView);
|
||||||
|
mBindings.filterChips.smoothScrollTo(0, 0);
|
||||||
|
} else {
|
||||||
|
filterChipView.enableCloseIcon();
|
||||||
|
|
||||||
|
mBindings.filterChipsGroup.removeView(filterChipView);
|
||||||
|
mBindings.filterChipsGroup.addView(filterChipView, 0);
|
||||||
|
mBindings.filterChips.smoothScrollTo(0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
filterChipView.setOnResetClicked(() -> mAppliedFilterViewModel.getCurrentNumOrdsPredicate().set(null));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case OrdiniUscitaElencoBindings.CLIENTE_FILTER_ID:
|
||||||
|
mAppliedFilterViewModel.getCurrentClientePredicate().addOnPropertyChangedCallback(new OnGeneralChangedCallback() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (mAppliedFilterViewModel.getCurrentClientePredicate().get() == null) {
|
||||||
|
filterChipView.disableCloseIcon();
|
||||||
|
|
||||||
|
mBindings.filterChipsGroup.removeView(filterChipView);
|
||||||
|
mBindings.filterChipsGroup.addView(filterChipView);
|
||||||
|
mBindings.filterChips.smoothScrollTo(0, 0);
|
||||||
|
} else {
|
||||||
|
filterChipView.enableCloseIcon();
|
||||||
|
|
||||||
|
mBindings.filterChipsGroup.removeView(filterChipView);
|
||||||
|
mBindings.filterChipsGroup.addView(filterChipView, 0);
|
||||||
|
mBindings.filterChips.smoothScrollTo(0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
filterChipView.setOnResetClicked(() -> mAppliedFilterViewModel.getCurrentClientePredicate().set(null));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case OrdiniUscitaElencoBindings.VETTORE_FILTER_ID:
|
||||||
|
mAppliedFilterViewModel.getCurrentVettorePredicate().addOnPropertyChangedCallback(new OnGeneralChangedCallback() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (mAppliedFilterViewModel.getCurrentVettorePredicate().get() == null) {
|
||||||
|
filterChipView.disableCloseIcon();
|
||||||
|
|
||||||
|
mBindings.filterChipsGroup.removeView(filterChipView);
|
||||||
|
mBindings.filterChipsGroup.addView(filterChipView);
|
||||||
|
mBindings.filterChips.smoothScrollTo(0, 0);
|
||||||
|
} else {
|
||||||
|
filterChipView.enableCloseIcon();
|
||||||
|
|
||||||
|
mBindings.filterChipsGroup.removeView(filterChipView);
|
||||||
|
mBindings.filterChipsGroup.addView(filterChipView, 0);
|
||||||
|
mBindings.filterChips.smoothScrollTo(0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
filterChipView.setOnResetClicked(() -> mAppliedFilterViewModel.getCurrentVettorePredicate().set(null));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case OrdiniUscitaElencoBindings.AUTOMEZZO_FILTER_ID:
|
||||||
|
mAppliedFilterViewModel.getCurrentAutomezzoPredicate().addOnPropertyChangedCallback(new OnGeneralChangedCallback() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (mAppliedFilterViewModel.getCurrentAutomezzoPredicate().get() == null) {
|
||||||
|
filterChipView.disableCloseIcon();
|
||||||
|
|
||||||
|
mBindings.filterChipsGroup.removeView(filterChipView);
|
||||||
|
mBindings.filterChipsGroup.addView(filterChipView);
|
||||||
|
mBindings.filterChips.smoothScrollTo(0, 0);
|
||||||
|
} else {
|
||||||
|
filterChipView.enableCloseIcon();
|
||||||
|
|
||||||
|
mBindings.filterChipsGroup.removeView(filterChipView);
|
||||||
|
mBindings.filterChipsGroup.addView(filterChipView, 0);
|
||||||
|
mBindings.filterChips.smoothScrollTo(0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
filterChipView.setOnResetClicked(() -> mAppliedFilterViewModel.getCurrentAutomezzoPredicate().set(null));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case OrdiniUscitaElencoBindings.PAESE_FILTER_ID:
|
||||||
|
mAppliedFilterViewModel.getCurrentPaesePredicate().addOnPropertyChangedCallback(new OnGeneralChangedCallback() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (mAppliedFilterViewModel.getCurrentPaesePredicate().get() == null) {
|
||||||
|
filterChipView.disableCloseIcon();
|
||||||
|
|
||||||
|
mBindings.filterChipsGroup.removeView(filterChipView);
|
||||||
|
mBindings.filterChipsGroup.addView(filterChipView);
|
||||||
|
mBindings.filterChips.smoothScrollTo(0, 0);
|
||||||
|
} else {
|
||||||
|
filterChipView.enableCloseIcon();
|
||||||
|
|
||||||
|
mBindings.filterChipsGroup.removeView(filterChipView);
|
||||||
|
mBindings.filterChipsGroup.addView(filterChipView, 0);
|
||||||
|
mBindings.filterChips.smoothScrollTo(0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
filterChipView.setOnResetClicked(() -> mAppliedFilterViewModel.getCurrentPaesePredicate().set(null));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case OrdiniUscitaElencoBindings.AGENTE_FILTER_ID:
|
||||||
|
mAppliedFilterViewModel.getCurrentAgentePredicate().addOnPropertyChangedCallback(new OnGeneralChangedCallback() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (mAppliedFilterViewModel.getCurrentAgentePredicate().get() == null) {
|
||||||
|
filterChipView.disableCloseIcon();
|
||||||
|
|
||||||
|
mBindings.filterChipsGroup.removeView(filterChipView);
|
||||||
|
mBindings.filterChipsGroup.addView(filterChipView);
|
||||||
|
mBindings.filterChips.smoothScrollTo(0, 0);
|
||||||
|
} else {
|
||||||
|
filterChipView.enableCloseIcon();
|
||||||
|
|
||||||
|
mBindings.filterChipsGroup.removeView(filterChipView);
|
||||||
|
mBindings.filterChipsGroup.addView(filterChipView, 0);
|
||||||
|
mBindings.filterChips.smoothScrollTo(0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
filterChipView.setOnResetClicked(() -> mAppliedFilterViewModel.getCurrentAgentePredicate().set(null));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case OrdiniUscitaElencoBindings.TERM_CONS_FILTER_ID:
|
||||||
|
mAppliedFilterViewModel.getCurrentTermConsPredicate().addOnPropertyChangedCallback(new OnGeneralChangedCallback() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (mAppliedFilterViewModel.getCurrentTermConsPredicate().get() == null) {
|
||||||
|
filterChipView.disableCloseIcon();
|
||||||
|
|
||||||
|
mBindings.filterChipsGroup.removeView(filterChipView);
|
||||||
|
mBindings.filterChipsGroup.addView(filterChipView);
|
||||||
|
mBindings.filterChips.smoothScrollTo(0, 0);
|
||||||
|
} else {
|
||||||
|
filterChipView.enableCloseIcon();
|
||||||
|
|
||||||
|
mBindings.filterChipsGroup.removeView(filterChipView);
|
||||||
|
mBindings.filterChipsGroup.addView(filterChipView, 0);
|
||||||
|
mBindings.filterChips.smoothScrollTo(0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
filterChipView.setOnResetClicked(() -> mAppliedFilterViewModel.getCurrentTermConsPredicate().set(null));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case OrdiniUscitaElencoBindings.DATA_CONS_FILTER_ID:
|
||||||
|
mAppliedFilterViewModel.getCurrentDataConsPredicate().addOnPropertyChangedCallback(new OnGeneralChangedCallback() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (mAppliedFilterViewModel.getCurrentDataConsPredicate().get() == null) {
|
||||||
|
filterChipView.disableCloseIcon();
|
||||||
|
|
||||||
|
mBindings.filterChipsGroup.removeView(filterChipView);
|
||||||
|
mBindings.filterChipsGroup.addView(filterChipView);
|
||||||
|
mBindings.filterChips.smoothScrollTo(0, 0);
|
||||||
|
} else {
|
||||||
|
filterChipView.enableCloseIcon();
|
||||||
|
|
||||||
|
mBindings.filterChipsGroup.removeView(filterChipView);
|
||||||
|
mBindings.filterChipsGroup.addView(filterChipView, 0);
|
||||||
|
mBindings.filterChips.smoothScrollTo(0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
filterChipView.setOnResetClicked(() -> {
|
||||||
|
mAppliedFilterViewModel.setDataConsegnaFilter(null);
|
||||||
|
mAppliedFilterViewModel.getCurrentDataConsPredicate().set(null);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
|
||||||
|
case OrdiniUscitaElencoBindings.GRUPPO_MERC_FILTER_ID:
|
||||||
|
mAppliedFilterViewModel.getCurrentGruppoMercPredicate().addOnPropertyChangedCallback(new OnGeneralChangedCallback() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (mAppliedFilterViewModel.getCurrentGruppoMercPredicate().get() == null) {
|
||||||
|
filterChipView.disableCloseIcon();
|
||||||
|
|
||||||
|
mBindings.filterChipsGroup.removeView(filterChipView);
|
||||||
|
mBindings.filterChipsGroup.addView(filterChipView);
|
||||||
|
mBindings.filterChips.smoothScrollTo(0, 0);
|
||||||
|
} else {
|
||||||
|
filterChipView.enableCloseIcon();
|
||||||
|
|
||||||
|
mBindings.filterChipsGroup.removeView(filterChipView);
|
||||||
|
mBindings.filterChipsGroup.addView(filterChipView, 0);
|
||||||
|
mBindings.filterChips.smoothScrollTo(0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
filterChipView.setOnResetClicked(() -> {
|
||||||
|
mAppliedFilterViewModel.setGruppoMercFilter(null);
|
||||||
|
mAppliedFilterViewModel.getCurrentGruppoMercPredicate().set(null);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
this.mBindings.filterChipsGroup.addView(filterChipView);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initBottomSheetDialogFilter(FilterChipDTO filterChipDTO) {
|
||||||
|
if (filterChipDTO.getID() == OrdiniUscitaElencoBindings.DATA_CONS_FILTER_ID) {
|
||||||
|
var datePicker =
|
||||||
|
MaterialDatePicker.Builder.datePicker()
|
||||||
|
.setTitleText(filterChipDTO.getFilterChipText())
|
||||||
|
.setSelection(this.mAppliedFilterViewModel.getSelectedDataCons() != null ? this.mAppliedFilterViewModel.getSelectedDataCons().getTime() : null)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
datePicker.addOnPositiveButtonClickListener(selection -> {
|
||||||
|
this.mAppliedFilterViewModel.setDataConsegnaFilter(new Date(selection));
|
||||||
|
});
|
||||||
|
datePicker.show(requireActivity().getSupportFragmentManager(), "TAG");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
filterChipDTO
|
||||||
|
.getFilterLayoutView()
|
||||||
|
.setFilterName(filterChipDTO.getFilterChipText())
|
||||||
|
.setContext(requireActivity());
|
||||||
|
|
||||||
|
var filterLayoutView = filterChipDTO
|
||||||
|
.getFilterLayoutView();
|
||||||
|
|
||||||
|
switch (filterChipDTO.getID()) {
|
||||||
|
case OrdiniUscitaElencoBindings.DEPOSITO_FILTER_ID:
|
||||||
|
((FilterDepositoLayoutView) filterLayoutView)
|
||||||
|
.setAllCodMdeps(mAppliedFilterViewModel.getAllCodMdeps(mtbDepoCache))
|
||||||
|
.setAvailableCodMdeps(mAppliedFilterViewModel.getAvailableCodMdeps(mtbDepoCache))
|
||||||
|
.setOnFilterApplied(mAppliedFilterViewModel::setDepositoFilter)
|
||||||
|
.setPreSelectedCodMdeps(Stream.of(Objects.requireNonNull(mViewModel.getOrderList().getValue()))
|
||||||
|
.filter(mAppliedFilterViewModel.getCurrentDepositoPredicate().get() == null ?
|
||||||
|
x -> false :
|
||||||
|
mAppliedFilterViewModel.getCurrentDepositoPredicate().get())
|
||||||
|
.map(x -> Stream.of(mtbDepoCache).filter(y -> x.getCodMdep().equalsIgnoreCase(y.getCodMdep())).findFirst().get())
|
||||||
|
.toList());
|
||||||
|
break;
|
||||||
|
|
||||||
|
case OrdiniUscitaElencoBindings.VIAGGIO_FILTER_ID:
|
||||||
|
((FilterViaggioLayoutView) filterLayoutView)
|
||||||
|
.setAllIDViaggio(mAppliedFilterViewModel.getAllIDViaggio())
|
||||||
|
.setAvailableIDViaggio(mAppliedFilterViewModel.getAvailableIDViaggio())
|
||||||
|
.setOnFilterApplied(mAppliedFilterViewModel::setIDViaggioFilter)
|
||||||
|
.setPreSelectedIDViaggio(Stream.of(Objects.requireNonNull(mViewModel.getOrderList().getValue()))
|
||||||
|
.filter(mAppliedFilterViewModel.getCurrentIdViaggioPredicate().get() == null ?
|
||||||
|
x -> false :
|
||||||
|
mAppliedFilterViewModel.getCurrentIdViaggioPredicate().get())
|
||||||
|
.map(OrdineUscitaInevasoDTO::getIdViaggio)
|
||||||
|
.toList());
|
||||||
|
break;
|
||||||
|
|
||||||
|
case OrdiniUscitaElencoBindings.NUM_ORD_FILTER_ID:
|
||||||
|
((FilterNumeroOrdineLayoutView) filterLayoutView)
|
||||||
|
.setAllNumOrds(mAppliedFilterViewModel.getAllNumOrds())
|
||||||
|
.setAvailableNumOrds(mAppliedFilterViewModel.getAvailableNumOrds())
|
||||||
|
.setOnFilterApplied(mAppliedFilterViewModel::setNumOrdFilter)
|
||||||
|
.setPreSelectedNumOrds(Stream.of(Objects.requireNonNull(mViewModel.getOrderList().getValue()))
|
||||||
|
.filter(mAppliedFilterViewModel.getCurrentNumOrdsPredicate().get() == null ?
|
||||||
|
x -> false :
|
||||||
|
mAppliedFilterViewModel.getCurrentNumOrdsPredicate().get())
|
||||||
|
.map(OrdineUscitaInevasoDTO::getNumOrd)
|
||||||
|
.toList());
|
||||||
|
break;
|
||||||
|
|
||||||
|
case OrdiniUscitaElencoBindings.CLIENTE_FILTER_ID:
|
||||||
|
((FilterClienteLayoutView) filterLayoutView)
|
||||||
|
.setAllClienti(mAppliedFilterViewModel.getAllClienti())
|
||||||
|
.setAvailableClienti(mAppliedFilterViewModel.getAvailableClienti())
|
||||||
|
.setOnFilterApplied(mAppliedFilterViewModel::setClienteFilter)
|
||||||
|
.setPreSelectedClienti(Stream.of(Objects.requireNonNull(mViewModel.getOrderList().getValue()))
|
||||||
|
.filter(mAppliedFilterViewModel.getCurrentClientePredicate().get() == null ?
|
||||||
|
x -> false :
|
||||||
|
mAppliedFilterViewModel.getCurrentClientePredicate().get())
|
||||||
|
.map(OrdineUscitaInevasoDTO::getRagSocOrd)
|
||||||
|
.toList());
|
||||||
|
break;
|
||||||
|
|
||||||
|
case OrdiniUscitaElencoBindings.VETTORE_FILTER_ID:
|
||||||
|
((FilterVettoreLayoutView) filterLayoutView)
|
||||||
|
.setAllVettori(mAppliedFilterViewModel.getAllVettori())
|
||||||
|
.setAvailableVettori(mAppliedFilterViewModel.getAvailableVettori())
|
||||||
|
.setOnFilterApplied(mAppliedFilterViewModel::setVettoreFilter)
|
||||||
|
.setPreSelectedVettori(Stream.of(Objects.requireNonNull(mViewModel.getOrderList().getValue()))
|
||||||
|
.filter(mAppliedFilterViewModel.getCurrentVettorePredicate().get() == null ?
|
||||||
|
x -> false :
|
||||||
|
mAppliedFilterViewModel.getCurrentVettorePredicate().get())
|
||||||
|
.map(x -> x.getCodVvet() + (!UtilityString.isNullOrEmpty(x.getCodVvet()) ? " - " + x.getDescrizioneVettore() : ""))
|
||||||
|
.toList());
|
||||||
|
break;
|
||||||
|
|
||||||
|
case OrdiniUscitaElencoBindings.AUTOMEZZO_FILTER_ID:
|
||||||
|
((FilterAutomezzoLayoutView) filterLayoutView)
|
||||||
|
.setAllAutomezzi(mAppliedFilterViewModel.getAllAutomezzi())
|
||||||
|
.setAvailableAutomezzi(mAppliedFilterViewModel.getAvailableAutomezzi())
|
||||||
|
.setOnFilterApplied(mAppliedFilterViewModel::setAutomezzoFilter)
|
||||||
|
.setPreSelectedAutomezzi(Stream.of(Objects.requireNonNull(mViewModel.getOrderList().getValue()))
|
||||||
|
.filter(mAppliedFilterViewModel.getCurrentAutomezzoPredicate().get() == null ?
|
||||||
|
x -> false :
|
||||||
|
mAppliedFilterViewModel.getCurrentAutomezzoPredicate().get())
|
||||||
|
.map(OrdineUscitaInevasoDTO::getDescrizioneAuto)
|
||||||
|
.toList());
|
||||||
|
break;
|
||||||
|
|
||||||
|
case OrdiniUscitaElencoBindings.PAESE_FILTER_ID:
|
||||||
|
((FilterPaeseLayoutView) filterLayoutView)
|
||||||
|
.setAllPaesi(mAppliedFilterViewModel.getAllPaesi())
|
||||||
|
.setAvailablePaesi(mAppliedFilterViewModel.getAvailablePaesi())
|
||||||
|
.setOnFilterApplied(mAppliedFilterViewModel::setPaeseFilter)
|
||||||
|
.setPreSelectedPaesi(Stream.of(Objects.requireNonNull(mViewModel.getOrderList().getValue()))
|
||||||
|
.filter(mAppliedFilterViewModel.getCurrentPaesePredicate().get() == null ?
|
||||||
|
x -> false :
|
||||||
|
mAppliedFilterViewModel.getCurrentPaesePredicate().get())
|
||||||
|
.map(OrdineUscitaInevasoDTO::getCitta)
|
||||||
|
.toList());
|
||||||
|
break;
|
||||||
|
|
||||||
|
case OrdiniUscitaElencoBindings.AGENTE_FILTER_ID:
|
||||||
|
((FilterAgenteLayoutView) filterLayoutView)
|
||||||
|
.setAllAgenti(mAppliedFilterViewModel.getAllAgenti())
|
||||||
|
.setAvailableAgenti(mAppliedFilterViewModel.getAvailableAgenti())
|
||||||
|
.setOnFilterApplied(mAppliedFilterViewModel::setAgenteFilter)
|
||||||
|
.setPreSelectedAgenti(Stream.of(Objects.requireNonNull(mViewModel.getOrderList().getValue()))
|
||||||
|
.filter(mAppliedFilterViewModel.getCurrentAgentePredicate().get() == null ?
|
||||||
|
x -> false :
|
||||||
|
mAppliedFilterViewModel.getCurrentAgentePredicate().get())
|
||||||
|
.map(OrdineUscitaInevasoDTO::getCitta)
|
||||||
|
.toList());
|
||||||
|
break;
|
||||||
|
|
||||||
|
case OrdiniUscitaElencoBindings.TERM_CONS_FILTER_ID:
|
||||||
|
((FilterTermConsLayoutView) filterLayoutView)
|
||||||
|
.setAllTermCons(mAppliedFilterViewModel.getAllTermCons())
|
||||||
|
.setAvailableTermCons(mAppliedFilterViewModel.getAvailableTermCons())
|
||||||
|
.setOnFilterApplied(mAppliedFilterViewModel::setTerminiConsegnaFilter)
|
||||||
|
.setPreSelectedTermCons(Stream.of(Objects.requireNonNull(mViewModel.getOrderList().getValue()))
|
||||||
|
.filter(mAppliedFilterViewModel.getCurrentTermConsPredicate().get() == null ?
|
||||||
|
x -> false :
|
||||||
|
mAppliedFilterViewModel.getCurrentTermConsPredicate().get())
|
||||||
|
.map(OrdineUscitaInevasoDTO::getCitta)
|
||||||
|
.toList());
|
||||||
|
break;
|
||||||
|
|
||||||
|
case OrdiniUscitaElencoBindings.GRUPPO_MERC_FILTER_ID:
|
||||||
|
((FilterGruppoMercLayoutView) filterLayoutView)
|
||||||
|
.setAllGroupMerc(mAppliedFilterViewModel.getAllGruppoMerc(mtbGrupCache))
|
||||||
|
.setAvailableGroupMerc(mAppliedFilterViewModel.getAvailableGruppoMerc(mtbGrupCache))
|
||||||
|
.setOnFilterApplied(mAppliedFilterViewModel::setGruppoMercFilter)
|
||||||
|
.setPreSelectedGroupMerc(mAppliedFilterViewModel.getSelectedMtbGrup());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
filterLayoutView.show(requireActivity().getSupportFragmentManager(), "TAG");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private final RunnableArgs<BarcodeScanDTO> onScanSuccessful = data -> {
|
private final RunnableArgs<BarcodeScanDTO> onScanSuccessful = data -> {
|
||||||
BarcodeManager.disable();
|
BarcodeManager.disable();
|
||||||
this.openProgress();
|
this.openProgress();
|
||||||
@@ -210,20 +693,34 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
|
|||||||
};
|
};
|
||||||
|
|
||||||
private void refreshList(List<OrdiniUscitaElencoDTO> filteredList) {
|
private void refreshList(List<OrdiniUscitaElencoDTO> filteredList) {
|
||||||
List<OrdiniUscitaElencoDTO> tmpList = null;
|
this.onLoadingStarted();
|
||||||
|
|
||||||
if(filteredList != null) {
|
//new Thread(() -> {
|
||||||
tmpList = filteredList;
|
|
||||||
} else if (mAppliedFilterViewModel != null) {
|
// requireActivity().runOnUiThread(() -> {
|
||||||
mAppliedFilterViewModel.init(mViewModel.getOrderList().getValue());
|
List<OrdiniUscitaElencoDTO> tmpList;
|
||||||
mAppliedFilterViewModel.applyAllTests();
|
|
||||||
tmpList = mAppliedFilterViewModel.getMutableFilteredOrderList().getValue();
|
if (filteredList != null) {
|
||||||
} else {
|
tmpList = filteredList;
|
||||||
tmpList = mViewModel.getOrderList().getValue();
|
} else if (mAppliedFilterViewModel != null) {
|
||||||
}
|
mAppliedFilterViewModel.applyAllTests();
|
||||||
|
tmpList = mAppliedFilterViewModel.getMutableFilteredOrderList().getValue();
|
||||||
|
} else {
|
||||||
|
tmpList = mViewModel.getOrderList().getValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
var list = convertDataModelToListModel(tmpList);
|
||||||
|
|
||||||
|
this.mOrdiniInevasiMutableData.clear();
|
||||||
|
this.mOrdiniInevasiMutableData.addAll(list);
|
||||||
|
|
||||||
|
fabVisible.set(Stream.of(mOrdiniInevasiMutableData)
|
||||||
|
.anyMatch(y -> y.getSelectedObservable().get()));
|
||||||
|
// });
|
||||||
|
|
||||||
|
this.onLoadingEnded();
|
||||||
|
//}).start();
|
||||||
|
|
||||||
this.mOrdiniInevasiMutableData.clear();
|
|
||||||
this.mOrdiniInevasiMutableData.addAll(convertDataModelToListModel(tmpList));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<OrdiniUscitaElencoListModel> convertDataModelToListModel(List<OrdiniUscitaElencoDTO> dataList) {
|
private List<OrdiniUscitaElencoListModel> convertDataModelToListModel(List<OrdiniUscitaElencoDTO> dataList) {
|
||||||
@@ -285,7 +782,7 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
|
|||||||
.map(OrdiniUscitaElencoListModel::getOriginalModel)
|
.map(OrdiniUscitaElencoListModel::getOriginalModel)
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
this.mViewModel.loadPicking(selectedOrders);
|
this.mViewModel.loadPicking(selectedOrders, this.mAppliedFilterViewModel.getSelectedMtbGrup());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -334,25 +831,30 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private DialogVenditaFiltroAvanzatoViewModel mAppliedFilterViewModel;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFilterClick() {
|
|
||||||
DialogVenditaFiltroAvanzatoView.make(
|
|
||||||
getActivity(),
|
|
||||||
this.mViewModel.getOrderList().getValue(),
|
|
||||||
mAppliedFilterViewModel,
|
|
||||||
|
|
||||||
filter -> {
|
|
||||||
|
|
||||||
mAppliedFilterViewModel = filter;
|
|
||||||
refreshList(null);
|
|
||||||
|
|
||||||
}).show();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addOnPreDestroy(Runnable onPreDestroy) {
|
public void addOnPreDestroy(Runnable onPreDestroy) {
|
||||||
this.mOnPreDestroyList.add(onPreDestroy);
|
this.mOnPreDestroyList.add(onPreDestroy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void initMtbDepoCache(Runnable onComplete) {
|
||||||
|
this.mDepositoRESTConsumer.getAll(mtbDepos -> {
|
||||||
|
this.mtbDepoCache = mtbDepos;
|
||||||
|
onComplete.run();
|
||||||
|
}, this::onError);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void initMtbGrupsCache(Runnable onComplete) {
|
||||||
|
var codMgrpArts = Stream.of(Objects.requireNonNull(this.mViewModel.getOrderList().getValue()))
|
||||||
|
.flatMap(x -> Stream.of(x.getAvailableClassMerc()))
|
||||||
|
.map(OrdineUscitaInevasoDTO.AvailableClassMerc::getCodMgrp)
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
this.mArticoloRESTConsumer.getArtsGroups(codMgrpArts, mtbGrupCache -> {
|
||||||
|
this.mtbGrupCache = mtbGrupCache;
|
||||||
|
onComplete.run();
|
||||||
|
}, this::onError);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
|||||||
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
|
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
|
||||||
import it.integry.integrywmsnative.core.model.DtbOrdt;
|
import it.integry.integrywmsnative.core.model.DtbOrdt;
|
||||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||||
|
import it.integry.integrywmsnative.core.model.MtbGrup;
|
||||||
import it.integry.integrywmsnative.core.model.OrdineInevasoDTO;
|
import it.integry.integrywmsnative.core.model.OrdineInevasoDTO;
|
||||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||||
@@ -81,7 +82,7 @@ public class OrdiniUscitaElencoViewModel {
|
|||||||
|
|
||||||
long forcedDelaySecs = (new Date().getTime() - loadingStartDate.getTime()) / 1000;
|
long forcedDelaySecs = (new Date().getTime() - loadingStartDate.getTime()) / 1000;
|
||||||
|
|
||||||
if(2 - forcedDelaySecs > 0) {
|
if (2 - forcedDelaySecs > 0) {
|
||||||
try {
|
try {
|
||||||
Thread.sleep((2 - forcedDelaySecs) * 1000);
|
Thread.sleep((2 - forcedDelaySecs) * 1000);
|
||||||
} catch (Exception ignored) {
|
} catch (Exception ignored) {
|
||||||
@@ -96,14 +97,14 @@ public class OrdiniUscitaElencoViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void loadPicking(List<OrdiniUscitaElencoDTO> selectedOrders) {
|
public void loadPicking(List<OrdiniUscitaElencoDTO> selectedOrders, List<MtbGrup> mtbGrupToFilter) {
|
||||||
List<GestioneEnum> foundGestioni = Stream.of(selectedOrders)
|
List<GestioneEnum> foundGestioni = Stream.of(selectedOrders)
|
||||||
.map(OrdineUscitaInevasoDTO::getGestioneEnum)
|
.map(OrdineUscitaInevasoDTO::getGestioneEnum)
|
||||||
.withoutNulls()
|
.withoutNulls()
|
||||||
.distinct()
|
.distinct()
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
if(foundGestioni != null && foundGestioni.size() > 1) {
|
if (foundGestioni != null && foundGestioni.size() > 1) {
|
||||||
this.sendError(new InvalidLUMultiGestioneException());
|
this.sendError(new InvalidLUMultiGestioneException());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -115,7 +116,7 @@ public class OrdiniUscitaElencoViewModel {
|
|||||||
.distinct()
|
.distinct()
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
if(foundCodMdep != null && foundCodMdep.size() > 1) {
|
if (foundCodMdep != null && foundCodMdep.size() > 1) {
|
||||||
this.sendError(new InvalidLUMultiCodMdepException());
|
this.sendError(new InvalidLUMultiCodMdepException());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -129,12 +130,20 @@ public class OrdiniUscitaElencoViewModel {
|
|||||||
|
|
||||||
this.mOrdiniRESTConsumer.retrieveListaArticoliFromOrdiniUscita(selectedOrdersBase, sitArts -> {
|
this.mOrdiniRESTConsumer.retrieveListaArticoliFromOrdiniUscita(selectedOrdersBase, sitArts -> {
|
||||||
|
|
||||||
|
if(mtbGrupToFilter != null && !mtbGrupToFilter.isEmpty()) {
|
||||||
|
sitArts = Stream.of(sitArts)
|
||||||
|
.filter(x -> Stream.of(mtbGrupToFilter).map(MtbGrup::getCodMgrp).anyMatch(y -> y.equalsIgnoreCase(x.getCodMgrp())))
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
List<SitArtOrdDTO> finalSitArts = sitArts;
|
||||||
|
|
||||||
this.mOrdiniRESTConsumer.getBancaliGiaRegistrati(
|
this.mOrdiniRESTConsumer.getBancaliGiaRegistrati(
|
||||||
Stream.of(selectedOrdersBase).map(x -> (OrdineInevasoDTO) x).toList(),
|
Stream.of(selectedOrdersBase).map(x -> (OrdineInevasoDTO) x).toList(),
|
||||||
mCurrentGestioneCol,
|
mCurrentGestioneCol,
|
||||||
mCurrentSegnoCol,
|
mCurrentSegnoCol,
|
||||||
mtbColtList -> {
|
mtbColtList -> {
|
||||||
this.sendOnOrdersDispatched(selectedOrdersBase, sitArts, mtbColtList);
|
this.sendOnOrdersDispatched(selectedOrdersBase, finalSitArts, mtbColtList);
|
||||||
|
|
||||||
this.sendOnLoadingEnded();
|
this.sendOnLoadingEnded();
|
||||||
}, this::sendError);
|
}, this::sendError);
|
||||||
@@ -149,11 +158,11 @@ public class OrdiniUscitaElencoViewModel {
|
|||||||
this.sendOnOrderFiltered(orderList);
|
this.sendOnOrderFiltered(orderList);
|
||||||
};
|
};
|
||||||
|
|
||||||
if(UtilityBarcode.isBarcodeOrdineV(barcodeScanDTO)) {
|
if (UtilityBarcode.isBarcodeOrdineV(barcodeScanDTO)) {
|
||||||
this.executeEtichettaOrdineV(barcodeScanDTO.getStringValue(), onBarcodeScanComplete);
|
this.executeEtichettaOrdineV(barcodeScanDTO.getStringValue(), onBarcodeScanComplete);
|
||||||
} else if(UtilityBarcode.isEtichettaAnonima(barcodeScanDTO)) {
|
} else if (UtilityBarcode.isEtichettaAnonima(barcodeScanDTO)) {
|
||||||
this.executeEtichettaLU(barcodeScanDTO.getStringValue(), onBarcodeScanComplete);
|
this.executeEtichettaLU(barcodeScanDTO.getStringValue(), onBarcodeScanComplete);
|
||||||
} else if(UtilityBarcode.isEtichetta128(barcodeScanDTO)){
|
} else if (UtilityBarcode.isEtichetta128(barcodeScanDTO)) {
|
||||||
this.executeEtichettaEan128(barcodeScanDTO, onBarcodeScanComplete);
|
this.executeEtichettaEan128(barcodeScanDTO, onBarcodeScanComplete);
|
||||||
} else {
|
} else {
|
||||||
onComplete.run();
|
onComplete.run();
|
||||||
@@ -161,7 +170,6 @@ public class OrdiniUscitaElencoViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void executeEtichettaOrdineV(String barcode, RunnableArgs<List<OrdiniUscitaElencoDTO>> onComplete) {
|
private void executeEtichettaOrdineV(String barcode, RunnableArgs<List<OrdiniUscitaElencoDTO>> onComplete) {
|
||||||
String gestione = "";
|
String gestione = "";
|
||||||
|
|
||||||
@@ -198,13 +206,13 @@ public class OrdiniUscitaElencoViewModel {
|
|||||||
private void executeEtichettaLU(String SSCC, RunnableArgs<List<OrdiniUscitaElencoDTO>> onComplete) {
|
private void executeEtichettaLU(String SSCC, RunnableArgs<List<OrdiniUscitaElencoDTO>> onComplete) {
|
||||||
this.mColliMagazzinoRESTConsumer.getBySSCC(SSCC, true, false, mtbColt -> {
|
this.mColliMagazzinoRESTConsumer.getBySSCC(SSCC, true, false, mtbColt -> {
|
||||||
|
|
||||||
if(mtbColt != null && mtbColt.getMtbColr() != null && mtbColt.getMtbColr().size() > 0) {
|
if (mtbColt != null && mtbColt.getMtbColr() != null && mtbColt.getMtbColr().size() > 0) {
|
||||||
|
|
||||||
if(mtbColt.getGestioneEnum() == GestioneEnum.ACQUISTO || mtbColt.getGestioneEnum() == GestioneEnum.LAVORAZIONE) {
|
if (mtbColt.getGestioneEnum() == GestioneEnum.ACQUISTO || mtbColt.getGestioneEnum() == GestioneEnum.LAVORAZIONE) {
|
||||||
//GET BY COMMESSA COLLO
|
//GET BY COMMESSA COLLO
|
||||||
this.mOrdiniUscitaElencoRESTConsumer.getOrdiniFromCommessaCollo(mCurrentCodMdep, mtbColt, orderList -> {
|
this.mOrdiniUscitaElencoRESTConsumer.getOrdiniFromCommessaCollo(mCurrentCodMdep, mtbColt, orderList -> {
|
||||||
|
|
||||||
if(orderList != null && orderList.size() > 0) {
|
if (orderList != null && orderList.size() > 0) {
|
||||||
List<Integer> numOrds = Stream.of(orderList)
|
List<Integer> numOrds = Stream.of(orderList)
|
||||||
.map(DtbOrdt::getNumOrd)
|
.map(DtbOrdt::getNumOrd)
|
||||||
.toList();
|
.toList();
|
||||||
@@ -235,14 +243,15 @@ public class OrdiniUscitaElencoViewModel {
|
|||||||
this.mBarcodeRESTConsumer.decodeEan128(barcodeScanDTO, ean128Model -> {
|
this.mBarcodeRESTConsumer.decodeEan128(barcodeScanDTO, ean128Model -> {
|
||||||
String barcodeProd = null;
|
String barcodeProd = null;
|
||||||
|
|
||||||
if(!UtilityString.isNullOrEmpty(ean128Model.Sscc)) barcodeProd = ean128Model.Sscc;
|
if (!UtilityString.isNullOrEmpty(ean128Model.Sscc)) barcodeProd = ean128Model.Sscc;
|
||||||
if(!UtilityString.isNullOrEmpty(ean128Model.Gtin)) barcodeProd = ean128Model.Gtin;
|
if (!UtilityString.isNullOrEmpty(ean128Model.Gtin)) barcodeProd = ean128Model.Gtin;
|
||||||
if(!UtilityString.isNullOrEmpty(ean128Model.Content)) barcodeProd = ean128Model.Content;
|
if (!UtilityString.isNullOrEmpty(ean128Model.Content))
|
||||||
|
barcodeProd = ean128Model.Content;
|
||||||
|
|
||||||
|
|
||||||
if(!UtilityString.isNullOrEmpty(barcodeProd)) {
|
if (!UtilityString.isNullOrEmpty(barcodeProd)) {
|
||||||
|
|
||||||
if(!UtilityString.isNullOrEmpty(ean128Model.Sscc)){
|
if (!UtilityString.isNullOrEmpty(ean128Model.Sscc)) {
|
||||||
this.executeEtichettaLU(ean128Model.Sscc, onComplete);
|
this.executeEtichettaLU(ean128Model.Sscc, onComplete);
|
||||||
} else {
|
} else {
|
||||||
this.sendError(new NoLUFoundException());
|
this.sendError(new NoLUFoundException());
|
||||||
@@ -280,7 +289,8 @@ public class OrdiniUscitaElencoViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void sendOnOrdersDispatched(List<OrdineUscitaInevasoDTO> orders, List<SitArtOrdDTO> sitArts, List<MtbColt> alreadyRegisteredMtbColts) {
|
private void sendOnOrdersDispatched(List<OrdineUscitaInevasoDTO> orders, List<SitArtOrdDTO> sitArts, List<MtbColt> alreadyRegisteredMtbColts) {
|
||||||
if (this.mListener != null) mListener.onOrdersDispatched(orders, sitArts, alreadyRegisteredMtbColts);
|
if (this.mListener != null)
|
||||||
|
mListener.onOrdersDispatched(orders, sitArts, alreadyRegisteredMtbColts);
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface Listener extends ILoadingListener {
|
public interface Listener extends ILoadingListener {
|
||||||
|
|||||||
@@ -0,0 +1,173 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.databinding.DataBindingUtil;
|
||||||
|
import androidx.lifecycle.MutableLiveData;
|
||||||
|
|
||||||
|
import com.annimon.stream.ComparatorCompat;
|
||||||
|
import com.annimon.stream.Stream;
|
||||||
|
import com.ravikoradiya.liveadapter.LiveAdapter;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.BR;
|
||||||
|
import it.integry.integrywmsnative.R;
|
||||||
|
import it.integry.integrywmsnative.core.di.BindableBoolean;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityBoolean;
|
||||||
|
import it.integry.integrywmsnative.databinding.LayoutFilterAgenteBinding;
|
||||||
|
import it.integry.integrywmsnative.ui.filter_chips.FilterLayoutView;
|
||||||
|
|
||||||
|
public class FilterAgenteLayoutView extends FilterLayoutView {
|
||||||
|
|
||||||
|
protected LayoutFilterAgenteBinding mBindings;
|
||||||
|
|
||||||
|
private List<String> allAgenti;
|
||||||
|
private List<String> availableAgenti;
|
||||||
|
private List<String> preSelectedAgenti = new ArrayList<>();
|
||||||
|
private List<String> hiddenAgenti = new ArrayList<>();
|
||||||
|
private final MutableLiveData<List<ListModel>> listModel = new MutableLiveData<>();
|
||||||
|
|
||||||
|
private RunnableArgs<List<String>> onFilterApplied;
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
|
mBindings = DataBindingUtil.inflate(inflater, R.layout.layout_filter_agente, container, false);
|
||||||
|
this.mBindings.setView(this);
|
||||||
|
|
||||||
|
refreshList();
|
||||||
|
|
||||||
|
this.setSearchView(this.mBindings.searchView, newFilter -> {
|
||||||
|
hiddenAgenti = Stream.of(allAgenti)
|
||||||
|
.filter(x -> !x.toUpperCase(Locale.ROOT).contains(newFilter.toUpperCase(Locale.ROOT)))
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
refreshList();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
new LiveAdapter(listModel, getViewLifecycleOwner(), BR.item)
|
||||||
|
.map(ListModel.class, R.layout.layout_filter_agente__list_item)
|
||||||
|
.into(this.mBindings.recyclerview);
|
||||||
|
|
||||||
|
return mBindings.getRoot();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshList() {
|
||||||
|
ComparatorCompat<ListModel> c =
|
||||||
|
ComparatorCompat
|
||||||
|
.chain(new ComparatorCompat<ListModel>((x, y) -> UtilityBoolean.toInt(x.getSelected().get()) - UtilityBoolean.toInt(y.getSelected().get())))
|
||||||
|
.thenComparing(new ComparatorCompat<>((x, y) -> UtilityBoolean.toInt(x.getEnabled().get()) - UtilityBoolean.toInt(y.getEnabled().get())))
|
||||||
|
.thenComparing(new ComparatorCompat<>((x, y) -> y.getOriginalModel().compareTo(x.getOriginalModel())))
|
||||||
|
.reversed();
|
||||||
|
|
||||||
|
listModel.setValue(Stream.of(getAllAgenti())
|
||||||
|
.filter(x -> !hiddenAgenti.contains(x))
|
||||||
|
.map(x -> {
|
||||||
|
var selectedBoolean = new BindableBoolean(preSelectedAgenti.contains(x));
|
||||||
|
selectedBoolean.addOnPropertyChangedCallback(() -> {
|
||||||
|
if (selectedBoolean.get()) preSelectedAgenti.add(x);
|
||||||
|
else preSelectedAgenti.remove(x);
|
||||||
|
});
|
||||||
|
|
||||||
|
return new ListModel()
|
||||||
|
.setSelected(selectedBoolean)
|
||||||
|
.setEnabled(new BindableBoolean(availableAgenti.contains(x)))
|
||||||
|
.setOriginalModel(x);
|
||||||
|
})
|
||||||
|
.sorted(c)
|
||||||
|
.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void onConfirm() {
|
||||||
|
if (onFilterApplied == null) return;
|
||||||
|
|
||||||
|
this.onFilterApplied.run(Stream.of(Objects.requireNonNull(listModel.getValue()))
|
||||||
|
.filter(x -> x.selected.get())
|
||||||
|
.map(x -> x.originalModel)
|
||||||
|
.toList());
|
||||||
|
|
||||||
|
dismiss();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getAllAgenti() {
|
||||||
|
return allAgenti;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterAgenteLayoutView setAllAgenti(List<String> allAgenti) {
|
||||||
|
this.allAgenti = allAgenti;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getAvailableAgenti() {
|
||||||
|
return availableAgenti;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterAgenteLayoutView setAvailableAgenti(List<String> availableAgenti) {
|
||||||
|
this.availableAgenti = availableAgenti;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getPreSelectedAgenti() {
|
||||||
|
return preSelectedAgenti;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterAgenteLayoutView setPreSelectedAgenti(List<String> preSelectedAgenti) {
|
||||||
|
this.preSelectedAgenti = preSelectedAgenti;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RunnableArgs<List<String>> getOnFilterApplied() {
|
||||||
|
return onFilterApplied;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterAgenteLayoutView setOnFilterApplied(RunnableArgs<List<String>> onFilterApplied) {
|
||||||
|
this.onFilterApplied = onFilterApplied;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class ListModel {
|
||||||
|
private BindableBoolean selected = new BindableBoolean();
|
||||||
|
private BindableBoolean enabled = new BindableBoolean();
|
||||||
|
private String originalModel;
|
||||||
|
|
||||||
|
public BindableBoolean getSelected() {
|
||||||
|
return selected;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ListModel setSelected(BindableBoolean selected) {
|
||||||
|
this.selected = selected;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BindableBoolean getEnabled() {
|
||||||
|
return enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ListModel setEnabled(BindableBoolean enabled) {
|
||||||
|
this.enabled = enabled;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOriginalModel() {
|
||||||
|
return originalModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ListModel setOriginalModel(String originalModel) {
|
||||||
|
this.originalModel = originalModel;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,172 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.databinding.DataBindingUtil;
|
||||||
|
import androidx.lifecycle.MutableLiveData;
|
||||||
|
|
||||||
|
import com.annimon.stream.ComparatorCompat;
|
||||||
|
import com.annimon.stream.Stream;
|
||||||
|
import com.ravikoradiya.liveadapter.LiveAdapter;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.BR;
|
||||||
|
import it.integry.integrywmsnative.R;
|
||||||
|
import it.integry.integrywmsnative.core.di.BindableBoolean;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityBoolean;
|
||||||
|
import it.integry.integrywmsnative.databinding.LayoutFilterAutomezzoBinding;
|
||||||
|
import it.integry.integrywmsnative.ui.filter_chips.FilterLayoutView;
|
||||||
|
|
||||||
|
public class FilterAutomezzoLayoutView extends FilterLayoutView {
|
||||||
|
|
||||||
|
protected LayoutFilterAutomezzoBinding mBindings;
|
||||||
|
|
||||||
|
private List<String> allAutomezzi;
|
||||||
|
private List<String> availableAutomezzi;
|
||||||
|
private List<String> preSelectedAutomezzi = new ArrayList<>();
|
||||||
|
private List<String> hiddenAutomezzi = new ArrayList<>();
|
||||||
|
private MutableLiveData<List<ListModel>> listModel = new MutableLiveData<>();
|
||||||
|
|
||||||
|
private RunnableArgs<List<String>> onFilterApplied;
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
|
mBindings = DataBindingUtil.inflate(inflater, R.layout.layout_filter_automezzo, container, false);
|
||||||
|
this.mBindings.setView(this);
|
||||||
|
|
||||||
|
refreshList();
|
||||||
|
|
||||||
|
this.setSearchView(this.mBindings.searchView, newFilter -> {
|
||||||
|
hiddenAutomezzi = Stream.of(allAutomezzi)
|
||||||
|
.filter(x -> !x.toUpperCase(Locale.ROOT).contains(newFilter.toUpperCase(Locale.ROOT)))
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
refreshList();
|
||||||
|
});
|
||||||
|
|
||||||
|
new LiveAdapter(listModel, getViewLifecycleOwner(), BR.item)
|
||||||
|
.map(ListModel.class, R.layout.layout_filter_automezzo__list_item)
|
||||||
|
.into(this.mBindings.recyclerview);
|
||||||
|
|
||||||
|
return mBindings.getRoot();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshList() {
|
||||||
|
ComparatorCompat<ListModel> c =
|
||||||
|
ComparatorCompat
|
||||||
|
.chain(new ComparatorCompat<ListModel>((x, y) -> UtilityBoolean.toInt(x.getSelected().get()) - UtilityBoolean.toInt(y.getSelected().get())))
|
||||||
|
.thenComparing(new ComparatorCompat<>((x, y) -> UtilityBoolean.toInt(x.getEnabled().get()) - UtilityBoolean.toInt(y.getEnabled().get())))
|
||||||
|
.thenComparing(new ComparatorCompat<>((x, y) -> y.getOriginalModel().compareTo(x.getOriginalModel())))
|
||||||
|
.reversed();
|
||||||
|
|
||||||
|
listModel.setValue(Stream.of(getAllAutomezzi())
|
||||||
|
.filter(x -> !hiddenAutomezzi.contains(x))
|
||||||
|
.map(x -> {
|
||||||
|
var selectedBoolean = new BindableBoolean(preSelectedAutomezzi.contains(x));
|
||||||
|
selectedBoolean.addOnPropertyChangedCallback(() -> {
|
||||||
|
if (selectedBoolean.get()) preSelectedAutomezzi.add(x);
|
||||||
|
else preSelectedAutomezzi.remove(x);
|
||||||
|
});
|
||||||
|
|
||||||
|
return new ListModel()
|
||||||
|
.setSelected(selectedBoolean)
|
||||||
|
.setEnabled(new BindableBoolean(availableAutomezzi.contains(x)))
|
||||||
|
.setOriginalModel(x);
|
||||||
|
})
|
||||||
|
.sorted(c)
|
||||||
|
.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void onConfirm() {
|
||||||
|
if (onFilterApplied == null) return;
|
||||||
|
|
||||||
|
this.onFilterApplied.run(Stream.of(Objects.requireNonNull(listModel.getValue()))
|
||||||
|
.filter(x -> x.selected.get())
|
||||||
|
.map(x -> x.originalModel)
|
||||||
|
.toList());
|
||||||
|
|
||||||
|
dismiss();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getAllAutomezzi() {
|
||||||
|
return allAutomezzi;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterAutomezzoLayoutView setAllAutomezzi(List<String> allAutomezzi) {
|
||||||
|
this.allAutomezzi = allAutomezzi;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getAvailableAutomezzi() {
|
||||||
|
return availableAutomezzi;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterAutomezzoLayoutView setAvailableAutomezzi(List<String> availableAutomezzi) {
|
||||||
|
this.availableAutomezzi = availableAutomezzi;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getPreSelectedAutomezzi() {
|
||||||
|
return preSelectedAutomezzi;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterAutomezzoLayoutView setPreSelectedAutomezzi(List<String> preSelectedAutomezzi) {
|
||||||
|
this.preSelectedAutomezzi = preSelectedAutomezzi;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RunnableArgs<List<String>> getOnFilterApplied() {
|
||||||
|
return onFilterApplied;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterAutomezzoLayoutView setOnFilterApplied(RunnableArgs<List<String>> onFilterApplied) {
|
||||||
|
this.onFilterApplied = onFilterApplied;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class ListModel {
|
||||||
|
private BindableBoolean selected = new BindableBoolean();
|
||||||
|
private BindableBoolean enabled = new BindableBoolean();
|
||||||
|
private String originalModel;
|
||||||
|
|
||||||
|
public BindableBoolean getSelected() {
|
||||||
|
return selected;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ListModel setSelected(BindableBoolean selected) {
|
||||||
|
this.selected = selected;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BindableBoolean getEnabled() {
|
||||||
|
return enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ListModel setEnabled(BindableBoolean enabled) {
|
||||||
|
this.enabled = enabled;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOriginalModel() {
|
||||||
|
return originalModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ListModel setOriginalModel(String originalModel) {
|
||||||
|
this.originalModel = originalModel;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,172 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.databinding.DataBindingUtil;
|
||||||
|
import androidx.lifecycle.MutableLiveData;
|
||||||
|
|
||||||
|
import com.annimon.stream.ComparatorCompat;
|
||||||
|
import com.annimon.stream.Stream;
|
||||||
|
import com.ravikoradiya.liveadapter.LiveAdapter;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.BR;
|
||||||
|
import it.integry.integrywmsnative.R;
|
||||||
|
import it.integry.integrywmsnative.core.di.BindableBoolean;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityBoolean;
|
||||||
|
import it.integry.integrywmsnative.databinding.LayoutFilterClienteBinding;
|
||||||
|
import it.integry.integrywmsnative.ui.filter_chips.FilterLayoutView;
|
||||||
|
|
||||||
|
public class FilterClienteLayoutView extends FilterLayoutView {
|
||||||
|
|
||||||
|
protected LayoutFilterClienteBinding mBindings;
|
||||||
|
|
||||||
|
private List<String> allClienti;
|
||||||
|
private List<String> availableClienti;
|
||||||
|
private List<String> preSelectedClienti = new ArrayList<>();
|
||||||
|
private List<String> hiddenClienti = new ArrayList<>();
|
||||||
|
private final MutableLiveData<List<ListModel>> listModel = new MutableLiveData<>();
|
||||||
|
|
||||||
|
private RunnableArgs<List<String>> onFilterApplied;
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
|
mBindings = DataBindingUtil.inflate(inflater, R.layout.layout_filter_cliente, container, false);
|
||||||
|
this.mBindings.setView(this);
|
||||||
|
|
||||||
|
refreshList();
|
||||||
|
|
||||||
|
this.setSearchView(this.mBindings.searchView, newFilter -> {
|
||||||
|
hiddenClienti = Stream.of(allClienti)
|
||||||
|
.filter(x -> !x.toUpperCase(Locale.ROOT).contains(newFilter.toUpperCase(Locale.ROOT)))
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
refreshList();
|
||||||
|
});
|
||||||
|
|
||||||
|
new LiveAdapter(listModel, getViewLifecycleOwner(), BR.item)
|
||||||
|
.map(ListModel.class, R.layout.layout_filter_cliente__list_item)
|
||||||
|
.into(this.mBindings.recyclerview);
|
||||||
|
|
||||||
|
return mBindings.getRoot();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshList() {
|
||||||
|
ComparatorCompat<ListModel> c =
|
||||||
|
ComparatorCompat
|
||||||
|
.chain(new ComparatorCompat<ListModel>((x, y) -> UtilityBoolean.toInt(x.getSelected().get()) - UtilityBoolean.toInt(y.getSelected().get())))
|
||||||
|
.thenComparing(new ComparatorCompat<>((x, y) -> UtilityBoolean.toInt(x.getEnabled().get()) - UtilityBoolean.toInt(y.getEnabled().get())))
|
||||||
|
.thenComparing(new ComparatorCompat<>((x, y) -> y.getOriginalModel().compareTo(x.getOriginalModel())))
|
||||||
|
.reversed();
|
||||||
|
|
||||||
|
listModel.setValue(Stream.of(getAllClienti())
|
||||||
|
.filter(x -> !hiddenClienti.contains(x))
|
||||||
|
.map(x -> {
|
||||||
|
var selectedBoolean = new BindableBoolean(preSelectedClienti.contains(x));
|
||||||
|
selectedBoolean.addOnPropertyChangedCallback(() -> {
|
||||||
|
if (selectedBoolean.get()) preSelectedClienti.add(x);
|
||||||
|
else preSelectedClienti.remove(x);
|
||||||
|
});
|
||||||
|
|
||||||
|
return new ListModel()
|
||||||
|
.setSelected(selectedBoolean)
|
||||||
|
.setEnabled(new BindableBoolean(availableClienti.contains(x)))
|
||||||
|
.setOriginalModel(x);
|
||||||
|
})
|
||||||
|
.sorted(c)
|
||||||
|
.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void onConfirm() {
|
||||||
|
if (onFilterApplied == null) return;
|
||||||
|
|
||||||
|
this.onFilterApplied.run(Stream.of(Objects.requireNonNull(listModel.getValue()))
|
||||||
|
.filter(x -> x.selected.get())
|
||||||
|
.map(x -> x.originalModel)
|
||||||
|
.toList());
|
||||||
|
|
||||||
|
dismiss();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getAllClienti() {
|
||||||
|
return allClienti;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterClienteLayoutView setAllClienti(List<String> allClienti) {
|
||||||
|
this.allClienti = allClienti;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getAvailableClienti() {
|
||||||
|
return availableClienti;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterClienteLayoutView setAvailableClienti(List<String> availableClienti) {
|
||||||
|
this.availableClienti = availableClienti;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getPreSelectedClienti() {
|
||||||
|
return preSelectedClienti;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterClienteLayoutView setPreSelectedClienti(List<String> preSelectedClienti) {
|
||||||
|
this.preSelectedClienti = preSelectedClienti;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RunnableArgs<List<String>> getOnFilterApplied() {
|
||||||
|
return onFilterApplied;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterClienteLayoutView setOnFilterApplied(RunnableArgs<List<String>> onFilterApplied) {
|
||||||
|
this.onFilterApplied = onFilterApplied;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class ListModel {
|
||||||
|
private BindableBoolean selected = new BindableBoolean();
|
||||||
|
private BindableBoolean enabled = new BindableBoolean();
|
||||||
|
private String originalModel;
|
||||||
|
|
||||||
|
public BindableBoolean getSelected() {
|
||||||
|
return selected;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ListModel setSelected(BindableBoolean selected) {
|
||||||
|
this.selected = selected;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BindableBoolean getEnabled() {
|
||||||
|
return enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ListModel setEnabled(BindableBoolean enabled) {
|
||||||
|
this.enabled = enabled;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOriginalModel() {
|
||||||
|
return originalModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ListModel setOriginalModel(String originalModel) {
|
||||||
|
this.originalModel = originalModel;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,175 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.databinding.DataBindingUtil;
|
||||||
|
import androidx.lifecycle.MutableLiveData;
|
||||||
|
|
||||||
|
import com.annimon.stream.ComparatorCompat;
|
||||||
|
import com.annimon.stream.Stream;
|
||||||
|
import com.ravikoradiya.liveadapter.LiveAdapter;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.BR;
|
||||||
|
import it.integry.integrywmsnative.R;
|
||||||
|
import it.integry.integrywmsnative.core.di.BindableBoolean;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
|
import it.integry.integrywmsnative.core.model.MtbDepo;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityBoolean;
|
||||||
|
import it.integry.integrywmsnative.databinding.LayoutFilterDepositoBinding;
|
||||||
|
import it.integry.integrywmsnative.ui.filter_chips.FilterLayoutView;
|
||||||
|
|
||||||
|
public class FilterDepositoLayoutView extends FilterLayoutView {
|
||||||
|
|
||||||
|
protected LayoutFilterDepositoBinding mBindings;
|
||||||
|
|
||||||
|
private List<MtbDepo> allCodMdeps;
|
||||||
|
private List<MtbDepo> availableCodMdeps;
|
||||||
|
private List<MtbDepo> preSelectedCodMdeps = new ArrayList<>();
|
||||||
|
private List<MtbDepo> hiddenDepos = new ArrayList<>();
|
||||||
|
private final MutableLiveData<List<ListModel>> listModel = new MutableLiveData<>();
|
||||||
|
|
||||||
|
private RunnableArgs<List<MtbDepo>> onFilterApplied;
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
|
mBindings = DataBindingUtil.inflate(inflater, R.layout.layout_filter_deposito, container, false);
|
||||||
|
this.mBindings.setView(this);
|
||||||
|
|
||||||
|
refreshList();
|
||||||
|
|
||||||
|
this.setSearchView(this.mBindings.searchView, newFilter -> {
|
||||||
|
hiddenDepos = Stream.of(allCodMdeps)
|
||||||
|
.filter(x -> !x.getCodMdep().toUpperCase(Locale.ROOT).contains(newFilter.toUpperCase(Locale.ROOT)) &&
|
||||||
|
!x.getDescrizione().toUpperCase(Locale.ROOT).contains(newFilter.toUpperCase(Locale.ROOT)))
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
refreshList();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
new LiveAdapter(listModel, getViewLifecycleOwner(), BR.item)
|
||||||
|
.map(ListModel.class, R.layout.layout_filter_deposito__list_item)
|
||||||
|
.into(this.mBindings.recyclerviewDepositi);
|
||||||
|
|
||||||
|
return mBindings.getRoot();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void onConfirm() {
|
||||||
|
if (onFilterApplied == null) return;
|
||||||
|
|
||||||
|
this.onFilterApplied.run(Stream.of(Objects.requireNonNull(listModel.getValue()))
|
||||||
|
.filter(x -> x.selected.get())
|
||||||
|
.map(x -> x.originalModel)
|
||||||
|
.toList());
|
||||||
|
|
||||||
|
dismiss();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshList() {
|
||||||
|
ComparatorCompat<ListModel> c =
|
||||||
|
ComparatorCompat
|
||||||
|
.chain(new ComparatorCompat<ListModel>((x, y) -> UtilityBoolean.toInt(x.getSelected().get()) - UtilityBoolean.toInt(y.getSelected().get())))
|
||||||
|
.thenComparing(new ComparatorCompat<>((x, y) -> UtilityBoolean.toInt(x.getEnabled().get()) - UtilityBoolean.toInt(y.getEnabled().get())))
|
||||||
|
.thenComparing(new ComparatorCompat<>((x, y) -> y.getOriginalModel().getCodMdep().compareToIgnoreCase(x.getOriginalModel().getCodMdep())))
|
||||||
|
.reversed();
|
||||||
|
|
||||||
|
|
||||||
|
listModel.setValue(Stream.of(getAllCodMdeps())
|
||||||
|
.filter(x -> !hiddenDepos.contains(x))
|
||||||
|
.map(x -> {
|
||||||
|
var selectedBoolean = new BindableBoolean(preSelectedCodMdeps.contains(x));
|
||||||
|
selectedBoolean.addOnPropertyChangedCallback(() -> {
|
||||||
|
if (selectedBoolean.get()) preSelectedCodMdeps.add(x);
|
||||||
|
else preSelectedCodMdeps.remove(x);
|
||||||
|
});
|
||||||
|
|
||||||
|
return new ListModel()
|
||||||
|
.setSelected(selectedBoolean)
|
||||||
|
.setEnabled(new BindableBoolean(availableCodMdeps.contains(x)))
|
||||||
|
.setOriginalModel(x);
|
||||||
|
})
|
||||||
|
.sorted(c)
|
||||||
|
.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<MtbDepo> getAllCodMdeps() {
|
||||||
|
return allCodMdeps;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterDepositoLayoutView setAllCodMdeps(List<MtbDepo> allCodMdeps) {
|
||||||
|
this.allCodMdeps = allCodMdeps;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<MtbDepo> getAvailableCodMdeps() {
|
||||||
|
return availableCodMdeps;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterDepositoLayoutView setAvailableCodMdeps(List<MtbDepo> availableCodMdeps) {
|
||||||
|
this.availableCodMdeps = availableCodMdeps;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<MtbDepo> getPreSelectedCodMdeps() {
|
||||||
|
return preSelectedCodMdeps;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterDepositoLayoutView setPreSelectedCodMdeps(List<MtbDepo> preSelectedCodMdeps) {
|
||||||
|
this.preSelectedCodMdeps = preSelectedCodMdeps;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RunnableArgs<List<MtbDepo>> getOnFilterApplied() {
|
||||||
|
return onFilterApplied;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterDepositoLayoutView setOnFilterApplied(RunnableArgs<List<MtbDepo>> onFilterApplied) {
|
||||||
|
this.onFilterApplied = onFilterApplied;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class ListModel {
|
||||||
|
private BindableBoolean selected = new BindableBoolean();
|
||||||
|
private BindableBoolean enabled = new BindableBoolean();
|
||||||
|
private MtbDepo originalModel;
|
||||||
|
|
||||||
|
public BindableBoolean getSelected() {
|
||||||
|
return selected;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ListModel setSelected(BindableBoolean selected) {
|
||||||
|
this.selected = selected;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BindableBoolean getEnabled() {
|
||||||
|
return enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ListModel setEnabled(BindableBoolean enabled) {
|
||||||
|
this.enabled = enabled;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MtbDepo getOriginalModel() {
|
||||||
|
return originalModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ListModel setOriginalModel(MtbDepo originalModel) {
|
||||||
|
this.originalModel = originalModel;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,175 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.databinding.DataBindingUtil;
|
||||||
|
import androidx.lifecycle.MutableLiveData;
|
||||||
|
|
||||||
|
import com.annimon.stream.ComparatorCompat;
|
||||||
|
import com.annimon.stream.Stream;
|
||||||
|
import com.ravikoradiya.liveadapter.LiveAdapter;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.BR;
|
||||||
|
import it.integry.integrywmsnative.R;
|
||||||
|
import it.integry.integrywmsnative.core.di.BindableBoolean;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
|
import it.integry.integrywmsnative.core.model.MtbGrup;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityBoolean;
|
||||||
|
import it.integry.integrywmsnative.databinding.LayoutFilterGruppoMercBinding;
|
||||||
|
import it.integry.integrywmsnative.ui.filter_chips.FilterLayoutView;
|
||||||
|
|
||||||
|
public class FilterGruppoMercLayoutView extends FilterLayoutView {
|
||||||
|
|
||||||
|
protected LayoutFilterGruppoMercBinding mBindings;
|
||||||
|
|
||||||
|
private List<MtbGrup> allGroupMerc;
|
||||||
|
private List<MtbGrup> availableGroupMerc;
|
||||||
|
private List<MtbGrup> preSelectedGroupMerc = new ArrayList<>();
|
||||||
|
private List<MtbGrup> hiddenGroupMerc = new ArrayList<>();
|
||||||
|
private final MutableLiveData<List<ListModel>> listModel = new MutableLiveData<>();
|
||||||
|
|
||||||
|
private RunnableArgs<List<MtbGrup>> onFilterApplied;
|
||||||
|
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
|
mBindings = DataBindingUtil.inflate(inflater, R.layout.layout_filter_gruppo_merc, container, false);
|
||||||
|
this.mBindings.setView(this);
|
||||||
|
|
||||||
|
refreshList();
|
||||||
|
|
||||||
|
this.setSearchView(this.mBindings.searchView, newFilter -> {
|
||||||
|
hiddenGroupMerc = Stream.of(allGroupMerc)
|
||||||
|
.filter(x -> !x.getCodMgrp().toUpperCase(Locale.ROOT).contains(newFilter.toUpperCase(Locale.ROOT)) &&
|
||||||
|
!x.getDescrizione().toUpperCase(Locale.ROOT).contains(newFilter.toUpperCase(Locale.ROOT)))
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
refreshList();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
new LiveAdapter(listModel, getViewLifecycleOwner(), BR.item)
|
||||||
|
.map(ListModel.class, R.layout.layout_filter_gruppo_merc__list_item)
|
||||||
|
.into(this.mBindings.recyclerview);
|
||||||
|
|
||||||
|
return mBindings.getRoot();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshList() {
|
||||||
|
ComparatorCompat<ListModel> c =
|
||||||
|
ComparatorCompat
|
||||||
|
.chain(new ComparatorCompat<ListModel>((x, y) -> UtilityBoolean.toInt(x.getSelected().get()) - UtilityBoolean.toInt(y.getSelected().get())))
|
||||||
|
.thenComparing(new ComparatorCompat<>((x, y) -> UtilityBoolean.toInt(x.getEnabled().get()) - UtilityBoolean.toInt(y.getEnabled().get())))
|
||||||
|
.thenComparing(new ComparatorCompat<>((x, y) -> y.getOriginalModel().getCodMgrp().compareTo(x.getOriginalModel().getCodMgrp())))
|
||||||
|
.reversed();
|
||||||
|
|
||||||
|
listModel.setValue(Stream.of(getAllGroupMerc())
|
||||||
|
.filter(x -> !hiddenGroupMerc.contains(x))
|
||||||
|
.map(x -> {
|
||||||
|
var selectedBoolean = new BindableBoolean(preSelectedGroupMerc.contains(x));
|
||||||
|
selectedBoolean.addOnPropertyChangedCallback(() -> {
|
||||||
|
if (selectedBoolean.get()) preSelectedGroupMerc.add(x);
|
||||||
|
else preSelectedGroupMerc.remove(x);
|
||||||
|
});
|
||||||
|
|
||||||
|
return new ListModel()
|
||||||
|
.setSelected(new BindableBoolean(preSelectedGroupMerc.contains(x)))
|
||||||
|
.setEnabled(new BindableBoolean(availableGroupMerc.contains(x)))
|
||||||
|
.setOriginalModel(x);
|
||||||
|
})
|
||||||
|
.sorted(c)
|
||||||
|
.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void onConfirm() {
|
||||||
|
if (onFilterApplied == null) return;
|
||||||
|
|
||||||
|
this.onFilterApplied.run(Stream.of(Objects.requireNonNull(listModel.getValue()))
|
||||||
|
.filter(x -> x.selected.get())
|
||||||
|
.map(x -> x.originalModel)
|
||||||
|
.toList());
|
||||||
|
|
||||||
|
dismiss();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<MtbGrup> getAllGroupMerc() {
|
||||||
|
return allGroupMerc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterGruppoMercLayoutView setAllGroupMerc(List<MtbGrup> allGroupMerc) {
|
||||||
|
this.allGroupMerc = allGroupMerc;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<MtbGrup> getAvailableGroupMerc() {
|
||||||
|
return availableGroupMerc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterGruppoMercLayoutView setAvailableGroupMerc(List<MtbGrup> availableGroupMerc) {
|
||||||
|
this.availableGroupMerc = availableGroupMerc;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<MtbGrup> getPreSelectedGroupMerc() {
|
||||||
|
return preSelectedGroupMerc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterGruppoMercLayoutView setPreSelectedGroupMerc(List<MtbGrup> preSelectedGroupMerc) {
|
||||||
|
this.preSelectedGroupMerc = preSelectedGroupMerc;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RunnableArgs<List<MtbGrup>> getOnFilterApplied() {
|
||||||
|
return onFilterApplied;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterGruppoMercLayoutView setOnFilterApplied(RunnableArgs<List<MtbGrup>> onFilterApplied) {
|
||||||
|
this.onFilterApplied = onFilterApplied;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class ListModel {
|
||||||
|
private BindableBoolean selected = new BindableBoolean();
|
||||||
|
private BindableBoolean enabled = new BindableBoolean();
|
||||||
|
private MtbGrup originalModel;
|
||||||
|
|
||||||
|
public BindableBoolean getSelected() {
|
||||||
|
return selected;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ListModel setSelected(BindableBoolean selected) {
|
||||||
|
this.selected = selected;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BindableBoolean getEnabled() {
|
||||||
|
return enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ListModel setEnabled(BindableBoolean enabled) {
|
||||||
|
this.enabled = enabled;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MtbGrup getOriginalModel() {
|
||||||
|
return originalModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ListModel setOriginalModel(MtbGrup originalModel) {
|
||||||
|
this.originalModel = originalModel;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,172 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.databinding.DataBindingUtil;
|
||||||
|
import androidx.lifecycle.MutableLiveData;
|
||||||
|
|
||||||
|
import com.annimon.stream.ComparatorCompat;
|
||||||
|
import com.annimon.stream.Stream;
|
||||||
|
import com.ravikoradiya.liveadapter.LiveAdapter;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.BR;
|
||||||
|
import it.integry.integrywmsnative.R;
|
||||||
|
import it.integry.integrywmsnative.core.di.BindableBoolean;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityBoolean;
|
||||||
|
import it.integry.integrywmsnative.databinding.LayoutFilterNumeroOrdineBinding;
|
||||||
|
import it.integry.integrywmsnative.ui.filter_chips.FilterLayoutView;
|
||||||
|
|
||||||
|
public class FilterNumeroOrdineLayoutView extends FilterLayoutView {
|
||||||
|
|
||||||
|
protected LayoutFilterNumeroOrdineBinding mBindings;
|
||||||
|
|
||||||
|
private List<Integer> allNumOrds;
|
||||||
|
private List<Integer> availableNumOrds;
|
||||||
|
private List<Integer> preSelectedNumOrds = new ArrayList<>();
|
||||||
|
private List<Integer> hiddenNumOrds = new ArrayList<>();
|
||||||
|
private final MutableLiveData<List<ListModel>> listModel = new MutableLiveData<>();
|
||||||
|
|
||||||
|
private RunnableArgs<List<Integer>> onFilterApplied;
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
|
mBindings = DataBindingUtil.inflate(inflater, R.layout.layout_filter_numero_ordine, container, false);
|
||||||
|
this.mBindings.setView(this);
|
||||||
|
|
||||||
|
refreshList();
|
||||||
|
|
||||||
|
this.setSearchView(this.mBindings.searchView, newFilter -> {
|
||||||
|
hiddenNumOrds = Stream.of(allNumOrds)
|
||||||
|
.filter(x -> !x.toString().contains(newFilter.toUpperCase(Locale.ROOT)))
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
refreshList();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
new LiveAdapter(listModel, getViewLifecycleOwner(), BR.item)
|
||||||
|
.map(ListModel.class, R.layout.layout_filter_numero_ordine__list_item)
|
||||||
|
.into(this.mBindings.recyclerview);
|
||||||
|
|
||||||
|
return mBindings.getRoot();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshList() {
|
||||||
|
ComparatorCompat<ListModel> c =
|
||||||
|
ComparatorCompat
|
||||||
|
.chain(new ComparatorCompat<ListModel>((x, y) -> UtilityBoolean.toInt(x.getSelected().get()) - UtilityBoolean.toInt(y.getSelected().get())))
|
||||||
|
.thenComparing(new ComparatorCompat<>((x, y) -> UtilityBoolean.toInt(x.getEnabled().get()) - UtilityBoolean.toInt(y.getEnabled().get())))
|
||||||
|
.thenComparing(new ComparatorCompat<>((x, y) -> y.getOriginalModel().compareTo(x.getOriginalModel())))
|
||||||
|
.reversed();
|
||||||
|
|
||||||
|
listModel.setValue(Stream.of(getAllNumOrds())
|
||||||
|
.filter(x -> !hiddenNumOrds.contains(x))
|
||||||
|
.map(x -> {
|
||||||
|
var selectedBoolean = new BindableBoolean(preSelectedNumOrds.contains(x));
|
||||||
|
selectedBoolean.addOnPropertyChangedCallback(() -> {
|
||||||
|
if(selectedBoolean.get()) preSelectedNumOrds.add(x);
|
||||||
|
else preSelectedNumOrds.remove(x);
|
||||||
|
});
|
||||||
|
|
||||||
|
return new ListModel()
|
||||||
|
.setSelected(selectedBoolean)
|
||||||
|
.setEnabled(new BindableBoolean(availableNumOrds.contains(x)))
|
||||||
|
.setOriginalModel(x);
|
||||||
|
})
|
||||||
|
.sorted(c)
|
||||||
|
.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void onConfirm() {
|
||||||
|
if (onFilterApplied == null) return;
|
||||||
|
|
||||||
|
this.onFilterApplied.run(Stream.of(Objects.requireNonNull(listModel.getValue()))
|
||||||
|
.filter(x -> x.selected.get())
|
||||||
|
.map(x -> x.originalModel)
|
||||||
|
.toList());
|
||||||
|
|
||||||
|
dismiss();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Integer> getAllNumOrds() {
|
||||||
|
return allNumOrds;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterNumeroOrdineLayoutView setAllNumOrds(List<Integer> allIDViaggio) {
|
||||||
|
this.allNumOrds = allIDViaggio;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Integer> getAvailableNumOrds() {
|
||||||
|
return availableNumOrds;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterNumeroOrdineLayoutView setAvailableNumOrds(List<Integer> availableIDViaggio) {
|
||||||
|
this.availableNumOrds = availableIDViaggio;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Integer> getPreSelectedNumOrds() {
|
||||||
|
return preSelectedNumOrds;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterNumeroOrdineLayoutView setPreSelectedNumOrds(List<Integer> preSelectedIDViaggio) {
|
||||||
|
this.preSelectedNumOrds = preSelectedIDViaggio;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RunnableArgs<List<Integer>> getOnFilterApplied() {
|
||||||
|
return onFilterApplied;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterNumeroOrdineLayoutView setOnFilterApplied(RunnableArgs<List<Integer>> onFilterApplied) {
|
||||||
|
this.onFilterApplied = onFilterApplied;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class ListModel {
|
||||||
|
private BindableBoolean selected = new BindableBoolean();
|
||||||
|
private BindableBoolean enabled = new BindableBoolean();
|
||||||
|
private Integer originalModel;
|
||||||
|
|
||||||
|
public BindableBoolean getSelected() {
|
||||||
|
return selected;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ListModel setSelected(BindableBoolean selected) {
|
||||||
|
this.selected = selected;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BindableBoolean getEnabled() {
|
||||||
|
return enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ListModel setEnabled(BindableBoolean enabled) {
|
||||||
|
this.enabled = enabled;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getOriginalModel() {
|
||||||
|
return originalModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ListModel setOriginalModel(Integer originalModel) {
|
||||||
|
this.originalModel = originalModel;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,173 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.databinding.DataBindingUtil;
|
||||||
|
import androidx.lifecycle.MutableLiveData;
|
||||||
|
|
||||||
|
import com.annimon.stream.ComparatorCompat;
|
||||||
|
import com.annimon.stream.Stream;
|
||||||
|
import com.ravikoradiya.liveadapter.LiveAdapter;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.BR;
|
||||||
|
import it.integry.integrywmsnative.R;
|
||||||
|
import it.integry.integrywmsnative.core.di.BindableBoolean;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityBoolean;
|
||||||
|
import it.integry.integrywmsnative.databinding.LayoutFilterPaeseBinding;
|
||||||
|
import it.integry.integrywmsnative.ui.filter_chips.FilterLayoutView;
|
||||||
|
|
||||||
|
public class FilterPaeseLayoutView extends FilterLayoutView {
|
||||||
|
|
||||||
|
protected LayoutFilterPaeseBinding mBindings;
|
||||||
|
|
||||||
|
private List<String> allPaesi;
|
||||||
|
private List<String> availablePaesi;
|
||||||
|
private List<String> preSelectedPaesi = new ArrayList<>();
|
||||||
|
private List<String> hiddenPaesi = new ArrayList<>();
|
||||||
|
private final MutableLiveData<List<ListModel>> listModel = new MutableLiveData<>();
|
||||||
|
|
||||||
|
private RunnableArgs<List<String>> onFilterApplied;
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
|
mBindings = DataBindingUtil.inflate(inflater, R.layout.layout_filter_paese, container, false);
|
||||||
|
this.mBindings.setView(this);
|
||||||
|
|
||||||
|
refreshList();
|
||||||
|
|
||||||
|
this.setSearchView(this.mBindings.searchView, newFilter -> {
|
||||||
|
hiddenPaesi = Stream.of(allPaesi)
|
||||||
|
.filter(x -> !x.toUpperCase(Locale.ROOT).contains(newFilter.toUpperCase(Locale.ROOT)))
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
refreshList();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
new LiveAdapter(listModel, getViewLifecycleOwner(), BR.item)
|
||||||
|
.map(ListModel.class, R.layout.layout_filter_paese__list_item)
|
||||||
|
.into(this.mBindings.recyclerview);
|
||||||
|
|
||||||
|
return mBindings.getRoot();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshList() {
|
||||||
|
ComparatorCompat<ListModel> c =
|
||||||
|
ComparatorCompat
|
||||||
|
.chain(new ComparatorCompat<ListModel>((x, y) -> UtilityBoolean.toInt(x.getSelected().get()) - UtilityBoolean.toInt(y.getSelected().get())))
|
||||||
|
.thenComparing(new ComparatorCompat<>((x, y) -> UtilityBoolean.toInt(x.getEnabled().get()) - UtilityBoolean.toInt(y.getEnabled().get())))
|
||||||
|
.thenComparing(new ComparatorCompat<>((x, y) -> y.getOriginalModel().compareTo(x.getOriginalModel())))
|
||||||
|
.reversed();
|
||||||
|
|
||||||
|
listModel.setValue(Stream.of(getAllPaesi())
|
||||||
|
.filter(x -> !hiddenPaesi.contains(x))
|
||||||
|
.map(x -> {
|
||||||
|
var selectedBoolean = new BindableBoolean(preSelectedPaesi.contains(x));
|
||||||
|
selectedBoolean.addOnPropertyChangedCallback(() -> {
|
||||||
|
if (selectedBoolean.get()) preSelectedPaesi.add(x);
|
||||||
|
else preSelectedPaesi.remove(x);
|
||||||
|
});
|
||||||
|
|
||||||
|
return new ListModel()
|
||||||
|
.setSelected(selectedBoolean)
|
||||||
|
.setEnabled(new BindableBoolean(availablePaesi.contains(x)))
|
||||||
|
.setOriginalModel(x);
|
||||||
|
})
|
||||||
|
.sorted(c)
|
||||||
|
.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void onConfirm() {
|
||||||
|
if (onFilterApplied == null) return;
|
||||||
|
|
||||||
|
this.onFilterApplied.run(Stream.of(Objects.requireNonNull(listModel.getValue()))
|
||||||
|
.filter(x -> x.selected.get())
|
||||||
|
.map(x -> x.originalModel)
|
||||||
|
.toList());
|
||||||
|
|
||||||
|
dismiss();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getAllPaesi() {
|
||||||
|
return allPaesi;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterPaeseLayoutView setAllPaesi(List<String> allPaesi) {
|
||||||
|
this.allPaesi = allPaesi;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getAvailablePaesi() {
|
||||||
|
return availablePaesi;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterPaeseLayoutView setAvailablePaesi(List<String> availablePaesi) {
|
||||||
|
this.availablePaesi = availablePaesi;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getPreSelectedPaesi() {
|
||||||
|
return preSelectedPaesi;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterPaeseLayoutView setPreSelectedPaesi(List<String> preSelectedPaesi) {
|
||||||
|
this.preSelectedPaesi = preSelectedPaesi;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RunnableArgs<List<String>> getOnFilterApplied() {
|
||||||
|
return onFilterApplied;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterPaeseLayoutView setOnFilterApplied(RunnableArgs<List<String>> onFilterApplied) {
|
||||||
|
this.onFilterApplied = onFilterApplied;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class ListModel {
|
||||||
|
private BindableBoolean selected = new BindableBoolean();
|
||||||
|
private BindableBoolean enabled = new BindableBoolean();
|
||||||
|
private String originalModel;
|
||||||
|
|
||||||
|
public BindableBoolean getSelected() {
|
||||||
|
return selected;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ListModel setSelected(BindableBoolean selected) {
|
||||||
|
this.selected = selected;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BindableBoolean getEnabled() {
|
||||||
|
return enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ListModel setEnabled(BindableBoolean enabled) {
|
||||||
|
this.enabled = enabled;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOriginalModel() {
|
||||||
|
return originalModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ListModel setOriginalModel(String originalModel) {
|
||||||
|
this.originalModel = originalModel;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,173 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.databinding.DataBindingUtil;
|
||||||
|
import androidx.lifecycle.MutableLiveData;
|
||||||
|
|
||||||
|
import com.annimon.stream.ComparatorCompat;
|
||||||
|
import com.annimon.stream.Stream;
|
||||||
|
import com.ravikoradiya.liveadapter.LiveAdapter;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.BR;
|
||||||
|
import it.integry.integrywmsnative.R;
|
||||||
|
import it.integry.integrywmsnative.core.di.BindableBoolean;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityBoolean;
|
||||||
|
import it.integry.integrywmsnative.databinding.LayoutFilterTermConsBinding;
|
||||||
|
import it.integry.integrywmsnative.ui.filter_chips.FilterLayoutView;
|
||||||
|
|
||||||
|
public class FilterTermConsLayoutView extends FilterLayoutView {
|
||||||
|
|
||||||
|
protected LayoutFilterTermConsBinding mBindings;
|
||||||
|
|
||||||
|
private List<String> allTermCons;
|
||||||
|
private List<String> availableTermCons;
|
||||||
|
private List<String> preSelectedTermCons = new ArrayList<>();
|
||||||
|
private List<String> hiddenSelectedTermCons = new ArrayList<>();
|
||||||
|
private final MutableLiveData<List<ListModel>> listModel = new MutableLiveData<>();
|
||||||
|
|
||||||
|
private RunnableArgs<List<String>> onFilterApplied;
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
|
mBindings = DataBindingUtil.inflate(inflater, R.layout.layout_filter_term_cons, container, false);
|
||||||
|
this.mBindings.setView(this);
|
||||||
|
|
||||||
|
refreshList();
|
||||||
|
|
||||||
|
this.setSearchView(this.mBindings.searchView, newFilter -> {
|
||||||
|
hiddenSelectedTermCons = Stream.of(allTermCons)
|
||||||
|
.filter(x -> !x.toUpperCase(Locale.ROOT).contains(newFilter.toUpperCase(Locale.ROOT)))
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
refreshList();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
new LiveAdapter(listModel, getViewLifecycleOwner(), BR.item)
|
||||||
|
.map(ListModel.class, R.layout.layout_filter_term_cons__list_item)
|
||||||
|
.into(this.mBindings.recyclerview);
|
||||||
|
|
||||||
|
return mBindings.getRoot();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshList() {
|
||||||
|
ComparatorCompat<ListModel> c =
|
||||||
|
ComparatorCompat
|
||||||
|
.chain(new ComparatorCompat<ListModel>((x, y) -> UtilityBoolean.toInt(x.getSelected().get()) - UtilityBoolean.toInt(y.getSelected().get())))
|
||||||
|
.thenComparing(new ComparatorCompat<>((x, y) -> UtilityBoolean.toInt(x.getEnabled().get()) - UtilityBoolean.toInt(y.getEnabled().get())))
|
||||||
|
.thenComparing(new ComparatorCompat<>((x, y) -> y.getOriginalModel().compareTo(x.getOriginalModel())))
|
||||||
|
.reversed();
|
||||||
|
|
||||||
|
listModel.setValue(Stream.of(getAllTermCons())
|
||||||
|
.filter(x -> !hiddenSelectedTermCons.contains(x))
|
||||||
|
.map(x -> {
|
||||||
|
var selectedBoolean = new BindableBoolean(preSelectedTermCons.contains(x));
|
||||||
|
selectedBoolean.addOnPropertyChangedCallback(() -> {
|
||||||
|
if (selectedBoolean.get()) preSelectedTermCons.add(x);
|
||||||
|
else preSelectedTermCons.remove(x);
|
||||||
|
});
|
||||||
|
|
||||||
|
return new ListModel()
|
||||||
|
.setSelected(selectedBoolean)
|
||||||
|
.setEnabled(new BindableBoolean(availableTermCons.contains(x)))
|
||||||
|
.setOriginalModel(x);
|
||||||
|
})
|
||||||
|
.sorted(c)
|
||||||
|
.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void onConfirm() {
|
||||||
|
if (onFilterApplied == null) return;
|
||||||
|
|
||||||
|
this.onFilterApplied.run(Stream.of(Objects.requireNonNull(listModel.getValue()))
|
||||||
|
.filter(x -> x.selected.get())
|
||||||
|
.map(x -> x.originalModel)
|
||||||
|
.toList());
|
||||||
|
|
||||||
|
dismiss();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getAllTermCons() {
|
||||||
|
return allTermCons;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterTermConsLayoutView setAllTermCons(List<String> allTermCons) {
|
||||||
|
this.allTermCons = allTermCons;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getAvailableTermCons() {
|
||||||
|
return availableTermCons;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterTermConsLayoutView setAvailableTermCons(List<String> availableTermCons) {
|
||||||
|
this.availableTermCons = availableTermCons;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getPreSelectedTermCons() {
|
||||||
|
return preSelectedTermCons;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterTermConsLayoutView setPreSelectedTermCons(List<String> preSelectedTermCons) {
|
||||||
|
this.preSelectedTermCons = preSelectedTermCons;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RunnableArgs<List<String>> getOnFilterApplied() {
|
||||||
|
return onFilterApplied;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterTermConsLayoutView setOnFilterApplied(RunnableArgs<List<String>> onFilterApplied) {
|
||||||
|
this.onFilterApplied = onFilterApplied;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class ListModel {
|
||||||
|
private BindableBoolean selected = new BindableBoolean();
|
||||||
|
private BindableBoolean enabled = new BindableBoolean();
|
||||||
|
private String originalModel;
|
||||||
|
|
||||||
|
public BindableBoolean getSelected() {
|
||||||
|
return selected;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ListModel setSelected(BindableBoolean selected) {
|
||||||
|
this.selected = selected;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BindableBoolean getEnabled() {
|
||||||
|
return enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ListModel setEnabled(BindableBoolean enabled) {
|
||||||
|
this.enabled = enabled;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOriginalModel() {
|
||||||
|
return originalModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ListModel setOriginalModel(String originalModel) {
|
||||||
|
this.originalModel = originalModel;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,174 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.databinding.DataBindingUtil;
|
||||||
|
import androidx.lifecycle.MutableLiveData;
|
||||||
|
|
||||||
|
import com.annimon.stream.ComparatorCompat;
|
||||||
|
import com.annimon.stream.Stream;
|
||||||
|
import com.ravikoradiya.liveadapter.LiveAdapter;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.BR;
|
||||||
|
import it.integry.integrywmsnative.R;
|
||||||
|
import it.integry.integrywmsnative.core.di.BindableBoolean;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityBoolean;
|
||||||
|
import it.integry.integrywmsnative.databinding.LayoutFilterVettoreBinding;
|
||||||
|
import it.integry.integrywmsnative.ui.filter_chips.FilterLayoutView;
|
||||||
|
|
||||||
|
public class FilterVettoreLayoutView extends FilterLayoutView {
|
||||||
|
|
||||||
|
protected LayoutFilterVettoreBinding mBindings;
|
||||||
|
|
||||||
|
private List<String> allVettori;
|
||||||
|
private List<String> availableVettori;
|
||||||
|
private List<String> preSelectedVettori = new ArrayList<>();
|
||||||
|
private List<String> hiddenSelectedVettori = new ArrayList<>();
|
||||||
|
private final MutableLiveData<List<ListModel>> listModel = new MutableLiveData<>();
|
||||||
|
|
||||||
|
private RunnableArgs<List<String>> onFilterApplied;
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
|
mBindings = DataBindingUtil.inflate(inflater, R.layout.layout_filter_vettore, container, false);
|
||||||
|
this.mBindings.setView(this);
|
||||||
|
|
||||||
|
refreshList();
|
||||||
|
|
||||||
|
this.setSearchView(this.mBindings.searchView, newFilter -> {
|
||||||
|
hiddenSelectedVettori = Stream.of(allVettori)
|
||||||
|
.filter(x -> !x.toUpperCase(Locale.ROOT).contains(newFilter.toUpperCase(Locale.ROOT)))
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
refreshList();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
new LiveAdapter(listModel, getViewLifecycleOwner(), BR.item)
|
||||||
|
.map(ListModel.class, R.layout.layout_filter_vettore__list_item)
|
||||||
|
.into(this.mBindings.recyclerview);
|
||||||
|
|
||||||
|
return mBindings.getRoot();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshList() {
|
||||||
|
ComparatorCompat<ListModel> c =
|
||||||
|
ComparatorCompat
|
||||||
|
.chain(new ComparatorCompat<ListModel>((x, y) -> UtilityBoolean.toInt(x.getSelected().get()) - UtilityBoolean.toInt(y.getSelected().get())))
|
||||||
|
.thenComparing(new ComparatorCompat<>((x, y) -> UtilityBoolean.toInt(x.getEnabled().get()) - UtilityBoolean.toInt(y.getEnabled().get())))
|
||||||
|
.thenComparing(new ComparatorCompat<>((x, y) -> y.getOriginalModel().compareTo(x.getOriginalModel())))
|
||||||
|
.reversed();
|
||||||
|
|
||||||
|
listModel.setValue(Stream.of(getAllVettori())
|
||||||
|
.filter(x -> !hiddenSelectedVettori.contains(x))
|
||||||
|
.map(x -> {
|
||||||
|
var selectedBoolean = new BindableBoolean(preSelectedVettori.contains(x));
|
||||||
|
selectedBoolean.addOnPropertyChangedCallback(() -> {
|
||||||
|
if (selectedBoolean.get()) preSelectedVettori.add(x);
|
||||||
|
else preSelectedVettori.remove(x);
|
||||||
|
});
|
||||||
|
|
||||||
|
return new ListModel()
|
||||||
|
.setSelected(selectedBoolean)
|
||||||
|
.setEnabled(new BindableBoolean(availableVettori.contains(x)))
|
||||||
|
.setOriginalModel(x);
|
||||||
|
})
|
||||||
|
.sorted(c)
|
||||||
|
.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void onConfirm() {
|
||||||
|
if (onFilterApplied == null) return;
|
||||||
|
|
||||||
|
this.onFilterApplied.run(Stream.of(Objects.requireNonNull(listModel.getValue()))
|
||||||
|
.filter(x -> x.selected.get())
|
||||||
|
.map(x -> x.originalModel)
|
||||||
|
.toList());
|
||||||
|
|
||||||
|
dismiss();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getAllVettori() {
|
||||||
|
return allVettori;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterVettoreLayoutView setAllVettori(List<String> allVettori) {
|
||||||
|
this.allVettori = allVettori;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getAvailableVettori() {
|
||||||
|
return availableVettori;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterVettoreLayoutView setAvailableVettori(List<String> availableVettori) {
|
||||||
|
this.availableVettori = availableVettori;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getPreSelectedVettori() {
|
||||||
|
return preSelectedVettori;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterVettoreLayoutView setPreSelectedVettori(List<String> preSelectedVettori) {
|
||||||
|
this.preSelectedVettori = preSelectedVettori;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RunnableArgs<List<String>> getOnFilterApplied() {
|
||||||
|
return onFilterApplied;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterVettoreLayoutView setOnFilterApplied(RunnableArgs<List<String>> onFilterApplied) {
|
||||||
|
this.onFilterApplied = onFilterApplied;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class ListModel {
|
||||||
|
private BindableBoolean selected = new BindableBoolean();
|
||||||
|
private BindableBoolean enabled = new BindableBoolean();
|
||||||
|
private String originalModel;
|
||||||
|
|
||||||
|
public BindableBoolean getSelected() {
|
||||||
|
return selected;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ListModel setSelected(BindableBoolean selected) {
|
||||||
|
this.selected = selected;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BindableBoolean getEnabled() {
|
||||||
|
return enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ListModel setEnabled(BindableBoolean enabled) {
|
||||||
|
this.enabled = enabled;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOriginalModel() {
|
||||||
|
return originalModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ListModel setOriginalModel(String originalModel) {
|
||||||
|
this.originalModel = originalModel;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,173 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.databinding.DataBindingUtil;
|
||||||
|
import androidx.lifecycle.MutableLiveData;
|
||||||
|
|
||||||
|
import com.annimon.stream.ComparatorCompat;
|
||||||
|
import com.annimon.stream.Stream;
|
||||||
|
import com.ravikoradiya.liveadapter.LiveAdapter;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.BR;
|
||||||
|
import it.integry.integrywmsnative.R;
|
||||||
|
import it.integry.integrywmsnative.core.di.BindableBoolean;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityBoolean;
|
||||||
|
import it.integry.integrywmsnative.databinding.LayoutFilterViaggioBinding;
|
||||||
|
import it.integry.integrywmsnative.ui.filter_chips.FilterLayoutView;
|
||||||
|
|
||||||
|
public class FilterViaggioLayoutView extends FilterLayoutView {
|
||||||
|
|
||||||
|
protected LayoutFilterViaggioBinding mBindings;
|
||||||
|
|
||||||
|
private List<Integer> allIDViaggio;
|
||||||
|
private List<Integer> availableIDViaggio;
|
||||||
|
private List<Integer> preSelectedIDViaggio = new ArrayList<>();
|
||||||
|
private List<Integer> hiddenIDViaggio = new ArrayList<>();
|
||||||
|
private MutableLiveData<List<ListModel>> listModel = new MutableLiveData<>();
|
||||||
|
|
||||||
|
private RunnableArgs<List<Integer>> onFilterApplied;
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
|
mBindings = DataBindingUtil.inflate(inflater, R.layout.layout_filter_viaggio, container, false);
|
||||||
|
this.mBindings.setView(this);
|
||||||
|
|
||||||
|
refreshList();
|
||||||
|
|
||||||
|
this.setSearchView(this.mBindings.searchView, newFilter -> {
|
||||||
|
hiddenIDViaggio = Stream.of(allIDViaggio)
|
||||||
|
.filter(x -> !x.toString().toUpperCase(Locale.ROOT).contains(newFilter.toUpperCase(Locale.ROOT)))
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
refreshList();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
new LiveAdapter(listModel, getViewLifecycleOwner(), BR.item)
|
||||||
|
.map(ListModel.class, R.layout.layout_filter_viaggio__list_item)
|
||||||
|
.into(this.mBindings.recyclerview);
|
||||||
|
|
||||||
|
return mBindings.getRoot();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshList() {
|
||||||
|
ComparatorCompat<ListModel> c =
|
||||||
|
ComparatorCompat
|
||||||
|
.chain(new ComparatorCompat<ListModel>((x, y) -> UtilityBoolean.toInt(x.getSelected().get()) - UtilityBoolean.toInt(y.getSelected().get())))
|
||||||
|
.thenComparing(new ComparatorCompat<>((x, y) -> UtilityBoolean.toInt(x.getEnabled().get()) - UtilityBoolean.toInt(y.getEnabled().get())))
|
||||||
|
.thenComparing(new ComparatorCompat<>((x, y) -> y.getOriginalModel().compareTo(x.getOriginalModel())))
|
||||||
|
.reversed();
|
||||||
|
|
||||||
|
listModel.setValue(Stream.of(getAllIDViaggio())
|
||||||
|
.filter(x -> !hiddenIDViaggio.contains(x))
|
||||||
|
.map(x -> {
|
||||||
|
var selectedBoolean = new BindableBoolean(preSelectedIDViaggio.contains(x));
|
||||||
|
selectedBoolean.addOnPropertyChangedCallback(() -> {
|
||||||
|
if (selectedBoolean.get()) preSelectedIDViaggio.add(x);
|
||||||
|
else preSelectedIDViaggio.remove(x);
|
||||||
|
});
|
||||||
|
|
||||||
|
return new ListModel()
|
||||||
|
.setSelected(selectedBoolean)
|
||||||
|
.setEnabled(new BindableBoolean(availableIDViaggio.contains(x)))
|
||||||
|
.setOriginalModel(x);
|
||||||
|
})
|
||||||
|
.sorted(c)
|
||||||
|
.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void onConfirm() {
|
||||||
|
if (onFilterApplied == null) return;
|
||||||
|
|
||||||
|
this.onFilterApplied.run(Stream.of(Objects.requireNonNull(listModel.getValue()))
|
||||||
|
.filter(x -> x.selected.get())
|
||||||
|
.map(x -> x.originalModel)
|
||||||
|
.toList());
|
||||||
|
|
||||||
|
dismiss();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Integer> getAllIDViaggio() {
|
||||||
|
return allIDViaggio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterViaggioLayoutView setAllIDViaggio(List<Integer> allIDViaggio) {
|
||||||
|
this.allIDViaggio = allIDViaggio;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Integer> getAvailableIDViaggio() {
|
||||||
|
return availableIDViaggio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterViaggioLayoutView setAvailableIDViaggio(List<Integer> availableIDViaggio) {
|
||||||
|
this.availableIDViaggio = availableIDViaggio;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Integer> getPreSelectedIDViaggio() {
|
||||||
|
return preSelectedIDViaggio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterViaggioLayoutView setPreSelectedIDViaggio(List<Integer> preSelectedIDViaggio) {
|
||||||
|
this.preSelectedIDViaggio = preSelectedIDViaggio;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RunnableArgs<List<Integer>> getOnFilterApplied() {
|
||||||
|
return onFilterApplied;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterViaggioLayoutView setOnFilterApplied(RunnableArgs<List<Integer>> onFilterApplied) {
|
||||||
|
this.onFilterApplied = onFilterApplied;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class ListModel {
|
||||||
|
private BindableBoolean selected = new BindableBoolean();
|
||||||
|
private BindableBoolean enabled = new BindableBoolean();
|
||||||
|
private Integer originalModel;
|
||||||
|
|
||||||
|
public BindableBoolean getSelected() {
|
||||||
|
return selected;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ListModel setSelected(BindableBoolean selected) {
|
||||||
|
this.selected = selected;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BindableBoolean getEnabled() {
|
||||||
|
return enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ListModel setEnabled(BindableBoolean enabled) {
|
||||||
|
this.enabled = enabled;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getOriginalModel() {
|
||||||
|
return originalModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ListModel setOriginalModel(Integer originalModel) {
|
||||||
|
this.originalModel = originalModel;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,708 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters;
|
||||||
|
|
||||||
|
import androidx.databinding.ObservableField;
|
||||||
|
import androidx.lifecycle.MutableLiveData;
|
||||||
|
|
||||||
|
import com.annimon.stream.Stream;
|
||||||
|
import com.annimon.stream.function.Predicate;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.time.DateUtils;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.model.MtbDepo;
|
||||||
|
import it.integry.integrywmsnative.core.model.MtbGrup;
|
||||||
|
import it.integry.integrywmsnative.core.model.OrdineInevasoDTO;
|
||||||
|
import it.integry.integrywmsnative.core.rest.model.OrdineUscitaInevasoDTO;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||||
|
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.OrdiniUscitaElencoDTO;
|
||||||
|
|
||||||
|
public class VenditaFiltroOrdiniViewModel {
|
||||||
|
|
||||||
|
private final ObservableField<Predicate<OrdiniUscitaElencoDTO>> currentDepositoPredicate = new ObservableField<>();
|
||||||
|
private final ObservableField<Predicate<OrdiniUscitaElencoDTO>> currentIdViaggioPredicate = new ObservableField<>();
|
||||||
|
private final ObservableField<Predicate<OrdiniUscitaElencoDTO>> currentNumOrdsPredicate = new ObservableField<>();
|
||||||
|
private final ObservableField<Predicate<OrdiniUscitaElencoDTO>> currentClientePredicate = new ObservableField<>();
|
||||||
|
private final ObservableField<Predicate<OrdiniUscitaElencoDTO>> currentDataConsPredicate = new ObservableField<>();
|
||||||
|
private final ObservableField<Predicate<OrdiniUscitaElencoDTO>> currentTermConsPredicate = new ObservableField<>();
|
||||||
|
private final ObservableField<Predicate<OrdiniUscitaElencoDTO>> currentVettorePredicate = new ObservableField<>();
|
||||||
|
private final ObservableField<Predicate<OrdiniUscitaElencoDTO>> currentAgentePredicate = new ObservableField<>();
|
||||||
|
private final ObservableField<Predicate<OrdiniUscitaElencoDTO>> currentAutomezzoPredicate = new ObservableField<>();
|
||||||
|
private final ObservableField<Predicate<OrdiniUscitaElencoDTO>> currentPaesePredicate = new ObservableField<>();
|
||||||
|
private final ObservableField<Predicate<OrdiniUscitaElencoDTO>> currentGruppoMercPredicate = new ObservableField<>();
|
||||||
|
|
||||||
|
private Date selectedDataCons = null;
|
||||||
|
private List<MtbGrup> selectedMtbGrup = new ArrayList<>();
|
||||||
|
|
||||||
|
private List<OrdiniUscitaElencoDTO> initialOrderList;
|
||||||
|
private final MutableLiveData<List<OrdiniUscitaElencoDTO>> currentFilteredOrderList = new MutableLiveData<>();
|
||||||
|
|
||||||
|
public void init(List<OrdiniUscitaElencoDTO> initialList) {
|
||||||
|
this.initialOrderList = initialList;
|
||||||
|
this.currentFilteredOrderList.setValue(this.initialOrderList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MutableLiveData<List<OrdiniUscitaElencoDTO>> getMutableFilteredOrderList() {
|
||||||
|
return this.currentFilteredOrderList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIDViaggioFilter(List<Integer> idViaggio) {
|
||||||
|
if (idViaggio == null || idViaggio.isEmpty()) currentIdViaggioPredicate.set(null);
|
||||||
|
else {
|
||||||
|
currentIdViaggioPredicate.set(o -> idViaggio.contains(o.getIdViaggio()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDepositoFilter(List<MtbDepo> mtbDepoList) {
|
||||||
|
if (mtbDepoList == null || mtbDepoList.isEmpty()) currentDepositoPredicate.set(null);
|
||||||
|
else {
|
||||||
|
List<String> codMdeps = Stream.of(mtbDepoList).map(MtbDepo::getCodMdep).toList();
|
||||||
|
currentDepositoPredicate.set(o -> codMdeps.contains(o.getCodMdep()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNumOrdFilter(List<Integer> numOrds) {
|
||||||
|
if (numOrds == null || numOrds.isEmpty()) currentNumOrdsPredicate.set(null);
|
||||||
|
else {
|
||||||
|
currentNumOrdsPredicate.set(o -> numOrds.contains(o.getNumOrd()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setClienteFilter(List<String> clienti) {
|
||||||
|
if (clienti == null || clienti.isEmpty()) currentClientePredicate.set(null);
|
||||||
|
else {
|
||||||
|
currentClientePredicate.set(o -> clienti.contains(o.getRagSocOrd()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTerminiConsegnaFilter(List<String> terminiConsegna) {
|
||||||
|
if (terminiConsegna == null || terminiConsegna.isEmpty())
|
||||||
|
currentTermConsPredicate.set(null);
|
||||||
|
else {
|
||||||
|
currentTermConsPredicate.set(o -> terminiConsegna.contains(o.getTermCons()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVettoreFilter(List<String> vettore) {
|
||||||
|
if (vettore == null || vettore.isEmpty()) currentVettorePredicate.set(null);
|
||||||
|
else {
|
||||||
|
currentVettorePredicate.set(o -> vettore.contains(o.getCodVvet() + (!UtilityString.isNullOrEmpty(o.getCodVvet()) ? " - " + o.getDescrizioneVettore() : "")));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAutomezzoFilter(List<String> automezzi) {
|
||||||
|
if (automezzi == null || automezzi.isEmpty()) currentAutomezzoPredicate.set(null);
|
||||||
|
else {
|
||||||
|
currentAutomezzoPredicate.set(o -> automezzi.contains(o.getDescrizioneAuto()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDataConsegnaFilter(Date dataConsegna) {
|
||||||
|
this.selectedDataCons = dataConsegna;
|
||||||
|
|
||||||
|
if (dataConsegna == null) currentDataConsPredicate.set(null);
|
||||||
|
else {
|
||||||
|
currentDataConsPredicate.set(o -> DateUtils.isSameDay(o.getDataConsD(), dataConsegna));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAgenteFilter(List<String> agenti) {
|
||||||
|
if (agenti == null || agenti.isEmpty()) currentAgentePredicate.set(null);
|
||||||
|
else {
|
||||||
|
currentAgentePredicate.set(o -> agenti.contains(o.getNomeAgente()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPaeseFilter(List<String> paesi) {
|
||||||
|
if (paesi == null || paesi.isEmpty()) currentPaesePredicate.set(null);
|
||||||
|
else {
|
||||||
|
currentPaesePredicate.set(o -> paesi.contains(o.getCitta()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGruppoMercFilter(List<MtbGrup> mtbGrupList) {
|
||||||
|
if (mtbGrupList == null || mtbGrupList.isEmpty()) {
|
||||||
|
currentGruppoMercPredicate.set(null);
|
||||||
|
this.selectedMtbGrup = new ArrayList<>();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.selectedMtbGrup = mtbGrupList;
|
||||||
|
var mtbGrups = Stream.of(mtbGrupList).map(MtbGrup::getCodMgrp).toList();
|
||||||
|
currentGruppoMercPredicate.set(o -> Stream.of(o.getAvailableClassMerc())
|
||||||
|
.anyMatch(x -> mtbGrups.contains(x.getCodMgrp())));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Date getSelectedDataCons() {
|
||||||
|
return selectedDataCons;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<MtbGrup> getSelectedMtbGrup() {
|
||||||
|
return selectedMtbGrup;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void applyAllTests() {
|
||||||
|
|
||||||
|
List<OrdiniUscitaElencoDTO> returnList = null;
|
||||||
|
|
||||||
|
if (currentNumOrdsPredicate.get() == null &&
|
||||||
|
currentClientePredicate.get() == null &&
|
||||||
|
currentDataConsPredicate.get() == null &&
|
||||||
|
currentTermConsPredicate.get() == null &&
|
||||||
|
currentVettorePredicate.get() == null &&
|
||||||
|
currentAutomezzoPredicate.get() == null &&
|
||||||
|
currentDepositoPredicate.get() == null &&
|
||||||
|
currentIdViaggioPredicate.get() == null &&
|
||||||
|
currentAgentePredicate.get() == null &&
|
||||||
|
currentPaesePredicate.get() == null &&
|
||||||
|
currentGruppoMercPredicate.get() == null
|
||||||
|
) {
|
||||||
|
returnList = this.initialOrderList;
|
||||||
|
} else {
|
||||||
|
Stream<OrdiniUscitaElencoDTO> tmpStream = Stream.of(this.initialOrderList)
|
||||||
|
.filter(x ->
|
||||||
|
(currentNumOrdsPredicate.get() == null || (currentNumOrdsPredicate.get().test(x))) &&
|
||||||
|
(currentClientePredicate.get() == null || (currentClientePredicate.get().test(x))) &&
|
||||||
|
(currentDataConsPredicate.get() == null || (currentDataConsPredicate.get().test(x))) &&
|
||||||
|
(currentTermConsPredicate.get() == null || (currentTermConsPredicate.get().test(x))) &&
|
||||||
|
(currentVettorePredicate.get() == null || (currentVettorePredicate.get().test(x))) &&
|
||||||
|
(currentAutomezzoPredicate.get() == null || (currentAutomezzoPredicate.get().test(x))) &&
|
||||||
|
(currentDepositoPredicate.get() == null || (currentDepositoPredicate.get().test(x))) &&
|
||||||
|
(currentIdViaggioPredicate.get() == null || (currentIdViaggioPredicate.get().test(x))) &&
|
||||||
|
(currentAgentePredicate.get() == null || (currentAgentePredicate.get().test(x))) &&
|
||||||
|
(currentPaesePredicate.get() == null || (currentPaesePredicate.get().test(x))) &&
|
||||||
|
(currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x)))
|
||||||
|
);
|
||||||
|
|
||||||
|
returnList = tmpStream.toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.currentFilteredOrderList.setValue(returnList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ObservableField<Predicate<OrdiniUscitaElencoDTO>> getCurrentDepositoPredicate() {
|
||||||
|
return currentDepositoPredicate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ObservableField<Predicate<OrdiniUscitaElencoDTO>> getCurrentIdViaggioPredicate() {
|
||||||
|
return currentIdViaggioPredicate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ObservableField<Predicate<OrdiniUscitaElencoDTO>> getCurrentNumOrdsPredicate() {
|
||||||
|
return currentNumOrdsPredicate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ObservableField<Predicate<OrdiniUscitaElencoDTO>> getCurrentClientePredicate() {
|
||||||
|
return currentClientePredicate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ObservableField<Predicate<OrdiniUscitaElencoDTO>> getCurrentDataConsPredicate() {
|
||||||
|
return currentDataConsPredicate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ObservableField<Predicate<OrdiniUscitaElencoDTO>> getCurrentTermConsPredicate() {
|
||||||
|
return currentTermConsPredicate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ObservableField<Predicate<OrdiniUscitaElencoDTO>> getCurrentVettorePredicate() {
|
||||||
|
return currentVettorePredicate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ObservableField<Predicate<OrdiniUscitaElencoDTO>> getCurrentAgentePredicate() {
|
||||||
|
return currentAgentePredicate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ObservableField<Predicate<OrdiniUscitaElencoDTO>> getCurrentAutomezzoPredicate() {
|
||||||
|
return currentAutomezzoPredicate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ObservableField<Predicate<OrdiniUscitaElencoDTO>> getCurrentPaesePredicate() {
|
||||||
|
return currentPaesePredicate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ObservableField<Predicate<OrdiniUscitaElencoDTO>> getCurrentGruppoMercPredicate() {
|
||||||
|
return currentGruppoMercPredicate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<MtbDepo> getAllCodMdeps(List<MtbDepo> mtbDepoFullList) {
|
||||||
|
List<String> codMdeps = Stream.of(initialOrderList)
|
||||||
|
.map(OrdineInevasoDTO::getCodMdep)
|
||||||
|
.distinct()
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
return Stream.of(Objects.requireNonNull(mtbDepoFullList))
|
||||||
|
.filter(x -> codMdeps.contains(x.getCodMdep()))
|
||||||
|
.distinct()
|
||||||
|
.withoutNulls()
|
||||||
|
.sortBy(MtbDepo::getCodMdep)
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<MtbDepo> getAvailableCodMdeps(List<MtbDepo> mtbDepoFullList) {
|
||||||
|
|
||||||
|
if (currentNumOrdsPredicate.get() == null &&
|
||||||
|
currentClientePredicate.get() == null &&
|
||||||
|
currentDataConsPredicate.get() == null &&
|
||||||
|
currentTermConsPredicate.get() == null &&
|
||||||
|
currentVettorePredicate.get() == null &&
|
||||||
|
currentAutomezzoPredicate.get() == null &&
|
||||||
|
currentIdViaggioPredicate.get() == null &&
|
||||||
|
currentAgentePredicate.get() == null &&
|
||||||
|
currentPaesePredicate.get() == null &&
|
||||||
|
currentGruppoMercPredicate.get() == null
|
||||||
|
) {
|
||||||
|
return getAllCodMdeps(mtbDepoFullList);
|
||||||
|
} else {
|
||||||
|
List<String> availableCodMdeps = Stream.of(this.initialOrderList)
|
||||||
|
.filter(x ->
|
||||||
|
(currentNumOrdsPredicate.get() == null || (currentNumOrdsPredicate.get().test(x))) &&
|
||||||
|
(currentClientePredicate.get() == null || (currentClientePredicate.get().test(x))) &&
|
||||||
|
(currentDataConsPredicate.get() == null || (currentDataConsPredicate.get().test(x))) &&
|
||||||
|
(currentTermConsPredicate.get() == null || (currentTermConsPredicate.get().test(x))) &&
|
||||||
|
(currentVettorePredicate.get() == null || (currentVettorePredicate.get().test(x))) &&
|
||||||
|
(currentAutomezzoPredicate.get() == null || (currentAutomezzoPredicate.get().test(x))) &&
|
||||||
|
(currentIdViaggioPredicate.get() == null || (currentIdViaggioPredicate.get().test(x))) &&
|
||||||
|
(currentAgentePredicate.get() == null || (currentAgentePredicate.get().test(x))) &&
|
||||||
|
(currentPaesePredicate.get() == null || (currentPaesePredicate.get().test(x))) &&
|
||||||
|
(currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x)))
|
||||||
|
)
|
||||||
|
.map(OrdineInevasoDTO::getCodMdep)
|
||||||
|
.distinct()
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
return Stream.of(Objects.requireNonNull(mtbDepoFullList))
|
||||||
|
.filter(x -> availableCodMdeps.contains(x.getCodMdep()))
|
||||||
|
.distinct()
|
||||||
|
.withoutNulls()
|
||||||
|
.sortBy(MtbDepo::getCodMdep)
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public List<Integer> getAllIDViaggio() {
|
||||||
|
return Stream
|
||||||
|
.of(Objects.requireNonNull(initialOrderList))
|
||||||
|
.filter(x -> x.getIdViaggio() != null)
|
||||||
|
.sortBy(x -> -x.getIdViaggio())
|
||||||
|
.map(x -> x.getIdViaggio() != null ? x.getIdViaggio() : null)
|
||||||
|
.distinct()
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Integer> getAvailableIDViaggio() {
|
||||||
|
|
||||||
|
if (currentNumOrdsPredicate.get() == null &&
|
||||||
|
currentClientePredicate.get() == null &&
|
||||||
|
currentDataConsPredicate.get() == null &&
|
||||||
|
currentTermConsPredicate.get() == null &&
|
||||||
|
currentVettorePredicate.get() == null &&
|
||||||
|
currentAutomezzoPredicate.get() == null &&
|
||||||
|
currentDepositoPredicate.get() == null &&
|
||||||
|
currentAgentePredicate.get() == null &&
|
||||||
|
currentPaesePredicate.get() == null &&
|
||||||
|
currentGruppoMercPredicate.get() == null
|
||||||
|
) {
|
||||||
|
return getAllIDViaggio();
|
||||||
|
} else {
|
||||||
|
return Stream.of(this.initialOrderList)
|
||||||
|
.filter(x ->
|
||||||
|
(currentNumOrdsPredicate.get() == null || (currentNumOrdsPredicate.get().test(x))) &&
|
||||||
|
(currentClientePredicate.get() == null || (currentClientePredicate.get().test(x))) &&
|
||||||
|
(currentDataConsPredicate.get() == null || (currentDataConsPredicate.get().test(x))) &&
|
||||||
|
(currentTermConsPredicate.get() == null || (currentTermConsPredicate.get().test(x))) &&
|
||||||
|
(currentVettorePredicate.get() == null || (currentVettorePredicate.get().test(x))) &&
|
||||||
|
(currentAutomezzoPredicate.get() == null || (currentAutomezzoPredicate.get().test(x))) &&
|
||||||
|
(currentDepositoPredicate.get() == null || (currentDepositoPredicate.get().test(x))) &&
|
||||||
|
(currentAgentePredicate.get() == null || (currentAgentePredicate.get().test(x))) &&
|
||||||
|
(currentPaesePredicate.get() == null || (currentPaesePredicate.get().test(x))) &&
|
||||||
|
(currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x)))
|
||||||
|
)
|
||||||
|
.map(OrdineUscitaInevasoDTO::getIdViaggio)
|
||||||
|
.distinct()
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public List<Integer> getAllNumOrds() {
|
||||||
|
return Stream
|
||||||
|
.of(Objects.requireNonNull(initialOrderList))
|
||||||
|
.filter(x -> x.getNumOrd() != null)
|
||||||
|
.sortBy(x -> -x.getNumOrd())
|
||||||
|
.map(x -> x.getNumOrd() != null ? x.getNumOrd() : null)
|
||||||
|
.distinct()
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Integer> getAvailableNumOrds() {
|
||||||
|
|
||||||
|
if (currentIdViaggioPredicate.get() == null &&
|
||||||
|
currentClientePredicate.get() == null &&
|
||||||
|
currentDataConsPredicate.get() == null &&
|
||||||
|
currentTermConsPredicate.get() == null &&
|
||||||
|
currentVettorePredicate.get() == null &&
|
||||||
|
currentAutomezzoPredicate.get() == null &&
|
||||||
|
currentDepositoPredicate.get() == null &&
|
||||||
|
currentAgentePredicate.get() == null &&
|
||||||
|
currentPaesePredicate.get() == null &&
|
||||||
|
currentGruppoMercPredicate.get() == null
|
||||||
|
) {
|
||||||
|
return getAllNumOrds();
|
||||||
|
} else {
|
||||||
|
return Stream.of(this.initialOrderList)
|
||||||
|
.filter(x ->
|
||||||
|
(currentIdViaggioPredicate.get() == null || (currentIdViaggioPredicate.get().test(x))) &&
|
||||||
|
(currentClientePredicate.get() == null || (currentClientePredicate.get().test(x))) &&
|
||||||
|
(currentDataConsPredicate.get() == null || (currentDataConsPredicate.get().test(x))) &&
|
||||||
|
(currentTermConsPredicate.get() == null || (currentTermConsPredicate.get().test(x))) &&
|
||||||
|
(currentVettorePredicate.get() == null || (currentVettorePredicate.get().test(x))) &&
|
||||||
|
(currentAutomezzoPredicate.get() == null || (currentAutomezzoPredicate.get().test(x))) &&
|
||||||
|
(currentDepositoPredicate.get() == null || (currentDepositoPredicate.get().test(x))) &&
|
||||||
|
(currentAgentePredicate.get() == null || (currentAgentePredicate.get().test(x))) &&
|
||||||
|
(currentPaesePredicate.get() == null || (currentPaesePredicate.get().test(x))) &&
|
||||||
|
(currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x)))
|
||||||
|
)
|
||||||
|
.map(OrdineUscitaInevasoDTO::getNumOrd)
|
||||||
|
.distinct()
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public List<String> getAllClienti() {
|
||||||
|
return Stream
|
||||||
|
.of(Objects.requireNonNull(initialOrderList))
|
||||||
|
.filter(x -> !UtilityString.isNullOrEmpty(x.getRagSocOrd()))
|
||||||
|
.sortBy(OrdineUscitaInevasoDTO::getRagSocOrd)
|
||||||
|
.map(OrdineUscitaInevasoDTO::getRagSocOrd)
|
||||||
|
.distinct()
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getAvailableClienti() {
|
||||||
|
|
||||||
|
if (currentIdViaggioPredicate.get() == null &&
|
||||||
|
currentNumOrdsPredicate.get() == null &&
|
||||||
|
currentDataConsPredicate.get() == null &&
|
||||||
|
currentTermConsPredicate.get() == null &&
|
||||||
|
currentVettorePredicate.get() == null &&
|
||||||
|
currentAutomezzoPredicate.get() == null &&
|
||||||
|
currentDepositoPredicate.get() == null &&
|
||||||
|
currentAgentePredicate.get() == null &&
|
||||||
|
currentPaesePredicate.get() == null &&
|
||||||
|
currentGruppoMercPredicate.get() == null
|
||||||
|
) {
|
||||||
|
return getAllClienti();
|
||||||
|
} else {
|
||||||
|
return Stream.of(this.initialOrderList)
|
||||||
|
.filter(x ->
|
||||||
|
(currentIdViaggioPredicate.get() == null || (currentIdViaggioPredicate.get().test(x))) &&
|
||||||
|
(currentNumOrdsPredicate.get() == null || (currentNumOrdsPredicate.get().test(x))) &&
|
||||||
|
(currentDataConsPredicate.get() == null || (currentDataConsPredicate.get().test(x))) &&
|
||||||
|
(currentTermConsPredicate.get() == null || (currentTermConsPredicate.get().test(x))) &&
|
||||||
|
(currentVettorePredicate.get() == null || (currentVettorePredicate.get().test(x))) &&
|
||||||
|
(currentAutomezzoPredicate.get() == null || (currentAutomezzoPredicate.get().test(x))) &&
|
||||||
|
(currentDepositoPredicate.get() == null || (currentDepositoPredicate.get().test(x))) &&
|
||||||
|
(currentAgentePredicate.get() == null || (currentAgentePredicate.get().test(x))) &&
|
||||||
|
(currentPaesePredicate.get() == null || (currentPaesePredicate.get().test(x))) &&
|
||||||
|
(currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x)))
|
||||||
|
)
|
||||||
|
.map(OrdineUscitaInevasoDTO::getRagSocOrd)
|
||||||
|
.distinct()
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public List<String> getAllVettori() {
|
||||||
|
return Stream
|
||||||
|
.of(Objects.requireNonNull(initialOrderList))
|
||||||
|
.filter(x -> !UtilityString.isNullOrEmpty(x.getCodVvet()))
|
||||||
|
.sortBy(OrdineUscitaInevasoDTO::getCodVvet)
|
||||||
|
.map(x -> x.getCodVvet() + (!UtilityString.isNullOrEmpty(x.getCodVvet()) ? " - " + x.getDescrizioneVettore() : ""))
|
||||||
|
.distinct()
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getAvailableVettori() {
|
||||||
|
|
||||||
|
if (currentIdViaggioPredicate.get() == null &&
|
||||||
|
currentNumOrdsPredicate.get() == null &&
|
||||||
|
currentDataConsPredicate.get() == null &&
|
||||||
|
currentTermConsPredicate.get() == null &&
|
||||||
|
currentClientePredicate.get() == null &&
|
||||||
|
currentAutomezzoPredicate.get() == null &&
|
||||||
|
currentDepositoPredicate.get() == null &&
|
||||||
|
currentAgentePredicate.get() == null &&
|
||||||
|
currentPaesePredicate.get() == null &&
|
||||||
|
currentGruppoMercPredicate.get() == null
|
||||||
|
) {
|
||||||
|
return getAllVettori();
|
||||||
|
} else {
|
||||||
|
return Stream.of(this.initialOrderList)
|
||||||
|
.filter(x ->
|
||||||
|
(currentIdViaggioPredicate.get() == null || (currentIdViaggioPredicate.get().test(x))) &&
|
||||||
|
(currentNumOrdsPredicate.get() == null || (currentNumOrdsPredicate.get().test(x))) &&
|
||||||
|
(currentDataConsPredicate.get() == null || (currentDataConsPredicate.get().test(x))) &&
|
||||||
|
(currentTermConsPredicate.get() == null || (currentTermConsPredicate.get().test(x))) &&
|
||||||
|
(currentClientePredicate.get() == null || (currentClientePredicate.get().test(x))) &&
|
||||||
|
(currentAutomezzoPredicate.get() == null || (currentAutomezzoPredicate.get().test(x))) &&
|
||||||
|
(currentDepositoPredicate.get() == null || (currentDepositoPredicate.get().test(x))) &&
|
||||||
|
(currentAgentePredicate.get() == null || (currentAgentePredicate.get().test(x))) &&
|
||||||
|
(currentPaesePredicate.get() == null || (currentPaesePredicate.get().test(x))) &&
|
||||||
|
(currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x)))
|
||||||
|
)
|
||||||
|
.map(x -> x.getCodVvet() + (!UtilityString.isNullOrEmpty(x.getCodVvet()) ? " - " + x.getDescrizioneVettore() : ""))
|
||||||
|
.distinct()
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public List<String> getAllAutomezzi() {
|
||||||
|
return Stream
|
||||||
|
.of(Objects.requireNonNull(initialOrderList))
|
||||||
|
.filter(x -> !UtilityString.isNullOrEmpty(x.getDescrizioneAuto()))
|
||||||
|
.sortBy(OrdineUscitaInevasoDTO::getDescrizioneAuto)
|
||||||
|
.map(OrdineUscitaInevasoDTO::getDescrizioneAuto)
|
||||||
|
.distinct()
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getAvailableAutomezzi() {
|
||||||
|
|
||||||
|
if (currentIdViaggioPredicate.get() == null &&
|
||||||
|
currentNumOrdsPredicate.get() == null &&
|
||||||
|
currentDataConsPredicate.get() == null &&
|
||||||
|
currentTermConsPredicate.get() == null &&
|
||||||
|
currentClientePredicate.get() == null &&
|
||||||
|
currentVettorePredicate.get() == null &&
|
||||||
|
currentDepositoPredicate.get() == null &&
|
||||||
|
currentAgentePredicate.get() == null &&
|
||||||
|
currentPaesePredicate.get() == null &&
|
||||||
|
currentGruppoMercPredicate.get() == null
|
||||||
|
) {
|
||||||
|
return getAllAutomezzi();
|
||||||
|
} else {
|
||||||
|
return Stream.of(this.initialOrderList)
|
||||||
|
.filter(x ->
|
||||||
|
(currentIdViaggioPredicate.get() == null || (currentIdViaggioPredicate.get().test(x))) &&
|
||||||
|
(currentNumOrdsPredicate.get() == null || (currentNumOrdsPredicate.get().test(x))) &&
|
||||||
|
(currentDataConsPredicate.get() == null || (currentDataConsPredicate.get().test(x))) &&
|
||||||
|
(currentTermConsPredicate.get() == null || (currentTermConsPredicate.get().test(x))) &&
|
||||||
|
(currentClientePredicate.get() == null || (currentClientePredicate.get().test(x))) &&
|
||||||
|
(currentVettorePredicate.get() == null || (currentVettorePredicate.get().test(x))) &&
|
||||||
|
(currentDepositoPredicate.get() == null || (currentDepositoPredicate.get().test(x))) &&
|
||||||
|
(currentAgentePredicate.get() == null || (currentAgentePredicate.get().test(x))) &&
|
||||||
|
(currentPaesePredicate.get() == null || (currentPaesePredicate.get().test(x))) &&
|
||||||
|
(currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x)))
|
||||||
|
)
|
||||||
|
.map(OrdineUscitaInevasoDTO::getDescrizioneAuto)
|
||||||
|
.distinct()
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public List<String> getAllPaesi() {
|
||||||
|
return Stream
|
||||||
|
.of(Objects.requireNonNull(initialOrderList))
|
||||||
|
.filter(x -> !UtilityString.isNullOrEmpty(x.getCitta()))
|
||||||
|
.sortBy(OrdineUscitaInevasoDTO::getCitta)
|
||||||
|
.map(OrdineUscitaInevasoDTO::getCitta)
|
||||||
|
.distinct()
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getAvailablePaesi() {
|
||||||
|
|
||||||
|
if (currentIdViaggioPredicate.get() == null &&
|
||||||
|
currentNumOrdsPredicate.get() == null &&
|
||||||
|
currentDataConsPredicate.get() == null &&
|
||||||
|
currentTermConsPredicate.get() == null &&
|
||||||
|
currentClientePredicate.get() == null &&
|
||||||
|
currentVettorePredicate.get() == null &&
|
||||||
|
currentDepositoPredicate.get() == null &&
|
||||||
|
currentAgentePredicate.get() == null &&
|
||||||
|
currentAutomezzoPredicate.get() == null &&
|
||||||
|
currentGruppoMercPredicate.get() == null
|
||||||
|
) {
|
||||||
|
List<String> all = getAllPaesi();
|
||||||
|
return all;
|
||||||
|
} else {
|
||||||
|
return Stream.of(this.initialOrderList)
|
||||||
|
.filter(x ->
|
||||||
|
(currentIdViaggioPredicate.get() == null || (currentIdViaggioPredicate.get().test(x))) &&
|
||||||
|
(currentNumOrdsPredicate.get() == null || (currentNumOrdsPredicate.get().test(x))) &&
|
||||||
|
(currentDataConsPredicate.get() == null || (currentDataConsPredicate.get().test(x))) &&
|
||||||
|
(currentTermConsPredicate.get() == null || (currentTermConsPredicate.get().test(x))) &&
|
||||||
|
(currentClientePredicate.get() == null || (currentClientePredicate.get().test(x))) &&
|
||||||
|
(currentVettorePredicate.get() == null || (currentVettorePredicate.get().test(x))) &&
|
||||||
|
(currentDepositoPredicate.get() == null || (currentDepositoPredicate.get().test(x))) &&
|
||||||
|
(currentAgentePredicate.get() == null || (currentAgentePredicate.get().test(x))) &&
|
||||||
|
(currentAutomezzoPredicate.get() == null || (currentAutomezzoPredicate.get().test(x))) &&
|
||||||
|
(currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x)))
|
||||||
|
)
|
||||||
|
.map(OrdineUscitaInevasoDTO::getCitta)
|
||||||
|
.distinct()
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public List<String> getAllAgenti() {
|
||||||
|
return Stream
|
||||||
|
.of(Objects.requireNonNull(initialOrderList))
|
||||||
|
.filter(x -> !UtilityString.isNullOrEmpty(x.getNomeAgente()))
|
||||||
|
.sortBy(OrdineUscitaInevasoDTO::getNomeAgente)
|
||||||
|
.map(OrdineUscitaInevasoDTO::getNomeAgente)
|
||||||
|
.distinct()
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getAvailableAgenti() {
|
||||||
|
|
||||||
|
if (currentIdViaggioPredicate.get() == null &&
|
||||||
|
currentNumOrdsPredicate.get() == null &&
|
||||||
|
currentDataConsPredicate.get() == null &&
|
||||||
|
currentTermConsPredicate.get() == null &&
|
||||||
|
currentClientePredicate.get() == null &&
|
||||||
|
currentVettorePredicate.get() == null &&
|
||||||
|
currentDepositoPredicate.get() == null &&
|
||||||
|
currentPaesePredicate.get() == null &&
|
||||||
|
currentAutomezzoPredicate.get() == null &&
|
||||||
|
currentGruppoMercPredicate.get() == null
|
||||||
|
) {
|
||||||
|
List<String> all = getAllAgenti();
|
||||||
|
return all;
|
||||||
|
} else {
|
||||||
|
return Stream.of(this.initialOrderList)
|
||||||
|
.filter(x ->
|
||||||
|
(currentIdViaggioPredicate.get() == null || (currentIdViaggioPredicate.get().test(x))) &&
|
||||||
|
(currentNumOrdsPredicate.get() == null || (currentNumOrdsPredicate.get().test(x))) &&
|
||||||
|
(currentDataConsPredicate.get() == null || (currentDataConsPredicate.get().test(x))) &&
|
||||||
|
(currentTermConsPredicate.get() == null || (currentTermConsPredicate.get().test(x))) &&
|
||||||
|
(currentClientePredicate.get() == null || (currentClientePredicate.get().test(x))) &&
|
||||||
|
(currentVettorePredicate.get() == null || (currentVettorePredicate.get().test(x))) &&
|
||||||
|
(currentDepositoPredicate.get() == null || (currentDepositoPredicate.get().test(x))) &&
|
||||||
|
(currentPaesePredicate.get() == null || (currentPaesePredicate.get().test(x))) &&
|
||||||
|
(currentAutomezzoPredicate.get() == null || (currentAutomezzoPredicate.get().test(x))) &&
|
||||||
|
(currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x)))
|
||||||
|
)
|
||||||
|
.map(OrdineUscitaInevasoDTO::getNomeAgente)
|
||||||
|
.distinct()
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public List<String> getAllTermCons() {
|
||||||
|
return Stream
|
||||||
|
.of(Objects.requireNonNull(initialOrderList))
|
||||||
|
.filter(x -> !UtilityString.isNullOrEmpty(x.getTermCons()))
|
||||||
|
.sortBy(OrdineUscitaInevasoDTO::getTermCons)
|
||||||
|
.map(OrdineUscitaInevasoDTO::getTermCons)
|
||||||
|
.distinct()
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getAvailableTermCons() {
|
||||||
|
|
||||||
|
if (currentIdViaggioPredicate.get() == null &&
|
||||||
|
currentNumOrdsPredicate.get() == null &&
|
||||||
|
currentDataConsPredicate.get() == null &&
|
||||||
|
currentAgentePredicate.get() == null &&
|
||||||
|
currentClientePredicate.get() == null &&
|
||||||
|
currentVettorePredicate.get() == null &&
|
||||||
|
currentDepositoPredicate.get() == null &&
|
||||||
|
currentPaesePredicate.get() == null &&
|
||||||
|
currentAutomezzoPredicate.get() == null &&
|
||||||
|
currentGruppoMercPredicate.get() == null
|
||||||
|
) {
|
||||||
|
return getAllTermCons();
|
||||||
|
} else {
|
||||||
|
return Stream.of(this.initialOrderList)
|
||||||
|
.filter(x ->
|
||||||
|
(currentIdViaggioPredicate.get() == null || (currentIdViaggioPredicate.get().test(x))) &&
|
||||||
|
(currentNumOrdsPredicate.get() == null || (currentNumOrdsPredicate.get().test(x))) &&
|
||||||
|
(currentDataConsPredicate.get() == null || (currentDataConsPredicate.get().test(x))) &&
|
||||||
|
(currentAgentePredicate.get() == null || (currentAgentePredicate.get().test(x))) &&
|
||||||
|
(currentClientePredicate.get() == null || (currentClientePredicate.get().test(x))) &&
|
||||||
|
(currentVettorePredicate.get() == null || (currentVettorePredicate.get().test(x))) &&
|
||||||
|
(currentDepositoPredicate.get() == null || (currentDepositoPredicate.get().test(x))) &&
|
||||||
|
(currentPaesePredicate.get() == null || (currentPaesePredicate.get().test(x))) &&
|
||||||
|
(currentAutomezzoPredicate.get() == null || (currentAutomezzoPredicate.get().test(x))) &&
|
||||||
|
(currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x)))
|
||||||
|
)
|
||||||
|
.map(OrdineUscitaInevasoDTO::getTermCons)
|
||||||
|
.distinct()
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public List<MtbGrup> getAllGruppoMerc(List<MtbGrup> mtbGrupFullList) {
|
||||||
|
var codMgrp = Stream.of(initialOrderList)
|
||||||
|
.flatMap(ordiniUscitaElencoDTO -> Stream.of(ordiniUscitaElencoDTO.getAvailableClassMerc()))
|
||||||
|
.map(OrdineUscitaInevasoDTO.AvailableClassMerc::getCodMgrp)
|
||||||
|
.withoutNulls()
|
||||||
|
.distinct()
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
return Stream.of(Objects.requireNonNull(mtbGrupFullList))
|
||||||
|
.filter(x -> codMgrp.contains(x.getCodMgrp()))
|
||||||
|
.distinct()
|
||||||
|
.withoutNulls()
|
||||||
|
.sortBy(MtbGrup::getDescrizione)
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<MtbGrup> getAvailableGruppoMerc(List<MtbGrup> mtbGrupFullList) {
|
||||||
|
|
||||||
|
if (currentNumOrdsPredicate.get() == null &&
|
||||||
|
currentClientePredicate.get() == null &&
|
||||||
|
currentDataConsPredicate.get() == null &&
|
||||||
|
currentTermConsPredicate.get() == null &&
|
||||||
|
currentVettorePredicate.get() == null &&
|
||||||
|
currentAutomezzoPredicate.get() == null &&
|
||||||
|
currentIdViaggioPredicate.get() == null &&
|
||||||
|
currentAgentePredicate.get() == null &&
|
||||||
|
currentPaesePredicate.get() == null &&
|
||||||
|
currentDepositoPredicate.get() == null
|
||||||
|
) {
|
||||||
|
return getAllGruppoMerc(mtbGrupFullList);
|
||||||
|
} else {
|
||||||
|
List<String> availableCodMgrups = Stream.of(this.initialOrderList)
|
||||||
|
.filter(x ->
|
||||||
|
(currentNumOrdsPredicate.get() == null || (currentNumOrdsPredicate.get().test(x))) &&
|
||||||
|
(currentClientePredicate.get() == null || (currentClientePredicate.get().test(x))) &&
|
||||||
|
(currentDataConsPredicate.get() == null || (currentDataConsPredicate.get().test(x))) &&
|
||||||
|
(currentTermConsPredicate.get() == null || (currentTermConsPredicate.get().test(x))) &&
|
||||||
|
(currentVettorePredicate.get() == null || (currentVettorePredicate.get().test(x))) &&
|
||||||
|
(currentAutomezzoPredicate.get() == null || (currentAutomezzoPredicate.get().test(x))) &&
|
||||||
|
(currentIdViaggioPredicate.get() == null || (currentIdViaggioPredicate.get().test(x))) &&
|
||||||
|
(currentAgentePredicate.get() == null || (currentAgentePredicate.get().test(x))) &&
|
||||||
|
(currentPaesePredicate.get() == null || (currentPaesePredicate.get().test(x))) &&
|
||||||
|
(currentDepositoPredicate.get() == null || (currentDepositoPredicate.get().test(x)))
|
||||||
|
)
|
||||||
|
.flatMap(x -> Stream.of(x.getAvailableClassMerc()))
|
||||||
|
.map(OrdineUscitaInevasoDTO.AvailableClassMerc::getCodMgrp)
|
||||||
|
.distinct()
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
return Stream.of(Objects.requireNonNull(mtbGrupFullList))
|
||||||
|
.filter(x -> availableCodMgrups.contains(x.getCodMgrp()))
|
||||||
|
.distinct()
|
||||||
|
.withoutNulls()
|
||||||
|
.sortBy(MtbGrup::getDescrizione)
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -31,7 +31,7 @@ public class OrdiniUscitaElencoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
@Override
|
@Override
|
||||||
public void onResponse(Call<ServiceRESTResponse<List<DtbOrdt>>> call, Response<ServiceRESTResponse<List<DtbOrdt>>> response) {
|
public void onResponse(Call<ServiceRESTResponse<List<DtbOrdt>>> call, Response<ServiceRESTResponse<List<DtbOrdt>>> response) {
|
||||||
analyzeAnswer(response, "getOrdiniFromCommessaCollo", (m) -> {
|
analyzeAnswer(response, "getOrdiniFromCommessaCollo", (m) -> {
|
||||||
onComplete.run(response.body().getEntity());
|
onComplete.run(response.body().getDto());
|
||||||
}, onFailed);
|
}, onFailed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ import it.integry.integrywmsnative.core.data_recover.ColliDataRecoverService;
|
|||||||
import it.integry.integrywmsnative.core.exception.InvalidLUException;
|
import it.integry.integrywmsnative.core.exception.InvalidLUException;
|
||||||
import it.integry.integrywmsnative.core.exception.NoArtsFoundException;
|
import it.integry.integrywmsnative.core.exception.NoArtsFoundException;
|
||||||
import it.integry.integrywmsnative.core.exception.NoLUFoundException;
|
import it.integry.integrywmsnative.core.exception.NoLUFoundException;
|
||||||
import it.integry.integrywmsnative.core.exception.NoPrintersFoundException;
|
|
||||||
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;
|
||||||
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILUBaseOperationsListener;
|
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILUBaseOperationsListener;
|
||||||
@@ -30,7 +29,6 @@ import it.integry.integrywmsnative.core.model.MtbAart;
|
|||||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||||
import it.integry.integrywmsnative.core.model.dto.PickDataDTO;
|
import it.integry.integrywmsnative.core.model.dto.PickDataDTO;
|
||||||
import it.integry.integrywmsnative.core.report.ReportManager;
|
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||||
@@ -209,26 +207,17 @@ public class PickingResiViewModel {
|
|||||||
if (!shouldPrint) {
|
if (!shouldPrint) {
|
||||||
onComplete.run();
|
onComplete.run();
|
||||||
} else {
|
} else {
|
||||||
this.mPrinterRESTConsumer.getAvailablePrinters(mDefaultCodMdepOfLU, PrinterRESTConsumer.Type.PRIMARIA, printerList -> {
|
singlePrint(mtbColtToPrint, onComplete, ex -> this.sendLUPrintError(ex, onComplete));
|
||||||
if (printerList == null || printerList.size() == 0) {
|
|
||||||
this.sendError(new NoPrintersFoundException());
|
|
||||||
onComplete.run();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
singlePrint(mtbColtToPrint, printerList.get(0), onComplete, ex -> this.sendLUPrintError(ex, onComplete));
|
|
||||||
}, this::sendError);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void singlePrint(MtbColt mtbColtToPrint, String printerName, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
private void singlePrint(MtbColt mtbColtToPrint, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
String reportName = ReportManager.getReportNameLUFromGestione(mtbColtToPrint.getGestioneEnum());
|
|
||||||
|
|
||||||
this.mPrinterRESTConsumer.printCollo(
|
this.mPrinterRESTConsumer.printCollo(
|
||||||
printerName,
|
PrinterRESTConsumer.Type.PRIMARIA,
|
||||||
mtbColtToPrint,
|
mtbColtToPrint,
|
||||||
1,
|
onComplete, onFailed);
|
||||||
reportName, onComplete, onFailed);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.prod_accettazione_ord_produzione;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.FilterNumeroOrdineLayoutView;
|
||||||
|
import it.integry.integrywmsnative.gest.prod_accettazione_ord_produzione.filters.FilterCommessaLayoutView;
|
||||||
|
import it.integry.integrywmsnative.ui.filter_chips.FilterChipDTO;
|
||||||
|
|
||||||
|
public class ProdOrdineProduzioneElencoBindings {
|
||||||
|
|
||||||
|
public static final int NUM_ORD_FILTER_ID = 0;
|
||||||
|
public static final int COMMESSA_FILTER_ID = 1;
|
||||||
|
|
||||||
|
public static final HashMap<Integer, FilterChipDTO> AVAILABLE_FILTERS = new HashMap<>() {{
|
||||||
|
|
||||||
|
put(NUM_ORD_FILTER_ID, new FilterChipDTO()
|
||||||
|
.setID(NUM_ORD_FILTER_ID)
|
||||||
|
.setFilterChipText("Numero ordine")
|
||||||
|
.setFilterLayoutView(new FilterNumeroOrdineLayoutView()));
|
||||||
|
|
||||||
|
put(COMMESSA_FILTER_ID, new FilterChipDTO()
|
||||||
|
.setID(COMMESSA_FILTER_ID)
|
||||||
|
.setFilterChipText("Commessa")
|
||||||
|
.setFilterLayoutView(new FilterCommessaLayoutView()));
|
||||||
|
|
||||||
|
}};
|
||||||
|
|
||||||
|
}
|
||||||
@@ -19,6 +19,7 @@ import com.annimon.stream.Stream;
|
|||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
@@ -27,9 +28,11 @@ import it.integry.integrywmsnative.R;
|
|||||||
import it.integry.integrywmsnative.core.data_cache.DataCache;
|
import it.integry.integrywmsnative.core.data_cache.DataCache;
|
||||||
import it.integry.integrywmsnative.core.di.BindableBoolean;
|
import it.integry.integrywmsnative.core.di.BindableBoolean;
|
||||||
import it.integry.integrywmsnative.core.expansion.BaseFragment;
|
import it.integry.integrywmsnative.core.expansion.BaseFragment;
|
||||||
import it.integry.integrywmsnative.core.interfaces.IFilterableFragment;
|
import it.integry.integrywmsnative.core.expansion.OnGeneralChangedCallback;
|
||||||
import it.integry.integrywmsnative.core.interfaces.IScrollableFragment;
|
import it.integry.integrywmsnative.core.interfaces.IScrollableFragment;
|
||||||
import it.integry.integrywmsnative.core.interfaces.ITitledFragment;
|
import it.integry.integrywmsnative.core.interfaces.ITitledFragment;
|
||||||
|
import it.integry.integrywmsnative.core.model.JtbComt;
|
||||||
|
import it.integry.integrywmsnative.core.rest.consumers.CommessaRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityBigDecimal;
|
import it.integry.integrywmsnative.core.utility.UtilityBigDecimal;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||||
@@ -37,31 +40,38 @@ import it.integry.integrywmsnative.databinding.FragmentProdOrdineProduzioneElenc
|
|||||||
import it.integry.integrywmsnative.gest.accettazione.dto.OrdineAccettazioneInevasoDTO;
|
import it.integry.integrywmsnative.gest.accettazione.dto.OrdineAccettazioneInevasoDTO;
|
||||||
import it.integry.integrywmsnative.gest.accettazione.dto.SitArtOrdDTO;
|
import it.integry.integrywmsnative.gest.accettazione.dto.SitArtOrdDTO;
|
||||||
import it.integry.integrywmsnative.gest.accettazione_picking.AccettazionePickingActivity;
|
import it.integry.integrywmsnative.gest.accettazione_picking.AccettazionePickingActivity;
|
||||||
import it.integry.integrywmsnative.gest.prod_accettazione_ord_produzione.dialog.DialogOrdineProduzioneFiltroAvanzatoView;
|
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.FilterNumeroOrdineLayoutView;
|
||||||
import it.integry.integrywmsnative.gest.prod_accettazione_ord_produzione.dialog.DialogOrdineProduzioneFiltroAvanzatoViewModel;
|
import it.integry.integrywmsnative.gest.prod_accettazione_ord_produzione.filters.FilterCommessaLayoutView;
|
||||||
|
import it.integry.integrywmsnative.gest.prod_accettazione_ord_produzione.filters.OrdineProduzioneFilterViewModel;
|
||||||
import it.integry.integrywmsnative.gest.prod_accettazione_ord_produzione.ui.MainListProdOrdineProduzioneElencoClienteListModel;
|
import it.integry.integrywmsnative.gest.prod_accettazione_ord_produzione.ui.MainListProdOrdineProduzioneElencoClienteListModel;
|
||||||
import it.integry.integrywmsnative.gest.prod_accettazione_ord_produzione.ui.MainListProdOrdineProduzioneElencoListModel;
|
import it.integry.integrywmsnative.gest.prod_accettazione_ord_produzione.ui.MainListProdOrdineProduzioneElencoListModel;
|
||||||
import it.integry.integrywmsnative.gest.prod_accettazione_ord_produzione.ui.OrdineProduzioneListAdapter;
|
import it.integry.integrywmsnative.gest.prod_accettazione_ord_produzione.ui.OrdineProduzioneListAdapter;
|
||||||
|
import it.integry.integrywmsnative.ui.filter_chips.FilterChipDTO;
|
||||||
|
import it.integry.integrywmsnative.ui.filter_chips.FilterChipView;
|
||||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A simple {@link Fragment} subclass.
|
* A simple {@link Fragment} subclass.
|
||||||
*/
|
*/
|
||||||
public class ProdOrdineProduzioneElencoFragment extends BaseFragment implements ProdOrdineProduzioneElencoViewModel.Listener, ITitledFragment, IScrollableFragment, IFilterableFragment {
|
public class ProdOrdineProduzioneElencoFragment extends BaseFragment implements ProdOrdineProduzioneElencoViewModel.Listener, ITitledFragment, IScrollableFragment {
|
||||||
|
|
||||||
public BindableBoolean fabVisible = new BindableBoolean(false);
|
public BindableBoolean fabVisible = new BindableBoolean(false);
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
ProdOrdineProduzioneElencoViewModel mViewModel;
|
ProdOrdineProduzioneElencoViewModel mViewModel;
|
||||||
|
|
||||||
private FragmentProdOrdineProduzioneElencoBinding mBinding;
|
@Inject
|
||||||
|
CommessaRESTConsumer mCommessaRESTConsumer;
|
||||||
|
|
||||||
|
private FragmentProdOrdineProduzioneElencoBinding mBindings;
|
||||||
|
|
||||||
private final ObservableArrayList<MainListProdOrdineProduzioneElencoListModel> mOrdiniInevasiMutableData = new ObservableArrayList<>();
|
private final ObservableArrayList<MainListProdOrdineProduzioneElencoListModel> mOrdiniInevasiMutableData = new ObservableArrayList<>();
|
||||||
|
|
||||||
private AppCompatTextView mAppBarTitle;
|
private AppCompatTextView mAppBarTitle;
|
||||||
|
|
||||||
private DialogOrdineProduzioneFiltroAvanzatoViewModel mAppliedFilterViewModel;
|
// private DialogOrdineProduzioneFiltroAvanzatoViewModel mAppliedFilterViewModel;
|
||||||
|
private OrdineProduzioneFilterViewModel mFilterViewModel = new OrdineProduzioneFilterViewModel();
|
||||||
|
private List<JtbComt> jtbComtCache;
|
||||||
|
|
||||||
public ProdOrdineProduzioneElencoFragment() {
|
public ProdOrdineProduzioneElencoFragment() {
|
||||||
// Required empty public constructor
|
// Required empty public constructor
|
||||||
@@ -84,7 +94,7 @@ public class ProdOrdineProduzioneElencoFragment extends BaseFragment implements
|
|||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
mBinding = DataBindingUtil.inflate(inflater, R.layout.fragment_prod_ordine_produzione_elenco, container, false);
|
mBindings = DataBindingUtil.inflate(inflater, R.layout.fragment_prod_ordine_produzione_elenco, container, false);
|
||||||
|
|
||||||
MainApplication.appComponent
|
MainApplication.appComponent
|
||||||
.prodOrdineProduzioneElencoComponent()
|
.prodOrdineProduzioneElencoComponent()
|
||||||
@@ -93,12 +103,13 @@ public class ProdOrdineProduzioneElencoFragment extends BaseFragment implements
|
|||||||
|
|
||||||
mViewModel.setListener(this);
|
mViewModel.setListener(this);
|
||||||
|
|
||||||
mBinding.setLifecycleOwner(this);
|
mBindings.setLifecycleOwner(this);
|
||||||
mBinding.setView(this);
|
mBindings.setView(this);
|
||||||
|
|
||||||
this.initRecyclerView();
|
this.initRecyclerView();
|
||||||
|
this.initFilters();
|
||||||
|
|
||||||
return mBinding.getRoot();
|
return mBindings.getRoot();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -119,9 +130,16 @@ public class ProdOrdineProduzioneElencoFragment extends BaseFragment implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initRecyclerView() {
|
private void initRecyclerView() {
|
||||||
this.mViewModel.getOrderList().observe(getViewLifecycleOwner(), this::refreshList);
|
this.mViewModel.getOrderList().observe(getViewLifecycleOwner(), v -> {
|
||||||
|
this.onLoadingStarted();
|
||||||
|
this.initJtbComtCache(this::onLoadingEnded);
|
||||||
|
|
||||||
mBinding.ordineProduzioneMainList.setLayoutManager(new LinearLayoutManager(getActivity()));
|
mFilterViewModel.init(mViewModel.getOrderList().getValue());
|
||||||
|
|
||||||
|
this.refreshList(null);
|
||||||
|
});
|
||||||
|
|
||||||
|
mBindings.ordineProduzioneMainList.setLayoutManager(new LinearLayoutManager(getActivity()));
|
||||||
|
|
||||||
OrdineProduzioneListAdapter adapter = new OrdineProduzioneListAdapter(getActivity(), mOrdiniInevasiMutableData)
|
OrdineProduzioneListAdapter adapter = new OrdineProduzioneListAdapter(getActivity(), mOrdiniInevasiMutableData)
|
||||||
.setOnGroupItemClicked(x -> {
|
.setOnGroupItemClicked(x -> {
|
||||||
@@ -146,23 +164,129 @@ public class ProdOrdineProduzioneElencoFragment extends BaseFragment implements
|
|||||||
.anyMatch(y -> y.getSelectedObservable().get()));
|
.anyMatch(y -> y.getSelectedObservable().get()));
|
||||||
});
|
});
|
||||||
|
|
||||||
adapter.setEmptyView(mBinding.ordiniProduzioneEmptyView);
|
adapter.setEmptyView(mBindings.ordiniProduzioneEmptyView);
|
||||||
|
|
||||||
mBinding.ordineProduzioneMainList.setAdapter(adapter);
|
mBindings.ordineProduzioneMainList.setAdapter(adapter);
|
||||||
|
|
||||||
|
// mToolbar.setRecyclerView(mBindings.ordineProduzioneMainList);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initFilters() {
|
||||||
|
var onPredicateChanged = new OnGeneralChangedCallback() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
refreshList(null);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
mFilterViewModel.getCurrentNumOrdsPredicate().addOnPropertyChangedCallback(onPredicateChanged);
|
||||||
|
mFilterViewModel.getCurrentCommPredicate().addOnPropertyChangedCallback(onPredicateChanged);
|
||||||
|
|
||||||
|
|
||||||
|
for (var filterChipDTO : ProdOrdineProduzioneElencoBindings.AVAILABLE_FILTERS.entrySet()) {
|
||||||
|
|
||||||
|
FilterChipView filterChipView = new FilterChipView(
|
||||||
|
requireActivity(),
|
||||||
|
filterChipDTO.getValue().getFilterChipText(),
|
||||||
|
v -> initBottomSheetDialogFilter(filterChipDTO.getValue()));
|
||||||
|
|
||||||
|
switch (filterChipDTO.getKey()) {
|
||||||
|
case ProdOrdineProduzioneElencoBindings.COMMESSA_FILTER_ID:
|
||||||
|
mFilterViewModel.getCurrentCommPredicate().addOnPropertyChangedCallback(new OnGeneralChangedCallback() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (mFilterViewModel.getCurrentCommPredicate().get() == null) {
|
||||||
|
filterChipView.disableCloseIcon();
|
||||||
|
|
||||||
|
mBindings.filterChipsGroup.removeView(filterChipView);
|
||||||
|
mBindings.filterChipsGroup.addView(filterChipView);
|
||||||
|
mBindings.filterChips.smoothScrollTo(0, 0);
|
||||||
|
} else {
|
||||||
|
filterChipView.enableCloseIcon();
|
||||||
|
|
||||||
|
mBindings.filterChipsGroup.removeView(filterChipView);
|
||||||
|
mBindings.filterChipsGroup.addView(filterChipView, 0);
|
||||||
|
mBindings.filterChips.smoothScrollTo(0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
filterChipView.setOnResetClicked(() -> mFilterViewModel.getCurrentCommPredicate().set(null));
|
||||||
|
break;
|
||||||
|
case ProdOrdineProduzioneElencoBindings.NUM_ORD_FILTER_ID:
|
||||||
|
mFilterViewModel.getCurrentNumOrdsPredicate().addOnPropertyChangedCallback(new OnGeneralChangedCallback() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (mFilterViewModel.getCurrentNumOrdsPredicate().get() == null) {
|
||||||
|
filterChipView.disableCloseIcon();
|
||||||
|
|
||||||
|
mBindings.filterChipsGroup.removeView(filterChipView);
|
||||||
|
mBindings.filterChipsGroup.addView(filterChipView);
|
||||||
|
mBindings.filterChips.smoothScrollTo(0, 0);
|
||||||
|
} else {
|
||||||
|
filterChipView.enableCloseIcon();
|
||||||
|
|
||||||
|
mBindings.filterChipsGroup.removeView(filterChipView);
|
||||||
|
mBindings.filterChipsGroup.addView(filterChipView, 0);
|
||||||
|
mBindings.filterChips.smoothScrollTo(0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
filterChipView.setOnResetClicked(() -> mFilterViewModel.getCurrentNumOrdsPredicate().set(null));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
this.mBindings.filterChipsGroup.addView(filterChipView);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initBottomSheetDialogFilter(FilterChipDTO filterChipDTO) {
|
||||||
|
filterChipDTO
|
||||||
|
.getFilterLayoutView()
|
||||||
|
.setFilterName(filterChipDTO.getFilterChipText())
|
||||||
|
.setContext(requireActivity());
|
||||||
|
|
||||||
|
var filterLayoutView = filterChipDTO
|
||||||
|
.getFilterLayoutView();
|
||||||
|
|
||||||
|
switch (filterChipDTO.getID()) {
|
||||||
|
case ProdOrdineProduzioneElencoBindings.COMMESSA_FILTER_ID:
|
||||||
|
((FilterCommessaLayoutView) filterLayoutView)
|
||||||
|
.setAllCommesse(mFilterViewModel.getAllCommesse(jtbComtCache))
|
||||||
|
.setAvailableCommesse(mFilterViewModel.getAvailableCommesse(jtbComtCache))
|
||||||
|
.setOnFilterApplied(mFilterViewModel::setCommessaFilter)
|
||||||
|
.setPreSelectedCommesse(Stream.of(Objects.requireNonNull(mViewModel.getOrderList().getValue()))
|
||||||
|
.filter(mFilterViewModel.getCurrentCommPredicate().get() == null ?
|
||||||
|
x -> false :
|
||||||
|
mFilterViewModel.getCurrentCommPredicate().get())
|
||||||
|
.map(x -> Stream.of(jtbComtCache).filter(y -> x.getCodJcom().equalsIgnoreCase(y.getCodJcom())).findFirst().get())
|
||||||
|
.toList());
|
||||||
|
break;
|
||||||
|
case ProdOrdineProduzioneElencoBindings.NUM_ORD_FILTER_ID:
|
||||||
|
((FilterNumeroOrdineLayoutView) filterLayoutView)
|
||||||
|
.setAllNumOrds(mFilterViewModel.getAllNumOrds())
|
||||||
|
.setAvailableNumOrds(mFilterViewModel.getAvailableNumOrds())
|
||||||
|
.setOnFilterApplied(mFilterViewModel::setNumOrdFilter)
|
||||||
|
.setPreSelectedNumOrds(Stream.of(Objects.requireNonNull(mViewModel.getOrderList().getValue()))
|
||||||
|
.filter(mFilterViewModel.getCurrentNumOrdsPredicate().get() == null ?
|
||||||
|
x -> false :
|
||||||
|
mFilterViewModel.getCurrentNumOrdsPredicate().get())
|
||||||
|
.map(OrdineAccettazioneInevasoDTO::getNumero)
|
||||||
|
.toList());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
filterLayoutView.show(requireActivity().getSupportFragmentManager(), "TAG");
|
||||||
|
|
||||||
mToolbar.setRecyclerView(mBinding.ordineProduzioneMainList);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void refreshList(List<OrdineAccettazioneInevasoDTO> filteredList) {
|
private void refreshList(List<OrdineAccettazioneInevasoDTO> filteredList) {
|
||||||
|
|
||||||
List<OrdineAccettazioneInevasoDTO> tmpList = null;
|
List<OrdineAccettazioneInevasoDTO> tmpList = null;
|
||||||
|
|
||||||
if(filteredList != null) {
|
if (filteredList != null) {
|
||||||
tmpList = filteredList;
|
tmpList = filteredList;
|
||||||
} else if (mAppliedFilterViewModel != null) {
|
} else if (mFilterViewModel != null) {
|
||||||
mAppliedFilterViewModel.init(mViewModel.getOrderList().getValue());
|
mFilterViewModel.applyAllTests();
|
||||||
mAppliedFilterViewModel.applyAllTests();
|
tmpList = mFilterViewModel.getMutableFilteredOrderList().getValue();
|
||||||
tmpList = mAppliedFilterViewModel.getMutableFilteredOrderList().getValue();
|
|
||||||
} else {
|
} else {
|
||||||
tmpList = mViewModel.getOrderList().getValue();
|
tmpList = mViewModel.getOrderList().getValue();
|
||||||
}
|
}
|
||||||
@@ -210,20 +334,20 @@ public class ProdOrdineProduzioneElencoFragment extends BaseFragment implements
|
|||||||
this.mViewModel.loadPicking(selectedOrders);
|
this.mViewModel.loadPicking(selectedOrders);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// @Override
|
||||||
public void onFilterClick() {
|
// public void onFilterClick() {
|
||||||
DialogOrdineProduzioneFiltroAvanzatoView.make(
|
// DialogOrdineProduzioneFiltroAvanzatoView.make(
|
||||||
getActivity(),
|
// getActivity(),
|
||||||
this.mViewModel.getOrderList().getValue(),
|
// this.mViewModel.getOrderList().getValue(),
|
||||||
mAppliedFilterViewModel,
|
// mAppliedFilterViewModel,
|
||||||
|
//
|
||||||
filter -> {
|
// filter -> {
|
||||||
|
//
|
||||||
mAppliedFilterViewModel = filter;
|
// mAppliedFilterViewModel = filter;
|
||||||
refreshList(null);
|
// refreshList(null);
|
||||||
|
//
|
||||||
}).show();
|
// }).show();
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -256,4 +380,18 @@ public class ProdOrdineProduzioneElencoFragment extends BaseFragment implements
|
|||||||
|
|
||||||
}).show(getActivity().getSupportFragmentManager(), "tag");
|
}).show(getActivity().getSupportFragmentManager(), "tag");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void initJtbComtCache(Runnable onComplete) {
|
||||||
|
var jtbComts = Stream.of(Objects.requireNonNull(this.mViewModel.getOrderList().getValue()))
|
||||||
|
.flatMap(x -> Stream.of(x.getCodJcom()))
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
this.mCommessaRESTConsumer.getJtbComts(jtbComts, jtbComtCache -> {
|
||||||
|
this.jtbComtCache = jtbComtCache;
|
||||||
|
onComplete.run();
|
||||||
|
}, this::onError);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,175 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.prod_accettazione_ord_produzione.filters;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.databinding.DataBindingUtil;
|
||||||
|
import androidx.lifecycle.MutableLiveData;
|
||||||
|
|
||||||
|
import com.annimon.stream.ComparatorCompat;
|
||||||
|
import com.annimon.stream.Stream;
|
||||||
|
import com.ravikoradiya.liveadapter.LiveAdapter;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.BR;
|
||||||
|
import it.integry.integrywmsnative.R;
|
||||||
|
import it.integry.integrywmsnative.core.di.BindableBoolean;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
|
import it.integry.integrywmsnative.core.model.JtbComt;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityBoolean;
|
||||||
|
import it.integry.integrywmsnative.databinding.LayoutFilterCommessaBinding;
|
||||||
|
import it.integry.integrywmsnative.ui.filter_chips.FilterLayoutView;
|
||||||
|
|
||||||
|
public class FilterCommessaLayoutView extends FilterLayoutView {
|
||||||
|
|
||||||
|
protected LayoutFilterCommessaBinding mBindings;
|
||||||
|
|
||||||
|
private List<JtbComt> allCommesse;
|
||||||
|
private List<JtbComt> availableCommesse;
|
||||||
|
private List<JtbComt> preSelectedCommesse = new ArrayList<>();
|
||||||
|
private List<JtbComt> hiddenCommesse = new ArrayList<>();
|
||||||
|
private final MutableLiveData<List<ListModel>> listModel = new MutableLiveData<>();
|
||||||
|
|
||||||
|
private RunnableArgs<List<JtbComt>> onFilterApplied;
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
|
mBindings = DataBindingUtil.inflate(inflater, R.layout.layout_filter_commessa, container, false);
|
||||||
|
this.mBindings.setView(this);
|
||||||
|
|
||||||
|
refreshList();
|
||||||
|
|
||||||
|
this.setSearchView(this.mBindings.searchView, newFilter -> {
|
||||||
|
hiddenCommesse = Stream.of(allCommesse)
|
||||||
|
.filter(x -> !x.getCodJcom().toUpperCase(Locale.ROOT).contains(newFilter.toUpperCase(Locale.ROOT)) &&
|
||||||
|
!x.getDescrizione().toUpperCase(Locale.ROOT).contains(newFilter.toUpperCase(Locale.ROOT)))
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
refreshList();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
new LiveAdapter(listModel, getViewLifecycleOwner(), BR.item)
|
||||||
|
.map(ListModel.class, R.layout.layout_filter_commessa__list_item)
|
||||||
|
.into(this.mBindings.recyclerview);
|
||||||
|
|
||||||
|
return mBindings.getRoot();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshList() {
|
||||||
|
ComparatorCompat<ListModel> c =
|
||||||
|
ComparatorCompat
|
||||||
|
.chain(new ComparatorCompat<ListModel>((x, y) -> UtilityBoolean.toInt(x.getSelected().get()) - UtilityBoolean.toInt(y.getSelected().get())))
|
||||||
|
.thenComparing(new ComparatorCompat<>((x, y) -> UtilityBoolean.toInt(x.getEnabled().get()) - UtilityBoolean.toInt(y.getEnabled().get())))
|
||||||
|
.thenComparing(new ComparatorCompat<>((x, y) -> y.getOriginalModel().getCodJcom().compareTo(x.getOriginalModel().getCodJcom())))
|
||||||
|
.reversed();
|
||||||
|
|
||||||
|
listModel.setValue(Stream.of(getAllCommesse())
|
||||||
|
.filter(x -> !hiddenCommesse.contains(x))
|
||||||
|
.map(x -> {
|
||||||
|
var selectedBoolean = new BindableBoolean(preSelectedCommesse.contains(x));
|
||||||
|
selectedBoolean.addOnPropertyChangedCallback(() -> {
|
||||||
|
if (selectedBoolean.get()) preSelectedCommesse.add(x);
|
||||||
|
else preSelectedCommesse.remove(x);
|
||||||
|
});
|
||||||
|
|
||||||
|
return new ListModel()
|
||||||
|
.setSelected(selectedBoolean)
|
||||||
|
.setEnabled(new BindableBoolean(availableCommesse.contains(x)))
|
||||||
|
.setOriginalModel(x);
|
||||||
|
})
|
||||||
|
.sorted(c)
|
||||||
|
.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void onConfirm() {
|
||||||
|
if (onFilterApplied == null) return;
|
||||||
|
|
||||||
|
this.onFilterApplied.run(Stream.of(Objects.requireNonNull(listModel.getValue()))
|
||||||
|
.filter(x -> x.selected.get())
|
||||||
|
.map(x -> x.originalModel)
|
||||||
|
.toList());
|
||||||
|
|
||||||
|
dismiss();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<JtbComt> getAllCommesse() {
|
||||||
|
return allCommesse;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterCommessaLayoutView setAllCommesse(List<JtbComt> allCommesse) {
|
||||||
|
this.allCommesse = allCommesse;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<JtbComt> getAvailableCommesse() {
|
||||||
|
return availableCommesse;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterCommessaLayoutView setAvailableCommesse(List<JtbComt> availableCommesse) {
|
||||||
|
this.availableCommesse = availableCommesse;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<JtbComt> getPreSelectedCommesse() {
|
||||||
|
return preSelectedCommesse;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterCommessaLayoutView setPreSelectedCommesse(List<JtbComt> preSelectedCommesse) {
|
||||||
|
this.preSelectedCommesse = preSelectedCommesse;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RunnableArgs<List<JtbComt>> getOnFilterApplied() {
|
||||||
|
return onFilterApplied;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterCommessaLayoutView setOnFilterApplied(RunnableArgs<List<JtbComt>> onFilterApplied) {
|
||||||
|
this.onFilterApplied = onFilterApplied;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class ListModel {
|
||||||
|
private BindableBoolean selected = new BindableBoolean();
|
||||||
|
private BindableBoolean enabled = new BindableBoolean();
|
||||||
|
private JtbComt originalModel;
|
||||||
|
|
||||||
|
public BindableBoolean getSelected() {
|
||||||
|
return selected;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ListModel setSelected(BindableBoolean selected) {
|
||||||
|
this.selected = selected;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BindableBoolean getEnabled() {
|
||||||
|
return enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ListModel setEnabled(BindableBoolean enabled) {
|
||||||
|
this.enabled = enabled;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public JtbComt getOriginalModel() {
|
||||||
|
return originalModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ListModel setOriginalModel(JtbComt originalModel) {
|
||||||
|
this.originalModel = originalModel;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,136 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.prod_accettazione_ord_produzione.filters;
|
||||||
|
|
||||||
|
import androidx.databinding.ObservableField;
|
||||||
|
import androidx.lifecycle.MutableLiveData;
|
||||||
|
|
||||||
|
import com.annimon.stream.Stream;
|
||||||
|
import com.annimon.stream.function.Predicate;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.model.JtbComt;
|
||||||
|
import it.integry.integrywmsnative.gest.accettazione.dto.OrdineAccettazioneInevasoDTO;
|
||||||
|
|
||||||
|
public class OrdineProduzioneFilterViewModel {
|
||||||
|
private final ObservableField<Predicate<OrdineAccettazioneInevasoDTO>> currentNumOrdsPredicate = new ObservableField<>();
|
||||||
|
private final ObservableField<Predicate<OrdineAccettazioneInevasoDTO>> currentCommPredicate = new ObservableField<>();
|
||||||
|
|
||||||
|
|
||||||
|
private List<OrdineAccettazioneInevasoDTO> initialOrderList;
|
||||||
|
private final MutableLiveData<List<OrdineAccettazioneInevasoDTO>> currentFilteredOrderList = new MutableLiveData<>();
|
||||||
|
|
||||||
|
public void init(List<OrdineAccettazioneInevasoDTO> initialList) {
|
||||||
|
this.initialOrderList = initialList;
|
||||||
|
this.currentFilteredOrderList.setValue(this.initialOrderList);
|
||||||
|
}
|
||||||
|
public MutableLiveData<List<OrdineAccettazioneInevasoDTO>> getMutableFilteredOrderList() {
|
||||||
|
return this.currentFilteredOrderList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNumOrdFilter(List<Integer> numOrds) {
|
||||||
|
if (numOrds == null || numOrds.isEmpty()) currentNumOrdsPredicate.set(null);
|
||||||
|
else {
|
||||||
|
currentNumOrdsPredicate.set(o -> numOrds.contains(o.getNumero()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCommessaFilter(List<JtbComt> jtbComtList) {
|
||||||
|
if (jtbComtList == null || jtbComtList.isEmpty()) currentCommPredicate.set(null);
|
||||||
|
else {
|
||||||
|
List<String> codMdeps = Stream.of(jtbComtList).map(JtbComt::getCodJcom).toList();
|
||||||
|
currentCommPredicate.set(o -> codMdeps.contains(o.getCodJcom()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void applyAllTests() {
|
||||||
|
List<OrdineAccettazioneInevasoDTO> returnList = null;
|
||||||
|
|
||||||
|
if (currentNumOrdsPredicate.get() == null &&
|
||||||
|
currentCommPredicate.get() == null
|
||||||
|
) {
|
||||||
|
returnList = this.initialOrderList;
|
||||||
|
} else {
|
||||||
|
Stream<OrdineAccettazioneInevasoDTO> tmpStream = Stream.of(this.initialOrderList)
|
||||||
|
.filter(x ->
|
||||||
|
(currentNumOrdsPredicate.get() == null || (currentNumOrdsPredicate.get().test(x))) &&
|
||||||
|
(currentCommPredicate.get() == null || (currentCommPredicate.get().test(x))));
|
||||||
|
|
||||||
|
returnList = tmpStream.toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.currentFilteredOrderList.setValue(returnList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ObservableField<Predicate<OrdineAccettazioneInevasoDTO>> getCurrentNumOrdsPredicate() {
|
||||||
|
return currentNumOrdsPredicate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ObservableField<Predicate<OrdineAccettazioneInevasoDTO>> getCurrentCommPredicate() {
|
||||||
|
return currentCommPredicate;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public List<JtbComt> getAllCommesse(List<JtbComt> commesseFullList) {
|
||||||
|
List<String> codJcom = Stream.of(initialOrderList)
|
||||||
|
.map(OrdineAccettazioneInevasoDTO::getCodJcom)
|
||||||
|
.distinct()
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
return Stream.of(Objects.requireNonNull(commesseFullList))
|
||||||
|
.filter(x -> codJcom.contains(x.getCodJcom()))
|
||||||
|
.distinct()
|
||||||
|
.withoutNulls()
|
||||||
|
.sortBy(JtbComt::getCodJcom)
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<JtbComt> getAvailableCommesse(List<JtbComt> commesseFullList) {
|
||||||
|
|
||||||
|
if (currentNumOrdsPredicate.get() == null) {
|
||||||
|
return getAllCommesse(commesseFullList);
|
||||||
|
} else {
|
||||||
|
List<String> availableCodMdeps = Stream.of(this.initialOrderList)
|
||||||
|
.filter(x ->
|
||||||
|
(currentNumOrdsPredicate.get() == null || (currentNumOrdsPredicate.get().test(x)))
|
||||||
|
)
|
||||||
|
.map(OrdineAccettazioneInevasoDTO::getCodJcom)
|
||||||
|
.distinct()
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
return Stream.of(Objects.requireNonNull(commesseFullList))
|
||||||
|
.filter(x -> availableCodMdeps.contains(x.getCodJcom()))
|
||||||
|
.distinct()
|
||||||
|
.withoutNulls()
|
||||||
|
.sortBy(JtbComt::getCodJcom)
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Integer> getAllNumOrds() {
|
||||||
|
return Stream
|
||||||
|
.of(Objects.requireNonNull(initialOrderList))
|
||||||
|
.filter(x -> x.getNumero() != null)
|
||||||
|
.sortBy(x -> -x.getNumero())
|
||||||
|
.map(x -> x.getNumero() != null ? x.getNumero() : null)
|
||||||
|
.distinct()
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Integer> getAvailableNumOrds() {
|
||||||
|
|
||||||
|
if (currentCommPredicate.get() == null
|
||||||
|
) {
|
||||||
|
return getAllNumOrds();
|
||||||
|
} else {
|
||||||
|
return Stream.of(this.initialOrderList)
|
||||||
|
.filter(x ->
|
||||||
|
(currentCommPredicate.get() == null || (currentCommPredicate.get().test(x)))
|
||||||
|
)
|
||||||
|
.map(OrdineAccettazioneInevasoDTO::getNumero)
|
||||||
|
.distinct()
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -22,7 +22,6 @@ import it.integry.integrywmsnative.core.model.CommonModelConsts;
|
|||||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||||
import it.integry.integrywmsnative.core.report.ReportManager;
|
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.PrinterRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.PrinterRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||||
@@ -109,8 +108,6 @@ public class ProdRecuperoMaterialeViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void dispatchItem(HistoryVersamentoProdULDTO item, MtbColt sourceMtbColt) {
|
public void dispatchItem(HistoryVersamentoProdULDTO item, MtbColt sourceMtbColt) {
|
||||||
BigDecimal qtaDaEvadere = BigDecimal.ZERO;
|
BigDecimal qtaDaEvadere = BigDecimal.ZERO;
|
||||||
BigDecimal numCnfDaEvadere = BigDecimal.ZERO;
|
BigDecimal numCnfDaEvadere = BigDecimal.ZERO;
|
||||||
@@ -214,8 +211,8 @@ public class ProdRecuperoMaterialeViewModel {
|
|||||||
UtilityBigDecimal.divide(mtbColtScarico.getMtbColr().get(0).getQtaCol(), mtbColtScarico.getMtbColr().get(0).getNumCnf()));
|
UtilityBigDecimal.divide(mtbColtScarico.getMtbColr().get(0).getQtaCol(), mtbColtScarico.getMtbColr().get(0).getNumCnf()));
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i = 0; i < mtbColtScarico.getMtbColr().size(); i++) {
|
for (int i = 0; i < mtbColtScarico.getMtbColr().size(); i++) {
|
||||||
if(mtbColtScarico.getMtbColr().get(i).getQtaCol().equals(BigDecimal.ZERO)) {
|
if (mtbColtScarico.getMtbColr().get(i).getQtaCol().equals(BigDecimal.ZERO)) {
|
||||||
mtbColtScarico.getMtbColr().remove(i);
|
mtbColtScarico.getMtbColr().remove(i);
|
||||||
i--;
|
i--;
|
||||||
}
|
}
|
||||||
@@ -288,39 +285,19 @@ public class ProdRecuperoMaterialeViewModel {
|
|||||||
|
|
||||||
|
|
||||||
private void printCollo(MtbColt mtbColtToPrint, Runnable onComplete) {
|
private void printCollo(MtbColt mtbColtToPrint, Runnable onComplete) {
|
||||||
|
singlePrint(mtbColtToPrint, onComplete, ex -> this.sendOnLUPrintError(ex, onComplete));
|
||||||
this.mPrinterRESTConsumer.getAvailablePrinters(SettingsManager.i().getUserSession().getDepo().getCodMdep(), PrinterRESTConsumer.Type.PRIMARIA, printerList -> {
|
|
||||||
|
|
||||||
if (printerList.size() > 0) {
|
|
||||||
try {
|
|
||||||
singlePrint(mtbColtToPrint, printerList.get(0), () -> {
|
|
||||||
onComplete.run();
|
|
||||||
}, ex -> this.sendOnLUPrintError(ex, onComplete));
|
|
||||||
|
|
||||||
} catch (Exception ex) {
|
|
||||||
this.sendError(ex);
|
|
||||||
onComplete.run();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.sendOnNoLUFound(onComplete);
|
|
||||||
}
|
|
||||||
}, this::sendError);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void singlePrint(MtbColt mtbColtToPrint, String printerName, Runnable onComplete, RunnableArgs<Exception> onAbort) {
|
private void singlePrint(MtbColt mtbColtToPrint, Runnable onComplete, RunnableArgs<Exception> onAbort) {
|
||||||
String reportName = ReportManager.getReportNameLUFromGestione(mtbColtToPrint.getGestioneEnum());
|
|
||||||
|
|
||||||
this.mPrinterRESTConsumer.printCollo(
|
this.mPrinterRESTConsumer.printCollo(
|
||||||
printerName,
|
PrinterRESTConsumer.Type.PRIMARIA,
|
||||||
mtbColtToPrint,
|
mtbColtToPrint,
|
||||||
1,
|
onComplete, onAbort);
|
||||||
reportName, onComplete, onAbort);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public MutableLiveData<List<HistoryVersamentoProdULDTO>> getOrderList() {
|
public MutableLiveData<List<HistoryVersamentoProdULDTO>> getOrderList() {
|
||||||
return mUlList;
|
return mUlList;
|
||||||
}
|
}
|
||||||
@@ -359,7 +336,8 @@ public class ProdRecuperoMaterialeViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void sendOnLURequest(boolean canLUBeCreated, boolean shouldCheckIfDocExist, RunnableArgss<MtbColt, Boolean> onComplete) {
|
private void sendOnLURequest(boolean canLUBeCreated, boolean shouldCheckIfDocExist, RunnableArgss<MtbColt, Boolean> onComplete) {
|
||||||
if(this.mListener != null) mListener.onLURequest(canLUBeCreated, shouldCheckIfDocExist, onComplete);
|
if (this.mListener != null)
|
||||||
|
mListener.onLURequest(canLUBeCreated, shouldCheckIfDocExist, onComplete);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendOnLUPrintError(Exception ex, Runnable onComplete) {
|
private void sendOnLUPrintError(Exception ex, Runnable onComplete) {
|
||||||
@@ -375,7 +353,6 @@ public class ProdRecuperoMaterialeViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public interface Listener extends ILoadingListener {
|
public interface Listener extends ILoadingListener {
|
||||||
|
|
||||||
void onError(Exception ex);
|
void onError(Exception ex);
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit;
|
package it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit;
|
||||||
|
|
||||||
import android.app.Dialog;
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
import android.text.SpannableString;
|
import android.text.SpannableString;
|
||||||
@@ -33,11 +34,10 @@ import it.integry.integrywmsnative.core.expansion.BaseActivity;
|
|||||||
import it.integry.integrywmsnative.core.rest.consumers.PVOrdiniAcquistoRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.PVOrdiniAcquistoRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityProgress;
|
|
||||||
import it.integry.integrywmsnative.databinding.ActivityPvOrdineAcquistoEditBinding;
|
import it.integry.integrywmsnative.databinding.ActivityPvOrdineAcquistoEditBinding;
|
||||||
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.ui.OrdineAcquistoArtListAdapter;
|
|
||||||
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.dialog.EditArticoloDialog;
|
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.dialog.EditArticoloDialog;
|
||||||
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.helper.PVEditOrderHelper;
|
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.helper.PVEditOrderHelper;
|
||||||
|
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.ui.OrdineAcquistoArtListAdapter;
|
||||||
import it.integry.integrywmsnative.ui.FabMenuCustomAnimations;
|
import it.integry.integrywmsnative.ui.FabMenuCustomAnimations;
|
||||||
import it.integry.integrywmsnative.ui.SimpleDividerItemDecoration;
|
import it.integry.integrywmsnative.ui.SimpleDividerItemDecoration;
|
||||||
import it.integry.integrywmsnative.view.dialogs.DialogAskAction;
|
import it.integry.integrywmsnative.view.dialogs.DialogAskAction;
|
||||||
@@ -46,6 +46,7 @@ import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
|||||||
|
|
||||||
public class PVOrdineAcquistoEditActivity extends BaseActivity {
|
public class PVOrdineAcquistoEditActivity extends BaseActivity {
|
||||||
|
|
||||||
|
private static String DATA_KEY_ORDER = "keyOrdine";
|
||||||
private Ordine mOrdine;
|
private Ordine mOrdine;
|
||||||
private Griglia mGriglia;
|
private Griglia mGriglia;
|
||||||
private List<ArticoloOrdine> mArticoli = new ArrayList<>();
|
private List<ArticoloOrdine> mArticoli = new ArrayList<>();
|
||||||
@@ -64,6 +65,13 @@ public class PVOrdineAcquistoEditActivity extends BaseActivity {
|
|||||||
ArticoloGrigliaRepository mArticoloGrigliaRepository;
|
ArticoloGrigliaRepository mArticoloGrigliaRepository;
|
||||||
|
|
||||||
|
|
||||||
|
public static Intent newInstance(Context context, Ordine ordine){
|
||||||
|
Intent myIntent = new Intent(context, PVOrdineAcquistoEditActivity.class);
|
||||||
|
String keyOrdine = DataCache.addItem(ordine);
|
||||||
|
myIntent.putExtra(DATA_KEY_ORDER, keyOrdine);
|
||||||
|
return myIntent;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@@ -77,7 +85,7 @@ public class PVOrdineAcquistoEditActivity extends BaseActivity {
|
|||||||
|
|
||||||
mBinding = DataBindingUtil.setContentView(this, R.layout.activity_pv_ordine_acquisto_edit);
|
mBinding = DataBindingUtil.setContentView(this, R.layout.activity_pv_ordine_acquisto_edit);
|
||||||
mBinding.setViewModel(this);
|
mBinding.setViewModel(this);
|
||||||
mOrdine = DataCache.retrieveItem(getIntent().getStringExtra("keyOrdine"));
|
mOrdine = DataCache.retrieveItem(getIntent().getStringExtra(DATA_KEY_ORDER));
|
||||||
setSupportActionBar(mBinding.toolbar);
|
setSupportActionBar(mBinding.toolbar);
|
||||||
mBinding.toolbar.setTitle(R.string.edit_order);
|
mBinding.toolbar.setTitle(R.string.edit_order);
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
@@ -136,13 +144,13 @@ public class PVOrdineAcquistoEditActivity extends BaseActivity {
|
|||||||
String text = "Stai per eliminare l'articolo <b> " + articoloOrdine.getDescrizione() + "</b> dall'ordine, <br> sei sicuro?";
|
String text = "Stai per eliminare l'articolo <b> " + articoloOrdine.getDescrizione() + "</b> dall'ordine, <br> sei sicuro?";
|
||||||
|
|
||||||
DialogSimpleMessageView.makeWarningDialog(new SpannableString(Html.fromHtml(text)), null, () -> this.runOnUiThread(() -> {
|
DialogSimpleMessageView.makeWarningDialog(new SpannableString(Html.fromHtml(text)), null, () -> this.runOnUiThread(() -> {
|
||||||
final Dialog progress = UtilityProgress.createDefaultProgressDialog(this);
|
this.openProgress();
|
||||||
mhelper.removeArticoloFromOrdine(articoloOrdine, () -> {
|
mhelper.removeArticoloFromOrdine(articoloOrdine, () -> {
|
||||||
progress.dismiss();
|
this.closeProgress();
|
||||||
BarcodeManager.enable();
|
BarcodeManager.enable();
|
||||||
runOnUiThread(this::fetchArticoli);
|
runOnUiThread(this::fetchArticoli);
|
||||||
}, e -> {
|
}, e -> {
|
||||||
progress.dismiss();
|
this.closeProgress();
|
||||||
runOnUiThread(() -> UtilityExceptions.defaultException(this, e));
|
runOnUiThread(() -> UtilityExceptions.defaultException(this, e));
|
||||||
});
|
});
|
||||||
}), () -> {
|
}), () -> {
|
||||||
@@ -159,16 +167,16 @@ public class PVOrdineAcquistoEditActivity extends BaseActivity {
|
|||||||
private void onScanSuccessful(BarcodeScanDTO dto) {
|
private void onScanSuccessful(BarcodeScanDTO dto) {
|
||||||
mBinding.closeActivityFab.close(false);
|
mBinding.closeActivityFab.close(false);
|
||||||
BarcodeManager.disable();
|
BarcodeManager.disable();
|
||||||
final Dialog progress = UtilityProgress.createDefaultProgressDialog(this);
|
this.openProgress();
|
||||||
mhelper.checkArticolo(
|
mhelper.checkArticolo(
|
||||||
mOrdine,
|
mOrdine,
|
||||||
dto.getStringValue(),
|
dto.getStringValue(),
|
||||||
articoloOrdine -> {
|
articoloOrdine -> {
|
||||||
progress.dismiss();
|
this.closeProgress();
|
||||||
addArticolo(articoloOrdine);
|
addArticolo(articoloOrdine);
|
||||||
},
|
},
|
||||||
e -> {
|
e -> {
|
||||||
progress.dismiss();
|
this.closeProgress();
|
||||||
handleException(e);
|
handleException(e);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -199,9 +207,9 @@ public class PVOrdineAcquistoEditActivity extends BaseActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void fetchArticoli() {
|
private void fetchArticoli() {
|
||||||
final Dialog progress = UtilityProgress.createDefaultProgressDialog(this);
|
this.openProgress();
|
||||||
mhelper.loadArticoli(mOrdine, articoli -> {
|
mhelper.loadArticoli(mOrdine, articoli -> {
|
||||||
progress.dismiss();
|
this.closeProgress();
|
||||||
mArticoli = articoli;
|
mArticoli = articoli;
|
||||||
runOnUiThread(() -> {
|
runOnUiThread(() -> {
|
||||||
mAdapter.updateItems(mArticoli);
|
mAdapter.updateItems(mArticoli);
|
||||||
@@ -218,22 +226,22 @@ public class PVOrdineAcquistoEditActivity extends BaseActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void exportOrdine() {
|
public void exportOrdine() {
|
||||||
final Dialog progress = UtilityProgress.createDefaultProgressDialog(this);
|
this.openProgress();
|
||||||
PVOrdiniAcquistoRESTConsumer.saveOrdine(mOrdine, mArticoli, mGriglia, (ordine) -> {
|
PVOrdiniAcquistoRESTConsumer.saveOrdine(mOrdine, mArticoli, mGriglia, (ordine) -> {
|
||||||
|
|
||||||
mOrdineRepository.updateOrder(ordine, ord -> {
|
mOrdineRepository.updateOrder(ordine, ord -> {
|
||||||
progress.dismiss();
|
this.closeProgress();
|
||||||
runOnUiThread(() -> {
|
runOnUiThread(() -> {
|
||||||
Toast.makeText(this, "Ordine salvato con successo", Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, "Ordine salvato con successo", Toast.LENGTH_SHORT).show();
|
||||||
onBackPressed();
|
onBackPressed();
|
||||||
});
|
});
|
||||||
}, e -> runOnUiThread(() -> {
|
}, e -> runOnUiThread(() -> {
|
||||||
progress.dismiss();
|
this.closeProgress();
|
||||||
UtilityExceptions.defaultException(this, e);
|
UtilityExceptions.defaultException(this, e);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
}, e -> runOnUiThread(() -> {
|
}, e -> runOnUiThread(() -> {
|
||||||
progress.dismiss();
|
this.closeProgress();
|
||||||
UtilityExceptions.defaultException(this, e);
|
UtilityExceptions.defaultException(this, e);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
@@ -247,16 +255,16 @@ public class PVOrdineAcquistoEditActivity extends BaseActivity {
|
|||||||
public void manualSearch(){
|
public void manualSearch(){
|
||||||
BarcodeManager.disable();
|
BarcodeManager.disable();
|
||||||
DialogSimpleInputHelper.makeInputDialog(this,"Inserisci il codice a barre/codice articolo da cercare",codice->{
|
DialogSimpleInputHelper.makeInputDialog(this,"Inserisci il codice a barre/codice articolo da cercare",codice->{
|
||||||
final Dialog progress = UtilityProgress.createDefaultProgressDialog(this);
|
this.openProgress();
|
||||||
mhelper.checkArticolo(
|
mhelper.checkArticolo(
|
||||||
mOrdine,
|
mOrdine,
|
||||||
codice,
|
codice,
|
||||||
articoloOrdine -> {
|
articoloOrdine -> {
|
||||||
progress.dismiss();
|
this.closeProgress();
|
||||||
addArticolo(articoloOrdine);
|
addArticolo(articoloOrdine);
|
||||||
},
|
},
|
||||||
e -> {
|
e -> {
|
||||||
progress.dismiss();
|
this.closeProgress();
|
||||||
handleException(e);
|
handleException(e);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ public class EditArticoloDialog {
|
|||||||
private ArticoloOrdine mSavedArt;
|
private ArticoloOrdine mSavedArt;
|
||||||
|
|
||||||
private boolean mLockedInput = false;
|
private boolean mLockedInput = false;
|
||||||
|
private Dialog mCurrentProgress;
|
||||||
|
|
||||||
|
|
||||||
public static Dialog make(Activity context, PVEditOrderHelper helper, ArticoloOrdine articolo, RunnableArgs<ArticoloOrdine> onDialogDismiss) {
|
public static Dialog make(Activity context, PVEditOrderHelper helper, ArticoloOrdine articolo, RunnableArgs<ArticoloOrdine> onDialogDismiss) {
|
||||||
@@ -128,7 +129,7 @@ public class EditArticoloDialog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void saveAndExit() {
|
public void saveAndExit() {
|
||||||
final Dialog progress = UtilityProgress.createDefaultProgressDialog(mContext);
|
this.openProgress();
|
||||||
try {
|
try {
|
||||||
float qtaOrd = Float.parseFloat(mBinding.qtaTot.getText().toString());
|
float qtaOrd = Float.parseFloat(mBinding.qtaTot.getText().toString());
|
||||||
if (qtaOrd <= 0) {
|
if (qtaOrd <= 0) {
|
||||||
@@ -138,12 +139,12 @@ public class EditArticoloDialog {
|
|||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
mContext.runOnUiThread(() -> UtilityExceptions.defaultException(mContext, e));
|
mContext.runOnUiThread(() -> UtilityExceptions.defaultException(mContext, e));
|
||||||
progress.dismiss();
|
this.closeProgress();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mHelper.saveArticoloToOrdine(mArticolo, () -> {
|
mHelper.saveArticoloToOrdine(mArticolo, () -> {
|
||||||
mSavedArt = mArticolo;
|
mSavedArt = mArticolo;
|
||||||
progress.dismiss();
|
this.closeProgress();
|
||||||
mDialog.dismiss();
|
mDialog.dismiss();
|
||||||
}, e -> mContext.runOnUiThread(() -> UtilityExceptions.defaultException(mContext, e)));
|
}, e -> mContext.runOnUiThread(() -> UtilityExceptions.defaultException(mContext, e)));
|
||||||
}
|
}
|
||||||
@@ -157,4 +158,20 @@ public class EditArticoloDialog {
|
|||||||
mDialog.dismiss();
|
mDialog.dismiss();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void openProgress() {
|
||||||
|
mContext.runOnUiThread(() -> {
|
||||||
|
if (this.mCurrentProgress == null) {
|
||||||
|
this.mCurrentProgress = UtilityProgress.createDefaultProgressDialog(mContext);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void closeProgress() {
|
||||||
|
mContext.runOnUiThread(() -> {
|
||||||
|
if (mCurrentProgress != null) {
|
||||||
|
mCurrentProgress.dismiss();
|
||||||
|
mCurrentProgress = null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ public class PVOrdiniAcquistoGrigliaFragment extends Fragment implements ITitled
|
|||||||
private OrdineAcquistoPvHelper mHelper;
|
private OrdineAcquistoPvHelper mHelper;
|
||||||
private Griglia mGriglia;
|
private Griglia mGriglia;
|
||||||
private OrdineAcquistoPvOpenListAdapter mAdapter;
|
private OrdineAcquistoPvOpenListAdapter mAdapter;
|
||||||
|
private Dialog mCurrentProgress;
|
||||||
private final List<OrdineWrapper> mRenderedOrderList = new ArrayList<>();
|
private final List<OrdineWrapper> mRenderedOrderList = new ArrayList<>();
|
||||||
private boolean mRedirectToNewOrder = true;
|
private boolean mRedirectToNewOrder = true;
|
||||||
|
|
||||||
@@ -80,7 +81,6 @@ public class PVOrdiniAcquistoGrigliaFragment extends Fragment implements ITitled
|
|||||||
.inject(this);
|
.inject(this);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PVOrdiniAcquistoGrigliaFragment newInstance() {
|
public static PVOrdiniAcquistoGrigliaFragment newInstance() {
|
||||||
@@ -97,7 +97,7 @@ public class PVOrdiniAcquistoGrigliaFragment extends Fragment implements ITitled
|
|||||||
mBinding = DataBindingUtil.inflate(inflater, R.layout.fragment_pv_ordini_acquisto, container, false);
|
mBinding = DataBindingUtil.inflate(inflater, R.layout.fragment_pv_ordini_acquisto, container, false);
|
||||||
mBinding.setViewmodel(this);
|
mBinding.setViewmodel(this);
|
||||||
|
|
||||||
mHelper = new OrdineAcquistoPvHelper(getActivity(), mGrigliaRepository, mArticoloGrigliaRepository, mArticoliOrdineRepository, mOrdineRepository);
|
mHelper = new OrdineAcquistoPvHelper(requireActivity(), mGrigliaRepository, mArticoloGrigliaRepository, mArticoliOrdineRepository, mOrdineRepository);
|
||||||
|
|
||||||
init();
|
init();
|
||||||
initRecyclerView();
|
initRecyclerView();
|
||||||
@@ -107,9 +107,9 @@ public class PVOrdiniAcquistoGrigliaFragment extends Fragment implements ITitled
|
|||||||
private void init() {
|
private void init() {
|
||||||
|
|
||||||
BarcodeManager.enable();
|
BarcodeManager.enable();
|
||||||
DialogScanLisA.make(getActivity(), mGrigliaRepository, mHelper, griglia -> {
|
DialogScanLisA.make(requireActivity(), mGrigliaRepository, mHelper, griglia -> {
|
||||||
if (griglia == null) {
|
if (griglia == null) {
|
||||||
if (getActivity() != null) ((IPoppableActivity) getActivity()).pop();
|
((IPoppableActivity) requireActivity()).pop();
|
||||||
} else {
|
} else {
|
||||||
setGriglia(griglia);
|
setGriglia(griglia);
|
||||||
}
|
}
|
||||||
@@ -134,17 +134,17 @@ public class PVOrdiniAcquistoGrigliaFragment extends Fragment implements ITitled
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void fetchOrders() {
|
private void fetchOrders() {
|
||||||
final Dialog progress = UtilityProgress.createDefaultProgressDialog(getActivity(), getString(R.string.ordini_a_aperti_progress));
|
this.openProgress();
|
||||||
|
|
||||||
mOrdineRepository.selectAllOpenOrders(mGriglia, (ordini) -> getActivity().runOnUiThread(() -> {
|
mOrdineRepository.selectAllOpenOrders(mGriglia, (ordini) -> requireActivity().runOnUiThread(() -> {
|
||||||
progress.dismiss();
|
this.closeProgress();
|
||||||
setOrdini(ordini);
|
setOrdini(ordini);
|
||||||
}), (e) -> {
|
}), (e) -> {
|
||||||
progress.dismiss();
|
this.closeProgress();
|
||||||
String errorMessage = e.getMessage();
|
String errorMessage = e.getMessage();
|
||||||
getActivity().runOnUiThread(() -> DialogSimpleMessageView
|
requireActivity().runOnUiThread(() -> DialogSimpleMessageView
|
||||||
.makeErrorDialog(new SpannableString(errorMessage), null, null)
|
.makeErrorDialog(new SpannableString(errorMessage), null, null)
|
||||||
.show(getActivity().getSupportFragmentManager(), "tag"));
|
.show(requireActivity().getSupportFragmentManager(), "tag"));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,29 +167,22 @@ public class PVOrdiniAcquistoGrigliaFragment extends Fragment implements ITitled
|
|||||||
private void initRecyclerView() {
|
private void initRecyclerView() {
|
||||||
mBinding.ordiniAApertiMainList.setHasFixedSize(true);
|
mBinding.ordiniAApertiMainList.setHasFixedSize(true);
|
||||||
|
|
||||||
mBinding.ordiniAApertiMainList.setLayoutManager(new LinearLayoutManager(getActivity()));
|
mBinding.ordiniAApertiMainList.setLayoutManager(new LinearLayoutManager(requireActivity()));
|
||||||
|
|
||||||
SimpleDividerItemDecoration itemDecorator = new SimpleDividerItemDecoration(getActivity(), SimpleDividerItemDecoration.VERTICAL);
|
SimpleDividerItemDecoration itemDecorator = new SimpleDividerItemDecoration(requireActivity(), SimpleDividerItemDecoration.VERTICAL);
|
||||||
itemDecorator.setDrawable(ContextCompat.getDrawable(getActivity(), R.drawable.divider));
|
itemDecorator.setDrawable(ContextCompat.getDrawable(requireActivity(), R.drawable.divider));
|
||||||
mBinding.ordiniAApertiMainList.addItemDecoration(itemDecorator);
|
mBinding.ordiniAApertiMainList.addItemDecoration(itemDecorator);
|
||||||
mAdapter = new OrdineAcquistoPvOpenListAdapter(getActivity(), mRenderedOrderList, this::selectAction);
|
mAdapter = new OrdineAcquistoPvOpenListAdapter(requireActivity(), mRenderedOrderList, this::selectAction);
|
||||||
mBinding.ordiniAApertiMainList.setAdapter(mAdapter);
|
mBinding.ordiniAApertiMainList.setAdapter(mAdapter);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void editOrdine(Ordine ordine) {
|
private void editOrdine(Ordine ordine) {
|
||||||
|
requireActivity().startActivity(PVOrdineAcquistoEditActivity.newInstance(requireActivity(),ordine));
|
||||||
Intent myIntent = new Intent(getActivity(), PVOrdineAcquistoEditActivity.class);
|
|
||||||
|
|
||||||
String keyOrdine = DataCache.addItem(ordine);
|
|
||||||
myIntent.putExtra("keyOrdine", keyOrdine);
|
|
||||||
|
|
||||||
getActivity().startActivity(myIntent);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void selectAction(Ordine ordine) {
|
private void selectAction(Ordine ordine) {
|
||||||
getActivity().runOnUiThread(() -> DialogAskAction.make(getActivity(),
|
requireActivity().runOnUiThread(() -> DialogAskAction.make(requireActivity(),
|
||||||
Html.fromHtml(String.format(this.getString(R.string.ord_acq_testata), String.valueOf(ordine.getOrdineId()), UtilityDate.formatDate(ordine.getDataIns(), UtilityDate.COMMONS_DATE_FORMATS.DMY_HUMAN))).toString(),
|
Html.fromHtml(String.format(this.getString(R.string.ord_acq_testata), String.valueOf(ordine.getOrdineId()), UtilityDate.formatDate(ordine.getDataIns(), UtilityDate.COMMONS_DATE_FORMATS.DMY_HUMAN))).toString(),
|
||||||
ordine.getCountArticoli() + " articoli",
|
ordine.getCountArticoli() + " articoli",
|
||||||
() -> this.editOrdine(ordine),
|
() -> this.editOrdine(ordine),
|
||||||
@@ -200,20 +193,20 @@ public class PVOrdiniAcquistoGrigliaFragment extends Fragment implements ITitled
|
|||||||
private void deleteOrdine(Ordine ordine) {
|
private void deleteOrdine(Ordine ordine) {
|
||||||
String text = "Stai per eliminare un ordine sei sicuro?";
|
String text = "Stai per eliminare un ordine sei sicuro?";
|
||||||
|
|
||||||
DialogSimpleMessageView.makeWarningDialog(new SpannableString(Html.fromHtml(text)), null, () -> getActivity().runOnUiThread(() -> {
|
DialogSimpleMessageView.makeWarningDialog(new SpannableString(Html.fromHtml(text)), null, () -> requireActivity().runOnUiThread(() -> {
|
||||||
final Dialog progress = UtilityProgress.createDefaultProgressDialog(getActivity());
|
this.openProgress();
|
||||||
mHelper.deleteOrder(ordine, () -> {
|
mHelper.deleteOrder(ordine, () -> {
|
||||||
getActivity().runOnUiThread(() -> {
|
requireActivity().runOnUiThread(() -> {
|
||||||
progress.dismiss();
|
this.closeProgress();
|
||||||
Toast.makeText(getActivity(), "Ordine eliminato!", Toast.LENGTH_SHORT).show();
|
Toast.makeText(requireActivity(), "Ordine eliminato!", Toast.LENGTH_SHORT).show();
|
||||||
fetchOrders();
|
fetchOrders();
|
||||||
});
|
});
|
||||||
}, e -> {
|
}, e -> {
|
||||||
progress.dismiss();
|
this.closeProgress();
|
||||||
getActivity().runOnUiThread(() -> UtilityExceptions.defaultException(getActivity(), e));
|
requireActivity().runOnUiThread(() -> UtilityExceptions.defaultException(requireActivity(), e));
|
||||||
});
|
});
|
||||||
}), () -> {
|
}), () -> {
|
||||||
}).show(getActivity().getSupportFragmentManager(), "tag");
|
}).show(requireActivity().getSupportFragmentManager(), "tag");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void refreshRenderedOrdini(List<OrdineWrapper> ordini) {
|
private void refreshRenderedOrdini(List<OrdineWrapper> ordini) {
|
||||||
@@ -222,12 +215,15 @@ public class PVOrdiniAcquistoGrigliaFragment extends Fragment implements ITitled
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void createNewOrder() {
|
public void createNewOrder() {
|
||||||
final Dialog progress = UtilityProgress.createDefaultProgressDialog(getActivity(), getString(R.string.ordini_a_aperti_progress));
|
this.openProgress();
|
||||||
mHelper.createNewOrder(mGriglia, order -> {
|
mHelper.createNewOrder(mGriglia, order -> {
|
||||||
progress.dismiss();
|
this.closeProgress();
|
||||||
getActivity().runOnUiThread(() -> editOrdine(order));
|
requireActivity().runOnUiThread(() -> editOrdine(order));
|
||||||
|
}, e -> requireActivity().runOnUiThread(() -> {
|
||||||
}, e -> getActivity().runOnUiThread(() -> UtilityExceptions.defaultException(getActivity(), e, progress)));
|
UtilityExceptions.defaultException(requireActivity(), e);
|
||||||
|
this.closeProgress();
|
||||||
|
}
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -256,4 +252,22 @@ public class PVOrdiniAcquistoGrigliaFragment extends Fragment implements ITitled
|
|||||||
public void addOnPreDestroy(Runnable onPreDestroy) {
|
public void addOnPreDestroy(Runnable onPreDestroy) {
|
||||||
this.mOnPreDestroyList.add(onPreDestroy);
|
this.mOnPreDestroyList.add(onPreDestroy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void openProgress() {
|
||||||
|
requireActivity().runOnUiThread(() -> {
|
||||||
|
if (this.mCurrentProgress == null) {
|
||||||
|
this.mCurrentProgress = UtilityProgress.createDefaultProgressDialog(requireActivity());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void closeProgress() {
|
||||||
|
requireActivity().runOnUiThread(() -> {
|
||||||
|
if (mCurrentProgress != null) {
|
||||||
|
mCurrentProgress.dismiss();
|
||||||
|
mCurrentProgress = null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ public class DialogScanLisA {
|
|||||||
private Activity mContext;
|
private Activity mContext;
|
||||||
|
|
||||||
private BaseDialog mDialog;
|
private BaseDialog mDialog;
|
||||||
|
private Dialog mCurrentProgress;
|
||||||
|
|
||||||
private DialogScanCodiceGrigliaBinding mBinding;
|
private DialogScanCodiceGrigliaBinding mBinding;
|
||||||
|
|
||||||
@@ -78,11 +79,11 @@ public class DialogScanLisA {
|
|||||||
private final RunnableArgs<BarcodeScanDTO> onScanSuccessfull = data -> {
|
private final RunnableArgs<BarcodeScanDTO> onScanSuccessfull = data -> {
|
||||||
BarcodeManager.disable();
|
BarcodeManager.disable();
|
||||||
|
|
||||||
final Dialog progressDialog = UtilityProgress.createDefaultProgressDialog(mContext);
|
this.openProgress();
|
||||||
Context context = mContext;
|
Context context = mContext;
|
||||||
RunnableArgs<Exception> mOnError = exception -> {
|
RunnableArgs<Exception> mOnError = exception -> {
|
||||||
mContext.runOnUiThread(() -> {
|
mContext.runOnUiThread(() -> {
|
||||||
progressDialog.dismiss();
|
this.closeProgress();
|
||||||
UtilityExceptions.defaultException(context, exception);
|
UtilityExceptions.defaultException(context, exception);
|
||||||
BarcodeManager.enable();
|
BarcodeManager.enable();
|
||||||
});
|
});
|
||||||
@@ -90,7 +91,7 @@ public class DialogScanLisA {
|
|||||||
|
|
||||||
RunnableArgs<Griglia> onGrigliaAvailable = griglia -> {
|
RunnableArgs<Griglia> onGrigliaAvailable = griglia -> {
|
||||||
mContext.runOnUiThread(() -> {
|
mContext.runOnUiThread(() -> {
|
||||||
progressDialog.dismiss();
|
this.closeProgress();
|
||||||
mGriglia = griglia;
|
mGriglia = griglia;
|
||||||
mDialog.dismiss();
|
mDialog.dismiss();
|
||||||
});
|
});
|
||||||
@@ -109,4 +110,20 @@ public class DialogScanLisA {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
protected void openProgress() {
|
||||||
|
mContext.runOnUiThread(() -> {
|
||||||
|
if (this.mCurrentProgress == null) {
|
||||||
|
this.mCurrentProgress = UtilityProgress.createDefaultProgressDialog(mContext);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void closeProgress() {
|
||||||
|
mContext.runOnUiThread(() -> {
|
||||||
|
if (mCurrentProgress != null) {
|
||||||
|
mCurrentProgress.dismiss();
|
||||||
|
mCurrentProgress = null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user