Compare commits
229 Commits
V1.46.07(4
...
v1.47.26(5
| Author | SHA1 | Date | |
|---|---|---|---|
| 50e2605ea5 | |||
| 3fe903cc12 | |||
| 3f95a70039 | |||
| 067443698a | |||
| 55c16e602d | |||
| 990a4d1538 | |||
| 6097a7f736 | |||
| f8b92901fd | |||
| 6c6daa4809 | |||
| de8b48d938 | |||
| bfa69ca78b | |||
| bffb471015 | |||
| 087e3e261c | |||
| 2eff03dee6 | |||
| fc34a555bd | |||
| 0bf21c046f | |||
| 473ed536fb | |||
| dc342c1fee | |||
| 81507938b1 | |||
| cff52140bd | |||
| 24d90b58f9 | |||
| b5d049aa1d | |||
| 01028f9888 | |||
| 2774eaecbf | |||
| 648a572752 | |||
| 022a56a584 | |||
| ea97e8f249 | |||
| 571ad1590f | |||
| 03c02d6625 | |||
| ba1118fdd8 | |||
| 7878748548 | |||
| 172a8256b6 | |||
| c16f5c1747 | |||
| 33860a0cfe | |||
| 15a946dfb6 | |||
| 62adf49157 | |||
| 64fcb7ccc8 | |||
| 3ebdc72642 | |||
| aacf5ca76e | |||
| 4f134bfc8e | |||
| 6bd1e62190 | |||
| f9f02452d7 | |||
| b653ae39af | |||
| 63d1d9ecf0 | |||
| 9c72a2a628 | |||
| 5f1b7ef4a4 | |||
| c36bc9d8c2 | |||
| ba9da26ca0 | |||
| b2ad4fdb62 | |||
| 60e725f554 | |||
| 2f6f9b54c2 | |||
| a2ef35e353 | |||
| b06f058ecf | |||
| e67cbd3760 | |||
| ce9d304043 | |||
| fc30b8253d | |||
| e8da16cb8a | |||
| dff725ea92 | |||
| e4248c8c48 | |||
| 819cc97113 | |||
| 05d806f9f2 | |||
| 6fdadffe77 | |||
| 5ae9371c51 | |||
| 4861c689d7 | |||
| 1c63908b3b | |||
| a622e89058 | |||
| ac4500e2a2 | |||
| 6ebcbc2d6c | |||
| 150be3cae2 | |||
| 72edf5228a | |||
| b72a3321d9 | |||
| 5bf71a1b0c | |||
| ee10427048 | |||
| 7fb7cbf8ec | |||
| 3a43e9238b | |||
| 007d58a17e | |||
| 998a59cffc | |||
| 11b353a91d | |||
| 8772d11e02 | |||
| 3d772e3722 | |||
| 41cfbc273e | |||
| bc67098ae0 | |||
| 0e49c93678 | |||
| ed93b88ee8 | |||
| 2cb184f24b | |||
| 126846aef2 | |||
| 8ac595c6c5 | |||
| fc2c0fbe0c | |||
| 0aa0b09afa | |||
| 9436236eaa | |||
| fc5568a046 | |||
| 590e9ec24e | |||
| 984a4a156b | |||
| 04afb4cfca | |||
| 81eda94fe0 | |||
| 8f02dfbee4 | |||
| 75e1447a54 | |||
| d8f9886f82 | |||
| 3279c4e2af | |||
| 6f070e6998 | |||
| df4bfcc955 | |||
| c1983cf73c | |||
| da9bbd0b1c | |||
| cd84d3e9a8 | |||
| 595f4a8797 | |||
| 388f08a02f | |||
| c562735661 | |||
| ab137ad828 | |||
| b56f209084 | |||
| 5107897888 | |||
| d91eaf3412 | |||
| caa6a7cd75 | |||
| 567b288e4d | |||
| 86121bfa93 | |||
| 669a38732f | |||
| e3e7a7d7c6 | |||
| 75914ab9c9 | |||
| d1976f3e21 | |||
| 5ef5c4b28a | |||
| 2c3d4bbc22 | |||
| fd8bb8e7da | |||
| 60a088a7f4 | |||
| 8ca5207a58 | |||
| f2cc31e08a | |||
| e541031efe | |||
| d4b220d1e6 | |||
| 798835cb4c | |||
| ba72284c87 | |||
| 603c5dd8b7 | |||
| 43fc8be493 | |||
| 22bace2402 | |||
| 3b86460f48 | |||
| ddac54b513 | |||
| a385b01584 | |||
| 7920166110 | |||
| e6f4cc9d6d | |||
| 13d9c40119 | |||
| 1d7125a821 | |||
| deb4d77203 | |||
| 520a1cb07a | |||
| c620e9cb96 | |||
| 6ef4961074 | |||
| 688a8e4bad | |||
| 12796b11e5 | |||
| f7dc857587 | |||
| f99c0e5514 | |||
| f1c304eaeb | |||
| 7b3fde1d71 | |||
| 3c337fc138 | |||
| 021f6974f1 | |||
| 92abfe1da4 | |||
| 6338c1dfa6 | |||
| 657d85be86 | |||
| 97c907c992 | |||
| caed709b64 | |||
| 13800eecab | |||
| c4357f662c | |||
| 67a8ca94db | |||
| 0bfd56c011 | |||
| eead844ac1 | |||
| 65cfadcb6e | |||
| 00067ca1c9 | |||
| 73ca8bb366 | |||
| 3ffdb2c220 | |||
| a5479595c7 | |||
| cff971bef8 | |||
| a5d3388665 | |||
| 22ad23c5b7 | |||
| b1d5e10db4 | |||
| bde41d21be | |||
| 9d8228419c | |||
| ad7d9059c0 | |||
| 4831a7ce19 | |||
| 552b82feda | |||
| 6d62a7b10e | |||
| 667f4aea74 | |||
| f80225b7bf | |||
| 7a02e1d8ad | |||
| 9cc70f4ee6 | |||
| 7c4c5da1d6 | |||
| b960b6319a | |||
| 08ddaa7a11 | |||
| bcce40094c | |||
| 960388adf8 | |||
| e76722018f | |||
| fc30017021 | |||
| e1dd4f2140 | |||
| 67a0679de7 | |||
| dfc87f7aec | |||
| 886ef6ba08 | |||
| fe77f90a7a | |||
| 7a1f0d6cf6 | |||
| 004bc3b926 | |||
| 5a0b45c6f9 | |||
| be5ebb89d7 | |||
| f81d61c4c5 | |||
| 634bc502ce | |||
| d13dbf1ad3 | |||
| 2f9ee642da | |||
| afecc11364 | |||
| b33d566abd | |||
| 69d880b587 | |||
| aeadea42e1 | |||
| f5c3dcfdc9 | |||
| d30af1e2a6 | |||
| 71a18e9ffa | |||
| 40e1fb4f83 | |||
| f3f0fd8fd8 | |||
| ed53b9e3b4 | |||
| 37ac05b8ab | |||
| 823d0d7a33 | |||
| 5b07ff5efa | |||
| c5639a643a | |||
| 012f75198b | |||
| d7e0e858d2 | |||
| 339a5e5b68 | |||
| 02a13911d8 | |||
| b6f51971f1 | |||
| 57079c0062 | |||
| 63c353a83c | |||
| c069d21cbf | |||
| afeb9ecc23 | |||
| 2ff8d80da3 | |||
| 891e2641fa | |||
| ca79107809 | |||
| 5c37b986ce | |||
| c426250cd5 | |||
| f090c11146 | |||
| f1ddaa1fca |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -149,3 +149,6 @@ crashlytics.properties
|
||||
crashlytics-build.properties
|
||||
### AndroidStudio Patch ###
|
||||
!/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
copilot.*.xml
|
||||
/.idea/dataSources.xml
|
||||
35
.idea/codeStyles/Project.xml
generated
35
.idea/codeStyles/Project.xml
generated
@@ -1,5 +1,40 @@
|
||||
<component name="ProjectCodeStyleConfiguration">
|
||||
<code_scheme name="Project" version="173">
|
||||
<JavaCodeStyleSettings>
|
||||
<option name="IMPORT_LAYOUT_TABLE">
|
||||
<value>
|
||||
<package name="" withSubpackages="true" static="false" module="true" />
|
||||
<package name="android" withSubpackages="true" static="true" />
|
||||
<package name="androidx" withSubpackages="true" static="true" />
|
||||
<package name="com" withSubpackages="true" static="true" />
|
||||
<package name="junit" withSubpackages="true" static="true" />
|
||||
<package name="net" withSubpackages="true" static="true" />
|
||||
<package name="org" withSubpackages="true" static="true" />
|
||||
<package name="java" withSubpackages="true" static="true" />
|
||||
<package name="javax" withSubpackages="true" static="true" />
|
||||
<package name="" withSubpackages="true" static="true" />
|
||||
<emptyLine />
|
||||
<package name="android" withSubpackages="true" static="false" />
|
||||
<emptyLine />
|
||||
<package name="androidx" withSubpackages="true" static="false" />
|
||||
<emptyLine />
|
||||
<package name="com" withSubpackages="true" static="false" />
|
||||
<emptyLine />
|
||||
<package name="junit" withSubpackages="true" static="false" />
|
||||
<emptyLine />
|
||||
<package name="net" withSubpackages="true" static="false" />
|
||||
<emptyLine />
|
||||
<package name="org" withSubpackages="true" static="false" />
|
||||
<emptyLine />
|
||||
<package name="java" withSubpackages="true" static="false" />
|
||||
<emptyLine />
|
||||
<package name="javax" withSubpackages="true" static="false" />
|
||||
<emptyLine />
|
||||
<package name="" withSubpackages="true" static="false" />
|
||||
<emptyLine />
|
||||
</value>
|
||||
</option>
|
||||
</JavaCodeStyleSettings>
|
||||
<JetCodeStyleSettings>
|
||||
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
||||
</JetCodeStyleSettings>
|
||||
|
||||
4
.idea/deploymentTargetSelector.xml
generated
4
.idea/deploymentTargetSelector.xml
generated
@@ -4,10 +4,10 @@
|
||||
<selectionStates>
|
||||
<SelectionState runConfigName="app">
|
||||
<option name="selectionMode" value="DROPDOWN" />
|
||||
<DropdownSelection timestamp="2025-03-17T09:16:48.549771200Z">
|
||||
<DropdownSelection timestamp="2025-10-02T11:26:10.944286600Z">
|
||||
<Target type="DEFAULT_BOOT">
|
||||
<handle>
|
||||
<DeviceId pluginId="PhysicalDevice" identifier="serial=21088B8EFD" />
|
||||
<DeviceId pluginId="PhysicalDevice" identifier="serial=7da0808" />
|
||||
</handle>
|
||||
</Target>
|
||||
</DropdownSelection>
|
||||
|
||||
11
.idea/runConfigurations/app.xml
generated
11
.idea/runConfigurations/app.xml
generated
@@ -1,6 +1,7 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="app" type="AndroidRunConfigurationType" factoryName="Android App">
|
||||
<module name="WMS.app.main" />
|
||||
<module name="WMS_Native.app" />
|
||||
<option name="ANDROID_RUN_CONFIGURATION_SCHEMA_VERSION" value="1" />
|
||||
<option name="DEPLOY" value="true" />
|
||||
<option name="DEPLOY_APK_FROM_BUNDLE" value="false" />
|
||||
<option name="DEPLOY_AS_INSTANT" value="false" />
|
||||
@@ -8,14 +9,17 @@
|
||||
<option name="PM_INSTALL_OPTIONS" value="" />
|
||||
<option name="ALL_USERS" value="false" />
|
||||
<option name="ALWAYS_INSTALL_WITH_PM" value="false" />
|
||||
<option name="ALLOW_ASSUME_VERIFIED" value="false" />
|
||||
<option name="CLEAR_APP_STORAGE" value="false" />
|
||||
<option name="DYNAMIC_FEATURES_DISABLED_LIST" value="" />
|
||||
<option name="ACTIVITY_EXTRA_FLAGS" value="" />
|
||||
<option name="MODE" value="default_activity" />
|
||||
<option name="RESTORE_ENABLED" value="false" />
|
||||
<option name="RESTORE_FILE" value="" />
|
||||
<option name="RESTORE_FRESH_INSTALL_ONLY" value="false" />
|
||||
<option name="CLEAR_LOGCAT" value="false" />
|
||||
<option name="SHOW_LOGCAT_AUTOMATICALLY" value="false" />
|
||||
<option name="INSPECTION_WITHOUT_ACTIVITY_RESTART" value="false" />
|
||||
<option name="TARGET_SELECTION_MODE" value="SHOW_DIALOG" />
|
||||
<option name="TARGET_SELECTION_MODE" value="DEVICE_AND_SNAPSHOT_COMBO_BOX" />
|
||||
<option name="SELECTED_CLOUD_MATRIX_CONFIGURATION_ID" value="-1" />
|
||||
<option name="SELECTED_CLOUD_MATRIX_PROJECT_ID" value="" />
|
||||
<option name="DEBUGGER_TYPE" value="Auto" />
|
||||
@@ -59,6 +63,7 @@
|
||||
<option name="NATIVE_MEMORY_SAMPLE_RATE_BYTES" value="2048" />
|
||||
</Profilers>
|
||||
<option name="DEEP_LINK" value="" />
|
||||
<option name="ACTIVITY" value="" />
|
||||
<option name="ACTIVITY_CLASS" value="" />
|
||||
<option name="SEARCH_ACTIVITY_IN_GLOBAL_SCOPE" value="false" />
|
||||
<option name="SKIP_ACTIVITY_VALIDATION" value="false" />
|
||||
|
||||
72
Jenkinsfile.groovy
Normal file
72
Jenkinsfile.groovy
Normal file
@@ -0,0 +1,72 @@
|
||||
pipeline {
|
||||
agent {
|
||||
label 'master'
|
||||
}
|
||||
|
||||
options {
|
||||
buildDiscarder(logRotator(numToKeepStr: '30', artifactNumToKeepStr: '10'))
|
||||
disableConcurrentBuilds()
|
||||
}
|
||||
|
||||
environment {
|
||||
// ANDROID_HOME = "/usr/local/android/sdk" // Cambia in base al tuo sistema
|
||||
JAVA_HOME = tool 'JDK 17.0.6 x64' // Nome dello strumento configurato in Jenkins
|
||||
PATH = "${env.JAVA_HOME}\\bin;${env.PATH}"
|
||||
}
|
||||
|
||||
stages {
|
||||
|
||||
stage('Preparing') {
|
||||
when {
|
||||
expression {
|
||||
return env.GIT_BRANCH == "master-beta"
|
||||
}
|
||||
}
|
||||
steps {
|
||||
bat "./gradlew addBetaSuffix"
|
||||
}
|
||||
}
|
||||
|
||||
stage('Build') {
|
||||
steps {
|
||||
bat "./gradlew assembleRelease"
|
||||
archiveArtifacts artifacts: 'app/build/outputs/apk/release/', onlyIfSuccessful: true
|
||||
}
|
||||
}
|
||||
|
||||
stage('Publish') {
|
||||
steps {
|
||||
azureUpload allowAnonymousAccess: true, fileShareName: 'storage-ci', filesPath: 'app/build/outputs/apk/release/*.apk,app/build/outputs/apk/release/*.txt', removePrefixPath: 'app/build/outputs/apk/release/', storageCredentialId: '83a86793-c1d6-4776-b20f-1ff652a57fee', storageType: 'filestorage', uploadArtifactsOnlyIfSuccessful: true, verbose: true, virtualPath: 'wms'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
post {
|
||||
success {
|
||||
script {
|
||||
bat 'curl -k "https://devservices.studioml.it/ems-api/updateWMSApp?overrideForced=false"'
|
||||
bat 'curl -k "https://devservices.studioml.it/ems-api/updateWMSApp?overrideForced=false&suffix=beta"'
|
||||
bat 'curl -k "https://services.studioml.it/ems-api/updateWMSApp?overrideForced=false"'
|
||||
bat 'curl -k "https://services.studioml.it/ems-api/updateWMSApp?overrideForced=false&suffix=beta"'
|
||||
if (env.GIT_BRANCH == "master" || env.GIT_BRANCH == "master-beta") {
|
||||
office365ConnectorSend adaptiveCards: true, color: '#008000', message: 'WMS è stato compilato con successo', status: 'SUCCESS', webhookUrl: 'https://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'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
122
app/build.gradle
122
app/build.gradle
@@ -8,10 +8,11 @@ apply plugin: 'com.google.firebase.crashlytics'
|
||||
//apply plugin: 'kotlin-android'
|
||||
apply plugin: 'com.google.gms.google-services'
|
||||
|
||||
|
||||
android {
|
||||
|
||||
def appVersionCode = 495
|
||||
def appVersionName = '1.46.07'
|
||||
def appVersionCode = 539
|
||||
def appVersionName = '1.47.26'
|
||||
|
||||
signingConfigs {
|
||||
release {
|
||||
@@ -34,7 +35,7 @@ android {
|
||||
defaultConfig {
|
||||
applicationId "it.integry.integrywmsnative"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 35
|
||||
targetSdk 36
|
||||
versionCode appVersionCode
|
||||
versionName appVersionName
|
||||
// testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
@@ -51,11 +52,18 @@ android {
|
||||
buildTypes {
|
||||
debug {
|
||||
ext.enableCrashlytics = false
|
||||
// minifyEnabled true // Abilita la minimizzazione del codice
|
||||
// shrinkResources true // Rimuove risorse non utilizzate
|
||||
// proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
release {
|
||||
minifyEnabled false
|
||||
// minifyEnabled true // Abilita la minimizzazione del codice
|
||||
// shrinkResources true // Rimuove risorse non utilizzate
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
signingConfig signingConfigs.release
|
||||
firebaseCrashlytics {
|
||||
mappingFileUploadEnabled true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,12 +82,7 @@ android {
|
||||
}
|
||||
|
||||
|
||||
build {
|
||||
doLast {
|
||||
delete "$projectDir/build/outputs/apk/release/version.txt"
|
||||
file("$projectDir/build/outputs/apk/release/version.txt").text = appVersionCode + '\n' + appVersionName + '\n' + 'forced=true'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
gradle.projectsEvaluated {
|
||||
tasks.withType(JavaCompile.class).tap {
|
||||
@@ -92,7 +95,7 @@ android {
|
||||
abortOnError false
|
||||
}
|
||||
namespace 'it.integry.integrywmsnative'
|
||||
compileSdk 35
|
||||
compileSdk 36
|
||||
}
|
||||
|
||||
configurations {
|
||||
@@ -101,36 +104,33 @@ configurations {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.4'
|
||||
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.5'
|
||||
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||
// androidTestImplementation('androidx.test.espresso:espresso-core:3.6.1', {
|
||||
// exclude group: 'com.android.support', module: 'support-annotations'
|
||||
// })
|
||||
// implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||
|
||||
implementation 'com.github.lupaulus:logger:2.3.2'
|
||||
|
||||
//Firebase
|
||||
|
||||
// Import the Firebase BoM
|
||||
implementation platform('com.google.firebase:firebase-bom:33.9.0')
|
||||
implementation platform('com.google.firebase:firebase-bom:33.16.0')
|
||||
implementation 'com.google.firebase:firebase-analytics'
|
||||
implementation 'com.google.firebase:firebase-crashlytics'
|
||||
implementation 'com.google.firebase:firebase-perf'
|
||||
implementation 'com.google.android.gms:play-services-basement:18.5.0'
|
||||
implementation 'com.google.android.gms:play-services-basement:18.7.1'
|
||||
|
||||
//JJWT
|
||||
implementation 'io.jsonwebtoken:jjwt-api:0.11.5'
|
||||
runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.11.5'
|
||||
runtimeOnly 'io.jsonwebtoken:jjwt-jackson:0.11.5'
|
||||
implementation 'io.jsonwebtoken:jjwt-api:0.13.0'
|
||||
runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.13.0'
|
||||
runtimeOnly 'io.jsonwebtoken:jjwt-jackson:0.13.0'
|
||||
|
||||
implementation 'com.google.guava:guava:33.4.0-android'
|
||||
|
||||
implementation 'androidx.appcompat:appcompat:1.7.0'
|
||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||
implementation 'androidx.appcompat:appcompat:1.7.1'
|
||||
implementation 'com.google.android.material:material:1.12.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.2.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.2.1'
|
||||
implementation 'androidx.cardview:cardview:1.0.0'
|
||||
implementation 'androidx.recyclerview:recyclerview:1.4.0'
|
||||
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
|
||||
|
||||
implementation('androidx.preference:preference-ktx:1.2.1') {
|
||||
exclude group: 'androidx.lifecycle', module: 'lifecycle-viewmodel'
|
||||
@@ -138,19 +138,18 @@ dependencies {
|
||||
}
|
||||
|
||||
implementation "androidx.slidingpanelayout:slidingpanelayout:1.2.0"
|
||||
implementation 'com.squareup.okhttp3:okhttp:4.10.0'
|
||||
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
|
||||
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
|
||||
implementation 'com.squareup.retrofit2:retrofit:3.0.0'
|
||||
implementation 'com.squareup.retrofit2:converter-gson:3.0.0'
|
||||
implementation 'com.annimon:stream:1.2.2'
|
||||
implementation 'androidx.lifecycle:lifecycle-runtime:2.8.7'
|
||||
implementation 'org.apache.commons:commons-text:1.9'
|
||||
implementation 'androidx.lifecycle:lifecycle-runtime:2.9.3'
|
||||
implementation 'org.apache.commons:commons-text:1.14.0'
|
||||
|
||||
//MVVM
|
||||
def dagger2_version = '2.55'
|
||||
api "com.google.dagger:dagger:$dagger2_version"
|
||||
def dagger2_version = '2.57.1'
|
||||
implementation "com.google.dagger:dagger:$dagger2_version"
|
||||
annotationProcessor "com.google.dagger:dagger-compiler:$dagger2_version"
|
||||
api "com.google.dagger:dagger-android:$dagger2_version"
|
||||
api "com.google.dagger:dagger-android-support:$dagger2_version"
|
||||
implementation "com.google.dagger:dagger-android:$dagger2_version"
|
||||
implementation "com.google.dagger:dagger-android-support:$dagger2_version"
|
||||
// if you use the support libraries
|
||||
annotationProcessor "com.google.dagger:dagger-android-processor:$dagger2_version"
|
||||
|
||||
@@ -162,7 +161,7 @@ dependencies {
|
||||
implementation 'com.github.pedromassango:doubleClick:3.0'
|
||||
|
||||
//SQLite ROOM
|
||||
def room_version = "2.6.1"
|
||||
def room_version = "2.7.2"
|
||||
|
||||
implementation "androidx.room:room-runtime:$room_version"
|
||||
annotationProcessor "androidx.room:room-compiler:$room_version"
|
||||
@@ -188,14 +187,13 @@ dependencies {
|
||||
implementation 'com.github.harry1453:android-bluetooth-serial:v1.1.2'
|
||||
|
||||
// RxJava is also required.
|
||||
implementation 'io.reactivex.rxjava2:rxjava:2.1.12'
|
||||
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
|
||||
|
||||
implementation 'org.greenrobot:eventbus:3.3.1'
|
||||
implementation 'io.reactivex.rxjava2:rxjava:2.2.21'
|
||||
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
|
||||
|
||||
//Barcode generator
|
||||
// implementation group: 'com.google.zxing', name: 'core', version: '3.5.3'
|
||||
implementation 'com.journeyapps:zxing-android-embedded:4.3.0'
|
||||
|
||||
implementation("org.javatuples:javatuples:1.2")
|
||||
}
|
||||
|
||||
repositories {
|
||||
@@ -203,3 +201,49 @@ repositories {
|
||||
google()
|
||||
maven { url 'https://jitpack.io' }
|
||||
}
|
||||
|
||||
tasks.register('addBetaSuffix') {
|
||||
doLast {
|
||||
def gradleFile = file("build.gradle")
|
||||
def content = gradleFile.text
|
||||
|
||||
// Modifica appVersionName
|
||||
content = content.replaceAll(/appVersionName\s*=\s*'(.*?)'/) { fullMatch, version ->
|
||||
"appVersionName = '${version}-beta'"
|
||||
}
|
||||
|
||||
// Modifica outputFileName
|
||||
content = content.replaceAll(/output\.outputFileName\s*=\s*"(.*?)"/) { fullMatch, filename ->
|
||||
"output.outputFileName = \"${filename.replace('.apk', '-beta.apk')}\""
|
||||
}
|
||||
|
||||
// Modifica direttamente la riga che crea 'version.txt' in 'version-beta.txt'
|
||||
content = content.replace(
|
||||
"def versionFile = new File(outputDir, \"version.txt\")",
|
||||
"def versionFile = new File(outputDir, \"version-beta.txt\")"
|
||||
)
|
||||
|
||||
// Sovrascrivi il file
|
||||
gradleFile.write(content)
|
||||
}
|
||||
}
|
||||
|
||||
tasks.register('createVersionFile') {
|
||||
doLast {
|
||||
def outputDir = file("${projectDir}/build/outputs/apk/release")
|
||||
def versionFile = new File(outputDir, "version.txt")
|
||||
|
||||
// Cancella il file se esiste
|
||||
if (versionFile.exists()) {
|
||||
versionFile.delete()
|
||||
}
|
||||
|
||||
// Crea il file con i contenuti desiderati
|
||||
versionFile.write("${android.defaultConfig.versionCode}\n${android.defaultConfig.versionName}\nforced=true")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
afterEvaluate {
|
||||
tasks.assembleRelease.finalizedBy createVersionFile
|
||||
}
|
||||
|
||||
23
app/proguard-rules.pro
vendored
23
app/proguard-rules.pro
vendored
@@ -23,3 +23,26 @@
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
# Prevent proguard from stripping interface information from TypeAdapter, TypeAdapterFactory,
|
||||
# JsonSerializer, JsonDeserializer instances (so they can be used in @JsonAdapter)
|
||||
-keep class * extends com.google.gson.TypeAdapter
|
||||
-keep class * implements com.google.gson.TypeAdapterFactory
|
||||
-keep class * implements com.google.gson.JsonSerializer
|
||||
-keep class * implements com.google.gson.JsonDeserializer
|
||||
# Prevent R8 from leaving Data object members always null
|
||||
-keepclasseswithmembers class * {
|
||||
<init>(...);
|
||||
@com.google.gson.annotations.SerializedName <fields>;
|
||||
}
|
||||
|
||||
# Per JJWT
|
||||
-keep class io.jsonwebtoken.** { *; }
|
||||
-keepnames class io.jsonwebtoken.* { *; }
|
||||
-keepnames interface io.jsonwebtoken.* { *; }
|
||||
|
||||
# Retain generic signatures of TypeToken and its subclasses with R8 version 3.0 and higher.
|
||||
-keep,allowobfuscation,allowshrinking class com.google.gson.reflect.TypeToken
|
||||
-keep,allowobfuscation,allowshrinking class * extends com.google.gson.reflect.TypeToken
|
||||
|
||||
-keep class it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse { *; }
|
||||
-keep class * extends it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse { *; }
|
||||
@@ -142,6 +142,8 @@ import it.integry.integrywmsnative.view.dialogs.choose_batch_lot.DialogChooseBat
|
||||
import it.integry.integrywmsnative.view.dialogs.choose_batch_lot.DialogChooseBatchLotModule;
|
||||
import it.integry.integrywmsnative.view.dialogs.create_new_art.DialogCreateNewArtComponent;
|
||||
import it.integry.integrywmsnative.view.dialogs.create_new_art.DialogCreateNewArtModule;
|
||||
import it.integry.integrywmsnative.view.dialogs.device_end_of_life.DialogDeviceEndOfLifeComponent;
|
||||
import it.integry.integrywmsnative.view.dialogs.device_end_of_life.DialogDeviceEndOfLifeModule;
|
||||
import it.integry.integrywmsnative.view.dialogs.extra_info.DialogExtraInfoComponent;
|
||||
import it.integry.integrywmsnative.view.dialogs.extra_info.DialogExtraInfoModule;
|
||||
import it.integry.integrywmsnative.view.dialogs.info_aggiuntive_lu.DialogInfoAggiuntiveLUComponent;
|
||||
@@ -251,7 +253,8 @@ import it.integry.integrywmsnative.view.dialogs.update_available.DialogUpdateAva
|
||||
VerificaGiacenzeModule.class,
|
||||
DialogExtraInfoModule.class,
|
||||
DialogAskDepositoModule.class,
|
||||
DialogChooseArtFromListaArtsModule.class
|
||||
DialogChooseArtFromListaArtsModule.class,
|
||||
DialogDeviceEndOfLifeModule.class
|
||||
})
|
||||
public interface MainApplicationComponent {
|
||||
|
||||
@@ -422,6 +425,8 @@ public interface MainApplicationComponent {
|
||||
|
||||
DialogChooseArtFromListaArtsComponent.Factory dialogChooseArtFromListaArtsComponent();
|
||||
|
||||
DialogDeviceEndOfLifeComponent.Factory dialogDeviceEndOfLifeComponent();
|
||||
|
||||
void inject(MainApplication mainApplication);
|
||||
|
||||
void inject(AppContext mainApplication);
|
||||
|
||||
@@ -313,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
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.text.SpannableString;
|
||||
@@ -12,8 +13,10 @@ import android.view.LayoutInflater;
|
||||
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
@@ -27,6 +30,7 @@ import it.integry.integrywmsnative.databinding.ActivitySplashBinding;
|
||||
import it.integry.integrywmsnative.gest.login.LoginActivity;
|
||||
import it.integry.integrywmsnative.gest.main.MainActivity;
|
||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||
import it.integry.integrywmsnative.view.dialogs.device_end_of_life.DialogDeviceEndOfLifeView;
|
||||
|
||||
public class SplashActivity extends BaseActivity implements MainContext.Listener {
|
||||
|
||||
@@ -65,9 +69,24 @@ public class SplashActivity extends BaseActivity implements MainContext.Listener
|
||||
|
||||
UtilityContext.initMainActivity(this);
|
||||
|
||||
LocalDate endSupportDate = LocalDate.of(2026, 1, 31);
|
||||
|
||||
initAppVersion();
|
||||
initPermissions(this::init);
|
||||
boolean isOldAndroid = Build.VERSION.SDK_INT < Build.VERSION_CODES.O;
|
||||
|
||||
executorService.execute(() -> {
|
||||
|
||||
if (isOldAndroid)
|
||||
showDeviceEndOfLifeMessage();
|
||||
|
||||
handler.post(() -> {
|
||||
if (LocalDate.now().isBefore(endSupportDate) || !isOldAndroid) {
|
||||
initAppVersion();
|
||||
initPermissions(this::init);
|
||||
} else {
|
||||
this.finish();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private void initAppVersion() {
|
||||
@@ -105,6 +124,21 @@ public class SplashActivity extends BaseActivity implements MainContext.Listener
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void showDeviceEndOfLifeMessage() {
|
||||
|
||||
CountDownLatch latch = new CountDownLatch(1);
|
||||
|
||||
DialogDeviceEndOfLifeView.newInstance(latch::countDown)
|
||||
.show(this.getSupportFragmentManager(), "dialog_device_end_of_life");
|
||||
|
||||
try {
|
||||
latch.await();
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDBDataLoading(String item) {
|
||||
handler.post(() -> mBinding.loadingInfoTextview.setText("Caricamento " + item));
|
||||
|
||||
@@ -24,19 +24,4 @@ public class CommonConst {
|
||||
public static String RECOVER_COLLO_FILE = "recover_ul.json";
|
||||
}
|
||||
|
||||
public static class Mail {
|
||||
|
||||
public static String[] forErrorsDebug = {
|
||||
"g.scorrano@integry.it",
|
||||
"v.castellana@integry.it"
|
||||
};
|
||||
|
||||
public static String[] forErrors = {
|
||||
// "syslogs@integry.it",
|
||||
"g.scorrano@integry.it",
|
||||
"v.castellana@integry.it"
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -11,11 +11,11 @@ public class JwtUtils {
|
||||
private final static String SIGNING_KEY = "gICy3bjD56i/YFnBZZKe5ibiz3Snsp08nybGGziCV4ZcvyXBbyqWUnJ2wTrRXhOuf/xdljPXX0yBaqdAgvKthQ==";
|
||||
|
||||
public static Claims parseJwt(String token) {
|
||||
Jws<Claims> jws = Jwts.parserBuilder()
|
||||
.setSigningKey(Keys.hmacShaKeyFor(Decoders.BASE64.decode(SIGNING_KEY)))
|
||||
Jws<Claims> jws = Jwts.parser()
|
||||
.verifyWith(Keys.hmacShaKeyFor(Decoders.BASE64.decode(SIGNING_KEY)))
|
||||
.build()
|
||||
.parseClaimsJws(token);
|
||||
.parseSignedClaims(token);
|
||||
|
||||
return jws.getBody();
|
||||
return jws.getPayload();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,11 +89,25 @@ public class AppContext {
|
||||
private void initLogger() {
|
||||
Logger.addLogAdapter(new AndroidLogAdapter());
|
||||
|
||||
logsFolder = new File(mApplicationContext.getExternalFilesDir(null).getAbsolutePath());
|
||||
int maxBytesSize = 5 * 1024 * 1024;
|
||||
Logger.addLogAdapter(new DiskLogAdapter(logsFolder, maxBytesSize));
|
||||
File dataDir = mApplicationContext.getExternalFilesDir(null);
|
||||
|
||||
logsFolder = new File(dataDir, "logs");
|
||||
|
||||
if (!logsFolder.exists())
|
||||
logsFolder.mkdirs();
|
||||
|
||||
//Temporary clean
|
||||
File[] wrongFilesToBeDeleted = dataDir.listFiles((file, s) -> s.startsWith("logs_"));
|
||||
|
||||
if (wrongFilesToBeDeleted != null)
|
||||
for (File fileToDelete : wrongFilesToBeDeleted) {
|
||||
fileToDelete.delete();
|
||||
}
|
||||
|
||||
removeOldLogs(logsFolder);
|
||||
|
||||
int maxBytesSize = 5 * 1024 * 1024;
|
||||
Logger.addLogAdapter(new DiskLogAdapter(logsFolder, maxBytesSize));
|
||||
}
|
||||
|
||||
private void removeOldLogs(File logsFolder) {
|
||||
|
||||
@@ -4,9 +4,6 @@ import androidx.databinding.BaseObservable;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import it.integry.integrywmsnative.core.CommonConst;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityNumber;
|
||||
|
||||
public class BindableFloat extends BaseObservable {
|
||||
private Float value;
|
||||
|
||||
@@ -15,10 +12,6 @@ public class BindableFloat extends BaseObservable {
|
||||
}
|
||||
|
||||
public BigDecimal getBigDecimal() {
|
||||
int numberOfDigits = UtilityNumber.countNumberOfDecimalDigits(get());
|
||||
|
||||
if(numberOfDigits > CommonConst.Config.NUMBER_OF_DECIMAL_DIGITS) numberOfDigits = CommonConst.Config.NUMBER_OF_DECIMAL_DIGITS;
|
||||
|
||||
return BigDecimal.valueOf(get());
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ import android.widget.EditText;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.RadioButton;
|
||||
import android.widget.RadioGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.ColorRes;
|
||||
import androidx.appcompat.widget.AppCompatCheckBox;
|
||||
@@ -37,6 +38,8 @@ import java.math.BigDecimal;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.DecimalFormatSymbols;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
@@ -45,6 +48,7 @@ import it.integry.integrywmsnative.MainApplication;
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.utility.LocaleDecimalKeyListener;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityBigDecimal;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityNumber;
|
||||
@@ -261,7 +265,7 @@ public class Converters {
|
||||
BigDecimal value = null;
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(s.toString()))
|
||||
value = new BigDecimal(s.toString());
|
||||
value = UtilityNumber.parseBigDecimal(s.toString(), Locale.getDefault());
|
||||
|
||||
observableBigDecimal.set(value);
|
||||
}
|
||||
@@ -271,7 +275,7 @@ public class Converters {
|
||||
}
|
||||
|
||||
BigDecimal newValue = observableBigDecimal.get();
|
||||
BigDecimal viewValue = !view.getText().toString().trim().isEmpty() ? new BigDecimal(view.getText().toString()) : null;
|
||||
BigDecimal viewValue = !view.getText().toString().trim().isEmpty() ? UtilityNumber.parseBigDecimal(view.getText().toString(), Locale.getDefault()) : null;
|
||||
|
||||
if (!UtilityBigDecimal.equalsTo(viewValue, newValue)) {
|
||||
view.setText(UtilityNumber.decimalToString(newValue));
|
||||
@@ -292,7 +296,7 @@ public class Converters {
|
||||
String newValueString = s.toString().trim();
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(newValueString))
|
||||
value = new BigDecimal(newValueString);
|
||||
value = UtilityNumber.parseBigDecimal(newValueString, Locale.getDefault());
|
||||
|
||||
observableBigDecimal.set(value);
|
||||
}
|
||||
@@ -301,7 +305,7 @@ public class Converters {
|
||||
view.addTextChangedListener(watcher);
|
||||
}
|
||||
BigDecimal newValue = observableBigDecimal.get();
|
||||
BigDecimal viewValue = !view.getText().toString().trim().isEmpty() ? new BigDecimal(view.getText().toString()) : null;
|
||||
BigDecimal viewValue = !view.getText().toString().trim().isEmpty() ? UtilityNumber.parseBigDecimal(view.getText().toString(), Locale.getDefault()) : null;
|
||||
|
||||
if (!UtilityBigDecimal.equalsTo(viewValue, newValue)) {
|
||||
view.setText(UtilityNumber.decimalToString(newValue));
|
||||
@@ -322,7 +326,7 @@ public class Converters {
|
||||
String newValueString = s.toString().trim();
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(newValueString))
|
||||
value = new BigDecimal(newValueString);
|
||||
value = UtilityNumber.parseBigDecimal(newValueString, Locale.getDefault());
|
||||
|
||||
observableBigDecimal.set(value);
|
||||
}
|
||||
@@ -331,7 +335,7 @@ public class Converters {
|
||||
view.addTextChangedListener(watcher);
|
||||
}
|
||||
BigDecimal newValue = observableBigDecimal.get();
|
||||
BigDecimal viewValue = !view.getText().toString().trim().isEmpty() ? new BigDecimal(view.getText().toString()) : null;
|
||||
BigDecimal viewValue = !view.getText().toString().trim().isEmpty() ? UtilityNumber.parseBigDecimal(view.getText().toString(), Locale.getDefault()) : null;
|
||||
|
||||
if (!UtilityBigDecimal.equalsTo(viewValue, newValue)) {
|
||||
view.setText(UtilityNumber.decimalToString(newValue));
|
||||
@@ -350,7 +354,8 @@ public class Converters {
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
BigDecimal value = null;
|
||||
if (!UtilityString.isNullOrEmpty(s.toString()))
|
||||
value = new BigDecimal(s.toString());
|
||||
value = UtilityNumber.parseBigDecimal(s.toString(), Locale.getDefault());
|
||||
|
||||
bindableBigDecimal.set(value);
|
||||
}
|
||||
};
|
||||
@@ -358,7 +363,7 @@ public class Converters {
|
||||
view.addTextChangedListener(watcher);
|
||||
}
|
||||
BigDecimal newValue = bindableBigDecimal.get();
|
||||
BigDecimal viewValue = !view.getText().toString().trim().isEmpty() ? new BigDecimal(view.getText().toString()) : null;
|
||||
BigDecimal viewValue = !view.getText().toString().trim().isEmpty() ? UtilityNumber.parseBigDecimal(view.getText().toString(), Locale.getDefault()) : null;
|
||||
|
||||
if (!UtilityBigDecimal.equalsTo(viewValue, newValue)) {
|
||||
view.setText(UtilityNumber.decimalToString(newValue));
|
||||
@@ -974,4 +979,64 @@ public class Converters {
|
||||
view.setLayoutParams(layoutParams);
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* BindingAdapter per bindare una LocalDate diretta su una TextView con un formato specificato.
|
||||
* Esempio di utilizzo in XML:
|
||||
* app:localDateText="@{myLocalDate}" app:dateFormat="@{@string/my_date_format}"
|
||||
*/
|
||||
@BindingAdapter(value = {"localDateText", "dateFormat"}, requireAll = false)
|
||||
public static void bindLocalDateText(TextView view, LocalDate date, String dateFormat) {
|
||||
if (date == null) {
|
||||
view.setText("");
|
||||
return;
|
||||
}
|
||||
String pattern = dateFormat != null ? dateFormat : "dd/MM/yyyy";
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern);
|
||||
view.setText(date.format(formatter));
|
||||
}
|
||||
|
||||
@BindingAdapter(value = {"localDateTimeText", "dateFormat"}, requireAll = false)
|
||||
public static void bindLocalDateText(TextView view, LocalDateTime date, String dateFormat) {
|
||||
if (date == null) {
|
||||
view.setText("");
|
||||
return;
|
||||
}
|
||||
String pattern = dateFormat != null ? dateFormat : "dd/MM/yyyy hh:mm";
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern);
|
||||
view.setText(date.format(formatter));
|
||||
}
|
||||
|
||||
/**
|
||||
* BindingAdapter per bindare una ObservableField<LocalDate> su una TextView con un formato specificato.
|
||||
* Esempio di utilizzo in XML:
|
||||
* app:localDateObservableText="@{myObservableLocalDate}" app:dateFormat="@{@string/my_date_format}"
|
||||
*/
|
||||
@BindingAdapter(value = {"localDateObservableText", "dateFormat"}, requireAll = false)
|
||||
public static void bindObservableLocalDateText(TextView view, ObservableField<LocalDate> observableDate, String dateFormat) {
|
||||
if (observableDate == null) {
|
||||
view.setText("");
|
||||
return;
|
||||
}
|
||||
LocalDate date = observableDate.get();
|
||||
if (date == null) {
|
||||
view.setText("");
|
||||
return;
|
||||
}
|
||||
String pattern = dateFormat != null ? dateFormat : "dd/MM/yyyy";
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern);
|
||||
view.setText(date.format(formatter));
|
||||
}
|
||||
|
||||
/**
|
||||
* BindingAdapter che applica automaticamente il KeyListener localizzato
|
||||
* ai campi con inputType numberDecimal, permettendo l'uso della virgola
|
||||
* come separatore decimale in base al locale del dispositivo.
|
||||
*/
|
||||
@BindingAdapter("useLocaleDecimalInput")
|
||||
public static void setLocaleDecimalInput(EditText view, boolean useLocaleInput) {
|
||||
if (useLocaleInput) {
|
||||
view.setKeyListener(LocaleDecimalKeyListener.getInstance());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -66,9 +66,6 @@ public class Ean128Service {
|
||||
|
||||
switch (aiModel.AI) {
|
||||
case SSCC -> {
|
||||
if (aiValue.length() > 0 && (aiValue.charAt(0) == '0' || aiValue.charAt(0) == '9')) {
|
||||
aiValue = new StringBuilder(aiValue.substring(1));
|
||||
}
|
||||
model.Sscc = aiValue.toString();
|
||||
}
|
||||
case GTIN -> {
|
||||
|
||||
@@ -97,6 +97,8 @@ public class MtbAart extends EntityBase {
|
||||
|
||||
private List<MtbUntMis> mtbUntMis;
|
||||
|
||||
private List<MtbAartBarCode> mtbAartBarCode;
|
||||
|
||||
|
||||
public enum UntMisRifPesoEnum {
|
||||
C,
|
||||
@@ -965,6 +967,13 @@ public class MtbAart extends EntityBase {
|
||||
return getMtbUntMis() != null && !getMtbUntMis().isEmpty() ? getMtbUntMis().get(0) : null;
|
||||
}
|
||||
|
||||
public List<MtbAartBarCode> getMtbAartBarCode() {
|
||||
return mtbAartBarCode;
|
||||
}
|
||||
|
||||
public void setMtbAartBarCode(List<MtbAartBarCode> mtbAartBarCode) {
|
||||
this.mtbAartBarCode = mtbAartBarCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
package it.integry.integrywmsnative.core.model;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
public class MtbAartBarCode extends EntityBase {
|
||||
private String codBarre;
|
||||
private String codMart;
|
||||
private BigDecimal qtaCnf;
|
||||
private String flagPrimario;
|
||||
private String tipoCodBarre;
|
||||
|
||||
public MtbAartBarCode() {
|
||||
this.type = "mtb_aart_bar_code";
|
||||
}
|
||||
|
||||
public String getCodBarre() {
|
||||
return codBarre;
|
||||
}
|
||||
|
||||
public void setCodBarre(String codBarre) {
|
||||
this.codBarre = codBarre;
|
||||
}
|
||||
|
||||
public String getCodMart() {
|
||||
return codMart;
|
||||
}
|
||||
|
||||
public void setCodMart(String codMart) {
|
||||
this.codMart = codMart;
|
||||
}
|
||||
|
||||
public BigDecimal getQtaCnf() {
|
||||
return qtaCnf;
|
||||
}
|
||||
|
||||
public void setQtaCnf(BigDecimal qtaCnf) {
|
||||
this.qtaCnf = qtaCnf;
|
||||
}
|
||||
|
||||
public String getFlagPrimario() {
|
||||
return flagPrimario;
|
||||
}
|
||||
|
||||
public void setFlagPrimario(String flagPrimario) {
|
||||
this.flagPrimario = flagPrimario;
|
||||
}
|
||||
|
||||
public String getTipoCodBarre() {
|
||||
return tipoCodBarre;
|
||||
}
|
||||
|
||||
public void setTipoCodBarre(String tipoCodBarre) {
|
||||
this.tipoCodBarre = tipoCodBarre;
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@ package it.integry.integrywmsnative.core.model.dto;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
|
||||
public class AlreadyRegisteredUDCDTO {
|
||||
public class AlreadyRegisteredUlDTO {
|
||||
|
||||
private MtbColt mtbColt;
|
||||
|
||||
@@ -13,7 +13,7 @@ public class AlreadyRegisteredUDCDTO {
|
||||
return mtbColt;
|
||||
}
|
||||
|
||||
public AlreadyRegisteredUDCDTO setMtbColt(MtbColt mtbColt) {
|
||||
public AlreadyRegisteredUlDTO setMtbColt(MtbColt mtbColt) {
|
||||
this.mtbColt = mtbColt;
|
||||
return this;
|
||||
}
|
||||
@@ -22,7 +22,7 @@ public class AlreadyRegisteredUDCDTO {
|
||||
return canBeRecovered;
|
||||
}
|
||||
|
||||
public AlreadyRegisteredUDCDTO setCanBeRecovered(boolean canBeRecovered) {
|
||||
public AlreadyRegisteredUlDTO setCanBeRecovered(boolean canBeRecovered) {
|
||||
this.canBeRecovered = canBeRecovered;
|
||||
return this;
|
||||
}
|
||||
@@ -28,7 +28,7 @@ public class AuthInterceptor implements Interceptor {
|
||||
public Response intercept(@NonNull Chain chain) throws IOException {
|
||||
var originalRequest = chain.request();
|
||||
|
||||
if (SettingsManager.i().getUserSession() != null) {
|
||||
if (SettingsManager.i().getUserSession() != null && SettingsManager.i().getUserSession().getAccessToken() != null) {
|
||||
|
||||
var accessToken = SettingsManager.i().getUserSession().getAccessToken();
|
||||
var accessTokenExpiryDate = SettingsManager.i().getUserSession().getAccessTokenExpiryDate();
|
||||
@@ -55,21 +55,22 @@ public class AuthInterceptor implements Interceptor {
|
||||
.protocol(Protocol.HTTP_1_1)
|
||||
.code(401)
|
||||
.message("Unauthorized")
|
||||
.body(ResponseBody.create(new byte[0], null))
|
||||
.body(ResponseBody.create(okhttp3.MediaType.get("application/json"), new byte[0]))
|
||||
.build();
|
||||
} catch (Exception e) {
|
||||
return chain.proceed(originalRequest);
|
||||
}
|
||||
|
||||
//Retrieve the new access token after refresh
|
||||
accessToken = SettingsManager.i().getUserSession().getAccessToken();
|
||||
}
|
||||
|
||||
// Add the access token to the request header
|
||||
var authorizedRequest = originalRequest.newBuilder()
|
||||
.header("Authorization", "Bearer " + SettingsManager.i().getUserSession().getAccessToken())
|
||||
.build();
|
||||
// Add the access token to the request header
|
||||
var authorizedRequest = originalRequest.newBuilder()
|
||||
.header("Authorization", "Bearer " + accessToken)
|
||||
.build();
|
||||
|
||||
return chain.proceed(authorizedRequest);
|
||||
} else
|
||||
return chain.proceed(originalRequest);
|
||||
return chain.proceed(authorizedRequest);
|
||||
} else
|
||||
return chain.proceed(originalRequest);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package it.integry.integrywmsnative.core.rest;
|
||||
import java.io.IOException;
|
||||
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
import okhttp3.HttpUrl;
|
||||
import okhttp3.Interceptor;
|
||||
import okhttp3.Request;
|
||||
@@ -18,31 +18,23 @@ public class HttpInterceptor implements Interceptor {
|
||||
@Override
|
||||
public Response intercept(Chain chain) throws IOException {
|
||||
|
||||
final String PROFILE_DB = SettingsManager.i().getUserSession() == null ? null : SettingsManager.i().getUserSession().getProfileDB();
|
||||
final String APP_TOKEN = "fa3a21af-606b-4129-a22b-aedc2a52c7b6";
|
||||
final String PROFILE_DB = SettingsManager.i().getUserSession() == null ? null : SettingsManager.i().getUserSession().getProfileDB();
|
||||
final String APP_TOKEN = "fa3a21af-606b-4129-a22b-aedc2a52c7b6";
|
||||
|
||||
final Request request = chain.request();
|
||||
final HttpUrl url = request.url().newBuilder()
|
||||
.addQueryParameter("profileDb", PROFILE_DB)
|
||||
.build();
|
||||
HttpUrl.Builder urlBuilder = chain.request().url().newBuilder();
|
||||
|
||||
Request.Builder builder = chain.request().newBuilder()
|
||||
if (!UtilityString.isNullOrEmpty(PROFILE_DB))
|
||||
urlBuilder
|
||||
.addQueryParameter("profileDb", PROFILE_DB);
|
||||
|
||||
HttpUrl url = urlBuilder.build();
|
||||
|
||||
final Request.Builder requestBuilder = chain.request().newBuilder();
|
||||
Request.Builder builder = requestBuilder
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.addHeader("Accept", "*/*")
|
||||
.addHeader("x-app-token", APP_TOKEN);
|
||||
|
||||
|
||||
String accessToken = null;
|
||||
|
||||
//Nel caso in cui il token è scaduto e devo richiamare la refresh non bisogna passare il vecchio token
|
||||
if(SettingsManager.i().getUserSession().getAccessTokenExpiryDate() != null &&
|
||||
UtilityDate.getNowTime().isBefore(SettingsManager.i().getUserSession().getAccessTokenExpiryDate().minusSeconds(20))) {
|
||||
accessToken = SettingsManager.i().getUserSession().getAccessToken();
|
||||
}
|
||||
|
||||
if(accessToken != null)
|
||||
builder.header("Authorization", "Bearer " + accessToken);
|
||||
|
||||
var newRequest = builder
|
||||
.url(url)
|
||||
.build();
|
||||
|
||||
@@ -37,19 +37,19 @@ public class RESTBuilder {
|
||||
}
|
||||
|
||||
public <T> T getService(final Class<T> service, int timeout) {
|
||||
return getService(service, SettingsManager.i().getServer().getProtocol(), SettingsManager.i().getServer().getHost(), SettingsManager.i().getServer().getPort(), true, true, timeout);
|
||||
return getService(service, SettingsManager.i().getServer().getProtocol(), SettingsManager.i().getServer().getHost(), SettingsManager.i().getServer().getPort(), true, timeout);
|
||||
|
||||
}
|
||||
|
||||
public <T> T getService(final Class<T> service, String protocol, String host, int port, boolean addInterceptors) {
|
||||
return getService(service, protocol, host, port, addInterceptors, true, 60);
|
||||
public <T> T getService(final Class<T> service, String protocol, String host, int port) {
|
||||
return getService(service, protocol, host, port, true, 60);
|
||||
}
|
||||
|
||||
public <T> T getService(final Class<T> service, String protocol, String host, int port, boolean addInterceptors, boolean addEmsApi) {
|
||||
return getService(service, protocol, host, port, addInterceptors, addEmsApi, 60);
|
||||
public <T> T getService(final Class<T> service, String protocol, String host, int port, boolean addEmsApi) {
|
||||
return getService(service, protocol, host, port, addEmsApi, 60);
|
||||
}
|
||||
|
||||
public <T> T getService(final Class<T> service, String protocol, String host, int port, boolean addInterceptors, boolean addEmsApi, int timeout) {
|
||||
public <T> T getService(final Class<T> service, String protocol, String host, int port, boolean addEmsApi, int timeout) {
|
||||
OkHttpClient.Builder clientBuilder = getDefaultHttpClient();
|
||||
|
||||
timeout = 0;
|
||||
@@ -62,7 +62,7 @@ public class RESTBuilder {
|
||||
clientBuilder.retryOnConnectionFailure(true);
|
||||
|
||||
clientBuilder.addInterceptor(authInterceptor);
|
||||
if (addInterceptors) clientBuilder.addInterceptor(new HttpInterceptor());
|
||||
clientBuilder.addInterceptor(new HttpInterceptor());
|
||||
if (ADD_LOGGER_INTERCEPTOR) clientBuilder.addInterceptor(new HttpLoggerInterceptor());
|
||||
|
||||
OkHttpClient client = clientBuilder.build();
|
||||
|
||||
@@ -3,6 +3,7 @@ package it.integry.integrywmsnative.core.rest.consumers;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
@@ -20,9 +21,11 @@ import retrofit2.Response;
|
||||
public class DocumentRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
private final RESTBuilder restBuilder;
|
||||
private final ExecutorService executorService;
|
||||
|
||||
public DocumentRESTConsumer(RESTBuilder restBuilder) {
|
||||
public DocumentRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService) {
|
||||
this.restBuilder = restBuilder;
|
||||
this.executorService = executorService;
|
||||
}
|
||||
|
||||
public void createDocsFromColli(List<LoadColliDTO> listColli, RunnableArgs<List<DtbDoct>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
@@ -40,17 +43,22 @@ public class DocumentRESTConsumer extends _BaseRESTConsumer {
|
||||
});
|
||||
}
|
||||
|
||||
public void createDocFromColli(LoadColliDTO loadColliDTO, RunnableArgs<DtbDoct> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public DtbDoct makeSynchronousCreateDocFromColliRequest(LoadColliDTO loadColliDTO) throws Exception {
|
||||
DocumentiRESTConsumerService documentiRESTConsumerService = restBuilder.getService(DocumentiRESTConsumerService.class);
|
||||
documentiRESTConsumerService.createDocFromColli(loadColliDTO).enqueue(new ManagedErrorCallback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<DtbDoct>> call, Response<ServiceRESTResponse<DtbDoct>> response) {
|
||||
analyzeAnswer(response, "createDocFromColli", onComplete, onFailed);
|
||||
}
|
||||
var response = documentiRESTConsumerService
|
||||
.createDocFromColli(loadColliDTO)
|
||||
.execute();
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<DtbDoct>> call, @NonNull final Exception e) {
|
||||
onFailed.run(e);
|
||||
return analyzeAnswer(response, "createDocFromColli");
|
||||
}
|
||||
|
||||
public void makeCreateDocFromColliRequest(LoadColliDTO loadColliDTO, RunnableArgs<DtbDoct> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
var result = makeSynchronousCreateDocFromColliRequest(loadColliDTO);
|
||||
if (onComplete != null) onComplete.run(result);
|
||||
} catch (Exception ex) {
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -5,8 +5,11 @@ import java.util.List;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
|
||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||
import it.integry.integrywmsnative.core.rest.model.pv.CloseVerificaRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.pv.DeleteRowVerificaRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.pv.GiacenzaPvDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.pv.SaveNewVerificaRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.pv.SaveNewRowVerificaRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.pv.UpdateRowVerificaRequestDTO;
|
||||
|
||||
public class GiacenzaPvRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
@@ -30,12 +33,36 @@ public class GiacenzaPvRESTConsumer extends _BaseRESTConsumer {
|
||||
return giacenzeList != null ? giacenzeList : new ArrayList<>();
|
||||
}
|
||||
|
||||
public void saveNewVerificaSynchronized(SaveNewVerificaRequestDTO saveNewVerificaRequest) throws Exception {
|
||||
public void saveNewRowSynchronized(SaveNewRowVerificaRequestDTO saveNewRowVerificaRequest) throws Exception {
|
||||
GiacenzaPvRESTConsumerService giacenzaPvRESTConsumerService = restBuilder.getService(GiacenzaPvRESTConsumerService.class, 0);
|
||||
var response = giacenzaPvRESTConsumerService.saveNewVerifica(saveNewVerificaRequest)
|
||||
var response = giacenzaPvRESTConsumerService.saveNewRowVerifica(saveNewRowVerificaRequest)
|
||||
.execute();
|
||||
|
||||
analyzeAnswer(response, "save-verifica-pv");
|
||||
analyzeAnswer(response, "save-row-verifica-pv");
|
||||
}
|
||||
|
||||
public void updateRowSynchronized(UpdateRowVerificaRequestDTO updateRowVerificaRequest) throws Exception {
|
||||
GiacenzaPvRESTConsumerService giacenzaPvRESTConsumerService = restBuilder.getService(GiacenzaPvRESTConsumerService.class, 0);
|
||||
var response = giacenzaPvRESTConsumerService.updateRowVerifica(updateRowVerificaRequest)
|
||||
.execute();
|
||||
|
||||
analyzeAnswer(response, "update-row-verifica-pv");
|
||||
}
|
||||
|
||||
public void deleteRowSynchronized(DeleteRowVerificaRequestDTO deleteRowVerificaRequest) throws Exception {
|
||||
GiacenzaPvRESTConsumerService giacenzaPvRESTConsumerService = restBuilder.getService(GiacenzaPvRESTConsumerService.class, 0);
|
||||
var response = giacenzaPvRESTConsumerService.deleteRowVerifica(deleteRowVerificaRequest)
|
||||
.execute();
|
||||
|
||||
analyzeAnswer(response, "delete-row-verifica-pv");
|
||||
}
|
||||
|
||||
public void closeVerifica(CloseVerificaRequestDTO closeVerificaRequestDTO) throws Exception {
|
||||
GiacenzaPvRESTConsumerService giacenzaPvRESTConsumerService = restBuilder.getService(GiacenzaPvRESTConsumerService.class, 0);
|
||||
var response = giacenzaPvRESTConsumerService.closeVerifica(closeVerificaRequestDTO)
|
||||
.execute();
|
||||
|
||||
analyzeAnswer(response, "close-verifica-pv");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,8 +3,11 @@ package it.integry.integrywmsnative.core.rest.consumers;
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.core.rest.model.pv.CloseVerificaRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.pv.DeleteRowVerificaRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.pv.GiacenzaPvDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.pv.SaveNewVerificaRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.pv.SaveNewRowVerificaRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.pv.UpdateRowVerificaRequestDTO;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.http.Body;
|
||||
import retrofit2.http.GET;
|
||||
@@ -17,6 +20,15 @@ public interface GiacenzaPvRESTConsumerService {
|
||||
Call<ServiceRESTResponse<List<GiacenzaPvDTO>>> retrieve(@Query("codMdep") String codMdep);
|
||||
|
||||
|
||||
@POST("wms/pv/verifica_giacenze/save_new_verifica")
|
||||
Call<ServiceRESTResponse<Void>> saveNewVerifica(@Body SaveNewVerificaRequestDTO saveNewVerificaRequest);
|
||||
@POST("wms/pv/verifica_giacenze/save_new_row")
|
||||
Call<ServiceRESTResponse<Void>> saveNewRowVerifica(@Body SaveNewRowVerificaRequestDTO saveNewRowVerificaRequest);
|
||||
|
||||
@POST("wms/pv/verifica_giacenze/update_row")
|
||||
Call<ServiceRESTResponse<Void>> updateRowVerifica(@Body UpdateRowVerificaRequestDTO updateRowVerificaRequest);
|
||||
|
||||
@POST("wms/pv/verifica_giacenze/delete_row")
|
||||
Call<ServiceRESTResponse<Void>> deleteRowVerifica(@Body DeleteRowVerificaRequestDTO deleteRowVerificaRequest);
|
||||
|
||||
@POST("wms/pv/verifica_giacenze/close_verifica")
|
||||
Call<ServiceRESTResponse<Void>> closeVerifica(@Body CloseVerificaRequestDTO closeVerificaRequest);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package it.integry.integrywmsnative.core.rest.consumers;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
@@ -9,6 +10,7 @@ import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||
import it.integry.integrywmsnative.core.rest.model.materiali.RecuperaMaterialiRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.materiali.VersaMaterialiRequestDTO;
|
||||
import it.integry.integrywmsnative.gest.prod_recupero_materiale.dto.HistoryVersamentoProdULRestDTO;
|
||||
|
||||
@Singleton
|
||||
public class MaterialiRESTConsumer extends _BaseRESTConsumer {
|
||||
@@ -21,6 +23,28 @@ public class MaterialiRESTConsumer extends _BaseRESTConsumer {
|
||||
this.executorService = executorService;
|
||||
}
|
||||
|
||||
public List<HistoryVersamentoProdULRestDTO> makeSynchronousRetrieveLastVersamentiRequest(String codJfas) throws Exception {
|
||||
var materialiRESTConsumerService = restBuilder.getService(MaterialiRESTConsumerService.class);
|
||||
|
||||
var response = materialiRESTConsumerService.retrieveLastVersamenti(codJfas)
|
||||
.execute();
|
||||
|
||||
|
||||
var data = analyzeAnswer(response, "retrieveLastVersamenti");
|
||||
return data;
|
||||
}
|
||||
|
||||
public void makeRetrieveLastVersamentiRequest(String codJfas, final RunnableArgs<List<HistoryVersamentoProdULRestDTO>> onComplete, final RunnableArgs<Exception> onFailed) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
var response = makeSynchronousRetrieveLastVersamentiRequest(codJfas);
|
||||
if (onComplete != null) onComplete.run(response);
|
||||
} catch (Exception ex) {
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public MtbColt makeSynchronousRecuperaRequest(RecuperaMaterialiRequestDTO request) throws Exception {
|
||||
var materialiRESTConsumerService = restBuilder.getService(MaterialiRESTConsumerService.class);
|
||||
|
||||
|
||||
@@ -1,17 +1,26 @@
|
||||
package it.integry.integrywmsnative.core.rest.consumers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.core.rest.model.materiali.RecuperaMaterialiRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.materiali.RecuperaMaterialiResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.materiali.VersaMaterialiRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.materiali.VersaMaterialiResponseDTO;
|
||||
import it.integry.integrywmsnative.gest.prod_recupero_materiale.dto.HistoryVersamentoProdULRestDTO;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.http.Body;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.POST;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
public interface MaterialiRESTConsumerService {
|
||||
|
||||
@POST("wms/materiali/versa")
|
||||
Call<ServiceRESTResponse<RecuperaMaterialiResponseDTO>> versa(@Body VersaMaterialiRequestDTO request);
|
||||
Call<ServiceRESTResponse<VersaMaterialiResponseDTO>> versa(@Body VersaMaterialiRequestDTO request);
|
||||
|
||||
@GET("wms/materiali/retrieveLastVersamenti")
|
||||
Call<ServiceRESTResponse<List<HistoryVersamentoProdULRestDTO>>> retrieveLastVersamenti(@Query("codJfas") String codJfas);
|
||||
|
||||
@POST("wms/materiali/recupera")
|
||||
Call<ServiceRESTResponse<RecuperaMaterialiResponseDTO>> recupera(@Body RecuperaMaterialiRequestDTO request);
|
||||
|
||||
@@ -4,11 +4,8 @@ import androidx.annotation.NonNull;
|
||||
|
||||
import com.annimon.stream.Optional;
|
||||
import com.annimon.stream.Stream;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
@@ -21,6 +18,7 @@ import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.model.MtbPartitaMag;
|
||||
import it.integry.integrywmsnative.core.model.OrdineInevasoDTO;
|
||||
import it.integry.integrywmsnative.core.model.dto.AlreadyRegisteredUlDTO;
|
||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
|
||||
@@ -28,8 +26,7 @@ import it.integry.integrywmsnative.core.rest.model.GetPickingListDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.OrdineUscitaInevasoDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.core.rest.model.SitArtOrdDTO;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDB;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityQuery;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.RetrieveAlreadyRegisteredUdsRequestDTO;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
import it.integry.integrywmsnative.gest.spedizione.model.PickingObjectDTO;
|
||||
import retrofit2.Call;
|
||||
@@ -180,44 +177,27 @@ public class OrdiniRESTConsumer extends _BaseRESTConsumer {
|
||||
});
|
||||
}
|
||||
|
||||
public void getBancaliGiaRegistrati(List<OrdineInevasoDTO> orders, GestioneEnum gestione, int segno, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
String whereCondGestione = "";
|
||||
public List<AlreadyRegisteredUlDTO> getBancaliGiaRegistratiSynchronized(List<? extends OrdineInevasoDTO> orders, int segno) throws Exception {
|
||||
OrdiniRESTConsumerService service = restBuilder.getService(OrdiniRESTConsumerService.class);
|
||||
|
||||
if (gestione != null) {
|
||||
whereCondGestione = "mtb_colt.gestione = " + UtilityDB.valueToString(gestione.getText()) + " ";
|
||||
} else {
|
||||
whereCondGestione = "(mtb_colt.gestione = 'V' OR mtb_colt.gestione = 'L') ";
|
||||
}
|
||||
var request = new RetrieveAlreadyRegisteredUdsRequestDTO()
|
||||
.setOrdini(orders)
|
||||
.setSegno(segno);
|
||||
|
||||
String baseSql = "SELECT DISTINCT mtb_colt.* " +
|
||||
"FROM mtb_colt " +
|
||||
" INNER JOIN mtb_colr ON " +
|
||||
" mtb_colt.gestione = mtb_colr.gestione " +
|
||||
" AND mtb_colt.ser_collo = mtb_colr.ser_collo " +
|
||||
" AND mtb_colt.data_collo = mtb_colr.data_collo " +
|
||||
" AND mtb_colt.num_collo = mtb_colr.num_collo " +
|
||||
" WHERE " + whereCondGestione +
|
||||
" AND mtb_colt.segno = " + UtilityDB.valueToString(segno) + " " +
|
||||
" AND mtb_colt.data_doc IS NULL AND ";
|
||||
var response = service.retrieveAlreadyRegisteredUDS(request)
|
||||
.execute();
|
||||
var data = analyzeAnswer(response, "getBancaliGiaRegistrati");
|
||||
return data == null || data.getUdsList() == null ? new ArrayList<>() : data.getUdsList();
|
||||
}
|
||||
|
||||
List<HashMap<String, Object>> whereCondMapList = new ArrayList<>();
|
||||
for (OrdineInevasoDTO ordineInevaso : orders) {
|
||||
HashMap<String, Object> whereCondMap = new HashMap<>();
|
||||
whereCondMap.put("mtb_colr.data_ord", ordineInevaso.getDataOrdD());
|
||||
whereCondMap.put("mtb_colr.num_ord", ordineInevaso.getNumOrd());
|
||||
whereCondMap.put("mtb_colr.gestione", ordineInevaso.getGestione());
|
||||
|
||||
whereCondMapList.add(whereCondMap);
|
||||
}
|
||||
|
||||
baseSql += "(" + UtilityQuery.concatFieldListInWhereCond(whereCondMapList) + ")";
|
||||
|
||||
Type typeOfObjectsList = new TypeToken<ArrayList<MtbColt>>() {
|
||||
}.getType();
|
||||
this.mSystemRESTConsumer.<List<MtbColt>>processSql(baseSql, typeOfObjectsList, value -> {
|
||||
if (onComplete != null) onComplete.run(value);
|
||||
}, ex -> {
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
public void getBancaliGiaRegistrati(List<OrdineInevasoDTO> orders, int segno, RunnableArgs<List<AlreadyRegisteredUlDTO>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
var result = getBancaliGiaRegistratiSynchronized(orders, segno);
|
||||
if (onComplete != null) onComplete.run(result);
|
||||
} catch (Exception ex) {
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,8 @@ import java.util.List;
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.core.rest.model.SitArtOrdDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.OrdineUscitaInevasoDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.RetrieveAlreadyRegisteredUdsRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.RetrieveAlreadyRegisteredUdsResponseDTO;
|
||||
import it.integry.integrywmsnative.gest.spedizione.model.PickingObjectDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.GetPickingListDTO;
|
||||
import retrofit2.Call;
|
||||
@@ -23,4 +25,7 @@ public interface OrdiniRESTConsumerService {
|
||||
|
||||
@GET("SM2GetOrdiniVenditaInevasi")
|
||||
Call<ServiceRESTResponse<List<OrdineUscitaInevasoDTO>>> getOrdiniInevasi(@Query("codMdep") String codMdep, @Query("gestione") String gestione);
|
||||
|
||||
@POST("wms/spedizione/retrieveAlreadyRegisteredUDS")
|
||||
Call<ServiceRESTResponse<RetrieveAlreadyRegisteredUdsResponseDTO>> retrieveAlreadyRegisteredUDS(@Body RetrieveAlreadyRegisteredUdsRequestDTO request);
|
||||
}
|
||||
|
||||
@@ -125,13 +125,12 @@ public class PrinterRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
public void printClosedOrdersSynchronized(PrintOrderCloseDTO dto, String codMdep) throws Exception {
|
||||
if (BuildConfig.DEBUG) {
|
||||
return;
|
||||
// return;
|
||||
}
|
||||
|
||||
PrinterRESTConsumerService printerService = restBuilder.getService(PrinterRESTConsumerService.class, 240);
|
||||
Call<ServiceRESTResponse<Object>> callable = printerService.printClosedOrders(codMdep, dto);
|
||||
|
||||
var response = callable.execute();
|
||||
var response = printerService.printClosedOrders(codMdep, dto).execute();
|
||||
analyzeAnswer(response, "printCollo");
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
package it.integry.integrywmsnative.core.rest.consumers;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
@@ -17,8 +14,6 @@ import java.util.concurrent.ExecutorService;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import it.integry.integrywmsnative.BuildConfig;
|
||||
import it.integry.integrywmsnative.core.CommonConst;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
|
||||
@@ -27,9 +22,7 @@ import it.integry.integrywmsnative.core.rest.model.MailRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.NativeSqlRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.core.rest.model.system.LatestAppVersionInfoDTO;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityGson;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Response;
|
||||
|
||||
@@ -110,36 +103,6 @@ public class SystemRESTConsumer extends _BaseRESTConsumer {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public void sendErrorLogMail(String message, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
String currentAzienda = UtilityString.isNullOrEmpty(SettingsManager.i().getUserSession().getProfileDB()) ? "" : " [" + SettingsManager.i().getUserSession().getProfileDB() + "]";
|
||||
|
||||
String dest = "";
|
||||
if (BuildConfig.DEBUG) {
|
||||
dest = TextUtils.join(";", CommonConst.Mail.forErrorsDebug);
|
||||
} else {
|
||||
dest = TextUtils.join(";", CommonConst.Mail.forErrors);
|
||||
}
|
||||
|
||||
|
||||
MailRequestDTO mailDTO = new MailRequestDTO()
|
||||
.setFrom("sender@integry.it")
|
||||
.setFromName((BuildConfig.DEBUG ? "[DEBUG] " : "") + "WMS Android")
|
||||
.setTo(dest)
|
||||
.setSubject("Bug notification" + currentAzienda)
|
||||
.setMsgText(message)
|
||||
.setHtml(true);
|
||||
|
||||
sendMail(mailDTO, () -> {
|
||||
if (onComplete != null) onComplete.run();
|
||||
}, ex -> {
|
||||
Log.e(SystemRESTConsumer.class.getName(), "", ex);
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public void sendMailSynchronized(MailRequestDTO mailDTO) throws Exception {
|
||||
SystemRESTConsumerService service = restBuilder.getService(SystemRESTConsumerService.class);
|
||||
var response = service.sendMail(mailDTO).execute();
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
package it.integry.integrywmsnative.core.rest.model;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class AvailableCodMdepsDTO {
|
||||
|
||||
@SerializedName("codMdep")
|
||||
private String codMdep;
|
||||
|
||||
@SerializedName("descrizione")
|
||||
private String descrizione;
|
||||
|
||||
public String getCodMdep() {
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package it.integry.integrywmsnative.core.rest.model.pv;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
public class CloseVerificaRequestDTO {
|
||||
|
||||
private String codMdep;
|
||||
private LocalDateTime dataVerifica;
|
||||
|
||||
public String getCodMdep() {
|
||||
return codMdep;
|
||||
}
|
||||
|
||||
public CloseVerificaRequestDTO setCodMdep(String codMdep) {
|
||||
this.codMdep = codMdep;
|
||||
return this;
|
||||
}
|
||||
|
||||
public LocalDateTime getDataVerifica() {
|
||||
return dataVerifica;
|
||||
}
|
||||
|
||||
public CloseVerificaRequestDTO setDataVerifica(LocalDateTime dataVerifica) {
|
||||
this.dataVerifica = dataVerifica;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package it.integry.integrywmsnative.core.rest.model.pv;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
public class DeleteRowVerificaRequestDTO {
|
||||
|
||||
private String codMdep;
|
||||
private LocalDateTime dataVerifica;
|
||||
private VerificaGiacenzeRowDTO row;
|
||||
|
||||
public String getCodMdep() {
|
||||
return codMdep;
|
||||
}
|
||||
|
||||
public DeleteRowVerificaRequestDTO setCodMdep(String codMdep) {
|
||||
this.codMdep = codMdep;
|
||||
return this;
|
||||
}
|
||||
|
||||
public LocalDateTime getDataVerifica() {
|
||||
return dataVerifica;
|
||||
}
|
||||
|
||||
public DeleteRowVerificaRequestDTO setDataVerifica(LocalDateTime dataVerifica) {
|
||||
this.dataVerifica = dataVerifica;
|
||||
return this;
|
||||
}
|
||||
|
||||
public VerificaGiacenzeRowDTO getRow() {
|
||||
return row;
|
||||
}
|
||||
|
||||
public DeleteRowVerificaRequestDTO setRow(VerificaGiacenzeRowDTO row) {
|
||||
this.row = row;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package it.integry.integrywmsnative.core.rest.model.pv;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
public class SaveNewRowVerificaRequestDTO {
|
||||
|
||||
private String codMdep;
|
||||
private LocalDateTime dataVerifica;
|
||||
private VerificaGiacenzeRowDTO row;
|
||||
|
||||
|
||||
public String getCodMdep() {
|
||||
return codMdep;
|
||||
}
|
||||
|
||||
public SaveNewRowVerificaRequestDTO setCodMdep(String codMdep) {
|
||||
this.codMdep = codMdep;
|
||||
return this;
|
||||
}
|
||||
|
||||
public LocalDateTime getDataVerifica() {
|
||||
return dataVerifica;
|
||||
}
|
||||
|
||||
public SaveNewRowVerificaRequestDTO setDataVerifica(LocalDateTime dataVerifica) {
|
||||
this.dataVerifica = dataVerifica;
|
||||
return this;
|
||||
}
|
||||
|
||||
public VerificaGiacenzeRowDTO getRow() {
|
||||
return row;
|
||||
}
|
||||
|
||||
public SaveNewRowVerificaRequestDTO setRow(VerificaGiacenzeRowDTO row) {
|
||||
this.row = row;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package it.integry.integrywmsnative.core.rest.model.pv;
|
||||
|
||||
public class SaveNewVerificaRequestDTO {
|
||||
|
||||
private VerificaGiacenzeDTO data;
|
||||
|
||||
public VerificaGiacenzeDTO getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public SaveNewVerificaRequestDTO setData(VerificaGiacenzeDTO data) {
|
||||
this.data = data;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package it.integry.integrywmsnative.core.rest.model.pv;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
public class UpdateRowVerificaRequestDTO {
|
||||
|
||||
private String codMdep;
|
||||
private LocalDateTime dataVerifica;
|
||||
private VerificaGiacenzeRowDTO row;
|
||||
|
||||
|
||||
public String getCodMdep() {
|
||||
return codMdep;
|
||||
}
|
||||
|
||||
public UpdateRowVerificaRequestDTO setCodMdep(String codMdep) {
|
||||
this.codMdep = codMdep;
|
||||
return this;
|
||||
}
|
||||
|
||||
public LocalDateTime getDataVerifica() {
|
||||
return dataVerifica;
|
||||
}
|
||||
|
||||
public UpdateRowVerificaRequestDTO setDataVerifica(LocalDateTime dataVerifica) {
|
||||
this.dataVerifica = dataVerifica;
|
||||
return this;
|
||||
}
|
||||
|
||||
public VerificaGiacenzeRowDTO getRow() {
|
||||
return row;
|
||||
}
|
||||
|
||||
public UpdateRowVerificaRequestDTO setRow(VerificaGiacenzeRowDTO row) {
|
||||
this.row = row;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package it.integry.integrywmsnative.core.rest.model.uds;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.OrdineInevasoDTO;
|
||||
|
||||
public class RetrieveAlreadyRegisteredUdsRequestDTO {
|
||||
|
||||
private List<? extends OrdineInevasoDTO> ordini;
|
||||
private int segno;
|
||||
|
||||
public List<? extends OrdineInevasoDTO> getOrdini() {
|
||||
return ordini;
|
||||
}
|
||||
|
||||
public RetrieveAlreadyRegisteredUdsRequestDTO setOrdini(List<? extends OrdineInevasoDTO> ordini) {
|
||||
this.ordini = ordini;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getSegno() {
|
||||
return segno;
|
||||
}
|
||||
|
||||
public RetrieveAlreadyRegisteredUdsRequestDTO setSegno(int segno) {
|
||||
this.segno = segno;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package it.integry.integrywmsnative.core.rest.model.uds;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.dto.AlreadyRegisteredUlDTO;
|
||||
|
||||
public class RetrieveAlreadyRegisteredUdsResponseDTO {
|
||||
|
||||
private List<AlreadyRegisteredUlDTO> udsList;
|
||||
|
||||
public List<AlreadyRegisteredUlDTO> getUdsList() {
|
||||
return udsList;
|
||||
}
|
||||
|
||||
public RetrieveAlreadyRegisteredUdsResponseDTO setUdsList(List<AlreadyRegisteredUlDTO> udsList) {
|
||||
this.udsList = udsList;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -97,6 +97,9 @@ public class DBSettingsModel {
|
||||
private List<String> allowedCodMgrpForArtCreation;
|
||||
private boolean flagAccettazioneGroupListForn = false;
|
||||
private boolean flagSpedizioneEnableFastPicking = false;
|
||||
private boolean flagAccettazioneBollaEditableQtaTot = true;
|
||||
private boolean flagViewSwitchDepoButton = true;
|
||||
private boolean flagProduzioneSkipAskVersamentoAutomatico;
|
||||
|
||||
public boolean isFlagSpedizioneEnableFakeGiacenza() {
|
||||
return flagSpedizioneEnableFakeGiacenza;
|
||||
@@ -815,4 +818,29 @@ public class DBSettingsModel {
|
||||
public void setFlagSpedizioneEnableFastPicking(boolean flagSpedizioneEnableFastPicking) {
|
||||
this.flagSpedizioneEnableFastPicking = flagSpedizioneEnableFastPicking;
|
||||
}
|
||||
|
||||
public boolean isFlagAccettazioneBollaEditableQtaTot() {
|
||||
return flagAccettazioneBollaEditableQtaTot;
|
||||
}
|
||||
|
||||
public void setFlagAccettazioneBollaEditableQtaTot(boolean flagAccettazioneBollaEditableQtaTot) {
|
||||
this.flagAccettazioneBollaEditableQtaTot = flagAccettazioneBollaEditableQtaTot;
|
||||
}
|
||||
|
||||
public boolean isFlagViewSwitchDepoButton() {
|
||||
return flagViewSwitchDepoButton;
|
||||
}
|
||||
|
||||
public void setFlagViewSwitchDepoButton(boolean flagViewSwitchDepoButton) {
|
||||
this.flagViewSwitchDepoButton = flagViewSwitchDepoButton;
|
||||
}
|
||||
|
||||
public boolean isFlagProduzioneSkipAskVersamentoAutomatico() {
|
||||
return flagProduzioneSkipAskVersamentoAutomatico;
|
||||
}
|
||||
|
||||
public DBSettingsModel setFlagProduzioneSkipAskVersamentoAutomatico(boolean flagProduzioneSkipAskVersamentoAutomatico) {
|
||||
this.flagProduzioneSkipAskVersamentoAutomatico = flagProduzioneSkipAskVersamentoAutomatico;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,8 +39,6 @@ public class SettingsManager {
|
||||
private static SettingsModel settingsModelIstance;
|
||||
private static DBSettingsModel dbSettingsModelIstance;
|
||||
|
||||
private static boolean firstStart = false;
|
||||
|
||||
private static Context mContext;
|
||||
private static SystemRESTConsumer mSystemRESTConsumer;
|
||||
private static ImballiRESTConsumer mImballiRESTConsumer;
|
||||
@@ -65,15 +63,15 @@ public class SettingsManager {
|
||||
public void init() {
|
||||
settingsModelIstance = (SettingsModel) Stash.getObject(TAG, SettingsModel.class);
|
||||
|
||||
if (settingsModelIstance == null) {
|
||||
if (settingsModelIstance == null)
|
||||
settingsModelIstance = new SettingsModel();
|
||||
|
||||
|
||||
if (settingsModelIstance.getServer() == null)
|
||||
settingsModelIstance.setServer(new SettingsModel.Server());
|
||||
firstStart = true;
|
||||
}
|
||||
|
||||
|
||||
dbSettingsModelIstance = new DBSettingsModel();
|
||||
|
||||
}
|
||||
|
||||
public SettingsModel getSettings() {
|
||||
@@ -89,10 +87,6 @@ public class SettingsManager {
|
||||
return dbSettingsModelIstance;
|
||||
}
|
||||
|
||||
public static boolean isFirstStart() {
|
||||
return firstStart;
|
||||
}
|
||||
|
||||
public static boolean isInstanceAvailable() {
|
||||
return i() != null;
|
||||
}
|
||||
@@ -307,6 +301,12 @@ public class SettingsManager {
|
||||
.setSection("PRODUZIONE")
|
||||
.setKeySection("VIEW_POSIZIONI")
|
||||
.setSetter(dbSettingsModelIstance::setViewPosizioni));
|
||||
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
|
||||
.setGestName("PICKING")
|
||||
.setSection("PRODUZIONE")
|
||||
.setKeySection("FLAG_SKIP_ASK_VERSAMENTO_AUTOMATICO")
|
||||
.setSetter(dbSettingsModelIstance::setFlagProduzioneSkipAskVersamentoAutomatico)
|
||||
.setDefaultValue(false));
|
||||
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
|
||||
.setGestName("PICKING")
|
||||
.setSection("SPEDIZIONE")
|
||||
@@ -564,6 +564,12 @@ public class SettingsManager {
|
||||
.setKeySection("ENABLE_FAST_PICKING")
|
||||
.setSetter(dbSettingsModelIstance::setFlagSpedizioneEnableFastPicking)
|
||||
.setDefaultValue(false));
|
||||
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
|
||||
.setGestName("PICKING")
|
||||
.setSection("ACCETTAZIONE_BOLLA")
|
||||
.setKeySection("FLAG_QTA_TOT_EDITABLE")
|
||||
.setSetter(dbSettingsModelIstance::setFlagAccettazioneBollaEditableQtaTot)
|
||||
.setDefaultValue(true));
|
||||
|
||||
stbGestSetupReaderList.add(new StbGestSetupReader<>(String.class)
|
||||
.setGestName("PICKING")
|
||||
@@ -617,6 +623,13 @@ public class SettingsManager {
|
||||
.setKeySection("ENABLE_ART_CREATION")
|
||||
.setSetter(dbSettingsModelIstance::setFlagEnableArtCreation));
|
||||
|
||||
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
|
||||
.setGestName("PICKING")
|
||||
.setSection("SETUP")
|
||||
.setKeySection("VIEW_SWITCH_DEPO_BUTTON")
|
||||
.setSetter(dbSettingsModelIstance::setFlagViewSwitchDepoButton)
|
||||
);
|
||||
|
||||
stbGestSetupReaderList.add(new StbGestSetupReader<>(String.class)
|
||||
.setGestName("PICKING")
|
||||
.setSection("SETUP")
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package it.integry.integrywmsnative.core.utility;
|
||||
|
||||
import android.text.method.DigitsKeyListener;
|
||||
|
||||
import java.text.DecimalFormatSymbols;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* KeyListener personalizzato che accetta numeri decimali
|
||||
* usando il separatore decimale del locale corrente (virgola per italiano)
|
||||
*/
|
||||
public class LocaleDecimalKeyListener {
|
||||
|
||||
/**
|
||||
* Ottiene un'istanza del KeyListener per il locale corrente
|
||||
*/
|
||||
public static DigitsKeyListener getInstance() {
|
||||
return getInstance(Locale.getDefault());
|
||||
}
|
||||
|
||||
/**
|
||||
* Ottiene un'istanza del KeyListener per un locale specifico
|
||||
*/
|
||||
public static DigitsKeyListener getInstance(Locale locale) {
|
||||
DecimalFormatSymbols symbols = new DecimalFormatSymbols(locale);
|
||||
char decimalSeparator = symbols.getDecimalSeparator();
|
||||
return DigitsKeyListener.getInstance("0123456789" + decimalSeparator);
|
||||
}
|
||||
}
|
||||
@@ -78,7 +78,7 @@ public class UtilityBarcode {
|
||||
|
||||
|
||||
public static boolean isEanPeso(BarcodeScanDTO barcodeScanDTO) {
|
||||
return (isEtichetta128(barcodeScanDTO) || isEan13(barcodeScanDTO)) && barcodeScanDTO.getStringValue().startsWith("2");
|
||||
return (isEtichetta128(barcodeScanDTO) || isEan13(barcodeScanDTO)) && barcodeScanDTO.getStringValue().length() == 13 && barcodeScanDTO.getStringValue().startsWith("2");
|
||||
}
|
||||
|
||||
public static boolean isEan8(BarcodeScanDTO barcodeScanDTO) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package it.integry.integrywmsnative.core.utility;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.DecimalFormatSymbols;
|
||||
import java.util.Locale;
|
||||
@@ -9,7 +10,8 @@ import it.integry.integrywmsnative.core.CommonConst;
|
||||
|
||||
public class UtilityNumber {
|
||||
|
||||
private static DecimalFormat decimalFormatInstance;
|
||||
// Locale italiano per la formattazione
|
||||
private static final Locale ITALIAN_LOCALE = new Locale("it", "IT");
|
||||
|
||||
public static String decimalToString(Float bigDecimal){
|
||||
if(bigDecimal == null) return "0";
|
||||
@@ -23,71 +25,59 @@ public class UtilityNumber {
|
||||
|
||||
public static String decimalToString(BigDecimal bigDecimal, int decimal){
|
||||
if(bigDecimal == null) return "0";
|
||||
return decimalToString(bigDecimal.floatValue(), decimal);
|
||||
|
||||
// Usa stripTrailingZeros per rimuovere gli zeri finali
|
||||
BigDecimal stripped = bigDecimal.stripTrailingZeros();
|
||||
// Limita il numero di decimali visualizzati
|
||||
int scale = Math.min(stripped.scale(), decimal);
|
||||
stripped = stripped.setScale(scale, RoundingMode.DOWN);
|
||||
|
||||
// Configura il formato italiano con virgola come separatore decimale
|
||||
DecimalFormatSymbols italianSymbols = new DecimalFormatSymbols(ITALIAN_LOCALE);
|
||||
italianSymbols.setDecimalSeparator(',');
|
||||
|
||||
// Crea il pattern dinamico basato sul numero di decimali
|
||||
StringBuilder patternBuilder = new StringBuilder("0");
|
||||
if (scale > 0) {
|
||||
patternBuilder.append(".");
|
||||
for (int i = 0; i < scale; i++) {
|
||||
patternBuilder.append("0");
|
||||
}
|
||||
}
|
||||
|
||||
DecimalFormat formatter = new DecimalFormat(patternBuilder.toString(), italianSymbols);
|
||||
String result = formatter.format(stripped);
|
||||
|
||||
// Se il risultato termina con ',', rimuovilo (per i numeri interi)
|
||||
if (result.endsWith(",")) {
|
||||
result = result.substring(0, result.length() - 1);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static String decimalToString(float floatValue, int decimal) {
|
||||
DecimalFormatSymbols otherSymbols = new DecimalFormatSymbols(Locale.getDefault());
|
||||
otherSymbols.setDecimalSeparator('.');
|
||||
otherSymbols.setGroupingSeparator(',');
|
||||
|
||||
final DecimalFormat decimalFormat = new DecimalFormat();
|
||||
decimalFormat.setMaximumFractionDigits(decimal);
|
||||
decimalFormat.setDecimalFormatSymbols(otherSymbols);
|
||||
decimalFormat.setGroupingUsed(false);
|
||||
decimalFormat.setMinimumFractionDigits(Math.min(2, decimal));
|
||||
|
||||
return decimalFormat.format(floatValue);
|
||||
return decimalToString(BigDecimal.valueOf(floatValue), decimal);
|
||||
}
|
||||
|
||||
public static DecimalFormat getNumberFormatInstance() {
|
||||
|
||||
if(decimalFormatInstance == null) {
|
||||
DecimalFormatSymbols otherSymbols = new DecimalFormatSymbols(Locale.getDefault());
|
||||
otherSymbols.setDecimalSeparator('.');
|
||||
otherSymbols.setGroupingSeparator(',');
|
||||
|
||||
decimalFormatInstance = new DecimalFormat();
|
||||
decimalFormatInstance.setMaximumFractionDigits(CommonConst.Config.NUMBER_OF_DECIMAL_DIGITS);
|
||||
decimalFormatInstance.setDecimalFormatSymbols(otherSymbols);
|
||||
decimalFormatInstance.setGroupingUsed(false);
|
||||
public static BigDecimal parseBigDecimal(String value, Locale locale) {
|
||||
if (value == null || value.trim().isEmpty()) return null;
|
||||
try {
|
||||
DecimalFormatSymbols symbols = new DecimalFormatSymbols(locale);
|
||||
DecimalFormat format = new DecimalFormat();
|
||||
format.setDecimalFormatSymbols(symbols);
|
||||
format.setParseBigDecimal(true);
|
||||
return (BigDecimal) format.parse(value);
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return decimalFormatInstance;
|
||||
}
|
||||
|
||||
public static int countNumberOfDecimalDigits(Float value) {
|
||||
String text = getNumberFormatInstance().format(Math.abs(value));
|
||||
int integerPlaces = text.indexOf('.');
|
||||
int decimalPlaces = text.length() - integerPlaces - 1;
|
||||
|
||||
return decimalPlaces;
|
||||
}
|
||||
|
||||
public static String normalizeStringNumber(String numberString) {
|
||||
return numberString.replaceAll(",", ".");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static Float decimalToFloat(BigDecimal bigDecimalValue) {
|
||||
float multiplier = (float) Math.pow(10, CommonConst.Config.NUMBER_OF_DECIMAL_DIGITS);
|
||||
|
||||
Float floatValue = null;
|
||||
|
||||
if(bigDecimalValue != null) {
|
||||
int intValue = (int) (bigDecimalValue.floatValue() * multiplier);
|
||||
floatValue = Float.valueOf(intValue / multiplier);
|
||||
}
|
||||
|
||||
return floatValue;
|
||||
}
|
||||
|
||||
public static float truncateToDecimal(float v, int i) {
|
||||
int delta = 10*i;
|
||||
|
||||
return ((int)v*delta)/delta;
|
||||
|
||||
/**
|
||||
* Parsa una stringa numerica italiana (con virgola come separatore decimale)
|
||||
* e restituisce un BigDecimal
|
||||
*/
|
||||
public static BigDecimal parseItalianBigDecimal(String value) {
|
||||
return parseBigDecimal(value, ITALIAN_LOCALE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,9 +3,15 @@ package it.integry.integrywmsnative.core.utility;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.util.TypedValue;
|
||||
|
||||
import androidx.annotation.AttrRes;
|
||||
import androidx.annotation.ColorInt;
|
||||
import androidx.annotation.ColorRes;
|
||||
import androidx.annotation.RawRes;
|
||||
import androidx.annotation.StringRes;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
@@ -69,4 +75,23 @@ public class UtilityResources {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Funzione di utilità per ottenere un colore da un attributo del tema
|
||||
public static @ColorRes int getColorResourceFromAttr(Context context, @AttrRes int attrRes) {
|
||||
TypedValue typedValue = new TypedValue();
|
||||
context.getTheme().resolveAttribute(attrRes, typedValue, true);
|
||||
return typedValue.data;
|
||||
}
|
||||
|
||||
public static @ColorInt int getColorFromAttr(Context context, @AttrRes int attrRes) {
|
||||
return ContextCompat.getColor(context, getColorResourceFromAttr(context, attrRes));
|
||||
}
|
||||
|
||||
public static ColorStateList getColorStateListFromAttr(Context context, @AttrRes int attrRes) {
|
||||
return ColorStateList.valueOf(getColorResourceFromAttr(context, attrRes));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,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
|
||||
|
||||
@@ -42,7 +42,7 @@ import it.integry.integrywmsnative.core.expansion.RunnableArgss;
|
||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.model.dto.AlreadyRegisteredUDCDTO;
|
||||
import it.integry.integrywmsnative.core.model.dto.AlreadyRegisteredUlDTO;
|
||||
import it.integry.integrywmsnative.core.model.observable.ObservableMtbTcol;
|
||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
import it.integry.integrywmsnative.core.report.ReportManager;
|
||||
@@ -452,12 +452,12 @@ public class AccettazioneBollaPickingActivity extends BaseActivity implements Ac
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
public void startListaBancaliRegistratiActivity(List<AlreadyRegisteredUDCDTO> mtbColts) {
|
||||
public void startListaBancaliRegistratiActivity(List<AlreadyRegisteredUlDTO> mtbColts) {
|
||||
|
||||
Intent myIntent = ListaBancaliActivity.createIntent(this,
|
||||
|
||||
Stream.of(mtbColts)
|
||||
.map(AlreadyRegisteredUDCDTO::getMtbColt)
|
||||
.map(AlreadyRegisteredUlDTO::getMtbColt)
|
||||
.toList(),
|
||||
|
||||
input -> Stream.of(mtbColts)
|
||||
@@ -620,6 +620,7 @@ public class AccettazioneBollaPickingActivity extends BaseActivity implements Ac
|
||||
.setDataScad(dataScad)
|
||||
.setCanPartitaMagBeChanged(canPartitaMagBeChanged)
|
||||
.setCanLUBeClosed(true)
|
||||
.setQtaTotEditable(SettingsManager.iDB().isFlagAccettazioneBollaEditableQtaTot())
|
||||
.setCanOverflowOrderQuantity(canOverflowQuantity)
|
||||
.setDisableTracciabilitaCheck(SettingsManager.iDB().isFlagAccettazioneBollaDisableMandatoryTracciabilita());
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingL
|
||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.model.dto.AlreadyRegisteredUDCDTO;
|
||||
import it.integry.integrywmsnative.core.model.dto.AlreadyRegisteredUlDTO;
|
||||
import it.integry.integrywmsnative.core.model.dto.PickDataDTO;
|
||||
import it.integry.integrywmsnative.core.model.observable.ObservableMtbTcol;
|
||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
@@ -160,7 +160,7 @@ public class AccettazioneBollaPickingViewModel {
|
||||
}
|
||||
|
||||
|
||||
public void retrieveExistentLU(RunnableArgs<List<AlreadyRegisteredUDCDTO>> onComplete) {
|
||||
public void retrieveExistentLU(RunnableArgs<List<AlreadyRegisteredUlDTO>> onComplete) {
|
||||
this.sendOnLoadingStarted();
|
||||
|
||||
this.mAccettazioneBollaPickingRESTConsumer.retrieveAlreadyRegisteredUDC(this.mBolle, mtbColtList -> {
|
||||
|
||||
@@ -2,17 +2,17 @@ package it.integry.integrywmsnative.gest.accettazione_bolla_picking.dto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.dto.AlreadyRegisteredUDCDTO;
|
||||
import it.integry.integrywmsnative.core.model.dto.AlreadyRegisteredUlDTO;
|
||||
|
||||
public class RetrieveAlreadyRegisteredULAccettazioneBollaResponseDTO {
|
||||
|
||||
private List<AlreadyRegisteredUDCDTO> udcList;
|
||||
private List<AlreadyRegisteredUlDTO> udcList;
|
||||
|
||||
public List<AlreadyRegisteredUDCDTO> getUdcList() {
|
||||
public List<AlreadyRegisteredUlDTO> getUdcList() {
|
||||
return udcList;
|
||||
}
|
||||
|
||||
public RetrieveAlreadyRegisteredULAccettazioneBollaResponseDTO setUdcList(List<AlreadyRegisteredUDCDTO> udcList) {
|
||||
public RetrieveAlreadyRegisteredULAccettazioneBollaResponseDTO setUdcList(List<AlreadyRegisteredUlDTO> udcList) {
|
||||
this.udcList = udcList;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.model.dto.AlreadyRegisteredUDCDTO;
|
||||
import it.integry.integrywmsnative.core.model.dto.AlreadyRegisteredUlDTO;
|
||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||
import it.integry.integrywmsnative.core.rest.consumers._BaseRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
|
||||
@@ -32,7 +32,7 @@ public class AccettazioneBollaPickingRESTConsumer extends _BaseRESTConsumer {
|
||||
}
|
||||
|
||||
|
||||
public void retrieveAlreadyRegisteredUDC(List<TestataBollaAccettazioneDTO> bolle, RunnableArgs<List<AlreadyRegisteredUDCDTO>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public void retrieveAlreadyRegisteredUDC(List<TestataBollaAccettazioneDTO> bolle, RunnableArgs<List<AlreadyRegisteredUlDTO>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
AccettazioneBollaPickingRESTConsumerService service = restBuilder.getService(AccettazioneBollaPickingRESTConsumerService.class);
|
||||
|
||||
var request = new RetrieveAlreadyRegisteredULAccettazioneBollaRequestDTO()
|
||||
|
||||
@@ -114,7 +114,7 @@ public class AccettazioneBollaPickingListAdapter extends SectionedRecyclerViewAd
|
||||
} else if (position % 2 == 1) {
|
||||
holder.mBinding.getRoot().setBackgroundColor(Color.WHITE);
|
||||
} else {
|
||||
holder.mBinding.getRoot().setBackgroundColor(mContext.getResources().getColor(R.color.letturaFacilitataBG));
|
||||
holder.mBinding.getRoot().setBackgroundColor(mContext.getResources().getColor(R.color.letturaFacilitataBGLight));
|
||||
}
|
||||
|
||||
holder.mBinding.deactivatedOverBg.setVisibility(!pickingObjectDTO.isActive() ? View.VISIBLE : View.GONE);
|
||||
|
||||
@@ -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;
|
||||
@@ -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(),
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -114,7 +114,7 @@ public class AccettazioneOrdiniPickingListAdapter extends SectionedRecyclerViewA
|
||||
} else if (position % 2 == 1) {
|
||||
holder.mBinding.getRoot().setBackgroundColor(Color.WHITE);
|
||||
} else {
|
||||
holder.mBinding.getRoot().setBackgroundColor(mContext.getResources().getColor(R.color.letturaFacilitataBG));
|
||||
holder.mBinding.getRoot().setBackgroundColor(mContext.getResources().getColor(R.color.letturaFacilitataBGLight));
|
||||
}
|
||||
|
||||
holder.mBinding.deactivatedOverBg.setVisibility(!pickingObjectDTO.isActive() ? View.VISIBLE : View.GONE);
|
||||
|
||||
@@ -45,9 +45,7 @@ public class DialogSelectDocInfo_FornitoreAdapter extends ArrayAdapter<DialogSel
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.getOriginalModel().getCodAnag() +
|
||||
(this.getOriginalModel().getCodVdes() != null ? " - " + this.getOriginalModel().getCodVdes() : "") +
|
||||
" ( " + this.getOriginalModel().getDescrizione() + " )";
|
||||
return this.getOriginalModel().getDescrizione();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ public class ContenutoBancaleActivity extends BaseActivity implements ContenutoB
|
||||
public final ObservableField<MtbColt> mtbColt = new ObservableField<>();
|
||||
public final ObservableField<String> descrizioneDepo = new ObservableField<>();
|
||||
public ObservableField<Boolean> fabVisible = new ObservableField<>(true);
|
||||
public ObservableField<Boolean> recoverFabMenuVisible = new ObservableField<>(false);
|
||||
public Boolean recoverFabMenuVisible = false;
|
||||
private PopupMenu fabPopupMenu;
|
||||
|
||||
private String mReportName;
|
||||
@@ -80,7 +80,7 @@ public class ContenutoBancaleActivity extends BaseActivity implements ContenutoB
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
boolean canRecoverUL = DataCache.retrieveItem(getIntent().getStringExtra(Key.CanRecoverUL));
|
||||
recoverFabMenuVisible = DataCache.retrieveItem(getIntent().getStringExtra(Key.CanRecoverUL));
|
||||
mtbColt.set(DataCache.retrieveItem(getIntent().getStringExtra(Key.MtbColtKey)));
|
||||
mReportName = DataCache.retrieveItem(getIntent().getStringExtra(Key.ReportName));
|
||||
|
||||
@@ -102,8 +102,6 @@ public class ContenutoBancaleActivity extends BaseActivity implements ContenutoB
|
||||
mViewModel.setListener(this);
|
||||
mViewModel.init(mtbColt.get(), mReportName);
|
||||
|
||||
recoverFabMenuVisible.set(canRecoverUL);
|
||||
|
||||
this.initRecyclerView();
|
||||
this.initColloInfo();
|
||||
this.initFab();
|
||||
@@ -144,6 +142,10 @@ public class ContenutoBancaleActivity extends BaseActivity implements ContenutoB
|
||||
fabPopupMenu.getMenu().removeItem(R.id.delete_ul);
|
||||
}
|
||||
|
||||
if(!recoverFabMenuVisible) {
|
||||
fabPopupMenu.getMenu().removeItem(R.id.recover_ul);
|
||||
}
|
||||
|
||||
fabPopupMenu.setOnMenuItemClickListener(item -> {
|
||||
int itemId = item.getItemId();
|
||||
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
package it.integry.integrywmsnative.gest.login.dto;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class AuthTokenClaimsDTO {
|
||||
|
||||
@SerializedName("deviceId")
|
||||
private long deviceId;
|
||||
|
||||
@SerializedName("userDTO")
|
||||
private User userDTO;
|
||||
|
||||
@SerializedName("profilesData")
|
||||
private HashMap<String, AuthTokenProfileDetails> profilesData;
|
||||
|
||||
public long getDeviceId() {
|
||||
@@ -36,11 +42,22 @@ public class AuthTokenClaimsDTO {
|
||||
}
|
||||
|
||||
public class User {
|
||||
@SerializedName("username")
|
||||
private String username;
|
||||
|
||||
@SerializedName("email")
|
||||
private Object email;
|
||||
|
||||
@SerializedName("fullname")
|
||||
private String fullname;
|
||||
|
||||
@SerializedName("keyGroup")
|
||||
private int keyGroup;
|
||||
|
||||
@SerializedName("attivo")
|
||||
private boolean attivo;
|
||||
|
||||
@SerializedName("type")
|
||||
private String type;
|
||||
|
||||
public String getUsername() {
|
||||
@@ -99,6 +116,7 @@ public class AuthTokenClaimsDTO {
|
||||
}
|
||||
|
||||
public static class AuthTokenProfileDetails {
|
||||
@SerializedName("defaultDepo")
|
||||
private AuthTokenDepoDetails defaultDepo;
|
||||
|
||||
public AuthTokenDepoDetails getDefaultDepo() {
|
||||
@@ -112,8 +130,13 @@ public class AuthTokenClaimsDTO {
|
||||
}
|
||||
|
||||
public static class AuthTokenDepoDetails {
|
||||
@SerializedName("codMdep")
|
||||
private String codMdep;
|
||||
|
||||
@SerializedName("descrizione")
|
||||
private String descrizione;
|
||||
|
||||
@SerializedName("codJfas")
|
||||
private String codJfas;
|
||||
|
||||
public String getCodMdep() {
|
||||
|
||||
@@ -1,12 +1,20 @@
|
||||
package it.integry.integrywmsnative.gest.login.dto;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
public class AuthenticationJwtResponseDTO {
|
||||
|
||||
@SerializedName("accessToken")
|
||||
private String accessToken;
|
||||
|
||||
@SerializedName("refreshToken")
|
||||
private String refreshToken;
|
||||
|
||||
@SerializedName("expiryDate")
|
||||
private LocalDateTime expiryDate;
|
||||
|
||||
@SerializedName("expireIn")
|
||||
private long expireIn;
|
||||
|
||||
|
||||
|
||||
@@ -1,11 +1,22 @@
|
||||
package it.integry.integrywmsnative.gest.login.dto;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class LoginAziendaDTO {
|
||||
|
||||
@SerializedName("profileDb")
|
||||
private String profileDb;
|
||||
|
||||
@SerializedName("endpointRestApi")
|
||||
private String endpointRestApi;
|
||||
|
||||
@SerializedName("phpApi")
|
||||
private String phpApi;
|
||||
|
||||
@SerializedName("repoPhoto")
|
||||
private String repoPhoto;
|
||||
|
||||
@SerializedName("endpointPvm")
|
||||
private String endpointPvm;
|
||||
|
||||
public String getProfileDb() {
|
||||
|
||||
@@ -1,9 +1,16 @@
|
||||
package it.integry.integrywmsnative.gest.login.dto;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class LoginRequestDTO {
|
||||
|
||||
@SerializedName("username")
|
||||
private String username;
|
||||
|
||||
@SerializedName("password")
|
||||
private String password;
|
||||
|
||||
@SerializedName("deviceId")
|
||||
private String deviceId;
|
||||
|
||||
public String getUsername() {
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
package it.integry.integrywmsnative.gest.login.dto;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import java.util.List;
|
||||
|
||||
public class LoginResponseDTO {
|
||||
|
||||
@SerializedName("fullName")
|
||||
private String fullName;
|
||||
private List<String> availableProfiles;
|
||||
|
||||
@SerializedName("availableProfiles")
|
||||
private List<String> availableProfiles;
|
||||
|
||||
public String getFullName() {
|
||||
return fullName;
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package it.integry.integrywmsnative.gest.login.dto;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class RefreshRequestDTO {
|
||||
@SerializedName("refreshToken")
|
||||
private String refreshToken;
|
||||
|
||||
public String getRefreshToken() {
|
||||
|
||||
@@ -34,7 +34,7 @@ public class AuthenticationRESTConsumer extends _BaseRESTConsumer {
|
||||
String host = CommonConst.Login.Azienda.host;
|
||||
int port = CommonConst.Login.Azienda.port;
|
||||
|
||||
AuthenticationRESTConsumerService service = restBuilder.getService(AuthenticationRESTConsumerService.class, protocol, host, port, false, true);
|
||||
AuthenticationRESTConsumerService service = restBuilder.getService(AuthenticationRESTConsumerService.class, protocol, host, port);
|
||||
service.loginAzienda(codAzienda).enqueue(new ManagedErrorCallback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<LoginAziendaDTO>> call, Response<ServiceRESTResponse<LoginAziendaDTO>> response) {
|
||||
@@ -67,7 +67,7 @@ public class AuthenticationRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
|
||||
public void authenticate(String protocol, String host, int port, String username, String password, String profileDb, String deviceSalt, RunnableArgs<AuthenticationJwtResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
AuthenticationRESTConsumerService service = restBuilder.getService(AuthenticationRESTConsumerService.class, protocol, host, port, false);
|
||||
AuthenticationRESTConsumerService service = restBuilder.getService(AuthenticationRESTConsumerService.class, protocol, host, port);
|
||||
|
||||
LoginRequestDTO loginRequestDTO = new LoginRequestDTO()
|
||||
.setUsername(username)
|
||||
@@ -94,7 +94,7 @@ public class AuthenticationRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
|
||||
public void retrieveAvailableProfiles(String protocol, String host, int port, String username, String password, RunnableArgs<List<String>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
AuthenticationRESTConsumerService service = restBuilder.getService(AuthenticationRESTConsumerService.class, protocol, host, port, false);
|
||||
AuthenticationRESTConsumerService service = restBuilder.getService(AuthenticationRESTConsumerService.class, protocol, host, port);
|
||||
|
||||
service.retreiveAvailableProfiles(username, password)
|
||||
.enqueue(new ManagedErrorCallback<>() {
|
||||
|
||||
@@ -49,8 +49,12 @@ public class LoginViewModel {
|
||||
|
||||
FirebaseInstallations.getInstance().getId().addOnCompleteListener(fid -> {
|
||||
|
||||
SettingsManager.i().createUserSession();
|
||||
retrieveAvailableProfiles(protocol, host, port, username, password, selectedProfile -> {
|
||||
SettingsManager.i().createUserSession();
|
||||
if(selectedProfile == null) {
|
||||
this.sendOnLoadingEnded();
|
||||
return;
|
||||
}
|
||||
|
||||
authenticate(protocol, host, port, username, password, selectedProfile, fid.getResult(), fullName -> {
|
||||
|
||||
@@ -126,6 +130,8 @@ public class LoginViewModel {
|
||||
}
|
||||
|
||||
private void authenticate(String protocol, String host, int port, String username, String password, String profileDb, String deviceSalt, RunnableArgs<String> onComplete) {
|
||||
|
||||
|
||||
mAuthenticationRESTConsumer.authenticate(protocol, host, port, username, password, profileDb, deviceSalt, sessionData -> {
|
||||
|
||||
var claims = JwtUtils.parseJwt(sessionData.getAccessToken());
|
||||
|
||||
@@ -102,7 +102,7 @@ public class MainActivity extends BaseActivity
|
||||
|
||||
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
|
||||
this, mBinding.drawerLayout, mBinding.appBarMain.toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
|
||||
mBinding.drawerLayout.setDrawerListener(toggle);
|
||||
mBinding.drawerLayout.addDrawerListener(toggle);
|
||||
toggle.syncState();
|
||||
|
||||
|
||||
@@ -122,6 +122,16 @@ public class MainActivity extends BaseActivity
|
||||
startActivity(myIntent);
|
||||
}
|
||||
|
||||
|
||||
public void toggleDrawer() {
|
||||
if (mBinding.drawerLayout.isDrawerOpen(GravityCompat.START)) {
|
||||
mBinding.drawerLayout.closeDrawer(GravityCompat.START);
|
||||
} else {
|
||||
mBinding.drawerLayout.openDrawer(GravityCompat.START);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
||||
@@ -294,9 +304,13 @@ public class MainActivity extends BaseActivity
|
||||
for (int i = 0; i < count; i++) {
|
||||
getSupportFragmentManager().popBackStack();
|
||||
}
|
||||
|
||||
mBinding.appBarMain.elevatedToolbar.setVisibility(getSupportFragmentManager().getBackStackEntryCount() > 1 ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
private void adaptViewToFragment(Fragment fragment) {
|
||||
mBinding.appBarMain.elevatedToolbar.setVisibility(fragment instanceof MainFragment ? View.GONE : View.VISIBLE);
|
||||
|
||||
if (fragment instanceof ISearchableFragment) {
|
||||
mBinding.appBarMain.mainSearch.setOnQueryTextListener((SearchView.OnQueryTextListener) fragment);
|
||||
mBinding.appBarMain.mainSearch.setVisibility(View.VISIBLE);
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
package it.integry.integrywmsnative.gest.main;
|
||||
|
||||
|
||||
import android.animation.ArgbEvaluator;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.view.LayoutInflater;
|
||||
@@ -122,7 +119,6 @@ public class MainFragment extends Fragment implements ITitledFragment, IScrollab
|
||||
mBindings = DataBindingUtil.inflate(inflater, R.layout.fragment_main, container, false);
|
||||
mBindings.setView(this);
|
||||
|
||||
mBindings.easterEggHorrorBloodExpandableLayout.setExpanded(false, false);
|
||||
return mBindings.getRoot();
|
||||
}
|
||||
|
||||
@@ -246,6 +242,13 @@ public class MainFragment extends Fragment implements ITitledFragment, IScrollab
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void toggleDrawer() {
|
||||
if (getActivity() != null && getActivity() instanceof MainActivity) {
|
||||
((MainActivity) getActivity()).toggleDrawer();
|
||||
}
|
||||
}
|
||||
|
||||
private void collapseNoConnectionLayout() {
|
||||
if (getActivity() != null)
|
||||
getActivity().runOnUiThread(() -> mBindings.noConnectionTopLayout.collapse(true));
|
||||
@@ -284,8 +287,8 @@ public class MainFragment extends Fragment implements ITitledFragment, IScrollab
|
||||
MenuConfiguration baseMenuConfiguration = new MenuConfiguration();
|
||||
List<MenuConfiguration.MenuGroup> menuGroups = baseMenuConfiguration.getGroups();
|
||||
|
||||
for (int i = 0; i < menuGroups.size(); i++) {
|
||||
try {
|
||||
try {
|
||||
for (int i = 0; i < menuGroups.size(); i++) {
|
||||
|
||||
BaseMenuConfiguration.MenuGroup menuGroup = menuGroups.get(i);
|
||||
|
||||
@@ -313,16 +316,12 @@ public class MainFragment extends Fragment implements ITitledFragment, IScrollab
|
||||
menuListAdapter.setClickListener(this::onMenuClick);
|
||||
|
||||
mBindings.menuContainer.addView(groupBinding.getRoot());
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
} catch (Exception exception) {
|
||||
UtilityExceptions.defaultException(requireActivity(), exception);
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception exception) {
|
||||
UtilityExceptions.defaultException(requireActivity(), exception);
|
||||
}
|
||||
}
|
||||
|
||||
private void onMenuClick(MenuConfiguration.MenuItem menuItem) {
|
||||
@@ -339,89 +338,6 @@ public class MainFragment extends Fragment implements ITitledFragment, IScrollab
|
||||
this.mOnPreDestroyList.add(onPreDestroy);
|
||||
}
|
||||
|
||||
|
||||
public void toggleEasterEggMode() {
|
||||
easterEggToggle = !easterEggToggle;
|
||||
|
||||
|
||||
int rootBgStart, rootBgEnd;
|
||||
int profileBgStart, profileBgEnd;
|
||||
float titleFlipStart, titleFlipEnd;
|
||||
int animationTimeMillis = 0;
|
||||
|
||||
if (easterEggToggle) {
|
||||
rootBgStart = Color.argb(255, 255, 255, 255);
|
||||
rootBgEnd = Color.argb(255, 0, 0, 0);
|
||||
|
||||
profileBgStart = Color.argb(255, 26, 115, 232);
|
||||
profileBgEnd = Color.argb(255, 211, 47, 47);
|
||||
animationTimeMillis = 2500;
|
||||
titleFlipStart = 1f;
|
||||
titleFlipEnd = -1f;
|
||||
} else {
|
||||
rootBgStart = Color.argb(255, 0, 0, 0);
|
||||
rootBgEnd = Color.argb(255, 255, 255, 255);
|
||||
|
||||
profileBgStart = Color.argb(255, 211, 47, 47);
|
||||
profileBgEnd = Color.argb(255, 26, 115, 232);
|
||||
animationTimeMillis = 750;
|
||||
titleFlipStart = -1f;
|
||||
titleFlipEnd = 1f;
|
||||
}
|
||||
|
||||
mBindings.easterEggHorrorBloodExpandableLayout.setDuration(animationTimeMillis);
|
||||
mBindings.easterEggHorrorBloodExpandableLayout.setExpanded(easterEggToggle, true);
|
||||
|
||||
View rootActivityView = requireActivity().findViewById(R.id.drawer_layout);
|
||||
ObjectAnimator colorFadeRootBg = ObjectAnimator.ofObject(rootActivityView, "backgroundColor",
|
||||
new ArgbEvaluator(),
|
||||
rootBgStart,
|
||||
rootBgEnd);
|
||||
|
||||
colorFadeRootBg.setDuration(animationTimeMillis);
|
||||
colorFadeRootBg.start();
|
||||
|
||||
View toolbarActivityView = requireActivity().findViewById(R.id.toolbar);
|
||||
ObjectAnimator colorFadeToolbarBg = ObjectAnimator.ofObject(toolbarActivityView, "backgroundColor",
|
||||
new ArgbEvaluator(),
|
||||
rootBgStart,
|
||||
rootBgEnd);
|
||||
|
||||
colorFadeToolbarBg.setDuration(animationTimeMillis);
|
||||
colorFadeToolbarBg.start();
|
||||
|
||||
ObjectAnimator colorFadeProfileBg = ObjectAnimator.ofObject(mBindings.profileRootContainer, "backgroundColor",
|
||||
new ArgbEvaluator(),
|
||||
profileBgStart,
|
||||
profileBgEnd);
|
||||
|
||||
colorFadeProfileBg.setDuration(animationTimeMillis);
|
||||
colorFadeProfileBg.start();
|
||||
|
||||
View toolbarTitleActivityView = requireActivity().findViewById(R.id.toolbar_title);
|
||||
ObjectAnimator flipToolbarTitleX = ObjectAnimator.ofFloat(toolbarTitleActivityView, "scaleX",
|
||||
titleFlipStart,
|
||||
titleFlipEnd);
|
||||
|
||||
flipToolbarTitleX.setDuration(animationTimeMillis);
|
||||
flipToolbarTitleX.start();
|
||||
|
||||
ObjectAnimator flipToolbarTitleY = ObjectAnimator.ofFloat(toolbarTitleActivityView, "scaleY",
|
||||
titleFlipStart,
|
||||
titleFlipEnd);
|
||||
|
||||
flipToolbarTitleY.setDuration(animationTimeMillis);
|
||||
flipToolbarTitleY.start();
|
||||
|
||||
ObjectAnimator colorFadeTitleTextColor = ObjectAnimator.ofObject(toolbarTitleActivityView, "textColor",
|
||||
new ArgbEvaluator(),
|
||||
rootBgEnd,
|
||||
rootBgStart);
|
||||
|
||||
colorFadeTitleTextColor.setDuration(animationTimeMillis);
|
||||
colorFadeTitleTextColor.start();
|
||||
}
|
||||
|
||||
public void changeUserDepo() {
|
||||
DialogSwitchUserDepoView.newInstance(SettingsManager.iDB().getAvailableCodMdep(), this::onUserDepoChanged)
|
||||
.show(getParentFragmentManager(), "switch-user-depo");
|
||||
|
||||
@@ -43,10 +43,10 @@ import it.integry.integrywmsnative.core.interfaces.ISelectAllFragment;
|
||||
import it.integry.integrywmsnative.core.interfaces.ITitledFragment;
|
||||
import it.integry.integrywmsnative.core.model.JtbComt;
|
||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.model.MtbDepo;
|
||||
import it.integry.integrywmsnative.core.model.MtbGrup;
|
||||
import it.integry.integrywmsnative.core.model.OrdineInevasoDTO;
|
||||
import it.integry.integrywmsnative.core.model.dto.AlreadyRegisteredUlDTO;
|
||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.CommessaRESTConsumer;
|
||||
@@ -806,7 +806,7 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
Stream.of(this.mOrdiniInevasiMutableData)
|
||||
this.mOrdiniInevasiMutableData.stream()
|
||||
.forEach(x -> x.getSelectedObservable().set(false));
|
||||
}
|
||||
|
||||
@@ -842,7 +842,7 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOrdersDispatched(List<OrdineUscitaInevasoDTO> orders, List<SitArtOrdDTO> sitArts, List<MtbColt> alreadyRegisteredMtbColts) {
|
||||
public void onOrdersDispatched(List<OrdineUscitaInevasoDTO> orders, List<SitArtOrdDTO> sitArts, List<AlreadyRegisteredUlDTO> alreadyRegisteredMtbColts) {
|
||||
List<String> codMarts = Stream.of(sitArts)
|
||||
.distinctBy(SitArtOrdDTO::getCodMart)
|
||||
.map(SitArtOrdDTO::getCodMart)
|
||||
@@ -862,7 +862,6 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
|
||||
() -> SpedizioneActivity.startActivity(getActivity(),
|
||||
sitArts,
|
||||
orders,
|
||||
alreadyRegisteredMtbColts,
|
||||
mCurrentGestioneCol,
|
||||
mCurrentSegnoCol,
|
||||
MtbColr.Causale.DEFAULT,
|
||||
|
||||
@@ -23,9 +23,9 @@ import it.integry.integrywmsnative.core.exception.NoOrderFoundException;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
|
||||
import it.integry.integrywmsnative.core.model.DtbOrdt;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.model.MtbGrup;
|
||||
import it.integry.integrywmsnative.core.model.OrdineInevasoDTO;
|
||||
import it.integry.integrywmsnative.core.model.dto.AlreadyRegisteredUlDTO;
|
||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||
@@ -146,8 +146,7 @@ public class OrdiniUscitaElencoViewModel {
|
||||
List<SitArtOrdDTO> finalSitArts = sitArts;
|
||||
|
||||
this.mOrdiniRESTConsumer.getBancaliGiaRegistrati(
|
||||
Stream.of(selectedOrdersBase).map(x -> (OrdineInevasoDTO) x).toList(),
|
||||
mCurrentGestioneCol,
|
||||
selectedOrdersBase.stream().map(x -> (OrdineInevasoDTO) x).collect(Collectors.toList()),
|
||||
mCurrentSegnoCol,
|
||||
mtbColtList -> {
|
||||
this.sendOnOrdersDispatched(selectedOrdersBase, finalSitArts, mtbColtList);
|
||||
@@ -303,7 +302,7 @@ public class OrdiniUscitaElencoViewModel {
|
||||
if (this.mListener != null) mListener.onOrderFiltered(filteredOrders);
|
||||
}
|
||||
|
||||
private void sendOnOrdersDispatched(List<OrdineUscitaInevasoDTO> orders, List<SitArtOrdDTO> sitArts, List<MtbColt> alreadyRegisteredMtbColts) {
|
||||
private void sendOnOrdersDispatched(List<OrdineUscitaInevasoDTO> orders, List<SitArtOrdDTO> sitArts, List<AlreadyRegisteredUlDTO> alreadyRegisteredMtbColts) {
|
||||
if (this.mListener != null)
|
||||
mListener.onOrdersDispatched(orders, sitArts, alreadyRegisteredMtbColts);
|
||||
}
|
||||
@@ -316,7 +315,7 @@ public class OrdiniUscitaElencoViewModel {
|
||||
|
||||
void onOrderFiltered(List<OrdiniUscitaElencoDTO> filteredOrders);
|
||||
|
||||
void onOrdersDispatched(List<OrdineUscitaInevasoDTO> orders, List<SitArtOrdDTO> sitArts, List<MtbColt> alreadyRegisteredMtbColts);
|
||||
void onOrdersDispatched(List<OrdineUscitaInevasoDTO> orders, List<SitArtOrdDTO> sitArts, List<AlreadyRegisteredUlDTO> alreadyRegisteredMtbColts);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -251,6 +251,9 @@ public class OrdiniUscitaElencoFiltroViewModel {
|
||||
.distinct()
|
||||
.toList();
|
||||
|
||||
if(codMdeps.isEmpty())
|
||||
return new ArrayList<>();
|
||||
|
||||
return Stream.of(Objects.requireNonNull(mtbDepoFullList))
|
||||
.filter(x -> codMdeps.contains(x.getCodMdep()))
|
||||
.distinct()
|
||||
|
||||
@@ -338,6 +338,8 @@ public class PickingLiberoViewModel {
|
||||
|
||||
if (this.mFlagAskCliente) {
|
||||
var data = this.sendLUClienteRequired();
|
||||
if (data == null) return;
|
||||
|
||||
vtbDest = data.first;
|
||||
codJcom = data.second;
|
||||
}
|
||||
@@ -648,7 +650,6 @@ public class PickingLiberoViewModel {
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void executeDepositChangeIfNeeded(MtbColt refMtbColt) throws Exception {
|
||||
//Considero solo la prima UDC scansionata
|
||||
boolean shouldChangeCodMdep = refMtbColt != null && !refMtbColt.getCodMdep().equalsIgnoreCase(mCurrentMtbColt.getCodMdep()) &&
|
||||
@@ -860,7 +861,7 @@ public class PickingLiberoViewModel {
|
||||
|
||||
if (this.mDefaultGestione == GestioneEnum.LAVORAZIONE && SettingsManager.iDB().isProduzioneGeneraDocScar()) {
|
||||
|
||||
if(SettingsManager.iDB().getInternalCodAnags() == null || SettingsManager.iDB().getInternalCodAnags().isEmpty())
|
||||
if (SettingsManager.iDB().getInternalCodAnags() == null || SettingsManager.iDB().getInternalCodAnags().isEmpty())
|
||||
throw new Exception("Nessuna anagrafica aziendale configurata. Assicurarsi di aver abilitato il flag FLAG_USE_COD_ANAG_AZIENDALE.");
|
||||
|
||||
closeUDSRequest
|
||||
|
||||
@@ -102,7 +102,7 @@ public class PickingResiListAdapter extends SectionedRecyclerViewAdapter<Picking
|
||||
} else if (position % 2 == 1) {
|
||||
holder.mBinding.getRoot().setBackgroundColor(Color.WHITE);
|
||||
} else {
|
||||
holder.mBinding.getRoot().setBackgroundColor(mContext.getResources().getColor(R.color.letturaFacilitataBG));
|
||||
holder.mBinding.getRoot().setBackgroundColor(mContext.getResources().getColor(R.color.letturaFacilitataBGLight));
|
||||
}
|
||||
|
||||
holder.mBinding.deactivatedOverBg.setVisibility(!pickingResiListModel.isActive() ? View.VISIBLE : View.GONE);
|
||||
|
||||
@@ -446,7 +446,6 @@ public class ProdFabbisognoLineeProdFragment extends BaseFragment implements ITi
|
||||
SpedizioneActivity.startActivity(getActivity(),
|
||||
sitArtOrdDTOS,
|
||||
new ArrayList<>(),
|
||||
new ArrayList<>(),
|
||||
GestioneEnum.LAVORAZIONE,
|
||||
+1,
|
||||
MtbColr.Causale.VERSAMENTO,
|
||||
|
||||
@@ -122,7 +122,13 @@ public class ProdRecuperoMaterialeFragment extends BaseFragment implements ITitl
|
||||
BarcodeManager.removeCallback(mBarcodeScannerInstanceID);
|
||||
}
|
||||
});
|
||||
|
||||
mViewModel.init(codJfas);
|
||||
mViewModel.refreshData(); // This will eventually trigger the LiveData observer for getOrderList
|
||||
|
||||
mBinding.swiperefresh.setOnRefreshListener(() -> {
|
||||
mViewModel.refreshData();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -299,8 +305,30 @@ public class ProdRecuperoMaterialeFragment extends BaseFragment implements ITitl
|
||||
@Override
|
||||
public void onDataSaved() {
|
||||
this.onLoadingEnded();
|
||||
this.requireActivity().runOnUiThread(() -> {
|
||||
handler.post(() -> {
|
||||
DialogCommon.showDataSaved(requireActivity(), this::popMe);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataRefreshStarted() {
|
||||
handler.post(() -> {
|
||||
mBinding.swiperefresh.setRefreshing(true);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataRefreshEnded() {
|
||||
handler.post(() -> {
|
||||
mBinding.swiperefresh.setRefreshing(false);
|
||||
// applyFilters(); // Non strettamente necessario qui se l'observer di getOrderList() fa il suo dovere
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Exception ex) {
|
||||
super.onError(ex);
|
||||
onDataRefreshEnded();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,28 +1,10 @@
|
||||
package it.integry.integrywmsnative.gest.prod_recupero_materiale;
|
||||
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.MaterialiRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.PrinterRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
||||
import it.integry.integrywmsnative.gest.prod_recupero_materiale.rest.ProdRecuperoMaterialeRESTConsumer;
|
||||
|
||||
@Module(subcomponents = ProdRecuperoMaterialeComponent.class)
|
||||
public class ProdRecuperoMaterialeModule {
|
||||
|
||||
@Provides
|
||||
ProdRecuperoMaterialeRESTConsumer providesProdRecuperMaterialeRESTConsumer(SystemRESTConsumer systemRESTConsumer, ArticoloRESTConsumer articoloRESTConsumer) {
|
||||
return new ProdRecuperoMaterialeRESTConsumer(systemRESTConsumer, articoloRESTConsumer);
|
||||
}
|
||||
|
||||
@Provides
|
||||
ProdRecuperoMaterialeViewModel providesProdRecuperoMaterialeViewModel(ProdRecuperoMaterialeRESTConsumer prodRecuperoMaterialeRESTConsumer,
|
||||
ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer,
|
||||
PrinterRESTConsumer printerRESTConsumer,
|
||||
MaterialiRESTConsumer materialiRESTConsumer) {
|
||||
return new ProdRecuperoMaterialeViewModel(prodRecuperoMaterialeRESTConsumer, colliMagazzinoRESTConsumer, printerRESTConsumer, materialiRESTConsumer);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,8 +3,10 @@ package it.integry.integrywmsnative.gest.prod_recupero_materiale;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.inject.Inject;
|
||||
@@ -16,6 +18,7 @@ import it.integry.integrywmsnative.core.expansion.RunnableArgss;
|
||||
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
|
||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.MaterialiRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.PrinterRESTConsumer;
|
||||
@@ -28,62 +31,88 @@ import it.integry.integrywmsnative.gest.spedizione.model.PickedQuantityDTO;
|
||||
|
||||
public class ProdRecuperoMaterialeViewModel {
|
||||
|
||||
private final BarcodeRESTConsumer mBarcodeRESTConsumer;
|
||||
private final ProdRecuperoMaterialeRESTConsumer mProdRecuperoMaterialeRESTConsumer;
|
||||
private final ColliMagazzinoRESTConsumer mColliMagazzinoRESTConsumer;
|
||||
private final PrinterRESTConsumer mPrinterRESTConsumer;
|
||||
private final MaterialiRESTConsumer mMaterialiRESTConsumer;
|
||||
private final ExecutorService mExecutorService;
|
||||
|
||||
private final MutableLiveData<List<HistoryVersamentoProdULDTO>> mUlList = new MutableLiveData<>();
|
||||
|
||||
private Listener mListener;
|
||||
|
||||
private String mCodJfas;
|
||||
|
||||
|
||||
@Inject
|
||||
public ProdRecuperoMaterialeViewModel(ProdRecuperoMaterialeRESTConsumer prodRecuperoMaterialeRESTConsumer,
|
||||
public ProdRecuperoMaterialeViewModel(BarcodeRESTConsumer barcodeRESTConsumer,
|
||||
ProdRecuperoMaterialeRESTConsumer prodRecuperoMaterialeRESTConsumer,
|
||||
ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer,
|
||||
PrinterRESTConsumer printerRESTConsumer,
|
||||
MaterialiRESTConsumer materialiRESTConsumer) {
|
||||
MaterialiRESTConsumer materialiRESTConsumer,
|
||||
ExecutorService executorService) {
|
||||
this.mBarcodeRESTConsumer = barcodeRESTConsumer;
|
||||
this.mProdRecuperoMaterialeRESTConsumer = prodRecuperoMaterialeRESTConsumer;
|
||||
this.mColliMagazzinoRESTConsumer = colliMagazzinoRESTConsumer;
|
||||
this.mPrinterRESTConsumer = printerRESTConsumer;
|
||||
this.mMaterialiRESTConsumer = materialiRESTConsumer;
|
||||
this.mExecutorService = executorService;
|
||||
}
|
||||
|
||||
public void init(String codJfas) {
|
||||
this.sendOnLoadingStarted();
|
||||
this.mCodJfas = codJfas;
|
||||
}
|
||||
|
||||
mProdRecuperoMaterialeRESTConsumer.loadLastULVersate(codJfas, ulList -> {
|
||||
this.mUlList.setValue(ulList);
|
||||
public void refreshData() {
|
||||
this.sendOnDataRefreshStarted();
|
||||
|
||||
this.sendOnLoadingEnded();
|
||||
}, this::sendError);
|
||||
this.mExecutorService.execute(() -> {
|
||||
try {
|
||||
List<HistoryVersamentoProdULDTO> lastUlVersate = mProdRecuperoMaterialeRESTConsumer.loadLastULVersateSynchronized(mCodJfas);
|
||||
lastUlVersate.sort(Comparator.comparing(HistoryVersamentoProdULDTO::getCodJfas));
|
||||
|
||||
this.mUlList.postValue(lastUlVersate);
|
||||
this.sendOnDataRefreshEnded();
|
||||
} catch (Exception e) {
|
||||
this.sendError(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void processBarcodeDTO(BarcodeScanDTO data) {
|
||||
if (UtilityBarcode.isEtichettaAnonima(data) || UtilityBarcode.isEtichetta128(data)) {
|
||||
this.executeEtichettaLU(data.getStringValue());
|
||||
this.executeEtichettaLU(data);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void executeEtichettaLU(String sscc) {
|
||||
private void executeEtichettaLU(BarcodeScanDTO barcodeScanDTO) {
|
||||
this.sendOnLoadingStarted();
|
||||
this.mBarcodeRESTConsumer.decodeEan128(barcodeScanDTO, ean128Model -> {
|
||||
|
||||
this.mColliMagazzinoRESTConsumer.getBySSCC(sscc, true, false, mtbColt -> {
|
||||
this.sendOnLoadingEnded();
|
||||
if(ean128Model == null || ean128Model.Sscc == null) {
|
||||
this.sendError(new NoLUFoundException());
|
||||
this.sendOnLoadingEnded();
|
||||
return;
|
||||
}
|
||||
|
||||
this.mColliMagazzinoRESTConsumer.getBySSCC(ean128Model.Sscc, true, false, mtbColt -> {
|
||||
this.sendOnLoadingEnded();
|
||||
|
||||
if (mtbColt != null) {
|
||||
HistoryVersamentoProdULDTO historyVersamentoProdULRestDTO = this.getHistoryElementFromMtbColt(mtbColt);
|
||||
if (historyVersamentoProdULRestDTO != null) {
|
||||
this.dispatchItem(historyVersamentoProdULRestDTO, mtbColt);
|
||||
} else {
|
||||
this.sendError(new NoLUFoundException());
|
||||
}
|
||||
|
||||
if (mtbColt != null) {
|
||||
HistoryVersamentoProdULDTO historyVersamentoProdULRestDTO = this.getHistoryElementFromMtbColt(mtbColt);
|
||||
if (historyVersamentoProdULRestDTO != null) {
|
||||
this.dispatchItem(historyVersamentoProdULRestDTO, mtbColt);
|
||||
} else {
|
||||
this.sendError(new NoLUFoundException());
|
||||
}
|
||||
|
||||
} else {
|
||||
this.sendError(new NoLUFoundException());
|
||||
}
|
||||
|
||||
}, this::sendError);
|
||||
}, this::sendError);
|
||||
}
|
||||
|
||||
@@ -164,7 +193,7 @@ public class ProdRecuperoMaterialeViewModel {
|
||||
.setNumColloRif(item.getNumColloRif())
|
||||
.setOrdini(ordiniRequest);
|
||||
|
||||
if(mtbColt != null) {
|
||||
if (mtbColt != null) {
|
||||
request.setMtbColtCarico(mtbColt);
|
||||
} else {
|
||||
request.setMtbColtCarico(sourceMtbColt);
|
||||
@@ -204,6 +233,14 @@ public class ProdRecuperoMaterialeViewModel {
|
||||
return this;
|
||||
}
|
||||
|
||||
private void sendOnDataRefreshStarted() {
|
||||
if (this.mListener != null) mListener.onDataRefreshStarted();
|
||||
}
|
||||
|
||||
private void sendOnDataRefreshEnded() {
|
||||
if (this.mListener != null) mListener.onDataRefreshEnded();
|
||||
}
|
||||
|
||||
private void sendOnLoadingStarted() {
|
||||
if (this.mListener != null) mListener.onLoadingStarted();
|
||||
}
|
||||
@@ -274,6 +311,10 @@ public class ProdRecuperoMaterialeViewModel {
|
||||
void onNoLUFound(Runnable onComplete);
|
||||
|
||||
void onDataSaved();
|
||||
|
||||
void onDataRefreshStarted();
|
||||
|
||||
void onDataRefreshEnded();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,310 +1,432 @@
|
||||
package it.integry.integrywmsnative.gest.prod_recupero_materiale.rest;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.MaterialiRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers._BaseRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDB;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
import it.integry.integrywmsnative.gest.prod_recupero_materiale.dto.HistoryVersamentoProdULDTO;
|
||||
import it.integry.integrywmsnative.gest.prod_recupero_materiale.dto.HistoryVersamentoProdULRestDTO;
|
||||
|
||||
@Singleton
|
||||
public class ProdRecuperoMaterialeRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
private final SystemRESTConsumer mSystemRESTConsumer;
|
||||
private final ArticoloRESTConsumer mArticoloRESTConsumer;
|
||||
private final MaterialiRESTConsumer mMaterialiRESTConsumer;
|
||||
|
||||
public ProdRecuperoMaterialeRESTConsumer(SystemRESTConsumer systemRESTConsumer, ArticoloRESTConsumer articoloRESTConsumer) {
|
||||
this.mSystemRESTConsumer = systemRESTConsumer;
|
||||
@Inject
|
||||
public ProdRecuperoMaterialeRESTConsumer(ArticoloRESTConsumer articoloRESTConsumer, MaterialiRESTConsumer materialiRESTConsumer) {
|
||||
this.mMaterialiRESTConsumer = materialiRESTConsumer;
|
||||
this.mArticoloRESTConsumer = articoloRESTConsumer;
|
||||
}
|
||||
|
||||
|
||||
public void loadLastULVersate(RunnableArgs<List<HistoryVersamentoProdULDTO>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
loadLastULVersate(null, onComplete, onFailed);
|
||||
public List<HistoryVersamentoProdULDTO> loadLastULVersateSynchronized() throws Exception {
|
||||
return loadLastULVersateSynchronized(null);
|
||||
}
|
||||
|
||||
public void loadLastULVersate(String codJfas, RunnableArgs<List<HistoryVersamentoProdULDTO>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public @NonNull List<HistoryVersamentoProdULDTO> loadLastULVersateSynchronized(String codJfas) throws Exception {
|
||||
var ulList = mMaterialiRESTConsumer.makeSynchronousRetrieveLastVersamentiRequest(codJfas);
|
||||
|
||||
String sql = "WITH ul_list AS ( " +
|
||||
" SELECT jtb_fasi.cod_jfas, " +
|
||||
" jtb_fasi.descrizione AS descrizione_fase, " +
|
||||
" mtb_colr.gestione, " +
|
||||
" mtb_colr.data_collo, " +
|
||||
" mtb_colr.num_collo, " +
|
||||
" mtb_colr.ser_collo, " +
|
||||
" mtb_colr.cod_mart, " +
|
||||
" mtb_colr.cod_col, " +
|
||||
" mtb_colr.cod_tagl, " +
|
||||
" SUM(mtb_colr.qta_col) AS qta_col, " +
|
||||
" mtb_colr.qta_cnf AS qta_cnf, " +
|
||||
" SUM(mtb_colr.num_cnf) AS num_cnf, " +
|
||||
" mtb_colr.partita_mag, " +
|
||||
" mtb_colr.cod_jcom, " +
|
||||
" mtb_colr.num_collo_rif, " +
|
||||
" mtb_colr.data_collo_rif, " +
|
||||
" mtb_colr.ser_collo_rif, " +
|
||||
" mtb_colr.gestione_rif, " +
|
||||
" mtb_colt.segno, " +
|
||||
" ISNULL(mtb_aart.descrizione_estesa, mtb_aart.descrizione) AS descrizione_art, " +
|
||||
" mtb_aart.unt_mis, " +
|
||||
" MAX(datetime_row) AS datetime_row, " +
|
||||
" mtb_colr.num_ord, " +
|
||||
" mtb_colr.data_ord, " +
|
||||
" mtb_colr.gestione as gestione_ord, " +
|
||||
" mtb_colr.riga_ord, " +
|
||||
" dtb_ord_steps.hr_num as hr, " +
|
||||
" CONVERT(INTEGER, ROUND((CAST(dtb_ord_steps.hr_num AS DECIMAL(20, 5)) / " +
|
||||
" SUM(dtb_ord_steps.hr_num) OVER (PARTITION BY mtb_colr.num_collo)) * 100, " +
|
||||
" SUM(CASE WHEN dtb_ord_steps.hr_num > 0 then dtb_ord_steps.hr_num else 1 end) OVER (PARTITION BY mtb_colr.num_collo)) * 100, " +
|
||||
" 0) as percentage_hr " +
|
||||
" FROM mtb_colr " +
|
||||
" INNER JOIN mtb_colt ON mtb_colr.num_collo = mtb_colt.num_collo " +
|
||||
" AND mtb_colr.data_collo = mtb_colt.data_collo " +
|
||||
" AND mtb_colr.ser_collo = mtb_colt.ser_collo " +
|
||||
" AND mtb_colr.gestione = mtb_colt.gestione " +
|
||||
" " + (SettingsManager.iDB().isFlagVersamentoDirettoProduzione() ? "INNER" : "LEFT OUTER") + " join dtb_ord_steps ON dtb_ord_steps.data_ord = mtb_colr.data_ord " +
|
||||
" AND dtb_ord_steps.gestione = mtb_colr.gestione " +
|
||||
" AND dtb_ord_steps.num_ord = mtb_colr.num_ord " +
|
||||
" AND dtb_ord_steps.data_iniz is not null " +
|
||||
" AND dtb_ord_steps.data_fine is null " +
|
||||
" INNER JOIN mtb_aart ON mtb_colr.cod_mart = mtb_aart.cod_mart " +
|
||||
" LEFT OUTER JOIN jtb_fasi ON mtb_colt.cod_jfas = jtb_fasi.cod_jfas " +
|
||||
" WHERE jtb_fasi.cod_jfas IS NOT NULL " +
|
||||
(UtilityString.isNullOrEmpty(codJfas) ? "" : " AND jtb_fasi.cod_jfas = " + UtilityDB.valueToString(codJfas)) +
|
||||
" AND segno = -1 " +
|
||||
" AND mtb_colr.data_collo > DATEADD(DAY, -5, GETDATE()) " +
|
||||
" GROUP BY jtb_fasi.cod_jfas, " +
|
||||
" jtb_fasi.descrizione, " +
|
||||
" mtb_colr.gestione, " +
|
||||
" mtb_colr.data_collo, " +
|
||||
" mtb_colr.num_collo, " +
|
||||
" mtb_colr.ser_collo, " +
|
||||
" mtb_colr.qta_cnf, " +
|
||||
" mtb_colr.cod_mart, " +
|
||||
" mtb_colr.cod_col, " +
|
||||
" mtb_colr.cod_tagl, " +
|
||||
" mtb_colr.ser_collo, " +
|
||||
" mtb_colr.partita_mag, " +
|
||||
" mtb_colr.cod_jcom, " +
|
||||
" mtb_aart.descrizione_estesa, " +
|
||||
" mtb_aart.descrizione, " +
|
||||
" mtb_aart.unt_mis, " +
|
||||
" mtb_colr.num_collo_rif, " +
|
||||
" mtb_colr.data_collo_rif, " +
|
||||
" mtb_colr.ser_collo_rif, " +
|
||||
" mtb_colr.gestione_rif, " +
|
||||
" mtb_colt.segno, " +
|
||||
" mtb_colr.num_ord, " +
|
||||
" mtb_colr.data_ord, " +
|
||||
" mtb_colr.gestione, " +
|
||||
" mtb_colr.riga_ord, " +
|
||||
" dtb_ord_steps.hr_num " +
|
||||
" HAVING SUM(mtb_colr.qta_col) > 0 " +
|
||||
"), max_ul AS ( " +
|
||||
" SELECT " +
|
||||
" cod_jfas, " +
|
||||
" descrizione_fase, " +
|
||||
" gestione, " +
|
||||
" cod_mart, " +
|
||||
" cod_col, " +
|
||||
" cod_tagl, " +
|
||||
" ser_collo, " +
|
||||
" partita_mag, " +
|
||||
" cod_jcom, " +
|
||||
" descrizione_art, " +
|
||||
" unt_mis, " +
|
||||
" num_collo_rif, " +
|
||||
" data_collo_rif, " +
|
||||
" ser_collo_rif, " +
|
||||
" gestione_rif, " +
|
||||
" segno, " +
|
||||
" num_ord, " +
|
||||
" data_ord, " +
|
||||
" gestione_ord, " +
|
||||
" riga_ord, " +
|
||||
" hr, " +
|
||||
" MAX (datetime_row) as max_datetime_row " +
|
||||
" FROM ul_list " +
|
||||
" GROUP BY cod_jfas, " +
|
||||
" descrizione_fase, " +
|
||||
" gestione, " +
|
||||
" cod_mart, " +
|
||||
" cod_col, " +
|
||||
" cod_tagl, " +
|
||||
" ser_collo, " +
|
||||
" partita_mag, " +
|
||||
" cod_jcom, " +
|
||||
" descrizione_art, " +
|
||||
" unt_mis, " +
|
||||
" num_collo_rif, " +
|
||||
" data_collo_rif, " +
|
||||
" ser_collo_rif, " +
|
||||
" gestione_rif, " +
|
||||
" segno, " +
|
||||
" num_ord, " +
|
||||
" data_ord, " +
|
||||
" gestione_ord, " +
|
||||
" riga_ord, " +
|
||||
" hr " +
|
||||
") " +
|
||||
" " +
|
||||
"SELECT ul_list.* FROM max_ul " +
|
||||
"LEFT OUTER JOIN ul_list ON " +
|
||||
" ISNULL(max_ul.cod_jfas, '') = ISNULL(ul_list.cod_jfas, '') AND " +
|
||||
" ISNULL(max_ul.descrizione_fase, '') = ISNULL(ul_list.descrizione_fase, '') AND " +
|
||||
" ISNULL(max_ul.gestione, '') = ISNULL(ul_list.gestione, '') AND " +
|
||||
" ISNULL(max_ul.cod_mart, '') = ISNULL(ul_list.cod_mart, '') AND " +
|
||||
" ISNULL(max_ul.cod_col, '') = ISNULL(ul_list.cod_col, '') AND " +
|
||||
" ISNULL(max_ul.cod_tagl, '') = ISNULL(ul_list.cod_tagl, '') AND " +
|
||||
" ISNULL(max_ul.ser_collo, '') = ISNULL(ul_list.ser_collo, '') AND " +
|
||||
" ISNULL(max_ul.partita_mag, '') = ISNULL(ul_list.partita_mag, '') AND " +
|
||||
" ISNULL(max_ul.cod_jcom, '') = ISNULL(ul_list.cod_jcom, '') AND " +
|
||||
" ISNULL(max_ul.descrizione_art, '') = ISNULL(ul_list.descrizione_art, '') AND " +
|
||||
" ISNULL(max_ul.unt_mis, '') = ISNULL(ul_list.unt_mis, '') AND " +
|
||||
" ISNULL(max_ul.num_collo_rif, '') = ISNULL(ul_list.num_collo_rif, '') AND " +
|
||||
" ISNULL(max_ul.data_collo_rif, '') = ISNULL(ul_list.data_collo_rif, '') AND " +
|
||||
" ISNULL(max_ul.ser_collo_rif, '') = ISNULL(ul_list.ser_collo_rif, '') AND " +
|
||||
" ISNULL(max_ul.gestione_rif, '') = ISNULL(ul_list.gestione_rif, '') AND " +
|
||||
" ISNULL(max_ul.segno, '') = ISNULL(ul_list.segno, '') AND " +
|
||||
" ISNULL(max_ul.num_ord, '') = ISNULL(ul_list.num_ord, '') AND " +
|
||||
" ISNULL(max_ul.data_ord, '') = ISNULL(ul_list.data_ord, '') AND " +
|
||||
" ISNULL(max_ul.gestione_ord, '') = ISNULL(ul_list.gestione_ord, '') AND " +
|
||||
" ISNULL(max_ul.riga_ord, '') = ISNULL(ul_list.riga_ord, '') AND " +
|
||||
" ISNULL(max_ul.hr, '') = ISNULL(ul_list.hr, '') AND " +
|
||||
" max_ul.max_datetime_row = ul_list.datetime_row";
|
||||
if (ulList == null) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
Type typeOfObjectsList = new TypeToken<ArrayList<HistoryVersamentoProdULRestDTO>>() {
|
||||
}.getType();
|
||||
this.mSystemRESTConsumer.<ArrayList<HistoryVersamentoProdULRestDTO>>processSql(sql, typeOfObjectsList, ulList -> {
|
||||
List<HistoryVersamentoProdULDTO> newUlList = new ArrayList<>();
|
||||
|
||||
if (ulList == null) {
|
||||
onComplete.run(null);
|
||||
return;
|
||||
Map<HashMap<String, Object>, List<HistoryVersamentoProdULRestDTO>> ulListGrouped = ulList.stream()
|
||||
.collect(Collectors.groupingBy(x -> {
|
||||
var keyMap = new HashMap<String, Object>();
|
||||
keyMap.put("gestione", x.getGestione());
|
||||
keyMap.put("data_collo", x.getDataCollo());
|
||||
keyMap.put("ser_collo", x.getSerCollo());
|
||||
keyMap.put("num_collo", x.getNumCollo());
|
||||
keyMap.put("cod_mart", x.getCodMart());
|
||||
keyMap.put("partita_mag", x.getPartitaMag());
|
||||
keyMap.put("gestione_rif", x.getGestioneRif());
|
||||
keyMap.put("data_collo_rif", x.getDataColloRif());
|
||||
keyMap.put("ser_collo_rif", x.getSerColloRif());
|
||||
keyMap.put("num_collo_rif", x.getNumColloRif());
|
||||
return keyMap;
|
||||
}, Collectors.toList()));
|
||||
|
||||
for (HashMap<String, Object> ulKey : ulListGrouped.keySet()) {
|
||||
var matchingUls = ulList.stream().filter(x ->
|
||||
Objects.equals(x.getGestione(), ulKey.get("gestione")) &&
|
||||
Objects.equals(x.getDataCollo(), ulKey.get("data_collo")) &&
|
||||
Objects.equals(x.getSerCollo(), ulKey.get("ser_collo")) &&
|
||||
Objects.equals(x.getNumCollo(), ulKey.get("num_collo")) &&
|
||||
Objects.equals(x.getCodMart(), ulKey.get("cod_mart")) &&
|
||||
Objects.equals(x.getPartitaMag(), ulKey.get("partita_mag")) &&
|
||||
Objects.equals(x.getGestioneRif(), ulKey.get("gestione_rif")) &&
|
||||
Objects.equals(x.getDataColloRif(), ulKey.get("data_collo_rif")) &&
|
||||
Objects.equals(x.getSerColloRif(), ulKey.get("ser_collo_rif")) &&
|
||||
Objects.equals(x.getNumColloRif(), ulKey.get("num_collo_rif"))
|
||||
).collect(Collectors.toUnmodifiableList());
|
||||
|
||||
ulKey.put("qta_col", matchingUls.stream().map(HistoryVersamentoProdULRestDTO::getQtaCol)
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add));
|
||||
ulKey.put("num_cnf", matchingUls.stream().map(HistoryVersamentoProdULRestDTO::getNumCnf)
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add));
|
||||
}
|
||||
|
||||
ulListGrouped.forEach((key, value) -> {
|
||||
|
||||
var listaOrdini = value.stream()
|
||||
.filter(x -> x.getDataOrd() != null &&
|
||||
x.getGestioneOrd() != null &&
|
||||
x.getNumOrd() != null)
|
||||
.map(x -> new HistoryVersamentoProdULDTO.OrdineDto()
|
||||
.setData(x.getDataOrd())
|
||||
.setNumero(x.getNumOrd())
|
||||
.setGestione(x.getGestione())
|
||||
.setRigaOrd(x.getRigaOrd())
|
||||
.setQtaCol(x.getQtaCol())
|
||||
.setNumCnf(x.getNumCnf())
|
||||
.setPercentageHr(x.getPercentageHr()))
|
||||
.distinct()
|
||||
.collect(Collectors.toUnmodifiableList());
|
||||
|
||||
var restData = value.get(0);
|
||||
var qtaCol = (BigDecimal) key.get("qta_col");
|
||||
var numCnf = (BigDecimal) key.get("num_cnf");
|
||||
|
||||
newUlList.add(new HistoryVersamentoProdULDTO()
|
||||
.setGestione(restData.getGestione())
|
||||
.setDataCollo(restData.getDataCollo())
|
||||
.setSerCollo(restData.getSerCollo())
|
||||
.setNumCollo(restData.getNumCollo())
|
||||
.setSegno(restData.getSegno())
|
||||
.setCodMart(restData.getCodMart())
|
||||
.setCodCol(restData.getCodCol())
|
||||
.setCodTagl(restData.getCodTagl())
|
||||
.setCodJfas(restData.getCodJfas())
|
||||
.setDescrizioneArt(restData.getDescrizioneArt())
|
||||
.setDescrizioneFase(restData.getDescrizioneFase())
|
||||
.setQtaCol(qtaCol)
|
||||
.setQtaCnf(restData.getQtaCnf())
|
||||
.setNumCnf(numCnf)
|
||||
.setPartitaMag(restData.getPartitaMag())
|
||||
.setCodJcom(restData.getCodJcom())
|
||||
.setDatetimeRow(restData.getDatetimeRow())
|
||||
.setUntMis(restData.getUntMis())
|
||||
.setGestioneRif(restData.getGestioneRif())
|
||||
.setDataColloRif(restData.getDataColloRif())
|
||||
.setSerColloRif(restData.getSerColloRif())
|
||||
.setNumColloRif(restData.getNumColloRif())
|
||||
.setOrdini(listaOrdini));
|
||||
|
||||
});
|
||||
|
||||
|
||||
if (!newUlList.isEmpty()) {
|
||||
List<String> codMarts = newUlList.stream()
|
||||
.map(HistoryVersamentoProdULDTO::getCodMart)
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.collect(Collectors.toUnmodifiableList());
|
||||
|
||||
var arts = this.mArticoloRESTConsumer.getByCodMartsSynchronized(codMarts);
|
||||
|
||||
if (arts != null && !arts.isEmpty()) {
|
||||
for (HistoryVersamentoProdULDTO value : newUlList) {
|
||||
|
||||
MtbAart foundMtbAart = arts.stream()
|
||||
.filter(x -> x.getCodMart().equalsIgnoreCase(value.getCodMart()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
|
||||
value.setMtbAart(foundMtbAart);
|
||||
}
|
||||
}
|
||||
|
||||
List<HistoryVersamentoProdULDTO> newUlList = new ArrayList<>();
|
||||
return newUlList;
|
||||
|
||||
Stream.of(ulList)
|
||||
.distinctBy(x -> {
|
||||
HashMap<String, Object> hashMap = new HashMap<>();
|
||||
hashMap.put("gestione", x.getGestione());
|
||||
hashMap.put("data_collo", x.getDataCollo());
|
||||
hashMap.put("ser_collo", x.getSerCollo());
|
||||
hashMap.put("num_collo", x.getNumCollo());
|
||||
hashMap.put("cod_mart", x.getCodMart());
|
||||
hashMap.put("gestione_rif", x.getGestioneRif());
|
||||
hashMap.put("data_collo_rif", x.getDataColloRif());
|
||||
hashMap.put("ser_collo_rif", x.getSerColloRif());
|
||||
hashMap.put("num_collo_rif", x.getNumColloRif());
|
||||
|
||||
return hashMap;
|
||||
})
|
||||
.forEach(restDTO -> {
|
||||
} else {
|
||||
return newUlList;
|
||||
}
|
||||
}
|
||||
|
||||
List<HistoryVersamentoProdULDTO.OrdineDto> ordineList = ulList.stream()
|
||||
.filter(x -> x.getNumCollo().equals(restDTO.getNumCollo()) &&
|
||||
x.getDataCollo().equals(restDTO.getDataCollo()) &&
|
||||
x.getSerCollo().equals(restDTO.getSerCollo()) &&
|
||||
x.getGestione().equals(restDTO.getGestione()) &&
|
||||
(x.getRigaOrd() == null || Objects.equals(x.getRigaOrd(), restDTO.getRigaOrd())))
|
||||
.map(x -> new HistoryVersamentoProdULDTO.OrdineDto()
|
||||
.setData(x.getDataOrd())
|
||||
.setNumero(x.getNumOrd())
|
||||
.setGestione(x.getGestione())
|
||||
.setRigaOrd(x.getRigaOrd())
|
||||
.setQtaCol(x.getQtaCol())
|
||||
.setNumCnf(x.getNumCnf())
|
||||
.setPercentageHr(x.getPercentageHr()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// BigDecimal qtaColTot = BigDecimal.ZERO;
|
||||
// BigDecimal numCnfColTot = BigDecimal.ZERO;
|
||||
// public void loadLastULVersate(String codJfas, RunnableArgs<List<HistoryVersamentoProdULDTO>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
//
|
||||
// for (HistoryVersamentoProdULDTO.OrdineDto ordine :
|
||||
// ordineList) {
|
||||
// qtaColTot = qtaColTot.add(ordine.getQtaCol());
|
||||
// numCnfColTot = numCnfColTot.add(ordine.getNumCnf());
|
||||
// String sql = "WITH ul_list AS ( " +
|
||||
// " SELECT jtb_fasi.cod_jfas, " +
|
||||
// " jtb_fasi.descrizione AS descrizione_fase, " +
|
||||
// " mtb_colr.gestione, " +
|
||||
// " mtb_colr.data_collo, " +
|
||||
// " mtb_colr.num_collo, " +
|
||||
// " mtb_colr.ser_collo, " +
|
||||
// " mtb_colr.cod_mart, " +
|
||||
// " mtb_colr.cod_col, " +
|
||||
// " mtb_colr.cod_tagl, " +
|
||||
// " SUM(mtb_colr.qta_col) AS qta_col, " +
|
||||
// " mtb_colr.qta_cnf AS qta_cnf, " +
|
||||
// " SUM(mtb_colr.num_cnf) AS num_cnf, " +
|
||||
// " mtb_colr.partita_mag, " +
|
||||
// " mtb_colr.cod_jcom, " +
|
||||
// " mtb_colr.num_collo_rif, " +
|
||||
// " mtb_colr.data_collo_rif, " +
|
||||
// " mtb_colr.ser_collo_rif, " +
|
||||
// " mtb_colr.gestione_rif, " +
|
||||
// " mtb_colt.segno, " +
|
||||
// " ISNULL(mtb_aart.descrizione_estesa, mtb_aart.descrizione) AS descrizione_art, " +
|
||||
// " mtb_aart.unt_mis, " +
|
||||
// " MAX(datetime_row) AS datetime_row, " +
|
||||
// " mtb_colr.num_ord, " +
|
||||
// " mtb_colr.data_ord, " +
|
||||
// " mtb_colr.gestione as gestione_ord, " +
|
||||
// " mtb_colr.riga_ord, " +
|
||||
// " dtb_ord_steps.hr_num as hr, " +
|
||||
// " CONVERT(INTEGER, ROUND((CAST(dtb_ord_steps.hr_num AS DECIMAL(20, 5)) / " +
|
||||
// " SUM(dtb_ord_steps.hr_num) OVER (PARTITION BY mtb_colr.num_collo)), " +
|
||||
// " SUM(CASE WHEN dtb_ord_steps.hr_num > 0 then dtb_ord_steps.hr_num else 1 end) OVER (PARTITION BY mtb_colr.num_collo)) * 100, " +
|
||||
// " 0) as percentage_hr " +
|
||||
// " FROM mtb_colr " +
|
||||
// " INNER JOIN mtb_colt ON mtb_colr.num_collo = mtb_colt.num_collo " +
|
||||
// " AND mtb_colr.data_collo = mtb_colt.data_collo " +
|
||||
// " AND mtb_colr.ser_collo = mtb_colt.ser_collo " +
|
||||
// " AND mtb_colr.gestione = mtb_colt.gestione " +
|
||||
// " " + (SettingsManager.iDB().isFlagVersamentoDirettoProduzione() ? "INNER" : "LEFT OUTER") + " join dtb_ord_steps ON dtb_ord_steps.data_ord = mtb_colr.data_ord " +
|
||||
// " AND dtb_ord_steps.gestione = mtb_colr.gestione " +
|
||||
// " AND dtb_ord_steps.num_ord = mtb_colr.num_ord " +
|
||||
// " AND dtb_ord_steps.data_iniz is not null " +
|
||||
// " AND dtb_ord_steps.data_fine is null " +
|
||||
// " INNER JOIN mtb_aart ON mtb_colr.cod_mart = mtb_aart.cod_mart " +
|
||||
// " LEFT OUTER JOIN jtb_fasi ON mtb_colt.cod_jfas = jtb_fasi.cod_jfas " +
|
||||
// " WHERE jtb_fasi.cod_jfas IS NOT NULL " +
|
||||
// (UtilityString.isNullOrEmpty(codJfas) ? "" : " AND jtb_fasi.cod_jfas = " + UtilityDB.valueToString(codJfas)) +
|
||||
// " AND segno = -1 " +
|
||||
// " AND mtb_colr.data_collo > DATEADD(DAY, -5, GETDATE()) " +
|
||||
// " GROUP BY jtb_fasi.cod_jfas, " +
|
||||
// " jtb_fasi.descrizione, " +
|
||||
// " mtb_colr.gestione, " +
|
||||
// " mtb_colr.data_collo, " +
|
||||
// " mtb_colr.num_collo, " +
|
||||
// " mtb_colr.ser_collo, " +
|
||||
// " mtb_colr.qta_cnf, " +
|
||||
// " mtb_colr.cod_mart, " +
|
||||
// " mtb_colr.cod_col, " +
|
||||
// " mtb_colr.cod_tagl, " +
|
||||
// " mtb_colr.ser_collo, " +
|
||||
// " mtb_colr.partita_mag, " +
|
||||
// " mtb_colr.cod_jcom, " +
|
||||
// " mtb_aart.descrizione_estesa, " +
|
||||
// " mtb_aart.descrizione, " +
|
||||
// " mtb_aart.unt_mis, " +
|
||||
// " mtb_colr.num_collo_rif, " +
|
||||
// " mtb_colr.data_collo_rif, " +
|
||||
// " mtb_colr.ser_collo_rif, " +
|
||||
// " mtb_colr.gestione_rif, " +
|
||||
// " mtb_colt.segno, " +
|
||||
// " mtb_colr.num_ord, " +
|
||||
// " mtb_colr.data_ord, " +
|
||||
// " mtb_colr.gestione, " +
|
||||
// " mtb_colr.riga_ord, " +
|
||||
// " dtb_ord_steps.hr_num " +
|
||||
// " HAVING SUM(mtb_colr.qta_col) > 0 " +
|
||||
// "), max_ul AS ( " +
|
||||
// " SELECT " +
|
||||
// " cod_jfas, " +
|
||||
// " descrizione_fase, " +
|
||||
// " gestione, " +
|
||||
// " cod_mart, " +
|
||||
// " cod_col, " +
|
||||
// " cod_tagl, " +
|
||||
// " ser_collo, " +
|
||||
// " partita_mag, " +
|
||||
// " cod_jcom, " +
|
||||
// " descrizione_art, " +
|
||||
// " unt_mis, " +
|
||||
// " num_collo_rif, " +
|
||||
// " data_collo_rif, " +
|
||||
// " ser_collo_rif, " +
|
||||
// " gestione_rif, " +
|
||||
// " segno, " +
|
||||
// " num_ord, " +
|
||||
// " data_ord, " +
|
||||
// " gestione_ord, " +
|
||||
// " riga_ord, " +
|
||||
// " hr, " +
|
||||
// " MAX (datetime_row) as max_datetime_row " +
|
||||
// " FROM ul_list " +
|
||||
// " GROUP BY cod_jfas, " +
|
||||
// " descrizione_fase, " +
|
||||
// " gestione, " +
|
||||
// " cod_mart, " +
|
||||
// " cod_col, " +
|
||||
// " cod_tagl, " +
|
||||
// " ser_collo, " +
|
||||
// " partita_mag, " +
|
||||
// " cod_jcom, " +
|
||||
// " descrizione_art, " +
|
||||
// " unt_mis, " +
|
||||
// " num_collo_rif, " +
|
||||
// " data_collo_rif, " +
|
||||
// " ser_collo_rif, " +
|
||||
// " gestione_rif, " +
|
||||
// " segno, " +
|
||||
// " num_ord, " +
|
||||
// " data_ord, " +
|
||||
// " gestione_ord, " +
|
||||
// " riga_ord, " +
|
||||
// " hr " +
|
||||
// ") " +
|
||||
// " " +
|
||||
// "SELECT ul_list.* FROM max_ul " +
|
||||
// "LEFT OUTER JOIN ul_list ON " +
|
||||
// " ISNULL(max_ul.cod_jfas, '') = ISNULL(ul_list.cod_jfas, '') AND " +
|
||||
// " ISNULL(max_ul.descrizione_fase, '') = ISNULL(ul_list.descrizione_fase, '') AND " +
|
||||
// " ISNULL(max_ul.gestione, '') = ISNULL(ul_list.gestione, '') AND " +
|
||||
// " ISNULL(max_ul.cod_mart, '') = ISNULL(ul_list.cod_mart, '') AND " +
|
||||
// " ISNULL(max_ul.cod_col, '') = ISNULL(ul_list.cod_col, '') AND " +
|
||||
// " ISNULL(max_ul.cod_tagl, '') = ISNULL(ul_list.cod_tagl, '') AND " +
|
||||
// " ISNULL(max_ul.ser_collo, '') = ISNULL(ul_list.ser_collo, '') AND " +
|
||||
// " ISNULL(max_ul.partita_mag, '') = ISNULL(ul_list.partita_mag, '') AND " +
|
||||
// " ISNULL(max_ul.cod_jcom, '') = ISNULL(ul_list.cod_jcom, '') AND " +
|
||||
// " ISNULL(max_ul.descrizione_art, '') = ISNULL(ul_list.descrizione_art, '') AND " +
|
||||
// " ISNULL(max_ul.unt_mis, '') = ISNULL(ul_list.unt_mis, '') AND " +
|
||||
// " ISNULL(max_ul.num_collo_rif, '') = ISNULL(ul_list.num_collo_rif, '') AND " +
|
||||
// " ISNULL(max_ul.data_collo_rif, '') = ISNULL(ul_list.data_collo_rif, '') AND " +
|
||||
// " ISNULL(max_ul.ser_collo_rif, '') = ISNULL(ul_list.ser_collo_rif, '') AND " +
|
||||
// " ISNULL(max_ul.gestione_rif, '') = ISNULL(ul_list.gestione_rif, '') AND " +
|
||||
// " ISNULL(max_ul.segno, '') = ISNULL(ul_list.segno, '') AND " +
|
||||
// " ISNULL(max_ul.num_ord, '') = ISNULL(ul_list.num_ord, '') AND " +
|
||||
// " ISNULL(max_ul.data_ord, '') = ISNULL(ul_list.data_ord, '') AND " +
|
||||
// " ISNULL(max_ul.gestione_ord, '') = ISNULL(ul_list.gestione_ord, '') AND " +
|
||||
// " ISNULL(max_ul.riga_ord, '') = ISNULL(ul_list.riga_ord, '') AND " +
|
||||
// " ISNULL(max_ul.hr, '') = ISNULL(ul_list.hr, '') AND " +
|
||||
// " max_ul.max_datetime_row = ul_list.datetime_row";
|
||||
//
|
||||
// Type typeOfObjectsList = new TypeToken<ArrayList<HistoryVersamentoProdULRestDTO>>() {
|
||||
// }.getType();
|
||||
// this.mSystemRESTConsumer.<ArrayList<HistoryVersamentoProdULRestDTO>>processSql(sql, typeOfObjectsList, ulList -> {
|
||||
//
|
||||
// if (ulList == null) {
|
||||
// onComplete.run(null);
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// List<HistoryVersamentoProdULDTO> newUlList = new ArrayList<>();
|
||||
//
|
||||
// Stream.of(ulList)
|
||||
// .distinctBy(x -> {
|
||||
// HashMap<String, Object> hashMap = new HashMap<>();
|
||||
// hashMap.put("gestione", x.getGestione());
|
||||
// hashMap.put("data_collo", x.getDataCollo());
|
||||
// hashMap.put("ser_collo", x.getSerCollo());
|
||||
// hashMap.put("num_collo", x.getNumCollo());
|
||||
// hashMap.put("cod_mart", x.getCodMart());
|
||||
// hashMap.put("gestione_rif", x.getGestioneRif());
|
||||
// hashMap.put("data_collo_rif", x.getDataColloRif());
|
||||
// hashMap.put("ser_collo_rif", x.getSerColloRif());
|
||||
// hashMap.put("num_collo_rif", x.getNumColloRif());
|
||||
//
|
||||
// return hashMap;
|
||||
// })
|
||||
// .forEach(restDTO -> {
|
||||
//
|
||||
// List<HistoryVersamentoProdULDTO.OrdineDto> ordineList = ulList.stream()
|
||||
// .filter(x -> x.getNumCollo().equals(restDTO.getNumCollo()) &&
|
||||
// x.getDataCollo().equals(restDTO.getDataCollo()) &&
|
||||
// x.getSerCollo().equals(restDTO.getSerCollo()) &&
|
||||
// x.getGestione().equals(restDTO.getGestione()) &&
|
||||
// (x.getRigaOrd() == null || Objects.equals(x.getRigaOrd(), restDTO.getRigaOrd())))
|
||||
// .map(x -> new HistoryVersamentoProdULDTO.OrdineDto()
|
||||
// .setData(x.getDataOrd())
|
||||
// .setNumero(x.getNumOrd())
|
||||
// .setGestione(x.getGestione())
|
||||
// .setRigaOrd(x.getRigaOrd())
|
||||
// .setQtaCol(x.getQtaCol())
|
||||
// .setNumCnf(x.getNumCnf())
|
||||
// .setPercentageHr(x.getPercentageHr()))
|
||||
// .collect(Collectors.toList());
|
||||
//
|
||||
//// BigDecimal qtaColTot = BigDecimal.ZERO;
|
||||
//// BigDecimal numCnfColTot = BigDecimal.ZERO;
|
||||
////
|
||||
//// for (HistoryVersamentoProdULDTO.OrdineDto ordine :
|
||||
//// ordineList) {
|
||||
//// qtaColTot = qtaColTot.add(ordine.getQtaCol());
|
||||
//// numCnfColTot = numCnfColTot.add(ordine.getNumCnf());
|
||||
//// }
|
||||
//
|
||||
// newUlList.add(new HistoryVersamentoProdULDTO()
|
||||
// .setGestione(restDTO.getGestione())
|
||||
// .setDataCollo(restDTO.getDataCollo())
|
||||
// .setSerCollo(restDTO.getSerCollo())
|
||||
// .setNumCollo(restDTO.getNumCollo())
|
||||
// .setSegno(restDTO.getSegno())
|
||||
// .setCodMart(restDTO.getCodMart())
|
||||
// .setCodCol(restDTO.getCodCol())
|
||||
// .setCodTagl(restDTO.getCodTagl())
|
||||
// .setCodJfas(restDTO.getCodJfas())
|
||||
// .setDescrizioneArt(restDTO.getDescrizioneArt())
|
||||
// .setDescrizioneFase(restDTO.getDescrizioneFase())
|
||||
// .setQtaCol(restDTO.getQtaCol())
|
||||
// .setQtaCnf(restDTO.getQtaCnf())
|
||||
// .setNumCnf(restDTO.getNumCnf())
|
||||
// .setPartitaMag(restDTO.getPartitaMag())
|
||||
// .setCodJcom(restDTO.getCodJcom())
|
||||
// .setDatetimeRow(restDTO.getDatetimeRow())
|
||||
// .setUntMis(restDTO.getUntMis())
|
||||
// .setGestioneRif(restDTO.getGestioneRif())
|
||||
// .setDataColloRif(restDTO.getDataColloRif())
|
||||
// .setSerColloRif(restDTO.getSerColloRif())
|
||||
// .setNumColloRif(restDTO.getNumColloRif())
|
||||
// .setOrdini(ordineList));
|
||||
//
|
||||
// });
|
||||
//
|
||||
//
|
||||
// if (!newUlList.isEmpty()) {
|
||||
// List<String> codMarts = Stream.of(newUlList)
|
||||
// .map(HistoryVersamentoProdULDTO::getCodMart)
|
||||
// .withoutNulls()
|
||||
// .distinct()
|
||||
// .toList();
|
||||
//
|
||||
// this.mArticoloRESTConsumer.getByCodMarts(codMarts, arts -> {
|
||||
//
|
||||
// if (arts != null && !arts.isEmpty()) {
|
||||
// for (HistoryVersamentoProdULDTO value : newUlList) {
|
||||
//
|
||||
// MtbAart foundMtbAart = null;
|
||||
//
|
||||
// List<MtbAart> mtbAartStream = Stream.of(arts)
|
||||
// .filter(x -> x.getCodMart().equalsIgnoreCase(value.getCodMart())).toList();
|
||||
//
|
||||
// if (mtbAartStream != null && !mtbAartStream.isEmpty()) {
|
||||
// foundMtbAart = mtbAartStream.get(0);
|
||||
// }
|
||||
//
|
||||
// value.setMtbAart(foundMtbAart);
|
||||
// }
|
||||
|
||||
newUlList.add(new HistoryVersamentoProdULDTO()
|
||||
.setGestione(restDTO.getGestione())
|
||||
.setDataCollo(restDTO.getDataCollo())
|
||||
.setSerCollo(restDTO.getSerCollo())
|
||||
.setNumCollo(restDTO.getNumCollo())
|
||||
.setSegno(restDTO.getSegno())
|
||||
.setCodMart(restDTO.getCodMart())
|
||||
.setCodCol(restDTO.getCodCol())
|
||||
.setCodTagl(restDTO.getCodTagl())
|
||||
.setCodJfas(restDTO.getCodJfas())
|
||||
.setDescrizioneArt(restDTO.getDescrizioneArt())
|
||||
.setDescrizioneFase(restDTO.getDescrizioneFase())
|
||||
.setQtaCol(restDTO.getQtaCol())
|
||||
.setQtaCnf(restDTO.getQtaCnf())
|
||||
.setNumCnf(restDTO.getNumCnf())
|
||||
.setPartitaMag(restDTO.getPartitaMag())
|
||||
.setCodJcom(restDTO.getCodJcom())
|
||||
.setDatetimeRow(restDTO.getDatetimeRow())
|
||||
.setUntMis(restDTO.getUntMis())
|
||||
.setGestioneRif(restDTO.getGestioneRif())
|
||||
.setDataColloRif(restDTO.getDataColloRif())
|
||||
.setSerColloRif(restDTO.getSerColloRif())
|
||||
.setNumColloRif(restDTO.getNumColloRif())
|
||||
.setOrdini(ordineList));
|
||||
|
||||
});
|
||||
|
||||
|
||||
if (!newUlList.isEmpty()) {
|
||||
List<String> codMarts = Stream.of(newUlList)
|
||||
.map(HistoryVersamentoProdULDTO::getCodMart)
|
||||
.withoutNulls()
|
||||
.distinct()
|
||||
.toList();
|
||||
|
||||
this.mArticoloRESTConsumer.getByCodMarts(codMarts, arts -> {
|
||||
|
||||
if (arts != null && !arts.isEmpty()) {
|
||||
for (HistoryVersamentoProdULDTO value : newUlList) {
|
||||
|
||||
MtbAart foundMtbAart = null;
|
||||
|
||||
List<MtbAart> mtbAartStream = Stream.of(arts)
|
||||
.filter(x -> x.getCodMart().equalsIgnoreCase(value.getCodMart())).toList();
|
||||
|
||||
if (mtbAartStream != null && !mtbAartStream.isEmpty()) {
|
||||
foundMtbAart = mtbAartStream.get(0);
|
||||
}
|
||||
|
||||
value.setMtbAart(foundMtbAart);
|
||||
}
|
||||
}
|
||||
|
||||
onComplete.run(newUlList);
|
||||
|
||||
}, onFailed);
|
||||
|
||||
} else {
|
||||
onComplete.run(newUlList);
|
||||
}
|
||||
|
||||
}, onFailed);
|
||||
}
|
||||
// }
|
||||
//
|
||||
// onComplete.run(newUlList);
|
||||
//
|
||||
// }, onFailed);
|
||||
//
|
||||
// } else {
|
||||
// onComplete.run(newUlList);
|
||||
// }
|
||||
//
|
||||
// }, onFailed);
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -40,14 +40,17 @@ import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.model.VersamentoAutomaticoULResponseDTO;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
import it.integry.integrywmsnative.databinding.FragmentProdRientroMerceOrderDetailBinding;
|
||||
import it.integry.integrywmsnative.gest.prod_versamento_materiale.dto.OrdineLavorazioneDTO;
|
||||
import it.integry.integrywmsnative.gest.settings.MainSettingsFragment;
|
||||
import it.integry.integrywmsnative.ui.SimpleDividerItemDecoration;
|
||||
import it.integry.integrywmsnative.view.dialogs.ask_should_versamento_automatico_ul.DialogAskShouldVersamentoAutomaticoULView;
|
||||
import it.integry.integrywmsnative.view.dialogs.input_lu_prod.DialogInputLUProdDTO;
|
||||
import it.integry.integrywmsnative.view.dialogs.input_lu_prod.DialogInputLUProdView;
|
||||
import it.integry.integrywmsnative.view.dialogs.printSsccUl.DialogPrintUlSSCCView;
|
||||
import it.integry.integrywmsnative.view.dialogs.versamento_automatico_ul_done.DialogVersamentoAutomaticoULDoneView;
|
||||
|
||||
/**
|
||||
* A simple {@link Fragment} subclass.
|
||||
@@ -268,6 +271,19 @@ public class ProdRientroMerceOrderDetailFragment extends BaseFragment implements
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onVersamentoAutomaticoULRequest(RunnableArgs<Boolean> onComplete) {
|
||||
DialogAskShouldVersamentoAutomaticoULView.newInstance(onComplete).show(requireActivity().getSupportFragmentManager(), "tag");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onULVersata(VersamentoAutomaticoULResponseDTO versamentoAutomaticoULResponseDTO, Runnable onComplete) {
|
||||
|
||||
handler.post(() -> {
|
||||
DialogVersamentoAutomaticoULDoneView.newInstance(versamentoAutomaticoULResponseDTO, onComplete).show(requireActivity().getSupportFragmentManager(), "tag");
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void addULButtonClick() {
|
||||
this.onLoadingStarted();
|
||||
|
||||
@@ -25,6 +25,7 @@ import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsume
|
||||
import it.integry.integrywmsnative.core.rest.consumers.PrinterRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ProduzioneRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.model.VersamentoAutomaticoULResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.produzione.CaricoProdFinDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.produzione.CaricoProdFinProdottoDTO;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
@@ -173,13 +174,39 @@ public class ProdRientroMerceOrderDetailViewModel {
|
||||
}, this::sendError);
|
||||
} else {
|
||||
synchronized (this.mtbColtsOfOrder) {
|
||||
this.sendOnLoadingEnded();
|
||||
this.mListener.onDataSaved(mtbColtSaved);
|
||||
Runnable onVersamentoCompleted = () -> {
|
||||
this.sendOnLoadingEnded();
|
||||
this.mListener.onDataSaved(mtbColtSaved);
|
||||
};
|
||||
|
||||
if (SettingsManager.iDB().isFlagProduzioneSkipAskVersamentoAutomatico()) {
|
||||
versaAutomaticamenteUL(mtbColtSaved, onVersamentoCompleted);
|
||||
} else {
|
||||
sendVersamentoAutomaticoULRequest(response -> {
|
||||
if (response) {
|
||||
versaAutomaticamenteUL(mtbColtSaved, onVersamentoCompleted);
|
||||
} else {
|
||||
onVersamentoCompleted.run();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}, this::sendError);
|
||||
}
|
||||
|
||||
private void versaAutomaticamenteUL(MtbColt mtbColt, Runnable onComplete) {
|
||||
if (mtbColt == null) return;
|
||||
|
||||
colliMagazzinoRESTConsumer.versamentoAutomaticoUL(mtbColt, versamentoResult -> {
|
||||
this.notifyVersamentoAutomaticoResult(versamentoResult, onComplete);
|
||||
}, this::sendError);
|
||||
}
|
||||
|
||||
private void notifyVersamentoAutomaticoResult(VersamentoAutomaticoULResponseDTO versamentoAutomaticoULResponseDTO, Runnable onComplete) {
|
||||
if (this.mListener != null)
|
||||
mListener.onULVersata(versamentoAutomaticoULResponseDTO, onComplete);
|
||||
}
|
||||
|
||||
public void deleteLU(MtbColt mtbColt) {
|
||||
this.sendOnLoadingStarted();
|
||||
@@ -251,11 +278,17 @@ public class ProdRientroMerceOrderDetailViewModel {
|
||||
this::sendError);
|
||||
}
|
||||
|
||||
private void sendVersamentoAutomaticoULRequest(RunnableArgs<Boolean> onComplete) {
|
||||
if (this.mListener != null) this.mListener.onVersamentoAutomaticoULRequest(onComplete);
|
||||
}
|
||||
|
||||
public interface Listener extends ILoadingListener {
|
||||
void onVersamentoAutomaticoULRequest(RunnableArgs<Boolean> onComplete);
|
||||
|
||||
void onDataSaved(MtbColt mtbColt);
|
||||
|
||||
void onError(Exception ex);
|
||||
|
||||
void onULVersata(VersamentoAutomaticoULResponseDTO versamentoAutomaticoULResponseDTO, Runnable onComplete);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ public class ProdRientroMerceOrderListFilterViewModel {
|
||||
|
||||
public void init(List<OrdineLavorazioneDTO> initialList) {
|
||||
this.initialOrderList = initialList;
|
||||
this.currentFilteredOrderList.setValue(this.initialOrderList);
|
||||
this.currentFilteredOrderList.postValue(this.initialOrderList);
|
||||
}
|
||||
|
||||
public MutableLiveData<List<OrdineLavorazioneDTO>> getMutableFilteredOrderList() {
|
||||
|
||||
@@ -201,6 +201,8 @@ public class VerificaGiacenzeFragment extends BaseFragment implements ITitledFra
|
||||
barcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
||||
.setOnScanSuccessful(onScanSuccessful)
|
||||
.setOnScanFailed(ex -> UtilityExceptions.defaultException(requireContext(), ex, false)));
|
||||
|
||||
BarcodeManager.enable(barcodeScannerIstanceID);
|
||||
}
|
||||
|
||||
private final RunnableArgs<BarcodeScanDTO> onScanSuccessful = data -> {
|
||||
@@ -209,12 +211,12 @@ public class VerificaGiacenzeFragment extends BaseFragment implements ITitledFra
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
this.mViewModel.processBarcodeDTO(data);
|
||||
this.onLoadingEnded();
|
||||
} catch (Exception e) {
|
||||
this.onError(e);
|
||||
}
|
||||
});
|
||||
|
||||
this.onLoadingEnded();
|
||||
};
|
||||
|
||||
|
||||
@@ -250,7 +252,13 @@ public class VerificaGiacenzeFragment extends BaseFragment implements ITitledFra
|
||||
|
||||
@Override
|
||||
public void onItemDeleteRequest(VerificaGiacenzeRowEntity data) {
|
||||
mViewModel.deleteRow(data);
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
mViewModel.deleteRow(data);
|
||||
} catch (Exception ex) {
|
||||
onError(ex);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -279,6 +287,8 @@ public class VerificaGiacenzeFragment extends BaseFragment implements ITitledFra
|
||||
.setTotalNumCnfOrd(incomingNumCnf)
|
||||
.setPartitaMag(partitaMag)
|
||||
.setDataScad(dataScad)
|
||||
.setCanInputZeroQuantity(true)
|
||||
.setCanOverflowOrderQuantity(true)
|
||||
.setCanLUBeClosed(false);
|
||||
|
||||
if (!dialogInputQuantityV2View.isVisible())
|
||||
@@ -313,12 +323,12 @@ public class VerificaGiacenzeFragment extends BaseFragment implements ITitledFra
|
||||
return result.get();
|
||||
}
|
||||
|
||||
public void saveAndClose() {
|
||||
public void Close() {
|
||||
this.onLoadingStarted();
|
||||
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
mViewModel.save();
|
||||
mViewModel.close();
|
||||
this.onLoadingEnded();
|
||||
|
||||
popMe();
|
||||
|
||||
@@ -8,7 +8,7 @@ import dagger.Module;
|
||||
import dagger.Provides;
|
||||
import it.integry.integrywmsnative.core.data_store.db.respository_new.VerificaGiacenzeRepository;
|
||||
import it.integry.integrywmsnative.core.data_store.db.respository_new.VerificaGiacenzeRowRepository;
|
||||
import it.integry.integrywmsnative.core.mapper.VerificaGiacenzeMapper;
|
||||
import it.integry.integrywmsnative.core.mapper.VerificaGiacenzeRowMapper;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.GiacenzaPvRESTConsumer;
|
||||
|
||||
@@ -16,8 +16,8 @@ import it.integry.integrywmsnative.core.rest.consumers.GiacenzaPvRESTConsumer;
|
||||
public class VerificaGiacenzeModule {
|
||||
|
||||
@Provides
|
||||
VerificaGiacenzeViewModel providesVerificaGiacenzeViewModel(ExecutorService executorService, Handler handler, VerificaGiacenzeMapper verificaGiacenzeMapper, VerificaGiacenzeRepository verificaGiacenzeRepository, VerificaGiacenzeRowRepository verificaGiacenzeRowRepository, GiacenzaPvRESTConsumer giacenzaPvRESTConsumer, ArticoloRESTConsumer articoloRESTConsumer) {
|
||||
return new VerificaGiacenzeViewModel(executorService, handler, verificaGiacenzeMapper, giacenzaPvRESTConsumer, verificaGiacenzeRepository, verificaGiacenzeRowRepository, articoloRESTConsumer);
|
||||
VerificaGiacenzeViewModel providesVerificaGiacenzeViewModel(ExecutorService executorService, Handler handler, VerificaGiacenzeRowMapper verificaGiacenzeRowMapper, VerificaGiacenzeRepository verificaGiacenzeRepository, VerificaGiacenzeRowRepository verificaGiacenzeRowRepository, GiacenzaPvRESTConsumer giacenzaPvRESTConsumer, ArticoloRESTConsumer articoloRESTConsumer) {
|
||||
return new VerificaGiacenzeViewModel(executorService, handler, verificaGiacenzeRowMapper, giacenzaPvRESTConsumer, verificaGiacenzeRepository, verificaGiacenzeRowRepository, articoloRESTConsumer);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -22,13 +22,18 @@ import it.integry.integrywmsnative.core.data_store.db.entity.VerificaGiacenzeRow
|
||||
import it.integry.integrywmsnative.core.data_store.db.respository_new.VerificaGiacenzeRepository;
|
||||
import it.integry.integrywmsnative.core.data_store.db.respository_new.VerificaGiacenzeRowRepository;
|
||||
import it.integry.integrywmsnative.core.exception.NoArtsFoundException;
|
||||
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
|
||||
import it.integry.integrywmsnative.core.mapper.VerificaGiacenzeMapper;
|
||||
import it.integry.integrywmsnative.core.mapper.VerificaGiacenzeRowMapper;
|
||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.GiacenzaPvRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.model.Ean13PesoModel;
|
||||
import it.integry.integrywmsnative.core.rest.model.pv.CloseVerificaRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.pv.DeleteRowVerificaRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.pv.GiacenzaPvDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.pv.SaveNewVerificaRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.pv.SaveNewRowVerificaRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.pv.UpdateRowVerificaRequestDTO;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityBigDecimal;
|
||||
import it.integry.integrywmsnative.gest.spedizione.model.PickedQuantityDTO;
|
||||
@@ -37,7 +42,7 @@ public class VerificaGiacenzeViewModel {
|
||||
|
||||
private final ExecutorService executorService;
|
||||
private final Handler handler;
|
||||
private final VerificaGiacenzeMapper verificaGiacenzeMapper;
|
||||
private final VerificaGiacenzeRowMapper verificaGiacenzeRowMapper;
|
||||
private final GiacenzaPvRESTConsumer giacenzaPvRESTConsumer;
|
||||
private final VerificaGiacenzeRepository verificaGiacenzeRepository;
|
||||
private final VerificaGiacenzeRowRepository verificaGiacenzeRowRepository;
|
||||
@@ -54,14 +59,14 @@ public class VerificaGiacenzeViewModel {
|
||||
@Inject
|
||||
public VerificaGiacenzeViewModel(ExecutorService executorService,
|
||||
Handler handler,
|
||||
VerificaGiacenzeMapper verificaGiacenzeMapper,
|
||||
VerificaGiacenzeRowMapper verificaGiacenzeRowMapper,
|
||||
GiacenzaPvRESTConsumer giacenzaPvRESTConsumer,
|
||||
VerificaGiacenzeRepository verificaGiacenzeRepository,
|
||||
VerificaGiacenzeRowRepository verificaGiacenzeRowRepository,
|
||||
ArticoloRESTConsumer articoloRESTConsumer) {
|
||||
this.executorService = executorService;
|
||||
this.handler = handler;
|
||||
this.verificaGiacenzeMapper = verificaGiacenzeMapper;
|
||||
this.verificaGiacenzeRowMapper = verificaGiacenzeRowMapper;
|
||||
this.giacenzaPvRESTConsumer = giacenzaPvRESTConsumer;
|
||||
this.verificaGiacenzeRepository = verificaGiacenzeRepository;
|
||||
this.verificaGiacenzeRowRepository = verificaGiacenzeRowRepository;
|
||||
@@ -116,7 +121,7 @@ public class VerificaGiacenzeViewModel {
|
||||
|
||||
public void randomizeElements(int elementsCount) {
|
||||
|
||||
for(int i = 0; i < elementsCount; i++) {
|
||||
for (int i = 0; i < elementsCount; i++) {
|
||||
var randomIndex = (int) (Math.random() * currentLoadedAnagrafiche.size());
|
||||
var randomAnagrafica = currentLoadedAnagrafiche.get(randomIndex);
|
||||
|
||||
@@ -166,19 +171,17 @@ public class VerificaGiacenzeViewModel {
|
||||
return entity;
|
||||
}
|
||||
|
||||
|
||||
public void save() throws Exception {
|
||||
if(currentVerificaRows.getValue().isEmpty()) {
|
||||
public void close() throws Exception {
|
||||
if (currentVerificaRows.getValue().isEmpty()) {
|
||||
delete();
|
||||
return;
|
||||
}
|
||||
|
||||
currentVerifica.getValue().setVerificaGiacenzeRowList(currentVerificaRows.getValue());
|
||||
CloseVerificaRequestDTO request = new CloseVerificaRequestDTO()
|
||||
.setCodMdep(Objects.requireNonNull(currentVerifica.getValue()).getCodMdep())
|
||||
.setDataVerifica(Objects.requireNonNull(currentVerifica.getValue()).getData());
|
||||
|
||||
SaveNewVerificaRequestDTO saveRequest = new SaveNewVerificaRequestDTO()
|
||||
.setData(verificaGiacenzeMapper.mapRoomToRest(currentVerifica.getValue()));
|
||||
|
||||
giacenzaPvRESTConsumer.saveNewVerificaSynchronized(saveRequest);
|
||||
giacenzaPvRESTConsumer.closeVerifica(request);
|
||||
|
||||
delete();
|
||||
}
|
||||
@@ -280,13 +283,37 @@ public class VerificaGiacenzeViewModel {
|
||||
}
|
||||
|
||||
public MtbAart searchAnagraficaByBarcode(String barcode) {
|
||||
return currentLoadedAnagrafiche.parallelStream()
|
||||
.filter(mtbAart -> barcode.equals(mtbAart.getBarCode()))
|
||||
MtbAart mtbAart = currentLoadedAnagrafiche.parallelStream()
|
||||
.filter(x -> barcode.equals(x.getBarCode()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
|
||||
if (mtbAart == null) {
|
||||
mtbAart = currentLoadedAnagrafiche.parallelStream()
|
||||
.filter(x -> x.getMtbAartBarCode() != null &&
|
||||
x.getMtbAartBarCode().stream()
|
||||
.anyMatch(y -> barcode.equals(y.getCodBarre())))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
return mtbAart;
|
||||
}
|
||||
|
||||
public void insertRow(VerificaGiacenzeRowEntity rowEntity) {
|
||||
this.sendOnLoadingStarted();
|
||||
|
||||
var saveRequest = new SaveNewRowVerificaRequestDTO()
|
||||
.setCodMdep(Objects.requireNonNull(currentVerifica.getValue()).getCodMdep())
|
||||
.setDataVerifica(Objects.requireNonNull(currentVerifica.getValue()).getData())
|
||||
.setRow(verificaGiacenzeRowMapper.mapRoomToRest(rowEntity));
|
||||
|
||||
try {
|
||||
giacenzaPvRESTConsumer.saveNewRowSynchronized(saveRequest);
|
||||
} catch (Exception e) {
|
||||
this.sendError(e);
|
||||
}
|
||||
|
||||
verificaGiacenzeRowRepository.insert(rowEntity, insertedData -> {
|
||||
handler.post(() -> {
|
||||
currentVerificaRows.getValue().add(insertedData);
|
||||
@@ -296,6 +323,19 @@ public class VerificaGiacenzeViewModel {
|
||||
}
|
||||
|
||||
public void updateRow(VerificaGiacenzeRowEntity rowEntity) {
|
||||
this.sendOnLoadingStarted();
|
||||
|
||||
var updateRequest = new UpdateRowVerificaRequestDTO()
|
||||
.setCodMdep(Objects.requireNonNull(currentVerifica.getValue()).getCodMdep())
|
||||
.setDataVerifica(Objects.requireNonNull(currentVerifica.getValue()).getData())
|
||||
.setRow(verificaGiacenzeRowMapper.mapRoomToRest(rowEntity));
|
||||
|
||||
try {
|
||||
giacenzaPvRESTConsumer.updateRowSynchronized(updateRequest);
|
||||
} catch (Exception e) {
|
||||
this.sendError(e);
|
||||
}
|
||||
|
||||
var indexInList = -1;
|
||||
|
||||
List<VerificaGiacenzeRowEntity> value = currentVerificaRows.getValue();
|
||||
@@ -318,6 +358,19 @@ public class VerificaGiacenzeViewModel {
|
||||
}
|
||||
|
||||
public void deleteRow(VerificaGiacenzeRowEntity rowEntity) {
|
||||
this.sendOnLoadingStarted();
|
||||
|
||||
var deleteRequest = new DeleteRowVerificaRequestDTO()
|
||||
.setCodMdep(Objects.requireNonNull(currentVerifica.getValue()).getCodMdep())
|
||||
.setDataVerifica(Objects.requireNonNull(currentVerifica.getValue()).getData())
|
||||
.setRow(verificaGiacenzeRowMapper.mapRoomToRest(rowEntity));
|
||||
|
||||
try {
|
||||
giacenzaPvRESTConsumer.deleteRowSynchronized(deleteRequest);
|
||||
} catch (Exception e) {
|
||||
this.sendError(e);
|
||||
}
|
||||
|
||||
verificaGiacenzeRowRepository.delete(rowEntity, () -> {
|
||||
|
||||
handler.post(() -> {
|
||||
@@ -330,6 +383,7 @@ public class VerificaGiacenzeViewModel {
|
||||
|
||||
private void notifyRowChanged() {
|
||||
currentVerificaRows.postValue(currentVerificaRows.getValue());
|
||||
this.sendOnLoadingEnded();
|
||||
}
|
||||
|
||||
private PickedQuantityDTO sendOnItemDispatched(MtbAart mtbAart,
|
||||
@@ -360,7 +414,15 @@ public class VerificaGiacenzeViewModel {
|
||||
this.listener.onError(ex);
|
||||
}
|
||||
|
||||
public interface Listener {
|
||||
private void sendOnLoadingStarted() {
|
||||
if (this.listener != null) listener.onLoadingStarted();
|
||||
}
|
||||
|
||||
private void sendOnLoadingEnded() {
|
||||
if (this.listener != null) listener.onLoadingEnded();
|
||||
}
|
||||
|
||||
public interface Listener extends ILoadingListener {
|
||||
PickedQuantityDTO onItemDispatched(MtbAart mtbAart,
|
||||
BigDecimal initialNumCnf,
|
||||
BigDecimal initialQtaCnf,
|
||||
|
||||
@@ -19,6 +19,8 @@ import androidx.sqlite.db.SimpleSQLiteQuery;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
import com.google.firebase.crashlytics.CustomKeysAndValues;
|
||||
import com.google.firebase.crashlytics.FirebaseCrashlytics;
|
||||
import com.harrysoft.androidbluetoothserial.BluetoothManager;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
@@ -31,7 +33,9 @@ import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.inject.Inject;
|
||||
@@ -256,78 +260,110 @@ public class MainSettingsFragment extends PreferenceFragmentCompat implements IT
|
||||
private void exportLog() {
|
||||
var handler = new Handler(Looper.getMainLooper());
|
||||
|
||||
DialogYesNoView.newInstance("Esportazione log", "Vuoi inviare il log degli eventi al supporto?", result -> {
|
||||
if (result == DialogConsts.Results.NO || result == DialogConsts.Results.ABORT)
|
||||
return;
|
||||
executorService.execute(() -> {
|
||||
|
||||
this.openProgress();
|
||||
if(!askConfirmToExportLog()) {
|
||||
return;
|
||||
}
|
||||
|
||||
executorService.execute(() -> {
|
||||
this.openProgress();
|
||||
|
||||
|
||||
File logFilePath = appContext.getLogFilePath();
|
||||
var files = logFilePath.listFiles();
|
||||
File logFilePath = appContext.getLogFilePath();
|
||||
var files = logFilePath.listFiles(File::isFile);
|
||||
|
||||
var fileToShare = Arrays.stream(files)
|
||||
.sorted(Comparator.reverseOrder())
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
try {
|
||||
List<MailAttachmentDTO> attachmentDTOList = new ArrayList<>();
|
||||
var fileToShare = Arrays.stream(files)
|
||||
.sorted(Comparator.reverseOrder())
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
try {
|
||||
List<MailAttachmentDTO> attachmentDTOList = new ArrayList<>();
|
||||
|
||||
if (fileToShare != null) {
|
||||
var htmlContent = createAppLogAttachment(fileToShare);
|
||||
if (fileToShare != null) {
|
||||
try {
|
||||
var htmlContent = createAppLogAttachment(fileToShare);
|
||||
|
||||
byte[] buffer = htmlContent.getBytes();//specify the size to allow.
|
||||
String base64 = Base64.encodeToString(buffer, Base64.NO_WRAP);
|
||||
byte[] buffer = htmlContent.getBytes();//specify the size to allow.
|
||||
String base64 = Base64.encodeToString(buffer, Base64.NO_WRAP);
|
||||
|
||||
var logAttachment = new MailAttachmentDTO()
|
||||
.setFileName("wms_log.html")
|
||||
.setFileb64Content(base64);
|
||||
attachmentDTOList.add(logAttachment);
|
||||
}
|
||||
var logAttachment = new MailAttachmentDTO()
|
||||
.setFileName("wms_log.html")
|
||||
.setFileb64Content(base64);
|
||||
attachmentDTOList.add(logAttachment);
|
||||
} catch (Exception ex) {
|
||||
String rawLogFile = getRawLogAttachment(fileToShare);
|
||||
|
||||
byte[] buffer = rawLogFile.getBytes();//specify the size to allow.
|
||||
String base64 = Base64.encodeToString(buffer, Base64.NO_WRAP);
|
||||
|
||||
var logAttachment = new MailAttachmentDTO()
|
||||
.setFileName("raw_log.txt")
|
||||
.setFileb64Content(base64);
|
||||
attachmentDTOList.add(logAttachment);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
rawDao.vacuumDb(new SimpleSQLiteQuery("pragma wal_checkpoint(full)"));
|
||||
File[] dbFiles = new File[3];
|
||||
dbFiles[0] = requireContext().getDatabasePath("integry_wms");
|
||||
dbFiles[1] = requireContext().getDatabasePath("integry_wms-shm");
|
||||
dbFiles[2] = requireContext().getDatabasePath("integry_wms-wal");
|
||||
rawDao.vacuumDb(new SimpleSQLiteQuery("pragma wal_checkpoint(full)"));
|
||||
rawDao.vacuumDb(new SimpleSQLiteQuery("VACUUM;"));
|
||||
File[] dbFiles = new File[3];
|
||||
dbFiles[0] = requireContext().getDatabasePath("integry_wms");
|
||||
dbFiles[1] = requireContext().getDatabasePath("integry_wms-shm");
|
||||
dbFiles[2] = requireContext().getDatabasePath("integry_wms-wal");
|
||||
|
||||
for (int i = 0; i < dbFiles.length; i++) {
|
||||
byte[] dbFileBytes = new byte[(int) dbFiles[i].length()];
|
||||
FileInputStream inputStream = new FileInputStream(dbFiles[i]);
|
||||
final int read = inputStream.read(dbFileBytes);
|
||||
inputStream.close();
|
||||
for (int i = 0; i < dbFiles.length; i++) {
|
||||
byte[] dbFileBytes = new byte[(int) dbFiles[i].length()];
|
||||
FileInputStream inputStream = new FileInputStream(dbFiles[i]);
|
||||
final int read = inputStream.read(dbFileBytes);
|
||||
inputStream.close();
|
||||
|
||||
var dbAttachment = new MailAttachmentDTO()
|
||||
.setFileName(dbFiles[i].getName())
|
||||
.setFileb64Content(Base64.encodeToString(dbFileBytes, Base64.NO_WRAP));
|
||||
attachmentDTOList.add(dbAttachment);
|
||||
}
|
||||
var dbAttachment = new MailAttachmentDTO()
|
||||
.setFileName(dbFiles[i].getName())
|
||||
.setFileb64Content(Base64.encodeToString(dbFileBytes, Base64.NO_WRAP));
|
||||
attachmentDTOList.add(dbAttachment);
|
||||
}
|
||||
|
||||
var mailRequest = new MailRequestDTO()
|
||||
.setTo("developer@integry.it")
|
||||
.setMsgText("Questa è una mail contenente il log del WMS")
|
||||
.setSubject("Internal WMS log")
|
||||
.setAttachments(attachmentDTOList);
|
||||
var mailRequest = new MailRequestDTO()
|
||||
.setTo("developer@integry.it")
|
||||
.setMsgText("Questa è una mail contenente il log del WMS")
|
||||
.setSubject("Internal WMS log")
|
||||
.setAttachments(attachmentDTOList);
|
||||
|
||||
|
||||
systemRESTConsumer.sendMailSynchronized(mailRequest);
|
||||
systemRESTConsumer.sendMailSynchronized(mailRequest);
|
||||
|
||||
this.closeProgress();
|
||||
} catch (Exception ex) {
|
||||
handler.post(() -> {
|
||||
this.closeProgress();
|
||||
UtilityExceptions.defaultException(requireContext(), ex);
|
||||
});
|
||||
}
|
||||
});
|
||||
})
|
||||
.show(getParentFragmentManager(), "tag");
|
||||
this.closeProgress();
|
||||
} catch (Exception ex) {
|
||||
handler.post(() -> {
|
||||
FirebaseCrashlytics.getInstance().recordException(ex, new CustomKeysAndValues.Builder() {{
|
||||
putString("ExportLog", "Error while exporting log");
|
||||
}}.build());
|
||||
this.closeProgress();
|
||||
UtilityExceptions.defaultException(requireContext(), ex);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private boolean askConfirmToExportLog() {
|
||||
CountDownLatch countDownLatch = new CountDownLatch(1);
|
||||
AtomicBoolean userConfirmed = new AtomicBoolean(false);
|
||||
|
||||
DialogYesNoView.newInstance("Esportazione log", "Vuoi inviare il log degli eventi al supporto?", result -> {
|
||||
userConfirmed.set(result != DialogConsts.Results.NO && result != DialogConsts.Results.ABORT);
|
||||
countDownLatch.countDown();
|
||||
}).show(getParentFragmentManager(), "tag");
|
||||
|
||||
try {
|
||||
countDownLatch.await();
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
return userConfirmed.get();
|
||||
}
|
||||
|
||||
private void openProgress() {
|
||||
// executorService.execute(() -> {
|
||||
this.mCurrentProgress.show(requireActivity().getSupportFragmentManager());
|
||||
@@ -437,4 +473,24 @@ public class MainSettingsFragment extends PreferenceFragmentCompat implements IT
|
||||
|
||||
return htmlContent.toString();
|
||||
}
|
||||
|
||||
private String getRawLogAttachment(File logFile) {
|
||||
//Read text from file
|
||||
StringBuilder text = new StringBuilder();
|
||||
|
||||
try {
|
||||
BufferedReader br = new BufferedReader(new FileReader(logFile));
|
||||
String line;
|
||||
|
||||
while ((line = br.readLine()) != null) {
|
||||
text.append(line);
|
||||
text.append('\n');
|
||||
}
|
||||
br.close();
|
||||
} catch (IOException e) {
|
||||
//You'll need to add proper error handling here
|
||||
}
|
||||
|
||||
return text.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
@@ -50,8 +51,10 @@ import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
||||
import it.integry.integrywmsnative.core.model.MtbPartitaMag;
|
||||
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;
|
||||
import it.integry.integrywmsnative.core.rest.model.OrdineUscitaInevasoDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.SitArtOrdDTO;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
@@ -120,7 +123,7 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
||||
|
||||
private ArrayList<SitArtOrdDTO> mSitArtOrd;
|
||||
private ArrayList<OrdineUscitaInevasoDTO> mTestateOrdini;
|
||||
private ArrayList<MtbColt> mColliRegistrati;
|
||||
private ArrayList<AlreadyRegisteredUlDTO> mColliRegistrati;
|
||||
private GestioneEnum mGestioneCol;
|
||||
private int mSegnoCol;
|
||||
private Integer mDefaultCausaleUL;
|
||||
@@ -135,7 +138,6 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
||||
public static void startActivity(Context context,
|
||||
List<SitArtOrdDTO> ordini,
|
||||
List<OrdineUscitaInevasoDTO> selectedOrders,
|
||||
List<MtbColt> mtbColtList,
|
||||
GestioneEnum gestioneCol,
|
||||
int segnoCol,
|
||||
Integer defaultCausaleUL,
|
||||
@@ -149,9 +151,6 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
||||
String keyTestateOrdini = DataCache.addItem(selectedOrders);
|
||||
myIntent.putExtra("keyTestateOrdini", keyTestateOrdini);
|
||||
|
||||
String keyColliRegistrati = DataCache.addItem(mtbColtList);
|
||||
myIntent.putExtra("keyColliRegistrati", keyColliRegistrati);
|
||||
|
||||
String keyGestioneCol = DataCache.addItem(gestioneCol);
|
||||
myIntent.putExtra("keyGestioneCol", keyGestioneCol);
|
||||
|
||||
@@ -176,7 +175,6 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
||||
|
||||
mSitArtOrd = DataCache.retrieveItem(getIntent().getStringExtra("keyPickingList"));
|
||||
mTestateOrdini = DataCache.retrieveItem(getIntent().getStringExtra("keyTestateOrdini"));
|
||||
mColliRegistrati = DataCache.retrieveItem(getIntent().getStringExtra("keyColliRegistrati"));
|
||||
mGestioneCol = DataCache.retrieveItem(getIntent().getStringExtra("keyGestioneCol"));
|
||||
mSegnoCol = DataCache.retrieveItem(getIntent().getStringExtra("keySegnoCol"));
|
||||
mDefaultCausaleUL = DataCache.retrieveItem(getIntent().getStringExtra("keyDefaultCausaleCol"));
|
||||
@@ -229,7 +227,6 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
||||
canOverflowOrderQuantity,
|
||||
mSitArtOrd,
|
||||
mTestateOrdini,
|
||||
mColliRegistrati,
|
||||
mGestioneCol, mSegnoCol, mDefaultCausaleUL,
|
||||
mEnableQuantityReset,
|
||||
useQtaOrd,
|
||||
@@ -742,12 +739,12 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
||||
public void addExtraItem() {
|
||||
handler.post(() -> {
|
||||
DialogScanArtView
|
||||
.newInstance(!mEnableFakeGiacenza, (status, mtbAart, ean128Model, mtbColr) -> {
|
||||
.newInstance(!mEnableFakeGiacenza, (status, mtbAart, ean128Model, mtbColt) -> {
|
||||
if (status == DialogConsts.Results.YES) {
|
||||
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
this.mViewmodel.dispatchExtraItem(mtbAart, ean128Model, mtbColr);
|
||||
this.mViewmodel.dispatchExtraItem(mtbAart, ean128Model, mtbColt);
|
||||
} catch (Exception e) {
|
||||
onError(e);
|
||||
}
|
||||
@@ -822,25 +819,45 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
||||
}
|
||||
|
||||
public void showCreatedUL() {
|
||||
handler.post(() -> {
|
||||
this.fabPopupMenu.dismiss();
|
||||
this.fabPopupMenu.dismiss();
|
||||
|
||||
ArrayList<MtbColt> createdMtbColts = this.mViewmodel.getCreatedMtbColts();
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
ArrayList<AlreadyRegisteredUlDTO> createdMtbColts = this.mViewmodel.getCreatedMtbColts();
|
||||
|
||||
Intent myIntent = ListaBancaliActivity.createIntent(this, createdMtbColts, true, false);
|
||||
this.startActivityForResult(myIntent, PICK_UL_REQUEST);
|
||||
handler.post(() -> {
|
||||
Intent myIntent = ListaBancaliActivity.createIntent(this,
|
||||
|
||||
createdMtbColts.stream()
|
||||
.map(AlreadyRegisteredUlDTO::getMtbColt)
|
||||
.collect(Collectors.toList()),
|
||||
|
||||
input -> createdMtbColts.stream()
|
||||
.filter(x -> x.getMtbColt().equals(input))
|
||||
.findFirst()
|
||||
.map(AlreadyRegisteredUlDTO::isCanBeRecovered)
|
||||
.orElse(false),
|
||||
|
||||
false,
|
||||
|
||||
ReportManager.getReportNameLUFromGestione(GestioneEnum.ACQUISTO));
|
||||
|
||||
|
||||
this.startActivityForResult(myIntent, PICK_UL_REQUEST);
|
||||
});
|
||||
} catch (Exception e) {
|
||||
onError(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public void closeOrder() {
|
||||
this.fabPopupMenu.dismiss();
|
||||
this.onLoadingStarted();
|
||||
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
this.mViewmodel.closeOrder();
|
||||
this.onLoadingEnded();
|
||||
} catch (Exception e) {
|
||||
onError(e);
|
||||
}
|
||||
|
||||
@@ -50,6 +50,7 @@ import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
||||
import it.integry.integrywmsnative.core.model.MtbPartitaMag;
|
||||
import it.integry.integrywmsnative.core.model.VtbVett;
|
||||
import it.integry.integrywmsnative.core.model.dto.AlreadyRegisteredUlDTO;
|
||||
import it.integry.integrywmsnative.core.model.dto.PickDataDTO;
|
||||
import it.integry.integrywmsnative.core.model.dto.StatoArticoloDTO;
|
||||
import it.integry.integrywmsnative.core.model.observable.ObservableMtbTcol;
|
||||
@@ -107,7 +108,6 @@ public class SpedizioneViewModel {
|
||||
|
||||
private List<OrdineUscitaInevasoDTO> mTestateOrdini;
|
||||
private MutableLiveData<List<PickingObjectDTO>> mPickingList = new MutableLiveData<>();
|
||||
private List<MtbColt> mColliRegistrati = new ArrayList<>();
|
||||
private List<MtbPartitaMag> mPartitaMagList = new ArrayList<>();
|
||||
|
||||
private Listener mListener;
|
||||
@@ -187,12 +187,11 @@ public class SpedizioneViewModel {
|
||||
}
|
||||
|
||||
|
||||
public void init(String codMdep, boolean enableGiacenza, boolean enableCheckPartitaMag, boolean shouldAskPesoLU, boolean canOverflowOrderQuantity, List<SitArtOrdDTO> pickingList, List<OrdineUscitaInevasoDTO> testateOrdini, List<MtbColt> colliRegistrati, GestioneEnum gestioneCol, int segnoCol, Integer defaultCausaleUL, boolean enableQuantityReset, boolean useQtaOrd, boolean useColliPedana) {
|
||||
public void init(String codMdep, boolean enableGiacenza, boolean enableCheckPartitaMag, boolean shouldAskPesoLU, boolean canOverflowOrderQuantity, List<SitArtOrdDTO> pickingList, List<OrdineUscitaInevasoDTO> testateOrdini, GestioneEnum gestioneCol, int segnoCol, Integer defaultCausaleUL, boolean enableQuantityReset, boolean useQtaOrd, boolean useColliPedana) {
|
||||
this.sendOnLoadingStarted();
|
||||
|
||||
this.mDefaultCodMdep = codMdep;
|
||||
this.mTestateOrdini = testateOrdini;
|
||||
this.mColliRegistrati = colliRegistrati;
|
||||
this.mEnableGiacenza = enableGiacenza;
|
||||
this.mEnableCheckPartitaMag = enableCheckPartitaMag;
|
||||
this.mCanOverflowOrderQuantity = canOverflowOrderQuantity;
|
||||
@@ -342,14 +341,6 @@ public class SpedizioneViewModel {
|
||||
return mIsOrdTrasf;
|
||||
}
|
||||
|
||||
private void onOrderClosedPrintingDone() {
|
||||
if (this.mIsOrdTrasf && !UtilityString.isNullOrEmpty(SettingsManager.iDB().getCodDtipOrdTrasfV())) {
|
||||
this.sendCreateDocsRequest();
|
||||
} else {
|
||||
this.sendOnOrderClosed();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void sendOnLoadingStarted() {
|
||||
if (this.mListener != null) mListener.onLoadingStarted();
|
||||
@@ -1024,7 +1015,7 @@ public class SpedizioneViewModel {
|
||||
if (availableBatchLots.stream().anyMatch(x -> x.getDataScad() == null)) {
|
||||
tmp.addAll(availableBatchLots.stream()
|
||||
.filter(x -> x.getDataScad() == null)
|
||||
.sorted(Comparator.comparing(x -> UtilityString.isNull(x.getPartitaMag(), "")))
|
||||
.sorted(Comparator.comparing(x -> x.getPartitaMag() == null ? "" : x.getPartitaMag()))
|
||||
.collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
@@ -1233,7 +1224,7 @@ public class SpedizioneViewModel {
|
||||
return !stati.isEmpty() ? stati.get(0) : null;
|
||||
}
|
||||
|
||||
public void dispatchExtraItem(MtbAart mtbAart, Ean128Model ean128Model, MtbColr mtbColrToUse) throws Exception {
|
||||
public void dispatchExtraItem(MtbAart mtbAart, Ean128Model ean128Model, MtbColt refMtbColt) throws Exception {
|
||||
|
||||
PickingObjectDTO pickingObjectDTO = new PickingObjectDTO().setMtbAart(mtbAart).setTempPickData(PickDataDTO.fromEan128(ean128Model));
|
||||
|
||||
@@ -1252,12 +1243,23 @@ public class SpedizioneViewModel {
|
||||
String partitaMag = null;
|
||||
LocalDate dataScad = null;
|
||||
|
||||
MtbColt refMtbColt = null;
|
||||
// MtbColt refMtbColt = null;
|
||||
|
||||
if (mtbColrToUse != null) {
|
||||
refMtbColt = new MtbColt().setDataCollo(mtbColrToUse.getDataColloD()).setSerCollo(mtbColrToUse.getSerCollo()).setNumCollo(mtbColrToUse.getNumCollo()).setGestione(mtbColrToUse.getGestione()).setMtbColr(new ObservableArrayList<>());
|
||||
if (refMtbColt != null && refMtbColt.getMtbColr() != null && !refMtbColt.getMtbColr().isEmpty()) {
|
||||
MtbColr mtbColrToUse = refMtbColt.getMtbColr().get(0);
|
||||
|
||||
refMtbColt.getMtbColr().add(mtbColrToUse);
|
||||
//Se il collo di riferimento non ha righe, lo creo al volo
|
||||
// refMtbColt = new MtbColt()
|
||||
// .setDataCollo(mtbColrToUse.getDataColloD())
|
||||
// .setSerCollo(mtbColrToUse.getSerCollo())
|
||||
// .setNumCollo(mtbColrToUse.getNumCollo())
|
||||
// .setGestione(mtbColrToUse.getGestione())
|
||||
//// .setCodMdep(mtbColrToUse.getCodMdepIn())
|
||||
//// .setPosizione(mtbColrToUse.getPosizioneIn())
|
||||
//// .setBarcodeUl(mtbColrToUse.getBarcodeUlIn())
|
||||
// .setMtbColr(new ObservableArrayList<>());
|
||||
//
|
||||
// refMtbColt.getMtbColr().add(mtbColrToUse);
|
||||
|
||||
pickingObjectDTO.setMtbAart(mtbColrToUse.getMtbAart()).setTempPickData(new PickDataDTO().setSourceMtbColt(refMtbColt));
|
||||
|
||||
@@ -1530,9 +1532,6 @@ public class SpedizioneViewModel {
|
||||
.setMtbAart(null);
|
||||
}
|
||||
|
||||
var clonedTargetMtbColt = (MtbColt) mCurrentMtbColt.clone();
|
||||
clonedTargetMtbColt.setMtbColr(null);
|
||||
|
||||
var insertUDSRowRequestDto = new InsertUDSRowRequestDTO()
|
||||
.setSourceMtbColr(clonedSourceMtbColr)
|
||||
.setCodMart(pickingObjectDTO.getMtbAart().getCodMart())
|
||||
@@ -1540,7 +1539,7 @@ public class SpedizioneViewModel {
|
||||
.setQtaCnf(qtaCnf)
|
||||
.setNumCnf(numCnf)
|
||||
.setPartitaMag(partitaMag)
|
||||
.setTargetMtbColt(clonedTargetMtbColt);
|
||||
.setTargetMtbColt(mCurrentMtbColt.clone(false));
|
||||
|
||||
if (dataScad != null)
|
||||
insertUDSRowRequestDto
|
||||
@@ -1555,6 +1554,7 @@ public class SpedizioneViewModel {
|
||||
createdMtbColr = this.mColliScaricoRESTConsumer.insertUDSRowSynchronized(insertUDSRowRequestDto);
|
||||
} catch (Exception ex) {
|
||||
this.sendError(ex);
|
||||
return;
|
||||
}
|
||||
|
||||
pickingObjectDTO.getWithdrawMtbColrs().add(createdMtbColr);
|
||||
@@ -1745,13 +1745,8 @@ public class SpedizioneViewModel {
|
||||
|
||||
var positionedMtbColts = this.askPositionChange(filledMtbColts);
|
||||
|
||||
|
||||
this.askPrint((shouldPrint && SettingsManager.iDB().isFlagPrintEtichetteOnLUClose()), positionedMtbColts);
|
||||
|
||||
positionedMtbColts.stream()
|
||||
.filter(x -> !this.mColliRegistrati.contains(x))
|
||||
.forEach(x -> this.mColliRegistrati.add(x));
|
||||
|
||||
postCloseOperations(positionedMtbColts);
|
||||
|
||||
this.mIsNewLU = false;
|
||||
@@ -2129,15 +2124,21 @@ public class SpedizioneViewModel {
|
||||
}
|
||||
|
||||
public void closeOrder() {
|
||||
|
||||
if (SettingsManager.iDB().isFlagPrintEtichetteOnOrderClose() || SettingsManager.iDB().isFlagPrintPackingListOnOrderClose()) {
|
||||
var printRequestResult = this.sendOnCloseOrderPrintRequest();
|
||||
this.onCloseOrderPrintRequest(printRequestResult);
|
||||
|
||||
this.sendOnLoadingStarted();
|
||||
this.onCloseOrderPrintRequested(printRequestResult);
|
||||
this.sendOnLoadingEnded();
|
||||
}
|
||||
|
||||
this.onOrderClosedPrintingDone();
|
||||
if (this.mIsOrdTrasf && !UtilityString.isNullOrEmpty(SettingsManager.iDB().getCodDtipOrdTrasfV())) {
|
||||
this.sendCreateDocsRequest();
|
||||
}
|
||||
}
|
||||
|
||||
private void onCloseOrderPrintRequest(PrintOrderCloseDTO dto) {
|
||||
private void onCloseOrderPrintRequested(PrintOrderCloseDTO dto) {
|
||||
if (!dto.isFlagPrintPackingList() && !dto.isFlagPrintSSCC()) {
|
||||
return;
|
||||
}
|
||||
@@ -2153,13 +2154,22 @@ public class SpedizioneViewModel {
|
||||
|
||||
dto.setPrintList(closedOrders);
|
||||
|
||||
CountDownLatch latch = new CountDownLatch(1);
|
||||
|
||||
try {
|
||||
printClosedOrders(dto);
|
||||
latch.countDown();
|
||||
} catch (Exception e) {
|
||||
this.sendLUPrintError(e, () -> {
|
||||
latch.countDown();
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
latch.await();
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private void printClosedOrders(PrintOrderCloseDTO dto) throws Exception {
|
||||
@@ -2192,8 +2202,8 @@ public class SpedizioneViewModel {
|
||||
return mPartitaMagList;
|
||||
}
|
||||
|
||||
public ArrayList<MtbColt> getCreatedMtbColts() {
|
||||
return (ArrayList<MtbColt>) this.mColliRegistrati;
|
||||
public ArrayList<AlreadyRegisteredUlDTO> getCreatedMtbColts() throws Exception {
|
||||
return (ArrayList<AlreadyRegisteredUlDTO>) this.mOrdiniRestConsumerService.getBancaliGiaRegistratiSynchronized(mTestateOrdini, mDefaultSegnoCol);
|
||||
}
|
||||
|
||||
public VtbVett getDefaultVettore() {
|
||||
@@ -2201,30 +2211,51 @@ public class SpedizioneViewModel {
|
||||
}
|
||||
|
||||
void createDocs() {
|
||||
var loadCollidto = new LoadColliDTO();
|
||||
executorService.execute(() -> {
|
||||
this.sendOnLoadingStarted();
|
||||
List<MtbColt> registeredUds = null;
|
||||
|
||||
var codAnag = mTestateOrdini.stream()
|
||||
.map(OrdineUscitaInevasoDTO::getCodAnagOrd)
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.findFirst()
|
||||
.get();
|
||||
try {
|
||||
var alreadyCreatedUds = getCreatedMtbColts();
|
||||
registeredUds = alreadyCreatedUds.stream()
|
||||
.map(AlreadyRegisteredUlDTO::getMtbColt)
|
||||
.collect(Collectors.toList());
|
||||
} catch (Exception e) {
|
||||
sendError(e);
|
||||
return;
|
||||
}
|
||||
|
||||
var codVdes = mTestateOrdini.stream().map(OrdineUscitaInevasoDTO::getCodVdes)
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.findFirst()
|
||||
.get();
|
||||
var loadCollidto = new LoadColliDTO();
|
||||
|
||||
loadCollidto.setColli(getCreatedMtbColts());
|
||||
loadCollidto.setCodDtip(SettingsManager.iDB().getCodDtipOrdTrasfV());
|
||||
loadCollidto.setCodMdep(mDefaultCodMdep);
|
||||
loadCollidto.setCodAnag(codAnag);
|
||||
loadCollidto.setCodVdes(codVdes);
|
||||
loadCollidto.setSaveDoc(true);
|
||||
loadCollidto.setGestione("L");
|
||||
var codAnag = mTestateOrdini.stream()
|
||||
.map(OrdineUscitaInevasoDTO::getCodAnagOrd)
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.findFirst()
|
||||
.get();
|
||||
|
||||
this.mDocumentRESTConsumer.createDocFromColli(loadCollidto, doc -> this.sendOnOrderClosed(), this::sendError);
|
||||
var codVdes = mTestateOrdini.stream()
|
||||
.map(OrdineUscitaInevasoDTO::getCodVdes)
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.findFirst()
|
||||
.get();
|
||||
|
||||
loadCollidto.setColli(registeredUds);
|
||||
loadCollidto.setCodDtip(SettingsManager.iDB().getCodDtipOrdTrasfV());
|
||||
loadCollidto.setCodMdep(mDefaultCodMdep);
|
||||
loadCollidto.setCodAnag(codAnag);
|
||||
loadCollidto.setCodVdes(codVdes);
|
||||
loadCollidto.setSaveDoc(true);
|
||||
loadCollidto.setGestione("L");
|
||||
|
||||
try {
|
||||
this.mDocumentRESTConsumer.makeSynchronousCreateDocFromColliRequest(loadCollidto);
|
||||
} catch (Exception e) {
|
||||
sendError(e);
|
||||
}
|
||||
this.sendOnLoadingEnded();
|
||||
});
|
||||
}
|
||||
|
||||
private Integer sendInputDuplicate() {
|
||||
|
||||
@@ -30,6 +30,7 @@ import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityNumber;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityResources;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
import it.integry.integrywmsnative.databinding.SpedizioneMainListGroupHeaderBinding;
|
||||
import it.integry.integrywmsnative.databinding.SpedizioneMainListGroupItemBinding;
|
||||
@@ -123,9 +124,9 @@ public class SpedizioneListAdapter extends SectionedRecyclerViewAdapter<Spedizio
|
||||
} else if (pickingObjectDTO.getQtaEvasa().floatValue() > 0) {
|
||||
holder.mBinding.getRoot().setBackgroundColor(mContext.getResources().getColor(R.color.orange_600_with_alpha));
|
||||
} else if (position % 2 == 1) {
|
||||
holder.mBinding.getRoot().setBackgroundColor(Color.WHITE);
|
||||
holder.mBinding.getRoot().setBackgroundColor(0);
|
||||
} else {
|
||||
holder.mBinding.getRoot().setBackgroundColor(mContext.getResources().getColor(R.color.letturaFacilitataBG));
|
||||
holder.mBinding.getRoot().setBackgroundColor(UtilityResources.getColorResourceFromAttr(mContext, R.attr.colorLetturaFacilitataSurface));
|
||||
}
|
||||
|
||||
holder.mBinding.deactivatedOverBg.setVisibility(!pickingObjectDTO.isActive() ? View.VISIBLE : View.GONE);
|
||||
@@ -135,8 +136,10 @@ public class SpedizioneListAdapter extends SectionedRecyclerViewAdapter<Spedizio
|
||||
holder.mBinding.qtaEvasa.setTextColor(ResourcesCompat.getColor(mContext.getResources(), !pickingObjectDTO.isActive() ? R.color.gray_600 : R.color.green_700, null));
|
||||
|
||||
holder.mBinding.descrizione.setText(pickingObjectDTO.getDescrizione());
|
||||
holder.mBinding.descrizione.setTextColor(pickingObjectDTO.isDescrizionePresente() ? Color.BLACK : Color.GRAY);
|
||||
|
||||
if(pickingObjectDTO.isDescrizionePresente())
|
||||
holder.mBinding.descrizione.setTextColor(UtilityResources.getColorResourceFromAttr(mContext, android.R.attr.colorForeground));
|
||||
else
|
||||
holder.mBinding.descrizione.setTextColor(Color.GRAY);
|
||||
|
||||
holder.mBinding.badge1.setText(pickingObjectDTO.getBadge1());
|
||||
holder.mBinding.badge2.setText(pickingObjectDTO.getBadge2());
|
||||
|
||||
@@ -91,7 +91,7 @@ public class BottomSheetFragmentLUContentListAdapter extends RecyclerView.Adapte
|
||||
holder.mViewDataBinding.executePendingBindings();
|
||||
|
||||
if (position % 2 == 1)
|
||||
holder.mViewDataBinding.getRoot().setBackgroundColor(mContext.getResources().getColor(R.color.letturaFacilitataBG));
|
||||
holder.mViewDataBinding.getRoot().setBackgroundColor(mContext.getResources().getColor(R.color.letturaFacilitataBGLight));
|
||||
|
||||
holder.mViewDataBinding.getRoot().setOnClickListener(new OnSingleClickListener() {
|
||||
@Override
|
||||
|
||||
@@ -44,7 +44,7 @@ public class BottomSheetFragmentLUContentViewModel {
|
||||
if (collo == null) return;
|
||||
|
||||
ObservableMtbTcol tipoPedana = collo.getMtbTCol();
|
||||
BigDecimal taraPedana = tipoPedana != null ? tipoPedana.getTaraKg() : BigDecimal.ZERO;
|
||||
BigDecimal taraPedana = tipoPedana != null && tipoPedana.getTaraKg() != null ? tipoPedana.getTaraKg() : BigDecimal.ZERO;
|
||||
BigDecimal pesoNetto = BigDecimal.ZERO;
|
||||
|
||||
for (MtbColr mtbColr : collo.getMtbColr()) {
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.content.DialogInterface;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -63,6 +64,9 @@ public class DialogAskClienteView extends BaseDialogFragment {
|
||||
@Inject
|
||||
DialogProgressView dialogProgressView;
|
||||
|
||||
@Inject
|
||||
Handler handler;
|
||||
|
||||
public static DialogAskClienteView newInstance(@NotNull RunnableArgss<VtbDest, String> onComplete, @NotNull Runnable onAbort) {
|
||||
return new DialogAskClienteView(onComplete, onAbort);
|
||||
}
|
||||
@@ -119,6 +123,8 @@ public class DialogAskClienteView extends BaseDialogFragment {
|
||||
DialogAskCliente_Page1ViewModel viewModel1 = (DialogAskCliente_Page1ViewModel) mAdapter.getViewModel(R.layout.dialog_ask_cliente__page1);
|
||||
DialogAskCliente_Page2ViewModel viewModel2 = (DialogAskCliente_Page2ViewModel) mAdapter.getViewModel(R.layout.dialog_ask_cliente__page2);
|
||||
|
||||
viewModel1.setHandler(handler);
|
||||
|
||||
viewModel1.setOnConfirmClickListener(() -> {
|
||||
String codAnag = viewModel1.getCurrentCliente();
|
||||
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.ask_cliente.dto;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class DialogAskClienteClienteDTO {
|
||||
|
||||
@SerializedName("codAnag")
|
||||
private String codAnag;
|
||||
|
||||
@SerializedName("ragSoc")
|
||||
private String ragSoc;
|
||||
@SerializedName("codJcoms")
|
||||
private ArrayList<String> codJcoms = new ArrayList<>();
|
||||
|
||||
public String getCodAnag() {
|
||||
|
||||
@@ -1,23 +1,34 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.ask_cliente.dto;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.VtbDest;
|
||||
|
||||
public class DialogAskClienteDestinatarioDTO {
|
||||
|
||||
|
||||
@SerializedName("codAnag")
|
||||
private String codAnag;
|
||||
|
||||
@SerializedName("codVdes")
|
||||
private String codVdes;
|
||||
|
||||
@SerializedName("destinatario")
|
||||
private String destinatario;
|
||||
|
||||
@SerializedName("indirizzo")
|
||||
private String indirizzo;
|
||||
|
||||
@SerializedName("cap")
|
||||
private String cap;
|
||||
|
||||
@SerializedName("citta")
|
||||
private String citta;
|
||||
|
||||
@SerializedName("prov")
|
||||
private String prov;
|
||||
|
||||
@SerializedName("nazione")
|
||||
private String nazione;
|
||||
|
||||
public String getCodAnag() {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.ask_cliente.viewmodel;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.widget.AutoCompleteTextView;
|
||||
|
||||
import androidx.databinding.ObservableArrayList;
|
||||
@@ -37,9 +38,15 @@ public class DialogAskCliente_Page1ViewModel implements IDialogAskClienteViewMod
|
||||
private Runnable onConfirmClickListener;
|
||||
private Runnable onAbortClickListener;
|
||||
|
||||
private Handler handler;
|
||||
|
||||
public DialogAskCliente_Page1ViewModel() {
|
||||
}
|
||||
|
||||
public void setHandler(Handler handler){
|
||||
this.handler = handler;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setContext(Context context) {
|
||||
this.mContext = context;
|
||||
@@ -147,33 +154,33 @@ public class DialogAskCliente_Page1ViewModel implements IDialogAskClienteViewMod
|
||||
|
||||
|
||||
private void initializeAdapter(ArrayList<DialogAskClienteClienteDTO> items) {
|
||||
handler.post(() -> {
|
||||
var orderedList = Stream.of(items)
|
||||
.sortBy(x -> x.getRagSoc() != null ? x.getRagSoc() : "")
|
||||
.toList();
|
||||
|
||||
var orderedList = Stream.of(items)
|
||||
.sortBy(x -> x.getRagSoc() != null ? x.getRagSoc() : "")
|
||||
.toList();
|
||||
DialogAskCliente_Page1_Cliente_ArrayAdapter adapter = new DialogAskCliente_Page1_Cliente_ArrayAdapter(mContext, orderedList);
|
||||
|
||||
DialogAskCliente_Page1_Cliente_ArrayAdapter adapter = new DialogAskCliente_Page1_Cliente_ArrayAdapter(mContext, orderedList);
|
||||
AutoCompleteTextView editTextDropdownCliente = mBinding.dropdownCliente;
|
||||
editTextDropdownCliente.setThreshold(0);
|
||||
editTextDropdownCliente.setAdapter(adapter);
|
||||
editTextDropdownCliente.setOnItemClickListener((parent, view, position, id) -> {
|
||||
refreshCodJcoms(items.get(position));
|
||||
});
|
||||
|
||||
AutoCompleteTextView editTextDropdownCliente = mBinding.dropdownCliente;
|
||||
editTextDropdownCliente.setThreshold(0);
|
||||
editTextDropdownCliente.setAdapter(adapter);
|
||||
editTextDropdownCliente.setOnItemClickListener((parent, view, position, id) -> {
|
||||
refreshCodJcoms(items.get(position));
|
||||
});
|
||||
DialogAskCliente_Page1_Commessa_ArrayAdapter commessaAdapter = new DialogAskCliente_Page1_Commessa_ArrayAdapter(mContext);
|
||||
|
||||
AutoCompleteTextView editTextDropdownCommessa = mBinding.dropdownCommessa;
|
||||
editTextDropdownCommessa.setThreshold(0);
|
||||
editTextDropdownCommessa.setAdapter(commessaAdapter);
|
||||
|
||||
DialogAskCliente_Page1_Commessa_ArrayAdapter commessaAdapter = new DialogAskCliente_Page1_Commessa_ArrayAdapter(mContext);
|
||||
|
||||
AutoCompleteTextView editTextDropdownCommessa = mBinding.dropdownCommessa;
|
||||
editTextDropdownCommessa.setThreshold(0);
|
||||
editTextDropdownCommessa.setAdapter(commessaAdapter);
|
||||
|
||||
codJcoms.addOnListChangedCallback(new OnListGeneralChangedCallback() {
|
||||
@Override
|
||||
public void onChanged(ObservableList sender) {
|
||||
commessaAdapter.clear();
|
||||
commessaAdapter.addAll(codJcoms);
|
||||
}
|
||||
codJcoms.addOnListChangedCallback(new OnListGeneralChangedCallback() {
|
||||
@Override
|
||||
public void onChanged(ObservableList sender) {
|
||||
commessaAdapter.clear();
|
||||
commessaAdapter.addAll(codJcoms);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -148,7 +148,7 @@ public class DialogSimpleMessageView extends BaseDialogFragment {
|
||||
}
|
||||
case WARNING -> {
|
||||
colorBackgroundTitle = ContextCompat.getColor(requireContext(), R.color.yellow_600);
|
||||
yield ResourcesCompat.getDrawable(requireContext().getResources(), R.drawable.ic_warning_white_24dp, null);
|
||||
yield ResourcesCompat.getDrawable(requireContext().getResources(), R.drawable.ic_baseline_warning_24, null);
|
||||
}
|
||||
case ERROR -> {
|
||||
colorBackgroundTitle = ContextCompat.getColor(requireContext(), R.color.red_300);
|
||||
|
||||
@@ -92,7 +92,7 @@ public class DialogChooseArtFromListaArtsView extends BaseDialogFragment {
|
||||
|
||||
@Override
|
||||
public void onDismiss(@NonNull DialogInterface dialog) {
|
||||
dismiss();
|
||||
//dismiss();
|
||||
}
|
||||
|
||||
public void dismiss(MtbAart item) {
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.device_end_of_life;
|
||||
|
||||
import dagger.Subcomponent;
|
||||
|
||||
@Subcomponent
|
||||
public interface DialogDeviceEndOfLifeComponent {
|
||||
|
||||
@Subcomponent.Factory
|
||||
interface Factory {
|
||||
DialogDeviceEndOfLifeComponent create();
|
||||
}
|
||||
|
||||
void inject(DialogDeviceEndOfLifeView dialogDeviceEndOfLifeView);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.device_end_of_life;
|
||||
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
|
||||
@Module(subcomponents = DialogDeviceEndOfLifeComponent.class)
|
||||
public class DialogDeviceEndOfLifeModule {
|
||||
|
||||
@Provides
|
||||
DialogDeviceEndOfLifeViewModel providesDialogDeviceEndOfLifeViewModel() {
|
||||
return new DialogDeviceEndOfLifeViewModel();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.device_end_of_life;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import it.integry.integrywmsnative.MainApplication;
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
|
||||
import it.integry.integrywmsnative.databinding.DialogDeviceEndOfLifeBinding;
|
||||
|
||||
public class DialogDeviceEndOfLifeView extends BaseDialogFragment {
|
||||
|
||||
@Inject
|
||||
DialogDeviceEndOfLifeViewModel mViewModel;
|
||||
|
||||
private DialogDeviceEndOfLifeBinding mBindings;
|
||||
private Context mContext;
|
||||
|
||||
private final Runnable onComplete;
|
||||
|
||||
//Pass here all external parameters
|
||||
public static DialogDeviceEndOfLifeView newInstance(Runnable onComplete) {
|
||||
return new DialogDeviceEndOfLifeView(onComplete);
|
||||
}
|
||||
|
||||
private DialogDeviceEndOfLifeView(Runnable onComplete) {
|
||||
super();
|
||||
|
||||
this.onComplete = onComplete;
|
||||
|
||||
MainApplication.appComponent
|
||||
.dialogDeviceEndOfLifeComponent()
|
||||
.create()
|
||||
.inject(this);
|
||||
}
|
||||
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
|
||||
this.mContext = requireContext();
|
||||
|
||||
mBindings = DialogDeviceEndOfLifeBinding.inflate(LayoutInflater.from(this.mContext), null, false);
|
||||
mBindings.setLifecycleOwner(this);
|
||||
|
||||
|
||||
setCancelable(false);
|
||||
|
||||
var alertDialog = new MaterialAlertDialogBuilder(this.mContext)
|
||||
.setView(mBindings.getRoot())
|
||||
.setCancelable(isCancelable())
|
||||
.setPositiveButton(R.string.i_understand_action, (dialog, which) -> {
|
||||
if (onComplete != null) onComplete.run();
|
||||
dismiss();
|
||||
})
|
||||
.create();
|
||||
|
||||
alertDialog.setCanceledOnTouchOutside(isCancelable());
|
||||
alertDialog.setOnShowListener(this);
|
||||
return alertDialog;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dismiss() {
|
||||
if (getDialog() != null) getDialog().dismiss();
|
||||
}
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user