Compare commits
191 Commits
v1.21.1(25
...
v1.27.0(28
| Author | SHA1 | Date | |
|---|---|---|---|
| c264cd38e3 | |||
| aabc4310fd | |||
| 9dc3996aef | |||
| e0e9e657c9 | |||
| 84cbab334f | |||
| f9751e770a | |||
| 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 | |||
| 983b70821a | |||
| 8e60aa0249 | |||
| 69962781aa | |||
| a921b83c1f | |||
| ea8be0559a | |||
| 66f117186c | |||
| 4ff39009d2 | |||
| 981a42cd7e | |||
| 062938d0e4 | |||
| cc7044c7de | |||
| 7d771bf39b | |||
| 3261aa7c41 | |||
| d79c13b370 | |||
| 55c1cb40a2 | |||
| e3ebfcb27d |
1
.idea/.gitignore
generated
vendored
Normal file
1
.idea/.gitignore
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/saveactions_settings.xml
|
||||
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="SKIP_NOOP_APK_INSTALLATIONS" 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="SELECTED_CLOUD_MATRIX_CONFIGURATION_ID" value="-1" />
|
||||
<option name="SELECTED_CLOUD_MATRIX_PROJECT_ID" value="" />
|
||||
@@ -45,7 +46,7 @@
|
||||
<option name="ADVANCED_PROFILING_ENABLED" value="false" />
|
||||
<option name="STARTUP_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="NATIVE_MEMORY_SAMPLE_RATE_BYTES" value="2048" />
|
||||
</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="SKIP_NOOP_APK_INSTALLATIONS" 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="SELECTED_CLOUD_MATRIX_CONFIGURATION_ID" value="-1" />
|
||||
<option name="SELECTED_CLOUD_MATRIX_PROJECT_ID" value="" />
|
||||
@@ -45,7 +46,7 @@
|
||||
<option name="ADVANCED_PROFILING_ENABLED" value="false" />
|
||||
<option name="STARTUP_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="NATIVE_MEMORY_SAMPLE_RATE_BYTES" value="2048" />
|
||||
</Profilers>
|
||||
|
||||
@@ -1,13 +1,17 @@
|
||||
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: 'kotlin-android'
|
||||
apply plugin: 'com.google.gms.google-services'
|
||||
|
||||
android {
|
||||
|
||||
def appVersionCode = 253
|
||||
def appVersionName = '1.21.1'
|
||||
def appVersionCode = 287
|
||||
def appVersionName = '1.27.0'
|
||||
|
||||
signingConfigs {
|
||||
release {
|
||||
@@ -27,12 +31,12 @@ android {
|
||||
}
|
||||
}
|
||||
|
||||
compileSdkVersion 30
|
||||
compileSdkVersion 31
|
||||
|
||||
defaultConfig {
|
||||
applicationId "it.integry.integrywmsnative"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 30
|
||||
targetSdkVersion 31
|
||||
versionCode appVersionCode
|
||||
versionName appVersionName
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
@@ -74,11 +78,11 @@ android {
|
||||
}
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
abortOnError false
|
||||
}
|
||||
|
||||
dynamicFeatures = [":dynamic__base", ":dynamic_vgalimenti"]
|
||||
lint {
|
||||
abortOnError false
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -94,37 +98,38 @@ dependencies {
|
||||
//Firebase
|
||||
|
||||
// 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-core'
|
||||
implementation 'com.google.firebase:firebase-crash'
|
||||
implementation 'com.google.firebase:firebase-crashlytics'
|
||||
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 'com.google.android.material:material:1.4.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
|
||||
implementation 'com.google.android.material:material:1.5.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
|
||||
implementation 'androidx.cardview:cardview:1.0.0'
|
||||
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.retrofit2:retrofit:2.9.0'
|
||||
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
|
||||
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-common-java8:2.3.1'
|
||||
implementation 'androidx.lifecycle:lifecycle-common-java8:2.4.1'
|
||||
implementation 'org.apache.commons:commons-text:1.9'
|
||||
|
||||
//MVVM
|
||||
def dagger2_version = '2.35.1'
|
||||
def dagger2_version = '2.40'
|
||||
api "com.google.dagger:dagger:$dagger2_version"
|
||||
annotationProcessor "com.google.dagger:dagger-compiler:$dagger2_version"
|
||||
api "com.google.dagger:dagger-android:$dagger2_version"
|
||||
api "com.google.dagger:dagger-android-support:$dagger2_version" // if you use the support libraries
|
||||
api "com.google.dagger:dagger-android-support:$dagger2_version"
|
||||
// if you use the support libraries
|
||||
annotationProcessor "com.google.dagger:dagger-android-processor:$dagger2_version"
|
||||
|
||||
//FAB
|
||||
@@ -134,13 +139,11 @@ dependencies {
|
||||
implementation 'com.github.cachapa:ExpandableLayout:2.9.2'
|
||||
implementation 'com.github.frankiesardo:linearlistview:1.0.1@aar'
|
||||
implementation 'com.github.fede87:StatusBarAlert:1.0.1'
|
||||
implementation 'com.github.akshay2211:Stash:master'
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
implementation 'com.github.zhukic:sectioned-recyclerview:1.2.3'
|
||||
implementation 'com.github.pedromassango:doubleClick:3.0'
|
||||
|
||||
//SQLite ROOM
|
||||
def room_version = "2.3.0"
|
||||
def room_version = "2.4.1"
|
||||
|
||||
implementation "androidx.room:room-runtime:$room_version"
|
||||
annotationProcessor "androidx.room:room-compiler:$room_version"
|
||||
@@ -154,12 +157,22 @@ dependencies {
|
||||
implementation project(':barcode_base_android_library')
|
||||
implementation project(':honeywellscannerlibrary')
|
||||
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 '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 {
|
||||
|
||||
@@ -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.REQUEST_INSTALL_PACKAGES" />
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
|
||||
|
||||
<application
|
||||
android:name=".MainApplication"
|
||||
@@ -19,7 +20,8 @@
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme"
|
||||
android:usesCleartextTraffic="true"
|
||||
android:fullBackupContent="@xml/backup_descriptor">
|
||||
android:fullBackupContent="@xml/backup_descriptor"
|
||||
android:requestLegacyExternalStorage="true">
|
||||
<activity
|
||||
android:name=".gest.spedizione.SpedizioneActivity"
|
||||
android:screenOrientation="portrait"
|
||||
@@ -40,7 +42,8 @@
|
||||
<activity
|
||||
android:name=".gest.main.MainActivity"
|
||||
android:theme="@style/Light"
|
||||
android:windowSoftInputMode="adjustNothing">
|
||||
android:windowSoftInputMode="adjustNothing"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.CLIENTBARCODEACTIVITY" />
|
||||
|
||||
@@ -73,7 +76,8 @@
|
||||
<activity
|
||||
android:name=".SplashActivity"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/SplashTheme">
|
||||
android:theme="@style/SplashTheme"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
|
||||
@@ -5,6 +5,12 @@ import javax.inject.Singleton;
|
||||
import dagger.Component;
|
||||
import it.integry.integrywmsnative.core.context.AppContext;
|
||||
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.MainAccettazioneModule;
|
||||
import it.integry.integrywmsnative.gest.accettazione_picking.AccettazionePickingComponent;
|
||||
@@ -15,10 +21,14 @@ 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.edit_form.DocInterniEditFormComponent;
|
||||
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.ContenutoBancaleModule;
|
||||
import it.integry.integrywmsnative.gest.lista_bancali.ListaBancaliComponent;
|
||||
import it.integry.integrywmsnative.gest.lista_bancali.ListaBancaliModule;
|
||||
import it.integry.integrywmsnative.gest.login.LoginComponent;
|
||||
import it.integry.integrywmsnative.gest.login.LoginModule;
|
||||
import it.integry.integrywmsnative.gest.main.MainActivityComponent;
|
||||
import it.integry.integrywmsnative.gest.main.MainActivityModule;
|
||||
import it.integry.integrywmsnative.gest.main.MainFragmentComponent;
|
||||
@@ -35,6 +45,8 @@ import it.integry.integrywmsnative.gest.prod_fabbisogno_linee_prod.ProdFabbisogn
|
||||
import it.integry.integrywmsnative.gest.prod_fabbisogno_linee_prod.ProdFabbisognoLineeProdModule;
|
||||
import it.integry.integrywmsnative.gest.prod_fabbisogno_linee_prod.dialog_ask_mag_prossimita.DialogAskMagazzinoProssimitaComponent;
|
||||
import it.integry.integrywmsnative.gest.prod_fabbisogno_linee_prod.dialog_ask_mag_prossimita.DialogAskMagazzinoProssimitaModule;
|
||||
import it.integry.integrywmsnative.gest.prod_linee_produzione.ProdLineeProduzioneComponent;
|
||||
import it.integry.integrywmsnative.gest.prod_linee_produzione.ProdLineeProduzioneModule;
|
||||
import it.integry.integrywmsnative.gest.prod_recupero_materiale.ProdRecuperoMaterialeComponent;
|
||||
import it.integry.integrywmsnative.gest.prod_recupero_materiale.ProdRecuperoMaterialeModule;
|
||||
import it.integry.integrywmsnative.gest.prod_rientro_merce.ProdRientroMerceComponent;
|
||||
@@ -43,12 +55,16 @@ import it.integry.integrywmsnative.gest.prod_versamento_materiale.ProdVersamento
|
||||
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.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.PVOrdiniAcquistoGrigliaModule;
|
||||
import it.integry.integrywmsnative.gest.rettifica_giacenze.RettificaGiacenzeComponent;
|
||||
import it.integry.integrywmsnative.gest.rettifica_giacenze.RettificaGiacenzeModule;
|
||||
import it.integry.integrywmsnative.gest.spedizione.SpedizioneComponent;
|
||||
import it.integry.integrywmsnative.gest.spedizione.SpedizioneModule;
|
||||
import it.integry.integrywmsnative.gest.spedizione.dialogs.print_sscc_list.DialogPrintOrderSSCCListComponent;
|
||||
import it.integry.integrywmsnative.gest.spedizione.dialogs.print_sscc_list.DialogPrintOrderSSCCListModule;
|
||||
import it.integry.integrywmsnative.gest.spedizione.dialogs.row_info.prod_fabbisogno_linee_prod.DialogRowInfoProdFabbisognoLineeProdComponent;
|
||||
import it.integry.integrywmsnative.gest.spedizione.dialogs.row_info.prod_fabbisogno_linee_prod.DialogRowInfoProdFabbisognoLineeProdModule;
|
||||
import it.integry.integrywmsnative.gest.ultime_consegne_cliente.UltimeConsegneClienteComponent;
|
||||
@@ -57,10 +73,13 @@ import it.integry.integrywmsnative.gest.ultimi_arrivi_fornitore.UltimiArriviForn
|
||||
import it.integry.integrywmsnative.gest.ultimi_arrivi_fornitore.UltimiArriviFornitoreModule;
|
||||
import it.integry.integrywmsnative.gest.versamento_merce.VersamentoMerceComponent;
|
||||
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.DialogChooseArtsFromListaArtsModule;
|
||||
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.info_aggiuntive_lu.InfoAggiuntiveLUDialogComponent;
|
||||
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_quantity_v2.DialogInputQuantityV2Component;
|
||||
@@ -76,6 +95,10 @@ import it.integry.integrywmsnative.view.dialogs.scan_or_create_lu.DialogScanOrCr
|
||||
RoomModule.class,
|
||||
SplashActivityModule.class,
|
||||
MainApplicationModule.class,
|
||||
BaseActivityModule.class,
|
||||
BaseFragmentModule.class,
|
||||
BaseDialogFragmentModule.class,
|
||||
LoginModule.class,
|
||||
MainActivityModule.class,
|
||||
MainFragmentModule.class,
|
||||
MainAccettazioneModule.class,
|
||||
@@ -106,46 +129,105 @@ import it.integry.integrywmsnative.view.dialogs.scan_or_create_lu.DialogScanOrCr
|
||||
DialogChooseArtsFromListaArtsModule.class,
|
||||
DocInterniModule.class,
|
||||
DialogSelectDocInfoModule.class,
|
||||
DocInterniEditFormModule.class
|
||||
DocInterniEditFormModule.class,
|
||||
DialogSelectDocRowsModule.class,
|
||||
DialogAskClienteModule.class,
|
||||
DialogEditArticoloModule.class,
|
||||
DialogPrintOrderSSCCListModule.class,
|
||||
ProdLineeProduzioneModule.class
|
||||
})
|
||||
public interface MainApplicationComponent {
|
||||
|
||||
BaseActivityComponent.Factory baseActivityComponent();
|
||||
|
||||
BaseFragmentComponent.Factory baseFragmentComponent();
|
||||
|
||||
BaseDialogFragmentComponent.Factory baseDialogFragmentComponent();
|
||||
|
||||
SplashActivityComponent.Factory splashActivityComponent();
|
||||
|
||||
LoginComponent.Factory loginActivityComponent();
|
||||
|
||||
MainActivityComponent.Factory mainActivityComponent();
|
||||
|
||||
MainFragmentComponent.Factory mainFragmentComponent();
|
||||
|
||||
MainAccettazioneComponent.Factory mainAccettazioneComponent();
|
||||
|
||||
ListaBancaliComponent.Factory listaBancaliComponent();
|
||||
|
||||
ContenutoBancaleComponent.Factory contenutoBancaleComponent();
|
||||
|
||||
PVOrdiniAcquistoGrigliaComponent.Factory pvOrdineAcquistoGrigliaComponent();
|
||||
|
||||
PVOrdineAcquistoEditComponent.Factory pvOrdineAcquistoEditComponent();
|
||||
|
||||
PickingLiberoComponent.Factory pickingLiberoComponent();
|
||||
|
||||
RettificaGiacenzeComponent.Factory rettificaGiacenzeComponent();
|
||||
|
||||
SpedizioneComponent.Factory spedizioneComponent();
|
||||
|
||||
AccettazionePickingComponent.Factory accettazionePickingComponent();
|
||||
|
||||
UltimeConsegneClienteComponent.Factory ultimeConsegneClienteComponent();
|
||||
|
||||
UltimiArriviFornitoreComponent.Factory ultimiArriviFornitoreComponent();
|
||||
|
||||
PickingResiComponent.Factory pickingResiComponent();
|
||||
|
||||
OrdiniUscitaElencoComponent.Factory prodOrdineLavorazioneElencoComponent();
|
||||
|
||||
DialogAskClienteComponent.Factory dialogAskClienteComponent();
|
||||
|
||||
DialogInputQuantityV2Component.Factory dialogInputQuantityV2Component();
|
||||
|
||||
DialogInputLUProdComponent.Factory dialogInputLUProdComponent();
|
||||
|
||||
DialogScanArtComponent.Factory dialogScanArtComponent();
|
||||
|
||||
DialogScanOrCreateLUComponent.Factory dialogScanOrCreateLUComponent();
|
||||
|
||||
ProdFabbisognoLineeProdComponent.Factory prodFabbisognoLineeProdComponent();
|
||||
|
||||
VersamentoMerceComponent.Factory versamentoMerceComponent();
|
||||
|
||||
DialogAskMagazzinoProssimitaComponent.Factory dialogAskMagazzinoProssimitaComponent();
|
||||
|
||||
DialogChooseBatchLotComponent.Factory dialogChooseBatchLotComponent();
|
||||
|
||||
DialogRowInfoProdFabbisognoLineeProdComponent.Factory dialogRowInfoProdFabbisognoLineeProdComponent();
|
||||
|
||||
ProdRientroMerceComponent.Factory prodRientroMerceComponent();
|
||||
|
||||
ProdRientroMerceOrderDetailComponent.Factory prodRientroMerceOrderDetailComponent();
|
||||
|
||||
ProdOrdineProduzioneElencoComponent.Factory prodOrdineProduzioneElencoComponent();
|
||||
|
||||
ProdRecuperoMaterialeComponent.Factory prodRecuperoMaterialeComponent();
|
||||
|
||||
ProdVersamentoMaterialeComponent.Factory prodVersamentoMaterialeComponent();
|
||||
|
||||
DialogChooseArtsFromListaArtsComponent.Factory dialogChooseArtsFromListaArtsComponent();
|
||||
|
||||
DocInterniComponent.Factory docInterniComponent();
|
||||
|
||||
DialogSelectDocInfoComponent.Factory dialogSelectMgrpDtipPairComponent();
|
||||
|
||||
DialogSelectDocRowsComponent.Factory dialogSelectDocRowsComponent();
|
||||
|
||||
DocInterniEditFormComponent.Factory docInterniEditFormComponent();
|
||||
|
||||
InfoAggiuntiveLUDialogComponent.Factory infoAggiuntiveLUDialogComponent();
|
||||
|
||||
DialogEditArticoloComponent.Factory dialogEditArticoloComponent();
|
||||
|
||||
DialogPrintOrderSSCCListComponent.Factory dialogPrintOrderSSCCListComponent();
|
||||
|
||||
ProdLineeProduzioneComponent.Factory prodLineeProduzioneComponent();
|
||||
|
||||
void inject(MainApplication mainApplication);
|
||||
|
||||
void inject(AppContext mainApplication);
|
||||
|
||||
}
|
||||
|
||||
@@ -19,14 +19,19 @@ import it.integry.integrywmsnative.core.rest.consumers.CommessaRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.DepositoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.EntityRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.GestSetupRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.GiacenzaRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.MagazzinoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.MesRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.OrdiniRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.PrinterRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
||||
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.prod_fabbisogno_linee_prod.rest.ProdFabbisognoLineeProdRESTConsumer;
|
||||
import it.integry.integrywmsnative.view.dialogs.DialogProgressView;
|
||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2View;
|
||||
|
||||
@Module
|
||||
public class MainApplicationModule {
|
||||
@@ -69,6 +74,24 @@ public class MainApplicationModule {
|
||||
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
|
||||
@Singleton
|
||||
OrdiniRESTConsumer provideOrdiniRESTConsumer(SystemRESTConsumer systemRESTConsumer, EntityRESTConsumer entityRESTConsumer) {
|
||||
@@ -165,5 +188,16 @@ public class MainApplicationModule {
|
||||
return new DocInterniRESTConsumer();
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
GiacenzaRESTConsumer provideGiacenzaRESTConsumer(SystemRESTConsumer systemRESTConsumer, ArticoloRESTConsumer articoloRESTConsumer) {
|
||||
return new GiacenzaRESTConsumer(systemRESTConsumer, articoloRESTConsumer);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
InventarioService provideInventarioService(GiacenzaRESTConsumer giacenzaRESTConsumer) {
|
||||
return new InventarioService(giacenzaRESTConsumer);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package it.integry.integrywmsnative;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
@@ -38,6 +39,12 @@ public class SplashActivity extends BaseActivity implements MainContext.Listener
|
||||
|
||||
private RunnableArgsss<Integer, String[], List<Integer>> onRequestPermissionResult;
|
||||
|
||||
public static void startActivity(Context context) {
|
||||
Intent intent = new Intent(context, SplashActivity.class);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
@@ -16,7 +16,7 @@ public class CommonConst {
|
||||
|
||||
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 {
|
||||
|
||||
@@ -23,7 +23,7 @@ public class BarcodeCallbackDTO {
|
||||
return onScanSuccessfull;
|
||||
}
|
||||
|
||||
public BarcodeCallbackDTO setOnScanSuccessfull(RunnableArgs<BarcodeScanDTO> onScanSuccessfull) {
|
||||
public BarcodeCallbackDTO setOnScanSuccessful(RunnableArgs<BarcodeScanDTO> onScanSuccessfull) {
|
||||
this.onScanSuccessfull = onScanSuccessfull;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import it.integry.integrywmsnative.gest.ordini_uscita_elenco.OrdiniUscitaElencoF
|
||||
import it.integry.integrywmsnative.gest.picking_libero.PickingLiberoFragment;
|
||||
import it.integry.integrywmsnative.gest.prod_accettazione_ord_produzione.ProdOrdineProduzioneElencoFragment;
|
||||
import it.integry.integrywmsnative.gest.prod_fabbisogno_linee_prod.ProdFabbisognoLineeProdFragment;
|
||||
import it.integry.integrywmsnative.gest.prod_linee_produzione.ProdLineeProduzioneFragment;
|
||||
import it.integry.integrywmsnative.gest.prod_recupero_materiale.ProdRecuperoMaterialeFragment;
|
||||
import it.integry.integrywmsnative.gest.prod_rientro_merce.ProdRientroMerceFragment;
|
||||
import it.integry.integrywmsnative.gest.prod_versamento_materiale.ProdVersamentoMaterialeFragment;
|
||||
@@ -45,137 +46,145 @@ public class MenuConfiguration extends BaseMenuConfiguration {
|
||||
.setDrawerIcon(R.drawable.ic_black_latest_delivery)
|
||||
.setFragmentFactory(UltimiArriviFornitoreFragment::newInstance))
|
||||
).addGroup(
|
||||
new MenuGroup()
|
||||
.setGroupText(R.string.checkout)
|
||||
.setGroupId(R.id.nav_group_spedizione)
|
||||
.setCodMenu("MM010")
|
||||
new MenuGroup()
|
||||
.setGroupText(R.string.checkout)
|
||||
.setGroupId(R.id.nav_group_spedizione)
|
||||
.setCodMenu("MM010")
|
||||
|
||||
.addItem(new MenuItem()
|
||||
.setID(R.id.nav_spedizione)
|
||||
.setCodMenu("MG046")
|
||||
.setTitleText(R.string.vendita_title_fragment)
|
||||
.setTitleIcon(R.drawable.ic_dashboard_spedizione)
|
||||
.setDrawerIcon(R.drawable.ic_black_upload)
|
||||
.setFragmentFactory(() -> OrdiniUscitaElencoFragment.newInstance(GestioneEnum.VENDITA, null, -1, null)))
|
||||
|
||||
.addItem(new MenuItem()
|
||||
.setID(R.id.nav_free_picking)
|
||||
.setCodMenu("MG047")
|
||||
.setTitleText(R.string.free_picking)
|
||||
.setTitleIcon(R.drawable.ic_dashboard_picking_libero)
|
||||
.setDrawerIcon(R.drawable.ic_black_barcode_scanner)
|
||||
.setFragmentFactory(() -> PickingLiberoFragment.newInstance(GestioneEnum.VENDITA)))
|
||||
|
||||
.addItem(new MenuItem()
|
||||
.setID(R.id.nav_resi_cliente)
|
||||
.setCodMenu("MG048")
|
||||
.setTitleText(R.string.fragment_ultime_consegne_cliente_title)
|
||||
.setTitleIcon(R.drawable.ic_latest_delivery_customer)
|
||||
.setDrawerIcon(R.drawable.ic_black_latest_delivery)
|
||||
.setFragmentFactory(UltimeConsegneClienteFragment::newInstance))
|
||||
).addGroup(new MenuGroup()
|
||||
.setGroupText(R.string.manufacture)
|
||||
.setGroupId(R.id.nav_group_produzione)
|
||||
.setCodMenu("MM009")
|
||||
|
||||
.addItem(new MenuItem()
|
||||
.setID(R.id.nav_spedizione)
|
||||
.setCodMenu("MG046")
|
||||
.setTitleText(R.string.vendita_title_fragment)
|
||||
.setTitleIcon(R.drawable.ic_dashboard_spedizione)
|
||||
.setDrawerIcon(R.drawable.ic_black_upload)
|
||||
.setFragmentFactory(() -> OrdiniUscitaElencoFragment.newInstance(GestioneEnum.VENDITA, null, -1, null)))
|
||||
.setID(R.id.nav_prod_ordine_produzione)
|
||||
.setCodMenu("MG049")
|
||||
.setTitleText(R.string.prod_ordine_produzione_title_fragment)
|
||||
.setTitleIcon(R.drawable.ic_dashboard_prod_accettazione_produzione)
|
||||
.setDrawerIcon(R.drawable.ic_black_external)
|
||||
.setFragmentFactory(ProdOrdineProduzioneElencoFragment::newInstance))
|
||||
|
||||
.addItem(new MenuItem()
|
||||
.setID(R.id.nav_free_picking)
|
||||
.setCodMenu("MG047")
|
||||
.setTitleText(R.string.free_picking)
|
||||
.setTitleIcon(R.drawable.ic_dashboard_picking_libero)
|
||||
.setDrawerIcon(R.drawable.ic_black_barcode_scanner)
|
||||
.setFragmentFactory(() -> PickingLiberoFragment.newInstance(GestioneEnum.VENDITA)))
|
||||
.setID(R.id.nav_prod_ordine_lavorazione)
|
||||
.setCodMenu("MG050")
|
||||
.setTitleText(R.string.prod_ordine_lavorazione_title_fragment)
|
||||
.setTitleIcon(R.drawable.ic_dashboard_prod_picking_lavorazione)
|
||||
.setDrawerIcon(R.drawable.ic_black_external)
|
||||
.setFragmentFactory(() -> OrdiniUscitaElencoFragment.newInstance(GestioneEnum.PRODUZIONE, GestioneEnum.LAVORAZIONE, -1, null)))
|
||||
|
||||
.addItem(new MenuItem()
|
||||
.setID(R.id.nav_resi_cliente)
|
||||
.setCodMenu("MG048")
|
||||
.setTitleText(R.string.fragment_ultime_consegne_cliente_title)
|
||||
.setTitleIcon(R.drawable.ic_latest_delivery_customer)
|
||||
.setDrawerIcon(R.drawable.ic_black_latest_delivery)
|
||||
.setFragmentFactory(UltimeConsegneClienteFragment::newInstance))
|
||||
).addGroup(new MenuGroup()
|
||||
.setGroupText(R.string.manufacture)
|
||||
.setGroupId(R.id.nav_group_produzione)
|
||||
.setCodMenu("MM009")
|
||||
|
||||
.addItem(new MenuItem()
|
||||
.setID(R.id.nav_prod_ordine_produzione)
|
||||
.setCodMenu("MG049")
|
||||
.setTitleText(R.string.prod_ordine_produzione_title_fragment)
|
||||
.setTitleIcon(R.drawable.ic_dashboard_prod_accettazione_produzione)
|
||||
.setDrawerIcon(R.drawable.ic_black_external)
|
||||
.setFragmentFactory(ProdOrdineProduzioneElencoFragment::newInstance))
|
||||
|
||||
.addItem(new MenuItem()
|
||||
.setID(R.id.nav_prod_ordine_lavorazione)
|
||||
.setCodMenu("MG050")
|
||||
.setTitleText(R.string.prod_ordine_lavorazione_title_fragment)
|
||||
.setTitleIcon(R.drawable.ic_dashboard_prod_picking_lavorazione)
|
||||
.setDrawerIcon(R.drawable.ic_black_external)
|
||||
.setFragmentFactory(() -> OrdiniUscitaElencoFragment.newInstance(GestioneEnum.PRODUZIONE, GestioneEnum.LAVORAZIONE, -1, null)))
|
||||
|
||||
.addItem(new MenuItem()
|
||||
.setID(R.id.nav_free_lav_picking)
|
||||
.setCodMenu("MG051")
|
||||
.setTitleText(it.integry.integrywmsnative.R.string.free_lav_picking)
|
||||
.setTitleIcon(R.drawable.ic_dashboard_prod_picking_libero)
|
||||
.setDrawerIcon(it.integry.integrywmsnative.R.drawable.ic_black_barcode_scanner)
|
||||
.setFragmentFactory(() -> PickingLiberoFragment.newInstance(GestioneEnum.LAVORAZIONE)))
|
||||
|
||||
.addItem(new MenuItem()
|
||||
.setID(R.id.nav_prod_posizionamento_da_ord)
|
||||
.setCodMenu("MG052")
|
||||
.setTitleText(R.string.prod_fabbisogno_linee_prod_title)
|
||||
.setTitleIcon(R.drawable.ic_dashboard_prod_versamento_merce)
|
||||
.setDrawerIcon(it.integry.integrywmsnative.R.drawable.ic_black_load_shelf)
|
||||
.setFragmentFactory(ProdFabbisognoLineeProdFragment::newInstance))
|
||||
|
||||
.addItem(new MenuItem()
|
||||
.setID(R.id.nav_prod_versamento_materiale)
|
||||
.setCodMenu("MG053")
|
||||
.setTitleText(R.string.prod_versamento_materiale_title_fragment)
|
||||
.setTitleIcon(R.drawable.ic_dashboard_prod_versamento_materiale)
|
||||
.setDrawerIcon(R.drawable.ic_black_external)
|
||||
.setFragmentFactory(ProdVersamentoMaterialeFragment::newInstance))
|
||||
|
||||
.addItem(new MenuItem()
|
||||
.setID(R.id.nav_prod_recupero_materiale)
|
||||
.setCodMenu("MG054")
|
||||
.setTitleText(R.string.prod_recupero_materiale_title_fragment)
|
||||
.setTitleIcon(R.drawable.ic_dashboard_prod_recupero_materiale)
|
||||
.setDrawerIcon(R.drawable.ic_black_external)
|
||||
.setFragmentFactory(ProdRecuperoMaterialeFragment::newInstance))
|
||||
|
||||
.addItem(new MenuItem()
|
||||
.setID(it.integry.integrywmsnative.R.id.nav_prod_rientro_merce)
|
||||
.setCodMenu("MG059")
|
||||
.setTitleText(it.integry.integrywmsnative.R.string.rientro_merce_fragment_title)
|
||||
.setTitleIcon(it.integry.integrywmsnative.R.drawable.ic_dashboard_prod_accettazione_produzione)
|
||||
.setDrawerIcon(it.integry.integrywmsnative.R.drawable.ic_black_external)
|
||||
.setFragmentFactory(ProdRientroMerceFragment::newInstance))
|
||||
).addGroup(
|
||||
new MenuGroup()
|
||||
.setGroupText(R.string.internal_handling)
|
||||
.setGroupId(R.id.nav_group_movimentazione_interna)
|
||||
.setCodMenu("MM011")
|
||||
.setID(R.id.nav_free_lav_picking)
|
||||
.setCodMenu("MG051")
|
||||
.setTitleText(it.integry.integrywmsnative.R.string.free_lav_picking)
|
||||
.setTitleIcon(R.drawable.ic_dashboard_prod_picking_libero)
|
||||
.setDrawerIcon(it.integry.integrywmsnative.R.drawable.ic_black_barcode_scanner)
|
||||
.setFragmentFactory(() -> PickingLiberoFragment.newInstance(GestioneEnum.LAVORAZIONE)))
|
||||
|
||||
.addItem(new MenuItem()
|
||||
.setID(R.id.nav_versamento_merce)
|
||||
.setCodMenu("MG055")
|
||||
.setTitleText(R.string.versamento_merce_fragment_title)
|
||||
.setTitleIcon(R.drawable.ic_dashboard_versamento_merce)
|
||||
.setDrawerIcon(R.drawable.ic_black_load_shelf)
|
||||
.setFragmentFactory(VersamentoMerceFragment::newInstance))
|
||||
.setID(R.id.nav_prod_posizionamento_da_ord)
|
||||
.setCodMenu("MG052")
|
||||
.setTitleText(R.string.prod_fabbisogno_linee_prod_title)
|
||||
.setTitleIcon(R.drawable.ic_dashboard_prod_versamento_merce)
|
||||
.setDrawerIcon(it.integry.integrywmsnative.R.drawable.ic_black_load_shelf)
|
||||
.setFragmentFactory(ProdFabbisognoLineeProdFragment::newInstance))
|
||||
|
||||
.addItem(new MenuItem()
|
||||
.setID(R.id.nav_rettifica_giacenze)
|
||||
.setCodMenu("MG056")
|
||||
.setTitleText(R.string.rettifica_giacenze_fragment_title)
|
||||
.setTitleIcon(R.drawable.ic_dashboard_rettifica_giacenze)
|
||||
.setDrawerIcon(R.drawable.ic_black_empty_box)
|
||||
.setFragmentFactory(RettificaGiacenzeFragment::newInstance))
|
||||
|
||||
|
||||
).addGroup(
|
||||
new MenuGroup()
|
||||
.setCodMenu("MM012")
|
||||
.setGroupText(it.integry.integrywmsnative.R.string.punto_vendita)
|
||||
.setGroupId(it.integry.integrywmsnative.R.id.nav_group_puntivendita)
|
||||
.setID(R.id.nav_prod_versamento_materiale)
|
||||
.setCodMenu("MG053")
|
||||
.setTitleText(R.string.prod_versamento_materiale_title_fragment)
|
||||
.setTitleIcon(R.drawable.ic_dashboard_prod_versamento_materiale)
|
||||
.setDrawerIcon(R.drawable.ic_black_external)
|
||||
.setFragmentFactory(ProdVersamentoMaterialeFragment::newInstance))
|
||||
|
||||
.addItem(new MenuItem()
|
||||
.setCodMenu("MG057")
|
||||
.setID(it.integry.integrywmsnative.R.id.nav_pv_ordini_acquisto)
|
||||
.setTitleText(it.integry.integrywmsnative.R.string.generate_orders)
|
||||
.setTitleIcon(it.integry.integrywmsnative.R.drawable.ic_dashboard_purchase_orders_pv)
|
||||
.setDrawerIcon(it.integry.integrywmsnative.R.drawable.ic_dashboard_purchase_orders_pv)
|
||||
.setFragmentFactory(PVOrdiniAcquistoGrigliaFragment::newInstance))
|
||||
.setID(R.id.nav_prod_recupero_materiale)
|
||||
.setCodMenu("MG054")
|
||||
.setTitleText(R.string.prod_recupero_materiale_title_fragment)
|
||||
.setTitleIcon(R.drawable.ic_dashboard_prod_recupero_materiale)
|
||||
.setDrawerIcon(R.drawable.ic_black_external)
|
||||
.setFragmentFactory(ProdRecuperoMaterialeFragment::newInstance))
|
||||
|
||||
.addItem(new MenuItem()
|
||||
.setCodMenu("MG058")
|
||||
.setID(it.integry.integrywmsnative.R.id.nav_pv_doc_interni)
|
||||
.setTitleText(it.integry.integrywmsnative.R.string.doc_interni)
|
||||
.setTitleIcon(R.drawable.ic_dashboard_contab_doc_interni)
|
||||
.setDrawerIcon(it.integry.integrywmsnative.R.drawable.ic_dashboard_contab_doc_interni)
|
||||
.setFragmentFactory(DocInterniFragment::newInstance))
|
||||
.setID(it.integry.integrywmsnative.R.id.nav_prod_rientro_merce)
|
||||
.setCodMenu("MG059")
|
||||
.setTitleText(it.integry.integrywmsnative.R.string.rientro_merce_fragment_title)
|
||||
.setTitleIcon(it.integry.integrywmsnative.R.drawable.ic_dashboard_prod_accettazione_produzione)
|
||||
.setDrawerIcon(it.integry.integrywmsnative.R.drawable.ic_black_external)
|
||||
.setFragmentFactory(ProdRientroMerceFragment::newInstance))
|
||||
|
||||
.addItem(new MenuItem()
|
||||
.setID(it.integry.integrywmsnative.R.id.nav_prod_linee)
|
||||
.setCodMenu("MG061")
|
||||
.setTitleText(it.integry.integrywmsnative.R.string.nav_prod_linee_title)
|
||||
.setTitleIcon(R.drawable.ic_production_line)
|
||||
.setDrawerIcon(it.integry.integrywmsnative.R.drawable.ic_production_line)
|
||||
.setFragmentFactory(ProdLineeProduzioneFragment::newInstance))
|
||||
).addGroup(
|
||||
new MenuGroup()
|
||||
.setGroupText(R.string.internal_handling)
|
||||
.setGroupId(R.id.nav_group_movimentazione_interna)
|
||||
.setCodMenu("MM011")
|
||||
|
||||
.addItem(new MenuItem()
|
||||
.setID(R.id.nav_versamento_merce)
|
||||
.setCodMenu("MG055")
|
||||
.setTitleText(R.string.versamento_merce_fragment_title)
|
||||
.setTitleIcon(R.drawable.ic_dashboard_versamento_merce)
|
||||
.setDrawerIcon(R.drawable.ic_black_load_shelf)
|
||||
.setFragmentFactory(VersamentoMerceFragment::newInstance))
|
||||
|
||||
.addItem(new MenuItem()
|
||||
.setID(R.id.nav_rettifica_giacenze)
|
||||
.setCodMenu("MG056")
|
||||
.setTitleText(R.string.rettifica_giacenze_fragment_title)
|
||||
.setTitleIcon(R.drawable.ic_dashboard_rettifica_giacenze)
|
||||
.setDrawerIcon(R.drawable.ic_black_empty_box)
|
||||
.setFragmentFactory(RettificaGiacenzeFragment::newInstance))
|
||||
|
||||
|
||||
).addGroup(
|
||||
new MenuGroup()
|
||||
.setCodMenu("MM012")
|
||||
.setGroupText(it.integry.integrywmsnative.R.string.punto_vendita)
|
||||
.setGroupId(it.integry.integrywmsnative.R.id.nav_group_puntivendita)
|
||||
|
||||
.addItem(new MenuItem()
|
||||
.setCodMenu("MG057")
|
||||
.setID(it.integry.integrywmsnative.R.id.nav_pv_ordini_acquisto)
|
||||
.setTitleText(it.integry.integrywmsnative.R.string.generate_orders)
|
||||
.setTitleIcon(it.integry.integrywmsnative.R.drawable.ic_dashboard_purchase_orders_pv)
|
||||
.setDrawerIcon(it.integry.integrywmsnative.R.drawable.ic_dashboard_purchase_orders_pv)
|
||||
.setFragmentFactory(PVOrdiniAcquistoGrigliaFragment::newInstance))
|
||||
.addItem(new MenuItem()
|
||||
.setCodMenu("MG058")
|
||||
.setID(it.integry.integrywmsnative.R.id.nav_pv_doc_interni)
|
||||
.setTitleText(it.integry.integrywmsnative.R.string.doc_interni)
|
||||
.setTitleIcon(R.drawable.ic_dashboard_contab_doc_interni)
|
||||
.setDrawerIcon(it.integry.integrywmsnative.R.drawable.ic_dashboard_contab_doc_interni)
|
||||
.setFragmentFactory(DocInterniFragment::newInstance))
|
||||
|
||||
// .addItem(new MenuItem()
|
||||
// .setID(it.integry.integrywmsnative.R.id.nav_pv_ordini_acquisto_trasmessi)
|
||||
@@ -183,7 +192,7 @@ public class MenuConfiguration extends BaseMenuConfiguration {
|
||||
// .setTitleIcon(it.integry.integrywmsnative.R.drawable.ic_dashboard_trasmitted_orders_list)
|
||||
// .setDrawerIcon(it.integry.integrywmsnative.R.drawable.ic_dashboard_trasmitted_orders_list)
|
||||
// .setFragmentClass(PVOrdiniAcquistoTransmittedListFragment.newInstance()))
|
||||
);
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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() {
|
||||
return mtbColtsSessions.size() > 0;
|
||||
return mtbColtsSessions != null && mtbColtsSessions.size() > 0;
|
||||
}
|
||||
|
||||
public List<Integer> getAllSessionIDs() {
|
||||
|
||||
@@ -4,6 +4,7 @@ import androidx.room.Database;
|
||||
import androidx.room.RoomDatabase;
|
||||
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.dao.ArticoloGrigliaDao;
|
||||
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.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({
|
||||
DateConverter.class
|
||||
DateConverter.class,
|
||||
BigDecimalConverter.class
|
||||
})
|
||||
public abstract class AppDatabase extends RoomDatabase {
|
||||
|
||||
// private AppDatabase mRoomInstance;
|
||||
|
||||
public abstract ArticoloGrigliaDao articoloGrigliaDao();
|
||||
|
||||
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.Insert;
|
||||
import androidx.room.Query;
|
||||
import androidx.room.RawQuery;
|
||||
import androidx.room.Update;
|
||||
import androidx.sqlite.db.SupportSQLiteQuery;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.ArticoloGriglia;
|
||||
@@ -21,10 +22,13 @@ public interface ArticoloGrigliaDao {
|
||||
|
||||
@Insert
|
||||
void insertAll(List<ArticoloGriglia> articoli);
|
||||
|
||||
@Insert
|
||||
Long insert(ArticoloGriglia articolo);
|
||||
|
||||
@Update
|
||||
void updateAll(List<ArticoloGriglia> articoli);
|
||||
|
||||
@Update
|
||||
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")
|
||||
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);
|
||||
|
||||
@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);
|
||||
|
||||
@RawQuery(observedEntities = ArticoloGriglia.class)
|
||||
List<ArticoloGriglia> getArticoli(SupportSQLiteQuery query);
|
||||
|
||||
@Query("SELECT * FROM articoli_griglia WHERE id_griglia = :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 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.Ordine;
|
||||
import it.integry.integrywmsnative.core.data_store.db.wrappers.ArticoloOrdineWrapper;
|
||||
|
||||
@Dao
|
||||
public interface ArticoloOrdineDao {
|
||||
@@ -34,8 +33,17 @@ public interface ArticoloOrdineDao {
|
||||
@Update
|
||||
void update(ArticoloOrdine articolo);
|
||||
|
||||
@Query("SELECT * FROM articoli_ordine where id_ordine = :ordineId")
|
||||
List<ArticoloOrdine> findArticoliByOrdine(int ordineId);
|
||||
@Query("SELECT articoli_ordine.*," +
|
||||
"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")
|
||||
ArticoloOrdine findArticoloByCodMartAndOrdine(int ordineId, String codMart);
|
||||
|
||||
@@ -6,7 +6,10 @@ import androidx.room.ForeignKey;
|
||||
import androidx.room.Index;
|
||||
import androidx.room.PrimaryKey;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||
|
||||
@@ -27,7 +30,7 @@ import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||
public class ArticoloGriglia {
|
||||
@PrimaryKey(autoGenerate = true)
|
||||
@ColumnInfo(name = "articolo_griglia_id")
|
||||
private int articoloGrigliaId;
|
||||
private Integer articoloGrigliaId;
|
||||
|
||||
@ColumnInfo(name = "cod_mart")
|
||||
private String codMart;
|
||||
@@ -71,11 +74,14 @@ public class ArticoloGriglia {
|
||||
@ColumnInfo(name = "id_griglia")
|
||||
private int idGriglia;
|
||||
|
||||
public int getArticoloGrigliaId() {
|
||||
@ColumnInfo(name = "new_no_promo")
|
||||
private boolean newNoPromo = false;
|
||||
|
||||
public Integer getArticoloGrigliaId() {
|
||||
return articoloGrigliaId;
|
||||
}
|
||||
|
||||
public void setArticoloGrigliaId(int articoloGrigliaId) {
|
||||
public void setArticoloGrigliaId(Integer articoloGrigliaId) {
|
||||
this.articoloGrigliaId = articoloGrigliaId;
|
||||
}
|
||||
|
||||
@@ -191,6 +197,22 @@ public class ArticoloGriglia {
|
||||
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) {
|
||||
ArticoloOrdine articolo = new ArticoloOrdine();
|
||||
|
||||
@@ -210,6 +232,8 @@ public class ArticoloGriglia {
|
||||
articolo.setGiacenza(BigDecimal.valueOf(this.getGiacenza()));
|
||||
articolo.setQtaPrevistaVendita(BigDecimal.valueOf(this.getQtaPrevistaVendita()));
|
||||
articolo.setQtaProposta(BigDecimal.valueOf(this.getQtaProposta()));
|
||||
articolo.setNewNoPromo(this.isNewNoPromo());
|
||||
articolo.setSystemNote(generateSystemNote());
|
||||
|
||||
articolo.setQtaOrd(0);
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ import java.util.Date;
|
||||
public class ArticoloOrdine {
|
||||
@PrimaryKey(autoGenerate = true)
|
||||
@ColumnInfo(name = "articolo_ordine_id")
|
||||
private int articoloOrdineId;
|
||||
private Integer articoloOrdineId;
|
||||
|
||||
@ColumnInfo(name = "cod_mart")
|
||||
private String codMart;
|
||||
@@ -67,6 +67,11 @@ public class ArticoloOrdine {
|
||||
@ColumnInfo(name = "data_ins")
|
||||
private Date dataIns;
|
||||
|
||||
@ColumnInfo(name = "new_no_promo")
|
||||
private boolean newNoPromo;
|
||||
|
||||
@ColumnInfo(name = "system_note")
|
||||
private String systemNote;
|
||||
|
||||
@Ignore
|
||||
private int ggScadenza = 0;
|
||||
@@ -80,12 +85,15 @@ public class ArticoloOrdine {
|
||||
@Ignore
|
||||
private BigDecimal qtaProposta = BigDecimal.ZERO;
|
||||
|
||||
@Ignore
|
||||
private int bgTint;
|
||||
|
||||
public int getArticoloOrdineId() {
|
||||
|
||||
public Integer getArticoloOrdineId() {
|
||||
return articoloOrdineId;
|
||||
}
|
||||
|
||||
public void setArticoloOrdineId(int articoloOrdineId) {
|
||||
public void setArticoloOrdineId(Integer articoloOrdineId) {
|
||||
this.articoloOrdineId = articoloOrdineId;
|
||||
}
|
||||
|
||||
@@ -221,14 +229,52 @@ public class ArticoloOrdine {
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getQtaCnfPrevistaVendita(){
|
||||
return qtaPrevistaVendita.equals(BigDecimal.ZERO) ? BigDecimal.ZERO : qtaPrevistaVendita.divide(BigDecimal.valueOf(qtaCnf),0, RoundingMode.CEILING);
|
||||
public BigDecimal getQtaCnfPrevistaVendita() {
|
||||
return qtaPrevistaVendita.equals(BigDecimal.ZERO) ? BigDecimal.ZERO : qtaPrevistaVendita.divide(BigDecimal.valueOf(qtaCnf), 0, RoundingMode.CEILING);
|
||||
}
|
||||
|
||||
public BigDecimal getQtaCnfProposta(){
|
||||
return qtaProposta.equals(BigDecimal.ZERO) ? BigDecimal.ZERO : qtaProposta.divide(BigDecimal.valueOf(qtaCnf),0, RoundingMode.CEILING);
|
||||
public BigDecimal getQtaCnfProposta() {
|
||||
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 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 java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
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;
|
||||
|
||||
@@ -24,27 +31,21 @@ public class ArticoliGrigliaDataSource extends Repository implements ArticoloGri
|
||||
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(() -> {
|
||||
try {
|
||||
List<ArticoloGriglia> toUpdate = new ArrayList<>();
|
||||
List<ArticoloGriglia> toInsert = new ArrayList<>();
|
||||
List<String> codMarts = new ArrayList<>();
|
||||
for (ArticoloGriglia art : articoli) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
var tmp = calcItemsToInsertAndUpdate(updatedArts);
|
||||
var toInsert = (List<ArticoloGriglia>) tmp.get("toInsert");
|
||||
var toUpdate = (List<ArticoloGriglia>) tmp.get("toUpdate");
|
||||
var codMarts = (List<String>) tmp.get("codMarts");
|
||||
|
||||
mArticoloGrigliaDao.insertAll(toInsert);
|
||||
mArticoloGrigliaDao.updateAll(toUpdate);
|
||||
|
||||
List<ArticoloGriglia> articoliGriglia = mArticoloGrigliaDao.getArticoliFromGriglia(griglia.getGrigliaId());
|
||||
List<ArticoloGriglia> toDelete = Stream.of(articoliGriglia).filter(articolo -> !codMarts.contains(articolo.getCodMart())).toList();
|
||||
mArticoloGrigliaDao.deleteList(toDelete);
|
||||
|
||||
onSuccess.run();
|
||||
} catch (Exception 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) {
|
||||
execute(() -> {
|
||||
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;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
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.Ordine;
|
||||
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;
|
||||
|
||||
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> toInsert = new ArrayList<>();
|
||||
for (ArticoloOrdine art : articoli) {
|
||||
if (art.getArticoloOrdineId() > 0) {
|
||||
if (art.getArticoloOrdineId() != null && art.getArticoloOrdineId() > 0) {
|
||||
toUpdate.add(art);
|
||||
} else {
|
||||
toInsert.add(art);
|
||||
}
|
||||
}
|
||||
mArticoloOrdineDao.insertAll(toInsert);
|
||||
for (ArticoloOrdine newArt : toInsert) {
|
||||
mArticoloOrdineDao.insert(newArt);
|
||||
}
|
||||
mArticoloOrdineDao.updateAll(toUpdate);
|
||||
onSuccess.run();
|
||||
|
||||
@@ -48,7 +53,7 @@ public class ArticoliOrdineDataSource extends Repository implements ArticoliOrdi
|
||||
public void saveArticoloToOrdine(ArticoloOrdine articolo, Runnable onSuccess, RunnableArgs<Exception> onFail) {
|
||||
execute(() -> {
|
||||
try {
|
||||
if (articolo.getArticoloOrdineId() > 0) {
|
||||
if (articolo.getArticoloOrdineId() != null && articolo.getArticoloOrdineId() > 0) {
|
||||
mArticoloOrdineDao.update(articolo);
|
||||
} else {
|
||||
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) {
|
||||
execute(() -> {
|
||||
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) {
|
||||
onError.run(e);
|
||||
}
|
||||
|
||||
@@ -1,35 +1,23 @@
|
||||
package it.integry.integrywmsnative.core.data_store.db.view_model;
|
||||
|
||||
import androidx.room.ColumnInfo;
|
||||
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.ArticoloGriglia;
|
||||
|
||||
public class ArticoloDTO {
|
||||
|
||||
private String codMart;
|
||||
|
||||
private String descrizione;
|
||||
|
||||
private String untMis;
|
||||
|
||||
private String barcode;
|
||||
|
||||
private String flagQtaMultipla;
|
||||
|
||||
private float qtaCnf;
|
||||
|
||||
private float merceDaRic;
|
||||
|
||||
private float mediaSett;
|
||||
|
||||
private float qtaMinOrdinabile;
|
||||
|
||||
public String codMart;
|
||||
public String descrizione;
|
||||
public String untMis;
|
||||
public float qtaCnf;
|
||||
public String barcode;
|
||||
public float merceDaRic;
|
||||
public float mediaSett;
|
||||
public String flagQtaMultipla;
|
||||
public String flagTracciabilita;
|
||||
public float qtaMinOrdinabile;
|
||||
public boolean newNoPromo;
|
||||
private int ggScadenza;
|
||||
|
||||
private float giacenza;
|
||||
|
||||
private float qtaPrevistaVendita;
|
||||
|
||||
private float qtaProposta;
|
||||
|
||||
|
||||
@@ -145,6 +133,24 @@ public class ArticoloDTO {
|
||||
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() {
|
||||
ArticoloGriglia result = new ArticoloGriglia();
|
||||
result.setBarCode(this.getBarCode());
|
||||
@@ -157,6 +163,7 @@ public class ArticoloDTO {
|
||||
result.setFlagQtaMultipla(this.getFlagQtaMultipla());
|
||||
result.setQtaMinOrdinabile(this.getQtaMinOrdinabile());
|
||||
result.setGgScadenza(this.ggScadenza);
|
||||
result.setNewNoPromo(this.newNoPromo);
|
||||
result.setGiacenza(this.giacenza);
|
||||
result.setQtaPrevistaVendita(this.qtaPrevistaVendita);
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -551,6 +551,12 @@ public class Converters {
|
||||
}
|
||||
|
||||
|
||||
@BindingAdapter("visibility")
|
||||
public static void bindViewVisibility(View view, boolean bool) {
|
||||
view.setVisibility(bool ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
|
||||
@BindingAdapter({"reverse_visibility"})
|
||||
public static void bindViewReverseVisibility(View view, final BindableBoolean bindableBoolean) {
|
||||
if (view.getTag(R.id.bound_observable) != bindableBoolean) {
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package it.integry.integrywmsnative.core.di.binders;
|
||||
|
||||
import androidx.appcompat.widget.AppCompatImageView;
|
||||
import androidx.databinding.BindingAdapter;
|
||||
|
||||
public class ImageViewBinders {
|
||||
@BindingAdapter("tint")
|
||||
public static void bindImageViewTint(final AppCompatImageView view, final int color) {
|
||||
view.setColorFilter(color, android.graphics.PorterDuff.Mode.MULTIPLY);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
public final class NoResultFromBarcodeException extends Exception {
|
||||
|
||||
public NoResultFromBarcodeException() {
|
||||
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;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
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.utility.UtilityExceptions;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityProgress;
|
||||
import it.integry.integrywmsnative.view.dialogs.DialogProgressView;
|
||||
|
||||
public class BaseActivity extends AppCompatActivity {
|
||||
|
||||
@Inject
|
||||
public DialogProgressView mCurrentProgress;
|
||||
|
||||
protected Dialog mCurrentProgress;
|
||||
private boolean progressOpened;
|
||||
|
||||
public BaseActivity() {
|
||||
//Thread.setDefaultUncaughtExceptionHandler(new MyExceptionHandler(this, BaseActivity.class));
|
||||
@Nullable
|
||||
@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
|
||||
@@ -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;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
@@ -12,18 +11,21 @@ import androidx.fragment.app.DialogFragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
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.utility.UtilityExceptions;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityProgress;
|
||||
import it.integry.integrywmsnative.view.dialogs.DialogProgressView;
|
||||
|
||||
public class BaseDialogFragment extends DialogFragment {
|
||||
|
||||
private boolean mBarcodeListener = false;
|
||||
private Dialog mCurrentProgress;
|
||||
@Inject
|
||||
public DialogProgressView mCurrentProgress;
|
||||
private boolean progressOpened;
|
||||
|
||||
private boolean mBarcodeListener = false;
|
||||
|
||||
public BaseDialogFragment() {
|
||||
super();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@@ -41,6 +43,11 @@ public class BaseDialogFragment extends DialogFragment {
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
|
||||
MainApplication.appComponent
|
||||
.baseDialogFragmentComponent()
|
||||
.create()
|
||||
.inject(this);
|
||||
|
||||
if (BarcodeManager.isEnabled() && BarcodeManager.isKeyboardEmulator()) {
|
||||
getDialog().setOnKeyListener((dialog, keyCode, 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) {
|
||||
int keyCode = keyEvent.getKeyCode();
|
||||
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;
|
||||
|
||||
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 java.util.ArrayList;
|
||||
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.interfaces.IPoppableActivity;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityProgress;
|
||||
import it.integry.integrywmsnative.ui.ElevatedToolbar;
|
||||
import it.integry.integrywmsnative.view.dialogs.DialogProgressView;
|
||||
|
||||
public abstract class BaseFragment extends Fragment {
|
||||
|
||||
protected Dialog mCurrentProgress;
|
||||
@Inject
|
||||
public DialogProgressView mCurrentProgress;
|
||||
|
||||
protected ElevatedToolbar mToolbar;
|
||||
|
||||
protected final List<Runnable> mOnPreDestroyList = new ArrayList<>();
|
||||
private boolean progressOpened;
|
||||
|
||||
|
||||
public void setScrollToolbar(ElevatedToolbar toolbar) {
|
||||
mToolbar = toolbar;
|
||||
}
|
||||
|
||||
|
||||
public void addOnPreDestroy(Runnable 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() {
|
||||
new Thread(() -> {
|
||||
BarcodeManager.disable();
|
||||
this.openProgress();
|
||||
}).start();
|
||||
this.openProgress();
|
||||
}
|
||||
|
||||
public void onLoadingEnded() {
|
||||
new Thread(() -> {
|
||||
this.closeProgress();
|
||||
BarcodeManager.enable();
|
||||
}).start();
|
||||
this.closeProgress();
|
||||
}
|
||||
|
||||
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) {
|
||||
this.getActivity().runOnUiThread(() -> {
|
||||
requireActivity().runOnUiThread(() -> {
|
||||
this.closeProgress();
|
||||
UtilityExceptions.defaultException(getActivity(), ex, mCurrentProgress);
|
||||
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() {
|
||||
getActivity().runOnUiThread(() -> {
|
||||
requireActivity().runOnUiThread(() -> {
|
||||
((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;
|
||||
|
||||
public abstract class OnGeneralChangedCallback extends Observable.OnPropertyChangedCallback implements Runnable{
|
||||
public abstract class OnGeneralChangedCallback extends Observable.OnPropertyChangedCallback implements Runnable {
|
||||
|
||||
@Override
|
||||
public void onPropertyChanged(Observable sender, int propertyId) {
|
||||
|
||||
@@ -1,28 +1,28 @@
|
||||
package it.integry.integrywmsnative.core.expansion;
|
||||
|
||||
import androidx.databinding.ObservableArrayList;
|
||||
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
|
||||
public void onItemRangeChanged(ObservableList sender, int positionStart, int itemCount) {
|
||||
public void onItemRangeChanged(ObservableList<T> sender, int positionStart, int itemCount) {
|
||||
onChanged(sender);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemRangeInserted(ObservableList sender, int positionStart, int itemCount) {
|
||||
public void onItemRangeInserted(ObservableList<T> sender, int positionStart, int itemCount) {
|
||||
onChanged(sender);
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemRangeRemoved(ObservableList sender, int positionStart, int itemCount) {
|
||||
public void onItemRangeRemoved(ObservableList<T> sender, int positionStart, int itemCount) {
|
||||
onChanged(sender);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,13 +21,13 @@ public abstract class ExtendedSectionedRecyclerView<T, SH extends RecyclerView.V
|
||||
public ExtendedSectionedRecyclerView(ObservableArrayList<T> myDataset) {
|
||||
mDataset.addAll(myDataset);
|
||||
|
||||
myDataset.addOnListChangedCallback(new OnListGeneralChangedCallback() {
|
||||
myDataset.addOnListChangedCallback(new OnListGeneralChangedCallback<T>() {
|
||||
@Override
|
||||
public void onChanged(ObservableList sender) {
|
||||
public void onChanged(ObservableList<T> sender) {
|
||||
mDataset.clear();
|
||||
mDataset.addAll(sender);
|
||||
notifyDataSetChanged();
|
||||
notifyDataChanged();
|
||||
notifyDataSetChanged();
|
||||
checkIfEmpty();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -60,7 +60,7 @@ public class MtbColr extends EntityBase {
|
||||
public MtbColr() {
|
||||
type = "mtb_colr";
|
||||
|
||||
if(SettingsManager.i().isUserLoggedIn()) {
|
||||
if (SettingsManager.i().isUserLoggedIn()) {
|
||||
setUtente(SettingsManager.i().getUser().getFullname());
|
||||
}
|
||||
}
|
||||
@@ -82,7 +82,6 @@ public class MtbColr extends EntityBase {
|
||||
}
|
||||
|
||||
|
||||
|
||||
public MtbColr setGestione(GestioneEnum gestione) {
|
||||
this.gestione = gestione.getText();
|
||||
return this;
|
||||
@@ -124,6 +123,11 @@ public class MtbColr extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public MtbColr setDataCollo(Date dataCollo) {
|
||||
setDataCollo(UtilityDate.formatDate(dataCollo, UtilityDate.COMMONS_DATE_FORMATS.DMY_TIME_SLASH));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public Integer getRiga() {
|
||||
return riga;
|
||||
@@ -301,8 +305,6 @@ public class MtbColr extends EntityBase {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public String getDatetimeRowS() {
|
||||
return datetimeRow;
|
||||
}
|
||||
@@ -322,11 +324,6 @@ public class MtbColr extends EntityBase {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public String getCodJcom() {
|
||||
return codJcom;
|
||||
}
|
||||
@@ -364,11 +361,6 @@ public class MtbColr extends EntityBase {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public String getDataScadPartitaS() {
|
||||
return dataScadPartita;
|
||||
}
|
||||
@@ -398,7 +390,6 @@ public class MtbColr extends EntityBase {
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getUntMis() {
|
||||
return untMis;
|
||||
}
|
||||
|
||||
@@ -1,13 +1,20 @@
|
||||
package it.integry.integrywmsnative.core.model;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import androidx.databinding.ObservableArrayList;
|
||||
|
||||
import com.annimon.stream.Optional;
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
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.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDB;
|
||||
@@ -57,6 +64,7 @@ public class MtbColt extends EntityBase {
|
||||
private String codJcom;
|
||||
|
||||
private List<MtbCols> mtbCols;
|
||||
private MtbTCol mtbTCol;
|
||||
|
||||
private Boolean disablePrint;
|
||||
private String ragSocCliente;
|
||||
@@ -83,7 +91,6 @@ public class MtbColt extends EntityBase {
|
||||
}
|
||||
|
||||
|
||||
|
||||
private ObservableArrayList<MtbColr> mtbColr = new ObservableArrayList<>();
|
||||
|
||||
public ObservableArrayList<MtbColr> getMtbColr() {
|
||||
@@ -95,21 +102,51 @@ public class MtbColt extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public MtbColt(){
|
||||
public MtbColt() {
|
||||
type = "mtb_colt";
|
||||
setDataCollo(UtilityDate.getDateInstance());
|
||||
setSerCollo("/");
|
||||
|
||||
if(SettingsManager.i().isUserLoggedIn()) {
|
||||
if (SettingsManager.i().isUserLoggedIn()) {
|
||||
setPreparatoDa(SettingsManager.i().getUser().getFullname());
|
||||
}
|
||||
}
|
||||
|
||||
public MtbColt initDefaultFields() {
|
||||
public MtbColt initDefaultFields(GestioneEnum gestioneEnum) {
|
||||
setGestione(gestioneEnum);
|
||||
setCodMdep(SettingsManager.i().getUserSession().getDepo().getCodMdep());
|
||||
setPreparatoDa(SettingsManager.i().getUser().getFullname());
|
||||
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;
|
||||
}
|
||||
@@ -137,11 +174,11 @@ public class MtbColt extends EntityBase {
|
||||
Date dataColloD = null;
|
||||
try {
|
||||
dataColloD = getDataColloD();
|
||||
} catch (Exception ex){
|
||||
} catch (Exception ex) {
|
||||
UtilityLogger.errorMe(ex);
|
||||
}
|
||||
|
||||
if(dataColloD != null){
|
||||
if (dataColloD != null) {
|
||||
return UtilityDate.formatDate(dataColloD, UtilityDate.COMMONS_DATE_FORMATS.DMY_HUMAN_LONG);
|
||||
} else return null;
|
||||
}
|
||||
@@ -392,7 +429,7 @@ public class MtbColt extends EntityBase {
|
||||
public String getTimeVers() {
|
||||
Date dataColloD = getDataVersD();
|
||||
|
||||
if(dataColloD != null){
|
||||
if (dataColloD != null) {
|
||||
return UtilityDate.formatDate(dataColloD, UtilityDate.COMMONS_DATE_FORMATS.TIME);
|
||||
} else return null;
|
||||
}
|
||||
@@ -526,16 +563,57 @@ public class MtbColt extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public MtbTCol getMtbTCol() {
|
||||
return mtbTCol;
|
||||
}
|
||||
|
||||
public MtbColt setMtbTCol(MtbTCol mtbTCol) {
|
||||
this.mtbTCol = mtbTCol;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void generaFiltroOrdineFromDTO(List<FiltroOrdineDTO> filtroOrdineDtos) {
|
||||
|
||||
String xmlPrefix = "{\"whereCond\": \"";
|
||||
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);
|
||||
|
||||
try {
|
||||
@@ -545,13 +623,13 @@ public class MtbColt extends EntityBase {
|
||||
UtilityDB.valueToString(UtilityDate.formatDate(x.getDataOrdD(), UtilityDate.COMMONS_DATE_FORMATS.YMD_SLASH)),
|
||||
UtilityDB.valueToString(x.getNumOrd())));
|
||||
|
||||
if(!UtilityString.isNullOrEmpty(x.getDataConsS())) {
|
||||
if (!UtilityString.isNullOrEmpty(x.getDataConsS())) {
|
||||
whereCond.append(String.format(" AND dr.dc = %s",
|
||||
UtilityDB.valueToString(UtilityDate.formatDate(x.getDataConsD(), UtilityDate.COMMONS_DATE_FORMATS.YMD_SLASH))));
|
||||
}
|
||||
|
||||
whereCond.append(")");
|
||||
if(i < filtroOrdineDtos.size()-1) {
|
||||
if (i < filtroOrdineDtos.size() - 1) {
|
||||
whereCond.append(" OR ");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
@@ -559,7 +637,8 @@ public class MtbColt extends EntityBase {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}*/
|
||||
whereCond = TextUtils.join(" OR ", conditions);
|
||||
|
||||
this.filtroOrdini = xmlPrefix + whereCond + xmlSuffix;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,273 @@
|
||||
package it.integry.integrywmsnative.core.model;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Created by ValerioC on 06/03/2018.
|
||||
*/
|
||||
|
||||
public class MvwSitArtUdcDetInventario {
|
||||
|
||||
private String gestione;
|
||||
private Date dataCollo;
|
||||
private String serCollo;
|
||||
private Integer numCollo;
|
||||
private Integer segno;
|
||||
private String codMdep;
|
||||
private String posizione;
|
||||
private Integer priorita;
|
||||
private String codGruppo;
|
||||
private String gruppo;
|
||||
private String codSgruppo;
|
||||
private String sottogruppo;
|
||||
private String codMart;
|
||||
private String diacod;
|
||||
private String descrizioneEstesa;
|
||||
private String partitaMag;
|
||||
private String codJcom;
|
||||
private String commessa;
|
||||
private String untMis;
|
||||
private BigDecimal qtaCol;
|
||||
private BigDecimal numCnf;
|
||||
private BigDecimal qtaCnf;
|
||||
private BigDecimal pesoNettoKg;
|
||||
private BigDecimal pesoLordoKg;
|
||||
private String codJfas;
|
||||
private MtbAart mtbAart;
|
||||
|
||||
|
||||
public String getGestione() {
|
||||
return gestione;
|
||||
}
|
||||
|
||||
public MvwSitArtUdcDetInventario setGestione(String gestione) {
|
||||
this.gestione = gestione;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataCollo() {
|
||||
return dataCollo;
|
||||
}
|
||||
|
||||
public MvwSitArtUdcDetInventario setDataCollo(Date dataCollo) {
|
||||
this.dataCollo = dataCollo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getSerCollo() {
|
||||
return serCollo;
|
||||
}
|
||||
|
||||
public MvwSitArtUdcDetInventario setSerCollo(String serCollo) {
|
||||
this.serCollo = serCollo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getNumCollo() {
|
||||
return numCollo;
|
||||
}
|
||||
|
||||
public MvwSitArtUdcDetInventario setNumCollo(Integer numCollo) {
|
||||
this.numCollo = numCollo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getSegno() {
|
||||
return segno;
|
||||
}
|
||||
|
||||
public MvwSitArtUdcDetInventario setSegno(Integer segno) {
|
||||
this.segno = segno;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodMdep() {
|
||||
return codMdep;
|
||||
}
|
||||
|
||||
public MvwSitArtUdcDetInventario setCodMdep(String codMdep) {
|
||||
this.codMdep = codMdep;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPosizione() {
|
||||
return posizione;
|
||||
}
|
||||
|
||||
public MvwSitArtUdcDetInventario setPosizione(String posizione) {
|
||||
this.posizione = posizione;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getPriorita() {
|
||||
return priorita;
|
||||
}
|
||||
|
||||
public MvwSitArtUdcDetInventario setPriorita(Integer priorita) {
|
||||
this.priorita = priorita;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodGruppo() {
|
||||
return codGruppo;
|
||||
}
|
||||
|
||||
public MvwSitArtUdcDetInventario setCodGruppo(String codGruppo) {
|
||||
this.codGruppo = codGruppo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getGruppo() {
|
||||
return gruppo;
|
||||
}
|
||||
|
||||
public MvwSitArtUdcDetInventario setGruppo(String gruppo) {
|
||||
this.gruppo = gruppo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodSgruppo() {
|
||||
return codSgruppo;
|
||||
}
|
||||
|
||||
public MvwSitArtUdcDetInventario setCodSgruppo(String codSgruppo) {
|
||||
this.codSgruppo = codSgruppo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getSottogruppo() {
|
||||
return sottogruppo;
|
||||
}
|
||||
|
||||
public MvwSitArtUdcDetInventario setSottogruppo(String sottogruppo) {
|
||||
this.sottogruppo = sottogruppo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodMart() {
|
||||
return codMart;
|
||||
}
|
||||
|
||||
public MvwSitArtUdcDetInventario setCodMart(String codMart) {
|
||||
this.codMart = codMart;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDiacod() {
|
||||
return diacod;
|
||||
}
|
||||
|
||||
public MvwSitArtUdcDetInventario setDiacod(String diacod) {
|
||||
this.diacod = diacod;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDescrizioneEstesa() {
|
||||
return descrizioneEstesa;
|
||||
}
|
||||
|
||||
public MvwSitArtUdcDetInventario setDescrizioneEstesa(String descrizioneEstesa) {
|
||||
this.descrizioneEstesa = descrizioneEstesa;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPartitaMag() {
|
||||
return partitaMag;
|
||||
}
|
||||
|
||||
public MvwSitArtUdcDetInventario setPartitaMag(String partitaMag) {
|
||||
this.partitaMag = partitaMag;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodJcom() {
|
||||
return codJcom;
|
||||
}
|
||||
|
||||
public MvwSitArtUdcDetInventario setCodJcom(String codJcom) {
|
||||
this.codJcom = codJcom;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCommessa() {
|
||||
return commessa;
|
||||
}
|
||||
|
||||
public MvwSitArtUdcDetInventario setCommessa(String commessa) {
|
||||
this.commessa = commessa;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getUntMis() {
|
||||
return untMis;
|
||||
}
|
||||
|
||||
public MvwSitArtUdcDetInventario setUntMis(String untMis) {
|
||||
this.untMis = untMis;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getQtaCol() {
|
||||
return qtaCol;
|
||||
}
|
||||
|
||||
public MvwSitArtUdcDetInventario setQtaCol(BigDecimal qtaCol) {
|
||||
this.qtaCol = qtaCol;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getNumCnf() {
|
||||
return numCnf;
|
||||
}
|
||||
|
||||
public MvwSitArtUdcDetInventario setNumCnf(BigDecimal numCnf) {
|
||||
this.numCnf = numCnf;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getQtaCnf() {
|
||||
return qtaCnf;
|
||||
}
|
||||
|
||||
public MvwSitArtUdcDetInventario setQtaCnf(BigDecimal qtaCnf) {
|
||||
this.qtaCnf = qtaCnf;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getPesoNettoKg() {
|
||||
return pesoNettoKg;
|
||||
}
|
||||
|
||||
public MvwSitArtUdcDetInventario setPesoNettoKg(BigDecimal pesoNettoKg) {
|
||||
this.pesoNettoKg = pesoNettoKg;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getPesoLordoKg() {
|
||||
return pesoLordoKg;
|
||||
}
|
||||
|
||||
public MvwSitArtUdcDetInventario setPesoLordoKg(BigDecimal pesoLordoKg) {
|
||||
this.pesoLordoKg = pesoLordoKg;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodJfas() {
|
||||
return codJfas;
|
||||
}
|
||||
|
||||
public MvwSitArtUdcDetInventario setCodJfas(String codJfas) {
|
||||
this.codJfas = codJfas;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MtbAart getMtbAart() {
|
||||
return mtbAart;
|
||||
}
|
||||
|
||||
public MvwSitArtUdcDetInventario setMtbAart(MtbAart mtbAart) {
|
||||
this.mtbAart = mtbAart;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -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 it.integry.integrywmsnative.core.exception.NoPrintersFoundException;
|
||||
import it.integry.integrywmsnative.core.exception.NoResultFromBarcodeException;
|
||||
|
||||
/**
|
||||
* Created by GiuseppeS on 22/03/2018.
|
||||
@@ -15,12 +16,17 @@ public class CommonRESTException {
|
||||
private static String MESSAGE_KEY = "message";
|
||||
private static String EXCEPTION_KEY = "exception";
|
||||
|
||||
private static HashMap<String, HashMap<String, Object>> bindingExceptions = new HashMap() {{
|
||||
put("Printer not found", new HashMap<String, Object>(){{
|
||||
private static final HashMap<String, HashMap<String, Object>> bindingExceptions = new HashMap<>() {{
|
||||
put("Printer not found", new HashMap<>() {{
|
||||
put(MESSAGE_KEY, "Stampante non trovata");
|
||||
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()) {
|
||||
if(message.contains(key)) {
|
||||
Class classType = (Class) bindingExceptions.get(key).get(EXCEPTION_KEY);
|
||||
Class<?> classType = (Class<?>) bindingExceptions.get(key).get(EXCEPTION_KEY);
|
||||
|
||||
try {
|
||||
return (Exception) classType.newInstance();
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
} catch (InstantiationException e) {
|
||||
} catch (IllegalAccessException | InstantiationException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ public class RESTBuilder {
|
||||
return getService(service, SettingsManager.i().getServer().getHost(), SettingsManager.i().getServer().getPort(), true);
|
||||
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
@@ -34,7 +35,7 @@ public class RESTBuilder {
|
||||
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();
|
||||
|
||||
clientBuilder.connectTimeout(timeout, TimeUnit.SECONDS);
|
||||
@@ -43,7 +44,7 @@ public class RESTBuilder {
|
||||
|
||||
clientBuilder.retryOnConnectionFailure(true);
|
||||
|
||||
if(addInterceptors) clientBuilder.addInterceptor(new HttpInterceptor());
|
||||
if (addInterceptors) clientBuilder.addInterceptor(new HttpInterceptor());
|
||||
|
||||
OkHttpClient client = clientBuilder.build();
|
||||
|
||||
@@ -62,4 +63,13 @@ public class RESTBuilder {
|
||||
|
||||
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
|
||||
public void onResponse(Call<ServiceRESTResponse<MtbAart>> call, Response<ServiceRESTResponse<MtbAart>> response) {
|
||||
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));
|
||||
} else onComplete.run(null);
|
||||
|
||||
@@ -107,9 +107,10 @@ public class ArticoloRESTConsumer extends _BaseRESTConsumer {
|
||||
})
|
||||
.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);
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package it.integry.integrywmsnative.core.rest.consumers;
|
||||
|
||||
import androidx.databinding.ObservableArrayList;
|
||||
|
||||
import com.annimon.stream.Optional;
|
||||
import com.annimon.stream.Stream;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonObject;
|
||||
@@ -32,6 +33,7 @@ import it.integry.integrywmsnative.core.rest.model.DistribuzioneColloDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.RettificaULDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.core.rest.model.SpostaArtsTraULRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.VersamentoAutomaticoULResponseDTO;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||
@@ -102,10 +104,9 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
public void createColloLavorazione(int segno, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
MtbColt mtbColtToCreate = new MtbColt()
|
||||
.setSegno(segno)
|
||||
.setGestione(GestioneEnum.LAVORAZIONE);
|
||||
.setSegno(segno);
|
||||
|
||||
mtbColtToCreate.initDefaultFields();
|
||||
mtbColtToCreate.initDefaultFields(GestioneEnum.LAVORAZIONE);
|
||||
|
||||
mtbColtToCreate
|
||||
.setOperation(CommonModelConsts.OPERATION.INSERT);
|
||||
@@ -121,9 +122,8 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
public void createColloScaricoDaCarico(MtbColt sourceMtbColt, MtbDepoPosizione posizione, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
MtbColt newMtbColt = new MtbColt()
|
||||
.initDefaultFields()
|
||||
.initDefaultFields(GestioneEnum.LAVORAZIONE)
|
||||
.setCodAnag(null)
|
||||
.setGestione(GestioneEnum.LAVORAZIONE)
|
||||
.setSegno(-1)
|
||||
.setCodTcol(sourceMtbColt.getCodTcol())
|
||||
.setPesoKg(sourceMtbColt.getPesoKg())
|
||||
@@ -153,7 +153,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
mtbColrClone
|
||||
.setNumCollo(null)
|
||||
.setDataCollo(null)
|
||||
.setDataCollo((String) null)
|
||||
.setRiga(null)
|
||||
.setGestione(GestioneEnum.LAVORAZIONE)
|
||||
|
||||
@@ -174,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) {
|
||||
|
||||
MtbColt newMtbColt = new MtbColt()
|
||||
.initDefaultFields()
|
||||
.initDefaultFields(GestioneEnum.LAVORAZIONE)
|
||||
.setCodAnag(null)
|
||||
.setGestione(GestioneEnum.LAVORAZIONE)
|
||||
.setSegno(-1)
|
||||
.setCodTcol(sourceMtbColt.getCodTcol())
|
||||
// .setPesoKg(sourceMtbColt.getPesoKg())
|
||||
@@ -207,7 +206,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
MtbColr mtbColrClone = new MtbColr();
|
||||
mtbColrClone
|
||||
.setNumCollo(null)
|
||||
.setDataCollo(null)
|
||||
.setDataCollo((String) null)
|
||||
.setRiga(null)
|
||||
.setGestione(GestioneEnum.LAVORAZIONE)
|
||||
.setDataColloRif(sourceMtbColt.getDataColloD())
|
||||
@@ -237,7 +236,6 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
saveCollo(newMtbColt, onComplete, onFailed);
|
||||
}
|
||||
|
||||
|
||||
public void createColloFromEtichettaAnonima(BarcodeScanDTO barcodeScanDTO, GestioneEnum gestione, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
createColloFromEtichettaAnonima(barcodeScanDTO.getStringValue(), gestione, onComplete, onFailed);
|
||||
}
|
||||
@@ -245,11 +243,16 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
public void createColloFromEtichettaAnonima(String barcode, GestioneEnum gestione, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
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;
|
||||
|
||||
if (customNumCollo != null) {
|
||||
@@ -397,7 +400,6 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
}, onFailed);
|
||||
}
|
||||
|
||||
|
||||
private void cyclicGetMultipleByTestate(@NotNull Iterator<MtbColt> sourceMtbColts, boolean onlyResiduo, ArrayList<MtbColt> resultMtbColt, Runnable onComplete, RunnableArgs<Exception> onAbort) {
|
||||
if (sourceMtbColts.hasNext()) {
|
||||
getByTestata(sourceMtbColts.next(), onlyResiduo, false, mtbColt -> {
|
||||
@@ -447,7 +449,6 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public void changePosizione(MtbColt mtbColtToMove, MtbDepoPosizione posizione, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
String codMdep = posizione.getCodMdep();
|
||||
@@ -543,7 +544,6 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
}, onFailed);
|
||||
}
|
||||
|
||||
|
||||
public static void retrieveBasketColli(RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||
colliMagazzinoRESTConsumerService.getColliInBasket(SettingsManager.i().getUserSession().getDepo().getCodMdep()).enqueue(new Callback<ServiceRESTResponse<List<MtbColt>>>() {
|
||||
@@ -589,38 +589,39 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
}
|
||||
|
||||
public void spostaArtsTraUL(MtbColt sourceMtbColt, MtbColt destMtbColt, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
MtbColt mtbColtToMoveClone = (MtbColt) sourceMtbColt.clone();
|
||||
MtbColt mtbColtDestClone = (MtbColt) destMtbColt.clone();
|
||||
new Thread(() -> {
|
||||
MtbColt mtbColtToMoveClone = (MtbColt) sourceMtbColt.clone();
|
||||
MtbColt mtbColtDestClone = (MtbColt) destMtbColt.clone();
|
||||
|
||||
for (int i = 0; i < mtbColtToMoveClone.getMtbColr().size(); i++) {
|
||||
mtbColtToMoveClone.getMtbColr().get(i)
|
||||
.setMtbAart(null)
|
||||
.setMtbPartitaMag(null);
|
||||
}
|
||||
|
||||
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);
|
||||
for (int i = 0; i < mtbColtToMoveClone.getMtbColr().size(); i++) {
|
||||
mtbColtToMoveClone.getMtbColr().get(i)
|
||||
.setMtbAart(null)
|
||||
.setMtbPartitaMag(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<Object>> call, Throwable t) {
|
||||
if (onFailed != null) onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
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
|
||||
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) {
|
||||
MtbColt sourceMtbColtClone = (MtbColt) sourceMtbColt.clone();
|
||||
|
||||
@@ -646,4 +647,57 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
});
|
||||
}
|
||||
|
||||
public void versamentoAutomaticoUL(MtbColt sourceMtbColt, RunnableArgs<VersamentoAutomaticoULResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
MtbColt sourceMtbColtClone = (MtbColt) sourceMtbColt.clone();
|
||||
|
||||
for (int i = 0; i < sourceMtbColtClone.getMtbColr().size(); i++) {
|
||||
sourceMtbColtClone.getMtbColr().get(i)
|
||||
.setMtbAart(null)
|
||||
.setMtbPartitaMag(null);
|
||||
}
|
||||
|
||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||
colliMagazzinoRESTConsumerService.versamentoAutomaticoUL(sourceMtbColtClone).enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<VersamentoAutomaticoULResponseDTO>> call, Response<ServiceRESTResponse<VersamentoAutomaticoULResponseDTO>> response) {
|
||||
analyzeAnswer(response, "versamentoAutomaticoUL", data -> {
|
||||
var result = response.body().getDto();
|
||||
|
||||
List<MtbColr> allMtbColr = new ArrayList<>();
|
||||
allMtbColr.addAll(result.getSuccess());
|
||||
allMtbColr.addAll(result.getFailed());
|
||||
|
||||
List<String> codMarts = Stream.of(allMtbColr)
|
||||
.map(x -> x.getCodMart().trim())
|
||||
.toList();
|
||||
|
||||
mArticoloRESTConsumer.getByCodMarts(codMarts, mtbAarts -> {
|
||||
for (var mtbColr : allMtbColr) {
|
||||
|
||||
MtbAart foundMtbAart = null;
|
||||
|
||||
Optional<MtbAart> mtbAartOpt = Stream.of(mtbAarts)
|
||||
.filter(x -> x.getCodMart().equalsIgnoreCase(mtbColr.getCodMart()))
|
||||
.findFirst();
|
||||
|
||||
if (mtbAartOpt.isPresent()) {
|
||||
foundMtbAart = mtbAartOpt.get();
|
||||
}
|
||||
|
||||
mtbColr.setMtbAart(foundMtbAart);
|
||||
}
|
||||
|
||||
onComplete.run(result);
|
||||
}, onFailed);
|
||||
|
||||
}, onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<VersamentoAutomaticoULResponseDTO>> call, Throwable t) {
|
||||
if (onFailed != null) onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import it.integry.integrywmsnative.core.rest.model.DistribuzioneColloDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.RettificaULDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.core.rest.model.SpostaArtsTraULRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.VersamentoAutomaticoULResponseDTO;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.http.Body;
|
||||
import retrofit2.http.GET;
|
||||
@@ -42,4 +43,7 @@ public interface ColliMagazzinoRESTConsumerService {
|
||||
@POST("wms/assegnaLottoSuColloScarico")
|
||||
Call<ServiceRESTResponse<MtbColt>> assegnaLottoSuColloScarico(@Body MtbColt mtbColt);
|
||||
|
||||
@POST("wms/versamentoAutomaticoUL")
|
||||
Call<ServiceRESTResponse<VersamentoAutomaticoULResponseDTO>> versamentoAutomaticoUL(@Body MtbColt mtbColt);
|
||||
|
||||
}
|
||||
|
||||
@@ -6,11 +6,11 @@ import java.util.List;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.model.StbGestSetup;
|
||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||
import it.integry.integrywmsnative.core.rest.model.GestSetupDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityLogger;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
@@ -35,18 +35,18 @@ public class GestSetupRESTConsumer extends _BaseRESTConsumer {
|
||||
public void onFailure(Call<ServiceRESTResponse<GestSetupDTO>> call, Throwable t) {
|
||||
Log.e("GestSetup", t.toString());
|
||||
// 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) {
|
||||
getValueStatic(gestName, sectionName, keySection, value -> {
|
||||
if(value != null){
|
||||
if (value != null) {
|
||||
onComplete.run("S".equalsIgnoreCase(value.value));
|
||||
} else onComplete.run(false);
|
||||
}, 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) {
|
||||
Log.e("PrintCollo", t.toString());
|
||||
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) {
|
||||
getValueStatic(gestName, sectionName, keySection, codMdep, value -> {
|
||||
if(value != null){
|
||||
if (value != null) {
|
||||
onComplete.run("S".equalsIgnoreCase(value.value));
|
||||
} else onComplete.run(false);
|
||||
}, 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) {
|
||||
GestSetupRESTConsumerService service = RESTBuilder.getService(GestSetupRESTConsumerService.class);
|
||||
service.getGestSetupValues(stbGestSetupList).enqueue(new Callback<ServiceRESTResponse<List<StbGestSetup>>>() {
|
||||
service.getGestSetupValues(stbGestSetupList).enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<List<StbGestSetup>>> call, Response<ServiceRESTResponse<List<StbGestSetup>>> response) {
|
||||
analyzeAnswer(response, "GestSetup", onComplete, onFailed);
|
||||
@@ -89,7 +89,7 @@ public class GestSetupRESTConsumer extends _BaseRESTConsumer {
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<List<StbGestSetup>>> call, Throwable t) {
|
||||
UtilityLogger.errorMe(new Exception(t));
|
||||
if(onFailed != null) onFailed.run(new Exception(t));
|
||||
if (onFailed != null) onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
package it.integry.integrywmsnative.core.rest.consumers;
|
||||
|
||||
import com.annimon.stream.Optional;
|
||||
import com.annimon.stream.Stream;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
||||
import it.integry.integrywmsnative.core.model.MvwSitArtUdcDetInventario;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityQuery;
|
||||
|
||||
@Singleton
|
||||
public class GiacenzaRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
private final SystemRESTConsumer mSystemRESTConsumer;
|
||||
private final ArticoloRESTConsumer mArticoloRESTConsumer;
|
||||
|
||||
public GiacenzaRESTConsumer(SystemRESTConsumer systemRESTConsumer, ArticoloRESTConsumer articoloRESTConsumer) {
|
||||
this.mSystemRESTConsumer = systemRESTConsumer;
|
||||
this.mArticoloRESTConsumer = articoloRESTConsumer;
|
||||
|
||||
}
|
||||
|
||||
public void getGiacenzeInPosizione(MtbDepoPosizione posizione, RunnableArgs<List<MvwSitArtUdcDetInventario>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
HashMap<String, Object> params = new HashMap<>();
|
||||
params.put("posizione", posizione.getPosizione());
|
||||
String whereCond = UtilityQuery.concatFieldsInWhereCond(params);
|
||||
String query = "SELECT * from mvw_sitart_udc_det_inventario" +
|
||||
" WHERE " + whereCond;
|
||||
|
||||
|
||||
Type typeOfObjectsList = new TypeToken<ArrayList<MvwSitArtUdcDetInventario>>() {
|
||||
}.getType();
|
||||
this.mSystemRESTConsumer.<ArrayList<MvwSitArtUdcDetInventario>>processSql(query, typeOfObjectsList, inventarioList -> {
|
||||
List<String> codMarts = Stream.of(inventarioList)
|
||||
.map(x -> x.getCodMart().trim())
|
||||
.toList();
|
||||
|
||||
mArticoloRESTConsumer.getByCodMarts(codMarts, mtbAarts -> {
|
||||
for (var row : inventarioList) {
|
||||
|
||||
MtbAart foundMtbAart = null;
|
||||
Optional<MtbAart> mtbAartOpt = Stream.of(mtbAarts)
|
||||
.filter(x -> x.getCodMart().equalsIgnoreCase(row.getCodMart()))
|
||||
.findFirst();
|
||||
|
||||
if (mtbAartOpt.isPresent()) {
|
||||
foundMtbAart = mtbAartOpt.get();
|
||||
}
|
||||
|
||||
row.setMtbAart(foundMtbAart);
|
||||
}
|
||||
|
||||
onComplete.run(inventarioList);
|
||||
}, onFailed);
|
||||
}, onFailed);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package it.integry.integrywmsnative.core.rest.consumers;
|
||||
|
||||
public interface GiacenzaRESTConsumerService {
|
||||
}
|
||||
@@ -93,7 +93,8 @@ public class OrdiniRESTConsumer extends _BaseRESTConsumer {
|
||||
&& (!UtilityString.isNullOrEmpty(x.getPartitaMag()) && x.getPartitaMag().equalsIgnoreCase(mtbColr.getPartitaMag())))
|
||||
.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);
|
||||
|
||||
service.getOrdiniInevasi(codMdep, gestione.getText())
|
||||
.enqueue(new Callback<ServiceRESTResponse<List<OrdineUscitaInevasoDTO>>>() {
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<List<OrdineUscitaInevasoDTO>>> call, Response<ServiceRESTResponse<List<OrdineUscitaInevasoDTO>>> response) {
|
||||
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)
|
||||
.map(x -> new GetPickingListDTO()
|
||||
.setData(x.getDataOrdS())
|
||||
@@ -157,10 +158,18 @@ public class OrdiniRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
OrdiniRESTConsumerService service = RESTBuilder.getService(OrdiniRESTConsumerService.class, 90);
|
||||
|
||||
service.getArticoliFromOrdini(getPickingListDTOs).enqueue(new Callback<ServiceRESTResponse<List<SitArtOrdDTO>>>() {
|
||||
service.getArticoliFromOrdini(codMdep, getPickingListDTOs).enqueue(new Callback<>() {
|
||||
@Override
|
||||
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
|
||||
@@ -182,13 +191,13 @@ public class OrdiniRESTConsumer extends _BaseRESTConsumer {
|
||||
}
|
||||
|
||||
String baseSql = "SELECT DISTINCT mtb_colt.* " +
|
||||
"FROM mtb_colt, " +
|
||||
" mtb_colr " +
|
||||
"WHERE mtb_colt.gestione = mtb_colr.gestione " +
|
||||
" AND mtb_colt.ser_collo = mtb_colr.ser_collo " +
|
||||
" AND mtb_colt.data_collo = mtb_colr.data_collo " +
|
||||
" AND mtb_colt.num_collo = mtb_colr.num_collo " +
|
||||
" AND " + whereCondGestione +
|
||||
"FROM mtb_colt " +
|
||||
" INNER JOIN mtb_colr ON " +
|
||||
" mtb_colt.gestione = mtb_colr.gestione " +
|
||||
" AND mtb_colt.ser_collo = mtb_colr.ser_collo " +
|
||||
" AND mtb_colt.data_collo = mtb_colr.data_collo " +
|
||||
" AND mtb_colt.num_collo = mtb_colr.num_collo " +
|
||||
" WHERE " + whereCondGestione +
|
||||
" AND mtb_colt.segno = " + UtilityDB.valueToString(segno) + " " +
|
||||
" AND mtb_colt.data_doc IS NULL AND ";
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ import retrofit2.http.Query;
|
||||
public interface OrdiniRESTConsumerService {
|
||||
|
||||
@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")
|
||||
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.util.ArrayList;
|
||||
import java.util.Date;
|
||||
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.Griglia;
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.Ordine;
|
||||
@@ -27,37 +30,47 @@ import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
|
||||
@Singleton
|
||||
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);
|
||||
ordiniARestService
|
||||
.getArticoliListino(codAlis)
|
||||
.enqueue(new Callback<ServiceRESTResponse<GrigliaDTO>>() {
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<GrigliaDTO>> call, Response<ServiceRESTResponse<GrigliaDTO>> response) {
|
||||
analyzeAnswer(response, "getArticoliListino", griglia -> {
|
||||
|
||||
UtilityThread.executeParallel(() -> {
|
||||
var startTime = new Date().getTime();
|
||||
|
||||
List<ArticoloDTO> listaArticoli = new ArrayList<>();
|
||||
|
||||
Stream.of(griglia.getGrigliaAcquistiChild())
|
||||
.map(ArticoloDTO::getCodMart)
|
||||
.distinct()
|
||||
.withoutNulls()
|
||||
.forEach(art -> {
|
||||
List<ArticoloDTO> inList = Stream.of(griglia.getGrigliaAcquistiChild()).filter(x -> x.getCodMart().equalsIgnoreCase(art)).toList();
|
||||
if (inList.size() > 1) {
|
||||
for (ArticoloDTO articolo : inList) {
|
||||
.groupBy(ArticoloDTO::getCodMart)
|
||||
.forEach(entry -> {
|
||||
|
||||
if (entry.getValue().size() == 1) {
|
||||
listaArticoli.add(entry.getValue().get(0));
|
||||
} else {
|
||||
for (ArticoloDTO articolo : entry.getValue()) {
|
||||
if (!articolo.getBarCode().endsWith(articolo.getCodMart())) {
|
||||
listaArticoli.add(articolo);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
listaArticoli.add(inList.get(0));
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
griglia.setGrigliaAcquistiChild(listaArticoli);
|
||||
|
||||
Log.d("LOADING TIME 1", "MS: " + (new Date().getTime() - startTime));
|
||||
onSuccess.run(griglia);
|
||||
}, false);
|
||||
}, 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();
|
||||
OrdineDTO ordineDTO = new OrdineDTO();
|
||||
List<ArtDTO> artRows = new ArrayList<>();
|
||||
@@ -80,7 +93,7 @@ public class PVOrdiniAcquistoRESTConsumer extends _BaseRESTConsumer {
|
||||
int i = 0;
|
||||
for (ArticoloOrdine art : articoli) {
|
||||
i++;
|
||||
artRows.add(convertArtToDTO(art,i));
|
||||
artRows.add(convertArtToDTO(art, i));
|
||||
}
|
||||
|
||||
ordineDTO.setChiaveGriglia(griglia.getCodAlis());
|
||||
@@ -96,9 +109,9 @@ public class PVOrdiniAcquistoRESTConsumer extends _BaseRESTConsumer {
|
||||
.enqueue(new Callback<List<ServiceRESTResponse<DtbOrdt>>>() {
|
||||
@Override
|
||||
public void onResponse(Call<List<ServiceRESTResponse<DtbOrdt>>> call, Response<List<ServiceRESTResponse<DtbOrdt>>> response) {
|
||||
if (response.body() != null && response.body().size() > 0){
|
||||
analyzeListOfAnswers(response, "getArticoliListino", dtoList-> {
|
||||
if (dtoList.size() > 0){
|
||||
if (response.body() != null && response.body().size() > 0) {
|
||||
analyzeListOfAnswers(response, "getArticoliListino", dtoList -> {
|
||||
if (dtoList.size() > 0) {
|
||||
DtbOrdt dto = dtoList.get(0);
|
||||
ordine.setTransmitted(true);
|
||||
ordine.setTransmissionDate(UtilityDate.getDateInstance());
|
||||
@@ -107,7 +120,7 @@ public class PVOrdiniAcquistoRESTConsumer extends _BaseRESTConsumer {
|
||||
ordine.setCodMdep(dto.getCodMdep());
|
||||
ordine.setNumOrd(dto.getNumOrd());
|
||||
onSuccess.run(ordine);
|
||||
}else{
|
||||
} else {
|
||||
onFailed.run(new Exception("Nessun ordine generato"));
|
||||
}
|
||||
}, onFailed);
|
||||
@@ -115,7 +128,7 @@ public class PVOrdiniAcquistoRESTConsumer extends _BaseRESTConsumer {
|
||||
}
|
||||
|
||||
@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());
|
||||
UtilityLogger.errorMe(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();
|
||||
dto.setRigaOrd(rigaOrd);
|
||||
dto.setCodMart(art.getCodMart());
|
||||
@@ -134,6 +146,7 @@ public class PVOrdiniAcquistoRESTConsumer extends _BaseRESTConsumer {
|
||||
dto.setDescrizione(art.getDescrizione());
|
||||
dto.setDataInsD(art.getDataIns());
|
||||
dto.setUntMis(art.getUntMis());
|
||||
dto.setSystemNote(art.getSystemNote());
|
||||
dto.setQta(BigDecimal.valueOf(art.getQtaOrd()));
|
||||
dto.setQtaCnf(BigDecimal.valueOf(art.getQtaCnf()));
|
||||
dto.setColli(BigDecimal.ZERO);
|
||||
|
||||
@@ -53,7 +53,7 @@ public class PosizioniRESTConsumer extends _BaseRESTConsumer{
|
||||
String codMdep = null;
|
||||
|
||||
PosizioniRESTConsumerService posizioniRESTConsumerService = RESTBuilder.getService(PosizioniRESTConsumerService.class);
|
||||
posizioniRESTConsumerService.getAvailablePosizioni(codMdep).enqueue(new Callback<ServiceRESTResponse<List<MtbDepoPosizione>>>() {
|
||||
posizioniRESTConsumerService.getAvailablePosizioni(codMdep).enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<List<MtbDepoPosizione>>> call, Response<ServiceRESTResponse<List<MtbDepoPosizione>>> response) {
|
||||
analyzeAnswer(response, "getAvailablePosizioni", (m) -> {
|
||||
|
||||
@@ -9,16 +9,18 @@ import java.util.List;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import it.integry.integrywmsnative.BuildConfig;
|
||||
import it.integry.integrywmsnative.core.exception.NoPrintersFoundException;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
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.model.JasperDTO;
|
||||
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.utility.UtilityLogger;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
import it.integry.integrywmsnative.gest.spedizione.model.PrintOrderCloseDTO;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
@@ -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) {
|
||||
// onComplete.run();
|
||||
@@ -64,10 +66,7 @@ public class PrinterRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
PrinterRESTConsumerService printerService = RESTBuilder.getService(PrinterRESTConsumerService.class);
|
||||
Call<ServiceRESTResponse<Object>> callable = null;
|
||||
if (printerType != null)
|
||||
callable = printerService.printCollo(printerType.toString(), testataColloToPrint);
|
||||
else
|
||||
callable = printerService.printCollo(testataColloToPrint);
|
||||
callable = printerService.printCollo(testataColloToPrint);
|
||||
|
||||
callable.enqueue(new Callback<>() {
|
||||
@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(PrintOrderCloseDTO dto, String codMdep, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
PrinterRESTConsumerService printerService = RESTBuilder.getService(PrinterRESTConsumerService.class, 240);
|
||||
Call<ServiceRESTResponse<Object>> callable = printerService.printClosedOrders(codMdep, dto);
|
||||
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));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -4,7 +4,9 @@ import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
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.gest.spedizione.model.PrintOrderCloseDTO;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.http.Body;
|
||||
import retrofit2.http.POST;
|
||||
@@ -26,11 +28,9 @@ public interface PrinterRESTConsumerService {
|
||||
@Body JasperDTO jasperDTO
|
||||
);
|
||||
|
||||
|
||||
@POST("wms/printEtichettaSSCC")
|
||||
Call<ServiceRESTResponse<Object>> printCollo(
|
||||
@Query("printerType") String printerType,
|
||||
@Body MtbColt mtbColtToPrint
|
||||
@POST("printReportType")
|
||||
Call<ServiceRESTResponse<Object>> printReportType(
|
||||
@Body ReportTypeDTO reportTypeDTO
|
||||
);
|
||||
|
||||
@POST("wms/printEtichettaSSCC")
|
||||
@@ -38,4 +38,10 @@ public interface PrinterRESTConsumerService {
|
||||
@Body MtbColt mtbColtToPrint
|
||||
);
|
||||
|
||||
@POST("wms/printClosedOrders")
|
||||
Call<ServiceRESTResponse<Object>> printClosedOrders(
|
||||
@Query("codMdep") String codMdep,
|
||||
@Body PrintOrderCloseDTO printOrderCloseDTO
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
package it.integry.integrywmsnative.core.rest.consumers;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.gest.prod_linee_produzione.dto.ProdLineStatusDTO;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
|
||||
@Singleton
|
||||
public class ProductionLinesRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
public void avviaLineaDiProduzione(String codJfas, Integer hrNum, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ProductionLinesRESTConsumerService restService = RESTBuilder.getService(ProductionLinesRESTConsumerService.class);
|
||||
Call<ServiceRESTResponse<JsonObject>> callable = restService.avviaLineaDiProduzione(codJfas, hrNum);
|
||||
callable.enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<JsonObject>> call, Response<ServiceRESTResponse<JsonObject>> response) {
|
||||
analyzeAnswer(response, "avviaLineaDiProduzione", data -> {
|
||||
onComplete.run();
|
||||
}, onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<JsonObject>> call, Throwable t) {
|
||||
onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void arrestaLineaDiProduzione(String codJfas, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ProductionLinesRESTConsumerService restService = RESTBuilder.getService(ProductionLinesRESTConsumerService.class);
|
||||
Call<ServiceRESTResponse<JsonObject>> callable = restService.arrestaLineaDiProduzione(codJfas);
|
||||
callable.enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<JsonObject>> call, Response<ServiceRESTResponse<JsonObject>> response) {
|
||||
analyzeAnswer(response, "arrestaLineaDiProduzione", data -> {
|
||||
onComplete.run();
|
||||
}, onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<JsonObject>> call, Throwable t) {
|
||||
onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void avviaProduzioneArticoloSuLinea(String codJfas, String codMart, String partitaMag, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ProductionLinesRESTConsumerService restService = RESTBuilder.getService(ProductionLinesRESTConsumerService.class, 300);
|
||||
Call<ServiceRESTResponse<JsonObject>> callable = restService.avviaProduzioneArticoloSuLinea(codJfas, codMart, partitaMag);
|
||||
callable.enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<JsonObject>> call, Response<ServiceRESTResponse<JsonObject>> response) {
|
||||
analyzeAnswer(response, "avviaProduzioneArticoloSuLinea", data -> {
|
||||
onComplete.run();
|
||||
}, onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<JsonObject>> call, Throwable t) {
|
||||
onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void getStatoLinee(String codMdep, RunnableArgs<List<ProdLineStatusDTO>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ProductionLinesRESTConsumerService restService = RESTBuilder.getService(ProductionLinesRESTConsumerService.class);
|
||||
Call<ServiceRESTResponse<List<ProdLineStatusDTO>>> callable = restService.getStatoLinee(codMdep);
|
||||
callable.enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<List<ProdLineStatusDTO>>> call, Response<ServiceRESTResponse<List<ProdLineStatusDTO>>> response) {
|
||||
analyzeAnswer(response, "getStatoLinee", onComplete::run, onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<List<ProdLineStatusDTO>>> call, Throwable t) {
|
||||
onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package it.integry.integrywmsnative.core.rest.consumers;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.gest.prod_linee_produzione.dto.ProdLineStatusDTO;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.POST;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
public interface ProductionLinesRESTConsumerService {
|
||||
|
||||
@POST("mes_v2/avviaLineaDiProduzione")
|
||||
Call<ServiceRESTResponse<JsonObject>> avviaLineaDiProduzione(@Query("codJfas") String codJfas, @Query("hrNum") Integer hrNum);
|
||||
|
||||
@POST("mes_v2/arrestaLineaDiProduzione")
|
||||
Call<ServiceRESTResponse<JsonObject>> arrestaLineaDiProduzione(@Query("codJfas") String codJfas);
|
||||
|
||||
@POST("mes_v2/avviaProduzioneArticoloSuLinea")
|
||||
Call<ServiceRESTResponse<JsonObject>> avviaProduzioneArticoloSuLinea(@Query("codJfas") String codJfas, @Query("codMart") String codMart, @Query("partitaMag") String partitaMag);
|
||||
|
||||
@GET("mes_v2/statoLineeProd")
|
||||
Call<ServiceRESTResponse<List<ProdLineStatusDTO>>> getStatoLinee(@Query("codMdep") String codMdep);
|
||||
}
|
||||
@@ -4,6 +4,9 @@ import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonDeserializer;
|
||||
import com.google.gson.JsonParseException;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.orhanobut.logger.Logger;
|
||||
|
||||
@@ -12,21 +15,25 @@ import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.Reader;
|
||||
import java.lang.reflect.Type;
|
||||
import java.net.ConnectException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import it.integry.integrywmsnative.BuildConfig;
|
||||
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.model.Azienda;
|
||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||
import it.integry.integrywmsnative.core.rest.model.AvailableCodMdepsDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.MailRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.NativeSqlRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.model.Azienda;
|
||||
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.UtilityString;
|
||||
import retrofit2.Call;
|
||||
@@ -42,27 +49,43 @@ public class SystemRESTConsumer extends _BaseRESTConsumer {
|
||||
nativeSqlDTO.nativeSql = nativeSql;
|
||||
|
||||
SystemRESTConsumerService service = RESTBuilder.getService(SystemRESTConsumerService.class);
|
||||
service.processSql(nativeSqlDTO).enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) {
|
||||
analyzeAnswer(response, "ProcessSql", o -> {
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(o);
|
||||
service
|
||||
.processSql(nativeSqlDTO)
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) {
|
||||
analyzeAnswer(response, "ProcessSql", o -> {
|
||||
Gson gson = new GsonBuilder()
|
||||
.registerTypeAdapter(Date.class, (JsonDeserializer<?>) (json, typeOfT, context) -> {
|
||||
try {
|
||||
return UtilityDate.recognizeDate(json.getAsString());
|
||||
} catch (Exception e) {
|
||||
throw new JsonParseException(e);
|
||||
}
|
||||
})
|
||||
.create();
|
||||
|
||||
InputStream ims = new ByteArrayInputStream(json.getBytes());
|
||||
Reader reader = new InputStreamReader(ims);
|
||||
T gsonObj = gson.fromJson(reader, clazz);
|
||||
|
||||
onComplete.run(gsonObj);
|
||||
}, onFailed);
|
||||
}
|
||||
String json = gson.toJson(o);
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<Object>> call, Throwable t) {
|
||||
Logger.e(t, "ProcessSQL");
|
||||
onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
InputStream ims = new ByteArrayInputStream(json.getBytes());
|
||||
Reader reader = new InputStreamReader(ims);
|
||||
T gsonObj = gson.fromJson(reader, clazz);
|
||||
|
||||
onComplete.run(gsonObj);
|
||||
}, onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<Object>> call, Throwable t) {
|
||||
Logger.e(t, "ProcessSQL");
|
||||
|
||||
if (t instanceof ConnectException)
|
||||
onFailed.run(new InvalidConnectionException(RESTBuilder.getDefaultHost(), RESTBuilder.getDefaultPort(), t));
|
||||
else
|
||||
onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@@ -100,7 +123,11 @@ public class SystemRESTConsumer extends _BaseRESTConsumer {
|
||||
}
|
||||
|
||||
|
||||
public static void getAvailableCodMdeps(final RunnableArgs<List<AvailableCodMdepsDTO>> onSuccess, RunnableArgs<Exception> onFailed) {
|
||||
public void getAvailableCodMdeps(final RunnableArgs<List<AvailableCodMdepsDTO>> onSuccess, RunnableArgs<Exception> onFailed) {
|
||||
getAvailableCodMdepsStatic(onSuccess, onFailed);
|
||||
}
|
||||
|
||||
public static void getAvailableCodMdepsStatic(final RunnableArgs<List<AvailableCodMdepsDTO>> onSuccess, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
SystemRESTConsumerService service = RESTBuilder.getService(SystemRESTConsumerService.class);
|
||||
service.getAvailableCodMdeps().enqueue(new Callback<>() {
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.util.Log;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.exception.NotValidLicenseException;
|
||||
import it.integry.integrywmsnative.core.rest.CommonRESTException;
|
||||
import it.integry.integrywmsnative.core.rest.model.EsitoType;
|
||||
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 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) {
|
||||
if (response.isSuccessful()) {
|
||||
@@ -30,7 +31,6 @@ public class _BaseRESTConsumer {
|
||||
}
|
||||
} else {
|
||||
Log.e(logTitle, response.body().getErrorMessage());
|
||||
// callback.onFailed(new Exception(response.body().getErrorMessage()));
|
||||
onFailed.run(CommonRESTException.tryRecognizeException(response.body().getErrorMessage()));
|
||||
}
|
||||
} else {
|
||||
@@ -41,7 +41,9 @@ public class _BaseRESTConsumer {
|
||||
if (response.code() == 404) {
|
||||
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 + ")"));
|
||||
} else {
|
||||
} else if (response.code() == 550)
|
||||
onFailed.run(new NotValidLicenseException());
|
||||
else {
|
||||
Log.e(logTitle, "Status " + response.code() + ": " + response.message());
|
||||
onFailed.run(new Exception("Status " + response.code() + ": " + response.message()));
|
||||
}
|
||||
@@ -64,7 +66,7 @@ public class _BaseRESTConsumer {
|
||||
}
|
||||
} else {
|
||||
Log.e(logTitle, response.body().getErrorMessage());
|
||||
onFailed.run(new Exception(response.body().getErrorMessage()));
|
||||
onFailed.run(CommonRESTException.tryRecognizeException(response.body().getErrorMessage()));
|
||||
}
|
||||
} else {
|
||||
Log.e(logTitle, response.message());
|
||||
@@ -74,7 +76,9 @@ public class _BaseRESTConsumer {
|
||||
if (response.code() == 404) {
|
||||
Log.e(logTitle, "Errore " + response.code() + ": risorsa non trovata");
|
||||
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());
|
||||
onFailed.run(new Exception("Status " + response.code() + ": " + response.message()));
|
||||
}
|
||||
@@ -111,7 +115,9 @@ public class _BaseRESTConsumer {
|
||||
if (responseList.code() == 404) {
|
||||
Log.e(logTitle, "Errore " + responseList.code() + ": risorsa non trovata");
|
||||
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());
|
||||
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 codMdep;
|
||||
private boolean flagEnablePickManuale;
|
||||
private boolean flagEnableScanArt;
|
||||
private String codMgrp;
|
||||
private String descrizioneMgrp;
|
||||
private String codMsgr;
|
||||
@@ -145,6 +146,14 @@ public class SitArtOrdDTO {
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isFlagEnableScanArt() {
|
||||
return flagEnableScanArt;
|
||||
}
|
||||
|
||||
public SitArtOrdDTO setFlagEnableScanArt(boolean flagEnableScanArt) {
|
||||
this.flagEnableScanArt = flagEnableScanArt;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodMgrp() {
|
||||
return codMgrp;
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package it.integry.integrywmsnative.core.rest.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
|
||||
public class VersamentoAutomaticoULResponseDTO {
|
||||
|
||||
private List<MtbColr> success;
|
||||
private List<MtbColr> failed;
|
||||
|
||||
public List<MtbColr> getSuccess() {
|
||||
return success;
|
||||
}
|
||||
|
||||
public VersamentoAutomaticoULResponseDTO setSuccess(List<MtbColr> success) {
|
||||
this.success = success;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<MtbColr> getFailed() {
|
||||
return failed;
|
||||
}
|
||||
|
||||
public VersamentoAutomaticoULResponseDTO setFailed(List<MtbColr> failed) {
|
||||
this.failed = failed;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -30,23 +30,27 @@ public class ServerStatusChecker {
|
||||
private Runnable runnableCode = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if(shouldExecute && !UtilityString.isNullOrEmpty(SettingsManager.i().getServer().getHost())) {
|
||||
UtilityServer.isEmsApiAvailable(SettingsManager.i().getServer().getHost(), SettingsManager.i().getServer().getPort(), mInternalCallback);
|
||||
if (shouldExecute && !UtilityString.isNullOrEmpty(SettingsManager.i().getServer().getHost())) {
|
||||
UtilityServer.isEmsApiAvailable(
|
||||
SettingsManager.i().getServer().getHost(),
|
||||
SettingsManager.i().getServer().getPort(),
|
||||
() -> mInternalCallback.run(true),
|
||||
ex -> mInternalCallback.run(false));
|
||||
handler.postDelayed(this, MILLIS_DELAY);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public void addCallback(RunnableArgs<Boolean> callback){
|
||||
public void addCallback(RunnableArgs<Boolean> callback) {
|
||||
this.mCallback.add(callback);
|
||||
}
|
||||
|
||||
public void removeCallback(RunnableArgs<Boolean> callback){
|
||||
public void removeCallback(RunnableArgs<Boolean> callback) {
|
||||
this.mCallback.remove(callback);
|
||||
}
|
||||
|
||||
|
||||
public static void init(){
|
||||
public static void init() {
|
||||
instance.shouldExecute = true;
|
||||
|
||||
instance.handler.post(instance.runnableCode);
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
package it.integry.integrywmsnative.core.services.inventario;
|
||||
|
||||
import androidx.databinding.ObservableArrayList;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
||||
import it.integry.integrywmsnative.core.model.MvwSitArtUdcDetInventario;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.GiacenzaRESTConsumer;
|
||||
|
||||
@Singleton
|
||||
public class InventarioService {
|
||||
|
||||
private final GiacenzaRESTConsumer mGiacenzaRESTConsumer;
|
||||
|
||||
public InventarioService(GiacenzaRESTConsumer giacenzaRESTConsumer) {
|
||||
this.mGiacenzaRESTConsumer = giacenzaRESTConsumer;
|
||||
}
|
||||
|
||||
public void getInventarioDaPosizione(MtbDepoPosizione posizione, RunnableArgs<List<MvwSitArtUdcDetInventario>> onSuccess, RunnableArgs<Exception> onError) {
|
||||
mGiacenzaRESTConsumer.getGiacenzeInPosizione(posizione, onSuccess, onError);
|
||||
}
|
||||
|
||||
public void getInventarioDaPosizionePerArticolo(MtbDepoPosizione posizione, MtbAart articolo, RunnableArgs<List<MvwSitArtUdcDetInventario>> onSuccess, RunnableArgs<Exception> onError) {
|
||||
getInventarioDaPosizione(posizione, (inventario) -> {
|
||||
List<MvwSitArtUdcDetInventario> inventarioArticolo = Stream.of(inventario).filter(
|
||||
x -> articolo.getCodMart().equalsIgnoreCase(x.getCodMart())
|
||||
).toList();
|
||||
onSuccess.run(inventarioArticolo);
|
||||
}, onError);
|
||||
}
|
||||
|
||||
public MtbColt mapInventarioToMtbColt(MvwSitArtUdcDetInventario inventario) {
|
||||
return mapInventarioToMtbColt(inventario, true);
|
||||
}
|
||||
|
||||
public MtbColt mapInventarioToMtbColt(MvwSitArtUdcDetInventario inventario, boolean includeRows) {
|
||||
MtbColt mtbColt = new MtbColt();
|
||||
|
||||
mtbColt.setGestione(inventario.getGestione());
|
||||
mtbColt.setDataCollo(inventario.getDataCollo());
|
||||
mtbColt.setSerCollo(inventario.getSerCollo());
|
||||
mtbColt.setNumCollo(inventario.getNumCollo());
|
||||
mtbColt.setSegno(inventario.getSegno());
|
||||
mtbColt.setCodMdep(inventario.getCodMdep());
|
||||
mtbColt.setPosizione(inventario.getPosizione());
|
||||
mtbColt.setCodJcom(inventario.getCodJcom());
|
||||
mtbColt.setPesoNettoKg(inventario.getPesoNettoKg());
|
||||
mtbColt.setPesoKg(inventario.getPesoLordoKg());
|
||||
mtbColt.setCodJfas(inventario.getCodJfas());
|
||||
|
||||
if (includeRows) {
|
||||
ObservableArrayList<MtbColr> rows = new ObservableArrayList<>();
|
||||
rows.add(mapInventarioToMtbColr(inventario));
|
||||
mtbColt.setMtbColr(rows);
|
||||
}
|
||||
return mtbColt;
|
||||
}
|
||||
|
||||
public MtbColr mapInventarioToMtbColr(MvwSitArtUdcDetInventario inventario) {
|
||||
MtbColr mtbColr = new MtbColr();
|
||||
|
||||
mtbColr.setGestione(inventario.getGestione());
|
||||
mtbColr.setDataCollo(inventario.getDataCollo());
|
||||
mtbColr.setSerCollo(inventario.getSerCollo());
|
||||
mtbColr.setNumCollo(inventario.getNumCollo());
|
||||
mtbColr.setCodMart(inventario.getCodMart());
|
||||
mtbColr.setDescrizione(inventario.getDescrizioneEstesa());
|
||||
mtbColr.setPartitaMag(inventario.getPartitaMag());
|
||||
mtbColr.setCodJcom(inventario.getCodJcom());
|
||||
mtbColr.setUntMis(inventario.getUntMis());
|
||||
mtbColr.setQtaCol(inventario.getQtaCol());
|
||||
mtbColr.setNumCnf(inventario.getNumCnf());
|
||||
mtbColr.setQtaCnf(inventario.getQtaCnf());
|
||||
mtbColr.setPesoNettoKg(inventario.getPesoNettoKg());
|
||||
mtbColr.setPesoLordoKg(inventario.getPesoLordoKg());
|
||||
mtbColr.setMtbAart(inventario.getMtbAart());
|
||||
|
||||
|
||||
return mtbColr;
|
||||
}
|
||||
|
||||
public List<MtbColt> mapInventarioToMtbColtList(List<MvwSitArtUdcDetInventario> inventario) {
|
||||
return new ArrayList<>(Stream.of(inventario).groupBy(x -> x.getNumCollo() + "-" + x.getDataCollo() + "-" + x.getSerCollo() + x.getGestione()).map(inv -> {
|
||||
List<MvwSitArtUdcDetInventario> rows = inv.getValue();
|
||||
MtbColt mtbColt = mapInventarioToMtbColt(rows.get(0), false);
|
||||
ObservableArrayList<MtbColr> mtbColrs = new ObservableArrayList<>();
|
||||
mtbColrs.addAll(Stream.of(rows).map(this::mapInventarioToMtbColr).toList());
|
||||
mtbColt.setMtbColr(mtbColrs);
|
||||
return mtbColt;
|
||||
}).toList());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -3,10 +3,11 @@ package it.integry.integrywmsnative.core.settings;
|
||||
import java.util.ArrayList;
|
||||
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.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 {
|
||||
|
||||
@@ -15,14 +16,15 @@ public class DBSettingsModel {
|
||||
private List<MtbDepoPosizione> availablePosizioni = null;
|
||||
|
||||
private Azienda datiAzienda = null;
|
||||
private List<InternalCodAnagsDTO> internalCodAnags = null;
|
||||
|
||||
private boolean enableCheckPartitaMagCheckPickingV;
|
||||
private boolean flagMultiClienteOrdV;
|
||||
private String defaultCodAnag;
|
||||
private boolean flagUseCodAnagAziendale;
|
||||
private String defaultCausaleRettificaGiacenze;
|
||||
private DistribuzioneColloDTO.CriterioDistribuzione defaultCriterioDistribuzione;
|
||||
private boolean flagAskClienteInPickingLibero;
|
||||
private boolean flagAllowEmptyClienteInPickingLibero;
|
||||
private boolean flagPickLiberoAllowEmptyCliente;
|
||||
|
||||
private boolean flagCanAddExtraItemSpedizione;
|
||||
private boolean flagCanAutoOpenNewULAccettazione;
|
||||
@@ -36,9 +38,15 @@ public class DBSettingsModel {
|
||||
private boolean flagSpedizioneCanSelectMultipleOrders;
|
||||
private List<String> notePerditaDocInterni = new ArrayList<>();
|
||||
private boolean flagSpedizioneUseQtaOrd;
|
||||
private boolean flagOrdinaNuoviArticoliInGriglia;
|
||||
private boolean flagOrdinaArticoliOnScan;
|
||||
private String docInterniCheckFornitore;
|
||||
private String produzioneDefaultCodAnag;
|
||||
private String reportNameSpedizionChiudiOrdine;
|
||||
private boolean flagPrintPackingListOnOrderClose;
|
||||
private boolean flagPrintEtichetteOnOrderClose;
|
||||
private int onNumCnfInputChanged = 1;
|
||||
private boolean flagAccettazioneUseQtaOrd = false;
|
||||
private boolean flagPickLiberoAllowEmptyDest = false;
|
||||
|
||||
public boolean isFlagSpedizioneEnableFakeGiacenza() {
|
||||
return flagSpedizioneEnableFakeGiacenza;
|
||||
@@ -72,7 +80,16 @@ public class DBSettingsModel {
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -102,12 +119,12 @@ public class DBSettingsModel {
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDefaultCodAnag() {
|
||||
return defaultCodAnag;
|
||||
public boolean isFlagUseCodAnagAziendale() {
|
||||
return flagUseCodAnagAziendale;
|
||||
}
|
||||
|
||||
public DBSettingsModel setDefaultCodAnag(String defaultCodAnag) {
|
||||
this.defaultCodAnag = defaultCodAnag;
|
||||
public DBSettingsModel setFlagUseCodAnagAziendale(boolean flagUseCodAnagAziendale) {
|
||||
this.flagUseCodAnagAziendale = flagUseCodAnagAziendale;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -138,12 +155,12 @@ public class DBSettingsModel {
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isFlagAllowEmptyClienteInPickingLibero() {
|
||||
return flagAllowEmptyClienteInPickingLibero;
|
||||
public boolean isFlagPickLiberoAllowEmptyCliente() {
|
||||
return flagPickLiberoAllowEmptyCliente;
|
||||
}
|
||||
|
||||
public DBSettingsModel setFlagAllowEmptyClienteInPickingLibero(boolean flagAllowEmptyClienteInPickingLibero) {
|
||||
this.flagAllowEmptyClienteInPickingLibero = flagAllowEmptyClienteInPickingLibero;
|
||||
public DBSettingsModel setFlagPickLiberoAllowEmptyCliente(boolean flagPickLiberoAllowEmptyCliente) {
|
||||
this.flagPickLiberoAllowEmptyCliente = flagPickLiberoAllowEmptyCliente;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -247,6 +264,15 @@ public class DBSettingsModel {
|
||||
return this;
|
||||
}
|
||||
|
||||
public DBSettingsModel setFlagOrdinaNuoviArticoliInGriglia(boolean flagOrdinaNuoviArticoliInGriglia) {
|
||||
this.flagOrdinaNuoviArticoliInGriglia = flagOrdinaNuoviArticoliInGriglia;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean getFlagOrdinaNuoviArticoliInGriglia() {
|
||||
return this.flagOrdinaNuoviArticoliInGriglia;
|
||||
}
|
||||
|
||||
public String getProduzioneDefaultCodAnag() {
|
||||
return produzioneDefaultCodAnag;
|
||||
}
|
||||
@@ -256,12 +282,21 @@ public class DBSettingsModel {
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getReportNameSpedizionChiudiOrdine() {
|
||||
return reportNameSpedizionChiudiOrdine;
|
||||
public boolean isFlagPrintPackingListOnOrderClose() {
|
||||
return flagPrintPackingListOnOrderClose;
|
||||
}
|
||||
|
||||
public DBSettingsModel setReportNameSpedizionChiudiOrdine(String reportNameSpedizionChiudiOrdine) {
|
||||
this.reportNameSpedizionChiudiOrdine = reportNameSpedizionChiudiOrdine;
|
||||
public DBSettingsModel setFlagPrintPackingListOnOrderClose(boolean flagPrintPackingListOnOrderClose) {
|
||||
this.flagPrintPackingListOnOrderClose = flagPrintPackingListOnOrderClose;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isFlagPrintEtichetteOnOrderClose() {
|
||||
return flagPrintEtichetteOnOrderClose;
|
||||
}
|
||||
|
||||
public DBSettingsModel setFlagPrintEtichetteOnOrderClose(boolean flagPrintEtichetteOnOrderClose) {
|
||||
this.flagPrintEtichetteOnOrderClose = flagPrintEtichetteOnOrderClose;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -282,4 +317,41 @@ public class DBSettingsModel {
|
||||
this.notePerditaDocInterni = notePerditaDocInterni;
|
||||
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.google.firebase.perf.metrics.Trace;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.net.SocketTimeoutException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -13,6 +15,7 @@ import java.util.List;
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
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.PosizioniRESTConsumer;
|
||||
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!"));
|
||||
};
|
||||
|
||||
onProgress.run("dati azienda");
|
||||
loadDatiAzienda(() -> {
|
||||
|
||||
onProgress.run("profili");
|
||||
loadAvailableProfiles(() -> {
|
||||
onProgress.run("depositi");
|
||||
loadAvailableCodMdeps(() -> {
|
||||
|
||||
onProgress.run("depositi");
|
||||
loadAvailableCodMdeps(() -> {
|
||||
onProgress.run("posizioni");
|
||||
loadAvailablePosizioni(() -> {
|
||||
|
||||
onProgress.run("posizioni");
|
||||
loadAvailablePosizioni(() -> {
|
||||
onProgress.run("impostazioni");
|
||||
loadGestSetupValues(() -> {
|
||||
|
||||
onProgress.run("impostazioni");
|
||||
loadGestSetupValues(tmpOnComplete, tmpOnFailed);
|
||||
}, tmpOnFailed);
|
||||
onProgress.run("dati azienda");
|
||||
loadDatiAzienda(tmpOnComplete, tmpOnFailed);
|
||||
}, tmpOnFailed);
|
||||
}, tmpOnFailed);
|
||||
}, tmpOnFailed);
|
||||
@@ -113,7 +113,27 @@ public class SettingsManager {
|
||||
SystemRESTConsumer.getAzienda(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);
|
||||
}
|
||||
|
||||
@@ -130,7 +150,7 @@ public class SettingsManager {
|
||||
}
|
||||
|
||||
private static void loadAvailableCodMdeps(Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
SystemRESTConsumer.getAvailableCodMdeps(availableCodMdeps -> {
|
||||
SystemRESTConsumer.getAvailableCodMdepsStatic(availableCodMdeps -> {
|
||||
dbSettingsModelIstance.setAvailableCodMdep(availableCodMdeps);
|
||||
|
||||
if (availableCodMdeps == null || availableCodMdeps.size() == 0) {
|
||||
@@ -193,7 +213,7 @@ public class SettingsManager {
|
||||
stbGestSetupList.add(new StbGestSetup()
|
||||
.setGestName("PICKING")
|
||||
.setSection("SETUP")
|
||||
.setKeySection("COD_ANAG_DEFAULT"));
|
||||
.setKeySection("FLAG_USE_COD_ANAG_AZIENDALE"));
|
||||
stbGestSetupList.add(new StbGestSetup()
|
||||
.setGestName("PICKING")
|
||||
.setSection("SETUP")
|
||||
@@ -238,10 +258,6 @@ public class SettingsManager {
|
||||
.setGestName("PICKING")
|
||||
.setSection("PRODUZIONE")
|
||||
.setKeySection("FLAG_VERSAMENTO_DIRETTO"));
|
||||
stbGestSetupList.add(new StbGestSetup()
|
||||
.setGestName("PICKING")
|
||||
.setSection("PRODUZIONE")
|
||||
.setKeySection("DEFAULT_COD_ANAG"));
|
||||
stbGestSetupList.add(new StbGestSetup()
|
||||
.setGestName("PICKING")
|
||||
.setSection("SPEDIZIONE")
|
||||
@@ -254,10 +270,6 @@ public class SettingsManager {
|
||||
.setGestName("PICKING")
|
||||
.setSection("SPEDIZIONE")
|
||||
.setKeySection("FLAG_CAN_SELECT_MULTIPLE_ORDERS"));
|
||||
stbGestSetupList.add(new StbGestSetup()
|
||||
.setGestName("PICKING")
|
||||
.setSection("SPEDIZIONE")
|
||||
.setKeySection("REPORT_PACKING_LIST"));
|
||||
stbGestSetupList.add(new StbGestSetup()
|
||||
.setGestName("PICKING")
|
||||
.setSection("SPEDIZIONE")
|
||||
@@ -270,16 +282,36 @@ public class SettingsManager {
|
||||
.setGestName("PVM")
|
||||
.setSection("DOC_INTERNI")
|
||||
.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 -> {
|
||||
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.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.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.setFlagCanAutoOpenNewULAccettazione(getValueFromList(list, "ACCETTAZIONE", "FLAG_AUTO_OPEN_NEW_UL", Boolean.class));
|
||||
dbSettingsModelIstance.setFlagCanAddExtraQuantitySpedizione(getValueFromList(list, "SPEDIZIONE", "FLAG_CAN_ADD_EXTRA_QUANTITY", Boolean.class));
|
||||
@@ -288,14 +320,18 @@ public class SettingsManager {
|
||||
dbSettingsModelIstance.setFlagAskPesoColloSpedizione(getValueFromList(list, "SETUP", "FLAG_ASK_PESO_COLLO", 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.setProduzioneDefaultCodAnag(getValueFromList(list, "PRODUZIONE", "DEFAULT_COD_ANAG", String.class));
|
||||
dbSettingsModelIstance.setFlagSpedizioneEnableManualPick(getValueFromList(list, "SPEDIZIONE", "ENABLE_MANUAL_PICK", 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.setReportNameSpedizionChiudiOrdine(getValueFromList(list, "SPEDIZIONE", "REPORT_PACKING_LIST", String.class));
|
||||
dbSettingsModelIstance.setFlagSpedizioneUseQtaOrd(getValueFromList(list, "SPEDIZIONE", "FLAG_USE_QTA_ORD", Boolean.class));
|
||||
String notePerdita = getValueFromList(list,"DOC_INTERNI","NOTE_PERDITA",String.class);
|
||||
if (notePerdita != null){
|
||||
dbSettingsModelIstance.setFlagOrdinaNuoviArticoliInGriglia(getValueFromList(list, "ORDINI_A", "ORDINA_NUOVI_ARTICOLI", Boolean.class));
|
||||
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("\\|")));
|
||||
}
|
||||
|
||||
@@ -303,8 +339,14 @@ public class SettingsManager {
|
||||
if (onNumCnfInputChanged != null) {
|
||||
dbSettingsModelIstance.setOnNumCnfInputChanged(onNumCnfInputChanged);
|
||||
}
|
||||
|
||||
if (onComplete != null) onComplete.run();
|
||||
String codMdep = SettingsManager.i().getUserSession().getDepo().getCodMdep();
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
@@ -13,13 +13,19 @@ import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Created by akshay on 01/03/18.
|
||||
*/
|
||||
|
||||
public class Stash {
|
||||
|
||||
private static Stash stash;
|
||||
private static Context instance;
|
||||
private SharedPreferences sp;
|
||||
|
||||
public static void init(Context context) {
|
||||
stash = new Stash();
|
||||
instance = context;
|
||||
if (stash.sp == null) {
|
||||
stash.sp = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
}
|
||||
@@ -34,7 +40,7 @@ public class Stash {
|
||||
public static void put(String key, String value) {
|
||||
checkfornull();
|
||||
try {
|
||||
stash.sp.edit().putString(key, value).apply();
|
||||
stash.sp.edit().putString(key, value).commit();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -44,7 +50,7 @@ public class Stash {
|
||||
public static void put(String key, Set<String> value) {
|
||||
checkfornull();
|
||||
try {
|
||||
stash.sp.edit().putStringSet(key, value).apply();
|
||||
stash.sp.edit().putStringSet(key, value).commit();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -54,7 +60,7 @@ public class Stash {
|
||||
public static void put(String key, int value) {
|
||||
checkfornull();
|
||||
try {
|
||||
stash.sp.edit().putInt(key, value).apply();
|
||||
stash.sp.edit().putInt(key, value).commit();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -64,7 +70,7 @@ public class Stash {
|
||||
public static void put(String key, long value) {
|
||||
checkfornull();
|
||||
try {
|
||||
stash.sp.edit().putLong(key, value).apply();
|
||||
stash.sp.edit().putLong(key, value).commit();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -74,7 +80,7 @@ public class Stash {
|
||||
public static void put(String key, float value) {
|
||||
checkfornull();
|
||||
try {
|
||||
stash.sp.edit().putFloat(key, value).apply();
|
||||
stash.sp.edit().putFloat(key, value).commit();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -84,7 +90,7 @@ public class Stash {
|
||||
public static void put(String key, boolean value) {
|
||||
checkfornull();
|
||||
try {
|
||||
stash.sp.edit().putBoolean(key, value).apply();
|
||||
stash.sp.edit().putBoolean(key, value).commit();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -95,7 +101,7 @@ public class Stash {
|
||||
checkfornull();
|
||||
try {
|
||||
Gson gson = new GsonBuilder().create();
|
||||
stash.sp.edit().putString(key, gson.toJson(value).toString()).apply();
|
||||
stash.sp.edit().putString(key, gson.toJson(value)).commit();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -112,18 +118,26 @@ public class Stash {
|
||||
}
|
||||
}
|
||||
|
||||
public static String getString(String key) {
|
||||
return getString(key, "");
|
||||
}
|
||||
|
||||
|
||||
//getStringSet
|
||||
public static Set<String> getStringSet(String key, Set<String> defaultvalue) {
|
||||
checkfornull();
|
||||
try {
|
||||
return getStringSet(key, defaultvalue);
|
||||
return stash.sp.getStringSet(key, defaultvalue);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return defaultvalue;
|
||||
}
|
||||
}
|
||||
|
||||
public static Set<String> getStringSet(String key) {
|
||||
return getStringSet(key, null);
|
||||
}
|
||||
|
||||
//getInt
|
||||
public static int getInt(String key, int defaultvalue) {
|
||||
checkfornull();
|
||||
@@ -135,6 +149,10 @@ public class Stash {
|
||||
}
|
||||
}
|
||||
|
||||
public static int getInt(String key) {
|
||||
return getInt(key, 0);
|
||||
}
|
||||
|
||||
//getLong
|
||||
public static long getLong(String key, long defaultvalue) {
|
||||
checkfornull();
|
||||
@@ -146,6 +164,10 @@ public class Stash {
|
||||
}
|
||||
}
|
||||
|
||||
public static long getLong(String key) {
|
||||
return getLong(key, (long) 0);
|
||||
}
|
||||
|
||||
//getFloat
|
||||
public static float getFloat(String key, float defaultvalue) {
|
||||
checkfornull();
|
||||
@@ -157,6 +179,10 @@ public class Stash {
|
||||
}
|
||||
}
|
||||
|
||||
public static float getFloat(String key) {
|
||||
return getFloat(key, 0.0f);
|
||||
}
|
||||
|
||||
//getBoolean
|
||||
public static boolean getBoolean(String key, boolean defaultvalue) {
|
||||
checkfornull();
|
||||
@@ -168,6 +194,10 @@ public class Stash {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean getBoolean(String key) {
|
||||
return getBoolean(key, false);
|
||||
}
|
||||
|
||||
//getObject
|
||||
public static <T> Object getObject(String key, Class<?> tClass) {
|
||||
checkfornull();
|
||||
@@ -196,7 +226,7 @@ public class Stash {
|
||||
public static void clear(String key) {
|
||||
checkfornull();
|
||||
try {
|
||||
stash.sp.edit().remove(key).apply();
|
||||
stash.sp.edit().remove(key).commit();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -206,12 +236,22 @@ public class Stash {
|
||||
public static void clearAll() {
|
||||
checkfornull();
|
||||
try {
|
||||
stash.sp.edit().clear().apply();
|
||||
stash.sp.edit().clear().commit();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void addListener(StashListener listener){
|
||||
checkfornull();
|
||||
stash.sp.registerOnSharedPreferenceChangeListener(listener);
|
||||
}
|
||||
|
||||
public static void removeListener(StashListener listener){
|
||||
checkfornull();
|
||||
stash.sp.unregisterOnSharedPreferenceChangeListener(listener);
|
||||
}
|
||||
|
||||
private static class GenericType implements ParameterizedType {
|
||||
|
||||
private Type type;
|
||||
@@ -238,4 +278,7 @@ public class Stash {
|
||||
// implement equals method too! (as per javadoc)
|
||||
}
|
||||
|
||||
}
|
||||
public interface StashListener extends SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.DownloadManager;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Environment;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.github.javiersantos.appupdater.AppUpdater;
|
||||
import com.github.javiersantos.appupdater.enums.Display;
|
||||
import com.github.javiersantos.appupdater.enums.UpdateFrom;
|
||||
|
||||
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.ClassRouter;
|
||||
import it.integry.integrywmsnative.core.class_router.interfaces.ICustomConfiguration;
|
||||
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 static void init(Activity context) {
|
||||
private AppCompatActivity mContext;
|
||||
|
||||
public void init(AppCompatActivity activityContext) {
|
||||
this.mContext = activityContext;
|
||||
|
||||
String suffix;
|
||||
ICustomConfiguration customConfiguration = ClassRouter.getInstance(ClassRouter.PATH.CUSTOM_CONFIGURATION);
|
||||
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";
|
||||
|
||||
|
||||
AppUpdater appUpdater = new AppUpdater(context)
|
||||
AppUpdater appUpdater = new AppUpdater(mContext)
|
||||
.setDisplay(Display.DIALOG)
|
||||
.setUpdateFrom(UpdateFrom.JSON)
|
||||
.setUpdateJSON(currentVersionUrl)
|
||||
.setButtonDoNotShowAgain(null)
|
||||
.setButtonUpdateClickListener((dialog, which) -> {
|
||||
installAPK(context, currentDownloadUrl);
|
||||
installAPK(currentDownloadUrl);
|
||||
});
|
||||
appUpdater.start();
|
||||
}
|
||||
|
||||
|
||||
private static void installAPK(Activity context, String downloadURL) {
|
||||
private void installAPK(String downloadURL) {
|
||||
|
||||
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
|
||||
final File file = new File(destination);
|
||||
if (file.exists())
|
||||
file.delete();
|
||||
var progressDialog = DialogProgressView.newInstance("Download", null, false);
|
||||
progressDialog.show(mContext.getSupportFragmentManager(), "tag");
|
||||
|
||||
//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
|
||||
request.setDestinationUri(uri);
|
||||
var fileDownloader = new FileDownloader()
|
||||
.setDestFolder(destination)
|
||||
.setUrlString(downloadURL)
|
||||
.setOnProgressUpdate(progress -> {
|
||||
mContext.runOnUiThread(() -> {
|
||||
progressDialog.setProgress(progress);
|
||||
});
|
||||
})
|
||||
.setOnDownloadCompleted(destPath -> {
|
||||
|
||||
// get download service and enqueue file
|
||||
final DownloadManager manager = (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE);
|
||||
manager.enqueue(request);
|
||||
mContext.runOnUiThread(() -> {
|
||||
progressDialog.dismiss();
|
||||
|
||||
//set BroadcastReceiver to install app when .apk is downloaded
|
||||
BroadcastReceiver onComplete = new BroadcastReceiver() {
|
||||
public void onReceive(Context ctxt, Intent i) {
|
||||
Uri fileLoc;
|
||||
Intent intent;
|
||||
|
||||
Uri fileLoc;
|
||||
Intent intent;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
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 = new Intent(Intent.ACTION_INSTALL_PACKAGE);
|
||||
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");
|
||||
intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
|
||||
intent.setDataAndType(fileLoc, "application/vnd.android.package-archive");
|
||||
intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
mContext.startActivity(intent);
|
||||
});
|
||||
|
||||
context.startActivity(intent);
|
||||
});
|
||||
|
||||
|
||||
new Thread(() -> {
|
||||
try {
|
||||
fileDownloader.download();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
};
|
||||
|
||||
//register receiver for when .apk download is compete
|
||||
context.registerReceiver(onComplete, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE));
|
||||
}).start();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.content.pm.PackageManager;
|
||||
import android.os.Build;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import it.integry.integrywmsnative.SplashActivity;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
|
||||
@@ -31,6 +30,11 @@ public class PermissionsHelper {
|
||||
if(Build.VERSION.SDK_INT >= 23) {
|
||||
//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()];
|
||||
permissionsToAsk.toArray(permissionArray);
|
||||
|
||||
@@ -13,10 +13,10 @@ public class UtilityBarcode {
|
||||
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
@@ -28,10 +28,14 @@ public class UtilityBarcode {
|
||||
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);
|
||||
}
|
||||
|
||||
public static boolean isEan128(BarcodeScanDTO barcodeScanDTO) {
|
||||
return barcodeScanDTO != null && barcodeScanDTO.getType() == BarcodeType.EAN128;
|
||||
}
|
||||
|
||||
public static boolean isEtichettaPosizione(BarcodeScanDTO barcodeScanDTO) {
|
||||
return isEtichettaPosizione(barcodeScanDTO, true);
|
||||
}
|
||||
@@ -42,12 +46,12 @@ public class UtilityBarcode {
|
||||
String barcode = barcodeScanDTO.getStringValue();
|
||||
boolean isPosizione = false;
|
||||
|
||||
if(SettingsManager.iDB().getAvailablePosizioni() != null) {
|
||||
if (SettingsManager.iDB().getAvailablePosizioni() != null) {
|
||||
Stream<MtbDepoPosizione> tmpStream = Stream.of(SettingsManager.iDB().getAvailablePosizioni())
|
||||
.filter(x -> x.getPosizione().equalsIgnoreCase(barcode) && (!enableCheckCodMdep || currentCodMdep.equalsIgnoreCase(x.getCodMdep())));
|
||||
|
||||
if(tmpStream.count() > 0){
|
||||
isPosizione = true;
|
||||
if (tmpStream.count() > 0) {
|
||||
isPosizione = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +63,6 @@ public class UtilityBarcode {
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static boolean isEanPeso(BarcodeScanDTO barcodeScanDTO) {
|
||||
return (isEtichetta128(barcodeScanDTO) || isEan13(barcodeScanDTO)) && barcodeScanDTO.getStringValue().startsWith("2");
|
||||
}
|
||||
@@ -81,31 +84,31 @@ public class UtilityBarcode {
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static Integer getNumColloFromULAnonima(String barcode) {
|
||||
if(!UtilityString.isNullOrEmpty(barcode)) {
|
||||
public static Integer getNumColloFromULAnonima(String barcode) throws Exception {
|
||||
if (!UtilityString.isNullOrEmpty(barcode)) {
|
||||
barcode = barcode.trim();
|
||||
|
||||
return Integer.parseInt(barcode.substring(3));
|
||||
try {
|
||||
return Integer.parseInt(barcode.substring(3, 10));
|
||||
} catch (NumberFormatException nfex) {
|
||||
throw new Exception("Impossibile leggere il numero collo dal barcode: " + barcode);
|
||||
}
|
||||
} else
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static Integer getAnnoColloFromULAnonima(String barcode) {
|
||||
if(barcode != null){
|
||||
if (barcode != null) {
|
||||
return Integer.parseInt(barcode.substring(1, 3));
|
||||
} else
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static String convertITF14toEAN13(String barcodeITF14) {
|
||||
String barcodeEAN13 = null;
|
||||
|
||||
if(barcodeITF14.length() == 14) {
|
||||
if (barcodeITF14.length() == 14) {
|
||||
barcodeEAN13 = barcodeITF14.substring(1, barcodeITF14.length() - 1).trim();
|
||||
barcodeEAN13 += getEAN13CheckDigit(barcodeEAN13);
|
||||
}
|
||||
@@ -116,7 +119,7 @@ public class UtilityBarcode {
|
||||
public static String convertITF14toNeutral(String barcodeITF14) {
|
||||
String barcodeNeutral = null;
|
||||
|
||||
if(barcodeITF14.length() == 14) {
|
||||
if (barcodeITF14.length() == 14) {
|
||||
barcodeNeutral = barcodeITF14.substring(1, barcodeITF14.length() - 1);
|
||||
}
|
||||
|
||||
@@ -124,10 +127,10 @@ public class UtilityBarcode {
|
||||
}
|
||||
|
||||
|
||||
private static String getEAN13CheckDigit(String ean) {
|
||||
private static String getEAN13CheckDigit(String ean) {
|
||||
|
||||
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;
|
||||
}
|
||||
long tot = 0;
|
||||
@@ -135,7 +138,7 @@ public class UtilityBarcode {
|
||||
for (int i = 0; i < 12; i++) {
|
||||
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;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.text.Html;
|
||||
|
||||
@@ -12,18 +11,24 @@ import com.google.firebase.crashlytics.FirebaseCrashlytics;
|
||||
import com.orhanobut.logger.Logger;
|
||||
|
||||
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.view.dialogs.DialogProgressView;
|
||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||
|
||||
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);
|
||||
if (progressDialog != null) progressDialog.dismiss();
|
||||
if (progressDialog != null && progressDialog.isVisible()) progressDialog.dismiss();
|
||||
}
|
||||
|
||||
public static void defaultException(Context context, Exception ex) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user