Compare commits
149 Commits
v1.23.3(25
...
v1.26.3(28
| Author | SHA1 | Date | |
|---|---|---|---|
| 6539c9179e | |||
| f43a7acf35 | |||
| ca96bacde6 | |||
| d4c94b7ab9 | |||
| 0c9e607c33 | |||
| b5c6ce2aa5 | |||
| 66f58ea20d | |||
| d6979289e2 | |||
| 496387b5c6 | |||
| 6b0d75fc60 | |||
| 7d263699da | |||
| 63e4e4e791 | |||
| 98c260f621 | |||
| 1b57dc74cf | |||
| 4f140d0d58 | |||
| 0d021e6bad | |||
| 1a0af47613 | |||
| ead509bb32 | |||
| ddfde73f1e | |||
| 3de5a2320d | |||
| 5cb32a9a77 | |||
| ecbb4ac55c | |||
| 84e0561fff | |||
| 71bfbb2afc | |||
| 2cb563320b | |||
| f3837f35b0 | |||
| fa52b8e040 | |||
| c80b5a9160 | |||
| 65ac5590c7 | |||
| 3cee7f2a95 | |||
| 3034b49586 | |||
| 718ffb3124 | |||
| 7173c49561 | |||
| 4407f37f8c | |||
| 37a16f6292 | |||
| 83d9e0c5f7 | |||
| d2249e031a | |||
| 2522e67705 | |||
| 371514157c | |||
| de889045e6 | |||
| 6225ba8207 | |||
| 36c9319bce | |||
| d4d494218b | |||
| a3d6b11c69 | |||
| 852edf1b13 | |||
| 6806290d98 | |||
| 66f7a51462 | |||
| 0e1e69dc9a | |||
| 2ef24fe6e9 | |||
| 54c2d90334 | |||
| 577f2041a1 | |||
| 2f3e74fbfe | |||
| b0fa911322 | |||
| 473b9f22fb | |||
| cc1e1bf221 | |||
| a0c85b3fcb | |||
| 0f41bd99aa | |||
| 7a3a207462 | |||
| 7206b3c37e | |||
| 4cf8b6167f | |||
| b19b438489 | |||
| d3ee6d9ea3 | |||
| dd9789c4f3 | |||
| 67571e3d7a | |||
| a0e17f557d | |||
| 684946bb14 | |||
| 4aab6b1688 | |||
| 310a79f41d | |||
| f8164ca1eb | |||
| 790a9eae6c | |||
| b41edd314f | |||
| 34d8a93c01 | |||
| 3b45d8fe35 | |||
| aba1fcdc7b | |||
| 012d7caa52 | |||
| e7e20da206 | |||
| ef6535897b | |||
| 8c75ecbd0a | |||
| fad3c4243d | |||
| a6e75114cb | |||
| 48a83bc0d5 | |||
| b58475b426 | |||
| 207daab105 | |||
| c32da27b7f | |||
| 1f94c14634 | |||
| 4880ea8301 | |||
| a2d165d475 | |||
| d142f0c868 | |||
| 746838010a | |||
| a74d865c57 | |||
| 0a37323cef | |||
| b36b80eae0 | |||
| acb7727f3c | |||
| c16f5d2ddd | |||
| 4ca449d557 | |||
| da70d7c064 | |||
| 0be1eac5fe | |||
| e0eabbcbda | |||
| bd7b561b28 | |||
| 37c3a1ec76 | |||
| 62e69ad5bf | |||
| 3a6ba51a69 | |||
| 767088f1d0 | |||
| d0f6999dd8 | |||
| f88d7892bd | |||
| 3df5e406ef | |||
| 8e0728c2b4 | |||
| 0a2d47110d | |||
| 4ed8c825dd | |||
| 0a6d01628f | |||
| 453c8e0cad | |||
| ee43d1e985 | |||
| 86d472fb88 | |||
| 61c3458088 | |||
| 85c4768e51 | |||
| f1b4ce469e | |||
| 6071b3eb44 | |||
| 1d2bd20584 | |||
| 756389e6c6 | |||
| 4b19129a2f | |||
| f6aadf1115 | |||
| 3a5de50353 | |||
| cf3b8749dc | |||
| 34ff300515 | |||
| 0738993d4c | |||
| 9765fe1807 | |||
| 968e904715 | |||
| 90985b899b | |||
| d81e0dd72c | |||
| ee8751163c | |||
| 5476e9633e | |||
| 84d800a698 | |||
| eb39e1b7c5 | |||
| 57fa738c59 | |||
| bfc02a7d48 | |||
| e963e03c81 | |||
| f1c25a3673 | |||
| 90d5a8d43b | |||
| e1b4af2402 | |||
| 86c7be4e7d | |||
| 8686df3d8a | |||
| 6b04246f42 | |||
| 8e40092130 | |||
| b8dbde5ee1 | |||
| ae6d37e80d | |||
| 6dcc711006 | |||
| a616cb6022 | |||
| 837781389c | |||
| f23ff88878 |
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>
|
||||
|
||||
@@ -10,8 +10,8 @@ apply plugin: 'com.google.gms.google-services'
|
||||
|
||||
android {
|
||||
|
||||
def appVersionCode = 258
|
||||
def appVersionName = '1.23.3'
|
||||
def appVersionCode = 286
|
||||
def appVersionName = '1.26.3'
|
||||
|
||||
signingConfigs {
|
||||
release {
|
||||
@@ -78,11 +78,11 @@ android {
|
||||
}
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
abortOnError false
|
||||
}
|
||||
|
||||
dynamicFeatures = [":dynamic__base", ":dynamic_vgalimenti"]
|
||||
lint {
|
||||
abortOnError false
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -113,6 +113,7 @@ dependencies {
|
||||
implementation 'androidx.cardview:cardview:1.0.0'
|
||||
implementation 'androidx.recyclerview:recyclerview:1.2.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'
|
||||
@@ -138,7 +139,6 @@ 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'
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
implementation 'com.github.zhukic:sectioned-recyclerview:1.2.3'
|
||||
implementation 'com.github.pedromassango:doubleClick:3.0'
|
||||
|
||||
@@ -157,11 +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'
|
||||
|
||||
// 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"
|
||||
|
||||
@@ -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,6 +21,8 @@ import it.integry.integrywmsnative.gest.contab_doc_interni.dialog.DialogSelectDo
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dialog.DialogSelectDocInfoModule;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.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;
|
||||
@@ -45,6 +53,8 @@ import it.integry.integrywmsnative.gest.prod_versamento_materiale.ProdVersamento
|
||||
import it.integry.integrywmsnative.gest.prod_versamento_materiale.ProdVersamentoMaterialeModule;
|
||||
import it.integry.integrywmsnative.gest.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;
|
||||
@@ -59,6 +69,8 @@ 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;
|
||||
@@ -79,6 +91,9 @@ 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,
|
||||
@@ -110,10 +125,19 @@ 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
|
||||
})
|
||||
public interface MainApplicationComponent {
|
||||
|
||||
BaseActivityComponent.Factory baseActivityComponent();
|
||||
|
||||
BaseFragmentComponent.Factory baseFragmentComponent();
|
||||
|
||||
BaseDialogFragmentComponent.Factory baseDialogFragmentComponent();
|
||||
|
||||
SplashActivityComponent.Factory splashActivityComponent();
|
||||
|
||||
LoginComponent.Factory loginActivityComponent();
|
||||
@@ -148,6 +172,8 @@ public interface MainApplicationComponent {
|
||||
|
||||
OrdiniUscitaElencoComponent.Factory prodOrdineLavorazioneElencoComponent();
|
||||
|
||||
DialogAskClienteComponent.Factory dialogAskClienteComponent();
|
||||
|
||||
DialogInputQuantityV2Component.Factory dialogInputQuantityV2Component();
|
||||
|
||||
DialogInputLUProdComponent.Factory dialogInputLUProdComponent();
|
||||
@@ -182,10 +208,14 @@ public interface MainApplicationComponent {
|
||||
|
||||
DialogSelectDocInfoComponent.Factory dialogSelectMgrpDtipPairComponent();
|
||||
|
||||
DialogSelectDocRowsComponent.Factory dialogSelectDocRowsComponent();
|
||||
|
||||
DocInterniEditFormComponent.Factory docInterniEditFormComponent();
|
||||
|
||||
InfoAggiuntiveLUDialogComponent.Factory infoAggiuntiveLUDialogComponent();
|
||||
|
||||
DialogEditArticoloComponent.Factory dialogEditArticoloComponent();
|
||||
|
||||
void inject(MainApplication mainApplication);
|
||||
|
||||
void inject(AppContext mainApplication);
|
||||
|
||||
@@ -27,8 +27,11 @@ import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.PrinterRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.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 {
|
||||
@@ -71,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) {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -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;
|
||||
@@ -105,11 +112,41 @@ public class MtbColt extends EntityBase {
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
@@ -540,9 +577,41 @@ public class MtbColt extends EntityBase {
|
||||
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 (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);
|
||||
@@ -568,7 +637,8 @@ public class MtbColt extends EntityBase {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}*/
|
||||
whereCond = TextUtils.join(" OR ", conditions);
|
||||
|
||||
this.filtroOrdini = xmlPrefix + whereCond + xmlSuffix;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package it.integry.integrywmsnative.core.model.dto;
|
||||
|
||||
public class InternalCodAnagsDTO {
|
||||
|
||||
private String codAnag;
|
||||
private boolean isCliente;
|
||||
private boolean isFornitore;
|
||||
|
||||
public String getCodAnag() {
|
||||
return codAnag;
|
||||
}
|
||||
|
||||
public InternalCodAnagsDTO setCodAnag(String codAnag) {
|
||||
this.codAnag = codAnag;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isCliente() {
|
||||
return isCliente;
|
||||
}
|
||||
|
||||
public InternalCodAnagsDTO setCliente(boolean cliente) {
|
||||
isCliente = cliente;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isFornitore() {
|
||||
return isFornitore;
|
||||
}
|
||||
|
||||
public InternalCodAnagsDTO setFornitore(boolean fornitore) {
|
||||
isFornitore = fornitore;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package it.integry.integrywmsnative.core.report;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public enum ReportType {
|
||||
|
||||
@SerializedName("0")
|
||||
ETICHETTA_SSCC_ACCETTAZIONE(0),
|
||||
@SerializedName("1")
|
||||
ETICHETTA_SSCC_LAVORAZIONE(1),
|
||||
@SerializedName("2")
|
||||
ETICHETTA_SSCC_SPEDIZIONE(2),
|
||||
@SerializedName("3")
|
||||
WMS_SPEDIZIONE_ETICHETTE_SSCC_ORD(3),
|
||||
@SerializedName("4")
|
||||
WMS_SPEDIZIONE_PACKING_LIST_ORD(4),
|
||||
@SerializedName("5")
|
||||
STAMPA_LISTINI_VENDITA(5);
|
||||
|
||||
private final int value;
|
||||
|
||||
ReportType(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public static ReportType from(Object value) {
|
||||
int castValue = (int) value;
|
||||
for (ReportType b : ReportType.values()) {
|
||||
if (b.value == castValue)
|
||||
return b;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public int getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import java.net.SocketTimeoutException;
|
||||
import java.util.HashMap;
|
||||
|
||||
import 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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,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);
|
||||
@@ -123,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())
|
||||
@@ -176,9 +174,8 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
public void createColliScaricoDaOrdineLavorazione(MtbColt sourceMtbColt, MtbColr sourceMtbColr, MtbDepoPosizione posizione, List<OrdineLavorazioneDTO> ordini, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
MtbColt newMtbColt = new MtbColt()
|
||||
.initDefaultFields()
|
||||
.initDefaultFields(GestioneEnum.LAVORAZIONE)
|
||||
.setCodAnag(null)
|
||||
.setGestione(GestioneEnum.LAVORAZIONE)
|
||||
.setSegno(-1)
|
||||
.setCodTcol(sourceMtbColt.getCodTcol())
|
||||
// .setPesoKg(sourceMtbColt.getPesoKg())
|
||||
@@ -246,11 +243,16 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
public void createColloFromEtichettaAnonima(String barcode, GestioneEnum gestione, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
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) {
|
||||
@@ -587,35 +589,37 @@ 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) {
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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,13 +9,15 @@ 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.DtbOrdt;
|
||||
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;
|
||||
@@ -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(List<DtbOrdt> closedOrders, String codMdep, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
PrinterRESTConsumerService printerService = RESTBuilder.getService(PrinterRESTConsumerService.class, 240);
|
||||
Call<ServiceRESTResponse<Object>> callable = printerService.printClosedOrders(codMdep, closedOrders);
|
||||
callable.enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) {
|
||||
analyzeAnswer(response, "printCollo", data -> {
|
||||
onComplete.run();
|
||||
}, onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<Object>> call, Throwable t) {
|
||||
if (t.getMessage().contains("Printer not found")) {
|
||||
onFailed.run(new NoPrintersFoundException());
|
||||
} else onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -2,8 +2,10 @@ package it.integry.integrywmsnative.core.rest.consumers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.DtbOrdt;
|
||||
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 retrofit2.Call;
|
||||
import retrofit2.http.Body;
|
||||
@@ -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 List<DtbOrdt> closedOrders
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ 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;
|
||||
@@ -23,6 +24,7 @@ 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;
|
||||
@@ -47,37 +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 GsonBuilder()
|
||||
.registerTypeAdapter(Date.class, (JsonDeserializer) (json, typeOfT, context) -> {
|
||||
try {
|
||||
return UtilityDate.recognizeDate(json.getAsString());
|
||||
} catch (Exception e) {
|
||||
throw new JsonParseException(e);
|
||||
}
|
||||
})
|
||||
.create();
|
||||
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();
|
||||
|
||||
|
||||
String json = gson.toJson(o);
|
||||
String json = gson.toJson(o);
|
||||
|
||||
InputStream ims = new ByteArrayInputStream(json.getBytes());
|
||||
Reader reader = new InputStreamReader(ims);
|
||||
T gsonObj = gson.fromJson(reader, clazz);
|
||||
InputStream ims = new ByteArrayInputStream(json.getBytes());
|
||||
Reader reader = new InputStreamReader(ims);
|
||||
T gsonObj = gson.fromJson(reader, clazz);
|
||||
|
||||
onComplete.run(gsonObj);
|
||||
}, onFailed);
|
||||
}
|
||||
onComplete.run(gsonObj);
|
||||
}, onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<Object>> call, Throwable t) {
|
||||
Logger.e(t, "ProcessSQL");
|
||||
onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
@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));
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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")
|
||||
@@ -257,7 +273,11 @@ public class SettingsManager {
|
||||
stbGestSetupList.add(new StbGestSetup()
|
||||
.setGestName("PICKING")
|
||||
.setSection("SPEDIZIONE")
|
||||
.setKeySection("REPORT_PACKING_LIST"));
|
||||
.setKeySection("FLAG_PRINT_PACKING_LIST_ON_CLOSE"));
|
||||
stbGestSetupList.add(new StbGestSetup()
|
||||
.setGestName("PICKING")
|
||||
.setSection("SPEDIZIONE")
|
||||
.setKeySection("FLAG_PRINT_ETICHETTE_ON_CLOSE"));
|
||||
stbGestSetupList.add(new StbGestSetup()
|
||||
.setGestName("PICKING")
|
||||
.setSection("SPEDIZIONE")
|
||||
@@ -270,16 +290,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 +328,20 @@ 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.setFlagPrintPackingListOnOrderClose(getValueFromList(list, "SPEDIZIONE", "FLAG_PRINT_PACKING_LIST_ON_CLOSE", Boolean.class));
|
||||
// dbSettingsModelIstance.setFlagPrintEtichetteOnOrderClose(getValueFromList(list, "SPEDIZIONE", "FLAG_PRINT_ETICHETTE_ON_CLOSE", Boolean.class));
|
||||
dbSettingsModelIstance.setFlagSpedizioneUseQtaOrd(getValueFromList(list, "SPEDIZIONE", "FLAG_USE_QTA_ORD", Boolean.class));
|
||||
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 +349,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);
|
||||
|
||||
}
|
||||
|
||||
@@ -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,7 +28,7 @@ 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);
|
||||
}
|
||||
|
||||
@@ -42,12 +42,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 +59,6 @@ public class UtilityBarcode {
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static boolean isEanPeso(BarcodeScanDTO barcodeScanDTO) {
|
||||
return (isEtichetta128(barcodeScanDTO) || isEan13(barcodeScanDTO)) && barcodeScanDTO.getStringValue().startsWith("2");
|
||||
}
|
||||
@@ -81,31 +80,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 +115,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 +123,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 +134,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) {
|
||||
|
||||
@@ -8,7 +8,8 @@ public class UtilityFocus {
|
||||
|
||||
public static void focusTextBox(Context context, EditText editTextToFocus) {
|
||||
editTextToFocus.requestFocus();
|
||||
|
||||
editTextToFocus.setSelectAllOnFocus(true);
|
||||
editTextToFocus.selectAll();
|
||||
InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
imm.showSoftInput(editTextToFocus, InputMethodManager.SHOW_IMPLICIT);
|
||||
}
|
||||
|
||||
@@ -31,10 +31,13 @@ public class UtilityPosizione {
|
||||
}
|
||||
|
||||
public static MtbDepoPosizione getFromCache(String posizione) {
|
||||
List<MtbDepoPosizione> tmpList = Stream.of(SettingsManager.iDB().getAvailablePosizioni())
|
||||
var availablePosizioni = SettingsManager.iDB().getAvailablePosizioni();
|
||||
if(availablePosizioni == null) return null;
|
||||
|
||||
List<MtbDepoPosizione> tmpList = Stream.of(availablePosizioni)
|
||||
.filter(x -> x.getPosizione().equalsIgnoreCase(posizione)).toList();
|
||||
|
||||
if(tmpList != null && tmpList.size() > 0) return tmpList.get(0);
|
||||
if(tmpList.size() > 0) return tmpList.get(0);
|
||||
else return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,26 +1,16 @@
|
||||
package it.integry.integrywmsnative.core.utility;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
|
||||
import it.integry.integrywmsnative.view.dialogs.DialogProgress;
|
||||
import it.integry.integrywmsnative.view.dialogs.DialogProgressView;
|
||||
|
||||
public class UtilityProgress {
|
||||
|
||||
public static Dialog createDefaultProgressDialog(Context mContext) {
|
||||
// final ProgressDialog progress = ProgressDialog.show(mContext, mContext.getText(R.string.waiting),
|
||||
// mContext.getText(R.string.loading) + " ...", true);
|
||||
//
|
||||
// return progress;
|
||||
public static DialogProgressView createDefaultProgressDialog(FragmentActivity mContext) {
|
||||
var progress = DialogProgressView.newInstance();
|
||||
progress.show(mContext.getSupportFragmentManager(), "tag");
|
||||
return progress;
|
||||
}
|
||||
|
||||
Dialog progress = DialogProgress.make(mContext);
|
||||
progress.show();
|
||||
return progress;
|
||||
}
|
||||
public static Dialog createDefaultProgressDialog(Context mContext,String subtitle) {
|
||||
Dialog progress = DialogProgress.make(mContext,subtitle);
|
||||
progress.show();
|
||||
return progress;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,14 +5,16 @@ import java.net.InetSocketAddress;
|
||||
import java.net.Socket;
|
||||
import java.net.SocketAddress;
|
||||
|
||||
import it.integry.integrywmsnative.core.exception.NotValidLicenseException;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.gest.login.exception.ServerNotReachableException;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
|
||||
public class UtilityServer {
|
||||
|
||||
public static void isHostReachable(final String serverAddress, final int serverTCPport, final RunnableArgs<Boolean> callback){
|
||||
public static void isHostReachable(final String serverAddress, final int serverTCPport, final RunnableArgs<Boolean> callback) {
|
||||
new Thread(() -> {
|
||||
|
||||
boolean connected = false;
|
||||
@@ -36,7 +38,7 @@ public class UtilityServer {
|
||||
}).start();
|
||||
}
|
||||
|
||||
public static void isEmsApiAvailable(final String serverAddress, final int serverTCPport, final RunnableArgs<Boolean> callback) {
|
||||
public static void isEmsApiAvailable(final String serverAddress, final int serverTCPport, final Runnable onComplete, final RunnableArgs<Exception> onFailed) {
|
||||
new Thread(() -> {
|
||||
OkHttpClient client = new OkHttpClient();
|
||||
|
||||
@@ -46,11 +48,16 @@ public class UtilityServer {
|
||||
|
||||
try {
|
||||
Response response = client.newCall(request).execute();
|
||||
boolean status = response.isSuccessful();
|
||||
response.close();
|
||||
callback.run(status);
|
||||
|
||||
if (response.code() == 200) onComplete.run();
|
||||
else if (response.code() == 404)
|
||||
onFailed.run(new ServerNotReachableException(serverAddress, serverTCPport, null));
|
||||
else if (response.code() == 550)
|
||||
onFailed.run(new NotValidLicenseException());
|
||||
else onFailed.run(new Exception("Errore non identificato (STATUS: " + response.code() + ")"));
|
||||
} catch (IOException e) {
|
||||
callback.run(false);
|
||||
onFailed.run(new ServerNotReachableException(serverAddress, serverTCPport, e));
|
||||
}
|
||||
|
||||
}).start();
|
||||
|
||||
@@ -9,6 +9,7 @@ import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.widget.AppCompatTextView;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import androidx.databinding.ObservableArrayList;
|
||||
@@ -76,10 +77,23 @@ public class MainAccettazioneFragment extends BaseFragment implements ISearchabl
|
||||
mAppBarTitle.setText(context.getText(R.string.accettazione_title_fragment).toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(@NonNull Bundle outState) {
|
||||
onLoadingEnded();
|
||||
outState.putString("mToolbar", DataCache.addItem(mToolbar));
|
||||
|
||||
super.onSaveInstanceState(outState);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
|
||||
if(savedInstanceState != null && savedInstanceState.containsKey("mToolbar"))
|
||||
mToolbar = DataCache.retrieveItem(savedInstanceState.getString("mToolbar"));
|
||||
|
||||
mBinding = DataBindingUtil.inflate(inflater, R.layout.fragment_main_accettazione, container, false);
|
||||
|
||||
MainApplication.appComponent
|
||||
|
||||
@@ -44,7 +44,6 @@ import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.model.MtbTCol;
|
||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
import it.integry.integrywmsnative.core.report.ReportManager;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.PrinterRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.model.VersamentoAutomaticoULResponseDTO;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityBigDecimal;
|
||||
@@ -85,6 +84,9 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
|
||||
@Inject
|
||||
AccettazionePickingViewModel mViewModel;
|
||||
|
||||
@Inject
|
||||
DialogInputQuantityV2View mDialogInputQuantityV2View;
|
||||
|
||||
private final AccettazionePickingFiltroOrdineViewModel mAppliedFilterViewModel = new AccettazionePickingFiltroOrdineViewModel();
|
||||
|
||||
private BottomSheetFragmentLUContentViewModel mBottomSheetFragmentLUContentViewModel;
|
||||
@@ -141,9 +143,14 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
|
||||
this.initFilters();
|
||||
|
||||
String codMdep = SettingsManager.i().getUserSession().getDepo().getCodMdep();
|
||||
boolean useQtaOrd = SettingsManager.iDB().isFlagAccettazioneUseQtaOrd();
|
||||
|
||||
mViewModel.setListeners(this);
|
||||
mViewModel.init(mOrders, mSitArts, codMdep);
|
||||
mViewModel.init(
|
||||
mOrders,
|
||||
mSitArts,
|
||||
codMdep,
|
||||
useQtaOrd);
|
||||
}
|
||||
|
||||
private void initFilters() {
|
||||
@@ -295,7 +302,8 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
|
||||
|
||||
}
|
||||
|
||||
filterLayoutView.show(getSupportFragmentManager(), "TAG");
|
||||
if (!filterLayoutView.isAdded())
|
||||
filterLayoutView.show(getSupportFragmentManager(), "TAG");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -347,7 +355,7 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
|
||||
|
||||
private void initBarcodeReader() {
|
||||
barcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
||||
.setOnScanSuccessfull(onScanSuccessful)
|
||||
.setOnScanSuccessful(onScanSuccessful)
|
||||
.setOnScanFailed(ex -> UtilityExceptions.defaultException(this, ex, false)));
|
||||
}
|
||||
|
||||
@@ -680,13 +688,10 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
|
||||
}
|
||||
|
||||
private final RunnableArgs<BarcodeScanDTO> onScanSuccessful = data -> {
|
||||
BarcodeManager.disable();
|
||||
|
||||
this.openProgress();
|
||||
this.onLoadingStarted();
|
||||
|
||||
this.mViewModel.processBarcodeDTO(data, () -> {
|
||||
BarcodeManager.enable();
|
||||
this.closeProgress();
|
||||
this.onLoadingEnded();
|
||||
});
|
||||
};
|
||||
|
||||
@@ -697,11 +702,10 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
|
||||
|
||||
public void createNewLU() {
|
||||
this.mBindings.accettazioneOrdineInevasoFab.close(true);
|
||||
|
||||
this.openProgress();
|
||||
this.onLoadingStarted();
|
||||
|
||||
this.mViewModel.createNewLU(null, null, false, () -> {
|
||||
this.closeProgress();
|
||||
this.onLoadingEnded();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -728,7 +732,6 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
|
||||
Intent myIntent = ListaBancaliActivity.createIntent(this,
|
||||
Stream.of(mtbColts).map(x -> (MtbColt) x).toList(),
|
||||
input -> ((RecoverMtbColt) input).isFlagCanBeRecovered(),
|
||||
PrinterRESTConsumer.Type.SECONDARIA,
|
||||
ReportManager.getReportNameLUFromGestione(GestioneEnum.ACQUISTO));
|
||||
this.startActivityForResult(myIntent, PICK_UL_REQUEST);
|
||||
}
|
||||
@@ -748,7 +751,7 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
|
||||
|
||||
@Override
|
||||
public void onLUPrintError(Exception ex, Runnable onComplete) {
|
||||
this.closeProgress();
|
||||
this.onLoadingEnded();
|
||||
DialogSimpleMessageView.makeErrorDialog(
|
||||
new SpannableString(ex.getMessage()),
|
||||
null,
|
||||
@@ -758,16 +761,6 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
|
||||
.show(getSupportFragmentManager(), "tag");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadingStarted() {
|
||||
this.openProgress();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadingEnded() {
|
||||
this.closeProgress();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMtbColrEdit(MtbColr mtbColr) {
|
||||
this.mViewModel.dispatchRowEdit(mtbColr);
|
||||
@@ -800,7 +793,7 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
|
||||
|
||||
@Override
|
||||
public void onError(Exception ex) {
|
||||
this.closeProgress();
|
||||
this.onLoadingEnded();
|
||||
|
||||
if (ex instanceof InvalidPesoKGException) {
|
||||
UtilityToast.showToast(ex.getMessage());
|
||||
@@ -833,19 +826,20 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
|
||||
.setCanLUBeClosed(true)
|
||||
.setCanOverflowOrderQuantity(canOverflowQuantity);
|
||||
|
||||
DialogInputQuantityV2View
|
||||
.newInstance(dialogInputQuantityV2DTO, (resultDTO, shouldCloseLU) -> {
|
||||
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO()
|
||||
.setNumCnf(resultDTO.getNumCnf())
|
||||
.setQtaCnf(resultDTO.getQtaCnf())
|
||||
.setQtaTot(resultDTO.getQtaTot())
|
||||
.setPartitaMag(resultDTO.getPartitaMag())
|
||||
.setDataScad(resultDTO.getDataScad());
|
||||
onComplete.run(pickedQuantityDTO, shouldCloseLU);
|
||||
}, () -> {
|
||||
this.mViewModel.resetMatchedRows();
|
||||
})
|
||||
.show(getSupportFragmentManager(), "tag");
|
||||
if (!mDialogInputQuantityV2View.isVisible())
|
||||
mDialogInputQuantityV2View
|
||||
.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
|
||||
.setOnComplete((resultDTO, shouldCloseLU) -> {
|
||||
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO()
|
||||
.setNumCnf(resultDTO.getNumCnf())
|
||||
.setQtaCnf(resultDTO.getQtaCnf())
|
||||
.setQtaTot(resultDTO.getQtaTot())
|
||||
.setPartitaMag(resultDTO.getPartitaMag())
|
||||
.setDataScad(resultDTO.getDataScad());
|
||||
onComplete.run(pickedQuantityDTO, shouldCloseLU);
|
||||
})
|
||||
.setOnAbort(() -> this.mViewModel.resetMatchedRows())
|
||||
.show(getSupportFragmentManager(), "tag");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -73,6 +73,7 @@ public class AccettazionePickingViewModel {
|
||||
|
||||
private List<OrdineAccettazioneInevasoDTO> mOrders;
|
||||
private List<SitArtOrdDTO> mSitArts;
|
||||
private boolean mUseQtaOrd;
|
||||
private final MutableLiveData<List<PickingObjectDTO>> mPickingList = new MutableLiveData<>();
|
||||
|
||||
private MtbColt mCurrentMtbColt = null;
|
||||
@@ -97,9 +98,10 @@ public class AccettazionePickingViewModel {
|
||||
}
|
||||
|
||||
|
||||
public void init(List<OrdineAccettazioneInevasoDTO> orders, List<SitArtOrdDTO> sitArts, String codMdep) {
|
||||
public void init(List<OrdineAccettazioneInevasoDTO> orders, List<SitArtOrdDTO> sitArts, String codMdep, boolean useQtaOrd) {
|
||||
this.mOrders = orders;
|
||||
this.mDefaultCodMdep = codMdep;
|
||||
this.mUseQtaOrd = useQtaOrd;
|
||||
|
||||
this.mSitArts = Stream.of(sitArts)
|
||||
.filter(x -> UtilityBigDecimal.greaterThan(x.getNumCnfDaEvadere(), BigDecimal.ZERO) && UtilityBigDecimal.greaterThan(x.getQtaDaEvadere(), BigDecimal.ZERO))
|
||||
@@ -219,10 +221,16 @@ public class AccettazionePickingViewModel {
|
||||
if (!UtilityBarcode.isEtichettaAnonimaOfCurrentYear(barcodeScanDTO.getStringValue())) {
|
||||
this.sendError(new NotCurrentYearLUException());
|
||||
} else {
|
||||
int numCollo = -1;
|
||||
|
||||
this.createNewLU(
|
||||
UtilityBarcode.getNumColloFromULAnonima(barcodeScanDTO.getStringValue()),
|
||||
CommonConst.Config.DEFAULT_ANONYMOUS_UL_SERIE, true, onComplete);
|
||||
try {
|
||||
numCollo = UtilityBarcode.getNumColloFromULAnonima(barcodeScanDTO.getStringValue());
|
||||
this.createNewLU(
|
||||
numCollo,
|
||||
CommonConst.Config.DEFAULT_ANONYMOUS_UL_SERIE, true, onComplete);
|
||||
} catch (Exception ex) {
|
||||
this.sendError(ex);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.sendError(new AlreadyUsedAnonymousLabelException());
|
||||
@@ -315,12 +323,13 @@ public class AccettazionePickingViewModel {
|
||||
barcodeProd = UtilityBarcode.convertITF14toEAN13(barcodeProd);
|
||||
}
|
||||
|
||||
String finalBarcodeProd = barcodeProd;
|
||||
this.mArticoloRESTConsumer.getByBarcodeProd(barcodeProd, mtbAartList -> {
|
||||
|
||||
if (mtbAartList != null && mtbAartList.size() > 0) {
|
||||
this.searchArtFromAnag(mtbAartList.get(0), pickData, onComplete);
|
||||
} else {
|
||||
this.sendError(new NoResultFromBarcodeException());
|
||||
this.sendError(new NoResultFromBarcodeException(finalBarcodeProd));
|
||||
}
|
||||
|
||||
}, this::sendError);
|
||||
@@ -370,8 +379,7 @@ public class AccettazionePickingViewModel {
|
||||
|
||||
MtbColt mtbColt = new MtbColt();
|
||||
mtbColt
|
||||
.initDefaultFields()
|
||||
.setGestione(defaultGestioneOfUL)
|
||||
.initDefaultFields(defaultGestioneOfUL)
|
||||
.setAnnotazioni(additionalNotes)
|
||||
.setPosizione(defaultPosAccettazione)
|
||||
.setOperation(CommonModelConsts.OPERATION.INSERT_OR_UPDATE);
|
||||
@@ -536,7 +544,9 @@ public class AccettazionePickingViewModel {
|
||||
initialQtaTot = totalQtaOrd;
|
||||
}
|
||||
|
||||
if (UtilityBigDecimal.greaterThan(pickingObjectDTO.getMtbAart().getColliPedana(), BigDecimal.ZERO) && UtilityBigDecimal.greaterThan(initialNumCnf, pickingObjectDTO.getMtbAart().getColliPedana())) {
|
||||
if (!this.mUseQtaOrd &&
|
||||
UtilityBigDecimal.greaterThan(pickingObjectDTO.getMtbAart().getColliPedana(), BigDecimal.ZERO) &&
|
||||
UtilityBigDecimal.greaterThan(initialNumCnf, pickingObjectDTO.getMtbAart().getColliPedana())) {
|
||||
initialNumCnf = pickingObjectDTO.getMtbAart().getColliPedana();
|
||||
initialQtaTot = initialNumCnf.multiply(initialQtaCnf);
|
||||
}
|
||||
@@ -833,7 +843,6 @@ public class AccettazionePickingViewModel {
|
||||
cloneMtbColt.setGestione(cloneMtbColt.getGestioneEnum() == GestioneEnum.LAVORAZIONE ? GestioneEnum.PRODUZIONE : cloneMtbColt.getGestioneEnum());
|
||||
|
||||
this.mPrinterRESTConsumer.printCollo(
|
||||
PrinterRESTConsumer.Type.SECONDARIA,
|
||||
cloneMtbColt,
|
||||
() -> {
|
||||
this.sendLUSuccessfullyPrinted();
|
||||
|
||||
@@ -31,8 +31,8 @@ import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||
import it.integry.integrywmsnative.databinding.FragmentDocInterniBinding;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dialog.DialogSelectDocInfoView;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dialog.DialogSelectDocInfoViewModel;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.GrigliaAcquistiDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.DocInterniSetupDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.GrigliaAcquistiDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.DocInterniEditFormActivity;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.ui.DocInterniListAdapter;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.ui.DocInterniListModel;
|
||||
@@ -81,8 +81,8 @@ public class DocInterniFragment extends BaseFragment implements ITitledFragment,
|
||||
mBinding.setLifecycleOwner(this);
|
||||
mBinding.setView(this);
|
||||
mBinding.setViewModel(mViewModel);
|
||||
mViewModel.mtbGrup.observe(getViewLifecycleOwner(),mtbGrup-> mViewModel.fetchProducts());
|
||||
mViewModel.dtbTipi.observe(getViewLifecycleOwner(),dtbTipi-> mViewModel.fetchDocuments());
|
||||
mViewModel.mtbGrup.observe(getViewLifecycleOwner(), mtbGrup -> mViewModel.fetchProducts());
|
||||
mViewModel.dtbTipi.observe(getViewLifecycleOwner(), dtbTipi -> mViewModel.fetchDocuments());
|
||||
this.initRecyclerView();
|
||||
|
||||
return mBinding.getRoot();
|
||||
@@ -91,9 +91,9 @@ public class DocInterniFragment extends BaseFragment implements ITitledFragment,
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
if (!this.mViewModel.hasDocDetails()){
|
||||
if (!this.mViewModel.hasDocDetails()) {
|
||||
mViewModel.init();
|
||||
}else{
|
||||
} else {
|
||||
this.mViewModel.fetchDocuments();
|
||||
}
|
||||
}
|
||||
@@ -115,30 +115,30 @@ public class DocInterniFragment extends BaseFragment implements ITitledFragment,
|
||||
|
||||
@Override
|
||||
public void onDocDetailsChanged(DialogSelectDocInfoViewModel selection) {
|
||||
if(selection.isInputValid()){
|
||||
if (selection.isInputValid()) {
|
||||
mViewModel.setSelectedDocDetails(selection);
|
||||
mBinding.mainFab.setVisibility(View.VISIBLE);
|
||||
}else{
|
||||
} else {
|
||||
mBinding.mainFab.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if (selection.requiresFornitore()){
|
||||
if (selection.requiresFornitore()) {
|
||||
mBinding.codAnagContainer.setVisibility(View.VISIBLE);
|
||||
}else{
|
||||
} else {
|
||||
mBinding.codAnagContainer.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
|
||||
if (selection.getSelectedGruppoArt() != null){
|
||||
if (selection.getSelectedGruppoArt() != null) {
|
||||
mBinding.mtbGrpContainer.setVisibility(View.VISIBLE);
|
||||
}else{
|
||||
} else {
|
||||
mBinding.mtbGrpContainer.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if (selection.requiresDocData()){
|
||||
if (selection.requiresDocData()) {
|
||||
mBinding.docContainer.setVisibility(View.VISIBLE);
|
||||
mBinding.document.setText(Html.fromHtml(getString(R.string.doc_testata, String.valueOf(selection.getNumDoc()), UtilityDate.formatDate(selection.getDataDoc(), UtilityDate.COMMONS_DATE_FORMATS.DMY_HUMAN))));
|
||||
}else{
|
||||
} else {
|
||||
mBinding.docContainer.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@@ -155,7 +155,7 @@ public class DocInterniFragment extends BaseFragment implements ITitledFragment,
|
||||
}
|
||||
|
||||
public void selectDocInfo() {
|
||||
if (this.dialogInitialized){
|
||||
if (this.dialogInitialized) {
|
||||
DialogSelectDocInfoView.newInstance(
|
||||
mDocInterniSetupDTO,
|
||||
this.mViewModel.dtbTipi.getValue(),
|
||||
@@ -201,6 +201,6 @@ public class DocInterniFragment extends BaseFragment implements ITitledFragment,
|
||||
|
||||
@Override
|
||||
public void onDocumentEditRequest(SqlMtbColt document, GrigliaAcquistiDTO arts) {
|
||||
requireActivity().startActivity(DocInterniEditFormActivity.newInstance(requireActivity(),document,arts));
|
||||
requireActivity().startActivity(DocInterniEditFormActivity.newInstance(requireActivity(), document, arts, mViewModel.getTipoDoc()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,6 @@ package it.integry.integrywmsnative.gest.contab_doc_interni;
|
||||
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@@ -17,10 +15,10 @@ import it.integry.integrywmsnative.core.di.BindableInteger;
|
||||
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dialog.DialogSelectDocInfoViewModel;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.DocInterniSetupDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.FornitoreDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.GrigliaAcquistiDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.GruppiArticoloDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.DocInterniSetupDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.TipiDocDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.rest.DocInterniRESTConsumer;
|
||||
|
||||
@@ -91,7 +89,7 @@ public class DocInterniViewModel {
|
||||
this.numDoc.postValue(selection.getNumDoc());
|
||||
this.note.postValue(selection.getNote());
|
||||
|
||||
if (selection.getSelectedTipoDoc() != null ) {
|
||||
if (selection.getSelectedTipoDoc() != null) {
|
||||
this.dtbTipi.postValue(selection.getSelectedTipoDoc());
|
||||
}
|
||||
}
|
||||
@@ -114,11 +112,11 @@ public class DocInterniViewModel {
|
||||
this.sendOnLoadingStarted();
|
||||
String codAnag = null, codVdes = null;
|
||||
FornitoreDTO fornitore = this.fornitore.getValue();
|
||||
if (fornitore != null){
|
||||
if (fornitore != null) {
|
||||
codAnag = fornitore.getCodAnag();
|
||||
codVdes = fornitore.getCodVdes();
|
||||
}
|
||||
documentRepository.getLocalDocumentsByCodDtip(this.getCodDtip(), codAnag, codVdes, dataDoc.getValue(),numDoc.getValue(), list -> {
|
||||
documentRepository.getLocalDocumentsByCodDtip(this.getCodDtip(), codAnag, codVdes, dataDoc.getValue(), numDoc.getValue(), list -> {
|
||||
documentRepository.getNextNumCollo(nextNumCollo -> {
|
||||
this.mDocsList.postValue(list);
|
||||
this.setNextNumCollo(nextNumCollo);
|
||||
@@ -141,6 +139,13 @@ public class DocInterniViewModel {
|
||||
return this.dtbTipi.getValue().getCodDtip();
|
||||
}
|
||||
|
||||
public TipiDocDTO getTipoDoc() {
|
||||
if (this.dtbTipi.getValue() == null) {
|
||||
return null;
|
||||
}
|
||||
return this.dtbTipi.getValue();
|
||||
}
|
||||
|
||||
private String getCodMgrp() {
|
||||
if (this.mtbGrup.getValue() == null) {
|
||||
return null;
|
||||
@@ -168,10 +173,10 @@ public class DocInterniViewModel {
|
||||
document.setNumCollo(this.nextNumCollo);
|
||||
document.setGestione("L");
|
||||
document.setDataDoc(this.dataDoc.getValue());
|
||||
if (this.numDoc.getValue() != null){
|
||||
if (this.numDoc.getValue() != null) {
|
||||
document.setNumDoc(Integer.parseInt(this.numDoc.getValue()));
|
||||
}
|
||||
if (this.fornitore.getValue() != null){
|
||||
if (this.fornitore.getValue() != null) {
|
||||
document.setCodAnag(this.fornitore.getValue().getCodAnag());
|
||||
document.setCodVdes(this.fornitore.getValue().getCodVdes());
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ public class DialogSelectDocInfoViewModel {
|
||||
selectedDocType.getGestione().equalsIgnoreCase("V") ? "V" : "A"
|
||||
);
|
||||
} else {
|
||||
return forn.getTipoAnag().equalsIgnoreCase("F") ;
|
||||
return forn.getTipoAnag().equalsIgnoreCase("F");
|
||||
}
|
||||
})
|
||||
.map(FornitoreDTO::getLabel).toList();
|
||||
@@ -148,8 +148,7 @@ public class DialogSelectDocInfoViewModel {
|
||||
public boolean requiresNote() {
|
||||
return this.getSelectedTipoDoc() != null &&
|
||||
this.getSelectedTipoDoc().getGestioneDoc().equals("P") &&
|
||||
this.getSelectedTipoDoc().getGestione().equals("L")
|
||||
;
|
||||
this.getSelectedTipoDoc().getGestione().equals("L");
|
||||
}
|
||||
|
||||
public boolean isInputValid() {
|
||||
@@ -161,12 +160,12 @@ public class DialogSelectDocInfoViewModel {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.requiresDocData() && (this.getDataDoc() == null || this.getNumDoc() == null)){
|
||||
if (this.requiresDocData() && (this.getDataDoc() == null || this.getNumDoc() == null)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (this.requiresNote() && (this.getNote() == null || this.getNote().length() <= 0) ){
|
||||
if (this.requiresNote() && (this.getNote() == null || this.getNote().length() <= 0)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -174,7 +173,7 @@ public class DialogSelectDocInfoViewModel {
|
||||
}
|
||||
|
||||
public boolean requiresDocData() {
|
||||
TipiDocDTO doc = this.getSelectedTipoDoc();
|
||||
TipiDocDTO doc = this.getSelectedTipoDoc();
|
||||
return doc != null && doc.getGestioneDoc().equalsIgnoreCase("P") && !doc.getGestione().equalsIgnoreCase("L");
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
package it.integry.integrywmsnative.gest.contab_doc_interni.dto;
|
||||
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColr;
|
||||
import it.integry.integrywmsnative.core.di.BindableBoolean;
|
||||
|
||||
public class DialogChooseRowFromListaDocRowsListModel {
|
||||
|
||||
private String codMart;
|
||||
private String descrizione;
|
||||
private String qtaOrdReadable;
|
||||
private String barcode;
|
||||
private boolean isNew;
|
||||
private SqlMtbColr originalModel;
|
||||
private BindableBoolean checked = new BindableBoolean(false);
|
||||
|
||||
public DialogChooseRowFromListaDocRowsListModel() {
|
||||
}
|
||||
|
||||
public BindableBoolean getChecked() {
|
||||
return checked;
|
||||
}
|
||||
|
||||
public DialogChooseRowFromListaDocRowsListModel setChecked(BindableBoolean checked) {
|
||||
this.checked = checked;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void toggleCheck() {
|
||||
this.checked.set(!this.checked.get());
|
||||
}
|
||||
|
||||
public String getCodMart() {
|
||||
return codMart;
|
||||
}
|
||||
|
||||
public DialogChooseRowFromListaDocRowsListModel setCodMart(String codMart) {
|
||||
this.codMart = codMart;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDescrizione() {
|
||||
return descrizione;
|
||||
}
|
||||
|
||||
public DialogChooseRowFromListaDocRowsListModel setDescrizione(String descrizione) {
|
||||
this.descrizione = descrizione;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getQtaOrdReadable() {
|
||||
return qtaOrdReadable;
|
||||
}
|
||||
|
||||
public DialogChooseRowFromListaDocRowsListModel setQtaOrdReadable(String qtaOrdReadable) {
|
||||
this.qtaOrdReadable = qtaOrdReadable;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getBarcode() {
|
||||
return barcode;
|
||||
}
|
||||
|
||||
public DialogChooseRowFromListaDocRowsListModel setBarcode(String barcode) {
|
||||
this.barcode = barcode;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isNew() {
|
||||
return isNew;
|
||||
}
|
||||
|
||||
public DialogChooseRowFromListaDocRowsListModel setNew(boolean aNew) {
|
||||
isNew = aNew;
|
||||
return this;
|
||||
}
|
||||
|
||||
public SqlMtbColr getOriginalModel() {
|
||||
return originalModel;
|
||||
}
|
||||
|
||||
public DialogChooseRowFromListaDocRowsListModel setOriginalModel(SqlMtbColr originalModel) {
|
||||
this.originalModel = originalModel;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,7 @@ public class GrigliaAcquistiChildDTO {
|
||||
public String flagQtaMultipla;
|
||||
public String flagTracciabilita;
|
||||
public BigDecimal qtaMinOrdinabile;
|
||||
public boolean newNoPromo;
|
||||
private int ggScadenza;
|
||||
private float giacenza;
|
||||
private float qtaPrevistaVendita;
|
||||
@@ -144,4 +145,13 @@ public class GrigliaAcquistiChildDTO {
|
||||
this.qtaProposta = qtaProposta;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isNewNoPromo() {
|
||||
return newNoPromo;
|
||||
}
|
||||
|
||||
public GrigliaAcquistiChildDTO setNewNoPromo(boolean newNoPromo) {
|
||||
this.newNoPromo = newNoPromo;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ public class TipiDocDTO {
|
||||
private String descrizione;
|
||||
private String gestione;
|
||||
private String gestioneDoc;
|
||||
private boolean requireNote = false;
|
||||
|
||||
public String getCodDtip() {
|
||||
return codDtip;
|
||||
@@ -38,7 +39,17 @@ public class TipiDocDTO {
|
||||
public void setGestioneDoc(String gestioneDoc) {
|
||||
this.gestioneDoc = gestioneDoc;
|
||||
}
|
||||
public String getLabel(){
|
||||
return this.codDtip +" - "+this.descrizione;
|
||||
|
||||
public String getLabel() {
|
||||
return this.codDtip + " - " + this.descrizione;
|
||||
}
|
||||
|
||||
public boolean isRequireNote() {
|
||||
return requireNote;
|
||||
}
|
||||
|
||||
public TipiDocDTO setRequireNote(boolean requireNote) {
|
||||
this.requireNote = requireNote;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,6 +39,8 @@ import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||
import it.integry.integrywmsnative.databinding.ActivityContabDocInterniEditBinding;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.GrigliaAcquistiChildDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.GrigliaAcquistiDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.TipiDocDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.dialog.selectDocRows.DialogSelectDocRowsView;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.ui.DocumentRowsListAdapter;
|
||||
import it.integry.integrywmsnative.ui.FabMenuCustomAnimations;
|
||||
import it.integry.integrywmsnative.view.bottom_sheet__mtb_colr_edit.BottomSheetMtbColrEditView;
|
||||
@@ -51,12 +53,17 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
||||
|
||||
private static final String DATA_KEY_DOCUMENT = "document";
|
||||
private static final String DATA_KEY_PRODUCTS_LIST = "productsList";
|
||||
private static final String DATA_KEY_TIPO_DOC = "docType";
|
||||
|
||||
@Inject
|
||||
MtbColrRepository documentRowsRepository;
|
||||
|
||||
@Inject
|
||||
DocInterniEditFormViewModel viewModel;
|
||||
|
||||
@Inject
|
||||
DialogInputQuantityV2View dialogInputQuantityV2View;
|
||||
|
||||
|
||||
private int mBarcodeScannerIstanceID;
|
||||
private ActivityContabDocInterniEditBinding binding;
|
||||
@@ -70,13 +77,15 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
||||
public BindableBoolean isDocumentExportable = new BindableBoolean(false);
|
||||
private final ObservableArrayList<SqlMtbColr> documentRowsObservableList = new ObservableArrayList<>();
|
||||
|
||||
public static Intent newInstance(Context context, SqlMtbColt document, GrigliaAcquistiDTO productList) {
|
||||
public static Intent newInstance(Context context, SqlMtbColt document, GrigliaAcquistiDTO productList, TipiDocDTO tipoDoc) {
|
||||
Intent myIntent = new Intent(context, DocInterniEditFormActivity.class);
|
||||
|
||||
String doc = DataCache.addItem(document);
|
||||
String productsKey = DataCache.addItem(productList);
|
||||
String docType = DataCache.addItem(tipoDoc);
|
||||
myIntent.putExtra(DATA_KEY_DOCUMENT, doc);
|
||||
myIntent.putExtra(DATA_KEY_PRODUCTS_LIST, productsKey);
|
||||
myIntent.putExtra(DATA_KEY_TIPO_DOC, docType);
|
||||
return myIntent;
|
||||
}
|
||||
|
||||
@@ -91,7 +100,14 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
||||
SqlMtbColt document = DataCache.retrieveItem(getIntent().getStringExtra(DATA_KEY_DOCUMENT));
|
||||
GrigliaAcquistiDTO griglia = DataCache.retrieveItem(getIntent().getStringExtra(DATA_KEY_PRODUCTS_LIST));
|
||||
List<GrigliaAcquistiChildDTO> productList = griglia.getGrigliaAcquistiChild();
|
||||
this.initViewModel(document, productList);
|
||||
TipiDocDTO docType = DataCache.retrieveItem(getIntent().getStringExtra(DATA_KEY_TIPO_DOC));
|
||||
|
||||
this.initViewModel();
|
||||
this.viewModel.setDocument(document);
|
||||
this.viewModel.setProductsList(productList);
|
||||
this.viewModel.setTipoDoc(docType);
|
||||
|
||||
|
||||
this.initView();
|
||||
this.initBindables();
|
||||
this.initRecyclerView();
|
||||
@@ -132,11 +148,9 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
||||
binding.bottomSheetMtbColrEdit.init(binding.bottomSheetMtbColrEdit, binding.bottomSheetMtbColrEditBackground);
|
||||
}
|
||||
|
||||
private void initViewModel(SqlMtbColt document, List<GrigliaAcquistiChildDTO> productList) {
|
||||
private void initViewModel() {
|
||||
this.viewModel.init();
|
||||
this.viewModel.setListeners(this);
|
||||
this.viewModel.setDocument(document);
|
||||
this.viewModel.setProductsList(productList);
|
||||
|
||||
}
|
||||
|
||||
private void initRecyclerView() {
|
||||
@@ -184,7 +198,7 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
||||
}
|
||||
|
||||
mBarcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
||||
.setOnScanSuccessfull(this.viewModel::processBarcode)
|
||||
.setOnScanSuccessful(this.viewModel::processBarcode)
|
||||
.setOnScanFailed(this::onError));
|
||||
this.viewModel.fetchDocumentRows();
|
||||
}
|
||||
@@ -209,6 +223,7 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
||||
|
||||
@Override
|
||||
public void onEditRowRequest(SqlMtbColr row, boolean flagTracciabilita) {
|
||||
this.onLoadingStarted();
|
||||
MtbAart mtbAart = new MtbAart();
|
||||
mtbAart.setBarCode(row.getCodBarre());
|
||||
mtbAart.setDiacod(row.getCodBarre());
|
||||
@@ -232,6 +247,7 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
||||
.setCanOverflowOrderQuantity(false)
|
||||
.setCanLUBeClosed(false)
|
||||
.setNotesAllowed(true)
|
||||
.setNotesMandatory(this.viewModel.isNotesMandatory())
|
||||
.setDataScadMandatory(flagTracciabilita)
|
||||
.setCanPartitaMagBeChanged(flagTracciabilita)
|
||||
.setSuggestPartitaMag(data -> {
|
||||
@@ -243,12 +259,14 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
||||
return partitaMag;
|
||||
});
|
||||
|
||||
DialogInputQuantityV2View
|
||||
.newInstance(dialogInputQuantityV2DTO, (resultDTO, shouldCloseLU) -> {
|
||||
this.onLoadingStarted();
|
||||
this.viewModel.saveRow(row, resultDTO);
|
||||
}, this::onLoadingEnded)
|
||||
.show(getSupportFragmentManager(), "tag");
|
||||
if (!dialogInputQuantityV2View.isAdded())
|
||||
dialogInputQuantityV2View.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
|
||||
.setOnComplete((resultDTO, shouldCloseLU) -> {
|
||||
this.onLoadingStarted();
|
||||
this.viewModel.saveRow(row, resultDTO);
|
||||
})
|
||||
.setOnAbort(this::onLoadingEnded)
|
||||
.show(getSupportFragmentManager(), "tag");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -280,6 +298,16 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
||||
this.viewModel.deleteRow(entityToSql(mtbColr));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMultipleRowsFound(List<SqlMtbColr> rows, GrigliaAcquistiChildDTO articolo) {
|
||||
DialogSelectDocRowsView.newInstance(rows, (row) -> {
|
||||
this.onLoadingEnded();
|
||||
if (row != null) {
|
||||
this.viewModel.editRow(row, (articolo.getFlagTracciabilita().equalsIgnoreCase("S")));
|
||||
}
|
||||
}
|
||||
).show(this.getSupportFragmentManager(), "dialogSelectDocRows");
|
||||
}
|
||||
|
||||
private MtbColr sqlToEntity(SqlMtbColr sqlMtbColr) {
|
||||
MtbColr entity = new MtbColr();
|
||||
|
||||
@@ -5,6 +5,8 @@ import androidx.lifecycle.MutableLiveData;
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
@@ -18,11 +20,13 @@ import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColt;
|
||||
import it.integry.integrywmsnative.core.data_store.db.repository.MtbColrRepository;
|
||||
import it.integry.integrywmsnative.core.data_store.db.repository.MtbColtRepository;
|
||||
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.ArtDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.ColloDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.GrigliaAcquistiChildDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.SaveDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.TipiDocDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.rest.DocInterniRESTConsumer;
|
||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2ResultDTO;
|
||||
|
||||
@@ -35,7 +39,9 @@ public class DocInterniEditFormViewModel {
|
||||
private final DocInterniRESTConsumer docInterniRESTConsumer;
|
||||
private DocInterniEditFormViewModel.Listener listener;
|
||||
private List<GrigliaAcquistiChildDTO> productsList;
|
||||
|
||||
private TipiDocDTO tipoDoc;
|
||||
private boolean isCheckPartitaMag = false;
|
||||
private JSONObject checkFornitoreRules = null;
|
||||
public MutableLiveData<SqlMtbColt> document = new MutableLiveData<>();
|
||||
public MutableLiveData<List<SqlMtbColr>> docRows = new MutableLiveData<>();
|
||||
|
||||
@@ -47,6 +53,16 @@ public class DocInterniEditFormViewModel {
|
||||
this.docRows.setValue(new ArrayList<>());
|
||||
}
|
||||
|
||||
public void init() {
|
||||
try {
|
||||
var docInterniCheckFornitore = SettingsManager.iDB().getDocInterniCheckFornitore();
|
||||
this.checkFornitoreRules = docInterniCheckFornitore != null ? new JSONObject(docInterniCheckFornitore) : null;
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void sendOnLoadingStarted() {
|
||||
if (this.listener != null) listener.onLoadingStarted();
|
||||
}
|
||||
@@ -71,7 +87,7 @@ public class DocInterniEditFormViewModel {
|
||||
}
|
||||
|
||||
public void editRow(SqlMtbColr row, boolean flagTracciabilita) {
|
||||
this.listener.onEditRowRequest(row, flagTracciabilita);
|
||||
this.listener.onEditRowRequest(row, flagTracciabilita && this.isCheckPartitaMag);
|
||||
}
|
||||
|
||||
private Integer getNextIdRiga() {
|
||||
@@ -111,43 +127,46 @@ public class DocInterniEditFormViewModel {
|
||||
}
|
||||
|
||||
public void onSearch(String search) {
|
||||
this.sendOnLoadingStarted();
|
||||
GrigliaAcquistiChildDTO articolo = this.searchArticolo(search);
|
||||
if (articolo == null) {
|
||||
this.sendError(new Exception("Nessun articolo corrispondente al codice fornito!"));
|
||||
this.sendOnLoadingEnded();
|
||||
return;
|
||||
}
|
||||
SqlMtbColr row = this.getRowForArticolo(articolo);
|
||||
this.sendOnLoadingEnded();
|
||||
this.editRow(row, articolo.getFlagTracciabilita().equalsIgnoreCase("S"));
|
||||
List<SqlMtbColr> rows = this.getRowsForArticolo(articolo);
|
||||
if (rows.isEmpty()) {
|
||||
this.sendError(new Exception("Nessun articolo corrispondente al codice fornito!"));
|
||||
}
|
||||
if (rows.size() > 1) {
|
||||
this.listener.onMultipleRowsFound(rows, articolo);
|
||||
} else {
|
||||
this.editRow(rows.get(0), (articolo.getFlagTracciabilita().equalsIgnoreCase("S")));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private SqlMtbColr getRowForArticolo(GrigliaAcquistiChildDTO articolo) {
|
||||
private List<SqlMtbColr> getRowsForArticolo(GrigliaAcquistiChildDTO articolo) {
|
||||
List<SqlMtbColr> docRows = this.docRows.getValue();
|
||||
if (docRows == null) {
|
||||
docRows = new ArrayList<>();
|
||||
}
|
||||
SqlMtbColt document = this.document.getValue();
|
||||
SqlMtbColr row = Stream.of(docRows).filter(docRow -> docRow.getCodMart().equalsIgnoreCase(articolo.getCodMart())).findFirstOrElse(null);
|
||||
if (row == null) {
|
||||
row = new SqlMtbColr();
|
||||
row.setIdCollo(document.getId());
|
||||
row.setRiga(getNextIdRiga());
|
||||
row.setCodMart(articolo.getCodMart());
|
||||
row.setSerCollo(document.getSerCollo());
|
||||
row.setGestione(document.getGestione());
|
||||
row.setNumCollo(document.getNumCollo());
|
||||
row.setDataCollo(document.getDataCollo());
|
||||
row.setDescrizione(articolo.getDescrizione());
|
||||
row.setUntMis(articolo.getUntMis());
|
||||
row.setCodBarre(articolo.getBarcode());
|
||||
row.setQtaCnf(articolo.getQtaCnf().floatValue());
|
||||
row.setNumCnf(0f);
|
||||
row.setQtaCol(0f);
|
||||
}
|
||||
return row;
|
||||
SqlMtbColr row = new SqlMtbColr();
|
||||
row.setIdCollo(document.getId());
|
||||
row.setRiga(getNextIdRiga());
|
||||
row.setCodMart(articolo.getCodMart());
|
||||
row.setSerCollo(document.getSerCollo());
|
||||
row.setGestione(document.getGestione());
|
||||
row.setNumCollo(document.getNumCollo());
|
||||
row.setDataCollo(document.getDataCollo());
|
||||
row.setDescrizione(articolo.getDescrizione());
|
||||
row.setUntMis(articolo.getUntMis());
|
||||
row.setCodBarre(articolo.getBarcode());
|
||||
row.setQtaCnf(articolo.getQtaCnf().floatValue());
|
||||
row.setNumCnf(0f);
|
||||
row.setQtaCol(0f);
|
||||
List<SqlMtbColr> rows = Stream.of(docRows).filter(docRow -> docRow.getCodMart().equalsIgnoreCase(articolo.getCodMart())).toList();
|
||||
rows.add(row);
|
||||
return rows;
|
||||
}
|
||||
|
||||
private GrigliaAcquistiChildDTO searchArticolo(String filter) {
|
||||
@@ -208,6 +227,26 @@ public class DocInterniEditFormViewModel {
|
||||
|
||||
public void setDocument(SqlMtbColt document) {
|
||||
this.document.setValue(document);
|
||||
this.initCheckFornitore();
|
||||
}
|
||||
|
||||
private void initCheckFornitore() {
|
||||
SqlMtbColt doc = this.document.getValue();
|
||||
boolean isCheckPartitaMag = false;
|
||||
if (doc != null && this.checkFornitoreRules != null) {
|
||||
String key = doc.getCodAnag();
|
||||
if (doc.getCodVdes() != null && !doc.getCodVdes().isEmpty()) {
|
||||
key += "-" + doc.getCodVdes();
|
||||
}
|
||||
try {
|
||||
if (this.checkFornitoreRules.has(key) && ((String) ((JSONObject) this.checkFornitoreRules.get(key)).get(doc.getCodDtipProvv())).equalsIgnoreCase("check-partitaMag")) {
|
||||
isCheckPartitaMag = true;
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
|
||||
}
|
||||
this.isCheckPartitaMag = isCheckPartitaMag;
|
||||
}
|
||||
|
||||
public SqlMtbColt getDocument() {
|
||||
@@ -262,6 +301,15 @@ public class DocInterniEditFormViewModel {
|
||||
return Stream.of(productsList).filter(prod -> prod.codMart.equalsIgnoreCase(codMart)).findFirstOrElse(null);
|
||||
}
|
||||
|
||||
public DocInterniEditFormViewModel setTipoDoc(TipiDocDTO docType) {
|
||||
this.tipoDoc = docType;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isNotesMandatory() {
|
||||
return this.tipoDoc != null && this.tipoDoc.isRequireNote();
|
||||
}
|
||||
|
||||
public interface Listener extends ILoadingListener {
|
||||
|
||||
void onError(Exception ex);
|
||||
@@ -270,6 +318,8 @@ public class DocInterniEditFormViewModel {
|
||||
|
||||
void onEditRowRequest(SqlMtbColr row, boolean flagTracciabilita);
|
||||
|
||||
void onMultipleRowsFound(List<SqlMtbColr> rows, GrigliaAcquistiChildDTO articolo);
|
||||
|
||||
void onDocumentHoldRequest();
|
||||
|
||||
void onDocExported();
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.dialog.selectDocRows;
|
||||
|
||||
import dagger.Subcomponent;
|
||||
|
||||
@Subcomponent
|
||||
public interface DialogSelectDocRowsComponent {
|
||||
|
||||
@Subcomponent.Factory
|
||||
interface Factory {
|
||||
DialogSelectDocRowsComponent create();
|
||||
}
|
||||
|
||||
|
||||
void inject(DialogSelectDocRowsView dialogSelectDocInfoView);
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user