Compare commits
179 Commits
v1.47.03(5
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 2f54b375b9 | |||
| 9aa9b9121f | |||
| 268ce9fce9 | |||
| 4861d53031 | |||
| e27a4e840a | |||
| cc67ac5f47 | |||
| 8e2d110792 | |||
| 9924165362 | |||
| 0904388ffe | |||
| f86296d2a1 | |||
| 4d01a52590 | |||
| 638e8650ee | |||
| 36061faeeb | |||
| a88ddab405 | |||
| 9fb18215e3 | |||
| 2e3af6d1b3 | |||
| 663d172edf | |||
| 092fbd69b6 | |||
| 878584a619 | |||
| 5d52e2df46 | |||
| 809d4ef5af | |||
| faa45cd096 | |||
| 1ab9b10a13 | |||
| cce4d2dbb2 | |||
| db246e6a94 | |||
| 37ce428bf0 | |||
| bb1867b1c8 | |||
| c104313d89 | |||
| c8cc56bfd6 | |||
| 80b5b8db34 | |||
| e0b86db09d | |||
| 9d871f3ae4 | |||
| e025b234a7 | |||
| 809ef43445 | |||
| 1079c38a5f | |||
| f6388eff1c | |||
| 495a8dae92 | |||
| ed938815bb | |||
| 539e8b7c31 | |||
| 92da8cde53 | |||
| 3d0f7f16f9 | |||
| 501ca404ff | |||
| 5ad4fd7821 | |||
| 1ba2fb96ba | |||
| ffdd1a1df5 | |||
| 0205255f7d | |||
| c21e856a0f | |||
| b673940dd6 | |||
| b0ce11cbf7 | |||
| 4ef2c209c8 | |||
| 41d77b806f | |||
| 6b65c4a570 | |||
| 4d5c0e5509 | |||
| 21af5fc0a9 | |||
| 09b984f5d0 | |||
| dd473412cc | |||
| 4f0c5bf6dd | |||
| 90e4e2e464 | |||
| 50e2605ea5 | |||
| 4752e3a3a2 | |||
| 3fe903cc12 | |||
| 3f95a70039 | |||
| 067443698a | |||
| 990a4d1538 | |||
| 55c16e602d | |||
| 6097a7f736 | |||
| f8b92901fd | |||
| 6c6daa4809 | |||
| de8b48d938 | |||
| bfa69ca78b | |||
| bffb471015 | |||
| 087e3e261c | |||
| 2eff03dee6 | |||
| fc34a555bd | |||
| 0bf21c046f | |||
| 473ed536fb | |||
| dc342c1fee | |||
| 81507938b1 | |||
| cff52140bd | |||
| 24d90b58f9 | |||
| b5d049aa1d | |||
| 01028f9888 | |||
| 2774eaecbf | |||
| 648a572752 | |||
| 022a56a584 | |||
| ea97e8f249 | |||
| 571ad1590f | |||
| 03c02d6625 | |||
| ba1118fdd8 | |||
| 7878748548 | |||
| 172a8256b6 | |||
| c16f5c1747 | |||
| 33860a0cfe | |||
| 15a946dfb6 | |||
| 62adf49157 | |||
| 64fcb7ccc8 | |||
| 3ebdc72642 | |||
| aacf5ca76e | |||
| 4f134bfc8e | |||
| 6bd1e62190 | |||
| f9f02452d7 | |||
| b653ae39af | |||
| 63d1d9ecf0 | |||
| 9c72a2a628 | |||
| 5f1b7ef4a4 | |||
| c36bc9d8c2 | |||
| ba9da26ca0 | |||
| b2ad4fdb62 | |||
| 60e725f554 | |||
| 2f6f9b54c2 | |||
| a2ef35e353 | |||
| b06f058ecf | |||
| e67cbd3760 | |||
| ce9d304043 | |||
| fc30b8253d | |||
| e8da16cb8a | |||
| dff725ea92 | |||
| e4248c8c48 | |||
| 819cc97113 | |||
| 05d806f9f2 | |||
| 6fdadffe77 | |||
| 5ae9371c51 | |||
| 4861c689d7 | |||
| 1c63908b3b | |||
| a622e89058 | |||
| ac4500e2a2 | |||
| 6ebcbc2d6c | |||
| 150be3cae2 | |||
| 72edf5228a | |||
| b72a3321d9 | |||
| 5bf71a1b0c | |||
| ee10427048 | |||
| 7fb7cbf8ec | |||
| 3a43e9238b | |||
| 007d58a17e | |||
| 998a59cffc | |||
| 11b353a91d | |||
| 8772d11e02 | |||
| 3d772e3722 | |||
| 41cfbc273e | |||
| bc67098ae0 | |||
| 0e49c93678 | |||
| ed93b88ee8 | |||
| 2cb184f24b | |||
| 126846aef2 | |||
| 8ac595c6c5 | |||
| fc2c0fbe0c | |||
| 0aa0b09afa | |||
| 9436236eaa | |||
| fc5568a046 | |||
| 590e9ec24e | |||
| 984a4a156b | |||
| 04afb4cfca | |||
| 81eda94fe0 | |||
| 8f02dfbee4 | |||
| 75e1447a54 | |||
| d8f9886f82 | |||
| 3279c4e2af | |||
| 6f070e6998 | |||
| df4bfcc955 | |||
| c1983cf73c | |||
| da9bbd0b1c | |||
| cd84d3e9a8 | |||
| 595f4a8797 | |||
| 388f08a02f | |||
| c562735661 | |||
| ab137ad828 | |||
| b56f209084 | |||
| 5107897888 | |||
| d91eaf3412 | |||
| caa6a7cd75 | |||
| 567b288e4d | |||
| 86121bfa93 | |||
| 669a38732f | |||
| e3e7a7d7c6 | |||
| 75914ab9c9 | |||
| d1976f3e21 | |||
| 5ef5c4b28a | |||
| 2c3d4bbc22 |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -149,3 +149,6 @@ crashlytics.properties
|
|||||||
crashlytics-build.properties
|
crashlytics-build.properties
|
||||||
### AndroidStudio Patch ###
|
### AndroidStudio Patch ###
|
||||||
!/gradle/wrapper/gradle-wrapper.jar
|
!/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
copilot.*.xml
|
||||||
|
/.idea/dataSources.xml
|
||||||
4
.idea/deploymentTargetSelector.xml
generated
4
.idea/deploymentTargetSelector.xml
generated
@@ -4,10 +4,10 @@
|
|||||||
<selectionStates>
|
<selectionStates>
|
||||||
<SelectionState runConfigName="app">
|
<SelectionState runConfigName="app">
|
||||||
<option name="selectionMode" value="DROPDOWN" />
|
<option name="selectionMode" value="DROPDOWN" />
|
||||||
<DropdownSelection timestamp="2025-05-14T09:45:15.341614500Z">
|
<DropdownSelection timestamp="2025-10-02T11:26:10.944286600Z">
|
||||||
<Target type="DEFAULT_BOOT">
|
<Target type="DEFAULT_BOOT">
|
||||||
<handle>
|
<handle>
|
||||||
<DeviceId pluginId="PhysicalDevice" identifier="serial=23324B682F" />
|
<DeviceId pluginId="PhysicalDevice" identifier="serial=7da0808" />
|
||||||
</handle>
|
</handle>
|
||||||
</Target>
|
</Target>
|
||||||
</DropdownSelection>
|
</DropdownSelection>
|
||||||
|
|||||||
11
.idea/runConfigurations/app.xml
generated
11
.idea/runConfigurations/app.xml
generated
@@ -1,6 +1,7 @@
|
|||||||
<component name="ProjectRunConfigurationManager">
|
<component name="ProjectRunConfigurationManager">
|
||||||
<configuration default="false" name="app" type="AndroidRunConfigurationType" factoryName="Android App">
|
<configuration default="false" name="app" type="AndroidRunConfigurationType" factoryName="Android App">
|
||||||
<module name="WMS.app.main" />
|
<module name="WMS.app" />
|
||||||
|
<option name="ANDROID_RUN_CONFIGURATION_SCHEMA_VERSION" value="1" />
|
||||||
<option name="DEPLOY" value="true" />
|
<option name="DEPLOY" value="true" />
|
||||||
<option name="DEPLOY_APK_FROM_BUNDLE" value="false" />
|
<option name="DEPLOY_APK_FROM_BUNDLE" value="false" />
|
||||||
<option name="DEPLOY_AS_INSTANT" value="false" />
|
<option name="DEPLOY_AS_INSTANT" value="false" />
|
||||||
@@ -8,14 +9,17 @@
|
|||||||
<option name="PM_INSTALL_OPTIONS" value="" />
|
<option name="PM_INSTALL_OPTIONS" value="" />
|
||||||
<option name="ALL_USERS" value="false" />
|
<option name="ALL_USERS" value="false" />
|
||||||
<option name="ALWAYS_INSTALL_WITH_PM" value="false" />
|
<option name="ALWAYS_INSTALL_WITH_PM" value="false" />
|
||||||
|
<option name="ALLOW_ASSUME_VERIFIED" value="false" />
|
||||||
<option name="CLEAR_APP_STORAGE" value="false" />
|
<option name="CLEAR_APP_STORAGE" value="false" />
|
||||||
<option name="DYNAMIC_FEATURES_DISABLED_LIST" value="" />
|
<option name="DYNAMIC_FEATURES_DISABLED_LIST" value="" />
|
||||||
<option name="ACTIVITY_EXTRA_FLAGS" value="" />
|
<option name="ACTIVITY_EXTRA_FLAGS" value="" />
|
||||||
<option name="MODE" value="default_activity" />
|
<option name="MODE" value="default_activity" />
|
||||||
|
<option name="RESTORE_ENABLED" value="false" />
|
||||||
|
<option name="RESTORE_FILE" value="" />
|
||||||
|
<option name="RESTORE_FRESH_INSTALL_ONLY" value="false" />
|
||||||
<option name="CLEAR_LOGCAT" value="false" />
|
<option name="CLEAR_LOGCAT" value="false" />
|
||||||
<option name="SHOW_LOGCAT_AUTOMATICALLY" value="false" />
|
<option name="SHOW_LOGCAT_AUTOMATICALLY" value="false" />
|
||||||
<option name="INSPECTION_WITHOUT_ACTIVITY_RESTART" value="false" />
|
<option name="TARGET_SELECTION_MODE" value="DEVICE_AND_SNAPSHOT_COMBO_BOX" />
|
||||||
<option name="TARGET_SELECTION_MODE" value="SHOW_DIALOG" />
|
|
||||||
<option name="SELECTED_CLOUD_MATRIX_CONFIGURATION_ID" value="-1" />
|
<option name="SELECTED_CLOUD_MATRIX_CONFIGURATION_ID" value="-1" />
|
||||||
<option name="SELECTED_CLOUD_MATRIX_PROJECT_ID" value="" />
|
<option name="SELECTED_CLOUD_MATRIX_PROJECT_ID" value="" />
|
||||||
<option name="DEBUGGER_TYPE" value="Auto" />
|
<option name="DEBUGGER_TYPE" value="Auto" />
|
||||||
@@ -59,6 +63,7 @@
|
|||||||
<option name="NATIVE_MEMORY_SAMPLE_RATE_BYTES" value="2048" />
|
<option name="NATIVE_MEMORY_SAMPLE_RATE_BYTES" value="2048" />
|
||||||
</Profilers>
|
</Profilers>
|
||||||
<option name="DEEP_LINK" value="" />
|
<option name="DEEP_LINK" value="" />
|
||||||
|
<option name="ACTIVITY" value="" />
|
||||||
<option name="ACTIVITY_CLASS" value="" />
|
<option name="ACTIVITY_CLASS" value="" />
|
||||||
<option name="SEARCH_ACTIVITY_IN_GLOBAL_SCOPE" value="false" />
|
<option name="SEARCH_ACTIVITY_IN_GLOBAL_SCOPE" value="false" />
|
||||||
<option name="SKIP_ACTIVITY_VALIDATION" value="false" />
|
<option name="SKIP_ACTIVITY_VALIDATION" value="false" />
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ pipeline {
|
|||||||
|
|
||||||
stage('Publish') {
|
stage('Publish') {
|
||||||
steps {
|
steps {
|
||||||
azureUpload allowAnonymousAccess: true, fileShareName: 'storage-ci', filesPath: 'app/build/outputs/apk/release/*', removePrefixPath: 'app/build/outputs/apk/release/', storageCredentialId: '83a86793-c1d6-4776-b20f-1ff652a57fee', storageType: 'filestorage', uploadArtifactsOnlyIfSuccessful: true, verbose: true, virtualPath: 'wms'
|
azureUpload allowAnonymousAccess: true, fileShareName: 'storage-ci', filesPath: 'app/build/outputs/apk/release/*.apk,app/build/outputs/apk/release/*.txt', removePrefixPath: 'app/build/outputs/apk/release/', storageCredentialId: '83a86793-c1d6-4776-b20f-1ff652a57fee', storageType: 'filestorage', uploadArtifactsOnlyIfSuccessful: true, verbose: true, virtualPath: 'wms'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -49,21 +49,21 @@ pipeline {
|
|||||||
bat 'curl -k "https://services.studioml.it/ems-api/updateWMSApp?overrideForced=false"'
|
bat 'curl -k "https://services.studioml.it/ems-api/updateWMSApp?overrideForced=false"'
|
||||||
bat 'curl -k "https://services.studioml.it/ems-api/updateWMSApp?overrideForced=false&suffix=beta"'
|
bat 'curl -k "https://services.studioml.it/ems-api/updateWMSApp?overrideForced=false&suffix=beta"'
|
||||||
if (env.GIT_BRANCH == "master" || env.GIT_BRANCH == "master-beta") {
|
if (env.GIT_BRANCH == "master" || env.GIT_BRANCH == "master-beta") {
|
||||||
office365ConnectorSend adaptiveCards: true, color: '#008000', message: 'WMS è stato compilato con successo', status: 'SUCCESS', webhookUrl: 'https://prod-89.westeurope.logic.azure.com:443/workflows/260580715a9d4447a54dea861a865536/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=EMqPHohvE5o5IGj_gir_iQaAufR4r8ZJxlFx52jklSE'
|
office365ConnectorSend adaptiveCards: true, color: '#008000', message: 'WMS è stato compilato con successo', status: 'SUCCESS', webhookUrl: 'https://default0b9c060c159c4e5f82a77459a72572.16.environment.api.powerplatform.com:443/powerautomate/automations/direct/workflows/a73f903a4044474c84ad9a0d68a9a479/triggers/manual/paths/invoke?api-version=1&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=gXc43FQXqIq7Xpfvis2XgFoPl8lpg0Sf5HtuxZG_jeI'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
unstable {
|
unstable {
|
||||||
script {
|
script {
|
||||||
if (env.GIT_BRANCH == "master" || env.GIT_BRANCH == "master-beta") {
|
if (env.GIT_BRANCH == "master" || env.GIT_BRANCH == "master-beta") {
|
||||||
office365ConnectorSend adaptiveCards: true, color: '#FFDE21', message: 'WMS è INSTABILE', status: 'UNSTABLE', webhookUrl: 'https://prod-89.westeurope.logic.azure.com:443/workflows/260580715a9d4447a54dea861a865536/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=EMqPHohvE5o5IGj_gir_iQaAufR4r8ZJxlFx52jklSE'
|
office365ConnectorSend adaptiveCards: true, color: '#FFDE21', message: 'WMS è INSTABILE', status: 'UNSTABLE', webhookUrl: 'https://default0b9c060c159c4e5f82a77459a72572.16.environment.api.powerplatform.com:443/powerautomate/automations/direct/workflows/a73f903a4044474c84ad9a0d68a9a479/triggers/manual/paths/invoke?api-version=1&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=gXc43FQXqIq7Xpfvis2XgFoPl8lpg0Sf5HtuxZG_jeI'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
failure {
|
failure {
|
||||||
script {
|
script {
|
||||||
if (env.GIT_BRANCH == "master" || env.GIT_BRANCH == "master-beta") {
|
if (env.GIT_BRANCH == "master" || env.GIT_BRANCH == "master-beta") {
|
||||||
office365ConnectorSend adaptiveCards: true, color: '#FF2C2C', message: 'Errore di compilazione su WMS', status: 'FAILURE', webhookUrl: 'https://prod-89.westeurope.logic.azure.com:443/workflows/260580715a9d4447a54dea861a865536/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=EMqPHohvE5o5IGj_gir_iQaAufR4r8ZJxlFx52jklSE'
|
office365ConnectorSend adaptiveCards: true, color: '#FF2C2C', message: 'Errore di compilazione su WMS', status: 'FAILURE', webhookUrl: 'https://default0b9c060c159c4e5f82a77459a72572.16.environment.api.powerplatform.com:443/powerautomate/automations/direct/workflows/a73f903a4044474c84ad9a0d68a9a479/triggers/manual/paths/invoke?api-version=1&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=gXc43FQXqIq7Xpfvis2XgFoPl8lpg0Sf5HtuxZG_jeI'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,10 +8,11 @@ apply plugin: 'com.google.firebase.crashlytics'
|
|||||||
//apply plugin: 'kotlin-android'
|
//apply plugin: 'kotlin-android'
|
||||||
apply plugin: 'com.google.gms.google-services'
|
apply plugin: 'com.google.gms.google-services'
|
||||||
|
|
||||||
|
|
||||||
android {
|
android {
|
||||||
|
|
||||||
def appVersionCode = 516
|
def appVersionCode = 553
|
||||||
def appVersionName = '1.47.03'
|
def appVersionName = '1.50.04'
|
||||||
|
|
||||||
signingConfigs {
|
signingConfigs {
|
||||||
release {
|
release {
|
||||||
@@ -34,7 +35,7 @@ android {
|
|||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "it.integry.integrywmsnative"
|
applicationId "it.integry.integrywmsnative"
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 35
|
targetSdk 36
|
||||||
versionCode appVersionCode
|
versionCode appVersionCode
|
||||||
versionName appVersionName
|
versionName appVersionName
|
||||||
// testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
// testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
@@ -60,6 +61,9 @@ android {
|
|||||||
// shrinkResources true // Rimuove risorse non utilizzate
|
// shrinkResources true // Rimuove risorse non utilizzate
|
||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||||
signingConfig signingConfigs.release
|
signingConfig signingConfigs.release
|
||||||
|
firebaseCrashlytics {
|
||||||
|
mappingFileUploadEnabled true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,7 +95,7 @@ android {
|
|||||||
abortOnError false
|
abortOnError false
|
||||||
}
|
}
|
||||||
namespace 'it.integry.integrywmsnative'
|
namespace 'it.integry.integrywmsnative'
|
||||||
compileSdk 35
|
compileSdk 36
|
||||||
}
|
}
|
||||||
|
|
||||||
configurations {
|
configurations {
|
||||||
@@ -110,18 +114,18 @@ dependencies {
|
|||||||
implementation 'com.github.lupaulus:logger:2.3.2'
|
implementation 'com.github.lupaulus:logger:2.3.2'
|
||||||
|
|
||||||
// Import the Firebase BoM
|
// Import the Firebase BoM
|
||||||
implementation platform('com.google.firebase:firebase-bom:33.14.0')
|
implementation platform('com.google.firebase:firebase-bom:33.16.0')
|
||||||
implementation 'com.google.firebase:firebase-analytics'
|
implementation 'com.google.firebase:firebase-analytics'
|
||||||
implementation 'com.google.firebase:firebase-crashlytics'
|
implementation 'com.google.firebase:firebase-crashlytics'
|
||||||
implementation 'com.google.firebase:firebase-perf'
|
implementation 'com.google.firebase:firebase-perf'
|
||||||
implementation 'com.google.android.gms:play-services-basement:18.7.0'
|
implementation 'com.google.android.gms:play-services-basement:18.7.1'
|
||||||
|
|
||||||
//JJWT
|
//JJWT
|
||||||
implementation 'io.jsonwebtoken:jjwt-api:0.11.5'
|
implementation 'io.jsonwebtoken:jjwt-api:0.13.0'
|
||||||
runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.11.5'
|
runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.13.0'
|
||||||
runtimeOnly 'io.jsonwebtoken:jjwt-jackson:0.11.5'
|
runtimeOnly 'io.jsonwebtoken:jjwt-jackson:0.13.0'
|
||||||
|
|
||||||
implementation 'androidx.appcompat:appcompat:1.7.0'
|
implementation 'androidx.appcompat:appcompat:1.7.1'
|
||||||
implementation 'com.google.android.material:material:1.12.0'
|
implementation 'com.google.android.material:material:1.12.0'
|
||||||
implementation 'androidx.constraintlayout:constraintlayout:2.2.1'
|
implementation 'androidx.constraintlayout:constraintlayout:2.2.1'
|
||||||
implementation 'androidx.cardview:cardview:1.0.0'
|
implementation 'androidx.cardview:cardview:1.0.0'
|
||||||
@@ -134,14 +138,14 @@ dependencies {
|
|||||||
}
|
}
|
||||||
|
|
||||||
implementation "androidx.slidingpanelayout:slidingpanelayout:1.2.0"
|
implementation "androidx.slidingpanelayout:slidingpanelayout:1.2.0"
|
||||||
implementation 'com.squareup.retrofit2:retrofit:2.11.0'
|
implementation 'com.squareup.retrofit2:retrofit:3.0.0'
|
||||||
implementation 'com.squareup.retrofit2:converter-gson:2.11.0'
|
implementation 'com.squareup.retrofit2:converter-gson:3.0.0'
|
||||||
implementation 'com.annimon:stream:1.2.2'
|
implementation 'com.annimon:stream:1.2.2'
|
||||||
implementation 'androidx.lifecycle:lifecycle-runtime:2.9.0'
|
implementation 'androidx.lifecycle:lifecycle-runtime:2.9.3'
|
||||||
implementation 'org.apache.commons:commons-text:1.9'
|
implementation 'org.apache.commons:commons-text:1.14.0'
|
||||||
|
|
||||||
//MVVM
|
//MVVM
|
||||||
def dagger2_version = '2.55'
|
def dagger2_version = '2.57.1'
|
||||||
implementation "com.google.dagger:dagger:$dagger2_version"
|
implementation "com.google.dagger:dagger:$dagger2_version"
|
||||||
annotationProcessor "com.google.dagger:dagger-compiler:$dagger2_version"
|
annotationProcessor "com.google.dagger:dagger-compiler:$dagger2_version"
|
||||||
implementation "com.google.dagger:dagger-android:$dagger2_version"
|
implementation "com.google.dagger:dagger-android:$dagger2_version"
|
||||||
@@ -157,7 +161,7 @@ dependencies {
|
|||||||
implementation 'com.github.pedromassango:doubleClick:3.0'
|
implementation 'com.github.pedromassango:doubleClick:3.0'
|
||||||
|
|
||||||
//SQLite ROOM
|
//SQLite ROOM
|
||||||
def room_version = "2.7.1"
|
def room_version = "2.7.2"
|
||||||
|
|
||||||
implementation "androidx.room:room-runtime:$room_version"
|
implementation "androidx.room:room-runtime:$room_version"
|
||||||
annotationProcessor "androidx.room:room-compiler:$room_version"
|
annotationProcessor "androidx.room:room-compiler:$room_version"
|
||||||
@@ -183,11 +187,13 @@ dependencies {
|
|||||||
implementation 'com.github.harry1453:android-bluetooth-serial:v1.1.2'
|
implementation 'com.github.harry1453:android-bluetooth-serial:v1.1.2'
|
||||||
|
|
||||||
// RxJava is also required.
|
// RxJava is also required.
|
||||||
implementation 'io.reactivex.rxjava2:rxjava:2.1.12'
|
implementation 'io.reactivex.rxjava2:rxjava:2.2.21'
|
||||||
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
|
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
|
||||||
|
|
||||||
//Barcode generator
|
//Barcode generator
|
||||||
implementation 'com.journeyapps:zxing-android-embedded:4.3.0'
|
implementation 'com.journeyapps:zxing-android-embedded:4.3.0'
|
||||||
|
|
||||||
|
implementation("org.javatuples:javatuples:1.2")
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
|
|||||||
6
app/proguard-rules.pro
vendored
6
app/proguard-rules.pro
vendored
@@ -34,6 +34,12 @@
|
|||||||
<init>(...);
|
<init>(...);
|
||||||
@com.google.gson.annotations.SerializedName <fields>;
|
@com.google.gson.annotations.SerializedName <fields>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Per JJWT
|
||||||
|
-keep class io.jsonwebtoken.** { *; }
|
||||||
|
-keepnames class io.jsonwebtoken.* { *; }
|
||||||
|
-keepnames interface io.jsonwebtoken.* { *; }
|
||||||
|
|
||||||
# Retain generic signatures of TypeToken and its subclasses with R8 version 3.0 and higher.
|
# Retain generic signatures of TypeToken and its subclasses with R8 version 3.0 and higher.
|
||||||
-keep,allowobfuscation,allowshrinking class com.google.gson.reflect.TypeToken
|
-keep,allowobfuscation,allowshrinking class com.google.gson.reflect.TypeToken
|
||||||
-keep,allowobfuscation,allowshrinking class * extends com.google.gson.reflect.TypeToken
|
-keep,allowobfuscation,allowshrinking class * extends com.google.gson.reflect.TypeToken
|
||||||
|
|||||||
@@ -142,6 +142,8 @@ import it.integry.integrywmsnative.view.dialogs.choose_batch_lot.DialogChooseBat
|
|||||||
import it.integry.integrywmsnative.view.dialogs.choose_batch_lot.DialogChooseBatchLotModule;
|
import it.integry.integrywmsnative.view.dialogs.choose_batch_lot.DialogChooseBatchLotModule;
|
||||||
import it.integry.integrywmsnative.view.dialogs.create_new_art.DialogCreateNewArtComponent;
|
import it.integry.integrywmsnative.view.dialogs.create_new_art.DialogCreateNewArtComponent;
|
||||||
import it.integry.integrywmsnative.view.dialogs.create_new_art.DialogCreateNewArtModule;
|
import it.integry.integrywmsnative.view.dialogs.create_new_art.DialogCreateNewArtModule;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.device_end_of_life.DialogDeviceEndOfLifeComponent;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.device_end_of_life.DialogDeviceEndOfLifeModule;
|
||||||
import it.integry.integrywmsnative.view.dialogs.extra_info.DialogExtraInfoComponent;
|
import it.integry.integrywmsnative.view.dialogs.extra_info.DialogExtraInfoComponent;
|
||||||
import it.integry.integrywmsnative.view.dialogs.extra_info.DialogExtraInfoModule;
|
import it.integry.integrywmsnative.view.dialogs.extra_info.DialogExtraInfoModule;
|
||||||
import it.integry.integrywmsnative.view.dialogs.info_aggiuntive_lu.DialogInfoAggiuntiveLUComponent;
|
import it.integry.integrywmsnative.view.dialogs.info_aggiuntive_lu.DialogInfoAggiuntiveLUComponent;
|
||||||
@@ -251,7 +253,8 @@ import it.integry.integrywmsnative.view.dialogs.update_available.DialogUpdateAva
|
|||||||
VerificaGiacenzeModule.class,
|
VerificaGiacenzeModule.class,
|
||||||
DialogExtraInfoModule.class,
|
DialogExtraInfoModule.class,
|
||||||
DialogAskDepositoModule.class,
|
DialogAskDepositoModule.class,
|
||||||
DialogChooseArtFromListaArtsModule.class
|
DialogChooseArtFromListaArtsModule.class,
|
||||||
|
DialogDeviceEndOfLifeModule.class
|
||||||
})
|
})
|
||||||
public interface MainApplicationComponent {
|
public interface MainApplicationComponent {
|
||||||
|
|
||||||
@@ -422,6 +425,8 @@ public interface MainApplicationComponent {
|
|||||||
|
|
||||||
DialogChooseArtFromListaArtsComponent.Factory dialogChooseArtFromListaArtsComponent();
|
DialogChooseArtFromListaArtsComponent.Factory dialogChooseArtFromListaArtsComponent();
|
||||||
|
|
||||||
|
DialogDeviceEndOfLifeComponent.Factory dialogDeviceEndOfLifeComponent();
|
||||||
|
|
||||||
void inject(MainApplication mainApplication);
|
void inject(MainApplication mainApplication);
|
||||||
|
|
||||||
void inject(AppContext mainApplication);
|
void inject(AppContext mainApplication);
|
||||||
|
|||||||
@@ -56,7 +56,6 @@ import it.integry.integrywmsnative.core.sound.SoundAlertService;
|
|||||||
import it.integry.integrywmsnative.core.update.UpdatesManager;
|
import it.integry.integrywmsnative.core.update.UpdatesManager;
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.rest.DocInterniRESTConsumer;
|
import it.integry.integrywmsnative.gest.contab_doc_interni.rest.DocInterniRESTConsumer;
|
||||||
import it.integry.integrywmsnative.gest.login.rest.AuthenticationRESTConsumer;
|
import it.integry.integrywmsnative.gest.login.rest.AuthenticationRESTConsumer;
|
||||||
import it.integry.integrywmsnative.gest.prod_fabbisogno_linee_prod.rest.ProdFabbisognoLineeProdRESTConsumer;
|
|
||||||
import it.integry.integrywmsnative.view.dialogs.DialogProgressView;
|
import it.integry.integrywmsnative.view.dialogs.DialogProgressView;
|
||||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2View;
|
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2View;
|
||||||
|
|
||||||
@@ -263,12 +262,6 @@ public class MainApplicationModule {
|
|||||||
return new PosizioniRESTConsumer(restBuilder, systemRESTConsumer, executorService);
|
return new PosizioniRESTConsumer(restBuilder, systemRESTConsumer, executorService);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
|
||||||
@Singleton
|
|
||||||
ProdFabbisognoLineeProdRESTConsumer providesProdFabbisognoLineeProdRESTConsumer(RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer) {
|
|
||||||
return new ProdFabbisognoLineeProdRESTConsumer(restBuilder, systemRESTConsumer);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
DocInterniRESTConsumer provideDocInterniRESTConsumer(RESTBuilder restBuilder, MagazzinoRESTConsumer magazzinoRESTConsumer) {
|
DocInterniRESTConsumer provideDocInterniRESTConsumer(RESTBuilder restBuilder, MagazzinoRESTConsumer magazzinoRESTConsumer) {
|
||||||
@@ -283,8 +276,8 @@ public class MainApplicationModule {
|
|||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
GiacenzaPvRESTConsumer provideGiacenzaPvRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService) {
|
GiacenzaPvRESTConsumer provideGiacenzaPvRESTConsumer(RESTBuilder restBuilder) {
|
||||||
return new GiacenzaPvRESTConsumer(restBuilder, executorService);
|
return new GiacenzaPvRESTConsumer(restBuilder);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import android.content.Context;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.PackageInfo;
|
import android.content.pm.PackageInfo;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.text.SpannableString;
|
import android.text.SpannableString;
|
||||||
@@ -12,8 +13,10 @@ import android.view.LayoutInflater;
|
|||||||
|
|
||||||
import androidx.databinding.DataBindingUtil;
|
import androidx.databinding.DataBindingUtil;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.CountDownLatch;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
@@ -27,6 +30,7 @@ import it.integry.integrywmsnative.databinding.ActivitySplashBinding;
|
|||||||
import it.integry.integrywmsnative.gest.login.LoginActivity;
|
import it.integry.integrywmsnative.gest.login.LoginActivity;
|
||||||
import it.integry.integrywmsnative.gest.main.MainActivity;
|
import it.integry.integrywmsnative.gest.main.MainActivity;
|
||||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.device_end_of_life.DialogDeviceEndOfLifeView;
|
||||||
|
|
||||||
public class SplashActivity extends BaseActivity implements MainContext.Listener {
|
public class SplashActivity extends BaseActivity implements MainContext.Listener {
|
||||||
|
|
||||||
@@ -65,9 +69,24 @@ public class SplashActivity extends BaseActivity implements MainContext.Listener
|
|||||||
|
|
||||||
UtilityContext.initMainActivity(this);
|
UtilityContext.initMainActivity(this);
|
||||||
|
|
||||||
|
LocalDate endSupportDate = LocalDate.of(2026, 1, 31);
|
||||||
|
|
||||||
initAppVersion();
|
boolean isOldAndroid = Build.VERSION.SDK_INT < Build.VERSION_CODES.O;
|
||||||
initPermissions(this::init);
|
|
||||||
|
executorService.execute(() -> {
|
||||||
|
|
||||||
|
if (isOldAndroid)
|
||||||
|
showDeviceEndOfLifeMessage();
|
||||||
|
|
||||||
|
handler.post(() -> {
|
||||||
|
if (LocalDate.now().isBefore(endSupportDate) || !isOldAndroid) {
|
||||||
|
initAppVersion();
|
||||||
|
initPermissions(this::init);
|
||||||
|
} else {
|
||||||
|
this.finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initAppVersion() {
|
private void initAppVersion() {
|
||||||
@@ -105,6 +124,21 @@ public class SplashActivity extends BaseActivity implements MainContext.Listener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void showDeviceEndOfLifeMessage() {
|
||||||
|
|
||||||
|
CountDownLatch latch = new CountDownLatch(1);
|
||||||
|
|
||||||
|
DialogDeviceEndOfLifeView.newInstance(latch::countDown)
|
||||||
|
.show(this.getSupportFragmentManager(), "dialog_device_end_of_life");
|
||||||
|
|
||||||
|
try {
|
||||||
|
latch.await();
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDBDataLoading(String item) {
|
public void onDBDataLoading(String item) {
|
||||||
handler.post(() -> mBinding.loadingInfoTextview.setText("Caricamento " + item));
|
handler.post(() -> mBinding.loadingInfoTextview.setText("Caricamento " + item));
|
||||||
|
|||||||
@@ -24,19 +24,4 @@ public class CommonConst {
|
|||||||
public static String RECOVER_COLLO_FILE = "recover_ul.json";
|
public static String RECOVER_COLLO_FILE = "recover_ul.json";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Mail {
|
|
||||||
|
|
||||||
public static String[] forErrorsDebug = {
|
|
||||||
"g.scorrano@integry.it",
|
|
||||||
"v.castellana@integry.it"
|
|
||||||
};
|
|
||||||
|
|
||||||
public static String[] forErrors = {
|
|
||||||
// "syslogs@integry.it",
|
|
||||||
"g.scorrano@integry.it",
|
|
||||||
"v.castellana@integry.it"
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,11 +11,11 @@ public class JwtUtils {
|
|||||||
private final static String SIGNING_KEY = "gICy3bjD56i/YFnBZZKe5ibiz3Snsp08nybGGziCV4ZcvyXBbyqWUnJ2wTrRXhOuf/xdljPXX0yBaqdAgvKthQ==";
|
private final static String SIGNING_KEY = "gICy3bjD56i/YFnBZZKe5ibiz3Snsp08nybGGziCV4ZcvyXBbyqWUnJ2wTrRXhOuf/xdljPXX0yBaqdAgvKthQ==";
|
||||||
|
|
||||||
public static Claims parseJwt(String token) {
|
public static Claims parseJwt(String token) {
|
||||||
Jws<Claims> jws = Jwts.parserBuilder()
|
Jws<Claims> jws = Jwts.parser()
|
||||||
.setSigningKey(Keys.hmacShaKeyFor(Decoders.BASE64.decode(SIGNING_KEY)))
|
.verifyWith(Keys.hmacShaKeyFor(Decoders.BASE64.decode(SIGNING_KEY)))
|
||||||
.build()
|
.build()
|
||||||
.parseClaimsJws(token);
|
.parseSignedClaims(token);
|
||||||
|
|
||||||
return jws.getBody();
|
return jws.getPayload();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,11 +89,25 @@ public class AppContext {
|
|||||||
private void initLogger() {
|
private void initLogger() {
|
||||||
Logger.addLogAdapter(new AndroidLogAdapter());
|
Logger.addLogAdapter(new AndroidLogAdapter());
|
||||||
|
|
||||||
logsFolder = new File(mApplicationContext.getExternalFilesDir(null).getAbsolutePath());
|
File dataDir = mApplicationContext.getExternalFilesDir(null);
|
||||||
int maxBytesSize = 5 * 1024 * 1024;
|
|
||||||
Logger.addLogAdapter(new DiskLogAdapter(logsFolder, maxBytesSize));
|
logsFolder = new File(dataDir, "logs");
|
||||||
|
|
||||||
|
if (!logsFolder.exists())
|
||||||
|
logsFolder.mkdirs();
|
||||||
|
|
||||||
|
//Temporary clean
|
||||||
|
File[] wrongFilesToBeDeleted = dataDir.listFiles((file, s) -> s.startsWith("logs_"));
|
||||||
|
|
||||||
|
if (wrongFilesToBeDeleted != null)
|
||||||
|
for (File fileToDelete : wrongFilesToBeDeleted) {
|
||||||
|
fileToDelete.delete();
|
||||||
|
}
|
||||||
|
|
||||||
removeOldLogs(logsFolder);
|
removeOldLogs(logsFolder);
|
||||||
|
|
||||||
|
int maxBytesSize = 5 * 1024 * 1024;
|
||||||
|
Logger.addLogAdapter(new DiskLogAdapter(logsFolder, maxBytesSize));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void removeOldLogs(File logsFolder) {
|
private void removeOldLogs(File logsFolder) {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package it.integry.integrywmsnative.core.data_recover;
|
package it.integry.integrywmsnative.core.data_recover;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||||
@@ -10,7 +11,7 @@ public class ColliDataRecoverDTO {
|
|||||||
private int id;
|
private int id;
|
||||||
private int numCollo;
|
private int numCollo;
|
||||||
private String serCollo;
|
private String serCollo;
|
||||||
private String dataCollo;
|
private LocalDate dataCollo;
|
||||||
private String gestioneCollo;
|
private String gestioneCollo;
|
||||||
private String filtro;
|
private String filtro;
|
||||||
|
|
||||||
@@ -43,11 +44,11 @@ public class ColliDataRecoverDTO {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDataCollo() {
|
public LocalDate getDataCollo() {
|
||||||
return dataCollo;
|
return dataCollo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ColliDataRecoverDTO setDataCollo(String dataCollo) {
|
public ColliDataRecoverDTO setDataCollo(LocalDate dataCollo) {
|
||||||
this.dataCollo = dataCollo;
|
this.dataCollo = dataCollo;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package it.integry.integrywmsnative.core.data_recover;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
||||||
import com.annimon.stream.Optional;
|
|
||||||
import com.annimon.stream.Stream;
|
import com.annimon.stream.Stream;
|
||||||
import com.google.android.gms.common.util.IOUtils;
|
import com.google.android.gms.common.util.IOUtils;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
@@ -14,6 +13,7 @@ import java.io.InputStream;
|
|||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
@@ -65,9 +65,9 @@ public class ColliDataRecoverService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private ColliDataRecoverDTO getIfExists(int id) {
|
private ColliDataRecoverDTO getIfExists(int id) {
|
||||||
Optional<ColliDataRecoverDTO> recoverDTOOptional = Stream.of(mtbColtsSessions)
|
Optional<ColliDataRecoverDTO> recoverDTOOptional = mtbColtsSessions.stream()
|
||||||
.filter(x -> x.getId() == id)
|
.filter(x -> x.getId() == id)
|
||||||
.findSingle();
|
.findFirst();
|
||||||
|
|
||||||
|
|
||||||
return recoverDTOOptional.isPresent() ? recoverDTOOptional.get() : null;
|
return recoverDTOOptional.isPresent() ? recoverDTOOptional.get() : null;
|
||||||
@@ -85,7 +85,7 @@ public class ColliDataRecoverService {
|
|||||||
|
|
||||||
ColliDataRecoverDTO recoverDTO = new ColliDataRecoverDTO()
|
ColliDataRecoverDTO recoverDTO = new ColliDataRecoverDTO()
|
||||||
.setId(newId)
|
.setId(newId)
|
||||||
.setDataCollo(mtbColtSession.getDataColloS())
|
.setDataCollo(mtbColtSession.getDataColloLD())
|
||||||
.setNumCollo(mtbColtSession.getNumCollo())
|
.setNumCollo(mtbColtSession.getNumCollo())
|
||||||
.setSerCollo(mtbColtSession.getSerCollo())
|
.setSerCollo(mtbColtSession.getSerCollo())
|
||||||
.setGestioneCollo(mtbColtSession.getGestione())
|
.setGestioneCollo(mtbColtSession.getGestione())
|
||||||
|
|||||||
@@ -4,9 +4,6 @@ import androidx.databinding.BaseObservable;
|
|||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.CommonConst;
|
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityNumber;
|
|
||||||
|
|
||||||
public class BindableFloat extends BaseObservable {
|
public class BindableFloat extends BaseObservable {
|
||||||
private Float value;
|
private Float value;
|
||||||
|
|
||||||
@@ -15,10 +12,6 @@ public class BindableFloat extends BaseObservable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getBigDecimal() {
|
public BigDecimal getBigDecimal() {
|
||||||
int numberOfDigits = UtilityNumber.countNumberOfDecimalDigits(get());
|
|
||||||
|
|
||||||
if(numberOfDigits > CommonConst.Config.NUMBER_OF_DECIMAL_DIGITS) numberOfDigits = CommonConst.Config.NUMBER_OF_DECIMAL_DIGITS;
|
|
||||||
|
|
||||||
return BigDecimal.valueOf(get());
|
return BigDecimal.valueOf(get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import android.widget.EditText;
|
|||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
import android.widget.RadioButton;
|
import android.widget.RadioButton;
|
||||||
import android.widget.RadioGroup;
|
import android.widget.RadioGroup;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.annotation.ColorRes;
|
import androidx.annotation.ColorRes;
|
||||||
import androidx.appcompat.widget.AppCompatCheckBox;
|
import androidx.appcompat.widget.AppCompatCheckBox;
|
||||||
@@ -37,6 +38,8 @@ import java.math.BigDecimal;
|
|||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.text.DecimalFormatSymbols;
|
import java.text.DecimalFormatSymbols;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
@@ -45,6 +48,7 @@ import it.integry.integrywmsnative.MainApplication;
|
|||||||
import it.integry.integrywmsnative.R;
|
import it.integry.integrywmsnative.R;
|
||||||
import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
|
import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
|
import it.integry.integrywmsnative.core.utility.LocaleDecimalKeyListener;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityBigDecimal;
|
import it.integry.integrywmsnative.core.utility.UtilityBigDecimal;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityNumber;
|
import it.integry.integrywmsnative.core.utility.UtilityNumber;
|
||||||
@@ -261,7 +265,7 @@ public class Converters {
|
|||||||
BigDecimal value = null;
|
BigDecimal value = null;
|
||||||
|
|
||||||
if (!UtilityString.isNullOrEmpty(s.toString()))
|
if (!UtilityString.isNullOrEmpty(s.toString()))
|
||||||
value = new BigDecimal(s.toString());
|
value = UtilityNumber.parseBigDecimal(s.toString(), Locale.getDefault());
|
||||||
|
|
||||||
observableBigDecimal.set(value);
|
observableBigDecimal.set(value);
|
||||||
}
|
}
|
||||||
@@ -271,7 +275,7 @@ public class Converters {
|
|||||||
}
|
}
|
||||||
|
|
||||||
BigDecimal newValue = observableBigDecimal.get();
|
BigDecimal newValue = observableBigDecimal.get();
|
||||||
BigDecimal viewValue = !view.getText().toString().trim().isEmpty() ? new BigDecimal(view.getText().toString()) : null;
|
BigDecimal viewValue = !view.getText().toString().trim().isEmpty() ? UtilityNumber.parseBigDecimal(view.getText().toString(), Locale.getDefault()) : null;
|
||||||
|
|
||||||
if (!UtilityBigDecimal.equalsTo(viewValue, newValue)) {
|
if (!UtilityBigDecimal.equalsTo(viewValue, newValue)) {
|
||||||
view.setText(UtilityNumber.decimalToString(newValue));
|
view.setText(UtilityNumber.decimalToString(newValue));
|
||||||
@@ -292,7 +296,7 @@ public class Converters {
|
|||||||
String newValueString = s.toString().trim();
|
String newValueString = s.toString().trim();
|
||||||
|
|
||||||
if (!UtilityString.isNullOrEmpty(newValueString))
|
if (!UtilityString.isNullOrEmpty(newValueString))
|
||||||
value = new BigDecimal(newValueString);
|
value = UtilityNumber.parseBigDecimal(newValueString, Locale.getDefault());
|
||||||
|
|
||||||
observableBigDecimal.set(value);
|
observableBigDecimal.set(value);
|
||||||
}
|
}
|
||||||
@@ -301,7 +305,7 @@ public class Converters {
|
|||||||
view.addTextChangedListener(watcher);
|
view.addTextChangedListener(watcher);
|
||||||
}
|
}
|
||||||
BigDecimal newValue = observableBigDecimal.get();
|
BigDecimal newValue = observableBigDecimal.get();
|
||||||
BigDecimal viewValue = !view.getText().toString().trim().isEmpty() ? new BigDecimal(view.getText().toString()) : null;
|
BigDecimal viewValue = !view.getText().toString().trim().isEmpty() ? UtilityNumber.parseBigDecimal(view.getText().toString(), Locale.getDefault()) : null;
|
||||||
|
|
||||||
if (!UtilityBigDecimal.equalsTo(viewValue, newValue)) {
|
if (!UtilityBigDecimal.equalsTo(viewValue, newValue)) {
|
||||||
view.setText(UtilityNumber.decimalToString(newValue));
|
view.setText(UtilityNumber.decimalToString(newValue));
|
||||||
@@ -322,7 +326,7 @@ public class Converters {
|
|||||||
String newValueString = s.toString().trim();
|
String newValueString = s.toString().trim();
|
||||||
|
|
||||||
if (!UtilityString.isNullOrEmpty(newValueString))
|
if (!UtilityString.isNullOrEmpty(newValueString))
|
||||||
value = new BigDecimal(newValueString);
|
value = UtilityNumber.parseBigDecimal(newValueString, Locale.getDefault());
|
||||||
|
|
||||||
observableBigDecimal.set(value);
|
observableBigDecimal.set(value);
|
||||||
}
|
}
|
||||||
@@ -331,7 +335,7 @@ public class Converters {
|
|||||||
view.addTextChangedListener(watcher);
|
view.addTextChangedListener(watcher);
|
||||||
}
|
}
|
||||||
BigDecimal newValue = observableBigDecimal.get();
|
BigDecimal newValue = observableBigDecimal.get();
|
||||||
BigDecimal viewValue = !view.getText().toString().trim().isEmpty() ? new BigDecimal(view.getText().toString()) : null;
|
BigDecimal viewValue = !view.getText().toString().trim().isEmpty() ? UtilityNumber.parseBigDecimal(view.getText().toString(), Locale.getDefault()) : null;
|
||||||
|
|
||||||
if (!UtilityBigDecimal.equalsTo(viewValue, newValue)) {
|
if (!UtilityBigDecimal.equalsTo(viewValue, newValue)) {
|
||||||
view.setText(UtilityNumber.decimalToString(newValue));
|
view.setText(UtilityNumber.decimalToString(newValue));
|
||||||
@@ -350,7 +354,8 @@ public class Converters {
|
|||||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||||
BigDecimal value = null;
|
BigDecimal value = null;
|
||||||
if (!UtilityString.isNullOrEmpty(s.toString()))
|
if (!UtilityString.isNullOrEmpty(s.toString()))
|
||||||
value = new BigDecimal(s.toString());
|
value = UtilityNumber.parseBigDecimal(s.toString(), Locale.getDefault());
|
||||||
|
|
||||||
bindableBigDecimal.set(value);
|
bindableBigDecimal.set(value);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -358,7 +363,7 @@ public class Converters {
|
|||||||
view.addTextChangedListener(watcher);
|
view.addTextChangedListener(watcher);
|
||||||
}
|
}
|
||||||
BigDecimal newValue = bindableBigDecimal.get();
|
BigDecimal newValue = bindableBigDecimal.get();
|
||||||
BigDecimal viewValue = !view.getText().toString().trim().isEmpty() ? new BigDecimal(view.getText().toString()) : null;
|
BigDecimal viewValue = !view.getText().toString().trim().isEmpty() ? UtilityNumber.parseBigDecimal(view.getText().toString(), Locale.getDefault()) : null;
|
||||||
|
|
||||||
if (!UtilityBigDecimal.equalsTo(viewValue, newValue)) {
|
if (!UtilityBigDecimal.equalsTo(viewValue, newValue)) {
|
||||||
view.setText(UtilityNumber.decimalToString(newValue));
|
view.setText(UtilityNumber.decimalToString(newValue));
|
||||||
@@ -974,4 +979,64 @@ public class Converters {
|
|||||||
view.setLayoutParams(layoutParams);
|
view.setLayoutParams(layoutParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
/**
|
||||||
|
* BindingAdapter per bindare una LocalDate diretta su una TextView con un formato specificato.
|
||||||
|
* Esempio di utilizzo in XML:
|
||||||
|
* app:localDateText="@{myLocalDate}" app:dateFormat="@{@string/my_date_format}"
|
||||||
|
*/
|
||||||
|
@BindingAdapter(value = {"localDateText", "dateFormat"}, requireAll = false)
|
||||||
|
public static void bindLocalDateText(TextView view, LocalDate date, String dateFormat) {
|
||||||
|
if (date == null) {
|
||||||
|
view.setText("");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String pattern = dateFormat != null ? dateFormat : "dd/MM/yyyy";
|
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern);
|
||||||
|
view.setText(date.format(formatter));
|
||||||
|
}
|
||||||
|
|
||||||
|
@BindingAdapter(value = {"localDateTimeText", "dateFormat"}, requireAll = false)
|
||||||
|
public static void bindLocalDateText(TextView view, LocalDateTime date, String dateFormat) {
|
||||||
|
if (date == null) {
|
||||||
|
view.setText("");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String pattern = dateFormat != null ? dateFormat : "dd/MM/yyyy hh:mm";
|
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern);
|
||||||
|
view.setText(date.format(formatter));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* BindingAdapter per bindare una ObservableField<LocalDate> su una TextView con un formato specificato.
|
||||||
|
* Esempio di utilizzo in XML:
|
||||||
|
* app:localDateObservableText="@{myObservableLocalDate}" app:dateFormat="@{@string/my_date_format}"
|
||||||
|
*/
|
||||||
|
@BindingAdapter(value = {"localDateObservableText", "dateFormat"}, requireAll = false)
|
||||||
|
public static void bindObservableLocalDateText(TextView view, ObservableField<LocalDate> observableDate, String dateFormat) {
|
||||||
|
if (observableDate == null) {
|
||||||
|
view.setText("");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
LocalDate date = observableDate.get();
|
||||||
|
if (date == null) {
|
||||||
|
view.setText("");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String pattern = dateFormat != null ? dateFormat : "dd/MM/yyyy";
|
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern);
|
||||||
|
view.setText(date.format(formatter));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* BindingAdapter che applica automaticamente il KeyListener localizzato
|
||||||
|
* ai campi con inputType numberDecimal, permettendo l'uso della virgola
|
||||||
|
* come separatore decimale in base al locale del dispositivo.
|
||||||
|
*/
|
||||||
|
@BindingAdapter("useLocaleDecimalInput")
|
||||||
|
public static void setLocaleDecimalInput(EditText view, boolean useLocaleInput) {
|
||||||
|
if (useLocaleInput) {
|
||||||
|
view.setKeyListener(LocaleDecimalKeyListener.getInstance());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package it.integry.integrywmsnative.core.model;
|
package it.integry.integrywmsnative.core.model;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.time.LocalDate;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class DtbDoct {
|
public class DtbDoct {
|
||||||
@@ -10,7 +10,7 @@ public class DtbDoct {
|
|||||||
|
|
||||||
private String codAnag;
|
private String codAnag;
|
||||||
private String codDtip;
|
private String codDtip;
|
||||||
private Date dataDoc;
|
private LocalDate dataDoc;
|
||||||
private Integer numDoc;
|
private Integer numDoc;
|
||||||
private String serDoc;
|
private String serDoc;
|
||||||
private BigDecimal acconto;
|
private BigDecimal acconto;
|
||||||
@@ -41,14 +41,14 @@ public class DtbDoct {
|
|||||||
private String compilatoDa;
|
private String compilatoDa;
|
||||||
private String userName;
|
private String userName;
|
||||||
private String controllatoDa;
|
private String controllatoDa;
|
||||||
private Date dataChkDoc;
|
private LocalDate dataChkDoc;
|
||||||
private Date dataDocVal;
|
private LocalDate dataDocVal;
|
||||||
private Date dataInizTrasp;
|
private LocalDate dataInizTrasp;
|
||||||
private Date dataIns;
|
private LocalDate dataIns;
|
||||||
private Date dataOrd;
|
private LocalDate dataOrd;
|
||||||
private Date dataReg;
|
private LocalDate dataReg;
|
||||||
private Date dataRifScad;
|
private LocalDate dataRifScad;
|
||||||
private Date dataUltMod;
|
private LocalDate dataUltMod;
|
||||||
private String descrizionePaga;
|
private String descrizionePaga;
|
||||||
private String flagPrzScontati;
|
private String flagPrzScontati;
|
||||||
private String gestione;
|
private String gestione;
|
||||||
@@ -89,7 +89,7 @@ public class DtbDoct {
|
|||||||
private String targa;
|
private String targa;
|
||||||
private Integer postiPallet;
|
private Integer postiPallet;
|
||||||
private BigDecimal tempMedia;
|
private BigDecimal tempMedia;
|
||||||
private Date dataCons;
|
private LocalDate dataCons;
|
||||||
private BigDecimal nolo;
|
private BigDecimal nolo;
|
||||||
private BigDecimal nolo2;
|
private BigDecimal nolo2;
|
||||||
private String conducente;
|
private String conducente;
|
||||||
@@ -102,7 +102,7 @@ public class DtbDoct {
|
|||||||
private String setDataDecorrenza2DataRic;
|
private String setDataDecorrenza2DataRic;
|
||||||
private BigDecimal totSpese;
|
private BigDecimal totSpese;
|
||||||
private String chkArtListino;
|
private String chkArtListino;
|
||||||
private Date dataCmov;
|
private LocalDate dataCmov;
|
||||||
private String reso;
|
private String reso;
|
||||||
private Integer numCmovAutofattura;
|
private Integer numCmovAutofattura;
|
||||||
private Object dtbTipi;
|
private Object dtbTipi;
|
||||||
@@ -141,11 +141,11 @@ public class DtbDoct {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getDataDoc() {
|
public LocalDate getDataDoc() {
|
||||||
return dataDoc;
|
return dataDoc;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DtbDoct setDataDoc(Date dataDoc) {
|
public DtbDoct setDataDoc(LocalDate dataDoc) {
|
||||||
this.dataDoc = dataDoc;
|
this.dataDoc = dataDoc;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@@ -420,74 +420,74 @@ public class DtbDoct {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getDataChkDoc() {
|
public LocalDate getDataChkDoc() {
|
||||||
return dataChkDoc;
|
return dataChkDoc;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DtbDoct setDataChkDoc(Date dataChkDoc) {
|
public DtbDoct setDataChkDoc(LocalDate dataChkDoc) {
|
||||||
this.dataChkDoc = dataChkDoc;
|
this.dataChkDoc = dataChkDoc;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getDataDocVal() {
|
public LocalDate getDataDocVal() {
|
||||||
return dataDocVal;
|
return dataDocVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DtbDoct setDataDocVal(Date dataDocVal) {
|
public DtbDoct setDataDocVal(LocalDate dataDocVal) {
|
||||||
this.dataDocVal = dataDocVal;
|
this.dataDocVal = dataDocVal;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getDataInizTrasp() {
|
public LocalDate getDataInizTrasp() {
|
||||||
return dataInizTrasp;
|
return dataInizTrasp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DtbDoct setDataInizTrasp(Date dataInizTrasp) {
|
public DtbDoct setDataInizTrasp(LocalDate dataInizTrasp) {
|
||||||
this.dataInizTrasp = dataInizTrasp;
|
this.dataInizTrasp = dataInizTrasp;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getDataIns() {
|
public LocalDate getDataIns() {
|
||||||
return dataIns;
|
return dataIns;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DtbDoct setDataIns(Date dataIns) {
|
public DtbDoct setDataIns(LocalDate dataIns) {
|
||||||
this.dataIns = dataIns;
|
this.dataIns = dataIns;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getDataOrd() {
|
public LocalDate getDataOrd() {
|
||||||
return dataOrd;
|
return dataOrd;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DtbDoct setDataOrd(Date dataOrd) {
|
public DtbDoct setDataOrd(LocalDate dataOrd) {
|
||||||
this.dataOrd = dataOrd;
|
this.dataOrd = dataOrd;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getDataReg() {
|
public LocalDate getDataReg() {
|
||||||
return dataReg;
|
return dataReg;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DtbDoct setDataReg(Date dataReg) {
|
public DtbDoct setDataReg(LocalDate dataReg) {
|
||||||
this.dataReg = dataReg;
|
this.dataReg = dataReg;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getDataRifScad() {
|
public LocalDate getDataRifScad() {
|
||||||
return dataRifScad;
|
return dataRifScad;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DtbDoct setDataRifScad(Date dataRifScad) {
|
public DtbDoct setDataRifScad(LocalDate dataRifScad) {
|
||||||
this.dataRifScad = dataRifScad;
|
this.dataRifScad = dataRifScad;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getDataUltMod() {
|
public LocalDate getDataUltMod() {
|
||||||
return dataUltMod;
|
return dataUltMod;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DtbDoct setDataUltMod(Date dataUltMod) {
|
public DtbDoct setDataUltMod(LocalDate dataUltMod) {
|
||||||
this.dataUltMod = dataUltMod;
|
this.dataUltMod = dataUltMod;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@@ -852,11 +852,11 @@ public class DtbDoct {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getDataCons() {
|
public LocalDate getDataCons() {
|
||||||
return dataCons;
|
return dataCons;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DtbDoct setDataCons(Date dataCons) {
|
public DtbDoct setDataCons(LocalDate dataCons) {
|
||||||
this.dataCons = dataCons;
|
this.dataCons = dataCons;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@@ -969,11 +969,11 @@ public class DtbDoct {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getDataCmov() {
|
public LocalDate getDataCmov() {
|
||||||
return dataCmov;
|
return dataCmov;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DtbDoct setDataCmov(Date dataCmov) {
|
public DtbDoct setDataCmov(LocalDate dataCmov) {
|
||||||
this.dataCmov = dataCmov;
|
this.dataCmov = dataCmov;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ public class MtbColr extends EntityBase {
|
|||||||
private String gestione;
|
private String gestione;
|
||||||
private String serCollo;
|
private String serCollo;
|
||||||
private Integer numCollo;
|
private Integer numCollo;
|
||||||
private String dataCollo;
|
private LocalDate dataCollo;
|
||||||
private Integer riga;
|
private Integer riga;
|
||||||
private Integer rigaOrd;
|
private Integer rigaOrd;
|
||||||
private String codMart;
|
private String codMart;
|
||||||
@@ -27,7 +27,7 @@ public class MtbColr extends EntityBase {
|
|||||||
private String serColloRif;
|
private String serColloRif;
|
||||||
private String note;
|
private String note;
|
||||||
private LocalDate dataOrd;
|
private LocalDate dataOrd;
|
||||||
private String dataColloRif;
|
private LocalDate dataColloRif;
|
||||||
private BigDecimal qtaCnf;
|
private BigDecimal qtaCnf;
|
||||||
private BigDecimal qtaCol;
|
private BigDecimal qtaCol;
|
||||||
private Integer numOrd;
|
private Integer numOrd;
|
||||||
@@ -164,21 +164,18 @@ public class MtbColr extends EntityBase {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDataColloS() {
|
|
||||||
|
public LocalDate getDataColloLD() {
|
||||||
return dataCollo;
|
return dataCollo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getDataColloD() {
|
|
||||||
return UtilityDate.recognizeDateWithExceptionHandler(getDataColloS());
|
|
||||||
}
|
|
||||||
|
|
||||||
public MtbColr setDataCollo(String dataCollo) {
|
public MtbColr setDataCollo(String dataCollo) {
|
||||||
this.dataCollo = dataCollo;
|
this.dataCollo = UtilityDate.recognizeLocalDateWithExceptionHandler(dataCollo);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MtbColr setDataCollo(Date dataCollo) {
|
public MtbColr setDataCollo(LocalDate dataCollo) {
|
||||||
setDataCollo(UtilityDate.formatDate(dataCollo, UtilityDate.COMMONS_DATE_FORMATS.DMY_TIME_SLASH));
|
this.dataCollo = dataCollo;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -287,25 +284,24 @@ public class MtbColr extends EntityBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getDataColloRifS() {
|
public String getDataColloRifS() {
|
||||||
return dataColloRif;
|
return dataColloRif != null ? UtilityDate.COMMONS_DATE_FORMATS.DATE_DMY_SLASHED_FORMATTER.format(dataColloRif) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getDataColloRifD() {
|
public Date getDataColloRifD() {
|
||||||
return UtilityDate.recognizeDateWithExceptionHandler(getDataColloRifS());
|
return UtilityDate.recognizeDateWithExceptionHandler(getDataColloRifS());
|
||||||
}
|
}
|
||||||
|
|
||||||
public MtbColr setDataColloRif(String dataColloRif) {
|
public LocalDate getDataColloRifLD() {
|
||||||
this.dataColloRif = dataColloRif;
|
return dataColloRif;
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public MtbColr setDataColloRif(Date dataColloRif) {
|
public MtbColr setDataColloRif(String dataColloRif) {
|
||||||
this.dataColloRif = UtilityDate.formatDate(dataColloRif, UtilityDate.COMMONS_DATE_FORMATS.DMY_TIME_SLASH);
|
this.dataColloRif = UtilityDate.recognizeLocalDateWithExceptionHandler(dataColloRif);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MtbColr setDataColloRif(LocalDate dataColloRif) {
|
public MtbColr setDataColloRif(LocalDate dataColloRif) {
|
||||||
this.dataColloRif = UtilityDate.formatDate(dataColloRif, UtilityDate.COMMONS_DATE_FORMATS.DMY_SLASH);
|
this.dataColloRif = dataColloRif;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
|||||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityDB;
|
import it.integry.integrywmsnative.core.utility.UtilityDB;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityLogger;
|
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -31,7 +30,7 @@ import it.integry.integrywmsnative.core.utility.UtilityString;
|
|||||||
|
|
||||||
public class MtbColt extends EntityBase {
|
public class MtbColt extends EntityBase {
|
||||||
private String gestione;
|
private String gestione;
|
||||||
private String dataCollo;
|
private LocalDate dataCollo;
|
||||||
private String serCollo;
|
private String serCollo;
|
||||||
private Integer numCollo;
|
private Integer numCollo;
|
||||||
private String rifOrd;
|
private String rifOrd;
|
||||||
@@ -86,7 +85,7 @@ public class MtbColt extends EntityBase {
|
|||||||
|
|
||||||
public MtbColt() {
|
public MtbColt() {
|
||||||
type = "mtb_colt";
|
type = "mtb_colt";
|
||||||
setDataCollo(UtilityDate.getDateInstance());
|
setDataCollo(LocalDate.now());
|
||||||
setSerCollo("/");
|
setSerCollo("/");
|
||||||
|
|
||||||
if (SettingsManager.i().isUserLoggedIn()) {
|
if (SettingsManager.i().isUserLoggedIn()) {
|
||||||
@@ -145,20 +144,13 @@ public class MtbColt extends EntityBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getDataColloHumanLong() {
|
public String getDataColloHumanLong() {
|
||||||
Date dataColloD = null;
|
if (dataCollo != null) {
|
||||||
try {
|
return UtilityDate.COMMONS_DATE_FORMATS.DATE_DMY_HUMAN_FORMATTER.format(dataCollo);
|
||||||
dataColloD = getDataColloD();
|
|
||||||
} catch (Exception ex) {
|
|
||||||
UtilityLogger.error(ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dataColloD != null) {
|
|
||||||
return UtilityDate.formatDate(dataColloD, UtilityDate.COMMONS_DATE_FORMATS.DMY_HUMAN_LONG);
|
|
||||||
} else return null;
|
} else return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDataColloS() {
|
public String getDataColloS() {
|
||||||
return dataCollo;
|
return dataCollo != null ? UtilityDate.COMMONS_DATE_FORMATS.DATE_DMY_SLASHED_FORMATTER.format(dataCollo) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getDataColloD() {
|
public Date getDataColloD() {
|
||||||
@@ -166,21 +158,16 @@ public class MtbColt extends EntityBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public LocalDate getDataColloLD() {
|
public LocalDate getDataColloLD() {
|
||||||
return UtilityDate.recognizeLocalDateWithExceptionHandler(getDataColloS());
|
return dataCollo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MtbColt setDataCollo(String dataCollo) {
|
public MtbColt setDataCollo(String dataCollo) {
|
||||||
this.dataCollo = dataCollo;
|
this.dataCollo = UtilityDate.recognizeLocalDateWithExceptionHandler(dataCollo);
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public MtbColt setDataCollo(Date dataCollo) {
|
|
||||||
this.dataCollo = UtilityDate.formatDate(dataCollo, UtilityDate.COMMONS_DATE_FORMATS.DMY_TIME_SLASH);
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MtbColt setDataCollo(LocalDate dataCollo) {
|
public MtbColt setDataCollo(LocalDate dataCollo) {
|
||||||
this.dataCollo = UtilityDate.formatDate(dataCollo, UtilityDate.COMMONS_DATE_FORMATS.DMY_SLASH);
|
this.dataCollo = dataCollo;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import java.math.BigDecimal;
|
|||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityNumber;
|
import it.integry.integrywmsnative.core.utility.UtilityNumber;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||||
|
|
||||||
@@ -306,7 +305,7 @@ public class MvwSitArtUdcDetInventario {
|
|||||||
return new MtbColr()
|
return new MtbColr()
|
||||||
.setCodJcom(getCodJcom())
|
.setCodJcom(getCodJcom())
|
||||||
.setCodMart(getCodMart())
|
.setCodMart(getCodMart())
|
||||||
.setDataCollo(UtilityDate.toDate(getDataCollo()))
|
.setDataCollo(getDataCollo())
|
||||||
.setNumCollo(getNumCollo())
|
.setNumCollo(getNumCollo())
|
||||||
.setSerCollo(getSerCollo())
|
.setSerCollo(getSerCollo())
|
||||||
.setGestione(getGestione())
|
.setGestione(getGestione())
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package it.integry.integrywmsnative.core.rest;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||||
import okhttp3.HttpUrl;
|
import okhttp3.HttpUrl;
|
||||||
import okhttp3.Interceptor;
|
import okhttp3.Interceptor;
|
||||||
import okhttp3.Request;
|
import okhttp3.Request;
|
||||||
@@ -17,19 +18,29 @@ public class HttpInterceptor implements Interceptor {
|
|||||||
@Override
|
@Override
|
||||||
public Response intercept(Chain chain) throws IOException {
|
public Response intercept(Chain chain) throws IOException {
|
||||||
|
|
||||||
final String PROFILE_DB = SettingsManager.i().getUserSession() == null ? null : SettingsManager.i().getUserSession().getProfileDB();
|
final String PROFILE_DB = SettingsManager.i().getUserSession() == null ? null : SettingsManager.i().getUserSession().getProfileDB();
|
||||||
final String APP_TOKEN = "fa3a21af-606b-4129-a22b-aedc2a52c7b6";
|
final String APP_TOKEN = "fa3a21af-606b-4129-a22b-aedc2a52c7b6";
|
||||||
|
|
||||||
final Request request = chain.request();
|
HttpUrl.Builder urlBuilder = chain.request().url().newBuilder();
|
||||||
final HttpUrl url = request.url().newBuilder()
|
|
||||||
.addQueryParameter("profileDb", PROFILE_DB)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
Request.Builder builder = chain.request().newBuilder()
|
if (!UtilityString.isNullOrEmpty(PROFILE_DB))
|
||||||
|
urlBuilder
|
||||||
|
.addQueryParameter("profileDb", PROFILE_DB);
|
||||||
|
|
||||||
|
HttpUrl url = urlBuilder.build();
|
||||||
|
|
||||||
|
final Request.Builder requestBuilder = chain.request().newBuilder();
|
||||||
|
|
||||||
|
Request.Builder builder = requestBuilder
|
||||||
.addHeader("Content-Type", "application/json")
|
.addHeader("Content-Type", "application/json")
|
||||||
.addHeader("Accept", "*/*")
|
.addHeader("Accept", "*/*")
|
||||||
.addHeader("x-app-token", APP_TOKEN);
|
.addHeader("x-app-token", APP_TOKEN);
|
||||||
|
|
||||||
|
if (SettingsManager.i().getUserSession() != null &&
|
||||||
|
SettingsManager.i().getUserSession().getDepo() != null &&
|
||||||
|
!UtilityString.isNullOrEmpty(SettingsManager.i().getUserSession().getDepo().getCodMdep()))
|
||||||
|
builder.addHeader("codMdep", SettingsManager.i().getUserSession().getDepo().getCodMdep());
|
||||||
|
|
||||||
var newRequest = builder
|
var newRequest = builder
|
||||||
.url(url)
|
.url(url)
|
||||||
.build();
|
.build();
|
||||||
|
|||||||
@@ -37,19 +37,19 @@ public class RESTBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public <T> T getService(final Class<T> service, int timeout) {
|
public <T> T getService(final Class<T> service, int timeout) {
|
||||||
return getService(service, SettingsManager.i().getServer().getProtocol(), 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, timeout);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T> T getService(final Class<T> service, String protocol, String host, int port, boolean addInterceptors) {
|
public <T> T getService(final Class<T> service, String protocol, String host, int port) {
|
||||||
return getService(service, protocol, host, port, addInterceptors, true, 60);
|
return getService(service, protocol, host, port, true, 60);
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T> T getService(final Class<T> service, String protocol, String host, int port, boolean addInterceptors, boolean addEmsApi) {
|
public <T> T getService(final Class<T> service, String protocol, String host, int port, boolean addEmsApi) {
|
||||||
return getService(service, protocol, host, port, addInterceptors, addEmsApi, 60);
|
return getService(service, protocol, host, port, addEmsApi, 60);
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T> T getService(final Class<T> service, String protocol, String host, int port, boolean addInterceptors, boolean addEmsApi, int timeout) {
|
public <T> T getService(final Class<T> service, String protocol, String host, int port, boolean addEmsApi, int timeout) {
|
||||||
OkHttpClient.Builder clientBuilder = getDefaultHttpClient();
|
OkHttpClient.Builder clientBuilder = getDefaultHttpClient();
|
||||||
|
|
||||||
timeout = 0;
|
timeout = 0;
|
||||||
@@ -62,7 +62,7 @@ public class RESTBuilder {
|
|||||||
clientBuilder.retryOnConnectionFailure(true);
|
clientBuilder.retryOnConnectionFailure(true);
|
||||||
|
|
||||||
clientBuilder.addInterceptor(authInterceptor);
|
clientBuilder.addInterceptor(authInterceptor);
|
||||||
if (addInterceptors) clientBuilder.addInterceptor(new HttpInterceptor());
|
clientBuilder.addInterceptor(new HttpInterceptor());
|
||||||
if (ADD_LOGGER_INTERCEPTOR) clientBuilder.addInterceptor(new HttpLoggerInterceptor());
|
if (ADD_LOGGER_INTERCEPTOR) clientBuilder.addInterceptor(new HttpLoggerInterceptor());
|
||||||
|
|
||||||
OkHttpClient client = clientBuilder.build();
|
OkHttpClient client = clientBuilder.build();
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ public class ArticoloRESTConsumer extends _BaseRESTConsumer {
|
|||||||
var codMarts = codMartToFind.parallelStream()
|
var codMarts = codMartToFind.parallelStream()
|
||||||
.filter(Objects::nonNull)
|
.filter(Objects::nonNull)
|
||||||
.distinct()
|
.distinct()
|
||||||
.collect(Collectors.toUnmodifiableList());
|
.collect(Collectors.toUnmodifiableList());
|
||||||
ArticoloRESTConsumerService articoloRESTConsumer = restBuilder.getService(ArticoloRESTConsumerService.class);
|
ArticoloRESTConsumerService articoloRESTConsumer = restBuilder.getService(ArticoloRESTConsumerService.class);
|
||||||
var response = articoloRESTConsumer
|
var response = articoloRESTConsumer
|
||||||
.getByCodMart(new RetrieveArticoloByCodMartRequestDTO()
|
.getByCodMart(new RetrieveArticoloByCodMartRequestDTO()
|
||||||
@@ -197,17 +197,6 @@ public class ArticoloRESTConsumer extends _BaseRESTConsumer {
|
|||||||
return this.systemRESTConsumer.processSqlSynchronized("SELECT * FROM mtb_grup " + whereCond, typeOfObjectsList);
|
return this.systemRESTConsumer.processSqlSynchronized("SELECT * FROM mtb_grup " + whereCond, typeOfObjectsList);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getArtsGroups(List<String> groupsToFind, RunnableArgs<List<MtbGrup>> onComplete, RunnableArgs<Exception> onFailed) {
|
|
||||||
executorService.execute(() -> {
|
|
||||||
try {
|
|
||||||
var data = getArtsGroupsSynchronized(groupsToFind);
|
|
||||||
if (onComplete != null) onComplete.run(data);
|
|
||||||
} catch (Exception ex) {
|
|
||||||
if (onFailed != null) onFailed.run(ex);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public List<MtbUntMis> getUntMisArtsSynchronized(List<String> inputUntMis) throws Exception {
|
public List<MtbUntMis> getUntMisArtsSynchronized(List<String> inputUntMis) throws Exception {
|
||||||
List<HashMap<String, Object>> whereCondList = inputUntMis.parallelStream()
|
List<HashMap<String, Object>> whereCondList = inputUntMis.parallelStream()
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
|
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -160,11 +161,11 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
|
|
||||||
mtbColrClone
|
mtbColrClone
|
||||||
.setNumCollo(null)
|
.setNumCollo(null)
|
||||||
.setDataCollo((String) null)
|
.setDataCollo((LocalDate) null)
|
||||||
.setRiga(null)
|
.setRiga(null)
|
||||||
.setGestione(GestioneEnum.LAVORAZIONE)
|
.setGestione(GestioneEnum.LAVORAZIONE)
|
||||||
|
|
||||||
.setDataColloRif(sourceMtbColt.getDataColloD())
|
.setDataColloRif(sourceMtbColt.getDataColloLD())
|
||||||
.setNumColloRif(sourceMtbColt.getNumCollo())
|
.setNumColloRif(sourceMtbColt.getNumCollo())
|
||||||
.setGestioneRif(sourceMtbColt.getGestione())
|
.setGestioneRif(sourceMtbColt.getGestione())
|
||||||
.setSerColloRif(sourceMtbColt.getSerCollo())
|
.setSerColloRif(sourceMtbColt.getSerCollo())
|
||||||
@@ -214,10 +215,10 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
MtbColr mtbColrClone = new MtbColr();
|
MtbColr mtbColrClone = new MtbColr();
|
||||||
mtbColrClone
|
mtbColrClone
|
||||||
.setNumCollo(null)
|
.setNumCollo(null)
|
||||||
.setDataCollo((String) null)
|
.setDataCollo((LocalDate) null)
|
||||||
.setRiga(null)
|
.setRiga(null)
|
||||||
.setGestione(GestioneEnum.LAVORAZIONE)
|
.setGestione(GestioneEnum.LAVORAZIONE)
|
||||||
.setDataColloRif(sourceMtbColt.getDataColloD())
|
.setDataColloRif(sourceMtbColt.getDataColloLD())
|
||||||
.setNumColloRif(sourceMtbColt.getNumCollo())
|
.setNumColloRif(sourceMtbColt.getNumCollo())
|
||||||
.setGestioneRif(sourceMtbColt.getGestione())
|
.setGestioneRif(sourceMtbColt.getGestione())
|
||||||
.setSerColloRif(sourceMtbColt.getSerCollo())
|
.setSerColloRif(sourceMtbColt.getSerCollo())
|
||||||
@@ -372,7 +373,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
mtbColr.setGestione(mtbColt.getGestione());
|
mtbColr.setGestione(mtbColt.getGestione());
|
||||||
mtbColr.setSerCollo(mtbColt.getSerCollo());
|
mtbColr.setSerCollo(mtbColt.getSerCollo());
|
||||||
mtbColr.setNumCollo(mtbColt.getNumCollo());
|
mtbColr.setNumCollo(mtbColt.getNumCollo());
|
||||||
mtbColr.setDataCollo(mtbColt.getDataColloS());
|
mtbColr.setDataCollo(mtbColt.getDataColloLD());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -408,7 +409,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public MtbColt getByChiaveColloSynchronized(GestioneEnum gestione, int numCollo, String dataCollo, String serCollo, boolean onlyResiduo, boolean throwExcIfNull) throws Exception {
|
public MtbColt getByChiaveColloSynchronized(GestioneEnum gestione, int numCollo, LocalDate dataCollo, String serCollo, boolean onlyResiduo, boolean throwExcIfNull) throws Exception {
|
||||||
MtbColt mtbColtToRetrieve = new MtbColt()
|
MtbColt mtbColtToRetrieve = new MtbColt()
|
||||||
.setGestione(gestione)
|
.setGestione(gestione)
|
||||||
.setNumCollo(numCollo)
|
.setNumCollo(numCollo)
|
||||||
@@ -418,7 +419,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
return getByTestataSynchronized(mtbColtToRetrieve, onlyResiduo, throwExcIfNull);
|
return getByTestataSynchronized(mtbColtToRetrieve, onlyResiduo, throwExcIfNull);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getByChiaveCollo(GestioneEnum gestione, int numCollo, String dataCollo, String serCollo, boolean onlyResiduo, boolean throwExcIfNull, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
public void getByChiaveCollo(GestioneEnum gestione, int numCollo, LocalDate dataCollo, String serCollo, boolean onlyResiduo, boolean throwExcIfNull, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
MtbColt mtbColtToRetrieve = new MtbColt()
|
MtbColt mtbColtToRetrieve = new MtbColt()
|
||||||
.setGestione(gestione)
|
.setGestione(gestione)
|
||||||
.setNumCollo(numCollo)
|
.setNumCollo(numCollo)
|
||||||
|
|||||||
@@ -13,23 +13,17 @@ import it.integry.integrywmsnative.core.rest.model.pv.UpdateRowVerificaRequestDT
|
|||||||
|
|
||||||
public class GiacenzaPvRESTConsumer extends _BaseRESTConsumer {
|
public class GiacenzaPvRESTConsumer extends _BaseRESTConsumer {
|
||||||
|
|
||||||
|
|
||||||
private final RESTBuilder restBuilder;
|
private final RESTBuilder restBuilder;
|
||||||
private final ExecutorService executorService;
|
|
||||||
|
|
||||||
public GiacenzaPvRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService) {
|
public GiacenzaPvRESTConsumer(RESTBuilder restBuilder) {
|
||||||
this.restBuilder = restBuilder;
|
this.restBuilder = restBuilder;
|
||||||
this.executorService = executorService;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<GiacenzaPvDTO> retrieveGiacenzeSynchronized(String codMdep, String codMart) throws Exception {
|
||||||
public List<GiacenzaPvDTO> retrieveGiacenzeSynchronized(String codMdep) throws Exception {
|
|
||||||
GiacenzaPvRESTConsumerService giacenzaPvRESTConsumerService = restBuilder.getService(GiacenzaPvRESTConsumerService.class, 120);
|
GiacenzaPvRESTConsumerService giacenzaPvRESTConsumerService = restBuilder.getService(GiacenzaPvRESTConsumerService.class, 120);
|
||||||
var response = giacenzaPvRESTConsumerService.retrieve(codMdep)
|
var response = giacenzaPvRESTConsumerService.retrieve(codMdep, codMart).execute();
|
||||||
.execute();
|
|
||||||
|
|
||||||
var giacenzeList = analyzeAnswer(response, "retrieve-giacenze-pv");
|
var giacenzeList = analyzeAnswer(response, "retrieve-giacenze-pv");
|
||||||
|
|
||||||
return giacenzeList != null ? giacenzeList : new ArrayList<>();
|
return giacenzeList != null ? giacenzeList : new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,5 +58,4 @@ public class GiacenzaPvRESTConsumer extends _BaseRESTConsumer {
|
|||||||
|
|
||||||
analyzeAnswer(response, "close-verifica-pv");
|
analyzeAnswer(response, "close-verifica-pv");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,8 +17,7 @@ import retrofit2.http.Query;
|
|||||||
public interface GiacenzaPvRESTConsumerService {
|
public interface GiacenzaPvRESTConsumerService {
|
||||||
|
|
||||||
@GET("wms/pv/verifica_giacenze/retrieve")
|
@GET("wms/pv/verifica_giacenze/retrieve")
|
||||||
Call<ServiceRESTResponse<List<GiacenzaPvDTO>>> retrieve(@Query("codMdep") String codMdep);
|
Call<ServiceRESTResponse<List<GiacenzaPvDTO>>> retrieve(@Query("codMdep") String codMdep, @Query("codMart") String codMart);
|
||||||
|
|
||||||
|
|
||||||
@POST("wms/pv/verifica_giacenze/save_new_row")
|
@POST("wms/pv/verifica_giacenze/save_new_row")
|
||||||
Call<ServiceRESTResponse<Void>> saveNewRowVerifica(@Body SaveNewRowVerificaRequestDTO saveNewRowVerificaRequest);
|
Call<ServiceRESTResponse<Void>> saveNewRowVerifica(@Body SaveNewRowVerificaRequestDTO saveNewRowVerificaRequest);
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package it.integry.integrywmsnative.core.rest.consumers;
|
package it.integry.integrywmsnative.core.rest.consumers;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
|
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
@@ -9,6 +10,7 @@ import it.integry.integrywmsnative.core.model.MtbColt;
|
|||||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||||
import it.integry.integrywmsnative.core.rest.model.materiali.RecuperaMaterialiRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.materiali.RecuperaMaterialiRequestDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.materiali.VersaMaterialiRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.materiali.VersaMaterialiRequestDTO;
|
||||||
|
import it.integry.integrywmsnative.gest.prod_recupero_materiale.dto.HistoryVersamentoProdULRestDTO;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class MaterialiRESTConsumer extends _BaseRESTConsumer {
|
public class MaterialiRESTConsumer extends _BaseRESTConsumer {
|
||||||
@@ -21,6 +23,28 @@ public class MaterialiRESTConsumer extends _BaseRESTConsumer {
|
|||||||
this.executorService = executorService;
|
this.executorService = executorService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<HistoryVersamentoProdULRestDTO> makeSynchronousRetrieveLastVersamentiRequest(String codJfas) throws Exception {
|
||||||
|
var materialiRESTConsumerService = restBuilder.getService(MaterialiRESTConsumerService.class);
|
||||||
|
|
||||||
|
var response = materialiRESTConsumerService.retrieveLastVersamenti(codJfas)
|
||||||
|
.execute();
|
||||||
|
|
||||||
|
|
||||||
|
var data = analyzeAnswer(response, "retrieveLastVersamenti");
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void makeRetrieveLastVersamentiRequest(String codJfas, final RunnableArgs<List<HistoryVersamentoProdULRestDTO>> onComplete, final RunnableArgs<Exception> onFailed) {
|
||||||
|
executorService.execute(() -> {
|
||||||
|
try {
|
||||||
|
var response = makeSynchronousRetrieveLastVersamentiRequest(codJfas);
|
||||||
|
if (onComplete != null) onComplete.run(response);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
if (onFailed != null) onFailed.run(ex);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public MtbColt makeSynchronousRecuperaRequest(RecuperaMaterialiRequestDTO request) throws Exception {
|
public MtbColt makeSynchronousRecuperaRequest(RecuperaMaterialiRequestDTO request) throws Exception {
|
||||||
var materialiRESTConsumerService = restBuilder.getService(MaterialiRESTConsumerService.class);
|
var materialiRESTConsumerService = restBuilder.getService(MaterialiRESTConsumerService.class);
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +1,26 @@
|
|||||||
package it.integry.integrywmsnative.core.rest.consumers;
|
package it.integry.integrywmsnative.core.rest.consumers;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||||
import it.integry.integrywmsnative.core.rest.model.materiali.RecuperaMaterialiRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.materiali.RecuperaMaterialiRequestDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.materiali.RecuperaMaterialiResponseDTO;
|
import it.integry.integrywmsnative.core.rest.model.materiali.RecuperaMaterialiResponseDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.materiali.VersaMaterialiRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.materiali.VersaMaterialiRequestDTO;
|
||||||
|
import it.integry.integrywmsnative.core.rest.model.materiali.VersaMaterialiResponseDTO;
|
||||||
|
import it.integry.integrywmsnative.gest.prod_recupero_materiale.dto.HistoryVersamentoProdULRestDTO;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.http.Body;
|
import retrofit2.http.Body;
|
||||||
|
import retrofit2.http.GET;
|
||||||
import retrofit2.http.POST;
|
import retrofit2.http.POST;
|
||||||
|
import retrofit2.http.Query;
|
||||||
|
|
||||||
public interface MaterialiRESTConsumerService {
|
public interface MaterialiRESTConsumerService {
|
||||||
|
|
||||||
@POST("wms/materiali/versa")
|
@POST("wms/materiali/versa")
|
||||||
Call<ServiceRESTResponse<RecuperaMaterialiResponseDTO>> versa(@Body VersaMaterialiRequestDTO request);
|
Call<ServiceRESTResponse<VersaMaterialiResponseDTO>> versa(@Body VersaMaterialiRequestDTO request);
|
||||||
|
|
||||||
|
@GET("wms/materiali/retrieveLastVersamenti")
|
||||||
|
Call<ServiceRESTResponse<List<HistoryVersamentoProdULRestDTO>>> retrieveLastVersamenti(@Query("codJfas") String codJfas);
|
||||||
|
|
||||||
@POST("wms/materiali/recupera")
|
@POST("wms/materiali/recupera")
|
||||||
Call<ServiceRESTResponse<RecuperaMaterialiResponseDTO>> recupera(@Body RecuperaMaterialiRequestDTO request);
|
Call<ServiceRESTResponse<RecuperaMaterialiResponseDTO>> recupera(@Body RecuperaMaterialiRequestDTO request);
|
||||||
|
|||||||
@@ -66,21 +66,14 @@ public class MesRESTConsumer extends _BaseRESTConsumer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void getOrdiniLavorazione(String flagEvaso, RunnableArgs<List<OrdineLavorazioneDTO>> onComplete, RunnableArgs<Exception> onFailed) {
|
public List<OrdineLavorazioneDTO> getOrdiniLavorazioneSynchronized(String flagEvaso) throws Exception {
|
||||||
MesRESTConsumerService mesRESTConsumerService = restBuilder.getService(MesRESTConsumerService.class);
|
MesRESTConsumerService mesRESTConsumerService = restBuilder.getService(MesRESTConsumerService.class);
|
||||||
|
|
||||||
mesRESTConsumerService.getOrdiniLavorazione(flagEvaso)
|
var response = mesRESTConsumerService.getOrdiniLavorazione(flagEvaso)
|
||||||
.enqueue(new ManagedErrorCallback<>() {
|
.execute();
|
||||||
@Override
|
|
||||||
public void onResponse(Call<ServiceRESTResponse<List<OrdineLavorazioneDTO>>> call, Response<ServiceRESTResponse<List<OrdineLavorazioneDTO>>> response) {
|
|
||||||
analyzeAnswer(response, "getOrdiniLavorazione", (m) -> onComplete.run(response.body().getDto()), onFailed);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
var data = analyzeAnswer(response, "mes_v2/getOrdiniLavorazione");
|
||||||
public void onFailure(Call<ServiceRESTResponse<List<OrdineLavorazioneDTO>>> call, @NonNull final Exception e) {
|
return data;
|
||||||
onFailed.run(e);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getLineeProduzione(String codJfasParent, RunnableArgs<List<JtbFasi>> onComplete, RunnableArgs<Exception> onFailed) {
|
public void getLineeProduzione(String codJfasParent, RunnableArgs<List<JtbFasi>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
package it.integry.integrywmsnative.core.rest.consumers;
|
package it.integry.integrywmsnative.core.rest.consumers;
|
||||||
|
|
||||||
import android.text.TextUtils;
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
@@ -17,8 +14,6 @@ import java.util.concurrent.ExecutorService;
|
|||||||
|
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.BuildConfig;
|
|
||||||
import it.integry.integrywmsnative.core.CommonConst;
|
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||||
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
|
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
|
||||||
@@ -27,9 +22,7 @@ import it.integry.integrywmsnative.core.rest.model.MailRequestDTO;
|
|||||||
import it.integry.integrywmsnative.core.rest.model.NativeSqlRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.NativeSqlRequestDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||||
import it.integry.integrywmsnative.core.rest.model.system.LatestAppVersionInfoDTO;
|
import it.integry.integrywmsnative.core.rest.model.system.LatestAppVersionInfoDTO;
|
||||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityGson;
|
import it.integry.integrywmsnative.core.utility.UtilityGson;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.Response;
|
import retrofit2.Response;
|
||||||
|
|
||||||
@@ -110,36 +103,6 @@ public class SystemRESTConsumer extends _BaseRESTConsumer {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void sendErrorLogMail(String message, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
|
||||||
|
|
||||||
String currentAzienda = UtilityString.isNullOrEmpty(SettingsManager.i().getUserSession().getProfileDB()) ? "" : " [" + SettingsManager.i().getUserSession().getProfileDB() + "]";
|
|
||||||
|
|
||||||
String dest = "";
|
|
||||||
if (BuildConfig.DEBUG) {
|
|
||||||
dest = TextUtils.join(";", CommonConst.Mail.forErrorsDebug);
|
|
||||||
} else {
|
|
||||||
dest = TextUtils.join(";", CommonConst.Mail.forErrors);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
MailRequestDTO mailDTO = new MailRequestDTO()
|
|
||||||
.setFrom("sender@integry.it")
|
|
||||||
.setFromName((BuildConfig.DEBUG ? "[DEBUG] " : "") + "WMS Android")
|
|
||||||
.setTo(dest)
|
|
||||||
.setSubject("Bug notification" + currentAzienda)
|
|
||||||
.setMsgText(message)
|
|
||||||
.setHtml(true);
|
|
||||||
|
|
||||||
sendMail(mailDTO, () -> {
|
|
||||||
if (onComplete != null) onComplete.run();
|
|
||||||
}, ex -> {
|
|
||||||
Log.e(SystemRESTConsumer.class.getName(), "", ex);
|
|
||||||
if (onFailed != null) onFailed.run(ex);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void sendMailSynchronized(MailRequestDTO mailDTO) throws Exception {
|
public void sendMailSynchronized(MailRequestDTO mailDTO) throws Exception {
|
||||||
SystemRESTConsumerService service = restBuilder.getService(SystemRESTConsumerService.class);
|
SystemRESTConsumerService service = restBuilder.getService(SystemRESTConsumerService.class);
|
||||||
var response = service.sendMail(mailDTO).execute();
|
var response = service.sendMail(mailDTO).execute();
|
||||||
|
|||||||
@@ -1,8 +1,13 @@
|
|||||||
package it.integry.integrywmsnative.core.rest.model;
|
package it.integry.integrywmsnative.core.rest.model;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
public class AvailableCodMdepsDTO {
|
public class AvailableCodMdepsDTO {
|
||||||
|
|
||||||
|
@SerializedName("codMdep")
|
||||||
private String codMdep;
|
private String codMdep;
|
||||||
|
|
||||||
|
@SerializedName("descrizione")
|
||||||
private String descrizione;
|
private String descrizione;
|
||||||
|
|
||||||
public String getCodMdep() {
|
public String getCodMdep() {
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ import it.integry.integrywmsnative.core.model.MtbColt;
|
|||||||
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
||||||
import it.integry.integrywmsnative.core.model.MvwSitArtUdcDetInventario;
|
import it.integry.integrywmsnative.core.model.MvwSitArtUdcDetInventario;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.GiacenzaRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.GiacenzaRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class InventarioService {
|
public class InventarioService {
|
||||||
@@ -48,7 +47,7 @@ public class InventarioService {
|
|||||||
MtbColt mtbColt = new MtbColt();
|
MtbColt mtbColt = new MtbColt();
|
||||||
|
|
||||||
mtbColt.setGestione(inventario.getGestione());
|
mtbColt.setGestione(inventario.getGestione());
|
||||||
mtbColt.setDataCollo(UtilityDate.toDate(inventario.getDataCollo()));
|
mtbColt.setDataCollo(inventario.getDataCollo());
|
||||||
mtbColt.setSerCollo(inventario.getSerCollo());
|
mtbColt.setSerCollo(inventario.getSerCollo());
|
||||||
mtbColt.setNumCollo(inventario.getNumCollo());
|
mtbColt.setNumCollo(inventario.getNumCollo());
|
||||||
mtbColt.setSegno(inventario.getSegno());
|
mtbColt.setSegno(inventario.getSegno());
|
||||||
@@ -71,7 +70,7 @@ public class InventarioService {
|
|||||||
MtbColr mtbColr = new MtbColr();
|
MtbColr mtbColr = new MtbColr();
|
||||||
|
|
||||||
mtbColr.setGestione(inventario.getGestione());
|
mtbColr.setGestione(inventario.getGestione());
|
||||||
mtbColr.setDataCollo(UtilityDate.toDate(inventario.getDataCollo()));
|
mtbColr.setDataCollo(inventario.getDataCollo());
|
||||||
mtbColr.setSerCollo(inventario.getSerCollo());
|
mtbColr.setSerCollo(inventario.getSerCollo());
|
||||||
mtbColr.setNumCollo(inventario.getNumCollo());
|
mtbColr.setNumCollo(inventario.getNumCollo());
|
||||||
mtbColr.setCodMart(inventario.getCodMart());
|
mtbColr.setCodMart(inventario.getCodMart());
|
||||||
|
|||||||
@@ -99,6 +99,9 @@ public class DBSettingsModel {
|
|||||||
private boolean flagSpedizioneEnableFastPicking = false;
|
private boolean flagSpedizioneEnableFastPicking = false;
|
||||||
private boolean flagAccettazioneBollaEditableQtaTot = true;
|
private boolean flagAccettazioneBollaEditableQtaTot = true;
|
||||||
private boolean flagViewSwitchDepoButton = true;
|
private boolean flagViewSwitchDepoButton = true;
|
||||||
|
private boolean flagProduzioneSkipAskVersamentoAutomatico;
|
||||||
|
private boolean flagAccettazioneViewLotto = false;
|
||||||
|
private boolean flagAccettazioneBollaMarkReceived = false;
|
||||||
|
|
||||||
public boolean isFlagSpedizioneEnableFakeGiacenza() {
|
public boolean isFlagSpedizioneEnableFakeGiacenza() {
|
||||||
return flagSpedizioneEnableFakeGiacenza;
|
return flagSpedizioneEnableFakeGiacenza;
|
||||||
@@ -833,4 +836,31 @@ public class DBSettingsModel {
|
|||||||
public void setFlagViewSwitchDepoButton(boolean flagViewSwitchDepoButton) {
|
public void setFlagViewSwitchDepoButton(boolean flagViewSwitchDepoButton) {
|
||||||
this.flagViewSwitchDepoButton = flagViewSwitchDepoButton;
|
this.flagViewSwitchDepoButton = flagViewSwitchDepoButton;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isFlagProduzioneSkipAskVersamentoAutomatico() {
|
||||||
|
return flagProduzioneSkipAskVersamentoAutomatico;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DBSettingsModel setFlagProduzioneSkipAskVersamentoAutomatico(boolean flagProduzioneSkipAskVersamentoAutomatico) {
|
||||||
|
this.flagProduzioneSkipAskVersamentoAutomatico = flagProduzioneSkipAskVersamentoAutomatico;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isFlagAccettazioneViewLotto() {
|
||||||
|
return flagAccettazioneViewLotto;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DBSettingsModel setFlagAccettazioneViewLotto(boolean flagAccettazioneViewLotto) {
|
||||||
|
this.flagAccettazioneViewLotto = flagAccettazioneViewLotto;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isFlagAccettazioneBollaMarkReceived() {
|
||||||
|
return flagAccettazioneBollaMarkReceived;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DBSettingsModel setFlagAccettazioneBollaMarkReceived(boolean flagAccettazioneBollaMarkReceived) {
|
||||||
|
this.flagAccettazioneBollaMarkReceived = flagAccettazioneBollaMarkReceived;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,8 +39,6 @@ public class SettingsManager {
|
|||||||
private static SettingsModel settingsModelIstance;
|
private static SettingsModel settingsModelIstance;
|
||||||
private static DBSettingsModel dbSettingsModelIstance;
|
private static DBSettingsModel dbSettingsModelIstance;
|
||||||
|
|
||||||
private static boolean firstStart = false;
|
|
||||||
|
|
||||||
private static Context mContext;
|
private static Context mContext;
|
||||||
private static SystemRESTConsumer mSystemRESTConsumer;
|
private static SystemRESTConsumer mSystemRESTConsumer;
|
||||||
private static ImballiRESTConsumer mImballiRESTConsumer;
|
private static ImballiRESTConsumer mImballiRESTConsumer;
|
||||||
@@ -65,15 +63,15 @@ public class SettingsManager {
|
|||||||
public void init() {
|
public void init() {
|
||||||
settingsModelIstance = (SettingsModel) Stash.getObject(TAG, SettingsModel.class);
|
settingsModelIstance = (SettingsModel) Stash.getObject(TAG, SettingsModel.class);
|
||||||
|
|
||||||
if (settingsModelIstance == null) {
|
if (settingsModelIstance == null)
|
||||||
settingsModelIstance = new SettingsModel();
|
settingsModelIstance = new SettingsModel();
|
||||||
|
|
||||||
|
|
||||||
|
if (settingsModelIstance.getServer() == null)
|
||||||
settingsModelIstance.setServer(new SettingsModel.Server());
|
settingsModelIstance.setServer(new SettingsModel.Server());
|
||||||
firstStart = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
dbSettingsModelIstance = new DBSettingsModel();
|
dbSettingsModelIstance = new DBSettingsModel();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public SettingsModel getSettings() {
|
public SettingsModel getSettings() {
|
||||||
@@ -89,10 +87,6 @@ public class SettingsManager {
|
|||||||
return dbSettingsModelIstance;
|
return dbSettingsModelIstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isFirstStart() {
|
|
||||||
return firstStart;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isInstanceAvailable() {
|
public static boolean isInstanceAvailable() {
|
||||||
return i() != null;
|
return i() != null;
|
||||||
}
|
}
|
||||||
@@ -260,6 +254,11 @@ public class SettingsManager {
|
|||||||
.setSection("ACCETTAZIONE")
|
.setSection("ACCETTAZIONE")
|
||||||
.setKeySection("FLAG_DELETE_ROW_ON_CLOSE")
|
.setKeySection("FLAG_DELETE_ROW_ON_CLOSE")
|
||||||
.setSetter(dbSettingsModelIstance::setFlagAccettazioneDeleteRowOnClose));
|
.setSetter(dbSettingsModelIstance::setFlagAccettazioneDeleteRowOnClose));
|
||||||
|
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
|
||||||
|
.setGestName("PICKING")
|
||||||
|
.setSection("ACCETTAZIONE")
|
||||||
|
.setKeySection("FLAG_VIEW_LOTTO")
|
||||||
|
.setSetter(dbSettingsModelIstance::setFlagAccettazioneViewLotto));
|
||||||
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
|
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
|
||||||
.setGestName("PICKING")
|
.setGestName("PICKING")
|
||||||
.setSection("SPEDIZIONE")
|
.setSection("SPEDIZIONE")
|
||||||
@@ -307,6 +306,12 @@ public class SettingsManager {
|
|||||||
.setSection("PRODUZIONE")
|
.setSection("PRODUZIONE")
|
||||||
.setKeySection("VIEW_POSIZIONI")
|
.setKeySection("VIEW_POSIZIONI")
|
||||||
.setSetter(dbSettingsModelIstance::setViewPosizioni));
|
.setSetter(dbSettingsModelIstance::setViewPosizioni));
|
||||||
|
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
|
||||||
|
.setGestName("PICKING")
|
||||||
|
.setSection("PRODUZIONE")
|
||||||
|
.setKeySection("FLAG_SKIP_ASK_VERSAMENTO_AUTOMATICO")
|
||||||
|
.setSetter(dbSettingsModelIstance::setFlagProduzioneSkipAskVersamentoAutomatico)
|
||||||
|
.setDefaultValue(false));
|
||||||
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
|
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
|
||||||
.setGestName("PICKING")
|
.setGestName("PICKING")
|
||||||
.setSection("SPEDIZIONE")
|
.setSection("SPEDIZIONE")
|
||||||
@@ -480,6 +485,12 @@ public class SettingsManager {
|
|||||||
.setKeySection("FLAG_ASK_PRINT_UL")
|
.setKeySection("FLAG_ASK_PRINT_UL")
|
||||||
.setSetter(dbSettingsModelIstance::setFlagAccettazioneBollaAskPrintUl)
|
.setSetter(dbSettingsModelIstance::setFlagAccettazioneBollaAskPrintUl)
|
||||||
.setDefaultValue(false));
|
.setDefaultValue(false));
|
||||||
|
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
|
||||||
|
.setGestName("PICKING")
|
||||||
|
.setSection("ACCETTAZIONE_BOLLA")
|
||||||
|
.setKeySection("FLAG_ENABLE_MARK_RECEIVED")
|
||||||
|
.setSetter(dbSettingsModelIstance::setFlagAccettazioneBollaMarkReceived)
|
||||||
|
.setDefaultValue(false));
|
||||||
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
|
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
|
||||||
.setGestName("PICKING")
|
.setGestName("PICKING")
|
||||||
.setSection("ACCETTAZIONE_BOLLA")
|
.setSection("ACCETTAZIONE_BOLLA")
|
||||||
|
|||||||
@@ -7,18 +7,22 @@ import android.net.Uri;
|
|||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
|
import android.text.Html;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
import androidx.fragment.app.FragmentActivity;
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.fragment.app.FragmentManager;
|
||||||
import androidx.preference.PreferenceManager;
|
import androidx.preference.PreferenceManager;
|
||||||
|
|
||||||
|
import com.google.firebase.crashlytics.FirebaseCrashlytics;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
|
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.BuildConfig;
|
import it.integry.integrywmsnative.BuildConfig;
|
||||||
import it.integry.integrywmsnative.core.helper.ContextHelper;
|
import it.integry.integrywmsnative.MainApplication;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.model.system.LatestAppVersionInfoDTO;
|
import it.integry.integrywmsnative.core.rest.model.system.LatestAppVersionInfoDTO;
|
||||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||||
@@ -26,11 +30,14 @@ import it.integry.integrywmsnative.core.utility.FileDownloader;
|
|||||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||||
import it.integry.integrywmsnative.gest.settings.MainSettingsFragment;
|
import it.integry.integrywmsnative.gest.settings.MainSettingsFragment;
|
||||||
import it.integry.integrywmsnative.view.dialogs.DialogProgressView;
|
import it.integry.integrywmsnative.view.dialogs.DialogProgressView;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||||
import it.integry.integrywmsnative.view.dialogs.update_available.DialogUpdateAvailableView;
|
import it.integry.integrywmsnative.view.dialogs.update_available.DialogUpdateAvailableView;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class UpdatesManager {
|
public class UpdatesManager {
|
||||||
|
|
||||||
|
private static final String TAG = "UpdatesManager";
|
||||||
|
|
||||||
private final ExecutorService executorService;
|
private final ExecutorService executorService;
|
||||||
private final Handler handler;
|
private final Handler handler;
|
||||||
private final SystemRESTConsumer systemRESTConsumer;
|
private final SystemRESTConsumer systemRESTConsumer;
|
||||||
@@ -41,109 +48,149 @@ public class UpdatesManager {
|
|||||||
this.systemRESTConsumer = systemRESTConsumer;
|
this.systemRESTConsumer = systemRESTConsumer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void executeCheck(Context context, boolean forceReinstall) {
|
public void executeCheck(@NonNull Context context, @NonNull FragmentManager fragmentManager, boolean forceReinstall) {
|
||||||
|
|
||||||
executorService.execute(() -> {
|
executorService.execute(() -> {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final String baseEndpoint = SettingsManager.i().getServer().getProtocol() + "://" + SettingsManager.i().getServer().getHost() +
|
|
||||||
(SettingsManager.i().getServer().getPort() > 0 ? ":" + SettingsManager.i().getServer().getPort() : "") + "/ems-api/";
|
|
||||||
|
|
||||||
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
|
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
|
||||||
var betaEnabled = sharedPreferences.getBoolean(MainSettingsFragment.KEY_BUTTON_ENABLE_BETA, false);
|
boolean betaEnabled = sharedPreferences.getBoolean(MainSettingsFragment.KEY_BUTTON_ENABLE_BETA, false);
|
||||||
|
|
||||||
LatestAppVersionInfoDTO latestData = systemRESTConsumer.retrieveUpdatesInfoSynchronized(betaEnabled);
|
LatestAppVersionInfoDTO latestData = systemRESTConsumer.retrieveUpdatesInfoSynchronized(betaEnabled);
|
||||||
|
|
||||||
if (latestData == null)
|
if (latestData == null) {
|
||||||
|
Log.d(TAG, "No update information received from server.");
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (latestData.getLatestVersionCode() < BuildConfig.VERSION_CODE)
|
boolean isUpdateRequired = latestData.getLatestVersionCode() > BuildConfig.VERSION_CODE;
|
||||||
|
boolean currentVersionIsBeta = BuildConfig.VERSION_NAME.toLowerCase().contains("beta");
|
||||||
|
boolean isChannelSwitch = currentVersionIsBeta != betaEnabled;
|
||||||
|
|
||||||
|
if (!isUpdateRequired && !forceReinstall && !isChannelSwitch) {
|
||||||
|
Log.d(TAG, "App is up to date.");
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
boolean currentVersionIsBeta = BuildConfig.VERSION_NAME.contains("beta");
|
// Se si passa da beta a stabile (o viceversa) o se è una reinstallazione forzata,
|
||||||
|
// l'aggiornamento non deve essere obbligatorio per non bloccare l'utente.
|
||||||
if(!forceReinstall && currentVersionIsBeta == betaEnabled && latestData.getLatestVersionCode() == BuildConfig.VERSION_CODE)
|
if (isChannelSwitch || forceReinstall) {
|
||||||
return;
|
|
||||||
|
|
||||||
//Se sto passando da una beta a una stable e viceversa non obbligo l'utente a fare l'aggiornamento
|
|
||||||
if(currentVersionIsBeta != betaEnabled || forceReinstall) {
|
|
||||||
latestData.setForced(false);
|
latestData.setForced(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
String currentDownloadUrl = baseEndpoint + latestData.getUrl();
|
final String baseEndpoint = SettingsManager.i().getServer().getProtocol() + "://" + SettingsManager.i().getServer().getHost() +
|
||||||
|
(SettingsManager.i().getServer().getPort() > 0 ? ":" + SettingsManager.i().getServer().getPort() : "") + "/ems-api/";
|
||||||
|
String downloadUrl = baseEndpoint + latestData.getUrl();
|
||||||
|
|
||||||
showDialog(context, latestData, () -> {
|
handler.post(() -> showUpdateAvailableDialog(context, fragmentManager, latestData, downloadUrl));
|
||||||
installAPK(context, currentDownloadUrl);
|
|
||||||
});
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
handler.post(() -> {
|
Log.e(TAG, "Error during update check", e);
|
||||||
UtilityExceptions.defaultException(context, e);
|
// Se il check fallisce, non è un errore bloccante. L'utente può continuare a usare l'app.
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showDialog(Context context, LatestAppVersionInfoDTO updatesData, Runnable onUpdateStart) {
|
private void showUpdateAvailableDialog(@NonNull Context context, @NonNull FragmentManager fragmentManager, @NonNull LatestAppVersionInfoDTO updatesData, @NonNull String downloadUrl) {
|
||||||
DialogUpdateAvailableView.newInstance(updatesData, onUpdateStart)
|
DialogUpdateAvailableView dialog = DialogUpdateAvailableView.newInstance(updatesData, () -> {
|
||||||
.show(((FragmentActivity)context).getSupportFragmentManager(), "dialog-updates");
|
// L'utente ha accettato di aggiornare
|
||||||
|
downloadAndInstall(context, fragmentManager, downloadUrl, updatesData.isForced());
|
||||||
|
});
|
||||||
|
|
||||||
|
if (updatesData.isForced()) {
|
||||||
|
dialog.setCancelable(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
dialog.show(fragmentManager, "dialog-updates");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void installAPK(Context context, String downloadURL) {
|
private void downloadAndInstall(@NonNull Context context, @NonNull FragmentManager fragmentManager, @NonNull String downloadUrl, boolean isForced) {
|
||||||
|
DialogProgressView progressDialog = new DialogProgressView("Download", null, false);
|
||||||
File destination = context.getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS);
|
if (isForced) {
|
||||||
|
progressDialog.setCancelable(false);
|
||||||
var progressDialogBuilder = new DialogProgressView("Download", null, false);
|
}
|
||||||
progressDialogBuilder.show(Objects.requireNonNull(ContextHelper.getFragmentManagerFromContext(context)), "tag");
|
progressDialog.show(fragmentManager, "progress-dialog");
|
||||||
|
|
||||||
|
|
||||||
var fileDownloader = new FileDownloader()
|
|
||||||
.setDestFolder(destination)
|
|
||||||
.setUrlString(downloadURL)
|
|
||||||
.setOnProgressUpdate(progress -> {
|
|
||||||
handler.post(() -> {
|
|
||||||
progressDialogBuilder.setProgress(progress);
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.setOnDownloadCompleted(destPath -> {
|
|
||||||
|
|
||||||
handler.post(() -> {
|
|
||||||
progressDialogBuilder.dismiss();
|
|
||||||
|
|
||||||
if (!destination.exists()) {
|
|
||||||
UtilityExceptions.defaultException(context, new Exception("Errore durante il download dell'aggiornamento"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Uri fileLoc;
|
|
||||||
Intent intent;
|
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
|
||||||
intent = new Intent(Intent.ACTION_INSTALL_PACKAGE);
|
|
||||||
fileLoc = GenericFileProvider.getUriForFile(context,
|
|
||||||
context.getApplicationContext().getPackageName() + ".core.update.GenericFileProvider",
|
|
||||||
destPath);
|
|
||||||
} else {
|
|
||||||
intent = new Intent(Intent.ACTION_VIEW);
|
|
||||||
fileLoc = Uri.fromFile(destPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
intent.setDataAndType(fileLoc, "application/vnd.android.package-archive");
|
|
||||||
intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
|
||||||
|
|
||||||
context.startActivity(intent);
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
|
FileDownloader fileDownloader = new FileDownloader()
|
||||||
|
.setExecutorService(executorService)
|
||||||
|
.setDestFolder(context.getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS))
|
||||||
|
.setUrlString(downloadUrl)
|
||||||
|
.setOnProgressUpdate(progress -> handler.post(() -> progressDialog.setProgress(progress)));
|
||||||
|
|
||||||
executorService.execute(() -> {
|
executorService.execute(() -> {
|
||||||
try {
|
try {
|
||||||
fileDownloader.download();
|
File apkFile = fileDownloader.download();
|
||||||
|
handler.post(() -> {
|
||||||
|
progressDialog.dismiss();
|
||||||
|
installApk(context, fragmentManager, apkFile, isForced);
|
||||||
|
});
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
progressDialogBuilder.dismissAllowingStateLoss();
|
Log.e(TAG, "Download failed", e);
|
||||||
UtilityExceptions.defaultException(context, e);
|
handler.post(() -> {
|
||||||
|
progressDialog.dismissAllowingStateLoss();
|
||||||
|
handleUpdateError(fragmentManager, e, isForced);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void installApk(@NonNull Context context, @NonNull FragmentManager fragmentManager, @NonNull File apkFile, boolean isForced) {
|
||||||
|
if (!apkFile.exists()) {
|
||||||
|
handleUpdateError(fragmentManager, new Exception("File APK non trovato dopo il download."), isForced);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Uri fileUri;
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||||
|
fileUri = GenericFileProvider.getUriForFile(context,
|
||||||
|
context.getApplicationContext().getPackageName() + ".core.update.GenericFileProvider",
|
||||||
|
apkFile);
|
||||||
|
} else {
|
||||||
|
fileUri = Uri.fromFile(apkFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
Intent intent = new Intent(Intent.ACTION_INSTALL_PACKAGE);
|
||||||
|
intent.setDataAndType(fileUri, "application/vnd.android.package-archive");
|
||||||
|
intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
|
||||||
|
try {
|
||||||
|
context.startActivity(intent);
|
||||||
|
// Se l'aggiornamento è forzato, l'app si chiuderà per attendere l'installazione manuale.
|
||||||
|
if (isForced) {
|
||||||
|
// Diamo tempo all'utente di vedere l'installer di sistema prima di chiudere l'app.
|
||||||
|
handler.postDelayed(MainApplication::exit, 1000);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.e(TAG, "Failed to start APK installation", e);
|
||||||
|
handleUpdateError(fragmentManager, e, isForced);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handleUpdateError(@NonNull FragmentManager fragmentManager, @NonNull Exception ex, boolean isForced) {
|
||||||
|
FirebaseCrashlytics.getInstance().recordException(ex);
|
||||||
|
String errorMessage = UtilityExceptions.recognizeExceptionMessage(ex);
|
||||||
|
|
||||||
|
handler.post(() -> {
|
||||||
|
String title = isForced ? "Aggiornamento Obbligatorio Fallito" : "Errore Aggiornamento";
|
||||||
|
Runnable onPositiveClick = null;
|
||||||
|
if (isForced) {
|
||||||
|
onPositiveClick = MainApplication::exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
DialogSimpleMessageView dialog = DialogSimpleMessageView.newInstance(
|
||||||
|
isForced ? DialogSimpleMessageView.TYPE.ERROR : DialogSimpleMessageView.TYPE.WARNING,
|
||||||
|
title,
|
||||||
|
Html.fromHtml(errorMessage),
|
||||||
|
null,
|
||||||
|
onPositiveClick,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null);
|
||||||
|
|
||||||
|
if (isForced) {
|
||||||
|
dialog.setCancelable(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
dialog.show(fragmentManager, "error-dialog");
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
|
||||||
@@ -9,6 +9,9 @@ import java.io.InputStream;
|
|||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
import java.util.concurrent.CountDownLatch;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
|
|
||||||
@@ -18,68 +21,87 @@ public class FileDownloader {
|
|||||||
private File destFolder;
|
private File destFolder;
|
||||||
|
|
||||||
private RunnableArgs<Integer> onProgressUpdate;
|
private RunnableArgs<Integer> onProgressUpdate;
|
||||||
private RunnableArgs<File> onDownloadCompleted;
|
|
||||||
|
|
||||||
|
private ExecutorService executorService;
|
||||||
|
|
||||||
public void download() throws Exception {
|
public File download() throws Exception {
|
||||||
InputStream input = null;
|
CountDownLatch countDownLatch = new CountDownLatch(1);
|
||||||
OutputStream output = null;
|
|
||||||
HttpURLConnection connection = null;
|
|
||||||
File downloadFile = null;
|
|
||||||
|
|
||||||
try {
|
AtomicReference<File> result = new AtomicReference<>();
|
||||||
if (!destFolder.exists()) destFolder.mkdirs();
|
AtomicReference<Exception> exceptionAtomicReference = new AtomicReference<>();
|
||||||
|
|
||||||
URL url = new URL(urlString);
|
executorService.execute(() -> {
|
||||||
connection = (HttpURLConnection) url.openConnection();
|
InputStream input = null;
|
||||||
connection.connect();
|
OutputStream output = null;
|
||||||
connection.setConnectTimeout(120 * 1000);
|
HttpURLConnection connection = null;
|
||||||
|
File downloadFile = null;
|
||||||
|
|
||||||
if (connection.getResponseCode() != HttpURLConnection.HTTP_OK)
|
|
||||||
throw new Exception("Server returned HTTP " + connection.getResponseCode() + " " + connection.getResponseMessage());
|
|
||||||
|
|
||||||
input = connection.getInputStream();
|
|
||||||
int totalBytesToDownload = connection.getContentLength();
|
|
||||||
int downloadedBytes = 0;
|
|
||||||
|
|
||||||
String title = URLUtil.guessFileName(String.valueOf(url), null, null);
|
|
||||||
downloadFile = new File(destFolder, title);
|
|
||||||
|
|
||||||
if (downloadFile.exists())
|
|
||||||
downloadFile.delete();
|
|
||||||
|
|
||||||
output = new FileOutputStream(downloadFile);
|
|
||||||
|
|
||||||
byte[] buf = new byte[1024];
|
|
||||||
int len;
|
|
||||||
while ((len = input.read(buf)) > 0) {
|
|
||||||
output.write(buf, 0, len);
|
|
||||||
|
|
||||||
downloadedBytes += len;
|
|
||||||
if (onProgressUpdate != null)
|
|
||||||
onProgressUpdate.run((downloadedBytes * 100) / totalBytesToDownload);
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
if(downloadFile != null && downloadFile.exists())
|
|
||||||
downloadFile.delete();
|
|
||||||
throw e;
|
|
||||||
|
|
||||||
} finally {
|
|
||||||
try {
|
try {
|
||||||
if (output != null)
|
if (!destFolder.exists()) destFolder.mkdirs();
|
||||||
output.close();
|
|
||||||
if (input != null)
|
|
||||||
input.close();
|
|
||||||
} catch (IOException ignored) {
|
|
||||||
}
|
|
||||||
if (connection != null)
|
|
||||||
connection.disconnect();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (onDownloadCompleted != null) onDownloadCompleted.run(downloadFile);
|
URL url = new URL(urlString);
|
||||||
|
connection = (HttpURLConnection) url.openConnection();
|
||||||
|
connection.connect();
|
||||||
|
connection.setConnectTimeout(120 * 1000);
|
||||||
|
|
||||||
|
if (connection.getResponseCode() != HttpURLConnection.HTTP_OK)
|
||||||
|
throw new Exception("Server returned HTTP " + connection.getResponseCode() + " " + connection.getResponseMessage());
|
||||||
|
|
||||||
|
input = connection.getInputStream();
|
||||||
|
int totalBytesToDownload = connection.getContentLength();
|
||||||
|
int downloadedBytes = 0;
|
||||||
|
|
||||||
|
String title = URLUtil.guessFileName(String.valueOf(url), null, null);
|
||||||
|
downloadFile = new File(destFolder, title);
|
||||||
|
|
||||||
|
if (downloadFile.exists())
|
||||||
|
downloadFile.delete();
|
||||||
|
|
||||||
|
output = new FileOutputStream(downloadFile);
|
||||||
|
|
||||||
|
byte[] buf = new byte[1024];
|
||||||
|
int len;
|
||||||
|
while ((len = input.read(buf)) > 0) {
|
||||||
|
output.write(buf, 0, len);
|
||||||
|
|
||||||
|
downloadedBytes += len;
|
||||||
|
if (onProgressUpdate != null)
|
||||||
|
onProgressUpdate.run((downloadedBytes * 100) / totalBytesToDownload);
|
||||||
|
}
|
||||||
|
|
||||||
|
result.set(downloadFile);
|
||||||
|
} catch (Exception e) {
|
||||||
|
if(downloadFile != null && downloadFile.exists())
|
||||||
|
downloadFile.delete();
|
||||||
|
exceptionAtomicReference.set(e);
|
||||||
|
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
if (output != null)
|
||||||
|
output.close();
|
||||||
|
if (input != null)
|
||||||
|
input.close();
|
||||||
|
} catch (IOException ignored) {
|
||||||
|
}
|
||||||
|
if (connection != null)
|
||||||
|
connection.disconnect();
|
||||||
|
|
||||||
|
countDownLatch.countDown();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
countDownLatch.await();
|
||||||
|
|
||||||
|
if(exceptionAtomicReference.get() != null)
|
||||||
|
throw exceptionAtomicReference.get();
|
||||||
|
|
||||||
|
return result.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public FileDownloader setExecutorService(ExecutorService executorService) {
|
||||||
|
this.executorService = executorService;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public String getUrlString() {
|
public String getUrlString() {
|
||||||
return urlString;
|
return urlString;
|
||||||
@@ -103,9 +125,4 @@ public class FileDownloader {
|
|||||||
this.onProgressUpdate = onProgressUpdate;
|
this.onProgressUpdate = onProgressUpdate;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public FileDownloader setOnDownloadCompleted(RunnableArgs<File> onDownloadCompleted) {
|
|
||||||
this.onDownloadCompleted = onDownloadCompleted;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package it.integry.integrywmsnative.core.utility;
|
||||||
|
|
||||||
|
import android.text.method.DigitsKeyListener;
|
||||||
|
|
||||||
|
import java.text.DecimalFormatSymbols;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* KeyListener personalizzato che accetta numeri decimali
|
||||||
|
* usando il separatore decimale del locale corrente (virgola per italiano)
|
||||||
|
*/
|
||||||
|
public class LocaleDecimalKeyListener {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ottiene un'istanza del KeyListener per il locale corrente
|
||||||
|
*/
|
||||||
|
public static DigitsKeyListener getInstance() {
|
||||||
|
return getInstance(Locale.getDefault());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ottiene un'istanza del KeyListener per un locale specifico
|
||||||
|
*/
|
||||||
|
public static DigitsKeyListener getInstance(Locale locale) {
|
||||||
|
DecimalFormatSymbols symbols = new DecimalFormatSymbols(locale);
|
||||||
|
char decimalSeparator = symbols.getDecimalSeparator();
|
||||||
|
return DigitsKeyListener.getInstance("0123456789" + decimalSeparator);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -78,7 +78,7 @@ public class UtilityBarcode {
|
|||||||
|
|
||||||
|
|
||||||
public static boolean isEanPeso(BarcodeScanDTO barcodeScanDTO) {
|
public static boolean isEanPeso(BarcodeScanDTO barcodeScanDTO) {
|
||||||
return (isEtichetta128(barcodeScanDTO) || isEan13(barcodeScanDTO)) && barcodeScanDTO.getStringValue().startsWith("2");
|
return (isEtichetta128(barcodeScanDTO) || isEan13(barcodeScanDTO)) && barcodeScanDTO.getStringValue().length() == 13 && barcodeScanDTO.getStringValue().startsWith("2");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isEan8(BarcodeScanDTO barcodeScanDTO) {
|
public static boolean isEan8(BarcodeScanDTO barcodeScanDTO) {
|
||||||
|
|||||||
@@ -41,6 +41,19 @@ public class UtilityDate {
|
|||||||
public static final String DM_HUMAN = "dd MMM";
|
public static final String DM_HUMAN = "dd MMM";
|
||||||
public static final String DMY_HUMAN = "dd MMM yyyy";
|
public static final String DMY_HUMAN = "dd MMM yyyy";
|
||||||
public static final String DMY_HUMAN_LONG = "dd MMMM yyyy";
|
public static final String DMY_HUMAN_LONG = "dd MMMM yyyy";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static final DateTimeFormatter DATE_DMY_SLASHED_FORMATTER = DateTimeFormatter.ofPattern(DMY_SLASH)
|
||||||
|
.withZone(ZoneId.systemDefault());
|
||||||
|
|
||||||
|
|
||||||
|
public static final DateTimeFormatter DATETIME_DMY_SLASHED_FORMATTER = DateTimeFormatter.ofPattern(DMY_TIME_SLASH)
|
||||||
|
.withZone(ZoneId.systemDefault());
|
||||||
|
|
||||||
|
public static final DateTimeFormatter DATE_DMY_HUMAN_FORMATTER = DateTimeFormatter.ofPattern(DMY_HUMAN_LONG)
|
||||||
|
.withZone(ZoneId.systemDefault());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Date recognizeDateWithExceptionHandler(String dateString) {
|
public static Date recognizeDateWithExceptionHandler(String dateString) {
|
||||||
|
|||||||
@@ -38,13 +38,7 @@ public class UtilityExceptions {
|
|||||||
Logger.e(ex, "Errore", (Object) ex.getStackTrace());
|
Logger.e(ex, "Errore", (Object) ex.getStackTrace());
|
||||||
}
|
}
|
||||||
|
|
||||||
String errorMessage = CommonRESTException.tryRecognizeThenGetMessage(ex);
|
String errorMessage = recognizeExceptionMessage(ex);
|
||||||
|
|
||||||
if (errorMessage == null) {
|
|
||||||
errorMessage = ex.getMessage();
|
|
||||||
|
|
||||||
if (ex.getCause() != null) errorMessage += "<br />" + ex.getCause().getMessage();
|
|
||||||
}
|
|
||||||
|
|
||||||
FragmentManager fm = ContextHelper.getFragmentManagerFromContext(context);
|
FragmentManager fm = ContextHelper.getFragmentManagerFromContext(context);
|
||||||
|
|
||||||
@@ -68,4 +62,15 @@ public class UtilityExceptions {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String recognizeExceptionMessage(Exception ex) {
|
||||||
|
String errorMessage = CommonRESTException.tryRecognizeThenGetMessage(ex);
|
||||||
|
|
||||||
|
if (errorMessage == null) {
|
||||||
|
errorMessage = ex.getMessage();
|
||||||
|
|
||||||
|
if (ex.getCause() != null) errorMessage += "<br />" + ex.getCause().getMessage();
|
||||||
|
}
|
||||||
|
return errorMessage;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package it.integry.integrywmsnative.core.utility;
|
package it.integry.integrywmsnative.core.utility;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.text.DecimalFormatSymbols;
|
import java.text.DecimalFormatSymbols;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
@@ -9,7 +10,8 @@ import it.integry.integrywmsnative.core.CommonConst;
|
|||||||
|
|
||||||
public class UtilityNumber {
|
public class UtilityNumber {
|
||||||
|
|
||||||
private static DecimalFormat decimalFormatInstance;
|
// Locale italiano per la formattazione
|
||||||
|
private static final Locale ITALIAN_LOCALE = new Locale("it", "IT");
|
||||||
|
|
||||||
public static String decimalToString(Float bigDecimal){
|
public static String decimalToString(Float bigDecimal){
|
||||||
if(bigDecimal == null) return "0";
|
if(bigDecimal == null) return "0";
|
||||||
@@ -23,71 +25,59 @@ public class UtilityNumber {
|
|||||||
|
|
||||||
public static String decimalToString(BigDecimal bigDecimal, int decimal){
|
public static String decimalToString(BigDecimal bigDecimal, int decimal){
|
||||||
if(bigDecimal == null) return "0";
|
if(bigDecimal == null) return "0";
|
||||||
return decimalToString(bigDecimal.floatValue(), decimal);
|
|
||||||
|
// Usa stripTrailingZeros per rimuovere gli zeri finali
|
||||||
|
BigDecimal stripped = bigDecimal.stripTrailingZeros();
|
||||||
|
// Limita il numero di decimali visualizzati
|
||||||
|
int scale = Math.min(stripped.scale(), decimal);
|
||||||
|
stripped = stripped.setScale(scale, RoundingMode.DOWN);
|
||||||
|
|
||||||
|
// Configura il formato italiano con virgola come separatore decimale
|
||||||
|
DecimalFormatSymbols italianSymbols = new DecimalFormatSymbols(ITALIAN_LOCALE);
|
||||||
|
italianSymbols.setDecimalSeparator(',');
|
||||||
|
|
||||||
|
// Crea il pattern dinamico basato sul numero di decimali
|
||||||
|
StringBuilder patternBuilder = new StringBuilder("0");
|
||||||
|
if (scale > 0) {
|
||||||
|
patternBuilder.append(".");
|
||||||
|
for (int i = 0; i < scale; i++) {
|
||||||
|
patternBuilder.append("0");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DecimalFormat formatter = new DecimalFormat(patternBuilder.toString(), italianSymbols);
|
||||||
|
String result = formatter.format(stripped);
|
||||||
|
|
||||||
|
// Se il risultato termina con ',', rimuovilo (per i numeri interi)
|
||||||
|
if (result.endsWith(",")) {
|
||||||
|
result = result.substring(0, result.length() - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String decimalToString(float floatValue, int decimal) {
|
public static String decimalToString(float floatValue, int decimal) {
|
||||||
DecimalFormatSymbols otherSymbols = new DecimalFormatSymbols(Locale.getDefault());
|
return decimalToString(BigDecimal.valueOf(floatValue), decimal);
|
||||||
otherSymbols.setDecimalSeparator('.');
|
|
||||||
otherSymbols.setGroupingSeparator(',');
|
|
||||||
|
|
||||||
final DecimalFormat decimalFormat = new DecimalFormat();
|
|
||||||
decimalFormat.setMaximumFractionDigits(decimal);
|
|
||||||
decimalFormat.setDecimalFormatSymbols(otherSymbols);
|
|
||||||
decimalFormat.setGroupingUsed(false);
|
|
||||||
decimalFormat.setMinimumFractionDigits(Math.min(2, decimal));
|
|
||||||
|
|
||||||
return decimalFormat.format(floatValue);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DecimalFormat getNumberFormatInstance() {
|
public static BigDecimal parseBigDecimal(String value, Locale locale) {
|
||||||
|
if (value == null || value.trim().isEmpty()) return null;
|
||||||
if(decimalFormatInstance == null) {
|
try {
|
||||||
DecimalFormatSymbols otherSymbols = new DecimalFormatSymbols(Locale.getDefault());
|
DecimalFormatSymbols symbols = new DecimalFormatSymbols(locale);
|
||||||
otherSymbols.setDecimalSeparator('.');
|
DecimalFormat format = new DecimalFormat();
|
||||||
otherSymbols.setGroupingSeparator(',');
|
format.setDecimalFormatSymbols(symbols);
|
||||||
|
format.setParseBigDecimal(true);
|
||||||
decimalFormatInstance = new DecimalFormat();
|
return (BigDecimal) format.parse(value);
|
||||||
decimalFormatInstance.setMaximumFractionDigits(CommonConst.Config.NUMBER_OF_DECIMAL_DIGITS);
|
} catch (Exception e) {
|
||||||
decimalFormatInstance.setDecimalFormatSymbols(otherSymbols);
|
return null;
|
||||||
decimalFormatInstance.setGroupingUsed(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return decimalFormatInstance;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int countNumberOfDecimalDigits(Float value) {
|
/**
|
||||||
String text = getNumberFormatInstance().format(Math.abs(value));
|
* Parsa una stringa numerica italiana (con virgola come separatore decimale)
|
||||||
int integerPlaces = text.indexOf('.');
|
* e restituisce un BigDecimal
|
||||||
int decimalPlaces = text.length() - integerPlaces - 1;
|
*/
|
||||||
|
public static BigDecimal parseItalianBigDecimal(String value) {
|
||||||
return decimalPlaces;
|
return parseBigDecimal(value, ITALIAN_LOCALE);
|
||||||
}
|
|
||||||
|
|
||||||
public static String normalizeStringNumber(String numberString) {
|
|
||||||
return numberString.replaceAll(",", ".");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static Float decimalToFloat(BigDecimal bigDecimalValue) {
|
|
||||||
float multiplier = (float) Math.pow(10, CommonConst.Config.NUMBER_OF_DECIMAL_DIGITS);
|
|
||||||
|
|
||||||
Float floatValue = null;
|
|
||||||
|
|
||||||
if(bigDecimalValue != null) {
|
|
||||||
int intValue = (int) (bigDecimalValue.floatValue() * multiplier);
|
|
||||||
floatValue = Float.valueOf(intValue / multiplier);
|
|
||||||
}
|
|
||||||
|
|
||||||
return floatValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static float truncateToDecimal(float v, int i) {
|
|
||||||
int delta = 10*i;
|
|
||||||
|
|
||||||
return ((int)v*delta)/delta;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,9 +3,15 @@ package it.integry.integrywmsnative.core.utility;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.pm.PackageInfo;
|
import android.content.pm.PackageInfo;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
|
import android.content.res.ColorStateList;
|
||||||
|
import android.util.TypedValue;
|
||||||
|
|
||||||
|
import androidx.annotation.AttrRes;
|
||||||
|
import androidx.annotation.ColorInt;
|
||||||
|
import androidx.annotation.ColorRes;
|
||||||
import androidx.annotation.RawRes;
|
import androidx.annotation.RawRes;
|
||||||
import androidx.annotation.StringRes;
|
import androidx.annotation.StringRes;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -69,4 +75,23 @@ public class UtilityResources {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Funzione di utilità per ottenere un colore da un attributo del tema
|
||||||
|
public static @ColorRes int getColorResourceFromAttr(Context context, @AttrRes int attrRes) {
|
||||||
|
TypedValue typedValue = new TypedValue();
|
||||||
|
context.getTheme().resolveAttribute(attrRes, typedValue, true);
|
||||||
|
return typedValue.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static @ColorInt int getColorFromAttr(Context context, @AttrRes int attrRes) {
|
||||||
|
return ContextCompat.getColor(context, getColorResourceFromAttr(context, attrRes));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ColorStateList getColorStateListFromAttr(Context context, @AttrRes int attrRes) {
|
||||||
|
return ColorStateList.valueOf(getColorResourceFromAttr(context, attrRes));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,12 +2,17 @@ package it.integry.integrywmsnative.gest.accettazione_bolla_elenco;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.view.Gravity;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
|
||||||
|
import androidx.annotation.DrawableRes;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.appcompat.widget.AppCompatTextView;
|
import androidx.appcompat.widget.AppCompatTextView;
|
||||||
|
import androidx.appcompat.widget.PopupMenu;
|
||||||
|
import androidx.databinding.BindingAdapter;
|
||||||
import androidx.databinding.ObservableArrayList;
|
import androidx.databinding.ObservableArrayList;
|
||||||
|
|
||||||
import com.annimon.stream.Stream;
|
import com.annimon.stream.Stream;
|
||||||
@@ -48,6 +53,9 @@ public class MainAccettazioneBollaElencoFragment extends BaseFragment implements
|
|||||||
private AppCompatTextView mAppBarTitle;
|
private AppCompatTextView mAppBarTitle;
|
||||||
|
|
||||||
public BindableBoolean fabVisible = new BindableBoolean(false);
|
public BindableBoolean fabVisible = new BindableBoolean(false);
|
||||||
|
public BindableBoolean fabMenuVisible = new BindableBoolean(false);
|
||||||
|
|
||||||
|
private PopupMenu fabPopupMenu;
|
||||||
|
|
||||||
private String mTextFilter;
|
private String mTextFilter;
|
||||||
|
|
||||||
@@ -100,6 +108,9 @@ public class MainAccettazioneBollaElencoFragment extends BaseFragment implements
|
|||||||
|
|
||||||
this.initRecyclerView();
|
this.initRecyclerView();
|
||||||
|
|
||||||
|
if (SettingsManager.iDB().isFlagAccettazioneBollaMarkReceived())
|
||||||
|
this.initFab();
|
||||||
|
|
||||||
mToolbar.setRecyclerView(mBinding.accettazioneMainList);
|
mToolbar.setRecyclerView(mBinding.accettazioneMainList);
|
||||||
|
|
||||||
return mBinding.getRoot();
|
return mBinding.getRoot();
|
||||||
@@ -111,6 +122,7 @@ public class MainAccettazioneBollaElencoFragment extends BaseFragment implements
|
|||||||
super.onStart();
|
super.onStart();
|
||||||
|
|
||||||
this.fabVisible.set(false);
|
this.fabVisible.set(false);
|
||||||
|
this.fabMenuVisible.set(false);
|
||||||
mViewModel.init();
|
mViewModel.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -147,8 +159,11 @@ public class MainAccettazioneBollaElencoFragment extends BaseFragment implements
|
|||||||
.filter(y -> !y.getGroupTitle().equalsIgnoreCase(x.getGroupTitle()) && y.getSelectedObservable().get())
|
.filter(y -> !y.getGroupTitle().equalsIgnoreCase(x.getGroupTitle()) && y.getSelectedObservable().get())
|
||||||
.forEach(y -> y.getSelectedObservable().set(false));
|
.forEach(y -> y.getSelectedObservable().set(false));
|
||||||
|
|
||||||
fabVisible.set(Stream.of(mBolleInevaseMutableData)
|
boolean rowSelected = Stream.of(mBolleInevaseMutableData)
|
||||||
.anyMatch(y -> y.getSelectedObservable().get()));
|
.anyMatch(y -> y.getSelectedObservable().get());
|
||||||
|
|
||||||
|
fabVisible.set(rowSelected && !SettingsManager.iDB().isFlagAccettazioneBollaMarkReceived());
|
||||||
|
fabMenuVisible.set(rowSelected && SettingsManager.iDB().isFlagAccettazioneBollaMarkReceived());
|
||||||
});
|
});
|
||||||
|
|
||||||
adapter.setEmptyView(this.mBinding.bolleAccettazioneEmptyView);
|
adapter.setEmptyView(this.mBinding.bolleAccettazioneEmptyView);
|
||||||
@@ -159,6 +174,28 @@ public class MainAccettazioneBollaElencoFragment extends BaseFragment implements
|
|||||||
mToolbar.setRecyclerView(this.mBinding.accettazioneMainList);
|
mToolbar.setRecyclerView(this.mBinding.accettazioneMainList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void initFab() {
|
||||||
|
fabPopupMenu = new PopupMenu(requireContext(), this.mBinding.accettazioneBollaFab,
|
||||||
|
(Gravity.END | Gravity.BOTTOM),
|
||||||
|
androidx.appcompat.R.attr.popupMenuStyle,
|
||||||
|
com.google.android.material.R.style.Widget_Material3_PopupMenu_ContextMenu);
|
||||||
|
|
||||||
|
fabPopupMenu.setForceShowIcon(true);
|
||||||
|
fabPopupMenu.getMenuInflater().inflate(R.menu.accettazione_bolla_fab_menu, fabPopupMenu.getMenu());
|
||||||
|
|
||||||
|
fabPopupMenu.setOnMenuItemClickListener(item -> {
|
||||||
|
int itemId = item.getItemId();
|
||||||
|
|
||||||
|
if (itemId == R.id.open_document) {
|
||||||
|
this.dispatchBolle();
|
||||||
|
} else if (itemId == R.id.mark_document_received) {
|
||||||
|
this.setBolleReceived();
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void refreshList() {
|
private void refreshList() {
|
||||||
List<TestataBollaAccettazioneDTO> tmpList = mViewModel.getBolleList().getValue();
|
List<TestataBollaAccettazioneDTO> tmpList = mViewModel.getBolleList().getValue();
|
||||||
@@ -223,14 +260,23 @@ public class MainAccettazioneBollaElencoFragment extends BaseFragment implements
|
|||||||
}).toList();
|
}).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void openFabMenu() {
|
||||||
|
fabPopupMenu.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setBolleReceived() {
|
||||||
|
this.mViewModel.markDocumentReceived(getSelectedBolle());
|
||||||
|
}
|
||||||
|
|
||||||
public void dispatchBolle() {
|
public void dispatchBolle() {
|
||||||
List<TestataBollaAccettazioneDTO> selectedBolle = Stream.of(this.mBolleInevaseMutableData)
|
this.mViewModel.loadPicking(getSelectedBolle());
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<TestataBollaAccettazioneDTO> getSelectedBolle() {
|
||||||
|
return Stream.of(this.mBolleInevaseMutableData)
|
||||||
.filter(x -> x.getSelectedObservable().get())
|
.filter(x -> x.getSelectedObservable().get())
|
||||||
.map(MainAccettazioneBolleElencoListModel::getOriginalModel)
|
.map(MainAccettazioneBolleElencoListModel::getOriginalModel)
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
this.mViewModel.loadPicking(selectedBolle);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,12 +1,15 @@
|
|||||||
package it.integry.integrywmsnative.gest.accettazione_bolla_elenco;
|
package it.integry.integrywmsnative.gest.accettazione_bolla_elenco;
|
||||||
|
|
||||||
|
import androidx.databinding.ObservableInt;
|
||||||
import androidx.lifecycle.MutableLiveData;
|
import androidx.lifecycle.MutableLiveData;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.R;
|
||||||
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
|
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
|
||||||
|
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||||
import it.integry.integrywmsnative.gest.accettazione_bolla_elenco.rest.BolleAccettazioneRESTConsumer;
|
import it.integry.integrywmsnative.gest.accettazione_bolla_elenco.rest.BolleAccettazioneRESTConsumer;
|
||||||
import it.integry.integrywmsnative.gest.accettazione_bolla_elenco.rest.dto.SitBollaAccettazioneDTO;
|
import it.integry.integrywmsnative.gest.accettazione_bolla_elenco.rest.dto.SitBollaAccettazioneDTO;
|
||||||
import it.integry.integrywmsnative.gest.accettazione_bolla_elenco.rest.dto.TestataBollaAccettazioneDTO;
|
import it.integry.integrywmsnative.gest.accettazione_bolla_elenco.rest.dto.TestataBollaAccettazioneDTO;
|
||||||
@@ -34,14 +37,10 @@ public class MainAccettazioneBollaElencoViewModel {
|
|||||||
}, this::sendError);
|
}, this::sendError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public MutableLiveData<List<TestataBollaAccettazioneDTO>> getBolleList() {
|
public MutableLiveData<List<TestataBollaAccettazioneDTO>> getBolleList() {
|
||||||
return bolleList;
|
return bolleList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void loadPicking(List<TestataBollaAccettazioneDTO> selectedBolle) {
|
public void loadPicking(List<TestataBollaAccettazioneDTO> selectedBolle) {
|
||||||
this.sendOnLoadingStarted();
|
this.sendOnLoadingStarted();
|
||||||
|
|
||||||
@@ -53,21 +52,10 @@ public class MainAccettazioneBollaElencoViewModel {
|
|||||||
}, this::sendError);
|
}, this::sendError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void markDocumentReceived(List<TestataBollaAccettazioneDTO> selectedBolle) {
|
||||||
|
this.sendOnLoadingStarted();
|
||||||
|
this.bolleAccettazioneRESTConsumer.markDocumentReceived(selectedBolle, this::sendOnLoadingEnded, this::sendError);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public MainAccettazioneBollaElencoViewModel setListener(MainAccettazioneBollaElencoViewModel.Listener listener) {
|
public MainAccettazioneBollaElencoViewModel setListener(MainAccettazioneBollaElencoViewModel.Listener listener) {
|
||||||
this.listener = listener;
|
this.listener = listener;
|
||||||
@@ -87,10 +75,9 @@ public class MainAccettazioneBollaElencoViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void sendOnPickingReady(List<TestataBollaAccettazioneDTO> bolle, List<SitBollaAccettazioneDTO> sitArts) {
|
private void sendOnPickingReady(List<TestataBollaAccettazioneDTO> bolle, List<SitBollaAccettazioneDTO> sitArts) {
|
||||||
if(this.listener != null) listener.onPickingReady(bolle, sitArts);
|
if (this.listener != null) listener.onPickingReady(bolle, sitArts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public interface Listener extends ILoadingListener {
|
public interface Listener extends ILoadingListener {
|
||||||
void onError(Exception ex);
|
void onError(Exception ex);
|
||||||
|
|
||||||
|
|||||||
@@ -9,9 +9,12 @@ import javax.inject.Singleton;
|
|||||||
|
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||||
|
import it.integry.integrywmsnative.core.rest.consumers.GiacenzaPvRESTConsumerService;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers._BaseRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers._BaseRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
|
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
|
||||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||||
|
import it.integry.integrywmsnative.core.rest.model.pv.SaveNewRowVerificaRequestDTO;
|
||||||
|
import it.integry.integrywmsnative.gest.accettazione_bolla_elenco.rest.dto.MarkDocumentReceivedRequestDTO;
|
||||||
import it.integry.integrywmsnative.gest.accettazione_bolla_elenco.rest.dto.RetrieveElencoArticoliAccettazioneBollaRequestDTO;
|
import it.integry.integrywmsnative.gest.accettazione_bolla_elenco.rest.dto.RetrieveElencoArticoliAccettazioneBollaRequestDTO;
|
||||||
import it.integry.integrywmsnative.gest.accettazione_bolla_elenco.rest.dto.RetrieveElencoArticoliAccettazioneBollaResponseDTO;
|
import it.integry.integrywmsnative.gest.accettazione_bolla_elenco.rest.dto.RetrieveElencoArticoliAccettazioneBollaResponseDTO;
|
||||||
import it.integry.integrywmsnative.gest.accettazione_bolla_elenco.rest.dto.RetrieveElencoBolleAccettazioneResponseDTO;
|
import it.integry.integrywmsnative.gest.accettazione_bolla_elenco.rest.dto.RetrieveElencoBolleAccettazioneResponseDTO;
|
||||||
@@ -65,4 +68,19 @@ public class BolleAccettazioneRESTConsumer extends _BaseRESTConsumer {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void markDocumentReceived(List<TestataBollaAccettazioneDTO> bolle, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
|
BolleAccettazioneRESTConsumerService service = restBuilder.getService(BolleAccettazioneRESTConsumerService.class);
|
||||||
|
service.markDocumentReceived(new MarkDocumentReceivedRequestDTO().setBolle(bolle))
|
||||||
|
.enqueue(new ManagedErrorCallback<>() {
|
||||||
|
@Override
|
||||||
|
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
|
||||||
|
analyzeAnswer(response, "markDocumentReceived", m -> onComplete.run(), onFailed);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) {
|
||||||
|
onFailed.run(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package it.integry.integrywmsnative.gest.accettazione_bolla_elenco.rest;
|
package it.integry.integrywmsnative.gest.accettazione_bolla_elenco.rest;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||||
|
import it.integry.integrywmsnative.gest.accettazione_bolla_elenco.rest.dto.MarkDocumentReceivedRequestDTO;
|
||||||
import it.integry.integrywmsnative.gest.accettazione_bolla_elenco.rest.dto.RetrieveElencoArticoliAccettazioneBollaRequestDTO;
|
import it.integry.integrywmsnative.gest.accettazione_bolla_elenco.rest.dto.RetrieveElencoArticoliAccettazioneBollaRequestDTO;
|
||||||
import it.integry.integrywmsnative.gest.accettazione_bolla_elenco.rest.dto.RetrieveElencoArticoliAccettazioneBollaResponseDTO;
|
import it.integry.integrywmsnative.gest.accettazione_bolla_elenco.rest.dto.RetrieveElencoArticoliAccettazioneBollaResponseDTO;
|
||||||
import it.integry.integrywmsnative.gest.accettazione_bolla_elenco.rest.dto.RetrieveElencoBolleAccettazioneResponseDTO;
|
import it.integry.integrywmsnative.gest.accettazione_bolla_elenco.rest.dto.RetrieveElencoBolleAccettazioneResponseDTO;
|
||||||
@@ -17,4 +18,6 @@ public interface BolleAccettazioneRESTConsumerService {
|
|||||||
@POST("wms/accettazione-bolla/retrievePickingList")
|
@POST("wms/accettazione-bolla/retrievePickingList")
|
||||||
Call<ServiceRESTResponse<RetrieveElencoArticoliAccettazioneBollaResponseDTO>> retrievePickingListBolle(@Body RetrieveElencoArticoliAccettazioneBollaRequestDTO retrieveElencoArticoliAccettazioneBollaReques);
|
Call<ServiceRESTResponse<RetrieveElencoArticoliAccettazioneBollaResponseDTO>> retrievePickingListBolle(@Body RetrieveElencoArticoliAccettazioneBollaRequestDTO retrieveElencoArticoliAccettazioneBollaReques);
|
||||||
|
|
||||||
|
@POST("wms/accettazione-bolla/markDocumentReceived")
|
||||||
|
Call<ServiceRESTResponse<Void>> markDocumentReceived(@Body MarkDocumentReceivedRequestDTO request);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.accettazione_bolla_elenco.rest.dto;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class MarkDocumentReceivedRequestDTO {
|
||||||
|
|
||||||
|
private List<TestataBollaAccettazioneDTO> bolle;
|
||||||
|
|
||||||
|
public List<TestataBollaAccettazioneDTO> getBolle() {
|
||||||
|
return bolle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MarkDocumentReceivedRequestDTO setBolle(List<TestataBollaAccettazioneDTO> bolle) {
|
||||||
|
this.bolle = bolle;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -114,7 +114,7 @@ public class AccettazioneBollaPickingListAdapter extends SectionedRecyclerViewAd
|
|||||||
} else if (position % 2 == 1) {
|
} else if (position % 2 == 1) {
|
||||||
holder.mBinding.getRoot().setBackgroundColor(Color.WHITE);
|
holder.mBinding.getRoot().setBackgroundColor(Color.WHITE);
|
||||||
} else {
|
} else {
|
||||||
holder.mBinding.getRoot().setBackgroundColor(mContext.getResources().getColor(R.color.letturaFacilitataBG));
|
holder.mBinding.getRoot().setBackgroundColor(mContext.getResources().getColor(R.color.letturaFacilitataBGLight));
|
||||||
}
|
}
|
||||||
|
|
||||||
holder.mBinding.deactivatedOverBg.setVisibility(!pickingObjectDTO.isActive() ? View.VISIBLE : View.GONE);
|
holder.mBinding.deactivatedOverBg.setVisibility(!pickingObjectDTO.isActive() ? View.VISIBLE : View.GONE);
|
||||||
|
|||||||
@@ -78,7 +78,6 @@ public class MainAccettazioneOrdiniElencoFragment extends BaseFragment implement
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSaveInstanceState(@NonNull Bundle outState) {
|
public void onSaveInstanceState(@NonNull Bundle outState) {
|
||||||
onLoadingEnded();
|
|
||||||
outState.putString("mToolbar", DataCache.addItem(mToolbar));
|
outState.putString("mToolbar", DataCache.addItem(mToolbar));
|
||||||
|
|
||||||
super.onSaveInstanceState(outState);
|
super.onSaveInstanceState(outState);
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ public class SitArtOrdDTO {
|
|||||||
private String descrizioneEstesaArt;
|
private String descrizioneEstesaArt;
|
||||||
private String descrizioneEstesaOrd;
|
private String descrizioneEstesaOrd;
|
||||||
private Date dataCons;
|
private Date dataCons;
|
||||||
|
private String partitaMag;
|
||||||
|
|
||||||
public String getDescrizioneEstesaOrd() {
|
public String getDescrizioneEstesaOrd() {
|
||||||
return descrizioneEstesaOrd;
|
return descrizioneEstesaOrd;
|
||||||
@@ -301,4 +302,13 @@ public class SitArtOrdDTO {
|
|||||||
this.dataCons = dataCons;
|
this.dataCons = dataCons;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getPartitaMag() {
|
||||||
|
return partitaMag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SitArtOrdDTO setPartitaMag(String partitaMag) {
|
||||||
|
this.partitaMag = partitaMag;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import android.view.Gravity;
|
|||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
|
||||||
import androidx.appcompat.app.AlertDialog;
|
|
||||||
import androidx.appcompat.widget.PopupMenu;
|
import androidx.appcompat.widget.PopupMenu;
|
||||||
import androidx.databinding.DataBindingUtil;
|
import androidx.databinding.DataBindingUtil;
|
||||||
import androidx.databinding.ObservableArrayList;
|
import androidx.databinding.ObservableArrayList;
|
||||||
@@ -19,6 +18,7 @@ import androidx.preference.PreferenceManager;
|
|||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
|
||||||
import com.annimon.stream.Stream;
|
import com.annimon.stream.Stream;
|
||||||
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||||
import com.google.android.material.snackbar.Snackbar;
|
import com.google.android.material.snackbar.Snackbar;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
@@ -157,7 +157,17 @@ public class AccettazioneOrdiniPickingActivity extends BaseActivity implements A
|
|||||||
boolean useQtaOrd = SettingsManager.iDB().isFlagAccettazioneUseQtaOrd();
|
boolean useQtaOrd = SettingsManager.iDB().isFlagAccettazioneUseQtaOrd();
|
||||||
|
|
||||||
mViewModel.setListeners(this);
|
mViewModel.setListeners(this);
|
||||||
mViewModel.init(mOrders, mSitArts, useQtaOrd);
|
|
||||||
|
this.onLoadingStarted();
|
||||||
|
executorService.execute(() -> {
|
||||||
|
try {
|
||||||
|
mViewModel.init(mOrders, mSitArts, useQtaOrd);
|
||||||
|
this.onLoadingEnded();
|
||||||
|
} catch (Exception e) {
|
||||||
|
this.onError(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initFab() {
|
private void initFab() {
|
||||||
@@ -369,7 +379,7 @@ public class AccettazioneOrdiniPickingActivity extends BaseActivity implements A
|
|||||||
|
|
||||||
private void refreshList() {
|
private void refreshList() {
|
||||||
|
|
||||||
runOnUiThread(() -> {
|
handler.post(() -> {
|
||||||
List<PickingObjectDTO> tmpList;
|
List<PickingObjectDTO> tmpList;
|
||||||
|
|
||||||
if (mAppliedFilterViewModel != null) {
|
if (mAppliedFilterViewModel != null) {
|
||||||
@@ -683,10 +693,15 @@ public class AccettazioneOrdiniPickingActivity extends BaseActivity implements A
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void showOrderByDialog() {
|
private void showOrderByDialog() {
|
||||||
AlertDialog dialog = new AlertDialog.Builder(this).setTitle(this.getText(R.string.action_orderBy)).setSingleChoiceItems(AccettazioneOrdineInevasoOrderBy.descriptions, mCurrentOrderBy.getVal(), (dialog12, which) -> {
|
MaterialAlertDialogBuilder dialog = new MaterialAlertDialogBuilder(this)
|
||||||
mCurrentOrderBy = AccettazioneOrdineInevasoOrderBy.Enum.fromInt(which);
|
.setTitle(this.getText(R.string.action_orderBy))
|
||||||
SettingsManager.i().getUserSession().setDefaultOrdinamentoPickingAccettazione(which);
|
.setSingleChoiceItems(AccettazioneOrdineInevasoOrderBy.descriptions, mCurrentOrderBy.getVal(),
|
||||||
}).setPositiveButton(getText(R.string.ok), (dialog1, which) -> this.refreshList()).create();
|
(dialog12, which) -> {
|
||||||
|
mCurrentOrderBy = AccettazioneOrdineInevasoOrderBy.Enum.fromInt(which);
|
||||||
|
SettingsManager.i().getUserSession().setDefaultOrdinamentoPickingAccettazione(which);
|
||||||
|
})
|
||||||
|
.setPositiveButton(getText(R.string.ok), (dialog1, which) -> this.refreshList());
|
||||||
|
|
||||||
dialog.show();
|
dialog.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -772,7 +787,7 @@ public class AccettazioneOrdiniPickingActivity extends BaseActivity implements A
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onWarning(String warningText, Runnable action) {
|
public void onWarning(String warningText, Runnable action) {
|
||||||
this.runOnUiThread(() -> {
|
handler.post(() -> {
|
||||||
this.onLoadingEnded();
|
this.onLoadingEnded();
|
||||||
DialogSimpleMessageView
|
DialogSimpleMessageView
|
||||||
.makeWarningDialog(new SpannableString(Html.fromHtml(warningText)), null, action)
|
.makeWarningDialog(new SpannableString(Html.fromHtml(warningText)), null, action)
|
||||||
@@ -800,7 +815,7 @@ public class AccettazioneOrdiniPickingActivity extends BaseActivity implements A
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRowSaved() {
|
public void onRowSaved() {
|
||||||
runOnUiThread(() -> {
|
handler.post(() -> {
|
||||||
Snackbar.make(mBindings.getRoot(), R.string.data_saved, Snackbar.LENGTH_SHORT)
|
Snackbar.make(mBindings.getRoot(), R.string.data_saved, Snackbar.LENGTH_SHORT)
|
||||||
.setBackgroundTint(getResources().getColor(R.color.green_500))
|
.setBackgroundTint(getResources().getColor(R.color.green_500))
|
||||||
.show();
|
.show();
|
||||||
@@ -809,7 +824,7 @@ public class AccettazioneOrdiniPickingActivity extends BaseActivity implements A
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFilterCodMartApplied(String codMartToFilter) {
|
public void onFilterCodMartApplied(String codMartToFilter) {
|
||||||
runOnUiThread(() -> {
|
handler.post(() -> {
|
||||||
var codMarts = new ArrayList<String>();
|
var codMarts = new ArrayList<String>();
|
||||||
codMarts.add(codMartToFilter);
|
codMarts.add(codMartToFilter);
|
||||||
|
|
||||||
@@ -819,7 +834,7 @@ public class AccettazioneOrdiniPickingActivity extends BaseActivity implements A
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFilterPosizioneApplied(String posizioneToFilter) {
|
public void onFilterPosizioneApplied(String posizioneToFilter) {
|
||||||
runOnUiThread(() -> {
|
handler.post(() -> {
|
||||||
var posizioni = new ArrayList<String>();
|
var posizioni = new ArrayList<String>();
|
||||||
posizioni.add(posizioneToFilter);
|
posizioni.add(posizioneToFilter);
|
||||||
|
|
||||||
@@ -830,7 +845,7 @@ public class AccettazioneOrdiniPickingActivity extends BaseActivity implements A
|
|||||||
@Override
|
@Override
|
||||||
public void onULVersata(VersamentoAutomaticoULResponseDTO versamentoAutomaticoULResponseDTO, Runnable onComplete) {
|
public void onULVersata(VersamentoAutomaticoULResponseDTO versamentoAutomaticoULResponseDTO, Runnable onComplete) {
|
||||||
|
|
||||||
runOnUiThread(() -> {
|
handler.post(() -> {
|
||||||
DialogVersamentoAutomaticoULDoneView.newInstance(versamentoAutomaticoULResponseDTO, onComplete).show(getSupportFragmentManager(), "tag");
|
DialogVersamentoAutomaticoULDoneView.newInstance(versamentoAutomaticoULResponseDTO, onComplete).show(getSupportFragmentManager(), "tag");
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -838,7 +853,7 @@ public class AccettazioneOrdiniPickingActivity extends BaseActivity implements A
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMtbColrDeleteRequest(RunnableArgs<Boolean> onComplete) {
|
public void onMtbColrDeleteRequest(RunnableArgs<Boolean> onComplete) {
|
||||||
runOnUiThread(() -> {
|
handler.post(() -> {
|
||||||
String text = getResources().getString(R.string.alert_delete_mtb_colr);
|
String text = getResources().getString(R.string.alert_delete_mtb_colr);
|
||||||
DialogSimpleMessageView.makeWarningDialog(new SpannableString(text), null, () -> onComplete.run(true), () -> onComplete.run(false)).show(getSupportFragmentManager(), "tag");
|
DialogSimpleMessageView.makeWarningDialog(new SpannableString(text), null, () -> onComplete.run(true), () -> onComplete.run(false)).show(getSupportFragmentManager(), "tag");
|
||||||
});
|
});
|
||||||
@@ -846,7 +861,7 @@ public class AccettazioneOrdiniPickingActivity extends BaseActivity implements A
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLUOpened(MtbColt mtbColt) {
|
public void onLUOpened(MtbColt mtbColt) {
|
||||||
runOnUiThread(() -> {
|
handler.post(() -> {
|
||||||
noLUPresent.set(false);
|
noLUPresent.set(false);
|
||||||
Snackbar.make(mBindings.getRoot(), R.string.data_saved, Snackbar.LENGTH_SHORT)
|
Snackbar.make(mBindings.getRoot(), R.string.data_saved, Snackbar.LENGTH_SHORT)
|
||||||
.setBackgroundTint(getResources().getColor(R.color.green_500))
|
.setBackgroundTint(getResources().getColor(R.color.green_500))
|
||||||
|
|||||||
@@ -1,50 +1,9 @@
|
|||||||
package it.integry.integrywmsnative.gest.accettazione_ordini_picking;
|
package it.integry.integrywmsnative.gest.accettazione_ordini_picking;
|
||||||
|
|
||||||
import dagger.Module;
|
import dagger.Module;
|
||||||
import dagger.Provides;
|
|
||||||
import it.integry.integrywmsnative.core.ean128.Ean128Service;
|
|
||||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.ColliAccettazioneRESTConsumer;
|
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.ColliLavorazioneRESTConsumer;
|
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.ImballiRESTConsumer;
|
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
|
||||||
import it.integry.integrywmsnative.gest.accettazione_ordini_picking.rest.AccettazioneOrdiniPickingRESTConsumer;
|
|
||||||
import it.integry.integrywmsnative.view.bottom_sheet__lu_content.BottomSheetFragmentLUContentViewModel;
|
|
||||||
|
|
||||||
@Module(subcomponents = AccettazioneOrdiniPickingComponent.class)
|
@Module(subcomponents = AccettazioneOrdiniPickingComponent.class)
|
||||||
public class AccettazioneOrdiniPickingModule {
|
public class AccettazioneOrdiniPickingModule {
|
||||||
|
|
||||||
@Provides
|
|
||||||
AccettazioneOrdiniPickingRESTConsumer providesAccettazionePickingRESTConsumer(RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer) {
|
|
||||||
return new AccettazioneOrdiniPickingRESTConsumer(restBuilder, systemRESTConsumer);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Provides
|
|
||||||
BottomSheetFragmentLUContentViewModel providesBottomSheetFragmentLUContentViewModel() {
|
|
||||||
return new BottomSheetFragmentLUContentViewModel();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Provides
|
|
||||||
AccettazioneOrdiniPickingViewModel providesAccettazioneViewModel(
|
|
||||||
ArticoloRESTConsumer articoloRESTConsumer,
|
|
||||||
BarcodeRESTConsumer barcodeRESTConsumer,
|
|
||||||
ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer,
|
|
||||||
AccettazioneOrdiniPickingRESTConsumer accettazioneOrdiniPickingRESTConsumer,
|
|
||||||
ColliAccettazioneRESTConsumer colliAccettazioneRESTConsumer,
|
|
||||||
ColliLavorazioneRESTConsumer colliLavorazioneRESTConsumer,
|
|
||||||
Ean128Service ean128Service,
|
|
||||||
ImballiRESTConsumer imballiRESTConsumer) {
|
|
||||||
return new AccettazioneOrdiniPickingViewModel(articoloRESTConsumer,
|
|
||||||
barcodeRESTConsumer,
|
|
||||||
colliMagazzinoRESTConsumer,
|
|
||||||
accettazioneOrdiniPickingRESTConsumer,
|
|
||||||
colliAccettazioneRESTConsumer,
|
|
||||||
colliLavorazioneRESTConsumer,
|
|
||||||
ean128Service,
|
|
||||||
imballiRESTConsumer);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package it.integry.integrywmsnative.gest.accettazione_ordini_picking;
|
package it.integry.integrywmsnative.gest.accettazione_ordini_picking;
|
||||||
|
|
||||||
|
import android.os.Handler;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.databinding.ObservableArrayList;
|
import androidx.databinding.ObservableArrayList;
|
||||||
import androidx.lifecycle.MutableLiveData;
|
import androidx.lifecycle.MutableLiveData;
|
||||||
@@ -11,6 +13,8 @@ import java.math.BigDecimal;
|
|||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
@@ -72,6 +76,8 @@ import it.integry.integrywmsnative.view.dialogs.tracciamento_imballi.Tracciament
|
|||||||
|
|
||||||
public class AccettazioneOrdiniPickingViewModel {
|
public class AccettazioneOrdiniPickingViewModel {
|
||||||
|
|
||||||
|
private final ExecutorService executorService;
|
||||||
|
private final Handler handler;
|
||||||
private final ArticoloRESTConsumer mArticoloRESTConsumer;
|
private final ArticoloRESTConsumer mArticoloRESTConsumer;
|
||||||
private final BarcodeRESTConsumer mBarcodeRESTConsumer;
|
private final BarcodeRESTConsumer mBarcodeRESTConsumer;
|
||||||
private final ColliMagazzinoRESTConsumer mColliMagazzinoRESTConsumer;
|
private final ColliMagazzinoRESTConsumer mColliMagazzinoRESTConsumer;
|
||||||
@@ -96,7 +102,9 @@ public class AccettazioneOrdiniPickingViewModel {
|
|||||||
private final List<HistoryMtbAartDTO> mHistoryUsedAarts = new ArrayList<>();
|
private final List<HistoryMtbAartDTO> mHistoryUsedAarts = new ArrayList<>();
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public AccettazioneOrdiniPickingViewModel(ArticoloRESTConsumer articoloRESTConsumer,
|
public AccettazioneOrdiniPickingViewModel(Handler handler,
|
||||||
|
ExecutorService executorService,
|
||||||
|
ArticoloRESTConsumer articoloRESTConsumer,
|
||||||
BarcodeRESTConsumer barcodeRESTConsumer,
|
BarcodeRESTConsumer barcodeRESTConsumer,
|
||||||
ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer,
|
ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer,
|
||||||
AccettazioneOrdiniPickingRESTConsumer accettazioneOrdiniPickingRESTConsumer,
|
AccettazioneOrdiniPickingRESTConsumer accettazioneOrdiniPickingRESTConsumer,
|
||||||
@@ -104,6 +112,8 @@ public class AccettazioneOrdiniPickingViewModel {
|
|||||||
ColliLavorazioneRESTConsumer colliLavorazioneRESTConsumer,
|
ColliLavorazioneRESTConsumer colliLavorazioneRESTConsumer,
|
||||||
Ean128Service ean128Service,
|
Ean128Service ean128Service,
|
||||||
ImballiRESTConsumer imballiRESTConsumer) {
|
ImballiRESTConsumer imballiRESTConsumer) {
|
||||||
|
this.handler = handler;
|
||||||
|
this.executorService = executorService;
|
||||||
this.mArticoloRESTConsumer = articoloRESTConsumer;
|
this.mArticoloRESTConsumer = articoloRESTConsumer;
|
||||||
this.mBarcodeRESTConsumer = barcodeRESTConsumer;
|
this.mBarcodeRESTConsumer = barcodeRESTConsumer;
|
||||||
this.mColliMagazzinoRESTConsumer = colliMagazzinoRESTConsumer;
|
this.mColliMagazzinoRESTConsumer = colliMagazzinoRESTConsumer;
|
||||||
@@ -115,23 +125,24 @@ public class AccettazioneOrdiniPickingViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void init(List<OrdineAccettazioneInevasoDTO> orders, List<SitArtOrdDTO> sitArts, boolean useQtaOrd) {
|
public void init(List<OrdineAccettazioneInevasoDTO> orders, List<SitArtOrdDTO> sitArts, boolean useQtaOrd) throws Exception {
|
||||||
this.mOrders = orders;
|
this.mOrders = orders;
|
||||||
this.mUseQtaOrd = useQtaOrd;
|
this.mUseQtaOrd = useQtaOrd;
|
||||||
|
|
||||||
List<SitArtOrdDTO> mSitArts = Stream.of(sitArts)
|
List<SitArtOrdDTO> mSitArts = sitArts.stream()
|
||||||
.filter(x ->
|
.filter(x ->
|
||||||
UtilityBigDecimal.greaterThan(x.getNumCnfDaEvadere(), BigDecimal.ZERO) &&
|
UtilityBigDecimal.greaterThan(x.getNumCnfDaEvadere(), BigDecimal.ZERO) &&
|
||||||
UtilityBigDecimal.greaterThan(x.getQtaDaEvadere(), BigDecimal.ZERO))
|
UtilityBigDecimal.greaterThan(x.getQtaDaEvadere(), BigDecimal.ZERO))
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
getEmptyPickingList(mSitArts, this.mPickingList::postValue);
|
var pickingList = getEmptyPickingList(mSitArts);
|
||||||
|
this.mPickingList.postValue(pickingList);
|
||||||
|
|
||||||
//Definizione della gestione collo di default
|
//Definizione della gestione collo di default
|
||||||
Boolean isOrdTrasf = Stream.of(mOrders)
|
Boolean isOrdTrasf = mOrders.stream()
|
||||||
.map(OrdineAccettazioneInevasoDTO::isOrdTrasf)
|
.map(OrdineAccettazioneInevasoDTO::isOrdTrasf)
|
||||||
.withoutNulls()
|
.filter(Objects::nonNull)
|
||||||
.distinctBy(x -> x)
|
.distinct()
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
@@ -145,10 +156,10 @@ public class AccettazioneOrdiniPickingViewModel {
|
|||||||
|
|
||||||
|
|
||||||
//Definizione della gestione collo di default
|
//Definizione della gestione collo di default
|
||||||
List<GestioneEnum> foundGestioni = Stream.of(mOrders)
|
List<GestioneEnum> foundGestioni = mOrders.stream()
|
||||||
.map(OrdineAccettazioneInevasoDTO::getGestioneEnum)
|
.map(OrdineAccettazioneInevasoDTO::getGestioneEnum)
|
||||||
.withoutNulls()
|
.filter(Objects::nonNull)
|
||||||
.distinctBy(x -> x)
|
.distinct()
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
if (foundGestioni.size() == 1) {
|
if (foundGestioni.size() == 1) {
|
||||||
@@ -157,7 +168,7 @@ public class AccettazioneOrdiniPickingViewModel {
|
|||||||
} else
|
} else
|
||||||
defaultGestioneOfUL = foundGestioni.get(0) == GestioneEnum.PRODUZIONE ? GestioneEnum.LAVORAZIONE : foundGestioni.get(0);
|
defaultGestioneOfUL = foundGestioni.get(0) == GestioneEnum.PRODUZIONE ? GestioneEnum.LAVORAZIONE : foundGestioni.get(0);
|
||||||
} else {
|
} else {
|
||||||
this.sendError(new InvalidLUMultiGestioneException());
|
throw new InvalidLUMultiGestioneException();
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (defaultGestioneOfUL) {
|
switch (defaultGestioneOfUL) {
|
||||||
@@ -166,32 +177,31 @@ public class AccettazioneOrdiniPickingViewModel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void getEmptyPickingList(List<SitArtOrdDTO> sitArtOrdList, RunnableArgs<List<PickingObjectDTO>> onComplete) {
|
private List<PickingObjectDTO> getEmptyPickingList(List<SitArtOrdDTO> sitArtOrdList) throws Exception {
|
||||||
|
|
||||||
List<String> codMarts = Stream.of(sitArtOrdList)
|
List<String> codMarts = sitArtOrdList.stream()
|
||||||
.map(SitArtOrdDTO::getCodMart)
|
.map(SitArtOrdDTO::getCodMart)
|
||||||
.toList();
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
this.mArticoloRESTConsumer.getByCodMarts(codMarts, listMtbAarts -> {
|
var listMtbAarts = this.mArticoloRESTConsumer.getByCodMartsSynchronized(codMarts);
|
||||||
List<PickingObjectDTO> pickingList = Stream.of(sitArtOrdList)
|
List<PickingObjectDTO> pickingList = sitArtOrdList.stream()
|
||||||
.map(sitArtOrdDTO -> {
|
.map(sitArtOrdDTO -> {
|
||||||
MtbAart mtbAart = null;
|
MtbAart mtbAart = null;
|
||||||
|
|
||||||
for (MtbAart mtbAartItem : listMtbAarts) {
|
for (MtbAart mtbAartItem : listMtbAarts) {
|
||||||
if (mtbAartItem.getCodMart().equalsIgnoreCase(sitArtOrdDTO.getCodMart())) {
|
if (mtbAartItem.getCodMart().equalsIgnoreCase(sitArtOrdDTO.getCodMart())) {
|
||||||
mtbAart = mtbAartItem;
|
mtbAart = mtbAartItem;
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return new PickingObjectDTO()
|
return new PickingObjectDTO()
|
||||||
.setSitArtOrdDTO(sitArtOrdDTO)
|
.setSitArtOrdDTO(sitArtOrdDTO)
|
||||||
.setMtbAart(mtbAart);
|
.setMtbAart(mtbAart);
|
||||||
})
|
})
|
||||||
.toList();
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
onComplete.run(pickingList);
|
return pickingList;
|
||||||
}, this::sendError);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public MutableLiveData<List<PickingObjectDTO>> getPickingList() {
|
public MutableLiveData<List<PickingObjectDTO>> getPickingList() {
|
||||||
@@ -273,7 +283,7 @@ public class AccettazioneOrdiniPickingViewModel {
|
|||||||
try {
|
try {
|
||||||
numCollo = UtilityBarcode.getNumColloFromULAnonima(barcodeScanDTO.getStringValue());
|
numCollo = UtilityBarcode.getNumColloFromULAnonima(barcodeScanDTO.getStringValue());
|
||||||
this.createNewLU(
|
this.createNewLU(
|
||||||
null,
|
barcodeScanDTO.getStringValue(),
|
||||||
numCollo,
|
numCollo,
|
||||||
CommonConst.Config.DEFAULT_ANONYMOUS_UL_SERIE, true, onComplete);
|
CommonConst.Config.DEFAULT_ANONYMOUS_UL_SERIE, true, onComplete);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
@@ -559,6 +569,9 @@ public class AccettazioneOrdiniPickingViewModel {
|
|||||||
dataScad = dataScad.plusDays(pickingObjectDTO.getMtbAart().getGgScadPartita());
|
dataScad = dataScad.plusDays(pickingObjectDTO.getMtbAart().getGgScadPartita());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (partitaMag == null && SettingsManager.iDB().isFlagAccettazioneViewLotto())
|
||||||
|
partitaMag = pickingObjectDTO.getSitArtOrdDTO().getPartitaMag();
|
||||||
|
|
||||||
if (partitaMag == null && dataScad == null) {
|
if (partitaMag == null && dataScad == null) {
|
||||||
HistoryMtbAartDTO historyMtbAartDTO = this.getHistoryItemIfExists(pickingObjectDTO.getMtbAart().getCodMart());
|
HistoryMtbAartDTO historyMtbAartDTO = this.getHistoryItemIfExists(pickingObjectDTO.getMtbAart().getCodMart());
|
||||||
|
|
||||||
@@ -651,8 +664,10 @@ public class AccettazioneOrdiniPickingViewModel {
|
|||||||
.setUntMis(pickingObjectDTO.getMtbAart().getUntMis())
|
.setUntMis(pickingObjectDTO.getMtbAart().getUntMis())
|
||||||
.setMtbAart(pickingObjectDTO.getMtbAart());
|
.setMtbAart(pickingObjectDTO.getMtbAart());
|
||||||
|
|
||||||
pickingObjectDTO.getWithdrawMtbColrs().add(insertedMtbColr);
|
handler.post(() -> {
|
||||||
mCurrentMtbColt.getMtbColr().add(insertedMtbColr);
|
pickingObjectDTO.getWithdrawMtbColrs().add(insertedMtbColr);
|
||||||
|
mCurrentMtbColt.getMtbColr().add(insertedMtbColr);
|
||||||
|
});
|
||||||
|
|
||||||
//Chiamato removeListFilter perché cosi mi cancella tutti i dati di pick temporanei
|
//Chiamato removeListFilter perché cosi mi cancella tutti i dati di pick temporanei
|
||||||
resetMatchedRows();
|
resetMatchedRows();
|
||||||
@@ -768,7 +783,9 @@ public class AccettazioneOrdiniPickingViewModel {
|
|||||||
pickingObjectDTO.get().getWithdrawMtbColrs().remove(mtbColrToDelete);
|
pickingObjectDTO.get().getWithdrawMtbColrs().remove(mtbColrToDelete);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.mCurrentMtbColt.getMtbColr().remove(mtbColrToDelete);
|
handler.post(() -> {
|
||||||
|
this.mCurrentMtbColt.getMtbColr().remove(mtbColrToDelete);
|
||||||
|
});
|
||||||
|
|
||||||
this.resetMatchedRows();
|
this.resetMatchedRows();
|
||||||
this.sendOnRowSaved();
|
this.sendOnRowSaved();
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import it.integry.integrywmsnative.R;
|
|||||||
import it.integry.integrywmsnative.core.expansion.OnListGeneralChangedCallback;
|
import it.integry.integrywmsnative.core.expansion.OnListGeneralChangedCallback;
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityNumber;
|
import it.integry.integrywmsnative.core.utility.UtilityNumber;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityResources;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||||
import it.integry.integrywmsnative.databinding.AccettazioneOrdineInevasoMainListGroupHeaderBinding;
|
import it.integry.integrywmsnative.databinding.AccettazioneOrdineInevasoMainListGroupHeaderBinding;
|
||||||
import it.integry.integrywmsnative.databinding.AccettazioneOrdineInevasoMainListGroupItemBinding;
|
import it.integry.integrywmsnative.databinding.AccettazioneOrdineInevasoMainListGroupItemBinding;
|
||||||
@@ -112,9 +113,9 @@ public class AccettazioneOrdiniPickingListAdapter extends SectionedRecyclerViewA
|
|||||||
} else if (pickingObjectDTO.getQtaEvasa().floatValue() > 0) {
|
} else if (pickingObjectDTO.getQtaEvasa().floatValue() > 0) {
|
||||||
holder.mBinding.getRoot().setBackgroundColor(mContext.getResources().getColor(R.color.orange_600_with_alpha));
|
holder.mBinding.getRoot().setBackgroundColor(mContext.getResources().getColor(R.color.orange_600_with_alpha));
|
||||||
} else if (position % 2 == 1) {
|
} else if (position % 2 == 1) {
|
||||||
holder.mBinding.getRoot().setBackgroundColor(Color.WHITE);
|
holder.mBinding.getRoot().setBackgroundColor(0);
|
||||||
} else {
|
} else {
|
||||||
holder.mBinding.getRoot().setBackgroundColor(mContext.getResources().getColor(R.color.letturaFacilitataBG));
|
holder.mBinding.getRoot().setBackgroundColor(UtilityResources.getColorResourceFromAttr(mContext, R.attr.colorLetturaFacilitataSurface));
|
||||||
}
|
}
|
||||||
|
|
||||||
holder.mBinding.deactivatedOverBg.setVisibility(!pickingObjectDTO.isActive() ? View.VISIBLE : View.GONE);
|
holder.mBinding.deactivatedOverBg.setVisibility(!pickingObjectDTO.isActive() ? View.VISIBLE : View.GONE);
|
||||||
|
|||||||
@@ -45,9 +45,7 @@ public class DialogSelectDocInfo_FornitoreAdapter extends ArrayAdapter<DialogSel
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return this.getOriginalModel().getCodAnag() +
|
return this.getOriginalModel().getDescrizione();
|
||||||
(this.getOriginalModel().getCodVdes() != null ? " - " + this.getOriginalModel().getCodVdes() : "") +
|
|
||||||
" ( " + this.getOriginalModel().getDescrizione() + " )";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public class AuthenticationRESTConsumer extends _BaseRESTConsumer {
|
|||||||
String host = CommonConst.Login.Azienda.host;
|
String host = CommonConst.Login.Azienda.host;
|
||||||
int port = CommonConst.Login.Azienda.port;
|
int port = CommonConst.Login.Azienda.port;
|
||||||
|
|
||||||
AuthenticationRESTConsumerService service = restBuilder.getService(AuthenticationRESTConsumerService.class, protocol, host, port, false, true);
|
AuthenticationRESTConsumerService service = restBuilder.getService(AuthenticationRESTConsumerService.class, protocol, host, port);
|
||||||
service.loginAzienda(codAzienda).enqueue(new ManagedErrorCallback<>() {
|
service.loginAzienda(codAzienda).enqueue(new ManagedErrorCallback<>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call<ServiceRESTResponse<LoginAziendaDTO>> call, Response<ServiceRESTResponse<LoginAziendaDTO>> response) {
|
public void onResponse(Call<ServiceRESTResponse<LoginAziendaDTO>> call, Response<ServiceRESTResponse<LoginAziendaDTO>> response) {
|
||||||
@@ -67,7 +67,7 @@ public class AuthenticationRESTConsumer extends _BaseRESTConsumer {
|
|||||||
|
|
||||||
|
|
||||||
public void authenticate(String protocol, String host, int port, String username, String password, String profileDb, String deviceSalt, RunnableArgs<AuthenticationJwtResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
public void authenticate(String protocol, String host, int port, String username, String password, String profileDb, String deviceSalt, RunnableArgs<AuthenticationJwtResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
AuthenticationRESTConsumerService service = restBuilder.getService(AuthenticationRESTConsumerService.class, protocol, host, port, false);
|
AuthenticationRESTConsumerService service = restBuilder.getService(AuthenticationRESTConsumerService.class, protocol, host, port);
|
||||||
|
|
||||||
LoginRequestDTO loginRequestDTO = new LoginRequestDTO()
|
LoginRequestDTO loginRequestDTO = new LoginRequestDTO()
|
||||||
.setUsername(username)
|
.setUsername(username)
|
||||||
@@ -94,7 +94,7 @@ public class AuthenticationRESTConsumer extends _BaseRESTConsumer {
|
|||||||
|
|
||||||
|
|
||||||
public void retrieveAvailableProfiles(String protocol, String host, int port, String username, String password, RunnableArgs<List<String>> onComplete, RunnableArgs<Exception> onFailed) {
|
public void retrieveAvailableProfiles(String protocol, String host, int port, String username, String password, RunnableArgs<List<String>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
AuthenticationRESTConsumerService service = restBuilder.getService(AuthenticationRESTConsumerService.class, protocol, host, port, false);
|
AuthenticationRESTConsumerService service = restBuilder.getService(AuthenticationRESTConsumerService.class, protocol, host, port);
|
||||||
|
|
||||||
service.retreiveAvailableProfiles(username, password)
|
service.retreiveAvailableProfiles(username, password)
|
||||||
.enqueue(new ManagedErrorCallback<>() {
|
.enqueue(new ManagedErrorCallback<>() {
|
||||||
|
|||||||
@@ -49,8 +49,12 @@ public class LoginViewModel {
|
|||||||
|
|
||||||
FirebaseInstallations.getInstance().getId().addOnCompleteListener(fid -> {
|
FirebaseInstallations.getInstance().getId().addOnCompleteListener(fid -> {
|
||||||
|
|
||||||
|
SettingsManager.i().createUserSession();
|
||||||
retrieveAvailableProfiles(protocol, host, port, username, password, selectedProfile -> {
|
retrieveAvailableProfiles(protocol, host, port, username, password, selectedProfile -> {
|
||||||
SettingsManager.i().createUserSession();
|
if(selectedProfile == null) {
|
||||||
|
this.sendOnLoadingEnded();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
authenticate(protocol, host, port, username, password, selectedProfile, fid.getResult(), fullName -> {
|
authenticate(protocol, host, port, username, password, selectedProfile, fid.getResult(), fullName -> {
|
||||||
|
|
||||||
@@ -126,6 +130,8 @@ public class LoginViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void authenticate(String protocol, String host, int port, String username, String password, String profileDb, String deviceSalt, RunnableArgs<String> onComplete) {
|
private void authenticate(String protocol, String host, int port, String username, String password, String profileDb, String deviceSalt, RunnableArgs<String> onComplete) {
|
||||||
|
|
||||||
|
|
||||||
mAuthenticationRESTConsumer.authenticate(protocol, host, port, username, password, profileDb, deviceSalt, sessionData -> {
|
mAuthenticationRESTConsumer.authenticate(protocol, host, port, username, password, profileDb, deviceSalt, sessionData -> {
|
||||||
|
|
||||||
var claims = JwtUtils.parseJwt(sessionData.getAccessToken());
|
var claims = JwtUtils.parseJwt(sessionData.getAccessToken());
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ public class MainActivity extends BaseActivity
|
|||||||
mBinding = DataBindingUtil.inflate(LayoutInflater.from(this), R.layout.activity_main, null, false);
|
mBinding = DataBindingUtil.inflate(LayoutInflater.from(this), R.layout.activity_main, null, false);
|
||||||
setContentView(mBinding.getRoot());
|
setContentView(mBinding.getRoot());
|
||||||
|
|
||||||
updatesManager.executeCheck(this, false);
|
updatesManager.executeCheck(this, getSupportFragmentManager(), false);
|
||||||
UtilityContext.initMainActivity(this);
|
UtilityContext.initMainActivity(this);
|
||||||
|
|
||||||
setSupportActionBar(mBinding.appBarMain.toolbar);
|
setSupportActionBar(mBinding.appBarMain.toolbar);
|
||||||
@@ -102,7 +102,7 @@ public class MainActivity extends BaseActivity
|
|||||||
|
|
||||||
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
|
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
|
||||||
this, mBinding.drawerLayout, mBinding.appBarMain.toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
|
this, mBinding.drawerLayout, mBinding.appBarMain.toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
|
||||||
mBinding.drawerLayout.setDrawerListener(toggle);
|
mBinding.drawerLayout.addDrawerListener(toggle);
|
||||||
toggle.syncState();
|
toggle.syncState();
|
||||||
|
|
||||||
|
|
||||||
@@ -122,6 +122,16 @@ public class MainActivity extends BaseActivity
|
|||||||
startActivity(myIntent);
|
startActivity(myIntent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void toggleDrawer() {
|
||||||
|
if (mBinding.drawerLayout.isDrawerOpen(GravityCompat.START)) {
|
||||||
|
mBinding.drawerLayout.closeDrawer(GravityCompat.START);
|
||||||
|
} else {
|
||||||
|
mBinding.drawerLayout.openDrawer(GravityCompat.START);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||||
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
||||||
@@ -294,9 +304,13 @@ public class MainActivity extends BaseActivity
|
|||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
getSupportFragmentManager().popBackStack();
|
getSupportFragmentManager().popBackStack();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mBinding.appBarMain.elevatedToolbar.setVisibility(getSupportFragmentManager().getBackStackEntryCount() > 1 ? View.VISIBLE : View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void adaptViewToFragment(Fragment fragment) {
|
private void adaptViewToFragment(Fragment fragment) {
|
||||||
|
mBinding.appBarMain.elevatedToolbar.setVisibility(fragment instanceof MainFragment ? View.GONE : View.VISIBLE);
|
||||||
|
|
||||||
if (fragment instanceof ISearchableFragment) {
|
if (fragment instanceof ISearchableFragment) {
|
||||||
mBinding.appBarMain.mainSearch.setOnQueryTextListener((SearchView.OnQueryTextListener) fragment);
|
mBinding.appBarMain.mainSearch.setOnQueryTextListener((SearchView.OnQueryTextListener) fragment);
|
||||||
mBinding.appBarMain.mainSearch.setVisibility(View.VISIBLE);
|
mBinding.appBarMain.mainSearch.setVisibility(View.VISIBLE);
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
package it.integry.integrywmsnative.gest.main;
|
package it.integry.integrywmsnative.gest.main;
|
||||||
|
|
||||||
|
|
||||||
import android.animation.ArgbEvaluator;
|
|
||||||
import android.animation.ObjectAnimator;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Color;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
@@ -122,7 +119,6 @@ public class MainFragment extends Fragment implements ITitledFragment, IScrollab
|
|||||||
mBindings = DataBindingUtil.inflate(inflater, R.layout.fragment_main, container, false);
|
mBindings = DataBindingUtil.inflate(inflater, R.layout.fragment_main, container, false);
|
||||||
mBindings.setView(this);
|
mBindings.setView(this);
|
||||||
|
|
||||||
mBindings.easterEggHorrorBloodExpandableLayout.setExpanded(false, false);
|
|
||||||
return mBindings.getRoot();
|
return mBindings.getRoot();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -246,6 +242,13 @@ public class MainFragment extends Fragment implements ITitledFragment, IScrollab
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void toggleDrawer() {
|
||||||
|
if (getActivity() != null && getActivity() instanceof MainActivity) {
|
||||||
|
((MainActivity) getActivity()).toggleDrawer();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void collapseNoConnectionLayout() {
|
private void collapseNoConnectionLayout() {
|
||||||
if (getActivity() != null)
|
if (getActivity() != null)
|
||||||
getActivity().runOnUiThread(() -> mBindings.noConnectionTopLayout.collapse(true));
|
getActivity().runOnUiThread(() -> mBindings.noConnectionTopLayout.collapse(true));
|
||||||
@@ -284,8 +287,8 @@ public class MainFragment extends Fragment implements ITitledFragment, IScrollab
|
|||||||
MenuConfiguration baseMenuConfiguration = new MenuConfiguration();
|
MenuConfiguration baseMenuConfiguration = new MenuConfiguration();
|
||||||
List<MenuConfiguration.MenuGroup> menuGroups = baseMenuConfiguration.getGroups();
|
List<MenuConfiguration.MenuGroup> menuGroups = baseMenuConfiguration.getGroups();
|
||||||
|
|
||||||
for (int i = 0; i < menuGroups.size(); i++) {
|
try {
|
||||||
try {
|
for (int i = 0; i < menuGroups.size(); i++) {
|
||||||
|
|
||||||
BaseMenuConfiguration.MenuGroup menuGroup = menuGroups.get(i);
|
BaseMenuConfiguration.MenuGroup menuGroup = menuGroups.get(i);
|
||||||
|
|
||||||
@@ -313,16 +316,12 @@ public class MainFragment extends Fragment implements ITitledFragment, IScrollab
|
|||||||
menuListAdapter.setClickListener(this::onMenuClick);
|
menuListAdapter.setClickListener(this::onMenuClick);
|
||||||
|
|
||||||
mBindings.menuContainer.addView(groupBinding.getRoot());
|
mBindings.menuContainer.addView(groupBinding.getRoot());
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} catch (Exception exception) {
|
|
||||||
UtilityExceptions.defaultException(requireActivity(), exception);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
} catch (Exception exception) {
|
||||||
|
UtilityExceptions.defaultException(requireActivity(), exception);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onMenuClick(MenuConfiguration.MenuItem menuItem) {
|
private void onMenuClick(MenuConfiguration.MenuItem menuItem) {
|
||||||
@@ -339,89 +338,6 @@ public class MainFragment extends Fragment implements ITitledFragment, IScrollab
|
|||||||
this.mOnPreDestroyList.add(onPreDestroy);
|
this.mOnPreDestroyList.add(onPreDestroy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void toggleEasterEggMode() {
|
|
||||||
easterEggToggle = !easterEggToggle;
|
|
||||||
|
|
||||||
|
|
||||||
int rootBgStart, rootBgEnd;
|
|
||||||
int profileBgStart, profileBgEnd;
|
|
||||||
float titleFlipStart, titleFlipEnd;
|
|
||||||
int animationTimeMillis = 0;
|
|
||||||
|
|
||||||
if (easterEggToggle) {
|
|
||||||
rootBgStart = Color.argb(255, 255, 255, 255);
|
|
||||||
rootBgEnd = Color.argb(255, 0, 0, 0);
|
|
||||||
|
|
||||||
profileBgStart = Color.argb(255, 26, 115, 232);
|
|
||||||
profileBgEnd = Color.argb(255, 211, 47, 47);
|
|
||||||
animationTimeMillis = 2500;
|
|
||||||
titleFlipStart = 1f;
|
|
||||||
titleFlipEnd = -1f;
|
|
||||||
} else {
|
|
||||||
rootBgStart = Color.argb(255, 0, 0, 0);
|
|
||||||
rootBgEnd = Color.argb(255, 255, 255, 255);
|
|
||||||
|
|
||||||
profileBgStart = Color.argb(255, 211, 47, 47);
|
|
||||||
profileBgEnd = Color.argb(255, 26, 115, 232);
|
|
||||||
animationTimeMillis = 750;
|
|
||||||
titleFlipStart = -1f;
|
|
||||||
titleFlipEnd = 1f;
|
|
||||||
}
|
|
||||||
|
|
||||||
mBindings.easterEggHorrorBloodExpandableLayout.setDuration(animationTimeMillis);
|
|
||||||
mBindings.easterEggHorrorBloodExpandableLayout.setExpanded(easterEggToggle, true);
|
|
||||||
|
|
||||||
View rootActivityView = requireActivity().findViewById(R.id.drawer_layout);
|
|
||||||
ObjectAnimator colorFadeRootBg = ObjectAnimator.ofObject(rootActivityView, "backgroundColor",
|
|
||||||
new ArgbEvaluator(),
|
|
||||||
rootBgStart,
|
|
||||||
rootBgEnd);
|
|
||||||
|
|
||||||
colorFadeRootBg.setDuration(animationTimeMillis);
|
|
||||||
colorFadeRootBg.start();
|
|
||||||
|
|
||||||
View toolbarActivityView = requireActivity().findViewById(R.id.toolbar);
|
|
||||||
ObjectAnimator colorFadeToolbarBg = ObjectAnimator.ofObject(toolbarActivityView, "backgroundColor",
|
|
||||||
new ArgbEvaluator(),
|
|
||||||
rootBgStart,
|
|
||||||
rootBgEnd);
|
|
||||||
|
|
||||||
colorFadeToolbarBg.setDuration(animationTimeMillis);
|
|
||||||
colorFadeToolbarBg.start();
|
|
||||||
|
|
||||||
ObjectAnimator colorFadeProfileBg = ObjectAnimator.ofObject(mBindings.profileRootContainer, "backgroundColor",
|
|
||||||
new ArgbEvaluator(),
|
|
||||||
profileBgStart,
|
|
||||||
profileBgEnd);
|
|
||||||
|
|
||||||
colorFadeProfileBg.setDuration(animationTimeMillis);
|
|
||||||
colorFadeProfileBg.start();
|
|
||||||
|
|
||||||
View toolbarTitleActivityView = requireActivity().findViewById(R.id.toolbar_title);
|
|
||||||
ObjectAnimator flipToolbarTitleX = ObjectAnimator.ofFloat(toolbarTitleActivityView, "scaleX",
|
|
||||||
titleFlipStart,
|
|
||||||
titleFlipEnd);
|
|
||||||
|
|
||||||
flipToolbarTitleX.setDuration(animationTimeMillis);
|
|
||||||
flipToolbarTitleX.start();
|
|
||||||
|
|
||||||
ObjectAnimator flipToolbarTitleY = ObjectAnimator.ofFloat(toolbarTitleActivityView, "scaleY",
|
|
||||||
titleFlipStart,
|
|
||||||
titleFlipEnd);
|
|
||||||
|
|
||||||
flipToolbarTitleY.setDuration(animationTimeMillis);
|
|
||||||
flipToolbarTitleY.start();
|
|
||||||
|
|
||||||
ObjectAnimator colorFadeTitleTextColor = ObjectAnimator.ofObject(toolbarTitleActivityView, "textColor",
|
|
||||||
new ArgbEvaluator(),
|
|
||||||
rootBgEnd,
|
|
||||||
rootBgStart);
|
|
||||||
|
|
||||||
colorFadeTitleTextColor.setDuration(animationTimeMillis);
|
|
||||||
colorFadeTitleTextColor.start();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void changeUserDepo() {
|
public void changeUserDepo() {
|
||||||
DialogSwitchUserDepoView.newInstance(SettingsManager.iDB().getAvailableCodMdep(), this::onUserDepoChanged)
|
DialogSwitchUserDepoView.newInstance(SettingsManager.iDB().getAvailableCodMdep(), this::onUserDepoChanged)
|
||||||
.show(getParentFragmentManager(), "switch-user-depo");
|
.show(getParentFragmentManager(), "switch-user-depo");
|
||||||
|
|||||||
@@ -251,6 +251,9 @@ public class OrdiniUscitaElencoFiltroViewModel {
|
|||||||
.distinct()
|
.distinct()
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
|
if(codMdeps.isEmpty())
|
||||||
|
return new ArrayList<>();
|
||||||
|
|
||||||
return Stream.of(Objects.requireNonNull(mtbDepoFullList))
|
return Stream.of(Objects.requireNonNull(mtbDepoFullList))
|
||||||
.filter(x -> codMdeps.contains(x.getCodMdep()))
|
.filter(x -> codMdeps.contains(x.getCodMdep()))
|
||||||
.distinct()
|
.distinct()
|
||||||
|
|||||||
@@ -575,7 +575,7 @@ public class PickingLiberoViewModel {
|
|||||||
MtbColt sourceMtbColt = new MtbColt()
|
MtbColt sourceMtbColt = new MtbColt()
|
||||||
.setNumCollo(mtbColr.getNumCollo())
|
.setNumCollo(mtbColr.getNumCollo())
|
||||||
.setGestione(mtbColr.getGestione())
|
.setGestione(mtbColr.getGestione())
|
||||||
.setDataCollo(mtbColr.getDataColloD())
|
.setDataCollo(mtbColr.getDataColloLD())
|
||||||
.setSerCollo(mtbColr.getSerCollo())
|
.setSerCollo(mtbColr.getSerCollo())
|
||||||
.setMtbColr(new ObservableArrayList<>());
|
.setMtbColr(new ObservableArrayList<>());
|
||||||
|
|
||||||
@@ -695,7 +695,7 @@ public class PickingLiberoViewModel {
|
|||||||
MtbColt mtbColt = mColliMagazzinoRESTConsumer.getByChiaveColloSynchronized(
|
MtbColt mtbColt = mColliMagazzinoRESTConsumer.getByChiaveColloSynchronized(
|
||||||
mtbColr.getGestioneRifEnum(),
|
mtbColr.getGestioneRifEnum(),
|
||||||
mtbColr.getNumColloRif(),
|
mtbColr.getNumColloRif(),
|
||||||
mtbColr.getDataColloRifS(),
|
mtbColr.getDataColloRifLD(),
|
||||||
mtbColr.getSerColloRif(),
|
mtbColr.getSerColloRif(),
|
||||||
true,
|
true,
|
||||||
false);
|
false);
|
||||||
|
|||||||
@@ -565,7 +565,7 @@ public class PickingResiViewModel {
|
|||||||
.setSerColloRif(UtilityString.empty2null(mtbColrToDispatch.getSerCollo()))
|
.setSerColloRif(UtilityString.empty2null(mtbColrToDispatch.getSerCollo()))
|
||||||
.setNumColloRif(mtbColrToDispatch.getNumCollo())
|
.setNumColloRif(mtbColrToDispatch.getNumCollo())
|
||||||
.setGestioneRif(UtilityString.empty2null(mtbColrToDispatch.getGestione()))
|
.setGestioneRif(UtilityString.empty2null(mtbColrToDispatch.getGestione()))
|
||||||
.setDataColloRif(UtilityString.empty2null(mtbColrToDispatch.getDataColloS()));
|
.setDataColloRif(mtbColrToDispatch.getDataColloLD());
|
||||||
|
|
||||||
|
|
||||||
if (mtbColrToDispatch.getPesoNettoKg() != null) {
|
if (mtbColrToDispatch.getPesoNettoKg() != null) {
|
||||||
@@ -608,7 +608,7 @@ public class PickingResiViewModel {
|
|||||||
this.mColliMagazzinoRESTConsumer.saveCollo(cloneMtbColt, value -> {
|
this.mColliMagazzinoRESTConsumer.saveCollo(cloneMtbColt, value -> {
|
||||||
|
|
||||||
mtbColr
|
mtbColr
|
||||||
.setDataCollo(value.getDataColloS())
|
.setDataCollo(value.getDataColloLD())
|
||||||
.setNumCollo(value.getNumCollo())
|
.setNumCollo(value.getNumCollo())
|
||||||
.setGestione(value.getGestione())
|
.setGestione(value.getGestione())
|
||||||
.setSerCollo(value.getSerCollo())
|
.setSerCollo(value.getSerCollo())
|
||||||
@@ -634,7 +634,7 @@ public class PickingResiViewModel {
|
|||||||
|
|
||||||
MtbColt mtbColt = new MtbColt()
|
MtbColt mtbColt = new MtbColt()
|
||||||
.setNumCollo(mtbColrToUpdate.getNumCollo())
|
.setNumCollo(mtbColrToUpdate.getNumCollo())
|
||||||
.setDataCollo(mtbColrToUpdate.getDataColloS())
|
.setDataCollo(mtbColrToUpdate.getDataColloLD())
|
||||||
.setSerCollo(mtbColrToUpdate.getSerCollo())
|
.setSerCollo(mtbColrToUpdate.getSerCollo())
|
||||||
.setGestione(mtbColrToUpdate.getGestione())
|
.setGestione(mtbColrToUpdate.getGestione())
|
||||||
.setMtbColr(new ObservableArrayList<>());
|
.setMtbColr(new ObservableArrayList<>());
|
||||||
@@ -682,7 +682,7 @@ public class PickingResiViewModel {
|
|||||||
|
|
||||||
MtbColt mtbColt = new MtbColt()
|
MtbColt mtbColt = new MtbColt()
|
||||||
.setNumCollo(mtbColrToDelete.getNumCollo())
|
.setNumCollo(mtbColrToDelete.getNumCollo())
|
||||||
.setDataCollo(mtbColrToDelete.getDataColloS())
|
.setDataCollo(mtbColrToDelete.getDataColloLD())
|
||||||
.setSerCollo(mtbColrToDelete.getSerCollo())
|
.setSerCollo(mtbColrToDelete.getSerCollo())
|
||||||
.setGestione(mtbColrToDelete.getGestione())
|
.setGestione(mtbColrToDelete.getGestione())
|
||||||
.setMtbColr(new ObservableArrayList<>());
|
.setMtbColr(new ObservableArrayList<>());
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ public class PickingResiListAdapter extends SectionedRecyclerViewAdapter<Picking
|
|||||||
} else if (position % 2 == 1) {
|
} else if (position % 2 == 1) {
|
||||||
holder.mBinding.getRoot().setBackgroundColor(Color.WHITE);
|
holder.mBinding.getRoot().setBackgroundColor(Color.WHITE);
|
||||||
} else {
|
} else {
|
||||||
holder.mBinding.getRoot().setBackgroundColor(mContext.getResources().getColor(R.color.letturaFacilitataBG));
|
holder.mBinding.getRoot().setBackgroundColor(mContext.getResources().getColor(R.color.letturaFacilitataBGLight));
|
||||||
}
|
}
|
||||||
|
|
||||||
holder.mBinding.deactivatedOverBg.setVisibility(!pickingResiListModel.isActive() ? View.VISIBLE : View.GONE);
|
holder.mBinding.deactivatedOverBg.setVisibility(!pickingResiListModel.isActive() ? View.VISIBLE : View.GONE);
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import androidx.databinding.DataBindingUtil;
|
|||||||
import androidx.databinding.ObservableArrayList;
|
import androidx.databinding.ObservableArrayList;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
import com.annimon.stream.Stream;
|
|
||||||
import com.ravikoradiya.liveadapter.LiveAdapter;
|
import com.ravikoradiya.liveadapter.LiveAdapter;
|
||||||
import com.ravikoradiya.liveadapter.Type;
|
import com.ravikoradiya.liveadapter.Type;
|
||||||
|
|
||||||
@@ -56,6 +55,7 @@ import it.integry.integrywmsnative.gest.spedizione.dialogs.row_info.prod_fabbiso
|
|||||||
import it.integry.integrywmsnative.ui.filter_chips.FilterChipDTO;
|
import it.integry.integrywmsnative.ui.filter_chips.FilterChipDTO;
|
||||||
import it.integry.integrywmsnative.ui.filter_chips.FilterChipView;
|
import it.integry.integrywmsnative.ui.filter_chips.FilterChipView;
|
||||||
import it.integry.integrywmsnative.ui.filter_chips.filters.FilterNumeroOrdineLayoutView;
|
import it.integry.integrywmsnative.ui.filter_chips.filters.FilterNumeroOrdineLayoutView;
|
||||||
|
import kotlin.Unit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A simple {@link Fragment} subclass.
|
* A simple {@link Fragment} subclass.
|
||||||
@@ -119,20 +119,39 @@ public class ProdFabbisognoLineeProdFragment extends BaseFragment implements ITi
|
|||||||
@Override
|
@Override
|
||||||
public void onStart() {
|
public void onStart() {
|
||||||
super.onStart();
|
super.onStart();
|
||||||
mViewModel.init();
|
|
||||||
|
this.onLoadingStarted();
|
||||||
|
executorService.execute(() -> {
|
||||||
|
try {
|
||||||
|
mViewModel.init();
|
||||||
|
this.onLoadingEnded();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
this.onError(ex);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initRecyclerView() {
|
private void initRecyclerView() {
|
||||||
mViewModel.getOrdiniList().observe(getViewLifecycleOwner(), data -> {
|
mViewModel.getOrdiniList().observe(getViewLifecycleOwner(), data -> {
|
||||||
mBindings.emptyView.setVisibility(data == null || data.isEmpty() ? View.VISIBLE : View.GONE);
|
|
||||||
|
|
||||||
this.onLoadingStarted();
|
this.onLoadingStarted();
|
||||||
this.initMtbGrupsCache(() -> {
|
|
||||||
this.initJtbComtCache(this::onLoadingEnded);
|
executorService.execute(() -> {
|
||||||
|
try {
|
||||||
|
this.initMtbGrupsCache();
|
||||||
|
this.initJtbComtCache();
|
||||||
|
this.onLoadingEnded();
|
||||||
|
|
||||||
|
handler.post(() -> {
|
||||||
|
mFilterViewModel.init(mViewModel.getOrdiniList().getValue());
|
||||||
|
this.refreshList(null);
|
||||||
|
});
|
||||||
|
} catch (Exception ex) {
|
||||||
|
this.onError(ex);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
mFilterViewModel.init(mViewModel.getOrdiniList().getValue());
|
|
||||||
this.refreshList(null);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
var itemTypeHeader = new Type<GroupTitleModel, FragmentProdFabbisognoLineeTitleItemBinding>(R.layout.fragment_prod_fabbisogno_linee_title_item, BR.item);
|
var itemTypeHeader = new Type<GroupTitleModel, FragmentProdFabbisognoLineeTitleItemBinding>(R.layout.fragment_prod_fabbisogno_linee_title_item, BR.item);
|
||||||
@@ -142,13 +161,13 @@ public class ProdFabbisognoLineeProdFragment extends BaseFragment implements ITi
|
|||||||
var item = x.getBinding().getItem();
|
var item = x.getBinding().getItem();
|
||||||
item.getSelected().set(!item.getSelected().get());
|
item.getSelected().set(!item.getSelected().get());
|
||||||
|
|
||||||
Stream.of(mProdFabbisognoItemModel)
|
mProdFabbisognoItemModel.stream()
|
||||||
.filter(y -> y instanceof ProdFabbisognoLineeItemModelDto && ((ProdFabbisognoLineeItemModelDto) y).getOrdineLavorazioneDTO().getCodJfas().equals(item.getTitle()))
|
.filter(y -> y instanceof ProdFabbisognoLineeItemModelDto && ((ProdFabbisognoLineeItemModelDto) y).getOrdineLavorazioneDTO().getCodJfas().equals(item.getTitle()))
|
||||||
.forEach(y -> {
|
.forEach(y -> {
|
||||||
((ProdFabbisognoLineeItemModelDto) y).getSelected().set(item.selected.get());
|
((ProdFabbisognoLineeItemModelDto) y).getSelected().set(item.selected.get());
|
||||||
});
|
});
|
||||||
|
|
||||||
fabVisible.set(Stream.of(mProdFabbisognoItemModel)
|
fabVisible.set(mProdFabbisognoItemModel.stream()
|
||||||
.filter(y -> y instanceof ProdFabbisognoLineeItemModelDto)
|
.filter(y -> y instanceof ProdFabbisognoLineeItemModelDto)
|
||||||
.anyMatch(y -> ((ProdFabbisognoLineeItemModelDto) y).getSelected().get()));
|
.anyMatch(y -> ((ProdFabbisognoLineeItemModelDto) y).getSelected().get()));
|
||||||
|
|
||||||
@@ -159,7 +178,7 @@ public class ProdFabbisognoLineeProdFragment extends BaseFragment implements ITi
|
|||||||
var item = x.getBinding().getItem();
|
var item = x.getBinding().getItem();
|
||||||
item.getSelected().set(!item.getSelected().get());
|
item.getSelected().set(!item.getSelected().get());
|
||||||
|
|
||||||
fabVisible.set(Stream.of(mProdFabbisognoItemModel)
|
fabVisible.set(mProdFabbisognoItemModel.stream()
|
||||||
.filter(y -> y instanceof ProdFabbisognoLineeItemModelDto)
|
.filter(y -> y instanceof ProdFabbisognoLineeItemModelDto)
|
||||||
.anyMatch(y -> ((ProdFabbisognoLineeItemModelDto) y).getSelected().get()));
|
.anyMatch(y -> ((ProdFabbisognoLineeItemModelDto) y).getSelected().get()));
|
||||||
|
|
||||||
@@ -169,6 +188,10 @@ public class ProdFabbisognoLineeProdFragment extends BaseFragment implements ITi
|
|||||||
new LiveAdapter(mProdFabbisognoItemModel)
|
new LiveAdapter(mProdFabbisognoItemModel)
|
||||||
.map(GroupTitleModel.class, itemTypeHeader)
|
.map(GroupTitleModel.class, itemTypeHeader)
|
||||||
.map(ProdFabbisognoLineeItemModelDto.class, itemType)
|
.map(ProdFabbisognoLineeItemModelDto.class, itemType)
|
||||||
|
.onNoData(noData -> {
|
||||||
|
mBindings.emptyView.setVisibility(noData ? View.VISIBLE : View.GONE);
|
||||||
|
return Unit.INSTANCE;
|
||||||
|
})
|
||||||
.into(this.mBindings.inventarioList);
|
.into(this.mBindings.inventarioList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -191,10 +214,6 @@ public class ProdFabbisognoLineeProdFragment extends BaseFragment implements ITi
|
|||||||
|
|
||||||
private List<Object> convertDataModelToListModel(List<ProdFabbisognoLineeItemModelDto> itemModel) {
|
private List<Object> convertDataModelToListModel(List<ProdFabbisognoLineeItemModelDto> itemModel) {
|
||||||
|
|
||||||
Stream.of(itemModel)
|
|
||||||
.sorted(Comparator.comparing(x -> x.getOrdineLavorazioneDTO().getCodJfas()))
|
|
||||||
.toList();
|
|
||||||
|
|
||||||
List<Object> listaFinale = new ArrayList<>();
|
List<Object> listaFinale = new ArrayList<>();
|
||||||
String currentGroup = null;
|
String currentGroup = null;
|
||||||
|
|
||||||
@@ -224,10 +243,10 @@ public class ProdFabbisognoLineeProdFragment extends BaseFragment implements ITi
|
|||||||
mFilterViewModel.getCurrentNumOrdsPredicate().addOnPropertyChangedCallback(onPredicateChanged);
|
mFilterViewModel.getCurrentNumOrdsPredicate().addOnPropertyChangedCallback(onPredicateChanged);
|
||||||
mFilterViewModel.getCurrentGruppoMercPredicate().addOnPropertyChangedCallback(onPredicateChanged);
|
mFilterViewModel.getCurrentGruppoMercPredicate().addOnPropertyChangedCallback(onPredicateChanged);
|
||||||
|
|
||||||
List<FilterChipDTO> filterList = Stream.of(ProdFabbisognoLineeProdBindings.AVAILABLE_FILTERS.entrySet())
|
List<FilterChipDTO> filterList = ProdFabbisognoLineeProdBindings.AVAILABLE_FILTERS.entrySet().stream()
|
||||||
.map(Map.Entry::getValue)
|
.map(Map.Entry::getValue)
|
||||||
.sortBy(FilterChipDTO::getPosizione)
|
.sorted(Comparator.comparing(FilterChipDTO::getPosizione))
|
||||||
.toList();
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
for (FilterChipDTO filterChipDTO : filterList) {
|
for (FilterChipDTO filterChipDTO : filterList) {
|
||||||
|
|
||||||
@@ -303,11 +322,11 @@ public class ProdFabbisognoLineeProdFragment extends BaseFragment implements ITi
|
|||||||
.setAllNumOrds(mFilterViewModel.getAllNumOrds())
|
.setAllNumOrds(mFilterViewModel.getAllNumOrds())
|
||||||
.setAvailableNumOrds(mFilterViewModel.getAvailableNumOrds())
|
.setAvailableNumOrds(mFilterViewModel.getAvailableNumOrds())
|
||||||
.setOnFilterApplied(mFilterViewModel::setNumOrdFilter)
|
.setOnFilterApplied(mFilterViewModel::setNumOrdFilter)
|
||||||
.setPreSelectedNumOrds(Stream.of(Objects.requireNonNull(mViewModel.getOrdiniList().getValue()))
|
.setPreSelectedNumOrds(Objects.requireNonNull(mViewModel.getOrdiniList().getValue()).stream()
|
||||||
.filter(mFilterViewModel.getCurrentNumOrdsPredicate().get() == null ?
|
.filter(mFilterViewModel.getCurrentNumOrdsPredicate().get() == null ?
|
||||||
x -> false : Objects.requireNonNull(mFilterViewModel.getCurrentNumOrdsPredicate().get()))
|
x -> false : Objects.requireNonNull(mFilterViewModel.getCurrentNumOrdsPredicate().get()))
|
||||||
.map(x -> x.getOrdineLavorazioneDTO().getNumOrd())
|
.map(x -> x.getOrdineLavorazioneDTO().getNumOrd())
|
||||||
.toList());
|
.collect(Collectors.toList()));
|
||||||
|
|
||||||
case ProdFabbisognoLineeProdBindings.MGRP_FILTER_ID ->
|
case ProdFabbisognoLineeProdBindings.MGRP_FILTER_ID ->
|
||||||
((FilterGruppoMercLayoutView) filterLayoutView)
|
((FilterGruppoMercLayoutView) filterLayoutView)
|
||||||
@@ -322,42 +341,36 @@ public class ProdFabbisognoLineeProdFragment extends BaseFragment implements ITi
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initMtbGrupsCache(Runnable onComplete) {
|
private void initMtbGrupsCache() throws Exception {
|
||||||
var codMgrpArts = Stream.of(Objects.requireNonNull(this.mViewModel.getOrdiniList().getValue()))
|
var codMgrpArts = Objects.requireNonNull(this.mViewModel.getOrdiniList().getValue()).stream()
|
||||||
.flatMap(x -> Stream.of(x.getOrdineLavorazioneDTO().getAvailableClassMerc() != null ?
|
.flatMap(x ->
|
||||||
x.getOrdineLavorazioneDTO().getAvailableClassMerc() : new ArrayList<>()))
|
(x.getOrdineLavorazioneDTO().getAvailableClassMerc() != null ?
|
||||||
|
x.getOrdineLavorazioneDTO().getAvailableClassMerc() : new ArrayList<OrdineLavorazioneDTO.AvailableClassMerc>()).stream())
|
||||||
.map(OrdineLavorazioneDTO.AvailableClassMerc::getCodMgrp)
|
.map(OrdineLavorazioneDTO.AvailableClassMerc::getCodMgrp)
|
||||||
.withoutNulls()
|
.filter(Objects::nonNull)
|
||||||
.distinct()
|
.distinct()
|
||||||
.toList();
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
this.mArticoloRESTConsumer.getArtsGroups(codMgrpArts, mtbGrupCache -> {
|
this.mtbGrupCache = this.mArticoloRESTConsumer.getArtsGroupsSynchronized(codMgrpArts);
|
||||||
this.mtbGrupCache = mtbGrupCache;
|
|
||||||
onComplete.run();
|
|
||||||
}, this::onError);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initJtbComtCache(Runnable onComplete) {
|
private void initJtbComtCache() throws Exception {
|
||||||
if (this.mViewModel.getOrdiniList().getValue() == null) {
|
if (this.mViewModel.getOrdiniList().getValue() == null) {
|
||||||
this.jtbComtCache = new ArrayList<>();
|
this.jtbComtCache = new ArrayList<>();
|
||||||
onComplete.run();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var jtbComts = Stream.of(Objects.requireNonNull(this.mViewModel.getOrdiniList().getValue()))
|
var jtbComts = Objects.requireNonNull(this.mViewModel.getOrdiniList().getValue()).stream()
|
||||||
.flatMap(x -> Stream.of(x.getOrdineLavorazioneDTO().getCodJcom()))
|
.map(x -> x.getOrdineLavorazioneDTO().getCodJcom())
|
||||||
.distinct().withoutNulls()
|
.filter(Objects::nonNull)
|
||||||
.toList();
|
.distinct()
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
if (jtbComts.isEmpty()) {
|
if (jtbComts.isEmpty()) {
|
||||||
this.jtbComtCache = new ArrayList<>();
|
this.jtbComtCache = new ArrayList<>();
|
||||||
onComplete.run();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.mCommessaRESTConsumer.getJtbComts(jtbComts, jtbComtCache -> {
|
this.jtbComtCache = this.mCommessaRESTConsumer.getJtbComtsSynchronized(jtbComts);
|
||||||
this.jtbComtCache = jtbComtCache;
|
|
||||||
onComplete.run();
|
|
||||||
}, this::onError);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -383,27 +396,34 @@ public class ProdFabbisognoLineeProdFragment extends BaseFragment implements ITi
|
|||||||
.map(x -> String.valueOf(((ProdFabbisognoLineeItemModelDto) x).getOrdineLavorazioneDTO().getNumOrd()))
|
.map(x -> String.valueOf(((ProdFabbisognoLineeItemModelDto) x).getOrdineLavorazioneDTO().getNumOrd()))
|
||||||
.collect(Collectors.toList()));
|
.collect(Collectors.toList()));
|
||||||
|
|
||||||
LocalDate dataInizio = Stream.of(mProdFabbisognoItemModel)
|
LocalDate dataInizio = mProdFabbisognoItemModel.stream()
|
||||||
.filter(x -> x instanceof ProdFabbisognoLineeItemModelDto && ((ProdFabbisognoLineeItemModelDto) x).selected.get())
|
.filter(x -> x instanceof ProdFabbisognoLineeItemModelDto && ((ProdFabbisognoLineeItemModelDto) x).selected.get())
|
||||||
.map(x -> ((ProdFabbisognoLineeItemModelDto) x).getOrdineLavorazioneDTO().getDataOrd())
|
.map(x -> ((ProdFabbisognoLineeItemModelDto) x).getOrdineLavorazioneDTO().getDataOrd())
|
||||||
.min(Comparator.naturalOrder())
|
.min(Comparator.naturalOrder())
|
||||||
.orElse(null);
|
.orElse(null);
|
||||||
|
|
||||||
LocalDate dataFine = Stream.of(mProdFabbisognoItemModel)
|
LocalDate dataFine = mProdFabbisognoItemModel.stream()
|
||||||
.filter(x -> x instanceof ProdFabbisognoLineeItemModelDto && ((ProdFabbisognoLineeItemModelDto) x).selected.get())
|
.filter(x -> x instanceof ProdFabbisognoLineeItemModelDto && ((ProdFabbisognoLineeItemModelDto) x).selected.get())
|
||||||
.map(x -> ((ProdFabbisognoLineeItemModelDto) x).getOrdineLavorazioneDTO().getDataOrd())
|
.map(x -> ((ProdFabbisognoLineeItemModelDto) x).getOrdineLavorazioneDTO().getDataOrd())
|
||||||
.max(Comparator.naturalOrder())
|
.max(Comparator.naturalOrder())
|
||||||
.orElse(null);
|
.orElse(null);
|
||||||
|
|
||||||
List<MtbGrup> listMtbGrup = Stream.of(mProdFabbisognoItemModel)
|
List<MtbGrup> listMtbGrup = mProdFabbisognoItemModel.stream()
|
||||||
.filter(x -> x instanceof ProdFabbisognoLineeItemModelDto && ((ProdFabbisognoLineeItemModelDto) x).selected.get())
|
.filter(x -> x instanceof ProdFabbisognoLineeItemModelDto && ((ProdFabbisognoLineeItemModelDto) x).selected.get())
|
||||||
.flatMap(x -> Stream.of(((ProdFabbisognoLineeItemModelDto) x).getSelectedMtbGrup()))
|
.flatMap(x -> ((ProdFabbisognoLineeItemModelDto) x).getSelectedMtbGrup().stream())
|
||||||
.toList();
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
this.mViewModel.loadFabbisogno(ordini, codMdep, dataInizio, dataFine, onCompleteData -> {
|
executorService.execute(() -> {
|
||||||
startPickingActivity(listMtbGrup, onCompleteData);
|
try {
|
||||||
|
onLoadingStarted();
|
||||||
|
var fabbisognoData = this.mViewModel.loadFabbisogno(ordini, codMdep, dataInizio, dataFine);
|
||||||
|
onLoadingEnded();
|
||||||
|
|
||||||
|
startPickingActivity(listMtbGrup, fabbisognoData);
|
||||||
|
} catch (Exception e) {
|
||||||
|
this.onError(e);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void startPickingActivity(List<MtbGrup> listMtbGrup, List<ProdFabbisognoLineeProdDTO> fabbisognoList) {
|
private void startPickingActivity(List<MtbGrup> listMtbGrup, List<ProdFabbisognoLineeProdDTO> fabbisognoList) {
|
||||||
@@ -414,10 +434,10 @@ public class ProdFabbisognoLineeProdFragment extends BaseFragment implements ITi
|
|||||||
.map(x -> String.valueOf(((ProdFabbisognoLineeItemModelDto) x).getOrdineLavorazioneDTO().getNumOrd()))
|
.map(x -> String.valueOf(((ProdFabbisognoLineeItemModelDto) x).getOrdineLavorazioneDTO().getNumOrd()))
|
||||||
.collect(Collectors.toList()));
|
.collect(Collectors.toList()));
|
||||||
|
|
||||||
Stream<ProdFabbisognoLineeProdDTO> streamSitArtOrd = Stream.of(fabbisognoList);
|
java.util.stream.Stream<ProdFabbisognoLineeProdDTO> streamSitArtOrd = fabbisognoList.stream();
|
||||||
|
|
||||||
streamSitArtOrd = listMtbGrup != null && !listMtbGrup.isEmpty() ?
|
streamSitArtOrd = listMtbGrup != null && !listMtbGrup.isEmpty() ?
|
||||||
streamSitArtOrd.filter(x -> Stream.of(listMtbGrup).anyMatch(y -> y.getCodMgrp().equalsIgnoreCase(x.getCodMgrp()))) :
|
streamSitArtOrd.filter(x -> listMtbGrup.stream().anyMatch(y -> y.getCodMgrp().equalsIgnoreCase(x.getCodMgrp()))) :
|
||||||
streamSitArtOrd;
|
streamSitArtOrd;
|
||||||
|
|
||||||
List<SitArtOrdDTO> sitArtOrdDTOS = streamSitArtOrd.map(x -> {
|
List<SitArtOrdDTO> sitArtOrdDTOS = streamSitArtOrd.map(x -> {
|
||||||
@@ -439,7 +459,7 @@ public class ProdFabbisognoLineeProdFragment extends BaseFragment implements ITi
|
|||||||
|
|
||||||
return sitArtOrdDTO;
|
return sitArtOrdDTO;
|
||||||
})
|
})
|
||||||
.toList();
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
boolean divideByGrpMerc = SettingsManager.iDB().isGroupPoductionByCommodityGroup();
|
boolean divideByGrpMerc = SettingsManager.iDB().isGroupPoductionByCommodityGroup();
|
||||||
|
|
||||||
|
|||||||
@@ -3,14 +3,12 @@ package it.integry.integrywmsnative.gest.prod_fabbisogno_linee_prod;
|
|||||||
import androidx.lifecycle.LiveData;
|
import androidx.lifecycle.LiveData;
|
||||||
import androidx.lifecycle.MutableLiveData;
|
import androidx.lifecycle.MutableLiveData;
|
||||||
|
|
||||||
import com.annimon.stream.Stream;
|
|
||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
|
||||||
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
|
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.MesRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.MesRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||||
@@ -35,47 +33,41 @@ public class ProdFabbisognoLineeProdViewModel {
|
|||||||
this.mMesRESTConsumer = mesRESTConsumer;
|
this.mMesRESTConsumer = mesRESTConsumer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init() {
|
public void init() throws Exception {
|
||||||
loadData();
|
loadData();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadData() {
|
public void loadData() throws Exception {
|
||||||
this.sendOnLoadingStarted();
|
|
||||||
|
|
||||||
this.mMesRESTConsumer.getOrdiniLavorazione("I", ordini -> {
|
var ordini = this.mMesRESTConsumer.getOrdiniLavorazioneSynchronized("I");
|
||||||
|
|
||||||
List<ProdFabbisognoLineeItemModelDto> itemModel = Stream.of(ordini)
|
List<ProdFabbisognoLineeItemModelDto> itemModel = ordini.stream()
|
||||||
.filter(x -> x.getCodMdep().equals(SettingsManager.i().getUserSession().getDepo().getCodMdep()))
|
.filter(x -> x.getCodMdep().equals(SettingsManager.i().getUserSession().getDepo().getCodMdep()))
|
||||||
.map(ord -> new ProdFabbisognoLineeItemModelDto()
|
.map(ord ->
|
||||||
.setOrdineLavorazioneDTO(ord)
|
new ProdFabbisognoLineeItemModelDto()
|
||||||
)
|
.setOrdineLavorazioneDTO(ord)
|
||||||
.sorted(Comparator.comparing(x -> x.getOrdineLavorazioneDTO().getCodJfas()))
|
)
|
||||||
.toList();
|
.sorted(Comparator.comparing(x -> x.getOrdineLavorazioneDTO().getCodJfas()))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
ordiniList.postValue(itemModel);
|
ordiniList.postValue(itemModel);
|
||||||
this.sendOnLoadingEnded();
|
|
||||||
}, this::sendError);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public LiveData<List<ProdFabbisognoLineeItemModelDto>> getOrdiniList() {
|
public LiveData<List<ProdFabbisognoLineeItemModelDto>> getOrdiniList() {
|
||||||
return ordiniList;
|
return ordiniList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadFabbisogno(String ordini, String codMdep, LocalDate dataInizio, LocalDate dataFine, RunnableArgs<List<ProdFabbisognoLineeProdDTO>> onComplete) {
|
public List<ProdFabbisognoLineeProdDTO> loadFabbisogno(String ordini, String codMdep, LocalDate dataInizio, LocalDate dataFine) throws Exception {
|
||||||
this.sendOnLoadingStarted();
|
|
||||||
|
|
||||||
this.mProdFabbisognoLineeProdRESTConsumer.loadFabbisogno(ordini, codMdep, jtbFasi -> {
|
var jtbFasi = this.mProdFabbisognoLineeProdRESTConsumer.loadFabbisognoSynchronized(ordini, codMdep);
|
||||||
if (jtbFasi == null) jtbFasi = new ArrayList<>();
|
if (jtbFasi == null) jtbFasi = new ArrayList<>();
|
||||||
|
|
||||||
Stream.of(jtbFasi)
|
jtbFasi.forEach(x -> {
|
||||||
.forEach(x -> {
|
x.setDataInizio(dataInizio);
|
||||||
x.setDataInizio(dataInizio);
|
x.setDataFine(dataFine);
|
||||||
x.setDataFine(dataFine);
|
});
|
||||||
});
|
|
||||||
|
|
||||||
this.sendOnLoadingEnded();
|
return jtbFasi;
|
||||||
onComplete.run(jtbFasi);
|
|
||||||
}, this::sendError);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,12 +3,11 @@ package it.integry.integrywmsnative.gest.prod_fabbisogno_linee_prod.filters;
|
|||||||
import androidx.databinding.ObservableField;
|
import androidx.databinding.ObservableField;
|
||||||
import androidx.lifecycle.MutableLiveData;
|
import androidx.lifecycle.MutableLiveData;
|
||||||
|
|
||||||
import com.annimon.stream.Stream;
|
|
||||||
import com.annimon.stream.function.Predicate;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.function.Predicate;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.model.MtbGrup;
|
import it.integry.integrywmsnative.core.model.MtbGrup;
|
||||||
@@ -45,9 +44,11 @@ public class ProdFabbisognoLineeProdFilterViewModel {
|
|||||||
this.selectedMtbGrup = new ArrayList<>();
|
this.selectedMtbGrup = new ArrayList<>();
|
||||||
} else {
|
} else {
|
||||||
this.selectedMtbGrup = mtbGrupList;
|
this.selectedMtbGrup = mtbGrupList;
|
||||||
var mtbGrups = Stream.of(mtbGrupList).map(MtbGrup::getCodMgrp).toList();
|
var mtbGrups = mtbGrupList.stream()
|
||||||
|
.map(MtbGrup::getCodMgrp)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
currentGruppoMercPredicate.set(x -> Stream.of(x.getOrdineLavorazioneDTO().getAvailableClassMerc())
|
currentGruppoMercPredicate.set(x -> x.getOrdineLavorazioneDTO().getAvailableClassMerc().stream()
|
||||||
.anyMatch(y -> mtbGrups.contains(y.getCodMgrp())));
|
.anyMatch(y -> mtbGrups.contains(y.getCodMgrp())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -59,16 +60,19 @@ public class ProdFabbisognoLineeProdFilterViewModel {
|
|||||||
currentGruppoMercPredicate.get() == null) {
|
currentGruppoMercPredicate.get() == null) {
|
||||||
returnList = this.initialList;
|
returnList = this.initialList;
|
||||||
} else {
|
} else {
|
||||||
returnList = Stream.of(this.initialList)
|
returnList = this.initialList.stream()
|
||||||
.filter(x -> (currentNumOrdsPredicate.get() == null || (currentNumOrdsPredicate.get().test(x))) &&
|
.filter(x -> (currentNumOrdsPredicate.get() == null || (currentNumOrdsPredicate.get().test(x))) &&
|
||||||
(currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x)))
|
(currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x)))
|
||||||
).map(x -> x.setSelectedMtbGrup(this.selectedMtbGrup)).toList();
|
)
|
||||||
|
.map(x -> x.setSelectedMtbGrup(this.selectedMtbGrup))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.currentList.setValue(returnList);
|
this.currentList.setValue(returnList);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ObservableField<Predicate<ProdFabbisognoLineeItemModelDto>> getCurrentNumOrdsPredicate() {
|
public ObservableField<java.util.function.Predicate<ProdFabbisognoLineeItemModelDto>> getCurrentNumOrdsPredicate() {
|
||||||
return currentNumOrdsPredicate;
|
return currentNumOrdsPredicate;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,11 +91,11 @@ public class ProdFabbisognoLineeProdFilterViewModel {
|
|||||||
public List<Integer> getAvailableNumOrds() {
|
public List<Integer> getAvailableNumOrds() {
|
||||||
if (currentGruppoMercPredicate.get() == null) return getAllNumOrds();
|
if (currentGruppoMercPredicate.get() == null) return getAllNumOrds();
|
||||||
else {
|
else {
|
||||||
return Stream.of(this.initialList)
|
return this.initialList.stream()
|
||||||
.filter(x -> (currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x))))
|
.filter(x -> (currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x))))
|
||||||
.map(x -> x.getOrdineLavorazioneDTO().getNumOrd())
|
.map(x -> x.getOrdineLavorazioneDTO().getNumOrd())
|
||||||
.distinct()
|
.distinct()
|
||||||
.toList();
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,43 +104,41 @@ public class ProdFabbisognoLineeProdFilterViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<MtbGrup> getAllGruppoMerc(List<MtbGrup> mtbGrupFullList) {
|
public List<MtbGrup> getAllGruppoMerc(List<MtbGrup> mtbGrupFullList) {
|
||||||
var codMgrp = Stream.of(initialList)
|
var codMgrp = initialList.stream()
|
||||||
.flatMap(x ->
|
.flatMap(x ->
|
||||||
Stream.of(x.getOrdineLavorazioneDTO().getAvailableClassMerc() != null ?
|
(x.getOrdineLavorazioneDTO().getAvailableClassMerc() != null ?
|
||||||
x.getOrdineLavorazioneDTO().getAvailableClassMerc() :
|
x.getOrdineLavorazioneDTO().getAvailableClassMerc() :
|
||||||
new ArrayList<>()))
|
new ArrayList<OrdineLavorazioneDTO.AvailableClassMerc>()).stream())
|
||||||
.map(OrdineLavorazioneDTO.AvailableClassMerc::getCodMgrp)
|
.map(OrdineLavorazioneDTO.AvailableClassMerc::getCodMgrp)
|
||||||
.withoutNulls()
|
.filter(Objects::nonNull)
|
||||||
.distinct()
|
.distinct()
|
||||||
.toList();
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
return Stream.of(Objects.requireNonNull(mtbGrupFullList))
|
return Objects.requireNonNull(mtbGrupFullList).stream()
|
||||||
.filter(x -> codMgrp.contains(x.getCodMgrp()))
|
.filter(x -> x != null && codMgrp.contains(x.getCodMgrp()))
|
||||||
.distinct()
|
.distinct()
|
||||||
.withoutNulls()
|
.sorted(Comparator.comparing(MtbGrup::getDescrizione))
|
||||||
.sortBy(MtbGrup::getDescrizione)
|
.collect(Collectors.toList());
|
||||||
.toList();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<MtbGrup> getAvailableGruppoMerc(List<MtbGrup> mtbGrupFullList){
|
public List<MtbGrup> getAvailableGruppoMerc(List<MtbGrup> mtbGrupFullList) {
|
||||||
if (currentNumOrdsPredicate.get() == null){
|
if (currentNumOrdsPredicate.get() == null) {
|
||||||
return getAllGruppoMerc(mtbGrupFullList);
|
return getAllGruppoMerc(mtbGrupFullList);
|
||||||
} else {
|
} else {
|
||||||
List<String> availableCodMgrups = Stream.of(this.initialList)
|
List<String> availableCodMgrups = this.initialList.stream()
|
||||||
.filter(x ->
|
.filter(x ->
|
||||||
(currentNumOrdsPredicate.get() == null || (currentNumOrdsPredicate.get().test(x)))
|
(currentNumOrdsPredicate.get() == null || (currentNumOrdsPredicate.get().test(x)))
|
||||||
)
|
)
|
||||||
.flatMap(x -> Stream.of(x.getOrdineLavorazioneDTO().getAvailableClassMerc()))
|
.flatMap(x -> x.getOrdineLavorazioneDTO().getAvailableClassMerc().stream())
|
||||||
.map(OrdineLavorazioneDTO.AvailableClassMerc::getCodMgrp)
|
.map(OrdineLavorazioneDTO.AvailableClassMerc::getCodMgrp)
|
||||||
.distinct()
|
.distinct()
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
return Stream.of(Objects.requireNonNull(mtbGrupFullList))
|
return Objects.requireNonNull(mtbGrupFullList).stream()
|
||||||
.filter(x -> availableCodMgrups.contains(x.getCodMgrp()))
|
.filter(x -> x != null && availableCodMgrups.contains(x.getCodMgrp()))
|
||||||
.distinct()
|
.distinct()
|
||||||
.withoutNulls()
|
.sorted(Comparator.comparing(MtbGrup::getDescrizione))
|
||||||
.sortBy(MtbGrup::getDescrizione)
|
.collect(Collectors.toList());
|
||||||
.toList();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,26 +1,21 @@
|
|||||||
package it.integry.integrywmsnative.gest.prod_fabbisogno_linee_prod.rest;
|
package it.integry.integrywmsnative.gest.prod_fabbisogno_linee_prod.rest;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import com.google.common.reflect.TypeToken;
|
||||||
|
|
||||||
import com.google.gson.reflect.TypeToken;
|
|
||||||
|
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
import it.integry.integrywmsnative.core.model.JtbFasi;
|
||||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers._BaseRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers._BaseRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
|
|
||||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityDB;
|
import it.integry.integrywmsnative.core.utility.UtilityDB;
|
||||||
import it.integry.integrywmsnative.gest.prod_fabbisogno_linee_prod.dto.ProdFabbisognoLineeProdDTO;
|
import it.integry.integrywmsnative.gest.prod_fabbisogno_linee_prod.dto.ProdFabbisognoLineeProdDTO;
|
||||||
import retrofit2.Call;
|
|
||||||
import retrofit2.Response;
|
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class ProdFabbisognoLineeProdRESTConsumer extends _BaseRESTConsumer {
|
public class ProdFabbisognoLineeProdRESTConsumer extends _BaseRESTConsumer {
|
||||||
@@ -28,32 +23,25 @@ public class ProdFabbisognoLineeProdRESTConsumer extends _BaseRESTConsumer {
|
|||||||
private final RESTBuilder restBuilder;
|
private final RESTBuilder restBuilder;
|
||||||
private final SystemRESTConsumer systemRESTConsumer;
|
private final SystemRESTConsumer systemRESTConsumer;
|
||||||
|
|
||||||
|
@Inject
|
||||||
public ProdFabbisognoLineeProdRESTConsumer(RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer) {
|
public ProdFabbisognoLineeProdRESTConsumer(RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer) {
|
||||||
this.restBuilder = restBuilder;
|
this.restBuilder = restBuilder;
|
||||||
this.systemRESTConsumer = systemRESTConsumer;
|
this.systemRESTConsumer = systemRESTConsumer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void loadFabbisogno(String numOrd, String codMdep, RunnableArgs<List<ProdFabbisognoLineeProdDTO>> onComplete, RunnableArgs<Exception> onFailed) {
|
public List<ProdFabbisognoLineeProdDTO> loadFabbisognoSynchronized(String numOrd, String codMdep) throws Exception {
|
||||||
ProdFabbisognoLineeProdRESTConsumerService prodFabbisognoLineeProdRESTConsumerService = restBuilder.getService(ProdFabbisognoLineeProdRESTConsumerService.class);
|
ProdFabbisognoLineeProdRESTConsumerService prodFabbisognoLineeProdRESTConsumerService = restBuilder.getService(ProdFabbisognoLineeProdRESTConsumerService.class);
|
||||||
prodFabbisognoLineeProdRESTConsumerService.loadFabbisogno(numOrd, codMdep)
|
var response = prodFabbisognoLineeProdRESTConsumerService.loadFabbisogno(numOrd, codMdep)
|
||||||
.enqueue(new ManagedErrorCallback<>() {
|
.execute();
|
||||||
@Override
|
|
||||||
public void onResponse(Call<ServiceRESTResponse<List<ProdFabbisognoLineeProdDTO>>> call,
|
|
||||||
Response<ServiceRESTResponse<List<ProdFabbisognoLineeProdDTO>>> response) {
|
|
||||||
analyzeAnswer(response, "retrieveFabbisogno", onComplete, onFailed);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
var data = analyzeAnswer(response, "approvvigionamento/retrieveFabbisogno");
|
||||||
public void onFailure(Call<ServiceRESTResponse<List<ProdFabbisognoLineeProdDTO>>> call, @NonNull final Exception e) {
|
return data;
|
||||||
onFailed.run(e);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void loadFabbisogno(String codMart, String ordini, Date startDate, Date endDate, String codMdep, RunnableArgs<List<ProdFabbisognoLineeProdDTO>> onComplete, RunnableArgs<Exception> onFailed) {
|
public ArrayList<JtbFasi> loadCodJfasOfFabbisognoSynchronized(String codMart, String ordini, LocalDate startDate, LocalDate endDate, String codMdep) throws Exception {
|
||||||
String sql = "SELECT DISTINCT cod_jfas\n" +
|
String sql = "SELECT DISTINCT jtb_fasi.cod_jfas, jtb_fasi.descrizione\n" +
|
||||||
"FROM (SELECT DENSE_RANK() OVER (PARTITION BY dtb_ordt.gestione, dtb_ordt.data_ord, dtb_ordt.num_ord ORDER BY dtb_ord_steps.data_iniz DESC) AS row_n,\n" +
|
"FROM (SELECT DENSE_RANK() OVER (PARTITION BY dtb_ordt.gestione, dtb_ordt.data_ord, dtb_ordt.num_ord ORDER BY dtb_ord_steps.data_iniz DESC) AS row_n,\n" +
|
||||||
" dtb_ord_steps.*\n" +
|
" dtb_ord_steps.*\n" +
|
||||||
" FROM dtb_ord_steps\n" +
|
" FROM dtb_ord_steps\n" +
|
||||||
@@ -71,11 +59,12 @@ public class ProdFabbisognoLineeProdRESTConsumer extends _BaseRESTConsumer {
|
|||||||
" AND dtb_ordt.num_ord IN ( " + ordini + " )\n" +
|
" AND dtb_ordt.num_ord IN ( " + ordini + " )\n" +
|
||||||
" AND dtb_ordt.data_ord BETWEEN " + UtilityDB.valueToString(startDate) + " AND " + UtilityDB.valueToString(endDate) + "\n" +
|
" AND dtb_ordt.data_ord BETWEEN " + UtilityDB.valueToString(startDate) + " AND " + UtilityDB.valueToString(endDate) + "\n" +
|
||||||
" AND dtb_ordr.cod_mart = " + UtilityDB.valueToString(codMart) + ") t\n" +
|
" AND dtb_ordr.cod_mart = " + UtilityDB.valueToString(codMart) + ") t\n" +
|
||||||
|
"INNER JOIN jtb_fasi ON t.cod_jfas = jtb_fasi.cod_jfas\n" +
|
||||||
"WHERE t.row_n = 1";
|
"WHERE t.row_n = 1";
|
||||||
|
|
||||||
|
|
||||||
Type typeOfObjectsList = new TypeToken<ArrayList<ProdFabbisognoLineeProdDTO>>() {}.getType();
|
Type typeOfObjectsList = new TypeToken<ArrayList<JtbFasi>>() {}.getType();
|
||||||
this.systemRESTConsumer.processSql(sql, typeOfObjectsList, onComplete, onFailed);
|
return this.systemRESTConsumer.processSqlSynchronized(sql, typeOfObjectsList);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -122,7 +122,13 @@ public class ProdRecuperoMaterialeFragment extends BaseFragment implements ITitl
|
|||||||
BarcodeManager.removeCallback(mBarcodeScannerInstanceID);
|
BarcodeManager.removeCallback(mBarcodeScannerInstanceID);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
mViewModel.init(codJfas);
|
mViewModel.init(codJfas);
|
||||||
|
mViewModel.refreshData(); // This will eventually trigger the LiveData observer for getOrderList
|
||||||
|
|
||||||
|
mBinding.swiperefresh.setOnRefreshListener(() -> {
|
||||||
|
mViewModel.refreshData();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -299,8 +305,30 @@ public class ProdRecuperoMaterialeFragment extends BaseFragment implements ITitl
|
|||||||
@Override
|
@Override
|
||||||
public void onDataSaved() {
|
public void onDataSaved() {
|
||||||
this.onLoadingEnded();
|
this.onLoadingEnded();
|
||||||
this.requireActivity().runOnUiThread(() -> {
|
handler.post(() -> {
|
||||||
DialogCommon.showDataSaved(requireActivity(), this::popMe);
|
DialogCommon.showDataSaved(requireActivity(), this::popMe);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDataRefreshStarted() {
|
||||||
|
handler.post(() -> {
|
||||||
|
mBinding.swiperefresh.setRefreshing(true);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDataRefreshEnded() {
|
||||||
|
handler.post(() -> {
|
||||||
|
mBinding.swiperefresh.setRefreshing(false);
|
||||||
|
// applyFilters(); // Non strettamente necessario qui se l'observer di getOrderList() fa il suo dovere
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(Exception ex) {
|
||||||
|
super.onError(ex);
|
||||||
|
onDataRefreshEnded();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,28 +1,10 @@
|
|||||||
package it.integry.integrywmsnative.gest.prod_recupero_materiale;
|
package it.integry.integrywmsnative.gest.prod_recupero_materiale;
|
||||||
|
|
||||||
import dagger.Module;
|
import dagger.Module;
|
||||||
import dagger.Provides;
|
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.MaterialiRESTConsumer;
|
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.PrinterRESTConsumer;
|
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
|
||||||
import it.integry.integrywmsnative.gest.prod_recupero_materiale.rest.ProdRecuperoMaterialeRESTConsumer;
|
|
||||||
|
|
||||||
@Module(subcomponents = ProdRecuperoMaterialeComponent.class)
|
@Module(subcomponents = ProdRecuperoMaterialeComponent.class)
|
||||||
public class ProdRecuperoMaterialeModule {
|
public class ProdRecuperoMaterialeModule {
|
||||||
|
|
||||||
@Provides
|
|
||||||
ProdRecuperoMaterialeRESTConsumer providesProdRecuperMaterialeRESTConsumer(SystemRESTConsumer systemRESTConsumer, ArticoloRESTConsumer articoloRESTConsumer) {
|
|
||||||
return new ProdRecuperoMaterialeRESTConsumer(systemRESTConsumer, articoloRESTConsumer);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Provides
|
|
||||||
ProdRecuperoMaterialeViewModel providesProdRecuperoMaterialeViewModel(ProdRecuperoMaterialeRESTConsumer prodRecuperoMaterialeRESTConsumer,
|
|
||||||
ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer,
|
|
||||||
PrinterRESTConsumer printerRESTConsumer,
|
|
||||||
MaterialiRESTConsumer materialiRESTConsumer) {
|
|
||||||
return new ProdRecuperoMaterialeViewModel(prodRecuperoMaterialeRESTConsumer, colliMagazzinoRESTConsumer, printerRESTConsumer, materialiRESTConsumer);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,8 +3,10 @@ package it.integry.integrywmsnative.gest.prod_recupero_materiale;
|
|||||||
import androidx.lifecycle.MutableLiveData;
|
import androidx.lifecycle.MutableLiveData;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
@@ -16,6 +18,7 @@ import it.integry.integrywmsnative.core.expansion.RunnableArgss;
|
|||||||
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
|
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
|
||||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||||
|
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.MaterialiRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.MaterialiRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.PrinterRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.PrinterRESTConsumer;
|
||||||
@@ -28,62 +31,88 @@ import it.integry.integrywmsnative.gest.spedizione.model.PickedQuantityDTO;
|
|||||||
|
|
||||||
public class ProdRecuperoMaterialeViewModel {
|
public class ProdRecuperoMaterialeViewModel {
|
||||||
|
|
||||||
|
private final BarcodeRESTConsumer mBarcodeRESTConsumer;
|
||||||
private final ProdRecuperoMaterialeRESTConsumer mProdRecuperoMaterialeRESTConsumer;
|
private final ProdRecuperoMaterialeRESTConsumer mProdRecuperoMaterialeRESTConsumer;
|
||||||
private final ColliMagazzinoRESTConsumer mColliMagazzinoRESTConsumer;
|
private final ColliMagazzinoRESTConsumer mColliMagazzinoRESTConsumer;
|
||||||
private final PrinterRESTConsumer mPrinterRESTConsumer;
|
private final PrinterRESTConsumer mPrinterRESTConsumer;
|
||||||
private final MaterialiRESTConsumer mMaterialiRESTConsumer;
|
private final MaterialiRESTConsumer mMaterialiRESTConsumer;
|
||||||
|
private final ExecutorService mExecutorService;
|
||||||
|
|
||||||
private final MutableLiveData<List<HistoryVersamentoProdULDTO>> mUlList = new MutableLiveData<>();
|
private final MutableLiveData<List<HistoryVersamentoProdULDTO>> mUlList = new MutableLiveData<>();
|
||||||
|
|
||||||
private Listener mListener;
|
private Listener mListener;
|
||||||
|
|
||||||
|
private String mCodJfas;
|
||||||
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public ProdRecuperoMaterialeViewModel(ProdRecuperoMaterialeRESTConsumer prodRecuperoMaterialeRESTConsumer,
|
public ProdRecuperoMaterialeViewModel(BarcodeRESTConsumer barcodeRESTConsumer,
|
||||||
|
ProdRecuperoMaterialeRESTConsumer prodRecuperoMaterialeRESTConsumer,
|
||||||
ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer,
|
ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer,
|
||||||
PrinterRESTConsumer printerRESTConsumer,
|
PrinterRESTConsumer printerRESTConsumer,
|
||||||
MaterialiRESTConsumer materialiRESTConsumer) {
|
MaterialiRESTConsumer materialiRESTConsumer,
|
||||||
|
ExecutorService executorService) {
|
||||||
|
this.mBarcodeRESTConsumer = barcodeRESTConsumer;
|
||||||
this.mProdRecuperoMaterialeRESTConsumer = prodRecuperoMaterialeRESTConsumer;
|
this.mProdRecuperoMaterialeRESTConsumer = prodRecuperoMaterialeRESTConsumer;
|
||||||
this.mColliMagazzinoRESTConsumer = colliMagazzinoRESTConsumer;
|
this.mColliMagazzinoRESTConsumer = colliMagazzinoRESTConsumer;
|
||||||
this.mPrinterRESTConsumer = printerRESTConsumer;
|
this.mPrinterRESTConsumer = printerRESTConsumer;
|
||||||
this.mMaterialiRESTConsumer = materialiRESTConsumer;
|
this.mMaterialiRESTConsumer = materialiRESTConsumer;
|
||||||
|
this.mExecutorService = executorService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init(String codJfas) {
|
public void init(String codJfas) {
|
||||||
this.sendOnLoadingStarted();
|
this.mCodJfas = codJfas;
|
||||||
|
}
|
||||||
|
|
||||||
mProdRecuperoMaterialeRESTConsumer.loadLastULVersate(codJfas, ulList -> {
|
public void refreshData() {
|
||||||
this.mUlList.setValue(ulList);
|
this.sendOnDataRefreshStarted();
|
||||||
|
|
||||||
this.sendOnLoadingEnded();
|
this.mExecutorService.execute(() -> {
|
||||||
}, this::sendError);
|
try {
|
||||||
|
List<HistoryVersamentoProdULDTO> lastUlVersate = mProdRecuperoMaterialeRESTConsumer.loadLastULVersateSynchronized(mCodJfas);
|
||||||
|
lastUlVersate.sort(Comparator.comparing(HistoryVersamentoProdULDTO::getCodJfas));
|
||||||
|
|
||||||
|
this.mUlList.postValue(lastUlVersate);
|
||||||
|
this.sendOnDataRefreshEnded();
|
||||||
|
} catch (Exception e) {
|
||||||
|
this.sendError(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void processBarcodeDTO(BarcodeScanDTO data) {
|
public void processBarcodeDTO(BarcodeScanDTO data) {
|
||||||
if (UtilityBarcode.isEtichettaAnonima(data) || UtilityBarcode.isEtichetta128(data)) {
|
if (UtilityBarcode.isEtichettaAnonima(data) || UtilityBarcode.isEtichetta128(data)) {
|
||||||
this.executeEtichettaLU(data.getStringValue());
|
this.executeEtichettaLU(data);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void executeEtichettaLU(String sscc) {
|
private void executeEtichettaLU(BarcodeScanDTO barcodeScanDTO) {
|
||||||
this.sendOnLoadingStarted();
|
this.sendOnLoadingStarted();
|
||||||
|
this.mBarcodeRESTConsumer.decodeEan128(barcodeScanDTO, ean128Model -> {
|
||||||
|
|
||||||
this.mColliMagazzinoRESTConsumer.getBySSCC(sscc, true, false, mtbColt -> {
|
if(ean128Model == null || ean128Model.Sscc == null) {
|
||||||
this.sendOnLoadingEnded();
|
this.sendError(new NoLUFoundException());
|
||||||
|
this.sendOnLoadingEnded();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.mColliMagazzinoRESTConsumer.getBySSCC(ean128Model.Sscc, true, false, mtbColt -> {
|
||||||
|
this.sendOnLoadingEnded();
|
||||||
|
|
||||||
|
if (mtbColt != null) {
|
||||||
|
HistoryVersamentoProdULDTO historyVersamentoProdULRestDTO = this.getHistoryElementFromMtbColt(mtbColt);
|
||||||
|
if (historyVersamentoProdULRestDTO != null) {
|
||||||
|
this.dispatchItem(historyVersamentoProdULRestDTO, mtbColt);
|
||||||
|
} else {
|
||||||
|
this.sendError(new NoLUFoundException());
|
||||||
|
}
|
||||||
|
|
||||||
if (mtbColt != null) {
|
|
||||||
HistoryVersamentoProdULDTO historyVersamentoProdULRestDTO = this.getHistoryElementFromMtbColt(mtbColt);
|
|
||||||
if (historyVersamentoProdULRestDTO != null) {
|
|
||||||
this.dispatchItem(historyVersamentoProdULRestDTO, mtbColt);
|
|
||||||
} else {
|
} else {
|
||||||
this.sendError(new NoLUFoundException());
|
this.sendError(new NoLUFoundException());
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
}, this::sendError);
|
||||||
this.sendError(new NoLUFoundException());
|
|
||||||
}
|
|
||||||
|
|
||||||
}, this::sendError);
|
}, this::sendError);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -164,7 +193,7 @@ public class ProdRecuperoMaterialeViewModel {
|
|||||||
.setNumColloRif(item.getNumColloRif())
|
.setNumColloRif(item.getNumColloRif())
|
||||||
.setOrdini(ordiniRequest);
|
.setOrdini(ordiniRequest);
|
||||||
|
|
||||||
if(mtbColt != null) {
|
if (mtbColt != null) {
|
||||||
request.setMtbColtCarico(mtbColt);
|
request.setMtbColtCarico(mtbColt);
|
||||||
} else {
|
} else {
|
||||||
request.setMtbColtCarico(sourceMtbColt);
|
request.setMtbColtCarico(sourceMtbColt);
|
||||||
@@ -204,6 +233,14 @@ public class ProdRecuperoMaterialeViewModel {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void sendOnDataRefreshStarted() {
|
||||||
|
if (this.mListener != null) mListener.onDataRefreshStarted();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sendOnDataRefreshEnded() {
|
||||||
|
if (this.mListener != null) mListener.onDataRefreshEnded();
|
||||||
|
}
|
||||||
|
|
||||||
private void sendOnLoadingStarted() {
|
private void sendOnLoadingStarted() {
|
||||||
if (this.mListener != null) mListener.onLoadingStarted();
|
if (this.mListener != null) mListener.onLoadingStarted();
|
||||||
}
|
}
|
||||||
@@ -274,6 +311,10 @@ public class ProdRecuperoMaterialeViewModel {
|
|||||||
void onNoLUFound(Runnable onComplete);
|
void onNoLUFound(Runnable onComplete);
|
||||||
|
|
||||||
void onDataSaved();
|
void onDataSaved();
|
||||||
|
|
||||||
|
void onDataRefreshStarted();
|
||||||
|
|
||||||
|
void onDataRefreshEnded();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,310 +1,432 @@
|
|||||||
package it.integry.integrywmsnative.gest.prod_recupero_materiale.rest;
|
package it.integry.integrywmsnative.gest.prod_recupero_materiale.rest;
|
||||||
|
|
||||||
import com.annimon.stream.Stream;
|
import androidx.annotation.NonNull;
|
||||||
import com.google.gson.reflect.TypeToken;
|
|
||||||
|
|
||||||
import java.lang.reflect.Type;
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
|
||||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.MaterialiRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers._BaseRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers._BaseRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityDB;
|
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
|
||||||
import it.integry.integrywmsnative.gest.prod_recupero_materiale.dto.HistoryVersamentoProdULDTO;
|
import it.integry.integrywmsnative.gest.prod_recupero_materiale.dto.HistoryVersamentoProdULDTO;
|
||||||
import it.integry.integrywmsnative.gest.prod_recupero_materiale.dto.HistoryVersamentoProdULRestDTO;
|
import it.integry.integrywmsnative.gest.prod_recupero_materiale.dto.HistoryVersamentoProdULRestDTO;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class ProdRecuperoMaterialeRESTConsumer extends _BaseRESTConsumer {
|
public class ProdRecuperoMaterialeRESTConsumer extends _BaseRESTConsumer {
|
||||||
|
|
||||||
private final SystemRESTConsumer mSystemRESTConsumer;
|
|
||||||
private final ArticoloRESTConsumer mArticoloRESTConsumer;
|
private final ArticoloRESTConsumer mArticoloRESTConsumer;
|
||||||
|
private final MaterialiRESTConsumer mMaterialiRESTConsumer;
|
||||||
|
|
||||||
public ProdRecuperoMaterialeRESTConsumer(SystemRESTConsumer systemRESTConsumer, ArticoloRESTConsumer articoloRESTConsumer) {
|
@Inject
|
||||||
this.mSystemRESTConsumer = systemRESTConsumer;
|
public ProdRecuperoMaterialeRESTConsumer(ArticoloRESTConsumer articoloRESTConsumer, MaterialiRESTConsumer materialiRESTConsumer) {
|
||||||
|
this.mMaterialiRESTConsumer = materialiRESTConsumer;
|
||||||
this.mArticoloRESTConsumer = articoloRESTConsumer;
|
this.mArticoloRESTConsumer = articoloRESTConsumer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void loadLastULVersate(RunnableArgs<List<HistoryVersamentoProdULDTO>> onComplete, RunnableArgs<Exception> onFailed) {
|
public List<HistoryVersamentoProdULDTO> loadLastULVersateSynchronized() throws Exception {
|
||||||
loadLastULVersate(null, onComplete, onFailed);
|
return loadLastULVersateSynchronized(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadLastULVersate(String codJfas, RunnableArgs<List<HistoryVersamentoProdULDTO>> onComplete, RunnableArgs<Exception> onFailed) {
|
public @NonNull List<HistoryVersamentoProdULDTO> loadLastULVersateSynchronized(String codJfas) throws Exception {
|
||||||
|
var ulList = mMaterialiRESTConsumer.makeSynchronousRetrieveLastVersamentiRequest(codJfas);
|
||||||
|
|
||||||
String sql = "WITH ul_list AS ( " +
|
if (ulList == null) {
|
||||||
" SELECT jtb_fasi.cod_jfas, " +
|
return new ArrayList<>();
|
||||||
" jtb_fasi.descrizione AS descrizione_fase, " +
|
}
|
||||||
" mtb_colr.gestione, " +
|
|
||||||
" mtb_colr.data_collo, " +
|
|
||||||
" mtb_colr.num_collo, " +
|
|
||||||
" mtb_colr.ser_collo, " +
|
|
||||||
" mtb_colr.cod_mart, " +
|
|
||||||
" mtb_colr.cod_col, " +
|
|
||||||
" mtb_colr.cod_tagl, " +
|
|
||||||
" SUM(mtb_colr.qta_col) AS qta_col, " +
|
|
||||||
" mtb_colr.qta_cnf AS qta_cnf, " +
|
|
||||||
" SUM(mtb_colr.num_cnf) AS num_cnf, " +
|
|
||||||
" mtb_colr.partita_mag, " +
|
|
||||||
" mtb_colr.cod_jcom, " +
|
|
||||||
" mtb_colr.num_collo_rif, " +
|
|
||||||
" mtb_colr.data_collo_rif, " +
|
|
||||||
" mtb_colr.ser_collo_rif, " +
|
|
||||||
" mtb_colr.gestione_rif, " +
|
|
||||||
" mtb_colt.segno, " +
|
|
||||||
" ISNULL(mtb_aart.descrizione_estesa, mtb_aart.descrizione) AS descrizione_art, " +
|
|
||||||
" mtb_aart.unt_mis, " +
|
|
||||||
" MAX(datetime_row) AS datetime_row, " +
|
|
||||||
" mtb_colr.num_ord, " +
|
|
||||||
" mtb_colr.data_ord, " +
|
|
||||||
" mtb_colr.gestione as gestione_ord, " +
|
|
||||||
" mtb_colr.riga_ord, " +
|
|
||||||
" dtb_ord_steps.hr_num as hr, " +
|
|
||||||
" CONVERT(INTEGER, ROUND((CAST(dtb_ord_steps.hr_num AS DECIMAL(20, 5)) / " +
|
|
||||||
" SUM(dtb_ord_steps.hr_num) OVER (PARTITION BY mtb_colr.num_collo)) * 100, " +
|
|
||||||
" SUM(CASE WHEN dtb_ord_steps.hr_num > 0 then dtb_ord_steps.hr_num else 1 end) OVER (PARTITION BY mtb_colr.num_collo)) * 100, " +
|
|
||||||
" 0) as percentage_hr " +
|
|
||||||
" FROM mtb_colr " +
|
|
||||||
" INNER JOIN mtb_colt ON mtb_colr.num_collo = mtb_colt.num_collo " +
|
|
||||||
" AND mtb_colr.data_collo = mtb_colt.data_collo " +
|
|
||||||
" AND mtb_colr.ser_collo = mtb_colt.ser_collo " +
|
|
||||||
" AND mtb_colr.gestione = mtb_colt.gestione " +
|
|
||||||
" " + (SettingsManager.iDB().isFlagVersamentoDirettoProduzione() ? "INNER" : "LEFT OUTER") + " join dtb_ord_steps ON dtb_ord_steps.data_ord = mtb_colr.data_ord " +
|
|
||||||
" AND dtb_ord_steps.gestione = mtb_colr.gestione " +
|
|
||||||
" AND dtb_ord_steps.num_ord = mtb_colr.num_ord " +
|
|
||||||
" AND dtb_ord_steps.data_iniz is not null " +
|
|
||||||
" AND dtb_ord_steps.data_fine is null " +
|
|
||||||
" INNER JOIN mtb_aart ON mtb_colr.cod_mart = mtb_aart.cod_mart " +
|
|
||||||
" LEFT OUTER JOIN jtb_fasi ON mtb_colt.cod_jfas = jtb_fasi.cod_jfas " +
|
|
||||||
" WHERE jtb_fasi.cod_jfas IS NOT NULL " +
|
|
||||||
(UtilityString.isNullOrEmpty(codJfas) ? "" : " AND jtb_fasi.cod_jfas = " + UtilityDB.valueToString(codJfas)) +
|
|
||||||
" AND segno = -1 " +
|
|
||||||
" AND mtb_colr.data_collo > DATEADD(DAY, -5, GETDATE()) " +
|
|
||||||
" GROUP BY jtb_fasi.cod_jfas, " +
|
|
||||||
" jtb_fasi.descrizione, " +
|
|
||||||
" mtb_colr.gestione, " +
|
|
||||||
" mtb_colr.data_collo, " +
|
|
||||||
" mtb_colr.num_collo, " +
|
|
||||||
" mtb_colr.ser_collo, " +
|
|
||||||
" mtb_colr.qta_cnf, " +
|
|
||||||
" mtb_colr.cod_mart, " +
|
|
||||||
" mtb_colr.cod_col, " +
|
|
||||||
" mtb_colr.cod_tagl, " +
|
|
||||||
" mtb_colr.ser_collo, " +
|
|
||||||
" mtb_colr.partita_mag, " +
|
|
||||||
" mtb_colr.cod_jcom, " +
|
|
||||||
" mtb_aart.descrizione_estesa, " +
|
|
||||||
" mtb_aart.descrizione, " +
|
|
||||||
" mtb_aart.unt_mis, " +
|
|
||||||
" mtb_colr.num_collo_rif, " +
|
|
||||||
" mtb_colr.data_collo_rif, " +
|
|
||||||
" mtb_colr.ser_collo_rif, " +
|
|
||||||
" mtb_colr.gestione_rif, " +
|
|
||||||
" mtb_colt.segno, " +
|
|
||||||
" mtb_colr.num_ord, " +
|
|
||||||
" mtb_colr.data_ord, " +
|
|
||||||
" mtb_colr.gestione, " +
|
|
||||||
" mtb_colr.riga_ord, " +
|
|
||||||
" dtb_ord_steps.hr_num " +
|
|
||||||
" HAVING SUM(mtb_colr.qta_col) > 0 " +
|
|
||||||
"), max_ul AS ( " +
|
|
||||||
" SELECT " +
|
|
||||||
" cod_jfas, " +
|
|
||||||
" descrizione_fase, " +
|
|
||||||
" gestione, " +
|
|
||||||
" cod_mart, " +
|
|
||||||
" cod_col, " +
|
|
||||||
" cod_tagl, " +
|
|
||||||
" ser_collo, " +
|
|
||||||
" partita_mag, " +
|
|
||||||
" cod_jcom, " +
|
|
||||||
" descrizione_art, " +
|
|
||||||
" unt_mis, " +
|
|
||||||
" num_collo_rif, " +
|
|
||||||
" data_collo_rif, " +
|
|
||||||
" ser_collo_rif, " +
|
|
||||||
" gestione_rif, " +
|
|
||||||
" segno, " +
|
|
||||||
" num_ord, " +
|
|
||||||
" data_ord, " +
|
|
||||||
" gestione_ord, " +
|
|
||||||
" riga_ord, " +
|
|
||||||
" hr, " +
|
|
||||||
" MAX (datetime_row) as max_datetime_row " +
|
|
||||||
" FROM ul_list " +
|
|
||||||
" GROUP BY cod_jfas, " +
|
|
||||||
" descrizione_fase, " +
|
|
||||||
" gestione, " +
|
|
||||||
" cod_mart, " +
|
|
||||||
" cod_col, " +
|
|
||||||
" cod_tagl, " +
|
|
||||||
" ser_collo, " +
|
|
||||||
" partita_mag, " +
|
|
||||||
" cod_jcom, " +
|
|
||||||
" descrizione_art, " +
|
|
||||||
" unt_mis, " +
|
|
||||||
" num_collo_rif, " +
|
|
||||||
" data_collo_rif, " +
|
|
||||||
" ser_collo_rif, " +
|
|
||||||
" gestione_rif, " +
|
|
||||||
" segno, " +
|
|
||||||
" num_ord, " +
|
|
||||||
" data_ord, " +
|
|
||||||
" gestione_ord, " +
|
|
||||||
" riga_ord, " +
|
|
||||||
" hr " +
|
|
||||||
") " +
|
|
||||||
" " +
|
|
||||||
"SELECT ul_list.* FROM max_ul " +
|
|
||||||
"LEFT OUTER JOIN ul_list ON " +
|
|
||||||
" ISNULL(max_ul.cod_jfas, '') = ISNULL(ul_list.cod_jfas, '') AND " +
|
|
||||||
" ISNULL(max_ul.descrizione_fase, '') = ISNULL(ul_list.descrizione_fase, '') AND " +
|
|
||||||
" ISNULL(max_ul.gestione, '') = ISNULL(ul_list.gestione, '') AND " +
|
|
||||||
" ISNULL(max_ul.cod_mart, '') = ISNULL(ul_list.cod_mart, '') AND " +
|
|
||||||
" ISNULL(max_ul.cod_col, '') = ISNULL(ul_list.cod_col, '') AND " +
|
|
||||||
" ISNULL(max_ul.cod_tagl, '') = ISNULL(ul_list.cod_tagl, '') AND " +
|
|
||||||
" ISNULL(max_ul.ser_collo, '') = ISNULL(ul_list.ser_collo, '') AND " +
|
|
||||||
" ISNULL(max_ul.partita_mag, '') = ISNULL(ul_list.partita_mag, '') AND " +
|
|
||||||
" ISNULL(max_ul.cod_jcom, '') = ISNULL(ul_list.cod_jcom, '') AND " +
|
|
||||||
" ISNULL(max_ul.descrizione_art, '') = ISNULL(ul_list.descrizione_art, '') AND " +
|
|
||||||
" ISNULL(max_ul.unt_mis, '') = ISNULL(ul_list.unt_mis, '') AND " +
|
|
||||||
" ISNULL(max_ul.num_collo_rif, '') = ISNULL(ul_list.num_collo_rif, '') AND " +
|
|
||||||
" ISNULL(max_ul.data_collo_rif, '') = ISNULL(ul_list.data_collo_rif, '') AND " +
|
|
||||||
" ISNULL(max_ul.ser_collo_rif, '') = ISNULL(ul_list.ser_collo_rif, '') AND " +
|
|
||||||
" ISNULL(max_ul.gestione_rif, '') = ISNULL(ul_list.gestione_rif, '') AND " +
|
|
||||||
" ISNULL(max_ul.segno, '') = ISNULL(ul_list.segno, '') AND " +
|
|
||||||
" ISNULL(max_ul.num_ord, '') = ISNULL(ul_list.num_ord, '') AND " +
|
|
||||||
" ISNULL(max_ul.data_ord, '') = ISNULL(ul_list.data_ord, '') AND " +
|
|
||||||
" ISNULL(max_ul.gestione_ord, '') = ISNULL(ul_list.gestione_ord, '') AND " +
|
|
||||||
" ISNULL(max_ul.riga_ord, '') = ISNULL(ul_list.riga_ord, '') AND " +
|
|
||||||
" ISNULL(max_ul.hr, '') = ISNULL(ul_list.hr, '') AND " +
|
|
||||||
" max_ul.max_datetime_row = ul_list.datetime_row";
|
|
||||||
|
|
||||||
Type typeOfObjectsList = new TypeToken<ArrayList<HistoryVersamentoProdULRestDTO>>() {
|
List<HistoryVersamentoProdULDTO> newUlList = new ArrayList<>();
|
||||||
}.getType();
|
|
||||||
this.mSystemRESTConsumer.<ArrayList<HistoryVersamentoProdULRestDTO>>processSql(sql, typeOfObjectsList, ulList -> {
|
|
||||||
|
|
||||||
if (ulList == null) {
|
Map<HashMap<String, Object>, List<HistoryVersamentoProdULRestDTO>> ulListGrouped = ulList.stream()
|
||||||
onComplete.run(null);
|
.collect(Collectors.groupingBy(x -> {
|
||||||
return;
|
var keyMap = new HashMap<String, Object>();
|
||||||
|
keyMap.put("gestione", x.getGestione());
|
||||||
|
keyMap.put("data_collo", x.getDataCollo());
|
||||||
|
keyMap.put("ser_collo", x.getSerCollo());
|
||||||
|
keyMap.put("num_collo", x.getNumCollo());
|
||||||
|
keyMap.put("cod_mart", x.getCodMart());
|
||||||
|
keyMap.put("partita_mag", x.getPartitaMag());
|
||||||
|
keyMap.put("gestione_rif", x.getGestioneRif());
|
||||||
|
keyMap.put("data_collo_rif", x.getDataColloRif());
|
||||||
|
keyMap.put("ser_collo_rif", x.getSerColloRif());
|
||||||
|
keyMap.put("num_collo_rif", x.getNumColloRif());
|
||||||
|
return keyMap;
|
||||||
|
}, Collectors.toList()));
|
||||||
|
|
||||||
|
for (HashMap<String, Object> ulKey : ulListGrouped.keySet()) {
|
||||||
|
var matchingUls = ulList.stream().filter(x ->
|
||||||
|
Objects.equals(x.getGestione(), ulKey.get("gestione")) &&
|
||||||
|
Objects.equals(x.getDataCollo(), ulKey.get("data_collo")) &&
|
||||||
|
Objects.equals(x.getSerCollo(), ulKey.get("ser_collo")) &&
|
||||||
|
Objects.equals(x.getNumCollo(), ulKey.get("num_collo")) &&
|
||||||
|
Objects.equals(x.getCodMart(), ulKey.get("cod_mart")) &&
|
||||||
|
Objects.equals(x.getPartitaMag(), ulKey.get("partita_mag")) &&
|
||||||
|
Objects.equals(x.getGestioneRif(), ulKey.get("gestione_rif")) &&
|
||||||
|
Objects.equals(x.getDataColloRif(), ulKey.get("data_collo_rif")) &&
|
||||||
|
Objects.equals(x.getSerColloRif(), ulKey.get("ser_collo_rif")) &&
|
||||||
|
Objects.equals(x.getNumColloRif(), ulKey.get("num_collo_rif"))
|
||||||
|
).collect(Collectors.toUnmodifiableList());
|
||||||
|
|
||||||
|
ulKey.put("qta_col", matchingUls.stream().map(HistoryVersamentoProdULRestDTO::getQtaCol)
|
||||||
|
.reduce(BigDecimal.ZERO, BigDecimal::add));
|
||||||
|
ulKey.put("num_cnf", matchingUls.stream().map(HistoryVersamentoProdULRestDTO::getNumCnf)
|
||||||
|
.reduce(BigDecimal.ZERO, BigDecimal::add));
|
||||||
|
}
|
||||||
|
|
||||||
|
ulListGrouped.forEach((key, value) -> {
|
||||||
|
|
||||||
|
var listaOrdini = value.stream()
|
||||||
|
.filter(x -> x.getDataOrd() != null &&
|
||||||
|
x.getGestioneOrd() != null &&
|
||||||
|
x.getNumOrd() != null)
|
||||||
|
.map(x -> new HistoryVersamentoProdULDTO.OrdineDto()
|
||||||
|
.setData(x.getDataOrd())
|
||||||
|
.setNumero(x.getNumOrd())
|
||||||
|
.setGestione(x.getGestione())
|
||||||
|
.setRigaOrd(x.getRigaOrd())
|
||||||
|
.setQtaCol(x.getQtaCol())
|
||||||
|
.setNumCnf(x.getNumCnf())
|
||||||
|
.setPercentageHr(x.getPercentageHr()))
|
||||||
|
.distinct()
|
||||||
|
.collect(Collectors.toUnmodifiableList());
|
||||||
|
|
||||||
|
var restData = value.get(0);
|
||||||
|
var qtaCol = (BigDecimal) key.get("qta_col");
|
||||||
|
var numCnf = (BigDecimal) key.get("num_cnf");
|
||||||
|
|
||||||
|
newUlList.add(new HistoryVersamentoProdULDTO()
|
||||||
|
.setGestione(restData.getGestione())
|
||||||
|
.setDataCollo(restData.getDataCollo())
|
||||||
|
.setSerCollo(restData.getSerCollo())
|
||||||
|
.setNumCollo(restData.getNumCollo())
|
||||||
|
.setSegno(restData.getSegno())
|
||||||
|
.setCodMart(restData.getCodMart())
|
||||||
|
.setCodCol(restData.getCodCol())
|
||||||
|
.setCodTagl(restData.getCodTagl())
|
||||||
|
.setCodJfas(restData.getCodJfas())
|
||||||
|
.setDescrizioneArt(restData.getDescrizioneArt())
|
||||||
|
.setDescrizioneFase(restData.getDescrizioneFase())
|
||||||
|
.setQtaCol(qtaCol)
|
||||||
|
.setQtaCnf(restData.getQtaCnf())
|
||||||
|
.setNumCnf(numCnf)
|
||||||
|
.setPartitaMag(restData.getPartitaMag())
|
||||||
|
.setCodJcom(restData.getCodJcom())
|
||||||
|
.setDatetimeRow(restData.getDatetimeRow())
|
||||||
|
.setUntMis(restData.getUntMis())
|
||||||
|
.setGestioneRif(restData.getGestioneRif())
|
||||||
|
.setDataColloRif(restData.getDataColloRif())
|
||||||
|
.setSerColloRif(restData.getSerColloRif())
|
||||||
|
.setNumColloRif(restData.getNumColloRif())
|
||||||
|
.setOrdini(listaOrdini));
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
if (!newUlList.isEmpty()) {
|
||||||
|
List<String> codMarts = newUlList.stream()
|
||||||
|
.map(HistoryVersamentoProdULDTO::getCodMart)
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.distinct()
|
||||||
|
.collect(Collectors.toUnmodifiableList());
|
||||||
|
|
||||||
|
var arts = this.mArticoloRESTConsumer.getByCodMartsSynchronized(codMarts);
|
||||||
|
|
||||||
|
if (arts != null && !arts.isEmpty()) {
|
||||||
|
for (HistoryVersamentoProdULDTO value : newUlList) {
|
||||||
|
|
||||||
|
MtbAart foundMtbAart = arts.stream()
|
||||||
|
.filter(x -> x.getCodMart().equalsIgnoreCase(value.getCodMart()))
|
||||||
|
.findFirst()
|
||||||
|
.orElse(null);
|
||||||
|
|
||||||
|
value.setMtbAart(foundMtbAart);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<HistoryVersamentoProdULDTO> newUlList = new ArrayList<>();
|
return newUlList;
|
||||||
|
|
||||||
Stream.of(ulList)
|
|
||||||
.distinctBy(x -> {
|
|
||||||
HashMap<String, Object> hashMap = new HashMap<>();
|
|
||||||
hashMap.put("gestione", x.getGestione());
|
|
||||||
hashMap.put("data_collo", x.getDataCollo());
|
|
||||||
hashMap.put("ser_collo", x.getSerCollo());
|
|
||||||
hashMap.put("num_collo", x.getNumCollo());
|
|
||||||
hashMap.put("cod_mart", x.getCodMart());
|
|
||||||
hashMap.put("gestione_rif", x.getGestioneRif());
|
|
||||||
hashMap.put("data_collo_rif", x.getDataColloRif());
|
|
||||||
hashMap.put("ser_collo_rif", x.getSerColloRif());
|
|
||||||
hashMap.put("num_collo_rif", x.getNumColloRif());
|
|
||||||
|
|
||||||
return hashMap;
|
} else {
|
||||||
})
|
return newUlList;
|
||||||
.forEach(restDTO -> {
|
}
|
||||||
|
}
|
||||||
|
|
||||||
List<HistoryVersamentoProdULDTO.OrdineDto> ordineList = ulList.stream()
|
|
||||||
.filter(x -> x.getNumCollo().equals(restDTO.getNumCollo()) &&
|
|
||||||
x.getDataCollo().equals(restDTO.getDataCollo()) &&
|
|
||||||
x.getSerCollo().equals(restDTO.getSerCollo()) &&
|
|
||||||
x.getGestione().equals(restDTO.getGestione()) &&
|
|
||||||
(x.getRigaOrd() == null || Objects.equals(x.getRigaOrd(), restDTO.getRigaOrd())))
|
|
||||||
.map(x -> new HistoryVersamentoProdULDTO.OrdineDto()
|
|
||||||
.setData(x.getDataOrd())
|
|
||||||
.setNumero(x.getNumOrd())
|
|
||||||
.setGestione(x.getGestione())
|
|
||||||
.setRigaOrd(x.getRigaOrd())
|
|
||||||
.setQtaCol(x.getQtaCol())
|
|
||||||
.setNumCnf(x.getNumCnf())
|
|
||||||
.setPercentageHr(x.getPercentageHr()))
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
|
|
||||||
// BigDecimal qtaColTot = BigDecimal.ZERO;
|
// public void loadLastULVersate(String codJfas, RunnableArgs<List<HistoryVersamentoProdULDTO>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
// BigDecimal numCnfColTot = BigDecimal.ZERO;
|
|
||||||
//
|
//
|
||||||
// for (HistoryVersamentoProdULDTO.OrdineDto ordine :
|
// String sql = "WITH ul_list AS ( " +
|
||||||
// ordineList) {
|
// " SELECT jtb_fasi.cod_jfas, " +
|
||||||
// qtaColTot = qtaColTot.add(ordine.getQtaCol());
|
// " jtb_fasi.descrizione AS descrizione_fase, " +
|
||||||
// numCnfColTot = numCnfColTot.add(ordine.getNumCnf());
|
// " mtb_colr.gestione, " +
|
||||||
|
// " mtb_colr.data_collo, " +
|
||||||
|
// " mtb_colr.num_collo, " +
|
||||||
|
// " mtb_colr.ser_collo, " +
|
||||||
|
// " mtb_colr.cod_mart, " +
|
||||||
|
// " mtb_colr.cod_col, " +
|
||||||
|
// " mtb_colr.cod_tagl, " +
|
||||||
|
// " SUM(mtb_colr.qta_col) AS qta_col, " +
|
||||||
|
// " mtb_colr.qta_cnf AS qta_cnf, " +
|
||||||
|
// " SUM(mtb_colr.num_cnf) AS num_cnf, " +
|
||||||
|
// " mtb_colr.partita_mag, " +
|
||||||
|
// " mtb_colr.cod_jcom, " +
|
||||||
|
// " mtb_colr.num_collo_rif, " +
|
||||||
|
// " mtb_colr.data_collo_rif, " +
|
||||||
|
// " mtb_colr.ser_collo_rif, " +
|
||||||
|
// " mtb_colr.gestione_rif, " +
|
||||||
|
// " mtb_colt.segno, " +
|
||||||
|
// " ISNULL(mtb_aart.descrizione_estesa, mtb_aart.descrizione) AS descrizione_art, " +
|
||||||
|
// " mtb_aart.unt_mis, " +
|
||||||
|
// " MAX(datetime_row) AS datetime_row, " +
|
||||||
|
// " mtb_colr.num_ord, " +
|
||||||
|
// " mtb_colr.data_ord, " +
|
||||||
|
// " mtb_colr.gestione as gestione_ord, " +
|
||||||
|
// " mtb_colr.riga_ord, " +
|
||||||
|
// " dtb_ord_steps.hr_num as hr, " +
|
||||||
|
// " CONVERT(INTEGER, ROUND((CAST(dtb_ord_steps.hr_num AS DECIMAL(20, 5)) / " +
|
||||||
|
// " SUM(dtb_ord_steps.hr_num) OVER (PARTITION BY mtb_colr.num_collo)), " +
|
||||||
|
// " SUM(CASE WHEN dtb_ord_steps.hr_num > 0 then dtb_ord_steps.hr_num else 1 end) OVER (PARTITION BY mtb_colr.num_collo)) * 100, " +
|
||||||
|
// " 0) as percentage_hr " +
|
||||||
|
// " FROM mtb_colr " +
|
||||||
|
// " INNER JOIN mtb_colt ON mtb_colr.num_collo = mtb_colt.num_collo " +
|
||||||
|
// " AND mtb_colr.data_collo = mtb_colt.data_collo " +
|
||||||
|
// " AND mtb_colr.ser_collo = mtb_colt.ser_collo " +
|
||||||
|
// " AND mtb_colr.gestione = mtb_colt.gestione " +
|
||||||
|
// " " + (SettingsManager.iDB().isFlagVersamentoDirettoProduzione() ? "INNER" : "LEFT OUTER") + " join dtb_ord_steps ON dtb_ord_steps.data_ord = mtb_colr.data_ord " +
|
||||||
|
// " AND dtb_ord_steps.gestione = mtb_colr.gestione " +
|
||||||
|
// " AND dtb_ord_steps.num_ord = mtb_colr.num_ord " +
|
||||||
|
// " AND dtb_ord_steps.data_iniz is not null " +
|
||||||
|
// " AND dtb_ord_steps.data_fine is null " +
|
||||||
|
// " INNER JOIN mtb_aart ON mtb_colr.cod_mart = mtb_aart.cod_mart " +
|
||||||
|
// " LEFT OUTER JOIN jtb_fasi ON mtb_colt.cod_jfas = jtb_fasi.cod_jfas " +
|
||||||
|
// " WHERE jtb_fasi.cod_jfas IS NOT NULL " +
|
||||||
|
// (UtilityString.isNullOrEmpty(codJfas) ? "" : " AND jtb_fasi.cod_jfas = " + UtilityDB.valueToString(codJfas)) +
|
||||||
|
// " AND segno = -1 " +
|
||||||
|
// " AND mtb_colr.data_collo > DATEADD(DAY, -5, GETDATE()) " +
|
||||||
|
// " GROUP BY jtb_fasi.cod_jfas, " +
|
||||||
|
// " jtb_fasi.descrizione, " +
|
||||||
|
// " mtb_colr.gestione, " +
|
||||||
|
// " mtb_colr.data_collo, " +
|
||||||
|
// " mtb_colr.num_collo, " +
|
||||||
|
// " mtb_colr.ser_collo, " +
|
||||||
|
// " mtb_colr.qta_cnf, " +
|
||||||
|
// " mtb_colr.cod_mart, " +
|
||||||
|
// " mtb_colr.cod_col, " +
|
||||||
|
// " mtb_colr.cod_tagl, " +
|
||||||
|
// " mtb_colr.ser_collo, " +
|
||||||
|
// " mtb_colr.partita_mag, " +
|
||||||
|
// " mtb_colr.cod_jcom, " +
|
||||||
|
// " mtb_aart.descrizione_estesa, " +
|
||||||
|
// " mtb_aart.descrizione, " +
|
||||||
|
// " mtb_aart.unt_mis, " +
|
||||||
|
// " mtb_colr.num_collo_rif, " +
|
||||||
|
// " mtb_colr.data_collo_rif, " +
|
||||||
|
// " mtb_colr.ser_collo_rif, " +
|
||||||
|
// " mtb_colr.gestione_rif, " +
|
||||||
|
// " mtb_colt.segno, " +
|
||||||
|
// " mtb_colr.num_ord, " +
|
||||||
|
// " mtb_colr.data_ord, " +
|
||||||
|
// " mtb_colr.gestione, " +
|
||||||
|
// " mtb_colr.riga_ord, " +
|
||||||
|
// " dtb_ord_steps.hr_num " +
|
||||||
|
// " HAVING SUM(mtb_colr.qta_col) > 0 " +
|
||||||
|
// "), max_ul AS ( " +
|
||||||
|
// " SELECT " +
|
||||||
|
// " cod_jfas, " +
|
||||||
|
// " descrizione_fase, " +
|
||||||
|
// " gestione, " +
|
||||||
|
// " cod_mart, " +
|
||||||
|
// " cod_col, " +
|
||||||
|
// " cod_tagl, " +
|
||||||
|
// " ser_collo, " +
|
||||||
|
// " partita_mag, " +
|
||||||
|
// " cod_jcom, " +
|
||||||
|
// " descrizione_art, " +
|
||||||
|
// " unt_mis, " +
|
||||||
|
// " num_collo_rif, " +
|
||||||
|
// " data_collo_rif, " +
|
||||||
|
// " ser_collo_rif, " +
|
||||||
|
// " gestione_rif, " +
|
||||||
|
// " segno, " +
|
||||||
|
// " num_ord, " +
|
||||||
|
// " data_ord, " +
|
||||||
|
// " gestione_ord, " +
|
||||||
|
// " riga_ord, " +
|
||||||
|
// " hr, " +
|
||||||
|
// " MAX (datetime_row) as max_datetime_row " +
|
||||||
|
// " FROM ul_list " +
|
||||||
|
// " GROUP BY cod_jfas, " +
|
||||||
|
// " descrizione_fase, " +
|
||||||
|
// " gestione, " +
|
||||||
|
// " cod_mart, " +
|
||||||
|
// " cod_col, " +
|
||||||
|
// " cod_tagl, " +
|
||||||
|
// " ser_collo, " +
|
||||||
|
// " partita_mag, " +
|
||||||
|
// " cod_jcom, " +
|
||||||
|
// " descrizione_art, " +
|
||||||
|
// " unt_mis, " +
|
||||||
|
// " num_collo_rif, " +
|
||||||
|
// " data_collo_rif, " +
|
||||||
|
// " ser_collo_rif, " +
|
||||||
|
// " gestione_rif, " +
|
||||||
|
// " segno, " +
|
||||||
|
// " num_ord, " +
|
||||||
|
// " data_ord, " +
|
||||||
|
// " gestione_ord, " +
|
||||||
|
// " riga_ord, " +
|
||||||
|
// " hr " +
|
||||||
|
// ") " +
|
||||||
|
// " " +
|
||||||
|
// "SELECT ul_list.* FROM max_ul " +
|
||||||
|
// "LEFT OUTER JOIN ul_list ON " +
|
||||||
|
// " ISNULL(max_ul.cod_jfas, '') = ISNULL(ul_list.cod_jfas, '') AND " +
|
||||||
|
// " ISNULL(max_ul.descrizione_fase, '') = ISNULL(ul_list.descrizione_fase, '') AND " +
|
||||||
|
// " ISNULL(max_ul.gestione, '') = ISNULL(ul_list.gestione, '') AND " +
|
||||||
|
// " ISNULL(max_ul.cod_mart, '') = ISNULL(ul_list.cod_mart, '') AND " +
|
||||||
|
// " ISNULL(max_ul.cod_col, '') = ISNULL(ul_list.cod_col, '') AND " +
|
||||||
|
// " ISNULL(max_ul.cod_tagl, '') = ISNULL(ul_list.cod_tagl, '') AND " +
|
||||||
|
// " ISNULL(max_ul.ser_collo, '') = ISNULL(ul_list.ser_collo, '') AND " +
|
||||||
|
// " ISNULL(max_ul.partita_mag, '') = ISNULL(ul_list.partita_mag, '') AND " +
|
||||||
|
// " ISNULL(max_ul.cod_jcom, '') = ISNULL(ul_list.cod_jcom, '') AND " +
|
||||||
|
// " ISNULL(max_ul.descrizione_art, '') = ISNULL(ul_list.descrizione_art, '') AND " +
|
||||||
|
// " ISNULL(max_ul.unt_mis, '') = ISNULL(ul_list.unt_mis, '') AND " +
|
||||||
|
// " ISNULL(max_ul.num_collo_rif, '') = ISNULL(ul_list.num_collo_rif, '') AND " +
|
||||||
|
// " ISNULL(max_ul.data_collo_rif, '') = ISNULL(ul_list.data_collo_rif, '') AND " +
|
||||||
|
// " ISNULL(max_ul.ser_collo_rif, '') = ISNULL(ul_list.ser_collo_rif, '') AND " +
|
||||||
|
// " ISNULL(max_ul.gestione_rif, '') = ISNULL(ul_list.gestione_rif, '') AND " +
|
||||||
|
// " ISNULL(max_ul.segno, '') = ISNULL(ul_list.segno, '') AND " +
|
||||||
|
// " ISNULL(max_ul.num_ord, '') = ISNULL(ul_list.num_ord, '') AND " +
|
||||||
|
// " ISNULL(max_ul.data_ord, '') = ISNULL(ul_list.data_ord, '') AND " +
|
||||||
|
// " ISNULL(max_ul.gestione_ord, '') = ISNULL(ul_list.gestione_ord, '') AND " +
|
||||||
|
// " ISNULL(max_ul.riga_ord, '') = ISNULL(ul_list.riga_ord, '') AND " +
|
||||||
|
// " ISNULL(max_ul.hr, '') = ISNULL(ul_list.hr, '') AND " +
|
||||||
|
// " max_ul.max_datetime_row = ul_list.datetime_row";
|
||||||
|
//
|
||||||
|
// Type typeOfObjectsList = new TypeToken<ArrayList<HistoryVersamentoProdULRestDTO>>() {
|
||||||
|
// }.getType();
|
||||||
|
// this.mSystemRESTConsumer.<ArrayList<HistoryVersamentoProdULRestDTO>>processSql(sql, typeOfObjectsList, ulList -> {
|
||||||
|
//
|
||||||
|
// if (ulList == null) {
|
||||||
|
// onComplete.run(null);
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// List<HistoryVersamentoProdULDTO> newUlList = new ArrayList<>();
|
||||||
|
//
|
||||||
|
// Stream.of(ulList)
|
||||||
|
// .distinctBy(x -> {
|
||||||
|
// HashMap<String, Object> hashMap = new HashMap<>();
|
||||||
|
// hashMap.put("gestione", x.getGestione());
|
||||||
|
// hashMap.put("data_collo", x.getDataCollo());
|
||||||
|
// hashMap.put("ser_collo", x.getSerCollo());
|
||||||
|
// hashMap.put("num_collo", x.getNumCollo());
|
||||||
|
// hashMap.put("cod_mart", x.getCodMart());
|
||||||
|
// hashMap.put("gestione_rif", x.getGestioneRif());
|
||||||
|
// hashMap.put("data_collo_rif", x.getDataColloRif());
|
||||||
|
// hashMap.put("ser_collo_rif", x.getSerColloRif());
|
||||||
|
// hashMap.put("num_collo_rif", x.getNumColloRif());
|
||||||
|
//
|
||||||
|
// return hashMap;
|
||||||
|
// })
|
||||||
|
// .forEach(restDTO -> {
|
||||||
|
//
|
||||||
|
// List<HistoryVersamentoProdULDTO.OrdineDto> ordineList = ulList.stream()
|
||||||
|
// .filter(x -> x.getNumCollo().equals(restDTO.getNumCollo()) &&
|
||||||
|
// x.getDataCollo().equals(restDTO.getDataCollo()) &&
|
||||||
|
// x.getSerCollo().equals(restDTO.getSerCollo()) &&
|
||||||
|
// x.getGestione().equals(restDTO.getGestione()) &&
|
||||||
|
// (x.getRigaOrd() == null || Objects.equals(x.getRigaOrd(), restDTO.getRigaOrd())))
|
||||||
|
// .map(x -> new HistoryVersamentoProdULDTO.OrdineDto()
|
||||||
|
// .setData(x.getDataOrd())
|
||||||
|
// .setNumero(x.getNumOrd())
|
||||||
|
// .setGestione(x.getGestione())
|
||||||
|
// .setRigaOrd(x.getRigaOrd())
|
||||||
|
// .setQtaCol(x.getQtaCol())
|
||||||
|
// .setNumCnf(x.getNumCnf())
|
||||||
|
// .setPercentageHr(x.getPercentageHr()))
|
||||||
|
// .collect(Collectors.toList());
|
||||||
|
//
|
||||||
|
//// BigDecimal qtaColTot = BigDecimal.ZERO;
|
||||||
|
//// BigDecimal numCnfColTot = BigDecimal.ZERO;
|
||||||
|
////
|
||||||
|
//// for (HistoryVersamentoProdULDTO.OrdineDto ordine :
|
||||||
|
//// ordineList) {
|
||||||
|
//// qtaColTot = qtaColTot.add(ordine.getQtaCol());
|
||||||
|
//// numCnfColTot = numCnfColTot.add(ordine.getNumCnf());
|
||||||
|
//// }
|
||||||
|
//
|
||||||
|
// newUlList.add(new HistoryVersamentoProdULDTO()
|
||||||
|
// .setGestione(restDTO.getGestione())
|
||||||
|
// .setDataCollo(restDTO.getDataCollo())
|
||||||
|
// .setSerCollo(restDTO.getSerCollo())
|
||||||
|
// .setNumCollo(restDTO.getNumCollo())
|
||||||
|
// .setSegno(restDTO.getSegno())
|
||||||
|
// .setCodMart(restDTO.getCodMart())
|
||||||
|
// .setCodCol(restDTO.getCodCol())
|
||||||
|
// .setCodTagl(restDTO.getCodTagl())
|
||||||
|
// .setCodJfas(restDTO.getCodJfas())
|
||||||
|
// .setDescrizioneArt(restDTO.getDescrizioneArt())
|
||||||
|
// .setDescrizioneFase(restDTO.getDescrizioneFase())
|
||||||
|
// .setQtaCol(restDTO.getQtaCol())
|
||||||
|
// .setQtaCnf(restDTO.getQtaCnf())
|
||||||
|
// .setNumCnf(restDTO.getNumCnf())
|
||||||
|
// .setPartitaMag(restDTO.getPartitaMag())
|
||||||
|
// .setCodJcom(restDTO.getCodJcom())
|
||||||
|
// .setDatetimeRow(restDTO.getDatetimeRow())
|
||||||
|
// .setUntMis(restDTO.getUntMis())
|
||||||
|
// .setGestioneRif(restDTO.getGestioneRif())
|
||||||
|
// .setDataColloRif(restDTO.getDataColloRif())
|
||||||
|
// .setSerColloRif(restDTO.getSerColloRif())
|
||||||
|
// .setNumColloRif(restDTO.getNumColloRif())
|
||||||
|
// .setOrdini(ordineList));
|
||||||
|
//
|
||||||
|
// });
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// if (!newUlList.isEmpty()) {
|
||||||
|
// List<String> codMarts = Stream.of(newUlList)
|
||||||
|
// .map(HistoryVersamentoProdULDTO::getCodMart)
|
||||||
|
// .withoutNulls()
|
||||||
|
// .distinct()
|
||||||
|
// .toList();
|
||||||
|
//
|
||||||
|
// this.mArticoloRESTConsumer.getByCodMarts(codMarts, arts -> {
|
||||||
|
//
|
||||||
|
// if (arts != null && !arts.isEmpty()) {
|
||||||
|
// for (HistoryVersamentoProdULDTO value : newUlList) {
|
||||||
|
//
|
||||||
|
// MtbAart foundMtbAart = null;
|
||||||
|
//
|
||||||
|
// List<MtbAart> mtbAartStream = Stream.of(arts)
|
||||||
|
// .filter(x -> x.getCodMart().equalsIgnoreCase(value.getCodMart())).toList();
|
||||||
|
//
|
||||||
|
// if (mtbAartStream != null && !mtbAartStream.isEmpty()) {
|
||||||
|
// foundMtbAart = mtbAartStream.get(0);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// value.setMtbAart(foundMtbAart);
|
||||||
// }
|
// }
|
||||||
|
// }
|
||||||
newUlList.add(new HistoryVersamentoProdULDTO()
|
//
|
||||||
.setGestione(restDTO.getGestione())
|
// onComplete.run(newUlList);
|
||||||
.setDataCollo(restDTO.getDataCollo())
|
//
|
||||||
.setSerCollo(restDTO.getSerCollo())
|
// }, onFailed);
|
||||||
.setNumCollo(restDTO.getNumCollo())
|
//
|
||||||
.setSegno(restDTO.getSegno())
|
// } else {
|
||||||
.setCodMart(restDTO.getCodMart())
|
// onComplete.run(newUlList);
|
||||||
.setCodCol(restDTO.getCodCol())
|
// }
|
||||||
.setCodTagl(restDTO.getCodTagl())
|
//
|
||||||
.setCodJfas(restDTO.getCodJfas())
|
// }, onFailed);
|
||||||
.setDescrizioneArt(restDTO.getDescrizioneArt())
|
// }
|
||||||
.setDescrizioneFase(restDTO.getDescrizioneFase())
|
|
||||||
.setQtaCol(restDTO.getQtaCol())
|
|
||||||
.setQtaCnf(restDTO.getQtaCnf())
|
|
||||||
.setNumCnf(restDTO.getNumCnf())
|
|
||||||
.setPartitaMag(restDTO.getPartitaMag())
|
|
||||||
.setCodJcom(restDTO.getCodJcom())
|
|
||||||
.setDatetimeRow(restDTO.getDatetimeRow())
|
|
||||||
.setUntMis(restDTO.getUntMis())
|
|
||||||
.setGestioneRif(restDTO.getGestioneRif())
|
|
||||||
.setDataColloRif(restDTO.getDataColloRif())
|
|
||||||
.setSerColloRif(restDTO.getSerColloRif())
|
|
||||||
.setNumColloRif(restDTO.getNumColloRif())
|
|
||||||
.setOrdini(ordineList));
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
if (!newUlList.isEmpty()) {
|
|
||||||
List<String> codMarts = Stream.of(newUlList)
|
|
||||||
.map(HistoryVersamentoProdULDTO::getCodMart)
|
|
||||||
.withoutNulls()
|
|
||||||
.distinct()
|
|
||||||
.toList();
|
|
||||||
|
|
||||||
this.mArticoloRESTConsumer.getByCodMarts(codMarts, arts -> {
|
|
||||||
|
|
||||||
if (arts != null && !arts.isEmpty()) {
|
|
||||||
for (HistoryVersamentoProdULDTO value : newUlList) {
|
|
||||||
|
|
||||||
MtbAart foundMtbAart = null;
|
|
||||||
|
|
||||||
List<MtbAart> mtbAartStream = Stream.of(arts)
|
|
||||||
.filter(x -> x.getCodMart().equalsIgnoreCase(value.getCodMart())).toList();
|
|
||||||
|
|
||||||
if (mtbAartStream != null && !mtbAartStream.isEmpty()) {
|
|
||||||
foundMtbAart = mtbAartStream.get(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
value.setMtbAart(foundMtbAart);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onComplete.run(newUlList);
|
|
||||||
|
|
||||||
}, onFailed);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
onComplete.run(newUlList);
|
|
||||||
}
|
|
||||||
|
|
||||||
}, onFailed);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,14 +40,17 @@ import it.integry.integrywmsnative.core.model.MtbColr;
|
|||||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
||||||
|
import it.integry.integrywmsnative.core.rest.model.VersamentoAutomaticoULResponseDTO;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||||
import it.integry.integrywmsnative.databinding.FragmentProdRientroMerceOrderDetailBinding;
|
import it.integry.integrywmsnative.databinding.FragmentProdRientroMerceOrderDetailBinding;
|
||||||
import it.integry.integrywmsnative.gest.prod_versamento_materiale.dto.OrdineLavorazioneDTO;
|
import it.integry.integrywmsnative.gest.prod_versamento_materiale.dto.OrdineLavorazioneDTO;
|
||||||
import it.integry.integrywmsnative.gest.settings.MainSettingsFragment;
|
import it.integry.integrywmsnative.gest.settings.MainSettingsFragment;
|
||||||
import it.integry.integrywmsnative.ui.SimpleDividerItemDecoration;
|
import it.integry.integrywmsnative.ui.SimpleDividerItemDecoration;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.ask_should_versamento_automatico_ul.DialogAskShouldVersamentoAutomaticoULView;
|
||||||
import it.integry.integrywmsnative.view.dialogs.input_lu_prod.DialogInputLUProdDTO;
|
import it.integry.integrywmsnative.view.dialogs.input_lu_prod.DialogInputLUProdDTO;
|
||||||
import it.integry.integrywmsnative.view.dialogs.input_lu_prod.DialogInputLUProdView;
|
import it.integry.integrywmsnative.view.dialogs.input_lu_prod.DialogInputLUProdView;
|
||||||
import it.integry.integrywmsnative.view.dialogs.printSsccUl.DialogPrintUlSSCCView;
|
import it.integry.integrywmsnative.view.dialogs.printSsccUl.DialogPrintUlSSCCView;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.versamento_automatico_ul_done.DialogVersamentoAutomaticoULDoneView;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A simple {@link Fragment} subclass.
|
* A simple {@link Fragment} subclass.
|
||||||
@@ -268,6 +271,19 @@ public class ProdRientroMerceOrderDetailFragment extends BaseFragment implements
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onVersamentoAutomaticoULRequest(RunnableArgs<Boolean> onComplete) {
|
||||||
|
DialogAskShouldVersamentoAutomaticoULView.newInstance(onComplete).show(requireActivity().getSupportFragmentManager(), "tag");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onULVersata(VersamentoAutomaticoULResponseDTO versamentoAutomaticoULResponseDTO, Runnable onComplete) {
|
||||||
|
|
||||||
|
handler.post(() -> {
|
||||||
|
DialogVersamentoAutomaticoULDoneView.newInstance(versamentoAutomaticoULResponseDTO, onComplete).show(requireActivity().getSupportFragmentManager(), "tag");
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public void addULButtonClick() {
|
public void addULButtonClick() {
|
||||||
this.onLoadingStarted();
|
this.onLoadingStarted();
|
||||||
@@ -355,7 +371,7 @@ public class ProdRientroMerceOrderDetailFragment extends BaseFragment implements
|
|||||||
public void deleteMtbColr(MtbColr mtbColr) {
|
public void deleteMtbColr(MtbColr mtbColr) {
|
||||||
MtbColt mtbColt = new MtbColt()
|
MtbColt mtbColt = new MtbColt()
|
||||||
.setGestione(mtbColr.getGestione())
|
.setGestione(mtbColr.getGestione())
|
||||||
.setDataCollo(mtbColr.getDataColloS())
|
.setDataCollo(mtbColr.getDataColloLD())
|
||||||
.setSerCollo(mtbColr.getSerCollo())
|
.setSerCollo(mtbColr.getSerCollo())
|
||||||
.setNumCollo(mtbColr.getNumCollo());
|
.setNumCollo(mtbColr.getNumCollo());
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsume
|
|||||||
import it.integry.integrywmsnative.core.rest.consumers.PrinterRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.PrinterRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.ProduzioneRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.ProduzioneRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
||||||
|
import it.integry.integrywmsnative.core.rest.model.VersamentoAutomaticoULResponseDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.produzione.CaricoProdFinDTO;
|
import it.integry.integrywmsnative.core.rest.model.produzione.CaricoProdFinDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.produzione.CaricoProdFinProdottoDTO;
|
import it.integry.integrywmsnative.core.rest.model.produzione.CaricoProdFinProdottoDTO;
|
||||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||||
@@ -173,13 +174,39 @@ public class ProdRientroMerceOrderDetailViewModel {
|
|||||||
}, this::sendError);
|
}, this::sendError);
|
||||||
} else {
|
} else {
|
||||||
synchronized (this.mtbColtsOfOrder) {
|
synchronized (this.mtbColtsOfOrder) {
|
||||||
this.sendOnLoadingEnded();
|
Runnable onVersamentoCompleted = () -> {
|
||||||
this.mListener.onDataSaved(mtbColtSaved);
|
this.sendOnLoadingEnded();
|
||||||
|
this.mListener.onDataSaved(mtbColtSaved);
|
||||||
|
};
|
||||||
|
|
||||||
|
if (SettingsManager.iDB().isFlagProduzioneSkipAskVersamentoAutomatico()) {
|
||||||
|
versaAutomaticamenteUL(mtbColtSaved, onVersamentoCompleted);
|
||||||
|
} else {
|
||||||
|
sendVersamentoAutomaticoULRequest(response -> {
|
||||||
|
if (response) {
|
||||||
|
versaAutomaticamenteUL(mtbColtSaved, onVersamentoCompleted);
|
||||||
|
} else {
|
||||||
|
onVersamentoCompleted.run();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, this::sendError);
|
}, this::sendError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void versaAutomaticamenteUL(MtbColt mtbColt, Runnable onComplete) {
|
||||||
|
if (mtbColt == null) return;
|
||||||
|
|
||||||
|
colliMagazzinoRESTConsumer.versamentoAutomaticoUL(mtbColt, versamentoResult -> {
|
||||||
|
this.notifyVersamentoAutomaticoResult(versamentoResult, onComplete);
|
||||||
|
}, this::sendError);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void notifyVersamentoAutomaticoResult(VersamentoAutomaticoULResponseDTO versamentoAutomaticoULResponseDTO, Runnable onComplete) {
|
||||||
|
if (this.mListener != null)
|
||||||
|
mListener.onULVersata(versamentoAutomaticoULResponseDTO, onComplete);
|
||||||
|
}
|
||||||
|
|
||||||
public void deleteLU(MtbColt mtbColt) {
|
public void deleteLU(MtbColt mtbColt) {
|
||||||
this.sendOnLoadingStarted();
|
this.sendOnLoadingStarted();
|
||||||
@@ -251,11 +278,17 @@ public class ProdRientroMerceOrderDetailViewModel {
|
|||||||
this::sendError);
|
this::sendError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void sendVersamentoAutomaticoULRequest(RunnableArgs<Boolean> onComplete) {
|
||||||
|
if (this.mListener != null) this.mListener.onVersamentoAutomaticoULRequest(onComplete);
|
||||||
|
}
|
||||||
|
|
||||||
public interface Listener extends ILoadingListener {
|
public interface Listener extends ILoadingListener {
|
||||||
|
void onVersamentoAutomaticoULRequest(RunnableArgs<Boolean> onComplete);
|
||||||
|
|
||||||
void onDataSaved(MtbColt mtbColt);
|
void onDataSaved(MtbColt mtbColt);
|
||||||
|
|
||||||
void onError(Exception ex);
|
void onError(Exception ex);
|
||||||
|
|
||||||
|
void onULVersata(VersamentoAutomaticoULResponseDTO versamentoAutomaticoULResponseDTO, Runnable onComplete);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ public class ProdRientroMerceOrderDetailRESTConsumer extends _BaseRESTConsumer {
|
|||||||
mtbColrList) {
|
mtbColrList) {
|
||||||
HashMap<String, Object> parm = new HashMap<>();
|
HashMap<String, Object> parm = new HashMap<>();
|
||||||
|
|
||||||
parm.put("data_collo", mtbcolr.getDataColloD());
|
parm.put("data_collo", mtbcolr.getDataColloLD());
|
||||||
parm.put("gestione", mtbcolr.getGestione());
|
parm.put("gestione", mtbcolr.getGestione());
|
||||||
parm.put("ser_collo", mtbcolr.getSerCollo());
|
parm.put("ser_collo", mtbcolr.getSerCollo());
|
||||||
parm.put("num_collo", mtbcolr.getNumCollo());
|
parm.put("num_collo", mtbcolr.getNumCollo());
|
||||||
@@ -90,7 +90,7 @@ public class ProdRientroMerceOrderDetailRESTConsumer extends _BaseRESTConsumer {
|
|||||||
ObservableArrayList<MtbColr> mtbColrsRoAdd = new ObservableArrayList<>();
|
ObservableArrayList<MtbColr> mtbColrsRoAdd = new ObservableArrayList<>();
|
||||||
mtbColrsRoAdd.addAll(Stream.of(mtbColrList)
|
mtbColrsRoAdd.addAll(Stream.of(mtbColrList)
|
||||||
.filter(x -> x.getNumCollo().equals(mtbColt.getNumCollo()) &&
|
.filter(x -> x.getNumCollo().equals(mtbColt.getNumCollo()) &&
|
||||||
x.getDataColloD().compareTo(mtbColt.getDataColloD()) == 0 &&
|
x.getDataColloLD().isEqual(mtbColt.getDataColloLD()) &&
|
||||||
x.getGestione().equals(mtbColt.getGestione()) &&
|
x.getGestione().equals(mtbColt.getGestione()) &&
|
||||||
x.getSerCollo().equals(mtbColt.getSerCollo()))
|
x.getSerCollo().equals(mtbColt.getSerCollo()))
|
||||||
.toList());
|
.toList());
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ public class ProdRientroMerceOrderListFilterViewModel {
|
|||||||
|
|
||||||
public void init(List<OrdineLavorazioneDTO> initialList) {
|
public void init(List<OrdineLavorazioneDTO> initialList) {
|
||||||
this.initialOrderList = initialList;
|
this.initialOrderList = initialList;
|
||||||
this.currentFilteredOrderList.setValue(this.initialOrderList);
|
this.currentFilteredOrderList.postValue(this.initialOrderList);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MutableLiveData<List<OrdineLavorazioneDTO>> getMutableFilteredOrderList() {
|
public MutableLiveData<List<OrdineLavorazioneDTO>> getMutableFilteredOrderList() {
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import com.ravikoradiya.liveadapter.Type;
|
|||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
|
import java.util.List;
|
||||||
import java.util.concurrent.CountDownLatch;
|
import java.util.concurrent.CountDownLatch;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
||||||
@@ -38,6 +39,7 @@ import it.integry.integrywmsnative.view.bottom_sheet__item_edit.BottomSheetItemD
|
|||||||
import it.integry.integrywmsnative.view.bottom_sheet__item_edit.BottomSheetItemEditView;
|
import it.integry.integrywmsnative.view.bottom_sheet__item_edit.BottomSheetItemEditView;
|
||||||
import it.integry.integrywmsnative.view.dialogs.DialogConsts;
|
import it.integry.integrywmsnative.view.dialogs.DialogConsts;
|
||||||
import it.integry.integrywmsnative.view.dialogs.ask_deposito.DialogAskDepositoView;
|
import it.integry.integrywmsnative.view.dialogs.ask_deposito.DialogAskDepositoView;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.choose_art_from_lista_arts.DialogChooseArtFromListaArtsView;
|
||||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2DTO;
|
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2DTO;
|
||||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2View;
|
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2View;
|
||||||
import it.integry.integrywmsnative.view.dialogs.yes_no.DialogYesNoView;
|
import it.integry.integrywmsnative.view.dialogs.yes_no.DialogYesNoView;
|
||||||
@@ -91,7 +93,6 @@ public class VerificaGiacenzeFragment extends BaseFragment implements ITitledFra
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void init() {
|
private void init() {
|
||||||
|
|
||||||
executorService.execute(() -> {
|
executorService.execute(() -> {
|
||||||
|
|
||||||
boolean recoveredSession = false;
|
boolean recoveredSession = false;
|
||||||
@@ -129,7 +130,6 @@ public class VerificaGiacenzeFragment extends BaseFragment implements ITitledFra
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
this.onLoadingStarted();
|
this.onLoadingStarted();
|
||||||
mViewModel.loadDeposito(codMdep);
|
|
||||||
|
|
||||||
if (!recoveredSession) mViewModel.createNew(codMdep);
|
if (!recoveredSession) mViewModel.createNew(codMdep);
|
||||||
|
|
||||||
@@ -162,7 +162,6 @@ public class VerificaGiacenzeFragment extends BaseFragment implements ITitledFra
|
|||||||
CountDownLatch countDownLatch = new CountDownLatch(1);
|
CountDownLatch countDownLatch = new CountDownLatch(1);
|
||||||
AtomicReference<String> codMdepAtomic = new AtomicReference<>();
|
AtomicReference<String> codMdepAtomic = new AtomicReference<>();
|
||||||
|
|
||||||
|
|
||||||
DialogAskDepositoView.newInstance(codMdep -> {
|
DialogAskDepositoView.newInstance(codMdep -> {
|
||||||
codMdepAtomic.set(codMdep);
|
codMdepAtomic.set(codMdep);
|
||||||
countDownLatch.countDown();
|
countDownLatch.countDown();
|
||||||
@@ -173,7 +172,6 @@ public class VerificaGiacenzeFragment extends BaseFragment implements ITitledFra
|
|||||||
return codMdepAtomic.get();
|
return codMdepAtomic.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void initRecyclerView() {
|
private void initRecyclerView() {
|
||||||
var itemType = new Type<VerificaGiacenzeRowEntity, ListaVerificaGiacenzePickedItemListModelBinding>(R.layout.lista_verifica_giacenze_picked_item_list_model, BR.item);
|
var itemType = new Type<VerificaGiacenzeRowEntity, ListaVerificaGiacenzePickedItemListModelBinding>(R.layout.lista_verifica_giacenze_picked_item_list_model, BR.item);
|
||||||
|
|
||||||
@@ -213,13 +211,12 @@ public class VerificaGiacenzeFragment extends BaseFragment implements ITitledFra
|
|||||||
this.mViewModel.processBarcodeDTO(data);
|
this.mViewModel.processBarcodeDTO(data);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
this.onError(e);
|
this.onError(e);
|
||||||
|
} finally {
|
||||||
|
handler.post(this::onLoadingEnded);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.onLoadingEnded();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
private void openItemAction(VerificaGiacenzeRowEntity item) {
|
private void openItemAction(VerificaGiacenzeRowEntity item) {
|
||||||
var anagrafica = mViewModel.searchAnagraficaByCodMart(item.getCodMart());
|
var anagrafica = mViewModel.searchAnagraficaByCodMart(item.getCodMart());
|
||||||
|
|
||||||
@@ -261,7 +258,6 @@ public class VerificaGiacenzeFragment extends BaseFragment implements ITitledFra
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public PickedQuantityDTO onItemDispatched(MtbAart mtbAart,
|
public PickedQuantityDTO onItemDispatched(MtbAart mtbAart,
|
||||||
BigDecimal initialNumCnf,
|
BigDecimal initialNumCnf,
|
||||||
BigDecimal initialQtaCnf,
|
BigDecimal initialQtaCnf,
|
||||||
@@ -338,7 +334,6 @@ public class VerificaGiacenzeFragment extends BaseFragment implements ITitledFra
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
@@ -350,4 +345,10 @@ public class VerificaGiacenzeFragment extends BaseFragment implements ITitledFra
|
|||||||
public void onCreateActionBar(AppCompatTextView titleText, Context context) {
|
public void onCreateActionBar(AppCompatTextView titleText, Context context) {
|
||||||
titleText.setText(R.string.verifica_giacenze_menu);
|
titleText.setText(R.string.verifica_giacenze_menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onChooseArtRequest(List<MtbAart> artsList, RunnableArgs<MtbAart> onComplete) {
|
||||||
|
DialogChooseArtFromListaArtsView.newInstance(true, artsList, onComplete)
|
||||||
|
.show(requireActivity().getSupportFragmentManager(), "dialog-choose-art");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -16,8 +16,8 @@ import it.integry.integrywmsnative.core.rest.consumers.GiacenzaPvRESTConsumer;
|
|||||||
public class VerificaGiacenzeModule {
|
public class VerificaGiacenzeModule {
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
VerificaGiacenzeViewModel providesVerificaGiacenzeViewModel(ExecutorService executorService, Handler handler, VerificaGiacenzeRowMapper verificaGiacenzeRowMapper, VerificaGiacenzeRepository verificaGiacenzeRepository, VerificaGiacenzeRowRepository verificaGiacenzeRowRepository, GiacenzaPvRESTConsumer giacenzaPvRESTConsumer, ArticoloRESTConsumer articoloRESTConsumer) {
|
VerificaGiacenzeViewModel providesVerificaGiacenzeViewModel(Handler handler, VerificaGiacenzeRowMapper verificaGiacenzeRowMapper, VerificaGiacenzeRepository verificaGiacenzeRepository, VerificaGiacenzeRowRepository verificaGiacenzeRowRepository, GiacenzaPvRESTConsumer giacenzaPvRESTConsumer, ArticoloRESTConsumer articoloRESTConsumer) {
|
||||||
return new VerificaGiacenzeViewModel(executorService, handler, verificaGiacenzeRowMapper, giacenzaPvRESTConsumer, verificaGiacenzeRepository, verificaGiacenzeRowRepository, articoloRESTConsumer);
|
return new VerificaGiacenzeViewModel(handler, verificaGiacenzeRowMapper, giacenzaPvRESTConsumer, verificaGiacenzeRepository, verificaGiacenzeRowRepository, articoloRESTConsumer);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -11,8 +11,8 @@ import java.time.LocalDateTime;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.CountDownLatch;
|
||||||
import java.util.stream.Collectors;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
@@ -22,8 +22,8 @@ import it.integry.integrywmsnative.core.data_store.db.entity.VerificaGiacenzeRow
|
|||||||
import it.integry.integrywmsnative.core.data_store.db.respository_new.VerificaGiacenzeRepository;
|
import it.integry.integrywmsnative.core.data_store.db.respository_new.VerificaGiacenzeRepository;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.respository_new.VerificaGiacenzeRowRepository;
|
import it.integry.integrywmsnative.core.data_store.db.respository_new.VerificaGiacenzeRowRepository;
|
||||||
import it.integry.integrywmsnative.core.exception.NoArtsFoundException;
|
import it.integry.integrywmsnative.core.exception.NoArtsFoundException;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
|
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
|
||||||
import it.integry.integrywmsnative.core.mapper.VerificaGiacenzeMapper;
|
|
||||||
import it.integry.integrywmsnative.core.mapper.VerificaGiacenzeRowMapper;
|
import it.integry.integrywmsnative.core.mapper.VerificaGiacenzeRowMapper;
|
||||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||||
@@ -31,7 +31,6 @@ import it.integry.integrywmsnative.core.rest.consumers.GiacenzaPvRESTConsumer;
|
|||||||
import it.integry.integrywmsnative.core.rest.model.Ean13PesoModel;
|
import it.integry.integrywmsnative.core.rest.model.Ean13PesoModel;
|
||||||
import it.integry.integrywmsnative.core.rest.model.pv.CloseVerificaRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.pv.CloseVerificaRequestDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.pv.DeleteRowVerificaRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.pv.DeleteRowVerificaRequestDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.pv.GiacenzaPvDTO;
|
|
||||||
import it.integry.integrywmsnative.core.rest.model.pv.SaveNewRowVerificaRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.pv.SaveNewRowVerificaRequestDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.pv.UpdateRowVerificaRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.pv.UpdateRowVerificaRequestDTO;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
|
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
|
||||||
@@ -39,8 +38,6 @@ import it.integry.integrywmsnative.core.utility.UtilityBigDecimal;
|
|||||||
import it.integry.integrywmsnative.gest.spedizione.model.PickedQuantityDTO;
|
import it.integry.integrywmsnative.gest.spedizione.model.PickedQuantityDTO;
|
||||||
|
|
||||||
public class VerificaGiacenzeViewModel {
|
public class VerificaGiacenzeViewModel {
|
||||||
|
|
||||||
private final ExecutorService executorService;
|
|
||||||
private final Handler handler;
|
private final Handler handler;
|
||||||
private final VerificaGiacenzeRowMapper verificaGiacenzeRowMapper;
|
private final VerificaGiacenzeRowMapper verificaGiacenzeRowMapper;
|
||||||
private final GiacenzaPvRESTConsumer giacenzaPvRESTConsumer;
|
private final GiacenzaPvRESTConsumer giacenzaPvRESTConsumer;
|
||||||
@@ -50,21 +47,17 @@ public class VerificaGiacenzeViewModel {
|
|||||||
|
|
||||||
private Listener listener;
|
private Listener listener;
|
||||||
|
|
||||||
private MutableLiveData<VerificaGiacenzeEntity> currentVerifica = new MutableLiveData<>();
|
private final MutableLiveData<VerificaGiacenzeEntity> currentVerifica = new MutableLiveData<>();
|
||||||
private final MutableLiveData<List<VerificaGiacenzeRowEntity>> currentVerificaRows = new MutableLiveData<>(new ArrayList<>());
|
private final MutableLiveData<List<VerificaGiacenzeRowEntity>> currentVerificaRows = new MutableLiveData<>(new ArrayList<>());
|
||||||
|
private List<MtbAart> currentLoadedAnagrafiche = new ArrayList<>();
|
||||||
private List<GiacenzaPvDTO> currentLoadedGiacenza = null;
|
|
||||||
private List<MtbAart> currentLoadedAnagrafiche = null;
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public VerificaGiacenzeViewModel(ExecutorService executorService,
|
public VerificaGiacenzeViewModel(Handler handler,
|
||||||
Handler handler,
|
|
||||||
VerificaGiacenzeRowMapper verificaGiacenzeRowMapper,
|
VerificaGiacenzeRowMapper verificaGiacenzeRowMapper,
|
||||||
GiacenzaPvRESTConsumer giacenzaPvRESTConsumer,
|
GiacenzaPvRESTConsumer giacenzaPvRESTConsumer,
|
||||||
VerificaGiacenzeRepository verificaGiacenzeRepository,
|
VerificaGiacenzeRepository verificaGiacenzeRepository,
|
||||||
VerificaGiacenzeRowRepository verificaGiacenzeRowRepository,
|
VerificaGiacenzeRowRepository verificaGiacenzeRowRepository,
|
||||||
ArticoloRESTConsumer articoloRESTConsumer) {
|
ArticoloRESTConsumer articoloRESTConsumer) {
|
||||||
this.executorService = executorService;
|
|
||||||
this.handler = handler;
|
this.handler = handler;
|
||||||
this.verificaGiacenzeRowMapper = verificaGiacenzeRowMapper;
|
this.verificaGiacenzeRowMapper = verificaGiacenzeRowMapper;
|
||||||
this.giacenzaPvRESTConsumer = giacenzaPvRESTConsumer;
|
this.giacenzaPvRESTConsumer = giacenzaPvRESTConsumer;
|
||||||
@@ -87,8 +80,7 @@ public class VerificaGiacenzeViewModel {
|
|||||||
currentVerifica.postValue(null);
|
currentVerifica.postValue(null);
|
||||||
currentVerificaRows.postValue(new ArrayList<>());
|
currentVerificaRows.postValue(new ArrayList<>());
|
||||||
|
|
||||||
currentLoadedGiacenza = null;
|
currentLoadedAnagrafiche = new ArrayList<>();
|
||||||
currentLoadedAnagrafiche = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public LiveData<VerificaGiacenzeEntity> getCurrentVerifica() {
|
public LiveData<VerificaGiacenzeEntity> getCurrentVerifica() {
|
||||||
@@ -99,60 +91,6 @@ public class VerificaGiacenzeViewModel {
|
|||||||
return currentVerificaRows;
|
return currentVerificaRows;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadDeposito(String codMdep) throws Exception {
|
|
||||||
currentLoadedGiacenza = this.giacenzaPvRESTConsumer.retrieveGiacenzeSynchronized(codMdep);
|
|
||||||
|
|
||||||
if (currentLoadedGiacenza == null) {
|
|
||||||
throw new Exception("Errore nel recupero delle giacenze");
|
|
||||||
}
|
|
||||||
|
|
||||||
var codMartsToRetrieve = currentLoadedGiacenza.parallelStream()
|
|
||||||
.map(GiacenzaPvDTO::getCodMart)
|
|
||||||
.collect(Collectors.toUnmodifiableList());
|
|
||||||
|
|
||||||
currentLoadedAnagrafiche = this.articoloRESTConsumer.getByCodMartsSynchronized(codMartsToRetrieve);
|
|
||||||
|
|
||||||
if (currentLoadedAnagrafiche == null) {
|
|
||||||
throw new Exception("Errore nel recupero delle anagrafiche");
|
|
||||||
}
|
|
||||||
|
|
||||||
currentLoadedAnagrafiche.forEach(x -> x.setFlagTracciabilita("N"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void randomizeElements(int elementsCount) {
|
|
||||||
|
|
||||||
for (int i = 0; i < elementsCount; i++) {
|
|
||||||
var randomIndex = (int) (Math.random() * currentLoadedAnagrafiche.size());
|
|
||||||
var randomAnagrafica = currentLoadedAnagrafiche.get(randomIndex);
|
|
||||||
|
|
||||||
var foundGiacenza = currentLoadedGiacenza.parallelStream()
|
|
||||||
.filter(x -> x.getCodMart().equalsIgnoreCase(randomAnagrafica.getCodMart()))
|
|
||||||
.findFirst()
|
|
||||||
.orElse(null);
|
|
||||||
var qtaGiacenza = foundGiacenza != null ? foundGiacenza.getQtaInv() : BigDecimal.ZERO;
|
|
||||||
|
|
||||||
var rowToInsert = new VerificaGiacenzeRowEntity();
|
|
||||||
rowToInsert.setParentId(currentVerifica.getValue().getId());
|
|
||||||
rowToInsert.setCodMart(randomAnagrafica.getCodMart());
|
|
||||||
rowToInsert.setDescrizione(randomAnagrafica.getDescrizione());
|
|
||||||
rowToInsert.setScanCodBarre(randomAnagrafica.getBarCode());
|
|
||||||
rowToInsert.setNumConf(BigDecimal.valueOf((int) (Math.random() * 100)));
|
|
||||||
rowToInsert.setQtaConf(randomAnagrafica.getQtaCnf());
|
|
||||||
rowToInsert.setQta(UtilityBigDecimal.multiply(rowToInsert.getNumConf(), randomAnagrafica.getQtaCnf()));
|
|
||||||
rowToInsert.setQtaInGiacenza(qtaGiacenza);
|
|
||||||
|
|
||||||
|
|
||||||
insertRow(rowToInsert);
|
|
||||||
|
|
||||||
try {
|
|
||||||
Thread.sleep(50);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void createNew(String codMdep) {
|
public void createNew(String codMdep) {
|
||||||
var verificaGiacenzeEntity = new VerificaGiacenzeEntity();
|
var verificaGiacenzeEntity = new VerificaGiacenzeEntity();
|
||||||
verificaGiacenzeEntity.setCodMdep(codMdep);
|
verificaGiacenzeEntity.setCodMdep(codMdep);
|
||||||
@@ -172,7 +110,7 @@ public class VerificaGiacenzeViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void close() throws Exception {
|
public void close() throws Exception {
|
||||||
if (currentVerificaRows.getValue().isEmpty()) {
|
if (currentVerificaRows.getValue() == null || currentVerificaRows.getValue().isEmpty()) {
|
||||||
delete();
|
delete();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -187,32 +125,52 @@ public class VerificaGiacenzeViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void processBarcodeDTO(BarcodeScanDTO barcodeScanDTO) throws Exception {
|
public void processBarcodeDTO(BarcodeScanDTO barcodeScanDTO) throws Exception {
|
||||||
|
|
||||||
if (UtilityBarcode.isEanPeso(barcodeScanDTO)) {
|
if (UtilityBarcode.isEanPeso(barcodeScanDTO)) {
|
||||||
var ean13 = Ean13PesoModel.fromBarcode(barcodeScanDTO.getStringValue());
|
var ean13 = Ean13PesoModel.fromBarcode(barcodeScanDTO.getStringValue());
|
||||||
this.loadArticolo(ean13.getPrecode());
|
this.loadArticolo(ean13.getPrecode());
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
this.loadArticolo(barcodeScanDTO.getStringValue());
|
this.loadArticolo(barcodeScanDTO.getStringValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void loadArticolo(String barcodeProd) throws Exception {
|
||||||
|
var mtbAartList = this.articoloRESTConsumer.searchByBarcodeSynchronized(barcodeProd);
|
||||||
|
|
||||||
private void loadArticolo(String barcodeProd) throws NoArtsFoundException, CloneNotSupportedException {
|
if (mtbAartList != null && !mtbAartList.isEmpty()) {
|
||||||
var foundMtbAart = searchAnagraficaByBarcode(barcodeProd);
|
MtbAart loadedArticolo;
|
||||||
|
|
||||||
if (foundMtbAart == null)
|
if (mtbAartList.size() == 1) loadedArticolo = mtbAartList.get(0);
|
||||||
throw new NoArtsFoundException();
|
else loadedArticolo = this.sendChooseArtRequest(mtbAartList);
|
||||||
|
|
||||||
loadArticolo(foundMtbAart);
|
if (loadedArticolo == null) return;
|
||||||
|
loadedArticolo.setFlagTracciabilita("N");
|
||||||
|
|
||||||
|
this.updateCurrentAnagrafiche(loadedArticolo);
|
||||||
|
this.loadArticolo(loadedArticolo);
|
||||||
|
} else throw new NoArtsFoundException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadArticolo(MtbAart mtbAart) throws NoArtsFoundException, CloneNotSupportedException {
|
private void updateCurrentAnagrafiche(MtbAart loadedArticolo) {
|
||||||
var foundGiacenza = currentLoadedGiacenza.parallelStream()
|
MtbAart mtbAart = currentLoadedAnagrafiche.stream()
|
||||||
.filter(x -> x.getCodMart().equalsIgnoreCase(mtbAart.getCodMart()))
|
.filter(x -> x.getCodMart().equalsIgnoreCase(loadedArticolo.getCodMart()))
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.orElse(null);
|
.orElse(null);
|
||||||
|
|
||||||
|
if (mtbAart != null) currentLoadedAnagrafiche.remove(mtbAart);
|
||||||
|
|
||||||
|
currentLoadedAnagrafiche.add(loadedArticolo);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void loadArticolo(MtbAart mtbAart) throws Exception {
|
||||||
|
var foundGiacenzaList = giacenzaPvRESTConsumer.retrieveGiacenzeSynchronized(
|
||||||
|
Objects.requireNonNull(currentVerifica.getValue()).getCodMdep(),
|
||||||
|
mtbAart.getCodMart()
|
||||||
|
);
|
||||||
|
|
||||||
|
if (foundGiacenzaList == null || foundGiacenzaList.isEmpty() || foundGiacenzaList.stream().count() > 1)
|
||||||
|
throw new Exception("Errore nel recupero delle giacenze");
|
||||||
|
var foundGiacenza = foundGiacenzaList.get(0);
|
||||||
|
|
||||||
var numCnfGiacenza = foundGiacenza != null ? UtilityBigDecimal.divide(foundGiacenza.getQtaInv(), mtbAart.getQtaCnf()) : BigDecimal.ZERO;
|
var numCnfGiacenza = foundGiacenza != null ? UtilityBigDecimal.divide(foundGiacenza.getQtaInv(), mtbAart.getQtaCnf()) : BigDecimal.ZERO;
|
||||||
var qtaCnfGiacenza = mtbAart.getQtaCnf();
|
var qtaCnfGiacenza = mtbAart.getQtaCnf();
|
||||||
var qtaGiacenza = foundGiacenza != null ? foundGiacenza.getQtaInv() : BigDecimal.ZERO;
|
var qtaGiacenza = foundGiacenza != null ? foundGiacenza.getQtaInv() : BigDecimal.ZERO;
|
||||||
@@ -226,7 +184,7 @@ public class VerificaGiacenzeViewModel {
|
|||||||
|
|
||||||
boolean isNewRow = false;
|
boolean isNewRow = false;
|
||||||
|
|
||||||
var rowToSave = currentVerificaRows.getValue().parallelStream()
|
var rowToSave = Objects.requireNonNull(currentVerificaRows.getValue()).parallelStream()
|
||||||
.filter(x -> x.getCodMart().equalsIgnoreCase(mtbAart.getCodMart()))
|
.filter(x -> x.getCodMart().equalsIgnoreCase(mtbAart.getCodMart()))
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.orElse(null);
|
.orElse(null);
|
||||||
@@ -235,7 +193,7 @@ public class VerificaGiacenzeViewModel {
|
|||||||
isNewRow = true;
|
isNewRow = true;
|
||||||
|
|
||||||
rowToSave = new VerificaGiacenzeRowEntity();
|
rowToSave = new VerificaGiacenzeRowEntity();
|
||||||
rowToSave.setParentId(currentVerifica.getValue().getId());
|
rowToSave.setParentId(Objects.requireNonNull(currentVerifica.getValue()).getId());
|
||||||
rowToSave.setCodMart(mtbAart.getCodMart());
|
rowToSave.setCodMart(mtbAart.getCodMart());
|
||||||
rowToSave.setPartitaMag(null);
|
rowToSave.setPartitaMag(null);
|
||||||
rowToSave.setDescrizione(mtbAart.getDescrizione());
|
rowToSave.setDescrizione(mtbAart.getDescrizione());
|
||||||
@@ -246,21 +204,18 @@ public class VerificaGiacenzeViewModel {
|
|||||||
initialQtaTot = rowToSave.getQta();
|
initialQtaTot = rowToSave.getQta();
|
||||||
}
|
}
|
||||||
|
|
||||||
var pickedQuantity = this.sendOnItemDispatched(mtbAart,
|
var pickedQuantity = this.sendOnItemDispatched(
|
||||||
|
mtbAart,
|
||||||
initialNumCnf,
|
initialNumCnf,
|
||||||
qtaCnfGiacenza,
|
qtaCnfGiacenza,
|
||||||
initialQtaTot,
|
initialQtaTot,
|
||||||
numCnfGiacenza,
|
numCnfGiacenza,
|
||||||
qtaGiacenza,
|
qtaGiacenza,
|
||||||
incomingNumCnf,
|
incomingNumCnf,
|
||||||
incomingQta,
|
incomingQta
|
||||||
null,
|
|
||||||
null
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if (pickedQuantity == null)
|
if (pickedQuantity == null) return;
|
||||||
return;
|
|
||||||
|
|
||||||
|
|
||||||
rowToSave.setNumConf(pickedQuantity.getNumCnf());
|
rowToSave.setNumConf(pickedQuantity.getNumCnf());
|
||||||
rowToSave.setQtaConf(pickedQuantity.getQtaCnf());
|
rowToSave.setQtaConf(pickedQuantity.getQtaCnf());
|
||||||
@@ -272,7 +227,6 @@ public class VerificaGiacenzeViewModel {
|
|||||||
} else {
|
} else {
|
||||||
updateRow(rowToSave);
|
updateRow(rowToSave);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public MtbAart searchAnagraficaByCodMart(String codMart) {
|
public MtbAart searchAnagraficaByCodMart(String codMart) {
|
||||||
@@ -282,24 +236,6 @@ public class VerificaGiacenzeViewModel {
|
|||||||
.orElse(null);
|
.orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MtbAart searchAnagraficaByBarcode(String barcode) {
|
|
||||||
MtbAart mtbAart = currentLoadedAnagrafiche.parallelStream()
|
|
||||||
.filter(x -> barcode.equals(x.getBarCode()))
|
|
||||||
.findFirst()
|
|
||||||
.orElse(null);
|
|
||||||
|
|
||||||
if (mtbAart == null) {
|
|
||||||
mtbAart = currentLoadedAnagrafiche.parallelStream()
|
|
||||||
.filter(x -> x.getMtbAartBarCode() != null &&
|
|
||||||
x.getMtbAartBarCode().stream()
|
|
||||||
.anyMatch(y -> barcode.equals(y.getCodBarre())))
|
|
||||||
.findFirst()
|
|
||||||
.orElse(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
return mtbAart;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void insertRow(VerificaGiacenzeRowEntity rowEntity) {
|
public void insertRow(VerificaGiacenzeRowEntity rowEntity) {
|
||||||
this.sendOnLoadingStarted();
|
this.sendOnLoadingStarted();
|
||||||
|
|
||||||
@@ -316,7 +252,7 @@ public class VerificaGiacenzeViewModel {
|
|||||||
|
|
||||||
verificaGiacenzeRowRepository.insert(rowEntity, insertedData -> {
|
verificaGiacenzeRowRepository.insert(rowEntity, insertedData -> {
|
||||||
handler.post(() -> {
|
handler.post(() -> {
|
||||||
currentVerificaRows.getValue().add(insertedData);
|
Objects.requireNonNull(currentVerificaRows.getValue()).add(insertedData);
|
||||||
notifyRowChanged();
|
notifyRowChanged();
|
||||||
});
|
});
|
||||||
}, this::sendError);
|
}, this::sendError);
|
||||||
@@ -339,7 +275,7 @@ public class VerificaGiacenzeViewModel {
|
|||||||
var indexInList = -1;
|
var indexInList = -1;
|
||||||
|
|
||||||
List<VerificaGiacenzeRowEntity> value = currentVerificaRows.getValue();
|
List<VerificaGiacenzeRowEntity> value = currentVerificaRows.getValue();
|
||||||
for (int i = 0; i < value.size(); i++) {
|
for (int i = 0; i < Objects.requireNonNull(value).size(); i++) {
|
||||||
VerificaGiacenzeRowEntity entity = value.get(i);
|
VerificaGiacenzeRowEntity entity = value.get(i);
|
||||||
|
|
||||||
if (Objects.equals(entity.getId(), rowEntity.getId())) {
|
if (Objects.equals(entity.getId(), rowEntity.getId())) {
|
||||||
@@ -374,7 +310,7 @@ public class VerificaGiacenzeViewModel {
|
|||||||
verificaGiacenzeRowRepository.delete(rowEntity, () -> {
|
verificaGiacenzeRowRepository.delete(rowEntity, () -> {
|
||||||
|
|
||||||
handler.post(() -> {
|
handler.post(() -> {
|
||||||
currentVerificaRows.getValue().remove(rowEntity);
|
Objects.requireNonNull(currentVerificaRows.getValue()).remove(rowEntity);
|
||||||
notifyRowChanged();
|
notifyRowChanged();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -386,6 +322,25 @@ public class VerificaGiacenzeViewModel {
|
|||||||
this.sendOnLoadingEnded();
|
this.sendOnLoadingEnded();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private MtbAart sendChooseArtRequest(List<MtbAart> mtbAarts) {
|
||||||
|
final CountDownLatch latch = new CountDownLatch(1);
|
||||||
|
AtomicReference<MtbAart> result = new AtomicReference<>();
|
||||||
|
|
||||||
|
listener.onChooseArtRequest(mtbAarts, data -> {
|
||||||
|
result.set(data);
|
||||||
|
latch.countDown();
|
||||||
|
});
|
||||||
|
|
||||||
|
try {
|
||||||
|
latch.await();
|
||||||
|
return result.get();
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
this.sendError(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
private PickedQuantityDTO sendOnItemDispatched(MtbAart mtbAart,
|
private PickedQuantityDTO sendOnItemDispatched(MtbAart mtbAart,
|
||||||
BigDecimal initialNumCnf,
|
BigDecimal initialNumCnf,
|
||||||
BigDecimal initialQtaCnf,
|
BigDecimal initialQtaCnf,
|
||||||
@@ -393,15 +348,13 @@ public class VerificaGiacenzeViewModel {
|
|||||||
BigDecimal inWarehouseNumCnf,
|
BigDecimal inWarehouseNumCnf,
|
||||||
BigDecimal inWarehouseQtaTot,
|
BigDecimal inWarehouseQtaTot,
|
||||||
BigDecimal incomingNumCnf,
|
BigDecimal incomingNumCnf,
|
||||||
BigDecimal incomingQtaTot,
|
BigDecimal incomingQtaTot) {
|
||||||
String partitaMag,
|
|
||||||
LocalDate dataScad) {
|
|
||||||
if (listener != null)
|
if (listener != null)
|
||||||
return this.listener.onItemDispatched(mtbAart,
|
return this.listener.onItemDispatched(
|
||||||
initialNumCnf, initialQtaCnf, initialQtaTot,
|
mtbAart, initialNumCnf, initialQtaCnf,
|
||||||
inWarehouseNumCnf, inWarehouseQtaTot,
|
initialQtaTot, inWarehouseNumCnf, inWarehouseQtaTot,
|
||||||
incomingNumCnf, incomingQtaTot,
|
incomingNumCnf, incomingQtaTot, null, null
|
||||||
partitaMag, dataScad);
|
);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -435,5 +388,7 @@ public class VerificaGiacenzeViewModel {
|
|||||||
LocalDate dataScad);
|
LocalDate dataScad);
|
||||||
|
|
||||||
void onError(Exception ex);
|
void onError(Exception ex);
|
||||||
|
|
||||||
|
void onChooseArtRequest(List<MtbAart> artsList, RunnableArgs<MtbAart> onComplete);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -366,7 +366,7 @@ public class RettificaGiacenzeViewModel {
|
|||||||
mtbColr
|
mtbColr
|
||||||
.setQtaCol(BigDecimal.ZERO)
|
.setQtaCol(BigDecimal.ZERO)
|
||||||
.setNumCnf(BigDecimal.ZERO)
|
.setNumCnf(BigDecimal.ZERO)
|
||||||
.setDataCollo(mCurrentMtbColt.getDataColloS())
|
.setDataCollo(mCurrentMtbColt.getDataColloLD())
|
||||||
.setNumCollo(mCurrentMtbColt.getNumCollo())
|
.setNumCollo(mCurrentMtbColt.getNumCollo())
|
||||||
.setGestione(mCurrentMtbColt.getGestione())
|
.setGestione(mCurrentMtbColt.getGestione())
|
||||||
.setSerCollo(mCurrentMtbColt.getSerCollo());
|
.setSerCollo(mCurrentMtbColt.getSerCollo());
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ import androidx.sqlite.db.SimpleSQLiteQuery;
|
|||||||
|
|
||||||
import com.annimon.stream.Stream;
|
import com.annimon.stream.Stream;
|
||||||
import com.google.android.material.snackbar.Snackbar;
|
import com.google.android.material.snackbar.Snackbar;
|
||||||
|
import com.google.firebase.crashlytics.CustomKeysAndValues;
|
||||||
|
import com.google.firebase.crashlytics.FirebaseCrashlytics;
|
||||||
import com.harrysoft.androidbluetoothserial.BluetoothManager;
|
import com.harrysoft.androidbluetoothserial.BluetoothManager;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
@@ -31,7 +33,9 @@ import java.util.Arrays;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.CountDownLatch;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
@@ -249,85 +253,117 @@ public class MainSettingsFragment extends PreferenceFragmentCompat implements IT
|
|||||||
private void checkUpdates() {
|
private void checkUpdates() {
|
||||||
Snackbar.make(getView(), R.string.checking_updates, Snackbar.LENGTH_SHORT)
|
Snackbar.make(getView(), R.string.checking_updates, Snackbar.LENGTH_SHORT)
|
||||||
.show();
|
.show();
|
||||||
updatesManager.executeCheck(getContext(), true);
|
updatesManager.executeCheck(getContext(), getParentFragmentManager(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void exportLog() {
|
private void exportLog() {
|
||||||
var handler = new Handler(Looper.getMainLooper());
|
var handler = new Handler(Looper.getMainLooper());
|
||||||
|
|
||||||
DialogYesNoView.newInstance("Esportazione log", "Vuoi inviare il log degli eventi al supporto?", result -> {
|
executorService.execute(() -> {
|
||||||
if (result == DialogConsts.Results.NO || result == DialogConsts.Results.ABORT)
|
|
||||||
return;
|
|
||||||
|
|
||||||
this.openProgress();
|
if(!askConfirmToExportLog()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
executorService.execute(() -> {
|
this.openProgress();
|
||||||
|
|
||||||
|
|
||||||
File logFilePath = appContext.getLogFilePath();
|
File logFilePath = appContext.getLogFilePath();
|
||||||
var files = logFilePath.listFiles();
|
var files = logFilePath.listFiles(File::isFile);
|
||||||
|
|
||||||
var fileToShare = Arrays.stream(files)
|
var fileToShare = Arrays.stream(files)
|
||||||
.sorted(Comparator.reverseOrder())
|
.sorted(Comparator.reverseOrder())
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.orElse(null);
|
.orElse(null);
|
||||||
try {
|
try {
|
||||||
List<MailAttachmentDTO> attachmentDTOList = new ArrayList<>();
|
List<MailAttachmentDTO> attachmentDTOList = new ArrayList<>();
|
||||||
|
|
||||||
if (fileToShare != null) {
|
if (fileToShare != null) {
|
||||||
var htmlContent = createAppLogAttachment(fileToShare);
|
try {
|
||||||
|
var htmlContent = createAppLogAttachment(fileToShare);
|
||||||
|
|
||||||
byte[] buffer = htmlContent.getBytes();//specify the size to allow.
|
byte[] buffer = htmlContent.getBytes();//specify the size to allow.
|
||||||
String base64 = Base64.encodeToString(buffer, Base64.NO_WRAP);
|
String base64 = Base64.encodeToString(buffer, Base64.NO_WRAP);
|
||||||
|
|
||||||
var logAttachment = new MailAttachmentDTO()
|
var logAttachment = new MailAttachmentDTO()
|
||||||
.setFileName("wms_log.html")
|
.setFileName("wms_log.html")
|
||||||
.setFileb64Content(base64);
|
.setFileb64Content(base64);
|
||||||
attachmentDTOList.add(logAttachment);
|
attachmentDTOList.add(logAttachment);
|
||||||
}
|
} catch (Exception ex) {
|
||||||
|
String rawLogFile = getRawLogAttachment(fileToShare);
|
||||||
|
|
||||||
|
byte[] buffer = rawLogFile.getBytes();//specify the size to allow.
|
||||||
|
String base64 = Base64.encodeToString(buffer, Base64.NO_WRAP);
|
||||||
|
|
||||||
|
var logAttachment = new MailAttachmentDTO()
|
||||||
|
.setFileName("raw_log.txt")
|
||||||
|
.setFileb64Content(base64);
|
||||||
|
attachmentDTOList.add(logAttachment);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
rawDao.vacuumDb(new SimpleSQLiteQuery("pragma wal_checkpoint(full)"));
|
rawDao.vacuumDb(new SimpleSQLiteQuery("pragma wal_checkpoint(full)"));
|
||||||
File[] dbFiles = new File[3];
|
rawDao.vacuumDb(new SimpleSQLiteQuery("VACUUM;"));
|
||||||
dbFiles[0] = requireContext().getDatabasePath("integry_wms");
|
File[] dbFiles = new File[3];
|
||||||
dbFiles[1] = requireContext().getDatabasePath("integry_wms-shm");
|
dbFiles[0] = requireContext().getDatabasePath("integry_wms");
|
||||||
dbFiles[2] = requireContext().getDatabasePath("integry_wms-wal");
|
dbFiles[1] = requireContext().getDatabasePath("integry_wms-shm");
|
||||||
|
dbFiles[2] = requireContext().getDatabasePath("integry_wms-wal");
|
||||||
|
|
||||||
for (int i = 0; i < dbFiles.length; i++) {
|
for (int i = 0; i < dbFiles.length; i++) {
|
||||||
byte[] dbFileBytes = new byte[(int) dbFiles[i].length()];
|
byte[] dbFileBytes = new byte[(int) dbFiles[i].length()];
|
||||||
FileInputStream inputStream = new FileInputStream(dbFiles[i]);
|
FileInputStream inputStream = new FileInputStream(dbFiles[i]);
|
||||||
final int read = inputStream.read(dbFileBytes);
|
final int read = inputStream.read(dbFileBytes);
|
||||||
inputStream.close();
|
inputStream.close();
|
||||||
|
|
||||||
var dbAttachment = new MailAttachmentDTO()
|
var dbAttachment = new MailAttachmentDTO()
|
||||||
.setFileName(dbFiles[i].getName())
|
.setFileName(dbFiles[i].getName())
|
||||||
.setFileb64Content(Base64.encodeToString(dbFileBytes, Base64.NO_WRAP));
|
.setFileb64Content(Base64.encodeToString(dbFileBytes, Base64.NO_WRAP));
|
||||||
attachmentDTOList.add(dbAttachment);
|
attachmentDTOList.add(dbAttachment);
|
||||||
}
|
}
|
||||||
|
|
||||||
var mailRequest = new MailRequestDTO()
|
var mailRequest = new MailRequestDTO()
|
||||||
.setTo("developer@integry.it")
|
.setTo("developer@integry.it")
|
||||||
.setMsgText("Questa è una mail contenente il log del WMS")
|
.setMsgText("Questa è una mail contenente il log del WMS")
|
||||||
.setSubject("Internal WMS log")
|
.setSubject("Internal WMS log")
|
||||||
.setAttachments(attachmentDTOList);
|
.setAttachments(attachmentDTOList);
|
||||||
|
|
||||||
|
|
||||||
systemRESTConsumer.sendMailSynchronized(mailRequest);
|
systemRESTConsumer.sendMailSynchronized(mailRequest);
|
||||||
|
|
||||||
this.closeProgress();
|
this.closeProgress();
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
handler.post(() -> {
|
handler.post(() -> {
|
||||||
this.closeProgress();
|
FirebaseCrashlytics.getInstance().recordException(ex, new CustomKeysAndValues.Builder() {{
|
||||||
UtilityExceptions.defaultException(requireContext(), ex);
|
putString("ExportLog", "Error while exporting log");
|
||||||
});
|
}}.build());
|
||||||
}
|
this.closeProgress();
|
||||||
});
|
UtilityExceptions.defaultException(requireContext(), ex);
|
||||||
})
|
});
|
||||||
.show(getParentFragmentManager(), "tag");
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private boolean askConfirmToExportLog() {
|
||||||
|
CountDownLatch countDownLatch = new CountDownLatch(1);
|
||||||
|
AtomicBoolean userConfirmed = new AtomicBoolean(false);
|
||||||
|
|
||||||
|
DialogYesNoView.newInstance("Esportazione log", "Vuoi inviare il log degli eventi al supporto?", result -> {
|
||||||
|
userConfirmed.set(result != DialogConsts.Results.NO && result != DialogConsts.Results.ABORT);
|
||||||
|
countDownLatch.countDown();
|
||||||
|
}).show(getParentFragmentManager(), "tag");
|
||||||
|
|
||||||
|
try {
|
||||||
|
countDownLatch.await();
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return userConfirmed.get();
|
||||||
|
}
|
||||||
|
|
||||||
private void openProgress() {
|
private void openProgress() {
|
||||||
// executorService.execute(() -> {
|
// executorService.execute(() -> {
|
||||||
this.mCurrentProgress.show(requireActivity().getSupportFragmentManager());
|
this.mCurrentProgress.show(requireActivity().getSupportFragmentManager());
|
||||||
@@ -437,4 +473,24 @@ public class MainSettingsFragment extends PreferenceFragmentCompat implements IT
|
|||||||
|
|
||||||
return htmlContent.toString();
|
return htmlContent.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getRawLogAttachment(File logFile) {
|
||||||
|
//Read text from file
|
||||||
|
StringBuilder text = new StringBuilder();
|
||||||
|
|
||||||
|
try {
|
||||||
|
BufferedReader br = new BufferedReader(new FileReader(logFile));
|
||||||
|
String line;
|
||||||
|
|
||||||
|
while ((line = br.readLine()) != null) {
|
||||||
|
text.append(line);
|
||||||
|
text.append('\n');
|
||||||
|
}
|
||||||
|
br.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
//You'll need to add proper error handling here
|
||||||
|
}
|
||||||
|
|
||||||
|
return text.toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -119,6 +119,7 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
|||||||
private boolean mFlagShowCodForn;
|
private boolean mFlagShowCodForn;
|
||||||
private boolean mDivideByGrpMerc;
|
private boolean mDivideByGrpMerc;
|
||||||
private boolean mEnableQuantityReset;
|
private boolean mEnableQuantityReset;
|
||||||
|
private boolean mIsApprovLinee;
|
||||||
private int mBarcodeScannerInstanceID = -1;
|
private int mBarcodeScannerInstanceID = -1;
|
||||||
|
|
||||||
private ArrayList<SitArtOrdDTO> mSitArtOrd;
|
private ArrayList<SitArtOrdDTO> mSitArtOrd;
|
||||||
@@ -739,12 +740,12 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
|||||||
public void addExtraItem() {
|
public void addExtraItem() {
|
||||||
handler.post(() -> {
|
handler.post(() -> {
|
||||||
DialogScanArtView
|
DialogScanArtView
|
||||||
.newInstance(!mEnableFakeGiacenza, (status, mtbAart, ean128Model, mtbColr) -> {
|
.newInstance(!mEnableFakeGiacenza, (status, mtbAart, ean128Model, mtbColt) -> {
|
||||||
if (status == DialogConsts.Results.YES) {
|
if (status == DialogConsts.Results.YES) {
|
||||||
|
|
||||||
executorService.execute(() -> {
|
executorService.execute(() -> {
|
||||||
try {
|
try {
|
||||||
this.mViewmodel.dispatchExtraItem(mtbAart, ean128Model, mtbColr);
|
this.mViewmodel.dispatchExtraItem(mtbAart, ean128Model, mtbColt);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
onError(e);
|
onError(e);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -128,6 +128,7 @@ public class SpedizioneViewModel {
|
|||||||
private boolean mEnableQuantityReset;
|
private boolean mEnableQuantityReset;
|
||||||
private boolean mUseQtaOrd;
|
private boolean mUseQtaOrd;
|
||||||
private boolean mUseColliPedana;
|
private boolean mUseColliPedana;
|
||||||
|
private boolean mIsApprovLinee = false;
|
||||||
private boolean mIsOrdTrasf = false;
|
private boolean mIsOrdTrasf = false;
|
||||||
|
|
||||||
private MtbColt mCurrentMtbColt = null;
|
private MtbColt mCurrentMtbColt = null;
|
||||||
@@ -187,7 +188,19 @@ public class SpedizioneViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void init(String codMdep, boolean enableGiacenza, boolean enableCheckPartitaMag, boolean shouldAskPesoLU, boolean canOverflowOrderQuantity, List<SitArtOrdDTO> pickingList, List<OrdineUscitaInevasoDTO> testateOrdini, GestioneEnum gestioneCol, int segnoCol, Integer defaultCausaleUL, boolean enableQuantityReset, boolean useQtaOrd, boolean useColliPedana) {
|
public void init(String codMdep,
|
||||||
|
boolean enableGiacenza,
|
||||||
|
boolean enableCheckPartitaMag,
|
||||||
|
boolean shouldAskPesoLU,
|
||||||
|
boolean canOverflowOrderQuantity,
|
||||||
|
List<SitArtOrdDTO> pickingList,
|
||||||
|
List<OrdineUscitaInevasoDTO> testateOrdini,
|
||||||
|
GestioneEnum gestioneCol,
|
||||||
|
int segnoCol,
|
||||||
|
Integer defaultCausaleUL,
|
||||||
|
boolean enableQuantityReset,
|
||||||
|
boolean useQtaOrd,
|
||||||
|
boolean useColliPedana) {
|
||||||
this.sendOnLoadingStarted();
|
this.sendOnLoadingStarted();
|
||||||
|
|
||||||
this.mDefaultCodMdep = codMdep;
|
this.mDefaultCodMdep = codMdep;
|
||||||
@@ -221,6 +234,8 @@ public class SpedizioneViewModel {
|
|||||||
this.mDefaultSegnoCol = segnoCol;
|
this.mDefaultSegnoCol = segnoCol;
|
||||||
|
|
||||||
this.initDefaultVars();
|
this.initDefaultVars();
|
||||||
|
|
||||||
|
this.mIsApprovLinee = this.mColliScaricoRESTConsumer instanceof ColliLavorazioneRESTConsumer && mDefaultSegnoCol == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void getPartitaMagList(List<SitArtOrdDTO> sitArtOrdList, RunnableArgs<List<MtbPartitaMag>> onComplete) {
|
private void getPartitaMagList(List<SitArtOrdDTO> sitArtOrdList, RunnableArgs<List<MtbPartitaMag>> onComplete) {
|
||||||
@@ -860,7 +875,7 @@ public class SpedizioneViewModel {
|
|||||||
if (pickingObjectDTO.getMtbColts().stream()
|
if (pickingObjectDTO.getMtbColts().stream()
|
||||||
.anyMatch(x ->
|
.anyMatch(x ->
|
||||||
Objects.equals(x.getNumCollo(), scannedUL.getNumCollo()) &&
|
Objects.equals(x.getNumCollo(), scannedUL.getNumCollo()) &&
|
||||||
x.getDataColloS().equals(scannedUL.getDataColloS()) &&
|
x.getDataColloLD().isEqual(scannedUL.getDataColloLD()) &&
|
||||||
x.getSerCollo().equalsIgnoreCase(scannedUL.getSerCollo()) &&
|
x.getSerCollo().equalsIgnoreCase(scannedUL.getSerCollo()) &&
|
||||||
(scannedUL.getGestioneEnum() == GestioneEnum.ACQUISTO || scannedUL.getGestioneEnum() == GestioneEnum.LAVORAZIONE))) {
|
(scannedUL.getGestioneEnum() == GestioneEnum.ACQUISTO || scannedUL.getGestioneEnum() == GestioneEnum.LAVORAZIONE))) {
|
||||||
|
|
||||||
@@ -874,7 +889,10 @@ public class SpedizioneViewModel {
|
|||||||
|
|
||||||
for (PickingObjectDTO pickingObject : pickingList) {
|
for (PickingObjectDTO pickingObject : pickingList) {
|
||||||
//Da verificare se il controllo per partita deve essere sempre effettuato
|
//Da verificare se il controllo per partita deve essere sempre effettuato
|
||||||
if (UtilityString.equalsIgnoreCase(x.getCodMart(), pickingObject.getSitArtOrdDTO().getCodMart()) && UtilityString.equalsIgnoreCase(x.getCodTagl(), pickingObject.getSitArtOrdDTO().getCodTagl()) && UtilityString.equalsIgnoreCase(x.getCodCol(), pickingObject.getSitArtOrdDTO().getCodCol()) && (!mEnableCheckPartitaMag || UtilityString.equalsIgnoreCase(x.getPartitaMag(), pickingObject.getSitArtOrdDTO().getPartitaMag()) || UtilityString.isNullOrEmpty(pickingObject.getSitArtOrdDTO().getPartitaMag()))) {
|
if (UtilityString.equalsIgnoreCase(x.getCodMart(), pickingObject.getSitArtOrdDTO().getCodMart()) &&
|
||||||
|
UtilityString.equalsIgnoreCase(x.getCodTagl(), pickingObject.getSitArtOrdDTO().getCodTagl()) &&
|
||||||
|
UtilityString.equalsIgnoreCase(x.getCodCol(), pickingObject.getSitArtOrdDTO().getCodCol()) &&
|
||||||
|
(!mEnableCheckPartitaMag || UtilityString.equalsIgnoreCase(x.getPartitaMag(), pickingObject.getSitArtOrdDTO().getPartitaMag()) || UtilityString.isNullOrEmpty(pickingObject.getSitArtOrdDTO().getPartitaMag()))) {
|
||||||
|
|
||||||
if (!matchPickingObject.contains(pickingObject)) {
|
if (!matchPickingObject.contains(pickingObject)) {
|
||||||
matchPickingObject.add(pickingObject);
|
matchPickingObject.add(pickingObject);
|
||||||
@@ -1015,7 +1033,7 @@ public class SpedizioneViewModel {
|
|||||||
if (availableBatchLots.stream().anyMatch(x -> x.getDataScad() == null)) {
|
if (availableBatchLots.stream().anyMatch(x -> x.getDataScad() == null)) {
|
||||||
tmp.addAll(availableBatchLots.stream()
|
tmp.addAll(availableBatchLots.stream()
|
||||||
.filter(x -> x.getDataScad() == null)
|
.filter(x -> x.getDataScad() == null)
|
||||||
.sorted(Comparator.comparing(x -> UtilityString.isNull(x.getPartitaMag(), "")))
|
.sorted(Comparator.comparing(x -> x.getPartitaMag() == null ? "" : x.getPartitaMag()))
|
||||||
.collect(Collectors.toList()));
|
.collect(Collectors.toList()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1224,7 +1242,7 @@ public class SpedizioneViewModel {
|
|||||||
return !stati.isEmpty() ? stati.get(0) : null;
|
return !stati.isEmpty() ? stati.get(0) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dispatchExtraItem(MtbAart mtbAart, Ean128Model ean128Model, MtbColr mtbColrToUse) throws Exception {
|
public void dispatchExtraItem(MtbAart mtbAart, Ean128Model ean128Model, MtbColt refMtbColt) throws Exception {
|
||||||
|
|
||||||
PickingObjectDTO pickingObjectDTO = new PickingObjectDTO().setMtbAart(mtbAart).setTempPickData(PickDataDTO.fromEan128(ean128Model));
|
PickingObjectDTO pickingObjectDTO = new PickingObjectDTO().setMtbAart(mtbAart).setTempPickData(PickDataDTO.fromEan128(ean128Model));
|
||||||
|
|
||||||
@@ -1243,12 +1261,23 @@ public class SpedizioneViewModel {
|
|||||||
String partitaMag = null;
|
String partitaMag = null;
|
||||||
LocalDate dataScad = null;
|
LocalDate dataScad = null;
|
||||||
|
|
||||||
MtbColt refMtbColt = null;
|
// MtbColt refMtbColt = null;
|
||||||
|
|
||||||
if (mtbColrToUse != null) {
|
if (refMtbColt != null && refMtbColt.getMtbColr() != null && !refMtbColt.getMtbColr().isEmpty()) {
|
||||||
refMtbColt = new MtbColt().setDataCollo(mtbColrToUse.getDataColloD()).setSerCollo(mtbColrToUse.getSerCollo()).setNumCollo(mtbColrToUse.getNumCollo()).setGestione(mtbColrToUse.getGestione()).setMtbColr(new ObservableArrayList<>());
|
MtbColr mtbColrToUse = refMtbColt.getMtbColr().get(0);
|
||||||
|
|
||||||
refMtbColt.getMtbColr().add(mtbColrToUse);
|
//Se il collo di riferimento non ha righe, lo creo al volo
|
||||||
|
// refMtbColt = new MtbColt()
|
||||||
|
// .setDataCollo(mtbColrToUse.getDataColloD())
|
||||||
|
// .setSerCollo(mtbColrToUse.getSerCollo())
|
||||||
|
// .setNumCollo(mtbColrToUse.getNumCollo())
|
||||||
|
// .setGestione(mtbColrToUse.getGestione())
|
||||||
|
//// .setCodMdep(mtbColrToUse.getCodMdepIn())
|
||||||
|
//// .setPosizione(mtbColrToUse.getPosizioneIn())
|
||||||
|
//// .setBarcodeUl(mtbColrToUse.getBarcodeUlIn())
|
||||||
|
// .setMtbColr(new ObservableArrayList<>());
|
||||||
|
//
|
||||||
|
// refMtbColt.getMtbColr().add(mtbColrToUse);
|
||||||
|
|
||||||
pickingObjectDTO.setMtbAart(mtbColrToUse.getMtbAart()).setTempPickData(new PickDataDTO().setSourceMtbColt(refMtbColt));
|
pickingObjectDTO.setMtbAart(mtbColrToUse.getMtbAart()).setTempPickData(new PickDataDTO().setSourceMtbColt(refMtbColt));
|
||||||
|
|
||||||
@@ -1456,7 +1485,7 @@ public class SpedizioneViewModel {
|
|||||||
private MtbColt loadRifULFromMtbColr(MtbColr mtbColr) throws Exception {
|
private MtbColt loadRifULFromMtbColr(MtbColr mtbColr) throws Exception {
|
||||||
//Se ho dei riferimenti ad una UL devo leggere la QTA ancora disponibile sulla Ul
|
//Se ho dei riferimenti ad una UL devo leggere la QTA ancora disponibile sulla Ul
|
||||||
if (mtbColr != null && !UtilityString.isNullOrEmpty(mtbColr.getGestioneRif()) && !UtilityString.isNullOrEmpty(mtbColr.getSerColloRif()) && !UtilityString.isNullOrEmpty(mtbColr.getDataColloRifS()) && mtbColr.getNumColloRif() != null) {
|
if (mtbColr != null && !UtilityString.isNullOrEmpty(mtbColr.getGestioneRif()) && !UtilityString.isNullOrEmpty(mtbColr.getSerColloRif()) && !UtilityString.isNullOrEmpty(mtbColr.getDataColloRifS()) && mtbColr.getNumColloRif() != null) {
|
||||||
return mColliMagazzinoRESTConsumer.getByChiaveColloSynchronized(mtbColr.getGestioneRifEnum(), mtbColr.getNumColloRif(), mtbColr.getDataColloRifS(), mtbColr.getSerColloRif(), true, false);
|
return mColliMagazzinoRESTConsumer.getByChiaveColloSynchronized(mtbColr.getGestioneRifEnum(), mtbColr.getNumColloRif(), mtbColr.getDataColloRifLD(), mtbColr.getSerColloRif(), true, false);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -1521,9 +1550,6 @@ public class SpedizioneViewModel {
|
|||||||
.setMtbAart(null);
|
.setMtbAart(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
var clonedTargetMtbColt = (MtbColt) mCurrentMtbColt.clone();
|
|
||||||
clonedTargetMtbColt.setMtbColr(null);
|
|
||||||
|
|
||||||
var insertUDSRowRequestDto = new InsertUDSRowRequestDTO()
|
var insertUDSRowRequestDto = new InsertUDSRowRequestDTO()
|
||||||
.setSourceMtbColr(clonedSourceMtbColr)
|
.setSourceMtbColr(clonedSourceMtbColr)
|
||||||
.setCodMart(pickingObjectDTO.getMtbAart().getCodMart())
|
.setCodMart(pickingObjectDTO.getMtbAart().getCodMart())
|
||||||
@@ -1531,7 +1557,7 @@ public class SpedizioneViewModel {
|
|||||||
.setQtaCnf(qtaCnf)
|
.setQtaCnf(qtaCnf)
|
||||||
.setNumCnf(numCnf)
|
.setNumCnf(numCnf)
|
||||||
.setPartitaMag(partitaMag)
|
.setPartitaMag(partitaMag)
|
||||||
.setTargetMtbColt(clonedTargetMtbColt);
|
.setTargetMtbColt(mCurrentMtbColt.clone(false));
|
||||||
|
|
||||||
if (dataScad != null)
|
if (dataScad != null)
|
||||||
insertUDSRowRequestDto
|
insertUDSRowRequestDto
|
||||||
@@ -1546,6 +1572,7 @@ public class SpedizioneViewModel {
|
|||||||
createdMtbColr = this.mColliScaricoRESTConsumer.insertUDSRowSynchronized(insertUDSRowRequestDto);
|
createdMtbColr = this.mColliScaricoRESTConsumer.insertUDSRowSynchronized(insertUDSRowRequestDto);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
this.sendError(ex);
|
this.sendError(ex);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
pickingObjectDTO.getWithdrawMtbColrs().add(createdMtbColr);
|
pickingObjectDTO.getWithdrawMtbColrs().add(createdMtbColr);
|
||||||
@@ -1572,7 +1599,7 @@ public class SpedizioneViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
refMtbColr.setNumCollo(refMtbColt.getNumCollo())
|
refMtbColr.setNumCollo(refMtbColt.getNumCollo())
|
||||||
.setDataCollo(refMtbColt.getDataColloS())
|
.setDataCollo(refMtbColt.getDataColloLD())
|
||||||
.setSerCollo(refMtbColt.getSerCollo())
|
.setSerCollo(refMtbColt.getSerCollo())
|
||||||
.setGestione(refMtbColt.getGestione());
|
.setGestione(refMtbColt.getGestione());
|
||||||
}
|
}
|
||||||
@@ -1734,9 +1761,11 @@ public class SpedizioneViewModel {
|
|||||||
|
|
||||||
var filledMtbColts = this.mColliMagazzinoRESTConsumer.fillMtbAartsOfMtbColtsSynchronized(generatedMtbColts);
|
var filledMtbColts = this.mColliMagazzinoRESTConsumer.fillMtbAartsOfMtbColtsSynchronized(generatedMtbColts);
|
||||||
|
|
||||||
var positionedMtbColts = this.askPositionChange(filledMtbColts);
|
|
||||||
|
|
||||||
this.askPrint((shouldPrint && SettingsManager.iDB().isFlagPrintEtichetteOnLUClose()), positionedMtbColts);
|
List<MtbColt> positionedMtbColts = this.askPositionChange(filledMtbColts);
|
||||||
|
|
||||||
|
if (!mIsApprovLinee)
|
||||||
|
this.askPrint((shouldPrint && SettingsManager.iDB().isFlagPrintEtichetteOnLUClose()), positionedMtbColts);
|
||||||
|
|
||||||
postCloseOperations(positionedMtbColts);
|
postCloseOperations(positionedMtbColts);
|
||||||
|
|
||||||
@@ -1761,7 +1790,7 @@ public class SpedizioneViewModel {
|
|||||||
//.setPrintSSCC(shouldPrint)
|
//.setPrintSSCC(shouldPrint)
|
||||||
.setOrderCodMdep(codMdep);
|
.setOrderCodMdep(codMdep);
|
||||||
|
|
||||||
if (this.mColliScaricoRESTConsumer instanceof ColliLavorazioneRESTConsumer && !mIsOrdTrasf) {
|
if (this.mColliScaricoRESTConsumer instanceof ColliLavorazioneRESTConsumer && !mIsOrdTrasf && !mIsApprovLinee) {
|
||||||
closeUDSRequestDto.setCriterioDistribuzione(CriterioDistribuzioneEnum.FASE);
|
closeUDSRequestDto.setCriterioDistribuzione(CriterioDistribuzioneEnum.FASE);
|
||||||
|
|
||||||
var codAnag = mTestateOrdini.stream()
|
var codAnag = mTestateOrdini.stream()
|
||||||
@@ -2012,7 +2041,7 @@ public class SpedizioneViewModel {
|
|||||||
cloneMtbColr.setRiga(null)
|
cloneMtbColr.setRiga(null)
|
||||||
.setNumCollo(null)
|
.setNumCollo(null)
|
||||||
.setGestione((String) null)
|
.setGestione((String) null)
|
||||||
.setDataCollo((String) null)
|
.setDataCollo((LocalDate) null)
|
||||||
.setSerCollo(null)
|
.setSerCollo(null)
|
||||||
.setCausale(MtbColr.Causale.VERSAMENTO);
|
.setCausale(MtbColr.Causale.VERSAMENTO);
|
||||||
|
|
||||||
@@ -2071,7 +2100,7 @@ public class SpedizioneViewModel {
|
|||||||
Optional<MtbColr> optionalMtbColrReference = pickingObjectDTO.getMtbColts().stream()
|
Optional<MtbColr> optionalMtbColrReference = pickingObjectDTO.getMtbColts().stream()
|
||||||
.filter(y -> withdrawMtbColr.getRefMtbColr() != null &&
|
.filter(y -> withdrawMtbColr.getRefMtbColr() != null &&
|
||||||
withdrawMtbColr.getRefMtbColr().getNumCollo().equals(y.getNumCollo()) &&
|
withdrawMtbColr.getRefMtbColr().getNumCollo().equals(y.getNumCollo()) &&
|
||||||
withdrawMtbColr.getRefMtbColr().getDataColloD().equals(y.getDataColloD()) &&
|
withdrawMtbColr.getRefMtbColr().getDataColloLD().isEqual(y.getDataColloLD()) &&
|
||||||
withdrawMtbColr.getRefMtbColr().getSerCollo().equals(y.getSerCollo()) &&
|
withdrawMtbColr.getRefMtbColr().getSerCollo().equals(y.getSerCollo()) &&
|
||||||
withdrawMtbColr.getRefMtbColr().getGestioneEnum().equals(y.getGestioneEnum()) &&
|
withdrawMtbColr.getRefMtbColr().getGestioneEnum().equals(y.getGestioneEnum()) &&
|
||||||
UtilityString.equalsIgnoreCase(withdrawMtbColr.getRefMtbColr().getCodMart(), y.getMtbColr() != null && !y.getMtbColr().isEmpty() ? y.getMtbColr().get(0).getCodMart() : null) &&
|
UtilityString.equalsIgnoreCase(withdrawMtbColr.getRefMtbColr().getCodMart(), y.getMtbColr() != null && !y.getMtbColr().isEmpty() ? y.getMtbColr().get(0).getCodMart() : null) &&
|
||||||
@@ -2115,18 +2144,18 @@ public class SpedizioneViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void closeOrder() {
|
public void closeOrder() {
|
||||||
this.sendOnLoadingStarted();
|
|
||||||
|
|
||||||
if (SettingsManager.iDB().isFlagPrintEtichetteOnOrderClose() || SettingsManager.iDB().isFlagPrintPackingListOnOrderClose()) {
|
if (SettingsManager.iDB().isFlagPrintEtichetteOnOrderClose() || SettingsManager.iDB().isFlagPrintPackingListOnOrderClose()) {
|
||||||
var printRequestResult = this.sendOnCloseOrderPrintRequest();
|
var printRequestResult = this.sendOnCloseOrderPrintRequest();
|
||||||
|
|
||||||
|
this.sendOnLoadingStarted();
|
||||||
this.onCloseOrderPrintRequested(printRequestResult);
|
this.onCloseOrderPrintRequested(printRequestResult);
|
||||||
|
this.sendOnLoadingEnded();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.mIsOrdTrasf && !UtilityString.isNullOrEmpty(SettingsManager.iDB().getCodDtipOrdTrasfV())) {
|
if (this.mIsOrdTrasf && !UtilityString.isNullOrEmpty(SettingsManager.iDB().getCodDtipOrdTrasfV())) {
|
||||||
this.sendCreateDocsRequest();
|
this.sendCreateDocsRequest();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.sendOnOrderClosed();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onCloseOrderPrintRequested(PrintOrderCloseDTO dto) {
|
private void onCloseOrderPrintRequested(PrintOrderCloseDTO dto) {
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import android.content.Context;
|
|||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.graphics.drawable.ColorDrawable;
|
import android.graphics.drawable.ColorDrawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.Handler;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
@@ -15,19 +16,20 @@ import androidx.databinding.DataBindingUtil;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.time.LocalDate;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.MainApplication;
|
import it.integry.integrywmsnative.MainApplication;
|
||||||
import it.integry.integrywmsnative.R;
|
import it.integry.integrywmsnative.R;
|
||||||
|
import it.integry.integrywmsnative.core.model.JtbFasi;
|
||||||
import it.integry.integrywmsnative.core.rest.model.SitArtOrdDTO;
|
import it.integry.integrywmsnative.core.rest.model.SitArtOrdDTO;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||||
import it.integry.integrywmsnative.databinding.DialogRowInfoProdFabbisognoLineeProdBinding;
|
import it.integry.integrywmsnative.databinding.DialogRowInfoProdFabbisognoLineeProdBinding;
|
||||||
import it.integry.integrywmsnative.gest.prod_fabbisogno_linee_prod.dto.ProdFabbisognoLineeProdDTO;
|
import it.integry.integrywmsnative.gest.prod_fabbisogno_linee_prod.dto.ProdFabbisognoLineeProdDTO;
|
||||||
import it.integry.integrywmsnative.gest.spedizione.ui.SpedizioneListModel;
|
|
||||||
import it.integry.integrywmsnative.gest.spedizione.dialogs.row_info.BaseDialogRowInfoView;
|
import it.integry.integrywmsnative.gest.spedizione.dialogs.row_info.BaseDialogRowInfoView;
|
||||||
|
import it.integry.integrywmsnative.gest.spedizione.ui.SpedizioneListModel;
|
||||||
|
|
||||||
public class DialogRowInfoProdFabbisognoLineeProdView extends BaseDialogRowInfoView implements DialogRowInfoProdFabbisognoLineeProdViewModel.Listener {
|
public class DialogRowInfoProdFabbisognoLineeProdView extends BaseDialogRowInfoView implements DialogRowInfoProdFabbisognoLineeProdViewModel.Listener {
|
||||||
|
|
||||||
@@ -35,6 +37,9 @@ public class DialogRowInfoProdFabbisognoLineeProdView extends BaseDialogRowInfoV
|
|||||||
@Inject
|
@Inject
|
||||||
DialogRowInfoProdFabbisognoLineeProdViewModel mViewModel;
|
DialogRowInfoProdFabbisognoLineeProdViewModel mViewModel;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
Handler handler;
|
||||||
|
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
private DialogRowInfoProdFabbisognoLineeProdBinding mBindings;
|
private DialogRowInfoProdFabbisognoLineeProdBinding mBindings;
|
||||||
|
|
||||||
@@ -70,27 +75,45 @@ public class DialogRowInfoProdFabbisognoLineeProdView extends BaseDialogRowInfoV
|
|||||||
|
|
||||||
SitArtOrdDTO sitArtOrdDTO = getSpedizioneListModel().getOriginalModel().getSitArtOrdDTO();
|
SitArtOrdDTO sitArtOrdDTO = getSpedizioneListModel().getOriginalModel().getSitArtOrdDTO();
|
||||||
|
|
||||||
this.mViewModel.getFabbisognoList().removeObservers(this);
|
this.mViewModel.getLineeProdList().removeObservers(this);
|
||||||
this.mViewModel.getFabbisognoList().observe(this, this::onFabbisognoListLoaded);
|
this.mViewModel.getLineeProdList().observe(this, this::onLineeProdLoaded);
|
||||||
|
|
||||||
|
this.onLoadingStarted();
|
||||||
|
executorService.execute(() -> {
|
||||||
|
try {
|
||||||
|
this.mViewModel.init(
|
||||||
|
sitArtOrdDTO.getCodMart(),
|
||||||
|
sitArtOrdDTO.getCodMdep(),
|
||||||
|
(String) sitArtOrdDTO.getExtraInfo().get("ordini"),
|
||||||
|
(LocalDate) sitArtOrdDTO.getExtraInfo().get("dataInizio"),
|
||||||
|
(LocalDate) sitArtOrdDTO.getExtraInfo().get("dataFine"));
|
||||||
|
|
||||||
|
this.onLoadingEnded();
|
||||||
|
} catch (Exception e) {
|
||||||
|
this.onError(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
this.mViewModel.init(
|
|
||||||
sitArtOrdDTO.getCodMart(),
|
|
||||||
sitArtOrdDTO.getCodMdep(),
|
|
||||||
(String) sitArtOrdDTO.getExtraInfo().get("ordini"),
|
|
||||||
(Date) sitArtOrdDTO.getExtraInfo().get("dataInizio"),
|
|
||||||
(Date) sitArtOrdDTO.getExtraInfo().get("dataFine"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onFabbisognoListLoaded(List<ProdFabbisognoLineeProdDTO> fabbisognoList) {
|
private void onLineeProdLoaded(List<JtbFasi> fabbisognoList) {
|
||||||
for (int i = 0; i < fabbisognoList.size(); i++) {
|
for (int i = 0; i < fabbisognoList.size(); i++) {
|
||||||
String currentKey = fabbisognoList.get(i).getCodJfas();
|
String currentKey = fabbisognoList.get(i).getCodJfas();
|
||||||
|
|
||||||
ViewGroup.LayoutParams lparams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
ViewGroup.LayoutParams lparams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||||
TextView tv = new TextView(this.mContext);
|
|
||||||
tv.setLayoutParams(lparams);
|
|
||||||
tv.setText(currentKey);
|
|
||||||
|
|
||||||
this.mBindings.contentView.addView(tv);
|
View inflatedLayout= getLayoutInflater().inflate(R.layout.dialog_row_info_prod_fabbisogno_linee_prod__linea_prod__list_item, null, false);
|
||||||
|
|
||||||
|
inflatedLayout.setLayoutParams(lparams);
|
||||||
|
inflatedLayout.setTag(currentKey);
|
||||||
|
|
||||||
|
TextView tvDescription = inflatedLayout.findViewById(R.id.description);
|
||||||
|
tvDescription.setText(fabbisognoList.get(i).getDescrizione());
|
||||||
|
|
||||||
|
TextView tvCode = inflatedLayout.findViewById(R.id.code);
|
||||||
|
tvCode.setText(fabbisognoList.get(i).getCodJfas());
|
||||||
|
|
||||||
|
this.mBindings.contentView.addView(inflatedLayout);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,13 +125,17 @@ public class DialogRowInfoProdFabbisognoLineeProdView extends BaseDialogRowInfoV
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLoadingStarted() {
|
public void onLoadingStarted() {
|
||||||
this.mBindings.loadingView.setVisibility(View.VISIBLE);
|
handler.post(() -> {
|
||||||
this.mBindings.contentView.setVisibility(View.GONE);
|
this.mBindings.loadingView.setVisibility(View.VISIBLE);
|
||||||
|
this.mBindings.contentView.setVisibility(View.GONE);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLoadingEnded() {
|
public void onLoadingEnded() {
|
||||||
this.mBindings.loadingView.setVisibility(View.GONE);
|
handler.post(() -> {
|
||||||
this.mBindings.contentView.setVisibility(View.VISIBLE);
|
this.mBindings.loadingView.setVisibility(View.GONE);
|
||||||
|
this.mBindings.contentView.setVisibility(View.VISIBLE);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,18 +2,18 @@ package it.integry.integrywmsnative.gest.spedizione.dialogs.row_info.prod_fabbis
|
|||||||
|
|
||||||
import androidx.lifecycle.MutableLiveData;
|
import androidx.lifecycle.MutableLiveData;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.time.LocalDate;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
|
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
|
||||||
import it.integry.integrywmsnative.gest.prod_fabbisogno_linee_prod.dto.ProdFabbisognoLineeProdDTO;
|
import it.integry.integrywmsnative.core.model.JtbFasi;
|
||||||
import it.integry.integrywmsnative.gest.prod_fabbisogno_linee_prod.rest.ProdFabbisognoLineeProdRESTConsumer;
|
import it.integry.integrywmsnative.gest.prod_fabbisogno_linee_prod.rest.ProdFabbisognoLineeProdRESTConsumer;
|
||||||
|
|
||||||
public class DialogRowInfoProdFabbisognoLineeProdViewModel {
|
public class DialogRowInfoProdFabbisognoLineeProdViewModel {
|
||||||
|
|
||||||
private final ProdFabbisognoLineeProdRESTConsumer mProdFabbisognoLineeProdRESTConsumer;
|
private final ProdFabbisognoLineeProdRESTConsumer mProdFabbisognoLineeProdRESTConsumer;
|
||||||
|
|
||||||
private final MutableLiveData<List<ProdFabbisognoLineeProdDTO>> mFabbisognoList = new MutableLiveData<>();
|
private final MutableLiveData<List<JtbFasi>> mLineeProdList = new MutableLiveData<>();
|
||||||
|
|
||||||
private Listener mListener;
|
private Listener mListener;
|
||||||
|
|
||||||
@@ -23,18 +23,15 @@ public class DialogRowInfoProdFabbisognoLineeProdViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void init(String codMart, String codMdep, String ordni, Date startDate, Date endDate) {
|
public void init(String codMart, String codMdep, String ordni, LocalDate startDate, LocalDate endDate) throws Exception {
|
||||||
this.sendOnLoadingStarted();
|
|
||||||
|
|
||||||
this.mProdFabbisognoLineeProdRESTConsumer.loadFabbisogno(codMart, ordni, startDate, endDate, codMdep, fabbisognoList -> {
|
var lineeProd = this.mProdFabbisognoLineeProdRESTConsumer.loadCodJfasOfFabbisognoSynchronized(codMart, ordni, startDate, endDate, codMdep);
|
||||||
this.mFabbisognoList.postValue(fabbisognoList);
|
this.mLineeProdList.postValue(lineeProd);
|
||||||
this.sendOnLoadingEnded();
|
|
||||||
}, this::sendError);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public MutableLiveData<List<ProdFabbisognoLineeProdDTO>> getFabbisognoList() {
|
public MutableLiveData<List<JtbFasi>> getLineeProdList() {
|
||||||
return mFabbisognoList;
|
return mLineeProdList;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendOnLoadingStarted() {
|
private void sendOnLoadingStarted() {
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ import it.integry.integrywmsnative.core.model.MtbColr;
|
|||||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityNumber;
|
import it.integry.integrywmsnative.core.utility.UtilityNumber;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityResources;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||||
import it.integry.integrywmsnative.databinding.SpedizioneMainListGroupHeaderBinding;
|
import it.integry.integrywmsnative.databinding.SpedizioneMainListGroupHeaderBinding;
|
||||||
import it.integry.integrywmsnative.databinding.SpedizioneMainListGroupItemBinding;
|
import it.integry.integrywmsnative.databinding.SpedizioneMainListGroupItemBinding;
|
||||||
@@ -123,9 +124,9 @@ public class SpedizioneListAdapter extends SectionedRecyclerViewAdapter<Spedizio
|
|||||||
} else if (pickingObjectDTO.getQtaEvasa().floatValue() > 0) {
|
} else if (pickingObjectDTO.getQtaEvasa().floatValue() > 0) {
|
||||||
holder.mBinding.getRoot().setBackgroundColor(mContext.getResources().getColor(R.color.orange_600_with_alpha));
|
holder.mBinding.getRoot().setBackgroundColor(mContext.getResources().getColor(R.color.orange_600_with_alpha));
|
||||||
} else if (position % 2 == 1) {
|
} else if (position % 2 == 1) {
|
||||||
holder.mBinding.getRoot().setBackgroundColor(Color.WHITE);
|
holder.mBinding.getRoot().setBackgroundColor(0);
|
||||||
} else {
|
} else {
|
||||||
holder.mBinding.getRoot().setBackgroundColor(mContext.getResources().getColor(R.color.letturaFacilitataBG));
|
holder.mBinding.getRoot().setBackgroundColor(UtilityResources.getColorResourceFromAttr(mContext, R.attr.colorLetturaFacilitataSurface));
|
||||||
}
|
}
|
||||||
|
|
||||||
holder.mBinding.deactivatedOverBg.setVisibility(!pickingObjectDTO.isActive() ? View.VISIBLE : View.GONE);
|
holder.mBinding.deactivatedOverBg.setVisibility(!pickingObjectDTO.isActive() ? View.VISIBLE : View.GONE);
|
||||||
@@ -135,8 +136,10 @@ public class SpedizioneListAdapter extends SectionedRecyclerViewAdapter<Spedizio
|
|||||||
holder.mBinding.qtaEvasa.setTextColor(ResourcesCompat.getColor(mContext.getResources(), !pickingObjectDTO.isActive() ? R.color.gray_600 : R.color.green_700, null));
|
holder.mBinding.qtaEvasa.setTextColor(ResourcesCompat.getColor(mContext.getResources(), !pickingObjectDTO.isActive() ? R.color.gray_600 : R.color.green_700, null));
|
||||||
|
|
||||||
holder.mBinding.descrizione.setText(pickingObjectDTO.getDescrizione());
|
holder.mBinding.descrizione.setText(pickingObjectDTO.getDescrizione());
|
||||||
holder.mBinding.descrizione.setTextColor(pickingObjectDTO.isDescrizionePresente() ? Color.BLACK : Color.GRAY);
|
if(pickingObjectDTO.isDescrizionePresente())
|
||||||
|
holder.mBinding.descrizione.setTextColor(UtilityResources.getColorResourceFromAttr(mContext, android.R.attr.colorForeground));
|
||||||
|
else
|
||||||
|
holder.mBinding.descrizione.setTextColor(Color.GRAY);
|
||||||
|
|
||||||
holder.mBinding.badge1.setText(pickingObjectDTO.getBadge1());
|
holder.mBinding.badge1.setText(pickingObjectDTO.getBadge1());
|
||||||
holder.mBinding.badge2.setText(pickingObjectDTO.getBadge2());
|
holder.mBinding.badge2.setText(pickingObjectDTO.getBadge2());
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ public class BottomSheetFragmentLUContentListAdapter extends RecyclerView.Adapte
|
|||||||
holder.mViewDataBinding.executePendingBindings();
|
holder.mViewDataBinding.executePendingBindings();
|
||||||
|
|
||||||
if (position % 2 == 1)
|
if (position % 2 == 1)
|
||||||
holder.mViewDataBinding.getRoot().setBackgroundColor(mContext.getResources().getColor(R.color.letturaFacilitataBG));
|
holder.mViewDataBinding.getRoot().setBackgroundColor(mContext.getResources().getColor(R.color.letturaFacilitataBGLight));
|
||||||
|
|
||||||
holder.mViewDataBinding.getRoot().setOnClickListener(new OnSingleClickListener() {
|
holder.mViewDataBinding.getRoot().setOnClickListener(new OnSingleClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public class BottomSheetFragmentLUContentViewModel {
|
|||||||
if (collo == null) return;
|
if (collo == null) return;
|
||||||
|
|
||||||
ObservableMtbTcol tipoPedana = collo.getMtbTCol();
|
ObservableMtbTcol tipoPedana = collo.getMtbTCol();
|
||||||
BigDecimal taraPedana = tipoPedana != null ? tipoPedana.getTaraKg() : BigDecimal.ZERO;
|
BigDecimal taraPedana = tipoPedana != null && tipoPedana.getTaraKg() != null ? tipoPedana.getTaraKg() : BigDecimal.ZERO;
|
||||||
BigDecimal pesoNetto = BigDecimal.ZERO;
|
BigDecimal pesoNetto = BigDecimal.ZERO;
|
||||||
|
|
||||||
for (MtbColr mtbColr : collo.getMtbColr()) {
|
for (MtbColr mtbColr : collo.getMtbColr()) {
|
||||||
|
|||||||
@@ -1,11 +1,17 @@
|
|||||||
package it.integry.integrywmsnative.view.dialogs.ask_cliente.dto;
|
package it.integry.integrywmsnative.view.dialogs.ask_cliente.dto;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class DialogAskClienteClienteDTO {
|
public class DialogAskClienteClienteDTO {
|
||||||
|
|
||||||
|
@SerializedName("codAnag")
|
||||||
private String codAnag;
|
private String codAnag;
|
||||||
|
|
||||||
|
@SerializedName("ragSoc")
|
||||||
private String ragSoc;
|
private String ragSoc;
|
||||||
|
@SerializedName("codJcoms")
|
||||||
private ArrayList<String> codJcoms = new ArrayList<>();
|
private ArrayList<String> codJcoms = new ArrayList<>();
|
||||||
|
|
||||||
public String getCodAnag() {
|
public String getCodAnag() {
|
||||||
|
|||||||
@@ -1,23 +1,34 @@
|
|||||||
package it.integry.integrywmsnative.view.dialogs.ask_cliente.dto;
|
package it.integry.integrywmsnative.view.dialogs.ask_cliente.dto;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.model.VtbDest;
|
import it.integry.integrywmsnative.core.model.VtbDest;
|
||||||
|
|
||||||
public class DialogAskClienteDestinatarioDTO {
|
public class DialogAskClienteDestinatarioDTO {
|
||||||
|
|
||||||
|
|
||||||
|
@SerializedName("codAnag")
|
||||||
private String codAnag;
|
private String codAnag;
|
||||||
|
|
||||||
|
@SerializedName("codVdes")
|
||||||
private String codVdes;
|
private String codVdes;
|
||||||
|
|
||||||
|
@SerializedName("destinatario")
|
||||||
private String destinatario;
|
private String destinatario;
|
||||||
|
|
||||||
|
@SerializedName("indirizzo")
|
||||||
private String indirizzo;
|
private String indirizzo;
|
||||||
|
|
||||||
|
@SerializedName("cap")
|
||||||
private String cap;
|
private String cap;
|
||||||
|
|
||||||
|
@SerializedName("citta")
|
||||||
private String citta;
|
private String citta;
|
||||||
|
|
||||||
|
@SerializedName("prov")
|
||||||
private String prov;
|
private String prov;
|
||||||
|
|
||||||
|
@SerializedName("nazione")
|
||||||
private String nazione;
|
private String nazione;
|
||||||
|
|
||||||
public String getCodAnag() {
|
public String getCodAnag() {
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ public class DialogSimpleMessageView extends BaseDialogFragment {
|
|||||||
}
|
}
|
||||||
case WARNING -> {
|
case WARNING -> {
|
||||||
colorBackgroundTitle = ContextCompat.getColor(requireContext(), R.color.yellow_600);
|
colorBackgroundTitle = ContextCompat.getColor(requireContext(), R.color.yellow_600);
|
||||||
yield ResourcesCompat.getDrawable(requireContext().getResources(), R.drawable.ic_warning_white_24dp, null);
|
yield ResourcesCompat.getDrawable(requireContext().getResources(), R.drawable.ic_baseline_warning_24, null);
|
||||||
}
|
}
|
||||||
case ERROR -> {
|
case ERROR -> {
|
||||||
colorBackgroundTitle = ContextCompat.getColor(requireContext(), R.color.red_300);
|
colorBackgroundTitle = ContextCompat.getColor(requireContext(), R.color.red_300);
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package it.integry.integrywmsnative.view.dialogs.device_end_of_life;
|
||||||
|
|
||||||
|
import dagger.Subcomponent;
|
||||||
|
|
||||||
|
@Subcomponent
|
||||||
|
public interface DialogDeviceEndOfLifeComponent {
|
||||||
|
|
||||||
|
@Subcomponent.Factory
|
||||||
|
interface Factory {
|
||||||
|
DialogDeviceEndOfLifeComponent create();
|
||||||
|
}
|
||||||
|
|
||||||
|
void inject(DialogDeviceEndOfLifeView dialogDeviceEndOfLifeView);
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package it.integry.integrywmsnative.view.dialogs.device_end_of_life;
|
||||||
|
|
||||||
|
import dagger.Module;
|
||||||
|
import dagger.Provides;
|
||||||
|
|
||||||
|
@Module(subcomponents = DialogDeviceEndOfLifeComponent.class)
|
||||||
|
public class DialogDeviceEndOfLifeModule {
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
DialogDeviceEndOfLifeViewModel providesDialogDeviceEndOfLifeViewModel() {
|
||||||
|
return new DialogDeviceEndOfLifeViewModel();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
package it.integry.integrywmsnative.view.dialogs.device_end_of_life;
|
||||||
|
|
||||||
|
import android.app.Dialog;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.MainApplication;
|
||||||
|
import it.integry.integrywmsnative.R;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
|
||||||
|
import it.integry.integrywmsnative.databinding.DialogDeviceEndOfLifeBinding;
|
||||||
|
|
||||||
|
public class DialogDeviceEndOfLifeView extends BaseDialogFragment {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
DialogDeviceEndOfLifeViewModel mViewModel;
|
||||||
|
|
||||||
|
private DialogDeviceEndOfLifeBinding mBindings;
|
||||||
|
private Context mContext;
|
||||||
|
|
||||||
|
private final Runnable onComplete;
|
||||||
|
|
||||||
|
//Pass here all external parameters
|
||||||
|
public static DialogDeviceEndOfLifeView newInstance(Runnable onComplete) {
|
||||||
|
return new DialogDeviceEndOfLifeView(onComplete);
|
||||||
|
}
|
||||||
|
|
||||||
|
private DialogDeviceEndOfLifeView(Runnable onComplete) {
|
||||||
|
super();
|
||||||
|
|
||||||
|
this.onComplete = onComplete;
|
||||||
|
|
||||||
|
MainApplication.appComponent
|
||||||
|
.dialogDeviceEndOfLifeComponent()
|
||||||
|
.create()
|
||||||
|
.inject(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
|
||||||
|
this.mContext = requireContext();
|
||||||
|
|
||||||
|
mBindings = DialogDeviceEndOfLifeBinding.inflate(LayoutInflater.from(this.mContext), null, false);
|
||||||
|
mBindings.setLifecycleOwner(this);
|
||||||
|
|
||||||
|
|
||||||
|
setCancelable(false);
|
||||||
|
|
||||||
|
var alertDialog = new MaterialAlertDialogBuilder(this.mContext)
|
||||||
|
.setView(mBindings.getRoot())
|
||||||
|
.setCancelable(isCancelable())
|
||||||
|
.setPositiveButton(R.string.i_understand_action, (dialog, which) -> {
|
||||||
|
if (onComplete != null) onComplete.run();
|
||||||
|
dismiss();
|
||||||
|
})
|
||||||
|
.create();
|
||||||
|
|
||||||
|
alertDialog.setCanceledOnTouchOutside(isCancelable());
|
||||||
|
alertDialog.setOnShowListener(this);
|
||||||
|
return alertDialog;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dismiss() {
|
||||||
|
if (getDialog() != null) getDialog().dismiss();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
package it.integry.integrywmsnative.view.dialogs.device_end_of_life;
|
||||||
|
|
||||||
|
public class DialogDeviceEndOfLifeViewModel {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -214,6 +214,8 @@ public class DialogInputQuantityV2View extends BaseDialogFragment implements Dia
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return mBindings.getRoot();
|
return mBindings.getRoot();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,15 +4,19 @@ import android.app.Dialog;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.Handler;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.databinding.ObservableArrayList;
|
||||||
|
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||||
|
|
||||||
|
import org.javatuples.Quartet;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
@@ -27,6 +31,7 @@ import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
|||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgssss;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgssss;
|
||||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||||
|
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||||
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
||||||
import it.integry.integrywmsnative.core.rest.model.Ean128Model;
|
import it.integry.integrywmsnative.core.rest.model.Ean128Model;
|
||||||
import it.integry.integrywmsnative.databinding.DialogScanArtBinding;
|
import it.integry.integrywmsnative.databinding.DialogScanArtBinding;
|
||||||
@@ -38,6 +43,9 @@ public class DialogScanArtView extends BaseDialogFragment implements DialogScanA
|
|||||||
@Inject
|
@Inject
|
||||||
DialogScanArtViewModel mViewModel;
|
DialogScanArtViewModel mViewModel;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
Handler handler;
|
||||||
|
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
|
|
||||||
private final boolean mForceOnlyUL;
|
private final boolean mForceOnlyUL;
|
||||||
@@ -46,15 +54,15 @@ public class DialogScanArtView extends BaseDialogFragment implements DialogScanA
|
|||||||
|
|
||||||
private int mBarcodeScannerInstanceID;
|
private int mBarcodeScannerInstanceID;
|
||||||
|
|
||||||
private RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, MtbColr> onPickingCompleted = null;
|
private RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, MtbColt> onPickingCompleted = null;
|
||||||
private RunnableArgs<MtbDepoPosizione> onMagazzinoAutomaticoPickingRequest = null;
|
private RunnableArgs<MtbDepoPosizione> onMagazzinoAutomaticoPickingRequest = null;
|
||||||
|
|
||||||
|
|
||||||
public static DialogScanArtView newInstance(boolean forceOnlyUL, @NotNull RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, MtbColr> onPickingCompleted, RunnableArgs<MtbDepoPosizione> onMagazzinoAutomaticoPickingRequest) {
|
public static DialogScanArtView newInstance(boolean forceOnlyUL, @NotNull RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, MtbColt> onPickingCompleted, RunnableArgs<MtbDepoPosizione> onMagazzinoAutomaticoPickingRequest) {
|
||||||
return new DialogScanArtView(forceOnlyUL, onPickingCompleted, onMagazzinoAutomaticoPickingRequest);
|
return new DialogScanArtView(forceOnlyUL, onPickingCompleted, onMagazzinoAutomaticoPickingRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
private DialogScanArtView(boolean forceOnlyUL, RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, MtbColr> onItemChoosed, RunnableArgs<MtbDepoPosizione> onMagazzinoAutomaticoPickingRequest) {
|
private DialogScanArtView(boolean forceOnlyUL, RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, MtbColt> onItemChoosed, RunnableArgs<MtbDepoPosizione> onMagazzinoAutomaticoPickingRequest) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
mForceOnlyUL = forceOnlyUL;
|
mForceOnlyUL = forceOnlyUL;
|
||||||
@@ -122,37 +130,60 @@ public class DialogScanArtView extends BaseDialogFragment implements DialogScanA
|
|||||||
private final RunnableArgs<BarcodeScanDTO> onScanSuccessfull = data -> {
|
private final RunnableArgs<BarcodeScanDTO> onScanSuccessfull = data -> {
|
||||||
this.onLoadingStarted();
|
this.onLoadingStarted();
|
||||||
|
|
||||||
this.mViewModel.processBarcodeDTO(data, (status, mtbAart, ean128Model, mtbColrList) -> {
|
executorService.execute(() -> {
|
||||||
|
|
||||||
var filteredMtbColrList = mtbColrList;
|
try {
|
||||||
|
|
||||||
if (mtbAart != null && filteredMtbColrList != null) {
|
Quartet<DialogConsts.Results, MtbAart, Ean128Model, MtbColt> result = this.mViewModel.processBarcodeDTO(data, pickMagazzinoAutomaticoPosizione -> {
|
||||||
filteredMtbColrList = filteredMtbColrList.stream()
|
handler.post(() -> {
|
||||||
.filter(x -> x.getCodMart().equalsIgnoreCase(mtbAart.getCodMart()))
|
this.onMagazzinoAutomaticoPickingRequest.run(pickMagazzinoAutomaticoPosizione);
|
||||||
.collect(Collectors.toList());
|
|
||||||
|
this.onLoadingEnded();
|
||||||
|
dismiss();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
var status = result.getValue0();
|
||||||
|
var mtbAart = result.getValue1();
|
||||||
|
var ean128Model = result.getValue2();
|
||||||
|
var mtbColt = result.getValue3();
|
||||||
|
|
||||||
|
List<MtbColr> filteredMtbColrList = mtbColt.getMtbColr();
|
||||||
|
|
||||||
|
if (mtbAart != null && filteredMtbColrList != null) {
|
||||||
|
filteredMtbColrList = filteredMtbColrList.stream()
|
||||||
|
.filter(x -> x.getCodMart().equalsIgnoreCase(mtbAart.getCodMart()))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
List<MtbColr> finalFilteredMtbColrList = filteredMtbColrList;
|
||||||
|
handler.post(() -> {
|
||||||
|
if (finalFilteredMtbColrList != null && finalFilteredMtbColrList.size() > 1) {
|
||||||
|
DialogChooseArtFromListaMtbColrView.make(getActivity(), finalFilteredMtbColrList, mtbColrChose -> {
|
||||||
|
|
||||||
|
mtbColt.setMtbColr(new ObservableArrayList<>());
|
||||||
|
mtbColt.getMtbColr().add(mtbColrChose);
|
||||||
|
onPickingCompleted.run(status, mtbAart, ean128Model, mtbColt);
|
||||||
|
}).show();
|
||||||
|
|
||||||
|
} else if (finalFilteredMtbColrList != null && finalFilteredMtbColrList.size() == 1) {
|
||||||
|
mtbColt.setMtbColr(new ObservableArrayList<>());
|
||||||
|
mtbColt.getMtbColr().add(finalFilteredMtbColrList.get(0));
|
||||||
|
onPickingCompleted.run(status, mtbAart, ean128Model, mtbColt);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
onPickingCompleted.run(status, mtbAart, ean128Model, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
this.onLoadingEnded();
|
||||||
|
|
||||||
|
dismiss();
|
||||||
|
});
|
||||||
|
} catch (Exception ex) {
|
||||||
|
onError(ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filteredMtbColrList != null && filteredMtbColrList.size() > 1) {
|
|
||||||
DialogChooseArtFromListaMtbColrView.make(getActivity(), filteredMtbColrList, mtbColrChose -> {
|
|
||||||
onPickingCompleted.run(status, mtbAart, ean128Model, mtbColrChose);
|
|
||||||
}).show();
|
|
||||||
|
|
||||||
} else if (filteredMtbColrList != null && filteredMtbColrList.size() == 1) {
|
|
||||||
onPickingCompleted.run(status, mtbAart, ean128Model, filteredMtbColrList.get(0));
|
|
||||||
|
|
||||||
} else {
|
|
||||||
onPickingCompleted.run(status, mtbAart, ean128Model, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
this.onLoadingEnded();
|
|
||||||
|
|
||||||
dismiss();
|
|
||||||
}, pickMagazzinoAutomaticoPosizione -> {
|
|
||||||
this.onMagazzinoAutomaticoPickingRequest.run(pickMagazzinoAutomaticoPosizione);
|
|
||||||
|
|
||||||
this.onLoadingEnded();
|
|
||||||
dismiss();
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,22 +1,17 @@
|
|||||||
package it.integry.integrywmsnative.view.dialogs.scan_art;
|
package it.integry.integrywmsnative.view.dialogs.scan_art;
|
||||||
|
|
||||||
import com.annimon.stream.Stream;
|
import org.javatuples.Quartet;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
||||||
import it.integry.integrywmsnative.core.exception.EmptyLUException;
|
|
||||||
import it.integry.integrywmsnative.core.exception.InvalidLUException;
|
import it.integry.integrywmsnative.core.exception.InvalidLUException;
|
||||||
import it.integry.integrywmsnative.core.exception.NoLUFoundException;
|
import it.integry.integrywmsnative.core.exception.NoLUFoundException;
|
||||||
import it.integry.integrywmsnative.core.exception.NoResultFromBarcodeException;
|
import it.integry.integrywmsnative.core.exception.NoResultFromBarcodeException;
|
||||||
import it.integry.integrywmsnative.core.exception.ScannedPositionNotExistException;
|
import it.integry.integrywmsnative.core.exception.ScannedPositionNotExistException;
|
||||||
import it.integry.integrywmsnative.core.exception.TooManyLUFoundInMonoLUPositionException;
|
import it.integry.integrywmsnative.core.exception.TooManyLUFoundInMonoLUPositionException;
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgssss;
|
|
||||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||||
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||||
@@ -62,23 +57,23 @@ public class DialogScanArtViewModel {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void processBarcodeDTO(BarcodeScanDTO barcodeScanDTO, RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, List<MtbColr>> onPickingCompleted, RunnableArgs<MtbDepoPosizione> onMagazzinoAutomaticoPickingRequest) {
|
public Quartet<DialogConsts.Results, MtbAart, Ean128Model, MtbColt> processBarcodeDTO(BarcodeScanDTO barcodeScanDTO, RunnableArgs<MtbDepoPosizione> onMagazzinoAutomaticoPickingRequest) throws Exception {
|
||||||
if (UtilityBarcode.isEtichettaAnonima(barcodeScanDTO)) {
|
if (UtilityBarcode.isEtichettaAnonima(barcodeScanDTO)) {
|
||||||
//Cerco gli articoli presenti nell'ul dell'etichetta anonima
|
//Cerco gli articoli presenti nell'ul dell'etichetta anonima
|
||||||
this.executeEtichettaLU(barcodeScanDTO.getStringValue(), onPickingCompleted);
|
return this.executeEtichettaLU(barcodeScanDTO.getStringValue());
|
||||||
|
|
||||||
} else if (UtilityBarcode.isEtichettaPosizione(barcodeScanDTO)) {
|
} else if (UtilityBarcode.isEtichettaPosizione(barcodeScanDTO)) {
|
||||||
//Cerco l'UL presente all'interno della posizione
|
//Cerco l'UL presente all'interno della posizione
|
||||||
this.executeEtichettaPosizione(barcodeScanDTO.getStringValue(), onPickingCompleted, onMagazzinoAutomaticoPickingRequest);
|
return this.executeEtichettaPosizione(barcodeScanDTO.getStringValue(), onMagazzinoAutomaticoPickingRequest);
|
||||||
|
|
||||||
} else if (UtilityBarcode.isEtichetta128(barcodeScanDTO)) {
|
} else if (UtilityBarcode.isEtichetta128(barcodeScanDTO)) {
|
||||||
this.executeEtichettaEan128(barcodeScanDTO, onPickingCompleted);
|
return this.executeEtichettaEan128(barcodeScanDTO);
|
||||||
|
|
||||||
} else if (UtilityBarcode.isEanPeso(barcodeScanDTO) && !mForceOnlyUL) {
|
} else if (UtilityBarcode.isEanPeso(barcodeScanDTO) && !mForceOnlyUL) {
|
||||||
this.executeEtichettaEanPeso(barcodeScanDTO, onPickingCompleted);
|
return this.executeEtichettaEanPeso(barcodeScanDTO);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
this.loadArticolo(barcodeScanDTO.getStringValue(), null, onPickingCompleted);
|
return this.loadArticolo(barcodeScanDTO.getStringValue(), null);
|
||||||
|
|
||||||
}
|
}
|
||||||
// else {
|
// else {
|
||||||
@@ -87,123 +82,108 @@ public class DialogScanArtViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private Quartet<DialogConsts.Results, MtbAart, Ean128Model, MtbColt> executeEtichettaEan128(BarcodeScanDTO barcodeScanDTO) throws Exception {
|
||||||
private void executeEtichettaEan128(BarcodeScanDTO barcodeScanDTO, RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, List<MtbColr>> onComplete) {
|
var ean128Model = this.mBarcodeRESTConsumer.decodeEan128Synchronized(barcodeScanDTO);
|
||||||
this.mBarcodeRESTConsumer.decodeEan128(barcodeScanDTO, ean128Model -> {
|
|
||||||
|
|
||||||
String barcodeProd = null;
|
|
||||||
|
|
||||||
if (ean128Model.Sscc != null) barcodeProd = ean128Model.Sscc;
|
|
||||||
if (ean128Model.Gtin != null) barcodeProd = ean128Model.Gtin;
|
|
||||||
if (ean128Model.Content != null) barcodeProd = ean128Model.Content;
|
|
||||||
|
|
||||||
|
|
||||||
if (!UtilityString.isNullOrEmpty(barcodeProd)) {
|
String barcodeProd = null;
|
||||||
if (!UtilityString.isNullOrEmpty(ean128Model.Sscc)) {
|
|
||||||
this.executeEtichettaLU(ean128Model.Sscc, onComplete);
|
if (ean128Model.Sscc != null) barcodeProd = ean128Model.Sscc;
|
||||||
} else if (!mForceOnlyUL) {
|
if (ean128Model.Gtin != null) barcodeProd = ean128Model.Gtin;
|
||||||
|
if (ean128Model.Content != null) barcodeProd = ean128Model.Content;
|
||||||
|
|
||||||
|
|
||||||
|
if (!UtilityString.isNullOrEmpty(barcodeProd)) {
|
||||||
|
if (!UtilityString.isNullOrEmpty(ean128Model.Sscc)) {
|
||||||
|
return this.executeEtichettaLU(ean128Model.Sscc);
|
||||||
|
|
||||||
|
} else if (!mForceOnlyUL) {
|
||||||
|
return this.loadArticolo(barcodeProd, ean128Model);
|
||||||
|
|
||||||
this.loadArticolo(barcodeProd, ean128Model, onComplete);
|
|
||||||
} else {
|
|
||||||
this.sendError(new Exception("Barcode non valido"));
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
//EAN 128 non completo o comunque mancano i riferimenti al prodotto
|
throw new Exception("Barcode non valido");
|
||||||
this.sendError(new NoResultFromBarcodeException(barcodeProd));
|
|
||||||
}
|
}
|
||||||
}, this::sendError);
|
} else {
|
||||||
}
|
//EAN 128 non completo o comunque mancano i riferimenti al prodotto
|
||||||
|
throw new NoResultFromBarcodeException(barcodeProd);
|
||||||
private void executeEtichettaEanPeso(BarcodeScanDTO barcodeScanDTO, RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, List<MtbColr>> onComplete) {
|
|
||||||
|
|
||||||
try {
|
|
||||||
Ean13PesoModel ean13PesoModel = Ean13PesoModel.fromBarcode(barcodeScanDTO.getStringValue());
|
|
||||||
|
|
||||||
this.loadArticolo(ean13PesoModel.getPrecode(), ean13PesoModel.toEan128(), onComplete);
|
|
||||||
} catch (Exception ex) {
|
|
||||||
this.sendError(ex);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Quartet<DialogConsts.Results, MtbAart, Ean128Model, MtbColt> executeEtichettaEanPeso(BarcodeScanDTO barcodeScanDTO) throws Exception {
|
||||||
|
Ean13PesoModel ean13PesoModel = Ean13PesoModel.fromBarcode(barcodeScanDTO.getStringValue());
|
||||||
|
|
||||||
private void executeEtichettaLU(String SSCC, RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, List<MtbColr>> onComplete) {
|
return this.loadArticolo(ean13PesoModel.getPrecode(), ean13PesoModel.toEan128());
|
||||||
mColliMagazzinoRESTConsumer.getBySSCC(SSCC, true, false, mtbColt -> {
|
|
||||||
|
|
||||||
if (mtbColt != null && mtbColt.getMtbColr() != null && !mtbColt.getMtbColr().isEmpty()) {
|
|
||||||
if (mtbColt.getSegno() != -1) {
|
|
||||||
onComplete.run(DialogConsts.Results.YES, null, null, mtbColt.getMtbColr());
|
|
||||||
} else this.sendError(new InvalidLUException());
|
|
||||||
} else {
|
|
||||||
this.sendError(new EmptyLUException());
|
|
||||||
}
|
|
||||||
|
|
||||||
}, this::sendError);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private Quartet<DialogConsts.Results, MtbAart, Ean128Model, MtbColt> executeEtichettaLU(String SSCC) throws Exception {
|
||||||
|
var mtbColt = mColliMagazzinoRESTConsumer.getBySsccSynchronized(SSCC, true, false);
|
||||||
|
|
||||||
private void executeEtichettaPosizione(String stringValue, RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, List<MtbColr>> onComplete, RunnableArgs<MtbDepoPosizione> onMagazzinoAutomaticoPickingRequest) {
|
if (mtbColt == null || mtbColt.getMtbColr() == null || mtbColt.getMtbColr().isEmpty())
|
||||||
MtbDepoPosizione foundPosizione = Stream.of(SettingsManager.iDB().getAvailablePosizioni())
|
throw new NoLUFoundException();
|
||||||
|
|
||||||
|
if (mtbColt.getSegno() == -1) throw new InvalidLUException();
|
||||||
|
|
||||||
|
return new Quartet<>(DialogConsts.Results.YES, null, null, mtbColt);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private Quartet<DialogConsts.Results, MtbAart, Ean128Model, MtbColt> executeEtichettaPosizione(String stringValue, RunnableArgs<MtbDepoPosizione> onMagazzinoAutomaticoPickingRequest) throws Exception {
|
||||||
|
MtbDepoPosizione foundPosizione = SettingsManager.iDB().getAvailablePosizioni().stream()
|
||||||
.filter(x -> x.getPosizione().equalsIgnoreCase(stringValue))
|
.filter(x -> x.getPosizione().equalsIgnoreCase(stringValue))
|
||||||
.single();
|
.findFirst()
|
||||||
|
.orElse(null);
|
||||||
|
|
||||||
if (foundPosizione == null) {
|
if (foundPosizione == null)
|
||||||
//Nessuna posizione trovata con questo barcode
|
//Nessuna posizione trovata con questo barcode
|
||||||
this.sendError(new ScannedPositionNotExistException());
|
throw new ScannedPositionNotExistException();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (foundPosizione.isMagazzinoAutomatico()) {
|
if (foundPosizione.isMagazzinoAutomatico()) {
|
||||||
//Eseguo picking da magazzino automatico
|
//Eseguo picking da magazzino automatico
|
||||||
onMagazzinoAutomaticoPickingRequest.run(foundPosizione);
|
onMagazzinoAutomaticoPickingRequest.run(foundPosizione);
|
||||||
} else {
|
} else {
|
||||||
this.executePosizione(foundPosizione, null, onComplete);
|
return this.executePosizione(foundPosizione, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void executePosizione(MtbDepoPosizione posizione, MtbAart articolo, RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, List<MtbColr>> onComplete) {
|
private Quartet<DialogConsts.Results, MtbAart, Ean128Model, MtbColt> executePosizione(MtbDepoPosizione posizione, MtbAart articolo) throws Exception {
|
||||||
this.mPosizioniRESTConsumer.getBancaliInPosizione(posizione, mtbColtList -> {
|
var mtbColtList = this.mPosizioniRESTConsumer.getBancaliInPosizioneSynchronized(posizione);
|
||||||
|
|
||||||
if (mtbColtList == null || mtbColtList.isEmpty()) {
|
if (mtbColtList == null || mtbColtList.isEmpty())
|
||||||
this.sendError(new NoLUFoundException());
|
throw new NoLUFoundException();
|
||||||
} else if (mtbColtList.size() == 1) {
|
|
||||||
this.mColliMagazzinoRESTConsumer.getByTestata(mtbColtList.get(0), true, false, mtbColt -> {
|
|
||||||
onComplete.run(DialogConsts.Results.YES, articolo, null, mtbColt.getMtbColr());
|
|
||||||
}, this::sendError);
|
|
||||||
} else {
|
|
||||||
this.sendError(new TooManyLUFoundInMonoLUPositionException());
|
|
||||||
}
|
|
||||||
|
|
||||||
}, this::sendError);
|
if (mtbColtList.size() != 1) {
|
||||||
|
throw new TooManyLUFoundInMonoLUPositionException();
|
||||||
|
}
|
||||||
|
|
||||||
|
var mtbColt = this.mColliMagazzinoRESTConsumer.getByTestataSynchronized(mtbColtList.get(0), true, false);
|
||||||
|
return new Quartet<>(DialogConsts.Results.YES, articolo, null, mtbColt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void loadArticolo(@NotNull String barcodeProd, Ean128Model ean128Model, RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, List<MtbColr>> onComplete) {
|
private Quartet<DialogConsts.Results, MtbAart, Ean128Model, MtbColt> loadArticolo(@NotNull String barcodeProd, Ean128Model ean128Model) throws Exception {
|
||||||
this.mArticoloRESTConsumer.searchByBarcode(barcodeProd, mtbAartList -> {
|
var mtbAartList = this.mArticoloRESTConsumer.searchByBarcodeSynchronized(barcodeProd);
|
||||||
if (mtbAartList != null && !mtbAartList.isEmpty()) {
|
|
||||||
|
|
||||||
MtbAart firstArt = mtbAartList.get(0);
|
if (mtbAartList == null || mtbAartList.isEmpty())
|
||||||
MtbDepoPosizione firstArtPosition = UtilityPosizione.getFromCache(firstArt.getPosizione());
|
throw new NoResultFromBarcodeException(barcodeProd);
|
||||||
|
|
||||||
if (firstArtPosition != null && firstArtPosition.isFlagMonoCollo() && mForceOnlyUL) {
|
MtbAart firstArt = mtbAartList.get(0);
|
||||||
this.executePosizione(firstArtPosition, firstArt, onComplete);
|
MtbDepoPosizione firstArtPosition = UtilityPosizione.getFromCache(firstArt.getPosizione());
|
||||||
} else if (!mForceOnlyUL) {
|
|
||||||
onComplete.run(DialogConsts.Results.YES, mtbAartList.get(0), ean128Model, null);
|
|
||||||
} else {
|
|
||||||
this.sendError(new NoResultFromBarcodeException(barcodeProd));
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
if (firstArtPosition != null && firstArtPosition.isFlagMonoCollo() && mForceOnlyUL)
|
||||||
this.sendError(new NoResultFromBarcodeException(barcodeProd));
|
return this.executePosizione(firstArtPosition, firstArt);
|
||||||
}
|
|
||||||
}, this::sendError);
|
if (!mForceOnlyUL)
|
||||||
|
return new Quartet<>(DialogConsts.Results.YES, mtbAartList.get(0), ean128Model, null);
|
||||||
|
|
||||||
|
throw new NoResultFromBarcodeException(barcodeProd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void sendError(Exception ex) {
|
|
||||||
if (this.mListener != null) mListener.onError(ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setListener(Listener listener) {
|
public void setListener(Listener listener) {
|
||||||
this.mListener = listener;
|
this.mListener = listener;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
<padding
|
<padding
|
||||||
android:left="6dp"
|
android:left="6dp"
|
||||||
android:right="6dp"
|
android:right="8dp"
|
||||||
android:top="1dp" />
|
android:top="1dp" />
|
||||||
|
|
||||||
<corners android:radius="12dp" />
|
<corners android:radius="12dp" />
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:width="488.3dp"
|
|
||||||
android:height="168.7dp"
|
|
||||||
android:viewportWidth="488.3"
|
|
||||||
android:viewportHeight="168.7">
|
|
||||||
<path
|
|
||||||
android:pathData="M484.96,0c0.1,1.5 0.2,3.6 -0.3,6c-0.7,3.4 -2.1,5.8 -3.6,8.5c-0.9,1.7 -2,3.3 -3.5,5.2c-3.5,4.7 -7.2,17.7 -9.9,39.7s-1.3,59.4 1.5,72s-0.1,22.1 -4.6,26.3s0.9,2.1 -6.7,5.1c-7.6,3 -18.9,-5.4 -21.2,-17.7l0,0c-2.3,-12.3 -3.1,-9.1 -0.1,-21.5c3,-12.4 7.6,-24.9 7.7,-36.7c0.1,-11.8 -5.1,-34.2 -12.3,-38s-7,-2.7 -13.8,-3.1s-9.9,-0.1 -13.8,4.3c-3.9,4.4 -6.5,10.3 -7.9,19.7c-1.4,9.4 0,26.7 2.4,33.1c2.4,6.4 3.7,6.8 1,14.9c-2.7,8.1 -15.7,9.9 -20.5,2.9c-4.8,-7.1 -4.3,-17.9 -1.5,-34.7c2.8,-16.8 2.3,-14.6 2.2,-27.2c0,-12.6 1,-11.4 -1.3,-15.8c-2.3,-4.4 -9.7,-9.7 -16.9,-5.7c-7.2,4 -11.7,21.3 -12.6,28.1s-0.9,24.5 0.4,31c1.2,6.5 1.3,12.8 -0.6,17.5s-4,7.4 -7.2,8.6s-6.4,1.4 -10.1,-0.9c-3.7,-2.3 -8.2,-4.8 -8.7,-16.8c-0.5,-12 3.7,-39.8 2.1,-53.6c-1.2,-10.7 -3.7,-14.3 -9.2,-10.6c-3.9,2.6 -7.2,9.4 -4.9,16s2.8,8.4 2.7,13s-1.1,8 -4.4,11.6c-3.3,3.5 -8.3,5 -12.8,1.9c-4.5,-3.1 -6.7,-9.9 -4.3,-18.3c2.5,-8.4 10.1,-11.6 1.7,-19.2c-8.3,-7.6 -14.9,1.7 -15.1,15.6c-0.2,14 0.8,23 3.6,32.5c2.8,9.6 4.1,14.7 4.1,22.7s-5.1,16.1 -12.8,15.3s-12.7,-15.8 -14.7,-26.2c-2,-10.4 -1.8,-8.8 -2.5,-11.3s-1.3,-5 -1.6,-9.6c-1.8,-13 4.7,-26 4.8,-37.1c0,-6.6 0.8,-8.5 -2.8,-12.3s-19.3,6.1 -23.4,17.1s-3.9,10.9 -3.6,25.9s1.8,25.1 5.1,34.5c3.3,9.4 3.9,16.5 3.2,19.7c-0.6,3.3 -0.6,3.1 -1.3,8.3c-0.7,5.2 -3.9,10.8 -6.8,12.3c-3.9,2 -8.2,0.3 -10.5,-1.8c-2.4,-2.4 -5.4,-8.4 -6.7,-13.9s-1.3,-8.5 -1.3,-16s0.3,-14.8 0.7,-19.7c0.4,-4.9 0.8,-11.8 1.1,-25.1c0.3,-13.3 -0.4,-19.2 -3.6,-29.8s-3.5,-9.7 -7.1,-13.5s-5.6,-4.9 -8.6,-4.9c-2.9,0 -8.5,3 -11.3,5.9c-2.7,2.9 -5.6,8.2 -8,15.5s-2.7,9.4 0.3,22.8s3.5,16.2 1.4,27.5c-2,11.3 -7.2,16.8 -14.8,16.8s-12.2,-3.3 -14.5,-7.8s-3.7,-12.1 -3.4,-17.3s2,-15.6 2.8,-18.3c0.9,-2.6 2.8,-14.6 3.3,-20.7c0.5,-6.1 -0.4,-11 -3.4,-16.2s-4.6,-7.1 -6.5,-8.3c-4.8,-2.5 -9.5,2.4 -11.6,4.6c-3.8,3.9 -7.6,10.3 -9,14.7s-1,4.3 -0.3,12s0.8,8.5 -0.2,17s-1.6,11.8 -4.2,15.3s-4,4.7 -9.7,4.7s-12.5,-6.7 -13.7,-12.5s1.4,-15.6 3.1,-23.4s1,-20.1 -0.3,-24c-4,-13.1 -11.8,-9.2 -16.1,-1.2c-5.2,7.4 -5.5,31.2 -3.5,39.9s0.6,19.8 -0.4,24.8s-4.2,12.3 -7,15.4s-10.6,4.7 -14.7,2.4s-8.1,-6.9 -9.7,-11.6c-1.6,-4.7 -1.4,-13.4 0.3,-17.2c1.7,-3.8 7.6,-11.5 8.4,-23.2c0.9,-11.7 -4.8,-17 -5.4,-18.6c-0.6,-1.6 -2.5,-1.1 -4.5,1c-7.6,9.1 -5.7,19.2 -5.8,24.7c-0.4,14.7 3.9,39.6 4.1,49.4c0.2,9.8 -1.7,12.8 -3.5,17.6c-1.8,4.8 -3.4,7.4 -7.6,10s-10.2,5.3 -14.5,3.4c-4.3,-2 -5.1,0.1 -9.1,-11.3c-4,-11.4 1.5,-34 4.2,-42.1c2.7,-8.1 4.2,-11 5.3,-18.4s2.4,-20.6 2.4,-38c0,-17.3 0.6,-16.8 -1.5,-21.5c-3.1,-6.7 -5.1,-14.5 -1.9,-20.4c0.2,-0.4 0.6,-1.1 1.2,-1.8C171.66,0 328.26,0 484.96,0z"
|
|
||||||
android:fillColor="#D32F2F"/>
|
|
||||||
</vector>
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user