Implementato pick extra item sui magazzini automatici

This commit is contained in:
Giuseppe Scorrano 2023-02-08 10:55:33 +01:00
parent bda1328dec
commit 9371e5824f
21 changed files with 294 additions and 53 deletions

View File

@ -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);
}

View File

@ -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.FilterVettoreLayoutView;
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;
public class OrdiniUscitaElencoBindings {
@ -28,6 +29,7 @@ public class OrdiniUscitaElencoBindings {
public static final int TERM_CONS_FILTER_ID = 8;
public static final int DATA_CONS_FILTER_ID = 9;
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<>() {{
put(DEPOSITO_FILTER_ID, new FilterChipDTO()
@ -94,6 +96,12 @@ public class OrdiniUscitaElencoBindings {
.setPosizione(7)
.setFilterChipText("Gruppo merceologico")
.setFilterLayoutView(new FilterGruppoMercLayoutView()));
put(COMMESSA_FILTER_ID, new FilterChipDTO()
.setID(COMMESSA_FILTER_ID)
.setPosizione(11)
.setFilterChipText("Commessa")
.setFilterLayoutView(new FilterCommessaLayoutView()));
}};
}

View File

@ -38,6 +38,7 @@ import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.interfaces.IScrollableFragment;
import it.integry.integrywmsnative.core.interfaces.ISelectAllFragment;
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.MtbColt;
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.secondary.GestioneEnum;
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.model.OrdineUscitaInevasoDTO;
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.ui.OrdiniUscitaElencoAdapter;
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.dialogs.row_info.BaseDialogRowInfoView;
import it.integry.integrywmsnative.ui.ElevatedToolbar;
@ -83,6 +86,9 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
@Inject
ArticoloRESTConsumer mArticoloRESTConsumer;
@Inject
CommessaRESTConsumer mCommessaRESTConsumer;
@Inject
OrdiniUscitaElencoViewModel mViewModel;
@ -104,6 +110,7 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
private List<MtbDepo> mtbDepoCache;
private List<MtbGrup> mtbGrupCache;
private List<JtbComt> jtbComtCache;
public OrdiniUscitaElencoFragment() {
// Required empty public constructor
@ -193,7 +200,9 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
this.mViewModel.getOrderList().observe(getViewLifecycleOwner(), v -> {
this.onLoadingStarted();
this.initMtbGrupsCache(this::onLoadingEnded);
this.initMtbGrupsCache(() -> {
this.initJtbComtCache(this::onLoadingEnded);
});
mAppliedFilterViewModel.init(mViewModel.getOrderList().getValue());
@ -265,6 +274,7 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
mAppliedFilterViewModel.getCurrentTermConsPredicate().addOnPropertyChangedCallback(onPredicateChanged);
mAppliedFilterViewModel.getCurrentDataConsPredicate().addOnPropertyChangedCallback(onPredicateChanged);
mAppliedFilterViewModel.getCurrentGruppoMercPredicate().addOnPropertyChangedCallback(onPredicateChanged);
mAppliedFilterViewModel.getCurrentCommessaPredicate().addOnPropertyChangedCallback(onPredicateChanged);
List<FilterChipDTO> filterList = Stream.of(OrdiniUscitaElencoBindings.AVAILABLE_FILTERS.entrySet())
.map(Map.Entry::getValue)
@ -527,6 +537,31 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
});
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);
@ -559,6 +594,19 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
.getFilterLayoutView();
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:
((FilterDepositoLayoutView) filterLayoutView)
.setAllCodMdeps(mAppliedFilterViewModel.getAllCodMdeps(mtbDepoCache))
@ -865,4 +913,23 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
onComplete.run();
}, 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);
}
}

View File

