Compare commits
49 Commits
v1.23.0(25
...
v1.23.7(26
| Author | SHA1 | Date | |
|---|---|---|---|
| f6aadf1115 | |||
| cf3b8749dc | |||
| 34ff300515 | |||
| 0738993d4c | |||
| 9765fe1807 | |||
| 968e904715 | |||
| 90985b899b | |||
| d81e0dd72c | |||
| ee8751163c | |||
| 5476e9633e | |||
| 84d800a698 | |||
| eb39e1b7c5 | |||
| 57fa738c59 | |||
| bfc02a7d48 | |||
| e963e03c81 | |||
| f1c25a3673 | |||
| 90d5a8d43b | |||
| e1b4af2402 | |||
| 8686df3d8a | |||
| 6b04246f42 | |||
| 8e40092130 | |||
| b8dbde5ee1 | |||
| ae6d37e80d | |||
| 6dcc711006 | |||
| a616cb6022 | |||
| 837781389c | |||
| f23ff88878 | |||
| ddc038add4 | |||
| f037617dd9 | |||
| 84cff70567 | |||
| 8a1b3a1b00 | |||
| f11a81ef05 | |||
| eb8595e247 | |||
| 85520b937f | |||
| ec5bee558c | |||
| 857295d92b | |||
| 4da2c43251 | |||
| fc1681d111 | |||
| 692a350128 | |||
| 47f29899a2 | |||
| a0dfd20110 | |||
| 92aadad5cb | |||
| 52092e7e9c | |||
| ecfb8faf01 | |||
| e5dd4b15f4 | |||
| 6e070285e3 | |||
| d13cdf63c2 | |||
| c3884774e1 | |||
| 8e60aa0249 |
@@ -1,13 +1,17 @@
|
|||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.application'
|
||||||
apply plugin: 'com.google.firebase.firebase-perf'
|
|
||||||
|
if (!project.hasProperty("disable-performance-plugin")) {
|
||||||
|
apply plugin: 'com.google.firebase.firebase-perf'
|
||||||
|
}
|
||||||
|
|
||||||
apply plugin: 'com.google.firebase.crashlytics'
|
apply plugin: 'com.google.firebase.crashlytics'
|
||||||
apply plugin: 'kotlin-android'
|
apply plugin: 'kotlin-android'
|
||||||
apply plugin: 'com.google.gms.google-services'
|
apply plugin: 'com.google.gms.google-services'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
|
|
||||||
def appVersionCode = 255
|
def appVersionCode = 262
|
||||||
def appVersionName = '1.23.0'
|
def appVersionName = '1.23.7'
|
||||||
|
|
||||||
signingConfigs {
|
signingConfigs {
|
||||||
release {
|
release {
|
||||||
@@ -27,12 +31,12 @@ android {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
compileSdkVersion 30
|
compileSdkVersion 31
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "it.integry.integrywmsnative"
|
applicationId "it.integry.integrywmsnative"
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 30
|
targetSdkVersion 31
|
||||||
versionCode appVersionCode
|
versionCode appVersionCode
|
||||||
versionName appVersionName
|
versionName appVersionName
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
@@ -94,33 +98,32 @@ dependencies {
|
|||||||
//Firebase
|
//Firebase
|
||||||
|
|
||||||
// Import the Firebase BoM
|
// Import the Firebase BoM
|
||||||
implementation platform('com.google.firebase:firebase-bom:26.3.0')
|
implementation platform('com.google.firebase:firebase-bom:29.1.0')
|
||||||
implementation 'com.google.firebase:firebase-analytics'
|
implementation 'com.google.firebase:firebase-analytics'
|
||||||
implementation 'com.google.firebase:firebase-core'
|
implementation 'com.google.firebase:firebase-core'
|
||||||
implementation 'com.google.firebase:firebase-crash'
|
|
||||||
implementation 'com.google.firebase:firebase-crashlytics'
|
implementation 'com.google.firebase:firebase-crashlytics'
|
||||||
implementation 'com.google.firebase:firebase-perf'
|
implementation 'com.google.firebase:firebase-perf'
|
||||||
implementation 'com.google.android.gms:play-services-basement:17.6.0'
|
implementation 'com.google.android.gms:play-services-basement:18.0.0'
|
||||||
|
|
||||||
|
|
||||||
implementation 'androidx.appcompat:appcompat:1.3.1'
|
implementation 'androidx.appcompat:appcompat:1.4.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.4.0'
|
implementation 'com.google.android.material:material:1.5.0'
|
||||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
|
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
|
||||||
implementation 'androidx.cardview:cardview:1.0.0'
|
implementation 'androidx.cardview:cardview:1.0.0'
|
||||||
implementation 'androidx.recyclerview:recyclerview:1.2.1'
|
implementation 'androidx.recyclerview:recyclerview:1.2.1'
|
||||||
implementation 'androidx.preference:preference-ktx:1.1.1'
|
implementation 'androidx.preference:preference-ktx:1.2.0'
|
||||||
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'
|
||||||
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
|
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
|
||||||
implementation 'com.annimon:stream:1.2.2'
|
implementation 'com.annimon:stream:1.2.2'
|
||||||
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.1'
|
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.4.1'
|
||||||
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
|
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
|
||||||
implementation 'androidx.lifecycle:lifecycle-common-java8:2.3.1'
|
implementation 'androidx.lifecycle:lifecycle-common-java8:2.4.1'
|
||||||
implementation 'org.apache.commons:commons-text:1.9'
|
implementation 'org.apache.commons:commons-text:1.9'
|
||||||
|
|
||||||
//MVVM
|
//MVVM
|
||||||
def dagger2_version = '2.35.1'
|
def dagger2_version = '2.40'
|
||||||
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"
|
||||||
@@ -140,7 +143,7 @@ dependencies {
|
|||||||
implementation 'com.github.pedromassango:doubleClick:3.0'
|
implementation 'com.github.pedromassango:doubleClick:3.0'
|
||||||
|
|
||||||
//SQLite ROOM
|
//SQLite ROOM
|
||||||
def room_version = "2.3.0"
|
def room_version = "2.4.1"
|
||||||
|
|
||||||
implementation "androidx.room:room-runtime:$room_version"
|
implementation "androidx.room:room-runtime:$room_version"
|
||||||
annotationProcessor "androidx.room:room-compiler:$room_version"
|
annotationProcessor "androidx.room:room-compiler:$room_version"
|
||||||
@@ -159,7 +162,6 @@ dependencies {
|
|||||||
|
|
||||||
|
|
||||||
implementation 'com.github.RaviKoradiya:LiveAdapter:1.3.4'
|
implementation 'com.github.RaviKoradiya:LiveAdapter:1.3.4'
|
||||||
implementation 'org.reflections:reflections:0.10.2'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
|
|||||||
@@ -19,7 +19,8 @@
|
|||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/AppTheme"
|
android:theme="@style/AppTheme"
|
||||||
android:usesCleartextTraffic="true"
|
android:usesCleartextTraffic="true"
|
||||||
android:fullBackupContent="@xml/backup_descriptor">
|
android:fullBackupContent="@xml/backup_descriptor"
|
||||||
|
android:requestLegacyExternalStorage="true">
|
||||||
<activity
|
<activity
|
||||||
android:name=".gest.spedizione.SpedizioneActivity"
|
android:name=".gest.spedizione.SpedizioneActivity"
|
||||||
android:screenOrientation="portrait"
|
android:screenOrientation="portrait"
|
||||||
@@ -40,7 +41,8 @@
|
|||||||
<activity
|
<activity
|
||||||
android:name=".gest.main.MainActivity"
|
android:name=".gest.main.MainActivity"
|
||||||
android:theme="@style/Light"
|
android:theme="@style/Light"
|
||||||
android:windowSoftInputMode="adjustNothing">
|
android:windowSoftInputMode="adjustNothing"
|
||||||
|
android:exported="true">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.CLIENTBARCODEACTIVITY" />
|
<action android:name="android.intent.action.CLIENTBARCODEACTIVITY" />
|
||||||
|
|
||||||
@@ -73,7 +75,8 @@
|
|||||||
<activity
|
<activity
|
||||||
android:name=".SplashActivity"
|
android:name=".SplashActivity"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:theme="@style/SplashTheme">
|
android:theme="@style/SplashTheme"
|
||||||
|
android:exported="true">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,10 @@ import javax.inject.Singleton;
|
|||||||
import dagger.Component;
|
import dagger.Component;
|
||||||
import it.integry.integrywmsnative.core.context.AppContext;
|
import it.integry.integrywmsnative.core.context.AppContext;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.RoomModule;
|
import it.integry.integrywmsnative.core.data_store.db.RoomModule;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.BaseActivityComponent;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.BaseActivityModule;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.BaseFragmentComponent;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.BaseFragmentModule;
|
||||||
import it.integry.integrywmsnative.gest.accettazione.MainAccettazioneComponent;
|
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;
|
||||||
@@ -15,6 +19,8 @@ import it.integry.integrywmsnative.gest.contab_doc_interni.dialog.DialogSelectDo
|
|||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dialog.DialogSelectDocInfoModule;
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dialog.DialogSelectDocInfoModule;
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.DocInterniEditFormComponent;
|
import it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.DocInterniEditFormComponent;
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.DocInterniEditFormModule;
|
import it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.DocInterniEditFormModule;
|
||||||
|
import it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.dialog.selectDocRows.DialogSelectDocRowsComponent;
|
||||||
|
import it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.dialog.selectDocRows.DialogSelectDocRowsModule;
|
||||||
import it.integry.integrywmsnative.gest.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;
|
||||||
@@ -59,10 +65,13 @@ import it.integry.integrywmsnative.gest.ultimi_arrivi_fornitore.UltimiArriviForn
|
|||||||
import it.integry.integrywmsnative.gest.ultimi_arrivi_fornitore.UltimiArriviFornitoreModule;
|
import it.integry.integrywmsnative.gest.ultimi_arrivi_fornitore.UltimiArriviFornitoreModule;
|
||||||
import it.integry.integrywmsnative.gest.versamento_merce.VersamentoMerceComponent;
|
import it.integry.integrywmsnative.gest.versamento_merce.VersamentoMerceComponent;
|
||||||
import it.integry.integrywmsnative.gest.versamento_merce.VersamentoMerceModule;
|
import it.integry.integrywmsnative.gest.versamento_merce.VersamentoMerceModule;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.ask_cliente.DialogAskClienteComponent;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.ask_cliente.DialogAskClienteModule;
|
||||||
import it.integry.integrywmsnative.view.dialogs.choose_arts_from_lista_arts.DialogChooseArtsFromListaArtsComponent;
|
import it.integry.integrywmsnative.view.dialogs.choose_arts_from_lista_arts.DialogChooseArtsFromListaArtsComponent;
|
||||||
import it.integry.integrywmsnative.view.dialogs.choose_arts_from_lista_arts.DialogChooseArtsFromListaArtsModule;
|
import it.integry.integrywmsnative.view.dialogs.choose_arts_from_lista_arts.DialogChooseArtsFromListaArtsModule;
|
||||||
import it.integry.integrywmsnative.view.dialogs.choose_batch_lot.DialogChooseBatchLotComponent;
|
import it.integry.integrywmsnative.view.dialogs.choose_batch_lot.DialogChooseBatchLotComponent;
|
||||||
import it.integry.integrywmsnative.view.dialogs.choose_batch_lot.DialogChooseBatchLotModule;
|
import it.integry.integrywmsnative.view.dialogs.choose_batch_lot.DialogChooseBatchLotModule;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.info_aggiuntive_lu.InfoAggiuntiveLUDialogComponent;
|
||||||
import it.integry.integrywmsnative.view.dialogs.input_lu_prod.DialogInputLUProdComponent;
|
import it.integry.integrywmsnative.view.dialogs.input_lu_prod.DialogInputLUProdComponent;
|
||||||
import it.integry.integrywmsnative.view.dialogs.input_lu_prod.DialogInputLUProdModule;
|
import it.integry.integrywmsnative.view.dialogs.input_lu_prod.DialogInputLUProdModule;
|
||||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2Component;
|
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2Component;
|
||||||
@@ -78,6 +87,8 @@ import it.integry.integrywmsnative.view.dialogs.scan_or_create_lu.DialogScanOrCr
|
|||||||
RoomModule.class,
|
RoomModule.class,
|
||||||
SplashActivityModule.class,
|
SplashActivityModule.class,
|
||||||
MainApplicationModule.class,
|
MainApplicationModule.class,
|
||||||
|
BaseActivityModule.class,
|
||||||
|
BaseFragmentModule.class,
|
||||||
LoginModule.class,
|
LoginModule.class,
|
||||||
MainActivityModule.class,
|
MainActivityModule.class,
|
||||||
MainFragmentModule.class,
|
MainFragmentModule.class,
|
||||||
@@ -109,47 +120,94 @@ import it.integry.integrywmsnative.view.dialogs.scan_or_create_lu.DialogScanOrCr
|
|||||||
DialogChooseArtsFromListaArtsModule.class,
|
DialogChooseArtsFromListaArtsModule.class,
|
||||||
DocInterniModule.class,
|
DocInterniModule.class,
|
||||||
DialogSelectDocInfoModule.class,
|
DialogSelectDocInfoModule.class,
|
||||||
DocInterniEditFormModule.class
|
DocInterniEditFormModule.class,
|
||||||
|
DialogSelectDocRowsModule.class,
|
||||||
|
DialogAskClienteModule.class
|
||||||
})
|
})
|
||||||
public interface MainApplicationComponent {
|
public interface MainApplicationComponent {
|
||||||
|
|
||||||
|
BaseActivityComponent.Factory baseActivityComponent();
|
||||||
|
|
||||||
|
BaseFragmentComponent.Factory baseFragmentComponent();
|
||||||
|
|
||||||
SplashActivityComponent.Factory splashActivityComponent();
|
SplashActivityComponent.Factory splashActivityComponent();
|
||||||
|
|
||||||
LoginComponent.Factory loginActivityComponent();
|
LoginComponent.Factory loginActivityComponent();
|
||||||
|
|
||||||
MainActivityComponent.Factory mainActivityComponent();
|
MainActivityComponent.Factory mainActivityComponent();
|
||||||
|
|
||||||
MainFragmentComponent.Factory mainFragmentComponent();
|
MainFragmentComponent.Factory mainFragmentComponent();
|
||||||
|
|
||||||
MainAccettazioneComponent.Factory mainAccettazioneComponent();
|
MainAccettazioneComponent.Factory mainAccettazioneComponent();
|
||||||
|
|
||||||
ListaBancaliComponent.Factory listaBancaliComponent();
|
ListaBancaliComponent.Factory listaBancaliComponent();
|
||||||
|
|
||||||
ContenutoBancaleComponent.Factory contenutoBancaleComponent();
|
ContenutoBancaleComponent.Factory contenutoBancaleComponent();
|
||||||
|
|
||||||
PVOrdiniAcquistoGrigliaComponent.Factory pvOrdineAcquistoGrigliaComponent();
|
PVOrdiniAcquistoGrigliaComponent.Factory pvOrdineAcquistoGrigliaComponent();
|
||||||
|
|
||||||
PVOrdineAcquistoEditComponent.Factory pvOrdineAcquistoEditComponent();
|
PVOrdineAcquistoEditComponent.Factory pvOrdineAcquistoEditComponent();
|
||||||
|
|
||||||
PickingLiberoComponent.Factory pickingLiberoComponent();
|
PickingLiberoComponent.Factory pickingLiberoComponent();
|
||||||
|
|
||||||
RettificaGiacenzeComponent.Factory rettificaGiacenzeComponent();
|
RettificaGiacenzeComponent.Factory rettificaGiacenzeComponent();
|
||||||
|
|
||||||
SpedizioneComponent.Factory spedizioneComponent();
|
SpedizioneComponent.Factory spedizioneComponent();
|
||||||
|
|
||||||
AccettazionePickingComponent.Factory accettazionePickingComponent();
|
AccettazionePickingComponent.Factory accettazionePickingComponent();
|
||||||
|
|
||||||
UltimeConsegneClienteComponent.Factory ultimeConsegneClienteComponent();
|
UltimeConsegneClienteComponent.Factory ultimeConsegneClienteComponent();
|
||||||
|
|
||||||
UltimiArriviFornitoreComponent.Factory ultimiArriviFornitoreComponent();
|
UltimiArriviFornitoreComponent.Factory ultimiArriviFornitoreComponent();
|
||||||
|
|
||||||
PickingResiComponent.Factory pickingResiComponent();
|
PickingResiComponent.Factory pickingResiComponent();
|
||||||
|
|
||||||
OrdiniUscitaElencoComponent.Factory prodOrdineLavorazioneElencoComponent();
|
OrdiniUscitaElencoComponent.Factory prodOrdineLavorazioneElencoComponent();
|
||||||
|
|
||||||
|
DialogAskClienteComponent.Factory dialogAskClienteComponent();
|
||||||
|
|
||||||
DialogInputQuantityV2Component.Factory dialogInputQuantityV2Component();
|
DialogInputQuantityV2Component.Factory dialogInputQuantityV2Component();
|
||||||
|
|
||||||
DialogInputLUProdComponent.Factory dialogInputLUProdComponent();
|
DialogInputLUProdComponent.Factory dialogInputLUProdComponent();
|
||||||
|
|
||||||
DialogScanArtComponent.Factory dialogScanArtComponent();
|
DialogScanArtComponent.Factory dialogScanArtComponent();
|
||||||
|
|
||||||
DialogScanOrCreateLUComponent.Factory dialogScanOrCreateLUComponent();
|
DialogScanOrCreateLUComponent.Factory dialogScanOrCreateLUComponent();
|
||||||
|
|
||||||
ProdFabbisognoLineeProdComponent.Factory prodFabbisognoLineeProdComponent();
|
ProdFabbisognoLineeProdComponent.Factory prodFabbisognoLineeProdComponent();
|
||||||
|
|
||||||
VersamentoMerceComponent.Factory versamentoMerceComponent();
|
VersamentoMerceComponent.Factory versamentoMerceComponent();
|
||||||
|
|
||||||
DialogAskMagazzinoProssimitaComponent.Factory dialogAskMagazzinoProssimitaComponent();
|
DialogAskMagazzinoProssimitaComponent.Factory dialogAskMagazzinoProssimitaComponent();
|
||||||
|
|
||||||
DialogChooseBatchLotComponent.Factory dialogChooseBatchLotComponent();
|
DialogChooseBatchLotComponent.Factory dialogChooseBatchLotComponent();
|
||||||
|
|
||||||
DialogRowInfoProdFabbisognoLineeProdComponent.Factory dialogRowInfoProdFabbisognoLineeProdComponent();
|
DialogRowInfoProdFabbisognoLineeProdComponent.Factory dialogRowInfoProdFabbisognoLineeProdComponent();
|
||||||
|
|
||||||
ProdRientroMerceComponent.Factory prodRientroMerceComponent();
|
ProdRientroMerceComponent.Factory prodRientroMerceComponent();
|
||||||
|
|
||||||
ProdRientroMerceOrderDetailComponent.Factory prodRientroMerceOrderDetailComponent();
|
ProdRientroMerceOrderDetailComponent.Factory prodRientroMerceOrderDetailComponent();
|
||||||
|
|
||||||
ProdOrdineProduzioneElencoComponent.Factory prodOrdineProduzioneElencoComponent();
|
ProdOrdineProduzioneElencoComponent.Factory prodOrdineProduzioneElencoComponent();
|
||||||
|
|
||||||
ProdRecuperoMaterialeComponent.Factory prodRecuperoMaterialeComponent();
|
ProdRecuperoMaterialeComponent.Factory prodRecuperoMaterialeComponent();
|
||||||
|
|
||||||
ProdVersamentoMaterialeComponent.Factory prodVersamentoMaterialeComponent();
|
ProdVersamentoMaterialeComponent.Factory prodVersamentoMaterialeComponent();
|
||||||
|
|
||||||
DialogChooseArtsFromListaArtsComponent.Factory dialogChooseArtsFromListaArtsComponent();
|
DialogChooseArtsFromListaArtsComponent.Factory dialogChooseArtsFromListaArtsComponent();
|
||||||
|
|
||||||
DocInterniComponent.Factory docInterniComponent();
|
DocInterniComponent.Factory docInterniComponent();
|
||||||
|
|
||||||
DialogSelectDocInfoComponent.Factory dialogSelectMgrpDtipPairComponent();
|
DialogSelectDocInfoComponent.Factory dialogSelectMgrpDtipPairComponent();
|
||||||
|
|
||||||
|
DialogSelectDocRowsComponent.Factory dialogSelectDocRowsComponent();
|
||||||
|
|
||||||
DocInterniEditFormComponent.Factory docInterniEditFormComponent();
|
DocInterniEditFormComponent.Factory docInterniEditFormComponent();
|
||||||
|
|
||||||
|
InfoAggiuntiveLUDialogComponent.Factory infoAggiuntiveLUDialogComponent();
|
||||||
|
|
||||||
void inject(MainApplication mainApplication);
|
void inject(MainApplication mainApplication);
|
||||||
|
|
||||||
void inject(AppContext mainApplication);
|
void inject(AppContext mainApplication);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,8 +27,11 @@ 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.core.services.inventario.InventarioService;
|
import it.integry.integrywmsnative.core.services.inventario.InventarioService;
|
||||||
|
import it.integry.integrywmsnative.core.update.UpdatesManager;
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.rest.DocInterniRESTConsumer;
|
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;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.DialogProgressView;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2View;
|
||||||
|
|
||||||
@Module
|
@Module
|
||||||
public class MainApplicationModule {
|
public class MainApplicationModule {
|
||||||
@@ -71,6 +74,24 @@ public class MainApplicationModule {
|
|||||||
return new MenuService(menuRESTConsumer);
|
return new MenuService(menuRESTConsumer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
UpdatesManager provideUpdatesManager() {
|
||||||
|
return new UpdatesManager();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
DialogProgressView providesDialogProgressView() {
|
||||||
|
return DialogProgressView.newInstance();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
DialogInputQuantityV2View providesDialogInputQuantityV2View() {
|
||||||
|
return new DialogInputQuantityV2View();
|
||||||
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
OrdiniRESTConsumer provideOrdiniRESTConsumer(SystemRESTConsumer systemRESTConsumer, EntityRESTConsumer entityRESTConsumer) {
|
OrdiniRESTConsumer provideOrdiniRESTConsumer(SystemRESTConsumer systemRESTConsumer, EntityRESTConsumer entityRESTConsumer) {
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public class CommonConst {
|
|||||||
|
|
||||||
public static String DEFAULT_ANONYMOUS_UL_SERIE = "UL";
|
public static String DEFAULT_ANONYMOUS_UL_SERIE = "UL";
|
||||||
|
|
||||||
public static int NUMBER_OF_DECIMAL_DIGITS = 3;
|
public static int NUMBER_OF_DECIMAL_DIGITS = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Files {
|
public static class Files {
|
||||||
|
|||||||
@@ -1,49 +0,0 @@
|
|||||||
package it.integry.integrywmsnative.core.coollection;
|
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.coollection.matcher.Matcher;
|
|
||||||
import it.integry.integrywmsnative.core.coollection.matcher.custom.Contains;
|
|
||||||
import it.integry.integrywmsnative.core.coollection.matcher.custom.Equals;
|
|
||||||
import it.integry.integrywmsnative.core.coollection.matcher.custom.EqualsIgnoreCase;
|
|
||||||
import it.integry.integrywmsnative.core.coollection.matcher.custom.GreaterThan;
|
|
||||||
import it.integry.integrywmsnative.core.coollection.matcher.custom.IsNull;
|
|
||||||
import it.integry.integrywmsnative.core.coollection.matcher.custom.LessThan;
|
|
||||||
import it.integry.integrywmsnative.core.coollection.matcher.custom.Not;
|
|
||||||
import it.integry.integrywmsnative.core.coollection.query.Query;
|
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
public class Coollection {
|
|
||||||
|
|
||||||
public static <T> Query<T> from(Collection<T> collection) {
|
|
||||||
return new Query<T>(collection);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Matcher eq(Object value) {
|
|
||||||
return new Equals(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Matcher contains(String value) {
|
|
||||||
return new Contains(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Matcher eqIgnoreCase(String value) {
|
|
||||||
return new EqualsIgnoreCase(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Matcher not(Matcher matcher) {
|
|
||||||
return new Not(matcher);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Matcher greaterThan(Number value) {
|
|
||||||
return new GreaterThan(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Matcher lessThan(Number value) {
|
|
||||||
return new LessThan(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Matcher isNull() {
|
|
||||||
return new IsNull();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
package it.integry.integrywmsnative.core.coollection.matcher;
|
|
||||||
|
|
||||||
public interface Matcher {
|
|
||||||
|
|
||||||
boolean match(Object value);
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
package it.integry.integrywmsnative.core.coollection.matcher.custom;
|
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.coollection.matcher.Matcher;
|
|
||||||
|
|
||||||
public class Contains implements Matcher {
|
|
||||||
|
|
||||||
private final String matcherValue;
|
|
||||||
|
|
||||||
public Contains(String matcherValue) {
|
|
||||||
this.matcherValue = matcherValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean match(Object value) {
|
|
||||||
return String.valueOf(value).contains(matcherValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
package it.integry.integrywmsnative.core.coollection.matcher.custom;
|
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.coollection.matcher.Matcher;
|
|
||||||
|
|
||||||
public class Equals implements Matcher {
|
|
||||||
|
|
||||||
private final Object value;
|
|
||||||
|
|
||||||
public Equals(Object value) {
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean match(Object anotherValue) {
|
|
||||||
return value.equals(anotherValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
package it.integry.integrywmsnative.core.coollection.matcher.custom;
|
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.coollection.matcher.Matcher;
|
|
||||||
|
|
||||||
public class EqualsIgnoreCase implements Matcher {
|
|
||||||
|
|
||||||
private final String value;
|
|
||||||
|
|
||||||
public EqualsIgnoreCase(String value) {
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean match(Object anotherValue) {
|
|
||||||
return (value).equalsIgnoreCase((String) anotherValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
package it.integry.integrywmsnative.core.coollection.matcher.custom;
|
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.coollection.matcher.Matcher;
|
|
||||||
|
|
||||||
public class GreaterThan implements Matcher {
|
|
||||||
|
|
||||||
private final Number value;
|
|
||||||
|
|
||||||
public GreaterThan(Number value) {
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean match(Object matchValue) {
|
|
||||||
if (matchValue == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return ((Number) matchValue).doubleValue() > value.doubleValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
package it.integry.integrywmsnative.core.coollection.matcher.custom;
|
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.coollection.matcher.Matcher;
|
|
||||||
|
|
||||||
public class IsNull implements Matcher {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean match(Object value) {
|
|
||||||
return value == null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
package it.integry.integrywmsnative.core.coollection.matcher.custom;
|
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.coollection.matcher.Matcher;
|
|
||||||
|
|
||||||
public class LessThan implements Matcher {
|
|
||||||
|
|
||||||
private final Number value;
|
|
||||||
|
|
||||||
public LessThan(Number value) {
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean match(Object matchValue) {
|
|
||||||
if (matchValue == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return ((Number) matchValue).doubleValue() < value.doubleValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
package it.integry.integrywmsnative.core.coollection.matcher.custom;
|
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.coollection.matcher.Matcher;
|
|
||||||
|
|
||||||
public class Not implements Matcher {
|
|
||||||
|
|
||||||
private final Matcher matcher;
|
|
||||||
|
|
||||||
public Not(Matcher matcher) {
|
|
||||||
this.matcher = matcher;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean match(Object value) {
|
|
||||||
return !matcher.match(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,90 +0,0 @@
|
|||||||
package it.integry.integrywmsnative.core.coollection.query;
|
|
||||||
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.coollection.matcher.Matcher;
|
|
||||||
import it.integry.integrywmsnative.core.coollection.query.criteria.Criteria;
|
|
||||||
import it.integry.integrywmsnative.core.coollection.query.criteria.CriteriaList;
|
|
||||||
import it.integry.integrywmsnative.core.coollection.query.order.Order;
|
|
||||||
import it.integry.integrywmsnative.core.coollection.query.order.OrderCriteria;
|
|
||||||
import it.integry.integrywmsnative.core.coollection.query.specification.custom.AndSpecification;
|
|
||||||
import it.integry.integrywmsnative.core.coollection.query.specification.custom.OrSpecification;
|
|
||||||
|
|
||||||
public class Query<T> {
|
|
||||||
|
|
||||||
private final Collection<T> collection;
|
|
||||||
private CriteriaList<T> criterias;
|
|
||||||
private OrderCriteria<T> orderCriteria;
|
|
||||||
|
|
||||||
public Query(Collection<T> collection) {
|
|
||||||
this.collection = collection;
|
|
||||||
criterias = new CriteriaList<T>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Query<T> where(String method, Matcher matcher) {
|
|
||||||
Criteria<T> criteria = new Criteria<T>(method, matcher);
|
|
||||||
criterias.add(criteria);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Query<T> and(String method, Matcher matcher) {
|
|
||||||
Criteria<T> criteria = new Criteria<T>(method, matcher);
|
|
||||||
criteria.setSpecification(new AndSpecification<T>());
|
|
||||||
criterias.add(criteria);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Query<T> or(String method, Matcher matcher) {
|
|
||||||
Criteria<T> criteria = new Criteria<T>(method, matcher);
|
|
||||||
criteria.setSpecification(new OrSpecification<T>());
|
|
||||||
criterias.add(criteria);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Query<T> orderBy(String method, Order order) {
|
|
||||||
orderCriteria = new OrderCriteria<T>(method, order);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Query<T> orderBy(String method) {
|
|
||||||
return orderBy(method, Order.ASC);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<T> all() {
|
|
||||||
List<T> all = new ArrayList<T>();
|
|
||||||
for (T item : collection) {
|
|
||||||
if (criterias.match(item)) {
|
|
||||||
all.add(item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (orderCriteria != null) {
|
|
||||||
all = orderCriteria.sort(all);
|
|
||||||
}
|
|
||||||
return all;
|
|
||||||
}
|
|
||||||
|
|
||||||
public T first() {
|
|
||||||
List<T> all = cloneCollection(collection);
|
|
||||||
if (orderCriteria != null) {
|
|
||||||
all = orderCriteria.sort(all);
|
|
||||||
}
|
|
||||||
for (T item : all) {
|
|
||||||
if (criterias.match(item)) {
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<T> cloneCollection(Collection<T> collection) {
|
|
||||||
List<T> list = new ArrayList<T>();
|
|
||||||
for (T item : collection) {
|
|
||||||
list.add(item);
|
|
||||||
}
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
package it.integry.integrywmsnative.core.coollection.query.criteria;
|
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.coollection.matcher.Matcher;
|
|
||||||
import it.integry.integrywmsnative.core.coollection.query.specification.Specification;
|
|
||||||
import it.integry.integrywmsnative.core.coollection.reflection.Phanton;
|
|
||||||
|
|
||||||
public class Criteria<T> {
|
|
||||||
|
|
||||||
private final String method;
|
|
||||||
private final Matcher matcher;
|
|
||||||
private Specification<T> specification;
|
|
||||||
|
|
||||||
public Criteria(String method, Matcher matcher) {
|
|
||||||
this.method = method;
|
|
||||||
this.matcher = matcher;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSpecification(Specification<T> specification) {
|
|
||||||
this.specification = specification;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Specification<T> specification() {
|
|
||||||
return specification;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean match(T item) {
|
|
||||||
try {
|
|
||||||
Object value = Phanton.from(item).call(method);
|
|
||||||
return matcher.match(value);
|
|
||||||
} catch (Exception err) {
|
|
||||||
throw new RuntimeException(err);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
package it.integry.integrywmsnative.core.coollection.query.criteria;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class CriteriaList<T> {
|
|
||||||
|
|
||||||
private List<Criteria<T>> criterias;
|
|
||||||
|
|
||||||
public CriteriaList() {
|
|
||||||
criterias = new ArrayList<Criteria<T>>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void add(Criteria<T> criteria) {
|
|
||||||
criterias.add(criteria);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean match(T item) {
|
|
||||||
if (criterias.size() == 0) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (criterias.size() == 1) {
|
|
||||||
return criterias.get(0).match(item);
|
|
||||||
}
|
|
||||||
boolean matched = true;
|
|
||||||
for (int i = criterias.size() - 1; i > 0; i--) {
|
|
||||||
Criteria<T> one = criterias.get(i);
|
|
||||||
Criteria<T> other = criterias.get(i - 1);
|
|
||||||
matched = matched && one.specification().match(item, one, other);
|
|
||||||
}
|
|
||||||
return matched;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
package it.integry.integrywmsnative.core.coollection.query.order;
|
|
||||||
|
|
||||||
public enum Order {
|
|
||||||
ASC, DESC
|
|
||||||
}
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
package it.integry.integrywmsnative.core.coollection.query.order;
|
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.coollection.reflection.Phanton;
|
|
||||||
|
|
||||||
import java.util.Comparator;
|
|
||||||
|
|
||||||
public class OrderComparator<T> implements Comparator<T> {
|
|
||||||
|
|
||||||
private final String method;
|
|
||||||
|
|
||||||
public OrderComparator(String method) {
|
|
||||||
this.method = method;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public int compare(T one, T other) {
|
|
||||||
Object oneValue = Phanton.from(one).call(method);
|
|
||||||
Object otherValue = Phanton.from(other).call(method);
|
|
||||||
if (oneValue == null || otherValue == null) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if (oneValue instanceof Comparable) {
|
|
||||||
return ((Comparable<Object>) oneValue).compareTo(otherValue);
|
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
package it.integry.integrywmsnative.core.coollection.query.order;
|
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class OrderCriteria<T> {
|
|
||||||
|
|
||||||
private final String method;
|
|
||||||
private final Order order;
|
|
||||||
|
|
||||||
public OrderCriteria(String method, Order order) {
|
|
||||||
this.method = method;
|
|
||||||
this.order = order;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<T> sort(List<T> list) {
|
|
||||||
Collections.sort(list, new OrderComparator<T>(method));
|
|
||||||
if (order == Order.DESC) {
|
|
||||||
Collections.reverse(list);
|
|
||||||
}
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
package it.integry.integrywmsnative.core.coollection.query.specification;
|
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.coollection.query.criteria.Criteria;
|
|
||||||
|
|
||||||
public interface Specification<T> {
|
|
||||||
|
|
||||||
boolean match(T item, Criteria<T> one, Criteria<T> other);
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
package it.integry.integrywmsnative.core.coollection.query.specification.custom;
|
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.coollection.query.criteria.Criteria;
|
|
||||||
import it.integry.integrywmsnative.core.coollection.query.specification.Specification;
|
|
||||||
|
|
||||||
public class AndSpecification<T> implements Specification<T> {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean match(T item, Criteria<T> one, Criteria<T> other) {
|
|
||||||
return one.match(item) && other.match(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
package it.integry.integrywmsnative.core.coollection.query.specification.custom;
|
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.coollection.query.criteria.Criteria;
|
|
||||||
import it.integry.integrywmsnative.core.coollection.query.specification.Specification;
|
|
||||||
|
|
||||||
public class OrSpecification<T> implements Specification<T> {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean match(T item, Criteria<T> one, Criteria<T> other) {
|
|
||||||
return one.match(item) || other.match(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
package it.integry.integrywmsnative.core.coollection.reflection;
|
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
|
|
||||||
public class Phanton<T> {
|
|
||||||
|
|
||||||
private final T target;
|
|
||||||
private Class<?> clazz;
|
|
||||||
|
|
||||||
private Phanton(T target) {
|
|
||||||
this.target = target;
|
|
||||||
clazz = target.getClass();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static <T> Phanton<T> from(T target) {
|
|
||||||
return new Phanton<T>(target);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Object call(String name) {
|
|
||||||
return invoke(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Object invoke(String name) {
|
|
||||||
for (final Field field : clazz.getDeclaredFields()) {
|
|
||||||
try {
|
|
||||||
if (name.equals(field.getName())) {
|
|
||||||
field.setAccessible(Boolean.TRUE);
|
|
||||||
return field.get(target);
|
|
||||||
}
|
|
||||||
} catch (final IllegalAccessException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
throw new RuntimeException("No such property with name " + name);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -18,7 +18,7 @@ import it.integry.integrywmsnative.core.data_store.db.entity.Ordine;
|
|||||||
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColr;
|
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColr;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColt;
|
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColt;
|
||||||
|
|
||||||
@Database(entities = {ArticoloGriglia.class, Griglia.class, Ordine.class, ArticoloOrdine.class, SqlMtbColt.class, SqlMtbColr.class}, version = 5, exportSchema = false)
|
@Database(entities = {ArticoloGriglia.class, Griglia.class, Ordine.class, ArticoloOrdine.class, SqlMtbColt.class, SqlMtbColr.class}, version = 7, exportSchema = false)
|
||||||
@TypeConverters({
|
@TypeConverters({
|
||||||
DateConverter.class
|
DateConverter.class
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import androidx.room.Insert;
|
|||||||
import androidx.room.Query;
|
import androidx.room.Query;
|
||||||
import androidx.room.Update;
|
import androidx.room.Update;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.data_store.db.entity.ArticoloGriglia;
|
import it.integry.integrywmsnative.core.data_store.db.entity.ArticoloGriglia;
|
||||||
@@ -21,10 +20,13 @@ public interface ArticoloGrigliaDao {
|
|||||||
|
|
||||||
@Insert
|
@Insert
|
||||||
void insertAll(List<ArticoloGriglia> articoli);
|
void insertAll(List<ArticoloGriglia> articoli);
|
||||||
|
|
||||||
@Insert
|
@Insert
|
||||||
Long insert(ArticoloGriglia articolo);
|
Long insert(ArticoloGriglia articolo);
|
||||||
|
|
||||||
@Update
|
@Update
|
||||||
void updateAll(List<ArticoloGriglia> articoli);
|
void updateAll(List<ArticoloGriglia> articoli);
|
||||||
|
|
||||||
@Update
|
@Update
|
||||||
void update(ArticoloGriglia articolo);
|
void update(ArticoloGriglia articolo);
|
||||||
|
|
||||||
@@ -45,4 +47,7 @@ public interface ArticoloGrigliaDao {
|
|||||||
|
|
||||||
@Query("SELECT * FROM articoli_griglia WHERE id_griglia = :grigliaId")
|
@Query("SELECT * FROM articoli_griglia WHERE id_griglia = :grigliaId")
|
||||||
List<ArticoloGriglia> getArticoliFromGriglia(int grigliaId);
|
List<ArticoloGriglia> getArticoliFromGriglia(int grigliaId);
|
||||||
|
|
||||||
|
@Query("SELECT * FROM articoli_griglia WHERE id_griglia = :grigliaId and new_no_promo = 1")
|
||||||
|
List<ArticoloGriglia> getNewArticoliInGriglia(int grigliaId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,6 +71,9 @@ public class ArticoloGriglia {
|
|||||||
@ColumnInfo(name = "id_griglia")
|
@ColumnInfo(name = "id_griglia")
|
||||||
private int idGriglia;
|
private int idGriglia;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "new_no_promo")
|
||||||
|
private boolean newNoPromo = false;
|
||||||
|
|
||||||
public int getArticoloGrigliaId() {
|
public int getArticoloGrigliaId() {
|
||||||
return articoloGrigliaId;
|
return articoloGrigliaId;
|
||||||
}
|
}
|
||||||
@@ -191,6 +194,14 @@ public class ArticoloGriglia {
|
|||||||
this.qtaProposta = qtaProposta;
|
this.qtaProposta = qtaProposta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isNewNoPromo() {
|
||||||
|
return newNoPromo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNewNoPromo(boolean newNoPromo) {
|
||||||
|
this.newNoPromo = newNoPromo;
|
||||||
|
}
|
||||||
|
|
||||||
public ArticoloOrdine convertToArticoloOrdine(Ordine ordine) {
|
public ArticoloOrdine convertToArticoloOrdine(Ordine ordine) {
|
||||||
ArticoloOrdine articolo = new ArticoloOrdine();
|
ArticoloOrdine articolo = new ArticoloOrdine();
|
||||||
|
|
||||||
@@ -210,6 +221,7 @@ public class ArticoloGriglia {
|
|||||||
articolo.setGiacenza(BigDecimal.valueOf(this.getGiacenza()));
|
articolo.setGiacenza(BigDecimal.valueOf(this.getGiacenza()));
|
||||||
articolo.setQtaPrevistaVendita(BigDecimal.valueOf(this.getQtaPrevistaVendita()));
|
articolo.setQtaPrevistaVendita(BigDecimal.valueOf(this.getQtaPrevistaVendita()));
|
||||||
articolo.setQtaProposta(BigDecimal.valueOf(this.getQtaProposta()));
|
articolo.setQtaProposta(BigDecimal.valueOf(this.getQtaProposta()));
|
||||||
|
articolo.setNewNoPromo(this.isNewNoPromo());
|
||||||
|
|
||||||
articolo.setQtaOrd(0);
|
articolo.setQtaOrd(0);
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ import java.util.Date;
|
|||||||
public class ArticoloOrdine {
|
public class ArticoloOrdine {
|
||||||
@PrimaryKey(autoGenerate = true)
|
@PrimaryKey(autoGenerate = true)
|
||||||
@ColumnInfo(name = "articolo_ordine_id")
|
@ColumnInfo(name = "articolo_ordine_id")
|
||||||
private int articoloOrdineId;
|
private Integer articoloOrdineId;
|
||||||
|
|
||||||
@ColumnInfo(name = "cod_mart")
|
@ColumnInfo(name = "cod_mart")
|
||||||
private String codMart;
|
private String codMart;
|
||||||
@@ -67,6 +67,8 @@ public class ArticoloOrdine {
|
|||||||
@ColumnInfo(name = "data_ins")
|
@ColumnInfo(name = "data_ins")
|
||||||
private Date dataIns;
|
private Date dataIns;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "new_no_promo")
|
||||||
|
private boolean newNoPromo;
|
||||||
|
|
||||||
@Ignore
|
@Ignore
|
||||||
private int ggScadenza = 0;
|
private int ggScadenza = 0;
|
||||||
@@ -81,7 +83,7 @@ public class ArticoloOrdine {
|
|||||||
private BigDecimal qtaProposta = BigDecimal.ZERO;
|
private BigDecimal qtaProposta = BigDecimal.ZERO;
|
||||||
|
|
||||||
|
|
||||||
public int getArticoloOrdineId() {
|
public Integer getArticoloOrdineId() {
|
||||||
return articoloOrdineId;
|
return articoloOrdineId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -221,14 +223,27 @@ public class ArticoloOrdine {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getQtaCnfPrevistaVendita(){
|
public BigDecimal getQtaCnfPrevistaVendita() {
|
||||||
return qtaPrevistaVendita.equals(BigDecimal.ZERO) ? BigDecimal.ZERO : qtaPrevistaVendita.divide(BigDecimal.valueOf(qtaCnf),0, RoundingMode.CEILING);
|
return qtaPrevistaVendita.equals(BigDecimal.ZERO) ? BigDecimal.ZERO : qtaPrevistaVendita.divide(BigDecimal.valueOf(qtaCnf), 0, RoundingMode.CEILING);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getQtaCnfProposta(){
|
public BigDecimal getQtaCnfProposta() {
|
||||||
return qtaProposta.equals(BigDecimal.ZERO) ? BigDecimal.ZERO : qtaProposta.divide(BigDecimal.valueOf(qtaCnf),0, RoundingMode.CEILING);
|
return qtaProposta.equals(BigDecimal.ZERO) ? BigDecimal.ZERO : qtaProposta.divide(BigDecimal.valueOf(qtaCnf), 0, RoundingMode.CEILING);
|
||||||
}
|
}
|
||||||
public BigDecimal getQtaCnfGiacenza(){
|
|
||||||
return giacenza.equals(BigDecimal.ZERO) ? BigDecimal.ZERO : giacenza.divide(BigDecimal.valueOf(qtaCnf),0, RoundingMode.CEILING);
|
public BigDecimal getQtaCnfGiacenza() {
|
||||||
|
return giacenza.equals(BigDecimal.ZERO) ? BigDecimal.ZERO : giacenza.divide(BigDecimal.valueOf(qtaCnf), 0, RoundingMode.CEILING);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isNewNoPromo() {
|
||||||
|
return newNoPromo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNewNoPromo(boolean newNoPromo) {
|
||||||
|
this.newNoPromo = newNoPromo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getCnfDaRic() {
|
||||||
|
return qtaCnf > 0.f ? merceDaRic / qtaCnf : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,4 +16,6 @@ public interface ArticoloGrigliaRepository {
|
|||||||
|
|
||||||
void findArticoloByScanAndGriglia(String scan, int idGriglia, RunnableArgs<ArticoloGriglia> onSuccess, RunnableArgs<Exception> onFail);
|
void findArticoloByScanAndGriglia(String scan, int idGriglia, RunnableArgs<ArticoloGriglia> onSuccess, RunnableArgs<Exception> onFail);
|
||||||
|
|
||||||
|
void findNewArticoliInGrigla(int idGriglia, RunnableArgs<List<ArticoloGriglia>> onSuccess, RunnableArgs<Exception> onFail);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,4 +89,14 @@ public class ArticoliGrigliaDataSource extends Repository implements ArticoloGri
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void findNewArticoliInGrigla(int idGriglia, RunnableArgs<List<ArticoloGriglia>> onSuccess, RunnableArgs<Exception> onFail) {
|
||||||
|
execute(() -> {
|
||||||
|
try {
|
||||||
|
onSuccess.run(mArticoloGrigliaDao.getNewArticoliInGriglia(idGriglia));
|
||||||
|
} catch (Exception e) {
|
||||||
|
onFail.run(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,13 +28,15 @@ public class ArticoliOrdineDataSource extends Repository implements ArticoliOrdi
|
|||||||
List<ArticoloOrdine> toUpdate = new ArrayList<>();
|
List<ArticoloOrdine> toUpdate = new ArrayList<>();
|
||||||
List<ArticoloOrdine> toInsert = new ArrayList<>();
|
List<ArticoloOrdine> toInsert = new ArrayList<>();
|
||||||
for (ArticoloOrdine art : articoli) {
|
for (ArticoloOrdine art : articoli) {
|
||||||
if (art.getArticoloOrdineId() > 0) {
|
if (art.getArticoloOrdineId() != null && art.getArticoloOrdineId() > 0) {
|
||||||
toUpdate.add(art);
|
toUpdate.add(art);
|
||||||
} else {
|
} else {
|
||||||
toInsert.add(art);
|
toInsert.add(art);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mArticoloOrdineDao.insertAll(toInsert);
|
for (ArticoloOrdine newArt : toInsert) {
|
||||||
|
mArticoloOrdineDao.insert(newArt);
|
||||||
|
}
|
||||||
mArticoloOrdineDao.updateAll(toUpdate);
|
mArticoloOrdineDao.updateAll(toUpdate);
|
||||||
onSuccess.run();
|
onSuccess.run();
|
||||||
|
|
||||||
@@ -48,7 +50,7 @@ public class ArticoliOrdineDataSource extends Repository implements ArticoliOrdi
|
|||||||
public void saveArticoloToOrdine(ArticoloOrdine articolo, Runnable onSuccess, RunnableArgs<Exception> onFail) {
|
public void saveArticoloToOrdine(ArticoloOrdine articolo, Runnable onSuccess, RunnableArgs<Exception> onFail) {
|
||||||
execute(() -> {
|
execute(() -> {
|
||||||
try {
|
try {
|
||||||
if (articolo.getArticoloOrdineId() > 0) {
|
if (articolo.getArticoloOrdineId() != null && articolo.getArticoloOrdineId() > 0) {
|
||||||
mArticoloOrdineDao.update(articolo);
|
mArticoloOrdineDao.update(articolo);
|
||||||
} else {
|
} else {
|
||||||
mArticoloOrdineDao.insert(articolo);
|
mArticoloOrdineDao.insert(articolo);
|
||||||
|
|||||||
@@ -1,35 +1,23 @@
|
|||||||
package it.integry.integrywmsnative.core.data_store.db.view_model;
|
package it.integry.integrywmsnative.core.data_store.db.view_model;
|
||||||
|
|
||||||
import androidx.room.ColumnInfo;
|
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.data_store.db.entity.ArticoloGriglia;
|
import it.integry.integrywmsnative.core.data_store.db.entity.ArticoloGriglia;
|
||||||
|
|
||||||
public class ArticoloDTO {
|
public class ArticoloDTO {
|
||||||
|
|
||||||
private String codMart;
|
public String codMart;
|
||||||
|
public String descrizione;
|
||||||
private String descrizione;
|
public String untMis;
|
||||||
|
public float qtaCnf;
|
||||||
private String untMis;
|
public String barcode;
|
||||||
|
public float merceDaRic;
|
||||||
private String barcode;
|
public float mediaSett;
|
||||||
|
public String flagQtaMultipla;
|
||||||
private String flagQtaMultipla;
|
public String flagTracciabilita;
|
||||||
|
public float qtaMinOrdinabile;
|
||||||
private float qtaCnf;
|
public boolean newNoPromo;
|
||||||
|
|
||||||
private float merceDaRic;
|
|
||||||
|
|
||||||
private float mediaSett;
|
|
||||||
|
|
||||||
private float qtaMinOrdinabile;
|
|
||||||
|
|
||||||
private int ggScadenza;
|
private int ggScadenza;
|
||||||
|
|
||||||
private float giacenza;
|
private float giacenza;
|
||||||
|
|
||||||
private float qtaPrevistaVendita;
|
private float qtaPrevistaVendita;
|
||||||
|
|
||||||
private float qtaProposta;
|
private float qtaProposta;
|
||||||
|
|
||||||
|
|
||||||
@@ -145,6 +133,24 @@ public class ArticoloDTO {
|
|||||||
this.qtaProposta = qtaProposta;
|
this.qtaProposta = qtaProposta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getFlagTracciabilita() {
|
||||||
|
return flagTracciabilita;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArticoloDTO setFlagTracciabilita(String flagTracciabilita) {
|
||||||
|
this.flagTracciabilita = flagTracciabilita;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isNewNoPromo() {
|
||||||
|
return newNoPromo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArticoloDTO setNewNoPromo(boolean newNoPromo) {
|
||||||
|
this.newNoPromo = newNoPromo;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public ArticoloGriglia toArticoloGriglia() {
|
public ArticoloGriglia toArticoloGriglia() {
|
||||||
ArticoloGriglia result = new ArticoloGriglia();
|
ArticoloGriglia result = new ArticoloGriglia();
|
||||||
result.setBarCode(this.getBarCode());
|
result.setBarCode(this.getBarCode());
|
||||||
@@ -157,6 +163,7 @@ public class ArticoloDTO {
|
|||||||
result.setFlagQtaMultipla(this.getFlagQtaMultipla());
|
result.setFlagQtaMultipla(this.getFlagQtaMultipla());
|
||||||
result.setQtaMinOrdinabile(this.getQtaMinOrdinabile());
|
result.setQtaMinOrdinabile(this.getQtaMinOrdinabile());
|
||||||
result.setGgScadenza(this.ggScadenza);
|
result.setGgScadenza(this.ggScadenza);
|
||||||
|
result.setNewNoPromo(this.newNoPromo);
|
||||||
result.setGiacenza(this.giacenza);
|
result.setGiacenza(this.giacenza);
|
||||||
result.setQtaPrevistaVendita(this.qtaPrevistaVendita);
|
result.setQtaPrevistaVendita(this.qtaPrevistaVendita);
|
||||||
result.setQtaProposta(this.qtaProposta);
|
result.setQtaProposta(this.qtaProposta);
|
||||||
|
|||||||
@@ -1,21 +1,37 @@
|
|||||||
package it.integry.integrywmsnative.core.expansion;
|
package it.integry.integrywmsnative.core.expansion;
|
||||||
|
|
||||||
import android.app.Dialog;
|
import android.content.Context;
|
||||||
|
import android.util.AttributeSet;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.MainApplication;
|
||||||
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
||||||
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.view.dialogs.DialogProgressView;
|
||||||
|
|
||||||
public class BaseActivity extends AppCompatActivity {
|
public class BaseActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public DialogProgressView mCurrentProgress;
|
||||||
|
|
||||||
protected Dialog mCurrentProgress;
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public View onCreateView(@Nullable View parent, @NonNull String name, @NonNull Context context, @NonNull AttributeSet attrs) {
|
||||||
|
var v = super.onCreateView(parent, name, context, attrs);
|
||||||
|
|
||||||
public BaseActivity() {
|
MainApplication.appComponent
|
||||||
//Thread.setDefaultUncaughtExceptionHandler(new MyExceptionHandler(this, BaseActivity.class));
|
.baseActivityComponent()
|
||||||
|
.create()
|
||||||
|
.inject(this);
|
||||||
|
|
||||||
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -42,8 +58,8 @@ public class BaseActivity extends AppCompatActivity {
|
|||||||
protected void openProgress() {
|
protected void openProgress() {
|
||||||
runOnUiThread(() -> {
|
runOnUiThread(() -> {
|
||||||
BarcodeManager.disable();
|
BarcodeManager.disable();
|
||||||
if (this.mCurrentProgress == null) {
|
if (!this.mCurrentProgress.isVisible() && !this.mCurrentProgress.isAdded()) {
|
||||||
this.mCurrentProgress = UtilityProgress.createDefaultProgressDialog(this);
|
this.mCurrentProgress.show(getSupportFragmentManager(), "tag");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -51,9 +67,8 @@ public class BaseActivity extends AppCompatActivity {
|
|||||||
protected void closeProgress() {
|
protected void closeProgress() {
|
||||||
runOnUiThread(() -> {
|
runOnUiThread(() -> {
|
||||||
BarcodeManager.enable();
|
BarcodeManager.enable();
|
||||||
if (mCurrentProgress != null) {
|
if (mCurrentProgress.isVisible()) {
|
||||||
mCurrentProgress.dismiss();
|
mCurrentProgress.dismiss();
|
||||||
mCurrentProgress = null;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package it.integry.integrywmsnative.core.expansion;
|
||||||
|
|
||||||
|
import dagger.Subcomponent;
|
||||||
|
|
||||||
|
@Subcomponent
|
||||||
|
public interface BaseActivityComponent {
|
||||||
|
|
||||||
|
@Subcomponent.Factory
|
||||||
|
interface Factory {
|
||||||
|
BaseActivityComponent create();
|
||||||
|
}
|
||||||
|
|
||||||
|
void inject(BaseActivity baseActivity);
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package it.integry.integrywmsnative.core.expansion;
|
||||||
|
|
||||||
|
import dagger.Module;
|
||||||
|
|
||||||
|
@Module(subcomponents = BaseActivityComponent.class)
|
||||||
|
public class BaseActivityModule {
|
||||||
|
}
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
package it.integry.integrywmsnative.core.expansion;
|
package it.integry.integrywmsnative.core.expansion;
|
||||||
|
|
||||||
import android.app.Dialog;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
@@ -15,11 +14,12 @@ import androidx.fragment.app.FragmentTransaction;
|
|||||||
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
||||||
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.core.utility.UtilityProgress;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.DialogProgressView;
|
||||||
|
|
||||||
public class BaseDialogFragment extends DialogFragment {
|
public class BaseDialogFragment extends DialogFragment {
|
||||||
|
|
||||||
private boolean mBarcodeListener = false;
|
private boolean mBarcodeListener = false;
|
||||||
private Dialog mCurrentProgress;
|
private DialogProgressView mCurrentProgress;
|
||||||
|
|
||||||
public BaseDialogFragment() {
|
public BaseDialogFragment() {
|
||||||
super();
|
super();
|
||||||
@@ -82,7 +82,7 @@ public class BaseDialogFragment extends DialogFragment {
|
|||||||
// new Thread(() -> {
|
// new Thread(() -> {
|
||||||
requireActivity().runOnUiThread(() -> {
|
requireActivity().runOnUiThread(() -> {
|
||||||
if (this.mCurrentProgress == null) {
|
if (this.mCurrentProgress == null) {
|
||||||
this.mCurrentProgress = UtilityProgress.createDefaultProgressDialog(getActivity());
|
this.mCurrentProgress = UtilityProgress.createDefaultProgressDialog(requireActivity());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// }).start();
|
// }).start();
|
||||||
|
|||||||
@@ -1,21 +1,30 @@
|
|||||||
package it.integry.integrywmsnative.core.expansion;
|
package it.integry.integrywmsnative.core.expansion;
|
||||||
|
|
||||||
import android.app.Dialog;
|
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.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.MainApplication;
|
||||||
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
||||||
import it.integry.integrywmsnative.core.interfaces.IPoppableActivity;
|
import it.integry.integrywmsnative.core.interfaces.IPoppableActivity;
|
||||||
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.ui.ElevatedToolbar;
|
import it.integry.integrywmsnative.ui.ElevatedToolbar;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.DialogProgressView;
|
||||||
|
|
||||||
public abstract class BaseFragment extends Fragment {
|
public abstract class BaseFragment extends Fragment {
|
||||||
|
|
||||||
protected Dialog mCurrentProgress;
|
@Inject
|
||||||
|
public DialogProgressView mCurrentProgress;
|
||||||
|
|
||||||
protected ElevatedToolbar mToolbar;
|
protected ElevatedToolbar mToolbar;
|
||||||
|
|
||||||
@@ -26,28 +35,35 @@ public abstract class BaseFragment extends Fragment {
|
|||||||
mToolbar = toolbar;
|
mToolbar = toolbar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void addOnPreDestroy(Runnable onPreDestroy) {
|
public void addOnPreDestroy(Runnable onPreDestroy) {
|
||||||
this.mOnPreDestroyList.add(onPreDestroy);
|
this.mOnPreDestroyList.add(onPreDestroy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
|
View view = super.onCreateView(inflater, container, savedInstanceState);
|
||||||
|
|
||||||
|
MainApplication.appComponent
|
||||||
|
.baseFragmentComponent()
|
||||||
|
.create()
|
||||||
|
.inject(this);
|
||||||
|
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
public void onLoadingStarted() {
|
public void onLoadingStarted() {
|
||||||
new Thread(() -> {
|
BarcodeManager.disable();
|
||||||
BarcodeManager.disable();
|
this.openProgress();
|
||||||
this.openProgress();
|
|
||||||
}).start();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onLoadingEnded() {
|
public void onLoadingEnded() {
|
||||||
new Thread(() -> {
|
this.closeProgress();
|
||||||
this.closeProgress();
|
BarcodeManager.enable();
|
||||||
BarcodeManager.enable();
|
|
||||||
}).start();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onError(Exception ex) {
|
public void onError(Exception ex) {
|
||||||
this.getActivity().runOnUiThread(() -> {
|
requireActivity().runOnUiThread(() -> {
|
||||||
this.closeProgress();
|
this.closeProgress();
|
||||||
UtilityExceptions.defaultException(getActivity(), ex, mCurrentProgress);
|
UtilityExceptions.defaultException(getActivity(), ex, mCurrentProgress);
|
||||||
BarcodeManager.enable();
|
BarcodeManager.enable();
|
||||||
@@ -65,24 +81,23 @@ public abstract class BaseFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void openProgress() {
|
protected void openProgress() {
|
||||||
getActivity().runOnUiThread(() -> {
|
requireActivity().runOnUiThread(() -> {
|
||||||
if (this.mCurrentProgress == null) {
|
if (!this.mCurrentProgress.isVisible() && !this.mCurrentProgress.isAdded()) {
|
||||||
this.mCurrentProgress = UtilityProgress.createDefaultProgressDialog(getActivity());
|
this.mCurrentProgress.show(requireActivity().getSupportFragmentManager(), "tag");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void closeProgress() {
|
protected void closeProgress() {
|
||||||
getActivity().runOnUiThread(() -> {
|
requireActivity().runOnUiThread(() -> {
|
||||||
if (mCurrentProgress != null) {
|
if (mCurrentProgress.isVisible()) {
|
||||||
mCurrentProgress.dismiss();
|
mCurrentProgress.dismiss();
|
||||||
mCurrentProgress = null;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void popMe() {
|
protected void popMe() {
|
||||||
getActivity().runOnUiThread(() -> {
|
requireActivity().runOnUiThread(() -> {
|
||||||
((IPoppableActivity) requireActivity()).pop();
|
((IPoppableActivity) requireActivity()).pop();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package it.integry.integrywmsnative.core.expansion;
|
||||||
|
|
||||||
|
import dagger.Subcomponent;
|
||||||
|
|
||||||
|
@Subcomponent
|
||||||
|
public interface BaseFragmentComponent {
|
||||||
|
|
||||||
|
@Subcomponent.Factory
|
||||||
|
interface Factory {
|
||||||
|
BaseFragmentComponent create();
|
||||||
|
}
|
||||||
|
|
||||||
|
void inject(BaseFragment baseFragment);
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package it.integry.integrywmsnative.core.expansion;
|
||||||
|
|
||||||
|
import dagger.Module;
|
||||||
|
|
||||||
|
@Module(subcomponents = BaseFragmentComponent.class)
|
||||||
|
public class BaseFragmentModule {
|
||||||
|
}
|
||||||
@@ -57,6 +57,7 @@ public class MtbColt extends EntityBase {
|
|||||||
private String codJcom;
|
private String codJcom;
|
||||||
|
|
||||||
private List<MtbCols> mtbCols;
|
private List<MtbCols> mtbCols;
|
||||||
|
private MtbTCol mtbTCol;
|
||||||
|
|
||||||
private Boolean disablePrint;
|
private Boolean disablePrint;
|
||||||
private String ragSocCliente;
|
private String ragSocCliente;
|
||||||
@@ -83,7 +84,6 @@ public class MtbColt extends EntityBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private ObservableArrayList<MtbColr> mtbColr = new ObservableArrayList<>();
|
private ObservableArrayList<MtbColr> mtbColr = new ObservableArrayList<>();
|
||||||
|
|
||||||
public ObservableArrayList<MtbColr> getMtbColr() {
|
public ObservableArrayList<MtbColr> getMtbColr() {
|
||||||
@@ -95,12 +95,12 @@ public class MtbColt extends EntityBase {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MtbColt(){
|
public MtbColt() {
|
||||||
type = "mtb_colt";
|
type = "mtb_colt";
|
||||||
setDataCollo(UtilityDate.getDateInstance());
|
setDataCollo(UtilityDate.getDateInstance());
|
||||||
setSerCollo("/");
|
setSerCollo("/");
|
||||||
|
|
||||||
if(SettingsManager.i().isUserLoggedIn()) {
|
if (SettingsManager.i().isUserLoggedIn()) {
|
||||||
setPreparatoDa(SettingsManager.i().getUser().getFullname());
|
setPreparatoDa(SettingsManager.i().getUser().getFullname());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -137,11 +137,11 @@ public class MtbColt extends EntityBase {
|
|||||||
Date dataColloD = null;
|
Date dataColloD = null;
|
||||||
try {
|
try {
|
||||||
dataColloD = getDataColloD();
|
dataColloD = getDataColloD();
|
||||||
} catch (Exception ex){
|
} catch (Exception ex) {
|
||||||
UtilityLogger.errorMe(ex);
|
UtilityLogger.errorMe(ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(dataColloD != null){
|
if (dataColloD != null) {
|
||||||
return UtilityDate.formatDate(dataColloD, UtilityDate.COMMONS_DATE_FORMATS.DMY_HUMAN_LONG);
|
return UtilityDate.formatDate(dataColloD, UtilityDate.COMMONS_DATE_FORMATS.DMY_HUMAN_LONG);
|
||||||
} else return null;
|
} else return null;
|
||||||
}
|
}
|
||||||
@@ -392,7 +392,7 @@ public class MtbColt extends EntityBase {
|
|||||||
public String getTimeVers() {
|
public String getTimeVers() {
|
||||||
Date dataColloD = getDataVersD();
|
Date dataColloD = getDataVersD();
|
||||||
|
|
||||||
if(dataColloD != null){
|
if (dataColloD != null) {
|
||||||
return UtilityDate.formatDate(dataColloD, UtilityDate.COMMONS_DATE_FORMATS.TIME);
|
return UtilityDate.formatDate(dataColloD, UtilityDate.COMMONS_DATE_FORMATS.TIME);
|
||||||
} else return null;
|
} else return null;
|
||||||
}
|
}
|
||||||
@@ -526,6 +526,15 @@ public class MtbColt extends EntityBase {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MtbTCol getMtbTCol() {
|
||||||
|
return mtbTCol;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MtbColt setMtbTCol(MtbTCol mtbTCol) {
|
||||||
|
this.mtbTCol = mtbTCol;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public void generaFiltroOrdineFromDTO(List<FiltroOrdineDTO> filtroOrdineDtos) {
|
public void generaFiltroOrdineFromDTO(List<FiltroOrdineDTO> filtroOrdineDtos) {
|
||||||
|
|
||||||
String xmlPrefix = "{\"whereCond\": \"";
|
String xmlPrefix = "{\"whereCond\": \"";
|
||||||
@@ -533,9 +542,9 @@ public class MtbColt extends EntityBase {
|
|||||||
|
|
||||||
StringBuilder whereCond = new StringBuilder();
|
StringBuilder whereCond = new StringBuilder();
|
||||||
|
|
||||||
if(filtroOrdineDtos != null && filtroOrdineDtos.size() > 0) {
|
if (filtroOrdineDtos != null && filtroOrdineDtos.size() > 0) {
|
||||||
|
|
||||||
for(int i = 0; i < filtroOrdineDtos.size(); i++){
|
for (int i = 0; i < filtroOrdineDtos.size(); i++) {
|
||||||
FiltroOrdineDTO x = filtroOrdineDtos.get(i);
|
FiltroOrdineDTO x = filtroOrdineDtos.get(i);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -545,13 +554,13 @@ public class MtbColt extends EntityBase {
|
|||||||
UtilityDB.valueToString(UtilityDate.formatDate(x.getDataOrdD(), UtilityDate.COMMONS_DATE_FORMATS.YMD_SLASH)),
|
UtilityDB.valueToString(UtilityDate.formatDate(x.getDataOrdD(), UtilityDate.COMMONS_DATE_FORMATS.YMD_SLASH)),
|
||||||
UtilityDB.valueToString(x.getNumOrd())));
|
UtilityDB.valueToString(x.getNumOrd())));
|
||||||
|
|
||||||
if(!UtilityString.isNullOrEmpty(x.getDataConsS())) {
|
if (!UtilityString.isNullOrEmpty(x.getDataConsS())) {
|
||||||
whereCond.append(String.format(" AND dr.dc = %s",
|
whereCond.append(String.format(" AND dr.dc = %s",
|
||||||
UtilityDB.valueToString(UtilityDate.formatDate(x.getDataConsD(), UtilityDate.COMMONS_DATE_FORMATS.YMD_SLASH))));
|
UtilityDB.valueToString(UtilityDate.formatDate(x.getDataConsD(), UtilityDate.COMMONS_DATE_FORMATS.YMD_SLASH))));
|
||||||
}
|
}
|
||||||
|
|
||||||
whereCond.append(")");
|
whereCond.append(")");
|
||||||
if(i < filtroOrdineDtos.size()-1) {
|
if (i < filtroOrdineDtos.size() - 1) {
|
||||||
whereCond.append(" OR ");
|
whereCond.append(" OR ");
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ public class ArticoloRESTConsumer extends _BaseRESTConsumer {
|
|||||||
@Override
|
@Override
|
||||||
public void onResponse(Call<ServiceRESTResponse<MtbAart>> call, Response<ServiceRESTResponse<MtbAart>> response) {
|
public void onResponse(Call<ServiceRESTResponse<MtbAart>> call, Response<ServiceRESTResponse<MtbAart>> response) {
|
||||||
analyzeAnswer(response, "getByCodMart", (m) -> {
|
analyzeAnswer(response, "getByCodMart", (m) -> {
|
||||||
if(response.body().getEntityList() != null && !response.body().getEntityList().isEmpty()) {
|
if (response.body().getEntityList() != null && !response.body().getEntityList().isEmpty()) {
|
||||||
onComplete.run(response.body().getEntityList().get(0));
|
onComplete.run(response.body().getEntityList().get(0));
|
||||||
} else onComplete.run(null);
|
} else onComplete.run(null);
|
||||||
|
|
||||||
@@ -107,9 +107,10 @@ public class ArticoloRESTConsumer extends _BaseRESTConsumer {
|
|||||||
})
|
})
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
var whereCond = " WHERE " + UtilityQuery.concatFieldListInWhereCond(whereCondMap);
|
var whereCond = whereCondMap.isEmpty() ? "" : " WHERE " + UtilityQuery.concatFieldListInWhereCond(whereCondMap);
|
||||||
|
|
||||||
Type typeOfObjectsList = new TypeToken<ArrayList<MtbGrup>>() {}.getType();
|
Type typeOfObjectsList = new TypeToken<ArrayList<MtbGrup>>() {
|
||||||
|
}.getType();
|
||||||
this.systemRESTConsumer.processSql("SELECT * FROM mtb_grup " + whereCond, typeOfObjectsList, onComplete, onFailed);
|
this.systemRESTConsumer.processSql("SELECT * FROM mtb_grup " + whereCond, typeOfObjectsList, onComplete, onFailed);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,9 +5,7 @@ import android.util.Log;
|
|||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.GsonBuilder;
|
import com.google.gson.GsonBuilder;
|
||||||
import com.google.gson.JsonDeserializationContext;
|
|
||||||
import com.google.gson.JsonDeserializer;
|
import com.google.gson.JsonDeserializer;
|
||||||
import com.google.gson.JsonElement;
|
|
||||||
import com.google.gson.JsonParseException;
|
import com.google.gson.JsonParseException;
|
||||||
import com.google.gson.reflect.TypeToken;
|
import com.google.gson.reflect.TypeToken;
|
||||||
import com.orhanobut.logger.Logger;
|
import com.orhanobut.logger.Logger;
|
||||||
@@ -17,8 +15,6 @@ import java.io.InputStream;
|
|||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.text.ParseException;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -35,6 +31,7 @@ import it.integry.integrywmsnative.core.rest.model.MailRequestDTO;
|
|||||||
import it.integry.integrywmsnative.core.rest.model.NativeSqlRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.NativeSqlRequestDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityLogger;
|
import it.integry.integrywmsnative.core.utility.UtilityLogger;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
@@ -55,18 +52,11 @@ public class SystemRESTConsumer extends _BaseRESTConsumer {
|
|||||||
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) {
|
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) {
|
||||||
analyzeAnswer(response, "ProcessSql", o -> {
|
analyzeAnswer(response, "ProcessSql", o -> {
|
||||||
Gson gson = new GsonBuilder()
|
Gson gson = new GsonBuilder()
|
||||||
.registerTypeAdapter(Date.class, new JsonDeserializer() {
|
.registerTypeAdapter(Date.class, (JsonDeserializer) (json, typeOfT, context) -> {
|
||||||
@Override
|
try {
|
||||||
public Date deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
|
return UtilityDate.recognizeDate(json.getAsString());
|
||||||
try {
|
} catch (Exception e) {
|
||||||
return new SimpleDateFormat("dd/MM/yyyy HH:mm:ss").parse(json.getAsString());
|
throw new JsonParseException(e);
|
||||||
} catch (Exception e) {
|
|
||||||
try {
|
|
||||||
return new SimpleDateFormat().parse(json.getAsString());
|
|
||||||
} catch (ParseException parseException) {
|
|
||||||
throw new JsonParseException(parseException);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.create();
|
.create();
|
||||||
|
|||||||
@@ -3,10 +3,10 @@ package it.integry.integrywmsnative.core.settings;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.rest.model.AvailableCodMdepsDTO;
|
|
||||||
import it.integry.integrywmsnative.core.rest.model.DistribuzioneColloDTO;
|
|
||||||
import it.integry.integrywmsnative.core.model.Azienda;
|
import it.integry.integrywmsnative.core.model.Azienda;
|
||||||
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
||||||
|
import it.integry.integrywmsnative.core.rest.model.AvailableCodMdepsDTO;
|
||||||
|
import it.integry.integrywmsnative.core.rest.model.DistribuzioneColloDTO;
|
||||||
|
|
||||||
public class DBSettingsModel {
|
public class DBSettingsModel {
|
||||||
|
|
||||||
@@ -36,9 +36,12 @@ public class DBSettingsModel {
|
|||||||
private boolean flagSpedizioneCanSelectMultipleOrders;
|
private boolean flagSpedizioneCanSelectMultipleOrders;
|
||||||
private List<String> notePerditaDocInterni = new ArrayList<>();
|
private List<String> notePerditaDocInterni = new ArrayList<>();
|
||||||
private boolean flagSpedizioneUseQtaOrd;
|
private boolean flagSpedizioneUseQtaOrd;
|
||||||
|
private boolean flagOrdinaNuoviArticoliInGriglia;
|
||||||
|
private String docInterniCheckFornitore;
|
||||||
private String produzioneDefaultCodAnag;
|
private String produzioneDefaultCodAnag;
|
||||||
private String reportNameSpedizionChiudiOrdine;
|
private String reportNameSpedizionChiudiOrdine;
|
||||||
private int onNumCnfInputChanged = 1;
|
private int onNumCnfInputChanged = 1;
|
||||||
|
private boolean flagAccettazioneUseQtaOrd = false;
|
||||||
|
|
||||||
public boolean isFlagSpedizioneEnableFakeGiacenza() {
|
public boolean isFlagSpedizioneEnableFakeGiacenza() {
|
||||||
return flagSpedizioneEnableFakeGiacenza;
|
return flagSpedizioneEnableFakeGiacenza;
|
||||||
@@ -72,7 +75,7 @@ public class DBSettingsModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public DBSettingsModel setDatiAzienda(Azienda datiAzienda) {
|
public DBSettingsModel setDatiAzienda(Azienda datiAzienda) {
|
||||||
this.datiAzienda = datiAzienda;
|
this.datiAzienda = datiAzienda;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -247,6 +250,15 @@ public class DBSettingsModel {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DBSettingsModel setFlagOrdinaNuoviArticoliInGriglia(boolean flagOrdinaNuoviArticoliInGriglia) {
|
||||||
|
this.flagOrdinaNuoviArticoliInGriglia = flagOrdinaNuoviArticoliInGriglia;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getFlagOrdinaNuoviArticoliInGriglia() {
|
||||||
|
return this.flagOrdinaNuoviArticoliInGriglia;
|
||||||
|
}
|
||||||
|
|
||||||
public String getProduzioneDefaultCodAnag() {
|
public String getProduzioneDefaultCodAnag() {
|
||||||
return produzioneDefaultCodAnag;
|
return produzioneDefaultCodAnag;
|
||||||
}
|
}
|
||||||
@@ -282,4 +294,22 @@ public class DBSettingsModel {
|
|||||||
this.notePerditaDocInterni = notePerditaDocInterni;
|
this.notePerditaDocInterni = notePerditaDocInterni;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getDocInterniCheckFornitore() {
|
||||||
|
return docInterniCheckFornitore;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DBSettingsModel setDocInterniCheckFornitore(String docInterniCheckFornitore) {
|
||||||
|
this.docInterniCheckFornitore = docInterniCheckFornitore;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isFlagAccettazioneUseQtaOrd() {
|
||||||
|
return flagAccettazioneUseQtaOrd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DBSettingsModel setFlagAccettazioneUseQtaOrd(boolean flagAccettazioneUseQtaOrd) {
|
||||||
|
this.flagAccettazioneUseQtaOrd = flagAccettazioneUseQtaOrd;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -270,6 +270,18 @@ public class SettingsManager {
|
|||||||
.setGestName("PVM")
|
.setGestName("PVM")
|
||||||
.setSection("DOC_INTERNI")
|
.setSection("DOC_INTERNI")
|
||||||
.setKeySection("NOTE_PERDITA"));
|
.setKeySection("NOTE_PERDITA"));
|
||||||
|
stbGestSetupList.add(new StbGestSetup()
|
||||||
|
.setGestName("PVM")
|
||||||
|
.setSection("ORDINI_A")
|
||||||
|
.setKeySection("ORDINA_NUOVI_ARTICOLI"));
|
||||||
|
stbGestSetupList.add(new StbGestSetup()
|
||||||
|
.setGestName("PVM")
|
||||||
|
.setSection("DOC_INTERNI")
|
||||||
|
.setKeySection("CHECK_FORNITORE"));
|
||||||
|
stbGestSetupList.add(new StbGestSetup()
|
||||||
|
.setGestName("PICKING")
|
||||||
|
.setSection("ACCETTAZIONE")
|
||||||
|
.setKeySection("FLAG_USE_QTA_ORD"));
|
||||||
|
|
||||||
|
|
||||||
GestSetupRESTConsumer.getValues(stbGestSetupList, list -> {
|
GestSetupRESTConsumer.getValues(stbGestSetupList, list -> {
|
||||||
@@ -294,8 +306,12 @@ public class SettingsManager {
|
|||||||
dbSettingsModelIstance.setFlagSpedizioneCanSelectMultipleOrders(getValueFromList(list, "SPEDIZIONE", "FLAG_CAN_SELECT_MULTIPLE_ORDERS", Boolean.class));
|
dbSettingsModelIstance.setFlagSpedizioneCanSelectMultipleOrders(getValueFromList(list, "SPEDIZIONE", "FLAG_CAN_SELECT_MULTIPLE_ORDERS", Boolean.class));
|
||||||
dbSettingsModelIstance.setReportNameSpedizionChiudiOrdine(getValueFromList(list, "SPEDIZIONE", "REPORT_PACKING_LIST", String.class));
|
dbSettingsModelIstance.setReportNameSpedizionChiudiOrdine(getValueFromList(list, "SPEDIZIONE", "REPORT_PACKING_LIST", String.class));
|
||||||
dbSettingsModelIstance.setFlagSpedizioneUseQtaOrd(getValueFromList(list, "SPEDIZIONE", "FLAG_USE_QTA_ORD", Boolean.class));
|
dbSettingsModelIstance.setFlagSpedizioneUseQtaOrd(getValueFromList(list, "SPEDIZIONE", "FLAG_USE_QTA_ORD", Boolean.class));
|
||||||
String notePerdita = getValueFromList(list,"DOC_INTERNI","NOTE_PERDITA",String.class);
|
dbSettingsModelIstance.setFlagOrdinaNuoviArticoliInGriglia(getValueFromList(list, "ORDINI_A", "ORDINA_NUOVI_ARTICOLI", Boolean.class));
|
||||||
if (notePerdita != null){
|
dbSettingsModelIstance.setDocInterniCheckFornitore(getValueFromList(list, "DOC_INTERNI", "CHECK_FORNITORE", String.class));
|
||||||
|
dbSettingsModelIstance.setFlagAccettazioneUseQtaOrd(getValueFromList(list, "ACCETTAZIONE", "FLAG_USE_QTA_ORD", Boolean.class));
|
||||||
|
|
||||||
|
String notePerdita = getValueFromList(list, "DOC_INTERNI", "NOTE_PERDITA", String.class);
|
||||||
|
if (notePerdita != null) {
|
||||||
dbSettingsModelIstance.setNotePerditaDocInterni(Arrays.asList(notePerdita.split("\\|")));
|
dbSettingsModelIstance.setNotePerditaDocInterni(Arrays.asList(notePerdita.split("\\|")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,60 +0,0 @@
|
|||||||
package it.integry.integrywmsnative.core.update;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.net.Uri;
|
|
||||||
import android.os.AsyncTask;
|
|
||||||
import android.os.Environment;
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.net.HttpURLConnection;
|
|
||||||
import java.net.URL;
|
|
||||||
|
|
||||||
public class UpdateApp extends AsyncTask<String,Void,Void> {
|
|
||||||
private Context context;
|
|
||||||
public void setContext(Context contextf){
|
|
||||||
context = contextf;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Void doInBackground(String... arg0) {
|
|
||||||
try {
|
|
||||||
URL url = new URL(arg0[0]);
|
|
||||||
HttpURLConnection c = (HttpURLConnection) url.openConnection();
|
|
||||||
c.setRequestMethod("GET");
|
|
||||||
c.setDoOutput(true);
|
|
||||||
c.connect();
|
|
||||||
|
|
||||||
File file = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
|
|
||||||
file.mkdirs();
|
|
||||||
File outputFile = new File(file, "update.apk");
|
|
||||||
if(outputFile.exists()){
|
|
||||||
outputFile.delete();
|
|
||||||
}
|
|
||||||
FileOutputStream fos = new FileOutputStream(outputFile);
|
|
||||||
|
|
||||||
InputStream is = c.getInputStream();
|
|
||||||
|
|
||||||
byte[] buffer = new byte[1024];
|
|
||||||
int len1 = 0;
|
|
||||||
while ((len1 = is.read(buffer)) != -1) {
|
|
||||||
fos.write(buffer, 0, len1);
|
|
||||||
}
|
|
||||||
fos.close();
|
|
||||||
is.close();
|
|
||||||
|
|
||||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
|
||||||
intent.setDataAndType(Uri.fromFile(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS)), "application/vnd.android.package-archive");
|
|
||||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // without this flag android returned a intent error!
|
|
||||||
context.startActivity(intent);
|
|
||||||
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.e("UpdateAPP", "Update error! " + e.getMessage());
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,30 +1,35 @@
|
|||||||
package it.integry.integrywmsnative.core.update;
|
package it.integry.integrywmsnative.core.update;
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.app.DownloadManager;
|
|
||||||
import android.content.BroadcastReceiver;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
import com.github.javiersantos.appupdater.AppUpdater;
|
import com.github.javiersantos.appupdater.AppUpdater;
|
||||||
import com.github.javiersantos.appupdater.enums.Display;
|
import com.github.javiersantos.appupdater.enums.Display;
|
||||||
import com.github.javiersantos.appupdater.enums.UpdateFrom;
|
import com.github.javiersantos.appupdater.enums.UpdateFrom;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.R;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.class_router.BaseCustomConfiguration;
|
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.interfaces.ICustomConfiguration;
|
import it.integry.integrywmsnative.core.class_router.interfaces.ICustomConfiguration;
|
||||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||||
|
import it.integry.integrywmsnative.core.utility.FileDownloader;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.DialogProgressView;
|
||||||
|
|
||||||
|
@Singleton
|
||||||
public class UpdatesManager {
|
public class UpdatesManager {
|
||||||
|
|
||||||
public static void init(Activity context) {
|
private AppCompatActivity mContext;
|
||||||
|
|
||||||
|
public void init(AppCompatActivity activityContext) {
|
||||||
|
this.mContext = activityContext;
|
||||||
|
|
||||||
String suffix;
|
String suffix;
|
||||||
ICustomConfiguration customConfiguration = ClassRouter.getInstance(ClassRouter.PATH.CUSTOM_CONFIGURATION);
|
ICustomConfiguration customConfiguration = ClassRouter.getInstance(ClassRouter.PATH.CUSTOM_CONFIGURATION);
|
||||||
try {
|
try {
|
||||||
@@ -40,64 +45,67 @@ public class UpdatesManager {
|
|||||||
String currentDownloadUrl = "http://" + SettingsManager.i().getServer().getHost() + ":" + SettingsManager.i().getServer().getPort() + "/ems-api/wms/android-release" + suffix + ".apk";
|
String currentDownloadUrl = "http://" + SettingsManager.i().getServer().getHost() + ":" + SettingsManager.i().getServer().getPort() + "/ems-api/wms/android-release" + suffix + ".apk";
|
||||||
|
|
||||||
|
|
||||||
AppUpdater appUpdater = new AppUpdater(context)
|
AppUpdater appUpdater = new AppUpdater(mContext)
|
||||||
.setDisplay(Display.DIALOG)
|
.setDisplay(Display.DIALOG)
|
||||||
.setUpdateFrom(UpdateFrom.JSON)
|
.setUpdateFrom(UpdateFrom.JSON)
|
||||||
.setUpdateJSON(currentVersionUrl)
|
.setUpdateJSON(currentVersionUrl)
|
||||||
.setButtonDoNotShowAgain(null)
|
.setButtonDoNotShowAgain(null)
|
||||||
.setButtonUpdateClickListener((dialog, which) -> {
|
.setButtonUpdateClickListener((dialog, which) -> {
|
||||||
installAPK(context, currentDownloadUrl);
|
installAPK(currentDownloadUrl);
|
||||||
});
|
});
|
||||||
appUpdater.start();
|
appUpdater.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static void installAPK(Activity context, String downloadURL) {
|
private void installAPK(String downloadURL) {
|
||||||
|
|
||||||
String destination = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS) + "/";
|
String destination = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS) + "/";
|
||||||
String fileName = context.getResources().getString(R.string.app_name) + ".apk";
|
|
||||||
destination += fileName;
|
|
||||||
final Uri uri = Uri.parse("file://" + destination);
|
|
||||||
|
|
||||||
//Delete update file if exists
|
var progressDialog = DialogProgressView.newInstance("Download", null, false);
|
||||||
final File file = new File(destination);
|
progressDialog.show(mContext.getSupportFragmentManager(), "tag");
|
||||||
if (file.exists())
|
|
||||||
file.delete();
|
|
||||||
|
|
||||||
//set downloadmanager
|
|
||||||
DownloadManager.Request request = new DownloadManager.Request(Uri.parse(downloadURL));
|
|
||||||
request.setDescription(context.getString(R.string.notification_update_download));
|
|
||||||
request.setTitle(context.getString(R.string.app_name));
|
|
||||||
|
|
||||||
//set destination
|
var fileDownloader = new FileDownloader()
|
||||||
request.setDestinationUri(uri);
|
.setDestFolder(destination)
|
||||||
|
.setUrlString(downloadURL)
|
||||||
|
.setOnProgressUpdate(progress -> {
|
||||||
|
mContext.runOnUiThread(() -> {
|
||||||
|
progressDialog.setProgress(progress);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.setOnDownloadCompleted(destPath -> {
|
||||||
|
|
||||||
// get download service and enqueue file
|
mContext.runOnUiThread(() -> {
|
||||||
final DownloadManager manager = (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE);
|
progressDialog.dismiss();
|
||||||
manager.enqueue(request);
|
|
||||||
|
|
||||||
//set BroadcastReceiver to install app when .apk is downloaded
|
Uri fileLoc;
|
||||||
BroadcastReceiver onComplete = new BroadcastReceiver() {
|
Intent intent;
|
||||||
public void onReceive(Context ctxt, Intent i) {
|
|
||||||
|
|
||||||
Uri fileLoc;
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||||
Intent intent;
|
intent = new Intent(Intent.ACTION_INSTALL_PACKAGE);
|
||||||
|
fileLoc = GenericFileProvider.getUriForFile(mContext,
|
||||||
|
mContext.getApplicationContext().getPackageName() + ".core.update.GenericFileProvider",
|
||||||
|
new File(destPath));
|
||||||
|
} else {
|
||||||
|
intent = new Intent(Intent.ACTION_VIEW);
|
||||||
|
fileLoc = Uri.fromFile(new File(destPath));
|
||||||
|
}
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
intent.setDataAndType(fileLoc, "application/vnd.android.package-archive");
|
||||||
intent = new Intent(Intent.ACTION_INSTALL_PACKAGE);
|
intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
fileLoc = GenericFileProvider.getUriForFile(context, context.getApplicationContext().getPackageName() + ".core.update.GenericFileProvider", file);
|
|
||||||
} else {
|
|
||||||
intent = new Intent(Intent.ACTION_VIEW);
|
|
||||||
fileLoc = Uri.fromFile(file);
|
|
||||||
}
|
|
||||||
|
|
||||||
intent.setDataAndType(fileLoc, "application/vnd.android.package-archive");
|
mContext.startActivity(intent);
|
||||||
intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
});
|
||||||
|
|
||||||
context.startActivity(intent);
|
});
|
||||||
|
|
||||||
|
|
||||||
|
new Thread(() -> {
|
||||||
|
try {
|
||||||
|
fileDownloader.download();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
};
|
}).start();
|
||||||
|
|
||||||
//register receiver for when .apk download is compete
|
|
||||||
context.registerReceiver(onComplete, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,113 @@
|
|||||||
|
package it.integry.integrywmsnative.core.utility;
|
||||||
|
|
||||||
|
import android.webkit.URLUtil;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.net.HttpURLConnection;
|
||||||
|
import java.net.URL;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
|
|
||||||
|
public class FileDownloader {
|
||||||
|
|
||||||
|
private String urlString;
|
||||||
|
private String destFolder;
|
||||||
|
|
||||||
|
private RunnableArgs<Integer> onProgressUpdate;
|
||||||
|
private RunnableArgs<String> onDownloadCompleted;
|
||||||
|
|
||||||
|
|
||||||
|
public void download() throws Exception {
|
||||||
|
InputStream input = null;
|
||||||
|
OutputStream output = null;
|
||||||
|
HttpURLConnection connection = null;
|
||||||
|
String destPathFile;
|
||||||
|
|
||||||
|
try {
|
||||||
|
File direct = new File(destFolder);
|
||||||
|
if (!direct.exists()) {
|
||||||
|
direct.mkdirs();
|
||||||
|
}
|
||||||
|
|
||||||
|
URL url = new URL(urlString);
|
||||||
|
connection = (HttpURLConnection) url.openConnection();
|
||||||
|
connection.connect();
|
||||||
|
connection.setConnectTimeout(120 * 1000);
|
||||||
|
|
||||||
|
if (connection.getResponseCode() != HttpURLConnection.HTTP_OK)
|
||||||
|
throw new Exception("Server returned HTTP " + connection.getResponseCode() + " " + connection.getResponseMessage());
|
||||||
|
|
||||||
|
input = connection.getInputStream();
|
||||||
|
int totalBytesToDownload = connection.getContentLength();
|
||||||
|
int downloadedBytes = 0;
|
||||||
|
|
||||||
|
String title = URLUtil.guessFileName(String.valueOf(url), null, null);
|
||||||
|
|
||||||
|
destPathFile = destFolder + title;
|
||||||
|
|
||||||
|
if (new File(destPathFile).exists())
|
||||||
|
new File(destPathFile).delete();
|
||||||
|
|
||||||
|
output = new FileOutputStream(destPathFile);
|
||||||
|
|
||||||
|
byte[] buf = new byte[1024];
|
||||||
|
int len;
|
||||||
|
while ((len = input.read(buf)) > 0) {
|
||||||
|
output.write(buf, 0, len);
|
||||||
|
|
||||||
|
downloadedBytes += len;
|
||||||
|
if (onProgressUpdate != null)
|
||||||
|
onProgressUpdate.run((downloadedBytes * 100) / totalBytesToDownload);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw e;
|
||||||
|
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
if (output != null)
|
||||||
|
output.close();
|
||||||
|
if (input != null)
|
||||||
|
input.close();
|
||||||
|
} catch (IOException ignored) {
|
||||||
|
}
|
||||||
|
if (connection != null)
|
||||||
|
connection.disconnect();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (onDownloadCompleted != null) onDownloadCompleted.run(destPathFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getUrlString() {
|
||||||
|
return urlString;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FileDownloader setUrlString(String urlString) {
|
||||||
|
this.urlString = urlString;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDestFolder() {
|
||||||
|
return destFolder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FileDownloader setDestFolder(String destFolder) {
|
||||||
|
this.destFolder = destFolder;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FileDownloader setOnProgressUpdate(RunnableArgs<Integer> onProgressUpdate) {
|
||||||
|
this.onProgressUpdate = onProgressUpdate;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FileDownloader setOnDownloadCompleted(RunnableArgs<String> onDownloadCompleted) {
|
||||||
|
this.onDownloadCompleted = onDownloadCompleted;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
package it.integry.integrywmsnative.core.utility;
|
package it.integry.integrywmsnative.core.utility;
|
||||||
|
|
||||||
import android.app.Dialog;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
|
|
||||||
@@ -13,6 +12,7 @@ import com.orhanobut.logger.Logger;
|
|||||||
|
|
||||||
import it.integry.integrywmsnative.BuildConfig;
|
import it.integry.integrywmsnative.BuildConfig;
|
||||||
import it.integry.integrywmsnative.core.rest.CommonRESTException;
|
import it.integry.integrywmsnative.core.rest.CommonRESTException;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.DialogProgressView;
|
||||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||||
|
|
||||||
public class UtilityExceptions {
|
public class UtilityExceptions {
|
||||||
@@ -21,9 +21,9 @@ public class UtilityExceptions {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
public static void defaultException(Context context, Exception ex, Dialog progressDialog) {
|
public static void defaultException(Context context, Exception ex, DialogProgressView progressDialog) {
|
||||||
defaultException(context, ex);
|
defaultException(context, ex);
|
||||||
if (progressDialog != null) progressDialog.dismiss();
|
if (progressDialog != null && progressDialog.isVisible()) progressDialog.dismiss();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void defaultException(Context context, Exception ex) {
|
public static void defaultException(Context context, Exception ex) {
|
||||||
|
|||||||
@@ -8,7 +8,8 @@ public class UtilityFocus {
|
|||||||
|
|
||||||
public static void focusTextBox(Context context, EditText editTextToFocus) {
|
public static void focusTextBox(Context context, EditText editTextToFocus) {
|
||||||
editTextToFocus.requestFocus();
|
editTextToFocus.requestFocus();
|
||||||
|
editTextToFocus.setSelectAllOnFocus(true);
|
||||||
|
editTextToFocus.selectAll();
|
||||||
InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
|
InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||||
imm.showSoftInput(editTextToFocus, InputMethodManager.SHOW_IMPLICIT);
|
imm.showSoftInput(editTextToFocus, InputMethodManager.SHOW_IMPLICIT);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package it.integry.integrywmsnative.core.utility;
|
package it.integry.integrywmsnative.core.utility;
|
||||||
|
|
||||||
import com.google.android.gms.common.internal.service.Common;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.text.DecimalFormatSymbols;
|
import java.text.DecimalFormatSymbols;
|
||||||
|
|||||||
@@ -31,10 +31,13 @@ public class UtilityPosizione {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static MtbDepoPosizione getFromCache(String posizione) {
|
public static MtbDepoPosizione getFromCache(String posizione) {
|
||||||
List<MtbDepoPosizione> tmpList = Stream.of(SettingsManager.iDB().getAvailablePosizioni())
|
var availablePosizioni = SettingsManager.iDB().getAvailablePosizioni();
|
||||||
|
if(availablePosizioni == null) return null;
|
||||||
|
|
||||||
|
List<MtbDepoPosizione> tmpList = Stream.of(availablePosizioni)
|
||||||
.filter(x -> x.getPosizione().equalsIgnoreCase(posizione)).toList();
|
.filter(x -> x.getPosizione().equalsIgnoreCase(posizione)).toList();
|
||||||
|
|
||||||
if(tmpList != null && tmpList.size() > 0) return tmpList.get(0);
|
if(tmpList.size() > 0) return tmpList.get(0);
|
||||||
else return null;
|
else return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,25 +1,21 @@
|
|||||||
package it.integry.integrywmsnative.core.utility;
|
package it.integry.integrywmsnative.core.utility;
|
||||||
|
|
||||||
import android.app.Dialog;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import android.content.Context;
|
import androidx.fragment.app.FragmentActivity;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.view.dialogs.DialogProgress;
|
import it.integry.integrywmsnative.view.dialogs.DialogProgressView;
|
||||||
|
|
||||||
public class UtilityProgress {
|
public class UtilityProgress {
|
||||||
|
|
||||||
public static Dialog createDefaultProgressDialog(Context mContext) {
|
public static DialogProgressView createDefaultProgressDialog(FragmentActivity mContext) {
|
||||||
// final ProgressDialog progress = ProgressDialog.show(mContext, mContext.getText(R.string.waiting),
|
var progress = DialogProgressView.newInstance();
|
||||||
// mContext.getText(R.string.loading) + " ...", true);
|
progress.show(mContext.getSupportFragmentManager(), "tag");
|
||||||
//
|
|
||||||
// return progress;
|
|
||||||
|
|
||||||
Dialog progress = DialogProgress.make(mContext);
|
|
||||||
progress.show();
|
|
||||||
return progress;
|
return progress;
|
||||||
}
|
}
|
||||||
public static Dialog createDefaultProgressDialog(Context mContext,String subtitle) {
|
|
||||||
Dialog progress = DialogProgress.make(mContext,subtitle);
|
public static DialogProgressView createDefaultProgressDialog(AppCompatActivity mContext, String title, String subtitle) {
|
||||||
progress.show();
|
DialogProgressView progress = DialogProgressView.newInstance(title, subtitle, true);
|
||||||
|
progress.show(mContext.getSupportFragmentManager(), "tag");
|
||||||
return progress;
|
return progress;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ import it.integry.integrywmsnative.core.expansion.RunnableArgss;
|
|||||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||||
|
import it.integry.integrywmsnative.core.model.MtbTCol;
|
||||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||||
import it.integry.integrywmsnative.core.report.ReportManager;
|
import it.integry.integrywmsnative.core.report.ReportManager;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.PrinterRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.PrinterRESTConsumer;
|
||||||
@@ -72,9 +73,9 @@ import it.integry.integrywmsnative.view.bottom_sheet__lu_content.BottomSheetFrag
|
|||||||
import it.integry.integrywmsnative.view.bottom_sheet__lu_content.BottomSheetFragmentLUContentViewModel;
|
import it.integry.integrywmsnative.view.bottom_sheet__lu_content.BottomSheetFragmentLUContentViewModel;
|
||||||
import it.integry.integrywmsnative.view.dialogs.ask_should_versamento_automatico_ul.DialogAskShouldVersamentoAutomaticoULView;
|
import it.integry.integrywmsnative.view.dialogs.ask_should_versamento_automatico_ul.DialogAskShouldVersamentoAutomaticoULView;
|
||||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.info_aggiuntive_lu.InfoAggiuntiveLUDialog;
|
||||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2DTO;
|
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2DTO;
|
||||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2View;
|
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2View;
|
||||||
import it.integry.integrywmsnative.view.dialogs.note_aggiuntive_lu.NoteAggiuntiveLUDialog;
|
|
||||||
import it.integry.integrywmsnative.view.dialogs.versamento_automatico_ul_done.DialogVersamentoAutomaticoULDoneView;
|
import it.integry.integrywmsnative.view.dialogs.versamento_automatico_ul_done.DialogVersamentoAutomaticoULDoneView;
|
||||||
|
|
||||||
public class AccettazionePickingActivity extends BaseActivity implements AccettazionePickingViewModel.Listener, BottomSheetFragmentLUContentViewModel.Listener, BottomSheetFragmentLUContentView.Listener {
|
public class AccettazionePickingActivity extends BaseActivity implements AccettazionePickingViewModel.Listener, BottomSheetFragmentLUContentViewModel.Listener, BottomSheetFragmentLUContentView.Listener {
|
||||||
@@ -84,6 +85,9 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
|
|||||||
@Inject
|
@Inject
|
||||||
AccettazionePickingViewModel mViewModel;
|
AccettazionePickingViewModel mViewModel;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
DialogInputQuantityV2View mDialogInputQuantityV2View;
|
||||||
|
|
||||||
private final AccettazionePickingFiltroOrdineViewModel mAppliedFilterViewModel = new AccettazionePickingFiltroOrdineViewModel();
|
private final AccettazionePickingFiltroOrdineViewModel mAppliedFilterViewModel = new AccettazionePickingFiltroOrdineViewModel();
|
||||||
|
|
||||||
private BottomSheetFragmentLUContentViewModel mBottomSheetFragmentLUContentViewModel;
|
private BottomSheetFragmentLUContentViewModel mBottomSheetFragmentLUContentViewModel;
|
||||||
@@ -140,9 +144,14 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
|
|||||||
this.initFilters();
|
this.initFilters();
|
||||||
|
|
||||||
String codMdep = SettingsManager.i().getUserSession().getDepo().getCodMdep();
|
String codMdep = SettingsManager.i().getUserSession().getDepo().getCodMdep();
|
||||||
|
boolean useQtaOrd = SettingsManager.iDB().isFlagAccettazioneUseQtaOrd();
|
||||||
|
|
||||||
mViewModel.setListeners(this);
|
mViewModel.setListeners(this);
|
||||||
mViewModel.init(mOrders, mSitArts, codMdep);
|
mViewModel.init(
|
||||||
|
mOrders,
|
||||||
|
mSitArts,
|
||||||
|
codMdep,
|
||||||
|
useQtaOrd);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initFilters() {
|
private void initFilters() {
|
||||||
@@ -791,9 +800,9 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNoteAggiuntiveRequest(RunnableArgs<String> onComplete) {
|
public void onInfoAggiuntiveRequest(RunnableArgss<String, MtbTCol> onComplete) {
|
||||||
runOnUiThread(() -> {
|
runOnUiThread(() -> {
|
||||||
NoteAggiuntiveLUDialog.make(this, onComplete).show();
|
InfoAggiuntiveLUDialog.newInstance(onComplete).show(getSupportFragmentManager(), "InfoAggiuntiveLUDialog");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -832,8 +841,9 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
|
|||||||
.setCanLUBeClosed(true)
|
.setCanLUBeClosed(true)
|
||||||
.setCanOverflowOrderQuantity(canOverflowQuantity);
|
.setCanOverflowOrderQuantity(canOverflowQuantity);
|
||||||
|
|
||||||
DialogInputQuantityV2View
|
mDialogInputQuantityV2View
|
||||||
.newInstance(dialogInputQuantityV2DTO, (resultDTO, shouldCloseLU) -> {
|
.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
|
||||||
|
.setOnComplete((resultDTO, shouldCloseLU) -> {
|
||||||
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO()
|
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO()
|
||||||
.setNumCnf(resultDTO.getNumCnf())
|
.setNumCnf(resultDTO.getNumCnf())
|
||||||
.setQtaCnf(resultDTO.getQtaCnf())
|
.setQtaCnf(resultDTO.getQtaCnf())
|
||||||
@@ -841,9 +851,8 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
|
|||||||
.setPartitaMag(resultDTO.getPartitaMag())
|
.setPartitaMag(resultDTO.getPartitaMag())
|
||||||
.setDataScad(resultDTO.getDataScad());
|
.setDataScad(resultDTO.getDataScad());
|
||||||
onComplete.run(pickedQuantityDTO, shouldCloseLU);
|
onComplete.run(pickedQuantityDTO, shouldCloseLU);
|
||||||
}, () -> {
|
|
||||||
this.mViewModel.resetMatchedRows();
|
|
||||||
})
|
})
|
||||||
|
.setOnAbort(() -> this.mViewModel.resetMatchedRows())
|
||||||
.show(getSupportFragmentManager(), "tag");
|
.show(getSupportFragmentManager(), "tag");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ 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.model.MtbTCol;
|
||||||
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.rest.consumers.ArticoloRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||||
@@ -72,6 +73,7 @@ public class AccettazionePickingViewModel {
|
|||||||
|
|
||||||
private List<OrdineAccettazioneInevasoDTO> mOrders;
|
private List<OrdineAccettazioneInevasoDTO> mOrders;
|
||||||
private List<SitArtOrdDTO> mSitArts;
|
private List<SitArtOrdDTO> mSitArts;
|
||||||
|
private boolean mUseQtaOrd;
|
||||||
private final MutableLiveData<List<PickingObjectDTO>> mPickingList = new MutableLiveData<>();
|
private final MutableLiveData<List<PickingObjectDTO>> mPickingList = new MutableLiveData<>();
|
||||||
|
|
||||||
private MtbColt mCurrentMtbColt = null;
|
private MtbColt mCurrentMtbColt = null;
|
||||||
@@ -96,9 +98,10 @@ public class AccettazionePickingViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void init(List<OrdineAccettazioneInevasoDTO> orders, List<SitArtOrdDTO> sitArts, String codMdep) {
|
public void init(List<OrdineAccettazioneInevasoDTO> orders, List<SitArtOrdDTO> sitArts, String codMdep, boolean useQtaOrd) {
|
||||||
this.mOrders = orders;
|
this.mOrders = orders;
|
||||||
this.mDefaultCodMdep = codMdep;
|
this.mDefaultCodMdep = codMdep;
|
||||||
|
this.mUseQtaOrd = useQtaOrd;
|
||||||
|
|
||||||
this.mSitArts = Stream.of(sitArts)
|
this.mSitArts = Stream.of(sitArts)
|
||||||
.filter(x -> UtilityBigDecimal.greaterThan(x.getNumCnfDaEvadere(), BigDecimal.ZERO) && UtilityBigDecimal.greaterThan(x.getQtaDaEvadere(), BigDecimal.ZERO))
|
.filter(x -> UtilityBigDecimal.greaterThan(x.getNumCnfDaEvadere(), BigDecimal.ZERO) && UtilityBigDecimal.greaterThan(x.getQtaDaEvadere(), BigDecimal.ZERO))
|
||||||
@@ -359,7 +362,7 @@ public class AccettazionePickingViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void createNewLU(Integer customNumCollo, String customSerCollo, boolean disablePrint, Runnable onComplete) {
|
public void createNewLU(Integer customNumCollo, String customSerCollo, boolean disablePrint, Runnable onComplete) {
|
||||||
this.sendOnNoteAggiuntiveRequest(additionalNotes -> {
|
this.sendOnInfoAggiuntiveRequest((additionalNotes, tCol) -> {
|
||||||
|
|
||||||
this.mGestSetupRESTConsumer.getValue("PICKING", "SETUP", "DEFAULT_POSIZIONE_COLLI_ACCETTAZIONE", defaultPosAccettazioneDTO -> {
|
this.mGestSetupRESTConsumer.getValue("PICKING", "SETUP", "DEFAULT_POSIZIONE_COLLI_ACCETTAZIONE", defaultPosAccettazioneDTO -> {
|
||||||
|
|
||||||
@@ -375,6 +378,11 @@ public class AccettazionePickingViewModel {
|
|||||||
.setPosizione(defaultPosAccettazione)
|
.setPosizione(defaultPosAccettazione)
|
||||||
.setOperation(CommonModelConsts.OPERATION.INSERT_OR_UPDATE);
|
.setOperation(CommonModelConsts.OPERATION.INSERT_OR_UPDATE);
|
||||||
|
|
||||||
|
if (tCol != null) {
|
||||||
|
mtbColt.setCodTcol(tCol.getCodTcol());
|
||||||
|
mtbColt.setMtbTCol(tCol);
|
||||||
|
}
|
||||||
|
|
||||||
if (customNumCollo != null) {
|
if (customNumCollo != null) {
|
||||||
mtbColt.setNumCollo(customNumCollo);
|
mtbColt.setNumCollo(customNumCollo);
|
||||||
}
|
}
|
||||||
@@ -530,7 +538,9 @@ public class AccettazionePickingViewModel {
|
|||||||
initialQtaTot = totalQtaOrd;
|
initialQtaTot = totalQtaOrd;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (UtilityBigDecimal.greaterThan(pickingObjectDTO.getMtbAart().getColliPedana(), BigDecimal.ZERO) && UtilityBigDecimal.greaterThan(initialNumCnf, pickingObjectDTO.getMtbAart().getColliPedana())) {
|
if (!this.mUseQtaOrd &&
|
||||||
|
UtilityBigDecimal.greaterThan(pickingObjectDTO.getMtbAart().getColliPedana(), BigDecimal.ZERO) &&
|
||||||
|
UtilityBigDecimal.greaterThan(initialNumCnf, pickingObjectDTO.getMtbAart().getColliPedana())) {
|
||||||
initialNumCnf = pickingObjectDTO.getMtbAart().getColliPedana();
|
initialNumCnf = pickingObjectDTO.getMtbAart().getColliPedana();
|
||||||
initialQtaTot = initialNumCnf.multiply(initialQtaCnf);
|
initialQtaTot = initialNumCnf.multiply(initialQtaCnf);
|
||||||
}
|
}
|
||||||
@@ -896,8 +906,8 @@ public class AccettazionePickingViewModel {
|
|||||||
if (this.mListener != null) this.mListener.onVersamentoAutomaticoULRequest(onComplete);
|
if (this.mListener != null) this.mListener.onVersamentoAutomaticoULRequest(onComplete);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendOnNoteAggiuntiveRequest(RunnableArgs<String> onComplete) {
|
private void sendOnInfoAggiuntiveRequest(RunnableArgss<String, MtbTCol> onComplete) {
|
||||||
if (this.mListener != null) this.mListener.onNoteAggiuntiveRequest(onComplete);
|
if (this.mListener != null) this.mListener.onInfoAggiuntiveRequest(onComplete);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendError(Exception ex) {
|
private void sendError(Exception ex) {
|
||||||
@@ -990,7 +1000,7 @@ public class AccettazionePickingViewModel {
|
|||||||
|
|
||||||
void onVersamentoAutomaticoULRequest(RunnableArgs<Boolean> onComplete);
|
void onVersamentoAutomaticoULRequest(RunnableArgs<Boolean> onComplete);
|
||||||
|
|
||||||
void onNoteAggiuntiveRequest(RunnableArgs<String> onComplete);
|
void onInfoAggiuntiveRequest(RunnableArgss<String, MtbTCol> onComplete);
|
||||||
|
|
||||||
void onError(Exception ex);
|
void onError(Exception ex);
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,85 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.contab_doc_interni.dto;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColr;
|
||||||
|
import it.integry.integrywmsnative.core.di.BindableBoolean;
|
||||||
|
|
||||||
|
public class DialogChooseRowFromListaDocRowsListModel {
|
||||||
|
|
||||||
|
private String codMart;
|
||||||
|
private String descrizione;
|
||||||
|
private String qtaOrdReadable;
|
||||||
|
private String barcode;
|
||||||
|
private boolean isNew;
|
||||||
|
private SqlMtbColr originalModel;
|
||||||
|
private BindableBoolean checked = new BindableBoolean(false);
|
||||||
|
|
||||||
|
public DialogChooseRowFromListaDocRowsListModel() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public BindableBoolean getChecked() {
|
||||||
|
return checked;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DialogChooseRowFromListaDocRowsListModel setChecked(BindableBoolean checked) {
|
||||||
|
this.checked = checked;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void toggleCheck() {
|
||||||
|
this.checked.set(!this.checked.get());
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCodMart() {
|
||||||
|
return codMart;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DialogChooseRowFromListaDocRowsListModel setCodMart(String codMart) {
|
||||||
|
this.codMart = codMart;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescrizione() {
|
||||||
|
return descrizione;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DialogChooseRowFromListaDocRowsListModel setDescrizione(String descrizione) {
|
||||||
|
this.descrizione = descrizione;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getQtaOrdReadable() {
|
||||||
|
return qtaOrdReadable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DialogChooseRowFromListaDocRowsListModel setQtaOrdReadable(String qtaOrdReadable) {
|
||||||
|
this.qtaOrdReadable = qtaOrdReadable;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBarcode() {
|
||||||
|
return barcode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DialogChooseRowFromListaDocRowsListModel setBarcode(String barcode) {
|
||||||
|
this.barcode = barcode;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isNew() {
|
||||||
|
return isNew;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DialogChooseRowFromListaDocRowsListModel setNew(boolean aNew) {
|
||||||
|
isNew = aNew;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SqlMtbColr getOriginalModel() {
|
||||||
|
return originalModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DialogChooseRowFromListaDocRowsListModel setOriginalModel(SqlMtbColr originalModel) {
|
||||||
|
this.originalModel = originalModel;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -14,6 +14,7 @@ public class GrigliaAcquistiChildDTO {
|
|||||||
public String flagQtaMultipla;
|
public String flagQtaMultipla;
|
||||||
public String flagTracciabilita;
|
public String flagTracciabilita;
|
||||||
public BigDecimal qtaMinOrdinabile;
|
public BigDecimal qtaMinOrdinabile;
|
||||||
|
public boolean newNoPromo;
|
||||||
private int ggScadenza;
|
private int ggScadenza;
|
||||||
private float giacenza;
|
private float giacenza;
|
||||||
private float qtaPrevistaVendita;
|
private float qtaPrevistaVendita;
|
||||||
@@ -144,4 +145,13 @@ public class GrigliaAcquistiChildDTO {
|
|||||||
this.qtaProposta = qtaProposta;
|
this.qtaProposta = qtaProposta;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isNewNoPromo() {
|
||||||
|
return newNoPromo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GrigliaAcquistiChildDTO setNewNoPromo(boolean newNoPromo) {
|
||||||
|
this.newNoPromo = newNoPromo;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ import it.integry.integrywmsnative.core.utility.UtilityDate;
|
|||||||
import it.integry.integrywmsnative.databinding.ActivityContabDocInterniEditBinding;
|
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.GrigliaAcquistiChildDTO;
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.GrigliaAcquistiDTO;
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.GrigliaAcquistiDTO;
|
||||||
|
import it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.dialog.selectDocRows.DialogSelectDocRowsView;
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.ui.DocumentRowsListAdapter;
|
import it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.ui.DocumentRowsListAdapter;
|
||||||
import it.integry.integrywmsnative.ui.FabMenuCustomAnimations;
|
import it.integry.integrywmsnative.ui.FabMenuCustomAnimations;
|
||||||
import it.integry.integrywmsnative.view.bottom_sheet__mtb_colr_edit.BottomSheetMtbColrEditView;
|
import it.integry.integrywmsnative.view.bottom_sheet__mtb_colr_edit.BottomSheetMtbColrEditView;
|
||||||
@@ -54,9 +55,13 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
|||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
MtbColrRepository documentRowsRepository;
|
MtbColrRepository documentRowsRepository;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
DocInterniEditFormViewModel viewModel;
|
DocInterniEditFormViewModel viewModel;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
DialogInputQuantityV2View dialogInputQuantityV2View;
|
||||||
|
|
||||||
|
|
||||||
private int mBarcodeScannerIstanceID;
|
private int mBarcodeScannerIstanceID;
|
||||||
private ActivityContabDocInterniEditBinding binding;
|
private ActivityContabDocInterniEditBinding binding;
|
||||||
@@ -133,6 +138,7 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initViewModel(SqlMtbColt document, List<GrigliaAcquistiChildDTO> productList) {
|
private void initViewModel(SqlMtbColt document, List<GrigliaAcquistiChildDTO> productList) {
|
||||||
|
this.viewModel.init();
|
||||||
this.viewModel.setListeners(this);
|
this.viewModel.setListeners(this);
|
||||||
this.viewModel.setDocument(document);
|
this.viewModel.setDocument(document);
|
||||||
this.viewModel.setProductsList(productList);
|
this.viewModel.setProductsList(productList);
|
||||||
@@ -209,6 +215,7 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEditRowRequest(SqlMtbColr row, boolean flagTracciabilita) {
|
public void onEditRowRequest(SqlMtbColr row, boolean flagTracciabilita) {
|
||||||
|
this.onLoadingStarted();
|
||||||
MtbAart mtbAart = new MtbAart();
|
MtbAart mtbAart = new MtbAart();
|
||||||
mtbAart.setBarCode(row.getCodBarre());
|
mtbAart.setBarCode(row.getCodBarre());
|
||||||
mtbAart.setDiacod(row.getCodBarre());
|
mtbAart.setDiacod(row.getCodBarre());
|
||||||
@@ -242,12 +249,12 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
|||||||
}
|
}
|
||||||
return partitaMag;
|
return partitaMag;
|
||||||
});
|
});
|
||||||
|
dialogInputQuantityV2View.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
|
||||||
DialogInputQuantityV2View
|
.setOnComplete((resultDTO, shouldCloseLU) -> {
|
||||||
.newInstance(dialogInputQuantityV2DTO, (resultDTO, shouldCloseLU) -> {
|
|
||||||
this.onLoadingStarted();
|
this.onLoadingStarted();
|
||||||
this.viewModel.saveRow(row, resultDTO);
|
this.viewModel.saveRow(row, resultDTO);
|
||||||
}, this::onLoadingEnded)
|
})
|
||||||
|
.setOnAbort(this::onLoadingEnded)
|
||||||
.show(getSupportFragmentManager(), "tag");
|
.show(getSupportFragmentManager(), "tag");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -280,6 +287,16 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
|||||||
this.viewModel.deleteRow(entityToSql(mtbColr));
|
this.viewModel.deleteRow(entityToSql(mtbColr));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onMultipleRowsFound(List<SqlMtbColr> rows, GrigliaAcquistiChildDTO articolo) {
|
||||||
|
DialogSelectDocRowsView.newInstance(rows, (row) -> {
|
||||||
|
this.onLoadingEnded();
|
||||||
|
if (row != null) {
|
||||||
|
this.viewModel.editRow(row, (articolo.getFlagTracciabilita().equalsIgnoreCase("S")));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
).show(this.getSupportFragmentManager(), "dialogSelectDocRows");
|
||||||
|
}
|
||||||
|
|
||||||
private MtbColr sqlToEntity(SqlMtbColr sqlMtbColr) {
|
private MtbColr sqlToEntity(SqlMtbColr sqlMtbColr) {
|
||||||
MtbColr entity = new MtbColr();
|
MtbColr entity = new MtbColr();
|
||||||
|
|||||||
@@ -4,6 +4,10 @@ import androidx.lifecycle.MutableLiveData;
|
|||||||
|
|
||||||
import com.annimon.stream.Stream;
|
import com.annimon.stream.Stream;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.json.JSONException;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -16,6 +20,7 @@ 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.MtbColrRepository;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.repository.MtbColtRepository;
|
import it.integry.integrywmsnative.core.data_store.db.repository.MtbColtRepository;
|
||||||
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
|
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
|
||||||
|
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.gest.contab_doc_interni.dto.ArtDTO;
|
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.ColloDTO;
|
||||||
@@ -33,7 +38,8 @@ public class DocInterniEditFormViewModel {
|
|||||||
private final DocInterniRESTConsumer docInterniRESTConsumer;
|
private final DocInterniRESTConsumer docInterniRESTConsumer;
|
||||||
private DocInterniEditFormViewModel.Listener listener;
|
private DocInterniEditFormViewModel.Listener listener;
|
||||||
private List<GrigliaAcquistiChildDTO> productsList;
|
private List<GrigliaAcquistiChildDTO> productsList;
|
||||||
|
private boolean isCheckPartitaMag = false;
|
||||||
|
private JSONObject checkFornitoreRules = null;
|
||||||
public MutableLiveData<SqlMtbColt> document = new MutableLiveData<>();
|
public MutableLiveData<SqlMtbColt> document = new MutableLiveData<>();
|
||||||
public MutableLiveData<List<SqlMtbColr>> docRows = new MutableLiveData<>();
|
public MutableLiveData<List<SqlMtbColr>> docRows = new MutableLiveData<>();
|
||||||
|
|
||||||
@@ -45,6 +51,16 @@ public class DocInterniEditFormViewModel {
|
|||||||
this.docRows.setValue(new ArrayList<>());
|
this.docRows.setValue(new ArrayList<>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void init() {
|
||||||
|
try {
|
||||||
|
var docInterniCheckFornitore = SettingsManager.iDB().getDocInterniCheckFornitore();
|
||||||
|
this.checkFornitoreRules = docInterniCheckFornitore != null ? new JSONObject(docInterniCheckFornitore) : null;
|
||||||
|
} catch (JSONException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void sendOnLoadingStarted() {
|
private void sendOnLoadingStarted() {
|
||||||
if (this.listener != null) listener.onLoadingStarted();
|
if (this.listener != null) listener.onLoadingStarted();
|
||||||
}
|
}
|
||||||
@@ -68,8 +84,8 @@ public class DocInterniEditFormViewModel {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void editRow(SqlMtbColr row,boolean flagTracciabilita) {
|
public void editRow(SqlMtbColr row, boolean flagTracciabilita) {
|
||||||
this.listener.onEditRowRequest(row,flagTracciabilita);
|
this.listener.onEditRowRequest(row, flagTracciabilita && this.isCheckPartitaMag);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Integer getNextIdRiga() {
|
private Integer getNextIdRiga() {
|
||||||
@@ -91,7 +107,8 @@ public class DocInterniEditFormViewModel {
|
|||||||
}, this::sendError);
|
}, this::sendError);
|
||||||
}, this::sendError);
|
}, this::sendError);
|
||||||
}
|
}
|
||||||
public void deleteDocument() {
|
|
||||||
|
public void deleteDocument() {
|
||||||
this.sendOnLoadingStarted();
|
this.sendOnLoadingStarted();
|
||||||
docInterniRESTConsumer.saveDoc(this.getSaveDto(), obj -> {
|
docInterniRESTConsumer.saveDoc(this.getSaveDto(), obj -> {
|
||||||
SqlMtbColt document = this.getDocument();
|
SqlMtbColt document = this.getDocument();
|
||||||
@@ -108,47 +125,55 @@ public void deleteDocument() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onSearch(String search) {
|
public void onSearch(String search) {
|
||||||
this.sendOnLoadingStarted();
|
|
||||||
GrigliaAcquistiChildDTO articolo = this.searchArticolo(search);
|
GrigliaAcquistiChildDTO articolo = this.searchArticolo(search);
|
||||||
if (articolo == null) {
|
if (articolo == null) {
|
||||||
this.sendError(new Exception("Nessun articolo corrispondente al codice fornito!"));
|
this.sendError(new Exception("Nessun articolo corrispondente al codice fornito!"));
|
||||||
this.sendOnLoadingEnded();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
SqlMtbColr row = this.getRowForArticolo(articolo);
|
List<SqlMtbColr> rows = this.getRowsForArticolo(articolo);
|
||||||
this.sendOnLoadingEnded();
|
if (rows.isEmpty()) {
|
||||||
this.editRow(row,articolo.getFlagTracciabilita().equalsIgnoreCase("S"));
|
this.sendError(new Exception("Nessun articolo corrispondente al codice fornito!"));
|
||||||
|
}
|
||||||
|
if (rows.size() > 1) {
|
||||||
|
this.listener.onMultipleRowsFound(rows, articolo);
|
||||||
|
} else {
|
||||||
|
this.editRow(rows.get(0), (articolo.getFlagTracciabilita().equalsIgnoreCase("S")));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private SqlMtbColr getRowForArticolo(GrigliaAcquistiChildDTO articolo) {
|
private List<SqlMtbColr> getRowsForArticolo(GrigliaAcquistiChildDTO articolo) {
|
||||||
List<SqlMtbColr> docRows = this.docRows.getValue();
|
List<SqlMtbColr> docRows = this.docRows.getValue();
|
||||||
if (docRows == null) {
|
if (docRows == null) {
|
||||||
docRows = new ArrayList<>();
|
docRows = new ArrayList<>();
|
||||||
}
|
}
|
||||||
SqlMtbColt document = this.document.getValue();
|
SqlMtbColt document = this.document.getValue();
|
||||||
SqlMtbColr row = Stream.of(docRows).filter(docRow -> docRow.getCodMart().equalsIgnoreCase(articolo.getCodMart())).findFirstOrElse(null);
|
SqlMtbColr row = new SqlMtbColr();
|
||||||
if (row == null) {
|
row.setIdCollo(document.getId());
|
||||||
row = new SqlMtbColr();
|
row.setRiga(getNextIdRiga());
|
||||||
row.setIdCollo(document.getId());
|
row.setCodMart(articolo.getCodMart());
|
||||||
row.setRiga(getNextIdRiga());
|
row.setSerCollo(document.getSerCollo());
|
||||||
row.setCodMart(articolo.getCodMart());
|
row.setGestione(document.getGestione());
|
||||||
row.setSerCollo(document.getSerCollo());
|
row.setNumCollo(document.getNumCollo());
|
||||||
row.setGestione(document.getGestione());
|
row.setDataCollo(document.getDataCollo());
|
||||||
row.setNumCollo(document.getNumCollo());
|
row.setDescrizione(articolo.getDescrizione());
|
||||||
row.setDataCollo(document.getDataCollo());
|
row.setUntMis(articolo.getUntMis());
|
||||||
row.setDescrizione(articolo.getDescrizione());
|
row.setCodBarre(articolo.getBarcode());
|
||||||
row.setUntMis(articolo.getUntMis());
|
row.setQtaCnf(articolo.getQtaCnf().floatValue());
|
||||||
row.setCodBarre(articolo.getBarcode());
|
row.setNumCnf(0f);
|
||||||
row.setQtaCnf(articolo.getQtaCnf().floatValue());
|
row.setQtaCol(0f);
|
||||||
row.setNumCnf(0f);
|
List<SqlMtbColr> rows = Stream.of(docRows).filter(docRow -> docRow.getCodMart().equalsIgnoreCase(articolo.getCodMart())).toList();
|
||||||
row.setQtaCol(0f);
|
rows.add(row);
|
||||||
}
|
return rows;
|
||||||
return row;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private GrigliaAcquistiChildDTO searchArticolo(String filter) {
|
private GrigliaAcquistiChildDTO searchArticolo(String filter) {
|
||||||
return Stream.of(this.productsList).filter(dto -> filter.equalsIgnoreCase(dto.getCodMart()) || filter.equalsIgnoreCase(dto.getBarcode())).findFirstOrElse(null);
|
return Stream.of(this.productsList).filter(dto ->
|
||||||
|
filter.equalsIgnoreCase(dto.getCodMart())
|
||||||
|
|| filter.equalsIgnoreCase(dto.getBarcode())
|
||||||
|
|| StringUtils.leftPad(filter, 13, '0').equalsIgnoreCase(dto.getCodMart())
|
||||||
|
|| StringUtils.leftPad(filter, 13, '0').equalsIgnoreCase(dto.getBarcode())
|
||||||
|
).findFirstOrElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private SaveDTO getSaveDto() {
|
private SaveDTO getSaveDto() {
|
||||||
@@ -200,6 +225,26 @@ public void deleteDocument() {
|
|||||||
|
|
||||||
public void setDocument(SqlMtbColt document) {
|
public void setDocument(SqlMtbColt document) {
|
||||||
this.document.setValue(document);
|
this.document.setValue(document);
|
||||||
|
this.initCheckFornitore();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initCheckFornitore() {
|
||||||
|
SqlMtbColt doc = this.document.getValue();
|
||||||
|
boolean isCheckPartitaMag = false;
|
||||||
|
if (doc != null && this.checkFornitoreRules != null) {
|
||||||
|
String key = doc.getCodAnag();
|
||||||
|
if (doc.getCodVdes() != null && !doc.getCodVdes().isEmpty()) {
|
||||||
|
key += "-" + doc.getCodVdes();
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
if (this.checkFornitoreRules.has(key) && ((String) ((JSONObject) this.checkFornitoreRules.get(key)).get(doc.getCodDtipProvv())).equalsIgnoreCase("check-partitaMag")) {
|
||||||
|
isCheckPartitaMag = true;
|
||||||
|
}
|
||||||
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
this.isCheckPartitaMag = isCheckPartitaMag;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SqlMtbColt getDocument() {
|
public SqlMtbColt getDocument() {
|
||||||
@@ -251,7 +296,7 @@ public void deleteDocument() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public GrigliaAcquistiChildDTO getArticoloByCodMart(String codMart) {
|
public GrigliaAcquistiChildDTO getArticoloByCodMart(String codMart) {
|
||||||
return Stream.of(productsList).filter(prod->prod.codMart.equalsIgnoreCase(codMart)).findFirstOrElse(null);
|
return Stream.of(productsList).filter(prod -> prod.codMart.equalsIgnoreCase(codMart)).findFirstOrElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface Listener extends ILoadingListener {
|
public interface Listener extends ILoadingListener {
|
||||||
@@ -260,7 +305,9 @@ public void deleteDocument() {
|
|||||||
|
|
||||||
void onRowsChanged(List<SqlMtbColr> rows);
|
void onRowsChanged(List<SqlMtbColr> rows);
|
||||||
|
|
||||||
void onEditRowRequest(SqlMtbColr row,boolean flagTracciabilita);
|
void onEditRowRequest(SqlMtbColr row, boolean flagTracciabilita);
|
||||||
|
|
||||||
|
void onMultipleRowsFound(List<SqlMtbColr> rows, GrigliaAcquistiChildDTO articolo);
|
||||||
|
|
||||||
void onDocumentHoldRequest();
|
void onDocumentHoldRequest();
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.dialog.selectDocRows;
|
||||||
|
|
||||||
|
import dagger.Subcomponent;
|
||||||
|
|
||||||
|
@Subcomponent
|
||||||
|
public interface DialogSelectDocRowsComponent {
|
||||||
|
|
||||||
|
@Subcomponent.Factory
|
||||||
|
interface Factory {
|
||||||
|
DialogSelectDocRowsComponent create();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void inject(DialogSelectDocRowsView dialogSelectDocInfoView);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.dialog.selectDocRows;
|
||||||
|
|
||||||
|
import dagger.Module;
|
||||||
|
|
||||||
|
@Module(subcomponents = DialogSelectDocRowsComponent.class)
|
||||||
|
public class DialogSelectDocRowsModule {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,143 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.dialog.selectDocRows;
|
||||||
|
|
||||||
|
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 androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.databinding.DataBindingUtil;
|
||||||
|
import androidx.lifecycle.MutableLiveData;
|
||||||
|
|
||||||
|
import com.annimon.stream.Stream;
|
||||||
|
import com.ravikoradiya.liveadapter.LiveAdapter;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.BR;
|
||||||
|
import it.integry.integrywmsnative.MainApplication;
|
||||||
|
import it.integry.integrywmsnative.R;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColr;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
|
import it.integry.integrywmsnative.databinding.DialogChooseRowFromListaDocRowsLayoutBinding;
|
||||||
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.DialogChooseRowFromListaDocRowsListModel;
|
||||||
|
import kotlin.Unit;
|
||||||
|
|
||||||
|
public class DialogSelectDocRowsView extends BaseDialogFragment {
|
||||||
|
|
||||||
|
private final RunnableArgs<SqlMtbColr> onRowSelected;
|
||||||
|
private final List<SqlMtbColr> listArts;
|
||||||
|
private final MutableLiveData<List<DialogChooseRowFromListaDocRowsListModel>> listModels = new MutableLiveData<>();
|
||||||
|
private DialogChooseRowFromListaDocRowsLayoutBinding binding;
|
||||||
|
public MutableLiveData<SqlMtbColr> selectedRow = new MutableLiveData<>();
|
||||||
|
|
||||||
|
public static DialogSelectDocRowsView newInstance(
|
||||||
|
List<SqlMtbColr> listArts,
|
||||||
|
RunnableArgs<SqlMtbColr> onDismiss
|
||||||
|
) {
|
||||||
|
return new DialogSelectDocRowsView(listArts, onDismiss);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private DialogSelectDocRowsView(List<SqlMtbColr> listArts, RunnableArgs<SqlMtbColr> onDismiss) {
|
||||||
|
super();
|
||||||
|
this.onRowSelected = onDismiss;
|
||||||
|
this.listArts = listArts;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDismiss(@NonNull DialogInterface dialog) {
|
||||||
|
super.onDismiss(dialog);
|
||||||
|
if (onRowSelected != null) onRowSelected.run(this.selectedRow.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
|
binding = DataBindingUtil.inflate(inflater, R.layout.dialog_choose_row_from_lista_doc_rows_layout, container, false);
|
||||||
|
binding.setLifecycleOwner(this);
|
||||||
|
MainApplication
|
||||||
|
.appComponent
|
||||||
|
.dialogSelectDocRowsComponent()
|
||||||
|
.create()
|
||||||
|
.inject(this);
|
||||||
|
binding.setView(this);
|
||||||
|
|
||||||
|
getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
|
||||||
|
getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||||
|
initView();
|
||||||
|
this.refreshList();
|
||||||
|
|
||||||
|
|
||||||
|
binding.positiveButton.setOnClickListener(view -> {
|
||||||
|
getDialog().dismiss();
|
||||||
|
});
|
||||||
|
|
||||||
|
binding.negativeButton.setOnClickListener(view -> {
|
||||||
|
this.selectedRow.setValue(null);
|
||||||
|
getDialog().dismiss();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
this.onLoadingEnded();
|
||||||
|
return binding.getRoot();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshList() {
|
||||||
|
var list = Stream.of(this.listArts).map(row -> {
|
||||||
|
DialogChooseRowFromListaDocRowsListModel model = new DialogChooseRowFromListaDocRowsListModel();
|
||||||
|
model.setCodMart(row.getCodMart());
|
||||||
|
model.setBarcode(row.getCodMart());
|
||||||
|
model.setOriginalModel(row);
|
||||||
|
model.setNew(row.getId() < 1);
|
||||||
|
model.setDescrizione(row.getDescrizione());
|
||||||
|
model.setQtaOrdReadable(row.getQtaCol() + "\n" + row.getUntMis());
|
||||||
|
model.getChecked().addOnPropertyChangedCallback(() -> {
|
||||||
|
this.checkRow(row, model.getChecked().get());
|
||||||
|
});
|
||||||
|
return model;
|
||||||
|
}).toList();
|
||||||
|
this.listModels.postValue(list);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void checkRow(SqlMtbColr row, boolean checked) {
|
||||||
|
if (checked) {
|
||||||
|
this.selectedRow.setValue(row);
|
||||||
|
var models = this.listModels.getValue();
|
||||||
|
if (models != null && !models.isEmpty()) {
|
||||||
|
Stream.of(models).filter(model -> model.getOriginalModel().getId() != row.getId()).forEach(model -> {
|
||||||
|
model.getChecked().set(false);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
var selectedRow = this.selectedRow.getValue();
|
||||||
|
if (selectedRow != null && selectedRow.getId() == row.getId()) {
|
||||||
|
this.selectedRow.setValue(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initView() {
|
||||||
|
initArrayAdapters();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initArrayAdapters() {
|
||||||
|
|
||||||
|
new LiveAdapter(listModels, getViewLifecycleOwner(), BR.row)
|
||||||
|
.map(DialogChooseRowFromListaDocRowsListModel.class, R.layout.dialog_choose_row_from_lista_doc_rows__item_model)
|
||||||
|
.onNoData(noData -> {
|
||||||
|
binding.emptyView.setVisibility(noData ? View.VISIBLE : View.GONE);
|
||||||
|
return Unit.INSTANCE;
|
||||||
|
}
|
||||||
|
).into(binding.listaDocRows);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -67,6 +67,9 @@ public class MainActivity extends BaseActivity
|
|||||||
@Inject
|
@Inject
|
||||||
MainContext mainContext;
|
MainContext mainContext;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
UpdatesManager updatesManager;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@@ -79,7 +82,7 @@ public class MainActivity extends BaseActivity
|
|||||||
mBinding = DataBindingUtil.inflate(LayoutInflater.from(this), R.layout.activity_main, null, false);
|
mBinding = DataBindingUtil.inflate(LayoutInflater.from(this), R.layout.activity_main, null, false);
|
||||||
setContentView(mBinding.getRoot());
|
setContentView(mBinding.getRoot());
|
||||||
|
|
||||||
UpdatesManager.init(this);
|
updatesManager.init(this);
|
||||||
UtilityContext.initMainActivity(this);
|
UtilityContext.initMainActivity(this);
|
||||||
|
|
||||||
setSupportActionBar(mBinding.appBarMain.toolbar);
|
setSupportActionBar(mBinding.appBarMain.toolbar);
|
||||||
|
|||||||
@@ -138,6 +138,7 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
|
|||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
|
super.onCreateView(inflater, container, savedInstanceState);
|
||||||
|
|
||||||
mBindings = DataBindingUtil.inflate(inflater, R.layout.fragment_main_ordini_uscita, container, false);
|
mBindings = DataBindingUtil.inflate(inflater, R.layout.fragment_main_ordini_uscita, container, false);
|
||||||
|
|
||||||
|
|||||||
@@ -69,6 +69,9 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
|
|||||||
@Inject
|
@Inject
|
||||||
PickingLiberoViewModel mViewModel;
|
PickingLiberoViewModel mViewModel;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
DialogInputQuantityV2View mDialogInputQuantityV2View;
|
||||||
|
|
||||||
public BindableBoolean thereIsAnOpenedUL = new BindableBoolean(false);
|
public BindableBoolean thereIsAnOpenedUL = new BindableBoolean(false);
|
||||||
public BindableBoolean thereIsntAnOpenedUL = new BindableBoolean(true);
|
public BindableBoolean thereIsntAnOpenedUL = new BindableBoolean(true);
|
||||||
public BindableBoolean thereIsAnyRowInUL = new BindableBoolean(false);
|
public BindableBoolean thereIsAnyRowInUL = new BindableBoolean(false);
|
||||||
@@ -155,6 +158,8 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
|
|||||||
barcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
barcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
||||||
.setOnScanSuccessfull(onScanSuccessful)
|
.setOnScanSuccessfull(onScanSuccessful)
|
||||||
.setOnScanFailed(ex -> UtilityExceptions.defaultException(getActivity(), ex, false)));
|
.setOnScanFailed(ex -> UtilityExceptions.defaultException(getActivity(), ex, false)));
|
||||||
|
|
||||||
|
BarcodeManager.enable();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initBottomSheet() {
|
private void initBottomSheet() {
|
||||||
@@ -199,10 +204,7 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
|
|||||||
};
|
};
|
||||||
|
|
||||||
public void createNewLU() {
|
public void createNewLU() {
|
||||||
this.onLoadingStarted();
|
|
||||||
|
|
||||||
this.mViewModel.createNewLU(null, null, () -> {
|
this.mViewModel.createNewLU(null, null, () -> {
|
||||||
this.onLoadingEnded();
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -227,7 +229,7 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLUOpened(MtbColt mtbColt) {
|
public void onLUOpened(MtbColt mtbColt) {
|
||||||
getActivity().runOnUiThread(() -> {
|
requireActivity().runOnUiThread(() -> {
|
||||||
mToolbarTitleText.setText(String.format(getActivity().getText(R.string.lu_number_text).toString(), mtbColt.getNumCollo()));
|
mToolbarTitleText.setText(String.format(getActivity().getText(R.string.lu_number_text).toString(), mtbColt.getNumCollo()));
|
||||||
|
|
||||||
initAdapter();
|
initAdapter();
|
||||||
@@ -248,7 +250,7 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLUClosed() {
|
public void onLUClosed() {
|
||||||
getActivity().runOnUiThread(() -> {
|
requireActivity().runOnUiThread(() -> {
|
||||||
mToolbarTitleText.setText(getActivity().getText(R.string.free_picking_title_fragment).toString());
|
mToolbarTitleText.setText(getActivity().getText(R.string.free_picking_title_fragment).toString());
|
||||||
destroyAdapter();
|
destroyAdapter();
|
||||||
|
|
||||||
@@ -289,9 +291,9 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onArtSelectionRequest(List<MtbColr> mtbColrsToPick, RunnableArgs<List<MtbColr>> onComplete, Runnable onAbort) {
|
public void onArtSelectionRequest(List<MtbColr> mtbColrsToPick, MtbAart mtbAart, RunnableArgs<List<MtbColr>> onComplete, Runnable onAbort) {
|
||||||
DialogChooseArtsFromListaArts
|
DialogChooseArtsFromListaArts
|
||||||
.newInstance(mtbColrsToPick, onComplete, () -> {
|
.newInstance(mtbColrsToPick, mtbAart, onComplete, () -> {
|
||||||
onAbort.run();
|
onAbort.run();
|
||||||
BarcodeManager.enable();
|
BarcodeManager.enable();
|
||||||
})
|
})
|
||||||
@@ -335,8 +337,8 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
|
|||||||
.setCanPartitaMagBeChanged(canPartitaMagBeChanged)
|
.setCanPartitaMagBeChanged(canPartitaMagBeChanged)
|
||||||
.setCanLUBeClosed(canLUBeClosed);
|
.setCanLUBeClosed(canLUBeClosed);
|
||||||
|
|
||||||
DialogInputQuantityV2View
|
mDialogInputQuantityV2View.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
|
||||||
.newInstance(dialogInputQuantityV2DTO, (resultDTO, shouldCloseLU) -> {
|
.setOnComplete((resultDTO, shouldCloseLU) -> {
|
||||||
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO()
|
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO()
|
||||||
.setNumCnf(resultDTO.getNumCnf())
|
.setNumCnf(resultDTO.getNumCnf())
|
||||||
.setQtaCnf(resultDTO.getQtaCnf())
|
.setQtaCnf(resultDTO.getQtaCnf())
|
||||||
@@ -346,15 +348,14 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
|
|||||||
|
|
||||||
this.openProgress();
|
this.openProgress();
|
||||||
onComplete.run(pickedQuantityDTO, shouldCloseLU);
|
onComplete.run(pickedQuantityDTO, shouldCloseLU);
|
||||||
}, () -> {
|
|
||||||
this.closeProgress();
|
|
||||||
})
|
})
|
||||||
.show(getActivity().getSupportFragmentManager(), "tag");
|
.setOnAbort(this::closeProgress)
|
||||||
|
.show(requireActivity().getSupportFragmentManager(), "tag");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRowSaved() {
|
public void onRowSaved() {
|
||||||
getActivity().runOnUiThread(() -> {
|
requireActivity().runOnUiThread(() -> {
|
||||||
FBToast.successToast(getActivity(), getResources().getString(R.string.data_saved), FBToast.LENGTH_SHORT);
|
FBToast.successToast(getActivity(), getResources().getString(R.string.data_saved), FBToast.LENGTH_SHORT);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -99,6 +99,7 @@ public class PickingLiberoViewModel {
|
|||||||
} else if (UtilityBarcode.isEtichettaPosizione(barcodeScanDTO)) {
|
} else if (UtilityBarcode.isEtichettaPosizione(barcodeScanDTO)) {
|
||||||
//Cerco tramite etichetta un collo in posizione mono ul
|
//Cerco tramite etichetta un collo in posizione mono ul
|
||||||
this.executeEtichettaPosizione(barcodeScanDTO, onComplete);
|
this.executeEtichettaPosizione(barcodeScanDTO, onComplete);
|
||||||
|
|
||||||
} else if (UtilityBarcode.isEtichetta128(barcodeScanDTO)) {
|
} else if (UtilityBarcode.isEtichetta128(barcodeScanDTO)) {
|
||||||
//Cerco tramite etichetta ean 128 (che può indicarmi una UL)
|
//Cerco tramite etichetta ean 128 (che può indicarmi una UL)
|
||||||
this.executeEtichettaEan128(barcodeScanDTO, onComplete);
|
this.executeEtichettaEan128(barcodeScanDTO, onComplete);
|
||||||
@@ -134,7 +135,7 @@ public class PickingLiberoViewModel {
|
|||||||
}
|
}
|
||||||
} else if (mtbColtList.size() == 1) {
|
} else if (mtbColtList.size() == 1) {
|
||||||
this.mColliMagazzinoRESTConsumer.getByTestata(mtbColtList.get(0), true, false, mtbColt -> {
|
this.mColliMagazzinoRESTConsumer.getByTestata(mtbColtList.get(0), true, false, mtbColt -> {
|
||||||
pickMerceULtoUL(mtbColt, onComplete);
|
pickMerceULtoUL(mtbColt, articolo, onComplete);
|
||||||
}, this::sendError);
|
}, this::sendError);
|
||||||
} else {
|
} else {
|
||||||
this.sendError(new TooManyLUFoundInMonoLUPositionException());
|
this.sendError(new TooManyLUFoundInMonoLUPositionException());
|
||||||
@@ -208,11 +209,14 @@ public class PickingLiberoViewModel {
|
|||||||
if (mtbAartList != null && mtbAartList.size() > 0) {
|
if (mtbAartList != null && mtbAartList.size() > 0) {
|
||||||
MtbAart articolo = mtbAartList.get(0);
|
MtbAart articolo = mtbAartList.get(0);
|
||||||
MtbDepoPosizione posizione = UtilityPosizione.getFromCache(articolo.getPosizione());
|
MtbDepoPosizione posizione = UtilityPosizione.getFromCache(articolo.getPosizione());
|
||||||
|
|
||||||
if (posizione != null && posizione.isFlagMonoCollo()) {
|
if (posizione != null && posizione.isFlagMonoCollo()) {
|
||||||
this.executePosizione(posizione, articolo, onComplete);
|
this.executePosizione(posizione, articolo, onComplete);
|
||||||
} else {
|
} else if(mDefaultGestione == GestioneEnum.VENDITA){
|
||||||
this.dispatchArt(articolo, ean128Model);
|
this.dispatchArt(articolo, ean128Model);
|
||||||
onComplete.run();
|
onComplete.run();
|
||||||
|
} else {
|
||||||
|
this.sendError(new NoResultFromBarcodeException());
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -225,7 +229,6 @@ public class PickingLiberoViewModel {
|
|||||||
|
|
||||||
public void createNewLU(Integer customNumCollo, String customSerCollo, Runnable onComplete) {
|
public void createNewLU(Integer customNumCollo, String customSerCollo, Runnable onComplete) {
|
||||||
if (this.mFlagAskCliente) {
|
if (this.mFlagAskCliente) {
|
||||||
this.sendOnLoadingEnded();
|
|
||||||
this.sendLUClienteRequired((vtbDest, codJcom) -> {
|
this.sendLUClienteRequired((vtbDest, codJcom) -> {
|
||||||
createNewLU_PostClienteAsk(customNumCollo, customSerCollo, vtbDest, codJcom, onComplete);
|
createNewLU_PostClienteAsk(customNumCollo, customSerCollo, vtbDest, codJcom, onComplete);
|
||||||
}, () -> {
|
}, () -> {
|
||||||
@@ -272,6 +275,8 @@ public class PickingLiberoViewModel {
|
|||||||
|
|
||||||
this.mCurrentMtbColt = mtbColt;
|
this.mCurrentMtbColt = mtbColt;
|
||||||
|
|
||||||
|
this.sendOnLoadingEnded();
|
||||||
|
|
||||||
if (onComplete != null) onComplete.run();
|
if (onComplete != null) onComplete.run();
|
||||||
this.sendLUOpened(mtbColt);
|
this.sendLUOpened(mtbColt);
|
||||||
}, this::sendError);
|
}, this::sendError);
|
||||||
@@ -382,13 +387,16 @@ public class PickingLiberoViewModel {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void pickMerceULtoUL(MtbColt sourceMtbColt, Runnable onComplete) {
|
private void pickMerceULtoUL(MtbColt sourceMtbColt, Runnable onComplete) {
|
||||||
|
pickMerceULtoUL(sourceMtbColt, null, onComplete);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void pickMerceULtoUL(MtbColt sourceMtbColt, MtbAart mtbAart, Runnable onComplete) {
|
||||||
List<MtbColr> mtbColrsToPick = Stream.of(sourceMtbColt.getMtbColr())
|
List<MtbColr> mtbColrsToPick = Stream.of(sourceMtbColt.getMtbColr())
|
||||||
.filter(x -> UtilityBigDecimal.greaterThan(x.getQtaCol(), BigDecimal.ZERO))
|
.filter(x -> UtilityBigDecimal.greaterThan(x.getQtaCol(), BigDecimal.ZERO))
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
this.sendArtSelectionRequest(mtbColrsToPick, pickedAarts -> {
|
this.sendArtSelectionRequest(mtbColrsToPick, mtbAart, pickedAarts -> {
|
||||||
List<MtbColr> destNewMtbColr = new ArrayList<>();
|
List<MtbColr> destNewMtbColr = new ArrayList<>();
|
||||||
|
|
||||||
if (pickedAarts.size() > 0) {
|
if (pickedAarts.size() > 0) {
|
||||||
@@ -809,9 +817,9 @@ public class PickingLiberoViewModel {
|
|||||||
if (this.mListener != null) mListener.onLUClienteRequired(onComplete, onAbort);
|
if (this.mListener != null) mListener.onLUClienteRequired(onComplete, onAbort);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendArtSelectionRequest(List<MtbColr> mtbColrsToPick, RunnableArgs<List<MtbColr>> onComplete, Runnable onAbort) {
|
private void sendArtSelectionRequest(List<MtbColr> mtbColrsToPick, MtbAart mtbAart, RunnableArgs<List<MtbColr>> onComplete, Runnable onAbort) {
|
||||||
if (this.mListener != null)
|
if (this.mListener != null)
|
||||||
mListener.onArtSelectionRequest(mtbColrsToPick, onComplete, onAbort);
|
mListener.onArtSelectionRequest(mtbColrsToPick, mtbAart, onComplete, onAbort);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendOnItemDispatched(PickingObjectDTO pickingObjectDTO,
|
private void sendOnItemDispatched(PickingObjectDTO pickingObjectDTO,
|
||||||
@@ -865,7 +873,7 @@ public class PickingLiberoViewModel {
|
|||||||
|
|
||||||
void onLUClienteRequired(RunnableArgss<VtbDest, String> onComplete, Runnable onAbort);
|
void onLUClienteRequired(RunnableArgss<VtbDest, String> onComplete, Runnable onAbort);
|
||||||
|
|
||||||
void onArtSelectionRequest(List<MtbColr> mtbColrsToPick, RunnableArgs<List<MtbColr>> onComplete, Runnable onAbort);
|
void onArtSelectionRequest(List<MtbColr> mtbColrsToPick, MtbAart mtbAart, RunnableArgs<List<MtbColr>> onComplete, Runnable onAbort);
|
||||||
|
|
||||||
void onItemDispatched(PickingObjectDTO pickingObjectDTO,
|
void onItemDispatched(PickingObjectDTO pickingObjectDTO,
|
||||||
MtbAart mtbAart,
|
MtbAart mtbAart,
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ import it.integry.integrywmsnative.core.expansion.RunnableArgss;
|
|||||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||||
|
import it.integry.integrywmsnative.core.model.MtbTCol;
|
||||||
import it.integry.integrywmsnative.core.rest.model.DocumentoResoDTO;
|
import it.integry.integrywmsnative.core.rest.model.DocumentoResoDTO;
|
||||||
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;
|
||||||
@@ -42,18 +43,18 @@ import it.integry.integrywmsnative.core.utility.UtilityResources;
|
|||||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityToast;
|
import it.integry.integrywmsnative.core.utility.UtilityToast;
|
||||||
import it.integry.integrywmsnative.databinding.ActivityPickingResiBinding;
|
import it.integry.integrywmsnative.databinding.ActivityPickingResiBinding;
|
||||||
|
import it.integry.integrywmsnative.gest.picking_resi.rest.WithdrawableDtbDocr;
|
||||||
import it.integry.integrywmsnative.gest.picking_resi.ui.PickingResiListAdapter;
|
import it.integry.integrywmsnative.gest.picking_resi.ui.PickingResiListAdapter;
|
||||||
import it.integry.integrywmsnative.gest.picking_resi.ui.PickingResiListModel;
|
import it.integry.integrywmsnative.gest.picking_resi.ui.PickingResiListModel;
|
||||||
import it.integry.integrywmsnative.gest.picking_resi.rest.WithdrawableDtbDocr;
|
|
||||||
import it.integry.integrywmsnative.gest.spedizione.exceptions.InvalidPesoKGException;
|
import it.integry.integrywmsnative.gest.spedizione.exceptions.InvalidPesoKGException;
|
||||||
import it.integry.integrywmsnative.gest.spedizione.model.PickedQuantityDTO;
|
import it.integry.integrywmsnative.gest.spedizione.model.PickedQuantityDTO;
|
||||||
import it.integry.integrywmsnative.view.bottom_sheet__lu_content.BottomSheetFragmentLUContentView;
|
import it.integry.integrywmsnative.view.bottom_sheet__lu_content.BottomSheetFragmentLUContentView;
|
||||||
import it.integry.integrywmsnative.view.bottom_sheet__lu_content.BottomSheetFragmentLUContentViewModel;
|
import it.integry.integrywmsnative.view.bottom_sheet__lu_content.BottomSheetFragmentLUContentViewModel;
|
||||||
import it.integry.integrywmsnative.view.dialogs.ask_should_print.DialogAskShouldPrint;
|
import it.integry.integrywmsnative.view.dialogs.ask_should_print.DialogAskShouldPrint;
|
||||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.info_aggiuntive_lu.InfoAggiuntiveLUDialog;
|
||||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2DTO;
|
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2DTO;
|
||||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2View;
|
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2View;
|
||||||
import it.integry.integrywmsnative.view.dialogs.note_aggiuntive_lu.NoteAggiuntiveLUDialog;
|
|
||||||
|
|
||||||
public class PickingResiActivity extends BaseActivity implements BottomSheetFragmentLUContentView.Listener, BottomSheetFragmentLUContentViewModel.Listener, PickingResiViewModel.Listener {
|
public class PickingResiActivity extends BaseActivity implements BottomSheetFragmentLUContentView.Listener, BottomSheetFragmentLUContentViewModel.Listener, PickingResiViewModel.Listener {
|
||||||
|
|
||||||
@@ -63,6 +64,9 @@ public class PickingResiActivity extends BaseActivity implements BottomSheetFrag
|
|||||||
@Inject
|
@Inject
|
||||||
PickingResiViewModel mViewmodel;
|
PickingResiViewModel mViewmodel;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
DialogInputQuantityV2View mDialogInputQuantityV2View;
|
||||||
|
|
||||||
private BottomSheetFragmentLUContentViewModel mBottomSheetFragmentLUContentViewModel;
|
private BottomSheetFragmentLUContentViewModel mBottomSheetFragmentLUContentViewModel;
|
||||||
|
|
||||||
private ObservableArrayList<PickingResiListModel> mPickingResiMutableData = new ObservableArrayList<>();
|
private ObservableArrayList<PickingResiListModel> mPickingResiMutableData = new ObservableArrayList<>();
|
||||||
@@ -276,15 +280,15 @@ public class PickingResiActivity extends BaseActivity implements BottomSheetFrag
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNoteAggiuntiveRequired(RunnableArgs<String> onComplete) {
|
public void onInfoAggiuntiveRequired(RunnableArgss<String, MtbTCol> onComplete) {
|
||||||
NoteAggiuntiveLUDialog.make(this, onComplete).show();
|
InfoAggiuntiveLUDialog.newInstance(onComplete).show(getSupportFragmentManager(), "InfoAggiuntiveLUDialog");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(Exception ex) {
|
public void onError(Exception ex) {
|
||||||
this.closeProgress();
|
this.closeProgress();
|
||||||
|
|
||||||
if(ex instanceof InvalidPesoKGException) {
|
if (ex instanceof InvalidPesoKGException) {
|
||||||
UtilityToast.showToast(ex.getMessage());
|
UtilityToast.showToast(ex.getMessage());
|
||||||
} else {
|
} else {
|
||||||
UtilityExceptions.defaultException(this, ex, mCurrentProgress);
|
UtilityExceptions.defaultException(this, ex, mCurrentProgress);
|
||||||
@@ -318,8 +322,9 @@ public class PickingResiActivity extends BaseActivity implements BottomSheetFrag
|
|||||||
.setCanLUBeClosed(false)
|
.setCanLUBeClosed(false)
|
||||||
.setCanPartitaMagBeChanged(false);
|
.setCanPartitaMagBeChanged(false);
|
||||||
|
|
||||||
DialogInputQuantityV2View
|
mDialogInputQuantityV2View
|
||||||
.newInstance(dialogInputQuantityV2DTO, (resultDTO, shouldCloseLU) -> {
|
.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
|
||||||
|
.setOnComplete((resultDTO, shouldCloseLU) -> {
|
||||||
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO()
|
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO()
|
||||||
.setNumCnf(resultDTO.getNumCnf())
|
.setNumCnf(resultDTO.getNumCnf())
|
||||||
.setQtaCnf(resultDTO.getQtaCnf())
|
.setQtaCnf(resultDTO.getQtaCnf())
|
||||||
@@ -329,7 +334,8 @@ public class PickingResiActivity extends BaseActivity implements BottomSheetFrag
|
|||||||
|
|
||||||
this.openProgress();
|
this.openProgress();
|
||||||
onComplete.run(pickedQuantityDTO, shouldCloseLU);
|
onComplete.run(pickedQuantityDTO, shouldCloseLU);
|
||||||
}, () -> {
|
})
|
||||||
|
.setOnAbort(() -> {
|
||||||
this.mViewmodel.resetMatchedRows();
|
this.mViewmodel.resetMatchedRows();
|
||||||
})
|
})
|
||||||
.show(getSupportFragmentManager(), "tag");
|
.show(getSupportFragmentManager(), "tag");
|
||||||
@@ -401,7 +407,7 @@ public class PickingResiActivity extends BaseActivity implements BottomSheetFrag
|
|||||||
null,
|
null,
|
||||||
R.string.button_ignore_print,
|
R.string.button_ignore_print,
|
||||||
onComplete)
|
onComplete)
|
||||||
.show(getSupportFragmentManager(), "tag");
|
.show(getSupportFragmentManager(), "tag");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ 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.model.MtbTCol;
|
||||||
import it.integry.integrywmsnative.core.model.dto.PickDataDTO;
|
import it.integry.integrywmsnative.core.model.dto.PickDataDTO;
|
||||||
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;
|
||||||
@@ -161,11 +162,16 @@ public class PickingResiViewModel {
|
|||||||
this.sendOnLoadingEnded();
|
this.sendOnLoadingEnded();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.sendOnNoteAggiuntiveRequired(noteAggiuntive -> {
|
this.sendOnInfoAggiuntiveRequired((noteAggiuntive, tCol) -> {
|
||||||
|
|
||||||
if (!UtilityString.isNullOrEmpty(noteAggiuntive)) {
|
if (!UtilityString.isNullOrEmpty(noteAggiuntive)) {
|
||||||
this.mCurrentMtbColt.setAnnotazioni(noteAggiuntive);
|
this.mCurrentMtbColt.setAnnotazioni(noteAggiuntive);
|
||||||
}
|
}
|
||||||
|
if (tCol != null) {
|
||||||
|
this.mCurrentMtbColt.setCodTcol(tCol.getCodTcol());
|
||||||
|
this.mCurrentMtbColt.setMtbTCol(tCol);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
this.mColliMagazzinoRESTConsumer.updateDataFine(mCurrentMtbColt, () -> {
|
this.mColliMagazzinoRESTConsumer.updateDataFine(mCurrentMtbColt, () -> {
|
||||||
|
|
||||||
@@ -717,8 +723,8 @@ public class PickingResiViewModel {
|
|||||||
return mPickingList;
|
return mPickingList;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendOnNoteAggiuntiveRequired(RunnableArgs<String> onComplete) {
|
private void sendOnInfoAggiuntiveRequired(RunnableArgss<String, MtbTCol> onComplete) {
|
||||||
if (this.mListener != null) this.mListener.onNoteAggiuntiveRequired(onComplete);
|
if (this.mListener != null) this.mListener.onInfoAggiuntiveRequired(onComplete);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendOnLoadingStarted() {
|
private void sendOnLoadingStarted() {
|
||||||
@@ -795,7 +801,7 @@ public class PickingResiViewModel {
|
|||||||
|
|
||||||
public interface Listener extends ILUPrintListener, ILoadingListener, ILUBaseOperationsListener {
|
public interface Listener extends ILUPrintListener, ILoadingListener, ILUBaseOperationsListener {
|
||||||
|
|
||||||
void onNoteAggiuntiveRequired(RunnableArgs<String> onComplete);
|
void onInfoAggiuntiveRequired(RunnableArgss<String, MtbTCol> onComplete);
|
||||||
|
|
||||||
void onError(Exception ex);
|
void onError(Exception ex);
|
||||||
|
|
||||||
|
|||||||
@@ -53,6 +53,9 @@ public class ProdRecuperoMaterialeFragment extends BaseFragment implements ITitl
|
|||||||
@Inject
|
@Inject
|
||||||
ProdRecuperoMaterialeViewModel mViewModel;
|
ProdRecuperoMaterialeViewModel mViewModel;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
DialogInputQuantityV2View mDialogInputQuantityV2View;
|
||||||
|
|
||||||
private FragmentProdRecuperoMaterialeBinding mBinding;
|
private FragmentProdRecuperoMaterialeBinding mBinding;
|
||||||
|
|
||||||
private int barcodeScannerIstanceID = -1;
|
private int barcodeScannerIstanceID = -1;
|
||||||
@@ -200,8 +203,9 @@ public class ProdRecuperoMaterialeFragment extends BaseFragment implements ITitl
|
|||||||
.setCanOverflowOrderQuantity(canOverflowOrderQuantity)
|
.setCanOverflowOrderQuantity(canOverflowOrderQuantity)
|
||||||
.setCanLUBeClosed(canLUBeClosed);
|
.setCanLUBeClosed(canLUBeClosed);
|
||||||
|
|
||||||
DialogInputQuantityV2View
|
mDialogInputQuantityV2View
|
||||||
.newInstance(dialogInputQuantityV2DTO, (resultDTO, shouldCloseLU) -> {
|
.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
|
||||||
|
.setOnComplete((resultDTO, shouldCloseLU) -> {
|
||||||
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO()
|
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO()
|
||||||
.setNumCnf(resultDTO.getNumCnf())
|
.setNumCnf(resultDTO.getNumCnf())
|
||||||
.setQtaCnf(resultDTO.getQtaCnf())
|
.setQtaCnf(resultDTO.getQtaCnf())
|
||||||
@@ -210,7 +214,8 @@ public class ProdRecuperoMaterialeFragment extends BaseFragment implements ITitl
|
|||||||
.setDataScad(resultDTO.getDataScad());
|
.setDataScad(resultDTO.getDataScad());
|
||||||
|
|
||||||
this.mViewModel.onItemDispatched(item, pickedQuantityDTO, sourceMtbColt);
|
this.mViewModel.onItemDispatched(item, pickedQuantityDTO, sourceMtbColt);
|
||||||
}, this::onLoadingEnded)
|
})
|
||||||
|
.setOnAbort(this::onLoadingEnded)
|
||||||
.show(requireActivity().getSupportFragmentManager(), "tag");
|
.show(requireActivity().getSupportFragmentManager(), "tag");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ public class ProdRientroMerceOrderDetailRESTConsumer extends _BaseRESTConsumer {
|
|||||||
}.getType();
|
}.getType();
|
||||||
systemRESTConsumer.<List<MtbColt>>processSql(mtbColtSql, mtbColtTypeOfObjectsList, mtbColtList -> {
|
systemRESTConsumer.<List<MtbColt>>processSql(mtbColtSql, mtbColtTypeOfObjectsList, mtbColtList -> {
|
||||||
|
|
||||||
if(mtbColtList == null) mtbColtList = new ArrayList<>();
|
if (mtbColtList == null) mtbColtList = new ArrayList<>();
|
||||||
|
|
||||||
for (MtbColt mtbColt : mtbColtList) {
|
for (MtbColt mtbColt : mtbColtList) {
|
||||||
|
|
||||||
@@ -108,23 +108,21 @@ public class ProdRientroMerceOrderDetailRESTConsumer extends _BaseRESTConsumer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void importColloDaProduzione(ImportColliDaProduzioneRequestDTO importColliDaProduzioneRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
public void importColloDaProduzione(ImportColliDaProduzioneRequestDTO importColliDaProduzioneRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
|
|
||||||
ProdRientroMerceOrderDetailRESTConsumerService service = RESTBuilder.getService(ProdRientroMerceOrderDetailRESTConsumerService.class);
|
ProdRientroMerceOrderDetailRESTConsumerService service = RESTBuilder.getService(ProdRientroMerceOrderDetailRESTConsumerService.class);
|
||||||
service.importColloDaProduzione(importColliDaProduzioneRequestDTO).enqueue(new Callback<ServiceRESTResponse<MtbColt>>() {
|
service.importColloDaProduzione(importColliDaProduzioneRequestDTO).enqueue(new Callback<ServiceRESTResponse<List<MtbColt>>>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call<ServiceRESTResponse<MtbColt>> call, Response<ServiceRESTResponse<MtbColt>> response) {
|
public void onResponse(Call<ServiceRESTResponse<List<MtbColt>>> call, Response<ServiceRESTResponse<List<MtbColt>>> response) {
|
||||||
analyzeAnswer(response, "importColliDaProduzione", mtbColt -> {
|
analyzeAnswer(response, "importColliDaProduzione", mtbColt -> {
|
||||||
onComplete.run(mtbColt);
|
onComplete.run(mtbColt.get(0));
|
||||||
}, ex -> {
|
}, ex -> {
|
||||||
if(onFailed != null) onFailed.run(ex);
|
if (onFailed != null) onFailed.run(ex);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Call<ServiceRESTResponse<MtbColt>> call, Throwable t) {
|
public void onFailure(Call<ServiceRESTResponse<List<MtbColt>>> call, Throwable t) {
|
||||||
Logger.e(t, "importColliDaProduzione");
|
Logger.e(t, "importColliDaProduzione");
|
||||||
onFailed.run(new Exception(t));
|
onFailed.run(new Exception(t));
|
||||||
}
|
}
|
||||||
@@ -140,7 +138,7 @@ public class ProdRientroMerceOrderDetailRESTConsumer extends _BaseRESTConsumer {
|
|||||||
analyzeAnswer(response, "deleteColloDaProduzione", mtbColt -> {
|
analyzeAnswer(response, "deleteColloDaProduzione", mtbColt -> {
|
||||||
onComplete.run();
|
onComplete.run();
|
||||||
}, ex -> {
|
}, ex -> {
|
||||||
if(onFailed != null) onFailed.run(ex);
|
if (onFailed != null) onFailed.run(ex);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,10 +13,10 @@ public interface ProdRientroMerceOrderDetailRESTConsumerService {
|
|||||||
|
|
||||||
|
|
||||||
@POST("importColliDaProduzioneJson")
|
@POST("importColliDaProduzioneJson")
|
||||||
Call<ServiceRESTResponse<MtbColt>> importColliDaProduzione(@Body List<ImportColliDaProduzioneRequestDTO> importColliDaProduzioneRequestDTO);
|
Call<ServiceRESTResponse<List<MtbColt>>> importColliDaProduzione(@Body List<ImportColliDaProduzioneRequestDTO> importColliDaProduzioneRequestDTO);
|
||||||
|
|
||||||
@POST("importColloDaProduzioneJson")
|
@POST("importColloDaProduzioneJson")
|
||||||
Call<ServiceRESTResponse<MtbColt>> importColloDaProduzione(@Body ImportColliDaProduzioneRequestDTO importColloDaProduzioneRequestDTO);
|
Call<ServiceRESTResponse<List<MtbColt>>> importColloDaProduzione(@Body ImportColliDaProduzioneRequestDTO importColloDaProduzioneRequestDTO);
|
||||||
|
|
||||||
@POST("cancellaColloDaProduzione")
|
@POST("cancellaColloDaProduzione")
|
||||||
Call<ServiceRESTResponse<Object>> deleteColloDaProduzione(@Body MtbColt mtbColtToDelete);
|
Call<ServiceRESTResponse<Object>> deleteColloDaProduzione(@Body MtbColt mtbColtToDelete);
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ import androidx.core.content.ContextCompat;
|
|||||||
import androidx.databinding.DataBindingUtil;
|
import androidx.databinding.DataBindingUtil;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
|
||||||
|
import com.annimon.stream.Stream;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -32,6 +34,7 @@ import it.integry.integrywmsnative.core.data_store.db.repository.GrigliaReposito
|
|||||||
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.expansion.BaseActivity;
|
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.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.databinding.ActivityPvOrdineAcquistoEditBinding;
|
import it.integry.integrywmsnative.databinding.ActivityPvOrdineAcquistoEditBinding;
|
||||||
@@ -65,7 +68,7 @@ public class PVOrdineAcquistoEditActivity extends BaseActivity {
|
|||||||
ArticoloGrigliaRepository mArticoloGrigliaRepository;
|
ArticoloGrigliaRepository mArticoloGrigliaRepository;
|
||||||
|
|
||||||
|
|
||||||
public static Intent newInstance(Context context, Ordine ordine){
|
public static Intent newInstance(Context context, Ordine ordine) {
|
||||||
Intent myIntent = new Intent(context, PVOrdineAcquistoEditActivity.class);
|
Intent myIntent = new Intent(context, PVOrdineAcquistoEditActivity.class);
|
||||||
String keyOrdine = DataCache.addItem(ordine);
|
String keyOrdine = DataCache.addItem(ordine);
|
||||||
myIntent.putExtra(DATA_KEY_ORDER, keyOrdine);
|
myIntent.putExtra(DATA_KEY_ORDER, keyOrdine);
|
||||||
@@ -110,6 +113,7 @@ public class PVOrdineAcquistoEditActivity extends BaseActivity {
|
|||||||
.setOnScanFailed(this::handleException));
|
.setOnScanFailed(this::handleException));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onSupportNavigateUp() {
|
public boolean onSupportNavigateUp() {
|
||||||
@@ -159,6 +163,7 @@ public class PVOrdineAcquistoEditActivity extends BaseActivity {
|
|||||||
|
|
||||||
private void handleException(Exception ex) {
|
private void handleException(Exception ex) {
|
||||||
runOnUiThread(() -> {
|
runOnUiThread(() -> {
|
||||||
|
this.closeProgress();
|
||||||
BarcodeManager.enable();
|
BarcodeManager.enable();
|
||||||
UtilityExceptions.defaultException(this, ex, false);
|
UtilityExceptions.defaultException(this, ex, false);
|
||||||
});
|
});
|
||||||
@@ -198,6 +203,32 @@ public class PVOrdineAcquistoEditActivity extends BaseActivity {
|
|||||||
fetchArticoli();
|
fetchArticoli();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void orderNewProducts() {
|
||||||
|
this.openProgress();
|
||||||
|
mhelper.getNewArticoli(mOrdine.getIdGriglia(), articoli -> {
|
||||||
|
if (articoli != null && !articoli.isEmpty()) {
|
||||||
|
List<ArticoloOrdine> articoliToSave = new ArrayList<>();
|
||||||
|
Stream.of(articoli).forEach(articolo -> {
|
||||||
|
if (
|
||||||
|
Stream.of(mArticoli).filter(x -> x.getCodMart().equalsIgnoreCase(articolo.getCodMart())).findFirst().isEmpty()
|
||||||
|
&& Stream.of(articoliToSave).filter(x -> x.getCodMart().equalsIgnoreCase(articolo.getCodMart())).findFirst().isEmpty()
|
||||||
|
) {
|
||||||
|
ArticoloOrdine dto = articolo.convertToArticoloOrdine(mOrdine);
|
||||||
|
dto.setQtaOrd(dto.getQtaCnf());
|
||||||
|
articoliToSave.add(dto);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (!articoliToSave.isEmpty()) {
|
||||||
|
mhelper.saveArticoliToOrdine(articoliToSave, this::fetchArticoli, this::handleException);
|
||||||
|
} else {
|
||||||
|
this.closeProgress();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.closeProgress();
|
||||||
|
}
|
||||||
|
}, this::handleException);
|
||||||
|
}
|
||||||
|
|
||||||
private void fetchGriglia() {
|
private void fetchGriglia() {
|
||||||
mhelper.loadGriglia(mOrdine.getIdGriglia(), griglia -> {
|
mhelper.loadGriglia(mOrdine.getIdGriglia(), griglia -> {
|
||||||
runOnUiThread(() -> {
|
runOnUiThread(() -> {
|
||||||
@@ -218,6 +249,9 @@ public class PVOrdineAcquistoEditActivity extends BaseActivity {
|
|||||||
mBinding.pvOrdineExport.setVisibility(mArticoli.size() > 0 ? View.INVISIBLE : View.GONE);
|
mBinding.pvOrdineExport.setVisibility(mArticoli.size() > 0 ? View.INVISIBLE : View.GONE);
|
||||||
mBinding.closeActivityFab.close(false);
|
mBinding.closeActivityFab.close(false);
|
||||||
mBinding.scanArtSpinner.setVisibility(mArticoli.size() > 0 ? View.GONE : View.VISIBLE);
|
mBinding.scanArtSpinner.setVisibility(mArticoli.size() > 0 ? View.GONE : View.VISIBLE);
|
||||||
|
if (mArticoli.isEmpty() && isOrderNewProdsForced()) {
|
||||||
|
orderNewProducts();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}, this::handleException);
|
}, this::handleException);
|
||||||
}
|
}
|
||||||
@@ -253,9 +287,9 @@ public class PVOrdineAcquistoEditActivity extends BaseActivity {
|
|||||||
super.onBackPressed();
|
super.onBackPressed();
|
||||||
}
|
}
|
||||||
|
|
||||||
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 -> {
|
||||||
this.openProgress();
|
this.openProgress();
|
||||||
mhelper.checkArticolo(
|
mhelper.checkArticolo(
|
||||||
mOrdine,
|
mOrdine,
|
||||||
@@ -272,4 +306,7 @@ public class PVOrdineAcquistoEditActivity extends BaseActivity {
|
|||||||
}, BarcodeManager::enable).show();
|
}, BarcodeManager::enable).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isOrderNewProdsForced() {
|
||||||
|
return SettingsManager.iDB().getFlagOrdinaNuoviArticoliInGriglia();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import android.view.LayoutInflater;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
|
import android.view.inputmethod.EditorInfo;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
@@ -27,7 +28,6 @@ import it.integry.integrywmsnative.core.di.BindableInteger;
|
|||||||
import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
|
import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityFocus;
|
|
||||||
import it.integry.integrywmsnative.databinding.DialogPvEditArticoloBinding;
|
import it.integry.integrywmsnative.databinding.DialogPvEditArticoloBinding;
|
||||||
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.helper.PVEditOrderHelper;
|
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.helper.PVEditOrderHelper;
|
||||||
|
|
||||||
@@ -53,7 +53,7 @@ public class EditArticoloDialog extends BaseDialogFragment {
|
|||||||
mArticolo.setValue(articolo);
|
mArticolo.setValue(articolo);
|
||||||
mHelper = helper;
|
mHelper = helper;
|
||||||
qtaOrd.set(BigDecimal.valueOf(articolo.getQtaOrd()));
|
qtaOrd.set(BigDecimal.valueOf(articolo.getQtaOrd()));
|
||||||
numCnf.set(BigDecimal.valueOf(articolo.getQtaOrd()).divide(BigDecimal.valueOf(articolo.getQtaCnf()),0,RoundingMode.CEILING).intValue());
|
numCnf.set(BigDecimal.valueOf(articolo.getQtaOrd()).divide(BigDecimal.valueOf(articolo.getQtaCnf()), 0, RoundingMode.CEILING).intValue());
|
||||||
qtaCnf.set(BigDecimal.valueOf(articolo.getQtaCnf()));
|
qtaCnf.set(BigDecimal.valueOf(articolo.getQtaCnf()));
|
||||||
|
|
||||||
this.onDialogDismiss = onDialogDismiss;
|
this.onDialogDismiss = onDialogDismiss;
|
||||||
@@ -70,11 +70,11 @@ public class EditArticoloDialog extends BaseDialogFragment {
|
|||||||
@Override
|
@Override
|
||||||
public void onDismiss(@NonNull DialogInterface dialog) {
|
public void onDismiss(@NonNull DialogInterface dialog) {
|
||||||
super.onDismiss(dialog);
|
super.onDismiss(dialog);
|
||||||
ArticoloOrdine articolo = mArticolo.getValue();
|
/*ArticoloOrdine articolo = mArticolo.getValue();
|
||||||
if (articolo != null && articolo.getQtaOrd() <= 0f){
|
if (articolo != null && articolo.getQtaOrd() <= 0f) {
|
||||||
articolo = null;
|
articolo = null;
|
||||||
}
|
}
|
||||||
onDialogDismiss.run(articolo);
|
onDialogDismiss.run(articolo);*/
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@@ -87,14 +87,12 @@ public class EditArticoloDialog extends BaseDialogFragment {
|
|||||||
getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
|
getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
|
||||||
getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||||
initBindings();
|
initBindings();
|
||||||
|
|
||||||
return mBinding.getRoot();
|
return mBinding.getRoot();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStart() {
|
public void onStart() {
|
||||||
super.onStart();
|
super.onStart();
|
||||||
UtilityFocus.focusTextBox(mContext, mBinding.inputQtaOrd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initBindings() {
|
private void initBindings() {
|
||||||
@@ -106,17 +104,17 @@ public class EditArticoloDialog extends BaseDialogFragment {
|
|||||||
ArticoloOrdine articoloOrdine = mArticolo.getValue();
|
ArticoloOrdine articoloOrdine = mArticolo.getValue();
|
||||||
BigDecimal qtaCnf = BigDecimal.valueOf(articoloOrdine.getQtaCnf());
|
BigDecimal qtaCnf = BigDecimal.valueOf(articoloOrdine.getQtaCnf());
|
||||||
int cnf = 0;
|
int cnf = 0;
|
||||||
if (qtaOrd.get() != null && qtaOrd.get().compareTo(BigDecimal.ZERO) > 0){
|
if (qtaOrd.get() != null && qtaOrd.get().compareTo(BigDecimal.ZERO) > 0) {
|
||||||
cnf = qtaOrd.get().divide(qtaCnf, 0, RoundingMode.CEILING).intValue();
|
cnf = qtaOrd.get().divide(qtaCnf, 0, RoundingMode.CEILING).intValue();
|
||||||
}
|
}
|
||||||
this.numCnf.set( cnf);
|
this.numCnf.set(cnf);
|
||||||
this.mBinding.executePendingBindings();
|
this.mBinding.executePendingBindings();
|
||||||
|
|
||||||
mLockedInput = false;
|
mLockedInput = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
BindableInteger.registerListener(numCnf, qta -> {
|
BindableInteger.registerListener(numCnf, qta -> {
|
||||||
if (!mLockedInput){
|
if (!mLockedInput) {
|
||||||
mLockedInput = true;
|
mLockedInput = true;
|
||||||
|
|
||||||
ArticoloOrdine articoloOrdine = mArticolo.getValue();
|
ArticoloOrdine articoloOrdine = mArticolo.getValue();
|
||||||
@@ -127,6 +125,22 @@ public class EditArticoloDialog extends BaseDialogFragment {
|
|||||||
mLockedInput = false;
|
mLockedInput = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
mBinding.inputQtaOrd.setOnEditorActionListener((v, actionId, event) -> {
|
||||||
|
if (actionId == EditorInfo.IME_ACTION_DONE) {
|
||||||
|
// saveAndExit();
|
||||||
|
mBinding.inputNumCnfText.requestFocus();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
mBinding.inputNumCnfText.setOnEditorActionListener((v, actionId, event) -> {
|
||||||
|
if (actionId == EditorInfo.IME_ACTION_DONE) {
|
||||||
|
saveAndExit();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void saveAndExit() {
|
public void saveAndExit() {
|
||||||
@@ -141,17 +155,23 @@ public class EditArticoloDialog extends BaseDialogFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
articolo.setQtaOrd(qtaOrd.get().floatValue());
|
articolo.setQtaOrd(qtaOrd.get().floatValue());
|
||||||
mArticolo.postValue(articolo);
|
mArticolo.setValue(articolo);
|
||||||
|
mHelper.saveArticoloToOrdine(mArticolo.getValue(), () -> {
|
||||||
|
this.onLoadingEnded();
|
||||||
|
requireActivity().runOnUiThread(() -> {
|
||||||
|
onDialogDismiss.run(articolo);
|
||||||
|
});
|
||||||
|
this.dismiss();
|
||||||
|
}, e -> {
|
||||||
|
mContext.runOnUiThread(() -> UtilityExceptions.defaultException(mContext, e));
|
||||||
|
this.onLoadingEnded();
|
||||||
|
});
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
mContext.runOnUiThread(() -> UtilityExceptions.defaultException(mContext, e));
|
mContext.runOnUiThread(() -> UtilityExceptions.defaultException(mContext, e));
|
||||||
this.onLoadingEnded();
|
this.onLoadingEnded();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mHelper.saveArticoloToOrdine(mArticolo.getValue(), () -> {
|
;
|
||||||
this.onLoadingEnded();
|
|
||||||
this.dismiss();
|
|
||||||
}, e -> mContext.runOnUiThread(() -> UtilityExceptions.defaultException(mContext, e)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArticoloOrdine getArticolo() {
|
public ArticoloOrdine getArticolo() {
|
||||||
@@ -160,6 +180,9 @@ public class EditArticoloDialog extends BaseDialogFragment {
|
|||||||
|
|
||||||
public void cancel() {
|
public void cancel() {
|
||||||
mArticolo.postValue(null);
|
mArticolo.postValue(null);
|
||||||
|
requireActivity().runOnUiThread(() -> {
|
||||||
|
onDialogDismiss.run(null);
|
||||||
|
});
|
||||||
this.dismiss();
|
this.dismiss();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,12 @@ package it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.helper;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
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.repository.ArticoloGrigliaRepository;
|
|
||||||
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.GrigliaRepository;
|
import it.integry.integrywmsnative.core.data_store.db.repository.GrigliaRepository;
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
|
|
||||||
@@ -63,7 +64,15 @@ public class PVEditOrderHelper {
|
|||||||
mArticoliOrdineRepository.saveArticoloToOrdine(articolo, onSave, onFail);
|
mArticoliOrdineRepository.saveArticoloToOrdine(articolo, onSave, onFail);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeArticoloFromOrdine(ArticoloOrdine articolo, Runnable onSave, RunnableArgs<Exception> onError){
|
public void saveArticoliToOrdine(List<ArticoloOrdine> articoli, Runnable onSave, RunnableArgs<Exception> onFail) {
|
||||||
|
mArticoliOrdineRepository.saveArticoliToOrdine(articoli, onSave, onFail);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeArticoloFromOrdine(ArticoloOrdine articolo, Runnable onSave, RunnableArgs<Exception> onError) {
|
||||||
mArticoliOrdineRepository.deleteArticolo(articolo, onSave, onError);
|
mArticoliOrdineRepository.deleteArticolo(articolo, onSave, onError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void getNewArticoli(int idGrigla, RunnableArgs<List<ArticoloGriglia>> onSuccess, RunnableArgs<Exception> onError) {
|
||||||
|
mArticoliGrigliaRepository.findNewArticoliInGrigla(idGrigla, onSuccess, onError);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
package it.integry.integrywmsnative.gest.pv_ordini_acquisto;
|
package it.integry.integrywmsnative.gest.pv_ordini_acquisto;
|
||||||
|
|
||||||
import android.app.Dialog;
|
|
||||||
import android.content.Context;
|
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;
|
||||||
@@ -25,7 +23,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.barcode_reader.BarcodeManager;
|
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
||||||
import it.integry.integrywmsnative.core.data_cache.DataCache;
|
|
||||||
import it.integry.integrywmsnative.core.data_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.repository.ArticoliOrdineRepository;
|
import it.integry.integrywmsnative.core.data_store.db.repository.ArticoliOrdineRepository;
|
||||||
@@ -41,12 +38,13 @@ import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
|||||||
import it.integry.integrywmsnative.core.utility.UtilityProgress;
|
import it.integry.integrywmsnative.core.utility.UtilityProgress;
|
||||||
import it.integry.integrywmsnative.databinding.FragmentPvOrdiniAcquistoBinding;
|
import it.integry.integrywmsnative.databinding.FragmentPvOrdiniAcquistoBinding;
|
||||||
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.PVOrdineAcquistoEditActivity;
|
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.PVOrdineAcquistoEditActivity;
|
||||||
import it.integry.integrywmsnative.gest.pv_ordini_acquisto.ui.OrdineAcquistoPvOpenListAdapter;
|
|
||||||
import it.integry.integrywmsnative.gest.pv_ordini_acquisto.dialogs.DialogScanLisA;
|
import it.integry.integrywmsnative.gest.pv_ordini_acquisto.dialogs.DialogScanLisA;
|
||||||
import it.integry.integrywmsnative.gest.pv_ordini_acquisto.helper.OrdineAcquistoPvHelper;
|
import it.integry.integrywmsnative.gest.pv_ordini_acquisto.helper.OrdineAcquistoPvHelper;
|
||||||
|
import it.integry.integrywmsnative.gest.pv_ordini_acquisto.ui.OrdineAcquistoPvOpenListAdapter;
|
||||||
import it.integry.integrywmsnative.ui.ElevatedToolbar;
|
import it.integry.integrywmsnative.ui.ElevatedToolbar;
|
||||||
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;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.DialogProgressView;
|
||||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||||
|
|
||||||
public class PVOrdiniAcquistoGrigliaFragment extends Fragment implements ITitledFragment, IScrollableFragment {
|
public class PVOrdiniAcquistoGrigliaFragment extends Fragment implements ITitledFragment, IScrollableFragment {
|
||||||
@@ -55,7 +53,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 DialogProgressView mCurrentProgress;
|
||||||
private final List<OrdineWrapper> mRenderedOrderList = new ArrayList<>();
|
private final List<OrdineWrapper> mRenderedOrderList = new ArrayList<>();
|
||||||
private boolean mRedirectToNewOrder = true;
|
private boolean mRedirectToNewOrder = true;
|
||||||
|
|
||||||
@@ -177,7 +175,7 @@ public class PVOrdiniAcquistoGrigliaFragment extends Fragment implements ITitled
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void editOrdine(Ordine ordine) {
|
private void editOrdine(Ordine ordine) {
|
||||||
requireActivity().startActivity(PVOrdineAcquistoEditActivity.newInstance(requireActivity(),ordine));
|
requireActivity().startActivity(PVOrdineAcquistoEditActivity.newInstance(requireActivity(), ordine));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package it.integry.integrywmsnative.gest.pv_ordini_acquisto.dialogs;
|
package it.integry.integrywmsnative.gest.pv_ordini_acquisto.dialogs;
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
@@ -8,6 +7,7 @@ import android.graphics.drawable.ColorDrawable;
|
|||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
|
||||||
import androidx.databinding.DataBindingUtil;
|
import androidx.databinding.DataBindingUtil;
|
||||||
|
import androidx.fragment.app.FragmentActivity;
|
||||||
|
|
||||||
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
||||||
import it.integry.integrywmsnative.R;
|
import it.integry.integrywmsnative.R;
|
||||||
@@ -21,15 +21,16 @@ import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
|||||||
import it.integry.integrywmsnative.core.utility.UtilityProgress;
|
import it.integry.integrywmsnative.core.utility.UtilityProgress;
|
||||||
import it.integry.integrywmsnative.databinding.DialogScanCodiceGrigliaBinding;
|
import it.integry.integrywmsnative.databinding.DialogScanCodiceGrigliaBinding;
|
||||||
import it.integry.integrywmsnative.gest.pv_ordini_acquisto.helper.OrdineAcquistoPvHelper;
|
import it.integry.integrywmsnative.gest.pv_ordini_acquisto.helper.OrdineAcquistoPvHelper;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.DialogProgressView;
|
||||||
|
|
||||||
public class DialogScanLisA {
|
public class DialogScanLisA {
|
||||||
|
|
||||||
private Activity mContext;
|
private FragmentActivity mContext;
|
||||||
|
|
||||||
private BaseDialog mDialog;
|
private BaseDialog mDialog;
|
||||||
private Dialog mCurrentProgress;
|
private DialogProgressView mCurrentProgress;
|
||||||
|
|
||||||
private DialogScanCodiceGrigliaBinding mBinding;
|
private final DialogScanCodiceGrigliaBinding mBinding;
|
||||||
|
|
||||||
private RunnableArgs<Griglia> mOnDialogDismiss;
|
private RunnableArgs<Griglia> mOnDialogDismiss;
|
||||||
|
|
||||||
@@ -38,7 +39,7 @@ public class DialogScanLisA {
|
|||||||
private GrigliaRepository mGrigliaRepository;
|
private GrigliaRepository mGrigliaRepository;
|
||||||
private Griglia mGriglia;
|
private Griglia mGriglia;
|
||||||
|
|
||||||
private DialogScanLisA(Activity context, GrigliaRepository grigliaRepository, OrdineAcquistoPvHelper helper, RunnableArgs<Griglia> onDialogDismiss) {
|
private DialogScanLisA(FragmentActivity context, GrigliaRepository grigliaRepository, OrdineAcquistoPvHelper helper, RunnableArgs<Griglia> onDialogDismiss) {
|
||||||
mOnDialogDismiss = null;
|
mOnDialogDismiss = null;
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mGrigliaRepository = grigliaRepository;
|
mGrigliaRepository = grigliaRepository;
|
||||||
@@ -54,9 +55,10 @@ public class DialogScanLisA {
|
|||||||
mDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
mDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||||
mOnDialogDismiss = onDialogDismiss;
|
mOnDialogDismiss = onDialogDismiss;
|
||||||
initBarcode();
|
initBarcode();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Dialog make(Activity context, GrigliaRepository grigliaRepository, OrdineAcquistoPvHelper helper, RunnableArgs<Griglia> onDialogDismiss) {
|
public static Dialog make(FragmentActivity context, GrigliaRepository grigliaRepository, OrdineAcquistoPvHelper helper, RunnableArgs<Griglia> onDialogDismiss) {
|
||||||
return new DialogScanLisA(context, grigliaRepository, helper, onDialogDismiss).mDialog;
|
return new DialogScanLisA(context, grigliaRepository, helper, onDialogDismiss).mDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,7 +77,6 @@ public class DialogScanLisA {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private final RunnableArgs<BarcodeScanDTO> onScanSuccessfull = data -> {
|
private final RunnableArgs<BarcodeScanDTO> onScanSuccessfull = data -> {
|
||||||
BarcodeManager.disable();
|
BarcodeManager.disable();
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package it.integry.integrywmsnative.gest.rettifica_giacenze;
|
package it.integry.integrywmsnative.gest.rettifica_giacenze;
|
||||||
|
|
||||||
import android.app.Dialog;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.pm.ActivityInfo;
|
import android.content.pm.ActivityInfo;
|
||||||
import android.content.res.ColorStateList;
|
import android.content.res.ColorStateList;
|
||||||
@@ -58,6 +57,7 @@ import it.integry.integrywmsnative.gest.spedizione.model.PickingObjectDTO;
|
|||||||
import it.integry.integrywmsnative.ui.SimpleDividerItemDecoration;
|
import it.integry.integrywmsnative.ui.SimpleDividerItemDecoration;
|
||||||
import it.integry.integrywmsnative.view.bottom_sheet__mtb_colr_edit.BottomSheetMtbColrEditView;
|
import it.integry.integrywmsnative.view.bottom_sheet__mtb_colr_edit.BottomSheetMtbColrEditView;
|
||||||
import it.integry.integrywmsnative.view.dialogs.DialogConsts;
|
import it.integry.integrywmsnative.view.dialogs.DialogConsts;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.DialogProgressView;
|
||||||
import it.integry.integrywmsnative.view.dialogs.ask_position_of_lu.DialogAskPositionOfLU;
|
import it.integry.integrywmsnative.view.dialogs.ask_position_of_lu.DialogAskPositionOfLU;
|
||||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||||
import it.integry.integrywmsnative.view.dialogs.choose_art_from_lista_arts.DialogChooseArtFromListaArts;
|
import it.integry.integrywmsnative.view.dialogs.choose_art_from_lista_arts.DialogChooseArtFromListaArts;
|
||||||
@@ -73,6 +73,9 @@ public class RettificaGiacenzeFragment extends BaseFragment implements ITitledFr
|
|||||||
@Inject
|
@Inject
|
||||||
RettificaGiacenzeViewModel mViewModel;
|
RettificaGiacenzeViewModel mViewModel;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
DialogInputQuantityV2View mDialogInputQuantityV2View;
|
||||||
|
|
||||||
public BindableBoolean thereIsAnOpenedUL = new BindableBoolean(false);
|
public BindableBoolean thereIsAnOpenedUL = new BindableBoolean(false);
|
||||||
public BindableBoolean thereIsntAnOpenedUL = new BindableBoolean(false);
|
public BindableBoolean thereIsntAnOpenedUL = new BindableBoolean(false);
|
||||||
|
|
||||||
@@ -82,7 +85,7 @@ public class RettificaGiacenzeFragment extends BaseFragment implements ITitledFr
|
|||||||
|
|
||||||
private int barcodeScannerIstanceID = -1;
|
private int barcodeScannerIstanceID = -1;
|
||||||
|
|
||||||
private Dialog mCurrentProgress;
|
private DialogProgressView mCurrentProgress;
|
||||||
|
|
||||||
public RettificaGiacenzeFragment() {
|
public RettificaGiacenzeFragment() {
|
||||||
// Required empty public constructor
|
// Required empty public constructor
|
||||||
@@ -320,7 +323,7 @@ public class RettificaGiacenzeFragment extends BaseFragment implements ITitledFr
|
|||||||
thereIsAnOpenedUL.set(false);
|
thereIsAnOpenedUL.set(false);
|
||||||
|
|
||||||
|
|
||||||
if(getActivity() != null) ((IPoppableActivity) getActivity()).pop();
|
if (getActivity() != null) ((IPoppableActivity) getActivity()).pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -331,7 +334,7 @@ public class RettificaGiacenzeFragment extends BaseFragment implements ITitledFr
|
|||||||
() -> onComplete.run(true),
|
() -> onComplete.run(true),
|
||||||
() -> onComplete.run(false)
|
() -> onComplete.run(false)
|
||||||
)
|
)
|
||||||
.show(getActivity().getSupportFragmentManager(), "tag");
|
.show(getActivity().getSupportFragmentManager(), "tag");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -341,7 +344,7 @@ public class RettificaGiacenzeFragment extends BaseFragment implements ITitledFr
|
|||||||
if (ex instanceof InvalidPesoKGException) {
|
if (ex instanceof InvalidPesoKGException) {
|
||||||
UtilityToast.showToast(ex.getMessage());
|
UtilityToast.showToast(ex.getMessage());
|
||||||
} else {
|
} else {
|
||||||
UtilityExceptions.defaultException(getActivity(), ex, mCurrentProgress);
|
UtilityExceptions.defaultException(requireActivity(), ex, mCurrentProgress);
|
||||||
}
|
}
|
||||||
|
|
||||||
BarcodeManager.enable();
|
BarcodeManager.enable();
|
||||||
@@ -378,8 +381,9 @@ public class RettificaGiacenzeFragment extends BaseFragment implements ITitledFr
|
|||||||
.setCanPartitaMagBeChanged(canPartitaMagBeChanged)
|
.setCanPartitaMagBeChanged(canPartitaMagBeChanged)
|
||||||
.setCanLUBeClosed(canLUBeClosed);
|
.setCanLUBeClosed(canLUBeClosed);
|
||||||
|
|
||||||
DialogInputQuantityV2View
|
mDialogInputQuantityV2View
|
||||||
.newInstance(dialogInputQuantityV2DTO, (resultDTO, shouldCloseLU) -> {
|
.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
|
||||||
|
.setOnComplete((resultDTO, shouldCloseLU) -> {
|
||||||
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO()
|
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO()
|
||||||
.setNumCnf(resultDTO.getNumCnf())
|
.setNumCnf(resultDTO.getNumCnf())
|
||||||
.setQtaCnf(resultDTO.getQtaCnf())
|
.setQtaCnf(resultDTO.getQtaCnf())
|
||||||
@@ -389,15 +393,16 @@ public class RettificaGiacenzeFragment extends BaseFragment implements ITitledFr
|
|||||||
|
|
||||||
this.openProgress();
|
this.openProgress();
|
||||||
onComplete.run(pickedQuantityDTO, shouldCloseLU);
|
onComplete.run(pickedQuantityDTO, shouldCloseLU);
|
||||||
}, () -> {
|
})
|
||||||
|
.setOnAbort(() -> {
|
||||||
this.closeProgress();
|
this.closeProgress();
|
||||||
})
|
})
|
||||||
.show(getActivity().getSupportFragmentManager(), "tag");
|
.show(requireActivity().getSupportFragmentManager(), "tag");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRowSaved() {
|
public void onRowSaved() {
|
||||||
FBToast.successToast(getActivity(), getResources().getString(R.string.data_saved), FBToast.LENGTH_SHORT);
|
FBToast.successToast(requireActivity(), getResources().getString(R.string.data_saved), FBToast.LENGTH_SHORT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -450,7 +455,8 @@ public class RettificaGiacenzeFragment extends BaseFragment implements ITitledFr
|
|||||||
null,
|
null,
|
||||||
() -> onComplete.run(true),
|
() -> onComplete.run(true),
|
||||||
() -> onComplete.run(false))
|
() -> onComplete.run(false))
|
||||||
.show(getActivity().getSupportFragmentManager(), "tag");;
|
.show(getActivity().getSupportFragmentManager(), "tag");
|
||||||
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -461,7 +467,7 @@ public class RettificaGiacenzeFragment extends BaseFragment implements ITitledFr
|
|||||||
null,
|
null,
|
||||||
R.string.button_ignore_print,
|
R.string.button_ignore_print,
|
||||||
onComplete)
|
onComplete)
|
||||||
.show(getActivity().getSupportFragmentManager(), "tag");
|
.show(getActivity().getSupportFragmentManager(), "tag");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -469,7 +475,7 @@ public class RettificaGiacenzeFragment extends BaseFragment implements ITitledFr
|
|||||||
DialogYesNo.make(getActivity(), "Posiziona UL", "Vuoi cambiare la posizione della UL corrente?", result -> {
|
DialogYesNo.make(getActivity(), "Posiziona UL", "Vuoi cambiare la posizione della UL corrente?", result -> {
|
||||||
switch (result) {
|
switch (result) {
|
||||||
case YES:
|
case YES:
|
||||||
DialogAskPositionOfLU.makeBase(getActivity(), false, (status, mtbDepoPosizione) -> {
|
DialogAskPositionOfLU.makeBase(getActivity(), false, (status, mtbDepoPosizione) -> {
|
||||||
if (status == DialogConsts.Results.ABORT) {
|
if (status == DialogConsts.Results.ABORT) {
|
||||||
onComplete.run(false, null);
|
onComplete.run(false, null);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -83,6 +83,9 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
|||||||
@Inject
|
@Inject
|
||||||
SpedizioneViewModel mViewmodel;
|
SpedizioneViewModel mViewmodel;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
DialogInputQuantityV2View mDialogInputQuantityV2View;
|
||||||
|
|
||||||
private BottomSheetFragmentLUContentViewModel mBottomSheetFragmentLUContentViewModel;
|
private BottomSheetFragmentLUContentViewModel mBottomSheetFragmentLUContentViewModel;
|
||||||
|
|
||||||
private final ObservableArrayList<SpedizioneListModel> mSpedizioneMutableData = new ObservableArrayList<>();
|
private final ObservableArrayList<SpedizioneListModel> mSpedizioneMutableData = new ObservableArrayList<>();
|
||||||
@@ -405,7 +408,7 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
|||||||
|
|
||||||
BigDecimal qtaEvasa = Stream.of(x.getWithdrawMtbColrs())
|
BigDecimal qtaEvasa = Stream.of(x.getWithdrawMtbColrs())
|
||||||
.filter(y -> y.getRefMtbColr() != null &&
|
.filter(y -> y.getRefMtbColr() != null &&
|
||||||
y.getRefMtbColr().getId() == mtbColrToDispatch.getId()
|
y.getRefMtbColr().getId() == mtbColrToDispatch.getId()
|
||||||
/*
|
/*
|
||||||
y.getRefMtbColr().getNumCollo().equals(mtbColrToDispatch.getNumCollo()) &&
|
y.getRefMtbColr().getNumCollo().equals(mtbColrToDispatch.getNumCollo()) &&
|
||||||
y.getRefMtbColr().getDataColloD().equals(mtbColrToDispatch.getDataColloD()) &&
|
y.getRefMtbColr().getDataColloD().equals(mtbColrToDispatch.getDataColloD()) &&
|
||||||
@@ -549,7 +552,7 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
|||||||
|
|
||||||
BigDecimal qtaEvasa = Stream.of(x.getWithdrawMtbColrs())
|
BigDecimal qtaEvasa = Stream.of(x.getWithdrawMtbColrs())
|
||||||
.filter(y -> y.getRefMtbColr() != null &&
|
.filter(y -> y.getRefMtbColr() != null &&
|
||||||
y.getRefMtbColr().getId() == mtbColrToDispatch.getId() /*
|
y.getRefMtbColr().getId() == mtbColrToDispatch.getId() /*
|
||||||
y.getRefMtbColr().getNumCollo().equals(mtbColrToDispatch.getNumCollo()) &&
|
y.getRefMtbColr().getNumCollo().equals(mtbColrToDispatch.getNumCollo()) &&
|
||||||
y.getRefMtbColr().getDataColloD().equals(mtbColrToDispatch.getDataColloD()) &&
|
y.getRefMtbColr().getDataColloD().equals(mtbColrToDispatch.getDataColloD()) &&
|
||||||
y.getRefMtbColr().getSerCollo().equals(mtbColrToDispatch.getSerCollo()) &&
|
y.getRefMtbColr().getSerCollo().equals(mtbColrToDispatch.getSerCollo()) &&
|
||||||
@@ -821,8 +824,9 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
|||||||
.setCanLUBeClosed(true)
|
.setCanLUBeClosed(true)
|
||||||
.setCanPartitaMagBeChanged(canPartitaMagBeChanged);
|
.setCanPartitaMagBeChanged(canPartitaMagBeChanged);
|
||||||
|
|
||||||
DialogInputQuantityV2View
|
mDialogInputQuantityV2View
|
||||||
.newInstance(dialogInputQuantityV2DTO, (resultDTO, shouldCloseLU) -> {
|
.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
|
||||||
|
.setOnComplete((resultDTO, shouldCloseLU) -> {
|
||||||
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO()
|
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO()
|
||||||
.setNumCnf(resultDTO.getNumCnf())
|
.setNumCnf(resultDTO.getNumCnf())
|
||||||
.setQtaCnf(resultDTO.getQtaCnf())
|
.setQtaCnf(resultDTO.getQtaCnf())
|
||||||
@@ -832,7 +836,8 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
|||||||
|
|
||||||
this.openProgress();
|
this.openProgress();
|
||||||
onComplete.run(pickedQuantityDTO, shouldCloseLU);
|
onComplete.run(pickedQuantityDTO, shouldCloseLU);
|
||||||
}, () -> {
|
})
|
||||||
|
.setOnAbort(() -> {
|
||||||
this.mViewmodel.resetMatchedRows();
|
this.mViewmodel.resetMatchedRows();
|
||||||
})
|
})
|
||||||
.show(getSupportFragmentManager(), "tag");
|
.show(getSupportFragmentManager(), "tag");
|
||||||
|
|||||||
@@ -1762,10 +1762,12 @@ public class SpedizioneViewModel {
|
|||||||
.filter(x -> !this.mColliRegistrati.contains(x))
|
.filter(x -> !this.mColliRegistrati.contains(x))
|
||||||
.forEach(x -> this.mColliRegistrati.add(x));
|
.forEach(x -> this.mColliRegistrati.add(x));
|
||||||
|
|
||||||
for (MtbColt mtbColt : mtbColtList) {
|
if (mTestateOrdini != null) {
|
||||||
Stream.of(mTestateOrdini)
|
for (MtbColt mtbColt : mtbColtList) {
|
||||||
.filter(x -> x.getNumOrd().equals(mtbColt.getNumOrd()) && x.getDataOrdD().equals(mtbColt.getDataOrdD()) && x.getGestioneEnum() == mtbColt.getGestioneEnum())
|
Stream.of(mTestateOrdini)
|
||||||
.forEach(x -> x.setExistColloBoolean(true));
|
.filter(x -> x.getNumOrd().equals(mtbColt.getNumOrd()) && x.getDataOrdD().equals(mtbColt.getDataOrdD()) && x.getGestioneEnum() == mtbColt.getGestioneEnum())
|
||||||
|
.forEach(x -> x.setExistColloBoolean(true));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mMtbColtSessionID != null)
|
if (mMtbColtSessionID != null)
|
||||||
|
|||||||
@@ -48,6 +48,9 @@ public class VersamentoMerceFragment extends BaseFragment implements ITitledFrag
|
|||||||
@Inject
|
@Inject
|
||||||
VersamentoMerceViewModel mViewModel;
|
VersamentoMerceViewModel mViewModel;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
DialogInputQuantityV2View mDialogInputQuantityV2View;
|
||||||
|
|
||||||
private FragmentMainVersamentoMerceBinding mBindings = null;
|
private FragmentMainVersamentoMerceBinding mBindings = null;
|
||||||
|
|
||||||
private final List<Runnable> mOnPreDestroyList = new ArrayList<>();
|
private final List<Runnable> mOnPreDestroyList = new ArrayList<>();
|
||||||
@@ -202,9 +205,10 @@ public class VersamentoMerceFragment extends BaseFragment implements ITitledFrag
|
|||||||
.setCanPartitaMagBeChanged(canBatchLotBeChanged)
|
.setCanPartitaMagBeChanged(canBatchLotBeChanged)
|
||||||
.setCanLUBeClosed(false);
|
.setCanLUBeClosed(false);
|
||||||
|
|
||||||
this.getActivity().runOnUiThread(() -> {
|
this.requireActivity().runOnUiThread(() -> {
|
||||||
DialogInputQuantityV2View
|
mDialogInputQuantityV2View
|
||||||
.newInstance(dialogInputQuantityV2DTO, (resultDTO, shouldCloseLU) -> {
|
.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
|
||||||
|
.setOnComplete((resultDTO, shouldCloseLU) -> {
|
||||||
|
|
||||||
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO()
|
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO()
|
||||||
.setNumCnf(resultDTO.getNumCnf())
|
.setNumCnf(resultDTO.getNumCnf())
|
||||||
@@ -215,8 +219,9 @@ public class VersamentoMerceFragment extends BaseFragment implements ITitledFrag
|
|||||||
|
|
||||||
onComplete.run(pickedQuantityDTO);
|
onComplete.run(pickedQuantityDTO);
|
||||||
|
|
||||||
}, this::onLoadingEnded)
|
})
|
||||||
.show(getActivity().getSupportFragmentManager(), "tag");
|
.setOnAbort(this::onLoadingEnded)
|
||||||
|
.show(requireActivity().getSupportFragmentManager(), "tag");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ public class BottomSheetFragmentLUContentView extends BottomSheetFragmentBaseVie
|
|||||||
public void onPropertyChanged(Observable sender, int propertyId) {
|
public void onPropertyChanged(Observable sender, int propertyId) {
|
||||||
var mtbColt = mViewModel.getObservableMtbColt().get();
|
var mtbColt = mViewModel.getObservableMtbColt().get();
|
||||||
|
|
||||||
if(mtbColt != null) {
|
if (mtbColt != null) {
|
||||||
initAdapter();
|
initAdapter();
|
||||||
|
|
||||||
onMtbColrItemChanged();
|
onMtbColrItemChanged();
|
||||||
@@ -101,6 +101,7 @@ public class BottomSheetFragmentLUContentView extends BottomSheetFragmentBaseVie
|
|||||||
List<MtbColr> mtbColrs = mViewModel.getObservableMtbColt().get().getMtbColr();
|
List<MtbColr> mtbColrs = mViewModel.getObservableMtbColt().get().getMtbColr();
|
||||||
mBinding.textviewArtCounter.setText(String.valueOf(mtbColrs.size()));
|
mBinding.textviewArtCounter.setText(String.valueOf(mtbColrs.size()));
|
||||||
mBinding.textviewArtDescription.setText(mContext.getResources().getQuantityString(R.plurals.articles, mtbColrs.size()));
|
mBinding.textviewArtDescription.setText(mContext.getResources().getQuantityString(R.plurals.articles, mtbColrs.size()));
|
||||||
|
mViewModel.calcPesi();
|
||||||
}
|
}
|
||||||
|
|
||||||
public BottomSheetFragmentLUContentView setListener(Listener listener) {
|
public BottomSheetFragmentLUContentView setListener(Listener listener) {
|
||||||
@@ -131,12 +132,12 @@ public class BottomSheetFragmentLUContentView extends BottomSheetFragmentBaseVie
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMtbColrEdit(MtbColr mtbColr) {
|
public void onMtbColrEdit(MtbColr mtbColr) {
|
||||||
if(mListener != null) this.mListener.onMtbColrEdit(mtbColr);
|
if (mListener != null) this.mListener.onMtbColrEdit(mtbColr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMtbColrDelete(MtbColr mtbColr) {
|
public void onMtbColrDelete(MtbColr mtbColr) {
|
||||||
if(mListener != null) this.mListener.onMtbColrDelete(mtbColr);
|
if (mListener != null) this.mListener.onMtbColrDelete(mtbColr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,16 +2,24 @@ package it.integry.integrywmsnative.view.bottom_sheet__lu_content;
|
|||||||
|
|
||||||
import androidx.databinding.ObservableField;
|
import androidx.databinding.ObservableField;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||||
|
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||||
|
import it.integry.integrywmsnative.core.model.MtbTCol;
|
||||||
|
|
||||||
public class BottomSheetFragmentLUContentViewModel {
|
public class BottomSheetFragmentLUContentViewModel {
|
||||||
|
|
||||||
public ObservableField<MtbColt> mtbColt = new ObservableField<>();
|
public ObservableField<MtbColt> mtbColt = new ObservableField<>();
|
||||||
|
public ObservableField<String> pesoKg = new ObservableField<>();
|
||||||
|
public ObservableField<String> pesoNettoKg = new ObservableField<>();
|
||||||
private Listener mListener;
|
private Listener mListener;
|
||||||
private MtbColrListener mMtbColrListener;
|
private MtbColrListener mMtbColrListener;
|
||||||
|
|
||||||
public void closeCurrentLU() {
|
public void closeCurrentLU() {
|
||||||
if(this.mListener != null) this.mListener.onBottomSheetLUClose();
|
if (this.mListener != null) this.mListener.onBottomSheetLUClose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public BottomSheetFragmentLUContentViewModel setMtbColt(MtbColt mtbColt) {
|
public BottomSheetFragmentLUContentViewModel setMtbColt(MtbColt mtbColt) {
|
||||||
@@ -33,6 +41,26 @@ public class BottomSheetFragmentLUContentViewModel {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void calcPesi() {
|
||||||
|
MtbColt collo = this.mtbColt.get();
|
||||||
|
if (collo != null) {
|
||||||
|
MtbTCol tipoPedana = collo.getMtbTCol();
|
||||||
|
BigDecimal taraPedana = tipoPedana != null ? tipoPedana.getTaraKg() : BigDecimal.ZERO;
|
||||||
|
BigDecimal pesoNetto = BigDecimal.ZERO;
|
||||||
|
for (MtbColr mtbColr : collo.getMtbColr()) {
|
||||||
|
MtbAart articolo = mtbColr.getMtbAart();
|
||||||
|
if (articolo != null) {
|
||||||
|
BigDecimal pesoRiga = articolo.isFlagQtaCnfFissaBoolean() ? mtbColr.getNumCnf().multiply(articolo.getPesoKg()) : mtbColr.getQtaCol();
|
||||||
|
BigDecimal pesoTara = articolo.getTaraKg().multiply(mtbColr.getNumCnf());
|
||||||
|
pesoRiga = pesoRiga.add(pesoTara);
|
||||||
|
pesoNetto = pesoNetto.add(pesoRiga);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.pesoNettoKg.set(pesoNetto.setScale(2, RoundingMode.CEILING).toString());
|
||||||
|
this.pesoKg.set(pesoNetto.add(taraPedana).setScale(2, RoundingMode.CEILING).toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public interface Listener {
|
public interface Listener {
|
||||||
void onBottomSheetLUClose();
|
void onBottomSheetLUClose();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,61 +0,0 @@
|
|||||||
package it.integry.integrywmsnative.view.dialogs;
|
|
||||||
|
|
||||||
import android.app.Dialog;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.graphics.Color;
|
|
||||||
import android.graphics.drawable.ColorDrawable;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
|
|
||||||
import androidx.databinding.DataBindingUtil;
|
|
||||||
|
|
||||||
import it.integry.integrywmsnative.R;
|
|
||||||
import it.integry.integrywmsnative.databinding.DialogProgressBinding;
|
|
||||||
|
|
||||||
public class DialogProgress {
|
|
||||||
|
|
||||||
private Context mContext;
|
|
||||||
private DialogProgressBinding mBinding;
|
|
||||||
|
|
||||||
private Dialog mDialog;
|
|
||||||
|
|
||||||
public static Dialog make(Context context,String subtitle) {
|
|
||||||
DialogProgress progress = new DialogProgress(context);
|
|
||||||
progress.setSubtitle(subtitle);
|
|
||||||
return progress.mDialog;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Dialog make(Context context) {
|
|
||||||
return new DialogProgress(context).mDialog;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private DialogProgress(Context context) {
|
|
||||||
mContext = context;
|
|
||||||
|
|
||||||
LayoutInflater inflater = (LayoutInflater) context.getSystemService( Context.LAYOUT_INFLATER_SERVICE );
|
|
||||||
mBinding = DataBindingUtil.inflate(inflater, R.layout.dialog_progress, null, false);
|
|
||||||
|
|
||||||
// final Thread[] progressBarThread = new Thread[1];
|
|
||||||
|
|
||||||
mDialog = new Dialog(mContext);
|
|
||||||
mDialog.setContentView(mBinding.getRoot());
|
|
||||||
mDialog.setCanceledOnTouchOutside(false);
|
|
||||||
mDialog.setCancelable(false);
|
|
||||||
mDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
|
||||||
|
|
||||||
mDialog.setOnShowListener(dialog -> {
|
|
||||||
// ((ProgressBar) currentView.findViewById(R.id.progressBar)).setIndeterminate(true);
|
|
||||||
// progressBarThread[0] = UtilityProgress.makeProgressBarIndeterminate(mBinding.progressBar);
|
|
||||||
});
|
|
||||||
|
|
||||||
mDialog.setOnDismissListener(dialog -> {
|
|
||||||
// progressBarThread[0].interrupt();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setSubtitle(String subtitle){
|
|
||||||
mBinding.subtitleText.setText(subtitle);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
package it.integry.integrywmsnative.view.dialogs;
|
||||||
|
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.graphics.drawable.ColorDrawable;
|
||||||
|
import android.os.Build;
|
||||||
|
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.fragment.app.DialogFragment;
|
||||||
|
|
||||||
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.R;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||||
|
import it.integry.integrywmsnative.databinding.DialogProgressBinding;
|
||||||
|
|
||||||
|
@Singleton
|
||||||
|
public class DialogProgressView extends DialogFragment {
|
||||||
|
|
||||||
|
private DialogProgressBinding mBindings;
|
||||||
|
|
||||||
|
private String title;
|
||||||
|
private String subtitle;
|
||||||
|
private boolean indeterminateProgress;
|
||||||
|
|
||||||
|
public static DialogProgressView newInstance(String title, String subtitle, boolean indeterminate) {
|
||||||
|
return new DialogProgressView()
|
||||||
|
.setIndeterminateProgress(indeterminate)
|
||||||
|
.setTitle(title)
|
||||||
|
.setSubtitle(subtitle);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static DialogProgressView newInstance() {
|
||||||
|
return newInstance(null, null, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
|
mBindings = DataBindingUtil.inflate(inflater, R.layout.dialog_progress, container, false);
|
||||||
|
|
||||||
|
setCancelable(false);
|
||||||
|
getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||||
|
|
||||||
|
mBindings.setTitle(UtilityString.isNullOrEmpty(title) ? requireActivity().getString(R.string.loading) : title);
|
||||||
|
|
||||||
|
mBindings.setSubtitle(subtitle);
|
||||||
|
mBindings.progressBar.setIndeterminate(isIndeterminateProgress());
|
||||||
|
|
||||||
|
if(!isIndeterminateProgress()){
|
||||||
|
mBindings.progressBar.setMax(100);
|
||||||
|
}
|
||||||
|
|
||||||
|
return mBindings.getRoot();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean isIndeterminateProgress() {
|
||||||
|
return indeterminateProgress;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DialogProgressView setIndeterminateProgress(boolean indeterminateProgress) {
|
||||||
|
this.indeterminateProgress = indeterminateProgress;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public DialogProgressView setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DialogProgressView setSubtitle(String subtitle) {
|
||||||
|
this.subtitle = subtitle;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProgress(int progress) {
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||||
|
mBindings.progressBar.setProgress(progress, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -23,17 +23,31 @@ import it.integry.integrywmsnative.view.dialogs.ask_cliente.viewmodel.IDialogAsk
|
|||||||
|
|
||||||
public class DialogAskClienteAdapter extends PagerAdapter implements ViewPager.OnPageChangeListener {
|
public class DialogAskClienteAdapter extends PagerAdapter implements ViewPager.OnPageChangeListener {
|
||||||
|
|
||||||
private Context mContext;
|
private final Context mContext;
|
||||||
|
|
||||||
private List<Map.Entry<Integer, Class>> mDatasetLayout;
|
private final List<Map.Entry<Integer, Class<? extends IDialogAskClienteViewModel>>> mDatasetLayout;
|
||||||
private List<Map.Entry<ViewDataBinding, IDialogAskClienteViewModel>> mDatasetViews;
|
private final List<Map.Entry<ViewDataBinding, IDialogAskClienteViewModel>> mDatasetViews;
|
||||||
|
private final List<IDialogAskClienteViewModel> mDatasetViewModels;
|
||||||
|
|
||||||
private DeactivatableViewPager viewPager;
|
private DeactivatableViewPager viewPager;
|
||||||
|
|
||||||
public DialogAskClienteAdapter(Context context, List<Map.Entry<Integer, Class>> datasetLayouts) {
|
public DialogAskClienteAdapter(Context context, List<Map.Entry<Integer, Class<? extends IDialogAskClienteViewModel>>> datasetLayouts) {
|
||||||
this.mContext = context;
|
this.mContext = context;
|
||||||
this.mDatasetLayout = datasetLayouts;
|
this.mDatasetLayout = datasetLayouts;
|
||||||
this.mDatasetViews = new ArrayList<>();
|
this.mDatasetViews = new ArrayList<>();
|
||||||
|
this.mDatasetViewModels = new ArrayList<>();
|
||||||
|
|
||||||
|
|
||||||
|
for (var viewModelEntry : mDatasetLayout) {
|
||||||
|
var viewModelClazz = viewModelEntry.getValue();
|
||||||
|
|
||||||
|
try {
|
||||||
|
IDialogAskClienteViewModel viewModel = viewModelClazz.newInstance();
|
||||||
|
mDatasetViewModels.add(viewModel);
|
||||||
|
} catch (IllegalAccessException | InstantiationException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -43,20 +57,13 @@ public class DialogAskClienteAdapter extends PagerAdapter implements ViewPager.O
|
|||||||
|
|
||||||
Integer viewId = mDatasetLayout.get(position).getKey();
|
Integer viewId = mDatasetLayout.get(position).getKey();
|
||||||
|
|
||||||
|
|
||||||
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService( Context.LAYOUT_INFLATER_SERVICE );
|
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService( Context.LAYOUT_INFLATER_SERVICE );
|
||||||
ViewDataBinding mBinding = DataBindingUtil.inflate(inflater, viewId, null, false);
|
ViewDataBinding mBinding = DataBindingUtil.inflate(inflater, viewId, container, false);
|
||||||
|
|
||||||
Class viewModelClass = mDatasetLayout.get(position).getValue();
|
|
||||||
IDialogAskClienteViewModel viewModel = null;
|
|
||||||
|
|
||||||
try {
|
var viewModel = this.mDatasetViewModels.get(position);
|
||||||
viewModel = (IDialogAskClienteViewModel) viewModelClass.newInstance();
|
viewModel.setBinding(mBinding);
|
||||||
viewModel.setBinding(mBinding);
|
viewModel.setContext(mContext);
|
||||||
viewModel.setContext(mContext);
|
|
||||||
} catch (IllegalAccessException | InstantiationException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
mBinding.setVariable(BR.viewmodel, viewModel);
|
mBinding.setVariable(BR.viewmodel, viewModel);
|
||||||
|
|
||||||
@@ -82,10 +89,10 @@ public class DialogAskClienteAdapter extends PagerAdapter implements ViewPager.O
|
|||||||
return mDatasetLayout.size();
|
return mDatasetLayout.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IDialogAskClienteViewModel getViewModel(@NonNull int layoutID) {
|
public IDialogAskClienteViewModel getViewModel(int layoutID) {
|
||||||
for(int i = 0; i < mDatasetLayout.size(); i++) {
|
for(int i = 0; i < mDatasetLayout.size(); i++) {
|
||||||
if(mDatasetLayout.get(i).getKey() == layoutID) {
|
if(mDatasetLayout.get(i).getKey() == layoutID) {
|
||||||
return this.mDatasetViews.get(i).getValue();
|
return this.mDatasetViewModels.get(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package it.integry.integrywmsnative.view.dialogs.ask_cliente;
|
||||||
|
|
||||||
|
import dagger.Subcomponent;
|
||||||
|
|
||||||
|
@Subcomponent
|
||||||
|
public interface DialogAskClienteComponent {
|
||||||
|
|
||||||
|
@Subcomponent.Factory
|
||||||
|
interface Factory {
|
||||||
|
DialogAskClienteComponent create();
|
||||||
|
}
|
||||||
|
|
||||||
|
void inject(DialogAskClienteView dialogAskClienteView);
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package it.integry.integrywmsnative.view.dialogs.ask_cliente;
|
||||||
|
|
||||||
|
import dagger.Module;
|
||||||
|
|
||||||
|
@Module(subcomponents = DialogAskClienteComponent.class)
|
||||||
|
public class DialogAskClienteModule {
|
||||||
|
}
|
||||||
@@ -14,23 +14,36 @@ import androidx.annotation.Nullable;
|
|||||||
import androidx.databinding.DataBindingUtil;
|
import androidx.databinding.DataBindingUtil;
|
||||||
import androidx.fragment.app.FragmentActivity;
|
import androidx.fragment.app.FragmentActivity;
|
||||||
|
|
||||||
|
import com.annimon.stream.Stream;
|
||||||
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.lang.reflect.Type;
|
||||||
import java.util.AbstractMap;
|
import java.util.AbstractMap;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.MainApplication;
|
||||||
import it.integry.integrywmsnative.R;
|
import it.integry.integrywmsnative.R;
|
||||||
import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
|
import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgss;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgss;
|
||||||
import it.integry.integrywmsnative.core.model.VtbDest;
|
import it.integry.integrywmsnative.core.model.VtbDest;
|
||||||
|
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityDialog;
|
import it.integry.integrywmsnative.core.utility.UtilityDialog;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityHashMap;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||||
import it.integry.integrywmsnative.databinding.DialogAskClienteBinding;
|
import it.integry.integrywmsnative.databinding.DialogAskClienteBinding;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.DialogProgressView;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.ask_cliente.dto.DialogAskClienteClienteDTO;
|
||||||
import it.integry.integrywmsnative.view.dialogs.ask_cliente.dto.DialogAskClienteDestinatarioDTO;
|
import it.integry.integrywmsnative.view.dialogs.ask_cliente.dto.DialogAskClienteDestinatarioDTO;
|
||||||
import it.integry.integrywmsnative.view.dialogs.ask_cliente.viewmodel.DialogAskCliente_Page1ViewModel;
|
import it.integry.integrywmsnative.view.dialogs.ask_cliente.viewmodel.DialogAskCliente_Page1ViewModel;
|
||||||
import it.integry.integrywmsnative.view.dialogs.ask_cliente.viewmodel.DialogAskCliente_Page2ViewModel;
|
import it.integry.integrywmsnative.view.dialogs.ask_cliente.viewmodel.DialogAskCliente_Page2ViewModel;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.ask_cliente.viewmodel.IDialogAskClienteViewModel;
|
||||||
|
|
||||||
public class DialogAskClienteView extends BaseDialogFragment {
|
public class DialogAskClienteView extends BaseDialogFragment {
|
||||||
|
|
||||||
@@ -44,8 +57,14 @@ public class DialogAskClienteView extends BaseDialogFragment {
|
|||||||
|
|
||||||
private boolean mIsClienteSelected = false;
|
private boolean mIsClienteSelected = false;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
SystemRESTConsumer systemRESTConsumer;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
DialogProgressView dialogProgressView;
|
||||||
|
|
||||||
public static DialogAskClienteView newInstance(@NotNull RunnableArgss<VtbDest, String> onComplete, @NotNull Runnable onAbort) {
|
public static DialogAskClienteView newInstance(@NotNull RunnableArgss<VtbDest, String> onComplete, @NotNull Runnable onAbort) {
|
||||||
return new DialogAskClienteView( onComplete, onAbort);
|
return new DialogAskClienteView(onComplete, onAbort);
|
||||||
}
|
}
|
||||||
|
|
||||||
private DialogAskClienteView(@NotNull RunnableArgss<VtbDest, String> onComplete, @NotNull Runnable onAbort) {
|
private DialogAskClienteView(@NotNull RunnableArgss<VtbDest, String> onComplete, @NotNull Runnable onAbort) {
|
||||||
@@ -68,8 +87,13 @@ public class DialogAskClienteView extends BaseDialogFragment {
|
|||||||
getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||||
getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
|
getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
|
||||||
|
|
||||||
|
MainApplication.appComponent
|
||||||
|
.dialogAskClienteComponent()
|
||||||
|
.create()
|
||||||
|
.inject(this);
|
||||||
|
|
||||||
List<Map.Entry<Integer, Class>> views = new ArrayList<>();
|
|
||||||
|
List<Map.Entry<Integer, Class<? extends IDialogAskClienteViewModel>>> views = new ArrayList<>();
|
||||||
views.add(new AbstractMap.SimpleEntry<>(R.layout.dialog_ask_cliente__page1, DialogAskCliente_Page1ViewModel.class));
|
views.add(new AbstractMap.SimpleEntry<>(R.layout.dialog_ask_cliente__page1, DialogAskCliente_Page1ViewModel.class));
|
||||||
views.add(new AbstractMap.SimpleEntry<>(R.layout.dialog_ask_cliente__page2, DialogAskCliente_Page2ViewModel.class));
|
views.add(new AbstractMap.SimpleEntry<>(R.layout.dialog_ask_cliente__page2, DialogAskCliente_Page2ViewModel.class));
|
||||||
|
|
||||||
@@ -79,9 +103,7 @@ public class DialogAskClienteView extends BaseDialogFragment {
|
|||||||
mBindings.viewpager.addOnPageChangeListener(mAdapter);
|
mBindings.viewpager.addOnPageChangeListener(mAdapter);
|
||||||
mBindings.viewpager.setCurrentItem(0, false);
|
mBindings.viewpager.setCurrentItem(0, false);
|
||||||
|
|
||||||
getDialog().setOnShowListener(d -> {
|
this.initView();
|
||||||
this.initView();
|
|
||||||
});
|
|
||||||
|
|
||||||
return mBindings.getRoot();
|
return mBindings.getRoot();
|
||||||
}
|
}
|
||||||
@@ -93,30 +115,23 @@ public class DialogAskClienteView extends BaseDialogFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
|
||||||
super.onViewCreated(view, savedInstanceState);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initView() {
|
private void initView() {
|
||||||
DialogAskCliente_Page1ViewModel viewModel1 = (DialogAskCliente_Page1ViewModel) mAdapter.getViewModel(R.layout.dialog_ask_cliente__page1);
|
DialogAskCliente_Page1ViewModel viewModel1 = (DialogAskCliente_Page1ViewModel) mAdapter.getViewModel(R.layout.dialog_ask_cliente__page1);
|
||||||
DialogAskCliente_Page2ViewModel viewModel2 = (DialogAskCliente_Page2ViewModel) mAdapter.getViewModel(R.layout.dialog_ask_cliente__page2);
|
DialogAskCliente_Page2ViewModel viewModel2 = (DialogAskCliente_Page2ViewModel) mAdapter.getViewModel(R.layout.dialog_ask_cliente__page2);
|
||||||
|
|
||||||
viewModel1
|
viewModel1.setOnConfirmClickListener(() -> {
|
||||||
.setOnConfirmClickListener(() -> {
|
String codAnag = viewModel1.getCurrentCliente();
|
||||||
String codAnag = viewModel1.getCurrentCliente();
|
|
||||||
|
|
||||||
if(UtilityString.isNullOrEmpty(codAnag)) {
|
if (UtilityString.isNullOrEmpty(codAnag)) {
|
||||||
this.mIsClienteSelected = true;
|
this.mIsClienteSelected = true;
|
||||||
dismiss();
|
dismiss();
|
||||||
mOnComplete.run(null, null);
|
mOnComplete.run(null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
viewModel2.setCodAnag(codAnag);
|
viewModel2.setCodAnag(codAnag);
|
||||||
|
|
||||||
mBindings.viewpager.setCurrentItem(mBindings.viewpager.getCurrentItem() + 1, true);
|
|
||||||
});
|
|
||||||
|
|
||||||
|
mBindings.viewpager.setCurrentItem(mBindings.viewpager.getCurrentItem() + 1, true);
|
||||||
|
});
|
||||||
viewModel2.setOnConfirmClickListener(() -> {
|
viewModel2.setOnConfirmClickListener(() -> {
|
||||||
DialogAskClienteDestinatarioDTO cliente = viewModel2.getCurrentDestinatario();
|
DialogAskClienteDestinatarioDTO cliente = viewModel2.getCurrentDestinatario();
|
||||||
|
|
||||||
@@ -128,13 +143,88 @@ public class DialogAskClienteView extends BaseDialogFragment {
|
|||||||
|
|
||||||
viewModel1.setOnAbortClickListener(this::dismiss);
|
viewModel1.setOnAbortClickListener(this::dismiss);
|
||||||
viewModel2.setOnAbortClickListener(this::dismiss);
|
viewModel2.setOnAbortClickListener(this::dismiss);
|
||||||
|
|
||||||
|
|
||||||
|
this.dialogProgressView.show(this.getParentFragmentManager(), "tag");
|
||||||
|
|
||||||
|
this.initClienti(viewModel1, () -> {
|
||||||
|
this.initDestinatari(viewModel2, () -> {
|
||||||
|
this.dialogProgressView.dismiss();
|
||||||
|
}, () -> {
|
||||||
|
this.dialogProgressView.dismiss();
|
||||||
|
});
|
||||||
|
}, () -> {
|
||||||
|
this.dialogProgressView.dismiss();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void initClienti(DialogAskCliente_Page1ViewModel viewModel, Runnable onComplete, Runnable onAbort) {
|
||||||
|
Type typeOfObjectsList = new TypeToken<ArrayList<HashMap<String, Object>>>() {
|
||||||
|
}.getType();
|
||||||
|
|
||||||
|
String sqlClienti = "SELECT gtb_anag.cod_anag, rag_soc, jtb_comt.cod_jcom " +
|
||||||
|
"FROM gtb_anag " +
|
||||||
|
"LEFT OUTER JOIN jtb_comt ON gtb_anag.cod_anag = jtb_comt.cod_anag " +
|
||||||
|
"INNER JOIN vtb_clie ON gtb_anag.cod_anag = vtb_clie.cod_anag " +
|
||||||
|
"WHERE vtb_clie.flag_stato = 'A' " +
|
||||||
|
"ORDER BY rag_soc";
|
||||||
|
|
||||||
|
this.systemRESTConsumer.<ArrayList<HashMap<String, Object>>>processSql(sqlClienti, typeOfObjectsList, value -> {
|
||||||
|
var availableClienti = new ArrayList<DialogAskClienteClienteDTO>();
|
||||||
|
|
||||||
|
Stream.of(value)
|
||||||
|
.groupBy(x -> x.get("codAnag").toString() + " " + x.get("ragSoc").toString())
|
||||||
|
.forEach(x -> {
|
||||||
|
DialogAskClienteClienteDTO dialogAskClienteClienteDTO = new DialogAskClienteClienteDTO();
|
||||||
|
dialogAskClienteClienteDTO.setCodAnag(UtilityHashMap.getValueIfExists(x.getValue().get(0), "codAnag"));
|
||||||
|
dialogAskClienteClienteDTO.setRagSoc(UtilityHashMap.getValueIfExists(x.getValue().get(0), "ragSoc"));
|
||||||
|
|
||||||
|
for (HashMap<String, Object> group : x.getValue()) {
|
||||||
|
if (group.containsKey("codJcom")) {
|
||||||
|
dialogAskClienteClienteDTO.getCodJcoms().add(UtilityHashMap.getValueIfExists(group, "codJcom"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
availableClienti.add(dialogAskClienteClienteDTO);
|
||||||
|
});
|
||||||
|
|
||||||
|
viewModel.setAvailableClienti(availableClienti);
|
||||||
|
onComplete.run();
|
||||||
|
}, ex -> {
|
||||||
|
onAbort.run();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initDestinatari(DialogAskCliente_Page2ViewModel viewModel, Runnable onComplete, Runnable onAbort) {
|
||||||
|
String sql = "SELECT vtb_dest.cod_anag,\n" +
|
||||||
|
" cod_vdes,\n" +
|
||||||
|
" destinatario,\n" +
|
||||||
|
" indirizzo,\n" +
|
||||||
|
" cap,\n" +
|
||||||
|
" citta,\n" +
|
||||||
|
" prov,\n" +
|
||||||
|
" nazione\n" +
|
||||||
|
"FROM vtb_dest\n" +
|
||||||
|
"INNER JOIN vtb_clie ON vtb_clie.cod_anag = vtb_dest.cod_anag\n" +
|
||||||
|
"WHERE vtb_clie.flag_stato = 'A'";
|
||||||
|
|
||||||
|
Type typeOfObjectsList = new TypeToken<ArrayList<DialogAskClienteDestinatarioDTO>>() {
|
||||||
|
}.getType();
|
||||||
|
this.systemRESTConsumer.<ArrayList<DialogAskClienteDestinatarioDTO>>processSql(sql, typeOfObjectsList, value -> {
|
||||||
|
viewModel.setAvailableDestinatari(value);
|
||||||
|
|
||||||
|
onComplete.run();
|
||||||
|
}, ex -> {
|
||||||
|
onAbort.run();
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDismiss(@NonNull DialogInterface dialog) {
|
public void onDismiss(@NonNull DialogInterface dialog) {
|
||||||
mAdapter.onDismiss();
|
mAdapter.onDismiss();
|
||||||
if(!mIsClienteSelected) {
|
if (!mIsClienteSelected) {
|
||||||
this.mOnAbort.run();
|
this.mOnAbort.run();
|
||||||
}
|
}
|
||||||
super.onDismiss(dialog);
|
super.onDismiss(dialog);
|
||||||
|
|||||||
@@ -10,12 +10,9 @@ import androidx.databinding.ViewDataBinding;
|
|||||||
|
|
||||||
import com.annimon.stream.Optional;
|
import com.annimon.stream.Optional;
|
||||||
import com.annimon.stream.Stream;
|
import com.annimon.stream.Stream;
|
||||||
import com.google.gson.reflect.TypeToken;
|
|
||||||
import com.tfb.fbtoast.FBToast;
|
import com.tfb.fbtoast.FBToast;
|
||||||
|
|
||||||
import java.lang.reflect.Type;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
||||||
@@ -24,11 +21,8 @@ import it.integry.integrywmsnative.core.barcode_reader.BarcodeCallbackDTO;
|
|||||||
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
||||||
import it.integry.integrywmsnative.core.expansion.OnListGeneralChangedCallback;
|
import it.integry.integrywmsnative.core.expansion.OnListGeneralChangedCallback;
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.ISimpleOperationCallback;
|
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
|
||||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityHashMap;
|
|
||||||
import it.integry.integrywmsnative.databinding.DialogAskClientePage1Binding;
|
import it.integry.integrywmsnative.databinding.DialogAskClientePage1Binding;
|
||||||
import it.integry.integrywmsnative.view.dialogs.ask_cliente.dto.DialogAskClienteClienteDTO;
|
import it.integry.integrywmsnative.view.dialogs.ask_cliente.dto.DialogAskClienteClienteDTO;
|
||||||
|
|
||||||
@@ -40,10 +34,12 @@ public class DialogAskCliente_Page1ViewModel implements IDialogAskClienteViewMod
|
|||||||
private int mBarcodeScannerInstanceID;
|
private int mBarcodeScannerInstanceID;
|
||||||
|
|
||||||
private ArrayList<DialogAskClienteClienteDTO> availableClienti;
|
private ArrayList<DialogAskClienteClienteDTO> availableClienti;
|
||||||
private ObservableArrayList<String> codJcoms = new ObservableArrayList<>();
|
private final ObservableArrayList<String> codJcoms = new ObservableArrayList<>();
|
||||||
|
|
||||||
|
private Runnable onConfirmClickListener;
|
||||||
|
private Runnable onAbortClickListener;
|
||||||
|
|
||||||
public DialogAskCliente_Page1ViewModel() {
|
public DialogAskCliente_Page1ViewModel() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -56,52 +52,31 @@ public class DialogAskCliente_Page1ViewModel implements IDialogAskClienteViewMod
|
|||||||
this.mBinding = (DialogAskClientePage1Binding) binding;
|
this.mBinding = (DialogAskClientePage1Binding) binding;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setAvailableClienti(ArrayList<DialogAskClienteClienteDTO> availableClienti) {
|
||||||
|
this.availableClienti = availableClienti;
|
||||||
|
initializeAdapter(availableClienti);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onShow() {
|
public void onShow() {
|
||||||
|
|
||||||
String sql = "SELECT gtb_anag.cod_anag, rag_soc, jtb_comt.cod_jcom " +
|
mBarcodeScannerInstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
||||||
"FROM gtb_anag " +
|
.setOnScanSuccessfull(onScanSuccessful)
|
||||||
"LEFT OUTER JOIN jtb_comt ON gtb_anag.cod_anag = jtb_comt.cod_anag " +
|
.setOnScanFailed(ex -> UtilityExceptions.defaultException(mContext, ex, false)));
|
||||||
"INNER JOIN vtb_clie ON gtb_anag.cod_anag = vtb_clie.cod_anag " +
|
BarcodeManager.enable();
|
||||||
"WHERE vtb_clie.flag_stato = 'A' " +
|
|
||||||
"ORDER BY rag_soc";
|
|
||||||
|
|
||||||
Type typeOfObjectsList = new TypeToken<ArrayList<HashMap<String, Object>>>() { }.getType();
|
this.mBinding.buttonYes.setOnClickListener(v -> {
|
||||||
|
if (validateCliente()) {
|
||||||
SystemRESTConsumer.processSqlStatic(sql, typeOfObjectsList, new ISimpleOperationCallback<ArrayList<HashMap<String, Object>>>() {
|
this.resetClienteError();
|
||||||
@Override
|
BarcodeManager.removeCallback(mBarcodeScannerInstanceID);
|
||||||
public void onSuccess(ArrayList<HashMap<String, Object>> value) {
|
if (onConfirmClickListener != null) onConfirmClickListener.run();
|
||||||
|
} else {
|
||||||
availableClienti = new ArrayList<>();
|
this.setClienteError(mContext.getResources().getText(R.string.not_valid_customer_error).toString());
|
||||||
|
|
||||||
Stream.of(value)
|
|
||||||
.groupBy(x -> x.get("codAnag").toString() + " " + x.get("ragSoc").toString())
|
|
||||||
.forEach(x -> {
|
|
||||||
DialogAskClienteClienteDTO dialogAskClienteClienteDTO = new DialogAskClienteClienteDTO();
|
|
||||||
dialogAskClienteClienteDTO.setCodAnag(UtilityHashMap.getValueIfExists(x.getValue().get(0), "codAnag"));
|
|
||||||
dialogAskClienteClienteDTO.setRagSoc(UtilityHashMap.getValueIfExists(x.getValue().get(0), "ragSoc"));
|
|
||||||
|
|
||||||
for (HashMap<String, Object> group : x.getValue()) {
|
|
||||||
if (group.containsKey("codJcom")) {
|
|
||||||
dialogAskClienteClienteDTO.getCodJcoms().add(UtilityHashMap.getValueIfExists(group, "codJcom"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
availableClienti.add(dialogAskClienteClienteDTO);
|
|
||||||
});
|
|
||||||
|
|
||||||
initializeAdapter(availableClienti);
|
|
||||||
|
|
||||||
mBarcodeScannerInstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
|
||||||
.setOnScanSuccessfull(onScanSuccessful)
|
|
||||||
.setOnScanFailed(ex -> UtilityExceptions.defaultException(mContext, ex, false)));
|
|
||||||
BarcodeManager.enable();
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
@Override
|
this.mBinding.buttonNo.setOnClickListener(v -> {
|
||||||
public void onFailed(Exception ex) {
|
if (onAbortClickListener != null) onAbortClickListener.run();
|
||||||
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -113,16 +88,7 @@ public class DialogAskCliente_Page1ViewModel implements IDialogAskClienteViewMod
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setOnConfirmClickListener(Runnable onConfirm) {
|
public void setOnConfirmClickListener(Runnable onConfirm) {
|
||||||
this.mBinding.buttonYes.setOnClickListener(v -> {
|
this.onConfirmClickListener = onConfirm;
|
||||||
if (validateCliente()) {
|
|
||||||
this.resetClienteError();
|
|
||||||
BarcodeManager.removeCallback(mBarcodeScannerInstanceID);
|
|
||||||
if (onConfirm != null) onConfirm.run();
|
|
||||||
} else {
|
|
||||||
this.setClienteError(mContext.getResources().getText(R.string.not_valid_customer_error).toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -139,7 +105,7 @@ public class DialogAskCliente_Page1ViewModel implements IDialogAskClienteViewMod
|
|||||||
} else {
|
} else {
|
||||||
DialogAskClienteClienteDTO resultCodJcom = searchBarcodeInCodJcom(barcode);
|
DialogAskClienteClienteDTO resultCodJcom = searchBarcodeInCodJcom(barcode);
|
||||||
|
|
||||||
if(resultCodJcom != null) {
|
if (resultCodJcom != null) {
|
||||||
mBinding.dropdownCliente.setText(resultCodJcom.toString());
|
mBinding.dropdownCliente.setText(resultCodJcom.toString());
|
||||||
refreshCodJcoms(resultCodJcom);
|
refreshCodJcoms(resultCodJcom);
|
||||||
mBinding.dropdownCommessa.setText(barcode);
|
mBinding.dropdownCommessa.setText(barcode);
|
||||||
@@ -174,9 +140,7 @@ public class DialogAskCliente_Page1ViewModel implements IDialogAskClienteViewMod
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setOnAbortClickListener(Runnable onAbort) {
|
public void setOnAbortClickListener(Runnable onAbort) {
|
||||||
this.mBinding.buttonNo.setOnClickListener(v -> {
|
this.onAbortClickListener = onAbort;
|
||||||
if (onAbort != null) onAbort.run();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -213,7 +177,7 @@ public class DialogAskCliente_Page1ViewModel implements IDialogAskClienteViewMod
|
|||||||
|
|
||||||
|
|
||||||
private boolean validateCliente() {
|
private boolean validateCliente() {
|
||||||
if(SettingsManager.iDB().isFlagAllowEmptyClienteInPickingLibero() && mBinding.inputCliente.getEditText().getText().toString().trim().length() == 0) {
|
if (SettingsManager.iDB().isFlagAllowEmptyClienteInPickingLibero() && mBinding.inputCliente.getEditText().getText().toString().trim().length() == 0) {
|
||||||
return true;
|
return true;
|
||||||
} else return getCurrentCliente() != null;
|
} else return getCurrentCliente() != null;
|
||||||
}
|
}
|
||||||
@@ -223,7 +187,7 @@ public class DialogAskCliente_Page1ViewModel implements IDialogAskClienteViewMod
|
|||||||
.filter(x -> x.getRagSoc().equalsIgnoreCase(mBinding.inputCliente.getEditText().getText().toString()))
|
.filter(x -> x.getRagSoc().equalsIgnoreCase(mBinding.inputCliente.getEditText().getText().toString()))
|
||||||
.findFirst();
|
.findFirst();
|
||||||
|
|
||||||
if(result.isPresent()) return result.get().getCodAnag();
|
if (result.isPresent()) return result.get().getCodAnag();
|
||||||
else return null;
|
else return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -234,7 +198,7 @@ public class DialogAskCliente_Page1ViewModel implements IDialogAskClienteViewMod
|
|||||||
.map(DialogAskClienteClienteDTO::getCodJcoms)
|
.map(DialogAskClienteClienteDTO::getCodJcoms)
|
||||||
.findFirst();
|
.findFirst();
|
||||||
|
|
||||||
if(result.isPresent() && Stream.of(result.get()).anyMatch(x -> x.equalsIgnoreCase(mBinding.inputCommessa.getEditText().getText().toString()))) {
|
if (result.isPresent() && Stream.of(result.get()).anyMatch(x -> x.equalsIgnoreCase(mBinding.inputCommessa.getEditText().getText().toString()))) {
|
||||||
return mBinding.inputCommessa.getEditText().getText().toString();
|
return mBinding.inputCommessa.getEditText().getText().toString();
|
||||||
} else return null;
|
} else return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,28 +5,24 @@ import android.widget.AutoCompleteTextView;
|
|||||||
|
|
||||||
import androidx.databinding.ViewDataBinding;
|
import androidx.databinding.ViewDataBinding;
|
||||||
|
|
||||||
import com.google.gson.reflect.TypeToken;
|
import com.annimon.stream.Stream;
|
||||||
|
|
||||||
import java.lang.reflect.Type;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.R;
|
import it.integry.integrywmsnative.R;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.ISimpleOperationCallback;
|
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityDB;
|
|
||||||
import it.integry.integrywmsnative.databinding.DialogAskClientePage2Binding;
|
import it.integry.integrywmsnative.databinding.DialogAskClientePage2Binding;
|
||||||
import it.integry.integrywmsnative.view.dialogs.ask_cliente.dto.DialogAskClienteDestinatarioDTO;
|
import it.integry.integrywmsnative.view.dialogs.ask_cliente.dto.DialogAskClienteDestinatarioDTO;
|
||||||
|
|
||||||
public class DialogAskCliente_Page2ViewModel implements IDialogAskClienteViewModel {
|
public class DialogAskCliente_Page2ViewModel implements IDialogAskClienteViewModel {
|
||||||
|
|
||||||
|
|
||||||
private DialogAskClientePage2Binding mBinding;
|
private DialogAskClientePage2Binding mBinding;
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
|
|
||||||
private Runnable mOnConfirm;
|
private Runnable mOnConfirm;
|
||||||
|
private Runnable mOnAbort;
|
||||||
|
|
||||||
private List<DialogAskClienteDestinatarioDTO> availableDestinatari;
|
private ArrayList<DialogAskClienteDestinatarioDTO> availableDestinatari;
|
||||||
|
|
||||||
private String mCodAnag;
|
private String mCodAnag;
|
||||||
|
|
||||||
@@ -39,6 +35,10 @@ public class DialogAskCliente_Page2ViewModel implements IDialogAskClienteViewMod
|
|||||||
this.mBinding = (DialogAskClientePage2Binding) binding;
|
this.mBinding = (DialogAskClientePage2Binding) binding;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setAvailableDestinatari(ArrayList<DialogAskClienteDestinatarioDTO> availableDestinatari) {
|
||||||
|
this.availableDestinatari = availableDestinatari;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setContext(Context context) {
|
public void setContext(Context context) {
|
||||||
this.mContext = context;
|
this.mContext = context;
|
||||||
@@ -46,28 +46,32 @@ public class DialogAskCliente_Page2ViewModel implements IDialogAskClienteViewMod
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onShow() {
|
public void onShow() {
|
||||||
String sql = "SELECT cod_anag, cod_vdes, destinatario, indirizzo, cap, citta, prov, nazione " +
|
var filteredDestinatari = availableDestinatari != null ? Stream.of(availableDestinatari)
|
||||||
"FROM vtb_dest " +
|
.filter(x -> x.getCodAnag().equalsIgnoreCase(mCodAnag))
|
||||||
"WHERE cod_anag = " + UtilityDB.valueToString(mCodAnag);
|
.toList()
|
||||||
|
: null;
|
||||||
|
|
||||||
Type typeOfObjectsList = new TypeToken<ArrayList<DialogAskClienteDestinatarioDTO>>() {
|
|
||||||
}.getType();
|
|
||||||
SystemRESTConsumer.processSqlStatic(sql, typeOfObjectsList, new ISimpleOperationCallback<ArrayList<DialogAskClienteDestinatarioDTO>>() {
|
|
||||||
@Override
|
|
||||||
public void onSuccess(ArrayList<DialogAskClienteDestinatarioDTO> value) {
|
|
||||||
availableDestinatari = value;
|
|
||||||
initializeAdapter(value);
|
|
||||||
|
|
||||||
if(value == null || value.size() == 0) {
|
if (filteredDestinatari == null || filteredDestinatari.size() == 0) {
|
||||||
mOnConfirm.run();
|
mOnConfirm.run();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
initializeAdapter(filteredDestinatari);
|
||||||
|
|
||||||
|
|
||||||
|
this.mBinding.buttonYes.setOnClickListener(v -> {
|
||||||
|
if (validateDestinatario()) {
|
||||||
|
this.resetClienteError();
|
||||||
|
if (mOnConfirm != null) mOnConfirm.run();
|
||||||
|
} else {
|
||||||
|
this.setClienteError(mContext.getResources().getText(R.string.not_valid_recipient_error).toString());
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailed(Exception ex) {
|
|
||||||
|
|
||||||
}
|
this.mBinding.buttonNo.setOnClickListener(v -> {
|
||||||
|
if (mOnAbort != null) mOnAbort.run();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,22 +82,11 @@ public class DialogAskCliente_Page2ViewModel implements IDialogAskClienteViewMod
|
|||||||
@Override
|
@Override
|
||||||
public void setOnConfirmClickListener(Runnable onConfirm) {
|
public void setOnConfirmClickListener(Runnable onConfirm) {
|
||||||
this.mOnConfirm = onConfirm;
|
this.mOnConfirm = onConfirm;
|
||||||
this.mBinding.buttonYes.setOnClickListener(v -> {
|
|
||||||
if (validateDestinatario()) {
|
|
||||||
this.resetClienteError();
|
|
||||||
if (onConfirm != null) onConfirm.run();
|
|
||||||
} else {
|
|
||||||
this.setClienteError(mContext.getResources().getText(R.string.not_valid_recipient_error).toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setOnAbortClickListener(Runnable onAbort) {
|
public void setOnAbortClickListener(Runnable onAbort) {
|
||||||
this.mBinding.buttonNo.setOnClickListener(v -> {
|
this.mOnAbort = onAbort;
|
||||||
if (onAbort != null) onAbort.run();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCodAnag(String codAnag) {
|
public void setCodAnag(String codAnag) {
|
||||||
@@ -101,8 +94,7 @@ public class DialogAskCliente_Page2ViewModel implements IDialogAskClienteViewMod
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void initializeAdapter(ArrayList<DialogAskClienteDestinatarioDTO> items) {
|
private void initializeAdapter(List<DialogAskClienteDestinatarioDTO> items) {
|
||||||
|
|
||||||
DialogAskCliente_Page2_ArrayAdapter adapter = new DialogAskCliente_Page2_ArrayAdapter(mContext, items);
|
DialogAskCliente_Page2_ArrayAdapter adapter = new DialogAskCliente_Page2_ArrayAdapter(mContext, items);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ public class DialogAskCliente_Page2_ArrayAdapter extends ArrayAdapter<DialogAskC
|
|||||||
|
|
||||||
private ListFilter listFilter = new ListFilter();
|
private ListFilter listFilter = new ListFilter();
|
||||||
|
|
||||||
public DialogAskCliente_Page2_ArrayAdapter(@NonNull Context context, @NonNull ArrayList<DialogAskClienteDestinatarioDTO> list) {
|
public DialogAskCliente_Page2_ArrayAdapter(@NonNull Context context, @NonNull List<DialogAskClienteDestinatarioDTO> list) {
|
||||||
super(context, 0 , list);
|
super(context, 0 , list);
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mDataset = list;
|
mDataset = list;
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package it.integry.integrywmsnative.view.dialogs.choose_arts_from_lista_arts;
|
package it.integry.integrywmsnative.view.dialogs.choose_arts_from_lista_arts;
|
||||||
|
|
||||||
import android.app.Dialog;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
@@ -42,6 +41,7 @@ import it.integry.integrywmsnative.core.utility.UtilityProgress;
|
|||||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||||
import it.integry.integrywmsnative.databinding.DialogChooseArtsFromListaArtsLayoutBinding;
|
import it.integry.integrywmsnative.databinding.DialogChooseArtsFromListaArtsLayoutBinding;
|
||||||
import it.integry.integrywmsnative.view.dialogs.DialogCommon;
|
import it.integry.integrywmsnative.view.dialogs.DialogCommon;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.DialogProgressView;
|
||||||
|
|
||||||
public class DialogChooseArtsFromListaArts extends BaseDialogFragment {
|
public class DialogChooseArtsFromListaArts extends BaseDialogFragment {
|
||||||
|
|
||||||
@@ -62,11 +62,23 @@ public class DialogChooseArtsFromListaArts extends BaseDialogFragment {
|
|||||||
private final List<DialogChooseArtsFromListaArtsItemModel> mDataset;
|
private final List<DialogChooseArtsFromListaArtsItemModel> mDataset;
|
||||||
|
|
||||||
private int mBarcodeScannerIstanceID;
|
private int mBarcodeScannerIstanceID;
|
||||||
|
private DialogProgressView mCurrentProgress;
|
||||||
|
private MtbAart selectedArt;
|
||||||
|
|
||||||
public static DialogChooseArtsFromListaArts newInstance(List<MtbColr> listaMtbColr, RunnableArgs<List<MtbColr>> onItemsChoosed, Runnable onAbort) {
|
public static DialogChooseArtsFromListaArts newInstance(List<MtbColr> listaMtbColr, RunnableArgs<List<MtbColr>> onItemsChoosed, Runnable onAbort) {
|
||||||
return new DialogChooseArtsFromListaArts(listaMtbColr, onItemsChoosed, onAbort);
|
return new DialogChooseArtsFromListaArts(listaMtbColr, onItemsChoosed, onAbort);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static DialogChooseArtsFromListaArts newInstance(List<MtbColr> listaMtbColr, MtbAart mtbAart, RunnableArgs<List<MtbColr>> onItemsChoosed, Runnable onAbort) {
|
||||||
|
DialogChooseArtsFromListaArts dialog = newInstance(listaMtbColr, onItemsChoosed, onAbort);
|
||||||
|
dialog.setSelectedArt(mtbAart);
|
||||||
|
return dialog;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSelectedArt(MtbAart mtbAart) {
|
||||||
|
this.selectedArt = mtbAart;
|
||||||
|
}
|
||||||
|
|
||||||
private DialogChooseArtsFromListaArts(List<MtbColr> listaMtbColr, RunnableArgs<List<MtbColr>> onItemsChoosed, Runnable onAbort) {
|
private DialogChooseArtsFromListaArts(List<MtbColr> listaMtbColr, RunnableArgs<List<MtbColr>> onItemsChoosed, Runnable onAbort) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
@@ -125,6 +137,14 @@ public class DialogChooseArtsFromListaArts extends BaseDialogFragment {
|
|||||||
return mBindings.getRoot();
|
return mBindings.getRoot();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStart() {
|
||||||
|
super.onStart();
|
||||||
|
|
||||||
|
if (selectedArt != null) {
|
||||||
|
this.loadArticolo(selectedArt.getBarCode(), null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void initRecyclerView() {
|
private void initRecyclerView() {
|
||||||
mBindings.listaArts.setNestedScrollingEnabled(false);
|
mBindings.listaArts.setNestedScrollingEnabled(false);
|
||||||
@@ -229,8 +249,6 @@ public class DialogChooseArtsFromListaArts extends BaseDialogFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDismiss(@NonNull DialogInterface dialog) {
|
public void onDismiss(@NonNull DialogInterface dialog) {
|
||||||
BarcodeManager.removeCallback(mBarcodeScannerIstanceID);
|
BarcodeManager.removeCallback(mBarcodeScannerIstanceID);
|
||||||
@@ -242,14 +260,15 @@ public class DialogChooseArtsFromListaArts extends BaseDialogFragment {
|
|||||||
private final RunnableArgs<BarcodeScanDTO> onScanSuccessfull = data -> {
|
private final RunnableArgs<BarcodeScanDTO> onScanSuccessfull = data -> {
|
||||||
BarcodeManager.disable();
|
BarcodeManager.disable();
|
||||||
|
|
||||||
Dialog progressDialog = UtilityProgress.createDefaultProgressDialog(context);
|
openProgress();
|
||||||
|
|
||||||
|
|
||||||
if (UtilityBarcode.isEan13(data)) {
|
if (UtilityBarcode.isEan13(data)) {
|
||||||
this.loadArticolo(data.getStringValue(), null, progressDialog);
|
this.loadArticolo(data.getStringValue(), null);
|
||||||
} else if (UtilityBarcode.isEtichetta128(data)) {
|
} else if (UtilityBarcode.isEtichetta128(data)) {
|
||||||
this.executeEtichettaEan128(data, progressDialog);
|
this.executeEtichettaEan128(data);
|
||||||
} else {
|
} else {
|
||||||
progressDialog.dismiss();
|
closeProgress();
|
||||||
BarcodeManager.enable();
|
BarcodeManager.enable();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -257,7 +276,7 @@ public class DialogChooseArtsFromListaArts extends BaseDialogFragment {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
private void executeEtichettaEan128(BarcodeScanDTO barcodeScanDTO, Dialog progressDialog) {
|
private void executeEtichettaEan128(BarcodeScanDTO barcodeScanDTO) {
|
||||||
this.barcodeRESTConsumer.decodeEan128(barcodeScanDTO, ean128Model -> {
|
this.barcodeRESTConsumer.decodeEan128(barcodeScanDTO, ean128Model -> {
|
||||||
|
|
||||||
String barcodeProd = null;
|
String barcodeProd = null;
|
||||||
@@ -271,11 +290,11 @@ public class DialogChooseArtsFromListaArts extends BaseDialogFragment {
|
|||||||
if (!UtilityString.isNullOrEmpty(barcodeProd)) {
|
if (!UtilityString.isNullOrEmpty(barcodeProd)) {
|
||||||
|
|
||||||
if (!UtilityString.isNullOrEmpty(ean128Model.Gtin) || !UtilityString.isNullOrEmpty(ean128Model.Content)) {
|
if (!UtilityString.isNullOrEmpty(ean128Model.Gtin) || !UtilityString.isNullOrEmpty(ean128Model.Content)) {
|
||||||
this.loadArticolo(barcodeProd, ean128Model, progressDialog);
|
this.loadArticolo(barcodeProd, ean128Model);
|
||||||
} else {
|
} else {
|
||||||
DialogCommon.showNoArtFoundDialog(context, () -> {
|
DialogCommon.showNoArtFoundDialog(context, () -> {
|
||||||
BarcodeManager.enable();
|
BarcodeManager.enable();
|
||||||
progressDialog.dismiss();
|
closeProgress();
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -285,18 +304,19 @@ public class DialogChooseArtsFromListaArts extends BaseDialogFragment {
|
|||||||
//EAN 128 non completo o comunque mancano i riferimenti al prodotto
|
//EAN 128 non completo o comunque mancano i riferimenti al prodotto
|
||||||
DialogCommon.showNoArtFoundDialog(context, () -> {
|
DialogCommon.showNoArtFoundDialog(context, () -> {
|
||||||
BarcodeManager.enable();
|
BarcodeManager.enable();
|
||||||
progressDialog.dismiss();
|
closeProgress();
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
}, ex -> {
|
}, ex -> {
|
||||||
UtilityExceptions.defaultException(context, ex, progressDialog);
|
closeProgress();
|
||||||
|
UtilityExceptions.defaultException(context, ex);
|
||||||
BarcodeManager.enable();
|
BarcodeManager.enable();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void loadArticolo(String barcodeProd, Ean128Model ean128Model, Dialog progressDialog) {
|
private void loadArticolo(String barcodeProd, Ean128Model ean128Model) {
|
||||||
if (barcodeProd.length() == 14) {
|
if (barcodeProd.length() == 14) {
|
||||||
barcodeProd = UtilityBarcode.convertITF14toEAN13(barcodeProd);
|
barcodeProd = UtilityBarcode.convertITF14toEAN13(barcodeProd);
|
||||||
}
|
}
|
||||||
@@ -310,19 +330,20 @@ public class DialogChooseArtsFromListaArts extends BaseDialogFragment {
|
|||||||
this.searchArtInList(mtbAartList.get(0), ean128Model);
|
this.searchArtInList(mtbAartList.get(0), ean128Model);
|
||||||
|
|
||||||
BarcodeManager.enable();
|
BarcodeManager.enable();
|
||||||
progressDialog.dismiss();
|
closeProgress();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
DialogCommon.showNoArtFoundDialog(context, () -> {
|
DialogCommon.showNoArtFoundDialog(context, () -> {
|
||||||
BarcodeManager.enable();
|
BarcodeManager.enable();
|
||||||
progressDialog.dismiss();
|
closeProgress();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}, ex -> {
|
}, ex -> {
|
||||||
|
closeProgress();
|
||||||
BarcodeManager.enable();
|
BarcodeManager.enable();
|
||||||
UtilityExceptions.defaultException(context, ex, progressDialog);
|
UtilityExceptions.defaultException(context, ex);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -364,5 +385,20 @@ public class DialogChooseArtsFromListaArts extends BaseDialogFragment {
|
|||||||
this.dismiss();
|
this.dismiss();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void openProgress() {
|
||||||
|
requireActivity().runOnUiThread(() -> {
|
||||||
|
if (this.mCurrentProgress == null) {
|
||||||
|
this.mCurrentProgress = UtilityProgress.createDefaultProgressDialog(getActivity());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void closeProgress() {
|
||||||
|
requireActivity().runOnUiThread(() -> {
|
||||||
|
if (mCurrentProgress != null) {
|
||||||
|
mCurrentProgress.dismiss();
|
||||||
|
mCurrentProgress = null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,146 @@
|
|||||||
|
package it.integry.integrywmsnative.view.dialogs.info_aggiuntive_lu;
|
||||||
|
|
||||||
|
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.AdapterView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.databinding.DataBindingUtil;
|
||||||
|
import androidx.databinding.ObservableField;
|
||||||
|
|
||||||
|
import com.annimon.stream.Optional;
|
||||||
|
import com.annimon.stream.Stream;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.MainApplication;
|
||||||
|
import it.integry.integrywmsnative.R;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.RunnableArgss;
|
||||||
|
import it.integry.integrywmsnative.core.model.MtbTCol;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityDialog;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityObservable;
|
||||||
|
import it.integry.integrywmsnative.databinding.DialogNoteAggiuntiveNuovaUlBinding;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.input_lu_prod.adapter.DialogInputLUProdTipoColloAdapter;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.input_lu_prod.adapter.DialogInputLUProdTipoColloListModel;
|
||||||
|
|
||||||
|
public class InfoAggiuntiveLUDialog extends BaseDialogFragment implements InfoAggiuntiveLUDialogViewModel.Listener {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
InfoAggiuntiveLUDialogViewModel mViewModel;
|
||||||
|
|
||||||
|
private DialogNoteAggiuntiveNuovaUlBinding mBindings;
|
||||||
|
private final RunnableArgss<String, MtbTCol> mOnComplete;
|
||||||
|
|
||||||
|
private DialogInputLUProdTipoColloAdapter codTcolArrayAdapter = null;
|
||||||
|
public ObservableField<String> additionalNotes = new ObservableField<>();
|
||||||
|
public ObservableField<String> selectedMtbTcol = new ObservableField<>();
|
||||||
|
public ObservableField<DialogInputLUProdTipoColloListModel> currentMtbTCol = new ObservableField<>();
|
||||||
|
|
||||||
|
public static InfoAggiuntiveLUDialog newInstance(@NotNull RunnableArgss<String, MtbTCol> onComplete) {
|
||||||
|
return new InfoAggiuntiveLUDialog(onComplete);
|
||||||
|
}
|
||||||
|
|
||||||
|
private InfoAggiuntiveLUDialog(@NotNull RunnableArgss<String, MtbTCol> onComplete) {
|
||||||
|
super();
|
||||||
|
this.mOnComplete = onComplete;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStart() {
|
||||||
|
super.onStart();
|
||||||
|
this.init();
|
||||||
|
|
||||||
|
UtilityDialog.setTo90PercentWidth(requireActivity(), this);
|
||||||
|
this.mViewModel.setListener(this);
|
||||||
|
this.mViewModel.init();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
|
mBindings = DataBindingUtil.inflate(inflater, R.layout.dialog_note_aggiuntive_nuova_ul, container, false);
|
||||||
|
mBindings.setLifecycleOwner(this);
|
||||||
|
|
||||||
|
MainApplication.appComponent
|
||||||
|
.infoAggiuntiveLUDialogComponent()
|
||||||
|
.create()
|
||||||
|
.inject(this);
|
||||||
|
|
||||||
|
mBindings.setView(this);
|
||||||
|
mBindings.setViewModel(this.mViewModel);
|
||||||
|
|
||||||
|
getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||||
|
getDialog().setCanceledOnTouchOutside(false);
|
||||||
|
getDialog().setCancelable(false);
|
||||||
|
getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
|
||||||
|
|
||||||
|
|
||||||
|
return mBindings.getRoot();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDismiss(@NonNull DialogInterface dialog) {
|
||||||
|
if (mOnComplete != null)
|
||||||
|
mOnComplete.run(additionalNotes.get(), mViewModel.getInternalTipoPed());
|
||||||
|
super.onDismiss(dialog);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void init() {
|
||||||
|
|
||||||
|
|
||||||
|
UtilityObservable.addPropertyChanged(this.selectedMtbTcol, (value) -> {
|
||||||
|
if (this.codTcolArrayAdapter != null && this.codTcolArrayAdapter.getDataset() != null) {
|
||||||
|
Optional<DialogInputLUProdTipoColloListModel> selectedItem = Stream.of(this.codTcolArrayAdapter.getDataset())
|
||||||
|
.filter(x -> x.toString().equals(value))
|
||||||
|
.findFirst();
|
||||||
|
|
||||||
|
if (selectedItem.isPresent()) {
|
||||||
|
currentMtbTCol.set(selectedItem.get());
|
||||||
|
this.mViewModel.setInternalTipoPed(selectedItem.get().getOriginalModel());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.mViewModel.getTipiCollo().observe(getViewLifecycleOwner(), tipiCollo -> {
|
||||||
|
|
||||||
|
codTcolArrayAdapter = new DialogInputLUProdTipoColloAdapter(getActivity(), R.layout.array_adapter_single_item, tipiCollo);
|
||||||
|
mBindings.filledExposedDropdownCodTcol.setAdapter(codTcolArrayAdapter);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
this.mBindings.filledExposedDropdownCodTcol.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||||
|
@Override
|
||||||
|
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
|
||||||
|
currentMtbTCol.set(codTcolArrayAdapter.getItem(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNothingSelected(AdapterView<?> adapterView) {
|
||||||
|
currentMtbTCol.set(null);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
mBindings.buttonConfirm.setOnClickListener(v -> {
|
||||||
|
dismiss();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package it.integry.integrywmsnative.view.dialogs.info_aggiuntive_lu;
|
||||||
|
|
||||||
|
import dagger.Subcomponent;
|
||||||
|
|
||||||
|
@Subcomponent
|
||||||
|
public interface InfoAggiuntiveLUDialogComponent {
|
||||||
|
|
||||||
|
@Subcomponent.Factory
|
||||||
|
interface Factory {
|
||||||
|
InfoAggiuntiveLUDialogComponent create();
|
||||||
|
}
|
||||||
|
|
||||||
|
void inject(InfoAggiuntiveLUDialog infoAggiuntiveLUDialog);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package it.integry.integrywmsnative.view.dialogs.info_aggiuntive_lu;
|
||||||
|
|
||||||
|
import dagger.Module;
|
||||||
|
import dagger.Provides;
|
||||||
|
import it.integry.integrywmsnative.core.rest.consumers.MagazzinoRESTConsumer;
|
||||||
|
|
||||||
|
@Module(subcomponents = InfoAggiuntiveLUDialogComponent.class)
|
||||||
|
public class InfoAggiuntiveLUDialogModule {
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
InfoAggiuntiveLUDialogViewModel providesInfoAggiuntiveLUDialogViewModel(MagazzinoRESTConsumer magazzinoRESTConsumer) {
|
||||||
|
return new InfoAggiuntiveLUDialogViewModel(magazzinoRESTConsumer);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
package it.integry.integrywmsnative.view.dialogs.info_aggiuntive_lu;
|
||||||
|
|
||||||
|
import androidx.lifecycle.MutableLiveData;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
|
||||||
|
import it.integry.integrywmsnative.core.model.MtbTCol;
|
||||||
|
import it.integry.integrywmsnative.core.rest.consumers.MagazzinoRESTConsumer;
|
||||||
|
|
||||||
|
public class InfoAggiuntiveLUDialogViewModel {
|
||||||
|
|
||||||
|
public final MutableLiveData<List<MtbTCol>> tipiCollo = new MutableLiveData<>();
|
||||||
|
|
||||||
|
private MtbTCol internalTipoPed;
|
||||||
|
|
||||||
|
private Listener mListener;
|
||||||
|
|
||||||
|
private final MagazzinoRESTConsumer mMagazzinoRESTConsumer;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public InfoAggiuntiveLUDialogViewModel(MagazzinoRESTConsumer magazzinoRESTConsumer) {
|
||||||
|
this.mMagazzinoRESTConsumer = magazzinoRESTConsumer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void init() {
|
||||||
|
new Thread(this::sendOnLoadingStarted).start();
|
||||||
|
|
||||||
|
mMagazzinoRESTConsumer.getTipiCollo(tipiCollo -> {
|
||||||
|
this.tipiCollo.postValue(tipiCollo);
|
||||||
|
this.sendOnLoadingEnded();
|
||||||
|
}, this::sendError);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MutableLiveData<List<MtbTCol>> getTipiCollo() {
|
||||||
|
return this.tipiCollo;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setInternalTipoPed(MtbTCol internalTipoPed) {
|
||||||
|
this.internalTipoPed = internalTipoPed;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public MtbTCol getInternalTipoPed() {
|
||||||
|
return internalTipoPed;
|
||||||
|
}
|
||||||
|
|
||||||
|
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 void setListener(Listener listener) {
|
||||||
|
this.mListener = listener;
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface Listener extends ILoadingListener {
|
||||||
|
|
||||||
|
void onError(Exception ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -100,7 +100,6 @@ public class DialogInputLUProdView extends BaseDialogFragment implements DialogI
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@@ -154,12 +153,12 @@ public class DialogInputLUProdView extends BaseDialogFragment implements DialogI
|
|||||||
});
|
});
|
||||||
|
|
||||||
UtilityObservable.addPropertyChanged(this.selectedMtbTcol, (value) -> {
|
UtilityObservable.addPropertyChanged(this.selectedMtbTcol, (value) -> {
|
||||||
if(this.codTcolArrayAdapter != null && this.codTcolArrayAdapter.getDataset() != null) {
|
if (this.codTcolArrayAdapter != null && this.codTcolArrayAdapter.getDataset() != null) {
|
||||||
Optional<DialogInputLUProdTipoColloListModel> selectedItem = Stream.of(this.codTcolArrayAdapter.getDataset())
|
Optional<DialogInputLUProdTipoColloListModel> selectedItem = Stream.of(this.codTcolArrayAdapter.getDataset())
|
||||||
.filter(x -> x.toString().equals(value))
|
.filter(x -> x.toString().equals(value))
|
||||||
.findFirst();
|
.findFirst();
|
||||||
|
|
||||||
if(selectedItem.isPresent()) {
|
if (selectedItem.isPresent()) {
|
||||||
currentMtbTCol.set(selectedItem.get());
|
currentMtbTCol.set(selectedItem.get());
|
||||||
this.mViewModel.setInternalTipoPed(selectedItem.get().getOriginalModel());
|
this.mViewModel.setInternalTipoPed(selectedItem.get().getOriginalModel());
|
||||||
}
|
}
|
||||||
@@ -171,12 +170,12 @@ public class DialogInputLUProdView extends BaseDialogFragment implements DialogI
|
|||||||
});
|
});
|
||||||
|
|
||||||
UtilityObservable.addPropertyChanged(this.selectedLineaProd, (value) -> {
|
UtilityObservable.addPropertyChanged(this.selectedLineaProd, (value) -> {
|
||||||
if(this.lineeProdArrayAdapter != null && this.lineeProdArrayAdapter.getDataset() != null) {
|
if (this.lineeProdArrayAdapter != null && this.lineeProdArrayAdapter.getDataset() != null) {
|
||||||
Optional<DialogInputLULineeProdListModel> selectedItem = Stream.of(this.lineeProdArrayAdapter.getDataset())
|
Optional<DialogInputLULineeProdListModel> selectedItem = Stream.of(this.lineeProdArrayAdapter.getDataset())
|
||||||
.filter(x -> x.toString().equals(value))
|
.filter(x -> x.toString().equals(value))
|
||||||
.findFirst();
|
.findFirst();
|
||||||
|
|
||||||
if(selectedItem.isPresent()) {
|
if (selectedItem.isPresent()) {
|
||||||
currentLineaProd.set(selectedItem.get());
|
currentLineaProd.set(selectedItem.get());
|
||||||
this.mViewModel.setInternalLineaProd(selectedItem.get().getOriginalModel());
|
this.mViewModel.setInternalLineaProd(selectedItem.get().getOriginalModel());
|
||||||
}
|
}
|
||||||
@@ -196,7 +195,7 @@ public class DialogInputLUProdView extends BaseDialogFragment implements DialogI
|
|||||||
});
|
});
|
||||||
|
|
||||||
UtilityObservable.addPropertyChanged(this.currentPesoNetto, (value) -> {
|
UtilityObservable.addPropertyChanged(this.currentPesoNetto, (value) -> {
|
||||||
if(value != null) {
|
if (value != null) {
|
||||||
this.currentPesoNetto.set(value.setScale(0, RoundingMode.HALF_UP));
|
this.currentPesoNetto.set(value.setScale(0, RoundingMode.HALF_UP));
|
||||||
}
|
}
|
||||||
if (this.mEnableDataCallback) {
|
if (this.mEnableDataCallback) {
|
||||||
@@ -217,7 +216,7 @@ public class DialogInputLUProdView extends BaseDialogFragment implements DialogI
|
|||||||
});
|
});
|
||||||
|
|
||||||
UtilityObservable.addPropertyChanged(this.currentPesoLordo, (value) -> {
|
UtilityObservable.addPropertyChanged(this.currentPesoLordo, (value) -> {
|
||||||
if(value != null) {
|
if (value != null) {
|
||||||
this.currentPesoLordo.set(value.setScale(0, RoundingMode.HALF_UP));
|
this.currentPesoLordo.set(value.setScale(0, RoundingMode.HALF_UP));
|
||||||
}
|
}
|
||||||
if (this.mEnableDataCallback) {
|
if (this.mEnableDataCallback) {
|
||||||
@@ -322,12 +321,12 @@ public class DialogInputLUProdView extends BaseDialogFragment implements DialogI
|
|||||||
codTcolArrayAdapter = new DialogInputLUProdTipoColloAdapter(getActivity(), R.layout.array_adapter_single_item, tipiCollo);
|
codTcolArrayAdapter = new DialogInputLUProdTipoColloAdapter(getActivity(), R.layout.array_adapter_single_item, tipiCollo);
|
||||||
mBindings.filledExposedDropdownCodTcol.setAdapter(codTcolArrayAdapter);
|
mBindings.filledExposedDropdownCodTcol.setAdapter(codTcolArrayAdapter);
|
||||||
|
|
||||||
if(mDialogInputLUProdDTO.getCodTcol() != null) {
|
if (mDialogInputLUProdDTO.getCodTcol() != null) {
|
||||||
Optional<MtbTCol> optTCol = Stream.of(tipiCollo)
|
Optional<MtbTCol> optTCol = Stream.of(tipiCollo)
|
||||||
.filter(x -> x.getCodTcol().equalsIgnoreCase(mDialogInputLUProdDTO.getCodTcol()))
|
.filter(x -> x.getCodTcol().equalsIgnoreCase(mDialogInputLUProdDTO.getCodTcol()))
|
||||||
.findFirst();
|
.findFirst();
|
||||||
|
|
||||||
if(optTCol.isPresent())
|
if (optTCol.isPresent())
|
||||||
selectedMtbTcol.set(new DialogInputLUProdTipoColloListModel().setOriginalModel(optTCol.get()).toString());
|
selectedMtbTcol.set(new DialogInputLUProdTipoColloListModel().setOriginalModel(optTCol.get()).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -341,12 +340,12 @@ public class DialogInputLUProdView extends BaseDialogFragment implements DialogI
|
|||||||
lineeProdArrayAdapter = new DialogInputLULineeProdAdapter(getActivity(), R.layout.array_adapter_single_item, lineeProd);
|
lineeProdArrayAdapter = new DialogInputLULineeProdAdapter(getActivity(), R.layout.array_adapter_single_item, lineeProd);
|
||||||
mBindings.filledExposedDropdownCodJfas.setAdapter(lineeProdArrayAdapter);
|
mBindings.filledExposedDropdownCodJfas.setAdapter(lineeProdArrayAdapter);
|
||||||
|
|
||||||
if(mDialogInputLUProdDTO.getSuggestedCodJfas() != null) {
|
if (mDialogInputLUProdDTO.getSuggestedCodJfas() != null) {
|
||||||
Optional<JtbFasi> optFas = Stream.of(lineeProd)
|
Optional<JtbFasi> optFas = Stream.of(lineeProd)
|
||||||
.filter(x -> x.getCodJfas().equalsIgnoreCase(mDialogInputLUProdDTO.getSuggestedCodJfas()))
|
.filter(x -> x.getCodJfas().equalsIgnoreCase(mDialogInputLUProdDTO.getSuggestedCodJfas()))
|
||||||
.findFirst();
|
.findFirst();
|
||||||
|
|
||||||
if(optFas.isPresent())
|
if (optFas.isPresent())
|
||||||
selectedLineaProd.set(new DialogInputLULineeProdListModel().setOriginalModel(optFas.get()).toString());
|
selectedLineaProd.set(new DialogInputLULineeProdListModel().setOriginalModel(optFas.get()).toString());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -372,9 +371,6 @@ public class DialogInputLUProdView extends BaseDialogFragment implements DialogI
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void resetValues() {
|
public void resetValues() {
|
||||||
this.mViewModel.blockedNumCnf.set(false);
|
this.mViewModel.blockedNumCnf.set(false);
|
||||||
this.mViewModel.blockedPesoLordo.set(false);
|
this.mViewModel.blockedPesoLordo.set(false);
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import android.view.LayoutInflater;
|
|||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
|
|
||||||
import androidx.databinding.DataBindingUtil;
|
import androidx.databinding.DataBindingUtil;
|
||||||
|
import androidx.fragment.app.FragmentActivity;
|
||||||
|
|
||||||
import com.annimon.stream.Optional;
|
import com.annimon.stream.Optional;
|
||||||
import com.annimon.stream.Stream;
|
import com.annimon.stream.Stream;
|
||||||
@@ -24,24 +25,25 @@ import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
|||||||
import it.integry.integrywmsnative.core.utility.UtilityNumber;
|
import it.integry.integrywmsnative.core.utility.UtilityNumber;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityProgress;
|
import it.integry.integrywmsnative.core.utility.UtilityProgress;
|
||||||
import it.integry.integrywmsnative.databinding.DialogInputPesoLuBinding;
|
import it.integry.integrywmsnative.databinding.DialogInputPesoLuBinding;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.DialogProgressView;
|
||||||
|
|
||||||
public class DialogInputPeso {
|
public class DialogInputPeso {
|
||||||
|
|
||||||
|
|
||||||
private Context mContext;
|
private final FragmentActivity mContext;
|
||||||
private DialogInputPesoLuBinding mBindings;
|
private final DialogInputPesoLuBinding mBindings;
|
||||||
private DialogInputPesoViewModel mViewModel;
|
private final DialogInputPesoViewModel mViewModel;
|
||||||
private Dialog currentDialog;
|
private final Dialog currentDialog;
|
||||||
|
|
||||||
private List<MtbTCol> codTcolList = null;
|
private List<MtbTCol> codTcolList = null;
|
||||||
private ArrayAdapter<String> codTcolArrayAdapter = null;
|
private ArrayAdapter<String> codTcolArrayAdapter = null;
|
||||||
|
|
||||||
public static Dialog make(final Context context, String codTcol, BigDecimal netWeight, BigDecimal grossWeight, RunnableArgsss<String, BigDecimal, BigDecimal> onDialogDismiss) {
|
public static Dialog make(final FragmentActivity context, String codTcol, BigDecimal netWeight, BigDecimal grossWeight, RunnableArgsss<String, BigDecimal, BigDecimal> onDialogDismiss) {
|
||||||
return new DialogInputPeso(context, codTcol, netWeight, grossWeight, onDialogDismiss).currentDialog;
|
return new DialogInputPeso(context, codTcol, netWeight, grossWeight, onDialogDismiss).currentDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private DialogInputPeso(final Context context, String codTcol, BigDecimal netWeight, BigDecimal grossWeight, RunnableArgsss<String, BigDecimal, BigDecimal> onDialogDismiss) {
|
private DialogInputPeso(final FragmentActivity context, String codTcol, BigDecimal netWeight, BigDecimal grossWeight, RunnableArgsss<String, BigDecimal, BigDecimal> onDialogDismiss) {
|
||||||
this.mContext = context;
|
this.mContext = context;
|
||||||
|
|
||||||
|
|
||||||
@@ -91,7 +93,7 @@ public class DialogInputPeso {
|
|||||||
|
|
||||||
private void init() {
|
private void init() {
|
||||||
|
|
||||||
final Dialog progressDialog = UtilityProgress.createDefaultProgressDialog(mContext);
|
final DialogProgressView progressDialog = UtilityProgress.createDefaultProgressDialog(mContext);
|
||||||
|
|
||||||
MagazzinoRESTConsumer.getTipiColloStatic(codTcols -> {
|
MagazzinoRESTConsumer.getTipiColloStatic(codTcols -> {
|
||||||
this.codTcolList = codTcols;
|
this.codTcolList = codTcols;
|
||||||
|
|||||||
@@ -3,8 +3,6 @@ package it.integry.integrywmsnative.view.dialogs.input_quantity_v2;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.res.ColorStateList;
|
import android.content.res.ColorStateList;
|
||||||
import android.graphics.Color;
|
|
||||||
import android.graphics.drawable.ColorDrawable;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
import android.text.InputType;
|
import android.text.InputType;
|
||||||
@@ -12,9 +10,7 @@ import android.text.SpannableString;
|
|||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.WindowManager;
|
|
||||||
import android.view.inputmethod.EditorInfo;
|
import android.view.inputmethod.EditorInfo;
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
@@ -27,12 +23,12 @@ import com.google.android.material.textfield.TextInputLayout;
|
|||||||
import com.pedromassango.doubleclick.DoubleClick;
|
import com.pedromassango.doubleclick.DoubleClick;
|
||||||
import com.pedromassango.doubleclick.DoubleClickListener;
|
import com.pedromassango.doubleclick.DoubleClickListener;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
||||||
import it.integry.integrywmsnative.MainApplication;
|
import it.integry.integrywmsnative.MainApplication;
|
||||||
@@ -42,14 +38,15 @@ import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
|||||||
import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
|
import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgss;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgss;
|
||||||
|
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||||
import it.integry.integrywmsnative.core.model.MtbUntMis;
|
import it.integry.integrywmsnative.core.model.MtbUntMis;
|
||||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityFocus;
|
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityObservable;
|
import it.integry.integrywmsnative.core.utility.UtilityObservable;
|
||||||
import it.integry.integrywmsnative.databinding.DialogInputQuantityV2Binding;
|
import it.integry.integrywmsnative.databinding.DialogInputQuantityV2Binding;
|
||||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||||
|
|
||||||
|
@Singleton
|
||||||
public class DialogInputQuantityV2View extends BaseDialogFragment implements DialogInputQuantityV2ViewModel.Listener {
|
public class DialogInputQuantityV2View extends BaseDialogFragment implements DialogInputQuantityV2ViewModel.Listener {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
@@ -59,6 +56,9 @@ public class DialogInputQuantityV2View extends BaseDialogFragment implements Dia
|
|||||||
private RunnableArgss<DialogInputQuantityV2ResultDTO, Boolean> mOnComplete;
|
private RunnableArgss<DialogInputQuantityV2ResultDTO, Boolean> mOnComplete;
|
||||||
private Runnable mOnAbort;
|
private Runnable mOnAbort;
|
||||||
|
|
||||||
|
public ObservableField<Integer> currentTextNumCnfToTake = new ObservableField<>(0);
|
||||||
|
public ObservableField<Integer> currentTextNumPezziToTake = new ObservableField<>(0);
|
||||||
|
|
||||||
public ObservableField<String> currentPartitaMag = new ObservableField<>();
|
public ObservableField<String> currentPartitaMag = new ObservableField<>();
|
||||||
public ObservableField<String> currentNotes = new ObservableField<>();
|
public ObservableField<String> currentNotes = new ObservableField<>();
|
||||||
public ObservableField<Date> currentDataScad = new ObservableField<>();
|
public ObservableField<Date> currentDataScad = new ObservableField<>();
|
||||||
@@ -67,9 +67,14 @@ public class DialogInputQuantityV2View extends BaseDialogFragment implements Dia
|
|||||||
public ObservableField<BigDecimal> currentQtaCnf = new ObservableField<>();
|
public ObservableField<BigDecimal> currentQtaCnf = new ObservableField<>();
|
||||||
public ObservableField<BigDecimal> currentQtaTot = new ObservableField<>();
|
public ObservableField<BigDecimal> currentQtaTot = new ObservableField<>();
|
||||||
|
|
||||||
|
public ObservableField<BigDecimal> currentTaraTot = new ObservableField<>();
|
||||||
|
public ObservableField<BigDecimal> currentTaraArticolo = new ObservableField<>();
|
||||||
|
public ObservableField<BigDecimal> currentPesoLordo = new ObservableField<>();
|
||||||
|
|
||||||
public ObservableField<Boolean> enabledNumCnf = new ObservableField<>(true);
|
public ObservableField<Boolean> enabledNumCnf = new ObservableField<>(true);
|
||||||
public ObservableField<Boolean> enabledQtaCnf = new ObservableField<>(true);
|
public ObservableField<Boolean> enabledQtaCnf = new ObservableField<>(true);
|
||||||
public ObservableField<Boolean> enabledQtaTot = new ObservableField<>(true);
|
public ObservableField<Boolean> enabledQtaTot = new ObservableField<>(true);
|
||||||
|
public ObservableField<Boolean> enabledPesoLordo = new ObservableField<>(false);
|
||||||
|
|
||||||
public ObservableField<Boolean> enabledChangePartitaMag = new ObservableField<>(true);
|
public ObservableField<Boolean> enabledChangePartitaMag = new ObservableField<>(true);
|
||||||
public ObservableField<Boolean> enabledNotes = new ObservableField<>(false);
|
public ObservableField<Boolean> enabledNotes = new ObservableField<>(false);
|
||||||
@@ -81,17 +86,22 @@ public class DialogInputQuantityV2View extends BaseDialogFragment implements Dia
|
|||||||
private boolean mEnableDataCallback = true;
|
private boolean mEnableDataCallback = true;
|
||||||
|
|
||||||
private int mBarcodeScannerIstanceID;
|
private int mBarcodeScannerIstanceID;
|
||||||
|
private boolean mFirstStart = true;
|
||||||
|
|
||||||
public static DialogInputQuantityV2View newInstance(@NotNull DialogInputQuantityV2DTO dialogInputQuantityV2DTO, @NotNull RunnableArgss<DialogInputQuantityV2ResultDTO, Boolean> onComplete, @NotNull Runnable onAbort) {
|
|
||||||
return new DialogInputQuantityV2View(dialogInputQuantityV2DTO, onComplete, onAbort);
|
public DialogInputQuantityV2View setDialogInputQuantityV2DTO(DialogInputQuantityV2DTO mDialogInputQuantityV2DTO) {
|
||||||
|
this.mDialogInputQuantityV2DTO = mDialogInputQuantityV2DTO;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
private DialogInputQuantityV2View(@NotNull DialogInputQuantityV2DTO dialogInputQuantityV2DTO, @NotNull RunnableArgss<DialogInputQuantityV2ResultDTO, Boolean> onComplete, @NotNull Runnable onAbort) {
|
public DialogInputQuantityV2View setOnComplete(RunnableArgss<DialogInputQuantityV2ResultDTO, Boolean> mOnComplete) {
|
||||||
super();
|
this.mOnComplete = mOnComplete;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
this.mDialogInputQuantityV2DTO = dialogInputQuantityV2DTO;
|
public DialogInputQuantityV2View setOnAbort(Runnable mOnAbort) {
|
||||||
this.mOnComplete = onComplete;
|
this.mOnAbort = mOnAbort;
|
||||||
this.mOnAbort = onAbort;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -144,7 +154,7 @@ public class DialogInputQuantityV2View extends BaseDialogFragment implements Dia
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (mDialogInputQuantityV2DTO.isSaveOnImeDone()){
|
if (mDialogInputQuantityV2DTO.isSaveOnImeDone()) {
|
||||||
|
|
||||||
mBindings.inputNumCnfText.setOnEditorActionListener((v, actionId, event) -> {
|
mBindings.inputNumCnfText.setOnEditorActionListener((v, actionId, event) -> {
|
||||||
if (actionId == EditorInfo.IME_ACTION_DONE) {
|
if (actionId == EditorInfo.IME_ACTION_DONE) {
|
||||||
@@ -154,6 +164,7 @@ public class DialogInputQuantityV2View extends BaseDialogFragment implements Dia
|
|||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
this.onLoadingEnded();
|
||||||
return mBindings.getRoot();
|
return mBindings.getRoot();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -197,7 +208,11 @@ public class DialogInputQuantityV2View extends BaseDialogFragment implements Dia
|
|||||||
@Override
|
@Override
|
||||||
public void onStart() {
|
public void onStart() {
|
||||||
super.onStart();
|
super.onStart();
|
||||||
this.init();
|
|
||||||
|
if(!mFirstStart) {
|
||||||
|
this.init();
|
||||||
|
mFirstStart = false;
|
||||||
|
}
|
||||||
|
|
||||||
int onNumCnfInputChanged = SettingsManager.iDB().getOnNumCnfInputChanged();
|
int onNumCnfInputChanged = SettingsManager.iDB().getOnNumCnfInputChanged();
|
||||||
|
|
||||||
@@ -206,21 +221,41 @@ public class DialogInputQuantityV2View extends BaseDialogFragment implements Dia
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void init() {
|
private void init() {
|
||||||
|
|
||||||
UtilityObservable.addPropertyChanged(this.currentPartitaMag, (value) -> {
|
UtilityObservable.addPropertyChanged(this.currentPartitaMag, (value) -> {
|
||||||
if (this.mEnableDataCallback) {
|
if (this.mEnableDataCallback) {
|
||||||
this.mViewModel.setPartitaMag(value);
|
this.mViewModel.setPartitaMag(value);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
UtilityObservable.addPropertyChanged(this.currentNotes, (value) -> {
|
UtilityObservable.addPropertyChanged(this.currentDataScad, (value) -> {
|
||||||
if (this.mEnableDataCallback) {
|
if (this.mEnableDataCallback) {
|
||||||
this.mViewModel.setNote(value);
|
MtbAart mtbAart = this.mViewModel.getMtbAart();
|
||||||
|
if (value != null && mtbAart != null && mtbAart.getGgScadPartita() != null && mtbAart.getGgScadPartita() > 0) {
|
||||||
|
Calendar calendar = Calendar.getInstance();
|
||||||
|
calendar.add(Calendar.DATE, mtbAart.getGgScadPartita());
|
||||||
|
Date minDataScad = calendar.getTime();
|
||||||
|
if (minDataScad.after(value) && value.after(new Date())) {
|
||||||
|
DialogSimpleMessageView
|
||||||
|
.makeWarningDialog(new SpannableString("La data selezionata è precedente alla data di scadenza consigliata per l'articolo scelto ( " + mtbAart.getGgScadPartita() + " giorni) . Continuare?"), null, () -> {
|
||||||
|
this.mViewModel.setDataScad(value);
|
||||||
|
}, () -> {
|
||||||
|
this.currentDataScad.set(null);
|
||||||
|
})
|
||||||
|
.show(requireActivity().getSupportFragmentManager(), "tag");
|
||||||
|
} else {
|
||||||
|
this.mViewModel.setDataScad(value);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.mViewModel.setDataScad(value);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
UtilityObservable.addPropertyChanged(this.currentDataScad, (value) -> {
|
UtilityObservable.addPropertyChanged(this.currentNotes, (value) -> {
|
||||||
if (this.mEnableDataCallback) {
|
if (this.mEnableDataCallback) {
|
||||||
this.mViewModel.setDataScad(value);
|
this.mViewModel.setNote(value);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -351,6 +386,18 @@ public class DialogInputQuantityV2View extends BaseDialogFragment implements Dia
|
|||||||
this.mViewModel.shouldAskDataScad = this.mDialogInputQuantityV2DTO.isDataScadMandatory();
|
this.mViewModel.shouldAskDataScad = this.mDialogInputQuantityV2DTO.isDataScadMandatory();
|
||||||
this.enabledNotes.set(this.mDialogInputQuantityV2DTO.isNotesAllowed());
|
this.enabledNotes.set(this.mDialogInputQuantityV2DTO.isNotesAllowed());
|
||||||
this.enabledLUCloseButton.set(this.mDialogInputQuantityV2DTO.isCanLUBeClosed());
|
this.enabledLUCloseButton.set(this.mDialogInputQuantityV2DTO.isCanLUBeClosed());
|
||||||
|
this.currentTaraArticolo.set(this.mViewModel.getMtbAart().getTaraKg());
|
||||||
|
|
||||||
|
if (this.mDialogInputQuantityV2DTO.getTotalNumCnfOrd() != null && !this.mDialogInputQuantityV2DTO.getTotalNumCnfOrd().equals(BigDecimal.ZERO) && !(this.mDialogInputQuantityV2DTO.getTotalNumCnfOrd().intValue() == 0)) {
|
||||||
|
this.currentTextNumCnfToTake.set(this.mDialogInputQuantityV2DTO.getTotalNumCnfOrd().intValue());
|
||||||
|
int qtaText = this.mDialogInputQuantityV2DTO.getTotalQtaOrd().intValue() % this.mDialogInputQuantityV2DTO.getTotalNumCnfOrd().intValue();
|
||||||
|
this.currentTextNumPezziToTake.set(qtaText);
|
||||||
|
} else {
|
||||||
|
this.currentTextNumCnfToTake.set(0);
|
||||||
|
this.currentTextNumPezziToTake.set(0);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -376,11 +423,17 @@ public class DialogInputQuantityV2View extends BaseDialogFragment implements Dia
|
|||||||
this.currentPartitaMag.set(this.mViewModel.getPartitaMag());
|
this.currentPartitaMag.set(this.mViewModel.getPartitaMag());
|
||||||
this.currentNotes.set(this.mViewModel.getNote());
|
this.currentNotes.set(this.mViewModel.getNote());
|
||||||
this.currentDataScad.set(this.mViewModel.getDataScad());
|
this.currentDataScad.set(this.mViewModel.getDataScad());
|
||||||
|
|
||||||
this.currentNumCnf.set(this.mViewModel.getNumCnf());
|
this.currentNumCnf.set(this.mViewModel.getNumCnf());
|
||||||
this.currentQtaCnf.set(this.mViewModel.getQtaCnf());
|
this.currentQtaCnf.set(this.mViewModel.getQtaCnf());
|
||||||
this.currentQtaTot.set(this.mViewModel.getQtaTot());
|
this.currentQtaTot.set(this.mViewModel.getQtaTot());
|
||||||
|
|
||||||
|
MtbAart articolo = this.mViewModel.getMtbAart();
|
||||||
|
if (articolo != null && !articolo.isFlagQtaCnfFissaBoolean()) {
|
||||||
|
BigDecimal taraTot = this.mViewModel.getNumCnf().multiply(articolo.getTaraKg());
|
||||||
|
this.currentTaraTot.set(taraTot);
|
||||||
|
this.currentPesoLordo.set(this.mViewModel.getQtaTot().add(taraTot));
|
||||||
|
}
|
||||||
|
|
||||||
this.mBindings.executePendingBindings();
|
this.mBindings.executePendingBindings();
|
||||||
|
|
||||||
this.mEnableDataCallback = true;
|
this.mEnableDataCallback = true;
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ public class DialogInputQuantityV2ViewModel {
|
|||||||
private String internalNote;
|
private String internalNote;
|
||||||
private Date internalDataScad;
|
private Date internalDataScad;
|
||||||
|
|
||||||
private RunnableArgsWithReturn<DialogInputQuantityV2ViewModel,String> suggestPartitaMagRunnable;
|
private RunnableArgsWithReturn<DialogInputQuantityV2ViewModel, String> suggestPartitaMagRunnable;
|
||||||
|
|
||||||
private boolean canOverflowOrderQuantity;
|
private boolean canOverflowOrderQuantity;
|
||||||
private boolean canPartitaMagBeChanged;
|
private boolean canPartitaMagBeChanged;
|
||||||
@@ -102,7 +102,7 @@ public class DialogInputQuantityV2ViewModel {
|
|||||||
this.internalQtaTot = totalQtaOrd;
|
this.internalQtaTot = totalQtaOrd;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.shouldAskDataScad == null){
|
if (this.shouldAskDataScad == null) {
|
||||||
this.shouldAskDataScad = mtbAart.get().isFlagTracciabilitaBoolean() && mtbAart.get().getGgScadPartita() != null && mtbAart.get().getGgScadPartita() > 0;
|
this.shouldAskDataScad = mtbAart.get().isFlagTracciabilitaBoolean() && mtbAart.get().getGgScadPartita() != null && mtbAart.get().getGgScadPartita() > 0;
|
||||||
}
|
}
|
||||||
this.shouldShowDataScad = this.shouldAskDataScad || this.internalDataScad != null;
|
this.shouldShowDataScad = this.shouldAskDataScad || this.internalDataScad != null;
|
||||||
@@ -151,7 +151,7 @@ public class DialogInputQuantityV2ViewModel {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(canPartitaMagBeChanged) {
|
if (canPartitaMagBeChanged) {
|
||||||
|
|
||||||
if (!UtilityString.isNullOrEmpty(ean128Model.BatchLot)) {
|
if (!UtilityString.isNullOrEmpty(ean128Model.BatchLot)) {
|
||||||
this.setPartitaMag(ean128Model.BatchLot);
|
this.setPartitaMag(ean128Model.BatchLot);
|
||||||
@@ -334,10 +334,11 @@ public class DialogInputQuantityV2ViewModel {
|
|||||||
this.internalQtaTot = UtilityBigDecimal.multiply(newValue, this.internalQtaCnf);
|
this.internalQtaTot = UtilityBigDecimal.multiply(newValue, this.internalQtaCnf);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case UPDATE_QTA_TOT:if (!this.blockedQtaTot.get() && this.internalQtaCnf != null)
|
case UPDATE_QTA_TOT:
|
||||||
this.internalQtaTot = UtilityBigDecimal.multiply(newValue, this.internalQtaCnf);
|
if (!this.blockedQtaTot.get() && this.internalQtaCnf != null)
|
||||||
else if (!this.blockedQtaCnf.get() && !this.mtbAart.get().isFlagQtaCnfFissaBoolean() && this.internalQtaTot != null)
|
this.internalQtaTot = UtilityBigDecimal.multiply(newValue, this.internalQtaCnf);
|
||||||
this.internalQtaCnf = UtilityBigDecimal.divide(internalQtaTot, newValue);
|
else if (!this.blockedQtaCnf.get() && !this.mtbAart.get().isFlagQtaCnfFissaBoolean() && this.internalQtaTot != null)
|
||||||
|
this.internalQtaCnf = UtilityBigDecimal.divide(internalQtaTot, newValue);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -403,13 +404,13 @@ public class DialogInputQuantityV2ViewModel {
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
} else if (mtbAart.get().isFlagTracciabilitaBoolean() && UtilityString.isNullOrEmpty(internalPartitaMag)) {
|
} else if (mtbAart.get().isFlagTracciabilitaBoolean() && UtilityString.isNullOrEmpty(internalPartitaMag)) {
|
||||||
if (suggestPartitaMagRunnable != null){
|
if (suggestPartitaMagRunnable != null) {
|
||||||
internalPartitaMag = suggestPartitaMagRunnable.run(this);
|
internalPartitaMag = suggestPartitaMagRunnable.run(this);
|
||||||
if (internalPartitaMag == null){
|
if (internalPartitaMag == null) {
|
||||||
this.mListener.onError(new InvalidBatchLotException());
|
this.mListener.onError(new InvalidBatchLotException());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
this.mListener.onError(new InvalidBatchLotException());
|
this.mListener.onError(new InvalidBatchLotException());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -480,11 +481,16 @@ public class DialogInputQuantityV2ViewModel {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DialogInputQuantityV2ViewModel setSuggestPartitaMagRunnable(RunnableArgsWithReturn<DialogInputQuantityV2ViewModel,String> suggestPartitaMagRunnable) {
|
public DialogInputQuantityV2ViewModel setSuggestPartitaMagRunnable(RunnableArgsWithReturn<DialogInputQuantityV2ViewModel, String> suggestPartitaMagRunnable) {
|
||||||
this.suggestPartitaMagRunnable = suggestPartitaMagRunnable;
|
this.suggestPartitaMagRunnable = suggestPartitaMagRunnable;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public MtbAart getMtbAart() {
|
||||||
|
return this.mtbAart.get();
|
||||||
|
}
|
||||||
|
|
||||||
public interface Listener {
|
public interface Listener {
|
||||||
void onDataChanged();
|
void onDataChanged();
|
||||||
|
|
||||||
|
|||||||
@@ -1,47 +0,0 @@
|
|||||||
package it.integry.integrywmsnative.view.dialogs.note_aggiuntive_lu;
|
|
||||||
|
|
||||||
import android.app.Dialog;
|
|
||||||
import android.content.Context;
|
|
||||||
|
|
||||||
import android.graphics.Color;
|
|
||||||
import android.graphics.drawable.ColorDrawable;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
|
|
||||||
import androidx.databinding.DataBindingUtil;
|
|
||||||
import it.integry.integrywmsnative.R;
|
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityDialog;
|
|
||||||
import it.integry.integrywmsnative.databinding.DialogNoteAggiuntiveNuovaUlBinding;
|
|
||||||
|
|
||||||
public class NoteAggiuntiveLUDialog {
|
|
||||||
|
|
||||||
private Dialog mDialog;
|
|
||||||
|
|
||||||
public static Dialog make(Context context, final RunnableArgs<String> onComplete) {
|
|
||||||
return new NoteAggiuntiveLUDialog(context, onComplete).mDialog;
|
|
||||||
}
|
|
||||||
|
|
||||||
private NoteAggiuntiveLUDialog(Context context, final RunnableArgs<String> onComplete){
|
|
||||||
|
|
||||||
LayoutInflater inflater = (LayoutInflater) context.getSystemService( Context.LAYOUT_INFLATER_SERVICE );
|
|
||||||
DialogNoteAggiuntiveNuovaUlBinding bindings = DataBindingUtil.inflate(inflater, R.layout.dialog_note_aggiuntive_nuova_ul, null, false);
|
|
||||||
|
|
||||||
|
|
||||||
mDialog = new Dialog(context);
|
|
||||||
mDialog.setContentView(bindings.getRoot());
|
|
||||||
|
|
||||||
mDialog.setCanceledOnTouchOutside(false);
|
|
||||||
mDialog.setCancelable(false);
|
|
||||||
mDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
|
||||||
|
|
||||||
UtilityDialog.setTo90PercentWidth(context, mDialog);
|
|
||||||
|
|
||||||
|
|
||||||
bindings.buttonConfirm.setOnClickListener(v -> {
|
|
||||||
mDialog.dismiss();
|
|
||||||
if(onComplete != null) onComplete.run(bindings.additionalNotesText.getText().toString());
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user