Compare commits
301 Commits
v1.46.05(4
...
develop
| Author | SHA1 | Date | |
|---|---|---|---|
| 43a2b90b16 | |||
| efe84528da | |||
| ab230425c3 | |||
| 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 | |||
| fd8bb8e7da | |||
| 60a088a7f4 | |||
| 8ca5207a58 | |||
| f2cc31e08a | |||
| e541031efe | |||
| d4b220d1e6 | |||
| 798835cb4c | |||
| ba72284c87 | |||
| 603c5dd8b7 | |||
| 43fc8be493 | |||
| 22bace2402 | |||
| 3b86460f48 | |||
| ddac54b513 | |||
| a385b01584 | |||
| 7920166110 | |||
| e6f4cc9d6d | |||
| 13d9c40119 | |||
| 1d7125a821 | |||
| deb4d77203 | |||
| 520a1cb07a | |||
| c620e9cb96 | |||
| 6ef4961074 | |||
| 688a8e4bad | |||
| 12796b11e5 | |||
| f7dc857587 | |||
| f99c0e5514 | |||
| f1c304eaeb | |||
| 7b3fde1d71 | |||
| 3c337fc138 | |||
| 021f6974f1 | |||
| 92abfe1da4 | |||
| 6338c1dfa6 | |||
| 657d85be86 | |||
| 97c907c992 | |||
| caed709b64 | |||
| 13800eecab | |||
| c4357f662c | |||
| 67a8ca94db | |||
| 0bfd56c011 | |||
| eead844ac1 | |||
| 65cfadcb6e | |||
| 00067ca1c9 | |||
| 73ca8bb366 | |||
| 3ffdb2c220 | |||
| a5479595c7 | |||
| cff971bef8 | |||
| a5d3388665 | |||
| 22ad23c5b7 | |||
| b1d5e10db4 | |||
| bde41d21be | |||
| 9d8228419c | |||
| ad7d9059c0 | |||
| 4831a7ce19 | |||
| 552b82feda | |||
| 6d62a7b10e | |||
| 667f4aea74 | |||
| f80225b7bf | |||
| 7a02e1d8ad | |||
| 9cc70f4ee6 | |||
| 7c4c5da1d6 | |||
| b960b6319a | |||
| 08ddaa7a11 | |||
| bcce40094c | |||
| 960388adf8 | |||
| e76722018f | |||
| fc30017021 | |||
| e1dd4f2140 | |||
| 67a0679de7 | |||
| dfc87f7aec | |||
| 886ef6ba08 | |||
| fe77f90a7a | |||
| 7a1f0d6cf6 | |||
| 004bc3b926 | |||
| 5a0b45c6f9 | |||
| be5ebb89d7 | |||
| f81d61c4c5 | |||
| 634bc502ce | |||
| d13dbf1ad3 | |||
| 2f9ee642da | |||
| afecc11364 | |||
| b33d566abd | |||
| 69d880b587 | |||
| aeadea42e1 | |||
| f5c3dcfdc9 | |||
| d30af1e2a6 | |||
| 71a18e9ffa | |||
| 40e1fb4f83 | |||
| f3f0fd8fd8 | |||
| ed53b9e3b4 | |||
| 37ac05b8ab | |||
| 823d0d7a33 | |||
| 5b07ff5efa | |||
| c5639a643a | |||
| 012f75198b | |||
| d7e0e858d2 | |||
| 339a5e5b68 | |||
| 02a13911d8 | |||
| b6f51971f1 | |||
| 57079c0062 | |||
| 63c353a83c | |||
| c069d21cbf | |||
| afeb9ecc23 | |||
| 2ff8d80da3 | |||
| 891e2641fa | |||
| ca79107809 | |||
| 5c37b986ce | |||
| c426250cd5 | |||
| f090c11146 | |||
| 5c90f22a49 | |||
| f1ddaa1fca | |||
| 8490553a32 | |||
| 66824fccb1 | |||
| 39dce4d23f | |||
| c1dbbde905 | |||
| 8d2d0ad195 | |||
| 927b14c9fc | |||
| f342cd0e5f | |||
| c287852ce6 | |||
| edc9470e9b |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -149,3 +149,6 @@ crashlytics.properties
|
||||
crashlytics-build.properties
|
||||
### AndroidStudio Patch ###
|
||||
!/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
copilot.*.xml
|
||||
/.idea/dataSources.xml
|
||||
35
.idea/codeStyles/Project.xml
generated
35
.idea/codeStyles/Project.xml
generated
@@ -1,5 +1,40 @@
|
||||
<component name="ProjectCodeStyleConfiguration">
|
||||
<code_scheme name="Project" version="173">
|
||||
<JavaCodeStyleSettings>
|
||||
<option name="IMPORT_LAYOUT_TABLE">
|
||||
<value>
|
||||
<package name="" withSubpackages="true" static="false" module="true" />
|
||||
<package name="android" withSubpackages="true" static="true" />
|
||||
<package name="androidx" withSubpackages="true" static="true" />
|
||||
<package name="com" withSubpackages="true" static="true" />
|
||||
<package name="junit" withSubpackages="true" static="true" />
|
||||
<package name="net" withSubpackages="true" static="true" />
|
||||
<package name="org" withSubpackages="true" static="true" />
|
||||
<package name="java" withSubpackages="true" static="true" />
|
||||
<package name="javax" withSubpackages="true" static="true" />
|
||||
<package name="" withSubpackages="true" static="true" />
|
||||
<emptyLine />
|
||||
<package name="android" withSubpackages="true" static="false" />
|
||||
<emptyLine />
|
||||
<package name="androidx" withSubpackages="true" static="false" />
|
||||
<emptyLine />
|
||||
<package name="com" withSubpackages="true" static="false" />
|
||||
<emptyLine />
|
||||
<package name="junit" withSubpackages="true" static="false" />
|
||||
<emptyLine />
|
||||
<package name="net" withSubpackages="true" static="false" />
|
||||
<emptyLine />
|
||||
<package name="org" withSubpackages="true" static="false" />
|
||||
<emptyLine />
|
||||
<package name="java" withSubpackages="true" static="false" />
|
||||
<emptyLine />
|
||||
<package name="javax" withSubpackages="true" static="false" />
|
||||
<emptyLine />
|
||||
<package name="" withSubpackages="true" static="false" />
|
||||
<emptyLine />
|
||||
</value>
|
||||
</option>
|
||||
</JavaCodeStyleSettings>
|
||||
<JetCodeStyleSettings>
|
||||
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
||||
</JetCodeStyleSettings>
|
||||
|
||||
4
.idea/deploymentTargetSelector.xml
generated
4
.idea/deploymentTargetSelector.xml
generated
@@ -4,10 +4,10 @@
|
||||
<selectionStates>
|
||||
<SelectionState runConfigName="app">
|
||||
<option name="selectionMode" value="DROPDOWN" />
|
||||
<DropdownSelection timestamp="2025-03-17T09:16:48.549771200Z">
|
||||
<DropdownSelection timestamp="2025-10-02T11:26:10.944286600Z">
|
||||
<Target type="DEFAULT_BOOT">
|
||||
<handle>
|
||||
<DeviceId pluginId="PhysicalDevice" identifier="serial=21088B8EFD" />
|
||||
<DeviceId pluginId="PhysicalDevice" identifier="serial=7da0808" />
|
||||
</handle>
|
||||
</Target>
|
||||
</DropdownSelection>
|
||||
|
||||
11
.idea/runConfigurations/app.xml
generated
11
.idea/runConfigurations/app.xml
generated
@@ -1,6 +1,7 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<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_APK_FROM_BUNDLE" value="false" />
|
||||
<option name="DEPLOY_AS_INSTANT" value="false" />
|
||||
@@ -8,14 +9,17 @@
|
||||
<option name="PM_INSTALL_OPTIONS" value="" />
|
||||
<option name="ALL_USERS" 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="DYNAMIC_FEATURES_DISABLED_LIST" value="" />
|
||||
<option name="ACTIVITY_EXTRA_FLAGS" value="" />
|
||||
<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="SHOW_LOGCAT_AUTOMATICALLY" value="false" />
|
||||
<option name="INSPECTION_WITHOUT_ACTIVITY_RESTART" value="false" />
|
||||
<option name="TARGET_SELECTION_MODE" value="SHOW_DIALOG" />
|
||||
<option name="TARGET_SELECTION_MODE" value="DEVICE_AND_SNAPSHOT_COMBO_BOX" />
|
||||
<option name="SELECTED_CLOUD_MATRIX_CONFIGURATION_ID" value="-1" />
|
||||
<option name="SELECTED_CLOUD_MATRIX_PROJECT_ID" value="" />
|
||||
<option name="DEBUGGER_TYPE" value="Auto" />
|
||||
@@ -59,6 +63,7 @@
|
||||
<option name="NATIVE_MEMORY_SAMPLE_RATE_BYTES" value="2048" />
|
||||
</Profilers>
|
||||
<option name="DEEP_LINK" value="" />
|
||||
<option name="ACTIVITY" value="" />
|
||||
<option name="ACTIVITY_CLASS" value="" />
|
||||
<option name="SEARCH_ACTIVITY_IN_GLOBAL_SCOPE" value="false" />
|
||||
<option name="SKIP_ACTIVITY_VALIDATION" value="false" />
|
||||
|
||||
72
Jenkinsfile.groovy
Normal file
72
Jenkinsfile.groovy
Normal file
@@ -0,0 +1,72 @@
|
||||
pipeline {
|
||||
agent {
|
||||
label 'master'
|
||||
}
|
||||
|
||||
options {
|
||||
buildDiscarder(logRotator(numToKeepStr: '30', artifactNumToKeepStr: '10'))
|
||||
disableConcurrentBuilds()
|
||||
}
|
||||
|
||||
environment {
|
||||
// ANDROID_HOME = "/usr/local/android/sdk" // Cambia in base al tuo sistema
|
||||
JAVA_HOME = tool 'JDK 17.0.6 x64' // Nome dello strumento configurato in Jenkins
|
||||
PATH = "${env.JAVA_HOME}\\bin;${env.PATH}"
|
||||
}
|
||||
|
||||
stages {
|
||||
|
||||
stage('Preparing') {
|
||||
when {
|
||||
expression {
|
||||
return env.GIT_BRANCH == "master-beta"
|
||||
}
|
||||
}
|
||||
steps {
|
||||
bat "./gradlew addBetaSuffix"
|
||||
}
|
||||
}
|
||||
|
||||
stage('Build') {
|
||||
steps {
|
||||
bat "./gradlew assembleRelease"
|
||||
archiveArtifacts artifacts: 'app/build/outputs/apk/release/', onlyIfSuccessful: true
|
||||
}
|
||||
}
|
||||
|
||||
stage('Publish') {
|
||||
steps {
|
||||
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'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
post {
|
||||
success {
|
||||
script {
|
||||
bat 'curl -k "https://devservices.studioml.it/ems-api/updateWMSApp?overrideForced=false"'
|
||||
bat 'curl -k "https://devservices.studioml.it/ems-api/updateWMSApp?overrideForced=false&suffix=beta"'
|
||||
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"'
|
||||
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://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 {
|
||||
script {
|
||||
if (env.GIT_BRANCH == "master" || env.GIT_BRANCH == "master-beta") {
|
||||
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 {
|
||||
script {
|
||||
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://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'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
122
app/build.gradle
122
app/build.gradle
@@ -8,10 +8,11 @@ apply plugin: 'com.google.firebase.crashlytics'
|
||||
//apply plugin: 'kotlin-android'
|
||||
apply plugin: 'com.google.gms.google-services'
|
||||
|
||||
|
||||
android {
|
||||
|
||||
def appVersionCode = 493
|
||||
def appVersionName = '1.46.05'
|
||||
def appVersionCode = 553
|
||||
def appVersionName = '1.50.04'
|
||||
|
||||
signingConfigs {
|
||||
release {
|
||||
@@ -34,7 +35,7 @@ android {
|
||||
defaultConfig {
|
||||
applicationId "it.integry.integrywmsnative"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 35
|
||||
targetSdk 36
|
||||
versionCode appVersionCode
|
||||
versionName appVersionName
|
||||
// testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
@@ -51,11 +52,18 @@ android {
|
||||
buildTypes {
|
||||
debug {
|
||||
ext.enableCrashlytics = false
|
||||
// minifyEnabled true // Abilita la minimizzazione del codice
|
||||
// shrinkResources true // Rimuove risorse non utilizzate
|
||||
// proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
release {
|
||||
minifyEnabled false
|
||||
// minifyEnabled true // Abilita la minimizzazione del codice
|
||||
// shrinkResources true // Rimuove risorse non utilizzate
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
signingConfig signingConfigs.release
|
||||
firebaseCrashlytics {
|
||||
mappingFileUploadEnabled true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,12 +82,7 @@ android {
|
||||
}
|
||||
|
||||
|
||||
build {
|
||||
doLast {
|
||||
delete "$projectDir/build/outputs/apk/release/version.txt"
|
||||
file("$projectDir/build/outputs/apk/release/version.txt").text = appVersionCode + '\n' + appVersionName + '\n' + 'forced=true'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
gradle.projectsEvaluated {
|
||||
tasks.withType(JavaCompile.class).tap {
|
||||
@@ -92,7 +95,7 @@ android {
|
||||
abortOnError false
|
||||
}
|
||||
namespace 'it.integry.integrywmsnative'
|
||||
compileSdk 35
|
||||
compileSdk 36
|
||||
}
|
||||
|
||||
configurations {
|
||||
@@ -101,36 +104,33 @@ configurations {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.4'
|
||||
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.5'
|
||||
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||
// androidTestImplementation('androidx.test.espresso:espresso-core:3.6.1', {
|
||||
// exclude group: 'com.android.support', module: 'support-annotations'
|
||||
// })
|
||||
// implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||
|
||||
implementation 'com.github.lupaulus:logger:2.3.2'
|
||||
|
||||
//Firebase
|
||||
|
||||
// Import the Firebase BoM
|
||||
implementation platform('com.google.firebase:firebase-bom:33.9.0')
|
||||
implementation platform('com.google.firebase:firebase-bom:33.16.0')
|
||||
implementation 'com.google.firebase:firebase-analytics'
|
||||
implementation 'com.google.firebase:firebase-crashlytics'
|
||||
implementation 'com.google.firebase:firebase-perf'
|
||||
implementation 'com.google.android.gms:play-services-basement:18.5.0'
|
||||
implementation 'com.google.android.gms:play-services-basement:18.7.1'
|
||||
|
||||
//JJWT
|
||||
implementation 'io.jsonwebtoken:jjwt-api:0.11.5'
|
||||
runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.11.5'
|
||||
runtimeOnly 'io.jsonwebtoken:jjwt-jackson:0.11.5'
|
||||
implementation 'io.jsonwebtoken:jjwt-api:0.13.0'
|
||||
runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.13.0'
|
||||
runtimeOnly 'io.jsonwebtoken:jjwt-jackson:0.13.0'
|
||||
|
||||
implementation 'com.google.guava:guava:33.4.0-android'
|
||||
|
||||
implementation 'androidx.appcompat:appcompat:1.7.0'
|
||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||
implementation 'androidx.appcompat:appcompat:1.7.1'
|
||||
implementation 'com.google.android.material:material:1.12.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.2.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.2.1'
|
||||
implementation 'androidx.cardview:cardview:1.0.0'
|
||||
implementation 'androidx.recyclerview:recyclerview:1.4.0'
|
||||
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
|
||||
|
||||
implementation('androidx.preference:preference-ktx:1.2.1') {
|
||||
exclude group: 'androidx.lifecycle', module: 'lifecycle-viewmodel'
|
||||
@@ -138,19 +138,18 @@ dependencies {
|
||||
}
|
||||
|
||||
implementation "androidx.slidingpanelayout:slidingpanelayout:1.2.0"
|
||||
implementation 'com.squareup.okhttp3:okhttp:4.10.0'
|
||||
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
|
||||
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
|
||||
implementation 'com.squareup.retrofit2:retrofit:3.0.0'
|
||||
implementation 'com.squareup.retrofit2:converter-gson:3.0.0'
|
||||
implementation 'com.annimon:stream:1.2.2'
|
||||
implementation 'androidx.lifecycle:lifecycle-runtime:2.8.7'
|
||||
implementation 'org.apache.commons:commons-text:1.9'
|
||||
implementation 'androidx.lifecycle:lifecycle-runtime:2.9.3'
|
||||
implementation 'org.apache.commons:commons-text:1.14.0'
|
||||
|
||||
//MVVM
|
||||
def dagger2_version = '2.55'
|
||||
api "com.google.dagger:dagger:$dagger2_version"
|
||||
def dagger2_version = '2.57.1'
|
||||
implementation "com.google.dagger:dagger:$dagger2_version"
|
||||
annotationProcessor "com.google.dagger:dagger-compiler:$dagger2_version"
|
||||
api "com.google.dagger:dagger-android:$dagger2_version"
|
||||
api "com.google.dagger:dagger-android-support:$dagger2_version"
|
||||
implementation "com.google.dagger:dagger-android:$dagger2_version"
|
||||
implementation "com.google.dagger:dagger-android-support:$dagger2_version"
|
||||
// if you use the support libraries
|
||||
annotationProcessor "com.google.dagger:dagger-android-processor:$dagger2_version"
|
||||
|
||||
@@ -162,7 +161,7 @@ dependencies {
|
||||
implementation 'com.github.pedromassango:doubleClick:3.0'
|
||||
|
||||
//SQLite ROOM
|
||||
def room_version = "2.6.1"
|
||||
def room_version = "2.7.2"
|
||||
|
||||
implementation "androidx.room:room-runtime:$room_version"
|
||||
annotationProcessor "androidx.room:room-compiler:$room_version"
|
||||
@@ -188,14 +187,13 @@ dependencies {
|
||||
implementation 'com.github.harry1453:android-bluetooth-serial:v1.1.2'
|
||||
|
||||
// RxJava is also required.
|
||||
implementation 'io.reactivex.rxjava2:rxjava:2.1.12'
|
||||
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
|
||||
|
||||
implementation 'org.greenrobot:eventbus:3.3.1'
|
||||
implementation 'io.reactivex.rxjava2:rxjava:2.2.21'
|
||||
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
|
||||
|
||||
//Barcode generator
|
||||
// implementation group: 'com.google.zxing', name: 'core', version: '3.5.3'
|
||||
implementation 'com.journeyapps:zxing-android-embedded:4.3.0'
|
||||
|
||||
implementation("org.javatuples:javatuples:1.2")
|
||||
}
|
||||
|
||||
repositories {
|
||||
@@ -203,3 +201,49 @@ repositories {
|
||||
google()
|
||||
maven { url 'https://jitpack.io' }
|
||||
}
|
||||
|
||||
tasks.register('addBetaSuffix') {
|
||||
doLast {
|
||||
def gradleFile = file("build.gradle")
|
||||
def content = gradleFile.text
|
||||
|
||||
// Modifica appVersionName
|
||||
content = content.replaceAll(/appVersionName\s*=\s*'(.*?)'/) { fullMatch, version ->
|
||||
"appVersionName = '${version}-beta'"
|
||||
}
|
||||
|
||||
// Modifica outputFileName
|
||||
content = content.replaceAll(/output\.outputFileName\s*=\s*"(.*?)"/) { fullMatch, filename ->
|
||||
"output.outputFileName = \"${filename.replace('.apk', '-beta.apk')}\""
|
||||
}
|
||||
|
||||
// Modifica direttamente la riga che crea 'version.txt' in 'version-beta.txt'
|
||||
content = content.replace(
|
||||
"def versionFile = new File(outputDir, \"version.txt\")",
|
||||
"def versionFile = new File(outputDir, \"version-beta.txt\")"
|
||||
)
|
||||
|
||||
// Sovrascrivi il file
|
||||
gradleFile.write(content)
|
||||
}
|
||||
}
|
||||
|
||||
tasks.register('createVersionFile') {
|
||||
doLast {
|
||||
def outputDir = file("${projectDir}/build/outputs/apk/release")
|
||||
def versionFile = new File(outputDir, "version.txt")
|
||||
|
||||
// Cancella il file se esiste
|
||||
if (versionFile.exists()) {
|
||||
versionFile.delete()
|
||||
}
|
||||
|
||||
// Crea il file con i contenuti desiderati
|
||||
versionFile.write("${android.defaultConfig.versionCode}\n${android.defaultConfig.versionName}\nforced=true")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
afterEvaluate {
|
||||
tasks.assembleRelease.finalizedBy createVersionFile
|
||||
}
|
||||
|
||||
23
app/proguard-rules.pro
vendored
23
app/proguard-rules.pro
vendored
@@ -23,3 +23,26 @@
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
# Prevent proguard from stripping interface information from TypeAdapter, TypeAdapterFactory,
|
||||
# JsonSerializer, JsonDeserializer instances (so they can be used in @JsonAdapter)
|
||||
-keep class * extends com.google.gson.TypeAdapter
|
||||
-keep class * implements com.google.gson.TypeAdapterFactory
|
||||
-keep class * implements com.google.gson.JsonSerializer
|
||||
-keep class * implements com.google.gson.JsonDeserializer
|
||||
# Prevent R8 from leaving Data object members always null
|
||||
-keepclasseswithmembers class * {
|
||||
<init>(...);
|
||||
@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.
|
||||
-keep,allowobfuscation,allowshrinking class com.google.gson.reflect.TypeToken
|
||||
-keep,allowobfuscation,allowshrinking class * extends com.google.gson.reflect.TypeToken
|
||||
|
||||
-keep class it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse { *; }
|
||||
-keep class * extends it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse { *; }
|
||||
@@ -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.create_new_art.DialogCreateNewArtComponent;
|
||||
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.DialogExtraInfoModule;
|
||||
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,
|
||||
DialogExtraInfoModule.class,
|
||||
DialogAskDepositoModule.class,
|
||||
DialogChooseArtFromListaArtsModule.class
|
||||
DialogChooseArtFromListaArtsModule.class,
|
||||
DialogDeviceEndOfLifeModule.class
|
||||
})
|
||||
public interface MainApplicationComponent {
|
||||
|
||||
@@ -422,6 +425,8 @@ public interface MainApplicationComponent {
|
||||
|
||||
DialogChooseArtFromListaArtsComponent.Factory dialogChooseArtFromListaArtsComponent();
|
||||
|
||||
DialogDeviceEndOfLifeComponent.Factory dialogDeviceEndOfLifeComponent();
|
||||
|
||||
void inject(MainApplication 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.gest.contab_doc_interni.rest.DocInterniRESTConsumer;
|
||||
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.input_quantity_v2.DialogInputQuantityV2View;
|
||||
|
||||
@@ -263,12 +262,6 @@ public class MainApplicationModule {
|
||||
return new PosizioniRESTConsumer(restBuilder, systemRESTConsumer, executorService);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
ProdFabbisognoLineeProdRESTConsumer providesProdFabbisognoLineeProdRESTConsumer(RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer) {
|
||||
return new ProdFabbisognoLineeProdRESTConsumer(restBuilder, systemRESTConsumer);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
DocInterniRESTConsumer provideDocInterniRESTConsumer(RESTBuilder restBuilder, MagazzinoRESTConsumer magazzinoRESTConsumer) {
|
||||
@@ -283,8 +276,8 @@ public class MainApplicationModule {
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
GiacenzaPvRESTConsumer provideGiacenzaPvRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService) {
|
||||
return new GiacenzaPvRESTConsumer(restBuilder, executorService);
|
||||
GiacenzaPvRESTConsumer provideGiacenzaPvRESTConsumer(RESTBuilder restBuilder) {
|
||||
return new GiacenzaPvRESTConsumer(restBuilder);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@@ -313,14 +306,14 @@ public class MainApplicationModule {
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
DocumentRESTConsumer provideDocumentiRESTConsumer(RESTBuilder restBuilder) {
|
||||
return new DocumentRESTConsumer(restBuilder);
|
||||
DocumentRESTConsumer provideDocumentiRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService) {
|
||||
return new DocumentRESTConsumer(restBuilder, executorService);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
ColliAccettazioneRESTConsumer provideColliAccettazioneRESTConsumer(RESTBuilder restBuilder) {
|
||||
return new ColliAccettazioneRESTConsumer(restBuilder);
|
||||
ColliAccettazioneRESTConsumer provideColliAccettazioneRESTConsumer(ExecutorService executorService, RESTBuilder restBuilder) {
|
||||
return new ColliAccettazioneRESTConsumer(executorService, restBuilder);
|
||||
}
|
||||
|
||||
@Provides
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.text.SpannableString;
|
||||
@@ -12,8 +13,10 @@ import android.view.LayoutInflater;
|
||||
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
|
||||
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.main.MainActivity;
|
||||
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 {
|
||||
|
||||
@@ -65,9 +69,24 @@ public class SplashActivity extends BaseActivity implements MainContext.Listener
|
||||
|
||||
UtilityContext.initMainActivity(this);
|
||||
|
||||
LocalDate endSupportDate = LocalDate.of(2026, 1, 31);
|
||||
|
||||
initAppVersion();
|
||||
initPermissions(this::init);
|
||||
boolean isOldAndroid = Build.VERSION.SDK_INT < Build.VERSION_CODES.O;
|
||||
|
||||
executorService.execute(() -> {
|
||||
|
||||
if (isOldAndroid)
|
||||
showDeviceEndOfLifeMessage();
|
||||
|
||||
handler.post(() -> {
|
||||
if (LocalDate.now().isBefore(endSupportDate) || !isOldAndroid) {
|
||||
initAppVersion();
|
||||
initPermissions(this::init);
|
||||
} else {
|
||||
this.finish();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
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
|
||||
public void onDBDataLoading(String 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 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==";
|
||||
|
||||
public static Claims parseJwt(String token) {
|
||||
Jws<Claims> jws = Jwts.parserBuilder()
|
||||
.setSigningKey(Keys.hmacShaKeyFor(Decoders.BASE64.decode(SIGNING_KEY)))
|
||||
Jws<Claims> jws = Jwts.parser()
|
||||
.verifyWith(Keys.hmacShaKeyFor(Decoders.BASE64.decode(SIGNING_KEY)))
|
||||
.build()
|
||||
.parseClaimsJws(token);
|
||||
.parseSignedClaims(token);
|
||||
|
||||
return jws.getBody();
|
||||
return jws.getPayload();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,11 +89,25 @@ public class AppContext {
|
||||
private void initLogger() {
|
||||
Logger.addLogAdapter(new AndroidLogAdapter());
|
||||
|
||||
logsFolder = new File(mApplicationContext.getExternalFilesDir(null).getAbsolutePath());
|
||||
int maxBytesSize = 5 * 1024 * 1024;
|
||||
Logger.addLogAdapter(new DiskLogAdapter(logsFolder, maxBytesSize));
|
||||
File dataDir = mApplicationContext.getExternalFilesDir(null);
|
||||
|
||||
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);
|
||||
|
||||
int maxBytesSize = 5 * 1024 * 1024;
|
||||
Logger.addLogAdapter(new DiskLogAdapter(logsFolder, maxBytesSize));
|
||||
}
|
||||
|
||||
private void removeOldLogs(File logsFolder) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package it.integry.integrywmsnative.core.data_recover;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
@@ -10,7 +11,7 @@ public class ColliDataRecoverDTO {
|
||||
private int id;
|
||||
private int numCollo;
|
||||
private String serCollo;
|
||||
private String dataCollo;
|
||||
private LocalDate dataCollo;
|
||||
private String gestioneCollo;
|
||||
private String filtro;
|
||||
|
||||
@@ -43,11 +44,11 @@ public class ColliDataRecoverDTO {
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDataCollo() {
|
||||
public LocalDate getDataCollo() {
|
||||
return dataCollo;
|
||||
}
|
||||
|
||||
public ColliDataRecoverDTO setDataCollo(String dataCollo) {
|
||||
public ColliDataRecoverDTO setDataCollo(LocalDate dataCollo) {
|
||||
this.dataCollo = dataCollo;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package it.integry.integrywmsnative.core.data_recover;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.annimon.stream.Optional;
|
||||
import com.annimon.stream.Stream;
|
||||
import com.google.android.gms.common.util.IOUtils;
|
||||
import com.google.gson.Gson;
|
||||
@@ -14,6 +13,7 @@ import java.io.InputStream;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Random;
|
||||
|
||||
import javax.inject.Inject;
|
||||
@@ -65,9 +65,9 @@ public class ColliDataRecoverService {
|
||||
}
|
||||
|
||||
private ColliDataRecoverDTO getIfExists(int id) {
|
||||
Optional<ColliDataRecoverDTO> recoverDTOOptional = Stream.of(mtbColtsSessions)
|
||||
Optional<ColliDataRecoverDTO> recoverDTOOptional = mtbColtsSessions.stream()
|
||||
.filter(x -> x.getId() == id)
|
||||
.findSingle();
|
||||
.findFirst();
|
||||
|
||||
|
||||
return recoverDTOOptional.isPresent() ? recoverDTOOptional.get() : null;
|
||||
@@ -85,7 +85,7 @@ public class ColliDataRecoverService {
|
||||
|
||||
ColliDataRecoverDTO recoverDTO = new ColliDataRecoverDTO()
|
||||
.setId(newId)
|
||||
.setDataCollo(mtbColtSession.getDataColloS())
|
||||
.setDataCollo(mtbColtSession.getDataColloLD())
|
||||
.setNumCollo(mtbColtSession.getNumCollo())
|
||||
.setSerCollo(mtbColtSession.getSerCollo())
|
||||
.setGestioneCollo(mtbColtSession.getGestione())
|
||||
|
||||
@@ -4,9 +4,6 @@ import androidx.databinding.BaseObservable;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import it.integry.integrywmsnative.core.CommonConst;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityNumber;
|
||||
|
||||
public class BindableFloat extends BaseObservable {
|
||||
private Float value;
|
||||
|
||||
@@ -15,10 +12,6 @@ public class BindableFloat extends BaseObservable {
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ import android.widget.EditText;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.RadioButton;
|
||||
import android.widget.RadioGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.ColorRes;
|
||||
import androidx.appcompat.widget.AppCompatCheckBox;
|
||||
@@ -37,6 +38,8 @@ import java.math.BigDecimal;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.DecimalFormatSymbols;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
@@ -45,6 +48,7 @@ import it.integry.integrywmsnative.MainApplication;
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
|
||||
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.UtilityDate;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityNumber;
|
||||
@@ -261,7 +265,7 @@ public class Converters {
|
||||
BigDecimal value = null;
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(s.toString()))
|
||||
value = new BigDecimal(s.toString());
|
||||
value = UtilityNumber.parseBigDecimal(s.toString(), Locale.getDefault());
|
||||
|
||||
observableBigDecimal.set(value);
|
||||
}
|
||||
@@ -271,7 +275,7 @@ public class Converters {
|
||||
}
|
||||
|
||||
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)) {
|
||||
view.setText(UtilityNumber.decimalToString(newValue));
|
||||
@@ -292,7 +296,7 @@ public class Converters {
|
||||
String newValueString = s.toString().trim();
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(newValueString))
|
||||
value = new BigDecimal(newValueString);
|
||||
value = UtilityNumber.parseBigDecimal(newValueString, Locale.getDefault());
|
||||
|
||||
observableBigDecimal.set(value);
|
||||
}
|
||||
@@ -301,7 +305,7 @@ public class Converters {
|
||||
view.addTextChangedListener(watcher);
|
||||
}
|
||||
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)) {
|
||||
view.setText(UtilityNumber.decimalToString(newValue));
|
||||
@@ -322,7 +326,7 @@ public class Converters {
|
||||
String newValueString = s.toString().trim();
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(newValueString))
|
||||
value = new BigDecimal(newValueString);
|
||||
value = UtilityNumber.parseBigDecimal(newValueString, Locale.getDefault());
|
||||
|
||||
observableBigDecimal.set(value);
|
||||
}
|
||||
@@ -331,7 +335,7 @@ public class Converters {
|
||||
view.addTextChangedListener(watcher);
|
||||
}
|
||||
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)) {
|
||||
view.setText(UtilityNumber.decimalToString(newValue));
|
||||
@@ -350,7 +354,8 @@ public class Converters {
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
BigDecimal value = null;
|
||||
if (!UtilityString.isNullOrEmpty(s.toString()))
|
||||
value = new BigDecimal(s.toString());
|
||||
value = UtilityNumber.parseBigDecimal(s.toString(), Locale.getDefault());
|
||||
|
||||
bindableBigDecimal.set(value);
|
||||
}
|
||||
};
|
||||
@@ -358,7 +363,7 @@ public class Converters {
|
||||
view.addTextChangedListener(watcher);
|
||||
}
|
||||
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)) {
|
||||
view.setText(UtilityNumber.decimalToString(newValue));
|
||||
@@ -974,4 +979,64 @@ public class Converters {
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -66,9 +66,6 @@ public class Ean128Service {
|
||||
|
||||
switch (aiModel.AI) {
|
||||
case SSCC -> {
|
||||
if (aiValue.length() > 0 && (aiValue.charAt(0) == '0' || aiValue.charAt(0) == '9')) {
|
||||
aiValue = new StringBuilder(aiValue.substring(1));
|
||||
}
|
||||
model.Sscc = aiValue.toString();
|
||||
}
|
||||
case GTIN -> {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package it.integry.integrywmsnative.core.model;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
public class DtbDoct {
|
||||
@@ -10,7 +10,7 @@ public class DtbDoct {
|
||||
|
||||
private String codAnag;
|
||||
private String codDtip;
|
||||
private Date dataDoc;
|
||||
private LocalDate dataDoc;
|
||||
private Integer numDoc;
|
||||
private String serDoc;
|
||||
private BigDecimal acconto;
|
||||
@@ -41,14 +41,14 @@ public class DtbDoct {
|
||||
private String compilatoDa;
|
||||
private String userName;
|
||||
private String controllatoDa;
|
||||
private Date dataChkDoc;
|
||||
private Date dataDocVal;
|
||||
private Date dataInizTrasp;
|
||||
private Date dataIns;
|
||||
private Date dataOrd;
|
||||
private Date dataReg;
|
||||
private Date dataRifScad;
|
||||
private Date dataUltMod;
|
||||
private LocalDate dataChkDoc;
|
||||
private LocalDate dataDocVal;
|
||||
private LocalDate dataInizTrasp;
|
||||
private LocalDate dataIns;
|
||||
private LocalDate dataOrd;
|
||||
private LocalDate dataReg;
|
||||
private LocalDate dataRifScad;
|
||||
private LocalDate dataUltMod;
|
||||
private String descrizionePaga;
|
||||
private String flagPrzScontati;
|
||||
private String gestione;
|
||||
@@ -89,7 +89,7 @@ public class DtbDoct {
|
||||
private String targa;
|
||||
private Integer postiPallet;
|
||||
private BigDecimal tempMedia;
|
||||
private Date dataCons;
|
||||
private LocalDate dataCons;
|
||||
private BigDecimal nolo;
|
||||
private BigDecimal nolo2;
|
||||
private String conducente;
|
||||
@@ -102,7 +102,7 @@ public class DtbDoct {
|
||||
private String setDataDecorrenza2DataRic;
|
||||
private BigDecimal totSpese;
|
||||
private String chkArtListino;
|
||||
private Date dataCmov;
|
||||
private LocalDate dataCmov;
|
||||
private String reso;
|
||||
private Integer numCmovAutofattura;
|
||||
private Object dtbTipi;
|
||||
@@ -141,11 +141,11 @@ public class DtbDoct {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataDoc() {
|
||||
public LocalDate getDataDoc() {
|
||||
return dataDoc;
|
||||
}
|
||||
|
||||
public DtbDoct setDataDoc(Date dataDoc) {
|
||||
public DtbDoct setDataDoc(LocalDate dataDoc) {
|
||||
this.dataDoc = dataDoc;
|
||||
return this;
|
||||
}
|
||||
@@ -420,74 +420,74 @@ public class DtbDoct {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataChkDoc() {
|
||||
public LocalDate getDataChkDoc() {
|
||||
return dataChkDoc;
|
||||
}
|
||||
|
||||
public DtbDoct setDataChkDoc(Date dataChkDoc) {
|
||||
public DtbDoct setDataChkDoc(LocalDate dataChkDoc) {
|
||||
this.dataChkDoc = dataChkDoc;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataDocVal() {
|
||||
public LocalDate getDataDocVal() {
|
||||
return dataDocVal;
|
||||
}
|
||||
|
||||
public DtbDoct setDataDocVal(Date dataDocVal) {
|
||||
public DtbDoct setDataDocVal(LocalDate dataDocVal) {
|
||||
this.dataDocVal = dataDocVal;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataInizTrasp() {
|
||||
public LocalDate getDataInizTrasp() {
|
||||
return dataInizTrasp;
|
||||
}
|
||||
|
||||
public DtbDoct setDataInizTrasp(Date dataInizTrasp) {
|
||||
public DtbDoct setDataInizTrasp(LocalDate dataInizTrasp) {
|
||||
this.dataInizTrasp = dataInizTrasp;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataIns() {
|
||||
public LocalDate getDataIns() {
|
||||
return dataIns;
|
||||
}
|
||||
|
||||
public DtbDoct setDataIns(Date dataIns) {
|
||||
public DtbDoct setDataIns(LocalDate dataIns) {
|
||||
this.dataIns = dataIns;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataOrd() {
|
||||
public LocalDate getDataOrd() {
|
||||
return dataOrd;
|
||||
}
|
||||
|
||||
public DtbDoct setDataOrd(Date dataOrd) {
|
||||
public DtbDoct setDataOrd(LocalDate dataOrd) {
|
||||
this.dataOrd = dataOrd;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataReg() {
|
||||
public LocalDate getDataReg() {
|
||||
return dataReg;
|
||||
}
|
||||
|
||||
public DtbDoct setDataReg(Date dataReg) {
|
||||
public DtbDoct setDataReg(LocalDate dataReg) {
|
||||
this.dataReg = dataReg;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataRifScad() {
|
||||
public LocalDate getDataRifScad() {
|
||||
return dataRifScad;
|
||||
}
|
||||
|
||||
public DtbDoct setDataRifScad(Date dataRifScad) {
|
||||
public DtbDoct setDataRifScad(LocalDate dataRifScad) {
|
||||
this.dataRifScad = dataRifScad;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataUltMod() {
|
||||
public LocalDate getDataUltMod() {
|
||||
return dataUltMod;
|
||||
}
|
||||
|
||||
public DtbDoct setDataUltMod(Date dataUltMod) {
|
||||
public DtbDoct setDataUltMod(LocalDate dataUltMod) {
|
||||
this.dataUltMod = dataUltMod;
|
||||
return this;
|
||||
}
|
||||
@@ -852,11 +852,11 @@ public class DtbDoct {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataCons() {
|
||||
public LocalDate getDataCons() {
|
||||
return dataCons;
|
||||
}
|
||||
|
||||
public DtbDoct setDataCons(Date dataCons) {
|
||||
public DtbDoct setDataCons(LocalDate dataCons) {
|
||||
this.dataCons = dataCons;
|
||||
return this;
|
||||
}
|
||||
@@ -969,11 +969,11 @@ public class DtbDoct {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataCmov() {
|
||||
public LocalDate getDataCmov() {
|
||||
return dataCmov;
|
||||
}
|
||||
|
||||
public DtbDoct setDataCmov(Date dataCmov) {
|
||||
public DtbDoct setDataCmov(LocalDate dataCmov) {
|
||||
this.dataCmov = dataCmov;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -97,6 +97,8 @@ public class MtbAart extends EntityBase {
|
||||
|
||||
private List<MtbUntMis> mtbUntMis;
|
||||
|
||||
private List<MtbAartBarCode> mtbAartBarCode;
|
||||
|
||||
|
||||
public enum UntMisRifPesoEnum {
|
||||
C,
|
||||
@@ -965,6 +967,13 @@ public class MtbAart extends EntityBase {
|
||||
return getMtbUntMis() != null && !getMtbUntMis().isEmpty() ? getMtbUntMis().get(0) : null;
|
||||
}
|
||||
|
||||
public List<MtbAartBarCode> getMtbAartBarCode() {
|
||||
return mtbAartBarCode;
|
||||
}
|
||||
|
||||
public void setMtbAartBarCode(List<MtbAartBarCode> mtbAartBarCode) {
|
||||
this.mtbAartBarCode = mtbAartBarCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
package it.integry.integrywmsnative.core.model;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
public class MtbAartBarCode extends EntityBase {
|
||||
private String codBarre;
|
||||
private String codMart;
|
||||
private BigDecimal qtaCnf;
|
||||
private String flagPrimario;
|
||||
private String tipoCodBarre;
|
||||
|
||||
public MtbAartBarCode() {
|
||||
this.type = "mtb_aart_bar_code";
|
||||
}
|
||||
|
||||
public String getCodBarre() {
|
||||
return codBarre;
|
||||
}
|
||||
|
||||
public void setCodBarre(String codBarre) {
|
||||
this.codBarre = codBarre;
|
||||
}
|
||||
|
||||
public String getCodMart() {
|
||||
return codMart;
|
||||
}
|
||||
|
||||
public void setCodMart(String codMart) {
|
||||
this.codMart = codMart;
|
||||
}
|
||||
|
||||
public BigDecimal getQtaCnf() {
|
||||
return qtaCnf;
|
||||
}
|
||||
|
||||
public void setQtaCnf(BigDecimal qtaCnf) {
|
||||
this.qtaCnf = qtaCnf;
|
||||
}
|
||||
|
||||
public String getFlagPrimario() {
|
||||
return flagPrimario;
|
||||
}
|
||||
|
||||
public void setFlagPrimario(String flagPrimario) {
|
||||
this.flagPrimario = flagPrimario;
|
||||
}
|
||||
|
||||
public String getTipoCodBarre() {
|
||||
return tipoCodBarre;
|
||||
}
|
||||
|
||||
public void setTipoCodBarre(String tipoCodBarre) {
|
||||
this.tipoCodBarre = tipoCodBarre;
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,7 @@ public class MtbColr extends EntityBase {
|
||||
private String gestione;
|
||||
private String serCollo;
|
||||
private Integer numCollo;
|
||||
private String dataCollo;
|
||||
private LocalDate dataCollo;
|
||||
private Integer riga;
|
||||
private Integer rigaOrd;
|
||||
private String codMart;
|
||||
@@ -27,7 +27,7 @@ public class MtbColr extends EntityBase {
|
||||
private String serColloRif;
|
||||
private String note;
|
||||
private LocalDate dataOrd;
|
||||
private String dataColloRif;
|
||||
private LocalDate dataColloRif;
|
||||
private BigDecimal qtaCnf;
|
||||
private BigDecimal qtaCol;
|
||||
private Integer numOrd;
|
||||
@@ -164,21 +164,18 @@ public class MtbColr extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDataColloS() {
|
||||
|
||||
public LocalDate getDataColloLD() {
|
||||
return dataCollo;
|
||||
}
|
||||
|
||||
public Date getDataColloD() {
|
||||
return UtilityDate.recognizeDateWithExceptionHandler(getDataColloS());
|
||||
}
|
||||
|
||||
public MtbColr setDataCollo(String dataCollo) {
|
||||
this.dataCollo = dataCollo;
|
||||
this.dataCollo = UtilityDate.recognizeLocalDateWithExceptionHandler(dataCollo);
|
||||
return this;
|
||||
}
|
||||
|
||||
public MtbColr setDataCollo(Date dataCollo) {
|
||||
setDataCollo(UtilityDate.formatDate(dataCollo, UtilityDate.COMMONS_DATE_FORMATS.DMY_TIME_SLASH));
|
||||
public MtbColr setDataCollo(LocalDate dataCollo) {
|
||||
this.dataCollo = dataCollo;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -287,25 +284,24 @@ public class MtbColr extends EntityBase {
|
||||
}
|
||||
|
||||
public String getDataColloRifS() {
|
||||
return dataColloRif;
|
||||
return dataColloRif != null ? UtilityDate.COMMONS_DATE_FORMATS.DATE_DMY_SLASHED_FORMATTER.format(dataColloRif) : null;
|
||||
}
|
||||
|
||||
public Date getDataColloRifD() {
|
||||
return UtilityDate.recognizeDateWithExceptionHandler(getDataColloRifS());
|
||||
}
|
||||
|
||||
public MtbColr setDataColloRif(String dataColloRif) {
|
||||
this.dataColloRif = dataColloRif;
|
||||
return this;
|
||||
public LocalDate getDataColloRifLD() {
|
||||
return dataColloRif;
|
||||
}
|
||||
|
||||
public MtbColr setDataColloRif(Date dataColloRif) {
|
||||
this.dataColloRif = UtilityDate.formatDate(dataColloRif, UtilityDate.COMMONS_DATE_FORMATS.DMY_TIME_SLASH);
|
||||
public MtbColr setDataColloRif(String dataColloRif) {
|
||||
this.dataColloRif = UtilityDate.recognizeLocalDateWithExceptionHandler(dataColloRif);
|
||||
return this;
|
||||
}
|
||||
|
||||
public MtbColr setDataColloRif(LocalDate dataColloRif) {
|
||||
this.dataColloRif = UtilityDate.formatDate(dataColloRif, UtilityDate.COMMONS_DATE_FORMATS.DMY_SLASH);
|
||||
this.dataColloRif = dataColloRif;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -355,13 +351,10 @@ public class MtbColr extends EntityBase {
|
||||
}
|
||||
|
||||
|
||||
public String getDatetimeRowS() {
|
||||
public String getDatetimeRow() {
|
||||
return datetimeRow;
|
||||
}
|
||||
|
||||
public Date getDatetimeRowD() {
|
||||
return UtilityDate.recognizeDateWithExceptionHandler(getDatetimeRowS());
|
||||
}
|
||||
|
||||
public MtbColr setDatetimeRow(String datetimeRow) {
|
||||
this.datetimeRow = datetimeRow;
|
||||
|
||||
@@ -22,7 +22,6 @@ import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDB;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityLogger;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
|
||||
/**
|
||||
@@ -31,7 +30,7 @@ import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
|
||||
public class MtbColt extends EntityBase {
|
||||
private String gestione;
|
||||
private String dataCollo;
|
||||
private LocalDate dataCollo;
|
||||
private String serCollo;
|
||||
private Integer numCollo;
|
||||
private String rifOrd;
|
||||
@@ -86,7 +85,7 @@ public class MtbColt extends EntityBase {
|
||||
|
||||
public MtbColt() {
|
||||
type = "mtb_colt";
|
||||
setDataCollo(UtilityDate.getDateInstance());
|
||||
setDataCollo(LocalDate.now());
|
||||
setSerCollo("/");
|
||||
|
||||
if (SettingsManager.i().isUserLoggedIn()) {
|
||||
@@ -145,20 +144,13 @@ public class MtbColt extends EntityBase {
|
||||
}
|
||||
|
||||
public String getDataColloHumanLong() {
|
||||
Date dataColloD = null;
|
||||
try {
|
||||
dataColloD = getDataColloD();
|
||||
} catch (Exception ex) {
|
||||
UtilityLogger.error(ex);
|
||||
}
|
||||
|
||||
if (dataColloD != null) {
|
||||
return UtilityDate.formatDate(dataColloD, UtilityDate.COMMONS_DATE_FORMATS.DMY_HUMAN_LONG);
|
||||
if (dataCollo != null) {
|
||||
return UtilityDate.COMMONS_DATE_FORMATS.DATE_DMY_HUMAN_FORMATTER.format(dataCollo);
|
||||
} else return null;
|
||||
}
|
||||
|
||||
public String getDataColloS() {
|
||||
return dataCollo;
|
||||
return dataCollo != null ? UtilityDate.COMMONS_DATE_FORMATS.DATE_DMY_SLASHED_FORMATTER.format(dataCollo) : null;
|
||||
}
|
||||
|
||||
public Date getDataColloD() {
|
||||
@@ -166,21 +158,16 @@ public class MtbColt extends EntityBase {
|
||||
}
|
||||
|
||||
public LocalDate getDataColloLD() {
|
||||
return UtilityDate.recognizeLocalDateWithExceptionHandler(getDataColloS());
|
||||
return dataCollo;
|
||||
}
|
||||
|
||||
public MtbColt setDataCollo(String dataCollo) {
|
||||
this.dataCollo = dataCollo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MtbColt setDataCollo(Date dataCollo) {
|
||||
this.dataCollo = UtilityDate.formatDate(dataCollo, UtilityDate.COMMONS_DATE_FORMATS.DMY_TIME_SLASH);
|
||||
this.dataCollo = UtilityDate.recognizeLocalDateWithExceptionHandler(dataCollo);
|
||||
return this;
|
||||
}
|
||||
|
||||
public MtbColt setDataCollo(LocalDate dataCollo) {
|
||||
this.dataCollo = UtilityDate.formatDate(dataCollo, UtilityDate.COMMONS_DATE_FORMATS.DMY_SLASH);
|
||||
this.dataCollo = dataCollo;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Date;
|
||||
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityNumber;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
|
||||
@@ -306,7 +305,7 @@ public class MvwSitArtUdcDetInventario {
|
||||
return new MtbColr()
|
||||
.setCodJcom(getCodJcom())
|
||||
.setCodMart(getCodMart())
|
||||
.setDataCollo(UtilityDate.toDate(getDataCollo()))
|
||||
.setDataCollo(getDataCollo())
|
||||
.setNumCollo(getNumCollo())
|
||||
.setSerCollo(getSerCollo())
|
||||
.setGestione(getGestione())
|
||||
|
||||
@@ -3,7 +3,7 @@ package it.integry.integrywmsnative.core.model.dto;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
|
||||
public class AlreadyRegisteredUDCDTO {
|
||||
public class AlreadyRegisteredUlDTO {
|
||||
|
||||
private MtbColt mtbColt;
|
||||
|
||||
@@ -13,7 +13,7 @@ public class AlreadyRegisteredUDCDTO {
|
||||
return mtbColt;
|
||||
}
|
||||
|
||||
public AlreadyRegisteredUDCDTO setMtbColt(MtbColt mtbColt) {
|
||||
public AlreadyRegisteredUlDTO setMtbColt(MtbColt mtbColt) {
|
||||
this.mtbColt = mtbColt;
|
||||
return this;
|
||||
}
|
||||
@@ -22,7 +22,7 @@ public class AlreadyRegisteredUDCDTO {
|
||||
return canBeRecovered;
|
||||
}
|
||||
|
||||
public AlreadyRegisteredUDCDTO setCanBeRecovered(boolean canBeRecovered) {
|
||||
public AlreadyRegisteredUlDTO setCanBeRecovered(boolean canBeRecovered) {
|
||||
this.canBeRecovered = canBeRecovered;
|
||||
return this;
|
||||
}
|
||||
@@ -28,7 +28,7 @@ public class AuthInterceptor implements Interceptor {
|
||||
public Response intercept(@NonNull Chain chain) throws IOException {
|
||||
var originalRequest = chain.request();
|
||||
|
||||
if (SettingsManager.i().getUserSession() != null) {
|
||||
if (SettingsManager.i().getUserSession() != null && SettingsManager.i().getUserSession().getAccessToken() != null) {
|
||||
|
||||
var accessToken = SettingsManager.i().getUserSession().getAccessToken();
|
||||
var accessTokenExpiryDate = SettingsManager.i().getUserSession().getAccessTokenExpiryDate();
|
||||
@@ -55,21 +55,22 @@ public class AuthInterceptor implements Interceptor {
|
||||
.protocol(Protocol.HTTP_1_1)
|
||||
.code(401)
|
||||
.message("Unauthorized")
|
||||
.body(ResponseBody.create(new byte[0], null))
|
||||
.body(ResponseBody.create(okhttp3.MediaType.get("application/json"), new byte[0]))
|
||||
.build();
|
||||
} catch (Exception e) {
|
||||
return chain.proceed(originalRequest);
|
||||
}
|
||||
|
||||
//Retrieve the new access token after refresh
|
||||
accessToken = SettingsManager.i().getUserSession().getAccessToken();
|
||||
}
|
||||
|
||||
// Add the access token to the request header
|
||||
var authorizedRequest = originalRequest.newBuilder()
|
||||
.header("Authorization", "Bearer " + SettingsManager.i().getUserSession().getAccessToken())
|
||||
.build();
|
||||
// Add the access token to the request header
|
||||
var authorizedRequest = originalRequest.newBuilder()
|
||||
.header("Authorization", "Bearer " + accessToken)
|
||||
.build();
|
||||
|
||||
return chain.proceed(authorizedRequest);
|
||||
} else
|
||||
return chain.proceed(originalRequest);
|
||||
return chain.proceed(authorizedRequest);
|
||||
} else
|
||||
return chain.proceed(originalRequest);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package it.integry.integrywmsnative.core.rest;
|
||||
import java.io.IOException;
|
||||
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
import okhttp3.HttpUrl;
|
||||
import okhttp3.Interceptor;
|
||||
import okhttp3.Request;
|
||||
@@ -18,30 +18,28 @@ public class HttpInterceptor implements Interceptor {
|
||||
@Override
|
||||
public Response intercept(Chain chain) throws IOException {
|
||||
|
||||
final String PROFILE_DB = SettingsManager.i().getUserSession() == null ? null : SettingsManager.i().getUserSession().getProfileDB();
|
||||
final String APP_TOKEN = "fa3a21af-606b-4129-a22b-aedc2a52c7b6";
|
||||
final String PROFILE_DB = SettingsManager.i().getUserSession() == null ? null : SettingsManager.i().getUserSession().getProfileDB();
|
||||
final String APP_TOKEN = "fa3a21af-606b-4129-a22b-aedc2a52c7b6";
|
||||
|
||||
final Request request = chain.request();
|
||||
final HttpUrl url = request.url().newBuilder()
|
||||
.addQueryParameter("profileDb", PROFILE_DB)
|
||||
.build();
|
||||
HttpUrl.Builder urlBuilder = chain.request().url().newBuilder();
|
||||
|
||||
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("Accept", "*/*")
|
||||
.addHeader("x-app-token", APP_TOKEN);
|
||||
|
||||
|
||||
String accessToken = null;
|
||||
|
||||
//Nel caso in cui il token è scaduto e devo richiamare la refresh non bisogna passare il vecchio token
|
||||
if(SettingsManager.i().getUserSession().getAccessTokenExpiryDate() != null &&
|
||||
UtilityDate.getNowTime().isBefore(SettingsManager.i().getUserSession().getAccessTokenExpiryDate().minusSeconds(20))) {
|
||||
accessToken = SettingsManager.i().getUserSession().getAccessToken();
|
||||
}
|
||||
|
||||
if(accessToken != null)
|
||||
builder.header("Authorization", "Bearer " + accessToken);
|
||||
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
|
||||
.url(url)
|
||||
|
||||
@@ -37,19 +37,19 @@ public class RESTBuilder {
|
||||
}
|
||||
|
||||
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) {
|
||||
return getService(service, protocol, host, port, addInterceptors, true, 60);
|
||||
public <T> T getService(final Class<T> service, String protocol, String host, int port) {
|
||||
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) {
|
||||
return getService(service, protocol, host, port, addInterceptors, addEmsApi, 60);
|
||||
public <T> T getService(final Class<T> service, String protocol, String host, int port, boolean addEmsApi) {
|
||||
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();
|
||||
|
||||
timeout = 0;
|
||||
@@ -62,7 +62,7 @@ public class RESTBuilder {
|
||||
clientBuilder.retryOnConnectionFailure(true);
|
||||
|
||||
clientBuilder.addInterceptor(authInterceptor);
|
||||
if (addInterceptors) clientBuilder.addInterceptor(new HttpInterceptor());
|
||||
clientBuilder.addInterceptor(new HttpInterceptor());
|
||||
if (ADD_LOGGER_INTERCEPTOR) clientBuilder.addInterceptor(new HttpLoggerInterceptor());
|
||||
|
||||
OkHttpClient client = clientBuilder.build();
|
||||
|
||||
@@ -132,7 +132,7 @@ public class ArticoloRESTConsumer extends _BaseRESTConsumer {
|
||||
var codMarts = codMartToFind.parallelStream()
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.collect(Collectors.toUnmodifiableList());
|
||||
.collect(Collectors.toUnmodifiableList());
|
||||
ArticoloRESTConsumerService articoloRESTConsumer = restBuilder.getService(ArticoloRESTConsumerService.class);
|
||||
var response = articoloRESTConsumer
|
||||
.getByCodMart(new RetrieveArticoloByCodMartRequestDTO()
|
||||
@@ -197,17 +197,6 @@ public class ArticoloRESTConsumer extends _BaseRESTConsumer {
|
||||
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 {
|
||||
List<HashMap<String, Object>> whereCondList = inputUntMis.parallelStream()
|
||||
|
||||
@@ -2,6 +2,8 @@ package it.integry.integrywmsnative.core.rest.consumers;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import java.util.concurrent.ExecutorService;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
@@ -14,112 +16,133 @@ import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.core.rest.model.udc.CloseUDCRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.udc.CloseUDCResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.udc.CreateUDCRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.udc.CreateUDCResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.udc.DeleteUDCRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.udc.EditUDCRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.udc.EditUDCRowResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDCRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDCRowResponseDTO;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Response;
|
||||
|
||||
@Singleton
|
||||
public class ColliAccettazioneRESTConsumer extends _BaseRESTConsumer implements ColliCaricoRESTConsumerInterface {
|
||||
|
||||
private final ExecutorService executorService;
|
||||
private final RESTBuilder restBuilder;
|
||||
|
||||
public ColliAccettazioneRESTConsumer(RESTBuilder restBuilder) {
|
||||
public ColliAccettazioneRESTConsumer(ExecutorService executorService, RESTBuilder restBuilder) {
|
||||
this.executorService = executorService;
|
||||
this.restBuilder = restBuilder;
|
||||
}
|
||||
|
||||
public void createUDC(CreateUDCRequestDTO createUDCRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
@Override
|
||||
public MtbColt createUDCSynchronized(CreateUDCRequestDTO createUDCRequestDTO) throws Exception {
|
||||
ColliAccettazioneRESTConsumerService colliAccettazioneRESTConsumerService = restBuilder.getService(ColliAccettazioneRESTConsumerService.class);
|
||||
|
||||
colliAccettazioneRESTConsumerService.createUDC(createUDCRequestDTO)
|
||||
.enqueue(new ManagedErrorCallback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<CreateUDCResponseDTO>> call, Response<ServiceRESTResponse<CreateUDCResponseDTO>> response) {
|
||||
analyzeAnswer(response, "accettazione/createUDC", data -> onComplete.run(data.getMtbColt()), onFailed);
|
||||
}
|
||||
var response = colliAccettazioneRESTConsumerService.createUDC(createUDCRequestDTO)
|
||||
.execute();
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<CreateUDCResponseDTO>> call, @NonNull final Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
var data = analyzeAnswer(response, "accettazione/createUDC");
|
||||
return data.getMtbColt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createUDC(CreateUDCRequestDTO createUDCRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
MtbColt result = createUDCSynchronized(createUDCRequestDTO);
|
||||
onComplete.run(result);
|
||||
} catch (Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public CloseUDCResponseDTO synchronousCloseUDC(CloseUDCRequestDTO closeUDCRequestDTO) throws Exception {
|
||||
ColliAccettazioneRESTConsumerService colliAccettazioneRESTConsumerService = restBuilder.getService(ColliAccettazioneRESTConsumerService.class);
|
||||
|
||||
var response = colliAccettazioneRESTConsumerService.closeUDC(closeUDCRequestDTO)
|
||||
.execute();
|
||||
|
||||
return analyzeAnswer(response, "accettazione/closeUDC");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeUDC(CloseUDCRequestDTO closeUDCRequestDTO, RunnableArgs<CloseUDCResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
CloseUDCResponseDTO result = synchronousCloseUDC(closeUDCRequestDTO);
|
||||
onComplete.run(result);
|
||||
} catch (Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public MtbColr synchronousInsertUDCRow(InsertUDCRowRequestDTO insertUDCRowRequestDTO) throws Exception {
|
||||
ColliAccettazioneRESTConsumerService colliAccettazioneRESTConsumerService = restBuilder.getService(ColliAccettazioneRESTConsumerService.class);
|
||||
|
||||
colliAccettazioneRESTConsumerService.closeUDC(closeUDCRequestDTO)
|
||||
.enqueue(new ManagedErrorCallback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<CloseUDCResponseDTO>> call, Response<ServiceRESTResponse<CloseUDCResponseDTO>> response) {
|
||||
analyzeAnswer(response, "accettazione/closeUDC", onComplete, onFailed);
|
||||
}
|
||||
var response = colliAccettazioneRESTConsumerService.insertUDCRow(insertUDCRowRequestDTO)
|
||||
.execute();
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<CloseUDCResponseDTO>> call, @NonNull final Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
var data = analyzeAnswer(response, "accettazione/insertUDCRow");
|
||||
|
||||
return data.getSavedMtbColr();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertUDCRow(InsertUDCRowRequestDTO insertUDCRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
onComplete.run(synchronousInsertUDCRow(insertUDCRowRequestDTO));
|
||||
} catch (Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public MtbColr synchronousEditUDCRow(EditUDCRowRequestDTO editUDCRowRequestDTO) throws Exception {
|
||||
ColliAccettazioneRESTConsumerService colliAccettazioneRESTConsumerService = restBuilder.getService(ColliAccettazioneRESTConsumerService.class);
|
||||
|
||||
colliAccettazioneRESTConsumerService.insertUDCRow(insertUDCRowRequestDTO)
|
||||
.enqueue(new ManagedErrorCallback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<InsertUDCRowResponseDTO>> call, Response<ServiceRESTResponse<InsertUDCRowResponseDTO>> response) {
|
||||
analyzeAnswer(response, "accettazione/insertUDCRow", data -> onComplete.run(data.getSavedMtbColr()), onFailed);
|
||||
}
|
||||
var response = colliAccettazioneRESTConsumerService.editUDCRow(editUDCRowRequestDTO)
|
||||
.execute();
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<InsertUDCRowResponseDTO>> call, @NonNull final Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
var data = analyzeAnswer(response, "accettazione/editUDCRow");
|
||||
return data.getSavedMtbColr();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void editUDCRow(EditUDCRowRequestDTO editUDCRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
onComplete.run(synchronousEditUDCRow(editUDCRowRequestDTO));
|
||||
} catch (Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void synchronousDeleteUDCRow(DeleteUDCRowRequestDTO deleteUDCRowRequestDTO) throws Exception {
|
||||
ColliAccettazioneRESTConsumerService colliAccettazioneRESTConsumerService = restBuilder.getService(ColliAccettazioneRESTConsumerService.class);
|
||||
|
||||
colliAccettazioneRESTConsumerService.editUDCRow(editUDCRowRequestDTO)
|
||||
.enqueue(new ManagedErrorCallback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<EditUDCRowResponseDTO>> call, Response<ServiceRESTResponse<EditUDCRowResponseDTO>> response) {
|
||||
analyzeAnswer(response, "accettazione/editUDCRow", data -> onComplete.run(data.getSavedMtbColr()), onFailed);
|
||||
}
|
||||
var response = colliAccettazioneRESTConsumerService.deleteUDCRow(deleteUDCRowRequestDTO)
|
||||
.execute();
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<EditUDCRowResponseDTO>> call, @NonNull final Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
analyzeAnswer(response, "accettazione/deleteUDCRow");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteUDCRow(DeleteUDCRowRequestDTO deleteUDCRowRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ColliAccettazioneRESTConsumerService colliAccettazioneRESTConsumerService = restBuilder.getService(ColliAccettazioneRESTConsumerService.class);
|
||||
|
||||
colliAccettazioneRESTConsumerService.deleteUDCRow(deleteUDCRowRequestDTO)
|
||||
.enqueue(new ManagedErrorCallback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
|
||||
analyzeAnswer(response, "accettazione/deleteUDCRow", data -> onComplete.run(), onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
synchronousDeleteUDCRow(deleteUDCRowRequestDTO);
|
||||
onComplete.run();
|
||||
} catch (Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void checkBarcodeUl(String barcodeUl, RunnableArgs<Boolean> onComplete, RunnableArgs<Exception> onFailed){
|
||||
|
||||
@@ -20,10 +20,8 @@ import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.core.rest.model.udc.CloseUDCRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.udc.CloseUDCResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.udc.CreateUDCRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.udc.CreateUDCResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.udc.DeleteUDCRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.udc.EditUDCRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.udc.EditUDCRowResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSFromArtRequestDTO;
|
||||
@@ -31,7 +29,6 @@ import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.DeleteUDSRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.EditUDSRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDCRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDCRowResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowResponseDTO;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
@@ -53,75 +50,93 @@ public class ColliLavorazioneRESTConsumer extends _BaseRESTConsumer implements C
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createUDC(CreateUDCRequestDTO createUDCRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public MtbColt createUDCSynchronized(CreateUDCRequestDTO createUDCRequestDTO) throws Exception {
|
||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||
|
||||
colliLavorazioneRESTConsumerService.createUDC(createUDCRequestDTO)
|
||||
.enqueue(new ManagedErrorCallback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<CreateUDCResponseDTO>> call, Response<ServiceRESTResponse<CreateUDCResponseDTO>> response) {
|
||||
analyzeAnswer(response, "lavorazione/createUDC", data -> onComplete.run(data.getMtbColt()), onFailed);
|
||||
}
|
||||
var response = colliLavorazioneRESTConsumerService.createUDC(createUDCRequestDTO)
|
||||
.execute();
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<CreateUDCResponseDTO>> call, @NonNull final Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
var data = analyzeAnswer(response, "lavorazione/createUDC");
|
||||
return data.getMtbColt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createUDC(CreateUDCRequestDTO createUDCRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
MtbColt result = createUDCSynchronized(createUDCRequestDTO);
|
||||
onComplete.run(result);
|
||||
} catch (Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public CloseUDCResponseDTO synchronousCloseUDC(CloseUDCRequestDTO closeUDCRequestDTO) throws Exception {
|
||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||
|
||||
var response = colliLavorazioneRESTConsumerService.closeUDC(closeUDCRequestDTO)
|
||||
.execute();
|
||||
|
||||
return analyzeAnswer(response, "lavorazione/closeUDC");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeUDC(CloseUDCRequestDTO closeUDCRequestDTO, RunnableArgs<CloseUDCResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
CloseUDCResponseDTO result = synchronousCloseUDC(closeUDCRequestDTO);
|
||||
onComplete.run(result);
|
||||
} catch (Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public MtbColr synchronousInsertUDCRow(InsertUDCRowRequestDTO insertUDCRowRequestDTO) throws Exception {
|
||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||
|
||||
colliLavorazioneRESTConsumerService.closeUDC(closeUDCRequestDTO)
|
||||
.enqueue(new ManagedErrorCallback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<CloseUDCResponseDTO>> call, Response<ServiceRESTResponse<CloseUDCResponseDTO>> response) {
|
||||
analyzeAnswer(response, "lavorazione/closeUDC", onComplete, onFailed);
|
||||
}
|
||||
var response = colliLavorazioneRESTConsumerService.insertUDCRow(insertUDCRowRequestDTO)
|
||||
.execute();
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<CloseUDCResponseDTO>> call, @NonNull final Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
var data = analyzeAnswer(response, "lavorazione/insertUDCRow");
|
||||
|
||||
return data.getSavedMtbColr();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertUDCRow(InsertUDCRowRequestDTO insertUDCRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
onComplete.run(synchronousInsertUDCRow(insertUDCRowRequestDTO));
|
||||
} catch (Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public MtbColr synchronousEditUDCRow(EditUDCRowRequestDTO editUDCRowRequestDTO) throws Exception {
|
||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||
|
||||
colliLavorazioneRESTConsumerService.insertUDCRow(insertUDCRowRequestDTO)
|
||||
.enqueue(new ManagedErrorCallback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<InsertUDCRowResponseDTO>> call, Response<ServiceRESTResponse<InsertUDCRowResponseDTO>> response) {
|
||||
analyzeAnswer(response, "lavorazione/insertUDCRow", data -> onComplete.run(data.getSavedMtbColr()), onFailed);
|
||||
}
|
||||
var response = colliLavorazioneRESTConsumerService.editUDCRow(editUDCRowRequestDTO)
|
||||
.execute();
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<InsertUDCRowResponseDTO>> call, @NonNull final Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
var data = analyzeAnswer(response, "lavorazione/editUDCRow");
|
||||
return data.getSavedMtbColr();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void editUDCRow(EditUDCRowRequestDTO editUDCRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||
|
||||
colliLavorazioneRESTConsumerService.editUDCRow(editUDCRowRequestDTO)
|
||||
.enqueue(new ManagedErrorCallback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<EditUDCRowResponseDTO>> call, Response<ServiceRESTResponse<EditUDCRowResponseDTO>> response) {
|
||||
analyzeAnswer(response, "lavorazione/editUDCRow", data -> onComplete.run(data.getSavedMtbColr()), onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<EditUDCRowResponseDTO>> call, @NonNull final Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
onComplete.run(synchronousEditUDCRow(editUDCRowRequestDTO));
|
||||
} catch (Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public MtbColt createUDSSynchronized(CreateUDSRequestDTO createUDSRequestDTO) throws Exception {
|
||||
@@ -231,22 +246,26 @@ public class ColliLavorazioneRESTConsumer extends _BaseRESTConsumer implements C
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void deleteUDCRow(DeleteUDCRowRequestDTO deleteUDCRowRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public void synchronousDeleteUDCRow(DeleteUDCRowRequestDTO deleteUDCRowRequestDTO) throws Exception {
|
||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||
|
||||
colliLavorazioneRESTConsumerService.deleteUDCRow(deleteUDCRowRequestDTO)
|
||||
.enqueue(new ManagedErrorCallback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
|
||||
analyzeAnswer(response, "lavorazione/deleteUDCRow", data -> onComplete.run(), onFailed);
|
||||
}
|
||||
var response = colliLavorazioneRESTConsumerService.deleteUDCRow(deleteUDCRowRequestDTO)
|
||||
.execute();
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
analyzeAnswer(response, "lavorazione/deleteUDCRow");
|
||||
}
|
||||
@Override
|
||||
public void deleteUDCRow(DeleteUDCRowRequestDTO deleteUDCRowRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
synchronousDeleteUDCRow(deleteUDCRowRequestDTO);
|
||||
onComplete.run();
|
||||
} catch (Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -11,18 +11,19 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
||||
import it.integry.integrywmsnative.BuildConfig;
|
||||
import it.integry.integrywmsnative.core.CommonConst;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
@@ -160,11 +161,11 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
mtbColrClone
|
||||
.setNumCollo(null)
|
||||
.setDataCollo((String) null)
|
||||
.setDataCollo((LocalDate) null)
|
||||
.setRiga(null)
|
||||
.setGestione(GestioneEnum.LAVORAZIONE)
|
||||
|
||||
.setDataColloRif(sourceMtbColt.getDataColloD())
|
||||
.setDataColloRif(sourceMtbColt.getDataColloLD())
|
||||
.setNumColloRif(sourceMtbColt.getNumCollo())
|
||||
.setGestioneRif(sourceMtbColt.getGestione())
|
||||
.setSerColloRif(sourceMtbColt.getSerCollo())
|
||||
@@ -214,10 +215,10 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
MtbColr mtbColrClone = new MtbColr();
|
||||
mtbColrClone
|
||||
.setNumCollo(null)
|
||||
.setDataCollo((String) null)
|
||||
.setDataCollo((LocalDate) null)
|
||||
.setRiga(null)
|
||||
.setGestione(GestioneEnum.LAVORAZIONE)
|
||||
.setDataColloRif(sourceMtbColt.getDataColloD())
|
||||
.setDataColloRif(sourceMtbColt.getDataColloLD())
|
||||
.setNumColloRif(sourceMtbColt.getNumCollo())
|
||||
.setGestioneRif(sourceMtbColt.getGestione())
|
||||
.setSerColloRif(sourceMtbColt.getSerCollo())
|
||||
@@ -244,10 +245,6 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
saveCollo(newMtbColt, onComplete, onFailed);
|
||||
}
|
||||
|
||||
public void createColloFromEtichettaAnonima(BarcodeScanDTO barcodeScanDTO, GestioneEnum gestione, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
createColloFromEtichettaAnonima(barcodeScanDTO.getStringValue(), gestione, onComplete, onFailed);
|
||||
}
|
||||
|
||||
public void createColloFromEtichettaAnonima(String barcode, GestioneEnum gestione, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
MtbColt mtbColtToCreate = new MtbColt()
|
||||
@@ -309,6 +306,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public List<MtbColr> fillMtbAartsOfMtbColrsSynchronized(List<MtbColr> mtbColrs) throws Exception {
|
||||
|
||||
List<String> codMarts = new ArrayList<>(mtbColrs.stream()
|
||||
@@ -350,29 +348,24 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
.collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
List<MtbAart> mtbAarts = mArticoloRESTConsumer.getByCodMartsSynchronized(codMarts);
|
||||
List<MtbAart> artList = mArticoloRESTConsumer.getByCodMartsSynchronized(codMarts);
|
||||
if (artList == null)
|
||||
artList = new ArrayList<>();
|
||||
|
||||
Map<String, MtbAart> mtbAartsMap = artList.parallelStream()
|
||||
.collect(Collectors.toMap(mtbAart -> mtbAart.getCodMart().toUpperCase(), x -> x));
|
||||
|
||||
for (MtbColt mtbColt : mtbColts) {
|
||||
for (MtbColr mtbColr : mtbColt.getMtbColr()) {
|
||||
|
||||
if (mtbAarts != null && !mtbAarts.isEmpty()) {
|
||||
MtbAart foundMtbAart = null;
|
||||
|
||||
List<MtbAart> mtbAartStream = mtbAarts.parallelStream()
|
||||
.filter(x -> x.getCodMart().equalsIgnoreCase(mtbColr.getCodMart()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if (!mtbAartStream.isEmpty()) {
|
||||
foundMtbAart = mtbAartStream.get(0);
|
||||
}
|
||||
|
||||
mtbColr.setMtbAart(foundMtbAart);
|
||||
if (mtbAartsMap.containsKey(mtbColr.getCodMart().toUpperCase())) {
|
||||
mtbColr.setMtbAart(mtbAartsMap.get(mtbColr.getCodMart().toUpperCase()));
|
||||
}
|
||||
|
||||
mtbColr.setGestione(mtbColt.getGestione());
|
||||
mtbColr.setSerCollo(mtbColt.getSerCollo());
|
||||
mtbColr.setNumCollo(mtbColt.getNumCollo());
|
||||
mtbColr.setDataCollo(mtbColt.getDataColloS());
|
||||
mtbColr.setDataCollo(mtbColt.getDataColloLD());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -408,7 +401,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()
|
||||
.setGestione(gestione)
|
||||
.setNumCollo(numCollo)
|
||||
@@ -418,7 +411,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
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()
|
||||
.setGestione(gestione)
|
||||
.setNumCollo(numCollo)
|
||||
@@ -455,7 +448,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
});
|
||||
}
|
||||
|
||||
public void spostaUlSynchronized(MtbColt mtbColtToMove, String codMdep, String posizione, boolean createDocAutomatically) throws Exception {
|
||||
public void spostaUlSynchronized(MtbColt mtbColtToMove, String codMdep, String posizione, boolean createDocAutomatically, boolean enableDocumentDailyGrouping) throws Exception {
|
||||
MtbColt mtbColtToMoveClone = (MtbColt) mtbColtToMove.clone();
|
||||
|
||||
for (int i = 0; i < mtbColtToMoveClone.getMtbColr().size(); i++) {
|
||||
@@ -478,11 +471,19 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
analyzeAnswer(response, "spostaUL");
|
||||
}
|
||||
|
||||
public void spostaUlSynchronized(MtbColt mtbColtToMove, MtbDepoPosizione posizione, boolean enableDocumentDailyGrouping) throws Exception {
|
||||
|
||||
public void spostaUL(MtbColt mtbColtToMove, String codMdep, String posizione, boolean createDocAutomatically, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
String codMdep = posizione.getCodMdep();
|
||||
String posizioneString = posizione.getPosizione();
|
||||
|
||||
spostaUlSynchronized(mtbColtToMove, codMdep, posizioneString, true, enableDocumentDailyGrouping);
|
||||
}
|
||||
|
||||
|
||||
public void spostaUL(MtbColt mtbColtToMove, String codMdep, String posizione, boolean createDocAutomatically, boolean enableDocumentDailyGrouping, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
spostaUlSynchronized(mtbColtToMove, codMdep, posizione, createDocAutomatically);
|
||||
spostaUlSynchronized(mtbColtToMove, codMdep, posizione, createDocAutomatically, enableDocumentDailyGrouping);
|
||||
if (onComplete != null) onComplete.run();
|
||||
} catch (Exception ex) {
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
@@ -490,14 +491,6 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
});
|
||||
}
|
||||
|
||||
public void spostaUL(MtbColt mtbColtToMove, MtbDepoPosizione posizione, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
String codMdep = posizione.getCodMdep();
|
||||
String posizioneString = posizione.getPosizione();
|
||||
|
||||
spostaUL(mtbColtToMove, codMdep, posizioneString, true, onComplete, onFailed);
|
||||
}
|
||||
|
||||
public void updateTipoULSynchronized(MtbColt mtbColt, String codTcol) throws Exception {
|
||||
|
||||
MtbColt mtbColtClone = (MtbColt) mtbColt.clone();
|
||||
|
||||
@@ -3,6 +3,7 @@ package it.integry.integrywmsnative.core.rest.consumers;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
@@ -20,9 +21,11 @@ import retrofit2.Response;
|
||||
public class DocumentRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
private final RESTBuilder restBuilder;
|
||||
private final ExecutorService executorService;
|
||||
|
||||
public DocumentRESTConsumer(RESTBuilder restBuilder) {
|
||||
public DocumentRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService) {
|
||||
this.restBuilder = restBuilder;
|
||||
this.executorService = executorService;
|
||||
}
|
||||
|
||||
public void createDocsFromColli(List<LoadColliDTO> listColli, RunnableArgs<List<DtbDoct>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
@@ -40,17 +43,22 @@ public class DocumentRESTConsumer extends _BaseRESTConsumer {
|
||||
});
|
||||
}
|
||||
|
||||
public void createDocFromColli(LoadColliDTO loadColliDTO, RunnableArgs<DtbDoct> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public DtbDoct makeSynchronousCreateDocFromColliRequest(LoadColliDTO loadColliDTO) throws Exception {
|
||||
DocumentiRESTConsumerService documentiRESTConsumerService = restBuilder.getService(DocumentiRESTConsumerService.class);
|
||||
documentiRESTConsumerService.createDocFromColli(loadColliDTO).enqueue(new ManagedErrorCallback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<DtbDoct>> call, Response<ServiceRESTResponse<DtbDoct>> response) {
|
||||
analyzeAnswer(response, "createDocFromColli", onComplete, onFailed);
|
||||
}
|
||||
var response = documentiRESTConsumerService
|
||||
.createDocFromColli(loadColliDTO)
|
||||
.execute();
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<DtbDoct>> call, @NonNull final Exception e) {
|
||||
onFailed.run(e);
|
||||
return analyzeAnswer(response, "createDocFromColli");
|
||||
}
|
||||
|
||||
public void makeCreateDocFromColliRequest(LoadColliDTO loadColliDTO, RunnableArgs<DtbDoct> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
var result = makeSynchronousCreateDocFromColliRequest(loadColliDTO);
|
||||
if (onComplete != null) onComplete.run(result);
|
||||
} catch (Exception ex) {
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -5,37 +5,57 @@ import java.util.List;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
|
||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||
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.GiacenzaPvDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.pv.SaveNewVerificaRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.pv.SaveNewRowVerificaRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.pv.UpdateRowVerificaRequestDTO;
|
||||
|
||||
public class GiacenzaPvRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
|
||||
private final RESTBuilder restBuilder;
|
||||
private final ExecutorService executorService;
|
||||
|
||||
public GiacenzaPvRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService) {
|
||||
public GiacenzaPvRESTConsumer(RESTBuilder restBuilder) {
|
||||
this.restBuilder = restBuilder;
|
||||
this.executorService = executorService;
|
||||
}
|
||||
|
||||
|
||||
public List<GiacenzaPvDTO> retrieveGiacenzeSynchronized(String codMdep) throws Exception {
|
||||
public List<GiacenzaPvDTO> retrieveGiacenzeSynchronized(String codMdep, String codMart) throws Exception {
|
||||
GiacenzaPvRESTConsumerService giacenzaPvRESTConsumerService = restBuilder.getService(GiacenzaPvRESTConsumerService.class, 120);
|
||||
var response = giacenzaPvRESTConsumerService.retrieve(codMdep)
|
||||
.execute();
|
||||
var response = giacenzaPvRESTConsumerService.retrieve(codMdep, codMart).execute();
|
||||
|
||||
var giacenzeList = analyzeAnswer(response, "retrieve-giacenze-pv");
|
||||
|
||||
return giacenzeList != null ? giacenzeList : new ArrayList<>();
|
||||
}
|
||||
|
||||
public void saveNewVerificaSynchronized(SaveNewVerificaRequestDTO saveNewVerificaRequest) throws Exception {
|
||||
public void saveNewRowSynchronized(SaveNewRowVerificaRequestDTO saveNewRowVerificaRequest) throws Exception {
|
||||
GiacenzaPvRESTConsumerService giacenzaPvRESTConsumerService = restBuilder.getService(GiacenzaPvRESTConsumerService.class, 0);
|
||||
var response = giacenzaPvRESTConsumerService.saveNewVerifica(saveNewVerificaRequest)
|
||||
var response = giacenzaPvRESTConsumerService.saveNewRowVerifica(saveNewRowVerificaRequest)
|
||||
.execute();
|
||||
|
||||
analyzeAnswer(response, "save-verifica-pv");
|
||||
analyzeAnswer(response, "save-row-verifica-pv");
|
||||
}
|
||||
|
||||
public void updateRowSynchronized(UpdateRowVerificaRequestDTO updateRowVerificaRequest) throws Exception {
|
||||
GiacenzaPvRESTConsumerService giacenzaPvRESTConsumerService = restBuilder.getService(GiacenzaPvRESTConsumerService.class, 0);
|
||||
var response = giacenzaPvRESTConsumerService.updateRowVerifica(updateRowVerificaRequest)
|
||||
.execute();
|
||||
|
||||
analyzeAnswer(response, "update-row-verifica-pv");
|
||||
}
|
||||
|
||||
public void deleteRowSynchronized(DeleteRowVerificaRequestDTO deleteRowVerificaRequest) throws Exception {
|
||||
GiacenzaPvRESTConsumerService giacenzaPvRESTConsumerService = restBuilder.getService(GiacenzaPvRESTConsumerService.class, 0);
|
||||
var response = giacenzaPvRESTConsumerService.deleteRowVerifica(deleteRowVerificaRequest)
|
||||
.execute();
|
||||
|
||||
analyzeAnswer(response, "delete-row-verifica-pv");
|
||||
}
|
||||
|
||||
public void closeVerifica(CloseVerificaRequestDTO closeVerificaRequestDTO) throws Exception {
|
||||
GiacenzaPvRESTConsumerService giacenzaPvRESTConsumerService = restBuilder.getService(GiacenzaPvRESTConsumerService.class, 0);
|
||||
var response = giacenzaPvRESTConsumerService.closeVerifica(closeVerificaRequestDTO)
|
||||
.execute();
|
||||
|
||||
analyzeAnswer(response, "close-verifica-pv");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,11 @@ 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.pv.CloseVerificaRequestDTO;
|
||||
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.SaveNewVerificaRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.pv.SaveNewRowVerificaRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.pv.UpdateRowVerificaRequestDTO;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.http.Body;
|
||||
import retrofit2.http.GET;
|
||||
@@ -14,9 +17,17 @@ import retrofit2.http.Query;
|
||||
public interface GiacenzaPvRESTConsumerService {
|
||||
|
||||
@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")
|
||||
Call<ServiceRESTResponse<Void>> saveNewRowVerifica(@Body SaveNewRowVerificaRequestDTO saveNewRowVerificaRequest);
|
||||
|
||||
@POST("wms/pv/verifica_giacenze/save_new_verifica")
|
||||
Call<ServiceRESTResponse<Void>> saveNewVerifica(@Body SaveNewVerificaRequestDTO saveNewVerificaRequest);
|
||||
@POST("wms/pv/verifica_giacenze/update_row")
|
||||
Call<ServiceRESTResponse<Void>> updateRowVerifica(@Body UpdateRowVerificaRequestDTO updateRowVerificaRequest);
|
||||
|
||||
@POST("wms/pv/verifica_giacenze/delete_row")
|
||||
Call<ServiceRESTResponse<Void>> deleteRowVerifica(@Body DeleteRowVerificaRequestDTO deleteRowVerificaRequest);
|
||||
|
||||
@POST("wms/pv/verifica_giacenze/close_verifica")
|
||||
Call<ServiceRESTResponse<Void>> closeVerifica(@Body CloseVerificaRequestDTO closeVerificaRequest);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package it.integry.integrywmsnative.core.rest.consumers;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import java.util.concurrent.ExecutorService;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
@@ -9,12 +7,8 @@ import javax.inject.Singleton;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.core.rest.model.magazzino_automatico.MagazzinoAutomaticoPickItemsRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.magazzino_automatico.MagazzinoAutomaticoPutItemsRequestDTO;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Response;
|
||||
|
||||
@Singleton
|
||||
public class MagazzinoAutomaticoRESTConsumer extends _BaseRESTConsumer {
|
||||
@@ -49,20 +43,12 @@ public class MagazzinoAutomaticoRESTConsumer extends _BaseRESTConsumer {
|
||||
}
|
||||
|
||||
|
||||
public void putItems(MtbDepoPosizione posizione, MagazzinoAutomaticoPutItemsRequestDTO magazzinoAutomaticoPutItemsRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public void makeSynchronousPutItemsRequest(MtbDepoPosizione posizione, MagazzinoAutomaticoPutItemsRequestDTO magazzinoAutomaticoPutItemsRequestDTO) throws Exception {
|
||||
MagazzinoAutomaticoRESTConsumerService magazzinoAutomaticoRESTConsumerService = restBuilder.getService(MagazzinoAutomaticoRESTConsumerService.class);
|
||||
magazzinoAutomaticoRESTConsumerService.putItems(posizione.getPosizione(), magazzinoAutomaticoPutItemsRequestDTO)
|
||||
.enqueue(new ManagedErrorCallback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
|
||||
analyzeAnswer(response, "magazzino-automatico/putItems", data -> onComplete.run(), onFailed);
|
||||
}
|
||||
var response = magazzinoAutomaticoRESTConsumerService.putItems(posizione.getPosizione(), magazzinoAutomaticoPutItemsRequestDTO)
|
||||
.execute();
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
var data = analyzeAnswer(response, "magazzino-automatico/putItems");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package it.integry.integrywmsnative.core.rest.consumers;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
|
||||
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.model.materiali.RecuperaMaterialiRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.materiali.VersaMaterialiRequestDTO;
|
||||
import it.integry.integrywmsnative.gest.prod_recupero_materiale.dto.HistoryVersamentoProdULRestDTO;
|
||||
|
||||
@Singleton
|
||||
public class MaterialiRESTConsumer extends _BaseRESTConsumer {
|
||||
@@ -21,6 +23,28 @@ public class MaterialiRESTConsumer extends _BaseRESTConsumer {
|
||||
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 {
|
||||
var materialiRESTConsumerService = restBuilder.getService(MaterialiRESTConsumerService.class);
|
||||
|
||||
|
||||
@@ -1,17 +1,26 @@
|
||||
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.materiali.RecuperaMaterialiRequestDTO;
|
||||
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.VersaMaterialiResponseDTO;
|
||||
import it.integry.integrywmsnative.gest.prod_recupero_materiale.dto.HistoryVersamentoProdULRestDTO;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.http.Body;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.POST;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
public interface MaterialiRESTConsumerService {
|
||||
|
||||
@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")
|
||||
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.getOrdiniLavorazione(flagEvaso)
|
||||
.enqueue(new ManagedErrorCallback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<List<OrdineLavorazioneDTO>>> call, Response<ServiceRESTResponse<List<OrdineLavorazioneDTO>>> response) {
|
||||
analyzeAnswer(response, "getOrdiniLavorazione", (m) -> onComplete.run(response.body().getDto()), onFailed);
|
||||
}
|
||||
var response = mesRESTConsumerService.getOrdiniLavorazione(flagEvaso)
|
||||
.execute();
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<List<OrdineLavorazioneDTO>>> call, @NonNull final Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
var data = analyzeAnswer(response, "mes_v2/getOrdiniLavorazione");
|
||||
return data;
|
||||
}
|
||||
|
||||
public void getLineeProduzione(String codJfasParent, RunnableArgs<List<JtbFasi>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
@@ -4,11 +4,8 @@ import androidx.annotation.NonNull;
|
||||
|
||||
import com.annimon.stream.Optional;
|
||||
import com.annimon.stream.Stream;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
@@ -21,6 +18,7 @@ import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.model.MtbPartitaMag;
|
||||
import it.integry.integrywmsnative.core.model.OrdineInevasoDTO;
|
||||
import it.integry.integrywmsnative.core.model.dto.AlreadyRegisteredUlDTO;
|
||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
|
||||
@@ -28,8 +26,7 @@ import it.integry.integrywmsnative.core.rest.model.GetPickingListDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.OrdineUscitaInevasoDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.core.rest.model.SitArtOrdDTO;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDB;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityQuery;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.RetrieveAlreadyRegisteredUdsRequestDTO;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
import it.integry.integrywmsnative.gest.spedizione.model.PickingObjectDTO;
|
||||
import retrofit2.Call;
|
||||
@@ -180,44 +177,27 @@ public class OrdiniRESTConsumer extends _BaseRESTConsumer {
|
||||
});
|
||||
}
|
||||
|
||||
public void getBancaliGiaRegistrati(List<OrdineInevasoDTO> orders, GestioneEnum gestione, int segno, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
String whereCondGestione = "";
|
||||
public List<AlreadyRegisteredUlDTO> getBancaliGiaRegistratiSynchronized(List<? extends OrdineInevasoDTO> orders, int segno) throws Exception {
|
||||
OrdiniRESTConsumerService service = restBuilder.getService(OrdiniRESTConsumerService.class);
|
||||
|
||||
if (gestione != null) {
|
||||
whereCondGestione = "mtb_colt.gestione = " + UtilityDB.valueToString(gestione.getText()) + " ";
|
||||
} else {
|
||||
whereCondGestione = "(mtb_colt.gestione = 'V' OR mtb_colt.gestione = 'L') ";
|
||||
}
|
||||
var request = new RetrieveAlreadyRegisteredUdsRequestDTO()
|
||||
.setOrdini(orders)
|
||||
.setSegno(segno);
|
||||
|
||||
String baseSql = "SELECT DISTINCT mtb_colt.* " +
|
||||
"FROM mtb_colt " +
|
||||
" INNER JOIN mtb_colr ON " +
|
||||
" mtb_colt.gestione = mtb_colr.gestione " +
|
||||
" AND mtb_colt.ser_collo = mtb_colr.ser_collo " +
|
||||
" AND mtb_colt.data_collo = mtb_colr.data_collo " +
|
||||
" AND mtb_colt.num_collo = mtb_colr.num_collo " +
|
||||
" WHERE " + whereCondGestione +
|
||||
" AND mtb_colt.segno = " + UtilityDB.valueToString(segno) + " " +
|
||||
" AND mtb_colt.data_doc IS NULL AND ";
|
||||
var response = service.retrieveAlreadyRegisteredUDS(request)
|
||||
.execute();
|
||||
var data = analyzeAnswer(response, "getBancaliGiaRegistrati");
|
||||
return data == null || data.getUdsList() == null ? new ArrayList<>() : data.getUdsList();
|
||||
}
|
||||
|
||||
List<HashMap<String, Object>> whereCondMapList = new ArrayList<>();
|
||||
for (OrdineInevasoDTO ordineInevaso : orders) {
|
||||
HashMap<String, Object> whereCondMap = new HashMap<>();
|
||||
whereCondMap.put("mtb_colr.data_ord", ordineInevaso.getDataOrdD());
|
||||
whereCondMap.put("mtb_colr.num_ord", ordineInevaso.getNumOrd());
|
||||
whereCondMap.put("mtb_colr.gestione", ordineInevaso.getGestione());
|
||||
|
||||
whereCondMapList.add(whereCondMap);
|
||||
}
|
||||
|
||||
baseSql += "(" + UtilityQuery.concatFieldListInWhereCond(whereCondMapList) + ")";
|
||||
|
||||
Type typeOfObjectsList = new TypeToken<ArrayList<MtbColt>>() {
|
||||
}.getType();
|
||||
this.mSystemRESTConsumer.<List<MtbColt>>processSql(baseSql, typeOfObjectsList, value -> {
|
||||
if (onComplete != null) onComplete.run(value);
|
||||
}, ex -> {
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
public void getBancaliGiaRegistrati(List<OrdineInevasoDTO> orders, int segno, RunnableArgs<List<AlreadyRegisteredUlDTO>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
var result = getBancaliGiaRegistratiSynchronized(orders, segno);
|
||||
if (onComplete != null) onComplete.run(result);
|
||||
} catch (Exception ex) {
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,8 @@ import java.util.List;
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.core.rest.model.SitArtOrdDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.OrdineUscitaInevasoDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.RetrieveAlreadyRegisteredUdsRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.RetrieveAlreadyRegisteredUdsResponseDTO;
|
||||
import it.integry.integrywmsnative.gest.spedizione.model.PickingObjectDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.GetPickingListDTO;
|
||||
import retrofit2.Call;
|
||||
@@ -23,4 +25,7 @@ public interface OrdiniRESTConsumerService {
|
||||
|
||||
@GET("SM2GetOrdiniVenditaInevasi")
|
||||
Call<ServiceRESTResponse<List<OrdineUscitaInevasoDTO>>> getOrdiniInevasi(@Query("codMdep") String codMdep, @Query("gestione") String gestione);
|
||||
|
||||
@POST("wms/spedizione/retrieveAlreadyRegisteredUDS")
|
||||
Call<ServiceRESTResponse<RetrieveAlreadyRegisteredUdsResponseDTO>> retrieveAlreadyRegisteredUDS(@Body RetrieveAlreadyRegisteredUdsRequestDTO request);
|
||||
}
|
||||
|
||||
@@ -125,13 +125,12 @@ public class PrinterRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
public void printClosedOrdersSynchronized(PrintOrderCloseDTO dto, String codMdep) throws Exception {
|
||||
if (BuildConfig.DEBUG) {
|
||||
return;
|
||||
// return;
|
||||
}
|
||||
|
||||
PrinterRESTConsumerService printerService = restBuilder.getService(PrinterRESTConsumerService.class, 240);
|
||||
Call<ServiceRESTResponse<Object>> callable = printerService.printClosedOrders(codMdep, dto);
|
||||
|
||||
var response = callable.execute();
|
||||
var response = printerService.printClosedOrders(codMdep, dto).execute();
|
||||
analyzeAnswer(response, "printCollo");
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
package it.integry.integrywmsnative.core.rest.consumers;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
@@ -17,19 +14,15 @@ import java.util.concurrent.ExecutorService;
|
||||
|
||||
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.model.MtbDepo;
|
||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
|
||||
import it.integry.integrywmsnative.core.rest.model.AvailableCodMdepsDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.MailRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.NativeSqlRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.core.rest.model.system.LatestAppVersionInfoDTO;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityGson;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Response;
|
||||
|
||||
@@ -89,57 +82,27 @@ public class SystemRESTConsumer extends _BaseRESTConsumer {
|
||||
});
|
||||
}
|
||||
|
||||
public List<AvailableCodMdepsDTO> getAvailableCodMdepsSynchronized() throws Exception {
|
||||
public List<MtbDepo> getAvailableCodMdepsSynchronized() throws Exception {
|
||||
SystemRESTConsumerService service = restBuilder.getService(SystemRESTConsumerService.class);
|
||||
var response = service.getAvailableCodMdeps().execute();
|
||||
return analyzeAnswer(response, "CodMdepsAvailable");
|
||||
}
|
||||
|
||||
public void getAvailableCodMdeps(final RunnableArgs<List<AvailableCodMdepsDTO>> onSuccess, RunnableArgs<Exception> onFailed) {
|
||||
public void getAvailableCodMdeps(final RunnableArgs<List<MtbDepo>> onSuccess, RunnableArgs<Exception> onFailed) {
|
||||
SystemRESTConsumerService service = restBuilder.getService(SystemRESTConsumerService.class);
|
||||
service.getAvailableCodMdeps().enqueue(new ManagedErrorCallback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<List<AvailableCodMdepsDTO>>> call, Response<ServiceRESTResponse<List<AvailableCodMdepsDTO>>> response) {
|
||||
public void onResponse(Call<ServiceRESTResponse<List<MtbDepo>>> call, Response<ServiceRESTResponse<List<MtbDepo>>> response) {
|
||||
analyzeAnswer(response, "CodMdepsAvailable", onSuccess, onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<List<AvailableCodMdepsDTO>>> call, @NonNull final Exception e) {
|
||||
public void onFailure(Call<ServiceRESTResponse<List<MtbDepo>>> call, @NonNull final Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
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 {
|
||||
SystemRESTConsumerService service = restBuilder.getService(SystemRESTConsumerService.class);
|
||||
var response = service.sendMail(mailDTO).execute();
|
||||
|
||||
@@ -2,7 +2,7 @@ package it.integry.integrywmsnative.core.rest.consumers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.rest.model.AvailableCodMdepsDTO;
|
||||
import it.integry.integrywmsnative.core.model.MtbDepo;
|
||||
import it.integry.integrywmsnative.core.rest.model.MailRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.NativeSqlRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
@@ -25,7 +25,7 @@ public interface SystemRESTConsumerService {
|
||||
Call<ServiceRESTResponse<List<String>>> getAvailableProfiles(@Query("username") String username, @Query("password") String password);
|
||||
|
||||
@GET("getAvailableCodMdepsForUser")
|
||||
Call<ServiceRESTResponse<List<AvailableCodMdepsDTO>>> getAvailableCodMdeps();
|
||||
Call<ServiceRESTResponse<List<MtbDepo>>> getAvailableCodMdeps();
|
||||
|
||||
@POST("sendEmail")
|
||||
Call<ServiceRESTResponse<Void>> sendMail(@Body MailRequestDTO mailDto);
|
||||
|
||||
@@ -91,34 +91,40 @@ public abstract class _BaseRESTConsumer {
|
||||
}
|
||||
|
||||
public static <T> void analyzeAnswerList(Response<ServiceRESTResponse<T>> response, String logTitle, RunnableArgs<List<T>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
try {
|
||||
var dataList = analyzeAnswerList(response, logTitle);
|
||||
onComplete.run(dataList);
|
||||
} catch (Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static <T> List<T> analyzeAnswerList(Response<ServiceRESTResponse<T>> response, String logTitle) throws Exception {
|
||||
if (response.isSuccessful()) {
|
||||
if (response.body() != null) {
|
||||
if (response.body().getEsito() == EsitoType.OK) {
|
||||
if (!UtilityString.isNullOrEmpty(response.body().getErrorMessage())) {
|
||||
onFailed.run(new Exception(response.body().getErrorMessage()));
|
||||
throw new Exception(response.body().getErrorMessage());
|
||||
} else {
|
||||
|
||||
List<T> dataObj = response.body().getEntityList();
|
||||
|
||||
onComplete.run(dataObj);
|
||||
return response.body().getEntityList();
|
||||
}
|
||||
} else {
|
||||
Log.e(logTitle, response.body().getErrorMessage());
|
||||
onFailed.run(CommonRESTException.tryRecognizeException(response.body().getErrorMessage()));
|
||||
throw CommonRESTException.tryRecognizeException(response.body().getErrorMessage());
|
||||
}
|
||||
} else {
|
||||
Log.e(logTitle, response.message());
|
||||
onFailed.run(new Exception(response.message()));
|
||||
throw new Exception(response.message());
|
||||
}
|
||||
} else {
|
||||
if (response.code() == 404) {
|
||||
Log.e(logTitle, "Errore " + response.code() + ": risorsa non trovata");
|
||||
onFailed.run(new Exception("Errore " + response.code() + ": risorsa non trovata (" + logTitle + ")"));
|
||||
throw new Exception("Errore " + response.code() + ": risorsa non trovata (" + logTitle + ")");
|
||||
} else if (response.code() == 550)
|
||||
onFailed.run(new InvalidLicenseException());
|
||||
throw new InvalidLicenseException();
|
||||
else {
|
||||
Log.e(logTitle, "Status " + response.code() + ": " + response.message());
|
||||
onFailed.run(new Exception("Status " + response.code() + ": " + response.message()));
|
||||
throw new Exception("Status " + response.code() + ": " + response.message());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,13 +12,18 @@ import it.integry.integrywmsnative.core.rest.model.uds.InsertUDCRowRequestDTO;
|
||||
|
||||
public interface ColliCaricoRESTConsumerInterface {
|
||||
|
||||
MtbColt createUDCSynchronized(CreateUDCRequestDTO createUDCRequestDTO) throws Exception;
|
||||
void createUDC(CreateUDCRequestDTO createUDCRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed);
|
||||
|
||||
CloseUDCResponseDTO synchronousCloseUDC(CloseUDCRequestDTO closeUDCRequestDTO) throws Exception;
|
||||
void closeUDC(CloseUDCRequestDTO closeUDCRequestDTO, RunnableArgs<CloseUDCResponseDTO> onComplete, RunnableArgs<Exception> onFailed);
|
||||
|
||||
MtbColr synchronousInsertUDCRow(InsertUDCRowRequestDTO insertUDCRowRequestDTO) throws Exception;
|
||||
void insertUDCRow(InsertUDCRowRequestDTO insertUDCRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed);
|
||||
|
||||
MtbColr synchronousEditUDCRow(EditUDCRowRequestDTO editUDCRowRequestDTO) throws Exception;
|
||||
void editUDCRow(EditUDCRowRequestDTO editUDCRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed);
|
||||
|
||||
void synchronousDeleteUDCRow(DeleteUDCRowRequestDTO deleteUDCRowRequestDTO) throws Exception;
|
||||
void deleteUDCRow(DeleteUDCRowRequestDTO deleteUDCRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed);
|
||||
}
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
package it.integry.integrywmsnative.core.rest.model;
|
||||
|
||||
public class AvailableCodMdepsDTO {
|
||||
|
||||
private String codMdep;
|
||||
private String descrizione;
|
||||
|
||||
public String getCodMdep() {
|
||||
return codMdep;
|
||||
}
|
||||
|
||||
public String getDescrizione() {
|
||||
return descrizione;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if((obj) != null) {
|
||||
return ((AvailableCodMdepsDTO) obj).codMdep.equalsIgnoreCase(codMdep);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package it.integry.integrywmsnative.core.rest.model.pv;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
public class CloseVerificaRequestDTO {
|
||||
|
||||
private String codMdep;
|
||||
private LocalDateTime dataVerifica;
|
||||
|
||||
public String getCodMdep() {
|
||||
return codMdep;
|
||||
}
|
||||
|
||||
public CloseVerificaRequestDTO setCodMdep(String codMdep) {
|
||||
this.codMdep = codMdep;
|
||||
return this;
|
||||
}
|
||||
|
||||
public LocalDateTime getDataVerifica() {
|
||||
return dataVerifica;
|
||||
}
|
||||
|
||||
public CloseVerificaRequestDTO setDataVerifica(LocalDateTime dataVerifica) {
|
||||
this.dataVerifica = dataVerifica;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package it.integry.integrywmsnative.core.rest.model.pv;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
public class DeleteRowVerificaRequestDTO {
|
||||
|
||||
private String codMdep;
|
||||
private LocalDateTime dataVerifica;
|
||||
private VerificaGiacenzeRowDTO row;
|
||||
|
||||
public String getCodMdep() {
|
||||
return codMdep;
|
||||
}
|
||||
|
||||
public DeleteRowVerificaRequestDTO setCodMdep(String codMdep) {
|
||||
this.codMdep = codMdep;
|
||||
return this;
|
||||
}
|
||||
|
||||
public LocalDateTime getDataVerifica() {
|
||||
return dataVerifica;
|
||||
}
|
||||
|
||||
public DeleteRowVerificaRequestDTO setDataVerifica(LocalDateTime dataVerifica) {
|
||||
this.dataVerifica = dataVerifica;
|
||||
return this;
|
||||
}
|
||||
|
||||
public VerificaGiacenzeRowDTO getRow() {
|
||||
return row;
|
||||
}
|
||||
|
||||
public DeleteRowVerificaRequestDTO setRow(VerificaGiacenzeRowDTO row) {
|
||||
this.row = row;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package it.integry.integrywmsnative.core.rest.model.pv;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
public class SaveNewRowVerificaRequestDTO {
|
||||
|
||||
private String codMdep;
|
||||
private LocalDateTime dataVerifica;
|
||||
private VerificaGiacenzeRowDTO row;
|
||||
|
||||
|
||||
public String getCodMdep() {
|
||||
return codMdep;
|
||||
}
|
||||
|
||||
public SaveNewRowVerificaRequestDTO setCodMdep(String codMdep) {
|
||||
this.codMdep = codMdep;
|
||||
return this;
|
||||
}
|
||||
|
||||
public LocalDateTime getDataVerifica() {
|
||||
return dataVerifica;
|
||||
}
|
||||
|
||||
public SaveNewRowVerificaRequestDTO setDataVerifica(LocalDateTime dataVerifica) {
|
||||
this.dataVerifica = dataVerifica;
|
||||
return this;
|
||||
}
|
||||
|
||||
public VerificaGiacenzeRowDTO getRow() {
|
||||
return row;
|
||||
}
|
||||
|
||||
public SaveNewRowVerificaRequestDTO setRow(VerificaGiacenzeRowDTO row) {
|
||||
this.row = row;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package it.integry.integrywmsnative.core.rest.model.pv;
|
||||
|
||||
public class SaveNewVerificaRequestDTO {
|
||||
|
||||
private VerificaGiacenzeDTO data;
|
||||
|
||||
public VerificaGiacenzeDTO getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public SaveNewVerificaRequestDTO setData(VerificaGiacenzeDTO data) {
|
||||
this.data = data;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package it.integry.integrywmsnative.core.rest.model.pv;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
public class UpdateRowVerificaRequestDTO {
|
||||
|
||||
private String codMdep;
|
||||
private LocalDateTime dataVerifica;
|
||||
private VerificaGiacenzeRowDTO row;
|
||||
|
||||
|
||||
public String getCodMdep() {
|
||||
return codMdep;
|
||||
}
|
||||
|
||||
public UpdateRowVerificaRequestDTO setCodMdep(String codMdep) {
|
||||
this.codMdep = codMdep;
|
||||
return this;
|
||||
}
|
||||
|
||||
public LocalDateTime getDataVerifica() {
|
||||
return dataVerifica;
|
||||
}
|
||||
|
||||
public UpdateRowVerificaRequestDTO setDataVerifica(LocalDateTime dataVerifica) {
|
||||
this.dataVerifica = dataVerifica;
|
||||
return this;
|
||||
}
|
||||
|
||||
public VerificaGiacenzeRowDTO getRow() {
|
||||
return row;
|
||||
}
|
||||
|
||||
public UpdateRowVerificaRequestDTO setRow(VerificaGiacenzeRowDTO row) {
|
||||
this.row = row;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package it.integry.integrywmsnative.core.rest.model.uds;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.OrdineInevasoDTO;
|
||||
|
||||
public class RetrieveAlreadyRegisteredUdsRequestDTO {
|
||||
|
||||
private List<? extends OrdineInevasoDTO> ordini;
|
||||
private int segno;
|
||||
|
||||
public List<? extends OrdineInevasoDTO> getOrdini() {
|
||||
return ordini;
|
||||
}
|
||||
|
||||
public RetrieveAlreadyRegisteredUdsRequestDTO setOrdini(List<? extends OrdineInevasoDTO> ordini) {
|
||||
this.ordini = ordini;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getSegno() {
|
||||
return segno;
|
||||
}
|
||||
|
||||
public RetrieveAlreadyRegisteredUdsRequestDTO setSegno(int segno) {
|
||||
this.segno = segno;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package it.integry.integrywmsnative.core.rest.model.uds;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.dto.AlreadyRegisteredUlDTO;
|
||||
|
||||
public class RetrieveAlreadyRegisteredUdsResponseDTO {
|
||||
|
||||
private List<AlreadyRegisteredUlDTO> udsList;
|
||||
|
||||
public List<AlreadyRegisteredUlDTO> getUdsList() {
|
||||
return udsList;
|
||||
}
|
||||
|
||||
public RetrieveAlreadyRegisteredUdsResponseDTO setUdsList(List<AlreadyRegisteredUlDTO> udsList) {
|
||||
this.udsList = udsList;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,6 @@ import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
||||
import it.integry.integrywmsnative.core.model.MvwSitArtUdcDetInventario;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.GiacenzaRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||
|
||||
@Singleton
|
||||
public class InventarioService {
|
||||
@@ -48,7 +47,7 @@ public class InventarioService {
|
||||
MtbColt mtbColt = new MtbColt();
|
||||
|
||||
mtbColt.setGestione(inventario.getGestione());
|
||||
mtbColt.setDataCollo(UtilityDate.toDate(inventario.getDataCollo()));
|
||||
mtbColt.setDataCollo(inventario.getDataCollo());
|
||||
mtbColt.setSerCollo(inventario.getSerCollo());
|
||||
mtbColt.setNumCollo(inventario.getNumCollo());
|
||||
mtbColt.setSegno(inventario.getSegno());
|
||||
@@ -71,7 +70,7 @@ public class InventarioService {
|
||||
MtbColr mtbColr = new MtbColr();
|
||||
|
||||
mtbColr.setGestione(inventario.getGestione());
|
||||
mtbColr.setDataCollo(UtilityDate.toDate(inventario.getDataCollo()));
|
||||
mtbColr.setDataCollo(inventario.getDataCollo());
|
||||
mtbColr.setSerCollo(inventario.getSerCollo());
|
||||
mtbColr.setNumCollo(inventario.getNumCollo());
|
||||
mtbColr.setCodMart(inventario.getCodMart());
|
||||
|
||||
@@ -7,15 +7,15 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.Azienda;
|
||||
import it.integry.integrywmsnative.core.model.MtbDepo;
|
||||
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
||||
import it.integry.integrywmsnative.core.model.dto.InternalCodAnagsDTO;
|
||||
import it.integry.integrywmsnative.core.model.observable.ObservableMtbTcol;
|
||||
import it.integry.integrywmsnative.core.rest.model.AvailableCodMdepsDTO;
|
||||
|
||||
public class DBSettingsModel {
|
||||
|
||||
private List<String> availableProfiles = null;
|
||||
private List<AvailableCodMdepsDTO> availableCodMdep = null;
|
||||
private List<MtbDepo> availableDepos = null;
|
||||
private List<MtbDepoPosizione> availablePosizioni = null;
|
||||
|
||||
private Azienda datiAzienda = null;
|
||||
@@ -97,6 +97,12 @@ public class DBSettingsModel {
|
||||
private List<String> allowedCodMgrpForArtCreation;
|
||||
private boolean flagAccettazioneGroupListForn = false;
|
||||
private boolean flagSpedizioneEnableFastPicking = false;
|
||||
private boolean flagAccettazioneBollaEditableQtaTot = true;
|
||||
private boolean flagViewSwitchDepoButton = true;
|
||||
private boolean flagProduzioneSkipAskVersamentoAutomatico;
|
||||
private boolean flagAccettazioneViewLotto = false;
|
||||
private boolean flagSpedizioneUnderflowQuantityWarning = false;
|
||||
private boolean flagAccettazioneBollaMarkReceived = false;
|
||||
|
||||
public boolean isFlagSpedizioneEnableFakeGiacenza() {
|
||||
return flagSpedizioneEnableFakeGiacenza;
|
||||
@@ -152,12 +158,12 @@ public class DBSettingsModel {
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<AvailableCodMdepsDTO> getAvailableCodMdep() {
|
||||
return availableCodMdep;
|
||||
public List<MtbDepo> getAvailableDepos() {
|
||||
return availableDepos;
|
||||
}
|
||||
|
||||
public void setAvailableCodMdep(List<AvailableCodMdepsDTO> availableCodMdep) {
|
||||
this.availableCodMdep = availableCodMdep;
|
||||
public void setAvailableDepos(List<MtbDepo> availableDepos) {
|
||||
this.availableDepos = availableDepos;
|
||||
}
|
||||
|
||||
public boolean isEnableCheckPartitaMagCheckPickingV() {
|
||||
@@ -815,4 +821,56 @@ public class DBSettingsModel {
|
||||
public void setFlagSpedizioneEnableFastPicking(boolean flagSpedizioneEnableFastPicking) {
|
||||
this.flagSpedizioneEnableFastPicking = flagSpedizioneEnableFastPicking;
|
||||
}
|
||||
|
||||
public boolean isFlagAccettazioneBollaEditableQtaTot() {
|
||||
return flagAccettazioneBollaEditableQtaTot;
|
||||
}
|
||||
|
||||
public void setFlagAccettazioneBollaEditableQtaTot(boolean flagAccettazioneBollaEditableQtaTot) {
|
||||
this.flagAccettazioneBollaEditableQtaTot = flagAccettazioneBollaEditableQtaTot;
|
||||
}
|
||||
|
||||
public boolean isFlagViewSwitchDepoButton() {
|
||||
return flagViewSwitchDepoButton;
|
||||
}
|
||||
|
||||
public void setFlagViewSwitchDepoButton(boolean 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 isFlagSpedizioneUnderflowQuantityWarning() {
|
||||
return flagSpedizioneUnderflowQuantityWarning;
|
||||
}
|
||||
|
||||
public DBSettingsModel setFlagSpedizioneUnderflowQuantityWarning(boolean flagSpedizioneUnderflowQuantityWarning) {
|
||||
this.flagSpedizioneUnderflowQuantityWarning = flagSpedizioneUnderflowQuantityWarning;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isFlagAccettazioneBollaMarkReceived() {
|
||||
return flagAccettazioneBollaMarkReceived;
|
||||
}
|
||||
|
||||
public DBSettingsModel setFlagAccettazioneBollaMarkReceived(boolean flagAccettazioneBollaMarkReceived) {
|
||||
this.flagAccettazioneBollaMarkReceived = flagAccettazioneBollaMarkReceived;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import javax.inject.Singleton;
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.CommonConst;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.model.MtbDepo;
|
||||
import it.integry.integrywmsnative.core.model.MtbTCol;
|
||||
import it.integry.integrywmsnative.core.model.dto.InternalCodAnagsDTO;
|
||||
import it.integry.integrywmsnative.core.model.observable.ObservableMtbTcol;
|
||||
@@ -26,7 +27,6 @@ import it.integry.integrywmsnative.core.rest.consumers.GestSetupRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ImballiRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.model.AvailableCodMdepsDTO;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityFirebase;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityLogger;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
@@ -39,8 +39,6 @@ public class SettingsManager {
|
||||
private static SettingsModel settingsModelIstance;
|
||||
private static DBSettingsModel dbSettingsModelIstance;
|
||||
|
||||
private static boolean firstStart = false;
|
||||
|
||||
private static Context mContext;
|
||||
private static SystemRESTConsumer mSystemRESTConsumer;
|
||||
private static ImballiRESTConsumer mImballiRESTConsumer;
|
||||
@@ -65,15 +63,15 @@ public class SettingsManager {
|
||||
public void init() {
|
||||
settingsModelIstance = (SettingsModel) Stash.getObject(TAG, SettingsModel.class);
|
||||
|
||||
if (settingsModelIstance == null) {
|
||||
if (settingsModelIstance == null)
|
||||
settingsModelIstance = new SettingsModel();
|
||||
|
||||
|
||||
if (settingsModelIstance.getServer() == null)
|
||||
settingsModelIstance.setServer(new SettingsModel.Server());
|
||||
firstStart = true;
|
||||
}
|
||||
|
||||
|
||||
dbSettingsModelIstance = new DBSettingsModel();
|
||||
|
||||
}
|
||||
|
||||
public SettingsModel getSettings() {
|
||||
@@ -89,10 +87,6 @@ public class SettingsManager {
|
||||
return dbSettingsModelIstance;
|
||||
}
|
||||
|
||||
public static boolean isFirstStart() {
|
||||
return firstStart;
|
||||
}
|
||||
|
||||
public static boolean isInstanceAvailable() {
|
||||
return i() != null;
|
||||
}
|
||||
@@ -176,7 +170,7 @@ public class SettingsManager {
|
||||
private static void loadAvailableCodMdeps() throws Exception {
|
||||
var availableCodMdeps = mSystemRESTConsumer.getAvailableCodMdepsSynchronized();
|
||||
|
||||
dbSettingsModelIstance.setAvailableCodMdep(availableCodMdeps);
|
||||
dbSettingsModelIstance.setAvailableDepos(availableCodMdeps);
|
||||
|
||||
if (availableCodMdeps == null || availableCodMdeps.isEmpty()) {
|
||||
throw new Exception(mContext.getText(R.string.no_codmdep_available).toString());
|
||||
@@ -185,7 +179,7 @@ public class SettingsManager {
|
||||
boolean codMdepExistsAnymore = false;
|
||||
|
||||
if (settingsModelIstance.getUserSession().getDepo() != null) {
|
||||
for (AvailableCodMdepsDTO availableCodMdepDTO : availableCodMdeps) {
|
||||
for (MtbDepo availableCodMdepDTO : availableCodMdeps) {
|
||||
//Controllo se il codMdep salvato esiste ancora
|
||||
if (availableCodMdepDTO.getCodMdep().equalsIgnoreCase(settingsModelIstance.getUserSession().getDepo().getCodMdep())) {
|
||||
codMdepExistsAnymore = true;
|
||||
@@ -260,11 +254,21 @@ public class SettingsManager {
|
||||
.setSection("ACCETTAZIONE")
|
||||
.setKeySection("FLAG_DELETE_ROW_ON_CLOSE")
|
||||
.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)
|
||||
.setGestName("PICKING")
|
||||
.setSection("SPEDIZIONE")
|
||||
.setKeySection("FLAG_CAN_ADD_EXTRA_QUANTITY")
|
||||
.setSetter(dbSettingsModelIstance::setFlagCanAddExtraQuantitySpedizione));
|
||||
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
|
||||
.setGestName("PICKING")
|
||||
.setSection("SPEDIZIONE")
|
||||
.setKeySection("FLAG_UNDERFLOW_QUANTITY_WARNING")
|
||||
.setSetter(dbSettingsModelIstance::setFlagSpedizioneUnderflowQuantityWarning));
|
||||
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
|
||||
.setGestName("PICKING")
|
||||
.setSection("SPEDIZIONE")
|
||||
@@ -307,6 +311,12 @@ public class SettingsManager {
|
||||
.setSection("PRODUZIONE")
|
||||
.setKeySection("VIEW_POSIZIONI")
|
||||
.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)
|
||||
.setGestName("PICKING")
|
||||
.setSection("SPEDIZIONE")
|
||||
@@ -480,6 +490,12 @@ public class SettingsManager {
|
||||
.setKeySection("FLAG_ASK_PRINT_UL")
|
||||
.setSetter(dbSettingsModelIstance::setFlagAccettazioneBollaAskPrintUl)
|
||||
.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)
|
||||
.setGestName("PICKING")
|
||||
.setSection("ACCETTAZIONE_BOLLA")
|
||||
@@ -564,6 +580,12 @@ public class SettingsManager {
|
||||
.setKeySection("ENABLE_FAST_PICKING")
|
||||
.setSetter(dbSettingsModelIstance::setFlagSpedizioneEnableFastPicking)
|
||||
.setDefaultValue(false));
|
||||
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
|
||||
.setGestName("PICKING")
|
||||
.setSection("ACCETTAZIONE_BOLLA")
|
||||
.setKeySection("FLAG_QTA_TOT_EDITABLE")
|
||||
.setSetter(dbSettingsModelIstance::setFlagAccettazioneBollaEditableQtaTot)
|
||||
.setDefaultValue(true));
|
||||
|
||||
stbGestSetupReaderList.add(new StbGestSetupReader<>(String.class)
|
||||
.setGestName("PICKING")
|
||||
@@ -617,6 +639,13 @@ public class SettingsManager {
|
||||
.setKeySection("ENABLE_ART_CREATION")
|
||||
.setSetter(dbSettingsModelIstance::setFlagEnableArtCreation));
|
||||
|
||||
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
|
||||
.setGestName("PICKING")
|
||||
.setSection("SETUP")
|
||||
.setKeySection("VIEW_SWITCH_DEPO_BUTTON")
|
||||
.setSetter(dbSettingsModelIstance::setFlagViewSwitchDepoButton)
|
||||
);
|
||||
|
||||
stbGestSetupReaderList.add(new StbGestSetupReader<>(String.class)
|
||||
.setGestName("PICKING")
|
||||
.setSection("SETUP")
|
||||
|
||||
@@ -2,7 +2,7 @@ package it.integry.integrywmsnative.core.settings;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import it.integry.integrywmsnative.core.rest.model.AvailableCodMdepsDTO;
|
||||
import it.integry.integrywmsnative.core.model.MtbDepo;
|
||||
|
||||
public class SettingsModel {
|
||||
|
||||
@@ -85,7 +85,7 @@ public class SettingsModel {
|
||||
private LocalDateTime refreshTokenExpiryDate;
|
||||
private String deviceId;
|
||||
private String profileDB;
|
||||
private AvailableCodMdepsDTO depo;
|
||||
private MtbDepo depo;
|
||||
private Integer defaultOrdinamentoPickingAccettazione = 0;
|
||||
private Integer defaultOrdinamentoPickingAccettazioneBolle = 0;
|
||||
|
||||
@@ -134,11 +134,11 @@ public class SettingsModel {
|
||||
return this;
|
||||
}
|
||||
|
||||
public AvailableCodMdepsDTO getDepo() {
|
||||
public MtbDepo getDepo() {
|
||||
return depo;
|
||||
}
|
||||
|
||||
public UserSession setDepo(AvailableCodMdepsDTO depo) {
|
||||
public UserSession setDepo(MtbDepo depo) {
|
||||
this.depo = depo;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -7,18 +7,22 @@ import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Environment;
|
||||
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 com.google.firebase.crashlytics.FirebaseCrashlytics;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
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.model.system.LatestAppVersionInfoDTO;
|
||||
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.gest.settings.MainSettingsFragment;
|
||||
import it.integry.integrywmsnative.view.dialogs.DialogProgressView;
|
||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||
import it.integry.integrywmsnative.view.dialogs.update_available.DialogUpdateAvailableView;
|
||||
|
||||
@Singleton
|
||||
public class UpdatesManager {
|
||||
|
||||
private static final String TAG = "UpdatesManager";
|
||||
|
||||
private final ExecutorService executorService;
|
||||
private final Handler handler;
|
||||
private final SystemRESTConsumer systemRESTConsumer;
|
||||
@@ -41,109 +48,149 @@ public class UpdatesManager {
|
||||
this.systemRESTConsumer = systemRESTConsumer;
|
||||
}
|
||||
|
||||
public void executeCheck(Context context, boolean forceReinstall) {
|
||||
|
||||
public void executeCheck(@NonNull Context context, @NonNull FragmentManager fragmentManager, boolean forceReinstall) {
|
||||
executorService.execute(() -> {
|
||||
|
||||
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);
|
||||
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);
|
||||
|
||||
if (latestData == null)
|
||||
if (latestData == null) {
|
||||
Log.d(TAG, "No update information received from server.");
|
||||
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;
|
||||
}
|
||||
|
||||
boolean currentVersionIsBeta = BuildConfig.VERSION_NAME.contains("beta");
|
||||
|
||||
if(!forceReinstall && currentVersionIsBeta == betaEnabled && latestData.getLatestVersionCode() == BuildConfig.VERSION_CODE)
|
||||
return;
|
||||
|
||||
//Se sto passando da una beta a una stable e viceversa non obbligo l'utente a fare l'aggiornamento
|
||||
if(currentVersionIsBeta != betaEnabled || forceReinstall) {
|
||||
// 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 (isChannelSwitch || forceReinstall) {
|
||||
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, () -> {
|
||||
installAPK(context, currentDownloadUrl);
|
||||
});
|
||||
handler.post(() -> showUpdateAvailableDialog(context, fragmentManager, latestData, downloadUrl));
|
||||
|
||||
} catch (Exception e) {
|
||||
handler.post(() -> {
|
||||
UtilityExceptions.defaultException(context, e);
|
||||
});
|
||||
Log.e(TAG, "Error during update check", 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) {
|
||||
DialogUpdateAvailableView.newInstance(updatesData, onUpdateStart)
|
||||
.show(((FragmentActivity)context).getSupportFragmentManager(), "dialog-updates");
|
||||
private void showUpdateAvailableDialog(@NonNull Context context, @NonNull FragmentManager fragmentManager, @NonNull LatestAppVersionInfoDTO updatesData, @NonNull String downloadUrl) {
|
||||
DialogUpdateAvailableView dialog = DialogUpdateAvailableView.newInstance(updatesData, () -> {
|
||||
// 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) {
|
||||
|
||||
File destination = context.getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS);
|
||||
|
||||
var progressDialogBuilder = new DialogProgressView("Download", null, false);
|
||||
progressDialogBuilder.show(Objects.requireNonNull(ContextHelper.getFragmentManagerFromContext(context)), "tag");
|
||||
|
||||
|
||||
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);
|
||||
});
|
||||
|
||||
});
|
||||
private void downloadAndInstall(@NonNull Context context, @NonNull FragmentManager fragmentManager, @NonNull String downloadUrl, boolean isForced) {
|
||||
DialogProgressView progressDialog = new DialogProgressView("Download", null, false);
|
||||
if (isForced) {
|
||||
progressDialog.setCancelable(false);
|
||||
}
|
||||
progressDialog.show(fragmentManager, "progress-dialog");
|
||||
|
||||
FileDownloader fileDownloader = new FileDownloader()
|
||||
.setExecutorService(executorService)
|
||||
.setDestFolder(context.getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS))
|
||||
.setUrlString(downloadUrl)
|
||||
.setOnProgressUpdate(progress -> handler.post(() -> progressDialog.setProgress(progress)));
|
||||
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
fileDownloader.download();
|
||||
File apkFile = fileDownloader.download();
|
||||
handler.post(() -> {
|
||||
progressDialog.dismiss();
|
||||
installApk(context, fragmentManager, apkFile, isForced);
|
||||
});
|
||||
} catch (Exception e) {
|
||||
progressDialogBuilder.dismissAllowingStateLoss();
|
||||
UtilityExceptions.defaultException(context, e);
|
||||
Log.e(TAG, "Download failed", 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.net.HttpURLConnection;
|
||||
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;
|
||||
|
||||
@@ -18,68 +21,87 @@ public class FileDownloader {
|
||||
private File destFolder;
|
||||
|
||||
private RunnableArgs<Integer> onProgressUpdate;
|
||||
private RunnableArgs<File> onDownloadCompleted;
|
||||
|
||||
private ExecutorService executorService;
|
||||
|
||||
public void download() throws Exception {
|
||||
InputStream input = null;
|
||||
OutputStream output = null;
|
||||
HttpURLConnection connection = null;
|
||||
File downloadFile = null;
|
||||
public File download() throws Exception {
|
||||
CountDownLatch countDownLatch = new CountDownLatch(1);
|
||||
|
||||
try {
|
||||
if (!destFolder.exists()) destFolder.mkdirs();
|
||||
AtomicReference<File> result = new AtomicReference<>();
|
||||
AtomicReference<Exception> exceptionAtomicReference = new AtomicReference<>();
|
||||
|
||||
URL url = new URL(urlString);
|
||||
connection = (HttpURLConnection) url.openConnection();
|
||||
connection.connect();
|
||||
connection.setConnectTimeout(120 * 1000);
|
||||
executorService.execute(() -> {
|
||||
InputStream input = null;
|
||||
OutputStream output = null;
|
||||
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 {
|
||||
if (output != null)
|
||||
output.close();
|
||||
if (input != null)
|
||||
input.close();
|
||||
} catch (IOException ignored) {
|
||||
}
|
||||
if (connection != null)
|
||||
connection.disconnect();
|
||||
}
|
||||
if (!destFolder.exists()) destFolder.mkdirs();
|
||||
|
||||
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() {
|
||||
return urlString;
|
||||
@@ -103,9 +125,4 @@ public class FileDownloader {
|
||||
this.onProgressUpdate = onProgressUpdate;
|
||||
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) {
|
||||
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) {
|
||||
|
||||
@@ -41,6 +41,19 @@ public class UtilityDate {
|
||||
public static final String DM_HUMAN = "dd MMM";
|
||||
public static final String DMY_HUMAN = "dd MMM 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) {
|
||||
|
||||
@@ -38,13 +38,7 @@ public class UtilityExceptions {
|
||||
Logger.e(ex, "Errore", (Object) ex.getStackTrace());
|
||||
}
|
||||
|
||||
String errorMessage = CommonRESTException.tryRecognizeThenGetMessage(ex);
|
||||
|
||||
if (errorMessage == null) {
|
||||
errorMessage = ex.getMessage();
|
||||
|
||||
if (ex.getCause() != null) errorMessage += "<br />" + ex.getCause().getMessage();
|
||||
}
|
||||
String errorMessage = recognizeExceptionMessage(ex);
|
||||
|
||||
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;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.DecimalFormatSymbols;
|
||||
import java.util.Locale;
|
||||
@@ -9,7 +10,8 @@ import it.integry.integrywmsnative.core.CommonConst;
|
||||
|
||||
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){
|
||||
if(bigDecimal == null) return "0";
|
||||
@@ -23,71 +25,59 @@ public class UtilityNumber {
|
||||
|
||||
public static String decimalToString(BigDecimal bigDecimal, int decimal){
|
||||
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) {
|
||||
DecimalFormatSymbols otherSymbols = new DecimalFormatSymbols(Locale.getDefault());
|
||||
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);
|
||||
return decimalToString(BigDecimal.valueOf(floatValue), decimal);
|
||||
}
|
||||
|
||||
public static DecimalFormat getNumberFormatInstance() {
|
||||
|
||||
if(decimalFormatInstance == null) {
|
||||
DecimalFormatSymbols otherSymbols = new DecimalFormatSymbols(Locale.getDefault());
|
||||
otherSymbols.setDecimalSeparator('.');
|
||||
otherSymbols.setGroupingSeparator(',');
|
||||
|
||||
decimalFormatInstance = new DecimalFormat();
|
||||
decimalFormatInstance.setMaximumFractionDigits(CommonConst.Config.NUMBER_OF_DECIMAL_DIGITS);
|
||||
decimalFormatInstance.setDecimalFormatSymbols(otherSymbols);
|
||||
decimalFormatInstance.setGroupingUsed(false);
|
||||
public static BigDecimal parseBigDecimal(String value, Locale locale) {
|
||||
if (value == null || value.trim().isEmpty()) return null;
|
||||
try {
|
||||
DecimalFormatSymbols symbols = new DecimalFormatSymbols(locale);
|
||||
DecimalFormat format = new DecimalFormat();
|
||||
format.setDecimalFormatSymbols(symbols);
|
||||
format.setParseBigDecimal(true);
|
||||
return (BigDecimal) format.parse(value);
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return decimalFormatInstance;
|
||||
}
|
||||
|
||||
public static int countNumberOfDecimalDigits(Float value) {
|
||||
String text = getNumberFormatInstance().format(Math.abs(value));
|
||||
int integerPlaces = text.indexOf('.');
|
||||
int decimalPlaces = text.length() - integerPlaces - 1;
|
||||
|
||||
return decimalPlaces;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* Parsa una stringa numerica italiana (con virgola come separatore decimale)
|
||||
* e restituisce un BigDecimal
|
||||
*/
|
||||
public static BigDecimal parseItalianBigDecimal(String value) {
|
||||
return parseBigDecimal(value, ITALIAN_LOCALE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,9 +3,15 @@ package it.integry.integrywmsnative.core.utility;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageInfo;
|
||||
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.StringRes;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
@@ -69,4 +75,23 @@ public class UtilityResources {
|
||||
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.os.Bundle;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.annotation.DrawableRes;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.widget.AppCompatTextView;
|
||||
import androidx.appcompat.widget.PopupMenu;
|
||||
import androidx.databinding.BindingAdapter;
|
||||
import androidx.databinding.ObservableArrayList;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
@@ -48,6 +53,9 @@ public class MainAccettazioneBollaElencoFragment extends BaseFragment implements
|
||||
private AppCompatTextView mAppBarTitle;
|
||||
|
||||
public BindableBoolean fabVisible = new BindableBoolean(false);
|
||||
public BindableBoolean fabMenuVisible = new BindableBoolean(false);
|
||||
|
||||
private PopupMenu fabPopupMenu;
|
||||
|
||||
private String mTextFilter;
|
||||
|
||||
@@ -100,6 +108,9 @@ public class MainAccettazioneBollaElencoFragment extends BaseFragment implements
|
||||
|
||||
this.initRecyclerView();
|
||||
|
||||
if (SettingsManager.iDB().isFlagAccettazioneBollaMarkReceived())
|
||||
this.initFab();
|
||||
|
||||
mToolbar.setRecyclerView(mBinding.accettazioneMainList);
|
||||
|
||||
return mBinding.getRoot();
|
||||
@@ -111,6 +122,7 @@ public class MainAccettazioneBollaElencoFragment extends BaseFragment implements
|
||||
super.onStart();
|
||||
|
||||
this.fabVisible.set(false);
|
||||
this.fabMenuVisible.set(false);
|
||||
mViewModel.init();
|
||||
}
|
||||
|
||||
@@ -147,8 +159,11 @@ public class MainAccettazioneBollaElencoFragment extends BaseFragment implements
|
||||
.filter(y -> !y.getGroupTitle().equalsIgnoreCase(x.getGroupTitle()) && y.getSelectedObservable().get())
|
||||
.forEach(y -> y.getSelectedObservable().set(false));
|
||||
|
||||
fabVisible.set(Stream.of(mBolleInevaseMutableData)
|
||||
.anyMatch(y -> y.getSelectedObservable().get()));
|
||||
boolean rowSelected = Stream.of(mBolleInevaseMutableData)
|
||||
.anyMatch(y -> y.getSelectedObservable().get());
|
||||
|
||||
fabVisible.set(rowSelected && !SettingsManager.iDB().isFlagAccettazioneBollaMarkReceived());
|
||||
fabMenuVisible.set(rowSelected && SettingsManager.iDB().isFlagAccettazioneBollaMarkReceived());
|
||||
});
|
||||
|
||||
adapter.setEmptyView(this.mBinding.bolleAccettazioneEmptyView);
|
||||
@@ -159,6 +174,28 @@ public class MainAccettazioneBollaElencoFragment extends BaseFragment implements
|
||||
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() {
|
||||
List<TestataBollaAccettazioneDTO> tmpList = mViewModel.getBolleList().getValue();
|
||||
@@ -223,14 +260,23 @@ public class MainAccettazioneBollaElencoFragment extends BaseFragment implements
|
||||
}).toList();
|
||||
}
|
||||
|
||||
public void openFabMenu() {
|
||||
fabPopupMenu.show();
|
||||
}
|
||||
|
||||
private void setBolleReceived() {
|
||||
this.mViewModel.markDocumentReceived(getSelectedBolle());
|
||||
}
|
||||
|
||||
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())
|
||||
.map(MainAccettazioneBolleElencoListModel::getOriginalModel)
|
||||
.toList();
|
||||
|
||||
this.mViewModel.loadPicking(selectedBolle);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
package it.integry.integrywmsnative.gest.accettazione_bolla_elenco;
|
||||
|
||||
import androidx.databinding.ObservableInt;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import it.integry.integrywmsnative.R;
|
||||
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.dto.SitBollaAccettazioneDTO;
|
||||
import it.integry.integrywmsnative.gest.accettazione_bolla_elenco.rest.dto.TestataBollaAccettazioneDTO;
|
||||
@@ -34,14 +37,10 @@ public class MainAccettazioneBollaElencoViewModel {
|
||||
}, this::sendError);
|
||||
}
|
||||
|
||||
|
||||
public MutableLiveData<List<TestataBollaAccettazioneDTO>> getBolleList() {
|
||||
return bolleList;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public void loadPicking(List<TestataBollaAccettazioneDTO> selectedBolle) {
|
||||
this.sendOnLoadingStarted();
|
||||
|
||||
@@ -53,21 +52,10 @@ public class MainAccettazioneBollaElencoViewModel {
|
||||
}, this::sendError);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public void markDocumentReceived(List<TestataBollaAccettazioneDTO> selectedBolle) {
|
||||
this.sendOnLoadingStarted();
|
||||
this.bolleAccettazioneRESTConsumer.markDocumentReceived(selectedBolle, this::sendOnLoadingEnded, this::sendError);
|
||||
}
|
||||
|
||||
public MainAccettazioneBollaElencoViewModel setListener(MainAccettazioneBollaElencoViewModel.Listener listener) {
|
||||
this.listener = listener;
|
||||
@@ -87,10 +75,9 @@ public class MainAccettazioneBollaElencoViewModel {
|
||||
}
|
||||
|
||||
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 {
|
||||
void onError(Exception ex);
|
||||
|
||||
|
||||
@@ -2,15 +2,19 @@ package it.integry.integrywmsnative.gest.accettazione_bolla_elenco.rest;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.GiacenzaPvRESTConsumerService;
|
||||
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.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.RetrieveElencoArticoliAccettazioneBollaResponseDTO;
|
||||
import it.integry.integrywmsnative.gest.accettazione_bolla_elenco.rest.dto.RetrieveElencoBolleAccettazioneResponseDTO;
|
||||
@@ -54,7 +58,7 @@ public class BolleAccettazioneRESTConsumer extends _BaseRESTConsumer {
|
||||
.enqueue(new ManagedErrorCallback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<RetrieveElencoArticoliAccettazioneBollaResponseDTO>> call, Response<ServiceRESTResponse<RetrieveElencoArticoliAccettazioneBollaResponseDTO>> response) {
|
||||
analyzeAnswer(response, "retrievePickingListBolle", data -> onComplete.run(data.getSitArticoli()), onFailed);
|
||||
analyzeAnswer(response, "retrievePickingListBolle", data -> onComplete.run(data.getSitArticoli() == null ? new ArrayList<>() : data.getSitArticoli()), onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -64,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;
|
||||
|
||||
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.RetrieveElencoArticoliAccettazioneBollaResponseDTO;
|
||||
import it.integry.integrywmsnative.gest.accettazione_bolla_elenco.rest.dto.RetrieveElencoBolleAccettazioneResponseDTO;
|
||||
@@ -17,4 +18,6 @@ public interface BolleAccettazioneRESTConsumerService {
|
||||
@POST("wms/accettazione-bolla/retrievePickingList")
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -42,7 +42,7 @@ import it.integry.integrywmsnative.core.expansion.RunnableArgss;
|
||||
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.dto.AlreadyRegisteredUDCDTO;
|
||||
import it.integry.integrywmsnative.core.model.dto.AlreadyRegisteredUlDTO;
|
||||
import it.integry.integrywmsnative.core.model.observable.ObservableMtbTcol;
|
||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
import it.integry.integrywmsnative.core.report.ReportManager;
|
||||
@@ -452,12 +452,12 @@ public class AccettazioneBollaPickingActivity extends BaseActivity implements Ac
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
public void startListaBancaliRegistratiActivity(List<AlreadyRegisteredUDCDTO> mtbColts) {
|
||||
public void startListaBancaliRegistratiActivity(List<AlreadyRegisteredUlDTO> mtbColts) {
|
||||
|
||||
Intent myIntent = ListaBancaliActivity.createIntent(this,
|
||||
|
||||
Stream.of(mtbColts)
|
||||
.map(AlreadyRegisteredUDCDTO::getMtbColt)
|
||||
.map(AlreadyRegisteredUlDTO::getMtbColt)
|
||||
.toList(),
|
||||
|
||||
input -> Stream.of(mtbColts)
|
||||
@@ -620,6 +620,7 @@ public class AccettazioneBollaPickingActivity extends BaseActivity implements Ac
|
||||
.setDataScad(dataScad)
|
||||
.setCanPartitaMagBeChanged(canPartitaMagBeChanged)
|
||||
.setCanLUBeClosed(true)
|
||||
.setQtaTotEditable(SettingsManager.iDB().isFlagAccettazioneBollaEditableQtaTot())
|
||||
.setCanOverflowOrderQuantity(canOverflowQuantity)
|
||||
.setDisableTracciabilitaCheck(SettingsManager.iDB().isFlagAccettazioneBollaDisableMandatoryTracciabilita());
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingL
|
||||
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.dto.AlreadyRegisteredUDCDTO;
|
||||
import it.integry.integrywmsnative.core.model.dto.AlreadyRegisteredUlDTO;
|
||||
import it.integry.integrywmsnative.core.model.dto.PickDataDTO;
|
||||
import it.integry.integrywmsnative.core.model.observable.ObservableMtbTcol;
|
||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
@@ -160,7 +160,7 @@ public class AccettazioneBollaPickingViewModel {
|
||||
}
|
||||
|
||||
|
||||
public void retrieveExistentLU(RunnableArgs<List<AlreadyRegisteredUDCDTO>> onComplete) {
|
||||
public void retrieveExistentLU(RunnableArgs<List<AlreadyRegisteredUlDTO>> onComplete) {
|
||||
this.sendOnLoadingStarted();
|
||||
|
||||
this.mAccettazioneBollaPickingRESTConsumer.retrieveAlreadyRegisteredUDC(this.mBolle, mtbColtList -> {
|
||||
|
||||
@@ -2,17 +2,17 @@ package it.integry.integrywmsnative.gest.accettazione_bolla_picking.dto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.dto.AlreadyRegisteredUDCDTO;
|
||||
import it.integry.integrywmsnative.core.model.dto.AlreadyRegisteredUlDTO;
|
||||
|
||||
public class RetrieveAlreadyRegisteredULAccettazioneBollaResponseDTO {
|
||||
|
||||
private List<AlreadyRegisteredUDCDTO> udcList;
|
||||
private List<AlreadyRegisteredUlDTO> udcList;
|
||||
|
||||
public List<AlreadyRegisteredUDCDTO> getUdcList() {
|
||||
public List<AlreadyRegisteredUlDTO> getUdcList() {
|
||||
return udcList;
|
||||
}
|
||||
|
||||
public RetrieveAlreadyRegisteredULAccettazioneBollaResponseDTO setUdcList(List<AlreadyRegisteredUDCDTO> udcList) {
|
||||
public RetrieveAlreadyRegisteredULAccettazioneBollaResponseDTO setUdcList(List<AlreadyRegisteredUlDTO> udcList) {
|
||||
this.udcList = udcList;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.model.dto.AlreadyRegisteredUDCDTO;
|
||||
import it.integry.integrywmsnative.core.model.dto.AlreadyRegisteredUlDTO;
|
||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||
import it.integry.integrywmsnative.core.rest.consumers._BaseRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
|
||||
@@ -32,7 +32,7 @@ public class AccettazioneBollaPickingRESTConsumer extends _BaseRESTConsumer {
|
||||
}
|
||||
|
||||
|
||||
public void retrieveAlreadyRegisteredUDC(List<TestataBollaAccettazioneDTO> bolle, RunnableArgs<List<AlreadyRegisteredUDCDTO>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public void retrieveAlreadyRegisteredUDC(List<TestataBollaAccettazioneDTO> bolle, RunnableArgs<List<AlreadyRegisteredUlDTO>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
AccettazioneBollaPickingRESTConsumerService service = restBuilder.getService(AccettazioneBollaPickingRESTConsumerService.class);
|
||||
|
||||
var request = new RetrieveAlreadyRegisteredULAccettazioneBollaRequestDTO()
|
||||
|
||||
@@ -114,7 +114,7 @@ public class AccettazioneBollaPickingListAdapter extends SectionedRecyclerViewAd
|
||||
} else if (position % 2 == 1) {
|
||||
holder.mBinding.getRoot().setBackgroundColor(Color.WHITE);
|
||||
} 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);
|
||||
|
||||
@@ -78,7 +78,6 @@ public class MainAccettazioneOrdiniElencoFragment extends BaseFragment implement
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(@NonNull Bundle outState) {
|
||||
onLoadingEnded();
|
||||
outState.putString("mToolbar", DataCache.addItem(mToolbar));
|
||||
|
||||
super.onSaveInstanceState(outState);
|
||||
|
||||
@@ -36,6 +36,7 @@ public class SitArtOrdDTO {
|
||||
private String descrizioneEstesaArt;
|
||||
private String descrizioneEstesaOrd;
|
||||
private Date dataCons;
|
||||
private String partitaMag;
|
||||
|
||||
public String getDescrizioneEstesaOrd() {
|
||||
return descrizioneEstesaOrd;
|
||||
@@ -301,4 +302,13 @@ public class SitArtOrdDTO {
|
||||
this.dataCons = dataCons;
|
||||
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.MenuItem;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.widget.PopupMenu;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import androidx.databinding.ObservableArrayList;
|
||||
@@ -19,6 +18,7 @@ import androidx.preference.PreferenceManager;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@@ -45,7 +45,7 @@ import it.integry.integrywmsnative.core.expansion.RunnableArgss;
|
||||
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.dto.AlreadyRegisteredUDCDTO;
|
||||
import it.integry.integrywmsnative.core.model.dto.AlreadyRegisteredUlDTO;
|
||||
import it.integry.integrywmsnative.core.model.observable.ObservableMtbTcol;
|
||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
import it.integry.integrywmsnative.core.report.ReportManager;
|
||||
@@ -157,7 +157,17 @@ public class AccettazioneOrdiniPickingActivity extends BaseActivity implements A
|
||||
boolean useQtaOrd = SettingsManager.iDB().isFlagAccettazioneUseQtaOrd();
|
||||
|
||||
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() {
|
||||
@@ -369,7 +379,7 @@ public class AccettazioneOrdiniPickingActivity extends BaseActivity implements A
|
||||
|
||||
private void refreshList() {
|
||||
|
||||
runOnUiThread(() -> {
|
||||
handler.post(() -> {
|
||||
List<PickingObjectDTO> tmpList;
|
||||
|
||||
if (mAppliedFilterViewModel != null) {
|
||||
@@ -683,18 +693,23 @@ public class AccettazioneOrdiniPickingActivity extends BaseActivity implements A
|
||||
}
|
||||
|
||||
private void showOrderByDialog() {
|
||||
AlertDialog dialog = new AlertDialog.Builder(this).setTitle(this.getText(R.string.action_orderBy)).setSingleChoiceItems(AccettazioneOrdineInevasoOrderBy.descriptions, mCurrentOrderBy.getVal(), (dialog12, which) -> {
|
||||
mCurrentOrderBy = AccettazioneOrdineInevasoOrderBy.Enum.fromInt(which);
|
||||
SettingsManager.i().getUserSession().setDefaultOrdinamentoPickingAccettazione(which);
|
||||
}).setPositiveButton(getText(R.string.ok), (dialog1, which) -> this.refreshList()).create();
|
||||
MaterialAlertDialogBuilder dialog = new MaterialAlertDialogBuilder(this)
|
||||
.setTitle(this.getText(R.string.action_orderBy))
|
||||
.setSingleChoiceItems(AccettazioneOrdineInevasoOrderBy.descriptions, mCurrentOrderBy.getVal(),
|
||||
(dialog12, which) -> {
|
||||
mCurrentOrderBy = AccettazioneOrdineInevasoOrderBy.Enum.fromInt(which);
|
||||
SettingsManager.i().getUserSession().setDefaultOrdinamentoPickingAccettazione(which);
|
||||
})
|
||||
.setPositiveButton(getText(R.string.ok), (dialog1, which) -> this.refreshList());
|
||||
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
public void startListaBancaliRegistratiActivity(List<AlreadyRegisteredUDCDTO> mtbColts) {
|
||||
public void startListaBancaliRegistratiActivity(List<AlreadyRegisteredUlDTO> mtbColts) {
|
||||
|
||||
Intent myIntent = ListaBancaliActivity.createIntent(this,
|
||||
|
||||
Stream.of(mtbColts).map(AlreadyRegisteredUDCDTO::getMtbColt).toList(),
|
||||
Stream.of(mtbColts).map(AlreadyRegisteredUlDTO::getMtbColt).toList(),
|
||||
|
||||
input -> Stream.of(mtbColts).filter(x -> x.getMtbColt() == input).findFirstOrElse(null).isCanBeRecovered(),
|
||||
|
||||
@@ -772,7 +787,7 @@ public class AccettazioneOrdiniPickingActivity extends BaseActivity implements A
|
||||
|
||||
@Override
|
||||
public void onWarning(String warningText, Runnable action) {
|
||||
this.runOnUiThread(() -> {
|
||||
handler.post(() -> {
|
||||
this.onLoadingEnded();
|
||||
DialogSimpleMessageView
|
||||
.makeWarningDialog(new SpannableString(Html.fromHtml(warningText)), null, action)
|
||||
@@ -800,7 +815,7 @@ public class AccettazioneOrdiniPickingActivity extends BaseActivity implements A
|
||||
|
||||
@Override
|
||||
public void onRowSaved() {
|
||||
runOnUiThread(() -> {
|
||||
handler.post(() -> {
|
||||
Snackbar.make(mBindings.getRoot(), R.string.data_saved, Snackbar.LENGTH_SHORT)
|
||||
.setBackgroundTint(getResources().getColor(R.color.green_500))
|
||||
.show();
|
||||
@@ -809,7 +824,7 @@ public class AccettazioneOrdiniPickingActivity extends BaseActivity implements A
|
||||
|
||||
@Override
|
||||
public void onFilterCodMartApplied(String codMartToFilter) {
|
||||
runOnUiThread(() -> {
|
||||
handler.post(() -> {
|
||||
var codMarts = new ArrayList<String>();
|
||||
codMarts.add(codMartToFilter);
|
||||
|
||||
@@ -819,7 +834,7 @@ public class AccettazioneOrdiniPickingActivity extends BaseActivity implements A
|
||||
|
||||
@Override
|
||||
public void onFilterPosizioneApplied(String posizioneToFilter) {
|
||||
runOnUiThread(() -> {
|
||||
handler.post(() -> {
|
||||
var posizioni = new ArrayList<String>();
|
||||
posizioni.add(posizioneToFilter);
|
||||
|
||||
@@ -830,7 +845,7 @@ public class AccettazioneOrdiniPickingActivity extends BaseActivity implements A
|
||||
@Override
|
||||
public void onULVersata(VersamentoAutomaticoULResponseDTO versamentoAutomaticoULResponseDTO, Runnable onComplete) {
|
||||
|
||||
runOnUiThread(() -> {
|
||||
handler.post(() -> {
|
||||
DialogVersamentoAutomaticoULDoneView.newInstance(versamentoAutomaticoULResponseDTO, onComplete).show(getSupportFragmentManager(), "tag");
|
||||
});
|
||||
|
||||
@@ -838,7 +853,7 @@ public class AccettazioneOrdiniPickingActivity extends BaseActivity implements A
|
||||
|
||||
@Override
|
||||
public void onMtbColrDeleteRequest(RunnableArgs<Boolean> onComplete) {
|
||||
runOnUiThread(() -> {
|
||||
handler.post(() -> {
|
||||
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");
|
||||
});
|
||||
@@ -846,7 +861,7 @@ public class AccettazioneOrdiniPickingActivity extends BaseActivity implements A
|
||||
|
||||
@Override
|
||||
public void onLUOpened(MtbColt mtbColt) {
|
||||
runOnUiThread(() -> {
|
||||
handler.post(() -> {
|
||||
noLUPresent.set(false);
|
||||
Snackbar.make(mBindings.getRoot(), R.string.data_saved, Snackbar.LENGTH_SHORT)
|
||||
.setBackgroundTint(getResources().getColor(R.color.green_500))
|
||||
|
||||
@@ -1,50 +1,9 @@
|
||||
package it.integry.integrywmsnative.gest.accettazione_ordini_picking;
|
||||
|
||||
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)
|
||||
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;
|
||||
|
||||
import android.os.Handler;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.databinding.ObservableArrayList;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
@@ -11,6 +13,8 @@ import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.inject.Inject;
|
||||
@@ -32,7 +36,7 @@ import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingL
|
||||
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.dto.AlreadyRegisteredUDCDTO;
|
||||
import it.integry.integrywmsnative.core.model.dto.AlreadyRegisteredUlDTO;
|
||||
import it.integry.integrywmsnative.core.model.dto.PickDataDTO;
|
||||
import it.integry.integrywmsnative.core.model.observable.ObservableMtbTcol;
|
||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
@@ -72,6 +76,8 @@ import it.integry.integrywmsnative.view.dialogs.tracciamento_imballi.Tracciament
|
||||
|
||||
public class AccettazioneOrdiniPickingViewModel {
|
||||
|
||||
private final ExecutorService executorService;
|
||||
private final Handler handler;
|
||||
private final ArticoloRESTConsumer mArticoloRESTConsumer;
|
||||
private final BarcodeRESTConsumer mBarcodeRESTConsumer;
|
||||
private final ColliMagazzinoRESTConsumer mColliMagazzinoRESTConsumer;
|
||||
@@ -96,7 +102,9 @@ public class AccettazioneOrdiniPickingViewModel {
|
||||
private final List<HistoryMtbAartDTO> mHistoryUsedAarts = new ArrayList<>();
|
||||
|
||||
@Inject
|
||||
public AccettazioneOrdiniPickingViewModel(ArticoloRESTConsumer articoloRESTConsumer,
|
||||
public AccettazioneOrdiniPickingViewModel(Handler handler,
|
||||
ExecutorService executorService,
|
||||
ArticoloRESTConsumer articoloRESTConsumer,
|
||||
BarcodeRESTConsumer barcodeRESTConsumer,
|
||||
ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer,
|
||||
AccettazioneOrdiniPickingRESTConsumer accettazioneOrdiniPickingRESTConsumer,
|
||||
@@ -104,6 +112,8 @@ public class AccettazioneOrdiniPickingViewModel {
|
||||
ColliLavorazioneRESTConsumer colliLavorazioneRESTConsumer,
|
||||
Ean128Service ean128Service,
|
||||
ImballiRESTConsumer imballiRESTConsumer) {
|
||||
this.handler = handler;
|
||||
this.executorService = executorService;
|
||||
this.mArticoloRESTConsumer = articoloRESTConsumer;
|
||||
this.mBarcodeRESTConsumer = barcodeRESTConsumer;
|
||||
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.mUseQtaOrd = useQtaOrd;
|
||||
|
||||
List<SitArtOrdDTO> mSitArts = Stream.of(sitArts)
|
||||
List<SitArtOrdDTO> mSitArts = sitArts.stream()
|
||||
.filter(x ->
|
||||
UtilityBigDecimal.greaterThan(x.getNumCnfDaEvadere(), BigDecimal.ZERO) &&
|
||||
UtilityBigDecimal.greaterThan(x.getQtaDaEvadere(), BigDecimal.ZERO))
|
||||
.toList();
|
||||
|
||||
getEmptyPickingList(mSitArts, this.mPickingList::postValue);
|
||||
var pickingList = getEmptyPickingList(mSitArts);
|
||||
this.mPickingList.postValue(pickingList);
|
||||
|
||||
//Definizione della gestione collo di default
|
||||
Boolean isOrdTrasf = Stream.of(mOrders)
|
||||
Boolean isOrdTrasf = mOrders.stream()
|
||||
.map(OrdineAccettazioneInevasoDTO::isOrdTrasf)
|
||||
.withoutNulls()
|
||||
.distinctBy(x -> x)
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.findFirst()
|
||||
.get();
|
||||
|
||||
@@ -145,10 +156,10 @@ public class AccettazioneOrdiniPickingViewModel {
|
||||
|
||||
|
||||
//Definizione della gestione collo di default
|
||||
List<GestioneEnum> foundGestioni = Stream.of(mOrders)
|
||||
List<GestioneEnum> foundGestioni = mOrders.stream()
|
||||
.map(OrdineAccettazioneInevasoDTO::getGestioneEnum)
|
||||
.withoutNulls()
|
||||
.distinctBy(x -> x)
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.toList();
|
||||
|
||||
if (foundGestioni.size() == 1) {
|
||||
@@ -157,7 +168,7 @@ public class AccettazioneOrdiniPickingViewModel {
|
||||
} else
|
||||
defaultGestioneOfUL = foundGestioni.get(0) == GestioneEnum.PRODUZIONE ? GestioneEnum.LAVORAZIONE : foundGestioni.get(0);
|
||||
} else {
|
||||
this.sendError(new InvalidLUMultiGestioneException());
|
||||
throw new InvalidLUMultiGestioneException();
|
||||
}
|
||||
|
||||
switch (defaultGestioneOfUL) {
|
||||
@@ -166,39 +177,38 @@ 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)
|
||||
.toList();
|
||||
.collect(Collectors.toList());
|
||||
|
||||
this.mArticoloRESTConsumer.getByCodMarts(codMarts, listMtbAarts -> {
|
||||
List<PickingObjectDTO> pickingList = Stream.of(sitArtOrdList)
|
||||
.map(sitArtOrdDTO -> {
|
||||
MtbAart mtbAart = null;
|
||||
var listMtbAarts = this.mArticoloRESTConsumer.getByCodMartsSynchronized(codMarts);
|
||||
List<PickingObjectDTO> pickingList = sitArtOrdList.stream()
|
||||
.map(sitArtOrdDTO -> {
|
||||
MtbAart mtbAart = null;
|
||||
|
||||
for (MtbAart mtbAartItem : listMtbAarts) {
|
||||
if (mtbAartItem.getCodMart().equalsIgnoreCase(sitArtOrdDTO.getCodMart())) {
|
||||
mtbAart = mtbAartItem;
|
||||
break;
|
||||
}
|
||||
for (MtbAart mtbAartItem : listMtbAarts) {
|
||||
if (mtbAartItem.getCodMart().equalsIgnoreCase(sitArtOrdDTO.getCodMart())) {
|
||||
mtbAart = mtbAartItem;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return new PickingObjectDTO()
|
||||
.setSitArtOrdDTO(sitArtOrdDTO)
|
||||
.setMtbAart(mtbAart);
|
||||
})
|
||||
.toList();
|
||||
return new PickingObjectDTO()
|
||||
.setSitArtOrdDTO(sitArtOrdDTO)
|
||||
.setMtbAart(mtbAart);
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
|
||||
onComplete.run(pickingList);
|
||||
}, this::sendError);
|
||||
return pickingList;
|
||||
}
|
||||
|
||||
public MutableLiveData<List<PickingObjectDTO>> getPickingList() {
|
||||
return mPickingList;
|
||||
}
|
||||
|
||||
public void retrieveExistentLU(RunnableArgs<List<AlreadyRegisteredUDCDTO>> onComplete) {
|
||||
public void retrieveExistentLU(RunnableArgs<List<AlreadyRegisteredUlDTO>> onComplete) {
|
||||
this.sendOnLoadingStarted();
|
||||
|
||||
this.mAccettazioneOrdiniPickingRESTConsumer.getBancaliGiaRegistrati(this.mOrders, mtbColtList -> {
|
||||
@@ -273,7 +283,7 @@ public class AccettazioneOrdiniPickingViewModel {
|
||||
try {
|
||||
numCollo = UtilityBarcode.getNumColloFromULAnonima(barcodeScanDTO.getStringValue());
|
||||
this.createNewLU(
|
||||
null,
|
||||
barcodeScanDTO.getStringValue(),
|
||||
numCollo,
|
||||
CommonConst.Config.DEFAULT_ANONYMOUS_UL_SERIE, true, onComplete);
|
||||
} catch (Exception ex) {
|
||||
@@ -559,6 +569,9 @@ public class AccettazioneOrdiniPickingViewModel {
|
||||
dataScad = dataScad.plusDays(pickingObjectDTO.getMtbAart().getGgScadPartita());
|
||||
}
|
||||
|
||||
if (partitaMag == null && SettingsManager.iDB().isFlagAccettazioneViewLotto())
|
||||
partitaMag = pickingObjectDTO.getSitArtOrdDTO().getPartitaMag();
|
||||
|
||||
if (partitaMag == null && dataScad == null) {
|
||||
HistoryMtbAartDTO historyMtbAartDTO = this.getHistoryItemIfExists(pickingObjectDTO.getMtbAart().getCodMart());
|
||||
|
||||
@@ -651,8 +664,10 @@ public class AccettazioneOrdiniPickingViewModel {
|
||||
.setUntMis(pickingObjectDTO.getMtbAart().getUntMis())
|
||||
.setMtbAart(pickingObjectDTO.getMtbAart());
|
||||
|
||||
pickingObjectDTO.getWithdrawMtbColrs().add(insertedMtbColr);
|
||||
mCurrentMtbColt.getMtbColr().add(insertedMtbColr);
|
||||
handler.post(() -> {
|
||||
pickingObjectDTO.getWithdrawMtbColrs().add(insertedMtbColr);
|
||||
mCurrentMtbColt.getMtbColr().add(insertedMtbColr);
|
||||
});
|
||||
|
||||
//Chiamato removeListFilter perché cosi mi cancella tutti i dati di pick temporanei
|
||||
resetMatchedRows();
|
||||
@@ -768,7 +783,9 @@ public class AccettazioneOrdiniPickingViewModel {
|
||||
pickingObjectDTO.get().getWithdrawMtbColrs().remove(mtbColrToDelete);
|
||||
}
|
||||
|
||||
this.mCurrentMtbColt.getMtbColr().remove(mtbColrToDelete);
|
||||
handler.post(() -> {
|
||||
this.mCurrentMtbColt.getMtbColr().remove(mtbColrToDelete);
|
||||
});
|
||||
|
||||
this.resetMatchedRows();
|
||||
this.sendOnRowSaved();
|
||||
|
||||
@@ -2,17 +2,17 @@ package it.integry.integrywmsnative.gest.accettazione_ordini_picking.dto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.dto.AlreadyRegisteredUDCDTO;
|
||||
import it.integry.integrywmsnative.core.model.dto.AlreadyRegisteredUlDTO;
|
||||
|
||||
public class RetrieveAlreadyRegisteredULAccettazioneOrdineResponseDTO {
|
||||
|
||||
private List<AlreadyRegisteredUDCDTO> udcList;
|
||||
private List<AlreadyRegisteredUlDTO> udcList;
|
||||
|
||||
public List<AlreadyRegisteredUDCDTO> getUdcList() {
|
||||
public List<AlreadyRegisteredUlDTO> getUdcList() {
|
||||
return udcList;
|
||||
}
|
||||
|
||||
public RetrieveAlreadyRegisteredULAccettazioneOrdineResponseDTO setUdcList(List<AlreadyRegisteredUDCDTO> udcList) {
|
||||
public RetrieveAlreadyRegisteredULAccettazioneOrdineResponseDTO setUdcList(List<AlreadyRegisteredUlDTO> udcList) {
|
||||
this.udcList = udcList;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.model.dto.AlreadyRegisteredUDCDTO;
|
||||
import it.integry.integrywmsnative.core.model.dto.AlreadyRegisteredUlDTO;
|
||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers._BaseRESTConsumer;
|
||||
@@ -33,7 +33,7 @@ public class AccettazioneOrdiniPickingRESTConsumer extends _BaseRESTConsumer {
|
||||
this.systemRestConsumer = systemRESTConsumer;
|
||||
}
|
||||
|
||||
public void getBancaliGiaRegistrati(List<OrdineAccettazioneInevasoDTO> ordiniToShow, RunnableArgs<List<AlreadyRegisteredUDCDTO>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public void getBancaliGiaRegistrati(List<OrdineAccettazioneInevasoDTO> ordiniToShow, RunnableArgs<List<AlreadyRegisteredUlDTO>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
AccettazioneOrdiniPickingRESTConsumerService service = restBuilder.getService(AccettazioneOrdiniPickingRESTConsumerService.class);
|
||||
|
||||
var request = new RetrieveAlreadyRegisteredULAccettazioneOrdineRequestDTO()
|
||||
|
||||
@@ -22,6 +22,7 @@ import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.expansion.OnListGeneralChangedCallback;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
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.databinding.AccettazioneOrdineInevasoMainListGroupHeaderBinding;
|
||||
import it.integry.integrywmsnative.databinding.AccettazioneOrdineInevasoMainListGroupItemBinding;
|
||||
@@ -112,9 +113,9 @@ public class AccettazioneOrdiniPickingListAdapter extends SectionedRecyclerViewA
|
||||
} else if (pickingObjectDTO.getQtaEvasa().floatValue() > 0) {
|
||||
holder.mBinding.getRoot().setBackgroundColor(mContext.getResources().getColor(R.color.orange_600_with_alpha));
|
||||
} else if (position % 2 == 1) {
|
||||
holder.mBinding.getRoot().setBackgroundColor(Color.WHITE);
|
||||
holder.mBinding.getRoot().setBackgroundColor(0);
|
||||
} 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);
|
||||
|
||||
@@ -45,9 +45,7 @@ public class DialogSelectDocInfo_FornitoreAdapter extends ArrayAdapter<DialogSel
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.getOriginalModel().getCodAnag() +
|
||||
(this.getOriginalModel().getCodVdes() != null ? " - " + this.getOriginalModel().getCodVdes() : "") +
|
||||
" ( " + this.getOriginalModel().getDescrizione() + " )";
|
||||
return this.getOriginalModel().getDescrizione();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ public class ContenutoBancaleActivity extends BaseActivity implements ContenutoB
|
||||
public final ObservableField<MtbColt> mtbColt = new ObservableField<>();
|
||||
public final ObservableField<String> descrizioneDepo = new ObservableField<>();
|
||||
public ObservableField<Boolean> fabVisible = new ObservableField<>(true);
|
||||
public ObservableField<Boolean> recoverFabMenuVisible = new ObservableField<>(false);
|
||||
public Boolean recoverFabMenuVisible = false;
|
||||
private PopupMenu fabPopupMenu;
|
||||
|
||||
private String mReportName;
|
||||
@@ -80,7 +80,7 @@ public class ContenutoBancaleActivity extends BaseActivity implements ContenutoB
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
boolean canRecoverUL = DataCache.retrieveItem(getIntent().getStringExtra(Key.CanRecoverUL));
|
||||
recoverFabMenuVisible = DataCache.retrieveItem(getIntent().getStringExtra(Key.CanRecoverUL));
|
||||
mtbColt.set(DataCache.retrieveItem(getIntent().getStringExtra(Key.MtbColtKey)));
|
||||
mReportName = DataCache.retrieveItem(getIntent().getStringExtra(Key.ReportName));
|
||||
|
||||
@@ -102,8 +102,6 @@ public class ContenutoBancaleActivity extends BaseActivity implements ContenutoB
|
||||
mViewModel.setListener(this);
|
||||
mViewModel.init(mtbColt.get(), mReportName);
|
||||
|
||||
recoverFabMenuVisible.set(canRecoverUL);
|
||||
|
||||
this.initRecyclerView();
|
||||
this.initColloInfo();
|
||||
this.initFab();
|
||||
@@ -125,7 +123,7 @@ public class ContenutoBancaleActivity extends BaseActivity implements ContenutoB
|
||||
}
|
||||
|
||||
private void initColloInfo() {
|
||||
SettingsManager.iDB().getAvailableCodMdep().stream()
|
||||
SettingsManager.iDB().getAvailableDepos().stream()
|
||||
.filter(x -> x.getCodMdep().equalsIgnoreCase(mtbColt.get().getCodMdep()))
|
||||
.findFirst()
|
||||
.ifPresent(x -> descrizioneDepo.set("(" + x.getDescrizione() + ")"));
|
||||
@@ -144,6 +142,10 @@ public class ContenutoBancaleActivity extends BaseActivity implements ContenutoB
|
||||
fabPopupMenu.getMenu().removeItem(R.id.delete_ul);
|
||||
}
|
||||
|
||||
if(!recoverFabMenuVisible) {
|
||||
fabPopupMenu.getMenu().removeItem(R.id.recover_ul);
|
||||
}
|
||||
|
||||
fabPopupMenu.setOnMenuItemClickListener(item -> {
|
||||
int itemId = item.getItemId();
|
||||
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
package it.integry.integrywmsnative.gest.login.dto;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class AuthTokenClaimsDTO {
|
||||
|
||||
@SerializedName("deviceId")
|
||||
private long deviceId;
|
||||
|
||||
@SerializedName("userDTO")
|
||||
private User userDTO;
|
||||
|
||||
@SerializedName("profilesData")
|
||||
private HashMap<String, AuthTokenProfileDetails> profilesData;
|
||||
|
||||
public long getDeviceId() {
|
||||
@@ -36,11 +42,22 @@ public class AuthTokenClaimsDTO {
|
||||
}
|
||||
|
||||
public class User {
|
||||
@SerializedName("username")
|
||||
private String username;
|
||||
|
||||
@SerializedName("email")
|
||||
private Object email;
|
||||
|
||||
@SerializedName("fullname")
|
||||
private String fullname;
|
||||
|
||||
@SerializedName("keyGroup")
|
||||
private int keyGroup;
|
||||
|
||||
@SerializedName("attivo")
|
||||
private boolean attivo;
|
||||
|
||||
@SerializedName("type")
|
||||
private String type;
|
||||
|
||||
public String getUsername() {
|
||||
@@ -99,6 +116,7 @@ public class AuthTokenClaimsDTO {
|
||||
}
|
||||
|
||||
public static class AuthTokenProfileDetails {
|
||||
@SerializedName("defaultDepo")
|
||||
private AuthTokenDepoDetails defaultDepo;
|
||||
|
||||
public AuthTokenDepoDetails getDefaultDepo() {
|
||||
@@ -112,8 +130,13 @@ public class AuthTokenClaimsDTO {
|
||||
}
|
||||
|
||||
public static class AuthTokenDepoDetails {
|
||||
@SerializedName("codMdep")
|
||||
private String codMdep;
|
||||
|
||||
@SerializedName("descrizione")
|
||||
private String descrizione;
|
||||
|
||||
@SerializedName("codJfas")
|
||||
private String codJfas;
|
||||
|
||||
public String getCodMdep() {
|
||||
|
||||
@@ -1,12 +1,20 @@
|
||||
package it.integry.integrywmsnative.gest.login.dto;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
public class AuthenticationJwtResponseDTO {
|
||||
|
||||
@SerializedName("accessToken")
|
||||
private String accessToken;
|
||||
|
||||
@SerializedName("refreshToken")
|
||||
private String refreshToken;
|
||||
|
||||
@SerializedName("expiryDate")
|
||||
private LocalDateTime expiryDate;
|
||||
|
||||
@SerializedName("expireIn")
|
||||
private long expireIn;
|
||||
|
||||
|
||||
|
||||
@@ -1,11 +1,22 @@
|
||||
package it.integry.integrywmsnative.gest.login.dto;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class LoginAziendaDTO {
|
||||
|
||||
@SerializedName("profileDb")
|
||||
private String profileDb;
|
||||
|
||||
@SerializedName("endpointRestApi")
|
||||
private String endpointRestApi;
|
||||
|
||||
@SerializedName("phpApi")
|
||||
private String phpApi;
|
||||
|
||||
@SerializedName("repoPhoto")
|
||||
private String repoPhoto;
|
||||
|
||||
@SerializedName("endpointPvm")
|
||||
private String endpointPvm;
|
||||
|
||||
public String getProfileDb() {
|
||||
|
||||
@@ -1,9 +1,16 @@
|
||||
package it.integry.integrywmsnative.gest.login.dto;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class LoginRequestDTO {
|
||||
|
||||
@SerializedName("username")
|
||||
private String username;
|
||||
|
||||
@SerializedName("password")
|
||||
private String password;
|
||||
|
||||
@SerializedName("deviceId")
|
||||
private String deviceId;
|
||||
|
||||
public String getUsername() {
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
package it.integry.integrywmsnative.gest.login.dto;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import java.util.List;
|
||||
|
||||
public class LoginResponseDTO {
|
||||
|
||||
@SerializedName("fullName")
|
||||
private String fullName;
|
||||
private List<String> availableProfiles;
|
||||
|
||||
@SerializedName("availableProfiles")
|
||||
private List<String> availableProfiles;
|
||||
|
||||
public String getFullName() {
|
||||
return fullName;
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package it.integry.integrywmsnative.gest.login.dto;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class RefreshRequestDTO {
|
||||
@SerializedName("refreshToken")
|
||||
private String refreshToken;
|
||||
|
||||
public String getRefreshToken() {
|
||||
|
||||
@@ -34,7 +34,7 @@ public class AuthenticationRESTConsumer extends _BaseRESTConsumer {
|
||||
String host = CommonConst.Login.Azienda.host;
|
||||
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<>() {
|
||||
@Override
|
||||
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) {
|
||||
AuthenticationRESTConsumerService service = restBuilder.getService(AuthenticationRESTConsumerService.class, protocol, host, port, false);
|
||||
AuthenticationRESTConsumerService service = restBuilder.getService(AuthenticationRESTConsumerService.class, protocol, host, port);
|
||||
|
||||
LoginRequestDTO loginRequestDTO = new LoginRequestDTO()
|
||||
.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) {
|
||||
AuthenticationRESTConsumerService service = restBuilder.getService(AuthenticationRESTConsumerService.class, protocol, host, port, false);
|
||||
AuthenticationRESTConsumerService service = restBuilder.getService(AuthenticationRESTConsumerService.class, protocol, host, port);
|
||||
|
||||
service.retreiveAvailableProfiles(username, password)
|
||||
.enqueue(new ManagedErrorCallback<>() {
|
||||
|
||||
@@ -49,8 +49,12 @@ public class LoginViewModel {
|
||||
|
||||
FirebaseInstallations.getInstance().getId().addOnCompleteListener(fid -> {
|
||||
|
||||
SettingsManager.i().createUserSession();
|
||||
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 -> {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
|
||||
mAuthenticationRESTConsumer.authenticate(protocol, host, port, username, password, profileDb, deviceSalt, sessionData -> {
|
||||
|
||||
var claims = JwtUtils.parseJwt(sessionData.getAccessToken());
|
||||
@@ -152,7 +158,7 @@ public class LoginViewModel {
|
||||
public void loadDepo(Runnable onComplete) {
|
||||
|
||||
this.mSystemRESTConsumer.getAvailableCodMdeps(availableCodMdeps -> {
|
||||
SettingsManager.iDB().setAvailableCodMdep(availableCodMdeps);
|
||||
SettingsManager.iDB().setAvailableDepos(availableCodMdeps);
|
||||
|
||||
if (availableCodMdeps == null || availableCodMdeps.isEmpty()) {
|
||||
this.sendError(new InvalidUserDepositException());
|
||||
|
||||
@@ -93,7 +93,7 @@ public class MainActivity extends BaseActivity
|
||||
mBinding = DataBindingUtil.inflate(LayoutInflater.from(this), R.layout.activity_main, null, false);
|
||||
setContentView(mBinding.getRoot());
|
||||
|
||||
updatesManager.executeCheck(this, false);
|
||||
updatesManager.executeCheck(this, getSupportFragmentManager(), false);
|
||||
UtilityContext.initMainActivity(this);
|
||||
|
||||
setSupportActionBar(mBinding.appBarMain.toolbar);
|
||||
@@ -102,7 +102,7 @@ public class MainActivity extends BaseActivity
|
||||
|
||||
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
|
||||
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();
|
||||
|
||||
|
||||
@@ -122,6 +122,16 @@ public class MainActivity extends BaseActivity
|
||||
startActivity(myIntent);
|
||||
}
|
||||
|
||||
|
||||
public void toggleDrawer() {
|
||||
if (mBinding.drawerLayout.isDrawerOpen(GravityCompat.START)) {
|
||||
mBinding.drawerLayout.closeDrawer(GravityCompat.START);
|
||||
} else {
|
||||
mBinding.drawerLayout.openDrawer(GravityCompat.START);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
||||
@@ -294,9 +304,13 @@ public class MainActivity extends BaseActivity
|
||||
for (int i = 0; i < count; i++) {
|
||||
getSupportFragmentManager().popBackStack();
|
||||
}
|
||||
|
||||
mBinding.appBarMain.elevatedToolbar.setVisibility(getSupportFragmentManager().getBackStackEntryCount() > 1 ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
private void adaptViewToFragment(Fragment fragment) {
|
||||
mBinding.appBarMain.elevatedToolbar.setVisibility(fragment instanceof MainFragment ? View.GONE : View.VISIBLE);
|
||||
|
||||
if (fragment instanceof ISearchableFragment) {
|
||||
mBinding.appBarMain.mainSearch.setOnQueryTextListener((SearchView.OnQueryTextListener) fragment);
|
||||
mBinding.appBarMain.mainSearch.setVisibility(View.VISIBLE);
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
package it.integry.integrywmsnative.gest.main;
|
||||
|
||||
|
||||
import android.animation.ArgbEvaluator;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.view.LayoutInflater;
|
||||
@@ -36,11 +33,11 @@ import it.integry.integrywmsnative.core.interfaces.IScrollableFragment;
|
||||
import it.integry.integrywmsnative.core.interfaces.ITitledFragment;
|
||||
import it.integry.integrywmsnative.core.menu.MenuService;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.model.MtbDepo;
|
||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliLavorazioneRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliSpedizioneRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.model.AvailableCodMdepsDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.watcher.ServerStatusChecker;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
@@ -122,7 +119,6 @@ public class MainFragment extends Fragment implements ITitledFragment, IScrollab
|
||||
mBindings = DataBindingUtil.inflate(inflater, R.layout.fragment_main, container, false);
|
||||
mBindings.setView(this);
|
||||
|
||||
mBindings.easterEggHorrorBloodExpandableLayout.setExpanded(false, false);
|
||||
return mBindings.getRoot();
|
||||
}
|
||||
|
||||
@@ -162,7 +158,7 @@ public class MainFragment extends Fragment implements ITitledFragment, IScrollab
|
||||
|
||||
initRecuperoCollo();
|
||||
|
||||
mBindings.switchDepoButton.setVisibility(SettingsManager.iDB().getAvailableCodMdep().size() > 1 ? View.VISIBLE : View.GONE);
|
||||
mBindings.switchDepoButton.setVisibility(SettingsManager.iDB().getAvailableDepos().size() > 1 ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
private void initSessionData() {
|
||||
@@ -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() {
|
||||
if (getActivity() != null)
|
||||
getActivity().runOnUiThread(() -> mBindings.noConnectionTopLayout.collapse(true));
|
||||
@@ -284,8 +287,8 @@ public class MainFragment extends Fragment implements ITitledFragment, IScrollab
|
||||
MenuConfiguration baseMenuConfiguration = new MenuConfiguration();
|
||||
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);
|
||||
|
||||
@@ -313,16 +316,12 @@ public class MainFragment extends Fragment implements ITitledFragment, IScrollab
|
||||
menuListAdapter.setClickListener(this::onMenuClick);
|
||||
|
||||
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) {
|
||||
@@ -339,95 +338,12 @@ public class MainFragment extends Fragment implements ITitledFragment, IScrollab
|
||||
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() {
|
||||
DialogSwitchUserDepoView.newInstance(SettingsManager.iDB().getAvailableCodMdep(), this::onUserDepoChanged)
|
||||
DialogSwitchUserDepoView.newInstance(SettingsManager.iDB().getAvailableDepos(), this::onUserDepoChanged)
|
||||
.show(getParentFragmentManager(), "switch-user-depo");
|
||||
}
|
||||
|
||||
private void onUserDepoChanged(AvailableCodMdepsDTO newDepo) {
|
||||
private void onUserDepoChanged(MtbDepo newDepo) {
|
||||
SettingsManager.i().getUserSession().setDepo(newDepo);
|
||||
initSessionData();
|
||||
}
|
||||
|
||||
@@ -43,10 +43,10 @@ import it.integry.integrywmsnative.core.interfaces.ISelectAllFragment;
|
||||
import it.integry.integrywmsnative.core.interfaces.ITitledFragment;
|
||||
import it.integry.integrywmsnative.core.model.JtbComt;
|
||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.model.MtbDepo;
|
||||
import it.integry.integrywmsnative.core.model.MtbGrup;
|
||||
import it.integry.integrywmsnative.core.model.OrdineInevasoDTO;
|
||||
import it.integry.integrywmsnative.core.model.dto.AlreadyRegisteredUlDTO;
|
||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.CommessaRESTConsumer;
|
||||
@@ -806,7 +806,7 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
Stream.of(this.mOrdiniInevasiMutableData)
|
||||
this.mOrdiniInevasiMutableData.stream()
|
||||
.forEach(x -> x.getSelectedObservable().set(false));
|
||||
}
|
||||
|
||||
@@ -842,7 +842,7 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOrdersDispatched(List<OrdineUscitaInevasoDTO> orders, List<SitArtOrdDTO> sitArts, List<MtbColt> alreadyRegisteredMtbColts) {
|
||||
public void onOrdersDispatched(List<OrdineUscitaInevasoDTO> orders, List<SitArtOrdDTO> sitArts, List<AlreadyRegisteredUlDTO> alreadyRegisteredMtbColts) {
|
||||
List<String> codMarts = Stream.of(sitArts)
|
||||
.distinctBy(SitArtOrdDTO::getCodMart)
|
||||
.map(SitArtOrdDTO::getCodMart)
|
||||
@@ -862,7 +862,6 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
|
||||
() -> SpedizioneActivity.startActivity(getActivity(),
|
||||
sitArts,
|
||||
orders,
|
||||
alreadyRegisteredMtbColts,
|
||||
mCurrentGestioneCol,
|
||||
mCurrentSegnoCol,
|
||||
MtbColr.Causale.DEFAULT,
|
||||
|
||||
@@ -23,9 +23,9 @@ import it.integry.integrywmsnative.core.exception.NoOrderFoundException;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
|
||||
import it.integry.integrywmsnative.core.model.DtbOrdt;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.model.MtbGrup;
|
||||
import it.integry.integrywmsnative.core.model.OrdineInevasoDTO;
|
||||
import it.integry.integrywmsnative.core.model.dto.AlreadyRegisteredUlDTO;
|
||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||
@@ -146,8 +146,7 @@ public class OrdiniUscitaElencoViewModel {
|
||||
List<SitArtOrdDTO> finalSitArts = sitArts;
|
||||
|
||||
this.mOrdiniRESTConsumer.getBancaliGiaRegistrati(
|
||||
Stream.of(selectedOrdersBase).map(x -> (OrdineInevasoDTO) x).toList(),
|
||||
mCurrentGestioneCol,
|
||||
selectedOrdersBase.stream().map(x -> (OrdineInevasoDTO) x).collect(Collectors.toList()),
|
||||
mCurrentSegnoCol,
|
||||
mtbColtList -> {
|
||||
this.sendOnOrdersDispatched(selectedOrdersBase, finalSitArts, mtbColtList);
|
||||
@@ -303,7 +302,7 @@ public class OrdiniUscitaElencoViewModel {
|
||||
if (this.mListener != null) mListener.onOrderFiltered(filteredOrders);
|
||||
}
|
||||
|
||||
private void sendOnOrdersDispatched(List<OrdineUscitaInevasoDTO> orders, List<SitArtOrdDTO> sitArts, List<MtbColt> alreadyRegisteredMtbColts) {
|
||||
private void sendOnOrdersDispatched(List<OrdineUscitaInevasoDTO> orders, List<SitArtOrdDTO> sitArts, List<AlreadyRegisteredUlDTO> alreadyRegisteredMtbColts) {
|
||||
if (this.mListener != null)
|
||||
mListener.onOrdersDispatched(orders, sitArts, alreadyRegisteredMtbColts);
|
||||
}
|
||||
@@ -316,7 +315,7 @@ public class OrdiniUscitaElencoViewModel {
|
||||
|
||||
void onOrderFiltered(List<OrdiniUscitaElencoDTO> filteredOrders);
|
||||
|
||||
void onOrdersDispatched(List<OrdineUscitaInevasoDTO> orders, List<SitArtOrdDTO> sitArts, List<MtbColt> alreadyRegisteredMtbColts);
|
||||
void onOrdersDispatched(List<OrdineUscitaInevasoDTO> orders, List<SitArtOrdDTO> sitArts, List<AlreadyRegisteredUlDTO> alreadyRegisteredMtbColts);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -251,6 +251,9 @@ public class OrdiniUscitaElencoFiltroViewModel {
|
||||
.distinct()
|
||||
.toList();
|
||||
|
||||
if(codMdeps.isEmpty())
|
||||
return new ArrayList<>();
|
||||
|
||||
return Stream.of(Objects.requireNonNull(mtbDepoFullList))
|
||||
.filter(x -> codMdeps.contains(x.getCodMdep()))
|
||||
.distinct()
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user