Compare commits
173 Commits
v1.45.02(4
...
v1.46.23(5
| Author | SHA1 | Date | |
|---|---|---|---|
| c620e9cb96 | |||
| 6ef4961074 | |||
| 12796b11e5 | |||
| 688a8e4bad | |||
| 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 | |||
| be5ebb89d7 | |||
| 5a0b45c6f9 | |||
| 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 | |||
| 7adeee589e | |||
| 52a393c260 | |||
| 60a405536c | |||
| 5f5117c0f6 | |||
| 0740faa964 | |||
| 2f40302791 | |||
| 13b3d5e63b | |||
| 58521997c1 | |||
| af64ca04f9 | |||
| 1e9d048264 | |||
| 6f202c0c7a | |||
| 94a9690045 | |||
| 2b4aa11021 | |||
| f2d5bb76c5 | |||
| 7bdb9b47f4 | |||
| 68bf6767b9 | |||
| 184d1f759c | |||
| 2a26236d94 | |||
| 71a00ac140 | |||
| f10aaaba6b | |||
| 296675f0b0 | |||
| 7f365be53d | |||
| 9e85204d04 | |||
| d5d80e71e7 | |||
| 73b360f427 | |||
| 722094bc3e | |||
| 645b2cfe5d | |||
| afcaa82069 | |||
| 393bffe14c | |||
| d44b6f00c6 | |||
| de68c3b49f | |||
| 0591b60fad | |||
| a6cebccad9 | |||
| 4186d90a32 | |||
| bb21441c3d | |||
| 12b1b89713 | |||
| 26512f5dc1 | |||
| 4d29e2ab41 | |||
| 6c6fd38482 | |||
| 2e37e874c3 | |||
| 1b4df1ecd1 | |||
| ce5ab1cfc2 | |||
| 3ac021d7ef | |||
| 4613f13eae | |||
| 71f077a617 | |||
| a80cf53f08 | |||
| ff73a124f0 | |||
| 18937a3315 | |||
| fb6a74aef8 | |||
| cd89ce917e | |||
| eb5ae8443d | |||
| 044bcbd852 | |||
| 53ba5a962b | |||
| db178ce991 | |||
| 7c35e19ed4 | |||
| 326a3a00b2 | |||
| 086597985b | |||
| d238cb1d88 | |||
| 5694d8bd1c | |||
| e5a4cf59c4 | |||
| 12fe5059a6 | |||
| e75121b0bd | |||
| 0312f972bc | |||
| 9d48fec426 | |||
| 645045b492 | |||
| 1988fae4f9 | |||
| 6c621d5ca8 | |||
| b8c8a9d8ea | |||
| 002e855d82 | |||
| 1c6de11e04 | |||
| ce3dfca6e0 | |||
| 706878b1e4 | |||
| 6c59e22101 | |||
| 2d48f6687c |
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-05-14T09:45:15.341614500Z">
|
||||
<Target type="DEFAULT_BOOT">
|
||||
<handle>
|
||||
<DeviceId pluginId="PhysicalDevice" identifier="serial=21088B8EFD" />
|
||||
<DeviceId pluginId="PhysicalDevice" identifier="serial=23324B682F" />
|
||||
</handle>
|
||||
</Target>
|
||||
</DropdownSelection>
|
||||
|
||||
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/*', 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://prod-89.westeurope.logic.azure.com:443/workflows/260580715a9d4447a54dea861a865536/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=EMqPHohvE5o5IGj_gir_iQaAufR4r8ZJxlFx52jklSE'
|
||||
}
|
||||
}
|
||||
}
|
||||
unstable {
|
||||
script {
|
||||
if (env.GIT_BRANCH == "master" || env.GIT_BRANCH == "master-beta") {
|
||||
office365ConnectorSend adaptiveCards: true, color: '#FFDE21', message: 'WMS è INSTABILE', status: 'UNSTABLE', webhookUrl: 'https://prod-89.westeurope.logic.azure.com:443/workflows/260580715a9d4447a54dea861a865536/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=EMqPHohvE5o5IGj_gir_iQaAufR4r8ZJxlFx52jklSE'
|
||||
}
|
||||
}
|
||||
}
|
||||
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://prod-89.westeurope.logic.azure.com:443/workflows/260580715a9d4447a54dea861a865536/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=EMqPHohvE5o5IGj_gir_iQaAufR4r8ZJxlFx52jklSE'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,8 +10,8 @@ apply plugin: 'com.google.gms.google-services'
|
||||
|
||||
android {
|
||||
|
||||
def appVersionCode = 484
|
||||
def appVersionName = '1.45.02'
|
||||
def appVersionCode = 511
|
||||
def appVersionName = '1.46.23'
|
||||
|
||||
signingConfigs {
|
||||
release {
|
||||
@@ -51,9 +51,13 @@ 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
|
||||
}
|
||||
@@ -62,6 +66,8 @@ android {
|
||||
android.buildFeatures.dataBinding true
|
||||
android.buildFeatures.buildConfig true
|
||||
|
||||
android.dataBinding.enabledForTests true
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_17
|
||||
targetCompatibility JavaVersion.VERSION_17
|
||||
@@ -72,12 +78,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 {
|
||||
@@ -99,35 +100,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.8.0')
|
||||
implementation platform('com.google.firebase:firebase-bom:33.14.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.0'
|
||||
|
||||
//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 'androidx.appcompat:appcompat:1.7.0'
|
||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||
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'
|
||||
@@ -135,20 +134,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:2.11.0'
|
||||
implementation 'com.squareup.retrofit2:converter-gson:2.11.0'
|
||||
implementation 'com.annimon:stream:1.2.2'
|
||||
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.8.7'
|
||||
// implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
|
||||
implementation 'androidx.lifecycle:lifecycle-runtime:2.9.0'
|
||||
implementation 'org.apache.commons:commons-text:1.9'
|
||||
|
||||
//MVVM
|
||||
def dagger2_version = '2.55'
|
||||
api "com.google.dagger:dagger:$dagger2_version"
|
||||
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"
|
||||
|
||||
@@ -160,7 +157,7 @@ dependencies {
|
||||
implementation 'com.github.pedromassango:doubleClick:3.0'
|
||||
|
||||
//SQLite ROOM
|
||||
def room_version = "2.6.1"
|
||||
def room_version = "2.7.1"
|
||||
|
||||
implementation "androidx.room:room-runtime:$room_version"
|
||||
annotationProcessor "androidx.room:room-compiler:$room_version"
|
||||
@@ -189,10 +186,7 @@ dependencies {
|
||||
implementation 'io.reactivex.rxjava2:rxjava:2.1.12'
|
||||
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
|
||||
|
||||
implementation 'org.greenrobot:eventbus:3.3.1'
|
||||
|
||||
//Barcode generator
|
||||
// implementation group: 'com.google.zxing', name: 'core', version: '3.5.3'
|
||||
implementation 'com.journeyapps:zxing-android-embedded:4.3.0'
|
||||
}
|
||||
|
||||
@@ -201,3 +195,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
|
||||
}
|
||||
|
||||
17
app/proguard-rules.pro
vendored
17
app/proguard-rules.pro
vendored
@@ -23,3 +23,20 @@
|
||||
# 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>;
|
||||
}
|
||||
# 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 { *; }
|
||||
@@ -132,6 +132,8 @@ import it.integry.integrywmsnative.view.dialogs.basket_lu.DialogBasketLUComponen
|
||||
import it.integry.integrywmsnative.view.dialogs.basket_lu.DialogBasketLUModule;
|
||||
import it.integry.integrywmsnative.view.dialogs.bind_product_barcode_with_package.DialogBindProductBarcodeWithPackageComponent;
|
||||
import it.integry.integrywmsnative.view.dialogs.bind_product_barcode_with_package.DialogBindProductBarcodeWithPackageModule;
|
||||
import it.integry.integrywmsnative.view.dialogs.choose_art_from_lista_arts.DialogChooseArtFromListaArtsComponent;
|
||||
import it.integry.integrywmsnative.view.dialogs.choose_art_from_lista_arts.DialogChooseArtFromListaArtsModule;
|
||||
import it.integry.integrywmsnative.view.dialogs.choose_arts_from_lista_arts.DialogChooseArtsFromMtbAartListComponent;
|
||||
import it.integry.integrywmsnative.view.dialogs.choose_arts_from_lista_arts.DialogChooseArtsFromMtbAartListModule;
|
||||
import it.integry.integrywmsnative.view.dialogs.choose_arts_from_mtbcolr_list.DialogChooseArtsFromMtbColrListComponent;
|
||||
@@ -248,7 +250,8 @@ import it.integry.integrywmsnative.view.dialogs.update_available.DialogUpdateAva
|
||||
DialogAskLivelloPosizioneModule.class,
|
||||
VerificaGiacenzeModule.class,
|
||||
DialogExtraInfoModule.class,
|
||||
DialogAskDepositoModule.class
|
||||
DialogAskDepositoModule.class,
|
||||
DialogChooseArtFromListaArtsModule.class
|
||||
})
|
||||
public interface MainApplicationComponent {
|
||||
|
||||
@@ -417,6 +420,8 @@ public interface MainApplicationComponent {
|
||||
|
||||
DialogAskDepositoComponent.Factory dialogAskDepositoComponent();
|
||||
|
||||
DialogChooseArtFromListaArtsComponent.Factory dialogChooseArtFromListaArtsComponent();
|
||||
|
||||
void inject(MainApplication mainApplication);
|
||||
|
||||
void inject(AppContext mainApplication);
|
||||
|
||||
@@ -49,6 +49,7 @@ import it.integry.integrywmsnative.core.rest.consumers.ProductionLinesRESTConsum
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ProduzioneRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.VettoriRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.watcher.ServerStatusChecker;
|
||||
import it.integry.integrywmsnative.core.services.inventario.InventarioService;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.sound.SoundAlertService;
|
||||
@@ -100,8 +101,14 @@ public class MainApplicationModule {
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
MainContext providesMainContextNew(MenuService menuService, AppDatabase appDatabase, SystemRESTConsumer systemRESTConsumer, AuthenticationRESTConsumer authenticationRESTConsumer) {
|
||||
return new MainContext(mApplication.getApplicationContext(), menuService, appDatabase, systemRESTConsumer, authenticationRESTConsumer);
|
||||
ServerStatusChecker providesServerStatusChecker(Handler handler) {
|
||||
return new ServerStatusChecker(handler);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
MainContext providesMainContextNew(MenuService menuService, AppDatabase appDatabase, AuthenticationRESTConsumer authenticationRESTConsumer, ExecutorService executorService, Handler handler, ServerStatusChecker serverStatusChecker) {
|
||||
return new MainContext(mApplication.getApplicationContext(), menuService, appDatabase, authenticationRESTConsumer, executorService, handler, serverStatusChecker);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@@ -151,8 +158,8 @@ public class MainApplicationModule {
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
OrdiniRESTConsumer provideOrdiniRESTConsumer(RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer, EntityRESTConsumer entityRESTConsumer) {
|
||||
return new OrdiniRESTConsumer(restBuilder, systemRESTConsumer, entityRESTConsumer);
|
||||
OrdiniRESTConsumer provideOrdiniRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService, SystemRESTConsumer systemRESTConsumer, EntityRESTConsumer entityRESTConsumer) {
|
||||
return new OrdiniRESTConsumer(restBuilder, executorService, systemRESTConsumer, entityRESTConsumer);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@@ -169,14 +176,14 @@ public class MainApplicationModule {
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
CommessaRESTConsumer provideCommessaRESTConsumer(SystemRESTConsumer systemRESTConsumer) {
|
||||
return new CommessaRESTConsumer(systemRESTConsumer);
|
||||
CommessaRESTConsumer provideCommessaRESTConsumer(ExecutorService executorService, SystemRESTConsumer systemRESTConsumer) {
|
||||
return new CommessaRESTConsumer(executorService, systemRESTConsumer);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
DepositoRESTConsumer provideDepositoRESTConsumer(EntityRESTConsumer entityRESTConsumer, SystemRESTConsumer systemRESTConsumer) {
|
||||
return new DepositoRESTConsumer(entityRESTConsumer, systemRESTConsumer);
|
||||
DepositoRESTConsumer provideDepositoRESTConsumer(ExecutorService executorService, SystemRESTConsumer systemRESTConsumer) {
|
||||
return new DepositoRESTConsumer(executorService, systemRESTConsumer);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@@ -199,18 +206,19 @@ public class MainApplicationModule {
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
EntityRESTConsumer provideEntityRESTConsumer(RESTBuilder restBuilder) {
|
||||
return new EntityRESTConsumer(restBuilder);
|
||||
EntityRESTConsumer provideEntityRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService) {
|
||||
return new EntityRESTConsumer(restBuilder, executorService);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
ColliMagazzinoRESTConsumer provideColliMagazzinoRESTConsumer(RESTBuilder restBuilder,
|
||||
ColliMagazzinoRESTConsumer provideColliMagazzinoRESTConsumer(ExecutorService executorService,
|
||||
RESTBuilder restBuilder,
|
||||
SystemRESTConsumer systemRESTConsumer,
|
||||
ArticoloRESTConsumer articoloRESTConsumer,
|
||||
EntityRESTConsumer entityRESTConsumer,
|
||||
SettingsManager settingsManager) {
|
||||
return new ColliMagazzinoRESTConsumer(restBuilder, systemRESTConsumer, articoloRESTConsumer, entityRESTConsumer, settingsManager);
|
||||
return new ColliMagazzinoRESTConsumer(executorService, restBuilder, systemRESTConsumer, articoloRESTConsumer, entityRESTConsumer, settingsManager);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@@ -251,8 +259,8 @@ public class MainApplicationModule {
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
PosizioniRESTConsumer providesPosizioniRESTConsumer(RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer) {
|
||||
return new PosizioniRESTConsumer(restBuilder, systemRESTConsumer);
|
||||
PosizioniRESTConsumer providesPosizioniRESTConsumer(RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer, ExecutorService executorService) {
|
||||
return new PosizioniRESTConsumer(restBuilder, systemRESTConsumer, executorService);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@@ -305,8 +313,8 @@ 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
|
||||
@@ -317,20 +325,20 @@ public class MainApplicationModule {
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
ColliSpedizioneRESTConsumer provideColliSpedizioneRESTConsumer(RESTBuilder restBuilder) {
|
||||
return new ColliSpedizioneRESTConsumer(restBuilder);
|
||||
ColliSpedizioneRESTConsumer provideColliSpedizioneRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService) {
|
||||
return new ColliSpedizioneRESTConsumer(restBuilder, executorService);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
ColliLavorazioneRESTConsumer provideColliLavorazioneRESTConsumer(RESTBuilder restBuilder, SettingsManager settingsManager) {
|
||||
return new ColliLavorazioneRESTConsumer(restBuilder, settingsManager);
|
||||
ColliLavorazioneRESTConsumer provideColliLavorazioneRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService, SettingsManager settingsManager) {
|
||||
return new ColliLavorazioneRESTConsumer(restBuilder, executorService, settingsManager);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
MagazzinoAutomaticoRESTConsumer provideMagazzinoAutomaticoRESTConsumer(RESTBuilder restBuilder) {
|
||||
return new MagazzinoAutomaticoRESTConsumer(restBuilder);
|
||||
MagazzinoAutomaticoRESTConsumer provideMagazzinoAutomaticoRESTConsumer(ExecutorService executorService, RESTBuilder restBuilder) {
|
||||
return new MagazzinoAutomaticoRESTConsumer(executorService, restBuilder);
|
||||
}
|
||||
|
||||
@Provides
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.content.Intent;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.text.SpannableString;
|
||||
import android.text.Spanned;
|
||||
import android.view.LayoutInflater;
|
||||
@@ -37,6 +38,9 @@ public class SplashActivity extends BaseActivity implements MainContext.Listener
|
||||
@Inject
|
||||
MainContext mainContext;
|
||||
|
||||
@Inject
|
||||
Handler handler;
|
||||
|
||||
private RunnableArgsss<Integer, String[], List<Integer>> onRequestPermissionResult;
|
||||
|
||||
public static void startActivity(Context context) {
|
||||
@@ -103,12 +107,12 @@ public class SplashActivity extends BaseActivity implements MainContext.Listener
|
||||
|
||||
@Override
|
||||
public void onDBDataLoading(String item) {
|
||||
runOnUiThread(() -> mBinding.loadingInfoTextview.setText("Caricamento " + item));
|
||||
handler.post(() -> mBinding.loadingInfoTextview.setText("Caricamento " + item));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMenuLoading() {
|
||||
runOnUiThread(() -> mBinding.loadingInfoTextview.setText("Caricamento menù"));
|
||||
handler.post(() -> mBinding.loadingInfoTextview.setText("Caricamento menù"));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -151,11 +155,13 @@ public class SplashActivity extends BaseActivity implements MainContext.Listener
|
||||
|
||||
@Override
|
||||
public void onError(Spanned message) {
|
||||
handler.post(() -> {
|
||||
DialogSimpleMessageView.makeErrorDialog(
|
||||
message, null, this::finish, R.string.logout, () -> {
|
||||
this.mainContext.logout(MainApplication::exit);
|
||||
})
|
||||
.show(this.getSupportFragmentManager(), "tag");
|
||||
|
||||
DialogSimpleMessageView.makeErrorDialog(
|
||||
message, null, this::finish, R.string.logout, () -> {
|
||||
this.mainContext.logout(MainApplication::exit);
|
||||
})
|
||||
.show(this.getSupportFragmentManager(), "tag");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ public class BarcodeCallbackDTO {
|
||||
|
||||
private int ID = -1;
|
||||
|
||||
private boolean enabled = true;
|
||||
private RunnableArgs<BarcodeScanDTO> onScanSuccessfull;
|
||||
private RunnableArgs<Exception> onScanFailed;
|
||||
|
||||
@@ -19,6 +20,15 @@ public class BarcodeCallbackDTO {
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
public BarcodeCallbackDTO setEnabled(boolean enabled) {
|
||||
this.enabled = enabled;
|
||||
return this;
|
||||
}
|
||||
|
||||
public RunnableArgs<BarcodeScanDTO> getOnScanSuccessfull() {
|
||||
return onScanSuccessfull;
|
||||
}
|
||||
|
||||
@@ -24,10 +24,15 @@ public class BarcodeManager {
|
||||
private static BarcodeReaderInterface mCurrentBarcodeInterface;
|
||||
private static final List<BarcodeCallbackDTO> mBarcodeCallbacksStacktrace = new ArrayList<>();
|
||||
|
||||
private static boolean mEnabled = true;
|
||||
// private static boolean mEnabled = true;
|
||||
|
||||
|
||||
private static final Class<? extends BarcodeReaderInterface>[] registeredBarcodeReaderInterfaces = new Class[]{PointMobileBarcodeReader.class, ZebraBarcodeReader.class, HoneyWellBarcodeReader.class, KeyboardEmulatorBarcodeReader.class};
|
||||
private static final Class<? extends BarcodeReaderInterface>[] registeredBarcodeReaderInterfaces = new Class[]{
|
||||
PointMobileBarcodeReader.class,
|
||||
ZebraBarcodeReader.class,
|
||||
HoneyWellBarcodeReader.class,
|
||||
KeyboardEmulatorBarcodeReader.class
|
||||
};
|
||||
|
||||
|
||||
public static void init(Context applicationContext) throws Exception {
|
||||
@@ -56,12 +61,12 @@ public class BarcodeManager {
|
||||
|
||||
mCurrentBarcodeInterface.register(data -> {
|
||||
BarcodeCallbackDTO callback = getValidCallback();
|
||||
if (callback != null && mEnabled) {
|
||||
if (callback != null && callback.isEnabled()) {
|
||||
callback.getOnScanSuccessfull().run(data);
|
||||
}
|
||||
}, ex -> {
|
||||
BarcodeCallbackDTO callback = getValidCallback();
|
||||
if (callback != null && mEnabled) {
|
||||
if (callback != null && callback.isEnabled()) {
|
||||
callback.getOnScanFailed().run(ex);
|
||||
}
|
||||
});
|
||||
@@ -103,7 +108,6 @@ public class BarcodeManager {
|
||||
}
|
||||
|
||||
public static int addCallback(BarcodeCallbackDTO barcodeCallbackDTO) {
|
||||
|
||||
int newID = -1;
|
||||
|
||||
if (!mBarcodeCallbacksStacktrace.isEmpty()) {
|
||||
@@ -133,18 +137,39 @@ public class BarcodeManager {
|
||||
}
|
||||
|
||||
|
||||
public static void disable() {
|
||||
mEnabled = false;
|
||||
// UtilityLogger.info("Barcode reader disabled");
|
||||
public static void disable(int instanceId) {
|
||||
mBarcodeCallbacksStacktrace.stream().filter(x -> x.getID() == instanceId)
|
||||
.findFirst().ifPresent(x -> x.setEnabled(false));
|
||||
}
|
||||
|
||||
public static void enable() {
|
||||
mEnabled = true;
|
||||
// UtilityLogger.info("Barcode reader enabled");
|
||||
public static void disableLastCallback() {
|
||||
BarcodeCallbackDTO validCallback = getValidCallback();
|
||||
if (validCallback != null) {
|
||||
validCallback.setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isEnabled() {
|
||||
return mEnabled;
|
||||
public static void enable(int instanceId) {
|
||||
mBarcodeCallbacksStacktrace.stream().filter(x -> x.getID() == instanceId)
|
||||
.findFirst().ifPresent(x -> x.setEnabled(true));
|
||||
}
|
||||
|
||||
public static void enableLastCallback() {
|
||||
BarcodeCallbackDTO validCallback = getValidCallback();
|
||||
if (validCallback != null) {
|
||||
validCallback.setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isEnabled(int instanceId) {
|
||||
return mBarcodeCallbacksStacktrace.stream().filter(x -> x.getID() == instanceId)
|
||||
.findFirst()
|
||||
.map(BarcodeCallbackDTO::isEnabled)
|
||||
.orElse(false);
|
||||
}
|
||||
|
||||
public static boolean isLastCallbackEnabled() {
|
||||
return getValidCallback() != null && getValidCallback().isEnabled();
|
||||
}
|
||||
|
||||
public static void changeSettings(List<Pair<String, Object>> settings) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package it.integry.integrywmsnative.core.context;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.text.Html;
|
||||
import android.text.SpannableString;
|
||||
import android.text.Spanned;
|
||||
@@ -9,16 +10,15 @@ import android.text.SpannedString;
|
||||
import com.google.firebase.installations.FirebaseInstallations;
|
||||
|
||||
import java.net.ConnectException;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
||||
import it.integry.integrywmsnative.core.data_store.db.AppDatabase;
|
||||
import it.integry.integrywmsnative.core.menu.MenuService;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.watcher.ServerStatusChecker;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityThread;
|
||||
import it.integry.integrywmsnative.gest.login.rest.AuthenticationRESTConsumer;
|
||||
|
||||
@Singleton
|
||||
@@ -27,17 +27,21 @@ public class MainContext {
|
||||
private final Context applicationContext;
|
||||
private final MenuService menuService;
|
||||
private final AppDatabase appDatabase;
|
||||
private final SystemRESTConsumer systemRESTConsumer;
|
||||
private final AuthenticationRESTConsumer authenticationRESTConsumer;
|
||||
private final ExecutorService executorService;
|
||||
private final Handler handler;
|
||||
private final ServerStatusChecker serverStatusChecker;
|
||||
|
||||
private Listener mListener;
|
||||
|
||||
public MainContext(Context applicationContext, MenuService menuService, AppDatabase appDatabase, SystemRESTConsumer systemRESTConsumer, AuthenticationRESTConsumer authenticationRESTConsumer) {
|
||||
public MainContext(Context applicationContext, MenuService menuService, AppDatabase appDatabase, AuthenticationRESTConsumer authenticationRESTConsumer, ExecutorService executorService, Handler handler, ServerStatusChecker serverStatusChecker) {
|
||||
this.applicationContext = applicationContext;
|
||||
this.menuService = menuService;
|
||||
this.appDatabase = appDatabase;
|
||||
this.systemRESTConsumer = systemRESTConsumer;
|
||||
this.authenticationRESTConsumer = authenticationRESTConsumer;
|
||||
this.executorService = executorService;
|
||||
this.handler = handler;
|
||||
this.serverStatusChecker = serverStatusChecker;
|
||||
}
|
||||
|
||||
public void init() {
|
||||
@@ -48,34 +52,31 @@ public class MainContext {
|
||||
}
|
||||
|
||||
|
||||
//this.initAuthSession(() -> {
|
||||
// this.initDeviceId(() -> {
|
||||
this.initDBData(() -> {
|
||||
this.initMenu(() -> {
|
||||
executorService.execute(() -> {
|
||||
|
||||
if (mListener != null) mListener.onContextInitialized();
|
||||
});
|
||||
});
|
||||
// });
|
||||
//});
|
||||
try {
|
||||
this.initDBData();
|
||||
this.initMenu();
|
||||
serverStatusChecker.init();
|
||||
|
||||
if (mListener != null) mListener.onContextInitialized();
|
||||
|
||||
this.initServerStatusChecker();
|
||||
} catch (Exception ex) {
|
||||
Spanned message = null;
|
||||
|
||||
// EventBus.getDefault().register(this);
|
||||
if (ex.getCause() != null && ex.getCause() instanceof ConnectException) {
|
||||
message = Html.fromHtml("Impossibile collegarsi all'host <b>" + SettingsManager.i().getServer().getHost() + ":" + SettingsManager.i().getServer().getPort() + "</b>. Riprovare più tardi.");
|
||||
} else if (ex.getMessage().startsWith("Status 404:")) {
|
||||
message = Html.fromHtml("Errore 404. Non è stato possibile soddisfare la richiesta sull'host <b>" + SettingsManager.i().getServer().getHost() + ":" + SettingsManager.i().getServer().getPort() + "</b>. Riprovare più tardi.");
|
||||
} else {
|
||||
message = new SpannableString(ex.getMessage());
|
||||
}
|
||||
|
||||
if (mListener != null) mListener.onError(message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// @Subscribe(threadMode = ThreadMode.MAIN)
|
||||
// public void onSessionExpired(SessionExpiredEvent event) {
|
||||
// DialogSimpleMessageView.makeErrorDialog(
|
||||
// new SpannedString("La sessione è scaduta. Effettua nuovamente la login"),
|
||||
// null,
|
||||
// () -> {
|
||||
// logout(MainApplication::exit);
|
||||
// })
|
||||
// .show(activity.getSupportFragmentManager(), "expired-session-error");
|
||||
// }
|
||||
|
||||
|
||||
private void initAuthSession(Runnable onComplete) {
|
||||
this.authenticationRESTConsumer.me(obj -> {
|
||||
@@ -105,50 +106,28 @@ public class MainContext {
|
||||
|
||||
public void logout(Runnable onLoggedOut) {
|
||||
menuService.invalidateCache();
|
||||
UtilityThread.executeParallel(() -> {
|
||||
executorService.execute(() -> {
|
||||
SettingsManager.i().setUser(null);
|
||||
SettingsManager.i().setUserSession(null);
|
||||
SettingsManager.update();
|
||||
appDatabase.clearAllTables();
|
||||
|
||||
onLoggedOut.run();
|
||||
}, true);
|
||||
handler.post(() -> {
|
||||
onLoggedOut.run();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private void initServerStatusChecker() {
|
||||
ServerStatusChecker.init();
|
||||
}
|
||||
|
||||
private void initDBData(Runnable onComplete) {
|
||||
|
||||
private void initDBData() throws Exception {
|
||||
|
||||
SettingsManager.loadDBVariables(item -> {
|
||||
if (mListener != null) mListener.onDBDataLoading(item);
|
||||
},
|
||||
onComplete,
|
||||
ex -> {
|
||||
|
||||
Spanned message = null;
|
||||
|
||||
if (ex.getCause() != null && ex.getCause() instanceof ConnectException) {
|
||||
message = Html.fromHtml("Impossibile collegarsi all'host <b>" + SettingsManager.i().getServer().getHost() + ":" + SettingsManager.i().getServer().getPort() + "</b>. Riprovare più tardi.");
|
||||
} else if (ex.getMessage().startsWith("Status 404:")) {
|
||||
message = Html.fromHtml("Errore 404. Non è stato possibile soddisfare la richiesta sull'host <b>" + SettingsManager.i().getServer().getHost() + ":" + SettingsManager.i().getServer().getPort() + "</b>. Riprovare più tardi.");
|
||||
} else {
|
||||
message = new SpannableString(ex.getMessage());
|
||||
}
|
||||
|
||||
if (mListener != null) mListener.onError(message);
|
||||
|
||||
}
|
||||
);
|
||||
if (mListener != null) mListener.onDBDataLoading(item);
|
||||
});
|
||||
}
|
||||
|
||||
private void initMenu(Runnable onComplete) {
|
||||
private void initMenu() throws Exception {
|
||||
if (mListener != null) mListener.onMenuLoading();
|
||||
this.menuService.init(onComplete, ex -> {
|
||||
if (mListener != null) mListener.onError(new SpannedString(ex.getMessage()));
|
||||
});
|
||||
this.menuService.init();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -24,6 +24,10 @@ import androidx.databinding.BindingAdapter;
|
||||
import androidx.databinding.BindingConversion;
|
||||
import androidx.databinding.Observable;
|
||||
import androidx.databinding.ObservableField;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.Observer;
|
||||
import androidx.lifecycle.ViewTreeLifecycleOwner;
|
||||
|
||||
import com.google.android.material.datepicker.MaterialDatePicker;
|
||||
import com.google.android.material.textfield.TextInputEditText;
|
||||
@@ -820,11 +824,11 @@ public class Converters {
|
||||
|
||||
|
||||
@BindingAdapter("visibilityWhenNotNull")
|
||||
public static void bindViewVisibilityWhenNotNull(View view, ObservableField<?> bindableObject) {
|
||||
public static void bindViewVisibilityObservableFieldWhenNotNull(View view, ObservableField<?> bindableObject) {
|
||||
if(bindableObject == null) return;
|
||||
|
||||
if (view.getTag(R.id.bound_observable) != bindableObject) {
|
||||
view.setTag(R.id.bound_observable, bindableObject);
|
||||
if (view.getTag(R.id.bound_observable_visibility) != bindableObject) {
|
||||
view.setTag(R.id.bound_observable_visibility, bindableObject);
|
||||
}
|
||||
|
||||
bindableObject.addOnPropertyChangedCallback(new Observable.OnPropertyChangedCallback() {
|
||||
@@ -838,6 +842,36 @@ public class Converters {
|
||||
}
|
||||
|
||||
|
||||
@BindingAdapter("visibilityWhenNotNull")
|
||||
public static void bindViewVisibilityLiveDataWhenNotNull(View view, LiveData<?> liveData) {
|
||||
// Se il LiveData è null, nascondi la view e esci
|
||||
if (liveData == null) {
|
||||
view.setVisibility(View.GONE);
|
||||
return;
|
||||
}
|
||||
|
||||
// Ottieni il LifecycleOwner dalla view
|
||||
LifecycleOwner lifecycleOwner = ViewTreeLifecycleOwner.get(view);
|
||||
if (lifecycleOwner == null) return;
|
||||
|
||||
// Rimuovi eventuali observer precedenti
|
||||
Observer<Object> oldObserver = (Observer<Object>) view.getTag(R.id.bound_observable_visibility);
|
||||
if (oldObserver != null) {
|
||||
liveData.removeObserver(oldObserver);
|
||||
}
|
||||
|
||||
// Crea e registra il nuovo observer
|
||||
Observer<Object> newObserver = value ->
|
||||
view.setVisibility(value == null ? View.GONE : View.VISIBLE);
|
||||
|
||||
liveData.observe(lifecycleOwner, newObserver);
|
||||
view.setTag(R.id.bound_observable_visibility, newObserver);
|
||||
|
||||
// Imposta lo stato iniziale
|
||||
view.setVisibility(liveData.getValue() == null ? View.GONE : View.VISIBLE);
|
||||
}
|
||||
|
||||
|
||||
@BindingAdapter("visibilityWhenNotNull")
|
||||
public static void bindViewVisibilityWhenNotNull(View view, Object genericObject) {
|
||||
view.setVisibility(genericObject == null ? View.GONE : View.VISIBLE);
|
||||
@@ -845,7 +879,7 @@ public class Converters {
|
||||
|
||||
|
||||
@BindingAdapter("visibilityWhenNull")
|
||||
public static void bindViewVisibilityWhenNull(View view, ObservableField<?> bindableObject) {
|
||||
public static void bindViewVisibilityObservableFieldWhenNull(View view, ObservableField<?> bindableObject) {
|
||||
|
||||
if (view.getTag(R.id.bound_observable_visibility) != bindableObject) {
|
||||
view.setTag(R.id.bound_observable_visibility, bindableObject);
|
||||
@@ -864,6 +898,36 @@ public class Converters {
|
||||
}
|
||||
|
||||
|
||||
@BindingAdapter("visibilityWhenNull")
|
||||
public static void bindViewVisibilityLiveDataWhenNull(View view, LiveData<?> liveData) {
|
||||
// Se il LiveData è null, nascondi la view e esci
|
||||
if (liveData == null) {
|
||||
view.setVisibility(View.VISIBLE);
|
||||
return;
|
||||
}
|
||||
|
||||
// Ottieni il LifecycleOwner dalla view
|
||||
LifecycleOwner lifecycleOwner = ViewTreeLifecycleOwner.get(view);
|
||||
if (lifecycleOwner == null) return;
|
||||
|
||||
// Rimuovi eventuali observer precedenti
|
||||
Observer<Object> oldObserver = (Observer<Object>) view.getTag(R.id.bound_observable_visibility);
|
||||
if (oldObserver != null) {
|
||||
liveData.removeObserver(oldObserver);
|
||||
}
|
||||
|
||||
// Crea e registra il nuovo observer
|
||||
Observer<Object> newObserver = value ->
|
||||
view.setVisibility(value == null ? View.VISIBLE : View.GONE);
|
||||
|
||||
liveData.observe(lifecycleOwner, newObserver);
|
||||
view.setTag(R.id.bound_observable_visibility, newObserver);
|
||||
|
||||
// Imposta lo stato iniziale
|
||||
view.setVisibility(liveData.getValue() == null ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
|
||||
@BindingAdapter({"reverse_visibility"})
|
||||
public static void bindViewReverseVisibility(View view, final BindableBoolean bindableBoolean) {
|
||||
if (view.getTag(R.id.bound_reverse_visibility) != bindableBoolean) {
|
||||
|
||||
@@ -3,6 +3,6 @@ package it.integry.integrywmsnative.core.exception;
|
||||
public class InvalidCodMdepBarcodeException extends RuntimeException {
|
||||
|
||||
public InvalidCodMdepBarcodeException(String message) {
|
||||
super(message);
|
||||
super("Il deposito scansionato non è valido: " + message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,13 +3,13 @@ package it.integry.integrywmsnative.core.exception;
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityResources;
|
||||
|
||||
public final class InvalidCodMdepLUException extends Exception {
|
||||
public final class InvalidCodMdepException extends Exception {
|
||||
|
||||
public InvalidCodMdepLUException() {
|
||||
public InvalidCodMdepException() {
|
||||
super(UtilityResources.getString(R.string.invalid_codmdep_error_message));
|
||||
}
|
||||
|
||||
public InvalidCodMdepLUException(String codMdep) {
|
||||
public InvalidCodMdepException(String codMdep) {
|
||||
super(UtilityResources.getString(R.string.invalid_codmdep_error_message) + "(" + codMdep + ")");
|
||||
}
|
||||
|
||||
@@ -34,7 +34,6 @@ public class BaseActivity extends AppCompatActivity {
|
||||
}
|
||||
|
||||
public void onLoadingStarted() {
|
||||
BarcodeManager.disable();
|
||||
this.openProgress();
|
||||
}
|
||||
|
||||
@@ -52,14 +51,14 @@ public class BaseActivity extends AppCompatActivity {
|
||||
|
||||
|
||||
private void openProgress() {
|
||||
BarcodeManager.disable();
|
||||
BarcodeManager.disableLastCallback();
|
||||
// executorService.execute(() -> {
|
||||
this.mCurrentProgress.show(getSupportFragmentManager());
|
||||
// });
|
||||
}
|
||||
|
||||
private void closeProgress() {
|
||||
BarcodeManager.enable();
|
||||
BarcodeManager.enableLastCallback();
|
||||
// executorService.execute(() -> {
|
||||
mCurrentProgress.dismiss();
|
||||
// });
|
||||
@@ -67,7 +66,7 @@ public class BaseActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
public boolean dispatchKeyEvent(KeyEvent event) {
|
||||
if (BarcodeManager.isEnabled() && BarcodeManager.isKeyboardEmulator()) {
|
||||
if (BarcodeManager.isLastCallbackEnabled() && BarcodeManager.isKeyboardEmulator()) {
|
||||
if (event.getAction() == KeyEvent.ACTION_DOWN || event.getAction() == KeyEvent.ACTION_MULTIPLE && !isControlKey(event)) {
|
||||
return BarcodeManager.onKeyDown(event.getKeyCode(), event);
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ public class BaseDialog extends Dialog {
|
||||
|
||||
public BaseDialog(@NonNull Context context) {
|
||||
super(context);
|
||||
if (BarcodeManager.isEnabled() && BarcodeManager.isKeyboardEmulator()) {
|
||||
if (BarcodeManager.isLastCallbackEnabled() && BarcodeManager.isKeyboardEmulator()) {
|
||||
setOnKeyListener((dialog, keyCode, event) -> {
|
||||
if (mBarcodeListener && (event.getAction() == KeyEvent.ACTION_DOWN || event.getAction() == KeyEvent.ACTION_MULTIPLE) && !isControlKey(event)) {
|
||||
return BarcodeManager.onKeyDown(event.getKeyCode(), event);
|
||||
|
||||
@@ -65,25 +65,23 @@ public abstract class BaseDialogFragment extends DialogFragment implements Dialo
|
||||
}
|
||||
|
||||
public void onLoadingStarted() {
|
||||
BarcodeManager.disable();
|
||||
this.openProgress();
|
||||
}
|
||||
|
||||
public void onLoadingEnded() {
|
||||
this.closeProgress();
|
||||
BarcodeManager.enable();
|
||||
}
|
||||
|
||||
|
||||
private void openProgress() {
|
||||
BarcodeManager.disable();
|
||||
BarcodeManager.disableLastCallback();
|
||||
// executorService.execute(() -> {
|
||||
this.mCurrentProgress.show(requireActivity().getSupportFragmentManager());
|
||||
// });
|
||||
}
|
||||
|
||||
private void closeProgress() {
|
||||
BarcodeManager.enable();
|
||||
BarcodeManager.enableLastCallback();
|
||||
// executorService.execute(() -> {
|
||||
mCurrentProgress.dismiss();
|
||||
// });
|
||||
@@ -91,9 +89,8 @@ public abstract class BaseDialogFragment extends DialogFragment implements Dialo
|
||||
|
||||
|
||||
public void onError(Exception ex) {
|
||||
this.onLoadingEnded();
|
||||
|
||||
requireActivity().runOnUiThread(() -> {
|
||||
this.onLoadingEnded();
|
||||
UtilityExceptions.defaultException(requireActivity(), ex);
|
||||
});
|
||||
}
|
||||
@@ -130,7 +127,7 @@ public abstract class BaseDialogFragment extends DialogFragment implements Dialo
|
||||
.create()
|
||||
.inject(this);
|
||||
|
||||
if (BarcodeManager.isEnabled() && BarcodeManager.isKeyboardEmulator() && getDialog() != null) {
|
||||
if (BarcodeManager.isLastCallbackEnabled() && BarcodeManager.isKeyboardEmulator() && getDialog() != null) {
|
||||
getDialog().setOnKeyListener((dialog, keyCode, event) -> {
|
||||
if (mBarcodeListener && (event.getAction() == KeyEvent.ACTION_DOWN || event.getAction() == KeyEvent.ACTION_MULTIPLE) && !isControlKey(event)) {
|
||||
return BarcodeManager.onKeyDown(event.getKeyCode(), event);
|
||||
|
||||
@@ -69,14 +69,14 @@ public abstract class BaseFragment extends Fragment {
|
||||
}
|
||||
|
||||
private void openProgress() {
|
||||
BarcodeManager.disable();
|
||||
BarcodeManager.disableLastCallback();
|
||||
// executorService.execute(() -> {
|
||||
this.mCurrentProgress.show(requireActivity().getSupportFragmentManager());
|
||||
// });
|
||||
}
|
||||
|
||||
private void closeProgress() {
|
||||
BarcodeManager.enable();
|
||||
BarcodeManager.enableLastCallback();
|
||||
// executorService.execute(() -> {
|
||||
mCurrentProgress.dismiss();
|
||||
// });
|
||||
@@ -86,7 +86,6 @@ public abstract class BaseFragment extends Fragment {
|
||||
handler.post(() -> {
|
||||
this.closeProgress();
|
||||
UtilityExceptions.defaultException(getActivity(), ex);
|
||||
BarcodeManager.enable();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package it.integry.integrywmsnative.core.expansion.view;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
import androidx.databinding.ObservableArrayList;
|
||||
import androidx.databinding.ObservableList;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import it.integry.integrywmsnative.core.expansion.OnListGeneralChangedCallback;
|
||||
|
||||
public abstract class ExtendedSectionedRecyclerViewNew<T, SH extends RecyclerView.ViewHolder, VH extends RecyclerView.ViewHolder>
|
||||
extends SectionedRecyclerViewAdapter<SH, VH> {
|
||||
|
||||
private View mEmptyView;
|
||||
|
||||
public ExtendedSectionedRecyclerViewNew(ObservableArrayList<T> myDataset) {
|
||||
super();
|
||||
|
||||
myDataset.addOnListChangedCallback(new OnListGeneralChangedCallback<T>() {
|
||||
@Override
|
||||
public void onChanged(ObservableList<T> sender) {
|
||||
checkIfEmpty();
|
||||
}
|
||||
});
|
||||
|
||||
checkIfEmpty();
|
||||
}
|
||||
|
||||
public ExtendedSectionedRecyclerViewNew<T, SH, VH> setEmptyView(View emptyView) {
|
||||
this.mEmptyView = emptyView;
|
||||
this.checkIfEmpty();
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void checkIfEmpty() {
|
||||
if (mEmptyView != null) {
|
||||
final boolean emptyViewVisible = getItemCount() == 0;
|
||||
mEmptyView.setVisibility(emptyViewVisible ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,218 @@
|
||||
package it.integry.integrywmsnative.core.expansion.view;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.util.Log;
|
||||
import android.util.SparseArray;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.HashSet;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class RecyclerViewProfiler {
|
||||
private static final String TAG = "RVProfiler";
|
||||
private final SparseArray<Long> bindingTimes;
|
||||
private final SparseArray<Long> creationTimes;
|
||||
private final Handler mainHandler;
|
||||
private WeakReference<RecyclerView> recyclerViewRef;
|
||||
private boolean isProfilingEnabled = true;
|
||||
|
||||
// Metriche di performance
|
||||
private long totalBindingTime = 0;
|
||||
private long totalCreationTime = 0;
|
||||
private int bindCount = 0;
|
||||
private int createCount = 0;
|
||||
private long firstBindTime = 0;
|
||||
private final ArrayDeque<Long> recentBindTimes;
|
||||
private static final int MAX_RECENT_TIMES = 50;
|
||||
|
||||
public RecyclerViewProfiler(RecyclerView recyclerView) {
|
||||
this.recyclerViewRef = new WeakReference<>(recyclerView);
|
||||
this.bindingTimes = new SparseArray<>();
|
||||
this.creationTimes = new SparseArray<>();
|
||||
this.mainHandler = new Handler(Looper.getMainLooper());
|
||||
this.recentBindTimes = new ArrayDeque<>();
|
||||
|
||||
setupRecyclerViewCallbacks();
|
||||
}
|
||||
|
||||
private void setupRecyclerViewCallbacks() {
|
||||
RecyclerView recyclerView = recyclerViewRef.get();
|
||||
if (recyclerView == null) return;
|
||||
|
||||
recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||
@Override
|
||||
public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
|
||||
if (newState == RecyclerView.SCROLL_STATE_IDLE) {
|
||||
logPerformanceMetrics();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Monitora il pre-layout
|
||||
recyclerView.addOnLayoutChangeListener((v, left, top, right, bottom,
|
||||
oldLeft, oldTop, oldRight, oldBottom) -> {
|
||||
if (firstBindTime == 0) {
|
||||
mainHandler.postDelayed(this::checkInitialPerformance, 500);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void onPreBind(int position) {
|
||||
if (!isProfilingEnabled) return;
|
||||
bindingTimes.put(position, System.nanoTime());
|
||||
}
|
||||
|
||||
public void onPostBind(int position) {
|
||||
if (!isProfilingEnabled) return;
|
||||
|
||||
Long startTime = bindingTimes.get(position);
|
||||
if (startTime != null) {
|
||||
long bindTime = System.nanoTime() - startTime;
|
||||
bindingTimes.remove(position);
|
||||
|
||||
if (firstBindTime == 0) {
|
||||
firstBindTime = bindTime;
|
||||
}
|
||||
|
||||
totalBindingTime += bindTime;
|
||||
bindCount++;
|
||||
|
||||
recentBindTimes.addLast(bindTime);
|
||||
if (recentBindTimes.size() > MAX_RECENT_TIMES) {
|
||||
recentBindTimes.removeFirst();
|
||||
}
|
||||
|
||||
// Segnala binding lenti
|
||||
if (bindTime > TimeUnit.MILLISECONDS.toNanos(16)) { // 1 frame
|
||||
Log.w(TAG, String.format("Slow binding at position %d: %.2fms",
|
||||
position, bindTime / 1_000_000.0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onPreCreate(int viewType) {
|
||||
if (!isProfilingEnabled) return;
|
||||
creationTimes.put(viewType, System.nanoTime());
|
||||
}
|
||||
|
||||
public void onPostCreate(int viewType) {
|
||||
if (!isProfilingEnabled) return;
|
||||
|
||||
Long startTime = creationTimes.get(viewType);
|
||||
if (startTime != null) {
|
||||
long createTime = System.nanoTime() - startTime;
|
||||
creationTimes.remove(viewType);
|
||||
|
||||
totalCreationTime += createTime;
|
||||
createCount++;
|
||||
|
||||
// Segnala creazioni lente
|
||||
if (createTime > TimeUnit.MILLISECONDS.toNanos(8)) {
|
||||
Log.w(TAG, String.format("Slow view creation for type %d: %.2fms",
|
||||
viewType, createTime / 1_000_000.0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void checkInitialPerformance() {
|
||||
RecyclerView recyclerView = recyclerViewRef.get();
|
||||
if (recyclerView == null) return;
|
||||
|
||||
// Verifica inflazione layout
|
||||
long avgBindTime = bindCount > 0 ? totalBindingTime / bindCount : 0;
|
||||
if (avgBindTime > TimeUnit.MILLISECONDS.toNanos(8)) {
|
||||
Log.w(TAG, String.format("High average binding time: %.2fms. " +
|
||||
"Consider using AsyncLayoutInflater", avgBindTime / 1_000_000.0));
|
||||
}
|
||||
|
||||
// Verifica dimensione view pool
|
||||
RecyclerView.RecycledViewPool pool = recyclerView.getRecycledViewPool();
|
||||
if (pool != null) {
|
||||
int[] viewTypes = getViewTypes(recyclerView);
|
||||
for (int type : viewTypes) {
|
||||
if (pool.getRecycledViewCount(type) == 0) {
|
||||
Log.w(TAG, "ViewPool empty for type " + type +
|
||||
". Consider increasing pool size");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Verifica prefetch
|
||||
if (recyclerView.getLayoutManager() instanceof LinearLayoutManager) {
|
||||
LinearLayoutManager lm = (LinearLayoutManager) recyclerView.getLayoutManager();
|
||||
if (!lm.isItemPrefetchEnabled()) {
|
||||
Log.w(TAG, "Item prefetch is disabled. Enable it for better performance");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void logPerformanceMetrics() {
|
||||
if (!isProfilingEnabled || recentBindTimes.isEmpty()) return;
|
||||
|
||||
// Calcola la varianza dei tempi di binding recenti
|
||||
double mean = recentBindTimes.stream()
|
||||
.mapToLong(Long::longValue)
|
||||
.average()
|
||||
.orElse(0.0);
|
||||
|
||||
double variance = recentBindTimes.stream()
|
||||
.mapToDouble(time -> Math.pow(time - mean, 2))
|
||||
.average()
|
||||
.orElse(0.0);
|
||||
|
||||
Log.d(TAG, String.format("Performance metrics:\n" +
|
||||
"Avg binding time: %.2fms\n" +
|
||||
"Binding time variance: %.2f\n" +
|
||||
"View creation rate: %.1f%%",
|
||||
mean / 1_000_000.0,
|
||||
variance / 1_000_000.0,
|
||||
createCount * 100.0 / (bindCount + 1)));
|
||||
}
|
||||
|
||||
private int[] getViewTypes(RecyclerView recyclerView) {
|
||||
RecyclerView.Adapter<?> adapter = recyclerView.getAdapter();
|
||||
if (adapter == null) return new int[0];
|
||||
|
||||
Set<Integer> types = new HashSet<>();
|
||||
for (int i = 0; i < adapter.getItemCount(); i++) {
|
||||
types.add(adapter.getItemViewType(i));
|
||||
}
|
||||
return types.stream().mapToInt(Integer::intValue).toArray();
|
||||
}
|
||||
|
||||
public void enableProfiling(boolean enabled) {
|
||||
isProfilingEnabled = enabled;
|
||||
if (!enabled) {
|
||||
bindingTimes.clear();
|
||||
creationTimes.clear();
|
||||
recentBindTimes.clear();
|
||||
}
|
||||
}
|
||||
|
||||
public String getProfilingStats() {
|
||||
if (bindCount == 0) return "No data collected yet";
|
||||
|
||||
return String.format(Locale.US,
|
||||
"Profiling Statistics:\n" +
|
||||
"Total bindings: %d\n" +
|
||||
"Average binding time: %.2fms\n" +
|
||||
"Total view creations: %d\n" +
|
||||
"Average creation time: %.2fms\n" +
|
||||
"First binding time: %.2fms\n" +
|
||||
"Creation/Binding ratio: %.1f%%",
|
||||
bindCount,
|
||||
(totalBindingTime / bindCount) / 1_000_000.0,
|
||||
createCount,
|
||||
(totalCreationTime / createCount) / 1_000_000.0,
|
||||
firstBindTime / 1_000_000.0,
|
||||
createCount * 100.0 / bindCount);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,352 @@
|
||||
package it.integry.integrywmsnative.core.expansion.view;
|
||||
|
||||
import android.util.SparseArray;
|
||||
import android.util.SparseIntArray;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import it.integry.integrywmsnative.BuildConfig;
|
||||
|
||||
public abstract class SectionedRecyclerViewAdapter<H extends RecyclerView.ViewHolder,
|
||||
I extends RecyclerView.ViewHolder> extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||
|
||||
private RecyclerViewProfiler profiler;
|
||||
|
||||
private static final int TYPE_HEADER = 0;
|
||||
private static final int TYPE_ITEM = 1;
|
||||
|
||||
// Utilizziamo SparseArray invece di HashMap per migliori performance su Android
|
||||
private final SparseArray<Section> sectionsByPosition;
|
||||
private final ArrayList<Section> sections;
|
||||
|
||||
// Cache per le posizioni degli item per evitare ricalcoli frequenti
|
||||
private final SparseIntArray positionCache;
|
||||
private int lastCacheUpdateCount;
|
||||
|
||||
// Pool di View per riutilizzo
|
||||
private final RecyclerView.RecycledViewPool sharedPool;
|
||||
|
||||
// Dimensione massima della cache delle posizioni
|
||||
private static final int MAX_POSITION_CACHE_SIZE = 2000;
|
||||
|
||||
public SectionedRecyclerViewAdapter() {
|
||||
this.sections = new ArrayList<>();
|
||||
this.sectionsByPosition = new SparseArray<>();
|
||||
this.positionCache = new SparseIntArray(MAX_POSITION_CACHE_SIZE);
|
||||
this.sharedPool = new RecyclerView.RecycledViewPool();
|
||||
|
||||
// Aumentiamo il pool di ViewHolder per tipo
|
||||
sharedPool.setMaxRecycledViews(TYPE_HEADER, 500);
|
||||
sharedPool.setMaxRecycledViews(TYPE_ITEM, 2000);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttachedToRecyclerView(@NonNull RecyclerView recyclerView) {
|
||||
super.onAttachedToRecyclerView(recyclerView);
|
||||
profiler = new RecyclerViewProfiler(recyclerView);
|
||||
profiler.enableProfiling(BuildConfig.DEBUG);
|
||||
|
||||
recyclerView.setRecycledViewPool(sharedPool);
|
||||
|
||||
// Ottimizziamo il layout manager per le prestazioni
|
||||
if (recyclerView.getLayoutManager() instanceof LinearLayoutManager) {
|
||||
LinearLayoutManager layoutManager = (LinearLayoutManager) recyclerView.getLayoutManager();
|
||||
layoutManager.setItemPrefetchEnabled(true);
|
||||
// layoutManager.setInitialPrefetchItemCount(20);
|
||||
}
|
||||
|
||||
// recyclerView.postDelayed(() -> {
|
||||
// Precarica alcuni ViewHolder
|
||||
// for (int i = 0; i < 100; i++) {
|
||||
// sharedPool.putRecycledView(
|
||||
// createViewHolder(recyclerView, TYPE_HEADER));
|
||||
// }
|
||||
// for (int i = 0; i < 100; i++) {
|
||||
// sharedPool.putRecycledView(
|
||||
// createViewHolder(recyclerView, TYPE_ITEM));
|
||||
// }
|
||||
// }, 50);
|
||||
}
|
||||
|
||||
protected static class Section {
|
||||
private final Object headerData;
|
||||
private final ArrayList<Object> itemsData;
|
||||
private int globalStartPosition; // Posizione globale di inizio sezione
|
||||
|
||||
public Section(Object headerData, int initialCapacity) {
|
||||
this.headerData = headerData;
|
||||
this.itemsData = new ArrayList<>(initialCapacity);
|
||||
this.globalStartPosition = 0;
|
||||
}
|
||||
|
||||
public Object getHeaderData() {
|
||||
return headerData;
|
||||
}
|
||||
|
||||
public List<Object> getItemsData() {
|
||||
return itemsData;
|
||||
}
|
||||
|
||||
public void addItem(Object item) {
|
||||
itemsData.add(item);
|
||||
}
|
||||
|
||||
public int getItemCount() {
|
||||
return itemsData.size();
|
||||
}
|
||||
|
||||
public void setGlobalStartPosition(int position) {
|
||||
this.globalStartPosition = position;
|
||||
}
|
||||
|
||||
public int getGlobalStartPosition() {
|
||||
return globalStartPosition;
|
||||
}
|
||||
}
|
||||
|
||||
// ViewHolder pooling e caching
|
||||
@Override
|
||||
public void onViewRecycled(@NonNull RecyclerView.ViewHolder holder) {
|
||||
super.onViewRecycled(holder);
|
||||
// Pulizia custom del ViewHolder se necessario
|
||||
if (holder instanceof OnRecycleListener) {
|
||||
((OnRecycleListener) holder).onRecycle();
|
||||
}
|
||||
}
|
||||
|
||||
// Interfaccia per gestire la pulizia custom dei ViewHolder
|
||||
public interface OnRecycleListener {
|
||||
void onRecycle();
|
||||
}
|
||||
|
||||
@Override
|
||||
@NonNull
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
profiler.onPreCreate(viewType);
|
||||
RecyclerView.ViewHolder holder;
|
||||
if (viewType == TYPE_HEADER) {
|
||||
holder = onCreateHeaderViewHolder(parent);
|
||||
} else {
|
||||
holder = onCreateItemViewHolder(parent);
|
||||
}
|
||||
|
||||
// Applichiamo ViewHolder pooling
|
||||
if (holder.itemView.getLayoutParams() == null) {
|
||||
holder.itemView.setLayoutParams(
|
||||
new ViewGroup.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
profiler.onPostCreate(viewType);
|
||||
return holder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||
profiler.onPreBind(position);
|
||||
PositionInfo posInfo = getItemPositionInfo(position);
|
||||
|
||||
if (getItemViewType(position) == TYPE_HEADER) {
|
||||
onBindHeaderViewHolder((H) holder,
|
||||
sections.get(posInfo.sectionPosition).getHeaderData(),
|
||||
posInfo.sectionPosition);
|
||||
} else {
|
||||
Section section = sections.get(posInfo.sectionPosition);
|
||||
onBindItemViewHolder((I) holder,
|
||||
section.getItemsData().get(posInfo.itemPosition),
|
||||
posInfo.sectionPosition,
|
||||
posInfo.itemPosition);
|
||||
}
|
||||
profiler.onPostBind(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position, @NonNull List<Object> payloads) {
|
||||
if (payloads.isEmpty()) {
|
||||
super.onBindViewHolder(holder, position, payloads);
|
||||
return;
|
||||
}
|
||||
|
||||
// Supporto per aggiornamenti parziali
|
||||
if (getItemViewType(position) == TYPE_HEADER) {
|
||||
onBindHeaderViewHolderPartial((H) holder, position, payloads);
|
||||
} else {
|
||||
onBindItemViewHolderPartial((I) holder, position, payloads);
|
||||
}
|
||||
}
|
||||
|
||||
// Metodi per gestire aggiornamenti parziali
|
||||
protected void onBindHeaderViewHolderPartial(H holder, int position, List<Object> payloads) {
|
||||
onBindViewHolder(holder, position);
|
||||
}
|
||||
|
||||
protected void onBindItemViewHolderPartial(I holder, int position, List<Object> payloads) {
|
||||
onBindViewHolder(holder, position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
int count = 0;
|
||||
for (Section section : sections) {
|
||||
count += section.getItemCount() + 1;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
return isHeader(position) ? TYPE_HEADER : TYPE_ITEM;
|
||||
}
|
||||
|
||||
// Metodi ottimizzati per la gestione delle sezioni
|
||||
public <T> void addSection(T headerData, int expectedItems) {
|
||||
sections.add(new Section(headerData, expectedItems));
|
||||
updatePositionCache();
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void addItem(int sectionPosition, Object item) {
|
||||
if (sectionPosition >= 0 && sectionPosition < sections.size()) {
|
||||
sections.get(sectionPosition).addItem(item);
|
||||
updatePositionCache();
|
||||
// Notifichiamo solo l'inserimento invece di un refresh completo
|
||||
notifyItemInserted(getGlobalPositionForItem(sectionPosition,
|
||||
sections.get(sectionPosition).getItemCount() - 1));
|
||||
}
|
||||
}
|
||||
|
||||
public <T extends Object, S extends Object> void setSections(List<T> headers, Map<T, List<S>> items) {
|
||||
sections.clear();
|
||||
sectionsByPosition.clear();
|
||||
|
||||
int position = 0;
|
||||
for (T header : headers) {
|
||||
List<S> sectionItems = items.get(header);
|
||||
Section section = new Section(header, sectionItems != null ? sectionItems.size() : 5);
|
||||
if (sectionItems != null) {
|
||||
section.getItemsData().addAll(sectionItems);
|
||||
}
|
||||
section.setGlobalStartPosition(position);
|
||||
sections.add(section);
|
||||
sectionsByPosition.put(position, section);
|
||||
|
||||
position += section.getItemCount() + 1;
|
||||
}
|
||||
|
||||
updatePositionCache();
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
// Gestione efficiente della cache delle posizioni
|
||||
private void updatePositionCache() {
|
||||
if (sections.size() > MAX_POSITION_CACHE_SIZE) {
|
||||
positionCache.clear();
|
||||
return;
|
||||
}
|
||||
|
||||
int currentPosition = 0;
|
||||
for (int i = 0; i < sections.size(); i++) {
|
||||
Section section = sections.get(i);
|
||||
section.setGlobalStartPosition(currentPosition);
|
||||
sectionsByPosition.put(currentPosition, section);
|
||||
currentPosition += section.getItemCount() + 1;
|
||||
}
|
||||
|
||||
lastCacheUpdateCount = getItemCount();
|
||||
}
|
||||
|
||||
private boolean isHeader(int position) {
|
||||
Section section = sectionsByPosition.get(position);
|
||||
if (section != null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
for (int i = 0; i < sections.size(); i++) {
|
||||
section = sections.get(i);
|
||||
if (position == section.getGlobalStartPosition()) {
|
||||
return true;
|
||||
}
|
||||
if (position < section.getGlobalStartPosition() + section.getItemCount() + 1) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static class PositionInfo {
|
||||
final int sectionPosition;
|
||||
final int itemPosition;
|
||||
|
||||
PositionInfo(int sectionPosition, int itemPosition) {
|
||||
this.sectionPosition = sectionPosition;
|
||||
this.itemPosition = itemPosition;
|
||||
}
|
||||
}
|
||||
|
||||
private PositionInfo getItemPositionInfo(int position) {
|
||||
// Controllo cache
|
||||
int cachedSection = positionCache.get(position, -1);
|
||||
if (cachedSection != -1 && lastCacheUpdateCount == getItemCount()) {
|
||||
Section section = sections.get(cachedSection);
|
||||
int relativePos = position - section.getGlobalStartPosition();
|
||||
if (relativePos == 0) {
|
||||
return new PositionInfo(cachedSection, -1);
|
||||
}
|
||||
return new PositionInfo(cachedSection, relativePos - 1);
|
||||
}
|
||||
|
||||
// Ricerca ottimizzata
|
||||
Section targetSection = sectionsByPosition.get(position);
|
||||
if (targetSection != null) {
|
||||
int sectionIndex = sections.indexOf(targetSection);
|
||||
return new PositionInfo(sectionIndex, -1);
|
||||
}
|
||||
|
||||
// Ricerca binaria nelle sezioni
|
||||
int left = 0;
|
||||
int right = sections.size() - 1;
|
||||
|
||||
while (left <= right) {
|
||||
int mid = (left + right) >>> 1;
|
||||
Section section = sections.get(mid);
|
||||
int sectionStart = section.getGlobalStartPosition();
|
||||
int sectionEnd = sectionStart + section.getItemCount() + 1;
|
||||
|
||||
if (position >= sectionStart && position < sectionEnd) {
|
||||
int relativePos = position - sectionStart;
|
||||
if (relativePos == 0) {
|
||||
return new PositionInfo(mid, -1);
|
||||
}
|
||||
return new PositionInfo(mid, relativePos - 1);
|
||||
}
|
||||
|
||||
if (position < sectionStart) {
|
||||
right = mid - 1;
|
||||
} else {
|
||||
left = mid + 1;
|
||||
}
|
||||
}
|
||||
|
||||
throw new IndexOutOfBoundsException("Position " + position + " is out of bounds");
|
||||
}
|
||||
|
||||
private int getGlobalPositionForItem(int sectionPosition, int itemPosition) {
|
||||
return sections.get(sectionPosition).getGlobalStartPosition() + itemPosition + 1;
|
||||
}
|
||||
|
||||
// Metodi astratti che devono essere implementati
|
||||
protected abstract H onCreateHeaderViewHolder(ViewGroup parent);
|
||||
protected abstract I onCreateItemViewHolder(ViewGroup parent);
|
||||
protected abstract void onBindHeaderViewHolder(H holder, Object headerData, int sectionPosition);
|
||||
protected abstract void onBindItemViewHolder(I holder, Object itemData, int sectionPosition, int itemPosition);
|
||||
}
|
||||
@@ -1,17 +1,10 @@
|
||||
package it.integry.integrywmsnative.core.menu;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.model.StbMenu;
|
||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||
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 retrofit2.Call;
|
||||
import retrofit2.Response;
|
||||
|
||||
@Singleton
|
||||
public class MenuRESTConsumer extends _BaseRESTConsumer {
|
||||
@@ -22,19 +15,12 @@ public class MenuRESTConsumer extends _BaseRESTConsumer {
|
||||
this.restBuilder = restBuilder;
|
||||
}
|
||||
|
||||
public void retrieveMenu(String rootCodOpz, RunnableArgs<StbMenu> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public StbMenu retrieveMenuSynchronized(String rootCodOpz) throws Exception {
|
||||
MenuRESTConsumerService menuRESTConsumerService = restBuilder.getService(MenuRESTConsumerService.class);
|
||||
menuRESTConsumerService.retrieveMenuConfig(rootCodOpz).enqueue(new ManagedErrorCallback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<StbMenu>> call, Response<ServiceRESTResponse<StbMenu>> response) {
|
||||
analyzeAnswer(response, "retrieveMenu", onComplete, onFailed);
|
||||
}
|
||||
var response = menuRESTConsumerService.retrieveMenuConfig(rootCodOpz)
|
||||
.execute();
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<StbMenu>> call, @NonNull final Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
return analyzeAnswer(response, "retrieveMenu");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ import javax.inject.Singleton;
|
||||
|
||||
import it.integry.integrywmsnative.core.class_router.configs.BaseMenuConfiguration;
|
||||
import it.integry.integrywmsnative.core.class_router.configs.MenuConfiguration;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.menu.exception.MenuNotFoundException;
|
||||
import it.integry.integrywmsnative.core.model.StbMenu;
|
||||
|
||||
@@ -29,20 +28,18 @@ public class MenuService {
|
||||
this.menuRESTConsumer = menuRESTConsumer;
|
||||
}
|
||||
|
||||
public void init(Runnable onMenuInitialized, RunnableArgs<Exception> onFailed) {
|
||||
menuRESTConsumer.retrieveMenu(MENU_COD_OPZ, menu -> {
|
||||
if(menu != null) {
|
||||
this.mInternalCachedMenu = menu.getStbMenuChildren();
|
||||
this.mInternalCachedFlatMenu = new ArrayList<>();
|
||||
flattenMenu(this.mInternalCachedMenu);
|
||||
}
|
||||
public void init() throws Exception {
|
||||
var menu = menuRESTConsumer.retrieveMenuSynchronized(MENU_COD_OPZ);
|
||||
|
||||
onMenuInitialized.run();
|
||||
}, onFailed);
|
||||
if (menu != null) {
|
||||
this.mInternalCachedMenu = menu.getStbMenuChildren();
|
||||
this.mInternalCachedFlatMenu = new ArrayList<>();
|
||||
flattenMenu(this.mInternalCachedMenu);
|
||||
}
|
||||
}
|
||||
|
||||
public List<StbMenu> getMenu() throws Exception {
|
||||
if(mInternalCachedMenu == null) throw new MenuNotFoundException();
|
||||
if (mInternalCachedMenu == null) throw new MenuNotFoundException();
|
||||
|
||||
return mInternalCachedMenu;
|
||||
}
|
||||
@@ -64,10 +61,10 @@ public class MenuService {
|
||||
}
|
||||
|
||||
private void flattenMenu(List<StbMenu> menu) {
|
||||
for(StbMenu stbMenu : menu) {
|
||||
for (StbMenu stbMenu : menu) {
|
||||
this.mInternalCachedFlatMenu.add(stbMenu);
|
||||
|
||||
if(stbMenu.getStbMenuChildren() != null && !stbMenu.getStbMenuChildren().isEmpty()) {
|
||||
if (stbMenu.getStbMenuChildren() != null && !stbMenu.getStbMenuChildren().isEmpty()) {
|
||||
flattenMenu(stbMenu.getStbMenuChildren());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package it.integry.integrywmsnative.core.model;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
@@ -96,6 +97,8 @@ public class MtbAart extends EntityBase {
|
||||
|
||||
private List<MtbUntMis> mtbUntMis;
|
||||
|
||||
private List<MtbAartBarCode> mtbAartBarCode;
|
||||
|
||||
|
||||
public enum UntMisRifPesoEnum {
|
||||
C,
|
||||
@@ -108,6 +111,104 @@ public class MtbAart extends EntityBase {
|
||||
this.type = "mtb_aart";
|
||||
}
|
||||
|
||||
public MtbAart(MtbAart other) {
|
||||
this();
|
||||
|
||||
this.codMart = other.codMart;
|
||||
this.descrizione = other.descrizione;
|
||||
this.untMis = other.untMis;
|
||||
this.barCode = other.barCode;
|
||||
this.pesoKg = other.pesoKg; // BigDecimal è immutabile
|
||||
this.qtaCnf = other.qtaCnf;
|
||||
this.codAliq = other.codAliq;
|
||||
this.codScoArt = other.codScoArt;
|
||||
this.codTcolUi = other.codTcolUi;
|
||||
this.codTcolUl = other.codTcolUl;
|
||||
this.articoloComposto = other.articoloComposto;
|
||||
this.esposizioneComp = other.esposizioneComp;
|
||||
this.descrizioneEstesa = other.descrizioneEstesa;
|
||||
this.codUltForn = other.codUltForn;
|
||||
this.dataUltCar = other.dataUltCar;
|
||||
this.valUltCar = other.valUltCar;
|
||||
this.codUltClie = other.codUltClie;
|
||||
this.dataUltScar = other.dataUltScar;
|
||||
this.valUltScar = other.valUltScar;
|
||||
this.tipoCodice = other.tipoCodice;
|
||||
this.note = other.note;
|
||||
this.posizione = other.posizione;
|
||||
this.colliPedana = other.colliPedana;
|
||||
this.untMis2 = other.untMis2;
|
||||
this.rapConv2 = other.rapConv2;
|
||||
this.flagInclListino = other.flagInclListino;
|
||||
this.untMis3 = other.untMis3;
|
||||
this.rapConv3 = other.rapConv3;
|
||||
this.codMartStat = other.codMartStat;
|
||||
this.codMcon = other.codMcon;
|
||||
this.codMgrp = other.codMgrp;
|
||||
this.codMsfa = other.codMsfa;
|
||||
this.codMsgr = other.codMsgr;
|
||||
this.codMstp = other.codMstp;
|
||||
this.codMtip = other.codMtip;
|
||||
this.descrizioneStat = other.descrizioneStat;
|
||||
this.flagStato = other.flagStato;
|
||||
this.cambioDiviCar = other.cambioDiviCar;
|
||||
this.cambioDiviScar = other.cambioDiviScar;
|
||||
this.ggScadPartita = other.ggScadPartita;
|
||||
this.volumeMc = other.volumeMc;
|
||||
this.flagEsponiPrz = other.flagEsponiPrz;
|
||||
this.dataUltVar = other.dataUltVar;
|
||||
this.percSfrido = other.percSfrido;
|
||||
this.codBarreImb = other.codBarreImb;
|
||||
this.flagCalcPrz = other.flagCalcPrz;
|
||||
this.esposizioneCompAcq = other.esposizioneCompAcq;
|
||||
this.flagCalcPrzAcq = other.flagCalcPrzAcq;
|
||||
this.diacod = other.diacod;
|
||||
this.plu = other.plu;
|
||||
this.partIvaProd = other.partIvaProd;
|
||||
this.ragSocProd = other.ragSocProd;
|
||||
this.flagRapConvVariabile = other.flagRapConvVariabile;
|
||||
this.flagMovArtMag = other.flagMovArtMag;
|
||||
this.flagTracciabilita = other.flagTracciabilita;
|
||||
this.taraKg = other.taraKg;
|
||||
this.colliStrato = other.colliStrato;
|
||||
this.flagQtaCnfFissa = other.flagQtaCnfFissa;
|
||||
this.flagColliPedanaFisso = other.flagColliPedanaFisso;
|
||||
this.codCconCosti = other.codCconCosti;
|
||||
this.codCconRicavi = other.codCconRicavi;
|
||||
this.codDgrpArt = other.codDgrpArt;
|
||||
this.codDiviCar = other.codDiviCar;
|
||||
this.codDiviScar = other.codDiviScar;
|
||||
this.codEcrCat = other.codEcrCat;
|
||||
this.codEcrMcat = other.codEcrMcat;
|
||||
this.codEcrRep = other.codEcrRep;
|
||||
this.codEcrStipo = other.codEcrStipo;
|
||||
this.codEcrTipo = other.codEcrTipo;
|
||||
this.codGrpBolla = other.codGrpBolla;
|
||||
this.ingredienti = other.ingredienti;
|
||||
this.idArtEqui = other.idArtEqui;
|
||||
this.descrCassa = other.descrCassa;
|
||||
this.codNcIntracee = other.codNcIntracee;
|
||||
this.marchio = other.marchio;
|
||||
this.sezione = other.sezione;
|
||||
this.untMisRifPeso = other.untMisRifPeso; // Enum è immutabile
|
||||
|
||||
this.qtaEsistente = other.qtaEsistente;
|
||||
this.qtaImpegnata = other.qtaImpegnata;
|
||||
this.numCnfEsistente = other.numCnfEsistente;
|
||||
this.numCnfImpegnata = other.numCnfImpegnata;
|
||||
|
||||
// Deep copy della lista
|
||||
if (other.mtbUntMis != null) {
|
||||
this.mtbUntMis = new ArrayList<>();
|
||||
for (MtbUntMis untMis : other.mtbUntMis) {
|
||||
this.mtbUntMis.add(new MtbUntMis(untMis)); // Assicurati che MtbUntMis abbia un costruttore di copia
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public boolean isFlagTracciabilitaBoolean() {
|
||||
return flagTracciabilita != null && flagTracciabilita.equalsIgnoreCase("S");
|
||||
}
|
||||
@@ -866,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;
|
||||
}
|
||||
}
|
||||
@@ -67,6 +67,58 @@ public class MtbColr extends EntityBase {
|
||||
}
|
||||
}
|
||||
|
||||
public MtbColr(MtbColr other) {
|
||||
this();
|
||||
|
||||
this.gestione = other.gestione;
|
||||
this.serCollo = other.serCollo;
|
||||
this.numCollo = other.numCollo;
|
||||
this.dataCollo = other.dataCollo;
|
||||
this.riga = other.riga;
|
||||
this.rigaOrd = other.rigaOrd;
|
||||
this.codMart = other.codMart;
|
||||
this.codBarre = other.codBarre;
|
||||
this.codCol = other.codCol;
|
||||
this.codTagl = other.codTagl;
|
||||
this.partitaMag = other.partitaMag;
|
||||
this.gestioneRif = other.gestioneRif;
|
||||
this.serColloRif = other.serColloRif;
|
||||
this.note = other.note;
|
||||
this.dataOrd = other.dataOrd; // LocalDate è immutabile
|
||||
this.dataColloRif = other.dataColloRif;
|
||||
this.qtaCnf = other.qtaCnf; // BigDecimal è immutabile
|
||||
this.qtaCol = other.qtaCol;
|
||||
this.numOrd = other.numOrd;
|
||||
this.numEtich = other.numEtich;
|
||||
this.numColloRif = other.numColloRif;
|
||||
this.datetimeRow = other.datetimeRow;
|
||||
this.codJcom = other.codJcom;
|
||||
this.numCnf = other.numCnf;
|
||||
this.insPartitaMag = other.insPartitaMag;
|
||||
this.mtbPartitaMag_descrizione = other.mtbPartitaMag_descrizione;
|
||||
this.dataScadPartita = other.dataScadPartita;
|
||||
this.descrizione = other.descrizione;
|
||||
this.untMis = other.untMis;
|
||||
this.causale = other.causale;
|
||||
this.utente = other.utente;
|
||||
this.codAnagDoc = other.codAnagDoc;
|
||||
this.codDtipDoc = other.codDtipDoc;
|
||||
this.dataDoc = other.dataDoc;
|
||||
this.serDoc = other.serDoc;
|
||||
this.numDoc = other.numDoc;
|
||||
this.idRigaDoc = other.idRigaDoc;
|
||||
this.pesoNettoKg = other.pesoNettoKg;
|
||||
this.pesoLordoKg = other.pesoLordoKg;
|
||||
|
||||
// Deep copy degli oggetti complessi
|
||||
this.mtbAart = other.mtbAart != null ? new MtbAart(other.mtbAart) : null;
|
||||
this.mtbPartitaMag = other.mtbPartitaMag != null ? new MtbPartitaMag(other.mtbPartitaMag) : null;
|
||||
|
||||
// Non copiamo i campi transient
|
||||
// this.id = other.id;
|
||||
// this.refMtbColr = other.refMtbColr;
|
||||
}
|
||||
|
||||
|
||||
public static class Causale {
|
||||
public static final int DEFAULT = 0;
|
||||
|
||||
@@ -3,7 +3,7 @@ package it.integry.integrywmsnative.core.model;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import androidx.databinding.ObservableArrayList;
|
||||
import androidx.databinding.ObservableField;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import com.annimon.stream.Optional;
|
||||
import com.annimon.stream.Stream;
|
||||
@@ -66,7 +66,9 @@ public class MtbColt extends EntityBase {
|
||||
private BigDecimal altezzaCm;
|
||||
private String codJcom;
|
||||
|
||||
private final ObservableField<ObservableMtbTcol> mtbTCol = new ObservableField<>();
|
||||
private String barcodeUl;
|
||||
|
||||
private final transient MutableLiveData<ObservableMtbTcol> mtbTCol = new MutableLiveData<>();
|
||||
|
||||
private Boolean disablePrint;
|
||||
private String ragSocCliente;
|
||||
@@ -261,7 +263,7 @@ public class MtbColt extends EntityBase {
|
||||
public MtbColt setCodTcol(String codTcol) {
|
||||
this.codTcol = codTcol;
|
||||
|
||||
if(!UtilityString.isNullOrEmpty(codTcol)) {
|
||||
if (!UtilityString.isNullOrEmpty(codTcol)) {
|
||||
var fountMtbTcolObservable = SettingsManager.iDB().getInternalImballi().stream()
|
||||
.filter(x -> x.getCodTcol().equalsIgnoreCase(codTcol))
|
||||
.findFirst()
|
||||
@@ -544,16 +546,25 @@ public class MtbColt extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public ObservableMtbTcol getMtbTCol() {
|
||||
return mtbTCol.get();
|
||||
public String getBarcodeUl() {
|
||||
return barcodeUl;
|
||||
}
|
||||
|
||||
public MtbColt setMtbTCol(ObservableMtbTcol mtbTCol) {
|
||||
this.mtbTCol.set(mtbTCol);
|
||||
public MtbColt setBarcodeUl(String barcodeUl) {
|
||||
this.barcodeUl = barcodeUl;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ObservableField<ObservableMtbTcol> mtbTcolProperty() {
|
||||
public ObservableMtbTcol getMtbTCol() {
|
||||
return mtbTCol.getValue();
|
||||
}
|
||||
|
||||
public MtbColt setMtbTCol(ObservableMtbTcol mtbTCol) {
|
||||
this.mtbTCol.postValue(mtbTCol);
|
||||
return this;
|
||||
}
|
||||
|
||||
public MutableLiveData<ObservableMtbTcol> mtbTcolProperty() {
|
||||
return mtbTCol;
|
||||
}
|
||||
|
||||
@@ -631,8 +642,20 @@ public class MtbColt extends EntityBase {
|
||||
|
||||
@Override
|
||||
public EntityBase clone() {
|
||||
return clone(true);
|
||||
}
|
||||
|
||||
public MtbColt clone(boolean withMtbColr) {
|
||||
MtbColt mtbColt = (MtbColt) super.clone();
|
||||
mtbColt.setMtbColr((ObservableArrayList<MtbColr>) mtbColt.getMtbColr().clone());
|
||||
mtbColt.setMtbColr(new ObservableArrayList<>());
|
||||
|
||||
if(!withMtbColr) return mtbColt;
|
||||
|
||||
this.getMtbColr().stream()
|
||||
.map(MtbColr::new) //Genera un clone
|
||||
.forEach(mtbColr -> {
|
||||
mtbColt.getMtbColr().add(mtbColr);
|
||||
});
|
||||
return mtbColt;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,34 +4,60 @@ import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
public class MtbPartitaMag extends EntityBase{
|
||||
private String codMart;
|
||||
|
||||
private String partitaMag;
|
||||
private String descrizione;
|
||||
public class MtbPartitaMag extends EntityBase {
|
||||
private String codMart;
|
||||
|
||||
private String partitaMag;
|
||||
private String descrizione;
|
||||
private LocalDateTime dataIns;
|
||||
private LocalDate dataScad;
|
||||
private Integer scelta;
|
||||
private Integer scelta;
|
||||
private BigDecimal costoUntUmMag;
|
||||
private BigDecimal valUntUmMag;
|
||||
private BigDecimal taraCnfKg;
|
||||
private BigDecimal qtaCnf;
|
||||
private String flagImballoArendere;
|
||||
private String flagStato;
|
||||
private String codDiviCont;
|
||||
private BigDecimal cambioDiviCont;
|
||||
private String barcode;
|
||||
private String note;
|
||||
private BigDecimal rapConv2;
|
||||
private BigDecimal rapConv3;
|
||||
private String posizione;
|
||||
private BigDecimal valUntUmMag;
|
||||
private BigDecimal taraCnfKg;
|
||||
private BigDecimal qtaCnf;
|
||||
private String flagImballoArendere;
|
||||
private String flagStato;
|
||||
private String codDiviCont;
|
||||
private BigDecimal cambioDiviCont;
|
||||
private String barcode;
|
||||
private String note;
|
||||
private BigDecimal rapConv2;
|
||||
private BigDecimal rapConv3;
|
||||
private String posizione;
|
||||
private String dataAggPrz;
|
||||
private String partitaMagSec;
|
||||
private String partitaMagSec;
|
||||
private BigDecimal qtaAttesa;
|
||||
|
||||
public MtbPartitaMag() {
|
||||
this.type = "mtb_partita_mag";
|
||||
}
|
||||
public MtbPartitaMag(MtbPartitaMag other) {
|
||||
this();
|
||||
|
||||
this.codMart = other.codMart;
|
||||
this.partitaMag = other.partitaMag;
|
||||
this.descrizione = other.descrizione;
|
||||
this.dataIns = other.dataIns; // LocalDateTime è immutabile
|
||||
this.dataScad = other.dataScad; // LocalDate è immutabile
|
||||
this.scelta = other.scelta;
|
||||
this.costoUntUmMag = other.costoUntUmMag; // BigDecimal è immutabile
|
||||
this.valUntUmMag = other.valUntUmMag;
|
||||
this.taraCnfKg = other.taraCnfKg;
|
||||
this.qtaCnf = other.qtaCnf;
|
||||
this.flagImballoArendere = other.flagImballoArendere;
|
||||
this.flagStato = other.flagStato;
|
||||
this.codDiviCont = other.codDiviCont;
|
||||
this.cambioDiviCont = other.cambioDiviCont;
|
||||
this.barcode = other.barcode;
|
||||
this.note = other.note;
|
||||
this.rapConv2 = other.rapConv2;
|
||||
this.rapConv3 = other.rapConv3;
|
||||
this.posizione = other.posizione;
|
||||
this.dataAggPrz = other.dataAggPrz;
|
||||
this.partitaMagSec = other.partitaMagSec;
|
||||
this.qtaAttesa = other.qtaAttesa;
|
||||
}
|
||||
|
||||
|
||||
public String getCodMart() {
|
||||
|
||||
@@ -15,6 +15,18 @@ public class MtbUntMis extends EntityBase {
|
||||
this.type = "mtb_unt_mis";
|
||||
}
|
||||
|
||||
// Costruttore di copia
|
||||
public MtbUntMis(MtbUntMis other) {
|
||||
this();
|
||||
|
||||
this.untMis = other.untMis;
|
||||
this.flagDig = other.flagDig;
|
||||
this.cifreDec = other.cifreDec; // BigDecimal è immutabile
|
||||
this.tipoUm = other.tipoUm;
|
||||
this.flagUnitaKg = other.flagUnitaKg;
|
||||
this.flagAttivo = other.flagAttivo;
|
||||
}
|
||||
|
||||
public String getUntMis() {
|
||||
return untMis;
|
||||
}
|
||||
|
||||
@@ -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,6 @@ 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 okhttp3.HttpUrl;
|
||||
import okhttp3.Interceptor;
|
||||
import okhttp3.Request;
|
||||
@@ -31,18 +30,6 @@ public class HttpInterceptor implements Interceptor {
|
||||
.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())) {
|
||||
accessToken = SettingsManager.i().getUserSession().getAccessToken();
|
||||
}
|
||||
|
||||
if(accessToken != null)
|
||||
builder.header("Authorization", "Bearer " + accessToken);
|
||||
|
||||
var newRequest = builder
|
||||
.url(url)
|
||||
.build();
|
||||
|
||||
@@ -108,7 +108,7 @@ public class ArticoloRESTConsumer extends _BaseRESTConsumer {
|
||||
});
|
||||
}
|
||||
|
||||
public void findIfIsKit(MtbAart mtbAart, RunnableArgs<MtbAart> onComplete, RunnableArgs<Exception> onFailed){
|
||||
public void findIfIsKit(MtbAart mtbAart, RunnableArgs<MtbAart> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ArticoloRESTConsumerService articoloRESTConsumerService = restBuilder.getService(ArticoloRESTConsumerService.class);
|
||||
|
||||
articoloRESTConsumerService
|
||||
@@ -132,8 +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()
|
||||
@@ -210,25 +209,26 @@ public class ArticoloRESTConsumer extends _BaseRESTConsumer {
|
||||
}
|
||||
|
||||
|
||||
public void getUntMisArts(List<String> inputUntMis, RunnableArgs<List<MtbUntMis>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
List<HashMap<String, Object>> whereCondList = Stream.of(inputUntMis)
|
||||
public List<MtbUntMis> getUntMisArtsSynchronized(List<String> inputUntMis) throws Exception {
|
||||
List<HashMap<String, Object>> whereCondList = inputUntMis.parallelStream()
|
||||
.distinct()
|
||||
.withoutNulls()
|
||||
.filter(Objects::nonNull)
|
||||
.map(x -> {
|
||||
HashMap<String, Object> data = new HashMap<>();
|
||||
data.put("unt_mis", x);
|
||||
return data;
|
||||
})
|
||||
.toList();
|
||||
.collect(Collectors.toUnmodifiableList());
|
||||
|
||||
var whereCond = whereCondList.isEmpty() ? "" : " WHERE " + UtilityQuery.concatFieldListInWhereCond(whereCondList);
|
||||
|
||||
Type typeOfObjectsList = new TypeToken<ArrayList<MtbUntMis>>() {
|
||||
}.getType();
|
||||
this.systemRESTConsumer.processSql("SELECT * FROM mtb_unt_mis " + whereCond, typeOfObjectsList, onComplete, onFailed);
|
||||
|
||||
return this.systemRESTConsumer.processSqlSynchronized("SELECT * FROM mtb_unt_mis " + whereCond, typeOfObjectsList);
|
||||
}
|
||||
|
||||
public void fillMtbAartsWithMtbUntMis(List<MtbAart> inputMtbAart, RunnableArgs<List<MtbAart>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public List<MtbAart> fillMtbAartsWithMtbUntMisSynchronized(List<MtbAart> inputMtbAart) throws Exception {
|
||||
var inputUntMis = new ArrayList<String>();
|
||||
|
||||
if (inputMtbAart != null && !inputMtbAart.isEmpty()) {
|
||||
@@ -240,21 +240,23 @@ public class ArticoloRESTConsumer extends _BaseRESTConsumer {
|
||||
}
|
||||
|
||||
if (inputUntMis.isEmpty()) {
|
||||
onComplete.run(inputMtbAart);
|
||||
return;
|
||||
return inputMtbAart;
|
||||
}
|
||||
|
||||
getUntMisArts(inputUntMis, mtbUntMiss -> {
|
||||
for (var item : inputMtbAart) {
|
||||
var mtbUntMis = Stream.of(mtbUntMiss).filter(x -> x.getUntMis().equalsIgnoreCase(item.getUntMis()))
|
||||
.findFirstOrElse(null);
|
||||
var mtbUntMiss = getUntMisArtsSynchronized(inputUntMis);
|
||||
|
||||
if (mtbUntMis != null)
|
||||
item.setMtbUntMis(Collections.singletonList(mtbUntMis));
|
||||
}
|
||||
for (var item : inputMtbAart) {
|
||||
var mtbUntMis = mtbUntMiss.stream()
|
||||
.filter(x -> x.getUntMis().equalsIgnoreCase(item.getUntMis()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
|
||||
if (mtbUntMis != null)
|
||||
item.setMtbUntMis(Collections.singletonList(mtbUntMis));
|
||||
}
|
||||
|
||||
return inputMtbAart;
|
||||
|
||||
onComplete.run(inputMtbAart);
|
||||
}, onFailed);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,16 +1,9 @@
|
||||
package it.integry.integrywmsnative.core.rest.consumers;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.model.Azienda;
|
||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Response;
|
||||
|
||||
@Singleton
|
||||
public class AziendaRESTConsumer extends _BaseRESTConsumer {
|
||||
@@ -21,19 +14,12 @@ public class AziendaRESTConsumer extends _BaseRESTConsumer {
|
||||
this.restBuilder = restBuilder;
|
||||
}
|
||||
|
||||
public void retrieveAzienda(RunnableArgs<Azienda> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public Azienda retrieveAziendaSynchronized() throws Exception {
|
||||
AziendaRESTConsumerService aziendaRESTConsumerService = restBuilder.getService(AziendaRESTConsumerService.class);
|
||||
aziendaRESTConsumerService.retrieveDefaultAzienda().enqueue(new ManagedErrorCallback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<Azienda>> call, Response<ServiceRESTResponse<Azienda>> response) {
|
||||
analyzeAnswer(response, "Retrieve default azienda", onComplete, onFailed);
|
||||
}
|
||||
var response = aziendaRESTConsumerService.retrieveDefaultAzienda()
|
||||
.execute();
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<Azienda>> call, @NonNull final Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
return analyzeAnswer(response, "Retrieve default azienda");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package it.integry.integrywmsnative.core.rest.consumers;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
@@ -27,10 +28,8 @@ 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;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.DeleteUDSRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.EditUDSRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.EditUDSRowResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDCRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDCRowResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowRequestDTO;
|
||||
@@ -44,10 +43,12 @@ public class ColliLavorazioneRESTConsumer extends _BaseRESTConsumer implements C
|
||||
|
||||
|
||||
private final RESTBuilder restBuilder;
|
||||
private final ExecutorService executorService;
|
||||
private final SettingsManager settingsManager;
|
||||
|
||||
public ColliLavorazioneRESTConsumer(RESTBuilder restBuilder, SettingsManager settingsManager) {
|
||||
public ColliLavorazioneRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService, SettingsManager settingsManager) {
|
||||
this.restBuilder = restBuilder;
|
||||
this.executorService = executorService;
|
||||
this.settingsManager = settingsManager;
|
||||
}
|
||||
|
||||
@@ -123,93 +124,111 @@ public class ColliLavorazioneRESTConsumer extends _BaseRESTConsumer implements C
|
||||
});
|
||||
}
|
||||
|
||||
public void createUDS(CreateUDSRequestDTO createUDSRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public MtbColt createUDSSynchronized(CreateUDSRequestDTO createUDSRequestDTO) throws Exception {
|
||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||
|
||||
colliLavorazioneRESTConsumerService.createUDS(createUDSRequestDTO)
|
||||
.enqueue(new ManagedErrorCallback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<CreateUDSResponseDTO>> call, Response<ServiceRESTResponse<CreateUDSResponseDTO>> response) {
|
||||
analyzeAnswer(response, "lavorazione/createUDS", data -> onComplete.run(data.getMtbColt()), onFailed);
|
||||
}
|
||||
var response = colliLavorazioneRESTConsumerService.createUDS(createUDSRequestDTO)
|
||||
.execute();
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<CreateUDSResponseDTO>> call, @NonNull final Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
var data = analyzeAnswer(response, "lavorazione/createUDS");
|
||||
return data.getMtbColt();
|
||||
}
|
||||
|
||||
public void createUDS(CreateUDSRequestDTO createUDSRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
var response = createUDSSynchronized(createUDSRequestDTO);
|
||||
if (onComplete != null) onComplete.run(response);
|
||||
} catch (Exception ex) {
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public CloseUDSResponseDTO closeUDSSynchronized(CloseUDSRequestDTO closeUDSRequestDTO) throws Exception {
|
||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||
|
||||
var response = colliLavorazioneRESTConsumerService.closeUDS(closeUDSRequestDTO)
|
||||
.execute();
|
||||
|
||||
var data = analyzeAnswer(response, "lavorazione/closeUDS");
|
||||
return data;
|
||||
}
|
||||
|
||||
public void closeUDS(CloseUDSRequestDTO closeUDSRequestDTO, RunnableArgs<CloseUDSResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
var response = closeUDSSynchronized(closeUDSRequestDTO);
|
||||
if (onComplete != null) onComplete.run(response);
|
||||
} catch (Exception ex) {
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeUDS(CloseUDSRequestDTO closeUDSRequestDTO, RunnableArgs<CloseUDSResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public MtbColr insertUDSRowSynchronized(InsertUDSRowRequestDTO insertUDSRowRequestDTO) throws Exception {
|
||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||
|
||||
colliLavorazioneRESTConsumerService.closeUDS(closeUDSRequestDTO)
|
||||
.enqueue(new ManagedErrorCallback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<CloseUDSResponseDTO>> call, Response<ServiceRESTResponse<CloseUDSResponseDTO>> response) {
|
||||
analyzeAnswer(response, "lavorazione/closeUDS", onComplete, onFailed);
|
||||
}
|
||||
Response<ServiceRESTResponse<InsertUDSRowResponseDTO>> response = colliLavorazioneRESTConsumerService.insertUDSRow(insertUDSRowRequestDTO)
|
||||
.execute();
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<CloseUDSResponseDTO>> call, @NonNull final Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
var data = analyzeAnswer(response, "lavorazione/insertUDSRow");
|
||||
return data.getSavedMtbColr();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void insertUDSRow(InsertUDSRowRequestDTO insertUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
var response = insertUDSRowSynchronized(insertUDSRowRequestDTO);
|
||||
if (onComplete != null) onComplete.run(response);
|
||||
} catch (Exception ex) {
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public MtbColr editUDSRowSynchronized(EditUDSRowRequestDTO editUDSRowRequestDTO) throws Exception {
|
||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||
|
||||
colliLavorazioneRESTConsumerService.insertUDSRow(insertUDSRowRequestDTO)
|
||||
.enqueue(new ManagedErrorCallback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<InsertUDSRowResponseDTO>> call, Response<ServiceRESTResponse<InsertUDSRowResponseDTO>> response) {
|
||||
analyzeAnswer(response, "lavorazione/insertUDSRow", data -> onComplete.run(data.getSavedMtbColr()), onFailed);
|
||||
}
|
||||
var response = colliLavorazioneRESTConsumerService.editUDSRow(editUDSRowRequestDTO)
|
||||
.execute();
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<InsertUDSRowResponseDTO>> call, @NonNull final Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
var data = analyzeAnswer(response, "lavorazione/editUDSRow");
|
||||
return data.getSavedMtbColr();
|
||||
}
|
||||
|
||||
public void editUDSRow(EditUDSRowRequestDTO editUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||
|
||||
colliLavorazioneRESTConsumerService.editUDSRow(editUDSRowRequestDTO)
|
||||
.enqueue(new ManagedErrorCallback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<EditUDSRowResponseDTO>> call, Response<ServiceRESTResponse<EditUDSRowResponseDTO>> response) {
|
||||
analyzeAnswer(response, "lavorazione/editUDSRow", data -> onComplete.run(data.getSavedMtbColr()), onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<EditUDSRowResponseDTO>> call, @NonNull final Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
var response = editUDSRowSynchronized(editUDSRowRequestDTO);
|
||||
if (onComplete != null) onComplete.run(response);
|
||||
} catch (Exception ex) {
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteUDSRow(DeleteUDSRowRequestDTO deleteUDSRowRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public void deleteUDSRowSynchronized(DeleteUDSRowRequestDTO deleteUDSRowRequestDTO) throws Exception {
|
||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||
|
||||
colliLavorazioneRESTConsumerService.deleteUDSRow(deleteUDSRowRequestDTO)
|
||||
.enqueue(new ManagedErrorCallback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
|
||||
analyzeAnswer(response, "lavorazione/deleteUDSRow", data -> onComplete.run(), onFailed);
|
||||
}
|
||||
var response = colliLavorazioneRESTConsumerService.deleteUDSRow(deleteUDSRowRequestDTO)
|
||||
.execute();
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
analyzeAnswer(response, "lavorazione/deleteUDSRow");
|
||||
}
|
||||
|
||||
public void deleteUDSRow(DeleteUDSRowRequestDTO deleteUDSRowRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
deleteUDSRowSynchronized(deleteUDSRowRequestDTO);
|
||||
if (onComplete != null) onComplete.run();
|
||||
} catch (Exception ex) {
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -17,6 +17,7 @@ import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
@@ -36,8 +37,8 @@ import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
|
||||
import it.integry.integrywmsnative.core.rest.model.RettificaULDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.core.rest.model.SpostaArtsTraULRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.SpostaArtsTraULResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.SpostaULRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.UpdatePosizioneULRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.UpdateTipoULRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.VersamentoAutomaticoULResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.CanULBeDeletedRequestDTO;
|
||||
@@ -60,8 +61,9 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
private final ArticoloRESTConsumer mArticoloRESTConsumer;
|
||||
private final EntityRESTConsumer mEntityRESTConsumer;
|
||||
private final SettingsManager mSettingsManager;
|
||||
private final ExecutorService executorService;
|
||||
|
||||
public ColliMagazzinoRESTConsumer(RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer,
|
||||
public ColliMagazzinoRESTConsumer(ExecutorService executorService, RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer,
|
||||
ArticoloRESTConsumer articoloRESTConsumer,
|
||||
EntityRESTConsumer entityRESTConsumer,
|
||||
SettingsManager settingsManager) {
|
||||
@@ -70,38 +72,36 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
this.mArticoloRESTConsumer = articoloRESTConsumer;
|
||||
this.mEntityRESTConsumer = entityRESTConsumer;
|
||||
this.mSettingsManager = settingsManager;
|
||||
this.executorService = executorService;
|
||||
}
|
||||
|
||||
public void saveCollo(MtbColt mtbColtToSave, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public MtbColt saveColloSynchronized(MtbColt mtbColtToSave) throws Exception {
|
||||
MtbColt mtbColtToSaveClone = (MtbColt) mtbColtToSave.clone();
|
||||
mtbColtToSaveClone.setOperation(CommonModelConsts.OPERATION.INSERT_OR_UPDATE);
|
||||
mtbColtToSaveClone.setOnlyPkMaster(false);
|
||||
|
||||
|
||||
mtbColtToSaveClone.setMtbColr(new ObservableArrayList<>());
|
||||
|
||||
for (int i = 0; i < mtbColtToSave.getMtbColr().size(); i++) {
|
||||
mtbColtToSaveClone.getMtbColr().add(
|
||||
((MtbColr) mtbColtToSave.getMtbColr().get(i).clone())
|
||||
.setMtbAart(null)
|
||||
.setMtbPartitaMag(null));
|
||||
mtbColtToSaveClone.getMtbColr().get(i)
|
||||
.setMtbAart(null)
|
||||
.setMtbPartitaMag(null);
|
||||
}
|
||||
|
||||
this.mEntityRESTConsumer.processEntity(mtbColtToSaveClone, new ISimpleOperationCallback<>() {
|
||||
@Override
|
||||
public void onSuccess(MtbColt value) {
|
||||
if (onComplete != null) onComplete.run(value);
|
||||
}
|
||||
return this.mEntityRESTConsumer.processEntitySynchronized(mtbColtToSaveClone, MtbColt.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed(Exception ex) {
|
||||
public void saveCollo(MtbColt mtbColtToSave, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
var mtbColt = saveColloSynchronized(mtbColtToSave);
|
||||
if (onComplete != null) onComplete.run(mtbColt);
|
||||
} catch (Exception ex) {
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
}
|
||||
}, MtbColt.class);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void saveColli(List<MtbColt> mtbColtsToSave, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public List<MtbColt> saveColliSynchronized(List<MtbColt> mtbColtsToSave) throws Exception {
|
||||
|
||||
for (MtbColt mtbColt : mtbColtsToSave) {
|
||||
for (int i = 0; i < mtbColt.getMtbColr().size(); i++) {
|
||||
@@ -111,28 +111,22 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
}
|
||||
}
|
||||
|
||||
this.mEntityRESTConsumer.processEntityList(mtbColtsToSave, true, MtbColt.class, onComplete, onFailed);
|
||||
|
||||
}
|
||||
|
||||
public void createColloLavorazione(int segno, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
MtbColt mtbColtToCreate = new MtbColt()
|
||||
.setSegno(segno);
|
||||
|
||||
mtbColtToCreate.initDefaultFields(GestioneEnum.LAVORAZIONE);
|
||||
|
||||
mtbColtToCreate
|
||||
.setOperation(CommonModelConsts.OPERATION.INSERT);
|
||||
|
||||
|
||||
saveCollo(mtbColtToCreate, value -> {
|
||||
if (onComplete != null) onComplete.run(value);
|
||||
}, ex -> {
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
});
|
||||
return this.mEntityRESTConsumer.processEntityListSynchronized(mtbColtsToSave, true, MtbColt.class);
|
||||
}
|
||||
|
||||
public void createColloScaricoDaCarico(MtbColt sourceMtbColt, MtbDepoPosizione posizione, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
var mtbColt = createColloScaricoDaCaricoSynchronized(sourceMtbColt, posizione);
|
||||
if (onComplete != null) onComplete.run(mtbColt);
|
||||
} catch (Exception ex) {
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public MtbColt createColloScaricoDaCaricoSynchronized(MtbColt sourceMtbColt, MtbDepoPosizione posizione) throws Exception {
|
||||
|
||||
MtbColt newMtbColt = new MtbColt()
|
||||
.initDefaultFields(GestioneEnum.LAVORAZIONE)
|
||||
@@ -181,7 +175,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
}
|
||||
|
||||
|
||||
saveCollo(newMtbColt, onComplete, onFailed);
|
||||
return saveColloSynchronized(newMtbColt);
|
||||
}
|
||||
|
||||
|
||||
@@ -212,7 +206,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
}
|
||||
|
||||
|
||||
// if (sourceMtbColt.getMtbColr().size() != 1) {
|
||||
// if (sourceMtbColt.getMtbColr().getValue().size() != 1) {
|
||||
// onFailed.run(new Exception());
|
||||
// return;
|
||||
// }
|
||||
@@ -288,32 +282,34 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
saveCollo(mtbColtToCreate, onComplete, onFailed);
|
||||
}
|
||||
|
||||
public void getBySSCC(String ssccString, boolean onlyResiduo, boolean throwExcIfNull, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public MtbColt getBySsccSynchronized(String ssccString, boolean onlyResiduo, boolean throwExcIfNull) throws Exception {
|
||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||
colliMagazzinoRESTConsumerService.getColloByBarcode(ssccString, onlyResiduo, throwExcIfNull).enqueue(new ManagedErrorCallback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<MtbColt>> call, Response<ServiceRESTResponse<MtbColt>> response) {
|
||||
analyzeAnswer(response, "GetBySSCC", mtbColt -> {
|
||||
var colloResponse = colliMagazzinoRESTConsumerService.getColloByBarcode(ssccString, onlyResiduo, throwExcIfNull)
|
||||
.execute();
|
||||
var mtbColt = analyzeAnswer(colloResponse, "GetBySSCC");
|
||||
|
||||
if (mtbColt != null && mtbColt.getMtbColr() != null && !mtbColt.getMtbColr().isEmpty()) {
|
||||
List<MtbColt> mtbColtList = new ArrayList<>();
|
||||
mtbColtList.add(mtbColt);
|
||||
fillMtbAartsOfMtbColts(mtbColtList, mtbColts -> onComplete.run(mtbColts.get(0)), onFailed);
|
||||
} else {
|
||||
onComplete.run(mtbColt);
|
||||
}
|
||||
if (mtbColt != null && mtbColt.getMtbColr() != null && !mtbColt.getMtbColr().isEmpty()) {
|
||||
List<MtbColt> mtbColtList = new ArrayList<>();
|
||||
mtbColtList.add(mtbColt);
|
||||
var mtbColts = fillMtbAartsOfMtbColtsSynchronized(mtbColtList);
|
||||
return mtbColts.get(0);
|
||||
}
|
||||
|
||||
}, onFailed);
|
||||
}
|
||||
return mtbColt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<MtbColt>> call, @NonNull final Exception e) {
|
||||
onFailed.run(e);
|
||||
public void getBySSCC(String ssccString, boolean onlyResiduo, boolean throwExcIfNull, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
var mtbColt = getBySsccSynchronized(ssccString, onlyResiduo, throwExcIfNull);
|
||||
if (onComplete != null) onComplete.run(mtbColt);
|
||||
} catch (Exception ex) {
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void fillMtbAartsOfMtbColrs(List<MtbColr> mtbColrs, RunnableArgs<List<MtbColr>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public List<MtbColr> fillMtbAartsOfMtbColrsSynchronized(List<MtbColr> mtbColrs) throws Exception {
|
||||
|
||||
List<String> codMarts = new ArrayList<>(mtbColrs.stream()
|
||||
.map(MtbColr::getCodMart)
|
||||
@@ -321,14 +317,48 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
.distinct()
|
||||
.collect(Collectors.toUnmodifiableList()));
|
||||
|
||||
mArticoloRESTConsumer.getByCodMarts(codMarts, arts -> {
|
||||
var arts = mArticoloRESTConsumer.getByCodMartsSynchronized(codMarts);
|
||||
|
||||
if (arts != null && !arts.isEmpty()) {
|
||||
for (MtbColr mtbColr : mtbColrs) {
|
||||
|
||||
if (arts != null && !arts.isEmpty()) {
|
||||
for (MtbColr mtbColr : mtbColrs) {
|
||||
MtbAart foundMtbAart = null;
|
||||
|
||||
List<MtbAart> mtbAartStream = arts.stream()
|
||||
.filter(x -> x.getCodMart().equalsIgnoreCase(mtbColr.getCodMart()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if (!mtbAartStream.isEmpty()) {
|
||||
foundMtbAart = mtbAartStream.get(0);
|
||||
}
|
||||
|
||||
mtbColr.setMtbAart(foundMtbAart);
|
||||
}
|
||||
}
|
||||
|
||||
return mtbColrs;
|
||||
}
|
||||
|
||||
public List<MtbColt> fillMtbAartsOfMtbColtsSynchronized(List<MtbColt> mtbColts) throws Exception {
|
||||
List<String> codMarts = new ArrayList<>();
|
||||
|
||||
for (MtbColt mtbColt : mtbColts) {
|
||||
codMarts.addAll(mtbColt.getMtbColr().stream()
|
||||
.map(MtbColr::getCodMart)
|
||||
.filter(x -> !UtilityString.isNullOrEmpty(x))
|
||||
.distinct()
|
||||
.collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
List<MtbAart> mtbAarts = mArticoloRESTConsumer.getByCodMartsSynchronized(codMarts);
|
||||
|
||||
for (MtbColt mtbColt : mtbColts) {
|
||||
for (MtbColr mtbColr : mtbColt.getMtbColr()) {
|
||||
|
||||
if (mtbAarts != null && !mtbAarts.isEmpty()) {
|
||||
MtbAart foundMtbAart = null;
|
||||
|
||||
List<MtbAart> mtbAartStream = arts.stream()
|
||||
List<MtbAart> mtbAartStream = mtbAarts.parallelStream()
|
||||
.filter(x -> x.getCodMart().equalsIgnoreCase(mtbColr.getCodMart()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
@@ -338,52 +368,26 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
mtbColr.setMtbAart(foundMtbAart);
|
||||
}
|
||||
|
||||
mtbColr.setGestione(mtbColt.getGestione());
|
||||
mtbColr.setSerCollo(mtbColt.getSerCollo());
|
||||
mtbColr.setNumCollo(mtbColt.getNumCollo());
|
||||
mtbColr.setDataCollo(mtbColt.getDataColloS());
|
||||
}
|
||||
}
|
||||
|
||||
onComplete.run(mtbColrs);
|
||||
}, onFailed);
|
||||
|
||||
return mtbColts;
|
||||
}
|
||||
|
||||
public void fillMtbAartsOfMtbColts(List<MtbColt> mtbColts, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
List<String> codMarts = new ArrayList<>();
|
||||
|
||||
for (MtbColt mtbColt : mtbColts) {
|
||||
codMarts.addAll(mtbColt.getMtbColr().stream()
|
||||
.map(MtbColr::getCodMart)
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.collect(Collectors.toUnmodifiableList()));
|
||||
}
|
||||
|
||||
|
||||
mArticoloRESTConsumer.getByCodMarts(codMarts, arts -> {
|
||||
|
||||
if (arts != null && !arts.isEmpty()) {
|
||||
for (MtbColt mtbColt : mtbColts) {
|
||||
for (MtbColr mtbColr : mtbColt.getMtbColr()) {
|
||||
|
||||
MtbAart foundMtbAart = null;
|
||||
|
||||
List<MtbAart> mtbAartStream = arts.stream()
|
||||
.filter(x -> x.getCodMart().equalsIgnoreCase(mtbColr.getCodMart()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if (!mtbAartStream.isEmpty()) {
|
||||
foundMtbAart = mtbAartStream.get(0);
|
||||
}
|
||||
|
||||
mtbColr.setMtbAart(foundMtbAart);
|
||||
mtbColr.setGestione(mtbColt.getGestione());
|
||||
mtbColr.setSerCollo(mtbColt.getSerCollo());
|
||||
mtbColr.setNumCollo(mtbColt.getNumCollo());
|
||||
mtbColr.setDataCollo(mtbColt.getDataColloS());
|
||||
}
|
||||
}
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
List<MtbColt> returnedMtbColts = fillMtbAartsOfMtbColtsSynchronized(mtbColts);
|
||||
if (onComplete != null) onComplete.run(returnedMtbColts);
|
||||
} catch (Exception ex) {
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
}
|
||||
|
||||
onComplete.run(mtbColts);
|
||||
}, onFailed);
|
||||
});
|
||||
}
|
||||
|
||||
public void getMultipleByTestate(List<MtbColt> testate, boolean onlyResiduo, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
@@ -404,6 +408,16 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
}
|
||||
}
|
||||
|
||||
public MtbColt getByChiaveColloSynchronized(GestioneEnum gestione, int numCollo, String dataCollo, String serCollo, boolean onlyResiduo, boolean throwExcIfNull) throws Exception {
|
||||
MtbColt mtbColtToRetrieve = new MtbColt()
|
||||
.setGestione(gestione)
|
||||
.setNumCollo(numCollo)
|
||||
.setDataCollo(dataCollo)
|
||||
.setSerCollo(serCollo);
|
||||
|
||||
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) {
|
||||
MtbColt mtbColtToRetrieve = new MtbColt()
|
||||
.setGestione(gestione)
|
||||
@@ -414,36 +428,34 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
getByTestata(mtbColtToRetrieve, onlyResiduo, throwExcIfNull, onComplete, onFailed);
|
||||
}
|
||||
|
||||
public void getByTestata(MtbColt testata, boolean onlyResiduo, boolean throwExcIfNull, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public MtbColt getByTestataSynchronized(MtbColt testata, boolean onlyResiduo, boolean throwExcIfNull) throws Exception {
|
||||
testata.setMtbColr(new ObservableArrayList<>());
|
||||
|
||||
|
||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||
colliMagazzinoRESTConsumerService.getColloInGiac(onlyResiduo, throwExcIfNull, testata)
|
||||
.enqueue(new ManagedErrorCallback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<MtbColt>> call, Response<ServiceRESTResponse<MtbColt>> response) {
|
||||
analyzeAnswer(response, "getColloInGiac", mtbColt -> {
|
||||
var response = colliMagazzinoRESTConsumerService.getColloInGiac(onlyResiduo, throwExcIfNull, testata)
|
||||
.execute();
|
||||
var mtbColt = analyzeAnswer(response, "getColloInGiac");
|
||||
if (mtbColt != null && mtbColt.getMtbColr() != null && !mtbColt.getMtbColr().isEmpty()) {
|
||||
var mtbColts = fillMtbAartsOfMtbColtsSynchronized(Collections.singletonList(mtbColt));
|
||||
return mtbColts.get(0);
|
||||
}
|
||||
|
||||
if (mtbColt != null && mtbColt.getMtbColr() != null && !mtbColt.getMtbColr().isEmpty()) {
|
||||
List<MtbColt> mtbColtList = new ArrayList<>();
|
||||
mtbColtList.add(mtbColt);
|
||||
fillMtbAartsOfMtbColts(mtbColtList, mtbColts -> onComplete.run(mtbColts.get(0)), onFailed);
|
||||
} else {
|
||||
onComplete.run(mtbColt);
|
||||
}
|
||||
|
||||
}, onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<MtbColt>> call, @NonNull final Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
return mtbColt;
|
||||
}
|
||||
|
||||
public void spostaUL(MtbColt mtbColtToMove, String codMdep, String posizione, boolean createDocAutomatically, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public void getByTestata(MtbColt testata, boolean onlyResiduo, boolean throwExcIfNull, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
var data = getByTestataSynchronized(testata, onlyResiduo, throwExcIfNull);
|
||||
if (onComplete != null) onComplete.run(data);
|
||||
} catch (Exception ex) {
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void spostaUlSynchronized(MtbColt mtbColtToMove, String codMdep, String posizione, boolean createDocAutomatically) throws Exception {
|
||||
MtbColt mtbColtToMoveClone = (MtbColt) mtbColtToMove.clone();
|
||||
|
||||
for (int i = 0; i < mtbColtToMoveClone.getMtbColr().size(); i++) {
|
||||
@@ -459,21 +471,23 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
.setCreateDocAutomatically(createDocAutomatically);
|
||||
|
||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||
colliMagazzinoRESTConsumerService
|
||||
Response<ServiceRESTResponse<Void>> response = colliMagazzinoRESTConsumerService
|
||||
.spostaUL(spostaUlRequestDTO)
|
||||
.enqueue(new ManagedErrorCallback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
|
||||
analyzeAnswer(response, "spostaUL", mtbColts -> {
|
||||
onComplete.run();
|
||||
}, onFailed);
|
||||
}
|
||||
.execute();
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) {
|
||||
if (onFailed != null) onFailed.run(e);
|
||||
}
|
||||
});
|
||||
analyzeAnswer(response, "spostaUL");
|
||||
}
|
||||
|
||||
|
||||
public void spostaUL(MtbColt mtbColtToMove, String codMdep, String posizione, boolean createDocAutomatically, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
spostaUlSynchronized(mtbColtToMove, codMdep, posizione, createDocAutomatically);
|
||||
if (onComplete != null) onComplete.run();
|
||||
} catch (Exception ex) {
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void spostaUL(MtbColt mtbColtToMove, MtbDepoPosizione posizione, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
@@ -484,7 +498,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
spostaUL(mtbColtToMove, codMdep, posizioneString, true, onComplete, onFailed);
|
||||
}
|
||||
|
||||
public void updateTipoUL(MtbColt mtbColt, String codTcol, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public void updateTipoULSynchronized(MtbColt mtbColt, String codTcol) throws Exception {
|
||||
|
||||
MtbColt mtbColtClone = (MtbColt) mtbColt.clone();
|
||||
mtbColtClone.setMtbColr(new ObservableArrayList<>());
|
||||
@@ -494,22 +508,52 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
.setCodTcol(codTcol);
|
||||
|
||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||
colliMagazzinoRESTConsumerService
|
||||
Response<ServiceRESTResponse<Void>> response = colliMagazzinoRESTConsumerService
|
||||
.updateTipoUL(updateTipoULRequest)
|
||||
.enqueue(new ManagedErrorCallback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
|
||||
analyzeAnswer(response, "updateTipoUL", mtbColts -> {
|
||||
onComplete.run();
|
||||
}, onFailed);
|
||||
}
|
||||
.execute();
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) {
|
||||
if (onFailed != null) onFailed.run(e);
|
||||
}
|
||||
});
|
||||
analyzeAnswer(response, "updateTipoUL");
|
||||
}
|
||||
|
||||
|
||||
public void updateTipoUL(MtbColt mtbColt, String codTcol, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
updateTipoULSynchronized(mtbColt, codTcol);
|
||||
if (onComplete != null) onComplete.run();
|
||||
} catch (Exception ex) {
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void updatePosizioneULSynchronized(MtbColt mtbColt, String posizione) throws Exception {
|
||||
|
||||
MtbColt mtbColtClone = (MtbColt) mtbColt.clone();
|
||||
mtbColtClone.setMtbColr(new ObservableArrayList<>());
|
||||
|
||||
UpdatePosizioneULRequestDTO updateTipoULRequest = new UpdatePosizioneULRequestDTO()
|
||||
.setMtbColt(mtbColtClone)
|
||||
.setPosizione(posizione);
|
||||
|
||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||
Response<ServiceRESTResponse<Void>> response = colliMagazzinoRESTConsumerService
|
||||
.updatePosizioneUL(updateTipoULRequest)
|
||||
.execute();
|
||||
|
||||
analyzeAnswer(response, "updatePosizioneUL");
|
||||
}
|
||||
|
||||
|
||||
public void updatePosizioneUL(MtbColt mtbColt, String posizione, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
updatePosizioneULSynchronized(mtbColt, posizione);
|
||||
if (onComplete != null) onComplete.run();
|
||||
} catch (Exception ex) {
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void updateDataFine(MtbColt mtbColt, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
@@ -572,44 +616,45 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
});
|
||||
}
|
||||
|
||||
public void spostaArtsTraUL(MtbColt sourceMtbColt, MtbColt destMtbColt, boolean flagForceUseRefs, RunnableArgs<List<MtbColr>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
new Thread(() -> {
|
||||
MtbColt mtbColtToMoveClone = (MtbColt) sourceMtbColt.clone();
|
||||
MtbColt mtbColtDestClone = (MtbColt) destMtbColt.clone();
|
||||
public List<MtbColr> spostaArtsTraULSynchronized(MtbColt sourceMtbColt, MtbColt destMtbColt, boolean flagForceUseRefs) throws Exception {
|
||||
MtbColt mtbColtToMoveClone = (MtbColt) sourceMtbColt.clone();
|
||||
MtbColt mtbColtDestClone = (MtbColt) destMtbColt.clone();
|
||||
|
||||
for (int i = 0; i < mtbColtToMoveClone.getMtbColr().size(); i++) {
|
||||
mtbColtToMoveClone.getMtbColr().get(i)
|
||||
.setMtbAart(null)
|
||||
.setMtbPartitaMag(null);
|
||||
}
|
||||
for (int i = 0; i < mtbColtToMoveClone.getMtbColr().size(); i++) {
|
||||
mtbColtToMoveClone.getMtbColr().get(i)
|
||||
.setMtbAart(null)
|
||||
.setMtbPartitaMag(null);
|
||||
}
|
||||
|
||||
mtbColtDestClone.setMtbColr(null);
|
||||
mtbColtDestClone.setMtbColr(null);
|
||||
|
||||
SpostaArtsTraULRequestDTO spostaArtsTraULRequestDTO = new SpostaArtsTraULRequestDTO()
|
||||
.setSourceMtbColt(mtbColtToMoveClone)
|
||||
.setDestinationMtbColt(mtbColtDestClone)
|
||||
.setFlagForceUseRefs(flagForceUseRefs);
|
||||
SpostaArtsTraULRequestDTO spostaArtsTraULRequestDTO = new SpostaArtsTraULRequestDTO()
|
||||
.setSourceMtbColt(mtbColtToMoveClone)
|
||||
.setDestinationMtbColt(mtbColtDestClone)
|
||||
.setFlagForceUseRefs(flagForceUseRefs);
|
||||
|
||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||
colliMagazzinoRESTConsumerService.spostaArtsTraUL(spostaArtsTraULRequestDTO).enqueue(new ManagedErrorCallback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<SpostaArtsTraULResponseDTO>> call, Response<ServiceRESTResponse<SpostaArtsTraULResponseDTO>> response) {
|
||||
analyzeAnswer(response, "spostaArtsTraUL", data -> {
|
||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||
var response = colliMagazzinoRESTConsumerService.spostaArtsTraUL(spostaArtsTraULRequestDTO)
|
||||
.execute();
|
||||
|
||||
fillMtbAartsOfMtbColrs(data.getGeneratedMtbColr(), onComplete, onFailed);
|
||||
var data = analyzeAnswer(response, "spostaArtsTraUL");
|
||||
var mtbColrs = fillMtbAartsOfMtbColrsSynchronized(data.getGeneratedMtbColr());
|
||||
|
||||
}, onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<SpostaArtsTraULResponseDTO>> call, @NonNull final Exception e) {
|
||||
if (onFailed != null) onFailed.run(e);
|
||||
}
|
||||
});
|
||||
}).start();
|
||||
return mtbColrs;
|
||||
}
|
||||
|
||||
public void assegnaLottoSuColloScarico(MtbColt sourceMtbColt, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public void spostaArtsTraUL(MtbColt sourceMtbColt, MtbColt destMtbColt, boolean flagForceUseRefs, RunnableArgs<List<MtbColr>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
var result = spostaArtsTraULSynchronized(sourceMtbColt, destMtbColt, flagForceUseRefs);
|
||||
if (onComplete != null) onComplete.run(result);
|
||||
} catch (Exception ex) {
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public MtbColt assegnaLottoSuColloScaricoSynchronized(MtbColt sourceMtbColt) throws Exception {
|
||||
MtbColt sourceMtbColtClone = (MtbColt) sourceMtbColt.clone();
|
||||
|
||||
for (int i = 0; i < sourceMtbColtClone.getMtbColr().size(); i++) {
|
||||
@@ -619,17 +664,20 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
}
|
||||
|
||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||
colliMagazzinoRESTConsumerService.assegnaLottoSuColloScarico(sourceMtbColtClone).enqueue(new ManagedErrorCallback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<MtbColt>> call, Response<ServiceRESTResponse<MtbColt>> response) {
|
||||
analyzeAnswer(response, "assegnaLottoSuColloScarico", data -> {
|
||||
onComplete.run();
|
||||
}, onFailed);
|
||||
}
|
||||
var response = colliMagazzinoRESTConsumerService.assegnaLottoSuColloScarico(sourceMtbColtClone)
|
||||
.execute();
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<MtbColt>> call, @NonNull final Exception e) {
|
||||
if (onFailed != null) onFailed.run(e);
|
||||
var data = analyzeAnswer(response, "assegnaLottoSuColloScarico");
|
||||
return data;
|
||||
}
|
||||
|
||||
public void assegnaLottoSuColloScarico(MtbColt sourceMtbColt, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
var result = assegnaLottoSuColloScaricoSynchronized(sourceMtbColt);
|
||||
if (onComplete != null) onComplete.run();
|
||||
} catch (Exception ex) {
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -735,42 +783,48 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
}
|
||||
|
||||
|
||||
public void canULBeDeleted(MtbColt mtbColt, RunnableArgs<Boolean> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public Boolean canULBeDeletedSynchronized(MtbColt mtbColt) throws Exception {
|
||||
CanULBeDeletedRequestDTO canULBeDeletedRequestDTO = new CanULBeDeletedRequestDTO()
|
||||
.setMtbColt(mtbColt);
|
||||
|
||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||
|
||||
colliMagazzinoRESTConsumerService.canULBeDeleted(canULBeDeletedRequestDTO)
|
||||
.enqueue(new ManagedErrorCallback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<Boolean>> call, Response<ServiceRESTResponse<Boolean>> response) {
|
||||
analyzeAnswer(response, "generic/canULBeDeleted", onComplete, onFailed);
|
||||
}
|
||||
var response = colliMagazzinoRESTConsumerService.canULBeDeleted(canULBeDeletedRequestDTO)
|
||||
.execute();
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<Boolean>> call, @NonNull final Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
var data = analyzeAnswer(response, "generic/canULBeDeleted");
|
||||
return data;
|
||||
}
|
||||
|
||||
public void canULBeDeleted(MtbColt mtbColt, RunnableArgs<Boolean> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
var result = canULBeDeletedSynchronized(mtbColt);
|
||||
if (onComplete != null) onComplete.run(result);
|
||||
} catch (Exception ex) {
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void deleteULSynchronized(DeleteULRequestDTO deleteULRequestDTO) throws Exception {
|
||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||
|
||||
var response = colliMagazzinoRESTConsumerService.deleteUL(deleteULRequestDTO)
|
||||
.execute();
|
||||
|
||||
analyzeAnswer(response, "generic/deleteUL");
|
||||
}
|
||||
|
||||
public void deleteUL(DeleteULRequestDTO deleteULRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||
|
||||
colliMagazzinoRESTConsumerService.deleteUL(deleteULRequestDTO)
|
||||
.enqueue(new ManagedErrorCallback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
|
||||
analyzeAnswer(response, "generic/deleteUL", Void -> onComplete.run(), onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
deleteULSynchronized(deleteULRequestDTO);
|
||||
if (onComplete != null) onComplete.run();
|
||||
} catch (Exception ex) {
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.core.rest.model.SpostaArtsTraULRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.SpostaArtsTraULResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.SpostaULRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.UpdatePosizioneULRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.UpdateTipoULRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.VersamentoAutomaticoULResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.CanULBeDeletedRequestDTO;
|
||||
@@ -37,6 +38,9 @@ public interface ColliMagazzinoRESTConsumerService {
|
||||
@POST("wms/updateTipoUL")
|
||||
Call<ServiceRESTResponse<Void>> updateTipoUL(@Body UpdateTipoULRequestDTO requestDto);
|
||||
|
||||
@POST("wms/updatePosizioneUL")
|
||||
Call<ServiceRESTResponse<Void>> updatePosizioneUL(@Body UpdatePosizioneULRequestDTO requestDto);
|
||||
|
||||
@POST("wms/spostaUL")
|
||||
Call<ServiceRESTResponse<Void>> spostaUL(@Body SpostaULRequestDTO requestDto);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package it.integry.integrywmsnative.core.rest.consumers;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
@@ -9,134 +9,152 @@ import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.interfaces.ColliScaricoRESTConsumerInterface;
|
||||
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
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.CreateUDSRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.DeleteUDSRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.DuplicateUDSRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.DuplicateUDSResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.EditUDSRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.EditUDSRowResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowResponseDTO;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Response;
|
||||
|
||||
@Singleton
|
||||
public class ColliSpedizioneRESTConsumer extends _BaseRESTConsumer implements ColliScaricoRESTConsumerInterface {
|
||||
|
||||
private final RESTBuilder restBuilder;
|
||||
private final ExecutorService executorService;
|
||||
|
||||
public ColliSpedizioneRESTConsumer(RESTBuilder restBuilder) {
|
||||
public ColliSpedizioneRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService) {
|
||||
this.restBuilder = restBuilder;
|
||||
this.executorService = executorService;
|
||||
}
|
||||
|
||||
public MtbColt createUDSSynchronized(CreateUDSRequestDTO createUDSRequestDTO) throws Exception {
|
||||
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = restBuilder.getService(ColliSpedizioneRESTConsumerService.class);
|
||||
|
||||
var response = colliSpedizioneRESTConsumerService.createUDS(createUDSRequestDTO)
|
||||
.execute();
|
||||
|
||||
var data = analyzeAnswer(response, "spedizione/createUDS");
|
||||
return data.getMtbColt();
|
||||
}
|
||||
|
||||
public void createUDS(CreateUDSRequestDTO createUDSRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
var response = createUDSSynchronized(createUDSRequestDTO);
|
||||
if (onComplete != null) onComplete.run(response);
|
||||
} catch (Exception ex) {
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public CloseUDSResponseDTO closeUDSSynchronized(CloseUDSRequestDTO closeUDSRequestDTO) throws Exception {
|
||||
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = restBuilder.getService(ColliSpedizioneRESTConsumerService.class);
|
||||
|
||||
colliSpedizioneRESTConsumerService.createUDS(createUDSRequestDTO)
|
||||
.enqueue(new ManagedErrorCallback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<CreateUDSResponseDTO>> call, Response<ServiceRESTResponse<CreateUDSResponseDTO>> response) {
|
||||
analyzeAnswer(response, "spedizione/createUDS", data -> onComplete.run(data.getMtbColt()), onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<CreateUDSResponseDTO>> call, @NonNull final Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
var response = colliSpedizioneRESTConsumerService.closeUDS(closeUDSRequestDTO)
|
||||
.execute();
|
||||
|
||||
var data = analyzeAnswer(response, "spedizione/closeUDS");
|
||||
return data;
|
||||
}
|
||||
|
||||
public void closeUDS(CloseUDSRequestDTO closeUDSRequestDTO, RunnableArgs<CloseUDSResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
var response = closeUDSSynchronized(closeUDSRequestDTO);
|
||||
if (onComplete != null) onComplete.run(response);
|
||||
} catch (Exception ex) {
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public MtbColr insertUDSRowSynchronized(InsertUDSRowRequestDTO insertUDSRowRequestDTO) throws Exception {
|
||||
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = restBuilder.getService(ColliSpedizioneRESTConsumerService.class);
|
||||
|
||||
colliSpedizioneRESTConsumerService.closeUDS(closeUDSRequestDTO)
|
||||
.enqueue(new ManagedErrorCallback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<CloseUDSResponseDTO>> call, Response<ServiceRESTResponse<CloseUDSResponseDTO>> response) {
|
||||
analyzeAnswer(response, "spedizione/closeUDS", onComplete, onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<CloseUDSResponseDTO>> call, @NonNull final Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
Response<ServiceRESTResponse<InsertUDSRowResponseDTO>> response = colliSpedizioneRESTConsumerService.insertUDSRow(insertUDSRowRequestDTO)
|
||||
.execute();
|
||||
|
||||
var data = analyzeAnswer(response, "spedizione/insertUDSRow");
|
||||
return data.getSavedMtbColr();
|
||||
}
|
||||
|
||||
public void insertUDSRow(InsertUDSRowRequestDTO insertUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
var response = insertUDSRowSynchronized(insertUDSRowRequestDTO);
|
||||
if (onComplete != null) onComplete.run(response);
|
||||
} catch (Exception ex) {
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public MtbColr editUDSRowSynchronized(EditUDSRowRequestDTO editUDSRowRequestDTO) throws Exception {
|
||||
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = restBuilder.getService(ColliSpedizioneRESTConsumerService.class);
|
||||
|
||||
colliSpedizioneRESTConsumerService.insertUDSRow(insertUDSRowRequestDTO)
|
||||
.enqueue(new ManagedErrorCallback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<InsertUDSRowResponseDTO>> call, Response<ServiceRESTResponse<InsertUDSRowResponseDTO>> response) {
|
||||
analyzeAnswer(response, "spedizione/insertUDSRow", data -> onComplete.run(data.getSavedMtbColr()), onFailed);
|
||||
}
|
||||
var response = colliSpedizioneRESTConsumerService.editUDSRow(editUDSRowRequestDTO)
|
||||
.execute();
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<InsertUDSRowResponseDTO>> call, @NonNull final Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
var data = analyzeAnswer(response, "spedizione/editUDSRow");
|
||||
return data.getSavedMtbColr();
|
||||
}
|
||||
|
||||
public void editUDSRow(EditUDSRowRequestDTO editUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
var response = editUDSRowSynchronized(editUDSRowRequestDTO);
|
||||
if (onComplete != null) onComplete.run(response);
|
||||
} catch (Exception ex) {
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void deleteUDSRowSynchronized(DeleteUDSRowRequestDTO deleteUDSRowRequestDTO) throws Exception {
|
||||
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = restBuilder.getService(ColliSpedizioneRESTConsumerService.class);
|
||||
|
||||
colliSpedizioneRESTConsumerService.editUDSRow(editUDSRowRequestDTO)
|
||||
.enqueue(new ManagedErrorCallback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<EditUDSRowResponseDTO>> call, Response<ServiceRESTResponse<EditUDSRowResponseDTO>> response) {
|
||||
analyzeAnswer(response, "spedizione/editUDSRow", data -> onComplete.run(data.getSavedMtbColr()), onFailed);
|
||||
}
|
||||
var response = colliSpedizioneRESTConsumerService.deleteUDSRow(deleteUDSRowRequestDTO)
|
||||
.execute();
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<EditUDSRowResponseDTO>> call, @NonNull final Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
analyzeAnswer(response, "spedizione/deleteUDSRow");
|
||||
}
|
||||
|
||||
public void deleteUDSRow(DeleteUDSRowRequestDTO deleteUDSRowRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
deleteUDSRowSynchronized(deleteUDSRowRequestDTO);
|
||||
if (onComplete != null) onComplete.run();
|
||||
} catch (Exception ex) {
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public DuplicateUDSResponseDTO duplicateUDSSynchronized(DuplicateUDSRequestDTO duplicateUDSRequestDTO) throws Exception {
|
||||
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = restBuilder.getService(ColliSpedizioneRESTConsumerService.class);
|
||||
|
||||
colliSpedizioneRESTConsumerService.deleteUDSRow(deleteUDSRowRequestDTO)
|
||||
.enqueue(new ManagedErrorCallback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
|
||||
analyzeAnswer(response, "spedizione/deleteUDSRow", data -> onComplete.run(), onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
var response = colliSpedizioneRESTConsumerService.duplicateUDS(duplicateUDSRequestDTO)
|
||||
.execute();
|
||||
|
||||
var data = analyzeAnswer(response, "spedizione/duplicateUDS");
|
||||
return data;
|
||||
}
|
||||
|
||||
public void duplicateUDS(DuplicateUDSRequestDTO duplicateUDSRequestDTO, RunnableArgs<DuplicateUDSResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = restBuilder.getService(ColliSpedizioneRESTConsumerService.class);
|
||||
|
||||
colliSpedizioneRESTConsumerService.duplicateUDS(duplicateUDSRequestDTO)
|
||||
.enqueue(new ManagedErrorCallback<>() {
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<ServiceRESTResponse<DuplicateUDSResponseDTO>> call, @NonNull Response<ServiceRESTResponse<DuplicateUDSResponseDTO>> response) {
|
||||
analyzeAnswer(response, "spedizione/duplicateUDS", onComplete, onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<ServiceRESTResponse<DuplicateUDSResponseDTO>> call, @NonNull final Exception e) {
|
||||
onFailed.run(new Exception());
|
||||
}
|
||||
});
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
var data = duplicateUDSSynchronized(duplicateUDSRequestDTO);
|
||||
if (onComplete != null) onComplete.run(data);
|
||||
} catch (Exception ex) {
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
@@ -18,34 +19,42 @@ import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
@Singleton
|
||||
public class CommessaRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
private final ExecutorService executorService;
|
||||
private final SystemRESTConsumer systemRESTConsumer;
|
||||
|
||||
public CommessaRESTConsumer(SystemRESTConsumer systemRESTConsumer) {
|
||||
public CommessaRESTConsumer(ExecutorService executorService, SystemRESTConsumer systemRESTConsumer) {
|
||||
this.executorService = executorService;
|
||||
this.systemRESTConsumer = systemRESTConsumer;
|
||||
}
|
||||
|
||||
|
||||
public void getJtbComts(List<String> itemsToFind, RunnableArgs<List<JtbComt>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
var whereCondMap = itemsToFind.stream()
|
||||
public List<JtbComt> getJtbComtsSynchronized(List<String> itemsToFind) throws Exception {
|
||||
List<HashMap<String, Object>> whereCondMap = itemsToFind.stream()
|
||||
.filter(x -> !UtilityString.isNullOrEmpty(x))
|
||||
.map(x -> {
|
||||
HashMap<String, Object> codJcom = new HashMap<>() {{
|
||||
put("cod_jcom", x);
|
||||
}};
|
||||
return codJcom;
|
||||
})
|
||||
.map(x -> new HashMap<String, Object>() {{
|
||||
put("cod_jcom", x);
|
||||
}})
|
||||
.collect(Collectors.toUnmodifiableList());
|
||||
|
||||
if(whereCondMap.isEmpty()) {
|
||||
onComplete.run(new ArrayList<>());
|
||||
return;
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
var whereCond = " WHERE " + UtilityQuery.concatFieldListInWhereCond(whereCondMap);
|
||||
|
||||
Type typeOfObjectsList = new TypeToken<ArrayList<JtbComt>>() {}.getType();
|
||||
this.systemRESTConsumer.processSql("SELECT * FROM jtb_comt " + whereCond, typeOfObjectsList, onComplete, onFailed);
|
||||
return this.systemRESTConsumer.processSqlSynchronized("SELECT * FROM jtb_comt " + whereCond, typeOfObjectsList);
|
||||
}
|
||||
|
||||
public void getJtbComts(List<String> itemsToFind, RunnableArgs<List<JtbComt>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
var data = getJtbComtsSynchronized(itemsToFind);
|
||||
if (onComplete != null) onComplete.run(data);
|
||||
} catch (Exception ex) {
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,26 +5,26 @@ import com.google.gson.reflect.TypeToken;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.model.MtbDepo;
|
||||
|
||||
@Singleton
|
||||
public class DepositoRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
private final EntityRESTConsumer entityRESTConsumer;
|
||||
private final ExecutorService executorService;
|
||||
private final SystemRESTConsumer systemRESTConsumer;
|
||||
|
||||
public DepositoRESTConsumer(EntityRESTConsumer entityRESTConsumer, SystemRESTConsumer systemRESTConsumer) {
|
||||
this.entityRESTConsumer = entityRESTConsumer;
|
||||
public DepositoRESTConsumer(ExecutorService executorService, SystemRESTConsumer systemRESTConsumer) {
|
||||
this.executorService = executorService;
|
||||
this.systemRESTConsumer = systemRESTConsumer;
|
||||
}
|
||||
|
||||
public void getAll(RunnableArgs<List<MtbDepo>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public List<MtbDepo> getAllSynchronized() throws Exception {
|
||||
Type typeOfObjectsList = new TypeToken<ArrayList<MtbDepo>>() {
|
||||
}.getType();
|
||||
this.systemRESTConsumer.processSql("SELECT * FROM mtb_depo", typeOfObjectsList, onComplete, onFailed);
|
||||
return this.systemRESTConsumer.processSqlSynchronized("SELECT * FROM mtb_depo", typeOfObjectsList);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.google.gson.JsonObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
@@ -26,100 +27,93 @@ import retrofit2.Response;
|
||||
public class EntityRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
private final RESTBuilder restBuilder;
|
||||
private final ExecutorService executorService;
|
||||
|
||||
public EntityRESTConsumer(RESTBuilder restBuilder) {
|
||||
public EntityRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService) {
|
||||
this.restBuilder = restBuilder;
|
||||
this.executorService = executorService;
|
||||
}
|
||||
|
||||
public <T extends EntityBase> T processEntitySynchronized(T entityToSave, Class<T> type) throws Exception {
|
||||
EntityRESTConsumerService service = restBuilder.getService(EntityRESTConsumerService.class);
|
||||
var response = service
|
||||
.processEntity(entityToSave)
|
||||
.execute();
|
||||
|
||||
if (response.isSuccessful()) {
|
||||
if (response.body() != null) {
|
||||
if (response.body().getEsito() == EsitoType.OK) {
|
||||
Gson gson = UtilityGson.createObject();
|
||||
|
||||
return gson.fromJson(response.body().getEntity(), type);
|
||||
} else {
|
||||
Log.e("EntityRESTConsumer", response.body().getErrorMessage());
|
||||
throw new Exception(response.body().getErrorMessage());
|
||||
}
|
||||
} else {
|
||||
Log.e("EntityRESTConsumer", response.message());
|
||||
throw new Exception(response.message());
|
||||
}
|
||||
} else {
|
||||
Log.e("EntityRESTConsumer", "Status " + response.code() + ": " + response.message());
|
||||
throw new Exception("Status " + response.code() + ": " + response.message());
|
||||
}
|
||||
}
|
||||
|
||||
public <T extends EntityBase> void processEntity(T entityToSave, final ISimpleOperationCallback<T> callback, Class<T> type) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
var data = processEntitySynchronized(entityToSave, type);
|
||||
if (callback != null) callback.onSuccess(data);
|
||||
} catch (Exception ex) {
|
||||
if (callback != null) callback.onFailed(ex);
|
||||
}
|
||||
});
|
||||
|
||||
RunnableArgs<Exception> tmpFailed = ex -> {
|
||||
if (callback != null) callback.onFailed(ex);
|
||||
};
|
||||
}
|
||||
|
||||
public <T extends EntityBase> List<T> processEntityListSynchronized(List<T> entitiesToSave, boolean singleTransaction, Class<T> type) throws Exception {
|
||||
EntityRESTConsumerService service = restBuilder.getService(EntityRESTConsumerService.class);
|
||||
service
|
||||
.processEntity(entityToSave)
|
||||
.enqueue(new ManagedErrorCallback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<JsonObject>> call, Response<ServiceRESTResponse<JsonObject>> response) {
|
||||
if (response.isSuccessful()) {
|
||||
var response = service.processEntityList(singleTransaction, entitiesToSave)
|
||||
.execute();
|
||||
|
||||
if (response.body() != null) {
|
||||
if (response.body().getEsito() == EsitoType.OK) {
|
||||
Gson gson = UtilityGson.createObject();
|
||||
T object = gson.fromJson(response.body().getEntity(), type);
|
||||
if (response.isSuccessful()) {
|
||||
|
||||
callback.onSuccess(object);
|
||||
} else {
|
||||
Log.e("EntityRESTConsumer", response.body().getErrorMessage());
|
||||
tmpFailed.run(new Exception(response.body().getErrorMessage()));
|
||||
}
|
||||
} else {
|
||||
Log.e("EntityRESTConsumer", response.message());
|
||||
tmpFailed.run(new Exception(response.message()));
|
||||
}
|
||||
} else {
|
||||
Log.e("EntityRESTConsumer", "Status " + response.code() + ": " + response.message());
|
||||
tmpFailed.run(new Exception("Status " + response.code() + ": " + response.message()));
|
||||
}
|
||||
if (response.body() != null) {
|
||||
|
||||
ArrayList<T> responseList = new ArrayList<>();
|
||||
Gson gson = UtilityGson.createObject();
|
||||
|
||||
for (ServiceRESTResponse<JsonObject> jsonSingleObject : response.body()) {
|
||||
|
||||
if (jsonSingleObject.getEsito() == EsitoType.OK) {
|
||||
String jsonText = gson.toJson(jsonSingleObject.getEntity());
|
||||
responseList.add(gson.fromJson(jsonText, type));
|
||||
} else {
|
||||
Log.e("EntityRESTConsumer", jsonSingleObject.getErrorMessage());
|
||||
throw new Exception(jsonSingleObject.getErrorMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<JsonObject>> call, @NonNull final Exception e) {
|
||||
tmpFailed.run(e);
|
||||
}
|
||||
});
|
||||
return responseList;
|
||||
} else {
|
||||
Log.e("EntityRESTConsumer", response.message());
|
||||
throw new Exception(response.message());
|
||||
}
|
||||
} else {
|
||||
Log.e("EntityRESTConsumer", "Status " + response.code() + ": " + response.message());
|
||||
throw new Exception("Status " + response.code() + ": " + response.message());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public <T extends EntityBase> void processEntityList(List<T> entitiesToSave, boolean singleTransaction, Class<T> type, final RunnableArgs<List<T>> onComplete, final RunnableArgs<Exception> onFailed) {
|
||||
|
||||
RunnableArgs<Exception> tmpFailed = ex -> {
|
||||
// UtilityExceptions.defaultException(null, ex);
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
};
|
||||
|
||||
EntityRESTConsumerService service = restBuilder.getService(EntityRESTConsumerService.class);
|
||||
Call<List<ServiceRESTResponse<JsonObject>>> request = service.processEntityList(singleTransaction, entitiesToSave);
|
||||
request.enqueue(new ManagedErrorCallback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<List<ServiceRESTResponse<JsonObject>>> call, Response<List<ServiceRESTResponse<JsonObject>>> response) {
|
||||
if (response.isSuccessful()) {
|
||||
|
||||
if (response.body() != null) {
|
||||
|
||||
ArrayList<T> responseList = new ArrayList<>();
|
||||
Gson gson = UtilityGson.createObject();
|
||||
// Type typeOfObjectsList = new TypeToken<T>() {}.getType();
|
||||
|
||||
for (ServiceRESTResponse<JsonObject> jsonSingleObject : response.body()) {
|
||||
|
||||
if (jsonSingleObject.getEsito() == EsitoType.OK) {
|
||||
String jsonText = gson.toJson(jsonSingleObject.getEntity());
|
||||
responseList.add(gson.fromJson(jsonText, type));
|
||||
} else {
|
||||
Log.e("EntityRESTConsumer", jsonSingleObject.getErrorMessage());
|
||||
tmpFailed.run(new Exception(jsonSingleObject.getErrorMessage()));
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
onComplete.run(responseList);
|
||||
} else {
|
||||
Log.e("EntityRESTConsumer", response.message());
|
||||
tmpFailed.run(new Exception(response.message()));
|
||||
}
|
||||
} else {
|
||||
Log.e("EntityRESTConsumer", "Status " + response.code() + ": " + response.message());
|
||||
tmpFailed.run(new Exception("Status " + response.code() + ": " + response.message()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<List<ServiceRESTResponse<JsonObject>>> call, @NonNull final Exception e) {
|
||||
tmpFailed.run(e);
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
var data = processEntityListSynchronized(entitiesToSave, singleTransaction, type);
|
||||
if (onComplete != null) onComplete.run(data);
|
||||
} catch (Exception ex) {
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -79,32 +79,22 @@ public class GestSetupRESTConsumer extends _BaseRESTConsumer {
|
||||
}
|
||||
|
||||
|
||||
public void getValues(String codMdep, List<StbGestSetupReader> stbGestSetupList, RunnableArgs<List<StbGestSetupReader>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public List<StbGestSetupReader> getValuesSynchronized(String codMdep, List<StbGestSetupReader> stbGestSetupList) throws Exception {
|
||||
var stbGestSetups = stbGestSetupList.stream().map(x -> (StbGestSetup) x).collect(Collectors.toList());
|
||||
|
||||
GestSetupRESTConsumerService service = restBuilder.getService(GestSetupRESTConsumerService.class);
|
||||
service.getGestSetupValues(codMdep, stbGestSetups).enqueue(new ManagedErrorCallback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<List<StbGestSetup>>> call, Response<ServiceRESTResponse<List<StbGestSetup>>> response) {
|
||||
analyzeAnswer(response, "GestSetup", data -> {
|
||||
var response = service.getGestSetupValues(codMdep, stbGestSetups)
|
||||
.execute();
|
||||
var data = analyzeAnswer(response, "GestSetup");
|
||||
for (StbGestSetup stbGestSetup : data) {
|
||||
stbGestSetupList.stream().filter(x -> stbGestSetup.getGestName().equalsIgnoreCase(x.getGestName()) &&
|
||||
stbGestSetup.getSection().equalsIgnoreCase(x.getSection()) &&
|
||||
stbGestSetup.getKeySection().equalsIgnoreCase(x.getKeySection()))
|
||||
.findFirst()
|
||||
.ifPresent(x -> x.setValue(stbGestSetup.getValue()));
|
||||
}
|
||||
|
||||
for (StbGestSetup stbGestSetup : data) {
|
||||
stbGestSetupList.stream().filter(x -> stbGestSetup.getGestName().equalsIgnoreCase(x.getGestName()) &&
|
||||
stbGestSetup.getSection().equalsIgnoreCase(x.getSection()) &&
|
||||
stbGestSetup.getKeySection().equalsIgnoreCase(x.getKeySection()))
|
||||
.findFirst()
|
||||
.ifPresent(x -> x.setValue(stbGestSetup.getValue()));
|
||||
}
|
||||
|
||||
onComplete.run(stbGestSetupList);
|
||||
}, onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<List<StbGestSetup>>> call, @NonNull final Exception e) {
|
||||
if (onFailed != null) onFailed.run(e);
|
||||
}
|
||||
});
|
||||
return stbGestSetupList;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import retrofit2.http.Query;
|
||||
|
||||
public interface GiacenzaPvRESTConsumerService {
|
||||
|
||||
@GET("giacenza/retrieve")
|
||||
@GET("wms/pv/verifica_giacenze/retrieve")
|
||||
Call<ServiceRESTResponse<List<GiacenzaPvDTO>>> retrieve(@Query("codMdep") String codMdep);
|
||||
|
||||
|
||||
|
||||
@@ -169,27 +169,28 @@ public class GiacenzaRESTConsumer extends _BaseRESTConsumer {
|
||||
}
|
||||
|
||||
|
||||
public void getInstantItemSituation(String codMdep, String codMart, String partitaMag, String codJcom, RunnableArgs<InstantItemSituationResponseDto> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public InstantItemSituationResponseDto getInstantItemSituationSynchronized(String codMdep, String codMart, String partitaMag, String codJcom) throws Exception {
|
||||
GiacenzaRESTConsumerService giacenzaRESTConsumerService = restBuilder.getService(GiacenzaRESTConsumerService.class);
|
||||
|
||||
giacenzaRESTConsumerService.retrieveInstantItemSituation(codMdep, codMart, partitaMag, codJcom)
|
||||
.enqueue(new ManagedErrorCallback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<InstantItemSituationResponseDto>> call, Response<ServiceRESTResponse<InstantItemSituationResponseDto>> response) {
|
||||
analyzeAnswer(response, "getInstantItemSituation", data -> {
|
||||
var response = giacenzaRESTConsumerService.retrieveInstantItemSituation(codMdep, codMart, partitaMag, codJcom)
|
||||
.execute();
|
||||
|
||||
fillInstantItemSituationWithMtbAarts(data, onComplete, onFailed);
|
||||
}, onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<InstantItemSituationResponseDto>> call, @NonNull final Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
var data = analyzeAnswer(response, "getInstantItemSituation");
|
||||
return fillInstantItemSituationWithMtbAartsSynchronized(data);
|
||||
}
|
||||
|
||||
private void fillInstantItemSituationWithMtbAarts(InstantItemSituationResponseDto data, RunnableArgs<InstantItemSituationResponseDto> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public void getInstantItemSituation(String codMdep, String codMart, String partitaMag, String codJcom, RunnableArgs<InstantItemSituationResponseDto> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
var response = getInstantItemSituationSynchronized(codMdep, codMart, partitaMag, codJcom);
|
||||
if (onComplete != null) onComplete.run(response);
|
||||
} catch (Exception ex) {
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private InstantItemSituationResponseDto fillInstantItemSituationWithMtbAartsSynchronized(InstantItemSituationResponseDto data) throws Exception {
|
||||
var inputCodMarts = new ArrayList<String>();
|
||||
|
||||
if (data.getIncomingItems() != null && !data.getIncomingItems().isEmpty()) {
|
||||
@@ -205,37 +206,33 @@ public class GiacenzaRESTConsumer extends _BaseRESTConsumer {
|
||||
}
|
||||
|
||||
if (inputCodMarts.isEmpty()) {
|
||||
onComplete.run(data);
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
mArticoloRESTConsumer.getByCodMarts(inputCodMarts, mtbAarts -> {
|
||||
var mtbAarts = mArticoloRESTConsumer.getByCodMartsSynchronized(inputCodMarts);
|
||||
var newMtbAarts = mArticoloRESTConsumer.fillMtbAartsWithMtbUntMisSynchronized(mtbAarts);
|
||||
|
||||
mArticoloRESTConsumer.fillMtbAartsWithMtbUntMis(mtbAarts, newMtbAarts -> {
|
||||
if (data.getIncomingItems() != null && !data.getIncomingItems().isEmpty()) {
|
||||
for (var item : data.getIncomingItems()) {
|
||||
var mtbAart = Stream.of(newMtbAarts).filter(x -> x.getCodMart().equalsIgnoreCase(item.getCodMart()))
|
||||
.findFirstOrElse(null);
|
||||
if (data.getIncomingItems() != null && !data.getIncomingItems().isEmpty()) {
|
||||
for (var item : data.getIncomingItems()) {
|
||||
var mtbAart = Stream.of(newMtbAarts).filter(x -> x.getCodMart().equalsIgnoreCase(item.getCodMart()))
|
||||
.findFirstOrElse(null);
|
||||
|
||||
if (mtbAart != null)
|
||||
item.setMtbAart(mtbAart);
|
||||
}
|
||||
}
|
||||
if (mtbAart != null)
|
||||
item.setMtbAart(mtbAart);
|
||||
}
|
||||
}
|
||||
|
||||
if (data.getAvailableItems() != null && !data.getAvailableItems().isEmpty()) {
|
||||
for (var item : data.getAvailableItems()) {
|
||||
var mtbAart = Stream.of(newMtbAarts).filter(x -> x.getCodMart().equalsIgnoreCase(item.getCodMart()))
|
||||
.findFirstOrElse(null);
|
||||
if (data.getAvailableItems() != null && !data.getAvailableItems().isEmpty()) {
|
||||
for (var item : data.getAvailableItems()) {
|
||||
var mtbAart = Stream.of(newMtbAarts).filter(x -> x.getCodMart().equalsIgnoreCase(item.getCodMart()))
|
||||
.findFirstOrElse(null);
|
||||
|
||||
if (mtbAart != null)
|
||||
item.setMtbAart(mtbAart);
|
||||
}
|
||||
}
|
||||
if (mtbAart != null)
|
||||
item.setMtbAart(mtbAart);
|
||||
}
|
||||
}
|
||||
|
||||
onComplete.run(data);
|
||||
}, onFailed);
|
||||
|
||||
}, onFailed);
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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;
|
||||
@@ -18,26 +20,31 @@ import retrofit2.Response;
|
||||
public class MagazzinoAutomaticoRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
|
||||
private final ExecutorService executorService;
|
||||
private final RESTBuilder restBuilder;
|
||||
|
||||
public MagazzinoAutomaticoRESTConsumer(RESTBuilder restBuilder) {
|
||||
public MagazzinoAutomaticoRESTConsumer(ExecutorService executorService, RESTBuilder restBuilder) {
|
||||
this.executorService = executorService;
|
||||
this.restBuilder = restBuilder;
|
||||
}
|
||||
|
||||
public void pickItems(MtbDepoPosizione posizione, MagazzinoAutomaticoPickItemsRequestDTO magazzinoAutomaticoPickItemsRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public void pickItemsSynchronized(MtbDepoPosizione posizione, MagazzinoAutomaticoPickItemsRequestDTO magazzinoAutomaticoPickItemsRequestDTO) throws Exception {
|
||||
MagazzinoAutomaticoRESTConsumerService magazzinoAutomaticoRESTConsumerService = restBuilder.getService(MagazzinoAutomaticoRESTConsumerService.class);
|
||||
magazzinoAutomaticoRESTConsumerService.pickItems(posizione.getPosizione(), magazzinoAutomaticoPickItemsRequestDTO)
|
||||
.enqueue(new ManagedErrorCallback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
|
||||
analyzeAnswer(response, "magazzino-automatico/pickItems", data -> onComplete.run(), onFailed);
|
||||
}
|
||||
var response = magazzinoAutomaticoRESTConsumerService.pickItems(posizione.getPosizione(), magazzinoAutomaticoPickItemsRequestDTO)
|
||||
.execute();
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
analyzeAnswer(response, "magazzino-automatico/pickItems");
|
||||
}
|
||||
|
||||
public void pickItems(MtbDepoPosizione posizione, MagazzinoAutomaticoPickItemsRequestDTO magazzinoAutomaticoPickItemsRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
pickItemsSynchronized(posizione, magazzinoAutomaticoPickItemsRequestDTO);
|
||||
if (onComplete != null) onComplete.run();
|
||||
} catch (Exception ex) {
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
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;
|
||||
|
||||
@Singleton
|
||||
public class MaterialiRESTConsumer extends _BaseRESTConsumer {
|
||||
@@ -43,4 +44,27 @@ public class MaterialiRESTConsumer extends _BaseRESTConsumer {
|
||||
});
|
||||
}
|
||||
|
||||
public void makeSynchronousVersaRequest(VersaMaterialiRequestDTO request) throws Exception {
|
||||
var materialiRESTConsumerService = restBuilder.getService(MaterialiRESTConsumerService.class);
|
||||
|
||||
var response = materialiRESTConsumerService.versa(request)
|
||||
.execute();
|
||||
|
||||
|
||||
var data = analyzeAnswer(response, "versaMateriali");
|
||||
// if (data == null) return null;
|
||||
// return data.getUpdatedMtbColtScarico();
|
||||
}
|
||||
|
||||
public void makeVersaRequest(VersaMaterialiRequestDTO request, final Runnable onComplete, final RunnableArgs<Exception> onFailed) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
makeSynchronousVersaRequest(request);
|
||||
if (onComplete != null) onComplete.run();
|
||||
} catch (Exception ex) {
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,12 +3,16 @@ package it.integry.integrywmsnative.core.rest.consumers;
|
||||
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 retrofit2.Call;
|
||||
import retrofit2.http.Body;
|
||||
import retrofit2.http.POST;
|
||||
|
||||
public interface MaterialiRESTConsumerService {
|
||||
|
||||
@POST("wms/materiali/versa")
|
||||
Call<ServiceRESTResponse<RecuperaMaterialiResponseDTO>> versa(@Body VersaMaterialiRequestDTO request);
|
||||
|
||||
@POST("wms/materiali/recupera")
|
||||
Call<ServiceRESTResponse<RecuperaMaterialiResponseDTO>> recupera(@Body RecuperaMaterialiRequestDTO request);
|
||||
|
||||
|
||||
@@ -4,14 +4,11 @@ import androidx.annotation.NonNull;
|
||||
|
||||
import com.annimon.stream.Optional;
|
||||
import com.annimon.stream.Stream;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.orhanobut.logger.Logger;
|
||||
|
||||
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;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
@@ -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;
|
||||
@@ -39,12 +36,14 @@ import retrofit2.Response;
|
||||
public class OrdiniRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
private final RESTBuilder restBuilder;
|
||||
private final ExecutorService executorService;
|
||||
|
||||
private final SystemRESTConsumer mSystemRESTConsumer;
|
||||
private final EntityRESTConsumer mEntityRESTConsumer;
|
||||
|
||||
public OrdiniRESTConsumer(RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer, EntityRESTConsumer entityRESTConsumer) {
|
||||
public OrdiniRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService,SystemRESTConsumer systemRESTConsumer, EntityRESTConsumer entityRESTConsumer) {
|
||||
this.restBuilder = restBuilder;
|
||||
this.executorService = executorService;
|
||||
this.mSystemRESTConsumer = systemRESTConsumer;
|
||||
this.mEntityRESTConsumer = entityRESTConsumer;
|
||||
}
|
||||
@@ -61,7 +60,7 @@ public class OrdiniRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
for (PickingObjectDTO pickingObjectDTO : pickingObjects) {
|
||||
for (MtbColt mtbColt : pickingObjectDTO.getMtbColts()) {
|
||||
Stream.of(mtbColt.getMtbColr())
|
||||
mtbColt.getMtbColr().stream()
|
||||
.filter(x -> !UtilityString.isNullOrEmpty(x.getPartitaMag()))
|
||||
.forEach(x -> {
|
||||
|
||||
@@ -125,28 +124,24 @@ public class OrdiniRESTConsumer extends _BaseRESTConsumer {
|
||||
this.mEntityRESTConsumer.processEntityList(partitaMag, true, MtbPartitaMag.class, onComplete, onFailed);
|
||||
}
|
||||
|
||||
public void getOrdiniInevasi(String codMdep, GestioneEnum gestione, RunnableArgs<List<OrdineUscitaInevasoDTO>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
public List<OrdineUscitaInevasoDTO> getOrdiniInevasiSynchronized(String codMdep, GestioneEnum gestione) throws Exception {
|
||||
OrdiniRESTConsumerService service = restBuilder.getService(OrdiniRESTConsumerService.class);
|
||||
|
||||
service.getOrdiniInevasi(codMdep, gestione.getText())
|
||||
.enqueue(new ManagedErrorCallback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<List<OrdineUscitaInevasoDTO>>> call, Response<ServiceRESTResponse<List<OrdineUscitaInevasoDTO>>> response) {
|
||||
analyzeAnswer(response, "getOrdiniInevasi", responseDtoList -> {
|
||||
if (responseDtoList == null) responseDtoList = new ArrayList<>();
|
||||
onComplete.run(responseDtoList);
|
||||
}, ex -> {
|
||||
Logger.e(ex, "Errore durante il caricamento degli ordini di lavorazione");
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
});
|
||||
}
|
||||
var response = service.getOrdiniInevasi(codMdep, gestione.getText())
|
||||
.execute();
|
||||
var data = analyzeAnswer(response, "getOrdiniInevasi");
|
||||
return data == null ? new ArrayList<>() : data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<List<OrdineUscitaInevasoDTO>>> call, @NonNull final Exception e) {
|
||||
if (onFailed != null) onFailed.run(e);
|
||||
}
|
||||
});
|
||||
public void getOrdiniInevasi(String codMdep, GestioneEnum gestione, RunnableArgs<List<OrdineUscitaInevasoDTO>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
var result = getOrdiniInevasiSynchronized(codMdep, gestione);
|
||||
if (onComplete != null) onComplete.run(result);
|
||||
} catch (Exception ex) {
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void retrieveListaArticoliFromOrdiniUscita(String codMdep, List<OrdineUscitaInevasoDTO> orders, RunnableArgs<List<SitArtOrdDTO>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
@@ -182,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);
|
||||
}
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
package it.integry.integrywmsnative.core.rest.consumers;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
@@ -14,44 +13,33 @@ import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
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.utility.UtilityDB;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Response;
|
||||
|
||||
@Singleton
|
||||
public class PosizioniRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
private final RESTBuilder restBuilder;
|
||||
private final SystemRESTConsumer mSystemRESTConsumer;
|
||||
private final ExecutorService executorService;
|
||||
|
||||
public PosizioniRESTConsumer(RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer) {
|
||||
public PosizioniRESTConsumer(RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer, ExecutorService executorService) {
|
||||
this.restBuilder = restBuilder;
|
||||
this.mSystemRESTConsumer = systemRESTConsumer;
|
||||
this.executorService = executorService;
|
||||
}
|
||||
|
||||
public void getAvailablePosizioni(RunnableArgs<List<MtbDepoPosizione>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public List<MtbDepoPosizione> getAvailablePosizioniSynchronized() throws Exception {
|
||||
String codMdep = null;
|
||||
|
||||
PosizioniRESTConsumerService posizioniRESTConsumerService = restBuilder.getService(PosizioniRESTConsumerService.class);
|
||||
posizioniRESTConsumerService.getAvailablePosizioni(codMdep).enqueue(new ManagedErrorCallback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<List<MtbDepoPosizione>>> call, Response<ServiceRESTResponse<List<MtbDepoPosizione>>> response) {
|
||||
analyzeAnswer(response, "getAvailablePosizioni", (m) -> {
|
||||
onComplete.run(response.body().getDto());
|
||||
}, onFailed);
|
||||
}
|
||||
var response = posizioniRESTConsumerService.getAvailablePosizioni(codMdep)
|
||||
.execute();
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<List<MtbDepoPosizione>>> call, @NonNull final Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
var data = analyzeAnswer(response, "getAvailablePosizioni");
|
||||
return response.body().getDto();
|
||||
}
|
||||
|
||||
|
||||
public void getBancaliInPosizione(MtbDepoPosizione mtbDepoPosizione, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public ArrayList<MtbColt> getBancaliInPosizioneSynchronized(MtbDepoPosizione mtbDepoPosizione) throws Exception {
|
||||
String sql = "SELECT * FROM mtb_colt " +
|
||||
"WHERE segno > 0 " +
|
||||
"AND cod_mdep = " + UtilityDB.valueToString(mtbDepoPosizione.getCodMdep()) + " " +
|
||||
@@ -61,10 +49,18 @@ public class PosizioniRESTConsumer extends _BaseRESTConsumer {
|
||||
Type typeOfObjectsList = new TypeToken<ArrayList<MtbColt>>() {
|
||||
}.getType();
|
||||
|
||||
mSystemRESTConsumer.<ArrayList<MtbColt>>processSql(sql, typeOfObjectsList, value -> {
|
||||
if (onComplete != null) onComplete.run(value);
|
||||
}, ex -> {
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
var value = mSystemRESTConsumer.<ArrayList<MtbColt>>processSqlSynchronized(sql, typeOfObjectsList);
|
||||
return value;
|
||||
}
|
||||
|
||||
public void getBancaliInPosizione(MtbDepoPosizione mtbDepoPosizione, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
var result = getBancaliInPosizioneSynchronized(mtbDepoPosizione);
|
||||
if (onComplete != null) onComplete.run(result);
|
||||
} catch (Exception ex) {
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@@ -123,27 +123,15 @@ public class PrinterRESTConsumer extends _BaseRESTConsumer {
|
||||
printReportType(reportType, codMdep, null, params, onComplete, onFailed);
|
||||
}
|
||||
|
||||
public void printClosedOrders(PrintOrderCloseDTO dto, String codMdep, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public void printClosedOrdersSynchronized(PrintOrderCloseDTO dto, String codMdep) throws Exception {
|
||||
if (BuildConfig.DEBUG) {
|
||||
onComplete.run();
|
||||
return;
|
||||
// return;
|
||||
}
|
||||
|
||||
PrinterRESTConsumerService printerService = restBuilder.getService(PrinterRESTConsumerService.class, 240);
|
||||
Call<ServiceRESTResponse<Object>> callable = printerService.printClosedOrders(codMdep, dto);
|
||||
callable.enqueue(new ManagedErrorCallback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) {
|
||||
analyzeAnswer(response, "printCollo", data -> {
|
||||
onComplete.run();
|
||||
}, onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<Object>> call, @NonNull final Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
var response = printerService.printClosedOrders(codMdep, dto).execute();
|
||||
analyzeAnswer(response, "printCollo");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -89,6 +89,11 @@ public class SystemRESTConsumer extends _BaseRESTConsumer {
|
||||
});
|
||||
}
|
||||
|
||||
public List<AvailableCodMdepsDTO> 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) {
|
||||
SystemRESTConsumerService service = restBuilder.getService(SystemRESTConsumerService.class);
|
||||
|
||||
@@ -12,13 +12,23 @@ import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowRequestDTO;
|
||||
|
||||
public interface ColliScaricoRESTConsumerInterface {
|
||||
|
||||
MtbColt createUDSSynchronized(CreateUDSRequestDTO createUDSRequestDTO) throws Exception;
|
||||
|
||||
void createUDS(CreateUDSRequestDTO createUDSRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed);
|
||||
|
||||
CloseUDSResponseDTO closeUDSSynchronized(CloseUDSRequestDTO closeUDSRequestDTO) throws Exception;
|
||||
|
||||
void closeUDS(CloseUDSRequestDTO closeUDSRequestDTO, RunnableArgs<CloseUDSResponseDTO> onComplete, RunnableArgs<Exception> onFailed);
|
||||
|
||||
MtbColr insertUDSRowSynchronized(InsertUDSRowRequestDTO insertUDSRowRequestDTO) throws Exception;
|
||||
|
||||
void insertUDSRow(InsertUDSRowRequestDTO insertUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed);
|
||||
|
||||
MtbColr editUDSRowSynchronized(EditUDSRowRequestDTO editUDSRowRequestDTO) throws Exception;
|
||||
|
||||
void editUDSRow(EditUDSRowRequestDTO editUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed);
|
||||
|
||||
void deleteUDSRowSynchronized(DeleteUDSRowRequestDTO deleteUDSRequestDTO) throws Exception;
|
||||
|
||||
void deleteUDSRow(DeleteUDSRowRequestDTO deleteUDSRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package it.integry.integrywmsnative.core.rest.deserializer;
|
||||
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import com.google.gson.JsonDeserializationContext;
|
||||
import com.google.gson.JsonDeserializer;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonParseException;
|
||||
|
||||
import java.lang.reflect.ParameterizedType;
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
public class MutableLiveDataDeserializer implements JsonDeserializer<MutableLiveData<?>> {
|
||||
@Override
|
||||
public MutableLiveData<?> deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
|
||||
Type type = ((ParameterizedType) typeOfT).getActualTypeArguments()[0];
|
||||
MutableLiveData<Object> liveData = new MutableLiveData<>();
|
||||
liveData.setValue(context.deserialize(json, type));
|
||||
return liveData;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package it.integry.integrywmsnative.core.rest.model;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
|
||||
public class UpdatePosizioneULRequestDTO {
|
||||
|
||||
private MtbColt mtbColt;
|
||||
private String posizione;
|
||||
|
||||
public MtbColt getMtbColt() {
|
||||
return mtbColt;
|
||||
}
|
||||
|
||||
public UpdatePosizioneULRequestDTO setMtbColt(MtbColt mtbColt) {
|
||||
this.mtbColt = mtbColt;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPosizione() {
|
||||
return posizione;
|
||||
}
|
||||
|
||||
public UpdatePosizioneULRequestDTO setPosizione(String posizione) {
|
||||
this.posizione = posizione;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
package it.integry.integrywmsnative.core.rest.model.materiali;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
|
||||
public class VersaMaterialiRequestDTO {
|
||||
|
||||
private String codMart;
|
||||
private String partitaMag;
|
||||
private BigDecimal numCnf;
|
||||
private BigDecimal qtaCnf;
|
||||
private BigDecimal qtaTot;
|
||||
|
||||
private Integer numCollo;
|
||||
private LocalDate dataCollo;
|
||||
private String gestione;
|
||||
private String serCollo;
|
||||
private String barcodeUl;
|
||||
|
||||
|
||||
public String getCodMart() {
|
||||
return codMart;
|
||||
}
|
||||
|
||||
public VersaMaterialiRequestDTO setCodMart(String codMart) {
|
||||
this.codMart = codMart;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPartitaMag() {
|
||||
return partitaMag;
|
||||
}
|
||||
|
||||
public VersaMaterialiRequestDTO setPartitaMag(String partitaMag) {
|
||||
this.partitaMag = partitaMag;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getNumCnf() {
|
||||
return numCnf;
|
||||
}
|
||||
|
||||
public VersaMaterialiRequestDTO setNumCnf(BigDecimal numCnf) {
|
||||
this.numCnf = numCnf;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getQtaCnf() {
|
||||
return qtaCnf;
|
||||
}
|
||||
|
||||
public VersaMaterialiRequestDTO setQtaCnf(BigDecimal qtaCnf) {
|
||||
this.qtaCnf = qtaCnf;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getQtaTot() {
|
||||
return qtaTot;
|
||||
}
|
||||
|
||||
public VersaMaterialiRequestDTO setQtaTot(BigDecimal qtaTot) {
|
||||
this.qtaTot = qtaTot;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getNumCollo() {
|
||||
return numCollo;
|
||||
}
|
||||
|
||||
public VersaMaterialiRequestDTO setNumCollo(Integer numCollo) {
|
||||
this.numCollo = numCollo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public LocalDate getDataCollo() {
|
||||
return dataCollo;
|
||||
}
|
||||
|
||||
public VersaMaterialiRequestDTO setDataCollo(LocalDate dataCollo) {
|
||||
this.dataCollo = dataCollo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getGestione() {
|
||||
return gestione;
|
||||
}
|
||||
|
||||
public VersaMaterialiRequestDTO setGestione(String gestione) {
|
||||
this.gestione = gestione;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getSerCollo() {
|
||||
return serCollo;
|
||||
}
|
||||
|
||||
public VersaMaterialiRequestDTO setSerCollo(String serCollo) {
|
||||
this.serCollo = serCollo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getBarcodeUl() {
|
||||
return barcodeUl;
|
||||
}
|
||||
|
||||
public VersaMaterialiRequestDTO setBarcodeUl(String barcodeUl) {
|
||||
this.barcodeUl = barcodeUl;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package it.integry.integrywmsnative.core.rest.model.materiali;
|
||||
|
||||
public class VersaMaterialiResponseDTO {
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package it.integry.integrywmsnative.core.rest.serializer;
|
||||
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonSerializationContext;
|
||||
import com.google.gson.JsonSerializer;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
public class MutableLiveDataSerializer implements JsonSerializer<MutableLiveData<?>> {
|
||||
@Override
|
||||
public JsonElement serialize(MutableLiveData<?> src, Type typeOfSrc, JsonSerializationContext context) {
|
||||
return context.serialize(src.getValue());
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,11 @@ import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
|
||||
public class ServerStatusChecker {
|
||||
|
||||
private static final ServerStatusChecker instance = new ServerStatusChecker();
|
||||
|
||||
private final Handler handler;
|
||||
|
||||
|
||||
|
||||
|
||||
private final List<RunnableArgs<Boolean>> mCallback = new ArrayList<>();
|
||||
|
||||
@@ -26,7 +30,29 @@ public class ServerStatusChecker {
|
||||
private final long MILLIS_DELAY = 5 * 1000;
|
||||
|
||||
|
||||
private final Handler handler = new Handler();
|
||||
public ServerStatusChecker(Handler handler) {
|
||||
this.handler = handler;
|
||||
}
|
||||
|
||||
public void addCallback(RunnableArgs<Boolean> callback) {
|
||||
this.mCallback.add(callback);
|
||||
}
|
||||
|
||||
public void removeCallback(RunnableArgs<Boolean> callback) {
|
||||
this.mCallback.remove(callback);
|
||||
}
|
||||
|
||||
|
||||
public void init() {
|
||||
this.shouldExecute = true;
|
||||
|
||||
this.handler.post(this.runnableCode);
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
this.shouldExecute = false;
|
||||
}
|
||||
|
||||
private final Runnable runnableCode = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -42,27 +68,4 @@ public class ServerStatusChecker {
|
||||
}
|
||||
};
|
||||
|
||||
public void addCallback(RunnableArgs<Boolean> callback) {
|
||||
this.mCallback.add(callback);
|
||||
}
|
||||
|
||||
public void removeCallback(RunnableArgs<Boolean> callback) {
|
||||
this.mCallback.remove(callback);
|
||||
}
|
||||
|
||||
|
||||
public static void init() {
|
||||
instance.shouldExecute = true;
|
||||
|
||||
instance.handler.post(instance.runnableCode);
|
||||
}
|
||||
|
||||
public static void dispose() {
|
||||
instance.shouldExecute = false;
|
||||
}
|
||||
|
||||
public static ServerStatusChecker getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -96,6 +96,8 @@ public class DBSettingsModel {
|
||||
private boolean flagEnableArtCreation;
|
||||
private List<String> allowedCodMgrpForArtCreation;
|
||||
private boolean flagAccettazioneGroupListForn = false;
|
||||
private boolean flagSpedizioneEnableFastPicking = false;
|
||||
private boolean flagAccettazioneBollaEditableQtaTot = true;
|
||||
|
||||
public boolean isFlagSpedizioneEnableFakeGiacenza() {
|
||||
return flagSpedizioneEnableFakeGiacenza;
|
||||
@@ -806,4 +808,20 @@ public class DBSettingsModel {
|
||||
public void setFlagAccettazioneGroupListForn(boolean flagAccettazioneGroupListForn) {
|
||||
this.flagAccettazioneGroupListForn = flagAccettazioneGroupListForn;
|
||||
}
|
||||
|
||||
public boolean isFlagSpedizioneEnableFastPicking() {
|
||||
return flagSpedizioneEnableFastPicking;
|
||||
}
|
||||
|
||||
public void setFlagSpedizioneEnableFastPicking(boolean flagSpedizioneEnableFastPicking) {
|
||||
this.flagSpedizioneEnableFastPicking = flagSpedizioneEnableFastPicking;
|
||||
}
|
||||
|
||||
public boolean isFlagAccettazioneBollaEditableQtaTot() {
|
||||
return flagAccettazioneBollaEditableQtaTot;
|
||||
}
|
||||
|
||||
public void setFlagAccettazioneBollaEditableQtaTot(boolean flagAccettazioneBollaEditableQtaTot) {
|
||||
this.flagAccettazioneBollaEditableQtaTot = flagAccettazioneBollaEditableQtaTot;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,136 +102,111 @@ public class SettingsManager {
|
||||
}
|
||||
|
||||
|
||||
public static void loadDBVariables(RunnableArgs<String> onProgress, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public static void loadDBVariables(RunnableArgs<String> onProgress) throws Exception {
|
||||
dbSettingsModelIstance = new DBSettingsModel();
|
||||
|
||||
Trace perfTrace = UtilityFirebase.getNewPerformanceTrace("db_load_vars");
|
||||
perfTrace.start();
|
||||
|
||||
Runnable tmpOnComplete = () -> {
|
||||
perfTrace.stop();
|
||||
onComplete.run();
|
||||
};
|
||||
|
||||
RunnableArgs<Exception> tmpOnFailed = ex -> {
|
||||
UtilityLogger.error(ex);
|
||||
perfTrace.putAttribute("failed", "true");
|
||||
if (!(ex instanceof SocketTimeoutException)) onFailed.run(ex);
|
||||
else
|
||||
onFailed.run(new Exception("Errore durante il caricamento dei dati. Riavviare l'applicazione!"));
|
||||
};
|
||||
|
||||
|
||||
onProgress.run("depositi");
|
||||
loadAvailableCodMdeps(() -> {
|
||||
try {
|
||||
onProgress.run("depositi");
|
||||
loadAvailableCodMdeps();
|
||||
|
||||
onProgress.run("posizioni");
|
||||
loadAvailablePosizioni(() -> {
|
||||
loadAvailablePosizioni();
|
||||
|
||||
onProgress.run("impostazioni");
|
||||
loadGestSetupValues(() -> {
|
||||
|
||||
onProgress.run("dati azienda");
|
||||
loadDatiAzienda(() -> {
|
||||
onProgress.run("impostazioni");
|
||||
loadGestSetupValues();
|
||||
|
||||
loadTipiCollo(tmpOnComplete, tmpOnFailed);
|
||||
|
||||
}, tmpOnFailed);
|
||||
}, tmpOnFailed);
|
||||
}, tmpOnFailed);
|
||||
}, tmpOnFailed);
|
||||
onProgress.run("dati azienda");
|
||||
loadDatiAzienda();
|
||||
loadTipiCollo();
|
||||
|
||||
perfTrace.stop();
|
||||
|
||||
} catch (Exception ex) {
|
||||
UtilityLogger.error(ex);
|
||||
perfTrace.putAttribute("failed", "true");
|
||||
|
||||
if (!(ex instanceof SocketTimeoutException))
|
||||
throw ex;
|
||||
else
|
||||
throw new Exception("Errore durante il caricamento dei dati. Riavviare l'applicazione!");
|
||||
}
|
||||
}
|
||||
|
||||
private static void loadTipiCollo(Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
mImballiRESTConsumer.retrieveImballi(MtbTCol.FlagUiUlEnum.UL, tipiColloUl -> {
|
||||
mImballiRESTConsumer.retrieveImballi(MtbTCol.FlagUiUlEnum.UI, tipiColloUi -> {
|
||||
private static void loadTipiCollo() throws Exception {
|
||||
var tipiColloUl = mImballiRESTConsumer.retrieveImballiSyncronized(MtbTCol.FlagUiUlEnum.UL);
|
||||
var tipiColloUi = mImballiRESTConsumer.retrieveImballiSyncronized(MtbTCol.FlagUiUlEnum.UI);
|
||||
|
||||
var imballiList = new ObservableArrayList<ObservableMtbTcol>();
|
||||
imballiList.addAll(tipiColloUi);
|
||||
imballiList.addAll(tipiColloUl);
|
||||
var imballiList = new ObservableArrayList<ObservableMtbTcol>();
|
||||
|
||||
SettingsManager.iDB().setInternalImballi(imballiList);
|
||||
onComplete.run();
|
||||
}, onFailed);
|
||||
}, onFailed);
|
||||
imballiList.addAll(tipiColloUi);
|
||||
imballiList.addAll(tipiColloUl);
|
||||
|
||||
SettingsManager.iDB().setInternalImballi(imballiList);
|
||||
}
|
||||
|
||||
private static void loadDatiAzienda(Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
private static void loadDatiAzienda() throws Exception {
|
||||
|
||||
mAziendaRESTConsumer.retrieveAzienda(datiAzienda -> {
|
||||
SettingsManager.iDB().setDatiAzienda(datiAzienda);
|
||||
var datiAzienda = mAziendaRESTConsumer.retrieveAziendaSynchronized();
|
||||
|
||||
if (!SettingsManager.iDB().isFlagUseCodAnagAziendale()) {
|
||||
onComplete.run();
|
||||
return;
|
||||
}
|
||||
SettingsManager.iDB().setDatiAzienda(datiAzienda);
|
||||
|
||||
String internalCodAnagsQuery = "SELECT ga.cod_anag,\n" +
|
||||
" CAST(CASE WHEN vc.cod_anag IS NOT NULL THEN 1 ELSE 0 END AS BIT) AS is_cliente,\n" +
|
||||
" CAST(CASE WHEN af.cod_anag IS NOT NULL THEN 1 ELSE 0 END AS BIT) AS is_fornitore\n" +
|
||||
"FROM azienda\n" +
|
||||
"INNER JOIN gtb_anag ga on azienda.part_iva = ga.part_iva\n" +
|
||||
"LEFT OUTER JOIN vtb_clie vc on ga.cod_anag = vc.cod_anag AND vc.flag_stato = 'A'\n" +
|
||||
"LEFT OUTER JOIN atb_forn af on ga.cod_anag = af.cod_anag AND af.flag_stato = 'A'";
|
||||
if (!SettingsManager.iDB().isFlagUseCodAnagAziendale()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Type type = new TypeToken<List<InternalCodAnagsDTO>>() {
|
||||
}.getType();
|
||||
mSystemRESTConsumer.<List<InternalCodAnagsDTO>>processSql(internalCodAnagsQuery, type, internalCodAnagsList -> {
|
||||
SettingsManager.iDB().setInternalCodAnags(internalCodAnagsList);
|
||||
String internalCodAnagsQuery = "SELECT ga.cod_anag,\n" +
|
||||
" CAST(CASE WHEN vc.cod_anag IS NOT NULL THEN 1 ELSE 0 END AS BIT) AS is_cliente,\n" +
|
||||
" CAST(CASE WHEN af.cod_anag IS NOT NULL THEN 1 ELSE 0 END AS BIT) AS is_fornitore\n" +
|
||||
"FROM azienda\n" +
|
||||
"INNER JOIN gtb_anag ga on azienda.part_iva = ga.part_iva\n" +
|
||||
"LEFT OUTER JOIN vtb_clie vc on ga.cod_anag = vc.cod_anag AND vc.flag_stato = 'A'\n" +
|
||||
"LEFT OUTER JOIN atb_forn af on ga.cod_anag = af.cod_anag AND af.flag_stato = 'A'";
|
||||
|
||||
if (onComplete != null) onComplete.run();
|
||||
}, onFailed);
|
||||
|
||||
}, onFailed);
|
||||
Type type = new TypeToken<List<InternalCodAnagsDTO>>() {
|
||||
}.getType();
|
||||
var internalCodAnagsList = mSystemRESTConsumer.<List<InternalCodAnagsDTO>>processSqlSynchronized(internalCodAnagsQuery, type);
|
||||
SettingsManager.iDB().setInternalCodAnags(internalCodAnagsList);
|
||||
}
|
||||
|
||||
private static void loadAvailableCodMdeps(Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
mSystemRESTConsumer.getAvailableCodMdeps(availableCodMdeps -> {
|
||||
dbSettingsModelIstance.setAvailableCodMdep(availableCodMdeps);
|
||||
private static void loadAvailableCodMdeps() throws Exception {
|
||||
var availableCodMdeps = mSystemRESTConsumer.getAvailableCodMdepsSynchronized();
|
||||
|
||||
if (availableCodMdeps == null || availableCodMdeps.isEmpty()) {
|
||||
onFailed.run(new Exception(mContext.getText(R.string.no_codmdep_available).toString()));
|
||||
return;
|
||||
}
|
||||
dbSettingsModelIstance.setAvailableCodMdep(availableCodMdeps);
|
||||
|
||||
boolean codMdepExistsAnymore = false;
|
||||
if (availableCodMdeps == null || availableCodMdeps.isEmpty()) {
|
||||
throw new Exception(mContext.getText(R.string.no_codmdep_available).toString());
|
||||
}
|
||||
|
||||
if (settingsModelIstance.getUserSession().getDepo() != null) {
|
||||
for (AvailableCodMdepsDTO availableCodMdepDTO : availableCodMdeps) {
|
||||
//Controllo se il codMdep salvato esiste ancora
|
||||
if (availableCodMdepDTO.getCodMdep().equalsIgnoreCase(settingsModelIstance.getUserSession().getDepo().getCodMdep())) {
|
||||
codMdepExistsAnymore = true;
|
||||
break;
|
||||
}
|
||||
boolean codMdepExistsAnymore = false;
|
||||
|
||||
if (settingsModelIstance.getUserSession().getDepo() != null) {
|
||||
for (AvailableCodMdepsDTO availableCodMdepDTO : availableCodMdeps) {
|
||||
//Controllo se il codMdep salvato esiste ancora
|
||||
if (availableCodMdepDTO.getCodMdep().equalsIgnoreCase(settingsModelIstance.getUserSession().getDepo().getCodMdep())) {
|
||||
codMdepExistsAnymore = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!codMdepExistsAnymore) {
|
||||
settingsModelIstance.getUserSession().setDepo(availableCodMdeps.get(0));
|
||||
}
|
||||
|
||||
if (onComplete != null) onComplete.run();
|
||||
}, ex -> {
|
||||
//BOH
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
});
|
||||
if (!codMdepExistsAnymore) {
|
||||
settingsModelIstance.getUserSession().setDepo(availableCodMdeps.get(0));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static void loadAvailablePosizioni(Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
mPosizioniRESTConsumer.getAvailablePosizioni(availablePosizioni -> {
|
||||
dbSettingsModelIstance.setAvailablePosizioni(availablePosizioni);
|
||||
|
||||
if (onComplete != null) onComplete.run();
|
||||
}, ex -> {
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
}
|
||||
);
|
||||
private static void loadAvailablePosizioni() throws Exception {
|
||||
var availablePosizioni = mPosizioniRESTConsumer.getAvailablePosizioniSynchronized();
|
||||
dbSettingsModelIstance.setAvailablePosizioni(availablePosizioni);
|
||||
}
|
||||
|
||||
|
||||
private static void loadGestSetupValues(Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
private static void loadGestSetupValues() throws Exception {
|
||||
|
||||
List<StbGestSetupReader> stbGestSetupReaderList = new ArrayList<>();
|
||||
|
||||
@@ -583,6 +558,18 @@ public class SettingsManager {
|
||||
.setKeySection("ENABLE_POSITION_CHANGE_REQUEST")
|
||||
.setSetter(dbSettingsModelIstance::setFlagPositionChangeRequest)
|
||||
.setDefaultValue(true));
|
||||
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
|
||||
.setGestName("PICKING")
|
||||
.setSection("SPEDIZIONE")
|
||||
.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")
|
||||
@@ -648,34 +635,33 @@ public class SettingsManager {
|
||||
String codMdep = SettingsManager.i().getUserSession().getDepo().getCodMdep();
|
||||
|
||||
|
||||
mGestSetupRESTConsumer.getValues(codMdep, stbGestSetupReaderList, list -> {
|
||||
var list = mGestSetupRESTConsumer.getValuesSynchronized(codMdep, stbGestSetupReaderList);
|
||||
|
||||
for (var stbGestSetupReader : list) {
|
||||
var value = stbGestSetupReader.getValue();
|
||||
var clazz = stbGestSetupReader.getClazz();
|
||||
|
||||
Object finalValue = null;
|
||||
if (value != null) {
|
||||
if (clazz == String.class) {
|
||||
finalValue = clazz.cast(value);
|
||||
} else if (clazz == Boolean.class) {
|
||||
finalValue = clazz.cast("S".equalsIgnoreCase(value));
|
||||
} else if (clazz == Integer.class && value != null) {
|
||||
finalValue = clazz.cast(Integer.parseInt(value));
|
||||
}
|
||||
} else if (stbGestSetupReader.getDefaultValue() == null) {
|
||||
if (clazz == Boolean.class) {
|
||||
finalValue = clazz.cast(Boolean.FALSE);
|
||||
} else if (clazz == Integer.class) {
|
||||
finalValue = clazz.cast(0);
|
||||
}
|
||||
} else finalValue = stbGestSetupReader.getDefaultValue();
|
||||
for (var stbGestSetupReader : list) {
|
||||
var value = stbGestSetupReader.getValue();
|
||||
var clazz = stbGestSetupReader.getClazz();
|
||||
|
||||
stbGestSetupReader.getSetter().run(finalValue);
|
||||
}
|
||||
Object finalValue = null;
|
||||
if (value != null) {
|
||||
if (clazz == String.class) {
|
||||
finalValue = clazz.cast(value);
|
||||
} else if (clazz == Boolean.class) {
|
||||
finalValue = clazz.cast("S".equalsIgnoreCase(value));
|
||||
} else if (clazz == Integer.class && value != null) {
|
||||
finalValue = clazz.cast(Integer.parseInt(value));
|
||||
}
|
||||
} else if (stbGestSetupReader.getDefaultValue() == null) {
|
||||
if (clazz == Boolean.class) {
|
||||
finalValue = clazz.cast(Boolean.FALSE);
|
||||
} else if (clazz == Integer.class) {
|
||||
finalValue = clazz.cast(0);
|
||||
}
|
||||
} else finalValue = stbGestSetupReader.getDefaultValue();
|
||||
|
||||
stbGestSetupReader.getSetter().run(finalValue);
|
||||
}
|
||||
|
||||
if (onComplete != null) onComplete.run();
|
||||
}, onFailed);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ package it.integry.integrywmsnative.core.utility;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
import com.google.zxing.BarcodeFormat;
|
||||
import com.google.zxing.EncodeHintType;
|
||||
import com.google.zxing.MultiFormatWriter;
|
||||
@@ -12,6 +11,7 @@ import com.journeyapps.barcodescanner.BarcodeEncoder;
|
||||
import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
||||
import it.integry.barcode_base_android_library.model.BarcodeType;
|
||||
@@ -61,7 +61,7 @@ public class UtilityBarcode {
|
||||
boolean isPosizione = false;
|
||||
|
||||
if (SettingsManager.iDB().getAvailablePosizioni() != null) {
|
||||
Stream<MtbDepoPosizione> tmpStream = Stream.of(SettingsManager.iDB().getAvailablePosizioni())
|
||||
Stream<MtbDepoPosizione> tmpStream = SettingsManager.iDB().getAvailablePosizioni().stream()
|
||||
.filter(x -> x.getPosizione().equalsIgnoreCase(barcode) && (!enableCheckCodMdep || currentCodMdep.equalsIgnoreCase(x.getCodMdep())));
|
||||
|
||||
if (tmpStream.count() > 0) {
|
||||
|
||||
@@ -40,4 +40,5 @@ public class UtilityDialog {
|
||||
// dialog.getWindow().setLayout(width, LinearLayout.LayoutParams.WRAP_CONTENT);
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.google.firebase.crashlytics.FirebaseCrashlytics;
|
||||
import com.orhanobut.logger.Logger;
|
||||
|
||||
import it.integry.integrywmsnative.BuildConfig;
|
||||
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
||||
import it.integry.integrywmsnative.core.exception.InvalidConnectionException;
|
||||
import it.integry.integrywmsnative.core.exception.InvalidLUException;
|
||||
import it.integry.integrywmsnative.core.exception.InvalidLUGestioneException;
|
||||
@@ -19,11 +20,12 @@ import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||
|
||||
public class UtilityExceptions {
|
||||
|
||||
private static final Class<?>[] FIREBASE_IGNORED_EXCEPTIONS = new Class[] {
|
||||
private static final Class<?>[] FIREBASE_IGNORED_EXCEPTIONS = new Class[]{
|
||||
InvalidConnectionException.class,
|
||||
InvalidLUGestioneException.class,
|
||||
InvalidLUException.class
|
||||
};
|
||||
|
||||
public static void defaultException(Context context, Exception ex) {
|
||||
defaultException(context, ex, false);
|
||||
}
|
||||
@@ -47,7 +49,11 @@ public class UtilityExceptions {
|
||||
FragmentManager fm = ContextHelper.getFragmentManagerFromContext(context);
|
||||
|
||||
if (fm != null) {
|
||||
DialogSimpleMessageView.makeErrorDialog(Html.fromHtml(errorMessage), null, null)
|
||||
boolean isBarcodeEnabled = BarcodeManager.isLastCallbackEnabled();
|
||||
if (isBarcodeEnabled) BarcodeManager.disableLastCallback();
|
||||
DialogSimpleMessageView.makeErrorDialog(Html.fromHtml(errorMessage), null, () -> {
|
||||
if (isBarcodeEnabled) BarcodeManager.enableLastCallback();
|
||||
})
|
||||
.show(fm, "tag");
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package it.integry.integrywmsnative.core.utility;
|
||||
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
|
||||
@@ -12,10 +14,12 @@ import it.integry.integrywmsnative.core.model.secondary.StatoPartitaMag;
|
||||
import it.integry.integrywmsnative.core.rest.deserializer.LocalDateDeserializer;
|
||||
import it.integry.integrywmsnative.core.rest.deserializer.LocalDateTimeDeserializer;
|
||||
import it.integry.integrywmsnative.core.rest.deserializer.MtbTcolFlagUiUlDeserializer;
|
||||
import it.integry.integrywmsnative.core.rest.deserializer.MutableLiveDataDeserializer;
|
||||
import it.integry.integrywmsnative.core.rest.deserializer.StatoPartitaMagDeserializer;
|
||||
import it.integry.integrywmsnative.core.rest.serializer.LocalDateSerializer;
|
||||
import it.integry.integrywmsnative.core.rest.serializer.LocalDateTimeSerializer;
|
||||
import it.integry.integrywmsnative.core.rest.serializer.MtbTcolFlagUiUlSerializer;
|
||||
import it.integry.integrywmsnative.core.rest.serializer.MutableLiveDataSerializer;
|
||||
import it.integry.integrywmsnative.core.rest.serializer.StatoPartitaMagSerializer;
|
||||
|
||||
public class UtilityGson {
|
||||
@@ -24,6 +28,8 @@ public class UtilityGson {
|
||||
return new GsonBuilder()
|
||||
.setDateFormat("dd/MM/yyyy HH:mm:ss")
|
||||
.excludeFieldsWithModifiers(Modifier.TRANSIENT)
|
||||
.registerTypeAdapter(MutableLiveData.class, new MutableLiveDataDeserializer())
|
||||
.registerTypeAdapter(MutableLiveData.class, new MutableLiveDataSerializer())
|
||||
.registerTypeAdapter(LocalDate.class, new LocalDateDeserializer())
|
||||
.registerTypeAdapter(LocalDate.class, new LocalDateSerializer())
|
||||
.registerTypeAdapter(LocalDateTime.class, new LocalDateTimeDeserializer())
|
||||
|
||||
@@ -2,6 +2,7 @@ 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;
|
||||
@@ -54,7 +55,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
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Bundle;
|
||||
import android.text.Html;
|
||||
import android.text.SpannableString;
|
||||
import android.view.Gravity;
|
||||
|
||||
@@ -41,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;
|
||||
@@ -98,7 +99,7 @@ public class AccettazioneBollaPickingActivity extends BaseActivity implements Ac
|
||||
public BindableBoolean noLUPresent = new BindableBoolean(true);
|
||||
public BindableBoolean bottomSheetEnabled = new BindableBoolean(false);
|
||||
|
||||
private int barcodeScannerIstanceID = -1;
|
||||
private int mBarcodeScannerInstanceID = -1;
|
||||
private boolean mShowSecondaryUntMis = true;
|
||||
private boolean mShouldCloseActivity;
|
||||
private AccettazioneBollaPickingOrderBy.Enum mCurrentOrderBy;
|
||||
@@ -182,10 +183,10 @@ public class AccettazioneBollaPickingActivity extends BaseActivity implements Ac
|
||||
this.mBindings.bottomSheetLuContent.collapse();
|
||||
} else if (!noLUPresent.get()) {
|
||||
this.mShouldCloseActivity = true;
|
||||
BarcodeManager.removeCallback(barcodeScannerIstanceID);
|
||||
BarcodeManager.removeCallback(mBarcodeScannerInstanceID);
|
||||
this.mViewModel.closeLU();
|
||||
} else {
|
||||
BarcodeManager.removeCallback(barcodeScannerIstanceID);
|
||||
BarcodeManager.removeCallback(mBarcodeScannerInstanceID);
|
||||
super.onBackPressed();
|
||||
}
|
||||
}
|
||||
@@ -199,7 +200,7 @@ public class AccettazioneBollaPickingActivity extends BaseActivity implements Ac
|
||||
}
|
||||
|
||||
private void initBarcodeReader() {
|
||||
barcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
||||
mBarcodeScannerInstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
||||
.setOnScanSuccessful(onScanSuccessful)
|
||||
.setOnScanFailed(ex -> UtilityExceptions.defaultException(this, ex, false)));
|
||||
}
|
||||
@@ -451,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)
|
||||
@@ -590,7 +591,7 @@ public class AccettazioneBollaPickingActivity extends BaseActivity implements Ac
|
||||
UtilityExceptions.defaultException(this, ex);
|
||||
}
|
||||
|
||||
BarcodeManager.enable();
|
||||
BarcodeManager.enable(mBarcodeScannerInstanceID);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -600,7 +601,7 @@ public class AccettazioneBollaPickingActivity extends BaseActivity implements Ac
|
||||
totalQtaToBeTaken, BigDecimal totalNumCnfToBeTaken, BigDecimal qtaCnfToBeTaken, BigDecimal
|
||||
totalQtaAvailable, BigDecimal totalNumCnfAvailable, BigDecimal qtaCnfAvailable, String
|
||||
partitaMag, LocalDate dataScad, boolean canPartitaMagBeChanged,
|
||||
boolean canOverflowQuantity, RunnableArgss<PickedQuantityDTO, Boolean> onComplete) {
|
||||
boolean canOverflowQuantity, RunnableArgs<PickedQuantityDTO> onComplete) {
|
||||
DialogInputQuantityV2DTO dialogInputQuantityV2DTO = new DialogInputQuantityV2DTO()
|
||||
.setMtbAart(mtbAart)
|
||||
.setInitialNumCnf(initialNumCnf)
|
||||
@@ -608,7 +609,7 @@ public class AccettazioneBollaPickingActivity extends BaseActivity implements Ac
|
||||
.setInitialQtaTot(initialQtaTot)
|
||||
.setTotalQtaOrd(totalQtaOrd)
|
||||
.setTotalNumCnfOrd(totalNumCnfOrd)
|
||||
.setQtaCnfOrd(qtaCnfOrd)
|
||||
.setTotalQtaCnfOrd(qtaCnfOrd)
|
||||
.setTotalQtaToBeTaken(totalQtaToBeTaken)
|
||||
.setTotalNumCnfToBeTaken(totalNumCnfToBeTaken)
|
||||
.setQtaCnfToBeTaken(qtaCnfToBeTaken)
|
||||
@@ -619,20 +620,26 @@ public class AccettazioneBollaPickingActivity extends BaseActivity implements Ac
|
||||
.setDataScad(dataScad)
|
||||
.setCanPartitaMagBeChanged(canPartitaMagBeChanged)
|
||||
.setCanLUBeClosed(true)
|
||||
.setQtaTotEditable(SettingsManager.iDB().isFlagAccettazioneBollaEditableQtaTot())
|
||||
.setCanOverflowOrderQuantity(canOverflowQuantity)
|
||||
.setDisableTracciabilitaCheck(SettingsManager.iDB().isFlagAccettazioneBollaDisableMandatoryTracciabilita());
|
||||
|
||||
if (!mDialogInputQuantityV2View.isVisible())
|
||||
mDialogInputQuantityV2View
|
||||
.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
|
||||
.setOnComplete((resultDTO, shouldCloseLU) -> {
|
||||
.setOnComplete(resultDTO -> {
|
||||
if(resultDTO.isAborted()) {
|
||||
this.mViewModel.resetMatchedRows();
|
||||
return;
|
||||
}
|
||||
|
||||
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO()
|
||||
.setNumCnf(resultDTO.getNumCnf())
|
||||
.setQtaCnf(resultDTO.getQtaCnf())
|
||||
.setQtaTot(resultDTO.getQtaTot())
|
||||
.setPartitaMag(resultDTO.getPartitaMag())
|
||||
.setDataScad(resultDTO.getDataScad());
|
||||
onComplete.run(pickedQuantityDTO, shouldCloseLU);
|
||||
onComplete.run(pickedQuantityDTO);
|
||||
})
|
||||
.setOnAbort(() -> this.mViewModel.resetMatchedRows())
|
||||
.show(getSupportFragmentManager(), "tag");
|
||||
@@ -690,4 +697,15 @@ public class AccettazioneBollaPickingActivity extends BaseActivity implements Ac
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfirmAnomalie(int anomalie, RunnableArgs<Boolean> onConfirm) {
|
||||
DialogSimpleMessageView.makeWarningDialog(new SpannableString(Html.fromHtml(String.format(getString(R.string.confirm_anomalie), anomalie))),
|
||||
null, () -> {
|
||||
onConfirm.run(true);
|
||||
}, () -> {
|
||||
onConfirm.run(false);
|
||||
})
|
||||
.show(getSupportFragmentManager(), "tag");
|
||||
}
|
||||
}
|
||||
@@ -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 -> {
|
||||
@@ -305,8 +305,8 @@ public class AccettazioneBollaPickingViewModel {
|
||||
private void loadArticolo(String barcodeProd, PickDataDTO pickData, Runnable onComplete) {
|
||||
this.mArticoloRESTConsumer.searchByBarcode(barcodeProd, mtbAartList -> {
|
||||
|
||||
if (mtbAartList != null && mtbAartList.size() > 0) {
|
||||
this.searchArtFromAnag(mtbAartList.get(0), pickData, onComplete);
|
||||
if (mtbAartList != null && !mtbAartList.isEmpty()) {
|
||||
this.searchArtFromAnag(mtbAartList.get(0), pickData, null, onComplete);
|
||||
} else {
|
||||
this.manageUnknownBarcode(barcodeProd, onComplete);
|
||||
}
|
||||
@@ -315,28 +315,41 @@ public class AccettazioneBollaPickingViewModel {
|
||||
}
|
||||
|
||||
|
||||
private void searchArtFromAnag(MtbAart mtbAart, PickDataDTO pickData, Runnable onComplete) {
|
||||
private void searchArtFromAnag(MtbAart mtbAart, PickDataDTO pickData, ArrayList<MtbAart> previousSearchedArts, Runnable onComplete) {
|
||||
if (previousSearchedArts == null) previousSearchedArts = new ArrayList<>();
|
||||
|
||||
if (previousSearchedArts.contains(mtbAart)) {
|
||||
manageNoArtFound(mtbAart, pickData);
|
||||
return;
|
||||
}
|
||||
|
||||
previousSearchedArts.add(mtbAart);
|
||||
|
||||
final List<PickingObjectDTO> pickingList = mPickingList.getValue();
|
||||
|
||||
List<PickingObjectDTO> matchPickingObject = Stream.of(pickingList)
|
||||
.filter(x -> UtilityString.equalsIgnoreCase(mtbAart.getCodMart(), x.getSitBollaAccettazione().getCodMart()))
|
||||
.toList();
|
||||
List<PickingObjectDTO> matchPickingObject = pickingList == null ? new ArrayList<>() :
|
||||
pickingList.stream()
|
||||
.filter(x -> UtilityString.equalsIgnoreCase(mtbAart.getCodMart(), x.getSitBollaAccettazione().getCodMart()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
for (PickingObjectDTO pickingObjectDTO : matchPickingObject) {
|
||||
pickingObjectDTO.setTempPickData(pickData);
|
||||
}
|
||||
|
||||
this.loadMatchedRows(matchPickingObject, mtbAart, pickData);
|
||||
this.loadMatchedRows(matchPickingObject, mtbAart, pickData, previousSearchedArts);
|
||||
onComplete.run();
|
||||
}
|
||||
|
||||
private void loadMatchedRows(List<PickingObjectDTO> matchedRows, MtbAart mtbAart, PickDataDTO pickDataDTO) {
|
||||
private void loadMatchedRows(List<PickingObjectDTO> matchedRows, MtbAart mtbAart, PickDataDTO pickDataDTO, ArrayList<MtbAart> previousSearchedArts) {
|
||||
if (matchedRows == null || matchedRows.isEmpty()) {
|
||||
this.sendOnLoadingStarted();
|
||||
this.mArticoloRESTConsumer.findIfIsKit(mtbAart, mtbAartFind -> {
|
||||
if (mtbAartFind == null){
|
||||
this.sendOnLoadingEnded();
|
||||
if (mtbAartFind == null) {
|
||||
manageNoArtFound(mtbAart, pickDataDTO);
|
||||
} else {
|
||||
searchArtFromAnag(mtbAartFind, pickDataDTO, () -> {});
|
||||
searchArtFromAnag(mtbAartFind, pickDataDTO, previousSearchedArts, () -> {
|
||||
});
|
||||
}
|
||||
}, this::sendError);
|
||||
} else if (matchedRows.size() == 1) {
|
||||
@@ -442,7 +455,7 @@ public class AccettazioneBollaPickingViewModel {
|
||||
dispatchBollaRow(pickingObjectDTO);
|
||||
}
|
||||
|
||||
public void dispatchBollaRow(final PickingObjectDTO pickingObjectDTO){
|
||||
public void dispatchBollaRow(final PickingObjectDTO pickingObjectDTO) {
|
||||
dispatchBollaRow(pickingObjectDTO, false);
|
||||
}
|
||||
|
||||
@@ -554,7 +567,7 @@ public class AccettazioneBollaPickingViewModel {
|
||||
UtilityBigDecimal.greaterThan(initialNumCnf, pickingObjectDTO.getMtbAart().getColliPedana())) {
|
||||
initialNumCnf = pickingObjectDTO.getMtbAart().getColliPedana();
|
||||
initialQtaTot = initialNumCnf.multiply(initialQtaCnf);
|
||||
} else if(UtilityBigDecimal.greaterThan(initialNumCnf, BigDecimal.ONE) && pickingObjectDTO.getMtbAart().isFlagQtaCnfFissaBoolean()) {
|
||||
} else if (UtilityBigDecimal.greaterThan(initialNumCnf, BigDecimal.ONE) && pickingObjectDTO.getMtbAart().isFlagQtaCnfFissaBoolean()) {
|
||||
initialNumCnf = BigDecimal.ONE;
|
||||
initialQtaTot = initialNumCnf.multiply(initialQtaCnf);
|
||||
}
|
||||
@@ -577,7 +590,7 @@ public class AccettazioneBollaPickingViewModel {
|
||||
}
|
||||
}
|
||||
|
||||
if (!longClick){
|
||||
if (!longClick) {
|
||||
this.sendOnItemDispatched(
|
||||
pickingObjectDTO,
|
||||
pickingObjectDTO.getMtbAart(),
|
||||
@@ -594,14 +607,14 @@ public class AccettazioneBollaPickingViewModel {
|
||||
partitaMag,
|
||||
dataScad,
|
||||
true,
|
||||
(pickedQuantityDTO, shouldCloseLU) -> {
|
||||
pickedQuantityDTO -> {
|
||||
this.saveNewRow(pickingObjectDTO,
|
||||
pickedQuantityDTO.getNumCnf(),
|
||||
pickedQuantityDTO.getQtaCnf(),
|
||||
pickedQuantityDTO.getQtaTot(),
|
||||
pickedQuantityDTO.getPartitaMag(),
|
||||
pickedQuantityDTO.getDataScad(),
|
||||
shouldCloseLU);
|
||||
pickedQuantityDTO.isShouldCloseLu());
|
||||
});
|
||||
} else {
|
||||
this.saveNewRow(
|
||||
@@ -643,7 +656,6 @@ public class AccettazioneBollaPickingViewModel {
|
||||
.setQtaCnf(qtaCnf)
|
||||
.setNumCnf(numCnf)
|
||||
.setPartitaMag(partitaMag)
|
||||
// .setCodJcom(pickingObjectDTO.getSitBollaAccettazione().getCodJcom())
|
||||
.setDataDoc(sitBolla != null ? sitBolla.getDataDoc() : firstAvailableBolla.getDataDoc())
|
||||
.setNumDoc(sitBolla != null ? sitBolla.getNumDoc() : firstAvailableBolla.getNumDoc())
|
||||
.setCodDtip(sitBolla != null ? sitBolla.getCodDtip() : firstAvailableBolla.getCodDtip())
|
||||
@@ -662,7 +674,7 @@ public class AccettazioneBollaPickingViewModel {
|
||||
.setMtbAart(pickingObjectDTO.getMtbAart());
|
||||
|
||||
pickingObjectDTO.getWithdrawMtbColrs().add(insertedMtbColr);
|
||||
mCurrentMtbColt.getMtbColr().add(insertedMtbColr);
|
||||
mCurrentMtbColt.getMtbColr().add(0, insertedMtbColr);
|
||||
|
||||
//Chiamato removeListFilter perché cosi mi cancella tutti i dati di pick temporanei
|
||||
resetMatchedRows();
|
||||
@@ -694,7 +706,9 @@ public class AccettazioneBollaPickingViewModel {
|
||||
mtbColrToEdit.getPartitaMag(),
|
||||
mtbColrToEdit.getDataScadPartita(),
|
||||
true,
|
||||
(pickedQuantityDTO, shouldCloseLU) -> {
|
||||
pickedQuantityDTO -> {
|
||||
if (pickedQuantityDTO == null)
|
||||
return;
|
||||
|
||||
this.saveEditedRow(mtbColrToEdit,
|
||||
pickedQuantityDTO.getNumCnf(),
|
||||
@@ -702,7 +716,7 @@ public class AccettazioneBollaPickingViewModel {
|
||||
pickedQuantityDTO.getQtaTot(),
|
||||
pickedQuantityDTO.getPartitaMag(),
|
||||
pickedQuantityDTO.getDataScad(),
|
||||
shouldCloseLU);
|
||||
pickedQuantityDTO.isShouldCloseLu());
|
||||
});
|
||||
}
|
||||
|
||||
@@ -801,21 +815,42 @@ public class AccettazioneBollaPickingViewModel {
|
||||
} else {
|
||||
CloseUDCRequestDTO closeUDCRequestDTO = new CloseUDCRequestDTO()
|
||||
.setMtbColt(mCurrentMtbColt);
|
||||
mColliCaricoRESTConsumer.closeUDC(closeUDCRequestDTO, closeUDCResponse -> {
|
||||
|
||||
Runnable onVersamentoCompleted = () -> {
|
||||
managePrintCollo(this::postCloseOperations);
|
||||
ObservableArrayList<MtbColr> mtbColr = mCurrentMtbColt.getMtbColr();
|
||||
List<PickingObjectDTO> pickingList = getPickingList().getValue();
|
||||
|
||||
this.sendLUClosed();
|
||||
this.sendOnLoadingEnded();
|
||||
};
|
||||
int listCount = pickingList != null ? pickingList.size() : 0;
|
||||
int anomalie = listCount > 0 ? listCount - mtbColr.size() : 0;
|
||||
|
||||
manageVersamentoAutomatico(onVersamentoCompleted);
|
||||
}, this::sendError);
|
||||
if (anomalie == 0) {
|
||||
closeUdc(closeUDCRequestDTO);
|
||||
} else {
|
||||
onConfirmAnomalie(anomalie, canBeClose -> {
|
||||
if (canBeClose) {
|
||||
closeUdc(closeUDCRequestDTO);
|
||||
} else {
|
||||
this.sendOnLoadingEnded();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}, this::sendError);
|
||||
}
|
||||
|
||||
private void closeUdc(CloseUDCRequestDTO closeUDCRequestDTO) {
|
||||
mColliCaricoRESTConsumer.closeUDC(closeUDCRequestDTO, closeUDCResponse -> {
|
||||
|
||||
Runnable onVersamentoCompleted = () -> {
|
||||
managePrintCollo(this::postCloseOperations);
|
||||
|
||||
this.sendLUClosed();
|
||||
this.sendOnLoadingEnded();
|
||||
};
|
||||
|
||||
manageVersamentoAutomatico(onVersamentoCompleted);
|
||||
}, this::sendError);
|
||||
}
|
||||
|
||||
private void manageVersamentoAutomatico(Runnable onComplete) {
|
||||
|
||||
if (!SettingsManager.iDB().isFlagAccettazioneBollaAskVersamentoAutomatico()) {
|
||||
@@ -982,7 +1017,7 @@ public class AccettazioneBollaPickingViewModel {
|
||||
String partitaMag,
|
||||
LocalDate dataScad,
|
||||
boolean canPartitaMagBeChanged,
|
||||
RunnableArgss<PickedQuantityDTO, Boolean> onComplete) {
|
||||
RunnableArgs<PickedQuantityDTO> onComplete) {
|
||||
if (this.mListener != null) mListener.onItemDispatched(pickingObjectDTO,
|
||||
mtbAart,
|
||||
initialNumCnf,
|
||||
@@ -1038,6 +1073,9 @@ public class AccettazioneBollaPickingViewModel {
|
||||
return this;
|
||||
}
|
||||
|
||||
private void onConfirmAnomalie(int anomalie, RunnableArgs<Boolean> onConfirm) {
|
||||
if (this.mListener != null) mListener.onConfirmAnomalie(anomalie, onConfirm);
|
||||
}
|
||||
|
||||
public interface Listener extends ILoadingListener, ILUPrintListener, ILUBaseOperationsListener {
|
||||
|
||||
@@ -1065,7 +1103,7 @@ public class AccettazioneBollaPickingViewModel {
|
||||
LocalDate dataScad,
|
||||
boolean canPartitaMagBeChanged,
|
||||
boolean canOverflowQuantity,
|
||||
RunnableArgss<PickedQuantityDTO, Boolean> onComplete);
|
||||
RunnableArgs<PickedQuantityDTO> onComplete);
|
||||
|
||||
void onFilterCodMartApplied(String codMartToFilter);
|
||||
|
||||
@@ -1075,6 +1113,8 @@ public class AccettazioneBollaPickingViewModel {
|
||||
|
||||
void onUnknownBarcodeScanned(String barcode, RunnableArgs<String> done, Runnable abort);
|
||||
|
||||
void onConfirmAnomalie(int anomalie, RunnableArgs<Boolean> onConfirm);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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()
|
||||
|
||||
@@ -2,12 +2,10 @@ package it.integry.integrywmsnative.gest.accettazione_bolla_picking.ui;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.os.Build;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.content.res.ResourcesCompat;
|
||||
import androidx.databinding.ObservableArrayList;
|
||||
@@ -17,7 +15,6 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.zhukic.sectionedrecyclerview.SectionedRecyclerViewAdapter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.R;
|
||||
@@ -65,29 +62,10 @@ public class AccettazioneBollaPickingListAdapter extends SectionedRecyclerViewAd
|
||||
this.mShowSecondaryUntMis = showSecondaryUntMis;
|
||||
|
||||
mutableDataSet.addOnListChangedCallback(new OnListGeneralChangedCallback() {
|
||||
@RequiresApi(api = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
|
||||
@Override
|
||||
public void onChanged(ObservableList sender) {
|
||||
List<AccettazioneBollaPickingListModel> listaOrdinata = new ArrayList<>();
|
||||
if (!sender.isEmpty()) {
|
||||
listaOrdinata = new ArrayList<>(sender);
|
||||
|
||||
Collections.sort(listaOrdinata, (a, b) -> {
|
||||
|
||||
boolean condA = a.getQtaEvasa().floatValue() > 0;
|
||||
boolean condB = b.getQtaEvasa().floatValue() > 0;
|
||||
|
||||
if (condA && !condB) {
|
||||
return -1;
|
||||
} else if (!condA && condB) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
});
|
||||
}
|
||||
|
||||
mDataset.clear();
|
||||
mDataset.addAll(listaOrdinata);
|
||||
mDataset.addAll(sender);
|
||||
notifyDataSetChanged();
|
||||
notifyDataChanged();
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
@@ -107,7 +107,7 @@ public class AccettazioneOrdiniPickingActivity extends BaseActivity implements A
|
||||
public BindableBoolean noLUPresent = new BindableBoolean(true);
|
||||
public BindableBoolean bottomSheetEnabled = new BindableBoolean(false);
|
||||
|
||||
private int barcodeScannerIstanceID = -1;
|
||||
private int mBarcodeScannerInstanceID = -1;
|
||||
|
||||
private List<OrdineAccettazioneInevasoDTO> mOrders;
|
||||
private List<SitArtOrdDTO> mSitArts;
|
||||
@@ -310,10 +310,10 @@ public class AccettazioneOrdiniPickingActivity extends BaseActivity implements A
|
||||
this.mBindings.bottomSheetLuContent.collapse();
|
||||
} else if (!noLUPresent.get()) {
|
||||
this.mShouldCloseActivity = true;
|
||||
BarcodeManager.removeCallback(barcodeScannerIstanceID);
|
||||
BarcodeManager.removeCallback(mBarcodeScannerInstanceID);
|
||||
this.mViewModel.closeLU();
|
||||
} else {
|
||||
BarcodeManager.removeCallback(barcodeScannerIstanceID);
|
||||
BarcodeManager.removeCallback(mBarcodeScannerInstanceID);
|
||||
super.onBackPressed();
|
||||
}
|
||||
}
|
||||
@@ -344,7 +344,7 @@ public class AccettazioneOrdiniPickingActivity extends BaseActivity implements A
|
||||
}
|
||||
|
||||
private void initBarcodeReader() {
|
||||
barcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO().setOnScanSuccessful(onScanSuccessful).setOnScanFailed(ex -> UtilityExceptions.defaultException(this, ex, false)));
|
||||
mBarcodeScannerInstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO().setOnScanSuccessful(onScanSuccessful).setOnScanFailed(ex -> UtilityExceptions.defaultException(this, ex, false)));
|
||||
}
|
||||
|
||||
private void initRecyclerView() {
|
||||
@@ -690,11 +690,11 @@ public class AccettazioneOrdiniPickingActivity extends BaseActivity implements A
|
||||
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(),
|
||||
|
||||
@@ -767,7 +767,7 @@ public class AccettazioneOrdiniPickingActivity extends BaseActivity implements A
|
||||
UtilityExceptions.defaultException(this, ex);
|
||||
}
|
||||
|
||||
BarcodeManager.enable();
|
||||
BarcodeManager.enable(mBarcodeScannerInstanceID);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -782,13 +782,20 @@ public class AccettazioneOrdiniPickingActivity extends BaseActivity implements A
|
||||
|
||||
@Override
|
||||
public void onItemDispatched(PickingObjectDTO pickingObjectDTO, MtbAart mtbAart, BigDecimal initialNumCnf, BigDecimal initialQtaCnf, BigDecimal initialQtaTot, BigDecimal totalQtaOrd, BigDecimal totalNumCnfOrd, BigDecimal qtaCnfOrd, BigDecimal totalQtaToBeTaken, BigDecimal totalNumCnfToBeTaken, BigDecimal qtaCnfToBeTaken, BigDecimal totalQtaAvailable, BigDecimal totalNumCnfAvailable, BigDecimal qtaCnfAvailable, String partitaMag, LocalDate dataScad, boolean canPartitaMagBeChanged, boolean canOverflowQuantity, String customArtDescription, RunnableArgss<PickedQuantityDTO, Boolean> onComplete) {
|
||||
DialogInputQuantityV2DTO dialogInputQuantityV2DTO = new DialogInputQuantityV2DTO().setMtbAart(mtbAart).setInitialNumCnf(initialNumCnf).setInitialQtaCnf(initialQtaCnf).setInitialQtaTot(initialQtaTot).setTotalQtaOrd(totalQtaOrd).setTotalNumCnfOrd(totalNumCnfOrd).setQtaCnfOrd(qtaCnfOrd).setTotalQtaToBeTaken(totalQtaToBeTaken).setTotalNumCnfToBeTaken(totalNumCnfToBeTaken).setQtaCnfToBeTaken(qtaCnfToBeTaken).setTotalQtaAvailable(totalQtaAvailable).setTotalNumCnfAvailable(totalNumCnfAvailable).setQtaCnfAvailable(qtaCnfAvailable).setPartitaMag(partitaMag).setDataScad(dataScad).setCanPartitaMagBeChanged(canPartitaMagBeChanged).setCanLUBeClosed(true).setCanOverflowOrderQuantity(canOverflowQuantity).setCustomArtDescription(customArtDescription);
|
||||
DialogInputQuantityV2DTO dialogInputQuantityV2DTO = new DialogInputQuantityV2DTO().setMtbAart(mtbAart).setInitialNumCnf(initialNumCnf).setInitialQtaCnf(initialQtaCnf).setInitialQtaTot(initialQtaTot).setTotalQtaOrd(totalQtaOrd).setTotalNumCnfOrd(totalNumCnfOrd).setTotalQtaCnfOrd(qtaCnfOrd).setTotalQtaToBeTaken(totalQtaToBeTaken).setTotalNumCnfToBeTaken(totalNumCnfToBeTaken).setQtaCnfToBeTaken(qtaCnfToBeTaken).setTotalQtaAvailable(totalQtaAvailable).setTotalNumCnfAvailable(totalNumCnfAvailable).setQtaCnfAvailable(qtaCnfAvailable).setPartitaMag(partitaMag).setDataScad(dataScad).setCanPartitaMagBeChanged(canPartitaMagBeChanged).setCanLUBeClosed(true).setCanOverflowOrderQuantity(canOverflowQuantity).setCustomArtDescription(customArtDescription);
|
||||
|
||||
if (!mDialogInputQuantityV2View.isVisible())
|
||||
mDialogInputQuantityV2View.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO).setOnComplete((resultDTO, shouldCloseLU) -> {
|
||||
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO().setNumCnf(resultDTO.getNumCnf()).setQtaCnf(resultDTO.getQtaCnf()).setQtaTot(resultDTO.getQtaTot()).setPartitaMag(resultDTO.getPartitaMag()).setDataScad(resultDTO.getDataScad());
|
||||
onComplete.run(pickedQuantityDTO, shouldCloseLU);
|
||||
}).setOnAbort(() -> this.mViewModel.resetMatchedRows()).show(getSupportFragmentManager(), "tag");
|
||||
mDialogInputQuantityV2View
|
||||
.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO).setOnComplete(resultDTO -> {
|
||||
if (resultDTO == null) {
|
||||
this.mViewModel.resetMatchedRows();
|
||||
return;
|
||||
}
|
||||
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO().setNumCnf(resultDTO.getNumCnf()).setQtaCnf(resultDTO.getQtaCnf()).setQtaTot(resultDTO.getQtaTot()).setPartitaMag(resultDTO.getPartitaMag()).setDataScad(resultDTO.getDataScad());
|
||||
onComplete.run(pickedQuantityDTO, pickedQuantityDTO.isShouldCloseLu());
|
||||
})
|
||||
.setOnAbort(() -> this.mViewModel.resetMatchedRows())
|
||||
.show(getSupportFragmentManager(), "tag");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -32,7 +32,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;
|
||||
@@ -198,7 +198,7 @@ public class AccettazioneOrdiniPickingViewModel {
|
||||
return mPickingList;
|
||||
}
|
||||
|
||||
public void retrieveExistentLU(RunnableArgs<List<AlreadyRegisteredUDCDTO>> onComplete) {
|
||||
public void retrieveExistentLU(RunnableArgs<List<AlreadyRegisteredUlDTO>> onComplete) {
|
||||
this.sendOnLoadingStarted();
|
||||
|
||||
this.mAccettazioneOrdiniPickingRESTConsumer.getBancaliGiaRegistrati(this.mOrders, mtbColtList -> {
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -70,7 +70,7 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
||||
DialogInputQuantityV2View dialogInputQuantityV2View;
|
||||
|
||||
|
||||
private int mBarcodeScannerIstanceID;
|
||||
private int mBarcodeScannerInstanceID;
|
||||
private ActivityContabDocInterniEditBinding binding;
|
||||
public BindableString documentHeader = new BindableString(true);
|
||||
public BindableString documentRifHeader = new BindableString(true);
|
||||
@@ -238,12 +238,12 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
||||
}
|
||||
|
||||
public void manualSearch() {
|
||||
BarcodeManager.disable();
|
||||
BarcodeManager.disable(mBarcodeScannerInstanceID);
|
||||
DialogSimpleInputHelper.makeInputDialog(this,
|
||||
"Ricerca articolo",
|
||||
null,
|
||||
"Cod articolo / Barcode",
|
||||
barcodeProd -> this.viewModel.loadArticoloByCodMartOrBarcode(barcodeProd), BarcodeManager::enable).show();
|
||||
barcodeProd -> this.viewModel.loadArticoloByCodMartOrBarcode(barcodeProd), () -> BarcodeManager.enable(mBarcodeScannerInstanceID)).show();
|
||||
}
|
||||
|
||||
|
||||
@@ -263,7 +263,7 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
||||
return;
|
||||
}
|
||||
|
||||
mBarcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
||||
mBarcodeScannerInstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
||||
.setOnScanSuccessful(this.viewModel::processBarcode)
|
||||
.setOnScanFailed(this::onError));
|
||||
this.viewModel.fetchDocumentRows();
|
||||
@@ -271,7 +271,7 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
BarcodeManager.removeCallback(mBarcodeScannerIstanceID);
|
||||
BarcodeManager.removeCallback(mBarcodeScannerInstanceID);
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@@ -356,7 +356,9 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
||||
|
||||
if (!dialogInputQuantityV2View.isAdded())
|
||||
dialogInputQuantityV2View.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
|
||||
.setOnComplete((resultDTO, shouldCloseLU) -> {
|
||||
.setOnComplete(resultDTO -> {
|
||||
if(resultDTO == null || resultDTO.isAborted()) return;
|
||||
|
||||
this.onLoadingStarted();
|
||||
this.viewModel.saveRow(row, resultDTO);
|
||||
})
|
||||
@@ -385,7 +387,7 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
BarcodeManager.removeCallback(mBarcodeScannerIstanceID);
|
||||
BarcodeManager.removeCallback(mBarcodeScannerInstanceID);
|
||||
super.onBackPressed();
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ public class ElencoInventariFragment extends BaseFragment implements ITitledFrag
|
||||
|
||||
public ObservableField<Boolean> canCreateInventario = new ObservableField<>(false);
|
||||
|
||||
private int barcodeScannerIstanceID = -1;
|
||||
private int mBarcodeScannerInstanceID = -1;
|
||||
|
||||
public ElencoInventariFragment() {
|
||||
// Required empty public constructor
|
||||
|
||||
@@ -61,7 +61,7 @@ public class PickingInventarioActivity extends BaseActivity implements PickingIn
|
||||
|
||||
private static final String KEY_INVENTARIO = "key_inventario";
|
||||
private static final String KEY_INVENTARIO_ARTS = "key_inventario_arts";
|
||||
private int barcodeScannerIstanceID;
|
||||
private int mBarcodeScannerInstanceID;
|
||||
|
||||
//Pass here all external parameters
|
||||
public static void startActivity(Context context, InventarioEntity inventarioEntity, List<InventarioArtDTO> inventarioArts) {
|
||||
@@ -125,7 +125,7 @@ public class PickingInventarioActivity extends BaseActivity implements PickingIn
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
BarcodeManager.removeCallback(barcodeScannerIstanceID);
|
||||
BarcodeManager.removeCallback(mBarcodeScannerInstanceID);
|
||||
super.onBackPressed();
|
||||
}
|
||||
|
||||
@@ -177,7 +177,7 @@ public class PickingInventarioActivity extends BaseActivity implements PickingIn
|
||||
}
|
||||
|
||||
private void initBarcodeReader() {
|
||||
barcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
||||
mBarcodeScannerInstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
||||
.setOnScanSuccessful(onScanSuccessful)
|
||||
.setOnScanFailed(ex -> UtilityExceptions.defaultException(this, ex, false)));
|
||||
}
|
||||
@@ -209,14 +209,14 @@ public class PickingInventarioActivity extends BaseActivity implements PickingIn
|
||||
}
|
||||
|
||||
public void manualSearch() {
|
||||
BarcodeManager.disable();
|
||||
BarcodeManager.disable(mBarcodeScannerInstanceID);
|
||||
DialogSimpleInputHelper.makeInputDialog(this,
|
||||
"Ricerca articolo",
|
||||
null,
|
||||
"Cod articolo / Barcode",
|
||||
barcodeProd ->
|
||||
this.mViewModel.loadArticoloByCodMartOrBarcode(barcodeProd, BarcodeManager::enable),
|
||||
BarcodeManager::enable)
|
||||
this.mViewModel.loadArticoloByCodMartOrBarcode(barcodeProd, () -> BarcodeManager.enable(mBarcodeScannerInstanceID)),
|
||||
() -> BarcodeManager.enable(mBarcodeScannerInstanceID))
|
||||
.show();
|
||||
}
|
||||
|
||||
@@ -241,7 +241,9 @@ public class PickingInventarioActivity extends BaseActivity implements PickingIn
|
||||
|
||||
if (!mDialogInputQuantityV2View.isVisible())
|
||||
mDialogInputQuantityV2View.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
|
||||
.setOnComplete((resultDTO, shouldCloseLU) -> {
|
||||
.setOnComplete(resultDTO -> {
|
||||
if(resultDTO == null || resultDTO.isAborted()) return;
|
||||
|
||||
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO()
|
||||
.setNumCnf(resultDTO.getNumCnf())
|
||||
.setQtaCnf(resultDTO.getQtaCnf())
|
||||
@@ -249,7 +251,7 @@ public class PickingInventarioActivity extends BaseActivity implements PickingIn
|
||||
.setPartitaMag(resultDTO.getPartitaMag())
|
||||
.setDataScad(resultDTO.getDataScad());
|
||||
|
||||
onComplete.run(pickedQuantityDTO, shouldCloseLU);
|
||||
onComplete.run(pickedQuantityDTO, pickedQuantityDTO.isShouldCloseLu());
|
||||
})
|
||||
.show(getSupportFragmentManager(), "tag");
|
||||
}
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -77,6 +77,9 @@ public class MainActivity extends BaseActivity
|
||||
@Inject
|
||||
DialogProgressView mDialogProgressView;
|
||||
|
||||
@Inject
|
||||
ServerStatusChecker serverStatusChecker;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -194,7 +197,7 @@ public class MainActivity extends BaseActivity
|
||||
fragment = new MainSettingsFragment();
|
||||
this.adaptViewToFragment(fragment);
|
||||
} else if (id == R.id.nav_logout) {
|
||||
ServerStatusChecker.dispose();
|
||||
serverStatusChecker.dispose();
|
||||
this.mainContext.logout(() -> {
|
||||
startLoginActivity();
|
||||
});
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.animation.ObjectAnimator;
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -20,8 +21,8 @@ import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
@@ -31,8 +32,6 @@ import it.integry.integrywmsnative.core.class_router.configs.BaseMenuConfigurati
|
||||
import it.integry.integrywmsnative.core.class_router.configs.MenuConfiguration;
|
||||
import it.integry.integrywmsnative.core.data_recover.ColliDataRecoverDTO;
|
||||
import it.integry.integrywmsnative.core.data_recover.ColliDataRecoverService;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgss;
|
||||
import it.integry.integrywmsnative.core.interfaces.IScrollableFragment;
|
||||
import it.integry.integrywmsnative.core.interfaces.ITitledFragment;
|
||||
import it.integry.integrywmsnative.core.menu.MenuService;
|
||||
@@ -43,7 +42,6 @@ import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsume
|
||||
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.model.uds.CloseUDSResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.watcher.ServerStatusChecker;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDimension;
|
||||
@@ -70,6 +68,11 @@ public class MainFragment extends Fragment implements ITitledFragment, IScrollab
|
||||
@Inject
|
||||
ColliLavorazioneRESTConsumer colliLavorazioneRESTConsumer;
|
||||
|
||||
@Inject
|
||||
ExecutorService executorService;
|
||||
|
||||
@Inject
|
||||
Handler handler;
|
||||
|
||||
@Inject
|
||||
MenuService menuService;
|
||||
@@ -77,6 +80,9 @@ public class MainFragment extends Fragment implements ITitledFragment, IScrollab
|
||||
@Inject
|
||||
ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer;
|
||||
|
||||
@Inject
|
||||
ServerStatusChecker serverStatusChecker;
|
||||
|
||||
private FragmentMainBinding mBindings;
|
||||
|
||||
private final List<Runnable> mOnPreDestroyList = new ArrayList<>();
|
||||
@@ -141,7 +147,7 @@ public class MainFragment extends Fragment implements ITitledFragment, IScrollab
|
||||
|
||||
|
||||
private void init() {
|
||||
ServerStatusChecker.getInstance().addCallback(value -> {
|
||||
serverStatusChecker.addCallback(value -> {
|
||||
if (value && mBindings.noConnectionTopLayout.isExpanded()) {
|
||||
collapseNoConnectionLayout();
|
||||
} else if (!value && !mBindings.noConnectionTopLayout.isExpanded()) {
|
||||
@@ -170,46 +176,31 @@ public class MainFragment extends Fragment implements ITitledFragment, IScrollab
|
||||
|
||||
private void initRecuperoCollo() {
|
||||
if (colliDataRecoverService.thereIsAnExistantSession()) {
|
||||
|
||||
startRecoverMode();
|
||||
|
||||
List<Exception> generatedErrors = new ArrayList<>();
|
||||
executorService.execute(() -> {
|
||||
|
||||
Iterator<Integer> sessionsIterator = colliDataRecoverService.getAllSessionIDs().iterator();
|
||||
|
||||
cyclicRecover(sessionsIterator, () -> {
|
||||
List<Exception> generatedErrors = new ArrayList<>();
|
||||
for (var sessionIds : colliDataRecoverService.getAllSessionIDs()) {
|
||||
try {
|
||||
recoverUL(sessionIds);
|
||||
} catch (Exception ex) {
|
||||
generatedErrors.add(ex);
|
||||
}
|
||||
}
|
||||
|
||||
for (Exception ex : generatedErrors) {
|
||||
UtilityExceptions.defaultException(getActivity(), ex);
|
||||
}
|
||||
|
||||
endRecoverMode();
|
||||
}, generatedErrors::add);
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void cyclicRecover(Iterator<Integer> sessionsIterator, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
RunnableArgss<Exception, Integer> tmpOnFailed = (ex, recoveredMtbColtID) -> {
|
||||
if (ex.getMessage().contains("Dati entity mtb_colt non trovati") ||
|
||||
ex.getMessage().contains("Dati collo non corretti") ||
|
||||
(ex.getMessage().contains("Il collo numero") && ex.getMessage().contains("non esiste")) ||
|
||||
ex.getMessage().contains("Impossibile eliminare un collo agganciato a documento")) {
|
||||
colliDataRecoverService.closeSession(recoveredMtbColtID);
|
||||
onFailed.run(ex);
|
||||
} else {
|
||||
onFailed.run(ex);
|
||||
}
|
||||
|
||||
cyclicRecover(sessionsIterator, onComplete, onFailed);
|
||||
};
|
||||
|
||||
if (!sessionsIterator.hasNext()) {
|
||||
onComplete.run();
|
||||
return;
|
||||
}
|
||||
|
||||
Integer recoveredMtbColtID = sessionsIterator.next();
|
||||
private void recoverUL(Integer recoveredMtbColtID) throws Exception {
|
||||
ColliDataRecoverDTO recoveredMtbColtDto = colliDataRecoverService.getSession(recoveredMtbColtID);
|
||||
MtbColt recoveredMtbColt = recoveredMtbColtDto.getMtbColt();
|
||||
|
||||
@@ -218,8 +209,8 @@ public class MainFragment extends Fragment implements ITitledFragment, IScrollab
|
||||
recoveredMtbColt.getGestioneEnum() == GestioneEnum.LAVORAZIONE)) {
|
||||
|
||||
String codMdep = SettingsManager.i().getUserSession().getDepo().getCodMdep();
|
||||
if(recoveredMtbColtDto.getTestateOrdini() != null &&
|
||||
!recoveredMtbColtDto.getTestateOrdini().isEmpty()){
|
||||
if (recoveredMtbColtDto.getTestateOrdini() != null &&
|
||||
!recoveredMtbColtDto.getTestateOrdini().isEmpty()) {
|
||||
codMdep = recoveredMtbColtDto.getTestateOrdini().get(0).getCodMdep();
|
||||
}
|
||||
|
||||
@@ -228,26 +219,29 @@ public class MainFragment extends Fragment implements ITitledFragment, IScrollab
|
||||
//.setPrintSSCC(shouldPrint)
|
||||
.setOrderCodMdep(codMdep);
|
||||
|
||||
RunnableArgs<CloseUDSResponseDTO> onRequestComplete = closeUDSResponseDto -> {
|
||||
colliDataRecoverService.closeSession(recoveredMtbColtID);
|
||||
cyclicRecover(sessionsIterator, onComplete, onFailed);
|
||||
};
|
||||
try {
|
||||
switch (recoveredMtbColt.getGestioneEnum()) {
|
||||
case LAVORAZIONE:
|
||||
colliLavorazioneRESTConsumer.closeUDSSynchronized(closeUDSRequestDto);
|
||||
break;
|
||||
case VENDITA:
|
||||
colliSpedizioneRESTConsumer.closeUDSSynchronized(closeUDSRequestDto);
|
||||
break;
|
||||
}
|
||||
|
||||
switch (recoveredMtbColt.getGestioneEnum()) {
|
||||
case LAVORAZIONE:
|
||||
colliLavorazioneRESTConsumer.closeUDS(closeUDSRequestDto, onRequestComplete, ex -> {
|
||||
tmpOnFailed.run(ex, recoveredMtbColtID);
|
||||
});
|
||||
break;
|
||||
case VENDITA:
|
||||
colliSpedizioneRESTConsumer.closeUDS(closeUDSRequestDto, onRequestComplete, ex -> {
|
||||
tmpOnFailed.run(ex, recoveredMtbColtID);
|
||||
});
|
||||
break;
|
||||
colliDataRecoverService.closeSession(recoveredMtbColtID);
|
||||
} catch (Exception ex) {
|
||||
if (ex.getMessage().contains("Dati entity mtb_colt non trovati") ||
|
||||
ex.getMessage().contains("Dati collo non corretti") ||
|
||||
(ex.getMessage().contains("Il collo numero") && ex.getMessage().contains("non esiste")) ||
|
||||
ex.getMessage().contains("Impossibile eliminare un collo agganciato a documento")) {
|
||||
colliDataRecoverService.closeSession(recoveredMtbColtID);
|
||||
}
|
||||
|
||||
throw ex;
|
||||
}
|
||||
} else {
|
||||
colliDataRecoverService.closeSession(recoveredMtbColtID);
|
||||
cyclicRecover(sessionsIterator, onComplete, onFailed);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -267,7 +261,9 @@ public class MainFragment extends Fragment implements ITitledFragment, IScrollab
|
||||
}
|
||||
|
||||
private void endRecoverMode() {
|
||||
mBindings.recoverDataExpandableLayout.collapse(true);
|
||||
handler.post(() -> {
|
||||
mBindings.recoverDataExpandableLayout.collapse(true);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,7 +2,9 @@ package it.integry.integrywmsnative.gest.ordini_uscita_elenco;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.text.Html;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -41,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;
|
||||
@@ -68,12 +70,12 @@ import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.FilterViagg
|
||||
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.OrdiniUscitaElencoFiltroViewModel;
|
||||
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.ui.OrdiniUscitaElencoAdapter;
|
||||
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.ui.OrdiniUscitaElencoListModel;
|
||||
import it.integry.integrywmsnative.ui.filter_chips.filters.FilterCommessaLayoutView;
|
||||
import it.integry.integrywmsnative.gest.spedizione.SpedizioneActivity;
|
||||
import it.integry.integrywmsnative.gest.spedizione.dialogs.row_info.BaseDialogRowInfoView;
|
||||
import it.integry.integrywmsnative.ui.ElevatedToolbar;
|
||||
import it.integry.integrywmsnative.ui.filter_chips.FilterChipDTO;
|
||||
import it.integry.integrywmsnative.ui.filter_chips.FilterChipView;
|
||||
import it.integry.integrywmsnative.ui.filter_chips.filters.FilterCommessaLayoutView;
|
||||
import it.integry.integrywmsnative.ui.filter_chips.filters.FilterNumeroOrdineLayoutView;
|
||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||
|
||||
@@ -93,6 +95,9 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
|
||||
@Inject
|
||||
OrdiniUscitaElencoViewModel mViewModel;
|
||||
|
||||
@Inject
|
||||
Handler handler;
|
||||
|
||||
private final OrdiniUscitaElencoFiltroViewModel mAppliedFilterViewModel = new OrdiniUscitaElencoFiltroViewModel();
|
||||
|
||||
private FragmentMainOrdiniUscitaBinding mBindings = null;
|
||||
@@ -107,7 +112,7 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
|
||||
private ElevatedToolbar mToolbar;
|
||||
private final List<Runnable> mOnPreDestroyList = new ArrayList<>();
|
||||
|
||||
private int barcodeScannerIstanceID = -1;
|
||||
private int mBarcodeScannerInstanceID = -1;
|
||||
|
||||
private List<MtbDepo> mtbDepoCache;
|
||||
private List<MtbGrup> mtbGrupCache;
|
||||
@@ -164,29 +169,58 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
|
||||
mBindings.setView(this);
|
||||
mBindings.setViewmodel(mViewModel);
|
||||
|
||||
this.initRecyclerView();
|
||||
Log.d("onCreateView", "Started");
|
||||
|
||||
this.initBarcodeReader();
|
||||
|
||||
this.initFilters();
|
||||
|
||||
Log.d("onCreateView", "Ended");
|
||||
return mBindings.getRoot();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
this.onLoadingStarted();
|
||||
|
||||
this.initMtbDepoCache(() -> {
|
||||
String codMdep = SettingsManager.i().getUserSession().getDepo().getCodMdep();
|
||||
mViewModel.init(codMdep, mCurrentGestioneOrd, mCurrentGestioneCol, mCurrentSegnoCol);
|
||||
Log.d("onStart", "Started");
|
||||
this.mViewModel.getOrderList().observe(getViewLifecycleOwner(), data -> {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
this.onLoadingStarted();
|
||||
|
||||
this.initMtbDepoCache();
|
||||
this.initMtbGrupsCache();
|
||||
this.initJtbComtCache();
|
||||
|
||||
handler.post(() -> {
|
||||
mAppliedFilterViewModel.init(data);
|
||||
this.refreshList(data, null);
|
||||
});
|
||||
|
||||
this.onLoadingEnded();
|
||||
} catch (Exception e) {
|
||||
onError(e);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
this.onLoadingStarted();
|
||||
|
||||
this.initRecyclerView();
|
||||
this.initFilters();
|
||||
|
||||
String codMdep = SettingsManager.i().getUserSession().getDepo().getCodMdep();
|
||||
mViewModel.init(codMdep, mCurrentGestioneOrd, mCurrentGestioneCol, mCurrentSegnoCol, () -> {
|
||||
this.onLoadingEnded();
|
||||
});
|
||||
|
||||
Log.d("onStart", "Ended");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
BarcodeManager.removeCallback(barcodeScannerIstanceID);
|
||||
BarcodeManager.removeCallback(mBarcodeScannerInstanceID);
|
||||
|
||||
for (Runnable onPreDestroy : mOnPreDestroyList) {
|
||||
onPreDestroy.run();
|
||||
@@ -201,16 +235,6 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
|
||||
boolean canSelectMultipleOrdini = SettingsManager.iDB().isFlagSpedizioneCanSelectMultipleOrders();
|
||||
boolean canSelectMultipleClienti = SettingsManager.iDB().isFlagMultiClienteOrdV();
|
||||
|
||||
this.mViewModel.getOrderList().observe(getViewLifecycleOwner(), v -> {
|
||||
this.onLoadingStarted();
|
||||
this.initMtbGrupsCache(() -> {
|
||||
this.initJtbComtCache(this::onLoadingEnded);
|
||||
});
|
||||
|
||||
mAppliedFilterViewModel.init(mViewModel.getOrderList().getValue());
|
||||
|
||||
this.refreshList(null);
|
||||
});
|
||||
|
||||
OrdiniUscitaElencoAdapter ordiniUscitaElencoAdapter =
|
||||
new OrdiniUscitaElencoAdapter(getActivity(), mOrdiniInevasiMutableData)
|
||||
@@ -243,26 +267,28 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
|
||||
ordiniUscitaElencoAdapter
|
||||
.setEmptyView(this.mBindings.ordiniVenditaEmptyView);
|
||||
|
||||
this.mBindings.venditaMainList.setAdapter(ordiniUscitaElencoAdapter);
|
||||
this.mBindings.venditaMainList.setLayoutManager(new LinearLayoutManager(getActivity()));
|
||||
this.mBindings.venditaMainList.setItemViewCacheSize(20);
|
||||
this.mBindings.venditaMainList.setAdapter(ordiniUscitaElencoAdapter);
|
||||
|
||||
|
||||
// if (mToolbar != null)
|
||||
// mToolbar.setRecyclerView(this.mBindings.venditaMainList);
|
||||
}
|
||||
|
||||
private void initBarcodeReader() {
|
||||
barcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
||||
mBarcodeScannerInstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
||||
.setOnScanSuccessful(onScanSuccessful)
|
||||
.setOnScanFailed(ex -> UtilityExceptions.defaultException(getActivity(), ex, false)));
|
||||
|
||||
BarcodeManager.enable();
|
||||
BarcodeManager.enable(mBarcodeScannerInstanceID);
|
||||
}
|
||||
|
||||
private void initFilters() {
|
||||
var onPredicateChanged = new OnGeneralChangedCallback() {
|
||||
@Override
|
||||
public void run() {
|
||||
refreshList(null);
|
||||
refreshList(mViewModel.getOrderList().getValue(), null);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -714,27 +740,25 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
|
||||
this.mViewModel.processBarcodeDTO(data, this::onLoadingEnded);
|
||||
};
|
||||
|
||||
private void refreshList(List<OrdiniUscitaElencoDTO> filteredList) {
|
||||
requireActivity().runOnUiThread(() -> {
|
||||
List<OrdiniUscitaElencoDTO> tmpList;
|
||||
private void refreshList(List<OrdiniUscitaElencoDTO> originalData, List<OrdiniUscitaElencoDTO> filteredList) {
|
||||
List<OrdiniUscitaElencoDTO> tmpList;
|
||||
|
||||
if (filteredList != null) {
|
||||
tmpList = filteredList;
|
||||
} else if (mAppliedFilterViewModel != null) {
|
||||
mAppliedFilterViewModel.applyAllTests();
|
||||
tmpList = mAppliedFilterViewModel.getMutableFilteredOrderList().getValue();
|
||||
} else {
|
||||
tmpList = mViewModel.getOrderList().getValue();
|
||||
}
|
||||
if (filteredList != null) {
|
||||
tmpList = filteredList;
|
||||
} else if (mAppliedFilterViewModel != null) {
|
||||
mAppliedFilterViewModel.applyAllTests();
|
||||
tmpList = mAppliedFilterViewModel.getMutableFilteredOrderList().getValue();
|
||||
} else {
|
||||
tmpList = originalData;
|
||||
}
|
||||
|
||||
var list = convertDataModelToListModel(tmpList);
|
||||
var list = convertDataModelToListModel(tmpList);
|
||||
|
||||
this.mOrdiniInevasiMutableData.clear();
|
||||
this.mOrdiniInevasiMutableData.addAll(list);
|
||||
this.mOrdiniInevasiMutableData.clear();
|
||||
this.mOrdiniInevasiMutableData.addAll(list);
|
||||
|
||||
fabVisible.set(mOrdiniInevasiMutableData.stream()
|
||||
.anyMatch(y -> y.getSelectedObservable().get()));
|
||||
});
|
||||
fabVisible.set(mOrdiniInevasiMutableData.stream()
|
||||
.anyMatch(y -> y.getSelectedObservable().get()));
|
||||
}
|
||||
|
||||
private List<OrdiniUscitaElencoListModel> convertDataModelToListModel(List<OrdiniUscitaElencoDTO> dataList) {
|
||||
@@ -744,7 +768,7 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
|
||||
.thenComparing(ComparatorCompat.comparing(x -> x.getDestinatario() != null ? x.getDestinatario() : "zzzzzzzzz"))
|
||||
.thenComparing(ComparatorCompat.comparing(OrdiniUscitaElencoDTO::getNumOrd));
|
||||
|
||||
List<OrdiniUscitaElencoListModel> notHiddenElements = Stream.of(dataList)
|
||||
List<OrdiniUscitaElencoListModel> notHiddenElements = dataList.stream()
|
||||
.filter(x -> !x.isHidden())
|
||||
.sorted(comparator)
|
||||
.map(x -> {
|
||||
@@ -774,7 +798,7 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
|
||||
|
||||
return listModel;
|
||||
})
|
||||
.toList();
|
||||
.collect(Collectors.toList());
|
||||
|
||||
return notHiddenElements;
|
||||
}
|
||||
@@ -782,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));
|
||||
}
|
||||
|
||||
@@ -803,22 +827,22 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
|
||||
|
||||
@Override
|
||||
public void onFilterNumOrderApplied(List<OrdiniUscitaElencoDTO> filteredOrder) {
|
||||
requireActivity().runOnUiThread(() -> {
|
||||
var numOrders = Stream.of(filteredOrder)
|
||||
handler.post(() -> {
|
||||
var numOrders = filteredOrder.parallelStream()
|
||||
.map(OrdineInevasoDTO::getNumOrd)
|
||||
.distinct()
|
||||
.toList();
|
||||
.collect(Collectors.toList());
|
||||
this.mAppliedFilterViewModel.setNumOrdFilter(numOrders);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOrderFiltered(List<OrdiniUscitaElencoDTO> filteredOrders) {
|
||||
refreshList(filteredOrders);
|
||||
refreshList(mViewModel.getOrderList().getValue(), filteredOrders);
|
||||
}
|
||||
|
||||
@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)
|
||||
@@ -838,7 +862,6 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
|
||||
() -> SpedizioneActivity.startActivity(getActivity(),
|
||||
sitArts,
|
||||
orders,
|
||||
alreadyRegisteredMtbColts,
|
||||
mCurrentGestioneCol,
|
||||
mCurrentSegnoCol,
|
||||
MtbColr.Causale.DEFAULT,
|
||||
@@ -874,38 +897,34 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
|
||||
}
|
||||
|
||||
|
||||
private void initMtbDepoCache(Runnable onComplete) {
|
||||
this.mDepositoRESTConsumer.getAll(mtbDepos -> {
|
||||
this.mtbDepoCache = mtbDepos;
|
||||
onComplete.run();
|
||||
}, this::onError);
|
||||
private void initMtbDepoCache() throws Exception {
|
||||
var mtbDepos = this.mDepositoRESTConsumer.getAllSynchronized();
|
||||
this.mtbDepoCache = mtbDepos;
|
||||
}
|
||||
|
||||
|
||||
private void initMtbGrupsCache(Runnable onComplete) {
|
||||
var codMgrpArts = Stream.of(Objects.requireNonNull(this.mViewModel.getOrderList().getValue()))
|
||||
.flatMap(x -> Stream.of(x.getAvailableClassMerc() != null ? x.getAvailableClassMerc() : new ArrayList<>()))
|
||||
private void initMtbGrupsCache() throws Exception {
|
||||
var codMgrpArts = Objects.requireNonNull(this.mViewModel.getOrderList().getValue()).parallelStream()
|
||||
.filter(x -> x.getAvailableClassMerc() != null && !x.getAvailableClassMerc().isEmpty())
|
||||
.flatMap(x -> x.getAvailableClassMerc().stream())
|
||||
.map(OrdineUscitaInevasoDTO.AvailableClassMerc::getCodMgrp)
|
||||
.withoutNulls()
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.toList();
|
||||
.collect(Collectors.toList());
|
||||
|
||||
this.mArticoloRESTConsumer.getArtsGroups(codMgrpArts, mtbGrupCache -> {
|
||||
this.mtbGrupCache = mtbGrupCache;
|
||||
onComplete.run();
|
||||
}, this::onError);
|
||||
var mtbGrupCache = this.mArticoloRESTConsumer.getArtsGroupsSynchronized(codMgrpArts);
|
||||
this.mtbGrupCache = mtbGrupCache;
|
||||
}
|
||||
|
||||
|
||||
private void initJtbComtCache(Runnable onComplete) {
|
||||
private void initJtbComtCache() throws Exception {
|
||||
if (this.mViewModel.getOrderList().getValue() == null) {
|
||||
this.jtbComtCache = new ArrayList<>();
|
||||
onComplete.run();
|
||||
return;
|
||||
}
|
||||
|
||||
List<String> jtbComts = null;
|
||||
if(this.mViewModel.getOrderList().getValue() != null) {
|
||||
if (this.mViewModel.getOrderList().getValue() != null) {
|
||||
jtbComts = this.mViewModel.getOrderList().getValue().stream()
|
||||
.map(OrdineUscitaInevasoDTO::getCodJcom)
|
||||
.distinct()
|
||||
@@ -915,13 +934,10 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
|
||||
|
||||
if (jtbComts == null || jtbComts.isEmpty()) {
|
||||
this.jtbComtCache = new ArrayList<>();
|
||||
onComplete.run();
|
||||
return;
|
||||
}
|
||||
|
||||
this.mCommessaRESTConsumer.getJtbComts(jtbComts, jtbComtCache -> {
|
||||
this.jtbComtCache = jtbComtCache;
|
||||
onComplete.run();
|
||||
}, this::onError);
|
||||
var jtbComtCache = this.mCommessaRESTConsumer.getJtbComtsSynchronized(jtbComts);
|
||||
this.jtbComtCache = jtbComtCache;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
package it.integry.integrywmsnative.gest.ordini_uscita_elenco;
|
||||
|
||||
import android.os.Handler;
|
||||
|
||||
import java.util.concurrent.ExecutorService;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import dagger.Module;
|
||||
@@ -20,8 +24,8 @@ public class OrdiniUscitaElencoModule {
|
||||
}
|
||||
|
||||
@Provides
|
||||
OrdiniUscitaElencoViewModel providesProdOrdineLavorazioneElencoViewModel(OrdiniRESTConsumer ordiniRESTConsumer, ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer, BarcodeRESTConsumer barcodeRESTConsumer, OrdiniUscitaElencoRESTConsumer ordiniUscitaElencoRESTConsumer) {
|
||||
return new OrdiniUscitaElencoViewModel(ordiniRESTConsumer, colliMagazzinoRESTConsumer, barcodeRESTConsumer, ordiniUscitaElencoRESTConsumer);
|
||||
OrdiniUscitaElencoViewModel providesProdOrdineLavorazioneElencoViewModel(Handler handler, ExecutorService executorService, OrdiniRESTConsumer ordiniRESTConsumer, ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer, BarcodeRESTConsumer barcodeRESTConsumer, OrdiniUscitaElencoRESTConsumer ordiniUscitaElencoRESTConsumer) {
|
||||
return new OrdiniUscitaElencoViewModel(handler, executorService, ordiniRESTConsumer, colliMagazzinoRESTConsumer, barcodeRESTConsumer, ordiniUscitaElencoRESTConsumer);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,6 +8,9 @@ import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
@@ -20,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;
|
||||
@@ -37,6 +40,8 @@ public class OrdiniUscitaElencoViewModel {
|
||||
|
||||
private final MutableLiveData<List<OrdiniUscitaElencoDTO>> mOrderList = new MutableLiveData<>();
|
||||
|
||||
private final android.os.Handler mHandler;
|
||||
private final ExecutorService executorService;
|
||||
private final OrdiniRESTConsumer mOrdiniRESTConsumer;
|
||||
private final ColliMagazzinoRESTConsumer mColliMagazzinoRESTConsumer;
|
||||
private final BarcodeRESTConsumer mBarcodeRESTConsumer;
|
||||
@@ -49,7 +54,14 @@ public class OrdiniUscitaElencoViewModel {
|
||||
private int mCurrentSegnoCol;
|
||||
|
||||
@Inject
|
||||
public OrdiniUscitaElencoViewModel(OrdiniRESTConsumer ordiniRESTConsumer, ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer, BarcodeRESTConsumer barcodeRESTConsumer, OrdiniUscitaElencoRESTConsumer ordiniUscitaElencoRESTConsumer) {
|
||||
public OrdiniUscitaElencoViewModel(android.os.Handler handler,
|
||||
ExecutorService executorService,
|
||||
OrdiniRESTConsumer ordiniRESTConsumer,
|
||||
ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer,
|
||||
BarcodeRESTConsumer barcodeRESTConsumer,
|
||||
OrdiniUscitaElencoRESTConsumer ordiniUscitaElencoRESTConsumer) {
|
||||
this.mHandler = handler;
|
||||
this.executorService = executorService;
|
||||
this.mOrdiniRESTConsumer = ordiniRESTConsumer;
|
||||
this.mColliMagazzinoRESTConsumer = colliMagazzinoRESTConsumer;
|
||||
this.mBarcodeRESTConsumer = barcodeRESTConsumer;
|
||||
@@ -57,39 +69,36 @@ public class OrdiniUscitaElencoViewModel {
|
||||
}
|
||||
|
||||
|
||||
public void init(String currentCodMdep, GestioneEnum gestioneOrd, GestioneEnum gestioneCol, int segnoCol) {
|
||||
public void init(String currentCodMdep, GestioneEnum gestioneOrd, GestioneEnum gestioneCol, int segnoCol, Runnable onComplete) {
|
||||
this.mCurrentCodMdep = currentCodMdep;
|
||||
this.mCurrentGestioneOrd = gestioneOrd;
|
||||
this.mCurrentGestioneCol = gestioneCol;
|
||||
this.mCurrentSegnoCol = segnoCol;
|
||||
|
||||
this.sendOnLoadingStarted();
|
||||
|
||||
Date loadingStartDate = new Date();
|
||||
executorService.execute(() -> {
|
||||
|
||||
this.mOrdiniRESTConsumer.getOrdiniInevasi(this.mCurrentCodMdep, mCurrentGestioneOrd,
|
||||
ordiniLavorazione -> {
|
||||
this.mOrderList.postValue(Stream.of(ordiniLavorazione)
|
||||
.map(x -> {
|
||||
try {
|
||||
return OrdiniUscitaElencoDTO.fromParent(x);
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
})
|
||||
.toList());
|
||||
List<OrdineUscitaInevasoDTO> ordiniLavorazione = null;
|
||||
try {
|
||||
ordiniLavorazione = this.mOrdiniRESTConsumer.getOrdiniInevasiSynchronized(this.mCurrentCodMdep, mCurrentGestioneOrd);
|
||||
|
||||
long forcedDelaySecs = (new Date().getTime() - loadingStartDate.getTime()) / 1000;
|
||||
var orderList = ordiniLavorazione.parallelStream()
|
||||
.map(x -> {
|
||||
try {
|
||||
return OrdiniUscitaElencoDTO.fromParent(x);
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
})
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if (2 - forcedDelaySecs > 0) {
|
||||
try {
|
||||
Thread.sleep((2 - forcedDelaySecs) * 1000);
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
this.sendOnLoadingEnded();
|
||||
}, this::sendError);
|
||||
this.mOrderList.postValue(orderList);
|
||||
onComplete.run();
|
||||
} catch (Exception e) {
|
||||
this.sendError(e);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
@@ -137,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);
|
||||
@@ -294,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);
|
||||
}
|
||||
@@ -307,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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -11,13 +11,13 @@ import androidx.databinding.DataBindingUtil;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import com.annimon.stream.ComparatorCompat;
|
||||
import com.annimon.stream.Stream;
|
||||
import com.ravikoradiya.liveadapter.LiveAdapter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import it.integry.integrywmsnative.BR;
|
||||
import it.integry.integrywmsnative.R;
|
||||
@@ -48,9 +48,9 @@ public class FilterClienteLayoutView extends FilterLayoutView {
|
||||
refreshList();
|
||||
|
||||
this.setSearchView(this.mBindings.searchView, newFilter -> {
|
||||
hiddenClienti = Stream.of(allClienti)
|
||||
hiddenClienti = allClienti.parallelStream()
|
||||
.filter(x -> !x.toUpperCase(Locale.ROOT).contains(newFilter.toUpperCase(Locale.ROOT)))
|
||||
.toList();
|
||||
.collect(Collectors.toList());
|
||||
|
||||
refreshList();
|
||||
});
|
||||
@@ -70,7 +70,7 @@ public class FilterClienteLayoutView extends FilterLayoutView {
|
||||
.thenComparing(new ComparatorCompat<>((x, y) -> y.getOriginalModel().compareTo(x.getOriginalModel())))
|
||||
.reversed();
|
||||
|
||||
listModel.setValue(Stream.of(getAllClienti())
|
||||
listModel.setValue(getAllClienti().parallelStream()
|
||||
.filter(x -> !hiddenClienti.contains(x))
|
||||
.map(x -> {
|
||||
var selectedBoolean = new BindableBoolean(preSelectedClienti.contains(x));
|
||||
@@ -85,17 +85,17 @@ public class FilterClienteLayoutView extends FilterLayoutView {
|
||||
.setOriginalModel(x);
|
||||
})
|
||||
.sorted(c)
|
||||
.toList());
|
||||
.collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
|
||||
public void onConfirm() {
|
||||
if (onFilterApplied == null) return;
|
||||
|
||||
this.onFilterApplied.run(Stream.of(Objects.requireNonNull(listModel.getValue()))
|
||||
this.onFilterApplied.run(Objects.requireNonNull(listModel.getValue()).parallelStream()
|
||||
.filter(x -> x.selected.get())
|
||||
.map(x -> x.originalModel)
|
||||
.toList());
|
||||
.collect(Collectors.toList()));
|
||||
|
||||
dismiss();
|
||||
}
|
||||
|
||||
@@ -9,9 +9,11 @@ import com.annimon.stream.function.Predicate;
|
||||
import org.apache.commons.lang3.time.DateUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.JtbComt;
|
||||
import it.integry.integrywmsnative.core.model.MtbDepo;
|
||||
@@ -349,13 +351,12 @@ public class OrdiniUscitaElencoFiltroViewModel {
|
||||
|
||||
|
||||
public List<Integer> getAllNumOrds() {
|
||||
return Stream
|
||||
.of(Objects.requireNonNull(initialOrderList))
|
||||
return Objects.requireNonNull(initialOrderList).parallelStream()
|
||||
.filter(x -> x.getNumOrd() != null)
|
||||
.sortBy(x -> -x.getNumOrd())
|
||||
.sorted(Comparator.comparing(OrdineInevasoDTO::getNumOrd))
|
||||
.map(x -> x.getNumOrd() != null ? x.getNumOrd() : null)
|
||||
.distinct()
|
||||
.toList();
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public List<Integer> getAvailableNumOrds() {
|
||||
|
||||
@@ -8,24 +8,59 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.core.content.res.ResourcesCompat;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import androidx.databinding.ObservableArrayList;
|
||||
import androidx.databinding.ObservableList;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import it.integry.integrywmsnative.R;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import it.integry.integrywmsnative.core.expansion.OnListGeneralChangedCallback;
|
||||
import it.integry.integrywmsnative.core.expansion.OnSingleClickListener;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.expansion.view.ExtendedSectionedRecyclerView;
|
||||
import it.integry.integrywmsnative.core.expansion.view.ExtendedSectionedRecyclerViewNew;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
import it.integry.integrywmsnative.databinding.FragmentMainOrdiniUscitaListGroupModelBinding;
|
||||
import it.integry.integrywmsnative.databinding.FragmentMainOrdiniUscitaListModelBinding;
|
||||
|
||||
public class OrdiniUscitaElencoAdapter extends ExtendedSectionedRecyclerView<OrdiniUscitaElencoListModel, OrdiniUscitaElencoAdapter.SubheaderHolder, OrdiniUscitaElencoAdapter.SingleItemViewHolder> {
|
||||
public class OrdiniUscitaElencoAdapter extends ExtendedSectionedRecyclerViewNew<OrdiniUscitaElencoListModel, OrdiniUscitaElencoAdapter.SubheaderHolder, OrdiniUscitaElencoAdapter.SingleItemViewHolder> {
|
||||
|
||||
private final Context mContext;
|
||||
// private final AsyncLayoutInflater asyncLayoutInflater;
|
||||
private final LayoutInflater layoutInflater;
|
||||
|
||||
private RunnableArgs<String> mOnGroupItemClicked;
|
||||
private RunnableArgs<OrdiniUscitaElencoListModel> mOnItemChecked;
|
||||
|
||||
private final int transparentColor;
|
||||
|
||||
public OrdiniUscitaElencoAdapter(Context context, ObservableArrayList<OrdiniUscitaElencoListModel> mutableDataSet) {
|
||||
super(mutableDataSet);
|
||||
mContext = context;
|
||||
layoutInflater = LayoutInflater.from(mContext);
|
||||
transparentColor = ResourcesCompat.getColor(mContext.getResources(), android.R.color.transparent, null);
|
||||
// asyncLayoutInflater = new AsyncLayoutInflater(mContext);
|
||||
|
||||
mutableDataSet.addOnListChangedCallback(new OnListGeneralChangedCallback<OrdiniUscitaElencoListModel>() {
|
||||
@Override
|
||||
public void onChanged(ObservableList<OrdiniUscitaElencoListModel> sender) {
|
||||
|
||||
Map<String, List<OrdiniUscitaElencoListModel>> collect = sender.stream()
|
||||
.collect(Collectors.groupingBy(OrdiniUscitaElencoListModel::getGroupTitle));
|
||||
|
||||
String[] keyArray = new String[collect.keySet().size()];
|
||||
collect.keySet().toArray(keyArray);
|
||||
|
||||
var keyList = Arrays.asList(keyArray);
|
||||
keyList.sort(String::compareTo);
|
||||
setSections(keyList, collect);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
static class SubheaderHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
FragmentMainOrdiniUscitaListModelBinding mBinding;
|
||||
@@ -47,11 +82,6 @@ public class OrdiniUscitaElencoAdapter extends ExtendedSectionedRecyclerView<Ord
|
||||
}
|
||||
}
|
||||
|
||||
public OrdiniUscitaElencoAdapter(Context context, ObservableArrayList<OrdiniUscitaElencoListModel> mutableDataSet) {
|
||||
super(mutableDataSet);
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
public OrdiniUscitaElencoAdapter setOnGroupItemClicked(RunnableArgs<String> onGroupItemClicked) {
|
||||
this.mOnGroupItemClicked = onGroupItemClicked;
|
||||
return this;
|
||||
@@ -64,59 +94,61 @@ public class OrdiniUscitaElencoAdapter extends ExtendedSectionedRecyclerView<Ord
|
||||
|
||||
|
||||
@Override
|
||||
public OrdiniUscitaElencoAdapter.SubheaderHolder onCreateSubheaderViewHolder(ViewGroup parent, int viewType) {
|
||||
FragmentMainOrdiniUscitaListModelBinding binding = DataBindingUtil.inflate(LayoutInflater.from(mContext), R.layout.fragment_main_ordini_uscita__list_model, parent, false);
|
||||
public OrdiniUscitaElencoAdapter.SubheaderHolder onCreateHeaderViewHolder(ViewGroup parent) {
|
||||
FragmentMainOrdiniUscitaListModelBinding binding = FragmentMainOrdiniUscitaListModelBinding.inflate(layoutInflater, parent, false);
|
||||
return new OrdiniUscitaElencoAdapter.SubheaderHolder(binding);
|
||||
}
|
||||
|
||||
@Override
|
||||
public OrdiniUscitaElencoAdapter.SingleItemViewHolder onCreateItemViewHolder(ViewGroup parent, int viewType) {
|
||||
FragmentMainOrdiniUscitaListGroupModelBinding binding = DataBindingUtil.inflate(LayoutInflater.from(mContext), R.layout.fragment_main_ordini_uscita__list_group_model, parent, false);
|
||||
public OrdiniUscitaElencoAdapter.SingleItemViewHolder onCreateItemViewHolder(ViewGroup parent) {
|
||||
FragmentMainOrdiniUscitaListGroupModelBinding binding = FragmentMainOrdiniUscitaListGroupModelBinding.inflate(layoutInflater, parent, false);
|
||||
return new OrdiniUscitaElencoAdapter.SingleItemViewHolder(binding);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindSubheaderViewHolder(OrdiniUscitaElencoAdapter.SubheaderHolder subheaderHolder, int nextItemPosition) {
|
||||
OrdiniUscitaElencoListModel pickingObjectDTO = this.mDataset.get(nextItemPosition);
|
||||
public void onBindHeaderViewHolder(SubheaderHolder subheaderHolder, Object headerData, int nextItemPosition) {
|
||||
String groupTitle = (String) headerData;
|
||||
|
||||
subheaderHolder.mBinding.groupTitle.setVisibility(UtilityString.isNullOrEmpty(pickingObjectDTO.getGroupTitle()) ? View.GONE : View.VISIBLE);
|
||||
subheaderHolder.mBinding.groupTitle.setText(Html.fromHtml(pickingObjectDTO.getGroupTitle()));
|
||||
subheaderHolder.mBinding.groupTitle.setVisibility(UtilityString.isNullOrEmpty(groupTitle) ? View.GONE : View.VISIBLE);
|
||||
subheaderHolder.mBinding.groupTitle.setText(Html.fromHtml(groupTitle));
|
||||
|
||||
subheaderHolder.mBinding.getRoot().setOnClickListener(new OnSingleClickListener() {
|
||||
@Override
|
||||
public void onSingleClick(View v) {
|
||||
if(mOnGroupItemClicked != null) mOnGroupItemClicked.run(pickingObjectDTO.getGroupTitle());
|
||||
if (mOnGroupItemClicked != null)
|
||||
mOnGroupItemClicked.run(groupTitle);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindItemViewHolder(final OrdiniUscitaElencoAdapter.SingleItemViewHolder holder, final int position) {
|
||||
OrdiniUscitaElencoListModel listModel = this.mDataset.get(position);
|
||||
public void onBindItemViewHolder(final SingleItemViewHolder holder, Object itemData, int sectionPosition, final int position) {
|
||||
OrdiniUscitaElencoListModel listModel = (OrdiniUscitaElencoListModel) itemData;
|
||||
|
||||
listModel.getSelectedObservable().resetOnPropertyChangedCallback();
|
||||
|
||||
if(listModel.getEtichettaColor() != null)
|
||||
if (listModel.getEtichettaColor() != null)
|
||||
holder.mBinding.emptyView.setBackgroundColor(listModel.getEtichettaColor());
|
||||
else holder.mBinding.emptyView.setBackgroundColor(ResourcesCompat.getColor(mContext.getResources(), android.R.color.transparent, null));
|
||||
else
|
||||
holder.mBinding.emptyView.setBackgroundColor(transparentColor);
|
||||
|
||||
if(!UtilityString.isNullOrEmpty(listModel.getDescription())) {
|
||||
holder.mBinding.descrizione.setText(Html.fromHtml(listModel.getDescription()));
|
||||
if (!UtilityString.isNullOrEmpty(listModel.getDescription())) {
|
||||
holder.mBinding.descrizione.setText(listModel.getDescriptionSpanned());
|
||||
holder.mBinding.descrizione.setVisibility(View.VISIBLE);
|
||||
} else holder.mBinding.descrizione.setVisibility(View.GONE);
|
||||
|
||||
if(!UtilityString.isNullOrEmpty(listModel.getSubDescription())) {
|
||||
holder.mBinding.subDescrizione.setText(Html.fromHtml(listModel.getSubDescription()));
|
||||
if (!UtilityString.isNullOrEmpty(listModel.getSubDescription())) {
|
||||
holder.mBinding.subDescrizione.setText(listModel.getSubDescriptionSpanned());
|
||||
holder.mBinding.subDescrizione.setVisibility(View.VISIBLE);
|
||||
} else holder.mBinding.subDescrizione.setVisibility(View.GONE);
|
||||
|
||||
if(!UtilityString.isNullOrEmpty(listModel.getRightDescription())) {
|
||||
holder.mBinding.rightDescrizione.setText(Html.fromHtml(listModel.getRightDescription()));
|
||||
if (!UtilityString.isNullOrEmpty(listModel.getRightDescription())) {
|
||||
holder.mBinding.rightDescrizione.setText(listModel.getRightDescriptionSpanned());
|
||||
holder.mBinding.rightDescrizione.setVisibility(View.VISIBLE);
|
||||
} else holder.mBinding.rightDescrizione.setVisibility(View.GONE);
|
||||
|
||||
if(!UtilityString.isNullOrEmpty(listModel.getRightSubDescription())) {
|
||||
holder.mBinding.rightSubDescrizione.setText(Html.fromHtml(listModel.getRightSubDescription()));
|
||||
if (!UtilityString.isNullOrEmpty(listModel.getRightSubDescription())) {
|
||||
holder.mBinding.rightSubDescrizione.setText(listModel.getRightSubDescriptionSpanned());
|
||||
holder.mBinding.rightSubDescrizione.setVisibility(View.VISIBLE);
|
||||
} else holder.mBinding.rightSubDescrizione.setVisibility(View.GONE);
|
||||
|
||||
@@ -125,25 +157,11 @@ public class OrdiniUscitaElencoAdapter extends ExtendedSectionedRecyclerView<Ord
|
||||
holder.mBinding.checkbox.jumpDrawablesToCurrentState();
|
||||
|
||||
listModel.getSelectedObservable().addOnPropertyChangedCallback(() -> {
|
||||
if(this.mOnItemChecked != null) this.mOnItemChecked.run(listModel);
|
||||
if (this.mOnItemChecked != null) this.mOnItemChecked.run(listModel);
|
||||
});
|
||||
|
||||
holder.mBinding.getRoot().setOnClickListener(v -> {
|
||||
listModel.getSelectedObservable().set(!listModel.getSelectedObservable().get());
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPlaceSubheaderBetweenItems(int position) {
|
||||
|
||||
if (getItemSize() == 1) return true;
|
||||
else if (getItemSize() > 1) {
|
||||
OrdiniUscitaElencoListModel compare1 = this.mDataset.get(position);
|
||||
OrdiniUscitaElencoListModel compare2 = this.mDataset.get(position + 1);
|
||||
|
||||
return !UtilityString.equalsIgnoreCase(compare1.getGroupTitle(), compare2.getGroupTitle());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package it.integry.integrywmsnative.gest.ordini_uscita_elenco.ui;
|
||||
|
||||
import android.text.Html;
|
||||
import android.text.Spanned;
|
||||
|
||||
import androidx.annotation.ColorInt;
|
||||
|
||||
import it.integry.integrywmsnative.core.di.BindableBoolean;
|
||||
@@ -13,6 +16,11 @@ public class OrdiniUscitaElencoListModel implements Cloneable {
|
||||
private String rightDescription;
|
||||
private String rightSubDescription;
|
||||
|
||||
private Spanned descriptionSpanned;
|
||||
private Spanned subDescriptionSpanned;
|
||||
private Spanned rightDescriptionSpanned;
|
||||
private Spanned rightSubDescriptionSpanned;
|
||||
|
||||
private @ColorInt Integer etichettaColor;
|
||||
|
||||
private boolean hidden;
|
||||
@@ -37,6 +45,7 @@ public class OrdiniUscitaElencoListModel implements Cloneable {
|
||||
|
||||
public OrdiniUscitaElencoListModel setDescription(String description) {
|
||||
this.description = description;
|
||||
this.descriptionSpanned = description != null ? Html.fromHtml(description) : null;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -46,6 +55,7 @@ public class OrdiniUscitaElencoListModel implements Cloneable {
|
||||
|
||||
public OrdiniUscitaElencoListModel setSubDescription(String subDescription) {
|
||||
this.subDescription = subDescription;
|
||||
this.subDescriptionSpanned = subDescription != null ? Html.fromHtml(subDescription) : null;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -55,6 +65,7 @@ public class OrdiniUscitaElencoListModel implements Cloneable {
|
||||
|
||||
public OrdiniUscitaElencoListModel setRightDescription(String rightDescription) {
|
||||
this.rightDescription = rightDescription;
|
||||
this.rightDescriptionSpanned = rightDescription != null ? Html.fromHtml(rightDescription) : null;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -64,6 +75,7 @@ public class OrdiniUscitaElencoListModel implements Cloneable {
|
||||
|
||||
public OrdiniUscitaElencoListModel setRightSubDescription(String rightSubDescription) {
|
||||
this.rightSubDescription = rightSubDescription;
|
||||
this.rightSubDescriptionSpanned = rightSubDescription != null ? Html.fromHtml(rightSubDescription) : null;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -97,4 +109,20 @@ public class OrdiniUscitaElencoListModel implements Cloneable {
|
||||
this.originalModel = originalModel;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Spanned getDescriptionSpanned() {
|
||||
return descriptionSpanned;
|
||||
}
|
||||
|
||||
public Spanned getSubDescriptionSpanned() {
|
||||
return subDescriptionSpanned;
|
||||
}
|
||||
|
||||
public Spanned getRightDescriptionSpanned() {
|
||||
return rightDescriptionSpanned;
|
||||
}
|
||||
|
||||
public Spanned getRightSubDescriptionSpanned() {
|
||||
return rightSubDescriptionSpanned;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package it.integry.integrywmsnative.gest.picking_libero;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.text.SpannableString;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@@ -76,6 +77,9 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
|
||||
@Inject
|
||||
DialogInputQuantityV2View mDialogInputQuantityV2View;
|
||||
|
||||
@Inject
|
||||
Handler handler;
|
||||
|
||||
public BindableBoolean thereIsAnOpenedUL = new BindableBoolean(false);
|
||||
public BindableBoolean thereIsntAnOpenedUL = new BindableBoolean(true);
|
||||
public BindableBoolean thereIsAnyRowInUL = new BindableBoolean(false);
|
||||
@@ -87,7 +91,7 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
|
||||
|
||||
private PickingLiberoListAdapter mAdapter;
|
||||
|
||||
private int barcodeScannerIstanceID = -1;
|
||||
private int mBarcodeScannerInstanceID = -1;
|
||||
|
||||
private GestioneEnum mCurrentGestione;
|
||||
private boolean mAskCliente;
|
||||
@@ -171,11 +175,11 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
|
||||
}
|
||||
|
||||
private void initBarcodeReader() {
|
||||
barcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
||||
mBarcodeScannerInstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
||||
.setOnScanSuccessful(onScanSuccessful)
|
||||
.setOnScanFailed(ex -> UtilityExceptions.defaultException(getActivity(), ex, false)));
|
||||
|
||||
BarcodeManager.enable();
|
||||
BarcodeManager.enable(mBarcodeScannerInstanceID);
|
||||
}
|
||||
|
||||
|
||||
@@ -206,23 +210,41 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
|
||||
}
|
||||
|
||||
private final RunnableArgs<BarcodeScanDTO> onScanSuccessful = data -> {
|
||||
BarcodeManager.disable();
|
||||
this.onLoadingStarted();
|
||||
|
||||
this.mViewModel.processBarcodeDTO(data, () -> {
|
||||
BarcodeManager.enable();
|
||||
this.onLoadingEnded();
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
this.mViewModel.processBarcodeDTO(data);
|
||||
} catch (Exception e) {
|
||||
onError(e);
|
||||
}
|
||||
});
|
||||
|
||||
this.onLoadingEnded();
|
||||
};
|
||||
|
||||
public void createNewLU() {
|
||||
this.mViewModel.createNewLU(null, null, () -> {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
this.mViewModel.createNewLU(null, null);
|
||||
} catch (Exception e) {
|
||||
this.onError(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void closeLU() {
|
||||
destroyAdapter();
|
||||
this.mViewModel.closeLU(null);
|
||||
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
this.onLoadingStarted();
|
||||
this.mViewModel.closeLU();
|
||||
this.onLoadingEnded();
|
||||
} catch (Exception e) {
|
||||
this.onError(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -241,7 +263,7 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
|
||||
|
||||
@Override
|
||||
public void onLUOpened(MtbColt mtbColt) {
|
||||
requireActivity().runOnUiThread(() -> {
|
||||
handler.post(() -> {
|
||||
mToolbarTitleText.setText(String.format(getActivity().getText(R.string.lu_number_text).toString(), mtbColt.getNumCollo()));
|
||||
|
||||
initAdapter();
|
||||
@@ -257,14 +279,14 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
|
||||
});
|
||||
|
||||
Snackbar.make(mBindings.getRoot(), R.string.data_saved, Snackbar.LENGTH_SHORT)
|
||||
.setBackgroundTint(getResources().getColor(R. color. green_500))
|
||||
.setBackgroundTint(getResources().getColor(R.color.green_500))
|
||||
.show();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLUClosed() {
|
||||
requireActivity().runOnUiThread(() -> {
|
||||
handler.post(() -> {
|
||||
mToolbarTitleText.setText(getActivity().getText(R.string.free_picking_title_fragment).toString());
|
||||
destroyAdapter();
|
||||
|
||||
@@ -285,7 +307,7 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
|
||||
|
||||
@Override
|
||||
public void onError(Exception ex) {
|
||||
requireActivity().runOnUiThread(() -> {
|
||||
handler.post(() -> {
|
||||
this.onLoadingEnded();
|
||||
|
||||
if (ex instanceof InvalidPesoKGException) {
|
||||
@@ -294,7 +316,7 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
|
||||
UtilityExceptions.defaultException(getActivity(), ex);
|
||||
}
|
||||
|
||||
BarcodeManager.enable();
|
||||
BarcodeManager.enable(mBarcodeScannerInstanceID);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -321,7 +343,7 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
|
||||
DialogChooseArtsFromMtbColrList
|
||||
.newInstance(mtbColrsToPick, mtbAart, onComplete, () -> {
|
||||
onAbort.run();
|
||||
BarcodeManager.enable();
|
||||
BarcodeManager.enable(mBarcodeScannerInstanceID);
|
||||
})
|
||||
.show(requireActivity().getSupportFragmentManager(), DialogChooseArtsFromMtbColrList.class.getName());
|
||||
}
|
||||
@@ -344,7 +366,7 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
|
||||
boolean canOverflowOrderQuantity,
|
||||
boolean canPartitaMagBeChanged,
|
||||
boolean canLUBeClosed,
|
||||
RunnableArgss<PickedQuantityDTO, Boolean> onComplete) {
|
||||
RunnableArgs<PickedQuantityDTO> onComplete) {
|
||||
|
||||
DialogInputQuantityV2DTO dialogInputQuantityV2DTO = new DialogInputQuantityV2DTO()
|
||||
.setMtbAart(mtbAart)
|
||||
@@ -365,7 +387,12 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
|
||||
|
||||
if (!mDialogInputQuantityV2View.isVisible())
|
||||
mDialogInputQuantityV2View.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
|
||||
.setOnComplete((resultDTO, shouldCloseLU) -> {
|
||||
.setOnComplete(resultDTO -> {
|
||||
if (resultDTO == null || resultDTO.isAborted()) {
|
||||
onComplete.run(null);
|
||||
return;
|
||||
}
|
||||
|
||||
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO()
|
||||
.setNumCnf(resultDTO.getNumCnf())
|
||||
.setQtaCnf(resultDTO.getQtaCnf())
|
||||
@@ -373,19 +400,16 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
|
||||
.setPartitaMag(resultDTO.getPartitaMag())
|
||||
.setDataScad(resultDTO.getDataScad());
|
||||
|
||||
onComplete.run(pickedQuantityDTO, shouldCloseLU);
|
||||
})
|
||||
.setOnAbort(() -> {
|
||||
onComplete.run(null, false);
|
||||
onComplete.run(pickedQuantityDTO);
|
||||
})
|
||||
.show(requireActivity().getSupportFragmentManager(), "tag");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRowSaved() {
|
||||
requireActivity().runOnUiThread(() -> {
|
||||
handler.post(() -> {
|
||||
Snackbar.make(mBindings.getRoot(), R.string.data_saved, Snackbar.LENGTH_SHORT)
|
||||
.setBackgroundTint(getResources().getColor(R. color. green_500))
|
||||
.setBackgroundTint(getResources().getColor(R.color.green_500))
|
||||
.show();
|
||||
});
|
||||
}
|
||||
@@ -393,19 +417,40 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
|
||||
|
||||
@Override
|
||||
public void onMtbColrEdit(MtbColr mtbColr) {
|
||||
this.mViewModel.dispatchRowEdit(mtbColr);
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
this.mViewModel.dispatchRowEdit(mtbColr);
|
||||
} catch (Exception e) {
|
||||
this.onError(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMtbColrDelete(MtbColr mtbColr) {
|
||||
this.mViewModel.deleteRow(mtbColr);
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
this.mViewModel.deleteRow(mtbColr);
|
||||
} catch (Exception e) {
|
||||
this.onError(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPreDestroy(Runnable onComplete) {
|
||||
BarcodeManager.removeCallback(barcodeScannerIstanceID);
|
||||
if (thereIsAnOpenedUL.get()) mViewModel.closeLU(onComplete);
|
||||
else onComplete.run();
|
||||
BarcodeManager.removeCallback(mBarcodeScannerInstanceID);
|
||||
if (thereIsAnOpenedUL.get()) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
this.onLoadingStarted();
|
||||
mViewModel.closeLU();
|
||||
this.onLoadingEnded();
|
||||
} catch (Exception e) {
|
||||
onError(e);
|
||||
}
|
||||
});
|
||||
} else onComplete.run();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package it.integry.integrywmsnative.gest.picking_libero;
|
||||
|
||||
import android.os.Handler;
|
||||
|
||||
import java.util.concurrent.ExecutorService;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
@@ -22,6 +24,7 @@ public class PickingLiberoModule {
|
||||
@Provides
|
||||
@Singleton
|
||||
PickingLiberoViewModel providesPickingLiberoViewModel(ExecutorService executorService,
|
||||
Handler handler,
|
||||
ArticoloRESTConsumer articoloRESTConsumer,
|
||||
ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer,
|
||||
BarcodeRESTConsumer barcodeRESTConsumer,
|
||||
@@ -34,6 +37,7 @@ public class PickingLiberoModule {
|
||||
) {
|
||||
return new PickingLiberoViewModel(
|
||||
executorService,
|
||||
handler,
|
||||
articoloRESTConsumer,
|
||||
colliMagazzinoRESTConsumer,
|
||||
barcodeRESTConsumer,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user