Merge remote-tracking branch 'origin/develop' into develop
This commit is contained in:
commit
a3dd34bb85
@ -17,8 +17,8 @@ apply plugin: 'com.google.gms.google-services'
|
||||
|
||||
android {
|
||||
|
||||
def appVersionCode = 122
|
||||
def appVersionName = '1.11.3'
|
||||
def appVersionCode = 126
|
||||
def appVersionName = '1.11.7'
|
||||
|
||||
signingConfigs {
|
||||
release {
|
||||
@ -95,9 +95,9 @@ dependencies {
|
||||
})
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||
implementation 'com.orhanobut:logger:2.2.0'
|
||||
implementation 'com.google.firebase:firebase-core:17.2.1'
|
||||
implementation 'com.google.firebase:firebase-core:17.2.2'
|
||||
implementation 'com.google.firebase:firebase-crash:16.2.1'
|
||||
implementation 'com.google.firebase:firebase-perf:19.0.3'
|
||||
implementation 'com.google.firebase:firebase-perf:19.0.5'
|
||||
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
|
||||
implementation 'androidx.appcompat:appcompat:1.1.0'
|
||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||
|
||||
@ -0,0 +1,398 @@
|
||||
package it.integry.integrywmsnative.core.model;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
public class GtbAnag {
|
||||
|
||||
private String codAnag;
|
||||
private String ragSoc;
|
||||
private String indirizzo;
|
||||
private String cap;
|
||||
private String citta;
|
||||
private String prov;
|
||||
private String nazione;
|
||||
private String telefono;
|
||||
private String fax;
|
||||
private String partIva;
|
||||
private String codFisc;
|
||||
private String note;
|
||||
private String personaRif;
|
||||
private String allegato;
|
||||
private String eMail;
|
||||
private String eMailPec;
|
||||
private String flagPersonaFg;
|
||||
private String sesso;
|
||||
private String codCentroAzi;
|
||||
private String codRuop;
|
||||
private Date dataNascita;
|
||||
private String luogoNascita;
|
||||
private String provNascita;
|
||||
private String nome;
|
||||
private String ragSoc2;
|
||||
private Integer classeMerito;
|
||||
private Date dataIns;
|
||||
private String numCell;
|
||||
private String cciaa;
|
||||
private String tipoAzienda;
|
||||
private String cuuPa;
|
||||
private String cognome;
|
||||
private String diacod;
|
||||
private BigDecimal lat;
|
||||
private BigDecimal lng;
|
||||
private String flagInformativa;
|
||||
private String flagConsenso;
|
||||
private String precode;
|
||||
private Boolean insDestinatario;
|
||||
|
||||
public String getCodAnag() {
|
||||
return codAnag;
|
||||
}
|
||||
|
||||
public GtbAnag setCodAnag(String codAnag) {
|
||||
this.codAnag = codAnag;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getRagSoc() {
|
||||
return ragSoc;
|
||||
}
|
||||
|
||||
public GtbAnag setRagSoc(String ragSoc) {
|
||||
this.ragSoc = ragSoc;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getIndirizzo() {
|
||||
return indirizzo;
|
||||
}
|
||||
|
||||
public GtbAnag setIndirizzo(String indirizzo) {
|
||||
this.indirizzo = indirizzo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCap() {
|
||||
return cap;
|
||||
}
|
||||
|
||||
public GtbAnag setCap(String cap) {
|
||||
this.cap = cap;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCitta() {
|
||||
return citta;
|
||||
}
|
||||
|
||||
public GtbAnag setCitta(String citta) {
|
||||
this.citta = citta;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getProv() {
|
||||
return prov;
|
||||
}
|
||||
|
||||
public GtbAnag setProv(String prov) {
|
||||
this.prov = prov;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getNazione() {
|
||||
return nazione;
|
||||
}
|
||||
|
||||
public GtbAnag setNazione(String nazione) {
|
||||
this.nazione = nazione;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getTelefono() {
|
||||
return telefono;
|
||||
}
|
||||
|
||||
public GtbAnag setTelefono(String telefono) {
|
||||
this.telefono = telefono;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getFax() {
|
||||
return fax;
|
||||
}
|
||||
|
||||
public GtbAnag setFax(String fax) {
|
||||
this.fax = fax;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPartIva() {
|
||||
return partIva;
|
||||
}
|
||||
|
||||
public GtbAnag setPartIva(String partIva) {
|
||||
this.partIva = partIva;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodFisc() {
|
||||
return codFisc;
|
||||
}
|
||||
|
||||
public GtbAnag setCodFisc(String codFisc) {
|
||||
this.codFisc = codFisc;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getNote() {
|
||||
return note;
|
||||
}
|
||||
|
||||
public GtbAnag setNote(String note) {
|
||||
this.note = note;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPersonaRif() {
|
||||
return personaRif;
|
||||
}
|
||||
|
||||
public GtbAnag setPersonaRif(String personaRif) {
|
||||
this.personaRif = personaRif;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getAllegato() {
|
||||
return allegato;
|
||||
}
|
||||
|
||||
public GtbAnag setAllegato(String allegato) {
|
||||
this.allegato = allegato;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String geteMail() {
|
||||
return eMail;
|
||||
}
|
||||
|
||||
public GtbAnag seteMail(String eMail) {
|
||||
this.eMail = eMail;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String geteMailPec() {
|
||||
return eMailPec;
|
||||
}
|
||||
|
||||
public GtbAnag seteMailPec(String eMailPec) {
|
||||
this.eMailPec = eMailPec;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getFlagPersonaFg() {
|
||||
return flagPersonaFg;
|
||||
}
|
||||
|
||||
public GtbAnag setFlagPersonaFg(String flagPersonaFg) {
|
||||
this.flagPersonaFg = flagPersonaFg;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getSesso() {
|
||||
return sesso;
|
||||
}
|
||||
|
||||
public GtbAnag setSesso(String sesso) {
|
||||
this.sesso = sesso;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodCentroAzi() {
|
||||
return codCentroAzi;
|
||||
}
|
||||
|
||||
public GtbAnag setCodCentroAzi(String codCentroAzi) {
|
||||
this.codCentroAzi = codCentroAzi;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodRuop() {
|
||||
return codRuop;
|
||||
}
|
||||
|
||||
public GtbAnag setCodRuop(String codRuop) {
|
||||
this.codRuop = codRuop;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataNascita() {
|
||||
return dataNascita;
|
||||
}
|
||||
|
||||
public GtbAnag setDataNascita(Date dataNascita) {
|
||||
this.dataNascita = dataNascita;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getLuogoNascita() {
|
||||
return luogoNascita;
|
||||
}
|
||||
|
||||
public GtbAnag setLuogoNascita(String luogoNascita) {
|
||||
this.luogoNascita = luogoNascita;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getProvNascita() {
|
||||
return provNascita;
|
||||
}
|
||||
|
||||
public GtbAnag setProvNascita(String provNascita) {
|
||||
this.provNascita = provNascita;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getNome() {
|
||||
return nome;
|
||||
}
|
||||
|
||||
public GtbAnag setNome(String nome) {
|
||||
this.nome = nome;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getRagSoc2() {
|
||||
return ragSoc2;
|
||||
}
|
||||
|
||||
public GtbAnag setRagSoc2(String ragSoc2) {
|
||||
this.ragSoc2 = ragSoc2;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getClasseMerito() {
|
||||
return classeMerito;
|
||||
}
|
||||
|
||||
public GtbAnag setClasseMerito(Integer classeMerito) {
|
||||
this.classeMerito = classeMerito;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataIns() {
|
||||
return dataIns;
|
||||
}
|
||||
|
||||
public GtbAnag setDataIns(Date dataIns) {
|
||||
this.dataIns = dataIns;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getNumCell() {
|
||||
return numCell;
|
||||
}
|
||||
|
||||
public GtbAnag setNumCell(String numCell) {
|
||||
this.numCell = numCell;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCciaa() {
|
||||
return cciaa;
|
||||
}
|
||||
|
||||
public GtbAnag setCciaa(String cciaa) {
|
||||
this.cciaa = cciaa;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getTipoAzienda() {
|
||||
return tipoAzienda;
|
||||
}
|
||||
|
||||
public GtbAnag setTipoAzienda(String tipoAzienda) {
|
||||
this.tipoAzienda = tipoAzienda;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCuuPa() {
|
||||
return cuuPa;
|
||||
}
|
||||
|
||||
public GtbAnag setCuuPa(String cuuPa) {
|
||||
this.cuuPa = cuuPa;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCognome() {
|
||||
return cognome;
|
||||
}
|
||||
|
||||
public GtbAnag setCognome(String cognome) {
|
||||
this.cognome = cognome;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDiacod() {
|
||||
return diacod;
|
||||
}
|
||||
|
||||
public GtbAnag setDiacod(String diacod) {
|
||||
this.diacod = diacod;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
public GtbAnag setLat(BigDecimal lat) {
|
||||
this.lat = lat;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getLng() {
|
||||
return lng;
|
||||
}
|
||||
|
||||
public GtbAnag setLng(BigDecimal lng) {
|
||||
this.lng = lng;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getFlagInformativa() {
|
||||
return flagInformativa;
|
||||
}
|
||||
|
||||
public GtbAnag setFlagInformativa(String flagInformativa) {
|
||||
this.flagInformativa = flagInformativa;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getFlagConsenso() {
|
||||
return flagConsenso;
|
||||
}
|
||||
|
||||
public GtbAnag setFlagConsenso(String flagConsenso) {
|
||||
this.flagConsenso = flagConsenso;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPrecode() {
|
||||
return precode;
|
||||
}
|
||||
|
||||
public GtbAnag setPrecode(String precode) {
|
||||
this.precode = precode;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Boolean getInsDestinatario() {
|
||||
return insDestinatario;
|
||||
}
|
||||
|
||||
public GtbAnag setInsDestinatario(Boolean insDestinatario) {
|
||||
this.insDestinatario = insDestinatario;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@ -44,8 +44,8 @@ public class UpdatesManager {
|
||||
.setDisplay(Display.DIALOG)
|
||||
.setUpdateFrom(UpdateFrom.JSON)
|
||||
.setUpdateJSON(currentVersionUrl)
|
||||
.setButtonDoNotShowAgain(null)
|
||||
.setButtonUpdateClickListener((dialog, which) -> {
|
||||
|
||||
installAPK(context, currentDownloadUrl);
|
||||
});
|
||||
appUpdater.start();
|
||||
|
||||
@ -21,7 +21,9 @@ import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.di.BindableString;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgss;
|
||||
import it.integry.integrywmsnative.core.model.GtbAnag;
|
||||
import it.integry.integrywmsnative.core.rest.model.DocumentoResoDTO;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
@ -32,30 +34,30 @@ public class DialogUltimeConsegneFiltroAvanzato {
|
||||
private AlertDialog mAlert;
|
||||
private Context mContext;
|
||||
private DialogUltimeConsegneFiltroAvanzatoViewModel mBaseViewModel;
|
||||
private RunnableArgss<List<DocumentoResoDTO>, DialogUltimeConsegneFiltroAvanzatoViewModel> mOnDismiss;
|
||||
private RunnableArgs<DialogUltimeConsegneFiltroAvanzatoViewModel> mOnDismiss;
|
||||
|
||||
|
||||
|
||||
private ArrayAdapter<String> arrayAdapterRagSoc;
|
||||
|
||||
private List<DocumentoResoDTO> mItems;
|
||||
private List<DocumentoResoDTO> mFilteredItems;
|
||||
private List<GtbAnag> mItems;
|
||||
private List<GtbAnag> mFilteredItems;
|
||||
|
||||
private Predicate<DocumentoResoDTO> currentRagSocPredicate = null;
|
||||
private Predicate<DocumentoResoDTO> currentDataDocPredicate = null;
|
||||
private Predicate<GtbAnag> currentRagSocPredicate = null;
|
||||
private Predicate<GtbAnag> currentDataDocPredicate = null;
|
||||
|
||||
public static AlertDialog make(final Context context,
|
||||
final List<DocumentoResoDTO> items,
|
||||
final List<GtbAnag> items,
|
||||
DialogUltimeConsegneFiltroAvanzatoViewModel baseViewModel,
|
||||
RunnableArgss<List<DocumentoResoDTO>, DialogUltimeConsegneFiltroAvanzatoViewModel> onDismiss) {
|
||||
RunnableArgs<DialogUltimeConsegneFiltroAvanzatoViewModel> onDismiss) {
|
||||
return new DialogUltimeConsegneFiltroAvanzato(context, items, baseViewModel, onDismiss).mAlert;
|
||||
}
|
||||
|
||||
|
||||
public DialogUltimeConsegneFiltroAvanzato(final Context context,
|
||||
final List<DocumentoResoDTO> items,
|
||||
final List<GtbAnag> items,
|
||||
DialogUltimeConsegneFiltroAvanzatoViewModel baseViewModel,
|
||||
RunnableArgss<List<DocumentoResoDTO>, DialogUltimeConsegneFiltroAvanzatoViewModel> onDismiss) {
|
||||
RunnableArgs<DialogUltimeConsegneFiltroAvanzatoViewModel> onDismiss) {
|
||||
mContext = context;
|
||||
mItems = items;
|
||||
mBaseViewModel = baseViewModel;
|
||||
@ -89,7 +91,7 @@ public class DialogUltimeConsegneFiltroAvanzato {
|
||||
|
||||
|
||||
mAlert.setOnDismissListener(dialogInterface -> {
|
||||
if(mOnDismiss != null) mOnDismiss.run(mFilteredItems, viewModel);
|
||||
if(mOnDismiss != null) mOnDismiss.run(viewModel);
|
||||
});
|
||||
|
||||
refreshList();
|
||||
@ -144,26 +146,13 @@ public class DialogUltimeConsegneFiltroAvanzato {
|
||||
|
||||
refreshList();
|
||||
});
|
||||
|
||||
BindableString.resetListeners(viewModel.dataDoc);
|
||||
BindableString.registerListener(viewModel.dataDoc, value -> {
|
||||
if (UtilityString.isNullOrEmpty(value)) currentDataDocPredicate = null;
|
||||
else {
|
||||
currentDataDocPredicate = o -> o.getDataDocD().equals(viewModel.dataDocDate);
|
||||
}
|
||||
|
||||
refreshList();
|
||||
|
||||
arrayAdapterRagSoc.clear();
|
||||
arrayAdapterRagSoc.addAll(getAvailableRagSocs(true));
|
||||
});
|
||||
}
|
||||
|
||||
private List<String> getAvailableRagSocs(boolean skipRecalc) {
|
||||
if(currentDataDocPredicate == null){
|
||||
mFilteredItems = mItems;
|
||||
} else if(!skipRecalc){
|
||||
Stream<DocumentoResoDTO> tmpStream = Stream.of(mItems)
|
||||
Stream<GtbAnag> tmpStream = Stream.of(mItems)
|
||||
.filter(x ->
|
||||
(currentDataDocPredicate == null || (currentDataDocPredicate.test(x)))
|
||||
);
|
||||
@ -171,7 +160,7 @@ public class DialogUltimeConsegneFiltroAvanzato {
|
||||
mFilteredItems = tmpStream.toList();
|
||||
}
|
||||
|
||||
return Stream.of(mFilteredItems).map(DocumentoResoDTO::getRagSoc).distinct().withoutNulls().toList();
|
||||
return Stream.of(mFilteredItems).map(x -> x.getCodAnag() + " - " + x.getRagSoc()).distinct().withoutNulls().toList();
|
||||
}
|
||||
|
||||
|
||||
@ -180,7 +169,7 @@ public class DialogUltimeConsegneFiltroAvanzato {
|
||||
if(currentRagSocPredicate == null && currentDataDocPredicate == null){
|
||||
mFilteredItems = mItems;
|
||||
} else {
|
||||
Stream<DocumentoResoDTO> tmpStream = Stream.of(mItems)
|
||||
Stream<GtbAnag> tmpStream = Stream.of(mItems)
|
||||
.filter(x ->
|
||||
(currentRagSocPredicate == null || (currentRagSocPredicate.test(x))) &&
|
||||
(currentDataDocPredicate== null || (currentDataDocPredicate.test(x)))
|
||||
|
||||
@ -8,6 +8,7 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.GtbAnag;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ISimpleOperationCallback;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
||||
@ -22,7 +23,27 @@ import it.integry.integrywmsnative.core.rest.model.DocumentoResoDTO;
|
||||
|
||||
public class UltimeConsegneClienteRESTConsumer {
|
||||
|
||||
public static void getUltimeConsegneClienti(String codMdep, String codAnag, String codMart, int limitConsegnePerCli, int limitDays, RunnableArgs<ArrayList<DocumentoResoDTO>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public static void getAvailableCodAnagClienti(RunnableArgs<List<GtbAnag>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
String sql = "SELECT DISTINCT gtb_anag.cod_anag, gtb_anag.rag_soc " +
|
||||
"FROM gtb_anag " +
|
||||
"INNER JOIN vtb_clie ON vtb_clie.cod_anag = gtb_anag.cod_anag " +
|
||||
"WHERE flag_stato = 'A'";
|
||||
|
||||
Type typeOfObjectsList = new TypeToken<ArrayList<GtbAnag>>() {}.getType();
|
||||
SystemRESTConsumer.processSql(sql, typeOfObjectsList, new ISimpleOperationCallback<ArrayList<GtbAnag>>() {
|
||||
@Override
|
||||
public void onSuccess(ArrayList<GtbAnag> value) {
|
||||
if(onComplete != null) onComplete.run(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed(Exception ex) {
|
||||
if(onFailed != null) onFailed.run(ex);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void getUltimeConsegneClienti(String codMdep, String codAnag, String codMart, Integer limitConsegnePerCli, int limitDays, RunnableArgs<ArrayList<DocumentoResoDTO>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
String sql = "SELECT consegne.*, " +
|
||||
" rag_soc," +
|
||||
|
||||
@ -7,12 +7,14 @@ import android.view.View;
|
||||
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import com.annimon.stream.Optional;
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.model.GtbAnag;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityProgress;
|
||||
@ -31,52 +33,36 @@ public class UltimeConsegneClienteViewModel {
|
||||
private List<DocumentoResoDTO> mItems;
|
||||
private List<DocumentoResoDTO> mRenderedItems = new ArrayList<>();
|
||||
|
||||
private List<GtbAnag> mAvailableGtbAnags = null;
|
||||
|
||||
private DialogUltimeConsegneFiltroAvanzato.DialogUltimeConsegneFiltroAvanzatoViewModel mAppliedFilterViewModel;
|
||||
|
||||
public UltimeConsegneClienteViewModel(Context context, FragmentMainUltimeConsegneClienteBinding binding) {
|
||||
this.mContext = context;
|
||||
this.mBinding = binding;
|
||||
|
||||
this.initList();
|
||||
|
||||
this.mBinding.mainFab.hide();
|
||||
this.mBinding.mainFab.setOnClickListener(v -> {
|
||||
dispatchConsegne();
|
||||
});
|
||||
|
||||
openFilterDialog();
|
||||
}
|
||||
|
||||
public void openFilterDialog() {
|
||||
DialogUltimeConsegneFiltroAvanzato.make(mContext, mItems, mAppliedFilterViewModel, (filteredOrderList, filter) -> {
|
||||
mAppliedFilterViewModel = filter;
|
||||
|
||||
if(filteredOrderList != null){
|
||||
|
||||
refreshItems(filteredOrderList);
|
||||
}
|
||||
|
||||
}).show();
|
||||
}
|
||||
|
||||
private void initList() {
|
||||
|
||||
Dialog progressDialog = UtilityProgress.createDefaultProgressDialog(mContext);
|
||||
|
||||
UltimeConsegneClienteRESTConsumer.getUltimeConsegneClienti(
|
||||
SettingsManager.i().userSession.depo.getCodMdep(),
|
||||
null,
|
||||
null,
|
||||
100,
|
||||
365,
|
||||
consegne -> {
|
||||
this.mItems = consegne;
|
||||
UltimeConsegneClienteRESTConsumer.getAvailableCodAnagClienti(gtbAnags -> {
|
||||
mAvailableGtbAnags = gtbAnags;
|
||||
progressDialog.dismiss();
|
||||
|
||||
this.initDataAdapter(consegne);
|
||||
refreshItems(consegne);
|
||||
|
||||
progressDialog.dismiss();
|
||||
}, ex -> {
|
||||
UtilityExceptions.defaultException(mContext, ex, progressDialog);
|
||||
});
|
||||
DialogUltimeConsegneFiltroAvanzato.make(mContext, gtbAnags, mAppliedFilterViewModel, (filter) -> {
|
||||
mAppliedFilterViewModel = filter;
|
||||
refreshItems();
|
||||
}).show();
|
||||
}, ex -> {
|
||||
UtilityExceptions.defaultException(mContext, ex, progressDialog);
|
||||
});
|
||||
}
|
||||
|
||||
private void initDataAdapter(ArrayList<DocumentoResoDTO> dataset) {
|
||||
@ -90,12 +76,43 @@ public class UltimeConsegneClienteViewModel {
|
||||
|
||||
}
|
||||
|
||||
private void refreshItems(List<DocumentoResoDTO> items){
|
||||
mBinding.emptyView.setVisibility((items != null && items.size() > 0) ? View.GONE : View.VISIBLE);
|
||||
private void refreshItems(){
|
||||
|
||||
mRenderedItems.clear();
|
||||
if(items != null) mRenderedItems.addAll(items);
|
||||
mAdapter.updateItems(mRenderedItems);
|
||||
Dialog progressDialog = UtilityProgress.createDefaultProgressDialog(mContext);
|
||||
|
||||
String currentAnagFilter = mAppliedFilterViewModel != null ? mAppliedFilterViewModel.ragSoc.get() : null;
|
||||
String currentCodAnagFilter = null;
|
||||
|
||||
Optional<GtbAnag> singleGtbAnag = Stream.of(mAvailableGtbAnags)
|
||||
.filter(x -> (x.getCodAnag() + " - " + x.getRagSoc()).equals(currentAnagFilter))
|
||||
.findSingle();
|
||||
|
||||
if(singleGtbAnag.isPresent()) {
|
||||
currentCodAnagFilter = singleGtbAnag.get().getCodAnag();
|
||||
}
|
||||
|
||||
UltimeConsegneClienteRESTConsumer.getUltimeConsegneClienti(
|
||||
SettingsManager.i().userSession.depo.getCodMdep(),
|
||||
currentCodAnagFilter,
|
||||
null,
|
||||
null,
|
||||
365,
|
||||
consegne -> {
|
||||
|
||||
this.mItems = consegne;
|
||||
|
||||
this.initDataAdapter(consegne);
|
||||
mBinding.emptyView.setVisibility((this.mItems != null && this.mItems.size() > 0) ? View.GONE : View.VISIBLE);
|
||||
|
||||
mRenderedItems.clear();
|
||||
if(this.mItems != null) mRenderedItems.addAll(this.mItems);
|
||||
mAdapter.updateItems(mRenderedItems);
|
||||
|
||||
progressDialog.dismiss();
|
||||
|
||||
}, ex -> {
|
||||
UtilityExceptions.defaultException(mContext, ex, progressDialog);
|
||||
});
|
||||
}
|
||||
|
||||
private void onSingleSelectionChanged(DocumentoResoDTO dto) {
|
||||
|
||||
@ -14,6 +14,7 @@ import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.annimon.stream.Optional;
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -21,6 +22,7 @@ import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.interfaces.IFilterableFragment;
|
||||
import it.integry.integrywmsnative.core.model.GtbAnag;
|
||||
import it.integry.integrywmsnative.core.rest.model.DocumentoResoDTO;
|
||||
import it.integry.integrywmsnative.core.interfaces.IScrollableFragment;
|
||||
import it.integry.integrywmsnative.core.interfaces.ITitledFragment;
|
||||
@ -30,6 +32,7 @@ import it.integry.integrywmsnative.core.utility.UtilityProgress;
|
||||
import it.integry.integrywmsnative.databinding.FragmentUltimiArriviFornitoreBinding;
|
||||
import it.integry.integrywmsnative.gest.picking_resi.PickingResiActivity;
|
||||
import it.integry.integrywmsnative.gest.ultimi_arrivi_fornitore.core.UltimiArriviFornitoreListAdapter;
|
||||
import it.integry.integrywmsnative.gest.ultimi_arrivi_fornitore.core.UltimiArriviFornitoreViewModel;
|
||||
import it.integry.integrywmsnative.gest.ultimi_arrivi_fornitore.dialog.DialogUltimiArriviFornitoreFiltroAvanzato;
|
||||
import it.integry.integrywmsnative.gest.ultimi_arrivi_fornitore.rest.UltimiArriviFornitoreRESTConsumer;
|
||||
import it.integry.integrywmsnative.ui.ElevatedToolbar;
|
||||
@ -42,14 +45,7 @@ public class UltimiArriviFornitoreFragment extends Fragment implements ITitledFr
|
||||
private Runnable mOnPreDestroy;
|
||||
private ElevatedToolbar mToolbar;
|
||||
|
||||
private FragmentUltimiArriviFornitoreBinding mBinding;
|
||||
|
||||
private List<DocumentoResoDTO> mItems;
|
||||
private List<DocumentoResoDTO> mRenderedItems = new ArrayList<>();
|
||||
|
||||
private UltimiArriviFornitoreListAdapter mAdapter;
|
||||
|
||||
private DialogUltimiArriviFornitoreFiltroAvanzato.DialogUltimiArriviFiltroAvanzatoViewModel mAppliedFilterViewModel;
|
||||
private UltimiArriviFornitoreViewModel mViewModel;
|
||||
|
||||
public UltimiArriviFornitoreFragment() {
|
||||
// Required empty public constructor
|
||||
@ -68,14 +64,14 @@ public class UltimiArriviFornitoreFragment extends Fragment implements ITitledFr
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
// Inflate the layout for this fragment
|
||||
mBinding = DataBindingUtil.inflate(LayoutInflater.from(getActivity()), R.layout.fragment_ultimi_arrivi_fornitore, container, false);
|
||||
FragmentUltimiArriviFornitoreBinding mBinding = DataBindingUtil.inflate(LayoutInflater.from(getActivity()), R.layout.fragment_ultimi_arrivi_fornitore, container, false);
|
||||
|
||||
mBinding.setViewmodel(this);
|
||||
mViewModel = new UltimiArriviFornitoreViewModel(getActivity(), mBinding);
|
||||
|
||||
mBinding.setViewmodel(mViewModel);
|
||||
|
||||
mToolbar.setRecyclerView(mBinding.recyclerView);
|
||||
|
||||
this.initView();
|
||||
|
||||
// Inflate the layout for this fragment
|
||||
return mBinding.getRoot();
|
||||
}
|
||||
@ -104,98 +100,11 @@ public class UltimiArriviFornitoreFragment extends Fragment implements ITitledFr
|
||||
|
||||
|
||||
|
||||
private void initView() {
|
||||
this.initList();
|
||||
|
||||
this.mBinding.mainFab.hide();
|
||||
this.mBinding.mainFab.setOnClickListener(v -> {
|
||||
dispatchConsegne();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void initList() {
|
||||
Dialog progressDialog = UtilityProgress.createDefaultProgressDialog(getActivity());
|
||||
|
||||
UltimiArriviFornitoreRESTConsumer.getUltimeConsegneFornitori(
|
||||
SettingsManager.i().userSession.depo.getCodMdep(),
|
||||
null,
|
||||
null,
|
||||
consegne -> {
|
||||
this.mItems = consegne;
|
||||
|
||||
this.initDataAdapter(consegne);
|
||||
refreshItems(consegne);
|
||||
|
||||
progressDialog.dismiss();
|
||||
}, ex -> {
|
||||
UtilityExceptions.defaultException(getActivity(), ex, progressDialog);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void initDataAdapter(ArrayList<DocumentoResoDTO> dataset) {
|
||||
mAdapter = new UltimiArriviFornitoreListAdapter(getActivity(), dataset);
|
||||
mAdapter.setOnSelectionChanged(this::onSingleSelectionChanged);
|
||||
|
||||
mBinding.recyclerView.setHasFixedSize(true);
|
||||
mBinding.recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
|
||||
mBinding.recyclerView.setAdapter(mAdapter);
|
||||
mBinding.fastscroll.setRecyclerView(mBinding.recyclerView);
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void onSingleSelectionChanged(DocumentoResoDTO dto) {
|
||||
List<DocumentoResoDTO> selectedOrders = getSelectedItems();
|
||||
|
||||
if(dto.isSelected()) {
|
||||
Stream.of(selectedOrders)
|
||||
.filter(x -> !x.getRagSoc().equalsIgnoreCase(dto.getRagSoc()))
|
||||
.forEach(x -> x.setSelected(false));
|
||||
}
|
||||
|
||||
if(selectedOrders != null && selectedOrders.size() > 0) {
|
||||
mBinding.mainFab.show();
|
||||
}
|
||||
else {
|
||||
mBinding.mainFab.hide();
|
||||
}
|
||||
}
|
||||
|
||||
private List<DocumentoResoDTO> getSelectedItems() {
|
||||
return Stream.of(this.mItems)
|
||||
.filter(DocumentoResoDTO::isSelected)
|
||||
.toList();
|
||||
}
|
||||
|
||||
|
||||
private void dispatchConsegne() {
|
||||
List<DocumentoResoDTO> selectedConsegne = getSelectedItems();
|
||||
|
||||
PickingResiActivity.startActivity(getActivity(), getText(R.string.ultime_arrivi_fornitore_title).toString(), selectedConsegne, -1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFilterClick() {
|
||||
DialogUltimiArriviFornitoreFiltroAvanzato.make(getActivity(), mItems, mAppliedFilterViewModel, (filteredOrderList, filter) -> {
|
||||
mAppliedFilterViewModel = filter;
|
||||
|
||||
if(filteredOrderList != null){
|
||||
|
||||
refreshItems(filteredOrderList);
|
||||
}
|
||||
|
||||
}).show();
|
||||
mViewModel.openFilterDialog();
|
||||
}
|
||||
|
||||
|
||||
private void refreshItems(List<DocumentoResoDTO> items){
|
||||
mBinding.emptyView.setVisibility((items != null && items.size() > 0) ? View.GONE : View.VISIBLE);
|
||||
|
||||
mRenderedItems.clear();
|
||||
if(items != null) mRenderedItems.addAll(items);
|
||||
mAdapter.updateItems(mRenderedItems);
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,154 @@
|
||||
package it.integry.integrywmsnative.gest.ultimi_arrivi_fornitore.core;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import com.annimon.stream.Optional;
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.model.GtbAnag;
|
||||
import it.integry.integrywmsnative.core.rest.model.DocumentoResoDTO;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityProgress;
|
||||
import it.integry.integrywmsnative.databinding.FragmentUltimiArriviFornitoreBinding;
|
||||
import it.integry.integrywmsnative.gest.picking_resi.PickingResiActivity;
|
||||
import it.integry.integrywmsnative.gest.ultimi_arrivi_fornitore.dialog.DialogUltimiArriviFornitoreFiltroAvanzato;
|
||||
import it.integry.integrywmsnative.gest.ultimi_arrivi_fornitore.rest.UltimiArriviFornitoreRESTConsumer;
|
||||
|
||||
public class UltimiArriviFornitoreViewModel {
|
||||
|
||||
private Context mContext;
|
||||
private FragmentUltimiArriviFornitoreBinding mBinding;
|
||||
|
||||
private List<DocumentoResoDTO> mItems;
|
||||
private List<DocumentoResoDTO> mRenderedItems = new ArrayList<>();
|
||||
|
||||
private List<GtbAnag> mAvailableGtbAnags = null;
|
||||
|
||||
private UltimiArriviFornitoreListAdapter mAdapter;
|
||||
|
||||
private DialogUltimiArriviFornitoreFiltroAvanzato.DialogUltimiArriviFiltroAvanzatoViewModel mAppliedFilterViewModel;
|
||||
|
||||
public UltimiArriviFornitoreViewModel(Context context, FragmentUltimiArriviFornitoreBinding binding) {
|
||||
this.mContext = context;
|
||||
this.mBinding = binding;
|
||||
|
||||
this.mBinding.mainFab.hide();
|
||||
this.mBinding.mainFab.setOnClickListener(v -> {
|
||||
dispatchConsegne();
|
||||
});
|
||||
|
||||
openFilterDialog();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void initDataAdapter(ArrayList<DocumentoResoDTO> dataset) {
|
||||
mAdapter = new UltimiArriviFornitoreListAdapter(mContext, dataset);
|
||||
mAdapter.setOnSelectionChanged(this::onSingleSelectionChanged);
|
||||
|
||||
mBinding.recyclerView.setHasFixedSize(true);
|
||||
mBinding.recyclerView.setLayoutManager(new LinearLayoutManager(mContext));
|
||||
mBinding.recyclerView.setAdapter(mAdapter);
|
||||
mBinding.fastscroll.setRecyclerView(mBinding.recyclerView);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void openFilterDialog() {
|
||||
Dialog progressDialog = UtilityProgress.createDefaultProgressDialog(mContext);
|
||||
|
||||
UltimiArriviFornitoreRESTConsumer.getAvailableCodAnagFornitori(gtbAnags -> {
|
||||
mAvailableGtbAnags = gtbAnags;
|
||||
progressDialog.dismiss();
|
||||
|
||||
DialogUltimiArriviFornitoreFiltroAvanzato.make(mContext, mAvailableGtbAnags, mAppliedFilterViewModel, (filter) -> {
|
||||
mAppliedFilterViewModel = filter;
|
||||
refreshItems();
|
||||
}).show();
|
||||
}, ex -> {
|
||||
UtilityExceptions.defaultException(mContext, ex, progressDialog);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private void dispatchConsegne() {
|
||||
List<DocumentoResoDTO> selectedConsegne = getSelectedItems();
|
||||
|
||||
PickingResiActivity.startActivity(mContext, mContext.getText(R.string.ultime_arrivi_fornitore_title).toString(), selectedConsegne, -1);
|
||||
}
|
||||
|
||||
private List<DocumentoResoDTO> getSelectedItems() {
|
||||
return Stream.of(this.mItems)
|
||||
.filter(DocumentoResoDTO::isSelected)
|
||||
.toList();
|
||||
}
|
||||
|
||||
|
||||
private void refreshItems(){
|
||||
|
||||
Dialog progressDialog = UtilityProgress.createDefaultProgressDialog(mContext);
|
||||
|
||||
String currentAnagFilter = mAppliedFilterViewModel != null ? mAppliedFilterViewModel.ragSoc.get() : null;
|
||||
String currentCodAnagFilter = null;
|
||||
|
||||
Optional<GtbAnag> singleGtbAnag = Stream.of(mAvailableGtbAnags)
|
||||
.filter(x -> (x.getCodAnag() + " - " + x.getRagSoc()).equals(currentAnagFilter))
|
||||
.findSingle();
|
||||
|
||||
if(singleGtbAnag.isPresent()) {
|
||||
currentCodAnagFilter = singleGtbAnag.get().getCodAnag();
|
||||
}
|
||||
|
||||
|
||||
UltimiArriviFornitoreRESTConsumer.getUltimeConsegneFornitori(
|
||||
SettingsManager.i().userSession.depo.getCodMdep(),
|
||||
currentCodAnagFilter,
|
||||
null,
|
||||
null,
|
||||
365,
|
||||
consegne -> {
|
||||
this.mItems = consegne;
|
||||
|
||||
this.initDataAdapter(consegne);
|
||||
|
||||
mBinding.emptyView.setVisibility((this.mItems != null && this.mItems.size() > 0) ? View.GONE : View.VISIBLE);
|
||||
|
||||
mRenderedItems.clear();
|
||||
if(this.mItems != null) mRenderedItems.addAll(this.mItems);
|
||||
mAdapter.updateItems(mRenderedItems);
|
||||
|
||||
progressDialog.dismiss();
|
||||
}, ex -> {
|
||||
UtilityExceptions.defaultException(mContext, ex, progressDialog);
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void onSingleSelectionChanged(DocumentoResoDTO dto) {
|
||||
List<DocumentoResoDTO> selectedOrders = getSelectedItems();
|
||||
|
||||
if(dto.isSelected()) {
|
||||
Stream.of(selectedOrders)
|
||||
.filter(x -> !x.getRagSoc().equalsIgnoreCase(dto.getRagSoc()))
|
||||
.forEach(x -> x.setSelected(false));
|
||||
}
|
||||
|
||||
if(selectedOrders != null && selectedOrders.size() > 0) {
|
||||
mBinding.mainFab.show();
|
||||
}
|
||||
else {
|
||||
mBinding.mainFab.hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -21,7 +21,9 @@ import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.di.BindableString;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgss;
|
||||
import it.integry.integrywmsnative.core.model.GtbAnag;
|
||||
import it.integry.integrywmsnative.core.rest.model.DocumentoResoDTO;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
@ -34,29 +36,29 @@ public class DialogUltimiArriviFornitoreFiltroAvanzato {
|
||||
private AlertDialog mAlert;
|
||||
private Context mContext;
|
||||
private DialogUltimiArriviFiltroAvanzatoViewModel mBaseViewModel;
|
||||
private RunnableArgss<List<DocumentoResoDTO>, DialogUltimiArriviFiltroAvanzatoViewModel> mOnDismiss;
|
||||
private RunnableArgs<DialogUltimiArriviFiltroAvanzatoViewModel> mOnDismiss;
|
||||
|
||||
|
||||
|
||||
private ArrayAdapter<String> arrayAdapterRagSoc;
|
||||
|
||||
private List<DocumentoResoDTO> mItems;
|
||||
private List<DocumentoResoDTO> mFilteredItems;
|
||||
private List<GtbAnag> mItems;
|
||||
private List<GtbAnag> mFilteredItems;
|
||||
|
||||
private Predicate<DocumentoResoDTO> currentRagSocPredicate = null;
|
||||
private Predicate<DocumentoResoDTO> currentDataDocPredicate = null;
|
||||
private Predicate<GtbAnag> currentRagSocPredicate = null;
|
||||
private Predicate<GtbAnag> currentDataDocPredicate = null;
|
||||
|
||||
public static AlertDialog make(final Context context,
|
||||
final List<DocumentoResoDTO> items,
|
||||
final List<GtbAnag> items,
|
||||
DialogUltimiArriviFiltroAvanzatoViewModel baseViewModel,
|
||||
RunnableArgss<List<DocumentoResoDTO>, DialogUltimiArriviFiltroAvanzatoViewModel> onDismiss) {
|
||||
RunnableArgs<DialogUltimiArriviFiltroAvanzatoViewModel> onDismiss) {
|
||||
return new DialogUltimiArriviFornitoreFiltroAvanzato(context, items, baseViewModel, onDismiss).mAlert;
|
||||
}
|
||||
|
||||
public DialogUltimiArriviFornitoreFiltroAvanzato(final Context context,
|
||||
final List<DocumentoResoDTO> items,
|
||||
final List<GtbAnag> items,
|
||||
DialogUltimiArriviFiltroAvanzatoViewModel baseViewModel,
|
||||
RunnableArgss<List<DocumentoResoDTO>, DialogUltimiArriviFiltroAvanzatoViewModel> onDismiss) {
|
||||
RunnableArgs<DialogUltimiArriviFiltroAvanzatoViewModel> onDismiss) {
|
||||
mContext = context;
|
||||
mItems = items;
|
||||
mBaseViewModel = baseViewModel;
|
||||
@ -90,7 +92,7 @@ public class DialogUltimiArriviFornitoreFiltroAvanzato {
|
||||
|
||||
|
||||
mAlert.setOnDismissListener(dialogInterface -> {
|
||||
if(mOnDismiss != null) mOnDismiss.run(mFilteredItems, viewModel);
|
||||
if(mOnDismiss != null) mOnDismiss.run(viewModel);
|
||||
});
|
||||
|
||||
refreshList();
|
||||
@ -145,26 +147,13 @@ public class DialogUltimiArriviFornitoreFiltroAvanzato {
|
||||
|
||||
refreshList();
|
||||
});
|
||||
|
||||
BindableString.resetListeners(viewModel.dataDoc);
|
||||
BindableString.registerListener(viewModel.dataDoc, value -> {
|
||||
if (UtilityString.isNullOrEmpty(value)) currentDataDocPredicate = null;
|
||||
else {
|
||||
currentDataDocPredicate = o -> o.getDataDocD().equals(viewModel.dataDocDate);
|
||||
}
|
||||
|
||||
refreshList();
|
||||
|
||||
arrayAdapterRagSoc.clear();
|
||||
arrayAdapterRagSoc.addAll(getAvailableRagSocs(true));
|
||||
});
|
||||
}
|
||||
|
||||
private List<String> getAvailableRagSocs(boolean skipRecalc) {
|
||||
if(currentDataDocPredicate == null){
|
||||
mFilteredItems = mItems;
|
||||
} else if(!skipRecalc){
|
||||
Stream<DocumentoResoDTO> tmpStream = Stream.of(mItems)
|
||||
Stream<GtbAnag> tmpStream = Stream.of(mItems)
|
||||
.filter(x ->
|
||||
(currentDataDocPredicate == null || (currentDataDocPredicate.test(x)))
|
||||
);
|
||||
@ -172,7 +161,7 @@ public class DialogUltimiArriviFornitoreFiltroAvanzato {
|
||||
mFilteredItems = tmpStream.toList();
|
||||
}
|
||||
|
||||
return Stream.of(mFilteredItems).map(DocumentoResoDTO::getRagSoc).distinct().withoutNulls().toList();
|
||||
return Stream.of(mFilteredItems).map(x -> x.getCodAnag() + " - " + x.getRagSoc()).distinct().withoutNulls().toList();
|
||||
}
|
||||
|
||||
|
||||
@ -181,7 +170,7 @@ public class DialogUltimiArriviFornitoreFiltroAvanzato {
|
||||
if(currentRagSocPredicate == null && currentDataDocPredicate == null){
|
||||
mFilteredItems = mItems;
|
||||
} else {
|
||||
Stream<DocumentoResoDTO> tmpStream = Stream.of(mItems)
|
||||
Stream<GtbAnag> tmpStream = Stream.of(mItems)
|
||||
.filter(x ->
|
||||
(currentRagSocPredicate == null || (currentRagSocPredicate.test(x))) &&
|
||||
(currentDataDocPredicate== null || (currentDataDocPredicate.test(x)))
|
||||
|
||||
@ -4,7 +4,9 @@ import com.google.gson.reflect.TypeToken;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.GtbAnag;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ISimpleOperationCallback;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
@ -13,19 +15,37 @@ import it.integry.integrywmsnative.core.rest.model.DocumentoResoDTO;
|
||||
|
||||
public class UltimiArriviFornitoreRESTConsumer {
|
||||
|
||||
public static void getUltimeConsegneFornitori(String codMdep, String codAnag, String codMart, RunnableArgs<ArrayList<DocumentoResoDTO>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public static void getAvailableCodAnagFornitori(RunnableArgs<List<GtbAnag>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
String sql = "SELECT DISTINCT gtb_anag.cod_anag, gtb_anag.rag_soc " +
|
||||
"FROM gtb_anag " +
|
||||
"INNER JOIN atb_forn ON atb_forn.cod_anag = gtb_anag.cod_anag " +
|
||||
"WHERE flag_stato = 'A'";
|
||||
|
||||
Type typeOfObjectsList = new TypeToken<ArrayList<GtbAnag>>() {}.getType();
|
||||
SystemRESTConsumer.processSql(sql, typeOfObjectsList, new ISimpleOperationCallback<ArrayList<GtbAnag>>() {
|
||||
@Override
|
||||
public void onSuccess(ArrayList<GtbAnag> value) {
|
||||
if(onComplete != null) onComplete.run(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed(Exception ex) {
|
||||
if(onFailed != null) onFailed.run(ex);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void getUltimeConsegneFornitori(String codMdep, String codAnag, String codMart, Integer limitConsegnePerCli, int limitDays, RunnableArgs<ArrayList<DocumentoResoDTO>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
int numberOfConsegnePerForn = 100;
|
||||
int numberOfDayToAnalyze = 365;
|
||||
|
||||
String sql = "SELECT consegne.*, " +
|
||||
" rag_soc " +
|
||||
"FROM WMS_GetUltimeConsegneFornitori(" +
|
||||
UtilityDB.valueToString(numberOfConsegnePerForn) + ", " +
|
||||
UtilityDB.valueToString(limitConsegnePerCli) + ", " +
|
||||
UtilityDB.valueToString(codAnag) + ", " +
|
||||
UtilityDB.valueToString(codMart) + ", " +
|
||||
UtilityDB.valueToString(codMdep) + ", " +
|
||||
UtilityDB.valueToString(numberOfDayToAnalyze) + ") consegne " +
|
||||
UtilityDB.valueToString(limitDays) + ") consegne " +
|
||||
"LEFT OUTER JOIN gtb_anag ON consegne.cod_anag = gtb_anag.cod_anag " +
|
||||
"ORDER BY rag_soc, " +
|
||||
" counter_consegna ";
|
||||
|
||||
@ -432,7 +432,7 @@ public class PickingObjectDTO {
|
||||
}
|
||||
|
||||
|
||||
if(mtbPartitaMag.getPartitaMag() != null && mtbPartitaMag.getDataScadD() != null) {
|
||||
if(!UtilityString.isNullOrEmpty(mtbPartitaMag.getPartitaMag())) {
|
||||
pickData.setMtbPartitaMag(mtbPartitaMag);
|
||||
}
|
||||
|
||||
|
||||
@ -98,6 +98,10 @@ public class DialogChooseArtsFromListaArts {
|
||||
mDialog.setCanceledOnTouchOutside(false);
|
||||
mDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||
|
||||
mDialog.setOnCancelListener(dialog -> {
|
||||
if(this.mOnAbort != null) this.mOnAbort.run();
|
||||
});
|
||||
|
||||
UtilityDialog.setTo90PercentSize(context, mDialog);
|
||||
|
||||
|
||||
@ -137,8 +141,6 @@ public class DialogChooseArtsFromListaArts {
|
||||
}
|
||||
|
||||
private void setupBarcode() {
|
||||
|
||||
final boolean prevBarcodeStatus = BarcodeManager.isEnabled();
|
||||
BarcodeManager.enable();
|
||||
|
||||
int barcodeIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
||||
@ -147,8 +149,6 @@ public class DialogChooseArtsFromListaArts {
|
||||
|
||||
mDialog.setOnDismissListener(dialog -> {
|
||||
BarcodeManager.removeCallback(barcodeIstanceID);
|
||||
// if(prevBarcodeStatus) BarcodeManager.enable();
|
||||
// else BarcodeManager.disable();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@ -11,6 +11,7 @@ import android.view.LayoutInflater;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.expansion.BaseDialog;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.model.Ean128Model;
|
||||
@ -32,7 +33,7 @@ import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
||||
public class DialogScanArt {
|
||||
|
||||
private Context mContext;
|
||||
private Dialog mDialog;
|
||||
private BaseDialog mDialog;
|
||||
|
||||
private RunnableArgsss<DialogConsts.Results, MtbAart, Ean128Model> mOnItemChoosed;
|
||||
|
||||
@ -48,7 +49,7 @@ public class DialogScanArt {
|
||||
LayoutInflater inflater = (LayoutInflater) context.getSystemService( Context.LAYOUT_INFLATER_SERVICE );
|
||||
DialogScanArtBinding bindings = DataBindingUtil.inflate(inflater, R.layout.dialog_scan_art, null, false);
|
||||
|
||||
mDialog = new Dialog(context);
|
||||
mDialog = new BaseDialog(context);
|
||||
|
||||
mDialog.setContentView(bindings.getRoot());
|
||||
|
||||
@ -73,6 +74,7 @@ public class DialogScanArt {
|
||||
.setOnScanSuccessfull(onScanSuccessfull)
|
||||
.setOnScanFailed(ex -> UtilityExceptions.defaultException(context, ex, false)));
|
||||
|
||||
mDialog.setBarcodeListener(true);
|
||||
mDialog.setOnDismissListener(dialog -> {
|
||||
BarcodeManager.removeCallback(barcodeIstanceID);
|
||||
BarcodeManager.enable();
|
||||
|
||||
@ -20,37 +20,29 @@
|
||||
app:cardCornerRadius="12dp"
|
||||
app:cardElevation="0dp">
|
||||
|
||||
<LinearLayout
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<!--<RelativeLayout-->
|
||||
<!--android:id="@+id/title_container"-->
|
||||
<!--android:layout_width="match_parent"-->
|
||||
<!--android:layout_height="wrap_content"-->
|
||||
<!--android:background="@color/light_blue_300"-->
|
||||
<!--android:gravity="center_horizontal">-->
|
||||
|
||||
<!--<androidx.appcompat.widget.AppCompatImageView-->
|
||||
<!--android:id="@+id/title_icon"-->
|
||||
<!--android:layout_width="wrap_content"-->
|
||||
<!--android:layout_height="wrap_content"-->
|
||||
<!--android:src="@drawable/ic_error_white_24dp"-->
|
||||
<!--android:layout_margin="24dp"/>-->
|
||||
|
||||
<!--</RelativeLayout>-->
|
||||
|
||||
|
||||
|
||||
<LinearLayout
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="24dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingEnd="8dp">
|
||||
android:paddingEnd="8dp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/buttons"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHeight_default="wrap"
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintStart_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title_text"
|
||||
@ -58,7 +50,10 @@
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/TextViewMaterial.DialogTitle"
|
||||
android:text="@string/dialog_choose_arts_from_lista_art"
|
||||
android:gravity="center_horizontal"/>
|
||||
android:gravity="center_horizontal"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"/>
|
||||
|
||||
|
||||
|
||||
@ -73,20 +68,25 @@
|
||||
app:strokeColor="@color/red_400"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:visibility="@{filterStatus.get() ? View.VISIBLE : View.GONE}"
|
||||
android:text="@string/remove_filter_button"/>
|
||||
android:text="@string/remove_filter_button"
|
||||
app:layout_constraintTop_toBottomOf="@id/title_text"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"/>
|
||||
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp">
|
||||
android:layout_marginTop="8dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/button_remove_filter"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent">
|
||||
|
||||
<LinearLayout
|
||||
<RelativeLayout
|
||||
android:id="@+id/empty_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center"
|
||||
android:padding="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
@ -101,7 +101,7 @@
|
||||
android:gravity="center"
|
||||
android:textColor="@color/empty_view_gray"/>
|
||||
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/dialog_choose_arts_from_lista_art__main_list"
|
||||
@ -112,7 +112,7 @@
|
||||
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
@ -122,7 +122,12 @@
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginStart="4dp"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:paddingBottom="8dp">
|
||||
android:paddingBottom="8dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent">
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/center_guideline"
|
||||
@ -162,7 +167,7 @@
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
<data>
|
||||
<variable
|
||||
name="viewmodel"
|
||||
type="it.integry.integrywmsnative.gest.ultimi_arrivi_fornitore.UltimiArriviFornitoreFragment" />
|
||||
type="it.integry.integrywmsnative.gest.ultimi_arrivi_fornitore.core.UltimiArriviFornitoreViewModel" />
|
||||
</data>
|
||||
|
||||
|
||||
|
||||
@ -110,6 +110,15 @@ public class KeyboardEmulatorBarcodeReader implements BarcodeReaderInterface {
|
||||
} catch (WrongFormatException e) {
|
||||
return BarcodeType.CODE128;
|
||||
}
|
||||
} else if (barcode.length() == 14) {
|
||||
try {
|
||||
int checksum = getEanChecksum(barcode);
|
||||
if (checksum == Integer.parseInt(barcode.substring(13))){
|
||||
return BarcodeType.INTERLEAVED_2OF5;
|
||||
}
|
||||
} catch (WrongFormatException e) {
|
||||
return BarcodeType.CODE128;
|
||||
}
|
||||
}
|
||||
return BarcodeType.CODE128;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user