Finish v1.30.10(328)
This commit is contained in:
commit
a1c8a52dd2
@ -10,8 +10,8 @@ apply plugin: 'com.google.gms.google-services'
|
|||||||
|
|
||||||
android {
|
android {
|
||||||
|
|
||||||
def appVersionCode = 327
|
def appVersionCode = 328
|
||||||
def appVersionName = '1.30.09'
|
def appVersionName = '1.30.10'
|
||||||
|
|
||||||
signingConfigs {
|
signingConfigs {
|
||||||
release {
|
release {
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package it.integry.integrywmsnative.core.expansion;
|
package it.integry.integrywmsnative.core.expansion;
|
||||||
|
|
||||||
|
import android.content.DialogInterface;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
@ -18,7 +19,7 @@ import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
|||||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||||
import it.integry.integrywmsnative.view.dialogs.DialogProgressView;
|
import it.integry.integrywmsnative.view.dialogs.DialogProgressView;
|
||||||
|
|
||||||
public class BaseDialogFragment extends DialogFragment {
|
public class BaseDialogFragment extends DialogFragment implements DialogInterface.OnShowListener {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public DialogProgressView mCurrentProgress;
|
public DialogProgressView mCurrentProgress;
|
||||||
@ -41,20 +42,7 @@ public class BaseDialogFragment extends DialogFragment {
|
|||||||
@Override
|
@Override
|
||||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||||
super.onViewCreated(view, savedInstanceState);
|
super.onViewCreated(view, savedInstanceState);
|
||||||
|
this.initialize();
|
||||||
MainApplication.appComponent
|
|
||||||
.baseDialogFragmentComponent()
|
|
||||||
.create()
|
|
||||||
.inject(this);
|
|
||||||
|
|
||||||
if (BarcodeManager.isEnabled() && BarcodeManager.isKeyboardEmulator()) {
|
|
||||||
getDialog().setOnKeyListener((dialog, keyCode, event) -> {
|
|
||||||
if (mBarcodeListener && (event.getAction() == KeyEvent.ACTION_DOWN || event.getAction() == KeyEvent.ACTION_MULTIPLE) && !isControlKey(event)) {
|
|
||||||
return BarcodeManager.onKeyDown(event.getKeyCode(), event);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onLoadingStarted() {
|
public void onLoadingStarted() {
|
||||||
@ -107,4 +95,24 @@ public class BaseDialogFragment extends DialogFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onShow(DialogInterface dialogInterface) {
|
||||||
|
this.initialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initialize() {
|
||||||
|
MainApplication.appComponent
|
||||||
|
.baseDialogFragmentComponent()
|
||||||
|
.create()
|
||||||
|
.inject(this);
|
||||||
|
|
||||||
|
if (BarcodeManager.isEnabled() && BarcodeManager.isKeyboardEmulator() && getDialog() != null) {
|
||||||
|
getDialog().setOnKeyListener((dialog, keyCode, event) -> {
|
||||||
|
if (mBarcodeListener && (event.getAction() == KeyEvent.ACTION_DOWN || event.getAction() == KeyEvent.ACTION_MULTIPLE) && !isControlKey(event)) {
|
||||||
|
return BarcodeManager.onKeyDown(event.getKeyCode(), event);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,6 @@
|
|||||||
|
package it.integry.integrywmsnative.core.expansion;
|
||||||
|
|
||||||
|
public interface RunnableArgsssss<S, T, U, V, X> {
|
||||||
|
|
||||||
|
void run(S data1, T data2, U data3, V data4, X data5);
|
||||||
|
}
|
||||||
@ -82,6 +82,7 @@ public class DialogAskInfoInventarioView extends BaseDialogFragment {
|
|||||||
.create();
|
.create();
|
||||||
|
|
||||||
alertDialog.setCanceledOnTouchOutside(cancelable);
|
alertDialog.setCanceledOnTouchOutside(cancelable);
|
||||||
|
alertDialog.setOnShowListener(this);
|
||||||
return alertDialog;
|
return alertDialog;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -12,6 +12,7 @@ import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.FilterPaese
|
|||||||
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.FilterTermConsLayoutView;
|
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.FilterTermConsLayoutView;
|
||||||
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.FilterVettoreLayoutView;
|
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.FilterVettoreLayoutView;
|
||||||
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.FilterViaggioLayoutView;
|
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.FilterViaggioLayoutView;
|
||||||
|
import it.integry.integrywmsnative.gest.prod_accettazione_ord_produzione.filters.FilterCommessaLayoutView;
|
||||||
import it.integry.integrywmsnative.ui.filter_chips.FilterChipDTO;
|
import it.integry.integrywmsnative.ui.filter_chips.FilterChipDTO;
|
||||||
|
|
||||||
public class OrdiniUscitaElencoBindings {
|
public class OrdiniUscitaElencoBindings {
|
||||||
@ -28,6 +29,7 @@ public class OrdiniUscitaElencoBindings {
|
|||||||
public static final int TERM_CONS_FILTER_ID = 8;
|
public static final int TERM_CONS_FILTER_ID = 8;
|
||||||
public static final int DATA_CONS_FILTER_ID = 9;
|
public static final int DATA_CONS_FILTER_ID = 9;
|
||||||
public static final int GRUPPO_MERC_FILTER_ID = 10;
|
public static final int GRUPPO_MERC_FILTER_ID = 10;
|
||||||
|
public static final int COMMESSA_FILTER_ID = 11;
|
||||||
|
|
||||||
public static final HashMap<Integer, FilterChipDTO> AVAILABLE_FILTERS = new HashMap<>() {{
|
public static final HashMap<Integer, FilterChipDTO> AVAILABLE_FILTERS = new HashMap<>() {{
|
||||||
put(DEPOSITO_FILTER_ID, new FilterChipDTO()
|
put(DEPOSITO_FILTER_ID, new FilterChipDTO()
|
||||||
@ -94,6 +96,12 @@ public class OrdiniUscitaElencoBindings {
|
|||||||
.setPosizione(7)
|
.setPosizione(7)
|
||||||
.setFilterChipText("Gruppo merceologico")
|
.setFilterChipText("Gruppo merceologico")
|
||||||
.setFilterLayoutView(new FilterGruppoMercLayoutView()));
|
.setFilterLayoutView(new FilterGruppoMercLayoutView()));
|
||||||
|
|
||||||
|
put(COMMESSA_FILTER_ID, new FilterChipDTO()
|
||||||
|
.setID(COMMESSA_FILTER_ID)
|
||||||
|
.setPosizione(11)
|
||||||
|
.setFilterChipText("Commessa")
|
||||||
|
.setFilterLayoutView(new FilterCommessaLayoutView()));
|
||||||
}};
|
}};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -38,6 +38,7 @@ import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
|||||||
import it.integry.integrywmsnative.core.interfaces.IScrollableFragment;
|
import it.integry.integrywmsnative.core.interfaces.IScrollableFragment;
|
||||||
import it.integry.integrywmsnative.core.interfaces.ISelectAllFragment;
|
import it.integry.integrywmsnative.core.interfaces.ISelectAllFragment;
|
||||||
import it.integry.integrywmsnative.core.interfaces.ITitledFragment;
|
import it.integry.integrywmsnative.core.interfaces.ITitledFragment;
|
||||||
|
import it.integry.integrywmsnative.core.model.JtbComt;
|
||||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||||
import it.integry.integrywmsnative.core.model.MtbDepo;
|
import it.integry.integrywmsnative.core.model.MtbDepo;
|
||||||
@ -45,6 +46,7 @@ import it.integry.integrywmsnative.core.model.MtbGrup;
|
|||||||
import it.integry.integrywmsnative.core.model.OrdineInevasoDTO;
|
import it.integry.integrywmsnative.core.model.OrdineInevasoDTO;
|
||||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||||
|
import it.integry.integrywmsnative.core.rest.consumers.CommessaRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.DepositoRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.DepositoRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.model.OrdineUscitaInevasoDTO;
|
import it.integry.integrywmsnative.core.rest.model.OrdineUscitaInevasoDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.SitArtOrdDTO;
|
import it.integry.integrywmsnative.core.rest.model.SitArtOrdDTO;
|
||||||
@ -66,6 +68,7 @@ import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.FilterViagg
|
|||||||
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.VenditaFiltroOrdiniViewModel;
|
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.VenditaFiltroOrdiniViewModel;
|
||||||
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.ui.OrdiniUscitaElencoAdapter;
|
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.ui.OrdiniUscitaElencoAdapter;
|
||||||
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.ui.OrdiniUscitaElencoListModel;
|
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.ui.OrdiniUscitaElencoListModel;
|
||||||
|
import it.integry.integrywmsnative.gest.prod_accettazione_ord_produzione.filters.FilterCommessaLayoutView;
|
||||||
import it.integry.integrywmsnative.gest.spedizione.SpedizioneActivity;
|
import it.integry.integrywmsnative.gest.spedizione.SpedizioneActivity;
|
||||||
import it.integry.integrywmsnative.gest.spedizione.dialogs.row_info.BaseDialogRowInfoView;
|
import it.integry.integrywmsnative.gest.spedizione.dialogs.row_info.BaseDialogRowInfoView;
|
||||||
import it.integry.integrywmsnative.ui.ElevatedToolbar;
|
import it.integry.integrywmsnative.ui.ElevatedToolbar;
|
||||||
@ -83,6 +86,9 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
|
|||||||
@Inject
|
@Inject
|
||||||
ArticoloRESTConsumer mArticoloRESTConsumer;
|
ArticoloRESTConsumer mArticoloRESTConsumer;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
CommessaRESTConsumer mCommessaRESTConsumer;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
OrdiniUscitaElencoViewModel mViewModel;
|
OrdiniUscitaElencoViewModel mViewModel;
|
||||||
|
|
||||||
@ -104,6 +110,7 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
|
|||||||
|
|
||||||
private List<MtbDepo> mtbDepoCache;
|
private List<MtbDepo> mtbDepoCache;
|
||||||
private List<MtbGrup> mtbGrupCache;
|
private List<MtbGrup> mtbGrupCache;
|
||||||
|
private List<JtbComt> jtbComtCache;
|
||||||
|
|
||||||
public OrdiniUscitaElencoFragment() {
|
public OrdiniUscitaElencoFragment() {
|
||||||
// Required empty public constructor
|
// Required empty public constructor
|
||||||
@ -193,7 +200,9 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
|
|||||||
|
|
||||||
this.mViewModel.getOrderList().observe(getViewLifecycleOwner(), v -> {
|
this.mViewModel.getOrderList().observe(getViewLifecycleOwner(), v -> {
|
||||||
this.onLoadingStarted();
|
this.onLoadingStarted();
|
||||||
this.initMtbGrupsCache(this::onLoadingEnded);
|
this.initMtbGrupsCache(() -> {
|
||||||
|
this.initJtbComtCache(this::onLoadingEnded);
|
||||||
|
});
|
||||||
|
|
||||||
mAppliedFilterViewModel.init(mViewModel.getOrderList().getValue());
|
mAppliedFilterViewModel.init(mViewModel.getOrderList().getValue());
|
||||||
|
|
||||||
@ -265,6 +274,7 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
|
|||||||
mAppliedFilterViewModel.getCurrentTermConsPredicate().addOnPropertyChangedCallback(onPredicateChanged);
|
mAppliedFilterViewModel.getCurrentTermConsPredicate().addOnPropertyChangedCallback(onPredicateChanged);
|
||||||
mAppliedFilterViewModel.getCurrentDataConsPredicate().addOnPropertyChangedCallback(onPredicateChanged);
|
mAppliedFilterViewModel.getCurrentDataConsPredicate().addOnPropertyChangedCallback(onPredicateChanged);
|
||||||
mAppliedFilterViewModel.getCurrentGruppoMercPredicate().addOnPropertyChangedCallback(onPredicateChanged);
|
mAppliedFilterViewModel.getCurrentGruppoMercPredicate().addOnPropertyChangedCallback(onPredicateChanged);
|
||||||
|
mAppliedFilterViewModel.getCurrentCommessaPredicate().addOnPropertyChangedCallback(onPredicateChanged);
|
||||||
|
|
||||||
List<FilterChipDTO> filterList = Stream.of(OrdiniUscitaElencoBindings.AVAILABLE_FILTERS.entrySet())
|
List<FilterChipDTO> filterList = Stream.of(OrdiniUscitaElencoBindings.AVAILABLE_FILTERS.entrySet())
|
||||||
.map(Map.Entry::getValue)
|
.map(Map.Entry::getValue)
|
||||||
@ -527,6 +537,31 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
|
|||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case OrdiniUscitaElencoBindings.COMMESSA_FILTER_ID:
|
||||||
|
mAppliedFilterViewModel.getCurrentCommessaPredicate().addOnPropertyChangedCallback(new OnGeneralChangedCallback() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (mAppliedFilterViewModel.getCurrentCommessaPredicate().get() == null) {
|
||||||
|
filterChipView.disableCloseIcon();
|
||||||
|
|
||||||
|
mBindings.filterChipsGroup.removeView(filterChipView);
|
||||||
|
mBindings.filterChipsGroup.addView(filterChipView);
|
||||||
|
mBindings.filterChips.smoothScrollTo(0, 0);
|
||||||
|
} else {
|
||||||
|
filterChipView.enableCloseIcon();
|
||||||
|
|
||||||
|
mBindings.filterChipsGroup.removeView(filterChipView);
|
||||||
|
mBindings.filterChipsGroup.addView(filterChipView, 0);
|
||||||
|
mBindings.filterChips.smoothScrollTo(0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
filterChipView.setOnResetClicked(() -> {
|
||||||
|
mAppliedFilterViewModel.setCommessaFilter(null);
|
||||||
|
mAppliedFilterViewModel.getCurrentCommessaPredicate().set(null);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.mBindings.filterChipsGroup.addView(filterChipView);
|
this.mBindings.filterChipsGroup.addView(filterChipView);
|
||||||
@ -559,6 +594,19 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
|
|||||||
.getFilterLayoutView();
|
.getFilterLayoutView();
|
||||||
|
|
||||||
switch (filterChipDTO.getID()) {
|
switch (filterChipDTO.getID()) {
|
||||||
|
case OrdiniUscitaElencoBindings.COMMESSA_FILTER_ID:
|
||||||
|
((FilterCommessaLayoutView) filterLayoutView)
|
||||||
|
.setAllCommesse(mAppliedFilterViewModel.getAllCommesse(this.jtbComtCache))
|
||||||
|
.setAvailableCommesse(mAppliedFilterViewModel.getAvailableCommesse(this.jtbComtCache))
|
||||||
|
.setOnFilterApplied(mAppliedFilterViewModel::setCommessaFilter)
|
||||||
|
.setPreSelectedCommesse(Stream.of(Objects.requireNonNull(mViewModel.getOrderList().getValue()))
|
||||||
|
.filter(mAppliedFilterViewModel.getCurrentCommessaPredicate().get() == null ?
|
||||||
|
x -> false :
|
||||||
|
mAppliedFilterViewModel.getCurrentCommessaPredicate().get())
|
||||||
|
.map(x -> Stream.of(jtbComtCache).filter(y -> x.getCodJcom().equalsIgnoreCase(y.getCodJcom())).findFirst().get())
|
||||||
|
.toList());
|
||||||
|
break;
|
||||||
|
|
||||||
case OrdiniUscitaElencoBindings.DEPOSITO_FILTER_ID:
|
case OrdiniUscitaElencoBindings.DEPOSITO_FILTER_ID:
|
||||||
((FilterDepositoLayoutView) filterLayoutView)
|
((FilterDepositoLayoutView) filterLayoutView)
|
||||||
.setAllCodMdeps(mAppliedFilterViewModel.getAllCodMdeps(mtbDepoCache))
|
.setAllCodMdeps(mAppliedFilterViewModel.getAllCodMdeps(mtbDepoCache))
|
||||||
@ -865,4 +913,23 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
|
|||||||
onComplete.run();
|
onComplete.run();
|
||||||
}, this::onError);
|
}, this::onError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void initJtbComtCache(Runnable onComplete) {
|
||||||
|
if (this.mViewModel.getOrderList().getValue() == null) {
|
||||||
|
this.jtbComtCache = new ArrayList<>();
|
||||||
|
onComplete.run();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var jtbComts = Stream.of(Objects.requireNonNull(this.mViewModel.getOrderList().getValue()))
|
||||||
|
.flatMap(x -> Stream.of(x.getCodJcom()))
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
this.mCommessaRESTConsumer.getJtbComts(jtbComts, jtbComtCache -> {
|
||||||
|
this.jtbComtCache = jtbComtCache;
|
||||||
|
onComplete.run();
|
||||||
|
}, this::onError);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,6 +13,7 @@ import java.util.Date;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.model.JtbComt;
|
||||||
import it.integry.integrywmsnative.core.model.MtbDepo;
|
import it.integry.integrywmsnative.core.model.MtbDepo;
|
||||||
import it.integry.integrywmsnative.core.model.MtbGrup;
|
import it.integry.integrywmsnative.core.model.MtbGrup;
|
||||||
import it.integry.integrywmsnative.core.model.OrdineInevasoDTO;
|
import it.integry.integrywmsnative.core.model.OrdineInevasoDTO;
|
||||||
@ -33,6 +34,7 @@ public class VenditaFiltroOrdiniViewModel {
|
|||||||
private final ObservableField<Predicate<OrdiniUscitaElencoDTO>> currentAutomezzoPredicate = new ObservableField<>();
|
private final ObservableField<Predicate<OrdiniUscitaElencoDTO>> currentAutomezzoPredicate = new ObservableField<>();
|
||||||
private final ObservableField<Predicate<OrdiniUscitaElencoDTO>> currentPaesePredicate = new ObservableField<>();
|
private final ObservableField<Predicate<OrdiniUscitaElencoDTO>> currentPaesePredicate = new ObservableField<>();
|
||||||
private final ObservableField<Predicate<OrdiniUscitaElencoDTO>> currentGruppoMercPredicate = new ObservableField<>();
|
private final ObservableField<Predicate<OrdiniUscitaElencoDTO>> currentGruppoMercPredicate = new ObservableField<>();
|
||||||
|
private final ObservableField<Predicate<OrdiniUscitaElencoDTO>> currentCommessaPredicate = new ObservableField<>();
|
||||||
|
|
||||||
private Date selectedDataCons = null;
|
private Date selectedDataCons = null;
|
||||||
private List<MtbGrup> selectedMtbGrup = new ArrayList<>();
|
private List<MtbGrup> selectedMtbGrup = new ArrayList<>();
|
||||||
@ -123,6 +125,14 @@ public class VenditaFiltroOrdiniViewModel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setCommessaFilter(List<JtbComt> jtbComtList) {
|
||||||
|
if (jtbComtList == null || jtbComtList.isEmpty()) currentCommessaPredicate.set(null);
|
||||||
|
else {
|
||||||
|
List<String> codJcoms = Stream.of(jtbComtList).map(JtbComt::getCodJcom).toList();
|
||||||
|
currentCommessaPredicate.set(o -> codJcoms.contains(o.getCodJcom()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void setGruppoMercFilter(List<MtbGrup> mtbGrupList) {
|
public void setGruppoMercFilter(List<MtbGrup> mtbGrupList) {
|
||||||
if (mtbGrupList == null || mtbGrupList.isEmpty()) {
|
if (mtbGrupList == null || mtbGrupList.isEmpty()) {
|
||||||
currentGruppoMercPredicate.set(null);
|
currentGruppoMercPredicate.set(null);
|
||||||
@ -159,7 +169,8 @@ public class VenditaFiltroOrdiniViewModel {
|
|||||||
currentIdViaggioPredicate.get() == null &&
|
currentIdViaggioPredicate.get() == null &&
|
||||||
currentAgentePredicate.get() == null &&
|
currentAgentePredicate.get() == null &&
|
||||||
currentPaesePredicate.get() == null &&
|
currentPaesePredicate.get() == null &&
|
||||||
currentGruppoMercPredicate.get() == null
|
currentGruppoMercPredicate.get() == null &&
|
||||||
|
currentCommessaPredicate.get() == null
|
||||||
) {
|
) {
|
||||||
returnList = this.initialOrderList;
|
returnList = this.initialOrderList;
|
||||||
} else {
|
} else {
|
||||||
@ -175,7 +186,8 @@ public class VenditaFiltroOrdiniViewModel {
|
|||||||
(currentIdViaggioPredicate.get() == null || (currentIdViaggioPredicate.get().test(x))) &&
|
(currentIdViaggioPredicate.get() == null || (currentIdViaggioPredicate.get().test(x))) &&
|
||||||
(currentAgentePredicate.get() == null || (currentAgentePredicate.get().test(x))) &&
|
(currentAgentePredicate.get() == null || (currentAgentePredicate.get().test(x))) &&
|
||||||
(currentPaesePredicate.get() == null || (currentPaesePredicate.get().test(x))) &&
|
(currentPaesePredicate.get() == null || (currentPaesePredicate.get().test(x))) &&
|
||||||
(currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x)))
|
(currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x))) &&
|
||||||
|
(currentCommessaPredicate.get() == null || (currentCommessaPredicate.get().test(x)))
|
||||||
);
|
);
|
||||||
|
|
||||||
returnList = tmpStream.toList();
|
returnList = tmpStream.toList();
|
||||||
@ -228,6 +240,10 @@ public class VenditaFiltroOrdiniViewModel {
|
|||||||
return currentGruppoMercPredicate;
|
return currentGruppoMercPredicate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ObservableField<Predicate<OrdiniUscitaElencoDTO>> getCurrentCommessaPredicate() {
|
||||||
|
return currentCommessaPredicate;
|
||||||
|
}
|
||||||
|
|
||||||
public List<MtbDepo> getAllCodMdeps(List<MtbDepo> mtbDepoFullList) {
|
public List<MtbDepo> getAllCodMdeps(List<MtbDepo> mtbDepoFullList) {
|
||||||
List<String> codMdeps = Stream.of(initialOrderList)
|
List<String> codMdeps = Stream.of(initialOrderList)
|
||||||
.map(OrdineInevasoDTO::getCodMdep)
|
.map(OrdineInevasoDTO::getCodMdep)
|
||||||
@ -253,7 +269,8 @@ public class VenditaFiltroOrdiniViewModel {
|
|||||||
currentIdViaggioPredicate.get() == null &&
|
currentIdViaggioPredicate.get() == null &&
|
||||||
currentAgentePredicate.get() == null &&
|
currentAgentePredicate.get() == null &&
|
||||||
currentPaesePredicate.get() == null &&
|
currentPaesePredicate.get() == null &&
|
||||||
currentGruppoMercPredicate.get() == null
|
currentGruppoMercPredicate.get() == null &&
|
||||||
|
currentCommessaPredicate.get() == null
|
||||||
) {
|
) {
|
||||||
return getAllCodMdeps(mtbDepoFullList);
|
return getAllCodMdeps(mtbDepoFullList);
|
||||||
} else {
|
} else {
|
||||||
@ -268,7 +285,8 @@ public class VenditaFiltroOrdiniViewModel {
|
|||||||
(currentIdViaggioPredicate.get() == null || (currentIdViaggioPredicate.get().test(x))) &&
|
(currentIdViaggioPredicate.get() == null || (currentIdViaggioPredicate.get().test(x))) &&
|
||||||
(currentAgentePredicate.get() == null || (currentAgentePredicate.get().test(x))) &&
|
(currentAgentePredicate.get() == null || (currentAgentePredicate.get().test(x))) &&
|
||||||
(currentPaesePredicate.get() == null || (currentPaesePredicate.get().test(x))) &&
|
(currentPaesePredicate.get() == null || (currentPaesePredicate.get().test(x))) &&
|
||||||
(currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x)))
|
(currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x))) &&
|
||||||
|
(currentCommessaPredicate.get() == null || (currentCommessaPredicate.get().test(x)))
|
||||||
)
|
)
|
||||||
.map(OrdineInevasoDTO::getCodMdep)
|
.map(OrdineInevasoDTO::getCodMdep)
|
||||||
.distinct()
|
.distinct()
|
||||||
@ -305,7 +323,8 @@ public class VenditaFiltroOrdiniViewModel {
|
|||||||
currentDepositoPredicate.get() == null &&
|
currentDepositoPredicate.get() == null &&
|
||||||
currentAgentePredicate.get() == null &&
|
currentAgentePredicate.get() == null &&
|
||||||
currentPaesePredicate.get() == null &&
|
currentPaesePredicate.get() == null &&
|
||||||
currentGruppoMercPredicate.get() == null
|
currentGruppoMercPredicate.get() == null &&
|
||||||
|
currentCommessaPredicate.get() == null
|
||||||
) {
|
) {
|
||||||
return getAllIDViaggio();
|
return getAllIDViaggio();
|
||||||
} else {
|
} else {
|
||||||
@ -320,7 +339,8 @@ public class VenditaFiltroOrdiniViewModel {
|
|||||||
(currentDepositoPredicate.get() == null || (currentDepositoPredicate.get().test(x))) &&
|
(currentDepositoPredicate.get() == null || (currentDepositoPredicate.get().test(x))) &&
|
||||||
(currentAgentePredicate.get() == null || (currentAgentePredicate.get().test(x))) &&
|
(currentAgentePredicate.get() == null || (currentAgentePredicate.get().test(x))) &&
|
||||||
(currentPaesePredicate.get() == null || (currentPaesePredicate.get().test(x))) &&
|
(currentPaesePredicate.get() == null || (currentPaesePredicate.get().test(x))) &&
|
||||||
(currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x)))
|
(currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x))) &&
|
||||||
|
(currentCommessaPredicate.get() == null || (currentCommessaPredicate.get().test(x)))
|
||||||
)
|
)
|
||||||
.map(OrdineUscitaInevasoDTO::getIdViaggio)
|
.map(OrdineUscitaInevasoDTO::getIdViaggio)
|
||||||
.distinct()
|
.distinct()
|
||||||
@ -350,7 +370,8 @@ public class VenditaFiltroOrdiniViewModel {
|
|||||||
currentDepositoPredicate.get() == null &&
|
currentDepositoPredicate.get() == null &&
|
||||||
currentAgentePredicate.get() == null &&
|
currentAgentePredicate.get() == null &&
|
||||||
currentPaesePredicate.get() == null &&
|
currentPaesePredicate.get() == null &&
|
||||||
currentGruppoMercPredicate.get() == null
|
currentGruppoMercPredicate.get() == null &&
|
||||||
|
currentCommessaPredicate.get() == null
|
||||||
) {
|
) {
|
||||||
return getAllNumOrds();
|
return getAllNumOrds();
|
||||||
} else {
|
} else {
|
||||||
@ -365,7 +386,8 @@ public class VenditaFiltroOrdiniViewModel {
|
|||||||
(currentDepositoPredicate.get() == null || (currentDepositoPredicate.get().test(x))) &&
|
(currentDepositoPredicate.get() == null || (currentDepositoPredicate.get().test(x))) &&
|
||||||
(currentAgentePredicate.get() == null || (currentAgentePredicate.get().test(x))) &&
|
(currentAgentePredicate.get() == null || (currentAgentePredicate.get().test(x))) &&
|
||||||
(currentPaesePredicate.get() == null || (currentPaesePredicate.get().test(x))) &&
|
(currentPaesePredicate.get() == null || (currentPaesePredicate.get().test(x))) &&
|
||||||
(currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x)))
|
(currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x))) &&
|
||||||
|
(currentCommessaPredicate.get() == null || (currentCommessaPredicate.get().test(x)))
|
||||||
)
|
)
|
||||||
.map(OrdineUscitaInevasoDTO::getNumOrd)
|
.map(OrdineUscitaInevasoDTO::getNumOrd)
|
||||||
.distinct()
|
.distinct()
|
||||||
@ -395,7 +417,8 @@ public class VenditaFiltroOrdiniViewModel {
|
|||||||
currentDepositoPredicate.get() == null &&
|
currentDepositoPredicate.get() == null &&
|
||||||
currentAgentePredicate.get() == null &&
|
currentAgentePredicate.get() == null &&
|
||||||
currentPaesePredicate.get() == null &&
|
currentPaesePredicate.get() == null &&
|
||||||
currentGruppoMercPredicate.get() == null
|
currentGruppoMercPredicate.get() == null &&
|
||||||
|
currentCommessaPredicate.get() == null
|
||||||
) {
|
) {
|
||||||
return getAllClienti();
|
return getAllClienti();
|
||||||
} else {
|
} else {
|
||||||
@ -410,7 +433,8 @@ public class VenditaFiltroOrdiniViewModel {
|
|||||||
(currentDepositoPredicate.get() == null || (currentDepositoPredicate.get().test(x))) &&
|
(currentDepositoPredicate.get() == null || (currentDepositoPredicate.get().test(x))) &&
|
||||||
(currentAgentePredicate.get() == null || (currentAgentePredicate.get().test(x))) &&
|
(currentAgentePredicate.get() == null || (currentAgentePredicate.get().test(x))) &&
|
||||||
(currentPaesePredicate.get() == null || (currentPaesePredicate.get().test(x))) &&
|
(currentPaesePredicate.get() == null || (currentPaesePredicate.get().test(x))) &&
|
||||||
(currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x)))
|
(currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x))) &&
|
||||||
|
(currentCommessaPredicate.get() == null || (currentCommessaPredicate.get().test(x)))
|
||||||
)
|
)
|
||||||
.map(OrdineUscitaInevasoDTO::getRagSocOrd)
|
.map(OrdineUscitaInevasoDTO::getRagSocOrd)
|
||||||
.distinct()
|
.distinct()
|
||||||
@ -440,7 +464,8 @@ public class VenditaFiltroOrdiniViewModel {
|
|||||||
currentDepositoPredicate.get() == null &&
|
currentDepositoPredicate.get() == null &&
|
||||||
currentAgentePredicate.get() == null &&
|
currentAgentePredicate.get() == null &&
|
||||||
currentPaesePredicate.get() == null &&
|
currentPaesePredicate.get() == null &&
|
||||||
currentGruppoMercPredicate.get() == null
|
currentGruppoMercPredicate.get() == null &&
|
||||||
|
currentCommessaPredicate.get() == null
|
||||||
) {
|
) {
|
||||||
return getAllVettori();
|
return getAllVettori();
|
||||||
} else {
|
} else {
|
||||||
@ -455,7 +480,8 @@ public class VenditaFiltroOrdiniViewModel {
|
|||||||
(currentDepositoPredicate.get() == null || (currentDepositoPredicate.get().test(x))) &&
|
(currentDepositoPredicate.get() == null || (currentDepositoPredicate.get().test(x))) &&
|
||||||
(currentAgentePredicate.get() == null || (currentAgentePredicate.get().test(x))) &&
|
(currentAgentePredicate.get() == null || (currentAgentePredicate.get().test(x))) &&
|
||||||
(currentPaesePredicate.get() == null || (currentPaesePredicate.get().test(x))) &&
|
(currentPaesePredicate.get() == null || (currentPaesePredicate.get().test(x))) &&
|
||||||
(currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x)))
|
(currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x))) &&
|
||||||
|
(currentCommessaPredicate.get() == null || (currentCommessaPredicate.get().test(x)))
|
||||||
)
|
)
|
||||||
.map(x -> x.getCodVvet() + (!UtilityString.isNullOrEmpty(x.getCodVvet()) ? " - " + x.getDescrizioneVettore() : ""))
|
.map(x -> x.getCodVvet() + (!UtilityString.isNullOrEmpty(x.getCodVvet()) ? " - " + x.getDescrizioneVettore() : ""))
|
||||||
.distinct()
|
.distinct()
|
||||||
@ -485,7 +511,8 @@ public class VenditaFiltroOrdiniViewModel {
|
|||||||
currentDepositoPredicate.get() == null &&
|
currentDepositoPredicate.get() == null &&
|
||||||
currentAgentePredicate.get() == null &&
|
currentAgentePredicate.get() == null &&
|
||||||
currentPaesePredicate.get() == null &&
|
currentPaesePredicate.get() == null &&
|
||||||
currentGruppoMercPredicate.get() == null
|
currentGruppoMercPredicate.get() == null &&
|
||||||
|
currentCommessaPredicate.get() == null
|
||||||
) {
|
) {
|
||||||
return getAllAutomezzi();
|
return getAllAutomezzi();
|
||||||
} else {
|
} else {
|
||||||
@ -500,7 +527,8 @@ public class VenditaFiltroOrdiniViewModel {
|
|||||||
(currentDepositoPredicate.get() == null || (currentDepositoPredicate.get().test(x))) &&
|
(currentDepositoPredicate.get() == null || (currentDepositoPredicate.get().test(x))) &&
|
||||||
(currentAgentePredicate.get() == null || (currentAgentePredicate.get().test(x))) &&
|
(currentAgentePredicate.get() == null || (currentAgentePredicate.get().test(x))) &&
|
||||||
(currentPaesePredicate.get() == null || (currentPaesePredicate.get().test(x))) &&
|
(currentPaesePredicate.get() == null || (currentPaesePredicate.get().test(x))) &&
|
||||||
(currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x)))
|
(currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x))) &&
|
||||||
|
(currentCommessaPredicate.get() == null || (currentCommessaPredicate.get().test(x)))
|
||||||
)
|
)
|
||||||
.map(OrdineUscitaInevasoDTO::getDescrizioneAuto)
|
.map(OrdineUscitaInevasoDTO::getDescrizioneAuto)
|
||||||
.distinct()
|
.distinct()
|
||||||
@ -530,7 +558,8 @@ public class VenditaFiltroOrdiniViewModel {
|
|||||||
currentDepositoPredicate.get() == null &&
|
currentDepositoPredicate.get() == null &&
|
||||||
currentAgentePredicate.get() == null &&
|
currentAgentePredicate.get() == null &&
|
||||||
currentAutomezzoPredicate.get() == null &&
|
currentAutomezzoPredicate.get() == null &&
|
||||||
currentGruppoMercPredicate.get() == null
|
currentGruppoMercPredicate.get() == null &&
|
||||||
|
currentCommessaPredicate.get() == null
|
||||||
) {
|
) {
|
||||||
List<String> all = getAllPaesi();
|
List<String> all = getAllPaesi();
|
||||||
return all;
|
return all;
|
||||||
@ -546,7 +575,8 @@ public class VenditaFiltroOrdiniViewModel {
|
|||||||
(currentDepositoPredicate.get() == null || (currentDepositoPredicate.get().test(x))) &&
|
(currentDepositoPredicate.get() == null || (currentDepositoPredicate.get().test(x))) &&
|
||||||
(currentAgentePredicate.get() == null || (currentAgentePredicate.get().test(x))) &&
|
(currentAgentePredicate.get() == null || (currentAgentePredicate.get().test(x))) &&
|
||||||
(currentAutomezzoPredicate.get() == null || (currentAutomezzoPredicate.get().test(x))) &&
|
(currentAutomezzoPredicate.get() == null || (currentAutomezzoPredicate.get().test(x))) &&
|
||||||
(currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x)))
|
(currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x))) &&
|
||||||
|
(currentCommessaPredicate.get() == null || (currentCommessaPredicate.get().test(x)))
|
||||||
)
|
)
|
||||||
.map(OrdineUscitaInevasoDTO::getCitta)
|
.map(OrdineUscitaInevasoDTO::getCitta)
|
||||||
.distinct()
|
.distinct()
|
||||||
@ -576,7 +606,8 @@ public class VenditaFiltroOrdiniViewModel {
|
|||||||
currentDepositoPredicate.get() == null &&
|
currentDepositoPredicate.get() == null &&
|
||||||
currentPaesePredicate.get() == null &&
|
currentPaesePredicate.get() == null &&
|
||||||
currentAutomezzoPredicate.get() == null &&
|
currentAutomezzoPredicate.get() == null &&
|
||||||
currentGruppoMercPredicate.get() == null
|
currentGruppoMercPredicate.get() == null &&
|
||||||
|
currentCommessaPredicate.get() == null
|
||||||
) {
|
) {
|
||||||
List<String> all = getAllAgenti();
|
List<String> all = getAllAgenti();
|
||||||
return all;
|
return all;
|
||||||
@ -592,7 +623,8 @@ public class VenditaFiltroOrdiniViewModel {
|
|||||||
(currentDepositoPredicate.get() == null || (currentDepositoPredicate.get().test(x))) &&
|
(currentDepositoPredicate.get() == null || (currentDepositoPredicate.get().test(x))) &&
|
||||||
(currentPaesePredicate.get() == null || (currentPaesePredicate.get().test(x))) &&
|
(currentPaesePredicate.get() == null || (currentPaesePredicate.get().test(x))) &&
|
||||||
(currentAutomezzoPredicate.get() == null || (currentAutomezzoPredicate.get().test(x))) &&
|
(currentAutomezzoPredicate.get() == null || (currentAutomezzoPredicate.get().test(x))) &&
|
||||||
(currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x)))
|
(currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x))) &&
|
||||||
|
(currentCommessaPredicate.get() == null || (currentCommessaPredicate.get().test(x)))
|
||||||
)
|
)
|
||||||
.map(OrdineUscitaInevasoDTO::getNomeAgente)
|
.map(OrdineUscitaInevasoDTO::getNomeAgente)
|
||||||
.distinct()
|
.distinct()
|
||||||
@ -622,7 +654,8 @@ public class VenditaFiltroOrdiniViewModel {
|
|||||||
currentDepositoPredicate.get() == null &&
|
currentDepositoPredicate.get() == null &&
|
||||||
currentPaesePredicate.get() == null &&
|
currentPaesePredicate.get() == null &&
|
||||||
currentAutomezzoPredicate.get() == null &&
|
currentAutomezzoPredicate.get() == null &&
|
||||||
currentGruppoMercPredicate.get() == null
|
currentGruppoMercPredicate.get() == null &&
|
||||||
|
currentCommessaPredicate.get() == null
|
||||||
) {
|
) {
|
||||||
return getAllTermCons();
|
return getAllTermCons();
|
||||||
} else {
|
} else {
|
||||||
@ -637,7 +670,8 @@ public class VenditaFiltroOrdiniViewModel {
|
|||||||
(currentDepositoPredicate.get() == null || (currentDepositoPredicate.get().test(x))) &&
|
(currentDepositoPredicate.get() == null || (currentDepositoPredicate.get().test(x))) &&
|
||||||
(currentPaesePredicate.get() == null || (currentPaesePredicate.get().test(x))) &&
|
(currentPaesePredicate.get() == null || (currentPaesePredicate.get().test(x))) &&
|
||||||
(currentAutomezzoPredicate.get() == null || (currentAutomezzoPredicate.get().test(x))) &&
|
(currentAutomezzoPredicate.get() == null || (currentAutomezzoPredicate.get().test(x))) &&
|
||||||
(currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x)))
|
(currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x))) &&
|
||||||
|
(currentCommessaPredicate.get() == null || (currentCommessaPredicate.get().test(x)))
|
||||||
)
|
)
|
||||||
.map(OrdineUscitaInevasoDTO::getTermCons)
|
.map(OrdineUscitaInevasoDTO::getTermCons)
|
||||||
.distinct()
|
.distinct()
|
||||||
@ -646,6 +680,62 @@ public class VenditaFiltroOrdiniViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public List<JtbComt> getAllCommesse(List<JtbComt> commesseFullList) {
|
||||||
|
List<String> codJcom = Stream.of(initialOrderList)
|
||||||
|
.map(OrdiniUscitaElencoDTO::getCodJcom)
|
||||||
|
.distinct()
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
return Stream.of(Objects.requireNonNull(commesseFullList))
|
||||||
|
.filter(x -> codJcom.contains(x.getCodJcom()))
|
||||||
|
.distinct()
|
||||||
|
.withoutNulls()
|
||||||
|
.sortBy(JtbComt::getCodJcom)
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
public List<JtbComt> getAvailableCommesse(List<JtbComt> commesseFullList) {
|
||||||
|
|
||||||
|
if (currentIdViaggioPredicate.get() == null &&
|
||||||
|
currentNumOrdsPredicate.get() == null &&
|
||||||
|
currentDataConsPredicate.get() == null &&
|
||||||
|
currentAgentePredicate.get() == null &&
|
||||||
|
currentClientePredicate.get() == null &&
|
||||||
|
currentVettorePredicate.get() == null &&
|
||||||
|
currentDepositoPredicate.get() == null &&
|
||||||
|
currentPaesePredicate.get() == null &&
|
||||||
|
currentAutomezzoPredicate.get() == null &&
|
||||||
|
currentGruppoMercPredicate.get() == null &&
|
||||||
|
currentTermConsPredicate.get() == null) {
|
||||||
|
return getAllCommesse(commesseFullList);
|
||||||
|
} else {
|
||||||
|
List<String> availableCommesse = Stream.of(this.initialOrderList)
|
||||||
|
.filter(x ->
|
||||||
|
(currentIdViaggioPredicate.get() == null || (currentIdViaggioPredicate.get().test(x))) &&
|
||||||
|
(currentNumOrdsPredicate.get() == null || (currentNumOrdsPredicate.get().test(x))) &&
|
||||||
|
(currentDataConsPredicate.get() == null || (currentDataConsPredicate.get().test(x))) &&
|
||||||
|
(currentAgentePredicate.get() == null || (currentAgentePredicate.get().test(x))) &&
|
||||||
|
(currentClientePredicate.get() == null || (currentClientePredicate.get().test(x))) &&
|
||||||
|
(currentVettorePredicate.get() == null || (currentVettorePredicate.get().test(x))) &&
|
||||||
|
(currentDepositoPredicate.get() == null || (currentDepositoPredicate.get().test(x))) &&
|
||||||
|
(currentPaesePredicate.get() == null || (currentPaesePredicate.get().test(x))) &&
|
||||||
|
(currentAutomezzoPredicate.get() == null || (currentAutomezzoPredicate.get().test(x))) &&
|
||||||
|
(currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x))) &&
|
||||||
|
(currentTermConsPredicate.get() == null || (currentTermConsPredicate.get().test(x)))
|
||||||
|
)
|
||||||
|
.map(OrdineUscitaInevasoDTO::getCodJcom)
|
||||||
|
.distinct()
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
return Stream.of(Objects.requireNonNull(commesseFullList))
|
||||||
|
.filter(x -> availableCommesse.contains(x.getCodJcom()))
|
||||||
|
.distinct()
|
||||||
|
.withoutNulls()
|
||||||
|
.sortBy(JtbComt::getCodJcom)
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public List<MtbGrup> getAllGruppoMerc(List<MtbGrup> mtbGrupFullList) {
|
public List<MtbGrup> getAllGruppoMerc(List<MtbGrup> mtbGrupFullList) {
|
||||||
var codMgrp = Stream.of(initialOrderList)
|
var codMgrp = Stream.of(initialOrderList)
|
||||||
.flatMap(ordiniUscitaElencoDTO ->
|
.flatMap(ordiniUscitaElencoDTO ->
|
||||||
@ -676,7 +766,8 @@ public class VenditaFiltroOrdiniViewModel {
|
|||||||
currentIdViaggioPredicate.get() == null &&
|
currentIdViaggioPredicate.get() == null &&
|
||||||
currentAgentePredicate.get() == null &&
|
currentAgentePredicate.get() == null &&
|
||||||
currentPaesePredicate.get() == null &&
|
currentPaesePredicate.get() == null &&
|
||||||
currentDepositoPredicate.get() == null
|
currentDepositoPredicate.get() == null &&
|
||||||
|
currentCommessaPredicate.get() == null
|
||||||
) {
|
) {
|
||||||
return getAllGruppoMerc(mtbGrupFullList);
|
return getAllGruppoMerc(mtbGrupFullList);
|
||||||
} else {
|
} else {
|
||||||
@ -691,7 +782,8 @@ public class VenditaFiltroOrdiniViewModel {
|
|||||||
(currentIdViaggioPredicate.get() == null || (currentIdViaggioPredicate.get().test(x))) &&
|
(currentIdViaggioPredicate.get() == null || (currentIdViaggioPredicate.get().test(x))) &&
|
||||||
(currentAgentePredicate.get() == null || (currentAgentePredicate.get().test(x))) &&
|
(currentAgentePredicate.get() == null || (currentAgentePredicate.get().test(x))) &&
|
||||||
(currentPaesePredicate.get() == null || (currentPaesePredicate.get().test(x))) &&
|
(currentPaesePredicate.get() == null || (currentPaesePredicate.get().test(x))) &&
|
||||||
(currentDepositoPredicate.get() == null || (currentDepositoPredicate.get().test(x)))
|
(currentDepositoPredicate.get() == null || (currentDepositoPredicate.get().test(x))) &&
|
||||||
|
(currentCommessaPredicate.get() == null || (currentCommessaPredicate.get().test(x)))
|
||||||
)
|
)
|
||||||
.flatMap(x -> Stream.of(x.getAvailableClassMerc()))
|
.flatMap(x -> Stream.of(x.getAvailableClassMerc()))
|
||||||
.map(OrdineUscitaInevasoDTO.AvailableClassMerc::getCodMgrp)
|
.map(OrdineUscitaInevasoDTO.AvailableClassMerc::getCodMgrp)
|
||||||
|
|||||||
@ -72,6 +72,7 @@ public class DialogScanGrigliaAcquistoView extends BaseDialogFragment {
|
|||||||
|
|
||||||
var alertDialog = alertDialogBuilder.create();
|
var alertDialog = alertDialogBuilder.create();
|
||||||
alertDialog.setCanceledOnTouchOutside(true);
|
alertDialog.setCanceledOnTouchOutside(true);
|
||||||
|
alertDialog.setOnShowListener(this);
|
||||||
return alertDialog;
|
return alertDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -656,6 +656,9 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
|||||||
if (status == DialogConsts.Results.YES) {
|
if (status == DialogConsts.Results.YES) {
|
||||||
this.mViewmodel.dispatchExtraItem(mtbAart, ean128Model, mtbColr);
|
this.mViewmodel.dispatchExtraItem(mtbAart, ean128Model, mtbColr);
|
||||||
}
|
}
|
||||||
|
}, pickMagazzinoAutomaticoPosizione -> {
|
||||||
|
this.onLoadingStarted();
|
||||||
|
this.mViewmodel.executeEmptyMagazzinoAutomaticoRequest(pickMagazzinoAutomaticoPosizione, this::onLoadingEnded);
|
||||||
})
|
})
|
||||||
.show(getSupportFragmentManager(), "tag");
|
.show(getSupportFragmentManager(), "tag");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -637,6 +637,21 @@ public class SpedizioneViewModel {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void executeEmptyMagazzinoAutomaticoRequest(MtbDepoPosizione mtbDepoPosizione, Runnable onComplete) {
|
||||||
|
final List<MagazzinoAutomaticoPickOrderRequestDTO> orders = Stream.of(this.mTestateOrdini)
|
||||||
|
.map(x -> new MagazzinoAutomaticoPickOrderRequestDTO(UtilityDate.toLocalDate(x.getDataOrdD()), x.getGestione(), x.getNumOrd())
|
||||||
|
.setDataCons(UtilityDate.toLocalDate(x.getDataConsD())))
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
var magazzinoAutomaticoPickRequest = new MagazzinoAutomaticoPickItemsRequestDTO()
|
||||||
|
.setShouldCreateUDS(true)
|
||||||
|
.setDefaultGestioneOfNewUDS(mDefaultGestioneOfUL.getText())
|
||||||
|
.setOrdersOfNewUDS(orders);
|
||||||
|
|
||||||
|
mMagazzinoAutomaticoRESTConsumer.pickItems(mtbDepoPosizione,
|
||||||
|
magazzinoAutomaticoPickRequest, onComplete, this::sendError);
|
||||||
|
}
|
||||||
|
|
||||||
private void searchArtFromUL(MtbColt scannedUL, Runnable onComplete) {
|
private void searchArtFromUL(MtbColt scannedUL, Runnable onComplete) {
|
||||||
|
|
||||||
final List<PickingObjectDTO> pickingList = mPickingList.getValue();
|
final List<PickingObjectDTO> pickingList = mPickingList.getValue();
|
||||||
|
|||||||
@ -44,6 +44,7 @@ public class DialogBasketLUView extends BaseDialogFragment {
|
|||||||
.create();
|
.create();
|
||||||
|
|
||||||
alertDialog.setCanceledOnTouchOutside(false);
|
alertDialog.setCanceledOnTouchOutside(false);
|
||||||
|
alertDialog.setOnShowListener(this);
|
||||||
this.initViewPager(alertDialog);
|
this.initViewPager(alertDialog);
|
||||||
|
|
||||||
return alertDialog;
|
return alertDialog;
|
||||||
|
|||||||
@ -7,7 +7,6 @@ import android.view.LayoutInflater;
|
|||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.fragment.app.DialogFragment;
|
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||||
@ -15,12 +14,13 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.R;
|
import it.integry.integrywmsnative.R;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||||
import it.integry.integrywmsnative.databinding.DialogChooseArtFromListaArtBinding;
|
import it.integry.integrywmsnative.databinding.DialogChooseArtFromListaArtBinding;
|
||||||
import it.integry.integrywmsnative.ui.SimpleDividerItemDecoration;
|
import it.integry.integrywmsnative.ui.SimpleDividerItemDecoration;
|
||||||
|
|
||||||
public class DialogChooseArtFromListaArtsView extends DialogFragment {
|
public class DialogChooseArtFromListaArtsView extends BaseDialogFragment {
|
||||||
|
|
||||||
|
|
||||||
private final List<MtbAart> mListaArts;
|
private final List<MtbAart> mListaArts;
|
||||||
@ -47,6 +47,7 @@ public class DialogChooseArtFromListaArtsView extends DialogFragment {
|
|||||||
.create();
|
.create();
|
||||||
|
|
||||||
alertDialog.setCanceledOnTouchOutside(false);
|
alertDialog.setCanceledOnTouchOutside(false);
|
||||||
|
alertDialog.setOnShowListener(this);
|
||||||
return alertDialog;
|
return alertDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -102,6 +102,7 @@ public class DialogChooseArtsFromMtbAartListView extends BaseDialogFragment impl
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onShow(DialogInterface dialogInterface) {
|
public void onShow(DialogInterface dialogInterface) {
|
||||||
|
super.onShow(dialogInterface);
|
||||||
this.initList();
|
this.initList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -144,6 +144,7 @@ public class DialogChooseArtsFromMtbColrList extends BaseDialogFragment implemen
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onShow(DialogInterface dialogInterface) {
|
public void onShow(DialogInterface dialogInterface) {
|
||||||
|
super.onShow(dialogInterface);
|
||||||
this.initList();
|
this.initList();
|
||||||
this.initFilter();
|
this.initFilter();
|
||||||
this.setupBarcode();
|
this.setupBarcode();
|
||||||
|
|||||||
@ -90,6 +90,7 @@ public class DialogInputPesoLUView extends BaseDialogFragment {
|
|||||||
.create();
|
.create();
|
||||||
|
|
||||||
alertDialog.setCanceledOnTouchOutside(cancelable);
|
alertDialog.setCanceledOnTouchOutside(cancelable);
|
||||||
|
alertDialog.setOnShowListener(this);
|
||||||
return alertDialog;
|
return alertDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -5,6 +5,8 @@ import dagger.Provides;
|
|||||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||||
|
import it.integry.integrywmsnative.core.rest.consumers.GiacenzaRESTConsumer;
|
||||||
|
import it.integry.integrywmsnative.core.rest.consumers.MagazzinoAutomaticoRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
|
||||||
|
|
||||||
@Module(subcomponents = DialogScanArtComponent.class)
|
@Module(subcomponents = DialogScanArtComponent.class)
|
||||||
@ -14,8 +16,15 @@ public class DialogScanArtModule {
|
|||||||
DialogScanArtViewModel providesDialogScanArtViewModel(BarcodeRESTConsumer barcodeRESTConsumer,
|
DialogScanArtViewModel providesDialogScanArtViewModel(BarcodeRESTConsumer barcodeRESTConsumer,
|
||||||
ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer,
|
ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer,
|
||||||
ArticoloRESTConsumer articoloRESTConsumer,
|
ArticoloRESTConsumer articoloRESTConsumer,
|
||||||
PosizioniRESTConsumer posizioniRESTConsumer) {
|
PosizioniRESTConsumer posizioniRESTConsumer,
|
||||||
return new DialogScanArtViewModel(barcodeRESTConsumer, colliMagazzinoRESTConsumer, articoloRESTConsumer, posizioniRESTConsumer);
|
MagazzinoAutomaticoRESTConsumer magazzinoAutomaticoRESTConsumer,
|
||||||
|
GiacenzaRESTConsumer giacenzaRESTConsumer) {
|
||||||
|
return new DialogScanArtViewModel(barcodeRESTConsumer,
|
||||||
|
colliMagazzinoRESTConsumer,
|
||||||
|
articoloRESTConsumer,
|
||||||
|
posizioniRESTConsumer,
|
||||||
|
magazzinoAutomaticoRESTConsumer,
|
||||||
|
giacenzaRESTConsumer);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,6 +26,7 @@ import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
|||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgssss;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgssss;
|
||||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||||
|
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
||||||
import it.integry.integrywmsnative.core.rest.model.Ean128Model;
|
import it.integry.integrywmsnative.core.rest.model.Ean128Model;
|
||||||
import it.integry.integrywmsnative.databinding.DialogScanArtBinding;
|
import it.integry.integrywmsnative.databinding.DialogScanArtBinding;
|
||||||
import it.integry.integrywmsnative.view.dialogs.DialogConsts;
|
import it.integry.integrywmsnative.view.dialogs.DialogConsts;
|
||||||
@ -42,17 +43,19 @@ public class DialogScanArtView extends BaseDialogFragment implements DialogScanA
|
|||||||
|
|
||||||
private int mBarcodeScannerIstanceID;
|
private int mBarcodeScannerIstanceID;
|
||||||
|
|
||||||
private RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, MtbColr> mOnItemChoosed = null;
|
private RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, MtbColr> onPickingCompleted = null;
|
||||||
|
private RunnableArgs<MtbDepoPosizione> onMagazzinoAutomaticoPickingRequest = null;
|
||||||
|
|
||||||
|
|
||||||
public static DialogScanArtView newInstance(boolean forceOnlyUL, @NotNull RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, MtbColr> onComplete) {
|
public static DialogScanArtView newInstance(boolean forceOnlyUL, @NotNull RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, MtbColr> onPickingCompleted, RunnableArgs<MtbDepoPosizione> onMagazzinoAutomaticoPickingRequest) {
|
||||||
return new DialogScanArtView(forceOnlyUL, onComplete);
|
return new DialogScanArtView(forceOnlyUL, onPickingCompleted, onMagazzinoAutomaticoPickingRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
private DialogScanArtView(boolean forceOnlyUL, RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, MtbColr> onItemChoosed) {
|
private DialogScanArtView(boolean forceOnlyUL, RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, MtbColr> onItemChoosed, RunnableArgs<MtbDepoPosizione> onMagazzinoAutomaticoPickingRequest) {
|
||||||
super();
|
super();
|
||||||
mForceOnlyUL = forceOnlyUL;
|
mForceOnlyUL = forceOnlyUL;
|
||||||
mOnItemChoosed = onItemChoosed;
|
onPickingCompleted = onItemChoosed;
|
||||||
|
this.onMagazzinoAutomaticoPickingRequest = onMagazzinoAutomaticoPickingRequest;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@ -76,7 +79,7 @@ public class DialogScanArtView extends BaseDialogFragment implements DialogScanA
|
|||||||
getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||||
|
|
||||||
mBindings.buttonNo.setOnClickListener(v -> {
|
mBindings.buttonNo.setOnClickListener(v -> {
|
||||||
mOnItemChoosed.run(DialogConsts.Results.ABORT, null, null, null);
|
onPickingCompleted.run(DialogConsts.Results.ABORT, null, null, null);
|
||||||
dismiss();
|
dismiss();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -116,19 +119,24 @@ public class DialogScanArtView extends BaseDialogFragment implements DialogScanA
|
|||||||
|
|
||||||
if (filteredMtbColrList != null && filteredMtbColrList.size() > 1) {
|
if (filteredMtbColrList != null && filteredMtbColrList.size() > 1) {
|
||||||
DialogChooseArtFromListaMtbColrView.make(getActivity(), filteredMtbColrList, mtbColrChose -> {
|
DialogChooseArtFromListaMtbColrView.make(getActivity(), filteredMtbColrList, mtbColrChose -> {
|
||||||
mOnItemChoosed.run(status, mtbAart, ean128Model, mtbColrChose);
|
onPickingCompleted.run(status, mtbAart, ean128Model, mtbColrChose);
|
||||||
}).show();
|
}).show();
|
||||||
|
|
||||||
} else if (filteredMtbColrList != null && filteredMtbColrList.size() == 1) {
|
} else if (filteredMtbColrList != null && filteredMtbColrList.size() == 1) {
|
||||||
mOnItemChoosed.run(status, mtbAart, ean128Model, filteredMtbColrList.get(0));
|
onPickingCompleted.run(status, mtbAart, ean128Model, filteredMtbColrList.get(0));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
mOnItemChoosed.run(status, mtbAart, ean128Model, null);
|
onPickingCompleted.run(status, mtbAart, ean128Model, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
this.onLoadingEnded();
|
this.onLoadingEnded();
|
||||||
|
|
||||||
|
dismiss();
|
||||||
|
}, pickMagazzinoAutomaticoPosizione -> {
|
||||||
|
this.onMagazzinoAutomaticoPickingRequest.run(pickMagazzinoAutomaticoPosizione);
|
||||||
|
|
||||||
|
this.onLoadingEnded();
|
||||||
dismiss();
|
dismiss();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
package it.integry.integrywmsnative.view.dialogs.scan_art;
|
package it.integry.integrywmsnative.view.dialogs.scan_art;
|
||||||
|
|
||||||
|
import com.annimon.stream.Stream;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -9,7 +11,9 @@ import it.integry.integrywmsnative.core.exception.EmptyLUException;
|
|||||||
import it.integry.integrywmsnative.core.exception.InvalidLUException;
|
import it.integry.integrywmsnative.core.exception.InvalidLUException;
|
||||||
import it.integry.integrywmsnative.core.exception.NoLUFoundException;
|
import it.integry.integrywmsnative.core.exception.NoLUFoundException;
|
||||||
import it.integry.integrywmsnative.core.exception.NoResultFromBarcodeException;
|
import it.integry.integrywmsnative.core.exception.NoResultFromBarcodeException;
|
||||||
|
import it.integry.integrywmsnative.core.exception.ScannedPositionNotExistException;
|
||||||
import it.integry.integrywmsnative.core.exception.TooManyLUFoundInMonoLUPositionException;
|
import it.integry.integrywmsnative.core.exception.TooManyLUFoundInMonoLUPositionException;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgssss;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgssss;
|
||||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||||
@ -17,9 +21,12 @@ import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
|||||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||||
|
import it.integry.integrywmsnative.core.rest.consumers.GiacenzaRESTConsumer;
|
||||||
|
import it.integry.integrywmsnative.core.rest.consumers.MagazzinoAutomaticoRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.model.Ean128Model;
|
import it.integry.integrywmsnative.core.rest.model.Ean128Model;
|
||||||
import it.integry.integrywmsnative.core.rest.model.Ean13PesoModel;
|
import it.integry.integrywmsnative.core.rest.model.Ean13PesoModel;
|
||||||
|
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
|
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityPosizione;
|
import it.integry.integrywmsnative.core.utility.UtilityPosizione;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||||
@ -31,6 +38,8 @@ public class DialogScanArtViewModel {
|
|||||||
private final ColliMagazzinoRESTConsumer mColliMagazzinoRESTConsumer;
|
private final ColliMagazzinoRESTConsumer mColliMagazzinoRESTConsumer;
|
||||||
private final ArticoloRESTConsumer mArticoloRESTConsumer;
|
private final ArticoloRESTConsumer mArticoloRESTConsumer;
|
||||||
private final PosizioniRESTConsumer mPosizioniRESTConsumer;
|
private final PosizioniRESTConsumer mPosizioniRESTConsumer;
|
||||||
|
private final MagazzinoAutomaticoRESTConsumer mMagazzinoAutomaticoRESTConsumer;
|
||||||
|
private final GiacenzaRESTConsumer mGiacenzaRESTConsumer;
|
||||||
|
|
||||||
private boolean mForceOnlyUL;
|
private boolean mForceOnlyUL;
|
||||||
|
|
||||||
@ -39,11 +48,13 @@ public class DialogScanArtViewModel {
|
|||||||
public DialogScanArtViewModel(BarcodeRESTConsumer barcodeRESTConsumer,
|
public DialogScanArtViewModel(BarcodeRESTConsumer barcodeRESTConsumer,
|
||||||
ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer,
|
ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer,
|
||||||
ArticoloRESTConsumer articoloRESTConsumer,
|
ArticoloRESTConsumer articoloRESTConsumer,
|
||||||
PosizioniRESTConsumer posizioniRESTConsumer) {
|
PosizioniRESTConsumer posizioniRESTConsumer, MagazzinoAutomaticoRESTConsumer mMagazzinoAutomaticoRESTConsumer, GiacenzaRESTConsumer mGiacenzaRESTConsumer) {
|
||||||
this.mBarcodeRESTConsumer = barcodeRESTConsumer;
|
this.mBarcodeRESTConsumer = barcodeRESTConsumer;
|
||||||
this.mColliMagazzinoRESTConsumer = colliMagazzinoRESTConsumer;
|
this.mColliMagazzinoRESTConsumer = colliMagazzinoRESTConsumer;
|
||||||
this.mArticoloRESTConsumer = articoloRESTConsumer;
|
this.mArticoloRESTConsumer = articoloRESTConsumer;
|
||||||
this.mPosizioniRESTConsumer = posizioniRESTConsumer;
|
this.mPosizioniRESTConsumer = posizioniRESTConsumer;
|
||||||
|
this.mMagazzinoAutomaticoRESTConsumer = mMagazzinoAutomaticoRESTConsumer;
|
||||||
|
this.mGiacenzaRESTConsumer = mGiacenzaRESTConsumer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DialogScanArtViewModel setForceOnlyUL(boolean forceOnlyUL) {
|
public DialogScanArtViewModel setForceOnlyUL(boolean forceOnlyUL) {
|
||||||
@ -51,23 +62,23 @@ public class DialogScanArtViewModel {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void processBarcodeDTO(BarcodeScanDTO barcodeScanDTO, RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, List<MtbColr>> onComplete) {
|
public void processBarcodeDTO(BarcodeScanDTO barcodeScanDTO, RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, List<MtbColr>> onPickingCompleted, RunnableArgs<MtbDepoPosizione> onMagazzinoAutomaticoPickingRequest) {
|
||||||
if (UtilityBarcode.isEtichettaAnonima(barcodeScanDTO)) {
|
if (UtilityBarcode.isEtichettaAnonima(barcodeScanDTO)) {
|
||||||
//Cerco gli articoli presenti nell'ul dell'etichetta anonima
|
//Cerco gli articoli presenti nell'ul dell'etichetta anonima
|
||||||
this.executeEtichettaLU(barcodeScanDTO.getStringValue(), onComplete);
|
this.executeEtichettaLU(barcodeScanDTO.getStringValue(), onPickingCompleted);
|
||||||
|
|
||||||
} else if (UtilityBarcode.isEtichettaPosizione(barcodeScanDTO)) {
|
} else if (UtilityBarcode.isEtichettaPosizione(barcodeScanDTO)) {
|
||||||
//Cerco l'UL presente all'interno della posizione
|
//Cerco l'UL presente all'interno della posizione
|
||||||
// this.executeEtichettaPosizione(barcodeScanDTO.getStringValue(), onComplete);
|
this.executeEtichettaPosizione(barcodeScanDTO.getStringValue(), onPickingCompleted, onMagazzinoAutomaticoPickingRequest);
|
||||||
|
|
||||||
} else if (UtilityBarcode.isEtichetta128(barcodeScanDTO)) {
|
} else if (UtilityBarcode.isEtichetta128(barcodeScanDTO)) {
|
||||||
this.executeEtichettaEan128(barcodeScanDTO, onComplete);
|
this.executeEtichettaEan128(barcodeScanDTO, onPickingCompleted);
|
||||||
|
|
||||||
} else if (UtilityBarcode.isEanPeso(barcodeScanDTO) && !mForceOnlyUL) {
|
} else if (UtilityBarcode.isEanPeso(barcodeScanDTO) && !mForceOnlyUL) {
|
||||||
this.executeEtichettaEanPeso(barcodeScanDTO, onComplete);
|
this.executeEtichettaEanPeso(barcodeScanDTO, onPickingCompleted);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
this.loadArticolo(barcodeScanDTO.getStringValue(), null, onComplete);
|
this.loadArticolo(barcodeScanDTO.getStringValue(), null, onPickingCompleted);
|
||||||
|
|
||||||
}
|
}
|
||||||
// else {
|
// else {
|
||||||
@ -76,6 +87,7 @@ public class DialogScanArtViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void executeEtichettaEan128(BarcodeScanDTO barcodeScanDTO, RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, List<MtbColr>> onComplete) {
|
private void executeEtichettaEan128(BarcodeScanDTO barcodeScanDTO, RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, List<MtbColr>> onComplete) {
|
||||||
this.mBarcodeRESTConsumer.decodeEan128(barcodeScanDTO, ean128Model -> {
|
this.mBarcodeRESTConsumer.decodeEan128(barcodeScanDTO, ean128Model -> {
|
||||||
|
|
||||||
@ -128,6 +140,27 @@ public class DialogScanArtViewModel {
|
|||||||
}, this::sendError);
|
}, this::sendError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void executeEtichettaPosizione(String stringValue, RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, List<MtbColr>> onComplete, RunnableArgs<MtbDepoPosizione> onMagazzinoAutomaticoPickingRequest) {
|
||||||
|
MtbDepoPosizione foundPosizione = Stream.of(SettingsManager.iDB().getAvailablePosizioni())
|
||||||
|
.filter(x -> x.getPosizione().equalsIgnoreCase(stringValue))
|
||||||
|
.single();
|
||||||
|
|
||||||
|
if (foundPosizione == null) {
|
||||||
|
//Nessuna posizione trovata con questo barcode
|
||||||
|
this.sendError(new ScannedPositionNotExistException());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (foundPosizione.isMagazzinoAutomatico()) {
|
||||||
|
//Eseguo picking da magazzino automatico
|
||||||
|
onMagazzinoAutomaticoPickingRequest.run(foundPosizione);
|
||||||
|
} else {
|
||||||
|
this.executePosizione(foundPosizione, null, onComplete);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void executePosizione(MtbDepoPosizione posizione, MtbAart articolo, RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, List<MtbColr>> onComplete) {
|
private void executePosizione(MtbDepoPosizione posizione, MtbAart articolo, RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, List<MtbColr>> onComplete) {
|
||||||
this.mPosizioniRESTConsumer.getBancaliInPosizione(posizione, mtbColtList -> {
|
this.mPosizioniRESTConsumer.getBancaliInPosizione(posizione, mtbColtList -> {
|
||||||
|
|
||||||
|
|||||||
@ -103,11 +103,12 @@ public class DialogScanOrCreateLUView extends BaseDialogFragment implements Dial
|
|||||||
}).show(requireActivity().getSupportFragmentManager(), "tag");
|
}).show(requireActivity().getSupportFragmentManager(), "tag");
|
||||||
});
|
});
|
||||||
|
|
||||||
var alertDialog = new MaterialAlertDialogBuilder(requireContext())
|
var alertDialog = new MaterialAlertDialogBuilder(requireContext())
|
||||||
.setView(mBindings.getRoot())
|
.setView(mBindings.getRoot())
|
||||||
.setCancelable(false)
|
.setCancelable(false)
|
||||||
.create();
|
.create();
|
||||||
alertDialog.setCanceledOnTouchOutside(false);
|
alertDialog.setCanceledOnTouchOutside(false);
|
||||||
|
alertDialog.setOnShowListener(this);
|
||||||
return alertDialog;
|
return alertDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -17,7 +17,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:padding="8dp"
|
android:paddingHorizontal="8dp"
|
||||||
android:background="?android:attr/selectableItemBackground"
|
android:background="?android:attr/selectableItemBackground"
|
||||||
android:clickable="@{item.enabled}"
|
android:clickable="@{item.enabled}"
|
||||||
android:onClick="@{() -> item.selected.toggle()}">
|
android:onClick="@{() -> item.selected.toggle()}">
|
||||||
|
|||||||
@ -17,7 +17,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:padding="8dp"
|
android:paddingHorizontal="8dp"
|
||||||
android:background="?android:attr/selectableItemBackground"
|
android:background="?android:attr/selectableItemBackground"
|
||||||
android:clickable="@{item.enabled}"
|
android:clickable="@{item.enabled}"
|
||||||
android:onClick="@{() -> item.selected.toggle()}">
|
android:onClick="@{() -> item.selected.toggle()}">
|
||||||
|
|||||||
@ -17,7 +17,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:padding="8dp"
|
android:paddingHorizontal="8dp"
|
||||||
android:background="?android:attr/selectableItemBackground"
|
android:background="?android:attr/selectableItemBackground"
|
||||||
android:clickable="@{item.enabled}"
|
android:clickable="@{item.enabled}"
|
||||||
android:onClick="@{() -> item.selected.toggle()}">
|
android:onClick="@{() -> item.selected.toggle()}">
|
||||||
|
|||||||
@ -17,7 +17,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:padding="8dp"
|
android:paddingHorizontal="8dp"
|
||||||
android:background="?android:attr/selectableItemBackground"
|
android:background="?android:attr/selectableItemBackground"
|
||||||
android:clickable="@{item.enabled}"
|
android:clickable="@{item.enabled}"
|
||||||
android:onClick="@{() -> item.selected.toggle()}">
|
android:onClick="@{() -> item.selected.toggle()}">
|
||||||
|
|||||||
@ -17,7 +17,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:padding="8dp"
|
android:paddingHorizontal="8dp"
|
||||||
android:background="?android:attr/selectableItemBackground"
|
android:background="?android:attr/selectableItemBackground"
|
||||||
android:clickable="@{item.enabled}"
|
android:clickable="@{item.enabled}"
|
||||||
android:onClick="@{() -> item.selected.toggle()}">
|
android:onClick="@{() -> item.selected.toggle()}">
|
||||||
|
|||||||
@ -17,7 +17,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:padding="8dp"
|
android:paddingHorizontal="8dp"
|
||||||
android:background="?android:attr/selectableItemBackground"
|
android:background="?android:attr/selectableItemBackground"
|
||||||
android:clickable="@{item.enabled}"
|
android:clickable="@{item.enabled}"
|
||||||
android:onClick="@{() -> item.selected.toggle()}">
|
android:onClick="@{() -> item.selected.toggle()}">
|
||||||
|
|||||||
@ -17,7 +17,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:padding="8dp"
|
android:paddingHorizontal="8dp"
|
||||||
android:background="?android:attr/selectableItemBackground"
|
android:background="?android:attr/selectableItemBackground"
|
||||||
android:clickable="@{item.enabled}"
|
android:clickable="@{item.enabled}"
|
||||||
android:onClick="@{() -> item.selected.toggle()}">
|
android:onClick="@{() -> item.selected.toggle()}">
|
||||||
|
|||||||
@ -17,7 +17,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:padding="8dp"
|
android:paddingHorizontal="8dp"
|
||||||
android:background="?android:attr/selectableItemBackground"
|
android:background="?android:attr/selectableItemBackground"
|
||||||
android:clickable="@{item.enabled}"
|
android:clickable="@{item.enabled}"
|
||||||
android:onClick="@{() -> item.selected.toggle()}">
|
android:onClick="@{() -> item.selected.toggle()}">
|
||||||
|
|||||||
@ -17,7 +17,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:padding="8dp"
|
android:paddingHorizontal="8dp"
|
||||||
android:background="?android:attr/selectableItemBackground"
|
android:background="?android:attr/selectableItemBackground"
|
||||||
android:clickable="@{item.enabled}"
|
android:clickable="@{item.enabled}"
|
||||||
android:onClick="@{() -> item.selected.toggle()}">
|
android:onClick="@{() -> item.selected.toggle()}">
|
||||||
|
|||||||
@ -17,7 +17,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:padding="8dp"
|
android:paddingHorizontal="8dp"
|
||||||
android:background="?android:attr/selectableItemBackground"
|
android:background="?android:attr/selectableItemBackground"
|
||||||
android:clickable="@{item.enabled}"
|
android:clickable="@{item.enabled}"
|
||||||
android:onClick="@{() -> item.selected.toggle()}">
|
android:onClick="@{() -> item.selected.toggle()}">
|
||||||
|
|||||||
@ -17,7 +17,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:padding="8dp"
|
android:paddingHorizontal="8dp"
|
||||||
android:background="?android:attr/selectableItemBackground"
|
android:background="?android:attr/selectableItemBackground"
|
||||||
android:clickable="@{item.enabled}"
|
android:clickable="@{item.enabled}"
|
||||||
android:onClick="@{() -> item.selected.toggle()}">
|
android:onClick="@{() -> item.selected.toggle()}">
|
||||||
|
|||||||
@ -17,7 +17,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:padding="8dp"
|
android:paddingHorizontal="8dp"
|
||||||
android:background="?android:attr/selectableItemBackground"
|
android:background="?android:attr/selectableItemBackground"
|
||||||
android:clickable="@{item.enabled}"
|
android:clickable="@{item.enabled}"
|
||||||
android:onClick="@{() -> item.selected.toggle()}">
|
android:onClick="@{() -> item.selected.toggle()}">
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
package it.integry.keyobardemulatorscannerlibrary;
|
package it.integry.keyobardemulatorscannerlibrary;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.Looper;
|
||||||
import android.util.Pair;
|
import android.util.Pair;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
|
|
||||||
@ -18,7 +20,8 @@ public class KeyboardEmulatorBarcodeReader implements BarcodeReaderInterface {
|
|||||||
private RunnableArgs<BarcodeScanDTO> mOnScanSuccessfull;
|
private RunnableArgs<BarcodeScanDTO> mOnScanSuccessfull;
|
||||||
private RunnableArgs<Exception> mOnScanFailed;
|
private RunnableArgs<Exception> mOnScanFailed;
|
||||||
private String mTextBarcode = "";
|
private String mTextBarcode = "";
|
||||||
private long mLastCharInsertTime = 0;
|
private final Handler handler = new Handler(Looper.getMainLooper());
|
||||||
|
// private long mLastCharInsertTime = 0;
|
||||||
|
|
||||||
|
|
||||||
public KeyboardEmulatorBarcodeReader(Context applicationContext) {
|
public KeyboardEmulatorBarcodeReader(Context applicationContext) {
|
||||||
@ -54,35 +57,56 @@ public class KeyboardEmulatorBarcodeReader implements BarcodeReaderInterface {
|
|||||||
@Override
|
@Override
|
||||||
public void onKeyEvent(KeyEvent keyEvent) {
|
public void onKeyEvent(KeyEvent keyEvent) {
|
||||||
|
|
||||||
if (keyEvent.getEventTime() - mLastCharInsertTime > 500) {
|
// if (keyEvent.getEventTime() - mLastCharInsertTime > 500) {
|
||||||
mLastCharInsertTime = keyEvent.getEventTime();
|
// mLastCharInsertTime = keyEvent.getEventTime();
|
||||||
mTextBarcode = "";
|
// mTextBarcode = "";
|
||||||
}
|
// }
|
||||||
if (keyEvent.getKeyCode() != KeyEvent.KEYCODE_ENTER) {
|
// if (keyEvent.getKeyCode() != KeyEvent.KEYCODE_ENTER) {
|
||||||
if (keyEvent.getKeyCode() != KeyEvent.KEYCODE_SHIFT_LEFT) {
|
// if (keyEvent.getKeyCode() != KeyEvent.KEYCODE_SHIFT_LEFT) {
|
||||||
mLastCharInsertTime = keyEvent.getEventTime();
|
// mLastCharInsertTime = keyEvent.getEventTime();
|
||||||
if (keyEvent.getUnicodeChar() > 0) {
|
|
||||||
mTextBarcode += (char) keyEvent.getUnicodeChar();
|
|
||||||
} else if (keyEvent.getCharacters() != null) {
|
|
||||||
mTextBarcode = keyEvent.getCharacters();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (mTextBarcode.length() > 0) {
|
|
||||||
|
|
||||||
BarcodeType barcodeType = decodeBarcode(mTextBarcode);
|
handler.removeCallbacks(dispatchBarcode);
|
||||||
BarcodeScanDTO barcodeScanDTO = new BarcodeScanDTO()
|
|
||||||
.setByteValue(mTextBarcode.getBytes())
|
|
||||||
.setStringValue(mTextBarcode)
|
|
||||||
.setType(barcodeType)
|
|
||||||
.setName(barcodeType != null ? barcodeType.toString() : "");
|
|
||||||
|
|
||||||
mOnScanSuccessfull.run(barcodeScanDTO);
|
if (keyEvent.getUnicodeChar() > 0) {
|
||||||
}
|
mTextBarcode += (char) keyEvent.getUnicodeChar();
|
||||||
|
} else if (keyEvent.getCharacters() != null) {
|
||||||
|
mTextBarcode = keyEvent.getCharacters();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handler.postDelayed(dispatchBarcode, 500);
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// if (mTextBarcode.length() > 0) {
|
||||||
|
//
|
||||||
|
// BarcodeType barcodeType = decodeBarcode(mTextBarcode);
|
||||||
|
// BarcodeScanDTO barcodeScanDTO = new BarcodeScanDTO()
|
||||||
|
// .setByteValue(mTextBarcode.getBytes())
|
||||||
|
// .setStringValue(mTextBarcode)
|
||||||
|
// .setType(barcodeType)
|
||||||
|
// .setName(barcodeType != null ? barcodeType.toString() : "");
|
||||||
|
//
|
||||||
|
// mOnScanSuccessfull.run(barcodeScanDTO);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private final Runnable dispatchBarcode = new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
BarcodeType barcodeType = decodeBarcode(mTextBarcode);
|
||||||
|
BarcodeScanDTO barcodeScanDTO = new BarcodeScanDTO()
|
||||||
|
.setByteValue(mTextBarcode.getBytes())
|
||||||
|
.setStringValue(mTextBarcode)
|
||||||
|
.setType(barcodeType)
|
||||||
|
.setName(barcodeType != null ? barcodeType.toString() : "");
|
||||||
|
|
||||||
|
mOnScanSuccessfull.run(barcodeScanDTO);
|
||||||
|
mTextBarcode = "";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
public BarcodeType decodeBarcode(String barcode) {
|
public BarcodeType decodeBarcode(String barcode) {
|
||||||
/*Pattern patternUPCA = Pattern.compile("^[0-9]{12}$");
|
/*Pattern patternUPCA = Pattern.compile("^[0-9]{12}$");
|
||||||
Pattern patternUPCE = Pattern.compile("^[0-1][0-9]{7}$");
|
Pattern patternUPCE = Pattern.compile("^[0-1][0-9]{7}$");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user