Compare commits
195 Commits
v1.31.05(3
...
v1.33.05(3
| Author | SHA1 | Date | |
|---|---|---|---|
| c34d7dc777 | |||
| 705dd96a0e | |||
| 10128a1bae | |||
| 54d40ca06e | |||
| 6251c0f1ac | |||
| e4aa2d19d9 | |||
| 3caed63b7f | |||
| 75bc046cf5 | |||
| 97d27b047d | |||
| 44e00f4f98 | |||
| 81b053ee06 | |||
| f1b5a7ec1b | |||
| 2d4211d329 | |||
| c5ba78eeda | |||
| 1faaef7062 | |||
| 762c5fd5b5 | |||
| 9af5970ec7 | |||
| 3a5836ba4b | |||
| 72b0e29ae6 | |||
| e0cc802b62 | |||
| 2d4d9cef4e | |||
| 4a8a21b970 | |||
| 5103a53c11 | |||
| 11c4cba70c | |||
| b1dba20973 | |||
| 920c22083b | |||
| f9230ac341 | |||
| 6344c4b77d | |||
| d4c111dedc | |||
| 65dda1d5c0 | |||
| 4a7406fda1 | |||
| ef17e7a0c7 | |||
| c45850555e | |||
| 303690eed2 | |||
| ae62b26edf | |||
| 2e39754c20 | |||
| 0ae6bbcd96 | |||
| 529455931d | |||
| 46d0510ed8 | |||
| b02e12d76e | |||
| c6bbde2b67 | |||
| cfbb27a67b | |||
| 35283fc11b | |||
| c3d62f88b4 | |||
| fc8469bf07 | |||
| 400f1440db | |||
| ad12e7e65b | |||
| a63e3817b5 | |||
| cbd772bf7e | |||
| e90bd46a42 | |||
| 96bd5d516c | |||
| d9306e13c2 | |||
| fc80baeaee | |||
| c0b49b68f7 | |||
| 73242bc208 | |||
| d4b60a51bd | |||
| 1bc687c79a | |||
| 3a6b0949d4 | |||
| bfc03a4ef9 | |||
| 4dfa796790 | |||
| f0db805c84 | |||
| 0cc742e103 | |||
| d01319c417 | |||
| c0b9496041 | |||
| d4e7832f80 | |||
| cb4f9e68f5 | |||
| ac4a5b1d34 | |||
| 39ebc9d367 | |||
| 7ef0299282 | |||
| 6a998d6605 | |||
| 9eb4b0a621 | |||
| f55080f7ca | |||
| 7fb6109e18 | |||
| f419944699 | |||
| 8de54a504b | |||
| 6f2be2b459 | |||
| fa413aba25 | |||
| ab6eeb91a6 | |||
| 16cbe01157 | |||
| 16cb685bb3 | |||
| 28501c5509 | |||
| 79c4bdad48 | |||
| 68007ebc8e | |||
| c5eec26f8d | |||
| 5c3f8d8717 | |||
| 43aa0f0324 | |||
| 4ab7bf27d7 | |||
| 28f4ac4414 | |||
| 60414c949e | |||
| ff09147968 | |||
| 17e66af99a | |||
| 762ab2719d | |||
| 95f282cd4d | |||
| 029979c463 | |||
| e748161dda | |||
| c2c2a1f984 | |||
| fd13f2f1b4 | |||
| ac6cca1eda | |||
| dc46b36624 | |||
| 42aa655021 | |||
| b89085a9c3 | |||
| 557644f024 | |||
| 258ed9d7ca | |||
| be7d3775cc | |||
| 93ffb191b5 | |||
| 8eb58a4d64 | |||
| 4bc8374ea3 | |||
| f76295c3f6 | |||
| b8486b677f | |||
| 1ad2d9ca9b | |||
| a57eadeab3 | |||
| 1c34b120db | |||
| c6c19ca04b | |||
| 987d667350 | |||
| e704bd1597 | |||
| 0f08d704ac | |||
| b340c2270d | |||
| d3c518b7df | |||
| d8a0594600 | |||
| 7af451724a | |||
| 6cbfb1d81b | |||
| a8c28d7624 | |||
| 3c7792febb | |||
| 4f2dfb82e6 | |||
| cd2c04ad0c | |||
| a1d8e98dfe | |||
| 80fb6737fe | |||
| eadd93dfaf | |||
| 12919613ab | |||
| 7da729205c | |||
| 1bfb734139 | |||
| 09ae517903 | |||
| 0735312c98 | |||
| c31e1ae79a | |||
| 3a9b6a99eb | |||
| 3da92d4630 | |||
| 1d54680db6 | |||
| 384214e084 | |||
| 03dc6e93be | |||
| 2ba4e5d11e | |||
| 78c6e98084 | |||
| 968eed44cb | |||
| ee784b27c6 | |||
| bac849324f | |||
| d823856ac5 | |||
| a49ee430e2 | |||
| d8672e1c22 | |||
| d8c6464830 | |||
| af5d19eb55 | |||
| 8fe0a1fd07 | |||
| b0a7a93f85 | |||
| 10f888b5d5 | |||
| 95807fbfbc | |||
| 4317e083a6 | |||
| 0c54a32e39 | |||
| 62dc62aa99 | |||
| 603fd6ad96 | |||
| 2182a970ac | |||
| 9b823fdca8 | |||
| 904c825472 | |||
| a15d225998 | |||
| 62f8ee61d3 | |||
| e3b8373bb9 | |||
| 0cdbbc096c | |||
| 895c21cee4 | |||
| d541761ac6 | |||
| 1df84ba046 | |||
| 72773deaf1 | |||
| 165568b7e3 | |||
| 3396e295fa | |||
| 0f3f593abd | |||
| df48ea3b32 | |||
| 5e52d83c40 | |||
| 0a71f54814 | |||
| c18828cdda | |||
| 92073fa8bb | |||
| 4131dd7e97 | |||
| 3c4fdea0ec | |||
| 71c73e8cde | |||
| 1a66d4f541 | |||
| d9c33dc5f5 | |||
| 1edcba63aa | |||
| 2566311f96 | |||
| c01cbc1bac | |||
| 9c95b107d5 | |||
| c2e1c048be | |||
| c3bfe70093 | |||
| a6cb8c9c9c | |||
| 5908e076a4 | |||
| 4445e9aff2 | |||
| 9cd0855dcf | |||
| d807ab1f31 | |||
| 69b88b1f6d | |||
| 35f1495ebc | |||
| 8322303351 |
@@ -10,8 +10,8 @@ apply plugin: 'com.google.gms.google-services'
|
||||
|
||||
android {
|
||||
|
||||
def appVersionCode = 339
|
||||
def appVersionName = '1.31.05'
|
||||
def appVersionCode = 376
|
||||
def appVersionName = '1.33.05'
|
||||
|
||||
signingConfigs {
|
||||
release {
|
||||
@@ -31,8 +31,6 @@ android {
|
||||
}
|
||||
}
|
||||
|
||||
compileSdkVersion 33
|
||||
|
||||
defaultConfig {
|
||||
applicationId "it.integry.integrywmsnative"
|
||||
minSdkVersion 21
|
||||
@@ -65,8 +63,8 @@ android {
|
||||
android.buildFeatures.buildConfig true
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_11
|
||||
targetCompatibility JavaVersion.VERSION_11
|
||||
sourceCompatibility JavaVersion.VERSION_17
|
||||
targetCompatibility JavaVersion.VERSION_17
|
||||
coreLibraryDesugaringEnabled true
|
||||
}
|
||||
|
||||
@@ -90,8 +88,7 @@ android {
|
||||
abortOnError false
|
||||
}
|
||||
namespace 'it.integry.integrywmsnative'
|
||||
|
||||
|
||||
compileSdk 33
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,14 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<manifest xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
|
||||
|
||||
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
|
||||
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />
|
||||
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
|
||||
|
||||
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"
|
||||
android:maxSdkVersion="32" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
|
||||
android:maxSdkVersion="32"
|
||||
tools:ignore="ScopedStorage" />
|
||||
|
||||
<application
|
||||
android:name=".MainApplication"
|
||||
android:allowBackup="true"
|
||||
@@ -23,28 +33,28 @@
|
||||
android:requestLegacyExternalStorage="true">
|
||||
<activity
|
||||
android:name=".gest.spedizione.SpedizioneActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Light"
|
||||
android:windowSoftInputMode="adjustNothing" />
|
||||
android:windowSoftInputMode="adjustNothing"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden" />
|
||||
<activity
|
||||
android:name=".gest.pv_ordine_acquisto_edit.PVOrdineAcquistoEditActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Light"
|
||||
android:windowSoftInputMode="adjustNothing" />
|
||||
android:windowSoftInputMode="adjustNothing"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden" />
|
||||
<activity
|
||||
android:name=".gest.prod_dettaglio_linea.ProdDettaglioLineaActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Light"
|
||||
android:windowSoftInputMode="adjustNothing" />
|
||||
android:windowSoftInputMode="adjustNothing"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden" />
|
||||
<activity
|
||||
android:name=".gest.contab_doc_interni.edit_form.DocInterniEditFormActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Light"
|
||||
android:windowSoftInputMode="adjustNothing" />
|
||||
android:windowSoftInputMode="adjustNothing"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden" />
|
||||
<activity
|
||||
android:name=".gest.picking_resi.PickingResiActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Light" />
|
||||
android:theme="@style/Light"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden" />
|
||||
<activity
|
||||
android:name=".gest.main.MainActivity"
|
||||
android:theme="@style/Light"
|
||||
@@ -56,30 +66,31 @@
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".gest.accettazione_picking.AccettazionePickingActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Light"
|
||||
android:windowSoftInputMode="adjustNothing" />
|
||||
<activity
|
||||
android:name=".gest.login.LoginActivity"
|
||||
android:theme="@style/Light" />
|
||||
android:theme="@style/Light"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden" />
|
||||
<activity
|
||||
android:name=".gest.accettazione_picking.AccettazionePickingActivity"
|
||||
android:theme="@style/Light"
|
||||
android:windowSoftInputMode="adjustNothing"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden" />
|
||||
<activity
|
||||
android:name=".gest.lista_bancali.ListaBancaliActivity"
|
||||
android:label="@string/activity_lista_bancali_title"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Light" />
|
||||
android:theme="@style/Light"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden" />
|
||||
<activity
|
||||
android:name=".gest.contenuto_bancale.ContenutoBancaleActivity"
|
||||
android:label="@string/activity_contenuto_bancale_title"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Light" />
|
||||
android:theme="@style/Light"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden" />
|
||||
<activity
|
||||
android:name=".gest.inventario.picking.PickingInventarioActivity"
|
||||
android:label="@string/activity_picking_inventario_title"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustNothing"
|
||||
android:theme="@style/Light"/>
|
||||
android:theme="@style/Light"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden"/>
|
||||
|
||||
<meta-data
|
||||
android:name="firebase_crashlytics_collection_enabled"
|
||||
|
||||
@@ -70,19 +70,19 @@ public class MainApplication extends Application {
|
||||
|
||||
|
||||
// handler listener
|
||||
private Thread.UncaughtExceptionHandler _unCaughtExceptionHandler =
|
||||
private final Thread.UncaughtExceptionHandler _unCaughtExceptionHandler =
|
||||
new Thread.UncaughtExceptionHandler() {
|
||||
@Override
|
||||
public void uncaughtException(Thread thread, Throwable ex) {
|
||||
try {
|
||||
UtilityLogger.error(new Exception(ex));
|
||||
} catch (Exception e) {
|
||||
Log.e("Uncaught error", "Exception Logger failed!", e);
|
||||
//MainApplication.exit();
|
||||
}
|
||||
|
||||
// re-throw critical exception further to the os (important)
|
||||
defaultUncaughtExceptionHandler.uncaughtException(thread, ex);
|
||||
|
||||
try {
|
||||
UtilityLogger.error(new Exception(ex));
|
||||
MainApplication.exit();
|
||||
} catch (Exception e) {
|
||||
Log.e("Uncaught error", "Exception Logger failed!", e);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -67,8 +67,10 @@ import it.integry.integrywmsnative.gest.prod_versamento_materiale.ProdVersamento
|
||||
import it.integry.integrywmsnative.gest.prod_versamento_materiale.ProdVersamentoMaterialeModule;
|
||||
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.PVOrdineAcquistoEditComponent;
|
||||
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.PVOrdineAcquistoEditModule;
|
||||
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.dialog.DialogEditArticoloComponent;
|
||||
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.dialog.DialogEditArticoloModule;
|
||||
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.dialog.edit_articolo.DialogEditArticoloComponent;
|
||||
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.dialog.edit_articolo.DialogEditArticoloModule;
|
||||
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.dialog.selectArtFromList.DialogSelectArtToOrderComponent;
|
||||
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.dialog.selectArtFromList.DialogSelectArtToOrderModule;
|
||||
import it.integry.integrywmsnative.gest.pv_ordini_acquisto.PVOrdiniAcquistoGrigliaComponent;
|
||||
import it.integry.integrywmsnative.gest.pv_ordini_acquisto.PVOrdiniAcquistoGrigliaModule;
|
||||
import it.integry.integrywmsnative.gest.pv_ordini_acquisto.dialogs.DialogScanGrigliaAcquistoComponent;
|
||||
@@ -80,6 +82,8 @@ import it.integry.integrywmsnative.gest.spedizione.SpedizioneComponent;
|
||||
import it.integry.integrywmsnative.gest.spedizione.SpedizioneModule;
|
||||
import it.integry.integrywmsnative.gest.spedizione.dialogs.print_sscc_list.DialogPrintOrderSSCCListComponent;
|
||||
import it.integry.integrywmsnative.gest.spedizione.dialogs.print_sscc_list.DialogPrintOrderSSCCListModule;
|
||||
import it.integry.integrywmsnative.gest.spedizione.dialogs.row_info.info_situazione_articolo.DialogInfoSituazioneArticoloComponent;
|
||||
import it.integry.integrywmsnative.gest.spedizione.dialogs.row_info.info_situazione_articolo.DialogInfoSituazioneArticoloModule;
|
||||
import it.integry.integrywmsnative.gest.spedizione.dialogs.row_info.prod_fabbisogno_linee_prod.DialogRowInfoProdFabbisognoLineeProdComponent;
|
||||
import it.integry.integrywmsnative.gest.spedizione.dialogs.row_info.prod_fabbisogno_linee_prod.DialogRowInfoProdFabbisognoLineeProdModule;
|
||||
import it.integry.integrywmsnative.gest.ultime_consegne_cliente.UltimeConsegneClienteComponent;
|
||||
@@ -172,7 +176,8 @@ import it.integry.integrywmsnative.view.dialogs.scan_or_create_lu.DialogScanOrCr
|
||||
BottomSheetMtbColrEditModalModule.class,
|
||||
DialogChooseArtsFromMtbAartListModule.class,
|
||||
MainSettingsModule.class,
|
||||
|
||||
DialogInfoSituazioneArticoloModule.class,
|
||||
DialogSelectArtToOrderModule.class
|
||||
})
|
||||
public interface MainApplicationComponent {
|
||||
|
||||
@@ -254,9 +259,7 @@ public interface MainApplicationComponent {
|
||||
|
||||
DocInterniComponent.Factory docInterniComponent();
|
||||
|
||||
DialogSelectDocInfoComponent.Factory dialogSelectMgrpDtipPairComponent();
|
||||
|
||||
DialogSelectDocRowsComponent.Factory dialogSelectDocRowsComponent();
|
||||
DialogSelectDocInfoComponent.Factory dialogSelectDocInfoNewViewComponent();
|
||||
|
||||
DocInterniEditFormComponent.Factory docInterniEditFormComponent();
|
||||
|
||||
@@ -290,6 +293,12 @@ public interface MainApplicationComponent {
|
||||
|
||||
MainSettingsComponent.Factory mainSettingsFragmentComponent();
|
||||
|
||||
DialogInfoSituazioneArticoloComponent.Factory dialogInfoSituazioneArticoloComponent();
|
||||
|
||||
DialogSelectDocRowsComponent.Factory dialogSelectDocRowsNewComponent();
|
||||
|
||||
DialogSelectArtToOrderComponent.Factory dialogSelectArtToOrderNewComponent();
|
||||
|
||||
void inject(MainApplication mainApplication);
|
||||
|
||||
void inject(AppContext mainApplication);
|
||||
|
||||
@@ -27,7 +27,7 @@ import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsume
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliSpedizioneRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.CommessaRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.DepositoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.DocumentiRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.DocumentRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.EntityRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.GestSetupRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.GiacenzaRESTConsumer;
|
||||
@@ -89,8 +89,8 @@ public class MainApplicationModule {
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
MainContext providesMainContextNew(MenuService menuService, AppDatabase appDatabase) {
|
||||
return new MainContext(mApplication.getApplicationContext(), menuService, appDatabase);
|
||||
MainContext providesMainContextNew(MenuService menuService, AppDatabase appDatabase, SystemRESTConsumer systemRESTConsumer) {
|
||||
return new MainContext(mApplication.getApplicationContext(), menuService, appDatabase, systemRESTConsumer);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@@ -253,8 +253,8 @@ public class MainApplicationModule {
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
DocumentiRESTConsumer provideDocumentiRESTConsumer() {
|
||||
return new DocumentiRESTConsumer();
|
||||
DocumentRESTConsumer provideDocumentiRESTConsumer() {
|
||||
return new DocumentRESTConsumer();
|
||||
}
|
||||
|
||||
@Provides
|
||||
|
||||
@@ -14,7 +14,6 @@ import java.util.List;
|
||||
import it.integry.barcode_base_android_library.interfaces.BarcodeReaderInterface;
|
||||
import it.integry.barcode_base_android_library.model.BarcodeSetting;
|
||||
import it.integry.honeywellscannerlibrary.HoneyWellBarcodeReader;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityLogger;
|
||||
import it.integry.integrywmsnative.gest.settings.MainSettingsFragment;
|
||||
import it.integry.keyobardemulatorscannerlibrary.KeyboardEmulatorBarcodeReader;
|
||||
import it.integry.pointmobilescannerlibrary.PointMobileBarcodeReader;
|
||||
@@ -136,12 +135,12 @@ public class BarcodeManager {
|
||||
|
||||
public static void disable() {
|
||||
mEnabled = false;
|
||||
UtilityLogger.trace("Barcode reader disabled");
|
||||
// UtilityLogger.info("Barcode reader disabled");
|
||||
}
|
||||
|
||||
public static void enable() {
|
||||
mEnabled = true;
|
||||
UtilityLogger.trace("Barcode reader enabled");
|
||||
// UtilityLogger.info("Barcode reader enabled");
|
||||
}
|
||||
|
||||
public static boolean isEnabled() {
|
||||
|
||||
@@ -15,6 +15,7 @@ import it.integry.integrywmsnative.gest.prod_rientro_merce.ProdRientroMerceFragm
|
||||
import it.integry.integrywmsnative.gest.prod_versamento_materiale.ProdVersamentoMaterialeFragment;
|
||||
import it.integry.integrywmsnative.gest.pv_ordini_acquisto.PVOrdiniAcquistoGrigliaFragment;
|
||||
import it.integry.integrywmsnative.gest.rettifica_giacenze.RettificaGiacenzeFragment;
|
||||
import it.integry.integrywmsnative.gest.spedizione.dialogs.row_info.info_situazione_articolo.DialogInfoSituazioneArticoloView;
|
||||
import it.integry.integrywmsnative.gest.ultime_consegne_cliente.UltimeConsegneClienteFragment;
|
||||
import it.integry.integrywmsnative.gest.ultimi_arrivi_fornitore.UltimiArriviFornitoreFragment;
|
||||
import it.integry.integrywmsnative.gest.versamento_merce.VersamentoMerceFragment;
|
||||
@@ -57,8 +58,16 @@ public class MenuConfiguration extends BaseMenuConfiguration {
|
||||
.setCodMenu("MG046")
|
||||
.setTitleText(R.string.vendita_title_fragment)
|
||||
.setTitleIcon(R.drawable.ic_dashboard_spedizione)
|
||||
.setDrawerIcon(R.drawable.ic_black_upload)
|
||||
.setFragmentFactory(() -> OrdiniUscitaElencoFragment.newInstance(GestioneEnum.VENDITA, null, -1, null)))
|
||||
.setDrawerIcon(R.drawable.ic_upload)
|
||||
.setFragmentFactory(() -> OrdiniUscitaElencoFragment.newInstance(GestioneEnum.VENDITA, null, -1, DialogInfoSituazioneArticoloView.class)))
|
||||
|
||||
.addItem(new MenuItem()
|
||||
.setID(R.id.nav_rettifica_spedizione)
|
||||
.setCodMenu("MG064")
|
||||
.setTitleText(R.string.rettifica_spedizione_fragment_title)
|
||||
.setTitleIcon(R.drawable.ic_dashboard_rettifica_spedizione)
|
||||
.setDrawerIcon(R.drawable.ic_rettifica_spedizione_drawer)
|
||||
.setFragmentFactory(() -> RettificaGiacenzeFragment.newInstance(GestioneEnum.VENDITA)))
|
||||
|
||||
.addItem(new MenuItem()
|
||||
.setID(R.id.nav_free_picking)
|
||||
@@ -99,9 +108,9 @@ public class MenuConfiguration extends BaseMenuConfiguration {
|
||||
.addItem(new MenuItem()
|
||||
.setID(R.id.nav_free_lav_picking)
|
||||
.setCodMenu("MG051")
|
||||
.setTitleText(it.integry.integrywmsnative.R.string.free_lav_picking)
|
||||
.setTitleText(R.string.free_lav_picking)
|
||||
.setTitleIcon(R.drawable.ic_dashboard_prod_picking_libero)
|
||||
.setDrawerIcon(it.integry.integrywmsnative.R.drawable.ic_black_barcode_scanner)
|
||||
.setDrawerIcon(R.drawable.ic_black_barcode_scanner)
|
||||
.setFragmentFactory(() -> PickingLiberoFragment.newInstance(GestioneEnum.LAVORAZIONE)))
|
||||
|
||||
.addItem(new MenuItem()
|
||||
@@ -109,7 +118,7 @@ public class MenuConfiguration extends BaseMenuConfiguration {
|
||||
.setCodMenu("MG052")
|
||||
.setTitleText(R.string.prod_fabbisogno_linee_prod_title)
|
||||
.setTitleIcon(R.drawable.ic_dashboard_prod_versamento_merce)
|
||||
.setDrawerIcon(it.integry.integrywmsnative.R.drawable.ic_black_load_shelf)
|
||||
.setDrawerIcon(R.drawable.ic_black_load_shelf)
|
||||
.setFragmentFactory(ProdFabbisognoLineeProdFragment::newInstance))
|
||||
|
||||
.addItem(new MenuItem()
|
||||
@@ -129,19 +138,19 @@ public class MenuConfiguration extends BaseMenuConfiguration {
|
||||
.setFragmentFactory(ProdRecuperoMaterialeFragment::newInstance))
|
||||
|
||||
.addItem(new MenuItem()
|
||||
.setID(it.integry.integrywmsnative.R.id.nav_prod_rientro_merce)
|
||||
.setID(R.id.nav_prod_rientro_merce)
|
||||
.setCodMenu("MG059")
|
||||
.setTitleText(it.integry.integrywmsnative.R.string.rientro_merce_fragment_title)
|
||||
.setTitleIcon(it.integry.integrywmsnative.R.drawable.ic_dashboard_prod_accettazione_produzione)
|
||||
.setDrawerIcon(it.integry.integrywmsnative.R.drawable.ic_black_external)
|
||||
.setTitleText(R.string.rientro_merce_fragment_title)
|
||||
.setTitleIcon(R.drawable.ic_dashboard_prod_accettazione_produzione)
|
||||
.setDrawerIcon(R.drawable.ic_black_external)
|
||||
.setFragmentFactory(ProdRientroMerceFragment::newInstance))
|
||||
|
||||
.addItem(new MenuItem()
|
||||
.setID(it.integry.integrywmsnative.R.id.nav_prod_linee)
|
||||
.setID(R.id.nav_prod_linee)
|
||||
.setCodMenu("MG061")
|
||||
.setTitleText(it.integry.integrywmsnative.R.string.nav_prod_linee_title)
|
||||
.setTitleText(R.string.nav_prod_linee_title)
|
||||
.setTitleIcon(R.drawable.ic_production_line)
|
||||
.setDrawerIcon(it.integry.integrywmsnative.R.drawable.ic_production_line)
|
||||
.setDrawerIcon(R.drawable.ic_production_line)
|
||||
.setFragmentFactory(ProdLineeProduzioneFragment::newInstance))
|
||||
).addGroup(
|
||||
new MenuGroup()
|
||||
@@ -192,7 +201,7 @@ public class MenuConfiguration extends BaseMenuConfiguration {
|
||||
.setID(it.integry.integrywmsnative.R.id.nav_pv_doc_interni)
|
||||
.setTitleText(it.integry.integrywmsnative.R.string.doc_interni)
|
||||
.setTitleIcon(R.drawable.ic_dashboard_contab_doc_interni)
|
||||
.setDrawerIcon(it.integry.integrywmsnative.R.drawable.ic_dashboard_contab_doc_interni)
|
||||
.setDrawerIcon(R.drawable.ic_documents_outline)
|
||||
.setFragmentFactory(DocInterniFragment::newInstance))
|
||||
|
||||
// .addItem(new MenuItem()
|
||||
|
||||
@@ -2,6 +2,7 @@ package it.integry.integrywmsnative.core.context;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
import com.google.firebase.crashlytics.FirebaseCrashlytics;
|
||||
import com.orhanobut.logger.AndroidLogAdapter;
|
||||
import com.orhanobut.logger.DiskLogAdapter;
|
||||
@@ -91,6 +92,32 @@ public class AppContext {
|
||||
logsFolder = new File(mApplicationContext.getExternalFilesDir(null).getAbsolutePath());
|
||||
int maxBytesSize = 5 * 1024 * 1024;
|
||||
Logger.addLogAdapter(new DiskLogAdapter(logsFolder, maxBytesSize));
|
||||
|
||||
removeOldLogs(logsFolder);
|
||||
}
|
||||
|
||||
private void removeOldLogs(File logsFolder) {
|
||||
var files = logsFolder.listFiles();
|
||||
|
||||
if (files == null || files.length <= 1)
|
||||
return;
|
||||
|
||||
var logFiles = Stream.of(files)
|
||||
.sortBy(x -> -1 * x.lastModified())
|
||||
.skip(1)
|
||||
.toList();
|
||||
|
||||
for (var logFile : logFiles) {
|
||||
boolean isDeleted = logFile.delete();
|
||||
}
|
||||
|
||||
files = logsFolder.listFiles();
|
||||
|
||||
if (files == null || files.length > 1)
|
||||
return;
|
||||
|
||||
final boolean isRenamed = files[0].renameTo(new File(files[0].getParentFile().getAbsolutePath() + "/" + "logs_0.csv"));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ import android.text.SpannableString;
|
||||
import android.text.Spanned;
|
||||
import android.text.SpannedString;
|
||||
|
||||
import com.google.firebase.installations.FirebaseInstallations;
|
||||
|
||||
import java.net.ConnectException;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
@@ -13,6 +15,7 @@ import javax.inject.Singleton;
|
||||
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
||||
import it.integry.integrywmsnative.core.data_store.db.AppDatabase;
|
||||
import it.integry.integrywmsnative.core.menu.MenuService;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.watcher.ServerStatusChecker;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityThread;
|
||||
@@ -23,13 +26,15 @@ public class MainContext {
|
||||
private final Context applicationContext;
|
||||
private final MenuService menuService;
|
||||
private final AppDatabase appDatabase;
|
||||
private final SystemRESTConsumer systemRESTConsumer;
|
||||
|
||||
private Listener mListener;
|
||||
|
||||
public MainContext(Context applicationContext, MenuService menuService, AppDatabase appDatabase) {
|
||||
public MainContext(Context applicationContext, MenuService menuService, AppDatabase appDatabase, SystemRESTConsumer systemRESTConsumer) {
|
||||
this.applicationContext = applicationContext;
|
||||
this.menuService = menuService;
|
||||
this.appDatabase = appDatabase;
|
||||
this.systemRESTConsumer = systemRESTConsumer;
|
||||
}
|
||||
|
||||
public void init() {
|
||||
@@ -40,10 +45,13 @@ public class MainContext {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
|
||||
this.initDBData(() -> {
|
||||
this.initMenu(() -> {
|
||||
|
||||
if (mListener != null) mListener.onContextInitialized();
|
||||
|
||||
this.initDeviceId(() -> {
|
||||
this.initDBData(() -> {
|
||||
this.initMenu(() -> {
|
||||
|
||||
if (mListener != null) mListener.onContextInitialized();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -52,6 +60,25 @@ public class MainContext {
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void initDeviceId(Runnable onComplete) {
|
||||
if (SettingsManager.i().getUserSession().getDeviceId() != null) {
|
||||
onComplete.run();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
FirebaseInstallations.getInstance().getId().addOnCompleteListener(fid -> {
|
||||
SettingsManager.i().getUserSession().setDeviceId(fid.getResult());
|
||||
SettingsManager.update();
|
||||
|
||||
systemRESTConsumer.registerDevice(onComplete, ex -> {
|
||||
if (mListener != null) mListener.onError(new SpannedString(ex.getMessage()));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public void logout(Runnable onLoggedOut) {
|
||||
menuService.invalidateCache();
|
||||
UtilityThread.executeParallel(() -> {
|
||||
|
||||
@@ -39,6 +39,9 @@ public class ColliDataRecoverService {
|
||||
if(isFilePresent(CommonConst.Files.RECOVER_COLLO_FILE)) {
|
||||
loadLocalFile();
|
||||
}
|
||||
|
||||
if(mtbColtsSessions == null)
|
||||
mtbColtsSessions = new ArrayList<>();
|
||||
}
|
||||
|
||||
public boolean thereIsAnExistantSession() {
|
||||
@@ -47,7 +50,6 @@ public class ColliDataRecoverService {
|
||||
|
||||
public List<Integer> getAllSessionIDs() {
|
||||
if(thereIsAnExistantSession()) {
|
||||
|
||||
return Stream.of(mtbColtsSessions)
|
||||
.map(ColliDataRecoverDTO::getId)
|
||||
.toList();
|
||||
@@ -56,7 +58,6 @@ public class ColliDataRecoverService {
|
||||
}
|
||||
|
||||
public ColliDataRecoverDTO getSession(Integer sessionID) {
|
||||
|
||||
if(sessionID == null) return null;
|
||||
|
||||
return getIfExists(sessionID);
|
||||
|
||||
@@ -40,8 +40,7 @@ import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColt;
|
||||
InventarioRoomDTO.class,
|
||||
InventarioRowRoomDTO.class
|
||||
},
|
||||
version = 14,
|
||||
exportSchema = true)
|
||||
version = 17)
|
||||
@TypeConverters({
|
||||
DateConverter.class,
|
||||
BigDecimalConverter.class,
|
||||
@@ -67,7 +66,10 @@ public abstract class AppDatabase extends RoomDatabase {
|
||||
.addMigrations(MIGRATION_10_11)
|
||||
.addMigrations(MIGRATION_11_12)
|
||||
.addMigrations(MIGRATION_12_13)
|
||||
.addMigrations(MIGRATION_13_14);
|
||||
.addMigrations(MIGRATION_13_14)
|
||||
.addMigrations(MIGRATION_14_15)
|
||||
.addMigrations(MIGRATION_15_16)
|
||||
.addMigrations(MIGRATION_16_17);
|
||||
|
||||
sInstance = builder.build();
|
||||
}
|
||||
@@ -135,4 +137,45 @@ public abstract class AppDatabase extends RoomDatabase {
|
||||
+ " ADD COLUMN new INTEGER");
|
||||
}
|
||||
};
|
||||
|
||||
static final Migration MIGRATION_14_15 = new Migration(14, 15) {
|
||||
@Override
|
||||
public void migrate(@NonNull SupportSQLiteDatabase database) {
|
||||
// rimuovo vincoli "not null" dai campi id_griglia e cod_alis
|
||||
database.execSQL("DROP TABLE IF EXISTS ordini_tmp;");
|
||||
database.execSQL("CREATE TABLE ordini_tmp (ordine_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, data_ins INTEGER, annotazioni TEXT, transmitted INTEGER NOT NULL, transmission_date INTEGER, gestione TEXT, data_ord INTEGER, num_ord INTEGER, cod_mdep TEXT, id_griglia INTEGER, cod_alis TEXT);");
|
||||
database.execSQL("INSERT INTO ordini_tmp(ordine_id,data_ins,annotazioni,transmitted,transmission_date,gestione,data_ord,num_ord,cod_mdep,id_griglia,cod_alis) SELECT ordini.ordine_id,ordini.data_ins,ordini.annotazioni,ordini.transmitted,ordini.transmission_date,ordini.gestione,ordini.data_ord,ordini.num_ord,ordini.cod_mdep,ordini.id_griglia,griglie.cod_alis from ordini left outer join griglie on ordini.id_griglia = griglie.griglia_id;");
|
||||
database.execSQL("DROP TABLE ordini;");
|
||||
database.execSQL("ALTER TABLE ordini_tmp RENAME TO ordini;");
|
||||
// aggiungo campo cod_alis sulle righe dell'ordine
|
||||
database.execSQL("DROP TABLE IF EXISTS art_ord_tmp;");
|
||||
database.execSQL("CREATE TABLE IF NOT EXISTS art_ord_tmp( articolo_ordine_id INTEGER PRIMARY KEY AUTOINCREMENT, cod_mart TEXT, descrizione TEXT, unt_mis TEXT, qta_cnf REAL NOT NULL, bar_code TEXT, merce_da_ric REAL NOT NULL, media_sett REAL NOT NULL, flag_qta_multipla TEXT, qta_min_ordinabile REAL NOT NULL, id_ordine INTEGER NOT NULL, qta_ord REAL NOT NULL, data_ins INTEGER, new_no_promo INTEGER NOT NULL, system_note TEXT, cod_alis TEXT , FOREIGN KEY(id_ordine) REFERENCES ordini(ordine_id) ON UPDATE NO ACTION ON DELETE CASCADE );");
|
||||
database.execSQL("INSERT INTO art_ord_tmp(articolo_ordine_id, cod_mart, descrizione, unt_mis, qta_cnf, bar_code, merce_da_ric, media_sett, flag_qta_multipla, qta_min_ordinabile, id_ordine, qta_ord, data_ins, new_no_promo, system_note, cod_alis) SELECT articolo_ordine_id, cod_mart, descrizione, unt_mis, qta_cnf, bar_code, merce_da_ric, media_sett, flag_qta_multipla, qta_min_ordinabile, id_ordine, qta_ord, data_ins, new_no_promo, system_note, null from articoli_ordine;");
|
||||
database.execSQL("DROP TABLE articoli_ordine;");
|
||||
database.execSQL("ALTER TABLE art_ord_tmp RENAME TO articoli_ordine;");
|
||||
database.execSQL("CREATE INDEX IF NOT EXISTS index_articoli_ordine_id_ordine ON articoli_ordine (id_ordine);");
|
||||
database.execSQL("CREATE UNIQUE INDEX IF NOT EXISTS index_articoli_ordine_id_ordine_cod_mart ON articoli_ordine (id_ordine, cod_mart);");
|
||||
}
|
||||
};
|
||||
static final Migration MIGRATION_15_16 = new Migration(15, 16) {
|
||||
@Override
|
||||
public void migrate(@NonNull SupportSQLiteDatabase database) {
|
||||
}
|
||||
};
|
||||
static final Migration MIGRATION_16_17 = new Migration(16, 17) {
|
||||
@Override
|
||||
public void migrate(@NonNull SupportSQLiteDatabase database) {
|
||||
database.execSQL("ALTER TABLE inventario_rows RENAME TO _inventario_rows_old;");
|
||||
database.execSQL("DROP INDEX index_inventario_rows__id;");
|
||||
database.execSQL("DROP INDEX index_inventario_rows_parent_id;");
|
||||
|
||||
database.execSQL("CREATE TABLE inventario_rows (_id INTEGER PRIMARY KEY AUTOINCREMENT, parent_id INTEGER, cod_mart TEXT, partita_mag TEXT, descrizione TEXT, qta REAL NOT NULL DEFAULT 0, num_cnf REAL NOT NULL DEFAULT 0, qta_cnf REAL NOT NULL DEFAULT 0, unt_mis TEXT NOT NULL DEFAULT '0', data_ora_inv INTEGER, scan_cod_barre TEXT, zona TEXT, remote_sync_date INTEGER, FOREIGN KEY(parent_id) REFERENCES inventari(_id) ON UPDATE NO ACTION ON DELETE CASCADE);");
|
||||
|
||||
database.execSQL("INSERT INTO inventario_rows SELECT * FROM _inventario_rows_old;");
|
||||
|
||||
database.execSQL("CREATE INDEX index_inventario_rows__id ON inventario_rows (_id);");
|
||||
database.execSQL("CREATE INDEX index_inventario_rows_parent_id ON inventario_rows (parent_id)");
|
||||
database.execSQL("DROP TABLE _inventario_rows_old;");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -24,6 +24,6 @@ public interface MtbColrDao {
|
||||
@Delete
|
||||
void delete(SqlMtbColr mtbColr);
|
||||
|
||||
@Query("SELECT * from mtb_colr where id_collo = :idDocument")
|
||||
@Query("SELECT * FROM mtb_colr WHERE id_collo = :idDocument ORDER BY id DESC")
|
||||
List<SqlMtbColr> getDocumentRows(long idDocument);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package it.integry.integrywmsnative.core.data_store.db.dao;
|
||||
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.room.Dao;
|
||||
import androidx.room.Delete;
|
||||
import androidx.room.Insert;
|
||||
@@ -33,7 +34,7 @@ public interface MtbColtDao {
|
||||
" AND ( mtb_colt.data_doc = :dataDoc OR (mtb_colt.data_doc is null and :dataDoc is null)) " +
|
||||
" AND ( mtb_colt.num_doc = :numDoc OR (mtb_colt.num_doc is null and :numDoc is null)) " +
|
||||
" and cod_dtip is null group by mtb_colt.id")
|
||||
List<DocInternoWrapper> getLocalDocumentsByCodDtip(String codDtip, String codAnag, String codVdes, Date dataDoc, String numDoc);
|
||||
LiveData<List<DocInternoWrapper>> getLocalDocumentsByCodDtip(String codDtip, String codAnag, String codVdes, Date dataDoc, String numDoc);
|
||||
|
||||
@Query("SELECT ifnull(MAX(num_collo),0) +1 as num_collo from mtb_colt")
|
||||
Integer getNextNumCollo();
|
||||
|
||||
@@ -19,7 +19,7 @@ public interface OrdineDao {
|
||||
@Query("SELECT ordini.* from ordini where ordini.transmitted = 1")
|
||||
List<Ordine> getAllTrasnmitted();
|
||||
|
||||
@Query("SELECT ordini.*, count(articolo_ordine_id) as countArticoli from ordini left join articoli_ordine ON ordini.ordine_id = articoli_ordine.id_ordine where ordini.transmitted = 0 and ordini.cod_alis = :codAlis group by ordini.ordine_id")
|
||||
@Query("SELECT ordini.*, count(articolo_ordine_id) as countArticoli from ordini left join articoli_ordine ON ordini.ordine_id = articoli_ordine.id_ordine where ordini.transmitted = 0 and ((:codAlis is null and ordini.cod_alis is null) OR (ordini.cod_alis = :codAlis)) group by ordini.ordine_id")
|
||||
List<OrdineWrapper> getAllOpenOrdersByGriglia(String codAlis);
|
||||
|
||||
@Insert
|
||||
|
||||
@@ -73,6 +73,9 @@ public class ArticoloOrdine {
|
||||
@ColumnInfo(name = "system_note")
|
||||
private String systemNote;
|
||||
|
||||
@ColumnInfo(name = "cod_alis")
|
||||
private String codAlis;
|
||||
|
||||
@Ignore
|
||||
private int ggScadenza = 0;
|
||||
|
||||
@@ -85,9 +88,15 @@ public class ArticoloOrdine {
|
||||
@Ignore
|
||||
private BigDecimal qtaProposta = BigDecimal.ZERO;
|
||||
|
||||
@Ignore
|
||||
private BigDecimal ctMaxOrd = BigDecimal.ZERO;
|
||||
|
||||
@Ignore
|
||||
private int bgTint;
|
||||
|
||||
@Ignore
|
||||
private boolean invalid = false;
|
||||
|
||||
|
||||
public Integer getArticoloOrdineId() {
|
||||
return articoloOrdineId;
|
||||
@@ -230,15 +239,15 @@ public class ArticoloOrdine {
|
||||
}
|
||||
|
||||
public BigDecimal getQtaCnfPrevistaVendita() {
|
||||
return qtaPrevistaVendita.equals(BigDecimal.ZERO) ? BigDecimal.ZERO : qtaPrevistaVendita.divide(BigDecimal.valueOf(qtaCnf), 0, RoundingMode.CEILING);
|
||||
return qtaPrevistaVendita == null || qtaPrevistaVendita.equals(BigDecimal.ZERO) ? BigDecimal.ZERO : qtaPrevistaVendita.divide(BigDecimal.valueOf(qtaCnf), 0, RoundingMode.CEILING);
|
||||
}
|
||||
|
||||
public BigDecimal getQtaCnfProposta() {
|
||||
return qtaProposta.equals(BigDecimal.ZERO) ? BigDecimal.ZERO : qtaProposta.divide(BigDecimal.valueOf(qtaCnf), 0, RoundingMode.CEILING);
|
||||
return qtaProposta == null || 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);
|
||||
return giacenza == null || giacenza.equals(BigDecimal.ZERO) ? BigDecimal.ZERO : giacenza.divide(BigDecimal.valueOf(qtaCnf), 0, RoundingMode.CEILING);
|
||||
}
|
||||
|
||||
public boolean isNewNoPromo() {
|
||||
@@ -277,4 +286,30 @@ public class ArticoloOrdine {
|
||||
public void setSystemNote(String systemNote) {
|
||||
this.systemNote = systemNote;
|
||||
}
|
||||
|
||||
public String getCodAlis() {
|
||||
return codAlis;
|
||||
}
|
||||
|
||||
public void setCodAlis(String codAlis) {
|
||||
this.codAlis = codAlis;
|
||||
}
|
||||
|
||||
public BigDecimal getCtMaxOrd() {
|
||||
return ctMaxOrd;
|
||||
}
|
||||
|
||||
public ArticoloOrdine setCtMaxOrd(BigDecimal ctMaxOrd) {
|
||||
this.ctMaxOrd = ctMaxOrd;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isInvalid() {
|
||||
return invalid;
|
||||
}
|
||||
|
||||
public ArticoloOrdine setInvalid(boolean invalid) {
|
||||
this.invalid = invalid;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ public class InventarioRoomDTO extends BaseSyncDTO implements EntityModelInterfa
|
||||
private String zona;
|
||||
|
||||
@ColumnInfo(name = Columns.IS_NEW)
|
||||
private Boolean isNew;
|
||||
private Boolean isNew = Boolean.TRUE;
|
||||
|
||||
@Ignore
|
||||
private List<InventarioRowRoomDTO> inventarioRowList;
|
||||
|
||||
@@ -17,7 +17,8 @@ import it.integry.integrywmsnative.core.data_store.db.interfaces.EntityModelInte
|
||||
@ForeignKey(
|
||||
entity = InventarioRoomDTO.class,
|
||||
parentColumns = {BaseSyncDTO.Columns.ID},
|
||||
childColumns = {InventarioRowRoomDTO.Columns.PARENT_ID}
|
||||
childColumns = {InventarioRowRoomDTO.Columns.PARENT_ID},
|
||||
onDelete = ForeignKey.CASCADE
|
||||
)
|
||||
}
|
||||
)
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package it.integry.integrywmsnative.core.data_store.db.entity;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.room.ColumnInfo;
|
||||
import androidx.room.Entity;
|
||||
@@ -52,10 +51,10 @@ public class Ordine {
|
||||
private boolean orderNewProducts = false;
|
||||
|
||||
@ColumnInfo(name = "id_griglia")
|
||||
private int idGriglia;
|
||||
@Nullable
|
||||
private Integer idGriglia;
|
||||
|
||||
@ColumnInfo(name = "cod_alis")
|
||||
@NonNull
|
||||
private String codAlis;
|
||||
|
||||
public int getOrdineId() {
|
||||
@@ -82,11 +81,11 @@ public class Ordine {
|
||||
this.annotazioni = annotazioni;
|
||||
}
|
||||
|
||||
public int getIdGriglia() {
|
||||
public Integer getIdGriglia() {
|
||||
return idGriglia;
|
||||
}
|
||||
|
||||
public void setIdGriglia(int idGriglia) {
|
||||
public void setIdGriglia(Integer idGriglia) {
|
||||
this.idGriglia = idGriglia;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package it.integry.integrywmsnative.core.data_store.db.repository;
|
||||
|
||||
import androidx.lifecycle.LiveData;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@@ -17,7 +19,7 @@ public interface MtbColtRepository {
|
||||
|
||||
void delete(SqlMtbColt mtbColt, Runnable onSuccess, RunnableArgs<Exception> onError);
|
||||
|
||||
void getLocalDocumentsByCodDtip(String codDtip, String codAnag, String codVdes, Date dataDoc, String numDoc, RunnableArgs<List<DocInternoWrapper>> onSuccess, RunnableArgs<Exception> onError);
|
||||
LiveData<List<DocInternoWrapper>> getDocuments(String codDtip, String codAnag, String codVdes, Date dataDoc, String numDoc);
|
||||
|
||||
void getNextNumCollo(RunnableArgs<Integer> onSuccess, RunnableArgs<Exception> onError);
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@ package it.integry.integrywmsnative.core.data_store.db.repository.datasource;
|
||||
|
||||
import android.os.Handler;
|
||||
|
||||
import androidx.lifecycle.LiveData;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
@@ -50,10 +52,8 @@ public class SqlMtbColtDataSource extends BaseDataSource implements MtbColtRepos
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getLocalDocumentsByCodDtip(String codDtip, String codAnag, String codVdes, Date dataDoc, String numDoc, RunnableArgs<List<DocInternoWrapper>> onSuccess, RunnableArgs<Exception> onError) {
|
||||
execute(() -> mMtbColtDao.getLocalDocumentsByCodDtip(codDtip, codAnag, codVdes, dataDoc, numDoc),
|
||||
onSuccess,
|
||||
onError);
|
||||
public LiveData<List<DocInternoWrapper>> getDocuments(String codDtip, String codAnag, String codVdes, Date dataDoc, String numDoc) {
|
||||
return mMtbColtDao.getLocalDocumentsByCodDtip(codDtip, codAnag, codVdes, dataDoc, numDoc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -69,7 +69,8 @@ public class InventarioRepository extends _BaseRepository<MtbInvent, InventarioR
|
||||
resolveFetch(remoteData, internalLiveData.getValue(),
|
||||
(remoteItem, localItem) -> Objects.equals(remoteItem.getIdInventario(), localItem.getIdInventario()),
|
||||
(remoteItem, localItem) -> {
|
||||
remoteItem.setNew(true);
|
||||
remoteItem.setRemoteSyncDate(localItem.getRemoteSyncDate());
|
||||
remoteItem.setNew(false);
|
||||
}, onComplete, onError);
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -58,7 +58,7 @@ public abstract class _BaseRepository<
|
||||
.collect(Collectors.toList());
|
||||
|
||||
var dataToDelete = finalLocalData.stream()
|
||||
.filter(x -> x.isSyncronized() && finalRemoteData.stream().noneMatch(y -> keyComparator.run(y, x)))
|
||||
.filter(x -> finalRemoteData.stream().noneMatch(y -> keyComparator.run(y, x)))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
var dataToInsert = finalRemoteData.stream()
|
||||
|
||||
@@ -1,218 +0,0 @@
|
||||
package it.integry.integrywmsnative.core.data_store.db.view_model;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.ArticoloOrdine;
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.Ordine;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||
|
||||
public class ArticoloDTO {
|
||||
|
||||
public String codMart;
|
||||
public String descrizione;
|
||||
public String untMis;
|
||||
public float qtaCnf;
|
||||
public String barcode;
|
||||
public float merceDaRic;
|
||||
public float mediaSett;
|
||||
public String flagQtaMultipla;
|
||||
public String flagTracciabilita;
|
||||
public float qtaMinOrdinabile;
|
||||
public boolean newNoPromo;
|
||||
private int ggScadenza;
|
||||
private float giacenza;
|
||||
private float qtaPrevistaVendita;
|
||||
private float qtaProposta;
|
||||
private float qtaOrd;
|
||||
|
||||
|
||||
public String getCodMart() {
|
||||
return codMart;
|
||||
}
|
||||
|
||||
public void setCodMart(String codMart) {
|
||||
this.codMart = codMart;
|
||||
}
|
||||
|
||||
public String getDescrizione() {
|
||||
return descrizione;
|
||||
}
|
||||
|
||||
public void setDescrizione(String descrizione) {
|
||||
this.descrizione = descrizione;
|
||||
}
|
||||
|
||||
public String getUntMis() {
|
||||
return untMis;
|
||||
}
|
||||
|
||||
public void setUntMis(String untMis) {
|
||||
this.untMis = untMis;
|
||||
}
|
||||
|
||||
public float getQtaCnf() {
|
||||
return qtaCnf;
|
||||
}
|
||||
|
||||
public void setQtaCnf(float qtaCnf) {
|
||||
this.qtaCnf = qtaCnf;
|
||||
}
|
||||
|
||||
public String getBarCode() {
|
||||
return barcode;
|
||||
}
|
||||
|
||||
public void setBarCode(String barCode) {
|
||||
this.barcode = barCode;
|
||||
}
|
||||
|
||||
public float getMerceDaRic() {
|
||||
return merceDaRic;
|
||||
}
|
||||
|
||||
public void setMerceDaRic(float merceDaRic) {
|
||||
this.merceDaRic = merceDaRic;
|
||||
}
|
||||
|
||||
public float getMediaSett() {
|
||||
return mediaSett;
|
||||
}
|
||||
|
||||
public void setMediaSett(float mediaSett) {
|
||||
this.mediaSett = mediaSett;
|
||||
}
|
||||
|
||||
public String getFlagQtaMultipla() {
|
||||
return flagQtaMultipla;
|
||||
}
|
||||
|
||||
public void setFlagQtaMultipla(String flagQtaMultipla) {
|
||||
this.flagQtaMultipla = flagQtaMultipla;
|
||||
}
|
||||
|
||||
public float getQtaMinOrdinabile() {
|
||||
return qtaMinOrdinabile;
|
||||
}
|
||||
|
||||
public void setQtaMinOrdinabile(float qtaMinOrdinabile) {
|
||||
this.qtaMinOrdinabile = qtaMinOrdinabile;
|
||||
}
|
||||
|
||||
public String getBarcode() {
|
||||
return barcode;
|
||||
}
|
||||
|
||||
public void setBarcode(String barcode) {
|
||||
this.barcode = barcode;
|
||||
}
|
||||
|
||||
public int getGgScadenza() {
|
||||
return ggScadenza;
|
||||
}
|
||||
|
||||
public void setGgScadenza(int ggScadenza) {
|
||||
this.ggScadenza = ggScadenza;
|
||||
}
|
||||
|
||||
public float getGiacenza() {
|
||||
return giacenza;
|
||||
}
|
||||
|
||||
public void setGiacenza(float giacenza) {
|
||||
this.giacenza = giacenza;
|
||||
}
|
||||
|
||||
public float getQtaPrevistaVendita() {
|
||||
return qtaPrevistaVendita;
|
||||
}
|
||||
|
||||
public void setQtaPrevistaVendita(float qtaPrevistaVendita) {
|
||||
this.qtaPrevistaVendita = qtaPrevistaVendita;
|
||||
}
|
||||
|
||||
public float getQtaProposta() {
|
||||
return qtaProposta;
|
||||
}
|
||||
|
||||
public void setQtaProposta(float qtaProposta) {
|
||||
this.qtaProposta = qtaProposta;
|
||||
}
|
||||
|
||||
public 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 float getQtaOrd() {
|
||||
return qtaOrd;
|
||||
}
|
||||
|
||||
public ArticoloDTO setQtaOrd(float qtaOrd) {
|
||||
this.qtaOrd = qtaOrd;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ArticoloOrdine convertToArticoloOrdine(Ordine ordine) {
|
||||
ArticoloOrdine articolo = new ArticoloOrdine();
|
||||
|
||||
articolo.setIdOrdine(ordine.getOrdineId());
|
||||
|
||||
articolo.setBarCode(this.getBarCode());
|
||||
articolo.setCodMart(this.getCodMart());
|
||||
articolo.setMediaSett(this.getMediaSett());
|
||||
articolo.setFlagQtaMultipla(this.getFlagQtaMultipla());
|
||||
articolo.setQtaMinOrdinabile(this.getQtaMinOrdinabile());
|
||||
articolo.setMerceDaRic(this.getMerceDaRic());
|
||||
articolo.setQtaCnf(this.getQtaCnf());
|
||||
articolo.setUntMis(this.getUntMis());
|
||||
articolo.setDescrizione(this.getDescrizione());
|
||||
articolo.setDataIns(UtilityDate.getDateInstance());
|
||||
articolo.setGgScadenza(this.getGgScadenza());
|
||||
articolo.setGiacenza(BigDecimal.valueOf(this.getGiacenza()));
|
||||
articolo.setQtaPrevistaVendita(BigDecimal.valueOf(this.getQtaPrevistaVendita()));
|
||||
articolo.setQtaProposta(BigDecimal.valueOf(this.getQtaProposta()));
|
||||
articolo.setNewNoPromo(this.isNewNoPromo());
|
||||
articolo.setSystemNote(generateSystemNote());
|
||||
articolo.setQtaOrd(this.getQtaOrd());
|
||||
|
||||
return articolo;
|
||||
}
|
||||
|
||||
public String generateSystemNote() {
|
||||
HashMap<String, String> pairs = new HashMap<>();
|
||||
pairs.put("qta_proposta", String.valueOf(qtaProposta));
|
||||
pairs.put("giacenza", String.valueOf(giacenza));
|
||||
|
||||
return new JSONObject(pairs).toString();
|
||||
}
|
||||
|
||||
|
||||
public int getSortByBarcodeCondition(String barcode) {
|
||||
if (codMart.equalsIgnoreCase(barcode))
|
||||
return 1;
|
||||
if (barcode != null) {
|
||||
if (barcode.equalsIgnoreCase(barcode))
|
||||
return 2;
|
||||
if (StringUtils.leftPad(barcode, 13, "0").equalsIgnoreCase(barcode))
|
||||
return 3;
|
||||
}
|
||||
return 100;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,224 @@
|
||||
package it.integry.integrywmsnative.core.data_store.db.view_model;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class ArticoloOrdinabileDTO {
|
||||
|
||||
|
||||
private String codAlis;
|
||||
private String codMart;
|
||||
private String descrizione;
|
||||
private String untMis;
|
||||
private float qtaCnf;
|
||||
private float merceDaRic;
|
||||
private float mediaSett;
|
||||
private String flagQtaMultipla;
|
||||
private String flagTracciabilita;
|
||||
private String flagQtaCnfFissa;
|
||||
private boolean newNoPromo;
|
||||
private float qtaMinOrdinabile;
|
||||
private int ggScadenza;
|
||||
private BigDecimal giacenza;
|
||||
private BigDecimal qtaPrevistaVendita;
|
||||
private BigDecimal qtaProposta;
|
||||
private float qtaOrd;
|
||||
|
||||
private float ctMaxOrd;
|
||||
|
||||
private List<String> barcode;
|
||||
|
||||
private String selectedBarcode;
|
||||
|
||||
public String getCodAlis() {
|
||||
return codAlis;
|
||||
}
|
||||
|
||||
public ArticoloOrdinabileDTO setCodAlis(String codAlis) {
|
||||
this.codAlis = codAlis;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodMart() {
|
||||
return codMart;
|
||||
}
|
||||
|
||||
public ArticoloOrdinabileDTO setCodMart(String codMart) {
|
||||
this.codMart = codMart;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDescrizione() {
|
||||
return descrizione;
|
||||
}
|
||||
|
||||
public ArticoloOrdinabileDTO setDescrizione(String descrizione) {
|
||||
this.descrizione = descrizione;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getUntMis() {
|
||||
return untMis;
|
||||
}
|
||||
|
||||
public ArticoloOrdinabileDTO setUntMis(String untMis) {
|
||||
this.untMis = untMis;
|
||||
return this;
|
||||
}
|
||||
|
||||
public float getQtaCnf() {
|
||||
return qtaCnf;
|
||||
}
|
||||
|
||||
public ArticoloOrdinabileDTO setQtaCnf(float qtaCnf) {
|
||||
this.qtaCnf = qtaCnf;
|
||||
return this;
|
||||
}
|
||||
|
||||
public float getMerceDaRic() {
|
||||
return merceDaRic;
|
||||
}
|
||||
|
||||
public ArticoloOrdinabileDTO setMerceDaRic(float merceDaRic) {
|
||||
this.merceDaRic = merceDaRic;
|
||||
return this;
|
||||
}
|
||||
|
||||
public float getMediaSett() {
|
||||
return mediaSett;
|
||||
}
|
||||
|
||||
public ArticoloOrdinabileDTO setMediaSett(float mediaSett) {
|
||||
this.mediaSett = mediaSett;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getFlagQtaMultipla() {
|
||||
return flagQtaMultipla;
|
||||
}
|
||||
|
||||
public ArticoloOrdinabileDTO setFlagQtaMultipla(String flagQtaMultipla) {
|
||||
this.flagQtaMultipla = flagQtaMultipla;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getFlagTracciabilita() {
|
||||
return flagTracciabilita;
|
||||
}
|
||||
|
||||
public ArticoloOrdinabileDTO setFlagTracciabilita(String flagTracciabilita) {
|
||||
this.flagTracciabilita = flagTracciabilita;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getFlagQtaCnfFissa() {
|
||||
return flagQtaCnfFissa;
|
||||
}
|
||||
|
||||
public ArticoloOrdinabileDTO setFlagQtaCnfFissa(String flagQtaCnfFissa) {
|
||||
this.flagQtaCnfFissa = flagQtaCnfFissa;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isNewNoPromo() {
|
||||
return newNoPromo;
|
||||
}
|
||||
|
||||
public ArticoloOrdinabileDTO setNewNoPromo(boolean newNoPromo) {
|
||||
this.newNoPromo = newNoPromo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public float getQtaMinOrdinabile() {
|
||||
return qtaMinOrdinabile;
|
||||
}
|
||||
|
||||
public ArticoloOrdinabileDTO setQtaMinOrdinabile(float qtaMinOrdinabile) {
|
||||
this.qtaMinOrdinabile = qtaMinOrdinabile;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getGgScadenza() {
|
||||
return ggScadenza;
|
||||
}
|
||||
|
||||
public ArticoloOrdinabileDTO setGgScadenza(int ggScadenza) {
|
||||
this.ggScadenza = ggScadenza;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getGiacenza() {
|
||||
return giacenza;
|
||||
}
|
||||
|
||||
public ArticoloOrdinabileDTO setGiacenza(BigDecimal giacenza) {
|
||||
this.giacenza = giacenza;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getQtaPrevistaVendita() {
|
||||
return qtaPrevistaVendita;
|
||||
}
|
||||
|
||||
public ArticoloOrdinabileDTO setQtaPrevistaVendita(BigDecimal qtaPrevistaVendita) {
|
||||
this.qtaPrevistaVendita = qtaPrevistaVendita;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getQtaProposta() {
|
||||
return qtaProposta;
|
||||
}
|
||||
|
||||
public ArticoloOrdinabileDTO setQtaProposta(BigDecimal qtaProposta) {
|
||||
this.qtaProposta = qtaProposta;
|
||||
return this;
|
||||
}
|
||||
|
||||
public float getQtaOrd() {
|
||||
return qtaOrd;
|
||||
}
|
||||
|
||||
public ArticoloOrdinabileDTO setQtaOrd(float qtaOrd) {
|
||||
this.qtaOrd = qtaOrd;
|
||||
return this;
|
||||
}
|
||||
|
||||
public float getCtMaxOrd() {
|
||||
return ctMaxOrd;
|
||||
}
|
||||
|
||||
public ArticoloOrdinabileDTO setCtMaxOrd(float ctMaxOrd) {
|
||||
this.ctMaxOrd = ctMaxOrd;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<String> getBarcode() {
|
||||
return barcode;
|
||||
}
|
||||
|
||||
public ArticoloOrdinabileDTO setBarcode(List<String> barcode) {
|
||||
this.barcode = barcode;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String generateSystemNote() {
|
||||
HashMap<String, String> pairs = new HashMap<>();
|
||||
pairs.put("qta_proposta", String.valueOf(qtaProposta));
|
||||
pairs.put("giacenza", String.valueOf(giacenza));
|
||||
|
||||
return new JSONObject(pairs).toString();
|
||||
}
|
||||
|
||||
public String getSelectedBarcode() {
|
||||
return selectedBarcode;
|
||||
}
|
||||
|
||||
public ArticoloOrdinabileDTO setSelectedBarcode(String selectedBarcode) {
|
||||
this.selectedBarcode = selectedBarcode;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
package it.integry.integrywmsnative.core.data_store.db.view_model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.ArticoloGriglia;
|
||||
|
||||
public class GrigliaDTO {
|
||||
private String descrLisa;
|
||||
private String descrDepo;
|
||||
private List<ArticoloDTO> grigliaAcquistiChild;
|
||||
|
||||
|
||||
public String getDescrLisa() {
|
||||
return descrLisa;
|
||||
}
|
||||
|
||||
public void setDescrLisa(String descrLisa) {
|
||||
this.descrLisa = descrLisa;
|
||||
}
|
||||
|
||||
public String getDescrDepo() {
|
||||
return descrDepo;
|
||||
}
|
||||
|
||||
public void setDescrDepo(String descrDepo) {
|
||||
this.descrDepo = descrDepo;
|
||||
}
|
||||
|
||||
public List<ArticoloDTO> getGrigliaAcquistiChild() {
|
||||
return grigliaAcquistiChild;
|
||||
}
|
||||
|
||||
public void setGrigliaAcquistiChild(List<ArticoloDTO> grigliaAcquistiChild) {
|
||||
this.grigliaAcquistiChild = grigliaAcquistiChild;
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
package it.integry.integrywmsnative.core.data_store.db.view_model;
|
||||
|
||||
import androidx.room.Embedded;
|
||||
import androidx.room.Ignore;
|
||||
|
||||
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.di.BindableBoolean;
|
||||
|
||||
public class OrdineWithGriglia {
|
||||
|
||||
@Embedded
|
||||
private Ordine ordine;
|
||||
@Embedded
|
||||
private Griglia griglia;
|
||||
|
||||
|
||||
public Ordine getOrdine() {
|
||||
return ordine;
|
||||
}
|
||||
|
||||
public void setOrdine(Ordine ordine) {
|
||||
this.ordine = ordine;
|
||||
}
|
||||
|
||||
public Griglia getGriglia() {
|
||||
return griglia;
|
||||
}
|
||||
|
||||
public void setGriglia(Griglia griglia) {
|
||||
this.griglia = griglia;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package it.integry.integrywmsnative.core.data_store.db.view_model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class OrdiniAcquistoGrigliaDTO {
|
||||
private String descrLisa;
|
||||
|
||||
private String descrDepo;
|
||||
|
||||
private List<ArticoloOrdinabileDTO> articoli;
|
||||
|
||||
public String getDescrLisa() {
|
||||
return descrLisa;
|
||||
}
|
||||
|
||||
public OrdiniAcquistoGrigliaDTO setDescrLisa(String descrLisa) {
|
||||
this.descrLisa = descrLisa;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDescrDepo() {
|
||||
return descrDepo;
|
||||
}
|
||||
|
||||
public OrdiniAcquistoGrigliaDTO setDescrDepo(String descrDepo) {
|
||||
this.descrDepo = descrDepo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<ArticoloOrdinabileDTO> getArticoli() {
|
||||
return articoli;
|
||||
}
|
||||
|
||||
public OrdiniAcquistoGrigliaDTO setArticoli(List<ArticoloOrdinabileDTO> articoli) {
|
||||
this.articoli = articoli;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,10 +1,9 @@
|
||||
package it.integry.integrywmsnative.core.di;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
|
||||
import androidx.databinding.BaseObservable;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import it.integry.integrywmsnative.core.CommonConst;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityNumber;
|
||||
|
||||
@@ -20,7 +19,7 @@ public class BindableFloat extends BaseObservable {
|
||||
|
||||
if(numberOfDigits > CommonConst.Config.NUMBER_OF_DECIMAL_DIGITS) numberOfDigits = CommonConst.Config.NUMBER_OF_DECIMAL_DIGITS;
|
||||
|
||||
return new BigDecimal(get());
|
||||
return BigDecimal.valueOf(get());
|
||||
}
|
||||
|
||||
public Float get(boolean defaultIfNull) {
|
||||
|
||||
@@ -24,6 +24,7 @@ import androidx.databinding.BindingAdapter;
|
||||
import androidx.databinding.BindingConversion;
|
||||
import androidx.databinding.Observable;
|
||||
import androidx.databinding.ObservableField;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import com.google.android.material.datepicker.MaterialDatePicker;
|
||||
import com.google.android.material.textfield.TextInputEditText;
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package it.integry.integrywmsnative.core.exception;
|
||||
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityResources;
|
||||
|
||||
public final class EmptyOrderException extends Exception {
|
||||
public EmptyOrderException() {
|
||||
super(UtilityResources.getString(R.string.empty_order));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package it.integry.integrywmsnative.core.exception;
|
||||
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityResources;
|
||||
|
||||
public final class ExpiredProductListException extends Exception {
|
||||
public ExpiredProductListException() {
|
||||
super(UtilityResources.getString(R.string.expired_list_session));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package it.integry.integrywmsnative.core.exception;
|
||||
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityResources;
|
||||
|
||||
public class GridNotSelectedException extends Exception {
|
||||
|
||||
public GridNotSelectedException() {
|
||||
super(UtilityResources.getString(R.string.grid_not_selected));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package it.integry.integrywmsnative.core.exception;
|
||||
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityResources;
|
||||
|
||||
public final class InvalidProductOrderedException extends Exception {
|
||||
|
||||
public InvalidProductOrderedException() {
|
||||
super(UtilityResources.getString(R.string.invalid_product_ordered));
|
||||
}
|
||||
|
||||
public InvalidProductOrderedException(String product) {
|
||||
super(UtilityResources.getString(R.string.invalid_product_ordered) + " (" + product + ")");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package it.integry.integrywmsnative.core.exception;
|
||||
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityResources;
|
||||
|
||||
public class MaxQtyExceededException extends Exception {
|
||||
|
||||
public MaxQtyExceededException() {
|
||||
super(UtilityResources.getString(R.string.max_qty_exceeded));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package it.integry.integrywmsnative.core.exception;
|
||||
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityResources;
|
||||
|
||||
public final class MultipleResultFromBarcodeException extends Exception {
|
||||
|
||||
public MultipleResultFromBarcodeException() {
|
||||
super(UtilityResources.getString(R.string.multiple_results_from_barcode));
|
||||
}
|
||||
|
||||
public MultipleResultFromBarcodeException(String barcode) {
|
||||
super(UtilityResources.getString(R.string.multiple_results_from_barcode) + " (" + barcode + ")");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package it.integry.integrywmsnative.core.exception;
|
||||
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityResources;
|
||||
|
||||
public final class NoResultFromCodMartException extends Exception {
|
||||
|
||||
public NoResultFromCodMartException() {
|
||||
super(UtilityResources.getString(R.string.no_result_from_cod_mart));
|
||||
}
|
||||
|
||||
public NoResultFromCodMartException(String codMart) {
|
||||
super(UtilityResources.getString(R.string.no_result_from_cod_mart) + " (" + codMart + ")");
|
||||
}
|
||||
}
|
||||
@@ -27,6 +27,20 @@ public class BaseDialogFragment extends DialogFragment implements DialogInterfac
|
||||
|
||||
private boolean mBarcodeListener = false;
|
||||
|
||||
private boolean cancelable = true;
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isCancelable() {
|
||||
return cancelable;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setCancelable(boolean cancelable) {
|
||||
super.setCancelable(cancelable);
|
||||
this.cancelable = cancelable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show(FragmentManager manager, String tag) {
|
||||
@@ -115,4 +129,6 @@ public class BaseDialogFragment extends DialogFragment implements DialogInterfac
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -860,4 +860,9 @@ public class MtbAart extends EntityBase {
|
||||
this.numCnfImpegnata = numCnfImpegnata;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public MtbUntMis getFirstUntMis() {
|
||||
return getMtbUntMis() != null && !getMtbUntMis().isEmpty() ? getMtbUntMis().get(0) : null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,28 +68,6 @@ public class MtbColt extends EntityBase {
|
||||
private Boolean disablePrint;
|
||||
private String ragSocCliente;
|
||||
|
||||
public void generaFiltroOrdine() throws Exception {
|
||||
|
||||
if (this.gestione == null) {
|
||||
throw new Exception("Impossibile creare il filtro dell'ordine se la gestione non è valorizzata");
|
||||
}
|
||||
|
||||
if (this.dataOrd == null) {
|
||||
throw new Exception("Impossibile creare il filtro dell'ordine se la data dell'ordine non è valorizzata");
|
||||
}
|
||||
|
||||
if (this.numOrd == null) {
|
||||
throw new Exception("Impossibile creare il filtro dell'ordine se il numero dell'ordine non è valorizzato");
|
||||
}
|
||||
|
||||
|
||||
Date dateOrd = UtilityDate.recognizeDate(this.dataOrd);
|
||||
String dateYMD = UtilityDate.formatDate(dateOrd, UtilityDate.COMMONS_DATE_FORMATS.YMD_SLASH);
|
||||
|
||||
this.filtroOrdini = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><ROOT><FILTER><DTB_ORDT><GESTIONE type=\"V\">" + this.gestione + "</GESTIONE><DATA_ORD type=\"D\">" + dateYMD + "</DATA_ORD><NUM_ORD type=\"N\">" + this.numOrd + "</NUM_ORD></DTB_ORDT></FILTER></ROOT>";
|
||||
}
|
||||
|
||||
|
||||
private ObservableArrayList<MtbColr> mtbColr = new ObservableArrayList<>();
|
||||
|
||||
public ObservableArrayList<MtbColr> getMtbColr() {
|
||||
|
||||
@@ -38,6 +38,7 @@ public class MtbUntMis extends EntityBase {
|
||||
}
|
||||
|
||||
public BigDecimal getCifreDec() {
|
||||
if(isFlagDig()) return BigDecimal.ZERO;
|
||||
return cifreDec;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package it.integry.integrywmsnative.core.model;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.time.LocalDate;
|
||||
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||
|
||||
/**
|
||||
* Created by ValerioC on 06/03/2018.
|
||||
@@ -10,7 +12,7 @@ import java.util.Date;
|
||||
public class MvwSitArtUdcDetInventario {
|
||||
|
||||
private String gestione;
|
||||
private Date dataCollo;
|
||||
private LocalDate dataCollo;
|
||||
private String serCollo;
|
||||
private Integer numCollo;
|
||||
private Integer segno;
|
||||
@@ -25,6 +27,7 @@ public class MvwSitArtUdcDetInventario {
|
||||
private String diacod;
|
||||
private String descrizioneEstesa;
|
||||
private String partitaMag;
|
||||
private LocalDate dataScad;
|
||||
private String codJcom;
|
||||
private String commessa;
|
||||
private String untMis;
|
||||
@@ -36,7 +39,6 @@ public class MvwSitArtUdcDetInventario {
|
||||
private String codJfas;
|
||||
private MtbAart mtbAart;
|
||||
|
||||
|
||||
public String getGestione() {
|
||||
return gestione;
|
||||
}
|
||||
@@ -46,11 +48,11 @@ public class MvwSitArtUdcDetInventario {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataCollo() {
|
||||
public LocalDate getDataCollo() {
|
||||
return dataCollo;
|
||||
}
|
||||
|
||||
public MvwSitArtUdcDetInventario setDataCollo(Date dataCollo) {
|
||||
public MvwSitArtUdcDetInventario setDataCollo(LocalDate dataCollo) {
|
||||
this.dataCollo = dataCollo;
|
||||
return this;
|
||||
}
|
||||
@@ -181,6 +183,15 @@ public class MvwSitArtUdcDetInventario {
|
||||
return this;
|
||||
}
|
||||
|
||||
public LocalDate getDataScad() {
|
||||
return dataScad;
|
||||
}
|
||||
|
||||
public MvwSitArtUdcDetInventario setDataScad(LocalDate dataScad) {
|
||||
this.dataScad = dataScad;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodJcom() {
|
||||
return codJcom;
|
||||
}
|
||||
@@ -271,12 +282,11 @@ public class MvwSitArtUdcDetInventario {
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public MtbColr toMtbColr() {
|
||||
return new MtbColr()
|
||||
.setCodJcom(getCodJcom())
|
||||
.setCodMart(getCodMart())
|
||||
.setDataCollo(getDataCollo())
|
||||
.setDataCollo(UtilityDate.toDate(getDataCollo()))
|
||||
.setNumCollo(getNumCollo())
|
||||
.setSerCollo(getSerCollo())
|
||||
.setGestione(getGestione())
|
||||
|
||||
@@ -22,6 +22,7 @@ public class HttpInterceptor implements Interceptor {
|
||||
final String PROFILE_DB = SettingsManager.i().getUserSession() == null ? null : SettingsManager.i().getUserSession().getProfileDB();
|
||||
final String USERNAME = SettingsManager.i().getUser().getUsername();
|
||||
final String PASSWORD = SettingsManager.i().getUser().getPassword();
|
||||
final String DEVICE_ID = SettingsManager.i().getUserSession().getDeviceId();
|
||||
|
||||
final Request request = chain.request();
|
||||
final HttpUrl url = request.url().newBuilder()
|
||||
@@ -36,6 +37,7 @@ public class HttpInterceptor implements Interceptor {
|
||||
.addHeader("Accept", "*/*")
|
||||
.addHeader("username", USERNAME != null ? USERNAME : "")
|
||||
.addHeader("password", PASSWORD != null ? PASSWORD : "")
|
||||
.addHeader("device_id", DEVICE_ID != null ? DEVICE_ID : "")
|
||||
.url(url).build();
|
||||
|
||||
return chain.proceed(newRequest);
|
||||
|
||||
@@ -63,7 +63,7 @@ public class RESTBuilder {
|
||||
|
||||
OkHttpClient client = clientBuilder.build();
|
||||
|
||||
String endpoint = protocol + "://" + host + ":" + port + "/" + (addEmsApi ? "ems-api/" : "");
|
||||
String endpoint = protocol + "://" + host + (port > 0 ? ":" + port : "") + "/" + (addEmsApi ? "ems-api/" : "");
|
||||
|
||||
|
||||
Gson gson = new GsonBuilder()
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.google.gson.reflect.TypeToken;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
@@ -14,6 +15,7 @@ import javax.inject.Singleton;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||
import it.integry.integrywmsnative.core.model.MtbGrup;
|
||||
import it.integry.integrywmsnative.core.model.MtbUntMis;
|
||||
import it.integry.integrywmsnative.core.model.dto.StatoArticoloDTO;
|
||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
@@ -58,6 +60,8 @@ public class ArticoloRESTConsumer extends _BaseRESTConsumer {
|
||||
public static void getByCodMartsStatic(List<String> codMartToFind, RunnableArgs<List<MtbAart>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
String joinedCods = Stream.of(codMartToFind)
|
||||
.withoutNulls()
|
||||
.distinct()
|
||||
.collect(Collectors.joining(","));
|
||||
|
||||
|
||||
@@ -131,8 +135,55 @@ public class ArticoloRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
public void getUntMisArts(List<String> inputUntMis, RunnableArgs<List<MtbUntMis>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
List<HashMap<String, Object>> whereCondList = Stream.of(inputUntMis)
|
||||
.distinct()
|
||||
.withoutNulls()
|
||||
.map(x -> {
|
||||
HashMap<String, Object> data = new HashMap<>();
|
||||
data.put("unt_mis", x);
|
||||
return data;
|
||||
})
|
||||
.toList();
|
||||
|
||||
var whereCond = whereCondList.isEmpty() ? "" : " WHERE " + UtilityQuery.concatFieldListInWhereCond(whereCondList);
|
||||
|
||||
Type typeOfObjectsList = new TypeToken<ArrayList<MtbUntMis>>() {
|
||||
}.getType();
|
||||
this.systemRESTConsumer.processSql("SELECT * FROM mtb_unt_mis " + whereCond, typeOfObjectsList, onComplete, onFailed);
|
||||
}
|
||||
|
||||
public void fillMtbAartsWithMtbUntMis(List<MtbAart> inputMtbAart, RunnableArgs<List<MtbAart>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
var inputUntMis = new ArrayList<String>();
|
||||
|
||||
if (inputMtbAart != null && !inputMtbAart.isEmpty()) {
|
||||
inputUntMis.addAll(Stream.of(inputMtbAart)
|
||||
.map(MtbAart::getUntMis)
|
||||
.withoutNulls()
|
||||
.distinct()
|
||||
.toList());
|
||||
}
|
||||
|
||||
if (inputUntMis.isEmpty()) {
|
||||
onComplete.run(inputMtbAart);
|
||||
return;
|
||||
}
|
||||
|
||||
getUntMisArts(inputUntMis, mtbUntMiss -> {
|
||||
for (var item : inputMtbAart) {
|
||||
var mtbUntMis = Stream.of(mtbUntMiss).filter(x -> x.getUntMis().equalsIgnoreCase(item.getUntMis()))
|
||||
.findFirstOrElse(null);
|
||||
|
||||
if (mtbUntMis != null)
|
||||
item.setMtbUntMis(Collections.singletonList(mtbUntMis));
|
||||
}
|
||||
|
||||
onComplete.run(inputMtbAart);
|
||||
}, onFailed);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,8 @@ import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.DeleteUDSRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.DeleteUDSRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.EditUDSRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.EditUDSRowResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.PrintUDSRequestDTO;
|
||||
@@ -137,6 +139,23 @@ public class ColliLavorazioneRESTConsumer extends _BaseRESTConsumer implements C
|
||||
});
|
||||
}
|
||||
|
||||
public void editUDSRow(EditUDSRowRequestDTO editUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = RESTBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||
|
||||
colliLavorazioneRESTConsumerService.editUDSRow(editUDSRowRequestDTO)
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<EditUDSRowResponseDTO>> call, Response<ServiceRESTResponse<EditUDSRowResponseDTO>> response) {
|
||||
analyzeAnswer(response, "lavorazione/editUDSRow", data -> onComplete.run(data.getSavedMtbColr()), onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<EditUDSRowResponseDTO>> call, Throwable t) {
|
||||
onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteUDSRow(DeleteUDSRowRequestDTO deleteUDSRowRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = RESTBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||
|
||||
@@ -8,6 +8,8 @@ import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.DeleteUDSRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.DeleteUDSRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.EditUDSRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.EditUDSRowResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.PrintUDSRequestDTO;
|
||||
@@ -35,6 +37,9 @@ public interface ColliLavorazioneRESTConsumerService {
|
||||
@POST("wms/lavorazione/insertUDSRow")
|
||||
Call<ServiceRESTResponse<InsertUDSRowResponseDTO>> insertUDSRow(@Body InsertUDSRowRequestDTO insertUDSRowRequestDTO);
|
||||
|
||||
@POST("wms/lavorazione/editUDSRow")
|
||||
Call<ServiceRESTResponse<EditUDSRowResponseDTO>> editUDSRow(@Body EditUDSRowRequestDTO editUDSRowRequestDTO);
|
||||
|
||||
@POST("wms/lavorazione/deleteUDSRow")
|
||||
Call<ServiceRESTResponse<Void>> deleteUDSRow(@Body DeleteUDSRowRequestDTO deleteUDSRowRequestDTO);
|
||||
|
||||
|
||||
@@ -15,6 +15,8 @@ import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.DeleteUDSRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.DeleteUDSRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.EditUDSRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.EditUDSRowResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.PrintUDSRequestDTO;
|
||||
@@ -133,6 +135,23 @@ public class ColliSpedizioneRESTConsumer extends _BaseRESTConsumer implements Co
|
||||
});
|
||||
}
|
||||
|
||||
public void editUDSRow(EditUDSRowRequestDTO editUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = RESTBuilder.getService(ColliSpedizioneRESTConsumerService.class);
|
||||
|
||||
colliSpedizioneRESTConsumerService.editUDSRow(editUDSRowRequestDTO)
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<EditUDSRowResponseDTO>> call, Response<ServiceRESTResponse<EditUDSRowResponseDTO>> response) {
|
||||
analyzeAnswer(response, "spedizione/editUDSRow", data -> onComplete.run(data.getSavedMtbColr()), onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<EditUDSRowResponseDTO>> call, Throwable t) {
|
||||
onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void deleteUDSRow(DeleteUDSRowRequestDTO deleteUDSRowRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = RESTBuilder.getService(ColliSpedizioneRESTConsumerService.class);
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@ import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.DeleteUDSRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.DeleteUDSRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.EditUDSRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.EditUDSRowResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.PrintUDSRequestDTO;
|
||||
@@ -35,6 +37,9 @@ public interface ColliSpedizioneRESTConsumerService {
|
||||
@POST("wms/spedizione/insertUDSRow")
|
||||
Call<ServiceRESTResponse<InsertUDSRowResponseDTO>> insertUDSRow(@Body InsertUDSRowRequestDTO insertUDSRowRequestDTO);
|
||||
|
||||
@POST("wms/spedizione/editUDSRow")
|
||||
Call<ServiceRESTResponse<EditUDSRowResponseDTO>> editUDSRow(@Body EditUDSRowRequestDTO editUDSRowRequestDTO);
|
||||
|
||||
@POST("wms/spedizione/deleteUDSRow")
|
||||
Call<ServiceRESTResponse<Void>> deleteUDSRow(@Body DeleteUDSRowRequestDTO deleteUDSRowRequestDTO);
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package it.integry.integrywmsnative.core.rest.consumers;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
@@ -9,12 +11,13 @@ import it.integry.integrywmsnative.core.model.DtbDoct;
|
||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||
import it.integry.integrywmsnative.core.rest.model.LoadColliDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.core.rest.model.documento.RetrieveDocumentoArtsResponseDTO;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
|
||||
@Singleton
|
||||
public class DocumentiRESTConsumer extends _BaseRESTConsumer {
|
||||
public class DocumentRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
|
||||
public void createDocsFromColli(List<LoadColliDTO> listColli, RunnableArgs<List<DtbDoct>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
@@ -48,4 +51,21 @@ public class DocumentiRESTConsumer extends _BaseRESTConsumer {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public void loadDocumentAvailableArts(String codDtip, String codMgrp, String codAnagForn, RunnableArgs<RetrieveDocumentoArtsResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
var inventarioRESTConsumerService = RESTBuilder.getService(DocumentiRESTConsumerService.class);
|
||||
inventarioRESTConsumerService.retrieveArts(codDtip, codMgrp, codAnagForn)
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<ServiceRESTResponse<RetrieveDocumentoArtsResponseDTO>> call, @NonNull Response<ServiceRESTResponse<RetrieveDocumentoArtsResponseDTO>> response) {
|
||||
analyzeAnswer(response, "loadDocumentoArts", onComplete, onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<ServiceRESTResponse<RetrieveDocumentoArtsResponseDTO>> call, @NonNull Throwable t) {
|
||||
onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -5,9 +5,12 @@ import java.util.List;
|
||||
import it.integry.integrywmsnative.core.model.DtbDoct;
|
||||
import it.integry.integrywmsnative.core.rest.model.LoadColliDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.core.rest.model.documento.RetrieveDocumentoArtsResponseDTO;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.http.Body;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.POST;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
public interface DocumentiRESTConsumerService {
|
||||
|
||||
@@ -17,4 +20,13 @@ public interface DocumentiRESTConsumerService {
|
||||
@POST("createDocFromColli")
|
||||
Call<ServiceRESTResponse<DtbDoct>> createDocFromColli(@Body LoadColliDTO listColli);
|
||||
|
||||
|
||||
|
||||
|
||||
@GET("wms/documento/arts")
|
||||
Call<ServiceRESTResponse<RetrieveDocumentoArtsResponseDTO>> retrieveArts(
|
||||
@Query("codDtip") String codDtip,
|
||||
@Query("codMgrp") String codMgrp,
|
||||
@Query("codAnagForn") String codAnagForn);
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package it.integry.integrywmsnative.core.rest.consumers;
|
||||
import com.annimon.stream.Optional;
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
@@ -13,6 +14,9 @@ import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
||||
import it.integry.integrywmsnative.core.model.MvwSitArtUdcDetInventario;
|
||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.core.rest.model.giacenza.InstantItemSituationIncomingItemDto;
|
||||
import it.integry.integrywmsnative.core.rest.model.giacenza.InstantItemSituationResponseDto;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
@@ -67,5 +71,118 @@ public class GiacenzaRESTConsumer extends _BaseRESTConsumer {
|
||||
});
|
||||
}
|
||||
|
||||
public void getGiacenzeByArticolo(String codMart, String partitaMag, RunnableArgs<List<MvwSitArtUdcDetInventario>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
GiacenzaRESTConsumerService giacenzaRESTConsumerService = RESTBuilder.getService(GiacenzaRESTConsumerService.class);
|
||||
var serviceRESTResponseCall =
|
||||
UtilityString.isNullOrEmpty(partitaMag) ?
|
||||
giacenzaRESTConsumerService.retrieveAvailableItemsByArt(codMart) :
|
||||
giacenzaRESTConsumerService.retrieveAvailableItemsByArt(codMart, partitaMag);
|
||||
serviceRESTResponseCall.enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<List<MvwSitArtUdcDetInventario>>> call, Response<ServiceRESTResponse<List<MvwSitArtUdcDetInventario>>> response) {
|
||||
analyzeAnswer(response, "getGiacenzeByArticolo", inventarioList -> {
|
||||
|
||||
List<String> codMarts = Stream.of(inventarioList)
|
||||
.map(x -> x.getCodMart().trim())
|
||||
.distinct()
|
||||
.toList();
|
||||
|
||||
mArticoloRESTConsumer.getByCodMarts(codMarts, mtbAarts -> {
|
||||
for (var row : inventarioList) {
|
||||
|
||||
MtbAart foundMtbAart = null;
|
||||
Optional<MtbAart> mtbAartOpt = Stream.of(mtbAarts)
|
||||
.filter(x -> x.getCodMart().equalsIgnoreCase(row.getCodMart()))
|
||||
.findFirst();
|
||||
|
||||
if (mtbAartOpt.isPresent()) {
|
||||
foundMtbAart = mtbAartOpt.get();
|
||||
}
|
||||
|
||||
row.setMtbAart(foundMtbAart);
|
||||
}
|
||||
|
||||
onComplete.run(inventarioList);
|
||||
}, onFailed);
|
||||
}, onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<List<MvwSitArtUdcDetInventario>>> call, Throwable t) {
|
||||
onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public void getInstantItemSituation(String codMdep, String codMart, String partitaMag, String codJcom, RunnableArgs<InstantItemSituationResponseDto> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
GiacenzaRESTConsumerService giacenzaRESTConsumerService = RESTBuilder.getService(GiacenzaRESTConsumerService.class);
|
||||
|
||||
giacenzaRESTConsumerService.retrieveInstantItemSituation(codMdep, codMart, partitaMag, codJcom)
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<InstantItemSituationResponseDto>> call, Response<ServiceRESTResponse<InstantItemSituationResponseDto>> response) {
|
||||
analyzeAnswer(response, "getInstantItemSituation", data -> {
|
||||
|
||||
fillInstantItemSituationWithMtbAarts(data, onComplete, onFailed);
|
||||
}, onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<InstantItemSituationResponseDto>> call, Throwable t) {
|
||||
onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void fillInstantItemSituationWithMtbAarts(InstantItemSituationResponseDto data, RunnableArgs<InstantItemSituationResponseDto> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
var inputCodMarts = new ArrayList<String>();
|
||||
|
||||
if (data.getIncomingItems() != null && !data.getIncomingItems().isEmpty()) {
|
||||
inputCodMarts.addAll(Stream.of(data.getIncomingItems())
|
||||
.map(InstantItemSituationIncomingItemDto::getCodMart)
|
||||
.toList());
|
||||
}
|
||||
|
||||
if (data.getAvailableItems() != null && !data.getAvailableItems().isEmpty()) {
|
||||
inputCodMarts.addAll(Stream.of(data.getAvailableItems())
|
||||
.map(MvwSitArtUdcDetInventario::getCodMart)
|
||||
.toList());
|
||||
}
|
||||
|
||||
if (inputCodMarts.isEmpty()) {
|
||||
onComplete.run(data);
|
||||
return;
|
||||
}
|
||||
|
||||
mArticoloRESTConsumer.getByCodMarts(inputCodMarts, mtbAarts -> {
|
||||
|
||||
mArticoloRESTConsumer.fillMtbAartsWithMtbUntMis(mtbAarts, newMtbAarts -> {
|
||||
if (data.getIncomingItems() != null && !data.getIncomingItems().isEmpty()) {
|
||||
for (var item : data.getIncomingItems()) {
|
||||
var mtbAart = Stream.of(newMtbAarts).filter(x -> x.getCodMart().equalsIgnoreCase(item.getCodMart()))
|
||||
.findFirstOrElse(null);
|
||||
|
||||
if (mtbAart != null)
|
||||
item.setMtbAart(mtbAart);
|
||||
}
|
||||
}
|
||||
|
||||
if (data.getAvailableItems() != null && !data.getAvailableItems().isEmpty()) {
|
||||
for (var item : data.getAvailableItems()) {
|
||||
var mtbAart = Stream.of(newMtbAarts).filter(x -> x.getCodMart().equalsIgnoreCase(item.getCodMart()))
|
||||
.findFirstOrElse(null);
|
||||
|
||||
if (mtbAart != null)
|
||||
item.setMtbAart(mtbAart);
|
||||
}
|
||||
}
|
||||
|
||||
onComplete.run(data);
|
||||
}, onFailed);
|
||||
|
||||
}, onFailed);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -4,14 +4,31 @@ import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.MvwSitArtUdcDetInventario;
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.core.rest.model.giacenza.InstantItemSituationResponseDto;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
public interface GiacenzaRESTConsumerService {
|
||||
|
||||
@GET("wms/giacenza/availableItems")
|
||||
@GET("wms/giacenza/availableItemsByPosizione")
|
||||
Call<ServiceRESTResponse<List<MvwSitArtUdcDetInventario>>> retrieveAvailableItems(
|
||||
@Query("posizione") String posizione);
|
||||
|
||||
@GET("wms/giacenza/availableItemsByArticolo")
|
||||
Call<ServiceRESTResponse<List<MvwSitArtUdcDetInventario>>> retrieveAvailableItemsByArt(
|
||||
@Query("codMart") String codMart);
|
||||
|
||||
@GET("wms/giacenza/availableItemsByArticolo")
|
||||
Call<ServiceRESTResponse<List<MvwSitArtUdcDetInventario>>> retrieveAvailableItemsByArt(
|
||||
@Query("codMart") String codMart,
|
||||
@Query("partitaMag") String partitaMag);
|
||||
|
||||
@GET("wms/giacenza/instantItemSituation")
|
||||
Call<ServiceRESTResponse<InstantItemSituationResponseDto>> retrieveInstantItemSituation(
|
||||
@Query("codMdep") String codMdep,
|
||||
@Query("codMart") String codMart,
|
||||
@Query("partitaMag") String partitaMag,
|
||||
@Query("codJcom") String codJcom);
|
||||
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ public class InventarioRESTConsumer extends _BaseRESTConsumer {
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<ServiceRESTResponse<RetrieveInventarioArtsResponseDTO>> call, @NonNull Response<ServiceRESTResponse<RetrieveInventarioArtsResponseDTO>> response) {
|
||||
analyzeAnswer(response, "loadInventario", onComplete, onFailed);
|
||||
analyzeAnswer(response, "loadInventarioArts", onComplete, onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -61,6 +61,7 @@ public class InventarioRESTConsumer extends _BaseRESTConsumer {
|
||||
.execute();
|
||||
|
||||
var data = analyzeAnswer(response, "retrieveInventario");
|
||||
if (data == null) return null;
|
||||
return data.getInventories();
|
||||
}
|
||||
|
||||
@@ -71,18 +72,18 @@ public class InventarioRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
var inventarioRESTConsumerService = RESTBuilder.getService(InventarioRESTConsumerService.class, 120);
|
||||
inventarioRESTConsumerService
|
||||
.insert(inventarioToInsert.getIdInventario(), request)
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
|
||||
analyzeAnswer(response, "insertInventario", ignored -> onComplete.run(), onFailed);
|
||||
}
|
||||
.insert(inventarioToInsert.getIdInventario(), request)
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
|
||||
analyzeAnswer(response, "insertInventario", ignored -> onComplete.run(), onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<Void>> call, Throwable t) {
|
||||
onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<Void>> call, Throwable t) {
|
||||
onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package it.integry.integrywmsnative.core.rest.consumers;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
@@ -72,17 +71,17 @@ public class MagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
});
|
||||
}
|
||||
|
||||
public void saveTerminalinoWMS(SaveDTO saveDTO, RunnableArgs<JsonObject> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public void saveTerminalinoWMS(SaveDTO saveDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
MagazzinoRESTConsumerService service = RESTBuilder.getService(MagazzinoRESTConsumerService.class);
|
||||
service.saveTerminalinoWMS(saveDTO)
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<JsonObject>> call, Response<ServiceRESTResponse<JsonObject>> response) {
|
||||
analyzeAnswer(response, "saveTerminalinoWMS", onComplete, onFailed);
|
||||
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
|
||||
analyzeAnswer(response, "saveTerminalinoWMS", data -> onComplete.run(), onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<JsonObject>> call, Throwable t) {
|
||||
public void onFailure(Call<ServiceRESTResponse<Void>> call, Throwable t) {
|
||||
onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package it.integry.integrywmsnative.core.rest.consumers;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.DtbOrdt;
|
||||
@@ -14,7 +12,7 @@ import retrofit2.http.POST;
|
||||
public interface MagazzinoRESTConsumerService {
|
||||
|
||||
@POST("SM2SaveTerminalinoWMS")
|
||||
Call<ServiceRESTResponse<JsonObject>> saveTerminalinoWMS(@Body SaveDTO saveDTO);
|
||||
Call<ServiceRESTResponse<Void>> saveTerminalinoWMS(@Body SaveDTO saveDTO);
|
||||
|
||||
@POST("SM2SaveTerminalino")
|
||||
Call<List<ServiceRESTResponse<DtbOrdt>>> saveOrdine(@Body SaveDTO saveDTO);
|
||||
|
||||
@@ -61,7 +61,10 @@ public class OrdiniRESTConsumer extends _BaseRESTConsumer {
|
||||
.filter(x -> !UtilityString.isNullOrEmpty(x.getPartitaMag()))
|
||||
.forEach(x -> {
|
||||
|
||||
if (!Stream.of(batchLotsToSearch).anyMatch(batchLotToSearch -> batchLotToSearch.getCodMart().equalsIgnoreCase(x.getCodMart()) && batchLotToSearch.getPartitaMag().equalsIgnoreCase(x.getPartitaMag()))) {
|
||||
if (!Stream.of(batchLotsToSearch)
|
||||
.anyMatch(batchLotToSearch ->
|
||||
batchLotToSearch.getCodMart().equalsIgnoreCase(x.getCodMart()) &&
|
||||
batchLotToSearch.getPartitaMag().equalsIgnoreCase(x.getPartitaMag()))) {
|
||||
MtbPartitaMag mtbPartitaMag = new MtbPartitaMag()
|
||||
.setCodMart(x.getCodMart())
|
||||
.setPartitaMag(x.getPartitaMag());
|
||||
|
||||
@@ -2,8 +2,6 @@ package it.integry.integrywmsnative.core.rest.consumers;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
@@ -13,8 +11,7 @@ import javax.inject.Singleton;
|
||||
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.ArticoloOrdine;
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.Ordine;
|
||||
import it.integry.integrywmsnative.core.data_store.db.view_model.ArticoloDTO;
|
||||
import it.integry.integrywmsnative.core.data_store.db.view_model.GrigliaDTO;
|
||||
import it.integry.integrywmsnative.core.data_store.db.view_model.OrdiniAcquistoGrigliaDTO;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
@@ -37,47 +34,23 @@ public class PVOrdiniAcquistoRESTConsumer extends _BaseRESTConsumer {
|
||||
this.magazzinoRESTConsumer = magazzinoRESTConsumer;
|
||||
}
|
||||
|
||||
public void getArticoliListino(String codAlis, RunnableArgs<GrigliaDTO> onSuccess, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
public void retrieveArticoli(String codAlis, String codMdep, RunnableArgs<OrdiniAcquistoGrigliaDTO> onSuccess, RunnableArgs<Exception> onFailed) {
|
||||
PVOrdiniAcquistoRESTConsumerService ordiniARestService = RESTBuilder.getService(PVOrdiniAcquistoRESTConsumerService.class, 300);
|
||||
ordiniARestService
|
||||
.getArticoliListino(codAlis)
|
||||
ordiniARestService.retrieveArticoli(codAlis, codMdep, null)
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<GrigliaDTO>> call, Response<ServiceRESTResponse<GrigliaDTO>> response) {
|
||||
analyzeAnswer(response, "getArticoliListino", griglia -> {
|
||||
|
||||
public void onResponse(Call<ServiceRESTResponse<OrdiniAcquistoGrigliaDTO>> call, Response<ServiceRESTResponse<OrdiniAcquistoGrigliaDTO>> response) {
|
||||
var startTime = new Date().getTime();
|
||||
analyzeAnswer(response, "retrieveArticoliOrdine", articoliOrdineWrapper -> {
|
||||
UtilityThread.executeParallel(() -> {
|
||||
var startTime = new Date().getTime();
|
||||
|
||||
List<ArticoloDTO> listaArticoli = new ArrayList<>();
|
||||
|
||||
Stream.of(griglia.getGrigliaAcquistiChild())
|
||||
.groupBy(ArticoloDTO::getCodMart)
|
||||
.forEach(entry -> {
|
||||
|
||||
if (entry.getValue().size() == 1) {
|
||||
listaArticoli.add(entry.getValue().get(0));
|
||||
} else {
|
||||
for (ArticoloDTO articolo : entry.getValue()) {
|
||||
if (!articolo.getBarCode().endsWith(articolo.getCodMart())) {
|
||||
listaArticoli.add(articolo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
griglia.setGrigliaAcquistiChild(listaArticoli);
|
||||
|
||||
Log.d("LOADING TIME 1", "MS: " + (new Date().getTime() - startTime));
|
||||
onSuccess.run(griglia);
|
||||
onSuccess.run(articoliOrdineWrapper);
|
||||
}, false);
|
||||
}, onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<GrigliaDTO>> call, Throwable t) {
|
||||
public void onFailure(Call<ServiceRESTResponse<OrdiniAcquistoGrigliaDTO>> call, Throwable t) {
|
||||
Log.e("getArticoliListino_pv", t.toString());
|
||||
UtilityLogger.error(new Exception(t));
|
||||
onFailed.run(new Exception(t));
|
||||
@@ -85,7 +58,31 @@ public class PVOrdiniAcquistoRESTConsumer extends _BaseRESTConsumer {
|
||||
});
|
||||
}
|
||||
|
||||
public void saveOrdine(Ordine ordine, List<ArticoloOrdine> articoli, RunnableArgs<Ordine> onSuccess, RunnableArgs<Exception> onFailed) {
|
||||
public void retrieveArticolo(String codAlis, String codMdep, String barcode, RunnableArgs<OrdiniAcquistoGrigliaDTO> onSuccess, RunnableArgs<Exception> onFailed) {
|
||||
PVOrdiniAcquistoRESTConsumerService ordiniARestService = RESTBuilder.getService(PVOrdiniAcquistoRESTConsumerService.class, 300);
|
||||
ordiniARestService.retrieveArticoli(codAlis, codMdep, barcode)
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<OrdiniAcquistoGrigliaDTO>> call, Response<ServiceRESTResponse<OrdiniAcquistoGrigliaDTO>> response) {
|
||||
var startTime = new Date().getTime();
|
||||
analyzeAnswer(response, "retrieveArticoliOrdine", articoliOrdineWrapper -> {
|
||||
UtilityThread.executeParallel(() -> {
|
||||
Log.d("LOADING TIME 1", "MS: " + (new Date().getTime() - startTime));
|
||||
onSuccess.run(articoliOrdineWrapper);
|
||||
}, false);
|
||||
}, onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<OrdiniAcquistoGrigliaDTO>> call, Throwable t) {
|
||||
Log.e("getArticoliListino_pv", t.toString());
|
||||
UtilityLogger.error(new Exception(t));
|
||||
onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void saveOrdine(Ordine ordine, List<ArticoloOrdine> articoli, String codMdep, RunnableArgs<Ordine> onSuccess, RunnableArgs<Exception> onFailed) {
|
||||
SaveDTO saveDTO = new SaveDTO();
|
||||
OrdineDTO ordineDTO = new OrdineDTO();
|
||||
List<ArtDTO> artRows = new ArrayList<>();
|
||||
@@ -101,21 +98,36 @@ public class PVOrdiniAcquistoRESTConsumer extends _BaseRESTConsumer {
|
||||
saveDTO.setGestione("O");
|
||||
saveDTO.setOrdineDTO(ordineDTO);
|
||||
|
||||
PVOrdiniAcquistoRESTConsumerService ordiniARestService = RESTBuilder.getService(PVOrdiniAcquistoRESTConsumerService.class, 300);
|
||||
ordiniARestService.save(codMdep, saveDTO)
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) {
|
||||
var startTime = new Date().getTime();
|
||||
analyzeAnswer(response, "retrieveArticoliOrdine", articoliOrdineWrapper -> {
|
||||
UtilityThread.executeParallel(() -> {
|
||||
// if (data == null) {
|
||||
// onFailed.run(new Exception("Nessun ordine generato"));
|
||||
// return;
|
||||
// }
|
||||
ordine.setTransmitted(true);
|
||||
ordine.setTransmissionDate(UtilityDate.getDateInstance());
|
||||
// ordine.setGestione(data.getGestione());
|
||||
// ordine.setDataOrdS(data.getDataOrd());
|
||||
// ordine.setCodMdep(data.getCodMdep());
|
||||
// ordine.setNumOrd(data.getNumOrd());
|
||||
onSuccess.run(ordine);
|
||||
}, false);
|
||||
}, onFailed);
|
||||
}
|
||||
|
||||
magazzinoRESTConsumer.saveOrdine(saveDTO, data -> {
|
||||
if (data == null) {
|
||||
onFailed.run(new Exception("Nessun ordine generato"));
|
||||
return;
|
||||
}
|
||||
|
||||
ordine.setTransmitted(true);
|
||||
ordine.setTransmissionDate(UtilityDate.getDateInstance());
|
||||
ordine.setGestione(data.getGestione());
|
||||
ordine.setDataOrdS(data.getDataOrd());
|
||||
ordine.setCodMdep(data.getCodMdep());
|
||||
ordine.setNumOrd(data.getNumOrd());
|
||||
onSuccess.run(ordine);
|
||||
}, onFailed);
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<Object>> call, Throwable t) {
|
||||
Log.e("saveOrdine", t.toString());
|
||||
UtilityLogger.error(new Exception(t));
|
||||
onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
@@ -131,6 +143,7 @@ public class PVOrdiniAcquistoRESTConsumer extends _BaseRESTConsumer {
|
||||
dto.setSystemNote(art.getSystemNote());
|
||||
dto.setQta(BigDecimal.valueOf(art.getQtaOrd()));
|
||||
dto.setQtaCnf(BigDecimal.valueOf(art.getQtaCnf()));
|
||||
dto.setCodAlis(art.getCodAlis());
|
||||
dto.setColli(BigDecimal.ZERO);
|
||||
return dto;
|
||||
}
|
||||
|
||||
@@ -1,13 +1,18 @@
|
||||
package it.integry.integrywmsnative.core.rest.consumers;
|
||||
|
||||
import it.integry.integrywmsnative.core.data_store.db.view_model.GrigliaDTO;
|
||||
import it.integry.integrywmsnative.core.data_store.db.view_model.OrdiniAcquistoGrigliaDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.SaveDTO;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.http.Body;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.POST;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
public interface PVOrdiniAcquistoRESTConsumerService {
|
||||
@GET("wms/ordini-acquisto/articoli")
|
||||
Call<ServiceRESTResponse<OrdiniAcquistoGrigliaDTO>> retrieveArticoli(@Query("chiaveGriglia") String codAlis, @Query("codMdep") String codMdep, @Query("barcodeArt") String barcode);
|
||||
|
||||
@POST("SM2GetElencoArticoli")
|
||||
Call<ServiceRESTResponse<GrigliaDTO>> getArticoliListino(@Query("chiaveGriglia") String codAlis);
|
||||
@POST("wms/ordini-acquisto/save")
|
||||
Call<ServiceRESTResponse<Object>> save(@Query("codMdep") String codMdep, @Body() SaveDTO saveDTO);
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ import it.integry.integrywmsnative.core.rest.model.AvailableCodMdepsDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.MailRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.NativeSqlRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.core.rest.model.system.RegisterDeviceRequestDTO;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
@@ -39,6 +40,27 @@ import retrofit2.Response;
|
||||
@Singleton
|
||||
public class SystemRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
|
||||
public void registerDevice(final Runnable onSuccess, final RunnableArgs<Exception> onFailed) {
|
||||
RegisterDeviceRequestDTO registerDeviceRequestDTO = new RegisterDeviceRequestDTO()
|
||||
.setApp("WMS");
|
||||
|
||||
SystemRESTConsumerService systemRESTConsumerService = RESTBuilder.getService(SystemRESTConsumerService.class);
|
||||
systemRESTConsumerService.registerDevice(registerDeviceRequestDTO)
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
|
||||
analyzeAnswer(response, "device/register", Void -> onSuccess.run(), onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<Void>> call, Throwable t) {
|
||||
onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public <T> void processSql(String nativeSql, final Type clazz, final RunnableArgs<T> onComplete, final RunnableArgs<Exception> onFailed) {
|
||||
NativeSqlRequestDTO nativeSqlDTO = new NativeSqlRequestDTO();
|
||||
nativeSqlDTO.nativeSql = nativeSql;
|
||||
|
||||
@@ -6,6 +6,7 @@ import it.integry.integrywmsnative.core.rest.model.AvailableCodMdepsDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.MailRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.NativeSqlRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.core.rest.model.system.RegisterDeviceRequestDTO;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.http.Body;
|
||||
import retrofit2.http.GET;
|
||||
@@ -14,6 +15,9 @@ import retrofit2.http.Query;
|
||||
|
||||
public interface SystemRESTConsumerService {
|
||||
|
||||
@POST("device/register")
|
||||
Call<ServiceRESTResponse<Void>> registerDevice(@Body RegisterDeviceRequestDTO registerDeviceRequestDTO);
|
||||
|
||||
@POST("processSql")
|
||||
Call<ServiceRESTResponse<Object>> processSql(@Body NativeSqlRequestDTO nativeSqlDTO);
|
||||
|
||||
|
||||
@@ -101,6 +101,7 @@ public abstract class _BaseRESTConsumer {
|
||||
if (response.getEsito() == EsitoType.OK) {
|
||||
if (!UtilityString.isNullOrEmpty(response.getErrorMessage())) {
|
||||
onFailed.run(new Exception(response.getErrorMessage()));
|
||||
return;
|
||||
} else {
|
||||
T dataObj = response.getDto() != null ?
|
||||
response.getDto() :
|
||||
|
||||
@@ -9,6 +9,7 @@ import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.DeleteUDSRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.DeleteUDSRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.EditUDSRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.PrintUDSRequestDTO;
|
||||
|
||||
@@ -26,5 +27,7 @@ public interface ColliScaricoRESTConsumerInterface {
|
||||
|
||||
void insertUDSRow(InsertUDSRowRequestDTO insertUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed);
|
||||
|
||||
void editUDSRow(EditUDSRowRequestDTO editUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed);
|
||||
|
||||
void deleteUDSRow(DeleteUDSRowRequestDTO deleteUDSRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed);
|
||||
}
|
||||
|
||||
@@ -1,22 +1,29 @@
|
||||
package it.integry.integrywmsnative.gest.contab_doc_interni.dto;
|
||||
package it.integry.integrywmsnative.core.rest.model;
|
||||
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public class DocFromPickingDTO {
|
||||
String codAnag, codVdes, tipoLista, noteDoc;
|
||||
Date dataDoc;
|
||||
Integer numDoc;
|
||||
List<DatiCollo> colli;
|
||||
List<Pedane> pedane;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
|
||||
public class SaveDocFromPickingRequestDTO {
|
||||
private String codAnag;
|
||||
private String codVdes;
|
||||
private String tipoLista;
|
||||
private String noteDoc;
|
||||
private Date dataDoc;
|
||||
private Integer numDoc;
|
||||
private List<DatiCollo> colli;
|
||||
private List<Pedane> pedane;
|
||||
|
||||
public String getCodAnag() {
|
||||
return codAnag;
|
||||
}
|
||||
|
||||
public DocFromPickingDTO setCodAnag(String codAnag) {
|
||||
public SaveDocFromPickingRequestDTO setCodAnag(String codAnag) {
|
||||
this.codAnag = codAnag;
|
||||
return this;
|
||||
}
|
||||
@@ -25,7 +32,7 @@ public class DocFromPickingDTO {
|
||||
return codVdes;
|
||||
}
|
||||
|
||||
public DocFromPickingDTO setCodVdes(String codVdes) {
|
||||
public SaveDocFromPickingRequestDTO setCodVdes(String codVdes) {
|
||||
this.codVdes = codVdes;
|
||||
return this;
|
||||
}
|
||||
@@ -34,7 +41,7 @@ public class DocFromPickingDTO {
|
||||
return tipoLista;
|
||||
}
|
||||
|
||||
public DocFromPickingDTO setTipoLista(String tipoLista) {
|
||||
public SaveDocFromPickingRequestDTO setTipoLista(String tipoLista) {
|
||||
this.tipoLista = tipoLista;
|
||||
return this;
|
||||
}
|
||||
@@ -43,7 +50,7 @@ public class DocFromPickingDTO {
|
||||
return noteDoc;
|
||||
}
|
||||
|
||||
public DocFromPickingDTO setNoteDoc(String noteDoc) {
|
||||
public SaveDocFromPickingRequestDTO setNoteDoc(String noteDoc) {
|
||||
this.noteDoc = noteDoc;
|
||||
return this;
|
||||
}
|
||||
@@ -52,7 +59,7 @@ public class DocFromPickingDTO {
|
||||
return dataDoc;
|
||||
}
|
||||
|
||||
public DocFromPickingDTO setDataDoc(Date dataDoc) {
|
||||
public SaveDocFromPickingRequestDTO setDataDoc(Date dataDoc) {
|
||||
this.dataDoc = dataDoc;
|
||||
return this;
|
||||
}
|
||||
@@ -61,7 +68,7 @@ public class DocFromPickingDTO {
|
||||
return numDoc;
|
||||
}
|
||||
|
||||
public DocFromPickingDTO setNumDoc(Integer numDoc) {
|
||||
public SaveDocFromPickingRequestDTO setNumDoc(Integer numDoc) {
|
||||
this.numDoc = numDoc;
|
||||
return this;
|
||||
}
|
||||
@@ -70,11 +77,24 @@ public class DocFromPickingDTO {
|
||||
return colli;
|
||||
}
|
||||
|
||||
public DocFromPickingDTO setColli(List<DatiCollo> colli) {
|
||||
public SaveDocFromPickingRequestDTO setColli(List<DatiCollo> colli) {
|
||||
this.colli = colli;
|
||||
return this;
|
||||
}
|
||||
|
||||
public SaveDocFromPickingRequestDTO setColliFromMtbColts(List<MtbColt> colli) {
|
||||
if(colli == null) return this;
|
||||
|
||||
this.colli = Stream.of(colli)
|
||||
.map(x -> new DatiCollo()
|
||||
.setDataCollo(x.getDataColloD())
|
||||
.setSerCollo(x.getSerCollo())
|
||||
.setNumCollo(x.getNumCollo())
|
||||
.setGestione(x.getGestione()))
|
||||
.toList();
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<Pedane> getPedane() {
|
||||
return pedane;
|
||||
}
|
||||
@@ -28,6 +28,7 @@ public class SitArtOrdDTO {
|
||||
private String descrizioneMsfa;
|
||||
private String untord;
|
||||
private BigDecimal qtaOmg;
|
||||
private BigDecimal qtaArrivo;
|
||||
|
||||
private final HashMap<String, Object> extraInfo = new HashMap<>();
|
||||
|
||||
@@ -232,4 +233,13 @@ public class SitArtOrdDTO {
|
||||
this.qtaOmg = qtaOmg;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getQtaArrivo() {
|
||||
return qtaArrivo;
|
||||
}
|
||||
|
||||
public SitArtOrdDTO setQtaArrivo(BigDecimal qtaArrivo) {
|
||||
this.qtaArrivo = qtaArrivo;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,119 @@
|
||||
package it.integry.integrywmsnative.core.rest.model.documento;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class DocumentoArtDTO {
|
||||
|
||||
private String codMart;
|
||||
private String descrizione;
|
||||
private String untMis;
|
||||
private BigDecimal qtaCnf;
|
||||
private ArrayList<String> barcode;
|
||||
private boolean flagTracciabilita;
|
||||
private boolean flagQtaCnfFissa;
|
||||
private BigDecimal giacenza;
|
||||
private boolean plu;
|
||||
private BigDecimal przVendIva;
|
||||
private boolean untMisDigitale;
|
||||
|
||||
public String getCodMart() {
|
||||
return codMart;
|
||||
}
|
||||
|
||||
public DocumentoArtDTO setCodMart(String codMart) {
|
||||
this.codMart = codMart;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDescrizione() {
|
||||
return descrizione;
|
||||
}
|
||||
|
||||
public DocumentoArtDTO setDescrizione(String descrizione) {
|
||||
this.descrizione = descrizione;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getUntMis() {
|
||||
return untMis;
|
||||
}
|
||||
|
||||
public DocumentoArtDTO setUntMis(String untMis) {
|
||||
this.untMis = untMis;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getQtaCnf() {
|
||||
return qtaCnf;
|
||||
}
|
||||
|
||||
public DocumentoArtDTO setQtaCnf(BigDecimal qtaCnf) {
|
||||
this.qtaCnf = qtaCnf;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<String> getBarcode() {
|
||||
return barcode;
|
||||
}
|
||||
|
||||
public DocumentoArtDTO setBarcode(ArrayList<String> barcode) {
|
||||
this.barcode = barcode;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isFlagTracciabilita() {
|
||||
return flagTracciabilita;
|
||||
}
|
||||
|
||||
public DocumentoArtDTO setFlagTracciabilita(boolean flagTracciabilita) {
|
||||
this.flagTracciabilita = flagTracciabilita;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isFlagQtaCnfFissa() {
|
||||
return flagQtaCnfFissa;
|
||||
}
|
||||
|
||||
public DocumentoArtDTO setFlagQtaCnfFissa(boolean flagQtaCnfFissa) {
|
||||
this.flagQtaCnfFissa = flagQtaCnfFissa;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getGiacenza() {
|
||||
return giacenza;
|
||||
}
|
||||
|
||||
public DocumentoArtDTO setGiacenza(BigDecimal giacenza) {
|
||||
this.giacenza = giacenza;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isPlu() {
|
||||
return plu;
|
||||
}
|
||||
|
||||
public DocumentoArtDTO setPlu(boolean plu) {
|
||||
this.plu = plu;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getPrzVendIva() {
|
||||
return przVendIva;
|
||||
}
|
||||
|
||||
public DocumentoArtDTO setPrzVendIva(BigDecimal przVendIva) {
|
||||
this.przVendIva = przVendIva;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isUntMisDigitale() {
|
||||
return untMisDigitale;
|
||||
}
|
||||
|
||||
public DocumentoArtDTO setUntMisDigitale(boolean untMisDigitale) {
|
||||
this.untMisDigitale = untMisDigitale;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package it.integry.integrywmsnative.core.rest.model.documento;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class RetrieveDocumentoArtsResponseDTO {
|
||||
|
||||
private List<DocumentoArtDTO> arts;
|
||||
|
||||
public List<DocumentoArtDTO> getArts() {
|
||||
return arts;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
package it.integry.integrywmsnative.core.rest.model.giacenza;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||
|
||||
public class InstantItemSituationIncomingItemDto {
|
||||
|
||||
private BigDecimal qtaOrd;
|
||||
private BigDecimal qtaEvasa;
|
||||
private BigDecimal numCnf;
|
||||
private BigDecimal numCnfEvasa;
|
||||
private BigDecimal qtaCnf;
|
||||
private String gestione;
|
||||
private LocalDate dataOrd;
|
||||
private int numOrd;
|
||||
private int rigaOrd;
|
||||
private LocalDate dataCons;
|
||||
private String codMart;
|
||||
private String descrizione;
|
||||
private String partitaMag;
|
||||
private String codJcom;
|
||||
private String codMdep;
|
||||
private String untMis;
|
||||
private MtbAart mtbAart;
|
||||
|
||||
public BigDecimal getQtaOrd() {
|
||||
return qtaOrd;
|
||||
}
|
||||
|
||||
public BigDecimal getQtaEvasa() {
|
||||
return qtaEvasa;
|
||||
}
|
||||
|
||||
public BigDecimal getNumCnf() {
|
||||
return numCnf;
|
||||
}
|
||||
|
||||
public BigDecimal getNumCnfEvasa() {
|
||||
return numCnfEvasa;
|
||||
}
|
||||
|
||||
public BigDecimal getQtaCnf() {
|
||||
return qtaCnf;
|
||||
}
|
||||
|
||||
public String getGestione() {
|
||||
return gestione;
|
||||
}
|
||||
|
||||
public LocalDate getDataOrd() {
|
||||
return dataOrd;
|
||||
}
|
||||
|
||||
public int getNumOrd() {
|
||||
return numOrd;
|
||||
}
|
||||
|
||||
public int getRigaOrd() {
|
||||
return rigaOrd;
|
||||
}
|
||||
|
||||
public LocalDate getDataCons() {
|
||||
return dataCons;
|
||||
}
|
||||
|
||||
public String getCodMart() {
|
||||
return codMart;
|
||||
}
|
||||
|
||||
public String getDescrizione() {
|
||||
return descrizione;
|
||||
}
|
||||
|
||||
public String getPartitaMag() {
|
||||
return partitaMag;
|
||||
}
|
||||
|
||||
public String getCodJcom() {
|
||||
return codJcom;
|
||||
}
|
||||
|
||||
public String getCodMdep() {
|
||||
return codMdep;
|
||||
}
|
||||
|
||||
public String getUntMis() {
|
||||
return untMis;
|
||||
}
|
||||
|
||||
public MtbAart getMtbAart() {
|
||||
return mtbAart;
|
||||
}
|
||||
|
||||
public InstantItemSituationIncomingItemDto setMtbAart(MtbAart mtbAart) {
|
||||
this.mtbAart = mtbAart;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package it.integry.integrywmsnative.core.rest.model.giacenza;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.MvwSitArtUdcDetInventario;
|
||||
|
||||
public class InstantItemSituationResponseDto {
|
||||
private List<InstantItemSituationIncomingItemDto> incomingItems;
|
||||
private List<MvwSitArtUdcDetInventario> availableItems;
|
||||
|
||||
|
||||
public List<InstantItemSituationIncomingItemDto> getIncomingItems() {
|
||||
return incomingItems;
|
||||
}
|
||||
|
||||
public List<MvwSitArtUdcDetInventario> getAvailableItems() {
|
||||
return availableItems;
|
||||
}
|
||||
}
|
||||
@@ -2,9 +2,11 @@ package it.integry.integrywmsnative.core.rest.model.inventario;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||
import it.integry.integrywmsnative.core.model.MtbUntMis;
|
||||
|
||||
public class InventarioArtDTO {
|
||||
|
||||
@@ -18,6 +20,7 @@ public class InventarioArtDTO {
|
||||
private BigDecimal giacenza;
|
||||
private boolean plu;
|
||||
private BigDecimal przVendIva;
|
||||
private boolean untMisDigitale;
|
||||
|
||||
public String getCodMart() {
|
||||
return codMart;
|
||||
@@ -109,7 +112,21 @@ public class InventarioArtDTO {
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isUntMisDigitale() {
|
||||
return untMisDigitale;
|
||||
}
|
||||
|
||||
public InventarioArtDTO setUntMisDigitale(boolean untMisDigitale) {
|
||||
this.untMisDigitale = untMisDigitale;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MtbAart toMtbAart() {
|
||||
MtbUntMis mtbUntMis = new MtbUntMis()
|
||||
.setUntMis(getUntMis())
|
||||
.setFlagDig(isUntMisDigitale() ? "S" : "N");
|
||||
List<MtbUntMis> mtbUntMisList = Collections.singletonList(mtbUntMis);
|
||||
|
||||
return new MtbAart()
|
||||
.setCodMart(getCodMart())
|
||||
.setDescrizione(getDescrizione())
|
||||
@@ -119,6 +136,7 @@ public class InventarioArtDTO {
|
||||
.setQtaCnf(getQtaCnf())
|
||||
.setPlu(isPlu() ? "S" : "N")
|
||||
.setFlagTracciabilita(isFlagTracciabilita() ? "S" : "N")
|
||||
.setFlagQtaCnfFissa(isFlagQtaCnfFissa() ? "S" : "N");
|
||||
.setFlagQtaCnfFissa(isFlagQtaCnfFissa() ? "S" : "N")
|
||||
.setMtbUntMis(mtbUntMisList);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package it.integry.integrywmsnative.core.rest.model.system;
|
||||
|
||||
public class RegisterDeviceRequestDTO {
|
||||
|
||||
private String app;
|
||||
|
||||
public String getApp() {
|
||||
return app;
|
||||
}
|
||||
|
||||
public RegisterDeviceRequestDTO setApp(String app) {
|
||||
this.app = app;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package it.integry.integrywmsnative.core.rest.model.uds;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
|
||||
public class EditUDSRowRequestDTO {
|
||||
|
||||
private MtbColr sourceMtbColr;
|
||||
private BigDecimal newQtaTot;
|
||||
private BigDecimal newQtaCnf;
|
||||
private BigDecimal newNumCnf;
|
||||
|
||||
|
||||
public MtbColr getSourceMtbColr() {
|
||||
return sourceMtbColr;
|
||||
}
|
||||
|
||||
public EditUDSRowRequestDTO setSourceMtbColr(MtbColr sourceMtbColr) {
|
||||
this.sourceMtbColr = sourceMtbColr;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getNewQtaTot() {
|
||||
return newQtaTot;
|
||||
}
|
||||
|
||||
public EditUDSRowRequestDTO setNewQtaTot(BigDecimal newQtaTot) {
|
||||
this.newQtaTot = newQtaTot;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getNewQtaCnf() {
|
||||
return newQtaCnf;
|
||||
}
|
||||
|
||||
public EditUDSRowRequestDTO setNewQtaCnf(BigDecimal newQtaCnf) {
|
||||
this.newQtaCnf = newQtaCnf;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getNewNumCnf() {
|
||||
return newNumCnf;
|
||||
}
|
||||
|
||||
public EditUDSRowRequestDTO setNewNumCnf(BigDecimal newNumCnf) {
|
||||
this.newNumCnf = newNumCnf;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package it.integry.integrywmsnative.core.rest.model.uds;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
|
||||
public class EditUDSRowResponseDTO {
|
||||
private MtbColr savedMtbColr;
|
||||
|
||||
public MtbColr getSavedMtbColr() {
|
||||
return savedMtbColr;
|
||||
}
|
||||
|
||||
public EditUDSRowResponseDTO setSavedMtbColr(MtbColr savedMtbColr) {
|
||||
this.savedMtbColr = savedMtbColr;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,7 @@ import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
||||
import it.integry.integrywmsnative.core.model.MvwSitArtUdcDetInventario;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.GiacenzaRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||
|
||||
@Singleton
|
||||
public class InventarioService {
|
||||
@@ -47,7 +48,7 @@ public class InventarioService {
|
||||
MtbColt mtbColt = new MtbColt();
|
||||
|
||||
mtbColt.setGestione(inventario.getGestione());
|
||||
mtbColt.setDataCollo(inventario.getDataCollo());
|
||||
mtbColt.setDataCollo(UtilityDate.toDate(inventario.getDataCollo()));
|
||||
mtbColt.setSerCollo(inventario.getSerCollo());
|
||||
mtbColt.setNumCollo(inventario.getNumCollo());
|
||||
mtbColt.setSegno(inventario.getSegno());
|
||||
@@ -70,7 +71,7 @@ public class InventarioService {
|
||||
MtbColr mtbColr = new MtbColr();
|
||||
|
||||
mtbColr.setGestione(inventario.getGestione());
|
||||
mtbColr.setDataCollo(inventario.getDataCollo());
|
||||
mtbColr.setDataCollo(UtilityDate.toDate(inventario.getDataCollo()));
|
||||
mtbColr.setSerCollo(inventario.getSerCollo());
|
||||
mtbColr.setNumCollo(inventario.getNumCollo());
|
||||
mtbColr.setCodMart(inventario.getCodMart());
|
||||
|
||||
@@ -38,10 +38,13 @@ public class DBSettingsModel {
|
||||
private boolean flagSpedizioneUseQtaOrd;
|
||||
private boolean flagOrdinaNuoviArticoliInGriglia;
|
||||
private boolean flagOrdinaArticoliOnScan;
|
||||
private boolean flagConsentiFuoriPianoLogistico;
|
||||
private boolean flagConsentiOrdineSenzaGriglia;
|
||||
private String docInterniCheckFornitore;
|
||||
private String produzioneDefaultCodAnag;
|
||||
private boolean flagPrintPackingListOnOrderClose;
|
||||
private boolean flagPrintEtichetteOnOrderClose;
|
||||
private boolean flagPrintEtichetteOnLUClose;
|
||||
private int onNumCnfInputChanged = 1;
|
||||
private int onQtaTotInputChanged = 1;
|
||||
private boolean flagAccettazioneUseQtaOrd = false;
|
||||
@@ -53,6 +56,11 @@ public class DBSettingsModel {
|
||||
|
||||
private boolean groupShippingByCommodityGroup = true;
|
||||
private boolean showCodFornSpedizione = true;
|
||||
private boolean flagCanCreateInventario = true;
|
||||
private boolean flagCanAddUnknownItemsInventario = true;
|
||||
private boolean flagShouldAskToCreateOrUpdateRowInventario = false;
|
||||
private String commessaMagazzino;
|
||||
private boolean flagGeneraDocumentoSpedizione = false;
|
||||
|
||||
public boolean isFlagSpedizioneEnableFakeGiacenza() {
|
||||
return flagSpedizioneEnableFakeGiacenza;
|
||||
@@ -279,6 +287,15 @@ public class DBSettingsModel {
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isFlagPrintEtichetteOnLUClose() {
|
||||
return flagPrintEtichetteOnLUClose;
|
||||
}
|
||||
|
||||
public DBSettingsModel setFlagPrintEtichetteOnLUClose(boolean flagPrintEtichetteOnLUClose) {
|
||||
this.flagPrintEtichetteOnLUClose = flagPrintEtichetteOnLUClose;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getOnNumCnfInputChanged() {
|
||||
return onNumCnfInputChanged;
|
||||
}
|
||||
@@ -396,4 +413,67 @@ public class DBSettingsModel {
|
||||
this.showCodFornSpedizione = showCodFornSpedizione;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isFlagCanCreateInventario() {
|
||||
return flagCanCreateInventario;
|
||||
}
|
||||
|
||||
public DBSettingsModel setFlagCanCreateInventario(boolean flagCanCreateInventario) {
|
||||
this.flagCanCreateInventario = flagCanCreateInventario;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isFlagCanAddUnknownItemsInventario() {
|
||||
return flagCanAddUnknownItemsInventario;
|
||||
}
|
||||
|
||||
public DBSettingsModel setFlagCanAddUnknownItemsInventario(boolean flagCanAddUnknownItemsInventario) {
|
||||
this.flagCanAddUnknownItemsInventario = flagCanAddUnknownItemsInventario;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isFlagShouldAskToCreateOrUpdateRowInventario() {
|
||||
return flagShouldAskToCreateOrUpdateRowInventario;
|
||||
}
|
||||
|
||||
public DBSettingsModel setFlagShouldAskToCreateOrUpdateRowInventario(boolean flagShouldAskToCreateOrUpdateRowInventario) {
|
||||
this.flagShouldAskToCreateOrUpdateRowInventario = flagShouldAskToCreateOrUpdateRowInventario;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isFlagConsentiFuoriPianoLogistico() {
|
||||
return flagConsentiFuoriPianoLogistico;
|
||||
}
|
||||
|
||||
public DBSettingsModel setFlagConsentiFuoriPianoLogistico(boolean flagConsentiFuoriPianoLogistico) {
|
||||
this.flagConsentiFuoriPianoLogistico = flagConsentiFuoriPianoLogistico;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isFlagConsentiOrdineSenzaGriglia() {
|
||||
return flagConsentiOrdineSenzaGriglia;
|
||||
}
|
||||
|
||||
public DBSettingsModel setFlagConsentiOrdineSenzaGriglia(boolean flagConsentiOrdineSenzaGriglia) {
|
||||
this.flagConsentiOrdineSenzaGriglia = flagConsentiOrdineSenzaGriglia;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCommessaMagazzino() {
|
||||
return commessaMagazzino;
|
||||
}
|
||||
|
||||
public DBSettingsModel setCommessaMagazzino(String commessaMagazzino) {
|
||||
this.commessaMagazzino = commessaMagazzino;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isFlagGeneraDocumentoSpedizione() {
|
||||
return flagGeneraDocumentoSpedizione;
|
||||
}
|
||||
|
||||
public DBSettingsModel setFlagGeneraDocumentoSpedizione(boolean flagGeneraDocumentoSpedizione) {
|
||||
this.flagGeneraDocumentoSpedizione = flagGeneraDocumentoSpedizione;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import java.util.List;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.CommonConst;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.model.StbGestSetup;
|
||||
import it.integry.integrywmsnative.core.model.dto.InternalCodAnagsDTO;
|
||||
@@ -24,6 +25,7 @@ import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.model.AvailableCodMdepsDTO;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityFirebase;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityLogger;
|
||||
|
||||
@Singleton
|
||||
public class SettingsManager {
|
||||
@@ -108,6 +110,7 @@ public class SettingsManager {
|
||||
};
|
||||
|
||||
RunnableArgs<Exception> tmpOnFailed = ex -> {
|
||||
UtilityLogger.error(ex);
|
||||
perfTrace.putAttribute("failed", "true");
|
||||
if (!(ex instanceof SocketTimeoutException)) onFailed.run(ex);
|
||||
else
|
||||
@@ -305,6 +308,14 @@ public class SettingsManager {
|
||||
.setGestName("PVM")
|
||||
.setSection("ORDINI_A")
|
||||
.setKeySection("ORDINA_ARTICOLI_ON_SCAN"));
|
||||
stbGestSetupList.add(new StbGestSetup()
|
||||
.setGestName("PVM")
|
||||
.setSection("ORDINI_A")
|
||||
.setKeySection("FLAG_CONSENTI_ORIDNE_DA_GRIGLIA"));
|
||||
stbGestSetupList.add(new StbGestSetup()
|
||||
.setGestName("PVM")
|
||||
.setSection("ORDINI_A")
|
||||
.setKeySection("FLAG_CONSENTI_ORIDNE_SENZA_GRIGLIA"));
|
||||
stbGestSetupList.add(new StbGestSetup()
|
||||
.setGestName("PVM")
|
||||
.setSection("DOC_INTERNI")
|
||||
@@ -325,6 +336,10 @@ public class SettingsManager {
|
||||
.setGestName("PICKING")
|
||||
.setSection("SPEDIZIONE")
|
||||
.setKeySection("FLAG_PRINT_ETICHETTE_ON_CLOSE"));
|
||||
stbGestSetupList.add(new StbGestSetup()
|
||||
.setGestName("PICKING")
|
||||
.setSection("SPEDIZIONE")
|
||||
.setKeySection("FLAG_PRINT_ETICHETTE_ON_LU_CLOSE"));
|
||||
stbGestSetupList.add(new StbGestSetup()
|
||||
.setGestName("PICKING")
|
||||
.setSection("SPEDIZIONE")
|
||||
@@ -349,6 +364,26 @@ public class SettingsManager {
|
||||
.setGestName("PICKING")
|
||||
.setSection("SPEDIZIONE")
|
||||
.setKeySection("FLAG_GROUP_BY_GRP_MERC"));
|
||||
stbGestSetupList.add(new StbGestSetup()
|
||||
.setGestName("PICKING")
|
||||
.setSection("INVENTARIO")
|
||||
.setKeySection("FLAG_CAN_CREATE_INVENTARIO"));
|
||||
stbGestSetupList.add(new StbGestSetup()
|
||||
.setGestName("PICKING")
|
||||
.setSection("INVENTARIO")
|
||||
.setKeySection("FLAG_CAN_ADD_UNKNOWN_ITEMS"));
|
||||
stbGestSetupList.add(new StbGestSetup()
|
||||
.setGestName("PICKING")
|
||||
.setSection("INVENTARIO")
|
||||
.setKeySection("FLAG_SHOULD_ASK_TO_CREATE_OR_UPDATE_ROW"));
|
||||
stbGestSetupList.add(new StbGestSetup()
|
||||
.setGestName("PICKING")
|
||||
.setSection("SETUP")
|
||||
.setKeySection("COMMESSA_MAGAZZINO"));
|
||||
stbGestSetupList.add(new StbGestSetup()
|
||||
.setGestName("PICKING")
|
||||
.setSection("SPEDIZIONE")
|
||||
.setKeySection("GENERA_DOC"));
|
||||
String codMdep = SettingsManager.i().getUserSession().getDepo().getCodMdep();
|
||||
|
||||
mGestSetupRESTConsumer.getValues(codMdep, stbGestSetupList, list -> {
|
||||
@@ -373,14 +408,22 @@ public class SettingsManager {
|
||||
dbSettingsModelIstance.setFlagAccettazioneUseQtaOrd(getValueFromList(list, "ACCETTAZIONE", "FLAG_USE_QTA_ORD", Boolean.class));
|
||||
dbSettingsModelIstance.setFlagPickLiberoAllowEmptyDest(getValueFromList(list, "PICKING_LIBERO", "FLAG_ALLOW_EMPTY_DEST", Boolean.class));
|
||||
dbSettingsModelIstance.setFlagOrdinaArticoliOnScan(getValueFromList(list, "ORDINI_A", "ORDINA_ARTICOLI_ON_SCAN", Boolean.class));
|
||||
dbSettingsModelIstance.setFlagConsentiFuoriPianoLogistico(getValueFromList(list, "ORDINI_A", "FLAG_CONSENTI_ORIDNE_DA_GRIGLIA", Boolean.class));
|
||||
dbSettingsModelIstance.setFlagConsentiOrdineSenzaGriglia(getValueFromList(list, "ORDINI_A", "FLAG_CONSENTI_ORIDNE_SENZA_GRIGLIA", Boolean.class));
|
||||
dbSettingsModelIstance.setFlagPrintPackingListOnOrderClose(getValueFromList(list, "SPEDIZIONE", "FLAG_PRINT_PACKING_LIST_ON_CLOSE", Boolean.class));
|
||||
dbSettingsModelIstance.setFlagPrintEtichetteOnOrderClose(getValueFromList(list, "SPEDIZIONE", "FLAG_PRINT_ETICHETTE_ON_CLOSE", Boolean.class));
|
||||
dbSettingsModelIstance.setFlagPrintEtichetteOnLUClose(getValueFromList(list, "SPEDIZIONE", "FLAG_PRINT_ETICHETTE_ON_LU_CLOSE", Boolean.class, true));
|
||||
dbSettingsModelIstance.setFlagAskInfoAggiuntiveSpedizione(getValueFromList(list, "SPEDIZIONE", "FLAG_ASK_INFO_AGGIUNTIVE", Boolean.class));
|
||||
dbSettingsModelIstance.setFilterFornitoreProd(getValueFromList(list, "PRODUZIONE", "FILTER_FORNTIORE_PROD", String.class));
|
||||
dbSettingsModelIstance.setCodDtipOrdTrasfV(getValueFromList(list, "SPEDIZIONE", "COD_DTIP_ORD_TRASF", String.class));
|
||||
dbSettingsModelIstance.setNotifyLotStatus(getValueFromList(list, "SPEDIZIONE", "FLAG_NOTIFICA_STATO_PARTITA", Boolean.class));
|
||||
dbSettingsModelIstance.setShowCodFornSpedizione(getValueFromList(list, "SPEDIZIONE", "FLAG_SHOW_COD_FORN", Boolean.class, Boolean.TRUE));
|
||||
dbSettingsModelIstance.setGroupShippingByCommodityGroup(getValueFromList(list, "SPEDIZIONE", "FLAG_GROUP_BY_GRP_MERC", Boolean.class, Boolean.FALSE));
|
||||
dbSettingsModelIstance.setFlagCanCreateInventario(getValueFromList(list, "INVENTARIO", "FLAG_CAN_CREATE_INVENTARIO", Boolean.class, Boolean.TRUE));
|
||||
dbSettingsModelIstance.setFlagCanAddUnknownItemsInventario(getValueFromList(list, "INVENTARIO", "FLAG_CAN_ADD_UNKNOWN_ITEMS", Boolean.class, Boolean.TRUE));
|
||||
dbSettingsModelIstance.setFlagShouldAskToCreateOrUpdateRowInventario(getValueFromList(list, "INVENTARIO", "FLAG_SHOULD_ASK_TO_CREATE_OR_UPDATE_ROW", Boolean.class, Boolean.FALSE));
|
||||
dbSettingsModelIstance.setCommessaMagazzino(getValueFromList(list, "SETUP", "COMMESSA_MAGAZZINO", String.class, CommonConst.Config.COMMESSA_MAG));
|
||||
dbSettingsModelIstance.setFlagGeneraDocumentoSpedizione(getValueFromList(list, "SPEDIZIONE", "GENERA_DOC", Boolean.class, Boolean.FALSE));
|
||||
|
||||
String notePerdita = getValueFromList(list, "DOC_INTERNI", "NOTE_PERDITA", String.class);
|
||||
if (notePerdita != null)
|
||||
@@ -408,16 +451,25 @@ public class SettingsManager {
|
||||
|
||||
StbGestSetup value = Stream.of(stbGestSetupList)
|
||||
.filter(x -> x.getSection().equalsIgnoreCase(section) && x.getKeySection().equalsIgnoreCase(keySectionName))
|
||||
.findFirstOrElse(new StbGestSetup());
|
||||
.findFirstOrElse(null);
|
||||
|
||||
if (clazz == String.class) {
|
||||
return clazz.cast(value.getValue());
|
||||
} else if (clazz == Boolean.class) {
|
||||
return clazz.cast("S".equalsIgnoreCase(value.getValue()));
|
||||
} else if (clazz == Integer.class && value.getValue() != null) {
|
||||
return clazz.cast(Integer.parseInt(value.getValue()));
|
||||
} else return defaultValue;
|
||||
if (value != null) {
|
||||
if (clazz == String.class) {
|
||||
return clazz.cast(value.getValue());
|
||||
} else if (clazz == Boolean.class) {
|
||||
return clazz.cast("S".equalsIgnoreCase(value.getValue()));
|
||||
} else if (clazz == Integer.class && value.getValue() != null) {
|
||||
return clazz.cast(Integer.parseInt(value.getValue()));
|
||||
}
|
||||
} else if (defaultValue == null) {
|
||||
if (clazz == Boolean.class) {
|
||||
return clazz.cast(Boolean.FALSE);
|
||||
} else if (clazz == Integer.class) {
|
||||
return clazz.cast(0);
|
||||
}
|
||||
}
|
||||
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -95,10 +95,19 @@ public class SettingsModel {
|
||||
}
|
||||
|
||||
public static class UserSession {
|
||||
private String deviceId;
|
||||
private String profileDB;
|
||||
private AvailableCodMdepsDTO depo;
|
||||
private Integer defaultOrdinamentoPickingAccettazione = 0;
|
||||
|
||||
public String getDeviceId() {
|
||||
return deviceId;
|
||||
}
|
||||
|
||||
public void setDeviceId(String deviceId) {
|
||||
this.deviceId = deviceId;
|
||||
}
|
||||
|
||||
public String getProfileDB() {
|
||||
return profileDB;
|
||||
}
|
||||
|
||||
@@ -27,9 +27,11 @@ public class UpdatesManager {
|
||||
public void init(AppCompatActivity activityContext) {
|
||||
this.mContext = activityContext;
|
||||
|
||||
final String baseEndpoint = SettingsManager.i().getServer().getProtocol() + "://" + SettingsManager.i().getServer().getHost() +
|
||||
(SettingsManager.i().getServer().getPort() > 0 ? ":" + SettingsManager.i().getServer().getPort() : "");
|
||||
|
||||
String currentVersionUrl = "http://" + SettingsManager.i().getServer().getHost() + ":" + SettingsManager.i().getServer().getPort() + "/ems-api/wms/currentVersion";
|
||||
String currentDownloadUrl = "http://" + SettingsManager.i().getServer().getHost() + ":" + SettingsManager.i().getServer().getPort() + "/ems-api/wms/android-release.apk";
|
||||
final String currentVersionUrl = baseEndpoint + "/ems-api/wms/currentVersion";
|
||||
final String currentDownloadUrl = baseEndpoint + "/ems-api/wms/android-release.apk";
|
||||
|
||||
|
||||
AppUpdater appUpdater = new AppUpdater(mContext)
|
||||
|
||||
@@ -20,11 +20,7 @@ public class PermissionsHelper {
|
||||
public static void askPermissions(SplashActivity activity, Runnable onPermissionsConfirmed, RunnableArgs<Boolean> onPermissionsDenied) {
|
||||
|
||||
List<String> permissionsToAsk = new ArrayList<>();
|
||||
permissionsToAsk.add(Manifest.permission.READ_EXTERNAL_STORAGE);
|
||||
permissionsToAsk.add(Manifest.permission.WRITE_EXTERNAL_STORAGE);
|
||||
permissionsToAsk.add(Manifest.permission.CAMERA);
|
||||
//permissionsToAsk.add(Manifest.permission.INTERNET);
|
||||
//permissionsToAsk.add(Manifest.permission.ACCESS_WIFI_STATE);
|
||||
|
||||
|
||||
if(Build.VERSION.SDK_INT >= 23) {
|
||||
@@ -34,6 +30,14 @@ public class PermissionsHelper {
|
||||
permissionsToAsk.add(Manifest.permission.BLUETOOTH_CONNECT);
|
||||
}
|
||||
|
||||
if(Build.VERSION.SDK_INT < 33) {
|
||||
permissionsToAsk.add(Manifest.permission.READ_EXTERNAL_STORAGE);
|
||||
permissionsToAsk.add(Manifest.permission.WRITE_EXTERNAL_STORAGE);
|
||||
} else {
|
||||
permissionsToAsk.add(Manifest.permission.READ_MEDIA_IMAGES);
|
||||
permissionsToAsk.add(Manifest.permission.READ_MEDIA_AUDIO);
|
||||
permissionsToAsk.add(Manifest.permission.READ_MEDIA_VIDEO);
|
||||
}
|
||||
|
||||
|
||||
String[] permissionArray = new String[permissionsToAsk.size()];
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package it.integry.integrywmsnative.core.utility;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
|
||||
public class UntMisUtils {
|
||||
|
||||
public static boolean shouldBeShowInColli(MtbAart mtbAart) {
|
||||
return SettingsManager.iDB().isFlagForceAllToColli() || (mtbAart == null || !mtbAart.isFlagQtaCnfFissaBoolean());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -36,6 +36,10 @@ public class UtilityBarcode {
|
||||
return barcodeScanDTO != null && barcodeScanDTO.getType() == BarcodeType.EAN128;
|
||||
}
|
||||
|
||||
public static boolean isCode128(BarcodeScanDTO barcodeScanDTO) {
|
||||
return barcodeScanDTO != null && barcodeScanDTO.getType() == BarcodeType.CODE128;
|
||||
}
|
||||
|
||||
public static boolean isEtichettaPosizione(BarcodeScanDTO barcodeScanDTO) {
|
||||
return isEtichettaPosizione(barcodeScanDTO, true);
|
||||
}
|
||||
|
||||
@@ -8,23 +8,23 @@ import it.integry.integrywmsnative.core.CommonConst;
|
||||
public class UtilityBigDecimal {
|
||||
|
||||
public static boolean greaterThan(BigDecimal input, BigDecimal toCompareWith) {
|
||||
if(input == null) return false;
|
||||
if(toCompareWith == null) return false;
|
||||
if (input == null) return false;
|
||||
if (toCompareWith == null) return false;
|
||||
|
||||
return input.compareTo(toCompareWith) > 0;
|
||||
}
|
||||
|
||||
public static boolean equalsTo(BigDecimal input, BigDecimal toCompareWith) {
|
||||
if(input == null && toCompareWith == null) return true;
|
||||
if(input == null) return false;
|
||||
if(toCompareWith == null) return false;
|
||||
if (input == null && toCompareWith == null) return true;
|
||||
if (input == null) return false;
|
||||
if (toCompareWith == null) return false;
|
||||
|
||||
return input.compareTo(toCompareWith) == 0;
|
||||
}
|
||||
|
||||
public static boolean lowerThan(BigDecimal input, BigDecimal toCompareWith) {
|
||||
if(input == null) return false;
|
||||
if(toCompareWith == null) return false;
|
||||
if (input == null) return false;
|
||||
if (toCompareWith == null) return false;
|
||||
|
||||
return input.compareTo(toCompareWith) < 0;
|
||||
}
|
||||
@@ -38,15 +38,15 @@ public class UtilityBigDecimal {
|
||||
}
|
||||
|
||||
public static BigDecimal getLowerBetween(BigDecimal input1, BigDecimal input2) {
|
||||
if(input1 == null) return input2;
|
||||
if(input2 == null) return input1;
|
||||
if (input1 == null) return input2;
|
||||
if (input2 == null) return input1;
|
||||
|
||||
return lowerThan(input1, input2) ? input1 : input2;
|
||||
}
|
||||
|
||||
public static BigDecimal getGreaterBetween(BigDecimal input1, BigDecimal input2) {
|
||||
if(input1 == null) return input2;
|
||||
if(input2 == null) return input1;
|
||||
if (input1 == null) return input2;
|
||||
if (input2 == null) return input1;
|
||||
|
||||
return greaterThan(input1, input2) ? input1 : input2;
|
||||
}
|
||||
@@ -57,14 +57,14 @@ public class UtilityBigDecimal {
|
||||
}
|
||||
|
||||
public static BigDecimal divide(BigDecimal input1, BigDecimal divisor, RoundingMode roundingMode) {
|
||||
if(divisor == null || equalsTo(divisor, BigDecimal.ZERO)) return null;
|
||||
if (divisor == null || equalsTo(divisor, BigDecimal.ZERO)) return null;
|
||||
return input1.divide(divisor, 3, roundingMode);
|
||||
}
|
||||
|
||||
|
||||
public static BigDecimal divideToInteger(BigDecimal input1, BigDecimal divisor) {
|
||||
if(divisor == null || equalsTo(divisor, BigDecimal.ZERO)) return null;
|
||||
return new BigDecimal(input1.divide(divisor,3, BigDecimal.ROUND_HALF_EVEN).intValue());
|
||||
if (divisor == null || equalsTo(divisor, BigDecimal.ZERO)) return null;
|
||||
return new BigDecimal(input1.divide(divisor, 3, BigDecimal.ROUND_HALF_EVEN).intValue());
|
||||
}
|
||||
|
||||
|
||||
@@ -73,8 +73,8 @@ public class UtilityBigDecimal {
|
||||
}
|
||||
|
||||
public static BigDecimal divideAndRoundToInteger(BigDecimal input1, BigDecimal divisor, RoundingMode roundingMode) {
|
||||
if(divisor == null || equalsTo(divisor, BigDecimal.ZERO)) return null;
|
||||
return new BigDecimal(input1.divide(divisor,0, roundingMode).intValue());
|
||||
if (divisor == null || equalsTo(divisor, BigDecimal.ZERO)) return null;
|
||||
return new BigDecimal(input1.divide(divisor, 0, roundingMode).intValue());
|
||||
}
|
||||
|
||||
public static BigDecimal multiply(BigDecimal input1, BigDecimal multiplier) {
|
||||
@@ -87,4 +87,8 @@ public class UtilityBigDecimal {
|
||||
return input.setScale(CommonConst.Config.NUMBER_OF_DECIMAL_DIGITS, RoundingMode.HALF_EVEN);
|
||||
}
|
||||
|
||||
public static boolean isNullOrZero(BigDecimal input) {
|
||||
return input == null || equalsTo(input, BigDecimal.ZERO);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -157,6 +157,18 @@ public class UtilityDate {
|
||||
return inputDate != null && inputDate.toLocalDate().isEqual(getNow());
|
||||
}
|
||||
|
||||
public static boolean isBeforeToday(LocalDate inputDate) {
|
||||
return inputDate != null && inputDate.isBefore(getNow());
|
||||
}
|
||||
|
||||
public static boolean isAfterToday(LocalDate inputDate) {
|
||||
return inputDate != null && inputDate.isAfter(getNow());
|
||||
}
|
||||
|
||||
public static boolean isToday(LocalDate inputDate) {
|
||||
return inputDate != null && inputDate.isEqual(getNow());
|
||||
}
|
||||
|
||||
public static LocalDate toLocalDate(Date dateToConvert) {
|
||||
return dateToConvert.toInstant()
|
||||
.atZone(currentZone)
|
||||
|
||||
@@ -7,10 +7,6 @@ import it.integry.integrywmsnative.BuildConfig;
|
||||
|
||||
public class UtilityLogger {
|
||||
|
||||
public static void trace(String message) {
|
||||
Logger.d(message, getPreviousStackTraceElement());
|
||||
}
|
||||
|
||||
public static void info(String message) {
|
||||
Logger.i(message);
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ public class UtilityNumber {
|
||||
decimalFormat.setMaximumFractionDigits(decimal);
|
||||
decimalFormat.setDecimalFormatSymbols(otherSymbols);
|
||||
decimalFormat.setGroupingUsed(false);
|
||||
decimalFormat.setMinimumFractionDigits(2);
|
||||
decimalFormat.setMinimumFractionDigits(Math.min(2, decimal));
|
||||
|
||||
return decimalFormat.format(floatValue);
|
||||
}
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
package it.integry.integrywmsnative.core.utility;
|
||||
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
|
||||
import it.integry.integrywmsnative.view.dialogs.DialogProgressView;
|
||||
|
||||
public class UtilityProgress {
|
||||
|
||||
public static DialogProgressView createDefaultProgressDialog(FragmentActivity mContext) {
|
||||
var progress = DialogProgressView.newInstance(null, null, true);
|
||||
progress.show(mContext.getSupportFragmentManager(), "tag");
|
||||
return progress;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -41,9 +41,15 @@ public class UtilityServer {
|
||||
public static void isEmsApiAvailable(final String protocol, final String serverAddress, final int serverTCPport, final Runnable onComplete, final RunnableArgs<Exception> onFailed) {
|
||||
new Thread(() -> {
|
||||
|
||||
String url = null;
|
||||
|
||||
if(serverTCPport > 0)
|
||||
url = String.format("%s://%s:%d/ems-api/system/ok", protocol, serverAddress, serverTCPport);
|
||||
else
|
||||
url = String.format("%s://%s/ems-api/system/ok", protocol, serverAddress);
|
||||
|
||||
Request request = new Request.Builder()
|
||||
.url(String.format("%s://%s:%d/ems-api/system/ok", protocol, serverAddress, serverTCPport))
|
||||
.url(url)
|
||||
.build();
|
||||
|
||||
try {
|
||||
|
||||
@@ -89,6 +89,7 @@ public class MainAccettazioneFragment extends BaseFragment implements ISearchabl
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
setRetainInstance(true);
|
||||
|
||||
if (savedInstanceState != null && savedInstanceState.containsKey("mToolbar"))
|
||||
mToolbar = DataCache.retrieveItem(savedInstanceState.getString("mToolbar"));
|
||||
@@ -289,7 +290,7 @@ public class MainAccettazioneFragment extends BaseFragment implements ISearchabl
|
||||
DialogSimpleMessageView.makeInfoDialog(getText(R.string.orders).toString(),
|
||||
Html.fromHtml(String.format(getActivity().getResources().getQuantityString(R.plurals.loaded_orders_message, (int) ordsCounter), ordsCounter)
|
||||
+ "<br /><br />" +
|
||||
"<b>" + artsCounter + "</b> " + getActivity().getResources().getQuantityString(R.plurals.available_articles, (int) artsCounter)),
|
||||
"<b>" + artsCounter + "</b> " + getActivity().getResources().getQuantityString(R.plurals.ordered_articles, (int) artsCounter)),
|
||||
null,
|
||||
() -> {
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@ import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
||||
import it.integry.integrywmsnative.core.CommonConst;
|
||||
import it.integry.integrywmsnative.core.exception.AlreadyUsedAnonymousLabelException;
|
||||
import it.integry.integrywmsnative.core.exception.InvalidLUMultiGestioneException;
|
||||
import it.integry.integrywmsnative.core.exception.InvalidOrderTypeException;
|
||||
import it.integry.integrywmsnative.core.exception.LUScanNotGrantedException;
|
||||
import it.integry.integrywmsnative.core.exception.NoArtsFoundException;
|
||||
import it.integry.integrywmsnative.core.exception.NoResultFromBarcodeException;
|
||||
@@ -126,18 +125,13 @@ public class AccettazionePickingViewModel {
|
||||
.distinctBy(x -> x)
|
||||
.toList();
|
||||
|
||||
if (foundGestioni != null) {
|
||||
|
||||
if (foundGestioni.size() == 1) {
|
||||
if (isOrdTrasf && (foundGestioni.get(0) == GestioneEnum.PRODUZIONE || foundGestioni.get(0) == GestioneEnum.LAVORAZIONE)) {
|
||||
defaultGestioneOfUL = GestioneEnum.ACQUISTO;
|
||||
} else
|
||||
defaultGestioneOfUL = foundGestioni.get(0) == GestioneEnum.PRODUZIONE ? GestioneEnum.LAVORAZIONE : foundGestioni.get(0);
|
||||
} else {
|
||||
this.sendError(new InvalidLUMultiGestioneException());
|
||||
}
|
||||
if (foundGestioni.size() == 1) {
|
||||
if (isOrdTrasf && (foundGestioni.get(0) == GestioneEnum.PRODUZIONE || foundGestioni.get(0) == GestioneEnum.LAVORAZIONE)) {
|
||||
defaultGestioneOfUL = GestioneEnum.ACQUISTO;
|
||||
} else
|
||||
defaultGestioneOfUL = foundGestioni.get(0) == GestioneEnum.PRODUZIONE ? GestioneEnum.LAVORAZIONE : foundGestioni.get(0);
|
||||
} else {
|
||||
this.sendError(new InvalidOrderTypeException());
|
||||
this.sendError(new InvalidLUMultiGestioneException());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -395,7 +389,7 @@ public class AccettazionePickingViewModel {
|
||||
.distinct()
|
||||
.toList();
|
||||
|
||||
if (codAnags != null && codAnags.size() == 1) {
|
||||
if (codAnags.size() == 1) {
|
||||
mtbColt.setCodAnag(codAnags.get(0));
|
||||
}
|
||||
|
||||
@@ -405,7 +399,7 @@ public class AccettazionePickingViewModel {
|
||||
.distinct()
|
||||
.toList();
|
||||
|
||||
if (rifOrds != null && rifOrds.size() == 1) {
|
||||
if (rifOrds.size() == 1) {
|
||||
mtbColt.setRifOrd(rifOrds.get(0));
|
||||
}
|
||||
|
||||
@@ -415,16 +409,9 @@ public class AccettazionePickingViewModel {
|
||||
.distinct()
|
||||
.toList();
|
||||
|
||||
if (numDataOrds != null && numDataOrds.size() == 1) {
|
||||
if (numDataOrds.size() == 1) {
|
||||
mtbColt.setNumOrd(mOrders.get(0).getNumero());
|
||||
mtbColt.setDataOrd(mOrders.get(0).getData());
|
||||
|
||||
try {
|
||||
mtbColt.generaFiltroOrdine();
|
||||
} catch (Exception ex) {
|
||||
this.sendError(ex);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
this.mColliMagazzinoRESTConsumer.saveCollo(mtbColt, savedMtbColt -> {
|
||||
|
||||
@@ -3,11 +3,12 @@ package it.integry.integrywmsnative.gest.contab_doc_interni;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.text.Html;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.widget.AppCompatTextView;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import androidx.databinding.ObservableArrayList;
|
||||
@@ -27,12 +28,11 @@ import it.integry.integrywmsnative.core.data_store.db.wrappers.DocInternoWrapper
|
||||
import it.integry.integrywmsnative.core.expansion.BaseFragment;
|
||||
import it.integry.integrywmsnative.core.interfaces.IScrollableFragment;
|
||||
import it.integry.integrywmsnative.core.interfaces.ITitledFragment;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||
import it.integry.integrywmsnative.core.rest.model.documento.DocumentoArtDTO;
|
||||
import it.integry.integrywmsnative.databinding.FragmentDocInterniBinding;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dialog.DialogSelectDocInfoResponseDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dialog.DialogSelectDocInfoView;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dialog.DialogSelectDocInfoViewModel;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.DocInterniSetupDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.GrigliaArticoliDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.DocInterniEditFormActivity;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.ui.DocInterniListAdapter;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.ui.DocInterniListModel;
|
||||
@@ -48,7 +48,6 @@ public class DocInterniFragment extends BaseFragment implements ITitledFragment,
|
||||
private FragmentDocInterniBinding mBinding;
|
||||
private DocInterniSetupDTO mDocInterniSetupDTO;
|
||||
private final List<Runnable> mOnPreDestroyList = new ArrayList<>();
|
||||
private boolean dialogInitialized = false;
|
||||
|
||||
|
||||
public DocInterniFragment() {
|
||||
@@ -70,6 +69,7 @@ public class DocInterniFragment extends BaseFragment implements ITitledFragment,
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
setRetainInstance(true);
|
||||
|
||||
mBinding = DataBindingUtil.inflate(inflater, R.layout.fragment_doc_interni, container, false);
|
||||
MainApplication.appComponent
|
||||
@@ -79,25 +79,33 @@ public class DocInterniFragment extends BaseFragment implements ITitledFragment,
|
||||
|
||||
mViewModel.setListeners(this);
|
||||
mBinding.setLifecycleOwner(this);
|
||||
|
||||
mBinding.setView(this);
|
||||
mBinding.setViewModel(mViewModel);
|
||||
mViewModel.mtbGrup.observe(getViewLifecycleOwner(), mtbGrup -> mViewModel.fetchProducts());
|
||||
mViewModel.dtbTipi.observe(getViewLifecycleOwner(), dtbTipi -> mViewModel.fetchDocuments());
|
||||
|
||||
this.initRecyclerView();
|
||||
|
||||
return mBinding.getRoot();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
|
||||
if (!this.mViewModel.hasDocDetails()) {
|
||||
mViewModel.init();
|
||||
} else {
|
||||
this.mViewModel.fetchDocuments();
|
||||
this.onLoadingStarted();
|
||||
this.mViewModel.fetchDocuments(this::onLoadingEnded);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
for (Runnable onPreDestroy : mOnPreDestroyList) {
|
||||
@@ -109,39 +117,13 @@ public class DocInterniFragment extends BaseFragment implements ITitledFragment,
|
||||
@Override
|
||||
public void onDocInterniSetupFetched(DocInterniSetupDTO docInterniSetupDTO) {
|
||||
this.mDocInterniSetupDTO = docInterniSetupDTO;
|
||||
this.dialogInitialized = true;
|
||||
this.selectDocInfo();
|
||||
this.openDocumentSelectionDialog();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDocDetailsChanged(DialogSelectDocInfoViewModel selection) {
|
||||
if (selection.isInputValid()) {
|
||||
mViewModel.setSelectedDocDetails(selection);
|
||||
mBinding.mainFab.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mBinding.mainFab.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if (selection.requiresFornitore()) {
|
||||
mBinding.codAnagContainer.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mBinding.codAnagContainer.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
|
||||
if (selection.getSelectedGruppoArt() != null) {
|
||||
mBinding.mtbGrpContainer.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mBinding.mtbGrpContainer.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if (selection.requiresDocData()) {
|
||||
mBinding.docContainer.setVisibility(View.VISIBLE);
|
||||
mBinding.document.setText(Html.fromHtml(getString(R.string.doc_testata, String.valueOf(selection.getNumDoc()), UtilityDate.formatDate(selection.getDataDoc(), UtilityDate.COMMONS_DATE_FORMATS.DMY_HUMAN))));
|
||||
} else {
|
||||
mBinding.docContainer.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
public void onDocDetailsChanged(DialogSelectDocInfoResponseDTO selection) {
|
||||
mViewModel.setSelectedDocDetails(selection);
|
||||
mBinding.invalidateAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -154,23 +136,17 @@ public class DocInterniFragment extends BaseFragment implements ITitledFragment,
|
||||
this.mOnPreDestroyList.add(onPreDestroy);
|
||||
}
|
||||
|
||||
public void selectDocInfo() {
|
||||
if (this.dialogInitialized) {
|
||||
DialogSelectDocInfoView.newInstance(
|
||||
mDocInterniSetupDTO,
|
||||
this.mViewModel.dtbTipi.getValue(),
|
||||
this.mViewModel.mtbGrup.getValue(),
|
||||
this.mViewModel.fornitore.getValue(),
|
||||
this.mViewModel.dataDoc.getValue(),
|
||||
this.mViewModel.numDoc.getValue(),
|
||||
this.mViewModel.note.getValue(),
|
||||
this::onDocDetailsChanged
|
||||
).show(requireActivity().getSupportFragmentManager(), "tag");
|
||||
}
|
||||
public void openDocumentSelectionDialog() {
|
||||
DialogSelectDocInfoView.newInstance(
|
||||
mDocInterniSetupDTO,
|
||||
this::onDocDetailsChanged,
|
||||
this::popMe)
|
||||
.show(requireActivity().getSupportFragmentManager(), "tag");
|
||||
}
|
||||
|
||||
private void initRecyclerView() {
|
||||
this.mViewModel.getDocsList().observe(getViewLifecycleOwner(), this::refreshList);
|
||||
|
||||
DocInterniListAdapter docInterniListAdapter = new DocInterniListAdapter(this.requireActivity(), this.mDocInterniMutableData);
|
||||
docInterniListAdapter.setEmptyView(this.mBinding.docInterniEmptyView);
|
||||
this.mBinding.docInterniMainList.setAdapter(docInterniListAdapter);
|
||||
@@ -200,7 +176,8 @@ public class DocInterniFragment extends BaseFragment implements ITitledFragment,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDocumentEditRequest(SqlMtbColt document, GrigliaArticoliDTO arts) {
|
||||
requireActivity().startActivity(DocInterniEditFormActivity.newInstance(requireActivity(), document, arts, mViewModel.getTipoDoc()));
|
||||
public void onDocumentEditRequest(SqlMtbColt document, List<DocumentoArtDTO> arts) {
|
||||
requireActivity()
|
||||
.startActivity(DocInterniEditFormActivity.newInstance(requireActivity(), document, arts, mViewModel.getTipoDoc()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,14 +3,15 @@ package it.integry.integrywmsnative.gest.contab_doc_interni;
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
import it.integry.integrywmsnative.core.data_store.db.repository.MtbColtRepository;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.DocumentRESTConsumer;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.rest.DocInterniRESTConsumer;
|
||||
|
||||
@Module(subcomponents = DocInterniComponent.class)
|
||||
public class DocInterniModule {
|
||||
|
||||
@Provides
|
||||
DocInterniViewModel docInterniViewModel(DocInterniRESTConsumer docInterniRESTConsumer, MtbColtRepository mtbColtRepository) {
|
||||
return new DocInterniViewModel(docInterniRESTConsumer,mtbColtRepository);
|
||||
DocInterniViewModel docInterniViewModel(DocInterniRESTConsumer docInterniRESTConsumer, MtbColtRepository mtbColtRepository, DocumentRESTConsumer documentRESTConsumer) {
|
||||
return new DocInterniViewModel(docInterniRESTConsumer,mtbColtRepository, documentRESTConsumer);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package it.integry.integrywmsnative.gest.contab_doc_interni;
|
||||
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@@ -14,51 +14,54 @@ import it.integry.integrywmsnative.core.data_store.db.wrappers.DocInternoWrapper
|
||||
import it.integry.integrywmsnative.core.di.BindableInteger;
|
||||
import it.integry.integrywmsnative.core.exception.NoDocTypeSelectedException;
|
||||
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.DocumentRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.model.documento.DocumentoArtDTO;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dialog.DialogSelectDocInfoViewModel;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dialog.DialogSelectDocInfoResponseDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.DocInterniSetupDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.FornitoreDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.GrigliaArticoliDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.GruppiArticoloDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.TipiDocDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.GruppoArticoloDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.TipoDocDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.rest.DocInterniRESTConsumer;
|
||||
|
||||
public class DocInterniViewModel {
|
||||
|
||||
@Inject
|
||||
MtbColtRepository documentRepository;
|
||||
private final MtbColtRepository documentRepository;
|
||||
private final DocInterniRESTConsumer docInterniRESTConsumer;
|
||||
private final DocumentRESTConsumer documentRESTConsumer;
|
||||
|
||||
private Listener mListener;
|
||||
private final DocInterniRESTConsumer mDocInterniRESTConsumer;
|
||||
private boolean productsFetched = true;
|
||||
private boolean docsFetched = true;
|
||||
private int nextNumCollo = 0;
|
||||
private GrigliaArticoliDTO productsList;
|
||||
private List<DocumentoArtDTO> availableArts;
|
||||
private final MutableLiveData<List<DocInternoWrapper>> mDocsList = new MutableLiveData<>();
|
||||
|
||||
public final MutableLiveData<TipiDocDTO> dtbTipi = new MutableLiveData<>();
|
||||
public final MutableLiveData<GruppiArticoloDTO> mtbGrup = new MutableLiveData<>();
|
||||
public final MutableLiveData<FornitoreDTO> fornitore = new MutableLiveData<>();
|
||||
public final MutableLiveData<Date> dataDoc = new MutableLiveData<>();
|
||||
public final MutableLiveData<String> numDoc = new MutableLiveData<>();
|
||||
public final MutableLiveData<String> note = new MutableLiveData<>();
|
||||
public TipoDocDTO dtbTipi;
|
||||
public GruppoArticoloDTO mtbGrup;
|
||||
public FornitoreDTO fornitore;
|
||||
public Date dataDoc;
|
||||
public String numDoc;
|
||||
public String note;
|
||||
public final BindableInteger artsSize = new BindableInteger(0);
|
||||
|
||||
@Inject
|
||||
public DocInterniViewModel(DocInterniRESTConsumer docInterniRESTConsumer, MtbColtRepository documentRepository) {
|
||||
mDocInterniRESTConsumer = docInterniRESTConsumer;
|
||||
public DocInterniViewModel(DocInterniRESTConsumer docInterniRESTConsumer,
|
||||
MtbColtRepository documentRepository,
|
||||
DocumentRESTConsumer documentRESTConsumer) {
|
||||
this.docInterniRESTConsumer = docInterniRESTConsumer;
|
||||
this.documentRepository = documentRepository;
|
||||
this.mDocsList.setValue(new ArrayList<>());
|
||||
this.documentRESTConsumer = documentRESTConsumer;
|
||||
}
|
||||
|
||||
|
||||
public void init() {
|
||||
this.sendOnLoadingStarted();
|
||||
// new Thread(() -> {
|
||||
mDocInterniRESTConsumer.getDocInterniSetup(returnDto -> {
|
||||
|
||||
docInterniRESTConsumer.getDocInterniSetup(returnDto -> {
|
||||
this.sendOnLoadingEnded();
|
||||
this.mListener.onDocInterniSetupFetched(returnDto);
|
||||
}, this::sendError);
|
||||
// }).start();
|
||||
}
|
||||
|
||||
private void sendOnLoadingStarted() {
|
||||
@@ -78,54 +81,62 @@ public class DocInterniViewModel {
|
||||
return this;
|
||||
}
|
||||
|
||||
public MutableLiveData<List<DocInternoWrapper>> getDocsList() {
|
||||
public LiveData<List<DocInternoWrapper>> getDocsList() {
|
||||
return mDocsList;
|
||||
}
|
||||
|
||||
public void setSelectedDocDetails(DialogSelectDocInfoViewModel selection) {
|
||||
public void setSelectedDocDetails(DialogSelectDocInfoResponseDTO selection) {
|
||||
this.fornitore = selection.getFornitore();
|
||||
this.dtbTipi = selection.getTipoDoc();
|
||||
|
||||
this.fornitore.postValue(selection.getSelectedFornitore());
|
||||
this.mtbGrup.postValue(selection.getSelectedGruppoArt());
|
||||
this.dataDoc.postValue(selection.getDataDoc());
|
||||
this.numDoc.postValue(selection.getNumDoc());
|
||||
this.note.postValue(selection.getNote());
|
||||
this.mtbGrup = selection.getGruppoArt();
|
||||
this.dataDoc = selection.getDataDoc();
|
||||
this.numDoc = selection.getNumDoc() != null ? selection.getNumDoc().toString() : null;
|
||||
this.note = selection.getNote();
|
||||
|
||||
if (selection.getSelectedTipoDoc() != null) {
|
||||
this.dtbTipi.postValue(selection.getSelectedTipoDoc());
|
||||
}
|
||||
this.sendOnLoadingStarted();
|
||||
fetchProducts(() -> {
|
||||
fetchDocuments(this::sendOnLoadingEnded);
|
||||
});
|
||||
}
|
||||
|
||||
public void fetchProducts() {
|
||||
this.productsFetched = false;
|
||||
this.sendOnLoadingStarted();
|
||||
mDocInterniRESTConsumer.fetchProducts(this.getCodDtip(), this.getCodMgrp(), returnDto -> {
|
||||
this.productsFetched = true;
|
||||
this.productsList = returnDto;
|
||||
this.artsSize.set(returnDto.getGrigliaAcquistiChild().size());
|
||||
if (this.docsFetched) {
|
||||
this.sendOnLoadingEnded();
|
||||
}
|
||||
}, this::sendError);
|
||||
public void fetchProducts(Runnable onComplete) {
|
||||
documentRESTConsumer.loadDocumentAvailableArts(
|
||||
this.getCodDtip(),
|
||||
this.getCodMgrp(),
|
||||
this.getCodAnagForn(),
|
||||
data -> {
|
||||
this.productsFetched = true;
|
||||
this.availableArts = data.getArts();
|
||||
this.artsSize.set(this.availableArts.size());
|
||||
|
||||
onComplete.run();
|
||||
}, this::sendError);
|
||||
}
|
||||
|
||||
public void fetchDocuments() {
|
||||
this.docsFetched = false;
|
||||
this.sendOnLoadingStarted();
|
||||
String codAnag = null, codVdes = null;
|
||||
FornitoreDTO fornitore = this.fornitore.getValue();
|
||||
public void fetchDocuments(Runnable onComplete) {
|
||||
String codAnag = null;
|
||||
String codVdes = null;
|
||||
|
||||
FornitoreDTO fornitore = this.fornitore;
|
||||
if (fornitore != null) {
|
||||
codAnag = fornitore.getCodAnag();
|
||||
codVdes = fornitore.getCodVdes();
|
||||
}
|
||||
documentRepository.getLocalDocumentsByCodDtip(this.getCodDtip(), codAnag, codVdes, dataDoc.getValue(), numDoc.getValue(), list -> {
|
||||
documentRepository.getNextNumCollo(nextNumCollo -> {
|
||||
this.mDocsList.postValue(list);
|
||||
this.setNextNumCollo(nextNumCollo);
|
||||
this.docsFetched = true;
|
||||
if (this.productsFetched) {
|
||||
this.sendOnLoadingEnded();
|
||||
}
|
||||
}, this::sendError);
|
||||
|
||||
|
||||
var docsList = documentRepository.getDocuments(this.getCodDtip(),
|
||||
codAnag, codVdes, dataDoc, numDoc);
|
||||
|
||||
docsList.observeForever(data -> {
|
||||
this.mDocsList.postValue(data);
|
||||
});
|
||||
|
||||
documentRepository.getNextNumCollo(nextNumCollo -> {
|
||||
this.setNextNumCollo(nextNumCollo);
|
||||
this.docsFetched = true;
|
||||
|
||||
onComplete.run();
|
||||
}, this::sendError);
|
||||
}
|
||||
|
||||
@@ -134,33 +145,37 @@ public class DocInterniViewModel {
|
||||
}
|
||||
|
||||
private String getCodDtip() {
|
||||
if (this.dtbTipi.getValue() == null) {
|
||||
if (this.dtbTipi == null) {
|
||||
return null;
|
||||
}
|
||||
return this.dtbTipi.getValue().getCodDtip();
|
||||
return this.dtbTipi.getCodDtip();
|
||||
}
|
||||
|
||||
public TipiDocDTO getTipoDoc() {
|
||||
if (this.dtbTipi.getValue() == null) {
|
||||
return null;
|
||||
}
|
||||
return this.dtbTipi.getValue();
|
||||
public TipoDocDTO getTipoDoc() {
|
||||
return this.dtbTipi;
|
||||
}
|
||||
|
||||
private String getCodMgrp() {
|
||||
if (this.mtbGrup.getValue() == null) {
|
||||
if (this.mtbGrup == null) {
|
||||
return null;
|
||||
}
|
||||
return this.mtbGrup.getValue().getCodMgrp();
|
||||
return this.mtbGrup.getCodMgrp();
|
||||
}
|
||||
|
||||
private String getCodAnagForn() {
|
||||
if (this.fornitore == null) {
|
||||
return null;
|
||||
}
|
||||
return this.fornitore.getCodAnag();
|
||||
}
|
||||
|
||||
public void editDocument(SqlMtbColt document) {
|
||||
this.mListener.onDocumentEditRequest(document, productsList);
|
||||
this.mListener.onDocumentEditRequest(document, availableArts);
|
||||
}
|
||||
|
||||
public void newDocument() {
|
||||
SqlMtbColt document = new SqlMtbColt();
|
||||
if (this.dtbTipi.getValue() == null) {
|
||||
if (this.dtbTipi == null) {
|
||||
this.sendError(new NoDocTypeSelectedException());
|
||||
return;
|
||||
}
|
||||
@@ -168,18 +183,18 @@ public class DocInterniViewModel {
|
||||
document.setCodMgrp(this.getCodMgrp());
|
||||
document.setDataCollo(new Date());
|
||||
document.setCodMdep(SettingsManager.i().getUserSession().getDepo().getCodMdep());
|
||||
document.setAnnotazioni(this.note.getValue());
|
||||
document.setAnnotazioni(this.note);
|
||||
document.setSegno(-1);
|
||||
document.setSerCollo("/");
|
||||
document.setNumCollo(this.nextNumCollo);
|
||||
document.setGestione("L");
|
||||
document.setDataDoc(this.dataDoc.getValue());
|
||||
if (this.numDoc.getValue() != null) {
|
||||
document.setNumDoc(Integer.parseInt(this.numDoc.getValue()));
|
||||
document.setDataDoc(this.dataDoc);
|
||||
if (this.numDoc != null) {
|
||||
document.setNumDoc(Integer.parseInt(this.numDoc));
|
||||
}
|
||||
if (this.fornitore.getValue() != null) {
|
||||
document.setCodAnag(this.fornitore.getValue().getCodAnag());
|
||||
document.setCodVdes(this.fornitore.getValue().getCodVdes());
|
||||
if (this.fornitore != null) {
|
||||
document.setCodAnag(this.fornitore.getCodAnag());
|
||||
document.setCodVdes(this.fornitore.getCodVdes());
|
||||
}
|
||||
documentRepository.insert(document, id -> {
|
||||
document.setId(id);
|
||||
@@ -188,7 +203,7 @@ public class DocInterniViewModel {
|
||||
}
|
||||
|
||||
public boolean hasDocDetails() {
|
||||
return this.dtbTipi.getValue() != null;
|
||||
return this.dtbTipi != null;
|
||||
}
|
||||
|
||||
public interface Listener extends ILoadingListener {
|
||||
@@ -197,9 +212,9 @@ public class DocInterniViewModel {
|
||||
|
||||
void onDocInterniSetupFetched(DocInterniSetupDTO docInterniSetupDTO);
|
||||
|
||||
void onDocDetailsChanged(DialogSelectDocInfoViewModel selection);
|
||||
void onDocDetailsChanged(DialogSelectDocInfoResponseDTO selection);
|
||||
|
||||
void onDocumentEditRequest(SqlMtbColt document, GrigliaArticoliDTO arts);
|
||||
void onDocumentEditRequest(SqlMtbColt document, List<DocumentoArtDTO> arts);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,5 @@ public interface DialogSelectDocInfoComponent {
|
||||
DialogSelectDocInfoComponent create();
|
||||
}
|
||||
|
||||
|
||||
void inject(DialogSelectDocInfoView dialogSelectDocInfoView);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,14 @@
|
||||
package it.integry.integrywmsnative.gest.contab_doc_interni.dialog;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
|
||||
@Module(subcomponents = DialogSelectDocInfoComponent.class)
|
||||
public class DialogSelectDocInfoModule {
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
DialogSelectDocInfoViewModel dialogSelectMgrpDtipPairViewModel() {
|
||||
DialogSelectDocInfoViewModel providesDialogDialogSelectDocInfoNewViewViewModel() {
|
||||
return new DialogSelectDocInfoViewModel();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
package it.integry.integrywmsnative.gest.contab_doc_interni.dialog;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.FornitoreDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.GruppoArticoloDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.TipoDocDTO;
|
||||
|
||||
public class DialogSelectDocInfoResponseDTO {
|
||||
|
||||
private TipoDocDTO tipoDoc;
|
||||
private GruppoArticoloDTO gruppoArt;
|
||||
private FornitoreDTO fornitore;
|
||||
private Date dataDoc;
|
||||
private Integer numDoc;
|
||||
private String note;
|
||||
private boolean fornitoreRequired;
|
||||
private boolean documentRequired;
|
||||
private boolean noteRequired;
|
||||
|
||||
|
||||
public TipoDocDTO getTipoDoc() {
|
||||
return tipoDoc;
|
||||
}
|
||||
|
||||
public DialogSelectDocInfoResponseDTO setTipoDoc(TipoDocDTO tipoDoc) {
|
||||
this.tipoDoc = tipoDoc;
|
||||
return this;
|
||||
}
|
||||
|
||||
public GruppoArticoloDTO getGruppoArt() {
|
||||
return gruppoArt;
|
||||
}
|
||||
|
||||
public DialogSelectDocInfoResponseDTO setGruppoArt(GruppoArticoloDTO gruppoArt) {
|
||||
this.gruppoArt = gruppoArt;
|
||||
return this;
|
||||
}
|
||||
|
||||
public FornitoreDTO getFornitore() {
|
||||
return fornitore;
|
||||
}
|
||||
|
||||
public DialogSelectDocInfoResponseDTO setFornitore(FornitoreDTO fornitore) {
|
||||
this.fornitore = fornitore;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataDoc() {
|
||||
return dataDoc;
|
||||
}
|
||||
|
||||
public DialogSelectDocInfoResponseDTO setDataDoc(Date dataDoc) {
|
||||
this.dataDoc = dataDoc;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getNumDoc() {
|
||||
return numDoc;
|
||||
}
|
||||
|
||||
public DialogSelectDocInfoResponseDTO setNumDoc(Integer numDoc) {
|
||||
this.numDoc = numDoc;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getNote() {
|
||||
return note;
|
||||
}
|
||||
|
||||
public DialogSelectDocInfoResponseDTO setNote(String note) {
|
||||
this.note = note;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isFornitoreRequired() {
|
||||
return fornitoreRequired;
|
||||
}
|
||||
|
||||
public DialogSelectDocInfoResponseDTO setFornitoreRequired(boolean fornitoreRequired) {
|
||||
this.fornitoreRequired = fornitoreRequired;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isDocumentRequired() {
|
||||
return documentRequired;
|
||||
}
|
||||
|
||||
public DialogSelectDocInfoResponseDTO setDocumentRequired(boolean documentRequired) {
|
||||
this.documentRequired = documentRequired;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isNoteRequired() {
|
||||
return noteRequired;
|
||||
}
|
||||
|
||||
public DialogSelectDocInfoResponseDTO setNoteRequired(boolean noteRequired) {
|
||||
this.noteRequired = noteRequired;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1,240 +1,254 @@
|
||||
package it.integry.integrywmsnative.gest.contab_doc_interni.dialog;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ArrayAdapter;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.databinding.ObservableField;
|
||||
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import it.integry.integrywmsnative.MainApplication;
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.di.BindableString;
|
||||
import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityObservable;
|
||||
import it.integry.integrywmsnative.databinding.DialogSelectDocInfoBinding;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.FornitoreDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.GruppiArticoloDTO;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
import it.integry.integrywmsnative.databinding.DialogSelectDocInfoViewBinding;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dialog.adapter.DialogSelectDocInfo_FornitoreAdapter;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dialog.adapter.DialogSelectDocInfo_GroupArtAdapter;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dialog.adapter.DialogSelectDocInfo_NoteAdapter;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dialog.adapter.DialogSelectDocInfo_TipoDocAdapter;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dialog.exception.DocumentRequiredException;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dialog.exception.FornitoreRequiredException;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dialog.exception.NoteRequiredException;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dialog.exception.TipoDocRequiredException;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.DocInterniSetupDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.TipiDocDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.FornitoreDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.GruppoArticoloDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.TipoDocDTO;
|
||||
|
||||
public class DialogSelectDocInfoView extends BaseDialogFragment implements DialogSelectDocInfoViewModel.Listener {
|
||||
public class DialogSelectDocInfoView extends BaseDialogFragment {
|
||||
|
||||
@Inject
|
||||
DialogSelectDocInfoViewModel mViewModel;
|
||||
private Context mCurrentContext;
|
||||
|
||||
private DialogSelectDocInfoViewBinding mBindings;
|
||||
private Context mContext;
|
||||
|
||||
public BindableString codDtip = new BindableString();
|
||||
public BindableString codMgrp = new BindableString();
|
||||
public BindableString codAnag = new BindableString();
|
||||
public BindableString numDoc = new BindableString();
|
||||
public BindableString note = new BindableString();
|
||||
public ObservableField<Date> dataDoc = new ObservableField<>();
|
||||
private final DocInterniSetupDTO mDocInputData;
|
||||
private final RunnableArgs<DialogSelectDocInfoResponseDTO> onConfirm;
|
||||
private final Runnable onAbort;
|
||||
|
||||
private ArrayAdapter<String> arrayAdapterCodDtips;
|
||||
private ArrayAdapter<String> arrayAdapterCodMgrps;
|
||||
private ArrayAdapter<String> arrayAdapterCodAnags;
|
||||
private ArrayAdapter<String> arrayAdapterNote;
|
||||
private DialogSelectDocInfoBinding mBindings;
|
||||
private boolean completed = false;
|
||||
|
||||
private final RunnableArgs<DialogSelectDocInfoViewModel> currentOnFilterDone;
|
||||
private final DocInterniSetupDTO docInterniSetupDTO;
|
||||
private final TipiDocDTO selectedDtip;
|
||||
private final GruppiArticoloDTO selectedGrp;
|
||||
private final FornitoreDTO selectedAnag;
|
||||
private final Date selectedDataDoc;
|
||||
private final String selectedNumDoc;
|
||||
private final String selectedNote;
|
||||
public ObservableField<TipoDocDTO> selectedTipoDoc = new ObservableField<>();
|
||||
public ObservableField<GruppoArticoloDTO> selectedGroupArt = new ObservableField<>();
|
||||
public ObservableField<FornitoreDTO> selectedFornitore = new ObservableField<>();
|
||||
public ObservableField<String> selectedNumDoc = new ObservableField<>();
|
||||
public ObservableField<Date> selectedDataDoc = new ObservableField<>();
|
||||
public ObservableField<String> selectedNote = new ObservableField<>();
|
||||
|
||||
public static DialogSelectDocInfoView newInstance(
|
||||
DocInterniSetupDTO docInterniSetupDTO,
|
||||
TipiDocDTO tipiDocDTO,
|
||||
GruppiArticoloDTO gruppiArticoloDTO,
|
||||
FornitoreDTO fornitoreDTO,
|
||||
Date dataDoc,
|
||||
String numDoc,
|
||||
String note,
|
||||
RunnableArgs<DialogSelectDocInfoViewModel> onDismiss
|
||||
) {
|
||||
return new DialogSelectDocInfoView(docInterniSetupDTO, tipiDocDTO, gruppiArticoloDTO, fornitoreDTO, dataDoc, numDoc,note, onDismiss);
|
||||
public ObservableField<Boolean> isFornitoreRequired = new ObservableField<>();
|
||||
public ObservableField<Boolean> isDocumentRequired = new ObservableField<>();
|
||||
public ObservableField<Boolean> isNoteRequired = new ObservableField<>();
|
||||
|
||||
public static DialogSelectDocInfoView newInstance(DocInterniSetupDTO docInputData,
|
||||
RunnableArgs<DialogSelectDocInfoResponseDTO> onConfirm,
|
||||
Runnable onAbort) {
|
||||
return new DialogSelectDocInfoView(docInputData, onConfirm, onAbort);
|
||||
}
|
||||
|
||||
private DialogSelectDocInfoView(DocInterniSetupDTO docInputData,
|
||||
RunnableArgs<DialogSelectDocInfoResponseDTO> onConfirm,
|
||||
Runnable onAbort) {
|
||||
super();
|
||||
|
||||
this.mDocInputData = docInputData;
|
||||
this.onConfirm = onConfirm;
|
||||
this.onAbort = onAbort;
|
||||
}
|
||||
|
||||
|
||||
private DialogSelectDocInfoView(DocInterniSetupDTO docInterniSetupDTO,
|
||||
TipiDocDTO tipiDocDTO,
|
||||
GruppiArticoloDTO gruppiArticoloDTO,
|
||||
FornitoreDTO fornitoreDTO,
|
||||
Date dataDoc,
|
||||
String numDoc,
|
||||
String note,
|
||||
RunnableArgs<DialogSelectDocInfoViewModel> onDismiss) {
|
||||
super();
|
||||
currentOnFilterDone = onDismiss;
|
||||
this.docInterniSetupDTO = docInterniSetupDTO;
|
||||
selectedDtip = tipiDocDTO;
|
||||
selectedGrp = gruppiArticoloDTO;
|
||||
selectedDataDoc = dataDoc;
|
||||
selectedNumDoc = numDoc;
|
||||
selectedNote = note;
|
||||
selectedAnag = fornitoreDTO;
|
||||
@NonNull
|
||||
@Override
|
||||
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
|
||||
this.mContext = requireContext();
|
||||
|
||||
MainApplication.appComponent
|
||||
.dialogSelectDocInfoNewViewComponent()
|
||||
.create()
|
||||
.inject(this);
|
||||
|
||||
setCancelable(false);
|
||||
|
||||
mBindings = DialogSelectDocInfoViewBinding.inflate(LayoutInflater.from(this.mContext), null, false);
|
||||
mBindings.setLifecycleOwner(this);
|
||||
mBindings.setView(this);
|
||||
|
||||
mViewModel.setFornitori(mDocInputData.getFornitori());
|
||||
|
||||
var alertDialog = new MaterialAlertDialogBuilder(this.mContext)
|
||||
.setView(mBindings.getRoot())
|
||||
.setCancelable(isCancelable())
|
||||
.setPositiveButton(R.string.confirm, (dialog, which) -> {
|
||||
//Volutamente vuoto
|
||||
})
|
||||
.setNegativeButton(R.string.abort, (dialog, which) -> {
|
||||
//Volutamente vuoto
|
||||
})
|
||||
.create();
|
||||
|
||||
alertDialog.setOnShowListener(this);
|
||||
alertDialog.setCanceledOnTouchOutside(isCancelable());
|
||||
alertDialog.setOnDismissListener(this);
|
||||
|
||||
|
||||
return alertDialog;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onShow(DialogInterface dialogInterface) {
|
||||
super.onShow(dialogInterface);
|
||||
|
||||
var alertDialog = ((AlertDialog) dialogInterface);
|
||||
|
||||
var positiveButton = alertDialog.getButton(DialogInterface.BUTTON_POSITIVE);
|
||||
positiveButton.setOnClickListener(view -> {
|
||||
try {
|
||||
mBindings.inputCodDtip.setErrorEnabled(false);
|
||||
mBindings.inputCodDtip.setError(null);
|
||||
mBindings.inputCodAnagForn.setErrorEnabled(false);
|
||||
mBindings.inputCodAnagForn.setError(null);
|
||||
mBindings.inputNumDocLayout.setErrorEnabled(false);
|
||||
mBindings.inputNumDoc.setError(null);
|
||||
mBindings.inputDataDocLayout.setErrorEnabled(false);
|
||||
mBindings.inputDataDoc.setError(null);
|
||||
mBindings.inputNoteLayout.setErrorEnabled(false);
|
||||
mBindings.inputNoteLayout.setError(null);
|
||||
|
||||
mViewModel.validate();
|
||||
completed = true;
|
||||
alertDialog.dismiss();
|
||||
|
||||
if (this.onConfirm != null)
|
||||
this.onConfirm.run(new DialogSelectDocInfoResponseDTO()
|
||||
.setTipoDoc(selectedTipoDoc.get())
|
||||
.setFornitore(selectedFornitore.get())
|
||||
.setGruppoArt(selectedGroupArt.get())
|
||||
.setDataDoc(selectedDataDoc.get())
|
||||
.setNumDoc(!UtilityString.isNullOrEmpty(selectedNumDoc.get()) ? Integer.parseInt(selectedNumDoc.get()) : null)
|
||||
.setNote(selectedNote.get()));
|
||||
} catch (TipoDocRequiredException tipoDocRequiredException) {
|
||||
mBindings.inputCodDtip.setErrorEnabled(true);
|
||||
mBindings.inputCodDtip.setError("Campo richiesto");
|
||||
} catch (FornitoreRequiredException fornitoreRequiredException) {
|
||||
mBindings.inputCodAnagForn.setErrorEnabled(true);
|
||||
mBindings.inputCodAnagForn.setError("Campo richiesto");
|
||||
} catch (DocumentRequiredException documentRequiredException) {
|
||||
mBindings.inputNumDocLayout.setErrorEnabled(true);
|
||||
mBindings.inputNumDocLayout.setError("Campo richiesto");
|
||||
mBindings.inputDataDocLayout.setErrorEnabled(true);
|
||||
mBindings.inputDataDocLayout.setError("Campo richiesto");
|
||||
} catch (NoteRequiredException noteRequiredException) {
|
||||
mBindings.inputNoteLayout.setErrorEnabled(true);
|
||||
mBindings.inputNoteLayout.setError("Campo richiesto");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
var negativeButton = alertDialog.getButton(DialogInterface.BUTTON_NEGATIVE);
|
||||
negativeButton.setOnClickListener(view -> {
|
||||
alertDialog.dismiss();
|
||||
if (this.onAbort != null) this.onAbort.run();
|
||||
});
|
||||
|
||||
this.initBindings();
|
||||
this.initAdapters();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void initBindings() {
|
||||
this.isFornitoreRequired.set(mViewModel.isFornitoreRequired().getValue());
|
||||
mViewModel.isFornitoreRequired().observe(this, val -> this.isFornitoreRequired.set(val));
|
||||
|
||||
this.isDocumentRequired.set(mViewModel.isDocumentRequired().getValue());
|
||||
mViewModel.isDocumentRequired().observe(this, val -> this.isDocumentRequired.set(val));
|
||||
|
||||
this.isNoteRequired.set(mViewModel.isNoteRequired().getValue());
|
||||
mViewModel.isNoteRequired().observe(this, val -> this.isNoteRequired.set(val));
|
||||
|
||||
|
||||
UtilityObservable.addPropertyChanged(this.selectedTipoDoc, mViewModel::setTipoDoc);
|
||||
UtilityObservable.addPropertyChanged(this.selectedGroupArt, mViewModel::setGruppoArt);
|
||||
UtilityObservable.addPropertyChanged(this.selectedFornitore, mViewModel::setFornitore);
|
||||
UtilityObservable.addPropertyChanged(this.selectedDataDoc, mViewModel::setDataDoc);
|
||||
UtilityObservable.addPropertyChanged(this.selectedNumDoc,
|
||||
value -> this.mViewModel.setNumDoc(UtilityString.isNullOrEmpty(value) ? null : Integer.parseInt(value)));
|
||||
UtilityObservable.addPropertyChanged(this.selectedNote, mViewModel::setNote);
|
||||
|
||||
mViewModel.isFornitoreRequired()
|
||||
.observe(this, val -> {
|
||||
if (!val) {
|
||||
this.selectedFornitore.set(null);
|
||||
mBindings.filledExposedDropdownCodAnagList.setText("");
|
||||
}
|
||||
});
|
||||
|
||||
mViewModel.isNoteRequired()
|
||||
.observe(this, val -> {
|
||||
if (!val) {
|
||||
this.selectedNote.set(null);
|
||||
mBindings.filledExposedDropdownNote.setText("");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void initAdapters() {
|
||||
var arrayAdapterCodDtips = new DialogSelectDocInfo_TipoDocAdapter(mContext, R.layout.array_adapter_single_item, mDocInputData.getTipiDoc());
|
||||
mBindings.filledExposedDropdownCodDtips.setAdapter(arrayAdapterCodDtips);
|
||||
mBindings.filledExposedDropdownCodDtips.setOnItemClickListener((adapterView, view, i, l) -> {
|
||||
this.selectedTipoDoc.set(
|
||||
((DialogSelectDocInfo_TipoDocAdapter.ListModel) adapterView.getItemAtPosition(i))
|
||||
.getOriginalModel());
|
||||
});
|
||||
|
||||
var arrayAdapterCodMgrps = new DialogSelectDocInfo_GroupArtAdapter(mContext, R.layout.array_adapter_single_item, mDocInputData.getGruppiArt());
|
||||
mBindings.filledExposedDropdownCodMgrps.setAdapter(arrayAdapterCodMgrps);
|
||||
mBindings.filledExposedDropdownCodMgrps.setOnItemClickListener((adapterView, view, i, l) -> {
|
||||
this.selectedGroupArt.set(
|
||||
((DialogSelectDocInfo_GroupArtAdapter.ListModel) adapterView.getItemAtPosition(i))
|
||||
.getOriginalModel());
|
||||
});
|
||||
|
||||
var arrayAdapterFornitori = new DialogSelectDocInfo_FornitoreAdapter(mContext, R.layout.array_adapter_single_item, mViewModel.getAvailableFornitori());
|
||||
mBindings.filledExposedDropdownCodAnagList.setAdapter(arrayAdapterFornitori);
|
||||
mBindings.filledExposedDropdownCodAnagList.setOnItemClickListener((adapterView, view, i, l) -> {
|
||||
this.selectedFornitore.set(
|
||||
((DialogSelectDocInfo_FornitoreAdapter.ListModel) adapterView.getItemAtPosition(i))
|
||||
.getOriginalModel());
|
||||
});
|
||||
|
||||
var arrayAdapterNote = new DialogSelectDocInfo_NoteAdapter(mContext, R.layout.array_adapter_single_item, SettingsManager.iDB().getNotePerditaDocInterni());
|
||||
mBindings.filledExposedDropdownNote.setAdapter(arrayAdapterNote);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDismiss(@NonNull DialogInterface dialog) {
|
||||
super.onDismiss(dialog);
|
||||
if (currentOnFilterDone != null) currentOnFilterDone.run(mViewModel);
|
||||
|
||||
if(!completed)
|
||||
this.onAbort.run();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
this.mCurrentContext = this.requireActivity();
|
||||
|
||||
mBindings = DataBindingUtil.inflate(inflater, R.layout.dialog_select_doc_info, container, false);
|
||||
mBindings.setLifecycleOwner(this);
|
||||
|
||||
MainApplication
|
||||
.appComponent
|
||||
.dialogSelectMgrpDtipPairComponent()
|
||||
.create()
|
||||
.inject(this);
|
||||
mViewModel.init(docInterniSetupDTO);
|
||||
mViewModel.setListeners(this);
|
||||
mBindings.setView(this);
|
||||
mBindings.setViewmodel(mViewModel);
|
||||
|
||||
getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
|
||||
getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||
initView();
|
||||
|
||||
|
||||
mBindings.positiveBtn.setOnClickListener(view -> {
|
||||
if (this.isInputValid()) {
|
||||
getDialog().dismiss();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
return mBindings.getRoot();
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
initArrayAdapters();
|
||||
initBindables();
|
||||
|
||||
if (selectedDtip != null) {
|
||||
codDtip.set(selectedDtip.getLabel());
|
||||
}
|
||||
if (selectedGrp != null) {
|
||||
codMgrp.set(selectedGrp.getLabel());
|
||||
}
|
||||
if (selectedAnag != null) {
|
||||
codAnag.set(selectedAnag.getLabel());
|
||||
}
|
||||
if (selectedDataDoc != null) {
|
||||
dataDoc.set(selectedDataDoc);
|
||||
}
|
||||
if (selectedNumDoc != null) {
|
||||
numDoc.set(selectedNumDoc);
|
||||
}
|
||||
if (selectedNote != null) {
|
||||
note.set(selectedNote);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isInputValid() {
|
||||
if (this.mViewModel.getSelectedTipoDoc() == null) {
|
||||
mBindings.inputCodDtip.setErrorEnabled(true);
|
||||
mBindings.inputCodDtip.setError("Seleziona un tipo documento");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.mViewModel.requiresFornitore() && this.mViewModel.getSelectedFornitore() == null) {
|
||||
mBindings.inputCodAnagForn.setErrorEnabled(true);
|
||||
mBindings.inputCodAnagForn.setError("Seleziona un fornitore/destinatario");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.mViewModel.requiresDocData() && this.mViewModel.getDataDoc() == null){
|
||||
mBindings.inputDataDoc.setError("Seleziona la data del documento");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.mViewModel.requiresDocData() && (this.mViewModel.getNumDoc() == null || this.mViewModel.getNumDoc().isEmpty() )){
|
||||
mBindings.inputNumDoc.setError("Seleziona il numero del documento");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.mViewModel.requiresNote() && (this.mViewModel.getNote() == null || this.mViewModel.getNote().isEmpty() )){
|
||||
mBindings.inputNoteLayout.setErrorEnabled(true);
|
||||
mBindings.inputNoteLayout.setError("Specifica delle note per il documento");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void initArrayAdapters() {
|
||||
|
||||
arrayAdapterCodDtips = new ArrayAdapter<>(mCurrentContext, R.layout.dialog_select_doc_info__single_item);
|
||||
arrayAdapterCodDtips.addAll(mViewModel.getAvailableCodDtips());
|
||||
mBindings.filledExposedDropdownCodDtips.setAdapter(arrayAdapterCodDtips);
|
||||
|
||||
arrayAdapterCodMgrps = new ArrayAdapter<>(mCurrentContext, R.layout.dialog_select_doc_info__single_item);
|
||||
arrayAdapterCodMgrps.addAll(mViewModel.getAvailableCodMgrps());
|
||||
mBindings.filledExposedDropdownCodMgrps.setAdapter(arrayAdapterCodMgrps);
|
||||
|
||||
arrayAdapterCodAnags = new ArrayAdapter<>(mCurrentContext, R.layout.dialog_select_doc_info__single_item);
|
||||
arrayAdapterCodAnags.addAll(mViewModel.getAvailableFornitori());
|
||||
mBindings.filledExposedDropdownCodAnagList.setAdapter(arrayAdapterCodAnags);
|
||||
|
||||
arrayAdapterNote = new ArrayAdapter<>(mCurrentContext, R.layout.dialog_select_doc_info__single_item);
|
||||
arrayAdapterNote.addAll(mViewModel.getAdditionalNotes());
|
||||
mBindings.filledExposedDropdownNote.setAdapter(arrayAdapterNote);
|
||||
}
|
||||
|
||||
private void initBindables() {
|
||||
BindableString.registerListener(codDtip, codDtip -> {
|
||||
mViewModel.setCodDtip(codDtip);
|
||||
mBindings.inputCodAnagForn.setVisibility(mViewModel.requiresFornitore() ? View.VISIBLE : View.GONE);
|
||||
mBindings.inputDataDocLayout.setVisibility(mViewModel.requiresDocData() ? View.VISIBLE : View.GONE);
|
||||
mBindings.inputNumDocLayout.setVisibility(mViewModel.requiresDocData() ? View.VISIBLE : View.GONE);
|
||||
mBindings.inputNoteLayout.setVisibility(mViewModel.requiresNote() ? View.VISIBLE : View.GONE);
|
||||
});
|
||||
BindableString.registerListener(codMgrp, mViewModel::setCodMgrp);
|
||||
BindableString.registerListener(codAnag, mViewModel::setCodAnag);
|
||||
BindableString.registerListener(numDoc, mViewModel::setNumDoc);
|
||||
BindableString.registerListener(note, mViewModel::setNote);
|
||||
UtilityObservable.addPropertyChanged(this.dataDoc, (value) -> {
|
||||
this.mViewModel.setDataDoc(value);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onDocTypeSelected() {
|
||||
arrayAdapterCodAnags.clear();
|
||||
if (mViewModel.getSelectedFornitore() != null && !mViewModel.getAvailableFornitori().contains(mViewModel.getSelectedFornitore().getLabel())) {
|
||||
codAnag.set("");
|
||||
}
|
||||
if (mViewModel.getNote() != null && ! mViewModel.requiresNote()){
|
||||
mViewModel.setNote(null);
|
||||
}
|
||||
arrayAdapterCodAnags.addAll(mViewModel.getAvailableFornitori());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,198 +1,167 @@
|
||||
package it.integry.integrywmsnative.gest.contab_doc_interni.dialog;
|
||||
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
import androidx.lifecycle.ViewModel;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.DocInterniSetupDTO;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dialog.exception.DocumentRequiredException;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dialog.exception.FornitoreRequiredException;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dialog.exception.NoteRequiredException;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dialog.exception.TipoDocRequiredException;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.FornitoreDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.GruppiArticoloDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.TipiDocDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.GruppoArticoloDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.TipoDocDTO;
|
||||
|
||||
public class DialogSelectDocInfoViewModel extends ViewModel {
|
||||
|
||||
private final MutableLiveData<TipoDocDTO> tipoDoc = new MutableLiveData<>();
|
||||
private final MutableLiveData<GruppoArticoloDTO> gruppoArt = new MutableLiveData<>();
|
||||
private final MutableLiveData<FornitoreDTO> fornitore = new MutableLiveData<>();
|
||||
private final MutableLiveData<Date> dataDoc = new MutableLiveData<>();
|
||||
private final MutableLiveData<Integer> numDoc = new MutableLiveData<>();
|
||||
private final MutableLiveData<String> note = new MutableLiveData<>();
|
||||
|
||||
private final MutableLiveData<List<FornitoreDTO>> availableFornitori = new MutableLiveData<>();
|
||||
|
||||
|
||||
public class DialogSelectDocInfoViewModel {
|
||||
private final MutableLiveData<Boolean> fornitoreRequired = new MutableLiveData<>(false);
|
||||
private final MutableLiveData<Boolean> documentRequired = new MutableLiveData<>(false);
|
||||
private final MutableLiveData<Boolean> noteRequired = new MutableLiveData<>(false);
|
||||
|
||||
public DialogSelectDocInfoViewModel() {
|
||||
tipoDoc.observeForever(val ->
|
||||
fornitoreRequired.postValue(
|
||||
val != null &&
|
||||
(val.getGestioneDoc().equals("T") ||
|
||||
val.getGestioneDoc().equals("A") ||
|
||||
(val.getGestioneDoc().equals("P") &&
|
||||
!val.getGestione().equals("L")))));
|
||||
|
||||
private DocInterniSetupDTO mDocInterniSetupDTO;
|
||||
tipoDoc.observeForever(val ->
|
||||
documentRequired.postValue(
|
||||
val != null &&
|
||||
val.getGestioneDoc().equalsIgnoreCase("P") && !val.getGestione().equalsIgnoreCase("L")));
|
||||
|
||||
private String mTipoDoc;
|
||||
|
||||
private String mGruppoArt;
|
||||
|
||||
private String mFornitore;
|
||||
|
||||
private Date mDataDoc;
|
||||
|
||||
private String mNumDoc;
|
||||
|
||||
private String mNote;
|
||||
|
||||
private Listener mListener;
|
||||
|
||||
public void init(DocInterniSetupDTO initialList) {
|
||||
this.mDocInterniSetupDTO = initialList;
|
||||
this.mTipoDoc = null;
|
||||
this.mGruppoArt = null;
|
||||
this.mFornitore = null;
|
||||
this.mDataDoc = null;
|
||||
this.mNumDoc = null;
|
||||
this.mNote = null;
|
||||
this.mListener = null;
|
||||
tipoDoc.observeForever(val ->
|
||||
noteRequired.postValue(
|
||||
val != null &&
|
||||
val.getGestioneDoc().equals("P") &&
|
||||
val.getGestione().equals("L")));
|
||||
}
|
||||
|
||||
public String getCodDtip() {
|
||||
return mTipoDoc;
|
||||
public MutableLiveData<List<FornitoreDTO>> getAvailableFornitori() {
|
||||
return availableFornitori;
|
||||
}
|
||||
|
||||
public void setCodDtip(String codDtip) {
|
||||
this.mTipoDoc = codDtip;
|
||||
if (this.getSelectedTipoDoc() != null) {
|
||||
this.mListener.onDocTypeSelected();
|
||||
}
|
||||
public void setFornitori(List<FornitoreDTO> fornitori) {
|
||||
tipoDoc.observeForever(val -> {
|
||||
availableFornitori.postValue(Stream.of(fornitori)
|
||||
.filter(forn -> {
|
||||
if (val.getGestioneDoc().equalsIgnoreCase("T")) {
|
||||
return forn.getTipoAnag().equalsIgnoreCase("D") &&
|
||||
forn.getGestioneAnag().equalsIgnoreCase(
|
||||
val.getGestione().equalsIgnoreCase("V") ? "V" : "A"
|
||||
);
|
||||
} else {
|
||||
return forn.getTipoAnag().equalsIgnoreCase("F");
|
||||
}
|
||||
})
|
||||
.toList());
|
||||
});
|
||||
}
|
||||
|
||||
public String getCodMgrp() {
|
||||
return mGruppoArt;
|
||||
|
||||
public MutableLiveData<Boolean> isFornitoreRequired() {
|
||||
return fornitoreRequired;
|
||||
}
|
||||
|
||||
public void setCodMgrp(String codMgrp) {
|
||||
this.mGruppoArt = codMgrp;
|
||||
public MutableLiveData<Boolean> isDocumentRequired() {
|
||||
return documentRequired;
|
||||
}
|
||||
|
||||
public void setCodAnag(String codAnag) {
|
||||
this.mFornitore = codAnag;
|
||||
public MutableLiveData<Boolean> isNoteRequired() {
|
||||
return noteRequired;
|
||||
}
|
||||
|
||||
|
||||
public MutableLiveData<TipoDocDTO> getTipoDoc() {
|
||||
return tipoDoc;
|
||||
}
|
||||
|
||||
public DialogSelectDocInfoViewModel setTipoDoc(TipoDocDTO tipoDoc) {
|
||||
this.tipoDoc.postValue(tipoDoc);
|
||||
return this;
|
||||
}
|
||||
|
||||
public GruppoArticoloDTO getGruppoArt() {
|
||||
return gruppoArt.getValue();
|
||||
}
|
||||
|
||||
public DialogSelectDocInfoViewModel setGruppoArt(GruppoArticoloDTO gruppoArt) {
|
||||
this.gruppoArt.postValue(gruppoArt);
|
||||
return this;
|
||||
}
|
||||
|
||||
public FornitoreDTO getFornitore() {
|
||||
return fornitore.getValue();
|
||||
}
|
||||
|
||||
public DialogSelectDocInfoViewModel setFornitore(FornitoreDTO fornitore) {
|
||||
this.fornitore.postValue(fornitore);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataDoc() {
|
||||
return mDataDoc;
|
||||
return dataDoc.getValue();
|
||||
}
|
||||
|
||||
public void setDataDoc(Date mDataDoc) {
|
||||
this.mDataDoc = mDataDoc;
|
||||
public DialogSelectDocInfoViewModel setDataDoc(Date dataDoc) {
|
||||
this.dataDoc.postValue(dataDoc);
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getNumDoc() {
|
||||
return mNumDoc;
|
||||
public Integer getNumDoc() {
|
||||
return numDoc.getValue();
|
||||
}
|
||||
|
||||
public void setNumDoc(String numDoc) {
|
||||
this.mNumDoc = numDoc;
|
||||
public DialogSelectDocInfoViewModel setNumDoc(Integer numDoc) {
|
||||
this.numDoc.postValue(numDoc);
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getNote() {
|
||||
return mNote;
|
||||
return note.getValue();
|
||||
}
|
||||
|
||||
public DialogSelectDocInfoViewModel setNote(String note) {
|
||||
this.mNote = note;
|
||||
this.note.postValue(note);
|
||||
return this;
|
||||
}
|
||||
|
||||
public DialogSelectDocInfoViewModel setListeners(Listener listener) {
|
||||
this.mListener = listener;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<String> getAvailableCodDtips() {
|
||||
return mDocInterniSetupDTO.getTipiDoc() != null ? Stream.of(mDocInterniSetupDTO.getTipiDoc()).map(TipiDocDTO::getLabel).toList() : new ArrayList<>();
|
||||
}
|
||||
|
||||
public List<String> getAvailableCodMgrps() {
|
||||
return mDocInterniSetupDTO.getGruppiArt() != null ? Stream.of(mDocInterniSetupDTO.getGruppiArt()).map(GruppiArticoloDTO::getLabel).toList() : new ArrayList<>();
|
||||
}
|
||||
|
||||
public List<String> getAvailableFornitori() {
|
||||
if (!this.requiresFornitore()) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
TipiDocDTO selectedDocType = getSelectedTipoDoc();
|
||||
|
||||
return Stream.of(mDocInterniSetupDTO.getFornitori())
|
||||
.filter(forn -> {
|
||||
if (selectedDocType.getGestioneDoc().equalsIgnoreCase("T")) {
|
||||
return forn.getTipoAnag().equalsIgnoreCase("D") &&
|
||||
forn.getGestioneAnag().equalsIgnoreCase(
|
||||
selectedDocType.getGestione().equalsIgnoreCase("V") ? "V" : "A"
|
||||
);
|
||||
} else {
|
||||
return forn.getTipoAnag().equalsIgnoreCase("F");
|
||||
}
|
||||
})
|
||||
.map(FornitoreDTO::getLabel).toList();
|
||||
}
|
||||
|
||||
public TipiDocDTO getSelectedTipoDoc() {
|
||||
return Stream.of(mDocInterniSetupDTO.getTipiDoc()).filter(x -> x.getLabel().equals(mTipoDoc)).findFirstOrElse(null);
|
||||
}
|
||||
|
||||
public FornitoreDTO getSelectedFornitore() {
|
||||
return Stream.of(mDocInterniSetupDTO.getFornitori()).filter(x -> x.getLabel().equals(mFornitore)).findFirstOrElse(null);
|
||||
}
|
||||
|
||||
public GruppiArticoloDTO getSelectedGruppoArt() {
|
||||
if (mGruppoArt == null) {
|
||||
return null;
|
||||
public boolean validate() throws TipoDocRequiredException, FornitoreRequiredException, DocumentRequiredException, NoteRequiredException {
|
||||
if (this.getTipoDoc().getValue() == null) {
|
||||
throw new TipoDocRequiredException();
|
||||
}
|
||||
|
||||
return Stream.of(mDocInterniSetupDTO.getGruppiArt()).filter(x -> x.getLabel().equals(mGruppoArt)).findFirstOrElse(null);
|
||||
}
|
||||
|
||||
public boolean requiresFornitore() {
|
||||
return this.getSelectedTipoDoc() != null && (
|
||||
this.getSelectedTipoDoc().getGestioneDoc().equals("T") ||
|
||||
this.getSelectedTipoDoc().getGestioneDoc().equals("A") ||
|
||||
(
|
||||
this.getSelectedTipoDoc().getGestioneDoc().equals("P") &&
|
||||
!this.getSelectedTipoDoc().getGestione().equals("L")
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public boolean requiresNote() {
|
||||
return this.getSelectedTipoDoc() != null &&
|
||||
this.getSelectedTipoDoc().getGestioneDoc().equals("P") &&
|
||||
this.getSelectedTipoDoc().getGestione().equals("L");
|
||||
}
|
||||
|
||||
public boolean isInputValid() {
|
||||
if (this.getSelectedTipoDoc() == null) {
|
||||
return false;
|
||||
if (Boolean.TRUE.equals(this.isFornitoreRequired().getValue()) && this.getFornitore() == null) {
|
||||
throw new FornitoreRequiredException();
|
||||
}
|
||||
|
||||
if (this.requiresFornitore() && this.getSelectedFornitore() == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.requiresDocData() && (this.getDataDoc() == null || this.getNumDoc() == null)) {
|
||||
return false;
|
||||
if (Boolean.TRUE.equals(this.isDocumentRequired().getValue()) && (this.getDataDoc() == null || this.getNumDoc() == null)) {
|
||||
throw new DocumentRequiredException();
|
||||
}
|
||||
|
||||
|
||||
if (this.requiresNote() && (this.getNote() == null || this.getNote().length() <= 0)) {
|
||||
return false;
|
||||
if (Boolean.TRUE.equals(this.isNoteRequired().getValue()) && UtilityString.isNullOrEmpty(this.getNote())) {
|
||||
throw new NoteRequiredException();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean requiresDocData() {
|
||||
TipiDocDTO doc = this.getSelectedTipoDoc();
|
||||
return doc != null && doc.getGestioneDoc().equalsIgnoreCase("P") && !doc.getGestione().equalsIgnoreCase("L");
|
||||
}
|
||||
|
||||
public List<String> getAdditionalNotes() {
|
||||
return SettingsManager.iDB().getNotePerditaDocInterni();
|
||||
}
|
||||
|
||||
public interface Listener extends ILoadingListener {
|
||||
|
||||
void onError(Exception ex);
|
||||
|
||||
void onDocTypeSelected();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package it.integry.integrywmsnative.gest.contab_doc_interni.dialog.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.widget.ArrayAdapter;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.FornitoreDTO;
|
||||
|
||||
public class DialogSelectDocInfo_FornitoreAdapter extends ArrayAdapter<DialogSelectDocInfo_FornitoreAdapter.ListModel> {
|
||||
|
||||
public DialogSelectDocInfo_FornitoreAdapter(@NonNull Context context, int resource, MutableLiveData<List<FornitoreDTO>> inputData) {
|
||||
super(context, resource);
|
||||
|
||||
if (inputData == null) return;
|
||||
|
||||
inputData.observeForever(data -> {
|
||||
List<ListModel> mDataset = Stream.of(data)
|
||||
.map(x -> new ListModel()
|
||||
.setOriginalModel(x))
|
||||
.toList();
|
||||
|
||||
clear();
|
||||
addAll(mDataset);
|
||||
});
|
||||
}
|
||||
|
||||
public static class ListModel {
|
||||
|
||||
private FornitoreDTO originalModel;
|
||||
|
||||
public FornitoreDTO getOriginalModel() {
|
||||
return originalModel;
|
||||
}
|
||||
|
||||
public ListModel setOriginalModel(FornitoreDTO originalModel) {
|
||||
this.originalModel = originalModel;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.getOriginalModel().getCodAnag() +
|
||||
(this.getOriginalModel().getCodVdes() != null ? " - " + this.getOriginalModel().getCodVdes() : "") +
|
||||
" ( " + this.getOriginalModel().getDescrizione() + " )";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user