Compare commits
82 Commits
v1.30.13(3
...
v1.32.08(3
| Author | SHA1 | Date | |
|---|---|---|---|
| af5d19eb55 | |||
| b0a7a93f85 | |||
| 10f888b5d5 | |||
| 95807fbfbc | |||
| 4317e083a6 | |||
| 0c54a32e39 | |||
| 62dc62aa99 | |||
| 2182a970ac | |||
| 9b823fdca8 | |||
| 904c825472 | |||
| a15d225998 | |||
| e3b8373bb9 | |||
| 0cdbbc096c | |||
| 895c21cee4 | |||
| d541761ac6 | |||
| 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 | |||
| 7fdc964687 | |||
| 8322303351 | |||
| a7f5f5f505 | |||
| 9b1a00d09c | |||
| 72ebf8f135 | |||
| be58e333b6 | |||
| 42620bd324 | |||
| d4deade046 | |||
| 846393304a | |||
| c3ceae8027 | |||
| 7b4d7db265 | |||
| 1c6cf9a02b | |||
| fd2d4fb47b | |||
| 094f9b68f6 | |||
| be418d3d26 | |||
| 25813a6362 | |||
| 51c5d3a0c7 | |||
| e964220655 | |||
| e493f1796b | |||
| 4882645311 | |||
| 468f1e5b58 | |||
| 79add4f60a | |||
| 975763f400 | |||
| 5eac3f14cc | |||
| bed5b36ade | |||
| 7678ce1a50 | |||
| b3faf38455 | |||
| 283cb59d42 | |||
| 1867ac8742 | |||
| d210e3b3e0 | |||
| 8bb2f48090 | |||
| 15b4d728e6 | |||
| 3018123110 | |||
| b02eaf02a8 | |||
| ad9795a3a3 | |||
| 170411383f | |||
| 9e87130d6c | |||
| 0f6a9cdae2 | |||
| 79ec6430f6 | |||
| 8aad7337bf |
6
.idea/kotlinc.xml
generated
Normal file
6
.idea/kotlinc.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="KotlinJpsPluginSettings">
|
||||
<option name="version" value="1.8.0" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -1,6 +1,6 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="app_base" type="AndroidRunConfigurationType" factoryName="Android App" activateToolWindowBeforeRun="false">
|
||||
<module name="WMS.app" />
|
||||
<configuration default="false" name="app" type="AndroidRunConfigurationType" factoryName="Android App">
|
||||
<module name="WMS.app.main" />
|
||||
<option name="DEPLOY" value="true" />
|
||||
<option name="DEPLOY_APK_FROM_BUNDLE" value="false" />
|
||||
<option name="DEPLOY_AS_INSTANT" value="false" />
|
||||
@@ -8,13 +8,12 @@
|
||||
<option name="PM_INSTALL_OPTIONS" value="" />
|
||||
<option name="ALL_USERS" value="false" />
|
||||
<option name="ALWAYS_INSTALL_WITH_PM" value="false" />
|
||||
<option name="DYNAMIC_FEATURES_DISABLED_LIST" value="WMS.dynamic_vgalimenti" />
|
||||
<option name="CLEAR_APP_STORAGE" value="false" />
|
||||
<option name="DYNAMIC_FEATURES_DISABLED_LIST" value="WMS.dynamic__base,WMS.dynamic_vgalimenti" />
|
||||
<option name="ACTIVITY_EXTRA_FLAGS" value="" />
|
||||
<option name="MODE" value="default_activity" />
|
||||
<option name="CLEAR_LOGCAT" value="true" />
|
||||
<option name="SHOW_LOGCAT_AUTOMATICALLY" value="true" />
|
||||
<option name="SKIP_NOOP_APK_INSTALLATIONS" value="true" />
|
||||
<option name="FORCE_STOP_RUNNING_APP" value="true" />
|
||||
<option name="CLEAR_LOGCAT" value="false" />
|
||||
<option name="SHOW_LOGCAT_AUTOMATICALLY" value="false" />
|
||||
<option name="INSPECTION_WITHOUT_ACTIVITY_RESTART" value="false" />
|
||||
<option name="TARGET_SELECTION_MODE" value="SHOW_DIALOG" />
|
||||
<option name="SELECTED_CLOUD_MATRIX_CONFIGURATION_ID" value="-1" />
|
||||
@@ -46,7 +45,7 @@
|
||||
<option name="ADVANCED_PROFILING_ENABLED" value="false" />
|
||||
<option name="STARTUP_PROFILING_ENABLED" value="false" />
|
||||
<option name="STARTUP_CPU_PROFILING_ENABLED" value="false" />
|
||||
<option name="STARTUP_CPU_PROFILING_CONFIGURATION_NAME" value="Callstack Sample" />
|
||||
<option name="STARTUP_CPU_PROFILING_CONFIGURATION_NAME" value="Java/Kotlin Method Sample (legacy)" />
|
||||
<option name="STARTUP_NATIVE_MEMORY_PROFILING_ENABLED" value="false" />
|
||||
<option name="NATIVE_MEMORY_SAMPLE_RATE_BYTES" value="2048" />
|
||||
</Profilers>
|
||||
61
.idea/runConfigurations/app_vglimenti.xml
generated
61
.idea/runConfigurations/app_vglimenti.xml
generated
@@ -1,61 +0,0 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="app_vglimenti" type="AndroidRunConfigurationType" factoryName="Android App" activateToolWindowBeforeRun="false">
|
||||
<module name="WMS.app" />
|
||||
<option name="DEPLOY" value="true" />
|
||||
<option name="DEPLOY_APK_FROM_BUNDLE" value="false" />
|
||||
<option name="DEPLOY_AS_INSTANT" value="false" />
|
||||
<option name="ARTIFACT_NAME" value="" />
|
||||
<option name="PM_INSTALL_OPTIONS" value="" />
|
||||
<option name="ALL_USERS" value="false" />
|
||||
<option name="ALWAYS_INSTALL_WITH_PM" value="false" />
|
||||
<option name="DYNAMIC_FEATURES_DISABLED_LIST" value="WMS.dynamic__base" />
|
||||
<option name="ACTIVITY_EXTRA_FLAGS" value="" />
|
||||
<option name="MODE" value="default_activity" />
|
||||
<option name="CLEAR_LOGCAT" value="true" />
|
||||
<option name="SHOW_LOGCAT_AUTOMATICALLY" value="true" />
|
||||
<option name="SKIP_NOOP_APK_INSTALLATIONS" value="true" />
|
||||
<option name="FORCE_STOP_RUNNING_APP" value="true" />
|
||||
<option name="INSPECTION_WITHOUT_ACTIVITY_RESTART" value="false" />
|
||||
<option name="TARGET_SELECTION_MODE" value="SHOW_DIALOG" />
|
||||
<option name="SELECTED_CLOUD_MATRIX_CONFIGURATION_ID" value="-1" />
|
||||
<option name="SELECTED_CLOUD_MATRIX_PROJECT_ID" value="" />
|
||||
<option name="DEBUGGER_TYPE" value="Auto" />
|
||||
<Auto>
|
||||
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
|
||||
<option name="SHOW_STATIC_VARS" value="true" />
|
||||
<option name="WORKING_DIR" value="" />
|
||||
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
|
||||
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
|
||||
</Auto>
|
||||
<Hybrid>
|
||||
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
|
||||
<option name="SHOW_STATIC_VARS" value="true" />
|
||||
<option name="WORKING_DIR" value="" />
|
||||
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
|
||||
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
|
||||
</Hybrid>
|
||||
<Java />
|
||||
<Native>
|
||||
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
|
||||
<option name="SHOW_STATIC_VARS" value="true" />
|
||||
<option name="WORKING_DIR" value="" />
|
||||
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
|
||||
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
|
||||
</Native>
|
||||
<Profilers>
|
||||
<option name="ADVANCED_PROFILING_ENABLED" value="false" />
|
||||
<option name="STARTUP_PROFILING_ENABLED" value="false" />
|
||||
<option name="STARTUP_CPU_PROFILING_ENABLED" value="false" />
|
||||
<option name="STARTUP_CPU_PROFILING_CONFIGURATION_NAME" value="Callstack Sample" />
|
||||
<option name="STARTUP_NATIVE_MEMORY_PROFILING_ENABLED" value="false" />
|
||||
<option name="NATIVE_MEMORY_SAMPLE_RATE_BYTES" value="2048" />
|
||||
</Profilers>
|
||||
<option name="DEEP_LINK" value="" />
|
||||
<option name="ACTIVITY_CLASS" value="" />
|
||||
<option name="SEARCH_ACTIVITY_IN_GLOBAL_SCOPE" value="false" />
|
||||
<option name="SKIP_ACTIVITY_VALIDATION" value="false" />
|
||||
<method v="2">
|
||||
<option name="Android.Gradle.BeforeRunTask" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
</component>
|
||||
@@ -10,8 +10,8 @@ apply plugin: 'com.google.gms.google-services'
|
||||
|
||||
android {
|
||||
|
||||
def appVersionCode = 331
|
||||
def appVersionName = '1.30.13'
|
||||
def appVersionCode = 348
|
||||
def appVersionName = '1.32.08'
|
||||
|
||||
signingConfigs {
|
||||
release {
|
||||
@@ -62,11 +62,12 @@ android {
|
||||
}
|
||||
|
||||
android.buildFeatures.dataBinding true
|
||||
android.buildFeatures.buildConfig true
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_11
|
||||
targetCompatibility JavaVersion.VERSION_11
|
||||
//coreLibraryDesugaringEnabled true
|
||||
coreLibraryDesugaringEnabled true
|
||||
}
|
||||
|
||||
productFlavors {
|
||||
@@ -85,9 +86,6 @@ android {
|
||||
options.compilerArgs << "-Xmaxerrs" << "10000"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
dynamicFeatures = [":dynamic__base", ":dynamic_vgalimenti"]
|
||||
lint {
|
||||
abortOnError false
|
||||
}
|
||||
@@ -97,6 +95,7 @@ android {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.2'
|
||||
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||
androidTestImplementation('androidx.test.espresso:espresso-core:3.3.0', {
|
||||
exclude group: 'com.android.support', module: 'support-annotations'
|
||||
@@ -115,7 +114,7 @@ dependencies {
|
||||
implementation 'com.google.android.gms:play-services-basement:18.1.0'
|
||||
|
||||
|
||||
implementation 'androidx.appcompat:appcompat:1.6.0'
|
||||
implementation 'androidx.appcompat:appcompat:1.6.1'
|
||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||
implementation 'com.google.android.material:material:1.8.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||||
@@ -188,7 +187,6 @@ dependencies {
|
||||
// RxJava is also required.
|
||||
implementation 'io.reactivex.rxjava2:rxjava:2.1.12'
|
||||
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
|
||||
|
||||
}
|
||||
|
||||
repositories {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"formatVersion": 1,
|
||||
"database": {
|
||||
"version": 13,
|
||||
"identityHash": "bc3841159bac7a7731fe39a5fa4f0f4e",
|
||||
"identityHash": "bef89b513f0a4d5ecd9c2111e2e614a4",
|
||||
"entities": [
|
||||
{
|
||||
"tableName": "articoli_griglia",
|
||||
@@ -112,10 +112,10 @@
|
||||
}
|
||||
],
|
||||
"primaryKey": {
|
||||
"autoGenerate": true,
|
||||
"columnNames": [
|
||||
"articolo_griglia_id"
|
||||
],
|
||||
"autoGenerate": true
|
||||
]
|
||||
},
|
||||
"indices": [
|
||||
{
|
||||
@@ -172,10 +172,10 @@
|
||||
}
|
||||
],
|
||||
"primaryKey": {
|
||||
"autoGenerate": true,
|
||||
"columnNames": [
|
||||
"griglia_id"
|
||||
],
|
||||
"autoGenerate": true
|
||||
]
|
||||
},
|
||||
"indices": [
|
||||
{
|
||||
@@ -262,10 +262,10 @@
|
||||
}
|
||||
],
|
||||
"primaryKey": {
|
||||
"autoGenerate": true,
|
||||
"columnNames": [
|
||||
"ordine_id"
|
||||
],
|
||||
"autoGenerate": true
|
||||
]
|
||||
},
|
||||
"indices": [],
|
||||
"foreignKeys": []
|
||||
@@ -366,10 +366,10 @@
|
||||
}
|
||||
],
|
||||
"primaryKey": {
|
||||
"autoGenerate": true,
|
||||
"columnNames": [
|
||||
"articolo_ordine_id"
|
||||
],
|
||||
"autoGenerate": true
|
||||
]
|
||||
},
|
||||
"indices": [
|
||||
{
|
||||
@@ -580,10 +580,10 @@
|
||||
}
|
||||
],
|
||||
"primaryKey": {
|
||||
"autoGenerate": true,
|
||||
"columnNames": [
|
||||
"id"
|
||||
],
|
||||
"autoGenerate": true
|
||||
]
|
||||
},
|
||||
"indices": [
|
||||
{
|
||||
@@ -829,10 +829,10 @@
|
||||
}
|
||||
],
|
||||
"primaryKey": {
|
||||
"autoGenerate": true,
|
||||
"columnNames": [
|
||||
"id"
|
||||
],
|
||||
"autoGenerate": true
|
||||
]
|
||||
},
|
||||
"indices": [
|
||||
{
|
||||
@@ -874,7 +874,7 @@
|
||||
},
|
||||
{
|
||||
"tableName": "inventari",
|
||||
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`_id` INTEGER PRIMARY KEY AUTOINCREMENT, `id_inventario` INTEGER, `cod_mdep` TEXT NOT NULL, `data_inventario` INTEGER, `data_reg` INTEGER, `data_ver` INTEGER, `filtro` TEXT, `flag_stato` TEXT, `flag_operazione` TEXT, `cod_anag` TEXT, `cod_dtip` TEXT, `inserito_da` TEXT, `registrato_da` TEXT, `verificato_da` TEXT, `data_ora_inizio` INTEGER, `data_ora_fine` INTEGER, `causale` TEXT, `zona` TEXT, `remote_sync_date` INTEGER)",
|
||||
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`_id` INTEGER PRIMARY KEY AUTOINCREMENT, `id_inventario` INTEGER, `cod_mdep` TEXT NOT NULL, `data_inventario` INTEGER, `data_reg` INTEGER, `data_ver` INTEGER, `filtro` TEXT, `flag_stato` TEXT, `flag_operazione` TEXT, `cod_anag` TEXT, `cod_dtip` TEXT, `inserito_da` TEXT, `registrato_da` TEXT, `verificato_da` TEXT, `data_ora_inizio` INTEGER, `data_ora_fine` INTEGER, `causale` TEXT, `zona` TEXT, `new` INTEGER, `remote_sync_date` INTEGER)",
|
||||
"fields": [
|
||||
{
|
||||
"fieldPath": "id",
|
||||
@@ -984,6 +984,12 @@
|
||||
"affinity": "TEXT",
|
||||
"notNull": false
|
||||
},
|
||||
{
|
||||
"fieldPath": "isNew",
|
||||
"columnName": "new",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": false
|
||||
},
|
||||
{
|
||||
"fieldPath": "remoteSyncDate",
|
||||
"columnName": "remote_sync_date",
|
||||
@@ -992,10 +998,10 @@
|
||||
}
|
||||
],
|
||||
"primaryKey": {
|
||||
"autoGenerate": true,
|
||||
"columnNames": [
|
||||
"_id"
|
||||
],
|
||||
"autoGenerate": true
|
||||
]
|
||||
},
|
||||
"indices": [
|
||||
{
|
||||
@@ -1107,10 +1113,10 @@
|
||||
}
|
||||
],
|
||||
"primaryKey": {
|
||||
"autoGenerate": true,
|
||||
"columnNames": [
|
||||
"_id"
|
||||
],
|
||||
"autoGenerate": true
|
||||
]
|
||||
},
|
||||
"indices": [
|
||||
{
|
||||
@@ -1150,7 +1156,7 @@
|
||||
"views": [],
|
||||
"setupQueries": [
|
||||
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
|
||||
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'bc3841159bac7a7731fe39a5fa4f0f4e')"
|
||||
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'bef89b513f0a4d5ecd9c2111e2e614a4')"
|
||||
]
|
||||
}
|
||||
}
|
||||
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"
|
||||
|
||||
@@ -3,11 +3,13 @@ package it.integry.integrywmsnative;
|
||||
import android.app.Application;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.util.Log;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import it.integry.integrywmsnative.core.context.AppContext;
|
||||
import it.integry.integrywmsnative.core.data_store.db.RoomModule;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityLogger;
|
||||
|
||||
|
||||
public class MainApplication extends Application {
|
||||
@@ -19,6 +21,8 @@ public class MainApplication extends Application {
|
||||
public static MainApplicationModule appModule;
|
||||
public static RoomModule roomModule;
|
||||
|
||||
private Thread.UncaughtExceptionHandler defaultUncaughtExceptionHandler;
|
||||
|
||||
@Inject
|
||||
AppContext appContext;
|
||||
|
||||
@@ -40,6 +44,9 @@ public class MainApplication extends Application {
|
||||
appComponent.inject(this);
|
||||
|
||||
res = getResources();
|
||||
|
||||
defaultUncaughtExceptionHandler = Thread.getDefaultUncaughtExceptionHandler();
|
||||
Thread.setDefaultUncaughtExceptionHandler(_unCaughtExceptionHandler);
|
||||
}
|
||||
|
||||
// Called by the system when the device configuration changes while your component is running.
|
||||
@@ -61,4 +68,22 @@ public class MainApplication extends Application {
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
|
||||
// handler listener
|
||||
private 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);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -74,6 +74,8 @@ import it.integry.integrywmsnative.gest.pv_ordini_acquisto.PVOrdiniAcquistoGrigl
|
||||
import it.integry.integrywmsnative.gest.pv_ordini_acquisto.dialogs.DialogScanGrigliaAcquistoComponent;
|
||||
import it.integry.integrywmsnative.gest.rettifica_giacenze.RettificaGiacenzeComponent;
|
||||
import it.integry.integrywmsnative.gest.rettifica_giacenze.RettificaGiacenzeModule;
|
||||
import it.integry.integrywmsnative.gest.settings.MainSettingsComponent;
|
||||
import it.integry.integrywmsnative.gest.settings.MainSettingsModule;
|
||||
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;
|
||||
@@ -169,6 +171,7 @@ import it.integry.integrywmsnative.view.dialogs.scan_or_create_lu.DialogScanOrCr
|
||||
BottomSheetInventarioRowActionsModule.class,
|
||||
BottomSheetMtbColrEditModalModule.class,
|
||||
DialogChooseArtsFromMtbAartListModule.class,
|
||||
MainSettingsModule.class,
|
||||
|
||||
})
|
||||
public interface MainApplicationComponent {
|
||||
@@ -251,7 +254,7 @@ public interface MainApplicationComponent {
|
||||
|
||||
DocInterniComponent.Factory docInterniComponent();
|
||||
|
||||
DialogSelectDocInfoComponent.Factory dialogSelectMgrpDtipPairComponent();
|
||||
DialogSelectDocInfoComponent.Factory dialogSelectDocInfoNewViewComponent();
|
||||
|
||||
DialogSelectDocRowsComponent.Factory dialogSelectDocRowsComponent();
|
||||
|
||||
@@ -285,6 +288,8 @@ public interface MainApplicationComponent {
|
||||
|
||||
DialogChooseArtsFromMtbAartListComponent.Factory dialogDialogDialogChooseArtsFromMtbAartListViewComponent();
|
||||
|
||||
MainSettingsComponent.Factory mainSettingsFragmentComponent();
|
||||
|
||||
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;
|
||||
@@ -253,8 +253,8 @@ public class MainApplicationModule {
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
DocumentiRESTConsumer provideDocumentiRESTConsumer() {
|
||||
return new DocumentiRESTConsumer();
|
||||
DocumentRESTConsumer provideDocumentiRESTConsumer() {
|
||||
return new DocumentRESTConsumer();
|
||||
}
|
||||
|
||||
@Provides
|
||||
|
||||
@@ -5,8 +5,9 @@ public class CommonConst {
|
||||
public static class Login {
|
||||
|
||||
public static class Azienda {
|
||||
public static String protocol = "https";
|
||||
public static String host = "www2.studioml.it";
|
||||
public static int port = 80;
|
||||
public static int port = 443;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
package it.integry.integrywmsnative.core.class_router;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import it.integry.integrywmsnative.core.class_router.interfaces.ICustomConfiguration;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityHashMap;
|
||||
|
||||
public class BaseCustomConfiguration implements ICustomConfiguration {
|
||||
|
||||
|
||||
public static class Keys {
|
||||
public static int FLAG_SHOW_COD_FORN_IN_SPEDIZIONE = 1;
|
||||
public static int CUSTOM_DYNAMIC_VERSION_PATH = 2;
|
||||
public static int FLAG_SPEDIZIONE_GROUP_BY_GRP_MERC = 3;
|
||||
}
|
||||
|
||||
protected HashMap<Integer, Object> configurations = new HashMap<>() {{
|
||||
put(Keys.FLAG_SHOW_COD_FORN_IN_SPEDIZIONE, true);
|
||||
put(Keys.FLAG_SPEDIZIONE_GROUP_BY_GRP_MERC, false);
|
||||
}};
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public <T> T getConfig(int key) {
|
||||
return UtilityHashMap.getValue(configurations, key);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,84 +0,0 @@
|
||||
package it.integry.integrywmsnative.core.class_router;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Pair;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ClassRouter {
|
||||
|
||||
public enum PATH {
|
||||
FILTRO_ORDINI_VENDITA,
|
||||
ORDINI_VENDITA,
|
||||
CUSTOM_CONFIGURATION,
|
||||
BARCODE_CUSTOMIZATION
|
||||
}
|
||||
|
||||
private static Context context;
|
||||
|
||||
private static List<Pair<PATH, Object>> mRouteClasses = new ArrayList<>();
|
||||
|
||||
public static void init() {
|
||||
// ClassRouter.context = context;
|
||||
}
|
||||
|
||||
private static boolean checkIClassExists(PATH path) {
|
||||
boolean methodAlreadyDeclared = false;
|
||||
|
||||
for(int i = 0; i < mRouteClasses.size() && !methodAlreadyDeclared; i++) {
|
||||
if(mRouteClasses.get(i).first == path) methodAlreadyDeclared = true;
|
||||
}
|
||||
|
||||
return methodAlreadyDeclared;
|
||||
}
|
||||
|
||||
|
||||
private static int getClassIndex(PATH path) {
|
||||
for(int i = 0; i < mRouteClasses.size(); i++) {
|
||||
if(mRouteClasses.get(i).first == path) return i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static void registerPath(PATH path, Class clazz) {
|
||||
if(checkIClassExists(path)) {
|
||||
//throw new MethodPathAlreadyDeclaredException(path);
|
||||
}
|
||||
|
||||
try {
|
||||
mRouteClasses.add(new Pair<>(path, clazz.newInstance()));
|
||||
} catch (IllegalAccessException | InstantiationException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void deregisterPath(PATH path) {
|
||||
if(checkIClassExists(path)) {
|
||||
mRouteClasses.remove(getClassIndex(path));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static <T> T getInstance(PATH path) {
|
||||
try {
|
||||
|
||||
if (!checkIClassExists(path)) {
|
||||
// throw new MethodPathNotRegisteredException(path);
|
||||
}
|
||||
|
||||
Object instance = mRouteClasses.get(getClassIndex(path)).second;
|
||||
|
||||
return (T)instance;
|
||||
|
||||
} catch (Exception ex) {
|
||||
// UtilityExceptions.defaultException(null, ex, true);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -57,9 +57,17 @@ 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)
|
||||
.setDrawerIcon(R.drawable.ic_upload)
|
||||
.setFragmentFactory(() -> OrdiniUscitaElencoFragment.newInstance(GestioneEnum.VENDITA, null, -1, null)))
|
||||
|
||||
.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)
|
||||
.setCodMenu("MG047")
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
package it.integry.integrywmsnative.core.class_router.exceptions;
|
||||
|
||||
import it.integry.integrywmsnative.core.class_router.ClassRouter;
|
||||
|
||||
public class MethodPathNotRegisteredException extends Exception {
|
||||
|
||||
public MethodPathNotRegisteredException(ClassRouter.PATH path) {
|
||||
super(String.format("Path %s is not registered", path.toString()));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package it.integry.integrywmsnative.core.class_router.interfaces;
|
||||
|
||||
public interface IBarcodeCustomization {
|
||||
|
||||
boolean shouldForceToEan13(String barcode);
|
||||
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package it.integry.integrywmsnative.core.class_router.interfaces;
|
||||
|
||||
public interface ICustomConfiguration {
|
||||
|
||||
<T>T getConfig(int key);
|
||||
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package it.integry.integrywmsnative.core.class_router.interfaces;
|
||||
|
||||
public interface IFiltroOrdiniVendita {
|
||||
|
||||
boolean shoudShowCodMdepFilter();
|
||||
|
||||
boolean shoudShowIdViaggioFilter();
|
||||
|
||||
boolean shoudShowAgenteFilter();
|
||||
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package it.integry.integrywmsnative.core.class_router.interfaces;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.rest.model.OrdineUscitaInevasoDTO;
|
||||
|
||||
public interface OrdiniVenditaInterface {
|
||||
|
||||
boolean isTrasfOrder(List<OrdineUscitaInevasoDTO> testateOrdini);
|
||||
|
||||
}
|
||||
@@ -34,6 +34,8 @@ public class AppContext {
|
||||
@Inject
|
||||
SettingsManager mSettingsManager;
|
||||
|
||||
private File logsFolder;
|
||||
|
||||
public AppContext(Context context) {
|
||||
this.mApplicationContext = context;
|
||||
|
||||
@@ -53,6 +55,10 @@ public class AppContext {
|
||||
this.initLogger();
|
||||
}
|
||||
|
||||
public File getLogFilePath() {
|
||||
return logsFolder;
|
||||
}
|
||||
|
||||
|
||||
private void initSettings() {
|
||||
Stash.init(mApplicationContext);
|
||||
@@ -82,10 +88,9 @@ public class AppContext {
|
||||
private void initLogger() {
|
||||
Logger.addLogAdapter(new AndroidLogAdapter());
|
||||
|
||||
File logsFolder = new File(mApplicationContext.getExternalFilesDir(null).getAbsolutePath());
|
||||
logsFolder = new File(mApplicationContext.getExternalFilesDir(null).getAbsolutePath());
|
||||
int maxBytesSize = 5 * 1024 * 1024;
|
||||
Logger.addLogAdapter(new DiskLogAdapter(logsFolder, maxBytesSize));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,13 +6,11 @@ import android.text.SpannableString;
|
||||
import android.text.Spanned;
|
||||
import android.text.SpannedString;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.ConnectException;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
||||
import it.integry.integrywmsnative.core.class_router.ClassRouter;
|
||||
import it.integry.integrywmsnative.core.data_store.db.AppDatabase;
|
||||
import it.integry.integrywmsnative.core.menu.MenuService;
|
||||
import it.integry.integrywmsnative.core.rest.watcher.ServerStatusChecker;
|
||||
@@ -44,8 +42,7 @@ public class MainContext {
|
||||
|
||||
this.initDBData(() -> {
|
||||
this.initMenu(() -> {
|
||||
|
||||
this.initReflections();
|
||||
|
||||
if (mListener != null) mListener.onContextInitialized();
|
||||
});
|
||||
});
|
||||
@@ -103,30 +100,6 @@ public class MainContext {
|
||||
});
|
||||
}
|
||||
|
||||
private void initReflections() {
|
||||
ClassRouter.init();
|
||||
|
||||
try {
|
||||
String initMethod = "init";
|
||||
|
||||
Class dynamicContextClass = Class.forName("it.integry.wms.dynamic_customization.DynamicContext");
|
||||
|
||||
Method[] methods = dynamicContextClass.getMethods();
|
||||
for (Method m : methods) {
|
||||
if (initMethod.equals(m.getName())) {
|
||||
// for static methods we can use null as instance of class
|
||||
final Object newInstance = dynamicContextClass.newInstance();
|
||||
|
||||
m.invoke(newInstance, applicationContext);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
// UtilityExceptions.defaultException(mContext, e, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public MainContext setListener(Listener listener) {
|
||||
this.mListener = listener;
|
||||
|
||||
@@ -40,7 +40,7 @@ import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColt;
|
||||
InventarioRoomDTO.class,
|
||||
InventarioRowRoomDTO.class
|
||||
},
|
||||
version = 13,
|
||||
version = 14,
|
||||
exportSchema = true)
|
||||
@TypeConverters({
|
||||
DateConverter.class,
|
||||
@@ -66,7 +66,8 @@ public abstract class AppDatabase extends RoomDatabase {
|
||||
AppDatabase.class, "integry_wms")
|
||||
.addMigrations(MIGRATION_10_11)
|
||||
.addMigrations(MIGRATION_11_12)
|
||||
.addMigrations(MIGRATION_12_13);
|
||||
.addMigrations(MIGRATION_12_13)
|
||||
.addMigrations(MIGRATION_13_14);
|
||||
|
||||
sInstance = builder.build();
|
||||
}
|
||||
@@ -126,4 +127,12 @@ public abstract class AppDatabase extends RoomDatabase {
|
||||
database.execSQL("CREATE INDEX IF NOT EXISTS index_inventario_rows__parent_id ON inventario_rows (parent_id)");
|
||||
}
|
||||
};
|
||||
|
||||
static final Migration MIGRATION_13_14 = new Migration(13, 14) {
|
||||
@Override
|
||||
public void migrate(@NonNull SupportSQLiteDatabase database) {
|
||||
database.execSQL("ALTER TABLE inventari"
|
||||
+ " ADD COLUMN new INTEGER");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -184,7 +184,7 @@ public class RoomModule {
|
||||
InventarioLocalDataSource inventarioLocalDataSource,
|
||||
InventarioRESTConsumer inventarioRESTConsumer,
|
||||
InventarioMapper inventarioMapper) {
|
||||
return new InventarioRepository(inventarioLocalDataSource, inventarioRESTConsumer, inventarioMapper, handler);
|
||||
return new InventarioRepository(inventarioLocalDataSource, inventarioRESTConsumer, inventarioMapper, handler, executorService);
|
||||
}
|
||||
|
||||
@Singleton
|
||||
|
||||
@@ -35,6 +35,7 @@ public class InventarioRoomDTO extends BaseSyncDTO implements EntityModelInterfa
|
||||
public static final String DATA_ORA_FINE = "data_ora_fine";
|
||||
public static final String CAUSALE = "causale";
|
||||
public static final String ZONA = "zona";
|
||||
public static final String IS_NEW = "new";
|
||||
}
|
||||
|
||||
/** The unique ID of the cheese. */
|
||||
@@ -95,6 +96,9 @@ public class InventarioRoomDTO extends BaseSyncDTO implements EntityModelInterfa
|
||||
@ColumnInfo(name = Columns.ZONA)
|
||||
private String zona;
|
||||
|
||||
@ColumnInfo(name = Columns.IS_NEW)
|
||||
private Boolean isNew = Boolean.TRUE;
|
||||
|
||||
@Ignore
|
||||
private List<InventarioRowRoomDTO> inventarioRowList;
|
||||
|
||||
@@ -235,6 +239,14 @@ public class InventarioRoomDTO extends BaseSyncDTO implements EntityModelInterfa
|
||||
this.zona = zona;
|
||||
}
|
||||
|
||||
public Boolean isNew() {
|
||||
return isNew;
|
||||
}
|
||||
|
||||
public void setNew(Boolean aNew) {
|
||||
isNew = aNew;
|
||||
}
|
||||
|
||||
public List<InventarioRowRoomDTO> getInventarioRowList() {
|
||||
return inventarioRowList;
|
||||
}
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
package it.integry.integrywmsnative.core.data_store.db.respository_new;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
@@ -17,9 +21,12 @@ import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.mapper.InventarioMapper;
|
||||
import it.integry.integrywmsnative.core.model.MtbInvent;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.InventarioRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityLiveData;
|
||||
|
||||
public class InventarioRepository extends _BaseRepository<MtbInvent, InventarioRoomDTO, InventarioMapper, InventarioLocalDataSource, InventarioRESTConsumer> {
|
||||
|
||||
private final ExecutorService executorService;
|
||||
|
||||
private final Handler handler;
|
||||
|
||||
private final MutableLiveData<List<InventarioRoomDTO>> internalLiveData = new MutableLiveData<>();
|
||||
@@ -28,22 +35,50 @@ public class InventarioRepository extends _BaseRepository<MtbInvent, InventarioR
|
||||
public InventarioRepository(InventarioLocalDataSource localDataSource,
|
||||
InventarioRESTConsumer remoteDataSource,
|
||||
InventarioMapper dataMapper,
|
||||
Handler handler) {
|
||||
Handler handler,
|
||||
ExecutorService executorService) {
|
||||
super(dataMapper, localDataSource, remoteDataSource);
|
||||
this.handler = handler;
|
||||
this.executorService = executorService;
|
||||
}
|
||||
|
||||
|
||||
public LiveData<List<InventarioRoomDTO>> retrieve() {
|
||||
public LiveData<List<InventarioRoomDTO>> retrieve(Runnable onComplete, RunnableArgs<Exception> onError) {
|
||||
localDataSource.makeSynchronousRetrieveAllLive(false)
|
||||
.observeOn(Schedulers.io())
|
||||
.subscribe(internalLiveData::postValue);
|
||||
// refresh(onComplete, onError);
|
||||
|
||||
UtilityLiveData.observeOnce(internalLiveData, inventories -> {
|
||||
refresh(onComplete, onError);
|
||||
});
|
||||
|
||||
|
||||
return internalLiveData;
|
||||
}
|
||||
|
||||
|
||||
public void refresh(Runnable onComplete, RunnableArgs<Exception> onError) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
var startRetrieve = new Date();
|
||||
var remoteData = remoteDataSource.makeSynchronousRetrieveRequest();
|
||||
Log.d("Timing [INVENTORIES RETRIEVE]", ((new Date().getTime() - startRetrieve.getTime()) / 1000) + " secs");
|
||||
|
||||
if (remoteData == null) remoteData = new ArrayList<>();
|
||||
|
||||
resolveFetch(remoteData, internalLiveData.getValue(),
|
||||
(remoteItem, localItem) -> Objects.equals(remoteItem.getIdInventario(), localItem.getIdInventario()),
|
||||
(remoteItem, localItem) -> {
|
||||
remoteItem.setRemoteSyncDate(localItem.getRemoteSyncDate());
|
||||
remoteItem.setNew(false);
|
||||
}, onComplete, onError);
|
||||
|
||||
} catch (Exception e) {
|
||||
onError.run(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void insert(InventarioRoomDTO inventarioDTO, Runnable onComplete, RunnableArgs<Exception> onError) {
|
||||
localDataSource.makeInsertRequest(inventarioDTO, localResult -> {
|
||||
if (onComplete != null) handler.post(onComplete);
|
||||
@@ -60,7 +95,7 @@ public class InventarioRepository extends _BaseRepository<MtbInvent, InventarioR
|
||||
}, onError);
|
||||
}
|
||||
|
||||
public void delete(InventarioRoomDTO inventarioDTO, Runnable onComplete, RunnableArgs<Exception> onError){
|
||||
public void delete(InventarioRoomDTO inventarioDTO, Runnable onComplete, RunnableArgs<Exception> onError) {
|
||||
localDataSource.makeDeleteRequest(inventarioDTO, onComplete, onError);
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -1,74 +0,0 @@
|
||||
package it.integry.integrywmsnative.core.exception;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Environment;
|
||||
import android.os.Looper;
|
||||
import android.util.Log;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
import it.integry.integrywmsnative.MainApplication;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityLogger;
|
||||
import it.integry.integrywmsnative.view.dialogs.exception.DialogException;
|
||||
|
||||
public class ExceptionsHandler implements Thread.UncaughtExceptionHandler {
|
||||
|
||||
private final static String TAG = ExceptionsHandler.class.getSimpleName();
|
||||
|
||||
private final Activity context;
|
||||
|
||||
public static void init(Activity context) {
|
||||
new ExceptionsHandler(context);
|
||||
}
|
||||
|
||||
private ExceptionsHandler(Activity context) {
|
||||
this.context = context;
|
||||
|
||||
//if (!BuildConfig.DEBUG) {
|
||||
Thread.setDefaultUncaughtExceptionHandler(this);
|
||||
|
||||
|
||||
//}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uncaughtException(final Thread thread, final Throwable ex) {
|
||||
try {
|
||||
UtilityLogger.error(new Exception(ex));
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "Exception Logger failed!", e);
|
||||
MainApplication.exit();
|
||||
}
|
||||
|
||||
appendToFile(new Exception(ex));
|
||||
new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
Looper.prepare();
|
||||
DialogException.make(context, context::finish).show();
|
||||
Looper.loop();
|
||||
}
|
||||
}.start();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void appendToFile(Exception e) {
|
||||
try {
|
||||
File yourFile = new File(Environment.getExternalStorageDirectory(), "log.txt");
|
||||
|
||||
FileWriter fstream = new FileWriter(yourFile.getPath(), true);
|
||||
BufferedWriter out = new BufferedWriter(fstream);
|
||||
PrintWriter pWriter = new PrintWriter(out, true);
|
||||
e.printStackTrace(pWriter);
|
||||
}
|
||||
catch (Exception ie) {
|
||||
throw new RuntimeException("Could not write Exception to file", ie);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,9 +19,7 @@ public class MenuRESTConsumer extends _BaseRESTConsumer {
|
||||
menuRESTConsumerService.retrieveMenuConfig(rootCodOpz).enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<StbMenu>> call, Response<ServiceRESTResponse<StbMenu>> response) {
|
||||
analyzeAnswer(response, "retrieveMenu", (m) -> {
|
||||
onComplete.run(response.body().getEntity());
|
||||
}, onFailed);
|
||||
analyzeAnswer(response, "retrieveMenu", onComplete, onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,15 +1,19 @@
|
||||
package it.integry.integrywmsnative.core.rest;
|
||||
|
||||
import android.os.Build;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.security.KeyManagementException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.net.ssl.SSLContext;
|
||||
import javax.net.ssl.TrustManager;
|
||||
import javax.net.ssl.X509TrustManager;
|
||||
|
||||
import it.integry.integrywmsnative.core.rest.deserializer.LocalDateDeserializer;
|
||||
import it.integry.integrywmsnative.core.rest.deserializer.LocalDateTimeDeserializer;
|
||||
import it.integry.integrywmsnative.core.rest.serializer.LocalDateSerializer;
|
||||
@@ -28,25 +32,25 @@ public class RESTBuilder {
|
||||
private static final boolean ADD_LOGGER_INTERCEPTOR = false;
|
||||
|
||||
public static <T> T getService(final Class<T> service) {
|
||||
return getService(service, SettingsManager.i().getServer().getHost(), SettingsManager.i().getServer().getPort(), true);
|
||||
return getService(service, SettingsManager.i().getServer().getProtocol(), SettingsManager.i().getServer().getHost(), SettingsManager.i().getServer().getPort(), true);
|
||||
|
||||
}
|
||||
|
||||
public static <T> T getService(final Class<T> service, int timeout) {
|
||||
return getService(service, SettingsManager.i().getServer().getHost(), SettingsManager.i().getServer().getPort(), true, true, timeout);
|
||||
return getService(service, SettingsManager.i().getServer().getProtocol(), SettingsManager.i().getServer().getHost(), SettingsManager.i().getServer().getPort(), true, true, timeout);
|
||||
|
||||
}
|
||||
|
||||
public static <T> T getService(final Class<T> service, String host, int port, boolean addInterceptors) {
|
||||
return getService(service, host, port, addInterceptors, true, 60);
|
||||
public static <T> T getService(final Class<T> service, String protocol, String host, int port, boolean addInterceptors) {
|
||||
return getService(service, protocol, host, port, addInterceptors, true, 60);
|
||||
}
|
||||
|
||||
public static <T> T getService(final Class<T> service, String host, int port, boolean addInterceptors, boolean addEmsApi) {
|
||||
return getService(service, host, port, addInterceptors, addEmsApi, 60);
|
||||
public static <T> T getService(final Class<T> service, String protocol, String host, int port, boolean addInterceptors, boolean addEmsApi) {
|
||||
return getService(service, protocol, host, port, addInterceptors, addEmsApi, 60);
|
||||
}
|
||||
|
||||
public static <T> T getService(final Class<T> service, String host, int port, boolean addInterceptors, boolean addEmsApi, int timeout) {
|
||||
OkHttpClient.Builder clientBuilder = new OkHttpClient.Builder();
|
||||
public static <T> T getService(final Class<T> service, String protocol, String host, int port, boolean addInterceptors, boolean addEmsApi, int timeout) {
|
||||
OkHttpClient.Builder clientBuilder = getDefaultHttpClient();
|
||||
|
||||
clientBuilder.connectTimeout(timeout, TimeUnit.SECONDS);
|
||||
clientBuilder.readTimeout(timeout, TimeUnit.SECONDS);
|
||||
@@ -59,14 +63,17 @@ public class RESTBuilder {
|
||||
|
||||
OkHttpClient client = clientBuilder.build();
|
||||
|
||||
String endpoint = "http://" + host + ":" + port + "/" + (addEmsApi ? "ems-api/" : "");
|
||||
String endpoint = protocol + "://" + host + ":" + port + "/" + (addEmsApi ? "ems-api/" : "");
|
||||
|
||||
|
||||
GsonBuilder builder = new GsonBuilder().setDateFormat("dd/MM/yyyy HH:mm:ss").excludeFieldsWithModifiers(Modifier.TRANSIENT);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
builder.registerTypeAdapter(LocalDate.class, new LocalDateDeserializer()).registerTypeAdapter(LocalDate.class, new LocalDateSerializer()).registerTypeAdapter(LocalDateTime.class, new LocalDateTimeDeserializer()).registerTypeAdapter(LocalDateTime.class, new LocalDateTimeSerializer());
|
||||
}
|
||||
Gson gson = builder.create();
|
||||
Gson gson = new GsonBuilder()
|
||||
.setDateFormat("dd/MM/yyyy HH:mm:ss")
|
||||
.excludeFieldsWithModifiers(Modifier.TRANSIENT)
|
||||
.registerTypeAdapter(LocalDate.class, new LocalDateDeserializer())
|
||||
.registerTypeAdapter(LocalDate.class, new LocalDateSerializer())
|
||||
.registerTypeAdapter(LocalDateTime.class, new LocalDateTimeDeserializer())
|
||||
.registerTypeAdapter(LocalDateTime.class, new LocalDateTimeSerializer())
|
||||
.create();
|
||||
|
||||
Retrofit retrofit = new Retrofit.Builder().addConverterFactory(GsonConverterFactory.create(gson)).baseUrl(endpoint).client(client).build();
|
||||
|
||||
@@ -81,4 +88,39 @@ public class RESTBuilder {
|
||||
public static int getDefaultPort() {
|
||||
return SettingsManager.i().getServer().getPort();
|
||||
}
|
||||
|
||||
|
||||
public static OkHttpClient.Builder getDefaultHttpClient() {
|
||||
TrustManager[] trustAllCerts = new TrustManager[]{
|
||||
new X509TrustManager() {
|
||||
@Override
|
||||
public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkServerTrusted(java.security.cert.X509Certificate[] chain, String authType) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
|
||||
return new java.security.cert.X509Certificate[]{};
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
SSLContext sslContext = null;
|
||||
try {
|
||||
sslContext = SSLContext.getInstance("SSL");
|
||||
sslContext.init(null, trustAllCerts, new java.security.SecureRandom());
|
||||
} catch (KeyManagementException | NoSuchAlgorithmException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
|
||||
OkHttpClient.Builder client = new OkHttpClient.Builder()
|
||||
.sslSocketFactory(sslContext.getSocketFactory(), (X509TrustManager) trustAllCerts[0])
|
||||
.hostnameVerifier((hostname, session) -> true);
|
||||
|
||||
return client;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,6 @@ package it.integry.integrywmsnative.core.rest.consumers;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
||||
import it.integry.integrywmsnative.core.class_router.ClassRouter;
|
||||
import it.integry.integrywmsnative.core.class_router.interfaces.IBarcodeCustomization;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||
import it.integry.integrywmsnative.core.rest.model.Ean128Model;
|
||||
@@ -18,15 +16,6 @@ public class BarcodeRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
public void decodeEan128(BarcodeScanDTO barcodeObj, RunnableArgs<Ean128Model> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
IBarcodeCustomization barcodeCustomization = ClassRouter.getInstance(ClassRouter.PATH.BARCODE_CUSTOMIZATION);
|
||||
|
||||
if (barcodeCustomization != null && barcodeCustomization.shouldForceToEan13(barcodeObj.getStringValue())) {
|
||||
Ean128Model ean128Model = new Ean128Model();
|
||||
ean128Model.Gtin = barcodeObj.getStringValue();
|
||||
onComplete.run(ean128Model);
|
||||
return;
|
||||
}
|
||||
|
||||
String ean128 = barcodeObj.getStringValue().replaceAll("" + ((char) 29), "|");
|
||||
|
||||
BarcodeRESTConsumerService barcodeRESTConsumerService = RESTBuilder.getService(BarcodeRESTConsumerService.class);
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
package it.integry.integrywmsnative.core.rest.consumers;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.rest.model.DistribuzioneColloDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.RettificaULDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.core.rest.model.SpostaArtsTraULRequestDTO;
|
||||
@@ -19,9 +16,6 @@ import retrofit2.http.Query;
|
||||
|
||||
public interface ColliMagazzinoRESTConsumerService {
|
||||
|
||||
@POST("wms/distribuzioneRigheCollo")
|
||||
Call<ServiceRESTResponse<JsonObject>> distribuisciCollo(@Body DistribuzioneColloDTO distribuzioneCollo);
|
||||
|
||||
@POST("getColloByBarcode")
|
||||
Call<ServiceRESTResponse<MtbColt>> getColloByBarcode(@Query("codBarreCollo") String sscc, @Query("onlyResiduo") boolean onlyResiduo, @Query("throwExcIfNull") boolean throwExcIfNull);
|
||||
|
||||
|
||||
@@ -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 loadDocumentoAvailableArts(String codDtip, String codMgrp, RunnableArgs<RetrieveDocumentoArtsResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
var inventarioRESTConsumerService = RESTBuilder.getService(DocumentiRESTConsumerService.class);
|
||||
inventarioRESTConsumerService.retrieveArts(codDtip, codMgrp)
|
||||
.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,12 @@ 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);
|
||||
|
||||
}
|
||||
|
||||
@@ -20,12 +20,10 @@ import retrofit2.Response;
|
||||
public class GestSetupRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
public void getValue(String gestName, String sectionName, String keySection, RunnableArgs<GestSetupDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
getValueStatic(gestName, sectionName, keySection, onComplete, onFailed);
|
||||
}
|
||||
|
||||
public static void getValueStatic(String gestName, String sectionName, String keySection, RunnableArgs<GestSetupDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
GestSetupRESTConsumerService service = RESTBuilder.getService(GestSetupRESTConsumerService.class);
|
||||
service.getGestSetupValue(gestName, sectionName, keySection).enqueue(new Callback<ServiceRESTResponse<GestSetupDTO>>() {
|
||||
|
||||
service.getGestSetupValue(gestName, sectionName, keySection)
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<GestSetupDTO>> call, Response<ServiceRESTResponse<GestSetupDTO>> response) {
|
||||
analyzeAnswer(response, "GestSetup", onComplete, onFailed);
|
||||
@@ -40,8 +38,8 @@ public class GestSetupRESTConsumer extends _BaseRESTConsumer {
|
||||
});
|
||||
}
|
||||
|
||||
public static void getBooleanValue(String gestName, String sectionName, String keySection, RunnableArgs<Boolean> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
getValueStatic(gestName, sectionName, keySection, value -> {
|
||||
public void getBooleanValue(String gestName, String sectionName, String keySection, RunnableArgs<Boolean> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
getValue(gestName, sectionName, keySection, value -> {
|
||||
if (value != null) {
|
||||
onComplete.run("S".equalsIgnoreCase(value.value));
|
||||
} else onComplete.run(false);
|
||||
@@ -50,7 +48,7 @@ public class GestSetupRESTConsumer extends _BaseRESTConsumer {
|
||||
});
|
||||
}
|
||||
|
||||
public static void getValueStatic(String gestName, String sectionName, String keySection, String codMdep, RunnableArgs<GestSetupDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public void getValue(String gestName, String sectionName, String keySection, String codMdep, RunnableArgs<GestSetupDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
GestSetupRESTConsumerService service = RESTBuilder.getService(GestSetupRESTConsumerService.class);
|
||||
service.getGestSetupValue(gestName, sectionName, keySection, codMdep).enqueue(new Callback<ServiceRESTResponse<GestSetupDTO>>() {
|
||||
@Override
|
||||
@@ -67,8 +65,8 @@ public class GestSetupRESTConsumer extends _BaseRESTConsumer {
|
||||
});
|
||||
}
|
||||
|
||||
public static void getBooleanValue(String gestName, String sectionName, String keySection, String codMdep, RunnableArgs<Boolean> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
getValueStatic(gestName, sectionName, keySection, codMdep, value -> {
|
||||
public void getBooleanValue(String gestName, String sectionName, String keySection, String codMdep, RunnableArgs<Boolean> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
getValue(gestName, sectionName, keySection, codMdep, value -> {
|
||||
if (value != null) {
|
||||
onComplete.run("S".equalsIgnoreCase(value.value));
|
||||
} else onComplete.run(false);
|
||||
|
||||
@@ -10,8 +10,17 @@ 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);
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@ package it.integry.integrywmsnative.core.rest.consumers;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
@@ -42,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
|
||||
@@ -52,6 +54,17 @@ public class InventarioRESTConsumer extends _BaseRESTConsumer {
|
||||
});
|
||||
}
|
||||
|
||||
public List<MtbInvent> makeSynchronousRetrieveRequest() throws Exception {
|
||||
var inventarioRESTConsumerService = RESTBuilder.getService(InventarioRESTConsumerService.class, 120);
|
||||
|
||||
var response = inventarioRESTConsumerService.retrieve()
|
||||
.execute();
|
||||
|
||||
var data = analyzeAnswer(response, "retrieveInventario");
|
||||
if (data == null) return null;
|
||||
return data.getInventories();
|
||||
}
|
||||
|
||||
|
||||
public void makeInsertRequest(MtbInvent inventarioToInsert, final Runnable onComplete, final RunnableArgs<Exception> onFailed) {
|
||||
var request = new InsertInventarioRequestDTO()
|
||||
@@ -59,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));
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package it.integry.integrywmsnative.core.rest.consumers;
|
||||
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.core.rest.model.inventario.InsertInventarioRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.inventario.RetrieveInventariResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.inventario.RetrieveInventarioArtsResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.inventario.RetrieveInventarioResponseDTO;
|
||||
import retrofit2.Call;
|
||||
@@ -12,6 +13,9 @@ import retrofit2.http.Path;
|
||||
|
||||
public interface InventarioRESTConsumerService {
|
||||
|
||||
@GET("wms/inventario/")
|
||||
Call<ServiceRESTResponse<RetrieveInventariResponseDTO>> retrieve();
|
||||
|
||||
@GET("wms/inventario/{inventoryId}")
|
||||
Call<ServiceRESTResponse<RetrieveInventarioResponseDTO>> retrieve(
|
||||
@Path("inventoryId") long inventoryId);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -101,12 +101,7 @@ public class SystemRESTConsumer extends _BaseRESTConsumer {
|
||||
}
|
||||
|
||||
|
||||
public static void sendErrorLogMail(String message) {
|
||||
sendErrorLogMail(message, null, null);
|
||||
}
|
||||
|
||||
|
||||
public static void sendErrorLogMail(String message, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public void sendErrorLogMail(String message, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
String currentAzienda = UtilityString.isNullOrEmpty(SettingsManager.i().getUserSession().getProfileDB()) ? "" : " [" + SettingsManager.i().getUserSession().getProfileDB() + "]";
|
||||
|
||||
@@ -135,10 +130,10 @@ public class SystemRESTConsumer extends _BaseRESTConsumer {
|
||||
}
|
||||
|
||||
|
||||
public static void sendMail(MailRequestDTO mailDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public void sendMail(MailRequestDTO mailDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
SystemRESTConsumerService service = RESTBuilder.getService(SystemRESTConsumerService.class);
|
||||
service.sendMail(mailDTO).enqueue(new Callback<ServiceRESTResponse<String>>() {
|
||||
service.sendMail(mailDTO).enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<String>> call, Response<ServiceRESTResponse<String>> response) {
|
||||
if (onComplete != null) onComplete.run();
|
||||
|
||||
@@ -15,41 +15,48 @@ import retrofit2.Response;
|
||||
|
||||
public abstract class _BaseRESTConsumer {
|
||||
|
||||
public static <T> void analyzeAnswer(Response<ServiceRESTResponse<T>> response, String logTitle, RunnableArgs<T> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public static <T> T analyzeAnswer(Response<ServiceRESTResponse<T>> response, String logTitle) throws Exception {
|
||||
if (response.isSuccessful()) {
|
||||
if (response.body() != null) {
|
||||
if (response.body().getEsito() == EsitoType.OK) {
|
||||
if (!UtilityString.isNullOrEmpty(response.body().getErrorMessage())) {
|
||||
onFailed.run(new Exception(response.body().getErrorMessage()));
|
||||
throw new Exception(response.body().getErrorMessage());
|
||||
} else {
|
||||
|
||||
T dataObj = response.body().getDto() != null ?
|
||||
response.body().getDto() :
|
||||
response.body().getEntity();
|
||||
|
||||
onComplete.run(dataObj);
|
||||
return dataObj;
|
||||
}
|
||||
} else {
|
||||
String errorMessage = UtilityString.isNull(response.body().getErrorMessage(), "Empty message");
|
||||
Log.e(logTitle, errorMessage);
|
||||
onFailed.run(CommonRESTException.tryRecognizeException(errorMessage));
|
||||
throw CommonRESTException.tryRecognizeException(errorMessage);
|
||||
}
|
||||
} else {
|
||||
Log.e(logTitle, response.message());
|
||||
onFailed.run(new Exception(response.message()));
|
||||
throw new Exception(response.message());
|
||||
}
|
||||
} else {
|
||||
if (response.code() == 404) {
|
||||
Log.e(logTitle, "Errore " + response.code() + ": risorsa non trovata (" + response.raw().request().url().toString() + ")");
|
||||
onFailed.run(new Exception("Errore " + response.code() + ": risorsa non trovata (" + logTitle + ")"));
|
||||
Log.e(logTitle, "Errore " + response.code() + ": risorsa non trovata (" + response.raw().request().url() + ")");
|
||||
throw new Exception("Errore " + response.code() + ": risorsa non trovata (" + logTitle + ")");
|
||||
} else if (response.code() == 550)
|
||||
onFailed.run(new InvalidLicenseException());
|
||||
throw new InvalidLicenseException();
|
||||
else {
|
||||
Log.e(logTitle, "Status " + response.code() + ": " + response.message());
|
||||
onFailed.run(new Exception("Status " + response.code() + ": " + response.message()));
|
||||
throw new Exception("Status " + response.code() + ": " + response.message());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static <T> void analyzeAnswer(Response<ServiceRESTResponse<T>> response, String logTitle, RunnableArgs<T> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
try {
|
||||
var data = analyzeAnswer(response, logTitle);
|
||||
onComplete.run(data);
|
||||
} catch (Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,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,84 +0,0 @@
|
||||
package it.integry.integrywmsnative.core.rest.model;
|
||||
|
||||
public class DistribuzioneColloDTO {
|
||||
|
||||
private String gestione;
|
||||
private String dataCollo;
|
||||
private Integer numCollo;
|
||||
private String serCollo;
|
||||
private String criterioDistribuzione;
|
||||
|
||||
public String getGestione() {
|
||||
return gestione;
|
||||
}
|
||||
|
||||
public DistribuzioneColloDTO setGestione(String gestione) {
|
||||
this.gestione = gestione;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDataCollo() {
|
||||
return dataCollo;
|
||||
}
|
||||
|
||||
public DistribuzioneColloDTO setDataCollo(String dataCollo) {
|
||||
this.dataCollo = dataCollo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getNumCollo() {
|
||||
return numCollo;
|
||||
}
|
||||
|
||||
public DistribuzioneColloDTO setNumCollo(Integer numCollo) {
|
||||
this.numCollo = numCollo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getSerCollo() {
|
||||
return serCollo;
|
||||
}
|
||||
|
||||
public DistribuzioneColloDTO setSerCollo(String serCollo) {
|
||||
this.serCollo = serCollo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCriterioDistribuzione() {
|
||||
return criterioDistribuzione;
|
||||
}
|
||||
|
||||
public CriterioDistribuzione getCriterioDistribuzioneEnum() {
|
||||
return CriterioDistribuzione.fromString(criterioDistribuzione);
|
||||
}
|
||||
|
||||
public DistribuzioneColloDTO setCriterioDistribuzione(String criterioDistribuzione) {
|
||||
this.criterioDistribuzione = criterioDistribuzione;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DistribuzioneColloDTO setCriterioDistribuzione(CriterioDistribuzione criterioDistribuzione) {
|
||||
this.criterioDistribuzione = criterioDistribuzione != null ? criterioDistribuzione.getText() : null;
|
||||
return this;
|
||||
}
|
||||
|
||||
public enum CriterioDistribuzione {
|
||||
UPDATE("U"), //UPDATE COLLO GIA' ESISTENTE
|
||||
SPLIT_ORDINE("O"); //UPDATE COLLO GIA' ESISTENTE
|
||||
|
||||
private String text;
|
||||
CriterioDistribuzione(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
public String getText() {
|
||||
return this.text;
|
||||
}
|
||||
|
||||
public static CriterioDistribuzione fromString(String text) {
|
||||
for (CriterioDistribuzione b : CriterioDistribuzione.values()) {
|
||||
if (b.text.equalsIgnoreCase(text)) return b;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package it.integry.integrywmsnative.core.rest.model;
|
||||
|
||||
public class MailAttachmentDTO {
|
||||
|
||||
private String fileName;
|
||||
private String fileb64Content;
|
||||
|
||||
public String getFileName() {
|
||||
return fileName;
|
||||
}
|
||||
|
||||
public MailAttachmentDTO setFileName(String fileName) {
|
||||
this.fileName = fileName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getFileb64Content() {
|
||||
return fileb64Content;
|
||||
}
|
||||
|
||||
public MailAttachmentDTO setFileb64Content(String fileb64Content) {
|
||||
this.fileb64Content = fileb64Content;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package it.integry.integrywmsnative.core.rest.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class MailRequestDTO {
|
||||
|
||||
private String from;
|
||||
@@ -11,6 +13,7 @@ public class MailRequestDTO {
|
||||
private String ccn;
|
||||
private String subject;
|
||||
private String msgText;
|
||||
private List<MailAttachmentDTO> attachments;
|
||||
private boolean isHtml = false;
|
||||
private boolean isDebug = false;
|
||||
|
||||
@@ -95,6 +98,15 @@ public class MailRequestDTO {
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<MailAttachmentDTO> getAttachments() {
|
||||
return attachments;
|
||||
}
|
||||
|
||||
public MailRequestDTO setAttachments(List<MailAttachmentDTO> attachments) {
|
||||
this.attachments = attachments;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isHtml() {
|
||||
return isHtml;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -1,10 +1,7 @@
|
||||
package it.integry.integrywmsnative.core.rest.model;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||
|
||||
/**
|
||||
* Created by GiuseppeS on 06/03/2018.
|
||||
*/
|
||||
@@ -12,7 +9,6 @@ import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||
public class ServiceRESTResponse<T> {
|
||||
|
||||
private int esito;
|
||||
private String execDate;
|
||||
private String profileDB;
|
||||
private String errorMessage;
|
||||
|
||||
@@ -24,9 +20,6 @@ public class ServiceRESTResponse<T> {
|
||||
return EsitoType.fromIntValue(esito);
|
||||
}
|
||||
|
||||
public Date getExecDate() {
|
||||
return UtilityDate.recognizeDateWithExceptionHandler(execDate);
|
||||
}
|
||||
|
||||
public String getProfileDB() {
|
||||
return profileDB;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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,14 @@
|
||||
package it.integry.integrywmsnative.core.rest.model.inventario;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.MtbInvent;
|
||||
|
||||
public class RetrieveInventariResponseDTO {
|
||||
|
||||
private List<MtbInvent> inventories;
|
||||
|
||||
public List<MtbInvent> getInventories() {
|
||||
return inventories;
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,6 @@ import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
public class CloseUDSRequestDTO {
|
||||
|
||||
private boolean printSSCC;
|
||||
private boolean enableTransferLogic;
|
||||
private String orderCodMdep;
|
||||
private MtbColt mtbColt;
|
||||
|
||||
@@ -18,15 +17,6 @@ public class CloseUDSRequestDTO {
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isEnableTransferLogic() {
|
||||
return enableTransferLogic;
|
||||
}
|
||||
|
||||
public CloseUDSRequestDTO setEnableTransferLogic(boolean enableTransferLogic) {
|
||||
this.enableTransferLogic = enableTransferLogic;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getOrderCodMdep() {
|
||||
return orderCodMdep;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -32,6 +32,7 @@ public class ServerStatusChecker {
|
||||
public void run() {
|
||||
if (shouldExecute && !UtilityString.isNullOrEmpty(SettingsManager.i().getServer().getHost())) {
|
||||
UtilityServer.isEmsApiAvailable(
|
||||
SettingsManager.i().getServer().getProtocol(),
|
||||
SettingsManager.i().getServer().getHost(),
|
||||
SettingsManager.i().getServer().getPort(),
|
||||
() -> mInternalCallback.run(true),
|
||||
|
||||
@@ -7,7 +7,6 @@ import it.integry.integrywmsnative.core.model.Azienda;
|
||||
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
||||
import it.integry.integrywmsnative.core.model.dto.InternalCodAnagsDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.AvailableCodMdepsDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.DistribuzioneColloDTO;
|
||||
|
||||
public class DBSettingsModel {
|
||||
|
||||
@@ -22,7 +21,6 @@ public class DBSettingsModel {
|
||||
private boolean flagMultiClienteOrdV;
|
||||
private boolean flagUseCodAnagAziendale;
|
||||
private String defaultCausaleRettificaGiacenze;
|
||||
private DistribuzioneColloDTO.CriterioDistribuzione defaultCriterioDistribuzione;
|
||||
private boolean flagAskClienteInPickingLibero;
|
||||
private boolean flagPickLiberoAllowEmptyCliente;
|
||||
|
||||
@@ -53,6 +51,10 @@ public class DBSettingsModel {
|
||||
private String codDtipOrdTrasfV;
|
||||
private boolean notifyLotStatus = false;
|
||||
|
||||
private boolean groupShippingByCommodityGroup = true;
|
||||
private boolean showCodFornSpedizione = true;
|
||||
private boolean flagCanCreateInventario = true;
|
||||
|
||||
public boolean isFlagSpedizioneEnableFakeGiacenza() {
|
||||
return flagSpedizioneEnableFakeGiacenza;
|
||||
}
|
||||
@@ -133,15 +135,6 @@ public class DBSettingsModel {
|
||||
return this;
|
||||
}
|
||||
|
||||
public DistribuzioneColloDTO.CriterioDistribuzione getDefaultCriterioDistribuzione() {
|
||||
return defaultCriterioDistribuzione;
|
||||
}
|
||||
|
||||
public DBSettingsModel setDefaultCriterioDistribuzione(String defaultCriterioDistribuzione) {
|
||||
this.defaultCriterioDistribuzione = DistribuzioneColloDTO.CriterioDistribuzione.fromString(defaultCriterioDistribuzione);
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isFlagAskClienteInPickingLibero() {
|
||||
return flagAskClienteInPickingLibero;
|
||||
}
|
||||
@@ -386,4 +379,31 @@ public class DBSettingsModel {
|
||||
this.notifyLotStatus = notifyLotStatus;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isGroupShippingByCommodityGroup() {
|
||||
return groupShippingByCommodityGroup;
|
||||
}
|
||||
|
||||
public DBSettingsModel setGroupShippingByCommodityGroup(boolean groupShippingByCommodityGroup) {
|
||||
this.groupShippingByCommodityGroup = groupShippingByCommodityGroup;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isShowCodFornSpedizione() {
|
||||
return showCodFornSpedizione;
|
||||
}
|
||||
|
||||
public DBSettingsModel setShowCodFornSpedizione(boolean showCodFornSpedizione) {
|
||||
this.showCodFornSpedizione = showCodFornSpedizione;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isFlagCanCreateInventario() {
|
||||
return flagCanCreateInventario;
|
||||
}
|
||||
|
||||
public DBSettingsModel setFlagCanCreateInventario(boolean flagCanCreateInventario) {
|
||||
this.flagCanCreateInventario = flagCanCreateInventario;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -341,13 +341,24 @@ public class SettingsManager {
|
||||
.setGestName("PICKING")
|
||||
.setSection("SPEDIZIONE")
|
||||
.setKeySection("FLAG_NOTIFICA_STATO_PARTITA"));
|
||||
stbGestSetupList.add(new StbGestSetup()
|
||||
.setGestName("PICKING")
|
||||
.setSection("SPEDIZIONE")
|
||||
.setKeySection("FLAG_SHOW_COD_FORN"));
|
||||
stbGestSetupList.add(new StbGestSetup()
|
||||
.setGestName("PICKING")
|
||||
.setSection("SPEDIZIONE")
|
||||
.setKeySection("FLAG_GROUP_BY_GRP_MERC"));
|
||||
stbGestSetupList.add(new StbGestSetup()
|
||||
.setGestName("PICKING")
|
||||
.setSection("INVENTARIO")
|
||||
.setKeySection("FLAG_CAN_CREATE_INVENTARIO"));
|
||||
String codMdep = SettingsManager.i().getUserSession().getDepo().getCodMdep();
|
||||
|
||||
mGestSetupRESTConsumer.getValues(codMdep, stbGestSetupList, list -> {
|
||||
dbSettingsModelIstance.setEnableCheckPartitaMagCheckPickingV(getValueFromList(list, "SETUP", "ENABLE_CHECK_PARTITA_MAG_PICKING_V", Boolean.class));
|
||||
dbSettingsModelIstance.setFlagMultiClienteOrdV(getValueFromList(list, "SETUP", "FLAG_MULTI_CLIENTE_ORD_VENDITA", Boolean.class));
|
||||
dbSettingsModelIstance.setFlagUseCodAnagAziendale(getValueFromList(list, "SETUP", "FLAG_USE_COD_ANAG_AZIENDALE", Boolean.class));
|
||||
dbSettingsModelIstance.setDefaultCriterioDistribuzione(getValueFromList(list, "SETUP", "DEFAULT_CRITERIO_DISTRIBUZIONE", String.class));
|
||||
dbSettingsModelIstance.setFlagAskClienteInPickingLibero(getValueFromList(list, "PICKING_LIBERO", "FLAG_ASK_CLIENTE", Boolean.class));
|
||||
dbSettingsModelIstance.setFlagPickLiberoAllowEmptyCliente(getValueFromList(list, "PICKING_LIBERO", "FLAG_ALLOW_EMPTY_CLIENTE", Boolean.class));
|
||||
dbSettingsModelIstance.setFlagCanAddExtraItemSpedizione(getValueFromList(list, "SPEDIZIONE", "FLAG_CAN_ADD_EXTRA_ITEMS", Boolean.class));
|
||||
@@ -372,6 +383,9 @@ public class SettingsManager {
|
||||
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, "SPEDIZIONE", "FLAG_CAN_CREATE_INVENTARIO", Boolean.class, Boolean.TRUE));
|
||||
|
||||
String notePerdita = getValueFromList(list, "DOC_INTERNI", "NOTE_PERDITA", String.class);
|
||||
if (notePerdita != null)
|
||||
@@ -392,19 +406,26 @@ public class SettingsManager {
|
||||
|
||||
|
||||
public static <T> T getValueFromList(List<StbGestSetup> stbGestSetupList, String section, String keySectionName, Class<T> clazz) {
|
||||
return getValueFromList(stbGestSetupList, section, keySectionName, clazz, null);
|
||||
}
|
||||
|
||||
public static <T> T getValueFromList(List<StbGestSetup> stbGestSetupList, String section, String keySectionName, Class<T> clazz, T defaultValue) {
|
||||
|
||||
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 null;
|
||||
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()));
|
||||
}
|
||||
}
|
||||
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ public class SettingsModel {
|
||||
|
||||
public static class Server {
|
||||
private String codAzienda;
|
||||
private String protocol;
|
||||
private String host;
|
||||
private int port;
|
||||
|
||||
@@ -32,6 +33,15 @@ public class SettingsModel {
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getProtocol() {
|
||||
return protocol == null ? "http" : protocol;
|
||||
}
|
||||
|
||||
public Server setProtocol(String protocol) {
|
||||
this.protocol = protocol;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getHost() {
|
||||
return host;
|
||||
}
|
||||
|
||||
@@ -15,9 +15,6 @@ import java.io.File;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import it.integry.integrywmsnative.core.class_router.BaseCustomConfiguration;
|
||||
import it.integry.integrywmsnative.core.class_router.ClassRouter;
|
||||
import it.integry.integrywmsnative.core.class_router.interfaces.ICustomConfiguration;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.FileDownloader;
|
||||
import it.integry.integrywmsnative.view.dialogs.DialogProgressView;
|
||||
@@ -30,19 +27,9 @@ public class UpdatesManager {
|
||||
public void init(AppCompatActivity activityContext) {
|
||||
this.mContext = activityContext;
|
||||
|
||||
String suffix;
|
||||
ICustomConfiguration customConfiguration = ClassRouter.getInstance(ClassRouter.PATH.CUSTOM_CONFIGURATION);
|
||||
try {
|
||||
suffix = customConfiguration.getConfig(BaseCustomConfiguration.Keys.CUSTOM_DYNAMIC_VERSION_PATH);
|
||||
if (suffix == null) {
|
||||
suffix = "";
|
||||
}
|
||||
} catch (Exception e) {
|
||||
suffix = "";
|
||||
}
|
||||
|
||||
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" + suffix + ".apk";
|
||||
String currentVersionUrl = SettingsManager.i().getServer().getProtocol() + "://" + SettingsManager.i().getServer().getHost() + ":" + SettingsManager.i().getServer().getPort() + "/ems-api/wms/currentVersion";
|
||||
String currentDownloadUrl = SettingsManager.i().getServer().getProtocol() + "://" + SettingsManager.i().getServer().getHost() + ":" + SettingsManager.i().getServer().getPort() + "/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,15 @@ 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()];
|
||||
|
||||
@@ -43,10 +43,10 @@ public class UtilityDate {
|
||||
public static final String DMY_HUMAN_LONG = "dd MMMM yyyy";
|
||||
}
|
||||
|
||||
public static Date recognizeDateWithExceptionHandler(String dateString) {
|
||||
try{
|
||||
public static Date recognizeDateWithExceptionHandler(String dateString) {
|
||||
try {
|
||||
return UtilityDate.recognizeDate(dateString);
|
||||
} catch (ParseException | DateNotRecognizedException | TimeNotRecognizedException pex){
|
||||
} catch (ParseException | DateNotRecognizedException | TimeNotRecognizedException pex) {
|
||||
UtilityLogger.error(pex);
|
||||
return null;
|
||||
}
|
||||
@@ -64,9 +64,9 @@ public class UtilityDate {
|
||||
char dateSeparator;
|
||||
|
||||
String onlyDateSubstring = dateString.substring(0, 10);
|
||||
if(onlyDateSubstring.contains("/")) dateSeparator = '/';
|
||||
else if(onlyDateSubstring.contains("-")) dateSeparator = '-';
|
||||
else if(onlyDateSubstring.contains(".")) dateSeparator = '.';
|
||||
if (onlyDateSubstring.contains("/")) dateSeparator = '/';
|
||||
else if (onlyDateSubstring.contains("-")) dateSeparator = '-';
|
||||
else if (onlyDateSubstring.contains(".")) dateSeparator = '.';
|
||||
else throw new DateNotRecognizedException(dateString);
|
||||
|
||||
String dateFormatString = (dateString.charAt(2) == dateSeparator)
|
||||
@@ -74,13 +74,13 @@ public class UtilityDate {
|
||||
: "yyyy" + dateSeparator + "MM" + dateSeparator + "dd";
|
||||
|
||||
|
||||
if(dateString.length() > 10){
|
||||
if (dateString.length() > 10) {
|
||||
|
||||
char timeSeparator;
|
||||
|
||||
String onlyTimeSubstring = dateString.substring(10, 14);
|
||||
if(onlyTimeSubstring.contains("-")) timeSeparator = '-';
|
||||
else if(onlyTimeSubstring.contains(":")) timeSeparator = ':';
|
||||
if (onlyTimeSubstring.contains("-")) timeSeparator = '-';
|
||||
else if (onlyTimeSubstring.contains(":")) timeSeparator = ':';
|
||||
else throw new TimeNotRecognizedException(dateString);
|
||||
|
||||
String timeFormatString = "HH" + timeSeparator + "mm" + timeSeparator + "ss";
|
||||
@@ -99,12 +99,11 @@ public class UtilityDate {
|
||||
|
||||
|
||||
public static String formatDate(Date dateToFormat, String format) {
|
||||
if(dateToFormat != null) {
|
||||
if (dateToFormat != null) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat(format);
|
||||
//sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
|
||||
return sdf.format(dateToFormat);
|
||||
}
|
||||
else return null;
|
||||
} else return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -116,7 +115,7 @@ public class UtilityDate {
|
||||
public static Date getDateInstance(boolean removeTime) {
|
||||
var calendar = getCalendarInstance();
|
||||
|
||||
if(removeTime) {
|
||||
if (removeTime) {
|
||||
calendar.set(Calendar.HOUR_OF_DAY, 0);
|
||||
calendar.set(Calendar.MINUTE, 0);
|
||||
calendar.set(Calendar.SECOND, 0);
|
||||
@@ -131,8 +130,6 @@ public class UtilityDate {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static String formatDate(LocalDate dateToFormat, String format) {
|
||||
if (dateToFormat != null) {
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(format);
|
||||
@@ -185,7 +182,6 @@ public class UtilityDate {
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static LocalDate getNow() {
|
||||
return Instant.now()
|
||||
.atZone(currentZone)
|
||||
@@ -197,6 +193,7 @@ public class UtilityDate {
|
||||
.atZone(currentZone)
|
||||
.toLocalDateTime();
|
||||
}
|
||||
|
||||
public static LocalDate timeToLocalDate(long time, @Nullable String timezone) {
|
||||
return Instant.ofEpochSecond(time)
|
||||
.atZone(timezone == null ? currentZone : ZoneId.of(timezone))
|
||||
@@ -210,7 +207,6 @@ public class UtilityDate {
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static long localDateTimeToTime(LocalDateTime localDateTime, @Nullable String timezone) {
|
||||
return localDateTime
|
||||
.atZone(timezone == null ? currentZone : ZoneId.of(timezone))
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -7,8 +7,8 @@ import java.net.SocketAddress;
|
||||
|
||||
import it.integry.integrywmsnative.core.exception.InvalidLicenseException;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||
import it.integry.integrywmsnative.gest.login.exception.ServerNotReachableException;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
|
||||
@@ -38,16 +38,18 @@ public class UtilityServer {
|
||||
}).start();
|
||||
}
|
||||
|
||||
public static void isEmsApiAvailable(final String serverAddress, final int serverTCPport, final Runnable onComplete, final RunnableArgs<Exception> onFailed) {
|
||||
public static void isEmsApiAvailable(final String protocol, final String serverAddress, final int serverTCPport, final Runnable onComplete, final RunnableArgs<Exception> onFailed) {
|
||||
new Thread(() -> {
|
||||
OkHttpClient client = new OkHttpClient();
|
||||
|
||||
|
||||
Request request = new Request.Builder()
|
||||
.url(String.format("http://%s:%d/ems-api/system/ok", serverAddress, serverTCPport))
|
||||
.url(String.format("%s://%s:%d/ems-api/system/ok", protocol, serverAddress, serverTCPport))
|
||||
.build();
|
||||
|
||||
try {
|
||||
Response response = client.newCall(request).execute();
|
||||
Response response = RESTBuilder.getDefaultHttpClient().build()
|
||||
.newCall(request)
|
||||
.execute();
|
||||
response.close();
|
||||
|
||||
if (response.code() == 200) onComplete.run();
|
||||
@@ -55,7 +57,8 @@ public class UtilityServer {
|
||||
onFailed.run(new ServerNotReachableException(serverAddress, serverTCPport, null));
|
||||
else if (response.code() == 550)
|
||||
onFailed.run(new InvalidLicenseException());
|
||||
else onFailed.run(new Exception("Errore non identificato (STATUS: " + response.code() + ")"));
|
||||
else
|
||||
onFailed.run(new Exception("Errore non identificato (STATUS: " + response.code() + ")"));
|
||||
} catch (IOException e) {
|
||||
onFailed.run(new ServerNotReachableException(serverAddress, serverTCPport, e));
|
||||
}
|
||||
|
||||
@@ -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"));
|
||||
|
||||
@@ -335,13 +335,11 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
// Handle item selection
|
||||
switch (item.getItemId()) {
|
||||
case R.id.action_filter:
|
||||
showOrderByDialog();
|
||||
return true;
|
||||
default:
|
||||
return super.onOptionsItemSelected(item);
|
||||
if (item.getItemId() == R.id.action_filter) {
|
||||
showOrderByDialog();
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
private void initVars() {
|
||||
@@ -752,11 +750,11 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
|
||||
public void onLUPrintError(Exception ex, Runnable onComplete) {
|
||||
this.onLoadingEnded();
|
||||
DialogSimpleMessageView.makeErrorDialog(
|
||||
new SpannableString(ex.getMessage()),
|
||||
null,
|
||||
null,
|
||||
R.string.button_ignore_print,
|
||||
onComplete)
|
||||
new SpannableString(ex.getMessage()),
|
||||
null,
|
||||
null,
|
||||
R.string.button_ignore_print,
|
||||
onComplete)
|
||||
.show(getSupportFragmentManager(), "tag");
|
||||
}
|
||||
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,12 +27,12 @@ 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.rest.model.documento.DocumentoArtDTO;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||
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;
|
||||
@@ -70,6 +70,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
|
||||
@@ -114,28 +115,23 @@ public class DocInterniFragment extends BaseFragment implements ITitledFragment,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDocDetailsChanged(DialogSelectDocInfoViewModel selection) {
|
||||
if (selection.isInputValid()) {
|
||||
mViewModel.setSelectedDocDetails(selection);
|
||||
mBinding.mainFab.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mBinding.mainFab.setVisibility(View.GONE);
|
||||
}
|
||||
public void onDocDetailsChanged(DialogSelectDocInfoResponseDTO selection) {
|
||||
mViewModel.setSelectedDocDetails(selection);
|
||||
|
||||
if (selection.requiresFornitore()) {
|
||||
if (selection.isFornitoreRequired()) {
|
||||
mBinding.codAnagContainer.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mBinding.codAnagContainer.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
|
||||
if (selection.getSelectedGruppoArt() != null) {
|
||||
if (selection.getGruppoArt() != null) {
|
||||
mBinding.mtbGrpContainer.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mBinding.mtbGrpContainer.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if (selection.requiresDocData()) {
|
||||
if (selection.isDocumentRequired()) {
|
||||
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 {
|
||||
@@ -156,16 +152,12 @@ public class DocInterniFragment extends BaseFragment implements ITitledFragment,
|
||||
|
||||
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");
|
||||
mDocInterniSetupDTO,
|
||||
this::onDocDetailsChanged,
|
||||
this::popMe)
|
||||
.show(requireActivity().getSupportFragmentManager(), "tag");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -200,7 +192,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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -14,29 +14,31 @@ 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<TipoDocDTO> dtbTipi = new MutableLiveData<>();
|
||||
public final MutableLiveData<GruppoArticoloDTO> mtbGrup = new MutableLiveData<>();
|
||||
public final MutableLiveData<FornitoreDTO> fornitore = new MutableLiveData<>();
|
||||
public final MutableLiveData<Date> dataDoc = new MutableLiveData<>();
|
||||
public final MutableLiveData<String> numDoc = new MutableLiveData<>();
|
||||
@@ -44,21 +46,24 @@ public class DocInterniViewModel {
|
||||
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.documentRESTConsumer = documentRESTConsumer;
|
||||
|
||||
this.mDocsList.setValue(new ArrayList<>());
|
||||
}
|
||||
|
||||
|
||||
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() {
|
||||
@@ -82,29 +87,29 @@ public class DocInterniViewModel {
|
||||
return mDocsList;
|
||||
}
|
||||
|
||||
public void setSelectedDocDetails(DialogSelectDocInfoViewModel selection) {
|
||||
public void setSelectedDocDetails(DialogSelectDocInfoResponseDTO selection) {
|
||||
|
||||
this.fornitore.postValue(selection.getSelectedFornitore());
|
||||
this.mtbGrup.postValue(selection.getSelectedGruppoArt());
|
||||
this.fornitore.postValue(selection.getFornitore());
|
||||
this.dtbTipi.postValue(selection.getTipoDoc());
|
||||
|
||||
this.mtbGrup.postValue(selection.getGruppoArt());
|
||||
this.dataDoc.postValue(selection.getDataDoc());
|
||||
this.numDoc.postValue(selection.getNumDoc());
|
||||
this.numDoc.postValue(selection.getNumDoc() != null ? selection.getNumDoc().toString() : null);
|
||||
this.note.postValue(selection.getNote());
|
||||
|
||||
if (selection.getSelectedTipoDoc() != null) {
|
||||
this.dtbTipi.postValue(selection.getSelectedTipoDoc());
|
||||
}
|
||||
}
|
||||
|
||||
public void fetchProducts() {
|
||||
this.productsFetched = false;
|
||||
this.sendOnLoadingStarted();
|
||||
mDocInterniRESTConsumer.fetchProducts(this.getCodDtip(), this.getCodMgrp(), returnDto -> {
|
||||
|
||||
documentRESTConsumer.loadDocumentoAvailableArts(this.getCodDtip(), this.getCodMgrp(), data -> {
|
||||
this.productsFetched = true;
|
||||
this.productsList = returnDto;
|
||||
this.artsSize.set(returnDto.getGrigliaAcquistiChild().size());
|
||||
if (this.docsFetched) {
|
||||
this.availableArts = data.getArts();
|
||||
this.artsSize.set(this.availableArts.size());
|
||||
|
||||
if (this.docsFetched)
|
||||
this.sendOnLoadingEnded();
|
||||
}
|
||||
|
||||
}, this::sendError);
|
||||
}
|
||||
|
||||
@@ -140,7 +145,7 @@ public class DocInterniViewModel {
|
||||
return this.dtbTipi.getValue().getCodDtip();
|
||||
}
|
||||
|
||||
public TipiDocDTO getTipoDoc() {
|
||||
public TipoDocDTO getTipoDoc() {
|
||||
if (this.dtbTipi.getValue() == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -155,7 +160,7 @@ public class DocInterniViewModel {
|
||||
}
|
||||
|
||||
public void editDocument(SqlMtbColt document) {
|
||||
this.mListener.onDocumentEditRequest(document, productsList);
|
||||
this.mListener.onDocumentEditRequest(document, availableArts);
|
||||
}
|
||||
|
||||
public void newDocument() {
|
||||
@@ -197,9 +202,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,242 @@
|
||||
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;
|
||||
|
||||
private final DocInterniSetupDTO mDocInputData;
|
||||
private final RunnableArgs<DialogSelectDocInfoResponseDTO> onConfirm;
|
||||
private final Runnable onAbort;
|
||||
|
||||
|
||||
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<>();
|
||||
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<>();
|
||||
|
||||
private ArrayAdapter<String> arrayAdapterCodDtips;
|
||||
private ArrayAdapter<String> arrayAdapterCodMgrps;
|
||||
private ArrayAdapter<String> arrayAdapterCodAnags;
|
||||
private ArrayAdapter<String> arrayAdapterNote;
|
||||
private DialogSelectDocInfoBinding mBindings;
|
||||
public ObservableField<Boolean> isFornitoreRequired = new ObservableField<>();
|
||||
public ObservableField<Boolean> isDocumentRequired = new ObservableField<>();
|
||||
public ObservableField<Boolean> isNoteRequired = new ObservableField<>();
|
||||
|
||||
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 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 static DialogSelectDocInfoView newInstance(DocInterniSetupDTO docInputData,
|
||||
RunnableArgs<DialogSelectDocInfoResponseDTO> onConfirm,
|
||||
Runnable onAbort) {
|
||||
return new DialogSelectDocInfoView(docInputData, onConfirm, onAbort);
|
||||
}
|
||||
|
||||
|
||||
private DialogSelectDocInfoView(DocInterniSetupDTO docInterniSetupDTO,
|
||||
TipiDocDTO tipiDocDTO,
|
||||
GruppiArticoloDTO gruppiArticoloDTO,
|
||||
FornitoreDTO fornitoreDTO,
|
||||
Date dataDoc,
|
||||
String numDoc,
|
||||
String note,
|
||||
RunnableArgs<DialogSelectDocInfoViewModel> onDismiss) {
|
||||
private DialogSelectDocInfoView(DocInterniSetupDTO docInputData,
|
||||
RunnableArgs<DialogSelectDocInfoResponseDTO> onConfirm,
|
||||
Runnable onAbort) {
|
||||
super();
|
||||
currentOnFilterDone = onDismiss;
|
||||
this.docInterniSetupDTO = docInterniSetupDTO;
|
||||
selectedDtip = tipiDocDTO;
|
||||
selectedGrp = gruppiArticoloDTO;
|
||||
selectedDataDoc = dataDoc;
|
||||
selectedNumDoc = numDoc;
|
||||
selectedNote = note;
|
||||
selectedAnag = fornitoreDTO;
|
||||
|
||||
this.mDocInputData = docInputData;
|
||||
this.onConfirm = onConfirm;
|
||||
this.onAbort = onAbort;
|
||||
}
|
||||
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public void onDismiss(@NonNull DialogInterface dialog) {
|
||||
super.onDismiss(dialog);
|
||||
if (currentOnFilterDone != null) currentOnFilterDone.run(mViewModel);
|
||||
}
|
||||
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
|
||||
this.mContext = requireContext();
|
||||
|
||||
@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()
|
||||
MainApplication.appComponent
|
||||
.dialogSelectDocInfoNewViewComponent()
|
||||
.create()
|
||||
.inject(this);
|
||||
mViewModel.init(docInterniSetupDTO);
|
||||
mViewModel.setListeners(this);
|
||||
|
||||
mBindings = DialogSelectDocInfoViewBinding.inflate(LayoutInflater.from(this.mContext), null, false);
|
||||
mBindings.setLifecycleOwner(this);
|
||||
mBindings.setView(this);
|
||||
mBindings.setViewmodel(mViewModel);
|
||||
|
||||
getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
|
||||
getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||
initView();
|
||||
mViewModel.setFornitori(mDocInputData.getFornitori());
|
||||
|
||||
var cancelable = true;
|
||||
|
||||
mBindings.positiveBtn.setOnClickListener(view -> {
|
||||
if (this.isInputValid()) {
|
||||
getDialog().dismiss();
|
||||
var alertDialog = new MaterialAlertDialogBuilder(this.mContext)
|
||||
.setView(mBindings.getRoot())
|
||||
.setCancelable(cancelable)
|
||||
.setPositiveButton(R.string.confirm, (dialog, which) -> {
|
||||
//Volutamente vuoto
|
||||
})
|
||||
.setNegativeButton(R.string.abort, (dialog, which) -> {
|
||||
//Volutamente vuoto
|
||||
})
|
||||
.create();
|
||||
|
||||
alertDialog.setOnShowListener(this);
|
||||
alertDialog.setCanceledOnTouchOutside(cancelable);
|
||||
|
||||
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();
|
||||
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");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
return mBindings.getRoot();
|
||||
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 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 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 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());
|
||||
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());
|
||||
});
|
||||
|
||||
arrayAdapterCodMgrps = new ArrayAdapter<>(mCurrentContext, R.layout.dialog_select_doc_info__single_item);
|
||||
arrayAdapterCodMgrps.addAll(mViewModel.getAvailableCodMgrps());
|
||||
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());
|
||||
});
|
||||
|
||||
arrayAdapterCodAnags = new ArrayAdapter<>(mCurrentContext, R.layout.dialog_select_doc_info__single_item);
|
||||
arrayAdapterCodAnags.addAll(mViewModel.getAvailableFornitori());
|
||||
mBindings.filledExposedDropdownCodAnagList.setAdapter(arrayAdapterCodAnags);
|
||||
var arrayAdapterFornitori = new DialogSelectDocInfo_FornitoreAdapter(mContext, R.layout.array_adapter_single_item, mDocInputData.getFornitori());
|
||||
mBindings.filledExposedDropdownCodAnagList.setAdapter(arrayAdapterFornitori);
|
||||
mBindings.filledExposedDropdownCodAnagList.setOnItemClickListener((adapterView, view, i, l) -> {
|
||||
this.selectedFornitore.set(
|
||||
((DialogSelectDocInfo_FornitoreAdapter.ListModel) adapterView.getItemAtPosition(i))
|
||||
.getOriginalModel());
|
||||
});
|
||||
|
||||
arrayAdapterNote = new ArrayAdapter<>(mCurrentContext, R.layout.dialog_select_doc_info__single_item);
|
||||
arrayAdapterNote.addAll(mViewModel.getAdditionalNotes());
|
||||
var arrayAdapterNote = new DialogSelectDocInfo_NoteAdapter(mContext, R.layout.array_adapter_single_item, SettingsManager.iDB().getNotePerditaDocInterni());
|
||||
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,163 @@
|
||||
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 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 void setCodDtip(String codDtip) {
|
||||
this.mTipoDoc = codDtip;
|
||||
if (this.getSelectedTipoDoc() != null) {
|
||||
this.mListener.onDocTypeSelected();
|
||||
}
|
||||
|
||||
public MutableLiveData<Boolean> isFornitoreRequired() {
|
||||
return fornitoreRequired;
|
||||
}
|
||||
|
||||
public String getCodMgrp() {
|
||||
return mGruppoArt;
|
||||
public MutableLiveData<Boolean> isDocumentRequired() {
|
||||
return documentRequired;
|
||||
}
|
||||
|
||||
public void setCodMgrp(String codMgrp) {
|
||||
this.mGruppoArt = codMgrp;
|
||||
public MutableLiveData<Boolean> isNoteRequired() {
|
||||
return noteRequired;
|
||||
}
|
||||
|
||||
public void setCodAnag(String codAnag) {
|
||||
this.mFornitore = codAnag;
|
||||
|
||||
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,50 @@
|
||||
package it.integry.integrywmsnative.gest.contab_doc_interni.dialog.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.widget.ArrayAdapter;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
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, List<FornitoreDTO> inputData) {
|
||||
super(context, resource);
|
||||
|
||||
if (inputData == null) return;
|
||||
|
||||
List<ListModel> mDataset = Stream.of(inputData)
|
||||
.map(x -> new ListModel()
|
||||
.setOriginalModel(x))
|
||||
.toList();
|
||||
|
||||
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() + " )";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package it.integry.integrywmsnative.gest.contab_doc_interni.dialog.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.widget.ArrayAdapter;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.GruppoArticoloDTO;
|
||||
|
||||
public class DialogSelectDocInfo_GroupArtAdapter extends ArrayAdapter<DialogSelectDocInfo_GroupArtAdapter.ListModel> {
|
||||
|
||||
public DialogSelectDocInfo_GroupArtAdapter(@NonNull Context context, int resource, List<GruppoArticoloDTO> inputData) {
|
||||
super(context, resource);
|
||||
|
||||
if(inputData == null) return;
|
||||
|
||||
List<ListModel> mDataset = Stream.of(inputData)
|
||||
.map(x -> new ListModel()
|
||||
.setOriginalModel(x))
|
||||
.toList();
|
||||
|
||||
addAll(mDataset);
|
||||
}
|
||||
|
||||
public static class ListModel {
|
||||
|
||||
private GruppoArticoloDTO originalModel;
|
||||
|
||||
public GruppoArticoloDTO getOriginalModel() {
|
||||
return originalModel;
|
||||
}
|
||||
public ListModel setOriginalModel(GruppoArticoloDTO originalModel) {
|
||||
this.originalModel = originalModel;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.getOriginalModel().getCodMgrp() + " - " + this.getOriginalModel().getDescrizione();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package it.integry.integrywmsnative.gest.contab_doc_interni.dialog.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.widget.ArrayAdapter;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class DialogSelectDocInfo_NoteAdapter extends ArrayAdapter<String> {
|
||||
|
||||
public DialogSelectDocInfo_NoteAdapter(@NonNull Context context, int resource, List<String> inputData) {
|
||||
super(context, resource);
|
||||
|
||||
if (inputData == null) return;
|
||||
|
||||
addAll(inputData);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package it.integry.integrywmsnative.gest.contab_doc_interni.dialog.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.widget.ArrayAdapter;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.TipoDocDTO;
|
||||
|
||||
public class DialogSelectDocInfo_TipoDocAdapter extends ArrayAdapter<DialogSelectDocInfo_TipoDocAdapter.ListModel> {
|
||||
|
||||
public DialogSelectDocInfo_TipoDocAdapter(@NonNull Context context, int resource, List<TipoDocDTO> inputData) {
|
||||
super(context, resource);
|
||||
|
||||
if(inputData == null) return;
|
||||
|
||||
List<ListModel> mDataset = Stream.of(inputData)
|
||||
.map(x -> new ListModel()
|
||||
.setOriginalModel(x))
|
||||
.toList();
|
||||
|
||||
addAll(mDataset);
|
||||
}
|
||||
|
||||
public static class ListModel {
|
||||
|
||||
private TipoDocDTO originalModel;
|
||||
|
||||
public TipoDocDTO getOriginalModel() {
|
||||
return originalModel;
|
||||
}
|
||||
public ListModel setOriginalModel(TipoDocDTO originalModel) {
|
||||
this.originalModel = originalModel;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.getOriginalModel().getCodDtip() + " - " + this.getOriginalModel().getDescrizione();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package it.integry.integrywmsnative.gest.contab_doc_interni.dialog.exception;
|
||||
|
||||
public class DocumentRequiredException extends Exception {
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package it.integry.integrywmsnative.gest.contab_doc_interni.dialog.exception;
|
||||
|
||||
public class FornitoreRequiredException extends Exception {
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package it.integry.integrywmsnative.gest.contab_doc_interni.dialog.exception;
|
||||
|
||||
public class NoteRequiredException extends Exception {
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package it.integry.integrywmsnative.gest.contab_doc_interni.dialog.exception;
|
||||
|
||||
public class TipoDocRequiredException extends Exception {
|
||||
}
|
||||
@@ -5,26 +5,26 @@ import java.util.List;
|
||||
public class DocInterniSetupDTO {
|
||||
|
||||
|
||||
private List<TipiDocDTO> tipiDoc;
|
||||
private List<TipoDocDTO> tipiDoc;
|
||||
|
||||
private List<GruppiArticoloDTO> gruppiArt;
|
||||
private List<GruppoArticoloDTO> gruppiArt;
|
||||
|
||||
private List<FornitoreDTO> fornitori;
|
||||
|
||||
|
||||
public List<TipiDocDTO> getTipiDoc() {
|
||||
public List<TipoDocDTO> getTipiDoc() {
|
||||
return tipiDoc;
|
||||
}
|
||||
|
||||
public void setTipiDoc(List<TipiDocDTO> tipiDoc) {
|
||||
public void setTipiDoc(List<TipoDocDTO> tipiDoc) {
|
||||
this.tipiDoc = tipiDoc;
|
||||
}
|
||||
|
||||
public List<GruppiArticoloDTO> getGruppiArt() {
|
||||
public List<GruppoArticoloDTO> getGruppiArt() {
|
||||
return gruppiArt;
|
||||
}
|
||||
|
||||
public void setGruppiArt(List<GruppiArticoloDTO> gruppiArt) {
|
||||
public void setGruppiArt(List<GruppoArticoloDTO> gruppiArt) {
|
||||
this.gruppiArt = gruppiArt;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package it.integry.integrywmsnative.gest.contab_doc_interni.dto;
|
||||
|
||||
public class GruppiArticoloDTO {
|
||||
public class GruppoArticoloDTO {
|
||||
|
||||
private String codMgrp;
|
||||
private String descrizione;
|
||||
@@ -1,6 +1,6 @@
|
||||
package it.integry.integrywmsnative.gest.contab_doc_interni.dto;
|
||||
|
||||
public class TipiDocDTO {
|
||||
public class TipoDocDTO {
|
||||
|
||||
private String codDtip;
|
||||
private String descrizione;
|
||||
@@ -48,7 +48,7 @@ public class TipiDocDTO {
|
||||
return requireNote;
|
||||
}
|
||||
|
||||
public TipiDocDTO setRequireNote(boolean requireNote) {
|
||||
public TipoDocDTO setRequireNote(boolean requireNote) {
|
||||
this.requireNote = requireNote;
|
||||
return this;
|
||||
}
|
||||
@@ -15,6 +15,7 @@ import com.annimon.stream.Stream;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@@ -35,11 +36,11 @@ import it.integry.integrywmsnative.core.expansion.BaseActivity;
|
||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
import it.integry.integrywmsnative.core.model.MtbPartitaMag;
|
||||
import it.integry.integrywmsnative.core.model.MtbUntMis;
|
||||
import it.integry.integrywmsnative.core.rest.model.documento.DocumentoArtDTO;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||
import it.integry.integrywmsnative.databinding.ActivityContabDocInterniEditBinding;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.GrigliaAcquistiChildDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.GrigliaArticoliDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.TipiDocDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.TipoDocDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.dialog.selectDocRows.DialogSelectDocRowsView;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.ui.DocumentRowsListAdapter;
|
||||
import it.integry.integrywmsnative.ui.FabMenuCustomAnimations;
|
||||
@@ -77,11 +78,11 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
||||
public BindableBoolean isDocumentExportable = new BindableBoolean(false);
|
||||
private final ObservableArrayList<SqlMtbColr> documentRowsObservableList = new ObservableArrayList<>();
|
||||
|
||||
public static Intent newInstance(Context context, SqlMtbColt document, GrigliaArticoliDTO productList, TipiDocDTO tipoDoc) {
|
||||
public static Intent newInstance(Context context, SqlMtbColt document, List<DocumentoArtDTO> arts, TipoDocDTO tipoDoc) {
|
||||
Intent myIntent = new Intent(context, DocInterniEditFormActivity.class);
|
||||
|
||||
String doc = DataCache.addItem(document);
|
||||
String productsKey = DataCache.addItem(productList);
|
||||
String productsKey = DataCache.addItem(arts);
|
||||
String docType = DataCache.addItem(tipoDoc);
|
||||
myIntent.putExtra(DATA_KEY_DOCUMENT, doc);
|
||||
myIntent.putExtra(DATA_KEY_PRODUCTS_LIST, productsKey);
|
||||
@@ -98,9 +99,8 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
||||
.create()
|
||||
.inject(this);
|
||||
SqlMtbColt document = DataCache.retrieveItem(getIntent().getStringExtra(DATA_KEY_DOCUMENT));
|
||||
GrigliaArticoliDTO griglia = DataCache.retrieveItem(getIntent().getStringExtra(DATA_KEY_PRODUCTS_LIST));
|
||||
List<GrigliaAcquistiChildDTO> productList = griglia.getGrigliaAcquistiChild();
|
||||
TipiDocDTO docType = DataCache.retrieveItem(getIntent().getStringExtra(DATA_KEY_TIPO_DOC));
|
||||
List<DocumentoArtDTO> productList = DataCache.retrieveItem(getIntent().getStringExtra(DATA_KEY_PRODUCTS_LIST));
|
||||
TipoDocDTO docType = DataCache.retrieveItem(getIntent().getStringExtra(DATA_KEY_TIPO_DOC));
|
||||
|
||||
this.initViewModel();
|
||||
this.viewModel.setDocument(document);
|
||||
@@ -177,7 +177,7 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
||||
|
||||
public void manualSearch() {
|
||||
BarcodeManager.disable();
|
||||
DialogSimpleInputHelper.makeInputDialog(this, "Ricerca articolo", null, "Cod articolo / Barcode", this.viewModel::onSearch, BarcodeManager::enable).show();
|
||||
DialogSimpleInputHelper.makeInputDialog(this, "Ricerca articolo", null, "Cod articolo / Barcode", this.viewModel::loadArticolo, BarcodeManager::enable).show();
|
||||
}
|
||||
|
||||
|
||||
@@ -222,7 +222,7 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEditRowRequest(SqlMtbColr row, boolean flagTracciabilita) {
|
||||
public void onEditRowRequest(SqlMtbColr row, boolean flagTracciabilita, boolean isUntMisDig) {
|
||||
this.onLoadingStarted();
|
||||
MtbAart mtbAart = new MtbAart();
|
||||
mtbAart.setBarCode(row.getCodBarre());
|
||||
@@ -235,6 +235,11 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
||||
mtbAart.setFlagTracciabilita(flagTracciabilita ? "S" : "N");
|
||||
mtbAart.setUntMis(row.getUntMis());
|
||||
|
||||
MtbUntMis mtbUntMis = new MtbUntMis()
|
||||
.setUntMis(row.getUntMis())
|
||||
.setFlagDig(isUntMisDig ? "S" : "N");
|
||||
mtbAart.setMtbUntMis(Collections.singletonList(mtbUntMis));
|
||||
|
||||
DialogInputQuantityV2DTO dialogInputQuantityV2DTO = new DialogInputQuantityV2DTO()
|
||||
.setMtbAart(mtbAart)
|
||||
.setInitialNumCnf(BigDecimal.valueOf(row.getNumCnf()))
|
||||
@@ -275,6 +280,12 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
||||
this.closeEdit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDocDeleted() {
|
||||
this.binding.closeActivityFab.close(true);
|
||||
this.closeEdit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDocExported() {
|
||||
runOnUiThread(() -> {
|
||||
@@ -290,8 +301,8 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
||||
|
||||
@Override
|
||||
public void onMtbColrEdit(MtbColr mtbColr) {
|
||||
GrigliaAcquistiChildDTO articolo = viewModel.getArticoloByCodMart(mtbColr.getCodMart());
|
||||
this.viewModel.editRow(entityToSql(mtbColr), articolo.getFlagTracciabilita().equalsIgnoreCase("S"));
|
||||
DocumentoArtDTO articolo = viewModel.getArticoloByCodMart(mtbColr.getCodMart());
|
||||
this.viewModel.dispatchRowEdit(entityToSql(mtbColr), articolo.isFlagTracciabilita(), articolo.isUntMisDigitale());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -300,11 +311,11 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMultipleRowsFound(List<SqlMtbColr> rows, GrigliaAcquistiChildDTO articolo) {
|
||||
public void onMultipleRowsFound(List<SqlMtbColr> rows, DocumentoArtDTO articolo) {
|
||||
DialogSelectDocRowsView.newInstance(rows, (row) -> {
|
||||
this.onLoadingEnded();
|
||||
if (row != null) {
|
||||
this.viewModel.editRow(row, (articolo.getFlagTracciabilita().equalsIgnoreCase("S")));
|
||||
this.viewModel.dispatchRowEdit(row, articolo.isFlagTracciabilita(), articolo.isUntMisDigitale());
|
||||
}
|
||||
}
|
||||
).show(this.getSupportFragmentManager(), "dialogSelectDocRows");
|
||||
|
||||
@@ -10,6 +10,7 @@ import org.json.JSONObject;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
@@ -21,13 +22,13 @@ import it.integry.integrywmsnative.core.data_store.db.repository.MtbColrDataSour
|
||||
import it.integry.integrywmsnative.core.data_store.db.repository.MtbColtRepository;
|
||||
import it.integry.integrywmsnative.core.exception.NoResultFromBarcodeException;
|
||||
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
|
||||
import it.integry.integrywmsnative.core.rest.model.documento.DocumentoArtDTO;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.ArtDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.ColloDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.GrigliaAcquistiChildDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.SaveDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.TipiDocDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.TipoDocDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.rest.DocInterniRESTConsumer;
|
||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2ResultDTO;
|
||||
|
||||
@@ -39,8 +40,9 @@ public class DocInterniEditFormViewModel {
|
||||
MtbColtRepository mtbColtRepository;
|
||||
private final DocInterniRESTConsumer docInterniRESTConsumer;
|
||||
private DocInterniEditFormViewModel.Listener listener;
|
||||
private List<GrigliaAcquistiChildDTO> productsList;
|
||||
private TipiDocDTO tipoDoc;
|
||||
private List<DocumentoArtDTO> productsList;
|
||||
private HashMap<String, String> flattedBarcodesCodMarts;
|
||||
private TipoDocDTO tipoDoc;
|
||||
private boolean isCheckPartitaMag = false;
|
||||
private JSONObject checkFornitoreRules = null;
|
||||
public MutableLiveData<SqlMtbColt> document = new MutableLiveData<>();
|
||||
@@ -87,8 +89,8 @@ public class DocInterniEditFormViewModel {
|
||||
|
||||
}
|
||||
|
||||
public void editRow(SqlMtbColr row, boolean flagTracciabilita) {
|
||||
this.listener.onEditRowRequest(row, flagTracciabilita && this.isCheckPartitaMag);
|
||||
public void dispatchRowEdit(SqlMtbColr row, boolean flagTracciabilita, boolean isUntMisDig) {
|
||||
this.listener.onEditRowRequest(row, flagTracciabilita && this.isCheckPartitaMag,isUntMisDig);
|
||||
}
|
||||
|
||||
private Integer getNextIdRiga() {
|
||||
@@ -101,7 +103,7 @@ public class DocInterniEditFormViewModel {
|
||||
|
||||
public void exportDocument() {
|
||||
this.sendOnLoadingStarted();
|
||||
docInterniRESTConsumer.saveDoc(this.getSaveDto(), obj -> {
|
||||
docInterniRESTConsumer.saveDoc(this.getSaveDto(), () -> {
|
||||
SqlMtbColt document = this.getDocument();
|
||||
document.setCodDtip(document.getCodDtipProvv());
|
||||
mtbColtRepository.update(document, doc -> {
|
||||
@@ -113,45 +115,59 @@ public class DocInterniEditFormViewModel {
|
||||
|
||||
public void deleteDocument() {
|
||||
this.sendOnLoadingStarted();
|
||||
docInterniRESTConsumer.saveDoc(this.getSaveDto(), obj -> {
|
||||
SqlMtbColt document = this.getDocument();
|
||||
document.setCodDtip(document.getCodDtipProvv());
|
||||
mtbColtRepository.update(document, doc -> {
|
||||
mtbColtRepository.delete(document, () -> {
|
||||
this.sendOnLoadingEnded();
|
||||
this.listener.onDocExported();
|
||||
this.listener.onDocDeleted();
|
||||
}, this::sendError);
|
||||
}, this::sendError);
|
||||
}
|
||||
|
||||
public void holdDocument() {
|
||||
this.listener.onDocumentHoldRequest();
|
||||
}
|
||||
|
||||
public void onSearch(String search) {
|
||||
GrigliaAcquistiChildDTO articolo = this.searchArticolo(search);
|
||||
if (articolo == null) {
|
||||
this.sendError(new NoResultFromBarcodeException());
|
||||
public void loadArticolo(String barcodeProd) {
|
||||
DocumentoArtDTO matchedArt;
|
||||
String usedBarcode = null;
|
||||
|
||||
String leftBarcode = StringUtils.leftPad(barcodeProd, 13, '0');
|
||||
|
||||
matchedArt = Stream.of(productsList)
|
||||
.filter(x -> x.getCodMart().equalsIgnoreCase(barcodeProd) ||
|
||||
leftBarcode.equalsIgnoreCase(x.getCodMart()) ||
|
||||
x.getBarcode().contains(barcodeProd))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
|
||||
if (matchedArt != null)
|
||||
usedBarcode = matchedArt.getBarcode().contains(barcodeProd) ? barcodeProd : null;
|
||||
|
||||
|
||||
|
||||
if (matchedArt == null) {
|
||||
this.sendError(new NoResultFromBarcodeException(barcodeProd));
|
||||
return;
|
||||
}
|
||||
List<SqlMtbColr> rows = this.getRowsForArticolo(articolo);
|
||||
if (rows.isEmpty()) {
|
||||
this.sendError(new NoResultFromBarcodeException());
|
||||
}
|
||||
|
||||
List<SqlMtbColr> rows = this.getRowsForArticolo(matchedArt, usedBarcode);
|
||||
|
||||
if (rows.size() > 1) {
|
||||
this.listener.onMultipleRowsFound(rows, articolo);
|
||||
this.listener.onMultipleRowsFound(rows, matchedArt);
|
||||
} else {
|
||||
this.editRow(rows.get(0), (articolo.getFlagTracciabilita().equalsIgnoreCase("S")));
|
||||
this.dispatchRowEdit(rows.get(0), matchedArt.isFlagTracciabilita(), matchedArt.isUntMisDigitale());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private List<SqlMtbColr> getRowsForArticolo(GrigliaAcquistiChildDTO articolo) {
|
||||
private List<SqlMtbColr> getRowsForArticolo(DocumentoArtDTO articolo, String barcode) {
|
||||
List<SqlMtbColr> docRows = this.docRows.getValue();
|
||||
if (docRows == null) {
|
||||
docRows = new ArrayList<>();
|
||||
}
|
||||
SqlMtbColt document = this.document.getValue();
|
||||
SqlMtbColr row = new SqlMtbColr();
|
||||
|
||||
row.setIdCollo(document.getId());
|
||||
row.setRiga(getNextIdRiga());
|
||||
row.setCodMart(articolo.getCodMart());
|
||||
@@ -161,24 +177,18 @@ public class DocInterniEditFormViewModel {
|
||||
row.setDataCollo(document.getDataCollo());
|
||||
row.setDescrizione(articolo.getDescrizione());
|
||||
row.setUntMis(articolo.getUntMis());
|
||||
row.setCodBarre(articolo.getBarcode());
|
||||
row.setCodBarre(barcode);
|
||||
row.setQtaCnf(articolo.getQtaCnf().floatValue());
|
||||
row.setNumCnf(0f);
|
||||
row.setQtaCol(0f);
|
||||
List<SqlMtbColr> rows = Stream.of(docRows).filter(docRow -> docRow.getCodMart().equalsIgnoreCase(articolo.getCodMart())).toList();
|
||||
|
||||
List<SqlMtbColr> rows = Stream.of(docRows)
|
||||
.filter(docRow -> docRow.getCodMart().equalsIgnoreCase(articolo.getCodMart()))
|
||||
.toList();
|
||||
rows.add(row);
|
||||
return rows;
|
||||
}
|
||||
|
||||
private GrigliaAcquistiChildDTO searchArticolo(String filter) {
|
||||
return Stream.of(this.productsList).filter(dto ->
|
||||
filter.equalsIgnoreCase(dto.getCodMart())
|
||||
|| filter.equalsIgnoreCase(dto.getBarcode())
|
||||
|| StringUtils.leftPad(filter, 13, '0').equalsIgnoreCase(dto.getCodMart())
|
||||
|| StringUtils.leftPad(filter, 13, '0').equalsIgnoreCase(dto.getBarcode())
|
||||
).findFirstOrElse(null);
|
||||
}
|
||||
|
||||
private SaveDTO getSaveDto() {
|
||||
SqlMtbColt document = this.getDocument();
|
||||
SaveDTO saveDTO = new SaveDTO();
|
||||
@@ -254,17 +264,20 @@ public class DocInterniEditFormViewModel {
|
||||
return document.getValue();
|
||||
}
|
||||
|
||||
public List<GrigliaAcquistiChildDTO> getProductsList() {
|
||||
return productsList;
|
||||
}
|
||||
|
||||
public void setProductsList(List<GrigliaAcquistiChildDTO> productsList) {
|
||||
public void setProductsList(List<DocumentoArtDTO> productsList) {
|
||||
this.productsList = productsList;
|
||||
this.flattedBarcodesCodMarts = new HashMap<>();
|
||||
|
||||
for (DocumentoArtDTO documentArt : productsList) {
|
||||
for (String barcode : documentArt.getBarcode()) {
|
||||
this.flattedBarcodesCodMarts.put(barcode, documentArt.getCodMart());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void processBarcode(BarcodeScanDTO dto) {
|
||||
String code = dto.getStringValue();
|
||||
this.onSearch(code);
|
||||
this.loadArticolo(code);
|
||||
}
|
||||
|
||||
public void saveRow(SqlMtbColr row, DialogInputQuantityV2ResultDTO resultDTO) {
|
||||
@@ -298,11 +311,13 @@ public class DocInterniEditFormViewModel {
|
||||
return this.docRows.getValue();
|
||||
}
|
||||
|
||||
public GrigliaAcquistiChildDTO getArticoloByCodMart(String codMart) {
|
||||
return Stream.of(productsList).filter(prod -> prod.getCodMart().equalsIgnoreCase(codMart)).findFirstOrElse(null);
|
||||
public DocumentoArtDTO getArticoloByCodMart(String codMart) {
|
||||
return Stream.of(productsList)
|
||||
.filter(prod -> prod.getCodMart().equalsIgnoreCase(codMart))
|
||||
.findFirstOrElse(null);
|
||||
}
|
||||
|
||||
public DocInterniEditFormViewModel setTipoDoc(TipiDocDTO docType) {
|
||||
public DocInterniEditFormViewModel setTipoDoc(TipoDocDTO docType) {
|
||||
this.tipoDoc = docType;
|
||||
return this;
|
||||
}
|
||||
@@ -317,12 +332,14 @@ public class DocInterniEditFormViewModel {
|
||||
|
||||
void onRowsChanged(List<SqlMtbColr> rows);
|
||||
|
||||
void onEditRowRequest(SqlMtbColr row, boolean flagTracciabilita);
|
||||
void onEditRowRequest(SqlMtbColr row, boolean flagTracciabilita, boolean isUntMisDig);
|
||||
|
||||
void onMultipleRowsFound(List<SqlMtbColr> rows, GrigliaAcquistiChildDTO articolo);
|
||||
void onMultipleRowsFound(List<SqlMtbColr> rows, DocumentoArtDTO art);
|
||||
|
||||
void onDocumentHoldRequest();
|
||||
|
||||
void onDocDeleted();
|
||||
|
||||
void onDocExported();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package it.integry.integrywmsnative.gest.contab_doc_interni.rest;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import it.integry.integrywmsnative.core.exception.RestException;
|
||||
@@ -11,7 +9,6 @@ import it.integry.integrywmsnative.core.rest.consumers.MagazzinoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers._BaseRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
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.dto.SaveDTO;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
@@ -41,23 +38,8 @@ public class DocInterniRESTConsumer extends _BaseRESTConsumer {
|
||||
});
|
||||
}
|
||||
|
||||
public void fetchProducts(String codDtip, String codMgrp, RunnableArgs<GrigliaArticoliDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
DocInterniRESTConsumerService service = RESTBuilder.getService(DocInterniRESTConsumerService.class);
|
||||
service.retrieveProducts(codDtip, codMgrp, "L").enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<GrigliaArticoliDTO>> call, Response<ServiceRESTResponse<GrigliaArticoliDTO>> response) {
|
||||
analyzeAnswer(response, "fetchProducts", onComplete, onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<GrigliaArticoliDTO>> call, Throwable t) {
|
||||
onFailed.run(new RestException(t.getMessage()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public void saveDoc(SaveDTO saveDTO, RunnableArgs<JsonObject> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public void saveDoc(SaveDTO saveDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
magazzinoRESTConsumer.saveTerminalinoWMS(saveDTO, onComplete, onFailed);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,10 +2,8 @@ package it.integry.integrywmsnative.gest.contab_doc_interni.rest;
|
||||
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.DocInterniSetupDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.GrigliaArticoliDTO;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
|
||||
public interface DocInterniRESTConsumerService {
|
||||
@@ -13,11 +11,4 @@ public interface DocInterniRESTConsumerService {
|
||||
@GET("getDocInterniSetup")
|
||||
Call<ServiceRESTResponse<DocInterniSetupDTO>> getSetupDocInterni();
|
||||
|
||||
|
||||
@GET("getElencoArticoli")
|
||||
Call<ServiceRESTResponse<GrigliaArticoliDTO>> retrieveProducts(
|
||||
@Query("codDtip") String codDtip,
|
||||
@Query("codMgrp") String codMgrp,
|
||||
@Query("gestione") String gestione);
|
||||
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.widget.AppCompatTextView;
|
||||
import androidx.databinding.ObservableField;
|
||||
|
||||
import com.ravikoradiya.liveadapter.LiveAdapter;
|
||||
import com.ravikoradiya.liveadapter.Type;
|
||||
@@ -25,6 +26,7 @@ import it.integry.integrywmsnative.core.expansion.RunnableArgss;
|
||||
import it.integry.integrywmsnative.core.interfaces.ILifecycleFragment;
|
||||
import it.integry.integrywmsnative.core.interfaces.ITitledFragment;
|
||||
import it.integry.integrywmsnative.core.rest.model.inventario.InventarioArtDTO;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.databinding.FragmentElencoInventarioBinding;
|
||||
import it.integry.integrywmsnative.databinding.FragmentElencoInventarioListSingleItemBinding;
|
||||
import it.integry.integrywmsnative.gest.inventario.bottom_sheet__inventario_actions.BottomSheetInventarioActionsView;
|
||||
@@ -39,6 +41,8 @@ public class ElencoInventariFragment extends BaseFragment implements ITitledFrag
|
||||
@Inject
|
||||
ElencoInventariViewModel mViewModel;
|
||||
|
||||
public ObservableField<Boolean> canCreateInventario = new ObservableField<>(false);
|
||||
|
||||
private int barcodeScannerIstanceID = -1;
|
||||
|
||||
public ElencoInventariFragment() {
|
||||
@@ -65,11 +69,20 @@ public class ElencoInventariFragment extends BaseFragment implements ITitledFrag
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
setRetainInstance(true);
|
||||
mBinding = FragmentElencoInventarioBinding.inflate(inflater, container, false);
|
||||
|
||||
mBinding.setLifecycleOwner(this);
|
||||
mBinding.setView(this);
|
||||
mBinding.setViewmodel(mViewModel);
|
||||
|
||||
canCreateInventario.set(SettingsManager.iDB().isFlagCanCreateInventario());
|
||||
|
||||
mBinding.swiperefresh.setRefreshing(true);
|
||||
mBinding.swiperefresh.setOnRefreshListener(() -> {
|
||||
mViewModel.loadData();
|
||||
});
|
||||
|
||||
mViewModel.loadData();
|
||||
this.initRecyclerView();
|
||||
|
||||
@@ -143,6 +156,22 @@ public class ElencoInventariFragment extends BaseFragment implements ITitledFrag
|
||||
startPicking(inventarioRoomDTO, listaArts);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInventoriesLoadingStarted() {
|
||||
mBinding.swiperefresh.setRefreshing(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInventoriesLoadingEnded() {
|
||||
mBinding.swiperefresh.setRefreshing(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInventoriesLoadingError(Exception ex) {
|
||||
mBinding.swiperefresh.setRefreshing(false);
|
||||
this.onError(ex);
|
||||
}
|
||||
|
||||
|
||||
private void startPicking(InventarioRoomDTO inventarioRoomDTO, List<InventarioArtDTO> listArts) {
|
||||
PickingInventarioActivity.startActivity(requireContext(), inventarioRoomDTO, listArts);
|
||||
|
||||
@@ -40,7 +40,10 @@ public class ElencoInventariViewModel {
|
||||
}
|
||||
|
||||
public void loadData() {
|
||||
inventarioList = inventarioRepository.retrieve();
|
||||
inventarioList = inventarioRepository.retrieve(
|
||||
this::sendOnInventoriesLoadingEnded,
|
||||
this::sendOnInventoriesLoadingError
|
||||
);
|
||||
}
|
||||
|
||||
public void destroyData() {
|
||||
@@ -146,16 +149,34 @@ public class ElencoInventariViewModel {
|
||||
if (this.listener != null) listener.onLoadingEnded();
|
||||
}
|
||||
|
||||
private void sendOnInventoriesLoadingStarted() {
|
||||
if (this.listener != null) listener.onInventoriesLoadingStarted();
|
||||
}
|
||||
|
||||
private void sendOnInventoriesLoadingEnded() {
|
||||
if (this.listener != null) listener.onInventoriesLoadingEnded();
|
||||
}
|
||||
|
||||
private void sendOnError(Exception ex) {
|
||||
if (this.listener != null) listener.onError(ex);
|
||||
}
|
||||
|
||||
private void sendOnInventoriesLoadingError(Exception ex) {
|
||||
if (this.listener != null) listener.onInventoriesLoadingError(ex);
|
||||
}
|
||||
|
||||
public interface Listener extends ILoadingListener {
|
||||
|
||||
void onInventarioInfoRequest(RunnableArgss<Long, String> onComplete);
|
||||
|
||||
void onInventarioLoaded(InventarioRoomDTO inventarioRoomDTO, List<InventarioArtDTO> listaArts);
|
||||
|
||||
void onInventoriesLoadingStarted();
|
||||
|
||||
void onInventoriesLoadingEnded();
|
||||
|
||||
void onInventoriesLoadingError(Exception ex);
|
||||
|
||||
void onCreateInventarioRequest(long inventoryId, String zone);
|
||||
|
||||
void onError(Exception ex);
|
||||
|
||||
@@ -75,6 +75,7 @@ public class PickingInventarioActivity extends BaseActivity implements PickingIn
|
||||
getMenuInflater().inflate(R.menu.picking_inventario_menu, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -91,18 +92,19 @@ public class PickingInventarioActivity extends BaseActivity implements PickingIn
|
||||
mViewModel.setListener(this);
|
||||
mBindings.setViewmodel(mViewModel);
|
||||
|
||||
mViewModel.init(
|
||||
DataCache.retrieveItem(getIntent().getStringExtra(KEY_INVENTARIO)),
|
||||
DataCache.retrieveItem(getIntent().getStringExtra(KEY_INVENTARIO_ARTS)));
|
||||
|
||||
initToolbar();
|
||||
initBarcodeReader();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
|
||||
mViewModel.init(
|
||||
DataCache.retrieveItem(getIntent().getStringExtra(KEY_INVENTARIO)),
|
||||
DataCache.retrieveItem(getIntent().getStringExtra(KEY_INVENTARIO_ARTS)));
|
||||
|
||||
initRecyclerView();
|
||||
}
|
||||
|
||||
@@ -112,6 +114,12 @@ public class PickingInventarioActivity extends BaseActivity implements PickingIn
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
BarcodeManager.removeCallback(barcodeScannerIstanceID);
|
||||
super.onBackPressed();
|
||||
}
|
||||
|
||||
private void initToolbar() {
|
||||
setSupportActionBar(mBindings.toolbar);
|
||||
|
||||
@@ -183,7 +191,8 @@ public class PickingInventarioActivity extends BaseActivity implements PickingIn
|
||||
|
||||
public void requestExportConfirm() {
|
||||
DialogYesNoView.newInstance("Esporta", "Vuoi confermare e chiudere l'inventario?", result -> {
|
||||
mViewModel.exportAll(this::onBackPressed);
|
||||
if (result == DialogConsts.Results.YES)
|
||||
mViewModel.exportAll(this::onBackPressed);
|
||||
})
|
||||
.show(getSupportFragmentManager(), "tag");
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ public class PickingInventarioViewModel extends ViewModel {
|
||||
|
||||
public void processBarcodeDTO(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
||||
if (UtilityBarcode.isEanPeso(barcodeScanDTO)) {
|
||||
//Cerco tramite etichetta ean 128 (che può indicarmi un articolo o una UL)
|
||||
//Cerco tramite etichetta ean peso
|
||||
this.executeEtichettaEanPeso(barcodeScanDTO, onComplete);
|
||||
|
||||
} else {
|
||||
@@ -111,6 +111,11 @@ public class PickingInventarioViewModel extends ViewModel {
|
||||
|
||||
|
||||
public void exportAll(Runnable onComplete) {
|
||||
if(this.currentInventarioRows.getValue().isEmpty()) {
|
||||
this.sendError(new Exception("Impossibile esportare un inventario senza righe"));
|
||||
return;
|
||||
}
|
||||
|
||||
this.sendOnLoadingStarted();
|
||||
currentInventario.getValue().setInventarioRowList(this.currentInventarioRows.getValue());
|
||||
|
||||
|
||||
@@ -98,14 +98,14 @@ public class LoginActivity extends BaseActivity implements LoginViewModel.Listen
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoginCompleted(String host, int port, String fullName, List<String> availableProfiles) {
|
||||
public void onLoginCompleted(String protocol, String host, int port, String fullName, List<String> availableProfiles) {
|
||||
|
||||
this.onLoadingEnded();
|
||||
runOnUiThread(() -> DialogSimpleMessageView.makeSuccessDialog(
|
||||
"Benvenuto",
|
||||
Html.fromHtml("Ciao <b>" + fullName + "</b>, la Integry le augura di svolgere al meglio il suo lavoro"),
|
||||
null,
|
||||
() -> showProfileDBSelectionDialog(host, port, availableProfiles))
|
||||
() -> showProfileDBSelectionDialog(protocol, host, port, availableProfiles))
|
||||
.show(getSupportFragmentManager(), "tag"));
|
||||
|
||||
}
|
||||
@@ -117,7 +117,7 @@ public class LoginActivity extends BaseActivity implements LoginViewModel.Listen
|
||||
loginButtonEnabled.set(true);
|
||||
}
|
||||
|
||||
private void showProfileDBSelectionDialog(final String host, final int port, final List<String> availableProfiles) {
|
||||
private void showProfileDBSelectionDialog(final String protocol, final String host, final int port, final List<String> availableProfiles) {
|
||||
Runnable onComplete = () -> {
|
||||
SettingsManager.update();
|
||||
|
||||
@@ -129,7 +129,7 @@ public class LoginActivity extends BaseActivity implements LoginViewModel.Listen
|
||||
if (availableProfiles != null && availableProfiles.size() == 1) {
|
||||
SettingsManager.i().getUserSession().setProfileDB(availableProfiles.get(0));
|
||||
|
||||
mViewmodel.loadDepo(codAzienda.get(), host, port, username.get(), password.get(), onComplete);
|
||||
mViewmodel.loadDepo(codAzienda.get(), protocol, host, port, username.get(), password.get(), onComplete);
|
||||
} else {
|
||||
|
||||
// setup the alert builder
|
||||
@@ -144,7 +144,7 @@ public class LoginActivity extends BaseActivity implements LoginViewModel.Listen
|
||||
builder.setItems(profiles, (dialog, which) -> {
|
||||
SettingsManager.i().getUserSession().setProfileDB(availableProfiles.get(which));
|
||||
|
||||
mViewmodel.loadDepo(codAzienda.get(), host, port, username.get(), password.get(), onComplete);
|
||||
mViewmodel.loadDepo(codAzienda.get(), protocol, host, port, username.get(), password.get(), onComplete);
|
||||
});
|
||||
|
||||
// create and show the alert dialog
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
package it.integry.integrywmsnative.gest.login.dto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class LoginDTO {
|
||||
|
||||
private String full_name;
|
||||
private List<String> availableProfiles;
|
||||
|
||||
public String getFull_name() {
|
||||
return full_name;
|
||||
}
|
||||
|
||||
public LoginDTO setFull_name(String full_name) {
|
||||
this.full_name = full_name;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<String> getAvailableProfiles() {
|
||||
return availableProfiles;
|
||||
}
|
||||
|
||||
public LoginDTO setAvailableProfiles(List<String> availableProfiles) {
|
||||
this.availableProfiles = availableProfiles;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user