Compare commits
67 Commits
v1.23.7(26
...
v1.24.6(27
| Author | SHA1 | Date | |
|---|---|---|---|
| cc1e1bf221 | |||
| 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 | |||
| 3a5de50353 | |||
| 86c7be4e7d |
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 = 262
|
||||
def appVersionName = '1.23.7'
|
||||
def appVersionCode = 274
|
||||
def appVersionName = '1.24.6'
|
||||
|
||||
signingConfigs {
|
||||
release {
|
||||
@@ -138,7 +138,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 +156,14 @@ 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'
|
||||
}
|
||||
|
||||
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() {
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,8 @@ 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;
|
||||
@@ -51,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;
|
||||
@@ -89,6 +93,7 @@ import it.integry.integrywmsnative.view.dialogs.scan_or_create_lu.DialogScanOrCr
|
||||
MainApplicationModule.class,
|
||||
BaseActivityModule.class,
|
||||
BaseFragmentModule.class,
|
||||
BaseDialogFragmentModule.class,
|
||||
LoginModule.class,
|
||||
MainActivityModule.class,
|
||||
MainFragmentModule.class,
|
||||
@@ -122,7 +127,8 @@ import it.integry.integrywmsnative.view.dialogs.scan_or_create_lu.DialogScanOrCr
|
||||
DialogSelectDocInfoModule.class,
|
||||
DocInterniEditFormModule.class,
|
||||
DialogSelectDocRowsModule.class,
|
||||
DialogAskClienteModule.class
|
||||
DialogAskClienteModule.class,
|
||||
DialogEditArticoloModule.class
|
||||
})
|
||||
public interface MainApplicationComponent {
|
||||
|
||||
@@ -130,6 +136,8 @@ public interface MainApplicationComponent {
|
||||
|
||||
BaseFragmentComponent.Factory baseFragmentComponent();
|
||||
|
||||
BaseDialogFragmentComponent.Factory baseDialogFragmentComponent();
|
||||
|
||||
SplashActivityComponent.Factory splashActivityComponent();
|
||||
|
||||
LoginComponent.Factory loginActivityComponent();
|
||||
@@ -206,6 +214,8 @@ public interface MainApplicationComponent {
|
||||
|
||||
InfoAggiuntiveLUDialogComponent.Factory infoAggiuntiveLUDialogComponent();
|
||||
|
||||
DialogEditArticoloComponent.Factory dialogEditArticoloComponent();
|
||||
|
||||
void inject(MainApplication mainApplication);
|
||||
|
||||
void inject(AppContext mainApplication);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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 = 7, exportSchema = false)
|
||||
@Database(entities = {ArticoloGriglia.class, Griglia.class, Ordine.class, ArticoloOrdine.class, SqlMtbColt.class, SqlMtbColr.class}, version = 8, 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,7 +4,9 @@ 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.List;
|
||||
|
||||
@@ -39,15 +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")
|
||||
@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);
|
||||
|
||||
@@ -27,7 +27,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;
|
||||
@@ -74,11 +74,11 @@ public class ArticoloGriglia {
|
||||
@ColumnInfo(name = "new_no_promo")
|
||||
private boolean newNoPromo = false;
|
||||
|
||||
public int getArticoloGrigliaId() {
|
||||
public Integer getArticoloGrigliaId() {
|
||||
return articoloGrigliaId;
|
||||
}
|
||||
|
||||
public void setArticoloGrigliaId(int articoloGrigliaId) {
|
||||
public void setArticoloGrigliaId(Integer articoloGrigliaId) {
|
||||
this.articoloGrigliaId = articoloGrigliaId;
|
||||
}
|
||||
|
||||
|
||||
@@ -82,12 +82,15 @@ public class ArticoloOrdine {
|
||||
@Ignore
|
||||
private BigDecimal qtaProposta = BigDecimal.ZERO;
|
||||
|
||||
@Ignore
|
||||
private int bgTint;
|
||||
|
||||
|
||||
public Integer getArticoloOrdineId() {
|
||||
return articoloOrdineId;
|
||||
}
|
||||
|
||||
public void setArticoloOrdineId(int articoloOrdineId) {
|
||||
public void setArticoloOrdineId(Integer articoloOrdineId) {
|
||||
this.articoloOrdineId = articoloOrdineId;
|
||||
}
|
||||
|
||||
@@ -244,6 +247,23 @@ public class ArticoloOrdine {
|
||||
}
|
||||
|
||||
public float getCnfDaRic() {
|
||||
return qtaCnf > 0.f ? merceDaRic / qtaCnf : 0;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
@@ -95,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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@ 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");
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,8 @@ public class BaseActivity extends AppCompatActivity {
|
||||
@Inject
|
||||
public DialogProgressView mCurrentProgress;
|
||||
|
||||
private boolean progressOpened;
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@Nullable View parent, @NonNull String name, @NonNull Context context, @NonNull AttributeSet attrs) {
|
||||
@@ -34,6 +36,45 @@ public class BaseActivity extends AppCompatActivity {
|
||||
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
|
||||
public boolean dispatchKeyEvent(KeyEvent event) {
|
||||
if (BarcodeManager.isEnabled() && BarcodeManager.isKeyboardEmulator()) {
|
||||
@@ -54,45 +95,4 @@ public class BaseActivity extends AppCompatActivity {
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
protected void openProgress() {
|
||||
runOnUiThread(() -> {
|
||||
BarcodeManager.disable();
|
||||
if (!this.mCurrentProgress.isVisible() && !this.mCurrentProgress.isAdded()) {
|
||||
this.mCurrentProgress.show(getSupportFragmentManager(), "tag");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected void closeProgress() {
|
||||
runOnUiThread(() -> {
|
||||
BarcodeManager.enable();
|
||||
if (mCurrentProgress.isVisible()) {
|
||||
mCurrentProgress.dismiss();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
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();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,19 +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 DialogProgressView 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(requireActivity());
|
||||
}
|
||||
});
|
||||
// }).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,6 +1,7 @@
|
||||
package it.integry.integrywmsnative.core.expansion;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -29,6 +30,7 @@ public abstract class BaseFragment extends Fragment {
|
||||
protected ElevatedToolbar mToolbar;
|
||||
|
||||
protected final List<Runnable> mOnPreDestroyList = new ArrayList<>();
|
||||
private boolean progressOpened;
|
||||
|
||||
|
||||
public void setScrollToolbar(ElevatedToolbar toolbar) {
|
||||
@@ -62,6 +64,30 @@ public abstract class BaseFragment extends Fragment {
|
||||
BarcodeManager.enable();
|
||||
}
|
||||
|
||||
private void openProgress() {
|
||||
Log.d("PROGRESS DIALOG", "OPENED");
|
||||
new Thread(() -> {
|
||||
if (!progressOpened && !this.mCurrentProgress.isAdded()) {
|
||||
this.progressOpened = true;
|
||||
requireActivity().runOnUiThread(() -> {
|
||||
this.mCurrentProgress.show(requireActivity().getSupportFragmentManager(), "tag");
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
private void closeProgress() {
|
||||
Log.d("PROGRESS DIALOG", "CLOSED");
|
||||
new Thread(() -> {
|
||||
if (progressOpened) {
|
||||
this.progressOpened = false;
|
||||
requireActivity().runOnUiThread(() -> {
|
||||
mCurrentProgress.dismiss();
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
public void onError(Exception ex) {
|
||||
requireActivity().runOnUiThread(() -> {
|
||||
this.closeProgress();
|
||||
@@ -80,22 +106,6 @@ public abstract class BaseFragment extends Fragment {
|
||||
}
|
||||
}
|
||||
|
||||
protected void openProgress() {
|
||||
requireActivity().runOnUiThread(() -> {
|
||||
if (!this.mCurrentProgress.isVisible() && !this.mCurrentProgress.isAdded()) {
|
||||
this.mCurrentProgress.show(requireActivity().getSupportFragmentManager(), "tag");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected void closeProgress() {
|
||||
requireActivity().runOnUiThread(() -> {
|
||||
if (mCurrentProgress.isVisible()) {
|
||||
mCurrentProgress.dismiss();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected void popMe() {
|
||||
requireActivity().runOnUiThread(() -> {
|
||||
((IPoppableActivity) requireActivity()).pop();
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,12 +2,16 @@ package it.integry.integrywmsnative.core.model;
|
||||
|
||||
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.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 +109,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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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,9 +243,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
public void createColloFromEtichettaAnonima(String barcode, GestioneEnum gestione, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
MtbColt mtbColtToCreate = new MtbColt()
|
||||
.setGestione(gestione);
|
||||
|
||||
mtbColtToCreate.initDefaultFields();
|
||||
.initDefaultFields(gestione);
|
||||
|
||||
Integer customNumCollo = UtilityBarcode.getNumColloFromULAnonima(barcode);
|
||||
String customSerCollo = CommonConst.Config.DEFAULT_ANONYMOUS_UL_SERIE;
|
||||
@@ -587,35 +582,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) {
|
||||
|
||||
@@ -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,7 +158,7 @@ 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);
|
||||
@@ -182,13 +183,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<>();
|
||||
@@ -126,7 +139,7 @@ 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());
|
||||
|
||||
@@ -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) -> {
|
||||
|
||||
@@ -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;
|
||||
@@ -41,7 +42,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()));
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -5,6 +5,7 @@ import java.util.List;
|
||||
|
||||
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;
|
||||
|
||||
@@ -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;
|
||||
@@ -37,11 +39,13 @@ public class DBSettingsModel {
|
||||
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 int onNumCnfInputChanged = 1;
|
||||
private boolean flagAccettazioneUseQtaOrd = false;
|
||||
private boolean flagPickLiberoAllowEmptyDest = false;
|
||||
|
||||
public boolean isFlagSpedizioneEnableFakeGiacenza() {
|
||||
return flagSpedizioneEnableFakeGiacenza;
|
||||
@@ -79,6 +83,15 @@ public class DBSettingsModel {
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<InternalCodAnagsDTO> getInternalCodAnags() {
|
||||
return internalCodAnags;
|
||||
}
|
||||
|
||||
public DBSettingsModel setInternalCodAnags(List<InternalCodAnagsDTO> internalCodAnags) {
|
||||
this.internalCodAnags = internalCodAnags;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<AvailableCodMdepsDTO> getAvailableCodMdep() {
|
||||
return availableCodMdep;
|
||||
}
|
||||
@@ -105,12 +118,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;
|
||||
}
|
||||
|
||||
@@ -141,12 +154,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;
|
||||
}
|
||||
|
||||
@@ -312,4 +325,23 @@ public class DBSettingsModel {
|
||||
this.flagAccettazioneUseQtaOrd = flagAccettazioneUseQtaOrd;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isFlagPickLiberoAllowEmptyDest() {
|
||||
return flagPickLiberoAllowEmptyDest;
|
||||
}
|
||||
|
||||
public DBSettingsModel setFlagPickLiberoAllowEmptyDest(boolean flagPickLiberoAllowEmptyDest) {
|
||||
this.flagPickLiberoAllowEmptyDest = flagPickLiberoAllowEmptyDest;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public boolean getFlagOrdinaArticoliOnScan() {
|
||||
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")
|
||||
@@ -274,6 +290,10 @@ public class SettingsManager {
|
||||
.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")
|
||||
@@ -282,16 +302,20 @@ public class SettingsManager {
|
||||
.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));
|
||||
@@ -300,7 +324,6 @@ 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));
|
||||
@@ -309,6 +332,8 @@ public class SettingsManager {
|
||||
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) {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package it.integry.integrywmsnative.core.utility;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
|
||||
import it.integry.integrywmsnative.view.dialogs.DialogProgressView;
|
||||
@@ -13,10 +12,5 @@ public class UtilityProgress {
|
||||
return progress;
|
||||
}
|
||||
|
||||
public static DialogProgressView createDefaultProgressDialog(AppCompatActivity mContext, String title, String subtitle) {
|
||||
DialogProgressView progress = DialogProgressView.newInstance(title, subtitle, true);
|
||||
progress.show(mContext.getSupportFragmentManager(), "tag");
|
||||
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
|
||||
|
||||
@@ -355,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)));
|
||||
}
|
||||
|
||||
@@ -688,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();
|
||||
});
|
||||
};
|
||||
|
||||
@@ -705,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();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -756,7 +752,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,
|
||||
@@ -766,16 +762,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);
|
||||
@@ -808,7 +794,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());
|
||||
|
||||
@@ -317,12 +317,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);
|
||||
@@ -372,8 +373,7 @@ public class AccettazionePickingViewModel {
|
||||
|
||||
MtbColt mtbColt = new MtbColt();
|
||||
mtbColt
|
||||
.initDefaultFields()
|
||||
.setGestione(defaultGestioneOfUL)
|
||||
.initDefaultFields(defaultGestioneOfUL)
|
||||
.setAnnotazioni(additionalNotes)
|
||||
.setPosizione(defaultPosAccettazione)
|
||||
.setOperation(CommonModelConsts.OPERATION.INSERT_OR_UPDATE);
|
||||
|
||||
@@ -190,7 +190,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();
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@ import it.integry.integrywmsnative.core.utility.UtilityServer;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
import it.integry.integrywmsnative.gest.login.exception.InvalidServerCodAziendaException;
|
||||
import it.integry.integrywmsnative.gest.login.exception.InvalidUserDepositException;
|
||||
import it.integry.integrywmsnative.gest.login.exception.ServerNotReachableException;
|
||||
import it.integry.integrywmsnative.gest.login.rest.LoginRESTConsumer;
|
||||
|
||||
public class LoginViewModel {
|
||||
@@ -52,13 +51,10 @@ public class LoginViewModel {
|
||||
final String host = u.getHost();
|
||||
final int port = u.getPort();
|
||||
|
||||
UtilityServer.isEmsApiAvailable(host, port, value1 -> {
|
||||
UtilityServer.isEmsApiAvailable(host, port, () -> {
|
||||
|
||||
if (value1) { //Is online
|
||||
mLoginRESTConsumer.authenticate(host, port, username, password, loginDTO -> {
|
||||
|
||||
SettingsManager.iDB().setAvailableProfiles(loginDTO.getAvailableProfiles());
|
||||
|
||||
SettingsManager.i().createUserSession();
|
||||
SettingsManager.i().getUser().setFullname(!UtilityString.isNullOrEmpty(loginDTO.getFull_name()) ? loginDTO.getFull_name() : username);
|
||||
|
||||
@@ -73,11 +69,7 @@ public class LoginViewModel {
|
||||
}, this::sendError);
|
||||
|
||||
|
||||
} else { //Is not online
|
||||
this.sendError(new ServerNotReachableException(host, port, null));
|
||||
}
|
||||
|
||||
});
|
||||
}, this::sendError);
|
||||
}, ex -> {
|
||||
this.sendError(new InvalidServerCodAziendaException(codAzienda, ex));
|
||||
});
|
||||
|
||||
@@ -237,7 +237,7 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
|
||||
|
||||
private void initBarcodeReader() {
|
||||
barcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
||||
.setOnScanSuccessfull(onScanSuccessful)
|
||||
.setOnScanSuccessful(onScanSuccessful)
|
||||
.setOnScanFailed(ex -> UtilityExceptions.defaultException(getActivity(), ex, false)));
|
||||
|
||||
BarcodeManager.enable();
|
||||
@@ -687,45 +687,32 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
|
||||
|
||||
|
||||
private final RunnableArgs<BarcodeScanDTO> onScanSuccessful = data -> {
|
||||
BarcodeManager.disable();
|
||||
this.openProgress();
|
||||
this.onLoadingStarted();
|
||||
|
||||
this.mViewModel.processBarcodeDTO(data, () -> {
|
||||
BarcodeManager.enable();
|
||||
this.closeProgress();
|
||||
this.onLoadingEnded();
|
||||
});
|
||||
};
|
||||
|
||||
private void refreshList(List<OrdiniUscitaElencoDTO> filteredList) {
|
||||
this.onLoadingStarted();
|
||||
List<OrdiniUscitaElencoDTO> tmpList;
|
||||
|
||||
//new Thread(() -> {
|
||||
if (filteredList != null) {
|
||||
tmpList = filteredList;
|
||||
} else if (mAppliedFilterViewModel != null) {
|
||||
mAppliedFilterViewModel.applyAllTests();
|
||||
tmpList = mAppliedFilterViewModel.getMutableFilteredOrderList().getValue();
|
||||
} else {
|
||||
tmpList = mViewModel.getOrderList().getValue();
|
||||
}
|
||||
|
||||
requireActivity().runOnUiThread(() -> {
|
||||
List<OrdiniUscitaElencoDTO> tmpList;
|
||||
var list = convertDataModelToListModel(tmpList);
|
||||
|
||||
if (filteredList != null) {
|
||||
tmpList = filteredList;
|
||||
} else if (mAppliedFilterViewModel != null) {
|
||||
mAppliedFilterViewModel.applyAllTests();
|
||||
tmpList = mAppliedFilterViewModel.getMutableFilteredOrderList().getValue();
|
||||
} else {
|
||||
tmpList = mViewModel.getOrderList().getValue();
|
||||
}
|
||||
|
||||
var list = convertDataModelToListModel(tmpList);
|
||||
|
||||
this.mOrdiniInevasiMutableData.clear();
|
||||
this.mOrdiniInevasiMutableData.addAll(list);
|
||||
|
||||
fabVisible.set(Stream.of(mOrdiniInevasiMutableData)
|
||||
.anyMatch(y -> y.getSelectedObservable().get()));
|
||||
|
||||
this.onLoadingEnded();
|
||||
});
|
||||
|
||||
//}).start();
|
||||
this.mOrdiniInevasiMutableData.clear();
|
||||
this.mOrdiniInevasiMutableData.addAll(list);
|
||||
|
||||
fabVisible.set(Stream.of(mOrdiniInevasiMutableData)
|
||||
.anyMatch(y -> y.getSelectedObservable().get()));
|
||||
}
|
||||
|
||||
private List<OrdiniUscitaElencoListModel> convertDataModelToListModel(List<OrdiniUscitaElencoDTO> dataList) {
|
||||
|
||||
@@ -104,7 +104,7 @@ public class OrdiniUscitaElencoViewModel {
|
||||
.distinct()
|
||||
.toList();
|
||||
|
||||
if (foundGestioni != null && foundGestioni.size() > 1) {
|
||||
if (foundGestioni.size() > 1) {
|
||||
this.sendError(new InvalidLUMultiGestioneException());
|
||||
return;
|
||||
}
|
||||
@@ -116,7 +116,7 @@ public class OrdiniUscitaElencoViewModel {
|
||||
.distinct()
|
||||
.toList();
|
||||
|
||||
if (foundCodMdep != null && foundCodMdep.size() > 1) {
|
||||
if (foundCodMdep.size() > 1) {
|
||||
this.sendError(new InvalidLUMultiCodMdepException());
|
||||
return;
|
||||
}
|
||||
@@ -128,9 +128,9 @@ public class OrdiniUscitaElencoViewModel {
|
||||
.map(x -> (OrdineUscitaInevasoDTO) x)
|
||||
.toList();
|
||||
|
||||
this.mOrdiniRESTConsumer.retrieveListaArticoliFromOrdiniUscita(selectedOrdersBase, sitArts -> {
|
||||
this.mOrdiniRESTConsumer.retrieveListaArticoliFromOrdiniUscita(mCurrentCodMdep, selectedOrdersBase, sitArts -> {
|
||||
|
||||
if(mtbGrupToFilter != null && !mtbGrupToFilter.isEmpty()) {
|
||||
if (mtbGrupToFilter != null && !mtbGrupToFilter.isEmpty()) {
|
||||
sitArts = Stream.of(sitArts)
|
||||
.filter(x -> Stream.of(mtbGrupToFilter).map(MtbGrup::getCodMgrp).anyMatch(y -> y.equalsIgnoreCase(x.getCodMgrp())))
|
||||
.toList();
|
||||
|
||||
@@ -156,7 +156,7 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
|
||||
|
||||
private void initBarcodeReader() {
|
||||
barcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
||||
.setOnScanSuccessfull(onScanSuccessful)
|
||||
.setOnScanSuccessful(onScanSuccessful)
|
||||
.setOnScanFailed(ex -> UtilityExceptions.defaultException(getActivity(), ex, false)));
|
||||
|
||||
BarcodeManager.enable();
|
||||
@@ -266,13 +266,13 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
|
||||
null,
|
||||
() -> onComplete.run(true),
|
||||
() -> onComplete.run(false)
|
||||
).show(getActivity().getSupportFragmentManager(), "tag");
|
||||
).show(requireActivity().getSupportFragmentManager(), "tag");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Exception ex) {
|
||||
getActivity().runOnUiThread(() -> {
|
||||
this.closeProgress();
|
||||
requireActivity().runOnUiThread(() -> {
|
||||
this.onLoadingEnded();
|
||||
|
||||
if (ex instanceof InvalidPesoKGException) {
|
||||
UtilityToast.showToast(ex.getMessage());
|
||||
@@ -287,7 +287,7 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
|
||||
@Override
|
||||
public void onLUClienteRequired(RunnableArgss<VtbDest, String> onComplete, Runnable onAbort) {
|
||||
DialogAskClienteView.newInstance(onComplete, onAbort)
|
||||
.show(getActivity().getSupportFragmentManager(), "tag");
|
||||
.show(requireActivity().getSupportFragmentManager(), "tag");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -346,10 +346,10 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
|
||||
.setPartitaMag(resultDTO.getPartitaMag())
|
||||
.setDataScad(resultDTO.getDataScad());
|
||||
|
||||
this.openProgress();
|
||||
this.onLoadingStarted();
|
||||
onComplete.run(pickedQuantityDTO, shouldCloseLU);
|
||||
})
|
||||
.setOnAbort(this::closeProgress)
|
||||
.setOnAbort(this::onLoadingEnded)
|
||||
.show(requireActivity().getSupportFragmentManager(), "tag");
|
||||
}
|
||||
|
||||
|
||||
@@ -205,6 +205,7 @@ public class PickingLiberoViewModel {
|
||||
barcodeProd = UtilityBarcode.convertITF14toEAN13(barcodeProd);
|
||||
}
|
||||
|
||||
String finalBarcodeProd = barcodeProd;
|
||||
mArticoloRESTConsumer.getByBarcodeProd(barcodeProd, mtbAartList -> {
|
||||
if (mtbAartList != null && mtbAartList.size() > 0) {
|
||||
MtbAart articolo = mtbAartList.get(0);
|
||||
@@ -216,11 +217,11 @@ public class PickingLiberoViewModel {
|
||||
this.dispatchArt(articolo, ean128Model);
|
||||
onComplete.run();
|
||||
} else {
|
||||
this.sendError(new NoResultFromBarcodeException());
|
||||
this.sendError(new NoResultFromBarcodeException(finalBarcodeProd));
|
||||
}
|
||||
|
||||
} else {
|
||||
this.sendError(new NoResultFromBarcodeException());
|
||||
this.sendError(new NoResultFromBarcodeException(finalBarcodeProd));
|
||||
}
|
||||
|
||||
}, this::sendError);
|
||||
@@ -243,10 +244,9 @@ public class PickingLiberoViewModel {
|
||||
this.sendOnLoadingStarted();
|
||||
|
||||
MtbColt mtbColt = new MtbColt();
|
||||
mtbColt.initDefaultFields();
|
||||
mtbColt.setGestione(mDefaultGestione)
|
||||
mtbColt.initDefaultFields(mDefaultGestione)
|
||||
.setRifOrd(mDefaultGestione == GestioneEnum.LAVORAZIONE ? "PICKING LIBERO" : null)
|
||||
.setCodAnag(SettingsManager.iDB().getProduzioneDefaultCodAnag())
|
||||
// .setCodAnag(SettingsManager.iDB().getProduzioneDefaultCodAnag())
|
||||
.setSegno(-1)
|
||||
.setOperation(CommonModelConsts.OPERATION.INSERT_OR_UPDATE);
|
||||
|
||||
|
||||
@@ -167,7 +167,7 @@ public class PickingResiActivity extends BaseActivity implements BottomSheetFrag
|
||||
|
||||
private void initBarcodeReader() {
|
||||
barcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
||||
.setOnScanSuccessfull(onScanSuccessful)
|
||||
.setOnScanSuccessful(onScanSuccessful)
|
||||
.setOnScanFailed(ex -> UtilityExceptions.defaultException(this, ex, false)));
|
||||
}
|
||||
|
||||
@@ -239,24 +239,20 @@ public class PickingResiActivity extends BaseActivity implements BottomSheetFrag
|
||||
return pickingResiListModels;
|
||||
}
|
||||
|
||||
private RunnableArgs<BarcodeScanDTO> onScanSuccessful = data -> {
|
||||
BarcodeManager.disable();
|
||||
|
||||
this.openProgress();
|
||||
private final RunnableArgs<BarcodeScanDTO> onScanSuccessful = data -> {
|
||||
this.onLoadingStarted();
|
||||
|
||||
this.mViewmodel.processBarcodeDTO(data, () -> {
|
||||
BarcodeManager.enable();
|
||||
this.closeProgress();
|
||||
this.onLoadingEnded();
|
||||
});
|
||||
};
|
||||
|
||||
public void createNewLU() {
|
||||
this.mBindings.mainFab.close(true);
|
||||
|
||||
this.openProgress();
|
||||
this.onLoadingStarted();
|
||||
|
||||
this.mViewmodel.createNewLU(null, null, () -> {
|
||||
this.closeProgress();
|
||||
this.onLoadingEnded();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -286,7 +282,7 @@ public class PickingResiActivity extends BaseActivity implements BottomSheetFrag
|
||||
|
||||
@Override
|
||||
public void onError(Exception ex) {
|
||||
this.closeProgress();
|
||||
this.onLoadingEnded();
|
||||
|
||||
if (ex instanceof InvalidPesoKGException) {
|
||||
UtilityToast.showToast(ex.getMessage());
|
||||
@@ -332,7 +328,7 @@ public class PickingResiActivity extends BaseActivity implements BottomSheetFrag
|
||||
.setPartitaMag(resultDTO.getPartitaMag())
|
||||
.setDataScad(resultDTO.getDataScad());
|
||||
|
||||
this.openProgress();
|
||||
this.onLoadingStarted();
|
||||
onComplete.run(pickedQuantityDTO, shouldCloseLU);
|
||||
})
|
||||
.setOnAbort(() -> {
|
||||
@@ -400,7 +396,7 @@ public class PickingResiActivity extends BaseActivity implements BottomSheetFrag
|
||||
|
||||
@Override
|
||||
public void onLUPrintError(Exception ex, Runnable onComplete) {
|
||||
this.closeProgress();
|
||||
this.onLoadingEnded();
|
||||
DialogSimpleMessageView.makeErrorDialog(
|
||||
new SpannableString(ex.getMessage()),
|
||||
null,
|
||||
@@ -409,14 +405,4 @@ public class PickingResiActivity extends BaseActivity implements BottomSheetFrag
|
||||
onComplete)
|
||||
.show(getSupportFragmentManager(), "tag");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadingStarted() {
|
||||
this.openProgress();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadingEnded() {
|
||||
this.closeProgress();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.model.MtbTCol;
|
||||
import it.integry.integrywmsnative.core.model.dto.PickDataDTO;
|
||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||
@@ -125,8 +126,7 @@ public class PickingResiViewModel {
|
||||
|
||||
public void createNewLU(Integer customNumCollo, String customSerCollo, Runnable onComplete) {
|
||||
MtbColt mtbColt = new MtbColt();
|
||||
mtbColt.initDefaultFields();
|
||||
mtbColt.setGestione(mDefaultGestioneOfLU)
|
||||
mtbColt.initDefaultFields(GestioneEnum.fromString(mDefaultGestioneOfLU))
|
||||
.setSegno(mDefaultSegnoOfLU)
|
||||
.setCodAnag(mDefaultCodAnagOfLU)
|
||||
.setCodMdep(mDefaultCodMdepOfLU)
|
||||
|
||||
@@ -26,7 +26,6 @@ import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
import it.integry.integrywmsnative.core.rest.model.SitArtOrdDTO;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityBigDecimal;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||
import it.integry.integrywmsnative.databinding.FragmentProdFabbisognoLineeProdBinding;
|
||||
import it.integry.integrywmsnative.gest.prod_fabbisogno_linee_prod.dialog_ask_mag_prossimita.DialogAskMagazzinoProssimitaView;
|
||||
import it.integry.integrywmsnative.gest.prod_fabbisogno_linee_prod.dto.ProdFabbisognoLineeProdDTO;
|
||||
@@ -112,24 +111,6 @@ public class ProdFabbisognoLineeProdFragment extends BaseFragment implements ITi
|
||||
titleText.setText(context.getText(R.string.prod_fabbisogno_linee_prod_title).toString());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onError(Exception ex) {
|
||||
this.closeProgress();
|
||||
UtilityExceptions.defaultException(getActivity(), ex);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadingStarted() {
|
||||
this.openProgress();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadingEnded() {
|
||||
this.closeProgress();
|
||||
}
|
||||
|
||||
|
||||
private void startPickingActivity(List<ProdFabbisognoLineeProdDTO> fabbisognoList) {
|
||||
String codMdep = SettingsManager.i().getUserSession().getDepo().getCodMdep();
|
||||
|
||||
|
||||
@@ -22,14 +22,12 @@ import javax.inject.Inject;
|
||||
|
||||
import it.integry.integrywmsnative.MainApplication;
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
||||
import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
|
||||
import it.integry.integrywmsnative.core.expansion.OnSingleClickListener;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgsss;
|
||||
import it.integry.integrywmsnative.core.model.JtbFasi;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||
import it.integry.integrywmsnative.databinding.DialogAskMagazzinoProssimitaBinding;
|
||||
|
||||
public class DialogAskMagazzinoProssimitaView extends BaseDialogFragment implements DialogAskMagazzinoProssimitaViewModel.Listener {
|
||||
@@ -178,20 +176,4 @@ public class DialogAskMagazzinoProssimitaView extends BaseDialogFragment impleme
|
||||
// });
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void onError(Exception ex) {
|
||||
this.closeProgress();
|
||||
UtilityExceptions.defaultException(mContext, ex);
|
||||
BarcodeManager.enable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadingStarted() {
|
||||
this.openProgress();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadingEnded() {
|
||||
this.closeProgress();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,16 +109,14 @@ public class ProdRecuperoMaterialeFragment extends BaseFragment implements ITitl
|
||||
|
||||
private void initBarcodeReader() {
|
||||
barcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
||||
.setOnScanSuccessfull(onScanSuccessful)
|
||||
.setOnScanSuccessful(onScanSuccessful)
|
||||
.setOnScanFailed(this::onError));
|
||||
|
||||
BarcodeManager.enable();
|
||||
}
|
||||
|
||||
private final RunnableArgs<BarcodeScanDTO> onScanSuccessful = data -> {
|
||||
BarcodeManager.disable();
|
||||
|
||||
this.openProgress();
|
||||
this.onLoadingStarted();
|
||||
|
||||
this.mViewModel.processBarcodeDTO(data);
|
||||
};
|
||||
@@ -228,7 +226,7 @@ public class ProdRecuperoMaterialeFragment extends BaseFragment implements ITitl
|
||||
|
||||
@Override
|
||||
public void onLUPrintError(Exception ex, Runnable onComplete) {
|
||||
this.closeProgress();
|
||||
this.onLoadingEnded();
|
||||
DialogSimpleMessageView.makeErrorDialog(
|
||||
new SpannableString(ex.getMessage()),
|
||||
null,
|
||||
|
||||
@@ -110,10 +110,10 @@ public class ProdRientroMerceOrderDetailFragment extends BaseFragment implements
|
||||
private void initRecyclerView() {
|
||||
mBindings.mainList.setNestedScrollingEnabled(false);
|
||||
mBindings.mainList.setHasFixedSize(true);
|
||||
mBindings.mainList.setLayoutManager(new LinearLayoutManager(getActivity()));
|
||||
mBindings.mainList.setLayoutManager(new LinearLayoutManager(requireActivity()));
|
||||
|
||||
SimpleDividerItemDecoration itemDecorator = new SimpleDividerItemDecoration(getActivity(), SimpleDividerItemDecoration.VERTICAL);
|
||||
itemDecorator.setDrawable(ContextCompat.getDrawable(getActivity(), R.drawable.divider));
|
||||
SimpleDividerItemDecoration itemDecorator = new SimpleDividerItemDecoration(requireActivity(), SimpleDividerItemDecoration.VERTICAL);
|
||||
itemDecorator.setDrawable(ContextCompat.getDrawable(requireActivity(), R.drawable.divider));
|
||||
mBindings.mainList.addItemDecoration(itemDecorator);
|
||||
|
||||
mAdapter = new ProdRientroMerceOrderDetailMtbColtListAdapter(new ObservableArrayList<>());
|
||||
@@ -167,7 +167,7 @@ public class ProdRientroMerceOrderDetailFragment extends BaseFragment implements
|
||||
|
||||
|
||||
public void addULButtonClick() {
|
||||
this.openProgress();
|
||||
this.onLoadingStarted();
|
||||
|
||||
String codProd = this.currentOrder.getValue().getCodProd();
|
||||
mArticoloRESTConsumer.getByCodMart(codProd, mtbAart -> {
|
||||
@@ -188,7 +188,7 @@ public class ProdRientroMerceOrderDetailFragment extends BaseFragment implements
|
||||
|
||||
mSystemRESTConsumer.<List<DtbOrdSteps>>processSql(sql, new TypeToken<ArrayList<DtbOrdSteps>>() {}.getType(), dtbOrdStep -> {
|
||||
|
||||
this.closeProgress();
|
||||
this.onLoadingEnded();
|
||||
|
||||
DialogInputLUProdDTO dialogInputLUProdDTO = new DialogInputLUProdDTO()
|
||||
.setMtbAart(mtbAart)
|
||||
@@ -216,9 +216,9 @@ public class ProdRientroMerceOrderDetailFragment extends BaseFragment implements
|
||||
|
||||
this.mViewModel.createLU(pickedQuantityDTO);
|
||||
}, () -> {
|
||||
this.closeProgress();
|
||||
this.onLoadingEnded();
|
||||
})
|
||||
.show(getActivity().getSupportFragmentManager(), "tag");
|
||||
.show(requireActivity().getSupportFragmentManager(), "tag");
|
||||
|
||||
}, this::onError);
|
||||
|
||||
@@ -248,63 +248,63 @@ public class ProdRientroMerceOrderDetailFragment extends BaseFragment implements
|
||||
if (currentOrder.getValue() != null) {
|
||||
switch (currentOrder.getValue().getStatoEnum()) {
|
||||
case IN_CORSO:
|
||||
return ContextCompat.getDrawable(getActivity(), R.drawable.ic_play_circle_filled_24dp);
|
||||
return ContextCompat.getDrawable(requireActivity(), R.drawable.ic_play_circle_filled_24dp);
|
||||
case PAUSA:
|
||||
return ContextCompat.getDrawable(getActivity(), R.drawable.ic_pause_circle_filled_24dp);
|
||||
return ContextCompat.getDrawable(requireActivity(), R.drawable.ic_pause_circle_filled_24dp);
|
||||
case PROGRAMMATO:
|
||||
default:
|
||||
return ContextCompat.getDrawable(getActivity(), R.drawable.ic_clock_circle_outline_24dp);
|
||||
return ContextCompat.getDrawable(requireActivity(), R.drawable.ic_clock_circle_outline_24dp);
|
||||
}
|
||||
}
|
||||
else
|
||||
return ContextCompat.getDrawable(getActivity(), R.drawable.ic_clock_circle_outline_24dp);
|
||||
return ContextCompat.getDrawable(requireActivity(), R.drawable.ic_clock_circle_outline_24dp);
|
||||
}
|
||||
|
||||
public Integer getOrderStatusIconTintColor() {
|
||||
if (currentOrder.getValue() != null) {
|
||||
switch (currentOrder.getValue().getStatoEnum()) {
|
||||
case IN_CORSO:
|
||||
return ContextCompat.getColor(getActivity(), R.color.green_800);
|
||||
return ContextCompat.getColor(requireActivity(), R.color.green_800);
|
||||
case PAUSA:
|
||||
return ContextCompat.getColor(getActivity(), R.color.yellow_800);
|
||||
return ContextCompat.getColor(requireActivity(), R.color.yellow_800);
|
||||
case PROGRAMMATO:
|
||||
default:
|
||||
return ContextCompat.getColor(getActivity(), R.color.blue_800);
|
||||
return ContextCompat.getColor(requireActivity(), R.color.blue_800);
|
||||
}
|
||||
}
|
||||
else
|
||||
return ContextCompat.getColor(getActivity(), R.color.blue_800);
|
||||
return ContextCompat.getColor(requireActivity(), R.color.blue_800);
|
||||
}
|
||||
|
||||
public Drawable getOrderStatusLabelBackgroud() {
|
||||
if (currentOrder.getValue() != null) {
|
||||
switch (currentOrder.getValue().getStatoEnum()) {
|
||||
case IN_CORSO:
|
||||
return ContextCompat.getDrawable(getActivity(), R.drawable.label_success_text);
|
||||
return ContextCompat.getDrawable(requireActivity(), R.drawable.label_success_text);
|
||||
case PAUSA:
|
||||
return ContextCompat.getDrawable(getActivity(), R.drawable.label_warning_text);
|
||||
return ContextCompat.getDrawable(requireActivity(), R.drawable.label_warning_text);
|
||||
case PROGRAMMATO:
|
||||
default:
|
||||
return ContextCompat.getDrawable(getActivity(), R.drawable.label_primary_text);
|
||||
return ContextCompat.getDrawable(requireActivity(), R.drawable.label_primary_text);
|
||||
}
|
||||
}
|
||||
else
|
||||
return ContextCompat.getDrawable(getActivity(), R.drawable.label_primary_text);
|
||||
return ContextCompat.getDrawable(requireActivity(), R.drawable.label_primary_text);
|
||||
}
|
||||
|
||||
public Integer getOrderStatusLabelTextColor() {
|
||||
if (currentOrder.getValue() != null) {
|
||||
switch (currentOrder.getValue().getStatoEnum()) {
|
||||
case IN_CORSO:
|
||||
return ContextCompat.getColor(getActivity(), R.color.green_800);
|
||||
return ContextCompat.getColor(requireActivity(), R.color.green_800);
|
||||
case PAUSA:
|
||||
return ContextCompat.getColor(getActivity(), R.color.yellow_800);
|
||||
return ContextCompat.getColor(requireActivity(), R.color.yellow_800);
|
||||
case PROGRAMMATO:
|
||||
default:
|
||||
return ContextCompat.getColor(getActivity(), R.color.blue_800);
|
||||
return ContextCompat.getColor(requireActivity(), R.color.blue_800);
|
||||
}
|
||||
}
|
||||
else
|
||||
return ContextCompat.getColor(getActivity(), R.color.blue_800);
|
||||
return ContextCompat.getColor(requireActivity(), R.color.blue_800);
|
||||
}
|
||||
}
|
||||
@@ -334,7 +334,7 @@ public class ProdVersamentoMaterialeFragment extends BaseFragment implements Pro
|
||||
@Override
|
||||
public void onWarning(String warningText, Runnable action) {
|
||||
this.requireActivity().runOnUiThread(() -> {
|
||||
this.closeProgress();
|
||||
this.onLoadingEnded();
|
||||
DialogSimpleMessageView
|
||||
.makeWarningDialog(new SpannableString(Html.fromHtml(warningText)), null, action)
|
||||
.show(requireActivity().getSupportFragmentManager(), "tag");
|
||||
|
||||
@@ -10,62 +10,50 @@ import android.widget.Toast;
|
||||
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import androidx.databinding.ObservableArrayList;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import com.ravikoradiya.liveadapter.LiveAdapter;
|
||||
import com.ravikoradiya.liveadapter.Type;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
||||
import it.integry.integrywmsnative.BR;
|
||||
import it.integry.integrywmsnative.MainApplication;
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.barcode_reader.BarcodeCallbackDTO;
|
||||
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
||||
import it.integry.integrywmsnative.core.data_cache.DataCache;
|
||||
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;
|
||||
import it.integry.integrywmsnative.core.data_store.db.repository.ArticoliOrdineRepository;
|
||||
import it.integry.integrywmsnative.core.data_store.db.repository.ArticoloGrigliaRepository;
|
||||
import it.integry.integrywmsnative.core.data_store.db.repository.GrigliaRepository;
|
||||
import it.integry.integrywmsnative.core.data_store.db.repository.OrdineRepository;
|
||||
import it.integry.integrywmsnative.core.expansion.BaseActivity;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.PVOrdiniAcquistoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||
import it.integry.integrywmsnative.databinding.ActivityPvOrdineAcquistoEditBinding;
|
||||
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.dialog.EditArticoloDialog;
|
||||
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.helper.PVEditOrderHelper;
|
||||
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.ui.OrdineAcquistoArtListAdapter;
|
||||
import it.integry.integrywmsnative.databinding.FragmentPvArticoliOrdineAcquistoListSingleItemBinding;
|
||||
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.dialog.DialogEditArticoloView;
|
||||
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.ui.OrdineAcquistoArtListModel;
|
||||
import it.integry.integrywmsnative.ui.FabMenuCustomAnimations;
|
||||
import it.integry.integrywmsnative.ui.SimpleDividerItemDecoration;
|
||||
import it.integry.integrywmsnative.view.dialogs.DialogAskAction;
|
||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleInputHelper;
|
||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||
|
||||
public class PVOrdineAcquistoEditActivity extends BaseActivity {
|
||||
public class PVOrdineAcquistoEditActivity extends BaseActivity implements PVOrdineAcquistoEditViewModel.Listener {
|
||||
|
||||
private static String DATA_KEY_ORDER = "keyOrdine";
|
||||
|
||||
private Ordine mOrdine;
|
||||
private Griglia mGriglia;
|
||||
private List<ArticoloOrdine> mArticoli = new ArrayList<>();
|
||||
private PVEditOrderHelper mhelper;
|
||||
private ActivityPvOrdineAcquistoEditBinding mBinding;
|
||||
private int mBarcodeScannerIstanceID;
|
||||
private OrdineAcquistoArtListAdapter mAdapter;
|
||||
|
||||
private int barcodeScannerIstanceID;
|
||||
|
||||
@Inject
|
||||
OrdineRepository mOrdineRepository;
|
||||
@Inject
|
||||
GrigliaRepository mGrigliaRepository;
|
||||
@Inject
|
||||
ArticoliOrdineRepository mArticoliOrdineRepository;
|
||||
@Inject
|
||||
ArticoloGrigliaRepository mArticoloGrigliaRepository;
|
||||
PVOrdineAcquistoEditViewModel mViewModel;
|
||||
|
||||
private final ObservableArrayList<OrdineAcquistoArtListModel> mArticoliMutableData = new ObservableArrayList<>();
|
||||
|
||||
|
||||
public static Intent newInstance(Context context, Ordine ordine) {
|
||||
@@ -84,7 +72,6 @@ public class PVOrdineAcquistoEditActivity extends BaseActivity {
|
||||
.create()
|
||||
.inject(this);
|
||||
|
||||
mhelper = new PVEditOrderHelper(mGrigliaRepository, mArticoliOrdineRepository, mArticoloGrigliaRepository);
|
||||
|
||||
mBinding = DataBindingUtil.setContentView(this, R.layout.activity_pv_ordine_acquisto_edit);
|
||||
mBinding.setViewModel(this);
|
||||
@@ -95,25 +82,40 @@ public class PVOrdineAcquistoEditActivity extends BaseActivity {
|
||||
|
||||
if (mOrdine == null) {
|
||||
Toast.makeText(this, "Impossibile modificare ordine esportato", Toast.LENGTH_SHORT).show();
|
||||
closeEdit();
|
||||
close();
|
||||
}
|
||||
if (mOrdine.isTransmitted()) {
|
||||
Toast.makeText(this, "Impossibile modificare ordine esportato", Toast.LENGTH_SHORT).show();
|
||||
closeEdit();
|
||||
close();
|
||||
}
|
||||
String testataOrdString = String.format(this.getString(R.string.ord_acq_testata), String.valueOf(mOrdine.getOrdineId()), UtilityDate.formatDate(mOrdine.getDataIns(), UtilityDate.COMMONS_DATE_FORMATS.DMY_HUMAN));
|
||||
mBinding.orderIdentifier.setText(Html.fromHtml(testataOrdString));
|
||||
FabMenuCustomAnimations.changeIconOnFocus(mBinding.closeActivityFab, R.drawable.ic_check_white_24dp, R.drawable.ic_close_24dp);
|
||||
|
||||
|
||||
initBarcodeReader();
|
||||
initRecyclerView();
|
||||
fetchDetails();
|
||||
mBarcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
||||
.setOnScanSuccessfull(this::onScanSuccessful)
|
||||
.setOnScanFailed(this::handleException));
|
||||
|
||||
this.mViewModel.setListener(this);
|
||||
|
||||
this.mViewModel.getCurrentGriglia().observe(this, griglia -> {
|
||||
mBinding.codAlis.setText(griglia.getCodAlis());
|
||||
});
|
||||
|
||||
this.mViewModel.getArticoli().observe(this, articoli -> {
|
||||
mBinding.countArtOrd.setText(String.valueOf(articoli.size()));
|
||||
mBinding.pvOrdineExport.setVisibility(articoli.size() > 0 ? View.INVISIBLE : View.GONE);
|
||||
mBinding.closeActivityFab.close(false);
|
||||
mBinding.scanArtSpinner.setVisibility(articoli.size() > 0 ? View.GONE : View.VISIBLE);
|
||||
|
||||
if (articoli.isEmpty() && isOrderNewProdsForced()) {
|
||||
this.mViewModel.orderNewProducts();
|
||||
}
|
||||
});
|
||||
|
||||
this.mViewModel.init(mOrdine);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onSupportNavigateUp() {
|
||||
@@ -121,187 +123,131 @@ public class PVOrdineAcquistoEditActivity extends BaseActivity {
|
||||
return true;
|
||||
}
|
||||
|
||||
private void initRecyclerView() {
|
||||
mBinding.articoliOrdineList.setHasFixedSize(true);
|
||||
private void initBarcodeReader() {
|
||||
barcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
||||
.setOnScanSuccessful(onScanSuccessful)
|
||||
.setOnScanFailed(this::onError));
|
||||
|
||||
BarcodeManager.enable();
|
||||
}
|
||||
|
||||
private void initRecyclerView() {
|
||||
|
||||
var itemType = new Type<ArticoloOrdine, FragmentPvArticoliOrdineAcquistoListSingleItemBinding>(R.layout.fragment_pv_articoli_ordine_acquisto__list_single_item, BR.articolo);
|
||||
itemType.onClick(x -> {
|
||||
this.selectAction(x.getBinding().getArticolo());
|
||||
return null;
|
||||
});
|
||||
|
||||
new LiveAdapter(this.mViewModel.getArticoli(), this)
|
||||
.map(ArticoloOrdine.class, itemType)
|
||||
.into(mBinding.articoliOrdineList);
|
||||
|
||||
mBinding.articoliOrdineList.setHasFixedSize(true);
|
||||
mBinding.articoliOrdineList.setLayoutManager(new LinearLayoutManager(this));
|
||||
|
||||
SimpleDividerItemDecoration itemDecorator = new SimpleDividerItemDecoration(this, SimpleDividerItemDecoration.VERTICAL);
|
||||
itemDecorator.setDrawable(ContextCompat.getDrawable(this, R.drawable.divider));
|
||||
mBinding.articoliOrdineList.addItemDecoration(itemDecorator);
|
||||
mAdapter = new OrdineAcquistoArtListAdapter(this, mArticoli, this::selectAction);
|
||||
mBinding.articoliOrdineList.setAdapter(mAdapter);
|
||||
}
|
||||
|
||||
|
||||
private void selectAction(ArticoloOrdine articoloOrdine) {
|
||||
mBinding.closeActivityFab.close(false);
|
||||
BarcodeManager.disable();
|
||||
runOnUiThread(() -> DialogAskAction.make(this,
|
||||
articoloOrdine.getDescrizione(),
|
||||
articoloOrdine.getQtaOrd() + " " + articoloOrdine.getUntMis(),
|
||||
() -> this.addArticolo(articoloOrdine),
|
||||
() -> this.deleteArticolo(articoloOrdine)).show());
|
||||
runOnUiThread(() -> {
|
||||
DialogAskAction.make(this,
|
||||
articoloOrdine.getDescrizione(),
|
||||
articoloOrdine.getQtaOrd() + " " + articoloOrdine.getUntMis(),
|
||||
() -> {
|
||||
this.mViewModel.checkArticolo(mOrdine, articoloOrdine.getCodMart(),
|
||||
artOrd -> {
|
||||
this.onItemDispatched(artOrd);
|
||||
BarcodeManager.enable();
|
||||
},
|
||||
this::onError);
|
||||
BarcodeManager.enable();
|
||||
},
|
||||
() -> {
|
||||
this.deleteArticolo(articoloOrdine);
|
||||
BarcodeManager.enable();
|
||||
}).show();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void deleteArticolo(ArticoloOrdine articoloOrdine) {
|
||||
String text = "Stai per eliminare l'articolo <b> " + articoloOrdine.getDescrizione() + "</b> dall'ordine, <br> sei sicuro?";
|
||||
|
||||
DialogSimpleMessageView.makeWarningDialog(new SpannableString(Html.fromHtml(text)), null, () -> this.runOnUiThread(() -> {
|
||||
this.openProgress();
|
||||
mhelper.removeArticoloFromOrdine(articoloOrdine, () -> {
|
||||
this.closeProgress();
|
||||
BarcodeManager.enable();
|
||||
runOnUiThread(this::fetchArticoli);
|
||||
}, e -> {
|
||||
this.closeProgress();
|
||||
runOnUiThread(() -> UtilityExceptions.defaultException(this, e));
|
||||
});
|
||||
}), () -> {
|
||||
DialogSimpleMessageView.makeWarningDialog(new SpannableString(Html.fromHtml(text)), null, () -> {
|
||||
this.mViewModel.deleteArticolo(articoloOrdine);
|
||||
}, () -> {
|
||||
|
||||
}).show(getSupportFragmentManager(), "tag");
|
||||
}
|
||||
|
||||
private void handleException(Exception ex) {
|
||||
runOnUiThread(() -> {
|
||||
this.closeProgress();
|
||||
BarcodeManager.enable();
|
||||
UtilityExceptions.defaultException(this, ex, false);
|
||||
private final RunnableArgs<BarcodeScanDTO> onScanSuccessful = data -> {
|
||||
mBinding.closeActivityFab.close(false);
|
||||
this.onLoadingStarted();
|
||||
|
||||
this.mViewModel.processBarcodeDTO(data, this::onLoadingEnded);
|
||||
|
||||
};
|
||||
|
||||
@Override
|
||||
public void onItemDispatched(ArticoloOrdine articoloOrdine) {
|
||||
|
||||
DialogEditArticoloView
|
||||
.newInstance(articoloOrdine, articolo -> {
|
||||
runOnUiThread(() -> {
|
||||
if (articolo != null) {
|
||||
Toast.makeText(this, "Articolo aggiunto all'ordine!", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
this.mViewModel.saveArticolo(articolo);
|
||||
});
|
||||
}, () -> {
|
||||
|
||||
}).show(this.getSupportFragmentManager(), "tag");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColorFromResource(int resId) {
|
||||
return getResources().getColor(resId);
|
||||
}
|
||||
|
||||
|
||||
public void exportOrdine() {
|
||||
this.mViewModel.exportOrdine(() -> {
|
||||
runOnUiThread(() -> {
|
||||
Toast.makeText(this, "Ordine salvato con successo", Toast.LENGTH_SHORT).show();
|
||||
close();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private void onScanSuccessful(BarcodeScanDTO dto) {
|
||||
mBinding.closeActivityFab.close(false);
|
||||
BarcodeManager.disable();
|
||||
this.openProgress();
|
||||
mhelper.checkArticolo(
|
||||
mOrdine,
|
||||
dto.getStringValue(),
|
||||
articoloOrdine -> {
|
||||
this.closeProgress();
|
||||
addArticolo(articoloOrdine);
|
||||
},
|
||||
e -> {
|
||||
this.closeProgress();
|
||||
handleException(e);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
private void addArticolo(ArticoloOrdine articoloOrdine) {
|
||||
|
||||
runOnUiThread(() -> EditArticoloDialog.newInstance(this, mhelper, articoloOrdine, articolo -> {
|
||||
BarcodeManager.enable();
|
||||
if (articolo != null) {
|
||||
Toast.makeText(this, "Articolo aggiunto all'ordine!", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
fetchArticoli();
|
||||
}).show(this.getSupportFragmentManager(), "tag"));
|
||||
}
|
||||
|
||||
private void fetchDetails() {
|
||||
fetchGriglia();
|
||||
fetchArticoli();
|
||||
}
|
||||
|
||||
private void orderNewProducts() {
|
||||
this.openProgress();
|
||||
mhelper.getNewArticoli(mOrdine.getIdGriglia(), articoli -> {
|
||||
if (articoli != null && !articoli.isEmpty()) {
|
||||
List<ArticoloOrdine> articoliToSave = new ArrayList<>();
|
||||
Stream.of(articoli).forEach(articolo -> {
|
||||
if (
|
||||
Stream.of(mArticoli).filter(x -> x.getCodMart().equalsIgnoreCase(articolo.getCodMart())).findFirst().isEmpty()
|
||||
&& Stream.of(articoliToSave).filter(x -> x.getCodMart().equalsIgnoreCase(articolo.getCodMart())).findFirst().isEmpty()
|
||||
) {
|
||||
ArticoloOrdine dto = articolo.convertToArticoloOrdine(mOrdine);
|
||||
dto.setQtaOrd(dto.getQtaCnf());
|
||||
articoliToSave.add(dto);
|
||||
}
|
||||
});
|
||||
if (!articoliToSave.isEmpty()) {
|
||||
mhelper.saveArticoliToOrdine(articoliToSave, this::fetchArticoli, this::handleException);
|
||||
} else {
|
||||
this.closeProgress();
|
||||
}
|
||||
} else {
|
||||
this.closeProgress();
|
||||
}
|
||||
}, this::handleException);
|
||||
}
|
||||
|
||||
private void fetchGriglia() {
|
||||
mhelper.loadGriglia(mOrdine.getIdGriglia(), griglia -> {
|
||||
runOnUiThread(() -> {
|
||||
mGriglia = griglia;
|
||||
mBinding.codAlis.setText(mGriglia.getCodAlis());
|
||||
});
|
||||
}, this::handleException);
|
||||
}
|
||||
|
||||
private void fetchArticoli() {
|
||||
this.openProgress();
|
||||
mhelper.loadArticoli(mOrdine, articoli -> {
|
||||
this.closeProgress();
|
||||
mArticoli = articoli;
|
||||
runOnUiThread(() -> {
|
||||
mAdapter.updateItems(mArticoli);
|
||||
mBinding.countArtOrd.setText(String.valueOf(mArticoli.size()));
|
||||
mBinding.pvOrdineExport.setVisibility(mArticoli.size() > 0 ? View.INVISIBLE : View.GONE);
|
||||
mBinding.closeActivityFab.close(false);
|
||||
mBinding.scanArtSpinner.setVisibility(mArticoli.size() > 0 ? View.GONE : View.VISIBLE);
|
||||
if (mArticoli.isEmpty() && isOrderNewProdsForced()) {
|
||||
orderNewProducts();
|
||||
}
|
||||
});
|
||||
}, this::handleException);
|
||||
}
|
||||
|
||||
public void closeEdit() {
|
||||
public void close() {
|
||||
onBackPressed();
|
||||
}
|
||||
|
||||
public void exportOrdine() {
|
||||
this.openProgress();
|
||||
PVOrdiniAcquistoRESTConsumer.saveOrdine(mOrdine, mArticoli, mGriglia, (ordine) -> {
|
||||
|
||||
mOrdineRepository.updateOrder(ordine, ord -> {
|
||||
this.closeProgress();
|
||||
runOnUiThread(() -> {
|
||||
Toast.makeText(this, "Ordine salvato con successo", Toast.LENGTH_SHORT).show();
|
||||
onBackPressed();
|
||||
});
|
||||
}, e -> runOnUiThread(() -> {
|
||||
this.closeProgress();
|
||||
UtilityExceptions.defaultException(this, e);
|
||||
}));
|
||||
|
||||
}, e -> runOnUiThread(() -> {
|
||||
this.closeProgress();
|
||||
UtilityExceptions.defaultException(this, e);
|
||||
}));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
BarcodeManager.removeCallback(mBarcodeScannerIstanceID);
|
||||
BarcodeManager.removeCallback(barcodeScannerIstanceID);
|
||||
super.onBackPressed();
|
||||
}
|
||||
|
||||
public void manualSearch() {
|
||||
BarcodeManager.disable();
|
||||
DialogSimpleInputHelper.makeInputDialog(this, "Inserisci il codice a barre/codice articolo da cercare", codice -> {
|
||||
this.openProgress();
|
||||
mhelper.checkArticolo(
|
||||
mOrdine,
|
||||
codice,
|
||||
this.onLoadingStarted();
|
||||
this.mViewModel.checkArticolo(mOrdine, codice,
|
||||
articoloOrdine -> {
|
||||
this.closeProgress();
|
||||
addArticolo(articoloOrdine);
|
||||
this.onItemDispatched(articoloOrdine);
|
||||
this.onLoadingEnded();
|
||||
BarcodeManager.enable();
|
||||
},
|
||||
e -> {
|
||||
this.closeProgress();
|
||||
handleException(e);
|
||||
}
|
||||
this::onError
|
||||
);
|
||||
}, BarcodeManager::enable).show();
|
||||
}
|
||||
@@ -309,4 +255,5 @@ public class PVOrdineAcquistoEditActivity extends BaseActivity {
|
||||
private boolean isOrderNewProdsForced() {
|
||||
return SettingsManager.iDB().getFlagOrdinaNuoviArticoliInGriglia();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,33 @@
|
||||
package it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
import it.integry.integrywmsnative.core.data_store.db.repository.ArticoliOrdineRepository;
|
||||
import it.integry.integrywmsnative.core.data_store.db.repository.ArticoloGrigliaRepository;
|
||||
import it.integry.integrywmsnative.core.data_store.db.repository.GrigliaRepository;
|
||||
import it.integry.integrywmsnative.core.data_store.db.repository.OrdineRepository;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.PVOrdiniAcquistoRESTConsumer;
|
||||
|
||||
@Module(subcomponents = PVOrdineAcquistoEditComponent.class)
|
||||
public class PVOrdineAcquistoEditModule {
|
||||
|
||||
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
PVOrdiniAcquistoRESTConsumer providesPVOrdiniAcquistoRESTConsumer() {
|
||||
return new PVOrdiniAcquistoRESTConsumer();
|
||||
}
|
||||
|
||||
@Provides
|
||||
PVOrdineAcquistoEditViewModel providesPvOrdineAcquistoEditViewModel(OrdineRepository ordineRepository,
|
||||
GrigliaRepository grigliaRepository,
|
||||
ArticoliOrdineRepository articoliOrdineRepository,
|
||||
ArticoloGrigliaRepository articoloGrigliaRepository,
|
||||
PVOrdiniAcquistoRESTConsumer pvOrdiniAcquistoRESTConsumer) {
|
||||
return new PVOrdineAcquistoEditViewModel(ordineRepository, grigliaRepository, articoliOrdineRepository, articoloGrigliaRepository, pvOrdiniAcquistoRESTConsumer);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,286 @@
|
||||
package it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit;
|
||||
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
||||
import it.integry.integrywmsnative.R;
|
||||
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.Griglia;
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.Ordine;
|
||||
import it.integry.integrywmsnative.core.data_store.db.repository.ArticoliOrdineRepository;
|
||||
import it.integry.integrywmsnative.core.data_store.db.repository.ArticoloGrigliaRepository;
|
||||
import it.integry.integrywmsnative.core.data_store.db.repository.GrigliaRepository;
|
||||
import it.integry.integrywmsnative.core.data_store.db.repository.OrdineRepository;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.PVOrdiniAcquistoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
|
||||
public class PVOrdineAcquistoEditViewModel {
|
||||
|
||||
@Inject
|
||||
OrdineRepository mOrdineRepository;
|
||||
|
||||
@Inject
|
||||
GrigliaRepository mGrigliaRepository;
|
||||
|
||||
@Inject
|
||||
ArticoliOrdineRepository mArticoliOrdineRepository;
|
||||
|
||||
@Inject
|
||||
ArticoloGrigliaRepository mArticoloGrigliaRepository;
|
||||
|
||||
@Inject
|
||||
PVOrdiniAcquistoRESTConsumer pvOrdiniAcquistoRESTConsumer;
|
||||
|
||||
private Ordine mCurrentOrdine;
|
||||
|
||||
|
||||
private Listener mListener;
|
||||
|
||||
|
||||
private final MutableLiveData<Griglia> mCurrentGriglia = new MutableLiveData<>();
|
||||
private final MutableLiveData<List<ArticoloOrdine>> mArticoli = new MutableLiveData<>();
|
||||
|
||||
|
||||
public PVOrdineAcquistoEditViewModel(OrdineRepository ordineRepository,
|
||||
GrigliaRepository grigliaRepository,
|
||||
ArticoliOrdineRepository articoliOrdineRepository,
|
||||
ArticoloGrigliaRepository articoloGrigliaRepository,
|
||||
PVOrdiniAcquistoRESTConsumer pvOrdiniAcquistoRESTConsumer) {
|
||||
this.mOrdineRepository = ordineRepository;
|
||||
this.mGrigliaRepository = grigliaRepository;
|
||||
this.mArticoliOrdineRepository = articoliOrdineRepository;
|
||||
this.mArticoloGrigliaRepository = articoloGrigliaRepository;
|
||||
this.pvOrdiniAcquistoRESTConsumer = pvOrdiniAcquistoRESTConsumer;
|
||||
}
|
||||
|
||||
public void init(Ordine ordine) {
|
||||
this.mCurrentOrdine = ordine;
|
||||
|
||||
this.sendOnLoadingStarted();
|
||||
|
||||
this.loadGriglia(ordine.getIdGriglia(), griglia -> {
|
||||
mCurrentGriglia.postValue(griglia);
|
||||
this.loadArticoli(mCurrentOrdine, articoli -> {
|
||||
articoli = Stream.of(articoli).map(this::setBgTint).toList();
|
||||
this.mArticoli.postValue(articoli);
|
||||
this.sendOnLoadingEnded();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private ArticoloOrdine setBgTint(ArticoloOrdine art) {
|
||||
int chk = art.checkQtaProposta();
|
||||
switch (chk) {
|
||||
case -1:
|
||||
art.setBgTint(this.mListener.getColorFromResource(R.color.red_600));
|
||||
break;
|
||||
case 1:
|
||||
art.setBgTint(this.mListener.getColorFromResource(R.color.orange_600));
|
||||
break;
|
||||
default:
|
||||
art.setBgTint(this.mListener.getColorFromResource(R.color.colorPrimary));
|
||||
}
|
||||
return art;
|
||||
}
|
||||
|
||||
public MutableLiveData<Griglia> getCurrentGriglia() {
|
||||
return mCurrentGriglia;
|
||||
}
|
||||
|
||||
public MutableLiveData<List<ArticoloOrdine>> getArticoli() {
|
||||
return mArticoli;
|
||||
}
|
||||
|
||||
public void saveArticolo(ArticoloOrdine articolo) {
|
||||
setBgTint(articolo);
|
||||
var newList = this.mArticoli.getValue();
|
||||
|
||||
var alreadySavedItem = Stream.of(newList)
|
||||
.filter(x -> Objects.equals(x.getCodMart(), articolo.getCodMart()))
|
||||
.findFirst();
|
||||
|
||||
if (alreadySavedItem.isPresent()) newList.remove(alreadySavedItem.get());
|
||||
|
||||
newList.add(articolo);
|
||||
this.mArticoli.postValue(newList);
|
||||
}
|
||||
|
||||
|
||||
public void processBarcodeDTO(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
||||
this.checkArticolo(
|
||||
mCurrentOrdine,
|
||||
barcodeScanDTO.getStringValue(),
|
||||
articoloOrdine -> {
|
||||
this.sendOnItemDispatched(articoloOrdine);
|
||||
onComplete.run();
|
||||
},
|
||||
this::sendError
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
private void loadGriglia(int idGriglia, RunnableArgs<Griglia> onLoad) {
|
||||
try {
|
||||
mGrigliaRepository.findGrigliaById(idGriglia, onLoad, this::sendError);
|
||||
} catch (Exception e) {
|
||||
this.sendError(e);
|
||||
}
|
||||
}
|
||||
|
||||
private void loadArticoli(Ordine ordine, RunnableArgs<List<ArticoloOrdine>> onLoad) {
|
||||
try {
|
||||
mArticoliOrdineRepository.findArticoliByOrdine(ordine, onLoad, this::sendError);
|
||||
} catch (Exception e) {
|
||||
this.sendError(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void checkArticolo(Ordine ordine, String barcode, RunnableArgs<ArticoloOrdine> onSuccess, RunnableArgs<Exception> onFail) {
|
||||
try {
|
||||
mArticoloGrigliaRepository.findArticoloByScanAndGriglia(barcode, ordine.getIdGriglia(), artGrid -> {
|
||||
if (artGrid != null) {
|
||||
mArticoliOrdineRepository.findArticoloByScanAndOrdine(ordine, barcode, (articolo) -> {
|
||||
if (articolo != null) {
|
||||
articolo
|
||||
.setQtaPrevistaVendita(BigDecimal.valueOf(artGrid.getQtaPrevistaVendita()))
|
||||
.setQtaProposta(BigDecimal.valueOf(artGrid.getQtaProposta()))
|
||||
.setGiacenza(BigDecimal.valueOf(artGrid.getGiacenza()))
|
||||
.setMediaSett(artGrid.getMediaSett());
|
||||
|
||||
articolo.setQtaMinOrdinabile(artGrid.getQtaMinOrdinabile());
|
||||
articolo.setMerceDaRic(artGrid.getMerceDaRic());
|
||||
articolo.setNewNoPromo(artGrid.isNewNoPromo());
|
||||
articolo.setFlagQtaMultipla(artGrid.getFlagQtaMultipla());
|
||||
|
||||
onSuccess.run(articolo);
|
||||
} else {
|
||||
ArticoloOrdine art = artGrid.convertToArticoloOrdine(ordine);
|
||||
if (isAutoOrderOnScan()) {
|
||||
art.setQtaOrd(art.getQtaCnf());
|
||||
mArticoliOrdineRepository.saveArticoloToOrdine(art, () -> {
|
||||
saveArticolo(art);
|
||||
this.sendOnLoadingEnded();
|
||||
|
||||
}, this::sendError);
|
||||
} else {
|
||||
onSuccess.run(art);
|
||||
}
|
||||
}
|
||||
}, onFail);
|
||||
|
||||
} else {
|
||||
onFail.run(new Exception("L' articolo ( " + barcode + " ) non è presente nella griglia"));
|
||||
}
|
||||
}, onFail);
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
onFail.run(e);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isAutoOrderOnScan() {
|
||||
return SettingsManager.iDB().getFlagOrdinaNuoviArticoliInGriglia();
|
||||
}
|
||||
|
||||
private void getNewArticoli(int idGrigla, RunnableArgs<List<ArticoloGriglia>> onSuccess, RunnableArgs<Exception> onError) {
|
||||
mArticoloGrigliaRepository.findNewArticoliInGrigla(idGrigla, onSuccess, onError);
|
||||
}
|
||||
|
||||
public void orderNewProducts() {
|
||||
this.sendOnLoadingStarted();
|
||||
|
||||
this.getNewArticoli(mCurrentOrdine.getIdGriglia(), articoli -> {
|
||||
if (articoli != null && !articoli.isEmpty()) {
|
||||
List<ArticoloOrdine> articoliToSave = new ArrayList<>();
|
||||
|
||||
Stream.of(articoli).forEach(articolo -> {
|
||||
if (
|
||||
Stream.of(mArticoli.getValue())
|
||||
.filter(x -> x.getCodMart().equalsIgnoreCase(articolo.getCodMart()))
|
||||
.findFirst()
|
||||
.isEmpty()
|
||||
|
||||
&& Stream.of(articoliToSave)
|
||||
.filter(x -> x.getCodMart().equalsIgnoreCase(articolo.getCodMart()))
|
||||
.findFirst()
|
||||
.isEmpty()
|
||||
) {
|
||||
ArticoloOrdine dto = articolo.convertToArticoloOrdine(mCurrentOrdine);
|
||||
dto.setQtaOrd(dto.getQtaCnf());
|
||||
articoliToSave.add(dto);
|
||||
}
|
||||
});
|
||||
if (!articoliToSave.isEmpty()) {
|
||||
mArticoliOrdineRepository.saveArticoliToOrdine(articoliToSave, () -> {
|
||||
Stream.of(articoliToSave).forEach(this::saveArticolo);
|
||||
|
||||
this.sendOnLoadingEnded();
|
||||
|
||||
}, this::sendError);
|
||||
|
||||
} else this.sendOnLoadingEnded();
|
||||
} else this.sendOnLoadingEnded();
|
||||
}, this::sendError);
|
||||
}
|
||||
|
||||
public void deleteArticolo(ArticoloOrdine articoloOrdine) {
|
||||
mArticoliOrdineRepository.deleteArticolo(articoloOrdine, () -> {
|
||||
this.mArticoli.getValue().remove(articoloOrdine);
|
||||
this.mArticoli.postValue(this.mArticoli.getValue());
|
||||
}, this::sendError);
|
||||
}
|
||||
|
||||
public void exportOrdine(Runnable onComplete) {
|
||||
this.sendOnLoadingStarted();
|
||||
pvOrdiniAcquistoRESTConsumer.saveOrdine(mCurrentOrdine, mArticoli.getValue(), mCurrentGriglia.getValue(), (ordine) -> {
|
||||
|
||||
mOrdineRepository.updateOrder(ordine, ord -> {
|
||||
this.sendOnLoadingEnded();
|
||||
onComplete.run();
|
||||
}, this::sendError);
|
||||
|
||||
}, this::sendError);
|
||||
}
|
||||
|
||||
private void sendOnItemDispatched(ArticoloOrdine articoloOrdine) {
|
||||
if (this.mListener != null) mListener.onItemDispatched(articoloOrdine);
|
||||
}
|
||||
|
||||
private void sendOnLoadingStarted() {
|
||||
if (this.mListener != null) mListener.onLoadingStarted();
|
||||
}
|
||||
|
||||
private void sendOnLoadingEnded() {
|
||||
if (this.mListener != null) mListener.onLoadingEnded();
|
||||
}
|
||||
|
||||
private void sendError(Exception ex) {
|
||||
if (this.mListener != null) mListener.onError(ex);
|
||||
}
|
||||
|
||||
public interface Listener extends ILoadingListener {
|
||||
void onItemDispatched(ArticoloOrdine articoloOrdine);
|
||||
|
||||
int getColorFromResource(int resId);
|
||||
|
||||
void onError(Exception ex);
|
||||
}
|
||||
|
||||
public PVOrdineAcquistoEditViewModel setListener(Listener listener) {
|
||||
this.mListener = listener;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.dialog;
|
||||
|
||||
import dagger.Subcomponent;
|
||||
|
||||
@Subcomponent
|
||||
public interface DialogEditArticoloComponent {
|
||||
|
||||
@Subcomponent.Factory
|
||||
interface Factory {
|
||||
DialogEditArticoloComponent create();
|
||||
}
|
||||
|
||||
void inject(DialogEditArticoloView dialogEditArticoloView);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.dialog;
|
||||
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
import it.integry.integrywmsnative.core.data_store.db.repository.ArticoliOrdineRepository;
|
||||
|
||||
@Module(subcomponents = DialogEditArticoloComponent.class)
|
||||
public class DialogEditArticoloModule {
|
||||
|
||||
|
||||
@Provides
|
||||
DialogEditArticoloViewModel providesDialogEditArticoloViewModel(ArticoliOrdineRepository articoliOrdineRepository) {
|
||||
return new DialogEditArticoloViewModel(articoliOrdineRepository);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,180 @@
|
||||
package it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.dialog;
|
||||
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Bundle;
|
||||
import android.text.InputType;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import androidx.databinding.ObservableField;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import it.integry.integrywmsnative.MainApplication;
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.ArticoloOrdine;
|
||||
import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityBigDecimal;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityObservable;
|
||||
import it.integry.integrywmsnative.databinding.DialogPvEditArticoloBinding;
|
||||
|
||||
public class DialogEditArticoloView extends BaseDialogFragment implements DialogEditArticoloViewModel.Listener {
|
||||
|
||||
@Inject
|
||||
DialogEditArticoloViewModel mViewModel;
|
||||
|
||||
private final ArticoloOrdine mArticolo;
|
||||
private final RunnableArgs<ArticoloOrdine> mOnComplete;
|
||||
private final Runnable mOnAbort;
|
||||
|
||||
public ObservableField<BigDecimal> currentNumCnf = new ObservableField<>();
|
||||
public ObservableField<BigDecimal> currentQtaCnf = new ObservableField<>();
|
||||
public ObservableField<BigDecimal> currentQtaTot = new ObservableField<>();
|
||||
|
||||
private DialogPvEditArticoloBinding mBindings;
|
||||
private boolean mEnableDataCallback = true;
|
||||
|
||||
public static DialogEditArticoloView newInstance(ArticoloOrdine articolo, RunnableArgs<ArticoloOrdine> onComplete, Runnable onAbort) {
|
||||
return new DialogEditArticoloView(articolo, onComplete, onAbort);
|
||||
}
|
||||
|
||||
private DialogEditArticoloView(ArticoloOrdine articolo, RunnableArgs<ArticoloOrdine> onComplete, Runnable onAbort) {
|
||||
super();
|
||||
|
||||
this.mArticolo = articolo;
|
||||
this.mOnComplete = onComplete;
|
||||
this.mOnAbort = onAbort;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
mBindings = DataBindingUtil.inflate(inflater, R.layout.dialog_pv_edit_articolo, container, false);
|
||||
mBindings.setLifecycleOwner(this);
|
||||
|
||||
MainApplication.appComponent
|
||||
.dialogEditArticoloComponent()
|
||||
.create()
|
||||
.inject(this);
|
||||
|
||||
getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||
getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
|
||||
|
||||
mBindings.toolbar.setTitle("Inserimento articolo");
|
||||
mBindings.inputQtaOrd.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL);
|
||||
|
||||
|
||||
this.mViewModel
|
||||
.setListener(this)
|
||||
.setCurrentArticolo(this.mArticolo)
|
||||
.setInitialQtaCnf(BigDecimal.valueOf(mArticolo.getQtaCnf()))
|
||||
.setInitialNumCnf(UtilityBigDecimal.divide(BigDecimal.valueOf(mArticolo.getQtaOrd()), BigDecimal.valueOf(mArticolo.getQtaCnf())).setScale(0, RoundingMode.CEILING))
|
||||
.setInitialQtaTot(BigDecimal.valueOf(mArticolo.getQtaOrd()));
|
||||
|
||||
mBindings.setView(this);
|
||||
|
||||
this.onDataChanged();
|
||||
|
||||
this.initBindings();
|
||||
|
||||
return mBindings.getRoot();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setStyle(DialogFragment.STYLE_NORMAL, R.style.AppTheme_NewMaterial_Dialog_FullscreenDialog);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
|
||||
this.mViewModel.setListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDismiss(@NonNull DialogInterface dialog) {
|
||||
this.mOnAbort.run();
|
||||
super.onDismiss(dialog);
|
||||
}
|
||||
|
||||
private void initBindings() {
|
||||
|
||||
UtilityObservable.addPropertyChanged(this.currentNumCnf, (value) -> {
|
||||
if (this.mEnableDataCallback) {
|
||||
this.mViewModel.setNumCnf(value);
|
||||
}
|
||||
});
|
||||
|
||||
UtilityObservable.addPropertyChanged(this.currentQtaCnf, (value) -> {
|
||||
if (this.mEnableDataCallback) {
|
||||
this.mViewModel.setQtaCnf(value);
|
||||
}
|
||||
});
|
||||
|
||||
UtilityObservable.addPropertyChanged(this.currentQtaTot, (value) -> {
|
||||
if (this.mEnableDataCallback) {
|
||||
this.mViewModel.setQtaTot(value);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
mBindings.inputQtaOrd.setOnEditorActionListener((v, actionId, event) -> {
|
||||
if (actionId == EditorInfo.IME_ACTION_DONE) {
|
||||
mBindings.inputNumCnfText.requestFocus();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
mBindings.inputNumCnfText.setOnEditorActionListener((v, actionId, event) -> {
|
||||
if (actionId == EditorInfo.IME_ACTION_DONE) {
|
||||
saveAndExit();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
public ArticoloOrdine getArticolo() {
|
||||
return mArticolo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataChanged() {
|
||||
this.mEnableDataCallback = false;
|
||||
|
||||
this.currentNumCnf.set(this.mViewModel.getNumCnf());
|
||||
this.currentQtaCnf.set(this.mViewModel.getQtaCnf());
|
||||
this.currentQtaTot.set(this.mViewModel.getQtaTot());
|
||||
|
||||
this.mBindings.executePendingBindings();
|
||||
|
||||
this.mEnableDataCallback = true;
|
||||
}
|
||||
|
||||
|
||||
public void saveAndExit() {
|
||||
this.onLoadingStarted();
|
||||
|
||||
this.mViewModel.save(newArticolo -> {
|
||||
this.mOnComplete.run(newArticolo);
|
||||
this.onLoadingEnded();
|
||||
dismiss();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
package it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.dialog;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.ArticoloOrdine;
|
||||
import it.integry.integrywmsnative.core.data_store.db.repository.ArticoliOrdineRepository;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityBigDecimal;
|
||||
|
||||
public class DialogEditArticoloViewModel {
|
||||
|
||||
ArticoliOrdineRepository mArticoliOrdineRepository;
|
||||
|
||||
private Listener mListener;
|
||||
|
||||
private ArticoloOrdine mCurrentArticolo;
|
||||
|
||||
private BigDecimal internalNumCnf;
|
||||
private BigDecimal internalQtaCnf;
|
||||
private BigDecimal internalQtaTot;
|
||||
|
||||
@Inject
|
||||
public DialogEditArticoloViewModel(ArticoliOrdineRepository articoliOrdineRepository) {
|
||||
this.mArticoliOrdineRepository = articoliOrdineRepository;
|
||||
}
|
||||
|
||||
public DialogEditArticoloViewModel setCurrentArticolo(ArticoloOrdine currentArticolo) {
|
||||
this.mCurrentArticolo = currentArticolo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DialogEditArticoloViewModel setInitialNumCnf(BigDecimal numCnf) {
|
||||
this.internalNumCnf = numCnf;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DialogEditArticoloViewModel setInitialQtaCnf(BigDecimal qtaCnf) {
|
||||
this.internalQtaCnf = qtaCnf;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DialogEditArticoloViewModel setInitialQtaTot(BigDecimal qtaTot) {
|
||||
this.internalQtaTot = qtaTot;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setNumCnf(BigDecimal newValue) {
|
||||
this.internalNumCnf = newValue;
|
||||
if (newValue == null) return;
|
||||
|
||||
this.internalQtaTot = UtilityBigDecimal.multiply(newValue, internalQtaCnf)
|
||||
.setScale(2, RoundingMode.CEILING);
|
||||
|
||||
this.mListener.onDataChanged();
|
||||
}
|
||||
|
||||
public void setQtaCnf(BigDecimal newValue) {
|
||||
this.internalQtaCnf = newValue;
|
||||
if (newValue == null) return;
|
||||
|
||||
this.mListener.onDataChanged();
|
||||
}
|
||||
|
||||
public void setQtaTot(BigDecimal newValue) {
|
||||
this.internalQtaTot = newValue;
|
||||
if (newValue == null) return;
|
||||
this.internalNumCnf = UtilityBigDecimal.divide(newValue, internalQtaCnf)
|
||||
.setScale(0, RoundingMode.CEILING);
|
||||
|
||||
this.mListener.onDataChanged();
|
||||
}
|
||||
|
||||
public BigDecimal getNumCnf() {
|
||||
return this.internalNumCnf;
|
||||
}
|
||||
|
||||
public BigDecimal getQtaCnf() {
|
||||
return this.internalQtaCnf;
|
||||
}
|
||||
|
||||
public BigDecimal getQtaTot() {
|
||||
return this.internalQtaTot;
|
||||
}
|
||||
|
||||
|
||||
public interface Listener {
|
||||
void onDataChanged();
|
||||
|
||||
void onError(Exception ex);
|
||||
}
|
||||
|
||||
|
||||
public Listener getListener() {
|
||||
return mListener;
|
||||
}
|
||||
|
||||
public DialogEditArticoloViewModel setListener(Listener listener) {
|
||||
this.mListener = listener;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public void save(RunnableArgs<ArticoloOrdine> onComplete) {
|
||||
if (UtilityBigDecimal.equalsOrLowerThan(this.internalQtaTot, BigDecimal.ZERO)) {
|
||||
this.mListener.onError(new Exception("La quantità ordinata deve essere maggiore di 0"));
|
||||
return;
|
||||
}
|
||||
|
||||
this.mCurrentArticolo.setQtaOrd(this.internalQtaTot.floatValue());
|
||||
|
||||
try {
|
||||
mArticoliOrdineRepository.saveArticoloToOrdine(this.mCurrentArticolo, () -> {
|
||||
onComplete.run(this.mCurrentArticolo);
|
||||
}, this.mListener::onError);
|
||||
} catch (Exception ex) {
|
||||
this.mListener.onError(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,188 +0,0 @@
|
||||
package it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.dialog;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Bundle;
|
||||
import android.text.InputType;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.ArticoloOrdine;
|
||||
import it.integry.integrywmsnative.core.di.BindableBigDecimal;
|
||||
import it.integry.integrywmsnative.core.di.BindableInteger;
|
||||
import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||
import it.integry.integrywmsnative.databinding.DialogPvEditArticoloBinding;
|
||||
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.helper.PVEditOrderHelper;
|
||||
|
||||
public class EditArticoloDialog extends BaseDialogFragment {
|
||||
|
||||
private final Activity mContext;
|
||||
private DialogPvEditArticoloBinding mBinding;
|
||||
private final PVEditOrderHelper mHelper;
|
||||
private final MutableLiveData<ArticoloOrdine> mArticolo = new MutableLiveData<>();
|
||||
private final RunnableArgs<ArticoloOrdine> onDialogDismiss;
|
||||
private boolean mLockedInput = false;
|
||||
|
||||
public final BindableBigDecimal qtaOrd = new BindableBigDecimal(BigDecimal.ZERO);
|
||||
public final BindableInteger numCnf = new BindableInteger(0);
|
||||
public final BindableBigDecimal qtaCnf = new BindableBigDecimal(BigDecimal.ZERO);
|
||||
|
||||
public static EditArticoloDialog newInstance(Activity context, PVEditOrderHelper helper, ArticoloOrdine articolo, RunnableArgs<ArticoloOrdine> onDialogDismiss) {
|
||||
return new EditArticoloDialog(context, helper, articolo, onDialogDismiss);
|
||||
}
|
||||
|
||||
private EditArticoloDialog(Activity context, PVEditOrderHelper helper, ArticoloOrdine articolo, RunnableArgs<ArticoloOrdine> onDialogDismiss) {
|
||||
mContext = context;
|
||||
mArticolo.setValue(articolo);
|
||||
mHelper = helper;
|
||||
qtaOrd.set(BigDecimal.valueOf(articolo.getQtaOrd()));
|
||||
numCnf.set(BigDecimal.valueOf(articolo.getQtaOrd()).divide(BigDecimal.valueOf(articolo.getQtaCnf()), 0, RoundingMode.CEILING).intValue());
|
||||
qtaCnf.set(BigDecimal.valueOf(articolo.getQtaCnf()));
|
||||
|
||||
this.onDialogDismiss = onDialogDismiss;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setStyle(DialogFragment.STYLE_NORMAL, R.style.AppTheme_NewMaterial_Dialog_FullscreenDialog);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDismiss(@NonNull DialogInterface dialog) {
|
||||
super.onDismiss(dialog);
|
||||
/*ArticoloOrdine articolo = mArticolo.getValue();
|
||||
if (articolo != null && articolo.getQtaOrd() <= 0f) {
|
||||
articolo = null;
|
||||
}
|
||||
onDialogDismiss.run(articolo);*/
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
mBinding = DataBindingUtil.inflate(inflater, R.layout.dialog_pv_edit_articolo, null, false);
|
||||
mBinding.setView(this);
|
||||
mBinding.toolbar.setTitle("Inserimento articolo");
|
||||
mBinding.inputQtaOrd.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL);
|
||||
getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
|
||||
getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||
initBindings();
|
||||
return mBinding.getRoot();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
}
|
||||
|
||||
private void initBindings() {
|
||||
|
||||
BindableBigDecimal.registerListener(qtaOrd, qta -> {
|
||||
if (!mLockedInput) {
|
||||
mLockedInput = true;
|
||||
|
||||
ArticoloOrdine articoloOrdine = mArticolo.getValue();
|
||||
BigDecimal qtaCnf = BigDecimal.valueOf(articoloOrdine.getQtaCnf());
|
||||
int cnf = 0;
|
||||
if (qtaOrd.get() != null && qtaOrd.get().compareTo(BigDecimal.ZERO) > 0) {
|
||||
cnf = qtaOrd.get().divide(qtaCnf, 0, RoundingMode.CEILING).intValue();
|
||||
}
|
||||
this.numCnf.set(cnf);
|
||||
this.mBinding.executePendingBindings();
|
||||
|
||||
mLockedInput = false;
|
||||
}
|
||||
});
|
||||
BindableInteger.registerListener(numCnf, qta -> {
|
||||
if (!mLockedInput) {
|
||||
mLockedInput = true;
|
||||
|
||||
ArticoloOrdine articoloOrdine = mArticolo.getValue();
|
||||
BigDecimal qtaCnf = BigDecimal.valueOf(articoloOrdine.getQtaCnf());
|
||||
this.qtaOrd.set(BigDecimal.valueOf(numCnf.get() * qtaCnf.floatValue()).setScale(2, RoundingMode.CEILING));
|
||||
this.mBinding.executePendingBindings();
|
||||
|
||||
mLockedInput = false;
|
||||
}
|
||||
});
|
||||
mBinding.inputQtaOrd.setOnEditorActionListener((v, actionId, event) -> {
|
||||
if (actionId == EditorInfo.IME_ACTION_DONE) {
|
||||
// saveAndExit();
|
||||
mBinding.inputNumCnfText.requestFocus();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
mBinding.inputNumCnfText.setOnEditorActionListener((v, actionId, event) -> {
|
||||
if (actionId == EditorInfo.IME_ACTION_DONE) {
|
||||
saveAndExit();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
public void saveAndExit() {
|
||||
this.onLoadingStarted();
|
||||
try {
|
||||
ArticoloOrdine articolo = mArticolo.getValue();
|
||||
if (articolo == null) {
|
||||
throw new Exception("Articolo non valido");
|
||||
}
|
||||
if (qtaOrd.get().compareTo(BigDecimal.ZERO) <= 0) {
|
||||
throw new Exception("La quantità ordinata deve essere maggiore di 0");
|
||||
}
|
||||
|
||||
articolo.setQtaOrd(qtaOrd.get().floatValue());
|
||||
mArticolo.setValue(articolo);
|
||||
mHelper.saveArticoloToOrdine(mArticolo.getValue(), () -> {
|
||||
this.onLoadingEnded();
|
||||
requireActivity().runOnUiThread(() -> {
|
||||
onDialogDismiss.run(articolo);
|
||||
});
|
||||
this.dismiss();
|
||||
}, e -> {
|
||||
mContext.runOnUiThread(() -> UtilityExceptions.defaultException(mContext, e));
|
||||
this.onLoadingEnded();
|
||||
});
|
||||
} catch (Exception e) {
|
||||
mContext.runOnUiThread(() -> UtilityExceptions.defaultException(mContext, e));
|
||||
this.onLoadingEnded();
|
||||
return;
|
||||
}
|
||||
;
|
||||
}
|
||||
|
||||
public ArticoloOrdine getArticolo() {
|
||||
return mArticolo.getValue();
|
||||
}
|
||||
|
||||
public void cancel() {
|
||||
mArticolo.postValue(null);
|
||||
requireActivity().runOnUiThread(() -> {
|
||||
onDialogDismiss.run(null);
|
||||
});
|
||||
this.dismiss();
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,6 @@ 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.Griglia;
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.Ordine;
|
||||
import it.integry.integrywmsnative.core.data_store.db.repository.ArticoliOrdineRepository;
|
||||
import it.integry.integrywmsnative.core.data_store.db.repository.ArticoloGrigliaRepository;
|
||||
@@ -43,26 +42,6 @@ public class PVEditOrderHelper {
|
||||
}
|
||||
}
|
||||
|
||||
public void loadGriglia(int idGriglia, RunnableArgs<Griglia> onLoad, RunnableArgs<Exception> onError) {
|
||||
try {
|
||||
mGrigliaRepository.findGrigliaById(idGriglia, onLoad, onError);
|
||||
} catch (Exception e) {
|
||||
onError.run(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void loadArticoli(Ordine ordine, RunnableArgs<List<ArticoloOrdine>> onLoad, RunnableArgs<Exception> onError) {
|
||||
try {
|
||||
mArticoliOrdineRepository.findArticoliByOrdine(ordine, onLoad, onError);
|
||||
} catch (Exception e) {
|
||||
onError.run(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void saveArticoloToOrdine(ArticoloOrdine articolo, Runnable onSave, RunnableArgs<Exception> onFail) {
|
||||
mArticoliOrdineRepository.saveArticoloToOrdine(articolo, onSave, onFail);
|
||||
}
|
||||
|
||||
public void saveArticoliToOrdine(List<ArticoloOrdine> articoli, Runnable onSave, RunnableArgs<Exception> onFail) {
|
||||
mArticoliOrdineRepository.saveArticoliToOrdine(articoli, onSave, onFail);
|
||||
|
||||
@@ -5,17 +5,19 @@ import android.view.LayoutInflater;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import androidx.databinding.ObservableArrayList;
|
||||
import androidx.databinding.ObservableList;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
import com.zhukic.sectionedrecyclerview.SectionedRecyclerViewAdapter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.ArticoloOrdine;
|
||||
import it.integry.integrywmsnative.core.expansion.OnListGeneralChangedCallback;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||
import it.integry.integrywmsnative.databinding.FragmentPvArticoliOrdineAcquistoListSingleItemBinding;
|
||||
import it.integry.integrywmsnative.databinding.FragmentPvOrdiniAcquistoListHeaderBinding;
|
||||
import it.integry.integrywmsnative.ui.fastscroll.SectionTitleProvider;
|
||||
@@ -23,9 +25,10 @@ import it.integry.integrywmsnative.ui.fastscroll.SectionTitleProvider;
|
||||
public class OrdineAcquistoArtListAdapter extends SectionedRecyclerViewAdapter<OrdineAcquistoArtListAdapter.SubheaderHolder, OrdineAcquistoArtListAdapter.SingleItemViewHolder> implements SectionTitleProvider {
|
||||
|
||||
|
||||
private Context mContext;
|
||||
private final Context mContext;
|
||||
|
||||
private final List<OrdineAcquistoArtListModel> mDataset = new ArrayList<>();
|
||||
|
||||
private List<ArticoloOrdine> mDataset;
|
||||
RunnableArgs<ArticoloOrdine> mOnItemSelect;
|
||||
|
||||
|
||||
@@ -51,28 +54,26 @@ public class OrdineAcquistoArtListAdapter extends SectionedRecyclerViewAdapter<O
|
||||
}
|
||||
|
||||
|
||||
public OrdineAcquistoArtListAdapter(Context context, List<ArticoloOrdine> myDataset, RunnableArgs<ArticoloOrdine> onItemSelect) {
|
||||
public OrdineAcquistoArtListAdapter(Context context, ObservableArrayList<OrdineAcquistoArtListModel> myDataset) {
|
||||
mContext = context;
|
||||
mDataset = orderItems(myDataset);
|
||||
mOnItemSelect = onItemSelect;
|
||||
|
||||
myDataset.addOnListChangedCallback(new OnListGeneralChangedCallback() {
|
||||
@Override
|
||||
public void onChanged(ObservableList sender) {
|
||||
mDataset.clear();
|
||||
mDataset.addAll(sender);
|
||||
notifyDataSetChanged();
|
||||
notifyDataChanged();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void updateItems(List<ArticoloOrdine> updatedDataset) {
|
||||
mDataset.clear();
|
||||
mDataset.addAll(orderItems(updatedDataset));
|
||||
notifyDataSetChanged();
|
||||
notifyDataChanged();
|
||||
public OrdineAcquistoArtListAdapter setOnItemClicked(RunnableArgs<ArticoloOrdine> onItemSelect) {
|
||||
this.mOnItemSelect = onItemSelect;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
private List<ArticoloOrdine> orderItems(List<ArticoloOrdine> dataset) {
|
||||
return Stream.of(dataset)
|
||||
.distinctBy(ArticoloOrdine::getArticoloOrdineId)
|
||||
.sortBy(x -> UtilityDate.formatDate(x.getDataIns(), UtilityDate.COMMONS_DATE_FORMATS.YMD_SLASH))
|
||||
.toList();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public SubheaderHolder onCreateSubheaderViewHolder(ViewGroup parent, int viewType) {
|
||||
@@ -94,7 +95,7 @@ public class OrdineAcquistoArtListAdapter extends SectionedRecyclerViewAdapter<O
|
||||
|
||||
@Override
|
||||
public void onBindItemViewHolder(OrdineAcquistoArtListAdapter.SingleItemViewHolder h, int itemPosition) {
|
||||
final ArticoloOrdine articoloOrdine = mDataset.get(itemPosition);
|
||||
final ArticoloOrdine articoloOrdine = mDataset.get(itemPosition).getOriginalModel();
|
||||
final OrdineAcquistoArtListAdapter.SingleItemViewHolder holder = h;
|
||||
|
||||
holder.binding.setArticolo(articoloOrdine);
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
package it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.ui;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.ArticoloOrdine;
|
||||
|
||||
public class OrdineAcquistoArtListModel {
|
||||
|
||||
private String badge1;
|
||||
private String description;
|
||||
private BigDecimal quantity;
|
||||
private String untMis;
|
||||
|
||||
private ArticoloOrdine originalModel;
|
||||
|
||||
public String getBadge1() {
|
||||
return badge1;
|
||||
}
|
||||
|
||||
public OrdineAcquistoArtListModel setBadge1(String badge1) {
|
||||
this.badge1 = badge1;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public OrdineAcquistoArtListModel setDescription(String description) {
|
||||
this.description = description;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getQuantity() {
|
||||
return quantity;
|
||||
}
|
||||
|
||||
public OrdineAcquistoArtListModel setQuantity(BigDecimal quantity) {
|
||||
this.quantity = quantity;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getUntMis() {
|
||||
return untMis;
|
||||
}
|
||||
|
||||
public OrdineAcquistoArtListModel setUntMis(String untMis) {
|
||||
this.untMis = untMis;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ArticoloOrdine getOriginalModel() {
|
||||
return originalModel;
|
||||
}
|
||||
|
||||
public OrdineAcquistoArtListModel setOriginalModel(ArticoloOrdine originalModel) {
|
||||
this.originalModel = originalModel;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -66,7 +66,7 @@ public class DialogScanLisA {
|
||||
private void initBarcode() {
|
||||
|
||||
int barcodeIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
||||
.setOnScanSuccessfull(onScanSuccessfull)
|
||||
.setOnScanSuccessful(onScanSuccessfull)
|
||||
.setOnScanFailed(ex -> UtilityExceptions.defaultException(mContext, ex, false)));
|
||||
|
||||
mDialog.setBarcodeListener(true);
|
||||
|
||||
@@ -40,8 +40,8 @@ public class OrdineAcquistoPvHelper {
|
||||
updateGriglia(griglia, onSave, onFail);
|
||||
}
|
||||
|
||||
public void updateGriglia(Griglia griglia, RunnableArgs<Griglia> onSave, RunnableArgs<Exception> onFail) {
|
||||
PVOrdiniAcquistoRESTConsumer.getArticoliListino(griglia.getCodAlis(), dto -> {
|
||||
public void updateGriglia(Griglia griglia, RunnableArgs<Griglia> onSaved, RunnableArgs<Exception> onFail) {
|
||||
PVOrdiniAcquistoRESTConsumer.getArticoliListinoStatic(griglia.getCodAlis(), dto -> {
|
||||
mContext.runOnUiThread(() -> {
|
||||
if (dto.getGrigliaAcquistiChild().size() <= 0) {
|
||||
onFail.run(new Exception("La griglia selezionata (" + griglia.getCodAlis() + ") non esiste o non presenta articoli"));
|
||||
@@ -50,7 +50,13 @@ public class OrdineAcquistoPvHelper {
|
||||
griglia.setDescrLisa(dto.getDescrLisa());
|
||||
griglia.setDescrDepo(dto.getDescrDepo());
|
||||
griglia.setCountArticoli(dto.getGrigliaAcquistiChild().size());
|
||||
mGrigliaRepository.saveGriglia(griglia, id -> saveLisAToGriglia(dto.getGrigliaAcquistiChild(), griglia, onSave, onFail), onFail);
|
||||
|
||||
|
||||
mGrigliaRepository.saveGriglia(griglia, id -> {
|
||||
saveLisAToGriglia(dto.getGrigliaAcquistiChild(), griglia, grigliaResult -> {
|
||||
onSaved.run(grigliaResult);
|
||||
}, onFail);
|
||||
}, onFail);
|
||||
});
|
||||
}, onFail);
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ public class RettificaGiacenzeFragment extends BaseFragment implements ITitledFr
|
||||
|
||||
private void initBarcodeReader() {
|
||||
barcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
||||
.setOnScanSuccessfull(onScanSuccessful)
|
||||
.setOnScanSuccessful(onScanSuccessful)
|
||||
.setOnScanFailed(ex -> UtilityExceptions.defaultException(getActivity(), ex, false)));
|
||||
}
|
||||
|
||||
@@ -214,13 +214,10 @@ public class RettificaGiacenzeFragment extends BaseFragment implements ITitledFr
|
||||
|
||||
|
||||
private final RunnableArgs<BarcodeScanDTO> onScanSuccessful = data -> {
|
||||
BarcodeManager.disable();
|
||||
|
||||
this.openProgress();
|
||||
this.onLoadingStarted();
|
||||
|
||||
this.mViewModel.processBarcodeDTO(data, () -> {
|
||||
BarcodeManager.enable();
|
||||
this.closeProgress();
|
||||
this.onLoadingEnded();
|
||||
});
|
||||
};
|
||||
|
||||
@@ -334,12 +331,12 @@ public class RettificaGiacenzeFragment extends BaseFragment implements ITitledFr
|
||||
() -> onComplete.run(true),
|
||||
() -> onComplete.run(false)
|
||||
)
|
||||
.show(getActivity().getSupportFragmentManager(), "tag");
|
||||
.show(requireActivity().getSupportFragmentManager(), "tag");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Exception ex) {
|
||||
this.closeProgress();
|
||||
this.onLoadingEnded();
|
||||
|
||||
if (ex instanceof InvalidPesoKGException) {
|
||||
UtilityToast.showToast(ex.getMessage());
|
||||
@@ -391,11 +388,11 @@ public class RettificaGiacenzeFragment extends BaseFragment implements ITitledFr
|
||||
.setPartitaMag(resultDTO.getPartitaMag())
|
||||
.setDataScad(resultDTO.getDataScad());
|
||||
|
||||
this.openProgress();
|
||||
this.onLoadingStarted();
|
||||
onComplete.run(pickedQuantityDTO, shouldCloseLU);
|
||||
})
|
||||
.setOnAbort(() -> {
|
||||
this.closeProgress();
|
||||
this.onLoadingEnded();
|
||||
})
|
||||
.show(requireActivity().getSupportFragmentManager(), "tag");
|
||||
}
|
||||
|
||||
@@ -150,13 +150,14 @@ public class RettificaGiacenzeViewModel {
|
||||
barcodeProd = UtilityBarcode.convertITF14toEAN13(barcodeProd);
|
||||
}
|
||||
|
||||
String finalBarcodeProd = barcodeProd;
|
||||
this.mArticoloRESTConsumer.getByBarcodeProd(barcodeProd, mtbAartList -> {
|
||||
if (onComplete != null) onComplete.run();
|
||||
|
||||
if (mtbAartList != null && mtbAartList.size() > 0) {
|
||||
this.dispatchArt(mtbAartList.get(0), pickData);
|
||||
} else {
|
||||
this.sendError(new NoResultFromBarcodeException());
|
||||
this.sendError(new NoResultFromBarcodeException(finalBarcodeProd));
|
||||
}
|
||||
|
||||
}, this::sendError);
|
||||
|
||||
@@ -204,7 +204,7 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
||||
boolean shouldAskPesoLU = SettingsManager.iDB().isFlagAskPesoColloSpedizione();
|
||||
boolean useQtaOrd = SettingsManager.iDB().isFlagSpedizioneUseQtaOrd();
|
||||
|
||||
if (!mEnableFakeGiacenza) this.openProgress();
|
||||
if (!mEnableFakeGiacenza) this.onLoadingStarted();
|
||||
mViewmodel.init(
|
||||
codMdep,
|
||||
!mEnableFakeGiacenza,
|
||||
@@ -249,7 +249,7 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
||||
|
||||
private void initBarcodeReader() {
|
||||
barcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
||||
.setOnScanSuccessfull(onScanSuccessful)
|
||||
.setOnScanSuccessful(onScanSuccessful)
|
||||
.setOnScanFailed(this::onError));
|
||||
|
||||
BarcodeManager.enable();
|
||||
@@ -622,13 +622,10 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
||||
|
||||
|
||||
private final RunnableArgs<BarcodeScanDTO> onScanSuccessful = data -> {
|
||||
BarcodeManager.disable();
|
||||
|
||||
this.openProgress();
|
||||
this.onLoadingStarted();
|
||||
|
||||
this.mViewmodel.processBarcodeDTO(data, () -> {
|
||||
BarcodeManager.enable();
|
||||
this.closeProgress();
|
||||
this.onLoadingEnded();
|
||||
});
|
||||
};
|
||||
|
||||
@@ -660,10 +657,10 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
||||
public void createNewUL() {
|
||||
this.mBindings.spedizioneFab.close(true);
|
||||
|
||||
this.openProgress();
|
||||
this.onLoadingStarted();
|
||||
|
||||
this.mViewmodel.createNewLU(null, null, () -> {
|
||||
this.closeProgress();
|
||||
this.onLoadingEnded();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -683,16 +680,6 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
||||
this.mViewmodel.closeOrder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadingStarted() {
|
||||
this.openProgress();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadingEnded() {
|
||||
this.closeProgress();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLUOpened(MtbColt mtbColt) {
|
||||
this.addExtraItemsEnabled.set(SettingsManager.iDB().isFlagCanAddExtraItemSpedizione());
|
||||
@@ -737,7 +724,7 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
||||
|
||||
@Override
|
||||
public void onLUPrintError(Exception ex, Runnable onComplete) {
|
||||
this.closeProgress();
|
||||
this.onLoadingEnded();
|
||||
DialogSimpleMessageView.makeErrorDialog(
|
||||
new SpannableString(ex.getMessage()),
|
||||
null,
|
||||
@@ -773,7 +760,7 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
||||
|
||||
@Override
|
||||
public void onError(Exception ex) {
|
||||
this.closeProgress();
|
||||
this.onLoadingEnded();
|
||||
|
||||
if (ex instanceof InvalidPesoKGException) {
|
||||
UtilityToast.showToast(ex.getMessage());
|
||||
@@ -834,7 +821,7 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
||||
.setPartitaMag(resultDTO.getPartitaMag())
|
||||
.setDataScad(resultDTO.getDataScad());
|
||||
|
||||
this.openProgress();
|
||||
this.onLoadingStarted();
|
||||
onComplete.run(pickedQuantityDTO, shouldCloseLU);
|
||||
})
|
||||
.setOnAbort(() -> {
|
||||
|
||||
@@ -78,7 +78,7 @@ public class SpedizioneViewModel {
|
||||
private GestioneEnum mDefaultGestioneOfUL = null;
|
||||
private int mDefaultSegnoCol = -1;
|
||||
private String mDefaultCodMdep = null;
|
||||
private List<FiltroOrdineDTO> mDefaultFiltroOrdine = new ArrayList<>();
|
||||
private final List<FiltroOrdineDTO> mDefaultFiltroOrdine = new ArrayList<>();
|
||||
private String mDefaultCodAnagOfUL = null;
|
||||
private String mDefaultRagSocOfUL = null;
|
||||
private String mDefaultRifOrdOfUL = null;
|
||||
@@ -626,12 +626,13 @@ public class SpedizioneViewModel {
|
||||
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);
|
||||
@@ -708,6 +709,7 @@ public class SpedizioneViewModel {
|
||||
|
||||
List<PickingObjectDTO> matchPickingObject = Stream.of(pickingList)
|
||||
.filter(x -> UtilityString.equalsIgnoreCase(mtbAart.getCodMart(), x.getSitArtOrdDTO().getCodMart()))
|
||||
.filter(x -> x.getSitArtOrdDTO().isFlagEnableScanArt())
|
||||
.filter(x -> {
|
||||
MtbPartitaMag mtbPartitaMag = pickData != null && pickData.getManualPickDTO() != null && pickData.getManualPickDTO().getMtbPartitaMag() != null ? pickData.getManualPickDTO().getMtbPartitaMag() : null;
|
||||
return !mEnableCheckPartitaMag || (mtbPartitaMag != null && UtilityString.equalsIgnoreCase(x.getSitArtOrdDTO().getPartitaMag(), mtbPartitaMag.getPartitaMag()));
|
||||
@@ -742,8 +744,8 @@ public class SpedizioneViewModel {
|
||||
this.getPickingList().postValue(pickingList);
|
||||
} else {
|
||||
MtbColt refMtbColt = matchedItem.getRefMtbColt();
|
||||
MtbColr refMtbColr = refMtbColt != null ? matchedItem.getRefMtbColt().getMtbColr().get(0) : null;
|
||||
this.dispatchOrdineRow(matchedItem, refMtbColt, refMtbColr, false);
|
||||
MtbColr refMtbColr = refMtbColt != null ? refMtbColt.getMtbColr().get(0) : null;
|
||||
this.dispatchOrdineRow(matchedItem, refMtbColt, refMtbColr, refMtbColr == null);
|
||||
}
|
||||
|
||||
} else {
|
||||
@@ -1317,8 +1319,7 @@ public class SpedizioneViewModel {
|
||||
|
||||
public void createNewLU(Integer customNumCollo, String customSerCollo, Runnable onComplete) {
|
||||
MtbColt mtbColt = new MtbColt();
|
||||
mtbColt.initDefaultFields();
|
||||
mtbColt.setGestione(mDefaultGestioneOfUL)
|
||||
mtbColt.initDefaultFields(mDefaultGestioneOfUL)
|
||||
.setSegno(mDefaultSegnoCol)
|
||||
.setRifOrd(mDefaultRifOrdOfUL)
|
||||
.setNumOrd(mDefaultNumOrdOfUL)
|
||||
@@ -1748,13 +1749,17 @@ public class SpedizioneViewModel {
|
||||
|
||||
|
||||
public void recoverLU(MtbColt mtbColt) {
|
||||
this.sendOnLoadingStarted();
|
||||
this.mCurrentMtbColt = mtbColt;
|
||||
mMtbColtSessionID = this.mColliDataRecoverService.startNewSession(mtbColt, mTestateOrdini);
|
||||
|
||||
this.mCurrentMtbColt.generaFiltroOrdineFromDTO(mDefaultFiltroOrdine);
|
||||
|
||||
this.resetMatchedRows();
|
||||
this.sendLUOpened(this.mCurrentMtbColt);
|
||||
this.mColliMagazzinoRESTConsumer.saveCollo(this.mCurrentMtbColt, savedMtbColt -> {
|
||||
this.resetMatchedRows();
|
||||
this.sendLUOpened(this.mCurrentMtbColt);
|
||||
this.sendOnLoadingEnded();
|
||||
}, this::sendError);
|
||||
}
|
||||
|
||||
private void postCloseOperations(List<MtbColt> mtbColtList) {
|
||||
|
||||
@@ -125,6 +125,7 @@ public class SpedizioneListAdapter extends SectionedRecyclerViewAdapter<Spedizio
|
||||
holder.mBinding.deactivatedOverBg.setVisibility(!pickingObjectDTO.isActive() ? View.VISIBLE : View.GONE);
|
||||
holder.mBinding.getRoot().setAlpha(!pickingObjectDTO.isActive() ? 0.8f : 1);
|
||||
holder.mBinding.badge1.setBackground(ResourcesCompat.getDrawable(mContext.getResources(), !pickingObjectDTO.isActive() ? R.drawable.badge_round_corner : R.drawable.badge1_round_corner, null));
|
||||
holder.mBinding.badge1.setTextColor(ResourcesCompat.getColor(mContext.getResources(), !pickingObjectDTO.isActive() ? R.color.gray_600 : R.color.white, null));
|
||||
holder.mBinding.qtaEvasa.setTextColor(ResourcesCompat.getColor(mContext.getResources(), !pickingObjectDTO.isActive() ? R.color.gray_600 : R.color.green_700, null));
|
||||
|
||||
holder.mBinding.descrizione.setText(pickingObjectDTO.getDescrizione());
|
||||
|
||||
@@ -138,7 +138,7 @@ public class UltimeConsegneClienteFragment extends BaseFragment implements Ultim
|
||||
|
||||
private void initBarcodeReader() {
|
||||
barcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
||||
.setOnScanSuccessfull(onScanSuccessful)
|
||||
.setOnScanSuccessful(onScanSuccessful)
|
||||
.setOnScanFailed(ex -> UtilityExceptions.defaultException(getActivity(), ex, false)));
|
||||
|
||||
BarcodeManager.enable();
|
||||
@@ -158,7 +158,7 @@ public class UltimeConsegneClienteFragment extends BaseFragment implements Ultim
|
||||
}
|
||||
|
||||
private void refreshItems() {
|
||||
this.openProgress();
|
||||
this.onLoadingStarted();
|
||||
|
||||
String currentAnagFilter = mAppliedFilterViewModel != null ? mAppliedFilterViewModel.ragSoc.get() : null;
|
||||
String currentCodAnagFilter = null;
|
||||
@@ -247,22 +247,4 @@ public class UltimeConsegneClienteFragment extends BaseFragment implements Ultim
|
||||
this.mOnPreDestroyList.add(onPreDestroy);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadingStarted() {
|
||||
BarcodeManager.disable();
|
||||
this.openProgress();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadingEnded() {
|
||||
this.closeProgress();
|
||||
BarcodeManager.enable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Exception ex) {
|
||||
this.closeProgress();
|
||||
UtilityExceptions.defaultException(getActivity(), ex, mCurrentProgress);
|
||||
BarcodeManager.enable();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ public class UltimiArriviFornitoreFragment extends BaseFragment implements ITitl
|
||||
|
||||
private void initBarcodeReader() {
|
||||
barcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
||||
.setOnScanSuccessfull(onScanSuccessful)
|
||||
.setOnScanSuccessful(onScanSuccessful)
|
||||
.setOnScanFailed(ex -> UtilityExceptions.defaultException(getActivity(), ex, false)));
|
||||
|
||||
BarcodeManager.enable();
|
||||
@@ -163,7 +163,7 @@ public class UltimiArriviFornitoreFragment extends BaseFragment implements ITitl
|
||||
}
|
||||
|
||||
private void filterItems(List<MtbAart> filteredMtbAarts) {
|
||||
this.openProgress();
|
||||
this.onLoadingStarted();
|
||||
|
||||
String currentAnagFilter = mAppliedFilterViewModel != null ? mAppliedFilterViewModel.ragSoc.get() : null;
|
||||
String currentCodAnagFilter = null;
|
||||
@@ -252,25 +252,6 @@ public class UltimiArriviFornitoreFragment extends BaseFragment implements ITitl
|
||||
this.mOnPreDestroyList.add(onPreDestroy);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadingStarted() {
|
||||
BarcodeManager.disable();
|
||||
this.openProgress();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadingEnded() {
|
||||
this.closeProgress();
|
||||
BarcodeManager.enable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Exception ex) {
|
||||
this.closeProgress();
|
||||
UtilityExceptions.defaultException(getActivity(), ex, mCurrentProgress);
|
||||
BarcodeManager.enable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMtbColtScanned(MtbColt scannedMtbColt) {
|
||||
|
||||
|
||||
@@ -117,25 +117,23 @@ public class VersamentoMerceFragment extends BaseFragment implements ITitledFrag
|
||||
null, this::openLU)
|
||||
.show(getActivity().getSupportFragmentManager(), "tag");
|
||||
}
|
||||
}).show(getActivity().getSupportFragmentManager(), "tag");
|
||||
}).show(requireActivity().getSupportFragmentManager(), "tag");
|
||||
}
|
||||
|
||||
|
||||
private void initBarcodeReader() {
|
||||
barcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
||||
.setOnScanSuccessfull(onScanSuccessful)
|
||||
.setOnScanSuccessful(onScanSuccessful)
|
||||
.setOnScanFailed(ex -> UtilityExceptions.defaultException(getActivity(), ex, false)));
|
||||
|
||||
BarcodeManager.enable();
|
||||
}
|
||||
|
||||
private final RunnableArgs<BarcodeScanDTO> onScanSuccessful = data -> {
|
||||
BarcodeManager.disable();
|
||||
this.openProgress();
|
||||
this.onLoadingStarted();
|
||||
|
||||
this.mViewModel.processBarcodeDTO(data, () -> {
|
||||
BarcodeManager.enable();
|
||||
this.closeProgress();
|
||||
this.onLoadingEnded();
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -54,20 +54,15 @@ public class VersamentoMerceViewModel {
|
||||
|
||||
|
||||
public void processBarcodeDTO(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
||||
|
||||
new Thread(() -> {
|
||||
if (UtilityBarcode.isEtichettaPosizione(barcodeScanDTO, false)) {
|
||||
this.executeEtichettaPosizione(barcodeScanDTO, onComplete);
|
||||
} else if (UtilityBarcode.isEtichettaAnonima(barcodeScanDTO)) {
|
||||
this.executeEtichettaLU(barcodeScanDTO.getStringValue(), true, onComplete);
|
||||
} else if (UtilityBarcode.isEtichetta128(barcodeScanDTO)) {
|
||||
this.executeEtichettaEan128(barcodeScanDTO, onComplete);
|
||||
} else {
|
||||
onComplete.run();
|
||||
}
|
||||
}).start();
|
||||
|
||||
|
||||
if (UtilityBarcode.isEtichettaPosizione(barcodeScanDTO, false)) {
|
||||
this.executeEtichettaPosizione(barcodeScanDTO, onComplete);
|
||||
} else if (UtilityBarcode.isEtichettaAnonima(barcodeScanDTO)) {
|
||||
this.executeEtichettaLU(barcodeScanDTO.getStringValue(), true, onComplete);
|
||||
} else if (UtilityBarcode.isEtichetta128(barcodeScanDTO)) {
|
||||
this.executeEtichettaEan128(barcodeScanDTO, onComplete);
|
||||
} else {
|
||||
onComplete.run();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -84,9 +79,8 @@ public class VersamentoMerceViewModel {
|
||||
} else if (mtbColtList.size() == 1) {
|
||||
mColliMagazzinoRESTConsumer.getByTestata(mtbColtList.get(0), true, false, mtbColt -> {
|
||||
|
||||
onComplete.run();
|
||||
//TAKE HERE
|
||||
pickMerceULtoUL(mtbColt);
|
||||
pickMerceULtoUL(mtbColt, onComplete);
|
||||
|
||||
}, this::sendError);
|
||||
} else {
|
||||
@@ -97,14 +91,22 @@ public class VersamentoMerceViewModel {
|
||||
|
||||
if (!UtilityString.equalsIgnoreCase(mCurrentMtbColt.getValue().getCodMdep(), foundPosizione.getCodMdep())) {
|
||||
this.sendOnSpostamentoTraDepConfirmRequired(mCurrentMtbColt.getValue().getCodMdep(), foundPosizione.getCodMdep(), canContinue -> {
|
||||
onComplete.run();
|
||||
if (canContinue) {
|
||||
updatePosizione(foundPosizione, UtilityPosizione.isPosizioneWithLivello(foundPosizione));
|
||||
} else {
|
||||
onComplete.run();
|
||||
if (UtilityPosizione.isPosizioneWithLivello(foundPosizione)) {
|
||||
askLivelloPosizione(foundPosizione);
|
||||
} else {
|
||||
updatePosizione(foundPosizione);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
updatePosizione(foundPosizione, UtilityPosizione.isPosizioneWithLivello(foundPosizione));
|
||||
onComplete.run();
|
||||
if (UtilityPosizione.isPosizioneWithLivello(foundPosizione)) {
|
||||
askLivelloPosizione(foundPosizione);
|
||||
} else {
|
||||
updatePosizione(foundPosizione);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -150,12 +152,11 @@ public class VersamentoMerceViewModel {
|
||||
if (mtbColt == null) {
|
||||
this.mColliMagazzinoRESTConsumer.createColloFromEtichettaAnonima(sscc, GestioneEnum.LAVORAZIONE, mtbColtAnonimo -> {
|
||||
onComplete.run();
|
||||
pickMerceULtoUL(mtbColtAnonimo);
|
||||
pickMerceULtoUL(mtbColtAnonimo, onComplete);
|
||||
}, this::sendError);
|
||||
|
||||
} else {
|
||||
onComplete.run();
|
||||
pickMerceULtoUL(mtbColt);
|
||||
pickMerceULtoUL(mtbColt, onComplete);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,7 +165,8 @@ public class VersamentoMerceViewModel {
|
||||
}
|
||||
|
||||
|
||||
private void pickMerceULtoUL(MtbColt destMtbColt) {
|
||||
private void pickMerceULtoUL(MtbColt destMtbColt, Runnable onComplete) {
|
||||
this.sendOnLoadingStarted();
|
||||
MtbColt sourceMtbColt = mCurrentMtbColt.getValue();
|
||||
|
||||
if (!UtilityString.equalsIgnoreCase(sourceMtbColt.getCodMdep(), destMtbColt.getCodMdep())) {
|
||||
@@ -181,21 +183,24 @@ public class VersamentoMerceViewModel {
|
||||
return;
|
||||
}
|
||||
|
||||
this.sendOnLoadingEnded();
|
||||
this.sendOnArtsChooseRequired(mtbColrsToPick, pickedAarts -> {
|
||||
List<MtbColr> destNewMtbColr = new ArrayList<>();
|
||||
|
||||
askQuantities(pickedAarts.iterator(), destNewMtbColr, () -> {
|
||||
this.sendOnLoadingStarted();
|
||||
|
||||
MtbColt clonedSourceTestata = (MtbColt) sourceMtbColt.clone();
|
||||
clonedSourceTestata.setMtbColr(new ObservableArrayList<>());
|
||||
clonedSourceTestata.getMtbColr().addAll(destNewMtbColr);
|
||||
|
||||
this.sendOnLoadingStarted();
|
||||
|
||||
this.mColliMagazzinoRESTConsumer.spostaArtsTraUL(
|
||||
clonedSourceTestata,
|
||||
destMtbColt,
|
||||
this::sendOnDataSaved,
|
||||
() -> {
|
||||
this.sendOnDataSaved();
|
||||
onComplete.run();
|
||||
},
|
||||
this::sendError
|
||||
);
|
||||
|
||||
@@ -242,26 +247,23 @@ public class VersamentoMerceViewModel {
|
||||
}
|
||||
|
||||
|
||||
public void updatePosizione(MtbDepoPosizione mtbDepoPosizione, boolean shouldAskLivello) {
|
||||
public void askLivelloPosizione(MtbDepoPosizione mtbDepoPosizione) {
|
||||
this.sendOnLivelloPosizioneRequired(mtbDepoPosizione, newPosizione -> {
|
||||
if (newPosizione == null) {
|
||||
askLivelloPosizione(mtbDepoPosizione);
|
||||
} else {
|
||||
updatePosizione(newPosizione);
|
||||
}
|
||||
|
||||
if (shouldAskLivello) {
|
||||
this.sendOnLivelloPosizioneRequired(mtbDepoPosizione, newPosizione -> {
|
||||
|
||||
if (newPosizione == null) {
|
||||
updatePosizione(mtbDepoPosizione, shouldAskLivello);
|
||||
} else {
|
||||
updatePosizione(newPosizione, false);
|
||||
}
|
||||
|
||||
});
|
||||
} else {
|
||||
this.sendOnLoadingStarted();
|
||||
mColliMagazzinoRESTConsumer.changePosizione(mCurrentMtbColt.getValue(), mtbDepoPosizione, () -> {
|
||||
this.sendOnLoadingEnded();
|
||||
this.sendOnDataSaved();
|
||||
}, this::sendError);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void updatePosizione(MtbDepoPosizione mtbDepoPosizione) {
|
||||
this.sendOnLoadingStarted();
|
||||
mColliMagazzinoRESTConsumer.changePosizione(mCurrentMtbColt.getValue(), mtbDepoPosizione, () -> {
|
||||
this.sendOnLoadingEnded();
|
||||
this.sendOnDataSaved();
|
||||
}, this::sendError);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ public class DialogAskClienteDestinatarioDTO {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("%s (%s)", getDestinatario(), getCodVdes());
|
||||
return getDestinatario() + (getCodVdes() != null ? (" (" + getCodVdes() + ")") : "");
|
||||
}
|
||||
|
||||
public VtbDest toVtbDestModel() {
|
||||
|
||||
@@ -61,7 +61,7 @@ public class DialogAskCliente_Page1ViewModel implements IDialogAskClienteViewMod
|
||||
public void onShow() {
|
||||
|
||||
mBarcodeScannerInstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
||||
.setOnScanSuccessfull(onScanSuccessful)
|
||||
.setOnScanSuccessful(onScanSuccessful)
|
||||
.setOnScanFailed(ex -> UtilityExceptions.defaultException(mContext, ex, false)));
|
||||
BarcodeManager.enable();
|
||||
|
||||
@@ -145,7 +145,12 @@ public class DialogAskCliente_Page1ViewModel implements IDialogAskClienteViewMod
|
||||
|
||||
|
||||
private void initializeAdapter(ArrayList<DialogAskClienteClienteDTO> items) {
|
||||
DialogAskCliente_Page1_Cliente_ArrayAdapter adapter = new DialogAskCliente_Page1_Cliente_ArrayAdapter(mContext, items);
|
||||
|
||||
var orderedList = Stream.of(items)
|
||||
.sortBy(x -> x.getRagSoc() != null ? x.getRagSoc() : "")
|
||||
.toList();
|
||||
|
||||
DialogAskCliente_Page1_Cliente_ArrayAdapter adapter = new DialogAskCliente_Page1_Cliente_ArrayAdapter(mContext, orderedList);
|
||||
|
||||
AutoCompleteTextView editTextDropdownCliente = mBinding.dropdownCliente;
|
||||
editTextDropdownCliente.setThreshold(0);
|
||||
@@ -177,7 +182,7 @@ public class DialogAskCliente_Page1ViewModel implements IDialogAskClienteViewMod
|
||||
|
||||
|
||||
private boolean validateCliente() {
|
||||
if (SettingsManager.iDB().isFlagAllowEmptyClienteInPickingLibero() && mBinding.inputCliente.getEditText().getText().toString().trim().length() == 0) {
|
||||
if (SettingsManager.iDB().isFlagPickLiberoAllowEmptyCliente() && mBinding.inputCliente.getEditText().getText().toString().trim().length() == 0) {
|
||||
return true;
|
||||
} else return getCurrentCliente() != null;
|
||||
}
|
||||
|
||||
@@ -20,13 +20,13 @@ import it.integry.integrywmsnative.view.dialogs.ask_cliente.dto.DialogAskCliente
|
||||
|
||||
public class DialogAskCliente_Page1_Cliente_ArrayAdapter extends ArrayAdapter<DialogAskClienteClienteDTO> implements Filterable {
|
||||
|
||||
private Context mContext;
|
||||
private List<DialogAskClienteClienteDTO> mDataset;
|
||||
private final Context mContext;
|
||||
private final List<DialogAskClienteClienteDTO> mDataset;
|
||||
private List<DialogAskClienteClienteDTO> mDatasetAllItems;
|
||||
|
||||
private ListFilter listFilter = new ListFilter();
|
||||
private final ListFilter listFilter = new ListFilter();
|
||||
|
||||
public DialogAskCliente_Page1_Cliente_ArrayAdapter(@NonNull Context context, @NonNull ArrayList<DialogAskClienteClienteDTO> list) {
|
||||
public DialogAskCliente_Page1_Cliente_ArrayAdapter(@NonNull Context context, @NonNull List<DialogAskClienteClienteDTO> list) {
|
||||
super(context, 0 , list);
|
||||
mContext = context;
|
||||
mDataset = list;
|
||||
@@ -37,13 +37,15 @@ public class DialogAskCliente_Page1_Cliente_ArrayAdapter extends ArrayAdapter<Di
|
||||
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
|
||||
View listItem = convertView;
|
||||
if(listItem == null) {
|
||||
listItem = LayoutInflater.from(mContext).inflate(R.layout.dropdown_simple_item, parent, false);
|
||||
listItem = LayoutInflater.from(mContext).inflate(R.layout.dropdown_simple_item_w_subtitle, parent, false);
|
||||
}
|
||||
|
||||
if(position < mDataset.size()) {
|
||||
AppCompatTextView textView = listItem.findViewById(R.id.text);
|
||||
AppCompatTextView textView = listItem.findViewById(R.id.title);
|
||||
AppCompatTextView subTitle = listItem.findViewById(R.id.subtitle);
|
||||
|
||||
textView.setText(mDataset.get(position).getRagSoc());
|
||||
subTitle.setText(mDataset.get(position).getCodAnag());
|
||||
|
||||
return listItem;
|
||||
}
|
||||
@@ -59,7 +61,7 @@ public class DialogAskCliente_Page1_Cliente_ArrayAdapter extends ArrayAdapter<Di
|
||||
}
|
||||
|
||||
public class ListFilter extends Filter {
|
||||
private Object lock = new Object();
|
||||
private final Object lock = new Object();
|
||||
|
||||
@Override
|
||||
protected FilterResults performFiltering(CharSequence prefix) {
|
||||
@@ -81,7 +83,7 @@ public class DialogAskCliente_Page1_Cliente_ArrayAdapter extends ArrayAdapter<Di
|
||||
ArrayList<DialogAskClienteClienteDTO> matchValues = new ArrayList<>();
|
||||
|
||||
for (DialogAskClienteClienteDTO dataItem : mDatasetAllItems) {
|
||||
if (dataItem.getRagSoc().toLowerCase().startsWith(searchStrLowerCase)) {
|
||||
if (dataItem.getRagSoc().toLowerCase().contains(searchStrLowerCase)) {
|
||||
matchValues.add(dataItem);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ public class DialogAskCliente_Page1_Commessa_ArrayAdapter extends ArrayAdapter<S
|
||||
private List<String> mDataset = new ArrayList<>();
|
||||
private List<String> mDatasetAllItems;
|
||||
|
||||
private DialogAskCliente_Page1_Commessa_ArrayAdapter.ListFilter listFilter = new DialogAskCliente_Page1_Commessa_ArrayAdapter.ListFilter();
|
||||
private final DialogAskCliente_Page1_Commessa_ArrayAdapter.ListFilter listFilter = new DialogAskCliente_Page1_Commessa_ArrayAdapter.ListFilter();
|
||||
|
||||
public DialogAskCliente_Page1_Commessa_ArrayAdapter(@NonNull Context context) {
|
||||
super(context, 0);
|
||||
@@ -56,7 +56,7 @@ public class DialogAskCliente_Page1_Commessa_ArrayAdapter extends ArrayAdapter<S
|
||||
}
|
||||
|
||||
public class ListFilter extends Filter {
|
||||
private Object lock = new Object();
|
||||
private final Object lock = new Object();
|
||||
|
||||
@Override
|
||||
protected FilterResults performFiltering(CharSequence prefix) {
|
||||
@@ -78,7 +78,7 @@ public class DialogAskCliente_Page1_Commessa_ArrayAdapter extends ArrayAdapter<S
|
||||
ArrayList<String> matchValues = new ArrayList<>();
|
||||
|
||||
for (String dataItem : mDatasetAllItems) {
|
||||
if (dataItem.toLowerCase().startsWith(searchStrLowerCase)) {
|
||||
if (dataItem.toLowerCase().contains(searchStrLowerCase)) {
|
||||
matchValues.add(dataItem);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.databinding.DialogAskClientePage2Binding;
|
||||
import it.integry.integrywmsnative.view.dialogs.ask_cliente.dto.DialogAskClienteDestinatarioDTO;
|
||||
|
||||
@@ -57,6 +58,12 @@ public class DialogAskCliente_Page2ViewModel implements IDialogAskClienteViewMod
|
||||
return;
|
||||
}
|
||||
|
||||
if(SettingsManager.iDB().isFlagPickLiberoAllowEmptyDest()) {
|
||||
filteredDestinatari.add(new DialogAskClienteDestinatarioDTO()
|
||||
.setCodAnag(null)
|
||||
.setDestinatario("Nessuno"));
|
||||
}
|
||||
|
||||
initializeAdapter(filteredDestinatari);
|
||||
|
||||
|
||||
@@ -95,7 +102,11 @@ public class DialogAskCliente_Page2ViewModel implements IDialogAskClienteViewMod
|
||||
|
||||
|
||||
private void initializeAdapter(List<DialogAskClienteDestinatarioDTO> items) {
|
||||
DialogAskCliente_Page2_ArrayAdapter adapter = new DialogAskCliente_Page2_ArrayAdapter(mContext, items);
|
||||
var orderedList = Stream.of(items)
|
||||
.sortBy(x -> x.getCodAnag() != null ? x.getCodAnag() : "")
|
||||
.toList();
|
||||
|
||||
DialogAskCliente_Page2_ArrayAdapter adapter = new DialogAskCliente_Page2_ArrayAdapter(mContext, orderedList);
|
||||
|
||||
|
||||
AutoCompleteTextView editTextFilledExposedDropdown = mBinding.dropdownDestinatario;
|
||||
@@ -105,7 +116,9 @@ public class DialogAskCliente_Page2ViewModel implements IDialogAskClienteViewMod
|
||||
|
||||
|
||||
private boolean validateDestinatario() {
|
||||
return getCurrentDestinatario() != null;
|
||||
if (SettingsManager.iDB().isFlagPickLiberoAllowEmptyDest() && getCurrentDestinatario() == null) {
|
||||
return true;
|
||||
} else return getCurrentDestinatario() != null;
|
||||
}
|
||||
|
||||
public DialogAskClienteDestinatarioDTO getCurrentDestinatario() {
|
||||
|
||||
@@ -11,6 +11,7 @@ import android.widget.Filterable;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.widget.AppCompatTextView;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -21,14 +22,15 @@ import it.integry.integrywmsnative.view.dialogs.ask_cliente.dto.DialogAskCliente
|
||||
|
||||
public class DialogAskCliente_Page2_ArrayAdapter extends ArrayAdapter<DialogAskClienteDestinatarioDTO> implements Filterable {
|
||||
|
||||
private Context mContext;
|
||||
private List<DialogAskClienteDestinatarioDTO> mDataset;
|
||||
private final Context mContext;
|
||||
private final List<DialogAskClienteDestinatarioDTO> mDataset;
|
||||
private List<DialogAskClienteDestinatarioDTO> mDatasetAllItems;
|
||||
|
||||
private ListFilter listFilter = new ListFilter();
|
||||
private final ListFilter listFilter = new ListFilter();
|
||||
|
||||
public DialogAskCliente_Page2_ArrayAdapter(@NonNull Context context, @NonNull List<DialogAskClienteDestinatarioDTO> list) {
|
||||
super(context, 0 , list);
|
||||
|
||||
mContext = context;
|
||||
mDataset = list;
|
||||
}
|
||||
@@ -43,18 +45,21 @@ public class DialogAskCliente_Page2_ArrayAdapter extends ArrayAdapter<DialogAskC
|
||||
|
||||
if(position < mDataset.size()) {
|
||||
|
||||
var item = mDataset.get(position);
|
||||
|
||||
AppCompatTextView destinatario = listItem.findViewById(R.id.destinatario);
|
||||
destinatario.setText(UtilityString.capitalizeWords(mDataset.get(position).toString()));
|
||||
destinatario.setText(UtilityString.capitalizeWords(item.getDestinatario() + (item.getCodVdes() != null ? ("(" + item.getCodVdes() + ")") : "")));
|
||||
if(item.getCodVdes() == null) destinatario.setTextColor(ContextCompat.getColor(mContext, R.color.gray_800));
|
||||
|
||||
AppCompatTextView subtitle = listItem.findViewById(R.id.subtitle);
|
||||
|
||||
StringBuilder subtitleStr = new StringBuilder();
|
||||
if(!UtilityString.isNullOrEmpty(mDataset.get(position).getCitta())) {
|
||||
subtitleStr.append(UtilityString.capitalizeWords(mDataset.get(position).getCitta()) + " - ");
|
||||
subtitleStr.append(UtilityString.capitalizeWords(item.getCitta())).append(" - ");
|
||||
}
|
||||
|
||||
if(!UtilityString.isNullOrEmpty(mDataset.get(position).getIndirizzo())) {
|
||||
subtitleStr.append(UtilityString.capitalizeWords(mDataset.get(position).getIndirizzo()));
|
||||
subtitleStr.append(UtilityString.capitalizeWords(item.getIndirizzo()));
|
||||
}
|
||||
|
||||
subtitle.setText(subtitleStr);
|
||||
@@ -95,7 +100,7 @@ public class DialogAskCliente_Page2_ArrayAdapter extends ArrayAdapter<DialogAskC
|
||||
ArrayList<DialogAskClienteDestinatarioDTO> matchValues = new ArrayList<>();
|
||||
|
||||
for (DialogAskClienteDestinatarioDTO dataItem : mDatasetAllItems) {
|
||||
if (dataItem.toString().toLowerCase().startsWith(searchStrLowerCase)) {
|
||||
if (dataItem.toString().toLowerCase().contains(searchStrLowerCase)) {
|
||||
matchValues.add(dataItem);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ public class DialogAskPositionOfLU {
|
||||
private void setupBarcode() {
|
||||
|
||||
int barcodeIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
||||
.setOnScanSuccessfull(onScanSuccessfull)
|
||||
.setOnScanSuccessful(onScanSuccessfull)
|
||||
.setOnScanFailed(ex -> UtilityExceptions.defaultException(mContext, ex, false)));
|
||||
|
||||
mDialog.setOnDismissListener(dialog -> {
|
||||
|
||||
@@ -37,11 +37,9 @@ import it.integry.integrywmsnative.core.rest.model.Ean128Model;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDialog;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityProgress;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
import it.integry.integrywmsnative.databinding.DialogChooseArtsFromListaArtsLayoutBinding;
|
||||
import it.integry.integrywmsnative.view.dialogs.DialogCommon;
|
||||
import it.integry.integrywmsnative.view.dialogs.DialogProgressView;
|
||||
|
||||
public class DialogChooseArtsFromListaArts extends BaseDialogFragment {
|
||||
|
||||
@@ -62,7 +60,6 @@ public class DialogChooseArtsFromListaArts extends BaseDialogFragment {
|
||||
private final List<DialogChooseArtsFromListaArtsItemModel> mDataset;
|
||||
|
||||
private int mBarcodeScannerIstanceID;
|
||||
private DialogProgressView mCurrentProgress;
|
||||
private MtbAart selectedArt;
|
||||
|
||||
public static DialogChooseArtsFromListaArts newInstance(List<MtbColr> listaMtbColr, RunnableArgs<List<MtbColr>> onItemsChoosed, Runnable onAbort) {
|
||||
@@ -242,7 +239,7 @@ public class DialogChooseArtsFromListaArts extends BaseDialogFragment {
|
||||
BarcodeManager.enable();
|
||||
|
||||
mBarcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
||||
.setOnScanSuccessfull(onScanSuccessfull)
|
||||
.setOnScanSuccessful(onScanSuccessfull)
|
||||
.setOnScanFailed(ex -> UtilityExceptions.defaultException(context, ex, false)));
|
||||
|
||||
|
||||
@@ -258,9 +255,7 @@ public class DialogChooseArtsFromListaArts extends BaseDialogFragment {
|
||||
|
||||
|
||||
private final RunnableArgs<BarcodeScanDTO> onScanSuccessfull = data -> {
|
||||
BarcodeManager.disable();
|
||||
|
||||
openProgress();
|
||||
onLoadingStarted();
|
||||
|
||||
|
||||
if (UtilityBarcode.isEan13(data)) {
|
||||
@@ -268,8 +263,7 @@ public class DialogChooseArtsFromListaArts extends BaseDialogFragment {
|
||||
} else if (UtilityBarcode.isEtichetta128(data)) {
|
||||
this.executeEtichettaEan128(data);
|
||||
} else {
|
||||
closeProgress();
|
||||
BarcodeManager.enable();
|
||||
onLoadingEnded();
|
||||
}
|
||||
|
||||
|
||||
@@ -293,8 +287,7 @@ public class DialogChooseArtsFromListaArts extends BaseDialogFragment {
|
||||
this.loadArticolo(barcodeProd, ean128Model);
|
||||
} else {
|
||||
DialogCommon.showNoArtFoundDialog(context, () -> {
|
||||
BarcodeManager.enable();
|
||||
closeProgress();
|
||||
onLoadingEnded();
|
||||
});
|
||||
|
||||
}
|
||||
@@ -303,16 +296,11 @@ public class DialogChooseArtsFromListaArts extends BaseDialogFragment {
|
||||
} else {
|
||||
//EAN 128 non completo o comunque mancano i riferimenti al prodotto
|
||||
DialogCommon.showNoArtFoundDialog(context, () -> {
|
||||
BarcodeManager.enable();
|
||||
closeProgress();
|
||||
onLoadingEnded();
|
||||
});
|
||||
|
||||
}
|
||||
}, ex -> {
|
||||
closeProgress();
|
||||
UtilityExceptions.defaultException(context, ex);
|
||||
BarcodeManager.enable();
|
||||
});
|
||||
}, this::onError);
|
||||
}
|
||||
|
||||
|
||||
@@ -329,22 +317,16 @@ public class DialogChooseArtsFromListaArts extends BaseDialogFragment {
|
||||
|
||||
this.searchArtInList(mtbAartList.get(0), ean128Model);
|
||||
|
||||
BarcodeManager.enable();
|
||||
closeProgress();
|
||||
onLoadingEnded();
|
||||
|
||||
} else {
|
||||
|
||||
DialogCommon.showNoArtFoundDialog(context, () -> {
|
||||
BarcodeManager.enable();
|
||||
closeProgress();
|
||||
onLoadingEnded();
|
||||
});
|
||||
}
|
||||
|
||||
}, ex -> {
|
||||
closeProgress();
|
||||
BarcodeManager.enable();
|
||||
UtilityExceptions.defaultException(context, ex);
|
||||
});
|
||||
}, this::onError);
|
||||
}
|
||||
|
||||
|
||||
@@ -385,20 +367,4 @@ public class DialogChooseArtsFromListaArts extends BaseDialogFragment {
|
||||
this.dismiss();
|
||||
}
|
||||
|
||||
protected void openProgress() {
|
||||
requireActivity().runOnUiThread(() -> {
|
||||
if (this.mCurrentProgress == null) {
|
||||
this.mCurrentProgress = UtilityProgress.createDefaultProgressDialog(getActivity());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected void closeProgress() {
|
||||
requireActivity().runOnUiThread(() -> {
|
||||
if (mCurrentProgress != null) {
|
||||
mCurrentProgress.dismiss();
|
||||
mCurrentProgress = null;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,6 +87,7 @@ public class DialogInputQuantityV2View extends BaseDialogFragment implements Dia
|
||||
|
||||
private int mBarcodeScannerIstanceID;
|
||||
private boolean mFirstStart = true;
|
||||
private boolean mAbort = true;
|
||||
|
||||
|
||||
public DialogInputQuantityV2View setDialogInputQuantityV2DTO(DialogInputQuantityV2DTO mDialogInputQuantityV2DTO) {
|
||||
@@ -170,38 +171,39 @@ public class DialogInputQuantityV2View extends BaseDialogFragment implements Dia
|
||||
|
||||
private void initBarcode() {
|
||||
mBarcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
||||
.setOnScanSuccessfull(onScanSuccessful)
|
||||
.setOnScanSuccessful(onScanSuccessful)
|
||||
.setOnScanFailed(ex -> UtilityExceptions.defaultException(this.context, ex, false)));
|
||||
}
|
||||
|
||||
private final RunnableArgs<BarcodeScanDTO> onScanSuccessful = data -> {
|
||||
BarcodeManager.disable();
|
||||
this.openProgress();
|
||||
this.onLoadingStarted();
|
||||
|
||||
this.mViewModel.processBarcodeDTO(data, () -> {
|
||||
this.closeProgress();
|
||||
BarcodeManager.enable();
|
||||
this.onLoadingEnded();
|
||||
});
|
||||
};
|
||||
|
||||
public void save() {
|
||||
if (this.mViewModel.validate()) {
|
||||
this.mOnComplete.run(this.mViewModel.getResult(), false);
|
||||
this.mAbort = false;
|
||||
dismiss();
|
||||
this.mOnComplete.run(this.mViewModel.getResult(), false);
|
||||
}
|
||||
}
|
||||
|
||||
public void saveAndCloseLU() {
|
||||
if (this.mViewModel.validate()) {
|
||||
this.mOnComplete.run(this.mViewModel.getResult(), true);
|
||||
this.mAbort = false;
|
||||
dismiss();
|
||||
this.mOnComplete.run(this.mViewModel.getResult(), true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDismiss(@NonNull DialogInterface dialog) {
|
||||
|
||||
BarcodeManager.removeCallback(mBarcodeScannerIstanceID);
|
||||
this.mOnAbort.run();
|
||||
if(mAbort) this.mOnAbort.run();
|
||||
super.onDismiss(dialog);
|
||||
}
|
||||
|
||||
@@ -209,10 +211,10 @@ public class DialogInputQuantityV2View extends BaseDialogFragment implements Dia
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
|
||||
if(!mFirstStart) {
|
||||
// if(!mFirstStart) {
|
||||
this.init();
|
||||
mFirstStart = false;
|
||||
}
|
||||
// mFirstStart = false;
|
||||
// }
|
||||
|
||||
int onNumCnfInputChanged = SettingsManager.iDB().getOnNumCnfInputChanged();
|
||||
|
||||
|
||||
@@ -5,13 +5,17 @@ import dagger.Provides;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
|
||||
|
||||
@Module(subcomponents = DialogScanArtComponent.class)
|
||||
public class DialogScanArtModule {
|
||||
|
||||
@Provides
|
||||
DialogScanArtViewModel providesDialogScanArtViewModel(BarcodeRESTConsumer barcodeRESTConsumer, ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer, ArticoloRESTConsumer articoloRESTConsumer) {
|
||||
return new DialogScanArtViewModel(barcodeRESTConsumer, colliMagazzinoRESTConsumer, articoloRESTConsumer);
|
||||
DialogScanArtViewModel providesDialogScanArtViewModel(BarcodeRESTConsumer barcodeRESTConsumer,
|
||||
ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer,
|
||||
ArticoloRESTConsumer articoloRESTConsumer,
|
||||
PosizioniRESTConsumer posizioniRESTConsumer) {
|
||||
return new DialogScanArtViewModel(barcodeRESTConsumer, colliMagazzinoRESTConsumer, articoloRESTConsumer, posizioniRESTConsumer);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,6 +12,8 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.inject.Inject;
|
||||
@@ -84,7 +86,6 @@ public class DialogScanArtView extends BaseDialogFragment implements DialogScanA
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onDismiss(@NonNull DialogInterface dialog) {
|
||||
BarcodeManager.removeCallback(mBarcodeScannerIstanceID);
|
||||
@@ -95,7 +96,7 @@ public class DialogScanArtView extends BaseDialogFragment implements DialogScanA
|
||||
|
||||
private void initBarcode() {
|
||||
mBarcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
||||
.setOnScanSuccessfull(onScanSuccessfull)
|
||||
.setOnScanSuccessful(onScanSuccessfull)
|
||||
.setOnScanFailed(this::onError));
|
||||
|
||||
setBarcodeListener(true);
|
||||
@@ -103,20 +104,32 @@ public class DialogScanArtView extends BaseDialogFragment implements DialogScanA
|
||||
|
||||
|
||||
private final RunnableArgs<BarcodeScanDTO> onScanSuccessfull = data -> {
|
||||
BarcodeManager.disable();
|
||||
this.openProgress();
|
||||
this.onLoadingStarted();
|
||||
|
||||
this.mViewModel.processBarcodeDTO(data, (status, mtbAart, ean128Model, mtbColrList) -> {
|
||||
if(mtbColrList != null && mtbColrList.size() > 0) {
|
||||
DialogChooseArtFromListaMtbColrView.make(getActivity(), mtbColrList, mtbColrChose -> {
|
||||
|
||||
var filteredMtbColrList = mtbColrList;
|
||||
|
||||
if (mtbAart != null) {
|
||||
filteredMtbColrList = Stream.of(filteredMtbColrList)
|
||||
.filter(x -> x.getCodMart().equalsIgnoreCase(mtbAart.getCodMart()))
|
||||
.toList();
|
||||
}
|
||||
|
||||
if (filteredMtbColrList != null && filteredMtbColrList.size() > 1) {
|
||||
DialogChooseArtFromListaMtbColrView.make(getActivity(), filteredMtbColrList, mtbColrChose -> {
|
||||
mOnItemChoosed.run(status, mtbAart, ean128Model, mtbColrChose);
|
||||
}).show();
|
||||
|
||||
} else if (filteredMtbColrList != null && filteredMtbColrList.size() == 1) {
|
||||
mOnItemChoosed.run(status, mtbAart, ean128Model, filteredMtbColrList.get(0));
|
||||
|
||||
} else {
|
||||
mOnItemChoosed.run(status, mtbAart, ean128Model, null);
|
||||
}
|
||||
|
||||
BarcodeManager.enable();
|
||||
this.closeProgress();
|
||||
|
||||
this.onLoadingEnded();
|
||||
|
||||
dismiss();
|
||||
});
|
||||
|
||||
@@ -7,16 +7,21 @@ import java.util.List;
|
||||
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
||||
import it.integry.integrywmsnative.core.exception.InvalidLUException;
|
||||
import it.integry.integrywmsnative.core.exception.NoArtsFoundException;
|
||||
import it.integry.integrywmsnative.core.exception.NoLUFoundException;
|
||||
import it.integry.integrywmsnative.core.exception.NoResultFromBarcodeException;
|
||||
import it.integry.integrywmsnative.core.exception.TooManyLUFoundInMonoLUPositionException;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgssss;
|
||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.model.Ean128Model;
|
||||
import it.integry.integrywmsnative.core.rest.model.Ean13PesoModel;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityPosizione;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
import it.integry.integrywmsnative.view.dialogs.DialogConsts;
|
||||
|
||||
@@ -25,15 +30,20 @@ public class DialogScanArtViewModel {
|
||||
private final BarcodeRESTConsumer mBarcodeRESTConsumer;
|
||||
private final ColliMagazzinoRESTConsumer mColliMagazzinoRESTConsumer;
|
||||
private final ArticoloRESTConsumer mArticoloRESTConsumer;
|
||||
private final PosizioniRESTConsumer mPosizioniRESTConsumer;
|
||||
|
||||
private boolean mForceOnlyUL;
|
||||
|
||||
private Listener mListener;
|
||||
|
||||
public DialogScanArtViewModel(BarcodeRESTConsumer barcodeRESTConsumer, ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer, ArticoloRESTConsumer articoloRESTConsumer) {
|
||||
public DialogScanArtViewModel(BarcodeRESTConsumer barcodeRESTConsumer,
|
||||
ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer,
|
||||
ArticoloRESTConsumer articoloRESTConsumer,
|
||||
PosizioniRESTConsumer posizioniRESTConsumer) {
|
||||
this.mBarcodeRESTConsumer = barcodeRESTConsumer;
|
||||
this.mColliMagazzinoRESTConsumer = colliMagazzinoRESTConsumer;
|
||||
this.mArticoloRESTConsumer = articoloRESTConsumer;
|
||||
this.mPosizioniRESTConsumer = posizioniRESTConsumer;
|
||||
}
|
||||
|
||||
public DialogScanArtViewModel setForceOnlyUL(boolean forceOnlyUL) {
|
||||
@@ -50,15 +60,19 @@ public class DialogScanArtViewModel {
|
||||
//Cerco l'UL presente all'interno della posizione
|
||||
// this.executeEtichettaPosizione(barcodeScanDTO.getStringValue(), onComplete);
|
||||
|
||||
} else if(UtilityBarcode.isEtichetta128(barcodeScanDTO)) {
|
||||
} else if (UtilityBarcode.isEtichetta128(barcodeScanDTO)) {
|
||||
this.executeEtichettaEan128(barcodeScanDTO, onComplete);
|
||||
} else if(UtilityBarcode.isEanPeso(barcodeScanDTO) && !mForceOnlyUL){
|
||||
|
||||
} else if (UtilityBarcode.isEanPeso(barcodeScanDTO) && !mForceOnlyUL) {
|
||||
this.executeEtichettaEanPeso(barcodeScanDTO, onComplete);
|
||||
} else if (!mForceOnlyUL){
|
||||
this.loadArticolo(barcodeScanDTO.getStringValue(), null, onComplete);
|
||||
|
||||
} else {
|
||||
this.sendError(new Exception("Barcode non valido"));
|
||||
this.loadArticolo(barcodeScanDTO.getStringValue(), null, onComplete);
|
||||
|
||||
}
|
||||
// else {
|
||||
// this.sendError(new Exception("Barcode non valido"));
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
@@ -67,15 +81,15 @@ public class DialogScanArtViewModel {
|
||||
|
||||
String barcodeProd = null;
|
||||
|
||||
if(ean128Model.Sscc != null) barcodeProd = ean128Model.Sscc;
|
||||
if(ean128Model.Gtin != null) barcodeProd = ean128Model.Gtin;
|
||||
if(ean128Model.Content != null) barcodeProd = ean128Model.Content;
|
||||
if (ean128Model.Sscc != null) barcodeProd = ean128Model.Sscc;
|
||||
if (ean128Model.Gtin != null) barcodeProd = ean128Model.Gtin;
|
||||
if (ean128Model.Content != null) barcodeProd = ean128Model.Content;
|
||||
|
||||
|
||||
if(!UtilityString.isNullOrEmpty(barcodeProd)) {
|
||||
if (!UtilityString.isNullOrEmpty(barcodeProd)) {
|
||||
if (!UtilityString.isNullOrEmpty(ean128Model.Sscc)) {
|
||||
this.executeEtichettaLU(ean128Model.Sscc, onComplete);
|
||||
} else if(!mForceOnlyUL) {
|
||||
} else if (!mForceOnlyUL) {
|
||||
if (barcodeProd.startsWith("0") || barcodeProd.startsWith("9")) {
|
||||
barcodeProd = barcodeProd.substring(1);
|
||||
}
|
||||
@@ -86,7 +100,7 @@ public class DialogScanArtViewModel {
|
||||
}
|
||||
} else {
|
||||
//EAN 128 non completo o comunque mancano i riferimenti al prodotto
|
||||
this.sendError(new NoResultFromBarcodeException());
|
||||
this.sendError(new NoResultFromBarcodeException(barcodeProd));
|
||||
}
|
||||
}, this::sendError);
|
||||
}
|
||||
@@ -117,23 +131,48 @@ public class DialogScanArtViewModel {
|
||||
}, this::sendError);
|
||||
}
|
||||
|
||||
private void executePosizione(MtbDepoPosizione posizione, MtbAart articolo, RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, List<MtbColr>> onComplete) {
|
||||
this.mPosizioniRESTConsumer.getBancaliInPosizione(posizione, mtbColtList -> {
|
||||
|
||||
private void loadArticolo(@NotNull String barcodeProd, Ean128Model ean128Model, RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, List<MtbColr>> onComplete) {
|
||||
if(barcodeProd.length() == 14) {
|
||||
// barcodeProd = UtilityBarcode.convertITF14toNeutral(barcodeProd);
|
||||
barcodeProd = UtilityBarcode.convertITF14toEAN13(barcodeProd);
|
||||
}
|
||||
|
||||
this.mArticoloRESTConsumer.getByBarcodeProd(barcodeProd, mtbAartList -> {
|
||||
if(mtbAartList != null && mtbAartList.size() > 0) {
|
||||
onComplete.run(DialogConsts.Results.YES, mtbAartList.get(0), ean128Model, null);
|
||||
if (mtbColtList == null || mtbColtList.size() == 0) {
|
||||
this.sendError(new NoLUFoundException());
|
||||
} else if (mtbColtList.size() == 1) {
|
||||
this.mColliMagazzinoRESTConsumer.getByTestata(mtbColtList.get(0), true, false, mtbColt -> {
|
||||
onComplete.run(DialogConsts.Results.YES, articolo, null, mtbColt.getMtbColr());
|
||||
}, this::sendError);
|
||||
} else {
|
||||
this.sendError(new NoResultFromBarcodeException());
|
||||
this.sendError(new TooManyLUFoundInMonoLUPositionException());
|
||||
}
|
||||
|
||||
}, this::sendError);
|
||||
}
|
||||
|
||||
|
||||
private void loadArticolo(@NotNull String barcodeProd, Ean128Model ean128Model, RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, List<MtbColr>> onComplete) {
|
||||
if (barcodeProd.length() == 14) {
|
||||
barcodeProd = UtilityBarcode.convertITF14toEAN13(barcodeProd);
|
||||
}
|
||||
|
||||
String finalBarcodeProd = barcodeProd;
|
||||
this.mArticoloRESTConsumer.getByBarcodeProd(barcodeProd, mtbAartList -> {
|
||||
if (mtbAartList != null && mtbAartList.size() > 0) {
|
||||
|
||||
MtbAart firstArt = mtbAartList.get(0);
|
||||
MtbDepoPosizione firstArtPosition = UtilityPosizione.getFromCache(firstArt.getPosizione());
|
||||
|
||||
if (firstArtPosition != null && firstArtPosition.isFlagMonoCollo() && mForceOnlyUL) {
|
||||
this.executePosizione(firstArtPosition, firstArt, onComplete);
|
||||
} else if (!mForceOnlyUL) {
|
||||
onComplete.run(DialogConsts.Results.YES, mtbAartList.get(0), ean128Model, null);
|
||||
} else {
|
||||
this.sendError(new NoResultFromBarcodeException(finalBarcodeProd));
|
||||
}
|
||||
|
||||
} else {
|
||||
this.sendError(new NoResultFromBarcodeException(finalBarcodeProd));
|
||||
}
|
||||
}, this::sendError);
|
||||
}
|
||||
|
||||
|
||||
private void sendError(Exception ex) {
|
||||
|
||||
@@ -11,7 +11,6 @@ import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -28,7 +27,6 @@ import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgss;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||
import it.integry.integrywmsnative.databinding.DialogScanOrCreateLuBinding;
|
||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||
import it.integry.integrywmsnative.view.dialogs.basket_lu.DialogBasketLU;
|
||||
@@ -126,19 +124,17 @@ public class DialogScanOrCreateLUView extends BaseDialogFragment implements Dial
|
||||
|
||||
private void initBarcode() {
|
||||
mBarcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
||||
.setOnScanSuccessfull(onScanSuccessfull)
|
||||
.setOnScanSuccessful(onScanSuccessfull)
|
||||
.setOnScanFailed(this::onError));
|
||||
|
||||
setBarcodeListener(true);
|
||||
}
|
||||
|
||||
private final RunnableArgs<BarcodeScanDTO> onScanSuccessfull = data -> {
|
||||
BarcodeManager.disable();
|
||||
this.openProgress();
|
||||
this.onLoadingStarted();
|
||||
|
||||
this.mViewModel.processBarcodeDTO(data, () -> {
|
||||
BarcodeManager.enable();
|
||||
this.closeProgress();
|
||||
this.onLoadingEnded();
|
||||
});
|
||||
};
|
||||
|
||||
@@ -159,7 +155,7 @@ public class DialogScanOrCreateLUView extends BaseDialogFragment implements Dial
|
||||
}, () -> {
|
||||
onConfirm.run(false);
|
||||
})
|
||||
.show(((AppCompatActivity) getActivity()).getSupportFragmentManager(), "tag");
|
||||
.show(requireActivity().getSupportFragmentManager(), "tag");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -169,21 +165,4 @@ public class DialogScanOrCreateLUView extends BaseDialogFragment implements Dial
|
||||
dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Exception ex) {
|
||||
this.closeProgress();
|
||||
UtilityExceptions.defaultException(getActivity(), ex);
|
||||
BarcodeManager.enable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadingStarted() {
|
||||
this.openProgress();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadingEnded() {
|
||||
this.closeProgress();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,12 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<layout xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:fab="http://schemas.android.com/apk/res-auto">
|
||||
xmlns:fab="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<data>
|
||||
|
||||
<import type="android.view.View" />
|
||||
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.PVOrdineAcquistoEditActivity" />
|
||||
@@ -18,241 +20,254 @@
|
||||
android:layout_height="match_parent">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/linearLayout2"
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/full_white"
|
||||
android:orientation="vertical"
|
||||
android:descendantFocusability="blocksDescendants"
|
||||
>
|
||||
android:descendantFocusability="blocksDescendants">
|
||||
|
||||
<LinearLayout
|
||||
<it.integry.integrywmsnative.ui.ElevatedToolbar
|
||||
android:id="@+id/elevated_toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/full_white"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="8dp"
|
||||
tools:context=".gest.contenuto_bancale.ContenutoBancaleActivity">
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent">
|
||||
|
||||
<it.integry.integrywmsnative.ui.ElevatedToolbar
|
||||
android:id="@+id/elevated_toolbar"
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?actionBarSize">
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/toolbar_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
tools:text="modifica ordine"
|
||||
style="@style/TextAppearance.AppCompat.Widget.ActionBar.Title"
|
||||
android:layout_gravity="start" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageButton
|
||||
android:id="@+id/add_extra_items_toolbar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="50dp"
|
||||
android:layout_gravity="end"
|
||||
android:background="@drawable/ripple_effect"
|
||||
android:adjustViewBounds="true"
|
||||
android:src="@drawable/ic_search_black_24dp"
|
||||
android:onClick="@{()->viewModel.manualSearch()}"
|
||||
android:tint="@color/colorPrimaryGray"/>
|
||||
</androidx.appcompat.widget.Toolbar>
|
||||
|
||||
</it.integry.integrywmsnative.ui.ElevatedToolbar>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:background="@drawable/gray_detail_background_round8"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/AppTheme.NewMaterial.Text.Small"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="ordine: "
|
||||
android:textColor="@android:color/black"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/order_identifier"
|
||||
style="@style/AppTheme.NewMaterial.Text.Small"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@android:color/black"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
tools:text="22 ottobre 2018" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/AppTheme.NewMaterial.Text.Small"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Griglia "
|
||||
android:textColor="@android:color/black" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/cod_alis"
|
||||
style="@style/AppTheme.NewMaterial.Text.Small"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@android:color/black"
|
||||
android:textStyle="italic"
|
||||
tools:text="4SECCO" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/AppTheme.NewMaterial.Text.Small"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="N. articoli "
|
||||
android:textColor="@android:color/black" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/count_art_ord"
|
||||
style="@style/AppTheme.NewMaterial.Text.Small"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@android:color/black"
|
||||
android:textStyle="bold"
|
||||
tools:text="10" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/articoli_ordine_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginBottom="92dp"
|
||||
android:paddingStart="2dp"
|
||||
android:paddingEnd="2dp" />
|
||||
<LinearLayout
|
||||
android:id="@+id/scan_art_spinner"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="24dp"
|
||||
android:visibility="visible"
|
||||
android:orientation="horizontal">
|
||||
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar"
|
||||
style="?android:attr/progressBarStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
android:layout_height="?actionBarSize">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/toolbar_title"
|
||||
style="@style/TextAppearance.AppCompat.Widget.ActionBar.Title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start"
|
||||
tools:text="modifica ordine" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageButton
|
||||
android:id="@+id/add_extra_items_toolbar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="50dp"
|
||||
android:layout_gravity="end"
|
||||
android:adjustViewBounds="true"
|
||||
android:background="@drawable/ripple_effect"
|
||||
android:onClick="@{()->viewModel.manualSearch()}"
|
||||
android:src="@drawable/ic_search_black_24dp"
|
||||
android:tint="@color/colorPrimaryGray" />
|
||||
</androidx.appcompat.widget.Toolbar>
|
||||
|
||||
</it.integry.integrywmsnative.ui.ElevatedToolbar>
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:id="@+id/header_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:background="@drawable/gray_detail_background_round8"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintTop_toBottomOf="@id/elevated_toolbar"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:padding="16dp">
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/AppTheme.NewMaterial.Text.Small"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="ordine:"
|
||||
android:textColor="@android:color/black"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/order_identifier"
|
||||
style="@style/AppTheme.NewMaterial.Text.Small"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
android:textColor="@android:color/black"
|
||||
android:textSize="16sp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="center_horizontal"
|
||||
style="@style/AppTheme.NewMaterial.Text"
|
||||
android:text="@string/scan_item"/>
|
||||
</LinearLayout>
|
||||
android:textStyle="bold"
|
||||
tools:text="22 ottobre 2018" />
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
</LinearLayout>
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
</LinearLayout>
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/AppTheme.NewMaterial.Text.Small"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Griglia"
|
||||
android:textColor="@android:color/black" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/cod_alis"
|
||||
style="@style/AppTheme.NewMaterial.Text.Small"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
android:paddingEnd="2dp"
|
||||
android:textColor="@android:color/black"
|
||||
android:textStyle="italic"
|
||||
tools:text="4SAPORIV" />
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/AppTheme.NewMaterial.Text.Small"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="N. articoli "
|
||||
android:textColor="@android:color/black" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/count_art_ord"
|
||||
style="@style/AppTheme.NewMaterial.Text.Small"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@android:color/black"
|
||||
android:textStyle="bold"
|
||||
tools:text="10" />
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
|
||||
<com.github.clans.fab.FloatingActionMenu
|
||||
android:id="@+id/close_activity_fab"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_anchor="@+id/linearLayout2"
|
||||
app:layout_anchorGravity="center"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:menu_icon="@drawable/ic_check_white_24dp"
|
||||
fab:menu_animationDelayPerItem="50"
|
||||
fab:menu_backgroundColor="@color/white_bg_alpha"
|
||||
fab:menu_buttonSpacing="0dp"
|
||||
fab:menu_colorNormal="@color/success_color"
|
||||
fab:menu_colorPressed="@color/green_400"
|
||||
fab:menu_labels_colorNormal="@color/white"
|
||||
fab:menu_labels_colorPressed="@color/white_pressed"
|
||||
fab:menu_labels_colorRipple="#66FFFFFF"
|
||||
fab:menu_labels_cornerRadius="3dp"
|
||||
fab:menu_labels_hideAnimation="@anim/fab_slide_out_to_right"
|
||||
fab:menu_labels_margin="0dp"
|
||||
fab:menu_labels_padding="8dp"
|
||||
fab:menu_labels_paddingBottom="4dp"
|
||||
fab:menu_labels_paddingLeft="8dp"
|
||||
fab:menu_labels_paddingRight="8dp"
|
||||
fab:menu_labels_paddingTop="4dp"
|
||||
fab:menu_labels_position="left"
|
||||
fab:menu_labels_showAnimation="@anim/fab_slide_in_from_right"
|
||||
fab:menu_labels_showShadow="true"
|
||||
fab:menu_labels_textColor="@color/black_semi_transparent"
|
||||
fab:menu_labels_textSize="18sp"
|
||||
fab:menu_openDirection="up"
|
||||
fab:menu_shadowColor="#66000000"
|
||||
fab:menu_shadowRadius="4dp"
|
||||
fab:menu_shadowXOffset="1dp"
|
||||
fab:menu_shadowYOffset="3dp"
|
||||
fab:menu_showShadow="true">
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
|
||||
<com.github.clans.fab.FloatingActionButton
|
||||
android:id="@+id/pv_ordine_export"
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/articoli_ordine_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:paddingStart="2dp"
|
||||
android:paddingEnd="2dp"
|
||||
android:clipToPadding="false"
|
||||
android:paddingBottom="72dp"
|
||||
android:scrollbars="vertical"
|
||||
app:layout_constraintTop_toBottomOf="@id/header_content"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:id="@+id/scan_art_spinner"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_black_upload"
|
||||
android:visibility="gone"
|
||||
app:fab_colorNormal="@color/white"
|
||||
app:fab_colorPressed="@color/white_pressed"
|
||||
app:fab_colorRipple="#66FFFFFF"
|
||||
app:onClick="@{() -> viewModel.exportOrdine()}"
|
||||
fab:fab_label="@string/close_and_export" />
|
||||
|
||||
<com.github.clans.fab.FloatingActionButton
|
||||
android:id="@+id/pv_ordine_close"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_check_black_24dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="24dp"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="visible"
|
||||
app:fab_colorNormal="@color/white"
|
||||
app:fab_colorPressed="@color/white_pressed"
|
||||
app:fab_colorRipple="#66FFFFFF"
|
||||
app:onClick="@{() -> viewModel.closeEdit()}"
|
||||
fab:fab_label="@string/close_and_exit" />
|
||||
app:layout_constraintTop_toBottomOf="@id/header_content"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent">
|
||||
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar"
|
||||
style="?android:attr/progressBarStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/AppTheme.NewMaterial.Text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="@string/scan_item"
|
||||
android:textSize="16sp" />
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
<com.github.clans.fab.FloatingActionMenu
|
||||
android:id="@+id/close_activity_fab"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentBottom="true"
|
||||
app:layout_anchorGravity="center"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:menu_icon="@drawable/ic_check_white_24dp"
|
||||
fab:menu_animationDelayPerItem="50"
|
||||
fab:menu_backgroundColor="@color/white_bg_alpha"
|
||||
fab:menu_buttonSpacing="0dp"
|
||||
fab:menu_colorNormal="@color/success_color"
|
||||
fab:menu_colorPressed="@color/green_400"
|
||||
fab:menu_labels_colorNormal="@color/white"
|
||||
fab:menu_labels_colorPressed="@color/white_pressed"
|
||||
fab:menu_labels_colorRipple="#66FFFFFF"
|
||||
fab:menu_labels_cornerRadius="3dp"
|
||||
fab:menu_labels_hideAnimation="@anim/fab_slide_out_to_right"
|
||||
fab:menu_labels_margin="0dp"
|
||||
fab:menu_labels_padding="8dp"
|
||||
fab:menu_labels_paddingBottom="4dp"
|
||||
fab:menu_labels_paddingLeft="8dp"
|
||||
fab:menu_labels_paddingRight="8dp"
|
||||
fab:menu_labels_paddingTop="4dp"
|
||||
fab:menu_labels_position="left"
|
||||
fab:menu_labels_showAnimation="@anim/fab_slide_in_from_right"
|
||||
fab:menu_labels_showShadow="true"
|
||||
fab:menu_labels_textColor="@color/black_semi_transparent"
|
||||
fab:menu_labels_textSize="18sp"
|
||||
fab:menu_openDirection="up"
|
||||
fab:menu_shadowColor="#66000000"
|
||||
fab:menu_shadowRadius="4dp"
|
||||
fab:menu_shadowXOffset="1dp"
|
||||
fab:menu_shadowYOffset="3dp"
|
||||
fab:menu_showShadow="true">
|
||||
|
||||
|
||||
<com.github.clans.fab.FloatingActionButton
|
||||
android:id="@+id/pv_ordine_export"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_black_upload"
|
||||
android:visibility="gone"
|
||||
app:fab_colorNormal="@color/white"
|
||||
app:fab_colorPressed="@color/white_pressed"
|
||||
app:fab_colorRipple="#66FFFFFF"
|
||||
app:onClick="@{() -> viewModel.exportOrdine()}"
|
||||
fab:fab_label="@string/close_and_export" />
|
||||
|
||||
<com.github.clans.fab.FloatingActionButton
|
||||
android:id="@+id/pv_ordine_close"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_check_black_24dp"
|
||||
android:visibility="visible"
|
||||
app:fab_colorNormal="@color/white"
|
||||
app:fab_colorPressed="@color/white_pressed"
|
||||
app:fab_colorRipple="#66FFFFFF"
|
||||
app:onClick="@{() -> viewModel.close()}"
|
||||
fab:fab_label="@string/close_and_exit" />
|
||||
|
||||
|
||||
</com.github.clans.fab.FloatingActionMenu>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
|
||||
</com.github.clans.fab.FloatingActionMenu>
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
|
||||
|
||||
</layout>
|
||||
@@ -1,38 +1,33 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<androidx.appcompat.widget.LinearLayoutCompat xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:paddingBottom="8dp">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/destinatario"
|
||||
style="@style/AppTheme.NewMaterial.Text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:textAppearance="?attr/textAppearanceSubtitle1"
|
||||
tools:text="Destinatario"
|
||||
style="@style/AppTheme.NewMaterial.Text"/>
|
||||
tools:text="Destinatario" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/subtitle"
|
||||
style="@style/AppTheme.NewMaterial.Text.Small"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
android:maxLines="1"
|
||||
android:textAppearance="?attr/textAppearanceSubtitle1"
|
||||
android:textColor="@color/gray_800"
|
||||
tools:text="Città" />
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/subtitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxLines="1"
|
||||
android:textAppearance="?attr/textAppearanceSubtitle1"
|
||||
tools:text="Città"
|
||||
style="@style/AppTheme.NewMaterial.Text.Small"/>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -12,7 +12,7 @@
|
||||
|
||||
<variable
|
||||
name="view"
|
||||
type="it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.dialog.EditArticoloDialog" />
|
||||
type="it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.dialog.DialogEditArticoloView" />
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
@@ -250,7 +250,7 @@
|
||||
style="@style/AppTheme.NewMaterial.Text.Medium"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{UtilityNumber.decimalToString(view.articolo.getCnfDaRic())}"
|
||||
android:text="@{UtilityNumber.decimalToString(view.articolo.merceDaRic)}"
|
||||
android:textColor="@android:color/black"
|
||||
android:textStyle="bold"
|
||||
tools:text="1" />
|
||||
@@ -281,7 +281,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="0dp"
|
||||
android:text="@{UtilityNumber.decimalToString(view.articolo.merceDaRic)}"
|
||||
android:text="@{UtilityNumber.decimalToString(view.articolo.getCnfDaRic())}"
|
||||
android:textColor="@android:color/black"
|
||||
android:textStyle="bold" />
|
||||
|
||||
@@ -552,7 +552,7 @@
|
||||
android:imeOptions="actionDone"
|
||||
android:selectAllOnFocus="true"
|
||||
android:inputType="number"
|
||||
app:binding="@{view.numCnf}" />
|
||||
app:binding="@{view.currentNumCnf}" />
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
@@ -575,7 +575,7 @@
|
||||
android:hint="@string/qty_x_pck"
|
||||
android:imeOptions="actionDone"
|
||||
android:inputType="numberDecimal"
|
||||
app:binding="@{view.qtaCnf}" />
|
||||
app:binding="@{view.currentQtaCnf}" />
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
@@ -597,7 +597,7 @@
|
||||
android:hint="@string/tot_qty"
|
||||
android:inputType="number"
|
||||
android:selectAllOnFocus="true"
|
||||
app:binding="@{view.qtaOrd}" />
|
||||
app:binding="@{view.currentQtaTot}" />
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
@@ -621,7 +621,7 @@
|
||||
android:layout_marginStart="4dp"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:layout_weight="1"
|
||||
android:onClick="@{() -> view.cancel()}"
|
||||
android:onClick="@{() -> view.dismiss()}"
|
||||
app:icon="@drawable/ic_close_24dp"
|
||||
app:iconGravity="textStart"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
@@ -4,9 +4,10 @@
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:orientation="vertical" android:layout_width="match_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:orientation="vertical"
|
||||
app:cardCornerRadius="12dp"
|
||||
app:cardElevation="0dp">
|
||||
|
||||
@@ -21,17 +22,17 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="24dp"
|
||||
android:paddingEnd="24dp"
|
||||
android:paddingTop="24dp"
|
||||
android:paddingEnd="24dp"
|
||||
android:paddingBottom="12dp">
|
||||
|
||||
<TextView
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/title_text"
|
||||
style="@style/TextViewMaterial.Dialog.HeadlineText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/TextViewMaterial.Dialog.HeadlineText"
|
||||
android:text="@string/extra_item"
|
||||
android:gravity="center_horizontal"/>
|
||||
android:gravity="center_horizontal"
|
||||
android:text="@string/extra_item" />
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="wrap_content"
|
||||
@@ -45,32 +46,31 @@
|
||||
android:id="@+id/progressBar"
|
||||
style="?android:attr/progressBarStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/AppTheme.NewMaterial.Text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="16sp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="center_horizontal"
|
||||
style="@style/AppTheme.NewMaterial.Text"
|
||||
android:text="@string/scan_item"/>
|
||||
android:text="@string/scan_item"
|
||||
android:textSize="16sp" />
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/button_no"
|
||||
style="@style/Button.DangerOutline"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
style="@style/Button.DangerOutline"
|
||||
app:strokeColor="@color/red_400"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:text="@string/abort"/>
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="@string/abort"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:strokeColor="@color/red_400" />
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
@@ -78,5 +78,4 @@
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
|
||||
|
||||
</layout>
|
||||
33
app/src/main/res/layout/dropdown_simple_item_w_subtitle.xml
Normal file
33
app/src/main/res/layout/dropdown_simple_item_w_subtitle.xml
Normal file
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.appcompat.widget.LinearLayoutCompat xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:paddingBottom="8dp">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/title"
|
||||
style="@style/AppTheme.NewMaterial.Text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:textAppearance="?attr/textAppearanceSubtitle1"
|
||||
tools:text="Destinatario" />
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/subtitle"
|
||||
style="@style/AppTheme.NewMaterial.Text.Small"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxLines="1"
|
||||
android:textAppearance="?attr/textAppearanceSubtitle1"
|
||||
android:textColor="@color/gray_800"
|
||||
tools:text="Città" />
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
@@ -94,7 +94,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/badge_round_corner"
|
||||
android:backgroundTint="@color/colorPrimary"
|
||||
android:backgroundTint="@{articolo.bgTint}"
|
||||
android:gravity="center"
|
||||
android:paddingLeft="6dp"
|
||||
android:paddingTop="2dp"
|
||||
@@ -104,6 +104,7 @@
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
tools:backgroundTint="@color/colorPrimary"
|
||||
tools:text="280.45\nCONF" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
package it.integry.integrywmsnative;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
public class ExampleUnitTest {
|
||||
@Test
|
||||
public void addition_isCorrect() throws Exception {
|
||||
assertEquals(4, 2 + 2);
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user