@ -13,6 +13,7 @@ import java.util.Date;
import java.util.List;
import java.util.Objects;
import it.integry.integrywmsnative.core.model.JtbComt;
import it.integry.integrywmsnative.core.model.MtbDepo;
import it.integry.integrywmsnative.core.model.MtbGrup;
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>> currentPaesePredicate = new ObservableField<>();
private final ObservableField<Predicate<OrdiniUscitaElencoDTO>> currentGruppoMercPredicate = new ObservableField<>();
private final ObservableField<Predicate<OrdiniUscitaElencoDTO>> currentCommessaPredicate = new ObservableField<>();
private Date selectedDataCons = null;
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) {
if (mtbGrupList == null || mtbGrupList.isEmpty()) {
currentGruppoMercPredicate.set(null);
@ -159,7 +169,8 @@ public class VenditaFiltroOrdiniViewModel {
currentIdViaggioPredicate.get() == null &&
currentAgentePredicate.get() == null &&
currentPaesePredicate.get() == null &&
currentGruppoMercPredicate.get() == null
currentGruppoMercPredicate.get() == null &&
currentCommessaPredicate.get() == null
) {
returnList = this.initialOrderList;
} else {
@ -175,7 +186,8 @@ public class VenditaFiltroOrdiniViewModel {
(currentIdViaggioPredicate.get() == null || (currentIdViaggioPredicate.get().test(x))) &&
(currentAgentePredicate.get() == null || (currentAgentePredicate.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();
@ -228,6 +240,10 @@ public class VenditaFiltroOrdiniViewModel {
return currentGruppoMercPredicate;
}
public ObservableField<Predicate<OrdiniUscitaElencoDTO>> getCurrentCommessaPredicate() {
return currentCommessaPredicate;
}
public List<MtbDepo> getAllCodMdeps(List<MtbDepo> mtbDepoFullList) {
List<String> codMdeps = Stream.of(initialOrderList)
.map(OrdineInevasoDTO::getCodMdep)
@ -253,7 +269,8 @@ public class VenditaFiltroOrdiniViewModel {
currentIdViaggioPredicate.get() == null &&
currentAgentePredicate.get() == null &&
currentPaesePredicate.get() == null &&
currentGruppoMercPredicate.get() == null
currentGruppoMercPredicate.get() == null &&
currentCommessaPredicate.get() == null
) {
return getAllCodMdeps(mtbDepoFullList);
} else {
@ -268,7 +285,8 @@ public class VenditaFiltroOrdiniViewModel {
(currentIdViaggioPredicate.get() == null || (currentIdViaggioPredicate.get().test(x))) &&
(currentAgentePredicate.get() == null || (currentAgentePredicate.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)
.distinct()
@ -305,7 +323,8 @@ public class VenditaFiltroOrdiniViewModel {
currentDepositoPredicate.get() == null &&
currentAgentePredicate.get() == null &&
currentPaesePredicate.get() == null &&
currentGruppoMercPredicate.get() == null
currentGruppoMercPredicate.get() == null &&
currentCommessaPredicate.get() == null
) {
return getAllIDViaggio();
} else {
@ -320,7 +339,8 @@ public class VenditaFiltroOrdiniViewModel {
(currentDepositoPredicate.get() == null || (currentDepositoPredicate.get().test(x))) &&
(currentAgentePredicate.get() == null || (currentAgentePredicate.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)
.distinct()
@ -350,7 +370,8 @@ public class VenditaFiltroOrdiniViewModel {
currentDepositoPredicate.get() == null &&
currentAgentePredicate.get() == null &&
currentPaesePredicate.get() == null &&
currentGruppoMercPredicate.get() == null
currentGruppoMercPredicate.get() == null &&
currentCommessaPredicate.get() == null
) {
return getAllNumOrds();
} else {
@ -365,7 +386,8 @@ public class VenditaFiltroOrdiniViewModel {
(currentDepositoPredicate.get() == null || (currentDepositoPredicate.get().test(x))) &&
(currentAgentePredicate.get() == null || (currentAgentePredicate.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)
.distinct()
@ -395,7 +417,8 @@ public class VenditaFiltroOrdiniViewModel {
currentDepositoPredicate.get() == null &&
currentAgentePredicate.get() == null &&
currentPaesePredicate.get() == null &&
currentGruppoMercPredicate.get() == null
currentGruppoMercPredicate.get() == null &&
currentCommessaPredicate.get() == null
) {
return getAllClienti();
} else {
@ -410,7 +433,8 @@ public class VenditaFiltroOrdiniViewModel {
(currentDepositoPredicate.get() == null || (currentDepositoPredicate.get().test(x))) &&
(currentAgentePredicate.get() == null || (currentAgentePredicate.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)
.distinct()
@ -440,7 +464,8 @@ public class VenditaFiltroOrdiniViewModel {
currentDepositoPredicate.get() == null &&
currentAgentePredicate.get() == null &&
currentPaesePredicate.get() == null &&
currentGruppoMercPredicate.get() == null
currentGruppoMercPredicate.get() == null &&
currentCommessaPredicate.get() == null
) {
return getAllVettori();
} else {
@ -455,7 +480,8 @@ public class VenditaFiltroOrdiniViewModel {
(currentDepositoPredicate.get() == null || (currentDepositoPredicate.get().test(x))) &&
(currentAgentePredicate.get() == null || (currentAgentePredicate.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() : ""))
.distinct()
@ -485,7 +511,8 @@ public class VenditaFiltroOrdiniViewModel {
currentDepositoPredicate.get() == null &&
currentAgentePredicate.get() == null &&
currentPaesePredicate.get() == null &&
currentGruppoMercPredicate.get() == null
currentGruppoMercPredicate.get() == null &&
currentCommessaPredicate.get() == null
) {
return getAllAutomezzi();
} else {
@ -500,7 +527,8 @@ public class VenditaFiltroOrdiniViewModel {
(currentDepositoPredicate.get() == null || (currentDepositoPredicate.get().test(x))) &&
(currentAgentePredicate.get() == null || (currentAgentePredicate.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)
.distinct()
@ -530,7 +558,8 @@ public class VenditaFiltroOrdiniViewModel {
currentDepositoPredicate.get() == null &&
currentAgentePredicate.get() == null &&
currentAutomezzoPredicate.get() == null &&
currentGruppoMercPredicate.get() == null
currentGruppoMercPredicate.get() == null &&
currentCommessaPredicate.get() == null
) {
List<String> all = getAllPaesi();
return all;
@ -546,7 +575,8 @@ public class VenditaFiltroOrdiniViewModel {
(currentDepositoPredicate.get() == null || (currentDepositoPredicate.get().test(x))) &&
(currentAgentePredicate.get() == null || (currentAgentePredicate.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)
.distinct()
@ -576,7 +606,8 @@ public class VenditaFiltroOrdiniViewModel {
currentDepositoPredicate.get() == null &&
currentPaesePredicate.get() == null &&
currentAutomezzoPredicate.get() == null &&
currentGruppoMercPredicate.get() == null
currentGruppoMercPredicate.get() == null &&
currentCommessaPredicate.get() == null
) {
List<String> all = getAllAgenti();
return all;
@ -592,7 +623,8 @@ public class VenditaFiltroOrdiniViewModel {
(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)))
(currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x))) &&
(currentCommessaPredicate.get() == null || (currentCommessaPredicate.get().test(x)))
)
.map(OrdineUscitaInevasoDTO::getNomeAgente)
.distinct()
@ -622,7 +654,8 @@ public class VenditaFiltroOrdiniViewModel {
currentDepositoPredicate.get() == null &&
currentPaesePredicate.get() == null &&
currentAutomezzoPredicate.get() == null &&
currentGruppoMercPredicate.get() == null
currentGruppoMercPredicate.get() == null &&
currentCommessaPredicate.get() == null
) {
return getAllTermCons();
} else {
@ -637,7 +670,8 @@ public class VenditaFiltroOrdiniViewModel {
(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)))
(currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x))) &&
(currentCommessaPredicate.get() == null || (currentCommessaPredicate.get().test(x)))
)
.map(OrdineUscitaInevasoDTO::getTermCons)
.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) {
var codMgrp = Stream.of(initialOrderList)
.flatMap(ordiniUscitaElencoDTO ->
@ -676,7 +766,8 @@ public class VenditaFiltroOrdiniViewModel {
currentIdViaggioPredicate.get() == null &&
currentAgentePredicate.get() == null &&
currentPaesePredicate.get() == null &&
currentDepositoPredicate.get() == null
currentDepositoPredicate.get() == null &&
currentCommessaPredicate.get() == null
) {
return getAllGruppoMerc(mtbGrupFullList);
} else {
@ -691,7 +782,8 @@ public class VenditaFiltroOrdiniViewModel {
(currentIdViaggioPredicate.get() == null || (currentIdViaggioPredicate.get().test(x))) &&
(currentAgentePredicate.get() == null || (currentAgentePredicate.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()))
.map(OrdineUscitaInevasoDTO.AvailableClassMerc::getCodMgrp)

View File

@ -656,6 +656,9 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
if (status == DialogConsts.Results.YES) {
this.mViewmodel.dispatchExtraItem(mtbAart, ean128Model, mtbColr);
}
}, pickMagazzinoAutomaticoPosizione -> {
this.onLoadingStarted();
this.mViewmodel.executeEmptyMagazzinoAutomaticoRequest(pickMagazzinoAutomaticoPosizione, this::onLoadingEnded);
})
.show(getSupportFragmentManager(), "tag");
}

View File

@ -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) {
final List<PickingObjectDTO> pickingList = mPickingList.getValue();

View File

@ -5,6 +5,8 @@ import dagger.Provides;
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
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;
@Module(subcomponents = DialogScanArtComponent.class)
@ -14,8 +16,15 @@ public class DialogScanArtModule {
DialogScanArtViewModel providesDialogScanArtViewModel(BarcodeRESTConsumer barcodeRESTConsumer,
ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer,
ArticoloRESTConsumer articoloRESTConsumer,
PosizioniRESTConsumer posizioniRESTConsumer) {
return new DialogScanArtViewModel(barcodeRESTConsumer, colliMagazzinoRESTConsumer, articoloRESTConsumer, posizioniRESTConsumer);
PosizioniRESTConsumer posizioniRESTConsumer,
MagazzinoAutomaticoRESTConsumer magazzinoAutomaticoRESTConsumer,
GiacenzaRESTConsumer giacenzaRESTConsumer) {
return new DialogScanArtViewModel(barcodeRESTConsumer,
colliMagazzinoRESTConsumer,
articoloRESTConsumer,
posizioniRESTConsumer,
magazzinoAutomaticoRESTConsumer,
giacenzaRESTConsumer);
}
}

View File

@ -26,6 +26,7 @@ import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.expansion.RunnableArgssss;
import it.integry.integrywmsnative.core.model.MtbAart;
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.databinding.DialogScanArtBinding;
import it.integry.integrywmsnative.view.dialogs.DialogConsts;
@ -42,17 +43,19 @@ public class DialogScanArtView extends BaseDialogFragment implements DialogScanA
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) {
return new DialogScanArtView(forceOnlyUL, onComplete);
public static DialogScanArtView newInstance(boolean forceOnlyUL, @NotNull RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, MtbColr> onPickingCompleted, RunnableArgs<MtbDepoPosizione> onMagazzinoAutomaticoPickingRequest) {
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();
mForceOnlyUL = forceOnlyUL;
mOnItemChoosed = onItemChoosed;
onPickingCompleted = onItemChoosed;
this.onMagazzinoAutomaticoPickingRequest = onMagazzinoAutomaticoPickingRequest;
}
@Nullable
@ -76,7 +79,7 @@ public class DialogScanArtView extends BaseDialogFragment implements DialogScanA
getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
mBindings.buttonNo.setOnClickListener(v -> {
mOnItemChoosed.run(DialogConsts.Results.ABORT, null, null, null);
onPickingCompleted.run(DialogConsts.Results.ABORT, null, null, null);
dismiss();
});
@ -116,19 +119,24 @@ public class DialogScanArtView extends BaseDialogFragment implements DialogScanA
if (filteredMtbColrList != null && filteredMtbColrList.size() > 1) {
DialogChooseArtFromListaMtbColrView.make(getActivity(), filteredMtbColrList, mtbColrChose -> {
mOnItemChoosed.run(status, mtbAart, ean128Model, mtbColrChose);
onPickingCompleted.run(status, mtbAart, ean128Model, mtbColrChose);
}).show();
} else if (filteredMtbColrList != null && filteredMtbColrList.size() == 1) {
mOnItemChoosed.run(status, mtbAart, ean128Model, filteredMtbColrList.get(0));
onPickingCompleted.run(status, mtbAart, ean128Model, filteredMtbColrList.get(0));
} else {
mOnItemChoosed.run(status, mtbAart, ean128Model, null);
onPickingCompleted.run(status, mtbAart, ean128Model, null);
}
this.onLoadingEnded();
dismiss();
}, pickMagazzinoAutomaticoPosizione -> {
this.onMagazzinoAutomaticoPickingRequest.run(pickMagazzinoAutomaticoPosizione);
this.onLoadingEnded();
dismiss();
});
};

View File

@ -1,5 +1,7 @@
package it.integry.integrywmsnative.view.dialogs.scan_art;
import com.annimon.stream.Stream;
import org.jetbrains.annotations.NotNull;
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.NoLUFoundException;
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.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.expansion.RunnableArgssss;
import it.integry.integrywmsnative.core.model.MtbAart;
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.BarcodeRESTConsumer;
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.model.Ean128Model;
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.UtilityPosizione;
import it.integry.integrywmsnative.core.utility.UtilityString;
@ -31,6 +38,8 @@ public class DialogScanArtViewModel {
private final ColliMagazzinoRESTConsumer mColliMagazzinoRESTConsumer;
private final ArticoloRESTConsumer mArticoloRESTConsumer;
private final PosizioniRESTConsumer mPosizioniRESTConsumer;
private final MagazzinoAutomaticoRESTConsumer mMagazzinoAutomaticoRESTConsumer;
private final GiacenzaRESTConsumer mGiacenzaRESTConsumer;
private boolean mForceOnlyUL;
@ -39,11 +48,13 @@ public class DialogScanArtViewModel {
public DialogScanArtViewModel(BarcodeRESTConsumer barcodeRESTConsumer,
ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer,
ArticoloRESTConsumer articoloRESTConsumer,
PosizioniRESTConsumer posizioniRESTConsumer) {
PosizioniRESTConsumer posizioniRESTConsumer, MagazzinoAutomaticoRESTConsumer mMagazzinoAutomaticoRESTConsumer, GiacenzaRESTConsumer mGiacenzaRESTConsumer) {
this.mBarcodeRESTConsumer = barcodeRESTConsumer;
this.mColliMagazzinoRESTConsumer = colliMagazzinoRESTConsumer;
this.mArticoloRESTConsumer = articoloRESTConsumer;
this.mPosizioniRESTConsumer = posizioniRESTConsumer;
this.mMagazzinoAutomaticoRESTConsumer = mMagazzinoAutomaticoRESTConsumer;
this.mGiacenzaRESTConsumer = mGiacenzaRESTConsumer;
}
public DialogScanArtViewModel setForceOnlyUL(boolean forceOnlyUL) {
@ -51,23 +62,23 @@ public class DialogScanArtViewModel {
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)) {
//Cerco gli articoli presenti nell'ul dell'etichetta anonima
this.executeEtichettaLU(barcodeScanDTO.getStringValue(), onComplete);
this.executeEtichettaLU(barcodeScanDTO.getStringValue(), onPickingCompleted);
} else if (UtilityBarcode.isEtichettaPosizione(barcodeScanDTO)) {
//Cerco l'UL presente all'interno della posizione
// this.executeEtichettaPosizione(barcodeScanDTO.getStringValue(), onComplete);
this.executeEtichettaPosizione(barcodeScanDTO.getStringValue(), onPickingCompleted, onMagazzinoAutomaticoPickingRequest);
} else if (UtilityBarcode.isEtichetta128(barcodeScanDTO)) {
this.executeEtichettaEan128(barcodeScanDTO, onComplete);
this.executeEtichettaEan128(barcodeScanDTO, onPickingCompleted);
} else if (UtilityBarcode.isEanPeso(barcodeScanDTO) && !mForceOnlyUL) {
this.executeEtichettaEanPeso(barcodeScanDTO, onComplete);
this.executeEtichettaEanPeso(barcodeScanDTO, onPickingCompleted);
} else {
this.loadArticolo(barcodeScanDTO.getStringValue(), null, onComplete);
this.loadArticolo(barcodeScanDTO.getStringValue(), null, onPickingCompleted);
}
// else {
@ -76,6 +87,7 @@ public class DialogScanArtViewModel {
}
private void executeEtichettaEan128(BarcodeScanDTO barcodeScanDTO, RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, List<MtbColr>> onComplete) {
this.mBarcodeRESTConsumer.decodeEan128(barcodeScanDTO, ean128Model -> {
@ -128,6 +140,27 @@ public class DialogScanArtViewModel {
}, 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) {
this.mPosizioniRESTConsumer.getBancaliInPosizione(posizione, mtbColtList -> {

View File

@ -17,7 +17,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="8dp"
android:paddingHorizontal="8dp"
android:background="?android:attr/selectableItemBackground"
android:clickable="@{item.enabled}"
android:onClick="@{() -> item.selected.toggle()}">

View File

@ -17,7 +17,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="8dp"
android:paddingHorizontal="8dp"
android:background="?android:attr/selectableItemBackground"
android:clickable="@{item.enabled}"
android:onClick="@{() -> item.selected.toggle()}">

View File

@ -17,7 +17,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="8dp"
android:paddingHorizontal="8dp"
android:background="?android:attr/selectableItemBackground"
android:clickable="@{item.enabled}"
android:onClick="@{() -> item.selected.toggle()}">

View File

@ -17,7 +17,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="8dp"
android:paddingHorizontal="8dp"
android:background="?android:attr/selectableItemBackground"
android:clickable="@{item.enabled}"
android:onClick="@{() -> item.selected.toggle()}">

View File

@ -17,7 +17,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="8dp"
android:paddingHorizontal="8dp"
android:background="?android:attr/selectableItemBackground"
android:clickable="@{item.enabled}"
android:onClick="@{() -> item.selected.toggle()}">

View File

@ -17,7 +17,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="8dp"
android:paddingHorizontal="8dp"
android:background="?android:attr/selectableItemBackground"
android:clickable="@{item.enabled}"
android:onClick="@{() -> item.selected.toggle()}">

View File

@ -17,7 +17,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="8dp"
android:paddingHorizontal="8dp"
android:background="?android:attr/selectableItemBackground"
android:clickable="@{item.enabled}"
android:onClick="@{() -> item.selected.toggle()}">

View File

@ -17,7 +17,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="8dp"
android:paddingHorizontal="8dp"
android:background="?android:attr/selectableItemBackground"
android:clickable="@{item.enabled}"
android:onClick="@{() -> item.selected.toggle()}">

View File

@ -17,7 +17,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="8dp"
android:paddingHorizontal="8dp"
android:background="?android:attr/selectableItemBackground"
android:clickable="@{item.enabled}"
android:onClick="@{() -> item.selected.toggle()}">

View File

@ -17,7 +17,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="8dp"
android:paddingHorizontal="8dp"
android:background="?android:attr/selectableItemBackground"
android:clickable="@{item.enabled}"
android:onClick="@{() -> item.selected.toggle()}">

View File

@ -17,7 +17,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="8dp"
android:paddingHorizontal="8dp"
android:background="?android:attr/selectableItemBackground"
android:clickable="@{item.enabled}"
android:onClick="@{() -> item.selected.toggle()}">

View File

@ -17,7 +17,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="8dp"
android:paddingHorizontal="8dp"
android:background="?android:attr/selectableItemBackground"
android:clickable="@{item.enabled}"
android:onClick="@{() -> item.selected.toggle()}">