Gestione Documenti interni di carelli
This commit is contained in:
@@ -9,6 +9,12 @@ import it.integry.integrywmsnative.gest.accettazione.MainAccettazioneComponent;
|
||||
import it.integry.integrywmsnative.gest.accettazione.MainAccettazioneModule;
|
||||
import it.integry.integrywmsnative.gest.accettazione_picking.AccettazionePickingComponent;
|
||||
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.DocInterniModule;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dialog.DialogSelectMgrpDtipPairComponent;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dialog.DialogSelectMgrpDtipPairModule;
|
||||
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.contenuto_bancale.ContenutoBancaleComponent;
|
||||
import it.integry.integrywmsnative.gest.contenuto_bancale.ContenutoBancaleModule;
|
||||
import it.integry.integrywmsnative.gest.lista_bancali.ListaBancaliComponent;
|
||||
@@ -97,7 +103,10 @@ import it.integry.integrywmsnative.view.dialogs.scan_or_create_lu.DialogScanOrCr
|
||||
ProdOrdineProduzioneElencoModule.class,
|
||||
ProdRecuperoMaterialeModule.class,
|
||||
ProdVersamentoMaterialeModule.class,
|
||||
DialogChooseArtsFromListaArtsModule.class
|
||||
DialogChooseArtsFromListaArtsModule.class,
|
||||
DocInterniModule.class,
|
||||
DialogSelectMgrpDtipPairModule.class,
|
||||
DocInterniEditFormModule.class
|
||||
})
|
||||
public interface MainApplicationComponent {
|
||||
|
||||
@@ -132,7 +141,9 @@ public interface MainApplicationComponent {
|
||||
ProdRecuperoMaterialeComponent.Factory prodRecuperoMaterialeComponent();
|
||||
ProdVersamentoMaterialeComponent.Factory prodVersamentoMaterialeComponent();
|
||||
DialogChooseArtsFromListaArtsComponent.Factory dialogChooseArtsFromListaArtsComponent();
|
||||
|
||||
DocInterniComponent.Factory docInterniComponent();
|
||||
DialogSelectMgrpDtipPairComponent.Factory dialogSelectMgrpDtipPairComponent();
|
||||
DocInterniEditFormComponent.Factory docInterniEditFormComponent();
|
||||
|
||||
void inject(MainApplication mainApplication);
|
||||
void inject(AppContext mainApplication);
|
||||
|
||||
@@ -25,6 +25,7 @@ import it.integry.integrywmsnative.core.rest.consumers.OrdiniRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.PrinterRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.rest.DocInterniRESTConsumer;
|
||||
import it.integry.integrywmsnative.gest.prod_fabbisogno_linee_prod.rest.ProdFabbisognoLineeProdRESTConsumer;
|
||||
|
||||
@Module
|
||||
@@ -158,5 +159,11 @@ public class MainApplicationModule {
|
||||
return new ProdFabbisognoLineeProdRESTConsumer(systemRESTConsumer);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
DocInterniRESTConsumer provideDocInterniRESTConsumer() {
|
||||
return new DocInterniRESTConsumer();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package it.integry.integrywmsnative.core.class_router.configs;
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
import it.integry.integrywmsnative.gest.accettazione.MainAccettazioneFragment;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.DocInterniFragment;
|
||||
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.OrdiniUscitaElencoFragment;
|
||||
import it.integry.integrywmsnative.gest.picking_libero.PickingLiberoFragment;
|
||||
import it.integry.integrywmsnative.gest.prod_accettazione_ord_produzione.ProdOrdineProduzioneElencoFragment;
|
||||
@@ -159,6 +160,13 @@ public class MenuConfiguration extends BaseMenuConfiguration {
|
||||
.setTitleIcon(it.integry.integrywmsnative.R.drawable.ic_dashboard_purchase_orders_pv)
|
||||
.setDrawerIcon(it.integry.integrywmsnative.R.drawable.ic_dashboard_purchase_orders_pv)
|
||||
.setFragmentFactory(PVOrdiniAcquistoGrigliaFragment::newInstance))
|
||||
.addItem(new MenuItem()
|
||||
.setCodMenu("MG058")
|
||||
.setID(it.integry.integrywmsnative.R.id.nav_pv_doc_interni)
|
||||
.setTitleText(it.integry.integrywmsnative.R.string.doc_interni)
|
||||
.setTitleIcon(R.drawable.ic_dashboard_contab_doc_interni)
|
||||
.setDrawerIcon(it.integry.integrywmsnative.R.drawable.ic_dashboard_contab_doc_interni)
|
||||
.setFragmentFactory(DocInterniFragment::newInstance))
|
||||
|
||||
// .addItem(new MenuItem()
|
||||
// .setID(it.integry.integrywmsnative.R.id.nav_pv_ordini_acquisto_trasmessi)
|
||||
|
||||
@@ -8,13 +8,17 @@ import it.integry.integrywmsnative.core.data_store.db.converter.DateConverter;
|
||||
import it.integry.integrywmsnative.core.data_store.db.dao.ArticoloGrigliaDao;
|
||||
import it.integry.integrywmsnative.core.data_store.db.dao.ArticoloOrdineDao;
|
||||
import it.integry.integrywmsnative.core.data_store.db.dao.GrigliaDao;
|
||||
import it.integry.integrywmsnative.core.data_store.db.dao.MtbColrDao;
|
||||
import it.integry.integrywmsnative.core.data_store.db.dao.MtbColtDao;
|
||||
import it.integry.integrywmsnative.core.data_store.db.dao.OrdineDao;
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.ArticoloGriglia;
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.ArticoloOrdine;
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.Griglia;
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.Ordine;
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColr;
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColt;
|
||||
|
||||
@Database(entities = {ArticoloGriglia.class, Griglia.class, Ordine.class, ArticoloOrdine.class}, version = 1, exportSchema = false)
|
||||
@Database(entities = {ArticoloGriglia.class, Griglia.class, Ordine.class, ArticoloOrdine.class, SqlMtbColt.class, SqlMtbColr.class}, version = 4, exportSchema = false)
|
||||
@TypeConverters({
|
||||
DateConverter.class
|
||||
})
|
||||
@@ -30,26 +34,9 @@ public abstract class AppDatabase extends RoomDatabase {
|
||||
|
||||
public abstract ArticoloOrdineDao articoloOrdineDao();
|
||||
|
||||
// public static AppDatabase getDatabase(final Context context) {
|
||||
// if (INSTANCE == null) {
|
||||
// synchronized (AppDatabase.class) {
|
||||
// if (INSTANCE == null) {
|
||||
// INSTANCE = Room.databaseBuilder(context.getApplicationContext(),
|
||||
// AppDatabase.class, "integry_wms")
|
||||
// .fallbackToDestructiveMigration()
|
||||
// .build();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return INSTANCE;
|
||||
// }
|
||||
public abstract MtbColtDao mtbColtDao();
|
||||
|
||||
// public AppDatabase(Application application) {
|
||||
// mRoomInstance = Room.databaseBuilder(application,
|
||||
// AppDatabase.class, "integry_wms")
|
||||
// .fallbackToDestructiveMigration()
|
||||
// .build();
|
||||
// }
|
||||
public abstract MtbColrDao mtbColrDao();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -11,15 +11,21 @@ import dagger.Provides;
|
||||
import it.integry.integrywmsnative.core.data_store.db.dao.ArticoloGrigliaDao;
|
||||
import it.integry.integrywmsnative.core.data_store.db.dao.ArticoloOrdineDao;
|
||||
import it.integry.integrywmsnative.core.data_store.db.dao.GrigliaDao;
|
||||
import it.integry.integrywmsnative.core.data_store.db.dao.MtbColrDao;
|
||||
import it.integry.integrywmsnative.core.data_store.db.dao.MtbColtDao;
|
||||
import it.integry.integrywmsnative.core.data_store.db.dao.OrdineDao;
|
||||
import it.integry.integrywmsnative.core.data_store.db.repository.ArticoliOrdineRepository;
|
||||
import it.integry.integrywmsnative.core.data_store.db.repository.ArticoloGrigliaRepository;
|
||||
import it.integry.integrywmsnative.core.data_store.db.repository.GrigliaRepository;
|
||||
import it.integry.integrywmsnative.core.data_store.db.repository.MtbColrRepository;
|
||||
import it.integry.integrywmsnative.core.data_store.db.repository.MtbColtRepository;
|
||||
import it.integry.integrywmsnative.core.data_store.db.repository.OrdineRepository;
|
||||
import it.integry.integrywmsnative.core.data_store.db.repository.implementations.ArticoliGrigliaDataSource;
|
||||
import it.integry.integrywmsnative.core.data_store.db.repository.implementations.ArticoliOrdineDataSource;
|
||||
import it.integry.integrywmsnative.core.data_store.db.repository.implementations.GrigliaDataSource;
|
||||
import it.integry.integrywmsnative.core.data_store.db.repository.implementations.OrdineDataSource;
|
||||
import it.integry.integrywmsnative.core.data_store.db.repository.implementations.SqlMtbColrDataSource;
|
||||
import it.integry.integrywmsnative.core.data_store.db.repository.implementations.SqlMtbColtDataSource;
|
||||
|
||||
@Module
|
||||
public class RoomModule {
|
||||
@@ -66,6 +72,18 @@ public class RoomModule {
|
||||
return appDatabase.articoloOrdineDao();
|
||||
}
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
MtbColtDao providesMtbColtDao(AppDatabase appDatabase) {
|
||||
return appDatabase.mtbColtDao();
|
||||
}
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
MtbColrDao providesMtbColrDao(AppDatabase appDatabase) {
|
||||
return appDatabase.mtbColrDao();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -96,4 +114,16 @@ public class RoomModule {
|
||||
return new OrdineDataSource(ordineDao);
|
||||
}
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
MtbColtRepository providesMtbColtRepository(MtbColtDao mtbColtDao) {
|
||||
return new SqlMtbColtDataSource(mtbColtDao);
|
||||
}
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
MtbColrRepository providesMtbColrRepository(MtbColrDao mtbColrDao) {
|
||||
return new SqlMtbColrDataSource(mtbColrDao);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package it.integry.integrywmsnative.core.data_store.db.dao;
|
||||
|
||||
import androidx.room.Dao;
|
||||
import androidx.room.Delete;
|
||||
import androidx.room.Insert;
|
||||
import androidx.room.Query;
|
||||
import androidx.room.Update;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColr;
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColt;
|
||||
|
||||
@Dao
|
||||
public interface MtbColrDao {
|
||||
@Query("SELECT * from mtb_colr ")
|
||||
List<SqlMtbColr> getAll();
|
||||
|
||||
@Insert
|
||||
Long insert(SqlMtbColr mtbColr);
|
||||
|
||||
@Update
|
||||
void update(SqlMtbColr mtbColr);
|
||||
|
||||
@Delete
|
||||
void delete(SqlMtbColr mtbColr);
|
||||
|
||||
@Query("SELECT * from mtb_colr where id_collo = :idDocument")
|
||||
List<SqlMtbColr> getDocumentRows(int idDocument);
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package it.integry.integrywmsnative.core.data_store.db.dao;
|
||||
|
||||
import androidx.room.Dao;
|
||||
import androidx.room.Delete;
|
||||
import androidx.room.Insert;
|
||||
import androidx.room.Query;
|
||||
import androidx.room.Update;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.Ordine;
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColt;
|
||||
import it.integry.integrywmsnative.core.data_store.db.view_model.OrdineWithGriglia;
|
||||
import it.integry.integrywmsnative.core.data_store.db.wrappers.DocInternoWrapper;
|
||||
import it.integry.integrywmsnative.core.data_store.db.wrappers.OrdineWrapper;
|
||||
|
||||
@Dao
|
||||
public interface MtbColtDao {
|
||||
@Query("SELECT * from mtb_colt")
|
||||
List<SqlMtbColt> getAll();
|
||||
|
||||
@Insert
|
||||
Long insert(SqlMtbColt mtbColt);
|
||||
|
||||
@Update
|
||||
void update(SqlMtbColt mtbColt);
|
||||
|
||||
@Delete
|
||||
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")
|
||||
List<DocInternoWrapper> getLocalDocumentsByCodDtipAndCodMgrp(String codDtip, String codMgrp);
|
||||
|
||||
@Query("SELECT ifnull(MAX(num_collo),0) +1 as num_collo from mtb_colt")
|
||||
Integer getNextNumCollo();
|
||||
}
|
||||
@@ -0,0 +1,438 @@
|
||||
package it.integry.integrywmsnative.core.data_store.db.entity;
|
||||
|
||||
import androidx.room.ColumnInfo;
|
||||
import androidx.room.Entity;
|
||||
import androidx.room.ForeignKey;
|
||||
import androidx.room.Index;
|
||||
import androidx.room.PrimaryKey;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@Entity(
|
||||
tableName = "mtb_colr",
|
||||
indices = {
|
||||
@Index(value = {"data_collo", "ser_collo", "num_collo", "gestione","riga"}, unique = true),
|
||||
@Index(value = {"id_collo"})
|
||||
},
|
||||
foreignKeys = {
|
||||
@ForeignKey(
|
||||
entity = SqlMtbColt.class,
|
||||
parentColumns = "id",
|
||||
childColumns = "id_collo",
|
||||
onDelete = ForeignKey.CASCADE
|
||||
)
|
||||
}
|
||||
)
|
||||
|
||||
public class SqlMtbColr {
|
||||
|
||||
@PrimaryKey(autoGenerate = true)
|
||||
@ColumnInfo(name = "id")
|
||||
private int id;
|
||||
|
||||
@ColumnInfo(name = "id_collo")
|
||||
private int idCollo;
|
||||
|
||||
|
||||
@ColumnInfo(name = "data_collo")
|
||||
private Date dataCollo;
|
||||
|
||||
@ColumnInfo(name = "gestione")
|
||||
private String gestione;
|
||||
|
||||
@ColumnInfo(name = "ser_collo")
|
||||
private String serCollo;
|
||||
|
||||
@ColumnInfo(name = "descrizione")
|
||||
private String descrizione;
|
||||
|
||||
@ColumnInfo(name = "num_collo")
|
||||
private Integer numCollo;
|
||||
|
||||
|
||||
@ColumnInfo(name = "riga")
|
||||
private Integer riga;
|
||||
|
||||
@ColumnInfo(name = "riga_ord")
|
||||
private Integer rigaOrd;
|
||||
|
||||
@ColumnInfo(name = "cod_mart")
|
||||
private String codMart;
|
||||
|
||||
@ColumnInfo(name = "cod_barre")
|
||||
private String codBarre;
|
||||
|
||||
@ColumnInfo(name = "cod_col")
|
||||
private String codCol;
|
||||
|
||||
@ColumnInfo(name = "cod_tagl")
|
||||
private String codTagl;
|
||||
|
||||
@ColumnInfo(name = "partita_mag")
|
||||
private String partitaMag;
|
||||
|
||||
@ColumnInfo(name = "gestione_rif")
|
||||
private String gestioneRif;
|
||||
|
||||
@ColumnInfo(name = "ser_collo_rif")
|
||||
private String serColloRif;
|
||||
|
||||
@ColumnInfo(name = "note")
|
||||
private String note;
|
||||
|
||||
@ColumnInfo(name = "data_ord")
|
||||
private Date dataOrd;
|
||||
|
||||
@ColumnInfo(name = "data_collo_rif")
|
||||
private Date dataColloRif;
|
||||
|
||||
@ColumnInfo(name = "qta_cnf")
|
||||
private Float qtaCnf;
|
||||
|
||||
@ColumnInfo(name = "qta_col")
|
||||
private Float qtaCol;
|
||||
|
||||
@ColumnInfo(name = "num_ord")
|
||||
private Integer numOrd;
|
||||
|
||||
@ColumnInfo(name = "num_etich")
|
||||
private Integer numEtich;
|
||||
|
||||
@ColumnInfo(name = "num_collo_rif")
|
||||
private Integer numColloRif;
|
||||
|
||||
@ColumnInfo(name = "datetime_row")
|
||||
private Date datetimeRow;
|
||||
|
||||
@ColumnInfo(name = "cod_jcom")
|
||||
private String codJcom;
|
||||
|
||||
@ColumnInfo(name = "num_cnf")
|
||||
private Float numCnf;
|
||||
|
||||
@ColumnInfo(name = "causale")
|
||||
private String causale;
|
||||
|
||||
@ColumnInfo(name = "utente")
|
||||
private String utente;
|
||||
|
||||
@ColumnInfo(name = "cod_anag_doc")
|
||||
private String codAnagDoc;
|
||||
|
||||
@ColumnInfo(name = "cod_dtip_doc")
|
||||
private String codDtipDoc;
|
||||
|
||||
@ColumnInfo(name = "data_doc")
|
||||
private Date dataDoc;
|
||||
|
||||
@ColumnInfo(name = "ser_doc")
|
||||
private String serDoc;
|
||||
|
||||
@ColumnInfo(name = "num_doc")
|
||||
private Integer numDoc;
|
||||
|
||||
@ColumnInfo(name = "id_riga_doc")
|
||||
private Integer idRigaDoc;
|
||||
|
||||
@ColumnInfo(name = "unt_mis")
|
||||
private String untMis;
|
||||
@ColumnInfo(name = "data_scad")
|
||||
private Date dataScad;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public int getIdCollo() {
|
||||
return idCollo;
|
||||
}
|
||||
|
||||
public void setIdCollo(int idCollo) {
|
||||
this.idCollo = idCollo;
|
||||
}
|
||||
|
||||
public Date getDataCollo() {
|
||||
return dataCollo;
|
||||
}
|
||||
|
||||
public void setDataCollo(Date dataCollo) {
|
||||
this.dataCollo = dataCollo;
|
||||
}
|
||||
|
||||
public String getGestione() {
|
||||
return gestione;
|
||||
}
|
||||
|
||||
public void setGestione(String gestione) {
|
||||
this.gestione = gestione;
|
||||
}
|
||||
|
||||
public String getSerCollo() {
|
||||
return serCollo;
|
||||
}
|
||||
|
||||
public void setSerCollo(String serCollo) {
|
||||
this.serCollo = serCollo;
|
||||
}
|
||||
|
||||
public Integer getNumCollo() {
|
||||
return numCollo;
|
||||
}
|
||||
|
||||
public void setNumCollo(Integer numCollo) {
|
||||
this.numCollo = numCollo;
|
||||
}
|
||||
|
||||
public Integer getRiga() {
|
||||
return riga;
|
||||
}
|
||||
|
||||
public void setRiga(Integer riga) {
|
||||
this.riga = riga;
|
||||
}
|
||||
|
||||
public Integer getRigaOrd() {
|
||||
return rigaOrd;
|
||||
}
|
||||
|
||||
public void setRigaOrd(Integer rigaOrd) {
|
||||
this.rigaOrd = rigaOrd;
|
||||
}
|
||||
|
||||
public String getCodMart() {
|
||||
return codMart;
|
||||
}
|
||||
|
||||
public void setCodMart(String codMart) {
|
||||
this.codMart = codMart;
|
||||
}
|
||||
|
||||
public String getCodBarre() {
|
||||
return codBarre;
|
||||
}
|
||||
|
||||
public void setCodBarre(String codBarre) {
|
||||
this.codBarre = codBarre;
|
||||
}
|
||||
|
||||
public String getCodCol() {
|
||||
return codCol;
|
||||
}
|
||||
|
||||
public void setCodCol(String codCol) {
|
||||
this.codCol = codCol;
|
||||
}
|
||||
|
||||
public String getCodTagl() {
|
||||
return codTagl;
|
||||
}
|
||||
|
||||
public void setCodTagl(String codTagl) {
|
||||
this.codTagl = codTagl;
|
||||
}
|
||||
|
||||
public String getPartitaMag() {
|
||||
return partitaMag;
|
||||
}
|
||||
|
||||
public void setPartitaMag(String partitaMag) {
|
||||
this.partitaMag = partitaMag;
|
||||
}
|
||||
|
||||
public String getGestioneRif() {
|
||||
return gestioneRif;
|
||||
}
|
||||
|
||||
public void setGestioneRif(String gestioneRif) {
|
||||
this.gestioneRif = gestioneRif;
|
||||
}
|
||||
|
||||
public String getSerColloRif() {
|
||||
return serColloRif;
|
||||
}
|
||||
|
||||
public void setSerColloRif(String serColloRif) {
|
||||
this.serColloRif = serColloRif;
|
||||
}
|
||||
|
||||
public String getNote() {
|
||||
return note;
|
||||
}
|
||||
|
||||
public void setNote(String note) {
|
||||
this.note = note;
|
||||
}
|
||||
|
||||
public Date getDataOrd() {
|
||||
return dataOrd;
|
||||
}
|
||||
|
||||
public void setDataOrd(Date dataOrd) {
|
||||
this.dataOrd = dataOrd;
|
||||
}
|
||||
|
||||
public Date getDataColloRif() {
|
||||
return dataColloRif;
|
||||
}
|
||||
|
||||
public void setDataColloRif(Date dataColloRif) {
|
||||
this.dataColloRif = dataColloRif;
|
||||
}
|
||||
|
||||
public Float getQtaCnf() {
|
||||
return qtaCnf;
|
||||
}
|
||||
|
||||
public void setQtaCnf(Float qtaCnf) {
|
||||
this.qtaCnf = qtaCnf;
|
||||
}
|
||||
|
||||
public Float getQtaCol() {
|
||||
return qtaCol;
|
||||
}
|
||||
|
||||
public void setQtaCol(Float qtaCol) {
|
||||
this.qtaCol = qtaCol;
|
||||
}
|
||||
|
||||
public Integer getNumOrd() {
|
||||
return numOrd;
|
||||
}
|
||||
|
||||
public void setNumOrd(Integer numOrd) {
|
||||
this.numOrd = numOrd;
|
||||
}
|
||||
|
||||
public Integer getNumEtich() {
|
||||
return numEtich;
|
||||
}
|
||||
|
||||
public void setNumEtich(Integer numEtich) {
|
||||
this.numEtich = numEtich;
|
||||
}
|
||||
|
||||
public Integer getNumColloRif() {
|
||||
return numColloRif;
|
||||
}
|
||||
|
||||
public void setNumColloRif(Integer numColloRif) {
|
||||
this.numColloRif = numColloRif;
|
||||
}
|
||||
|
||||
public Date getDatetimeRow() {
|
||||
return datetimeRow;
|
||||
}
|
||||
|
||||
public void setDatetimeRow(Date datetimeRow) {
|
||||
this.datetimeRow = datetimeRow;
|
||||
}
|
||||
|
||||
public String getCodJcom() {
|
||||
return codJcom;
|
||||
}
|
||||
|
||||
public void setCodJcom(String codJcom) {
|
||||
this.codJcom = codJcom;
|
||||
}
|
||||
|
||||
public Float getNumCnf() {
|
||||
return numCnf;
|
||||
}
|
||||
|
||||
public void setNumCnf(Float numCnf) {
|
||||
this.numCnf = numCnf;
|
||||
}
|
||||
|
||||
public String getCausale() {
|
||||
return causale;
|
||||
}
|
||||
|
||||
public void setCausale(String causale) {
|
||||
this.causale = causale;
|
||||
}
|
||||
|
||||
public String getUtente() {
|
||||
return utente;
|
||||
}
|
||||
|
||||
public void setUtente(String utente) {
|
||||
this.utente = utente;
|
||||
}
|
||||
|
||||
public String getCodAnagDoc() {
|
||||
return codAnagDoc;
|
||||
}
|
||||
|
||||
public void setCodAnagDoc(String codAnagDoc) {
|
||||
this.codAnagDoc = codAnagDoc;
|
||||
}
|
||||
|
||||
public String getCodDtipDoc() {
|
||||
return codDtipDoc;
|
||||
}
|
||||
|
||||
public void setCodDtipDoc(String codDtipDoc) {
|
||||
this.codDtipDoc = codDtipDoc;
|
||||
}
|
||||
|
||||
public Date getDataDoc() {
|
||||
return dataDoc;
|
||||
}
|
||||
|
||||
public void setDataDoc(Date dataDoc) {
|
||||
this.dataDoc = dataDoc;
|
||||
}
|
||||
|
||||
public String getSerDoc() {
|
||||
return serDoc;
|
||||
}
|
||||
|
||||
public void setSerDoc(String serDoc) {
|
||||
this.serDoc = serDoc;
|
||||
}
|
||||
|
||||
public Integer getNumDoc() {
|
||||
return numDoc;
|
||||
}
|
||||
|
||||
public void setNumDoc(Integer numDoc) {
|
||||
this.numDoc = numDoc;
|
||||
}
|
||||
|
||||
public Integer getIdRigaDoc() {
|
||||
return idRigaDoc;
|
||||
}
|
||||
|
||||
public void setIdRigaDoc(Integer idRigaDoc) {
|
||||
this.idRigaDoc = idRigaDoc;
|
||||
}
|
||||
|
||||
public String getUntMis() {
|
||||
return untMis;
|
||||
}
|
||||
|
||||
public void setUntMis(String untMis) {
|
||||
this.untMis = untMis;
|
||||
}
|
||||
|
||||
public String getDescrizione() {
|
||||
return descrizione;
|
||||
}
|
||||
|
||||
public void setDescrizione(String descrizione) {
|
||||
this.descrizione = descrizione;
|
||||
}
|
||||
|
||||
public Date getDataScad() {
|
||||
return dataScad;
|
||||
}
|
||||
|
||||
public void setDataScad(Date dataScad) {
|
||||
this.dataScad = dataScad;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,341 @@
|
||||
package it.integry.integrywmsnative.core.data_store.db.entity;
|
||||
|
||||
import androidx.room.ColumnInfo;
|
||||
import androidx.room.Entity;
|
||||
import androidx.room.Ignore;
|
||||
import androidx.room.Index;
|
||||
import androidx.room.PrimaryKey;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Entity(
|
||||
tableName = "mtb_colt",
|
||||
indices = {
|
||||
@Index(value = {"data_collo", "ser_collo", "num_collo", "gestione"}, unique = true)
|
||||
}
|
||||
)
|
||||
|
||||
public class SqlMtbColt {
|
||||
|
||||
@PrimaryKey(autoGenerate = true)
|
||||
@ColumnInfo(name = "id")
|
||||
private int id;
|
||||
|
||||
@ColumnInfo(name = "username")
|
||||
private String username;
|
||||
|
||||
@ColumnInfo
|
||||
private String gestione;
|
||||
|
||||
@ColumnInfo(name = "data_collo")
|
||||
private Date dataCollo;
|
||||
|
||||
@ColumnInfo(name = "ser_collo")
|
||||
private String serCollo;
|
||||
|
||||
@ColumnInfo(name = "num_collo")
|
||||
private Integer numCollo;
|
||||
|
||||
@ColumnInfo(name = "rif_ord")
|
||||
private String rifOrd;
|
||||
|
||||
@ColumnInfo(name = "cod_anag")
|
||||
private String codAnag;
|
||||
|
||||
@ColumnInfo(name = "cod_vdes")
|
||||
private String codVdes;
|
||||
|
||||
@ColumnInfo(name = "cod_mdep")
|
||||
private String codMdep;
|
||||
|
||||
@ColumnInfo(name = "cod_vlis")
|
||||
private String codVlis;
|
||||
|
||||
@ColumnInfo(name = "cod_dtip")
|
||||
private String codDtip;
|
||||
|
||||
@ColumnInfo(name = "cod_tcol")
|
||||
private String codTcol;
|
||||
|
||||
@ColumnInfo(name = "ser_doc")
|
||||
private String serDoc;
|
||||
|
||||
@ColumnInfo(name = "annotazioni")
|
||||
private String annotazioni;
|
||||
|
||||
@ColumnInfo(name = "posizione")
|
||||
private String posizione;
|
||||
|
||||
@ColumnInfo(name = "cod_dtip_provv")
|
||||
private String codDtipProvv;
|
||||
|
||||
@ColumnInfo(name = "ser_doc_provv")
|
||||
private String serDocProvv;
|
||||
|
||||
@ColumnInfo(name = "cod_jfas")
|
||||
private String codJfas;
|
||||
|
||||
@ColumnInfo(name = "data_ord")
|
||||
private Date dataOrd;
|
||||
|
||||
@ColumnInfo(name = "data_doc")
|
||||
private Date dataDoc;
|
||||
|
||||
@ColumnInfo(name = "data_doc_provv")
|
||||
private Date dataDocProvv;
|
||||
|
||||
@ColumnInfo(name = "cod_mgrp")
|
||||
private String codMgrp;
|
||||
|
||||
@ColumnInfo(name = "data_vers")
|
||||
private Date dataVers;
|
||||
|
||||
@ColumnInfo(name = "segno")
|
||||
private Integer segno;
|
||||
|
||||
@ColumnInfo(name = "num_ord")
|
||||
private Integer numOrd;
|
||||
|
||||
@ColumnInfo(name = "num_doc")
|
||||
private Integer numDoc;
|
||||
|
||||
@ColumnInfo(name = "num_doc_provv")
|
||||
private Integer numDocProvv;
|
||||
|
||||
@Ignore
|
||||
private List<SqlMtbColr> sqlMtbColrs = new ArrayList<>();
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getGestione() {
|
||||
return gestione;
|
||||
}
|
||||
|
||||
public void setGestione(String gestione) {
|
||||
this.gestione = gestione;
|
||||
}
|
||||
|
||||
public Date getDataCollo() {
|
||||
return dataCollo;
|
||||
}
|
||||
|
||||
public void setDataCollo(Date dataCollo) {
|
||||
this.dataCollo = dataCollo;
|
||||
}
|
||||
|
||||
public String getSerCollo() {
|
||||
return serCollo;
|
||||
}
|
||||
|
||||
public void setSerCollo(String serCollo) {
|
||||
this.serCollo = serCollo;
|
||||
}
|
||||
|
||||
public Integer getNumCollo() {
|
||||
return numCollo;
|
||||
}
|
||||
|
||||
public void setNumCollo(Integer numCollo) {
|
||||
this.numCollo = numCollo;
|
||||
}
|
||||
|
||||
public String getRifOrd() {
|
||||
return rifOrd;
|
||||
}
|
||||
|
||||
public void setRifOrd(String rifOrd) {
|
||||
this.rifOrd = rifOrd;
|
||||
}
|
||||
|
||||
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 getCodMdep() {
|
||||
return codMdep;
|
||||
}
|
||||
|
||||
public void setCodMdep(String codMdep) {
|
||||
this.codMdep = codMdep;
|
||||
}
|
||||
|
||||
public String getCodVlis() {
|
||||
return codVlis;
|
||||
}
|
||||
|
||||
public void setCodVlis(String codVlis) {
|
||||
this.codVlis = codVlis;
|
||||
}
|
||||
|
||||
public String getCodDtip() {
|
||||
return codDtip;
|
||||
}
|
||||
|
||||
public void setCodDtip(String codDtip) {
|
||||
this.codDtip = codDtip;
|
||||
}
|
||||
|
||||
public String getCodTcol() {
|
||||
return codTcol;
|
||||
}
|
||||
|
||||
public void setCodTcol(String codTcol) {
|
||||
this.codTcol = codTcol;
|
||||
}
|
||||
|
||||
public String getSerDoc() {
|
||||
return serDoc;
|
||||
}
|
||||
|
||||
public void setSerDoc(String serDoc) {
|
||||
this.serDoc = serDoc;
|
||||
}
|
||||
|
||||
public String getAnnotazioni() {
|
||||
return annotazioni;
|
||||
}
|
||||
|
||||
public void setAnnotazioni(String annotazioni) {
|
||||
this.annotazioni = annotazioni;
|
||||
}
|
||||
|
||||
public String getPosizione() {
|
||||
return posizione;
|
||||
}
|
||||
|
||||
public void setPosizione(String posizione) {
|
||||
this.posizione = posizione;
|
||||
}
|
||||
|
||||
public String getCodDtipProvv() {
|
||||
return codDtipProvv;
|
||||
}
|
||||
|
||||
public void setCodDtipProvv(String codDtipProvv) {
|
||||
this.codDtipProvv = codDtipProvv;
|
||||
}
|
||||
|
||||
public String getSerDocProvv() {
|
||||
return serDocProvv;
|
||||
}
|
||||
|
||||
public void setSerDocProvv(String serDocProvv) {
|
||||
this.serDocProvv = serDocProvv;
|
||||
}
|
||||
|
||||
public String getCodJfas() {
|
||||
return codJfas;
|
||||
}
|
||||
|
||||
public void setCodJfas(String codJfas) {
|
||||
this.codJfas = codJfas;
|
||||
}
|
||||
|
||||
public Date getDataOrd() {
|
||||
return dataOrd;
|
||||
}
|
||||
|
||||
public void setDataOrd(Date dataOrd) {
|
||||
this.dataOrd = dataOrd;
|
||||
}
|
||||
|
||||
public Date getDataDoc() {
|
||||
return dataDoc;
|
||||
}
|
||||
|
||||
public void setDataDoc(Date dataDoc) {
|
||||
this.dataDoc = dataDoc;
|
||||
}
|
||||
|
||||
public Date getDataDocProvv() {
|
||||
return dataDocProvv;
|
||||
}
|
||||
|
||||
public void setDataDocProvv(Date dataDocProvv) {
|
||||
this.dataDocProvv = dataDocProvv;
|
||||
}
|
||||
|
||||
public Date getDataVers() {
|
||||
return dataVers;
|
||||
}
|
||||
|
||||
public void setDataVers(Date dataVers) {
|
||||
this.dataVers = dataVers;
|
||||
}
|
||||
|
||||
public Integer getSegno() {
|
||||
return segno;
|
||||
}
|
||||
|
||||
public void setSegno(Integer segno) {
|
||||
this.segno = segno;
|
||||
}
|
||||
|
||||
public Integer getNumOrd() {
|
||||
return numOrd;
|
||||
}
|
||||
|
||||
public void setNumOrd(Integer numOrd) {
|
||||
this.numOrd = numOrd;
|
||||
}
|
||||
|
||||
public Integer getNumDoc() {
|
||||
return numDoc;
|
||||
}
|
||||
|
||||
public void setNumDoc(Integer numDoc) {
|
||||
this.numDoc = numDoc;
|
||||
}
|
||||
|
||||
public Integer getNumDocProvv() {
|
||||
return numDocProvv;
|
||||
}
|
||||
|
||||
public void setNumDocProvv(Integer numDocProvv) {
|
||||
this.numDocProvv = numDocProvv;
|
||||
}
|
||||
|
||||
public List<SqlMtbColr> getSqlMtbColrs() {
|
||||
return sqlMtbColrs;
|
||||
}
|
||||
|
||||
public void setSqlMtbColrs(List<SqlMtbColr> sqlMtbColrs) {
|
||||
this.sqlMtbColrs = sqlMtbColrs;
|
||||
}
|
||||
|
||||
public String getCodMgrp() {
|
||||
return codMgrp;
|
||||
}
|
||||
|
||||
public void setCodMgrp(String codMgrp) {
|
||||
this.codMgrp = codMgrp;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package it.integry.integrywmsnative.core.data_store.db.repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
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.expansion.RunnableArgs;
|
||||
|
||||
public interface MtbColrRepository {
|
||||
|
||||
void selectAll(RunnableArgs<List<SqlMtbColr>> onSuccess, RunnableArgs<Exception> onError);
|
||||
|
||||
void insert(SqlMtbColr mtbColr, RunnableArgs<Integer> onSuccess, RunnableArgs<Exception> onError);
|
||||
|
||||
void update(SqlMtbColr mtbColr, RunnableArgs<SqlMtbColr> onSuccess, RunnableArgs<Exception> onError);
|
||||
|
||||
void delete(SqlMtbColr mtbColr, Runnable onSuccess, RunnableArgs<Exception> onError);
|
||||
|
||||
void getDocumentRows(SqlMtbColt sqlMtbColt, RunnableArgs<List<SqlMtbColr>> onSuccess, RunnableArgs<Exception> onError);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package it.integry.integrywmsnative.core.data_store.db.repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.Griglia;
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.Ordine;
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColt;
|
||||
import it.integry.integrywmsnative.core.data_store.db.view_model.OrdineWithGriglia;
|
||||
import it.integry.integrywmsnative.core.data_store.db.wrappers.DocInternoWrapper;
|
||||
import it.integry.integrywmsnative.core.data_store.db.wrappers.OrdineWrapper;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
|
||||
public interface MtbColtRepository {
|
||||
|
||||
void selectAll(RunnableArgs<List<SqlMtbColt>> onSuccess, RunnableArgs<Exception> onError);
|
||||
|
||||
void insert(SqlMtbColt mtbColt, RunnableArgs<Integer> onSuccess, RunnableArgs<Exception> onError);
|
||||
|
||||
void update(SqlMtbColt mtbColt, RunnableArgs<SqlMtbColt> 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 getNextNumCollo(RunnableArgs<Integer> onSuccess, RunnableArgs<Exception> onError);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package it.integry.integrywmsnative.core.data_store.db.repository.implementations;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import it.integry.integrywmsnative.core.data_store.db.dao.MtbColrDao;
|
||||
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.repository.MtbColrRepository;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
|
||||
public class SqlMtbColrDataSource extends Repository implements MtbColrRepository {
|
||||
|
||||
private MtbColrDao mMtbColrDao;
|
||||
|
||||
@Inject
|
||||
public SqlMtbColrDataSource(MtbColrDao mtbColrDao) {
|
||||
this.mMtbColrDao = mtbColrDao;
|
||||
}
|
||||
|
||||
public void selectAll(RunnableArgs<List<SqlMtbColr>> onSuccess, RunnableArgs<Exception> onError) {
|
||||
Runnable query = () -> {
|
||||
try {
|
||||
onSuccess.run(mMtbColrDao.getAll());
|
||||
} catch (Exception e) {
|
||||
onError.run(e);
|
||||
}
|
||||
};
|
||||
execute(query);
|
||||
}
|
||||
|
||||
public void insert(SqlMtbColr mtbColr, RunnableArgs<Integer> onSuccess, RunnableArgs<Exception> onError) {
|
||||
execute(() -> {
|
||||
try {
|
||||
Long id = mMtbColrDao.insert(mtbColr);
|
||||
onSuccess.run(id.intValue());
|
||||
} catch (Exception e) {
|
||||
onError.run(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public void update(SqlMtbColr mtbColr, RunnableArgs<SqlMtbColr> onSuccess, RunnableArgs<Exception> onError) {
|
||||
execute(() -> {
|
||||
try {
|
||||
mMtbColrDao.update(mtbColr);
|
||||
onSuccess.run(mtbColr);
|
||||
} catch (Exception e) {
|
||||
onError.run(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void delete(SqlMtbColr mtbColr, Runnable onSuccess, RunnableArgs<Exception> onError) {
|
||||
execute(() -> {
|
||||
try {
|
||||
mMtbColrDao.delete(mtbColr);
|
||||
onSuccess.run();
|
||||
} catch (Exception e) {
|
||||
onError.run(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void getDocumentRows(SqlMtbColt document, RunnableArgs<List<SqlMtbColr>> onSuccess, RunnableArgs<Exception> onError) {
|
||||
Runnable query = () -> {
|
||||
try {
|
||||
onSuccess.run(mMtbColrDao.getDocumentRows(document.getId()));
|
||||
} catch (Exception e) {
|
||||
onError.run(e);
|
||||
}
|
||||
};
|
||||
execute(query);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package it.integry.integrywmsnative.core.data_store.db.repository.implementations;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import it.integry.integrywmsnative.core.data_store.db.dao.MtbColtDao;
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColt;
|
||||
import it.integry.integrywmsnative.core.data_store.db.repository.MtbColtRepository;
|
||||
import it.integry.integrywmsnative.core.data_store.db.wrappers.DocInternoWrapper;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
|
||||
public class SqlMtbColtDataSource extends Repository implements MtbColtRepository {
|
||||
|
||||
private MtbColtDao mMtbColtDao;
|
||||
|
||||
@Inject
|
||||
public SqlMtbColtDataSource(MtbColtDao mtbColtDao) {
|
||||
this.mMtbColtDao = mtbColtDao;
|
||||
}
|
||||
|
||||
public void selectAll(RunnableArgs<List<SqlMtbColt>> onSuccess, RunnableArgs<Exception> onError) {
|
||||
Runnable query = () -> {
|
||||
try {
|
||||
onSuccess.run(mMtbColtDao.getAll());
|
||||
} catch (Exception e) {
|
||||
onError.run(e);
|
||||
}
|
||||
};
|
||||
execute(query);
|
||||
}
|
||||
|
||||
public void insert(SqlMtbColt mtbColt, RunnableArgs<Integer> onSuccess, RunnableArgs<Exception> onError) {
|
||||
execute(() -> {
|
||||
try {
|
||||
Long id = mMtbColtDao.insert(mtbColt);
|
||||
onSuccess.run(id.intValue());
|
||||
} catch (Exception e) {
|
||||
onError.run(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public void update(SqlMtbColt mtbColt, RunnableArgs<SqlMtbColt> onSuccess, RunnableArgs<Exception> onError) {
|
||||
execute(() -> {
|
||||
try {
|
||||
mMtbColtDao.update(mtbColt);
|
||||
onSuccess.run(mtbColt);
|
||||
} catch (Exception e) {
|
||||
onError.run(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void delete(SqlMtbColt mtbColt, Runnable onSuccess, RunnableArgs<Exception> onError) {
|
||||
execute(() -> {
|
||||
try {
|
||||
mMtbColtDao.delete(mtbColt);
|
||||
onSuccess.run();
|
||||
} catch (Exception e) {
|
||||
onError.run(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getLocalDocumentsByCodDtipAndCodMgrp(String codDtip, String codMgrp, RunnableArgs<List<DocInternoWrapper>> onSuccess, RunnableArgs<Exception> onError) {
|
||||
Runnable query = () -> {
|
||||
try {
|
||||
onSuccess.run(mMtbColtDao.getLocalDocumentsByCodDtipAndCodMgrp(codDtip,codMgrp));
|
||||
} catch (Exception e) {
|
||||
onError.run(e);
|
||||
}
|
||||
};
|
||||
execute(query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getNextNumCollo(RunnableArgs<Integer> onSuccess, RunnableArgs<Exception> onError) {
|
||||
Runnable query = () -> {
|
||||
try {
|
||||
onSuccess.run(mMtbColtDao.getNextNumCollo());
|
||||
} catch (Exception e) {
|
||||
onError.run(e);
|
||||
}
|
||||
};
|
||||
execute(query);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package it.integry.integrywmsnative.core.data_store.db.wrappers;
|
||||
|
||||
import androidx.room.ColumnInfo;
|
||||
import androidx.room.Embedded;
|
||||
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColt;
|
||||
|
||||
public class DocInternoWrapper {
|
||||
@Embedded
|
||||
private SqlMtbColt document;
|
||||
|
||||
@ColumnInfo(name = "countArticoli")
|
||||
private int countArticoli = 0;
|
||||
|
||||
public SqlMtbColt getDocument() {
|
||||
return document;
|
||||
}
|
||||
|
||||
public void setDocument(SqlMtbColt document) {
|
||||
this.document = document;
|
||||
}
|
||||
|
||||
public int getCountArticoli() {
|
||||
return countArticoli;
|
||||
}
|
||||
|
||||
public void setCountArticoli(int countArticoli) {
|
||||
this.countArticoli = countArticoli;
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,20 @@ import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
|
||||
public class BindableString extends BaseObservable {
|
||||
String value;
|
||||
private boolean isHtml = false;
|
||||
|
||||
public BindableString(){};
|
||||
public BindableString(boolean isHtml){
|
||||
this.isHtml = isHtml;
|
||||
};
|
||||
public BindableString(String startingValue ,boolean isHtml){
|
||||
this.isHtml = isHtml;
|
||||
this.set(startingValue);
|
||||
};
|
||||
|
||||
public boolean isHtml() {
|
||||
return isHtml;
|
||||
}
|
||||
|
||||
public String get() {
|
||||
return value != null ? value : "";
|
||||
|
||||
@@ -2,6 +2,7 @@ package it.integry.integrywmsnative.core.di;
|
||||
|
||||
import android.app.DatePickerDialog;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.text.Html;
|
||||
import android.text.SpannableString;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
@@ -126,8 +127,9 @@ public class Converters {
|
||||
view.addTextChangedListener(watcher);
|
||||
}
|
||||
String newValue = bindableString.get();
|
||||
boolean isHtml = bindableString.isHtml();
|
||||
if (!view.getText().toString().equals(newValue)) {
|
||||
view.setText(newValue);
|
||||
view.setText(isHtml ? Html.fromHtml(newValue) : newValue);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -367,8 +369,9 @@ public class Converters {
|
||||
view.addTextChangedListener(watcher);
|
||||
}
|
||||
String newValue = bindableString.get();
|
||||
boolean isHtml = bindableString.isHtml();
|
||||
if (!view.getText().toString().equals(newValue)) {
|
||||
view.setText(newValue);
|
||||
view.setText(isHtml ? Html.fromHtml(newValue) : newValue);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ package it.integry.integrywmsnative.core.interfaces;
|
||||
|
||||
import androidx.appcompat.widget.SearchView;
|
||||
|
||||
public interface ISearcableFragment extends SearchView.OnQueryTextListener, IDestroyableFragment {
|
||||
public interface ISearchableFragment extends SearchView.OnQueryTextListener, IDestroyableFragment {
|
||||
|
||||
void onSearchEnabled();
|
||||
|
||||
@@ -57,10 +57,10 @@ public class PrinterRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
public void printCollo(Type printerType, MtbColt testataColloToPrint, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
if (BuildConfig.DEBUG) {
|
||||
onComplete.run();
|
||||
return;
|
||||
}
|
||||
// if (BuildConfig.DEBUG) {
|
||||
// onComplete.run();
|
||||
// return;
|
||||
// }
|
||||
|
||||
PrinterRESTConsumerService printerService = RESTBuilder.getService(PrinterRESTConsumerService.class);
|
||||
Call<ServiceRESTResponse<Object>> callable = null;
|
||||
@@ -88,10 +88,10 @@ public class PrinterRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
|
||||
public void printReport(String printerName, String reportName, HashMap<String, Object> params, int quantity, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
if (BuildConfig.DEBUG) {
|
||||
onComplete.run();
|
||||
return;
|
||||
}
|
||||
// if (BuildConfig.DEBUG) {
|
||||
// onComplete.run();
|
||||
// return;
|
||||
// }
|
||||
|
||||
JasperDTO jasperDTO = new JasperDTO();
|
||||
jasperDTO.setReportName(reportName);
|
||||
|
||||
@@ -28,7 +28,7 @@ import it.integry.integrywmsnative.core.data_cache.DataCache;
|
||||
import it.integry.integrywmsnative.core.di.BindableBoolean;
|
||||
import it.integry.integrywmsnative.core.expansion.BaseFragment;
|
||||
import it.integry.integrywmsnative.core.interfaces.IScrollableFragment;
|
||||
import it.integry.integrywmsnative.core.interfaces.ISearcableFragment;
|
||||
import it.integry.integrywmsnative.core.interfaces.ISearchableFragment;
|
||||
import it.integry.integrywmsnative.core.interfaces.ITitledFragment;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityBigDecimal;
|
||||
@@ -43,7 +43,7 @@ import it.integry.integrywmsnative.gest.accettazione_picking.AccettazionePicking
|
||||
import it.integry.integrywmsnative.ui.ElevatedToolbar;
|
||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||
|
||||
public class MainAccettazioneFragment extends BaseFragment implements ISearcableFragment, ITitledFragment, IScrollableFragment, MainAccettazioneViewModel.Listener {
|
||||
public class MainAccettazioneFragment extends BaseFragment implements ISearchableFragment, ITitledFragment, IScrollableFragment, MainAccettazioneViewModel.Listener {
|
||||
|
||||
public BindableBoolean fabVisible = new BindableBoolean(false);
|
||||
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package it.integry.integrywmsnative.gest.contab_doc_interni;
|
||||
|
||||
import dagger.Subcomponent;
|
||||
|
||||
@Subcomponent()
|
||||
public interface DocInterniComponent {
|
||||
@Subcomponent.Factory
|
||||
interface Factory {
|
||||
DocInterniComponent create();
|
||||
}
|
||||
|
||||
void inject(DocInterniFragment docInterniFragment);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
package it.integry.integrywmsnative.gest.contab_doc_interni;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.appcompat.widget.AppCompatTextView;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import androidx.databinding.ObservableArrayList;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import it.integry.integrywmsnative.MainApplication;
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColt;
|
||||
import it.integry.integrywmsnative.core.data_store.db.wrappers.DocInternoWrapper;
|
||||
import it.integry.integrywmsnative.core.expansion.BaseFragment;
|
||||
import it.integry.integrywmsnative.core.interfaces.IScrollableFragment;
|
||||
import it.integry.integrywmsnative.core.interfaces.ITitledFragment;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
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.DialogSelectMgrpDtipPairViewModel;
|
||||
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.edit_form.DocInterniEditFormActivity;
|
||||
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.pv_ordine_acquisto_edit.PVOrdineAcquistoEditActivity;
|
||||
import it.integry.integrywmsnative.gest.spedizione.ui.SpedizioneListAdapter;
|
||||
import it.integry.integrywmsnative.ui.ElevatedToolbar;
|
||||
|
||||
public class DocInterniFragment extends BaseFragment implements ITitledFragment, IScrollableFragment, DocInterniViewModel.Listener {
|
||||
|
||||
@Inject
|
||||
DocInterniViewModel mViewModel;
|
||||
|
||||
private final ObservableArrayList<DocInterniListModel> mDocInterniMutableData = new ObservableArrayList<>();
|
||||
private ElevatedToolbar mToolbar;
|
||||
private FragmentDocInterniBinding mBinding;
|
||||
private TipiDocAndGruppiArtDTO mTipiDocAndGruppiArtDTO;
|
||||
private final List<Runnable> mOnPreDestroyList = new ArrayList<>();
|
||||
private boolean dialogInitialized = false;
|
||||
|
||||
|
||||
public DocInterniFragment() {
|
||||
// Required empty public constructor
|
||||
}
|
||||
|
||||
public static DocInterniFragment newInstance() {
|
||||
DocInterniFragment fragment = new DocInterniFragment();
|
||||
Bundle args = new Bundle();
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreateActionBar(AppCompatTextView titleText, Context context) {
|
||||
titleText.setText(context.getText(R.string.doc_interni).toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
|
||||
mBinding = DataBindingUtil.inflate(inflater, R.layout.fragment_doc_interni, container, false);
|
||||
MainApplication.appComponent
|
||||
.docInterniComponent()
|
||||
.create()
|
||||
.inject(this);
|
||||
|
||||
mViewModel.setListeners(this);
|
||||
mBinding.setLifecycleOwner(this);
|
||||
mBinding.setView(this);
|
||||
mBinding.setViewModel(mViewModel);
|
||||
this.initRecyclerView();
|
||||
|
||||
return mBinding.getRoot();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
if (!this.mViewModel.hasDocDetails()){
|
||||
mViewModel.init();
|
||||
}else{
|
||||
this.mViewModel.fetchDocuments();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
for (Runnable onPreDestroy : mOnPreDestroyList) {
|
||||
onPreDestroy.run();
|
||||
}
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGruppiArtAndTipiDocFetch(TipiDocAndGruppiArtDTO tipiDocAndGruppiArtDTO) {
|
||||
this.mTipiDocAndGruppiArtDTO = tipiDocAndGruppiArtDTO;
|
||||
this.dialogInitialized = true;
|
||||
this.selectCodMgrpAndCodDtip();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDocDetailsChanged(DialogSelectMgrpDtipPairViewModel selection) {
|
||||
|
||||
this.mViewModel.setSelectedDocDetails(selection);
|
||||
this.mBinding.mainFab.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setScrollToolbar(ElevatedToolbar toolbar) {
|
||||
mToolbar = toolbar;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addOnPreDestroy(Runnable onPreDestroy) {
|
||||
this.mOnPreDestroyList.add(onPreDestroy);
|
||||
}
|
||||
|
||||
public void selectCodMgrpAndCodDtip() {
|
||||
if (this.dialogInitialized){
|
||||
DialogSelectMgrpDtipPairView.newInstance(
|
||||
mTipiDocAndGruppiArtDTO,
|
||||
this.mViewModel.dtbTipi.getValue(),
|
||||
this.mViewModel.mtbGrup.getValue(),
|
||||
this::onDocDetailsChanged
|
||||
).show(requireActivity().getSupportFragmentManager(), "tag");
|
||||
}
|
||||
}
|
||||
|
||||
private void initRecyclerView() {
|
||||
this.mViewModel.getDocsList().observe(getViewLifecycleOwner(), this::refreshList);
|
||||
DocInterniListAdapter docInterniListAdapter = new DocInterniListAdapter(this.requireActivity(), this.mDocInterniMutableData);
|
||||
docInterniListAdapter.setEmptyView(this.mBinding.docInterniEmptyView);
|
||||
this.mBinding.docInterniMainList.setAdapter(docInterniListAdapter);
|
||||
this.mBinding.docInterniMainList.setLayoutManager(new LinearLayoutManager(this.requireActivity()));
|
||||
|
||||
docInterniListAdapter.setOnItemClicked(this.mViewModel::editDocument);
|
||||
if (mToolbar != null)
|
||||
mToolbar.setRecyclerView(this.mBinding.docInterniMainList);
|
||||
}
|
||||
|
||||
private void refreshList(List<DocInternoWrapper> filteredList) {
|
||||
this.mDocInterniMutableData.clear();
|
||||
this.mDocInterniMutableData.addAll(convertDataModelToListModel(mViewModel.getDocsList().getValue()));
|
||||
}
|
||||
|
||||
private List<DocInterniListModel> convertDataModelToListModel(List<DocInternoWrapper> dataList) {
|
||||
|
||||
return Stream.of(dataList)
|
||||
.map(x -> {
|
||||
DocInterniListModel listModel = new DocInterniListModel();
|
||||
listModel.setDocument(x.getDocument());
|
||||
listModel.setProductsCount(x.getCountArticoli());
|
||||
return listModel;
|
||||
})
|
||||
.toList();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDocumentEditRequest(SqlMtbColt document, GrigliaAcquistiDTO arts) {
|
||||
requireActivity().startActivity(DocInterniEditFormActivity.newInstance(requireActivity(),document,arts));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package it.integry.integrywmsnative.gest.contab_doc_interni;
|
||||
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
import it.integry.integrywmsnative.core.data_store.db.repository.MtbColtRepository;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.rest.DocInterniRESTConsumer;
|
||||
|
||||
@Module(subcomponents = DocInterniComponent.class)
|
||||
public class DocInterniModule {
|
||||
|
||||
@Provides
|
||||
DocInterniViewModel docInterniViewModel(DocInterniRESTConsumer docInterniRESTConsumer, MtbColtRepository mtbColtRepository) {
|
||||
return new DocInterniViewModel(docInterniRESTConsumer,mtbColtRepository);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
package it.integry.integrywmsnative.gest.contab_doc_interni;
|
||||
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColt;
|
||||
import it.integry.integrywmsnative.core.data_store.db.repository.MtbColtRepository;
|
||||
import it.integry.integrywmsnative.core.data_store.db.wrappers.DocInternoWrapper;
|
||||
import it.integry.integrywmsnative.core.di.BindableInteger;
|
||||
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dialog.DialogSelectMgrpDtipPairViewModel;
|
||||
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.TipiDocAndGruppiArtDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.TipiDocDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.rest.DocInterniRESTConsumer;
|
||||
|
||||
public class DocInterniViewModel {
|
||||
|
||||
private Listener mListener;
|
||||
private final DocInterniRESTConsumer mDocInterniRESTConsumer;
|
||||
private boolean productsFetched = true;
|
||||
private boolean docsFetched = true;
|
||||
private int nextNumCollo = 0;
|
||||
private GrigliaAcquistiDTO productsList;
|
||||
|
||||
|
||||
public final MutableLiveData<TipiDocDTO> dtbTipi = new MutableLiveData<>();
|
||||
public final MutableLiveData<GruppiArticoloDTO> mtbGrup = new MutableLiveData<>();
|
||||
private final MutableLiveData<List<DocInternoWrapper>> mDocsList = new MutableLiveData<>();
|
||||
public final BindableInteger artsSize = new BindableInteger(0);
|
||||
@Inject
|
||||
MtbColtRepository documentRepository;
|
||||
|
||||
@Inject
|
||||
public DocInterniViewModel(DocInterniRESTConsumer docInterniRESTConsumer, MtbColtRepository documentRepository) {
|
||||
mDocInterniRESTConsumer = docInterniRESTConsumer;
|
||||
this.documentRepository = documentRepository;
|
||||
this.mDocsList.setValue(new ArrayList<>());
|
||||
}
|
||||
|
||||
|
||||
public void init() {
|
||||
this.sendOnLoadingStarted();
|
||||
// new Thread(() -> {
|
||||
mDocInterniRESTConsumer.getDocTypesAndGroupArts(returnDto -> {
|
||||
this.sendOnLoadingEnded();
|
||||
this.mListener.onGruppiArtAndTipiDocFetch(returnDto);
|
||||
}, this::sendError);
|
||||
// }).start();
|
||||
}
|
||||
|
||||
private void sendOnLoadingStarted() {
|
||||
if (this.mListener != null) mListener.onLoadingStarted();
|
||||
}
|
||||
|
||||
private void sendOnLoadingEnded() {
|
||||
if (this.mListener != null) mListener.onLoadingEnded();
|
||||
}
|
||||
|
||||
private void sendError(Exception ex) {
|
||||
if (this.mListener != null) mListener.onError(ex);
|
||||
}
|
||||
|
||||
public DocInterniViewModel setListeners(Listener listener) {
|
||||
this.mListener = listener;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MutableLiveData<List<DocInternoWrapper>> getDocsList() {
|
||||
return mDocsList;
|
||||
}
|
||||
|
||||
public void setSelectedDocDetails(DialogSelectMgrpDtipPairViewModel 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.dtbTipi.setValue(selection.getSelectedTipoDoc());
|
||||
this.mtbGrup.setValue(selection.getSelectedGruppoArt());
|
||||
this.fetchProducts();
|
||||
this.fetchDocuments();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void fetchProducts() {
|
||||
this.productsFetched = false;
|
||||
mDocInterniRESTConsumer.fetchProducts(this.dtbTipi.getValue().getCodDtip(), this.mtbGrup.getValue().getCodMgrp(), returnDto -> {
|
||||
this.productsFetched = true;
|
||||
this.productsList = returnDto;
|
||||
this.artsSize.set(returnDto.getGrigliaAcquistiChild().size());
|
||||
if (this.docsFetched) {
|
||||
this.sendOnLoadingEnded();
|
||||
}
|
||||
}, this::sendError);
|
||||
}
|
||||
|
||||
public void fetchDocuments() {
|
||||
this.docsFetched = false;
|
||||
this.sendOnLoadingStarted();
|
||||
documentRepository.getLocalDocumentsByCodDtipAndCodMgrp(this.getCodDtip(), this.getCodMgrp(), list -> {
|
||||
documentRepository.getNextNumCollo(nextNumCollo->{
|
||||
this.mDocsList.postValue(list);
|
||||
this.setNextNumCollo(nextNumCollo);
|
||||
this.docsFetched = true;
|
||||
if (this.productsFetched) {
|
||||
this.sendOnLoadingEnded();
|
||||
}
|
||||
},this::sendError);
|
||||
},this::sendError);
|
||||
}
|
||||
|
||||
private void setNextNumCollo(Integer nextNumCollo) {
|
||||
this.nextNumCollo = nextNumCollo;
|
||||
}
|
||||
|
||||
private String getCodDtip() {
|
||||
if (this.dtbTipi.getValue() == null) {
|
||||
return null;
|
||||
}
|
||||
return this.dtbTipi.getValue().getCodDtip();
|
||||
}
|
||||
|
||||
private String getCodMgrp() {
|
||||
if (this.mtbGrup.getValue() == null) {
|
||||
return null;
|
||||
}
|
||||
return this.mtbGrup.getValue().getCodMgrp();
|
||||
}
|
||||
|
||||
public void editDocument(SqlMtbColt document) {
|
||||
this.mListener.onDocumentEditRequest(document, productsList);
|
||||
}
|
||||
|
||||
public void newDocument() {
|
||||
SqlMtbColt document = new SqlMtbColt();
|
||||
if (this.dtbTipi.getValue() == null) {
|
||||
this.sendError(new Exception("Nessun tipo documento selezionato!"));
|
||||
return;
|
||||
}
|
||||
document.setCodDtipProvv(this.getCodDtip());
|
||||
document.setCodMgrp(this.getCodMgrp());
|
||||
document.setDataCollo(new Date());
|
||||
document.setCodMdep(SettingsManager.i().getUserSession().getDepo().getCodMdep());
|
||||
document.setAnnotazioni("");
|
||||
document.setSegno(-1);
|
||||
document.setSerCollo("/");
|
||||
document.setNumCollo(this.nextNumCollo);
|
||||
document.setGestione("L");
|
||||
documentRepository.insert(document,id->{
|
||||
document.setId(id);
|
||||
this.editDocument(document);
|
||||
}, this::sendError);
|
||||
}
|
||||
|
||||
public boolean hasDocDetails() {
|
||||
return this.dtbTipi.getValue() != null && this.mtbGrup.getValue() != null;
|
||||
}
|
||||
|
||||
public interface Listener extends ILoadingListener {
|
||||
|
||||
void onError(Exception ex);
|
||||
|
||||
void onGruppiArtAndTipiDocFetch(TipiDocAndGruppiArtDTO tipiDocAndGruppiArtDTO);
|
||||
|
||||
void onDocDetailsChanged(DialogSelectMgrpDtipPairViewModel selection);
|
||||
|
||||
void onDocumentEditRequest(SqlMtbColt document, GrigliaAcquistiDTO arts);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
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);
|
||||
|
||||
}
|
||||
@@ -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 = DialogSelectMgrpDtipPairComponent.class)
|
||||
public class DialogSelectMgrpDtipPairModule {
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
DialogSelectMgrpDtipPairViewModel dialogSelectMgrpDtipPairViewModel() {
|
||||
return new DialogSelectMgrpDtipPairViewModel();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,161 @@
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
package it.integry.integrywmsnative.gest.contab_doc_interni.dto;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
public class ArtDTO {
|
||||
|
||||
private Integer rigaOrd;
|
||||
|
||||
private String codMart;
|
||||
|
||||
private String barcode;
|
||||
|
||||
private String descrizione;
|
||||
|
||||
private Date dataIns;
|
||||
|
||||
private String untMis;
|
||||
|
||||
private BigDecimal qta;
|
||||
|
||||
private BigDecimal qtaCnf;
|
||||
|
||||
private BigDecimal colli;
|
||||
|
||||
private String partitaMag;
|
||||
|
||||
private Date dataScad;
|
||||
|
||||
public Integer getRigaOrd() {
|
||||
return rigaOrd;
|
||||
}
|
||||
|
||||
public void setRigaOrd(Integer rigaOrd) {
|
||||
this.rigaOrd = rigaOrd;
|
||||
}
|
||||
|
||||
public String getCodMart() {
|
||||
return codMart;
|
||||
}
|
||||
|
||||
public void setCodMart(String codMart) {
|
||||
this.codMart = codMart;
|
||||
}
|
||||
|
||||
public String getBarcode() {
|
||||
return barcode;
|
||||
}
|
||||
|
||||
public void setBarcode(String barcode) {
|
||||
this.barcode = barcode;
|
||||
}
|
||||
|
||||
public String getDescrizione() {
|
||||
return descrizione;
|
||||
}
|
||||
|
||||
public void setDescrizione(String descrizione) {
|
||||
this.descrizione = descrizione;
|
||||
}
|
||||
|
||||
public Date getDataIns() {
|
||||
return dataIns;
|
||||
}
|
||||
|
||||
public void setDataIns(Date dataIns) {
|
||||
this.dataIns = dataIns;
|
||||
}
|
||||
|
||||
public String getUntMis() {
|
||||
return untMis;
|
||||
}
|
||||
|
||||
public void setUntMis(String untMis) {
|
||||
this.untMis = untMis;
|
||||
}
|
||||
|
||||
public BigDecimal getQta() {
|
||||
return qta;
|
||||
}
|
||||
|
||||
public void setQta(BigDecimal qta) {
|
||||
this.qta = qta;
|
||||
}
|
||||
|
||||
public BigDecimal getQtaCnf() {
|
||||
return qtaCnf;
|
||||
}
|
||||
|
||||
public void setQtaCnf(BigDecimal qtaCnf) {
|
||||
this.qtaCnf = qtaCnf;
|
||||
}
|
||||
|
||||
public BigDecimal getColli() {
|
||||
return colli;
|
||||
}
|
||||
|
||||
public void setColli(BigDecimal colli) {
|
||||
this.colli = colli;
|
||||
}
|
||||
|
||||
public String getPartitaMag() {
|
||||
return partitaMag;
|
||||
}
|
||||
|
||||
public void setPartitaMag(String partitaMag) {
|
||||
this.partitaMag = partitaMag;
|
||||
}
|
||||
|
||||
public Date getDataScad() {
|
||||
return dataScad;
|
||||
}
|
||||
|
||||
public void setDataScad(Date dataScad) {
|
||||
this.dataScad = dataScad;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
package it.integry.integrywmsnative.gest.contab_doc_interni.dto;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public class ColloDTO {
|
||||
|
||||
private String codMdep;
|
||||
private String createdDate;
|
||||
private String annotazioni;
|
||||
private String gestione;
|
||||
private String segno;
|
||||
private String idDisp;
|
||||
private String codDtip;
|
||||
private List<ArtDTO> artRows = new ArrayList<>();
|
||||
private RifOrd rifOrd;
|
||||
|
||||
public String getCodMdep() {
|
||||
return codMdep;
|
||||
}
|
||||
|
||||
public void setCodMdep(String codMdep) {
|
||||
this.codMdep = codMdep;
|
||||
}
|
||||
|
||||
public String getCreatedDate() {
|
||||
return createdDate;
|
||||
}
|
||||
|
||||
public void setCreatedDate(String createdDate) {
|
||||
this.createdDate = createdDate;
|
||||
}
|
||||
|
||||
public String getAnnotazioni() {
|
||||
return annotazioni;
|
||||
}
|
||||
|
||||
public void setAnnotazioni(String annotazioni) {
|
||||
this.annotazioni = annotazioni;
|
||||
}
|
||||
|
||||
public String getGestione() {
|
||||
return gestione;
|
||||
}
|
||||
|
||||
public void setGestione(String gestione) {
|
||||
this.gestione = gestione;
|
||||
}
|
||||
|
||||
public String getSegno() {
|
||||
return segno;
|
||||
}
|
||||
|
||||
public void setSegno(String segno) {
|
||||
this.segno = segno;
|
||||
}
|
||||
|
||||
public String getIdDisp() {
|
||||
return idDisp;
|
||||
}
|
||||
|
||||
public void setIdDisp(String idDisp) {
|
||||
this.idDisp = idDisp;
|
||||
}
|
||||
|
||||
public String getCodDtip() {
|
||||
return codDtip;
|
||||
}
|
||||
|
||||
public void setCodDtip(String codDtip) {
|
||||
this.codDtip = codDtip;
|
||||
}
|
||||
|
||||
public List<ArtDTO> getArtRows() {
|
||||
return artRows;
|
||||
}
|
||||
|
||||
public void setArtRows(List<ArtDTO> artRows) {
|
||||
this.artRows = artRows;
|
||||
}
|
||||
|
||||
public void addArtRow(ArtDTO artRow){
|
||||
this.artRows.add(artRow);
|
||||
}
|
||||
|
||||
public RifOrd getRifOrd() {
|
||||
return rifOrd;
|
||||
}
|
||||
|
||||
public void setRifOrd(RifOrd rifOrd) {
|
||||
this.rifOrd = rifOrd;
|
||||
}
|
||||
|
||||
public static class RifOrd {
|
||||
|
||||
private Date dataOrd;
|
||||
|
||||
private Integer numOrd;
|
||||
|
||||
private String chiaveOrd;
|
||||
|
||||
public Date getDataOrd() {
|
||||
return dataOrd;
|
||||
}
|
||||
|
||||
public void setDataOrd(Date dataOrd) {
|
||||
this.dataOrd = dataOrd;
|
||||
}
|
||||
|
||||
public Integer getNumOrd() {
|
||||
return numOrd;
|
||||
}
|
||||
|
||||
public void setNumOrd(Integer numOrd) {
|
||||
this.numOrd = numOrd;
|
||||
}
|
||||
|
||||
public String getChiaveOrd() {
|
||||
return chiaveOrd;
|
||||
}
|
||||
|
||||
public void setChiaveOrd(String chiaveOrd) {
|
||||
this.chiaveOrd = chiaveOrd;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
package it.integry.integrywmsnative.gest.contab_doc_interni.dto;
|
||||
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public class DocFromPickingDTO {
|
||||
String codAnag, codVdes, tipoLista, noteDoc;
|
||||
Date dataDoc;
|
||||
Integer numDoc;
|
||||
List<DatiCollo> colli;
|
||||
List<Pedane> pedane;
|
||||
|
||||
public String getCodAnag() {
|
||||
return codAnag;
|
||||
}
|
||||
|
||||
public DocFromPickingDTO setCodAnag(String codAnag) {
|
||||
this.codAnag = codAnag;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodVdes() {
|
||||
return codVdes;
|
||||
}
|
||||
|
||||
public DocFromPickingDTO setCodVdes(String codVdes) {
|
||||
this.codVdes = codVdes;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getTipoLista() {
|
||||
return tipoLista;
|
||||
}
|
||||
|
||||
public DocFromPickingDTO setTipoLista(String tipoLista) {
|
||||
this.tipoLista = tipoLista;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getNoteDoc() {
|
||||
return noteDoc;
|
||||
}
|
||||
|
||||
public DocFromPickingDTO setNoteDoc(String noteDoc) {
|
||||
this.noteDoc = noteDoc;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataDoc() {
|
||||
return dataDoc;
|
||||
}
|
||||
|
||||
public DocFromPickingDTO setDataDoc(Date dataDoc) {
|
||||
this.dataDoc = dataDoc;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getNumDoc() {
|
||||
return numDoc;
|
||||
}
|
||||
|
||||
public DocFromPickingDTO setNumDoc(Integer numDoc) {
|
||||
this.numDoc = numDoc;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<DatiCollo> getColli() {
|
||||
return colli;
|
||||
}
|
||||
|
||||
public DocFromPickingDTO setColli(List<DatiCollo> colli) {
|
||||
this.colli = colli;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<Pedane> getPedane() {
|
||||
return pedane;
|
||||
}
|
||||
|
||||
public void setPedane(List<Pedane> pedane) {
|
||||
this.pedane = pedane;
|
||||
}
|
||||
|
||||
public static class Pedane {
|
||||
String codTcol;
|
||||
BigDecimal qta;
|
||||
|
||||
public String getCodTcol() {
|
||||
return codTcol;
|
||||
}
|
||||
|
||||
public void setCodTcol(String codTcol) {
|
||||
this.codTcol = codTcol;
|
||||
}
|
||||
|
||||
public BigDecimal getQta() {
|
||||
return qta;
|
||||
}
|
||||
|
||||
public void setQta(BigDecimal qta) {
|
||||
this.qta = qta;
|
||||
}
|
||||
}
|
||||
|
||||
public static class DatiCollo {
|
||||
String gestione, serCollo;
|
||||
Date dataCollo;
|
||||
Integer numCollo;
|
||||
|
||||
public String getGestione() {
|
||||
return gestione;
|
||||
}
|
||||
|
||||
public DatiCollo setGestione(String gestione) {
|
||||
this.gestione = gestione;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getSerCollo() {
|
||||
return serCollo;
|
||||
}
|
||||
|
||||
public DatiCollo setSerCollo(String serCollo) {
|
||||
this.serCollo = serCollo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataCollo() {
|
||||
return dataCollo;
|
||||
}
|
||||
|
||||
public DatiCollo setDataCollo(Date dataCollo) {
|
||||
this.dataCollo = dataCollo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getNumCollo() {
|
||||
return numCollo;
|
||||
}
|
||||
|
||||
public DatiCollo setNumCollo(Integer numCollo) {
|
||||
this.numCollo = numCollo;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
package it.integry.integrywmsnative.gest.contab_doc_interni.dto;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
public class GrigliaAcquistiChildDTO {
|
||||
|
||||
public String codMart;
|
||||
public String descrizione;
|
||||
public String untMis;
|
||||
public BigDecimal qtaCnf;
|
||||
public String barcode;
|
||||
public BigDecimal merceDaRic;
|
||||
public BigDecimal mediaSett;
|
||||
public String flagQtaMultipla;
|
||||
public BigDecimal qtaMinOrdinabile;
|
||||
|
||||
public String getCodMart() {
|
||||
return codMart;
|
||||
}
|
||||
|
||||
public GrigliaAcquistiChildDTO setCodMart(String codMart) {
|
||||
this.codMart = codMart;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDescrizione() {
|
||||
return descrizione;
|
||||
}
|
||||
|
||||
public GrigliaAcquistiChildDTO setDescrizione(String descrizione) {
|
||||
this.descrizione = descrizione;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getUntMis() {
|
||||
return untMis;
|
||||
}
|
||||
|
||||
public GrigliaAcquistiChildDTO setUntMis(String untMis) {
|
||||
this.untMis = untMis;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getQtaCnf() {
|
||||
return qtaCnf;
|
||||
}
|
||||
|
||||
public GrigliaAcquistiChildDTO setQtaCnf(BigDecimal qtaCnf) {
|
||||
this.qtaCnf = qtaCnf;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getBarcode() {
|
||||
return barcode;
|
||||
}
|
||||
|
||||
public GrigliaAcquistiChildDTO setBarcode(String barcode) {
|
||||
this.barcode = barcode;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getMerceDaRic() {
|
||||
return merceDaRic;
|
||||
}
|
||||
|
||||
public GrigliaAcquistiChildDTO setMerceDaRic(BigDecimal merceDaRic) {
|
||||
this.merceDaRic = merceDaRic;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getMediaSett() {
|
||||
return mediaSett;
|
||||
}
|
||||
|
||||
public GrigliaAcquistiChildDTO setMediaSett(BigDecimal mediaSett) {
|
||||
this.mediaSett = mediaSett;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getFlagQtaMultipla() {
|
||||
return flagQtaMultipla;
|
||||
}
|
||||
|
||||
public GrigliaAcquistiChildDTO setFlagQtaMultipla(String flagQtaMultipla) {
|
||||
this.flagQtaMultipla = flagQtaMultipla;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getQtaMinOrdinabile() {
|
||||
return qtaMinOrdinabile;
|
||||
}
|
||||
|
||||
public GrigliaAcquistiChildDTO setQtaMinOrdinabile(BigDecimal qtaMinOrdinabile) {
|
||||
this.qtaMinOrdinabile = qtaMinOrdinabile;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package it.integry.integrywmsnative.gest.contab_doc_interni.dto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class GrigliaAcquistiDTO {
|
||||
|
||||
private String descrLisa;
|
||||
|
||||
private String descrDepo;
|
||||
|
||||
private List<GrigliaAcquistiChildDTO> grigliaAcquistiChild;
|
||||
|
||||
public String getDescrLisa() {
|
||||
return descrLisa;
|
||||
}
|
||||
|
||||
public void setDescrLisa(String descrLisa) {
|
||||
this.descrLisa = descrLisa;
|
||||
}
|
||||
|
||||
public String getDescrDepo() {
|
||||
return descrDepo;
|
||||
}
|
||||
|
||||
public void setDescrDepo(String descrDepo) {
|
||||
this.descrDepo = descrDepo;
|
||||
}
|
||||
|
||||
public List<GrigliaAcquistiChildDTO> getGrigliaAcquistiChild() {
|
||||
return grigliaAcquistiChild;
|
||||
}
|
||||
|
||||
public void setGrigliaAcquistiChild(List<GrigliaAcquistiChildDTO> grigliaAcquistiChild) {
|
||||
this.grigliaAcquistiChild = grigliaAcquistiChild;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package it.integry.integrywmsnative.gest.contab_doc_interni.dto;
|
||||
|
||||
public class GruppiArticoloDTO {
|
||||
|
||||
private String codMgrp;
|
||||
private String descrizione;
|
||||
|
||||
public String getCodMgrp() {
|
||||
return codMgrp;
|
||||
}
|
||||
|
||||
public void setCodMgrp(String codMgrp) {
|
||||
this.codMgrp = codMgrp;
|
||||
}
|
||||
|
||||
public String getDescrizione() {
|
||||
return descrizione;
|
||||
}
|
||||
|
||||
public void setDescrizione(String descrizione) {
|
||||
this.descrizione = descrizione;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return this.codMgrp+" - "+this.descrizione;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package it.integry.integrywmsnative.gest.contab_doc_interni.dto;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by GiuseppeS on 28/06/2017.
|
||||
*/
|
||||
public class InventarioDTO {
|
||||
|
||||
private List<Object> rowList;
|
||||
|
||||
private Date dataCreate;
|
||||
|
||||
|
||||
public List<Object> getRowList() {
|
||||
return rowList;
|
||||
}
|
||||
|
||||
public void setRowList(List<Object> rowList) {
|
||||
this.rowList = rowList;
|
||||
}
|
||||
|
||||
public Date getDataCreate() {
|
||||
return dataCreate;
|
||||
}
|
||||
|
||||
public void setDataCreate(Date dataCreate) {
|
||||
this.dataCreate = dataCreate;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package it.integry.integrywmsnative.gest.contab_doc_interni.dto;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public class OrdineDTO {
|
||||
|
||||
private String chiaveGriglia;
|
||||
private Date dataCons;
|
||||
|
||||
private List<ArtDTO> artRows;
|
||||
|
||||
public String getChiaveGriglia() {
|
||||
return chiaveGriglia;
|
||||
}
|
||||
|
||||
public void setChiaveGriglia(String chiaveGriglia) {
|
||||
this.chiaveGriglia = chiaveGriglia;
|
||||
}
|
||||
|
||||
public Date getDataCons() {
|
||||
return dataCons;
|
||||
}
|
||||
|
||||
public void setDataCons(Date dataCons) {
|
||||
this.dataCons = dataCons;
|
||||
}
|
||||
|
||||
public List<ArtDTO> getArtRows() {
|
||||
return artRows;
|
||||
}
|
||||
|
||||
public void setArtRows(List<ArtDTO> artRows) {
|
||||
this.artRows = artRows;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package it.integry.integrywmsnative.gest.contab_doc_interni.dto;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public class PropostaOrdineDTO {
|
||||
|
||||
List<ArticoliDTO> articoli;
|
||||
private Date dataOrd;
|
||||
private String compilatoDa;
|
||||
|
||||
public Date getDataOrd() {
|
||||
return dataOrd;
|
||||
}
|
||||
|
||||
public PropostaOrdineDTO setDataOrd(Date dataOrd) {
|
||||
this.dataOrd = dataOrd;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCompilatoDa() {
|
||||
return compilatoDa;
|
||||
}
|
||||
|
||||
public PropostaOrdineDTO setCompilatoDa(String compilatoDa) {
|
||||
this.compilatoDa = compilatoDa;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<ArticoliDTO> getArticoli() {
|
||||
return articoli;
|
||||
}
|
||||
|
||||
public PropostaOrdineDTO setArticoli(List<ArticoliDTO> articoli) {
|
||||
this.articoli = articoli;
|
||||
return this;
|
||||
}
|
||||
|
||||
public static class ArticoliDTO {
|
||||
String codMart, untMis, codArtFor, listino;
|
||||
BigDecimal qtaOrd, qtaCnf;
|
||||
|
||||
public String getCodMart() {
|
||||
return codMart;
|
||||
}
|
||||
|
||||
public ArticoliDTO setCodMart(String codMart) {
|
||||
this.codMart = codMart;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getUntMis() {
|
||||
return untMis;
|
||||
}
|
||||
|
||||
public ArticoliDTO setUntMis(String untMis) {
|
||||
this.untMis = untMis;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodArtFor() {
|
||||
return codArtFor;
|
||||
}
|
||||
|
||||
public ArticoliDTO setCodArtFor(String codArtFor) {
|
||||
this.codArtFor = codArtFor;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getListino() {
|
||||
return listino;
|
||||
}
|
||||
|
||||
public ArticoliDTO setListino(String listino) {
|
||||
this.listino = listino;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getQtaOrd() {
|
||||
return qtaOrd;
|
||||
}
|
||||
|
||||
public ArticoliDTO setQtaOrd(BigDecimal qtaOrd) {
|
||||
this.qtaOrd = qtaOrd;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getQtaCnf() {
|
||||
return qtaCnf;
|
||||
}
|
||||
|
||||
public ArticoliDTO setQtaCnf(BigDecimal qtaCnf) {
|
||||
this.qtaCnf = qtaCnf;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
package it.integry.integrywmsnative.gest.contab_doc_interni.dto;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class SaveDTO {
|
||||
private String gestione;
|
||||
private String codMdep;
|
||||
private String idDisp;
|
||||
private String zona;
|
||||
private String segno;
|
||||
private Date listCreate;
|
||||
private String annotazioni;
|
||||
private String codDtip;
|
||||
private Integer idInventario;
|
||||
|
||||
private OrdineDTO ordineDTO;
|
||||
private ColloDTO colloDTO;
|
||||
private InventarioDTO inventarioDTO;
|
||||
|
||||
public String getGestione() {
|
||||
return gestione;
|
||||
}
|
||||
|
||||
public void setGestione(String gestione) {
|
||||
this.gestione = gestione;
|
||||
}
|
||||
|
||||
public String getCodMdep() {
|
||||
return codMdep;
|
||||
}
|
||||
|
||||
public void setCodMdep(String codMdep) {
|
||||
this.codMdep = codMdep;
|
||||
}
|
||||
|
||||
public String getIdDisp() {
|
||||
return idDisp;
|
||||
}
|
||||
|
||||
public void setIdDisp(String idDisp) {
|
||||
this.idDisp = idDisp;
|
||||
}
|
||||
|
||||
public String getZona() {
|
||||
return zona;
|
||||
}
|
||||
|
||||
public void setZona(String zona) {
|
||||
this.zona = zona;
|
||||
}
|
||||
|
||||
public String getSegno() {
|
||||
return segno;
|
||||
}
|
||||
|
||||
public void setSegno(String segno) {
|
||||
this.segno = segno;
|
||||
}
|
||||
|
||||
public Date getListCreate() {
|
||||
return listCreate;
|
||||
}
|
||||
|
||||
public void setListCreate(Date listCreate) {
|
||||
this.listCreate = listCreate;
|
||||
}
|
||||
|
||||
public String getAnnotazioni() {
|
||||
return annotazioni;
|
||||
}
|
||||
|
||||
public void setAnnotazioni(String annotazioni) {
|
||||
this.annotazioni = annotazioni;
|
||||
}
|
||||
|
||||
public String getCodDtip() {
|
||||
return codDtip;
|
||||
}
|
||||
|
||||
public void setCodDtip(String codDtip) {
|
||||
this.codDtip = codDtip;
|
||||
}
|
||||
|
||||
public Integer getIdInventario() {
|
||||
return idInventario;
|
||||
}
|
||||
|
||||
public void setIdInventario(Integer idInventario) {
|
||||
this.idInventario = idInventario;
|
||||
}
|
||||
|
||||
public OrdineDTO getOrdineDTO() {
|
||||
return ordineDTO;
|
||||
}
|
||||
|
||||
public void setOrdineDTO(OrdineDTO ordineDTO) {
|
||||
this.ordineDTO = ordineDTO;
|
||||
}
|
||||
|
||||
public ColloDTO getColloDTO() {
|
||||
return colloDTO;
|
||||
}
|
||||
|
||||
public void setColloDTO(ColloDTO colloDTO) {
|
||||
this.colloDTO = colloDTO;
|
||||
}
|
||||
|
||||
public InventarioDTO getInventarioDTO() {
|
||||
return inventarioDTO;
|
||||
}
|
||||
|
||||
public void setInventarioDTO(InventarioDTO inventarioDTO) {
|
||||
this.inventarioDTO = inventarioDTO;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package it.integry.integrywmsnative.gest.contab_doc_interni.dto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class TipiDocAndGruppiArtDTO {
|
||||
|
||||
|
||||
private List<TipiDocDTO> tipiDoc;
|
||||
|
||||
|
||||
private List<GruppiArticoloDTO> gruppiArt;
|
||||
|
||||
|
||||
public List<TipiDocDTO> getTipiDoc() {
|
||||
return tipiDoc;
|
||||
}
|
||||
|
||||
public void setTipiDoc(List<TipiDocDTO> tipiDoc) {
|
||||
this.tipiDoc = tipiDoc;
|
||||
}
|
||||
|
||||
public List<GruppiArticoloDTO> getGruppiArt() {
|
||||
return gruppiArt;
|
||||
}
|
||||
|
||||
public void setGruppiArt(List<GruppiArticoloDTO> gruppiArt) {
|
||||
this.gruppiArt = gruppiArt;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package it.integry.integrywmsnative.gest.contab_doc_interni.dto;
|
||||
|
||||
public class TipiDocDTO {
|
||||
|
||||
private String codDtip;
|
||||
private String descrizione;
|
||||
|
||||
public String getCodDtip() {
|
||||
return codDtip;
|
||||
}
|
||||
|
||||
public void setCodDtip(String codDtip) {
|
||||
this.codDtip = codDtip;
|
||||
}
|
||||
|
||||
public String getDescrizione() {
|
||||
return descrizione;
|
||||
}
|
||||
|
||||
public void setDescrizione(String descrizione) {
|
||||
this.descrizione = descrizione;
|
||||
}
|
||||
|
||||
public String getLabel(){
|
||||
return this.codDtip +" - "+this.descrizione;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,295 @@
|
||||
package it.integry.integrywmsnative.gest.contab_doc_interni.edit_form;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.text.Html;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import androidx.databinding.ObservableArrayList;
|
||||
import androidx.recyclerview.widget.DiffUtil;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
import com.ravikoradiya.liveadapter.LiveAdapter;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
||||
import it.integry.integrywmsnative.BR;
|
||||
import it.integry.integrywmsnative.MainApplication;
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.barcode_reader.BarcodeCallbackDTO;
|
||||
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
||||
import it.integry.integrywmsnative.core.data_cache.DataCache;
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.ArticoloOrdine;
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColr;
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColt;
|
||||
import it.integry.integrywmsnative.core.data_store.db.repository.MtbColrRepository;
|
||||
import it.integry.integrywmsnative.core.data_store.db.repository.MtbColtRepository;
|
||||
import it.integry.integrywmsnative.core.di.BindableBoolean;
|
||||
import it.integry.integrywmsnative.core.di.BindableInteger;
|
||||
import it.integry.integrywmsnative.core.di.BindableString;
|
||||
import it.integry.integrywmsnative.core.expansion.BaseActivity;
|
||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
import it.integry.integrywmsnative.core.model.MtbPartitaMag;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||
import it.integry.integrywmsnative.databinding.ActivityContabDocInterniEditBinding;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.GrigliaAcquistiChildDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.GrigliaAcquistiDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.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.view.bottom_sheet__mtb_colr_edit.BottomSheetMtbColrEditView;
|
||||
import it.integry.integrywmsnative.view.dialogs.DialogCommon;
|
||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleInputHelper;
|
||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2DTO;
|
||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2View;
|
||||
|
||||
public class DocInterniEditFormActivity extends BaseActivity implements DocInterniEditFormViewModel.Listener, BottomSheetMtbColrEditView.Listener {
|
||||
|
||||
private static String DATA_KEY_DOCUMENT = "document";
|
||||
private static String DATA_KEY_PRODUCTS_LIST = "productsList";
|
||||
|
||||
@Inject
|
||||
MtbColrRepository documentRowsRepository;
|
||||
@Inject
|
||||
DocInterniEditFormViewModel viewModel;
|
||||
|
||||
|
||||
private int mBarcodeScannerIstanceID;
|
||||
private ActivityContabDocInterniEditBinding binding;
|
||||
public BindableString documentHeader = new BindableString(true);
|
||||
public BindableString codDtip = new BindableString();
|
||||
public BindableString note = new BindableString();
|
||||
public BindableString codMgrp = new BindableString();
|
||||
public BindableInteger prodsCount = new BindableInteger(0);
|
||||
public BindableBoolean isDocumentExportable = new BindableBoolean(false);
|
||||
private final ObservableArrayList<SqlMtbColr> documentRowsObservableList = new ObservableArrayList<>();
|
||||
|
||||
public static Intent newInstance(Context context, SqlMtbColt document, GrigliaAcquistiDTO productList) {
|
||||
Intent myIntent = new Intent(context, DocInterniEditFormActivity.class);
|
||||
|
||||
String doc = DataCache.addItem(document);
|
||||
String productsKey = DataCache.addItem(productList);
|
||||
myIntent.putExtra(DATA_KEY_DOCUMENT, doc);
|
||||
myIntent.putExtra(DATA_KEY_PRODUCTS_LIST, productsKey);
|
||||
return myIntent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
binding = DataBindingUtil.setContentView(this, R.layout.activity_contab_doc_interni_edit);
|
||||
MainApplication.appComponent
|
||||
.docInterniEditFormComponent()
|
||||
.create()
|
||||
.inject(this);
|
||||
SqlMtbColt document = DataCache.retrieveItem(getIntent().getStringExtra(DATA_KEY_DOCUMENT));
|
||||
GrigliaAcquistiDTO griglia = DataCache.retrieveItem(getIntent().getStringExtra(DATA_KEY_PRODUCTS_LIST));
|
||||
List<GrigliaAcquistiChildDTO> productList = griglia.getGrigliaAcquistiChild();
|
||||
this.initViewModel(document, productList);
|
||||
this.initView();
|
||||
this.initBindables();
|
||||
this.initRecyclerView();
|
||||
}
|
||||
|
||||
private void initBindables() {
|
||||
SqlMtbColt document = this.viewModel.getDocument();
|
||||
this.codDtip.set(document.getCodDtipProvv());
|
||||
this.note.set(document.getAnnotazioni());
|
||||
this.codMgrp.set(document.getCodMgrp());
|
||||
this.documentHeader.set(String.format(this.getString(R.string.doc_interni_doc_header), document.getId(), document.getCodDtipProvv()));
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
binding.setViewModel(this.viewModel);
|
||||
binding.setView(this);
|
||||
setSupportActionBar(binding.toolbar);
|
||||
binding.toolbar.setTitle(R.string.edit_doc);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
FabMenuCustomAnimations.changeIconOnFocus(binding.closeActivityFab, R.drawable.ic_check_white_24dp, R.drawable.ic_close_24dp);
|
||||
binding.bottomSheetMtbColrEdit.setListener(this);
|
||||
binding.bottomSheetMtbColrEdit.init(binding.bottomSheetMtbColrEdit, binding.bottomSheetMtbColrEditBackground);
|
||||
}
|
||||
|
||||
private void initViewModel(SqlMtbColt document, List<GrigliaAcquistiChildDTO> productList) {
|
||||
this.viewModel.setListeners(this);
|
||||
this.viewModel.setDocument(document);
|
||||
this.viewModel.setProductsList(productList);
|
||||
}
|
||||
|
||||
private void initRecyclerView() {
|
||||
this.viewModel.docRows.observe(this, this::refreshList);
|
||||
DocumentRowsListAdapter listAdapter = new DocumentRowsListAdapter(this, documentRowsObservableList);
|
||||
listAdapter.setEmptyView(binding.scanArtSpinner);
|
||||
binding.documentRowsList.setAdapter(listAdapter);
|
||||
binding.documentRowsList.setLayoutManager(new LinearLayoutManager(this));
|
||||
listAdapter.setOnItemClicked(row -> {
|
||||
binding.bottomSheetMtbColrEdit.setMtbColr(sqlToEntity(row));
|
||||
binding.bottomSheetMtbColrEdit.expand();
|
||||
});
|
||||
}
|
||||
|
||||
private void refreshList(List<SqlMtbColr> sqlMtbColrs) {
|
||||
this.documentRowsObservableList.clear();
|
||||
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() {
|
||||
this.onBackPressed();
|
||||
}
|
||||
|
||||
public void manualSearch() {
|
||||
BarcodeManager.disable();
|
||||
DialogSimpleInputHelper.makeInputDialog(this, "Aggiungi delle annotazioni al documento", this.note.get(), this.viewModel::onSearch, BarcodeManager::enable).show();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
SqlMtbColt document = this.viewModel.getDocument();
|
||||
if (document == null) {
|
||||
Toast.makeText(this, "Nesusn documento selezionato!", Toast.LENGTH_SHORT).show();
|
||||
closeEdit();
|
||||
return;
|
||||
}
|
||||
|
||||
if (document.getCodDtip() != null) {
|
||||
Toast.makeText(this, "Impossibile modificare un documento esportato", Toast.LENGTH_SHORT).show();
|
||||
closeEdit();
|
||||
return;
|
||||
}
|
||||
|
||||
mBarcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
||||
.setOnScanSuccessfull(this.viewModel::onScanSuccessful)
|
||||
.setOnScanFailed(this::onError));
|
||||
this.viewModel.fetchDocumentRows();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
BarcodeManager.removeCallback(mBarcodeScannerIstanceID);
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onSupportNavigateUp() {
|
||||
onBackPressed();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRowsChanged(List<SqlMtbColr> rows) {
|
||||
this.prodsCount.set(rows.size());
|
||||
this.isDocumentExportable.set(rows.size() > 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEditRowRequest(SqlMtbColr row) {
|
||||
MtbAart mtbAart = new MtbAart();
|
||||
mtbAart.setBarCode(row.getCodBarre());
|
||||
mtbAart.setDiacod(row.getCodBarre());
|
||||
mtbAart.setCodMart(row.getCodMart());
|
||||
mtbAart.setFlagQtaCnfFissa("S");
|
||||
mtbAart.setQtaCnf(BigDecimal.valueOf(row.getQtaCnf()));
|
||||
mtbAart.setDescrizione(row.getDescrizione());
|
||||
mtbAart.setDescrizioneEstesa(row.getDescrizione());
|
||||
mtbAart.setUntMis(row.getUntMis());
|
||||
|
||||
DialogInputQuantityV2DTO dialogInputQuantityV2DTO = new DialogInputQuantityV2DTO()
|
||||
.setMtbAart(mtbAart)
|
||||
.setInitialNumCnf(BigDecimal.valueOf(row.getNumCnf()))
|
||||
.setInitialQtaCnf(BigDecimal.valueOf(row.getQtaCnf()))
|
||||
.setInitialQtaTot(BigDecimal.valueOf(row.getQtaCol()))
|
||||
.setDataScad(row.getDataScad())
|
||||
.setCanOverflowOrderQuantity(false)
|
||||
.setCanLUBeClosed(false)
|
||||
.setCanPartitaMagBeChanged(false);
|
||||
|
||||
DialogInputQuantityV2View
|
||||
.newInstance(dialogInputQuantityV2DTO, (resultDTO, shouldCloseLU) -> {
|
||||
this.onLoadingStarted();
|
||||
this.viewModel.saveRow(row, resultDTO);
|
||||
}, this::onLoadingEnded)
|
||||
.show(getSupportFragmentManager(), "tag");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDocumentHoldRequest() {
|
||||
this.closeEdit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDocExported() {
|
||||
runOnUiThread(() -> {
|
||||
DialogCommon.showDataSaved(this, this::closeEdit);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
BarcodeManager.removeCallback(mBarcodeScannerIstanceID);
|
||||
super.onBackPressed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMtbColrEdit(MtbColr mtbColr) {
|
||||
this.viewModel.editRow(entityToSql(mtbColr));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMtbColrDelete(MtbColr mtbColr) {
|
||||
this.viewModel.deleteRow(entityToSql(mtbColr));
|
||||
}
|
||||
|
||||
|
||||
private MtbColr sqlToEntity(SqlMtbColr sqlMtbColr) {
|
||||
MtbColr entity = new MtbColr();
|
||||
|
||||
entity
|
||||
.setCodMart(sqlMtbColr.getCodMart())
|
||||
.setSerCollo(sqlMtbColr.getSerCollo())
|
||||
.setGestione(sqlMtbColr.getGestione())
|
||||
.setNumCollo(sqlMtbColr.getNumCollo())
|
||||
.setDataCollo(UtilityDate.formatDate(sqlMtbColr.getDataCollo(), UtilityDate.COMMONS_DATE_FORMATS.DMY_TIME_SLASH))
|
||||
.setRiga(sqlMtbColr.getRiga())
|
||||
.setDescrizione(sqlMtbColr.getDescrizione())
|
||||
.setUntMis(sqlMtbColr.getUntMis())
|
||||
.setCodBarre(sqlMtbColr.getCodBarre())
|
||||
.setQtaCnf(BigDecimal.valueOf(sqlMtbColr.getQtaCnf()))
|
||||
.setNumCnf(BigDecimal.valueOf(sqlMtbColr.getNumCnf()))
|
||||
.setMtbPartitaMag(new MtbPartitaMag().setDataScad(sqlMtbColr.getDataScad()))
|
||||
.setQtaCol(BigDecimal.valueOf(sqlMtbColr.getQtaCol()));
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
||||
private SqlMtbColr entityToSql(MtbColr mtbColr) {
|
||||
|
||||
return Stream.of(this.viewModel.getDocumentRows())
|
||||
.filter(row -> row.getRiga().equals(mtbColr.getRiga()))
|
||||
.findFirstOrElse(null);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package it.integry.integrywmsnative.gest.contab_doc_interni.edit_form;
|
||||
|
||||
import dagger.Subcomponent;
|
||||
|
||||
@Subcomponent
|
||||
public interface DocInterniEditFormComponent {
|
||||
|
||||
@Subcomponent.Factory
|
||||
interface Factory {
|
||||
|
||||
DocInterniEditFormComponent create();
|
||||
}
|
||||
|
||||
void inject(DocInterniEditFormActivity docInterniEditFormActivity);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package it.integry.integrywmsnative.gest.contab_doc_interni.edit_form;
|
||||
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
import it.integry.integrywmsnative.core.data_store.db.repository.MtbColrRepository;
|
||||
import it.integry.integrywmsnative.core.data_store.db.repository.MtbColtRepository;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.DocInterniComponent;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.DocInterniViewModel;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.rest.DocInterniRESTConsumer;
|
||||
|
||||
@Module(subcomponents = DocInterniEditFormComponent.class)
|
||||
public class DocInterniEditFormModule {
|
||||
|
||||
|
||||
@Provides
|
||||
DocInterniEditFormViewModel docInterniEditFormViewModel(DocInterniRESTConsumer docInterniRESTConsumer, MtbColrRepository mtbColrRepository, MtbColtRepository mtbColtRepository) {
|
||||
return new DocInterniEditFormViewModel(docInterniRESTConsumer,mtbColrRepository, mtbColtRepository);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,250 @@
|
||||
package it.integry.integrywmsnative.gest.contab_doc_interni.edit_form;
|
||||
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
||||
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.repository.MtbColrRepository;
|
||||
import it.integry.integrywmsnative.core.data_store.db.repository.MtbColtRepository;
|
||||
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.ArtDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.ColloDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.GrigliaAcquistiChildDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.SaveDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.rest.DocInterniRESTConsumer;
|
||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2ResultDTO;
|
||||
|
||||
public class DocInterniEditFormViewModel {
|
||||
|
||||
@Inject
|
||||
MtbColrRepository mtbColrRepository;
|
||||
@Inject
|
||||
MtbColtRepository mtbColtRepository;
|
||||
private final DocInterniRESTConsumer docInterniRESTConsumer;
|
||||
private DocInterniEditFormViewModel.Listener listener;
|
||||
private List<GrigliaAcquistiChildDTO> productsList;
|
||||
|
||||
public MutableLiveData<SqlMtbColt> document = new MutableLiveData<>();
|
||||
public MutableLiveData<List<SqlMtbColr>> docRows = new MutableLiveData<>();
|
||||
|
||||
@Inject
|
||||
public DocInterniEditFormViewModel(DocInterniRESTConsumer docInterniRESTConsumer, MtbColrRepository mtbColrRepository, MtbColtRepository mtbColtRepository) {
|
||||
this.docInterniRESTConsumer = docInterniRESTConsumer;
|
||||
this.mtbColrRepository = mtbColrRepository;
|
||||
this.mtbColtRepository = mtbColtRepository;
|
||||
this.docRows.setValue(new ArrayList<>());
|
||||
}
|
||||
|
||||
private void sendOnLoadingStarted() {
|
||||
if (this.listener != null) listener.onLoadingStarted();
|
||||
}
|
||||
|
||||
private void sendOnLoadingEnded() {
|
||||
if (this.listener != null) listener.onLoadingEnded();
|
||||
}
|
||||
|
||||
private void sendError(Exception ex) {
|
||||
if (this.listener != null) listener.onError(ex);
|
||||
}
|
||||
|
||||
public void fetchDocumentRows() {
|
||||
this.sendOnLoadingStarted();
|
||||
mtbColrRepository.getDocumentRows(this.document.getValue(), rows -> {
|
||||
this.docRows.postValue(rows);
|
||||
this.listener.onRowsChanged(rows);
|
||||
this.sendOnLoadingEnded();
|
||||
}, this::sendError);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void editRow(SqlMtbColr row) {
|
||||
this.listener.onEditRowRequest(row);
|
||||
}
|
||||
|
||||
private Integer getNextIdRiga() {
|
||||
List<SqlMtbColr> rows = this.docRows.getValue();
|
||||
if (rows == null || rows.size() <= 0) {
|
||||
return 1;
|
||||
}
|
||||
return Stream.of(rows).mapToInt(SqlMtbColr::getRiga).max().getAsInt() + 1;
|
||||
}
|
||||
|
||||
public void exportDocument() {
|
||||
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() {
|
||||
this.listener.onDocumentHoldRequest();
|
||||
}
|
||||
|
||||
public void onSearch(String search) {
|
||||
this.sendOnLoadingStarted();
|
||||
GrigliaAcquistiChildDTO articolo = this.searchArticolo(search);
|
||||
if (articolo == null) {
|
||||
this.sendError(new Exception("Nessun articolo corrispondente al codice fornito!"));
|
||||
this.sendOnLoadingEnded();
|
||||
return;
|
||||
}
|
||||
SqlMtbColr row = this.getRowForArticolo(articolo);
|
||||
this.editRow(row);
|
||||
|
||||
}
|
||||
|
||||
private SqlMtbColr getRowForArticolo(GrigliaAcquistiChildDTO articolo) {
|
||||
List<SqlMtbColr> docRows = this.docRows.getValue();
|
||||
if (docRows == null) {
|
||||
docRows = new ArrayList<>();
|
||||
}
|
||||
SqlMtbColt document = this.document.getValue();
|
||||
SqlMtbColr row = Stream.of(docRows).filter(docRow -> docRow.getCodMart().equalsIgnoreCase(articolo.getCodMart())).findFirstOrElse(null);
|
||||
if (row == null) {
|
||||
row = new SqlMtbColr();
|
||||
row.setIdCollo(document.getId());
|
||||
row.setRiga(getNextIdRiga());
|
||||
row.setCodMart(articolo.getCodMart());
|
||||
row.setSerCollo(document.getSerCollo());
|
||||
row.setGestione(document.getGestione());
|
||||
row.setNumCollo(document.getNumCollo());
|
||||
row.setDataCollo(document.getDataCollo());
|
||||
row.setDescrizione(articolo.getDescrizione());
|
||||
row.setUntMis(articolo.getUntMis());
|
||||
row.setCodBarre(articolo.getBarcode());
|
||||
row.setQtaCnf(articolo.getQtaCnf().floatValue());
|
||||
row.setNumCnf(0f);
|
||||
row.setQtaCol(0f);
|
||||
}
|
||||
return row;
|
||||
}
|
||||
|
||||
private GrigliaAcquistiChildDTO searchArticolo(String filter) {
|
||||
return Stream.of(this.productsList).filter(dto -> dto.getCodMart().equalsIgnoreCase(filter) || dto.getBarcode().equalsIgnoreCase(filter)).findFirstOrElse(null);
|
||||
}
|
||||
|
||||
private SaveDTO getSaveDto() {
|
||||
SqlMtbColt document = this.getDocument();
|
||||
SaveDTO saveDTO = new SaveDTO();
|
||||
saveDTO.setIdDisp("1");
|
||||
saveDTO.setGestione(document.getGestione());
|
||||
saveDTO.setCodMdep(document.getCodMdep());
|
||||
saveDTO.setCodDtip(document.getCodDtipProvv());
|
||||
saveDTO.setAnnotazioni(document.getAnnotazioni());
|
||||
saveDTO.setSegno(document.getSegno().toString());
|
||||
|
||||
ColloDTO collo = new ColloDTO();
|
||||
collo.setIdDisp("1");
|
||||
collo.setGestione(document.getGestione());
|
||||
collo.setCodMdep(document.getCodMdep());
|
||||
collo.setCodDtip(document.getCodDtipProvv());
|
||||
collo.setCreatedDate(UtilityDate.formatDate(document.getDataCollo(), UtilityDate.COMMONS_DATE_FORMATS.DMY_TIME_SLASH));
|
||||
collo.setAnnotazioni(document.getAnnotazioni());
|
||||
collo.setSegno(saveDTO.getSegno());
|
||||
|
||||
for (SqlMtbColr row : this.getDocumentRows()) {
|
||||
ArtDTO artDto = new ArtDTO();
|
||||
artDto.setBarcode(row.getCodBarre());
|
||||
artDto.setQta(BigDecimal.valueOf(row.getQtaCol()));
|
||||
artDto.setDataIns(row.getDataCollo());
|
||||
artDto.setColli(BigDecimal.valueOf(row.getNumCnf()));
|
||||
artDto.setUntMis(row.getUntMis());
|
||||
artDto.setCodMart(row.getCodMart());
|
||||
if (row.getDataScad() != null) {
|
||||
artDto.setDataScad(row.getDataScad());
|
||||
}
|
||||
artDto.setDescrizione(row.getDescrizione());
|
||||
collo.addArtRow(artDto);
|
||||
}
|
||||
saveDTO.setColloDTO(collo);
|
||||
|
||||
return saveDTO;
|
||||
}
|
||||
|
||||
public DocInterniEditFormViewModel setListeners(Listener listener) {
|
||||
this.listener = listener;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setDocument(SqlMtbColt document) {
|
||||
this.document.setValue(document);
|
||||
}
|
||||
|
||||
public SqlMtbColt getDocument() {
|
||||
return document.getValue();
|
||||
}
|
||||
|
||||
public List<GrigliaAcquistiChildDTO> getProductsList() {
|
||||
return productsList;
|
||||
}
|
||||
|
||||
public void setProductsList(List<GrigliaAcquistiChildDTO> productsList) {
|
||||
this.productsList = productsList;
|
||||
}
|
||||
|
||||
public void onScanSuccessful(BarcodeScanDTO dto) {
|
||||
String code = dto.getStringValue();
|
||||
this.onSearch(code);
|
||||
}
|
||||
|
||||
public void saveRow(SqlMtbColr row, DialogInputQuantityV2ResultDTO resultDTO) {
|
||||
row.setQtaCnf(resultDTO.getQtaCnf().floatValue());
|
||||
row.setNumCnf(resultDTO.getNumCnf().floatValue());
|
||||
row.setQtaCol(resultDTO.getQtaTot().floatValue());
|
||||
row.setDataScad(resultDTO.getDataScad());
|
||||
if (row.getId() > 0) {
|
||||
this.mtbColrRepository.update(row, id -> {
|
||||
this.fetchDocumentRows();
|
||||
}, this::sendError);
|
||||
} else {
|
||||
this.mtbColrRepository.insert(row, id -> {
|
||||
this.fetchDocumentRows();
|
||||
}, this::sendError);
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteRow(SqlMtbColr sqlMtbColr) {
|
||||
mtbColrRepository.delete(sqlMtbColr, this::fetchDocumentRows, this::sendError);
|
||||
}
|
||||
|
||||
public void setNote(String note) {
|
||||
SqlMtbColt document = this.document.getValue();
|
||||
document.setAnnotazioni(note);
|
||||
mtbColtRepository.update(document, doc -> this.document.postValue(doc), this::sendError);
|
||||
}
|
||||
|
||||
public List<SqlMtbColr> getDocumentRows() {
|
||||
return this.docRows.getValue();
|
||||
}
|
||||
|
||||
public interface Listener extends ILoadingListener {
|
||||
|
||||
void onError(Exception ex);
|
||||
|
||||
void onRowsChanged(List<SqlMtbColr> rows);
|
||||
|
||||
void onEditRowRequest(SqlMtbColr row);
|
||||
|
||||
void onDocumentHoldRequest();
|
||||
|
||||
void onDocExported();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.ui;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.Html;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import androidx.databinding.ObservableArrayList;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColr;
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColt;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.expansion.view.ExtendedRecyclerView;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||
import it.integry.integrywmsnative.databinding.ActivityContabDocInternoRowListSingleItemBinding;
|
||||
import it.integry.integrywmsnative.databinding.DocInterniListModelBinding;
|
||||
|
||||
public class DocumentRowsListAdapter extends ExtendedRecyclerView<SqlMtbColr, DocumentRowsListAdapter.SingleItemViewHolder> {
|
||||
|
||||
private Context mContext;
|
||||
|
||||
private RunnableArgs<SqlMtbColr> mOnItemClicked;
|
||||
|
||||
public DocumentRowsListAdapter(Context context, ObservableArrayList<SqlMtbColr> myDataset) {
|
||||
super(myDataset);
|
||||
this.mContext = context;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public SingleItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
ActivityContabDocInternoRowListSingleItemBinding binding = DataBindingUtil.inflate(LayoutInflater.from(parent.getContext()), R.layout.activity_contab_doc_interno_row__list_single_item, parent, false);
|
||||
return new SingleItemViewHolder(binding);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull SingleItemViewHolder holder, int position) {
|
||||
final SqlMtbColr row = mDataset.get(position);
|
||||
holder.binding.setItem(row);
|
||||
holder.binding.executePendingBindings();
|
||||
holder.binding.getRoot().setOnClickListener(v -> {
|
||||
if (this.mOnItemClicked != null)
|
||||
this.mOnItemClicked.run(row);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public void setOnItemClicked(RunnableArgs<SqlMtbColr> onItemClicked){
|
||||
this.mOnItemClicked = onItemClicked;
|
||||
}
|
||||
static class SingleItemViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
ActivityContabDocInternoRowListSingleItemBinding binding;
|
||||
|
||||
SingleItemViewHolder(ActivityContabDocInternoRowListSingleItemBinding binding) {
|
||||
super(binding.getRoot());
|
||||
this.binding = binding;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package it.integry.integrywmsnative.gest.contab_doc_interni.rest;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||
import it.integry.integrywmsnative.core.rest.consumers._BaseRESTConsumer;
|
||||
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.SaveDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.TipiDocAndGruppiArtDTO;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
|
||||
@Singleton
|
||||
public class DocInterniRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
public void getDocTypesAndGroupArts(RunnableArgs<TipiDocAndGruppiArtDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
DocInterniRESTConsumerService service = RESTBuilder.getService(DocInterniRESTConsumerService.class);
|
||||
service.getDocTypesAndGroupArts().enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<TipiDocAndGruppiArtDTO>> call, Response<ServiceRESTResponse<TipiDocAndGruppiArtDTO>> response) {
|
||||
analyzeAnswer(response, "getDocTypesAndGroupArts", onComplete, onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<TipiDocAndGruppiArtDTO>> call, Throwable t) {
|
||||
onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void fetchProducts(String codDtip, String codMgrp, RunnableArgs<GrigliaAcquistiDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
DocInterniRESTConsumerService service = RESTBuilder.getService(DocInterniRESTConsumerService.class);
|
||||
service.fetchProducts(codDtip,codMgrp,"L").enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<GrigliaAcquistiDTO>> call, Response<ServiceRESTResponse<GrigliaAcquistiDTO>> response) {
|
||||
analyzeAnswer(response, "fetchProducts", onComplete, onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<GrigliaAcquistiDTO>> call, Throwable t) {
|
||||
onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public void saveDoc(SaveDTO saveDTO, RunnableArgs<JsonObject> onComplete, RunnableArgs<Exception> onFailed){
|
||||
DocInterniRESTConsumerService service = RESTBuilder.getService(DocInterniRESTConsumerService.class);
|
||||
service.save(saveDTO).enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<JsonObject>> call, Response<ServiceRESTResponse<JsonObject>> response) {
|
||||
analyzeAnswer(response, "saveDoc", onComplete, onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<JsonObject>> call, Throwable t) {
|
||||
onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package it.integry.integrywmsnative.gest.contab_doc_interni.rest;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
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.SaveDTO;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.TipiDocAndGruppiArtDTO;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.http.Body;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.POST;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
|
||||
public interface DocInterniRESTConsumerService {
|
||||
|
||||
@GET("getDocTypesAndArtsGroups")
|
||||
Call<ServiceRESTResponse<TipiDocAndGruppiArtDTO>> getDocTypesAndGroupArts();
|
||||
|
||||
@POST("SM2SaveTerminalinoWMS")
|
||||
Call<ServiceRESTResponse<JsonObject>> save(@Body SaveDTO saveDTO);
|
||||
|
||||
@GET("getElencoArticoli")
|
||||
Call<ServiceRESTResponse<GrigliaAcquistiDTO>> fetchProducts(@Query("codDtip") String codDtip, @Query("codMgrp") String codMgrp, @Query("gestione") String gestione);
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package it.integry.integrywmsnative.gest.contab_doc_interni.ui;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.Html;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import androidx.databinding.ObservableArrayList;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColt;
|
||||
import it.integry.integrywmsnative.core.data_store.db.wrappers.DocInternoWrapper;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.expansion.view.ExtendedRecyclerView;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||
import it.integry.integrywmsnative.databinding.DocInterniListModelBinding;
|
||||
|
||||
public class DocInterniListAdapter extends ExtendedRecyclerView<DocInterniListModel, DocInterniListAdapter.SingleItemViewHolder> {
|
||||
|
||||
private Context mContext;
|
||||
|
||||
private RunnableArgs<SqlMtbColt> mOnItemClicked;
|
||||
|
||||
public DocInterniListAdapter(Context context, ObservableArrayList<DocInterniListModel> myDataset) {
|
||||
super(myDataset);
|
||||
this.mContext = context;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public SingleItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
DocInterniListModelBinding binding = DataBindingUtil.inflate(LayoutInflater.from(parent.getContext()), R.layout.doc_interni_list_model, parent, false);
|
||||
return new SingleItemViewHolder(binding);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull SingleItemViewHolder holder, int position) {
|
||||
final DocInterniListModel doc = mDataset.get(position);
|
||||
SqlMtbColt mtbColt = doc.getDocument();
|
||||
|
||||
String testataDocString = String.format(mContext.getString(R.string.doc_interni_doc_header), mtbColt.getId(), mtbColt.getCodDtipProvv());
|
||||
holder.binding.dataDoc.setText(Html.fromHtml(UtilityDate.formatDate(mtbColt.getDataCollo(), UtilityDate.COMMONS_DATE_FORMATS.DM_HUMAN)));
|
||||
holder.binding.docDescription.setText(Html.fromHtml(testataDocString));
|
||||
holder.binding.numRows.setText(Html.fromHtml(String.format(mContext.getString(R.string.doc_interni_num_arts_doc), doc.getProductsCount())));
|
||||
|
||||
holder.binding.executePendingBindings();
|
||||
holder.binding.getRoot().setOnClickListener(v -> {
|
||||
if (this.mOnItemClicked != null)
|
||||
this.mOnItemClicked.run(mtbColt);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public void setOnItemClicked(RunnableArgs<SqlMtbColt> onItemClicked){
|
||||
this.mOnItemClicked = onItemClicked;
|
||||
}
|
||||
static class SingleItemViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
DocInterniListModelBinding binding;
|
||||
|
||||
SingleItemViewHolder(DocInterniListModelBinding binding) {
|
||||
super(binding.getRoot());
|
||||
this.binding = binding;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package it.integry.integrywmsnative.gest.contab_doc_interni.ui;
|
||||
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColt;
|
||||
import it.integry.integrywmsnative.core.data_store.db.wrappers.DocInternoWrapper;
|
||||
|
||||
public class DocInterniListModel {
|
||||
|
||||
|
||||
private SqlMtbColt document;
|
||||
private int productsCount;
|
||||
|
||||
public SqlMtbColt getDocument() {
|
||||
return document;
|
||||
}
|
||||
|
||||
public void setDocument(SqlMtbColt document) {
|
||||
this.document = document;
|
||||
}
|
||||
|
||||
public int getProductsCount() {
|
||||
return productsCount;
|
||||
}
|
||||
|
||||
public void setProductsCount(int productsCount) {
|
||||
this.productsCount = productsCount;
|
||||
}
|
||||
}
|
||||
@@ -39,7 +39,7 @@ import it.integry.integrywmsnative.core.interfaces.IFilterableFragment;
|
||||
import it.integry.integrywmsnative.core.interfaces.ILifecycleFragment;
|
||||
import it.integry.integrywmsnative.core.interfaces.IPoppableActivity;
|
||||
import it.integry.integrywmsnative.core.interfaces.IScrollableFragment;
|
||||
import it.integry.integrywmsnative.core.interfaces.ISearcableFragment;
|
||||
import it.integry.integrywmsnative.core.interfaces.ISearchableFragment;
|
||||
import it.integry.integrywmsnative.core.interfaces.ISelectAllFragment;
|
||||
import it.integry.integrywmsnative.core.interfaces.ITitledFragment;
|
||||
import it.integry.integrywmsnative.core.menu.MenuService;
|
||||
@@ -280,21 +280,21 @@ public class MainActivity extends BaseActivity
|
||||
}
|
||||
|
||||
private void adaptViewToFragment(Fragment fragment) {
|
||||
if (fragment instanceof ISearcableFragment) {
|
||||
if (fragment instanceof ISearchableFragment) {
|
||||
mBinding.appBarMain.mainSearch.setOnQueryTextListener((SearchView.OnQueryTextListener) fragment);
|
||||
mBinding.appBarMain.mainSearch.setVisibility(View.VISIBLE);
|
||||
mBinding.appBarMain.mainSearch.setOnSearchClickListener(v -> {
|
||||
((ISearcableFragment) fragment).onSearchEnabled();
|
||||
((ISearchableFragment) fragment).onSearchEnabled();
|
||||
mBinding.appBarMain.toolbarTitleLeft.setVisibility(View.GONE);
|
||||
});
|
||||
|
||||
mBinding.appBarMain.mainSearch.setOnCloseListener(() -> {
|
||||
((ISearcableFragment) fragment).onSearchDisabled();
|
||||
((ISearchableFragment) fragment).onSearchDisabled();
|
||||
mBinding.appBarMain.toolbarTitleLeft.setVisibility(View.VISIBLE);
|
||||
return false;
|
||||
});
|
||||
|
||||
((ISearcableFragment) fragment).addOnPreDestroy(() -> {
|
||||
((ISearchableFragment) fragment).addOnPreDestroy(() -> {
|
||||
mBinding.appBarMain.mainSearch.setIconified(true);
|
||||
mBinding.appBarMain.mainSearch.setVisibility(View.GONE);
|
||||
});
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.text.Html;
|
||||
import android.text.SpannableString;
|
||||
@@ -33,11 +34,10 @@ import it.integry.integrywmsnative.core.expansion.BaseActivity;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.PVOrdiniAcquistoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityProgress;
|
||||
import it.integry.integrywmsnative.databinding.ActivityPvOrdineAcquistoEditBinding;
|
||||
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.ui.OrdineAcquistoArtListAdapter;
|
||||
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.dialog.EditArticoloDialog;
|
||||
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.helper.PVEditOrderHelper;
|
||||
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.ui.OrdineAcquistoArtListAdapter;
|
||||
import it.integry.integrywmsnative.ui.FabMenuCustomAnimations;
|
||||
import it.integry.integrywmsnative.ui.SimpleDividerItemDecoration;
|
||||
import it.integry.integrywmsnative.view.dialogs.DialogAskAction;
|
||||
@@ -46,6 +46,7 @@ import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||
|
||||
public class PVOrdineAcquistoEditActivity extends BaseActivity {
|
||||
|
||||
private static String DATA_KEY_ORDER = "keyOrdine";
|
||||
private Ordine mOrdine;
|
||||
private Griglia mGriglia;
|
||||
private List<ArticoloOrdine> mArticoli = new ArrayList<>();
|
||||
@@ -64,6 +65,13 @@ public class PVOrdineAcquistoEditActivity extends BaseActivity {
|
||||
ArticoloGrigliaRepository mArticoloGrigliaRepository;
|
||||
|
||||
|
||||
public static Intent newInstance(Context context, Ordine ordine){
|
||||
Intent myIntent = new Intent(context, PVOrdineAcquistoEditActivity.class);
|
||||
String keyOrdine = DataCache.addItem(ordine);
|
||||
myIntent.putExtra(DATA_KEY_ORDER, keyOrdine);
|
||||
return myIntent;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -77,7 +85,7 @@ public class PVOrdineAcquistoEditActivity extends BaseActivity {
|
||||
|
||||
mBinding = DataBindingUtil.setContentView(this, R.layout.activity_pv_ordine_acquisto_edit);
|
||||
mBinding.setViewModel(this);
|
||||
mOrdine = DataCache.retrieveItem(getIntent().getStringExtra("keyOrdine"));
|
||||
mOrdine = DataCache.retrieveItem(getIntent().getStringExtra(DATA_KEY_ORDER));
|
||||
setSupportActionBar(mBinding.toolbar);
|
||||
mBinding.toolbar.setTitle(R.string.edit_order);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
@@ -97,7 +97,7 @@ public class PVOrdiniAcquistoGrigliaFragment extends Fragment implements ITitled
|
||||
mBinding = DataBindingUtil.inflate(inflater, R.layout.fragment_pv_ordini_acquisto, container, false);
|
||||
mBinding.setViewmodel(this);
|
||||
|
||||
mHelper = new OrdineAcquistoPvHelper(getActivity(), mGrigliaRepository, mArticoloGrigliaRepository, mArticoliOrdineRepository, mOrdineRepository);
|
||||
mHelper = new OrdineAcquistoPvHelper(requireActivity(), mGrigliaRepository, mArticoloGrigliaRepository, mArticoliOrdineRepository, mOrdineRepository);
|
||||
|
||||
init();
|
||||
initRecyclerView();
|
||||
@@ -107,9 +107,9 @@ public class PVOrdiniAcquistoGrigliaFragment extends Fragment implements ITitled
|
||||
private void init() {
|
||||
|
||||
BarcodeManager.enable();
|
||||
DialogScanLisA.make(getActivity(), mGrigliaRepository, mHelper, griglia -> {
|
||||
DialogScanLisA.make(requireActivity(), mGrigliaRepository, mHelper, griglia -> {
|
||||
if (griglia == null) {
|
||||
if (getActivity() != null) ((IPoppableActivity) getActivity()).pop();
|
||||
((IPoppableActivity) requireActivity()).pop();
|
||||
} else {
|
||||
setGriglia(griglia);
|
||||
}
|
||||
@@ -136,15 +136,15 @@ public class PVOrdiniAcquistoGrigliaFragment extends Fragment implements ITitled
|
||||
private void fetchOrders() {
|
||||
this.openProgress();
|
||||
|
||||
mOrdineRepository.selectAllOpenOrders(mGriglia, (ordini) -> getActivity().runOnUiThread(() -> {
|
||||
mOrdineRepository.selectAllOpenOrders(mGriglia, (ordini) -> requireActivity().runOnUiThread(() -> {
|
||||
this.closeProgress();
|
||||
setOrdini(ordini);
|
||||
}), (e) -> {
|
||||
this.closeProgress();
|
||||
String errorMessage = e.getMessage();
|
||||
getActivity().runOnUiThread(() -> DialogSimpleMessageView
|
||||
requireActivity().runOnUiThread(() -> DialogSimpleMessageView
|
||||
.makeErrorDialog(new SpannableString(errorMessage), null, null)
|
||||
.show(getActivity().getSupportFragmentManager(), "tag"));
|
||||
.show(requireActivity().getSupportFragmentManager(), "tag"));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -167,29 +167,22 @@ public class PVOrdiniAcquistoGrigliaFragment extends Fragment implements ITitled
|
||||
private void initRecyclerView() {
|
||||
mBinding.ordiniAApertiMainList.setHasFixedSize(true);
|
||||
|
||||
mBinding.ordiniAApertiMainList.setLayoutManager(new LinearLayoutManager(getActivity()));
|
||||
mBinding.ordiniAApertiMainList.setLayoutManager(new LinearLayoutManager(requireActivity()));
|
||||
|
||||
SimpleDividerItemDecoration itemDecorator = new SimpleDividerItemDecoration(getActivity(), SimpleDividerItemDecoration.VERTICAL);
|
||||
itemDecorator.setDrawable(ContextCompat.getDrawable(getActivity(), R.drawable.divider));
|
||||
SimpleDividerItemDecoration itemDecorator = new SimpleDividerItemDecoration(requireActivity(), SimpleDividerItemDecoration.VERTICAL);
|
||||
itemDecorator.setDrawable(ContextCompat.getDrawable(requireActivity(), R.drawable.divider));
|
||||
mBinding.ordiniAApertiMainList.addItemDecoration(itemDecorator);
|
||||
mAdapter = new OrdineAcquistoPvOpenListAdapter(getActivity(), mRenderedOrderList, this::selectAction);
|
||||
mAdapter = new OrdineAcquistoPvOpenListAdapter(requireActivity(), mRenderedOrderList, this::selectAction);
|
||||
mBinding.ordiniAApertiMainList.setAdapter(mAdapter);
|
||||
}
|
||||
|
||||
private void editOrdine(Ordine ordine) {
|
||||
|
||||
Intent myIntent = new Intent(getActivity(), PVOrdineAcquistoEditActivity.class);
|
||||
|
||||
String keyOrdine = DataCache.addItem(ordine);
|
||||
myIntent.putExtra("keyOrdine", keyOrdine);
|
||||
|
||||
getActivity().startActivity(myIntent);
|
||||
|
||||
requireActivity().startActivity(PVOrdineAcquistoEditActivity.newInstance(requireActivity(),ordine));
|
||||
}
|
||||
|
||||
|
||||
private void selectAction(Ordine ordine) {
|
||||
getActivity().runOnUiThread(() -> DialogAskAction.make(getActivity(),
|
||||
requireActivity().runOnUiThread(() -> DialogAskAction.make(requireActivity(),
|
||||
Html.fromHtml(String.format(this.getString(R.string.ord_acq_testata), String.valueOf(ordine.getOrdineId()), UtilityDate.formatDate(ordine.getDataIns(), UtilityDate.COMMONS_DATE_FORMATS.DMY_HUMAN))).toString(),
|
||||
ordine.getCountArticoli() + " articoli",
|
||||
() -> this.editOrdine(ordine),
|
||||
@@ -200,20 +193,20 @@ public class PVOrdiniAcquistoGrigliaFragment extends Fragment implements ITitled
|
||||
private void deleteOrdine(Ordine ordine) {
|
||||
String text = "Stai per eliminare un ordine sei sicuro?";
|
||||
|
||||
DialogSimpleMessageView.makeWarningDialog(new SpannableString(Html.fromHtml(text)), null, () -> getActivity().runOnUiThread(() -> {
|
||||
DialogSimpleMessageView.makeWarningDialog(new SpannableString(Html.fromHtml(text)), null, () -> requireActivity().runOnUiThread(() -> {
|
||||
this.openProgress();
|
||||
mHelper.deleteOrder(ordine, () -> {
|
||||
getActivity().runOnUiThread(() -> {
|
||||
requireActivity().runOnUiThread(() -> {
|
||||
this.closeProgress();
|
||||
Toast.makeText(getActivity(), "Ordine eliminato!", Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(requireActivity(), "Ordine eliminato!", Toast.LENGTH_SHORT).show();
|
||||
fetchOrders();
|
||||
});
|
||||
}, e -> {
|
||||
this.closeProgress();
|
||||
getActivity().runOnUiThread(() -> UtilityExceptions.defaultException(getActivity(), e));
|
||||
requireActivity().runOnUiThread(() -> UtilityExceptions.defaultException(requireActivity(), e));
|
||||
});
|
||||
}), () -> {
|
||||
}).show(getActivity().getSupportFragmentManager(), "tag");
|
||||
}).show(requireActivity().getSupportFragmentManager(), "tag");
|
||||
}
|
||||
|
||||
private void refreshRenderedOrdini(List<OrdineWrapper> ordini) {
|
||||
@@ -225,9 +218,9 @@ public class PVOrdiniAcquistoGrigliaFragment extends Fragment implements ITitled
|
||||
this.openProgress();
|
||||
mHelper.createNewOrder(mGriglia, order -> {
|
||||
this.closeProgress();
|
||||
getActivity().runOnUiThread(() -> editOrdine(order));
|
||||
}, e -> getActivity().runOnUiThread(() -> {
|
||||
UtilityExceptions.defaultException(getActivity(), e);
|
||||
requireActivity().runOnUiThread(() -> editOrdine(order));
|
||||
}, e -> requireActivity().runOnUiThread(() -> {
|
||||
UtilityExceptions.defaultException(requireActivity(), e);
|
||||
this.closeProgress();
|
||||
}
|
||||
));
|
||||
@@ -261,15 +254,15 @@ public class PVOrdiniAcquistoGrigliaFragment extends Fragment implements ITitled
|
||||
}
|
||||
|
||||
protected void openProgress() {
|
||||
getActivity().runOnUiThread(() -> {
|
||||
requireActivity().runOnUiThread(() -> {
|
||||
if (this.mCurrentProgress == null) {
|
||||
this.mCurrentProgress = UtilityProgress.createDefaultProgressDialog(getActivity());
|
||||
this.mCurrentProgress = UtilityProgress.createDefaultProgressDialog(requireActivity());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected void closeProgress() {
|
||||
getActivity().runOnUiThread(() -> {
|
||||
requireActivity().runOnUiThread(() -> {
|
||||
if (mCurrentProgress != null) {
|
||||
mCurrentProgress.dismiss();
|
||||
mCurrentProgress = null;
|
||||
|
||||
@@ -21,7 +21,7 @@ import it.integry.integrywmsnative.databinding.DialogInputGeneralBinding;
|
||||
public class DialogSimpleInputHelper {
|
||||
|
||||
|
||||
private static Dialog makeBase(Context mContext, String titleText, RunnableArgs<String> onPositiveClick, Runnable onNegativeClick){
|
||||
private static Dialog makeBase(Context mContext, String titleText, String valueText, RunnableArgs<String> onPositiveClick, Runnable onNegativeClick){
|
||||
Dialog dialog = new Dialog(mContext);
|
||||
DialogSimpleInputViewModel viewModel = new DialogSimpleInputViewModel(dialog);
|
||||
|
||||
@@ -39,6 +39,9 @@ public class DialogSimpleInputHelper {
|
||||
|
||||
//Title VIEW
|
||||
mBinding.titleText.setText(titleText);
|
||||
if (valueText != null){
|
||||
mBinding.generalInput.setText(valueText);
|
||||
}
|
||||
ColorStateList colorStateList = ColorStateList.valueOf(Color.WHITE);
|
||||
|
||||
//Content View
|
||||
@@ -56,6 +59,18 @@ public class DialogSimpleInputHelper {
|
||||
|
||||
return makeBase(mContext,
|
||||
title,
|
||||
null,
|
||||
onPositiveClick,
|
||||
onNegativeClick);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static Dialog makeInputDialog(Context mContext, String title,String value, RunnableArgs<String> onPositiveClick, Runnable onNegativeClick){
|
||||
|
||||
return makeBase(mContext,
|
||||
title,
|
||||
value,
|
||||
onPositiveClick,
|
||||
onNegativeClick);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user