Compare commits
36 Commits
v1.20.0(24
...
v1.22.0(25
| Author | SHA1 | Date | |
|---|---|---|---|
| 981a42cd7e | |||
| 062938d0e4 | |||
| cc7044c7de | |||
| 7d771bf39b | |||
| 3261aa7c41 | |||
| d79c13b370 | |||
| 55c1cb40a2 | |||
| d570ab7e3d | |||
| e3ebfcb27d | |||
| 2230dade45 | |||
| 637e46b868 | |||
| 473d5d1a5a | |||
| c37f4d62a4 | |||
| b8ac75ed6d | |||
| df9d3a80ac | |||
| 6aacaef720 | |||
| 1fab62187f | |||
| 0c4d0f2b59 | |||
| dbf183c7c6 | |||
| 42649cd5bb | |||
| 1f1a8f75de | |||
| 5215d43bf4 | |||
| d2f262a9b8 | |||
| 1fc78d053b | |||
| 016be4799c | |||
| e837132996 | |||
| 925760720d | |||
| 2e872c23aa | |||
| 7a62c8855f | |||
| c1da07b23c | |||
| ba7e2a6d61 | |||
| e798db1427 | |||
| a79dee3574 | |||
| 4f753399bf | |||
| 80842e49e5 | |||
| 2eac741bbb |
@@ -6,8 +6,8 @@ apply plugin: 'com.google.gms.google-services'
|
|||||||
|
|
||||||
android {
|
android {
|
||||||
|
|
||||||
def appVersionCode = 247
|
def appVersionCode = 254
|
||||||
def appVersionName = '1.20.0'
|
def appVersionName = '1.22.0'
|
||||||
|
|
||||||
signingConfigs {
|
signingConfigs {
|
||||||
release {
|
release {
|
||||||
@@ -134,7 +134,6 @@ dependencies {
|
|||||||
implementation 'com.github.cachapa:ExpandableLayout:2.9.2'
|
implementation 'com.github.cachapa:ExpandableLayout:2.9.2'
|
||||||
implementation 'com.github.frankiesardo:linearlistview:1.0.1@aar'
|
implementation 'com.github.frankiesardo:linearlistview:1.0.1@aar'
|
||||||
implementation 'com.github.fede87:StatusBarAlert:1.0.1'
|
implementation 'com.github.fede87:StatusBarAlert:1.0.1'
|
||||||
implementation 'com.github.akshay2211:Stash:master'
|
|
||||||
testImplementation 'junit:junit:4.13.2'
|
testImplementation 'junit:junit:4.13.2'
|
||||||
implementation 'com.github.zhukic:sectioned-recyclerview:1.2.3'
|
implementation 'com.github.zhukic:sectioned-recyclerview:1.2.3'
|
||||||
implementation 'com.github.pedromassango:doubleClick:3.0'
|
implementation 'com.github.pedromassango:doubleClick:3.0'
|
||||||
|
|||||||
@@ -11,14 +11,16 @@ import it.integry.integrywmsnative.gest.accettazione_picking.AccettazionePicking
|
|||||||
import it.integry.integrywmsnative.gest.accettazione_picking.AccettazionePickingModule;
|
import it.integry.integrywmsnative.gest.accettazione_picking.AccettazionePickingModule;
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.DocInterniComponent;
|
import it.integry.integrywmsnative.gest.contab_doc_interni.DocInterniComponent;
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.DocInterniModule;
|
import it.integry.integrywmsnative.gest.contab_doc_interni.DocInterniModule;
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dialog.DialogSelectMgrpDtipPairComponent;
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dialog.DialogSelectDocInfoComponent;
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dialog.DialogSelectMgrpDtipPairModule;
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dialog.DialogSelectDocInfoModule;
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.DocInterniEditFormComponent;
|
import it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.DocInterniEditFormComponent;
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.DocInterniEditFormModule;
|
import it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.DocInterniEditFormModule;
|
||||||
import it.integry.integrywmsnative.gest.contenuto_bancale.ContenutoBancaleComponent;
|
import it.integry.integrywmsnative.gest.contenuto_bancale.ContenutoBancaleComponent;
|
||||||
import it.integry.integrywmsnative.gest.contenuto_bancale.ContenutoBancaleModule;
|
import it.integry.integrywmsnative.gest.contenuto_bancale.ContenutoBancaleModule;
|
||||||
import it.integry.integrywmsnative.gest.lista_bancali.ListaBancaliComponent;
|
import it.integry.integrywmsnative.gest.lista_bancali.ListaBancaliComponent;
|
||||||
import it.integry.integrywmsnative.gest.lista_bancali.ListaBancaliModule;
|
import it.integry.integrywmsnative.gest.lista_bancali.ListaBancaliModule;
|
||||||
|
import it.integry.integrywmsnative.gest.login.LoginComponent;
|
||||||
|
import it.integry.integrywmsnative.gest.login.LoginModule;
|
||||||
import it.integry.integrywmsnative.gest.main.MainActivityComponent;
|
import it.integry.integrywmsnative.gest.main.MainActivityComponent;
|
||||||
import it.integry.integrywmsnative.gest.main.MainActivityModule;
|
import it.integry.integrywmsnative.gest.main.MainActivityModule;
|
||||||
import it.integry.integrywmsnative.gest.main.MainFragmentComponent;
|
import it.integry.integrywmsnative.gest.main.MainFragmentComponent;
|
||||||
@@ -76,6 +78,7 @@ import it.integry.integrywmsnative.view.dialogs.scan_or_create_lu.DialogScanOrCr
|
|||||||
RoomModule.class,
|
RoomModule.class,
|
||||||
SplashActivityModule.class,
|
SplashActivityModule.class,
|
||||||
MainApplicationModule.class,
|
MainApplicationModule.class,
|
||||||
|
LoginModule.class,
|
||||||
MainActivityModule.class,
|
MainActivityModule.class,
|
||||||
MainFragmentModule.class,
|
MainFragmentModule.class,
|
||||||
MainAccettazioneModule.class,
|
MainAccettazioneModule.class,
|
||||||
@@ -105,12 +108,13 @@ import it.integry.integrywmsnative.view.dialogs.scan_or_create_lu.DialogScanOrCr
|
|||||||
ProdVersamentoMaterialeModule.class,
|
ProdVersamentoMaterialeModule.class,
|
||||||
DialogChooseArtsFromListaArtsModule.class,
|
DialogChooseArtsFromListaArtsModule.class,
|
||||||
DocInterniModule.class,
|
DocInterniModule.class,
|
||||||
DialogSelectMgrpDtipPairModule.class,
|
DialogSelectDocInfoModule.class,
|
||||||
DocInterniEditFormModule.class
|
DocInterniEditFormModule.class
|
||||||
})
|
})
|
||||||
public interface MainApplicationComponent {
|
public interface MainApplicationComponent {
|
||||||
|
|
||||||
SplashActivityComponent.Factory splashActivityComponent();
|
SplashActivityComponent.Factory splashActivityComponent();
|
||||||
|
LoginComponent.Factory loginActivityComponent();
|
||||||
MainActivityComponent.Factory mainActivityComponent();
|
MainActivityComponent.Factory mainActivityComponent();
|
||||||
MainFragmentComponent.Factory mainFragmentComponent();
|
MainFragmentComponent.Factory mainFragmentComponent();
|
||||||
MainAccettazioneComponent.Factory mainAccettazioneComponent();
|
MainAccettazioneComponent.Factory mainAccettazioneComponent();
|
||||||
@@ -142,7 +146,7 @@ public interface MainApplicationComponent {
|
|||||||
ProdVersamentoMaterialeComponent.Factory prodVersamentoMaterialeComponent();
|
ProdVersamentoMaterialeComponent.Factory prodVersamentoMaterialeComponent();
|
||||||
DialogChooseArtsFromListaArtsComponent.Factory dialogChooseArtsFromListaArtsComponent();
|
DialogChooseArtsFromListaArtsComponent.Factory dialogChooseArtsFromListaArtsComponent();
|
||||||
DocInterniComponent.Factory docInterniComponent();
|
DocInterniComponent.Factory docInterniComponent();
|
||||||
DialogSelectMgrpDtipPairComponent.Factory dialogSelectMgrpDtipPairComponent();
|
DialogSelectDocInfoComponent.Factory dialogSelectMgrpDtipPairComponent();
|
||||||
DocInterniEditFormComponent.Factory docInterniEditFormComponent();
|
DocInterniEditFormComponent.Factory docInterniEditFormComponent();
|
||||||
|
|
||||||
void inject(MainApplication mainApplication);
|
void inject(MainApplication mainApplication);
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package it.integry.integrywmsnative;
|
package it.integry.integrywmsnative;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.PackageInfo;
|
import android.content.pm.PackageInfo;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
@@ -38,6 +39,12 @@ public class SplashActivity extends BaseActivity implements MainContext.Listener
|
|||||||
|
|
||||||
private RunnableArgsss<Integer, String[], List<Integer>> onRequestPermissionResult;
|
private RunnableArgsss<Integer, String[], List<Integer>> onRequestPermissionResult;
|
||||||
|
|
||||||
|
public static void startActivity(Context context) {
|
||||||
|
Intent intent = new Intent(context, SplashActivity.class);
|
||||||
|
context.startActivity(intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import it.integry.integrywmsnative.gest.picking_libero.PickingLiberoFragment;
|
|||||||
import it.integry.integrywmsnative.gest.prod_accettazione_ord_produzione.ProdOrdineProduzioneElencoFragment;
|
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_fabbisogno_linee_prod.ProdFabbisognoLineeProdFragment;
|
||||||
import it.integry.integrywmsnative.gest.prod_recupero_materiale.ProdRecuperoMaterialeFragment;
|
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;
|
import it.integry.integrywmsnative.gest.prod_versamento_materiale.ProdVersamentoMaterialeFragment;
|
||||||
import it.integry.integrywmsnative.gest.pv_ordini_acquisto.PVOrdiniAcquistoGrigliaFragment;
|
import it.integry.integrywmsnative.gest.pv_ordini_acquisto.PVOrdiniAcquistoGrigliaFragment;
|
||||||
import it.integry.integrywmsnative.gest.rettifica_giacenze.RettificaGiacenzeFragment;
|
import it.integry.integrywmsnative.gest.rettifica_giacenze.RettificaGiacenzeFragment;
|
||||||
@@ -124,6 +125,14 @@ public class MenuConfiguration extends BaseMenuConfiguration {
|
|||||||
.setTitleIcon(R.drawable.ic_dashboard_prod_recupero_materiale)
|
.setTitleIcon(R.drawable.ic_dashboard_prod_recupero_materiale)
|
||||||
.setDrawerIcon(R.drawable.ic_black_external)
|
.setDrawerIcon(R.drawable.ic_black_external)
|
||||||
.setFragmentFactory(ProdRecuperoMaterialeFragment::newInstance))
|
.setFragmentFactory(ProdRecuperoMaterialeFragment::newInstance))
|
||||||
|
|
||||||
|
.addItem(new MenuItem()
|
||||||
|
.setID(it.integry.integrywmsnative.R.id.nav_prod_rientro_merce)
|
||||||
|
.setCodMenu("MG059")
|
||||||
|
.setTitleText(it.integry.integrywmsnative.R.string.rientro_merce_fragment_title)
|
||||||
|
.setTitleIcon(it.integry.integrywmsnative.R.drawable.ic_dashboard_prod_accettazione_produzione)
|
||||||
|
.setDrawerIcon(it.integry.integrywmsnative.R.drawable.ic_black_external)
|
||||||
|
.setFragmentFactory(ProdRientroMerceFragment::newInstance))
|
||||||
).addGroup(
|
).addGroup(
|
||||||
new MenuGroup()
|
new MenuGroup()
|
||||||
.setGroupText(R.string.internal_handling)
|
.setGroupText(R.string.internal_handling)
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import it.integry.integrywmsnative.core.data_store.db.entity.Ordine;
|
|||||||
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColr;
|
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColr;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColt;
|
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColt;
|
||||||
|
|
||||||
@Database(entities = {ArticoloGriglia.class, Griglia.class, Ordine.class, ArticoloOrdine.class, SqlMtbColt.class, SqlMtbColr.class}, version = 4, exportSchema = false)
|
@Database(entities = {ArticoloGriglia.class, Griglia.class, Ordine.class, ArticoloOrdine.class, SqlMtbColt.class, SqlMtbColr.class}, version = 5, exportSchema = false)
|
||||||
@TypeConverters({
|
@TypeConverters({
|
||||||
DateConverter.class
|
DateConverter.class
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import androidx.room.Insert;
|
|||||||
import androidx.room.Query;
|
import androidx.room.Query;
|
||||||
import androidx.room.Update;
|
import androidx.room.Update;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.data_store.db.entity.Ordine;
|
import it.integry.integrywmsnative.core.data_store.db.entity.Ordine;
|
||||||
@@ -28,8 +29,14 @@ public interface MtbColtDao {
|
|||||||
@Delete
|
@Delete
|
||||||
void delete(SqlMtbColt mtbColt);
|
void delete(SqlMtbColt mtbColt);
|
||||||
|
|
||||||
@Query("SELECT mtb_colt.*, count(mtb_colr.id) as countArticoli from mtb_colt left outer join mtb_colr on (mtb_colr.id_collo = mtb_colt.id) where cod_dtip_provv = :codDtip AND cod_mgrp = :codMgrp and cod_dtip is null group by mtb_colt.id")
|
@Query("SELECT mtb_colt.*, count(mtb_colr.id) as countArticoli from mtb_colt left outer join mtb_colr on (mtb_colr.id_collo = mtb_colt.id) where" +
|
||||||
List<DocInternoWrapper> getLocalDocumentsByCodDtipAndCodMgrp(String codDtip, String codMgrp);
|
" cod_dtip_provv = :codDtip " +
|
||||||
|
" AND ( cod_anag = :codAnag OR (cod_anag is null and :codAnag is null)) " +
|
||||||
|
" AND ( cod_vdes = :codVdes OR (cod_vdes is null and :codVdes is null)) " +
|
||||||
|
" AND ( mtb_colt.data_doc = :dataDoc OR (mtb_colt.data_doc is null and :dataDoc is null)) " +
|
||||||
|
" AND ( mtb_colt.num_doc = :numDoc OR (mtb_colt.num_doc is null and :numDoc is null)) " +
|
||||||
|
" and cod_dtip is null group by mtb_colt.id")
|
||||||
|
List<DocInternoWrapper> getLocalDocumentsByCodDtip(String codDtip, String codAnag, String codVdes, Date dataDoc, String numDoc);
|
||||||
|
|
||||||
@Query("SELECT ifnull(MAX(num_collo),0) +1 as num_collo from mtb_colt")
|
@Query("SELECT ifnull(MAX(num_collo),0) +1 as num_collo from mtb_colt")
|
||||||
Integer getNextNumCollo();
|
Integer getNextNumCollo();
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import androidx.room.ForeignKey;
|
|||||||
import androidx.room.Index;
|
import androidx.room.Index;
|
||||||
import androidx.room.PrimaryKey;
|
import androidx.room.PrimaryKey;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||||
|
|
||||||
@Entity(
|
@Entity(
|
||||||
@@ -54,6 +56,18 @@ public class ArticoloGriglia {
|
|||||||
@ColumnInfo(name = "qta_min_ordinabile")
|
@ColumnInfo(name = "qta_min_ordinabile")
|
||||||
private float qtaMinOrdinabile;
|
private float qtaMinOrdinabile;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "gg_scadenza")
|
||||||
|
private int ggScadenza;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "giacenza")
|
||||||
|
private float giacenza;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "qta_prevista_vendita")
|
||||||
|
private float qtaPrevistaVendita;
|
||||||
|
|
||||||
|
@ColumnInfo(name = "qta_proposta")
|
||||||
|
private float qtaProposta;
|
||||||
|
|
||||||
@ColumnInfo(name = "id_griglia")
|
@ColumnInfo(name = "id_griglia")
|
||||||
private int idGriglia;
|
private int idGriglia;
|
||||||
|
|
||||||
@@ -145,6 +159,38 @@ public class ArticoloGriglia {
|
|||||||
this.idGriglia = idGriglia;
|
this.idGriglia = idGriglia;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getGgScadenza() {
|
||||||
|
return ggScadenza;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGgScadenza(int ggScadenza) {
|
||||||
|
this.ggScadenza = ggScadenza;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getGiacenza() {
|
||||||
|
return giacenza;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGiacenza(float giacenza) {
|
||||||
|
this.giacenza = giacenza;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getQtaPrevistaVendita() {
|
||||||
|
return qtaPrevistaVendita;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQtaPrevistaVendita(float qtaPrevistaVendita) {
|
||||||
|
this.qtaPrevistaVendita = qtaPrevistaVendita;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getQtaProposta() {
|
||||||
|
return qtaProposta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQtaProposta(float qtaProposta) {
|
||||||
|
this.qtaProposta = qtaProposta;
|
||||||
|
}
|
||||||
|
|
||||||
public ArticoloOrdine convertToArticoloOrdine(Ordine ordine) {
|
public ArticoloOrdine convertToArticoloOrdine(Ordine ordine) {
|
||||||
ArticoloOrdine articolo = new ArticoloOrdine();
|
ArticoloOrdine articolo = new ArticoloOrdine();
|
||||||
|
|
||||||
@@ -160,6 +206,11 @@ public class ArticoloGriglia {
|
|||||||
articolo.setUntMis(this.getUntMis());
|
articolo.setUntMis(this.getUntMis());
|
||||||
articolo.setDescrizione(this.getDescrizione());
|
articolo.setDescrizione(this.getDescrizione());
|
||||||
articolo.setDataIns(UtilityDate.getDateInstance());
|
articolo.setDataIns(UtilityDate.getDateInstance());
|
||||||
|
articolo.setGgScadenza(this.getGgScadenza());
|
||||||
|
articolo.setGiacenza(BigDecimal.valueOf(this.getGiacenza()));
|
||||||
|
articolo.setQtaPrevistaVendita(BigDecimal.valueOf(this.getQtaPrevistaVendita()));
|
||||||
|
articolo.setQtaProposta(BigDecimal.valueOf(this.getQtaProposta()));
|
||||||
|
|
||||||
articolo.setQtaOrd(0);
|
articolo.setQtaOrd(0);
|
||||||
|
|
||||||
return articolo;
|
return articolo;
|
||||||
|
|||||||
@@ -3,16 +3,19 @@ package it.integry.integrywmsnative.core.data_store.db.entity;
|
|||||||
import androidx.room.ColumnInfo;
|
import androidx.room.ColumnInfo;
|
||||||
import androidx.room.Entity;
|
import androidx.room.Entity;
|
||||||
import androidx.room.ForeignKey;
|
import androidx.room.ForeignKey;
|
||||||
|
import androidx.room.Ignore;
|
||||||
import androidx.room.Index;
|
import androidx.room.Index;
|
||||||
import androidx.room.PrimaryKey;
|
import androidx.room.PrimaryKey;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
@Entity(
|
@Entity(
|
||||||
tableName = "articoli_ordine",
|
tableName = "articoli_ordine",
|
||||||
indices = {
|
indices = {
|
||||||
@Index(value = "id_ordine"),
|
@Index(value = "id_ordine"),
|
||||||
@Index(value = {"id_ordine","cod_mart"}, unique = true)
|
@Index(value = {"id_ordine", "cod_mart"}, unique = true)
|
||||||
},
|
},
|
||||||
foreignKeys = {
|
foreignKeys = {
|
||||||
@ForeignKey(
|
@ForeignKey(
|
||||||
@@ -22,7 +25,7 @@ import java.util.Date;
|
|||||||
onDelete = ForeignKey.CASCADE
|
onDelete = ForeignKey.CASCADE
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
public class ArticoloOrdine {
|
public class ArticoloOrdine {
|
||||||
@PrimaryKey(autoGenerate = true)
|
@PrimaryKey(autoGenerate = true)
|
||||||
@ColumnInfo(name = "articolo_ordine_id")
|
@ColumnInfo(name = "articolo_ordine_id")
|
||||||
@@ -64,6 +67,20 @@ public class ArticoloOrdine {
|
|||||||
@ColumnInfo(name = "data_ins")
|
@ColumnInfo(name = "data_ins")
|
||||||
private Date dataIns;
|
private Date dataIns;
|
||||||
|
|
||||||
|
|
||||||
|
@Ignore
|
||||||
|
private int ggScadenza = 0;
|
||||||
|
|
||||||
|
@Ignore
|
||||||
|
private BigDecimal giacenza = BigDecimal.ZERO;
|
||||||
|
|
||||||
|
@Ignore
|
||||||
|
private BigDecimal qtaPrevistaVendita = BigDecimal.ZERO;
|
||||||
|
|
||||||
|
@Ignore
|
||||||
|
private BigDecimal qtaProposta = BigDecimal.ZERO;
|
||||||
|
|
||||||
|
|
||||||
public int getArticoloOrdineId() {
|
public int getArticoloOrdineId() {
|
||||||
return articoloOrdineId;
|
return articoloOrdineId;
|
||||||
}
|
}
|
||||||
@@ -167,4 +184,51 @@ public class ArticoloOrdine {
|
|||||||
public void setDataIns(Date dataIns) {
|
public void setDataIns(Date dataIns) {
|
||||||
this.dataIns = dataIns;
|
this.dataIns = dataIns;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getGgScadenza() {
|
||||||
|
return ggScadenza;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArticoloOrdine setGgScadenza(int ggScadenza) {
|
||||||
|
this.ggScadenza = ggScadenza;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getGiacenza() {
|
||||||
|
return giacenza;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArticoloOrdine setGiacenza(BigDecimal giacenza) {
|
||||||
|
this.giacenza = giacenza;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getQtaPrevistaVendita() {
|
||||||
|
return qtaPrevistaVendita;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArticoloOrdine setQtaPrevistaVendita(BigDecimal qtaPrevistaVendita) {
|
||||||
|
this.qtaPrevistaVendita = qtaPrevistaVendita;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getQtaProposta() {
|
||||||
|
return qtaProposta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArticoloOrdine setQtaProposta(BigDecimal qtaProposta) {
|
||||||
|
this.qtaProposta = qtaProposta;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getQtaCnfPrevistaVendita(){
|
||||||
|
return qtaPrevistaVendita.equals(BigDecimal.ZERO) ? BigDecimal.ZERO : qtaPrevistaVendita.divide(BigDecimal.valueOf(qtaCnf),0, RoundingMode.CEILING);
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getQtaCnfProposta(){
|
||||||
|
return qtaProposta.equals(BigDecimal.ZERO) ? BigDecimal.ZERO : qtaProposta.divide(BigDecimal.valueOf(qtaCnf),0, RoundingMode.CEILING);
|
||||||
|
}
|
||||||
|
public BigDecimal getQtaCnfGiacenza(){
|
||||||
|
return giacenza.equals(BigDecimal.ZERO) ? BigDecimal.ZERO : giacenza.divide(BigDecimal.valueOf(qtaCnf),0, RoundingMode.CEILING);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package it.integry.integrywmsnative.core.data_store.db.repository;
|
package it.integry.integrywmsnative.core.data_store.db.repository;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.data_store.db.entity.Griglia;
|
import it.integry.integrywmsnative.core.data_store.db.entity.Griglia;
|
||||||
@@ -20,7 +21,7 @@ public interface MtbColtRepository {
|
|||||||
|
|
||||||
void delete(SqlMtbColt mtbColt, Runnable onSuccess, RunnableArgs<Exception> onError);
|
void delete(SqlMtbColt mtbColt, Runnable onSuccess, RunnableArgs<Exception> onError);
|
||||||
|
|
||||||
void getLocalDocumentsByCodDtipAndCodMgrp(String codDtip, String codMgrp, RunnableArgs<List<DocInternoWrapper>> onSuccess, RunnableArgs<Exception> onError);
|
void getLocalDocumentsByCodDtip(String codDtip, String codAnag, String codVdes, Date dataDoc, String numDoc, RunnableArgs<List<DocInternoWrapper>> onSuccess, RunnableArgs<Exception> onError);
|
||||||
|
|
||||||
void getNextNumCollo(RunnableArgs<Integer> onSuccess, RunnableArgs<Exception> onError);
|
void getNextNumCollo(RunnableArgs<Integer> onSuccess, RunnableArgs<Exception> onError);
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package it.integry.integrywmsnative.core.data_store.db.repository.implementations;
|
package it.integry.integrywmsnative.core.data_store.db.repository.implementations;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
@@ -65,10 +66,10 @@ public class SqlMtbColtDataSource extends Repository implements MtbColtRepositor
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getLocalDocumentsByCodDtipAndCodMgrp(String codDtip, String codMgrp, RunnableArgs<List<DocInternoWrapper>> onSuccess, RunnableArgs<Exception> onError) {
|
public void getLocalDocumentsByCodDtip(String codDtip, String codAnag, String codVdes, Date dataDoc, String numDoc, RunnableArgs<List<DocInternoWrapper>> onSuccess, RunnableArgs<Exception> onError) {
|
||||||
Runnable query = () -> {
|
Runnable query = () -> {
|
||||||
try {
|
try {
|
||||||
onSuccess.run(mMtbColtDao.getLocalDocumentsByCodDtipAndCodMgrp(codDtip,codMgrp));
|
onSuccess.run(mMtbColtDao.getLocalDocumentsByCodDtip(codDtip,codAnag,codVdes,dataDoc,numDoc));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
onError.run(e);
|
onError.run(e);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,34 +1,38 @@
|
|||||||
package it.integry.integrywmsnative.core.data_store.db.view_model;
|
package it.integry.integrywmsnative.core.data_store.db.view_model;
|
||||||
|
|
||||||
|
import androidx.room.ColumnInfo;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.data_store.db.entity.ArticoloGriglia;
|
import it.integry.integrywmsnative.core.data_store.db.entity.ArticoloGriglia;
|
||||||
|
|
||||||
public class ArticoloDTO {
|
public class ArticoloDTO {
|
||||||
|
|
||||||
private String codMart;
|
private String codMart;
|
||||||
|
|
||||||
|
|
||||||
private String descrizione;
|
private String descrizione;
|
||||||
|
|
||||||
|
|
||||||
private String untMis;
|
private String untMis;
|
||||||
|
|
||||||
|
|
||||||
private float qtaCnf;
|
|
||||||
|
|
||||||
|
|
||||||
private String barcode;
|
private String barcode;
|
||||||
|
|
||||||
|
|
||||||
private float merceDaRic;
|
|
||||||
|
|
||||||
|
|
||||||
private float mediaSett;
|
|
||||||
|
|
||||||
|
|
||||||
private String flagQtaMultipla;
|
private String flagQtaMultipla;
|
||||||
|
|
||||||
|
private float qtaCnf;
|
||||||
|
|
||||||
|
private float merceDaRic;
|
||||||
|
|
||||||
|
private float mediaSett;
|
||||||
|
|
||||||
private float qtaMinOrdinabile;
|
private float qtaMinOrdinabile;
|
||||||
|
|
||||||
|
private int ggScadenza;
|
||||||
|
|
||||||
|
private float giacenza;
|
||||||
|
|
||||||
|
private float qtaPrevistaVendita;
|
||||||
|
|
||||||
|
private float qtaProposta;
|
||||||
|
|
||||||
|
|
||||||
public String getCodMart() {
|
public String getCodMart() {
|
||||||
return codMart;
|
return codMart;
|
||||||
}
|
}
|
||||||
@@ -101,8 +105,47 @@ public class ArticoloDTO {
|
|||||||
this.qtaMinOrdinabile = qtaMinOrdinabile;
|
this.qtaMinOrdinabile = qtaMinOrdinabile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getBarcode() {
|
||||||
|
return barcode;
|
||||||
|
}
|
||||||
|
|
||||||
public ArticoloGriglia toArticoloGriglia(){
|
public void setBarcode(String barcode) {
|
||||||
|
this.barcode = barcode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getGgScadenza() {
|
||||||
|
return ggScadenza;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGgScadenza(int ggScadenza) {
|
||||||
|
this.ggScadenza = ggScadenza;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getGiacenza() {
|
||||||
|
return giacenza;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGiacenza(float giacenza) {
|
||||||
|
this.giacenza = giacenza;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getQtaPrevistaVendita() {
|
||||||
|
return qtaPrevistaVendita;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQtaPrevistaVendita(float qtaPrevistaVendita) {
|
||||||
|
this.qtaPrevistaVendita = qtaPrevistaVendita;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getQtaProposta() {
|
||||||
|
return qtaProposta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQtaProposta(float qtaProposta) {
|
||||||
|
this.qtaProposta = qtaProposta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArticoloGriglia toArticoloGriglia() {
|
||||||
ArticoloGriglia result = new ArticoloGriglia();
|
ArticoloGriglia result = new ArticoloGriglia();
|
||||||
result.setBarCode(this.getBarCode());
|
result.setBarCode(this.getBarCode());
|
||||||
result.setDescrizione(this.getDescrizione());
|
result.setDescrizione(this.getDescrizione());
|
||||||
@@ -113,6 +156,10 @@ public class ArticoloDTO {
|
|||||||
result.setMediaSett(this.getMediaSett());
|
result.setMediaSett(this.getMediaSett());
|
||||||
result.setFlagQtaMultipla(this.getFlagQtaMultipla());
|
result.setFlagQtaMultipla(this.getFlagQtaMultipla());
|
||||||
result.setQtaMinOrdinabile(this.getQtaMinOrdinabile());
|
result.setQtaMinOrdinabile(this.getQtaMinOrdinabile());
|
||||||
|
result.setGgScadenza(this.ggScadenza);
|
||||||
|
result.setGiacenza(this.giacenza);
|
||||||
|
result.setQtaPrevistaVendita(this.qtaPrevistaVendita);
|
||||||
|
result.setQtaProposta(this.qtaProposta);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import androidx.databinding.PropertyChangeRegistry;
|
|||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
|
|
||||||
public class BindableBigDecimal implements Observable {
|
public class BindableBigDecimal implements Observable {
|
||||||
|
|
||||||
BigDecimal mValue;
|
BigDecimal mValue;
|
||||||
@@ -102,9 +104,24 @@ public class BindableBigDecimal implements Observable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void set(BigDecimal value, boolean forceRefresh) {
|
public void set(BigDecimal value, boolean forceRefresh) {
|
||||||
if (!mValue.equals(value) || forceRefresh) {
|
if ((mValue == null) || !mValue.equals(value) || forceRefresh) {
|
||||||
this.mValue = value;
|
this.mValue = value;
|
||||||
notifyChange();
|
notifyChange();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void registerListener(BindableBigDecimal bindableBigDecimal, RunnableArgs<BigDecimal> onValueChanged) {
|
||||||
|
bindableBigDecimal.addOnPropertyChangedCallback(new OnPropertyChangedCallback() {
|
||||||
|
@Override
|
||||||
|
public void onPropertyChanged(Observable sender, int propertyId) {
|
||||||
|
if(onValueChanged != null) onValueChanged.run(bindableBigDecimal.get());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void resetListeners(BindableBigDecimal bindableBigDecimal){
|
||||||
|
BigDecimal oldValue = bindableBigDecimal.get();
|
||||||
|
bindableBigDecimal = new BindableBigDecimal();
|
||||||
|
bindableBigDecimal.set(oldValue);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
package it.integry.integrywmsnative.core.di;
|
package it.integry.integrywmsnative.core.di;
|
||||||
|
|
||||||
import androidx.databinding.BaseObservable;
|
import androidx.databinding.BaseObservable;
|
||||||
|
import androidx.databinding.Observable;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
|
|
||||||
public class BindableInteger extends BaseObservable {
|
public class BindableInteger extends BaseObservable {
|
||||||
Integer mValue;
|
Integer mValue;
|
||||||
@@ -34,4 +37,19 @@ public class BindableInteger extends BaseObservable {
|
|||||||
return mValue == null;
|
return mValue == null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void registerListener(BindableInteger bindableInteger, RunnableArgs<Integer> onValueChanged) {
|
||||||
|
bindableInteger.addOnPropertyChangedCallback(new OnPropertyChangedCallback() {
|
||||||
|
@Override
|
||||||
|
public void onPropertyChanged(Observable sender, int propertyId) {
|
||||||
|
if(onValueChanged != null) onValueChanged.run(bindableInteger.get());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void resetListeners(BindableInteger bindableInteger){
|
||||||
|
Integer oldValue = bindableInteger.get();
|
||||||
|
bindableInteger = new BindableInteger();
|
||||||
|
bindableInteger.set(oldValue);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ public class Converters {
|
|||||||
|
|
||||||
@BindingConversion
|
@BindingConversion
|
||||||
public static String convertBindableToString(BindableString bindableString) {
|
public static String convertBindableToString(BindableString bindableString) {
|
||||||
if(bindableString != null) return bindableString.get();
|
if (bindableString != null) return bindableString.get();
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,7 +76,8 @@ public class Converters {
|
|||||||
TextWatcherAdapter watcher = new TextWatcherAdapter() {
|
TextWatcherAdapter watcher = new TextWatcherAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||||
if(bindableInteger != null) bindableInteger.set(Integer.parseInt(s.toString()));
|
if (bindableInteger != null)
|
||||||
|
bindableInteger.set(Integer.parseInt(s.toString()));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
view.setTag(R.id.bound_observable, new Pair<>(bindableInteger, watcher));
|
view.setTag(R.id.bound_observable, new Pair<>(bindableInteger, watcher));
|
||||||
@@ -98,7 +99,7 @@ public class Converters {
|
|||||||
TextWatcherAdapter watcher = new TextWatcherAdapter() {
|
TextWatcherAdapter watcher = new TextWatcherAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||||
if(observableField != null) observableField.set(s.toString());
|
if (observableField != null) observableField.set(s.toString());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
view.setTag(R.id.bound_observable, new Pair<>(observableField, watcher));
|
view.setTag(R.id.bound_observable, new Pair<>(observableField, watcher));
|
||||||
@@ -210,7 +211,8 @@ public class Converters {
|
|||||||
@Override
|
@Override
|
||||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||||
BigDecimal value = null;
|
BigDecimal value = null;
|
||||||
if(!UtilityString.isNullOrEmpty(s.toString())) value = new BigDecimal(s.toString());
|
if (!UtilityString.isNullOrEmpty(s.toString()))
|
||||||
|
value = new BigDecimal(s.toString());
|
||||||
observableBigDecimal.set(value);
|
observableBigDecimal.set(value);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -220,11 +222,65 @@ public class Converters {
|
|||||||
BigDecimal newValue = observableBigDecimal.get();
|
BigDecimal newValue = observableBigDecimal.get();
|
||||||
BigDecimal viewValue = view.getText().toString().trim().length() > 0 ? new BigDecimal(view.getText().toString()) : null;
|
BigDecimal viewValue = view.getText().toString().trim().length() > 0 ? new BigDecimal(view.getText().toString()) : null;
|
||||||
|
|
||||||
if(!UtilityBigDecimal.equalsTo(viewValue, newValue)) {
|
if (!UtilityBigDecimal.equalsTo(viewValue, newValue)) {
|
||||||
view.setText(UtilityNumber.decimalToString(newValue));
|
view.setText(UtilityNumber.decimalToString(newValue));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@BindingAdapter("binding")
|
||||||
|
public static void bindTextInputEditTextBigDecimal(TextInputEditText view, final BindableBigDecimal bindableBigDecimal) {
|
||||||
|
Pair<BindableBigDecimal, TextWatcherAdapter> pair = (Pair) view.getTag(R.id.bound_observable);
|
||||||
|
if (pair == null || pair.first != bindableBigDecimal) {
|
||||||
|
if (pair != null) {
|
||||||
|
view.removeTextChangedListener(pair.second);
|
||||||
|
}
|
||||||
|
TextWatcherAdapter watcher = new TextWatcherAdapter() {
|
||||||
|
@Override
|
||||||
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||||
|
BigDecimal value = null;
|
||||||
|
if (!UtilityString.isNullOrEmpty(s.toString()))
|
||||||
|
value = new BigDecimal(s.toString());
|
||||||
|
bindableBigDecimal.set(value);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
view.setTag(R.id.bound_observable, new Pair<>(bindableBigDecimal, watcher));
|
||||||
|
view.addTextChangedListener(watcher);
|
||||||
|
}
|
||||||
|
BigDecimal newValue = bindableBigDecimal.get();
|
||||||
|
BigDecimal viewValue = view.getText().toString().trim().length() > 0 ? new BigDecimal(view.getText().toString()) : null;
|
||||||
|
|
||||||
|
if (!UtilityBigDecimal.equalsTo(viewValue, newValue)) {
|
||||||
|
view.setText(UtilityNumber.decimalToString(newValue));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@BindingAdapter("binding")
|
||||||
|
public static void bindTextInputEditTextInteger(TextInputEditText view, final BindableInteger bindableInteger) {
|
||||||
|
Pair<BindableInteger, TextWatcherAdapter> pair = (Pair) view.getTag(R.id.bound_observable);
|
||||||
|
if (pair == null || pair.first != bindableInteger) {
|
||||||
|
if (pair != null) {
|
||||||
|
view.removeTextChangedListener(pair.second);
|
||||||
|
}
|
||||||
|
TextWatcherAdapter watcher = new TextWatcherAdapter() {
|
||||||
|
@Override
|
||||||
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||||
|
Integer value = null;
|
||||||
|
if (!UtilityString.isNullOrEmpty(s.toString()))
|
||||||
|
value = Integer.valueOf(s.toString());
|
||||||
|
bindableInteger.set(value);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
view.setTag(R.id.bound_observable, new Pair<>(bindableInteger, watcher));
|
||||||
|
view.addTextChangedListener(watcher);
|
||||||
|
}
|
||||||
|
Integer newValue = bindableInteger.get();
|
||||||
|
Integer viewValue = view.getText().toString().trim().length() > 0 ? Integer.valueOf(view.getText().toString()) : Integer.valueOf(0);
|
||||||
|
|
||||||
|
if (!(viewValue.compareTo(newValue) == 0)) {
|
||||||
|
view.setText(newValue.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@BindingAdapter("binding")
|
@BindingAdapter("binding")
|
||||||
public static void bindTextInputEditTextString(TextInputEditText view, final ObservableField<String> observableString) {
|
public static void bindTextInputEditTextString(TextInputEditText view, final ObservableField<String> observableString) {
|
||||||
Pair<ObservableField<String>, TextWatcherAdapter> pair = (Pair) view.getTag(R.id.bound_observable);
|
Pair<ObservableField<String>, TextWatcherAdapter> pair = (Pair) view.getTag(R.id.bound_observable);
|
||||||
@@ -244,7 +300,7 @@ public class Converters {
|
|||||||
String newValue = observableString.get();
|
String newValue = observableString.get();
|
||||||
String viewValue = view.getText().toString();
|
String viewValue = view.getText().toString();
|
||||||
|
|
||||||
if(!viewValue.equalsIgnoreCase(newValue)) {
|
if (!viewValue.equalsIgnoreCase(newValue)) {
|
||||||
view.setText(newValue);
|
view.setText(newValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -268,7 +324,7 @@ public class Converters {
|
|||||||
// Get Current Date
|
// Get Current Date
|
||||||
Calendar c = UtilityDate.getCalendarInstance();
|
Calendar c = UtilityDate.getCalendarInstance();
|
||||||
|
|
||||||
if(observableDate.get() != null) {
|
if (observableDate.get() != null) {
|
||||||
c.setTime(observableDate.get());
|
c.setTime(observableDate.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -279,8 +335,8 @@ public class Converters {
|
|||||||
DatePickerDialog datePickerDialog = new DatePickerDialog(view.getContext(),
|
DatePickerDialog datePickerDialog = new DatePickerDialog(view.getContext(),
|
||||||
(cView, year, month, day) -> {
|
(cView, year, month, day) -> {
|
||||||
Date resultDate = new GregorianCalendar(year, month, day).getTime();
|
Date resultDate = new GregorianCalendar(year, month, day).getTime();
|
||||||
|
|
||||||
if(parentFragment != null && warningOnOldDates && resultDate.before(new Date())) {
|
if (parentFragment != null && warningOnOldDates && resultDate.before(new Date())) {
|
||||||
DialogSimpleMessageView
|
DialogSimpleMessageView
|
||||||
.makeWarningDialog(new SpannableString("Hai scelto una data precedente a quella odierna. Continuare?"), null, () -> {
|
.makeWarningDialog(new SpannableString("Hai scelto una data precedente a quella odierna. Continuare?"), null, () -> {
|
||||||
view.setText(UtilityDate.formatDate(resultDate, UtilityDate.COMMONS_DATE_FORMATS.DMY_HUMAN));
|
view.setText(UtilityDate.formatDate(resultDate, UtilityDate.COMMONS_DATE_FORMATS.DMY_HUMAN));
|
||||||
@@ -299,8 +355,8 @@ public class Converters {
|
|||||||
|
|
||||||
//Adding click-listener
|
//Adding click-listener
|
||||||
view.setOnClickListener(onClick::run);
|
view.setOnClickListener(onClick::run);
|
||||||
if(view.getParent() != null && view.getParent().getParent() != null && view.getParent().getParent() instanceof TextInputLayout) {
|
if (view.getParent() != null && view.getParent().getParent() != null && view.getParent().getParent() instanceof TextInputLayout) {
|
||||||
((FrameLayout)view.getParent()).setOnClickListener(onClick::run);
|
((FrameLayout) view.getParent()).setOnClickListener(onClick::run);
|
||||||
((TextInputLayout) view.getParent().getParent()).setOnClickListener(onClick::run);
|
((TextInputLayout) view.getParent().getParent()).setOnClickListener(onClick::run);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -495,6 +551,12 @@ public class Converters {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@BindingAdapter("visibility")
|
||||||
|
public static void bindViewVisibility(View view, boolean bool) {
|
||||||
|
view.setVisibility(bool ? View.VISIBLE : View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@BindingAdapter({"reverse_visibility"})
|
@BindingAdapter({"reverse_visibility"})
|
||||||
public static void bindViewReverseVisibility(View view, final BindableBoolean bindableBoolean) {
|
public static void bindViewReverseVisibility(View view, final BindableBoolean bindableBoolean) {
|
||||||
if (view.getTag(R.id.bound_observable) != bindableBoolean) {
|
if (view.getTag(R.id.bound_observable) != bindableBoolean) {
|
||||||
|
|||||||
@@ -22,8 +22,6 @@ public abstract class BaseFragment extends Fragment {
|
|||||||
protected final List<Runnable> mOnPreDestroyList = new ArrayList<>();
|
protected final List<Runnable> mOnPreDestroyList = new ArrayList<>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void setScrollToolbar(ElevatedToolbar toolbar) {
|
public void setScrollToolbar(ElevatedToolbar toolbar) {
|
||||||
mToolbar = toolbar;
|
mToolbar = toolbar;
|
||||||
}
|
}
|
||||||
@@ -34,10 +32,6 @@ public abstract class BaseFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void onLoadingStarted() {
|
public void onLoadingStarted() {
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
BarcodeManager.disable();
|
BarcodeManager.disable();
|
||||||
@@ -71,23 +65,25 @@ public abstract class BaseFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void openProgress() {
|
protected void openProgress() {
|
||||||
getActivity().runOnUiThread(() -> {
|
getActivity().runOnUiThread(() -> {
|
||||||
if (this.mCurrentProgress == null) {
|
if (this.mCurrentProgress == null) {
|
||||||
this.mCurrentProgress = UtilityProgress.createDefaultProgressDialog(getActivity());
|
this.mCurrentProgress = UtilityProgress.createDefaultProgressDialog(getActivity());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void closeProgress() {
|
protected void closeProgress() {
|
||||||
getActivity().runOnUiThread(() -> {
|
getActivity().runOnUiThread(() -> {
|
||||||
if (mCurrentProgress != null) {
|
if (mCurrentProgress != null) {
|
||||||
mCurrentProgress.dismiss();
|
mCurrentProgress.dismiss();
|
||||||
mCurrentProgress = null;
|
mCurrentProgress = null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void popMe() {
|
protected void popMe() {
|
||||||
((IPoppableActivity) requireActivity()).pop();
|
getActivity().runOnUiThread(() -> {
|
||||||
|
((IPoppableActivity) requireActivity()).pop();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public class MtbCols extends EntityBase {
|
|||||||
type = "mtb_cols";
|
type = "mtb_cols";
|
||||||
setCodMdep(SettingsManager.i().getUserSession().getDepo().getCodMdep());
|
setCodMdep(SettingsManager.i().getUserSession().getDepo().getCodMdep());
|
||||||
setModificatoDa(SettingsManager.i().getUser().getFullname());
|
setModificatoDa(SettingsManager.i().getUser().getFullname());
|
||||||
setDataMove(UtilityDate.getDateInstance());
|
//setDataMove(UtilityDate.getDateInstance());
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDataCollo() {
|
public String getDataCollo() {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package it.integry.integrywmsnative.core.rest.consumers;
|
|||||||
|
|
||||||
import androidx.databinding.ObservableArrayList;
|
import androidx.databinding.ObservableArrayList;
|
||||||
|
|
||||||
|
import com.annimon.stream.Optional;
|
||||||
import com.annimon.stream.Stream;
|
import com.annimon.stream.Stream;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
@@ -32,6 +33,7 @@ import it.integry.integrywmsnative.core.rest.model.DistribuzioneColloDTO;
|
|||||||
import it.integry.integrywmsnative.core.rest.model.RettificaULDTO;
|
import it.integry.integrywmsnative.core.rest.model.RettificaULDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||||
import it.integry.integrywmsnative.core.rest.model.SpostaArtsTraULRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.SpostaArtsTraULRequestDTO;
|
||||||
|
import it.integry.integrywmsnative.core.rest.model.VersamentoAutomaticoULResponseDTO;
|
||||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
|
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||||
@@ -646,4 +648,58 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void versamentoAutomaticoUL(MtbColt sourceMtbColt, RunnableArgs<VersamentoAutomaticoULResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
|
MtbColt sourceMtbColtClone = (MtbColt) sourceMtbColt.clone();
|
||||||
|
|
||||||
|
for (int i = 0; i < sourceMtbColtClone.getMtbColr().size(); i++) {
|
||||||
|
sourceMtbColtClone.getMtbColr().get(i)
|
||||||
|
.setMtbAart(null)
|
||||||
|
.setMtbPartitaMag(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||||
|
colliMagazzinoRESTConsumerService.versamentoAutomaticoUL(sourceMtbColtClone).enqueue(new Callback<>() {
|
||||||
|
@Override
|
||||||
|
public void onResponse(Call<ServiceRESTResponse<VersamentoAutomaticoULResponseDTO>> call, Response<ServiceRESTResponse<VersamentoAutomaticoULResponseDTO>> response) {
|
||||||
|
analyzeAnswer(response, "versamentoAutomaticoUL", data -> {
|
||||||
|
var result = response.body().getDto();
|
||||||
|
|
||||||
|
List<MtbColr> allMtbColr = new ArrayList<>();
|
||||||
|
allMtbColr.addAll(result.getSuccess());
|
||||||
|
allMtbColr.addAll(result.getFailed());
|
||||||
|
|
||||||
|
List<String> codMarts = Stream.of(allMtbColr)
|
||||||
|
.map(x -> x.getCodMart().trim())
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
mArticoloRESTConsumer.getByCodMarts(codMarts, mtbAarts -> {
|
||||||
|
for (var mtbColr : allMtbColr) {
|
||||||
|
|
||||||
|
MtbAart foundMtbAart = null;
|
||||||
|
|
||||||
|
Optional<MtbAart> mtbAartOpt = Stream.of(mtbAarts)
|
||||||
|
.filter(x -> x.getCodMart().equalsIgnoreCase(mtbColr.getCodMart()))
|
||||||
|
.findFirst();
|
||||||
|
|
||||||
|
if(mtbAartOpt.isPresent()){
|
||||||
|
foundMtbAart = mtbAartOpt.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
mtbColr.setMtbAart(foundMtbAart);
|
||||||
|
}
|
||||||
|
|
||||||
|
onComplete.run(result);
|
||||||
|
}, onFailed);
|
||||||
|
|
||||||
|
}, onFailed);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Call<ServiceRESTResponse<VersamentoAutomaticoULResponseDTO>> call, Throwable t) {
|
||||||
|
if (onFailed != null) onFailed.run(new Exception(t));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import it.integry.integrywmsnative.core.rest.model.DistribuzioneColloDTO;
|
|||||||
import it.integry.integrywmsnative.core.rest.model.RettificaULDTO;
|
import it.integry.integrywmsnative.core.rest.model.RettificaULDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||||
import it.integry.integrywmsnative.core.rest.model.SpostaArtsTraULRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.SpostaArtsTraULRequestDTO;
|
||||||
|
import it.integry.integrywmsnative.core.rest.model.VersamentoAutomaticoULResponseDTO;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.http.Body;
|
import retrofit2.http.Body;
|
||||||
import retrofit2.http.GET;
|
import retrofit2.http.GET;
|
||||||
@@ -42,4 +43,7 @@ public interface ColliMagazzinoRESTConsumerService {
|
|||||||
@POST("wms/assegnaLottoSuColloScarico")
|
@POST("wms/assegnaLottoSuColloScarico")
|
||||||
Call<ServiceRESTResponse<MtbColt>> assegnaLottoSuColloScarico(@Body MtbColt mtbColt);
|
Call<ServiceRESTResponse<MtbColt>> assegnaLottoSuColloScarico(@Body MtbColt mtbColt);
|
||||||
|
|
||||||
|
@POST("wms/versamentoAutomaticoUL")
|
||||||
|
Call<ServiceRESTResponse<VersamentoAutomaticoULResponseDTO>> versamentoAutomaticoUL(@Body MtbColt mtbColt);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,7 +100,11 @@ public class SystemRESTConsumer extends _BaseRESTConsumer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void getAvailableCodMdeps(final RunnableArgs<List<AvailableCodMdepsDTO>> onSuccess, RunnableArgs<Exception> onFailed) {
|
public void getAvailableCodMdeps(final RunnableArgs<List<AvailableCodMdepsDTO>> onSuccess, RunnableArgs<Exception> onFailed) {
|
||||||
|
getAvailableCodMdepsStatic(onSuccess, onFailed);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void getAvailableCodMdepsStatic(final RunnableArgs<List<AvailableCodMdepsDTO>> onSuccess, RunnableArgs<Exception> onFailed) {
|
||||||
|
|
||||||
SystemRESTConsumerService service = RESTBuilder.getService(SystemRESTConsumerService.class);
|
SystemRESTConsumerService service = RESTBuilder.getService(SystemRESTConsumerService.class);
|
||||||
service.getAvailableCodMdeps().enqueue(new Callback<>() {
|
service.getAvailableCodMdeps().enqueue(new Callback<>() {
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package it.integry.integrywmsnative.core.rest.model;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||||
|
|
||||||
|
public class VersamentoAutomaticoULResponseDTO {
|
||||||
|
|
||||||
|
private List<MtbColr> success;
|
||||||
|
private List<MtbColr> failed;
|
||||||
|
|
||||||
|
public List<MtbColr> getSuccess() {
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
public VersamentoAutomaticoULResponseDTO setSuccess(List<MtbColr> success) {
|
||||||
|
this.success = success;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<MtbColr> getFailed() {
|
||||||
|
return failed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public VersamentoAutomaticoULResponseDTO setFailed(List<MtbColr> failed) {
|
||||||
|
this.failed = failed;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package it.integry.integrywmsnative.core.settings;
|
package it.integry.integrywmsnative.core.settings;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.rest.model.AvailableCodMdepsDTO;
|
import it.integry.integrywmsnative.core.rest.model.AvailableCodMdepsDTO;
|
||||||
@@ -33,6 +34,7 @@ public class DBSettingsModel {
|
|||||||
private boolean flagForceAllToColli;
|
private boolean flagForceAllToColli;
|
||||||
private boolean flagSpedizioneEnableManualPick;
|
private boolean flagSpedizioneEnableManualPick;
|
||||||
private boolean flagSpedizioneCanSelectMultipleOrders;
|
private boolean flagSpedizioneCanSelectMultipleOrders;
|
||||||
|
private List<String> notePerditaDocInterni = new ArrayList<>();
|
||||||
private boolean flagSpedizioneUseQtaOrd;
|
private boolean flagSpedizioneUseQtaOrd;
|
||||||
private String produzioneDefaultCodAnag;
|
private String produzioneDefaultCodAnag;
|
||||||
private String reportNameSpedizionChiudiOrdine;
|
private String reportNameSpedizionChiudiOrdine;
|
||||||
@@ -271,4 +273,13 @@ public class DBSettingsModel {
|
|||||||
this.onNumCnfInputChanged = onNumCnfInputChanged;
|
this.onNumCnfInputChanged = onNumCnfInputChanged;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<String> getNotePerditaDocInterni() {
|
||||||
|
return notePerditaDocInterni;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DBSettingsModel setNotePerditaDocInterni(List<String> notePerditaDocInterni) {
|
||||||
|
this.notePerditaDocInterni = notePerditaDocInterni;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import com.google.firebase.perf.metrics.Trace;
|
|||||||
|
|
||||||
import java.net.SocketTimeoutException;
|
import java.net.SocketTimeoutException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.R;
|
import it.integry.integrywmsnative.R;
|
||||||
@@ -129,7 +130,7 @@ public class SettingsManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void loadAvailableCodMdeps(Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
private static void loadAvailableCodMdeps(Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
SystemRESTConsumer.getAvailableCodMdeps(availableCodMdeps -> {
|
SystemRESTConsumer.getAvailableCodMdepsStatic(availableCodMdeps -> {
|
||||||
dbSettingsModelIstance.setAvailableCodMdep(availableCodMdeps);
|
dbSettingsModelIstance.setAvailableCodMdep(availableCodMdeps);
|
||||||
|
|
||||||
if (availableCodMdeps == null || availableCodMdeps.size() == 0) {
|
if (availableCodMdeps == null || availableCodMdeps.size() == 0) {
|
||||||
@@ -265,6 +266,10 @@ public class SettingsManager {
|
|||||||
.setGestName("PICKING")
|
.setGestName("PICKING")
|
||||||
.setSection("SETUP")
|
.setSection("SETUP")
|
||||||
.setKeySection("ON_NUM_CNF_INPUT_CHANGED"));
|
.setKeySection("ON_NUM_CNF_INPUT_CHANGED"));
|
||||||
|
stbGestSetupList.add(new StbGestSetup()
|
||||||
|
.setGestName("PVM")
|
||||||
|
.setSection("DOC_INTERNI")
|
||||||
|
.setKeySection("NOTE_PERDITA"));
|
||||||
|
|
||||||
|
|
||||||
GestSetupRESTConsumer.getValues(stbGestSetupList, list -> {
|
GestSetupRESTConsumer.getValues(stbGestSetupList, list -> {
|
||||||
@@ -289,6 +294,10 @@ public class SettingsManager {
|
|||||||
dbSettingsModelIstance.setFlagSpedizioneCanSelectMultipleOrders(getValueFromList(list, "SPEDIZIONE", "FLAG_CAN_SELECT_MULTIPLE_ORDERS", Boolean.class));
|
dbSettingsModelIstance.setFlagSpedizioneCanSelectMultipleOrders(getValueFromList(list, "SPEDIZIONE", "FLAG_CAN_SELECT_MULTIPLE_ORDERS", Boolean.class));
|
||||||
dbSettingsModelIstance.setReportNameSpedizionChiudiOrdine(getValueFromList(list, "SPEDIZIONE", "REPORT_PACKING_LIST", String.class));
|
dbSettingsModelIstance.setReportNameSpedizionChiudiOrdine(getValueFromList(list, "SPEDIZIONE", "REPORT_PACKING_LIST", String.class));
|
||||||
dbSettingsModelIstance.setFlagSpedizioneUseQtaOrd(getValueFromList(list, "SPEDIZIONE", "FLAG_USE_QTA_ORD", Boolean.class));
|
dbSettingsModelIstance.setFlagSpedizioneUseQtaOrd(getValueFromList(list, "SPEDIZIONE", "FLAG_USE_QTA_ORD", Boolean.class));
|
||||||
|
String notePerdita = getValueFromList(list,"DOC_INTERNI","NOTE_PERDITA",String.class);
|
||||||
|
if (notePerdita != null){
|
||||||
|
dbSettingsModelIstance.setNotePerditaDocInterni(Arrays.asList(notePerdita.split("\\|")));
|
||||||
|
}
|
||||||
|
|
||||||
Integer onNumCnfInputChanged = getValueFromList(list, "SETUP", "ON_NUM_CNF_INPUT_CHANGED", Integer.class);
|
Integer onNumCnfInputChanged = getValueFromList(list, "SETUP", "ON_NUM_CNF_INPUT_CHANGED", Integer.class);
|
||||||
if (onNumCnfInputChanged != null) {
|
if (onNumCnfInputChanged != null) {
|
||||||
|
|||||||
@@ -13,13 +13,19 @@ import java.lang.reflect.Type;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by akshay on 01/03/18.
|
||||||
|
*/
|
||||||
|
|
||||||
public class Stash {
|
public class Stash {
|
||||||
|
|
||||||
private static Stash stash;
|
private static Stash stash;
|
||||||
|
private static Context instance;
|
||||||
private SharedPreferences sp;
|
private SharedPreferences sp;
|
||||||
|
|
||||||
public static void init(Context context) {
|
public static void init(Context context) {
|
||||||
stash = new Stash();
|
stash = new Stash();
|
||||||
|
instance = context;
|
||||||
if (stash.sp == null) {
|
if (stash.sp == null) {
|
||||||
stash.sp = PreferenceManager.getDefaultSharedPreferences(context);
|
stash.sp = PreferenceManager.getDefaultSharedPreferences(context);
|
||||||
}
|
}
|
||||||
@@ -34,7 +40,7 @@ public class Stash {
|
|||||||
public static void put(String key, String value) {
|
public static void put(String key, String value) {
|
||||||
checkfornull();
|
checkfornull();
|
||||||
try {
|
try {
|
||||||
stash.sp.edit().putString(key, value).apply();
|
stash.sp.edit().putString(key, value).commit();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@@ -44,7 +50,7 @@ public class Stash {
|
|||||||
public static void put(String key, Set<String> value) {
|
public static void put(String key, Set<String> value) {
|
||||||
checkfornull();
|
checkfornull();
|
||||||
try {
|
try {
|
||||||
stash.sp.edit().putStringSet(key, value).apply();
|
stash.sp.edit().putStringSet(key, value).commit();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@@ -54,7 +60,7 @@ public class Stash {
|
|||||||
public static void put(String key, int value) {
|
public static void put(String key, int value) {
|
||||||
checkfornull();
|
checkfornull();
|
||||||
try {
|
try {
|
||||||
stash.sp.edit().putInt(key, value).apply();
|
stash.sp.edit().putInt(key, value).commit();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@@ -64,7 +70,7 @@ public class Stash {
|
|||||||
public static void put(String key, long value) {
|
public static void put(String key, long value) {
|
||||||
checkfornull();
|
checkfornull();
|
||||||
try {
|
try {
|
||||||
stash.sp.edit().putLong(key, value).apply();
|
stash.sp.edit().putLong(key, value).commit();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@@ -74,7 +80,7 @@ public class Stash {
|
|||||||
public static void put(String key, float value) {
|
public static void put(String key, float value) {
|
||||||
checkfornull();
|
checkfornull();
|
||||||
try {
|
try {
|
||||||
stash.sp.edit().putFloat(key, value).apply();
|
stash.sp.edit().putFloat(key, value).commit();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@@ -84,7 +90,7 @@ public class Stash {
|
|||||||
public static void put(String key, boolean value) {
|
public static void put(String key, boolean value) {
|
||||||
checkfornull();
|
checkfornull();
|
||||||
try {
|
try {
|
||||||
stash.sp.edit().putBoolean(key, value).apply();
|
stash.sp.edit().putBoolean(key, value).commit();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@@ -95,7 +101,7 @@ public class Stash {
|
|||||||
checkfornull();
|
checkfornull();
|
||||||
try {
|
try {
|
||||||
Gson gson = new GsonBuilder().create();
|
Gson gson = new GsonBuilder().create();
|
||||||
stash.sp.edit().putString(key, gson.toJson(value).toString()).apply();
|
stash.sp.edit().putString(key, gson.toJson(value)).commit();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@@ -112,18 +118,26 @@ public class Stash {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getString(String key) {
|
||||||
|
return getString(key, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//getStringSet
|
//getStringSet
|
||||||
public static Set<String> getStringSet(String key, Set<String> defaultvalue) {
|
public static Set<String> getStringSet(String key, Set<String> defaultvalue) {
|
||||||
checkfornull();
|
checkfornull();
|
||||||
try {
|
try {
|
||||||
return getStringSet(key, defaultvalue);
|
return stash.sp.getStringSet(key, defaultvalue);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return defaultvalue;
|
return defaultvalue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Set<String> getStringSet(String key) {
|
||||||
|
return getStringSet(key, null);
|
||||||
|
}
|
||||||
|
|
||||||
//getInt
|
//getInt
|
||||||
public static int getInt(String key, int defaultvalue) {
|
public static int getInt(String key, int defaultvalue) {
|
||||||
checkfornull();
|
checkfornull();
|
||||||
@@ -135,6 +149,10 @@ public class Stash {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int getInt(String key) {
|
||||||
|
return getInt(key, 0);
|
||||||
|
}
|
||||||
|
|
||||||
//getLong
|
//getLong
|
||||||
public static long getLong(String key, long defaultvalue) {
|
public static long getLong(String key, long defaultvalue) {
|
||||||
checkfornull();
|
checkfornull();
|
||||||
@@ -146,6 +164,10 @@ public class Stash {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static long getLong(String key) {
|
||||||
|
return getLong(key, (long) 0);
|
||||||
|
}
|
||||||
|
|
||||||
//getFloat
|
//getFloat
|
||||||
public static float getFloat(String key, float defaultvalue) {
|
public static float getFloat(String key, float defaultvalue) {
|
||||||
checkfornull();
|
checkfornull();
|
||||||
@@ -157,6 +179,10 @@ public class Stash {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static float getFloat(String key) {
|
||||||
|
return getFloat(key, 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
//getBoolean
|
//getBoolean
|
||||||
public static boolean getBoolean(String key, boolean defaultvalue) {
|
public static boolean getBoolean(String key, boolean defaultvalue) {
|
||||||
checkfornull();
|
checkfornull();
|
||||||
@@ -168,6 +194,10 @@ public class Stash {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean getBoolean(String key) {
|
||||||
|
return getBoolean(key, false);
|
||||||
|
}
|
||||||
|
|
||||||
//getObject
|
//getObject
|
||||||
public static <T> Object getObject(String key, Class<?> tClass) {
|
public static <T> Object getObject(String key, Class<?> tClass) {
|
||||||
checkfornull();
|
checkfornull();
|
||||||
@@ -196,7 +226,7 @@ public class Stash {
|
|||||||
public static void clear(String key) {
|
public static void clear(String key) {
|
||||||
checkfornull();
|
checkfornull();
|
||||||
try {
|
try {
|
||||||
stash.sp.edit().remove(key).apply();
|
stash.sp.edit().remove(key).commit();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@@ -206,12 +236,22 @@ public class Stash {
|
|||||||
public static void clearAll() {
|
public static void clearAll() {
|
||||||
checkfornull();
|
checkfornull();
|
||||||
try {
|
try {
|
||||||
stash.sp.edit().clear().apply();
|
stash.sp.edit().clear().commit();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void addListener(StashListener listener){
|
||||||
|
checkfornull();
|
||||||
|
stash.sp.registerOnSharedPreferenceChangeListener(listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void removeListener(StashListener listener){
|
||||||
|
checkfornull();
|
||||||
|
stash.sp.unregisterOnSharedPreferenceChangeListener(listener);
|
||||||
|
}
|
||||||
|
|
||||||
private static class GenericType implements ParameterizedType {
|
private static class GenericType implements ParameterizedType {
|
||||||
|
|
||||||
private Type type;
|
private Type type;
|
||||||
@@ -238,4 +278,7 @@ public class Stash {
|
|||||||
// implement equals method too! (as per javadoc)
|
// implement equals method too! (as per javadoc)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
public interface StashListener extends SharedPreferences.OnSharedPreferenceChangeListener {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -21,6 +21,8 @@ import java.math.BigDecimal;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
@@ -33,6 +35,7 @@ import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
|||||||
import it.integry.integrywmsnative.core.data_cache.DataCache;
|
import it.integry.integrywmsnative.core.data_cache.DataCache;
|
||||||
import it.integry.integrywmsnative.core.di.BindableBoolean;
|
import it.integry.integrywmsnative.core.di.BindableBoolean;
|
||||||
import it.integry.integrywmsnative.core.expansion.BaseActivity;
|
import it.integry.integrywmsnative.core.expansion.BaseActivity;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.OnGeneralChangedCallback;
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgss;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgss;
|
||||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||||
@@ -41,6 +44,7 @@ import it.integry.integrywmsnative.core.model.MtbColt;
|
|||||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||||
import it.integry.integrywmsnative.core.report.ReportManager;
|
import it.integry.integrywmsnative.core.report.ReportManager;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.PrinterRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.PrinterRESTConsumer;
|
||||||
|
import it.integry.integrywmsnative.core.rest.model.VersamentoAutomaticoULResponseDTO;
|
||||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityBigDecimal;
|
import it.integry.integrywmsnative.core.utility.UtilityBigDecimal;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||||
@@ -50,20 +54,28 @@ import it.integry.integrywmsnative.core.utility.UtilityToast;
|
|||||||
import it.integry.integrywmsnative.databinding.ActivityAccettazioneOrdineInevasoBinding;
|
import it.integry.integrywmsnative.databinding.ActivityAccettazioneOrdineInevasoBinding;
|
||||||
import it.integry.integrywmsnative.gest.accettazione.dto.OrdineAccettazioneInevasoDTO;
|
import it.integry.integrywmsnative.gest.accettazione.dto.OrdineAccettazioneInevasoDTO;
|
||||||
import it.integry.integrywmsnative.gest.accettazione.dto.SitArtOrdDTO;
|
import it.integry.integrywmsnative.gest.accettazione.dto.SitArtOrdDTO;
|
||||||
import it.integry.integrywmsnative.gest.accettazione_picking.ui.AccettazioneListAdapter;
|
|
||||||
import it.integry.integrywmsnative.gest.accettazione_picking.ui.AccettazioneListModel;
|
|
||||||
import it.integry.integrywmsnative.gest.accettazione_picking.dto.AccettazioneOrdineInevasoOrderBy;
|
import it.integry.integrywmsnative.gest.accettazione_picking.dto.AccettazioneOrdineInevasoOrderBy;
|
||||||
import it.integry.integrywmsnative.gest.accettazione_picking.dto.PickingObjectDTO;
|
import it.integry.integrywmsnative.gest.accettazione_picking.dto.PickingObjectDTO;
|
||||||
|
import it.integry.integrywmsnative.gest.accettazione_picking.filters.AccettazionePickingFiltroOrdineViewModel;
|
||||||
|
import it.integry.integrywmsnative.gest.accettazione_picking.filters.FilterCodArtLayoutView;
|
||||||
|
import it.integry.integrywmsnative.gest.accettazione_picking.filters.FilterDescrLayoutView;
|
||||||
|
import it.integry.integrywmsnative.gest.accettazione_picking.filters.FilterPosizioneLayoutView;
|
||||||
import it.integry.integrywmsnative.gest.accettazione_picking.rest.RecoverMtbColt;
|
import it.integry.integrywmsnative.gest.accettazione_picking.rest.RecoverMtbColt;
|
||||||
|
import it.integry.integrywmsnative.gest.accettazione_picking.ui.AccettazioneListAdapter;
|
||||||
|
import it.integry.integrywmsnative.gest.accettazione_picking.ui.AccettazioneListModel;
|
||||||
import it.integry.integrywmsnative.gest.lista_bancali.ListaBancaliActivity;
|
import it.integry.integrywmsnative.gest.lista_bancali.ListaBancaliActivity;
|
||||||
import it.integry.integrywmsnative.gest.spedizione.exceptions.InvalidPesoKGException;
|
import it.integry.integrywmsnative.gest.spedizione.exceptions.InvalidPesoKGException;
|
||||||
import it.integry.integrywmsnative.gest.spedizione.model.PickedQuantityDTO;
|
import it.integry.integrywmsnative.gest.spedizione.model.PickedQuantityDTO;
|
||||||
|
import it.integry.integrywmsnative.ui.filter_chips.FilterChipDTO;
|
||||||
|
import it.integry.integrywmsnative.ui.filter_chips.FilterChipView;
|
||||||
import it.integry.integrywmsnative.view.bottom_sheet__lu_content.BottomSheetFragmentLUContentView;
|
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.bottom_sheet__lu_content.BottomSheetFragmentLUContentViewModel;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.ask_should_versamento_automatico_ul.DialogAskShouldVersamentoAutomaticoULView;
|
||||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2View;
|
|
||||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2DTO;
|
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2DTO;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2View;
|
||||||
import it.integry.integrywmsnative.view.dialogs.note_aggiuntive_lu.NoteAggiuntiveLUDialog;
|
import it.integry.integrywmsnative.view.dialogs.note_aggiuntive_lu.NoteAggiuntiveLUDialog;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.versamento_automatico_ul_done.DialogVersamentoAutomaticoULDoneView;
|
||||||
|
|
||||||
public class AccettazionePickingActivity extends BaseActivity implements AccettazionePickingViewModel.Listener, BottomSheetFragmentLUContentViewModel.Listener, BottomSheetFragmentLUContentView.Listener {
|
public class AccettazionePickingActivity extends BaseActivity implements AccettazionePickingViewModel.Listener, BottomSheetFragmentLUContentViewModel.Listener, BottomSheetFragmentLUContentView.Listener {
|
||||||
|
|
||||||
@@ -72,6 +84,8 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
|
|||||||
@Inject
|
@Inject
|
||||||
AccettazionePickingViewModel mViewModel;
|
AccettazionePickingViewModel mViewModel;
|
||||||
|
|
||||||
|
private final AccettazionePickingFiltroOrdineViewModel mAppliedFilterViewModel = new AccettazionePickingFiltroOrdineViewModel();
|
||||||
|
|
||||||
private BottomSheetFragmentLUContentViewModel mBottomSheetFragmentLUContentViewModel;
|
private BottomSheetFragmentLUContentViewModel mBottomSheetFragmentLUContentViewModel;
|
||||||
|
|
||||||
private final ObservableArrayList<AccettazioneListModel> mAccettazioneMutableData = new ObservableArrayList<>();
|
private final ObservableArrayList<AccettazioneListModel> mAccettazioneMutableData = new ObservableArrayList<>();
|
||||||
@@ -123,6 +137,7 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
|
|||||||
this.initVars();
|
this.initVars();
|
||||||
this.initBarcodeReader();
|
this.initBarcodeReader();
|
||||||
this.initRecyclerView();
|
this.initRecyclerView();
|
||||||
|
this.initFilters();
|
||||||
|
|
||||||
String codMdep = SettingsManager.i().getUserSession().getDepo().getCodMdep();
|
String codMdep = SettingsManager.i().getUserSession().getDepo().getCodMdep();
|
||||||
|
|
||||||
@@ -130,6 +145,158 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
|
|||||||
mViewModel.init(mOrders, mSitArts, codMdep);
|
mViewModel.init(mOrders, mSitArts, codMdep);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void initFilters() {
|
||||||
|
|
||||||
|
var onPredicateChanged = new OnGeneralChangedCallback() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
refreshList();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
mAppliedFilterViewModel.getCurrentCodArtPredicate().addOnPropertyChangedCallback(onPredicateChanged);
|
||||||
|
mAppliedFilterViewModel.getCurrentDescrPredicate().addOnPropertyChangedCallback(onPredicateChanged);
|
||||||
|
mAppliedFilterViewModel.getCurrentPosPredicate().addOnPropertyChangedCallback(onPredicateChanged);
|
||||||
|
|
||||||
|
List<FilterChipDTO> filterList = Stream.of(AccettazionePickingBindings.AVAILABLE_FILTERS.entrySet())
|
||||||
|
.map(Map.Entry::getValue)
|
||||||
|
.sortBy(FilterChipDTO::getPosizione)
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
for (FilterChipDTO filterChipDTO : filterList) {
|
||||||
|
|
||||||
|
FilterChipView filterChipView = new FilterChipView(
|
||||||
|
this,
|
||||||
|
filterChipDTO.getFilterChipText(),
|
||||||
|
v -> initBottomSheetDialogFilter(filterChipDTO));
|
||||||
|
|
||||||
|
switch (filterChipDTO.getID()) {
|
||||||
|
case AccettazionePickingBindings.COD_ART_FILTER_ID:
|
||||||
|
mAppliedFilterViewModel.getCurrentCodArtPredicate().addOnPropertyChangedCallback(new OnGeneralChangedCallback() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (mAppliedFilterViewModel.getCurrentCodArtPredicate().get() == null) {
|
||||||
|
mViewModel.resetMatchedRows();
|
||||||
|
filterChipView.disableCloseIcon();
|
||||||
|
|
||||||
|
mBindings.filterChipsGroup.removeView(filterChipView);
|
||||||
|
mBindings.filterChipsGroup.addView(filterChipView);
|
||||||
|
mBindings.filterChips.smoothScrollTo(0, 0);
|
||||||
|
} else {
|
||||||
|
filterChipView.enableCloseIcon();
|
||||||
|
|
||||||
|
mBindings.filterChipsGroup.removeView(filterChipView);
|
||||||
|
mBindings.filterChipsGroup.addView(filterChipView, 0);
|
||||||
|
mBindings.filterChips.smoothScrollTo(0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
filterChipView.setOnResetClicked(() -> mAppliedFilterViewModel.getCurrentCodArtPredicate().set(null));
|
||||||
|
break;
|
||||||
|
case AccettazionePickingBindings.DESCR_FILTER_ID:
|
||||||
|
mAppliedFilterViewModel.getCurrentDescrPredicate().addOnPropertyChangedCallback(new OnGeneralChangedCallback() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (mAppliedFilterViewModel.getCurrentDescrPredicate().get() == null) {
|
||||||
|
mViewModel.resetMatchedRows();
|
||||||
|
filterChipView.disableCloseIcon();
|
||||||
|
|
||||||
|
mBindings.filterChipsGroup.removeView(filterChipView);
|
||||||
|
mBindings.filterChipsGroup.addView(filterChipView);
|
||||||
|
mBindings.filterChips.smoothScrollTo(0, 0);
|
||||||
|
} else {
|
||||||
|
filterChipView.enableCloseIcon();
|
||||||
|
|
||||||
|
mBindings.filterChipsGroup.removeView(filterChipView);
|
||||||
|
mBindings.filterChipsGroup.addView(filterChipView, 0);
|
||||||
|
mBindings.filterChips.smoothScrollTo(0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
filterChipView.setOnResetClicked(() -> mAppliedFilterViewModel.getCurrentDescrPredicate().set(null));
|
||||||
|
break;
|
||||||
|
case AccettazionePickingBindings.POS_FILTER_ID:
|
||||||
|
mAppliedFilterViewModel.getCurrentPosPredicate().addOnPropertyChangedCallback(new OnGeneralChangedCallback() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (mAppliedFilterViewModel.getCurrentPosPredicate().get() == null) {
|
||||||
|
mViewModel.resetMatchedRows();
|
||||||
|
filterChipView.disableCloseIcon();
|
||||||
|
|
||||||
|
mBindings.filterChipsGroup.removeView(filterChipView);
|
||||||
|
mBindings.filterChipsGroup.addView(filterChipView);
|
||||||
|
mBindings.filterChips.smoothScrollTo(0, 0);
|
||||||
|
} else {
|
||||||
|
filterChipView.enableCloseIcon();
|
||||||
|
|
||||||
|
mBindings.filterChipsGroup.removeView(filterChipView);
|
||||||
|
mBindings.filterChipsGroup.addView(filterChipView, 0);
|
||||||
|
mBindings.filterChips.smoothScrollTo(0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
filterChipView.setOnResetClicked(() -> mAppliedFilterViewModel.getCurrentPosPredicate().set(null));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.mBindings.filterChipsGroup.addView(filterChipView);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void initBottomSheetDialogFilter(FilterChipDTO filterChipDTO) {
|
||||||
|
|
||||||
|
filterChipDTO
|
||||||
|
.getFilterLayoutView()
|
||||||
|
.setFilterName(filterChipDTO.getFilterChipText())
|
||||||
|
.setContext(this);
|
||||||
|
|
||||||
|
var filterLayoutView = filterChipDTO
|
||||||
|
.getFilterLayoutView();
|
||||||
|
|
||||||
|
switch (filterChipDTO.getID()) {
|
||||||
|
case AccettazionePickingBindings.COD_ART_FILTER_ID:
|
||||||
|
((FilterCodArtLayoutView) filterLayoutView)
|
||||||
|
.setAll(mAppliedFilterViewModel.getAllCodArts())
|
||||||
|
.setAvailable(mAppliedFilterViewModel.getAvailableCodArts())
|
||||||
|
.setOnFilterApplied(mAppliedFilterViewModel::setCodArtFilter)
|
||||||
|
.setPreselected(Stream.of(Objects.requireNonNull(mViewModel.getPickingList().getValue()))
|
||||||
|
.filter(mAppliedFilterViewModel.getCurrentCodArtPredicate().get() == null ?
|
||||||
|
x -> false :
|
||||||
|
mAppliedFilterViewModel.getCurrentCodArtPredicate().get())
|
||||||
|
.map(x -> x.getSitArtOrdDTO().getCodMart())
|
||||||
|
.toList());
|
||||||
|
break;
|
||||||
|
case AccettazionePickingBindings.DESCR_FILTER_ID:
|
||||||
|
((FilterDescrLayoutView) filterLayoutView)
|
||||||
|
.setAll(mAppliedFilterViewModel.getAllDescrs())
|
||||||
|
.setAvailable(mAppliedFilterViewModel.getAvailableDescrs())
|
||||||
|
.setOnFilterApplied(mAppliedFilterViewModel::setDescrFilter)
|
||||||
|
.setPreselected(Stream.of(Objects.requireNonNull(mViewModel.getPickingList().getValue()))
|
||||||
|
.filter(mAppliedFilterViewModel.getCurrentDescrPredicate().get() == null ?
|
||||||
|
x -> false :
|
||||||
|
mAppliedFilterViewModel.getCurrentDescrPredicate().get())
|
||||||
|
.map(x -> x.getSitArtOrdDTO().getDescrizioneEstesaArt())
|
||||||
|
.toList());
|
||||||
|
break;
|
||||||
|
case AccettazionePickingBindings.POS_FILTER_ID:
|
||||||
|
((FilterPosizioneLayoutView) filterLayoutView)
|
||||||
|
.setAll(mAppliedFilterViewModel.getAllPos())
|
||||||
|
.setAvailable(mAppliedFilterViewModel.getAvailablePos())
|
||||||
|
.setOnFilterApplied(mAppliedFilterViewModel::setPosFilter)
|
||||||
|
.setPreselected(Stream.of(Objects.requireNonNull(mViewModel.getPickingList().getValue()))
|
||||||
|
.filter(mAppliedFilterViewModel.getCurrentPosPredicate().get() == null ?
|
||||||
|
x -> false :
|
||||||
|
mAppliedFilterViewModel.getCurrentPosPredicate().get())
|
||||||
|
.map(x -> x.getMtbAart().getPosizione())
|
||||||
|
.toList());
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
filterLayoutView.show(getSupportFragmentManager(), "TAG");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onSupportNavigateUp() {
|
public boolean onSupportNavigateUp() {
|
||||||
onBackPressed();
|
onBackPressed();
|
||||||
@@ -162,7 +329,7 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
|
|||||||
// Handle item selection
|
// Handle item selection
|
||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
case R.id.action_filter:
|
case R.id.action_filter:
|
||||||
showOrderDialog();
|
showOrderByDialog();
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
@@ -189,6 +356,8 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
|
|||||||
this.mBindings.accettazionePickingList.setLayoutManager(new LinearLayoutManager(this));
|
this.mBindings.accettazionePickingList.setLayoutManager(new LinearLayoutManager(this));
|
||||||
|
|
||||||
this.mViewModel.getPickingList().observe(this, updatedData -> {
|
this.mViewModel.getPickingList().observe(this, updatedData -> {
|
||||||
|
mAppliedFilterViewModel.init(updatedData);
|
||||||
|
|
||||||
refreshList();
|
refreshList();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -198,9 +367,28 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void refreshList() {
|
private void refreshList() {
|
||||||
this.mAccettazioneMutableData.clear();
|
//this.onLoadingStarted();
|
||||||
this.mAccettazioneMutableData.addAll(convertDataModelToListModel(this.mViewModel.getPickingList().getValue()));
|
|
||||||
this.noItemsToPick.set(!isThereAnyItemToPick(this.mViewModel.getPickingList().getValue()));
|
//new Thread(() -> {
|
||||||
|
|
||||||
|
runOnUiThread(() -> {
|
||||||
|
List<PickingObjectDTO> tmpList;
|
||||||
|
|
||||||
|
if (mAppliedFilterViewModel != null) {
|
||||||
|
mAppliedFilterViewModel.applyAllTests();
|
||||||
|
tmpList = mAppliedFilterViewModel.getMutableFilteredOrderList().getValue();
|
||||||
|
} else {
|
||||||
|
tmpList = mViewModel.getPickingList().getValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
var list = convertDataModelToListModel(tmpList);
|
||||||
|
|
||||||
|
this.mAccettazioneMutableData.clear();
|
||||||
|
this.mAccettazioneMutableData.addAll(list);
|
||||||
|
this.noItemsToPick.set(!isThereAnyItemToPick(tmpList));
|
||||||
|
|
||||||
|
//this.onLoadingEnded();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<AccettazioneListModel> convertDataModelToListModel(List<PickingObjectDTO> dataList) {
|
private List<AccettazioneListModel> convertDataModelToListModel(List<PickingObjectDTO> dataList) {
|
||||||
@@ -228,17 +416,21 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
|
|||||||
private List<AccettazioneListModel> convertDataModelToListModel__CodArtForn(List<PickingObjectDTO> dataList) {
|
private List<AccettazioneListModel> convertDataModelToListModel__CodArtForn(List<PickingObjectDTO> dataList) {
|
||||||
ArrayList<AccettazioneListModel> list = new ArrayList<>();
|
ArrayList<AccettazioneListModel> list = new ArrayList<>();
|
||||||
Stream.of(dataList)
|
Stream.of(dataList)
|
||||||
.sortBy(x -> x.getSitArtOrdDTO().getCodArtFor() + (UtilityString.isNullOrEmpty(x.getMtbAart().getDescrizioneEstesa()) ? "" : " - " + x.getMtbAart().getDescrizioneEstesa()))
|
.sortBy(x -> UtilityString.isNull(x.getSitArtOrdDTO().getCodArtFor(), x.getSitArtOrdDTO().getCodMart()) +
|
||||||
|
(UtilityString.isNullOrEmpty(x.getMtbAart().getDescrizioneEstesa()) ? "" : " - " + x.getMtbAart().getDescrizioneEstesa()))
|
||||||
.forEach(x -> {
|
.forEach(x -> {
|
||||||
AccettazioneListModel accettazioneListModel = new AccettazioneListModel();
|
AccettazioneListModel accettazioneListModel = new AccettazioneListModel();
|
||||||
accettazioneListModel.setActive(true);
|
accettazioneListModel.setActive(true);
|
||||||
|
|
||||||
accettazioneListModel.setGroupTitle(x.getSitArtOrdDTO().getCodArtFor() + (UtilityString.isNullOrEmpty(x.getMtbAart().getDescrizioneEstesa()) ? "" : " - " + x.getMtbAart().getDescrizioneEstesa()));
|
accettazioneListModel.setGroupTitle(UtilityString.isNull(x.getSitArtOrdDTO().getCodArtFor(), x.getSitArtOrdDTO().getCodMart()) +
|
||||||
|
(UtilityString.isNullOrEmpty(x.getMtbAart().getDescrizioneEstesa()) ? "" : " - " + x.getMtbAart().getDescrizioneEstesa()));
|
||||||
|
|
||||||
accettazioneListModel.setBadge1(UtilityString.isNull(x.getSitArtOrdDTO().getCodJcom(), CommonConst.Config.COMMESSA_MAG));
|
accettazioneListModel.setBadge1(UtilityString.isNull(x.getSitArtOrdDTO().getCodJcom(), CommonConst.Config.COMMESSA_MAG));
|
||||||
accettazioneListModel.setBadge2(String.valueOf(x.getSitArtOrdDTO().getNumOrd()));
|
accettazioneListModel.setBadge2(String.valueOf(x.getSitArtOrdDTO().getNumOrd()));
|
||||||
|
|
||||||
accettazioneListModel.setDescrizione(x.getSitArtOrdDTO().getDescrizioneCommessa());
|
accettazioneListModel.setDescrizione(x.getSitArtOrdDTO().getDescrizioneCommessa());
|
||||||
|
if (x.getMtbAart() != null)
|
||||||
|
accettazioneListModel.setPosizione(x.getMtbAart().getPosizione());
|
||||||
|
|
||||||
//Calc Num CNF
|
//Calc Num CNF
|
||||||
BigDecimal numCnfEvasa = BigDecimal.ZERO;
|
BigDecimal numCnfEvasa = BigDecimal.ZERO;
|
||||||
@@ -295,12 +487,15 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
|
|||||||
AccettazioneListModel accettazioneListModel = new AccettazioneListModel();
|
AccettazioneListModel accettazioneListModel = new AccettazioneListModel();
|
||||||
accettazioneListModel.setActive(true);
|
accettazioneListModel.setActive(true);
|
||||||
|
|
||||||
accettazioneListModel.setGroupTitle(x.getSitArtOrdDTO().getCodArtFor() + (UtilityString.isNullOrEmpty(x.getMtbAart().getDescrizioneEstesa()) ? "" : " - " + x.getMtbAart().getDescrizioneEstesa()));
|
accettazioneListModel.setGroupTitle(UtilityString.isNull(x.getSitArtOrdDTO().getCodArtFor(), x.getSitArtOrdDTO().getCodMart())
|
||||||
|
+ (UtilityString.isNullOrEmpty(x.getMtbAart().getDescrizioneEstesa()) ? "" : " - " + x.getMtbAart().getDescrizioneEstesa()));
|
||||||
|
|
||||||
accettazioneListModel.setBadge1(UtilityString.isNull(x.getSitArtOrdDTO().getCodJcom(), CommonConst.Config.COMMESSA_MAG));
|
accettazioneListModel.setBadge1(UtilityString.isNull(x.getSitArtOrdDTO().getCodJcom(), CommonConst.Config.COMMESSA_MAG));
|
||||||
accettazioneListModel.setBadge2(String.valueOf(x.getSitArtOrdDTO().getNumOrd()));
|
accettazioneListModel.setBadge2(String.valueOf(x.getSitArtOrdDTO().getNumOrd()));
|
||||||
|
|
||||||
accettazioneListModel.setDescrizione(x.getSitArtOrdDTO().getDescrizioneCommessa());
|
accettazioneListModel.setDescrizione(x.getSitArtOrdDTO().getDescrizioneCommessa());
|
||||||
|
if (x.getMtbAart() != null)
|
||||||
|
accettazioneListModel.setPosizione(x.getMtbAart().getPosizione());
|
||||||
|
|
||||||
//Calc Num CNF
|
//Calc Num CNF
|
||||||
BigDecimal numCnfEvasa = BigDecimal.ZERO;
|
BigDecimal numCnfEvasa = BigDecimal.ZERO;
|
||||||
@@ -361,7 +556,7 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
|
|||||||
|
|
||||||
accettazioneListModel.setGroupTitle(x.getSitArtOrdDTO().getCodJcom() + (!UtilityString.isNullOrEmpty(x.getSitArtOrdDTO().getDescrizioneCommessa()) ? " - " + x.getSitArtOrdDTO().getDescrizioneCommessa() : ""));
|
accettazioneListModel.setGroupTitle(x.getSitArtOrdDTO().getCodJcom() + (!UtilityString.isNullOrEmpty(x.getSitArtOrdDTO().getDescrizioneCommessa()) ? " - " + x.getSitArtOrdDTO().getDescrizioneCommessa() : ""));
|
||||||
|
|
||||||
accettazioneListModel.setBadge1(x.getSitArtOrdDTO().getCodArtFor());
|
accettazioneListModel.setBadge1(UtilityString.isNull(x.getSitArtOrdDTO().getCodArtFor(), x.getSitArtOrdDTO().getCodMart()));
|
||||||
accettazioneListModel.setBadge2(String.valueOf(x.getSitArtOrdDTO().getNumOrd()));
|
accettazioneListModel.setBadge2(String.valueOf(x.getSitArtOrdDTO().getNumOrd()));
|
||||||
|
|
||||||
//Calc Num CNF
|
//Calc Num CNF
|
||||||
@@ -405,6 +600,7 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
|
|||||||
|
|
||||||
if (x.getMtbAart() != null) {
|
if (x.getMtbAart() != null) {
|
||||||
accettazioneListModel.setDescrizione(x.getMtbAart().getDescrizioneEstesa());
|
accettazioneListModel.setDescrizione(x.getMtbAart().getDescrizioneEstesa());
|
||||||
|
accettazioneListModel.setPosizione(x.getMtbAart().getPosizione());
|
||||||
}
|
}
|
||||||
|
|
||||||
accettazioneListModel.setOriginalModel(x);
|
accettazioneListModel.setOriginalModel(x);
|
||||||
@@ -420,7 +616,7 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
|
|||||||
|
|
||||||
accettazioneListModel.setGroupTitle(UtilityString.isNull(x.getSitArtOrdDTO().getCodJcom(), CommonConst.Config.COMMESSA_MAG));
|
accettazioneListModel.setGroupTitle(UtilityString.isNull(x.getSitArtOrdDTO().getCodJcom(), CommonConst.Config.COMMESSA_MAG));
|
||||||
|
|
||||||
accettazioneListModel.setBadge1(x.getSitArtOrdDTO().getCodArtFor());
|
accettazioneListModel.setBadge1(UtilityString.isNull(x.getSitArtOrdDTO().getCodArtFor(), x.getSitArtOrdDTO().getCodMart()));
|
||||||
accettazioneListModel.setBadge2(String.valueOf(x.getSitArtOrdDTO().getNumOrd()));
|
accettazioneListModel.setBadge2(String.valueOf(x.getSitArtOrdDTO().getNumOrd()));
|
||||||
|
|
||||||
|
|
||||||
@@ -514,8 +710,7 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
|
|||||||
this.mViewModel.retrieveExistentLU(this::startListaBancaliRegistratiActivity);
|
this.mViewModel.retrieveExistentLU(this::startListaBancaliRegistratiActivity);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showOrderDialog() {
|
private void showOrderByDialog() {
|
||||||
|
|
||||||
AlertDialog dialog = new AlertDialog.Builder(this)
|
AlertDialog dialog = new AlertDialog.Builder(this)
|
||||||
.setTitle(this.getText(R.string.action_orderBy))
|
.setTitle(this.getText(R.string.action_orderBy))
|
||||||
.setSingleChoiceItems(AccettazioneOrdineInevasoOrderBy.descriptions, mCurrentOrderBy.getVal(), (dialog12, which) -> {
|
.setSingleChoiceItems(AccettazioneOrdineInevasoOrderBy.descriptions, mCurrentOrderBy.getVal(), (dialog12, which) -> {
|
||||||
@@ -527,7 +722,6 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
|
|||||||
dialog.show();
|
dialog.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void startListaBancaliRegistratiActivity(ArrayList<RecoverMtbColt> mtbColts) {
|
public void startListaBancaliRegistratiActivity(ArrayList<RecoverMtbColt> mtbColts) {
|
||||||
|
|
||||||
Intent myIntent = ListaBancaliActivity.createIntent(this,
|
Intent myIntent = ListaBancaliActivity.createIntent(this,
|
||||||
@@ -560,7 +754,7 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
|
|||||||
null,
|
null,
|
||||||
R.string.button_ignore_print,
|
R.string.button_ignore_print,
|
||||||
onComplete)
|
onComplete)
|
||||||
.show(getSupportFragmentManager(), "tag");
|
.show(getSupportFragmentManager(), "tag");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -588,9 +782,19 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
|
|||||||
this.mViewModel.closeLU();
|
this.mViewModel.closeLU();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onVersamentoAutomaticoULRequest(RunnableArgs<Boolean> onComplete) {
|
||||||
|
runOnUiThread(() -> {
|
||||||
|
DialogAskShouldVersamentoAutomaticoULView.newInstance(onComplete)
|
||||||
|
.show(getSupportFragmentManager(), "tag");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNoteAggiuntiveRequest(RunnableArgs<String> onComplete) {
|
public void onNoteAggiuntiveRequest(RunnableArgs<String> onComplete) {
|
||||||
NoteAggiuntiveLUDialog.make(this, onComplete::run, () -> onComplete.run(null)).show();
|
runOnUiThread(() -> {
|
||||||
|
NoteAggiuntiveLUDialog.make(this, onComplete).show();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -645,44 +849,72 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRowSaved() {
|
public void onRowSaved() {
|
||||||
FBToast.successToast(this, getResources().getString(R.string.data_saved), FBToast.LENGTH_SHORT);
|
runOnUiThread(() -> {
|
||||||
|
FBToast.successToast(this, getResources().getString(R.string.data_saved), FBToast.LENGTH_SHORT);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFilterApplied(String newValue) {
|
public void onFilterCodMartApplied(String codMartToFilter) {
|
||||||
this.mBindings.filteredArtsInListExpandableLayout.expand(true);
|
runOnUiThread(() -> {
|
||||||
this.mBindings.descriptionFilterText.setText(!UtilityString.isNullOrEmpty(newValue) ? newValue : "");
|
var codMarts = new ArrayList<String>();
|
||||||
|
codMarts.add(codMartToFilter);
|
||||||
|
|
||||||
|
this.mAppliedFilterViewModel.setCodArtFilter(codMarts);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFilterRemoved() {
|
public void onFilterPosizioneApplied(String posizioneToFilter) {
|
||||||
mBindings.filteredArtsInListExpandableLayout.collapse(true);
|
runOnUiThread(() -> {
|
||||||
|
var posizioni = new ArrayList<String>();
|
||||||
|
posizioni.add(posizioneToFilter);
|
||||||
|
|
||||||
|
this.mAppliedFilterViewModel.setPosFilter(posizioni);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onULVersata(VersamentoAutomaticoULResponseDTO versamentoAutomaticoULResponseDTO, Runnable onComplete) {
|
||||||
|
|
||||||
|
runOnUiThread(() -> {
|
||||||
|
DialogVersamentoAutomaticoULDoneView
|
||||||
|
.newInstance(versamentoAutomaticoULResponseDTO, onComplete)
|
||||||
|
.show(getSupportFragmentManager(), "tag");
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMtbColrDeleteRequest(RunnableArgs<Boolean> onComplete) {
|
public void onMtbColrDeleteRequest(RunnableArgs<Boolean> onComplete) {
|
||||||
String text = getResources().getString(R.string.alert_delete_mtb_colr);
|
runOnUiThread(() -> {
|
||||||
DialogSimpleMessageView.makeWarningDialog(new SpannableString(text),
|
String text = getResources().getString(R.string.alert_delete_mtb_colr);
|
||||||
null,
|
DialogSimpleMessageView.makeWarningDialog(new SpannableString(text),
|
||||||
() -> onComplete.run(true),
|
null,
|
||||||
() -> onComplete.run(false)
|
() -> onComplete.run(true),
|
||||||
).show(getSupportFragmentManager(), "tag");
|
() -> onComplete.run(false)
|
||||||
|
).show(getSupportFragmentManager(), "tag");
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLUOpened(MtbColt mtbColt) {
|
public void onLUOpened(MtbColt mtbColt) {
|
||||||
noLUPresent.set(false);
|
runOnUiThread(() -> {
|
||||||
FBToast.successToast(this, getResources().getString(R.string.data_saved), FBToast.LENGTH_SHORT);
|
noLUPresent.set(false);
|
||||||
|
FBToast.successToast(this, getResources().getString(R.string.data_saved), FBToast.LENGTH_SHORT);
|
||||||
|
|
||||||
this.mBottomSheetFragmentLUContentViewModel.setMtbColt(mtbColt);
|
this.mBottomSheetFragmentLUContentViewModel.setMtbColt(mtbColt);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLUClosed() {
|
public void onLUClosed() {
|
||||||
noLUPresent.set(true);
|
runOnUiThread(() -> {
|
||||||
this.mBottomSheetFragmentLUContentViewModel.setMtbColt(null);
|
noLUPresent.set(true);
|
||||||
|
this.mBottomSheetFragmentLUContentViewModel.setMtbColt(null);
|
||||||
|
|
||||||
if (this.mShouldCloseActivity) super.onBackPressed();
|
if (this.mShouldCloseActivity) super.onBackPressed();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.accettazione_picking;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.gest.accettazione_picking.filters.FilterCodArtLayoutView;
|
||||||
|
import it.integry.integrywmsnative.gest.accettazione_picking.filters.FilterDescrLayoutView;
|
||||||
|
import it.integry.integrywmsnative.gest.accettazione_picking.filters.FilterPosizioneLayoutView;
|
||||||
|
import it.integry.integrywmsnative.ui.filter_chips.FilterChipDTO;
|
||||||
|
|
||||||
|
public class AccettazionePickingBindings {
|
||||||
|
|
||||||
|
public static final int COD_ART_FILTER_ID = 0;
|
||||||
|
public static final int DESCR_FILTER_ID = 1;
|
||||||
|
public static final int POS_FILTER_ID = 2;
|
||||||
|
|
||||||
|
public static final HashMap<Integer, FilterChipDTO> AVAILABLE_FILTERS = new HashMap<>() {
|
||||||
|
{
|
||||||
|
put(COD_ART_FILTER_ID, new FilterChipDTO()
|
||||||
|
.setID(COD_ART_FILTER_ID)
|
||||||
|
.setPosizione(0)
|
||||||
|
.setFilterChipText("Codice articolo")
|
||||||
|
.setFilterLayoutView(new FilterCodArtLayoutView()));
|
||||||
|
|
||||||
|
put(DESCR_FILTER_ID, new FilterChipDTO()
|
||||||
|
.setID(DESCR_FILTER_ID)
|
||||||
|
.setPosizione(1)
|
||||||
|
.setFilterChipText("Descrizione articolo")
|
||||||
|
.setFilterLayoutView(new FilterDescrLayoutView()));
|
||||||
|
|
||||||
|
put(POS_FILTER_ID, new FilterChipDTO()
|
||||||
|
.setID(POS_FILTER_ID)
|
||||||
|
.setPosizione(1)
|
||||||
|
.setFilterChipText("Posizione")
|
||||||
|
.setFilterLayoutView(new FilterPosizioneLayoutView()));
|
||||||
|
}};
|
||||||
|
|
||||||
|
}
|
||||||
@@ -42,11 +42,13 @@ import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsume
|
|||||||
import it.integry.integrywmsnative.core.rest.consumers.GestSetupRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.GestSetupRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.PrinterRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.PrinterRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.model.Ean13PesoModel;
|
import it.integry.integrywmsnative.core.rest.model.Ean13PesoModel;
|
||||||
|
import it.integry.integrywmsnative.core.rest.model.VersamentoAutomaticoULResponseDTO;
|
||||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
|
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityBigDecimal;
|
import it.integry.integrywmsnative.core.utility.UtilityBigDecimal;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityThread;
|
||||||
import it.integry.integrywmsnative.gest.accettazione.dto.OrdineAccettazioneInevasoDTO;
|
import it.integry.integrywmsnative.gest.accettazione.dto.OrdineAccettazioneInevasoDTO;
|
||||||
import it.integry.integrywmsnative.gest.accettazione.dto.SitArtOrdDTO;
|
import it.integry.integrywmsnative.gest.accettazione.dto.SitArtOrdDTO;
|
||||||
import it.integry.integrywmsnative.gest.accettazione_picking.dto.HistoryMtbAartDTO;
|
import it.integry.integrywmsnative.gest.accettazione_picking.dto.HistoryMtbAartDTO;
|
||||||
@@ -243,6 +245,10 @@ public class AccettazionePickingViewModel {
|
|||||||
this.executeEtichettaEanPeso(barcodeScanDTO, onComplete);
|
this.executeEtichettaEanPeso(barcodeScanDTO, onComplete);
|
||||||
|
|
||||||
|
|
||||||
|
} else if (UtilityBarcode.isEtichettaPosizione(barcodeScanDTO)) {
|
||||||
|
//Applico filtro per posizione
|
||||||
|
this.executeEtichettaPosizione(barcodeScanDTO, onComplete);
|
||||||
|
|
||||||
} else if (UtilityBarcode.isEtichetta128(barcodeScanDTO)) {
|
} else if (UtilityBarcode.isEtichetta128(barcodeScanDTO)) {
|
||||||
//Cerco tramite etichetta ean 128 (che può indicarmi un articolo o una UL)
|
//Cerco tramite etichetta ean 128 (che può indicarmi un articolo o una UL)
|
||||||
this.executeEtichettaEan128(barcodeScanDTO, onComplete);
|
this.executeEtichettaEan128(barcodeScanDTO, onComplete);
|
||||||
@@ -293,6 +299,15 @@ public class AccettazionePickingViewModel {
|
|||||||
}, this::sendError);
|
}, this::sendError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void executeEtichettaPosizione(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
||||||
|
|
||||||
|
var optionalPos = Stream.of(SettingsManager.iDB().getAvailablePosizioni())
|
||||||
|
.filter(x -> x.getPosizione().equalsIgnoreCase(barcodeScanDTO.getStringValue()))
|
||||||
|
.findFirst();
|
||||||
|
|
||||||
|
this.sendFilterPosizioneApplied(optionalPos.get().getPosizione());
|
||||||
|
onComplete.run();
|
||||||
|
}
|
||||||
|
|
||||||
private void loadArticolo(String barcodeProd, PickDataDTO pickData, Runnable onComplete) {
|
private void loadArticolo(String barcodeProd, PickDataDTO pickData, Runnable onComplete) {
|
||||||
if (barcodeProd.length() == 14) {
|
if (barcodeProd.length() == 14) {
|
||||||
@@ -332,16 +347,14 @@ public class AccettazionePickingViewModel {
|
|||||||
} else if (matchedRows.size() == 1) {
|
} else if (matchedRows.size() == 1) {
|
||||||
this.dispatchOrdineRow(matchedRows.get(0));
|
this.dispatchOrdineRow(matchedRows.get(0));
|
||||||
} else {
|
} else {
|
||||||
List<PickingObjectDTO> pickingList = mPickingList.getValue();
|
//So che il codMart sarà solo 1
|
||||||
|
var firstCodMart = Stream.of(matchedRows)
|
||||||
|
.map(x -> x.getSitArtOrdDTO().getCodMart())
|
||||||
|
.distinct()
|
||||||
|
.findFirst()
|
||||||
|
.get();
|
||||||
|
|
||||||
for (int i = 0; i < pickingList.size(); i++) {
|
this.sendFilterCodMartApplied(firstCodMart);
|
||||||
if (!matchedRows.contains(pickingList.get(i))) {
|
|
||||||
pickingList.get(i).setHidden(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.sendFilterApplied(null);
|
|
||||||
this.getPickingList().postValue(pickingList);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -571,64 +584,67 @@ public class AccettazionePickingViewModel {
|
|||||||
public void saveNewRow(PickingObjectDTO pickingObjectDTO, BigDecimal numCnf, BigDecimal qtaCnf, BigDecimal qtaTot, String partitaMag, Date dataScad, boolean shouldCloseLU) {
|
public void saveNewRow(PickingObjectDTO pickingObjectDTO, BigDecimal numCnf, BigDecimal qtaCnf, BigDecimal qtaTot, String partitaMag, Date dataScad, boolean shouldCloseLU) {
|
||||||
this.sendOnLoadingStarted();
|
this.sendOnLoadingStarted();
|
||||||
|
|
||||||
String gestioneRif = pickingObjectDTO.getSitArtOrdDTO().getGestioneEnum() == GestioneEnum.PRODUZIONE ? "L" : pickingObjectDTO.getSitArtOrdDTO().getGestione();
|
UtilityThread.executeParallel(() -> {
|
||||||
|
|
||||||
final MtbColr mtbColr = new MtbColr()
|
String gestioneRif = pickingObjectDTO.getSitArtOrdDTO().getGestioneEnum() == GestioneEnum.PRODUZIONE ? "L" : pickingObjectDTO.getSitArtOrdDTO().getGestione();
|
||||||
.setCodMart(pickingObjectDTO.getMtbAart().getCodMart())
|
|
||||||
.setPartitaMag(partitaMag)
|
final MtbColr mtbColr = new MtbColr()
|
||||||
.setDataScadPartita(dataScad)
|
.setCodMart(pickingObjectDTO.getMtbAart().getCodMart())
|
||||||
.setQtaCol(qtaTot)
|
.setPartitaMag(partitaMag)
|
||||||
.setQtaCnf(qtaCnf)
|
.setDataScadPartita(dataScad)
|
||||||
.setNumCnf(numCnf)
|
.setQtaCol(qtaTot)
|
||||||
.setGestioneRif(gestioneRif)
|
.setQtaCnf(qtaCnf)
|
||||||
.setCodJcom(pickingObjectDTO.getSitArtOrdDTO().getCodJcom())
|
.setNumCnf(numCnf)
|
||||||
.setDescrizione(pickingObjectDTO.getMtbAart().getDescrizioneEstesa())
|
.setGestioneRif(gestioneRif)
|
||||||
.setDatetimeRow(UtilityDate.getDateInstance())
|
.setCodJcom(pickingObjectDTO.getSitArtOrdDTO().getCodJcom())
|
||||||
.setDataOrd(pickingObjectDTO.getSitArtOrdDTO().getDataOrd())
|
.setDescrizione(pickingObjectDTO.getMtbAart().getDescrizioneEstesa())
|
||||||
.setNumOrd(pickingObjectDTO.getSitArtOrdDTO().getNumOrd())
|
.setDatetimeRow(UtilityDate.getDateInstance())
|
||||||
.setRigaOrd(pickingObjectDTO.getSitArtOrdDTO().getRigaOrd());
|
.setDataOrd(pickingObjectDTO.getSitArtOrdDTO().getDataOrd())
|
||||||
|
.setNumOrd(pickingObjectDTO.getSitArtOrdDTO().getNumOrd())
|
||||||
|
.setRigaOrd(pickingObjectDTO.getSitArtOrdDTO().getRigaOrd());
|
||||||
|
|
||||||
|
|
||||||
this.addHistoryItem(mtbColr);
|
this.addHistoryItem(mtbColr);
|
||||||
|
|
||||||
mtbColr.setOperation(CommonModelConsts.OPERATION.INSERT_OR_UPDATE);
|
mtbColr.setOperation(CommonModelConsts.OPERATION.INSERT_OR_UPDATE);
|
||||||
|
|
||||||
MtbColt cloneMtbColt = (MtbColt) mCurrentMtbColt.clone();
|
MtbColt cloneMtbColt = (MtbColt) mCurrentMtbColt.clone();
|
||||||
cloneMtbColt.setOperation(CommonModelConsts.OPERATION.UPDATE);
|
cloneMtbColt.setOperation(CommonModelConsts.OPERATION.UPDATE);
|
||||||
|
|
||||||
cloneMtbColt.setMtbColr(new ObservableArrayList<>());
|
cloneMtbColt.setMtbColr(new ObservableArrayList<>());
|
||||||
cloneMtbColt.getMtbColr().add((MtbColr) mtbColr.clone());
|
cloneMtbColt.getMtbColr().add((MtbColr) mtbColr.clone());
|
||||||
|
|
||||||
if (UtilityBigDecimal.equalsTo(numCnf, BigDecimal.ZERO) && UtilityBigDecimal.equalsTo(qtaTot, BigDecimal.ZERO)) {
|
if (UtilityBigDecimal.equalsTo(numCnf, BigDecimal.ZERO) && UtilityBigDecimal.equalsTo(qtaTot, BigDecimal.ZERO)) {
|
||||||
resetMatchedRows();
|
resetMatchedRows();
|
||||||
this.sendOnLoadingEnded();
|
this.sendOnLoadingEnded();
|
||||||
|
|
||||||
if (shouldCloseLU) closeLU();
|
if (shouldCloseLU) closeLU();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mColliMagazzinoRESTConsumer.saveCollo(cloneMtbColt, value -> {
|
mColliMagazzinoRESTConsumer.saveCollo(cloneMtbColt, value -> {
|
||||||
|
|
||||||
mtbColr
|
mtbColr
|
||||||
.setDataCollo(value.getDataColloS())
|
.setDataCollo(value.getDataColloS())
|
||||||
.setNumCollo(value.getNumCollo())
|
.setNumCollo(value.getNumCollo())
|
||||||
.setGestione(value.getGestione())
|
.setGestione(value.getGestione())
|
||||||
.setSerCollo(value.getSerCollo())
|
.setSerCollo(value.getSerCollo())
|
||||||
.setRiga(value.getMtbColr().get(value.getMtbColr().size() - 1).getRiga())
|
.setRiga(value.getMtbColr().get(value.getMtbColr().size() - 1).getRiga())
|
||||||
.setUntMis(pickingObjectDTO.getMtbAart().getUntMis())
|
.setUntMis(pickingObjectDTO.getMtbAart().getUntMis())
|
||||||
.setMtbAart(pickingObjectDTO.getMtbAart());
|
.setMtbAart(pickingObjectDTO.getMtbAart());
|
||||||
|
|
||||||
pickingObjectDTO.getWithdrawMtbColrs().add(mtbColr);
|
pickingObjectDTO.getWithdrawMtbColrs().add(mtbColr);
|
||||||
mCurrentMtbColt.getMtbColr().add(mtbColr);
|
mCurrentMtbColt.getMtbColr().add(mtbColr);
|
||||||
|
|
||||||
//Chiamato removeListFilter perché cosi mi cancella tutti i dati di pick temporanei
|
//Chiamato removeListFilter perché cosi mi cancella tutti i dati di pick temporanei
|
||||||
resetMatchedRows();
|
resetMatchedRows();
|
||||||
|
|
||||||
this.sendOnRowSaved();
|
this.sendOnRowSaved();
|
||||||
this.sendOnLoadingEnded();
|
this.sendOnLoadingEnded();
|
||||||
|
|
||||||
if (shouldCloseLU) closeLU();
|
if (shouldCloseLU) closeLU();
|
||||||
}, this::sendError);
|
}, this::sendError);
|
||||||
|
}, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -772,19 +788,40 @@ public class AccettazionePickingViewModel {
|
|||||||
} else {
|
} else {
|
||||||
mColliMagazzinoRESTConsumer.updateDataFine(mCurrentMtbColt, () -> {
|
mColliMagazzinoRESTConsumer.updateDataFine(mCurrentMtbColt, () -> {
|
||||||
|
|
||||||
if (!mCurrentMtbColt.getDisablePrint()) {
|
Runnable onVersamentoCompleted = () -> {
|
||||||
printCollo(this::postCloseOperations);
|
if (!mCurrentMtbColt.getDisablePrint()) {
|
||||||
} else {
|
printCollo(this::postCloseOperations);
|
||||||
postCloseOperations();
|
} else {
|
||||||
}
|
postCloseOperations();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.sendLUClosed();
|
||||||
|
this.sendOnLoadingEnded();
|
||||||
|
};
|
||||||
|
|
||||||
|
sendVersamentoAutomaticoULRequest(response -> {
|
||||||
|
if (response) {
|
||||||
|
versaAutomaticamenteUL(onVersamentoCompleted);
|
||||||
|
} else {
|
||||||
|
onVersamentoCompleted.run();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
this.sendLUClosed();
|
|
||||||
this.sendOnLoadingEnded();
|
|
||||||
}, this::sendError);
|
}, this::sendError);
|
||||||
}
|
}
|
||||||
}, this::sendError);
|
}, this::sendError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void versaAutomaticamenteUL(Runnable onComplete) {
|
||||||
|
if (mCurrentMtbColt == null) return;
|
||||||
|
|
||||||
|
mColliMagazzinoRESTConsumer.versamentoAutomaticoUL(mCurrentMtbColt, versamentoResult -> {
|
||||||
|
this.notifyVersamentoAutomaticoResult(versamentoResult, onComplete);
|
||||||
|
}, this::sendError);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void printCollo(Runnable onComplete) {
|
private void printCollo(Runnable onComplete) {
|
||||||
MtbColt cloneMtbColt = (MtbColt) mCurrentMtbColt.clone();
|
MtbColt cloneMtbColt = (MtbColt) mCurrentMtbColt.clone();
|
||||||
cloneMtbColt.setGestione(cloneMtbColt.getGestioneEnum() == GestioneEnum.LAVORAZIONE ? GestioneEnum.PRODUZIONE : cloneMtbColt.getGestioneEnum());
|
cloneMtbColt.setGestione(cloneMtbColt.getGestioneEnum() == GestioneEnum.LAVORAZIONE ? GestioneEnum.PRODUZIONE : cloneMtbColt.getGestioneEnum());
|
||||||
@@ -816,12 +853,10 @@ public class AccettazionePickingViewModel {
|
|||||||
public void resetMatchedRows() {
|
public void resetMatchedRows() {
|
||||||
for (PickingObjectDTO pickingObjectDTO : this.mPickingList.getValue()) {
|
for (PickingObjectDTO pickingObjectDTO : this.mPickingList.getValue()) {
|
||||||
pickingObjectDTO
|
pickingObjectDTO
|
||||||
.setTempPickData(null)
|
.setTempPickData(null);
|
||||||
.setHidden(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.mPickingList.postValue(this.mPickingList.getValue());
|
this.mPickingList.postValue(this.mPickingList.getValue());
|
||||||
this.sendFilterRemoved();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addHistoryItem(@NonNull MtbColr mtbColr) {
|
private void addHistoryItem(@NonNull MtbColr mtbColr) {
|
||||||
@@ -857,6 +892,10 @@ public class AccettazionePickingViewModel {
|
|||||||
if (this.mListener != null) mListener.onLoadingEnded();
|
if (this.mListener != null) mListener.onLoadingEnded();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void sendVersamentoAutomaticoULRequest(RunnableArgs<Boolean> onComplete) {
|
||||||
|
if (this.mListener != null) this.mListener.onVersamentoAutomaticoULRequest(onComplete);
|
||||||
|
}
|
||||||
|
|
||||||
private void sendOnNoteAggiuntiveRequest(RunnableArgs<String> onComplete) {
|
private void sendOnNoteAggiuntiveRequest(RunnableArgs<String> onComplete) {
|
||||||
if (this.mListener != null) this.mListener.onNoteAggiuntiveRequest(onComplete);
|
if (this.mListener != null) this.mListener.onNoteAggiuntiveRequest(onComplete);
|
||||||
}
|
}
|
||||||
@@ -925,26 +964,32 @@ public class AccettazionePickingViewModel {
|
|||||||
if (this.mListener != null) mListener.onRowSaved();
|
if (this.mListener != null) mListener.onRowSaved();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendFilterApplied(String newValue) {
|
private void sendFilterCodMartApplied(String codMart) {
|
||||||
if (this.mListener != null) mListener.onFilterApplied(newValue);
|
if (this.mListener != null) mListener.onFilterCodMartApplied(codMart);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendFilterRemoved() {
|
private void sendFilterPosizioneApplied(String posizione) {
|
||||||
if (this.mListener != null) mListener.onFilterRemoved();
|
if (this.mListener != null) mListener.onFilterPosizioneApplied(posizione);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendMtbColrDeleteRequest(RunnableArgs<Boolean> onComplete) {
|
private void sendMtbColrDeleteRequest(RunnableArgs<Boolean> onComplete) {
|
||||||
if (this.mListener != null) mListener.onMtbColrDeleteRequest(onComplete);
|
if (this.mListener != null) mListener.onMtbColrDeleteRequest(onComplete);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AccettazionePickingViewModel setListeners(AccettazionePickingViewModel.Listener
|
private void notifyVersamentoAutomaticoResult(VersamentoAutomaticoULResponseDTO versamentoAutomaticoULResponseDTO, Runnable onComplete) {
|
||||||
listener) {
|
if (this.mListener != null)
|
||||||
|
mListener.onULVersata(versamentoAutomaticoULResponseDTO, onComplete);
|
||||||
|
}
|
||||||
|
|
||||||
|
public AccettazionePickingViewModel setListeners(AccettazionePickingViewModel.Listener listener) {
|
||||||
this.mListener = listener;
|
this.mListener = listener;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface Listener extends ILoadingListener, ILUPrintListener, ILUBaseOperationsListener {
|
public interface Listener extends ILoadingListener, ILUPrintListener, ILUBaseOperationsListener {
|
||||||
|
|
||||||
|
void onVersamentoAutomaticoULRequest(RunnableArgs<Boolean> onComplete);
|
||||||
|
|
||||||
void onNoteAggiuntiveRequest(RunnableArgs<String> onComplete);
|
void onNoteAggiuntiveRequest(RunnableArgs<String> onComplete);
|
||||||
|
|
||||||
void onError(Exception ex);
|
void onError(Exception ex);
|
||||||
@@ -969,9 +1014,11 @@ public class AccettazionePickingViewModel {
|
|||||||
boolean canOverflowQuantity,
|
boolean canOverflowQuantity,
|
||||||
RunnableArgss<PickedQuantityDTO, Boolean> onComplete);
|
RunnableArgss<PickedQuantityDTO, Boolean> onComplete);
|
||||||
|
|
||||||
void onFilterApplied(String newValue);
|
void onFilterCodMartApplied(String codMartToFilter);
|
||||||
|
|
||||||
void onFilterRemoved();
|
void onFilterPosizioneApplied(String posizioneToFilter);
|
||||||
|
|
||||||
|
void onULVersata(VersamentoAutomaticoULResponseDTO versamentoAutomaticoULResponseDTO, Runnable onComplete);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,174 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.accettazione_picking.filters;
|
||||||
|
|
||||||
|
import androidx.databinding.ObservableField;
|
||||||
|
import androidx.lifecycle.MutableLiveData;
|
||||||
|
|
||||||
|
import com.annimon.stream.Stream;
|
||||||
|
import com.annimon.stream.function.Predicate;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||||
|
import it.integry.integrywmsnative.gest.accettazione_picking.dto.PickingObjectDTO;
|
||||||
|
|
||||||
|
public class AccettazionePickingFiltroOrdineViewModel {
|
||||||
|
|
||||||
|
private final ObservableField<Predicate<PickingObjectDTO>> currentCodArtPredicate = new ObservableField<>();
|
||||||
|
private final ObservableField<Predicate<PickingObjectDTO>> currentDescrPredicate = new ObservableField<>();
|
||||||
|
private final ObservableField<Predicate<PickingObjectDTO>> currentPosPredicate = new ObservableField<>();
|
||||||
|
|
||||||
|
|
||||||
|
private List<PickingObjectDTO> initialOrderList;
|
||||||
|
private final MutableLiveData<List<PickingObjectDTO>> currentFilteredOrderList = new MutableLiveData<>();
|
||||||
|
|
||||||
|
public void init(List<PickingObjectDTO> initialList) {
|
||||||
|
this.initialOrderList = initialList;
|
||||||
|
this.currentFilteredOrderList.setValue(this.initialOrderList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MutableLiveData<List<PickingObjectDTO>> getMutableFilteredOrderList() {
|
||||||
|
return this.currentFilteredOrderList;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setCodArtFilter(List<String> codArts) {
|
||||||
|
if (codArts == null || codArts.isEmpty()) currentCodArtPredicate.set(null);
|
||||||
|
else {
|
||||||
|
currentCodArtPredicate.set(o -> codArts.contains(o.getSitArtOrdDTO().getCodMart()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setDescrFilter(List<String> descrs) {
|
||||||
|
if (descrs == null || descrs.isEmpty()) currentDescrPredicate.set(null);
|
||||||
|
else {
|
||||||
|
currentDescrPredicate.set(o -> descrs.contains(o.getSitArtOrdDTO().getDescrizioneEstesaArt()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setPosFilter(List<String> pos) {
|
||||||
|
if (pos == null || pos.isEmpty()) currentPosPredicate.set(null);
|
||||||
|
else {
|
||||||
|
currentPosPredicate.set(o -> o.getMtbAart() != null && o.getMtbAart().getPosizione() == null ? pos.contains(null) : pos.contains(o.getMtbAart().getPosizione()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void applyAllTests() {
|
||||||
|
|
||||||
|
List<PickingObjectDTO> returnList = null;
|
||||||
|
|
||||||
|
if (currentCodArtPredicate.get() == null &&
|
||||||
|
currentDescrPredicate.get() == null &&
|
||||||
|
currentPosPredicate.get() == null) {
|
||||||
|
returnList = this.initialOrderList;
|
||||||
|
} else {
|
||||||
|
Stream<PickingObjectDTO> tmpStream = Stream.of(this.initialOrderList)
|
||||||
|
.filter(x ->
|
||||||
|
(currentCodArtPredicate.get() == null || (currentCodArtPredicate.get().test(x))) &&
|
||||||
|
(currentDescrPredicate.get() == null || (currentDescrPredicate.get().test(x))) &&
|
||||||
|
(currentPosPredicate.get() == null || (currentPosPredicate.get().test(x)))
|
||||||
|
);
|
||||||
|
|
||||||
|
returnList = tmpStream.toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.currentFilteredOrderList.setValue(returnList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ObservableField<Predicate<PickingObjectDTO>> getCurrentCodArtPredicate() {
|
||||||
|
return currentCodArtPredicate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ObservableField<Predicate<PickingObjectDTO>> getCurrentDescrPredicate() {
|
||||||
|
return currentDescrPredicate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ObservableField<Predicate<PickingObjectDTO>> getCurrentPosPredicate() {
|
||||||
|
return currentPosPredicate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getAllCodArts() {
|
||||||
|
return Stream
|
||||||
|
.of(Objects.requireNonNull(initialOrderList))
|
||||||
|
.filter(x -> x.getSitArtOrdDTO().getCodMart() != null)
|
||||||
|
.sortBy(x -> x.getSitArtOrdDTO().getCodMart())
|
||||||
|
.map(x -> x.getSitArtOrdDTO().getCodMart() != null ? x.getSitArtOrdDTO().getCodMart() : null)
|
||||||
|
.distinct()
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getAvailableCodArts() {
|
||||||
|
|
||||||
|
if (currentDescrPredicate.get() == null &&
|
||||||
|
currentPosPredicate.get() == null) {
|
||||||
|
return getAllCodArts();
|
||||||
|
} else {
|
||||||
|
return Stream.of(this.initialOrderList)
|
||||||
|
.filter(x ->
|
||||||
|
(currentDescrPredicate.get() == null || (currentDescrPredicate.get().test(x))) &&
|
||||||
|
(currentPosPredicate.get() == null || (currentPosPredicate.get().test(x)))
|
||||||
|
)
|
||||||
|
.map(x -> x.getSitArtOrdDTO().getCodMart())
|
||||||
|
.distinct()
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getAllDescrs() {
|
||||||
|
return Stream
|
||||||
|
.of(Objects.requireNonNull(initialOrderList))
|
||||||
|
.filter(x -> x.getSitArtOrdDTO().getDescrizioneEstesaArt() != null)
|
||||||
|
.sortBy(x -> x.getSitArtOrdDTO().getDescrizioneEstesaArt())
|
||||||
|
.map(x -> x.getSitArtOrdDTO().getDescrizioneEstesaArt() != null ? x.getSitArtOrdDTO().getDescrizioneEstesaArt() : null)
|
||||||
|
.distinct()
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getAvailableDescrs() {
|
||||||
|
|
||||||
|
if (currentCodArtPredicate.get() == null &&
|
||||||
|
currentPosPredicate.get() == null) {
|
||||||
|
return getAllDescrs();
|
||||||
|
} else {
|
||||||
|
return Stream.of(this.initialOrderList)
|
||||||
|
.filter(x ->
|
||||||
|
(currentCodArtPredicate.get() == null || (currentCodArtPredicate.get().test(x))) &&
|
||||||
|
(currentPosPredicate.get() == null || (currentPosPredicate.get().test(x)))
|
||||||
|
)
|
||||||
|
.map(x -> x.getSitArtOrdDTO().getDescrizioneEstesaArt())
|
||||||
|
.distinct()
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getAllPos() {
|
||||||
|
return Stream
|
||||||
|
.of(Objects.requireNonNull(initialOrderList))
|
||||||
|
.filter(x -> x.getMtbAart() != null && x.getMtbAart().getPosizione() != null)
|
||||||
|
.sortBy(x -> UtilityString.isNull(x.getMtbAart().getPosizione(), "000000"))
|
||||||
|
.map(x -> x.getMtbAart().getPosizione() != null ? x.getMtbAart().getPosizione() : null)
|
||||||
|
.distinct()
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getAvailablePos() {
|
||||||
|
|
||||||
|
if (currentCodArtPredicate.get() == null &&
|
||||||
|
currentDescrPredicate.get() == null) {
|
||||||
|
return getAllPos();
|
||||||
|
} else {
|
||||||
|
return Stream.of(this.initialOrderList)
|
||||||
|
.filter(x ->
|
||||||
|
(currentCodArtPredicate.get() == null || (currentCodArtPredicate.get().test(x))) &&
|
||||||
|
(currentDescrPredicate.get() == null || (currentDescrPredicate.get().test(x)))
|
||||||
|
)
|
||||||
|
.map(x -> x.getMtbAart().getPosizione())
|
||||||
|
.distinct()
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,184 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.accettazione_picking.filters;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.databinding.DataBindingUtil;
|
||||||
|
import androidx.lifecycle.MutableLiveData;
|
||||||
|
|
||||||
|
import com.annimon.stream.ComparatorCompat;
|
||||||
|
import com.annimon.stream.Stream;
|
||||||
|
import com.ravikoradiya.liveadapter.LiveAdapter;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.BR;
|
||||||
|
import it.integry.integrywmsnative.R;
|
||||||
|
import it.integry.integrywmsnative.core.di.BindableBoolean;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityBoolean;
|
||||||
|
import it.integry.integrywmsnative.databinding.LayoutFilterCodArtBinding;
|
||||||
|
import it.integry.integrywmsnative.ui.filter_chips.FilterLayoutView;
|
||||||
|
|
||||||
|
public class FilterCodArtLayoutView extends FilterLayoutView {
|
||||||
|
|
||||||
|
protected LayoutFilterCodArtBinding mBindings;
|
||||||
|
|
||||||
|
private List<String> all;
|
||||||
|
private List<String> available;
|
||||||
|
private List<String> preselected = new ArrayList<>();
|
||||||
|
private List<String> hidden = new ArrayList<>();
|
||||||
|
private final MutableLiveData<List<ListModel>> listModel = new MutableLiveData<>();
|
||||||
|
|
||||||
|
private RunnableArgs<List<String>> onFilterApplied;
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
|
mBindings = DataBindingUtil.inflate(inflater, R.layout.layout_filter_cod_art, container, false);
|
||||||
|
this.mBindings.setView(this);
|
||||||
|
|
||||||
|
refreshList();
|
||||||
|
|
||||||
|
this.setSearchView(this.mBindings.searchView, newFilter -> {
|
||||||
|
hidden = Stream.of(all)
|
||||||
|
.filter(x -> !x.toUpperCase(Locale.ROOT).contains(newFilter.toUpperCase(Locale.ROOT)) &&
|
||||||
|
!x.toUpperCase(Locale.ROOT).contains(newFilter.toUpperCase(Locale.ROOT)))
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
refreshList();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
new LiveAdapter(listModel, getViewLifecycleOwner(), BR.item)
|
||||||
|
.map(ListModel.class, R.layout.layout_filter_cod_art__list_item)
|
||||||
|
.into(this.mBindings.recyclerview);
|
||||||
|
|
||||||
|
return mBindings.getRoot();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void onConfirm() {
|
||||||
|
if (onFilterApplied == null) return;
|
||||||
|
|
||||||
|
this.onFilterApplied.run(Stream.of(Objects.requireNonNull(listModel.getValue()))
|
||||||
|
.filter(x -> x.selected.get())
|
||||||
|
.map(x -> x.originalModel)
|
||||||
|
.toList());
|
||||||
|
|
||||||
|
dismiss();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshList() {
|
||||||
|
ComparatorCompat<ListModel> c =
|
||||||
|
ComparatorCompat
|
||||||
|
.chain(new ComparatorCompat<ListModel>((x, y) -> UtilityBoolean.toInt(x.getSelected().get()) - UtilityBoolean.toInt(y.getSelected().get())))
|
||||||
|
.thenComparing(new ComparatorCompat<>((x, y) -> UtilityBoolean.toInt(x.getEnabled().get()) - UtilityBoolean.toInt(y.getEnabled().get())))
|
||||||
|
.thenComparing(new ComparatorCompat<>((x, y) -> y.getOriginalModel().compareToIgnoreCase(x.getOriginalModel())))
|
||||||
|
.reversed();
|
||||||
|
|
||||||
|
|
||||||
|
listModel.setValue(Stream.of(getAll())
|
||||||
|
.filter(x -> !hidden.contains(x))
|
||||||
|
.map(x -> {
|
||||||
|
var selectedBoolean = new BindableBoolean(preselected.contains(x));
|
||||||
|
selectedBoolean.addOnPropertyChangedCallback(() -> {
|
||||||
|
if (selectedBoolean.get()) preselected.add(x);
|
||||||
|
else preselected.remove(x);
|
||||||
|
});
|
||||||
|
|
||||||
|
return new ListModel()
|
||||||
|
.setSelected(selectedBoolean)
|
||||||
|
.setEnabled(new BindableBoolean(available.contains(x)))
|
||||||
|
.setOriginalModel(x);
|
||||||
|
})
|
||||||
|
.sorted(c)
|
||||||
|
.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getAll() {
|
||||||
|
return all;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterCodArtLayoutView setAll(List<String> all) {
|
||||||
|
this.all = all;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getAvailable() {
|
||||||
|
return available;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterCodArtLayoutView setAvailable(List<String> available) {
|
||||||
|
this.available = available;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getPreselected() {
|
||||||
|
return preselected;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterCodArtLayoutView setPreselected(List<String> preselected) {
|
||||||
|
this.preselected = preselected;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RunnableArgs<List<String>> getOnFilterApplied() {
|
||||||
|
return onFilterApplied;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterCodArtLayoutView setOnFilterApplied(RunnableArgs<List<String>> onFilterApplied) {
|
||||||
|
this.onFilterApplied = onFilterApplied;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getHidden() {
|
||||||
|
return hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterCodArtLayoutView setHidden(List<String> hidden) {
|
||||||
|
this.hidden = hidden;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class ListModel {
|
||||||
|
private BindableBoolean selected = new BindableBoolean();
|
||||||
|
private BindableBoolean enabled = new BindableBoolean();
|
||||||
|
private String originalModel;
|
||||||
|
|
||||||
|
public BindableBoolean getSelected() {
|
||||||
|
return selected;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ListModel setSelected(BindableBoolean selected) {
|
||||||
|
this.selected = selected;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BindableBoolean getEnabled() {
|
||||||
|
return enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ListModel setEnabled(BindableBoolean enabled) {
|
||||||
|
this.enabled = enabled;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOriginalModel() {
|
||||||
|
return originalModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ListModel setOriginalModel(String originalModel) {
|
||||||
|
this.originalModel = originalModel;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,184 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.accettazione_picking.filters;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.databinding.DataBindingUtil;
|
||||||
|
import androidx.lifecycle.MutableLiveData;
|
||||||
|
|
||||||
|
import com.annimon.stream.ComparatorCompat;
|
||||||
|
import com.annimon.stream.Stream;
|
||||||
|
import com.ravikoradiya.liveadapter.LiveAdapter;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.BR;
|
||||||
|
import it.integry.integrywmsnative.R;
|
||||||
|
import it.integry.integrywmsnative.core.di.BindableBoolean;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityBoolean;
|
||||||
|
import it.integry.integrywmsnative.databinding.LayoutFilterDescrBinding;
|
||||||
|
import it.integry.integrywmsnative.ui.filter_chips.FilterLayoutView;
|
||||||
|
|
||||||
|
public class FilterDescrLayoutView extends FilterLayoutView {
|
||||||
|
|
||||||
|
protected LayoutFilterDescrBinding mBindings;
|
||||||
|
|
||||||
|
private List<String> all;
|
||||||
|
private List<String> available;
|
||||||
|
private List<String> preselected = new ArrayList<>();
|
||||||
|
private List<String> hidden = new ArrayList<>();
|
||||||
|
private final MutableLiveData<List<ListModel>> listModel = new MutableLiveData<>();
|
||||||
|
|
||||||
|
private RunnableArgs<List<String>> onFilterApplied;
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
|
mBindings = DataBindingUtil.inflate(inflater, R.layout.layout_filter_descr, container, false);
|
||||||
|
this.mBindings.setView(this);
|
||||||
|
|
||||||
|
refreshList();
|
||||||
|
|
||||||
|
this.setSearchView(this.mBindings.searchView, newFilter -> {
|
||||||
|
hidden = Stream.of(all)
|
||||||
|
.filter(x -> !x.toUpperCase(Locale.ROOT).contains(newFilter.toUpperCase(Locale.ROOT)) &&
|
||||||
|
!x.toUpperCase(Locale.ROOT).contains(newFilter.toUpperCase(Locale.ROOT)))
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
refreshList();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
new LiveAdapter(listModel, getViewLifecycleOwner(), BR.item)
|
||||||
|
.map(ListModel.class, R.layout.layout_filter_descr__list_item)
|
||||||
|
.into(this.mBindings.recyclerview);
|
||||||
|
|
||||||
|
return mBindings.getRoot();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void onConfirm() {
|
||||||
|
if (onFilterApplied == null) return;
|
||||||
|
|
||||||
|
this.onFilterApplied.run(Stream.of(Objects.requireNonNull(listModel.getValue()))
|
||||||
|
.filter(x -> x.selected.get())
|
||||||
|
.map(x -> x.originalModel)
|
||||||
|
.toList());
|
||||||
|
|
||||||
|
dismiss();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshList() {
|
||||||
|
ComparatorCompat<ListModel> c =
|
||||||
|
ComparatorCompat
|
||||||
|
.chain(new ComparatorCompat<ListModel>((x, y) -> UtilityBoolean.toInt(x.getSelected().get()) - UtilityBoolean.toInt(y.getSelected().get())))
|
||||||
|
.thenComparing(new ComparatorCompat<>((x, y) -> UtilityBoolean.toInt(x.getEnabled().get()) - UtilityBoolean.toInt(y.getEnabled().get())))
|
||||||
|
.thenComparing(new ComparatorCompat<>((x, y) -> y.getOriginalModel().compareToIgnoreCase(x.getOriginalModel())))
|
||||||
|
.reversed();
|
||||||
|
|
||||||
|
|
||||||
|
listModel.setValue(Stream.of(getAll())
|
||||||
|
.filter(x -> !hidden.contains(x))
|
||||||
|
.map(x -> {
|
||||||
|
var selectedBoolean = new BindableBoolean(preselected.contains(x));
|
||||||
|
selectedBoolean.addOnPropertyChangedCallback(() -> {
|
||||||
|
if (selectedBoolean.get()) preselected.add(x);
|
||||||
|
else preselected.remove(x);
|
||||||
|
});
|
||||||
|
|
||||||
|
return new ListModel()
|
||||||
|
.setSelected(selectedBoolean)
|
||||||
|
.setEnabled(new BindableBoolean(available.contains(x)))
|
||||||
|
.setOriginalModel(x);
|
||||||
|
})
|
||||||
|
.sorted(c)
|
||||||
|
.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getAll() {
|
||||||
|
return all;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterDescrLayoutView setAll(List<String> all) {
|
||||||
|
this.all = all;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getAvailable() {
|
||||||
|
return available;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterDescrLayoutView setAvailable(List<String> available) {
|
||||||
|
this.available = available;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getPreselected() {
|
||||||
|
return preselected;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterDescrLayoutView setPreselected(List<String> preselected) {
|
||||||
|
this.preselected = preselected;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RunnableArgs<List<String>> getOnFilterApplied() {
|
||||||
|
return onFilterApplied;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterDescrLayoutView setOnFilterApplied(RunnableArgs<List<String>> onFilterApplied) {
|
||||||
|
this.onFilterApplied = onFilterApplied;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getHidden() {
|
||||||
|
return hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterDescrLayoutView setHidden(List<String> hidden) {
|
||||||
|
this.hidden = hidden;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class ListModel {
|
||||||
|
private BindableBoolean selected = new BindableBoolean();
|
||||||
|
private BindableBoolean enabled = new BindableBoolean();
|
||||||
|
private String originalModel;
|
||||||
|
|
||||||
|
public BindableBoolean getSelected() {
|
||||||
|
return selected;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ListModel setSelected(BindableBoolean selected) {
|
||||||
|
this.selected = selected;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BindableBoolean getEnabled() {
|
||||||
|
return enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ListModel setEnabled(BindableBoolean enabled) {
|
||||||
|
this.enabled = enabled;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOriginalModel() {
|
||||||
|
return originalModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ListModel setOriginalModel(String originalModel) {
|
||||||
|
this.originalModel = originalModel;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,186 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.accettazione_picking.filters;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.databinding.DataBindingUtil;
|
||||||
|
import androidx.lifecycle.MutableLiveData;
|
||||||
|
|
||||||
|
import com.annimon.stream.ComparatorCompat;
|
||||||
|
import com.annimon.stream.Stream;
|
||||||
|
import com.ravikoradiya.liveadapter.LiveAdapter;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.BR;
|
||||||
|
import it.integry.integrywmsnative.R;
|
||||||
|
import it.integry.integrywmsnative.core.di.BindableBoolean;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityBoolean;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||||
|
import it.integry.integrywmsnative.databinding.LayoutFilterPosizioneBinding;
|
||||||
|
import it.integry.integrywmsnative.ui.filter_chips.FilterLayoutView;
|
||||||
|
|
||||||
|
public class FilterPosizioneLayoutView extends FilterLayoutView {
|
||||||
|
|
||||||
|
protected LayoutFilterPosizioneBinding mBindings;
|
||||||
|
|
||||||
|
private List<String> all;
|
||||||
|
private List<String> available;
|
||||||
|
private List<String> preselected = new ArrayList<>();
|
||||||
|
private List<String> hidden = new ArrayList<>();
|
||||||
|
private final MutableLiveData<List<ListModel>> listModel = new MutableLiveData<>();
|
||||||
|
|
||||||
|
private RunnableArgs<List<String>> onFilterApplied;
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
|
mBindings = DataBindingUtil.inflate(inflater, R.layout.layout_filter_posizione, container, false);
|
||||||
|
this.mBindings.setView(this);
|
||||||
|
|
||||||
|
refreshList();
|
||||||
|
|
||||||
|
this.setSearchView(this.mBindings.searchView, newFilter -> {
|
||||||
|
hidden = Stream.of(all)
|
||||||
|
.filter(x -> !x.toUpperCase(Locale.ROOT).contains(newFilter.toUpperCase(Locale.ROOT)) &&
|
||||||
|
!x.toUpperCase(Locale.ROOT).contains(newFilter.toUpperCase(Locale.ROOT)))
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
refreshList();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
new LiveAdapter(listModel, getViewLifecycleOwner(), BR.item)
|
||||||
|
.map(ListModel.class, R.layout.layout_filter_posizione__list_item)
|
||||||
|
.into(this.mBindings.recyclerview);
|
||||||
|
|
||||||
|
return mBindings.getRoot();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void onConfirm() {
|
||||||
|
if (onFilterApplied == null) return;
|
||||||
|
|
||||||
|
this.onFilterApplied.run(Stream.of(Objects.requireNonNull(listModel.getValue()))
|
||||||
|
.filter(x -> x.selected.get())
|
||||||
|
.map(x -> x.originalModel)
|
||||||
|
.toList());
|
||||||
|
|
||||||
|
dismiss();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshList() {
|
||||||
|
ComparatorCompat<ListModel> c =
|
||||||
|
ComparatorCompat
|
||||||
|
.chain(new ComparatorCompat<ListModel>((x, y) -> UtilityBoolean.toInt(x.getSelected().get()) - UtilityBoolean.toInt(y.getSelected().get())))
|
||||||
|
.thenComparing(new ComparatorCompat<>((x, y) -> UtilityBoolean.toInt(x.getEnabled().get()) - UtilityBoolean.toInt(y.getEnabled().get())))
|
||||||
|
.thenComparing(new ComparatorCompat<>((x, y) ->
|
||||||
|
UtilityString.isNull(y.getOriginalModel(), "000000").compareToIgnoreCase(UtilityString.isNull(x.getOriginalModel(), "000000"))))
|
||||||
|
.reversed();
|
||||||
|
|
||||||
|
|
||||||
|
listModel.setValue(Stream.of(getAll())
|
||||||
|
.filter(x -> !hidden.contains(x))
|
||||||
|
.map(x -> {
|
||||||
|
var selectedBoolean = new BindableBoolean(preselected.contains(x));
|
||||||
|
selectedBoolean.addOnPropertyChangedCallback(() -> {
|
||||||
|
if (selectedBoolean.get()) preselected.add(x);
|
||||||
|
else preselected.remove(x);
|
||||||
|
});
|
||||||
|
|
||||||
|
return new ListModel()
|
||||||
|
.setSelected(selectedBoolean)
|
||||||
|
.setEnabled(new BindableBoolean(available.contains(x)))
|
||||||
|
.setOriginalModel(x);
|
||||||
|
})
|
||||||
|
.sorted(c)
|
||||||
|
.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getAll() {
|
||||||
|
return all;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterPosizioneLayoutView setAll(List<String> all) {
|
||||||
|
this.all = all;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getAvailable() {
|
||||||
|
return available;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterPosizioneLayoutView setAvailable(List<String> available) {
|
||||||
|
this.available = available;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getPreselected() {
|
||||||
|
return preselected;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterPosizioneLayoutView setPreselected(List<String> preselected) {
|
||||||
|
this.preselected = preselected;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RunnableArgs<List<String>> getOnFilterApplied() {
|
||||||
|
return onFilterApplied;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterPosizioneLayoutView setOnFilterApplied(RunnableArgs<List<String>> onFilterApplied) {
|
||||||
|
this.onFilterApplied = onFilterApplied;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getHidden() {
|
||||||
|
return hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterPosizioneLayoutView setHidden(List<String> hidden) {
|
||||||
|
this.hidden = hidden;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class ListModel {
|
||||||
|
private BindableBoolean selected = new BindableBoolean();
|
||||||
|
private BindableBoolean enabled = new BindableBoolean();
|
||||||
|
private String originalModel;
|
||||||
|
|
||||||
|
public BindableBoolean getSelected() {
|
||||||
|
return selected;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ListModel setSelected(BindableBoolean selected) {
|
||||||
|
this.selected = selected;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BindableBoolean getEnabled() {
|
||||||
|
return enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ListModel setEnabled(BindableBoolean enabled) {
|
||||||
|
this.enabled = enabled;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOriginalModel() {
|
||||||
|
return originalModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ListModel setOriginalModel(String originalModel) {
|
||||||
|
this.originalModel = originalModel;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -114,7 +114,7 @@ public class AccettazioneListAdapter extends SectionedRecyclerViewAdapter<Accett
|
|||||||
|
|
||||||
holder.mBinding.deactivatedOverBg.setVisibility(!pickingObjectDTO.isActive() ? View.VISIBLE : View.GONE);
|
holder.mBinding.deactivatedOverBg.setVisibility(!pickingObjectDTO.isActive() ? View.VISIBLE : View.GONE);
|
||||||
holder.mBinding.getRoot().setAlpha(!pickingObjectDTO.isActive() ? 0.8f : 1);
|
holder.mBinding.getRoot().setAlpha(!pickingObjectDTO.isActive() ? 0.8f : 1);
|
||||||
holder.mBinding.badge1.setBackground(ResourcesCompat.getDrawable(mContext.getResources(), !pickingObjectDTO.isActive() ? R.drawable.badge_gray_round_corner : R.drawable.badge1_round_corner, null));
|
holder.mBinding.badge1.setBackground(ResourcesCompat.getDrawable(mContext.getResources(), !pickingObjectDTO.isActive() ? R.drawable.badge_round_corner : R.drawable.badge1_round_corner, null));
|
||||||
holder.mBinding.qtaEvasa.setTextColor(ResourcesCompat.getColor(mContext.getResources(), !pickingObjectDTO.isActive() ? R.color.gray_600 : R.color.green_700, null));
|
holder.mBinding.qtaEvasa.setTextColor(ResourcesCompat.getColor(mContext.getResources(), !pickingObjectDTO.isActive() ? R.color.gray_600 : R.color.green_700, null));
|
||||||
|
|
||||||
holder.mBinding.descrizione.setText(pickingObjectDTO.getDescrizione());
|
holder.mBinding.descrizione.setText(pickingObjectDTO.getDescrizione());
|
||||||
@@ -125,6 +125,9 @@ public class AccettazioneListAdapter extends SectionedRecyclerViewAdapter<Accett
|
|||||||
holder.mBinding.badge2.setText(pickingObjectDTO.getBadge2());
|
holder.mBinding.badge2.setText(pickingObjectDTO.getBadge2());
|
||||||
holder.mBinding.badge2.setVisibility(UtilityString.isNullOrEmpty(pickingObjectDTO.getBadge2()) ? View.GONE : View.VISIBLE);
|
holder.mBinding.badge2.setVisibility(UtilityString.isNullOrEmpty(pickingObjectDTO.getBadge2()) ? View.GONE : View.VISIBLE);
|
||||||
|
|
||||||
|
holder.mBinding.badge3.setText(pickingObjectDTO.getPosizione());
|
||||||
|
holder.mBinding.badge3Layout.setVisibility(UtilityString.isNullOrEmpty(pickingObjectDTO.getPosizione()) ? View.GONE : View.VISIBLE);
|
||||||
|
|
||||||
|
|
||||||
holder.mBinding.qtaEvasa.setText(UtilityNumber.decimalToString(pickingObjectDTO.getQtaEvasa()));
|
holder.mBinding.qtaEvasa.setText(UtilityNumber.decimalToString(pickingObjectDTO.getQtaEvasa()));
|
||||||
holder.mBinding.qtaTot.setText(UtilityNumber.decimalToString(pickingObjectDTO.getQtaTot()));
|
holder.mBinding.qtaTot.setText(UtilityNumber.decimalToString(pickingObjectDTO.getQtaTot()));
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ public class AccettazioneListModel implements Cloneable {
|
|||||||
private BigDecimal secQtaTot;
|
private BigDecimal secQtaTot;
|
||||||
private String secUntMis;
|
private String secUntMis;
|
||||||
|
|
||||||
|
private String posizione;
|
||||||
|
|
||||||
private boolean active;
|
private boolean active;
|
||||||
|
|
||||||
private PickingObjectDTO mOriginalModel;
|
private PickingObjectDTO mOriginalModel;
|
||||||
@@ -154,6 +156,15 @@ public class AccettazioneListModel implements Cloneable {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getPosizione() {
|
||||||
|
return posizione;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AccettazioneListModel setPosizione(String posizione) {
|
||||||
|
this.posizione = posizione;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isActive() {
|
public boolean isActive() {
|
||||||
return active;
|
return active;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package it.integry.integrywmsnative.gest.contab_doc_interni;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.text.Html;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
@@ -26,17 +27,15 @@ import it.integry.integrywmsnative.core.data_store.db.wrappers.DocInternoWrapper
|
|||||||
import it.integry.integrywmsnative.core.expansion.BaseFragment;
|
import it.integry.integrywmsnative.core.expansion.BaseFragment;
|
||||||
import it.integry.integrywmsnative.core.interfaces.IScrollableFragment;
|
import it.integry.integrywmsnative.core.interfaces.IScrollableFragment;
|
||||||
import it.integry.integrywmsnative.core.interfaces.ITitledFragment;
|
import it.integry.integrywmsnative.core.interfaces.ITitledFragment;
|
||||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||||
import it.integry.integrywmsnative.databinding.FragmentDocInterniBinding;
|
import it.integry.integrywmsnative.databinding.FragmentDocInterniBinding;
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dialog.DialogSelectMgrpDtipPairView;
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dialog.DialogSelectDocInfoView;
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dialog.DialogSelectMgrpDtipPairViewModel;
|
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.GrigliaAcquistiDTO;
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.TipiDocAndGruppiArtDTO;
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.DocInterniSetupDTO;
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.DocInterniEditFormActivity;
|
import it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.DocInterniEditFormActivity;
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.ui.DocInterniListAdapter;
|
import it.integry.integrywmsnative.gest.contab_doc_interni.ui.DocInterniListAdapter;
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.ui.DocInterniListModel;
|
import it.integry.integrywmsnative.gest.contab_doc_interni.ui.DocInterniListModel;
|
||||||
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.PVOrdineAcquistoEditActivity;
|
|
||||||
import it.integry.integrywmsnative.gest.spedizione.ui.SpedizioneListAdapter;
|
|
||||||
import it.integry.integrywmsnative.ui.ElevatedToolbar;
|
import it.integry.integrywmsnative.ui.ElevatedToolbar;
|
||||||
|
|
||||||
public class DocInterniFragment extends BaseFragment implements ITitledFragment, IScrollableFragment, DocInterniViewModel.Listener {
|
public class DocInterniFragment extends BaseFragment implements ITitledFragment, IScrollableFragment, DocInterniViewModel.Listener {
|
||||||
@@ -47,7 +46,7 @@ public class DocInterniFragment extends BaseFragment implements ITitledFragment,
|
|||||||
private final ObservableArrayList<DocInterniListModel> mDocInterniMutableData = new ObservableArrayList<>();
|
private final ObservableArrayList<DocInterniListModel> mDocInterniMutableData = new ObservableArrayList<>();
|
||||||
private ElevatedToolbar mToolbar;
|
private ElevatedToolbar mToolbar;
|
||||||
private FragmentDocInterniBinding mBinding;
|
private FragmentDocInterniBinding mBinding;
|
||||||
private TipiDocAndGruppiArtDTO mTipiDocAndGruppiArtDTO;
|
private DocInterniSetupDTO mDocInterniSetupDTO;
|
||||||
private final List<Runnable> mOnPreDestroyList = new ArrayList<>();
|
private final List<Runnable> mOnPreDestroyList = new ArrayList<>();
|
||||||
private boolean dialogInitialized = false;
|
private boolean dialogInitialized = false;
|
||||||
|
|
||||||
@@ -82,6 +81,8 @@ public class DocInterniFragment extends BaseFragment implements ITitledFragment,
|
|||||||
mBinding.setLifecycleOwner(this);
|
mBinding.setLifecycleOwner(this);
|
||||||
mBinding.setView(this);
|
mBinding.setView(this);
|
||||||
mBinding.setViewModel(mViewModel);
|
mBinding.setViewModel(mViewModel);
|
||||||
|
mViewModel.mtbGrup.observe(getViewLifecycleOwner(),mtbGrup-> mViewModel.fetchProducts());
|
||||||
|
mViewModel.dtbTipi.observe(getViewLifecycleOwner(),dtbTipi-> mViewModel.fetchDocuments());
|
||||||
this.initRecyclerView();
|
this.initRecyclerView();
|
||||||
|
|
||||||
return mBinding.getRoot();
|
return mBinding.getRoot();
|
||||||
@@ -106,17 +107,41 @@ public class DocInterniFragment extends BaseFragment implements ITitledFragment,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onGruppiArtAndTipiDocFetch(TipiDocAndGruppiArtDTO tipiDocAndGruppiArtDTO) {
|
public void onDocInterniSetupFetched(DocInterniSetupDTO docInterniSetupDTO) {
|
||||||
this.mTipiDocAndGruppiArtDTO = tipiDocAndGruppiArtDTO;
|
this.mDocInterniSetupDTO = docInterniSetupDTO;
|
||||||
this.dialogInitialized = true;
|
this.dialogInitialized = true;
|
||||||
this.selectCodMgrpAndCodDtip();
|
this.selectDocInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDocDetailsChanged(DialogSelectMgrpDtipPairViewModel selection) {
|
public void onDocDetailsChanged(DialogSelectDocInfoViewModel selection) {
|
||||||
|
if(selection.isInputValid()){
|
||||||
|
mViewModel.setSelectedDocDetails(selection);
|
||||||
|
mBinding.mainFab.setVisibility(View.VISIBLE);
|
||||||
|
}else{
|
||||||
|
mBinding.mainFab.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (selection.requiresFornitore()){
|
||||||
|
mBinding.codAnagContainer.setVisibility(View.VISIBLE);
|
||||||
|
}else{
|
||||||
|
mBinding.codAnagContainer.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (selection.getSelectedGruppoArt() != null){
|
||||||
|
mBinding.mtbGrpContainer.setVisibility(View.VISIBLE);
|
||||||
|
}else{
|
||||||
|
mBinding.mtbGrpContainer.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (selection.requiresDocData()){
|
||||||
|
mBinding.docContainer.setVisibility(View.VISIBLE);
|
||||||
|
mBinding.document.setText(Html.fromHtml(getString(R.string.doc_testata, String.valueOf(selection.getNumDoc()), UtilityDate.formatDate(selection.getDataDoc(), UtilityDate.COMMONS_DATE_FORMATS.DMY_HUMAN))));
|
||||||
|
}else{
|
||||||
|
mBinding.docContainer.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
this.mViewModel.setSelectedDocDetails(selection);
|
|
||||||
this.mBinding.mainFab.setVisibility(View.VISIBLE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -129,12 +154,16 @@ public class DocInterniFragment extends BaseFragment implements ITitledFragment,
|
|||||||
this.mOnPreDestroyList.add(onPreDestroy);
|
this.mOnPreDestroyList.add(onPreDestroy);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void selectCodMgrpAndCodDtip() {
|
public void selectDocInfo() {
|
||||||
if (this.dialogInitialized){
|
if (this.dialogInitialized){
|
||||||
DialogSelectMgrpDtipPairView.newInstance(
|
DialogSelectDocInfoView.newInstance(
|
||||||
mTipiDocAndGruppiArtDTO,
|
mDocInterniSetupDTO,
|
||||||
this.mViewModel.dtbTipi.getValue(),
|
this.mViewModel.dtbTipi.getValue(),
|
||||||
this.mViewModel.mtbGrup.getValue(),
|
this.mViewModel.mtbGrup.getValue(),
|
||||||
|
this.mViewModel.fornitore.getValue(),
|
||||||
|
this.mViewModel.dataDoc.getValue(),
|
||||||
|
this.mViewModel.numDoc.getValue(),
|
||||||
|
this.mViewModel.note.getValue(),
|
||||||
this::onDocDetailsChanged
|
this::onDocDetailsChanged
|
||||||
).show(requireActivity().getSupportFragmentManager(), "tag");
|
).show(requireActivity().getSupportFragmentManager(), "tag");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ package it.integry.integrywmsnative.gest.contab_doc_interni;
|
|||||||
|
|
||||||
import androidx.lifecycle.MutableLiveData;
|
import androidx.lifecycle.MutableLiveData;
|
||||||
|
|
||||||
|
import com.annimon.stream.Stream;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -14,29 +16,33 @@ import it.integry.integrywmsnative.core.data_store.db.wrappers.DocInternoWrapper
|
|||||||
import it.integry.integrywmsnative.core.di.BindableInteger;
|
import it.integry.integrywmsnative.core.di.BindableInteger;
|
||||||
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
|
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
|
||||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dialog.DialogSelectMgrpDtipPairViewModel;
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dialog.DialogSelectDocInfoViewModel;
|
||||||
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.FornitoreDTO;
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.GrigliaAcquistiDTO;
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.GrigliaAcquistiDTO;
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.GruppiArticoloDTO;
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.GruppiArticoloDTO;
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.TipiDocAndGruppiArtDTO;
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.DocInterniSetupDTO;
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.TipiDocDTO;
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.TipiDocDTO;
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.rest.DocInterniRESTConsumer;
|
import it.integry.integrywmsnative.gest.contab_doc_interni.rest.DocInterniRESTConsumer;
|
||||||
|
|
||||||
public class DocInterniViewModel {
|
public class DocInterniViewModel {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
MtbColtRepository documentRepository;
|
||||||
private Listener mListener;
|
private Listener mListener;
|
||||||
private final DocInterniRESTConsumer mDocInterniRESTConsumer;
|
private final DocInterniRESTConsumer mDocInterniRESTConsumer;
|
||||||
private boolean productsFetched = true;
|
private boolean productsFetched = true;
|
||||||
private boolean docsFetched = true;
|
private boolean docsFetched = true;
|
||||||
private int nextNumCollo = 0;
|
private int nextNumCollo = 0;
|
||||||
private GrigliaAcquistiDTO productsList;
|
private GrigliaAcquistiDTO productsList;
|
||||||
|
private final MutableLiveData<List<DocInternoWrapper>> mDocsList = new MutableLiveData<>();
|
||||||
|
|
||||||
public final MutableLiveData<TipiDocDTO> dtbTipi = new MutableLiveData<>();
|
public final MutableLiveData<TipiDocDTO> dtbTipi = new MutableLiveData<>();
|
||||||
public final MutableLiveData<GruppiArticoloDTO> mtbGrup = new MutableLiveData<>();
|
public final MutableLiveData<GruppiArticoloDTO> mtbGrup = new MutableLiveData<>();
|
||||||
private final MutableLiveData<List<DocInternoWrapper>> mDocsList = new MutableLiveData<>();
|
public final MutableLiveData<FornitoreDTO> fornitore = new MutableLiveData<>();
|
||||||
|
public final MutableLiveData<Date> dataDoc = new MutableLiveData<>();
|
||||||
|
public final MutableLiveData<String> numDoc = new MutableLiveData<>();
|
||||||
|
public final MutableLiveData<String> note = new MutableLiveData<>();
|
||||||
public final BindableInteger artsSize = new BindableInteger(0);
|
public final BindableInteger artsSize = new BindableInteger(0);
|
||||||
@Inject
|
|
||||||
MtbColtRepository documentRepository;
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public DocInterniViewModel(DocInterniRESTConsumer docInterniRESTConsumer, MtbColtRepository documentRepository) {
|
public DocInterniViewModel(DocInterniRESTConsumer docInterniRESTConsumer, MtbColtRepository documentRepository) {
|
||||||
@@ -49,9 +55,9 @@ public class DocInterniViewModel {
|
|||||||
public void init() {
|
public void init() {
|
||||||
this.sendOnLoadingStarted();
|
this.sendOnLoadingStarted();
|
||||||
// new Thread(() -> {
|
// new Thread(() -> {
|
||||||
mDocInterniRESTConsumer.getDocTypesAndGroupArts(returnDto -> {
|
mDocInterniRESTConsumer.getDocInterniSetup(returnDto -> {
|
||||||
this.sendOnLoadingEnded();
|
this.sendOnLoadingEnded();
|
||||||
this.mListener.onGruppiArtAndTipiDocFetch(returnDto);
|
this.mListener.onDocInterniSetupFetched(returnDto);
|
||||||
}, this::sendError);
|
}, this::sendError);
|
||||||
// }).start();
|
// }).start();
|
||||||
}
|
}
|
||||||
@@ -77,20 +83,23 @@ public class DocInterniViewModel {
|
|||||||
return mDocsList;
|
return mDocsList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSelectedDocDetails(DialogSelectMgrpDtipPairViewModel selection) {
|
public void setSelectedDocDetails(DialogSelectDocInfoViewModel selection) {
|
||||||
if (selection.getSelectedGruppoArt() != null && selection.getSelectedTipoDoc() != null) {
|
|
||||||
if (this.dtbTipi.getValue() == null || this.mtbGrup.getValue() == null || !this.dtbTipi.getValue().equals(selection.getSelectedTipoDoc()) || !this.mtbGrup.getValue().equals(selection.getSelectedGruppoArt())) {
|
this.fornitore.postValue(selection.getSelectedFornitore());
|
||||||
this.dtbTipi.setValue(selection.getSelectedTipoDoc());
|
this.mtbGrup.postValue(selection.getSelectedGruppoArt());
|
||||||
this.mtbGrup.setValue(selection.getSelectedGruppoArt());
|
this.dataDoc.postValue(selection.getDataDoc());
|
||||||
this.fetchProducts();
|
this.numDoc.postValue(selection.getNumDoc());
|
||||||
this.fetchDocuments();
|
this.note.postValue(selection.getNote());
|
||||||
}
|
|
||||||
|
if (selection.getSelectedTipoDoc() != null ) {
|
||||||
|
this.dtbTipi.postValue(selection.getSelectedTipoDoc());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void fetchProducts() {
|
public void fetchProducts() {
|
||||||
this.productsFetched = false;
|
this.productsFetched = false;
|
||||||
mDocInterniRESTConsumer.fetchProducts(this.dtbTipi.getValue().getCodDtip(), this.mtbGrup.getValue().getCodMgrp(), returnDto -> {
|
this.sendOnLoadingStarted();
|
||||||
|
mDocInterniRESTConsumer.fetchProducts(this.getCodDtip(), this.getCodMgrp(), returnDto -> {
|
||||||
this.productsFetched = true;
|
this.productsFetched = true;
|
||||||
this.productsList = returnDto;
|
this.productsList = returnDto;
|
||||||
this.artsSize.set(returnDto.getGrigliaAcquistiChild().size());
|
this.artsSize.set(returnDto.getGrigliaAcquistiChild().size());
|
||||||
@@ -103,16 +112,22 @@ public class DocInterniViewModel {
|
|||||||
public void fetchDocuments() {
|
public void fetchDocuments() {
|
||||||
this.docsFetched = false;
|
this.docsFetched = false;
|
||||||
this.sendOnLoadingStarted();
|
this.sendOnLoadingStarted();
|
||||||
documentRepository.getLocalDocumentsByCodDtipAndCodMgrp(this.getCodDtip(), this.getCodMgrp(), list -> {
|
String codAnag = null, codVdes = null;
|
||||||
documentRepository.getNextNumCollo(nextNumCollo->{
|
FornitoreDTO fornitore = this.fornitore.getValue();
|
||||||
|
if (fornitore != null){
|
||||||
|
codAnag = fornitore.getCodAnag();
|
||||||
|
codVdes = fornitore.getCodVdes();
|
||||||
|
}
|
||||||
|
documentRepository.getLocalDocumentsByCodDtip(this.getCodDtip(), codAnag, codVdes, dataDoc.getValue(),numDoc.getValue(), list -> {
|
||||||
|
documentRepository.getNextNumCollo(nextNumCollo -> {
|
||||||
this.mDocsList.postValue(list);
|
this.mDocsList.postValue(list);
|
||||||
this.setNextNumCollo(nextNumCollo);
|
this.setNextNumCollo(nextNumCollo);
|
||||||
this.docsFetched = true;
|
this.docsFetched = true;
|
||||||
if (this.productsFetched) {
|
if (this.productsFetched) {
|
||||||
this.sendOnLoadingEnded();
|
this.sendOnLoadingEnded();
|
||||||
}
|
}
|
||||||
},this::sendError);
|
}, this::sendError);
|
||||||
},this::sendError);
|
}, this::sendError);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setNextNumCollo(Integer nextNumCollo) {
|
private void setNextNumCollo(Integer nextNumCollo) {
|
||||||
@@ -147,28 +162,36 @@ public class DocInterniViewModel {
|
|||||||
document.setCodMgrp(this.getCodMgrp());
|
document.setCodMgrp(this.getCodMgrp());
|
||||||
document.setDataCollo(new Date());
|
document.setDataCollo(new Date());
|
||||||
document.setCodMdep(SettingsManager.i().getUserSession().getDepo().getCodMdep());
|
document.setCodMdep(SettingsManager.i().getUserSession().getDepo().getCodMdep());
|
||||||
document.setAnnotazioni("");
|
document.setAnnotazioni(this.note.getValue());
|
||||||
document.setSegno(-1);
|
document.setSegno(-1);
|
||||||
document.setSerCollo("/");
|
document.setSerCollo("/");
|
||||||
document.setNumCollo(this.nextNumCollo);
|
document.setNumCollo(this.nextNumCollo);
|
||||||
document.setGestione("L");
|
document.setGestione("L");
|
||||||
documentRepository.insert(document,id->{
|
document.setDataDoc(this.dataDoc.getValue());
|
||||||
|
if (this.numDoc.getValue() != null){
|
||||||
|
document.setNumDoc(Integer.parseInt(this.numDoc.getValue()));
|
||||||
|
}
|
||||||
|
if (this.fornitore.getValue() != null){
|
||||||
|
document.setCodAnag(this.fornitore.getValue().getCodAnag());
|
||||||
|
document.setCodVdes(this.fornitore.getValue().getCodVdes());
|
||||||
|
}
|
||||||
|
documentRepository.insert(document, id -> {
|
||||||
document.setId(id);
|
document.setId(id);
|
||||||
this.editDocument(document);
|
this.editDocument(document);
|
||||||
}, this::sendError);
|
}, this::sendError);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasDocDetails() {
|
public boolean hasDocDetails() {
|
||||||
return this.dtbTipi.getValue() != null && this.mtbGrup.getValue() != null;
|
return this.dtbTipi.getValue() != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface Listener extends ILoadingListener {
|
public interface Listener extends ILoadingListener {
|
||||||
|
|
||||||
void onError(Exception ex);
|
void onError(Exception ex);
|
||||||
|
|
||||||
void onGruppiArtAndTipiDocFetch(TipiDocAndGruppiArtDTO tipiDocAndGruppiArtDTO);
|
void onDocInterniSetupFetched(DocInterniSetupDTO docInterniSetupDTO);
|
||||||
|
|
||||||
void onDocDetailsChanged(DialogSelectMgrpDtipPairViewModel selection);
|
void onDocDetailsChanged(DialogSelectDocInfoViewModel selection);
|
||||||
|
|
||||||
void onDocumentEditRequest(SqlMtbColt document, GrigliaAcquistiDTO arts);
|
void onDocumentEditRequest(SqlMtbColt document, GrigliaAcquistiDTO arts);
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.contab_doc_interni.dialog;
|
||||||
|
|
||||||
|
import dagger.Subcomponent;
|
||||||
|
|
||||||
|
@Subcomponent
|
||||||
|
public interface DialogSelectDocInfoComponent {
|
||||||
|
|
||||||
|
@Subcomponent.Factory
|
||||||
|
interface Factory {
|
||||||
|
DialogSelectDocInfoComponent create();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void inject(DialogSelectDocInfoView dialogSelectDocInfoView);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.contab_doc_interni.dialog;
|
||||||
|
|
||||||
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
|
import dagger.Module;
|
||||||
|
import dagger.Provides;
|
||||||
|
|
||||||
|
@Module(subcomponents = DialogSelectDocInfoComponent.class)
|
||||||
|
public class DialogSelectDocInfoModule {
|
||||||
|
|
||||||
|
@Singleton
|
||||||
|
@Provides
|
||||||
|
DialogSelectDocInfoViewModel dialogSelectMgrpDtipPairViewModel() {
|
||||||
|
return new DialogSelectDocInfoViewModel();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,240 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.contab_doc_interni.dialog;
|
||||||
|
|
||||||
|
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.view.WindowManager;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.databinding.DataBindingUtil;
|
||||||
|
import androidx.databinding.ObservableField;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.MainApplication;
|
||||||
|
import it.integry.integrywmsnative.R;
|
||||||
|
import it.integry.integrywmsnative.core.di.BindableString;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityObservable;
|
||||||
|
import it.integry.integrywmsnative.databinding.DialogSelectDocInfoBinding;
|
||||||
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.FornitoreDTO;
|
||||||
|
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;
|
||||||
|
|
||||||
|
public class DialogSelectDocInfoView extends BaseDialogFragment implements DialogSelectDocInfoViewModel.Listener {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
DialogSelectDocInfoViewModel mViewModel;
|
||||||
|
private Context mCurrentContext;
|
||||||
|
|
||||||
|
|
||||||
|
public BindableString codDtip = new BindableString();
|
||||||
|
public BindableString codMgrp = new BindableString();
|
||||||
|
public BindableString codAnag = new BindableString();
|
||||||
|
public BindableString numDoc = new BindableString();
|
||||||
|
public BindableString note = new BindableString();
|
||||||
|
public ObservableField<Date> dataDoc = new ObservableField<>();
|
||||||
|
|
||||||
|
private ArrayAdapter<String> arrayAdapterCodDtips;
|
||||||
|
private ArrayAdapter<String> arrayAdapterCodMgrps;
|
||||||
|
private ArrayAdapter<String> arrayAdapterCodAnags;
|
||||||
|
private ArrayAdapter<String> arrayAdapterNote;
|
||||||
|
private DialogSelectDocInfoBinding mBindings;
|
||||||
|
|
||||||
|
private final RunnableArgs<DialogSelectDocInfoViewModel> currentOnFilterDone;
|
||||||
|
private final DocInterniSetupDTO docInterniSetupDTO;
|
||||||
|
private final TipiDocDTO selectedDtip;
|
||||||
|
private final GruppiArticoloDTO selectedGrp;
|
||||||
|
private final FornitoreDTO selectedAnag;
|
||||||
|
private final Date selectedDataDoc;
|
||||||
|
private final String selectedNumDoc;
|
||||||
|
private final String selectedNote;
|
||||||
|
|
||||||
|
public static DialogSelectDocInfoView newInstance(
|
||||||
|
DocInterniSetupDTO docInterniSetupDTO,
|
||||||
|
TipiDocDTO tipiDocDTO,
|
||||||
|
GruppiArticoloDTO gruppiArticoloDTO,
|
||||||
|
FornitoreDTO fornitoreDTO,
|
||||||
|
Date dataDoc,
|
||||||
|
String numDoc,
|
||||||
|
String note,
|
||||||
|
RunnableArgs<DialogSelectDocInfoViewModel> onDismiss
|
||||||
|
) {
|
||||||
|
return new DialogSelectDocInfoView(docInterniSetupDTO, tipiDocDTO, gruppiArticoloDTO, fornitoreDTO, dataDoc, numDoc,note, onDismiss);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private DialogSelectDocInfoView(DocInterniSetupDTO docInterniSetupDTO,
|
||||||
|
TipiDocDTO tipiDocDTO,
|
||||||
|
GruppiArticoloDTO gruppiArticoloDTO,
|
||||||
|
FornitoreDTO fornitoreDTO,
|
||||||
|
Date dataDoc,
|
||||||
|
String numDoc,
|
||||||
|
String note,
|
||||||
|
RunnableArgs<DialogSelectDocInfoViewModel> onDismiss) {
|
||||||
|
super();
|
||||||
|
currentOnFilterDone = onDismiss;
|
||||||
|
this.docInterniSetupDTO = docInterniSetupDTO;
|
||||||
|
selectedDtip = tipiDocDTO;
|
||||||
|
selectedGrp = gruppiArticoloDTO;
|
||||||
|
selectedDataDoc = dataDoc;
|
||||||
|
selectedNumDoc = numDoc;
|
||||||
|
selectedNote = note;
|
||||||
|
selectedAnag = fornitoreDTO;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDismiss(@NonNull DialogInterface dialog) {
|
||||||
|
super.onDismiss(dialog);
|
||||||
|
if (currentOnFilterDone != null) currentOnFilterDone.run(mViewModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
|
this.mCurrentContext = this.requireActivity();
|
||||||
|
|
||||||
|
mBindings = DataBindingUtil.inflate(inflater, R.layout.dialog_select_doc_info, container, false);
|
||||||
|
mBindings.setLifecycleOwner(this);
|
||||||
|
|
||||||
|
MainApplication
|
||||||
|
.appComponent
|
||||||
|
.dialogSelectMgrpDtipPairComponent()
|
||||||
|
.create()
|
||||||
|
.inject(this);
|
||||||
|
mViewModel.init(docInterniSetupDTO);
|
||||||
|
mViewModel.setListeners(this);
|
||||||
|
mBindings.setView(this);
|
||||||
|
mBindings.setViewmodel(mViewModel);
|
||||||
|
|
||||||
|
getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
|
||||||
|
getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||||
|
initView();
|
||||||
|
|
||||||
|
|
||||||
|
mBindings.positiveBtn.setOnClickListener(view -> {
|
||||||
|
if (this.isInputValid()) {
|
||||||
|
getDialog().dismiss();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
return mBindings.getRoot();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initView() {
|
||||||
|
initArrayAdapters();
|
||||||
|
initBindables();
|
||||||
|
|
||||||
|
if (selectedDtip != null) {
|
||||||
|
codDtip.set(selectedDtip.getLabel());
|
||||||
|
}
|
||||||
|
if (selectedGrp != null) {
|
||||||
|
codMgrp.set(selectedGrp.getLabel());
|
||||||
|
}
|
||||||
|
if (selectedAnag != null) {
|
||||||
|
codAnag.set(selectedAnag.getLabel());
|
||||||
|
}
|
||||||
|
if (selectedDataDoc != null) {
|
||||||
|
dataDoc.set(selectedDataDoc);
|
||||||
|
}
|
||||||
|
if (selectedNumDoc != null) {
|
||||||
|
numDoc.set(selectedNumDoc);
|
||||||
|
}
|
||||||
|
if (selectedNote != null) {
|
||||||
|
note.set(selectedNote);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isInputValid() {
|
||||||
|
if (this.mViewModel.getSelectedTipoDoc() == null) {
|
||||||
|
mBindings.inputCodDtip.setErrorEnabled(true);
|
||||||
|
mBindings.inputCodDtip.setError("Seleziona un tipo documento");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.mViewModel.requiresFornitore() && this.mViewModel.getSelectedFornitore() == null) {
|
||||||
|
mBindings.inputCodAnagForn.setErrorEnabled(true);
|
||||||
|
mBindings.inputCodAnagForn.setError("Seleziona un fornitore/destinatario");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.mViewModel.requiresDocData() && this.mViewModel.getDataDoc() == null){
|
||||||
|
mBindings.inputDataDoc.setError("Seleziona la data del documento");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.mViewModel.requiresDocData() && (this.mViewModel.getNumDoc() == null || this.mViewModel.getNumDoc().isEmpty() )){
|
||||||
|
mBindings.inputNumDoc.setError("Seleziona il numero del documento");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.mViewModel.requiresNote() && (this.mViewModel.getNote() == null || this.mViewModel.getNote().isEmpty() )){
|
||||||
|
mBindings.inputNoteLayout.setErrorEnabled(true);
|
||||||
|
mBindings.inputNoteLayout.setError("Specifica delle note per il documento");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initArrayAdapters() {
|
||||||
|
|
||||||
|
arrayAdapterCodDtips = new ArrayAdapter<>(mCurrentContext, R.layout.dialog_select_doc_info__single_item);
|
||||||
|
arrayAdapterCodDtips.addAll(mViewModel.getAvailableCodDtips());
|
||||||
|
mBindings.filledExposedDropdownCodDtips.setAdapter(arrayAdapterCodDtips);
|
||||||
|
|
||||||
|
arrayAdapterCodMgrps = new ArrayAdapter<>(mCurrentContext, R.layout.dialog_select_doc_info__single_item);
|
||||||
|
arrayAdapterCodMgrps.addAll(mViewModel.getAvailableCodMgrps());
|
||||||
|
mBindings.filledExposedDropdownCodMgrps.setAdapter(arrayAdapterCodMgrps);
|
||||||
|
|
||||||
|
arrayAdapterCodAnags = new ArrayAdapter<>(mCurrentContext, R.layout.dialog_select_doc_info__single_item);
|
||||||
|
arrayAdapterCodAnags.addAll(mViewModel.getAvailableFornitori());
|
||||||
|
mBindings.filledExposedDropdownCodAnagList.setAdapter(arrayAdapterCodAnags);
|
||||||
|
|
||||||
|
arrayAdapterNote = new ArrayAdapter<>(mCurrentContext, R.layout.dialog_select_doc_info__single_item);
|
||||||
|
arrayAdapterNote.addAll(mViewModel.getAdditionalNotes());
|
||||||
|
mBindings.filledExposedDropdownNote.setAdapter(arrayAdapterNote);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initBindables() {
|
||||||
|
BindableString.registerListener(codDtip, codDtip -> {
|
||||||
|
mViewModel.setCodDtip(codDtip);
|
||||||
|
mBindings.inputCodAnagForn.setVisibility(mViewModel.requiresFornitore() ? View.VISIBLE : View.GONE);
|
||||||
|
mBindings.inputDataDocLayout.setVisibility(mViewModel.requiresDocData() ? View.VISIBLE : View.GONE);
|
||||||
|
mBindings.inputNumDocLayout.setVisibility(mViewModel.requiresDocData() ? View.VISIBLE : View.GONE);
|
||||||
|
mBindings.inputNoteLayout.setVisibility(mViewModel.requiresNote() ? View.VISIBLE : View.GONE);
|
||||||
|
});
|
||||||
|
BindableString.registerListener(codMgrp, mViewModel::setCodMgrp);
|
||||||
|
BindableString.registerListener(codAnag, mViewModel::setCodAnag);
|
||||||
|
BindableString.registerListener(numDoc, mViewModel::setNumDoc);
|
||||||
|
BindableString.registerListener(note, mViewModel::setNote);
|
||||||
|
UtilityObservable.addPropertyChanged(this.dataDoc, (value) -> {
|
||||||
|
this.mViewModel.setDataDoc(value);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDocTypeSelected() {
|
||||||
|
arrayAdapterCodAnags.clear();
|
||||||
|
if (mViewModel.getSelectedFornitore() != null && !mViewModel.getAvailableFornitori().contains(mViewModel.getSelectedFornitore().getLabel())) {
|
||||||
|
codAnag.set("");
|
||||||
|
}
|
||||||
|
if (mViewModel.getNote() != null && ! mViewModel.requiresNote()){
|
||||||
|
mViewModel.setNote(null);
|
||||||
|
}
|
||||||
|
arrayAdapterCodAnags.addAll(mViewModel.getAvailableFornitori());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,195 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.contab_doc_interni.dialog;
|
||||||
|
|
||||||
|
import com.annimon.stream.Stream;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColt;
|
||||||
|
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
|
||||||
|
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||||
|
import it.integry.integrywmsnative.gest.contab_doc_interni.DocInterniViewModel;
|
||||||
|
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;
|
||||||
|
|
||||||
|
|
||||||
|
public class DialogSelectDocInfoViewModel {
|
||||||
|
|
||||||
|
|
||||||
|
private DocInterniSetupDTO mDocInterniSetupDTO;
|
||||||
|
|
||||||
|
private String mTipoDoc;
|
||||||
|
|
||||||
|
private String mGruppoArt;
|
||||||
|
|
||||||
|
private String mFornitore;
|
||||||
|
|
||||||
|
private Date mDataDoc;
|
||||||
|
|
||||||
|
private String mNumDoc;
|
||||||
|
|
||||||
|
private String mNote;
|
||||||
|
|
||||||
|
private Listener mListener;
|
||||||
|
|
||||||
|
public void init(DocInterniSetupDTO initialList) {
|
||||||
|
this.mDocInterniSetupDTO = initialList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCodDtip() {
|
||||||
|
return mTipoDoc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCodDtip(String codDtip) {
|
||||||
|
this.mTipoDoc = codDtip;
|
||||||
|
if (this.getSelectedTipoDoc() != null) {
|
||||||
|
this.mListener.onDocTypeSelected();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCodMgrp() {
|
||||||
|
return mGruppoArt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCodMgrp(String codMgrp) {
|
||||||
|
this.mGruppoArt = codMgrp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCodAnag(String codAnag) {
|
||||||
|
this.mFornitore = codAnag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDataDoc() {
|
||||||
|
return mDataDoc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDataDoc(Date mDataDoc) {
|
||||||
|
this.mDataDoc = mDataDoc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNumDoc() {
|
||||||
|
return mNumDoc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNumDoc(String numDoc) {
|
||||||
|
this.mNumDoc = numDoc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNote() {
|
||||||
|
return mNote;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DialogSelectDocInfoViewModel setNote(String note) {
|
||||||
|
this.mNote = note;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DialogSelectDocInfoViewModel setListeners(Listener listener) {
|
||||||
|
this.mListener = listener;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getAvailableCodDtips() {
|
||||||
|
return Stream.of(mDocInterniSetupDTO.getTipiDoc()).map(TipiDocDTO::getLabel).toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getAvailableCodMgrps() {
|
||||||
|
return Stream.of(mDocInterniSetupDTO.getGruppiArt()).map(GruppiArticoloDTO::getLabel).toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getAvailableFornitori() {
|
||||||
|
if (!this.requiresFornitore()) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
TipiDocDTO selectedDocType = getSelectedTipoDoc();
|
||||||
|
|
||||||
|
return Stream.of(mDocInterniSetupDTO.getFornitori())
|
||||||
|
.filter(forn -> {
|
||||||
|
if (selectedDocType.getGestioneDoc().equalsIgnoreCase("T")) {
|
||||||
|
return forn.getTipoAnag().equalsIgnoreCase("D") &&
|
||||||
|
forn.getGestioneAnag().equalsIgnoreCase(
|
||||||
|
selectedDocType.getGestione().equalsIgnoreCase("V") ? "V" : "A"
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return forn.getTipoAnag().equalsIgnoreCase("F") ;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.map(FornitoreDTO::getLabel).toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public TipiDocDTO getSelectedTipoDoc() {
|
||||||
|
return Stream.of(mDocInterniSetupDTO.getTipiDoc()).filter(x -> x.getLabel().equals(mTipoDoc)).findFirstOrElse(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public FornitoreDTO getSelectedFornitore() {
|
||||||
|
return Stream.of(mDocInterniSetupDTO.getFornitori()).filter(x -> x.getLabel().equals(mFornitore)).findFirstOrElse(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public GruppiArticoloDTO getSelectedGruppoArt() {
|
||||||
|
if (mGruppoArt == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Stream.of(mDocInterniSetupDTO.getGruppiArt()).filter(x -> x.getLabel().equals(mGruppoArt)).findFirstOrElse(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean requiresFornitore() {
|
||||||
|
return this.getSelectedTipoDoc() != null && (
|
||||||
|
this.getSelectedTipoDoc().getGestioneDoc().equals("T") ||
|
||||||
|
this.getSelectedTipoDoc().getGestioneDoc().equals("A") ||
|
||||||
|
(
|
||||||
|
this.getSelectedTipoDoc().getGestioneDoc().equals("P") &&
|
||||||
|
!this.getSelectedTipoDoc().getGestione().equals("L")
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean requiresNote() {
|
||||||
|
return this.getSelectedTipoDoc() != null &&
|
||||||
|
this.getSelectedTipoDoc().getGestioneDoc().equals("P") &&
|
||||||
|
this.getSelectedTipoDoc().getGestione().equals("L")
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isInputValid() {
|
||||||
|
if (this.getSelectedTipoDoc() == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.requiresFornitore() && this.getSelectedFornitore() == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.requiresDocData() && (this.getDataDoc() == null || this.getNumDoc() == null)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (this.requiresNote() && (this.getNote() == null || this.getNote().length() <= 0) ){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean requiresDocData() {
|
||||||
|
TipiDocDTO doc = this.getSelectedTipoDoc();
|
||||||
|
return doc != null && doc.getGestioneDoc().equalsIgnoreCase("P") && !doc.getGestione().equalsIgnoreCase("L");
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getAdditionalNotes() {
|
||||||
|
return SettingsManager.iDB().getNotePerditaDocInterni();
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface Listener extends ILoadingListener {
|
||||||
|
|
||||||
|
void onError(Exception ex);
|
||||||
|
|
||||||
|
void onDocTypeSelected();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
package it.integry.integrywmsnative.gest.contab_doc_interni.dialog;
|
|
||||||
|
|
||||||
import dagger.Subcomponent;
|
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.DocInterniFragment;
|
|
||||||
|
|
||||||
@Subcomponent
|
|
||||||
public interface DialogSelectMgrpDtipPairComponent {
|
|
||||||
|
|
||||||
@Subcomponent.Factory
|
|
||||||
interface Factory {
|
|
||||||
DialogSelectMgrpDtipPairComponent create();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void inject(DialogSelectMgrpDtipPairView dialogSelectMgrpDtipPairView);
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
package it.integry.integrywmsnative.gest.contab_doc_interni.dialog;
|
|
||||||
|
|
||||||
import javax.inject.Singleton;
|
|
||||||
|
|
||||||
import dagger.Module;
|
|
||||||
import dagger.Provides;
|
|
||||||
|
|
||||||
@Module(subcomponents = DialogSelectMgrpDtipPairComponent.class)
|
|
||||||
public class DialogSelectMgrpDtipPairModule {
|
|
||||||
|
|
||||||
@Singleton
|
|
||||||
@Provides
|
|
||||||
DialogSelectMgrpDtipPairViewModel dialogSelectMgrpDtipPairViewModel() {
|
|
||||||
return new DialogSelectMgrpDtipPairViewModel();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,161 +0,0 @@
|
|||||||
package it.integry.integrywmsnative.gest.contab_doc_interni.dialog;
|
|
||||||
|
|
||||||
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.view.WindowManager;
|
|
||||||
import android.widget.ArrayAdapter;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
import androidx.databinding.DataBindingUtil;
|
|
||||||
|
|
||||||
import javax.inject.Inject;
|
|
||||||
|
|
||||||
import it.integry.integrywmsnative.MainApplication;
|
|
||||||
import it.integry.integrywmsnative.R;
|
|
||||||
import it.integry.integrywmsnative.core.di.BindableString;
|
|
||||||
import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
|
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
|
||||||
import it.integry.integrywmsnative.databinding.DialogSelectTipoDocAndGroupArtBinding;
|
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.GruppiArticoloDTO;
|
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.TipiDocAndGruppiArtDTO;
|
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.TipiDocDTO;
|
|
||||||
|
|
||||||
public class DialogSelectMgrpDtipPairView extends BaseDialogFragment {
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
DialogSelectMgrpDtipPairViewModel mViewModel;
|
|
||||||
private Context mCurrentContext;
|
|
||||||
|
|
||||||
|
|
||||||
public BindableString codDtip = new BindableString();
|
|
||||||
public BindableString codMgrp = new BindableString();
|
|
||||||
private ArrayAdapter<String> arrayAdapterCodDtips;
|
|
||||||
private ArrayAdapter<String> arrayAdapterCodMgrps;
|
|
||||||
private DialogSelectTipoDocAndGroupArtBinding mBindings;
|
|
||||||
|
|
||||||
private RunnableArgs<DialogSelectMgrpDtipPairViewModel> currentOnFilterDone;
|
|
||||||
private TipiDocAndGruppiArtDTO mTipiDocAndGruppiArtDTO;
|
|
||||||
private TipiDocDTO mSelectedDtip;
|
|
||||||
private GruppiArticoloDTO mSelectedGrp;
|
|
||||||
|
|
||||||
|
|
||||||
public static DialogSelectMgrpDtipPairView newInstance(
|
|
||||||
TipiDocAndGruppiArtDTO tipiDocAndGruppiArtDTO,
|
|
||||||
TipiDocDTO tipiDocDTO,
|
|
||||||
GruppiArticoloDTO gruppiArticoloDTO,
|
|
||||||
RunnableArgs<DialogSelectMgrpDtipPairViewModel> onDismiss
|
|
||||||
) {
|
|
||||||
return new DialogSelectMgrpDtipPairView(tipiDocAndGruppiArtDTO,tipiDocDTO,gruppiArticoloDTO, onDismiss);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private DialogSelectMgrpDtipPairView(TipiDocAndGruppiArtDTO tipiDocAndGruppiArtDTO,TipiDocDTO tipiDocDTO, GruppiArticoloDTO gruppiArticoloDTO, RunnableArgs<DialogSelectMgrpDtipPairViewModel> onDismiss) {
|
|
||||||
super();
|
|
||||||
currentOnFilterDone = onDismiss;
|
|
||||||
mTipiDocAndGruppiArtDTO = tipiDocAndGruppiArtDTO;
|
|
||||||
mSelectedDtip = tipiDocDTO;
|
|
||||||
mSelectedGrp = gruppiArticoloDTO;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDismiss(@NonNull DialogInterface dialog) {
|
|
||||||
super.onDismiss(dialog);
|
|
||||||
if (currentOnFilterDone != null) currentOnFilterDone.run(mViewModel);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
@Override
|
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
|
||||||
this.mCurrentContext = this.requireActivity();
|
|
||||||
|
|
||||||
mBindings = DataBindingUtil.inflate(inflater, R.layout.dialog_select_tipo_doc_and_group_art, container, false);
|
|
||||||
mBindings.setLifecycleOwner(this);
|
|
||||||
|
|
||||||
MainApplication
|
|
||||||
.appComponent
|
|
||||||
.dialogSelectMgrpDtipPairComponent()
|
|
||||||
.create()
|
|
||||||
.inject(this);
|
|
||||||
mViewModel.init(mTipiDocAndGruppiArtDTO);
|
|
||||||
mBindings.setView(this);
|
|
||||||
mBindings.setViewmodel(mViewModel);
|
|
||||||
|
|
||||||
getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
|
|
||||||
getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
|
||||||
initView();
|
|
||||||
|
|
||||||
|
|
||||||
mBindings.positiveBtn.setOnClickListener(view -> {
|
|
||||||
if (this.isInputValid()) {
|
|
||||||
getDialog().dismiss();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
return mBindings.getRoot();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initView() {
|
|
||||||
initArrayAdapters();
|
|
||||||
initBindables();
|
|
||||||
if (mSelectedDtip != null){
|
|
||||||
codDtip.set(mSelectedDtip.getLabel());
|
|
||||||
}
|
|
||||||
if (mSelectedGrp != null){
|
|
||||||
codMgrp.set(mSelectedGrp.getLabel());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isInputValid() {
|
|
||||||
if (this.mViewModel.getSelectedTipoDoc() == null) {
|
|
||||||
mBindings.inputCodDtip.setErrorEnabled(true);
|
|
||||||
mBindings.inputCodDtip.setError("Seleziona un tipo documento");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (this.mViewModel.getSelectedGruppoArt() == null) {
|
|
||||||
mBindings.inputCodMgrps.setErrorEnabled(true);
|
|
||||||
mBindings.inputCodMgrps.setError("Seleziona un gruppo merceologico");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initArrayAdapters() {
|
|
||||||
|
|
||||||
arrayAdapterCodDtips = new ArrayAdapter<>(mCurrentContext, R.layout.dialog_select_tipo_doc_and_group_art__single_item);
|
|
||||||
arrayAdapterCodDtips.addAll(mViewModel.getAvailableCodDtips());
|
|
||||||
mBindings.filledExposedDropdownCodDtips.setAdapter(arrayAdapterCodDtips);
|
|
||||||
|
|
||||||
|
|
||||||
arrayAdapterCodMgrps = new ArrayAdapter<>(mCurrentContext, R.layout.dialog_select_tipo_doc_and_group_art__single_item);
|
|
||||||
arrayAdapterCodMgrps.addAll(mViewModel.getAvailableCodMgrps());
|
|
||||||
mBindings.filledExposedDropdownCodMgrps.setAdapter(arrayAdapterCodMgrps);
|
|
||||||
}
|
|
||||||
|
|
||||||
public DialogSelectMgrpDtipPairView setCodDtip(String codDtip) {
|
|
||||||
this.codDtip.set(codDtip);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DialogSelectMgrpDtipPairView setCodMgrp(String codMgrp) {
|
|
||||||
this.codMgrp.set(codMgrp);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void initBindables() {
|
|
||||||
|
|
||||||
BindableString.registerListener(codDtip, mViewModel::setCodDtip);
|
|
||||||
BindableString.registerListener(codMgrp, mViewModel::setCodMgrp);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,62 +0,0 @@
|
|||||||
package it.integry.integrywmsnative.gest.contab_doc_interni.dialog;
|
|
||||||
|
|
||||||
import com.annimon.stream.Stream;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.GruppiArticoloDTO;
|
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.TipiDocAndGruppiArtDTO;
|
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.TipiDocDTO;
|
|
||||||
|
|
||||||
|
|
||||||
public class DialogSelectMgrpDtipPairViewModel {
|
|
||||||
|
|
||||||
|
|
||||||
private TipiDocAndGruppiArtDTO mTipiDocAndGruppiArtDTO;
|
|
||||||
|
|
||||||
private String mTipoDoc;
|
|
||||||
private String mGruppoArt;
|
|
||||||
|
|
||||||
public void init(TipiDocAndGruppiArtDTO initialList) {
|
|
||||||
this.mTipiDocAndGruppiArtDTO = initialList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCodDtip() {
|
|
||||||
return mTipoDoc;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCodDtip(String codDtip) {
|
|
||||||
this.mTipoDoc = codDtip;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCodMgrp() {
|
|
||||||
return mGruppoArt;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCodMgrp(String codMgrp) {
|
|
||||||
this.mGruppoArt = codMgrp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> getAvailableCodDtips() {
|
|
||||||
return Stream.of(mTipiDocAndGruppiArtDTO.getTipiDoc()).map(TipiDocDTO::getLabel).toList();
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> getAvailableCodMgrps() {
|
|
||||||
return Stream.of(mTipiDocAndGruppiArtDTO.getGruppiArt()).map(GruppiArticoloDTO::getLabel).toList();
|
|
||||||
}
|
|
||||||
|
|
||||||
public TipiDocDTO getSelectedTipoDoc(){
|
|
||||||
if (mTipoDoc == null){
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return Stream.of(mTipiDocAndGruppiArtDTO.getTipiDoc()).filter(x->x.getLabel().equals(mTipoDoc)).findFirstOrElse(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public GruppiArticoloDTO getSelectedGruppoArt(){
|
|
||||||
if (mGruppoArt == null){
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Stream.of(mTipiDocAndGruppiArtDTO.getGruppiArt()).filter(x->x.getLabel().equals(mGruppoArt)).findFirstOrElse(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -2,14 +2,15 @@ package it.integry.integrywmsnative.gest.contab_doc_interni.dto;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class TipiDocAndGruppiArtDTO {
|
public class DocInterniSetupDTO {
|
||||||
|
|
||||||
|
|
||||||
private List<TipiDocDTO> tipiDoc;
|
private List<TipiDocDTO> tipiDoc;
|
||||||
|
|
||||||
|
|
||||||
private List<GruppiArticoloDTO> gruppiArt;
|
private List<GruppiArticoloDTO> gruppiArt;
|
||||||
|
|
||||||
|
private List<FornitoreDTO> fornitori;
|
||||||
|
|
||||||
|
|
||||||
public List<TipiDocDTO> getTipiDoc() {
|
public List<TipiDocDTO> getTipiDoc() {
|
||||||
return tipiDoc;
|
return tipiDoc;
|
||||||
@@ -26,4 +27,12 @@ public class TipiDocAndGruppiArtDTO {
|
|||||||
public void setGruppiArt(List<GruppiArticoloDTO> gruppiArt) {
|
public void setGruppiArt(List<GruppiArticoloDTO> gruppiArt) {
|
||||||
this.gruppiArt = gruppiArt;
|
this.gruppiArt = gruppiArt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<FornitoreDTO> getFornitori() {
|
||||||
|
return fornitori;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFornitori(List<FornitoreDTO> fornitori) {
|
||||||
|
this.fornitori = fornitori;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.contab_doc_interni.dto;
|
||||||
|
|
||||||
|
public class DocSetupDTO {
|
||||||
|
}
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.contab_doc_interni.dto;
|
||||||
|
|
||||||
|
public class FornitoreDTO {
|
||||||
|
|
||||||
|
|
||||||
|
private String codAnag;
|
||||||
|
|
||||||
|
private String descrizione;
|
||||||
|
|
||||||
|
private String codVdes;
|
||||||
|
|
||||||
|
private String tipoAnag;
|
||||||
|
|
||||||
|
private String gestioneAnag;
|
||||||
|
|
||||||
|
|
||||||
|
public String getCodAnag() {
|
||||||
|
return codAnag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCodAnag(String codAnag) {
|
||||||
|
this.codAnag = codAnag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCodVdes() {
|
||||||
|
return codVdes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCodVdes(String codVdes) {
|
||||||
|
this.codVdes = codVdes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescrizione() {
|
||||||
|
return descrizione;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescrizione(String descrizione) {
|
||||||
|
this.descrizione = descrizione;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTipoAnag() {
|
||||||
|
return tipoAnag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTipoAnag(String tipoAnag) {
|
||||||
|
this.tipoAnag = tipoAnag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGestioneAnag() {
|
||||||
|
return gestioneAnag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGestioneAnag(String gestioneAnag) {
|
||||||
|
this.gestioneAnag = gestioneAnag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLabel() {
|
||||||
|
return this.codAnag + (this.codVdes != null ? " - "+ this.codVdes : "") +" ( " + this.descrizione+" )";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -12,7 +12,12 @@ public class GrigliaAcquistiChildDTO {
|
|||||||
public BigDecimal merceDaRic;
|
public BigDecimal merceDaRic;
|
||||||
public BigDecimal mediaSett;
|
public BigDecimal mediaSett;
|
||||||
public String flagQtaMultipla;
|
public String flagQtaMultipla;
|
||||||
|
public String flagTracciabilita;
|
||||||
public BigDecimal qtaMinOrdinabile;
|
public BigDecimal qtaMinOrdinabile;
|
||||||
|
private int ggScadenza;
|
||||||
|
private float giacenza;
|
||||||
|
private float qtaPrevistaVendita;
|
||||||
|
private float qtaProposta;
|
||||||
|
|
||||||
public String getCodMart() {
|
public String getCodMart() {
|
||||||
return codMart;
|
return codMart;
|
||||||
@@ -94,4 +99,49 @@ public class GrigliaAcquistiChildDTO {
|
|||||||
this.qtaMinOrdinabile = qtaMinOrdinabile;
|
this.qtaMinOrdinabile = qtaMinOrdinabile;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getFlagTracciabilita() {
|
||||||
|
return flagTracciabilita;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GrigliaAcquistiChildDTO setFlagTracciabilita(String flagTracciabilita) {
|
||||||
|
this.flagTracciabilita = flagTracciabilita;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getGgScadenza() {
|
||||||
|
return ggScadenza;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GrigliaAcquistiChildDTO setGgScadenza(int ggScadenza) {
|
||||||
|
this.ggScadenza = ggScadenza;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getGiacenza() {
|
||||||
|
return giacenza;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GrigliaAcquistiChildDTO setGiacenza(float giacenza) {
|
||||||
|
this.giacenza = giacenza;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getQtaPrevistaVendita() {
|
||||||
|
return qtaPrevistaVendita;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GrigliaAcquistiChildDTO setQtaPrevistaVendita(float qtaPrevistaVendita) {
|
||||||
|
this.qtaPrevistaVendita = qtaPrevistaVendita;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getQtaProposta() {
|
||||||
|
return qtaProposta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GrigliaAcquistiChildDTO setQtaProposta(float qtaProposta) {
|
||||||
|
this.qtaProposta = qtaProposta;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ public class TipiDocDTO {
|
|||||||
|
|
||||||
private String codDtip;
|
private String codDtip;
|
||||||
private String descrizione;
|
private String descrizione;
|
||||||
|
private String gestione;
|
||||||
|
private String gestioneDoc;
|
||||||
|
|
||||||
public String getCodDtip() {
|
public String getCodDtip() {
|
||||||
return codDtip;
|
return codDtip;
|
||||||
@@ -21,6 +23,21 @@ public class TipiDocDTO {
|
|||||||
this.descrizione = descrizione;
|
this.descrizione = descrizione;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getGestione() {
|
||||||
|
return gestione;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGestione(String gestione) {
|
||||||
|
this.gestione = gestione;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGestioneDoc() {
|
||||||
|
return gestioneDoc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGestioneDoc(String gestioneDoc) {
|
||||||
|
this.gestioneDoc = gestioneDoc;
|
||||||
|
}
|
||||||
public String getLabel(){
|
public String getLabel(){
|
||||||
return this.codDtip +" - "+this.descrizione;
|
return this.codDtip +" - "+this.descrizione;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,35 +3,31 @@ package it.integry.integrywmsnative.gest.contab_doc_interni.edit_form;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.Html;
|
import android.view.View;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.databinding.DataBindingUtil;
|
import androidx.databinding.DataBindingUtil;
|
||||||
import androidx.databinding.ObservableArrayList;
|
import androidx.databinding.ObservableArrayList;
|
||||||
import androidx.recyclerview.widget.DiffUtil;
|
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
|
||||||
import com.annimon.stream.Stream;
|
import com.annimon.stream.Stream;
|
||||||
import com.ravikoradiya.liveadapter.LiveAdapter;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
|
||||||
import it.integry.integrywmsnative.BR;
|
|
||||||
import it.integry.integrywmsnative.MainApplication;
|
import it.integry.integrywmsnative.MainApplication;
|
||||||
import it.integry.integrywmsnative.R;
|
import it.integry.integrywmsnative.R;
|
||||||
import it.integry.integrywmsnative.core.barcode_reader.BarcodeCallbackDTO;
|
import it.integry.integrywmsnative.core.barcode_reader.BarcodeCallbackDTO;
|
||||||
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
||||||
import it.integry.integrywmsnative.core.data_cache.DataCache;
|
import it.integry.integrywmsnative.core.data_cache.DataCache;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.entity.ArticoloOrdine;
|
|
||||||
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColr;
|
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColr;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColt;
|
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColt;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.repository.MtbColrRepository;
|
import it.integry.integrywmsnative.core.data_store.db.repository.MtbColrRepository;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.repository.MtbColtRepository;
|
|
||||||
import it.integry.integrywmsnative.core.di.BindableBoolean;
|
import it.integry.integrywmsnative.core.di.BindableBoolean;
|
||||||
import it.integry.integrywmsnative.core.di.BindableInteger;
|
import it.integry.integrywmsnative.core.di.BindableInteger;
|
||||||
import it.integry.integrywmsnative.core.di.BindableString;
|
import it.integry.integrywmsnative.core.di.BindableString;
|
||||||
@@ -44,10 +40,6 @@ import it.integry.integrywmsnative.databinding.ActivityContabDocInterniEditBindi
|
|||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.GrigliaAcquistiChildDTO;
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.GrigliaAcquistiChildDTO;
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.GrigliaAcquistiDTO;
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.GrigliaAcquistiDTO;
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.ui.DocumentRowsListAdapter;
|
import it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.ui.DocumentRowsListAdapter;
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.ui.DocInterniListAdapter;
|
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.ui.DocInterniListModel;
|
|
||||||
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.FilterDepositoLayoutView;
|
|
||||||
import it.integry.integrywmsnative.gest.spedizione.model.PickedQuantityDTO;
|
|
||||||
import it.integry.integrywmsnative.ui.FabMenuCustomAnimations;
|
import it.integry.integrywmsnative.ui.FabMenuCustomAnimations;
|
||||||
import it.integry.integrywmsnative.view.bottom_sheet__mtb_colr_edit.BottomSheetMtbColrEditView;
|
import it.integry.integrywmsnative.view.bottom_sheet__mtb_colr_edit.BottomSheetMtbColrEditView;
|
||||||
import it.integry.integrywmsnative.view.dialogs.DialogCommon;
|
import it.integry.integrywmsnative.view.dialogs.DialogCommon;
|
||||||
@@ -69,9 +61,11 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
|||||||
private int mBarcodeScannerIstanceID;
|
private int mBarcodeScannerIstanceID;
|
||||||
private ActivityContabDocInterniEditBinding binding;
|
private ActivityContabDocInterniEditBinding binding;
|
||||||
public BindableString documentHeader = new BindableString(true);
|
public BindableString documentHeader = new BindableString(true);
|
||||||
|
public BindableString documentRifHeader = new BindableString(true);
|
||||||
public BindableString codDtip = new BindableString();
|
public BindableString codDtip = new BindableString();
|
||||||
public BindableString note = new BindableString();
|
public BindableString note = new BindableString();
|
||||||
public BindableString codMgrp = new BindableString();
|
public BindableString codMgrp = new BindableString();
|
||||||
|
public BindableString codAnag = new BindableString();
|
||||||
public BindableInteger prodsCount = new BindableInteger(0);
|
public BindableInteger prodsCount = new BindableInteger(0);
|
||||||
public BindableBoolean isDocumentExportable = new BindableBoolean(false);
|
public BindableBoolean isDocumentExportable = new BindableBoolean(false);
|
||||||
private final ObservableArrayList<SqlMtbColr> documentRowsObservableList = new ObservableArrayList<>();
|
private final ObservableArrayList<SqlMtbColr> documentRowsObservableList = new ObservableArrayList<>();
|
||||||
@@ -107,8 +101,24 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
|||||||
SqlMtbColt document = this.viewModel.getDocument();
|
SqlMtbColt document = this.viewModel.getDocument();
|
||||||
this.codDtip.set(document.getCodDtipProvv());
|
this.codDtip.set(document.getCodDtipProvv());
|
||||||
this.note.set(document.getAnnotazioni());
|
this.note.set(document.getAnnotazioni());
|
||||||
this.codMgrp.set(document.getCodMgrp());
|
if(document.getCodMgrp() != null){
|
||||||
|
this.codMgrp.set(document.getCodMgrp());
|
||||||
|
}else{
|
||||||
|
binding.mtbGrupContainer.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
if (document.getCodAnag() != null){
|
||||||
|
this.codAnag.set(document.getCodAnag() + (document.getCodVdes()!=null?" - "+document.getCodVdes():""));
|
||||||
|
}else{
|
||||||
|
this.binding.supplierLayout.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
this.documentHeader.set(String.format(this.getString(R.string.doc_interni_doc_header), document.getId(), document.getCodDtipProvv()));
|
this.documentHeader.set(String.format(this.getString(R.string.doc_interni_doc_header), document.getId(), document.getCodDtipProvv()));
|
||||||
|
|
||||||
|
if (document.getNumDoc() != null && document.getDataDoc() != null){
|
||||||
|
this.documentRifHeader.set(String.format(this.getString(R.string.doc_testata), document.getNumDoc().toString(), document.getDataDoc()));
|
||||||
|
}else{
|
||||||
|
this.binding.docRifLayout.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initView() {
|
private void initView() {
|
||||||
@@ -117,7 +127,7 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
|||||||
setSupportActionBar(binding.toolbar);
|
setSupportActionBar(binding.toolbar);
|
||||||
binding.toolbar.setTitle(R.string.edit_doc);
|
binding.toolbar.setTitle(R.string.edit_doc);
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
FabMenuCustomAnimations.changeIconOnFocus(binding.closeActivityFab, R.drawable.ic_check_white_24dp, R.drawable.ic_close_24dp);
|
FabMenuCustomAnimations.changeIconOnFocus(binding.closeActivityFab, R.drawable.ic_menu_24dp, R.drawable.ic_close_24dp);
|
||||||
binding.bottomSheetMtbColrEdit.setListener(this);
|
binding.bottomSheetMtbColrEdit.setListener(this);
|
||||||
binding.bottomSheetMtbColrEdit.init(binding.bottomSheetMtbColrEdit, binding.bottomSheetMtbColrEditBackground);
|
binding.bottomSheetMtbColrEdit.init(binding.bottomSheetMtbColrEdit, binding.bottomSheetMtbColrEditBackground);
|
||||||
}
|
}
|
||||||
@@ -126,8 +136,8 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
|||||||
this.viewModel.setListeners(this);
|
this.viewModel.setListeners(this);
|
||||||
this.viewModel.setDocument(document);
|
this.viewModel.setDocument(document);
|
||||||
this.viewModel.setProductsList(productList);
|
this.viewModel.setProductsList(productList);
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
private void initRecyclerView() {
|
private void initRecyclerView() {
|
||||||
this.viewModel.docRows.observe(this, this::refreshList);
|
this.viewModel.docRows.observe(this, this::refreshList);
|
||||||
DocumentRowsListAdapter listAdapter = new DocumentRowsListAdapter(this, documentRowsObservableList);
|
DocumentRowsListAdapter listAdapter = new DocumentRowsListAdapter(this, documentRowsObservableList);
|
||||||
@@ -145,14 +155,6 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
|||||||
this.documentRowsObservableList.addAll(this.viewModel.docRows.getValue());
|
this.documentRowsObservableList.addAll(this.viewModel.docRows.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void editNote() {
|
|
||||||
BarcodeManager.disable();
|
|
||||||
DialogSimpleInputHelper.makeInputDialog(this, "Inserisci il codice a barre/codice articolo da cercare", note -> {
|
|
||||||
this.note.set(note);
|
|
||||||
this.viewModel.setNote(note);
|
|
||||||
BarcodeManager.enable();
|
|
||||||
}, BarcodeManager::enable).show();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void closeEdit() {
|
public void closeEdit() {
|
||||||
@@ -161,7 +163,7 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
|||||||
|
|
||||||
public void manualSearch() {
|
public void manualSearch() {
|
||||||
BarcodeManager.disable();
|
BarcodeManager.disable();
|
||||||
DialogSimpleInputHelper.makeInputDialog(this, "Aggiungi delle annotazioni al documento", this.note.get(), this.viewModel::onSearch, BarcodeManager::enable).show();
|
DialogSimpleInputHelper.makeInputDialog(this, "Inserisci il codice a barre/codice articolo da cercare", null, this.viewModel::onSearch, BarcodeManager::enable).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -206,7 +208,7 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEditRowRequest(SqlMtbColr row) {
|
public void onEditRowRequest(SqlMtbColr row, boolean flagTracciabilita) {
|
||||||
MtbAart mtbAart = new MtbAart();
|
MtbAart mtbAart = new MtbAart();
|
||||||
mtbAart.setBarCode(row.getCodBarre());
|
mtbAart.setBarCode(row.getCodBarre());
|
||||||
mtbAart.setDiacod(row.getCodBarre());
|
mtbAart.setDiacod(row.getCodBarre());
|
||||||
@@ -215,6 +217,7 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
|||||||
mtbAart.setQtaCnf(BigDecimal.valueOf(row.getQtaCnf()));
|
mtbAart.setQtaCnf(BigDecimal.valueOf(row.getQtaCnf()));
|
||||||
mtbAart.setDescrizione(row.getDescrizione());
|
mtbAart.setDescrizione(row.getDescrizione());
|
||||||
mtbAart.setDescrizioneEstesa(row.getDescrizione());
|
mtbAart.setDescrizioneEstesa(row.getDescrizione());
|
||||||
|
mtbAart.setFlagTracciabilita(flagTracciabilita? "S" : "N");
|
||||||
mtbAart.setUntMis(row.getUntMis());
|
mtbAart.setUntMis(row.getUntMis());
|
||||||
|
|
||||||
DialogInputQuantityV2DTO dialogInputQuantityV2DTO = new DialogInputQuantityV2DTO()
|
DialogInputQuantityV2DTO dialogInputQuantityV2DTO = new DialogInputQuantityV2DTO()
|
||||||
@@ -222,10 +225,22 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
|||||||
.setInitialNumCnf(BigDecimal.valueOf(row.getNumCnf()))
|
.setInitialNumCnf(BigDecimal.valueOf(row.getNumCnf()))
|
||||||
.setInitialQtaCnf(BigDecimal.valueOf(row.getQtaCnf()))
|
.setInitialQtaCnf(BigDecimal.valueOf(row.getQtaCnf()))
|
||||||
.setInitialQtaTot(BigDecimal.valueOf(row.getQtaCol()))
|
.setInitialQtaTot(BigDecimal.valueOf(row.getQtaCol()))
|
||||||
|
.setNote(row.getNote())
|
||||||
|
.setPartitaMag(row.getPartitaMag())
|
||||||
.setDataScad(row.getDataScad())
|
.setDataScad(row.getDataScad())
|
||||||
.setCanOverflowOrderQuantity(false)
|
.setCanOverflowOrderQuantity(false)
|
||||||
.setCanLUBeClosed(false)
|
.setCanLUBeClosed(false)
|
||||||
.setCanPartitaMagBeChanged(false);
|
.setNotesAllowed(true)
|
||||||
|
.setDataScadMandatory(flagTracciabilita)
|
||||||
|
.setCanPartitaMagBeChanged(flagTracciabilita)
|
||||||
|
.setSuggestPartitaMag(data -> {
|
||||||
|
Date dataScad = data.getDataScad();
|
||||||
|
String partitaMag = null;
|
||||||
|
if (dataScad != null){
|
||||||
|
partitaMag = new SimpleDateFormat("yyyymmdd").format(dataScad);
|
||||||
|
}
|
||||||
|
return partitaMag;
|
||||||
|
});
|
||||||
|
|
||||||
DialogInputQuantityV2View
|
DialogInputQuantityV2View
|
||||||
.newInstance(dialogInputQuantityV2DTO, (resultDTO, shouldCloseLU) -> {
|
.newInstance(dialogInputQuantityV2DTO, (resultDTO, shouldCloseLU) -> {
|
||||||
@@ -255,7 +270,8 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMtbColrEdit(MtbColr mtbColr) {
|
public void onMtbColrEdit(MtbColr mtbColr) {
|
||||||
this.viewModel.editRow(entityToSql(mtbColr));
|
GrigliaAcquistiChildDTO articolo = viewModel.getArticoloByCodMart(mtbColr.getCodMart());
|
||||||
|
this.viewModel.editRow(entityToSql(mtbColr),articolo.getFlagTracciabilita().equalsIgnoreCase("S"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -68,8 +68,8 @@ public class DocInterniEditFormViewModel {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void editRow(SqlMtbColr row) {
|
public void editRow(SqlMtbColr row,boolean flagTracciabilita) {
|
||||||
this.listener.onEditRowRequest(row);
|
this.listener.onEditRowRequest(row,flagTracciabilita);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Integer getNextIdRiga() {
|
private Integer getNextIdRiga() {
|
||||||
@@ -91,6 +91,17 @@ public class DocInterniEditFormViewModel {
|
|||||||
}, this::sendError);
|
}, this::sendError);
|
||||||
}, this::sendError);
|
}, this::sendError);
|
||||||
}
|
}
|
||||||
|
public void deleteDocument() {
|
||||||
|
this.sendOnLoadingStarted();
|
||||||
|
docInterniRESTConsumer.saveDoc(this.getSaveDto(), obj -> {
|
||||||
|
SqlMtbColt document = this.getDocument();
|
||||||
|
document.setCodDtip(document.getCodDtipProvv());
|
||||||
|
mtbColtRepository.update(document, doc -> {
|
||||||
|
this.sendOnLoadingEnded();
|
||||||
|
this.listener.onDocExported();
|
||||||
|
}, this::sendError);
|
||||||
|
}, this::sendError);
|
||||||
|
}
|
||||||
|
|
||||||
public void holdDocument() {
|
public void holdDocument() {
|
||||||
this.listener.onDocumentHoldRequest();
|
this.listener.onDocumentHoldRequest();
|
||||||
@@ -105,7 +116,7 @@ public class DocInterniEditFormViewModel {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
SqlMtbColr row = this.getRowForArticolo(articolo);
|
SqlMtbColr row = this.getRowForArticolo(articolo);
|
||||||
this.editRow(row);
|
this.editRow(row,articolo.getFlagTracciabilita().equalsIgnoreCase("S"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -207,6 +218,7 @@ public class DocInterniEditFormViewModel {
|
|||||||
row.setQtaCnf(resultDTO.getQtaCnf().floatValue());
|
row.setQtaCnf(resultDTO.getQtaCnf().floatValue());
|
||||||
row.setNumCnf(resultDTO.getNumCnf().floatValue());
|
row.setNumCnf(resultDTO.getNumCnf().floatValue());
|
||||||
row.setQtaCol(resultDTO.getQtaTot().floatValue());
|
row.setQtaCol(resultDTO.getQtaTot().floatValue());
|
||||||
|
row.setNote(resultDTO.getNote());
|
||||||
row.setDataScad(resultDTO.getDataScad());
|
row.setDataScad(resultDTO.getDataScad());
|
||||||
if (row.getId() > 0) {
|
if (row.getId() > 0) {
|
||||||
this.mtbColrRepository.update(row, id -> {
|
this.mtbColrRepository.update(row, id -> {
|
||||||
@@ -233,13 +245,17 @@ public class DocInterniEditFormViewModel {
|
|||||||
return this.docRows.getValue();
|
return this.docRows.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public GrigliaAcquistiChildDTO getArticoloByCodMart(String codMart) {
|
||||||
|
return Stream.of(productsList).filter(prod->prod.codMart.equalsIgnoreCase(codMart)).findFirstOrElse(null);
|
||||||
|
}
|
||||||
|
|
||||||
public interface Listener extends ILoadingListener {
|
public interface Listener extends ILoadingListener {
|
||||||
|
|
||||||
void onError(Exception ex);
|
void onError(Exception ex);
|
||||||
|
|
||||||
void onRowsChanged(List<SqlMtbColr> rows);
|
void onRowsChanged(List<SqlMtbColr> rows);
|
||||||
|
|
||||||
void onEditRowRequest(SqlMtbColr row);
|
void onEditRowRequest(SqlMtbColr row,boolean flagTracciabilita);
|
||||||
|
|
||||||
void onDocumentHoldRequest();
|
void onDocumentHoldRequest();
|
||||||
|
|
||||||
|
|||||||
@@ -2,18 +2,15 @@ package it.integry.integrywmsnative.gest.contab_doc_interni.rest;
|
|||||||
|
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers._BaseRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers._BaseRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||||
import it.integry.integrywmsnative.gest.accettazione.dto.SitArtOrdDTO;
|
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.GrigliaAcquistiDTO;
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.GrigliaAcquistiDTO;
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.SaveDTO;
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.SaveDTO;
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.TipiDocAndGruppiArtDTO;
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.DocInterniSetupDTO;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.Callback;
|
import retrofit2.Callback;
|
||||||
import retrofit2.Response;
|
import retrofit2.Response;
|
||||||
@@ -21,16 +18,16 @@ import retrofit2.Response;
|
|||||||
@Singleton
|
@Singleton
|
||||||
public class DocInterniRESTConsumer extends _BaseRESTConsumer {
|
public class DocInterniRESTConsumer extends _BaseRESTConsumer {
|
||||||
|
|
||||||
public void getDocTypesAndGroupArts(RunnableArgs<TipiDocAndGruppiArtDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
public void getDocInterniSetup(RunnableArgs<DocInterniSetupDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
DocInterniRESTConsumerService service = RESTBuilder.getService(DocInterniRESTConsumerService.class);
|
DocInterniRESTConsumerService service = RESTBuilder.getService(DocInterniRESTConsumerService.class);
|
||||||
service.getDocTypesAndGroupArts().enqueue(new Callback<>() {
|
service.getSetupDocInterni().enqueue(new Callback<>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call<ServiceRESTResponse<TipiDocAndGruppiArtDTO>> call, Response<ServiceRESTResponse<TipiDocAndGruppiArtDTO>> response) {
|
public void onResponse(Call<ServiceRESTResponse<DocInterniSetupDTO>> call, Response<ServiceRESTResponse<DocInterniSetupDTO>> response) {
|
||||||
analyzeAnswer(response, "getDocTypesAndGroupArts", onComplete, onFailed);
|
analyzeAnswer(response, "getSetupDocInterni", onComplete, onFailed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Call<ServiceRESTResponse<TipiDocAndGruppiArtDTO>> call, Throwable t) {
|
public void onFailure(Call<ServiceRESTResponse<DocInterniSetupDTO>> call, Throwable t) {
|
||||||
onFailed.run(new Exception(t));
|
onFailed.run(new Exception(t));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -2,15 +2,10 @@ package it.integry.integrywmsnative.gest.contab_doc_interni.rest;
|
|||||||
|
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||||
import it.integry.integrywmsnative.gest.accettazione.dto.GetPickingListAccettazioneDTO;
|
|
||||||
import it.integry.integrywmsnative.gest.accettazione.dto.OrdineAccettazioneInevasoDTO;
|
|
||||||
import it.integry.integrywmsnative.gest.accettazione.dto.SitArtOrdDTO;
|
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.GrigliaAcquistiDTO;
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.GrigliaAcquistiDTO;
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.SaveDTO;
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.SaveDTO;
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.TipiDocAndGruppiArtDTO;
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.DocInterniSetupDTO;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.http.Body;
|
import retrofit2.http.Body;
|
||||||
import retrofit2.http.GET;
|
import retrofit2.http.GET;
|
||||||
@@ -20,8 +15,8 @@ import retrofit2.http.Query;
|
|||||||
|
|
||||||
public interface DocInterniRESTConsumerService {
|
public interface DocInterniRESTConsumerService {
|
||||||
|
|
||||||
@GET("getDocTypesAndArtsGroups")
|
@GET("getDocInterniSetup")
|
||||||
Call<ServiceRESTResponse<TipiDocAndGruppiArtDTO>> getDocTypesAndGroupArts();
|
Call<ServiceRESTResponse<DocInterniSetupDTO>> getSetupDocInterni();
|
||||||
|
|
||||||
@POST("SM2SaveTerminalinoWMS")
|
@POST("SM2SaveTerminalinoWMS")
|
||||||
Call<ServiceRESTResponse<JsonObject>> save(@Body SaveDTO saveDTO);
|
Call<ServiceRESTResponse<JsonObject>> save(@Body SaveDTO saveDTO);
|
||||||
|
|||||||
@@ -1,16 +1,48 @@
|
|||||||
package it.integry.integrywmsnative.gest.login;
|
package it.integry.integrywmsnative.gest.login;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.text.Html;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.databinding.DataBindingUtil;
|
import androidx.databinding.DataBindingUtil;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.MainApplication;
|
||||||
import it.integry.integrywmsnative.R;
|
import it.integry.integrywmsnative.R;
|
||||||
|
import it.integry.integrywmsnative.SplashActivity;
|
||||||
|
import it.integry.integrywmsnative.core.di.BindableBoolean;
|
||||||
|
import it.integry.integrywmsnative.core.di.BindableString;
|
||||||
import it.integry.integrywmsnative.core.expansion.BaseActivity;
|
import it.integry.integrywmsnative.core.expansion.BaseActivity;
|
||||||
|
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityWindow;
|
import it.integry.integrywmsnative.core.utility.UtilityWindow;
|
||||||
import it.integry.integrywmsnative.databinding.ActivityLoginBinding;
|
import it.integry.integrywmsnative.databinding.ActivityLoginBinding;
|
||||||
import it.integry.integrywmsnative.gest.login.viewmodel.LoginViewModel;
|
import it.integry.integrywmsnative.gest.login.viewmodel.LoginViewModel;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||||
|
|
||||||
public class LoginActivity extends BaseActivity {
|
public class LoginActivity extends BaseActivity implements LoginViewModel.Listener {
|
||||||
|
|
||||||
|
ActivityLoginBinding mBindings;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
LoginViewModel mViewmodel;
|
||||||
|
|
||||||
|
|
||||||
|
public BindableString username = new BindableString();
|
||||||
|
public BindableString password = new BindableString();
|
||||||
|
public BindableString codAzienda = new BindableString();
|
||||||
|
|
||||||
|
public BindableBoolean customSettingsCheckboxEnabled = new BindableBoolean();
|
||||||
|
public BindableBoolean customSettingsCheckboxChecked = new BindableBoolean();
|
||||||
|
|
||||||
|
public BindableBoolean loginButtonEnabled = new BindableBoolean();
|
||||||
|
|
||||||
|
|
||||||
|
public BindableString usernameError = new BindableString();
|
||||||
|
public BindableString passwordError = new BindableString();
|
||||||
|
public BindableString codAziendaError = new BindableString();
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -18,9 +50,44 @@ public class LoginActivity extends BaseActivity {
|
|||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
UtilityWindow.maximizeToFullScreen(this);
|
UtilityWindow.maximizeToFullScreen(this);
|
||||||
|
|
||||||
ActivityLoginBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_login);
|
mBindings = DataBindingUtil.setContentView(this, R.layout.activity_login);
|
||||||
LoginViewModel loginViewModel = new LoginViewModel(this);
|
mBindings.setView(this);
|
||||||
binding.setLoginViewModel(loginViewModel);
|
|
||||||
|
MainApplication.appComponent
|
||||||
|
.loginActivityComponent()
|
||||||
|
.create()
|
||||||
|
.inject(this);
|
||||||
|
|
||||||
|
mViewmodel.setListener(this);
|
||||||
|
|
||||||
|
loginButtonEnabled.set(true);
|
||||||
|
|
||||||
|
codAzienda.set(SettingsManager.i().getServer().getCodAzienda());
|
||||||
|
|
||||||
|
customSettingsCheckboxChecked.set(SettingsManager.i().getServer().getHost() == null);
|
||||||
|
customSettingsCheckboxEnabled.set(SettingsManager.i().getServer().getHost() != null);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean validate(String username, String codAzienda) {
|
||||||
|
if (username.isEmpty() || username.length() < 3) {
|
||||||
|
usernameError.set(getText(R.string.username_error_not_valid).toString());
|
||||||
|
return false;
|
||||||
|
} else usernameError.set(null);
|
||||||
|
|
||||||
|
if (codAzienda.isEmpty() || codAzienda.length() < 3) {
|
||||||
|
codAziendaError.set(getText(R.string.server_cod_azienda_error_not_valid).toString());
|
||||||
|
return false;
|
||||||
|
} else codAziendaError.set(null);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void login() {
|
||||||
|
if (validate(username.get(), codAzienda.get())) {
|
||||||
|
loginButtonEnabled.set(false);
|
||||||
|
mViewmodel.login(codAzienda.get(), username.get(), password.get());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -29,4 +96,65 @@ public class LoginActivity extends BaseActivity {
|
|||||||
// disable going back to the MainActivity
|
// disable going back to the MainActivity
|
||||||
moveTaskToBack(true);
|
moveTaskToBack(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLoginCompleted(String host, int port, String fullName, List<String> availableProfiles) {
|
||||||
|
|
||||||
|
this.onLoadingEnded();
|
||||||
|
runOnUiThread(() -> DialogSimpleMessageView.makeSuccessDialog(
|
||||||
|
"Benvenuto",
|
||||||
|
Html.fromHtml("Ciao <b>" + fullName + "</b>, la Integry le augura di svolgere al meglio il suo lavoro"),
|
||||||
|
null,
|
||||||
|
() -> showProfileDBSelectionDialog(host, port, availableProfiles))
|
||||||
|
.show(getSupportFragmentManager(), "tag"));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(Exception ex) {
|
||||||
|
super.onError(ex);
|
||||||
|
loginButtonEnabled.set(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showProfileDBSelectionDialog(final String host, final int port, final List<String> availableProfiles) {
|
||||||
|
Runnable onComplete = () -> {
|
||||||
|
SettingsManager.update();
|
||||||
|
|
||||||
|
startSplashActivity();
|
||||||
|
};
|
||||||
|
|
||||||
|
loginButtonEnabled.set(true);
|
||||||
|
|
||||||
|
if (availableProfiles != null && availableProfiles.size() == 1) {
|
||||||
|
SettingsManager.i().getUserSession().setProfileDB(availableProfiles.get(0));
|
||||||
|
|
||||||
|
mViewmodel.loadDepo(codAzienda.get(), host, port, username.get(), password.get(), onComplete);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// setup the alert builder
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||||
|
builder.setTitle(R.string.action_choose_profile_db);
|
||||||
|
|
||||||
|
// add a list
|
||||||
|
String[] profiles = new String[availableProfiles.size()];
|
||||||
|
profiles = availableProfiles
|
||||||
|
.toArray(profiles);
|
||||||
|
|
||||||
|
builder.setItems(profiles, (dialog, which) -> {
|
||||||
|
SettingsManager.i().getUserSession().setProfileDB(availableProfiles.get(which));
|
||||||
|
|
||||||
|
mViewmodel.loadDepo(codAzienda.get(), host, port, username.get(), password.get(), onComplete);
|
||||||
|
});
|
||||||
|
|
||||||
|
// create and show the alert dialog
|
||||||
|
AlertDialog dialog = builder.create();
|
||||||
|
dialog.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void startSplashActivity() {
|
||||||
|
finish();
|
||||||
|
SplashActivity.startActivity(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.login;
|
||||||
|
|
||||||
|
import dagger.Subcomponent;
|
||||||
|
|
||||||
|
@Subcomponent
|
||||||
|
public interface LoginComponent {
|
||||||
|
|
||||||
|
@Subcomponent.Factory
|
||||||
|
interface Factory {
|
||||||
|
LoginComponent create();
|
||||||
|
}
|
||||||
|
|
||||||
|
void inject(LoginActivity loginActivity);
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.login;
|
||||||
|
|
||||||
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
|
import dagger.Module;
|
||||||
|
import dagger.Provides;
|
||||||
|
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
||||||
|
import it.integry.integrywmsnative.gest.login.rest.LoginRESTConsumer;
|
||||||
|
import it.integry.integrywmsnative.gest.login.viewmodel.LoginViewModel;
|
||||||
|
|
||||||
|
@Module(subcomponents = LoginComponent.class)
|
||||||
|
public class LoginModule {
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
LoginRESTConsumer provideLoginRESTConsumer() {
|
||||||
|
return new LoginRESTConsumer();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
LoginViewModel providesSpedizioneViewModel(SystemRESTConsumer systemRESTConsumer, LoginRESTConsumer loginRESTConsumer) {
|
||||||
|
return new LoginViewModel(systemRESTConsumer, loginRESTConsumer);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,112 +0,0 @@
|
|||||||
package it.integry.integrywmsnative.gest.login.core;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.CommonConst;
|
|
||||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.ISimpleOperationCallback;
|
|
||||||
import it.integry.integrywmsnative.core.rest.model.EsitoType;
|
|
||||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
|
||||||
import it.integry.integrywmsnative.gest.login.dto.LoginAziendaDTO;
|
|
||||||
import it.integry.integrywmsnative.gest.login.dto.LoginDTO;
|
|
||||||
import it.integry.integrywmsnative.gest.login.rest.LoginRESTConsumerService;
|
|
||||||
import retrofit2.Call;
|
|
||||||
import retrofit2.Callback;
|
|
||||||
import retrofit2.Response;
|
|
||||||
|
|
||||||
public class LoginHelper {
|
|
||||||
|
|
||||||
private Context mContext;
|
|
||||||
|
|
||||||
private String mCodAzienda;
|
|
||||||
private String mUsername;
|
|
||||||
private String mPassword;
|
|
||||||
|
|
||||||
public LoginHelper(Context context, String codAzienda, String username, String password){
|
|
||||||
this.mContext = context;
|
|
||||||
|
|
||||||
this.mCodAzienda = codAzienda;
|
|
||||||
this.mUsername = username;
|
|
||||||
this.mPassword = password;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void retrieveServerData(final ISimpleOperationCallback<LoginAziendaDTO> callback){
|
|
||||||
|
|
||||||
String host = CommonConst.Login.Azienda.host;
|
|
||||||
int port = CommonConst.Login.Azienda.port;
|
|
||||||
|
|
||||||
LoginRESTConsumerService service = RESTBuilder.getService(LoginRESTConsumerService.class, host, port, false, true);
|
|
||||||
service.loginAzienda(mCodAzienda).enqueue(new Callback<ServiceRESTResponse<LoginAziendaDTO>>() {
|
|
||||||
@Override
|
|
||||||
public void onResponse(Call<ServiceRESTResponse<LoginAziendaDTO>> call, Response<ServiceRESTResponse<LoginAziendaDTO>> response) {
|
|
||||||
if(response.isSuccessful()) {
|
|
||||||
|
|
||||||
if(response.body() != null) {
|
|
||||||
if(response.body().getEsito() == EsitoType.OK) {
|
|
||||||
callback.onSuccess(response.body().getDto());
|
|
||||||
} else {
|
|
||||||
Log.e("LoginAzienda", response.body().getErrorMessage());
|
|
||||||
callback.onFailed(new Exception(response.body().getErrorMessage()));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Log.e("LoginAzienda", response.message());
|
|
||||||
callback.onFailed(new Exception(response.message()));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Log.e("LoginAzienda", "Status " + response.code() + ": " + response.message());
|
|
||||||
callback.onFailed(new Exception("Status " + response.code() + ": " + response.message()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(Call<ServiceRESTResponse<LoginAziendaDTO>> call, Throwable t) {
|
|
||||||
Log.e("LoginAzienda", t.toString());
|
|
||||||
callback.onFailed(new Exception(t));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void doLogin(String host, int port, final ISimpleOperationCallback<LoginDTO> callback){
|
|
||||||
LoginRESTConsumerService service = RESTBuilder.getService(LoginRESTConsumerService.class, host, port, false);
|
|
||||||
service.login(mUsername, mPassword).enqueue(new Callback<ServiceRESTResponse<LoginDTO>>() {
|
|
||||||
@Override
|
|
||||||
public void onResponse(Call<ServiceRESTResponse<LoginDTO>> call, Response<ServiceRESTResponse<LoginDTO>> response) {
|
|
||||||
|
|
||||||
if(response.isSuccessful()) {
|
|
||||||
|
|
||||||
if(response.body() != null) {
|
|
||||||
if(response.body().getEsito() == EsitoType.OK) {
|
|
||||||
callback.onSuccess(response.body().getDto());
|
|
||||||
} else {
|
|
||||||
Log.e("Login", response.body().getErrorMessage());
|
|
||||||
callback.onFailed(new Exception(response.body().getErrorMessage()));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Log.e("Login", response.message());
|
|
||||||
callback.onFailed(new Exception(response.message()));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Log.e("Login", "Status " + response.code() + ": " + response.message());
|
|
||||||
callback.onFailed(new Exception("Status " + response.code() + ": " + response.message()));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(Call<ServiceRESTResponse<LoginDTO>> call, final Throwable t) {
|
|
||||||
|
|
||||||
Log.e("Login", t.toString());
|
|
||||||
callback.onFailed(new Exception(t));
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -2,10 +2,54 @@ package it.integry.integrywmsnative.gest.login.dto;
|
|||||||
|
|
||||||
public class LoginAziendaDTO {
|
public class LoginAziendaDTO {
|
||||||
|
|
||||||
public String profileDb;
|
private String profileDb;
|
||||||
public String endpointRestApi;
|
private String endpointRestApi;
|
||||||
public String phpApi;
|
private String phpApi;
|
||||||
public String repoPhoto;
|
private String repoPhoto;
|
||||||
public String endpointPvm;
|
private String endpointPvm;
|
||||||
|
|
||||||
|
public String getProfileDb() {
|
||||||
|
return profileDb;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LoginAziendaDTO setProfileDb(String profileDb) {
|
||||||
|
this.profileDb = profileDb;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEndpointRestApi() {
|
||||||
|
return endpointRestApi;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LoginAziendaDTO setEndpointRestApi(String endpointRestApi) {
|
||||||
|
this.endpointRestApi = endpointRestApi;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPhpApi() {
|
||||||
|
return phpApi;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LoginAziendaDTO setPhpApi(String phpApi) {
|
||||||
|
this.phpApi = phpApi;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRepoPhoto() {
|
||||||
|
return repoPhoto;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LoginAziendaDTO setRepoPhoto(String repoPhoto) {
|
||||||
|
this.repoPhoto = repoPhoto;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEndpointPvm() {
|
||||||
|
return endpointPvm;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LoginAziendaDTO setEndpointPvm(String endpointPvm) {
|
||||||
|
this.endpointPvm = endpointPvm;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,24 @@ import java.util.List;
|
|||||||
|
|
||||||
public class LoginDTO {
|
public class LoginDTO {
|
||||||
|
|
||||||
public String full_name;
|
private String full_name;
|
||||||
public List<String> availableProfiles;
|
private List<String> availableProfiles;
|
||||||
|
|
||||||
|
public String getFull_name() {
|
||||||
|
return full_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LoginDTO setFull_name(String full_name) {
|
||||||
|
this.full_name = full_name;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getAvailableProfiles() {
|
||||||
|
return availableProfiles;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LoginDTO setAvailableProfiles(List<String> availableProfiles) {
|
||||||
|
this.availableProfiles = availableProfiles;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.login.exception;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.R;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityResources;
|
||||||
|
|
||||||
|
public class InvalidServerCodAziendaException extends Exception {
|
||||||
|
|
||||||
|
public InvalidServerCodAziendaException(String codAzienda, Throwable cause) {
|
||||||
|
super(String.format(UtilityResources.getString(R.string.server_cod_azienda_not_valid), codAzienda), cause);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.login.exception;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.R;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityResources;
|
||||||
|
|
||||||
|
public class InvalidUserDepositException extends Exception {
|
||||||
|
|
||||||
|
public InvalidUserDepositException() {
|
||||||
|
super(UtilityResources.getString(R.string.no_codmdep_available));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.login.exception;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.R;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityResources;
|
||||||
|
|
||||||
|
public class InvalidUsernameException extends Exception {
|
||||||
|
|
||||||
|
public InvalidUsernameException() {
|
||||||
|
super(UtilityResources.getString(R.string.username_error_not_valid));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.login.exception;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.R;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityResources;
|
||||||
|
|
||||||
|
public class ServerNotReachableException extends Exception {
|
||||||
|
|
||||||
|
public ServerNotReachableException(String host, int port, Throwable cause) {
|
||||||
|
super(String.format(UtilityResources.getString(R.string.server_not_reachable), host, port), cause);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.login.rest;
|
||||||
|
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.CommonConst;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
|
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||||
|
import it.integry.integrywmsnative.core.rest.consumers._BaseRESTConsumer;
|
||||||
|
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||||
|
import it.integry.integrywmsnative.gest.login.dto.LoginAziendaDTO;
|
||||||
|
import it.integry.integrywmsnative.gest.login.dto.LoginDTO;
|
||||||
|
import retrofit2.Call;
|
||||||
|
import retrofit2.Callback;
|
||||||
|
import retrofit2.Response;
|
||||||
|
|
||||||
|
@Singleton
|
||||||
|
public class LoginRESTConsumer extends _BaseRESTConsumer {
|
||||||
|
|
||||||
|
|
||||||
|
public void retrieveServerData(String codAzienda, RunnableArgs<LoginAziendaDTO> onComplete, RunnableArgs<Exception> onFailed){
|
||||||
|
|
||||||
|
String host = CommonConst.Login.Azienda.host;
|
||||||
|
int port = CommonConst.Login.Azienda.port;
|
||||||
|
|
||||||
|
LoginRESTConsumerService service = RESTBuilder.getService(LoginRESTConsumerService.class, host, port, false, true);
|
||||||
|
service.loginAzienda(codAzienda).enqueue(new Callback<>() {
|
||||||
|
@Override
|
||||||
|
public void onResponse(Call<ServiceRESTResponse<LoginAziendaDTO>> call, Response<ServiceRESTResponse<LoginAziendaDTO>> response) {
|
||||||
|
analyzeAnswer(response, "LoginAzienda", onComplete, onFailed);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Call<ServiceRESTResponse<LoginAziendaDTO>> call, Throwable t) {
|
||||||
|
Log.e("LoginAzienda", t.toString());
|
||||||
|
onFailed.run(new Exception(t));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void authenticate(String host, int port, String username, String password, RunnableArgs<LoginDTO> onComplete, RunnableArgs<Exception> onFailed){
|
||||||
|
LoginRESTConsumerService service = RESTBuilder.getService(LoginRESTConsumerService.class, host, port, false);
|
||||||
|
service.login(username, password).enqueue(new Callback<>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResponse(Call<ServiceRESTResponse<LoginDTO>> call, Response<ServiceRESTResponse<LoginDTO>> response) {
|
||||||
|
analyzeAnswer(response, "Login", onComplete, onFailed);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Call<ServiceRESTResponse<LoginDTO>> call, final Throwable t) {
|
||||||
|
Log.e("Login", t.toString());
|
||||||
|
onFailed.run(new Exception(t));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,167 +1,103 @@
|
|||||||
package it.integry.integrywmsnative.gest.login.viewmodel;
|
package it.integry.integrywmsnative.gest.login.viewmodel;
|
||||||
|
|
||||||
import android.app.Dialog;
|
import com.annimon.stream.Stream;
|
||||||
import android.content.Intent;
|
|
||||||
import android.text.Html;
|
|
||||||
import android.text.SpannableString;
|
|
||||||
import android.text.Spanned;
|
|
||||||
|
|
||||||
import androidx.appcompat.app.AlertDialog;
|
|
||||||
|
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.R;
|
import javax.inject.Inject;
|
||||||
import it.integry.integrywmsnative.SplashActivity;
|
|
||||||
import it.integry.integrywmsnative.core.di.BindableBoolean;
|
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
|
||||||
import it.integry.integrywmsnative.core.di.BindableString;
|
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.ISimpleOperationCallback;
|
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityProgress;
|
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityServer;
|
import it.integry.integrywmsnative.core.utility.UtilityServer;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||||
import it.integry.integrywmsnative.gest.login.LoginActivity;
|
import it.integry.integrywmsnative.gest.login.exception.InvalidServerCodAziendaException;
|
||||||
import it.integry.integrywmsnative.gest.login.core.LoginHelper;
|
import it.integry.integrywmsnative.gest.login.exception.InvalidUserDepositException;
|
||||||
import it.integry.integrywmsnative.gest.login.dto.LoginAziendaDTO;
|
import it.integry.integrywmsnative.gest.login.exception.ServerNotReachableException;
|
||||||
import it.integry.integrywmsnative.gest.login.dto.LoginDTO;
|
import it.integry.integrywmsnative.gest.login.rest.LoginRESTConsumer;
|
||||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
|
||||||
|
|
||||||
public class LoginViewModel {
|
public class LoginViewModel {
|
||||||
|
|
||||||
public BindableString username = new BindableString();
|
|
||||||
public BindableString password = new BindableString();
|
|
||||||
public BindableString codAzienda = new BindableString();
|
|
||||||
|
|
||||||
public BindableBoolean customSettingsCheckboxEnabled = new BindableBoolean();
|
private final SystemRESTConsumer mSystemRESTConsumer;
|
||||||
public BindableBoolean customSettingsCheckboxChecked = new BindableBoolean();
|
private final LoginRESTConsumer mLoginRESTConsumer;
|
||||||
|
|
||||||
public BindableBoolean loginButtonEnabled = new BindableBoolean();
|
private Listener mListener;
|
||||||
|
|
||||||
|
@Inject
|
||||||
public BindableString usernameError = new BindableString();
|
public LoginViewModel(SystemRESTConsumer systemRESTConsumer, LoginRESTConsumer loginRESTConsumer) {
|
||||||
public BindableString passwordError = new BindableString();
|
this.mSystemRESTConsumer = systemRESTConsumer;
|
||||||
public BindableString codAziendaError = new BindableString();
|
this.mLoginRESTConsumer = loginRESTConsumer;
|
||||||
|
|
||||||
|
|
||||||
private LoginActivity mActivity;
|
|
||||||
|
|
||||||
private Dialog mProgress;
|
|
||||||
|
|
||||||
public LoginViewModel(LoginActivity activity) {
|
|
||||||
this.mActivity = activity;
|
|
||||||
|
|
||||||
loginButtonEnabled.set(true);
|
|
||||||
|
|
||||||
codAzienda.set(SettingsManager.i().getServer().getCodAzienda());
|
|
||||||
|
|
||||||
customSettingsCheckboxChecked.set(SettingsManager.i().getServer().getHost() == null);
|
|
||||||
customSettingsCheckboxEnabled.set(SettingsManager.i().getServer().getHost() != null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public boolean validate() {
|
public void login(String codAzienda, String username, String password) {
|
||||||
if (username.isEmpty() || username.get().length() < 3) {
|
this.sendOnLoadingStarted();
|
||||||
usernameError.set(mActivity.getText(R.string.username_error_not_valid).toString());
|
|
||||||
return false;
|
|
||||||
} else usernameError.set(null);
|
|
||||||
|
|
||||||
if (codAzienda.isEmpty() || codAzienda.get().length() < 3) {
|
mLoginRESTConsumer.retrieveServerData(codAzienda, value -> {
|
||||||
codAziendaError.set(mActivity.getText(R.string.server_cod_azienda_not_valid).toString());
|
|
||||||
return false;
|
|
||||||
} else codAziendaError.set(null);
|
|
||||||
|
|
||||||
return true;
|
final String serverEndpoint = value.getEndpointRestApi();
|
||||||
}
|
|
||||||
|
|
||||||
|
URL u;
|
||||||
|
try {
|
||||||
|
u = new URL(serverEndpoint);
|
||||||
|
} catch (final MalformedURLException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
this.sendError(e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
public void login(boolean areValidData) {
|
final String host = u.getHost();
|
||||||
if (areValidData) {
|
final int port = u.getPort();
|
||||||
loginButtonEnabled.set(false);
|
|
||||||
|
|
||||||
mProgress = UtilityProgress.createDefaultProgressDialog(mActivity);
|
UtilityServer.isEmsApiAvailable(host, port, value1 -> {
|
||||||
|
|
||||||
final LoginHelper loginHelper = new LoginHelper(mActivity, codAzienda.get(), username.get(), password.get());
|
if (value1) { //Is online
|
||||||
|
mLoginRESTConsumer.authenticate(host, port, username, password, loginDTO -> {
|
||||||
|
|
||||||
loginHelper.retrieveServerData(new ISimpleOperationCallback<LoginAziendaDTO>() {
|
SettingsManager.iDB().setAvailableProfiles(loginDTO.getAvailableProfiles());
|
||||||
|
|
||||||
@Override
|
SettingsManager.i().createUserSession();
|
||||||
public void onSuccess(LoginAziendaDTO value) {
|
SettingsManager.i().getUser().setFullname(!UtilityString.isNullOrEmpty(loginDTO.getFull_name()) ? loginDTO.getFull_name() : username);
|
||||||
|
|
||||||
final String serverEndpoint = value.endpointRestApi;
|
List<String> availableProfiles = null;
|
||||||
|
if(loginDTO.getAvailableProfiles() != null && !loginDTO.getAvailableProfiles().isEmpty()) {
|
||||||
URL u;
|
availableProfiles = Stream.of(loginDTO.getAvailableProfiles())
|
||||||
try {
|
.sorted()
|
||||||
u = new URL(serverEndpoint);
|
.toList();
|
||||||
} catch (final MalformedURLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
onLoginFailed(new SpannableString(e.toString()));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
final String host = u.getHost();
|
|
||||||
final int port = u.getPort();
|
|
||||||
|
|
||||||
UtilityServer.isEmsApiAvailable(host, port, value1 -> {
|
|
||||||
|
|
||||||
if (value1) { //Is online
|
|
||||||
loginHelper.doLogin(host, port, new ISimpleOperationCallback<LoginDTO>() {
|
|
||||||
@Override
|
|
||||||
public void onSuccess(final LoginDTO loginDTO) {
|
|
||||||
|
|
||||||
SettingsManager.iDB().setAvailableProfiles(loginDTO.availableProfiles);
|
|
||||||
|
|
||||||
SettingsManager.i().createUserSession();
|
|
||||||
SettingsManager.i().getUser().setFullname(!UtilityString.isNullOrEmpty(loginDTO.full_name) ? loginDTO.full_name : username.get());
|
|
||||||
|
|
||||||
|
|
||||||
mActivity.runOnUiThread(() -> onLoginSuccess(
|
|
||||||
"Benvenuto",
|
|
||||||
Html.fromHtml("Ciao <b>" + loginDTO.full_name + "</b>, la Integry le augura di svolgere al meglio il suo lavoro"),
|
|
||||||
host, port, loginDTO.availableProfiles));
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailed(final Exception ex) {
|
|
||||||
onLoginFailed(new SpannableString(ex.getMessage()));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
} else { //Is not online
|
|
||||||
onLoginFailed(Html.fromHtml(String.format(mActivity.getText(R.string.server_not_reachable).toString(), host, port)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
this.sendOnLoginCompleted(host, port, loginDTO.getFull_name(), availableProfiles);
|
||||||
|
}, this::sendError);
|
||||||
|
|
||||||
|
|
||||||
|
} else { //Is not online
|
||||||
|
this.sendError(new ServerNotReachableException(host, port, null));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailed(Exception ex) {
|
|
||||||
onLoginFailed(Html.fromHtml(String.format(mActivity.getText(R.string.server_cod_azienda_not_valid).toString(), codAzienda.get())));
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
}, ex -> {
|
||||||
}
|
this.sendError(new InvalidServerCodAziendaException(codAzienda, ex));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void loadDepo(String host, int port, Runnable onComplete) {
|
public void loadDepo(String codAzienda, String host, int port, String username, String password, Runnable onComplete) {
|
||||||
|
|
||||||
SettingsManager.i().getServer().setCodAzienda(codAzienda.get());
|
SettingsManager.i().getServer().setCodAzienda(codAzienda);
|
||||||
SettingsManager.i().getServer().setHost(host);
|
SettingsManager.i().getServer().setHost(host);
|
||||||
SettingsManager.i().getServer().setPort(port);
|
SettingsManager.i().getServer().setPort(port);
|
||||||
|
|
||||||
SettingsManager.i().getUser().setUsername(username.get());
|
SettingsManager.i().getUser().setUsername(username);
|
||||||
SettingsManager.i().getUser().setPassword(password.get());
|
SettingsManager.i().getUser().setPassword(password);
|
||||||
|
|
||||||
SystemRESTConsumer.getAvailableCodMdeps(availableCodMdeps -> {
|
this.mSystemRESTConsumer.getAvailableCodMdeps(availableCodMdeps -> {
|
||||||
SettingsManager.iDB().setAvailableCodMdep(availableCodMdeps);
|
SettingsManager.iDB().setAvailableCodMdep(availableCodMdeps);
|
||||||
|
|
||||||
if (availableCodMdeps == null || availableCodMdeps.size() == 0) {
|
if (availableCodMdeps == null || availableCodMdeps.size() == 0) {
|
||||||
onLoginFailed(Html.fromHtml(String.format(mActivity.getText(R.string.no_codmdep_available).toString())));
|
this.sendError(new InvalidUserDepositException());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,72 +105,36 @@ public class LoginViewModel {
|
|||||||
|
|
||||||
|
|
||||||
if (onComplete != null) onComplete.run();
|
if (onComplete != null) onComplete.run();
|
||||||
}, ex -> {
|
}, this::sendError);
|
||||||
//BOH
|
|
||||||
onLoginFailed(new SpannableString(ex.getMessage()));
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void onLoginFailed(final Spanned message) {
|
private void sendOnLoadingStarted() {
|
||||||
mProgress.dismiss();
|
if (this.mListener != null) mListener.onLoadingStarted();
|
||||||
loginButtonEnabled.set(true);
|
|
||||||
mActivity.runOnUiThread(() -> DialogSimpleMessageView.makeErrorDialog(
|
|
||||||
message,
|
|
||||||
null,
|
|
||||||
null)
|
|
||||||
.show(mActivity.getSupportFragmentManager(), "tag"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void sendOnLoadingEnded() {
|
||||||
private void onLoginSuccess(final String title, final Spanned message, final String host, final int port, final List<String> availableProfiles) {
|
if (this.mListener != null) mListener.onLoadingEnded();
|
||||||
mProgress.dismiss();
|
|
||||||
mActivity.runOnUiThread(() -> DialogSimpleMessageView.makeSuccessDialog(
|
|
||||||
title,
|
|
||||||
message,
|
|
||||||
null,
|
|
||||||
() -> showProfileDBSelectionDialog(host, port, availableProfiles))
|
|
||||||
.show(mActivity.getSupportFragmentManager(), "tag"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showProfileDBSelectionDialog(final String host, final int port, final List<String> availableProfiles) {
|
private void sendOnLoginCompleted(String host, int port, String fullName, List<String> availableProfiles) {
|
||||||
if (availableProfiles != null && availableProfiles.size() == 1) {
|
if (this.mListener != null)
|
||||||
SettingsManager.i().getUserSession().setProfileDB(availableProfiles.get(0));
|
mListener.onLoginCompleted(host, port, fullName, availableProfiles);
|
||||||
|
|
||||||
loadDepo(host, port, this::onLoginCompleted);
|
|
||||||
} else {
|
|
||||||
|
|
||||||
// setup the alert builder
|
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(mActivity);
|
|
||||||
builder.setTitle(R.string.action_choose_profile_db);
|
|
||||||
|
|
||||||
// add a list
|
|
||||||
String[] profiles = new String[availableProfiles.size()];
|
|
||||||
profiles = availableProfiles.toArray(profiles);
|
|
||||||
builder.setItems(profiles, (dialog, which) -> {
|
|
||||||
SettingsManager.i().getUserSession().setProfileDB(availableProfiles.get(which));
|
|
||||||
|
|
||||||
loadDepo(host, port, this::onLoginCompleted);
|
|
||||||
});
|
|
||||||
|
|
||||||
// create and show the alert dialog
|
|
||||||
AlertDialog dialog = builder.create();
|
|
||||||
dialog.show();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onLoginCompleted() {
|
private void sendError(Exception ex) {
|
||||||
loginButtonEnabled.set(true);
|
if (this.mListener != null) mListener.onError(ex);
|
||||||
SettingsManager.update();
|
|
||||||
|
|
||||||
startSplashActivity();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LoginViewModel setListener(Listener listener) {
|
||||||
|
this.mListener = listener;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
private void startSplashActivity() {
|
public interface Listener extends ILoadingListener {
|
||||||
mActivity.finish();
|
void onError(Exception ex);
|
||||||
Intent myIntent = new Intent(mActivity, SplashActivity.class);
|
|
||||||
mActivity.startActivity(myIntent);
|
void onLoginCompleted(String host, int port, String fullName, List<String> availableProfiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -262,9 +262,12 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
|
|||||||
mAppliedFilterViewModel.getCurrentDataConsPredicate().addOnPropertyChangedCallback(onPredicateChanged);
|
mAppliedFilterViewModel.getCurrentDataConsPredicate().addOnPropertyChangedCallback(onPredicateChanged);
|
||||||
mAppliedFilterViewModel.getCurrentGruppoMercPredicate().addOnPropertyChangedCallback(onPredicateChanged);
|
mAppliedFilterViewModel.getCurrentGruppoMercPredicate().addOnPropertyChangedCallback(onPredicateChanged);
|
||||||
|
|
||||||
List<FilterChipDTO> filterList = Stream.of(OrdiniUscitaElencoBindings.AVAILABLE_FILTERS.entrySet()).map(Map.Entry::getValue).sortBy(FilterChipDTO::getPosizione).toList();
|
List<FilterChipDTO> filterList = Stream.of(OrdiniUscitaElencoBindings.AVAILABLE_FILTERS.entrySet())
|
||||||
|
.map(Map.Entry::getValue)
|
||||||
|
.sortBy(FilterChipDTO::getPosizione)
|
||||||
|
.toList();
|
||||||
|
|
||||||
for (FilterChipDTO filterChipDTO : filterList){
|
for (FilterChipDTO filterChipDTO : filterList) {
|
||||||
|
|
||||||
FilterChipView filterChipView = new FilterChipView(
|
FilterChipView filterChipView = new FilterChipView(
|
||||||
requireActivity(),
|
requireActivity(),
|
||||||
@@ -697,28 +700,29 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
|
|||||||
|
|
||||||
//new Thread(() -> {
|
//new Thread(() -> {
|
||||||
|
|
||||||
// requireActivity().runOnUiThread(() -> {
|
requireActivity().runOnUiThread(() -> {
|
||||||
List<OrdiniUscitaElencoDTO> tmpList;
|
List<OrdiniUscitaElencoDTO> tmpList;
|
||||||
|
|
||||||
if (filteredList != null) {
|
if (filteredList != null) {
|
||||||
tmpList = filteredList;
|
tmpList = filteredList;
|
||||||
} else if (mAppliedFilterViewModel != null) {
|
} else if (mAppliedFilterViewModel != null) {
|
||||||
mAppliedFilterViewModel.applyAllTests();
|
mAppliedFilterViewModel.applyAllTests();
|
||||||
tmpList = mAppliedFilterViewModel.getMutableFilteredOrderList().getValue();
|
tmpList = mAppliedFilterViewModel.getMutableFilteredOrderList().getValue();
|
||||||
} else {
|
} else {
|
||||||
tmpList = mViewModel.getOrderList().getValue();
|
tmpList = mViewModel.getOrderList().getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
var list = convertDataModelToListModel(tmpList);
|
var list = convertDataModelToListModel(tmpList);
|
||||||
|
|
||||||
this.mOrdiniInevasiMutableData.clear();
|
this.mOrdiniInevasiMutableData.clear();
|
||||||
this.mOrdiniInevasiMutableData.addAll(list);
|
this.mOrdiniInevasiMutableData.addAll(list);
|
||||||
|
|
||||||
fabVisible.set(Stream.of(mOrdiniInevasiMutableData)
|
fabVisible.set(Stream.of(mOrdiniInevasiMutableData)
|
||||||
.anyMatch(y -> y.getSelectedObservable().get()));
|
.anyMatch(y -> y.getSelectedObservable().get()));
|
||||||
// });
|
|
||||||
|
|
||||||
this.onLoadingEnded();
|
this.onLoadingEnded();
|
||||||
|
});
|
||||||
|
|
||||||
//}).start();
|
//}).start();
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -831,7 +835,6 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addOnPreDestroy(Runnable onPreDestroy) {
|
public void addOnPreDestroy(Runnable onPreDestroy) {
|
||||||
this.mOnPreDestroyList.add(onPreDestroy);
|
this.mOnPreDestroyList.add(onPreDestroy);
|
||||||
@@ -848,8 +851,10 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
|
|||||||
|
|
||||||
private void initMtbGrupsCache(Runnable onComplete) {
|
private void initMtbGrupsCache(Runnable onComplete) {
|
||||||
var codMgrpArts = Stream.of(Objects.requireNonNull(this.mViewModel.getOrderList().getValue()))
|
var codMgrpArts = Stream.of(Objects.requireNonNull(this.mViewModel.getOrderList().getValue()))
|
||||||
.flatMap(x -> Stream.of(x.getAvailableClassMerc()))
|
.flatMap(x -> Stream.of(x.getAvailableClassMerc() != null ? x.getAvailableClassMerc() : new ArrayList<>()))
|
||||||
.map(OrdineUscitaInevasoDTO.AvailableClassMerc::getCodMgrp)
|
.map(OrdineUscitaInevasoDTO.AvailableClassMerc::getCodMgrp)
|
||||||
|
.withoutNulls()
|
||||||
|
.distinct()
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
this.mArticoloRESTConsumer.getArtsGroups(codMgrpArts, mtbGrupCache -> {
|
this.mArticoloRESTConsumer.getArtsGroups(codMgrpArts, mtbGrupCache -> {
|
||||||
|
|||||||
@@ -648,7 +648,10 @@ public class VenditaFiltroOrdiniViewModel {
|
|||||||
|
|
||||||
public List<MtbGrup> getAllGruppoMerc(List<MtbGrup> mtbGrupFullList) {
|
public List<MtbGrup> getAllGruppoMerc(List<MtbGrup> mtbGrupFullList) {
|
||||||
var codMgrp = Stream.of(initialOrderList)
|
var codMgrp = Stream.of(initialOrderList)
|
||||||
.flatMap(ordiniUscitaElencoDTO -> Stream.of(ordiniUscitaElencoDTO.getAvailableClassMerc()))
|
.flatMap(ordiniUscitaElencoDTO ->
|
||||||
|
Stream.of(ordiniUscitaElencoDTO.getAvailableClassMerc() != null ?
|
||||||
|
ordiniUscitaElencoDTO.getAvailableClassMerc() :
|
||||||
|
new ArrayList<>()))
|
||||||
.map(OrdineUscitaInevasoDTO.AvailableClassMerc::getCodMgrp)
|
.map(OrdineUscitaInevasoDTO.AvailableClassMerc::getCodMgrp)
|
||||||
.withoutNulls()
|
.withoutNulls()
|
||||||
.distinct()
|
.distinct()
|
||||||
|
|||||||
@@ -276,8 +276,8 @@ public class PickingResiActivity extends BaseActivity implements BottomSheetFrag
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNoteAggiuntiveRequired(RunnableArgs<String> onComplete, Runnable onAbort) {
|
public void onNoteAggiuntiveRequired(RunnableArgs<String> onComplete) {
|
||||||
NoteAggiuntiveLUDialog.make(this, onComplete, onAbort).show();
|
NoteAggiuntiveLUDialog.make(this, onComplete).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -185,9 +185,6 @@ public class PickingResiViewModel {
|
|||||||
|
|
||||||
}, this::sendError);
|
}, this::sendError);
|
||||||
|
|
||||||
}, () -> {
|
|
||||||
this.sendLUClosed();
|
|
||||||
this.sendOnLoadingEnded();
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, this::sendError);
|
}, this::sendError);
|
||||||
@@ -720,8 +717,8 @@ public class PickingResiViewModel {
|
|||||||
return mPickingList;
|
return mPickingList;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendOnNoteAggiuntiveRequired(RunnableArgs<String> onComplete, Runnable onAbort) {
|
private void sendOnNoteAggiuntiveRequired(RunnableArgs<String> onComplete) {
|
||||||
if (this.mListener != null) this.mListener.onNoteAggiuntiveRequired(onComplete, onAbort);
|
if (this.mListener != null) this.mListener.onNoteAggiuntiveRequired(onComplete);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendOnLoadingStarted() {
|
private void sendOnLoadingStarted() {
|
||||||
@@ -798,7 +795,7 @@ public class PickingResiViewModel {
|
|||||||
|
|
||||||
public interface Listener extends ILUPrintListener, ILoadingListener, ILUBaseOperationsListener {
|
public interface Listener extends ILUPrintListener, ILoadingListener, ILUBaseOperationsListener {
|
||||||
|
|
||||||
void onNoteAggiuntiveRequired(RunnableArgs<String> onComplete, Runnable onAbort);
|
void onNoteAggiuntiveRequired(RunnableArgs<String> onComplete);
|
||||||
|
|
||||||
void onError(Exception ex);
|
void onError(Exception ex);
|
||||||
|
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ public class PickingResiRESTConsumer {
|
|||||||
|
|
||||||
|
|
||||||
if(onComplete != null) onComplete.run(values);
|
if(onComplete != null) onComplete.run(values);
|
||||||
}
|
} else onComplete.run(new ArrayList<>());
|
||||||
|
|
||||||
}, onFailed);
|
}, onFailed);
|
||||||
|
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ public class PickingResiListAdapter extends SectionedRecyclerViewAdapter<Picking
|
|||||||
|
|
||||||
holder.mBinding.deactivatedOverBg.setVisibility(!pickingResiListModel.isActive() ? View.VISIBLE : View.GONE);
|
holder.mBinding.deactivatedOverBg.setVisibility(!pickingResiListModel.isActive() ? View.VISIBLE : View.GONE);
|
||||||
holder.mBinding.getRoot().setAlpha(!pickingResiListModel.isActive() ? 0.8f : 1);
|
holder.mBinding.getRoot().setAlpha(!pickingResiListModel.isActive() ? 0.8f : 1);
|
||||||
holder.mBinding.badge1.setBackground(ResourcesCompat.getDrawable(mContext.getResources(), !pickingResiListModel.isActive() ? R.drawable.badge_gray_round_corner : R.drawable.badge1_round_corner, null));
|
holder.mBinding.badge1.setBackground(ResourcesCompat.getDrawable(mContext.getResources(), !pickingResiListModel.isActive() ? R.drawable.badge_round_corner : R.drawable.badge1_round_corner, null));
|
||||||
holder.mBinding.qtaEvasa.setTextColor(ResourcesCompat.getColor(mContext.getResources(), !pickingResiListModel.isActive() ? R.color.gray_600 : R.color.green_700, null));
|
holder.mBinding.qtaEvasa.setTextColor(ResourcesCompat.getColor(mContext.getResources(), !pickingResiListModel.isActive() ? R.color.gray_600 : R.color.green_700, null));
|
||||||
|
|
||||||
holder.mBinding.descrizione.setText(pickingResiListModel.getDescrizione());
|
holder.mBinding.descrizione.setText(pickingResiListModel.getDescrizione());
|
||||||
|
|||||||
@@ -284,10 +284,16 @@ public class ProdVersamentoMaterialeFragment extends BaseFragment implements Pro
|
|||||||
if (offsetCnf.floatValue() != 0 || offsetCol.floatValue() != 0){
|
if (offsetCnf.floatValue() != 0 || offsetCol.floatValue() != 0){
|
||||||
if ( SettingsManager.iDB().isFlagForceAllToColli() || (majorOrder.getOriginalMtbAart() != null && !majorOrder.getOriginalMtbAart().isFlagQtaCnfFissaBoolean())) {
|
if ( SettingsManager.iDB().isFlagForceAllToColli() || (majorOrder.getOriginalMtbAart() != null && !majorOrder.getOriginalMtbAart().isFlagQtaCnfFissaBoolean())) {
|
||||||
majorOrder.setNumCnfBigDecimal(majorOrder.getNumCnfBigDecimal().add(offsetCnf));
|
majorOrder.setNumCnfBigDecimal(majorOrder.getNumCnfBigDecimal().add(offsetCnf));
|
||||||
|
majorOrder.getOriginalOrdineLavorazione().setNumCnfVersamento(majorOrder.getNumCnfBigDecimal().floatValue());
|
||||||
|
|
||||||
majorOrder.setQtaBigDecimal(majorOrder.getQtaBigDecimal().add(offsetCol));
|
majorOrder.setQtaBigDecimal(majorOrder.getQtaBigDecimal().add(offsetCol));
|
||||||
|
majorOrder.getOriginalOrdineLavorazione().setQtaColVersamento(majorOrder.getQtaBigDecimal().floatValue());
|
||||||
} else {
|
} else {
|
||||||
majorOrder.setQtaBigDecimal(majorOrder.getQtaBigDecimal().add(offsetCol));
|
majorOrder.setQtaBigDecimal(majorOrder.getQtaBigDecimal().add(offsetCol));
|
||||||
|
majorOrder.getOriginalOrdineLavorazione().setQtaColVersamento(majorOrder.getQtaBigDecimal().floatValue());
|
||||||
|
|
||||||
majorOrder.setNumCnfBigDecimal(UtilityBigDecimal.divide(majorOrder.getQtaBigDecimal(), qtaCnf));
|
majorOrder.setNumCnfBigDecimal(UtilityBigDecimal.divide(majorOrder.getQtaBigDecimal(), qtaCnf));
|
||||||
|
majorOrder.getOriginalOrdineLavorazione().setNumCnfVersamento(majorOrder.getNumCnfBigDecimal().floatValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -319,6 +325,12 @@ public class ProdVersamentoMaterialeFragment extends BaseFragment implements Pro
|
|||||||
this.openLU();
|
this.openLU();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(Exception ex, boolean requestClose) {
|
||||||
|
super.onError(ex);
|
||||||
|
if(requestClose) popMe();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onWarning(String warningText, Runnable action) {
|
public void onWarning(String warningText, Runnable action) {
|
||||||
this.requireActivity().runOnUiThread(() -> {
|
this.requireActivity().runOnUiThread(() -> {
|
||||||
|
|||||||
@@ -77,8 +77,13 @@ public class ProdVersamentoMaterialeViewModel {
|
|||||||
mtbDepoPosizione.getPosizione(),
|
mtbDepoPosizione.getPosizione(),
|
||||||
getIdMaterialeFromCollo(mtbColt),
|
getIdMaterialeFromCollo(mtbColt),
|
||||||
ordini -> {
|
ordini -> {
|
||||||
setCurrentOrders(ordini, mtbColt.getMtbColr().get(0));
|
if(ordini == null || ordini.isEmpty())
|
||||||
this.sendOnLoadingEnded();
|
this.sendError(new Exception("Nessun ordine compatibile con " + getIdMaterialeFromCollo(mtbColt) + " sulla linea " + mtbDepoPosizione.getPosizione()), true);
|
||||||
|
else {
|
||||||
|
setCurrentOrders(ordini, mtbColt.getMtbColr().get(0));
|
||||||
|
this.sendOnLoadingEnded();
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
e -> this.sendWarning(e.getMessage(), this::sendRequestLUOpen));
|
e -> this.sendWarning(e.getMessage(), this::sendRequestLUOpen));
|
||||||
}
|
}
|
||||||
@@ -194,7 +199,11 @@ public class ProdVersamentoMaterialeViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void sendError(Exception ex) {
|
private void sendError(Exception ex) {
|
||||||
if (this.mListener != null) mListener.onError(ex);
|
if (this.mListener != null) mListener.onError(ex, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sendError(Exception ex, boolean requestClose) {
|
||||||
|
if (this.mListener != null) mListener.onError(ex, requestClose);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendOnDataSaved() {
|
private void sendOnDataSaved() {
|
||||||
@@ -205,7 +214,7 @@ public class ProdVersamentoMaterialeViewModel {
|
|||||||
|
|
||||||
void requestLUOpen();
|
void requestLUOpen();
|
||||||
|
|
||||||
void onError(Exception ex);
|
void onError(Exception ex, boolean requestClose);
|
||||||
|
|
||||||
void onWarning(String warningText, Runnable action);
|
void onWarning(String warningText, Runnable action);
|
||||||
|
|
||||||
|
|||||||
@@ -183,13 +183,14 @@ public class PVOrdineAcquistoEditActivity extends BaseActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void addArticolo(ArticoloOrdine articoloOrdine) {
|
private void addArticolo(ArticoloOrdine articoloOrdine) {
|
||||||
runOnUiThread(() -> EditArticoloDialog.make(this, mhelper, articoloOrdine, articolo -> {
|
|
||||||
|
runOnUiThread(() -> EditArticoloDialog.newInstance(this, mhelper, articoloOrdine, articolo -> {
|
||||||
BarcodeManager.enable();
|
BarcodeManager.enable();
|
||||||
if (articolo != null) {
|
if (articolo != null) {
|
||||||
Toast.makeText(this, "Articolo aggiunto all'ordine!", Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, "Articolo aggiunto all'ordine!", Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
fetchArticoli();
|
fetchArticoli();
|
||||||
}).show());
|
}).show(this.getSupportFragmentManager(), "tag"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fetchDetails() {
|
private void fetchDetails() {
|
||||||
|
|||||||
@@ -1,177 +1,165 @@
|
|||||||
package it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.dialog;
|
package it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.dialog;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.Dialog;
|
import android.content.DialogInterface;
|
||||||
import android.content.Context;
|
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.graphics.drawable.ColorDrawable;
|
import android.graphics.drawable.ColorDrawable;
|
||||||
import android.text.Editable;
|
import android.os.Bundle;
|
||||||
import android.text.TextWatcher;
|
import android.text.InputType;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.view.WindowManager;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
import androidx.databinding.DataBindingUtil;
|
import androidx.databinding.DataBindingUtil;
|
||||||
|
import androidx.fragment.app.DialogFragment;
|
||||||
|
import androidx.lifecycle.MutableLiveData;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.R;
|
import it.integry.integrywmsnative.R;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.entity.ArticoloOrdine;
|
import it.integry.integrywmsnative.core.data_store.db.entity.ArticoloOrdine;
|
||||||
import it.integry.integrywmsnative.core.expansion.BaseDialog;
|
import it.integry.integrywmsnative.core.di.BindableBigDecimal;
|
||||||
|
import it.integry.integrywmsnative.core.di.BindableInteger;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityDialog;
|
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityFocus;
|
import it.integry.integrywmsnative.core.utility.UtilityFocus;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityProgress;
|
|
||||||
import it.integry.integrywmsnative.databinding.DialogPvEditArticoloBinding;
|
import it.integry.integrywmsnative.databinding.DialogPvEditArticoloBinding;
|
||||||
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.helper.PVEditOrderHelper;
|
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.helper.PVEditOrderHelper;
|
||||||
|
|
||||||
public class EditArticoloDialog {
|
public class EditArticoloDialog extends BaseDialogFragment {
|
||||||
|
|
||||||
private Activity mContext;
|
|
||||||
|
|
||||||
private Dialog mDialog;
|
|
||||||
|
|
||||||
|
private final Activity mContext;
|
||||||
private DialogPvEditArticoloBinding mBinding;
|
private DialogPvEditArticoloBinding mBinding;
|
||||||
|
private final PVEditOrderHelper mHelper;
|
||||||
private PVEditOrderHelper mHelper;
|
private final MutableLiveData<ArticoloOrdine> mArticolo = new MutableLiveData<>();
|
||||||
|
private final RunnableArgs<ArticoloOrdine> onDialogDismiss;
|
||||||
private ArticoloOrdine mArticolo;
|
|
||||||
private ArticoloOrdine mSavedArt;
|
|
||||||
|
|
||||||
private boolean mLockedInput = false;
|
private boolean mLockedInput = false;
|
||||||
private Dialog mCurrentProgress;
|
|
||||||
|
|
||||||
|
public final BindableBigDecimal qtaOrd = new BindableBigDecimal(BigDecimal.ZERO);
|
||||||
|
public final BindableInteger numCnf = new BindableInteger(0);
|
||||||
|
public final BindableBigDecimal qtaCnf = new BindableBigDecimal(BigDecimal.ZERO);
|
||||||
|
|
||||||
public static Dialog make(Activity context, PVEditOrderHelper helper, ArticoloOrdine articolo, RunnableArgs<ArticoloOrdine> onDialogDismiss) {
|
public static EditArticoloDialog newInstance(Activity context, PVEditOrderHelper helper, ArticoloOrdine articolo, RunnableArgs<ArticoloOrdine> onDialogDismiss) {
|
||||||
return new EditArticoloDialog(context, helper, articolo, onDialogDismiss).mDialog;
|
return new EditArticoloDialog(context, helper, articolo, onDialogDismiss);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private EditArticoloDialog(Activity context, PVEditOrderHelper helper, ArticoloOrdine articolo, RunnableArgs<ArticoloOrdine> onDialogDismiss) {
|
private EditArticoloDialog(Activity context, PVEditOrderHelper helper, ArticoloOrdine articolo, RunnableArgs<ArticoloOrdine> onDialogDismiss) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mArticolo = articolo;
|
mArticolo.setValue(articolo);
|
||||||
mHelper = helper;
|
mHelper = helper;
|
||||||
|
qtaOrd.set(BigDecimal.valueOf(articolo.getQtaOrd()));
|
||||||
|
numCnf.set(BigDecimal.valueOf(articolo.getQtaOrd()).divide(BigDecimal.valueOf(articolo.getQtaCnf()),0,RoundingMode.CEILING).intValue());
|
||||||
|
qtaCnf.set(BigDecimal.valueOf(articolo.getQtaCnf()));
|
||||||
|
|
||||||
mSavedArt = null;
|
this.onDialogDismiss = onDialogDismiss;
|
||||||
|
|
||||||
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setStyle(DialogFragment.STYLE_NORMAL, R.style.AppTheme_NewMaterial_Dialog_FullscreenDialog);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDismiss(@NonNull DialogInterface dialog) {
|
||||||
|
super.onDismiss(dialog);
|
||||||
|
ArticoloOrdine articolo = mArticolo.getValue();
|
||||||
|
if (articolo != null && articolo.getQtaOrd() <= 0f){
|
||||||
|
articolo = null;
|
||||||
|
}
|
||||||
|
onDialogDismiss.run(articolo);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
mBinding = DataBindingUtil.inflate(inflater, R.layout.dialog_pv_edit_articolo, null, false);
|
mBinding = DataBindingUtil.inflate(inflater, R.layout.dialog_pv_edit_articolo, null, false);
|
||||||
mBinding.setViewmodel(this);
|
mBinding.setView(this);
|
||||||
|
mBinding.toolbar.setTitle("Inserimento articolo");
|
||||||
|
mBinding.inputQtaOrd.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL);
|
||||||
|
getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
|
||||||
|
getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||||
|
initBindings();
|
||||||
|
|
||||||
mDialog = new BaseDialog(context);
|
return mBinding.getRoot();
|
||||||
mDialog.setContentView(mBinding.getRoot());
|
|
||||||
UtilityDialog.setTo90PercentWidth(mContext, mDialog);
|
|
||||||
mDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
|
||||||
|
|
||||||
int qtaCnf = (int) Math.ceil(mArticolo.getQtaOrd() / mArticolo.getQtaCnf());
|
|
||||||
mBinding.qtaTot.setText(String.valueOf(mArticolo.getQtaOrd()));
|
|
||||||
mBinding.qtaCnf.setText(String.valueOf(qtaCnf));
|
|
||||||
mDialog.setOnShowListener(dialog -> {
|
|
||||||
UtilityFocus.focusTextBox(mContext, mBinding.qtaTot);
|
|
||||||
});
|
|
||||||
|
|
||||||
mDialog.setOnDismissListener(dialog -> {
|
|
||||||
onDialogDismiss.run(mSavedArt);
|
|
||||||
});
|
|
||||||
setListeners();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setListeners() {
|
@Override
|
||||||
mBinding.qtaTot.addTextChangedListener(new TextWatcher() {
|
public void onStart() {
|
||||||
@Override
|
super.onStart();
|
||||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
UtilityFocus.focusTextBox(mContext, mBinding.inputQtaOrd);
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
|
||||||
setQtaOrd(s.toString().length() > 0 ? Float.parseFloat(s.toString()) : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void afterTextChanged(Editable s) {
|
|
||||||
}
|
|
||||||
});
|
|
||||||
mBinding.qtaCnf.addTextChangedListener(new TextWatcher() {
|
|
||||||
@Override
|
|
||||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
|
||||||
setQtaCnf(s.toString().length() > 0 ? Integer.parseInt(s.toString()) : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void afterTextChanged(Editable s) {
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setQtaCnf(int qtaCnf) {
|
private void initBindings() {
|
||||||
if (mLockedInput) {
|
|
||||||
mLockedInput = false;
|
|
||||||
} else {
|
|
||||||
mLockedInput = true;
|
|
||||||
|
|
||||||
float qtaTot = qtaCnf * mArticolo.getQtaCnf();
|
BindableBigDecimal.registerListener(qtaOrd, qta -> {
|
||||||
mBinding.qtaTot.setText(String.valueOf(qtaTot));
|
if (!mLockedInput) {
|
||||||
}
|
mLockedInput = true;
|
||||||
}
|
|
||||||
|
|
||||||
public void setQtaOrd(float qtaOrd) {
|
ArticoloOrdine articoloOrdine = mArticolo.getValue();
|
||||||
mArticolo.setQtaOrd(qtaOrd);
|
BigDecimal qtaCnf = BigDecimal.valueOf(articoloOrdine.getQtaCnf());
|
||||||
if (mLockedInput) {
|
int cnf = 0;
|
||||||
mLockedInput = false;
|
if (qtaOrd.get() != null && qtaOrd.get().compareTo(BigDecimal.ZERO) > 0){
|
||||||
} else {
|
cnf = qtaOrd.get().divide(qtaCnf, 0, RoundingMode.CEILING).intValue();
|
||||||
mLockedInput = true;
|
}
|
||||||
mBinding.qtaCnf.setText(String.valueOf((int) Math.ceil(qtaOrd / mArticolo.getQtaCnf())));
|
this.numCnf.set( cnf);
|
||||||
}
|
this.mBinding.executePendingBindings();
|
||||||
|
|
||||||
|
mLockedInput = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
BindableInteger.registerListener(numCnf, qta -> {
|
||||||
|
if (!mLockedInput){
|
||||||
|
mLockedInput = true;
|
||||||
|
|
||||||
|
ArticoloOrdine articoloOrdine = mArticolo.getValue();
|
||||||
|
BigDecimal qtaCnf = BigDecimal.valueOf(articoloOrdine.getQtaCnf());
|
||||||
|
this.qtaOrd.set(BigDecimal.valueOf(numCnf.get() * qtaCnf.floatValue()).setScale(2, RoundingMode.CEILING));
|
||||||
|
this.mBinding.executePendingBindings();
|
||||||
|
|
||||||
|
mLockedInput = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void saveAndExit() {
|
public void saveAndExit() {
|
||||||
this.openProgress();
|
this.onLoadingStarted();
|
||||||
try {
|
try {
|
||||||
float qtaOrd = Float.parseFloat(mBinding.qtaTot.getText().toString());
|
ArticoloOrdine articolo = mArticolo.getValue();
|
||||||
if (qtaOrd <= 0) {
|
if (articolo == null) {
|
||||||
|
throw new Exception("Articolo non valido");
|
||||||
|
}
|
||||||
|
if (qtaOrd.get().compareTo(BigDecimal.ZERO) <= 0) {
|
||||||
throw new Exception("La quantità ordinata deve essere maggiore di 0");
|
throw new Exception("La quantità ordinata deve essere maggiore di 0");
|
||||||
}
|
}
|
||||||
mArticolo.setQtaOrd(qtaOrd);
|
|
||||||
|
articolo.setQtaOrd(qtaOrd.get().floatValue());
|
||||||
|
mArticolo.postValue(articolo);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
mContext.runOnUiThread(() -> UtilityExceptions.defaultException(mContext, e));
|
mContext.runOnUiThread(() -> UtilityExceptions.defaultException(mContext, e));
|
||||||
this.closeProgress();
|
this.onLoadingEnded();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mHelper.saveArticoloToOrdine(mArticolo, () -> {
|
mHelper.saveArticoloToOrdine(mArticolo.getValue(), () -> {
|
||||||
mSavedArt = mArticolo;
|
this.onLoadingEnded();
|
||||||
this.closeProgress();
|
this.dismiss();
|
||||||
mDialog.dismiss();
|
|
||||||
}, e -> mContext.runOnUiThread(() -> UtilityExceptions.defaultException(mContext, e)));
|
}, e -> mContext.runOnUiThread(() -> UtilityExceptions.defaultException(mContext, e)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArticoloOrdine getArticolo() {
|
public ArticoloOrdine getArticolo() {
|
||||||
return mArticolo;
|
return mArticolo.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void cancel() {
|
public void cancel() {
|
||||||
mArticolo = null;
|
mArticolo.postValue(null);
|
||||||
mDialog.dismiss();
|
this.dismiss();
|
||||||
}
|
|
||||||
|
|
||||||
protected void openProgress() {
|
|
||||||
mContext.runOnUiThread(() -> {
|
|
||||||
if (this.mCurrentProgress == null) {
|
|
||||||
this.mCurrentProgress = UtilityProgress.createDefaultProgressDialog(mContext);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void closeProgress() {
|
|
||||||
mContext.runOnUiThread(() -> {
|
|
||||||
if (mCurrentProgress != null) {
|
|
||||||
mCurrentProgress.dismiss();
|
|
||||||
mCurrentProgress = null;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -174,7 +174,7 @@ public class SpedizioneViewModel {
|
|||||||
|
|
||||||
private void getEmptyPickingList(List<SitArtOrdDTO> sitArtOrdList, RunnableArgs<List<PickingObjectDTO>> onComplete) {
|
private void getEmptyPickingList(List<SitArtOrdDTO> sitArtOrdList, RunnableArgs<List<PickingObjectDTO>> onComplete) {
|
||||||
List<String> codMarts = Stream.of(sitArtOrdList)
|
List<String> codMarts = Stream.of(sitArtOrdList)
|
||||||
.map(SitArtOrdDTO::getCodMart)
|
.map(x -> x.getCodMart().trim())
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
this.mArticoloRESTConsumer.getByCodMarts(codMarts, listMtbAarts -> {
|
this.mArticoloRESTConsumer.getByCodMarts(codMarts, listMtbAarts -> {
|
||||||
@@ -183,7 +183,7 @@ public class SpedizioneViewModel {
|
|||||||
MtbAart mtbAart = null;
|
MtbAart mtbAart = null;
|
||||||
|
|
||||||
for (MtbAart mtbAartItem : listMtbAarts) {
|
for (MtbAart mtbAartItem : listMtbAarts) {
|
||||||
if (mtbAartItem.getCodMart().equalsIgnoreCase(sitArtOrdDTO.getCodMart())) {
|
if (mtbAartItem.getCodMart().trim().equalsIgnoreCase(sitArtOrdDTO.getCodMart().trim())) {
|
||||||
mtbAart = mtbAartItem;
|
mtbAart = mtbAartItem;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ public class SpedizioneListAdapter extends SectionedRecyclerViewAdapter<Spedizio
|
|||||||
|
|
||||||
holder.mBinding.deactivatedOverBg.setVisibility(!pickingObjectDTO.isActive() ? View.VISIBLE : View.GONE);
|
holder.mBinding.deactivatedOverBg.setVisibility(!pickingObjectDTO.isActive() ? View.VISIBLE : View.GONE);
|
||||||
holder.mBinding.getRoot().setAlpha(!pickingObjectDTO.isActive() ? 0.8f : 1);
|
holder.mBinding.getRoot().setAlpha(!pickingObjectDTO.isActive() ? 0.8f : 1);
|
||||||
holder.mBinding.badge1.setBackground(ResourcesCompat.getDrawable(mContext.getResources(), !pickingObjectDTO.isActive() ? R.drawable.badge_gray_round_corner : R.drawable.badge1_round_corner, null));
|
holder.mBinding.badge1.setBackground(ResourcesCompat.getDrawable(mContext.getResources(), !pickingObjectDTO.isActive() ? R.drawable.badge_round_corner : R.drawable.badge1_round_corner, null));
|
||||||
holder.mBinding.qtaEvasa.setTextColor(ResourcesCompat.getColor(mContext.getResources(), !pickingObjectDTO.isActive() ? R.color.gray_600 : R.color.green_700, null));
|
holder.mBinding.qtaEvasa.setTextColor(ResourcesCompat.getColor(mContext.getResources(), !pickingObjectDTO.isActive() ? R.color.gray_600 : R.color.green_700, null));
|
||||||
|
|
||||||
holder.mBinding.descrizione.setText(pickingObjectDTO.getDescrizione());
|
holder.mBinding.descrizione.setText(pickingObjectDTO.getDescrizione());
|
||||||
|
|||||||
@@ -0,0 +1,333 @@
|
|||||||
|
package it.integry.integrywmsnative.ui.expandablelayout;
|
||||||
|
|
||||||
|
import static it.integry.integrywmsnative.ui.expandablelayout.ExpandableLayout.State.COLLAPSED;
|
||||||
|
import static it.integry.integrywmsnative.ui.expandablelayout.ExpandableLayout.State.COLLAPSING;
|
||||||
|
import static it.integry.integrywmsnative.ui.expandablelayout.ExpandableLayout.State.EXPANDED;
|
||||||
|
import static it.integry.integrywmsnative.ui.expandablelayout.ExpandableLayout.State.EXPANDING;
|
||||||
|
|
||||||
|
import android.animation.Animator;
|
||||||
|
import android.animation.AnimatorListenerAdapter;
|
||||||
|
import android.animation.ValueAnimator;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.res.Configuration;
|
||||||
|
import android.content.res.TypedArray;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.Parcelable;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.animation.Interpolator;
|
||||||
|
import android.widget.FrameLayout;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.R;
|
||||||
|
|
||||||
|
public class ExpandableLayout extends FrameLayout {
|
||||||
|
public interface State {
|
||||||
|
int COLLAPSED = 0;
|
||||||
|
int COLLAPSING = 1;
|
||||||
|
int EXPANDING = 2;
|
||||||
|
int EXPANDED = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final String KEY_SUPER_STATE = "super_state";
|
||||||
|
public static final String KEY_EXPANSION = "expansion";
|
||||||
|
|
||||||
|
public static final int HORIZONTAL = 0;
|
||||||
|
public static final int VERTICAL = 1;
|
||||||
|
|
||||||
|
private static final int DEFAULT_DURATION = 300;
|
||||||
|
|
||||||
|
private int duration = DEFAULT_DURATION;
|
||||||
|
private float parallax;
|
||||||
|
private float expansion;
|
||||||
|
private int orientation;
|
||||||
|
private int state;
|
||||||
|
|
||||||
|
private Interpolator interpolator = new FastOutSlowInInterpolator();
|
||||||
|
private ValueAnimator animator;
|
||||||
|
|
||||||
|
private ExpandableLayout.OnExpansionUpdateListener listener;
|
||||||
|
|
||||||
|
public ExpandableLayout(Context context) {
|
||||||
|
this(context, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ExpandableLayout(Context context, AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
|
||||||
|
if (attrs != null) {
|
||||||
|
TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.ExpandableLayout);
|
||||||
|
duration = a.getInt(R.styleable.ExpandableLayout_el_duration, DEFAULT_DURATION);
|
||||||
|
expansion = a.getBoolean(R.styleable.ExpandableLayout_el_expanded, false) ? 1 : 0;
|
||||||
|
orientation = a.getInt(R.styleable.ExpandableLayout_android_orientation, VERTICAL);
|
||||||
|
parallax = a.getFloat(R.styleable.ExpandableLayout_el_parallax, 1);
|
||||||
|
a.recycle();
|
||||||
|
|
||||||
|
state = expansion == 0 ? COLLAPSED : EXPANDED;
|
||||||
|
setParallax(parallax);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Parcelable onSaveInstanceState() {
|
||||||
|
Parcelable superState = super.onSaveInstanceState();
|
||||||
|
Bundle bundle = new Bundle();
|
||||||
|
|
||||||
|
expansion = isExpanded() ? 1 : 0;
|
||||||
|
|
||||||
|
bundle.putFloat(KEY_EXPANSION, expansion);
|
||||||
|
bundle.putParcelable(KEY_SUPER_STATE, superState);
|
||||||
|
|
||||||
|
return bundle;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onRestoreInstanceState(Parcelable parcelable) {
|
||||||
|
Bundle bundle = (Bundle) parcelable;
|
||||||
|
expansion = bundle.getFloat(KEY_EXPANSION);
|
||||||
|
state = expansion == 1 ? EXPANDED : COLLAPSED;
|
||||||
|
Parcelable superState = bundle.getParcelable(KEY_SUPER_STATE);
|
||||||
|
|
||||||
|
super.onRestoreInstanceState(superState);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||||
|
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||||
|
|
||||||
|
int width = getMeasuredWidth();
|
||||||
|
int height = getMeasuredHeight();
|
||||||
|
|
||||||
|
int size = orientation == LinearLayout.HORIZONTAL ? width : height;
|
||||||
|
|
||||||
|
setVisibility(expansion == 0 && size == 0 ? GONE : VISIBLE);
|
||||||
|
|
||||||
|
int expansionDelta = size - Math.round(size * expansion);
|
||||||
|
if (parallax > 0) {
|
||||||
|
float parallaxDelta = expansionDelta * parallax;
|
||||||
|
for (int i = 0; i < getChildCount(); i++) {
|
||||||
|
View child = getChildAt(i);
|
||||||
|
if (orientation == HORIZONTAL) {
|
||||||
|
int direction = -1;
|
||||||
|
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR1 && getLayoutDirection() == LAYOUT_DIRECTION_RTL) {
|
||||||
|
direction = 1;
|
||||||
|
}
|
||||||
|
child.setTranslationX(direction * parallaxDelta);
|
||||||
|
} else {
|
||||||
|
child.setTranslationY(-parallaxDelta);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (orientation == HORIZONTAL) {
|
||||||
|
setMeasuredDimension(width - expansionDelta, height);
|
||||||
|
} else {
|
||||||
|
setMeasuredDimension(width, height - expansionDelta);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onConfigurationChanged(Configuration newConfig) {
|
||||||
|
if (animator != null) {
|
||||||
|
animator.cancel();
|
||||||
|
}
|
||||||
|
super.onConfigurationChanged(newConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get expansion state
|
||||||
|
*
|
||||||
|
* @return one of {@link ExpandableLayout.State}
|
||||||
|
*/
|
||||||
|
public int getState() {
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isExpanded() {
|
||||||
|
return state == EXPANDING || state == EXPANDED;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void toggle() {
|
||||||
|
toggle(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void toggle(boolean animate) {
|
||||||
|
if (isExpanded()) {
|
||||||
|
collapse(animate);
|
||||||
|
} else {
|
||||||
|
expand(animate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void expand() {
|
||||||
|
expand(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void expand(boolean animate) {
|
||||||
|
setExpanded(true, animate);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void collapse() {
|
||||||
|
collapse(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void collapse(boolean animate) {
|
||||||
|
setExpanded(false, animate);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convenience method - same as calling setExpanded(expanded, true)
|
||||||
|
*/
|
||||||
|
public void setExpanded(boolean expand) {
|
||||||
|
setExpanded(expand, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExpanded(boolean expand, boolean animate) {
|
||||||
|
if (expand == isExpanded()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int targetExpansion = expand ? 1 : 0;
|
||||||
|
if (animate) {
|
||||||
|
animateSize(targetExpansion);
|
||||||
|
} else {
|
||||||
|
setExpansion(targetExpansion);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getDuration() {
|
||||||
|
return duration;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInterpolator(Interpolator interpolator) {
|
||||||
|
this.interpolator = interpolator;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDuration(int duration) {
|
||||||
|
this.duration = duration;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getExpansion() {
|
||||||
|
return expansion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExpansion(float expansion) {
|
||||||
|
if (this.expansion == expansion) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Infer state from previous value
|
||||||
|
float delta = expansion - this.expansion;
|
||||||
|
if (expansion == 0) {
|
||||||
|
state = COLLAPSED;
|
||||||
|
} else if (expansion == 1) {
|
||||||
|
state = EXPANDED;
|
||||||
|
} else if (delta < 0) {
|
||||||
|
state = COLLAPSING;
|
||||||
|
} else if (delta > 0) {
|
||||||
|
state = EXPANDING;
|
||||||
|
}
|
||||||
|
|
||||||
|
setVisibility(state == COLLAPSED ? GONE : VISIBLE);
|
||||||
|
this.expansion = expansion;
|
||||||
|
requestLayout();
|
||||||
|
|
||||||
|
if (listener != null) {
|
||||||
|
listener.onExpansionUpdate(expansion, state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getParallax() {
|
||||||
|
return parallax;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParallax(float parallax) {
|
||||||
|
// Make sure parallax is between 0 and 1
|
||||||
|
parallax = Math.min(1, Math.max(0, parallax));
|
||||||
|
this.parallax = parallax;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getOrientation() {
|
||||||
|
return orientation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOrientation(int orientation) {
|
||||||
|
if (orientation < 0 || orientation > 1) {
|
||||||
|
throw new IllegalArgumentException("Orientation must be either 0 (horizontal) or 1 (vertical)");
|
||||||
|
}
|
||||||
|
this.orientation = orientation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOnExpansionUpdateListener(ExpandableLayout.OnExpansionUpdateListener listener) {
|
||||||
|
this.listener = listener;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void animateSize(int targetExpansion) {
|
||||||
|
if (animator != null) {
|
||||||
|
animator.cancel();
|
||||||
|
animator = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
setLayerType(View.LAYER_TYPE_HARDWARE, null);
|
||||||
|
|
||||||
|
animator = ValueAnimator.ofFloat(expansion, targetExpansion);
|
||||||
|
animator.setInterpolator(interpolator);
|
||||||
|
animator.setDuration(duration);
|
||||||
|
|
||||||
|
animator.addUpdateListener(valueAnimator -> setExpansion((float) valueAnimator.getAnimatedValue()));
|
||||||
|
animator.addListener(new AnimatorListenerAdapter() {
|
||||||
|
@Override
|
||||||
|
public void onAnimationEnd(Animator animation) {
|
||||||
|
super.onAnimationEnd(animation);
|
||||||
|
|
||||||
|
setLayerType(View.LAYER_TYPE_NONE, null);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
animator.addListener(new ExpandableLayout.ExpansionListener(targetExpansion));
|
||||||
|
|
||||||
|
animator.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface OnExpansionUpdateListener {
|
||||||
|
/**
|
||||||
|
* Callback for expansion updates
|
||||||
|
*
|
||||||
|
* @param expansionFraction Value between 0 (collapsed) and 1 (expanded) representing the the expansion progress
|
||||||
|
* @param state One of {@link ExpandableLayout.State} repesenting the current expansion state
|
||||||
|
*/
|
||||||
|
void onExpansionUpdate(float expansionFraction, int state);
|
||||||
|
}
|
||||||
|
|
||||||
|
private class ExpansionListener implements Animator.AnimatorListener {
|
||||||
|
private int targetExpansion;
|
||||||
|
private boolean canceled;
|
||||||
|
|
||||||
|
public ExpansionListener(int targetExpansion) {
|
||||||
|
this.targetExpansion = targetExpansion;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAnimationStart(Animator animation) {
|
||||||
|
state = targetExpansion == 0 ? COLLAPSING : EXPANDING;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAnimationEnd(Animator animation) {
|
||||||
|
if (!canceled) {
|
||||||
|
state = targetExpansion == 0 ? COLLAPSED : EXPANDED;
|
||||||
|
setExpansion(targetExpansion);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAnimationCancel(Animator animation) {
|
||||||
|
canceled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAnimationRepeat(Animator animation) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
package it.integry.integrywmsnative.ui.expandablelayout;
|
||||||
|
|
||||||
|
public class FastOutSlowInInterpolator extends LookupTableInterpolator {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lookup table values sampled with x at regular intervals between 0 and 1 for a total of
|
||||||
|
* 201 points.
|
||||||
|
*/
|
||||||
|
private static final float[] VALUES = new float[] {
|
||||||
|
0.0000f, 0.0001f, 0.0002f, 0.0005f, 0.0009f, 0.0014f, 0.0020f,
|
||||||
|
0.0027f, 0.0036f, 0.0046f, 0.0058f, 0.0071f, 0.0085f, 0.0101f,
|
||||||
|
0.0118f, 0.0137f, 0.0158f, 0.0180f, 0.0205f, 0.0231f, 0.0259f,
|
||||||
|
0.0289f, 0.0321f, 0.0355f, 0.0391f, 0.0430f, 0.0471f, 0.0514f,
|
||||||
|
0.0560f, 0.0608f, 0.0660f, 0.0714f, 0.0771f, 0.0830f, 0.0893f,
|
||||||
|
0.0959f, 0.1029f, 0.1101f, 0.1177f, 0.1257f, 0.1339f, 0.1426f,
|
||||||
|
0.1516f, 0.1610f, 0.1707f, 0.1808f, 0.1913f, 0.2021f, 0.2133f,
|
||||||
|
0.2248f, 0.2366f, 0.2487f, 0.2611f, 0.2738f, 0.2867f, 0.2998f,
|
||||||
|
0.3131f, 0.3265f, 0.3400f, 0.3536f, 0.3673f, 0.3810f, 0.3946f,
|
||||||
|
0.4082f, 0.4217f, 0.4352f, 0.4485f, 0.4616f, 0.4746f, 0.4874f,
|
||||||
|
0.5000f, 0.5124f, 0.5246f, 0.5365f, 0.5482f, 0.5597f, 0.5710f,
|
||||||
|
0.5820f, 0.5928f, 0.6033f, 0.6136f, 0.6237f, 0.6335f, 0.6431f,
|
||||||
|
0.6525f, 0.6616f, 0.6706f, 0.6793f, 0.6878f, 0.6961f, 0.7043f,
|
||||||
|
0.7122f, 0.7199f, 0.7275f, 0.7349f, 0.7421f, 0.7491f, 0.7559f,
|
||||||
|
0.7626f, 0.7692f, 0.7756f, 0.7818f, 0.7879f, 0.7938f, 0.7996f,
|
||||||
|
0.8053f, 0.8108f, 0.8162f, 0.8215f, 0.8266f, 0.8317f, 0.8366f,
|
||||||
|
0.8414f, 0.8461f, 0.8507f, 0.8551f, 0.8595f, 0.8638f, 0.8679f,
|
||||||
|
0.8720f, 0.8760f, 0.8798f, 0.8836f, 0.8873f, 0.8909f, 0.8945f,
|
||||||
|
0.8979f, 0.9013f, 0.9046f, 0.9078f, 0.9109f, 0.9139f, 0.9169f,
|
||||||
|
0.9198f, 0.9227f, 0.9254f, 0.9281f, 0.9307f, 0.9333f, 0.9358f,
|
||||||
|
0.9382f, 0.9406f, 0.9429f, 0.9452f, 0.9474f, 0.9495f, 0.9516f,
|
||||||
|
0.9536f, 0.9556f, 0.9575f, 0.9594f, 0.9612f, 0.9629f, 0.9646f,
|
||||||
|
0.9663f, 0.9679f, 0.9695f, 0.9710f, 0.9725f, 0.9739f, 0.9753f,
|
||||||
|
0.9766f, 0.9779f, 0.9791f, 0.9803f, 0.9815f, 0.9826f, 0.9837f,
|
||||||
|
0.9848f, 0.9858f, 0.9867f, 0.9877f, 0.9885f, 0.9894f, 0.9902f,
|
||||||
|
0.9910f, 0.9917f, 0.9924f, 0.9931f, 0.9937f, 0.9944f, 0.9949f,
|
||||||
|
0.9955f, 0.9960f, 0.9964f, 0.9969f, 0.9973f, 0.9977f, 0.9980f,
|
||||||
|
0.9984f, 0.9986f, 0.9989f, 0.9991f, 0.9993f, 0.9995f, 0.9997f,
|
||||||
|
0.9998f, 0.9999f, 0.9999f, 1.0000f, 1.0000f
|
||||||
|
};
|
||||||
|
|
||||||
|
public FastOutSlowInInterpolator() {
|
||||||
|
super(VALUES);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package it.integry.integrywmsnative.ui.expandablelayout;
|
||||||
|
|
||||||
|
import android.view.animation.Interpolator;
|
||||||
|
|
||||||
|
abstract class LookupTableInterpolator implements Interpolator {
|
||||||
|
|
||||||
|
private final float[] mValues;
|
||||||
|
private final float mStepSize;
|
||||||
|
|
||||||
|
public LookupTableInterpolator(float[] values) {
|
||||||
|
mValues = values;
|
||||||
|
mStepSize = 1f / (mValues.length - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getInterpolation(float input) {
|
||||||
|
if (input >= 1.0f) {
|
||||||
|
return 1.0f;
|
||||||
|
}
|
||||||
|
if (input <= 0f) {
|
||||||
|
return 0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calculate index - We use min with length - 2 to avoid IndexOutOfBoundsException when
|
||||||
|
// we lerp (linearly interpolate) in the return statement
|
||||||
|
int position = Math.min((int) (input * (mValues.length - 1)), mValues.length - 2);
|
||||||
|
|
||||||
|
// Calculate values to account for small offsets as the lookup table has discrete values
|
||||||
|
float quantized = position * mStepSize;
|
||||||
|
float diff = input - quantized;
|
||||||
|
float weight = diff / mStepSize;
|
||||||
|
|
||||||
|
// Linearly interpolate between the table values
|
||||||
|
return mValues[position] + weight * (mValues[position + 1] - mValues[position]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -77,12 +77,14 @@ public class BottomSheetFragmentLUContentView extends BottomSheetFragmentBaseVie
|
|||||||
this.mViewModel.getObservableMtbColt().addOnPropertyChangedCallback(new Observable.OnPropertyChangedCallback() {
|
this.mViewModel.getObservableMtbColt().addOnPropertyChangedCallback(new Observable.OnPropertyChangedCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onPropertyChanged(Observable sender, int propertyId) {
|
public void onPropertyChanged(Observable sender, int propertyId) {
|
||||||
if(mViewModel.getObservableMtbColt().get() != null) {
|
var mtbColt = mViewModel.getObservableMtbColt().get();
|
||||||
|
|
||||||
|
if(mtbColt != null) {
|
||||||
initAdapter();
|
initAdapter();
|
||||||
|
|
||||||
onMtbColrItemChanged();
|
onMtbColrItemChanged();
|
||||||
|
|
||||||
mViewModel.getObservableMtbColt().get().getMtbColr().addOnListChangedCallback(new OnListGeneralChangedCallback() {
|
mtbColt.getMtbColr().addOnListChangedCallback(new OnListGeneralChangedCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onChanged(ObservableList sender) {
|
public void onChanged(ObservableList sender) {
|
||||||
onMtbColrItemChanged();
|
onMtbColrItemChanged();
|
||||||
|
|||||||
@@ -0,0 +1,75 @@
|
|||||||
|
package it.integry.integrywmsnative.view.dialogs.ask_should_versamento_automatico_ul;
|
||||||
|
|
||||||
|
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.view.WindowManager;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.databinding.DataBindingUtil;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.R;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
|
import it.integry.integrywmsnative.databinding.DialogAskShouldVersamentoAutomaticoUlBinding;
|
||||||
|
|
||||||
|
public class DialogAskShouldVersamentoAutomaticoULView extends BaseDialogFragment {
|
||||||
|
|
||||||
|
private RunnableArgs<Boolean> mOnDismiss;
|
||||||
|
private DialogAskShouldVersamentoAutomaticoUlBinding mBindings;
|
||||||
|
|
||||||
|
private boolean returnValue = false;
|
||||||
|
|
||||||
|
public static DialogAskShouldVersamentoAutomaticoULView newInstance(@NotNull RunnableArgs<Boolean> onDismiss) {
|
||||||
|
return new DialogAskShouldVersamentoAutomaticoULView(onDismiss);
|
||||||
|
}
|
||||||
|
|
||||||
|
private DialogAskShouldVersamentoAutomaticoULView(@NotNull RunnableArgs<Boolean> onDismiss) {
|
||||||
|
super();
|
||||||
|
|
||||||
|
this.mOnDismiss = onDismiss;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
|
mBindings = DataBindingUtil.inflate(inflater, R.layout.dialog_ask_should_versamento_automatico_ul, container, false);
|
||||||
|
mBindings.setLifecycleOwner(this);
|
||||||
|
|
||||||
|
getDialog().setCanceledOnTouchOutside(false);
|
||||||
|
getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||||
|
getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
|
||||||
|
|
||||||
|
mBindings.setView(this);
|
||||||
|
|
||||||
|
return mBindings.getRoot();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDismiss(@NonNull DialogInterface dialog) {
|
||||||
|
super.onDismiss(dialog);
|
||||||
|
|
||||||
|
if (mOnDismiss != null) {
|
||||||
|
this.mOnDismiss.run(returnValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void confirm() {
|
||||||
|
this.returnValue = true;
|
||||||
|
dismiss();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void abort() {
|
||||||
|
this.returnValue = false;
|
||||||
|
dismiss();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@ package it.integry.integrywmsnative.view.dialogs.input_quantity_v2;
|
|||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.expansion.RunnableArgsWithReturn;
|
||||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityBigDecimal;
|
import it.integry.integrywmsnative.core.utility.UtilityBigDecimal;
|
||||||
|
|
||||||
@@ -27,10 +28,14 @@ public class DialogInputQuantityV2DTO {
|
|||||||
private BigDecimal qtaCnfAvailable;
|
private BigDecimal qtaCnfAvailable;
|
||||||
|
|
||||||
private boolean canPartitaMagBeChanged = true;
|
private boolean canPartitaMagBeChanged = true;
|
||||||
|
private boolean isDataScadMandatory = false;
|
||||||
|
private boolean isNotesAllowed = false;
|
||||||
private boolean canLUBeClosed;
|
private boolean canLUBeClosed;
|
||||||
|
|
||||||
private String partitaMag;
|
private String partitaMag;
|
||||||
|
private String note;
|
||||||
private Date dataScad;
|
private Date dataScad;
|
||||||
|
private RunnableArgsWithReturn<DialogInputQuantityV2ViewModel,String> suggestPartitaMag;
|
||||||
|
|
||||||
private boolean canOverflowOrderQuantity;
|
private boolean canOverflowOrderQuantity;
|
||||||
|
|
||||||
@@ -178,6 +183,15 @@ public class DialogInputQuantityV2DTO {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getNote() {
|
||||||
|
return note;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DialogInputQuantityV2DTO setNote(String note) {
|
||||||
|
this.note = note;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public Date getDataScad() {
|
public Date getDataScad() {
|
||||||
return dataScad;
|
return dataScad;
|
||||||
}
|
}
|
||||||
@@ -195,4 +209,31 @@ public class DialogInputQuantityV2DTO {
|
|||||||
this.canOverflowOrderQuantity = canOverflowOrderQuantity;
|
this.canOverflowOrderQuantity = canOverflowOrderQuantity;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DialogInputQuantityV2DTO setDataScadMandatory(boolean dataScadMandatory) {
|
||||||
|
isDataScadMandatory = dataScadMandatory;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isDataScadMandatory() {
|
||||||
|
return isDataScadMandatory ;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isNotesAllowed() {
|
||||||
|
return isNotesAllowed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DialogInputQuantityV2DTO setNotesAllowed(boolean notesAllowed) {
|
||||||
|
isNotesAllowed = notesAllowed;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RunnableArgsWithReturn<DialogInputQuantityV2ViewModel, String> getSuggestPartitaMag() {
|
||||||
|
return suggestPartitaMag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DialogInputQuantityV2DTO setSuggestPartitaMag(RunnableArgsWithReturn<DialogInputQuantityV2ViewModel, String> suggestPartitaMag) {
|
||||||
|
this.suggestPartitaMag = suggestPartitaMag;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import java.util.Date;
|
|||||||
public class DialogInputQuantityV2ResultDTO {
|
public class DialogInputQuantityV2ResultDTO {
|
||||||
|
|
||||||
private String partitaMag;
|
private String partitaMag;
|
||||||
|
private String note;
|
||||||
private Date dataScad;
|
private Date dataScad;
|
||||||
|
|
||||||
private BigDecimal numCnf;
|
private BigDecimal numCnf;
|
||||||
@@ -21,6 +22,15 @@ public class DialogInputQuantityV2ResultDTO {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getNote() {
|
||||||
|
return note;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DialogInputQuantityV2ResultDTO setNote(String note) {
|
||||||
|
this.note = note;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public Date getDataScad() {
|
public Date getDataScad() {
|
||||||
return dataScad;
|
return dataScad;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ public class DialogInputQuantityV2View extends BaseDialogFragment implements Dia
|
|||||||
private Runnable mOnAbort;
|
private Runnable mOnAbort;
|
||||||
|
|
||||||
public ObservableField<String> currentPartitaMag = new ObservableField<>();
|
public ObservableField<String> currentPartitaMag = new ObservableField<>();
|
||||||
|
public ObservableField<String> currentNotes = new ObservableField<>();
|
||||||
public ObservableField<Date> currentDataScad = new ObservableField<>();
|
public ObservableField<Date> currentDataScad = new ObservableField<>();
|
||||||
|
|
||||||
public ObservableField<BigDecimal> currentNumCnf = new ObservableField<>();
|
public ObservableField<BigDecimal> currentNumCnf = new ObservableField<>();
|
||||||
@@ -67,6 +68,7 @@ public class DialogInputQuantityV2View extends BaseDialogFragment implements Dia
|
|||||||
public ObservableField<Boolean> enabledQtaTot = new ObservableField<>(true);
|
public ObservableField<Boolean> enabledQtaTot = new ObservableField<>(true);
|
||||||
|
|
||||||
public ObservableField<Boolean> enabledChangePartitaMag = new ObservableField<>(true);
|
public ObservableField<Boolean> enabledChangePartitaMag = new ObservableField<>(true);
|
||||||
|
public ObservableField<Boolean> enabledNotes = new ObservableField<>(false);
|
||||||
public ObservableField<Boolean> enabledLUCloseButton = new ObservableField<>(true);
|
public ObservableField<Boolean> enabledLUCloseButton = new ObservableField<>(true);
|
||||||
|
|
||||||
private Context context;
|
private Context context;
|
||||||
@@ -127,6 +129,8 @@ public class DialogInputQuantityV2View extends BaseDialogFragment implements Dia
|
|||||||
.setCanOverflowOrderQuantity(mDialogInputQuantityV2DTO.isCanOverflowOrderQuantity())
|
.setCanOverflowOrderQuantity(mDialogInputQuantityV2DTO.isCanOverflowOrderQuantity())
|
||||||
.setQtaCnfAvailable(mDialogInputQuantityV2DTO.getQtaCnfAvailable())
|
.setQtaCnfAvailable(mDialogInputQuantityV2DTO.getQtaCnfAvailable())
|
||||||
.setPartitaMag(mDialogInputQuantityV2DTO.getPartitaMag())
|
.setPartitaMag(mDialogInputQuantityV2DTO.getPartitaMag())
|
||||||
|
.setNote(mDialogInputQuantityV2DTO.getNote())
|
||||||
|
.setSuggestPartitaMagRunnable(mDialogInputQuantityV2DTO.getSuggestPartitaMag())
|
||||||
.setDataScad(mDialogInputQuantityV2DTO.getDataScad());
|
.setDataScad(mDialogInputQuantityV2DTO.getDataScad());
|
||||||
|
|
||||||
mBindings.setView(this);
|
mBindings.setView(this);
|
||||||
@@ -196,6 +200,12 @@ public class DialogInputQuantityV2View extends BaseDialogFragment implements Dia
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
UtilityObservable.addPropertyChanged(this.currentNotes, (value) -> {
|
||||||
|
if (this.mEnableDataCallback) {
|
||||||
|
this.mViewModel.setNote(value);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
UtilityObservable.addPropertyChanged(this.currentDataScad, (value) -> {
|
UtilityObservable.addPropertyChanged(this.currentDataScad, (value) -> {
|
||||||
if (this.mEnableDataCallback) {
|
if (this.mEnableDataCallback) {
|
||||||
this.mViewModel.setDataScad(value);
|
this.mViewModel.setDataScad(value);
|
||||||
@@ -326,6 +336,8 @@ public class DialogInputQuantityV2View extends BaseDialogFragment implements Dia
|
|||||||
|
|
||||||
this.mViewModel.setCanPartitaMagBeChanged(this.mDialogInputQuantityV2DTO.isCanPartitaMagBeChanged());
|
this.mViewModel.setCanPartitaMagBeChanged(this.mDialogInputQuantityV2DTO.isCanPartitaMagBeChanged());
|
||||||
this.enabledChangePartitaMag.set(this.mDialogInputQuantityV2DTO.isCanPartitaMagBeChanged());
|
this.enabledChangePartitaMag.set(this.mDialogInputQuantityV2DTO.isCanPartitaMagBeChanged());
|
||||||
|
this.mViewModel.shouldAskDataScad = this.mDialogInputQuantityV2DTO.isDataScadMandatory();
|
||||||
|
this.enabledNotes.set(this.mDialogInputQuantityV2DTO.isNotesAllowed());
|
||||||
this.enabledLUCloseButton.set(this.mDialogInputQuantityV2DTO.isCanLUBeClosed());
|
this.enabledLUCloseButton.set(this.mDialogInputQuantityV2DTO.isCanLUBeClosed());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -350,6 +362,7 @@ public class DialogInputQuantityV2View extends BaseDialogFragment implements Dia
|
|||||||
this.mEnableDataCallback = false;
|
this.mEnableDataCallback = false;
|
||||||
|
|
||||||
this.currentPartitaMag.set(this.mViewModel.getPartitaMag());
|
this.currentPartitaMag.set(this.mViewModel.getPartitaMag());
|
||||||
|
this.currentNotes.set(this.mViewModel.getNote());
|
||||||
this.currentDataScad.set(this.mViewModel.getDataScad());
|
this.currentDataScad.set(this.mViewModel.getDataScad());
|
||||||
|
|
||||||
this.currentNumCnf.set(this.mViewModel.getNumCnf());
|
this.currentNumCnf.set(this.mViewModel.getNumCnf());
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import java.util.Date;
|
|||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.RunnableArgsWithReturn;
|
||||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.model.Ean13PesoModel;
|
import it.integry.integrywmsnative.core.rest.model.Ean13PesoModel;
|
||||||
@@ -59,8 +60,11 @@ public class DialogInputQuantityV2ViewModel {
|
|||||||
private BigDecimal internalQtaTot;
|
private BigDecimal internalQtaTot;
|
||||||
|
|
||||||
private String internalPartitaMag;
|
private String internalPartitaMag;
|
||||||
|
private String internalNote;
|
||||||
private Date internalDataScad;
|
private Date internalDataScad;
|
||||||
|
|
||||||
|
private RunnableArgsWithReturn<DialogInputQuantityV2ViewModel,String> suggestPartitaMagRunnable;
|
||||||
|
|
||||||
private boolean canOverflowOrderQuantity;
|
private boolean canOverflowOrderQuantity;
|
||||||
private boolean canPartitaMagBeChanged;
|
private boolean canPartitaMagBeChanged;
|
||||||
private int onNumCnfInputChanged;
|
private int onNumCnfInputChanged;
|
||||||
@@ -98,8 +102,10 @@ public class DialogInputQuantityV2ViewModel {
|
|||||||
this.internalQtaTot = totalQtaOrd;
|
this.internalQtaTot = totalQtaOrd;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.shouldAskDataScad = mtbAart.get().isFlagTracciabilitaBoolean() && mtbAart.get().getGgScadPartita() != null && mtbAart.get().getGgScadPartita() > 0;
|
if (this.shouldAskDataScad == null){
|
||||||
this.shouldShowDataScad = this.internalDataScad != null;
|
this.shouldAskDataScad = mtbAart.get().isFlagTracciabilitaBoolean() && mtbAart.get().getGgScadPartita() != null && mtbAart.get().getGgScadPartita() > 0;
|
||||||
|
}
|
||||||
|
this.shouldShowDataScad = this.shouldAskDataScad || this.internalDataScad != null;
|
||||||
|
|
||||||
this.blockedNumCnf.set(false);
|
this.blockedNumCnf.set(false);
|
||||||
this.blockedQtaCnf.set(false);
|
this.blockedQtaCnf.set(false);
|
||||||
@@ -194,6 +200,10 @@ public class DialogInputQuantityV2ViewModel {
|
|||||||
return internalPartitaMag;
|
return internalPartitaMag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getNote() {
|
||||||
|
return internalNote;
|
||||||
|
}
|
||||||
|
|
||||||
public Date getDataScad() {
|
public Date getDataScad() {
|
||||||
return internalDataScad;
|
return internalDataScad;
|
||||||
}
|
}
|
||||||
@@ -285,6 +295,10 @@ public class DialogInputQuantityV2ViewModel {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean canPartitaMagBeChanged() {
|
||||||
|
return canPartitaMagBeChanged;
|
||||||
|
}
|
||||||
|
|
||||||
public DialogInputQuantityV2ViewModel setPartitaMag(String internalPartitaMag) {
|
public DialogInputQuantityV2ViewModel setPartitaMag(String internalPartitaMag) {
|
||||||
this.internalPartitaMag = internalPartitaMag;
|
this.internalPartitaMag = internalPartitaMag;
|
||||||
return this;
|
return this;
|
||||||
@@ -389,9 +403,16 @@ public class DialogInputQuantityV2ViewModel {
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
} else if (mtbAart.get().isFlagTracciabilitaBoolean() && UtilityString.isNullOrEmpty(internalPartitaMag)) {
|
} else if (mtbAart.get().isFlagTracciabilitaBoolean() && UtilityString.isNullOrEmpty(internalPartitaMag)) {
|
||||||
|
if (suggestPartitaMagRunnable != null){
|
||||||
this.mListener.onError(new InvalidBatchLotException());
|
internalPartitaMag = suggestPartitaMagRunnable.run(this);
|
||||||
return false;
|
if (internalPartitaMag == null){
|
||||||
|
this.mListener.onError(new InvalidBatchLotException());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
this.mListener.onError(new InvalidBatchLotException());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
} else if (this.shouldAskDataScad && UtilityString.isNullOrEmpty(internalPartitaMag)) {
|
} else if (this.shouldAskDataScad && UtilityString.isNullOrEmpty(internalPartitaMag)) {
|
||||||
|
|
||||||
@@ -445,6 +466,7 @@ public class DialogInputQuantityV2ViewModel {
|
|||||||
.setDataScad(this.internalDataScad)
|
.setDataScad(this.internalDataScad)
|
||||||
.setNumCnf(this.internalNumCnf)
|
.setNumCnf(this.internalNumCnf)
|
||||||
.setQtaCnf(this.internalQtaCnf)
|
.setQtaCnf(this.internalQtaCnf)
|
||||||
|
.setNote(this.internalNote)
|
||||||
.setQtaTot(this.internalQtaTot);
|
.setQtaTot(this.internalQtaTot);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -453,6 +475,16 @@ public class DialogInputQuantityV2ViewModel {
|
|||||||
this.mListener = listener;
|
this.mListener = listener;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DialogInputQuantityV2ViewModel setNote(String value) {
|
||||||
|
this.internalNote = value;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DialogInputQuantityV2ViewModel setSuggestPartitaMagRunnable(RunnableArgsWithReturn<DialogInputQuantityV2ViewModel,String> suggestPartitaMagRunnable) {
|
||||||
|
this.suggestPartitaMagRunnable = suggestPartitaMagRunnable;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public interface Listener {
|
public interface Listener {
|
||||||
void onDataChanged();
|
void onDataChanged();
|
||||||
|
|
||||||
|
|||||||
@@ -10,21 +10,23 @@ import android.view.LayoutInflater;
|
|||||||
import androidx.databinding.DataBindingUtil;
|
import androidx.databinding.DataBindingUtil;
|
||||||
import it.integry.integrywmsnative.R;
|
import it.integry.integrywmsnative.R;
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityDialog;
|
||||||
import it.integry.integrywmsnative.databinding.DialogNoteAggiuntiveNuovaUlBinding;
|
import it.integry.integrywmsnative.databinding.DialogNoteAggiuntiveNuovaUlBinding;
|
||||||
|
|
||||||
public class NoteAggiuntiveLUDialog {
|
public class NoteAggiuntiveLUDialog {
|
||||||
|
|
||||||
private Dialog mDialog;
|
private Dialog mDialog;
|
||||||
|
|
||||||
public static Dialog make(Context context, final RunnableArgs<String> onComplete, final Runnable onAbort) {
|
public static Dialog make(Context context, final RunnableArgs<String> onComplete) {
|
||||||
return new NoteAggiuntiveLUDialog(context, onComplete, onAbort).mDialog;
|
return new NoteAggiuntiveLUDialog(context, onComplete).mDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
private NoteAggiuntiveLUDialog(Context context, final RunnableArgs<String> onComplete, final Runnable onAbort){
|
private NoteAggiuntiveLUDialog(Context context, final RunnableArgs<String> onComplete){
|
||||||
|
|
||||||
LayoutInflater inflater = (LayoutInflater) context.getSystemService( Context.LAYOUT_INFLATER_SERVICE );
|
LayoutInflater inflater = (LayoutInflater) context.getSystemService( Context.LAYOUT_INFLATER_SERVICE );
|
||||||
DialogNoteAggiuntiveNuovaUlBinding bindings = DataBindingUtil.inflate(inflater, R.layout.dialog_note_aggiuntive_nuova_ul, null, false);
|
DialogNoteAggiuntiveNuovaUlBinding bindings = DataBindingUtil.inflate(inflater, R.layout.dialog_note_aggiuntive_nuova_ul, null, false);
|
||||||
|
|
||||||
|
|
||||||
mDialog = new Dialog(context);
|
mDialog = new Dialog(context);
|
||||||
mDialog.setContentView(bindings.getRoot());
|
mDialog.setContentView(bindings.getRoot());
|
||||||
|
|
||||||
@@ -32,17 +34,14 @@ public class NoteAggiuntiveLUDialog {
|
|||||||
mDialog.setCancelable(false);
|
mDialog.setCancelable(false);
|
||||||
mDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
mDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||||
|
|
||||||
|
UtilityDialog.setTo90PercentWidth(context, mDialog);
|
||||||
|
|
||||||
|
|
||||||
bindings.buttonConfirm.setOnClickListener(v -> {
|
bindings.buttonConfirm.setOnClickListener(v -> {
|
||||||
mDialog.dismiss();
|
mDialog.dismiss();
|
||||||
if(onComplete != null) onComplete.run(bindings.additionalNotesText.getText().toString());
|
if(onComplete != null) onComplete.run(bindings.additionalNotesText.getText().toString());
|
||||||
});
|
});
|
||||||
|
|
||||||
bindings.buttonAbort.setOnClickListener(v -> {
|
|
||||||
mDialog.dismiss();
|
|
||||||
if(onAbort != null) onAbort.run();
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,170 @@
|
|||||||
|
package it.integry.integrywmsnative.view.dialogs.versamento_automatico_ul_done;
|
||||||
|
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.graphics.drawable.ColorDrawable;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.text.Html;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.view.WindowManager;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
import androidx.databinding.DataBindingUtil;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.R;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
|
||||||
|
import it.integry.integrywmsnative.core.rest.model.VersamentoAutomaticoULResponseDTO;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityDialog;
|
||||||
|
import it.integry.integrywmsnative.databinding.DialogVersamentoAutomaticoUlDoneBinding;
|
||||||
|
|
||||||
|
public class DialogVersamentoAutomaticoULDoneView extends BaseDialogFragment {
|
||||||
|
|
||||||
|
public final VersamentoAutomaticoULResponseDTO versamentoAutomaticoULResponseDTO;
|
||||||
|
private final Runnable mOnDismiss;
|
||||||
|
|
||||||
|
private DialogVersamentoAutomaticoUlDoneBinding mBindings;
|
||||||
|
|
||||||
|
public static DialogVersamentoAutomaticoULDoneView newInstance(@NotNull VersamentoAutomaticoULResponseDTO versamentoAutomaticoULResponseDTO, @NotNull Runnable onDismiss) {
|
||||||
|
return new DialogVersamentoAutomaticoULDoneView(versamentoAutomaticoULResponseDTO, onDismiss);
|
||||||
|
}
|
||||||
|
|
||||||
|
private DialogVersamentoAutomaticoULDoneView(@NotNull VersamentoAutomaticoULResponseDTO versamentoAutomaticoULResponseDTO, @NotNull Runnable onDismiss) {
|
||||||
|
super();
|
||||||
|
|
||||||
|
this.versamentoAutomaticoULResponseDTO = versamentoAutomaticoULResponseDTO;
|
||||||
|
this.mOnDismiss = onDismiss;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
|
mBindings = DataBindingUtil.inflate(inflater, R.layout.dialog_versamento_automatico_ul_done, container, false);
|
||||||
|
mBindings.setLifecycleOwner(this);
|
||||||
|
|
||||||
|
getDialog().setCanceledOnTouchOutside(false);
|
||||||
|
getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||||
|
getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
|
||||||
|
|
||||||
|
UtilityDialog.setTo95PercentWidth(requireContext(), this);
|
||||||
|
|
||||||
|
mBindings.setView(this);
|
||||||
|
|
||||||
|
this.initTitle();
|
||||||
|
this.initContent();
|
||||||
|
|
||||||
|
return mBindings.getRoot();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDismiss(@NonNull DialogInterface dialog) {
|
||||||
|
super.onDismiss(dialog);
|
||||||
|
|
||||||
|
if (mOnDismiss != null) {
|
||||||
|
this.mOnDismiss.run();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void initTitle() {
|
||||||
|
int colorBackgroundTitle = -1;
|
||||||
|
|
||||||
|
if (versamentoAutomaticoULResponseDTO.getFailed() == null || versamentoAutomaticoULResponseDTO.getFailed().isEmpty()) {
|
||||||
|
//SUCCESS
|
||||||
|
colorBackgroundTitle = ContextCompat.getColor(requireContext(), R.color.green_300);
|
||||||
|
} else {
|
||||||
|
//WARNING
|
||||||
|
colorBackgroundTitle = ContextCompat.getColor(requireContext(), R.color.yellow_600);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
mBindings.base.setBackgroundColor(colorBackgroundTitle);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initContent() {
|
||||||
|
String text;
|
||||||
|
|
||||||
|
if (versamentoAutomaticoULResponseDTO.getFailed() == null || versamentoAutomaticoULResponseDTO.getFailed().isEmpty()) {
|
||||||
|
//SUCCESS
|
||||||
|
text = "Versamento completato con successo";
|
||||||
|
} else {
|
||||||
|
//WARNING
|
||||||
|
text = "Il sistema non è riuscito a versare <b>" + versamentoAutomaticoULResponseDTO.getFailed().size() +
|
||||||
|
" " + getResources().getQuantityString(R.plurals.articles, versamentoAutomaticoULResponseDTO.getFailed().size()) + "</b>";
|
||||||
|
}
|
||||||
|
|
||||||
|
mBindings.descriptionText.setText(Html.fromHtml(text));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// var notCompletedListAdapter = new BaseAdapter() {
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public View getView(int position, View convertView, ViewGroup parent) {
|
||||||
|
//
|
||||||
|
// var mtbColr = versamentoAutomaticoULResponseDTO.getFailed().get(position);
|
||||||
|
//
|
||||||
|
// var inflater = LayoutInflater.from(requireContext());
|
||||||
|
// DialogVersamentoAutomaticoUlDoneNotCompletedListItemBinding binding = null;
|
||||||
|
//
|
||||||
|
// if(convertView == null) {
|
||||||
|
// binding = DataBindingUtil.inflate(inflater, R.layout.dialog_versamento_automatico_ul_done__not_completed_list_item, parent, false);
|
||||||
|
// } else {
|
||||||
|
// binding = DataBindingUtil.findBinding(convertView);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// binding.setItem(mtbColr);
|
||||||
|
//
|
||||||
|
// convertView = binding.getRoot();
|
||||||
|
//
|
||||||
|
// //Setting qty with unt_mis
|
||||||
|
// if (!SettingsManager.iDB().isFlagForceAllToColli() && (mtbColr.getMtbAart() == null || mtbColr.getMtbAart().isFlagQtaCnfFissaBoolean())) {
|
||||||
|
// String text = UtilityNumber.decimalToString(mtbColr.getQtaCol());
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// if (mtbColr.getMtbAart() != null) {
|
||||||
|
// text += !UtilityString.isNullOrEmpty(mtbColr.getMtbAart().getUntMis()) ? "\n" + mtbColr.getMtbAart().getUntMis() : "";
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// binding.qtaTextview.setText(text);
|
||||||
|
// } else {
|
||||||
|
// binding.qtaTextview.setText(UtilityNumber.decimalToString(mtbColr.getNumCnf()) + "\n" + UtilityResources.getString(R.string.unt_mis_col));
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// return convertView;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public long getItemId(int position) {
|
||||||
|
// return position;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public Object getItem(int position) {
|
||||||
|
// return position;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public int getCount() {
|
||||||
|
// return versamentoAutomaticoULResponseDTO.getFailed().size();
|
||||||
|
// }
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// mBindings.detailsNotCompletedList.setAdapter(notCompletedListAdapter);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// public void toggleDetailVisibility() {
|
||||||
|
// mBindings.detailsContainer.toggle(true);
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
|
|
||||||
|
|
||||||
<solid android:color="@color/orange_600" />
|
|
||||||
|
|
||||||
<padding
|
|
||||||
android:left="1dp"
|
|
||||||
android:right="1dp"
|
|
||||||
android:top="1dp" />
|
|
||||||
|
|
||||||
<corners android:radius="5dp" />
|
|
||||||
</shape>
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
|
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||||
|
|
||||||
<solid android:color="@color/gray_600" />
|
<solid android:color="@color/white" />
|
||||||
|
|
||||||
<padding
|
<padding
|
||||||
android:left="6dp"
|
android:left="6dp"
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
|
|
||||||
<solid android:color="@android:color/white" />
|
|
||||||
<stroke android:width="1dip" android:color="#969696"/>
|
|
||||||
|
|
||||||
<!-- The radius makes the corners rounded -->
|
|
||||||
<corners
|
|
||||||
android:radius="8dp" >
|
|
||||||
</corners>
|
|
||||||
</shape>
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
|
|
||||||
|
|
||||||
<solid android:color="#ebebeb" />
|
|
||||||
|
|
||||||
<padding
|
|
||||||
android:left="4dp"
|
|
||||||
android:right="4dp"
|
|
||||||
android:top="4dp" />
|
|
||||||
|
|
||||||
<corners android:topLeftRadius="16dp" android:topRightRadius="16dp" />
|
|
||||||
</shape>
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:shape="rectangle">
|
|
||||||
<corners
|
|
||||||
android:topLeftRadius="16dp"
|
|
||||||
android:topRightRadius="16dp" />
|
|
||||||
<padding android:top="16dp" />
|
|
||||||
<solid android:color="@color/white" />
|
|
||||||
|
|
||||||
</shape>
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
|
|
||||||
<shape
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:shape="oval">
|
|
||||||
|
|
||||||
<solid
|
|
||||||
android:color="#0074E4"/>
|
|
||||||
|
|
||||||
<size
|
|
||||||
android:width="100dp"
|
|
||||||
android:height="100dp"/>
|
|
||||||
</shape>
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
|
|
||||||
|
|
||||||
<solid android:color="@android:color/white" />
|
|
||||||
|
|
||||||
<padding
|
|
||||||
android:left="1dp"
|
|
||||||
android:right="1dp"
|
|
||||||
android:top="1dp" />
|
|
||||||
|
|
||||||
<corners android:radius="500dp" />
|
|
||||||
</shape>
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
|
|
||||||
|
|
||||||
<solid
|
|
||||||
android:color="@color/white_bg_alpha" />
|
|
||||||
|
|
||||||
<padding
|
|
||||||
android:left="1dp"
|
|
||||||
android:right="1dp"
|
|
||||||
android:top="1dp" />
|
|
||||||
|
|
||||||
<corners android:radius="500dp" />
|
|
||||||
</shape>
|
|
||||||
7
app/src/main/res/drawable/dialog_card_child_bg.xml
Normal file
7
app/src/main/res/drawable/dialog_card_child_bg.xml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||||
|
|
||||||
|
<solid android:color="@color/white" />
|
||||||
|
|
||||||
|
<corners android:radius="20dp" />
|
||||||
|
</shape>
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<solid android:color="@color/black_semi_transparent"/>
|
|
||||||
<padding
|
|
||||||
android:left="16dp"
|
|
||||||
android:top="4dp"
|
|
||||||
android:right="16dp"
|
|
||||||
android:bottom="4dp"/>
|
|
||||||
<corners
|
|
||||||
android:radius="2dp"/>
|
|
||||||
</shape>
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
|
|
||||||
<solid android:color="@color/colorAccent"/>
|
|
||||||
<corners
|
|
||||||
android:bottomLeftRadius="50dp"
|
|
||||||
android:bottomRightRadius="0dp"
|
|
||||||
android:topLeftRadius="50dp"
|
|
||||||
android:topRightRadius="50dp"/>
|
|
||||||
</shape>
|
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<vector android:height="24dp" android:tint="#FFFFFF"
|
||||||
|
android:viewportHeight="24" android:viewportWidth="24"
|
||||||
|
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<path android:fillColor="@android:color/white" android:pathData="M7.41,8.59L12,13.17l4.59,-4.58L18,10l-6,6 -6,-6 1.41,-1.41z"/>
|
||||||
|
</vector>
|
||||||
@@ -1,5 +1,10 @@
|
|||||||
<vector android:height="76dp" android:tint="#FFFFFF"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
android:width="24dp"
|
||||||
android:width="76dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
android:height="24dp"
|
||||||
<path android:fillColor="#FF000000" android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM13,17h-2v-2h2v2zM13,13h-2L11,7h2v6z"/>
|
android:tint="#FFFFFF"
|
||||||
|
android:viewportWidth="24.0"
|
||||||
|
android:viewportHeight="24.0">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FF000000"
|
||||||
|
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM13,17h-2v-2h2v2zM13,13h-2L11,7h2v6z" />
|
||||||
</vector>
|
</vector>
|
||||||
|
|||||||
5
app/src/main/res/drawable/ic_location_24.xml
Normal file
5
app/src/main/res/drawable/ic_location_24.xml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<vector android:height="24dp" android:tint="#FFFFFF"
|
||||||
|
android:viewportHeight="24" android:viewportWidth="24"
|
||||||
|
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<path android:fillColor="@android:color/white" android:pathData="M12,2C8.13,2 5,5.13 5,9c0,5.25 7,13 7,13s7,-7.75 7,-13c0,-3.87 -3.13,-7 -7,-7zM12,11.5c-1.38,0 -2.5,-1.12 -2.5,-2.5s1.12,-2.5 2.5,-2.5 2.5,1.12 2.5,2.5 -1.12,2.5 -2.5,2.5z"/>
|
||||||
|
</vector>
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user