Compare commits
99 Commits
v1.24.0
...
v1.27.1(28
| Author | SHA1 | Date | |
|---|---|---|---|
| 350c4bc4ed | |||
| df13a6e29d | |||
| ee8fa96c40 | |||
| c264cd38e3 | |||
| 64f669753f | |||
| aabc4310fd | |||
| 9dc3996aef | |||
| e0e9e657c9 | |||
| 84cbab334f | |||
| f9751e770a | |||
| 6539c9179e | |||
| f43a7acf35 | |||
| ca96bacde6 | |||
| d4c94b7ab9 | |||
| 0c9e607c33 | |||
| b5c6ce2aa5 | |||
| 66f58ea20d | |||
| d6979289e2 | |||
| 496387b5c6 | |||
| 6b0d75fc60 | |||
| 7d263699da | |||
| 63e4e4e791 | |||
| 98c260f621 | |||
| 1b57dc74cf | |||
| 4f140d0d58 | |||
| 0d021e6bad | |||
| 1a0af47613 | |||
| ead509bb32 | |||
| ddfde73f1e | |||
| 3de5a2320d | |||
| 5cb32a9a77 | |||
| ecbb4ac55c | |||
| 84e0561fff | |||
| 71bfbb2afc | |||
| 2cb563320b | |||
| f3837f35b0 | |||
| fa52b8e040 | |||
| c80b5a9160 | |||
| 65ac5590c7 | |||
| 3cee7f2a95 | |||
| 3034b49586 | |||
| 718ffb3124 | |||
| 7173c49561 | |||
| 4407f37f8c | |||
| 37a16f6292 | |||
| 83d9e0c5f7 | |||
| d2249e031a | |||
| 2522e67705 | |||
| 371514157c | |||
| de889045e6 | |||
| 6225ba8207 | |||
| 36c9319bce | |||
| d4d494218b | |||
| a3d6b11c69 | |||
| 852edf1b13 | |||
| 6806290d98 | |||
| 66f7a51462 | |||
| 0e1e69dc9a | |||
| 2ef24fe6e9 | |||
| 54c2d90334 | |||
| 577f2041a1 | |||
| 2f3e74fbfe | |||
| b0fa911322 | |||
| 473b9f22fb | |||
| cc1e1bf221 | |||
| a0c85b3fcb | |||
| 0f41bd99aa | |||
| 7a3a207462 | |||
| 7206b3c37e | |||
| 4cf8b6167f | |||
| b19b438489 | |||
| d3ee6d9ea3 | |||
| dd9789c4f3 | |||
| 67571e3d7a | |||
| a0e17f557d | |||
| 684946bb14 | |||
| 4aab6b1688 | |||
| 310a79f41d | |||
| f8164ca1eb | |||
| 790a9eae6c | |||
| b41edd314f | |||
| 34d8a93c01 | |||
| 3b45d8fe35 | |||
| aba1fcdc7b | |||
| 012d7caa52 | |||
| e7e20da206 | |||
| ef6535897b | |||
| 8c75ecbd0a | |||
| fad3c4243d | |||
| a6e75114cb | |||
| 48a83bc0d5 | |||
| b58475b426 | |||
| 207daab105 | |||
| c32da27b7f | |||
| 1f94c14634 | |||
| 4880ea8301 | |||
| a2d165d475 | |||
| d142f0c868 | |||
| 746838010a |
@@ -10,8 +10,8 @@ apply plugin: 'com.google.gms.google-services'
|
||||
|
||||
android {
|
||||
|
||||
def appVersionCode = 268
|
||||
def appVersionName = '1.24.0'
|
||||
def appVersionCode = 288
|
||||
def appVersionName = '1.7.1'
|
||||
|
||||
signingConfigs {
|
||||
release {
|
||||
@@ -78,12 +78,11 @@ android {
|
||||
}
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
abortOnError false
|
||||
}
|
||||
|
||||
dynamicFeatures = [":dynamic__base", ":dynamic_vgalimenti"]
|
||||
|
||||
lint {
|
||||
abortOnError false
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -114,6 +113,7 @@ dependencies {
|
||||
implementation 'androidx.cardview:cardview:1.0.0'
|
||||
implementation 'androidx.recyclerview:recyclerview:1.2.1'
|
||||
implementation 'androidx.preference:preference-ktx:1.2.0'
|
||||
implementation "androidx.slidingpanelayout:slidingpanelayout:1.2.0"
|
||||
implementation 'com.squareup.okhttp3:okhttp:4.9.1'
|
||||
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
|
||||
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
|
||||
@@ -165,6 +165,14 @@ dependencies {
|
||||
// testImplementation "org.junit.jupiter:junit-jupiter-api:5.8.1"
|
||||
// androidTestImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
|
||||
// androidTestImplementation 'org.testng:testng:7.4.0'
|
||||
|
||||
|
||||
//Bluetooth device manager
|
||||
implementation 'com.github.harry1453:android-bluetooth-serial:v1.1'
|
||||
|
||||
// RxJava is also required.
|
||||
implementation 'io.reactivex.rxjava2:rxjava:2.1.12'
|
||||
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
|
||||
}
|
||||
|
||||
repositories {
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
package it.integry.integrywmsnative;
|
||||
|
||||
import android.content.Context;
|
||||
import androidx.test.InstrumentationRegistry;
|
||||
import androidx.test.runner.AndroidJUnit4;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Instrumentation test, which will execute on an Android device.
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class ExampleInstrumentedTest {
|
||||
@Test
|
||||
public void useAppContext() throws Exception {
|
||||
// Context of the app under test.
|
||||
Context appContext = InstrumentationRegistry.getTargetContext();
|
||||
|
||||
assertEquals("it.integry.integrywmsnative", appContext.getPackageName());
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
|
||||
|
||||
<application
|
||||
android:name=".MainApplication"
|
||||
|
||||
@@ -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;
|
||||
@@ -43,6 +45,8 @@ import it.integry.integrywmsnative.gest.prod_fabbisogno_linee_prod.ProdFabbisogn
|
||||
import it.integry.integrywmsnative.gest.prod_fabbisogno_linee_prod.ProdFabbisognoLineeProdModule;
|
||||
import it.integry.integrywmsnative.gest.prod_fabbisogno_linee_prod.dialog_ask_mag_prossimita.DialogAskMagazzinoProssimitaComponent;
|
||||
import it.integry.integrywmsnative.gest.prod_fabbisogno_linee_prod.dialog_ask_mag_prossimita.DialogAskMagazzinoProssimitaModule;
|
||||
import it.integry.integrywmsnative.gest.prod_linee_produzione.ProdLineeProduzioneComponent;
|
||||
import it.integry.integrywmsnative.gest.prod_linee_produzione.ProdLineeProduzioneModule;
|
||||
import it.integry.integrywmsnative.gest.prod_recupero_materiale.ProdRecuperoMaterialeComponent;
|
||||
import it.integry.integrywmsnative.gest.prod_recupero_materiale.ProdRecuperoMaterialeModule;
|
||||
import it.integry.integrywmsnative.gest.prod_rientro_merce.ProdRientroMerceComponent;
|
||||
@@ -59,6 +63,8 @@ import it.integry.integrywmsnative.gest.rettifica_giacenze.RettificaGiacenzeComp
|
||||
import it.integry.integrywmsnative.gest.rettifica_giacenze.RettificaGiacenzeModule;
|
||||
import it.integry.integrywmsnative.gest.spedizione.SpedizioneComponent;
|
||||
import it.integry.integrywmsnative.gest.spedizione.SpedizioneModule;
|
||||
import it.integry.integrywmsnative.gest.spedizione.dialogs.print_sscc_list.DialogPrintOrderSSCCListComponent;
|
||||
import it.integry.integrywmsnative.gest.spedizione.dialogs.print_sscc_list.DialogPrintOrderSSCCListModule;
|
||||
import it.integry.integrywmsnative.gest.spedizione.dialogs.row_info.prod_fabbisogno_linee_prod.DialogRowInfoProdFabbisognoLineeProdComponent;
|
||||
import it.integry.integrywmsnative.gest.spedizione.dialogs.row_info.prod_fabbisogno_linee_prod.DialogRowInfoProdFabbisognoLineeProdModule;
|
||||
import it.integry.integrywmsnative.gest.ultime_consegne_cliente.UltimeConsegneClienteComponent;
|
||||
@@ -91,6 +97,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,
|
||||
@@ -125,7 +132,9 @@ import it.integry.integrywmsnative.view.dialogs.scan_or_create_lu.DialogScanOrCr
|
||||
DocInterniEditFormModule.class,
|
||||
DialogSelectDocRowsModule.class,
|
||||
DialogAskClienteModule.class,
|
||||
DialogEditArticoloModule.class
|
||||
DialogEditArticoloModule.class,
|
||||
DialogPrintOrderSSCCListModule.class,
|
||||
ProdLineeProduzioneModule.class
|
||||
})
|
||||
public interface MainApplicationComponent {
|
||||
|
||||
@@ -133,6 +142,8 @@ public interface MainApplicationComponent {
|
||||
|
||||
BaseFragmentComponent.Factory baseFragmentComponent();
|
||||
|
||||
BaseDialogFragmentComponent.Factory baseDialogFragmentComponent();
|
||||
|
||||
SplashActivityComponent.Factory splashActivityComponent();
|
||||
|
||||
LoginComponent.Factory loginActivityComponent();
|
||||
@@ -211,6 +222,10 @@ public interface MainApplicationComponent {
|
||||
|
||||
DialogEditArticoloComponent.Factory dialogEditArticoloComponent();
|
||||
|
||||
DialogPrintOrderSSCCListComponent.Factory dialogPrintOrderSSCCListComponent();
|
||||
|
||||
ProdLineeProduzioneComponent.Factory prodLineeProduzioneComponent();
|
||||
|
||||
void inject(MainApplication mainApplication);
|
||||
|
||||
void inject(AppContext mainApplication);
|
||||
|
||||
@@ -8,6 +8,7 @@ import it.integry.integrywmsnative.gest.ordini_uscita_elenco.OrdiniUscitaElencoF
|
||||
import it.integry.integrywmsnative.gest.picking_libero.PickingLiberoFragment;
|
||||
import it.integry.integrywmsnative.gest.prod_accettazione_ord_produzione.ProdOrdineProduzioneElencoFragment;
|
||||
import it.integry.integrywmsnative.gest.prod_fabbisogno_linee_prod.ProdFabbisognoLineeProdFragment;
|
||||
import it.integry.integrywmsnative.gest.prod_linee_produzione.ProdLineeProduzioneFragment;
|
||||
import it.integry.integrywmsnative.gest.prod_recupero_materiale.ProdRecuperoMaterialeFragment;
|
||||
import it.integry.integrywmsnative.gest.prod_rientro_merce.ProdRientroMerceFragment;
|
||||
import it.integry.integrywmsnative.gest.prod_versamento_materiale.ProdVersamentoMaterialeFragment;
|
||||
@@ -133,6 +134,14 @@ public class MenuConfiguration extends BaseMenuConfiguration {
|
||||
.setTitleIcon(it.integry.integrywmsnative.R.drawable.ic_dashboard_prod_accettazione_produzione)
|
||||
.setDrawerIcon(it.integry.integrywmsnative.R.drawable.ic_black_external)
|
||||
.setFragmentFactory(ProdRientroMerceFragment::newInstance))
|
||||
|
||||
.addItem(new MenuItem()
|
||||
.setID(it.integry.integrywmsnative.R.id.nav_prod_linee)
|
||||
.setCodMenu("MG061")
|
||||
.setTitleText(it.integry.integrywmsnative.R.string.nav_prod_linee_title)
|
||||
.setTitleIcon(R.drawable.ic_production_line)
|
||||
.setDrawerIcon(it.integry.integrywmsnative.R.drawable.ic_production_line)
|
||||
.setFragmentFactory(ProdLineeProduzioneFragment::newInstance))
|
||||
).addGroup(
|
||||
new MenuGroup()
|
||||
.setGroupText(R.string.internal_handling)
|
||||
|
||||
@@ -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,9 +19,10 @@ 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 = 8, exportSchema = false)
|
||||
@Database(entities = {ArticoloGriglia.class, Griglia.class, Ordine.class, ArticoloOrdine.class, SqlMtbColt.class, SqlMtbColr.class}, version = 9, exportSchema = false)
|
||||
@TypeConverters({
|
||||
DateConverter.class
|
||||
DateConverter.class,
|
||||
BigDecimalConverter.class
|
||||
})
|
||||
public abstract class AppDatabase extends RoomDatabase {
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -8,9 +8,8 @@ import androidx.room.Update;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.ArticoloGriglia;
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.ArticoloOrdine;
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.Ordine;
|
||||
import it.integry.integrywmsnative.core.data_store.db.wrappers.ArticoloOrdineWrapper;
|
||||
|
||||
@Dao
|
||||
public interface ArticoloOrdineDao {
|
||||
@@ -34,8 +33,17 @@ public interface ArticoloOrdineDao {
|
||||
@Update
|
||||
void update(ArticoloOrdine articolo);
|
||||
|
||||
@Query("SELECT * FROM articoli_ordine where id_ordine = :ordineId")
|
||||
List<ArticoloOrdine> findArticoliByOrdine(int ordineId);
|
||||
@Query("SELECT articoli_ordine.*," +
|
||||
"articoli_griglia.gg_scadenza," +
|
||||
"articoli_griglia.giacenza," +
|
||||
"articoli_griglia.qta_prevista_vendita," +
|
||||
"articoli_griglia.qta_proposta " +
|
||||
"FROM articoli_ordine " +
|
||||
"INNER JOIN ordini on articoli_ordine.id_ordine = ordini.ordine_id " +
|
||||
"LEFT OUTER JOIN articoli_griglia " +
|
||||
"on articoli_ordine.cod_mart = articoli_griglia.cod_mart and ordini.id_griglia = articoli_griglia.id_griglia and articoli_ordine.bar_code = articoli_griglia.bar_code " +
|
||||
"where id_ordine = :ordineId")
|
||||
List<ArticoloOrdineWrapper> findArticoliByOrdine(int ordineId);
|
||||
|
||||
@Query("SELECt * from articoli_ordine where cod_mart = :codMart and id_ordine = :ordineId LIMIT 1")
|
||||
ArticoloOrdine findArticoloByCodMartAndOrdine(int ordineId, String codMart);
|
||||
|
||||
@@ -6,7 +6,10 @@ import androidx.room.ForeignKey;
|
||||
import androidx.room.Index;
|
||||
import androidx.room.PrimaryKey;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||
|
||||
@@ -202,6 +205,14 @@ public class ArticoloGriglia {
|
||||
this.newNoPromo = newNoPromo;
|
||||
}
|
||||
|
||||
public String generateSystemNote() {
|
||||
HashMap<String, String> pairs = new HashMap<>();
|
||||
pairs.put("qta_proposta", String.valueOf(qtaProposta));
|
||||
pairs.put("giacenza", String.valueOf(giacenza));
|
||||
|
||||
return new JSONObject(pairs).toString();
|
||||
}
|
||||
|
||||
public ArticoloOrdine convertToArticoloOrdine(Ordine ordine) {
|
||||
ArticoloOrdine articolo = new ArticoloOrdine();
|
||||
|
||||
@@ -222,6 +233,7 @@ public class ArticoloGriglia {
|
||||
articolo.setQtaPrevistaVendita(BigDecimal.valueOf(this.getQtaPrevistaVendita()));
|
||||
articolo.setQtaProposta(BigDecimal.valueOf(this.getQtaProposta()));
|
||||
articolo.setNewNoPromo(this.isNewNoPromo());
|
||||
articolo.setSystemNote(generateSystemNote());
|
||||
|
||||
articolo.setQtaOrd(0);
|
||||
|
||||
|
||||
@@ -70,6 +70,9 @@ public class ArticoloOrdine {
|
||||
@ColumnInfo(name = "new_no_promo")
|
||||
private boolean newNoPromo;
|
||||
|
||||
@ColumnInfo(name = "system_note")
|
||||
private String systemNote;
|
||||
|
||||
@Ignore
|
||||
private int ggScadenza = 0;
|
||||
|
||||
@@ -82,6 +85,9 @@ public class ArticoloOrdine {
|
||||
@Ignore
|
||||
private BigDecimal qtaProposta = BigDecimal.ZERO;
|
||||
|
||||
@Ignore
|
||||
private int bgTint;
|
||||
|
||||
|
||||
public Integer getArticoloOrdineId() {
|
||||
return articoloOrdineId;
|
||||
@@ -244,6 +250,31 @@ 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;
|
||||
}
|
||||
|
||||
public String getSystemNote() {
|
||||
return systemNote;
|
||||
}
|
||||
|
||||
public void setSystemNote(String systemNote) {
|
||||
this.systemNote = systemNote;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package it.integry.integrywmsnative.core.di.binders;
|
||||
|
||||
import androidx.appcompat.widget.AppCompatImageView;
|
||||
import androidx.databinding.BindingAdapter;
|
||||
|
||||
public class ImageViewBinders {
|
||||
@BindingAdapter("tint")
|
||||
public static void bindImageViewTint(final AppCompatImageView view, final int color) {
|
||||
view.setColorFilter(color, android.graphics.PorterDuff.Mode.MULTIPLY);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package it.integry.integrywmsnative.core.exception;
|
||||
|
||||
public class BluetoothConnectionException extends Exception {
|
||||
|
||||
public BluetoothConnectionException(String btDeviceName, String btDeviceMac, Throwable th) {
|
||||
super("Impossibile collegarsi al dispositivo bluetooth: " + btDeviceName + " [" + btDeviceMac + "]. Riprovare.");
|
||||
initCause(th);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package it.integry.integrywmsnative.core.exception;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public class InvalidConnectionException extends Exception {
|
||||
|
||||
|
||||
public InvalidConnectionException(String host, int port, Throwable cause) {
|
||||
super(String.format(Locale.ITALY, "Impossibile stabilire la connessione con il server (%s:%d)", host, port), cause);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,6 +4,11 @@ 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");
|
||||
}
|
||||
}
|
||||
@@ -36,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()) {
|
||||
@@ -56,47 +95,4 @@ public class BaseActivity extends AppCompatActivity {
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
protected void openProgress() {
|
||||
BarcodeManager.disable();
|
||||
if (!progressOpened) {
|
||||
this.progressOpened = true;
|
||||
runOnUiThread(() -> {
|
||||
this.mCurrentProgress.show(getSupportFragmentManager(), "tag");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
protected void closeProgress() {
|
||||
BarcodeManager.enable();
|
||||
if (progressOpened) {
|
||||
this.progressOpened = false;
|
||||
runOnUiThread(() -> {
|
||||
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 {
|
||||
}
|
||||
@@ -54,13 +54,31 @@ public abstract class BaseFragment extends Fragment {
|
||||
}
|
||||
|
||||
public void onLoadingStarted() {
|
||||
BarcodeManager.disable();
|
||||
this.openProgress();
|
||||
}
|
||||
|
||||
public void onLoadingEnded() {
|
||||
this.closeProgress();
|
||||
}
|
||||
|
||||
private void openProgress() {
|
||||
BarcodeManager.disable();
|
||||
if (!progressOpened && !this.mCurrentProgress.isAdded()) {
|
||||
this.progressOpened = true;
|
||||
requireActivity().runOnUiThread(() -> {
|
||||
this.mCurrentProgress.show(requireActivity().getSupportFragmentManager(), "tag");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void closeProgress() {
|
||||
BarcodeManager.enable();
|
||||
if (progressOpened) {
|
||||
this.progressOpened = false;
|
||||
requireActivity().runOnUiThread(() -> {
|
||||
mCurrentProgress.dismiss();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public void onError(Exception ex) {
|
||||
@@ -81,24 +99,6 @@ public abstract class BaseFragment extends Fragment {
|
||||
}
|
||||
}
|
||||
|
||||
protected void openProgress() {
|
||||
if (!progressOpened) {
|
||||
this.progressOpened = true;
|
||||
requireActivity().runOnUiThread(() -> {
|
||||
this.mCurrentProgress.show(requireActivity().getSupportFragmentManager(), "tag");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
protected void closeProgress() {
|
||||
if (progressOpened) {
|
||||
this.progressOpened = false;
|
||||
requireActivity().runOnUiThread(() -> {
|
||||
mCurrentProgress.dismiss();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
protected void popMe() {
|
||||
requireActivity().runOnUiThread(() -> {
|
||||
((IPoppableActivity) requireActivity()).pop();
|
||||
|
||||
@@ -21,13 +21,13 @@ public abstract class ExtendedSectionedRecyclerView<T, SH extends RecyclerView.V
|
||||
public ExtendedSectionedRecyclerView(ObservableArrayList<T> myDataset) {
|
||||
mDataset.addAll(myDataset);
|
||||
|
||||
myDataset.addOnListChangedCallback(new OnListGeneralChangedCallback() {
|
||||
myDataset.addOnListChangedCallback(new OnListGeneralChangedCallback<T>() {
|
||||
@Override
|
||||
public void onChanged(ObservableList sender) {
|
||||
public void onChanged(ObservableList<T> sender) {
|
||||
mDataset.clear();
|
||||
mDataset.addAll(sender);
|
||||
notifyDataSetChanged();
|
||||
notifyDataChanged();
|
||||
notifyDataSetChanged();
|
||||
checkIfEmpty();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,13 +1,20 @@
|
||||
package it.integry.integrywmsnative.core.model;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import androidx.databinding.ObservableArrayList;
|
||||
|
||||
import com.annimon.stream.Optional;
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.dto.InternalCodAnagsDTO;
|
||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDB;
|
||||
@@ -105,11 +112,41 @@ public class MtbColt extends EntityBase {
|
||||
}
|
||||
}
|
||||
|
||||
public MtbColt initDefaultFields() {
|
||||
public MtbColt initDefaultFields(GestioneEnum gestioneEnum) {
|
||||
setGestione(gestioneEnum);
|
||||
setCodMdep(SettingsManager.i().getUserSession().getDepo().getCodMdep());
|
||||
setPreparatoDa(SettingsManager.i().getUser().getFullname());
|
||||
setOraInizPrep(UtilityDate.getDateInstance());
|
||||
setCodAnag(SettingsManager.iDB().getDefaultCodAnag());
|
||||
|
||||
String codAnagToUse = null;
|
||||
switch (gestioneEnum) {
|
||||
case ACQUISTO:
|
||||
case LAVORAZIONE:
|
||||
case PRODUZIONE:
|
||||
if (SettingsManager.iDB().getInternalCodAnags() == null) break;
|
||||
|
||||
Optional<InternalCodAnagsDTO> optCodAnagForn = Stream.of(SettingsManager.iDB().getInternalCodAnags())
|
||||
.filter(InternalCodAnagsDTO::isFornitore)
|
||||
.findFirst();
|
||||
|
||||
if (optCodAnagForn.isEmpty()) break;
|
||||
|
||||
codAnagToUse = optCodAnagForn.get().getCodAnag();
|
||||
break;
|
||||
case VENDITA:
|
||||
if (SettingsManager.iDB().getInternalCodAnags() == null) break;
|
||||
|
||||
Optional<InternalCodAnagsDTO> optCodAnagClie = Stream.of(SettingsManager.iDB().getInternalCodAnags())
|
||||
.filter(InternalCodAnagsDTO::isCliente)
|
||||
.findFirst();
|
||||
|
||||
if (optCodAnagClie.isEmpty()) break;
|
||||
|
||||
codAnagToUse = optCodAnagClie.get().getCodAnag();
|
||||
break;
|
||||
}
|
||||
|
||||
setCodAnag(codAnagToUse);
|
||||
|
||||
return this;
|
||||
}
|
||||
@@ -540,9 +577,41 @@ public class MtbColt extends EntityBase {
|
||||
String xmlPrefix = "{\"whereCond\": \"";
|
||||
String xmlSuffix = "\"}";
|
||||
|
||||
StringBuilder whereCond = new StringBuilder();
|
||||
// StringBuilder whereCond = new StringBuilder();
|
||||
String whereCond;
|
||||
List<String> conditions = new ArrayList<>();
|
||||
String existingFilter;
|
||||
if (this.filtroOrdini != null) {
|
||||
existingFilter = this.filtroOrdini;
|
||||
existingFilter = existingFilter.replace(xmlPrefix, "").replace(xmlSuffix, "");
|
||||
conditions.add(existingFilter);
|
||||
} else {
|
||||
existingFilter = "";
|
||||
}
|
||||
|
||||
if (filtroOrdineDtos != null && filtroOrdineDtos.size() > 0) {
|
||||
|
||||
for (FiltroOrdineDTO filtroOrdineDTO : filtroOrdineDtos) {
|
||||
try {
|
||||
String condition = (String.format("(d.g = %s AND d.d = %s and d.n = %s",
|
||||
UtilityDB.valueToString(filtroOrdineDTO.getGestioneOrd()),
|
||||
UtilityDB.valueToString(UtilityDate.formatDate(filtroOrdineDTO.getDataOrdD(), UtilityDate.COMMONS_DATE_FORMATS.YMD_SLASH)),
|
||||
UtilityDB.valueToString(filtroOrdineDTO.getNumOrd())));
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(filtroOrdineDTO.getDataConsS())) {
|
||||
condition += (String.format(" AND dr.dc = %s",
|
||||
UtilityDB.valueToString(UtilityDate.formatDate(filtroOrdineDTO.getDataConsD(), UtilityDate.COMMONS_DATE_FORMATS.YMD_SLASH))));
|
||||
}
|
||||
|
||||
condition += ")";
|
||||
if (!existingFilter.contains(condition)) {
|
||||
conditions.add(condition);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/*if (filtroOrdineDtos != null && filtroOrdineDtos.size() > 0) {
|
||||
|
||||
for (int i = 0; i < filtroOrdineDtos.size(); i++) {
|
||||
FiltroOrdineDTO x = filtroOrdineDtos.get(i);
|
||||
@@ -568,7 +637,8 @@ public class MtbColt extends EntityBase {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}*/
|
||||
whereCond = TextUtils.join(" OR ", conditions);
|
||||
|
||||
this.filtroOrdini = xmlPrefix + whereCond + xmlSuffix;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package it.integry.integrywmsnative.core.model.dto;
|
||||
|
||||
public class InternalCodAnagsDTO {
|
||||
|
||||
private String codAnag;
|
||||
private boolean isCliente;
|
||||
private boolean isFornitore;
|
||||
|
||||
public String getCodAnag() {
|
||||
return codAnag;
|
||||
}
|
||||
|
||||
public InternalCodAnagsDTO setCodAnag(String codAnag) {
|
||||
this.codAnag = codAnag;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isCliente() {
|
||||
return isCliente;
|
||||
}
|
||||
|
||||
public InternalCodAnagsDTO setCliente(boolean cliente) {
|
||||
isCliente = cliente;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isFornitore() {
|
||||
return isFornitore;
|
||||
}
|
||||
|
||||
public InternalCodAnagsDTO setFornitore(boolean fornitore) {
|
||||
isFornitore = fornitore;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package it.integry.integrywmsnative.core.report;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public enum ReportType {
|
||||
|
||||
@SerializedName("0")
|
||||
ETICHETTA_SSCC_ACCETTAZIONE(0),
|
||||
@SerializedName("1")
|
||||
ETICHETTA_SSCC_LAVORAZIONE(1),
|
||||
@SerializedName("2")
|
||||
ETICHETTA_SSCC_SPEDIZIONE(2),
|
||||
@SerializedName("3")
|
||||
WMS_SPEDIZIONE_ETICHETTE_SSCC_ORD(3),
|
||||
@SerializedName("4")
|
||||
WMS_SPEDIZIONE_PACKING_LIST_ORD(4),
|
||||
@SerializedName("5")
|
||||
STAMPA_LISTINI_VENDITA(5);
|
||||
|
||||
private final int value;
|
||||
|
||||
ReportType(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public static ReportType from(Object value) {
|
||||
int castValue = (int) value;
|
||||
for (ReportType b : ReportType.values()) {
|
||||
if (b.value == castValue)
|
||||
return b;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public int getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import java.net.SocketTimeoutException;
|
||||
import java.util.HashMap;
|
||||
|
||||
import it.integry.integrywmsnative.core.exception.NoPrintersFoundException;
|
||||
import it.integry.integrywmsnative.core.exception.NoResultFromBarcodeException;
|
||||
|
||||
/**
|
||||
* Created by GiuseppeS on 22/03/2018.
|
||||
@@ -15,12 +16,17 @@ public class CommonRESTException {
|
||||
private static String MESSAGE_KEY = "message";
|
||||
private static String EXCEPTION_KEY = "exception";
|
||||
|
||||
private static HashMap<String, HashMap<String, Object>> bindingExceptions = new HashMap() {{
|
||||
put("Printer not found", new HashMap<String, Object>(){{
|
||||
private static final HashMap<String, HashMap<String, Object>> bindingExceptions = new HashMap<>() {{
|
||||
put("Printer not found", new HashMap<>() {{
|
||||
put(MESSAGE_KEY, "Stampante non trovata");
|
||||
put(EXCEPTION_KEY, NoPrintersFoundException.class);
|
||||
}});
|
||||
|
||||
put("barcode non letto correttamente", new HashMap<>() {{
|
||||
put(MESSAGE_KEY, "Barcode non letto correttamente");
|
||||
put(EXCEPTION_KEY, NoResultFromBarcodeException.class);
|
||||
}});
|
||||
|
||||
|
||||
}};
|
||||
|
||||
@@ -42,13 +48,11 @@ public class CommonRESTException {
|
||||
|
||||
for(String key : bindingExceptions.keySet()) {
|
||||
if(message.contains(key)) {
|
||||
Class classType = (Class) bindingExceptions.get(key).get(EXCEPTION_KEY);
|
||||
Class<?> classType = (Class<?>) bindingExceptions.get(key).get(EXCEPTION_KEY);
|
||||
|
||||
try {
|
||||
return (Exception) classType.newInstance();
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
} catch (InstantiationException e) {
|
||||
} catch (IllegalAccessException | InstantiationException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ public class RESTBuilder {
|
||||
return getService(service, SettingsManager.i().getServer().getHost(), SettingsManager.i().getServer().getPort(), true);
|
||||
|
||||
}
|
||||
|
||||
public static <T> T getService(final Class<T> service, int timeout) {
|
||||
return getService(service, SettingsManager.i().getServer().getHost(), SettingsManager.i().getServer().getPort(), true, true, timeout);
|
||||
|
||||
@@ -62,4 +63,13 @@ public class RESTBuilder {
|
||||
|
||||
return retrofit.create(service);
|
||||
}
|
||||
|
||||
|
||||
public static String getDefaultHost() {
|
||||
return SettingsManager.i().getServer().getHost();
|
||||
}
|
||||
|
||||
public static int getDefaultPort() {
|
||||
return SettingsManager.i().getServer().getPort();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,10 +104,9 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
public void createColloLavorazione(int segno, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
MtbColt mtbColtToCreate = new MtbColt()
|
||||
.setSegno(segno)
|
||||
.setGestione(GestioneEnum.LAVORAZIONE);
|
||||
.setSegno(segno);
|
||||
|
||||
mtbColtToCreate.initDefaultFields();
|
||||
mtbColtToCreate.initDefaultFields(GestioneEnum.LAVORAZIONE);
|
||||
|
||||
mtbColtToCreate
|
||||
.setOperation(CommonModelConsts.OPERATION.INSERT);
|
||||
@@ -123,9 +122,8 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
public void createColloScaricoDaCarico(MtbColt sourceMtbColt, MtbDepoPosizione posizione, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
MtbColt newMtbColt = new MtbColt()
|
||||
.initDefaultFields()
|
||||
.initDefaultFields(GestioneEnum.LAVORAZIONE)
|
||||
.setCodAnag(null)
|
||||
.setGestione(GestioneEnum.LAVORAZIONE)
|
||||
.setSegno(-1)
|
||||
.setCodTcol(sourceMtbColt.getCodTcol())
|
||||
.setPesoKg(sourceMtbColt.getPesoKg())
|
||||
@@ -176,9 +174,8 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
public void createColliScaricoDaOrdineLavorazione(MtbColt sourceMtbColt, MtbColr sourceMtbColr, MtbDepoPosizione posizione, List<OrdineLavorazioneDTO> ordini, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
MtbColt newMtbColt = new MtbColt()
|
||||
.initDefaultFields()
|
||||
.initDefaultFields(GestioneEnum.LAVORAZIONE)
|
||||
.setCodAnag(null)
|
||||
.setGestione(GestioneEnum.LAVORAZIONE)
|
||||
.setSegno(-1)
|
||||
.setCodTcol(sourceMtbColt.getCodTcol())
|
||||
// .setPesoKg(sourceMtbColt.getPesoKg())
|
||||
@@ -246,11 +243,16 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
public void createColloFromEtichettaAnonima(String barcode, GestioneEnum gestione, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
MtbColt mtbColtToCreate = new MtbColt()
|
||||
.setGestione(gestione);
|
||||
.initDefaultFields(gestione);
|
||||
|
||||
mtbColtToCreate.initDefaultFields();
|
||||
Integer customNumCollo = null;
|
||||
|
||||
try {
|
||||
customNumCollo = UtilityBarcode.getNumColloFromULAnonima(barcode);
|
||||
} catch (Exception ex) {
|
||||
onFailed.run(ex);
|
||||
}
|
||||
|
||||
Integer customNumCollo = UtilityBarcode.getNumColloFromULAnonima(barcode);
|
||||
String customSerCollo = CommonConst.Config.DEFAULT_ANONYMOUS_UL_SERIE;
|
||||
|
||||
if (customNumCollo != null) {
|
||||
@@ -587,6 +589,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
}
|
||||
|
||||
public void spostaArtsTraUL(MtbColt sourceMtbColt, MtbColt destMtbColt, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
new Thread(() -> {
|
||||
MtbColt mtbColtToMoveClone = (MtbColt) sourceMtbColt.clone();
|
||||
MtbColt mtbColtDestClone = (MtbColt) destMtbColt.clone();
|
||||
|
||||
@@ -616,6 +619,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
if (onFailed != null) onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
}).start();
|
||||
}
|
||||
|
||||
public void assegnaLottoSuColloScarico(MtbColt sourceMtbColt, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
@@ -6,11 +6,11 @@ import java.util.List;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.model.StbGestSetup;
|
||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||
import it.integry.integrywmsnative.core.rest.model.GestSetupDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityLogger;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
@@ -80,7 +80,7 @@ public class GestSetupRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
public static void getValues(List<StbGestSetup> stbGestSetupList, RunnableArgs<List<StbGestSetup>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
GestSetupRESTConsumerService service = RESTBuilder.getService(GestSetupRESTConsumerService.class);
|
||||
service.getGestSetupValues(stbGestSetupList).enqueue(new Callback<ServiceRESTResponse<List<StbGestSetup>>>() {
|
||||
service.getGestSetupValues(stbGestSetupList).enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<List<StbGestSetup>>> call, Response<ServiceRESTResponse<List<StbGestSetup>>> response) {
|
||||
analyzeAnswer(response, "GestSetup", onComplete, onFailed);
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -160,7 +161,15 @@ public class OrdiniRESTConsumer extends _BaseRESTConsumer {
|
||||
service.getArticoliFromOrdini(codMdep, getPickingListDTOs).enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<List<SitArtOrdDTO>>> call, Response<ServiceRESTResponse<List<SitArtOrdDTO>>> response) {
|
||||
analyzeAnswer(response, "retrieveListaArticoliFromOrdiniUscita", onComplete, onFailed);
|
||||
analyzeAnswer(response, "retrieveListaArticoliFromOrdiniUscita", sitArtOrds -> {
|
||||
if (sitArtOrds != null) {
|
||||
for (SitArtOrdDTO sitArtOrd : sitArtOrds) {
|
||||
sitArtOrd.setCodMart(sitArtOrd.getCodMart().trim());
|
||||
}
|
||||
}
|
||||
|
||||
onComplete.run(sitArtOrds);
|
||||
}, onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -182,13 +191,13 @@ public class OrdiniRESTConsumer extends _BaseRESTConsumer {
|
||||
}
|
||||
|
||||
String baseSql = "SELECT DISTINCT mtb_colt.* " +
|
||||
"FROM mtb_colt, " +
|
||||
" mtb_colr " +
|
||||
"WHERE mtb_colt.gestione = mtb_colr.gestione " +
|
||||
"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 " +
|
||||
" AND " + whereCondGestione +
|
||||
" WHERE " + whereCondGestione +
|
||||
" AND mtb_colt.segno = " + UtilityDB.valueToString(segno) + " " +
|
||||
" AND mtb_colt.data_doc IS NULL AND ";
|
||||
|
||||
|
||||
@@ -136,7 +136,6 @@ public class PVOrdiniAcquistoRESTConsumer extends _BaseRESTConsumer {
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
private ArtDTO convertArtToDTO(ArticoloOrdine art, int rigaOrd) {
|
||||
@@ -147,6 +146,7 @@ public class PVOrdiniAcquistoRESTConsumer extends _BaseRESTConsumer {
|
||||
dto.setDescrizione(art.getDescrizione());
|
||||
dto.setDataInsD(art.getDataIns());
|
||||
dto.setUntMis(art.getUntMis());
|
||||
dto.setSystemNote(art.getSystemNote());
|
||||
dto.setQta(BigDecimal.valueOf(art.getQtaOrd()));
|
||||
dto.setQtaCnf(BigDecimal.valueOf(art.getQtaCnf()));
|
||||
dto.setColli(BigDecimal.ZERO);
|
||||
|
||||
@@ -9,16 +9,18 @@ import java.util.List;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import it.integry.integrywmsnative.BuildConfig;
|
||||
import it.integry.integrywmsnative.core.exception.NoPrintersFoundException;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.report.ReportType;
|
||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||
import it.integry.integrywmsnative.core.rest.model.JasperDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.JasperPairDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.ReportTypeDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityLogger;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
import it.integry.integrywmsnative.gest.spedizione.model.PrintOrderCloseDTO;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
@@ -55,7 +57,7 @@ public class PrinterRESTConsumer extends _BaseRESTConsumer {
|
||||
});
|
||||
}
|
||||
|
||||
public void printCollo(Type printerType, MtbColt testataColloToPrint, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public void printCollo(MtbColt testataColloToPrint, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
// if (BuildConfig.DEBUG) {
|
||||
// onComplete.run();
|
||||
@@ -64,9 +66,6 @@ public class PrinterRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
PrinterRESTConsumerService printerService = RESTBuilder.getService(PrinterRESTConsumerService.class);
|
||||
Call<ServiceRESTResponse<Object>> callable = null;
|
||||
if (printerType != null)
|
||||
callable = printerService.printCollo(printerType.toString(), testataColloToPrint);
|
||||
else
|
||||
callable = printerService.printCollo(testataColloToPrint);
|
||||
|
||||
callable.enqueue(new Callback<>() {
|
||||
@@ -119,4 +118,64 @@ public class PrinterRESTConsumer extends _BaseRESTConsumer {
|
||||
});
|
||||
}
|
||||
|
||||
public void printReportType(ReportType reportType, String codMdep, String codAnag, HashMap<String, Object> params, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
ReportTypeDTO reportTypeDTO = new ReportTypeDTO();
|
||||
reportTypeDTO.setReportType(reportType);
|
||||
reportTypeDTO.setCodAnag(codAnag);
|
||||
reportTypeDTO.setCodMdep(codMdep);
|
||||
|
||||
Stream.of(params)
|
||||
.forEach(x -> reportTypeDTO.getParams().add(new JasperPairDTO(x.getKey(), x.getValue())));
|
||||
|
||||
PrinterRESTConsumerService printerService = RESTBuilder.getService(PrinterRESTConsumerService.class);
|
||||
printerService
|
||||
.printReportType(reportTypeDTO)
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) {
|
||||
analyzeAnswer(response, "printReportType", data -> {
|
||||
onComplete.run();
|
||||
}, onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<Object>> call, Throwable t) {
|
||||
if (t.getMessage().contains("Printer not found")) {
|
||||
onFailed.run(new NoPrintersFoundException());
|
||||
} else onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void printReportType(ReportType reportType, HashMap<String, Object> params, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
printReportType(reportType, null, null, params, onComplete, onFailed);
|
||||
}
|
||||
|
||||
public void printReportType(ReportType reportType, String codMdep, HashMap<String, Object> params, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
printReportType(reportType, codMdep, null, params, onComplete, onFailed);
|
||||
}
|
||||
|
||||
public void printClosedOrders(PrintOrderCloseDTO dto, String codMdep, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
PrinterRESTConsumerService printerService = RESTBuilder.getService(PrinterRESTConsumerService.class, 240);
|
||||
Call<ServiceRESTResponse<Object>> callable = printerService.printClosedOrders(codMdep, dto);
|
||||
callable.enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) {
|
||||
analyzeAnswer(response, "printCollo", data -> {
|
||||
onComplete.run();
|
||||
}, onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<Object>> call, Throwable t) {
|
||||
if (t.getMessage().contains("Printer not found")) {
|
||||
onFailed.run(new NoPrintersFoundException());
|
||||
} else onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -4,7 +4,9 @@ import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.rest.model.JasperDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.ReportTypeDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.gest.spedizione.model.PrintOrderCloseDTO;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.http.Body;
|
||||
import retrofit2.http.POST;
|
||||
@@ -26,11 +28,9 @@ public interface PrinterRESTConsumerService {
|
||||
@Body JasperDTO jasperDTO
|
||||
);
|
||||
|
||||
|
||||
@POST("wms/printEtichettaSSCC")
|
||||
Call<ServiceRESTResponse<Object>> printCollo(
|
||||
@Query("printerType") String printerType,
|
||||
@Body MtbColt mtbColtToPrint
|
||||
@POST("printReportType")
|
||||
Call<ServiceRESTResponse<Object>> printReportType(
|
||||
@Body ReportTypeDTO reportTypeDTO
|
||||
);
|
||||
|
||||
@POST("wms/printEtichettaSSCC")
|
||||
@@ -38,4 +38,10 @@ public interface PrinterRESTConsumerService {
|
||||
@Body MtbColt mtbColtToPrint
|
||||
);
|
||||
|
||||
@POST("wms/printClosedOrders")
|
||||
Call<ServiceRESTResponse<Object>> printClosedOrders(
|
||||
@Query("codMdep") String codMdep,
|
||||
@Body PrintOrderCloseDTO printOrderCloseDTO
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
package it.integry.integrywmsnative.core.rest.consumers;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.gest.prod_linee_produzione.dto.ProdLineStatusDTO;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
|
||||
@Singleton
|
||||
public class ProductionLinesRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
public void avviaLineaDiProduzione(String codJfas, Integer hrNum, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ProductionLinesRESTConsumerService restService = RESTBuilder.getService(ProductionLinesRESTConsumerService.class);
|
||||
Call<ServiceRESTResponse<JsonObject>> callable = restService.avviaLineaDiProduzione(codJfas, hrNum);
|
||||
callable.enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<JsonObject>> call, Response<ServiceRESTResponse<JsonObject>> response) {
|
||||
analyzeAnswer(response, "avviaLineaDiProduzione", data -> {
|
||||
onComplete.run();
|
||||
}, onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<JsonObject>> call, Throwable t) {
|
||||
onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void arrestaLineaDiProduzione(String codJfas, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ProductionLinesRESTConsumerService restService = RESTBuilder.getService(ProductionLinesRESTConsumerService.class);
|
||||
Call<ServiceRESTResponse<JsonObject>> callable = restService.arrestaLineaDiProduzione(codJfas);
|
||||
callable.enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<JsonObject>> call, Response<ServiceRESTResponse<JsonObject>> response) {
|
||||
analyzeAnswer(response, "arrestaLineaDiProduzione", data -> {
|
||||
onComplete.run();
|
||||
}, onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<JsonObject>> call, Throwable t) {
|
||||
onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void avviaProduzioneArticoloSuLinea(String codJfas, String codMart, String partitaMag, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ProductionLinesRESTConsumerService restService = RESTBuilder.getService(ProductionLinesRESTConsumerService.class, 300);
|
||||
Call<ServiceRESTResponse<JsonObject>> callable = restService.avviaProduzioneArticoloSuLinea(codJfas, codMart, partitaMag);
|
||||
callable.enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<JsonObject>> call, Response<ServiceRESTResponse<JsonObject>> response) {
|
||||
analyzeAnswer(response, "avviaProduzioneArticoloSuLinea", data -> {
|
||||
onComplete.run();
|
||||
}, onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<JsonObject>> call, Throwable t) {
|
||||
onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void getStatoLinee(String codMdep, RunnableArgs<List<ProdLineStatusDTO>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ProductionLinesRESTConsumerService restService = RESTBuilder.getService(ProductionLinesRESTConsumerService.class);
|
||||
Call<ServiceRESTResponse<List<ProdLineStatusDTO>>> callable = restService.getStatoLinee(codMdep);
|
||||
callable.enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<List<ProdLineStatusDTO>>> call, Response<ServiceRESTResponse<List<ProdLineStatusDTO>>> response) {
|
||||
analyzeAnswer(response, "getStatoLinee", onComplete::run, onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<List<ProdLineStatusDTO>>> call, Throwable t) {
|
||||
onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package it.integry.integrywmsnative.core.rest.consumers;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.gest.prod_linee_produzione.dto.ProdLineStatusDTO;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.POST;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
public interface ProductionLinesRESTConsumerService {
|
||||
|
||||
@POST("mes_v2/avviaLineaDiProduzione")
|
||||
Call<ServiceRESTResponse<JsonObject>> avviaLineaDiProduzione(@Query("codJfas") String codJfas, @Query("hrNum") Integer hrNum);
|
||||
|
||||
@POST("mes_v2/arrestaLineaDiProduzione")
|
||||
Call<ServiceRESTResponse<JsonObject>> arrestaLineaDiProduzione(@Query("codJfas") String codJfas);
|
||||
|
||||
@POST("mes_v2/avviaProduzioneArticoloSuLinea")
|
||||
Call<ServiceRESTResponse<JsonObject>> avviaProduzioneArticoloSuLinea(@Query("codJfas") String codJfas, @Query("codMart") String codMart, @Query("partitaMag") String partitaMag);
|
||||
|
||||
@GET("mes_v2/statoLineeProd")
|
||||
Call<ServiceRESTResponse<List<ProdLineStatusDTO>>> getStatoLinee(@Query("codMdep") String codMdep);
|
||||
}
|
||||
@@ -15,6 +15,7 @@ import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.Reader;
|
||||
import java.lang.reflect.Type;
|
||||
import java.net.ConnectException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@@ -23,6 +24,7 @@ import javax.inject.Singleton;
|
||||
|
||||
import it.integry.integrywmsnative.BuildConfig;
|
||||
import it.integry.integrywmsnative.core.CommonConst;
|
||||
import it.integry.integrywmsnative.core.exception.InvalidConnectionException;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.model.Azienda;
|
||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||
@@ -47,12 +49,14 @@ public class SystemRESTConsumer extends _BaseRESTConsumer {
|
||||
nativeSqlDTO.nativeSql = nativeSql;
|
||||
|
||||
SystemRESTConsumerService service = RESTBuilder.getService(SystemRESTConsumerService.class);
|
||||
service.processSql(nativeSqlDTO).enqueue(new Callback<>() {
|
||||
service
|
||||
.processSql(nativeSqlDTO)
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) {
|
||||
analyzeAnswer(response, "ProcessSql", o -> {
|
||||
Gson gson = new GsonBuilder()
|
||||
.registerTypeAdapter(Date.class, (JsonDeserializer) (json, typeOfT, context) -> {
|
||||
.registerTypeAdapter(Date.class, (JsonDeserializer<?>) (json, typeOfT, context) -> {
|
||||
try {
|
||||
return UtilityDate.recognizeDate(json.getAsString());
|
||||
} catch (Exception e) {
|
||||
@@ -75,6 +79,10 @@ public class SystemRESTConsumer extends _BaseRESTConsumer {
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<Object>> call, Throwable t) {
|
||||
Logger.e(t, "ProcessSQL");
|
||||
|
||||
if (t instanceof ConnectException)
|
||||
onFailed.run(new InvalidConnectionException(RESTBuilder.getDefaultHost(), RESTBuilder.getDefaultPort(), t));
|
||||
else
|
||||
onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.util.Log;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.exception.NotValidLicenseException;
|
||||
import it.integry.integrywmsnative.core.rest.CommonRESTException;
|
||||
import it.integry.integrywmsnative.core.rest.model.EsitoType;
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
@@ -12,7 +13,7 @@ import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
import retrofit2.Response;
|
||||
|
||||
public class _BaseRESTConsumer {
|
||||
public abstract class _BaseRESTConsumer {
|
||||
|
||||
public static <T> void analyzeAnswer(Response<ServiceRESTResponse<T>> response, String logTitle, RunnableArgs<T> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
if (response.isSuccessful()) {
|
||||
@@ -30,7 +31,6 @@ public class _BaseRESTConsumer {
|
||||
}
|
||||
} else {
|
||||
Log.e(logTitle, response.body().getErrorMessage());
|
||||
// callback.onFailed(new Exception(response.body().getErrorMessage()));
|
||||
onFailed.run(CommonRESTException.tryRecognizeException(response.body().getErrorMessage()));
|
||||
}
|
||||
} else {
|
||||
@@ -41,7 +41,9 @@ public class _BaseRESTConsumer {
|
||||
if (response.code() == 404) {
|
||||
Log.e(logTitle, "Errore " + response.code() + ": risorsa non trovata (" + response.raw().request().url().toString() + ")");
|
||||
onFailed.run(new Exception("Errore " + response.code() + ": risorsa non trovata (" + logTitle + ")"));
|
||||
} else {
|
||||
} else if (response.code() == 550)
|
||||
onFailed.run(new NotValidLicenseException());
|
||||
else {
|
||||
Log.e(logTitle, "Status " + response.code() + ": " + response.message());
|
||||
onFailed.run(new Exception("Status " + response.code() + ": " + response.message()));
|
||||
}
|
||||
@@ -64,7 +66,7 @@ public class _BaseRESTConsumer {
|
||||
}
|
||||
} else {
|
||||
Log.e(logTitle, response.body().getErrorMessage());
|
||||
onFailed.run(new Exception(response.body().getErrorMessage()));
|
||||
onFailed.run(CommonRESTException.tryRecognizeException(response.body().getErrorMessage()));
|
||||
}
|
||||
} else {
|
||||
Log.e(logTitle, response.message());
|
||||
@@ -74,7 +76,9 @@ public class _BaseRESTConsumer {
|
||||
if (response.code() == 404) {
|
||||
Log.e(logTitle, "Errore " + response.code() + ": risorsa non trovata");
|
||||
onFailed.run(new Exception("Errore " + response.code() + ": risorsa non trovata (" + logTitle + ")"));
|
||||
} else {
|
||||
} else if (response.code() == 550)
|
||||
onFailed.run(new NotValidLicenseException());
|
||||
else {
|
||||
Log.e(logTitle, "Status " + response.code() + ": " + response.message());
|
||||
onFailed.run(new Exception("Status " + response.code() + ": " + response.message()));
|
||||
}
|
||||
@@ -111,7 +115,9 @@ public class _BaseRESTConsumer {
|
||||
if (responseList.code() == 404) {
|
||||
Log.e(logTitle, "Errore " + responseList.code() + ": risorsa non trovata");
|
||||
onFailed.run(new Exception("Errore " + responseList.code() + ": risorsa non trovata (" + logTitle + ")"));
|
||||
} else {
|
||||
} else if (responseList.code() == 550)
|
||||
onFailed.run(new NotValidLicenseException());
|
||||
else {
|
||||
Log.e(logTitle, "Status " + responseList.code() + ": " + responseList.message());
|
||||
onFailed.run(new Exception("Status " + responseList.code() + ": " + responseList.message()));
|
||||
}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
package it.integry.integrywmsnative.core.rest.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.report.ReportType;
|
||||
|
||||
public class ReportTypeDTO {
|
||||
|
||||
|
||||
private ReportType reportType;
|
||||
private String codAnag;
|
||||
private String codMdep;
|
||||
private List<JasperPairDTO> params = new ArrayList<>();
|
||||
|
||||
public List<JasperPairDTO> getParams() {
|
||||
return params;
|
||||
}
|
||||
|
||||
public ReportTypeDTO setParams(List<JasperPairDTO> params) {
|
||||
this.params = params;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ReportType getReportType() {
|
||||
return reportType;
|
||||
}
|
||||
|
||||
public ReportTypeDTO setReportType(ReportType reportType) {
|
||||
this.reportType = reportType;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodAnag() {
|
||||
return codAnag;
|
||||
}
|
||||
|
||||
public ReportTypeDTO setCodAnag(String codAnag) {
|
||||
this.codAnag = codAnag;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodMdep() {
|
||||
return codMdep;
|
||||
}
|
||||
|
||||
public ReportTypeDTO setCodMdep(String codMdep) {
|
||||
this.codMdep = codMdep;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -31,7 +31,11 @@ public class ServerStatusChecker {
|
||||
@Override
|
||||
public void run() {
|
||||
if (shouldExecute && !UtilityString.isNullOrEmpty(SettingsManager.i().getServer().getHost())) {
|
||||
UtilityServer.isEmsApiAvailable(SettingsManager.i().getServer().getHost(), SettingsManager.i().getServer().getPort(), mInternalCallback);
|
||||
UtilityServer.isEmsApiAvailable(
|
||||
SettingsManager.i().getServer().getHost(),
|
||||
SettingsManager.i().getServer().getPort(),
|
||||
() -> mInternalCallback.run(true),
|
||||
ex -> mInternalCallback.run(false));
|
||||
handler.postDelayed(this, MILLIS_DELAY);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,10 +16,11 @@ 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;
|
||||
@@ -37,9 +39,11 @@ 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 boolean flagPrintPackingListOnOrderClose;
|
||||
private boolean flagPrintEtichetteOnOrderClose;
|
||||
private int onNumCnfInputChanged = 1;
|
||||
private boolean flagAccettazioneUseQtaOrd = false;
|
||||
private boolean flagPickLiberoAllowEmptyDest = false;
|
||||
@@ -80,6 +84,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;
|
||||
}
|
||||
@@ -106,12 +119,12 @@ public class DBSettingsModel {
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDefaultCodAnag() {
|
||||
return defaultCodAnag;
|
||||
public boolean isFlagUseCodAnagAziendale() {
|
||||
return flagUseCodAnagAziendale;
|
||||
}
|
||||
|
||||
public DBSettingsModel setDefaultCodAnag(String defaultCodAnag) {
|
||||
this.defaultCodAnag = defaultCodAnag;
|
||||
public DBSettingsModel setFlagUseCodAnagAziendale(boolean flagUseCodAnagAziendale) {
|
||||
this.flagUseCodAnagAziendale = flagUseCodAnagAziendale;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -269,12 +282,21 @@ public class DBSettingsModel {
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getReportNameSpedizionChiudiOrdine() {
|
||||
return reportNameSpedizionChiudiOrdine;
|
||||
public boolean isFlagPrintPackingListOnOrderClose() {
|
||||
return flagPrintPackingListOnOrderClose;
|
||||
}
|
||||
|
||||
public DBSettingsModel setReportNameSpedizionChiudiOrdine(String reportNameSpedizionChiudiOrdine) {
|
||||
this.reportNameSpedizionChiudiOrdine = reportNameSpedizionChiudiOrdine;
|
||||
public DBSettingsModel setFlagPrintPackingListOnOrderClose(boolean flagPrintPackingListOnOrderClose) {
|
||||
this.flagPrintPackingListOnOrderClose = flagPrintPackingListOnOrderClose;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isFlagPrintEtichetteOnOrderClose() {
|
||||
return flagPrintEtichetteOnOrderClose;
|
||||
}
|
||||
|
||||
public DBSettingsModel setFlagPrintEtichetteOnOrderClose(boolean flagPrintEtichetteOnOrderClose) {
|
||||
this.flagPrintEtichetteOnOrderClose = flagPrintEtichetteOnOrderClose;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -322,4 +344,14 @@ public class DBSettingsModel {
|
||||
this.flagPickLiberoAllowEmptyDest = flagPickLiberoAllowEmptyDest;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public boolean isFlagOrdinaArticoliOnScan() {
|
||||
return flagOrdinaArticoliOnScan;
|
||||
}
|
||||
|
||||
public DBSettingsModel setFlagOrdinaArticoliOnScan(boolean flagOrdinaArticoliOnScan) {
|
||||
this.flagOrdinaArticoliOnScan = flagOrdinaArticoliOnScan;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,9 @@ import android.content.Context;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
import com.google.firebase.perf.metrics.Trace;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.net.SocketTimeoutException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -13,6 +15,7 @@ import java.util.List;
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.model.StbGestSetup;
|
||||
import it.integry.integrywmsnative.core.model.dto.InternalCodAnagsDTO;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.GestSetupRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
||||
@@ -88,11 +91,6 @@ 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(() -> {
|
||||
@@ -101,8 +99,10 @@ public class SettingsManager {
|
||||
loadAvailablePosizioni(() -> {
|
||||
|
||||
onProgress.run("impostazioni");
|
||||
loadGestSetupValues(tmpOnComplete, tmpOnFailed);
|
||||
}, tmpOnFailed);
|
||||
loadGestSetupValues(() -> {
|
||||
|
||||
onProgress.run("dati azienda");
|
||||
loadDatiAzienda(tmpOnComplete, tmpOnFailed);
|
||||
}, tmpOnFailed);
|
||||
}, tmpOnFailed);
|
||||
}, tmpOnFailed);
|
||||
@@ -113,8 +113,28 @@ public class SettingsManager {
|
||||
SystemRESTConsumer.getAzienda(datiAzienda -> {
|
||||
SettingsManager.iDB().setDatiAzienda(datiAzienda);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
private static void loadAvailableProfiles(Runnable onComplete, RunnableArgs<Exception> 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")
|
||||
@@ -254,10 +270,6 @@ public class SettingsManager {
|
||||
.setGestName("PICKING")
|
||||
.setSection("SPEDIZIONE")
|
||||
.setKeySection("FLAG_CAN_SELECT_MULTIPLE_ORDERS"));
|
||||
stbGestSetupList.add(new StbGestSetup()
|
||||
.setGestName("PICKING")
|
||||
.setSection("SPEDIZIONE")
|
||||
.setKeySection("REPORT_PACKING_LIST"));
|
||||
stbGestSetupList.add(new StbGestSetup()
|
||||
.setGestName("PICKING")
|
||||
.setSection("SPEDIZIONE")
|
||||
@@ -274,6 +286,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")
|
||||
@@ -292,7 +308,7 @@ public class SettingsManager {
|
||||
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.setFlagPickLiberoAllowEmptyCliente(getValueFromList(list, "PICKING_LIBERO", "FLAG_ALLOW_EMPTY_CLIENTE", Boolean.class));
|
||||
@@ -304,16 +320,15 @@ public class SettingsManager {
|
||||
dbSettingsModelIstance.setFlagAskPesoColloSpedizione(getValueFromList(list, "SETUP", "FLAG_ASK_PESO_COLLO", Boolean.class));
|
||||
dbSettingsModelIstance.setFlagUseNewPickingListSpedizione(getValueFromList(list, "SPEDIZIONE", "FLAG_USE_NEW_PICKING_LIST", Boolean.class));
|
||||
dbSettingsModelIstance.setFlagVersamentoDirettoProduzione(getValueFromList(list, "PRODUZIONE", "FLAG_VERSAMENTO_DIRETTO", Boolean.class));
|
||||
dbSettingsModelIstance.setProduzioneDefaultCodAnag(getValueFromList(list, "PRODUZIONE", "DEFAULT_COD_ANAG", String.class));
|
||||
dbSettingsModelIstance.setFlagSpedizioneEnableManualPick(getValueFromList(list, "SPEDIZIONE", "ENABLE_MANUAL_PICK", Boolean.class));
|
||||
dbSettingsModelIstance.setFlagSpedizioneEnableFakeGiacenza(getValueFromList(list, "SPEDIZIONE", "ENABLE_FAKE_GIACENZA", Boolean.class));
|
||||
dbSettingsModelIstance.setFlagSpedizioneCanSelectMultipleOrders(getValueFromList(list, "SPEDIZIONE", "FLAG_CAN_SELECT_MULTIPLE_ORDERS", Boolean.class));
|
||||
dbSettingsModelIstance.setReportNameSpedizionChiudiOrdine(getValueFromList(list, "SPEDIZIONE", "REPORT_PACKING_LIST", String.class));
|
||||
dbSettingsModelIstance.setFlagSpedizioneUseQtaOrd(getValueFromList(list, "SPEDIZIONE", "FLAG_USE_QTA_ORD", Boolean.class));
|
||||
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) {
|
||||
@@ -324,9 +339,15 @@ public class SettingsManager {
|
||||
if (onNumCnfInputChanged != null) {
|
||||
dbSettingsModelIstance.setOnNumCnfInputChanged(onNumCnfInputChanged);
|
||||
}
|
||||
|
||||
String codMdep = SettingsManager.i().getUserSession().getDepo().getCodMdep();
|
||||
GestSetupRESTConsumer.getBooleanValue("PICKING", "SPEDIZIONE", "FLAG_PRINT_PACKING_LIST_ON_CLOSE", codMdep, (value) -> {
|
||||
dbSettingsModelIstance.setFlagPrintPackingListOnOrderClose(value);
|
||||
GestSetupRESTConsumer.getBooleanValue("PICKING", "SPEDIZIONE", "FLAG_PRINT_ETICHETTE_ON_CLOSE", codMdep, (gestSetupDTO) -> {
|
||||
dbSettingsModelIstance.setFlagPrintEtichetteOnOrderClose(value);
|
||||
if (onComplete != null) onComplete.run();
|
||||
}, onFailed);
|
||||
}, onFailed);
|
||||
}, onFailed);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -3,16 +3,15 @@ package it.integry.integrywmsnative.core.utility;
|
||||
import android.Manifest;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Build;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import it.integry.integrywmsnative.SplashActivity;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
|
||||
@@ -31,6 +30,11 @@ public class PermissionsHelper {
|
||||
if(Build.VERSION.SDK_INT >= 23) {
|
||||
//permissionsToAsk.add(Manifest.permission.REQUEST_INSTALL_PACKAGES);
|
||||
}
|
||||
if(Build.VERSION.SDK_INT >= 31) {
|
||||
permissionsToAsk.add(Manifest.permission.BLUETOOTH_CONNECT);
|
||||
}
|
||||
|
||||
|
||||
|
||||
String[] permissionArray = new String[permissionsToAsk.size()];
|
||||
permissionsToAsk.toArray(permissionArray);
|
||||
|
||||
@@ -32,6 +32,10 @@ public class UtilityBarcode {
|
||||
return barcodeScanDTO != null && (barcodeScanDTO.getType() == BarcodeType.CODE128 || barcodeScanDTO.getType() == BarcodeType.EAN128);
|
||||
}
|
||||
|
||||
public static boolean isEan128(BarcodeScanDTO barcodeScanDTO) {
|
||||
return barcodeScanDTO != null && barcodeScanDTO.getType() == BarcodeType.EAN128;
|
||||
}
|
||||
|
||||
public static boolean isEtichettaPosizione(BarcodeScanDTO barcodeScanDTO) {
|
||||
return isEtichettaPosizione(barcodeScanDTO, true);
|
||||
}
|
||||
@@ -59,7 +63,6 @@ public class UtilityBarcode {
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static boolean isEanPeso(BarcodeScanDTO barcodeScanDTO) {
|
||||
return (isEtichetta128(barcodeScanDTO) || isEan13(barcodeScanDTO)) && barcodeScanDTO.getStringValue().startsWith("2");
|
||||
}
|
||||
@@ -81,18 +84,19 @@ public class UtilityBarcode {
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static Integer getNumColloFromULAnonima(String barcode) {
|
||||
public static Integer getNumColloFromULAnonima(String barcode) throws Exception {
|
||||
if (!UtilityString.isNullOrEmpty(barcode)) {
|
||||
barcode = barcode.trim();
|
||||
|
||||
return Integer.parseInt(barcode.substring(3));
|
||||
try {
|
||||
return Integer.parseInt(barcode.substring(3, 10));
|
||||
} catch (NumberFormatException nfex) {
|
||||
throw new Exception("Impossibile leggere il numero collo dal barcode: " + barcode);
|
||||
}
|
||||
} else
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static Integer getAnnoColloFromULAnonima(String barcode) {
|
||||
if (barcode != null) {
|
||||
return Integer.parseInt(barcode.substring(1, 3));
|
||||
@@ -101,7 +105,6 @@ public class UtilityBarcode {
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static String convertITF14toEAN13(String barcodeITF14) {
|
||||
String barcodeEAN13 = null;
|
||||
|
||||
|
||||
@@ -11,14 +11,19 @@ import com.google.firebase.crashlytics.FirebaseCrashlytics;
|
||||
import com.orhanobut.logger.Logger;
|
||||
|
||||
import it.integry.integrywmsnative.BuildConfig;
|
||||
import it.integry.integrywmsnative.core.exception.InvalidConnectionException;
|
||||
import it.integry.integrywmsnative.core.exception.InvalidLUException;
|
||||
import it.integry.integrywmsnative.core.exception.InvalidLUGestioneException;
|
||||
import it.integry.integrywmsnative.core.rest.CommonRESTException;
|
||||
import it.integry.integrywmsnative.view.dialogs.DialogProgressView;
|
||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||
|
||||
public class UtilityExceptions {
|
||||
|
||||
private static final Class<? extends Exception>[] FIREBASE_IGNORED_EXCEPTIONS = new Class[] {
|
||||
|
||||
private static final Class<?>[] FIREBASE_IGNORED_EXCEPTIONS = new Class[] {
|
||||
InvalidConnectionException.class,
|
||||
InvalidLUGestioneException.class,
|
||||
InvalidLUException.class
|
||||
};
|
||||
|
||||
public static void defaultException(Context context, Exception ex, DialogProgressView progressDialog) {
|
||||
|
||||
@@ -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,7 +5,9 @@ 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;
|
||||
@@ -36,7 +38,7 @@ public class UtilityServer {
|
||||
}).start();
|
||||
}
|
||||
|
||||
public static void isEmsApiAvailable(final String serverAddress, final int serverTCPport, final RunnableArgs<Boolean> callback) {
|
||||
public static void isEmsApiAvailable(final String serverAddress, final int serverTCPport, final Runnable onComplete, final RunnableArgs<Exception> onFailed) {
|
||||
new Thread(() -> {
|
||||
OkHttpClient client = new OkHttpClient();
|
||||
|
||||
@@ -46,11 +48,16 @@ public class UtilityServer {
|
||||
|
||||
try {
|
||||
Response response = client.newCall(request).execute();
|
||||
boolean status = response.isSuccessful();
|
||||
response.close();
|
||||
callback.run(status);
|
||||
|
||||
if (response.code() == 200) onComplete.run();
|
||||
else if (response.code() == 404)
|
||||
onFailed.run(new ServerNotReachableException(serverAddress, serverTCPport, null));
|
||||
else if (response.code() == 550)
|
||||
onFailed.run(new NotValidLicenseException());
|
||||
else onFailed.run(new Exception("Errore non identificato (STATUS: " + response.code() + ")"));
|
||||
} catch (IOException e) {
|
||||
callback.run(false);
|
||||
onFailed.run(new ServerNotReachableException(serverAddress, serverTCPport, e));
|
||||
}
|
||||
|
||||
}).start();
|
||||
|
||||
@@ -9,6 +9,7 @@ import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.widget.AppCompatTextView;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import androidx.databinding.ObservableArrayList;
|
||||
@@ -76,10 +77,23 @@ public class MainAccettazioneFragment extends BaseFragment implements ISearchabl
|
||||
mAppBarTitle.setText(context.getText(R.string.accettazione_title_fragment).toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(@NonNull Bundle outState) {
|
||||
onLoadingEnded();
|
||||
outState.putString("mToolbar", DataCache.addItem(mToolbar));
|
||||
|
||||
super.onSaveInstanceState(outState);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
|
||||
if(savedInstanceState != null && savedInstanceState.containsKey("mToolbar"))
|
||||
mToolbar = DataCache.retrieveItem(savedInstanceState.getString("mToolbar"));
|
||||
|
||||
mBinding = DataBindingUtil.inflate(inflater, R.layout.fragment_main_accettazione, container, false);
|
||||
|
||||
MainApplication.appComponent
|
||||
|
||||
@@ -44,7 +44,6 @@ import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.model.MtbTCol;
|
||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
import it.integry.integrywmsnative.core.report.ReportManager;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.PrinterRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.model.VersamentoAutomaticoULResponseDTO;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityBigDecimal;
|
||||
@@ -303,6 +302,7 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
|
||||
|
||||
}
|
||||
|
||||
if (!filterLayoutView.isAdded())
|
||||
filterLayoutView.show(getSupportFragmentManager(), "TAG");
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -736,7 +732,6 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
|
||||
Intent myIntent = ListaBancaliActivity.createIntent(this,
|
||||
Stream.of(mtbColts).map(x -> (MtbColt) x).toList(),
|
||||
input -> ((RecoverMtbColt) input).isFlagCanBeRecovered(),
|
||||
PrinterRESTConsumer.Type.SECONDARIA,
|
||||
ReportManager.getReportNameLUFromGestione(GestioneEnum.ACQUISTO));
|
||||
this.startActivityForResult(myIntent, PICK_UL_REQUEST);
|
||||
}
|
||||
@@ -756,7 +751,7 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
|
||||
|
||||
@Override
|
||||
public void onLUPrintError(Exception ex, Runnable onComplete) {
|
||||
this.closeProgress();
|
||||
this.onLoadingEnded();
|
||||
DialogSimpleMessageView.makeErrorDialog(
|
||||
new SpannableString(ex.getMessage()),
|
||||
null,
|
||||
@@ -766,16 +761,6 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
|
||||
.show(getSupportFragmentManager(), "tag");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadingStarted() {
|
||||
this.openProgress();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadingEnded() {
|
||||
this.closeProgress();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMtbColrEdit(MtbColr mtbColr) {
|
||||
this.mViewModel.dispatchRowEdit(mtbColr);
|
||||
@@ -808,7 +793,7 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
|
||||
|
||||
@Override
|
||||
public void onError(Exception ex) {
|
||||
this.closeProgress();
|
||||
this.onLoadingEnded();
|
||||
|
||||
if (ex instanceof InvalidPesoKGException) {
|
||||
UtilityToast.showToast(ex.getMessage());
|
||||
@@ -841,6 +826,7 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
|
||||
.setCanLUBeClosed(true)
|
||||
.setCanOverflowOrderQuantity(canOverflowQuantity);
|
||||
|
||||
if (!mDialogInputQuantityV2View.isVisible())
|
||||
mDialogInputQuantityV2View
|
||||
.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
|
||||
.setOnComplete((resultDTO, shouldCloseLU) -> {
|
||||
|
||||
@@ -221,10 +221,16 @@ public class AccettazionePickingViewModel {
|
||||
if (!UtilityBarcode.isEtichettaAnonimaOfCurrentYear(barcodeScanDTO.getStringValue())) {
|
||||
this.sendError(new NotCurrentYearLUException());
|
||||
} else {
|
||||
int numCollo = -1;
|
||||
|
||||
try {
|
||||
numCollo = UtilityBarcode.getNumColloFromULAnonima(barcodeScanDTO.getStringValue());
|
||||
this.createNewLU(
|
||||
UtilityBarcode.getNumColloFromULAnonima(barcodeScanDTO.getStringValue()),
|
||||
numCollo,
|
||||
CommonConst.Config.DEFAULT_ANONYMOUS_UL_SERIE, true, onComplete);
|
||||
} catch (Exception ex) {
|
||||
this.sendError(ex);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.sendError(new AlreadyUsedAnonymousLabelException());
|
||||
@@ -373,8 +379,7 @@ public class AccettazionePickingViewModel {
|
||||
|
||||
MtbColt mtbColt = new MtbColt();
|
||||
mtbColt
|
||||
.initDefaultFields()
|
||||
.setGestione(defaultGestioneOfUL)
|
||||
.initDefaultFields(defaultGestioneOfUL)
|
||||
.setAnnotazioni(additionalNotes)
|
||||
.setPosizione(defaultPosAccettazione)
|
||||
.setOperation(CommonModelConsts.OPERATION.INSERT_OR_UPDATE);
|
||||
@@ -838,7 +843,6 @@ public class AccettazionePickingViewModel {
|
||||
cloneMtbColt.setGestione(cloneMtbColt.getGestioneEnum() == GestioneEnum.LAVORAZIONE ? GestioneEnum.PRODUZIONE : cloneMtbColt.getGestioneEnum());
|
||||
|
||||
this.mPrinterRESTConsumer.printCollo(
|
||||
PrinterRESTConsumer.Type.SECONDARIA,
|
||||
cloneMtbColt,
|
||||
() -> {
|
||||
this.sendLUSuccessfullyPrinted();
|
||||
|
||||
@@ -31,8 +31,8 @@ import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||
import it.integry.integrywmsnative.databinding.FragmentDocInterniBinding;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dialog.DialogSelectDocInfoView;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dialog.DialogSelectDocInfoViewModel;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.GrigliaAcquistiDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.DocInterniSetupDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.GrigliaAcquistiDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.DocInterniEditFormActivity;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.ui.DocInterniListAdapter;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.ui.DocInterniListModel;
|
||||
@@ -201,6 +201,6 @@ public class DocInterniFragment extends BaseFragment implements ITitledFragment,
|
||||
|
||||
@Override
|
||||
public void onDocumentEditRequest(SqlMtbColt document, GrigliaAcquistiDTO arts) {
|
||||
requireActivity().startActivity(DocInterniEditFormActivity.newInstance(requireActivity(),document,arts));
|
||||
requireActivity().startActivity(DocInterniEditFormActivity.newInstance(requireActivity(), document, arts, mViewModel.getTipoDoc()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,6 @@ package it.integry.integrywmsnative.gest.contab_doc_interni;
|
||||
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@@ -17,10 +15,10 @@ import it.integry.integrywmsnative.core.di.BindableInteger;
|
||||
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dialog.DialogSelectDocInfoViewModel;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.DocInterniSetupDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.FornitoreDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.GrigliaAcquistiDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.GruppiArticoloDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.DocInterniSetupDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.TipiDocDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.rest.DocInterniRESTConsumer;
|
||||
|
||||
@@ -141,6 +139,13 @@ public class DocInterniViewModel {
|
||||
return this.dtbTipi.getValue().getCodDtip();
|
||||
}
|
||||
|
||||
public TipiDocDTO getTipoDoc() {
|
||||
if (this.dtbTipi.getValue() == null) {
|
||||
return null;
|
||||
}
|
||||
return this.dtbTipi.getValue();
|
||||
}
|
||||
|
||||
private String getCodMgrp() {
|
||||
if (this.mtbGrup.getValue() == null) {
|
||||
return null;
|
||||
|
||||
@@ -148,8 +148,7 @@ public class DialogSelectDocInfoViewModel {
|
||||
public boolean requiresNote() {
|
||||
return this.getSelectedTipoDoc() != null &&
|
||||
this.getSelectedTipoDoc().getGestioneDoc().equals("P") &&
|
||||
this.getSelectedTipoDoc().getGestione().equals("L")
|
||||
;
|
||||
this.getSelectedTipoDoc().getGestione().equals("L");
|
||||
}
|
||||
|
||||
public boolean isInputValid() {
|
||||
|
||||
@@ -6,6 +6,7 @@ public class TipiDocDTO {
|
||||
private String descrizione;
|
||||
private String gestione;
|
||||
private String gestioneDoc;
|
||||
private boolean requireNote = false;
|
||||
|
||||
public String getCodDtip() {
|
||||
return codDtip;
|
||||
@@ -38,7 +39,17 @@ public class TipiDocDTO {
|
||||
public void setGestioneDoc(String gestioneDoc) {
|
||||
this.gestioneDoc = gestioneDoc;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return this.codDtip + " - " + this.descrizione;
|
||||
}
|
||||
|
||||
public boolean isRequireNote() {
|
||||
return requireNote;
|
||||
}
|
||||
|
||||
public TipiDocDTO setRequireNote(boolean requireNote) {
|
||||
this.requireNote = requireNote;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||
import it.integry.integrywmsnative.databinding.ActivityContabDocInterniEditBinding;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.GrigliaAcquistiChildDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.GrigliaAcquistiDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.TipiDocDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.dialog.selectDocRows.DialogSelectDocRowsView;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.ui.DocumentRowsListAdapter;
|
||||
import it.integry.integrywmsnative.ui.FabMenuCustomAnimations;
|
||||
@@ -52,6 +53,7 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
||||
|
||||
private static final String DATA_KEY_DOCUMENT = "document";
|
||||
private static final String DATA_KEY_PRODUCTS_LIST = "productsList";
|
||||
private static final String DATA_KEY_TIPO_DOC = "docType";
|
||||
|
||||
@Inject
|
||||
MtbColrRepository documentRowsRepository;
|
||||
@@ -75,13 +77,15 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
||||
public BindableBoolean isDocumentExportable = new BindableBoolean(false);
|
||||
private final ObservableArrayList<SqlMtbColr> documentRowsObservableList = new ObservableArrayList<>();
|
||||
|
||||
public static Intent newInstance(Context context, SqlMtbColt document, GrigliaAcquistiDTO productList) {
|
||||
public static Intent newInstance(Context context, SqlMtbColt document, GrigliaAcquistiDTO productList, TipiDocDTO tipoDoc) {
|
||||
Intent myIntent = new Intent(context, DocInterniEditFormActivity.class);
|
||||
|
||||
String doc = DataCache.addItem(document);
|
||||
String productsKey = DataCache.addItem(productList);
|
||||
String docType = DataCache.addItem(tipoDoc);
|
||||
myIntent.putExtra(DATA_KEY_DOCUMENT, doc);
|
||||
myIntent.putExtra(DATA_KEY_PRODUCTS_LIST, productsKey);
|
||||
myIntent.putExtra(DATA_KEY_TIPO_DOC, docType);
|
||||
return myIntent;
|
||||
}
|
||||
|
||||
@@ -96,7 +100,14 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
||||
SqlMtbColt document = DataCache.retrieveItem(getIntent().getStringExtra(DATA_KEY_DOCUMENT));
|
||||
GrigliaAcquistiDTO griglia = DataCache.retrieveItem(getIntent().getStringExtra(DATA_KEY_PRODUCTS_LIST));
|
||||
List<GrigliaAcquistiChildDTO> productList = griglia.getGrigliaAcquistiChild();
|
||||
this.initViewModel(document, productList);
|
||||
TipiDocDTO docType = DataCache.retrieveItem(getIntent().getStringExtra(DATA_KEY_TIPO_DOC));
|
||||
|
||||
this.initViewModel();
|
||||
this.viewModel.setDocument(document);
|
||||
this.viewModel.setProductsList(productList);
|
||||
this.viewModel.setTipoDoc(docType);
|
||||
|
||||
|
||||
this.initView();
|
||||
this.initBindables();
|
||||
this.initRecyclerView();
|
||||
@@ -137,12 +148,9 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
||||
binding.bottomSheetMtbColrEdit.init(binding.bottomSheetMtbColrEdit, binding.bottomSheetMtbColrEditBackground);
|
||||
}
|
||||
|
||||
private void initViewModel(SqlMtbColt document, List<GrigliaAcquistiChildDTO> productList) {
|
||||
private void initViewModel() {
|
||||
this.viewModel.init();
|
||||
this.viewModel.setListeners(this);
|
||||
this.viewModel.setDocument(document);
|
||||
this.viewModel.setProductsList(productList);
|
||||
|
||||
}
|
||||
|
||||
private void initRecyclerView() {
|
||||
@@ -239,6 +247,7 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
||||
.setCanOverflowOrderQuantity(false)
|
||||
.setCanLUBeClosed(false)
|
||||
.setNotesAllowed(true)
|
||||
.setNotesMandatory(this.viewModel.isNotesMandatory())
|
||||
.setDataScadMandatory(flagTracciabilita)
|
||||
.setCanPartitaMagBeChanged(flagTracciabilita)
|
||||
.setSuggestPartitaMag(data -> {
|
||||
@@ -249,6 +258,8 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
||||
}
|
||||
return partitaMag;
|
||||
});
|
||||
|
||||
if (!dialogInputQuantityV2View.isAdded())
|
||||
dialogInputQuantityV2View.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
|
||||
.setOnComplete((resultDTO, shouldCloseLU) -> {
|
||||
this.onLoadingStarted();
|
||||
|
||||
@@ -26,6 +26,7 @@ import it.integry.integrywmsnative.gest.contab_doc_interni.dto.ArtDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.ColloDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.GrigliaAcquistiChildDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.SaveDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.TipiDocDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.rest.DocInterniRESTConsumer;
|
||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2ResultDTO;
|
||||
|
||||
@@ -38,6 +39,7 @@ public class DocInterniEditFormViewModel {
|
||||
private final DocInterniRESTConsumer docInterniRESTConsumer;
|
||||
private DocInterniEditFormViewModel.Listener listener;
|
||||
private List<GrigliaAcquistiChildDTO> productsList;
|
||||
private TipiDocDTO tipoDoc;
|
||||
private boolean isCheckPartitaMag = false;
|
||||
private JSONObject checkFornitoreRules = null;
|
||||
public MutableLiveData<SqlMtbColt> document = new MutableLiveData<>();
|
||||
@@ -299,6 +301,15 @@ public class DocInterniEditFormViewModel {
|
||||
return Stream.of(productsList).filter(prod -> prod.codMart.equalsIgnoreCase(codMart)).findFirstOrElse(null);
|
||||
}
|
||||
|
||||
public DocInterniEditFormViewModel setTipoDoc(TipiDocDTO docType) {
|
||||
this.tipoDoc = docType;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isNotesMandatory() {
|
||||
return this.tipoDoc != null && this.tipoDoc.isRequireNote();
|
||||
}
|
||||
|
||||
public interface Listener extends ILoadingListener {
|
||||
|
||||
void onError(Exception ex);
|
||||
|
||||
@@ -45,16 +45,14 @@ public class ContenutoBancaleActivity extends BaseActivity implements ContenutoB
|
||||
public ObservableField<Boolean> recoverFabMenuVisible = new ObservableField<>(false);
|
||||
|
||||
private String mReportName;
|
||||
private PrinterRESTConsumer.Type mPrinterType;
|
||||
|
||||
private static class Key {
|
||||
private static final String MtbColtKey = "mtbColtKey";
|
||||
private static final String CanRecoverUL = "canRecoverUL";
|
||||
private static final String PrinterType = "printerType";
|
||||
private static final String ReportName = "reportName";
|
||||
}
|
||||
|
||||
public static Intent createIntent(Context context, MtbColt item, boolean canRecoverUl, PrinterRESTConsumer.Type printerType, String reportName) {
|
||||
public static Intent createIntent(Context context, MtbColt item, boolean canRecoverUl, String reportName) {
|
||||
Intent myIntent = new Intent(context, ContenutoBancaleActivity.class);
|
||||
|
||||
String keyMtbColt = DataCache.addItem(item);
|
||||
@@ -63,9 +61,6 @@ public class ContenutoBancaleActivity extends BaseActivity implements ContenutoB
|
||||
String keyCanRecoverUL = DataCache.addItem(canRecoverUl);
|
||||
myIntent.putExtra(Key.CanRecoverUL, keyCanRecoverUL);
|
||||
|
||||
String keyPrinterType = DataCache.addItem(printerType);
|
||||
myIntent.putExtra(Key.PrinterType, keyPrinterType);
|
||||
|
||||
String keyReportName = DataCache.addItem(reportName);
|
||||
myIntent.putExtra(Key.ReportName, keyReportName);
|
||||
|
||||
@@ -79,7 +74,6 @@ public class ContenutoBancaleActivity extends BaseActivity implements ContenutoB
|
||||
boolean canRecoverUL = DataCache.retrieveItem(getIntent().getStringExtra(Key.CanRecoverUL));
|
||||
mtbColt.set(DataCache.retrieveItem(getIntent().getStringExtra(Key.MtbColtKey)));
|
||||
mReportName = DataCache.retrieveItem(getIntent().getStringExtra(Key.ReportName));
|
||||
mPrinterType = DataCache.retrieveItem(getIntent().getStringExtra(Key.PrinterType));
|
||||
|
||||
bindings = DataBindingUtil.setContentView(this, R.layout.activity_contenuto_bancale);
|
||||
|
||||
@@ -97,7 +91,7 @@ public class ContenutoBancaleActivity extends BaseActivity implements ContenutoB
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
mViewModel.setListener(this);
|
||||
mViewModel.init(mtbColt.get(), mPrinterType, mReportName);
|
||||
mViewModel.init(mtbColt.get(), mReportName);
|
||||
|
||||
recoverFabMenuVisible.set(canRecoverUL);
|
||||
|
||||
@@ -143,7 +137,7 @@ public class ContenutoBancaleActivity extends BaseActivity implements ContenutoB
|
||||
this.bindings.contenutoBancaleFab.close(true);
|
||||
this.onLoadingStarted();
|
||||
try {
|
||||
this.mPrinterRESTConsumer.printCollo(mPrinterType, mtbColt.get(),
|
||||
this.mPrinterRESTConsumer.printCollo(mtbColt.get(),
|
||||
() -> {
|
||||
this.onLoadingEnded();
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ import javax.inject.Inject;
|
||||
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.DepositoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.PrinterRESTConsumer;
|
||||
|
||||
public class ContenutoBancaleViewModel {
|
||||
|
||||
@@ -19,7 +18,7 @@ public class ContenutoBancaleViewModel {
|
||||
this.mDepositoRESTConsumer = depositoRESTConsumer;
|
||||
}
|
||||
|
||||
public void init(MtbColt mtbColt, PrinterRESTConsumer.Type printerType, String defaultReportName) {
|
||||
public void init(MtbColt mtbColt, String defaultReportName) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ import it.integry.integrywmsnative.core.data_cache.DataCache;
|
||||
import it.integry.integrywmsnative.core.expansion.BaseActivity;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgsWithReturn;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.PrinterRESTConsumer;
|
||||
import it.integry.integrywmsnative.databinding.ActivityListaBancaliBinding;
|
||||
import it.integry.integrywmsnative.gest.contenuto_bancale.ContenutoBancaleActivity;
|
||||
import it.integry.integrywmsnative.gest.lista_bancali.ui.ListaColliMainListAdapter;
|
||||
@@ -30,7 +29,6 @@ public class ListaBancaliActivity extends BaseActivity implements ListaBancaliVi
|
||||
private static class Key {
|
||||
private static final String MtbColtsKey = "mtbColtsKey";
|
||||
private static final String CanRecoverUL = "canRecoverUL";
|
||||
private static final String PrinterType = "printerType";
|
||||
private static final String ReportName = "reportName";
|
||||
private static final String FlagOnlyResiduo = "flagOnlyResiduo";
|
||||
}
|
||||
@@ -43,7 +41,6 @@ public class ListaBancaliActivity extends BaseActivity implements ListaBancaliVi
|
||||
private final ObservableArrayList<MtbColt> mtbColts = new ObservableArrayList<>();
|
||||
|
||||
private RunnableArgsWithReturn<MtbColt, Boolean> mCanRecoverUl;
|
||||
private PrinterRESTConsumer.Type mPrinterType;
|
||||
private String mReportName;
|
||||
private boolean mFlagOnlyResiduo;
|
||||
|
||||
@@ -51,19 +48,19 @@ public class ListaBancaliActivity extends BaseActivity implements ListaBancaliVi
|
||||
|
||||
|
||||
|
||||
public static Intent createIntent(Context context, List<MtbColt> items, RunnableArgsWithReturn<MtbColt, Boolean> canRecoverUlAction, PrinterRESTConsumer.Type printerType, String reportName) {
|
||||
return createIntent(context, items, canRecoverUlAction, printerType, true, reportName);
|
||||
public static Intent createIntent(Context context, List<MtbColt> items, RunnableArgsWithReturn<MtbColt, Boolean> canRecoverUlAction, String reportName) {
|
||||
return createIntent(context, items, canRecoverUlAction, true, reportName);
|
||||
}
|
||||
|
||||
public static Intent createIntent(Context context, List<MtbColt> items, boolean canRecoverUl, PrinterRESTConsumer.Type printerType, boolean onlyResiduo) {
|
||||
return createIntent(context, items, input -> canRecoverUl, printerType, onlyResiduo);
|
||||
public static Intent createIntent(Context context, List<MtbColt> items, boolean canRecoverUl, boolean onlyResiduo) {
|
||||
return createIntent(context, items, input -> canRecoverUl, onlyResiduo);
|
||||
}
|
||||
|
||||
public static Intent createIntent(Context context, List<MtbColt> items, RunnableArgsWithReturn<MtbColt, Boolean> canRecoverUlAction, PrinterRESTConsumer.Type printerType, boolean onlyResiduo) {
|
||||
return createIntent(context, items, canRecoverUlAction, printerType, onlyResiduo, null);
|
||||
public static Intent createIntent(Context context, List<MtbColt> items, RunnableArgsWithReturn<MtbColt, Boolean> canRecoverUlAction, boolean onlyResiduo) {
|
||||
return createIntent(context, items, canRecoverUlAction, onlyResiduo, null);
|
||||
}
|
||||
|
||||
public static Intent createIntent(Context context, List<MtbColt> items, RunnableArgsWithReturn<MtbColt, Boolean> canRecoverUlAction, PrinterRESTConsumer.Type printerType, boolean onlyResiduo, String reportName) {
|
||||
public static Intent createIntent(Context context, List<MtbColt> items, RunnableArgsWithReturn<MtbColt, Boolean> canRecoverUlAction, boolean onlyResiduo, String reportName) {
|
||||
Intent myIntent = new Intent(context, ListaBancaliActivity.class);
|
||||
|
||||
String mtbColtsKey = DataCache.addItem(items);
|
||||
@@ -72,9 +69,6 @@ public class ListaBancaliActivity extends BaseActivity implements ListaBancaliVi
|
||||
String canRecoverULKey = DataCache.addItem(canRecoverUlAction);
|
||||
myIntent.putExtra(Key.CanRecoverUL, canRecoverULKey);
|
||||
|
||||
String printerTypeKey = DataCache.addItem(printerType);
|
||||
myIntent.putExtra(Key.PrinterType, printerTypeKey);
|
||||
|
||||
String flagOnlyResiduoKey = DataCache.addItem(onlyResiduo);
|
||||
myIntent.putExtra(Key.FlagOnlyResiduo, flagOnlyResiduoKey);
|
||||
|
||||
@@ -97,7 +91,6 @@ public class ListaBancaliActivity extends BaseActivity implements ListaBancaliVi
|
||||
|
||||
|
||||
mCanRecoverUl = DataCache.retrieveItem(getIntent().getStringExtra(Key.CanRecoverUL));
|
||||
mPrinterType = DataCache.retrieveItem(getIntent().getStringExtra(Key.PrinterType));
|
||||
mReportName = DataCache.retrieveItem(getIntent().getStringExtra(Key.ReportName));
|
||||
mFlagOnlyResiduo = DataCache.retrieveItem(getIntent().getStringExtra(Key.FlagOnlyResiduo));
|
||||
|
||||
@@ -138,7 +131,7 @@ public class ListaBancaliActivity extends BaseActivity implements ListaBancaliVi
|
||||
}
|
||||
|
||||
public void startContenutoBancaleActivity(MtbColt item){
|
||||
Intent myIntent = ContenutoBancaleActivity.createIntent(this, item, mCanRecoverUl.run(item), mPrinterType, mReportName);
|
||||
Intent myIntent = ContenutoBancaleActivity.createIntent(this, item, mCanRecoverUl.run(item), mReportName);
|
||||
startActivityForResult(myIntent, PICK_UL_REQUEST);
|
||||
}
|
||||
|
||||
|
||||
@@ -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));
|
||||
});
|
||||
|
||||
@@ -75,10 +75,7 @@ public class MainFragment extends Fragment implements ITitledFragment, IScrollab
|
||||
}
|
||||
|
||||
public static MainFragment newInstance() {
|
||||
MainFragment fragment = new MainFragment();
|
||||
Bundle args = new Bundle();
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
return new MainFragment();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -42,6 +42,7 @@ import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.model.MtbDepo;
|
||||
import it.integry.integrywmsnative.core.model.MtbGrup;
|
||||
import it.integry.integrywmsnative.core.model.OrdineInevasoDTO;
|
||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.DepositoRESTConsumer;
|
||||
@@ -180,6 +181,8 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
|
||||
for (Runnable onPreDestroy : mOnPreDestroyList) {
|
||||
onPreDestroy.run();
|
||||
}
|
||||
|
||||
mViewModel.setListener(null);
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@@ -682,26 +685,19 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
|
||||
break;
|
||||
}
|
||||
|
||||
if (!filterLayoutView.isAdded())
|
||||
filterLayoutView.show(requireActivity().getSupportFragmentManager(), "TAG");
|
||||
}
|
||||
|
||||
|
||||
private final RunnableArgs<BarcodeScanDTO> onScanSuccessful = data -> {
|
||||
BarcodeManager.disable();
|
||||
this.openProgress();
|
||||
this.onLoadingStarted();
|
||||
|
||||
this.mViewModel.processBarcodeDTO(data, () -> {
|
||||
BarcodeManager.enable();
|
||||
this.closeProgress();
|
||||
});
|
||||
this.mViewModel.processBarcodeDTO(data, this::onLoadingEnded);
|
||||
};
|
||||
|
||||
private void refreshList(List<OrdiniUscitaElencoDTO> filteredList) {
|
||||
|
||||
// new Thread(() -> {
|
||||
|
||||
// requireActivity().runOnUiThread(() -> {
|
||||
// this.onLoadingStarted();
|
||||
requireActivity().runOnUiThread(() -> {
|
||||
List<OrdiniUscitaElencoDTO> tmpList;
|
||||
|
||||
if (filteredList != null) {
|
||||
@@ -720,12 +716,7 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
|
||||
|
||||
fabVisible.set(Stream.of(mOrdiniInevasiMutableData)
|
||||
.anyMatch(y -> y.getSelectedObservable().get()));
|
||||
|
||||
// this.onLoadingEnded();
|
||||
// });
|
||||
|
||||
// }).start();
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
private List<OrdiniUscitaElencoListModel> convertDataModelToListModel(List<OrdiniUscitaElencoDTO> dataList) {
|
||||
@@ -790,6 +781,17 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
|
||||
this.mViewModel.loadPicking(selectedOrders, this.mAppliedFilterViewModel.getSelectedMtbGrup());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFilterNumOrderApplied(List<OrdiniUscitaElencoDTO> filteredOrder) {
|
||||
requireActivity().runOnUiThread(() -> {
|
||||
var numOrders = Stream.of(filteredOrder)
|
||||
.map(OrdineInevasoDTO::getNumOrd)
|
||||
.distinct()
|
||||
.toList();
|
||||
this.mAppliedFilterViewModel.setNumOrdFilter(numOrders);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOrderFiltered(List<OrdiniUscitaElencoDTO> filteredOrders) {
|
||||
refreshList(filteredOrders);
|
||||
|
||||
@@ -154,12 +154,15 @@ public class OrdiniUscitaElencoViewModel {
|
||||
public void processBarcodeDTO(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
||||
|
||||
RunnableArgs<List<OrdiniUscitaElencoDTO>> onBarcodeScanComplete = orderList -> {
|
||||
onComplete.run();
|
||||
this.sendOnOrderFiltered(orderList);
|
||||
onComplete.run();
|
||||
};
|
||||
|
||||
if (UtilityBarcode.isBarcodeOrdineV(barcodeScanDTO)) {
|
||||
this.executeEtichettaOrdineV(barcodeScanDTO.getStringValue(), onBarcodeScanComplete);
|
||||
this.executeEtichettaOrdineV(barcodeScanDTO.getStringValue(), foundOrder -> {
|
||||
this.sendOnFilterNumOrderApplied(foundOrder);
|
||||
onComplete.run();
|
||||
});
|
||||
} else if (UtilityBarcode.isEtichettaAnonima(barcodeScanDTO)) {
|
||||
this.executeEtichettaLU(barcodeScanDTO.getStringValue(), onBarcodeScanComplete);
|
||||
} else if (UtilityBarcode.isEtichetta128(barcodeScanDTO)) {
|
||||
@@ -196,10 +199,11 @@ public class OrdiniUscitaElencoViewModel {
|
||||
final String finalGestione = gestione;
|
||||
final Date finalDate = date;
|
||||
|
||||
List<OrdiniUscitaElencoDTO> filteredOrders = Stream.of(mOrderList.getValue())
|
||||
.filter(x -> x.getNumOrd() == numOrd && x.getGestione().equalsIgnoreCase(finalGestione) && x.getDataOrdD().equals(finalDate)).toList();
|
||||
List<OrdiniUscitaElencoDTO> foundItem = Stream.of(mOrderList.getValue())
|
||||
.filter(x -> x.getNumOrd() == numOrd && x.getGestione().equalsIgnoreCase(finalGestione) && x.getDataOrdD().equals(finalDate))
|
||||
.toList();
|
||||
|
||||
onComplete.run(filteredOrders);
|
||||
onComplete.run(foundItem);
|
||||
}
|
||||
|
||||
|
||||
@@ -284,6 +288,10 @@ public class OrdiniUscitaElencoViewModel {
|
||||
if (this.mListener != null) mListener.onError(ex);
|
||||
}
|
||||
|
||||
private void sendOnFilterNumOrderApplied(List<OrdiniUscitaElencoDTO> filteredOrder) {
|
||||
if (this.mListener != null) mListener.onFilterNumOrderApplied(filteredOrder);
|
||||
}
|
||||
|
||||
private void sendOnOrderFiltered(List<OrdiniUscitaElencoDTO> filteredOrders) {
|
||||
if (this.mListener != null) mListener.onOrderFiltered(filteredOrders);
|
||||
}
|
||||
@@ -297,6 +305,8 @@ public class OrdiniUscitaElencoViewModel {
|
||||
|
||||
void onError(Exception ex);
|
||||
|
||||
void onFilterNumOrderApplied(List<OrdiniUscitaElencoDTO> filteredOrder);
|
||||
|
||||
void onOrderFiltered(List<OrdiniUscitaElencoDTO> filteredOrders);
|
||||
|
||||
void onOrdersDispatched(List<OrdineUscitaInevasoDTO> orders, List<SitArtOrdDTO> sitArts, List<MtbColt> alreadyRegisteredMtbColts);
|
||||
|
||||
@@ -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
|
||||
@@ -337,6 +337,7 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
|
||||
.setCanPartitaMagBeChanged(canPartitaMagBeChanged)
|
||||
.setCanLUBeClosed(canLUBeClosed);
|
||||
|
||||
if (!mDialogInputQuantityV2View.isVisible())
|
||||
mDialogInputQuantityV2View.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
|
||||
.setOnComplete((resultDTO, shouldCloseLU) -> {
|
||||
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO()
|
||||
@@ -346,10 +347,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");
|
||||
}
|
||||
|
||||
|
||||
@@ -244,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);
|
||||
|
||||
@@ -627,7 +626,7 @@ public class PickingLiberoViewModel {
|
||||
UtilityString.equalsIgnoreCase(x.getCodCol(), mtbColrToUpdate.getCodCol()) &&
|
||||
UtilityString.equalsIgnoreCase(x.getCodTagl(), mtbColrToUpdate.getCodTagl()) &&
|
||||
UtilityString.equalsIgnoreCase(x.getPartitaMag(), mtbColrToUpdate.getPartitaMag()))
|
||||
.single();
|
||||
.findFirstOrElse(null);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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());
|
||||
@@ -322,6 +318,7 @@ public class PickingResiActivity extends BaseActivity implements BottomSheetFrag
|
||||
.setCanLUBeClosed(false)
|
||||
.setCanPartitaMagBeChanged(false);
|
||||
|
||||
if (!mDialogInputQuantityV2View.isVisible())
|
||||
mDialogInputQuantityV2View
|
||||
.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
|
||||
.setOnComplete((resultDTO, shouldCloseLU) -> {
|
||||
@@ -332,7 +329,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 +397,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 +406,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)
|
||||
@@ -218,7 +218,6 @@ public class PickingResiViewModel {
|
||||
private void singlePrint(MtbColt mtbColtToPrint, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
this.mPrinterRESTConsumer.printCollo(
|
||||
PrinterRESTConsumer.Type.PRIMARIA,
|
||||
mtbColtToPrint,
|
||||
onComplete, onFailed);
|
||||
|
||||
@@ -303,10 +302,16 @@ public class PickingResiViewModel {
|
||||
if (!UtilityBarcode.isEtichettaAnonimaOfCurrentYear(barcodeScanDTO.getStringValue())) {
|
||||
this.sendError(new NotCurrentYearLUException());
|
||||
} else {
|
||||
int numCollo = -1;
|
||||
|
||||
try {
|
||||
numCollo = UtilityBarcode.getNumColloFromULAnonima(barcodeScanDTO.getStringValue());
|
||||
this.createNewLU(
|
||||
UtilityBarcode.getNumColloFromULAnonima(barcodeScanDTO.getStringValue()),
|
||||
numCollo,
|
||||
CommonConst.Config.DEFAULT_ANONYMOUS_UL_SERIE, onComplete);
|
||||
} catch (Exception ex) {
|
||||
this.sendError(ex);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
|
||||
@@ -274,6 +274,7 @@ public class ProdOrdineProduzioneElencoFragment extends BaseFragment implements
|
||||
break;
|
||||
}
|
||||
|
||||
if (!filterLayoutView.isAdded())
|
||||
filterLayoutView.show(requireActivity().getSupportFragmentManager(), "TAG");
|
||||
|
||||
}
|
||||
@@ -382,8 +383,6 @@ public class ProdOrdineProduzioneElencoFragment extends BaseFragment implements
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private void initJtbComtCache(Runnable onComplete) {
|
||||
var jtbComts = Stream.of(Objects.requireNonNull(this.mViewModel.getOrderList().getValue()))
|
||||
.flatMap(x -> Stream.of(x.getCodJcom()))
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package it.integry.integrywmsnative.gest.prod_linee_produzione;
|
||||
|
||||
import dagger.Subcomponent;
|
||||
|
||||
@Subcomponent
|
||||
public interface ProdLineeProduzioneComponent {
|
||||
|
||||
@Subcomponent.Factory
|
||||
interface Factory {
|
||||
ProdLineeProduzioneComponent create();
|
||||
}
|
||||
|
||||
void inject(ProdLineeProduzioneFragment prodLineeProduzioneFragment);
|
||||
}
|
||||
@@ -0,0 +1,187 @@
|
||||
package it.integry.integrywmsnative.gest.prod_linee_produzione;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.text.Html;
|
||||
import android.text.InputType;
|
||||
import android.text.SpannableString;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.appcompat.widget.AppCompatTextView;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import androidx.databinding.ObservableArrayList;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
||||
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.expansion.BaseFragment;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.interfaces.IScrollableFragment;
|
||||
import it.integry.integrywmsnative.core.interfaces.ITitledFragment;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
import it.integry.integrywmsnative.databinding.FragmentLineeProdBinding;
|
||||
import it.integry.integrywmsnative.gest.prod_linee_produzione.dialogs.BottomSheetLineAction;
|
||||
import it.integry.integrywmsnative.gest.prod_linee_produzione.dialogs.DialogStartProduction;
|
||||
import it.integry.integrywmsnative.gest.prod_linee_produzione.dto.ProdLineStatusDTO;
|
||||
import it.integry.integrywmsnative.gest.prod_linee_produzione.ui.LinesListAdapter;
|
||||
import it.integry.integrywmsnative.ui.ElevatedToolbar;
|
||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleInputHelper;
|
||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||
|
||||
public class ProdLineeProduzioneFragment extends BaseFragment implements ITitledFragment, IScrollableFragment, ProdLineeProduzioneViewModel.Listener {
|
||||
|
||||
|
||||
@Inject
|
||||
ProdLineeProduzioneViewModel mViewModel;
|
||||
|
||||
private final ObservableArrayList<ProdLineStatusDTO> mLinesObservableList = new ObservableArrayList<>();
|
||||
private FragmentLineeProdBinding mBinding;
|
||||
private ElevatedToolbar mToolbar;
|
||||
private int barcodeScannerIstanceID = -1;
|
||||
private final RunnableArgs<BarcodeScanDTO> onScanSuccessful = data -> {
|
||||
this.onLoadingStarted();
|
||||
|
||||
this.mViewModel.processBarcodeDTO(data);
|
||||
};
|
||||
|
||||
public static ProdLineeProduzioneFragment newInstance() {
|
||||
return new ProdLineeProduzioneFragment();
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
|
||||
mBinding = DataBindingUtil.inflate(inflater, R.layout.fragment_linee_prod, container, false);
|
||||
MainApplication.appComponent
|
||||
.prodLineeProduzioneComponent()
|
||||
.create()
|
||||
.inject(this);
|
||||
|
||||
mViewModel.setListener(this);
|
||||
mBinding.setLifecycleOwner(this);
|
||||
this.initRecyclerView();
|
||||
this.initBarcodeReader();
|
||||
mViewModel.init();
|
||||
|
||||
return mBinding.getRoot();
|
||||
}
|
||||
|
||||
private void initBarcodeReader() {
|
||||
barcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
||||
.setOnScanSuccessful(onScanSuccessful)
|
||||
.setOnScanFailed(this::onError));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setScrollToolbar(ElevatedToolbar toolbar) {
|
||||
mToolbar = toolbar;
|
||||
}
|
||||
|
||||
public void refreshLineeProd(List<ProdLineStatusDTO> linesList) {
|
||||
this.mLinesObservableList.clear();
|
||||
if (linesList != null) {
|
||||
|
||||
this.mLinesObservableList.addAll(linesList);
|
||||
}
|
||||
}
|
||||
|
||||
private void initRecyclerView() {
|
||||
this.mViewModel.getProdLinesList().observe(getViewLifecycleOwner(), this::refreshLineeProd);
|
||||
LinesListAdapter prodLinesListAdapter = new LinesListAdapter(this.requireActivity(), this.mLinesObservableList);
|
||||
prodLinesListAdapter.setEmptyView(this.mBinding.linesListEmptyView);
|
||||
this.mBinding.linesMainList.setAdapter(prodLinesListAdapter);
|
||||
this.mBinding.linesMainList.setLayoutManager(new LinearLayoutManager(this.requireActivity()));
|
||||
prodLinesListAdapter.setOnItemClicked(this.mViewModel::onLineSelected);
|
||||
if (mToolbar != null)
|
||||
mToolbar.setRecyclerView(this.mBinding.linesMainList);
|
||||
}
|
||||
|
||||
public void requestResources(ProdLineStatusDTO prodLine) {
|
||||
this.onLoadingEnded();
|
||||
BarcodeManager.disable();
|
||||
requireActivity().runOnUiThread(() -> {
|
||||
|
||||
DialogSimpleInputHelper.makeInputDialog(requireContext(), "Inserisci il numero di risorse da allocare", qta -> {
|
||||
this.onLoadingStarted();
|
||||
try {
|
||||
Integer hrNum = Integer.parseInt(qta);
|
||||
this.mViewModel.startProductionLine(prodLine, hrNum);
|
||||
} catch (NumberFormatException ex) {
|
||||
this.onError(new Exception("Inserire un numero di risorse valido"));
|
||||
}
|
||||
}, BarcodeManager::enable, InputType.TYPE_CLASS_NUMBER).show();
|
||||
});
|
||||
}
|
||||
|
||||
public void requestOrderChange(ProdLineStatusDTO prodLine) {
|
||||
this.onLoadingEnded();
|
||||
requireActivity().runOnUiThread(() -> {
|
||||
DialogStartProduction.newInstance((dto) -> {
|
||||
this.mViewModel.checkBarcodeAndStartOrdine(prodLine, dto);
|
||||
}).show(getChildFragmentManager(), "DialogStartProduction");
|
||||
});
|
||||
}
|
||||
|
||||
public void requestProductionStop(ProdLineStatusDTO prodLine) {
|
||||
this.onLoadingEnded();
|
||||
BarcodeManager.disable();
|
||||
if (UtilityString.isNullOrEmpty(prodLine.getListaOrd())) {
|
||||
mViewModel.stopProduction(prodLine);
|
||||
} else {
|
||||
this.confirmOrderClose(() -> {
|
||||
mViewModel.stopProduction(prodLine);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void successDialog(String message, Runnable onComplete) {
|
||||
BarcodeManager.disable();
|
||||
requireActivity().runOnUiThread(() -> DialogSimpleMessageView.makeSuccessDialog(getResources().getString(R.string.success),
|
||||
new SpannableString(message), null, onComplete).show(getChildFragmentManager(), "successDialog"));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void selectLine(ProdLineStatusDTO dto) {
|
||||
this.onLoadingEnded();
|
||||
BarcodeManager.disable();
|
||||
if (!dto.isStarted()) {
|
||||
this.requestResources(dto);
|
||||
} else {
|
||||
BottomSheetLineAction.newInstance(dto, this::requestResources, this::requestOrderChange, this::requestProductionStop, BarcodeManager::enable).show(getChildFragmentManager(), "BottomSheetLineAction");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void confirmOrderClose(Runnable onConfirm) {
|
||||
this.onLoadingEnded();
|
||||
requireActivity().runOnUiThread(() -> {
|
||||
DialogSimpleMessageView.makeWarningDialog(
|
||||
Html.fromHtml("Per completare l'operazione è necessario chiudere gli ordini attualmente aperti sulla linea."
|
||||
+ "<br /> <br/>" +
|
||||
"Continuare?"),
|
||||
null,
|
||||
onConfirm,
|
||||
BarcodeManager::enable
|
||||
).show(getChildFragmentManager(), "confirmOrderClose");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onCreateActionBar(AppCompatTextView titleText, Context context) {
|
||||
titleText.setText(context.getText(R.string.nav_prod_linee_title).toString());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package it.integry.integrywmsnative.gest.prod_linee_produzione;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ProductionLinesRESTConsumer;
|
||||
import it.integry.integrywmsnative.gest.prod_rientro_merce.ProdRientroMerceComponent;
|
||||
|
||||
@Module(subcomponents = ProdRientroMerceComponent.class)
|
||||
public class ProdLineeProduzioneModule {
|
||||
|
||||
@Provides
|
||||
ProdLineeProduzioneViewModel providesProdRientroMerceViewModel(ProductionLinesRESTConsumer productionLinesRESTConsumer, BarcodeRESTConsumer barcodeRESTConsumer) {
|
||||
return new ProdLineeProduzioneViewModel(productionLinesRESTConsumer, barcodeRESTConsumer);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
ProductionLinesRESTConsumer providesProductionLinesRESTConsumer() {
|
||||
return new ProductionLinesRESTConsumer();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
package it.integry.integrywmsnative.gest.prod_linee_produzione;
|
||||
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
||||
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
||||
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ProductionLinesRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
import it.integry.integrywmsnative.gest.prod_linee_produzione.dto.ProdLineStatusDTO;
|
||||
|
||||
public class ProdLineeProduzioneViewModel {
|
||||
|
||||
|
||||
private final ProductionLinesRESTConsumer productionLinesRESTConsumer;
|
||||
private final BarcodeRESTConsumer mBarcodeRESTConsumer;
|
||||
private final MutableLiveData<List<ProdLineStatusDTO>> prodLines = new MutableLiveData<>();
|
||||
|
||||
private Listener mListener;
|
||||
|
||||
@Inject
|
||||
public ProdLineeProduzioneViewModel(ProductionLinesRESTConsumer productionLinesRESTConsumer, BarcodeRESTConsumer barcodeRESTConsumer) {
|
||||
this.productionLinesRESTConsumer = productionLinesRESTConsumer;
|
||||
this.mBarcodeRESTConsumer = barcodeRESTConsumer;
|
||||
}
|
||||
|
||||
public void init() {
|
||||
this.sendOnLoadingStarted();
|
||||
reloadLines();
|
||||
|
||||
}
|
||||
|
||||
private void reloadLines() {
|
||||
BarcodeManager.disable();
|
||||
sendOnLoadingStarted();
|
||||
this.productionLinesRESTConsumer.getStatoLinee(SettingsManager.i().getUserSession().getDepo().getCodMdep(), lineeProdList -> {
|
||||
this.sendOnLoadingEnded();
|
||||
BarcodeManager.enable();
|
||||
prodLines.postValue(lineeProdList);
|
||||
}, this::sendError);
|
||||
}
|
||||
|
||||
public MutableLiveData<List<ProdLineStatusDTO>> getProdLinesList() {
|
||||
return prodLines;
|
||||
}
|
||||
|
||||
public void setListener(Listener listener) {
|
||||
this.mListener = listener;
|
||||
}
|
||||
|
||||
public void processBarcodeDTO(BarcodeScanDTO barcodeScanDTO) {
|
||||
String codJfas = barcodeScanDTO.getStringValue();
|
||||
|
||||
ProdLineStatusDTO prodLine = prodLines.getValue() != null ? Stream.of(prodLines.getValue()).filter(x -> x.getCodJfas().equalsIgnoreCase(codJfas)).findFirstOrElse(null) : null;
|
||||
if (prodLine != null) {
|
||||
this.onLineSelected(prodLine);
|
||||
} else {
|
||||
this.sendError(new Exception("Linea di produzione " + codJfas + " non trovata"));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
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 void startProductionLine(ProdLineStatusDTO prodLine, Integer hrNum) {
|
||||
this.sendOnLoadingStarted();
|
||||
this.productionLinesRESTConsumer.avviaLineaDiProduzione(prodLine.getCodJfas(),
|
||||
hrNum,
|
||||
() -> this.mListener.successDialog("Operazione completata", this::reloadLines),
|
||||
this::sendError);
|
||||
}
|
||||
|
||||
public void onLineSelected(ProdLineStatusDTO lineSelected) {
|
||||
mListener.selectLine(lineSelected);
|
||||
}
|
||||
|
||||
public void checkBarcodeAndStartOrdine(ProdLineStatusDTO prodLine, BarcodeScanDTO dto) {
|
||||
this.sendOnLoadingStarted();
|
||||
mBarcodeRESTConsumer.decodeEan128(dto, (ean128) -> {
|
||||
String codMart = ean128.Content;
|
||||
String partitaMag = ean128.BatchLot;
|
||||
if (!prodLine.isStarted()) {
|
||||
this.sendError(new Exception("Impossibile avviare una produzione su una linea ferma!"));
|
||||
} else if (UtilityString.isNullOrEmpty(prodLine.getListaOrd())) {
|
||||
this.startProduction(prodLine, codMart, partitaMag);
|
||||
} else {
|
||||
this.mListener.confirmOrderClose(() -> {
|
||||
this.startProduction(prodLine, codMart, partitaMag);
|
||||
});
|
||||
}
|
||||
}, this::sendError);
|
||||
}
|
||||
|
||||
private void startProduction(ProdLineStatusDTO prodLine, String codMart, String partitaMag) {
|
||||
this.sendOnLoadingStarted();
|
||||
this.productionLinesRESTConsumer.avviaProduzioneArticoloSuLinea(prodLine.getCodJfas(), codMart, partitaMag,
|
||||
() -> this.mListener.successDialog("Operazione completata", this::reloadLines),
|
||||
this::sendError);
|
||||
}
|
||||
|
||||
public void stopProduction(ProdLineStatusDTO prodLine) {
|
||||
this.sendOnLoadingStarted();
|
||||
this.productionLinesRESTConsumer.arrestaLineaDiProduzione(prodLine.getCodJfas(),
|
||||
() -> this.mListener.successDialog("Operazione completata", this::reloadLines),
|
||||
this::sendError);
|
||||
}
|
||||
|
||||
|
||||
public interface Listener extends ILoadingListener {
|
||||
|
||||
void onError(Exception ex);
|
||||
|
||||
void successDialog(String message, Runnable onComplete);
|
||||
|
||||
void selectLine(ProdLineStatusDTO prodLineStatusDTO);
|
||||
|
||||
void confirmOrderClose(Runnable onConfirm);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
package it.integry.integrywmsnative.gest.prod_linee_produzione.dialogs;
|
||||
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
||||
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.databinding.BottomSheetLineActionsBinding;
|
||||
import it.integry.integrywmsnative.gest.prod_linee_produzione.dto.ProdLineStatusDTO;
|
||||
|
||||
public class BottomSheetLineAction extends BottomSheetDialogFragment {
|
||||
|
||||
private BottomSheetLineActionsBinding mBinding;
|
||||
|
||||
private ProdLineStatusDTO prodLine;
|
||||
private RunnableArgs<ProdLineStatusDTO> onChangeResourcesRequest;
|
||||
private RunnableArgs<ProdLineStatusDTO> onChangeOrdersRequest;
|
||||
private RunnableArgs<ProdLineStatusDTO> onLineCloseRequest;
|
||||
private Runnable onCancelAction;
|
||||
|
||||
public static BottomSheetLineAction newInstance(ProdLineStatusDTO dto, RunnableArgs<ProdLineStatusDTO> onChangeResourcesRequest, RunnableArgs<ProdLineStatusDTO> onChangeOrdersRequest, RunnableArgs<ProdLineStatusDTO> onLineCloseRequest, Runnable onCancel) {
|
||||
BottomSheetLineAction fragment = new BottomSheetLineAction();
|
||||
fragment
|
||||
.setProdLine(dto)
|
||||
.setOnChangeResourcesRequest(onChangeResourcesRequest)
|
||||
.setOnChangeOrdersRequest(onChangeOrdersRequest)
|
||||
.setOnLineCloseRequest(onLineCloseRequest)
|
||||
.setOnCancelAction(onCancel);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
mBinding = BottomSheetLineActionsBinding.inflate(inflater, container, false);
|
||||
mBinding.setLifecycleOwner(this);
|
||||
mBinding.setView(this);
|
||||
mBinding.setListModel(this.prodLine);
|
||||
|
||||
return mBinding.getRoot();
|
||||
}
|
||||
|
||||
public BottomSheetLineAction setOnCancelAction(Runnable onCancelAction) {
|
||||
this.onCancelAction = onCancelAction;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BottomSheetLineAction setOnChangeResourcesRequest(RunnableArgs<ProdLineStatusDTO> onChangeResourcesRequest) {
|
||||
this.onChangeResourcesRequest = onChangeResourcesRequest;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public BottomSheetLineAction setOnChangeOrdersRequest(RunnableArgs<ProdLineStatusDTO> onChangeOrdersRequest) {
|
||||
this.onChangeOrdersRequest = onChangeOrdersRequest;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public BottomSheetLineAction setOnLineCloseRequest(RunnableArgs<ProdLineStatusDTO> onLineCloseRequest) {
|
||||
this.onLineCloseRequest = onLineCloseRequest;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ProdLineStatusDTO getProdLine() {
|
||||
return prodLine;
|
||||
}
|
||||
|
||||
public BottomSheetLineAction setProdLine(ProdLineStatusDTO prodLine) {
|
||||
this.prodLine = prodLine;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void onResourcesClicked() {
|
||||
if (this.onChangeResourcesRequest != null) {
|
||||
this.onChangeResourcesRequest.run(prodLine);
|
||||
}
|
||||
this.dismiss();
|
||||
|
||||
}
|
||||
|
||||
public void onPlayClicked() {
|
||||
if (this.onChangeOrdersRequest != null) {
|
||||
this.onChangeOrdersRequest.run(prodLine);
|
||||
}
|
||||
this.dismiss();
|
||||
}
|
||||
|
||||
public void onStopClicked() {
|
||||
if (this.onLineCloseRequest != null) {
|
||||
this.onLineCloseRequest.run(prodLine);
|
||||
}
|
||||
this.dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel(@NonNull DialogInterface dialog) {
|
||||
if (this.onCancelAction != null) {
|
||||
onCancelAction.run();
|
||||
}
|
||||
super.onCancel(dialog);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package it.integry.integrywmsnative.gest.prod_linee_produzione.dialogs;
|
||||
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
||||
import it.integry.integrywmsnative.core.barcode_reader.BarcodeCallbackDTO;
|
||||
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
||||
import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
|
||||
import it.integry.integrywmsnative.databinding.DialogStartProductionBinding;
|
||||
|
||||
public class DialogStartProduction extends BaseDialogFragment {
|
||||
private int barcodeScannerIstanceID = -1;
|
||||
private RunnableArgs<BarcodeScanDTO> onScanSuccessful;
|
||||
private DialogStartProductionBinding mBinding;
|
||||
|
||||
public static DialogStartProduction newInstance(RunnableArgs<BarcodeScanDTO> onScanSuccessful) {
|
||||
|
||||
Bundle args = new Bundle();
|
||||
|
||||
DialogStartProduction fragment = new DialogStartProduction();
|
||||
fragment.setArguments(args);
|
||||
fragment.setOnScanSuccessful(onScanSuccessful);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onDismiss(@NonNull DialogInterface dialog) {
|
||||
BarcodeManager.removeCallback(barcodeScannerIstanceID);
|
||||
super.onDismiss(dialog);
|
||||
}
|
||||
|
||||
public DialogStartProduction setOnScanSuccessful(RunnableArgs<BarcodeScanDTO> onScanSuccessful) {
|
||||
this.onScanSuccessful = onScanSuccessful;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
mBinding = DialogStartProductionBinding.inflate(inflater, container, false);
|
||||
mBinding.setLifecycleOwner(this);
|
||||
this.initBarcodeReader();
|
||||
setCancelable(true);
|
||||
getDialog().setCanceledOnTouchOutside(true);
|
||||
getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||
return mBinding.getRoot();
|
||||
}
|
||||
|
||||
|
||||
private void initBarcodeReader() {
|
||||
barcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
||||
.setOnScanSuccessful(this::processBarcode)
|
||||
.setOnScanFailed(this::onError));
|
||||
BarcodeManager.enable();
|
||||
}
|
||||
|
||||
private void processBarcode(BarcodeScanDTO barcodeScanDTO) {
|
||||
if (UtilityBarcode.isEan128(barcodeScanDTO)) {
|
||||
this.onScanSuccessful.run(barcodeScanDTO);
|
||||
this.dismiss();
|
||||
} else {
|
||||
this.onError(new Exception("Il barcode scansionato non è valido!"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
package it.integry.integrywmsnative.gest.prod_linee_produzione.dto;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
||||
public class ProdLineStatusDTO {
|
||||
|
||||
private String codJfas;
|
||||
|
||||
private String descrizione;
|
||||
|
||||
private String codMdepLav;
|
||||
|
||||
private Date datetimeStart;
|
||||
|
||||
private Date datetimeEnd;
|
||||
|
||||
private BigDecimal maxAllocazione;
|
||||
|
||||
private Integer qtaAllocate;
|
||||
|
||||
private String listaOrd;
|
||||
|
||||
|
||||
public String getCodJfas() {
|
||||
return codJfas;
|
||||
}
|
||||
|
||||
public ProdLineStatusDTO setCodJfas(String codJfas) {
|
||||
this.codJfas = codJfas;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDescrizione() {
|
||||
return descrizione;
|
||||
}
|
||||
|
||||
public ProdLineStatusDTO setDescrizione(String descrizione) {
|
||||
this.descrizione = descrizione;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodMdepLav() {
|
||||
return codMdepLav;
|
||||
}
|
||||
|
||||
public ProdLineStatusDTO setCodMdepLav(String codMdepLav) {
|
||||
this.codMdepLav = codMdepLav;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDatetimeStart() {
|
||||
return datetimeStart;
|
||||
}
|
||||
|
||||
public ProdLineStatusDTO setDatetimeStart(Date datetimeStart) {
|
||||
this.datetimeStart = datetimeStart;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDatetimeEnd() {
|
||||
return datetimeEnd;
|
||||
}
|
||||
|
||||
public ProdLineStatusDTO setDatetimeEnd(Date datetimeEnd) {
|
||||
this.datetimeEnd = datetimeEnd;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getMaxAllocazione() {
|
||||
return maxAllocazione;
|
||||
}
|
||||
|
||||
public ProdLineStatusDTO setMaxAllocazione(BigDecimal maxAllocazione) {
|
||||
this.maxAllocazione = maxAllocazione;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getQtaAllocate() {
|
||||
return qtaAllocate;
|
||||
}
|
||||
|
||||
public ProdLineStatusDTO setQtaAllocate(Integer qtaAllocate) {
|
||||
this.qtaAllocate = qtaAllocate;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getListaOrd() {
|
||||
return listaOrd;
|
||||
}
|
||||
|
||||
public ProdLineStatusDTO setListaOrd(String listaOrd) {
|
||||
this.listaOrd = listaOrd;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isStarted() {
|
||||
return datetimeStart != null && datetimeEnd == null;
|
||||
}
|
||||
|
||||
|
||||
public boolean isPaused() {
|
||||
if (datetimeEnd == null) {
|
||||
return false;
|
||||
}
|
||||
Calendar today = Calendar.getInstance();
|
||||
today.set(Calendar.MILLISECOND, 0);
|
||||
today.set(Calendar.SECOND, 0);
|
||||
today.set(Calendar.MINUTE, 0);
|
||||
today.set(Calendar.HOUR_OF_DAY, 0);
|
||||
Calendar lastCloseTime = Calendar.getInstance();
|
||||
lastCloseTime.setTime(datetimeEnd);
|
||||
lastCloseTime.set(Calendar.MILLISECOND, 0);
|
||||
lastCloseTime.set(Calendar.SECOND, 0);
|
||||
lastCloseTime.set(Calendar.MINUTE, 0);
|
||||
lastCloseTime.set(Calendar.HOUR_OF_DAY, 0);
|
||||
return datetimeStart != null && datetimeEnd != null && today.equals(lastCloseTime);
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return codJfas + " - " + descrizione;
|
||||
}
|
||||
|
||||
public String getRisorseLabel() {
|
||||
return qtaAllocate + (maxAllocazione != null && maxAllocazione.compareTo(BigDecimal.ZERO) > 0 ? "/" + maxAllocazione : "");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package it.integry.integrywmsnative.gest.prod_linee_produzione.ui;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import androidx.databinding.ObservableArrayList;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.expansion.view.ExtendedRecyclerView;
|
||||
import it.integry.integrywmsnative.databinding.FragmentLineeProdMainListModelBinding;
|
||||
import it.integry.integrywmsnative.gest.prod_linee_produzione.dto.ProdLineStatusDTO;
|
||||
|
||||
public class LinesListAdapter extends ExtendedRecyclerView<ProdLineStatusDTO, LinesListAdapter.SingleItemViewHolder> {
|
||||
private Context mContext;
|
||||
|
||||
private RunnableArgs<ProdLineStatusDTO> mOnItemClicked;
|
||||
|
||||
public LinesListAdapter(Context context, ObservableArrayList<ProdLineStatusDTO> myDataset) {
|
||||
super(myDataset);
|
||||
this.mContext = context;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public LinesListAdapter.SingleItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
FragmentLineeProdMainListModelBinding binding = DataBindingUtil.inflate(LayoutInflater.from(parent.getContext()), R.layout.fragment_linee_prod_main_list_model, parent, false);
|
||||
return new LinesListAdapter.SingleItemViewHolder(binding);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull LinesListAdapter.SingleItemViewHolder holder, int position) {
|
||||
final ProdLineStatusDTO line = mDataset.get(position);
|
||||
|
||||
holder.binding.setListModel(line);
|
||||
holder.binding.executePendingBindings();
|
||||
holder.binding.getRoot().setOnClickListener(v -> {
|
||||
if (this.mOnItemClicked != null)
|
||||
this.mOnItemClicked.run(line);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public void setOnItemClicked(RunnableArgs<ProdLineStatusDTO> onItemClicked) {
|
||||
this.mOnItemClicked = onItemClicked;
|
||||
}
|
||||
|
||||
static class SingleItemViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
FragmentLineeProdMainListModelBinding binding;
|
||||
|
||||
SingleItemViewHolder(FragmentLineeProdMainListModelBinding binding) {
|
||||
super(binding.getRoot());
|
||||
this.binding = binding;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -116,9 +116,7 @@ public class ProdRecuperoMaterialeFragment extends BaseFragment implements ITitl
|
||||
}
|
||||
|
||||
private final RunnableArgs<BarcodeScanDTO> onScanSuccessful = data -> {
|
||||
BarcodeManager.disable();
|
||||
|
||||
this.openProgress();
|
||||
this.onLoadingStarted();
|
||||
|
||||
this.mViewModel.processBarcodeDTO(data);
|
||||
};
|
||||
@@ -203,6 +201,7 @@ public class ProdRecuperoMaterialeFragment extends BaseFragment implements ITitl
|
||||
.setCanOverflowOrderQuantity(canOverflowOrderQuantity)
|
||||
.setCanLUBeClosed(canLUBeClosed);
|
||||
|
||||
if (!mDialogInputQuantityV2View.isVisible())
|
||||
mDialogInputQuantityV2View
|
||||
.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
|
||||
.setOnComplete((resultDTO, shouldCloseLU) -> {
|
||||
@@ -217,6 +216,7 @@ public class ProdRecuperoMaterialeFragment extends BaseFragment implements ITitl
|
||||
})
|
||||
.setOnAbort(this::onLoadingEnded)
|
||||
.show(requireActivity().getSupportFragmentManager(), "tag");
|
||||
else this.onLoadingEnded();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -228,7 +228,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,
|
||||
|
||||
@@ -291,7 +291,6 @@ public class ProdRecuperoMaterialeViewModel {
|
||||
|
||||
private void singlePrint(MtbColt mtbColtToPrint, Runnable onComplete, RunnableArgs<Exception> onAbort) {
|
||||
this.mPrinterRESTConsumer.printCollo(
|
||||
PrinterRESTConsumer.Type.PRIMARIA,
|
||||
mtbColtToPrint,
|
||||
onComplete, onAbort);
|
||||
|
||||
|
||||
@@ -117,10 +117,12 @@ public class ProdRientroMerceFragment extends BaseFragment implements ITitledFra
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
|
||||
for (Runnable onPreDestroy :
|
||||
mOnPreDestroyList) {
|
||||
for (Runnable onPreDestroy : mOnPreDestroyList) {
|
||||
onPreDestroy.run();
|
||||
}
|
||||
|
||||
mProdRientroMerceOrderDetailFragment.onDetach();
|
||||
mProdRientroMerceOrderListFragment.onDetach();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -8,8 +8,8 @@ import javax.inject.Inject;
|
||||
|
||||
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.MesRESTConsumer;
|
||||
import it.integry.integrywmsnative.gest.picking_resi.exceptions.DocumentsLoadException;
|
||||
import it.integry.integrywmsnative.gest.prod_versamento_materiale.dto.OrdineLavorazioneDTO;
|
||||
import it.integry.integrywmsnative.gest.spedizione.exceptions.OrdersLoadException;
|
||||
|
||||
public class ProdRientroMerceViewModel {
|
||||
|
||||
@@ -31,7 +31,7 @@ public class ProdRientroMerceViewModel {
|
||||
this.mMesRESTConsumer.getOrdiniLavorazione("I", null, ordiniLavorazioneList -> {
|
||||
this.mOrdiniLavorazioneAperti.postValue(ordiniLavorazioneList);
|
||||
this.sendOnLoadingEnded();
|
||||
}, ex -> this.sendError(new DocumentsLoadException(ex)));
|
||||
}, ex -> this.sendError(new OrdersLoadException(ex)));
|
||||
}
|
||||
|
||||
public MutableLiveData<List<OrdineLavorazioneDTO>> getOrdiniLavorazioneAperti() {
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
package it.integry.integrywmsnative.gest.prod_rientro_merce.order_detail;
|
||||
|
||||
import android.bluetooth.BluetoothDevice;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
@@ -12,10 +15,13 @@ import androidx.databinding.ObservableArrayList;
|
||||
import androidx.databinding.ObservableField;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
import androidx.preference.PreferenceManager;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.harrysoft.androidbluetoothserial.BluetoothManager;
|
||||
import com.harrysoft.androidbluetoothserial.BluetoothSerialDevice;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
@@ -23,8 +29,11 @@ import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import it.integry.integrywmsnative.MainApplication;
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.exception.BluetoothConnectionException;
|
||||
import it.integry.integrywmsnative.core.expansion.AtomicBigDecimal;
|
||||
import it.integry.integrywmsnative.core.expansion.BaseFragment;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
@@ -36,6 +45,7 @@ import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDB;
|
||||
import it.integry.integrywmsnative.databinding.FragmentProdRientroMerceOrderDetailBinding;
|
||||
import it.integry.integrywmsnative.gest.prod_versamento_materiale.dto.OrdineLavorazioneDTO;
|
||||
import it.integry.integrywmsnative.gest.settings.MainSettingsFragment;
|
||||
import it.integry.integrywmsnative.ui.SimpleDividerItemDecoration;
|
||||
import it.integry.integrywmsnative.view.dialogs.input_lu_prod.DialogInputLUProdDTO;
|
||||
import it.integry.integrywmsnative.view.dialogs.input_lu_prod.DialogInputLUProdView;
|
||||
@@ -64,6 +74,9 @@ public class ProdRientroMerceOrderDetailFragment extends BaseFragment implements
|
||||
|
||||
private RunnableArgs<MtbColt> onMtbColtClicked;
|
||||
|
||||
private BluetoothManager bluetoothManager;
|
||||
private BluetoothSerialDevice mConnectedBluetoothDevice;
|
||||
|
||||
|
||||
public ObservableField<BigDecimal> sumLUNumber = new ObservableField<>(BigDecimal.ZERO);
|
||||
public ObservableField<BigDecimal> sumColliNumber = new ObservableField<>(BigDecimal.ZERO);
|
||||
@@ -103,6 +116,7 @@ public class ProdRientroMerceOrderDetailFragment extends BaseFragment implements
|
||||
this.mViewModel.mtbColtsOfOrder.observe(getViewLifecycleOwner(), this::refreshList);
|
||||
|
||||
this.initRecyclerView();
|
||||
this.initULScaleBluetoothConnection();
|
||||
|
||||
return mBindings.getRoot();
|
||||
}
|
||||
@@ -110,10 +124,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<>());
|
||||
@@ -125,6 +139,48 @@ public class ProdRientroMerceOrderDetailFragment extends BaseFragment implements
|
||||
});
|
||||
}
|
||||
|
||||
private void initULScaleBluetoothConnection() {
|
||||
bluetoothManager = BluetoothManager.getInstance();
|
||||
if (bluetoothManager == null) {
|
||||
// Bluetooth unavailable on this device :( tell the user
|
||||
Toast.makeText(requireActivity(), "Bluetooth not available.", Toast.LENGTH_LONG).show(); // Replace context with your context instance.
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(requireContext());
|
||||
var btMacAddress = sharedPreferences.getString(MainSettingsFragment.KEY_PALLET_BT_DEVICE, null);
|
||||
|
||||
if (btMacAddress == null) {
|
||||
Toast.makeText(requireActivity(), "Nessun dispositivo BLUETOOTH configurato nelle impostazioni.", Toast.LENGTH_LONG).show(); // Replace context with your context instance.
|
||||
return;
|
||||
}
|
||||
|
||||
var btName = Stream.of(bluetoothManager.getPairedDevicesList())
|
||||
.filter(x -> x.getAddress().equalsIgnoreCase(btMacAddress))
|
||||
.map(BluetoothDevice::getName)
|
||||
.findFirstOrElse(null);
|
||||
|
||||
var disposableBluetooth = bluetoothManager.openSerialDevice(btMacAddress)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(this::onConnected, x -> this.onError(new BluetoothConnectionException(btName, btMacAddress, x)));
|
||||
|
||||
}
|
||||
|
||||
private void onConnected(BluetoothSerialDevice connectedDevice) {
|
||||
Toast.makeText(requireActivity(), "Connesso a: " + connectedDevice.getMac(), Toast.LENGTH_LONG).show();
|
||||
mConnectedBluetoothDevice = connectedDevice;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDetach() {
|
||||
if (mConnectedBluetoothDevice != null)
|
||||
bluetoothManager.close();
|
||||
|
||||
super.onDetach();
|
||||
}
|
||||
|
||||
public void setOrder(OrdineLavorazioneDTO order) {
|
||||
currentOrder.postValue(order);
|
||||
mBindings.invalidateAll();
|
||||
@@ -167,7 +223,7 @@ public class ProdRientroMerceOrderDetailFragment extends BaseFragment implements
|
||||
|
||||
|
||||
public void addULButtonClick() {
|
||||
this.openProgress();
|
||||
this.onLoadingStarted();
|
||||
|
||||
String codProd = this.currentOrder.getValue().getCodProd();
|
||||
mArticoloRESTConsumer.getByCodMart(codProd, mtbAart -> {
|
||||
@@ -186,9 +242,10 @@ public class ProdRientroMerceOrderDetailFragment extends BaseFragment implements
|
||||
" AND (data_fine IS NULL OR last_step = id_step) " +
|
||||
"ORDER BY id_step DESC";
|
||||
|
||||
mSystemRESTConsumer.<List<DtbOrdSteps>>processSql(sql, new TypeToken<ArrayList<DtbOrdSteps>>() {}.getType(), dtbOrdStep -> {
|
||||
mSystemRESTConsumer.<List<DtbOrdSteps>>processSql(sql, new TypeToken<ArrayList<DtbOrdSteps>>() {
|
||||
}.getType(), dtbOrdStep -> {
|
||||
|
||||
this.closeProgress();
|
||||
this.onLoadingEnded();
|
||||
|
||||
DialogInputLUProdDTO dialogInputLUProdDTO = new DialogInputLUProdDTO()
|
||||
.setMtbAart(mtbAart)
|
||||
@@ -203,7 +260,7 @@ public class ProdRientroMerceOrderDetailFragment extends BaseFragment implements
|
||||
|
||||
|
||||
DialogInputLUProdView
|
||||
.newInstance(dialogInputLUProdDTO, resultDTO -> {
|
||||
.newInstance(mConnectedBluetoothDevice != null ? mConnectedBluetoothDevice.toSimpleDeviceInterface() : null, dialogInputLUProdDTO, resultDTO -> {
|
||||
ProdRientroMerceOrderDetailPickedQuantityDTO pickedQuantityDTO = new ProdRientroMerceOrderDetailPickedQuantityDTO()
|
||||
.setNumCnf(resultDTO.getNumCnf())
|
||||
.setPesoCollo(resultDTO.getPesoCollo())
|
||||
@@ -216,9 +273,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 +305,59 @@ 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);
|
||||
} else
|
||||
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);
|
||||
} else
|
||||
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);
|
||||
} else
|
||||
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);
|
||||
}
|
||||
}
|
||||
else
|
||||
return ContextCompat.getColor(getActivity(), R.color.blue_800);
|
||||
return ContextCompat.getColor(requireActivity(), R.color.blue_800);
|
||||
}
|
||||
} else
|
||||
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");
|
||||
|
||||
@@ -13,11 +13,8 @@ import androidx.databinding.DataBindingUtil;
|
||||
import androidx.databinding.ObservableArrayList;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
import com.ravikoradiya.liveadapter.LiveAdapter;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import com.ravikoradiya.liveadapter.Type;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
@@ -35,6 +32,7 @@ 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.databinding.ActivityPvOrdineAcquistoEditBinding;
|
||||
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;
|
||||
@@ -134,20 +132,17 @@ public class PVOrdineAcquistoEditActivity extends BaseActivity implements PVOrdi
|
||||
}
|
||||
|
||||
private void initRecyclerView() {
|
||||
// this.mViewModel.getArticoli().observe(this, updatedData -> {
|
||||
// this.mArticoliMutableData.clear();
|
||||
// this.mArticoliMutableData.addAll(convertDataModelToListModel(updatedData));
|
||||
//// this.noItemsToPick.set(!isThereAnyItemToPick(updatedData));
|
||||
// });
|
||||
|
||||
// var mAdapter = new OrdineAcquistoArtListAdapter(this, mArticoliMutableData)
|
||||
// .setOnItemClicked(this::selectAction);
|
||||
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;
|
||||
});
|
||||
|
||||
var liveAdapter = new LiveAdapter(this.mViewModel.getArticoli(), this, BR.articolo)
|
||||
.map(ArticoloOrdine.class, R.layout.fragment_pv_articoli_ordine_acquisto__list_single_item)
|
||||
new LiveAdapter(this.mViewModel.getArticoli(), this)
|
||||
.map(ArticoloOrdine.class, itemType)
|
||||
.into(mBinding.articoliOrdineList);
|
||||
|
||||
// mBinding.articoliOrdineList.setAdapter(mAdapter);
|
||||
mBinding.articoliOrdineList.setHasFixedSize(true);
|
||||
mBinding.articoliOrdineList.setLayoutManager(new LinearLayoutManager(this));
|
||||
|
||||
@@ -156,20 +151,6 @@ public class PVOrdineAcquistoEditActivity extends BaseActivity implements PVOrdi
|
||||
mBinding.articoliOrdineList.addItemDecoration(itemDecorator);
|
||||
}
|
||||
|
||||
private List<OrdineAcquistoArtListModel> convertDataModelToListModel
|
||||
(List<ArticoloOrdine> dataList) {
|
||||
return Stream.of(dataList)
|
||||
.distinctBy(ArticoloOrdine::getArticoloOrdineId)
|
||||
.sortBy(x -> x.getDataIns().getTime())
|
||||
.map(x -> new OrdineAcquistoArtListModel()
|
||||
.setBadge1(x.getCodMart())
|
||||
.setDescription(x.getDescrizione())
|
||||
.setQuantity(BigDecimal.valueOf(x.getQtaOrd()))
|
||||
.setUntMis(x.getUntMis())
|
||||
.setOriginalModel(x))
|
||||
.toList();
|
||||
}
|
||||
|
||||
|
||||
private void selectAction(ArticoloOrdine articoloOrdine) {
|
||||
mBinding.closeActivityFab.close(false);
|
||||
@@ -179,7 +160,12 @@ public class PVOrdineAcquistoEditActivity extends BaseActivity implements PVOrdi
|
||||
articoloOrdine.getDescrizione(),
|
||||
articoloOrdine.getQtaOrd() + " " + articoloOrdine.getUntMis(),
|
||||
() -> {
|
||||
this.onItemDispatched(articoloOrdine);
|
||||
this.mViewModel.checkArticolo(mOrdine, articoloOrdine.getCodMart(),
|
||||
artOrd -> {
|
||||
this.onItemDispatched(artOrd);
|
||||
BarcodeManager.enable();
|
||||
},
|
||||
this::onError);
|
||||
BarcodeManager.enable();
|
||||
},
|
||||
() -> {
|
||||
@@ -204,9 +190,7 @@ public class PVOrdineAcquistoEditActivity extends BaseActivity implements PVOrdi
|
||||
mBinding.closeActivityFab.close(false);
|
||||
this.onLoadingStarted();
|
||||
|
||||
this.mViewModel.processBarcodeDTO(data, () -> {
|
||||
this.onLoadingEnded();
|
||||
});
|
||||
this.mViewModel.processBarcodeDTO(data, this::onLoadingEnded);
|
||||
|
||||
};
|
||||
|
||||
@@ -227,6 +211,11 @@ public class PVOrdineAcquistoEditActivity extends BaseActivity implements PVOrdi
|
||||
}).show(this.getSupportFragmentManager(), "tag");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColorFromResource(int resId) {
|
||||
return getResources().getColor(resId);
|
||||
}
|
||||
|
||||
|
||||
public void exportOrdine() {
|
||||
this.mViewModel.exportOrdine(() -> {
|
||||
@@ -252,11 +241,13 @@ public class PVOrdineAcquistoEditActivity extends BaseActivity implements PVOrdi
|
||||
BarcodeManager.disable();
|
||||
DialogSimpleInputHelper.makeInputDialog(this, "Inserisci il codice a barre/codice articolo da cercare", codice -> {
|
||||
this.onLoadingStarted();
|
||||
this.mViewModel.loadArticolo(codice,
|
||||
() -> {
|
||||
this.mViewModel.checkArticolo(mOrdine, codice,
|
||||
articoloOrdine -> {
|
||||
this.onItemDispatched(articoloOrdine);
|
||||
this.onLoadingEnded();
|
||||
BarcodeManager.enable();
|
||||
}
|
||||
},
|
||||
this::onError
|
||||
);
|
||||
}, BarcodeManager::enable).show();
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ 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;
|
||||
@@ -11,6 +12,7 @@ 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;
|
||||
@@ -22,6 +24,7 @@ import it.integry.integrywmsnative.core.data_store.db.repository.OrdineRepositor
|
||||
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 {
|
||||
|
||||
@@ -69,13 +72,27 @@ public class PVOrdineAcquistoEditViewModel {
|
||||
|
||||
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() {
|
||||
@@ -87,6 +104,7 @@ public class PVOrdineAcquistoEditViewModel {
|
||||
}
|
||||
|
||||
public void saveArticolo(ArticoloOrdine articolo) {
|
||||
setBgTint(articolo);
|
||||
var newList = this.mArticoli.getValue();
|
||||
|
||||
var alreadySavedItem = Stream.of(newList)
|
||||
@@ -100,29 +118,6 @@ public class PVOrdineAcquistoEditViewModel {
|
||||
}
|
||||
|
||||
|
||||
public void loadArticolo(String barcode, Runnable onSuccess) {
|
||||
try {
|
||||
mArticoliOrdineRepository.findArticoloByScanAndOrdine(mCurrentOrdine, barcode, (articolo) -> {
|
||||
if (articolo != null) {
|
||||
onSuccess.run();
|
||||
this.sendOnItemDispatched(articolo);
|
||||
} else {
|
||||
mArticoloGrigliaRepository.findArticoloByScanAndGriglia(barcode, mCurrentOrdine.getIdGriglia(), artGrid -> {
|
||||
if (artGrid != null) {
|
||||
onSuccess.run();
|
||||
this.sendOnItemDispatched(artGrid.convertToArticoloOrdine(mCurrentOrdine));
|
||||
} else {
|
||||
this.sendError(new Exception("L' articolo ( " + barcode + " ) non è presente nella griglia"));
|
||||
}
|
||||
}, this::sendError);
|
||||
}
|
||||
}, this::sendError);
|
||||
|
||||
} catch (Exception e) {
|
||||
this.sendError(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void processBarcodeDTO(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
||||
this.checkArticolo(
|
||||
mCurrentOrdine,
|
||||
@@ -152,27 +147,55 @@ public class PVOrdineAcquistoEditViewModel {
|
||||
}
|
||||
}
|
||||
|
||||
private void checkArticolo(Ordine ordine, String barcode, RunnableArgs<ArticoloOrdine> onSuccess, RunnableArgs<Exception> onFail) {
|
||||
public void checkArticolo(Ordine ordine, String barcode, RunnableArgs<ArticoloOrdine> onSuccess, RunnableArgs<Exception> onFail) {
|
||||
try {
|
||||
mArticoliOrdineRepository.findArticoloByScanAndOrdine(ordine, barcode, (articolo) -> {
|
||||
if (articolo != null) {
|
||||
onSuccess.run(articolo);
|
||||
} else {
|
||||
mArticoloGrigliaRepository.findArticoloByScanAndGriglia(barcode, ordine.getIdGriglia(), artGrid -> {
|
||||
if (artGrid != null) {
|
||||
onSuccess.run(artGrid.convertToArticoloOrdine(ordine));
|
||||
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());
|
||||
articolo.setSystemNote(artGrid.generateSystemNote());
|
||||
|
||||
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);
|
||||
}
|
||||
}, onFail);
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
onFail.run(e);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isAutoOrderOnScan() {
|
||||
return SettingsManager.iDB().isFlagOrdinaArticoliOnScan();
|
||||
}
|
||||
|
||||
private void getNewArticoli(int idGrigla, RunnableArgs<List<ArticoloGriglia>> onSuccess, RunnableArgs<Exception> onError) {
|
||||
mArticoloGrigliaRepository.findNewArticoliInGrigla(idGrigla, onSuccess, onError);
|
||||
}
|
||||
@@ -252,6 +275,8 @@ public class PVOrdineAcquistoEditViewModel {
|
||||
public interface Listener extends ILoadingListener {
|
||||
void onItemDispatched(ArticoloOrdine articoloOrdine);
|
||||
|
||||
int getColorFromResource(int resId);
|
||||
|
||||
void onError(Exception ex);
|
||||
}
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ public class DialogEditArticoloViewModel {
|
||||
|
||||
public void setQtaTot(BigDecimal newValue) {
|
||||
this.internalQtaTot = newValue;
|
||||
|
||||
if (newValue == null) return;
|
||||
this.internalNumCnf = UtilityBigDecimal.divide(newValue, internalQtaCnf)
|
||||
.setScale(0, RoundingMode.CEILING);
|
||||
|
||||
|
||||
@@ -28,6 +28,8 @@ public class ArtDTO {
|
||||
|
||||
private String dataScad;
|
||||
|
||||
private String systemNote;
|
||||
|
||||
public Integer getRigaOrd() {
|
||||
return rigaOrd;
|
||||
}
|
||||
@@ -63,6 +65,7 @@ public class ArtDTO {
|
||||
public String getDataIns() {
|
||||
return dataIns;
|
||||
}
|
||||
|
||||
public Date getDataInsD() {
|
||||
return UtilityDate.recognizeDateWithExceptionHandler(getDataIns());
|
||||
}
|
||||
@@ -70,6 +73,7 @@ public class ArtDTO {
|
||||
public void setDataIns(String dataIns) {
|
||||
this.dataIns = dataIns;
|
||||
}
|
||||
|
||||
public void setDataInsD(Date dataIns) {
|
||||
setDataIns(UtilityDate.formatDate(dataIns, UtilityDate.COMMONS_DATE_FORMATS.DMY_TIME_SLASH));
|
||||
}
|
||||
@@ -122,6 +126,7 @@ public class ArtDTO {
|
||||
public void setDataScad(String dataScad) {
|
||||
this.dataScad = dataScad;
|
||||
}
|
||||
|
||||
public Date getDataScadD() {
|
||||
return UtilityDate.recognizeDateWithExceptionHandler(getDataScad());
|
||||
}
|
||||
@@ -130,5 +135,12 @@ public class ArtDTO {
|
||||
setDataScad(UtilityDate.formatDate(dataScad, UtilityDate.COMMONS_DATE_FORMATS.DMY_TIME_SLASH));
|
||||
}
|
||||
|
||||
|
||||
public String getSystemNote() {
|
||||
return systemNote;
|
||||
}
|
||||
|
||||
public ArtDTO setSystemNote(String systemNote) {
|
||||
this.systemNote = systemNote;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
@@ -381,6 +378,7 @@ public class RettificaGiacenzeFragment extends BaseFragment implements ITitledFr
|
||||
.setCanPartitaMagBeChanged(canPartitaMagBeChanged)
|
||||
.setCanLUBeClosed(canLUBeClosed);
|
||||
|
||||
if (!mDialogInputQuantityV2View.isVisible())
|
||||
mDialogInputQuantityV2View
|
||||
.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
|
||||
.setOnComplete((resultDTO, shouldCloseLU) -> {
|
||||
@@ -391,13 +389,13 @@ public class RettificaGiacenzeFragment extends BaseFragment implements ITitledFr
|
||||
.setPartitaMag(resultDTO.getPartitaMag())
|
||||
.setDataScad(resultDTO.getDataScad());
|
||||
|
||||
this.openProgress();
|
||||
this.onLoadingStarted();
|
||||
onComplete.run(pickedQuantityDTO, shouldCloseLU);
|
||||
})
|
||||
.setOnAbort(() -> {
|
||||
this.closeProgress();
|
||||
})
|
||||
.setOnAbort(this::onLoadingEnded)
|
||||
.show(requireActivity().getSupportFragmentManager(), "tag");
|
||||
|
||||
else this.onLoadingEnded();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -494,7 +494,7 @@ public class RettificaGiacenzeViewModel {
|
||||
onComplete.run();
|
||||
} else {
|
||||
|
||||
this.mPrinterRESTConsumer.printCollo(null, mCurrentMtbColt, () -> {
|
||||
this.mPrinterRESTConsumer.printCollo(mCurrentMtbColt, () -> {
|
||||
this.sendLUSuccessfullyPrinted();
|
||||
onComplete.run();
|
||||
}, ex -> this.sendLUPrintError(ex, onComplete));
|
||||
|
||||
@@ -1,20 +1,34 @@
|
||||
package it.integry.integrywmsnative.gest.settings;
|
||||
|
||||
import android.bluetooth.BluetoothDevice;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.widget.AppCompatTextView;
|
||||
import androidx.preference.ListPreference;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceFragmentCompat;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
import com.harrysoft.androidbluetoothserial.BluetoothManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.interfaces.ITitledFragment;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityResources;
|
||||
|
||||
public class MainSettingsFragment extends PreferenceFragmentCompat implements ITitledFragment {
|
||||
public class MainSettingsFragment extends PreferenceFragmentCompat implements ITitledFragment, Preference.OnPreferenceChangeListener {
|
||||
|
||||
private final ArrayList<Runnable> onPreDestroyList = new ArrayList<>();
|
||||
|
||||
public static final String KEY_PALLET_BT_DEVICE = "pallet_scale_bt_device";
|
||||
|
||||
private Collection<BluetoothDevice> btPairedDevices;
|
||||
|
||||
@Override
|
||||
public void onCreateActionBar(AppCompatTextView titleText, Context context) {
|
||||
titleText.setText(context.getText(R.string.settings_category).toString());
|
||||
@@ -23,8 +37,52 @@ public class MainSettingsFragment extends PreferenceFragmentCompat implements IT
|
||||
@Override
|
||||
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
|
||||
setPreferencesFromResource(R.xml.app_preferences, rootKey);
|
||||
|
||||
var palletScaleBtDeviceListPref = (ListPreference) findPreference(KEY_PALLET_BT_DEVICE);
|
||||
setListPreferenceData(palletScaleBtDeviceListPref);
|
||||
palletScaleBtDeviceListPref.setOnPreferenceChangeListener(this);
|
||||
}
|
||||
|
||||
|
||||
protected void setListPreferenceData(ListPreference lp) {
|
||||
BluetoothManager bluetoothManager = BluetoothManager.getInstance();
|
||||
if (bluetoothManager == null) {
|
||||
// Bluetooth unavailable on this device :( tell the user
|
||||
Toast.makeText(requireActivity(), "Bluetooth not available", Toast.LENGTH_LONG).show(); // Replace context with your context instance.
|
||||
return;
|
||||
}
|
||||
|
||||
btPairedDevices = bluetoothManager.getPairedDevicesList();
|
||||
|
||||
if(!Stream.of(btPairedDevices).anyMatch(x -> x.getAddress().equalsIgnoreCase(lp.getValue()))) {
|
||||
lp.setValue(null);
|
||||
}
|
||||
|
||||
updatePalletBtDeviceSummary(lp, lp.getValue());
|
||||
|
||||
if (!btPairedDevices.isEmpty()) {
|
||||
CharSequence[] entries = new CharSequence[btPairedDevices.size()];
|
||||
Stream.of(btPairedDevices)
|
||||
.map(BluetoothDevice::getName)
|
||||
.toList()
|
||||
.toArray(entries);
|
||||
|
||||
CharSequence[] entryValues = new CharSequence[btPairedDevices.size()];
|
||||
Stream.of(btPairedDevices)
|
||||
.map(BluetoothDevice::getAddress)
|
||||
.toList()
|
||||
.toArray(entryValues);
|
||||
|
||||
lp.setEntries(entries);
|
||||
lp.setEntryValues(entryValues);
|
||||
} else {
|
||||
lp.setEntries(new CharSequence[0]);
|
||||
lp.setEntryValues(new CharSequence[0]);
|
||||
lp.setDialogMessage("Nessun dispositivo bluetooth associato. Associane uno dalle impostazioni bluetooth prima di procedere.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void addOnPreDestroy(Runnable onPreDestroy) {
|
||||
onPreDestroyList.add(onPreDestroy);
|
||||
@@ -34,9 +92,34 @@ public class MainSettingsFragment extends PreferenceFragmentCompat implements IT
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
|
||||
for (Runnable onPreDestroy :
|
||||
onPreDestroyList) {
|
||||
for (Runnable onPreDestroy : onPreDestroyList) {
|
||||
onPreDestroy.run();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceChange(@NonNull Preference preference, Object newValue) {
|
||||
|
||||
final int idx;
|
||||
switch (preference.getKey()) {
|
||||
case KEY_PALLET_BT_DEVICE:
|
||||
final var palletScaleBtDeviceListPref = (ListPreference) preference;
|
||||
updatePalletBtDeviceSummary(palletScaleBtDeviceListPref, (String) newValue);
|
||||
break;
|
||||
|
||||
}
|
||||
// Set result so knows to refresh itself
|
||||
// getActivity().setResult(RESULT_OK);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
private void updatePalletBtDeviceSummary(ListPreference listPref, String btDeviceAddress) {
|
||||
String btDeviceName = Stream.of(btPairedDevices)
|
||||
.filter(x -> x.getAddress().equalsIgnoreCase(btDeviceAddress))
|
||||
.map(BluetoothDevice::getName)
|
||||
.findFirstOrElse(UtilityResources.getString(R.string.pallet_scale_bt_device_selection_info));
|
||||
listPref.setSummary(btDeviceName);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.content.SharedPreferences;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Bundle;
|
||||
import android.text.SpannableString;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import androidx.databinding.ObservableArrayList;
|
||||
@@ -44,7 +45,6 @@ import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
||||
import it.integry.integrywmsnative.core.model.MtbPartitaMag;
|
||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.PrinterRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.model.OrdineUscitaInevasoDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.SitArtOrdDTO;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
@@ -56,12 +56,14 @@ import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityToast;
|
||||
import it.integry.integrywmsnative.databinding.ActivitySpedizioneBinding;
|
||||
import it.integry.integrywmsnative.gest.lista_bancali.ListaBancaliActivity;
|
||||
import it.integry.integrywmsnative.gest.spedizione.ui.SpedizioneListAdapter;
|
||||
import it.integry.integrywmsnative.gest.spedizione.ui.SpedizioneListModel;
|
||||
import it.integry.integrywmsnative.gest.spedizione.dialogs.print_sscc_list.DialogPrintOrderSSCCListView;
|
||||
import it.integry.integrywmsnative.gest.spedizione.dialogs.row_info.BaseDialogRowInfoView;
|
||||
import it.integry.integrywmsnative.gest.spedizione.exceptions.InvalidPesoKGException;
|
||||
import it.integry.integrywmsnative.gest.spedizione.model.PickedQuantityDTO;
|
||||
import it.integry.integrywmsnative.gest.spedizione.model.PickingObjectDTO;
|
||||
import it.integry.integrywmsnative.gest.spedizione.model.PrintOrderCloseDTO;
|
||||
import it.integry.integrywmsnative.gest.spedizione.ui.SpedizioneListAdapter;
|
||||
import it.integry.integrywmsnative.gest.spedizione.ui.SpedizioneListModel;
|
||||
import it.integry.integrywmsnative.view.bottom_sheet__lu_content.BottomSheetFragmentLUContentView;
|
||||
import it.integry.integrywmsnative.view.bottom_sheet__lu_content.BottomSheetFragmentLUContentViewModel;
|
||||
import it.integry.integrywmsnative.view.dialogs.DialogConsts;
|
||||
@@ -192,9 +194,7 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
||||
this.initBarcodeReader();
|
||||
this.initRecyclerView();
|
||||
|
||||
|
||||
String reportNameSpedizioneChiudiOrdine = SettingsManager.iDB().getReportNameSpedizionChiudiOrdine();
|
||||
closeOrderButtonEnabled.set(!UtilityString.isNullOrEmpty(reportNameSpedizioneChiudiOrdine));
|
||||
closeOrderButtonEnabled.set(SettingsManager.iDB().isFlagPrintEtichetteOnOrderClose() || SettingsManager.iDB().isFlagPrintPackingListOnOrderClose());
|
||||
|
||||
|
||||
String codMdep = SettingsManager.i().getUserSession().getDepo().getCodMdep();
|
||||
@@ -204,7 +204,6 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
||||
boolean shouldAskPesoLU = SettingsManager.iDB().isFlagAskPesoColloSpedizione();
|
||||
boolean useQtaOrd = SettingsManager.iDB().isFlagSpedizioneUseQtaOrd();
|
||||
|
||||
if (!mEnableFakeGiacenza) this.openProgress();
|
||||
mViewmodel.init(
|
||||
codMdep,
|
||||
!mEnableFakeGiacenza,
|
||||
@@ -214,7 +213,6 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
||||
mSitArtOrd,
|
||||
mTestateOrdini,
|
||||
mColliRegistrati,
|
||||
reportNameSpedizioneChiudiOrdine,
|
||||
mGestioneCol, mSegnoCol, mDefaultCausaleUL,
|
||||
mEnableQuantityReset,
|
||||
useQtaOrd);
|
||||
@@ -622,13 +620,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 +655,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();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -672,7 +667,7 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
||||
|
||||
ArrayList<MtbColt> createdMtbColts = this.mViewmodel.getCreatedMtbColts();
|
||||
|
||||
Intent myIntent = ListaBancaliActivity.createIntent(this, createdMtbColts, true, PrinterRESTConsumer.Type.PRIMARIA, false);
|
||||
Intent myIntent = ListaBancaliActivity.createIntent(this, createdMtbColts, true, false);
|
||||
this.startActivityForResult(myIntent, PICK_UL_REQUEST);
|
||||
}
|
||||
|
||||
@@ -683,16 +678,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());
|
||||
@@ -709,7 +694,7 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
||||
this.addExtraItemsEnabled.set(false);
|
||||
noLUPresent.set(true);
|
||||
this.mBottomSheetFragmentLUContentViewModel.setMtbColt(null);
|
||||
closeOrderButtonEnabled.set(!UtilityString.isNullOrEmpty(SettingsManager.iDB().getReportNameSpedizionChiudiOrdine()));
|
||||
closeOrderButtonEnabled.set(SettingsManager.iDB().isFlagPrintEtichetteOnOrderClose() || SettingsManager.iDB().isFlagPrintPackingListOnOrderClose());
|
||||
|
||||
if (this.mShouldCloseActivity) super.onBackPressed();
|
||||
}
|
||||
@@ -737,7 +722,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 +758,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());
|
||||
@@ -824,6 +809,7 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
||||
.setCanLUBeClosed(true)
|
||||
.setCanPartitaMagBeChanged(canPartitaMagBeChanged);
|
||||
|
||||
if (!mDialogInputQuantityV2View.isVisible())
|
||||
mDialogInputQuantityV2View
|
||||
.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
|
||||
.setOnComplete((resultDTO, shouldCloseLU) -> {
|
||||
@@ -834,13 +820,14 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
||||
.setPartitaMag(resultDTO.getPartitaMag())
|
||||
.setDataScad(resultDTO.getDataScad());
|
||||
|
||||
this.openProgress();
|
||||
this.onLoadingStarted();
|
||||
onComplete.run(pickedQuantityDTO, shouldCloseLU);
|
||||
})
|
||||
.setOnAbort(() -> {
|
||||
this.mViewmodel.resetMatchedRows();
|
||||
})
|
||||
.show(getSupportFragmentManager(), "tag");
|
||||
else Toast.makeText(this, "Dialog già a video", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -864,12 +851,58 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
||||
}).show();
|
||||
}
|
||||
|
||||
public void askShouldPrintPackingList(PrintOrderCloseDTO printOrderCloseDTO, RunnableArgs<PrintOrderCloseDTO> onComplete) {
|
||||
DialogSimpleMessageView.makeInfoDialog(
|
||||
getResources().getString(R.string.action_close_order),
|
||||
new SpannableString(getResources().getString(R.string.message_print_packing_list_on_close_order)),
|
||||
null,
|
||||
() -> {
|
||||
printOrderCloseDTO.setFlagPrintPackingList(true);
|
||||
if (SettingsManager.iDB().isFlagPrintEtichetteOnOrderClose()) {
|
||||
this.askShouldPrintSSCC(printOrderCloseDTO, onComplete);
|
||||
} else {
|
||||
onComplete.run(printOrderCloseDTO);
|
||||
}
|
||||
},
|
||||
() -> {
|
||||
printOrderCloseDTO.setFlagPrintPackingList(false);
|
||||
if (SettingsManager.iDB().isFlagPrintEtichetteOnOrderClose()) {
|
||||
this.askShouldPrintSSCC(printOrderCloseDTO, onComplete);
|
||||
} else {
|
||||
onComplete.run(printOrderCloseDTO);
|
||||
}
|
||||
}
|
||||
)
|
||||
.show(getSupportFragmentManager(), "tag");
|
||||
}
|
||||
|
||||
public void askShouldPrintSSCC(PrintOrderCloseDTO printOrderCloseDTO, RunnableArgs<PrintOrderCloseDTO> onComplete) {
|
||||
DialogPrintOrderSSCCListView.newInstance(printOrderCloseDTO, onComplete).show(this.getSupportFragmentManager(), "dialogPrintOrderSSCCListView");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBatchLotSelectionRequest(List<MtbPartitaMag> availableBatchLots, RunnableArgs<MtbPartitaMag> onComplete) {
|
||||
DialogChooseBatchLotView.newInstance(availableBatchLots, onComplete)
|
||||
.show(getSupportFragmentManager(), "tag");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCloseOrderPrintRequest(RunnableArgs<PrintOrderCloseDTO> onComplete) {
|
||||
PrintOrderCloseDTO printOrderCloseDTO = new PrintOrderCloseDTO();
|
||||
if (SettingsManager.iDB().isFlagPrintPackingListOnOrderClose()) {
|
||||
this.askShouldPrintPackingList(printOrderCloseDTO, onComplete);
|
||||
} else if (SettingsManager.iDB().isFlagPrintEtichetteOnOrderClose()) {
|
||||
this.askShouldPrintSSCC(printOrderCloseDTO, onComplete);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOrderClosed() {
|
||||
this.onLoadingEnded();
|
||||
this.onBackPressed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRowSaved() {
|
||||
FBToast.successToast(this, getResources().getString(R.string.data_saved), FBToast.LENGTH_SHORT);
|
||||
|
||||
@@ -26,7 +26,6 @@ import it.integry.integrywmsnative.core.data_recover.ColliDataRecoverService;
|
||||
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.NoPrintersFoundException;
|
||||
import it.integry.integrywmsnative.core.exception.NoResultFromBarcodeException;
|
||||
import it.integry.integrywmsnative.core.exception.ScannedPositionNotExistException;
|
||||
import it.integry.integrywmsnative.core.expansion.AtomicBigDecimal;
|
||||
@@ -37,6 +36,7 @@ import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILUBaseOp
|
||||
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILUPrintListener;
|
||||
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
|
||||
import it.integry.integrywmsnative.core.model.CommonModelConsts;
|
||||
import it.integry.integrywmsnative.core.model.DtbOrdt;
|
||||
import it.integry.integrywmsnative.core.model.FiltroOrdineDTO;
|
||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
@@ -45,6 +45,7 @@ import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
||||
import it.integry.integrywmsnative.core.model.MtbPartitaMag;
|
||||
import it.integry.integrywmsnative.core.model.dto.PickDataDTO;
|
||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
import it.integry.integrywmsnative.core.report.ReportType;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||
@@ -55,6 +56,7 @@ import it.integry.integrywmsnative.core.rest.model.Ean128Model;
|
||||
import it.integry.integrywmsnative.core.rest.model.Ean13PesoModel;
|
||||
import it.integry.integrywmsnative.core.rest.model.OrdineUscitaInevasoDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.SitArtOrdDTO;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityBigDecimal;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||
@@ -66,6 +68,7 @@ import it.integry.integrywmsnative.gest.spedizione.exceptions.NotCurrentYearLUEx
|
||||
import it.integry.integrywmsnative.gest.spedizione.exceptions.OrdersLoadException;
|
||||
import it.integry.integrywmsnative.gest.spedizione.model.PickedQuantityDTO;
|
||||
import it.integry.integrywmsnative.gest.spedizione.model.PickingObjectDTO;
|
||||
import it.integry.integrywmsnative.gest.spedizione.model.PrintOrderCloseDTO;
|
||||
|
||||
public class SpedizioneViewModel {
|
||||
|
||||
@@ -78,7 +81,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;
|
||||
@@ -91,7 +94,6 @@ public class SpedizioneViewModel {
|
||||
private boolean mEnableCheckPartitaMag;
|
||||
private boolean mCanOverflowOrderQuantity;
|
||||
private boolean mShouldAskPesoLU;
|
||||
private String mReportNameSpedizioneChiudiOrdine;
|
||||
private boolean mIsNewLU;
|
||||
private boolean mEnableQuantityReset;
|
||||
private boolean mUseQtaOrd;
|
||||
@@ -133,7 +135,6 @@ public class SpedizioneViewModel {
|
||||
List<SitArtOrdDTO> pickingList,
|
||||
List<OrdineUscitaInevasoDTO> testateOrdini,
|
||||
List<MtbColt> colliRegistrati,
|
||||
String reportNameSpedizioneChiudiOrdine,
|
||||
GestioneEnum gestioneCol,
|
||||
int segnoCol,
|
||||
Integer defaultCausaleUL,
|
||||
@@ -148,7 +149,6 @@ public class SpedizioneViewModel {
|
||||
this.mEnableCheckPartitaMag = enableCheckPartitaMag;
|
||||
this.mCanOverflowOrderQuantity = canOverflowOrderQuantity;
|
||||
this.mShouldAskPesoLU = shouldAskPesoLU;
|
||||
this.mReportNameSpedizioneChiudiOrdine = reportNameSpedizioneChiudiOrdine;
|
||||
this.mDefaultCausaleOfUL = defaultCausaleUL;
|
||||
this.mEnableQuantityReset = enableQuantityReset;
|
||||
this.mUseQtaOrd = useQtaOrd;
|
||||
@@ -210,9 +210,9 @@ public class SpedizioneViewModel {
|
||||
.distinct()
|
||||
.toList();
|
||||
|
||||
if (foundGestioni != null && foundGestioni.size() > 1) {
|
||||
if (foundGestioni.size() > 1) {
|
||||
return;
|
||||
} else if (foundGestioni != null && foundGestioni.size() == 1) {
|
||||
} else if (foundGestioni.size() == 1) {
|
||||
mDefaultGestioneOfUL = foundGestioni.get(0);
|
||||
} else {
|
||||
mDefaultGestioneOfUL = GestioneEnum.VENDITA;
|
||||
@@ -305,6 +305,14 @@ public class SpedizioneViewModel {
|
||||
if (this.mListener != null) mListener.onLoadingStarted();
|
||||
}
|
||||
|
||||
private void sendOnCloseOrderPrintRequest(RunnableArgs<PrintOrderCloseDTO> onComplete) {
|
||||
if (this.mListener != null) mListener.onCloseOrderPrintRequest(onComplete);
|
||||
}
|
||||
|
||||
private void sendOnOrderClosed() {
|
||||
if (this.mListener != null) mListener.onOrderClosed();
|
||||
}
|
||||
|
||||
private void sendOnLoadingEnded() {
|
||||
if (this.mListener != null) mListener.onLoadingEnded();
|
||||
}
|
||||
@@ -511,10 +519,15 @@ public class SpedizioneViewModel {
|
||||
if (!UtilityBarcode.isEtichettaAnonimaOfCurrentYear(barcodeScanDTO.getStringValue())) {
|
||||
this.sendError(new NotCurrentYearLUException());
|
||||
} else {
|
||||
int numCollo = -1;
|
||||
|
||||
this.createNewLU(
|
||||
UtilityBarcode.getNumColloFromULAnonima(barcodeScanDTO.getStringValue()),
|
||||
try {
|
||||
numCollo = UtilityBarcode.getNumColloFromULAnonima(barcodeScanDTO.getStringValue());
|
||||
this.createNewLU(numCollo,
|
||||
CommonConst.Config.DEFAULT_ANONYMOUS_UL_SERIE, onComplete);
|
||||
} catch (Exception ex) {
|
||||
this.sendError(ex);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -1319,8 +1332,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)
|
||||
@@ -1723,26 +1735,25 @@ public class SpedizioneViewModel {
|
||||
if (!shouldPrint) {
|
||||
onComplete.run();
|
||||
} else {
|
||||
cyclicPrint(PrinterRESTConsumer.Type.PRIMARIA, mtbColtsToPrint.iterator(), onComplete, ex -> this.sendLUPrintError(ex, onComplete));
|
||||
cyclicPrint(mtbColtsToPrint.iterator(), onComplete, ex -> this.sendLUPrintError(ex, onComplete));
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
private void cyclicPrint(PrinterRESTConsumer.Type printerType, @NotNull Iterator<MtbColt> sourceMtbColts, Runnable onComplete, RunnableArgs<Exception> onAbort) {
|
||||
private void cyclicPrint(@NotNull Iterator<MtbColt> sourceMtbColts, Runnable onComplete, RunnableArgs<Exception> onAbort) {
|
||||
if (sourceMtbColts.hasNext()) {
|
||||
singlePrint(printerType, sourceMtbColts.next(), () -> {
|
||||
cyclicPrint(printerType, sourceMtbColts, onComplete, onAbort);
|
||||
singlePrint(sourceMtbColts.next(), () -> {
|
||||
cyclicPrint(sourceMtbColts, onComplete, onAbort);
|
||||
}, onAbort);
|
||||
} else {
|
||||
onComplete.run();
|
||||
}
|
||||
}
|
||||
|
||||
private void singlePrint(PrinterRESTConsumer.Type printerType, MtbColt mtbColtToPrint, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
private void singlePrint(MtbColt mtbColtToPrint, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
this.mPrinterRESTConsumer.printCollo(
|
||||
printerType,
|
||||
mtbColtToPrint,
|
||||
onComplete,
|
||||
onFailed);
|
||||
@@ -1750,13 +1761,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.mColliMagazzinoRESTConsumer.saveCollo(this.mCurrentMtbColt, savedMtbColt -> {
|
||||
this.resetMatchedRows();
|
||||
this.sendLUOpened(this.mCurrentMtbColt);
|
||||
this.sendOnLoadingEnded();
|
||||
}, this::sendError);
|
||||
}
|
||||
|
||||
private void postCloseOperations(List<MtbColt> mtbColtList) {
|
||||
@@ -1846,49 +1861,85 @@ public class SpedizioneViewModel {
|
||||
|
||||
public void closeOrder() {
|
||||
this.sendOnLoadingStarted();
|
||||
if (SettingsManager.iDB().isFlagPrintEtichetteOnOrderClose() || SettingsManager.iDB().isFlagPrintPackingListOnOrderClose()) {
|
||||
this.sendOnCloseOrderPrintRequest(this::onCloseOrderPrintRequest);
|
||||
}
|
||||
}
|
||||
|
||||
Runnable onComplete = () -> this.sendOnLoadingEnded();
|
||||
|
||||
this.mPrinterRESTConsumer.getAvailablePrinters(mDefaultCodMdep, PrinterRESTConsumer.Type.PRIMARIA, printerList -> {
|
||||
|
||||
if (printerList == null || printerList.size() == 0) {
|
||||
this.sendError(new NoPrintersFoundException());
|
||||
onComplete.run();
|
||||
private void onCloseOrderPrintRequest(PrintOrderCloseDTO dto) {
|
||||
if (!dto.isFlagPrintPackingList() && !dto.isFlagPrintSSCC()) {
|
||||
this.sendOnOrderClosed();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
cyclicPrintPackingList(
|
||||
this.mTestateOrdini.iterator(),
|
||||
printerList.get(0),
|
||||
onComplete,
|
||||
ex -> this.sendLUPrintError(ex, onComplete));
|
||||
|
||||
}, this::sendError);
|
||||
|
||||
List<DtbOrdt> closedOrders = Stream.of(this.mTestateOrdini).map(ord -> {
|
||||
DtbOrdt ordV = new DtbOrdt();
|
||||
ordV.setDataOrd(ord.getDataOrdS())
|
||||
.setNumOrd(ord.getNumOrd())
|
||||
.setGestione(ord.getGestione())
|
||||
.setCodAnag(ord.getCodAnagOrd());
|
||||
return ordV;
|
||||
}).toList();
|
||||
dto.setPrintList(closedOrders);
|
||||
printClosedOrders(dto, this::sendOnOrderClosed, ex -> this.sendLUPrintError(ex, this::sendOnLoadingEnded));
|
||||
}
|
||||
|
||||
private void cyclicPrintPackingList(@NotNull Iterator<OrdineUscitaInevasoDTO> sourceTestateOrdineVenditaIterator, String printerName, Runnable onComplete, RunnableArgs<Exception> onAbort) {
|
||||
private void printClosedOrders(PrintOrderCloseDTO dto, Runnable onSuccess, RunnableArgs<Exception> onAbort) {
|
||||
|
||||
|
||||
this.mPrinterRESTConsumer.printClosedOrders(
|
||||
dto,
|
||||
SettingsManager.i().getUserSession().getDepo().getCodMdep(),
|
||||
onSuccess,
|
||||
onAbort);
|
||||
}
|
||||
|
||||
private void cyclicPrintPackingList(@NotNull Iterator<OrdineUscitaInevasoDTO> sourceTestateOrdineVenditaIterator, Runnable onComplete, RunnableArgs<Exception> onAbort) {
|
||||
if (sourceTestateOrdineVenditaIterator.hasNext()) {
|
||||
singlePrintPackingList(sourceTestateOrdineVenditaIterator.next(), printerName, () -> {
|
||||
cyclicPrintPackingList(sourceTestateOrdineVenditaIterator, printerName, onComplete, onAbort);
|
||||
singlePrintPackingList(sourceTestateOrdineVenditaIterator.next(), () -> {
|
||||
cyclicPrintPackingList(sourceTestateOrdineVenditaIterator, onComplete, onAbort);
|
||||
}, onAbort);
|
||||
} else {
|
||||
onComplete.run();
|
||||
}
|
||||
}
|
||||
|
||||
private void singlePrintPackingList(OrdineUscitaInevasoDTO ordineUscitaInevasoDTO, String printerName, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
private void cyclicPrintListEtichette(@NotNull Iterator<OrdineUscitaInevasoDTO> sourceTestateOrdineVenditaIterator, Runnable onComplete, RunnableArgs<Exception> onAbort) {
|
||||
if (sourceTestateOrdineVenditaIterator.hasNext()) {
|
||||
singlePrintListEtichette(sourceTestateOrdineVenditaIterator.next(), () -> {
|
||||
cyclicPrintListEtichette(sourceTestateOrdineVenditaIterator, onComplete, onAbort);
|
||||
}, onAbort);
|
||||
} else {
|
||||
onComplete.run();
|
||||
}
|
||||
}
|
||||
|
||||
private void singlePrintPackingList(OrdineUscitaInevasoDTO ordineUscitaInevasoDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
HashMap<String, Object> params = new HashMap<>();
|
||||
params.put("gestione", ordineUscitaInevasoDTO.getGestione());
|
||||
params.put("num_ord", ordineUscitaInevasoDTO.getNumOrd());
|
||||
params.put("data_ord", UtilityDate.formatDate(ordineUscitaInevasoDTO.getDataOrdD(), UtilityDate.COMMONS_DATE_FORMATS.YMD_DASH));
|
||||
|
||||
this.mPrinterRESTConsumer.printReport(
|
||||
printerName,
|
||||
this.mReportNameSpedizioneChiudiOrdine,
|
||||
this.mPrinterRESTConsumer.printReportType(
|
||||
ReportType.WMS_SPEDIZIONE_PACKING_LIST_ORD,
|
||||
SettingsManager.i().getUserSession().getDepo().getCodMdep(),
|
||||
ordineUscitaInevasoDTO.getCodAnagOrd(),
|
||||
params,
|
||||
onComplete,
|
||||
onFailed);
|
||||
|
||||
}
|
||||
|
||||
private void singlePrintListEtichette(OrdineUscitaInevasoDTO ordineUscitaInevasoDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
HashMap<String, Object> params = new HashMap<>();
|
||||
params.put("gestione", ordineUscitaInevasoDTO.getGestione());
|
||||
params.put("num_ord", ordineUscitaInevasoDTO.getNumOrd());
|
||||
params.put("data_ord", UtilityDate.formatDate(ordineUscitaInevasoDTO.getDataOrdD(), UtilityDate.COMMONS_DATE_FORMATS.YMD_DASH));
|
||||
|
||||
this.mPrinterRESTConsumer.printReportType(
|
||||
ReportType.WMS_SPEDIZIONE_ETICHETTE_SSCC_ORD,
|
||||
SettingsManager.i().getUserSession().getDepo().getCodMdep(),
|
||||
ordineUscitaInevasoDTO.getCodAnagOrd(),
|
||||
params,
|
||||
1,
|
||||
onComplete,
|
||||
onFailed);
|
||||
|
||||
@@ -1941,6 +1992,10 @@ public class SpedizioneViewModel {
|
||||
void onLUPositionChangeRequest(RunnableArgss<Boolean, MtbDepoPosizione> onComplete);
|
||||
|
||||
void onBatchLotSelectionRequest(List<MtbPartitaMag> availableBatchLots, RunnableArgs<MtbPartitaMag> onComplete);
|
||||
|
||||
void onCloseOrderPrintRequest(RunnableArgs<PrintOrderCloseDTO> onComplete);
|
||||
|
||||
void onOrderClosed();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package it.integry.integrywmsnative.gest.spedizione.dialogs.print_sscc_list;
|
||||
|
||||
import dagger.Subcomponent;
|
||||
|
||||
@Subcomponent
|
||||
public interface DialogPrintOrderSSCCListComponent {
|
||||
|
||||
@Subcomponent.Factory
|
||||
interface Factory {
|
||||
DialogPrintOrderSSCCListComponent create();
|
||||
}
|
||||
|
||||
void inject(DialogPrintOrderSSCCListView dialogPrintOrderSSCCListView);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package it.integry.integrywmsnative.gest.spedizione.dialogs.print_sscc_list;
|
||||
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
|
||||
@Module(subcomponents = DialogPrintOrderSSCCListComponent.class)
|
||||
public class DialogPrintOrderSSCCListModule {
|
||||
|
||||
|
||||
@Provides
|
||||
DialogPrintOrderSSCCListViewModel providesDialogPrintOrderSSCCListViewModel() {
|
||||
return new DialogPrintOrderSSCCListViewModel();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
package it.integry.integrywmsnative.gest.spedizione.dialogs.print_sscc_list;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.RadioGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import it.integry.integrywmsnative.MainApplication;
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||
import it.integry.integrywmsnative.databinding.DialogPrintOrderSsccListBinding;
|
||||
import it.integry.integrywmsnative.gest.spedizione.model.PrintOrderCloseDTO;
|
||||
|
||||
public class DialogPrintOrderSSCCListView extends BaseDialogFragment {
|
||||
|
||||
|
||||
@Inject
|
||||
DialogPrintOrderSSCCListViewModel mViewModel;
|
||||
|
||||
private Context mContext;
|
||||
private DialogPrintOrderSsccListBinding mBindings;
|
||||
private final PrintOrderCloseDTO printOrderCloseDTO;
|
||||
private final RunnableArgs<PrintOrderCloseDTO> onDialogClose;
|
||||
|
||||
|
||||
public static DialogPrintOrderSSCCListView newInstance(
|
||||
PrintOrderCloseDTO printOrderCloseDTO,
|
||||
RunnableArgs<PrintOrderCloseDTO> onDismiss
|
||||
) {
|
||||
return new DialogPrintOrderSSCCListView(printOrderCloseDTO, onDismiss);
|
||||
}
|
||||
|
||||
public DialogPrintOrderSSCCListView(@NotNull PrintOrderCloseDTO printOrderCloseDTO, @NotNull RunnableArgs<PrintOrderCloseDTO> onDismiss) {
|
||||
this.printOrderCloseDTO = printOrderCloseDTO;
|
||||
this.onDialogClose = onDismiss;
|
||||
}
|
||||
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
this.mContext = getActivity();
|
||||
|
||||
mBindings = DataBindingUtil.inflate(inflater, R.layout.dialog_print_order_sscc_list, container, false);
|
||||
|
||||
MainApplication.appComponent
|
||||
.dialogPrintOrderSSCCListComponent()
|
||||
.create()
|
||||
.inject(this);
|
||||
mBindings.setView(this);
|
||||
setCancelable(true);
|
||||
getDialog().setCanceledOnTouchOutside(true);
|
||||
getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||
|
||||
return mBindings.getRoot();
|
||||
}
|
||||
|
||||
public void onCheckChange(RadioGroup radioGroup, int id) {
|
||||
this.printOrderCloseDTO.setFlagSkipPrintedSSCC(id == mBindings.printOnlyNew.getId());
|
||||
}
|
||||
|
||||
public void onPositiveClick() {
|
||||
this.printOrderCloseDTO.setFlagPrintSSCC(true);
|
||||
this.dismiss();
|
||||
}
|
||||
|
||||
public void onNegativeClick() {
|
||||
this.printOrderCloseDTO.setFlagPrintSSCC(false);
|
||||
this.dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDismiss(@NonNull DialogInterface dialog) {
|
||||
this.onDialogClose.run(this.printOrderCloseDTO);
|
||||
super.onDismiss(dialog);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel(@NonNull DialogInterface dialog) {
|
||||
this.onNegativeClick();
|
||||
super.onCancel(dialog);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
if (this.printOrderCloseDTO.isFlagSkipPrintedSSCC()) {
|
||||
mBindings.printOnlyNew.setChecked(true);
|
||||
} else {
|
||||
mBindings.printAll.setChecked(true);
|
||||
}
|
||||
super.onStart();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onError(Exception ex) {
|
||||
UtilityExceptions.defaultException(this.mContext, ex);
|
||||
dismiss();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package it.integry.integrywmsnative.gest.spedizione.dialogs.print_sscc_list;
|
||||
|
||||
public class DialogPrintOrderSSCCListViewModel {
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package it.integry.integrywmsnative.gest.spedizione.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.DtbOrdt;
|
||||
|
||||
public class PrintOrderCloseDTO {
|
||||
private boolean flagPrintPackingList = false;
|
||||
private boolean flagPrintSSCC = false;
|
||||
private boolean flagSkipPrintedSSCC = true;
|
||||
private List<DtbOrdt> printList;
|
||||
|
||||
public boolean isFlagPrintPackingList() {
|
||||
return flagPrintPackingList;
|
||||
}
|
||||
|
||||
public PrintOrderCloseDTO setFlagPrintPackingList(boolean flagPrintPackingList) {
|
||||
this.flagPrintPackingList = flagPrintPackingList;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isFlagPrintSSCC() {
|
||||
return flagPrintSSCC;
|
||||
}
|
||||
|
||||
public PrintOrderCloseDTO setFlagPrintSSCC(boolean flagPrintSSCC) {
|
||||
this.flagPrintSSCC = flagPrintSSCC;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isFlagSkipPrintedSSCC() {
|
||||
return flagSkipPrintedSSCC;
|
||||
}
|
||||
|
||||
public PrintOrderCloseDTO setFlagSkipPrintedSSCC(boolean flagSkipPrintedSSCC) {
|
||||
this.flagSkipPrintedSSCC = flagSkipPrintedSSCC;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<DtbOrdt> getPrintList() {
|
||||
return printList;
|
||||
}
|
||||
|
||||
public PrintOrderCloseDTO setPrintList(List<DtbOrdt> printList) {
|
||||
this.printList = printList;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user