Compare commits
171 Commits
v1.23.0(25
...
v1.26.3(28
| Author | SHA1 | Date | |
|---|---|---|---|
| 6539c9179e | |||
| f43a7acf35 | |||
| ca96bacde6 | |||
| d4c94b7ab9 | |||
| 0c9e607c33 | |||
| b5c6ce2aa5 | |||
| 66f58ea20d | |||
| d6979289e2 | |||
| 496387b5c6 | |||
| 6b0d75fc60 | |||
| 7d263699da | |||
| 63e4e4e791 | |||
| 98c260f621 | |||
| 1b57dc74cf | |||
| 4f140d0d58 | |||
| 0d021e6bad | |||
| 1a0af47613 | |||
| ead509bb32 | |||
| ddfde73f1e | |||
| 3de5a2320d | |||
| 5cb32a9a77 | |||
| ecbb4ac55c | |||
| 84e0561fff | |||
| 71bfbb2afc | |||
| 2cb563320b | |||
| f3837f35b0 | |||
| fa52b8e040 | |||
| c80b5a9160 | |||
| 65ac5590c7 | |||
| 3cee7f2a95 | |||
| 3034b49586 | |||
| 718ffb3124 | |||
| 7173c49561 | |||
| 4407f37f8c | |||
| 37a16f6292 | |||
| 83d9e0c5f7 | |||
| d2249e031a | |||
| 2522e67705 | |||
| 371514157c | |||
| de889045e6 | |||
| 6225ba8207 | |||
| 36c9319bce | |||
| d4d494218b | |||
| a3d6b11c69 | |||
| 852edf1b13 | |||
| 6806290d98 | |||
| 66f7a51462 | |||
| 0e1e69dc9a | |||
| 2ef24fe6e9 | |||
| 54c2d90334 | |||
| 577f2041a1 | |||
| 2f3e74fbfe | |||
| b0fa911322 | |||
| 473b9f22fb | |||
| cc1e1bf221 | |||
| a0c85b3fcb | |||
| 0f41bd99aa | |||
| 7a3a207462 | |||
| 7206b3c37e | |||
| 4cf8b6167f | |||
| b19b438489 | |||
| d3ee6d9ea3 | |||
| dd9789c4f3 | |||
| 67571e3d7a | |||
| a0e17f557d | |||
| 684946bb14 | |||
| 4aab6b1688 | |||
| 310a79f41d | |||
| f8164ca1eb | |||
| 790a9eae6c | |||
| b41edd314f | |||
| 34d8a93c01 | |||
| 3b45d8fe35 | |||
| aba1fcdc7b | |||
| 012d7caa52 | |||
| e7e20da206 | |||
| ef6535897b | |||
| 8c75ecbd0a | |||
| fad3c4243d | |||
| a6e75114cb | |||
| 48a83bc0d5 | |||
| b58475b426 | |||
| 207daab105 | |||
| c32da27b7f | |||
| 1f94c14634 | |||
| 4880ea8301 | |||
| a2d165d475 | |||
| d142f0c868 | |||
| 746838010a | |||
| a74d865c57 | |||
| 0a37323cef | |||
| b36b80eae0 | |||
| acb7727f3c | |||
| c16f5d2ddd | |||
| 4ca449d557 | |||
| da70d7c064 | |||
| 0be1eac5fe | |||
| e0eabbcbda | |||
| bd7b561b28 | |||
| 37c3a1ec76 | |||
| 62e69ad5bf | |||
| 3a6ba51a69 | |||
| 767088f1d0 | |||
| d0f6999dd8 | |||
| f88d7892bd | |||
| 3df5e406ef | |||
| 8e0728c2b4 | |||
| 0a2d47110d | |||
| 4ed8c825dd | |||
| 0a6d01628f | |||
| 453c8e0cad | |||
| ee43d1e985 | |||
| 86d472fb88 | |||
| 61c3458088 | |||
| 85c4768e51 | |||
| f1b4ce469e | |||
| 6071b3eb44 | |||
| 1d2bd20584 | |||
| 756389e6c6 | |||
| 4b19129a2f | |||
| f6aadf1115 | |||
| 3a5de50353 | |||
| cf3b8749dc | |||
| 34ff300515 | |||
| 0738993d4c | |||
| 9765fe1807 | |||
| 968e904715 | |||
| 90985b899b | |||
| d81e0dd72c | |||
| ee8751163c | |||
| 5476e9633e | |||
| 84d800a698 | |||
| eb39e1b7c5 | |||
| 57fa738c59 | |||
| bfc02a7d48 | |||
| e963e03c81 | |||
| f1c25a3673 | |||
| 90d5a8d43b | |||
| e1b4af2402 | |||
| 86c7be4e7d | |||
| 8686df3d8a | |||
| 6b04246f42 | |||
| 8e40092130 | |||
| b8dbde5ee1 | |||
| ae6d37e80d | |||
| 6dcc711006 | |||
| a616cb6022 | |||
| 837781389c | |||
| f23ff88878 | |||
| ddc038add4 | |||
| f037617dd9 | |||
| 84cff70567 | |||
| 8a1b3a1b00 | |||
| f11a81ef05 | |||
| eb8595e247 | |||
| 85520b937f | |||
| ec5bee558c | |||
| 857295d92b | |||
| 4da2c43251 | |||
| fc1681d111 | |||
| 692a350128 | |||
| 47f29899a2 | |||
| a0dfd20110 | |||
| 92aadad5cb | |||
| 52092e7e9c | |||
| ecfb8faf01 | |||
| e5dd4b15f4 | |||
| 6e070285e3 | |||
| d13cdf63c2 | |||
| c3884774e1 | |||
| 8e60aa0249 |
558
.idea/dbnavigator.xml
generated
Normal file
558
.idea/dbnavigator.xml
generated
Normal file
File diff suppressed because one or more lines are too long
3
.idea/runConfigurations/app_base.xml
generated
3
.idea/runConfigurations/app_base.xml
generated
@@ -15,6 +15,7 @@
|
|||||||
<option name="SHOW_LOGCAT_AUTOMATICALLY" value="true" />
|
<option name="SHOW_LOGCAT_AUTOMATICALLY" value="true" />
|
||||||
<option name="SKIP_NOOP_APK_INSTALLATIONS" value="true" />
|
<option name="SKIP_NOOP_APK_INSTALLATIONS" value="true" />
|
||||||
<option name="FORCE_STOP_RUNNING_APP" value="true" />
|
<option name="FORCE_STOP_RUNNING_APP" value="true" />
|
||||||
|
<option name="INSPECTION_WITHOUT_ACTIVITY_RESTART" value="false" />
|
||||||
<option name="TARGET_SELECTION_MODE" value="SHOW_DIALOG" />
|
<option name="TARGET_SELECTION_MODE" value="SHOW_DIALOG" />
|
||||||
<option name="SELECTED_CLOUD_MATRIX_CONFIGURATION_ID" value="-1" />
|
<option name="SELECTED_CLOUD_MATRIX_CONFIGURATION_ID" value="-1" />
|
||||||
<option name="SELECTED_CLOUD_MATRIX_PROJECT_ID" value="" />
|
<option name="SELECTED_CLOUD_MATRIX_PROJECT_ID" value="" />
|
||||||
@@ -45,7 +46,7 @@
|
|||||||
<option name="ADVANCED_PROFILING_ENABLED" value="false" />
|
<option name="ADVANCED_PROFILING_ENABLED" value="false" />
|
||||||
<option name="STARTUP_PROFILING_ENABLED" value="false" />
|
<option name="STARTUP_PROFILING_ENABLED" value="false" />
|
||||||
<option name="STARTUP_CPU_PROFILING_ENABLED" value="false" />
|
<option name="STARTUP_CPU_PROFILING_ENABLED" value="false" />
|
||||||
<option name="STARTUP_CPU_PROFILING_CONFIGURATION_NAME" value="Sample Java Methods" />
|
<option name="STARTUP_CPU_PROFILING_CONFIGURATION_NAME" value="Callstack Sample" />
|
||||||
<option name="STARTUP_NATIVE_MEMORY_PROFILING_ENABLED" value="false" />
|
<option name="STARTUP_NATIVE_MEMORY_PROFILING_ENABLED" value="false" />
|
||||||
<option name="NATIVE_MEMORY_SAMPLE_RATE_BYTES" value="2048" />
|
<option name="NATIVE_MEMORY_SAMPLE_RATE_BYTES" value="2048" />
|
||||||
</Profilers>
|
</Profilers>
|
||||||
|
|||||||
3
.idea/runConfigurations/app_vglimenti.xml
generated
3
.idea/runConfigurations/app_vglimenti.xml
generated
@@ -15,6 +15,7 @@
|
|||||||
<option name="SHOW_LOGCAT_AUTOMATICALLY" value="true" />
|
<option name="SHOW_LOGCAT_AUTOMATICALLY" value="true" />
|
||||||
<option name="SKIP_NOOP_APK_INSTALLATIONS" value="true" />
|
<option name="SKIP_NOOP_APK_INSTALLATIONS" value="true" />
|
||||||
<option name="FORCE_STOP_RUNNING_APP" value="true" />
|
<option name="FORCE_STOP_RUNNING_APP" value="true" />
|
||||||
|
<option name="INSPECTION_WITHOUT_ACTIVITY_RESTART" value="false" />
|
||||||
<option name="TARGET_SELECTION_MODE" value="SHOW_DIALOG" />
|
<option name="TARGET_SELECTION_MODE" value="SHOW_DIALOG" />
|
||||||
<option name="SELECTED_CLOUD_MATRIX_CONFIGURATION_ID" value="-1" />
|
<option name="SELECTED_CLOUD_MATRIX_CONFIGURATION_ID" value="-1" />
|
||||||
<option name="SELECTED_CLOUD_MATRIX_PROJECT_ID" value="" />
|
<option name="SELECTED_CLOUD_MATRIX_PROJECT_ID" value="" />
|
||||||
@@ -45,7 +46,7 @@
|
|||||||
<option name="ADVANCED_PROFILING_ENABLED" value="false" />
|
<option name="ADVANCED_PROFILING_ENABLED" value="false" />
|
||||||
<option name="STARTUP_PROFILING_ENABLED" value="false" />
|
<option name="STARTUP_PROFILING_ENABLED" value="false" />
|
||||||
<option name="STARTUP_CPU_PROFILING_ENABLED" value="false" />
|
<option name="STARTUP_CPU_PROFILING_ENABLED" value="false" />
|
||||||
<option name="STARTUP_CPU_PROFILING_CONFIGURATION_NAME" value="Sample Java Methods" />
|
<option name="STARTUP_CPU_PROFILING_CONFIGURATION_NAME" value="Callstack Sample" />
|
||||||
<option name="STARTUP_NATIVE_MEMORY_PROFILING_ENABLED" value="false" />
|
<option name="STARTUP_NATIVE_MEMORY_PROFILING_ENABLED" value="false" />
|
||||||
<option name="NATIVE_MEMORY_SAMPLE_RATE_BYTES" value="2048" />
|
<option name="NATIVE_MEMORY_SAMPLE_RATE_BYTES" value="2048" />
|
||||||
</Profilers>
|
</Profilers>
|
||||||
|
|||||||
@@ -1,13 +1,17 @@
|
|||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.application'
|
||||||
apply plugin: 'com.google.firebase.firebase-perf'
|
|
||||||
|
if (!project.hasProperty("disable-performance-plugin")) {
|
||||||
|
apply plugin: 'com.google.firebase.firebase-perf'
|
||||||
|
}
|
||||||
|
|
||||||
apply plugin: 'com.google.firebase.crashlytics'
|
apply plugin: 'com.google.firebase.crashlytics'
|
||||||
apply plugin: 'kotlin-android'
|
apply plugin: 'kotlin-android'
|
||||||
apply plugin: 'com.google.gms.google-services'
|
apply plugin: 'com.google.gms.google-services'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
|
|
||||||
def appVersionCode = 255
|
def appVersionCode = 286
|
||||||
def appVersionName = '1.23.0'
|
def appVersionName = '1.26.3'
|
||||||
|
|
||||||
signingConfigs {
|
signingConfigs {
|
||||||
release {
|
release {
|
||||||
@@ -27,12 +31,12 @@ android {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
compileSdkVersion 30
|
compileSdkVersion 31
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "it.integry.integrywmsnative"
|
applicationId "it.integry.integrywmsnative"
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 30
|
targetSdkVersion 31
|
||||||
versionCode appVersionCode
|
versionCode appVersionCode
|
||||||
versionName appVersionName
|
versionName appVersionName
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
@@ -74,11 +78,11 @@ android {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lintOptions {
|
|
||||||
abortOnError false
|
|
||||||
}
|
|
||||||
|
|
||||||
dynamicFeatures = [":dynamic__base", ":dynamic_vgalimenti"]
|
dynamicFeatures = [":dynamic__base", ":dynamic_vgalimenti"]
|
||||||
|
lint {
|
||||||
|
abortOnError false
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -94,33 +98,33 @@ dependencies {
|
|||||||
//Firebase
|
//Firebase
|
||||||
|
|
||||||
// Import the Firebase BoM
|
// Import the Firebase BoM
|
||||||
implementation platform('com.google.firebase:firebase-bom:26.3.0')
|
implementation platform('com.google.firebase:firebase-bom:29.1.0')
|
||||||
implementation 'com.google.firebase:firebase-analytics'
|
implementation 'com.google.firebase:firebase-analytics'
|
||||||
implementation 'com.google.firebase:firebase-core'
|
implementation 'com.google.firebase:firebase-core'
|
||||||
implementation 'com.google.firebase:firebase-crash'
|
|
||||||
implementation 'com.google.firebase:firebase-crashlytics'
|
implementation 'com.google.firebase:firebase-crashlytics'
|
||||||
implementation 'com.google.firebase:firebase-perf'
|
implementation 'com.google.firebase:firebase-perf'
|
||||||
implementation 'com.google.android.gms:play-services-basement:17.6.0'
|
implementation 'com.google.android.gms:play-services-basement:18.0.0'
|
||||||
|
|
||||||
|
|
||||||
implementation 'androidx.appcompat:appcompat:1.3.1'
|
implementation 'androidx.appcompat:appcompat:1.4.1'
|
||||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||||
implementation 'com.google.android.material:material:1.4.0'
|
implementation 'com.google.android.material:material:1.5.0'
|
||||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
|
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
|
||||||
implementation 'androidx.cardview:cardview:1.0.0'
|
implementation 'androidx.cardview:cardview:1.0.0'
|
||||||
implementation 'androidx.recyclerview:recyclerview:1.2.1'
|
implementation 'androidx.recyclerview:recyclerview:1.2.1'
|
||||||
implementation 'androidx.preference:preference-ktx:1.1.1'
|
implementation 'androidx.preference:preference-ktx:1.2.0'
|
||||||
|
implementation "androidx.slidingpanelayout:slidingpanelayout:1.2.0"
|
||||||
implementation 'com.squareup.okhttp3:okhttp:4.9.1'
|
implementation 'com.squareup.okhttp3:okhttp:4.9.1'
|
||||||
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
|
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
|
||||||
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
|
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
|
||||||
implementation 'com.annimon:stream:1.2.2'
|
implementation 'com.annimon:stream:1.2.2'
|
||||||
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.1'
|
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.4.1'
|
||||||
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
|
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
|
||||||
implementation 'androidx.lifecycle:lifecycle-common-java8:2.3.1'
|
implementation 'androidx.lifecycle:lifecycle-common-java8:2.4.1'
|
||||||
implementation 'org.apache.commons:commons-text:1.9'
|
implementation 'org.apache.commons:commons-text:1.9'
|
||||||
|
|
||||||
//MVVM
|
//MVVM
|
||||||
def dagger2_version = '2.35.1'
|
def dagger2_version = '2.40'
|
||||||
api "com.google.dagger:dagger:$dagger2_version"
|
api "com.google.dagger:dagger:$dagger2_version"
|
||||||
annotationProcessor "com.google.dagger:dagger-compiler:$dagger2_version"
|
annotationProcessor "com.google.dagger:dagger-compiler:$dagger2_version"
|
||||||
api "com.google.dagger:dagger-android:$dagger2_version"
|
api "com.google.dagger:dagger-android:$dagger2_version"
|
||||||
@@ -135,12 +139,11 @@ dependencies {
|
|||||||
implementation 'com.github.cachapa:ExpandableLayout:2.9.2'
|
implementation 'com.github.cachapa:ExpandableLayout:2.9.2'
|
||||||
implementation 'com.github.frankiesardo:linearlistview:1.0.1@aar'
|
implementation 'com.github.frankiesardo:linearlistview:1.0.1@aar'
|
||||||
implementation 'com.github.fede87:StatusBarAlert:1.0.1'
|
implementation 'com.github.fede87:StatusBarAlert:1.0.1'
|
||||||
testImplementation 'junit:junit:4.13.2'
|
|
||||||
implementation 'com.github.zhukic:sectioned-recyclerview:1.2.3'
|
implementation 'com.github.zhukic:sectioned-recyclerview:1.2.3'
|
||||||
implementation 'com.github.pedromassango:doubleClick:3.0'
|
implementation 'com.github.pedromassango:doubleClick:3.0'
|
||||||
|
|
||||||
//SQLite ROOM
|
//SQLite ROOM
|
||||||
def room_version = "2.3.0"
|
def room_version = "2.4.1"
|
||||||
|
|
||||||
implementation "androidx.room:room-runtime:$room_version"
|
implementation "androidx.room:room-runtime:$room_version"
|
||||||
annotationProcessor "androidx.room:room-compiler:$room_version"
|
annotationProcessor "androidx.room:room-compiler:$room_version"
|
||||||
@@ -154,12 +157,22 @@ dependencies {
|
|||||||
implementation project(':barcode_base_android_library')
|
implementation project(':barcode_base_android_library')
|
||||||
implementation project(':honeywellscannerlibrary')
|
implementation project(':honeywellscannerlibrary')
|
||||||
implementation project(':keyobardemulatorscannerlibrary')
|
implementation project(':keyobardemulatorscannerlibrary')
|
||||||
androidTestImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.1'
|
|
||||||
androidTestImplementation 'org.testng:testng:7.4.0'
|
|
||||||
|
|
||||||
|
|
||||||
implementation 'com.github.RaviKoradiya:LiveAdapter:1.3.4'
|
implementation 'com.github.RaviKoradiya:LiveAdapter:1.3.4'
|
||||||
implementation 'org.reflections:reflections:0.10.2'
|
|
||||||
|
// Required -- JUnit 4 framework
|
||||||
|
// testImplementation "org.junit.jupiter:junit-jupiter-api:5.8.1"
|
||||||
|
// androidTestImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
|
||||||
|
// androidTestImplementation 'org.testng:testng:7.4.0'
|
||||||
|
|
||||||
|
|
||||||
|
//Bluetooth device manager
|
||||||
|
implementation 'com.github.harry1453:android-bluetooth-serial:v1.1'
|
||||||
|
|
||||||
|
// RxJava is also required.
|
||||||
|
implementation 'io.reactivex.rxjava2:rxjava:2.1.12'
|
||||||
|
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
|
|||||||
@@ -1,26 +0,0 @@
|
|||||||
package it.integry.integrywmsnative;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import androidx.test.InstrumentationRegistry;
|
|
||||||
import androidx.test.runner.AndroidJUnit4;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Instrumentation test, which will execute on an Android device.
|
|
||||||
*
|
|
||||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
|
||||||
*/
|
|
||||||
@RunWith(AndroidJUnit4.class)
|
|
||||||
public class ExampleInstrumentedTest {
|
|
||||||
@Test
|
|
||||||
public void useAppContext() throws Exception {
|
|
||||||
// Context of the app under test.
|
|
||||||
Context appContext = InstrumentationRegistry.getTargetContext();
|
|
||||||
|
|
||||||
assertEquals("it.integry.integrywmsnative", appContext.getPackageName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
package it.integry.integrywmsnative.gest.spedizione;
|
|
||||||
|
|
||||||
class SpedizioneViewModelTest {
|
|
||||||
|
|
||||||
@org.junit.jupiter.api.Test
|
|
||||||
void createNewLU() {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -8,6 +8,7 @@
|
|||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||||
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
|
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
|
||||||
<uses-permission android:name="android.permission.CAMERA" />
|
<uses-permission android:name="android.permission.CAMERA" />
|
||||||
|
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:name=".MainApplication"
|
android:name=".MainApplication"
|
||||||
@@ -19,7 +20,8 @@
|
|||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/AppTheme"
|
android:theme="@style/AppTheme"
|
||||||
android:usesCleartextTraffic="true"
|
android:usesCleartextTraffic="true"
|
||||||
android:fullBackupContent="@xml/backup_descriptor">
|
android:fullBackupContent="@xml/backup_descriptor"
|
||||||
|
android:requestLegacyExternalStorage="true">
|
||||||
<activity
|
<activity
|
||||||
android:name=".gest.spedizione.SpedizioneActivity"
|
android:name=".gest.spedizione.SpedizioneActivity"
|
||||||
android:screenOrientation="portrait"
|
android:screenOrientation="portrait"
|
||||||
@@ -40,7 +42,8 @@
|
|||||||
<activity
|
<activity
|
||||||
android:name=".gest.main.MainActivity"
|
android:name=".gest.main.MainActivity"
|
||||||
android:theme="@style/Light"
|
android:theme="@style/Light"
|
||||||
android:windowSoftInputMode="adjustNothing">
|
android:windowSoftInputMode="adjustNothing"
|
||||||
|
android:exported="true">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.CLIENTBARCODEACTIVITY" />
|
<action android:name="android.intent.action.CLIENTBARCODEACTIVITY" />
|
||||||
|
|
||||||
@@ -73,7 +76,8 @@
|
|||||||
<activity
|
<activity
|
||||||
android:name=".SplashActivity"
|
android:name=".SplashActivity"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:theme="@style/SplashTheme">
|
android:theme="@style/SplashTheme"
|
||||||
|
android:exported="true">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,12 @@ import javax.inject.Singleton;
|
|||||||
import dagger.Component;
|
import dagger.Component;
|
||||||
import it.integry.integrywmsnative.core.context.AppContext;
|
import it.integry.integrywmsnative.core.context.AppContext;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.RoomModule;
|
import it.integry.integrywmsnative.core.data_store.db.RoomModule;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.BaseActivityComponent;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.BaseActivityModule;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.BaseDialogFragmentComponent;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.BaseDialogFragmentModule;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.BaseFragmentComponent;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.BaseFragmentModule;
|
||||||
import it.integry.integrywmsnative.gest.accettazione.MainAccettazioneComponent;
|
import it.integry.integrywmsnative.gest.accettazione.MainAccettazioneComponent;
|
||||||
import it.integry.integrywmsnative.gest.accettazione.MainAccettazioneModule;
|
import it.integry.integrywmsnative.gest.accettazione.MainAccettazioneModule;
|
||||||
import it.integry.integrywmsnative.gest.accettazione_picking.AccettazionePickingComponent;
|
import it.integry.integrywmsnative.gest.accettazione_picking.AccettazionePickingComponent;
|
||||||
@@ -15,6 +21,8 @@ import it.integry.integrywmsnative.gest.contab_doc_interni.dialog.DialogSelectDo
|
|||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dialog.DialogSelectDocInfoModule;
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dialog.DialogSelectDocInfoModule;
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.DocInterniEditFormComponent;
|
import it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.DocInterniEditFormComponent;
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.DocInterniEditFormModule;
|
import it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.DocInterniEditFormModule;
|
||||||
|
import it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.dialog.selectDocRows.DialogSelectDocRowsComponent;
|
||||||
|
import it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.dialog.selectDocRows.DialogSelectDocRowsModule;
|
||||||
import it.integry.integrywmsnative.gest.contenuto_bancale.ContenutoBancaleComponent;
|
import it.integry.integrywmsnative.gest.contenuto_bancale.ContenutoBancaleComponent;
|
||||||
import it.integry.integrywmsnative.gest.contenuto_bancale.ContenutoBancaleModule;
|
import it.integry.integrywmsnative.gest.contenuto_bancale.ContenutoBancaleModule;
|
||||||
import it.integry.integrywmsnative.gest.lista_bancali.ListaBancaliComponent;
|
import it.integry.integrywmsnative.gest.lista_bancali.ListaBancaliComponent;
|
||||||
@@ -45,6 +53,8 @@ import it.integry.integrywmsnative.gest.prod_versamento_materiale.ProdVersamento
|
|||||||
import it.integry.integrywmsnative.gest.prod_versamento_materiale.ProdVersamentoMaterialeModule;
|
import it.integry.integrywmsnative.gest.prod_versamento_materiale.ProdVersamentoMaterialeModule;
|
||||||
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.PVOrdineAcquistoEditComponent;
|
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.PVOrdineAcquistoEditComponent;
|
||||||
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.PVOrdineAcquistoEditModule;
|
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.PVOrdineAcquistoEditModule;
|
||||||
|
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.dialog.DialogEditArticoloComponent;
|
||||||
|
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.dialog.DialogEditArticoloModule;
|
||||||
import it.integry.integrywmsnative.gest.pv_ordini_acquisto.PVOrdiniAcquistoGrigliaComponent;
|
import it.integry.integrywmsnative.gest.pv_ordini_acquisto.PVOrdiniAcquistoGrigliaComponent;
|
||||||
import it.integry.integrywmsnative.gest.pv_ordini_acquisto.PVOrdiniAcquistoGrigliaModule;
|
import it.integry.integrywmsnative.gest.pv_ordini_acquisto.PVOrdiniAcquistoGrigliaModule;
|
||||||
import it.integry.integrywmsnative.gest.rettifica_giacenze.RettificaGiacenzeComponent;
|
import it.integry.integrywmsnative.gest.rettifica_giacenze.RettificaGiacenzeComponent;
|
||||||
@@ -59,10 +69,13 @@ import it.integry.integrywmsnative.gest.ultimi_arrivi_fornitore.UltimiArriviForn
|
|||||||
import it.integry.integrywmsnative.gest.ultimi_arrivi_fornitore.UltimiArriviFornitoreModule;
|
import it.integry.integrywmsnative.gest.ultimi_arrivi_fornitore.UltimiArriviFornitoreModule;
|
||||||
import it.integry.integrywmsnative.gest.versamento_merce.VersamentoMerceComponent;
|
import it.integry.integrywmsnative.gest.versamento_merce.VersamentoMerceComponent;
|
||||||
import it.integry.integrywmsnative.gest.versamento_merce.VersamentoMerceModule;
|
import it.integry.integrywmsnative.gest.versamento_merce.VersamentoMerceModule;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.ask_cliente.DialogAskClienteComponent;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.ask_cliente.DialogAskClienteModule;
|
||||||
import it.integry.integrywmsnative.view.dialogs.choose_arts_from_lista_arts.DialogChooseArtsFromListaArtsComponent;
|
import it.integry.integrywmsnative.view.dialogs.choose_arts_from_lista_arts.DialogChooseArtsFromListaArtsComponent;
|
||||||
import it.integry.integrywmsnative.view.dialogs.choose_arts_from_lista_arts.DialogChooseArtsFromListaArtsModule;
|
import it.integry.integrywmsnative.view.dialogs.choose_arts_from_lista_arts.DialogChooseArtsFromListaArtsModule;
|
||||||
import it.integry.integrywmsnative.view.dialogs.choose_batch_lot.DialogChooseBatchLotComponent;
|
import it.integry.integrywmsnative.view.dialogs.choose_batch_lot.DialogChooseBatchLotComponent;
|
||||||
import it.integry.integrywmsnative.view.dialogs.choose_batch_lot.DialogChooseBatchLotModule;
|
import it.integry.integrywmsnative.view.dialogs.choose_batch_lot.DialogChooseBatchLotModule;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.info_aggiuntive_lu.InfoAggiuntiveLUDialogComponent;
|
||||||
import it.integry.integrywmsnative.view.dialogs.input_lu_prod.DialogInputLUProdComponent;
|
import it.integry.integrywmsnative.view.dialogs.input_lu_prod.DialogInputLUProdComponent;
|
||||||
import it.integry.integrywmsnative.view.dialogs.input_lu_prod.DialogInputLUProdModule;
|
import it.integry.integrywmsnative.view.dialogs.input_lu_prod.DialogInputLUProdModule;
|
||||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2Component;
|
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2Component;
|
||||||
@@ -78,6 +91,9 @@ import it.integry.integrywmsnative.view.dialogs.scan_or_create_lu.DialogScanOrCr
|
|||||||
RoomModule.class,
|
RoomModule.class,
|
||||||
SplashActivityModule.class,
|
SplashActivityModule.class,
|
||||||
MainApplicationModule.class,
|
MainApplicationModule.class,
|
||||||
|
BaseActivityModule.class,
|
||||||
|
BaseFragmentModule.class,
|
||||||
|
BaseDialogFragmentModule.class,
|
||||||
LoginModule.class,
|
LoginModule.class,
|
||||||
MainActivityModule.class,
|
MainActivityModule.class,
|
||||||
MainFragmentModule.class,
|
MainFragmentModule.class,
|
||||||
@@ -109,47 +125,99 @@ import it.integry.integrywmsnative.view.dialogs.scan_or_create_lu.DialogScanOrCr
|
|||||||
DialogChooseArtsFromListaArtsModule.class,
|
DialogChooseArtsFromListaArtsModule.class,
|
||||||
DocInterniModule.class,
|
DocInterniModule.class,
|
||||||
DialogSelectDocInfoModule.class,
|
DialogSelectDocInfoModule.class,
|
||||||
DocInterniEditFormModule.class
|
DocInterniEditFormModule.class,
|
||||||
|
DialogSelectDocRowsModule.class,
|
||||||
|
DialogAskClienteModule.class,
|
||||||
|
DialogEditArticoloModule.class
|
||||||
})
|
})
|
||||||
public interface MainApplicationComponent {
|
public interface MainApplicationComponent {
|
||||||
|
|
||||||
|
BaseActivityComponent.Factory baseActivityComponent();
|
||||||
|
|
||||||
|
BaseFragmentComponent.Factory baseFragmentComponent();
|
||||||
|
|
||||||
|
BaseDialogFragmentComponent.Factory baseDialogFragmentComponent();
|
||||||
|
|
||||||
SplashActivityComponent.Factory splashActivityComponent();
|
SplashActivityComponent.Factory splashActivityComponent();
|
||||||
|
|
||||||
LoginComponent.Factory loginActivityComponent();
|
LoginComponent.Factory loginActivityComponent();
|
||||||
|
|
||||||
MainActivityComponent.Factory mainActivityComponent();
|
MainActivityComponent.Factory mainActivityComponent();
|
||||||
|
|
||||||
MainFragmentComponent.Factory mainFragmentComponent();
|
MainFragmentComponent.Factory mainFragmentComponent();
|
||||||
|
|
||||||
MainAccettazioneComponent.Factory mainAccettazioneComponent();
|
MainAccettazioneComponent.Factory mainAccettazioneComponent();
|
||||||
|
|
||||||
ListaBancaliComponent.Factory listaBancaliComponent();
|
ListaBancaliComponent.Factory listaBancaliComponent();
|
||||||
|
|
||||||
ContenutoBancaleComponent.Factory contenutoBancaleComponent();
|
ContenutoBancaleComponent.Factory contenutoBancaleComponent();
|
||||||
|
|
||||||
PVOrdiniAcquistoGrigliaComponent.Factory pvOrdineAcquistoGrigliaComponent();
|
PVOrdiniAcquistoGrigliaComponent.Factory pvOrdineAcquistoGrigliaComponent();
|
||||||
|
|
||||||
PVOrdineAcquistoEditComponent.Factory pvOrdineAcquistoEditComponent();
|
PVOrdineAcquistoEditComponent.Factory pvOrdineAcquistoEditComponent();
|
||||||
|
|
||||||
PickingLiberoComponent.Factory pickingLiberoComponent();
|
PickingLiberoComponent.Factory pickingLiberoComponent();
|
||||||
|
|
||||||
RettificaGiacenzeComponent.Factory rettificaGiacenzeComponent();
|
RettificaGiacenzeComponent.Factory rettificaGiacenzeComponent();
|
||||||
|
|
||||||
SpedizioneComponent.Factory spedizioneComponent();
|
SpedizioneComponent.Factory spedizioneComponent();
|
||||||
|
|
||||||
AccettazionePickingComponent.Factory accettazionePickingComponent();
|
AccettazionePickingComponent.Factory accettazionePickingComponent();
|
||||||
|
|
||||||
UltimeConsegneClienteComponent.Factory ultimeConsegneClienteComponent();
|
UltimeConsegneClienteComponent.Factory ultimeConsegneClienteComponent();
|
||||||
|
|
||||||
UltimiArriviFornitoreComponent.Factory ultimiArriviFornitoreComponent();
|
UltimiArriviFornitoreComponent.Factory ultimiArriviFornitoreComponent();
|
||||||
|
|
||||||
PickingResiComponent.Factory pickingResiComponent();
|
PickingResiComponent.Factory pickingResiComponent();
|
||||||
|
|
||||||
OrdiniUscitaElencoComponent.Factory prodOrdineLavorazioneElencoComponent();
|
OrdiniUscitaElencoComponent.Factory prodOrdineLavorazioneElencoComponent();
|
||||||
|
|
||||||
|
DialogAskClienteComponent.Factory dialogAskClienteComponent();
|
||||||
|
|
||||||
DialogInputQuantityV2Component.Factory dialogInputQuantityV2Component();
|
DialogInputQuantityV2Component.Factory dialogInputQuantityV2Component();
|
||||||
|
|
||||||
DialogInputLUProdComponent.Factory dialogInputLUProdComponent();
|
DialogInputLUProdComponent.Factory dialogInputLUProdComponent();
|
||||||
|
|
||||||
DialogScanArtComponent.Factory dialogScanArtComponent();
|
DialogScanArtComponent.Factory dialogScanArtComponent();
|
||||||
|
|
||||||
DialogScanOrCreateLUComponent.Factory dialogScanOrCreateLUComponent();
|
DialogScanOrCreateLUComponent.Factory dialogScanOrCreateLUComponent();
|
||||||
|
|
||||||
ProdFabbisognoLineeProdComponent.Factory prodFabbisognoLineeProdComponent();
|
ProdFabbisognoLineeProdComponent.Factory prodFabbisognoLineeProdComponent();
|
||||||
|
|
||||||
VersamentoMerceComponent.Factory versamentoMerceComponent();
|
VersamentoMerceComponent.Factory versamentoMerceComponent();
|
||||||
|
|
||||||
DialogAskMagazzinoProssimitaComponent.Factory dialogAskMagazzinoProssimitaComponent();
|
DialogAskMagazzinoProssimitaComponent.Factory dialogAskMagazzinoProssimitaComponent();
|
||||||
|
|
||||||
DialogChooseBatchLotComponent.Factory dialogChooseBatchLotComponent();
|
DialogChooseBatchLotComponent.Factory dialogChooseBatchLotComponent();
|
||||||
|
|
||||||
DialogRowInfoProdFabbisognoLineeProdComponent.Factory dialogRowInfoProdFabbisognoLineeProdComponent();
|
DialogRowInfoProdFabbisognoLineeProdComponent.Factory dialogRowInfoProdFabbisognoLineeProdComponent();
|
||||||
|
|
||||||
ProdRientroMerceComponent.Factory prodRientroMerceComponent();
|
ProdRientroMerceComponent.Factory prodRientroMerceComponent();
|
||||||
|
|
||||||
ProdRientroMerceOrderDetailComponent.Factory prodRientroMerceOrderDetailComponent();
|
ProdRientroMerceOrderDetailComponent.Factory prodRientroMerceOrderDetailComponent();
|
||||||
|
|
||||||
ProdOrdineProduzioneElencoComponent.Factory prodOrdineProduzioneElencoComponent();
|
ProdOrdineProduzioneElencoComponent.Factory prodOrdineProduzioneElencoComponent();
|
||||||
|
|
||||||
ProdRecuperoMaterialeComponent.Factory prodRecuperoMaterialeComponent();
|
ProdRecuperoMaterialeComponent.Factory prodRecuperoMaterialeComponent();
|
||||||
|
|
||||||
ProdVersamentoMaterialeComponent.Factory prodVersamentoMaterialeComponent();
|
ProdVersamentoMaterialeComponent.Factory prodVersamentoMaterialeComponent();
|
||||||
|
|
||||||
DialogChooseArtsFromListaArtsComponent.Factory dialogChooseArtsFromListaArtsComponent();
|
DialogChooseArtsFromListaArtsComponent.Factory dialogChooseArtsFromListaArtsComponent();
|
||||||
|
|
||||||
DocInterniComponent.Factory docInterniComponent();
|
DocInterniComponent.Factory docInterniComponent();
|
||||||
|
|
||||||
DialogSelectDocInfoComponent.Factory dialogSelectMgrpDtipPairComponent();
|
DialogSelectDocInfoComponent.Factory dialogSelectMgrpDtipPairComponent();
|
||||||
|
|
||||||
|
DialogSelectDocRowsComponent.Factory dialogSelectDocRowsComponent();
|
||||||
|
|
||||||
DocInterniEditFormComponent.Factory docInterniEditFormComponent();
|
DocInterniEditFormComponent.Factory docInterniEditFormComponent();
|
||||||
|
|
||||||
|
InfoAggiuntiveLUDialogComponent.Factory infoAggiuntiveLUDialogComponent();
|
||||||
|
|
||||||
|
DialogEditArticoloComponent.Factory dialogEditArticoloComponent();
|
||||||
|
|
||||||
void inject(MainApplication mainApplication);
|
void inject(MainApplication mainApplication);
|
||||||
|
|
||||||
void inject(AppContext mainApplication);
|
void inject(AppContext mainApplication);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,8 +27,11 @@ import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
|
|||||||
import it.integry.integrywmsnative.core.rest.consumers.PrinterRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.PrinterRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.services.inventario.InventarioService;
|
import it.integry.integrywmsnative.core.services.inventario.InventarioService;
|
||||||
|
import it.integry.integrywmsnative.core.update.UpdatesManager;
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.rest.DocInterniRESTConsumer;
|
import it.integry.integrywmsnative.gest.contab_doc_interni.rest.DocInterniRESTConsumer;
|
||||||
import it.integry.integrywmsnative.gest.prod_fabbisogno_linee_prod.rest.ProdFabbisognoLineeProdRESTConsumer;
|
import it.integry.integrywmsnative.gest.prod_fabbisogno_linee_prod.rest.ProdFabbisognoLineeProdRESTConsumer;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.DialogProgressView;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2View;
|
||||||
|
|
||||||
@Module
|
@Module
|
||||||
public class MainApplicationModule {
|
public class MainApplicationModule {
|
||||||
@@ -71,6 +74,24 @@ public class MainApplicationModule {
|
|||||||
return new MenuService(menuRESTConsumer);
|
return new MenuService(menuRESTConsumer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
UpdatesManager provideUpdatesManager() {
|
||||||
|
return new UpdatesManager();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
DialogProgressView providesDialogProgressView() {
|
||||||
|
return DialogProgressView.newInstance();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
DialogInputQuantityV2View providesDialogInputQuantityV2View() {
|
||||||
|
return new DialogInputQuantityV2View();
|
||||||
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
OrdiniRESTConsumer provideOrdiniRESTConsumer(SystemRESTConsumer systemRESTConsumer, EntityRESTConsumer entityRESTConsumer) {
|
OrdiniRESTConsumer provideOrdiniRESTConsumer(SystemRESTConsumer systemRESTConsumer, EntityRESTConsumer entityRESTConsumer) {
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public class CommonConst {
|
|||||||
|
|
||||||
public static String DEFAULT_ANONYMOUS_UL_SERIE = "UL";
|
public static String DEFAULT_ANONYMOUS_UL_SERIE = "UL";
|
||||||
|
|
||||||
public static int NUMBER_OF_DECIMAL_DIGITS = 3;
|
public static int NUMBER_OF_DECIMAL_DIGITS = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Files {
|
public static class Files {
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public class BarcodeCallbackDTO {
|
|||||||
return onScanSuccessfull;
|
return onScanSuccessfull;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BarcodeCallbackDTO setOnScanSuccessfull(RunnableArgs<BarcodeScanDTO> onScanSuccessfull) {
|
public BarcodeCallbackDTO setOnScanSuccessful(RunnableArgs<BarcodeScanDTO> onScanSuccessfull) {
|
||||||
this.onScanSuccessfull = onScanSuccessfull;
|
this.onScanSuccessfull = onScanSuccessfull;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,49 +0,0 @@
|
|||||||
package it.integry.integrywmsnative.core.coollection;
|
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.coollection.matcher.Matcher;
|
|
||||||
import it.integry.integrywmsnative.core.coollection.matcher.custom.Contains;
|
|
||||||
import it.integry.integrywmsnative.core.coollection.matcher.custom.Equals;
|
|
||||||
import it.integry.integrywmsnative.core.coollection.matcher.custom.EqualsIgnoreCase;
|
|
||||||
import it.integry.integrywmsnative.core.coollection.matcher.custom.GreaterThan;
|
|
||||||
import it.integry.integrywmsnative.core.coollection.matcher.custom.IsNull;
|
|
||||||
import it.integry.integrywmsnative.core.coollection.matcher.custom.LessThan;
|
|
||||||
import it.integry.integrywmsnative.core.coollection.matcher.custom.Not;
|
|
||||||
import it.integry.integrywmsnative.core.coollection.query.Query;
|
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
public class Coollection {
|
|
||||||
|
|
||||||
public static <T> Query<T> from(Collection<T> collection) {
|
|
||||||
return new Query<T>(collection);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Matcher eq(Object value) {
|
|
||||||
return new Equals(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Matcher contains(String value) {
|
|
||||||
return new Contains(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Matcher eqIgnoreCase(String value) {
|
|
||||||
return new EqualsIgnoreCase(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Matcher not(Matcher matcher) {
|
|
||||||
return new Not(matcher);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Matcher greaterThan(Number value) {
|
|
||||||
return new GreaterThan(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Matcher lessThan(Number value) {
|
|
||||||
return new LessThan(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Matcher isNull() {
|
|
||||||
return new IsNull();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
package it.integry.integrywmsnative.core.coollection.matcher;
|
|
||||||
|
|
||||||
public interface Matcher {
|
|
||||||
|
|
||||||
boolean match(Object value);
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
package it.integry.integrywmsnative.core.coollection.matcher.custom;
|
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.coollection.matcher.Matcher;
|
|
||||||
|
|
||||||
public class Contains implements Matcher {
|
|
||||||
|
|
||||||
private final String matcherValue;
|
|
||||||
|
|
||||||
public Contains(String matcherValue) {
|
|
||||||
this.matcherValue = matcherValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean match(Object value) {
|
|
||||||
return String.valueOf(value).contains(matcherValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
package it.integry.integrywmsnative.core.coollection.matcher.custom;
|
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.coollection.matcher.Matcher;
|
|
||||||
|
|
||||||
public class Equals implements Matcher {
|
|
||||||
|
|
||||||
private final Object value;
|
|
||||||
|
|
||||||
public Equals(Object value) {
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean match(Object anotherValue) {
|
|
||||||
return value.equals(anotherValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
package it.integry.integrywmsnative.core.coollection.matcher.custom;
|
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.coollection.matcher.Matcher;
|
|
||||||
|
|
||||||
public class EqualsIgnoreCase implements Matcher {
|
|
||||||
|
|
||||||
private final String value;
|
|
||||||
|
|
||||||
public EqualsIgnoreCase(String value) {
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean match(Object anotherValue) {
|
|
||||||
return (value).equalsIgnoreCase((String) anotherValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
package it.integry.integrywmsnative.core.coollection.matcher.custom;
|
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.coollection.matcher.Matcher;
|
|
||||||
|
|
||||||
public class GreaterThan implements Matcher {
|
|
||||||
|
|
||||||
private final Number value;
|
|
||||||
|
|
||||||
public GreaterThan(Number value) {
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean match(Object matchValue) {
|
|
||||||
if (matchValue == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return ((Number) matchValue).doubleValue() > value.doubleValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
package it.integry.integrywmsnative.core.coollection.matcher.custom;
|
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.coollection.matcher.Matcher;
|
|
||||||
|
|
||||||
public class IsNull implements Matcher {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean match(Object value) {
|
|
||||||
return value == null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
package it.integry.integrywmsnative.core.coollection.matcher.custom;
|
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.coollection.matcher.Matcher;
|
|
||||||
|
|
||||||
public class LessThan implements Matcher {
|
|
||||||
|
|
||||||
private final Number value;
|
|
||||||
|
|
||||||
public LessThan(Number value) {
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean match(Object matchValue) {
|
|
||||||
if (matchValue == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return ((Number) matchValue).doubleValue() < value.doubleValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
package it.integry.integrywmsnative.core.coollection.matcher.custom;
|
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.coollection.matcher.Matcher;
|
|
||||||
|
|
||||||
public class Not implements Matcher {
|
|
||||||
|
|
||||||
private final Matcher matcher;
|
|
||||||
|
|
||||||
public Not(Matcher matcher) {
|
|
||||||
this.matcher = matcher;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean match(Object value) {
|
|
||||||
return !matcher.match(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,90 +0,0 @@
|
|||||||
package it.integry.integrywmsnative.core.coollection.query;
|
|
||||||
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.coollection.matcher.Matcher;
|
|
||||||
import it.integry.integrywmsnative.core.coollection.query.criteria.Criteria;
|
|
||||||
import it.integry.integrywmsnative.core.coollection.query.criteria.CriteriaList;
|
|
||||||
import it.integry.integrywmsnative.core.coollection.query.order.Order;
|
|
||||||
import it.integry.integrywmsnative.core.coollection.query.order.OrderCriteria;
|
|
||||||
import it.integry.integrywmsnative.core.coollection.query.specification.custom.AndSpecification;
|
|
||||||
import it.integry.integrywmsnative.core.coollection.query.specification.custom.OrSpecification;
|
|
||||||
|
|
||||||
public class Query<T> {
|
|
||||||
|
|
||||||
private final Collection<T> collection;
|
|
||||||
private CriteriaList<T> criterias;
|
|
||||||
private OrderCriteria<T> orderCriteria;
|
|
||||||
|
|
||||||
public Query(Collection<T> collection) {
|
|
||||||
this.collection = collection;
|
|
||||||
criterias = new CriteriaList<T>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Query<T> where(String method, Matcher matcher) {
|
|
||||||
Criteria<T> criteria = new Criteria<T>(method, matcher);
|
|
||||||
criterias.add(criteria);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Query<T> and(String method, Matcher matcher) {
|
|
||||||
Criteria<T> criteria = new Criteria<T>(method, matcher);
|
|
||||||
criteria.setSpecification(new AndSpecification<T>());
|
|
||||||
criterias.add(criteria);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Query<T> or(String method, Matcher matcher) {
|
|
||||||
Criteria<T> criteria = new Criteria<T>(method, matcher);
|
|
||||||
criteria.setSpecification(new OrSpecification<T>());
|
|
||||||
criterias.add(criteria);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Query<T> orderBy(String method, Order order) {
|
|
||||||
orderCriteria = new OrderCriteria<T>(method, order);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Query<T> orderBy(String method) {
|
|
||||||
return orderBy(method, Order.ASC);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<T> all() {
|
|
||||||
List<T> all = new ArrayList<T>();
|
|
||||||
for (T item : collection) {
|
|
||||||
if (criterias.match(item)) {
|
|
||||||
all.add(item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (orderCriteria != null) {
|
|
||||||
all = orderCriteria.sort(all);
|
|
||||||
}
|
|
||||||
return all;
|
|
||||||
}
|
|
||||||
|
|
||||||
public T first() {
|
|
||||||
List<T> all = cloneCollection(collection);
|
|
||||||
if (orderCriteria != null) {
|
|
||||||
all = orderCriteria.sort(all);
|
|
||||||
}
|
|
||||||
for (T item : all) {
|
|
||||||
if (criterias.match(item)) {
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<T> cloneCollection(Collection<T> collection) {
|
|
||||||
List<T> list = new ArrayList<T>();
|
|
||||||
for (T item : collection) {
|
|
||||||
list.add(item);
|
|
||||||
}
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
package it.integry.integrywmsnative.core.coollection.query.criteria;
|
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.coollection.matcher.Matcher;
|
|
||||||
import it.integry.integrywmsnative.core.coollection.query.specification.Specification;
|
|
||||||
import it.integry.integrywmsnative.core.coollection.reflection.Phanton;
|
|
||||||
|
|
||||||
public class Criteria<T> {
|
|
||||||
|
|
||||||
private final String method;
|
|
||||||
private final Matcher matcher;
|
|
||||||
private Specification<T> specification;
|
|
||||||
|
|
||||||
public Criteria(String method, Matcher matcher) {
|
|
||||||
this.method = method;
|
|
||||||
this.matcher = matcher;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSpecification(Specification<T> specification) {
|
|
||||||
this.specification = specification;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Specification<T> specification() {
|
|
||||||
return specification;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean match(T item) {
|
|
||||||
try {
|
|
||||||
Object value = Phanton.from(item).call(method);
|
|
||||||
return matcher.match(value);
|
|
||||||
} catch (Exception err) {
|
|
||||||
throw new RuntimeException(err);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
package it.integry.integrywmsnative.core.coollection.query.criteria;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class CriteriaList<T> {
|
|
||||||
|
|
||||||
private List<Criteria<T>> criterias;
|
|
||||||
|
|
||||||
public CriteriaList() {
|
|
||||||
criterias = new ArrayList<Criteria<T>>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void add(Criteria<T> criteria) {
|
|
||||||
criterias.add(criteria);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean match(T item) {
|
|
||||||
if (criterias.size() == 0) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (criterias.size() == 1) {
|
|
||||||
return criterias.get(0).match(item);
|
|
||||||
}
|
|
||||||
boolean matched = true;
|
|
||||||
for (int i = criterias.size() - 1; i > 0; i--) {
|
|
||||||
Criteria<T> one = criterias.get(i);
|
|
||||||
Criteria<T> other = criterias.get(i - 1);
|
|
||||||
matched = matched && one.specification().match(item, one, other);
|
|
||||||
}
|
|
||||||
return matched;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
package it.integry.integrywmsnative.core.coollection.query.order;
|
|
||||||
|
|
||||||
public enum Order {
|
|
||||||
ASC, DESC
|
|
||||||
}
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
package it.integry.integrywmsnative.core.coollection.query.order;
|
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.coollection.reflection.Phanton;
|
|
||||||
|
|
||||||
import java.util.Comparator;
|
|
||||||
|
|
||||||
public class OrderComparator<T> implements Comparator<T> {
|
|
||||||
|
|
||||||
private final String method;
|
|
||||||
|
|
||||||
public OrderComparator(String method) {
|
|
||||||
this.method = method;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public int compare(T one, T other) {
|
|
||||||
Object oneValue = Phanton.from(one).call(method);
|
|
||||||
Object otherValue = Phanton.from(other).call(method);
|
|
||||||
if (oneValue == null || otherValue == null) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if (oneValue instanceof Comparable) {
|
|
||||||
return ((Comparable<Object>) oneValue).compareTo(otherValue);
|
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
package it.integry.integrywmsnative.core.coollection.query.order;
|
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class OrderCriteria<T> {
|
|
||||||
|
|
||||||
private final String method;
|
|
||||||
private final Order order;
|
|
||||||
|
|
||||||
public OrderCriteria(String method, Order order) {
|
|
||||||
this.method = method;
|
|
||||||
this.order = order;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<T> sort(List<T> list) {
|
|
||||||
Collections.sort(list, new OrderComparator<T>(method));
|
|
||||||
if (order == Order.DESC) {
|
|
||||||
Collections.reverse(list);
|
|
||||||
}
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
package it.integry.integrywmsnative.core.coollection.query.specification;
|
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.coollection.query.criteria.Criteria;
|
|
||||||
|
|
||||||
public interface Specification<T> {
|
|
||||||
|
|
||||||
boolean match(T item, Criteria<T> one, Criteria<T> other);
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
package it.integry.integrywmsnative.core.coollection.query.specification.custom;
|
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.coollection.query.criteria.Criteria;
|
|
||||||
import it.integry.integrywmsnative.core.coollection.query.specification.Specification;
|
|
||||||
|
|
||||||
public class AndSpecification<T> implements Specification<T> {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean match(T item, Criteria<T> one, Criteria<T> other) {
|
|
||||||
return one.match(item) && other.match(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
package it.integry.integrywmsnative.core.coollection.query.specification.custom;
|
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.coollection.query.criteria.Criteria;
|
|
||||||
import it.integry.integrywmsnative.core.coollection.query.specification.Specification;
|
|
||||||
|
|
||||||
public class OrSpecification<T> implements Specification<T> {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean match(T item, Criteria<T> one, Criteria<T> other) {
|
|
||||||
return one.match(item) || other.match(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
package it.integry.integrywmsnative.core.coollection.reflection;
|
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
|
|
||||||
public class Phanton<T> {
|
|
||||||
|
|
||||||
private final T target;
|
|
||||||
private Class<?> clazz;
|
|
||||||
|
|
||||||
private Phanton(T target) {
|
|
||||||
this.target = target;
|
|
||||||
clazz = target.getClass();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static <T> Phanton<T> from(T target) {
|
|
||||||
return new Phanton<T>(target);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Object call(String name) {
|
|
||||||
return invoke(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Object invoke(String name) {
|
|
||||||
for (final Field field : clazz.getDeclaredFields()) {
|
|
||||||
try {
|
|
||||||
if (name.equals(field.getName())) {
|
|
||||||
field.setAccessible(Boolean.TRUE);
|
|
||||||
return field.get(target);
|
|
||||||
}
|
|
||||||
} catch (final IllegalAccessException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
throw new RuntimeException("No such property with name " + name);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -42,7 +42,7 @@ public class ColliDataRecoverService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean thereIsAnExistantSession() {
|
public boolean thereIsAnExistantSession() {
|
||||||
return mtbColtsSessions.size() > 0;
|
return mtbColtsSessions != null && mtbColtsSessions.size() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Integer> getAllSessionIDs() {
|
public List<Integer> getAllSessionIDs() {
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import androidx.room.Database;
|
|||||||
import androidx.room.RoomDatabase;
|
import androidx.room.RoomDatabase;
|
||||||
import androidx.room.TypeConverters;
|
import androidx.room.TypeConverters;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.converter.BigDecimalConverter;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.converter.DateConverter;
|
import it.integry.integrywmsnative.core.data_store.db.converter.DateConverter;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.dao.ArticoloGrigliaDao;
|
import it.integry.integrywmsnative.core.data_store.db.dao.ArticoloGrigliaDao;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.dao.ArticoloOrdineDao;
|
import it.integry.integrywmsnative.core.data_store.db.dao.ArticoloOrdineDao;
|
||||||
@@ -18,14 +19,13 @@ import it.integry.integrywmsnative.core.data_store.db.entity.Ordine;
|
|||||||
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColr;
|
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColr;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColt;
|
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColt;
|
||||||
|
|
||||||
@Database(entities = {ArticoloGriglia.class, Griglia.class, Ordine.class, ArticoloOrdine.class, SqlMtbColt.class, SqlMtbColr.class}, version = 5, exportSchema = false)
|
@Database(entities = {ArticoloGriglia.class, Griglia.class, Ordine.class, ArticoloOrdine.class, SqlMtbColt.class, SqlMtbColr.class}, version = 9, exportSchema = false)
|
||||||
@TypeConverters({
|
@TypeConverters({
|
||||||
DateConverter.class
|
DateConverter.class,
|
||||||
|
BigDecimalConverter.class
|
||||||
})
|
})
|
||||||
public abstract class AppDatabase extends RoomDatabase {
|
public abstract class AppDatabase extends RoomDatabase {
|
||||||
|
|
||||||
// private AppDatabase mRoomInstance;
|
|
||||||
|
|
||||||
public abstract ArticoloGrigliaDao articoloGrigliaDao();
|
public abstract ArticoloGrigliaDao articoloGrigliaDao();
|
||||||
|
|
||||||
public abstract GrigliaDao grigliaDao();
|
public abstract GrigliaDao grigliaDao();
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package it.integry.integrywmsnative.core.data_store.db.converter;
|
||||||
|
|
||||||
|
import androidx.room.TypeConverter;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
public class BigDecimalConverter {
|
||||||
|
@TypeConverter
|
||||||
|
public static BigDecimal fromFloat(Float value) {
|
||||||
|
return value == null ? null : BigDecimal.valueOf(value.doubleValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
@TypeConverter
|
||||||
|
public static Float dateToTimestamp(BigDecimal value) {
|
||||||
|
return value == null ? null : value.floatValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,9 +4,10 @@ import androidx.room.Dao;
|
|||||||
import androidx.room.Delete;
|
import androidx.room.Delete;
|
||||||
import androidx.room.Insert;
|
import androidx.room.Insert;
|
||||||
import androidx.room.Query;
|
import androidx.room.Query;
|
||||||
|
import androidx.room.RawQuery;
|
||||||
import androidx.room.Update;
|
import androidx.room.Update;
|
||||||
|
import androidx.sqlite.db.SupportSQLiteQuery;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.data_store.db.entity.ArticoloGriglia;
|
import it.integry.integrywmsnative.core.data_store.db.entity.ArticoloGriglia;
|
||||||
@@ -21,10 +22,13 @@ public interface ArticoloGrigliaDao {
|
|||||||
|
|
||||||
@Insert
|
@Insert
|
||||||
void insertAll(List<ArticoloGriglia> articoli);
|
void insertAll(List<ArticoloGriglia> articoli);
|
||||||
|
|
||||||
@Insert
|
@Insert
|
||||||
Long insert(ArticoloGriglia articolo);
|
Long insert(ArticoloGriglia articolo);
|
||||||
|
|
||||||
@Update
|
@Update
|
||||||
void updateAll(List<ArticoloGriglia> articoli);
|
void updateAll(List<ArticoloGriglia> articoli);
|
||||||
|
|
||||||
@Update
|
@Update
|
||||||
void update(ArticoloGriglia articolo);
|
void update(ArticoloGriglia articolo);
|
||||||
|
|
||||||
@@ -37,12 +41,18 @@ public interface ArticoloGrigliaDao {
|
|||||||
@Query("SELECT * FROM articoli_griglia WHERE cod_mart = :codMart AND id_griglia = :idGriglia LIMIT 1")
|
@Query("SELECT * FROM articoli_griglia WHERE cod_mart = :codMart AND id_griglia = :idGriglia LIMIT 1")
|
||||||
ArticoloGriglia findArticoloByCodMartAndGriglia(String codMart, int idGriglia);
|
ArticoloGriglia findArticoloByCodMartAndGriglia(String codMart, int idGriglia);
|
||||||
|
|
||||||
@Query("SELECT * FROM articoli_griglia WHERE (cod_mart = :scan OR bar_code =:scan )AND id_griglia = :idGriglia LIMIT 1")
|
@Query("SELECT * FROM articoli_griglia WHERE (cod_mart = :scan OR bar_code =:scan) AND id_griglia = :idGriglia LIMIT 1")
|
||||||
ArticoloGriglia findArticoloByScanAndGriglia(String scan, int idGriglia);
|
ArticoloGriglia findArticoloByScanAndGriglia(String scan, int idGriglia);
|
||||||
|
|
||||||
@Query("SELECT articolo_griglia_id FROM articoli_griglia WHERE (cod_mart = :codMart AND bar_code =:barCode )AND id_griglia = :idGriglia LIMIT 1")
|
@Query("SELECT articolo_griglia_id FROM articoli_griglia WHERE (cod_mart = :codMart AND bar_code =:barCode) AND id_griglia = :idGriglia LIMIT 1")
|
||||||
Integer getIdArticoloByGrigliaAndBarcodeAndCodMart(int idGriglia, String barCode, String codMart);
|
Integer getIdArticoloByGrigliaAndBarcodeAndCodMart(int idGriglia, String barCode, String codMart);
|
||||||
|
|
||||||
|
@RawQuery(observedEntities = ArticoloGriglia.class)
|
||||||
|
List<ArticoloGriglia> getArticoli(SupportSQLiteQuery query);
|
||||||
|
|
||||||
@Query("SELECT * FROM articoli_griglia WHERE id_griglia = :grigliaId")
|
@Query("SELECT * FROM articoli_griglia WHERE id_griglia = :grigliaId")
|
||||||
List<ArticoloGriglia> getArticoliFromGriglia(int grigliaId);
|
List<ArticoloGriglia> getArticoliFromGriglia(int grigliaId);
|
||||||
|
|
||||||
|
@Query("SELECT * FROM articoli_griglia WHERE id_griglia = :grigliaId AND new_no_promo = 1")
|
||||||
|
List<ArticoloGriglia> getNewArticoliInGriglia(int grigliaId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,9 +8,8 @@ import androidx.room.Update;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.data_store.db.entity.ArticoloGriglia;
|
|
||||||
import it.integry.integrywmsnative.core.data_store.db.entity.ArticoloOrdine;
|
import it.integry.integrywmsnative.core.data_store.db.entity.ArticoloOrdine;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.entity.Ordine;
|
import it.integry.integrywmsnative.core.data_store.db.wrappers.ArticoloOrdineWrapper;
|
||||||
|
|
||||||
@Dao
|
@Dao
|
||||||
public interface ArticoloOrdineDao {
|
public interface ArticoloOrdineDao {
|
||||||
@@ -34,8 +33,17 @@ public interface ArticoloOrdineDao {
|
|||||||
@Update
|
@Update
|
||||||
void update(ArticoloOrdine articolo);
|
void update(ArticoloOrdine articolo);
|
||||||
|
|
||||||
@Query("SELECT * FROM articoli_ordine where id_ordine = :ordineId")
|
@Query("SELECT articoli_ordine.*," +
|
||||||
List<ArticoloOrdine> findArticoliByOrdine(int ordineId);
|
"articoli_griglia.gg_scadenza," +
|
||||||
|
"articoli_griglia.giacenza," +
|
||||||
|
"articoli_griglia.qta_prevista_vendita," +
|
||||||
|
"articoli_griglia.qta_proposta " +
|
||||||
|
"FROM articoli_ordine " +
|
||||||
|
"INNER JOIN ordini on articoli_ordine.id_ordine = ordini.ordine_id " +
|
||||||
|
"LEFT OUTER JOIN articoli_griglia " +
|
||||||
|
"on articoli_ordine.cod_mart = articoli_griglia.cod_mart and ordini.id_griglia = articoli_griglia.id_griglia and articoli_ordine.bar_code = articoli_griglia.bar_code " +
|
||||||
|
"where id_ordine = :ordineId")
|
||||||
|
List<ArticoloOrdineWrapper> findArticoliByOrdine(int ordineId);
|
||||||
|
|
||||||
@Query("SELECt * from articoli_ordine where cod_mart = :codMart and id_ordine = :ordineId LIMIT 1")
|
@Query("SELECt * from articoli_ordine where cod_mart = :codMart and id_ordine = :ordineId LIMIT 1")
|
||||||
ArticoloOrdine findArticoloByCodMartAndOrdine(int ordineId, String codMart);
|
ArticoloOrdine findArticoloByCodMartAndOrdine(int ordineId, String codMart);
|
||||||
|
|||||||
@@ -6,7 +6,10 @@ import androidx.room.ForeignKey;
|
|||||||
import androidx.room.Index;
|
import androidx.room.Index;
|
||||||
import androidx.room.PrimaryKey;
|
import androidx.room.PrimaryKey;
|
||||||
|
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||||
|
|
||||||
@@ -27,7 +30,7 @@ import it.integry.integrywmsnative.core.utility.UtilityDate;
|
|||||||
public class ArticoloGriglia {
|
public class ArticoloGriglia {
|
||||||
@PrimaryKey(autoGenerate = true)
|
@PrimaryKey(autoGenerate = true)
|
||||||
@ColumnInfo(name = "articolo_griglia_id")
|
@ColumnInfo(name = "articolo_griglia_id")
|
||||||
private int articoloGrigliaId;
|
private Integer articoloGrigliaId;
|
||||||
|
|
||||||
@ColumnInfo(name = "cod_mart")
|
@ColumnInfo(name = "cod_mart")
|
||||||
private String codMart;
|
private String codMart;
|
||||||
@@ -71,11 +74,14 @@ public class ArticoloGriglia {
|
|||||||
@ColumnInfo(name = "id_griglia")
|
@ColumnInfo(name = "id_griglia")
|
||||||
private int idGriglia;
|
private int idGriglia;
|
||||||
|
|
||||||
public int getArticoloGrigliaId() {
|
@ColumnInfo(name = "new_no_promo")
|
||||||
|
private boolean newNoPromo = false;
|
||||||
|
|
||||||
|
public Integer getArticoloGrigliaId() {
|
||||||
return articoloGrigliaId;
|
return articoloGrigliaId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setArticoloGrigliaId(int articoloGrigliaId) {
|
public void setArticoloGrigliaId(Integer articoloGrigliaId) {
|
||||||
this.articoloGrigliaId = articoloGrigliaId;
|
this.articoloGrigliaId = articoloGrigliaId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -191,6 +197,22 @@ public class ArticoloGriglia {
|
|||||||
this.qtaProposta = qtaProposta;
|
this.qtaProposta = qtaProposta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isNewNoPromo() {
|
||||||
|
return newNoPromo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNewNoPromo(boolean newNoPromo) {
|
||||||
|
this.newNoPromo = newNoPromo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String generateSystemNote() {
|
||||||
|
HashMap<String, String> pairs = new HashMap<>();
|
||||||
|
pairs.put("qta_proposta", String.valueOf(qtaProposta));
|
||||||
|
pairs.put("giacenza", String.valueOf(giacenza));
|
||||||
|
|
||||||
|
return new JSONObject(pairs).toString();
|
||||||
|
}
|
||||||
|
|
||||||
public ArticoloOrdine convertToArticoloOrdine(Ordine ordine) {
|
public ArticoloOrdine convertToArticoloOrdine(Ordine ordine) {
|
||||||
ArticoloOrdine articolo = new ArticoloOrdine();
|
ArticoloOrdine articolo = new ArticoloOrdine();
|
||||||
|
|
||||||
@@ -210,6 +232,8 @@ public class ArticoloGriglia {
|
|||||||
articolo.setGiacenza(BigDecimal.valueOf(this.getGiacenza()));
|
articolo.setGiacenza(BigDecimal.valueOf(this.getGiacenza()));
|
||||||
articolo.setQtaPrevistaVendita(BigDecimal.valueOf(this.getQtaPrevistaVendita()));
|
articolo.setQtaPrevistaVendita(BigDecimal.valueOf(this.getQtaPrevistaVendita()));
|
||||||
articolo.setQtaProposta(BigDecimal.valueOf(this.getQtaProposta()));
|
articolo.setQtaProposta(BigDecimal.valueOf(this.getQtaProposta()));
|
||||||
|
articolo.setNewNoPromo(this.isNewNoPromo());
|
||||||
|
articolo.setSystemNote(generateSystemNote());
|
||||||
|
|
||||||
articolo.setQtaOrd(0);
|
articolo.setQtaOrd(0);
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ import java.util.Date;
|
|||||||
public class ArticoloOrdine {
|
public class ArticoloOrdine {
|
||||||
@PrimaryKey(autoGenerate = true)
|
@PrimaryKey(autoGenerate = true)
|
||||||
@ColumnInfo(name = "articolo_ordine_id")
|
@ColumnInfo(name = "articolo_ordine_id")
|
||||||
private int articoloOrdineId;
|
private Integer articoloOrdineId;
|
||||||
|
|
||||||
@ColumnInfo(name = "cod_mart")
|
@ColumnInfo(name = "cod_mart")
|
||||||
private String codMart;
|
private String codMart;
|
||||||
@@ -67,6 +67,11 @@ public class ArticoloOrdine {
|
|||||||
@ColumnInfo(name = "data_ins")
|
@ColumnInfo(name = "data_ins")
|
||||||
private Date dataIns;
|
private Date dataIns;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "new_no_promo")
|
||||||
|
private boolean newNoPromo;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "system_note")
|
||||||
|
private String systemNote;
|
||||||
|
|
||||||
@Ignore
|
@Ignore
|
||||||
private int ggScadenza = 0;
|
private int ggScadenza = 0;
|
||||||
@@ -80,12 +85,15 @@ public class ArticoloOrdine {
|
|||||||
@Ignore
|
@Ignore
|
||||||
private BigDecimal qtaProposta = BigDecimal.ZERO;
|
private BigDecimal qtaProposta = BigDecimal.ZERO;
|
||||||
|
|
||||||
|
@Ignore
|
||||||
|
private int bgTint;
|
||||||
|
|
||||||
public int getArticoloOrdineId() {
|
|
||||||
|
public Integer getArticoloOrdineId() {
|
||||||
return articoloOrdineId;
|
return articoloOrdineId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setArticoloOrdineId(int articoloOrdineId) {
|
public void setArticoloOrdineId(Integer articoloOrdineId) {
|
||||||
this.articoloOrdineId = articoloOrdineId;
|
this.articoloOrdineId = articoloOrdineId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -221,14 +229,52 @@ public class ArticoloOrdine {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getQtaCnfPrevistaVendita(){
|
public BigDecimal getQtaCnfPrevistaVendita() {
|
||||||
return qtaPrevistaVendita.equals(BigDecimal.ZERO) ? BigDecimal.ZERO : qtaPrevistaVendita.divide(BigDecimal.valueOf(qtaCnf),0, RoundingMode.CEILING);
|
return qtaPrevistaVendita.equals(BigDecimal.ZERO) ? BigDecimal.ZERO : qtaPrevistaVendita.divide(BigDecimal.valueOf(qtaCnf), 0, RoundingMode.CEILING);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getQtaCnfProposta(){
|
public BigDecimal getQtaCnfProposta() {
|
||||||
return qtaProposta.equals(BigDecimal.ZERO) ? BigDecimal.ZERO : qtaProposta.divide(BigDecimal.valueOf(qtaCnf),0, RoundingMode.CEILING);
|
return qtaProposta.equals(BigDecimal.ZERO) ? BigDecimal.ZERO : qtaProposta.divide(BigDecimal.valueOf(qtaCnf), 0, RoundingMode.CEILING);
|
||||||
}
|
}
|
||||||
public BigDecimal getQtaCnfGiacenza(){
|
|
||||||
return giacenza.equals(BigDecimal.ZERO) ? BigDecimal.ZERO : giacenza.divide(BigDecimal.valueOf(qtaCnf),0, RoundingMode.CEILING);
|
public BigDecimal getQtaCnfGiacenza() {
|
||||||
|
return giacenza.equals(BigDecimal.ZERO) ? BigDecimal.ZERO : giacenza.divide(BigDecimal.valueOf(qtaCnf), 0, RoundingMode.CEILING);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isNewNoPromo() {
|
||||||
|
return newNoPromo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNewNoPromo(boolean newNoPromo) {
|
||||||
|
this.newNoPromo = newNoPromo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getCnfDaRic() {
|
||||||
|
return qtaCnf > 0.f ? merceDaRic * qtaCnf : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int checkQtaProposta() {
|
||||||
|
int check = 0;
|
||||||
|
if (!qtaProposta.equals(BigDecimal.ZERO)) {
|
||||||
|
check = BigDecimal.valueOf(qtaOrd).compareTo(qtaProposta);
|
||||||
|
}
|
||||||
|
return check;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getBgTint() {
|
||||||
|
return bgTint;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArticoloOrdine setBgTint(int bgTint) {
|
||||||
|
this.bgTint = bgTint;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSystemNote() {
|
||||||
|
return systemNote;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSystemNote(String systemNote) {
|
||||||
|
this.systemNote = systemNote;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,4 +16,6 @@ public interface ArticoloGrigliaRepository {
|
|||||||
|
|
||||||
void findArticoloByScanAndGriglia(String scan, int idGriglia, RunnableArgs<ArticoloGriglia> onSuccess, RunnableArgs<Exception> onFail);
|
void findArticoloByScanAndGriglia(String scan, int idGriglia, RunnableArgs<ArticoloGriglia> onSuccess, RunnableArgs<Exception> onFail);
|
||||||
|
|
||||||
|
void findNewArticoliInGrigla(int idGriglia, RunnableArgs<List<ArticoloGriglia>> onSuccess, RunnableArgs<Exception> onFail);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,14 @@ import com.annimon.stream.Stream;
|
|||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.Callable;
|
||||||
|
import java.util.concurrent.ExecutionException;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
import java.util.concurrent.Future;
|
||||||
|
import java.util.concurrent.ThreadPoolExecutor;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
@@ -24,27 +31,21 @@ public class ArticoliGrigliaDataSource extends Repository implements ArticoloGri
|
|||||||
this.mArticoloGrigliaDao = articoloGrigliaDao;
|
this.mArticoloGrigliaDao = articoloGrigliaDao;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void saveArticoliToGriglia(List<ArticoloGriglia> articoli, Griglia griglia, Runnable onSuccess, RunnableArgs<Exception> onFail) {
|
public void saveArticoliToGriglia(List<ArticoloGriglia> updatedArts, Griglia griglia, Runnable onSuccess, RunnableArgs<Exception> onFail) {
|
||||||
execute(() -> {
|
execute(() -> {
|
||||||
try {
|
try {
|
||||||
List<ArticoloGriglia> toUpdate = new ArrayList<>();
|
var tmp = calcItemsToInsertAndUpdate(updatedArts);
|
||||||
List<ArticoloGriglia> toInsert = new ArrayList<>();
|
var toInsert = (List<ArticoloGriglia>) tmp.get("toInsert");
|
||||||
List<String> codMarts = new ArrayList<>();
|
var toUpdate = (List<ArticoloGriglia>) tmp.get("toUpdate");
|
||||||
for (ArticoloGriglia art : articoli) {
|
var codMarts = (List<String>) tmp.get("codMarts");
|
||||||
Integer id = mArticoloGrigliaDao.getIdArticoloByGrigliaAndBarcodeAndCodMart(griglia.getGrigliaId(), art.getBarCode(), art.getCodMart());
|
|
||||||
codMarts.add(art.getCodMart());
|
|
||||||
if (id != null) {
|
|
||||||
art.setArticoloGrigliaId(id);
|
|
||||||
toUpdate.add(art);
|
|
||||||
} else {
|
|
||||||
toInsert.add(art);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
mArticoloGrigliaDao.insertAll(toInsert);
|
mArticoloGrigliaDao.insertAll(toInsert);
|
||||||
mArticoloGrigliaDao.updateAll(toUpdate);
|
mArticoloGrigliaDao.updateAll(toUpdate);
|
||||||
|
|
||||||
List<ArticoloGriglia> articoliGriglia = mArticoloGrigliaDao.getArticoliFromGriglia(griglia.getGrigliaId());
|
List<ArticoloGriglia> articoliGriglia = mArticoloGrigliaDao.getArticoliFromGriglia(griglia.getGrigliaId());
|
||||||
List<ArticoloGriglia> toDelete = Stream.of(articoliGriglia).filter(articolo -> !codMarts.contains(articolo.getCodMart())).toList();
|
List<ArticoloGriglia> toDelete = Stream.of(articoliGriglia).filter(articolo -> !codMarts.contains(articolo.getCodMart())).toList();
|
||||||
mArticoloGrigliaDao.deleteList(toDelete);
|
mArticoloGrigliaDao.deleteList(toDelete);
|
||||||
|
|
||||||
onSuccess.run();
|
onSuccess.run();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
onFail.run(e);
|
onFail.run(e);
|
||||||
@@ -52,6 +53,52 @@ public class ArticoliGrigliaDataSource extends Repository implements ArticoloGri
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private HashMap<String, Object> calcItemsToInsertAndUpdate(List<ArticoloGriglia> updatedArts) throws InterruptedException, ExecutionException {
|
||||||
|
var toInsert = new ArrayList<ArticoloGriglia>();
|
||||||
|
var toUpdate = new ArrayList<ArticoloGriglia>();
|
||||||
|
var codMarts = new ArrayList<String>();
|
||||||
|
|
||||||
|
int cores = Runtime.getRuntime().availableProcessors();
|
||||||
|
ThreadPoolExecutor executor = (ThreadPoolExecutor) Executors.newFixedThreadPool(cores);
|
||||||
|
List<Callable<ArticoloGriglia>> calls = new ArrayList<>();
|
||||||
|
|
||||||
|
for (int i = 0; i < updatedArts.size(); i++) {
|
||||||
|
int finalI = i;
|
||||||
|
Callable<ArticoloGriglia> callableTask = () -> {
|
||||||
|
var updatedArt = updatedArts.get(finalI);
|
||||||
|
Integer id = mArticoloGrigliaDao.getIdArticoloByGrigliaAndBarcodeAndCodMart(updatedArt.getIdGriglia(), updatedArt.getBarCode(), updatedArt.getCodMart());
|
||||||
|
|
||||||
|
if (id != null) {
|
||||||
|
updatedArt.setArticoloGrigliaId(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
return updatedArt;
|
||||||
|
};
|
||||||
|
|
||||||
|
calls.add(callableTask);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Future<ArticoloGriglia>> futures = executor.invokeAll(calls, Long.MAX_VALUE, TimeUnit.MILLISECONDS);
|
||||||
|
|
||||||
|
for (Future<ArticoloGriglia> future : futures) {
|
||||||
|
if (future.isDone()) {
|
||||||
|
codMarts.add(future.get().getCodMart());
|
||||||
|
if (future.get().getArticoloGrigliaId() == null) toInsert.add(future.get());
|
||||||
|
else toUpdate.add(future.get());
|
||||||
|
} else {
|
||||||
|
future.cancel(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var tmp = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
tmp.put("toInsert", toInsert);
|
||||||
|
tmp.put("toUpdate", toUpdate);
|
||||||
|
tmp.put("codMarts", codMarts);
|
||||||
|
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
|
|
||||||
public void findArticoloByBarcodeAndGriglia(String barcode, int idGriglia, RunnableArgs<ArticoloGriglia> onSuccess, RunnableArgs<Exception> onFail) {
|
public void findArticoloByBarcodeAndGriglia(String barcode, int idGriglia, RunnableArgs<ArticoloGriglia> onSuccess, RunnableArgs<Exception> onFail) {
|
||||||
execute(() -> {
|
execute(() -> {
|
||||||
try {
|
try {
|
||||||
@@ -89,4 +136,14 @@ public class ArticoliGrigliaDataSource extends Repository implements ArticoloGri
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void findNewArticoliInGrigla(int idGriglia, RunnableArgs<List<ArticoloGriglia>> onSuccess, RunnableArgs<Exception> onFail) {
|
||||||
|
execute(() -> {
|
||||||
|
try {
|
||||||
|
onSuccess.run(mArticoloGrigliaDao.getNewArticoliInGriglia(idGriglia));
|
||||||
|
} catch (Exception e) {
|
||||||
|
onFail.run(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package it.integry.integrywmsnative.core.data_store.db.repository.implementations;
|
package it.integry.integrywmsnative.core.data_store.db.repository.implementations;
|
||||||
|
|
||||||
|
import com.annimon.stream.Stream;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -11,6 +13,7 @@ import it.integry.integrywmsnative.core.data_store.db.dao.ArticoloOrdineDao;
|
|||||||
import it.integry.integrywmsnative.core.data_store.db.entity.ArticoloOrdine;
|
import it.integry.integrywmsnative.core.data_store.db.entity.ArticoloOrdine;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.entity.Ordine;
|
import it.integry.integrywmsnative.core.data_store.db.entity.Ordine;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.repository.ArticoliOrdineRepository;
|
import it.integry.integrywmsnative.core.data_store.db.repository.ArticoliOrdineRepository;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.wrappers.ArticoloOrdineWrapper;
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
|
|
||||||
public class ArticoliOrdineDataSource extends Repository implements ArticoliOrdineRepository {
|
public class ArticoliOrdineDataSource extends Repository implements ArticoliOrdineRepository {
|
||||||
@@ -28,13 +31,15 @@ public class ArticoliOrdineDataSource extends Repository implements ArticoliOrdi
|
|||||||
List<ArticoloOrdine> toUpdate = new ArrayList<>();
|
List<ArticoloOrdine> toUpdate = new ArrayList<>();
|
||||||
List<ArticoloOrdine> toInsert = new ArrayList<>();
|
List<ArticoloOrdine> toInsert = new ArrayList<>();
|
||||||
for (ArticoloOrdine art : articoli) {
|
for (ArticoloOrdine art : articoli) {
|
||||||
if (art.getArticoloOrdineId() > 0) {
|
if (art.getArticoloOrdineId() != null && art.getArticoloOrdineId() > 0) {
|
||||||
toUpdate.add(art);
|
toUpdate.add(art);
|
||||||
} else {
|
} else {
|
||||||
toInsert.add(art);
|
toInsert.add(art);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mArticoloOrdineDao.insertAll(toInsert);
|
for (ArticoloOrdine newArt : toInsert) {
|
||||||
|
mArticoloOrdineDao.insert(newArt);
|
||||||
|
}
|
||||||
mArticoloOrdineDao.updateAll(toUpdate);
|
mArticoloOrdineDao.updateAll(toUpdate);
|
||||||
onSuccess.run();
|
onSuccess.run();
|
||||||
|
|
||||||
@@ -48,7 +53,7 @@ public class ArticoliOrdineDataSource extends Repository implements ArticoliOrdi
|
|||||||
public void saveArticoloToOrdine(ArticoloOrdine articolo, Runnable onSuccess, RunnableArgs<Exception> onFail) {
|
public void saveArticoloToOrdine(ArticoloOrdine articolo, Runnable onSuccess, RunnableArgs<Exception> onFail) {
|
||||||
execute(() -> {
|
execute(() -> {
|
||||||
try {
|
try {
|
||||||
if (articolo.getArticoloOrdineId() > 0) {
|
if (articolo.getArticoloOrdineId() != null && articolo.getArticoloOrdineId() > 0) {
|
||||||
mArticoloOrdineDao.update(articolo);
|
mArticoloOrdineDao.update(articolo);
|
||||||
} else {
|
} else {
|
||||||
mArticoloOrdineDao.insert(articolo);
|
mArticoloOrdineDao.insert(articolo);
|
||||||
@@ -93,7 +98,15 @@ public class ArticoliOrdineDataSource extends Repository implements ArticoliOrdi
|
|||||||
public void findArticoliByOrdine(Ordine ordine, RunnableArgs<List<ArticoloOrdine>> onLoad, RunnableArgs<Exception> onError) {
|
public void findArticoliByOrdine(Ordine ordine, RunnableArgs<List<ArticoloOrdine>> onLoad, RunnableArgs<Exception> onError) {
|
||||||
execute(() -> {
|
execute(() -> {
|
||||||
try {
|
try {
|
||||||
onLoad.run(mArticoloOrdineDao.findArticoliByOrdine(ordine.getOrdineId()));
|
List<ArticoloOrdineWrapper> list = mArticoloOrdineDao.findArticoliByOrdine(ordine.getOrdineId());
|
||||||
|
onLoad.run(Stream.of(list).map(x -> {
|
||||||
|
ArticoloOrdine art = x.getArticoloOrdine();
|
||||||
|
art.setGgScadenza(x.getGgScadenza());
|
||||||
|
art.setGiacenza(x.getGiacenza());
|
||||||
|
art.setQtaProposta(x.getQtaProposta());
|
||||||
|
art.setQtaPrevistaVendita(x.getQtaPrevistaVendita());
|
||||||
|
return art;
|
||||||
|
}).toList());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
onError.run(e);
|
onError.run(e);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,35 +1,23 @@
|
|||||||
package it.integry.integrywmsnative.core.data_store.db.view_model;
|
package it.integry.integrywmsnative.core.data_store.db.view_model;
|
||||||
|
|
||||||
import androidx.room.ColumnInfo;
|
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.data_store.db.entity.ArticoloGriglia;
|
import it.integry.integrywmsnative.core.data_store.db.entity.ArticoloGriglia;
|
||||||
|
|
||||||
public class ArticoloDTO {
|
public class ArticoloDTO {
|
||||||
|
|
||||||
private String codMart;
|
public String codMart;
|
||||||
|
public String descrizione;
|
||||||
private String descrizione;
|
public String untMis;
|
||||||
|
public float qtaCnf;
|
||||||
private String untMis;
|
public String barcode;
|
||||||
|
public float merceDaRic;
|
||||||
private String barcode;
|
public float mediaSett;
|
||||||
|
public String flagQtaMultipla;
|
||||||
private String flagQtaMultipla;
|
public String flagTracciabilita;
|
||||||
|
public float qtaMinOrdinabile;
|
||||||
private float qtaCnf;
|
public boolean newNoPromo;
|
||||||
|
|
||||||
private float merceDaRic;
|
|
||||||
|
|
||||||
private float mediaSett;
|
|
||||||
|
|
||||||
private float qtaMinOrdinabile;
|
|
||||||
|
|
||||||
private int ggScadenza;
|
private int ggScadenza;
|
||||||
|
|
||||||
private float giacenza;
|
private float giacenza;
|
||||||
|
|
||||||
private float qtaPrevistaVendita;
|
private float qtaPrevistaVendita;
|
||||||
|
|
||||||
private float qtaProposta;
|
private float qtaProposta;
|
||||||
|
|
||||||
|
|
||||||
@@ -145,6 +133,24 @@ public class ArticoloDTO {
|
|||||||
this.qtaProposta = qtaProposta;
|
this.qtaProposta = qtaProposta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getFlagTracciabilita() {
|
||||||
|
return flagTracciabilita;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArticoloDTO setFlagTracciabilita(String flagTracciabilita) {
|
||||||
|
this.flagTracciabilita = flagTracciabilita;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isNewNoPromo() {
|
||||||
|
return newNoPromo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArticoloDTO setNewNoPromo(boolean newNoPromo) {
|
||||||
|
this.newNoPromo = newNoPromo;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public ArticoloGriglia toArticoloGriglia() {
|
public ArticoloGriglia toArticoloGriglia() {
|
||||||
ArticoloGriglia result = new ArticoloGriglia();
|
ArticoloGriglia result = new ArticoloGriglia();
|
||||||
result.setBarCode(this.getBarCode());
|
result.setBarCode(this.getBarCode());
|
||||||
@@ -157,6 +163,7 @@ public class ArticoloDTO {
|
|||||||
result.setFlagQtaMultipla(this.getFlagQtaMultipla());
|
result.setFlagQtaMultipla(this.getFlagQtaMultipla());
|
||||||
result.setQtaMinOrdinabile(this.getQtaMinOrdinabile());
|
result.setQtaMinOrdinabile(this.getQtaMinOrdinabile());
|
||||||
result.setGgScadenza(this.ggScadenza);
|
result.setGgScadenza(this.ggScadenza);
|
||||||
|
result.setNewNoPromo(this.newNoPromo);
|
||||||
result.setGiacenza(this.giacenza);
|
result.setGiacenza(this.giacenza);
|
||||||
result.setQtaPrevistaVendita(this.qtaPrevistaVendita);
|
result.setQtaPrevistaVendita(this.qtaPrevistaVendita);
|
||||||
result.setQtaProposta(this.qtaProposta);
|
result.setQtaProposta(this.qtaProposta);
|
||||||
|
|||||||
@@ -0,0 +1,65 @@
|
|||||||
|
package it.integry.integrywmsnative.core.data_store.db.wrappers;
|
||||||
|
|
||||||
|
import androidx.room.ColumnInfo;
|
||||||
|
import androidx.room.Embedded;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.entity.ArticoloOrdine;
|
||||||
|
|
||||||
|
public class ArticoloOrdineWrapper {
|
||||||
|
@Embedded
|
||||||
|
private ArticoloOrdine articoloOrdine;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "gg_scadenza")
|
||||||
|
private int ggScadenza = 0;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "giacenza")
|
||||||
|
private BigDecimal giacenza = BigDecimal.ZERO;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "qta_prevista_vendita")
|
||||||
|
private BigDecimal qtaPrevistaVendita = BigDecimal.ZERO;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "qta_proposta")
|
||||||
|
private BigDecimal qtaProposta = BigDecimal.ZERO;
|
||||||
|
|
||||||
|
public ArticoloOrdine getArticoloOrdine() {
|
||||||
|
return articoloOrdine;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setArticoloOrdine(ArticoloOrdine articoloOrdine) {
|
||||||
|
this.articoloOrdine = articoloOrdine;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getGgScadenza() {
|
||||||
|
return ggScadenza;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGgScadenza(int ggScadenza) {
|
||||||
|
this.ggScadenza = ggScadenza;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getGiacenza() {
|
||||||
|
return giacenza;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGiacenza(BigDecimal giacenza) {
|
||||||
|
this.giacenza = giacenza;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getQtaPrevistaVendita() {
|
||||||
|
return qtaPrevistaVendita;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQtaPrevistaVendita(BigDecimal qtaPrevistaVendita) {
|
||||||
|
this.qtaPrevistaVendita = qtaPrevistaVendita;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getQtaProposta() {
|
||||||
|
return qtaProposta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQtaProposta(BigDecimal qtaProposta) {
|
||||||
|
this.qtaProposta = qtaProposta;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package it.integry.integrywmsnative.core.exception;
|
||||||
|
|
||||||
|
public class BluetoothConnectionException extends Exception {
|
||||||
|
|
||||||
|
public BluetoothConnectionException(String btDeviceName, String btDeviceMac, Throwable th) {
|
||||||
|
super("Impossibile collegarsi al dispositivo bluetooth: " + btDeviceName + " [" + btDeviceMac + "]. Riprovare.");
|
||||||
|
initCause(th);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package it.integry.integrywmsnative.core.exception;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
public class InvalidConnectionException extends Exception {
|
||||||
|
|
||||||
|
|
||||||
|
public InvalidConnectionException(String host, int port, Throwable cause) {
|
||||||
|
super(String.format(Locale.ITALY, "Impossibile stabilire la connessione con il server (%s:%d)", host, port), cause);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -4,7 +4,12 @@ import it.integry.integrywmsnative.R;
|
|||||||
import it.integry.integrywmsnative.core.utility.UtilityResources;
|
import it.integry.integrywmsnative.core.utility.UtilityResources;
|
||||||
|
|
||||||
public final class NoResultFromBarcodeException extends Exception {
|
public final class NoResultFromBarcodeException extends Exception {
|
||||||
|
|
||||||
public NoResultFromBarcodeException() {
|
public NoResultFromBarcodeException() {
|
||||||
super(UtilityResources.getString(R.string.no_result_from_barcode));
|
super(UtilityResources.getString(R.string.no_result_from_barcode));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public NoResultFromBarcodeException(String barcode) {
|
||||||
|
super(UtilityResources.getString(R.string.no_result_from_barcode) + " (" + barcode + ")");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package it.integry.integrywmsnative.core.exception;
|
||||||
|
|
||||||
|
public class NotValidLicenseException extends Exception {
|
||||||
|
|
||||||
|
public NotValidLicenseException() {
|
||||||
|
super("Licenza non valida");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,21 +1,78 @@
|
|||||||
package it.integry.integrywmsnative.core.expansion;
|
package it.integry.integrywmsnative.core.expansion;
|
||||||
|
|
||||||
import android.app.Dialog;
|
import android.content.Context;
|
||||||
|
import android.util.AttributeSet;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.MainApplication;
|
||||||
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityProgress;
|
import it.integry.integrywmsnative.view.dialogs.DialogProgressView;
|
||||||
|
|
||||||
public class BaseActivity extends AppCompatActivity {
|
public class BaseActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public DialogProgressView mCurrentProgress;
|
||||||
|
|
||||||
protected Dialog mCurrentProgress;
|
private boolean progressOpened;
|
||||||
|
|
||||||
public BaseActivity() {
|
@Nullable
|
||||||
//Thread.setDefaultUncaughtExceptionHandler(new MyExceptionHandler(this, BaseActivity.class));
|
@Override
|
||||||
|
public View onCreateView(@Nullable View parent, @NonNull String name, @NonNull Context context, @NonNull AttributeSet attrs) {
|
||||||
|
var v = super.onCreateView(parent, name, context, attrs);
|
||||||
|
|
||||||
|
MainApplication.appComponent
|
||||||
|
.baseActivityComponent()
|
||||||
|
.create()
|
||||||
|
.inject(this);
|
||||||
|
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onLoadingStarted() {
|
||||||
|
BarcodeManager.disable();
|
||||||
|
this.openProgress();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onLoadingEnded() {
|
||||||
|
this.closeProgress();
|
||||||
|
BarcodeManager.enable();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onError(Exception ex) {
|
||||||
|
this.runOnUiThread(() -> {
|
||||||
|
this.closeProgress();
|
||||||
|
UtilityExceptions.defaultException(this, ex, mCurrentProgress);
|
||||||
|
BarcodeManager.enable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void openProgress() {
|
||||||
|
BarcodeManager.disable();
|
||||||
|
if (!progressOpened && !this.mCurrentProgress.isAdded()) {
|
||||||
|
this.progressOpened = true;
|
||||||
|
runOnUiThread(() -> {
|
||||||
|
this.mCurrentProgress.show(getSupportFragmentManager(), "tag");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void closeProgress() {
|
||||||
|
BarcodeManager.enable();
|
||||||
|
if (progressOpened) {
|
||||||
|
this.progressOpened = false;
|
||||||
|
runOnUiThread(() -> {
|
||||||
|
mCurrentProgress.dismiss();
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -38,46 +95,4 @@ public class BaseActivity extends AppCompatActivity {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected void openProgress() {
|
|
||||||
runOnUiThread(() -> {
|
|
||||||
BarcodeManager.disable();
|
|
||||||
if (this.mCurrentProgress == null) {
|
|
||||||
this.mCurrentProgress = UtilityProgress.createDefaultProgressDialog(this);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void closeProgress() {
|
|
||||||
runOnUiThread(() -> {
|
|
||||||
BarcodeManager.enable();
|
|
||||||
if (mCurrentProgress != null) {
|
|
||||||
mCurrentProgress.dismiss();
|
|
||||||
mCurrentProgress = null;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void onLoadingStarted() {
|
|
||||||
new Thread(() -> {
|
|
||||||
BarcodeManager.disable();
|
|
||||||
this.openProgress();
|
|
||||||
}).start();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onLoadingEnded() {
|
|
||||||
new Thread(() -> {
|
|
||||||
this.closeProgress();
|
|
||||||
BarcodeManager.enable();
|
|
||||||
}).start();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onError(Exception ex) {
|
|
||||||
this.runOnUiThread(() -> {
|
|
||||||
this.closeProgress();
|
|
||||||
UtilityExceptions.defaultException(this, ex, mCurrentProgress);
|
|
||||||
BarcodeManager.enable();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package it.integry.integrywmsnative.core.expansion;
|
||||||
|
|
||||||
|
import dagger.Subcomponent;
|
||||||
|
|
||||||
|
@Subcomponent
|
||||||
|
public interface BaseActivityComponent {
|
||||||
|
|
||||||
|
@Subcomponent.Factory
|
||||||
|
interface Factory {
|
||||||
|
BaseActivityComponent create();
|
||||||
|
}
|
||||||
|
|
||||||
|
void inject(BaseActivity baseActivity);
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package it.integry.integrywmsnative.core.expansion;
|
||||||
|
|
||||||
|
import dagger.Module;
|
||||||
|
|
||||||
|
@Module(subcomponents = BaseActivityComponent.class)
|
||||||
|
public class BaseActivityModule {
|
||||||
|
}
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
package it.integry.integrywmsnative.core.expansion;
|
package it.integry.integrywmsnative.core.expansion;
|
||||||
|
|
||||||
import android.app.Dialog;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
@@ -12,18 +11,21 @@ import androidx.fragment.app.DialogFragment;
|
|||||||
import androidx.fragment.app.FragmentManager;
|
import androidx.fragment.app.FragmentManager;
|
||||||
import androidx.fragment.app.FragmentTransaction;
|
import androidx.fragment.app.FragmentTransaction;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.MainApplication;
|
||||||
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityProgress;
|
import it.integry.integrywmsnative.view.dialogs.DialogProgressView;
|
||||||
|
|
||||||
public class BaseDialogFragment extends DialogFragment {
|
public class BaseDialogFragment extends DialogFragment {
|
||||||
|
|
||||||
private boolean mBarcodeListener = false;
|
@Inject
|
||||||
private Dialog mCurrentProgress;
|
public DialogProgressView mCurrentProgress;
|
||||||
|
private boolean progressOpened;
|
||||||
|
|
||||||
|
private boolean mBarcodeListener = false;
|
||||||
|
|
||||||
public BaseDialogFragment() {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -41,6 +43,11 @@ public class BaseDialogFragment extends DialogFragment {
|
|||||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||||
super.onViewCreated(view, savedInstanceState);
|
super.onViewCreated(view, savedInstanceState);
|
||||||
|
|
||||||
|
MainApplication.appComponent
|
||||||
|
.baseDialogFragmentComponent()
|
||||||
|
.create()
|
||||||
|
.inject(this);
|
||||||
|
|
||||||
if (BarcodeManager.isEnabled() && BarcodeManager.isKeyboardEmulator()) {
|
if (BarcodeManager.isEnabled() && BarcodeManager.isKeyboardEmulator()) {
|
||||||
getDialog().setOnKeyListener((dialog, keyCode, event) -> {
|
getDialog().setOnKeyListener((dialog, keyCode, event) -> {
|
||||||
if (mBarcodeListener && (event.getAction() == KeyEvent.ACTION_DOWN || event.getAction() == KeyEvent.ACTION_MULTIPLE) && !isControlKey(event)) {
|
if (mBarcodeListener && (event.getAction() == KeyEvent.ACTION_DOWN || event.getAction() == KeyEvent.ACTION_MULTIPLE) && !isControlKey(event)) {
|
||||||
@@ -51,6 +58,42 @@ public class BaseDialogFragment extends DialogFragment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onLoadingStarted() {
|
||||||
|
BarcodeManager.disable();
|
||||||
|
this.openProgress();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onLoadingEnded() {
|
||||||
|
this.closeProgress();
|
||||||
|
BarcodeManager.enable();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void openProgress() {
|
||||||
|
if (!progressOpened && !this.mCurrentProgress.isAdded()) {
|
||||||
|
this.progressOpened = true;
|
||||||
|
requireActivity().runOnUiThread(() -> {
|
||||||
|
this.mCurrentProgress.show(requireActivity().getSupportFragmentManager(), "tag");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void closeProgress() {
|
||||||
|
if (progressOpened) {
|
||||||
|
this.progressOpened = false;
|
||||||
|
requireActivity().runOnUiThread(() -> {
|
||||||
|
mCurrentProgress.dismiss();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void onError(Exception ex) {
|
||||||
|
requireActivity().runOnUiThread(() -> {
|
||||||
|
this.onLoadingEnded();
|
||||||
|
UtilityExceptions.defaultException(requireActivity(), ex);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private boolean isControlKey(KeyEvent keyEvent) {
|
private boolean isControlKey(KeyEvent keyEvent) {
|
||||||
int keyCode = keyEvent.getKeyCode();
|
int keyCode = keyEvent.getKeyCode();
|
||||||
return (
|
return (
|
||||||
@@ -65,45 +108,4 @@ public class BaseDialogFragment extends DialogFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void onLoadingStarted() {
|
|
||||||
BarcodeManager.disable();
|
|
||||||
this.openProgress();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onLoadingEnded() {
|
|
||||||
this.closeProgress();
|
|
||||||
BarcodeManager.enable();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void openProgress() {
|
|
||||||
|
|
||||||
// new Thread(() -> {
|
|
||||||
requireActivity().runOnUiThread(() -> {
|
|
||||||
if (this.mCurrentProgress == null) {
|
|
||||||
this.mCurrentProgress = UtilityProgress.createDefaultProgressDialog(getActivity());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
// }).start();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void closeProgress() {
|
|
||||||
// new Thread(() -> {
|
|
||||||
requireActivity().runOnUiThread(() -> {
|
|
||||||
if (mCurrentProgress != null) {
|
|
||||||
mCurrentProgress.dismiss();
|
|
||||||
mCurrentProgress = null;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
// }).start();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void onError(Exception ex) {
|
|
||||||
requireActivity().runOnUiThread(() -> {
|
|
||||||
this.closeProgress();
|
|
||||||
UtilityExceptions.defaultException(requireActivity(), ex);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package it.integry.integrywmsnative.core.expansion;
|
||||||
|
|
||||||
|
import dagger.Subcomponent;
|
||||||
|
|
||||||
|
@Subcomponent
|
||||||
|
public interface BaseDialogFragmentComponent {
|
||||||
|
|
||||||
|
@Subcomponent.Factory
|
||||||
|
interface Factory {
|
||||||
|
BaseDialogFragmentComponent create();
|
||||||
|
}
|
||||||
|
|
||||||
|
void inject(BaseDialogFragment baseDialogFragment);
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package it.integry.integrywmsnative.core.expansion;
|
||||||
|
|
||||||
|
import dagger.Module;
|
||||||
|
|
||||||
|
@Module(subcomponents = BaseDialogFragmentComponent.class)
|
||||||
|
public class BaseDialogFragmentModule {
|
||||||
|
}
|
||||||
@@ -1,53 +1,88 @@
|
|||||||
package it.integry.integrywmsnative.core.expansion;
|
package it.integry.integrywmsnative.core.expansion;
|
||||||
|
|
||||||
import android.app.Dialog;
|
import android.os.Bundle;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.MainApplication;
|
||||||
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
||||||
import it.integry.integrywmsnative.core.interfaces.IPoppableActivity;
|
import it.integry.integrywmsnative.core.interfaces.IPoppableActivity;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityProgress;
|
|
||||||
import it.integry.integrywmsnative.ui.ElevatedToolbar;
|
import it.integry.integrywmsnative.ui.ElevatedToolbar;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.DialogProgressView;
|
||||||
|
|
||||||
public abstract class BaseFragment extends Fragment {
|
public abstract class BaseFragment extends Fragment {
|
||||||
|
|
||||||
protected Dialog mCurrentProgress;
|
@Inject
|
||||||
|
public DialogProgressView mCurrentProgress;
|
||||||
|
|
||||||
protected ElevatedToolbar mToolbar;
|
protected ElevatedToolbar mToolbar;
|
||||||
|
|
||||||
protected final List<Runnable> mOnPreDestroyList = new ArrayList<>();
|
protected final List<Runnable> mOnPreDestroyList = new ArrayList<>();
|
||||||
|
private boolean progressOpened;
|
||||||
|
|
||||||
|
|
||||||
public void setScrollToolbar(ElevatedToolbar toolbar) {
|
public void setScrollToolbar(ElevatedToolbar toolbar) {
|
||||||
mToolbar = toolbar;
|
mToolbar = toolbar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void addOnPreDestroy(Runnable onPreDestroy) {
|
public void addOnPreDestroy(Runnable onPreDestroy) {
|
||||||
this.mOnPreDestroyList.add(onPreDestroy);
|
this.mOnPreDestroyList.add(onPreDestroy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
|
View view = super.onCreateView(inflater, container, savedInstanceState);
|
||||||
|
|
||||||
|
MainApplication.appComponent
|
||||||
|
.baseFragmentComponent()
|
||||||
|
.create()
|
||||||
|
.inject(this);
|
||||||
|
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
public void onLoadingStarted() {
|
public void onLoadingStarted() {
|
||||||
new Thread(() -> {
|
this.openProgress();
|
||||||
BarcodeManager.disable();
|
|
||||||
this.openProgress();
|
|
||||||
}).start();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onLoadingEnded() {
|
public void onLoadingEnded() {
|
||||||
new Thread(() -> {
|
this.closeProgress();
|
||||||
this.closeProgress();
|
}
|
||||||
BarcodeManager.enable();
|
|
||||||
}).start();
|
private void openProgress() {
|
||||||
|
BarcodeManager.disable();
|
||||||
|
if (!progressOpened && !this.mCurrentProgress.isAdded()) {
|
||||||
|
this.progressOpened = true;
|
||||||
|
requireActivity().runOnUiThread(() -> {
|
||||||
|
this.mCurrentProgress.show(requireActivity().getSupportFragmentManager(), "tag");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void closeProgress() {
|
||||||
|
BarcodeManager.enable();
|
||||||
|
if (progressOpened) {
|
||||||
|
this.progressOpened = false;
|
||||||
|
requireActivity().runOnUiThread(() -> {
|
||||||
|
mCurrentProgress.dismiss();
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onError(Exception ex) {
|
public void onError(Exception ex) {
|
||||||
this.getActivity().runOnUiThread(() -> {
|
requireActivity().runOnUiThread(() -> {
|
||||||
this.closeProgress();
|
this.closeProgress();
|
||||||
UtilityExceptions.defaultException(getActivity(), ex, mCurrentProgress);
|
UtilityExceptions.defaultException(getActivity(), ex, mCurrentProgress);
|
||||||
BarcodeManager.enable();
|
BarcodeManager.enable();
|
||||||
@@ -64,25 +99,8 @@ public abstract class BaseFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void openProgress() {
|
|
||||||
getActivity().runOnUiThread(() -> {
|
|
||||||
if (this.mCurrentProgress == null) {
|
|
||||||
this.mCurrentProgress = UtilityProgress.createDefaultProgressDialog(getActivity());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void closeProgress() {
|
|
||||||
getActivity().runOnUiThread(() -> {
|
|
||||||
if (mCurrentProgress != null) {
|
|
||||||
mCurrentProgress.dismiss();
|
|
||||||
mCurrentProgress = null;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void popMe() {
|
protected void popMe() {
|
||||||
getActivity().runOnUiThread(() -> {
|
requireActivity().runOnUiThread(() -> {
|
||||||
((IPoppableActivity) requireActivity()).pop();
|
((IPoppableActivity) requireActivity()).pop();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package it.integry.integrywmsnative.core.expansion;
|
||||||
|
|
||||||
|
import dagger.Subcomponent;
|
||||||
|
|
||||||
|
@Subcomponent
|
||||||
|
public interface BaseFragmentComponent {
|
||||||
|
|
||||||
|
@Subcomponent.Factory
|
||||||
|
interface Factory {
|
||||||
|
BaseFragmentComponent create();
|
||||||
|
}
|
||||||
|
|
||||||
|
void inject(BaseFragment baseFragment);
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package it.integry.integrywmsnative.core.expansion;
|
||||||
|
|
||||||
|
import dagger.Module;
|
||||||
|
|
||||||
|
@Module(subcomponents = BaseFragmentComponent.class)
|
||||||
|
public class BaseFragmentModule {
|
||||||
|
}
|
||||||
@@ -2,7 +2,7 @@ package it.integry.integrywmsnative.core.expansion;
|
|||||||
|
|
||||||
import androidx.databinding.Observable;
|
import androidx.databinding.Observable;
|
||||||
|
|
||||||
public abstract class OnGeneralChangedCallback extends Observable.OnPropertyChangedCallback implements Runnable{
|
public abstract class OnGeneralChangedCallback extends Observable.OnPropertyChangedCallback implements Runnable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPropertyChanged(Observable sender, int propertyId) {
|
public void onPropertyChanged(Observable sender, int propertyId) {
|
||||||
|
|||||||
@@ -1,28 +1,28 @@
|
|||||||
package it.integry.integrywmsnative.core.expansion;
|
package it.integry.integrywmsnative.core.expansion;
|
||||||
|
|
||||||
import androidx.databinding.ObservableArrayList;
|
|
||||||
import androidx.databinding.ObservableList;
|
import androidx.databinding.ObservableList;
|
||||||
|
import androidx.databinding.ObservableList.OnListChangedCallback;
|
||||||
|
|
||||||
public abstract class OnListGeneralChangedCallback extends ObservableList.OnListChangedCallback {
|
public abstract class OnListGeneralChangedCallback<T> extends OnListChangedCallback<ObservableList<T>> {
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onItemRangeChanged(ObservableList sender, int positionStart, int itemCount) {
|
public void onItemRangeChanged(ObservableList<T> sender, int positionStart, int itemCount) {
|
||||||
onChanged(sender);
|
onChanged(sender);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onItemRangeInserted(ObservableList sender, int positionStart, int itemCount) {
|
public void onItemRangeInserted(ObservableList<T> sender, int positionStart, int itemCount) {
|
||||||
onChanged(sender);
|
onChanged(sender);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onItemRangeMoved(ObservableList sender, int fromPosition, int toPosition, int itemCount) {
|
public void onItemRangeMoved(ObservableList<T> sender, int fromPosition, int toPosition, int itemCount) {
|
||||||
onChanged(sender);
|
onChanged(sender);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onItemRangeRemoved(ObservableList sender, int positionStart, int itemCount) {
|
public void onItemRangeRemoved(ObservableList<T> sender, int positionStart, int itemCount) {
|
||||||
onChanged(sender);
|
onChanged(sender);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,13 +21,13 @@ public abstract class ExtendedSectionedRecyclerView<T, SH extends RecyclerView.V
|
|||||||
public ExtendedSectionedRecyclerView(ObservableArrayList<T> myDataset) {
|
public ExtendedSectionedRecyclerView(ObservableArrayList<T> myDataset) {
|
||||||
mDataset.addAll(myDataset);
|
mDataset.addAll(myDataset);
|
||||||
|
|
||||||
myDataset.addOnListChangedCallback(new OnListGeneralChangedCallback() {
|
myDataset.addOnListChangedCallback(new OnListGeneralChangedCallback<T>() {
|
||||||
@Override
|
@Override
|
||||||
public void onChanged(ObservableList sender) {
|
public void onChanged(ObservableList<T> sender) {
|
||||||
mDataset.clear();
|
mDataset.clear();
|
||||||
mDataset.addAll(sender);
|
mDataset.addAll(sender);
|
||||||
notifyDataSetChanged();
|
|
||||||
notifyDataChanged();
|
notifyDataChanged();
|
||||||
|
notifyDataSetChanged();
|
||||||
checkIfEmpty();
|
checkIfEmpty();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,13 +1,20 @@
|
|||||||
package it.integry.integrywmsnative.core.model;
|
package it.integry.integrywmsnative.core.model;
|
||||||
|
|
||||||
|
import android.text.TextUtils;
|
||||||
|
|
||||||
import androidx.databinding.ObservableArrayList;
|
import androidx.databinding.ObservableArrayList;
|
||||||
|
|
||||||
|
import com.annimon.stream.Optional;
|
||||||
|
import com.annimon.stream.Stream;
|
||||||
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.model.dto.InternalCodAnagsDTO;
|
||||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityDB;
|
import it.integry.integrywmsnative.core.utility.UtilityDB;
|
||||||
@@ -57,6 +64,7 @@ public class MtbColt extends EntityBase {
|
|||||||
private String codJcom;
|
private String codJcom;
|
||||||
|
|
||||||
private List<MtbCols> mtbCols;
|
private List<MtbCols> mtbCols;
|
||||||
|
private MtbTCol mtbTCol;
|
||||||
|
|
||||||
private Boolean disablePrint;
|
private Boolean disablePrint;
|
||||||
private String ragSocCliente;
|
private String ragSocCliente;
|
||||||
@@ -83,7 +91,6 @@ public class MtbColt extends EntityBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private ObservableArrayList<MtbColr> mtbColr = new ObservableArrayList<>();
|
private ObservableArrayList<MtbColr> mtbColr = new ObservableArrayList<>();
|
||||||
|
|
||||||
public ObservableArrayList<MtbColr> getMtbColr() {
|
public ObservableArrayList<MtbColr> getMtbColr() {
|
||||||
@@ -95,21 +102,51 @@ public class MtbColt extends EntityBase {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MtbColt(){
|
public MtbColt() {
|
||||||
type = "mtb_colt";
|
type = "mtb_colt";
|
||||||
setDataCollo(UtilityDate.getDateInstance());
|
setDataCollo(UtilityDate.getDateInstance());
|
||||||
setSerCollo("/");
|
setSerCollo("/");
|
||||||
|
|
||||||
if(SettingsManager.i().isUserLoggedIn()) {
|
if (SettingsManager.i().isUserLoggedIn()) {
|
||||||
setPreparatoDa(SettingsManager.i().getUser().getFullname());
|
setPreparatoDa(SettingsManager.i().getUser().getFullname());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public MtbColt initDefaultFields() {
|
public MtbColt initDefaultFields(GestioneEnum gestioneEnum) {
|
||||||
|
setGestione(gestioneEnum);
|
||||||
setCodMdep(SettingsManager.i().getUserSession().getDepo().getCodMdep());
|
setCodMdep(SettingsManager.i().getUserSession().getDepo().getCodMdep());
|
||||||
setPreparatoDa(SettingsManager.i().getUser().getFullname());
|
setPreparatoDa(SettingsManager.i().getUser().getFullname());
|
||||||
setOraInizPrep(UtilityDate.getDateInstance());
|
setOraInizPrep(UtilityDate.getDateInstance());
|
||||||
setCodAnag(SettingsManager.iDB().getDefaultCodAnag());
|
|
||||||
|
String codAnagToUse = null;
|
||||||
|
switch (gestioneEnum) {
|
||||||
|
case ACQUISTO:
|
||||||
|
case LAVORAZIONE:
|
||||||
|
case PRODUZIONE:
|
||||||
|
if (SettingsManager.iDB().getInternalCodAnags() == null) break;
|
||||||
|
|
||||||
|
Optional<InternalCodAnagsDTO> optCodAnagForn = Stream.of(SettingsManager.iDB().getInternalCodAnags())
|
||||||
|
.filter(InternalCodAnagsDTO::isFornitore)
|
||||||
|
.findFirst();
|
||||||
|
|
||||||
|
if (optCodAnagForn.isEmpty()) break;
|
||||||
|
|
||||||
|
codAnagToUse = optCodAnagForn.get().getCodAnag();
|
||||||
|
break;
|
||||||
|
case VENDITA:
|
||||||
|
if (SettingsManager.iDB().getInternalCodAnags() == null) break;
|
||||||
|
|
||||||
|
Optional<InternalCodAnagsDTO> optCodAnagClie = Stream.of(SettingsManager.iDB().getInternalCodAnags())
|
||||||
|
.filter(InternalCodAnagsDTO::isCliente)
|
||||||
|
.findFirst();
|
||||||
|
|
||||||
|
if (optCodAnagClie.isEmpty()) break;
|
||||||
|
|
||||||
|
codAnagToUse = optCodAnagClie.get().getCodAnag();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
setCodAnag(codAnagToUse);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@@ -137,11 +174,11 @@ public class MtbColt extends EntityBase {
|
|||||||
Date dataColloD = null;
|
Date dataColloD = null;
|
||||||
try {
|
try {
|
||||||
dataColloD = getDataColloD();
|
dataColloD = getDataColloD();
|
||||||
} catch (Exception ex){
|
} catch (Exception ex) {
|
||||||
UtilityLogger.errorMe(ex);
|
UtilityLogger.errorMe(ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(dataColloD != null){
|
if (dataColloD != null) {
|
||||||
return UtilityDate.formatDate(dataColloD, UtilityDate.COMMONS_DATE_FORMATS.DMY_HUMAN_LONG);
|
return UtilityDate.formatDate(dataColloD, UtilityDate.COMMONS_DATE_FORMATS.DMY_HUMAN_LONG);
|
||||||
} else return null;
|
} else return null;
|
||||||
}
|
}
|
||||||
@@ -392,7 +429,7 @@ public class MtbColt extends EntityBase {
|
|||||||
public String getTimeVers() {
|
public String getTimeVers() {
|
||||||
Date dataColloD = getDataVersD();
|
Date dataColloD = getDataVersD();
|
||||||
|
|
||||||
if(dataColloD != null){
|
if (dataColloD != null) {
|
||||||
return UtilityDate.formatDate(dataColloD, UtilityDate.COMMONS_DATE_FORMATS.TIME);
|
return UtilityDate.formatDate(dataColloD, UtilityDate.COMMONS_DATE_FORMATS.TIME);
|
||||||
} else return null;
|
} else return null;
|
||||||
}
|
}
|
||||||
@@ -526,16 +563,57 @@ public class MtbColt extends EntityBase {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MtbTCol getMtbTCol() {
|
||||||
|
return mtbTCol;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MtbColt setMtbTCol(MtbTCol mtbTCol) {
|
||||||
|
this.mtbTCol = mtbTCol;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public void generaFiltroOrdineFromDTO(List<FiltroOrdineDTO> filtroOrdineDtos) {
|
public void generaFiltroOrdineFromDTO(List<FiltroOrdineDTO> filtroOrdineDtos) {
|
||||||
|
|
||||||
String xmlPrefix = "{\"whereCond\": \"";
|
String xmlPrefix = "{\"whereCond\": \"";
|
||||||
String xmlSuffix = "\"}";
|
String xmlSuffix = "\"}";
|
||||||
|
|
||||||
StringBuilder whereCond = new StringBuilder();
|
// StringBuilder whereCond = new StringBuilder();
|
||||||
|
String whereCond;
|
||||||
|
List<String> conditions = new ArrayList<>();
|
||||||
|
String existingFilter;
|
||||||
|
if (this.filtroOrdini != null) {
|
||||||
|
existingFilter = this.filtroOrdini;
|
||||||
|
existingFilter = existingFilter.replace(xmlPrefix, "").replace(xmlSuffix, "");
|
||||||
|
conditions.add(existingFilter);
|
||||||
|
} else {
|
||||||
|
existingFilter = "";
|
||||||
|
}
|
||||||
|
|
||||||
if(filtroOrdineDtos != null && filtroOrdineDtos.size() > 0) {
|
|
||||||
|
|
||||||
for(int i = 0; i < filtroOrdineDtos.size(); i++){
|
for (FiltroOrdineDTO filtroOrdineDTO : filtroOrdineDtos) {
|
||||||
|
try {
|
||||||
|
String condition = (String.format("(d.g = %s AND d.d = %s and d.n = %s",
|
||||||
|
UtilityDB.valueToString(filtroOrdineDTO.getGestioneOrd()),
|
||||||
|
UtilityDB.valueToString(UtilityDate.formatDate(filtroOrdineDTO.getDataOrdD(), UtilityDate.COMMONS_DATE_FORMATS.YMD_SLASH)),
|
||||||
|
UtilityDB.valueToString(filtroOrdineDTO.getNumOrd())));
|
||||||
|
|
||||||
|
if (!UtilityString.isNullOrEmpty(filtroOrdineDTO.getDataConsS())) {
|
||||||
|
condition += (String.format(" AND dr.dc = %s",
|
||||||
|
UtilityDB.valueToString(UtilityDate.formatDate(filtroOrdineDTO.getDataConsD(), UtilityDate.COMMONS_DATE_FORMATS.YMD_SLASH))));
|
||||||
|
}
|
||||||
|
|
||||||
|
condition += ")";
|
||||||
|
if (!existingFilter.contains(condition)) {
|
||||||
|
conditions.add(condition);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*if (filtroOrdineDtos != null && filtroOrdineDtos.size() > 0) {
|
||||||
|
|
||||||
|
for (int i = 0; i < filtroOrdineDtos.size(); i++) {
|
||||||
FiltroOrdineDTO x = filtroOrdineDtos.get(i);
|
FiltroOrdineDTO x = filtroOrdineDtos.get(i);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -545,13 +623,13 @@ public class MtbColt extends EntityBase {
|
|||||||
UtilityDB.valueToString(UtilityDate.formatDate(x.getDataOrdD(), UtilityDate.COMMONS_DATE_FORMATS.YMD_SLASH)),
|
UtilityDB.valueToString(UtilityDate.formatDate(x.getDataOrdD(), UtilityDate.COMMONS_DATE_FORMATS.YMD_SLASH)),
|
||||||
UtilityDB.valueToString(x.getNumOrd())));
|
UtilityDB.valueToString(x.getNumOrd())));
|
||||||
|
|
||||||
if(!UtilityString.isNullOrEmpty(x.getDataConsS())) {
|
if (!UtilityString.isNullOrEmpty(x.getDataConsS())) {
|
||||||
whereCond.append(String.format(" AND dr.dc = %s",
|
whereCond.append(String.format(" AND dr.dc = %s",
|
||||||
UtilityDB.valueToString(UtilityDate.formatDate(x.getDataConsD(), UtilityDate.COMMONS_DATE_FORMATS.YMD_SLASH))));
|
UtilityDB.valueToString(UtilityDate.formatDate(x.getDataConsD(), UtilityDate.COMMONS_DATE_FORMATS.YMD_SLASH))));
|
||||||
}
|
}
|
||||||
|
|
||||||
whereCond.append(")");
|
whereCond.append(")");
|
||||||
if(i < filtroOrdineDtos.size()-1) {
|
if (i < filtroOrdineDtos.size() - 1) {
|
||||||
whereCond.append(" OR ");
|
whereCond.append(" OR ");
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -559,7 +637,8 @@ public class MtbColt extends EntityBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}*/
|
||||||
|
whereCond = TextUtils.join(" OR ", conditions);
|
||||||
|
|
||||||
this.filtroOrdini = xmlPrefix + whereCond + xmlSuffix;
|
this.filtroOrdini = xmlPrefix + whereCond + xmlSuffix;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package it.integry.integrywmsnative.core.model.dto;
|
||||||
|
|
||||||
|
public class InternalCodAnagsDTO {
|
||||||
|
|
||||||
|
private String codAnag;
|
||||||
|
private boolean isCliente;
|
||||||
|
private boolean isFornitore;
|
||||||
|
|
||||||
|
public String getCodAnag() {
|
||||||
|
return codAnag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public InternalCodAnagsDTO setCodAnag(String codAnag) {
|
||||||
|
this.codAnag = codAnag;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isCliente() {
|
||||||
|
return isCliente;
|
||||||
|
}
|
||||||
|
|
||||||
|
public InternalCodAnagsDTO setCliente(boolean cliente) {
|
||||||
|
isCliente = cliente;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isFornitore() {
|
||||||
|
return isFornitore;
|
||||||
|
}
|
||||||
|
|
||||||
|
public InternalCodAnagsDTO setFornitore(boolean fornitore) {
|
||||||
|
isFornitore = fornitore;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package it.integry.integrywmsnative.core.report;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
public enum ReportType {
|
||||||
|
|
||||||
|
@SerializedName("0")
|
||||||
|
ETICHETTA_SSCC_ACCETTAZIONE(0),
|
||||||
|
@SerializedName("1")
|
||||||
|
ETICHETTA_SSCC_LAVORAZIONE(1),
|
||||||
|
@SerializedName("2")
|
||||||
|
ETICHETTA_SSCC_SPEDIZIONE(2),
|
||||||
|
@SerializedName("3")
|
||||||
|
WMS_SPEDIZIONE_ETICHETTE_SSCC_ORD(3),
|
||||||
|
@SerializedName("4")
|
||||||
|
WMS_SPEDIZIONE_PACKING_LIST_ORD(4),
|
||||||
|
@SerializedName("5")
|
||||||
|
STAMPA_LISTINI_VENDITA(5);
|
||||||
|
|
||||||
|
private final int value;
|
||||||
|
|
||||||
|
ReportType(int value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ReportType from(Object value) {
|
||||||
|
int castValue = (int) value;
|
||||||
|
for (ReportType b : ReportType.values()) {
|
||||||
|
if (b.value == castValue)
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public int getValue() {
|
||||||
|
return this.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -5,6 +5,7 @@ import java.net.SocketTimeoutException;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.exception.NoPrintersFoundException;
|
import it.integry.integrywmsnative.core.exception.NoPrintersFoundException;
|
||||||
|
import it.integry.integrywmsnative.core.exception.NoResultFromBarcodeException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by GiuseppeS on 22/03/2018.
|
* Created by GiuseppeS on 22/03/2018.
|
||||||
@@ -15,12 +16,17 @@ public class CommonRESTException {
|
|||||||
private static String MESSAGE_KEY = "message";
|
private static String MESSAGE_KEY = "message";
|
||||||
private static String EXCEPTION_KEY = "exception";
|
private static String EXCEPTION_KEY = "exception";
|
||||||
|
|
||||||
private static HashMap<String, HashMap<String, Object>> bindingExceptions = new HashMap() {{
|
private static final HashMap<String, HashMap<String, Object>> bindingExceptions = new HashMap<>() {{
|
||||||
put("Printer not found", new HashMap<String, Object>(){{
|
put("Printer not found", new HashMap<>() {{
|
||||||
put(MESSAGE_KEY, "Stampante non trovata");
|
put(MESSAGE_KEY, "Stampante non trovata");
|
||||||
put(EXCEPTION_KEY, NoPrintersFoundException.class);
|
put(EXCEPTION_KEY, NoPrintersFoundException.class);
|
||||||
}});
|
}});
|
||||||
|
|
||||||
|
put("barcode non letto correttamente", new HashMap<>() {{
|
||||||
|
put(MESSAGE_KEY, "Barcode non letto correttamente");
|
||||||
|
put(EXCEPTION_KEY, NoResultFromBarcodeException.class);
|
||||||
|
}});
|
||||||
|
|
||||||
|
|
||||||
}};
|
}};
|
||||||
|
|
||||||
@@ -42,13 +48,11 @@ public class CommonRESTException {
|
|||||||
|
|
||||||
for(String key : bindingExceptions.keySet()) {
|
for(String key : bindingExceptions.keySet()) {
|
||||||
if(message.contains(key)) {
|
if(message.contains(key)) {
|
||||||
Class classType = (Class) bindingExceptions.get(key).get(EXCEPTION_KEY);
|
Class<?> classType = (Class<?>) bindingExceptions.get(key).get(EXCEPTION_KEY);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return (Exception) classType.newInstance();
|
return (Exception) classType.newInstance();
|
||||||
} catch (IllegalAccessException e) {
|
} catch (IllegalAccessException | InstantiationException e) {
|
||||||
e.printStackTrace();
|
|
||||||
} catch (InstantiationException e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ public class RESTBuilder {
|
|||||||
return getService(service, SettingsManager.i().getServer().getHost(), SettingsManager.i().getServer().getPort(), true);
|
return getService(service, SettingsManager.i().getServer().getHost(), SettingsManager.i().getServer().getPort(), true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> T getService(final Class<T> service, int timeout) {
|
public static <T> T getService(final Class<T> service, int timeout) {
|
||||||
return getService(service, SettingsManager.i().getServer().getHost(), SettingsManager.i().getServer().getPort(), true, true, timeout);
|
return getService(service, SettingsManager.i().getServer().getHost(), SettingsManager.i().getServer().getPort(), true, true, timeout);
|
||||||
|
|
||||||
@@ -34,7 +35,7 @@ public class RESTBuilder {
|
|||||||
return getService(service, host, port, addInterceptors, addEmsApi, 30);
|
return getService(service, host, port, addInterceptors, addEmsApi, 30);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> T getService(final Class<T> service, String host, int port, boolean addInterceptors, boolean addEmsApi, int timeout){
|
public static <T> T getService(final Class<T> service, String host, int port, boolean addInterceptors, boolean addEmsApi, int timeout) {
|
||||||
OkHttpClient.Builder clientBuilder = new OkHttpClient.Builder();
|
OkHttpClient.Builder clientBuilder = new OkHttpClient.Builder();
|
||||||
|
|
||||||
clientBuilder.connectTimeout(timeout, TimeUnit.SECONDS);
|
clientBuilder.connectTimeout(timeout, TimeUnit.SECONDS);
|
||||||
@@ -43,7 +44,7 @@ public class RESTBuilder {
|
|||||||
|
|
||||||
clientBuilder.retryOnConnectionFailure(true);
|
clientBuilder.retryOnConnectionFailure(true);
|
||||||
|
|
||||||
if(addInterceptors) clientBuilder.addInterceptor(new HttpInterceptor());
|
if (addInterceptors) clientBuilder.addInterceptor(new HttpInterceptor());
|
||||||
|
|
||||||
OkHttpClient client = clientBuilder.build();
|
OkHttpClient client = clientBuilder.build();
|
||||||
|
|
||||||
@@ -62,4 +63,13 @@ public class RESTBuilder {
|
|||||||
|
|
||||||
return retrofit.create(service);
|
return retrofit.create(service);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static String getDefaultHost() {
|
||||||
|
return SettingsManager.i().getServer().getHost();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getDefaultPort() {
|
||||||
|
return SettingsManager.i().getServer().getPort();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ public class ArticoloRESTConsumer extends _BaseRESTConsumer {
|
|||||||
@Override
|
@Override
|
||||||
public void onResponse(Call<ServiceRESTResponse<MtbAart>> call, Response<ServiceRESTResponse<MtbAart>> response) {
|
public void onResponse(Call<ServiceRESTResponse<MtbAart>> call, Response<ServiceRESTResponse<MtbAart>> response) {
|
||||||
analyzeAnswer(response, "getByCodMart", (m) -> {
|
analyzeAnswer(response, "getByCodMart", (m) -> {
|
||||||
if(response.body().getEntityList() != null && !response.body().getEntityList().isEmpty()) {
|
if (response.body().getEntityList() != null && !response.body().getEntityList().isEmpty()) {
|
||||||
onComplete.run(response.body().getEntityList().get(0));
|
onComplete.run(response.body().getEntityList().get(0));
|
||||||
} else onComplete.run(null);
|
} else onComplete.run(null);
|
||||||
|
|
||||||
@@ -107,9 +107,10 @@ public class ArticoloRESTConsumer extends _BaseRESTConsumer {
|
|||||||
})
|
})
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
var whereCond = " WHERE " + UtilityQuery.concatFieldListInWhereCond(whereCondMap);
|
var whereCond = whereCondMap.isEmpty() ? "" : " WHERE " + UtilityQuery.concatFieldListInWhereCond(whereCondMap);
|
||||||
|
|
||||||
Type typeOfObjectsList = new TypeToken<ArrayList<MtbGrup>>() {}.getType();
|
Type typeOfObjectsList = new TypeToken<ArrayList<MtbGrup>>() {
|
||||||
|
}.getType();
|
||||||
this.systemRESTConsumer.processSql("SELECT * FROM mtb_grup " + whereCond, typeOfObjectsList, onComplete, onFailed);
|
this.systemRESTConsumer.processSql("SELECT * FROM mtb_grup " + whereCond, typeOfObjectsList, onComplete, onFailed);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -104,10 +104,9 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
|
|
||||||
public void createColloLavorazione(int segno, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
public void createColloLavorazione(int segno, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
MtbColt mtbColtToCreate = new MtbColt()
|
MtbColt mtbColtToCreate = new MtbColt()
|
||||||
.setSegno(segno)
|
.setSegno(segno);
|
||||||
.setGestione(GestioneEnum.LAVORAZIONE);
|
|
||||||
|
|
||||||
mtbColtToCreate.initDefaultFields();
|
mtbColtToCreate.initDefaultFields(GestioneEnum.LAVORAZIONE);
|
||||||
|
|
||||||
mtbColtToCreate
|
mtbColtToCreate
|
||||||
.setOperation(CommonModelConsts.OPERATION.INSERT);
|
.setOperation(CommonModelConsts.OPERATION.INSERT);
|
||||||
@@ -123,9 +122,8 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
public void createColloScaricoDaCarico(MtbColt sourceMtbColt, MtbDepoPosizione posizione, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
public void createColloScaricoDaCarico(MtbColt sourceMtbColt, MtbDepoPosizione posizione, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
|
|
||||||
MtbColt newMtbColt = new MtbColt()
|
MtbColt newMtbColt = new MtbColt()
|
||||||
.initDefaultFields()
|
.initDefaultFields(GestioneEnum.LAVORAZIONE)
|
||||||
.setCodAnag(null)
|
.setCodAnag(null)
|
||||||
.setGestione(GestioneEnum.LAVORAZIONE)
|
|
||||||
.setSegno(-1)
|
.setSegno(-1)
|
||||||
.setCodTcol(sourceMtbColt.getCodTcol())
|
.setCodTcol(sourceMtbColt.getCodTcol())
|
||||||
.setPesoKg(sourceMtbColt.getPesoKg())
|
.setPesoKg(sourceMtbColt.getPesoKg())
|
||||||
@@ -176,9 +174,8 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
public void createColliScaricoDaOrdineLavorazione(MtbColt sourceMtbColt, MtbColr sourceMtbColr, MtbDepoPosizione posizione, List<OrdineLavorazioneDTO> ordini, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
public void createColliScaricoDaOrdineLavorazione(MtbColt sourceMtbColt, MtbColr sourceMtbColr, MtbDepoPosizione posizione, List<OrdineLavorazioneDTO> ordini, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
|
|
||||||
MtbColt newMtbColt = new MtbColt()
|
MtbColt newMtbColt = new MtbColt()
|
||||||
.initDefaultFields()
|
.initDefaultFields(GestioneEnum.LAVORAZIONE)
|
||||||
.setCodAnag(null)
|
.setCodAnag(null)
|
||||||
.setGestione(GestioneEnum.LAVORAZIONE)
|
|
||||||
.setSegno(-1)
|
.setSegno(-1)
|
||||||
.setCodTcol(sourceMtbColt.getCodTcol())
|
.setCodTcol(sourceMtbColt.getCodTcol())
|
||||||
// .setPesoKg(sourceMtbColt.getPesoKg())
|
// .setPesoKg(sourceMtbColt.getPesoKg())
|
||||||
@@ -246,11 +243,16 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
public void createColloFromEtichettaAnonima(String barcode, GestioneEnum gestione, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
public void createColloFromEtichettaAnonima(String barcode, GestioneEnum gestione, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
|
|
||||||
MtbColt mtbColtToCreate = new MtbColt()
|
MtbColt mtbColtToCreate = new MtbColt()
|
||||||
.setGestione(gestione);
|
.initDefaultFields(gestione);
|
||||||
|
|
||||||
mtbColtToCreate.initDefaultFields();
|
Integer customNumCollo = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
customNumCollo = UtilityBarcode.getNumColloFromULAnonima(barcode);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
onFailed.run(ex);
|
||||||
|
}
|
||||||
|
|
||||||
Integer customNumCollo = UtilityBarcode.getNumColloFromULAnonima(barcode);
|
|
||||||
String customSerCollo = CommonConst.Config.DEFAULT_ANONYMOUS_UL_SERIE;
|
String customSerCollo = CommonConst.Config.DEFAULT_ANONYMOUS_UL_SERIE;
|
||||||
|
|
||||||
if (customNumCollo != null) {
|
if (customNumCollo != null) {
|
||||||
@@ -587,35 +589,37 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void spostaArtsTraUL(MtbColt sourceMtbColt, MtbColt destMtbColt, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
public void spostaArtsTraUL(MtbColt sourceMtbColt, MtbColt destMtbColt, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
MtbColt mtbColtToMoveClone = (MtbColt) sourceMtbColt.clone();
|
new Thread(() -> {
|
||||||
MtbColt mtbColtDestClone = (MtbColt) destMtbColt.clone();
|
MtbColt mtbColtToMoveClone = (MtbColt) sourceMtbColt.clone();
|
||||||
|
MtbColt mtbColtDestClone = (MtbColt) destMtbColt.clone();
|
||||||
|
|
||||||
for (int i = 0; i < mtbColtToMoveClone.getMtbColr().size(); i++) {
|
for (int i = 0; i < mtbColtToMoveClone.getMtbColr().size(); i++) {
|
||||||
mtbColtToMoveClone.getMtbColr().get(i)
|
mtbColtToMoveClone.getMtbColr().get(i)
|
||||||
.setMtbAart(null)
|
.setMtbAart(null)
|
||||||
.setMtbPartitaMag(null);
|
.setMtbPartitaMag(null);
|
||||||
}
|
|
||||||
|
|
||||||
mtbColtDestClone.setMtbColr(null);
|
|
||||||
|
|
||||||
SpostaArtsTraULRequestDTO spostaArtsTraULRequestDTO = new SpostaArtsTraULRequestDTO()
|
|
||||||
.setSourceMtbColt(mtbColtToMoveClone)
|
|
||||||
.setDestinationMtbColt(mtbColtDestClone);
|
|
||||||
|
|
||||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
|
||||||
colliMagazzinoRESTConsumerService.spostaArtsTraUL(spostaArtsTraULRequestDTO).enqueue(new Callback<>() {
|
|
||||||
@Override
|
|
||||||
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) {
|
|
||||||
analyzeAnswer(response, "spostaArtsTraUL", data -> {
|
|
||||||
onComplete.run();
|
|
||||||
}, onFailed);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
mtbColtDestClone.setMtbColr(null);
|
||||||
public void onFailure(Call<ServiceRESTResponse<Object>> call, Throwable t) {
|
|
||||||
if (onFailed != null) onFailed.run(new Exception(t));
|
SpostaArtsTraULRequestDTO spostaArtsTraULRequestDTO = new SpostaArtsTraULRequestDTO()
|
||||||
}
|
.setSourceMtbColt(mtbColtToMoveClone)
|
||||||
});
|
.setDestinationMtbColt(mtbColtDestClone);
|
||||||
|
|
||||||
|
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||||
|
colliMagazzinoRESTConsumerService.spostaArtsTraUL(spostaArtsTraULRequestDTO).enqueue(new Callback<>() {
|
||||||
|
@Override
|
||||||
|
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) {
|
||||||
|
analyzeAnswer(response, "spostaArtsTraUL", data -> {
|
||||||
|
onComplete.run();
|
||||||
|
}, onFailed);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Call<ServiceRESTResponse<Object>> call, Throwable t) {
|
||||||
|
if (onFailed != null) onFailed.run(new Exception(t));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}).start();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void assegnaLottoSuColloScarico(MtbColt sourceMtbColt, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
public void assegnaLottoSuColloScarico(MtbColt sourceMtbColt, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
|
|||||||
@@ -6,11 +6,11 @@ import java.util.List;
|
|||||||
|
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
import it.integry.integrywmsnative.core.model.StbGestSetup;
|
import it.integry.integrywmsnative.core.model.StbGestSetup;
|
||||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||||
import it.integry.integrywmsnative.core.rest.model.GestSetupDTO;
|
import it.integry.integrywmsnative.core.rest.model.GestSetupDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityLogger;
|
import it.integry.integrywmsnative.core.utility.UtilityLogger;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.Callback;
|
import retrofit2.Callback;
|
||||||
@@ -35,18 +35,18 @@ public class GestSetupRESTConsumer extends _BaseRESTConsumer {
|
|||||||
public void onFailure(Call<ServiceRESTResponse<GestSetupDTO>> call, Throwable t) {
|
public void onFailure(Call<ServiceRESTResponse<GestSetupDTO>> call, Throwable t) {
|
||||||
Log.e("GestSetup", t.toString());
|
Log.e("GestSetup", t.toString());
|
||||||
// UtilityLogger.errorMe(new Exception(t));
|
// UtilityLogger.errorMe(new Exception(t));
|
||||||
if(onFailed != null) onFailed.run(new Exception(t));
|
if (onFailed != null) onFailed.run(new Exception(t));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void getBooleanValue(String gestName, String sectionName, String keySection, RunnableArgs<Boolean> onComplete, RunnableArgs<Exception> onFailed) {
|
public static void getBooleanValue(String gestName, String sectionName, String keySection, RunnableArgs<Boolean> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
getValueStatic(gestName, sectionName, keySection, value -> {
|
getValueStatic(gestName, sectionName, keySection, value -> {
|
||||||
if(value != null){
|
if (value != null) {
|
||||||
onComplete.run("S".equalsIgnoreCase(value.value));
|
onComplete.run("S".equalsIgnoreCase(value.value));
|
||||||
} else onComplete.run(false);
|
} else onComplete.run(false);
|
||||||
}, ex -> {
|
}, ex -> {
|
||||||
if(onFailed != null) onFailed.run(ex);
|
if (onFailed != null) onFailed.run(ex);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,25 +62,25 @@ public class GestSetupRESTConsumer extends _BaseRESTConsumer {
|
|||||||
public void onFailure(Call<ServiceRESTResponse<GestSetupDTO>> call, Throwable t) {
|
public void onFailure(Call<ServiceRESTResponse<GestSetupDTO>> call, Throwable t) {
|
||||||
Log.e("PrintCollo", t.toString());
|
Log.e("PrintCollo", t.toString());
|
||||||
UtilityLogger.errorMe(new Exception(t));
|
UtilityLogger.errorMe(new Exception(t));
|
||||||
if(onFailed != null) onFailed.run(new Exception(t));
|
if (onFailed != null) onFailed.run(new Exception(t));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void getBooleanValue(String gestName, String sectionName, String keySection, String codMdep, RunnableArgs<Boolean> onComplete, RunnableArgs<Exception> onFailed) {
|
public static void getBooleanValue(String gestName, String sectionName, String keySection, String codMdep, RunnableArgs<Boolean> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
getValueStatic(gestName, sectionName, keySection, codMdep, value -> {
|
getValueStatic(gestName, sectionName, keySection, codMdep, value -> {
|
||||||
if(value != null){
|
if (value != null) {
|
||||||
onComplete.run("S".equalsIgnoreCase(value.value));
|
onComplete.run("S".equalsIgnoreCase(value.value));
|
||||||
} else onComplete.run(false);
|
} else onComplete.run(false);
|
||||||
}, ex -> {
|
}, ex -> {
|
||||||
if(onFailed != null) onFailed.run(ex);
|
if (onFailed != null) onFailed.run(ex);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void getValues(List<StbGestSetup> stbGestSetupList, RunnableArgs<List<StbGestSetup>> onComplete, RunnableArgs<Exception> onFailed) {
|
public static void getValues(List<StbGestSetup> stbGestSetupList, RunnableArgs<List<StbGestSetup>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
GestSetupRESTConsumerService service = RESTBuilder.getService(GestSetupRESTConsumerService.class);
|
GestSetupRESTConsumerService service = RESTBuilder.getService(GestSetupRESTConsumerService.class);
|
||||||
service.getGestSetupValues(stbGestSetupList).enqueue(new Callback<ServiceRESTResponse<List<StbGestSetup>>>() {
|
service.getGestSetupValues(stbGestSetupList).enqueue(new Callback<>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call<ServiceRESTResponse<List<StbGestSetup>>> call, Response<ServiceRESTResponse<List<StbGestSetup>>> response) {
|
public void onResponse(Call<ServiceRESTResponse<List<StbGestSetup>>> call, Response<ServiceRESTResponse<List<StbGestSetup>>> response) {
|
||||||
analyzeAnswer(response, "GestSetup", onComplete, onFailed);
|
analyzeAnswer(response, "GestSetup", onComplete, onFailed);
|
||||||
@@ -89,7 +89,7 @@ public class GestSetupRESTConsumer extends _BaseRESTConsumer {
|
|||||||
@Override
|
@Override
|
||||||
public void onFailure(Call<ServiceRESTResponse<List<StbGestSetup>>> call, Throwable t) {
|
public void onFailure(Call<ServiceRESTResponse<List<StbGestSetup>>> call, Throwable t) {
|
||||||
UtilityLogger.errorMe(new Exception(t));
|
UtilityLogger.errorMe(new Exception(t));
|
||||||
if(onFailed != null) onFailed.run(new Exception(t));
|
if (onFailed != null) onFailed.run(new Exception(t));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,7 +93,8 @@ public class OrdiniRESTConsumer extends _BaseRESTConsumer {
|
|||||||
&& (!UtilityString.isNullOrEmpty(x.getPartitaMag()) && x.getPartitaMag().equalsIgnoreCase(mtbColr.getPartitaMag())))
|
&& (!UtilityString.isNullOrEmpty(x.getPartitaMag()) && x.getPartitaMag().equalsIgnoreCase(mtbColr.getPartitaMag())))
|
||||||
.findFirst();
|
.findFirst();
|
||||||
|
|
||||||
if (optionalMtbPartitaMag.isPresent()) mtbColr.setMtbPartitaMag(optionalMtbPartitaMag.get());
|
if (optionalMtbPartitaMag.isPresent())
|
||||||
|
mtbColr.setMtbPartitaMag(optionalMtbPartitaMag.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -125,7 +126,7 @@ public class OrdiniRESTConsumer extends _BaseRESTConsumer {
|
|||||||
OrdiniRESTConsumerService service = RESTBuilder.getService(OrdiniRESTConsumerService.class);
|
OrdiniRESTConsumerService service = RESTBuilder.getService(OrdiniRESTConsumerService.class);
|
||||||
|
|
||||||
service.getOrdiniInevasi(codMdep, gestione.getText())
|
service.getOrdiniInevasi(codMdep, gestione.getText())
|
||||||
.enqueue(new Callback<ServiceRESTResponse<List<OrdineUscitaInevasoDTO>>>() {
|
.enqueue(new Callback<>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call<ServiceRESTResponse<List<OrdineUscitaInevasoDTO>>> call, Response<ServiceRESTResponse<List<OrdineUscitaInevasoDTO>>> response) {
|
public void onResponse(Call<ServiceRESTResponse<List<OrdineUscitaInevasoDTO>>> call, Response<ServiceRESTResponse<List<OrdineUscitaInevasoDTO>>> response) {
|
||||||
analyzeAnswer(response, "getOrdiniInevasi", responseDtoList -> {
|
analyzeAnswer(response, "getOrdiniInevasi", responseDtoList -> {
|
||||||
@@ -145,7 +146,7 @@ public class OrdiniRESTConsumer extends _BaseRESTConsumer {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void retrieveListaArticoliFromOrdiniUscita(List<OrdineUscitaInevasoDTO> orders, RunnableArgs<List<SitArtOrdDTO>> onComplete, RunnableArgs<Exception> onFailed) {
|
public void retrieveListaArticoliFromOrdiniUscita(String codMdep, List<OrdineUscitaInevasoDTO> orders, RunnableArgs<List<SitArtOrdDTO>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
List<GetPickingListDTO> getPickingListDTOs = Stream.of(orders)
|
List<GetPickingListDTO> getPickingListDTOs = Stream.of(orders)
|
||||||
.map(x -> new GetPickingListDTO()
|
.map(x -> new GetPickingListDTO()
|
||||||
.setData(x.getDataOrdS())
|
.setData(x.getDataOrdS())
|
||||||
@@ -157,10 +158,18 @@ public class OrdiniRESTConsumer extends _BaseRESTConsumer {
|
|||||||
|
|
||||||
OrdiniRESTConsumerService service = RESTBuilder.getService(OrdiniRESTConsumerService.class, 90);
|
OrdiniRESTConsumerService service = RESTBuilder.getService(OrdiniRESTConsumerService.class, 90);
|
||||||
|
|
||||||
service.getArticoliFromOrdini(getPickingListDTOs).enqueue(new Callback<ServiceRESTResponse<List<SitArtOrdDTO>>>() {
|
service.getArticoliFromOrdini(codMdep, getPickingListDTOs).enqueue(new Callback<>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call<ServiceRESTResponse<List<SitArtOrdDTO>>> call, Response<ServiceRESTResponse<List<SitArtOrdDTO>>> response) {
|
public void onResponse(Call<ServiceRESTResponse<List<SitArtOrdDTO>>> call, Response<ServiceRESTResponse<List<SitArtOrdDTO>>> response) {
|
||||||
analyzeAnswer(response, "retrieveListaArticoliFromOrdiniUscita", onComplete, onFailed);
|
analyzeAnswer(response, "retrieveListaArticoliFromOrdiniUscita", sitArtOrds -> {
|
||||||
|
if (sitArtOrds != null) {
|
||||||
|
for (SitArtOrdDTO sitArtOrd : sitArtOrds) {
|
||||||
|
sitArtOrd.setCodMart(sitArtOrd.getCodMart().trim());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onComplete.run(sitArtOrds);
|
||||||
|
}, onFailed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -182,13 +191,13 @@ public class OrdiniRESTConsumer extends _BaseRESTConsumer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String baseSql = "SELECT DISTINCT mtb_colt.* " +
|
String baseSql = "SELECT DISTINCT mtb_colt.* " +
|
||||||
"FROM mtb_colt, " +
|
"FROM mtb_colt " +
|
||||||
" mtb_colr " +
|
" INNER JOIN mtb_colr ON " +
|
||||||
"WHERE mtb_colt.gestione = mtb_colr.gestione " +
|
" mtb_colt.gestione = mtb_colr.gestione " +
|
||||||
" AND mtb_colt.ser_collo = mtb_colr.ser_collo " +
|
" AND mtb_colt.ser_collo = mtb_colr.ser_collo " +
|
||||||
" AND mtb_colt.data_collo = mtb_colr.data_collo " +
|
" AND mtb_colt.data_collo = mtb_colr.data_collo " +
|
||||||
" AND mtb_colt.num_collo = mtb_colr.num_collo " +
|
" AND mtb_colt.num_collo = mtb_colr.num_collo " +
|
||||||
" AND " + whereCondGestione +
|
" WHERE " + whereCondGestione +
|
||||||
" AND mtb_colt.segno = " + UtilityDB.valueToString(segno) + " " +
|
" AND mtb_colt.segno = " + UtilityDB.valueToString(segno) + " " +
|
||||||
" AND mtb_colt.data_doc IS NULL AND ";
|
" AND mtb_colt.data_doc IS NULL AND ";
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import retrofit2.http.Query;
|
|||||||
public interface OrdiniRESTConsumerService {
|
public interface OrdiniRESTConsumerService {
|
||||||
|
|
||||||
@POST("wms/getArticoliFromOrdini")
|
@POST("wms/getArticoliFromOrdini")
|
||||||
Call<ServiceRESTResponse<List<SitArtOrdDTO>>> getArticoliFromOrdini(@Body List<GetPickingListDTO> pickingListDTO);
|
Call<ServiceRESTResponse<List<SitArtOrdDTO>>> getArticoliFromOrdini(@Query("codMdep") String codMdep, @Body List<GetPickingListDTO> pickingListDTO);
|
||||||
|
|
||||||
@POST("wms/getSuggestedPickingList")
|
@POST("wms/getSuggestedPickingList")
|
||||||
Call<ServiceRESTResponse<List<PickingObjectDTO>>> getSuggestedPickingList(@Query("codMdep") String codMdep, @Body List<SitArtOrdDTO> sitArtOrdDTOList);
|
Call<ServiceRESTResponse<List<PickingObjectDTO>>> getSuggestedPickingList(@Query("codMdep") String codMdep, @Body List<SitArtOrdDTO> sitArtOrdDTOList);
|
||||||
|
|||||||
@@ -6,8 +6,11 @@ import com.annimon.stream.Stream;
|
|||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.data_store.db.entity.ArticoloOrdine;
|
import it.integry.integrywmsnative.core.data_store.db.entity.ArticoloOrdine;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.entity.Griglia;
|
import it.integry.integrywmsnative.core.data_store.db.entity.Griglia;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.entity.Ordine;
|
import it.integry.integrywmsnative.core.data_store.db.entity.Ordine;
|
||||||
@@ -27,37 +30,47 @@ import retrofit2.Call;
|
|||||||
import retrofit2.Callback;
|
import retrofit2.Callback;
|
||||||
import retrofit2.Response;
|
import retrofit2.Response;
|
||||||
|
|
||||||
|
@Singleton
|
||||||
public class PVOrdiniAcquistoRESTConsumer extends _BaseRESTConsumer {
|
public class PVOrdiniAcquistoRESTConsumer extends _BaseRESTConsumer {
|
||||||
|
|
||||||
|
|
||||||
public static void getArticoliListino(String codAlis, RunnableArgs<GrigliaDTO> onSuccess, RunnableArgs<Exception> onFailed) {
|
public void getArticoliListino(String codAlis, RunnableArgs<GrigliaDTO> onSuccess, RunnableArgs<Exception> onFailed) {
|
||||||
|
getArticoliListinoStatic(codAlis, onSuccess, onFailed);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void getArticoliListinoStatic(String codAlis, RunnableArgs<GrigliaDTO> onSuccess, RunnableArgs<Exception> onFailed) {
|
||||||
PVOrdiniAcquistoRESTConsumerService ordiniARestService = RESTBuilder.getService(PVOrdiniAcquistoRESTConsumerService.class);
|
PVOrdiniAcquistoRESTConsumerService ordiniARestService = RESTBuilder.getService(PVOrdiniAcquistoRESTConsumerService.class);
|
||||||
ordiniARestService
|
ordiniARestService
|
||||||
.getArticoliListino(codAlis)
|
.getArticoliListino(codAlis)
|
||||||
.enqueue(new Callback<ServiceRESTResponse<GrigliaDTO>>() {
|
.enqueue(new Callback<>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call<ServiceRESTResponse<GrigliaDTO>> call, Response<ServiceRESTResponse<GrigliaDTO>> response) {
|
public void onResponse(Call<ServiceRESTResponse<GrigliaDTO>> call, Response<ServiceRESTResponse<GrigliaDTO>> response) {
|
||||||
analyzeAnswer(response, "getArticoliListino", griglia -> {
|
analyzeAnswer(response, "getArticoliListino", griglia -> {
|
||||||
|
|
||||||
UtilityThread.executeParallel(() -> {
|
UtilityThread.executeParallel(() -> {
|
||||||
|
var startTime = new Date().getTime();
|
||||||
|
|
||||||
List<ArticoloDTO> listaArticoli = new ArrayList<>();
|
List<ArticoloDTO> listaArticoli = new ArrayList<>();
|
||||||
|
|
||||||
Stream.of(griglia.getGrigliaAcquistiChild())
|
Stream.of(griglia.getGrigliaAcquistiChild())
|
||||||
.map(ArticoloDTO::getCodMart)
|
.groupBy(ArticoloDTO::getCodMart)
|
||||||
.distinct()
|
.forEach(entry -> {
|
||||||
.withoutNulls()
|
|
||||||
.forEach(art -> {
|
if (entry.getValue().size() == 1) {
|
||||||
List<ArticoloDTO> inList = Stream.of(griglia.getGrigliaAcquistiChild()).filter(x -> x.getCodMart().equalsIgnoreCase(art)).toList();
|
listaArticoli.add(entry.getValue().get(0));
|
||||||
if (inList.size() > 1) {
|
} else {
|
||||||
for (ArticoloDTO articolo : inList) {
|
for (ArticoloDTO articolo : entry.getValue()) {
|
||||||
if (!articolo.getBarCode().endsWith(articolo.getCodMart())) {
|
if (!articolo.getBarCode().endsWith(articolo.getCodMart())) {
|
||||||
listaArticoli.add(articolo);
|
listaArticoli.add(articolo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
listaArticoli.add(inList.get(0));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
griglia.setGrigliaAcquistiChild(listaArticoli);
|
griglia.setGrigliaAcquistiChild(listaArticoli);
|
||||||
|
|
||||||
|
Log.d("LOADING TIME 1", "MS: " + (new Date().getTime() - startTime));
|
||||||
onSuccess.run(griglia);
|
onSuccess.run(griglia);
|
||||||
}, false);
|
}, false);
|
||||||
}, onFailed);
|
}, onFailed);
|
||||||
@@ -72,7 +85,7 @@ public class PVOrdiniAcquistoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void saveOrdine(Ordine ordine, List<ArticoloOrdine> articoli, Griglia griglia, RunnableArgs<Ordine> onSuccess, RunnableArgs<Exception> onFailed) {
|
public void saveOrdine(Ordine ordine, List<ArticoloOrdine> articoli, Griglia griglia, RunnableArgs<Ordine> onSuccess, RunnableArgs<Exception> onFailed) {
|
||||||
SaveDTO saveDTO = new SaveDTO();
|
SaveDTO saveDTO = new SaveDTO();
|
||||||
OrdineDTO ordineDTO = new OrdineDTO();
|
OrdineDTO ordineDTO = new OrdineDTO();
|
||||||
List<ArtDTO> artRows = new ArrayList<>();
|
List<ArtDTO> artRows = new ArrayList<>();
|
||||||
@@ -80,7 +93,7 @@ public class PVOrdiniAcquistoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
int i = 0;
|
int i = 0;
|
||||||
for (ArticoloOrdine art : articoli) {
|
for (ArticoloOrdine art : articoli) {
|
||||||
i++;
|
i++;
|
||||||
artRows.add(convertArtToDTO(art,i));
|
artRows.add(convertArtToDTO(art, i));
|
||||||
}
|
}
|
||||||
|
|
||||||
ordineDTO.setChiaveGriglia(griglia.getCodAlis());
|
ordineDTO.setChiaveGriglia(griglia.getCodAlis());
|
||||||
@@ -96,9 +109,9 @@ public class PVOrdiniAcquistoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
.enqueue(new Callback<List<ServiceRESTResponse<DtbOrdt>>>() {
|
.enqueue(new Callback<List<ServiceRESTResponse<DtbOrdt>>>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call<List<ServiceRESTResponse<DtbOrdt>>> call, Response<List<ServiceRESTResponse<DtbOrdt>>> response) {
|
public void onResponse(Call<List<ServiceRESTResponse<DtbOrdt>>> call, Response<List<ServiceRESTResponse<DtbOrdt>>> response) {
|
||||||
if (response.body() != null && response.body().size() > 0){
|
if (response.body() != null && response.body().size() > 0) {
|
||||||
analyzeListOfAnswers(response, "getArticoliListino", dtoList-> {
|
analyzeListOfAnswers(response, "getArticoliListino", dtoList -> {
|
||||||
if (dtoList.size() > 0){
|
if (dtoList.size() > 0) {
|
||||||
DtbOrdt dto = dtoList.get(0);
|
DtbOrdt dto = dtoList.get(0);
|
||||||
ordine.setTransmitted(true);
|
ordine.setTransmitted(true);
|
||||||
ordine.setTransmissionDate(UtilityDate.getDateInstance());
|
ordine.setTransmissionDate(UtilityDate.getDateInstance());
|
||||||
@@ -107,7 +120,7 @@ public class PVOrdiniAcquistoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
ordine.setCodMdep(dto.getCodMdep());
|
ordine.setCodMdep(dto.getCodMdep());
|
||||||
ordine.setNumOrd(dto.getNumOrd());
|
ordine.setNumOrd(dto.getNumOrd());
|
||||||
onSuccess.run(ordine);
|
onSuccess.run(ordine);
|
||||||
}else{
|
} else {
|
||||||
onFailed.run(new Exception("Nessun ordine generato"));
|
onFailed.run(new Exception("Nessun ordine generato"));
|
||||||
}
|
}
|
||||||
}, onFailed);
|
}, onFailed);
|
||||||
@@ -115,7 +128,7 @@ public class PVOrdiniAcquistoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Call<List<ServiceRESTResponse<DtbOrdt>>>call, Throwable t) {
|
public void onFailure(Call<List<ServiceRESTResponse<DtbOrdt>>> call, Throwable t) {
|
||||||
Log.e("saveOrdineTerminale_pv", t.toString());
|
Log.e("saveOrdineTerminale_pv", t.toString());
|
||||||
UtilityLogger.errorMe(new Exception(t));
|
UtilityLogger.errorMe(new Exception(t));
|
||||||
onFailed.run(new Exception(t));
|
onFailed.run(new Exception(t));
|
||||||
@@ -123,10 +136,9 @@ public class PVOrdiniAcquistoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ArtDTO convertArtToDTO(ArticoloOrdine art, int rigaOrd) {
|
private ArtDTO convertArtToDTO(ArticoloOrdine art, int rigaOrd) {
|
||||||
ArtDTO dto = new ArtDTO();
|
ArtDTO dto = new ArtDTO();
|
||||||
dto.setRigaOrd(rigaOrd);
|
dto.setRigaOrd(rigaOrd);
|
||||||
dto.setCodMart(art.getCodMart());
|
dto.setCodMart(art.getCodMart());
|
||||||
@@ -134,6 +146,7 @@ public class PVOrdiniAcquistoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
dto.setDescrizione(art.getDescrizione());
|
dto.setDescrizione(art.getDescrizione());
|
||||||
dto.setDataInsD(art.getDataIns());
|
dto.setDataInsD(art.getDataIns());
|
||||||
dto.setUntMis(art.getUntMis());
|
dto.setUntMis(art.getUntMis());
|
||||||
|
dto.setSystemNote(art.getSystemNote());
|
||||||
dto.setQta(BigDecimal.valueOf(art.getQtaOrd()));
|
dto.setQta(BigDecimal.valueOf(art.getQtaOrd()));
|
||||||
dto.setQtaCnf(BigDecimal.valueOf(art.getQtaCnf()));
|
dto.setQtaCnf(BigDecimal.valueOf(art.getQtaCnf()));
|
||||||
dto.setColli(BigDecimal.ZERO);
|
dto.setColli(BigDecimal.ZERO);
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ public class PosizioniRESTConsumer extends _BaseRESTConsumer{
|
|||||||
String codMdep = null;
|
String codMdep = null;
|
||||||
|
|
||||||
PosizioniRESTConsumerService posizioniRESTConsumerService = RESTBuilder.getService(PosizioniRESTConsumerService.class);
|
PosizioniRESTConsumerService posizioniRESTConsumerService = RESTBuilder.getService(PosizioniRESTConsumerService.class);
|
||||||
posizioniRESTConsumerService.getAvailablePosizioni(codMdep).enqueue(new Callback<ServiceRESTResponse<List<MtbDepoPosizione>>>() {
|
posizioniRESTConsumerService.getAvailablePosizioni(codMdep).enqueue(new Callback<>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call<ServiceRESTResponse<List<MtbDepoPosizione>>> call, Response<ServiceRESTResponse<List<MtbDepoPosizione>>> response) {
|
public void onResponse(Call<ServiceRESTResponse<List<MtbDepoPosizione>>> call, Response<ServiceRESTResponse<List<MtbDepoPosizione>>> response) {
|
||||||
analyzeAnswer(response, "getAvailablePosizioni", (m) -> {
|
analyzeAnswer(response, "getAvailablePosizioni", (m) -> {
|
||||||
|
|||||||
@@ -9,13 +9,15 @@ import java.util.List;
|
|||||||
|
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.BuildConfig;
|
|
||||||
import it.integry.integrywmsnative.core.exception.NoPrintersFoundException;
|
import it.integry.integrywmsnative.core.exception.NoPrintersFoundException;
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
|
import it.integry.integrywmsnative.core.model.DtbOrdt;
|
||||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||||
|
import it.integry.integrywmsnative.core.report.ReportType;
|
||||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||||
import it.integry.integrywmsnative.core.rest.model.JasperDTO;
|
import it.integry.integrywmsnative.core.rest.model.JasperDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.JasperPairDTO;
|
import it.integry.integrywmsnative.core.rest.model.JasperPairDTO;
|
||||||
|
import it.integry.integrywmsnative.core.rest.model.ReportTypeDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityLogger;
|
import it.integry.integrywmsnative.core.utility.UtilityLogger;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||||
@@ -55,7 +57,7 @@ public class PrinterRESTConsumer extends _BaseRESTConsumer {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void printCollo(Type printerType, MtbColt testataColloToPrint, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
public void printCollo(MtbColt testataColloToPrint, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
|
|
||||||
// if (BuildConfig.DEBUG) {
|
// if (BuildConfig.DEBUG) {
|
||||||
// onComplete.run();
|
// onComplete.run();
|
||||||
@@ -64,10 +66,7 @@ public class PrinterRESTConsumer extends _BaseRESTConsumer {
|
|||||||
|
|
||||||
PrinterRESTConsumerService printerService = RESTBuilder.getService(PrinterRESTConsumerService.class);
|
PrinterRESTConsumerService printerService = RESTBuilder.getService(PrinterRESTConsumerService.class);
|
||||||
Call<ServiceRESTResponse<Object>> callable = null;
|
Call<ServiceRESTResponse<Object>> callable = null;
|
||||||
if (printerType != null)
|
callable = printerService.printCollo(testataColloToPrint);
|
||||||
callable = printerService.printCollo(printerType.toString(), testataColloToPrint);
|
|
||||||
else
|
|
||||||
callable = printerService.printCollo(testataColloToPrint);
|
|
||||||
|
|
||||||
callable.enqueue(new Callback<>() {
|
callable.enqueue(new Callback<>() {
|
||||||
@Override
|
@Override
|
||||||
@@ -119,4 +118,64 @@ public class PrinterRESTConsumer extends _BaseRESTConsumer {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void printReportType(ReportType reportType, String codMdep, String codAnag, HashMap<String, Object> params, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
|
|
||||||
|
ReportTypeDTO reportTypeDTO = new ReportTypeDTO();
|
||||||
|
reportTypeDTO.setReportType(reportType);
|
||||||
|
reportTypeDTO.setCodAnag(codAnag);
|
||||||
|
reportTypeDTO.setCodMdep(codMdep);
|
||||||
|
|
||||||
|
Stream.of(params)
|
||||||
|
.forEach(x -> reportTypeDTO.getParams().add(new JasperPairDTO(x.getKey(), x.getValue())));
|
||||||
|
|
||||||
|
PrinterRESTConsumerService printerService = RESTBuilder.getService(PrinterRESTConsumerService.class);
|
||||||
|
printerService
|
||||||
|
.printReportType(reportTypeDTO)
|
||||||
|
.enqueue(new Callback<>() {
|
||||||
|
@Override
|
||||||
|
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) {
|
||||||
|
analyzeAnswer(response, "printReportType", data -> {
|
||||||
|
onComplete.run();
|
||||||
|
}, onFailed);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Call<ServiceRESTResponse<Object>> call, Throwable t) {
|
||||||
|
if (t.getMessage().contains("Printer not found")) {
|
||||||
|
onFailed.run(new NoPrintersFoundException());
|
||||||
|
} else onFailed.run(new Exception(t));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void printReportType(ReportType reportType, HashMap<String, Object> params, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
|
printReportType(reportType, null, null, params, onComplete, onFailed);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void printReportType(ReportType reportType, String codMdep, HashMap<String, Object> params, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
|
printReportType(reportType, codMdep, null, params, onComplete, onFailed);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void printClosedOrders(List<DtbOrdt> closedOrders, String codMdep, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
|
|
||||||
|
PrinterRESTConsumerService printerService = RESTBuilder.getService(PrinterRESTConsumerService.class, 240);
|
||||||
|
Call<ServiceRESTResponse<Object>> callable = printerService.printClosedOrders(codMdep, closedOrders);
|
||||||
|
callable.enqueue(new Callback<>() {
|
||||||
|
@Override
|
||||||
|
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) {
|
||||||
|
analyzeAnswer(response, "printCollo", data -> {
|
||||||
|
onComplete.run();
|
||||||
|
}, onFailed);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Call<ServiceRESTResponse<Object>> call, Throwable t) {
|
||||||
|
if (t.getMessage().contains("Printer not found")) {
|
||||||
|
onFailed.run(new NoPrintersFoundException());
|
||||||
|
} else onFailed.run(new Exception(t));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,10 @@ package it.integry.integrywmsnative.core.rest.consumers;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.model.DtbOrdt;
|
||||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||||
import it.integry.integrywmsnative.core.rest.model.JasperDTO;
|
import it.integry.integrywmsnative.core.rest.model.JasperDTO;
|
||||||
|
import it.integry.integrywmsnative.core.rest.model.ReportTypeDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.http.Body;
|
import retrofit2.http.Body;
|
||||||
@@ -26,11 +28,9 @@ public interface PrinterRESTConsumerService {
|
|||||||
@Body JasperDTO jasperDTO
|
@Body JasperDTO jasperDTO
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@POST("printReportType")
|
||||||
@POST("wms/printEtichettaSSCC")
|
Call<ServiceRESTResponse<Object>> printReportType(
|
||||||
Call<ServiceRESTResponse<Object>> printCollo(
|
@Body ReportTypeDTO reportTypeDTO
|
||||||
@Query("printerType") String printerType,
|
|
||||||
@Body MtbColt mtbColtToPrint
|
|
||||||
);
|
);
|
||||||
|
|
||||||
@POST("wms/printEtichettaSSCC")
|
@POST("wms/printEtichettaSSCC")
|
||||||
@@ -38,4 +38,10 @@ public interface PrinterRESTConsumerService {
|
|||||||
@Body MtbColt mtbColtToPrint
|
@Body MtbColt mtbColtToPrint
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@POST("wms/printClosedOrders")
|
||||||
|
Call<ServiceRESTResponse<Object>> printClosedOrders(
|
||||||
|
@Query("codMdep") String codMdep,
|
||||||
|
@Body List<DtbOrdt> closedOrders
|
||||||
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,9 +5,7 @@ import android.util.Log;
|
|||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.GsonBuilder;
|
import com.google.gson.GsonBuilder;
|
||||||
import com.google.gson.JsonDeserializationContext;
|
|
||||||
import com.google.gson.JsonDeserializer;
|
import com.google.gson.JsonDeserializer;
|
||||||
import com.google.gson.JsonElement;
|
|
||||||
import com.google.gson.JsonParseException;
|
import com.google.gson.JsonParseException;
|
||||||
import com.google.gson.reflect.TypeToken;
|
import com.google.gson.reflect.TypeToken;
|
||||||
import com.orhanobut.logger.Logger;
|
import com.orhanobut.logger.Logger;
|
||||||
@@ -17,8 +15,7 @@ import java.io.InputStream;
|
|||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.text.ParseException;
|
import java.net.ConnectException;
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -27,6 +24,7 @@ import javax.inject.Singleton;
|
|||||||
|
|
||||||
import it.integry.integrywmsnative.BuildConfig;
|
import it.integry.integrywmsnative.BuildConfig;
|
||||||
import it.integry.integrywmsnative.core.CommonConst;
|
import it.integry.integrywmsnative.core.CommonConst;
|
||||||
|
import it.integry.integrywmsnative.core.exception.InvalidConnectionException;
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
import it.integry.integrywmsnative.core.model.Azienda;
|
import it.integry.integrywmsnative.core.model.Azienda;
|
||||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||||
@@ -35,6 +33,7 @@ import it.integry.integrywmsnative.core.rest.model.MailRequestDTO;
|
|||||||
import it.integry.integrywmsnative.core.rest.model.NativeSqlRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.NativeSqlRequestDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityLogger;
|
import it.integry.integrywmsnative.core.utility.UtilityLogger;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
@@ -50,44 +49,43 @@ public class SystemRESTConsumer extends _BaseRESTConsumer {
|
|||||||
nativeSqlDTO.nativeSql = nativeSql;
|
nativeSqlDTO.nativeSql = nativeSql;
|
||||||
|
|
||||||
SystemRESTConsumerService service = RESTBuilder.getService(SystemRESTConsumerService.class);
|
SystemRESTConsumerService service = RESTBuilder.getService(SystemRESTConsumerService.class);
|
||||||
service.processSql(nativeSqlDTO).enqueue(new Callback<>() {
|
service
|
||||||
@Override
|
.processSql(nativeSqlDTO)
|
||||||
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) {
|
.enqueue(new Callback<>() {
|
||||||
analyzeAnswer(response, "ProcessSql", o -> {
|
@Override
|
||||||
Gson gson = new GsonBuilder()
|
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) {
|
||||||
.registerTypeAdapter(Date.class, new JsonDeserializer() {
|
analyzeAnswer(response, "ProcessSql", o -> {
|
||||||
@Override
|
Gson gson = new GsonBuilder()
|
||||||
public Date deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
|
.registerTypeAdapter(Date.class, (JsonDeserializer<?>) (json, typeOfT, context) -> {
|
||||||
try {
|
|
||||||
return new SimpleDateFormat("dd/MM/yyyy HH:mm:ss").parse(json.getAsString());
|
|
||||||
} catch (Exception e) {
|
|
||||||
try {
|
try {
|
||||||
return new SimpleDateFormat().parse(json.getAsString());
|
return UtilityDate.recognizeDate(json.getAsString());
|
||||||
} catch (ParseException parseException) {
|
} catch (Exception e) {
|
||||||
throw new JsonParseException(parseException);
|
throw new JsonParseException(e);
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
}
|
.create();
|
||||||
})
|
|
||||||
.create();
|
|
||||||
|
|
||||||
|
|
||||||
String json = gson.toJson(o);
|
String json = gson.toJson(o);
|
||||||
|
|
||||||
InputStream ims = new ByteArrayInputStream(json.getBytes());
|
InputStream ims = new ByteArrayInputStream(json.getBytes());
|
||||||
Reader reader = new InputStreamReader(ims);
|
Reader reader = new InputStreamReader(ims);
|
||||||
T gsonObj = gson.fromJson(reader, clazz);
|
T gsonObj = gson.fromJson(reader, clazz);
|
||||||
|
|
||||||
onComplete.run(gsonObj);
|
onComplete.run(gsonObj);
|
||||||
}, onFailed);
|
}, onFailed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Call<ServiceRESTResponse<Object>> call, Throwable t) {
|
public void onFailure(Call<ServiceRESTResponse<Object>> call, Throwable t) {
|
||||||
Logger.e(t, "ProcessSQL");
|
Logger.e(t, "ProcessSQL");
|
||||||
onFailed.run(new Exception(t));
|
|
||||||
}
|
if (t instanceof ConnectException)
|
||||||
});
|
onFailed.run(new InvalidConnectionException(RESTBuilder.getDefaultHost(), RESTBuilder.getDefaultPort(), t));
|
||||||
|
else
|
||||||
|
onFailed.run(new Exception(t));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import android.util.Log;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.exception.NotValidLicenseException;
|
||||||
import it.integry.integrywmsnative.core.rest.CommonRESTException;
|
import it.integry.integrywmsnative.core.rest.CommonRESTException;
|
||||||
import it.integry.integrywmsnative.core.rest.model.EsitoType;
|
import it.integry.integrywmsnative.core.rest.model.EsitoType;
|
||||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||||
@@ -12,7 +13,7 @@ import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
|||||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||||
import retrofit2.Response;
|
import retrofit2.Response;
|
||||||
|
|
||||||
public class _BaseRESTConsumer {
|
public abstract class _BaseRESTConsumer {
|
||||||
|
|
||||||
public static <T> void analyzeAnswer(Response<ServiceRESTResponse<T>> response, String logTitle, RunnableArgs<T> onComplete, RunnableArgs<Exception> onFailed) {
|
public static <T> void analyzeAnswer(Response<ServiceRESTResponse<T>> response, String logTitle, RunnableArgs<T> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
if (response.isSuccessful()) {
|
if (response.isSuccessful()) {
|
||||||
@@ -30,7 +31,6 @@ public class _BaseRESTConsumer {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.e(logTitle, response.body().getErrorMessage());
|
Log.e(logTitle, response.body().getErrorMessage());
|
||||||
// callback.onFailed(new Exception(response.body().getErrorMessage()));
|
|
||||||
onFailed.run(CommonRESTException.tryRecognizeException(response.body().getErrorMessage()));
|
onFailed.run(CommonRESTException.tryRecognizeException(response.body().getErrorMessage()));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -41,7 +41,9 @@ public class _BaseRESTConsumer {
|
|||||||
if (response.code() == 404) {
|
if (response.code() == 404) {
|
||||||
Log.e(logTitle, "Errore " + response.code() + ": risorsa non trovata (" + response.raw().request().url().toString() + ")");
|
Log.e(logTitle, "Errore " + response.code() + ": risorsa non trovata (" + response.raw().request().url().toString() + ")");
|
||||||
onFailed.run(new Exception("Errore " + response.code() + ": risorsa non trovata (" + logTitle + ")"));
|
onFailed.run(new Exception("Errore " + response.code() + ": risorsa non trovata (" + logTitle + ")"));
|
||||||
} else {
|
} else if (response.code() == 550)
|
||||||
|
onFailed.run(new NotValidLicenseException());
|
||||||
|
else {
|
||||||
Log.e(logTitle, "Status " + response.code() + ": " + response.message());
|
Log.e(logTitle, "Status " + response.code() + ": " + response.message());
|
||||||
onFailed.run(new Exception("Status " + response.code() + ": " + response.message()));
|
onFailed.run(new Exception("Status " + response.code() + ": " + response.message()));
|
||||||
}
|
}
|
||||||
@@ -64,7 +66,7 @@ public class _BaseRESTConsumer {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.e(logTitle, response.body().getErrorMessage());
|
Log.e(logTitle, response.body().getErrorMessage());
|
||||||
onFailed.run(new Exception(response.body().getErrorMessage()));
|
onFailed.run(CommonRESTException.tryRecognizeException(response.body().getErrorMessage()));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.e(logTitle, response.message());
|
Log.e(logTitle, response.message());
|
||||||
@@ -74,7 +76,9 @@ public class _BaseRESTConsumer {
|
|||||||
if (response.code() == 404) {
|
if (response.code() == 404) {
|
||||||
Log.e(logTitle, "Errore " + response.code() + ": risorsa non trovata");
|
Log.e(logTitle, "Errore " + response.code() + ": risorsa non trovata");
|
||||||
onFailed.run(new Exception("Errore " + response.code() + ": risorsa non trovata (" + logTitle + ")"));
|
onFailed.run(new Exception("Errore " + response.code() + ": risorsa non trovata (" + logTitle + ")"));
|
||||||
} else {
|
} else if (response.code() == 550)
|
||||||
|
onFailed.run(new NotValidLicenseException());
|
||||||
|
else {
|
||||||
Log.e(logTitle, "Status " + response.code() + ": " + response.message());
|
Log.e(logTitle, "Status " + response.code() + ": " + response.message());
|
||||||
onFailed.run(new Exception("Status " + response.code() + ": " + response.message()));
|
onFailed.run(new Exception("Status " + response.code() + ": " + response.message()));
|
||||||
}
|
}
|
||||||
@@ -111,7 +115,9 @@ public class _BaseRESTConsumer {
|
|||||||
if (responseList.code() == 404) {
|
if (responseList.code() == 404) {
|
||||||
Log.e(logTitle, "Errore " + responseList.code() + ": risorsa non trovata");
|
Log.e(logTitle, "Errore " + responseList.code() + ": risorsa non trovata");
|
||||||
onFailed.run(new Exception("Errore " + responseList.code() + ": risorsa non trovata (" + logTitle + ")"));
|
onFailed.run(new Exception("Errore " + responseList.code() + ": risorsa non trovata (" + logTitle + ")"));
|
||||||
} else {
|
} else if (responseList.code() == 550)
|
||||||
|
onFailed.run(new NotValidLicenseException());
|
||||||
|
else {
|
||||||
Log.e(logTitle, "Status " + responseList.code() + ": " + responseList.message());
|
Log.e(logTitle, "Status " + responseList.code() + ": " + responseList.message());
|
||||||
onFailed.run(new Exception("Status " + responseList.code() + ": " + responseList.message()));
|
onFailed.run(new Exception("Status " + responseList.code() + ": " + responseList.message()));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,51 @@
|
|||||||
|
package it.integry.integrywmsnative.core.rest.model;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.report.ReportType;
|
||||||
|
|
||||||
|
public class ReportTypeDTO {
|
||||||
|
|
||||||
|
|
||||||
|
private ReportType reportType;
|
||||||
|
private String codAnag;
|
||||||
|
private String codMdep;
|
||||||
|
private List<JasperPairDTO> params = new ArrayList<>();
|
||||||
|
|
||||||
|
public List<JasperPairDTO> getParams() {
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ReportTypeDTO setParams(List<JasperPairDTO> params) {
|
||||||
|
this.params = params;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ReportType getReportType() {
|
||||||
|
return reportType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ReportTypeDTO setReportType(ReportType reportType) {
|
||||||
|
this.reportType = reportType;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCodAnag() {
|
||||||
|
return codAnag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ReportTypeDTO setCodAnag(String codAnag) {
|
||||||
|
this.codAnag = codAnag;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCodMdep() {
|
||||||
|
return codMdep;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ReportTypeDTO setCodMdep(String codMdep) {
|
||||||
|
this.codMdep = codMdep;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -19,6 +19,7 @@ public class SitArtOrdDTO {
|
|||||||
private String idViaggio;
|
private String idViaggio;
|
||||||
private String codMdep;
|
private String codMdep;
|
||||||
private boolean flagEnablePickManuale;
|
private boolean flagEnablePickManuale;
|
||||||
|
private boolean flagEnableScanArt;
|
||||||
private String codMgrp;
|
private String codMgrp;
|
||||||
private String descrizioneMgrp;
|
private String descrizioneMgrp;
|
||||||
private String codMsgr;
|
private String codMsgr;
|
||||||
@@ -145,6 +146,14 @@ public class SitArtOrdDTO {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isFlagEnableScanArt() {
|
||||||
|
return flagEnableScanArt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SitArtOrdDTO setFlagEnableScanArt(boolean flagEnableScanArt) {
|
||||||
|
this.flagEnableScanArt = flagEnableScanArt;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public String getCodMgrp() {
|
public String getCodMgrp() {
|
||||||
return codMgrp;
|
return codMgrp;
|
||||||
|
|||||||
@@ -30,23 +30,27 @@ public class ServerStatusChecker {
|
|||||||
private Runnable runnableCode = new Runnable() {
|
private Runnable runnableCode = new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if(shouldExecute && !UtilityString.isNullOrEmpty(SettingsManager.i().getServer().getHost())) {
|
if (shouldExecute && !UtilityString.isNullOrEmpty(SettingsManager.i().getServer().getHost())) {
|
||||||
UtilityServer.isEmsApiAvailable(SettingsManager.i().getServer().getHost(), SettingsManager.i().getServer().getPort(), mInternalCallback);
|
UtilityServer.isEmsApiAvailable(
|
||||||
|
SettingsManager.i().getServer().getHost(),
|
||||||
|
SettingsManager.i().getServer().getPort(),
|
||||||
|
() -> mInternalCallback.run(true),
|
||||||
|
ex -> mInternalCallback.run(false));
|
||||||
handler.postDelayed(this, MILLIS_DELAY);
|
handler.postDelayed(this, MILLIS_DELAY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public void addCallback(RunnableArgs<Boolean> callback){
|
public void addCallback(RunnableArgs<Boolean> callback) {
|
||||||
this.mCallback.add(callback);
|
this.mCallback.add(callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeCallback(RunnableArgs<Boolean> callback){
|
public void removeCallback(RunnableArgs<Boolean> callback) {
|
||||||
this.mCallback.remove(callback);
|
this.mCallback.remove(callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void init(){
|
public static void init() {
|
||||||
instance.shouldExecute = true;
|
instance.shouldExecute = true;
|
||||||
|
|
||||||
instance.handler.post(instance.runnableCode);
|
instance.handler.post(instance.runnableCode);
|
||||||
|
|||||||
@@ -3,10 +3,11 @@ package it.integry.integrywmsnative.core.settings;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.rest.model.AvailableCodMdepsDTO;
|
|
||||||
import it.integry.integrywmsnative.core.rest.model.DistribuzioneColloDTO;
|
|
||||||
import it.integry.integrywmsnative.core.model.Azienda;
|
import it.integry.integrywmsnative.core.model.Azienda;
|
||||||
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
||||||
|
import it.integry.integrywmsnative.core.model.dto.InternalCodAnagsDTO;
|
||||||
|
import it.integry.integrywmsnative.core.rest.model.AvailableCodMdepsDTO;
|
||||||
|
import it.integry.integrywmsnative.core.rest.model.DistribuzioneColloDTO;
|
||||||
|
|
||||||
public class DBSettingsModel {
|
public class DBSettingsModel {
|
||||||
|
|
||||||
@@ -15,14 +16,15 @@ public class DBSettingsModel {
|
|||||||
private List<MtbDepoPosizione> availablePosizioni = null;
|
private List<MtbDepoPosizione> availablePosizioni = null;
|
||||||
|
|
||||||
private Azienda datiAzienda = null;
|
private Azienda datiAzienda = null;
|
||||||
|
private List<InternalCodAnagsDTO> internalCodAnags = null;
|
||||||
|
|
||||||
private boolean enableCheckPartitaMagCheckPickingV;
|
private boolean enableCheckPartitaMagCheckPickingV;
|
||||||
private boolean flagMultiClienteOrdV;
|
private boolean flagMultiClienteOrdV;
|
||||||
private String defaultCodAnag;
|
private boolean flagUseCodAnagAziendale;
|
||||||
private String defaultCausaleRettificaGiacenze;
|
private String defaultCausaleRettificaGiacenze;
|
||||||
private DistribuzioneColloDTO.CriterioDistribuzione defaultCriterioDistribuzione;
|
private DistribuzioneColloDTO.CriterioDistribuzione defaultCriterioDistribuzione;
|
||||||
private boolean flagAskClienteInPickingLibero;
|
private boolean flagAskClienteInPickingLibero;
|
||||||
private boolean flagAllowEmptyClienteInPickingLibero;
|
private boolean flagPickLiberoAllowEmptyCliente;
|
||||||
|
|
||||||
private boolean flagCanAddExtraItemSpedizione;
|
private boolean flagCanAddExtraItemSpedizione;
|
||||||
private boolean flagCanAutoOpenNewULAccettazione;
|
private boolean flagCanAutoOpenNewULAccettazione;
|
||||||
@@ -36,9 +38,15 @@ public class DBSettingsModel {
|
|||||||
private boolean flagSpedizioneCanSelectMultipleOrders;
|
private boolean flagSpedizioneCanSelectMultipleOrders;
|
||||||
private List<String> notePerditaDocInterni = new ArrayList<>();
|
private List<String> notePerditaDocInterni = new ArrayList<>();
|
||||||
private boolean flagSpedizioneUseQtaOrd;
|
private boolean flagSpedizioneUseQtaOrd;
|
||||||
|
private boolean flagOrdinaNuoviArticoliInGriglia;
|
||||||
|
private boolean flagOrdinaArticoliOnScan;
|
||||||
|
private String docInterniCheckFornitore;
|
||||||
private String produzioneDefaultCodAnag;
|
private String produzioneDefaultCodAnag;
|
||||||
private String reportNameSpedizionChiudiOrdine;
|
private boolean flagPrintPackingListOnOrderClose;
|
||||||
|
private boolean flagPrintEtichetteOnOrderClose;
|
||||||
private int onNumCnfInputChanged = 1;
|
private int onNumCnfInputChanged = 1;
|
||||||
|
private boolean flagAccettazioneUseQtaOrd = false;
|
||||||
|
private boolean flagPickLiberoAllowEmptyDest = false;
|
||||||
|
|
||||||
public boolean isFlagSpedizioneEnableFakeGiacenza() {
|
public boolean isFlagSpedizioneEnableFakeGiacenza() {
|
||||||
return flagSpedizioneEnableFakeGiacenza;
|
return flagSpedizioneEnableFakeGiacenza;
|
||||||
@@ -72,7 +80,16 @@ public class DBSettingsModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public DBSettingsModel setDatiAzienda(Azienda datiAzienda) {
|
public DBSettingsModel setDatiAzienda(Azienda datiAzienda) {
|
||||||
this.datiAzienda = datiAzienda;
|
this.datiAzienda = datiAzienda;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<InternalCodAnagsDTO> getInternalCodAnags() {
|
||||||
|
return internalCodAnags;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DBSettingsModel setInternalCodAnags(List<InternalCodAnagsDTO> internalCodAnags) {
|
||||||
|
this.internalCodAnags = internalCodAnags;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,12 +119,12 @@ public class DBSettingsModel {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDefaultCodAnag() {
|
public boolean isFlagUseCodAnagAziendale() {
|
||||||
return defaultCodAnag;
|
return flagUseCodAnagAziendale;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DBSettingsModel setDefaultCodAnag(String defaultCodAnag) {
|
public DBSettingsModel setFlagUseCodAnagAziendale(boolean flagUseCodAnagAziendale) {
|
||||||
this.defaultCodAnag = defaultCodAnag;
|
this.flagUseCodAnagAziendale = flagUseCodAnagAziendale;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,12 +155,12 @@ public class DBSettingsModel {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isFlagAllowEmptyClienteInPickingLibero() {
|
public boolean isFlagPickLiberoAllowEmptyCliente() {
|
||||||
return flagAllowEmptyClienteInPickingLibero;
|
return flagPickLiberoAllowEmptyCliente;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DBSettingsModel setFlagAllowEmptyClienteInPickingLibero(boolean flagAllowEmptyClienteInPickingLibero) {
|
public DBSettingsModel setFlagPickLiberoAllowEmptyCliente(boolean flagPickLiberoAllowEmptyCliente) {
|
||||||
this.flagAllowEmptyClienteInPickingLibero = flagAllowEmptyClienteInPickingLibero;
|
this.flagPickLiberoAllowEmptyCliente = flagPickLiberoAllowEmptyCliente;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -247,6 +264,15 @@ public class DBSettingsModel {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DBSettingsModel setFlagOrdinaNuoviArticoliInGriglia(boolean flagOrdinaNuoviArticoliInGriglia) {
|
||||||
|
this.flagOrdinaNuoviArticoliInGriglia = flagOrdinaNuoviArticoliInGriglia;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getFlagOrdinaNuoviArticoliInGriglia() {
|
||||||
|
return this.flagOrdinaNuoviArticoliInGriglia;
|
||||||
|
}
|
||||||
|
|
||||||
public String getProduzioneDefaultCodAnag() {
|
public String getProduzioneDefaultCodAnag() {
|
||||||
return produzioneDefaultCodAnag;
|
return produzioneDefaultCodAnag;
|
||||||
}
|
}
|
||||||
@@ -256,12 +282,21 @@ public class DBSettingsModel {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getReportNameSpedizionChiudiOrdine() {
|
public boolean isFlagPrintPackingListOnOrderClose() {
|
||||||
return reportNameSpedizionChiudiOrdine;
|
return flagPrintPackingListOnOrderClose;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DBSettingsModel setReportNameSpedizionChiudiOrdine(String reportNameSpedizionChiudiOrdine) {
|
public DBSettingsModel setFlagPrintPackingListOnOrderClose(boolean flagPrintPackingListOnOrderClose) {
|
||||||
this.reportNameSpedizionChiudiOrdine = reportNameSpedizionChiudiOrdine;
|
this.flagPrintPackingListOnOrderClose = flagPrintPackingListOnOrderClose;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isFlagPrintEtichetteOnOrderClose() {
|
||||||
|
return flagPrintEtichetteOnOrderClose;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DBSettingsModel setFlagPrintEtichetteOnOrderClose(boolean flagPrintEtichetteOnOrderClose) {
|
||||||
|
this.flagPrintEtichetteOnOrderClose = flagPrintEtichetteOnOrderClose;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -282,4 +317,41 @@ public class DBSettingsModel {
|
|||||||
this.notePerditaDocInterni = notePerditaDocInterni;
|
this.notePerditaDocInterni = notePerditaDocInterni;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getDocInterniCheckFornitore() {
|
||||||
|
return docInterniCheckFornitore;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DBSettingsModel setDocInterniCheckFornitore(String docInterniCheckFornitore) {
|
||||||
|
this.docInterniCheckFornitore = docInterniCheckFornitore;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isFlagAccettazioneUseQtaOrd() {
|
||||||
|
return flagAccettazioneUseQtaOrd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DBSettingsModel setFlagAccettazioneUseQtaOrd(boolean flagAccettazioneUseQtaOrd) {
|
||||||
|
this.flagAccettazioneUseQtaOrd = flagAccettazioneUseQtaOrd;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isFlagPickLiberoAllowEmptyDest() {
|
||||||
|
return flagPickLiberoAllowEmptyDest;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DBSettingsModel setFlagPickLiberoAllowEmptyDest(boolean flagPickLiberoAllowEmptyDest) {
|
||||||
|
this.flagPickLiberoAllowEmptyDest = flagPickLiberoAllowEmptyDest;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean isFlagOrdinaArticoliOnScan() {
|
||||||
|
return flagOrdinaArticoliOnScan;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DBSettingsModel setFlagOrdinaArticoliOnScan(boolean flagOrdinaArticoliOnScan) {
|
||||||
|
this.flagOrdinaArticoliOnScan = flagOrdinaArticoliOnScan;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,9 @@ import android.content.Context;
|
|||||||
|
|
||||||
import com.annimon.stream.Stream;
|
import com.annimon.stream.Stream;
|
||||||
import com.google.firebase.perf.metrics.Trace;
|
import com.google.firebase.perf.metrics.Trace;
|
||||||
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
|
||||||
|
import java.lang.reflect.Type;
|
||||||
import java.net.SocketTimeoutException;
|
import java.net.SocketTimeoutException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@@ -13,6 +15,7 @@ import java.util.List;
|
|||||||
import it.integry.integrywmsnative.R;
|
import it.integry.integrywmsnative.R;
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
import it.integry.integrywmsnative.core.model.StbGestSetup;
|
import it.integry.integrywmsnative.core.model.StbGestSetup;
|
||||||
|
import it.integry.integrywmsnative.core.model.dto.InternalCodAnagsDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.GestSetupRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.GestSetupRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
||||||
@@ -88,21 +91,18 @@ public class SettingsManager {
|
|||||||
onFailed.run(new Exception("Errore durante il caricamento dei dati. Riavviare l'applicazione!"));
|
onFailed.run(new Exception("Errore durante il caricamento dei dati. Riavviare l'applicazione!"));
|
||||||
};
|
};
|
||||||
|
|
||||||
onProgress.run("dati azienda");
|
|
||||||
loadDatiAzienda(() -> {
|
|
||||||
|
|
||||||
onProgress.run("profili");
|
onProgress.run("depositi");
|
||||||
loadAvailableProfiles(() -> {
|
loadAvailableCodMdeps(() -> {
|
||||||
|
|
||||||
onProgress.run("depositi");
|
onProgress.run("posizioni");
|
||||||
loadAvailableCodMdeps(() -> {
|
loadAvailablePosizioni(() -> {
|
||||||
|
|
||||||
onProgress.run("posizioni");
|
onProgress.run("impostazioni");
|
||||||
loadAvailablePosizioni(() -> {
|
loadGestSetupValues(() -> {
|
||||||
|
|
||||||
onProgress.run("impostazioni");
|
onProgress.run("dati azienda");
|
||||||
loadGestSetupValues(tmpOnComplete, tmpOnFailed);
|
loadDatiAzienda(tmpOnComplete, tmpOnFailed);
|
||||||
}, tmpOnFailed);
|
|
||||||
}, tmpOnFailed);
|
}, tmpOnFailed);
|
||||||
}, tmpOnFailed);
|
}, tmpOnFailed);
|
||||||
}, tmpOnFailed);
|
}, tmpOnFailed);
|
||||||
@@ -113,7 +113,27 @@ public class SettingsManager {
|
|||||||
SystemRESTConsumer.getAzienda(datiAzienda -> {
|
SystemRESTConsumer.getAzienda(datiAzienda -> {
|
||||||
SettingsManager.iDB().setDatiAzienda(datiAzienda);
|
SettingsManager.iDB().setDatiAzienda(datiAzienda);
|
||||||
|
|
||||||
if (onComplete != null) onComplete.run();
|
if (!SettingsManager.iDB().isFlagUseCodAnagAziendale()) {
|
||||||
|
onComplete.run();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
String internalCodAnagsQuery = "SELECT ga.cod_anag,\n" +
|
||||||
|
" CAST(CASE WHEN vc.cod_anag IS NOT NULL THEN 1 ELSE 0 END AS BIT) AS is_cliente,\n" +
|
||||||
|
" CAST(CASE WHEN af.cod_anag IS NOT NULL THEN 1 ELSE 0 END AS BIT) AS is_fornitore\n" +
|
||||||
|
"FROM azienda\n" +
|
||||||
|
"INNER JOIN gtb_anag ga on azienda.part_iva = ga.part_iva\n" +
|
||||||
|
"LEFT OUTER JOIN vtb_clie vc on ga.cod_anag = vc.cod_anag AND vc.flag_stato = 'A'\n" +
|
||||||
|
"LEFT OUTER JOIN atb_forn af on ga.cod_anag = af.cod_anag AND af.flag_stato = 'A'";
|
||||||
|
|
||||||
|
Type type = new TypeToken<List<InternalCodAnagsDTO>>() {
|
||||||
|
}.getType();
|
||||||
|
SystemRESTConsumer.<List<InternalCodAnagsDTO>>processSqlStatic(internalCodAnagsQuery, type, internalCodAnagsList -> {
|
||||||
|
SettingsManager.iDB().setInternalCodAnags(internalCodAnagsList);
|
||||||
|
|
||||||
|
if (onComplete != null) onComplete.run();
|
||||||
|
}, onFailed);
|
||||||
|
|
||||||
}, onFailed);
|
}, onFailed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -193,7 +213,7 @@ public class SettingsManager {
|
|||||||
stbGestSetupList.add(new StbGestSetup()
|
stbGestSetupList.add(new StbGestSetup()
|
||||||
.setGestName("PICKING")
|
.setGestName("PICKING")
|
||||||
.setSection("SETUP")
|
.setSection("SETUP")
|
||||||
.setKeySection("COD_ANAG_DEFAULT"));
|
.setKeySection("FLAG_USE_COD_ANAG_AZIENDALE"));
|
||||||
stbGestSetupList.add(new StbGestSetup()
|
stbGestSetupList.add(new StbGestSetup()
|
||||||
.setGestName("PICKING")
|
.setGestName("PICKING")
|
||||||
.setSection("SETUP")
|
.setSection("SETUP")
|
||||||
@@ -238,10 +258,6 @@ public class SettingsManager {
|
|||||||
.setGestName("PICKING")
|
.setGestName("PICKING")
|
||||||
.setSection("PRODUZIONE")
|
.setSection("PRODUZIONE")
|
||||||
.setKeySection("FLAG_VERSAMENTO_DIRETTO"));
|
.setKeySection("FLAG_VERSAMENTO_DIRETTO"));
|
||||||
stbGestSetupList.add(new StbGestSetup()
|
|
||||||
.setGestName("PICKING")
|
|
||||||
.setSection("PRODUZIONE")
|
|
||||||
.setKeySection("DEFAULT_COD_ANAG"));
|
|
||||||
stbGestSetupList.add(new StbGestSetup()
|
stbGestSetupList.add(new StbGestSetup()
|
||||||
.setGestName("PICKING")
|
.setGestName("PICKING")
|
||||||
.setSection("SPEDIZIONE")
|
.setSection("SPEDIZIONE")
|
||||||
@@ -257,7 +273,11 @@ public class SettingsManager {
|
|||||||
stbGestSetupList.add(new StbGestSetup()
|
stbGestSetupList.add(new StbGestSetup()
|
||||||
.setGestName("PICKING")
|
.setGestName("PICKING")
|
||||||
.setSection("SPEDIZIONE")
|
.setSection("SPEDIZIONE")
|
||||||
.setKeySection("REPORT_PACKING_LIST"));
|
.setKeySection("FLAG_PRINT_PACKING_LIST_ON_CLOSE"));
|
||||||
|
stbGestSetupList.add(new StbGestSetup()
|
||||||
|
.setGestName("PICKING")
|
||||||
|
.setSection("SPEDIZIONE")
|
||||||
|
.setKeySection("FLAG_PRINT_ETICHETTE_ON_CLOSE"));
|
||||||
stbGestSetupList.add(new StbGestSetup()
|
stbGestSetupList.add(new StbGestSetup()
|
||||||
.setGestName("PICKING")
|
.setGestName("PICKING")
|
||||||
.setSection("SPEDIZIONE")
|
.setSection("SPEDIZIONE")
|
||||||
@@ -270,16 +290,36 @@ public class SettingsManager {
|
|||||||
.setGestName("PVM")
|
.setGestName("PVM")
|
||||||
.setSection("DOC_INTERNI")
|
.setSection("DOC_INTERNI")
|
||||||
.setKeySection("NOTE_PERDITA"));
|
.setKeySection("NOTE_PERDITA"));
|
||||||
|
stbGestSetupList.add(new StbGestSetup()
|
||||||
|
.setGestName("PVM")
|
||||||
|
.setSection("ORDINI_A")
|
||||||
|
.setKeySection("ORDINA_NUOVI_ARTICOLI"));
|
||||||
|
stbGestSetupList.add(new StbGestSetup()
|
||||||
|
.setGestName("PVM")
|
||||||
|
.setSection("ORDINI_A")
|
||||||
|
.setKeySection("ORDINA_ARTICOLI_ON_SCAN"));
|
||||||
|
stbGestSetupList.add(new StbGestSetup()
|
||||||
|
.setGestName("PVM")
|
||||||
|
.setSection("DOC_INTERNI")
|
||||||
|
.setKeySection("CHECK_FORNITORE"));
|
||||||
|
stbGestSetupList.add(new StbGestSetup()
|
||||||
|
.setGestName("PICKING")
|
||||||
|
.setSection("ACCETTAZIONE")
|
||||||
|
.setKeySection("FLAG_USE_QTA_ORD"));
|
||||||
|
stbGestSetupList.add(new StbGestSetup()
|
||||||
|
.setGestName("PICKING")
|
||||||
|
.setSection("PICKING_LIBERO")
|
||||||
|
.setKeySection("FLAG_ALLOW_EMPTY_DEST"));
|
||||||
|
|
||||||
|
|
||||||
GestSetupRESTConsumer.getValues(stbGestSetupList, list -> {
|
GestSetupRESTConsumer.getValues(stbGestSetupList, list -> {
|
||||||
dbSettingsModelIstance.setDefaultCausaleRettificaGiacenze(getValueFromList(list, "SETUP", "DEFAULT_CAUSALE_RETTIFICA_GIACENZE", String.class));
|
dbSettingsModelIstance.setDefaultCausaleRettificaGiacenze(getValueFromList(list, "SETUP", "DEFAULT_CAUSALE_RETTIFICA_GIACENZE", String.class));
|
||||||
dbSettingsModelIstance.setEnableCheckPartitaMagCheckPickingV(getValueFromList(list, "SETUP", "ENABLE_CHECK_PARTITA_MAG_PICKING_V", Boolean.class));
|
dbSettingsModelIstance.setEnableCheckPartitaMagCheckPickingV(getValueFromList(list, "SETUP", "ENABLE_CHECK_PARTITA_MAG_PICKING_V", Boolean.class));
|
||||||
dbSettingsModelIstance.setFlagMultiClienteOrdV(getValueFromList(list, "SETUP", "FLAG_MULTI_CLIENTE_ORD_VENDITA", Boolean.class));
|
dbSettingsModelIstance.setFlagMultiClienteOrdV(getValueFromList(list, "SETUP", "FLAG_MULTI_CLIENTE_ORD_VENDITA", Boolean.class));
|
||||||
dbSettingsModelIstance.setDefaultCodAnag(getValueFromList(list, "SETUP", "COD_ANAG_DEFAULT", String.class));
|
dbSettingsModelIstance.setFlagUseCodAnagAziendale(getValueFromList(list, "SETUP", "FLAG_USE_COD_ANAG_AZIENDALE", Boolean.class));
|
||||||
dbSettingsModelIstance.setDefaultCriterioDistribuzione(getValueFromList(list, "SETUP", "DEFAULT_CRITERIO_DISTRIBUZIONE", String.class));
|
dbSettingsModelIstance.setDefaultCriterioDistribuzione(getValueFromList(list, "SETUP", "DEFAULT_CRITERIO_DISTRIBUZIONE", String.class));
|
||||||
dbSettingsModelIstance.setFlagAskClienteInPickingLibero(getValueFromList(list, "PICKING_LIBERO", "FLAG_ASK_CLIENTE", Boolean.class));
|
dbSettingsModelIstance.setFlagAskClienteInPickingLibero(getValueFromList(list, "PICKING_LIBERO", "FLAG_ASK_CLIENTE", Boolean.class));
|
||||||
dbSettingsModelIstance.setFlagAllowEmptyClienteInPickingLibero(getValueFromList(list, "PICKING_LIBERO", "FLAG_ALLOW_EMPTY_CLIENTE", Boolean.class));
|
dbSettingsModelIstance.setFlagPickLiberoAllowEmptyCliente(getValueFromList(list, "PICKING_LIBERO", "FLAG_ALLOW_EMPTY_CLIENTE", Boolean.class));
|
||||||
dbSettingsModelIstance.setFlagCanAddExtraItemSpedizione(getValueFromList(list, "SPEDIZIONE", "FLAG_CAN_ADD_EXTRA_ITEMS", Boolean.class));
|
dbSettingsModelIstance.setFlagCanAddExtraItemSpedizione(getValueFromList(list, "SPEDIZIONE", "FLAG_CAN_ADD_EXTRA_ITEMS", Boolean.class));
|
||||||
dbSettingsModelIstance.setFlagCanAutoOpenNewULAccettazione(getValueFromList(list, "ACCETTAZIONE", "FLAG_AUTO_OPEN_NEW_UL", Boolean.class));
|
dbSettingsModelIstance.setFlagCanAutoOpenNewULAccettazione(getValueFromList(list, "ACCETTAZIONE", "FLAG_AUTO_OPEN_NEW_UL", Boolean.class));
|
||||||
dbSettingsModelIstance.setFlagCanAddExtraQuantitySpedizione(getValueFromList(list, "SPEDIZIONE", "FLAG_CAN_ADD_EXTRA_QUANTITY", Boolean.class));
|
dbSettingsModelIstance.setFlagCanAddExtraQuantitySpedizione(getValueFromList(list, "SPEDIZIONE", "FLAG_CAN_ADD_EXTRA_QUANTITY", Boolean.class));
|
||||||
@@ -288,14 +328,20 @@ public class SettingsManager {
|
|||||||
dbSettingsModelIstance.setFlagAskPesoColloSpedizione(getValueFromList(list, "SETUP", "FLAG_ASK_PESO_COLLO", Boolean.class));
|
dbSettingsModelIstance.setFlagAskPesoColloSpedizione(getValueFromList(list, "SETUP", "FLAG_ASK_PESO_COLLO", Boolean.class));
|
||||||
dbSettingsModelIstance.setFlagUseNewPickingListSpedizione(getValueFromList(list, "SPEDIZIONE", "FLAG_USE_NEW_PICKING_LIST", Boolean.class));
|
dbSettingsModelIstance.setFlagUseNewPickingListSpedizione(getValueFromList(list, "SPEDIZIONE", "FLAG_USE_NEW_PICKING_LIST", Boolean.class));
|
||||||
dbSettingsModelIstance.setFlagVersamentoDirettoProduzione(getValueFromList(list, "PRODUZIONE", "FLAG_VERSAMENTO_DIRETTO", Boolean.class));
|
dbSettingsModelIstance.setFlagVersamentoDirettoProduzione(getValueFromList(list, "PRODUZIONE", "FLAG_VERSAMENTO_DIRETTO", Boolean.class));
|
||||||
dbSettingsModelIstance.setProduzioneDefaultCodAnag(getValueFromList(list, "PRODUZIONE", "DEFAULT_COD_ANAG", String.class));
|
|
||||||
dbSettingsModelIstance.setFlagSpedizioneEnableManualPick(getValueFromList(list, "SPEDIZIONE", "ENABLE_MANUAL_PICK", Boolean.class));
|
dbSettingsModelIstance.setFlagSpedizioneEnableManualPick(getValueFromList(list, "SPEDIZIONE", "ENABLE_MANUAL_PICK", Boolean.class));
|
||||||
dbSettingsModelIstance.setFlagSpedizioneEnableFakeGiacenza(getValueFromList(list, "SPEDIZIONE", "ENABLE_FAKE_GIACENZA", Boolean.class));
|
dbSettingsModelIstance.setFlagSpedizioneEnableFakeGiacenza(getValueFromList(list, "SPEDIZIONE", "ENABLE_FAKE_GIACENZA", Boolean.class));
|
||||||
dbSettingsModelIstance.setFlagSpedizioneCanSelectMultipleOrders(getValueFromList(list, "SPEDIZIONE", "FLAG_CAN_SELECT_MULTIPLE_ORDERS", Boolean.class));
|
dbSettingsModelIstance.setFlagSpedizioneCanSelectMultipleOrders(getValueFromList(list, "SPEDIZIONE", "FLAG_CAN_SELECT_MULTIPLE_ORDERS", Boolean.class));
|
||||||
dbSettingsModelIstance.setReportNameSpedizionChiudiOrdine(getValueFromList(list, "SPEDIZIONE", "REPORT_PACKING_LIST", String.class));
|
// dbSettingsModelIstance.setFlagPrintPackingListOnOrderClose(getValueFromList(list, "SPEDIZIONE", "FLAG_PRINT_PACKING_LIST_ON_CLOSE", Boolean.class));
|
||||||
|
// dbSettingsModelIstance.setFlagPrintEtichetteOnOrderClose(getValueFromList(list, "SPEDIZIONE", "FLAG_PRINT_ETICHETTE_ON_CLOSE", Boolean.class));
|
||||||
dbSettingsModelIstance.setFlagSpedizioneUseQtaOrd(getValueFromList(list, "SPEDIZIONE", "FLAG_USE_QTA_ORD", Boolean.class));
|
dbSettingsModelIstance.setFlagSpedizioneUseQtaOrd(getValueFromList(list, "SPEDIZIONE", "FLAG_USE_QTA_ORD", Boolean.class));
|
||||||
String notePerdita = getValueFromList(list,"DOC_INTERNI","NOTE_PERDITA",String.class);
|
dbSettingsModelIstance.setFlagOrdinaNuoviArticoliInGriglia(getValueFromList(list, "ORDINI_A", "ORDINA_NUOVI_ARTICOLI", Boolean.class));
|
||||||
if (notePerdita != null){
|
dbSettingsModelIstance.setDocInterniCheckFornitore(getValueFromList(list, "DOC_INTERNI", "CHECK_FORNITORE", String.class));
|
||||||
|
dbSettingsModelIstance.setFlagAccettazioneUseQtaOrd(getValueFromList(list, "ACCETTAZIONE", "FLAG_USE_QTA_ORD", Boolean.class));
|
||||||
|
dbSettingsModelIstance.setFlagPickLiberoAllowEmptyDest(getValueFromList(list, "PICKING_LIBERO", "FLAG_ALLOW_EMPTY_DEST", Boolean.class));
|
||||||
|
dbSettingsModelIstance.setFlagOrdinaArticoliOnScan(getValueFromList(list, "ORDINI_A", "ORDINA_ARTICOLI_ON_SCAN", Boolean.class));
|
||||||
|
|
||||||
|
String notePerdita = getValueFromList(list, "DOC_INTERNI", "NOTE_PERDITA", String.class);
|
||||||
|
if (notePerdita != null) {
|
||||||
dbSettingsModelIstance.setNotePerditaDocInterni(Arrays.asList(notePerdita.split("\\|")));
|
dbSettingsModelIstance.setNotePerditaDocInterni(Arrays.asList(notePerdita.split("\\|")));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -303,8 +349,14 @@ public class SettingsManager {
|
|||||||
if (onNumCnfInputChanged != null) {
|
if (onNumCnfInputChanged != null) {
|
||||||
dbSettingsModelIstance.setOnNumCnfInputChanged(onNumCnfInputChanged);
|
dbSettingsModelIstance.setOnNumCnfInputChanged(onNumCnfInputChanged);
|
||||||
}
|
}
|
||||||
|
String codMdep = SettingsManager.i().getUserSession().getDepo().getCodMdep();
|
||||||
if (onComplete != null) onComplete.run();
|
GestSetupRESTConsumer.getBooleanValue("PICKING", "SPEDIZIONE", "FLAG_PRINT_PACKING_LIST_ON_CLOSE", codMdep, (value) -> {
|
||||||
|
dbSettingsModelIstance.setFlagPrintPackingListOnOrderClose(value);
|
||||||
|
GestSetupRESTConsumer.getBooleanValue("PICKING", "SPEDIZIONE", "FLAG_PRINT_ETICHETTE_ON_CLOSE", codMdep, (gestSetupDTO) -> {
|
||||||
|
dbSettingsModelIstance.setFlagPrintEtichetteOnOrderClose(value);
|
||||||
|
if (onComplete != null) onComplete.run();
|
||||||
|
}, onFailed);
|
||||||
|
}, onFailed);
|
||||||
}, onFailed);
|
}, onFailed);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,60 +0,0 @@
|
|||||||
package it.integry.integrywmsnative.core.update;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.net.Uri;
|
|
||||||
import android.os.AsyncTask;
|
|
||||||
import android.os.Environment;
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.net.HttpURLConnection;
|
|
||||||
import java.net.URL;
|
|
||||||
|
|
||||||
public class UpdateApp extends AsyncTask<String,Void,Void> {
|
|
||||||
private Context context;
|
|
||||||
public void setContext(Context contextf){
|
|
||||||
context = contextf;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Void doInBackground(String... arg0) {
|
|
||||||
try {
|
|
||||||
URL url = new URL(arg0[0]);
|
|
||||||
HttpURLConnection c = (HttpURLConnection) url.openConnection();
|
|
||||||
c.setRequestMethod("GET");
|
|
||||||
c.setDoOutput(true);
|
|
||||||
c.connect();
|
|
||||||
|
|
||||||
File file = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
|
|
||||||
file.mkdirs();
|
|
||||||
File outputFile = new File(file, "update.apk");
|
|
||||||
if(outputFile.exists()){
|
|
||||||
outputFile.delete();
|
|
||||||
}
|
|
||||||
FileOutputStream fos = new FileOutputStream(outputFile);
|
|
||||||
|
|
||||||
InputStream is = c.getInputStream();
|
|
||||||
|
|
||||||
byte[] buffer = new byte[1024];
|
|
||||||
int len1 = 0;
|
|
||||||
while ((len1 = is.read(buffer)) != -1) {
|
|
||||||
fos.write(buffer, 0, len1);
|
|
||||||
}
|
|
||||||
fos.close();
|
|
||||||
is.close();
|
|
||||||
|
|
||||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
|
||||||
intent.setDataAndType(Uri.fromFile(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS)), "application/vnd.android.package-archive");
|
|
||||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // without this flag android returned a intent error!
|
|
||||||
context.startActivity(intent);
|
|
||||||
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.e("UpdateAPP", "Update error! " + e.getMessage());
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,30 +1,35 @@
|
|||||||
package it.integry.integrywmsnative.core.update;
|
package it.integry.integrywmsnative.core.update;
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.app.DownloadManager;
|
|
||||||
import android.content.BroadcastReceiver;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
import com.github.javiersantos.appupdater.AppUpdater;
|
import com.github.javiersantos.appupdater.AppUpdater;
|
||||||
import com.github.javiersantos.appupdater.enums.Display;
|
import com.github.javiersantos.appupdater.enums.Display;
|
||||||
import com.github.javiersantos.appupdater.enums.UpdateFrom;
|
import com.github.javiersantos.appupdater.enums.UpdateFrom;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.R;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.class_router.BaseCustomConfiguration;
|
import it.integry.integrywmsnative.core.class_router.BaseCustomConfiguration;
|
||||||
import it.integry.integrywmsnative.core.class_router.ClassRouter;
|
import it.integry.integrywmsnative.core.class_router.ClassRouter;
|
||||||
import it.integry.integrywmsnative.core.class_router.interfaces.ICustomConfiguration;
|
import it.integry.integrywmsnative.core.class_router.interfaces.ICustomConfiguration;
|
||||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||||
|
import it.integry.integrywmsnative.core.utility.FileDownloader;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.DialogProgressView;
|
||||||
|
|
||||||
|
@Singleton
|
||||||
public class UpdatesManager {
|
public class UpdatesManager {
|
||||||
|
|
||||||
public static void init(Activity context) {
|
private AppCompatActivity mContext;
|
||||||
|
|
||||||
|
public void init(AppCompatActivity activityContext) {
|
||||||
|
this.mContext = activityContext;
|
||||||
|
|
||||||
String suffix;
|
String suffix;
|
||||||
ICustomConfiguration customConfiguration = ClassRouter.getInstance(ClassRouter.PATH.CUSTOM_CONFIGURATION);
|
ICustomConfiguration customConfiguration = ClassRouter.getInstance(ClassRouter.PATH.CUSTOM_CONFIGURATION);
|
||||||
try {
|
try {
|
||||||
@@ -40,64 +45,67 @@ public class UpdatesManager {
|
|||||||
String currentDownloadUrl = "http://" + SettingsManager.i().getServer().getHost() + ":" + SettingsManager.i().getServer().getPort() + "/ems-api/wms/android-release" + suffix + ".apk";
|
String currentDownloadUrl = "http://" + SettingsManager.i().getServer().getHost() + ":" + SettingsManager.i().getServer().getPort() + "/ems-api/wms/android-release" + suffix + ".apk";
|
||||||
|
|
||||||
|
|
||||||
AppUpdater appUpdater = new AppUpdater(context)
|
AppUpdater appUpdater = new AppUpdater(mContext)
|
||||||
.setDisplay(Display.DIALOG)
|
.setDisplay(Display.DIALOG)
|
||||||
.setUpdateFrom(UpdateFrom.JSON)
|
.setUpdateFrom(UpdateFrom.JSON)
|
||||||
.setUpdateJSON(currentVersionUrl)
|
.setUpdateJSON(currentVersionUrl)
|
||||||
.setButtonDoNotShowAgain(null)
|
.setButtonDoNotShowAgain(null)
|
||||||
.setButtonUpdateClickListener((dialog, which) -> {
|
.setButtonUpdateClickListener((dialog, which) -> {
|
||||||
installAPK(context, currentDownloadUrl);
|
installAPK(currentDownloadUrl);
|
||||||
});
|
});
|
||||||
appUpdater.start();
|
appUpdater.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static void installAPK(Activity context, String downloadURL) {
|
private void installAPK(String downloadURL) {
|
||||||
|
|
||||||
String destination = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS) + "/";
|
String destination = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS) + "/";
|
||||||
String fileName = context.getResources().getString(R.string.app_name) + ".apk";
|
|
||||||
destination += fileName;
|
|
||||||
final Uri uri = Uri.parse("file://" + destination);
|
|
||||||
|
|
||||||
//Delete update file if exists
|
var progressDialog = DialogProgressView.newInstance("Download", null, false);
|
||||||
final File file = new File(destination);
|
progressDialog.show(mContext.getSupportFragmentManager(), "tag");
|
||||||
if (file.exists())
|
|
||||||
file.delete();
|
|
||||||
|
|
||||||
//set downloadmanager
|
|
||||||
DownloadManager.Request request = new DownloadManager.Request(Uri.parse(downloadURL));
|
|
||||||
request.setDescription(context.getString(R.string.notification_update_download));
|
|
||||||
request.setTitle(context.getString(R.string.app_name));
|
|
||||||
|
|
||||||
//set destination
|
var fileDownloader = new FileDownloader()
|
||||||
request.setDestinationUri(uri);
|
.setDestFolder(destination)
|
||||||
|
.setUrlString(downloadURL)
|
||||||
|
.setOnProgressUpdate(progress -> {
|
||||||
|
mContext.runOnUiThread(() -> {
|
||||||
|
progressDialog.setProgress(progress);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.setOnDownloadCompleted(destPath -> {
|
||||||
|
|
||||||
// get download service and enqueue file
|
mContext.runOnUiThread(() -> {
|
||||||
final DownloadManager manager = (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE);
|
progressDialog.dismiss();
|
||||||
manager.enqueue(request);
|
|
||||||
|
|
||||||
//set BroadcastReceiver to install app when .apk is downloaded
|
Uri fileLoc;
|
||||||
BroadcastReceiver onComplete = new BroadcastReceiver() {
|
Intent intent;
|
||||||
public void onReceive(Context ctxt, Intent i) {
|
|
||||||
|
|
||||||
Uri fileLoc;
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||||
Intent intent;
|
intent = new Intent(Intent.ACTION_INSTALL_PACKAGE);
|
||||||
|
fileLoc = GenericFileProvider.getUriForFile(mContext,
|
||||||
|
mContext.getApplicationContext().getPackageName() + ".core.update.GenericFileProvider",
|
||||||
|
new File(destPath));
|
||||||
|
} else {
|
||||||
|
intent = new Intent(Intent.ACTION_VIEW);
|
||||||
|
fileLoc = Uri.fromFile(new File(destPath));
|
||||||
|
}
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
intent.setDataAndType(fileLoc, "application/vnd.android.package-archive");
|
||||||
intent = new Intent(Intent.ACTION_INSTALL_PACKAGE);
|
intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
fileLoc = GenericFileProvider.getUriForFile(context, context.getApplicationContext().getPackageName() + ".core.update.GenericFileProvider", file);
|
|
||||||
} else {
|
|
||||||
intent = new Intent(Intent.ACTION_VIEW);
|
|
||||||
fileLoc = Uri.fromFile(file);
|
|
||||||
}
|
|
||||||
|
|
||||||
intent.setDataAndType(fileLoc, "application/vnd.android.package-archive");
|
mContext.startActivity(intent);
|
||||||
intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
});
|
||||||
|
|
||||||
context.startActivity(intent);
|
});
|
||||||
|
|
||||||
|
|
||||||
|
new Thread(() -> {
|
||||||
|
try {
|
||||||
|
fileDownloader.download();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
};
|
}).start();
|
||||||
|
|
||||||
//register receiver for when .apk download is compete
|
|
||||||
context.registerReceiver(onComplete, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,113 @@
|
|||||||
|
package it.integry.integrywmsnative.core.utility;
|
||||||
|
|
||||||
|
import android.webkit.URLUtil;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.net.HttpURLConnection;
|
||||||
|
import java.net.URL;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
|
|
||||||
|
public class FileDownloader {
|
||||||
|
|
||||||
|
private String urlString;
|
||||||
|
private String destFolder;
|
||||||
|
|
||||||
|
private RunnableArgs<Integer> onProgressUpdate;
|
||||||
|
private RunnableArgs<String> onDownloadCompleted;
|
||||||
|
|
||||||
|
|
||||||
|
public void download() throws Exception {
|
||||||
|
InputStream input = null;
|
||||||
|
OutputStream output = null;
|
||||||
|
HttpURLConnection connection = null;
|
||||||
|
String destPathFile;
|
||||||
|
|
||||||
|
try {
|
||||||
|
File direct = new File(destFolder);
|
||||||
|
if (!direct.exists()) {
|
||||||
|
direct.mkdirs();
|
||||||
|
}
|
||||||
|
|
||||||
|
URL url = new URL(urlString);
|
||||||
|
connection = (HttpURLConnection) url.openConnection();
|
||||||
|
connection.connect();
|
||||||
|
connection.setConnectTimeout(120 * 1000);
|
||||||
|
|
||||||
|
if (connection.getResponseCode() != HttpURLConnection.HTTP_OK)
|
||||||
|
throw new Exception("Server returned HTTP " + connection.getResponseCode() + " " + connection.getResponseMessage());
|
||||||
|
|
||||||
|
input = connection.getInputStream();
|
||||||
|
int totalBytesToDownload = connection.getContentLength();
|
||||||
|
int downloadedBytes = 0;
|
||||||
|
|
||||||
|
String title = URLUtil.guessFileName(String.valueOf(url), null, null);
|
||||||
|
|
||||||
|
destPathFile = destFolder + title;
|
||||||
|
|
||||||
|
if (new File(destPathFile).exists())
|
||||||
|
new File(destPathFile).delete();
|
||||||
|
|
||||||
|
output = new FileOutputStream(destPathFile);
|
||||||
|
|
||||||
|
byte[] buf = new byte[1024];
|
||||||
|
int len;
|
||||||
|
while ((len = input.read(buf)) > 0) {
|
||||||
|
output.write(buf, 0, len);
|
||||||
|
|
||||||
|
downloadedBytes += len;
|
||||||
|
if (onProgressUpdate != null)
|
||||||
|
onProgressUpdate.run((downloadedBytes * 100) / totalBytesToDownload);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw e;
|
||||||
|
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
if (output != null)
|
||||||
|
output.close();
|
||||||
|
if (input != null)
|
||||||
|
input.close();
|
||||||
|
} catch (IOException ignored) {
|
||||||
|
}
|
||||||
|
if (connection != null)
|
||||||
|
connection.disconnect();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (onDownloadCompleted != null) onDownloadCompleted.run(destPathFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getUrlString() {
|
||||||
|
return urlString;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FileDownloader setUrlString(String urlString) {
|
||||||
|
this.urlString = urlString;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDestFolder() {
|
||||||
|
return destFolder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FileDownloader setDestFolder(String destFolder) {
|
||||||
|
this.destFolder = destFolder;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FileDownloader setOnProgressUpdate(RunnableArgs<Integer> onProgressUpdate) {
|
||||||
|
this.onProgressUpdate = onProgressUpdate;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FileDownloader setOnDownloadCompleted(RunnableArgs<String> onDownloadCompleted) {
|
||||||
|
this.onDownloadCompleted = onDownloadCompleted;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,16 +3,15 @@ package it.integry.integrywmsnative.core.utility;
|
|||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.widget.Toast;
|
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.core.app.ActivityCompat;
|
||||||
|
|
||||||
import com.annimon.stream.Stream;
|
import com.annimon.stream.Stream;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
|
||||||
import androidx.core.app.ActivityCompat;
|
|
||||||
import it.integry.integrywmsnative.SplashActivity;
|
import it.integry.integrywmsnative.SplashActivity;
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
|
|
||||||
@@ -31,6 +30,11 @@ public class PermissionsHelper {
|
|||||||
if(Build.VERSION.SDK_INT >= 23) {
|
if(Build.VERSION.SDK_INT >= 23) {
|
||||||
//permissionsToAsk.add(Manifest.permission.REQUEST_INSTALL_PACKAGES);
|
//permissionsToAsk.add(Manifest.permission.REQUEST_INSTALL_PACKAGES);
|
||||||
}
|
}
|
||||||
|
if(Build.VERSION.SDK_INT >= 31) {
|
||||||
|
permissionsToAsk.add(Manifest.permission.BLUETOOTH_CONNECT);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
String[] permissionArray = new String[permissionsToAsk.size()];
|
String[] permissionArray = new String[permissionsToAsk.size()];
|
||||||
permissionsToAsk.toArray(permissionArray);
|
permissionsToAsk.toArray(permissionArray);
|
||||||
|
|||||||
@@ -13,10 +13,10 @@ public class UtilityBarcode {
|
|||||||
|
|
||||||
|
|
||||||
public static boolean isBarcodeOrdineV(BarcodeScanDTO barcodeScanDTO) {
|
public static boolean isBarcodeOrdineV(BarcodeScanDTO barcodeScanDTO) {
|
||||||
return (isEan13(barcodeScanDTO) || isEtichetta128(barcodeScanDTO)) && barcodeScanDTO.getStringValue().startsWith("3");
|
return (isEan13(barcodeScanDTO) || isEtichetta128(barcodeScanDTO)) && barcodeScanDTO.getStringValue().startsWith("3");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isEtichettaAnonima(BarcodeScanDTO barcodeScanDTO){
|
public static boolean isEtichettaAnonima(BarcodeScanDTO barcodeScanDTO) {
|
||||||
return barcodeScanDTO != null && barcodeScanDTO.getType() == BarcodeType.CODE128 && barcodeScanDTO.getStringValue().startsWith("U");
|
return barcodeScanDTO != null && barcodeScanDTO.getType() == BarcodeType.CODE128 && barcodeScanDTO.getStringValue().startsWith("U");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ public class UtilityBarcode {
|
|||||||
return fullYear.equalsIgnoreCase("" + currentYear);
|
return fullYear.equalsIgnoreCase("" + currentYear);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isEtichetta128(BarcodeScanDTO barcodeScanDTO){
|
public static boolean isEtichetta128(BarcodeScanDTO barcodeScanDTO) {
|
||||||
return barcodeScanDTO != null && (barcodeScanDTO.getType() == BarcodeType.CODE128 || barcodeScanDTO.getType() == BarcodeType.EAN128);
|
return barcodeScanDTO != null && (barcodeScanDTO.getType() == BarcodeType.CODE128 || barcodeScanDTO.getType() == BarcodeType.EAN128);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,12 +42,12 @@ public class UtilityBarcode {
|
|||||||
String barcode = barcodeScanDTO.getStringValue();
|
String barcode = barcodeScanDTO.getStringValue();
|
||||||
boolean isPosizione = false;
|
boolean isPosizione = false;
|
||||||
|
|
||||||
if(SettingsManager.iDB().getAvailablePosizioni() != null) {
|
if (SettingsManager.iDB().getAvailablePosizioni() != null) {
|
||||||
Stream<MtbDepoPosizione> tmpStream = Stream.of(SettingsManager.iDB().getAvailablePosizioni())
|
Stream<MtbDepoPosizione> tmpStream = Stream.of(SettingsManager.iDB().getAvailablePosizioni())
|
||||||
.filter(x -> x.getPosizione().equalsIgnoreCase(barcode) && (!enableCheckCodMdep || currentCodMdep.equalsIgnoreCase(x.getCodMdep())));
|
.filter(x -> x.getPosizione().equalsIgnoreCase(barcode) && (!enableCheckCodMdep || currentCodMdep.equalsIgnoreCase(x.getCodMdep())));
|
||||||
|
|
||||||
if(tmpStream.count() > 0){
|
if (tmpStream.count() > 0) {
|
||||||
isPosizione = true;
|
isPosizione = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,7 +59,6 @@ public class UtilityBarcode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static boolean isEanPeso(BarcodeScanDTO barcodeScanDTO) {
|
public static boolean isEanPeso(BarcodeScanDTO barcodeScanDTO) {
|
||||||
return (isEtichetta128(barcodeScanDTO) || isEan13(barcodeScanDTO)) && barcodeScanDTO.getStringValue().startsWith("2");
|
return (isEtichetta128(barcodeScanDTO) || isEan13(barcodeScanDTO)) && barcodeScanDTO.getStringValue().startsWith("2");
|
||||||
}
|
}
|
||||||
@@ -81,31 +80,31 @@ public class UtilityBarcode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static Integer getNumColloFromULAnonima(String barcode) throws Exception {
|
||||||
public static Integer getNumColloFromULAnonima(String barcode) {
|
if (!UtilityString.isNullOrEmpty(barcode)) {
|
||||||
if(!UtilityString.isNullOrEmpty(barcode)) {
|
|
||||||
barcode = barcode.trim();
|
barcode = barcode.trim();
|
||||||
|
try {
|
||||||
return Integer.parseInt(barcode.substring(3));
|
return Integer.parseInt(barcode.substring(3, 10));
|
||||||
|
} catch (NumberFormatException nfex) {
|
||||||
|
throw new Exception("Impossibile leggere il numero collo dal barcode: " + barcode);
|
||||||
|
}
|
||||||
} else
|
} else
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static Integer getAnnoColloFromULAnonima(String barcode) {
|
public static Integer getAnnoColloFromULAnonima(String barcode) {
|
||||||
if(barcode != null){
|
if (barcode != null) {
|
||||||
return Integer.parseInt(barcode.substring(1, 3));
|
return Integer.parseInt(barcode.substring(1, 3));
|
||||||
} else
|
} else
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static String convertITF14toEAN13(String barcodeITF14) {
|
public static String convertITF14toEAN13(String barcodeITF14) {
|
||||||
String barcodeEAN13 = null;
|
String barcodeEAN13 = null;
|
||||||
|
|
||||||
if(barcodeITF14.length() == 14) {
|
if (barcodeITF14.length() == 14) {
|
||||||
barcodeEAN13 = barcodeITF14.substring(1, barcodeITF14.length() - 1).trim();
|
barcodeEAN13 = barcodeITF14.substring(1, barcodeITF14.length() - 1).trim();
|
||||||
barcodeEAN13 += getEAN13CheckDigit(barcodeEAN13);
|
barcodeEAN13 += getEAN13CheckDigit(barcodeEAN13);
|
||||||
}
|
}
|
||||||
@@ -116,7 +115,7 @@ public class UtilityBarcode {
|
|||||||
public static String convertITF14toNeutral(String barcodeITF14) {
|
public static String convertITF14toNeutral(String barcodeITF14) {
|
||||||
String barcodeNeutral = null;
|
String barcodeNeutral = null;
|
||||||
|
|
||||||
if(barcodeITF14.length() == 14) {
|
if (barcodeITF14.length() == 14) {
|
||||||
barcodeNeutral = barcodeITF14.substring(1, barcodeITF14.length() - 1);
|
barcodeNeutral = barcodeITF14.substring(1, barcodeITF14.length() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,10 +123,10 @@ public class UtilityBarcode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static String getEAN13CheckDigit(String ean) {
|
private static String getEAN13CheckDigit(String ean) {
|
||||||
|
|
||||||
if (ean.length() != 12) {
|
if (ean.length() != 12) {
|
||||||
UtilityLogger.errorMe(new Exception("Please provide an input string of 12 chars. Current lenght: "+ean.length()));
|
UtilityLogger.errorMe(new Exception("Please provide an input string of 12 chars. Current lenght: " + ean.length()));
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
long tot = 0;
|
long tot = 0;
|
||||||
@@ -135,7 +134,7 @@ public class UtilityBarcode {
|
|||||||
for (int i = 0; i < 12; i++) {
|
for (int i = 0; i < 12; i++) {
|
||||||
tot = tot + (Long.parseLong(String.valueOf(ean.charAt(i))) * (i % 2 == 0 ? 1 : 3));
|
tot = tot + (Long.parseLong(String.valueOf(ean.charAt(i))) * (i % 2 == 0 ? 1 : 3));
|
||||||
}
|
}
|
||||||
return tot % 10 == 0 ? "0" : "" + ( 10 - ( tot % 10));
|
return tot % 10 == 0 ? "0" : "" + (10 - (tot % 10));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package it.integry.integrywmsnative.core.utility;
|
package it.integry.integrywmsnative.core.utility;
|
||||||
|
|
||||||
import android.app.Dialog;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
|
|
||||||
@@ -12,18 +11,24 @@ import com.google.firebase.crashlytics.FirebaseCrashlytics;
|
|||||||
import com.orhanobut.logger.Logger;
|
import com.orhanobut.logger.Logger;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.BuildConfig;
|
import it.integry.integrywmsnative.BuildConfig;
|
||||||
|
import it.integry.integrywmsnative.core.exception.InvalidConnectionException;
|
||||||
|
import it.integry.integrywmsnative.core.exception.InvalidLUException;
|
||||||
|
import it.integry.integrywmsnative.core.exception.InvalidLUGestioneException;
|
||||||
import it.integry.integrywmsnative.core.rest.CommonRESTException;
|
import it.integry.integrywmsnative.core.rest.CommonRESTException;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.DialogProgressView;
|
||||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||||
|
|
||||||
public class UtilityExceptions {
|
public class UtilityExceptions {
|
||||||
|
|
||||||
private static final Class<? extends Exception>[] FIREBASE_IGNORED_EXCEPTIONS = new Class[] {
|
private static final Class<?>[] FIREBASE_IGNORED_EXCEPTIONS = new Class[] {
|
||||||
|
InvalidConnectionException.class,
|
||||||
|
InvalidLUGestioneException.class,
|
||||||
|
InvalidLUException.class
|
||||||
};
|
};
|
||||||
|
|
||||||
public static void defaultException(Context context, Exception ex, Dialog progressDialog) {
|
public static void defaultException(Context context, Exception ex, DialogProgressView progressDialog) {
|
||||||
defaultException(context, ex);
|
defaultException(context, ex);
|
||||||
if (progressDialog != null) progressDialog.dismiss();
|
if (progressDialog != null && progressDialog.isVisible()) progressDialog.dismiss();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void defaultException(Context context, Exception ex) {
|
public static void defaultException(Context context, Exception ex) {
|
||||||
|
|||||||
@@ -8,7 +8,8 @@ public class UtilityFocus {
|
|||||||
|
|
||||||
public static void focusTextBox(Context context, EditText editTextToFocus) {
|
public static void focusTextBox(Context context, EditText editTextToFocus) {
|
||||||
editTextToFocus.requestFocus();
|
editTextToFocus.requestFocus();
|
||||||
|
editTextToFocus.setSelectAllOnFocus(true);
|
||||||
|
editTextToFocus.selectAll();
|
||||||
InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
|
InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||||
imm.showSoftInput(editTextToFocus, InputMethodManager.SHOW_IMPLICIT);
|
imm.showSoftInput(editTextToFocus, InputMethodManager.SHOW_IMPLICIT);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package it.integry.integrywmsnative.core.utility;
|
package it.integry.integrywmsnative.core.utility;
|
||||||
|
|
||||||
import com.google.android.gms.common.internal.service.Common;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.text.DecimalFormatSymbols;
|
import java.text.DecimalFormatSymbols;
|
||||||
|
|||||||
@@ -31,10 +31,13 @@ public class UtilityPosizione {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static MtbDepoPosizione getFromCache(String posizione) {
|
public static MtbDepoPosizione getFromCache(String posizione) {
|
||||||
List<MtbDepoPosizione> tmpList = Stream.of(SettingsManager.iDB().getAvailablePosizioni())
|
var availablePosizioni = SettingsManager.iDB().getAvailablePosizioni();
|
||||||
|
if(availablePosizioni == null) return null;
|
||||||
|
|
||||||
|
List<MtbDepoPosizione> tmpList = Stream.of(availablePosizioni)
|
||||||
.filter(x -> x.getPosizione().equalsIgnoreCase(posizione)).toList();
|
.filter(x -> x.getPosizione().equalsIgnoreCase(posizione)).toList();
|
||||||
|
|
||||||
if(tmpList != null && tmpList.size() > 0) return tmpList.get(0);
|
if(tmpList.size() > 0) return tmpList.get(0);
|
||||||
else return null;
|
else return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,26 +1,16 @@
|
|||||||
package it.integry.integrywmsnative.core.utility;
|
package it.integry.integrywmsnative.core.utility;
|
||||||
|
|
||||||
import android.app.Dialog;
|
import androidx.fragment.app.FragmentActivity;
|
||||||
import android.content.Context;
|
|
||||||
|
|
||||||
import it.integry.integrywmsnative.view.dialogs.DialogProgress;
|
import it.integry.integrywmsnative.view.dialogs.DialogProgressView;
|
||||||
|
|
||||||
public class UtilityProgress {
|
public class UtilityProgress {
|
||||||
|
|
||||||
public static Dialog createDefaultProgressDialog(Context mContext) {
|
public static DialogProgressView createDefaultProgressDialog(FragmentActivity mContext) {
|
||||||
// final ProgressDialog progress = ProgressDialog.show(mContext, mContext.getText(R.string.waiting),
|
var progress = DialogProgressView.newInstance();
|
||||||
// mContext.getText(R.string.loading) + " ...", true);
|
progress.show(mContext.getSupportFragmentManager(), "tag");
|
||||||
//
|
return progress;
|
||||||
// return progress;
|
}
|
||||||
|
|
||||||
Dialog progress = DialogProgress.make(mContext);
|
|
||||||
progress.show();
|
|
||||||
return progress;
|
|
||||||
}
|
|
||||||
public static Dialog createDefaultProgressDialog(Context mContext,String subtitle) {
|
|
||||||
Dialog progress = DialogProgress.make(mContext,subtitle);
|
|
||||||
progress.show();
|
|
||||||
return progress;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,14 +5,16 @@ import java.net.InetSocketAddress;
|
|||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
import java.net.SocketAddress;
|
import java.net.SocketAddress;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.exception.NotValidLicenseException;
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
|
import it.integry.integrywmsnative.gest.login.exception.ServerNotReachableException;
|
||||||
import okhttp3.OkHttpClient;
|
import okhttp3.OkHttpClient;
|
||||||
import okhttp3.Request;
|
import okhttp3.Request;
|
||||||
import okhttp3.Response;
|
import okhttp3.Response;
|
||||||
|
|
||||||
public class UtilityServer {
|
public class UtilityServer {
|
||||||
|
|
||||||
public static void isHostReachable(final String serverAddress, final int serverTCPport, final RunnableArgs<Boolean> callback){
|
public static void isHostReachable(final String serverAddress, final int serverTCPport, final RunnableArgs<Boolean> callback) {
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
|
|
||||||
boolean connected = false;
|
boolean connected = false;
|
||||||
@@ -36,7 +38,7 @@ public class UtilityServer {
|
|||||||
}).start();
|
}).start();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void isEmsApiAvailable(final String serverAddress, final int serverTCPport, final RunnableArgs<Boolean> callback) {
|
public static void isEmsApiAvailable(final String serverAddress, final int serverTCPport, final Runnable onComplete, final RunnableArgs<Exception> onFailed) {
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
OkHttpClient client = new OkHttpClient();
|
OkHttpClient client = new OkHttpClient();
|
||||||
|
|
||||||
@@ -46,11 +48,16 @@ public class UtilityServer {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
Response response = client.newCall(request).execute();
|
Response response = client.newCall(request).execute();
|
||||||
boolean status = response.isSuccessful();
|
|
||||||
response.close();
|
response.close();
|
||||||
callback.run(status);
|
|
||||||
|
if (response.code() == 200) onComplete.run();
|
||||||
|
else if (response.code() == 404)
|
||||||
|
onFailed.run(new ServerNotReachableException(serverAddress, serverTCPport, null));
|
||||||
|
else if (response.code() == 550)
|
||||||
|
onFailed.run(new NotValidLicenseException());
|
||||||
|
else onFailed.run(new Exception("Errore non identificato (STATUS: " + response.code() + ")"));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
callback.run(false);
|
onFailed.run(new ServerNotReachableException(serverAddress, serverTCPport, e));
|
||||||
}
|
}
|
||||||
|
|
||||||
}).start();
|
}).start();
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import android.view.LayoutInflater;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
import androidx.appcompat.widget.AppCompatTextView;
|
import androidx.appcompat.widget.AppCompatTextView;
|
||||||
import androidx.databinding.DataBindingUtil;
|
import androidx.databinding.DataBindingUtil;
|
||||||
import androidx.databinding.ObservableArrayList;
|
import androidx.databinding.ObservableArrayList;
|
||||||
@@ -76,10 +77,23 @@ public class MainAccettazioneFragment extends BaseFragment implements ISearchabl
|
|||||||
mAppBarTitle.setText(context.getText(R.string.accettazione_title_fragment).toString());
|
mAppBarTitle.setText(context.getText(R.string.accettazione_title_fragment).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSaveInstanceState(@NonNull Bundle outState) {
|
||||||
|
onLoadingEnded();
|
||||||
|
outState.putString("mToolbar", DataCache.addItem(mToolbar));
|
||||||
|
|
||||||
|
super.onSaveInstanceState(outState);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
|
|
||||||
|
if(savedInstanceState != null && savedInstanceState.containsKey("mToolbar"))
|
||||||
|
mToolbar = DataCache.retrieveItem(savedInstanceState.getString("mToolbar"));
|
||||||
|
|
||||||
mBinding = DataBindingUtil.inflate(inflater, R.layout.fragment_main_accettazione, container, false);
|
mBinding = DataBindingUtil.inflate(inflater, R.layout.fragment_main_accettazione, container, false);
|
||||||
|
|
||||||
MainApplication.appComponent
|
MainApplication.appComponent
|
||||||
|
|||||||
@@ -41,9 +41,9 @@ import it.integry.integrywmsnative.core.expansion.RunnableArgss;
|
|||||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||||
|
import it.integry.integrywmsnative.core.model.MtbTCol;
|
||||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||||
import it.integry.integrywmsnative.core.report.ReportManager;
|
import it.integry.integrywmsnative.core.report.ReportManager;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.PrinterRESTConsumer;
|
|
||||||
import it.integry.integrywmsnative.core.rest.model.VersamentoAutomaticoULResponseDTO;
|
import it.integry.integrywmsnative.core.rest.model.VersamentoAutomaticoULResponseDTO;
|
||||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityBigDecimal;
|
import it.integry.integrywmsnative.core.utility.UtilityBigDecimal;
|
||||||
@@ -72,9 +72,9 @@ import it.integry.integrywmsnative.view.bottom_sheet__lu_content.BottomSheetFrag
|
|||||||
import it.integry.integrywmsnative.view.bottom_sheet__lu_content.BottomSheetFragmentLUContentViewModel;
|
import it.integry.integrywmsnative.view.bottom_sheet__lu_content.BottomSheetFragmentLUContentViewModel;
|
||||||
import it.integry.integrywmsnative.view.dialogs.ask_should_versamento_automatico_ul.DialogAskShouldVersamentoAutomaticoULView;
|
import it.integry.integrywmsnative.view.dialogs.ask_should_versamento_automatico_ul.DialogAskShouldVersamentoAutomaticoULView;
|
||||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.info_aggiuntive_lu.InfoAggiuntiveLUDialog;
|
||||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2DTO;
|
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2DTO;
|
||||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2View;
|
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2View;
|
||||||
import it.integry.integrywmsnative.view.dialogs.note_aggiuntive_lu.NoteAggiuntiveLUDialog;
|
|
||||||
import it.integry.integrywmsnative.view.dialogs.versamento_automatico_ul_done.DialogVersamentoAutomaticoULDoneView;
|
import it.integry.integrywmsnative.view.dialogs.versamento_automatico_ul_done.DialogVersamentoAutomaticoULDoneView;
|
||||||
|
|
||||||
public class AccettazionePickingActivity extends BaseActivity implements AccettazionePickingViewModel.Listener, BottomSheetFragmentLUContentViewModel.Listener, BottomSheetFragmentLUContentView.Listener {
|
public class AccettazionePickingActivity extends BaseActivity implements AccettazionePickingViewModel.Listener, BottomSheetFragmentLUContentViewModel.Listener, BottomSheetFragmentLUContentView.Listener {
|
||||||
@@ -84,6 +84,9 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
|
|||||||
@Inject
|
@Inject
|
||||||
AccettazionePickingViewModel mViewModel;
|
AccettazionePickingViewModel mViewModel;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
DialogInputQuantityV2View mDialogInputQuantityV2View;
|
||||||
|
|
||||||
private final AccettazionePickingFiltroOrdineViewModel mAppliedFilterViewModel = new AccettazionePickingFiltroOrdineViewModel();
|
private final AccettazionePickingFiltroOrdineViewModel mAppliedFilterViewModel = new AccettazionePickingFiltroOrdineViewModel();
|
||||||
|
|
||||||
private BottomSheetFragmentLUContentViewModel mBottomSheetFragmentLUContentViewModel;
|
private BottomSheetFragmentLUContentViewModel mBottomSheetFragmentLUContentViewModel;
|
||||||
@@ -140,9 +143,14 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
|
|||||||
this.initFilters();
|
this.initFilters();
|
||||||
|
|
||||||
String codMdep = SettingsManager.i().getUserSession().getDepo().getCodMdep();
|
String codMdep = SettingsManager.i().getUserSession().getDepo().getCodMdep();
|
||||||
|
boolean useQtaOrd = SettingsManager.iDB().isFlagAccettazioneUseQtaOrd();
|
||||||
|
|
||||||
mViewModel.setListeners(this);
|
mViewModel.setListeners(this);
|
||||||
mViewModel.init(mOrders, mSitArts, codMdep);
|
mViewModel.init(
|
||||||
|
mOrders,
|
||||||
|
mSitArts,
|
||||||
|
codMdep,
|
||||||
|
useQtaOrd);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initFilters() {
|
private void initFilters() {
|
||||||
@@ -294,7 +302,8 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
filterLayoutView.show(getSupportFragmentManager(), "TAG");
|
if (!filterLayoutView.isAdded())
|
||||||
|
filterLayoutView.show(getSupportFragmentManager(), "TAG");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -346,7 +355,7 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
|
|||||||
|
|
||||||
private void initBarcodeReader() {
|
private void initBarcodeReader() {
|
||||||
barcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
barcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
||||||
.setOnScanSuccessfull(onScanSuccessful)
|
.setOnScanSuccessful(onScanSuccessful)
|
||||||
.setOnScanFailed(ex -> UtilityExceptions.defaultException(this, ex, false)));
|
.setOnScanFailed(ex -> UtilityExceptions.defaultException(this, ex, false)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -679,13 +688,10 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
|
|||||||
}
|
}
|
||||||
|
|
||||||
private final RunnableArgs<BarcodeScanDTO> onScanSuccessful = data -> {
|
private final RunnableArgs<BarcodeScanDTO> onScanSuccessful = data -> {
|
||||||
BarcodeManager.disable();
|
this.onLoadingStarted();
|
||||||
|
|
||||||
this.openProgress();
|
|
||||||
|
|
||||||
this.mViewModel.processBarcodeDTO(data, () -> {
|
this.mViewModel.processBarcodeDTO(data, () -> {
|
||||||
BarcodeManager.enable();
|
this.onLoadingEnded();
|
||||||
this.closeProgress();
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -696,11 +702,10 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
|
|||||||
|
|
||||||
public void createNewLU() {
|
public void createNewLU() {
|
||||||
this.mBindings.accettazioneOrdineInevasoFab.close(true);
|
this.mBindings.accettazioneOrdineInevasoFab.close(true);
|
||||||
|
this.onLoadingStarted();
|
||||||
this.openProgress();
|
|
||||||
|
|
||||||
this.mViewModel.createNewLU(null, null, false, () -> {
|
this.mViewModel.createNewLU(null, null, false, () -> {
|
||||||
this.closeProgress();
|
this.onLoadingEnded();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -727,7 +732,6 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
|
|||||||
Intent myIntent = ListaBancaliActivity.createIntent(this,
|
Intent myIntent = ListaBancaliActivity.createIntent(this,
|
||||||
Stream.of(mtbColts).map(x -> (MtbColt) x).toList(),
|
Stream.of(mtbColts).map(x -> (MtbColt) x).toList(),
|
||||||
input -> ((RecoverMtbColt) input).isFlagCanBeRecovered(),
|
input -> ((RecoverMtbColt) input).isFlagCanBeRecovered(),
|
||||||
PrinterRESTConsumer.Type.SECONDARIA,
|
|
||||||
ReportManager.getReportNameLUFromGestione(GestioneEnum.ACQUISTO));
|
ReportManager.getReportNameLUFromGestione(GestioneEnum.ACQUISTO));
|
||||||
this.startActivityForResult(myIntent, PICK_UL_REQUEST);
|
this.startActivityForResult(myIntent, PICK_UL_REQUEST);
|
||||||
}
|
}
|
||||||
@@ -747,7 +751,7 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLUPrintError(Exception ex, Runnable onComplete) {
|
public void onLUPrintError(Exception ex, Runnable onComplete) {
|
||||||
this.closeProgress();
|
this.onLoadingEnded();
|
||||||
DialogSimpleMessageView.makeErrorDialog(
|
DialogSimpleMessageView.makeErrorDialog(
|
||||||
new SpannableString(ex.getMessage()),
|
new SpannableString(ex.getMessage()),
|
||||||
null,
|
null,
|
||||||
@@ -757,16 +761,6 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
|
|||||||
.show(getSupportFragmentManager(), "tag");
|
.show(getSupportFragmentManager(), "tag");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onLoadingStarted() {
|
|
||||||
this.openProgress();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onLoadingEnded() {
|
|
||||||
this.closeProgress();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMtbColrEdit(MtbColr mtbColr) {
|
public void onMtbColrEdit(MtbColr mtbColr) {
|
||||||
this.mViewModel.dispatchRowEdit(mtbColr);
|
this.mViewModel.dispatchRowEdit(mtbColr);
|
||||||
@@ -791,15 +785,15 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNoteAggiuntiveRequest(RunnableArgs<String> onComplete) {
|
public void onInfoAggiuntiveRequest(RunnableArgss<String, MtbTCol> onComplete) {
|
||||||
runOnUiThread(() -> {
|
runOnUiThread(() -> {
|
||||||
NoteAggiuntiveLUDialog.make(this, onComplete).show();
|
InfoAggiuntiveLUDialog.newInstance(onComplete).show(getSupportFragmentManager(), "InfoAggiuntiveLUDialog");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(Exception ex) {
|
public void onError(Exception ex) {
|
||||||
this.closeProgress();
|
this.onLoadingEnded();
|
||||||
|
|
||||||
if (ex instanceof InvalidPesoKGException) {
|
if (ex instanceof InvalidPesoKGException) {
|
||||||
UtilityToast.showToast(ex.getMessage());
|
UtilityToast.showToast(ex.getMessage());
|
||||||
@@ -832,19 +826,20 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
|
|||||||
.setCanLUBeClosed(true)
|
.setCanLUBeClosed(true)
|
||||||
.setCanOverflowOrderQuantity(canOverflowQuantity);
|
.setCanOverflowOrderQuantity(canOverflowQuantity);
|
||||||
|
|
||||||
DialogInputQuantityV2View
|
if (!mDialogInputQuantityV2View.isVisible())
|
||||||
.newInstance(dialogInputQuantityV2DTO, (resultDTO, shouldCloseLU) -> {
|
mDialogInputQuantityV2View
|
||||||
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO()
|
.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
|
||||||
.setNumCnf(resultDTO.getNumCnf())
|
.setOnComplete((resultDTO, shouldCloseLU) -> {
|
||||||
.setQtaCnf(resultDTO.getQtaCnf())
|
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO()
|
||||||
.setQtaTot(resultDTO.getQtaTot())
|
.setNumCnf(resultDTO.getNumCnf())
|
||||||
.setPartitaMag(resultDTO.getPartitaMag())
|
.setQtaCnf(resultDTO.getQtaCnf())
|
||||||
.setDataScad(resultDTO.getDataScad());
|
.setQtaTot(resultDTO.getQtaTot())
|
||||||
onComplete.run(pickedQuantityDTO, shouldCloseLU);
|
.setPartitaMag(resultDTO.getPartitaMag())
|
||||||
}, () -> {
|
.setDataScad(resultDTO.getDataScad());
|
||||||
this.mViewModel.resetMatchedRows();
|
onComplete.run(pickedQuantityDTO, shouldCloseLU);
|
||||||
})
|
})
|
||||||
.show(getSupportFragmentManager(), "tag");
|
.setOnAbort(() -> this.mViewModel.resetMatchedRows())
|
||||||
|
.show(getSupportFragmentManager(), "tag");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ import it.integry.integrywmsnative.core.model.CommonModelConsts;
|
|||||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||||
|
import it.integry.integrywmsnative.core.model.MtbTCol;
|
||||||
import it.integry.integrywmsnative.core.model.dto.PickDataDTO;
|
import it.integry.integrywmsnative.core.model.dto.PickDataDTO;
|
||||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||||
@@ -72,6 +73,7 @@ public class AccettazionePickingViewModel {
|
|||||||
|
|
||||||
private List<OrdineAccettazioneInevasoDTO> mOrders;
|
private List<OrdineAccettazioneInevasoDTO> mOrders;
|
||||||
private List<SitArtOrdDTO> mSitArts;
|
private List<SitArtOrdDTO> mSitArts;
|
||||||
|
private boolean mUseQtaOrd;
|
||||||
private final MutableLiveData<List<PickingObjectDTO>> mPickingList = new MutableLiveData<>();
|
private final MutableLiveData<List<PickingObjectDTO>> mPickingList = new MutableLiveData<>();
|
||||||
|
|
||||||
private MtbColt mCurrentMtbColt = null;
|
private MtbColt mCurrentMtbColt = null;
|
||||||
@@ -96,9 +98,10 @@ public class AccettazionePickingViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void init(List<OrdineAccettazioneInevasoDTO> orders, List<SitArtOrdDTO> sitArts, String codMdep) {
|
public void init(List<OrdineAccettazioneInevasoDTO> orders, List<SitArtOrdDTO> sitArts, String codMdep, boolean useQtaOrd) {
|
||||||
this.mOrders = orders;
|
this.mOrders = orders;
|
||||||
this.mDefaultCodMdep = codMdep;
|
this.mDefaultCodMdep = codMdep;
|
||||||
|
this.mUseQtaOrd = useQtaOrd;
|
||||||
|
|
||||||
this.mSitArts = Stream.of(sitArts)
|
this.mSitArts = Stream.of(sitArts)
|
||||||
.filter(x -> UtilityBigDecimal.greaterThan(x.getNumCnfDaEvadere(), BigDecimal.ZERO) && UtilityBigDecimal.greaterThan(x.getQtaDaEvadere(), BigDecimal.ZERO))
|
.filter(x -> UtilityBigDecimal.greaterThan(x.getNumCnfDaEvadere(), BigDecimal.ZERO) && UtilityBigDecimal.greaterThan(x.getQtaDaEvadere(), BigDecimal.ZERO))
|
||||||
@@ -218,10 +221,16 @@ public class AccettazionePickingViewModel {
|
|||||||
if (!UtilityBarcode.isEtichettaAnonimaOfCurrentYear(barcodeScanDTO.getStringValue())) {
|
if (!UtilityBarcode.isEtichettaAnonimaOfCurrentYear(barcodeScanDTO.getStringValue())) {
|
||||||
this.sendError(new NotCurrentYearLUException());
|
this.sendError(new NotCurrentYearLUException());
|
||||||
} else {
|
} else {
|
||||||
|
int numCollo = -1;
|
||||||
|
|
||||||
this.createNewLU(
|
try {
|
||||||
UtilityBarcode.getNumColloFromULAnonima(barcodeScanDTO.getStringValue()),
|
numCollo = UtilityBarcode.getNumColloFromULAnonima(barcodeScanDTO.getStringValue());
|
||||||
CommonConst.Config.DEFAULT_ANONYMOUS_UL_SERIE, true, onComplete);
|
this.createNewLU(
|
||||||
|
numCollo,
|
||||||
|
CommonConst.Config.DEFAULT_ANONYMOUS_UL_SERIE, true, onComplete);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
this.sendError(ex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.sendError(new AlreadyUsedAnonymousLabelException());
|
this.sendError(new AlreadyUsedAnonymousLabelException());
|
||||||
@@ -314,12 +323,13 @@ public class AccettazionePickingViewModel {
|
|||||||
barcodeProd = UtilityBarcode.convertITF14toEAN13(barcodeProd);
|
barcodeProd = UtilityBarcode.convertITF14toEAN13(barcodeProd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String finalBarcodeProd = barcodeProd;
|
||||||
this.mArticoloRESTConsumer.getByBarcodeProd(barcodeProd, mtbAartList -> {
|
this.mArticoloRESTConsumer.getByBarcodeProd(barcodeProd, mtbAartList -> {
|
||||||
|
|
||||||
if (mtbAartList != null && mtbAartList.size() > 0) {
|
if (mtbAartList != null && mtbAartList.size() > 0) {
|
||||||
this.searchArtFromAnag(mtbAartList.get(0), pickData, onComplete);
|
this.searchArtFromAnag(mtbAartList.get(0), pickData, onComplete);
|
||||||
} else {
|
} else {
|
||||||
this.sendError(new NoResultFromBarcodeException());
|
this.sendError(new NoResultFromBarcodeException(finalBarcodeProd));
|
||||||
}
|
}
|
||||||
|
|
||||||
}, this::sendError);
|
}, this::sendError);
|
||||||
@@ -359,7 +369,7 @@ public class AccettazionePickingViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void createNewLU(Integer customNumCollo, String customSerCollo, boolean disablePrint, Runnable onComplete) {
|
public void createNewLU(Integer customNumCollo, String customSerCollo, boolean disablePrint, Runnable onComplete) {
|
||||||
this.sendOnNoteAggiuntiveRequest(additionalNotes -> {
|
this.sendOnInfoAggiuntiveRequest((additionalNotes, tCol) -> {
|
||||||
|
|
||||||
this.mGestSetupRESTConsumer.getValue("PICKING", "SETUP", "DEFAULT_POSIZIONE_COLLI_ACCETTAZIONE", defaultPosAccettazioneDTO -> {
|
this.mGestSetupRESTConsumer.getValue("PICKING", "SETUP", "DEFAULT_POSIZIONE_COLLI_ACCETTAZIONE", defaultPosAccettazioneDTO -> {
|
||||||
|
|
||||||
@@ -369,12 +379,16 @@ public class AccettazionePickingViewModel {
|
|||||||
|
|
||||||
MtbColt mtbColt = new MtbColt();
|
MtbColt mtbColt = new MtbColt();
|
||||||
mtbColt
|
mtbColt
|
||||||
.initDefaultFields()
|
.initDefaultFields(defaultGestioneOfUL)
|
||||||
.setGestione(defaultGestioneOfUL)
|
|
||||||
.setAnnotazioni(additionalNotes)
|
.setAnnotazioni(additionalNotes)
|
||||||
.setPosizione(defaultPosAccettazione)
|
.setPosizione(defaultPosAccettazione)
|
||||||
.setOperation(CommonModelConsts.OPERATION.INSERT_OR_UPDATE);
|
.setOperation(CommonModelConsts.OPERATION.INSERT_OR_UPDATE);
|
||||||
|
|
||||||
|
if (tCol != null) {
|
||||||
|
mtbColt.setCodTcol(tCol.getCodTcol());
|
||||||
|
mtbColt.setMtbTCol(tCol);
|
||||||
|
}
|
||||||
|
|
||||||
if (customNumCollo != null) {
|
if (customNumCollo != null) {
|
||||||
mtbColt.setNumCollo(customNumCollo);
|
mtbColt.setNumCollo(customNumCollo);
|
||||||
}
|
}
|
||||||
@@ -530,7 +544,9 @@ public class AccettazionePickingViewModel {
|
|||||||
initialQtaTot = totalQtaOrd;
|
initialQtaTot = totalQtaOrd;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (UtilityBigDecimal.greaterThan(pickingObjectDTO.getMtbAart().getColliPedana(), BigDecimal.ZERO) && UtilityBigDecimal.greaterThan(initialNumCnf, pickingObjectDTO.getMtbAart().getColliPedana())) {
|
if (!this.mUseQtaOrd &&
|
||||||
|
UtilityBigDecimal.greaterThan(pickingObjectDTO.getMtbAart().getColliPedana(), BigDecimal.ZERO) &&
|
||||||
|
UtilityBigDecimal.greaterThan(initialNumCnf, pickingObjectDTO.getMtbAart().getColliPedana())) {
|
||||||
initialNumCnf = pickingObjectDTO.getMtbAart().getColliPedana();
|
initialNumCnf = pickingObjectDTO.getMtbAart().getColliPedana();
|
||||||
initialQtaTot = initialNumCnf.multiply(initialQtaCnf);
|
initialQtaTot = initialNumCnf.multiply(initialQtaCnf);
|
||||||
}
|
}
|
||||||
@@ -827,7 +843,6 @@ public class AccettazionePickingViewModel {
|
|||||||
cloneMtbColt.setGestione(cloneMtbColt.getGestioneEnum() == GestioneEnum.LAVORAZIONE ? GestioneEnum.PRODUZIONE : cloneMtbColt.getGestioneEnum());
|
cloneMtbColt.setGestione(cloneMtbColt.getGestioneEnum() == GestioneEnum.LAVORAZIONE ? GestioneEnum.PRODUZIONE : cloneMtbColt.getGestioneEnum());
|
||||||
|
|
||||||
this.mPrinterRESTConsumer.printCollo(
|
this.mPrinterRESTConsumer.printCollo(
|
||||||
PrinterRESTConsumer.Type.SECONDARIA,
|
|
||||||
cloneMtbColt,
|
cloneMtbColt,
|
||||||
() -> {
|
() -> {
|
||||||
this.sendLUSuccessfullyPrinted();
|
this.sendLUSuccessfullyPrinted();
|
||||||
@@ -896,8 +911,8 @@ public class AccettazionePickingViewModel {
|
|||||||
if (this.mListener != null) this.mListener.onVersamentoAutomaticoULRequest(onComplete);
|
if (this.mListener != null) this.mListener.onVersamentoAutomaticoULRequest(onComplete);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendOnNoteAggiuntiveRequest(RunnableArgs<String> onComplete) {
|
private void sendOnInfoAggiuntiveRequest(RunnableArgss<String, MtbTCol> onComplete) {
|
||||||
if (this.mListener != null) this.mListener.onNoteAggiuntiveRequest(onComplete);
|
if (this.mListener != null) this.mListener.onInfoAggiuntiveRequest(onComplete);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendError(Exception ex) {
|
private void sendError(Exception ex) {
|
||||||
@@ -990,7 +1005,7 @@ public class AccettazionePickingViewModel {
|
|||||||
|
|
||||||
void onVersamentoAutomaticoULRequest(RunnableArgs<Boolean> onComplete);
|
void onVersamentoAutomaticoULRequest(RunnableArgs<Boolean> onComplete);
|
||||||
|
|
||||||
void onNoteAggiuntiveRequest(RunnableArgs<String> onComplete);
|
void onInfoAggiuntiveRequest(RunnableArgss<String, MtbTCol> onComplete);
|
||||||
|
|
||||||
void onError(Exception ex);
|
void onError(Exception ex);
|
||||||
|
|
||||||
|
|||||||
@@ -31,8 +31,8 @@ import it.integry.integrywmsnative.core.utility.UtilityDate;
|
|||||||
import it.integry.integrywmsnative.databinding.FragmentDocInterniBinding;
|
import it.integry.integrywmsnative.databinding.FragmentDocInterniBinding;
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dialog.DialogSelectDocInfoView;
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dialog.DialogSelectDocInfoView;
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dialog.DialogSelectDocInfoViewModel;
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dialog.DialogSelectDocInfoViewModel;
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.GrigliaAcquistiDTO;
|
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.DocInterniSetupDTO;
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.DocInterniSetupDTO;
|
||||||
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.GrigliaAcquistiDTO;
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.DocInterniEditFormActivity;
|
import it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.DocInterniEditFormActivity;
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.ui.DocInterniListAdapter;
|
import it.integry.integrywmsnative.gest.contab_doc_interni.ui.DocInterniListAdapter;
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.ui.DocInterniListModel;
|
import it.integry.integrywmsnative.gest.contab_doc_interni.ui.DocInterniListModel;
|
||||||
@@ -81,8 +81,8 @@ public class DocInterniFragment extends BaseFragment implements ITitledFragment,
|
|||||||
mBinding.setLifecycleOwner(this);
|
mBinding.setLifecycleOwner(this);
|
||||||
mBinding.setView(this);
|
mBinding.setView(this);
|
||||||
mBinding.setViewModel(mViewModel);
|
mBinding.setViewModel(mViewModel);
|
||||||
mViewModel.mtbGrup.observe(getViewLifecycleOwner(),mtbGrup-> mViewModel.fetchProducts());
|
mViewModel.mtbGrup.observe(getViewLifecycleOwner(), mtbGrup -> mViewModel.fetchProducts());
|
||||||
mViewModel.dtbTipi.observe(getViewLifecycleOwner(),dtbTipi-> mViewModel.fetchDocuments());
|
mViewModel.dtbTipi.observe(getViewLifecycleOwner(), dtbTipi -> mViewModel.fetchDocuments());
|
||||||
this.initRecyclerView();
|
this.initRecyclerView();
|
||||||
|
|
||||||
return mBinding.getRoot();
|
return mBinding.getRoot();
|
||||||
@@ -91,9 +91,9 @@ public class DocInterniFragment extends BaseFragment implements ITitledFragment,
|
|||||||
@Override
|
@Override
|
||||||
public void onStart() {
|
public void onStart() {
|
||||||
super.onStart();
|
super.onStart();
|
||||||
if (!this.mViewModel.hasDocDetails()){
|
if (!this.mViewModel.hasDocDetails()) {
|
||||||
mViewModel.init();
|
mViewModel.init();
|
||||||
}else{
|
} else {
|
||||||
this.mViewModel.fetchDocuments();
|
this.mViewModel.fetchDocuments();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -115,30 +115,30 @@ public class DocInterniFragment extends BaseFragment implements ITitledFragment,
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDocDetailsChanged(DialogSelectDocInfoViewModel selection) {
|
public void onDocDetailsChanged(DialogSelectDocInfoViewModel selection) {
|
||||||
if(selection.isInputValid()){
|
if (selection.isInputValid()) {
|
||||||
mViewModel.setSelectedDocDetails(selection);
|
mViewModel.setSelectedDocDetails(selection);
|
||||||
mBinding.mainFab.setVisibility(View.VISIBLE);
|
mBinding.mainFab.setVisibility(View.VISIBLE);
|
||||||
}else{
|
} else {
|
||||||
mBinding.mainFab.setVisibility(View.GONE);
|
mBinding.mainFab.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selection.requiresFornitore()){
|
if (selection.requiresFornitore()) {
|
||||||
mBinding.codAnagContainer.setVisibility(View.VISIBLE);
|
mBinding.codAnagContainer.setVisibility(View.VISIBLE);
|
||||||
}else{
|
} else {
|
||||||
mBinding.codAnagContainer.setVisibility(View.GONE);
|
mBinding.codAnagContainer.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (selection.getSelectedGruppoArt() != null){
|
if (selection.getSelectedGruppoArt() != null) {
|
||||||
mBinding.mtbGrpContainer.setVisibility(View.VISIBLE);
|
mBinding.mtbGrpContainer.setVisibility(View.VISIBLE);
|
||||||
}else{
|
} else {
|
||||||
mBinding.mtbGrpContainer.setVisibility(View.GONE);
|
mBinding.mtbGrpContainer.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selection.requiresDocData()){
|
if (selection.requiresDocData()) {
|
||||||
mBinding.docContainer.setVisibility(View.VISIBLE);
|
mBinding.docContainer.setVisibility(View.VISIBLE);
|
||||||
mBinding.document.setText(Html.fromHtml(getString(R.string.doc_testata, String.valueOf(selection.getNumDoc()), UtilityDate.formatDate(selection.getDataDoc(), UtilityDate.COMMONS_DATE_FORMATS.DMY_HUMAN))));
|
mBinding.document.setText(Html.fromHtml(getString(R.string.doc_testata, String.valueOf(selection.getNumDoc()), UtilityDate.formatDate(selection.getDataDoc(), UtilityDate.COMMONS_DATE_FORMATS.DMY_HUMAN))));
|
||||||
}else{
|
} else {
|
||||||
mBinding.docContainer.setVisibility(View.GONE);
|
mBinding.docContainer.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -155,7 +155,7 @@ public class DocInterniFragment extends BaseFragment implements ITitledFragment,
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void selectDocInfo() {
|
public void selectDocInfo() {
|
||||||
if (this.dialogInitialized){
|
if (this.dialogInitialized) {
|
||||||
DialogSelectDocInfoView.newInstance(
|
DialogSelectDocInfoView.newInstance(
|
||||||
mDocInterniSetupDTO,
|
mDocInterniSetupDTO,
|
||||||
this.mViewModel.dtbTipi.getValue(),
|
this.mViewModel.dtbTipi.getValue(),
|
||||||
@@ -201,6 +201,6 @@ public class DocInterniFragment extends BaseFragment implements ITitledFragment,
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDocumentEditRequest(SqlMtbColt document, GrigliaAcquistiDTO arts) {
|
public void onDocumentEditRequest(SqlMtbColt document, GrigliaAcquistiDTO arts) {
|
||||||
requireActivity().startActivity(DocInterniEditFormActivity.newInstance(requireActivity(),document,arts));
|
requireActivity().startActivity(DocInterniEditFormActivity.newInstance(requireActivity(), document, arts, mViewModel.getTipoDoc()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,6 @@ package it.integry.integrywmsnative.gest.contab_doc_interni;
|
|||||||
|
|
||||||
import androidx.lifecycle.MutableLiveData;
|
import androidx.lifecycle.MutableLiveData;
|
||||||
|
|
||||||
import com.annimon.stream.Stream;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -17,10 +15,10 @@ import it.integry.integrywmsnative.core.di.BindableInteger;
|
|||||||
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
|
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
|
||||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dialog.DialogSelectDocInfoViewModel;
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dialog.DialogSelectDocInfoViewModel;
|
||||||
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.DocInterniSetupDTO;
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.FornitoreDTO;
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.FornitoreDTO;
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.GrigliaAcquistiDTO;
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.GrigliaAcquistiDTO;
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.GruppiArticoloDTO;
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.GruppiArticoloDTO;
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.DocInterniSetupDTO;
|
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.TipiDocDTO;
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.TipiDocDTO;
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.rest.DocInterniRESTConsumer;
|
import it.integry.integrywmsnative.gest.contab_doc_interni.rest.DocInterniRESTConsumer;
|
||||||
|
|
||||||
@@ -91,7 +89,7 @@ public class DocInterniViewModel {
|
|||||||
this.numDoc.postValue(selection.getNumDoc());
|
this.numDoc.postValue(selection.getNumDoc());
|
||||||
this.note.postValue(selection.getNote());
|
this.note.postValue(selection.getNote());
|
||||||
|
|
||||||
if (selection.getSelectedTipoDoc() != null ) {
|
if (selection.getSelectedTipoDoc() != null) {
|
||||||
this.dtbTipi.postValue(selection.getSelectedTipoDoc());
|
this.dtbTipi.postValue(selection.getSelectedTipoDoc());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -114,11 +112,11 @@ public class DocInterniViewModel {
|
|||||||
this.sendOnLoadingStarted();
|
this.sendOnLoadingStarted();
|
||||||
String codAnag = null, codVdes = null;
|
String codAnag = null, codVdes = null;
|
||||||
FornitoreDTO fornitore = this.fornitore.getValue();
|
FornitoreDTO fornitore = this.fornitore.getValue();
|
||||||
if (fornitore != null){
|
if (fornitore != null) {
|
||||||
codAnag = fornitore.getCodAnag();
|
codAnag = fornitore.getCodAnag();
|
||||||
codVdes = fornitore.getCodVdes();
|
codVdes = fornitore.getCodVdes();
|
||||||
}
|
}
|
||||||
documentRepository.getLocalDocumentsByCodDtip(this.getCodDtip(), codAnag, codVdes, dataDoc.getValue(),numDoc.getValue(), list -> {
|
documentRepository.getLocalDocumentsByCodDtip(this.getCodDtip(), codAnag, codVdes, dataDoc.getValue(), numDoc.getValue(), list -> {
|
||||||
documentRepository.getNextNumCollo(nextNumCollo -> {
|
documentRepository.getNextNumCollo(nextNumCollo -> {
|
||||||
this.mDocsList.postValue(list);
|
this.mDocsList.postValue(list);
|
||||||
this.setNextNumCollo(nextNumCollo);
|
this.setNextNumCollo(nextNumCollo);
|
||||||
@@ -141,6 +139,13 @@ public class DocInterniViewModel {
|
|||||||
return this.dtbTipi.getValue().getCodDtip();
|
return this.dtbTipi.getValue().getCodDtip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TipiDocDTO getTipoDoc() {
|
||||||
|
if (this.dtbTipi.getValue() == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return this.dtbTipi.getValue();
|
||||||
|
}
|
||||||
|
|
||||||
private String getCodMgrp() {
|
private String getCodMgrp() {
|
||||||
if (this.mtbGrup.getValue() == null) {
|
if (this.mtbGrup.getValue() == null) {
|
||||||
return null;
|
return null;
|
||||||
@@ -168,10 +173,10 @@ public class DocInterniViewModel {
|
|||||||
document.setNumCollo(this.nextNumCollo);
|
document.setNumCollo(this.nextNumCollo);
|
||||||
document.setGestione("L");
|
document.setGestione("L");
|
||||||
document.setDataDoc(this.dataDoc.getValue());
|
document.setDataDoc(this.dataDoc.getValue());
|
||||||
if (this.numDoc.getValue() != null){
|
if (this.numDoc.getValue() != null) {
|
||||||
document.setNumDoc(Integer.parseInt(this.numDoc.getValue()));
|
document.setNumDoc(Integer.parseInt(this.numDoc.getValue()));
|
||||||
}
|
}
|
||||||
if (this.fornitore.getValue() != null){
|
if (this.fornitore.getValue() != null) {
|
||||||
document.setCodAnag(this.fornitore.getValue().getCodAnag());
|
document.setCodAnag(this.fornitore.getValue().getCodAnag());
|
||||||
document.setCodVdes(this.fornitore.getValue().getCodVdes());
|
document.setCodVdes(this.fornitore.getValue().getCodVdes());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ public class DialogSelectDocInfoViewModel {
|
|||||||
selectedDocType.getGestione().equalsIgnoreCase("V") ? "V" : "A"
|
selectedDocType.getGestione().equalsIgnoreCase("V") ? "V" : "A"
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return forn.getTipoAnag().equalsIgnoreCase("F") ;
|
return forn.getTipoAnag().equalsIgnoreCase("F");
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.map(FornitoreDTO::getLabel).toList();
|
.map(FornitoreDTO::getLabel).toList();
|
||||||
@@ -148,8 +148,7 @@ public class DialogSelectDocInfoViewModel {
|
|||||||
public boolean requiresNote() {
|
public boolean requiresNote() {
|
||||||
return this.getSelectedTipoDoc() != null &&
|
return this.getSelectedTipoDoc() != null &&
|
||||||
this.getSelectedTipoDoc().getGestioneDoc().equals("P") &&
|
this.getSelectedTipoDoc().getGestioneDoc().equals("P") &&
|
||||||
this.getSelectedTipoDoc().getGestione().equals("L")
|
this.getSelectedTipoDoc().getGestione().equals("L");
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isInputValid() {
|
public boolean isInputValid() {
|
||||||
@@ -161,12 +160,12 @@ public class DialogSelectDocInfoViewModel {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.requiresDocData() && (this.getDataDoc() == null || this.getNumDoc() == null)){
|
if (this.requiresDocData() && (this.getDataDoc() == null || this.getNumDoc() == null)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (this.requiresNote() && (this.getNote() == null || this.getNote().length() <= 0) ){
|
if (this.requiresNote() && (this.getNote() == null || this.getNote().length() <= 0)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -174,7 +173,7 @@ public class DialogSelectDocInfoViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean requiresDocData() {
|
public boolean requiresDocData() {
|
||||||
TipiDocDTO doc = this.getSelectedTipoDoc();
|
TipiDocDTO doc = this.getSelectedTipoDoc();
|
||||||
return doc != null && doc.getGestioneDoc().equalsIgnoreCase("P") && !doc.getGestione().equalsIgnoreCase("L");
|
return doc != null && doc.getGestioneDoc().equalsIgnoreCase("P") && !doc.getGestione().equalsIgnoreCase("L");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,85 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.contab_doc_interni.dto;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColr;
|
||||||
|
import it.integry.integrywmsnative.core.di.BindableBoolean;
|
||||||
|
|
||||||
|
public class DialogChooseRowFromListaDocRowsListModel {
|
||||||
|
|
||||||
|
private String codMart;
|
||||||
|
private String descrizione;
|
||||||
|
private String qtaOrdReadable;
|
||||||
|
private String barcode;
|
||||||
|
private boolean isNew;
|
||||||
|
private SqlMtbColr originalModel;
|
||||||
|
private BindableBoolean checked = new BindableBoolean(false);
|
||||||
|
|
||||||
|
public DialogChooseRowFromListaDocRowsListModel() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public BindableBoolean getChecked() {
|
||||||
|
return checked;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DialogChooseRowFromListaDocRowsListModel setChecked(BindableBoolean checked) {
|
||||||
|
this.checked = checked;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void toggleCheck() {
|
||||||
|
this.checked.set(!this.checked.get());
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCodMart() {
|
||||||
|
return codMart;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DialogChooseRowFromListaDocRowsListModel setCodMart(String codMart) {
|
||||||
|
this.codMart = codMart;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescrizione() {
|
||||||
|
return descrizione;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DialogChooseRowFromListaDocRowsListModel setDescrizione(String descrizione) {
|
||||||
|
this.descrizione = descrizione;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getQtaOrdReadable() {
|
||||||
|
return qtaOrdReadable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DialogChooseRowFromListaDocRowsListModel setQtaOrdReadable(String qtaOrdReadable) {
|
||||||
|
this.qtaOrdReadable = qtaOrdReadable;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBarcode() {
|
||||||
|
return barcode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DialogChooseRowFromListaDocRowsListModel setBarcode(String barcode) {
|
||||||
|
this.barcode = barcode;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isNew() {
|
||||||
|
return isNew;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DialogChooseRowFromListaDocRowsListModel setNew(boolean aNew) {
|
||||||
|
isNew = aNew;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SqlMtbColr getOriginalModel() {
|
||||||
|
return originalModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DialogChooseRowFromListaDocRowsListModel setOriginalModel(SqlMtbColr originalModel) {
|
||||||
|
this.originalModel = originalModel;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -14,6 +14,7 @@ public class GrigliaAcquistiChildDTO {
|
|||||||
public String flagQtaMultipla;
|
public String flagQtaMultipla;
|
||||||
public String flagTracciabilita;
|
public String flagTracciabilita;
|
||||||
public BigDecimal qtaMinOrdinabile;
|
public BigDecimal qtaMinOrdinabile;
|
||||||
|
public boolean newNoPromo;
|
||||||
private int ggScadenza;
|
private int ggScadenza;
|
||||||
private float giacenza;
|
private float giacenza;
|
||||||
private float qtaPrevistaVendita;
|
private float qtaPrevistaVendita;
|
||||||
@@ -144,4 +145,13 @@ public class GrigliaAcquistiChildDTO {
|
|||||||
this.qtaProposta = qtaProposta;
|
this.qtaProposta = qtaProposta;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isNewNoPromo() {
|
||||||
|
return newNoPromo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GrigliaAcquistiChildDTO setNewNoPromo(boolean newNoPromo) {
|
||||||
|
this.newNoPromo = newNoPromo;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ public class TipiDocDTO {
|
|||||||
private String descrizione;
|
private String descrizione;
|
||||||
private String gestione;
|
private String gestione;
|
||||||
private String gestioneDoc;
|
private String gestioneDoc;
|
||||||
|
private boolean requireNote = false;
|
||||||
|
|
||||||
public String getCodDtip() {
|
public String getCodDtip() {
|
||||||
return codDtip;
|
return codDtip;
|
||||||
@@ -38,7 +39,17 @@ public class TipiDocDTO {
|
|||||||
public void setGestioneDoc(String gestioneDoc) {
|
public void setGestioneDoc(String gestioneDoc) {
|
||||||
this.gestioneDoc = gestioneDoc;
|
this.gestioneDoc = gestioneDoc;
|
||||||
}
|
}
|
||||||
public String getLabel(){
|
|
||||||
return this.codDtip +" - "+this.descrizione;
|
public String getLabel() {
|
||||||
|
return this.codDtip + " - " + this.descrizione;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isRequireNote() {
|
||||||
|
return requireNote;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TipiDocDTO setRequireNote(boolean requireNote) {
|
||||||
|
this.requireNote = requireNote;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,6 +39,8 @@ import it.integry.integrywmsnative.core.utility.UtilityDate;
|
|||||||
import it.integry.integrywmsnative.databinding.ActivityContabDocInterniEditBinding;
|
import it.integry.integrywmsnative.databinding.ActivityContabDocInterniEditBinding;
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.GrigliaAcquistiChildDTO;
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.GrigliaAcquistiChildDTO;
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.GrigliaAcquistiDTO;
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.GrigliaAcquistiDTO;
|
||||||
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.TipiDocDTO;
|
||||||
|
import it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.dialog.selectDocRows.DialogSelectDocRowsView;
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.ui.DocumentRowsListAdapter;
|
import it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.ui.DocumentRowsListAdapter;
|
||||||
import it.integry.integrywmsnative.ui.FabMenuCustomAnimations;
|
import it.integry.integrywmsnative.ui.FabMenuCustomAnimations;
|
||||||
import it.integry.integrywmsnative.view.bottom_sheet__mtb_colr_edit.BottomSheetMtbColrEditView;
|
import it.integry.integrywmsnative.view.bottom_sheet__mtb_colr_edit.BottomSheetMtbColrEditView;
|
||||||
@@ -51,12 +53,17 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
|||||||
|
|
||||||
private static final String DATA_KEY_DOCUMENT = "document";
|
private static final String DATA_KEY_DOCUMENT = "document";
|
||||||
private static final String DATA_KEY_PRODUCTS_LIST = "productsList";
|
private static final String DATA_KEY_PRODUCTS_LIST = "productsList";
|
||||||
|
private static final String DATA_KEY_TIPO_DOC = "docType";
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
MtbColrRepository documentRowsRepository;
|
MtbColrRepository documentRowsRepository;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
DocInterniEditFormViewModel viewModel;
|
DocInterniEditFormViewModel viewModel;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
DialogInputQuantityV2View dialogInputQuantityV2View;
|
||||||
|
|
||||||
|
|
||||||
private int mBarcodeScannerIstanceID;
|
private int mBarcodeScannerIstanceID;
|
||||||
private ActivityContabDocInterniEditBinding binding;
|
private ActivityContabDocInterniEditBinding binding;
|
||||||
@@ -70,13 +77,15 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
|||||||
public BindableBoolean isDocumentExportable = new BindableBoolean(false);
|
public BindableBoolean isDocumentExportable = new BindableBoolean(false);
|
||||||
private final ObservableArrayList<SqlMtbColr> documentRowsObservableList = new ObservableArrayList<>();
|
private final ObservableArrayList<SqlMtbColr> documentRowsObservableList = new ObservableArrayList<>();
|
||||||
|
|
||||||
public static Intent newInstance(Context context, SqlMtbColt document, GrigliaAcquistiDTO productList) {
|
public static Intent newInstance(Context context, SqlMtbColt document, GrigliaAcquistiDTO productList, TipiDocDTO tipoDoc) {
|
||||||
Intent myIntent = new Intent(context, DocInterniEditFormActivity.class);
|
Intent myIntent = new Intent(context, DocInterniEditFormActivity.class);
|
||||||
|
|
||||||
String doc = DataCache.addItem(document);
|
String doc = DataCache.addItem(document);
|
||||||
String productsKey = DataCache.addItem(productList);
|
String productsKey = DataCache.addItem(productList);
|
||||||
|
String docType = DataCache.addItem(tipoDoc);
|
||||||
myIntent.putExtra(DATA_KEY_DOCUMENT, doc);
|
myIntent.putExtra(DATA_KEY_DOCUMENT, doc);
|
||||||
myIntent.putExtra(DATA_KEY_PRODUCTS_LIST, productsKey);
|
myIntent.putExtra(DATA_KEY_PRODUCTS_LIST, productsKey);
|
||||||
|
myIntent.putExtra(DATA_KEY_TIPO_DOC, docType);
|
||||||
return myIntent;
|
return myIntent;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,7 +100,14 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
|||||||
SqlMtbColt document = DataCache.retrieveItem(getIntent().getStringExtra(DATA_KEY_DOCUMENT));
|
SqlMtbColt document = DataCache.retrieveItem(getIntent().getStringExtra(DATA_KEY_DOCUMENT));
|
||||||
GrigliaAcquistiDTO griglia = DataCache.retrieveItem(getIntent().getStringExtra(DATA_KEY_PRODUCTS_LIST));
|
GrigliaAcquistiDTO griglia = DataCache.retrieveItem(getIntent().getStringExtra(DATA_KEY_PRODUCTS_LIST));
|
||||||
List<GrigliaAcquistiChildDTO> productList = griglia.getGrigliaAcquistiChild();
|
List<GrigliaAcquistiChildDTO> productList = griglia.getGrigliaAcquistiChild();
|
||||||
this.initViewModel(document, productList);
|
TipiDocDTO docType = DataCache.retrieveItem(getIntent().getStringExtra(DATA_KEY_TIPO_DOC));
|
||||||
|
|
||||||
|
this.initViewModel();
|
||||||
|
this.viewModel.setDocument(document);
|
||||||
|
this.viewModel.setProductsList(productList);
|
||||||
|
this.viewModel.setTipoDoc(docType);
|
||||||
|
|
||||||
|
|
||||||
this.initView();
|
this.initView();
|
||||||
this.initBindables();
|
this.initBindables();
|
||||||
this.initRecyclerView();
|
this.initRecyclerView();
|
||||||
@@ -132,11 +148,9 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
|||||||
binding.bottomSheetMtbColrEdit.init(binding.bottomSheetMtbColrEdit, binding.bottomSheetMtbColrEditBackground);
|
binding.bottomSheetMtbColrEdit.init(binding.bottomSheetMtbColrEdit, binding.bottomSheetMtbColrEditBackground);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initViewModel(SqlMtbColt document, List<GrigliaAcquistiChildDTO> productList) {
|
private void initViewModel() {
|
||||||
|
this.viewModel.init();
|
||||||
this.viewModel.setListeners(this);
|
this.viewModel.setListeners(this);
|
||||||
this.viewModel.setDocument(document);
|
|
||||||
this.viewModel.setProductsList(productList);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initRecyclerView() {
|
private void initRecyclerView() {
|
||||||
@@ -184,7 +198,7 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
|||||||
}
|
}
|
||||||
|
|
||||||
mBarcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
mBarcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
||||||
.setOnScanSuccessfull(this.viewModel::processBarcode)
|
.setOnScanSuccessful(this.viewModel::processBarcode)
|
||||||
.setOnScanFailed(this::onError));
|
.setOnScanFailed(this::onError));
|
||||||
this.viewModel.fetchDocumentRows();
|
this.viewModel.fetchDocumentRows();
|
||||||
}
|
}
|
||||||
@@ -209,6 +223,7 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEditRowRequest(SqlMtbColr row, boolean flagTracciabilita) {
|
public void onEditRowRequest(SqlMtbColr row, boolean flagTracciabilita) {
|
||||||
|
this.onLoadingStarted();
|
||||||
MtbAart mtbAart = new MtbAart();
|
MtbAart mtbAart = new MtbAart();
|
||||||
mtbAart.setBarCode(row.getCodBarre());
|
mtbAart.setBarCode(row.getCodBarre());
|
||||||
mtbAart.setDiacod(row.getCodBarre());
|
mtbAart.setDiacod(row.getCodBarre());
|
||||||
@@ -232,6 +247,7 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
|||||||
.setCanOverflowOrderQuantity(false)
|
.setCanOverflowOrderQuantity(false)
|
||||||
.setCanLUBeClosed(false)
|
.setCanLUBeClosed(false)
|
||||||
.setNotesAllowed(true)
|
.setNotesAllowed(true)
|
||||||
|
.setNotesMandatory(this.viewModel.isNotesMandatory())
|
||||||
.setDataScadMandatory(flagTracciabilita)
|
.setDataScadMandatory(flagTracciabilita)
|
||||||
.setCanPartitaMagBeChanged(flagTracciabilita)
|
.setCanPartitaMagBeChanged(flagTracciabilita)
|
||||||
.setSuggestPartitaMag(data -> {
|
.setSuggestPartitaMag(data -> {
|
||||||
@@ -243,12 +259,14 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
|||||||
return partitaMag;
|
return partitaMag;
|
||||||
});
|
});
|
||||||
|
|
||||||
DialogInputQuantityV2View
|
if (!dialogInputQuantityV2View.isAdded())
|
||||||
.newInstance(dialogInputQuantityV2DTO, (resultDTO, shouldCloseLU) -> {
|
dialogInputQuantityV2View.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
|
||||||
this.onLoadingStarted();
|
.setOnComplete((resultDTO, shouldCloseLU) -> {
|
||||||
this.viewModel.saveRow(row, resultDTO);
|
this.onLoadingStarted();
|
||||||
}, this::onLoadingEnded)
|
this.viewModel.saveRow(row, resultDTO);
|
||||||
.show(getSupportFragmentManager(), "tag");
|
})
|
||||||
|
.setOnAbort(this::onLoadingEnded)
|
||||||
|
.show(getSupportFragmentManager(), "tag");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -280,6 +298,16 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
|||||||
this.viewModel.deleteRow(entityToSql(mtbColr));
|
this.viewModel.deleteRow(entityToSql(mtbColr));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onMultipleRowsFound(List<SqlMtbColr> rows, GrigliaAcquistiChildDTO articolo) {
|
||||||
|
DialogSelectDocRowsView.newInstance(rows, (row) -> {
|
||||||
|
this.onLoadingEnded();
|
||||||
|
if (row != null) {
|
||||||
|
this.viewModel.editRow(row, (articolo.getFlagTracciabilita().equalsIgnoreCase("S")));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
).show(this.getSupportFragmentManager(), "dialogSelectDocRows");
|
||||||
|
}
|
||||||
|
|
||||||
private MtbColr sqlToEntity(SqlMtbColr sqlMtbColr) {
|
private MtbColr sqlToEntity(SqlMtbColr sqlMtbColr) {
|
||||||
MtbColr entity = new MtbColr();
|
MtbColr entity = new MtbColr();
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user